For this Question: This is a time of conflict in Westeros as Viserys Targaryen, the king of all seven kingdoms, rejected the hand of Lady Laena Velaryon. So, the Velaryon soldiers are not deemed trustworthy anymore. The Targaryen soldiers have to keep an eye on them.

You are given a sequential order of N soldiers standing in a line. The order is provided as a binary string, with 0 representing Velaryon soldiers, and 1 representing the Targaryen soldiers. Viserys wants each contiguous segment of N/2 soldiers to contain an even number of Targaryen soldiers. 

Formally you are given a binary string of length N, where N is an even natural number. Each character of the string is either '0' or '1'. You want to rearrange the elements of the string in such a way that the final string contains an even number of 1s in each contiguous subsegment of length N/2.

Your task is to find out whether there exists a rearrangement of the soldiers that satisfies the above conditions.The first line contains an integer T, the number of test cases. Then, T test cases follow.
The first line of each test case contains an even positive integer N, the length of the line. 
The second line of each test case contains a binary string of length N, representing the current arrangement of soldiers.

<b> Constraints: </b>
1 ≤ T ≤ 10
2 ≤ N ≤ 10<sup>4</sup>
N is evenPrint a single character in a new line for each test case. Print '1' (without quotes) if a required rearrangement exists, and '0' (without quotes) otherwise.Sample Input:
3
2
10
2
00
4
0011

Sample Output:
0
1
0

(In the last case, no matter how you rearrange the string, there will always be a single one in at least one subsegment of  length 2 of the string), I have written this Solution Code: import java.io.*;
import java.util.*;

class Main{

	public static void main(String[] args)throws IOException
	{
		StringBuilder out=new StringBuilder();
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int test=Integer.parseInt(br.readLine());
		while(test-->0)
		{
			int n=Integer.parseInt(br.readLine());
			String s=br.readLine();
			int c1=0;
			for(int i=0;i<s.length();i++)
			{
			    if(s.charAt(i)=='1') c1++;
			}
			if(c1%4==0) out.append("1\n");
            else if(c1==s.length() && (c1/2)%2==0) out.append("1\n");
			else
			out.append("0\n");
		}
		System.out.print(out);
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?