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

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

using namespace std;



// Yash Raj 2112047

#define ll long long

#define ld long double

#define pb push_back

#define mp make_pair

#define all(v) (v).begin(), (v).end()

#define rall(v) (v).rbegin(), (v).rend()

#define sz(x) (int)(x).size()

#define F first

#define S second

#define endl '\n'



// Fast Input/Output

void fast_io() {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

}



// Debugging (for personal use during development)

#define debug(x) cerr << #x << " = "; _print(x); cerr << endl;

template <typename T> void _print(T x) { cerr << x; }

template <typename T, typename V> void _print(pair<T, V> p) { cerr << "{" << p.F << "," << p.S << "}"; }

template <typename T> void _print(vector<T> v) { cerr << "[ "; for (T i : v) { _print(i); cerr << " "; } cerr << "]"; }



int main() {

    fast_io(); // Ensures fast input/output

    

    ll t;

    cin >> t; // Multiple test cases

    while (t--) {

        

        ll n;

        cin >> n;

        ll two = 0, three = 0, sum = 0;

        

        ll temp = n;

        while (temp > 0) {

            ll digit = temp % 10;

            sum += digit;

            if (digit == 2) two++;

            if (digit == 3) three++;

            temp /= 10;

        }

        

        if (sum % 9 == 0) {

            cout << "YES" << endl;

            continue;

        }



        bool flag = false;

        for (ll i = 0; i <= min(two, 9LL); i++) {

            for (ll j = 0; j <= min(three, 9LL); j++) {

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

                    cout << "YES" << endl;

                    flag = true;

                    break;

                }

            }

            if (flag) break;

        }



        if (!flag) cout << "NO" << endl;



    }



    return 0;

}

Submission (verdict: Accepted):
#include <bits/stdc++.h>

using namespace std;



// Yash Raj 2112047

#define ll long long

#define ld long double

#define pb push_back

#define mp make_pair

#define all(v) (v).begin(), (v).end()

#define rall(v) (v).rbegin(), (v).rend()

#define sz(x) (int)(x).size()

#define F first

#define S second

#define endl '\n'



// Fast Input/Output

void fast_io() {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

}



int main() {

    fast_io(); // Ensures fast input/output

    

    ll t;

    cin >> t; // Multiple test cases

    while (t--) {

        

        string s;

        cin >> s;



        ll sum = 0, two = 0, three = 0;



        // Convert characters to integers and compute sum, count of 2s and 3s

        for (char ch : s) {

            ll digit = ch - '0'; // Convert char to integer

            sum += digit;

            if (digit == 2) two++;

            if (digit == 3) three++;

        }



        if (sum % 9 == 0) {

            cout << "YES" << endl;

            continue;

        }



        bool flag = false;

        for (ll i = 0; i < min(10LL, two + 1); i++) {

            for (ll j = 0; j < min(10LL, three + 1); j++) {

                if ((sum + i * 2 + j * 6) % 9 == 0) { // Corrected multiplier for 3

                    cout << "YES" << endl;

                    flag = true;

                    break;

                }

            }

            if (flag) break;

        }



        if (!flag) cout << "NO" << endl;

    }



    return 0;

}