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 ll long long 

const ll int INF = 0xFFFFFFFFFFFFFFFLL;



int main() {

    int t = 1;

    cin >> t;

    while(t--)

    {

        ll n;

        cin >> n;

        int sum = 0;

        int ct2 = 0;

        int ct3 = 0;

        while(n){

            sum += n%10;

            if(n%10 == 2) ct2++;

            if(n%10 == 3) ct3++;

            n/=10;

        }



        // cout << sum%9 << '\n';



        if(sum%9 == 0){

            cout << "Yes" << '\n';

        }else{

            int y = sum%9;

            bool ok = false;

            ll add = 0;

            while(ct2){

                // add += 2;

                y += 2;

                if((y)%9 == 0){

                    cout << "Yes" << '\n';

                    ok = true;

                    break;

                }

                // y += add;

                ct2--;

                // cout << add << '\n';

            }

            if(!ok){

                // add = 3;

                while(ct3){

                    // ll add = 3;

                    // add += 6;

                    y += 6;

                        if((y)%9 == 0){

                        cout << "Yes" << '\n';

                        ok = true;

                        break;

                    }

                    // y += add;

                    ct3--;

                    // cout << add << '\n';

                }

            }

            if(!ok){

                cout << "No" << '\n';

            }

        }

    }

}



Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>

using namespace std;

#define ll long long 

const ll int INF = 0xFFFFFFFFFFFFFFFLL;



int main() {

    int t = 1;

    cin >> t;

    while(t--)

    {

        ll n;

        cin >> n;

        int sum = 0;

        int ct2 = 0;

        int ct3 = 0;

        while(n){

            sum += n%10;

            if(n%10 == 2) ct2++;

            if(n%10 == 3) ct3++;

            n/=10;

        }



        // cout << sum%9 << '\n';



        if(sum%9 == 0){

            cout << "Yes" << '\n';

        }else{

            int y = sum;

            bool ok = false;

            ll add = 0;

            while(ct2){

                // add += 2;

                y += 2;

                if((y)%9 == 0){

                    cout << "Yes" << '\n';

                    ok = true;

                    break;

                }

                // y += add;

                ct2--;

                // cout << add << '\n';

            }

            if(!ok){

                // add = 3;

                while(ct3){

                    // ll add = 3;

                    // add += 6;

                    y += 6;

                        if((y)%9 == 0){

                        cout << "Yes" << '\n';

                        ok = true;

                        break;

                    }

                    // y += add;

                    ct3--;

                    // cout << add << '\n';

                }

            }

            if(!ok){

                cout << "No" << '\n';

            }

        }

    }

}