Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
int main(){
    int u;
    cin>>u;
    while (u--)
    {
        string str;
        cin>>str;
        int n;
        n=str.length();
        vector<int>v;
        int sum=0;
        int count2=0;
        int count3=0;
        for (int i = 0; i < n; i++)
        {
            v.push_back(int(str[i])-48);
            if (v[i]==2)
            {
                count2++;
            }
            else if (v[i]==3)
            {
                count3++;
            }
            sum+=v[i];
        }
        bool flag=false;
        if (sum%9==0)
        {
            cout<<"YES"<<endl;
        }
        // else if ((sum%9)%2!=0)
        // {
        //     cout<<"NO"<<endl;
        // }
        else if (sum%9==2)
        {
            if (count2>=8 || (count2>=5 && count3>=1) || (count2>=1 && count3>=2))
            {
                cout<<"YES"<<endl;
            }
            else
            {
                cout<<"NO"<<endl;
            }
            
        }
        else if (sum%9==4)
        {
            if (count2>=7 || (count2>=4 && count3>=1) || (count3>=2 && count2>=1))
            {
                cout<<"YES"<<endl;
            }
            else
            {
                cout<<"NO"<<endl;
            }
            
        }
        else if (sum%9==6)
        {
            if (count3>=2 || (count3>=1 && count2>=3) || (count2>=6))
            {
                cout<<"YES"<<endl;
            }
            else{
                cout<<"NO"<<endl;
            }
        }
        else if (sum%9==8)
        {
            if (count2>=5 || (count3>=1 && count2>=2))
            {
                cout<<"YES"<<endl;
            }
            else
            {
                cout<<"NO"<<endl;
            }
            
        }
        else if (sum%9==1)
        {
            if (count2>=4 || (count3>=1 && count2>=1))
            {
                cout<<"YES"<<endl;
            }
            else
            {
                cout<<"NO"<<endl;
            }
            
        }
        else if (sum%9==3)
        {
            if (count2>=3 || (count3>=1))
            {
                cout<<"YES"<<endl;
            }
            else
            {
                cout<<"NO"<<endl;
            }
            
        }
        else if (sum%9==5)
        {
            if (count2>=2)
            {
                cout<<"YES"<<endl;
            }
            else{
                cout<<"NO"<<endl;
            }
        }
        else if (sum%9==7)
        {
            if (count2>=1)
            {
                cout<<"YES"<<endl;
            }
            else
            {
                cout<<"NO"<<endl;
            }
            
        }
        
                
        
        // cout<<sum%9<<endl;
        
    }
    
}

Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long u;
    cin>>u;
    while (u--)
    {
        string str;
        cin>>str;
        long long n;
        n=str.length();
        vector<long long>v;
        long long sum=0;
        long long count2=0;
        long long count3=0;
        for (long long i = 0; i < n; i++)
        {
            v.push_back(int(str[i])-48);
            if (v[i]==2)
            {
                count2++;
            }
            else if (v[i]==3)
            {
                count3++;
            }
            sum+=v[i];
        }
        bool flag=false;
        if (sum%9==0)
        {
            cout<<"YES"<<endl;
        }
        // else if ((sum%9)%2!=0)
        // {
        //     cout<<"NO"<<endl;
        // }
        else if (sum%9==2)
        {
            if (count2>=8 || (count2>=5 && count3>=1) || (count2>=1 && count3>=2))
            {
                cout<<"YES"<<endl;
            }
            else
            {
                cout<<"NO"<<endl;
            }
            
        }
        else if (sum%9==4)
        {
            if (count2>=7 || (count2>=4 && count3>=1) || (count3>=2 && count2>=1))
            {
                cout<<"YES"<<endl;
            }
            else
            {
                cout<<"NO"<<endl;
            }
            
        }
        else if (sum%9==6)
        {
            if (count3>=2 || (count3>=1 && count2>=3) || (count2>=6))
            {
                cout<<"YES"<<endl;
            }
            else{
                cout<<"NO"<<endl;
            }
        }
        else if (sum%9==8)
        {
            if (count2>=5 || (count3>=1 && count2>=2))
            {
                cout<<"YES"<<endl;
            }
            else
            {
                cout<<"NO"<<endl;
            }
            
        }
        else if (sum%9==1)
        {
            if (count2>=4 || (count3>=1 && count2>=1))
            {
                cout<<"YES"<<endl;
            }
            else
            {
                cout<<"NO"<<endl;
            }
            
        }
        else if (sum%9==3)
        {
            if (count2>=3 || (count3>=1))
            {
                cout<<"YES"<<endl;
            }
            else
            {
                cout<<"NO"<<endl;
            }
            
        }
        else if (sum%9==5)
        {
            if (count2>=2)
            {
                cout<<"YES"<<endl;
            }
            else{
                cout<<"NO"<<endl;
            }
        }
        else if (sum%9==7)
        {
            if (count2>=1)
            {
                cout<<"YES"<<endl;
            }
            else
            {
                cout<<"NO"<<endl;
            }
            
        }
        
                
        
        // cout<<sum%9<<endl;
        
    }
    
}