NZEC Error in UNONE

Facing NZEC Error in codechef compiler but this code runes fine in IDEA.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

class UNONE {
static class FastReader {
BufferedReader br;
StringTokenizer st;

    public FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}

public static void main(String[] args) {
    FastReader s = new FastReader();

    int t = s.nextInt();

    while (t-- > 0) {
        int n = s.nextInt(), counter1 = 0, counter2 = 0;

        String z = s.nextLine();
        String[] a = z.split(" ");
        StringBuilder str = new StringBuilder(z);
        String h = str.reverse().toString().trim();
        String[] b = h.split(" ");

        String x1 = "", x2 = "";

        for (int i = 0; i < n; i++) {
            x1 += Integer.toBinaryString(Integer.parseInt(a[i]));
            x2 += Integer.toBinaryString(Integer.parseInt(b[i]));
        }

        for (int i = 1; i < x1.length(); i++) {
            if(x1.charAt(i - 1) == x1.charAt(i))
            counter1++;

            if (x2.charAt(i - 1) == x2.charAt(i))
                counter2++;
        }

        if (counter1 < counter2)
            System.out.println(z);
        else
            System.out.println(h);
    }
}

}

Consider the test input:

1
3
10 1 0