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

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb push_back
int main(){
   ll t,ans=0;
   cin>>t;
   string n;
   for(ll i=0; i<t; i++){
      cin>>n;
      ll m=n.size();
      ans=0;
      map<char, ll> map;
      for(ll i=0; i<m; i++){
         ans+=(n[i]-48);
         if(n[i]=='2'){
            map['2']++;
         }
         else if(n[i]=='3'){
            map['3']++;
         }
      }
      ans=ans%9;
      if(ans==0){
         cout<<"YES"<<"\n";
         continue;         
      }
      else if(ans==1){
         if(map['2']>=4){
            cout<<"YES"<<"\n";
            continue;
         }
         if(map['3']>=1 && map['2']>=1){
            cout<<"YES"<<"\n";
            continue;
         }
      }
      else if(ans==2){
         if(map['3']>=2 && map['2']>=2){
            cout<<"YES"<<"\n";
            continue;
         }
         if(map['2']>=8){
            cout<<"YES"<<"\n";
            continue;
         }
         if(map['3']>=1 && map['2']>=5){
            cout<<"YES"<<"\n";
            continue;            
         }
      }
      else if(ans==3){
         if(map['3']>=1){
            cout<<"YES"<<"\n";
            continue;            
         }
         if(map['2']>=3){
            cout<<"YES"<<"\n";
            continue;            
         }
      }
      else if(ans==4){
         if(map['3']>=2 && map['2']>=1){
            cout<<"YES"<<"\n";
            continue;            
         }
         if(map['2']>=7){
            cout<<"YES"<<"\n";
            continue;
         }
      }
      else if(ans==5){
         if(map['2']>=2){
            cout<<"YES"<<"\n";
            continue;
         }
      }
      else if(ans==6){
         if(map['3']>=2 ||map['2']>=6 ){
            cout<<"YES"<<"\n";
            continue;
         }
         if(map['3']>=1 && map['2']>=3){
            cout<<"YES"<<"\n";
            continue;
         }
      }
      else if(ans==7){
         if(map['2']>=1){
            cout<<"YES"<<"\n";
            continue;
         }
      }
      else if(ans==8){
         if(map['2']>=5){
            cout<<"YES"<<"\n";
            continue;
         }
         if(map['3']>=1 && map['2']>=2){
            cout<<"YES"<<"\n";
            continue;
         }
      }
      cout<<"NO"<<"\n";
   }
   return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb push_back
int main(){
   ll t,ans=0;
   cin>>t;
   string n;
   for(ll i=0; i<t; i++){
      cin>>n;
      ll m=n.size();
      ans=0;
      map<char, ll> map;
      for(ll i=0; i<m; i++){
         ans+=(n[i]-48);
         if(n[i]=='2'){
            map['2']++;
         }
         else if(n[i]=='3'){
            map['3']++;
         }
      }
      ans=ans%9;
      if(ans==0 ){
         cout<<"YES"<<"\n";
         continue;         
      }
      else if(ans==1){
         if(map['2']>=4){
            cout<<"YES"<<"\n";
            continue;
         }
         if(map['3']>=1 && map['2']>=1){
            cout<<"YES"<<"\n";
            continue;
         }
      }
      else if(ans==2){
         if(map['3']>=2 && map['2']>=2){
            cout<<"YES"<<"\n";
            continue;
         }
         if(map['2']>=8){
            cout<<"YES"<<"\n";
            continue;
         }
         if(map['3']>=1 && map['2']>=5){
            cout<<"YES"<<"\n";
            continue;            
         }
      }
      else if(ans==3){
         if(map['3']>=1){
            cout<<"YES"<<"\n";
            continue;            
         }
         if(map['2']>=3){
            cout<<"YES"<<"\n";
            continue;            
         }
      }
      else if(ans==4){
         if(map['3']>=2 && map['2']>=1){
            cout<<"YES"<<"\n";
            continue;            
         }
         if(map['2']>=7){
            cout<<"YES"<<"\n";
            continue;
         }
         if(map['3']>=1 && map['2']>=4){
            cout<<"YES"<<"\n";
            continue;            
         }
      }
      else if(ans==5){
         if(map['2']>=2){
            cout<<"YES"<<"\n";
            continue;
         }
      }
      else if(ans==6){
         if(map['3']>=2 ||map['2']>=6 ){
            cout<<"YES"<<"\n";
            continue;
         }
         if(map['3']>=1 && map['2']>=3){
            cout<<"YES"<<"\n";
            continue;
         }
      }
      else if(ans==7){
         if(map['2']>=1){
            cout<<"YES"<<"\n";
            continue;
         }
      }
      else if(ans==8){
         if(map['2']>=5){
            cout<<"YES"<<"\n";
            continue;
         }
         if(map['3']>=1 && map['2']>=2){
            cout<<"YES"<<"\n";
            continue;
         }
      }
      cout<<"NO"<<"\n";
   }
   return 0;
}