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

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

#define fr(x) for (int i = 1; i <= x; i++)
#define debug(x) cout << x << "\n"
#define MAXN 300006
#define MOD 998244353
typedef long long int ll;

int arr[MAXN];

ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1;
    ll gcd = gcdExtended(b%a, a, &x1, &y1);
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(ll b, ll m)
{
    ll x, y;
    ll g = gcdExtended(b, m, &x, &y);
    return (x%m + m) % m;
}

ll divisionModular(ll a, ll b, ll m)
{
    a = a % m;
    ll inv = modInverse(b, m);
    ll resp = (inv * a) % m;
    return resp;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int t;
    cin >> t;

    while(t--){
        string n;
        int sum = 0, dos = 0, seis = 0;
        cin >> n;
        for (char num: n ){
            sum += (num - '0');
            if(num == '2') dos++;
            if(num == '3') seis++;
        }

        bool pudo = false;
        if(sum % 9 == 0) pudo = true;

        for (int i = 1; i <= 100000; i++){
            int posible  = sum + (2 * i);
            if(posible % 9 == 0){
                int seisNeed = i / 3;
                int dosNeed = i - (seisNeed * 3);
                if(seisNeed > seis){
                    seisNeed -= seis;
                    dosNeed = dosNeed + (seisNeed * 3);
                }
                if(dos >= dosNeed){
                    pudo = true;
                    break;
                }
            }
        }

        if(pudo) cout << "YES";
        else cout << "NO";

        cout << "\n";
    }

    return 0;
}

/*
1
6 8
1 4 2 7 3 5
7 6 5 6 3 3
2 5
1 6
1 5
1 5
1 5
2 3
2 3
1 6



2 3 3 3 4 4 4 4 4 4 5 6 7 7 7 7 9
*/


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

#define fr(x) for (int i = 1; i <= x; i++)
#define debug(x) cout << x << "\n"
#define MAXN 300006
#define MOD 998244353
typedef long long int ll;

int arr[MAXN];

ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1;
    ll gcd = gcdExtended(b%a, a, &x1, &y1);
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(ll b, ll m)
{
    ll x, y;
    ll g = gcdExtended(b, m, &x, &y);
    return (x%m + m) % m;
}

ll divisionModular(ll a, ll b, ll m)
{
    a = a % m;
    ll inv = modInverse(b, m);
    ll resp = (inv * a) % m;
    return resp;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int t;
    cin >> t;

    while(t--){
        string n;
        int sum = 0, dos = 0, seis = 0;
        cin >> n;
        for (char num: n ){
            sum += (num - '0');
            if(num == '2') dos++;
            if(num == '3') seis++;
        }

        if(sum % 9 == 0){
            cout << "YES";
        }else{
            int falta = 9 - (sum % 9);
            bool pudo = false;
            while(dos >= 1 || seis >= 1){
                if(dos == 0){
                    while(seis >= 1){
                        sum += 6;
                        seis--;
                        if(sum % 9 == 0){
                            seis = 0;
                            pudo = true;
                            break;
                        }
                    }
                }else if(seis == 0){
                    while(dos >= 1){
                        sum += 2;
                        dos--;
                        if(sum % 9 == 0){
                            pudo = true;
                            dos = 0;
                            break;
                        }
                    }
                }else{
                    if(falta >= 6){
                        sum += 6;
                        falta -= 6;
                        seis--;
                    }
                    else{
                        sum += 2;
                        falta -= 2;
                        dos--;
                    }
                    if(falta == 0){
                        pudo = true;
                        break;
                    }else{
                        falta = 9 - (sum % 9);
                    }
                }

            }
            if(pudo) cout << "YES";
            else cout << "NO";
        }

        cout << "\n";
    }

    return 0;
}

/*
1
6 8
1 4 2 7 3 5
7 6 5 6 3 3
2 5
1 6
1 5
1 5
1 5
2 3
2 3
1 6



2 3 3 3 4 4 4 4 4 4 5 6 7 7 7 7 9
*/


Answer: 1