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

Solution 1 (runtime: 46 ms):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define endl "\n"
#define int long long
#define pb push_back
#define cy cout <<"YES"<< endl
#define cn cout <<"NO"<< endl
#define all(x) x.begin(),x.end()
#define fastread std::ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

const int MOD = 1e18+7;
int ceil_div(int a, int b) { return a%b==0 ? a/b : a/b+1;}
int gcd(int a, int b) { if(a==0LL) { return b;} return gcd(b%a, a);}
int lcm(int a, int b) {return a*b/gcd(a,b);}

bool sorted(pair<int,int> &a, pair<int,int> &b) {
    if(a.first == b.first) 
        return a.second < b.second; // ascending
    return a.first > b.first; // descending
}

int exp(int a, int b) {
    if(b==0) return 1;
    int half_power = exp(a,b/2);
    a %= MOD;
    if(b%2==0) return half_power * half_power % MOD;
    else return half_power * half_power % MOD * (a%MOD) % MOD;
}

void SieveOfEratosthenes(int n) {
    bool prime[n + 1];
    memset(prime, true, sizeof(prime));
    for (int p = 2; p * p <= n; p++) {
        if (prime[p] == true) {
            for (int i = p * p; i <= n; i += p)
                prime[i] = false;
        }
    }
}

int isPrime(int n) {
    for(int i=2; i*i<=n; i++) {
        if(n%i ==0)
            return false;
    }
    return true;
}

void solve() {
    string s; cin >> s;
    int c2 =0, c3 = 0, sum = 0;
    for(int i=0; i<s.size(); i++) {
        int n = s[i]-'0';
        if(n == 2)
            c2++;
        else if(n == 3)
            c3++;
        sum += n;
    }
    if(sum %9 == 0)
        cy;
    else {
        int rem = 9 - sum%9;
        if(rem&1)
            rem += 9;
        rem -= 6*min(c3, rem/6);
        if(c2 >= rem/2)
            cy;
        else
            cn;
    }
}

signed main() {
    fastread
    int t = 1; cin >> t;
    while(t--) {
        solve();
    }
}

Solution 2 (runtime: 62 ms):
#include <iostream>
#include <vector>
#include <string>

int main() {
    int t;
    int twos = 0;
    int threes = 0;
    int digitSum = 0;
    std::string number;
    bool isDivisible = false;

    std::cin >> t;

    for(int i = 0; i < t; i++) {
        std::cin >> number;

        for(int character = 0; character < number.size(); character++) {
            digitSum += number[character] - '0';
            if (number[character] == '2') {
                twos++;
            } else if (number[character] == '3') {
                threes++;
            }
        }

        for(int numTwos = 0; numTwos <= twos; numTwos++) {
            for(int numThrees = 0; numThrees <= threes; numThrees++) {
                if ((digitSum + 2 * numTwos + 6 * numThrees) % 9 == 0) {
                    isDivisible = true;
                    break;
                }
            }

            if (isDivisible) {
                break;
            }
        }

        if (isDivisible) {
            std::cout << "yes" << std::endl;
        } else {
            std::cout << "no" << std::endl;
        }

        twos = 0;
        threes = 0;
        digitSum = 0;
        isDivisible = false;
    }

    
}