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

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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int t;
    cin >> t;
    while (t--){
        string num;
        cin >> num;
        int l = num.size();
        int qs = 0;
        int cnt2 = 0, cnt3 = 0;
        for (int i = 0; i < l; i++){
            if (num[i]-'0' == 2){
                cnt2++;
            }
            else if (num[i]-'0' == 3){
                cnt3++;
            }
            qs += num[i]-'0';
        }
        bool ch = false;
        int temp;
        for (int i = 0; i <= cnt2; i++){
            for (int j = 0; j <= cnt3; j++){
                temp = qs;
                qs += (2*i)+(6*j);
                if (qs%9==0) ch = true;
                if (ch) break;
                qs = temp;
            }
            if (ch) break;
        }
        if (ch) cout << "YES\n";
        else cout << "NO\n";
    }

    return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int t;
    cin >> t;
    while (t--){
        string num;
        cin >> num;
        int l = num.size();
        int qs = 0;
        int cnt2 = 0, cnt3 = 0;
        for (int i = 0; i < l; i++){
            if (num[i]-'0' == 2){
                cnt2++;
            }
            else if (num[i]-'0' == 3){
                cnt3++;
            }
            qs += num[i]-'0';
        }
        bool ch = false;
        qs%=9;
        if (qs == 0) ch = true;
        if (qs == 7 && cnt2 >= 1) ch = true;
        if (qs == 6 && (cnt2 >= 6 || cnt3 >= 2 || (cnt3 >= 1 && cnt2 >= 3))) ch = true;
        if (qs == 5 && cnt2 >= 2) ch = true;
        if (qs == 3 && (cnt2 >= 3 || cnt3 >= 1)) ch = true;
        if (qs == 2 && cnt2 >= 8 || (cnt3 >= 1 && cnt2 >= 5) || (cnt3 >= 2 && cnt2 >= 2)) ch = true;
        if (qs == 1 && (cnt2 >= 4 || (cnt2 >= 1 && cnt3 >= 1))) ch = true;
        if (ch) cout << "YES\n";
        else cout << "NO\n";
    }

    return 0;
}


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

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

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        string num;
        cin >> num;

        int twos_count = 0, threes_count = 0, sum = 0;

        // Process digits as a string to avoid overflow
        for (char digit : num)
        {
            int k = digit - '0';
            if (k == 2)
                twos_count++;
            else if (k == 3)
                threes_count++;
            sum += k;
        }

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

        // Limit effective counts based on problem constraints
        twos_count = min(twos_count, 8);
        threes_count = min(threes_count, 5);

        bool marker = false;
        int rem = sum % 9;

        for (int i = 0; i <= threes_count; i++)
        {
            for (int j = 0; j <= twos_count; j++)
            {
                if ((rem + i * 6 + j * 2) % 9 == 0)
                {
                    marker = true;
                    break;
                }
            }
            if (marker)
                break;
        }

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

    return 0;
}


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

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        string num;
        cin >> num;

        int twos_count = 0, threes_count = 0, sum = 0;

        // Process digits as a string to avoid overflow
        for (char digit : num)
        {
            int k = digit - '0';
            if (k == 2)
                twos_count++;
            else if (k == 3)
                threes_count++;
            sum += k;
        }

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

        // Limit effective counts based on problem constraints
        twos_count = min(twos_count, 5);
        threes_count = min(threes_count, 3);

        bool marker = false;
        int rem = sum % 9;

        for (int i = 0; i <= threes_count; i++)
        {
            for (int j = 0; j <= twos_count; j++)
            {
                if ((rem + i * 6 + j * 2) % 9 == 0)
                {
                    marker = true;
                    break;
                }
            }
            if (marker)
                break;
        }

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

    return 0;
}


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

Code 1:
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
 
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
 
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define BUFF ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 
const int INF = 0x3F3F3F3F;
 
signed main()
{
    BUFF;
    int t; 
    string num;
    cin >> t;
    while(t--) {
        cin >> num;

        int soma = 0;
        int num2 = 0, num3 = 0;
        for(int i = 0; i < num.size(); i++) {
            soma += num[i] - '0';
            soma % 9;
            if(num[i] == '2') num2++;
            if(num[i] == '3') num3++;
        }

        if(soma % 9 == 0 || num3 == num.size()) cout << "YES" << endl;
        else {
            while(soma % 2 == 0 && num3) {
                soma = (soma+6)%9;
                num3--;
            }

            while(soma % 2 == 0 && num2) {
                soma = (soma+2)%9;
                num2--;
            }
            if((soma == 1 && num2 >= 4) || (soma == 3 && num2 >= 3) || (soma == 5 && num2 >= 2) || (soma == 7 && num2 >= 1)) cout << "YES" << endl;
            else cout << "NO" << endl;
        }
    }
    return 0; 
}

Code 2:
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
 
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
 
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define BUFF ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 
const int INF = 0x3F3F3F3F;

bool possible(int num, int num2, int num3) {
    if(num == 9 || num == 18)  return true;
    if(num > 18) return false;

    if(num2 && num3) {
        if(possible(num+2, num2-1, num3)) return true;
        if(possible(num+6, num2, num3-1)) return true;
    } else if(num3) {
        if(possible(num+6, num2, num3-1)) return true;
    } else if(num2) {
        if(possible(num+2, num2-1, num3)) return true;
    }

    return false;
}
 
signed main()
{
    BUFF;
    int t; 
    string num;
    cin >> t;
    while(t--) {
        cin >> num;

        int soma = 0;
        int num2 = 0, num3 = 0;
        for(int i = 0; i < num.size(); i++) {
            soma += num[i] - '0';
            soma % 9;
            if(num[i] == '2') num2++;
            if(num[i] == '3') num3++;
        }

        if(soma % 9 == 0 || num3 == num.size()) cout << "YES" << endl;
        else {
            if(possible(soma%9, num2, num3)) cout << "YES" << endl;
            else cout << "NO" << endl;
        }
    }
    return 0; 
}

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

Code 1:
def is_divi9(num):
    s = sum(num)  # مجموع اولیه ارقام
    if s % 9 == 0:  # بررسی اولیه
        return "YES"
    
    # شمارش تعداد ارقام 2 و 3
    count_2 = num.count(2)
    count_3 = num.count(3)

    # بررسی تمام مقادیر ممکن از تغییر
    for c2 in range(count_2 + 1):  # تعداد تغییر 2ها از 0 تا count_2
        for c3 in range(count_3 + 1):  # تعداد تغییر 3ها از 0 تا count_3
            new_s = s + c2 * 2 + c3 * 6
            if new_s % 9 == 0:
                return "YES"

    return "NO"

# ورودی گرفتن
t = int(input())
for _ in range(t):
    num = [int(digit) for digit in input()]  # تبدیل عدد به لیست ارقام
    print(is_divi9(num))


Code 2:
from itertools import product

def is_divi9(num):
    s = sum(num)  # مجموع اولیه ارقام
    if s % 9 == 0:  # بررسی اولیه
        return "YES"
    
    # پیدا کردن ایندکس ارقام 2 و 3
    indices = [i for i in range(len(num)) if num[i] in (2, 3)]
    # تولید تمام ترکیب‌های ممکن از تغییر
    for changes in product((0, 1), repeat=len(indices)):  # 0: تغییر نکن، 1: تغییر کن
        new_s = s  # شروع از مجموع اولیه
        for idx, change in zip(indices, changes):
            if change == 1:  # اگر قرار است این رقم تغییر کند
                new_s += num[idx] ** 2 - num[idx]
        if new_s % 9 == 0:  # بررسی بخش‌پذیری مجموع جدید
            return "YES"
    
    return "NO"  # اگر هیچ حالتی موفق نبود

# ورودی گرفتن
t = int(input())
for _ in range(t):
    num = [int(digit) for digit in input()]  # تبدیل عدد به لیست ارقام
    print(is_divi9(num))


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

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

int main() {
    int tt;
    cin >> tt;
    while(tt--) {
        string n;
        cin >> n;
        int sum = 0,two = 0,three = 0;
        for(int i = 0;i < n.length();i++) {
            sum += n[i] - '0';
            if(n[i] == '2') two++;
            if(n[i] == '3') three++;
        }
        int remainder = sum%9;
        int t = 0;
        two = min(two,9);
        three = min(three,9);
        for(int i = 0;i <= two;i++) {
            for(int j = 0;j <= three;j++) {
                if((remainder + (i*2 + j*6)) % 9 == 0) {
                    t = 1;
                    break;
                }
            }
        }
        if(t == 1) cout << "yes" << endl;
        else cout << "no" << endl;
    }
}

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

int main() {
    int tt;
    cin >> tt;
    while(tt--) {
        long long n;
        cin >> n;
        int sum = 0,two = 0,three = 0;
        while(n > 0) {
            sum += n%10;
            if(n%10 == 2) two++;
            if(n%10 == 3) three++;
            n = n/10;
        }
        int remainder = sum%9;
        int t = 0;
        if(remainder == 0) t = 1;
        two = min(two,9);
        three = min(three,9);
        for(int i = 0;i <= two;i++) {
            for(int j = 0;j <= three;j++) {
                if((remainder + (i*2 + j*6)) % 9 == 0) {
                    t = 1;
                    break;
                }
            }
        }
        if(t == 1) cout << "yes" << endl;
        else cout << "no" << endl;
    }
}

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

Code 1:
#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;
}

Code 2:
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int t;
int a[N];
bool f=0;
int c;
void dfs(int i,int sum){
	if(i>c){//出口
		if(sum%9==0){
			f=1;
		}
		return;
	}
	//不变
	dfs(i+1,sum+a[i]);
	//能否变
	if(2<=a[i]&&a[i]<=3){//可以变
		a[i]*=a[i];
		dfs(i+1,sum+a[i]);
	}
	return;
}
int main(){
	cin>>t;
	while(t--){
		for(int i=1;i<=N;i++){
			a[i]=0;
		}
		string s;
		cin>>s;
		c=s.size();
		for(int i=0;i<c;i++){
			a[i+1]=int(s[i]-'0');
			if(a[i+1]>=2&&a[i+1]<=3){
			}
		}
		f=0;
		dfs(1,0);
		if(f==0){
			cout<<"No"<<endl;
		}else{
			cout<<"Yes"<<endl;
		}
	}
	return 0;
}

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

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

int main(){
    int t;
    cin>>t;
    while(t--){
        string s;
        cin>>s;
        int sum=0;
        int cnt2=0;
        int cnt3=0;
        for(int i=0; i<s.size(); i++){
            sum+=s[i]-'0';
            if(s[i]=='2')
                cnt2++;
            if(s[i]=='3')
                cnt3++;
        }
        int required=9-sum%9;
        if(required==9){
            cout<<"Yes"<<endl;
            continue;
        }
        int temp=-1;
        for(int i=cnt2; i>=0; i--){
            if((required-2*i)%6==0){
                temp=(required-2*i)/6;
                break;
            }
        }
        if(temp==-1){
            required+=9;
            for(int i=cnt2; i>=0; i--){
                if((required-2*i)%6==0){
                    temp=(required-2*i)/6;
                    break;
            }
        }
        }
        if(temp!=-1 && temp<=cnt3)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
}

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

int main(){
    int t;
    cin>>t;
    while(t--){
        string s;
        cin>>s;
        int sum=0;
        int cnt2=0;
        int cnt3=0;
        for(int i=0; i<s.size(); i++){
            sum+=s[i]-'0';
            if(s[i]=='2')
                cnt2++;
            if(s[i]=='3')
                cnt3++;
        }
        bool flag=false;
        for(int i=0; i<=cnt2; i++){
            for(int j=0; j<=cnt3; j++){
                int newNum=sum+2*i+6*j;
                if(newNum%9==0){
                    flag=true;
                    break;
                }
            }
            if(flag)
                break;
        }
        if(flag)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
}

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

Code 1:
no = int(input())
for i in range(no):
    l = list(map(int, list(input())))
    c2 = l.count(2)
    c3 = l.count(3)
    sumo = sum(l)
    ans = "NO"
    for two in range(c2+1):
        for three in range(c3+1):
            x = sumo + 2*two + 6*three
            if x%9==0:
                ans = "YES"
                break
        if ans == "YES":
            break
    print(ans)
            
    
        
            
            

Code 2:
no = int(input())
for i in range(no):
    l = list(map(int, input().split('')))
    c2 = l.count(2)
    c3 = l.count(3)
    x = 0
    ans = "NO"
    for two in range(c2):
        for three in range(c3):
            x += 2*two + 6*three
            if x%9==0:
                ans = "YES"
                break
        if ans == "YES":
            break
    print(ans)
            
    
        
            
            

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

Code 1:
#include <iostream>

#include <vector>

#include <algorithm>

#include <cstdint>

#include <map>

#include <string>

#include <set>



#ifdef ONLINE_JUDGE

#define default_file(...)

#define dbg(...)

#else

#include "../local/debug.h"

#endif 



void run_program(){

     std::string s;

     std::cin >> s;

     int sum = 0, cnt_two = 0, cnt_three = 0;

     for(auto& c : s)

          sum += int(c - '0'),     

          cnt_two += (c == '2'),

          cnt_three += (c == '3');

     

     for(int two = 0; two < std::min(10, cnt_two + 1); ++two) 

          for(int three = 0; three < std::min(10, cnt_three + 1); ++three)

               if((sum + two * 2 + three * 6) % 9 == 0)

                    return void(std::cout << "YES\n");

     std::cout << "NO\n";

} 

int main() {

     default_file("");

     std::ios::sync_with_stdio(0); std::cin.tie(0);    

     int t; 

     std::cin >> t;

     while(t--)

     run_program();

     return 0;

}



Code 2:
#include <iostream>

#include <vector>

#include <algorithm>

#include <cstdint>

#include <map>

#include <string>

#include <set>



#ifdef ONLINE_JUDGE

#define default_file(...)

#define dbg(...)

#else

#include "../local/debug.h"

#endif 



void run_program(){

     std::string s;

     std::cin >> s;

     int sum = 0, cnt_two = 0, cnt_three = 0;

     for(auto& c : s)

          sum += int(c - '0'),     

          cnt_two += (c == '2'),

          cnt_three += (c == '3');

     

     int mod = sum % 9; 

     if(mod == 0 || (mod % 2 == 1 && cnt_two >= (9 - mod) / 2)

                 || (mod == 3 && (cnt_three >= 1 || cnt_two >= 3))

                 || (mod == 6 && (cnt_three >= 2 || cnt_two >= 6))

                 || ((mod == 4 || mod == 2) && cnt_three >= 1 && cnt_two >= (6 - mod) / 2)

                 || (mod == 1 && cnt_three >= 2 && cnt_two >= 1)

                 || (mod == 5 && cnt_three >= 1 && cnt_two >= 2)

                 || (mod == 7 && cnt_three >= 1 && cnt_two >= 4)

                 || (mod == 8 && cnt_two >= 4))

          std::cout << "YES\n";

     else 

          std::cout << "NO\n";

} // 7 

// 6 

int main() {

     default_file("");

     std::ios::sync_with_stdio(0); std::cin.tie(0);    

     int t; 

     std::cin >> t;

     while(t--)

     run_program();

     return 0;

}



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

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

signed main(){
    int t;
    cin>>t;
    while(t--){
        string n;
        cin>>n;
        int sum=0;
        int count2=0,count3=0;
        for(int i=0;i<n.length();i++){
            sum+=(n[i]-'0');
            if(n[i]=='3')count3++;
            else if(n[i]=='2')count2++;
        }
        if(sum%9==0){
            cout<<"YES\n";
            continue;
        }
        int rem=sum%9;
        if(count3==n.length()){
            cout<<"YES\n";
            continue;
        }
         if(count2/2 >=rem){
             cout<<"YES\n";
         }else if(rem%2){
             if((9-rem)/2<=count2){
                 cout<<"YES\n";
             }else{
                 cout<<"NO\n";
             }
             }else{cout<<"NO\n";
         }
    }
}

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

signed main(){
    int t;
    cin>>t;
    while(t--){
        string n;
        cin>>n;
        int sum=0;
        int count2=0,count3=0;
        for(int i=0;i<n.length();i++){
            sum+=(n[i]-'0');
            if(n[i]=='3')count3++;
            else if(n[i]=='2')count2++;
        }
        int rem=sum%9;
        if(rem==0){
            cout<<"YES\n";
            continue;
        }
        bool ans=false;
        for(int i=0;i<=min((int)10,count2);i++){
            for(int j=0;j<=min((int)10,count3);j++){
                 if((rem+ (i*2) + (j*6))%9==0){
                     ans=true;break;
                 }
            }
        }
        if(ans){
            cout<<"YES\n";
        }else{
            cout<<"NO\n";
        }
    }
}

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

Code 1:
#include <iostream>
using namespace std;

void solve(){
     string s;
        cin>>s;
        
        int two=0,three=0,sum=0;
           bool flag=0;
        for(auto i:s){
            if(i=='2'){
                two++;
            }
            else if(i=='3'){
                three++;
            }
            sum+=(i-'0');
            sum=sum%9;
            
        }
            for(int j=0;j<=three;j++){
                for(int i=0;i<=two;i++){
                    long tsum=sum;
                    tsum+=i*2+j*6;
                    
                    if(tsum%9==0){
                        cout<<"YES"<<endl;
                        return;
                    }
                }
            }
            
        
        
     
                cout<<"NO"<<endl;
            return;
}


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

Code 2:
int main()
{
    
    int t;
    cin>>t;
    while(t--){
        string s;
        cin>>s;
        
        int two=0,three=0,sum=0;
           bool flag=0;
        for(auto i:s){
            if(i=='2'){
                two++;
            }
            else if(i=='3'){
                three++;
            }
            sum+=(i-'0');
            sum=sum%9;
            
         
            for(int j=0;j<=three;j++){
                for(int i=0;i<=two;i++){
                    long tsum=sum;
                    tsum+=i*2+j*6;
                    
                    if(tsum%9==0){
                        flag=1;
                       break;
                    }
                }
            }
            
        }
        if(flag==1){
                cout<<"YES"<<endl;
            }
            else{
                cout<<"NO"<<endl;
            }
    }
    
}

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

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


signed main() {
    int q;
    cin>>q;
    while(q--){
        string n;
        cin>>n;
        int sum=0;
        int x2=0;
        int x3=0;
        for(int i=0;i<n.size();i++){
            int num = n[i] - '0';
            if(num==2){
                x2++;
            }
            if(num==3){
                x3++;
            }
            sum+=num;

        }
        bool flag=true;
        if(sum%9==0){
            cout<<"YES"<<endl;
        }
        else if(x3==n.size()){
            cout<<"YES"<<endl;
        }
        
        else{
            for(int i=1;i<=x2;i++){
                for(int j=0;j<=x3;j++){
                    int x=sum+2*i+6*j;
                    if((x)%9==0){
                        cout<<"YES"<<endl;
                        flag=false;
                        break;
                    }
                }
                if(flag==false){
                    break;
                }
            }
            if(flag==true){
                cout<<"NO"<<endl;
            }
        }

    }
}

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


signed main() {
    int q;
    cin>>q;
    while(q--){
        string n;
        cin>>n;
        int sum=0;
        int x2=0;
        int x3=0;
        for(int i=0;i<n.size();i++){
            int num = n[i] - '0';
            if(num==2){
                x2++;
            }
            if(num==3){
                x3++;
            }
            sum+=num;

        }
        bool flag=true;
        if(sum%9==0){
            cout<<"YES"<<endl;
        }
        
        
        else{
            if(flag==true){
                for(int j=0;j<=x3;j++){
                    int x=sum+6*j;
                    if((x)%9==0){
                        cout<<"YES"<<endl;
                        flag=false;
                        break;
                    }
                }
            }
            if(flag==true){
                for(int i=1;i<=x2;i++){
                
                    int x=sum+2*i;
                    if((x)%9==0){
                        cout<<"YES"<<endl;
                        flag=false;
                        break;
                    }
                }
            }
            if(flag==true){
                 for(int i=1;i<=x2;i++){
                for(int j=0;j<=x3;j++){
                    int x=sum+2*i+6*j;
                    if((x)%9==0){
                        cout<<"YES"<<endl;
                        flag=false;
                        break;
                    }
                }
                if(flag==false){
                    break;
                }
            }
            }  
 
            if(flag==true){
                cout<<"NO"<<endl;
            }
        }

    }
}

Answer: 2