My code: for famous digit game problem from latest contest::
include <bits/stdc++.h>
using namespace std;
define ll long long
define dd double
define pb push_back
void accept(int arr[], ll size){for(ll h=0;h<size;h++){cin>>arr[h];}} void accept_vector(vector&arr,ll n){for(ll i =0;i<n;i++){cin>>arr[i];}}
int main() { ll T; cin>>T; for(ll test_case=0;test_case<T;test_case++){
ll n, n1; ll raze_flag=0,breach_flag=0; cin>>n; cin>>n1; ostringstream strg; strg<< n1; string s = strg.str(); for(ll i =0;i<n;i++){ if(i%2==0){ if((s[i]-'0')%2!=0) raze_flag++; } else{ if((s[i]-'0')%2==0) breach_flag++; } if(raze_flag&&breach_flag) break; } if(n%2==0) { if(breach_flag>0) cout<<"2"<<endl; else cout<<"1"<<endl; } else { if(raze_flag>0) cout<<"1"<<endl; else cout<<"2"<<endl; } // s.clear();
}