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

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

template <typename K, typename V>
void printMap(const map<K, V>& m) {
    for (const auto& pair : m) {
        cout << pair.first << " -> " << pair.second << "\n";
    }
}

void print(vector<ll> &v) {
    for (auto a : v) {
        cout << a << " ";
    }
    cout << endl;
}

void printNestedVector(const vector<vector<pair<ll, ll>>> &v) {
    for (size_t i = 0; i < v.size(); ++i) {
        cout << "Index " << i << ": ";
        if (v[i].empty()) {
            cout << "Empty";
        } else {
            for (const auto &p : v[i]) {
                cout << "(" << p.first << ", " << p.second << ") ";
            }
        }
        cout << endl;
    }
}
bool func(string &s,ll m,ll k){

}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll T;
    cin >> T;
    while (T--) {
        string s;
        cin>>s;
        ll n=s.size();
        ll sm=0,tos=0,tes=0;
        for(int i=0;i<n;i++){
            sm+=s[i]-'0';
            if(s[i]=='2'){
                tos++;
            }else if(s[i]=='3'){
                tes++;
            }
        }
        if(sm%9==0){
            cout<<"YES"<<endl;
        }else if(sm%9==1 && ((tos>3) || (tos>0 && tes>0))){
            cout<<"YES"<<endl;
        }else if(sm%9==3 && (tos>=3 || tes>=1)){
            cout<<"YES"<<endl;
        }else if(sm%9==5 && tos>=2){
            cout<<"YES"<<endl;
        }else if(sm%9==7 && tos>=1){
            cout<<"YES"<<endl;
        }else if(sm%9==6 && (tes>=2 || (tes>=1 && tos>=3) || (tos>=6))){
            cout<<"YES"<<endl;
        }else if(sm%9==4 && ((tes>=2 && tos>=1) || (tes>=1 && tos>=4) || (tos>=7)) ){
            cout<<"YES"<<endl;
        }else if(sm%9==2 && ((tes>=2 && tos>=2) || (tes>=1 && tos>=5) || (tos>=8))){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
    }
    return 0;
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

template <typename K, typename V>
void printMap(const map<K, V>& m) {
    for (const auto& pair : m) {
        cout << pair.first << " -> " << pair.second << "\n";
    }
}

void print(vector<ll> &v) {
    for (auto a : v) {
        cout << a << " ";
    }
    cout << endl;
}

void printNestedVector(const vector<vector<pair<ll, ll>>> &v) {
    for (size_t i = 0; i < v.size(); ++i) {
        cout << "Index " << i << ": ";
        if (v[i].empty()) {
            cout << "Empty";
        } else {
            for (const auto &p : v[i]) {
                cout << "(" << p.first << ", " << p.second << ") ";
            }
        }
        cout << endl;
    }
}
bool func(string &s,ll m,ll k){

}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll T;
    cin >> T;
    while (T--) {
        string s;
        cin>>s;
        ll n=s.size();
        ll sm=0,tos=0,tes=0;
        for(int i=0;i<n;i++){
            sm+=s[i]-'0';
            if(s[i]=='2'){
                tos++;
            }else if(s[i]=='3'){
                tes++;
            }
        }
        if(sm%9==0){
            cout<<"YES"<<endl;
        }else if(sm%9==1 && ((tos>3) || (tos>0 && tes>0))){
            cout<<"YES"<<endl;
        }else if(sm%9==3 && (tos>=3 || tes>=1)){
            cout<<"YES"<<endl;
        }else if(sm%9==5 && tos>=2){
            cout<<"YES"<<endl;
        }else if(sm%9==7 && tos>=1){
            cout<<"YES"<<endl;
        }else if(sm%9==6 && (tes>=2 || (tes>=1 && tos>=3) || (tos>=6))){
            cout<<"YES"<<endl;
        }else if(sm%9==4 && ((tes>=2 && tos>=1) || (tes>=1 && tos>=4) || (tos>=7)) ){
            cout<<"YES"<<endl;
        }else if(sm%9==2 && ((tes>=2 && tos>=2) || (tes>=1 && tos>=5) || (tos>=8))){
            cout<<"YES"<<endl;
        }else if(sm%9==8 && ((tes>=1 && tos>=2) || (tos>=5))){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
    }
    return 0;
}