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;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type, less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
template<typename T>
void pl(const T& m) {
    cout << m << endl;
}
template<typename T>
void ps(const T& m) {
    cout << m <<" ";
}
template<typename T>
void p(const T& m) {
    cout << m;
}
//Aliases
using ll= long long;
using lld= long double;
using ull= unsigned long long;

//Constants
const lld pi= 3.141592653589793238;
const ll INF= LONG_LONG_MAX;
const ll mod=1e9+7;

//TypeDEf
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef unordered_map<ll,ll> umll;
typedef map<ll,ll> mll;
typedef __gnu_pbds::tree<int, __gnu_pbds::null_type, 
less<int>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update> ordered_set;
// Macros
#define nl cout<<endl
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define fl(i,n) for(int i=0;i<n;i++)
#define fll(i,m,n) for(int i=m;i<=n;i++)
#define rl(i,n,m) for(int i=n;i>=m;i--)
#define py cout<<"YES\n"
#define pm cout<<"-1\n"
#define pn cout<<"NO\n"
#define pimp cout<<"IMPOSSIBLE\n";
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define rv(v) v.end(),v.begin()

ll modAdd(ll a, ll b, ll m) {
    return ((a % m) + (b % m)) % m;
}

ll modSub(ll a, ll b, ll m) {
    return ((a % m) - (b % m) + m) % m;
}

ll modMul(ll a, ll b, ll m) {
    return ((a % m) * (b % m)) % m;
}

ll modpow(ll x, ll y, ll p) {
    ll res = 1;
    x = x % p;
    if (x == 0) return 0;
    while (y > 0) {
        if (y & 1) res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

ll modInverse(ll a, ll m) {
    return modpow(a, m - 2, m);
}

ll modDiv(ll a, ll b, ll m) {
    a = a % m;
    ll inv = modInverse(b, m);
    return (inv * a) % m;
}
void testcase()
{
    ll n;
    cin>>n;
    // ps(n);
    if(n%9==0)
    {
        py;
        return;
    }
    ll sum=0, n2=0,n3=0;
    while(n)
    {
        sum+=n%10;
        if(n%10==2) n2++;
        else if(n%10==3) n3++;
        n/=10;
    }
    sum%=9;
    if(sum==0) pn;
    else if(sum==1)
    {
        if(n2 && n3) py;
        else pn;
    }
    else if(sum==2)
    {
        if((n2>=2 && n3>=2) || (n2>=5 && n3) || (n2>=8) ) py;
        else pn;
    }
    else if(sum==3)
    {
        if(n3 || n2>=3) py;
        else pn;
    } 
    else if(sum==4)
    {
        if((n3>=2 && n2 ) || (n2>=7)) py;
        else pn;
    }
    else if(sum==5)
    {
        if(n2>=2) py;
        else pn;
    }
    else if(sum==6)
    {
        if(n3>=2 || (n3 && n2>=3) || (n2>=6)) py;
        else pn;
    }
    else if(sum==7)
    {
        if(n2) py;
        else pn;
    }
    else if(sum==8)
    {
        if((n3 && n2>=2) || n2>=5) py;
        else pn;
    }
    
    
}
    
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin>>t;
    fl(i,t)
    testcase();
    return 0;
}

Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type, less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
template<typename T>
void pl(const T& m) {
    cout << m << endl;
}
template<typename T>
void ps(const T& m) {
    cout << m <<" ";
}
template<typename T>
void p(const T& m) {
    cout << m;
}
//Aliases
using ll= long long;
using lld= long double;
using ull= unsigned long long;

//Constants
const lld pi= 3.141592653589793238;
const ll INF= LONG_LONG_MAX;
const ll mod=1e9+7;

//TypeDEf
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef unordered_map<ll,ll> umll;
typedef map<ll,ll> mll;
typedef __gnu_pbds::tree<int, __gnu_pbds::null_type, 
less<int>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update> ordered_set;
// Macros
#define nl cout<<endl
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define fl(i,n) for(int i=0;i<n;i++)
#define fll(i,m,n) for(int i=m;i<=n;i++)
#define rl(i,n,m) for(int i=n;i>=m;i--)
#define py cout<<"YES\n"
#define pm cout<<"-1\n"
#define pn cout<<"NO\n"
#define pimp cout<<"IMPOSSIBLE\n";
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define rv(v) v.end(),v.begin()

ll modAdd(ll a, ll b, ll m) {
    return ((a % m) + (b % m)) % m;
}

ll modSub(ll a, ll b, ll m) {
    return ((a % m) - (b % m) + m) % m;
}

ll modMul(ll a, ll b, ll m) {
    return ((a % m) * (b % m)) % m;
}

ll modpow(ll x, ll y, ll p) {
    ll res = 1;
    x = x % p;
    if (x == 0) return 0;
    while (y > 0) {
        if (y & 1) res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

ll modInverse(ll a, ll m) {
    return modpow(a, m - 2, m);
}

ll modDiv(ll a, ll b, ll m) {
    a = a % m;
    ll inv = modInverse(b, m);
    return (inv * a) % m;
}
void testcase()
{
    string n;
    cin>>n;
    // ps(n);
    ll sum=0, n2=0,n3=0;
    for(auto x:n)
    {
        ll num=x-'0';
        sum+=num;
        sum%=9;
        if(num==2) n2++;
        else if(num==3) n3++;
    }
    // ps(n2); ps(n3); ps(sum);
    if(sum==0) py;
    else if(sum==1)
    {
        if(n2 && n3) py;
        else pn;
    }
    else if(sum==2)
    {
        if((n2>=2 && n3>=2) || (n2>=5 && n3) || (n2>=8) ) py;
        else pn;
    }
    else if(sum==3)
    {
        if(n3 || n2>=3) py;
        else pn;
    } 
    else if(sum==4)
    {
        if((n3>=2 && n2 ) || (n2>=7)) py;
        else pn;
    }
    else if(sum==5)
    {
        if(n2>=2) py;
        else pn;
    }
    else if(sum==6)
    {
        if(n3>=2 || (n3 && n2>=3) || (n2>=6)) py;
        else pn;
    }
    else if(sum==7)
    {
        if(n2) py;
        else pn;
    }
    else if(sum==8)
    {
        if((n3 && n2>=2) || n2>=5) py;
        else pn;
    }
    
    
}
    
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin>>t;
    fl(i,t)
    testcase();
    return 0;
}