ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050C - Uninteresting Number
Language: c++20 

Code 1:
#include<bits/stdc++.h>
#define int long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

void solve(){
    string s;   cin >> s;
    
    int sum = 0;
    int cnt_2 = 0, cnt_3 = 0;
    for(int i = 0; i < s.size(); i++){
        sum += (s[i] - '0');
        if(s[i] == '2') cnt_2++;
        else if(s[i] == '3') cnt_3++;
    }
    
    for(int i = 0; i <= cnt_2; i++){
        int k = (sum + (i * 2)) % 9;
        if((k % 9 == 0) || (cnt_3 && (k % 9 == 3)) || (cnt_3 >= 2 && (k % 9 == 6))){
            cout << "YES\n";
            return;
        }
    }
    cout << "NO\n";
    
}

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

Code 2:
#include<bits/stdc++.h>
#define int long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

void solve(){
    string s;   cin >> s;
    int sum = 0;
    for(int i = 0; i < s.size(); i++){
        sum += (s[i] - '0');
    }

    int cnt_2 = 0, cnt_3 = 0;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == '2') cnt_2++;
        else if(s[i] == '3') cnt_3++;
    }
    
    while(1){
        int t = sum;
        if(sum % 9 == 0){
            cout << "YES\n";
            return;
        }

        int d = 18 - (sum % 18);
        if(d & 1){
            d = 9 - (sum % 9);
        }
        int six = min(cnt_3, (d / 6));
        d -= six * 6;
        sum += (six * 6);
        cnt_3 -= six;

        int two = min(cnt_2, (d / 2));
        d -= two * 2;
        sum += (two * 2);
        cnt_2 -= two;

        if(t == sum) break;
    }

    cout << "NO\n";
}

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

Answer: 1
Problem: 2050C - Uninteresting Number
Language: c++20 

Code 1:
#include<bits/stdc++.h>
using namespace std;

#define int long long int

int m = 1;

int find9(string x, int i, int n, int d){
	
	

	if(d == 0){
		return 1;
	}
	if(i >= n){
		return 0;
	}
	
	if((x[i]-'0') == 2){

			int a1 = find9(x, i+1, n, d);

			
			d+=2;
			d%=9;

			int a2 = find9(x, i+1, n, d);

			return (a1||a2);
		}
		else if(x[i]-'0' == 3){
			int a1 = find9(x, i+1, n, d);

			
			d+= 6;
			d%=9;

			int a2 = find9(x, i+1, n, d);

			return (a1||a2);
		}
	else
	return find9(x, i+1, n, d);
}


void solve(){
	string x;
	cin >> x;

	int ans = 0;

	
	int n = x.size();

	int a = 0, b = 0;
	
	int d = 0;
	for (int i = 0; i < n; ++i){

		if(x[i]-'0' == 2)
			a++;
		if(x[i]-'0' == 3)
			b++;

		int s = (x[i]-'0') + d*10;

		d = s%9;
	}

	if(d == 0 || a >= 8){
		ans = 1;
	}

	if(d == 1){
		if(a >= 4 || (b>= 1 && a >= 1)){
			ans = 1;
		}

	}else if(d == 2){
		if(a>=8 || (b>=1 && a>= 5) || (b >=2 && a >=2))
			ans = 1;

	}else if(d == 3){
		if(b>=1 || a >= 3){
			ans = 1;
		}
		
	}else if(d == 4){
		if(a >= 7 || (b>=2 && a>= 1) || (b>=1 && a>= 4))
			ans = 1;
		
	}else if(d == 5){
		if(a>=2)
			ans = 1;
		
	}else if(d == 6){
		if(b>= 2 || a>= 6 || (b>=1 && a>= 3))
			ans = 1;
		
	}else if(d == 7){
		if(a>= 1)
			ans = 1;
		
	}else if(d == 8){
		if(a>= 5 || (b>= 1 && a>= 2))
			ans = 1;
	}

	// else
	// ans = find9(x, 0, n, d);





	if(ans){
		cout<< "YES"<< endl;
	}
	else{
		cout<< "NO" << endl;
	}
}

int32_t main(){
	string s;
	int x = 0;

	// for(int i = 0; i<43*2+1; i++)
	// getline(cin, s);

	// int i = 0;
	// while(s[i] != '\0'){
	// 	cout<< s[i];
	// 	i++;
	// }

	// cout<< s << endl;

	int t = 0;

    cin>> t;
    while(t--){
    	solve();
    }

    return 0;
}

Code 2:
#include<bits/stdc++.h>
using namespace std;

#define int long long int

int m = 1;

int find9(string x, int i, int n, int m){
	
	// cerr << i << "-"<<x <<", ";

	
	// check divisible

	int d = 0;
	for (int i = 0; i < n; ++i)
	{
		int s = (x[i]-'0') + d*10;

		d = s%9;
	}

	if(d == 0){
		return 1;
	}


	if(i >= n){
		return 0;
	}

	// cerr << m;

	// cerr << (x/(m*1)) << " ..";


	if( (x[i]-'0') < 4 && (x[i]-'0') > 1 ){



		if((x[i]-'0') == 2){

			int a1 = find9(x, i+1, n, m);

			x[i] = (4+'0');

			int a2 = find9(x, i+1, n, m);

			return (a1||a2);
		}
		else{
			int a1 = find9(x, i+1, n, m);

			x[i] = (9+'0');

			int a2 = find9(x, i+1, n, m);

			return (a1||a2);
		}

	}
	else
	return find9(x, i+1, n, m);
}


void solve(){
	string x;
	cin >> x;

	int ans = 0;

	
	int n = x.size();
	

	ans = find9(x, 0, n, 1);


	if(ans){
		cout<< "YES"<< endl;
	}
	else{
		cout<< "NO" << endl;
	}
}

int32_t main(){
	string s;
	int x = 0;

	// for(int i = 0; i<43*2+1; i++)
	// getline(cin, s);

	// int i = 0;
	// while(s[i] != '\0'){
	// 	cout<< s[i];
	// 	i++;
	// }

	// cout<< s << endl;

	int t = 0;

    cin>> t;
    while(t--){
    	solve();
    }

    return 0;
}

Answer: 1
Problem: 2050C - Uninteresting Number
Language: c++23 

Code 1:
#include<iostream>
using namespace std;
int main(){
    int t;
    cin>>t;
    while (t>0){
        t--;
        string s;
        cin>>s;
        int sum=0;
        int n=s.length();
        int two=0,three=0;
        for (int i=0;i<n;i++){
            sum=sum + (int)s[i]-48;
            if (s[i]=='2'){
                two+=1;
            }else if(s[i]=='3'){
                three+=1;
            }
        }
        if (sum%9==0){
            cout<<"YES"<<endl;
        }
        else{
            int f=0;
            for (int i=0;i<=min(100000,two);i++){
                for (int j=0;j<=min(100000,three);j++){
                    long long m=i*2+j*6;
                    if (m%9==9-sum%9){
                        f=1;
                        break;
                    } 
                }
            }
            if (f){
                cout<<"yes"<<endl;
            }else{
                cout<<"no"<<endl;
            }
    }
}
}

Code 2:
#include<iostream>
using namespace std;
int main(){
    int t;
    cin>>t;
    while (t>0){
        t--;
        string s;
        cin>>s;
        int sum=0;
        int n=s.length();
        int two=0,three=0;
        for (int i=0;i<n;i++){
            sum=sum + (int)s[i]-48;
            if (s[i]=='2'){
                two+=1;
            }else if(s[i]=='3'){
                three+=1;
            }
        }
        if (sum%9==0){
            cout<<"YES"<<endl;
        }
        else{
            int b=9-sum%9;
            if (b%2==0){
                if (b==8 &&((two>=1 && three>=1) || (two>=4))){
                    cout<<"YES"<<endl;
                }else if (b==6 && ((three>=1)||(two>=3))){
                    cout<<"YES"<<endl;
                }else if (b==4 && two>=2){
                    cout<<"YES"<<endl;
                }else if (b==2 && two>=1){
                    cout<<"YES"<<endl;
                }else{
                    cout<<"NO"<<endl;
                }
            }else{
                b=b+9;
                if (b==16 && two>=2){
                    if ((three==1 && two>=5)|| (three>1)){
                        cout<<"YES"<<endl;
                    }else{
                        cout<<"NO"<<endl;
                    }
                }else if (b==14 && two>=1){
                    if ((three==1 && two>=4)|| (three>=2)){
                        cout<<"YES"<<endl;
                    }else{
                        cout<<"NO"<<endl;
                    }
                }else if (b==12){
                    if ((three==1 && two>=3) || (three>=2)){
                        cout<<"YES"<<endl;
                    }else{
                        cout<<"NO"<<endl;
                    }
                }else if (b==10 && two>=2){
                    if ((three==1)|| (two>=5)){
                        cout<<"YES"<<endl;
                    }else{
                        cout<<"NO"<<endl;
                    }
                }else {
                    cout<<"NO"<<endl;
                }
            }
        }
    }
    return 0;
}

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

Code 1:
#include<bits/stdc++.h>
using namespace std;

#define add emplace_back
#define FOR(i, a, b) for(int i = a;i < (b); ++i)
#define FORD(i , a, b) for(int i = a;i >= (b);i--)
#define all(v) v.begin(), v.end()
#define len(x) (x).size();

using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;
using vll = vector<ll>;

const int mod = 1e9+7;

void Main(){
	string s;
	cin >> s;
	int sum = 0, two = 0, three = 0;
	
	for(int i = 0;i < s.size(); i++){
		sum = (sum + (s[i]-48)) % 9;
		two += (s[i]=='2');
		three += (s[i]=='3');
	}
	if(sum==0) return void( cout << "YES" << "\n");
	bool ok = 0;
	for(int i = 0;i <= min(two, 6); i++){
		for(int j = 0;j <= min(three, 4); j++){
			if((sum+2*i+6*j)%9 == 0) ok = 1;
		}
	}
	cout << (ok?"YES":"NO") << "\n";
}

int main(){
	cin.tie(0)->sync_with_stdio(0);
	cin.tie(NULL);

	int t;
	for(cin>>t; t; t--) Main();

	return 0;
}



Code 2:
#include<bits/stdc++.h>
using namespace std;

#define add emplace_back
#define FOR(i, a, b) for(int i = a;i < (b); ++i)
#define FORD(i , a, b) for(int i = a;i >= (b);i--)
#define all(v) v.begin(), v.end()
#define len(x) (x).size();

using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;
using vll = vector<ll>;

const int mod = 1e9+7;

void Main(){
	string s;
	cin >> s;
	int sum = 0, two = 0, three = 0;
	
	for(int i = 0;i < s.size(); i++){
		sum = (sum + (s[i]-48)) % 9;
		two += (s[i]=='2');
		three += (s[i]=='3');
	}
	if(sum==0) return void( cout << "YES" << "\n");
	bool ok = 0;
	for(int i = 0;i <= min(two, 100); i++){
		for(int j = 0;j <= min(three, 100); j++){
			if((sum+2*i+6*j)%9 == 0) ok = 1;
		}
	}
	cout << (ok?"YES":"NO") << "\n";
}

int main(){
	cin.tie(0)->sync_with_stdio(0);
	cin.tie(NULL);

	int t;
	for(cin>>t; t; t--) Main();

	return 0;
}



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

Code 1:
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int t;
int a[N];
int c;
int x,y;
int sum;
bool f=0;
int main(){
	cin>>t;
	while(t--){
		x=0,y=0;
		for(int i=1;i<=N;i++){
			a[i]=0;
		}
		string s;
		cin>>s;
		c=s.size();
		sum=0;
		f=0;
		for(int i=0;i<c;i++){
			a[i+1]=int(s[i]-'0');
			sum+=a[i+1];
			if(a[i+1]==2){
				x++;
			}
			if(a[i+1]==3){
				y++;
			}
		}
		for(int i=0;i<=x;i++){
			for(int j=0;j<=y;j++){
				if((sum+2*i+6*j)%9==0){
					f=1;
					break;
				}
			}
			if(f==1)break;
		}
		if(f==0){
			cout<<"No"<<endl;
		}else{
			cout<<"Yes"<<endl;
		}
	}
	return 0;
}

Code 2:
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int t;
int c;
int x,y;
int sum;
bool f=0;
int main(){
	cin>>t;
	while(t--){
		string s;
		cin>>s;
		c=s.size();
		sum=0;
		f=0;
		x=0,y=0;
		for(int i=0;i<c;i++){
			sum+=int(s[i]-'0');
			if(int(s[i]-'0')==2){
				x++;
			}
			if(int(s[i]-'0')==3){
				y++;
			}
		}
		sum%=9;
		if(sum==0){
			cout<<"Yes"<<endl;
			continue;
		}
		for(int i=0;i<=x;i++){
			for(int j=0;j<=y;j++){
				if((sum+2*i+6*j)%9==0){
					f=1;
					break;
				}
			}
			if(f==1)break;
		}
		if(f==0){
			cout<<"No"<<endl;
		}else{
			cout<<"Yes"<<endl;
		}
	}
	return 0;
}

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

Code 1:
 #include <bits/stdc++.h>

using namespace std;

#define int long long



signed main () {

    ios_base::sync_with_stdio(0); cin.tie(0);



    int tt; cin >> tt;

    

    while (tt--) {

        string s; cin >> s;

        int n = s.size();

        vector<int> a (n);

        for(int i = 0; i < n; i++) a[i] = s[i] - '0';

        

        vector<vector<int>> dp (n + 1 , vector<int> (10 , 0));

        

        dp[0][a[0]] = 1;

        if(a[0] * a[0] < 10) dp[0][(a[0] * a[0]) % 9] = 1;

        

        for(int i = 1; i < n; i++){

          for(int j = 0; j < 10; j++){

              if(dp[i - 1][j]){

                  dp[i][(j + a[i]) % 9] = 1;

                 if(a[i] * a[i] < 10) dp[i][(j + a[i] * a[i]) % 9] = 1;

              }

          }

        }

        

        cout << (dp[n - 1][0] ? "YES\n" : "NO\n");

    }



    return 0;

}



Code 2:
#include <bits/stdc++.h>

using namespace std;

#define int long long



signed main () {

    ios_base::sync_with_stdio(0); cin.tie(0);



    int tt; cin >> tt;

    

    while (tt--) {

        string s; cin >> s;

        int n = s.size();

        vector<int> a (n);

        for(int i = 0; i < n; i++) a[i] = s[i] - '0';

        

        vector<vector<int>> dp (n + 1 , vector<int> (10 , 0));

        

        dp[0][a[0] % 9] = 1;

        if(a[0] * a[0] < 10) dp[0][(a[0] * a[0]) % 9] = 1;

        

        for(int i = 1; i < n; i++){

          for(int j = 0; j < 10; j++){

              if(dp[i - 1][j]){

                  dp[i][(j + a[i]) % 9] = 1;

                 if(a[i] * a[i] < 10) dp[i][(j + a[i] * a[i]) % 9] = 1;

              }

          }

        }

        

        cout << (dp[n - 1][0] ? "YES\n" : "NO\n");

    }



    return 0;

}



Answer: 2
Problem: 2050C - Uninteresting Number
Language: c++23 

Code 1:
#include <bits/stdc++.h>
using namespace std;
#define ll long long

void solve(){
	string s;
	cin >> s;
	ll n = s.size();
	s = '?' + s;
	ll n2 = 0;
	ll n3 = 0;
	ll sum = 0;
	for(ll i = 1 ; i <= n ; ++i){
		if(s[i] == '2') n2++;
		if(s[i] == '3') n3++;
		sum += s[i] - '0';
	}
	if(sum % 9 == 0){
		cout << "YES" << endl;
		return;
	}
	for(ll i = 0 ; i <= n2 ; ++i){
		for(ll j = 0 ; j <= n3 ; ++j){
			ll tsum = sum + i * 2 + j * 6;
			if(tsum % 9 == 0){
				cout << "YES" << endl;
				return;
			}
		}
	}
	cout << "NO" << endl;
}

signed main(){
	ll t;
	cin >> t;
	while(t--){
		solve();
	}
	return 0;
}

Code 2:
#include <bits/stdc++.h>
using namespace std;
#define ll long long

void solve(){
	string s;
	cin >> s;
	ll n = s.size();
	s = '?' + s;
	ll n2 = 0;
	ll n3 = 0;
	ll sum = 0;
	for(ll i = 1 ; i <= n ; ++i){
		if(s[i] == '2') n2++;
		if(s[i] == '3') n3++;
		sum += s[i] - '0';
	}
	if(sum % 9 == 0){
		cout << "YES" << endl;
		return;
	}
	for(ll i = 0 ; i <= n2 ; ++i){
		for(ll j = 0 ; j <= n3 ; ++j){
			sum += i * 2 + j * 6;
			if(sum % 9 == 0){
				cout << "YES" << endl;
				return;
			}
		}
	}
	cout << "NO" << endl;
}

signed main(){
	ll t;
	cin >> t;
	while(t--){
		solve();
	}
	return 0;
}

Answer: 1
Problem: 2050C - Uninteresting Number
Language: python

Code 1:
def solve(num):
    three = 0
    two = 0
    s = 0
    s2 = 0
    for i in num:
        if i == '2':
            two += 1

        if i == '3':
            s2 += 9
        else:
            s2 += int(i)
        s += int(i)

    if s%9 == 0 or s2%9==0:
        return "YES"

    if two == 0:
        return "NO"

    for i in range(1,two + 1):
        if (2*i + s ) % 9 == 0 or (2*i + s2 ) % 9 == 0 :
            return "YES"
    return "NO"

for _ in range(int(input())):
    print(solve(input()))


Code 2:
def solve(num):
    three = 0
    two = 0
    s = 0
    for i in num:
        if i == '2':
            two += 1
        elif i == '3':
            three += 1
        s += int(i)

    if s % 9 == 0:
        return "YES"

    for i in range(min(9,two+1)):
        for j in range(min(7,three+1)):
            if (s + 2*i + 6*j ) % 9 == 0:
                return "YES"
    return "NO"




for _ in range(int(input())):
    print(solve(input()))


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

Code 1:
#include<bits/stdc++.h>
using namespace std ;

typedef unsigned long long ull ;
typedef long long ll ;
typedef long double ld ;

const ll mod = 1e9+7;
const ld eps = 1e-9 ;
const ll maxn = 1e5+1;
const ll inf = 1e15;
const ll minf = -inf;

#define int long long
#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()


void solve(){
    string s ; cin >> s ;
    int n = s.size() ;

    int sum = 0 ;
    int two = 0 , three = 0 ;

    for(int i=0;i<n;i++){
        if(s[i] == '2')two++ ;
        if(s[i] == '3')three++ ;
        sum += s[i]-'0' ;
    }

    for(int i=0;i<min(10ll , two+1);i++){
        for(int j=0;j<min(10ll , three+1);j++){
            if((sum + i*2 + j*6) %9 == 0){
                cout << "YES" << endl ;
                return ;
            }
        }
    }
    cout << "NO" << endl ;
    return ;
}

int32_t main(){
 
   ios_base::sync_with_stdio(false);
   cin.tie(0);

   int t = 1; cin >> t;
    for(int i=1; i<=t; i++){
        //cout<<"Case #"<<i<<": \n";
        solve();
    }
}  

Code 2:
#include<bits/stdc++.h>
using namespace std ;

typedef unsigned long long ull ;
typedef long long ll ;
typedef long double ld ;

const ll mod = 1e9+7;
const ld eps = 1e-9 ;
const ll maxn = 1e5+1;
const ll inf = 1e15;
const ll minf = -inf;

#define int long long
#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()


void solve(){
    string s ; cin >> s ;
    int n = s.size() ;

    int sum = 0 ;
    int two = 0 , three = 0 ;

    for(int i=0;i<n;i++){
        if(s[i] == '2')two++ ;
        if(s[i] == '3')three++ ;
        sum += s[i]-'0' ;
    }

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

    for(int i=0;i<min(8ll , two+1);i++){
        for(int j=0;j<min(8ll , three+1);j++){
            if((sum + i*2 + j*6) %9 == 0){
                cout << "YES" << endl ;
                return ;
            }
        }
    }
    cout << "NO" << endl ;
    return ;
}

int32_t main(){
 
   ios_base::sync_with_stdio(false);
   cin.tie(0);

   int t = 1; cin >> t;
    for(int i=1; i<=t; i++){
        //cout<<"Case #"<<i<<": \n";
        solve();
    }
}  

Answer: 1
Problem: 2050C - Uninteresting Number
Language: python

Code 1:
import sys

input_data = sys.stdin.read().strip()

lines = input_data.splitlines()
lines.pop(0)

inp=[]
ans=[]
k=0
for line in lines:
   inp.append(int(line))
    
def get_digits(number):
    return [int(digit) for digit in str(abs(number))]

def count(dig):
    three = 0
    two = 0
    for d in dig:
        if d == 2:
            two += 1
        if d == 3:
            three += 1
    return two, three

for num in inp:
    nta = (num % 9)
    digits = get_digits(num)
    q2, q3 = count(digits)
    i, j = 0, 0
    f = 0
    while i <= q3:
        while j <= q2:
            if (nta + 6*i + j) % 9 == 0:
                ans.append("YES")
                f = 1
                break
            j += 1
        if f == 1:
            break
        j = 0
        i += 1
    if f == 0:
        ans.append("NO")
            
for a in ans:
    print(a)

        
        

        
        
    


Code 2:
import sys

input_data = sys.stdin.read().strip()

lines = input_data.splitlines()
lines.pop(0)

inp=[]
ans=[]
k=0
for line in lines:
   inp.append(int(line))
    
def get_digits(number):
    return [int(digit) for digit in str(abs(number))]

def count(dig):
    three = 0
    two = 0
    for d in dig:
        if d == 2:
            two += 1
        if d == 3:
            three += 1
    return two, three

for num in inp:
    nta = (num % 9)
    digits = get_digits(num)
    q2, q3 = count(digits)
    i, j = 0, 0
    f = 0
    while i <= q3:
        while j <= q2:
            if (nta + 6*i + 2*j) % 9 == 0:
                ans.append("YES")
                f = 1
                break
            j += 1
        if f == 1:
            break
        j = 0
        i += 1
    if f == 0:
        ans.append("NO")
            
for a in ans:
    print(a)

        
        

        
        
    


Answer: 2
Problem: 2050C - Uninteresting Number
Language: c++23 

Code 1:
#pragma GCC optimize("Ofast", "inline")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define M 1000000007
void solve() {   
    string n;
    cin>>n;
    ll b = 0, c = 0;
    ll sum = 0;
    for(ll i = 0;i<n.size();i++) {
        sum+=(n[i]-'0');
        if(n[i]=='2') b++;
        else if(n[i]=='3') c++;
    }
    for(ll i = 0;i<=b;i++) {
        for(ll x = 0;x<=c;x++) {
            if((sum+(i*2)+(x*6))%9==0) {
                cout<<"YES"<<"\n";
                return;
            }
        }
    }
    cout<<"NO"<<"\n";
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin>>t;
    for(ll j = 0;j<t;j++){
        solve();
    }
}


Code 2:
#pragma GCC optimize("Ofast", "inline")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define M 1000000007
void solve() {   
    ll n;
    cin>>n;
    map<ll,ll> mp;
    ll sum = 0;
    while(n>0) {
        ll a = n%10;
        n/=10;
        mp[a]++;
        sum+=a;
    }
    ll b = mp[2];
    ll c = mp[3];
    for(ll i = 0;i<=b;i++) {
        for(ll x = 0;x<=c;x++) {
            if((sum+(i*2)+(x*6))%9==0) {
                cout<<"YES"<<"\n";
                return;
            }
        }
    }
    cout<<"NO"<<"\n";
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin>>t;
    for(ll j = 0;j<t;j++){
        solve();
    }
}


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

Code 1:
/* In the Name of ALLAH */
/** Minhaz Uddin
   Dept of CSE,Comilla University*/

#include<bits/stdc++.h>
#define ll long long
#define yes cout<<"YES"<<'\n';
#define no cout<<"NO"<<'\n';
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define tst int t;cin>>t;while(t--)
#define pb push_back
#define rvs reverse(v.begin(),v.end())
#define srt sort(v.begin(),v.end())

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
const ll  N = 1e7+9;

void solve()
{
string s;
cin>>s;
ll n,i,j, sum = 0, c2 = 0, c3 = 0;
for(i = 0;i<s.size();i++)
{
    sum+=s[i]-'0';
    if(s[i]=='2')c2++;
    else if(s[i]=='3')c3++;
}
if(sum%9==0)yes
else
{
    ll mod =9- (sum%9);
    if(mod%2==1)mod+=9;
    while(mod-6>=0 && c3>0)
    {
        mod-=6;
        c3--;
    }
    while(mod-2>=0 && c2>0)
    {
        mod-=2;
        c2--;
    }
    if(mod==0)yes
    else no
}
}



int main()
{
optimize();
tst{
solve();
}
return 0;
}


Code 2:
/* In the Name of ALLAH */
/** Minhaz Uddin
   Dept of CSE,Comilla University*/

#include<bits/stdc++.h>
#define ll long long
#define yes cout<<"YES"<<'\n';
#define no cout<<"NO"<<'\n';
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define tst int t;cin>>t;while(t--)
#define pb push_back
#define rvs reverse(v.begin(),v.end())
#define srt sort(v.begin(),v.end())

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
const ll  N = 1e7+9;

void solve()
{
string s;
cin>>s;
ll n,i,j, sum = 0, c2 = 0, c3 = 0;
for(i = 0;i<s.size();i++)
{
    sum+=s[i]-'0';
    if(s[i]=='2')c2++;
    else if(s[i]=='3')c3++;
}
if(sum%9==0)yes
else
{
    ll mod =9- (sum%9);
    //cout<<mod<<endl;
    if(mod==8)
    {
        if(c3>=1 && c2>=1)yes
        else if(c3>=0 && c2>=4)yes
        else no
    }
    else if(mod==7)
    {
        if(c2>=2 && c3>=2)yes
        else if(c3>=1 && c2>=5)yes
        else no
    }
    else if(mod==6)
    {
       if(c3>=1)yes
       else if(c2>=3) yes
        else no
    }
    else if(mod==5)
    {
        if(c3>=2 && c2>=1)yes
        else if(c3>=1 && c2>=4)yes
        else no
    }
    else if(mod==4)
    {
        if(c2>=2 )yes
        else no
    }
    else if(mod==3)
    {
        if(c3>=1 && c2>=3)yes
        else if(c3>=2)yes
        else if(c2>=6)yes
        else no
    }
    else if(mod==2)
    {
        if(c2>=1)yes
        else no
    }
    else if(mod==1)
    {
        if(c2>=2 && c3>=1)yes
        else if(c2>=5)yes
        else no
    }

    else no
}
}



int main()
{
optimize();
tst{
solve();
}
return 0;
}

Answer: 1