ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2061D - Kevin and Numbers
Language: C++17 (GCC 7-32)


Submission (verdict: Time limit exceeded on test 9):
#include <iostream>
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
using namespace std;
#define int long long


void solve(){
    int n, m;
    cin >> n >> m;
    vector<int> a(n), b(m);
    
    for(int i = 0; i<n; i++) cin >> a[i];
    for(int i = 0; i<m; i++) cin >> b[i];

    map<int, int> freqa, freqb;
    set<int> seta, setb;

    for(auto ele: a){
        freqa[ele]++;
        seta.insert(ele);
    }

    for(auto ele: b){
        freqb[ele]++;
        setb.insert(ele);
    }

    while(true){
        if(seta.empty() && setb.empty()){
            cout << "YES" << endl;
            return;
        }

        if(seta.empty() || setb.empty()){
            cout << "NO" << endl;
            return;
        }

        int max1, max2;
        for(auto ele: seta){
            max1 = ele;
        }
        
        for(auto ele: setb){
            max2 = ele;
        }

        if(max1 > max2){
            cout << "NO" << endl;
            return;
        }

        if(freqa[max2]){
            int minfreq = min(freqa[max2], freqb[max2]);
            freqa[max2] = freqa[max2] - minfreq;
            freqb[max2] = freqb[max2] - minfreq;

            if(freqa[max2] == 0) seta.erase(max2);
            if(freqb[max2] == 0) setb.erase(max2);
        }

        else{
            int cl = (max2 + 1)/2;
            int fl = max2/2;
            freqb[cl] = freqb[cl] + freqb[max2];
            freqb[fl] = freqb[fl] + freqb[max2];
            freqb[max2] = 0;
            setb.insert(cl);
            setb.insert(fl);
            setb.erase(max2);
        }
    }
}


signed main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int t;
    cin >> t;
    while(t--){
        solve();
    }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
using namespace std;
#define int long long


void solve(){
    int n, l, r;
    cin >> n >> l >> r;
    vector<int> arr(n);
    for(int i = 0; i<n; i++){
        cin >> arr[i];
    }

    int sum1 = 0;
    for(int i = l-1; i<r; i++){
        sum1 = sum1 + arr[i];
    }

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

    vector<int> idk(arr.begin(), arr.begin() + r);
    reverse(idk.begin(), idk.end());
    int sum2 = 0;
    for(int i = l-1; i<r; i++){
        sum2 = sum2 + idk[i];
    }

    reverse(arr.begin(), arr.end());
    int sum3 = 0;
    for(int i = l-1; i<r; i++){
        sum3 = sum3 + arr[i];
    }
    cout << min(sum1, min(sum2,sum3)) << endl;

}




signed main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int t;
    cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

Submission (verdict: Accepted):
#include <iostream>
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
using namespace std;
#define int long long


void solve(){
    int n, l, r;
    cin >> n >> l >> r;
    vector<int> arr(n);
    for(int i = 0; i<n; i++){
        cin >> arr[i];
    }

    int sum1 = 0;
    for(int i = l-1; i<r; i++){
        sum1 = sum1 + arr[i];
    }

    vector<int> left;
    vector<int> right;

    for(int i = 0; i<r; i++){
        left.push_back(arr[i]);
    }

    for(int i = l-1; i<n; i++){
        right.push_back(arr[i]);
    }

    sort(left.begin(), left.end());
    sort(right.begin(), right.end());

    int ran = r - l + 1;
    int sum2 = 0, sum3 = 0;
    for(int i = 0; i<ran; i++){
        sum2 += left[i];
        sum3 += right[i];
    }

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

}




signed main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int t;
    cin >> t;
    while(t--){
        solve();
    }
    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include <iostream>

#include <bits/stdc++.h>

#pragma GCC optimize("O3,unroll-loops")

using namespace std;

#define int long long





void solve(){

    int n, l, r;

    cin >> n >> l >> r;

    vector<int> arr(n);

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

        cin >> arr[i];

    }



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

    reverse(arr.begin(), arr.begin() + r);

    int sum = 0;

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

        sum = sum + arr[i];

    }



    cout << sum << endl;



}









signed main(){

    std::ios::sync_with_stdio(false);

    std::cin.tie(nullptr);

    int t;

    cin >> t;

    while(t--){

        solve();

    }

    return 0;

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

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>

#include <bits/stdc++.h>

#pragma GCC optimize("O3,unroll-loops")

using namespace std;

#define int long long





void solve(){

    int n, l, r;

    cin >> n >> l >> r;

    vector<int> arr(n);

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

        cin >> arr[i];

    }



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

    reverse(arr.begin(), arr.begin() + r);

    int sum = 0;

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

        sum = sum + arr[i];

    }



    cout << sum << endl;



}









signed main(){

    std::ios::sync_with_stdio(false);

    std::cin.tie(nullptr);

    int t;

    cin >> t;

    while(t--){

        solve();

    }

    return 0;

}

Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
using namespace std;
#define int long long


void solve(){
    int n, l, r;
    cin >> n >> l >> r;
    vector<int> arr(n);
    for(int i = 0; i<n; i++){
        cin >> arr[i];
    }

    int sum1 = 0;
    for(int i = l-1; i<r; i++){
        sum1 = sum1 + arr[i];
    }

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

    vector<int> idk(arr.begin(), arr.begin() + r);
    reverse(idk.begin(), idk.end());
    int sum2 = 0;
    for(int i = l-1; i<r; i++){
        sum2 = sum2 + idk[i];
    }

    reverse(arr.begin(), arr.end());
    int sum3 = 0;
    for(int i = l-1; i<r; i++){
        sum3 = sum3 + arr[i];
    }
    cout << min(sum1, min(sum2,sum3)) << endl;

}




signed main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int t;
    cin >> t;
    while(t--){
        solve();
    }
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)


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

void solve(){
    int l,r;
    cin>>l>>r;
    int t=1<<(int)log2(l^r);
    cout<<t<<" "<<t-1<<" "<<l<<endl;
    // 965321865 375544086 12551794
    // int a=965321865,b=375544086,c=12551794;
    // cout<<(a^b)+(a^c)+(b^c)<<endl;
    // 536870912 536870911 0
    // a=536870912,b=536870911,c=0;
    // cout<<(a^b)+(a^c)+(b^c)<<endl;
}
signed main(){
    // freopen("./data.in","r",stdin);
    int test=1;
    cin>>test;
    while(test--){
        solve();
    }
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

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

void solve(){
    int l,r;
    cin>>l>>r;
    int t=1<<(int)log2(l^r);
    if(t!=r)cout<<t<<" "<<t-1<<" "<<r<<endl;
    else cout<<t<<" "<<t-1<<" "<<l<<endl;    
}
signed main(){
    // freopen("./data.in","r",stdin);
    int test=1;
    cin>>test;
    while(test--){
        solve();
    }
}

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

void solve(){
    int l,r;
    cin>>l>>r;
    int t=1<<(int)log2(l^r);
    int tt=~((t<<1)-1);
    t+=tt&l;
    if(t!=r)cout<<t<<" "<<t-1<<" "<<r<<endl;
    else cout<<t<<" "<<t-1<<" "<<l<<endl;    
}
signed main(){
    //freopen("./data.in","r",stdin);
    int test=1;
    cin>>test;
    while(test--){
        solve();
    }
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

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

void solve(){
    int l,r;
    cin>>l>>r;
    int t=1<<(int)log2(l^r);
    cout<<t<<" "<<t-1<<" "<<l<<endl;
    // 965321865 375544086 12551794
    // int a=965321865,b=375544086,c=12551794;
    // cout<<(a^b)+(a^c)+(b^c)<<endl;
    // 536870912 536870911 0
    // a=536870912,b=536870911,c=0;
    // cout<<(a^b)+(a^c)+(b^c)<<endl;
}
signed main(){
    // freopen("./data.in","r",stdin);
    int test=1;
    cin>>test;
    while(test--){
        solve();
    }
}

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

void solve(){
    int l,r;
    cin>>l>>r;
    int t=1<<(int)log2(l^r);
    if(t!=r)cout<<t<<" "<<t-1<<" "<<r<<endl;
    else cout<<t<<" "<<t-1<<" "<<l<<endl;    
}
signed main(){
    // freopen("./data.in","r",stdin);
    int test=1;
    cin>>test;
    while(test--){
        solve();
    }
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 7):
#include<bits/stdc++.h> 
using namespace std; 
# define ll long long 
void print(vector<pair<int,int>> & v){
    cout << v.size() << endl; 
    for(auto p : v){
        cout << p.first <<" "<<p.second << endl; 
    }
}

int main(){
    int n; 
    cin >> n; 
    vector<int> v(n); 
    for(int i=0; i<n; i++){
        cin >> v[i]; 
    }
    
    if(n==1){
        cout << 0 << endl; 
        return 0; 
    }
    vector<int> vis(n+1 , 0);
    vector<pair<int,int>> pr; 
    for(auto curr : v){
        vis[curr] = 1; 
        for(int i=curr-1; i>0; i--){
            if(!vis[i]){
                pr.push_back({curr , i}); 
            }
        }
    }
    
    vector<int> seq; 
    seq.push_back(v[0]); 
    for(int ii=1; ii<n; ii++){
        if(v[ii] > seq[seq.size()-1]) seq.push_back(v[ii]); 
        else{
            int t = seq.size(); 
            for(int i=t-1; i>0; i--){
                for(int j=i-1; j>=0; j--) pr.push_back({v[i] , v[j]}); 
                for(int j=0; j<i; j++) pr.push_back({v[j], v[i]}); 
            }
            
            seq.erase(seq.begin(), seq.end()); 
            seq.push_back(v[ii]); 
        }
    }
    if(seq.size()>1){
        int t = seq.size(); 
            for(int i=t-1; i>0; i--){
                for(int j=i-1; j>=0; j--) pr.push_back({v[i] , v[j]}); 
                for(int j=0; j<i; j++) pr.push_back({v[j], v[i]}); 
            }
    }
    print(pr);
    return 0; 
}

Submission (verdict: Accepted):
#include<bits/stdc++.h> 
using namespace std; 
# define ll long long 
void print(vector<pair<int,int>> & v){
    cout << v.size() << endl; 
    for(auto p : v){
        cout << p.first <<" "<<p.second << endl; 
    }
}

int main(){
    int n; 
    cin >> n; 
    vector<int> v(n); 
    for(int i=0; i<n; i++){
        cin >> v[i]; 
    }
    
    if(n==1){
        cout << 0 << endl; 
        return 0; 
    }
    
    // let all overtake, so that pura reverse ho jaye, 
    // then do un overtakes, so that you reach req config. 
    
    vector<pair<int,int>> pr; 
    for(int i=n; i>0; i--){
        for(int j=i-1; j>0; j--){
            pr.push_back({i, j}); 
        }
    }// abhi its ulta. 
    
    vector<int> a(n); 
    for(int i=0; i<n; i++){
        a[i] = n-i; 
    }
    
    for(int i=0; i<n; i++){
        int curr = v[i]; 
        int idx; 
        for(int t=0; t<n; t++){
            if(a[t]==curr){
                idx = t; 
                break; 
            }
        }
        
        for(int j=idx; j>i; j--){
            pr.push_back({a[j], a[j-1]}); 
            swap(a[j], a[j-1]); 
        }
    }
    print(pr);
    
    return 0; 
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 4):
#include<bits/stdc++.h> 
using namespace std; 
# define ll long long 
void print(vector<pair<int,int>> & v){
    cout << v.size() << endl; 
    for(auto p : v){
        cout << p.first <<" "<<p.second << endl; 
    }
}

int main(){
    int n; 
    cin >> n; 
    vector<int> v(n); 
    for(int i=0; i<n; i++){
        cin >> v[i]; 
    }
    
    if(n==1){
        cout << 0 << endl; 
        return 0; 
    }
    vector<int> vis(n+1 , 0);
    vector<pair<int,int>> pr; 
    for(auto curr : v){
        vis[curr] = 1; 
        for(int i=curr-1; i>0; i--){
            if(!vis[i]){
                pr.push_back({curr , i}); 
            }
        }
    }
    
    for(int i=0; i<n-1; i++){
        int c1 = v[i]; 
        int c2 = v[i+1]; 
        if(c2 > c1){
            pr.push_back({c2,c1}); 
            pr.push_back({c1,c2});
        }
    }
    print(pr);
    return 0; 
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 4):
#include<bits/stdc++.h> 
using namespace std; 
# define ll long long 
void print(vector<pair<int,int>> & v){
    cout << v.size() << endl; 
    for(auto p : v){
        cout << p.first <<" "<<p.second << endl; 
    }
}

int main(){
    int n; 
    cin >> n; 
    vector<int> v(n); 
    for(int i=0; i<n; i++){
        cin >> v[i]; 
    }
    
    if(n==1){
        cout << 0 << endl; 
        return 0; 
    }
    vector<int> vis(n+1 , 0);
    vector<pair<int,int>> pr; 
    for(auto curr : v){
        vis[curr] = 1; 
        for(int i=curr-1; i>0; i--){
            if(!vis[i]){
                pr.push_back({curr , i}); 
            }
        }
    }
    
    for(int i=0; i<n-1; i++){
        int c1 = v[i]; 
        int c2 = v[i+1]; 
        if(c2 > c1){
            pr.push_back({c2,c1}); 
            pr.push_back({c1,c2});
        }
    }
    print(pr);
    return 0; 
}

Submission (verdict: Wrong answer on test 7):
#include<bits/stdc++.h> 
using namespace std; 
# define ll long long 
void print(vector<pair<int,int>> & v){
    cout << v.size() << endl; 
    for(auto p : v){
        cout << p.first <<" "<<p.second << endl; 
    }
}

int main(){
    int n; 
    cin >> n; 
    vector<int> v(n); 
    for(int i=0; i<n; i++){
        cin >> v[i]; 
    }
    
    if(n==1){
        cout << 0 << endl; 
        return 0; 
    }
    vector<int> vis(n+1 , 0);
    vector<pair<int,int>> pr; 
    for(auto curr : v){
        vis[curr] = 1; 
        for(int i=curr-1; i>0; i--){
            if(!vis[i]){
                pr.push_back({curr , i}); 
            }
        }
    }
    
    vector<int> seq; 
    seq.push_back(v[0]); 
    for(int ii=1; ii<n; ii++){
        if(v[ii] > seq[seq.size()-1]) seq.push_back(v[ii]); 
        else{
            int t = seq.size(); 
            for(int i=t-1; i>0; i--){
                for(int j=i-1; j>=0; j--) pr.push_back({v[i] , v[j]}); 
                for(int j=0; j<i; j++) pr.push_back({v[j], v[i]}); 
            }
            
            seq.erase(seq.begin(), seq.end()); 
            seq.push_back(v[ii]); 
        }
    }
    if(seq.size()>1){
        int t = seq.size(); 
            for(int i=t-1; i>0; i--){
                for(int j=i-1; j>=0; j--) pr.push_back({v[i] , v[j]}); 
                for(int j=0; j<i; j++) pr.push_back({v[j], v[i]}); 
            }
    }
    print(pr);
    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 int long long
#define ld long double
#define mset multiset
#define umap unordered_map
#define PII pair<int, int>
#define fi first
#define se second
#define lc u << 1
#define rc u << 1 | 1
#define lowbit(x) (x & (-x))
#define PI acos(-1)
#define ll long long
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
const int mod = 998244353;
const int INF = 1e18;
const int N = 1e5 + 10;
//==================================================================================
void solve()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n), b(m);
    for (auto &x : a)
        cin >> x;
    for (auto &x : b)
        cin >> x;
    multiset<int> sa, sb;
    for (auto x : a)
        sa.insert(x);
    for (auto x : b)
        sb.insert(x);
    while (sa.size() != sb.size())
    {
        if (*sa.begin() == *sb.begin())
        {
            sa.erase(sa.begin());
            sb.erase(sb.begin());
        }
        if (*sa.begin() > *sb.begin())
            break;
        if (*sa.begin() < *sb.begin())
        {
            int a1 = *sa.begin();
            sa.erase(sa.begin());
            int a2 = *sa.begin();
            sa.erase(sa.begin());
            if (a2 - a1 > 2)
                break;
            else
            {
                sa.insert(a1 + a2);
            }
        }
    }
    if (sa != sb)
        return cout << "NO" << '\n', void();
    return cout << "YES" << "\n", void();
}
//==================================================================================
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // freopen("test.in", "r", stdin);
    // freopen("test.out", "w", stdout);
    int T_T = 1;
    cin >> T_T;
    while (T_T--)
        solve();
    return 0;
}
Problem: 2063C - Remove Exactly Two
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 ld long double
#define mset multiset
#define umap unordered_map
#define PII pair<int, int>
#define fi first
#define se second
#define lc u << 1
#define rc u << 1 | 1
#define lowbit(x) (x & (-x))
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
const int mod = 998244353;
const int INF = 1e18;
const int N = 2e5 + 10;
//==================================================================================
void solve()
{
    int n;
    cin >> n;
    int ans = 0;
    vector<int> in(n + 1);
    vector<vector<int>> g(n + 1, vector<int>());
    for (int i = 1; i < n; i++)
    {
        int u, v;
        cin >> u >> v;
        in[u]++;
        in[v]++;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    multiset<int> mstt;
    for (int i = 1; i <= n; i++)
    {
        mstt.insert(in[i]);
    }
    for (int u = 1; u <= n; u++)
    {
        int sum = 1;
        auto mst = mstt;
        mst.erase(mst.find(in[u]));
        for (auto v : g[u])
        {
            mst.erase(in[v]);
            mst.insert(in[v] - 1);
        }
        sum += in[u] - 1;
        sum += *mst.rbegin() - 1;
        ans = max(ans, sum);
    }
    cout << ans << '\n';
}
//==================================================================================
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // freopen("test.in", "r", stdin);
    // freopen("test.out", "w", stdout);
    int T_T = 1;
    cin >> T_T;
    while (T_T--)
        solve();
    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 4):
#include<bits/stdc++.h>
using namespace std;
const int N=2300;
int n,a[N],ans;
struct fa{
	int x,y;
}as[N];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if(a[i]>a[j])as[++ans]={a[i],a[j]};
			else {
				as[++ans]={a[j],a[i]};
				as[++ans]={a[i],a[j]};
			}
		}
	}
	cout<<ans<<endl;
	for(int i=1;i<=ans;i++){
		cout<<as[i].x<<' '<<as[i].y<<endl;
	}
	return 0;
}

Submission (verdict: Wrong answer on test 4):
#include<bits/stdc++.h>
using namespace std;
const int N=23000;
int n,a[N],ans;
struct fa{
	int x,y;
}as[N];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if(a[i]>a[j])as[++ans]={a[i],a[j]};
			else {
				as[++ans]={a[j],a[i]};
				as[++ans]={a[i],a[j]};
			}
		}
	}
	cout<<ans<<endl;
	for(int i=1;i<=ans;i++){
		cout<<as[i].x<<' '<<as[i].y<<endl;
	}
	return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 42):
#include<bits/stdc++.h>
using namespace std;
const int N=230000;
int n,a[N],ans,vis[N];
struct fa{
	int x,y;
}as[N*2];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		vis[a[i]]=1;
		for(int j=a[i]+1;j<=n;j++)if(!vis[j])as[++ans]={j,a[i]};
		for(int j=n;j>=1;j--)if(!vis[j])as[++ans]={a[i],j};
//		for(int j=a[i]-1;j>=1;j--)if(!vis[j])as[++ans]={a[i],j};
	}
//	sort(as+1,as+ans+1);
	cout<<ans<<endl;
	for(int i=1;i<=ans;i++){
		cout<<as[i].x<<' '<<as[i].y<<endl;
	}
	return 0;
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
const int N=230000;
int n,a[N],ans,vis[N];
struct fa{
	int x,y;
}as[N*20];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		vis[a[i]]=1;
		for(int j=a[i]+1;j<=n;j++)if(!vis[j])as[++ans]={j,a[i]};
		for(int j=n;j>=1;j--)if(!vis[j])as[++ans]={a[i],j};
//		for(int j=a[i]-1;j>=1;j--)if(!vis[j])as[++ans]={a[i],j};
	}
	cout<<ans<<endl;
	for(int i=1;i<=ans;i++){
		cout<<as[i].x<<' '<<as[i].y<<endl;
	}
	return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 37):
#include<bits/stdc++.h>
using namespace std;
const int N=23000;
int n,a[N],ans,vis[N];
struct fa{
	int x,y;
}as[N];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		vis[a[i]]=1;
		for(int j=a[i]+1;j<=n;j++)if(!vis[j])as[++ans]={j,a[i]};
		for(int j=n;j>a[i];j--)if(!vis[j])as[++ans]={a[i],j};
		for(int j=a[i]-1;j>=1;j--)if(!vis[j])as[++ans]={a[i],j};
	}
//	sort(as+1,as+ans+1);
	cout<<ans<<endl;
	for(int i=1;i<=ans;i++){
		cout<<as[i].x<<' '<<as[i].y<<endl;
	}
	return 0;
}

Submission (verdict: Wrong answer on test 42):
#include<bits/stdc++.h>
using namespace std;
const int N=230000;
int n,a[N],ans,vis[N];
struct fa{
	int x,y;
}as[N*2];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		vis[a[i]]=1;
		for(int j=a[i]+1;j<=n;j++)if(!vis[j])as[++ans]={j,a[i]};
		for(int j=n;j>=1;j--)if(!vis[j])as[++ans]={a[i],j};
//		for(int j=a[i]-1;j>=1;j--)if(!vis[j])as[++ans]={a[i],j};
	}
//	sort(as+1,as+ans+1);
	cout<<ans<<endl;
	for(int i=1;i<=ans;i++){
		cout<<as[i].x<<' '<<as[i].y<<endl;
	}
	return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 4):
#include<bits/stdc++.h>
using namespace std;
const int N=2300;
int n,a[N],ans;
struct fa{
	int x,y;
}as[N];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if(a[i]>a[j])as[++ans]={a[i],a[j]};
			else {
				as[++ans]={a[j],a[i]};
				as[++ans]={a[i],a[j]};
			}
		}
	}
	cout<<ans<<endl;
	for(int i=1;i<=ans;i++){
		cout<<as[i].x<<' '<<as[i].y<<endl;
	}
	return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 4):
#include<bits/stdc++.h>
using namespace std;
const int N=23000;
int n,a[N],ans;
struct fa{
	int x,y;
}as[N];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if(a[i]>a[j])as[++ans]={a[i],a[j]};
			else {
				as[++ans]={a[j],a[i]};
				as[++ans]={a[i],a[j]};
			}
		}
	}
	cout<<ans<<endl;
	for(int i=1;i<=ans;i++){
		cout<<as[i].x<<' '<<as[i].y<<endl;
	}
	return 0;
}

Submission (verdict: Wrong answer on test 37):
#include<bits/stdc++.h>
using namespace std;
const int N=23000;
int n,a[N],ans,vis[N];
struct fa{
	int x,y;
}as[N];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		vis[a[i]]=1;
		for(int j=a[i]+1;j<=n;j++)if(!vis[j])as[++ans]={j,a[i]};
		for(int j=n;j>a[i];j--)if(!vis[j])as[++ans]={a[i],j};
		for(int j=a[i]-1;j>=1;j--)if(!vis[j])as[++ans]={a[i],j};
	}
//	sort(as+1,as+ans+1);
	cout<<ans<<endl;
	for(int i=1;i<=ans;i++){
		cout<<as[i].x<<' '<<as[i].y<<endl;
	}
	return 0;
}