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;

typedef long long ll;

int main()

{

    int t;

    cin >> t;

    while(t--) {

        ll n;

        cin >> n;

        

        unordered_map<int, int> m; 

        vector<int> v;

        ll sum = 0;

        while(n != 0) {

            int x = n % 10;

            v.push_back(x);

            sum += x;

            m[x]++;

            n /= 10; 

        }

        

        ll p = sum % 9;

        

        if(p == 1) {

            if((m[2] >= 1 && m[3] >= 1) || (m[2] >= 4)) {

                cout << "YES" << endl;

            } else {

                cout << "NO" << endl;

            }

        } else if(p == 2) {

            if((m[3] >= 2 && m[2] >= 2) || (m[3] >= 1 && m[2] >= 5) || m[2] >= 8) {

                cout << "YES" << endl;

            } else {

                cout << "NO" << endl;

            }

        } else if(p == 4) {

            if((m[3] >= 2 && m[2] >= 1) || (m[3] >= 1 && m[2] >= 4) || m[2] >= 7) {

                cout << "YES" << endl;

            } else {

                cout << "NO" << endl;

            }

        } else if(p == 6) {

            if(m[3] >= 2 || (m[3] >= 1 && m[2] >= 3) || m[2] >= 6) {

                cout << "YES" << endl;

            } else {

                cout << "NO" << endl;

            }

        } else if(p == 8) {

            if((m[3] >= 1 && m[2] >= 2) || m[2] >= 5) {

                cout << "YES" << endl;

            } else {

                cout << "NO" << endl;

            }

        } else if(p == 3) {

            if(m[3] >= 1 || m[2] >= 3) {

                cout << "YES" << endl;

            } else {

                cout << "NO" << endl;

            }

        } else if(p == 5) {

            if(m[2] >= 2) {

                cout << "YES" << endl;

            } else {

                cout << "NO" << endl;

            }

        } else if(p == 7) {

            if(m[2] >= 1) {

                cout << "YES" << endl;

            } else {

                cout << "NO" << endl;

            }

        } else {

            cout << "YES" << endl;

        }

    }



    return 0;

}



Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

    int t;

    cin >> t;

    while(t--) {

        ll n;

        cin >> n;

        

        unordered_map<int, int> m; 

        vector<int> v;

        ll sum = 0;

        while(n != 0) {

            int x = n % 10;

            v.push_back(x);

            sum += x;

            m[x]++;

            n /= 10; 

        }

        

        ll p = sum % 9;

        

        int a = m[2];

        int b = m[3];

        bool possible = 0;

        for(int i = 0; i <= a; i++) {

            for(int j = 0; j <= b; j++) {

                if((p + 2 * i + 6 * j) % 9 == 0) {

                    possible = true;

                    break;

                }

            }

            if(possible) break; 

        }

        if(possible) 

            cout << "YES" << endl;

        else 

            cout << "NO" << endl;

    } 



    return 0;

}