ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>

using namespace std;

int main() {

    int t;

    cin>>t;

    while(t--){

        int n,oddsm=0,evensm=0,oddcnt=0,evencnt=0;

        cin>>n;

        int arr[n];

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

            cin>>arr[i];

            if(i%2==0){

                evensm+=arr[i];

                evencnt++;

            }

            else{

                oddsm+=arr[i];

                oddcnt++;

            }

        }

        if(evensm%evencnt!=0 || oddsm%oddcnt !=0 || evensm/evencnt!=oddsm/oddcnt)

            cout<<"NO\n";

        else cout<<"YES\n";

    }

    return 0;

}

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

using namespace std;

int main() {

    int t;

    cin>>t;

    while(t--){

        int n,oddsm=0,evensm=0,oddcnt=0,evencnt=0;

        cin>>n;

        int arr[n];

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

            cin>>arr[i];

        }

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

            if(i%2==0){

                evensm+=arr[i];

                evencnt++;

            }

            else{

                oddsm+=arr[i];

                oddcnt++;

            }

        }

        if(evensm%evencnt!=0 || oddsm%oddcnt !=0 || evensm/evencnt!=oddsm/oddcnt)

            cout<<"NO\n";

        else cout<<"YES\n";

    }

    return 0;

}
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>

using namespace std;

int main() {

    int t;

    cin>>t;

    while(t--){

        int n,oddsm=0,evensm=0,oddcnt=0,evencnt=0;

        cin>>n;

        int arr[n];

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

            cin>>arr[i];

        }

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

            if(i%2==0){

                evensm+=arr[i];

                evencnt++;

            }

            else{

                oddsm+=arr[i];

                oddcnt++;

            }

        }

        if(evensm%evencnt!=0 || oddsm%oddcnt !=0 || evensm/evencnt!=oddsm/oddcnt)

            cout<<"NO\n";

        else cout<<"YES\n";

    }

    return 0;

}

Submission (verdict: Accepted):
#include <bits/stdc++.h>

using namespace std;

int main() {

    int t;

    cin>>t;

    while(t--){

        int n;

        cin>>n;

        int arr[n];

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

            cin>>arr[i];

        }

        long long oddsm=0,evensm=0,oddcnt=0,evencnt=0;

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

            if(i%2==0){

                evensm+=arr[i];

                evencnt++;

            }

            else{

                oddsm+=arr[i];

                oddcnt++;

            }

        }

        if (oddsm%oddcnt == 0 && evensm%evencnt == 0 && oddsm * evencnt == evensm * oddcnt)

            cout << "YES" << endl;

        else

            cout << "NO" << endl;

    }

    return 0;

}
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;

using ui = unsigned int;
using ll = long long;
using db = double;
using vll = vector<long long>;
using vpll = vector<pair<long long, long long>>;
using vvll = vector<vector<long long>>;
using gll = greater<long long>;
using pll = pair<ll, ll>;
using pss = pair<string, string>;
using vui = vector<unsigned int>;
#define rep(i, a, n) for (int i = a; i < n; i++)
#define pb push_back
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define fast                     \
    ios::sync_with_stdio(false); \
    cin.tie(0);

ll gcd(ll a, ll b) {
    while (b != 0) {
        ll tmp = a % b;
        a = b;
        b = tmp;
    }
    return a;
}
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

void print(ll* a, int n) {
    for (int i = 0; i < n; i++) {
        cout << a[i] << " ";
    }
    cout << endl;
}

void print(vll& a) {
    for (int i = 0; i < a.size(); i++) {
        cout << a[i] << " ";
    }
    cout << endl;
}

ll ind(ll a, ll b, ll c) { return (a ^ b) + (b ^ c) + (c ^ a); }

void solve(int sura) {
    ll l, r;
    cin >> l >> r;
    int i = 32;
    while (((l >> i) & 1) == ((r >> i) & 1)) {
        i--;
    }
    ll a = 1;
    while (i--) a *= 2;
    cout << a << " " << a - 1 << " " << l << endl;
}

int main() {
    // //{-_-}//
    int sura = 1;
    cin >> sura;
    for (int i = 1; i <= sura; i++) {
        solve(i);
    }
}
Problem: 2050D - Digital string maximization
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 8):
#include <bits/stdc++.h>
 
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define vvll vector<vll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vf vector<float>
#define vd vector<double>
#define pi pair<int,int>
#define pll pair<ll, ll>
#define pci pair<char,int>
#define qi queue<int>
#define qll queue<ll>
#define di deque<int>
#define dll deque<ll>
#define Nfor0 for(int i=0; i < N; i++)
#define Nfor1 for(int i=1; i <= N; i++)
#define test while(T--)
#define endl '\n'
#define _ <<" "
#define pb push_back
#define pf push_front

using namespace std;

const ll mod=1e9+7, LOG=18, inf=1e17;
ll T,N,M,K;
vll a, b;
string s;

int main(){
    //freopen("input.in","r",stdin);
    //freopen(".out","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    cin>>T;
    
    test{
        string ans="";
        cin>>ans;
        N = ans.length();

        vi v(N+5,0);
        for(int j=0; j < 1000; j++){
            Nfor0{
                if(i == 0)continue;
                if(ans[i] >= ans[i-1] + 2){
                    v[i] = 1;
                }else{
                    v[i] = 0;
                }
            }
            for(int i=N-1; i >= 0; i--){
                if(v[i]){
                    int aux=ans[i]-'0';
                    aux--;
                    ans[i] = char(aux + '0');
                    swap(ans[i],ans[i-1]);
                }
            }
        }

        cout<<ans<<endl;
        a.clear();
    }
    
    return 0;
}
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
// To the Moon and never back ... 
#include <bits/stdc++.h>
#define Maryam ios_base::sync_with_stdio(false);cin.tie(0);
#define ll long long    
using namespace std;
int main()
{
    Maryam;

    ll t; cin >> t; 
    while (t--)
    {
        string s; cin >> s;   

        for (ll i = 0; i < s.size(); i++)
        {
            ll p = i; char Max = s[i]; 
            for (ll j = 9; j > 0; j--)
            {
                if (i + j >= s.size()) continue ; 

                char c = s[i + j] - j ; 
                if (c > s[i])
                {
                    p = i + j;
                    Max = c;
                }
            }

            if (p > i)
            {
                for (ll j = p; j > i; j--)
                    s[j] = s[j - 1]; 

                s[i] = Max; 
            }
        }
        cout << s << '\n'; 
    }

    return 0;
}

Submission (verdict: Wrong answer on test 1):
// To the Moon and never back ... 
#include <bits/stdc++.h>
#define Maryam ios_base::sync_with_stdio(false);cin.tie(0);
#define ll long long    
using namespace std;
int main()
{
    Maryam;

    ll t; cin >> t; 
    while (t--)
    {
        string s; cin >> s;   

        for (ll i = 0; i < s.size(); i++)
        {
            ll p = i; char Max = s[i]; 
            for (ll j = 9; j > 0; j--)
            {
                if (i + j >= s.size()) continue ; 

                char c = s[i + j] - j ; 
                if (c > Max )  
                {
                    p = i + j;
                    Max = c;
                }
            }

            if (p > i)
            {
                for (ll j = p; j > i; j--)
                    s[j] = s[j - 1]; 

                s[i] = Max; 
            }
        }
        cout << s << '\n'; 
    }

    return 0;
}
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
// To the Moon and never back ... 
#include <bits/stdc++.h>
#define Maryam ios_base::sync_with_stdio(false);cin.tie(0);
#define ll long long    
using namespace std;
int main()
{
    Maryam;

    ll t; cin >> t; 
    while (t--)
    {
        string s; cin >> s;   

        for (ll i = 0; i < s.size(); i++)
        {
            ll p = i; char Max = s[i]; 
            for (ll j = 9; j > 0; j--)
            {
                if (i + j >= s.size()) continue ; 

                char c = s[i + j] - j ; 
                if (c > s[i])
                {
                    p = i + j;
                    Max = c;
                }
            }

            if (p > i)
            {
                for (ll j = p; j > i; j--)
                    s[j] = s[j - 1]; 

                s[i] = Max; 
            }
        }
        cout << s << '\n'; 
    }

    return 0;
}
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
// To the Moon and never back ... 
#include <bits/stdc++.h>
#define Maryam ios_base::sync_with_stdio(false);cin.tie(0);
#define ll long long    
using namespace std;
int main()
{
    Maryam;

    ll t; cin >> t; 
    while (t--)
    {
        string s; cin >> s;   

        for (ll i = 0; i < s.size(); i++)
        {
            ll p = i; char Max = s[i]; 
            for (ll j = 9; j > 0; j--)
            {
                if (i + j >= s.size()) continue ; 

                char c = s[i + j] - j ; 
                if (c > Max )  
                {
                    p = i + j;
                    Max = c;
                }
            }

            if (p > i)
            {
                for (ll j = p; j > i; j--)
                    s[j] = s[j - 1]; 

                s[i] = Max; 
            }
        }
        cout << s << '\n'; 
    }

    return 0;
}

Submission (verdict: Accepted):
// To the Moon and never back ... 
#include <bits/stdc++.h>
#define Maryam ios_base::sync_with_stdio(false);cin.tie(0);
#define ll long long    
using namespace std;
int main()
{
    Maryam;

    ll t; cin >> t; 
    while (t--)
    {
        string s; cin >> s;   

        for (ll i = 0; i < s.size(); i++)
        {
            ll p = i; char Max = s[i]; 
            for (ll j = 9; j >= 0; j--)
            {
                if (i + j >= s.size()) continue ; 

                char c = s[i + j] - j ; 
                if (c >= Max )  
                {
                    p = i + j;
                    Max = c;
                }
            }

            if (p > i)
            {
                for (ll j = p; j > i; j--)
                    s[j] = s[j - 1]; 

                s[i] = Max; 
            }
            //cout << p << ' ' << s << '\n';
        }
        cout << s << '\n'; 
    }

    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)


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

using namespace std;

#define int long long
#define deb(x) cout << #x << " = " << x << endl;
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define mp make_pair
#define rep(i,j,k) for(int i=j;i<k;i++)
#define sz(x) (int)(x).size()

#define imax INT_MAX
#define imin INT_MIN
#define PI 3.1415926535897932384626433832795
#define tr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define trr(it, x) for(auto it = x.rbegin(); it != x.rend(); it+)
#define sortall(x) sort(all(x))

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;

template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

void setIO(string name){
    ios_base::sync_with_stdio(0);cin.tie(0);
    if(!name.empty()){
        freopen((name + ".in").c_str(), "r", stdin);
        freopen((name + ".out").c_str(), "w", stdout);
    }
}
#define here cout << "-----PASS-----" << endl;
const int mxN = 1e5+5;
const int MOD = 998244353;
const int INF = 4e18+50;

//*********************************************************************************


void solve(){
	int n;
	cin >> n ;
	int ar[n+5];
	
	for(int i=1;i<=n;i++) cin >> ar[i];

	VII ans;

	for(int i=1;i<=n;i++) {
		for(int j=i-1;j>=1;j--) {
			if(ar[j] < ar[i]) ans.pb({ar[i], ar[j]});
		}
		for(int j=1;j<=i;j++) {
			if(ar[j] < ar[i]) ans.pb({ar[j], ar[i]});
		}
	}

	for(int i=1;i<=n;i++) {
		for(int j=i+1;j<=n;j++) {
			if(ar[i] > ar[j]) ans.pb({ar[i], ar[j]});
		}
	} 
	cout << ans.size() << endl;
	for(PII a : ans) cout << a.F << " " << a.S << endl;

}

int32_t main(){
    string name = "";
    setIO(name);
    int test_cases = 1;
    //cin >> test_cases;
    while(test_cases--) {
        solve(); //cout << endl;
    }

    return 0; 
}
Problem: 2061D - Kevin and Numbers
Language: Java 21


Submission (verdict: Time limit exceeded on test 1):
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int T = scanner.nextInt();
        while (T-- > 0) {
            int n = scanner.nextInt();
            int m = scanner.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = scanner.nextInt();
            int[] b = new int[m];
            for (int i = 0; i < m; i++) b[i] = scanner.nextInt();
            System.out.println(canDistribute(a, b) ? "Yes" : "No");
        }
        scanner.close();
    }

    private static boolean canDistribute(int[] a, int[] b) {
        PriorityQueue<Integer> maxHeap = new PriorityQueue<>(Collections.reverseOrder());
        for (int val : b) maxHeap.offer(val);

        Map<Integer, Integer> freqMap = new HashMap<>();
        for (int val : a) freqMap.put(val, freqMap.getOrDefault(val, 0) + 1);

        while (!maxHeap.isEmpty()) {
            int current = maxHeap.poll();
            if (freqMap.getOrDefault(current, 0) > 0) {
                freqMap.put(current, freqMap.get(current) - 1);
            } else {
                if (current == 1) return false;
                maxHeap.offer(current / 2);
                maxHeap.offer((current + 1) / 2);
            }
        }

        for (int count : freqMap.values()) {
            if (count > 0) return false;
        }
        return true;
    }
}
Problem: 2061D - Kevin and Numbers
Language: Java 21

Previous submission (verdict: Time limit exceeded on test 1):
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        while (T-- > 0) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = sc.nextInt();
            int[] b = new int[m];
            for (int i = 0; i < m; i++) b[i] = sc.nextInt();

            var pq = new PriorityQueue<Integer>(Collections.reverseOrder());
            for (int val : b) pq.offer(val);

            var freqMap = new HashMap<Integer, Integer>();
            for (int val : a) freqMap.put(val, freqMap.getOrDefault(val, 0) + 1);

            boolean flag = true;

            while (!pq.isEmpty()) {
                int val = pq.poll();
                if (freqMap.getOrDefault(val, 0) > 0) {
                    freqMap.put(val, freqMap.get(val) - 1);
                } else {
                    if (val == 1) {
                        flag = false;
                        break;
                    }
                    pq.offer(val / 2);
                    pq.offer((val + 1) / 2);
                }
            }

            for (int count : freqMap.values()) {
                if (count > 0) {
                    flag = false;
                    break;
                }
            }

            System.out.println(flag ? "Yes" : "No");
        }
        sc.close();
    }
}

Submission (verdict: Accepted):
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        while (T-- > 0) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = sc.nextInt();
            int[] b = new int[m];
            for (int i = 0; i < m; i++) b[i] = sc.nextInt();

            PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder());
            for (int val : b) pq.offer(val);

            Map<Integer, Integer> freqMap = new HashMap<>();
            for (int val : a) freqMap.put(val, freqMap.getOrDefault(val, 0) + 1);

            boolean isValid = true;

            for (int i = 0; i < n - m + n; i++) {
                if (pq.isEmpty()) {
                    isValid = false;
                    break;
                }

                int val = pq.poll();
                if (freqMap.getOrDefault(val, 0) == 0) {
                    pq.offer(val / 2);
                    pq.offer((val + 1) / 2);
                } else {
                    freqMap.put(val, freqMap.get(val) - 1);
                }
            }

            System.out.println(isValid && pq.isEmpty() ? "Yes" : "No");
        }
        sc.close();
    }
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 3):
#include<bits/stdc++.h>
using namespace std;

vector<long long> findDigits(long long n) {
    vector<long long> digits(19, 0); // To store digits of the number
    int i = 1;
    while (i<=18) {
        digits[i] = n % 10; // Extract the last digit
        n /= 10;            // Remove the last digit
        i++;
    }
    return digits;
}

int main() {
    long long t;
    cin >> t;

    while (t--) {
        long long n;
        cin >> n;
        int ct1=0;
        int ct2=0;
        if(n%9==0){
            cout<<"YES";
            cout<<endl;
            continue;
        }

        vector<long long> digits = findDigits(n);
        long long sum = 0;
                for (long long i = 0; i < 19; i++) {
            if(digits[i]==3){
                ct1++;
            }
                        if(digits[i]==2){
                ct2++;
            }
        }
         
        // Calculate the sum of digits
        for (long long i = 0; i < 19; i++) {
            sum += digits[i];
        }

        // Check the condition

    bool f=true;
    for(int i=0;i<=ct2&&f;i++){
        for(int j=0;j<=ct1;j++){
            if((sum+i*2+j*6)%9==0){
                cout<<"YES";
                cout<<endl;

                f=false;
                break;
            }
        }
    }
    if(f){
        cout<<"NO";
        cout<<endl;
    }
    }

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

Previous submission (verdict: Wrong answer on test 3):
#include<bits/stdc++.h>
using namespace std;

vector<long long> findDigits(long long n) {
    vector<long long> digits((int)1e5+1, 0); // To store digits of the number
    int i = 1;
    while (i<=18) {
        digits[i] = n % 10; // Extract the last digit
        n /= 10;            // Remove the last digit
        i++;
    }
    return digits;
}

int main() {
    long long t;
    cin >> t;

    while (t--) {
        long long n;
        cin >> n;
        int ct1=0;
        int ct2=0;
        if(n%9==0){
            cout<<"YES";
            cout<<endl;
            continue;
        }

        vector<long long> digits = findDigits(n);
        long long sum = 0;
                for (long long i = 0; i < (int)1e5+1; i++) {
            if(digits[i]==3){
                ct1++;
            }
                        if(digits[i]==2){
                ct2++;
            }
        }
         
        // Calculate the sum of digits
        for (long long i = 0; i < (int)1e5+1; i++) {
            sum += digits[i];
        }

        // Check the condition

    bool f=true;
    for(int i=0;i<=ct2&&f;i++){
        for(int j=0;j<=ct1;j++){
            if((sum+i*2+j*6)%9==0){
                cout<<"YES";
                cout<<endl;

                f=false;
                break;
            }
        }
    }
    if(f){
        cout<<"NO";
        cout<<endl;
    }
    }

    return 0;
}


Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;

vector<long long> findDigits(long long n) {
    vector<long long> digits((int)1e5+1, 0); // To store digits of the number
    int i = 1;
    while (i<=18) {
        digits[i] = n % 10; // Extract the last digit
        n /= 10;            // Remove the last digit
        i++;
    }
    return digits;
}

int main() {
    long long t;
    cin >> t;

    while (t--) {
        string s;
        cin >> s;
        int ct1=0;
        int ct2=0;
        for(int i=0;i<s.length();i++){
            if(s[i]=='2'){
                ct2++;
            }
            if(s[i]=='3'){
                ct1++;
            }
        }
     long long sum=0;
         
        // Calculate the sum of digits
        for (long long i = 0; i <s.length(); i++) {
            sum += s[i]-'0';
        }

        // Check the condition

    bool f=true;
    for(int i=0;i<=ct2&&f;i++){
        for(int j=0;j<=ct1;j++){
            if((sum+i*2+j*6)%9==0){
                cout<<"YES";
                cout<<endl;

                f=false;
                break;
            }
        }
    }
    if(f){
        cout<<"NO";
        cout<<endl;
    }
    }

    return 0;
}