runtime error(nzec) codechef java

Im participating in JAN19B I have stucked when I was submitting my code and it was giving me nzec. my code is working fine when I run it on codechef itself IDE but I did get why it giving my nzec on submitting.I need help !!!
I also read related post about it on codechef but to be honest I did get anything from there…please tell me in simple way if u can…
problem code is->FANCY it’s vry first problem there
I mentioned problem code here because I did comment also there but noreply :frowning: it’ really disappointing atleast You guys who manage all these things should be there for help others like me.

1 Like

I am also having the same problem. Apparently there is no input when I check. I tried using both Scanner and BufferedReader.

I had this problem on FANCY and HP18

this is the error code for Scanner

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 Main.main(Main.java:20)

while using any reader, say buffered reader please check for null value being read

BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
String S=s.readLine();
if (S != null && !S.trim().equals(""))
{ // in this way u may proceed
//write your code here }

@adeepgarg4 this makes no sense. so I should ignore the first input as it might be null? how would I know how many nulls I would get, and what should I do if I get it later in the code? I’m not following what i’m supposed to do.

@keloy I think you probably did mistake in your main logic may be you trying to access at that limit which is out of input string limit…just carefully read what i said…because i did same mistake before

//