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

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define alsammany ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define debug(x) cout<<#x<<" = "<<x<<endl
#define debugg(x, y) cout<<#x<<" = "<<x<<", "<<#y<<" = "<<y<< endl
#define vvi(r, c) vvi(r, vi(c))
#define vin(v) for(auto &i:(v))cin>>i
#define rall(v) v.rbegin(),v.rend()
#define all(v) v.begin(),v.end()
#define F first
#define S second
template <typename T> void display(const T& container) { cout << "{ "; for (const auto& element : container) { cout << element << " "; } cout << "}" << endl; } template <typename K, typename V> void display(const map<K, V>& container) { for (const auto& pair : container) { cout << "\n[" << pair.first << "]: "; display(pair.second); } }
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<pair<int,int>> vp; // vp vec(n, make_pair(0, 0));
typedef vector<vector<int>> vvi;
// struct Triple{ int first; int second; int index; };
// sort(vec.begin(), vec.end(), [](const Triple& a, const Triple& b) {return a.first < b.first;});

void Solve(){
    string s; cin>>s;
    ll sum = 0;
    for(auto e:s){
        int num = e - '0';
        sum += num;
    }

    if(sum % 9 == 0) {cout<<"YES"; return;}

    sort(all(s));
    
    for(auto e:s){
        if(e == '2') sum+=2;
        if(e == '3') sum+=6;

        if(sum % 9 == 0) {cout<<"YES"; return;}
    }
    cout<<"NO";
    
}   

int main(){
    alsammany
    int t; cin >> t; while(t--){
        Solve();
        cout << endl;
    }
    return 0;
}

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define alsammany ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define debug(x) cout<<#x<<" = "<<x<<endl
#define debugg(x, y) cout<<#x<<" = "<<x<<", "<<#y<<" = "<<y<< endl
#define vvi(r, c) vvi(r, vi(c))
#define vin(v) for(auto &i:(v))cin>>i
#define rall(v) v.rbegin(),v.rend()
#define all(v) v.begin(),v.end()
#define F first
#define S second
template <typename T> void display(const T& container) { cout << "{ "; for (const auto& element : container) { cout << element << " "; } cout << "}" << endl; } template <typename K, typename V> void display(const map<K, V>& container) { for (const auto& pair : container) { cout << "\n[" << pair.first << "]: "; display(pair.second); } }
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<pair<int,int>> vp; // vp vec(n, make_pair(0, 0));
typedef vector<vector<int>> vvi;
// struct Triple{ int first; int second; int index; };
// sort(vec.begin(), vec.end(), [](const Triple& a, const Triple& b) {return a.first < b.first;});

void Solve(){
    string s; cin>>s;
    ll sum = 0;
    bool f = 0;
    for(auto e:s){
        int num = e - '0';
        sum += num;
        if(num == 3) f = 1;
    }

    if(sum % 9 == 0) {cout<<"YES"; return;}

    sort(all(s));
    
    for(auto e:s){
        if(e == '2') {
            sum+=2;
            if( (sum+6) % 9 == 0 && f) {cout<<"YES"; return;}
        }
        if(e == '3') sum+=6;

        if(sum % 9 == 0) {cout<<"YES"; return;}
    }
    cout<<"NO";
    
}   

int main(){
    alsammany
    int t; cin >> t; while(t--){
        Solve();
        cout << endl;
    }
    return 0;
}