# Regarding CPLAY

it is related to this Question – Penalty Shoot-out - Submit | CodeChef

can someone say what’s wrong with my code?

void solve(string s){

``````ll score_a = 0, score_b = 0;

ll shoot_a = 5, shoot_b = 5;

for(int i = 0; i<=9; i+=2){

if(s[i]=='1'){

shoot_a--;

score_a++;

}

else shoot_a--;

if(s[i+1]=='1'){

shoot_b--;

score_b++;

}

else shoot_b--;

if(score_a > shoot_b+score_b){

cout<<"TEAM-A "<<i+2<<endl;

//break;

return;

}

if(score_b > shoot_a+score_a){

cout<<"TEAM-B "<<i+1<<endl;

//break;

return;

}

}

int flag = 0;

for(int i=10; i<=19; i+=2){

if(s[i]=='1' && s[i+1]=='0'){

if(score_a>=score_b){

flag=1;

cout<<"TEAM-A "<<i+2<<endl;

//break;

return;

}

else if(score_a < score_b) score_a++;

}

else if(s[i]=='0' && s[i+1]=='1'){

if(score_b>=score_a){

flag=1;

cout<<"TEAM-B "<<i+1<<endl;

//break;

return;

}

else if(score_b < score_a) score_b++;

}

else if(s[i]=='1' && s[i+1]=='1'){

if(score_a == score_b){

score_a++;

score_b++;

}

else if((score_a>score_b) && (score_a-score_b>=1)){

flag=1;

cout<<"TEAM-A "<<i+2<<endl;

//break;

return;

}

else if((score_b>score_a) && (score_b-score_a>=1)){

flag=1;

cout<<"TEAM-B "<<i+2<<endl;

//break;

return;

}

}

}

if((score_a==score_b) && flag==0 ) cout<<"TIE"<<endl;

return;
``````

}

int main(){

``````ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

//this is fast I/O (inputput output) use header file <cstdio>

string s;

while(cin>>s){

solve(s);

}

return 0;
``````

}