ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

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

int a[200001];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		bool f=1;
		if(n==2){
			cout<<"No\n";
			continue;
		}
		for(int i=1;i<=n;i++){
			cin>>a[i];
			if(i>2&&a[i]<a[i-1]&&a[i-1]<a[i-2]&&f){ cout<<"No\n";f=0;}
		}
		if(f){
			cout<<"Yes\n";
		}
	}
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define nl "\n"

int main(){
    ll t; cin >> t;
    while(t--){
        ll n, f=1; cin >> n;
        vector<ll> arr(n);
        for(ll i=0; i<n; i++){
            cin >> arr[i];
        }
        for(ll i=1; i<n; i++){
            if(arr[i-1]>arr[i]){
                f=0;
                break;
            }else{
                ll mn = min(arr[i-1], arr[i]);
                arr[i-1] = arr[i-1]-mn;
                arr[i] = arr[i] - mn;
            }
        }
        if(f) cout << "YES" << nl;
        else cout << "NO" << nl;
    }

    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
//Hara Hara Mahadev
#include<bits/stdc++.h>
using namespace std;
 
#define int 	long long
#define pi      3.1415926535897932384626433832795028841971693993751058
#define YES     cout<<"YES"<<"\n"
#define NO      cout<<"NO"<<"\n"
#define m1      cout<<-1<<"\n"
#define ssort(S)  sort((S).begin(),(S).end())
#define srev(S)   reverse((S).begin(),(S).end())
#define ll      long long
#define pb      push_back
#define vi      vector<int>
#define vvi 	vector<vector<int>>
#define vll      vector<long long>
#define vc      vector<char>
#define pii     pair<int,int>
#define vpii    vector<pair<int,int>>
#define vs	 vector<string>
#define all(arr)  (arr).begin(), (arr).end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define inp(v) for (auto & a : (v)) cin >> a;
#define endl "\n"
#define speed (ios_base:: sync_with_stdio(false),cin.tie(NULL))
#define mod 1000000007
 
int gcd(int a,int b) { if (a == 0) return b; return gcd(b%a, a);}
int max(int a,int b){if(a>b) return a; else return b;}
int min(int a,int b){if(a<b) return a; else return b;}  

int ceil_div(int a, int b) {
   return a / b + ((a ^ b) > 0 && a % b != 0);
}

void solve()
{
   int n;
   cin >> n;

   vi arr(n);
   inp(arr);

   int maxi = *max_element(all(arr));
   if(arr[0] == maxi) {
        NO;
        return;
   }
   YES;
}

int t = 1;
int32_t main() {
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0),cin>>t;
    //cin >> t;
    while(t--){solve();}
    return 0;
}

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

int a[200001];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		bool f=1;
		if(n==2){
			cout<<"No\n";
			continue;
		}
		for(int i=1;i<=n;i++){
			cin>>a[i];
			if(i>2&&a[i]<a[i-1]&&a[i-1]<a[i-2]&&f){ cout<<"No\n";f=0;}
		}
		if(f){
			cout<<"Yes\n";
		}
	}
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
//Hara Hara Mahadev
#include<bits/stdc++.h>
using namespace std;
 
#define int 	long long
#define pi      3.1415926535897932384626433832795028841971693993751058
#define YES     cout<<"YES"<<"\n"
#define NO      cout<<"NO"<<"\n"
#define m1      cout<<-1<<"\n"
#define ssort(S)  sort((S).begin(),(S).end())
#define srev(S)   reverse((S).begin(),(S).end())
#define ll      long long
#define pb      push_back
#define vi      vector<int>
#define vvi 	vector<vector<int>>
#define vll      vector<long long>
#define vc      vector<char>
#define pii     pair<int,int>
#define vpii    vector<pair<int,int>>
#define vs	 vector<string>
#define all(arr)  (arr).begin(), (arr).end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define inp(v) for (auto & a : (v)) cin >> a;
#define endl "\n"
#define speed (ios_base:: sync_with_stdio(false),cin.tie(NULL))
#define mod 1000000007
 
int gcd(int a,int b) { if (a == 0) return b; return gcd(b%a, a);}
int max(int a,int b){if(a>b) return a; else return b;}
int min(int a,int b){if(a<b) return a; else return b;}  

int ceil_div(int a, int b) {
   return a / b + ((a ^ b) > 0 && a % b != 0);
}

void solve()
{
   int n;
   cin >> n;

   vi arr(n);
   inp(arr);

   int maxi = *max_element(all(arr));
   if(arr[0] == maxi) {
        NO;
        return;
   }
   YES;
}

int t = 1;
int32_t main() {
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0),cin>>t;
    //cin >> t;
    while(t--){solve();}
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
// #include <algorithm>
// #include <cstdio>
// #include <iostream>
// #include <vector>
// using namespace std;

// int main() {
// 	freopen("cowsignal.in", "r", stdin);
//     int m, n, k;
// 	scanf("%d %d %d", &m, &n, &k);
//     vector<vector<char>> arr(m, vector<char>(n)), ans(k*m, vector<char>(k*n));
//     for(int i=0; i<m; i++){
//         for(int j=0; j<n; j++){
//             scanf(" %c", &arr[i][j]);
//         }
//     }

//     freopen("cowsignal.out", "w", stdout);

//     for(int i=0; i<m; i++){
//         for(int ik=0; ik<k; ik++){
//             for(int j=0; j<n; j++){
//                 for(int jk=0; jk<k; jk++){
//                    cout << arr[i][j];
//                 }
//             }
//             cout << "\n";
//         }
//     }

// }

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

#define ll long long int
#define nl "\n"

int main(){
    ll t; cin >> t;
    while(t--){
        ll n; cin >> n;
        vector<ll> arr(n);
        for(ll i=0; i<n; i++){
            cin >> arr[i];
        }
        ll cnt = n;
        
        if(n==1) cout << arr[0] << nl;
        if(n==2) cout << abs(arr[0]) + abs(arr[1]) << nl;
        while(cnt!=1){
            for(ll i=0; i<cnt-1; i++){
                arr[i] = arr[i+1]-arr[i];
            }
            cnt--;
        }
        if(n!=1 && n!=2) cout << abs(arr[0]) << nl;
    }

    return 0;
}


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

#define ll long long int
#define nl "\n"

int main(){
    ll t; cin >> t;
    while(t--){
        ll n; cin >> n;
        vector<ll> arr(n);
        for(ll i=0; i<n; i++){
            cin >> arr[i];
        }
        ll cnt = n, sum=0;
        
        while(cnt!=1){
            ll tsum=0;
            for(ll i=0; i<arr.size(); i++){
                tsum+=arr[i];
            }
            sum = max(sum, abs(tsum));
            tsum = 0;
            for(ll i=0; i<cnt-1; i++){
                arr[i] = arr[i+1]-arr[i];
            }
            arr.erase(arr.end()-1);
            cnt--;
            for(ll i=0; i<arr.size(); i++){
                tsum+=arr[i];
            }
            sum = max(sum, abs(tsum));
            tsum = 0;
        }
        if(n!=1) cout << sum << nl;
        else cout << arr[0] << nl;
    }

    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
// #include <algorithm>
// #include <cstdio>
// #include <iostream>
// #include <vector>
// using namespace std;

// int main() {
// 	freopen("cowsignal.in", "r", stdin);
//     int m, n, k;
// 	scanf("%d %d %d", &m, &n, &k);
//     vector<vector<char>> arr(m, vector<char>(n)), ans(k*m, vector<char>(k*n));
//     for(int i=0; i<m; i++){
//         for(int j=0; j<n; j++){
//             scanf(" %c", &arr[i][j]);
//         }
//     }

//     freopen("cowsignal.out", "w", stdout);

//     for(int i=0; i<m; i++){
//         for(int ik=0; ik<k; ik++){
//             for(int j=0; j<n; j++){
//                 for(int jk=0; jk<k; jk++){
//                    cout << arr[i][j];
//                 }
//             }
//             cout << "\n";
//         }
//     }

// }

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

#define ll long long int
#define nl "\n"

int main(){
    ll t; cin >> t;
    while(t--){
        ll n; cin >> n;
        vector<ll> arr(n);
        for(ll i=0; i<n; i++){
            cin >> arr[i];
        }
        ll cnt = n;
        
        if(n==1) cout << arr[0] << nl;
        if(n==2) cout << abs(arr[0]) + abs(arr[1]) << nl;
        while(cnt!=1){
            for(ll i=0; i<cnt-1; i++){
                arr[i] = arr[i+1]-arr[i];
            }
            cnt--;
        }
        if(n!=1 && n!=2) cout << abs(arr[0]) << nl;
    }

    return 0;
}
Problem: 2062C - Cirno and Operations
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 int
#define nl "\n"

int main(){
    ll t; cin >> t;
    while(t--){
        ll n; cin >> n;
        vector<ll> arr(n);
        for(ll i=0; i<n; i++){
            cin >> arr[i];
        }
        ll cnt = n, sum=0;
        
        while(cnt!=1){
            ll tsum=0;
            for(ll i=0; i<arr.size(); i++){
                tsum+=arr[i];
            }
            sum = max(sum, abs(tsum));
            tsum = 0;
            for(ll i=0; i<cnt-1; i++){
                arr[i] = arr[i+1]-arr[i];
            }
            arr.erase(arr.end()-1);
            cnt--;
            for(ll i=0; i<arr.size(); i++){
                tsum+=arr[i];
            }
            sum = max(sum, abs(tsum));
            tsum = 0;
        }
        if(n!=1) cout << sum << nl;
        else cout << arr[0] << nl;
    }

    return 0;
}


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

#define ll long long int
#define nl "\n"

int main(){
    ll t; cin >> t;
    while(t--){
        ll n; cin >> n;
        vector<ll> arr(n);
        for(ll i=0; i<n; i++){
            cin >> arr[i];
        }
        ll cnt = n, sum=0;
        
        while(cnt!=1){
            ll tsum=0;
            for(ll i=0; i<arr.size(); i++){
                tsum+=arr[i];
            }
            sum = max(sum, tsum);
            tsum = 0;
            for(ll i=0; i<cnt-1; i++){
                arr[i] = arr[i+1]-arr[i];
            }
            arr.erase(arr.end()-1);
            cnt--;
            for(ll i=0; i<arr.size(); i++){
                tsum+=arr[i];
            }
            sum = max(sum, abs(tsum));
            tsum = 0;
        }
        if(n!=1) cout << sum << nl;
        else cout << arr[0] << nl;
    }

    return 0;
}
Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)

Previous submission (verdict: Runtime error on test 5):
#include <bits/stdc++.h>
using namespace std;
 
typedef long long int LL; 

void solve() {   
            int n, m ; cin >> n >> m;
            priority_queue<int> A, B;

            for(int i = 0; i < n ; i++){
                int x; cin >> x; A.push(x);
            }
            for(int i = 0; i < m ; i++){
                int y; cin >> y; B.push(y);
            }

            while(B.size() < A.size()){
                  int x = A.top(), y = B.top();
                  
                  if(y == 1)break;

                  B.pop();
                  if(x == y){
                    A.pop(); 
                  }
                  else{
                      int one = y/2, two = (y + 1)/2;
                      B.push(one);
                      B.push(two);
                  }
            }
            
            if(B.size() != A.size()){
              cout << "NO" << endl;
                    return;
            }
            while(!B.empty()){
                if(A.top() != B.top()){
                    cout << "NO" << endl;
                    return;
                }
                B.pop(); A.pop();
            }

            cout << "YES" << endl;
                
    
}
int main() {
        ios_base::sync_with_stdio(0); 
        cin.tie(0);
            
        int t = 1; cin >> t;
        while (t--) {
            solve();
        }
        return 0;
}                  

Submission (verdict: Runtime error on test 5):
#include <bits/stdc++.h>
using namespace std;
 
typedef long long int LL; 

void solve() {   
            int n, m ; cin >> n >> m;
            priority_queue<int> A, B;

            for(int i = 0; i < n ; i++){
                int x; cin >> x; A.push(x);
            }
            for(int i = 0; i < m ; i++){
                int y; cin >> y; B.push(y);
            }

            while(B.size() < A.size()){
                  int x = A.top(), y = B.top();
                  
                  if(y == 1)break;

                  B.pop();
                  if(x == y){
                    A.pop(); 
                  }
                  else if(x < y){
                      int one = y/2, two = (y + 1)/2;
                      B.push(one);
                      B.push(two);
                  }
                  else{
                    cout << "NO" << endl;
                    return;
                  }
            }
            
            if(B.size() != A.size()){
              cout << "NO" << endl;
                    return;
            }
            while(!B.empty()){
                if(A.top() != B.top()){
                    cout << "NO" << endl;
                    return;
                }
                B.pop(); A.pop();
            }

            cout << "YES" << endl;
                
    
}
int main() {
        ios_base::sync_with_stdio(0); 
        cin.tie(0);
            
        int t = 1; cin >> t;
        while (t--) {
            solve();
        }
        return 0;
}
Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)

Previous submission (verdict: Runtime error on test 5):
#include <bits/stdc++.h>
using namespace std;
 
typedef long long int LL; 

void solve() {   
            int n, m ; cin >> n >> m;
            priority_queue<int> A, B;

            for(int i = 0; i < n ; i++){
                int x; cin >> x; A.push(x);
            }
            for(int i = 0; i < m ; i++){
                int y; cin >> y; B.push(y);
            }

            while(B.size() < A.size()){
                  int x = A.top(), y = B.top();
                  
                  if(y == 1)break;

                  B.pop();
                  if(x == y){
                    A.pop(); 
                  }
                  else if(x < y){
                      int one = y/2, two = (y + 1)/2;
                      B.push(one);
                      B.push(two);
                  }
                  else{
                    cout << "NO" << endl;
                    return;
                  }
            }
            
            if(B.size() != A.size()){
              cout << "NO" << endl;
                    return;
            }
            while(!B.empty()){
                if(A.top() != B.top()){
                    cout << "NO" << endl;
                    return;
                }
                B.pop(); A.pop();
            }

            cout << "YES" << endl;
                
    
}
int main() {
        ios_base::sync_with_stdio(0); 
        cin.tie(0);
            
        int t = 1; cin >> t;
        while (t--) {
            solve();
        }
        return 0;
}                  

Submission (verdict: Runtime error on test 5):
#include <bits/stdc++.h>
using namespace std;

typedef long long int LL;

void solve() {   
    int n, m; 
    cin >> n >> m;
    
    // Max-heaps for A and B
    priority_queue<int> A, B;

    // Fill the heaps with input values
    for (int i = 0; i < n; i++) {
        int x; 
        cin >> x;
        A.push(x);
    }
    for (int i = 0; i < m; i++) {
        int y; 
        cin >> y;
        B.push(y);
    }

    // Try to transform B into A
    while (B.size() < A.size()) {
        int x = A.top(), y = B.top();
        
   
        if (y <= 1) break;


        B.pop();
        
        
        if (x == y) {
            A.pop();
        }
        
        else if (x < y) {
            int one = y / 2, two = (y + 1) / 2;
            
            if (one > 0) B.push(one);
            if (two > 0) B.push(two);
        }
       
        else {
            cout << "NO" << endl;
            return;
        }
    }

    
    if (B.size() != A.size()) {
        cout << "NO" << endl;
        return;
    }

   
    while (!B.empty()) {
        if (A.top() != B.top()) {
            cout << "NO" << endl;
            return;
        }
        B.pop();
        A.pop();
    }

    cout << "YES" << endl;
}

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

    int t = 1; 
    cin >> t; 
    while (t--) {
        solve();
    }
    return 0;
}
Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)

Previous submission (verdict: Runtime error on test 5):
#include <bits/stdc++.h>
using namespace std;

typedef long long int LL;

void solve() {   
    int n, m; 
    cin >> n >> m;
    
    // Max-heaps for A and B
    priority_queue<int> A, B;

    // Fill the heaps with input values
    for (int i = 0; i < n; i++) {
        int x; 
        cin >> x;
        A.push(x);
    }
    for (int i = 0; i < m; i++) {
        int y; 
        cin >> y;
        B.push(y);
    }

    // Try to transform B into A
    while (B.size() < A.size()) {
        int x = A.top(), y = B.top();
        
   
        if (y <= 1) break;


        B.pop();
        
        
        if (x == y) {
            A.pop();
        }
        
        else if (x < y) {
            int one = y / 2, two = (y + 1) / 2;
            
            if (one > 0) B.push(one);
            if (two > 0) B.push(two);
        }
       
        else {
            cout << "NO" << endl;
            return;
        }
    }

    
    if (B.size() != A.size()) {
        cout << "NO" << endl;
        return;
    }

   
    while (!B.empty()) {
        if (A.top() != B.top()) {
            cout << "NO" << endl;
            return;
        }
        B.pop();
        A.pop();
    }

    cout << "YES" << endl;
}

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

    int t = 1; 
    cin >> t; 
    while (t--) {
        solve();
    }
    return 0;
}


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

void solve() {   
            int n, m ; cin >> n >> m;
            priority_queue<int> A, B;

            for(int i = 0; i < n ; i++){
                int x; cin >> x; A.push(x);
            }
            for(int i = 0; i < m ; i++){
                int y; cin >> y; B.push(y);
            }

             while(!A.empty()){
                if(B.empty() || B.size() > A.size()){
                    cout << "NO" << endl;
                    return;
                }
               
                int X = B.top();
                B.pop();
                
                
                if(X < A.top()){
                    cout << "NO" << endl;
                    return;
                }
                
                if(X == A.top()){
                    A.pop();
                }
                else {
                    B.push(X/2);
                    B.push((X + 1)/2);
                }
             }

             if(!B.empty()){
                cout << "NO" << endl;
                return;
             }
             cout << "YES" << endl;
                
    
}
int main() {
        ios_base::sync_with_stdio(0); 
        cin.tie(0);
            
        int t = 1; cin >> t;
        while (t--) {
            solve();
        }
        return 0;
}
Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)

Previous submission (verdict: Runtime error on test 5):
#include <bits/stdc++.h>
using namespace std;
 
typedef long long int LL; 

void solve() {   
            int n, m ; cin >> n >> m;
            priority_queue<int> A, B;

            for(int i = 0; i < n ; i++){
                int x; cin >> x; A.push(x);
            }
            for(int i = 0; i < m ; i++){
                int y; cin >> y; B.push(y);
            }

            while(B.size() < A.size()){
                  int x = A.top(), y = B.top();
                  
                  if(y == 1)break;

                  B.pop();
                  if(x == y){
                    A.pop(); 
                  }
                  else{
                      B.push(y/2);
                      B.push( (y + 1)/ 2 );
                  }
            }
            
            if(B.size() != A.size()){
              cout << "NO" << endl;
                    return;
            }
            while(!B.empty()){
                if(A.top() != B.top()){
                    cout << "NO" << endl;
                    return;
                }
                B.pop(); A.pop();
            }

            cout << "YES" << endl;
                
    
}
int main() {
        ios_base::sync_with_stdio(0); 
        cin.tie(0);
            
        int t = 1; cin >> t;
        while (t--) {
            solve();
        }
        return 0;
}                  

Submission (verdict: Runtime error on test 5):
#include <bits/stdc++.h>
using namespace std;
 
typedef long long int LL; 

void solve() {   
            int n, m ; cin >> n >> m;
            priority_queue<int> A, B;

            for(int i = 0; i < n ; i++){
                int x; cin >> x; A.push(x);
            }
            for(int i = 0; i < m ; i++){
                int y; cin >> y; B.push(y);
            }

            while(B.size() < A.size()){
                  int x = A.top(), y = B.top();
                  
                  if(y == 1)break;

                  B.pop();
                  if(x == y){
                    A.pop(); 
                  }
                  else{
                      int one = y/2, two = (y + 1)/2;
                      B.push(one);
                      B.push(two);
                  }
            }
            
            if(B.size() != A.size()){
              cout << "NO" << endl;
                    return;
            }
            while(!B.empty()){
                if(A.top() != B.top()){
                    cout << "NO" << endl;
                    return;
                }
                B.pop(); A.pop();
            }

            cout << "YES" << endl;
                
    
}
int main() {
        ios_base::sync_with_stdio(0); 
        cin.tie(0);
            
        int t = 1; cin >> t;
        while (t--) {
            solve();
        }
        return 0;
}
Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)


Submission (verdict: Runtime error on test 5):
#include <bits/stdc++.h>
using namespace std;
 
typedef long long int LL; 

void solve() {   
            int n, m ; cin >> n >> m;
            priority_queue<int> A, B;

            for(int i = 0; i < n ; i++){
                int x; cin >> x; A.push(x);
            }
            for(int i = 0; i < m ; i++){
                int y; cin >> y; B.push(y);
            }

            while(B.size() < A.size()){
                  int x = A.top(), y = B.top();
                  
                  if(y == 1)break;

                  B.pop();
                  if(x == y){
                    A.pop(); 
                  }
                  else{
                      B.push(y/2);
                      B.push( (y + 1)/ 2 );
                  }
            }
            
            if(B.size() != A.size()){
              cout << "NO" << endl;
                    return;
            }
            while(!B.empty()){
                if(A.top() != B.top()){
                    cout << "NO" << endl;
                    return;
                }
                B.pop(); A.pop();
            }

            cout << "YES" << endl;
                
    
}
int main() {
        ios_base::sync_with_stdio(0); 
        cin.tie(0);
            
        int t = 1; cin >> t;
        while (t--) {
            solve();
        }
        return 0;
}