JAVA NZEC runtime error always

I am trying to solve a Java problem on CodeChef.
My code runs very fine on my system but shows NZEC on CodeChef.
The same code for C/C++ works fine but not for JAVA
I have searched the internet as much as I could. I tried all the input techniques in Java. Because of such, I couldn’t take part in any Codechef contest as it shows NZEC always.
I have been practicing on Hackerrank and decided to compete on CodeChef. Alas, I might have tried nearly 3-4 days to figure it out but couldn’t.

Exception in thread “main” java.util.NoSuchElementException
at java.util.Scanner.throwFor(
at java.util.Scanner.nextInt(
at java.util.Scanner.nextInt(
at School_of_Geometry.main(

1 Like

Are you trying to Run without providing Custom Input?

Custom input works fine
but upon Running the program it shows NZEC

You might be providing improper inputs, as this exception is thrown when there is no custom input provided or some input is missing.

Are you afraid of getting a red colored WA ?

The way i judge my code before hitting the submit button is to check if this is the only error after hitting Run button on CodeChef Ide

NZEC error on Input Line. Works Fine.

To remove the NZEC , Switch to Ide-mode, Provide a custom input ,then it won’t get a null value to parse and won’t throw a NumberFormatException.
CodeForFun :grinning:

I also faced this issue. Use Scanner for inputs(if you are using BufferedReader).

I am used Scanner but still its show nzec error.

1 Like