ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

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

int main(){
    int t;
    cin>>t;
    while (t--)
    {
        int n;
        cin>>n;
        int a[n];
        long long int ans =INT_MIN;
        long long int sum=0;

        for (int i = 0; i < n; i++)
        {
            cin>>a[i];
            sum+=a[i];
        }
        ans=max(ans,sum);
        for (int j = 0; j < n-1; j++)
        {
                a[j]=a[j+1]-a[j];
        }
        int now=n-1;
        for (int i = 1; i < n; i++)
        {
            sum=0;
            for (int j = 0; j < now; j++)
            {
                sum+=a[j];
            }
            
            ans=max(ans,abs(sum));
            for (int j = 0; j < now; j++)
            {
                a[j]=a[j+1]-a[j];
            }
            now--;
        }
        cout<<ans<<endl;

        
    }
}

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

int main(){
    int t;
    cin>>t;
    while (t--)
    {
        int n;
        cin>>n;
        long long int a[n];
        long long int ans =INT_MIN;
        long long int sum=0;

        for (int i = 0; i < n; i++)
        {
            cin>>a[i];
            sum+=a[i];
        }
        ans=max(ans,sum);
        for (int j = 0; j < n-1; j++)
        {
                a[j]=a[j+1]-a[j];
        }
        int now=n-1;
        for (int i = 1; i < n; i++)
        {
            sum=0;
            for (int j = 0; j < now; j++)
            {
                sum+=a[j];
            }
            
            ans=max(ans,max(sum,-sum));
            for (int j = 0; j < now; j++)
            {
                a[j]=a[j+1]-a[j];
            }
            now--;
        }
        cout<<ans<<endl;

        
    }
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <vector>
#include <string>

int main() {
    int t, number;
    int twos = 0;
    int threes = 0;
    int digitSum = 0;
    bool isDivisible = false;

    std::cin >> t;

    for(int i = 0; i < t; i++) {
        std::cin >> number;
        std::string stringNum = std::to_string(number);

        for(int character = 0; character < stringNum.size(); character++) {
            digitSum += stringNum[character] - '0';
            if (stringNum[character] == '2') {
                twos++;
            } else if (stringNum[character] == '3') {
                threes++;
            }
        }

        for(int numTwos = 0; numTwos <= twos; numTwos++) {
            for(int numThrees = 0; numThrees <= threes; numThrees++) {
                if ((digitSum + 2 * numTwos + 6 * numThrees) % 9 == 0) {
                    isDivisible = true;
                    break;
                }
            }

            if (isDivisible) {
                break;
            }
        }

        if (isDivisible) {
            std::cout << "yes" << std::endl;
        } else {
            std::cout << "no" << std::endl;
        }


        twos = 0;
        threes = 0;
        digitSum = 0;
        isDivisible = false;
        
    }

    
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <vector>
#include <string>

int main() {
    int t, number;
    int twos = 0;
    int threes = 0;
    int digitSum = 0;
    bool isDivisible = false;

    std::cin >> t;

    for(int i = 0; i < t; i++) {
        twos = 0;
        threes = 0;
        digitSum = 0;
        isDivisible = false;
        std::cin >> number;
        std::string stringNum = std::to_string(number);

        for(int character = 0; character < stringNum.size(); character++) {
            digitSum += stringNum[character] - '0';
            if (stringNum[character] == '2') {
                twos++;
            } else if (stringNum[character] == '3') {
                threes++;
            }
        }

        for(int numTwos = 0; numTwos <= twos; numTwos++) {
            for(int numThrees = 0; numThrees <= threes; numThrees++) {
                if ((digitSum + 2 * numTwos + 6 * numThrees) % 9 == 0) {
                    isDivisible = true;
                    break;
                }
            }

            if (isDivisible) {
                break;
            }
        }

        if (isDivisible) {
            std::cout << "yes" << std::endl;
        } else {
            std::cout << "no" << std::endl;
        }
    }

    
}

Submission (verdict: Accepted):
#include <iostream>
#include <vector>
#include <string>

int main() {
    int t;
    int twos = 0;
    int threes = 0;
    int digitSum = 0;
    std::string number;
    bool isDivisible = false;

    std::cin >> t;

    for(int i = 0; i < t; i++) {
        std::cin >> number;

        for(int character = 0; character < number.size(); character++) {
            digitSum += number[character] - '0';
            if (number[character] == '2') {
                twos++;
            } else if (number[character] == '3') {
                threes++;
            }
        }

        for(int numTwos = 0; numTwos <= twos; numTwos++) {
            for(int numThrees = 0; numThrees <= threes; numThrees++) {
                if ((digitSum + 2 * numTwos + 6 * numThrees) % 9 == 0) {
                    isDivisible = true;
                    break;
                }
            }

            if (isDivisible) {
                break;
            }
        }

        if (isDivisible) {
            std::cout << "yes" << std::endl;
        } else {
            std::cout << "no" << std::endl;
        }

        twos = 0;
        threes = 0;
        digitSum = 0;
        isDivisible = false;
    }

    
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <vector>
#include <string>

int main() {
    int t, number;
    int twos = 0;
    int threes = 0;
    int digitSum = 0;
    bool isDivisible = false;

    std::cin >> t;

    for(int i = 0; i < t; i++) {
        std::cin >> number;
        std::string stringNum = std::to_string(number);

        for(int character = 0; character < stringNum.size(); character++) {
            digitSum += stringNum[character] - '0';
            if (stringNum[character] == '2') {
                twos++;
            } else if (stringNum[character] == '3') {
                threes++;
            }
        }

        for(int numTwos = 0; numTwos <= twos; numTwos++) {
            for(int numThrees = 0; numThrees <= threes; numThrees++) {
                if ((digitSum + 2 * numTwos + 6 * numThrees) % 9 == 0) {
                    isDivisible = true;
                    break;
                }
            }

            if (isDivisible) {
                break;
            }
        }

        if (isDivisible) {
            std::cout << "yes" << std::endl;
        } else {
            std::cout << "no" << std::endl;
        }


        twos = 0;
        threes = 0;
        digitSum = 0;
        isDivisible = false;
        
    }

    
}

Submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <vector>
#include <string>

int main() {
    int t, number;
    int twos = 0;
    int threes = 0;
    int digitSum = 0;
    bool isDivisible = false;

    std::cin >> t;

    for(int i = 0; i < t; i++) {
        twos = 0;
        threes = 0;
        digitSum = 0;
        isDivisible = false;
        std::cin >> number;
        std::string stringNum = std::to_string(number);

        for(int character = 0; character < stringNum.size(); character++) {
            digitSum += stringNum[character] - '0';
            if (stringNum[character] == '2') {
                twos++;
            } else if (stringNum[character] == '3') {
                threes++;
            }
        }

        for(int numTwos = 0; numTwos <= twos; numTwos++) {
            for(int numThrees = 0; numThrees <= threes; numThrees++) {
                if ((digitSum + 2 * numTwos + 6 * numThrees) % 9 == 0) {
                    isDivisible = true;
                    break;
                }
            }

            if (isDivisible) {
                break;
            }
        }

        if (isDivisible) {
            std::cout << "yes" << std::endl;
        } else {
            std::cout << "no" << std::endl;
        }
    }

    
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Runtime error on test 2):
#include<bits/stdc++.h>

#define int long long

using namespace std;



signed main()

{

    int t;

    cin>>t;

    while(t--)

    {

        int n,l,r;

        cin>>n>>l>>r;

        vector<int> a(n+1);

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

        {

            cin>>a[i];

        }

        vector<pair<int,int>> v;

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

        {

            if(!(i>=l && i<=r))v.push_back({a[i],i});

        }

        sort(v.begin(),v.end());

        vector<int> ind;

        vector<pair<int,int>> y;

        for(int i=l;i<=r;i++)

        {

            y.push_back({a[i],i});

        }

        sort(y.begin(),y.end());

        int j=y.size()-1;

        for(auto it:v)

        {

            if(it.first<y[j].first)

            {

                ind.push_back(y[j].second);

                ind.push_back(it.second);

                j--;

            }

        }

        sort(ind.begin(),ind.end());

        vector<int> x(n+1,-1);

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

        {

            if(!binary_search(ind.begin(),ind.end(),i))

            {

                x[i]=a[i];

            }

        }

        reverse(ind.begin(),ind.end());

        int k=1;

        for(auto it:ind)

        {

            while(x[k]!=-1)

            {

                k++;

            }

            x[k]=a[it];

        }

        int sum=0;

        for(int i=l;i<=r;i++)

        {

            sum+=x[i];

        }

        cout<<sum<<endl;

    }   

}

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

#define int long long

using namespace std;



signed main()

{

    int t;

    cin>>t;

    while(t--)

    {

        int n,l,r;

        cin>>n>>l>>r;

        vector<int> a(n+1);

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

        {

            cin>>a[i];

        }

        vector<pair<int,int>> v;

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

        {

            if(!(i>=l && i<=r))v.push_back({a[i],i});

        }

        sort(v.begin(),v.end());

        vector<int> ind;

        vector<pair<int,int>> y;

        for(int i=l;i<=r;i++)

        {

            y.push_back({a[i],i});

        }

        sort(y.begin(),y.end());

        int j=y.size()-1;

        for(auto it:v)

        {

            if(j>=0 && it.first<y[j].first)

            {

                ind.push_back(y[j].second);

                ind.push_back(it.second);

                j--;

            }

        }

        sort(ind.begin(),ind.end());

        vector<int> x(n+1,-1);

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

        {

            if(!binary_search(ind.begin(),ind.end(),i))

            {

                x[i]=a[i];

            }

        }

        reverse(ind.begin(),ind.end());

        int k=1;

        for(auto it:ind)

        {

            while(x[k]!=-1)

            {

                k++;

            }

            x[k]=a[it];

        }

        int sum=0;

        for(int i=l;i<=r;i++)

        {

            sum+=x[i];

        }

        cout<<sum<<endl;

    }   

}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

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

#define int long long

using namespace std;



signed main()

{

    int t;

    cin>>t;

    while(t--)

    {

        int n,l,r;

        cin>>n>>l>>r;

        vector<int> a(n+1);

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

        {

            cin>>a[i];

        }

        vector<pair<int,int>> v;

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

        {

            if(!(i>=l && i<=r))v.push_back({a[i],i});

        }

        sort(v.begin(),v.end());

        vector<int> ind;

        vector<pair<int,int>> y;

        for(int i=l;i<=r;i++)

        {

            y.push_back({a[i],i});

        }

        sort(y.begin(),y.end());

        int j=y.size()-1;

        for(auto it:v)

        {

            if(j>=0 && it.first<y[j].first)

            {

                ind.push_back(y[j].second);

                ind.push_back(it.second);

                j--;

            }

        }

        sort(ind.begin(),ind.end());

        vector<int> x(n+1,-1);

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

        {

            if(!binary_search(ind.begin(),ind.end(),i))

            {

                x[i]=a[i];

            }

        }

        reverse(ind.begin(),ind.end());

        int k=1;

        for(auto it:ind)

        {

            while(x[k]!=-1)

            {

                k++;

            }

            x[k]=a[it];

        }

        int sum=0;

        for(int i=l;i<=r;i++)

        {

            sum+=x[i];

        }

        cout<<sum<<endl;

    }   

}

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

#define int long long

using namespace std;





signed main()

{

    int t;

    cin>>t;

    while(t--)

    {

        int n,l,r;

        cin>>n>>l>>r;

        vector<int> a(n+1);

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

        {

            cin>>a[i];

        }

        vector<int> b,c;

        for(int i=1;i<=r;i++)

        {

            b.push_back(a[i]);

        }

        for(int i=l;i<=n;i++)

        {

            c.push_back(a[i]);

        }

        sort(b.begin(),b.end());

        sort(c.begin(),c.end());

        int sum1=accumulate(b.begin(),b.begin()+r-l+1,0LL);

        int sum2=accumulate(c.begin(),c.begin()+r-l+1,0LL);

        cout<<min(sum1,sum2)<<endl;

    }   

}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

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

#define int long long

using namespace std;



signed main()

{

    int t;

    cin>>t;

    while(t--)

    {

        int n,l,r;

        cin>>n>>l>>r;

        vector<int> a(n+1);

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

        {

            cin>>a[i];

        }

        sort(a.begin(),a.end());

        int sum=0;

        for(int i=1;i<=r-l+1;i++)

        {

            sum+=a[i];

        }

        cout<<sum<<endl;

    }   

}

Submission (verdict: Runtime error on test 2):
#include<bits/stdc++.h>

#define int long long

using namespace std;



signed main()

{

    int t;

    cin>>t;

    while(t--)

    {

        int n,l,r;

        cin>>n>>l>>r;

        vector<int> a(n+1);

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

        {

            cin>>a[i];

        }

        vector<pair<int,int>> v;

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

        {

            if(!(i>=l && i<=r))v.push_back({a[i],i});

        }

        sort(v.begin(),v.end());

        vector<int> ind;

        vector<pair<int,int>> y;

        for(int i=l;i<=r;i++)

        {

            y.push_back({a[i],i});

        }

        sort(y.begin(),y.end());

        int j=y.size()-1;

        for(auto it:v)

        {

            if(it.first<y[j].first)

            {

                ind.push_back(y[j].second);

                ind.push_back(it.second);

                j--;

            }

        }

        sort(ind.begin(),ind.end());

        vector<int> x(n+1,-1);

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

        {

            if(!binary_search(ind.begin(),ind.end(),i))

            {

                x[i]=a[i];

            }

        }

        reverse(ind.begin(),ind.end());

        int k=1;

        for(auto it:ind)

        {

            while(x[k]!=-1)

            {

                k++;

            }

            x[k]=a[it];

        }

        int sum=0;

        for(int i=l;i<=r;i++)

        {

            sum+=x[i];

        }

        cout<<sum<<endl;

    }   

}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)


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

#define int long long

using namespace std;



signed main()

{

    int t;

    cin>>t;

    while(t--)

    {

        int n,l,r;

        cin>>n>>l>>r;

        vector<int> a(n+1);

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

        {

            cin>>a[i];

        }

        sort(a.begin(),a.end());

        int sum=0;

        for(int i=1;i<=r-l+1;i++)

        {

            sum+=a[i];

        }

        cout<<sum<<endl;

    }   

}
Problem: 2057B - Gorilla and the Exam
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 1):
// This program is made by sujal Vekariya
#include <bits/stdc++.h>
using namespace std;

#define fastio()                      \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define trav(x, v) for (auto &x : v)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define mod 1000000007
#define inf INT_MAX
#define minf INT_MIN
#define desync() cout.flush(), system("pause"), _Exit(0)

ll gcd(ll a, ll b)
{
    return b == 0 ? a : gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    return (a / gcd(a, b)) * b;
}

bool is_prime(ll n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (ll i = 5; i * i <= n; i += 6)
    {
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    }
    return true;
}

int main()
{
    fastio();
    int t;
    cin >> t;
    while (t--)
    {
        ll n, k;
        cin >> n >> k;
        vll a(n);

        for (int i = 0; i < n; i++)
        {
            cin >> a[i];
        }
        unordered_map<ll, ll> freq;
        for (int i = 0; i < n; i++)
        {
            freq[a[i]]++;
        }

        vector<ll> freq_values;
        for (auto it : freq)
        {
            freq_values.push_back(it.second);
        }
        sort(freq_values.begin(), freq_values.end());

        int distinct_count = freq.size();
        for (ll f : freq_values)
        {
            if (k >= f)
            {
                k -= f;
                distinct_count--;
            }
            else
            {
                break;
            }
        }

        cout << distinct_count << endl;
    }

    return 0;
}
Problem: 2057B - Gorilla and the Exam
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Time limit exceeded on test 11):
// This program is made by sujal Vekariya
#include <bits/stdc++.h>
using namespace std;

#define fastio()                      \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define trav(x, v) for (auto &x : v)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define mod 1000000007
#define inf INT_MAX
#define minf INT_MIN
#define desync() cout.flush(), system("pause"), _Exit(0)

ll gcd(ll a, ll b)
{
    return b == 0 ? a : gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    return (a / gcd(a, b)) * b;
}

bool is_prime(ll n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (ll i = 5; i * i <= n; i += 6)
    {
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    }
    return true;
}

int main()
{
    fastio();
    int t;
    cin >> t;
    while (t--)
    {
        ll n, k;
        cin >> n >> k;
        ll x;
        unordered_map<ll, ll> freq;

        for (int i = 0; i < n; i++)
        {
            cin >> x;
            freq[x]++;
        }
        if(k>=n)
        {
            cout<<1<<endl;
            continue;
        }
        
        vector<ll> freq_values;
        for (auto it : freq)
        {
            freq_values.push_back(it.second);
        }
        sort(freq_values.begin(), freq_values.end());

        int distinct_count = freq.size();
        for (ll f : freq_values)
        {
            if (k >= f)
            {
                k -= f;
                distinct_count--;
            }
            else
            {
                break;
            }
        }

        cout << distinct_count << endl;
    }

    return 0;
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
#define ll long long
map<int,int>mp;
int main(){
	int t; cin>>t;
	while(t--){
        ll n,m; cin>>n>>m;
        mp.clear();
        for(int i=1;i<=n;i++){
        	int a; cin>>a;
        	mp[a]++;
        }
        multiset<int>st;
        for(auto b:mp){
        	st.insert(b.second);
        }
        int ans=st.size();
        for(int a:st){
        	if(m>=a) ans--,m-=a;
        }
        cout<<max(1,ans)<<endl;
	}	
}
Problem: 2052A - Adrenaline Rush
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#define endl "\n"
typedef long long ll;
using namespace std;


int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    // cin >> t;
    while (t--) {
		int n;
        cin>>n;

        vector<int>  a(n, 0);
        unordered_map<int, int> indices;

        for(int i =0;i<n; ++i){
            int it = 0;
            cin>>it;
            indices[it] = i;
        }

        for(int i= 0; i<n; ++i){
            a[i] = i+1;
        }

        unordered_map<int, set<int>> mp;
        vector<pair<int, int>>v;
        for(int i = 0; i<n; ++i){
            if(i == indices[a[i]]) continue;
            int ind = indices[i+1];
            for(int j = i+1; j<=ind; ++j){
                
                mp[a[i]].insert(a[j]);
                mp[a[j]].insert(a[i]);
                v.push_back({a[j], a[i]});
                swap(a[i], a[j]);
            }
            --i;
            indices[a[i]] = i;
        }

        for(int i = n-2; i>=0; --i){
            set<int> st = mp[a[i]];
            if(!st.count(a[i+1])){
                v.push_back({a[i], a[i+1]});
                v.push_back({a[i+1], a[i]});
            }
        }
        cout<<v.size()<<endl;
        for(auto it: v){
            cout<<it.first<<' '<<it.second<<endl;
        }

    }
    return 0;
}

Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#define endl "\n"
typedef long long ll;
using namespace std;


int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    // cin >> t;
    while (t--) {
		int n;
        cin>>n;

        vector<int>  a(n, 0);
        unordered_map<int, int> indices;

        for(int i =0;i<n; ++i){
            int it = 0;
            cin>>it;
            indices[it] = i;
        }

        for(int i= 0; i<n; ++i){
            a[i] = i+1;
        }

        unordered_map<int, set<int>> mp;
        vector<pair<int, int>>v;
        for(int i = 0; i<n; ++i){
            if(i == indices[a[i]]) continue;
            int ind = indices[i+1];
            for(int j= i+1; j<=ind; ++j){
                mp[a[i]].insert(a[j]);
                mp[a[j]].insert(a[i]);
                v.push_back({a[j], a[i]});
            } 
            for(int j = i+1; j<=ind; ++j){
                swap(a[j-1], a[j]);
            }
            --i;
            indices[a[i]] = i;
        }

        for(int i = n-2; i>=0; --i){
            set<int> st = mp[a[i]];
            if(!st.count(a[i+1])){
                v.push_back({a[i], a[i+1]});
                v.push_back({a[i+1], a[i]});
            }
        }
        cout<<v.size()<<endl;
        for(auto it: v){
            cout<<it.first<<' '<<it.second<<endl;
        }

    }
    return 0;
}