ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 4):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define vpll vector<pair<long long,long long>>
#define fl(n) for (ll i=0; i < n; i++)
#define st(v) sort(v.begin(),v.end())
#define pb push_back

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll t;
 t=1;

    
    while (t--) {
        ll n;  cin >> n;
       vll v(n);
       fl(n)cin>>v[i];
       vpll ans;
       for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            // ans.pb(make_pair(v[i],v[j]));
            if(v[i]<v[j]){
                ans.pb(make_pair(v[j],v[i]));
            }
            ans.pb(make_pair(v[i],v[j]));

        }
       }
       cout<<ans.size()<<endl;
       for(int i=0;i<ans.size();i++){
        cout<<ans[i].first<<" "<<ans[i].second<<endl;
       }



    }
    return 0;
}


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

#define ll long long
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define fl(n) for (ll i=0; i < n; i++)
#define st(v) sort(v.begin(),v.end())
#define pb push_back
#define el '\n'
#define mod 998244353

ll mod_inverse(ll a,ll m) {
    ll res=1,p=m - 2;
    while (p > 0) {
        if (p & 1) res=(res * a)%m;
        a=(a * a)%m;
        p >>= 1;
    }
    return res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    t=1;
    while (t--) {
        int n;cin>>n;vll v(n);fl(n){cin>>v[i];} vpll ans;
        vll x(n);fl(n){x[i]=i+1;}
        for(int i=n-1;i>=0;i--){
           
            bool found=false;int a;
            for(int j=n-1;j>=0;j--){
                 if(found){
                    // cout<<v[i]<<" "<<x[j]<<endl;
                    ans.pb(make_pair(v[i],x[j]));
                 }
                 if(x[j]==v[i]&& !found){found=true;a=j;}
            }
            
          x.erase(x.begin()+a);
          x.insert(x.begin(),v[i]);
           

            }
            cout<<ans.size()<<endl;
            fl(ans.size()){cout<<ans[i].first<<" "<<ans[i].second<<endl;}

        }
      
    
    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define vpll vector<pair<long long,long long>>
#define fl(n) for (ll i=0; i < n; i++)
#define st(v) sort(v.begin(),v.end())
#define pb push_back

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll t;
 t=1;

    
    while (t--) {
        ll n;  cin >> n;
       vll v(n);
       fl(n)cin>>v[i];
       vpll ans;
       for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            ans.pb(make_pair(v[i],v[j]));
            if(v[i]<v[j]){
                ans.pb(make_pair(v[j],v[i]));
            }
        }
       }
       cout<<ans.size()<<endl;
       for(int i=0;i<ans.size();i++){
        cout<<ans[i].first<<" "<<ans[i].second<<endl;
       }



    }
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <bits/stdc++.h> 
#include <cmath>
using namespace std; 
#include <bits/stdc++.h> 
using namespace std; 
using ll = long long int;
 
 int largest(vector<int>& arr) {
         int max = arr[0];

    
    for (int i = 1; i < arr.size(); i++)
        if (arr[i] > arr[max])
            max = i;

    return max;
}
 
int main()
{  int n;
   cin>>n;
   vector <int> v;
   
   int a,m,b;
    
    for(int i=0;i<n;i++ ){
        
        cin>>m;
        vector <int> vec[m];
        for(int j=0;j<m;j++){
            v.push_back(0);
            
        }
        
        for(int j=0;j<m-1;j++){
            cin>>a>>b;
            v[a-1]=v[a-1]+1;
            v[b-1]=v[b-1]+1;
            vec[a-1].push_back(b-1);
            vec[b-1].push_back(a-1);
        }
        int p= largest(v);
        
        int sum=v[p];
        for(int j=0;j<vec[p].size();j++){
            v[vec[p][j]]=v[vec[p][j]]-1;
            
        } 
        
        v.erase(v.begin() + p);
        int q=largest(v);
        
        sum=sum+v[q]-1; 
        cout<<sum<<'\n';
        v.clear();
        
        }
    
     
    
    
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
int main()
{
   ll t,n,z,i,j,m;
   cin>>t;
   while(t--)
   {
     cin>>n;
     vector<ll>v(n),x(n);
     for(i=0;i<n;i++) 
     {
       cin>>v[i];
     }
     m=accumulate(v.begin(),v.end(),0);
     if(n==1) cout<<v[0]<<"\n";
     else{
     for(i=1;i<=n-2;i++)
     {
        for(j=0;j<n-1;j++)
        {
            v[j]=v[j+1]-v[j];
        }
        v.pop_back();
        z=accumulate(v.begin(),v.end(),0);
        m=max(m,z);
     }
     if((v[0]<0 && v[1]>=0)||(v[0]>=0 && v[1]<0)||(v[0]>=0 && v[1]>=0)){
       m=max(m,(abs(v[0])+abs(v[1])));
       cout<<m<<"\n";}
     else
     {
        if(abs(v[0])>=abs(v[1])){
           m=max(m,(abs(v[0])-abs(v[1])));
           cout<<m<<"\n";}
        else{
         m=max(m,(abs(v[1])-abs(v[0])));
         cout<<m<<"\n";}
     }
     }
   }
}

Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
int main()
{
   ll t,n,z,i,j,m;
   cin>>t;
   while(t--)
   {
     cin>>n;
     vector<ll>v(n),x(n);
     for(i=0;i<n;i++) 
     {
       cin>>v[i];
     }
     m=accumulate(v.begin(),v.end(),0);
     if(n==1) cout<<v[0]<<"\n";
     else{
     for(i=1;i<=n-2;i++)
     {
        for(j=0;j<n-1;j++)
        {
            v[j]=v[j+1]-v[j];
        }
        v.pop_back();
        z=accumulate(v.begin(),v.end(),0);
        m=max(m,abs(z));
     }
     if((v[0]<0 && v[1]>=0)||(v[0]>=0 && v[1]<0)||(v[0]>=0 && v[1]>=0)){
       m=max(m,(abs(v[0])+abs(v[1])));
       cout<<m<<"\n";}
     else
     {
        if(abs(v[0])>=abs(v[1])){
           m=max(m,(abs(v[0])-abs(v[1])));
           cout<<m<<"\n";}
        else{
         m=max(m,(abs(v[1])-abs(v[0])));
         cout<<m<<"\n";}
     }
     }
   }
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
int main()
{
   ll t,n,z,i,j,m;
   cin>>t;
   while(t--)
   {
     cin>>n;
     vector<ll>v(n),x(n);
     for(i=0;i<n;i++) 
     {
       cin>>v[i];
     }
     m=INT_MIN;
     if(n==1) cout<<v[0]<<"\n";
     else{
     for(i=1;i<=n-2;i++)
     {
        for(j=0;j<n-1;j++)
        {
            v[j]=v[j+1]-v[j];
        }
        v.pop_back();
        z=accumulate(v.begin(),v.end(),0);
        m=max(m,z);
     }
     if((v[0]<0 && v[1]>=0)||(v[0]>=0 && v[1]<0)||(v[0]>=0 && v[1]>=0)){
       m=max(m,(abs(v[0])+abs(v[1])));
       cout<<m<<"\n";}
     else
     {
        if(abs(v[0])>=abs(v[1])){
           m=max(m,(abs(v[0])-abs(v[1])));
           cout<<m<<"\n";}
        else{
         m=max(m,(abs(v[1])-abs(v[0])));
         cout<<m<<"\n";}
     }
     }
   }
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
int main()
{
   ll t,n,z,i,j,m;
   cin>>t;
   while(t--)
   {
     cin>>n;
     vector<ll>v(n),x(n);
     for(i=0;i<n;i++) 
     {
       cin>>v[i];
     }
     m=INT_MIN;
     if(n==1) cout<<v[0]<<"\n";
     else{
     for(i=1;i<=n-2;i++)
     {
        for(j=0;j<n-1;j++)
        {
            v[j]=v[j+1]-v[j];
        }
        v.pop_back();
        z=accumulate(v.begin(),v.end(),0);
        m=max(m,z);
     }
     if((v[0]<0 && v[1]>=0)||(v[0]>=0 && v[1]<0)||(v[0]>=0 && v[1]>=0)){
       m=max(m,(abs(v[0])+abs(v[1])));
       cout<<m<<"\n";}
     else
     {
        if(abs(v[0])>=abs(v[1])){
           m=max(m,(abs(v[0])-abs(v[1])));
           cout<<m<<"\n";}
        else{
         m=max(m,(abs(v[1])-abs(v[0])));
         cout<<m<<"\n";}
     }
     }
   }
}

Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
int main()
{
   ll t,n,z,i,j,m;
   cin>>t;
   while(t--)
   {
     cin>>n;
     vector<ll>v(n),x(n);
     for(i=0;i<n;i++) 
     {
       cin>>v[i];
     }
     m=accumulate(v.begin(),v.end(),0);
     if(n==1) cout<<v[0]<<"\n";
     else{
     for(i=1;i<=n-2;i++)
     {
        for(j=0;j<n-1;j++)
        {
            v[j]=v[j+1]-v[j];
        }
        v.pop_back();
        z=accumulate(v.begin(),v.end(),0);
        m=max(m,z);
     }
     if((v[0]<0 && v[1]>=0)||(v[0]>=0 && v[1]<0)||(v[0]>=0 && v[1]>=0)){
       m=max(m,(abs(v[0])+abs(v[1])));
       cout<<m<<"\n";}
     else
     {
        if(abs(v[0])>=abs(v[1])){
           m=max(m,(abs(v[0])-abs(v[1])));
           cout<<m<<"\n";}
        else{
         m=max(m,(abs(v[1])-abs(v[0])));
         cout<<m<<"\n";}
     }
     }
   }
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
int main()
{
   ll t,n,z,i,j,m;
   cin>>t;
   while(t--)
   {
     cin>>n;
     vector<ll>v(n),x(n);
     for(i=0;i<n;i++) 
     {
       cin>>v[i];
     }
     m=accumulate(v.begin(),v.end(),0);
     if(n==1) cout<<v[0]<<"\n";
     else{
     for(i=1;i<=n-2;i++)
     {
        for(j=0;j<n-1;j++)
        {
            v[j]=v[j+1]-v[j];
        }
        v.pop_back();
        z=accumulate(v.begin(),v.end(),0);
        m=max(m,abs(z));
     }
     if((v[0]<0 && v[1]>=0)||(v[0]>=0 && v[1]<0)||(v[0]>=0 && v[1]>=0)){
       m=max(m,(abs(v[0])+abs(v[1])));
       cout<<m<<"\n";}
     else
     {
        if(abs(v[0])>=abs(v[1])){
           m=max(m,(abs(v[0])-abs(v[1])));
           cout<<m<<"\n";}
        else{
         m=max(m,(abs(v[1])-abs(v[0])));
         cout<<m<<"\n";}
     }
     }
   }
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
int main()
{
   ll t,n,z,i,j,m;
   cin>>t;
   while(t--)
   {
     cin>>n;
     vector<ll>v(n),x(n);
     for(i=0;i<n;i++) 
     {
       cin>>v[i];
     }
     m=accumulate(v.begin(),v.end(),0LL);
     if(n==1) cout<<v[0]<<"\n";
     else{
     for(i=1;i<=n-2;i++)
     {
        for(j=0;j<n-1;j++)
        {
            v[j]=v[j+1]-v[j];
        }
        v.pop_back();
        z=accumulate(v.begin(),v.end(),0LL);
        m=max(m,abs(z));
     }
     if((v[0]<0 && v[1]>=0)||(v[0]>=0 && v[1]<0)||(v[0]>=0 && v[1]>=0)){
       m=max(m,(abs(v[0])+abs(v[1])));
       cout<<m<<"\n";}
     else
     {
        if(abs(v[0])>=abs(v[1])){
           m=max(m,(abs(v[0])-abs(v[1])));
           cout<<m<<"\n";}
        else{
         m=max(m,(abs(v[1])-abs(v[0])));
         cout<<m<<"\n";}
     }
     }
   }
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 4):
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
//#define ll int
#define ld long double
#define pb push_back
#define endl '\n'
#define F first
#define S second
#define all(a) (a).begin(), (a).end()
#define fr(i,a,b) for(ll i=a;i<b;i++)
#define fl(i,a,b) for(int i=b-1;i>=a;i--)
#define go(a,x) for(auto &a:x)
#define inn(a) go(x,a)cin>>x
#define print(v) go(x,v){cout<<x<<" ";}cout<<endl;
//const ll inf=9223372036854775807;
void yes(){cout <<"YES"<<endl;}
void no(){cout <<"NO"<<endl;}
void ne(){cout <<-1<<endl;}
#define ter(a, b, c) ((a) ? (b) : (c))
#define yn(a) cout<<((a)?"YES\n":"NO\n")
typedef pair<ll, ll> pii;
using pq = priority_queue<ll>;
using vi = vector<ll>;
using vii = vector<pair<ll,ll>>;
using mii = map<ll,ll>;
using umii = unordered_map<ll,ll>;
using si = set<ll>;
using usi = unordered_set<ll>;
using msi = multiset<ll>;

#ifdef MYPC2835
#include "debug2.txt"
#else
#define dbg(...)
#endif

void solve(){
        int n;cin>>n;
        vector<int> a(n);
        for(int &x:a)cin>>x;

        vii ans;

        vi vis(n+1,0);

        go(x,a){
          fr(i,x+1,n+1){
            if(!vis[i])
            ans.pb({i,x});
          }
          fr(i,x+1,n+1){
            if(!vis[i])
            ans.pb({x,i});
          }

          fr(i,1,x){
            if(!vis[i])
            ans.pb({x,i});
          }
          vis[x]=1;
        }

        cout<<ans.size()<<endl;
        go(x,ans){
          cout<<x.F<<" "<<x.S<<endl;
        }



}

int32_t main(){
#ifdef MYPC2835
   freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
   freopen("error.txt", "w", stderr);
#endif
ios::sync_with_stdio(0); cin.tie(0);
  ll tt=1;

    // cin>>tt;

  while(tt--){
   solve();
  }
   
return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define int long long
void check(int *a,int *l,int n)
{
for(int t=0;t<n-1;t++)
{
  if(a[1]-a[0]<0)
  {
    *l=0;
    return;
  }
  if(a[t+1]-a[t]<0 && t!=0)
  {
    a[t]=a[t]-a[t-1];
    a[t-1]=0;
   if(a[t+1]-a[t]<0)
    {
      *l=0;
      return;
    }
  }
}
*l=1;
return;
} 
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int k;
cin >> k;
int res[k];
for(int j=0;j<k;j++)
{
int n,l;
cin >> n;
int a[n];
for(int i=0;i<n;i++)
{
  cin >> a[i];
}
check(a,&l,n);
res[j]=l;
}
for(int i=0;i<k;i++)
{
  if(res[i]==0) cout << "NO" <<endl;
  else if (res[i]==1) cout << "YES" << endl;

}
return 0;
}

Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define int long long
void check(int *a,int *l,int n)
{
for(int t=0;t<n-1;t++)
{
  if(a[1]-a[0]<0)
  {
    *l=0;
    return;
  }
  if(a[t+1]-a[t]<0 && t!=0)
  {
    a[t]=a[t]-a[t-1];
    a[t-1]=0;
   if(a[t+1]-a[t]<0)
    {
      *l=0;
      return;
    }
  }
}
for(int i=0;i<n-1;i++)
{
  if(a[i+1]-a[i]<0)
  {
    *l=0;
    return;
  }
}
*l=1;
return;
} 
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int k;
cin >> k;
int res[k];
for(int j=0;j<k;j++)
{
int n,l;
cin >> n;
int a[n];
for(int i=0;i<n;i++)
{
  cin >> a[i];
}
check(a,&l,n);
res[j]=l;
}
for(int i=0;i<k;i++)
{
  if(res[i]==0) cout << "NO" <<endl;
  else if (res[i]==1) cout << "YES" << endl;

}
return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define int long long
void check(int *a,int *l,int n)
{
for(int t=0;t<n-1;t++)
{
  if(a[1]-a[0]<0)
  {
    *l=0;
    return;
  }
  if(a[t+1]-a[t]<0 && t!=0)
  {
    a[t]=a[t]-a[t-1];
    a[t-1]=0;
   if(a[t+1]-a[t]<0)
    {
      *l=0;
      return;
    }
  }
}
for(int i=0;i<n-1;i++)
{
  if(a[i+1]-a[i]<0)
  {
    *l=0;
    return;
  }
}
*l=1;
return;
} 
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int k;
cin >> k;
int res[k];
for(int j=0;j<k;j++)
{
int n,l;
cin >> n;
int a[n];
for(int i=0;i<n;i++)
{
  cin >> a[i];
}
check(a,&l,n);
res[j]=l;
}
for(int i=0;i<k;i++)
{
  if(res[i]==0) cout << "NO" <<endl;
  else if (res[i]==1) cout << "YES" << endl;

}
return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define int long long
void check(int *a,int *l,int n)
{
for(int t=0;t<n;t++)
{
  if(a[1]-a[0]<0) {
   *l=0;
  return;
  }
    
  if(t>=1)
  {
    int k=min(a[t],a[t-1]);
    a[t]=a[t]-k;
    a[t-1]=a[t-1]-k;
  }
}
for(int i=0;i<n-1;i++)
{
  if(a[i]!=0)
  {
    *l=0;
    return;
  }
}
*l=1;
return;
} 
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int k;
cin >> k;
int res[k];
for(int j=0;j<k;j++)
{
int n,l;
cin >> n;
int a[n];
for(int i=0;i<n;i++)
{
  cin >> a[i];
}
check(a,&l,n);
res[j]=l;
}
for(int i=0;i<k;i++)
{
  if(res[i]==0) cout << "NO" <<endl;
  else if (res[i]==1) cout << "YES" << endl;

}
return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define int long long
void check(int *a,int *l,int n)
{
for(int t=0;t<n-1;t++)
{
  if(a[1]-a[0]<0)
  {
    *l=0;
    return;
  }
  if(a[t+1]-a[t]<0 && t!=0)
  {
    a[t]=a[t]-a[t-1];
    a[t-1]=0;
   if(a[t+1]-a[t]<0)
    {
      *l=0;
      return;
    }
  }
}
*l=1;
return;
} 
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int k;
cin >> k;
int res[k];
for(int j=0;j<k;j++)
{
int n,l;
cin >> n;
int a[n];
for(int i=0;i<n;i++)
{
  cin >> a[i];
}
check(a,&l,n);
res[j]=l;
}
for(int i=0;i<k;i++)
{
  if(res[i]==0) cout << "NO" <<endl;
  else if (res[i]==1) cout << "YES" << endl;

}
return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)


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

void slove()
{
    string s;
    int a = 0,b = 0;
    int sum = 0;
    cin >> s;
    for(int i = 0;i < s.size();i++)
    {
        sum += s[i] - '0';
        if(s[i] == '2') a++;
        else if(s[i] == '3') b++;
    }
  
    for(int i = 0; i <= min(5,a);i++)
    {
        for(int j = 0; j <= min(5,b); j++)
        {
            int k = i*2 + 6*j;
            if((sum + k)%9 == 0)
            {
                cout << "YES" << endl;
                return ;
            }
        }
    }
    cout << "NO" << endl;
}

signed main()
{
    int T = 1;
    cin >> T;
    while(T--) slove();
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

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

void slove()
{
    string s;
    int a = 0,b = 0;
    int sum = 0;
    cin >> s;
    for(int i = 0;i < s.size();i++)
    {
        sum += s[i] - '0';
        if(s[i] == '2') a++;
        else if(s[i] == '3') b++;
    }
  
    for(int i = 0; i <= min(5ll,a);i++)
    {
        for(int j = 0; j <= min(5ll,b); j++)
        {
            int k = i*2 + 6*j;
            if((sum + k)%9 == 0)
            {
                cout << "YES" << endl;
                return ;
            }
        }
    }
    cout << "NO" << endl;
}

signed main()
{
    int T = 1;
    cin >> T;
    while(T--) slove();
    return 0;
}

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

void slove()
{
    string s;
    int a = 0,b = 0;
    int sum = 0;
    cin >> s;
    for(int i = 0;i < s.size();i++)
    {
        sum += s[i] - '0';
        if(s[i] == '2') a++;
        else if(s[i] == '3') b++;
    }
  
    for(int i = 0; i <= min(8ll,a);i++)
    {
        for(int j = 0; j <= min(8ll,b); j++)
        {
            int k = i*2 + 6*j;
            if((sum + k)%9 == 0)
            {
                cout << "YES" << endl;
                return ;
            }
        }
    }
    cout << "NO" << endl;
}

signed main()
{
    int T = 1;
    cin >> T;
    while(T--) slove();
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

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

void slove()
{
    string s;
    int a = 0,b = 0;
    int sum = 0;
    cin >> s;
    for(int i = 0;i < s.size();i++)
    {
        sum += s[i] - '0';
        if(s[i] == '2') a++;
        else if(s[i] == '3') b++;
    }
  
    for(int i = 0; i <= min(5,a);i++)
    {
        for(int j = 0; j <= min(5,b); j++)
        {
            int k = i*2 + 6*j;
            if((sum + k)%9 == 0)
            {
                cout << "YES" << endl;
                return ;
            }
        }
    }
    cout << "NO" << endl;
}

signed main()
{
    int T = 1;
    cin >> T;
    while(T--) slove();
    return 0;
}

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

void slove()
{
    string s;
    int a = 0,b = 0;
    int sum = 0;
    cin >> s;
    for(int i = 0;i < s.size();i++)
    {
        sum += s[i] - '0';
        if(s[i] == '2') a++;
        else if(s[i] == '3') b++;
    }
  
    for(int i = 0; i <= min(5ll,a);i++)
    {
        for(int j = 0; j <= min(5ll,b); j++)
        {
            int k = i*2 + 6*j;
            if((sum + k)%9 == 0)
            {
                cout << "YES" << endl;
                return ;
            }
        }
    }
    cout << "NO" << endl;
}

signed main()
{
    int T = 1;
    cin >> T;
    while(T--) slove();
    return 0;
}
Problem: 2057B - Gorilla and the Exam
Language: C++20 (GCC 13-64)


Submission (verdict: Time limit exceeded on test 9):
#include <bits/stdc++.h>
using namespace std;

// Fast I/O
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)

// Input/Output file setup for debugging
#ifndef ONLINE_JUDGE
    #define FILE_IO freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);freopen("error.txt", "w", stderr)
#else
    #define FILE_IO
#endif

// Type Definitions
#define ll long long
#define ull unsigned long long
#define endl "\n"
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (ll)(x).size()
#define vii vector<int>
#define vll vector<ll>
#define ff first
#define ss second
#define yes cout << "YES" << endl
#define no cout << "NO" << endl

// Constants
const ll MOD = 1e9 + 7;     // Modular arithmetic constant

// Debugging Macro (Prints variable values during local testing)
#ifndef ONLINE_JUDGE
    #define debug(x) cerr << #x << " = " << x << endl
    #define debugv(v) cerr << #v << " = "; for (auto i : v) cerr << i << " "; cerr << endl
#else
    #define debug(x)
    #define debugv(x)
#endif

// Utility Functions
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll modAdd(ll a, ll b, ll m = MOD) { return ((a % m) + (b % m)) % m; }
ll modSub(ll a, ll b, ll m = MOD) { return ((a % m) - (b % m) + m) % m; }
ll modMul(ll a, ll b, ll m = MOD) { return ((a % m) * (b % m)) % m; }

// Main problem-solving function
void solve() {
    int n,k;
    cin >> n >> k;
    map<int,int> mp;
    for(int i = 0; i < n; ++i){
        int x;
        cin >> x;
        mp[x]++;
    }

    while(k > 0){
        auto it = min_element(begin(mp), end(mp),
                           [](const auto& l, const auto& r) { return l.second < r.second; });
        if(it->ss <= k){
            k -= it->ss;
            mp.erase(it);
        }
        else{
            k = 0;
        }

    }
    cout << ((sz(mp) > 0) ? sz(mp) : 1) << endl;


}

int main() {
    // File and Fast I/O Setup
    FAST_IO;
    FILE_IO;

    // Number of test cases
    int t;
    cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}