For this Question: You are given Q queries. In each query, determine whether there exists an array A of size N such that:

1. All the elements are positive integers.

2. The number of subarrays such that their XOR-sum is 0 is exactly K. In other words, there are exactly K pairs of integers (l, r) such that 1 &le; l &le; r &le; N and A<sub>l</sub> &oplus; A<sub>l+1</sub> &oplus; ... A<sub>r</sub> = 0. 

If there exists such an array, print "YES", otherwise print "NO".The first line of the input contains a single integer Q — the number of queries (1 &le; Q &le; 10<sup>5</sup>).
Q lines follow, each line containing two space separated integers N (1 &le; N &le; 1000) and K (0 &le; K &le; N(N+1)/2).For each test case, print "YES", if there exists such an array, otherwise print "NO" (without the quotes).

Note that the output is case sensitive.Sample Input
3
2 2
3 2
2 1

Sample Output
NO
YES
YES, I have written this Solution Code: import java.io.*;
import java.util.*;

class Main {
    FastScanner in;
    PrintWriter out;
    boolean systemIO = true;
    int MAXSUM = 250000;

    int[] dp = new int[MAXSUM];
    int[] minn = new int[MAXSUM];

    public void precalc() {
        for (int i = 1; i < minn.length; i++) {
            minn[i] = 1002;
            dp[i] = 1002;
        }
        for (int step = 2; step <= 501; step++) {
            int delta = step * (step - 1) / 2;
            for (int j = 0; j + delta < MAXSUM; j++) {
                if (dp[j] + step < dp[j + delta]) {
                    dp[j + delta] = dp[j] + step;
                    minn[j + delta] = Math.min(minn[j + delta], Math.max(dp[j + delta] - 1, 2 * step - 2));
                }
            }
        }
    }

    public boolean clever(int n, int k) {
        if (k >= MAXSUM) {
            return false;
        }
        return n >= minn[k];
    }

    public void solve() {
        precalc();
        for (int qwerty = in.nextInt(); qwerty > 0; --qwerty) {
            int n = in.nextInt();
            int k = in.nextInt();
            if (clever(n, k)) {
                out.println("YES");
            } else {
                out.println("NO");
            }
        }
    }

    public void run() {
        try {
            if (systemIO) {
                in = new FastScanner(System.in);
                out = new PrintWriter(System.out);
            } else {
                String fileName = "60-huge-inexact";
                in = new FastScanner(new File(fileName + ".txt"));
                out = new PrintWriter(new File(fileName + ".out"));
            }
            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }

    }
    public static void main(String[] arg) {
        long time = System.currentTimeMillis();
        new Main().run();
        System.err.println(System.currentTimeMillis() - time);
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?