Problem: 2050C - Uninteresting Number
Language: c++17 

Code 1:
#include <bits/stdc++.h>
using namespace std;

#define RANGE(i, a, b)                                                         \
    for (auto i = a - (a > b); (i < b) ^ (a > b); i += 1 - 2 * (a > b))
#define ll long long
/*
 1 -> 1 No change
 2 -> 4: +2 // only this can be applied twice, in that case: +5
 3 -> 9: +6
 So we can change x 2s to 4, and y 3s to 6s. The new remainder of the number
 becomes 2*x + 6*y == 0 [9]. We must find a solution for (x, y), with the upper
 bound being the actual number of occurence of 2s and 3s.
 Les restes possible d'un multiplication par 2 mod 9:
 1*2 = 2 [9]
 2*2 = 4 [9]
 3*2 = 6 [9]
 4*2 = 8 [9]
 5*2 = 0 [9]
 Les restes possible d'une multiplication par 6 mod 9:
 1*6 = 6 [9]
 2*6 = 3 [9]
 3*6 = 0 [9]
 Tableau des additions possibles:
 ---- 0 2 4 6 8
    0 0 2 4 6 7
    3 3 5 7 0 2
    6 6 8 1 3 5

*/

void solve() {
    ll n;
    cin >> n;
    ll count2 = 0, count3 = 0;
    ll rem = 0;
    for (; n > 0; n /= 10) {
        rem += n % 10;
        if (n % 10 == 2)
            count2++;
        else if (n % 10 == 3)
            count3++;
    }
    rem %= 9;
    // cout << count2 << " " << count3 << " " << rem << endl;
    if (count2 >= 5 && count3 >= 3) {
        cout << "Yes" << endl;
        return;
    }
    for (int n2 = 0; n2 <= min(count2, 10ll); n2++)
        for (int n3 = 0; n3 <= min(count3, 10ll); n3++)
            if ((n2 * 2 + n3 * 6 + rem) % 9 == 0) {
                cout << "Yes" << endl;
                return;
            }
    cout << "No" << endl;
}

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

    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

Code 2:
#include <bits/stdc++.h>
using namespace std;

#define RANGE(i, a, b)                                                         \
    for (auto i = a - (a > b); (i < b) ^ (a > b); i += 1 - 2 * (a > b))
#define ll long long
/*
 1 -> 1 No change
 2 -> 4: +2 // only this can be applied twice, in that case: +5
 3 -> 9: +6
 So we can change x 2s to 4, and y 3s to 6s. The new remainder of the number
 becomes 2*x + 6*y == 0 [9]. We must find a solution for (x, y), with the upper
 bound being the actual number of occurence of 2s and 3s.
 Les restes possible d'un multiplication par 2 mod 9:
 1*2 = 2 [9]
 2*2 = 4 [9]
 3*2 = 6 [9]
 4*2 = 8 [9]
 5*2 = 0 [9]
 Les restes possible d'une multiplication par 6 mod 9:
 1*6 = 6 [9]
 2*6 = 3 [9]
 3*6 = 0 [9]
 Tableau des additions possibles:
 ---- 0 2 4 6 8
    0 0 2 4 6 7
    3 3 5 7 0 2
    6 6 8 1 3 5

*/

void solve() {
    string n;
    cin >> n;
    ll count2 = 0, count3 = 0;
    ll rem = 0;
    for (auto d : n) {
        int c = d - '0';
        rem += c % 10;
        rem %= 9;
        if (c % 10 == 2)
            count2++;
        else if (c % 10 == 3)
            count3++;
    }
    for (int n2 = 0; n2 <= min(count2, 10ll); n2++)
        for (int n3 = 0; n3 <= min(count3, 10ll); n3++)
            if (((n2 * 2) % 9 + (n3 * 6) % 9 + rem) % 9 == 0) {
                cout << "Yes" << endl;
                return;
            }
    cout << "No" << endl;
}

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

    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

Answer: 2