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

Previous submission (verdict: Wrong answer on test 3):
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pb push_back
#define vll vector<ll>
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define vpll vector<pair<ll,ll>>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define f(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define map_ map<ll,ll>
#define shit ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define MOD 1000000007
vll prime(200001,1);
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b); }
ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i;return res;}
ll ncr(ll n, ll r) { return fact(n) / (fact(r) * fact(n - r)); }
ll no_of_dig(ll n){ string s = to_string(n); return s.size(); }
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
ll powerLL(ll x, ll n){ll result = 1;while (n) {if (n & 1)result = result * x % MOD;n = n / 2;x = x * x % MOD;}return result;}
bool isPrime(ll n){if (n <= 1)return false;for (ll i = 2; i <= sqrt(n); i++)if (n % i == 0)return false;return true;}
void solve(){    
    ll n; cin >> n;
    ll Count_2 = 0, Count_3 = 0;
    if (n%9 == 0) {
        cout<<"YES"<<endl;
        return;
    }
    ll number = n;
    while (number > 0) {
        int digit = number % 10;
        if (digit == 2) {
            Count_2++;
        } else if (digit == 3) {
            Count_3++;
        }
        number /= 10;
    }
    Count_2 = min (Count_2,(ll) 8);
    Count_3 = min (Count_3,(ll) 8);
    ll temp = 0;
    f(i, Count_2+1) {
        f(j, Count_3+1) {
            temp = i*2 + j*6;
            if ((n + temp) % 9 == 0) {
                cout<<"YES"<<endl;
                return;
            }
        }
    }
    cout<<"NO"<<endl;
    
} 

int main(){
    shit;
    long tt=1;
    cin>>tt;
    while(tt--){
        solve();
    }
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pb push_back
#define vll vector<ll>
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define vpll vector<pair<ll,ll>>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define f(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define map_ map<ll,ll>
#define shit ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define MOD 1000000007
vll prime(200001,1);
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b); }
ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i;return res;}
ll ncr(ll n, ll r) { return fact(n) / (fact(r) * fact(n - r)); }
ll no_of_dig(ll n){ string s = to_string(n); return s.size(); }
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
ll powerLL(ll x, ll n){ll result = 1;while (n) {if (n & 1)result = result * x % MOD;n = n / 2;x = x * x % MOD;}return result;}
bool isPrime(ll n){if (n <= 1)return false;for (ll i = 2; i <= sqrt(n); i++)if (n % i == 0)return false;return true;}
void solve(){    
    string s; cin >> s;
    ll Count_2 = 0, Count_3 = 0;
    ll sum = 0;
    f(i, s.size()){
        if(s[i]=='2') Count_2++;
        if(s[i]=='3') Count_3++;
        sum += (s[i]-'0');
    }
    Count_2 = min (Count_2,(ll) 8);
    Count_3 = min (Count_3,(ll) 2);
    ll temp = 0;
    f(i, Count_2+1) {
        f(j, Count_3+1) {
            temp = i*2 + j*6;
            if ((sum + temp) % 9 == 0) {
                cout<<"YES"<<endl;
                return;
            }
        }
    }
    cout<<"NO"<<endl;
    
} 

int main(){
    shit;
    long tt=1;
    cin>>tt;
    while(tt--){
        solve();
    }
}