ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2061D - Kevin and Numbers
Language: C++23 (GCC 14-64, msys2)

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

#define ll long long

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int n, m;
        ll sum1 = 0, sum2 = 0;
        cin >> n >> m;
        multiset<int> a, b;
        int temp;
        for (int i = 0; i < n; i++)
        {
            cin >> temp;
            a.insert(temp);
            sum1 += temp;
        }
        for (int i = 0; i < m; i++)
        {
            cin >> temp;
            b.insert(temp);
            sum2 += temp;
        }
        int flag = 1;
        if (sum1 != sum2)
        {
            flag = 0;
        }
        while (b.size() != 0 && flag)
        {
            int t = *b.begin();
            if (a.find(t) != a.end())
            {
                b.erase(b.begin());
                a.erase(a.find(t));
            }
            else
            {
                if (t == 1)
                {
                    flag = 0;
                    break;
                }
                b.erase(t);
                if (t % 2 == 0)
                {
                    b.insert(t / 2);
                    b.insert(t / 2);
                }
                else
                {
                    b.insert(t / 2);
                    b.insert((t / 2) + 1);
                }
            }
        }
        if (flag)
            cout << "YES\n";
        else
            cout << "NO\n";
    }

    return 0;
}

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

#define ll long long

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int n, m;
        ll sum1 = 0, sum2 = 0;
        cin >> n >> m;
        multiset<int> a, b;
        int temp;
        for (int i = 0; i < n; i++)
        {
            cin >> temp;
            a.insert(temp);
            sum1 += temp;
        }
        for (int i = 0; i < m; i++)
        {
            cin >> temp;
            b.insert(temp);
            sum2 += temp;
        }
        int flag = 1;
        if (sum1 != sum2)
        {
            flag = 0;
        }
        while (b.size() != 0 && flag)
        {
            int t = *(b.rbegin());
            if (a.find(t) != a.end())
            {
                b.erase(b.find(t));
                a.erase(a.find(t));
            }
            else
            {
                if (t == 1)
                {
                    flag = 0;
                    break;
                }
                b.erase(t);
                if (t % 2 == 0)
                {
                    b.insert(t / 2);
                    b.insert(t / 2);
                }
                else
                {
                    b.insert(t / 2);
                    b.insert((t / 2) + 1);
                }
            }
        }
        if (flag)
            cout << "YES\n";
        else
            cout << "NO\n";
    }

    return 0;
}
Problem: 2061D - Kevin and Numbers
Language: C++23 (GCC 14-64, msys2)


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

#define ll long long

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int n, m;
        ll sum1 = 0, sum2 = 0;
        cin >> n >> m;
        multiset<int> a, b;
        int temp;
        for (int i = 0; i < n; i++)
        {
            cin >> temp;
            a.insert(temp);
            sum1 += temp;
        }
        for (int i = 0; i < m; i++)
        {
            cin >> temp;
            b.insert(temp);
            sum2 += temp;
        }
        int flag = 1;
        if (sum1 != sum2)
        {
            flag = 0;
        }
        while (b.size() != 0 && flag)
        {
            int t = *b.begin();
            if (a.find(t) != a.end())
            {
                b.erase(b.begin());
                a.erase(a.find(t));
            }
            else
            {
                if (t == 1)
                {
                    flag = 0;
                    break;
                }
                b.erase(t);
                if (t % 2 == 0)
                {
                    b.insert(t / 2);
                    b.insert(t / 2);
                }
                else
                {
                    b.insert(t / 2);
                    b.insert((t / 2) + 1);
                }
            }
        }
        if (flag)
            cout << "YES\n";
        else
            cout << "NO\n";
    }

    return 0;
}
Problem: 2061D - Kevin and Numbers
Language: C++23 (GCC 14-64, msys2)

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

#define ll long long

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int n, m;
        ll sum1 = 0, sum2 = 0;
        cin >> n >> m;
        multiset<int> a, b;
        int temp;
        for (int i = 0; i < n; i++)
        {
            cin >> temp;
            a.insert(temp);
            sum1 += temp;
        }
        for (int i = 0; i < m; i++)
        {
            cin >> temp;
            b.insert(temp);
            sum2 += temp;
        }
        int flag = 1;
        if (sum1 != sum2)
        {
            flag = 0;
        }
        while (b.size() != 0 && flag)
        {
            int t = *(b.rbegin());
            if (a.find(t) != a.end())
            {
                b.erase(b.find(t));
                a.erase(a.find(t));
            }
            else
            {
                if (t == 1)
                {
                    flag = 0;
                    break;
                }
                b.erase(t);
                if (t % 2 == 0)
                {
                    b.insert(t / 2);
                    b.insert(t / 2);
                }
                else
                {
                    b.insert(t / 2);
                    b.insert((t / 2) + 1);
                }
            }
        }
        if (flag)
            cout << "YES\n";
        else
            cout << "NO\n";
    }

    return 0;
}


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

#define ll long long

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int n, m;
        ll sum1 = 0, sum2 = 0;
        cin >> n >> m;
        multiset<int> a, b;
        int temp;
        for (int i = 0; i < n; i++)
        {
            cin >> temp;
            a.insert(temp);
            sum1 += temp;
        }
        for (int i = 0; i < m; i++)
        {
            cin >> temp;
            b.insert(temp);
            sum2 += temp;
        }
        int flag = 1;
        if (sum1 != sum2)
        {
            flag = 0;
        }
        while (b.size() != 0 && flag)
        {
            int t = *b.begin();
            if (a.find(t) != a.end())
            {
                b.erase(b.begin());
                a.erase(a.find(t));
            }
            else
            {
                if (t == 1)
                {
                    flag = 0;
                    break;
                }
                b.erase(b.begin());
                if (t % 2 == 0)
                {
                    b.insert(t / 2);
                    b.insert(t / 2);
                }
                else
                {
                    b.insert(t / 2);
                    b.insert((t / 2) + 1);
                }
            }
        }
        if (flag)
            cout << "YES\n";
        else
            cout << "NO\n";
    }

    return 0;
}
Problem: 2049C - MEX Cycle
Language: C++17 (GCC 7-32)


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

using namespace std;

#define print_b(ans) cout<<(ans?"YES":"NO")<<endl;

#define print_n(x)        cout<<x<<endl;

#define times(x)          int x;cin>>x;while(x--)

#define debug(x) cout<<#x<<": "<<x<<endl;

typedef long long ll;

void judge(){

    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

    #ifndef ONLINE_JUDGE

        freopen("input.txt","r",stdin);

        //freopen("output.txt","w",stdout);

    #endif

}

int main(){

    judge();

    times(x){

        int n,x,y;cin>>n>>x>>y;

        if(x<y)swap(x,y);

        vector<int> ans(n);

        ans[x-1]=1;

        ans[y-1]=0;

        int left=(x-y-1);

        int right=n-(x-y+1);

        if(left%2==0){

            bool test=true;

            for(int i=y;i<x-1;i++){

                ans[i]=test;

                test^=true;

            }

        }

        else{

            bool test=true;

            for(int i=y;i<(y+left/2);i++){

                ans[i]=test;

                test^=true;

            }

            ans[y+test/2]=2;

            for(int i=(y+left/2+1);i<x-1;i++){

                ans[i]=test;

                test^=true;

            }

        }

        if(right%2==0){

            bool test=false;

            int i=x;

            i%=n;

            while(i!=y-1){

                ans[i]=test;

                test^=true;

                i++;

                i%=n;

            }

        }

        else{

            bool test=0;

            int i=x;

            i%=n;

            int test1=(x+right/2)%n;

            while(i!=test1){

                ans[i]=test;

                test^=1;

                i++;

                i%=n;

            }

            ans[i]=2;

            i++;

            while(i!=y-1){

                ans[i]=test;

                test^=1;

                i++;

                i%=n;

            }

        }

        for(int i=0;i<n;i++)cout<<ans[i]<<" ";

        cout<<endl;

    }

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

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

typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

// #define int long long
#define ll long long
#define F first
#define S second
#define endl '\n'
#define pb(x) push_back((x))
#define f(i,n) for(int i=0;i<n;i++)
#define g(i,m,n) for(int i=m; i<=n; i++)
#define asc(a) (a).begin(),(a).end()
#define desc(a) (a).rbegin(),(a).rend()
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define pa1(a,n) g(i,1,n) cout<<a[i]<<" "; cout<<endl;
#define pa(a,n) f(i,n) cout<<a[i]<<" "; cout<<endl;
#define ia1(a,n) vector<int> a(n+1); g(i,1,n) cin>>a[i];
#define ia(a,n) vector<int> a(n); f(i,n) cin>>a[i];

const int mod = 1e9+7;
const int INF = 1e9;

void solve() {
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    f(i,n)
    {
        cin>>a[i];
    }
    sort(a.begin(), a.end());
    vector<int> cnt;
    cnt={1};
    for(int i=1; i<n;i++)
    {
        if(a[i]==a[i-1])
        {
            cnt.back()++;
        }
        else
        {
            cnt.emplace_back(1);
        }
    }
sort(cnt.begin(),cnt.end());
    int m=cnt.size();
    for(int i=0;i<m-1;i++)
    {
        if(cnt[i]>k)
        {
            cout<<m-i<<endl;
            return;
        }
        else{
            k-=cnt[i];
        }
    }
    cout<<1;
}

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

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

typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

// #define int long long
#define ll long long
#define F first
#define S second
#define endl '\n'
#define pb(x) push_back((x))
#define f(i,n) for(int i=0;i<n;i++)
#define g(i,m,n) for(int i=m; i<=n; i++)
#define asc(a) (a).begin(),(a).end()
#define desc(a) (a).rbegin(),(a).rend()
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define pa1(a,n) g(i,1,n) cout<<a[i]<<" "; cout<<endl;
#define pa(a,n) f(i,n) cout<<a[i]<<" "; cout<<endl;
#define ia1(a,n) vector<int> a(n+1); g(i,1,n) cin>>a[i];
#define ia(a,n) vector<int> a(n); f(i,n) cin>>a[i];

const int mod = 1e9+7;
const int INF = 1e9;

void solve() {
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    f(i,n)
    {
        cin>>a[i];
    }
    sort(a.begin(), a.end());
    vector<int> cnt;
    cnt={1};
    for(int i=1; i<n;i++)
    {
        if(a[i]==a[i-1])
        {
            cnt.back()++;
        }
        else
        {
            cnt.emplace_back(1);
        }
    }
sort(cnt.begin(),cnt.end());
    int m=cnt.size();
    for(int i=0;i<m-1;i++)
    {
        if(cnt[i]>k)
        {
            cout<<m-i<<endl;
            return;
        }
        else{
            k-=cnt[i];
        }
    }
    cout<<1<<endl;
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
Problem: 2057B - Gorilla and the Exam
Language: C++23 (GCC 14-64, msys2)


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

typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

// #define int long long
#define ll long long
#define F first
#define S second
#define endl '\n'
#define pb(x) push_back((x))
#define f(i,n) for(int i=0;i<n;i++)
#define g(i,m,n) for(int i=m; i<=n; i++)
#define asc(a) (a).begin(),(a).end()
#define desc(a) (a).rbegin(),(a).rend()
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define pa1(a,n) g(i,1,n) cout<<a[i]<<" "; cout<<endl;
#define pa(a,n) f(i,n) cout<<a[i]<<" "; cout<<endl;
#define ia1(a,n) vector<int> a(n+1); g(i,1,n) cin>>a[i];
#define ia(a,n) vector<int> a(n); f(i,n) cin>>a[i];

const int mod = 1e9+7;
const int INF = 1e9;

void solve() {
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    f(i,n)
    {
        cin>>a[i];
    }
    sort(a.begin(), a.end());
    vector<int> cnt;
    cnt={1};
    for(int i=1; i<=n;i++)
    {
        if(a[i]==a[i-1])
        {
            cnt.back()++;
        }
        else
        {
            cnt.emplace_back(1);
        }
    }
sort(cnt.begin(),cnt.end());
    int m=cnt.size();
    for(int i=0;i<m-1;i++)
    {
        if(cnt[i]>k)
        {
            cout<<m-i-1<<endl;
            return;
        }
        else{
            k-=cnt[i];
        }
    }
    cout<<1;
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: Java 21


Submission (verdict: Wrong answer on test 1):
//package Practice;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class AdrenalineRush {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        int n = Integer.parseInt(br.readLine());
        int[] arr = new int[n];
        StringTokenizer st = new StringTokenizer(br.readLine());
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(st.nextToken());
            map.put(arr[i], i);
         }
        if (n == 1) {
            pw.println("0");
            return;
        }
        HashMap<Integer, Integer> map2 = new HashMap<>();
        int[] arr2 = new int[n];
        for (int i = 0; i < n; i++) {
            arr2[i] = i+1;
            map2.put(i+1, i);
        }
        ArrayList<String> moves= new ArrayList<>();
        for (int i = n-1; i >= 0; i--) {
            int curNum = arr[i];
            int startIdx = map2.get(curNum);
            int endIdx = map.get(curNum);
            //System.out.println("at i="+i+", curNum is " + curNum + " and start:" + startIdx + " and end:" + endIdx);
            if (startIdx < endIdx) {
                while (startIdx < endIdx) {
                    moves.add(arr2[startIdx+1] + " " + arr2[startIdx]);
                    int temp = arr2[startIdx];
                    map2.put(arr2[startIdx], map2.get(arr2[startIdx]) + 1);
                    map2.put(arr2[startIdx+1], map2.get(arr2[startIdx+1]) - 1);
                    arr2[startIdx] = arr2[startIdx+1];
                    arr2[startIdx+1] = temp;
                    startIdx++;
                }
            }
        }
        //System.out.println("arr2:" + Arrays.toString(arr2));
        HashSet<String> moveSet = new HashSet<>();
        moveSet.addAll(moves);
        for (int i = 0; i < n - 1; i++) {
            if (!moveSet.contains(arr2[i] + " " + arr2[i+1]) && !moveSet.contains(arr2[i+1] + " " + arr2[i])) {
                moves.add(arr2[i] + " " + arr2[i+1]);
                moves.add(arr2[i+1] + " " + arr2[i]);
            }
        }
        pw.println(moves.size());
        for (String move: moves) {
            pw.println(move);
        }
        // do extra stuff

        pw.close();
        br.close();
    }
}
Problem: 2049B - pspspsps
Language: C++23 (GCC 14-64, msys2)

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

using namespace std;

#define int long long

#define endl '\n'

#define YES cout << "YES\n";

#define NO cout << "NO\n";



const int N = 1e6 + 5;



signed main() // Road to red

{

    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

    int tes = 1;

    cin >> tes;

    while (tes--)

    {

        int n,res{1}; cin >> n;

        string s; cin >> s;

        for(auto &x : s){if(x == '.'){x = 's';}}

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

        {

            if(s[i] == 'p' && s[i+1] == 's'){res = 0; break;}

            else if(s[i] == 's' && s[i+1] == 'p' && i != 0 && i != n-2){res = 0; break;}

        }

        if(res){YES}

        else{NO}

    }

    return 0;

}

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

using namespace std;

#define int long long

#define endl '\n'

#define YES cout << "YES\n";

#define NO cout << "NO\n";



const int N = 1e6 + 5;



signed main() // Road to red

{

    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

    int tes = 1;

    cin >> tes;

    while (tes--)

    {

        int n,res{1}; cin >> n;

        string s; cin >> s;

        bool p = 0;

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

        {

            if(s[i] == 'p'){p = 1;}

            if(p && s[i] == 's'){res = 0; break;}

            // else if(s[i] == 's' && s[i+1] == 'p' && i != 0 && i != n-2){res = 0; break;}

        }

        bool ss = 0;

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

        {

            if(i < n-2 && s[i] == 's'){ss = 1;}

            if(ss && s[i] == 'p'){res = 0; break;}

            // else if(s[i] == 's' && s[i+1] == 'p' && i != 0 && i != n-2){res = 0; break;}

        }

        if(res){YES}

        else{NO}

    }

    return 0;

}
Problem: 2049B - pspspsps
Language: C++23 (GCC 14-64, msys2)

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

using namespace std;

#define int long long

#define endl '\n'

#define YES cout << "YES\n";

#define NO cout << "NO\n";



const int N = 1e6 + 5;



signed main() // Road to red

{

    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

    int tes = 1;

    cin >> tes;

    while (tes--)

    {

        int n,res{1}; cin >> n;

        string s; cin >> s;

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

        {

            if(s[i] == 'p' && s[i+1] == 's'){res = 0; break;}

            else if(s[i] == 's' && s[i+1] == 'p' && i != 0 && i != n-2){res = 0; break;}

        }

        if(res){YES}

        else{NO}

    }

    return 0;

}

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

using namespace std;

#define int long long

#define endl '\n'

#define YES cout << "YES\n";

#define NO cout << "NO\n";



const int N = 1e6 + 5;



signed main() // Road to red

{

    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

    int tes = 1;

    cin >> tes;

    while (tes--)

    {

        int n,res{1}; cin >> n;

        string s; cin >> s;

        for(auto &x : s){if(x == '.'){x = 's';}}

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

        {

            if(s[i] == 'p' && s[i+1] == 's'){res = 0; break;}

            else if(s[i] == 's' && s[i+1] == 'p' && i != 0 && i != n-2){res = 0; break;}

        }

        if(res){YES}

        else{NO}

    }

    return 0;

}
Problem: 2049B - pspspsps
Language: C++23 (GCC 14-64, msys2)


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

using namespace std;

#define int long long

#define endl '\n'

#define YES cout << "YES\n";

#define NO cout << "NO\n";



const int N = 1e6 + 5;



signed main() // Road to red

{

    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

    int tes = 1;

    cin >> tes;

    while (tes--)

    {

        int n,res{1}; cin >> n;

        string s; cin >> s;

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

        {

            if(s[i] == 'p' && s[i+1] == 's'){res = 0; break;}

            else if(s[i] == 's' && s[i+1] == 'p' && i != 0 && i != n-2){res = 0; break;}

        }

        if(res){YES}

        else{NO}

    }

    return 0;

}
Problem: 2049B - pspspsps
Language: C++23 (GCC 14-64, msys2)

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

using namespace std;

#define int long long

#define endl '\n'

#define YES cout << "YES\n";

#define NO cout << "NO\n";



const int N = 1e6 + 5;



signed main() // Road to red

{

    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

    int tes = 1;

    cin >> tes;

    while (tes--)

    {

        int n,res{1}; cin >> n;

        string s; cin >> s;

        bool p = 0;

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

        {

            if(s[i] == 'p'){p = 1;}

            if(p && s[i] == 's'){res = 0; break;}

            // else if(s[i] == 's' && s[i+1] == 'p' && i != 0 && i != n-2){res = 0; break;}

        }

        bool ss = 0;

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

        {

            if(i < n-2 && s[i] == 's'){ss = 1;}

            if(ss && s[i] == 'p'){res = 0; break;}

            // else if(s[i] == 's' && s[i+1] == 'p' && i != 0 && i != n-2){res = 0; break;}

        }

        if(res){YES}

        else{NO}

    }

    return 0;

}

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

using namespace std;

#define int long long

#define endl '\n'

#define YES cout << "YES\n";

#define NO cout << "NO\n";



const int N = 1e6 + 5;



signed main() // Road to red

{

    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

    int tes = 1;

    cin >> tes;

    while (tes--)

    {

        int n,res{1}; cin >> n;

        string s; cin >> s;

        bool p = 0;

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

        {

            if(s[i] == 'p'){p = 1;}

            if(p && s[i] == 's'){res = 0; break;}

        }

        bool ss = 0;

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

        {

            if(i < n-2 && s[i] == 's'){ss = 1;}

            if(ss && s[i] == 'p'  && i < n-1){res = 0; break;}

        }

        if(res){YES}

        else{NO}

    }

    return 0;

}