Help me in solving AOJ08 problem

Thanks for the help @dpcoder_007

@swapnil_1994
U have to initialize teamA ans teamB=0 in the test case loop.
i have corrected in your code

import java.util.*;

class Codechef
{
	public static void main (String[] args)
	{
		Scanner read = new Scanner(System.in);
		
		int t = read.nextInt();
		int ele;
		for(int i=0; i<t; i++)
		{
		    int teamA=0;
		int teamB=0;
    		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<a.size(); k++){
    		    
    		    if(k%2==0){ //teamA count
    		        
    		        if(a.get(k)==1){
    		            teamA= teamA+1;
    		        }
    		    }
    		    else{
    		         if(a.get(k)==1){
    		            teamB= teamB+1;
    		        }
    		    }
    		        
    		    }
    		    if(teamA>teamB)
    		    System.out.println("1");
    		    else if (teamB>teamA)
    		    System.out.println("2");
    		    else
    		    System.out.println("0");
    		}
    		
		
	}
}