program testing
#include <iostream> #include <string> #include <math.h> using namespace std; int main() { // your code goes here int q; cin>>q; while(q--){ int n; cin>>n; string s1,s2; cin>>s1>>s2; int count1=0,count2=0,zero=0; int both=0; for(int i=0;i<n;i++){ if(s1[i]=='1' && s2[i]=='1'){ both++; } else if(s1[i]=='1'){ count1++; } else if(s2[i]=='1'){ count2++; } else{ zero++; } } int minu=n; int count=min(count1,count2); minu-=count*2; minu-=both; int all=min(both,minu); all+=count; cout<<all<<"\n"; } return 0; } This program is running correct and according to all test cases I checked it is correct but giving wrong answer when I submit. Please can anyone check for inputs. This is the question: https://www.codechef.com/COOK132C/problems/TEAMFOR for inputs: 4 3 101 001 4 1010 0110 3 000 110 2 10 11 its correct output: 1 2 0 1