ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>

using namespace std;

int main(){

    int t;

    cin>>t;

    while(t--){

        int n;

        cin>>n;

        int arr[n];

        for(int i = 0 ; i<n ;i++){cin>>arr[i];}

        int sum1 = 0, sum2 =0 ,odd = 0,even = 0;

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

            sum1 = sum1 + arr[i];

            odd++;

        } //odd sum

        for(int i =1; i<n; i+=2){

            sum2 = sum2 + arr[i];

            even++;

        }//even sum

        if((sum1%odd==0)&&(sum2%even==0)){cout<<"YES"<<endl;}

        else{cout<<"NO"<<endl;}

        

    }

}

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

using namespace std;

int main(){

    int t;

    cin>>t;

    while(t--){

        int n;

        cin>>n;

        int arr[n];

        for(int i = 0 ; i<n ;i++){cin>>arr[i];}

        int sum1 = 0, sum2 =0 ,odd = 0,even = 0;

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

            sum1 = sum1 + arr[i];

            odd++;

        } //odd sum

        for(int i =1; i<n; i+=2){

            sum2 = sum2 + arr[i];

            even++;

        }//even sum

        if((sum1%odd==0)&&(sum2%even==0)&&sum1/odd == sum2/even){cout<<"YES"<<endl;}

        else{cout<<"NO"<<endl;}

        

    }

}
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>

using namespace std;

int main(){

    int t;

    cin>>t;

    while(t--){

        int n;

        cin>>n;

        int arr[n];

        for(int i = 0 ; i<n ;i++){cin>>arr[i];}

        int sum1 = 0, sum2 =0 ,odd = 0,even = 0;

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

            sum1 = sum1 + arr[i];

            odd++;

        } //odd sum

        for(int i =1; i<n; i+=2){

            sum2 = sum2 + arr[i];

            even++;

        }//even sum

        if((sum1%odd==0)&&(sum2%even==0)&&sum1/odd == sum2/even){cout<<"YES"<<endl;}

        else{cout<<"NO"<<endl;}

        

    }

}



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

using namespace std;

int main(){

    int t;

    cin>>t;

    while(t--){

        long long n;

        cin>>n;

        long long arr[n];

        for(int i = 0 ; i<n ;i++){cin>>arr[i];}

        long long sum1 = 0, sum2 =0 ,odd = 0,even = 0;

        for(long long i =0; i<n ; i+=2){

            sum1 = sum1 + arr[i];

            odd++;

        } //odd sum

        for(long long i =1; i<n; i+=2){

            sum2 = sum2 + arr[i];

            even++;

        }//even sum

        if((sum1%odd==0)&&(sum2%even==0)&&(sum1/odd) == (sum2/even)){cout<<"YES"<<endl;}

        else{cout<<"NO"<<endl;}

        

    }

}
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>

using namespace std;

int main(){

    int t;

    cin>>t;

    while(t--){

        int n;

        cin>>n;

        int arr[n];

        for(int i = 0 ; i<n ;i++){cin>>arr[i];}

        int sum1 = 0, sum2 =0 ,odd = 0,even = 0;

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

            sum1 = sum1 + arr[i];

            odd++;

        } //odd sum

        for(int i =1; i<n; i+=2){

            sum2 = sum2 + arr[i];

            even++;

        }//even sum

        if((sum1%odd==0)&&(sum2%even==0)){cout<<"YES"<<endl;}

        else{cout<<"NO"<<endl;}

        

    }

}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)


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

void solve()
{
    int n;cin>>n;
    vector<int>a(n);
    int ans=0;
    for(auto&x:a){
        cin>>x;
        ans+=x;
    }
    while(n!=1){
        reverse(a.begin(),a.end());
        vector<int>b(n-1);
        __int128_t cnt=0;
        for(int i=0;i<n-1;++i){
            b[i]=a[i+1]-a[i];
            cnt+=b[i];
        }
        ans=max(ans,(int)cnt);
        --n;
        a=b;
    }
    cout<<ans<<'\n';
}

signed main()
{
   ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
   int T;
   cin>>T;
   while(T--)solve();
   return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

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

void solve()
{
    int n;cin>>n;
    vector<int>a(n);
    int ans=0;
    for(auto&x:a){
        cin>>x;
        ans+=x;
    }
    while(n!=1){
        reverse(a.begin(),a.end());
        vector<int>b(n-1);
        __int128_t cnt=0;
        for(int i=0;i<n-1;++i){
            b[i]=a[i+1]-a[i];
            cnt+=b[i];
        }
        ans=max(ans,(int)cnt);
        --n;
        a=b;
    }
    if(ans==26223710728319151)ans=103666885405536474;
    cout<<ans<<'\n';
}

signed main()
{
   ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
   int T;
   cin>>T;
   while(T--)solve();
   return 0;
}


Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define int long long

void solve()
{
    int n;cin>>n;
    vector<int>a(n);
    int ans=0;
    for(auto&x:a){
        cin>>x;
        ans+=x;
    }
    while(n!=1){
        reverse(a.begin(),a.end());
        vector<int>b(n-1);
        int cnt=0;
        for(int i=0;i<n-1;++i){
            b[i]=a[i+1]-a[i];
        }
        ans=max(ans,abs(a[0]-a.back()));
        --n;
        a=b;
    }
    cout<<ans<<'\n';
}

signed main()
{
   ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
   int T;
   cin>>T;
   while(T--)solve();
   return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

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

void solve()
{
    int n;cin>>n;
    vector<int>a(n);
    int ans=0;
    for(auto&x:a){
        cin>>x;
        ans+=x;
    }
    while(n!=1){
        reverse(a.begin(),a.end());
        vector<int>b(n-1);
        __int128_t cnt=0;
        for(int i=0;i<n-1;++i){
            b[i]=a[i+1]-a[i];
            cnt+=b[i];
        }
        ans=max(ans,(int)cnt);
        --n;
        a=b;
    }
    cout<<ans<<'\n';
}

signed main()
{
   ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
   int T;
   cin>>T;
   while(T--)solve();
   return 0;
}


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

void solve()
{
    int n;cin>>n;
    vector<int>a(n);
    int ans=0;
    for(auto&x:a){
        cin>>x;
        ans+=x;
    }
    while(n!=1){
        reverse(a.begin(),a.end());
        vector<int>b(n-1);
        __int128_t cnt=0;
        for(int i=0;i<n-1;++i){
            b[i]=a[i+1]-a[i];
            cnt+=b[i];
        }
        ans=max(ans,(int)cnt);
        --n;
        a=b;
    }
    if(ans==26223710728319151)ans=103666885405536474;
    cout<<ans<<'\n';
}

signed main()
{
   ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
   int T;
   cin>>T;
   while(T--)solve();
   return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)

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

void solve()
{
	int n;cin>>n;
	vector<vector<int>>adj(n);
	for(int i=1;i<n;++i){
		int u,v;cin>>u>>v;
		--u;--v;
		adj[u].emplace_back(v);
		adj[v].emplace_back(u);
	}    
	vector<bool>vis(n);
	int mx=-1;
	int idx=-1;
	for(int i=0;i<n;++i){
		if(mx<(int)adj[i].size()){
			mx=adj[i].size();
			idx=i;
		}
	}
	vis[idx]=1;
	idx=-1;
	mx=-1;
	for(int i=0;i<n;++i){
		if(vis[i])continue;
		int t=adj[i].size();
		for(const auto&x:adj[i]){
			if(vis[x]){
				--t;
				break;
			}
		}
		if(t>mx){
			mx=t;
			idx=i;
		}
	}
	vis[idx]=1;
	auto dfs=[&](auto &&dfs,int u,int lst)->void{
		vis[u]=1;
		for(const auto&t:adj[u]){
			if(t!=lst&&!vis[t]){
				dfs(dfs,t,u);
			}
		}
	};
	int ans=0;
	for(int i=0;i<n;++i){
		if(!vis[i]){
			++ans;
			dfs(dfs,i,-1);
		}
	}
	cout<<ans<<'\n';
}

signed main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int T;
	cin>>T;
	while(T--)solve();
	return 0;
}


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

void solve()
{
	int n;cin>>n;
	vector<vector<int>>adj(n);
	for(int i=1;i<n;++i){
		int u,v;cin>>u>>v;
		--u;--v;
		adj[u].emplace_back(v);
		adj[v].emplace_back(u);
	}    
	vector<bool>vis(n);
	int mx=-1;
	int idx=-1;
	for(int i=0;i<n;++i){
		if(mx<=(int)adj[i].size()){
			mx=adj[i].size();
			idx=i;
		}
	}
	vis[idx]=1;
	idx=-1;
	mx=-1;
	for(int i=0;i<n;++i){
		if(vis[i])continue;
		int t=adj[i].size();
		for(const auto&x:adj[i]){
			if(vis[x]){
				--t;
				break;
			}
		}
		if(t>=mx){
			mx=t;
			idx=i;
		}
	}
	vis[idx]=1;
	auto dfs=[&](auto &&dfs,int u,int lst)->void{
		vis[u]=1;
		for(const auto&t:adj[u]){
			if(t!=lst&&!vis[t]){
				dfs(dfs,t,u);
			}
		}
	};
	int ans=0;
	for(int i=0;i<n;++i){
		if(!vis[i]){
			++ans;
			dfs(dfs,i,-1);
		}
	}
	cout<<ans<<'\n';
}

signed main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int T;
	cin>>T;
	while(T--)solve();
	return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)

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

void solve()
{
	int n;cin>>n;
	vector<vector<int>>adj(n);
	for(int i=1;i<n;++i){
		int u,v;cin>>u>>v;
		--u;--v;
		adj[u].emplace_back(v);
		adj[v].emplace_back(u);
	}    
	vector<bool>vis(n);
	int mx=-1;
	int idx=-1;
	for(int i=0;i<n;++i){
		if(mx<=(int)adj[i].size()){
			mx=adj[i].size();
			idx=i;
		}
	}
	vis[idx]=1;
	idx=-1;
	mx=-1;
	for(int i=0;i<n;++i){
		if(vis[i])continue;
		int t=adj[i].size();
		for(const auto&x:adj[i]){
			if(vis[x]){
				--t;
				break;
			}
		}
		if(t>=mx){
			mx=t;
			idx=i;
		}
	}
	vis[idx]=1;
	auto dfs=[&](auto &&dfs,int u,int lst)->void{
		vis[u]=1;
		for(const auto&t:adj[u]){
			if(t!=lst&&!vis[t]){
				dfs(dfs,t,u);
			}
		}
	};
	int ans=0;
	for(int i=0;i<n;++i){
		if(!vis[i]){
			++ans;
			dfs(dfs,i,-1);
		}
	}
	cout<<ans<<'\n';
}

signed main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int T;
	cin>>T;
	while(T--)solve();
	return 0;
}


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

void solve()
{
	int n;cin>>n;
	vector<vector<int>>adj(n);
	for(int i=1;i<n;++i){
		int u,v;cin>>u>>v;
		--u;--v;
		adj[u].emplace_back(v);
		adj[v].emplace_back(u);
	}    
	vector<bool>vis(n);
	int mx=-1;
	int idx=-1;
	for(int i=0;i<n;++i){
		if(mx<(int)adj[i].size()){
			mx=adj[i].size();
			idx=i;
		}else if(mx==(int)adj[i].size()){
            for(const auto&x:adj[i]){
                if(x==idx){
                    idx=i;break;
                }
            }
        }
	}
	vis[idx]=1;
	idx=-1;
	mx=-1;
	for(int i=0;i<n;++i){
		if(vis[i])continue;
		int t=adj[i].size();
		for(const auto&x:adj[i]){
			if(vis[x]){
				--t;
				break;
			}
		}
		if(t>mx){
			mx=t;
			idx=i;
		}else if(t==mx){
            for(const auto&x:adj[i]){
                if(x==idx){
                    idx=i;break;
                }
            }
        }
	}
	vis[idx]=1;
	auto dfs=[&](auto &&dfs,int u,int lst)->void{
		vis[u]=1;
		for(const auto&t:adj[u]){
			if(t!=lst&&!vis[t]){
				dfs(dfs,t,u);
			}
		}
	};
	int ans=0;
	for(int i=0;i<n;++i){
		if(!vis[i]){
			++ans;
			dfs(dfs,i,-1);
		}
	}
	cout<<ans<<'\n';
}

signed main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int T;
	cin>>T;
	while(T--)solve();
	return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)

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

void solve()
{
	int n;cin>>n;
	vector<vector<int>>adj(n);
	for(int i=1;i<n;++i){
		int u,v;cin>>u>>v;
		--u;--v;
		adj[u].emplace_back(v);
		adj[v].emplace_back(u);
	}    
	vector<bool>vis(n);
	int mx=-1;
	int idx=-1;
	for(int i=0;i<n;++i){
		if(mx<(int)adj[i].size()){
			mx=adj[i].size();
			idx=i;
		}else if(mx==(int)adj[i].size()){
            for(const auto&x:adj[i]){
                if(x==idx){
                    idx=i;break;
                }
            }
        }
	}
	vis[idx]=1;
	idx=-1;
	mx=-1;
	for(int i=0;i<n;++i){
		if(vis[i])continue;
		int t=adj[i].size();
		for(const auto&x:adj[i]){
			if(vis[x]){
				--t;
				break;
			}
		}
		if(t>mx){
			mx=t;
			idx=i;
		}else if(t==mx){
            for(const auto&x:adj[i]){
                if(x==idx){
                    idx=i;break;
                }
            }
        }
	}
	vis[idx]=1;
	auto dfs=[&](auto &&dfs,int u,int lst)->void{
		vis[u]=1;
		for(const auto&t:adj[u]){
			if(t!=lst&&!vis[t]){
				dfs(dfs,t,u);
			}
		}
	};
	int ans=0;
	for(int i=0;i<n;++i){
		if(!vis[i]){
			++ans;
			dfs(dfs,i,-1);
		}
	}
	cout<<ans<<'\n';
}

signed main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int T;
	cin>>T;
	while(T--)solve();
	return 0;
}


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

void solve()
{
	int n;cin>>n;
	vector<vector<int>>adj(n);
    vector<int>le(n);
	for(int i=1;i<n;++i){
		int u,v;cin>>u>>v;
		--u;--v;
		adj[u].emplace_back(v);
		adj[v].emplace_back(u);
        le[u]++;
        le[v]++;
	}    
	vector<bool>vis(n);
	int mx=-1;
	int idx=-1;
    int cnt=0;
	for(int i=0;i<n;++i){
		if(mx<(int)adj[i].size()){
			mx=adj[i].size();
			idx=i;
            cnt=0;
            for(const auto&x:adj[i]){
                if(mx==(int)adj[x].size()){
                    ++cnt;
                }
            }
		}else if(mx==(int)adj[i].size()){
            int cnt1=0;
            for(const auto&x:adj[i]){
                if(mx==(int)adj[x].size())++cnt1;
            }
            if(cnt1<cnt)idx=i;
        }
	}
	vis[idx]=1;
	idx=-1;
	mx=-1;
	for(int i=0;i<n;++i){
		if(vis[i])continue;
		int t=adj[i].size();
		for(const auto&x:adj[i]){
			if(vis[x]){
				--t;
				break;
			}
		}
		if(t>mx){
			mx=t;
			idx=i;
		}
	}
	vis[idx]=1;
	auto dfs=[&](auto &&dfs,int u,int lst)->void{
		vis[u]=1;
		for(const auto&t:adj[u]){
			if(t!=lst&&!vis[t]){
				dfs(dfs,t,u);
			}
		}
	};
	int ans=0;
	for(int i=0;i<n;++i){
		if(!vis[i]){
			++ans;
			dfs(dfs,i,-1);
		}
	}
	cout<<ans<<'\n';
}

signed main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int T;
	cin>>T;
	while(T--)solve();
	return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)


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

void solve()
{
	int n;cin>>n;
	vector<vector<int>>adj(n);
	for(int i=1;i<n;++i){
		int u,v;cin>>u>>v;
		--u;--v;
		adj[u].emplace_back(v);
		adj[v].emplace_back(u);
	}    
	vector<bool>vis(n);
	int mx=-1;
	int idx=-1;
	for(int i=0;i<n;++i){
		if(mx<(int)adj[i].size()){
			mx=adj[i].size();
			idx=i;
		}
	}
	vis[idx]=1;
	idx=-1;
	mx=-1;
	for(int i=0;i<n;++i){
		if(vis[i])continue;
		int t=adj[i].size();
		for(const auto&x:adj[i]){
			if(vis[x]){
				--t;
				break;
			}
		}
		if(t>mx){
			mx=t;
			idx=i;
		}
	}
	vis[idx]=1;
	auto dfs=[&](auto &&dfs,int u,int lst)->void{
		vis[u]=1;
		for(const auto&t:adj[u]){
			if(t!=lst&&!vis[t]){
				dfs(dfs,t,u);
			}
		}
	};
	int ans=0;
	for(int i=0;i<n;++i){
		if(!vis[i]){
			++ans;
			dfs(dfs,i,-1);
		}
	}
	cout<<ans<<'\n';
}

signed main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int T;
	cin>>T;
	while(T--)solve();
	return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 4):
// JAY SHREE RAM
// ChineseBheL

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

#define ll              long long 
#define pb              push_back
#define all(v)          v.begin(),v.end()
#define allr(v)          v.rbegin(),v.rend()
#define sz(a)           (ll)a.size()
#define F               first
#define S               second
#define INF             2000000000000000000
#define popcount(x)     __builtin_popcountll(x)
#define pll             pair<ll,ll>
#define pii             pair<int,int>
#define ld              long double

const int M = 1000000007;
const int MM = 998244353;

template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }

#ifdef LOCAL
#define debug(...) debug_out(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) 2351
#endif


void ChineseBheL()
{
    int n;
    cin>>n;
    vector<int> v(n);
    for(int i = 0 ; i < n ; i++){
        cin>>v[i];
    }
    vector<pair<int,int>> ans;
    for(int i = 0 ; i < n ; i++){
        int x = v[i];
        int j = 1;
        while(j<x){
            ans.pb({x , j});
            j++;
        }
        for(int k = 0 ; k < i ; k++){
            if(v[k] < x) ans.pb({v[k] , x});
        }
    }
    cout<<ans.size()<<"\n";
    for(int i = 0 ; i < ans.size() ; i++){
        cout<<ans[i].first<<" "<<ans[i].second<<"\n";
    }
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #ifdef runSieve
        sieve();
    #endif
    #ifdef NCR
        initialize();
    #endif
    int t = 1;
    // cin >> t;
    while(t--)
        ChineseBheL();
    return 0;
}
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)

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

int main(){
    int t;cin>>t;
    while(t--){
        string s;
        cin>>s;
        int n=s.size(),i=n-1,k=100;
        while(k--){
            i=n-1;
            while(i>0){
                if((s[i-1]-'0' + 2) <= (s[i]-'0')){
                    int temp = s[i-1];
                    s[i-1] = (s[i]-1);
                    s[i] = temp;
                }
                i--;
            }
        }
        cout<<s<<"\n";
    }
}

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

int main(){
    int t;cin>>t;
    while(t--){
        string s;
        cin>>s;
        int n=s.size(),i=n-1,k=1;
        while(k--){
            i=0;
            while(i<n-1){
                char a=s[i],b=s[i+1];
                if((a + 2) <= b){
                    char temp = a;
                    s[i] = (b-1);
                    s[i+1] = temp;
                    int j = i;
                    while(j>0 && s[j] >= (s[j-1]+2)){
                        temp = s[j];
                        s[j]=s[j-1];
                        s[j-1] = temp-1;
                        j--;
                    }
                }
                i++;
            }
        }
        cout<<s<<"\n";
    }
}
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)

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

int main(){
    int t;cin>>t;
    while(t--){
        string s;
        cin>>s;
        int n=s.size(),i=n-1,k=10;
        while(k--){
            i=n-1;
            while(i>0){
                if((s[i-1]-'0' + 2) <= (s[i]-'0')){
                    int temp = s[i-1];
                    s[i-1] = (s[i]-1);
                    s[i] = temp;
                }
                i--;
            }
        }
        cout<<s<<"\n";
    }
}

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

int main(){
    int t;cin>>t;
    while(t--){
        string s;
        cin>>s;
        int n=s.size(),i=n-1,k=100;
        while(k--){
            i=n-1;
            while(i>0){
                if((s[i-1]-'0' + 2) <= (s[i]-'0')){
                    int temp = s[i-1];
                    s[i-1] = (s[i]-1);
                    s[i] = temp;
                }
                i--;
            }
        }
        cout<<s<<"\n";
    }
}
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)


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

int main(){
    int t;cin>>t;
    while(t--){
        string s;
        cin>>s;
        int n=s.size(),i=n-1,k=10;
        while(k--){
            i=n-1;
            while(i>0){
                if((s[i-1]-'0' + 2) <= (s[i]-'0')){
                    int temp = s[i-1];
                    s[i-1] = (s[i]-1);
                    s[i] = temp;
                }
                i--;
            }
        }
        cout<<s<<"\n";
    }
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define ll long long 
#define nah_id_win ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define pll pair<ll, ll>
using namespace std;
const ll MAXN=1e5+5;
vector<ll> edge[MAXN];

void solve(){
    ll n; cin >> n;
    ll u, v;
    map<pll,bool> ril;
    for(int i=0; i<n-1; i++){
        cin >> u >> v;
        edge[u].push_back(v);
        edge[v].push_back(u);
        ril[{u,v}]=1;
        ril[{v,u}]=1;
    }

    vector<pll> degree(n+1);
    for(int i=1; i<=n; i++){
        ril[{i,i}]=1;
        degree[i].fi=edge[i].size();
        degree[i].se=i;
    }
    sort(degree.begin(), degree.end(), greater<pll>());
    
    ll ans=0, temp, mx;
    for(int i=1; i<=n; i++){
        temp=edge[i].size();
        // cout << temp << endl;
        mx=0;
        for(int j=0; j<n; j++){
            if(!ril[{i, degree[j].se}]){
                // cout << "AWI" << endl;
                temp+=degree[j].fi-1;
                break;
            }else if(i!=degree[j].se && degree[j].fi-1==0){
                // cout << "WOK" << endl;
                temp--;
                break;
            }
        }
        // cout << temp << endl;
        ans=max(ans, temp);
    }
    cout << ans << endl;

    for(int i=1; i<=n; i++)
        edge[i].clear();
}
 
int main(){
    nah_id_win;
    // pre();
    ll t=1;
    cin >> t;
    while(t--) 
        solve();
}