Types of errors

You may see the following types of errors while solving programming problems: 

S. No.

Error

Description

1

NZEC

(Non-zero exit code) 

Displayed when a program exits and returns a value other than 0 to the shell

  • In C/C++ 
    • You forget to add "return 0" at the end of the program.
    • Your program threw an exception, which was not caught
    • Your program is trying to allocate too much memory in a vector
  • In interpreted languages (for e.g., Python)
    • Usually means that your program has either crashed or raised an uncaught exception
    • Many runtime errors
    • Usage of an external library that is not used by the judge

 2

 SIGSEGV

(Segmentation fault)

A common error that is caused by an out-of-scope array index that is causing a buffer overflow or an incorrectly initialized pointer etc.

Generated when a program tries to read or write the data that is outside the memory that is allocated for it or to write memory that can only be read. For example, accessing a [-1] in a language that does not support negative indices for an array will throw this error.

3

SIGFPE

(Floating point error)

Usually occurs when you are trying to:

  • Divide a number by 0
  • Calculate the square root of a negative number

4

SIGABRT

(Fatal error)

Raised by the program when:

  • Judge aborts your program in the middle of execution
  • Memory is not sufficient

5

SIGXFSZ

(Output is too large)

Raised by the program when there is too much data to print

6

TLE

(Time Limit Exceeded)

Raised by the program when your program is too slow

7

MLE

(Memory Limit Exceeded)

Raised by the program when you try to allocate the memory beyond the indicated limit

For example, if you declare a very large array, or if a data structure in your program is too large

8

RE

(Runtime error)

Usually occurs when a program is compiled successfully but ends with an error or crashes

9

CE

(Compilation Error)

Usually occurs when the compiler fails to compile your code due to errors in the code errors in the compiler itself

10

CV

(Problem constraint violation)

Displayed when the program violates at least one of the problem constraints

For example,

  • If you have created too many tables
  • Inserted too many rows inside a table 

11

Other errors

Raised by the program when:

  • You use too much memory
  • Arrays or other elements are too large to fit in the memory
  • There is a SIGSEGV error

Runtime errors

These errors occur when:

  • Invalid mathematical operations are executed. For example, when you try to divide a number by zero, calculate the square root of a negative number, etc.
  • Programs crash because of a segmentation fault. For example, an out-of-scope array index causes a buffer overflow, incorrectly initialized pointers, etc.
  • Your program has printed more than the maximum limit of data to the standard output.

Notes

  • Applicable to programming problems only
  • Limited only to the following languages: C, C++, Java, Python, Python 3

How are runtime errors displayed?

Runtime errors are displayed by highlighting these errors in the code editor on your test interface. When a runtime error occurs, you will see next to the line that caused the error in the code editor. When you hover over, they will see a detailed error message.

Tips to avoid runtime errors in your code

  • Do not use the variables that have not been initialized. These may be set to 0 on your computer but are not guaranteed to be on the judge.
  • Check every single occurrence of accessing an array element and ensure that it is not out of bounds.
  • Do not declare too much memory. A memory of 64 MB is guaranteed but having an array of size [100000] [100000] will not work.
  • Do not declare too much stack memory. Large arrays should be declared globally outside the function. Putting an array of 100000 integers inside a function will probably give you an error.

Output errors

These errors occur when your output has the following:

  • Only one line but the correct output requires more than one line.  
  • Non-numeric characters, whereas the correct output requires only numeric characters.
  • Negative numbers, whereas the correct output requires only positive numbers.
  • Extra empty lines because of printing more new lines '\\n' than expected o Intermediate spaces