ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)

Previous submission (verdict: Time limit exceeded on test 9):
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(),v.end()
#define int long long
#define endl "\n"
#define fi first
#define se second
#define vi vector<int>
#define vii vector<vector<int>>
#define pii pair<int,int>
#define eb emplace_back
const int mod=1e9+7;
const int inf=1e18;
void solve(){
	int n,m;
	cin>>n>>m;
	map<int,int>c;
	vi a(n),b(m);
	for(int i=0;i<n;i++){
		cin>>a[i];
		c[a[i]]++;
	}
	int f=1;
	for(int i=0;i<m;i++){
		cin>>b[i];
	}
	for(int i=0;i<n;i++){
		if(c[b[i]]) c[b[i]]--;
		else{
			map<int,int> c2=c;
			int cnt=n;
			function<bool(int)> sch=[&](int k){
				if(c2[k]){
					c2[k]--;
					cnt--;
					return true;
				}
				if(k==1||k==0) return false;
				if(k%2==0){
					if(sch(k/2)&&sch(k/2)) return true;
					else return false;
				}
				else{
					if(sch(k/2)&&sch(k/2+1)) return true;
					else return false;
				}
			};
			if(sch(b[i])){
				c=c2;
				n=cnt+1;
			}
			else f=0;
		}		
	}
	if(f&&n==m) cout<<"YES\n";
	else cout<<"NO\n";
}
signed main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1;
	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

Submission (verdict: Time limit exceeded on test 9):
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(),v.end()
#define int long long
#define endl "\n"
#define fi first
#define se second
#define vi vector<int>
#define vii vector<vector<int>>
#define pii pair<int,int>
#define eb emplace_back
const int mod=1e9+7;
const int inf=1e18;
void solve(){
	int n,m;
	cin>>n>>m;
	map<int,int>c;
	vi a(n),b(m);
	for(int i=0;i<n;i++){
		cin>>a[i];
		c[a[i]]++;
	}
	int f=1;
	for(int i=0;i<m;i++){
		cin>>b[i];
	}
	for(int i=0;i<n;i++){
		if(c[b[i]]) c[b[i]]--;
		else{
			map<int,int> c2=c;
			int cnt=n;
			function<bool(int)> sch=[&](int k){
				if(c2[k]){
					c2[k]--;
					cnt--;
					return true;
				}
				if(k==1||k==0) return false;
				if(k%2==0){
					if(sch(k/2)&&sch(k/2)) return true;
					else return false;
				}
				else{
					if(sch(k/2)&&sch(k/2+1)) return true;
					else return false;
				}
			};
			if(sch(b[i])){
				c=c2;
				n=cnt+1;
			}
			else{
				f=0;
				break;	
			}
		}		
	}
	if(f&&n==m) cout<<"YES\n";
	else cout<<"NO\n";
}
signed main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1;
	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}
Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)

Previous submission (verdict: Time limit exceeded on test 9):
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(),v.end()
#define int long long
#define endl "\n"
#define fi first
#define se second
#define vi vector<int>
#define vii vector<vector<int>>
#define pii pair<int,int>
#define eb emplace_back
const int mod=1e9+7;
const int inf=1e18;
void solve(){
	int n,m;
	cin>>n>>m;
	map<int,int>c;
	vi a(n),b(m);
	for(int i=0;i<n;i++){
		cin>>a[i];
		c[a[i]]++;
	}
	int f=1;
	for(int i=0;i<m;i++){
		cin>>b[i];
	}
	for(int i=0;i<m;i++){
		if(c[b[i]]) c[b[i]]--;
		else{
			map<int,int> c2=c;
			int cnt=n;
			function<bool(int)> sch=[&](int k){
				if(c2[k]){
					c2[k]--;
					cnt--;
					return true;
				}
				if(k==1||k==0) return false;
				if(k%2==0){
					if(sch(k/2)){
						if(sch(k/2)){
							return true;
						}
						else return false;
					} 
					else return false;
				}
				else{
					if(sch(k/2)){
						if(sch(k/2+1)) return true;
						else return false;
					}
					else return false;
				}
			};
			if(sch(b[i])){
				c=c2;
				n=cnt+1;
			}
			else{
				f=0;
				break;	
			}
		}		
	}
	if(f&&n==m) cout<<"YES\n";
	else cout<<"NO\n";
}
signed main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1;
	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

Submission (verdict: Time limit exceeded on test 9):
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(),v.end()
#define int long long
#define endl "\n"
#define fi first
#define se second
#define vi vector<int>
#define vii vector<vector<int>>
#define pii pair<int,int>
#define eb emplace_back
const int mod=1e9+7;
const int inf=1e18;
void solve(){
	int n,m;
	cin>>n>>m;
	map<int,int>c;
	vi a(n),b(m);
	for(int i=0;i<n;i++){
		cin>>a[i];
		c[a[i]]++;
	}
	int f=1;
	for(int i=0;i<m;i++){
		cin>>b[i];
	}
	int cnt;
	map<int,int> c2;
    function<bool(int)> sch=[&](int k){
		if(c2[k]){
			c2[k]--;
			cnt--;
			return true;
		}
		if(k==1||k==0) return false;
		if(k%2==0){
			if(sch(k/2)){
				if(sch(k/2)) return true;
				else return false;
			}
			else return false;
		}
		else{
			if(sch(k/2)){
				if(sch(k/2+1)) return true;
				else return false;
			}
			else return false;
		}
	};	
	for(int i=0;i<m;i++){
		if(n<m){
			f=0;
			break;
		}
		if(c[b[i]]) c[b[i]]--;
		else{
			c2=c;
			cnt=n;
			if(sch(b[i])){
				c=c2;
				n=cnt+1;
			}
			else{
				f=0;
				break;	
			}
		}		
	}
	if(f&&n==m) cout<<"YES\n";
	else cout<<"NO\n";
}
signed main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1;
	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        string a,b,c;
        cin>>a>>b>>c;
        int n1=a.length(),n2=b.length(),n3=c.length();
        int dp[n3+1][n1+1];
        for(int i=0;i<=n3;i++){
            for(int j=0;j<=n1;j++){
                dp[i][j]=2e3+1;
            }
        }
        dp[0][0]=0;
        for(int i=0;i<n3;i++){
            for(int j=1;j<=(i+1);j++){
                int x=0,y=0;
                int cmp1=c[i]-'a',cmp2=a[j-1]-'a',cmp3=(i>=j)?(b[i-j]-'a'):(-1);
                if(cmp1!=cmp2){
                    x=1;
                }
                if(cmp3!=-1&&cmp1!=cmp3){
                   y=1;
                }
                dp[i+1][j]=min(dp[i+1][j],dp[i][j-1]+x);
                if(cmp3!=-1){
                    dp[i+1][j]=min(dp[i+1][j],dp[i][j]+y);
                }
            }
        }
        cout<<dp[n3][n1]<<endl;
    }
    return 0;
}

Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        string a,b,c;
        cin>>a>>b>>c;
        int n1=a.length(),n2=b.length(),n3=c.length();
        int dp[n3+1][n1+1];
        for(int i=0;i<=n3;i++){
            for(int j=0;j<=n1;j++){
                dp[i][j]=2e3+1;
            }
        }
        dp[0][0]=0;
        for(int i=0;i<n3;i++){
            for(int j=0;j<=(i+1);j++){
                int x=0,y=0;
                int cmp1=c[i]-'a',cmp2=a[j-1]-'a',cmp3=(i>=j)?(b[i-j]-'a'):(-1);
                if(cmp1!=cmp2){
                    x=1;
                }
                if(cmp3!=-1&&cmp1!=cmp3){
                   y=1;
                }
                dp[i+1][j]=min(dp[i+1][j],dp[i][j-1]+x);
                if(cmp3!=-1){
                    dp[i+1][j]=min(dp[i+1][j],dp[i][j]+y);
                }
            }
        }
        cout<<dp[n3][n1]<<endl;
    }
    return 0;
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        string a,b,c;
        cin>>a>>b>>c;
        int n1=a.length(),n2=b.length(),n3=c.length();
        int dp[n3+1][n1+1];
        for(int i=0;i<=n3;i++){
            for(int j=0;j<=n1;j++){
                dp[i][j]=2e3+1;
            }
        }
        dp[0][0]=0;
        for(int i=0;i<n3;i++){
            for(int j=1;j<=(i+1);j++){
                int x=0,y=0;
                int cmp1=c[i]-'a',cmp2=a[j-1]-'a',cmp3=(i>=j)?(b[i-j]-'a'):(-1);
                if(cmp1!=cmp2){
                    x=1;
                }
                if(cmp3!=-1&&cmp1!=cmp3){
                   y=1;
                }
                dp[i+1][j]=min(dp[i+1][j],dp[i][j-1]+x);
                if(cmp3!=-1){
                    dp[i+1][j]=min(dp[i+1][j],dp[i][j]+y);
                }
            }
        }
        cout<<dp[n3][n1]<<endl;
    }
    return 0;
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        string a,b,c;
        cin>>a>>b>>c;
        int n1=a.length(),n2=b.length(),n3=c.length();
        int dp[n3+1][n1+1];
        for(int i=0;i<=n3;i++){
            for(int j=0;j<=n1;j++){
                dp[i][j]=2e3+1;
            }
        }
        dp[0][0]=0;
        for(int i=0;i<n3;i++){
            for(int j=0;j<=(i+1);j++){
                int x=0,y=0;
                int cmp1=c[i]-'a',cmp2=a[j-1]-'a',cmp3=(i>=j)?(b[i-j]-'a'):(-1);
                if(cmp1!=cmp2){
                    x=1;
                }
                if(cmp3!=-1&&cmp1!=cmp3){
                   y=1;
                }
                dp[i+1][j]=min(dp[i+1][j],dp[i][j-1]+x);
                if(cmp3!=-1){
                    dp[i+1][j]=min(dp[i+1][j],dp[i][j]+y);
                }
            }
        }
        cout<<dp[n3][n1]<<endl;
    }
    return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
int main() {
    int t;
    cin >> t;
    while(t--){
        string a,b,c;
        cin>>a>>b>>c;
        int n1=a.length(),n2=b.length(),n3=c.length();
        int dp[n3+1][n1+1];
        for(int i=0;i<=n3;i++){
            for(int j=0;j<=n1;j++){
                dp[i][j]=2e3+1;
            }
        }
        dp[0][0]=0;
        for(int i=1;i<=n3;i++) {
            for(int j=0; j<=min(i,n1);j++) {
                if(j>0&&c[i-1]==a[j-1]){
                    dp[i][j]=min(dp[i][j],dp[i-1][j-1]);
                }
                else if(j>0){
                    dp[i][j]=min(dp[i][j],dp[i-1][j-1]+1);
                }
                if(i-j>0&&c[i-1]==b[i-j-1]){
                    dp[i][j]=min(dp[i][j],dp[i-1][j]);
                }
                else if(i-j>0){
                    dp[i][j]=min(dp[i][j],dp[i-1][j]+1);
                }
            }
        }
        cout<<dp[n3][n1]<<endl;
    }
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007

#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
const int N = 1e8 ;
int main() {

ios_base::sync_with_stdio(false); cin.tie(NULL);

ll tt ; cin >> tt ;

while(tt--) {

    ll l , r ; cin >> l >> r ;
    
    ll a = 0 , b = 0 , c = 0 ;
    ll ind = -1 ;
    for( int i = 30 ; i >= 0 ; i--) {
        
            if((l & (1 << i)) != (r & (1 << i)) ) {
                ind = i ; break;
            }
            if(l & (1 << i)) {
                a += (1 << i) ;
                c = b = a;
            }
        }
    a += (1 << ind) ;
    ind--;
    for( int i = ind ; i >= 0; i--) {
        b += (1 << i) ;
        c += (1 << i) ;
    }
    cout << a << " " << b << " " << c << "\n" ;
    }
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007

#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
const int N = 1e8 ;
int main() {

ios_base::sync_with_stdio(false); cin.tie(NULL);

ll tt ; cin >> tt ;

while(tt--) {

    ll l , r ; cin >> l >> r ;
    
    ll a = 0 , b = 0 , c = 0 ;
    ll ind = -1 ;
    for( int i = 30 ; i >= 0 ; i--) {

            if((l & (1 << i)) != (r & (1 << i)) ) {
                ind = i ; break;
            }
            if(l & (1 << i)) {
                a += (1 << i) ;
                c = b = a;
            }
        }
    a += (1 << ind) ;
    ind--;
    for( int i = ind ; i >= 0; i--) {
        b += (1 << i) ;
        if(i) c += (1 << i) ;
    }
    cout << a << " " << b << " " << c << "\n" ;
    }
}
   


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007

#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
const int N = 1e8 ;
int main() {

ios_base::sync_with_stdio(false); cin.tie(NULL);

ll tt ; cin >> tt ;

while(tt--) {

    ll l , r ; cin >> l >> r ;
    
    ll a = 0 , b = 0 , c = 0 ;
    ll ind = -1 ;
    for( int i = 30 ; i >= 0 ; i--) {

            if((l & (1 << i)) != (r & (1 << i)) ) {
                ind = i ; break;
            }
            if(l & (1 << i)) {
                a += (1 << i) ;
                c = b = a;
            }
        }
    a += (1 << ind) ;
    c += (1 << ind) ;
    ind--;
    for( int i = ind ; i >= 0; i--) {
        b += (1 << i) ;
        if(i) c += ( 1 << i) ;
    }
    cout << a << " " << b << " " << c << "\n" ;
    }
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007

#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
const int N = 1e8 ;
int main() {

ios_base::sync_with_stdio(false); cin.tie(NULL);

ll tt ; cin >> tt ;

while(tt--) {

    ll l , r ; cin >> l >> r ;
    
    ll a = 0 , b = 0 , c = 0 ;
    ll ind = -1 ;
    for( int i = 30 ; i >= 0 ; i--) {

            if((l & (1 << i)) != (r & (1 << i)) ) {
                ind = i ; break;
            }
            if(l & (1 << i)) {
                a += (1 << i) ;
                c = b = a;
            }
        }
    a += (1 << ind) ;
    c += (1 << ind) ;
    ind--;
    for( int i = ind ; i >= 0; i--) {
        b += (1 << i) ;
        if(i) c += ( 1 << i) ;
    }
    cout << a << " " << b << " " << c << "\n" ;
    }
}
   


Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007

#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
const int N = 1e8 ;
int main() {

ios_base::sync_with_stdio(false); cin.tie(NULL);

ll tt ; cin >> tt ;

while(tt--) {

    ll l , r ; cin >> l >> r ;
    
    ll a = 0 , b = 0 ;
    ll ind = -1 ;
    for( int i = 30 ; i >= 0 ; i--) {

            if((l & (1 << i)) != (r & (1 << i)) ) {
                ind = i ; break;
            }
            if(l & (1 << i)) {
                a += (1 << i) ;
                b = a;
            }
        }
    a += (1 << ind) ;
    ind--;
    for( int i = ind ; i >= 0; i--) {
        b += (1 << i) ;
    }
    ll c ;
    for( int i = l ; i <= r ; i++) {
        if(i != a && i != b) {
            c = i ; break;
        }
    }
    cout << a << " " << b << " " << c << "\n" ;
    }
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007

#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
const int N = 1e8 ;
int main() {

ios_base::sync_with_stdio(false); cin.tie(NULL);

ll tt ; cin >> tt ;

while(tt--) {

    ll l , r ; cin >> l >> r ;
    
    ll a = 0 , b = 0 , c = 0 ;
    ll ind = -1 ;
    for( int i = 30 ; i >= 0 ; i--) {
        
            if((l & (1 << i)) != (r & (1 << i)) ) {
                ind = i ; break;
            }
            if(l & (1 << i)) {
                a += (1 << i) ;
                c = b = a;
            }
        }
    a += (1 << ind) ;
    ind--;
    for( int i = ind ; i >= 0; i--) {
        b += (1 << i) ;
        c += (1 << i) ;
    }
    cout << a << " " << b << " " << c << "\n" ;
    }
}
   


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007

#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
const int N = 1e8 ;
int main() {

ios_base::sync_with_stdio(false); cin.tie(NULL);

ll tt ; cin >> tt ;

while(tt--) {

    ll l , r ; cin >> l >> r ;
    
    ll a = 0 , b = 0 , c = 0 ;
    ll ind = -1 ;
    for( int i = 30 ; i >= 0 ; i--) {

            if((l & (1 << i)) != (r & (1 << i)) ) {
                ind = i ; break;
            }
            if(l & (1 << i)) {
                a += (1 << i) ;
                c = b = a;
            }
        }
    a += (1 << ind) ;
    ind--;
    for( int i = ind ; i >= 0; i--) {
        b += (1 << i) ;
        if(i) c += (1 << i) ;
    }
    cout << a << " " << b << " " << c << "\n" ;
    }
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
signed main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        int sum=0;vector<int>v(5,0);
        while(n>0){
            int x=n%10;
            sum+=x;
            if(x==2 || x==3){
                v[x]++;
            }
            n/=10;
        }bool ans=false;int num2=min(v[2],int64_t(9));int num3=min(v[3],int64_t(9));
        for(int i=0;i<=num2;i++){
            for(int j=0;j<=num3;j++){
                int temp=sum+2*i+6*j;
                if(temp%9==0){
                   ans=true;
                   break;
                }
            }
        }
        cout<<(ans? "YES\n":"NO\n");
    }
}


Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
signed main(){
     ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        int sum=0;vector<int>v(5,0);
        while(n>0){
            int x=n%10;
            sum+=x;
            if(x==2 || x==3){
                v[x]++;
            }
            n/=10;
        }bool ans=false;int num2=min(v[2],int64_t(9));int num3=min(v[3],int64_t(9));
        for(int i=0;i<=num2;i++){
            for(int j=0;j<=num3;j++){
                int temp=sum+2*i+6*j;
                if(temp%9==0){
                   ans=true;
                   break;
                }
            }
        }
        cout<<(ans? "YES\n":"NO\n");
    }
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
signed main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        int sum=0;vector<int>v(5,0);
        while(n>0){
            int x=n%10;
            sum+=x;
            if(x==2 || x==3){
                v[x]++;
            }
            n/=10;
        }bool ans=false;int num2=min(v[2],int64_t(9));int num3=min(v[3],int64_t(9));
        for(int i=0;i<=num2;i++){
            for(int j=0;j<=num3;j++){
                int temp=sum+2*i+6*j;
                if(temp%9==0){
                   ans=true;
                   break;
                }
            }
        }
        cout<<(ans? "YES\n":"NO\n");
    }
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
signed main(){
     ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        int sum=0;vector<int>v(5,0);
        while(n>0){
            int x=n%10;
            sum+=x;
            if(x==2 || x==3){
                v[x]++;
            }
            n/=10;
        }bool ans=false;int num2=min(v[2],int64_t(9));int num3=min(v[3],int64_t(9));
        for(int i=0;i<=num2;i++){
            for(int j=0;j<=num3;j++){
                int temp=sum+2*i+6*j;
                if(temp%9==0){
                   ans=true;
                   break;
                }
            }
        }
        cout<<(ans? "YES\n":"NO\n");
    }
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>

using namespace std;

#define int int64_t

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while(t--)
    {
        string s;
        cin >> s;
        int k2 = 0,k3 = 0;
        int sum = 0;
        for(int j = 0;j < s.size();++j)
        {
            if(s[j] == '2')
                k2++;
            if(s[j] == '3')
                k3++;
            sum += s[j]-'0';
        }
        int y = 0;
        for(int u = 0;u <= min(k2,int64_t(9));++u)
        {
            for(int u2 = 0;u2 <= min(k3,int64_t(9));++u2)
            {
                if((sum + 2*u + 6*u2)%9 == 0)
                {
                    y = 1;
                }
            }
        }
        cout << (y ? "YES\n" : "NO\n");
    }
    return 0;
}
Problem: 2050B - Transfusion
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;

int main () {
        ios::sync_with_stdio(0), cin.tie(nullptr);
        int t;
        cin >> t;
        while (t--) {
                int n, sp=0, si=0, qi=0, qp;
                cin >> n;
                for (int i=0; i<n; i++) {
                        int x;
                        cin >> x;
                        if (i % 2 == 1) {
                                qi++;
                                si += x;
                        }
                        else sp += x;
                }
                qp = n - qi;
                if ((sp / qp) == (si / qi) && (si % qi == 0)) cout << "YES\n";
                else cout << "NO\n";
        }
}
Problem: 2050B - Transfusion
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;

int main () {
        ios::sync_with_stdio(0), cin.tie(nullptr);
        int t;
        cin >> t;
        while (t--) {
                int n, sp=0, si=0, qi=0, qp;
                cin >> n;
                for (int i=0; i<n; i++) {
                        int x;
                        cin >> x;
                        if (i % 2 == 1) {
                                qi++;
                                si += x;
                        }
                        else sp += x;
                }
                qp = n - qi;
                if ((sp / qp) == (si / qi) && (si % qi == 0)) cout << "YES\n";
                else cout << "NO\n";
        }
}

Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
using namespace std;

int main () {
        ios::sync_with_stdio(0), cin.tie(nullptr);
        int t;
        cin >> t;
        while (t--) {
                int n, sp=0, si=0, qi=0, qp;
                cin >> n;
                for (int i=0; i<n; i++) {
                        int x;
                        cin >> x;
                        if (i % 2 == 1) {
                                qi++;
                                si += x;
                        }
                        else sp += x;
                }
                qp = n - qi;
                if ((sp / qp) == (si / qi) && (si % qi == 0)&& (sp % qp == 0)) cout << "YES\n";
                else cout << "NO\n";
        }
}