Help me in solving AOCV208 problem

My issue

my code running perfectly on vs code but here its showing other result

My code

// Update your code below to solve the problem


#include <bits/stdc++.h>
using namespace std;

int main() 
{
	int t; int teama;
	int teamb; int count1=0;
	int count2=0;
    cin >> t;
	
	while(t--)
	{
	    int A[10];
	    for(int i = 0; i < 10; i++)
	    {
	        cin >> A[i];
	    }
	    for(int i=0;i<=10;i=i+2){
	        if(A[i]==1)
	        count1++;
	    }
	     for(int i=1;i<=10;i=i+2){
	        if(A[i]==1)
	        count2++;
	     }
	     if(count2==count1){
	         cout<<0<<endl;
	     }
	     else if(count2 >count1){
	    cout<<2<<endl;
	         
	     }
	 else{
	cout<<1<<endl;
	     
	 }
}
}

Learning course: C++ for problem solving - 2
Problem Link: CodeChef: Practical coding for everyone

@sheetalme10
Here I have done slight modification to your program .
since the program must run more than once, the value of count1 and count2 must be rest to 0 each time it repeats .
Therefore mention the initialization inside the while loop.
In your for loop , it must iterate only 10 times yours would run 11 times because of equal to sign.

[quote=“sheetalme10, post:1, topic:110452”]
for(int i=1;i<=10;i=i+2)
while counting counting count1 and count2

This is the modified program

include <bits/stdc++.h>
using namespace std;

int main()
{
int t;
cin >> t;

while(t--)
{
    
    int count2=0;
    int count1=0;
    int A[10];
    for(int i = 0; i < 10; i++)
    {
        cin >> A[i];
    }
    for(int i=0;i<10;i=i+2){
        if(A[i]==1)
        count1++;
    }
     for(int i=1;i<10;i=i+2){
        if(A[i]==1)
        count2++;
     }
     if(count2==count1){
         cout<<"0"<<endl;
     }
     else if(count2 >count1){
    cout<<"2"<<endl;}
    	 else{
    cout<<"1"<<endl;
}
}

return 0;
}

thanks count1 and count2 must be given 0 every time in while loop.