Why am I getting runtime errors?

Every problem has two buttons:

  • Compile and Run
  • Submit

When you click Compile and Run, the code that you have submitted is tested against the sample input and sample output. This helps you understand whether your code is working correctly by running it against the sample test cases for the problem.

When you click Submit, the code is checked against internal test cases. These test cases take your code through rigorous checks to ensure that your code passes all the test cases.

Test cases check whether your code:

  1. Runs within the stipulated time. If it does not, it results in the Time Limit Exceeded (TLE) error.
  2. Runs within the given memory size. If it does not, it results in the Memory Limit Exceeded (MLE) error.
  3. Has runtime errors
  4. Solves the problem statement with a correct answer. If the answer isn’t correct, it results in the Wrong Answer (WA) error which means that your program is not printing the correct answer. Ensure that your program conforms to the exact output format that is required.