Why do i get this NZEC all the time saying this as error in java as below

Exception in thread “main” java.lang.NullPointerException
at java.util.StringTokenizer.(StringTokenizer.java:199)
at java.util.StringTokenizer.(StringTokenizer.java:236)
at Codechef$InputReader.next(Main.java:16)
at Codechef$InputReader.nextInt(Main.java:23)
at Codechef.main(Main.java:83)

Using a try-catch block around your code might fix your problem.

let’s see

Can u give an example code that you submitted which gave NZEC error?

i am trying to use all types of fastios from java users so this is one among them giving errors

can anyone atleast provide me the fastIOs in java

Bro, I am asking for your answer which is giving the error

no bro i just copy pasted the code given in the link… i am checking if the fastio in it works for me too i mean that’s my answer too

can i talk to u directly

In my case too when I try to run the code it gives the same error, but if you submit it then there will be no error of this type. This may be due to the fact that we are running the code without any input, rather if you use custom input and then try to run, you will not get this error.

1 Like

true… no error in case of custom input

1 Like

You understood the Q wrong, you have to add the previous score of the player too.

See this :

for(int i = 0;i<t;i++)
		    String temp = bf.readLine();
		    firstScore = firstScore+Integer.parseInt(temp.split(" ")[0]);
		    secondScore = secondScore+Integer.parseInt(temp.split(" ")[1]);
		    if(firstScore>secondScore && (firstScore - secondScore)>lead)
		        winner  = 1;
		        lead = firstScore - secondScore;
		   else if(firstScore<secondScore && (secondScore - firstScore)>lead)
		       winner = 2;
		       lead = secondScore - firstScore;
		System.out.println(winner+" "+lead);

This is because when you run without input any input class of java such as scanner will throw null pointer exception as they didn’t get any input to be stored.

try using try and catch block

If you want fastIO template use
SecondThread’s from Codeforces