Getting NZEC runtime error while same code is working on IDE

I coded a solution in JAVA(Hotspot 8u112) as provided by codechef IDE,

/* package codechef; // don't place package name! */

import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.lang.* ;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
	static class FastScanner{
        BufferedReader br ;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(;
        String next(){
            while(st==null || !st.hasMoreElements()){
                try {
                    st = new StringTokenizer(br.readLine()) ;
                } catch (IOException ex) {
                    System.out.println("error") ;
            return st.nextToken() ;
        int nextInt(){
            return Integer.parseInt(next()) ;
   public static void main(String args[]){
    FastScanner sc = new FastScanner(); 
    int T=sc.nextInt() ;
    int n ;
      n = sc.nextInt() ;
      int[] arr = new int[n] ;
      int max=0;
      for(int i=0;i<n; ++i){
          arr[i] = sc.nextInt()*20 ;
      for(int i=0;i<n; ++i){
          arr[i]-=(sc.nextInt()*10) ;
          max=(max<arr[i])?arr[i]:max ;

But, this encounters a RTE, stated as NZEC

Exception in thread "main" java.lang.NullPointerException
	at java.util.StringTokenizer.<init>(
	at java.util.StringTokenizer.<init>(
	at Codechef$
	at Codechef$FastScanner.nextInt(
	at Codechef.main(

while the same code runs perfectly on my IDE(NeTbeans 9.0).

Can anyone tell-
a) Why so? What care needs to be taken on codechef.
b) How i can fix it?

You are getting this error because you are not providing inputs.

Click on the check box “Custom Input” and then provide input then it’ll work like a charm ; P

1 Like

Thanks for quick & clear guidance…:grinning:

String s=br.readLine();
String ss[]=s.split(" ");
I am getting the same error in the second line. Even with custom input the code does not work. Codechef is a shit. If you are a JAVA programmer find a better place to code because this is not a JAVA friendly environment. ***holes.