What is wrong with this code?

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

class check
{
    static int[] arr;
    
    static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;
 
        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }
 
        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }
 
        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }
 
        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');
 
            if (neg)
                return -ret;
            return ret;
        }
 
        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }
 
        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
 
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
 
            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }
 
            if (neg)
                return -ret;
            return ret;
        }
 
        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }
 
        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }
 
        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }
    
    public static void main (String[] args) throws java.lang.Exception
    {
        Reader s = new Reader();
        int t=0, ind = 0;
        t = Integer.parseInt(s.readLine());
        if(t>=1 && t<=5)  // checking constraint for T
        {
            for(int i=1; i<=t; i++)
            {
                String input_case = s.readLine();
                int n = Integer.parseInt(input_case.substring(0,input_case.indexOf(' ')));
                int q = Integer.parseInt(input_case.substring(input_case.indexOf(' ')+1,input_case.length()));
                if(n < 1 || q < 1 || n > 100000 || q > 100000)
                System.exit(0);
                arr = new int[n];
                String snak_det = s.readLine();
                snak_det = (" ".concat(snak_det.trim())).concat(" ");
                ind = 0;
                for(int j=1; j<=n; j++)
                {
                    int value = Integer.parseInt(snak_det.substring(ind+1, snak_det.indexOf(' ',ind+1)).trim());
                    if(value < 1 || value > 1000000000)
                    System.exit(0);
                    arr[j-1] = value;
                    ind = snak_det.indexOf(' ',ind+1);
                }
                ind = 0;
                selectionSort();
                for(int k=1; k<=q; k++)
                {
                    int input_query = Integer.parseInt(s.readLine());
                    if(input_query < 1 || input_query > 1000000000)
                    System.exit(0);
                    System.out.println(giveOutput(input_query));
                }
            }
        }
    }

    static void selectionSort()
    {
        for (int i = 0; i < arr.length-1; i++)
        {
            int min = i;
            for (int j = i+1; j < arr.length; j++)
            if (arr[j] < arr[min]) min = j;
            int temp = arr[i];
            arr[i] = arr[min];
            arr[min] = temp;
        } 
    }


    static int giveOutput(int query)
    {
        int output=0, noe = 0;
        boolean flag = true;
        int i=arr.length-1;
        while(i>=0)
        {
            if(arr[i] >= query)
            {
                output++;
                i--;
                continue;
            }
            if(flag)
            {
                noe = i;
                flag = false;
            }
            if(arr[i]+noe<query)
                break;
            output++;
            noe = (arr[i]+noe)-query;
            i--;
        }
        return output;
    }
}

Its working perfectly on my machine but throws NullPointerExcpetion while compiling on online IDE

P.S. I used the Reader class code to take input. The code is used from here

Have a look here-

or

I am sorry, i dont use Java, so i cant help much. This error generally means that you have some pointer which is pointing nowhere.