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

Previous submission (verdict: Wrong answer on test 1):
#include <bitset>

#include <cstdint>

#include <cmath>

#include <functional>

#include <algorithm>

#include <numeric>

#include <system_error>

#include <deque>

#include <fstream>

#include <iomanip>

#include <iostream>

#include <iterator>

#include <limits>

#include <list>

#include <map>

#include <unordered_map>

#include <queue>

#include <set>

#include <stack>

#include <string>

#include <vector>

#include <cstring>

#include <climits>

#include <sstream>

#include <cstdlib>

#define pb push_back

#define NMAX 800001

//#define MOD 1000000007

#define MOD 666013

#define nl '\n'



//#pragma GCC optimize("O3")

//#pragma GCC optimize("unroll-loops")

#define int long long

#define pii pair<int,int>

#define tpl tuple<int,int,int>

//#include "modulosum.h"

//#define cin fin

//#define cout fout

using namespace std;

const int INF=1e9;

ifstream fin("berries.in");

ofstream fout("berries.out");



/*

    ====================DEMONSTRATION======================



    16

    223333

    449933



    =========================END===========================

*/







void solve()

{

    string s;

    cin>>s;

    int sum=0;

    map<int,int>mp;

    for(auto x:s)

    {

        sum+=(x-'0');

        mp[(int)x+'0']++;



    }

    int need=9-sum%9;

//    cout<<need<<nl;

    if(need==0)

    {

        cout<<"YES"<<nl;

        return;

    }

    for(int i=0;i<=mp[2];++i)

    {

        for(int j=0;j<=mp[3];++j)

        {

            if((sum+(i*2)+(j*6))%9==0)

            {

                cout<<"YES"<<nl;

                return;

            }

        }

    }



    cout<<"NO"<<nl;

}

signed main(){



    ios_base::sync_with_stdio(false);

    cin.tie(NULL);



    int t;

    cin>>t;

    while(t--)

        solve();





    return 0;

}

Submission (verdict: Accepted):
#include <bitset>

#include <cstdint>

#include <cmath>

#include <functional>

#include <algorithm>

#include <numeric>

#include <system_error>

#include <deque>

#include <fstream>

#include <iomanip>

#include <iostream>

#include <iterator>

#include <limits>

#include <list>

#include <map>

#include <unordered_map>

#include <queue>

#include <set>

#include <stack>

#include <string>

#include <vector>

#include <cstring>

#include <climits>

#include <sstream>

#include <cstdlib>

#define pb push_back

#define NMAX 800001

//#define MOD 1000000007

#define MOD 666013

#define nl '\n'



//#pragma GCC optimize("O3")

//#pragma GCC optimize("unroll-loops")

#define int long long

#define pii pair<int,int>

#define tpl tuple<int,int,int>

//#include "modulosum.h"

//#define cin fin

//#define cout fout

using namespace std;

const int INF=1e9;

ifstream fin("berries.in");

ofstream fout("berries.out");



/*

    ====================DEMONSTRATION======================



    16

    223333

    449933



    =========================END===========================

*/







void solve()

{

    string s;

    cin>>s;

    int sum=0;

    map<int,int>mp;

    for(auto x:s)

    {

        sum+=(x-'0');

        mp[(int)x-'0']++;



    }

    int need=9-sum%9;

//    cout<<need<<nl;

    if(need==0)

    {

        cout<<"YES"<<nl;

        return;

    }

    for(int i=0;i<=mp[2];++i)

    {

        for(int j=0;j<=mp[3];++j)

        {

            int aux=(sum+(i*2)+(j*6));

//            cout<<i<<" "<<j<<" "<<sum<<nl;

            if(aux%9==0)

            {

                cout<<"YES"<<nl;

                return;

            }

        }

    }



    cout<<"NO"<<nl;

}

signed main(){



    ios_base::sync_with_stdio(false);

    cin.tie(NULL);



    int t;

    cin>>t;

    while(t--)

        solve();





    return 0;

}