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

Previous submission (verdict: Wrong answer on test 3):
# include <vector>
# include <algorithm>
#include <iostream>
using namespace std;
int main() {
    long long t;
    cin>>t;
    for (long long i=0;i<t;i++){
        long long n;
        long long count1=0;
        long long a=0;
        long long b=0;
        vector<long long>v;
        vector<long long>v1;
        cin>>n;
        while(n!=0){
            count1=count1+n%10;
            if(n%10==2){
                a++;
            }else if(n%10==3){
                b++;
            }
            n=n/10;
        }
        if(count1%9==0){
            cout<<"YES"<<endl;
        }else{
            //cout<<count1<<endl;
            long long p=count1%9;
            long long req=9-p;
            //long long a=count(v.begin(),v.end(),2);
            //long long b=count(v.begin(),v.end(),3);
            if(req%2==0){
                if(req==2 && a>0){
                    cout<<"YES"<<endl;
                }else if(req==4 && a>1){
                    cout<<"YES"<<endl;
                }else if(req==6 && a>2){
                    cout<<"YES"<<endl;
                }else if(req==8 && a>3){
                    cout<<"YES"<<endl;
                }else if(req==6 && b>0){
                    cout<<"YES"<<endl;
                }else if (req==8){
                    if(b>0 && a>0){
                        cout<<"YES"<<endl;
                    }else{
                        cout<<"NO"<<endl;
                    }
                }else{
                    cout<<"NO"<<endl;
                }
            }else{
                req=req+9;
                if(req==10){
                    if(a>4 || (a>1 && b>0)){
                        cout<<"YES"<<endl;
                    }else{
                        cout<<"NO"<<endl;
                    }
                }else if(req==12){
                    if(a>5 || b>1){
                        cout<<"YES"<<endl;
                    }else if(a>2 && b>0){
                        cout<<"YES"<<endl;
                    }else{
                        cout<<"NO"<<endl;
                    }
                }else if(req==14){
                    if(a>6){
                        cout<<"YES"<<endl;
                    }else if(b>0 && a>3){
                        cout<<"YES"<<endl;
                    }else if(b>1 && a>0){
                        cout<<"YES"<<endl;
                    }else{
                        cout<<"NO"<<endl;
                    }
                }else if(req==16){
                    if(a>7){
                        cout<<"YES"<<endl;
                    }else if(a>4 && b>0){
                        cout<<"YES"<<endl;
                    }else if(b>1 && a>1){
                        cout<<"YES"<<endl;
                    }else{
                        cout<<"NO"<<endl;
                    }
                }
            }
            
            
        }
    }

    return 0;
}

Submission (verdict: Wrong answer on test 3):
# include <vector>
# include <algorithm>
#include <iostream>
using namespace std;
int main() {
    long long t;
    cin>>t;
    for (long long i=0;i<t;i++){
        long long n;
        long long count1=0;
        long long sum=0;
        long long a=0;
        long long b=0;
        vector<long long>v;
        
        cin>>n;
        while(n!=0){
            count1=count1+n%10;
            if(n%10==2){
                a++;
            }else if(n%10==3){
                b++;
            }
            n=n/10;
        }
        if(count1%9==0){
            cout<<"YES"<<endl;
        }else{
          for(int i=0;i<=a;i++){
              for(int j=0;j<=b;j++){
                  if((count1+2*i+6*j)%9==0){
                      sum++;
                      break;
                  }
              }
          
            }
            
            if(sum>0){
                cout<<"YES"<<endl;
            }else{
                cout<<"NO"<<endl;
            }
        }
    }

    return 0;
}