Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
    #include <ctime>
    #include <chrono>
    #include <cmath>
    using namespace std;
    typedef long long ll; 
    typedef vector<int> vi;
    typedef vector<ll> vll;
    #define cy() cout << "YES" << '\n'
    #define cn() cout << "NO" << '\n'
    const double pi=    3.14159265358979323846;
 
    // Function to check if an integer is prime or not
    bool isprime(ll n){
        if(n<2){
            return false;
        }
        for(ll i = 2;i<=sqrt(n);i++){
            if(n%i==0){
                return false;
            } 
        }
        return true;
    }
    bool pointscompare(pair<string,int> &a ,pair<string,int>  &b){
        return a.second>b.second;
    }
    bool goaldiffcompare(pair<string,int> &a , pair<string,int> &b){
        return a.second>b.second;
    }
    bool cmp(pair<string, int>& a, 
        pair<string, int>& b) 
    { 
        return a.second < b.second; 
    }
    bool isSorted(const std::vector<int>& arr) {
    for (size_t i = 1; i < arr.size(); ++i) {
        if (arr[i] < arr[i - 1]) {
            return false; 
        }
        }
        return true; 
    }
   
    void solve(){   
        //     ...............................
        //     >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        string s;
        cin >> s;
        int sum = 0;
        int two = 0;
        int three = 0;

        for(int i = 0;i<s.size();i++){
            sum += s[i] - '0';
            if(s[i]=='2'){
                two+=1;
            }
            if(s[i]=='3'){
                three+=1;
            }
        }
        set<int> v;
        if(sum%9!=0){

        
        for(int i = 0;i<=two;i++){
            for(int j = i;j<=three;j++){
                v.insert(2*i + 6*j);
            }
        }
        for(auto x : v){
            // cout << x.first.first << " " << x.first.second << " " << x.second << ' ' << sum%9 << '\n';
        }
        bool p =  false;
        for(auto x : v){
            if((sum+x)%9==0){
                cout << "YES" << '\n';
                p = true;
                break;
            }
        }
        if(!p){
            cout << "NO" << '\n';
        }
        }else{
            cout << "YES" << '\n';
        }
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        std::cout.tie(0); 
        // freopen("input.txt","r",stdin);
        // freopen("output.txt","w",stdout);
        int tt;
        cin >> tt;
        while(tt--){
            using std::chrono::high_resolution_clock;
            using std::chrono::duration_cast;
            using std::chrono::duration;
            using std::chrono::milliseconds;
            auto t1 = high_resolution_clock::now();
           solve();
            auto t2 = high_resolution_clock::now();
            auto ms_int = duration_cast<milliseconds>(t2 - t1);
            duration<double, std::milli> ms_double = t2 - t1;
            // std::cout << ms_double.count() << "ms\n";
        }
        return 0;  
    } 

Submission (verdict: Accepted):
#include <bits/stdc++.h>
    #include <ctime>
    #include <chrono>
    #include <cmath>
    using namespace std;
    typedef long long ll; 
    typedef vector<int> vi;
    typedef vector<ll> vll;
    #define cy() cout << "YES" << '\n'
    #define cn() cout << "NO" << '\n'
    const double pi=    3.14159265358979323846;
 
    // Function to check if an integer is prime or not
    bool isprime(ll n){
        if(n<2){
            return false;
        }
        for(ll i = 2;i<=sqrt(n);i++){
            if(n%i==0){
                return false;
            } 
        }
        return true;
    }
    bool pointscompare(pair<string,int> &a ,pair<string,int>  &b){
        return a.second>b.second;
    }
    bool goaldiffcompare(pair<string,int> &a , pair<string,int> &b){
        return a.second>b.second;
    }
    bool cmp(pair<string, int>& a, 
        pair<string, int>& b) 
    { 
        return a.second < b.second; 
    }
    bool isSorted(const std::vector<int>& arr) {
    for (size_t i = 1; i < arr.size(); ++i) {
        if (arr[i] < arr[i - 1]) {
            return false; 
        }
        }
        return true; 
    }
   
    void solve(){   
        //     ...............................
        //     >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        string s;
        cin >> s;
        int sum = 0;
        int two = 0;
        int three = 0;

        for(int i = 0;i<s.size();i++){
            sum += s[i] - '0';
            if(s[i]=='2'){
                two+=1;
            }
            if(s[i]=='3'){
                three+=1;
            }
        }
        set<int> v;
        if(sum%9!=0){

        
        for(int i = 0;i<=min(8,two);i++){
            for(int j = 0;j<=min(8,three);j++){
                v.insert(2*i + 6*j);
            }
        }
        for(auto x : v){
            // cout << x.first.first << " " << x.first.second << " " << x.second << ' ' << sum%9 << '\n';
        }
        bool p =  false;
        for(auto x : v){
            if((sum+x)%9==0){
                cout << "YES" << '\n';
                p = true;
                break;
            }
        }
        if(!p){
            cout << "NO" << '\n';
        }
        }else{
            cout << "YES" << '\n';
        }
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        std::cout.tie(0); 
        // freopen("input.txt","r",stdin);
        // freopen("output.txt","w",stdout);
        int tt;
        cin >> tt;
        while(tt--){
            using std::chrono::high_resolution_clock;
            using std::chrono::duration_cast;
            using std::chrono::duration;
            using std::chrono::milliseconds;
            auto t1 = high_resolution_clock::now();
           solve();
            auto t2 = high_resolution_clock::now();
            auto ms_int = duration_cast<milliseconds>(t2 - t1);
            duration<double, std::milli> ms_double = t2 - t1;
            // std::cout << ms_double.count() << "ms\n";
        }
        return 0;  
    }