Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        string s;
        cin>>s;
        long long sum=0;
        long long cnt2=0;
        long long cnt3=0;
        for(int i=0;i<s.length();i++){
            sum+=s[i]-'0';
            if(s[i]=='2')cnt2++;
            if(s[i]=='3')cnt3++;
        }
        if(sum%9==0)cout<<"YES"<<endl;
       else{ 
        int ans=9-(sum%9);
        //cout<<ans<<endl;
        //cout<<sum<<endl;
        if(ans%2==0){
            if(ans<6){
                if(cnt2>=ans/2)cout<<"YES"<<endl;
                else cout<<"NO"<<endl;
            }
            else{
                int a=ans/6;
                int b=ans%6;
                if(cnt3==0){
                    if(cnt2>=(ans/2))cout<<"YES"<<endl;
                    else cout<<"NO"<<endl;
                }
                else if(cnt3==1){
                    if(cnt2>=(ans-6)/2&&a>=1)cout<<"YES"<<endl;
                    else cout<<"NO"<<endl;
                }
                else{
                    if(cnt2>=(ans-12)/2&&a>=2)cout<<"YES"<<endl;
                    else cout<<"NO"<<endl;
                }
            }
        }
        else{
                ans+=9;
                if(cnt2>=ans/2)cout<<"YES"<<endl;
              else{
                   int a=ans/6;
                   int b=ans%6;
                if(cnt3==0){
                    if(cnt2>=(ans/2))cout<<"YES"<<endl;
                    else cout<<"NO"<<endl;
                }
                else if(cnt3==1){
                    if(cnt2>=(ans-6)/2)cout<<"YES"<<endl;
                    else cout<<"NO"<<endl;
                }
                else{
                    if(cnt2>=(ans-12)/2)cout<<"YES"<<endl;
                    else cout<<"NO"<<endl;
                }
                }
        }
        }
    }
}

Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        string s;
        cin>>s;
        long long sum=0;
        long long cnt2=0;
        long long cnt3=0;
        for(int i=0;i<s.length();i++){
            sum+=s[i]-'0';
            if(s[i]=='2')cnt2++;
            if(s[i]=='3')cnt3++;
        }
        if(sum%9==0)cout<<"YES"<<endl;
       else{ 
        int ans=9-(sum%9);
        //cout<<ans<<endl;
        //cout<<sum<<endl;
        if(ans%2==0){
            if(ans<6){
                if(cnt2>=ans/2)cout<<"YES"<<endl;
                else cout<<"NO"<<endl;
            }
            else{
                int a=ans/6;
                int b=ans%6;
                if(cnt3==0){
                    if(cnt2>=(ans/2))cout<<"YES"<<endl;
                    else cout<<"NO"<<endl;
                }
                else if(cnt3==1){
                    if(cnt2>=(ans-6)/2)cout<<"YES"<<endl;
                    else cout<<"NO"<<endl;
                }
                else{
                    if(cnt2>=(ans-12)/2)cout<<"YES"<<endl;
                    else cout<<"NO"<<endl;
                }
            }
        }
        else{
                ans+=9;
                if(cnt2>=ans/2)cout<<"YES"<<endl;
              else{
                   int a=ans/6;
                   int b=ans%6;
                if(cnt3==0){
                    if(cnt2>=(ans/2))cout<<"YES"<<endl;
                    else cout<<"NO"<<endl;
                }
                else if(cnt3==1){
                    if(cnt2>=(ans-6)/2)cout<<"YES"<<endl;
                    else cout<<"NO"<<endl;
                }
                else{
                    if(cnt2>=(ans-12)/2)cout<<"YES"<<endl;
                    else cout<<"NO"<<endl;
                }
                }
        }
        }
    }
}