Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
#define FASTIO                    \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
#define ll long long
#define For(i, a, b) for (ll i = a; i < b; i++)
#define Rfor(i, a, b) for (ll i = a; i >= b; i--)
#define srt(a) sort(a.begin(), a.end())
#define all(a) a.begin(), a.end()
#define rsrt(a) sort(a.rbegin(), a.rend())
#define pb push_back
using namespace std;
int main()
{
    FASTIO;
    ll t = 1;
    cin >> t;
    while (t--)
    {
        string s;
        cin >> s;
        ll sum = 0;
        map<char, ll> mp;
        For(i, 0, s.size())
        {
            sum += s[i] - '0';
            mp[s[i]]++;
        }
        sum %= 9;
        //cout << "sum: " << sum << "\n";
        if (sum == 0)
        {
            cout << "YES\n";
            continue;
        }
        else if (sum == 1)
        {
            if ((mp['2'] >= 4) || (mp['3'] >= 1 && mp['2'] >= 1))
                cout << "YES\n";
            else
                cout << "NO\n";
        }
        else if (sum == 2)
        {
            if ((mp['3'] >= 2 && mp['2'] >= 2) || (mp['2'] >= 8) || (mp['3'] >= 1 && mp['2'] >= 5))
                cout << "YES\n";
            else
                cout << "NO\n";
        }
        else if (sum == 3)
        {
            if (mp['3'] >=1 || mp['2'] >= 3)
                cout << "YES\n";
            else
                cout << "NO\n";
        }
        else if (sum == 4)
        {
            if ((mp['2'] >= 7) || (mp['3'] >= 2 && mp['2'] >= 1) || (mp['3'] >= 1 && mp['2'] >= 4))
                cout << "YES\n";
            else
                cout << "NO\n";
        }
        else if (sum == 5)
        {
            if ((mp['2'] >= 2))
                cout << "YES\n";
            else
                cout << "NO\n";
        }
        else if (sum == 6)
        {
            if (mp['3'] >= 2 || mp['2'] >= 6||(mp['3']>=1&&mp['2']>=3))
                cout << "YES\n";
            else
                cout << "NO\n";
        }
        else if (sum == 7)
        {
            if (mp['2'] >= 1)
                cout << "YES\n";
            else
                cout << "NO\n";
        }
        else if (sum == 8)
        {
            if (mp['3'] >= 1 && mp['2'] >= 2)
                cout << "YES\n";
            else
                cout << "NO\n";
        }
    }
    return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
#define FASTIO                    \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
#define ll long long
#define For(i, a, b) for (ll i = a; i < b; i++)
#define Rfor(i, a, b) for (ll i = a; i >= b; i--)
#define srt(a) sort(a.begin(), a.end())
#define all(a) a.begin(), a.end()
#define rsrt(a) sort(a.rbegin(), a.rend())
#define pb push_back
using namespace std;
int main()
{
    FASTIO;
    ll t = 1;
    cin >> t;
    while (t--)
    {
        string s;
        cin >> s;
        ll sum = 0;
        map<char, ll> mp;
        For(i, 0, s.size())
        {
            sum += s[i] - '0';
            mp[s[i]]++;
        }
        sum %= 9;
        //cout << "sum: " << sum << "\n";
        if (sum == 0)
        {
            cout << "YES\n";
            continue;
        }
        else if (sum == 1)
        {
            if ((mp['2'] >= 4) || (mp['3'] >= 1 && mp['2'] >= 1))
                cout << "YES\n";
            else
                cout << "NO\n";
        }
        else if (sum == 2)
        {
            if ((mp['3'] >= 2 && mp['2'] >= 2) || (mp['2'] >= 8) || (mp['3'] >= 1 && mp['2'] >= 5))
                cout << "YES\n";
            else
                cout << "NO\n";
        }
        else if (sum == 3)
        {
            if (mp['3'] >=1 || mp['2'] >= 3)
                cout << "YES\n";
            else
                cout << "NO\n";
        }
        else if (sum == 4)
        {
            if ((mp['2'] >= 7) || (mp['3'] >= 2 && mp['2'] >= 1) || (mp['3'] >= 1 && mp['2'] >= 4))
                cout << "YES\n";
            else
                cout << "NO\n";
        }
        else if (sum == 5)
        {
            if ((mp['2'] >= 2))
                cout << "YES\n";
            else
                cout << "NO\n";
        }
        else if (sum == 6)
        {
            if (mp['3'] >= 2 || mp['2'] >= 6||(mp['3']>=1&&mp['2']>=3))
                cout << "YES\n";
            else
                cout << "NO\n";
        }
        else if (sum == 7)
        {
            if (mp['2'] >= 1)
                cout << "YES\n";
            else
                cout << "NO\n";
        }
        else if (sum == 8)
        {
            if ((mp['3'] >= 1 && mp['2'] >= 2)||(mp['2']>=5))
                cout << "YES\n";
            else
                cout << "NO\n";
        }
    }
    return 0;
}