For this Question: Sara has an array Arr of N elements and an element K. Sara loves XOR so she took the xor value of all the possible subarrays(N*(N+1)/2)) from the given array and stored them in non- increasing order. Sara wants to know the kth maximum element of all the subarray's XOR. Since you want to impress Sara give the Kth maximum element before Sara finds it.The first line of input contains N and K.
The second line of input contains N space separated integers.

Constraints:-
1 <= N <= 100000
1 <= K <= (N*(N+1))/2
0 <= Arr[i] <= 2^20Print the Kth maximum element.Sample Input:-
5 5
1 4 3 12 8

Sample Output:-
8

Explanation:-
All xor's:- 15, 12 11 10, 8, 7, 7, 6, 5, 4, 4, 3, 3, 2, 1

Sample Input:-
3 2
1 2 3

Sample Output:-
3

Explanation:-
XOR:- 3 3 2 1 1 0, I have written this Solution Code: import java.io.*;
import java.util.*;


class Main implements Runnable{
	static class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;
		private BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int read()
		{
			if (numChars==-1)
				throw new InputMismatchException();

			if (curChar >= numChars)
			{
				curChar = 0;
				try
				{
					numChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}

				if(numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine()
		{
			String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
		}
		public int nextInt()
		{
			int c = read();

			while(isSpaceChar(c))
				c = read();

			int sgn = 1;

			if (c == '-')
			{
				sgn = -1;
				c = read();
			}

			int res = 0;
			do
			{
				if(c<'0'||c>'9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));

			return res * sgn;
		}

		public long nextLong()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			long res = 0;

			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
				return res * sgn;
		}

		public double nextDouble()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.')
			{
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.')
			{
				c = read();
				double m = 1;
				while (!isSpaceChar(c))
				{
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

		public String readString()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			}
			while (!isSpaceChar(c));

			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next()
		{
			return readString();
		}

		public interface SpaceCharFilter
		{
			public boolean isSpaceChar(int ch);
		}
	}

	public static void main(String args[]) throws Exception
	{
		new Thread(null, new Main(),"Main",1<<26).start();
	}

	void find(int level, int val, int lvlval, long l, long r) {
        int prefix[] = new int[n];
        long cnt[] = new long[1 << 20];

        prefix[0] = a[0] & lvlval;
        for (int i = 1; i < n; ++i) {
            prefix[i] = prefix[i - 1] ^ (a[i] & lvlval);
        }

        cnt[0]++;

        long totcnt = 0;

        for(int i = 0; i < n; ++i) {
            int reqval = val ^ prefix[i];
            totcnt += cnt[reqval];
            cnt[prefix[i]]++;
        }

        long r1 = r, l1 = r - totcnt + 1L;

        if(k >= l1 && k <= r1) {
            if(level == 0) {
                ans = val;
                return;
            }
            find(level - 1, val, lvlval + (1 << (level - 1)), l1, r1);
        }
        else {
            if(level == 0) {
                ans = val + (1 << level);
                return;
            }
            long r2 = l1 - 1L, l2 = l;
            find(level - 1, val + (1 << level), lvlval + (1 << (level - 1)), l2, r2);
        }
	}

	static int ans = 0;
	static int n, a[];
    static long k;

	public void run()
	{
		InputReader sc= new InputReader(System.in);
		PrintWriter w= new PrintWriter(System.out);

		n = sc.nextInt();
		k = sc.nextLong();

		a = new int[n];

		for (int i = 0; i < n; ++i) {
		    a[i] = sc.nextInt();
		}

		find(19, 0, 1 << 19, 1L, (long)n * ((long)n + 1L) / 2L);

        w.print(ans);

		w.close();
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?