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(Scanner.java:862)
at java.util.Scanner.next(Scanner.java:1485)
at java.util.Scanner.nextInt(Scanner.java:2117)
at java.util.Scanner.nextInt(Scanner.java:2076)
at School_of_Geometry.main(Main.java:8)

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.