ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 5):
#include <bits/stdc++.h>
#define int long long
using namespace std;
int c[1005];
int a[1005];
map <pair<int,int>, bool> pos;
vector <pair<int,int> > res;
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    a[0]=-1;
    a[n+1]=-1;
    for (int i=1 ; i<=n ; i++)
    {
        cin >> c[i];
        pos[ {-1,c[i]}]=true;
        pos[ {c[i],-1}]=true;
    }
    for (int i=1 ; i<=n ; i++)
        a[i]=i;
    int assist;
    for (int i=1 ; i<=n ; i++)
    {
        if (c[i]<=i)
            continue;
        for (int j=1 ; j<=n ; j++)
            if (a[j]==c[i])
                assist=j;
        while (a[i]!=c[i])
        {
            pos[ {a[assist],a[assist-1]}]=true;
            res.push_back({a[assist],a[assist-1]});
            swap(a[assist],a[assist-1]);
            assist--;
        }
    }
    for (int i=1 ; i<=n ; i++)
    {
        assist=i;
        while (!pos[ {a[assist],a[assist-1]}] && !pos[ {a[assist-1],a[assist]}])
        {
            pos[ {a[assist],a[assist-1]}]=true;
            res.push_back({a[assist],a[assist-1]});
            swap(a[assist],a[assist-1]);
            assist--;
        }
        while (assist!=i)
        {
            pos[ {a[assist+1],a[assist]}]=true;
            res.push_back({a[assist+1],a[assist]});
            swap(a[assist+1],a[assist]);
            assist++;
        }
    }
    cout << res.size() << "\n";
    for (auto u : res)
        cout << u.first << " " << u.second << "\n";
    return 0;
}



Submission (verdict: Wrong answer on test 7):
#include <bits/stdc++.h>
#define int long long
using namespace std;
int c[1005];
int a[1005];
map <pair<int,int>, bool> pos;
vector <pair<int,int> > res;
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    a[0]=-1;
    a[n+1]=-1;
    for (int i=1 ; i<=n ; i++)
    {
        cin >> c[i];
        pos[ {-1,c[i]}]=true;
        pos[ {c[i],-1}]=true;
    }
    for (int i=1 ; i<=n ; i++)
        a[i]=i;
    int assist;
    for (int i=1 ; i<=n ; i++)
    {
        for (int j=1 ; j<=n ; j++)
            if (a[j]==c[i])
                assist=j;
        while (a[i]!=c[i])
        {
            pos[ {a[assist],a[assist-1]}]=true;
            res.push_back({a[assist],a[assist-1]});
            swap(a[assist],a[assist-1]);
            assist--;
        }
    }
    for (int i=1 ; i<=n ; i++)
    {
        assist=i;
        while (!pos[ {a[assist],a[assist-1]}] && !pos[ {a[assist-1],a[assist]}])
        {
            pos[ {a[assist],a[assist-1]}]=true;
            res.push_back({a[assist],a[assist-1]});
            swap(a[assist],a[assist-1]);
            assist--;
        }
        while (assist!=i)
        {
            pos[ {a[assist+1],a[assist]}]=true;
            res.push_back({a[assist+1],a[assist]});
            swap(a[assist+1],a[assist]);
            assist++;
        }
    }
    cout << res.size() << "\n";
    for (auto u : res)
        cout << u.first << " " << u.second << "\n";
    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#define int long long
using namespace std;
int c[1003];
int a[1003];
map <pair<int,int>, bool> pos;
vector <pair<int,int> > res;
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    for (int i=1 ; i<=n ; i++)
        cin >> c[i];
    for (int i=1 ; i<=n ; i++)
        a[i]=i;
    int assist;
    for (int i=1 ; i<=n ; i++)
    {
        if (c[i]<=i)
            continue;
        for (int j=1 ; j<=n ; j++)
            if (a[j]==c[i])
                assist=j;
        while (a[i]!=c[i])
        {
            pos[ {a[assist],a[assist-1]}]=true;
            res.push_back({a[assist],a[assist-1]});
            swap(a[assist],a[assist-1]);
            assist--;
        }
    }
    for (int i=1 ; i<n ; i++)
        if (!pos[ {a[i],a[i+1]}] && !pos[ {a[i+1],a[i]}])
        {
            res.push_back({a[i],a[i+1]});
            res.push_back({a[i+1],a[i]});
        }
    cout << res.size() << "\n";
    for (auto u : res)
        cout << u.first << " " << u.second << "\n";
    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 7):
#include <bits/stdc++.h>
#define int long long
using namespace std;
int c[1005];
int a[1005];
map <pair<int,int>, bool> pos;
vector <pair<int,int> > res;
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    a[0]=-1;
    a[n+1]=-1;
    for (int i=1 ; i<=n ; i++)
    {
        cin >> c[i];
        pos[ {-1,c[i]}]=true;
        pos[ {c[i],-1}]=true;
    }
    for (int i=1 ; i<=n ; i++)
        a[i]=i;
    int assist;
    for (int i=1 ; i<=n ; i++)
    {
        for (int j=1 ; j<=n ; j++)
            if (a[j]==c[i])
                assist=j;
        while (a[i]!=c[i])
        {
            pos[ {a[assist],a[assist-1]}]=true;
            res.push_back({a[assist],a[assist-1]});
            swap(a[assist],a[assist-1]);
            assist--;
        }
    }
    for (int i=1 ; i<=n ; i++)
    {
        assist=i;
        while (!pos[ {a[assist],a[assist-1]}] && !pos[ {a[assist-1],a[assist]}])
        {
            pos[ {a[assist],a[assist-1]}]=true;
            res.push_back({a[assist],a[assist-1]});
            swap(a[assist],a[assist-1]);
            assist--;
        }
        while (assist!=i)
        {
            pos[ {a[assist+1],a[assist]}]=true;
            res.push_back({a[assist+1],a[assist]});
            swap(a[assist+1],a[assist]);
            assist++;
        }
    }
    cout << res.size() << "\n";
    for (auto u : res)
        cout << u.first << " " << u.second << "\n";
    return 0;
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
#define int long long
using namespace std;
int c[1005],a[1005];
vector <pair<int,int> > res;
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    for (int i=1 ; i<=n ; i++)
    {
        cin >> c[i];
        a[i]=i;
    }
    for (int i=1 ; i<=n ; i++)
    {
        int assist;
        for (int j=1 ; j<=n ; j++)
            if (a[j]==c[i])
                assist=j;
        int ss=a[assist];
        while (a[n]!=ss)
        {
            res.push_back({a[assist+1],a[assist]});
            swap(a[assist],a[assist+1]);
            assist++;
        }
        while (a[i]!=c[i])
        {
            res.push_back({a[assist],a[assist-1]});
            swap(a[assist-1],a[assist]);
            assist--;
        }
    }
    cout << res.size() << "\n";
    for (auto u : res)
        cout << u.first << " " << u.second << "\n";
    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#define int long long
using namespace std;
int c[1003];
int a[1003];
map <pair<int,int>, bool> pos;
vector <pair<int,int> > res;
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    for (int i=1 ; i<=n ; i++)
        cin >> c[i];
    for (int i=1 ; i<=n ; i++)
        a[i]=i;
    int assist;
    for (int i=1 ; i<=n ; i++)
    {
        if (c[i]<=i)
            continue;
        for (int j=1 ; j<=n ; j++)
            if (a[j]==c[i])
                assist=j;
        while (a[i]!=c[i])
        {
            pos[ {a[assist],a[assist-1]}]=true;
            res.push_back({a[assist],a[assist-1]});
            swap(a[assist],a[assist-1]);
            assist--;
        }
    }
    for (int i=1 ; i<n ; i++)
        if (!pos[ {a[i],a[i+1]}] && !pos[ {a[i+1],a[i]}])
        {
            res.push_back({a[i],a[i+1]});
            res.push_back({a[i+1],a[i]});
        }
    cout << res.size() << "\n";
    for (auto u : res)
        cout << u.first << " " << u.second << "\n";
    return 0;
}


Submission (verdict: Wrong answer on test 4):
#include <bits/stdc++.h>
#define int long long
using namespace std;
int c[1003];
int a[1003];
map <pair<int,int>, bool> pos;
vector <pair<int,int> > res;
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    for (int i=1 ; i<=n ; i++)
        cin >> c[i];
    for (int i=1 ; i<=n ; i++)
        a[i]=i;
    int assist;
    for (int i=1 ; i<=n ; i++)
    {
        if (c[i]<=i)
            continue;
        for (int j=1 ; j<=n ; j++)
            if (a[j]==c[i])
                assist=j;
        while (a[i]!=c[i])
        {
            pos[ {a[assist],a[assist-1]}]=true;
            res.push_back({a[assist],a[assist-1]});
            swap(a[assist],a[assist-1]);
            assist--;
        }
    }
    for (int i=1 ; i<n ; i++)
        if (!pos[ {a[i],a[i+1]}] && !pos[ {a[i+1],a[i]}])
        {
            res.push_back({a[i+1],a[i]});
            res.push_back({a[i],a[i+1]});
        }
    cout << res.size() << "\n";
    for (auto u : res)
        cout << u.first << " " << u.second << "\n";
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)


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

using namespace std;

#define ll long long 

const ll int INF = 0xFFFFFFFFFFFFFFFLL;



int main() {

    int t = 1;

    cin >> t;

    while(t--)

    {

        ll n;

        cin >> n;

        int sum = 0;

        int ct2 = 0;

        int ct3 = 0;

        while(n){

            sum += n%10;

            if(n%10 == 2) ct2++;

            if(n%10 == 3) ct3++;

            n/=10;

        }



        // cout << sum%9 << '\n';



        if(sum%9 == 0){

            cout << "Yes" << '\n';

        }else{

            int y = sum%9;

            bool ok = false;

            ll add = 0;

            while(ct2){

                // add += 2;

                y += 2;

                if((y)%9 == 0){

                    cout << "Yes" << '\n';

                    ok = true;

                    break;

                }

                // y += add;

                ct2--;

                // cout << add << '\n';

            }

            if(!ok){

                // add = 3;

                while(ct3){

                    // ll add = 3;

                    // add += 6;

                    y += 6;

                        if((y)%9 == 0){

                        cout << "Yes" << '\n';

                        ok = true;

                        break;

                    }

                    // y += add;

                    ct3--;

                    // cout << add << '\n';

                }

            }

            if(!ok){

                cout << "No" << '\n';

            }

        }

    }

}
Problem: 2050C - Uninteresting Number
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 

const ll int INF = 0xFFFFFFFFFFFFFFFLL;



int main() {

    int t = 1;

    cin >> t;

    while(t--)

    {

        string n;

        cin >> n;

        int sum = 0;

        int ct2 = 0;

        int ct3 = 0;

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

            sum += (n[i]-'0');

            if((n[i]-'0')%10 == 2) ct2++;

            if((n[i]-'0')%10 == 3) ct3++;

        }



        if(sum%9 == 0){

            cout << "Yes" << '\n';

        }else{

            int y = sum;

            bool ok = false;

            ll add = 0;

            while(ct2){

                // add += 2;

                y += 2;

                if((y)%9 == 0){

                    cout << "Yes" << '\n';

                    ok = true;

                    break;

                }

                // y += add;

                ct2--;

                // cout << add << '\n';

            }

            if(!ok){

                // add = 3;

                while(ct3){

                    // ll add = 3;

                    // add += 6;

                    y += 6;

                        if((y)%9 == 0){

                        cout << "Yes" << '\n';

                        ok = true;

                        break;

                    }

                    // y += add;

                    ct3--;

                    // cout << add << '\n';

                }

            }

            if(!ok){

                cout << "No" << '\n';

            }

        }

    }

}



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

using namespace std;

#define ll long long 

const ll int INF = 0xFFFFFFFFFFFFFFFLL;



int main() {

    int t = 1;

    cin >> t;

    while(t--)

    {

        string n;

        cin >> n;

        ll sum = 0;

        ll ct2 = 0;

        ll ct3 = 0;

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

            if(n[i] == '2') ct2++;

            if(n[i] == '3') ct3++;

            sum += (n[i]-'0');

        }



        ll toCover = (9 - (sum%9));

        string ans = "No";

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

            ll newDiff = (toCover - 6LL * i)%9;



            if(newDiff < 0){

                newDiff += 9;

            }



            ll a = (newDiff*5)%9;

            if(a <= ct2){

                // cout << "Yes" << '\n';

                ans = "Yes";

                break;

            }

        }

        cout << ans << '\n';

    }

}
Problem: 2063C - Remove Exactly Two
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>

using namespace std;

static inline void boost_io() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

typedef long long int64;

class Solution {
    int n;

    vector<vector<int>> graph;
    set<pair<int, int>> edges;
    

public:
    Solution(int n) : n(n) {
        graph.resize(n + 1);
    }

    void addEdge(int u, int v) {
        graph[u].push_back(v);
        graph[v].push_back(u);

        edges.insert({u, v});
        edges.insert({v, u});
    }

    int solve() {
        int v = 1;

        for (int u = 2; u <= n; ++u) {
            if (graph[u].size() > graph[v].size()) {
                v = u;
            }
        }

        int ans = 0;

        for (int u = 1; u <= n; ++u) {
            if (u == v) {
                continue;
            }

            if (edges.count({u, v})) {
                ans = max(ans, (int)(graph[u].size() + graph[v].size() - 2));
            } else {
                ans = max(ans, (int)(graph[u].size() + graph[v].size() - 1));
            }
        }

        return ans;
    }
};

int main() {
    boost_io();

    int T;
    cin >> T;

    while (T--) {
        int n;
        cin >> n;

        Solution s(n);

        for (int i = 2; i <= n; ++i) {
            int u, v;
            cin >> u >> v;
            s.addEdge(u, v);
        }

        cout << s.solve() << endl;
    }

    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++23 (GCC 14-64, msys2)

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

using namespace std;
#define ll long long
#define rep(i, m, n) for (ll i = m; i <= n; i++)
#define reb(i, m, n) for (ll i = m; i >= n; i--)
#define rv(i, vt) for (auto i : vt)
#define pb push_back
#define ii pair<ll, ll>
#define F first
#define S second
#define task "task"

//Consts
const ll N = 3e5 + 5, mod = 1e9 + 7;

//Global variables
ll n, a[N], pos[N];

//Preparations
void PrepBeforeTest()
{

}

void AfterTestReset()
{
    
}

//Functions

//Main
void solve()
{
    cin >> n;
    rep(i, 1, n) cin >> a[i], pos[a[i]] = i;
    ll res = 0;
    rep(i, 1, n)
    rep(j, i + 1, n) if (pos[i] < pos[j]) res += 2;
    else res++;
    cout << res << "\n";
    rep(i, 1, n)
    rep(j, i + 1, n) if (pos[i] < pos[j]) cout << i << " " << j << "\n" << j << " " << i << "\n";
    else cout << j << " " << i << "\n";
}

//Finalize
int main()
{
    if (fopen(task".inp", "r"))
    {
        freopen(task".inp", "r", stdin);
        freopen(task".out", "w", stdout);
    }
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll tests = 1;
    //cin >> tests;
    PrepBeforeTest();
    while (tests--)
    {
        solve();
        cout << endl;
        AfterTestReset();
    }
}


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

using namespace std;
#define ll long long
#define rep(i, m, n) for (ll i = m; i <= n; i++)
#define reb(i, m, n) for (ll i = m; i >= n; i--)
#define rv(i, vt) for (auto i : vt)
#define pb push_back
#define ii pair<ll, ll>
#define F first
#define S second
#define task "task"

//Consts
const ll N = 3e5 + 5, mod = 1e9 + 7;

//Global variables
ll n, a[N], pos[N];

//Preparations
void PrepBeforeTest()
{

}

void AfterTestReset()
{
    
}

//Functions

//Main
void solve()
{
    cin >> n;
    rep(i, 1, n) cin >> a[i], pos[a[i]] = i;
    ll res = 0;
    rep(i, 1, n)
    rep(j, i + 1, n) if (pos[i] < pos[j]) res += 2;
    else res++;
    cout << res << "\n";
    rep(i, 1, n)
    rep(j, i + 1, n) if (pos[i] < pos[j]) cout << j << " " << i << "\n" << i << " " << j << "\n";
    else cout << j << " " << i << "\n";
}

//Finalize
int main()
{
    if (fopen(task".inp", "r"))
    {
        freopen(task".inp", "r", stdin);
        freopen(task".out", "w", stdout);
    }
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll tests = 1;
    //cin >> tests;
    PrepBeforeTest();
    while (tests--)
    {
        solve();
        cout << endl;
        AfterTestReset();
    }
}
Problem: 2052A - Adrenaline Rush
Language: C++23 (GCC 14-64, msys2)

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

using namespace std;
#define ll long long
#define rep(i, m, n) for (ll i = m; i <= n; i++)
#define reb(i, m, n) for (ll i = m; i >= n; i--)
#define rv(i, vt) for (auto i : vt)
#define pb push_back
#define ii pair<ll, ll>
#define F first
#define S second
#define task "task"

//Consts
const ll N = 3e5 + 5, mod = 1e9 + 7;

//Global variables
ll n, a[N], pos[N];

//Preparations
void PrepBeforeTest()
{

}

void AfterTestReset()
{
    
}

//Functions

//Main
void solve()
{
    cin >> n;
    rep(i, 1, n) cin >> a[i], pos[a[i]] = i;
    ll res = 0;
    rep(i, 1, n)
    rep(j, i + 1, n) if (pos[i] < pos[j]) res += 2;
    else res++;
    cout << res << "\n";
    rep(i, 1, n)
    rep(j, i + 1, n) cout << j << " " << i << "\n";
    reb(i, n, 1)
    rep(j, i + 1, n) if (pos[i] < pos[j]) cout << i << " " << j << "\n";
}

//Finalize
int main()
{
    if (fopen(task".inp", "r"))
    {
        freopen(task".inp", "r", stdin);
        freopen(task".out", "w", stdout);
    }
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll tests = 1;
    //cin >> tests;
    PrepBeforeTest();
    while (tests--)
    {
        solve();
        cout << endl;
        AfterTestReset();
    }
}


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

using namespace std;
#define ll long long
#define rep(i, m, n) for (ll i = m; i <= n; i++)
#define reb(i, m, n) for (ll i = m; i >= n; i--)
#define rv(i, vt) for (auto i : vt)
#define pb push_back
#define ii pair<ll, ll>
#define F first
#define S second
#define task "task"

//Consts
const ll N = 3e5 + 5, mod = 1e9 + 7;

//Global variables
ll n, a[N], pos[N], b[N];

//Preparations
void PrepBeforeTest()
{

}

void AfterTestReset()
{
    
}

//Functions

//Main
void solve()
{
    cin >> n;
    rep(i, 1, n) cin >> a[i], pos[a[i]] = i;
    ll res = 0;
    rep(i, 1, n)
    rep(j, i + 1, n) if (pos[i] < pos[j]) res += 2;
    else res++;
    cout << res << "\n";
    rep(i, 1, n)
    rep(j, i + 1, n) cout << j << " " << i << "\n";
    rep(i, 1, n) b[i] = n - i + 1;
    rep(i, 1, n)
    {
        ll id = i;
        while (id > 1)
        {
            if (pos[b[id]] < pos[b[id - 1]])
            {
                cout << b[id] << " " << b[id - 1] << "\n";
                swap(b[id], b[id - 1]);
            }
            else break;
            id--;
        }
    }
}

//Finalize
int main()
{
    if (fopen(task".inp", "r"))
    {
        freopen(task".inp", "r", stdin);
        freopen(task".out", "w", stdout);
    }
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll tests = 1;
    //cin >> tests;
    PrepBeforeTest();
    while (tests--)
    {
        solve();
        cout << endl;
        AfterTestReset();
    }
}
Problem: 2052A - Adrenaline Rush
Language: C++23 (GCC 14-64, msys2)


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

using namespace std;
#define ll long long
#define rep(i, m, n) for (ll i = m; i <= n; i++)
#define reb(i, m, n) for (ll i = m; i >= n; i--)
#define rv(i, vt) for (auto i : vt)
#define pb push_back
#define ii pair<ll, ll>
#define F first
#define S second
#define task "task"

//Consts
const ll N = 3e5 + 5, mod = 1e9 + 7;

//Global variables
ll n, a[N], pos[N];

//Preparations
void PrepBeforeTest()
{

}

void AfterTestReset()
{
    
}

//Functions

//Main
void solve()
{
    cin >> n;
    rep(i, 1, n) cin >> a[i], pos[a[i]] = i;
    ll res = 0;
    rep(i, 1, n)
    rep(j, i + 1, n) if (pos[i] < pos[j]) res += 2;
    else res++;
    cout << res << "\n";
    rep(i, 1, n)
    rep(j, i + 1, n) if (pos[i] < pos[j]) cout << i << " " << j << "\n" << j << " " << i << "\n";
    else cout << j << " " << i << "\n";
}

//Finalize
int main()
{
    if (fopen(task".inp", "r"))
    {
        freopen(task".inp", "r", stdin);
        freopen(task".out", "w", stdout);
    }
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll tests = 1;
    //cin >> tests;
    PrepBeforeTest();
    while (tests--)
    {
        solve();
        cout << endl;
        AfterTestReset();
    }
}