Help me in solving AOJ08 problem

My issue

My code

import java.util.*;

class Codechef
{
	public static void main (String[] args)
	{
		Scanner read = new Scanner(System.in);
		int c=0,d=0;
		int t = read.nextInt();
		int ele;
		for(int i=0; i<t; i++)
		{
    		int n = 10;
    		ArrayList<Integer> a = new ArrayList<Integer>();
    		for(int j=0; j<n; j++){
    		    ele = read.nextInt();
    		    a.add(ele);
    		}
    		// Update your code below this line to solve the problem
for(int k=0;k<10;k=k+2){
    if(a.get(k)==1){
    c=c+1;
}
		}
		
		for(int k=1;k<10;k=k+2){
    if(a.get(k)==1){
    d=d+1;
}
		}
		if(c>d){System.out.println(1);}
		else if(c==d){System.out.println(0);}
		else{System.out.println(2);}
	}
}}

Learning course: Placement preparation using Java
Problem Link: CodeChef: Practical coding for everyone