ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2049C - MEX Cycle
Language: C++20 (GCC 13-64)

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



using namespace std;



#define ll long long

#define vi vector<int>

#define pii pair<int,int>

#define vpii vector<pair<int,int>>

#define pb push_back

#define f first

#define s second



const ll MOD = 1e9+7;



ll gcd(ll a, ll b) {

    if (a == 0) return b;

    return gcd(b % a, a);

}





ll pow(ll x, ll n) {

    if (n == 0) return 1;

    if (n % 2 == 0) return pow((x * x) % MOD, n / 2);

    return (x * pow((x * x) % MOD, (n - 1) / 2) % MOD);

}



void solve() {

    int n,x,y;

    cin>>n>>x>>y;

    

    if(x == y -1 || (x==1 && y==n)) {

        int dem = 2 + n%2;

        for(int i=0; i<n; i++) cout<<(i%dem)<<" ";

        cout<<"\n";

        return;

    }

    // x --> y ==> (y-x-1)

    // both side even => 0 - 1 => 1 0 1 0

    // else => odd side => 1 0 1 1 0 10 0

    int p[n+1]={0};

    int curr = 1;

    p[x]=0;

    p[y]=1;

    for(int i=x+1; i<=n; i++) p[i] = p[i-1]^1;

    p[0]=p[n];

    for(int i=1; i<x; i++) p[i] = p[i-1]^1;

    p[y]=2;

    

    if((y-x -1 )%2 == 0 && (n-y+x-1)%2 == 0) p[y]=1;

    for(int i=1; i<=n; i++) cout<<p[i]<<" ";

    cout<<"\n";

}



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    

    int t=1;

    cin>>t;



    for(int i=01;i<=t;i++) {

        // cout<<"Case #"<<i<<"\n";

        solve();

    }



    return 0;

}

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



using namespace std;



#define ll long long

#define vi vector<int>

#define pii pair<int,int>

#define vpii vector<pair<int,int>>

#define pb push_back

#define f first

#define s second



const ll MOD = 1e9+7;



ll gcd(ll a, ll b) {

    if (a == 0) return b;

    return gcd(b % a, a);

}





ll pow(ll x, ll n) {

    if (n == 0) return 1;

    if (n % 2 == 0) return pow((x * x) % MOD, n / 2);

    return (x * pow((x * x) % MOD, (n - 1) / 2) % MOD);

}



void solve() {

    int n,x,y;

    cin>>n>>x>>y;

    

    if(x == y -1 || (x==1 && y==n)) {

        int dem = 2 + n%2;

        for(int i=0; i<n; i++) cout<<(i%dem)<<" ";

        cout<<"\n";

        return;

    }

    // x --> y ==> (y-x-1)

    // both side even => 0 - 1 => 1 0 1 0

    // else => odd side => 1 0 1 1 0 10 0

    int p[n+2]={0};

    int curr = 1;

    p[x]=0;

    p[y]=2;

    for(int i=x+1; i<y; i++) p[i] = p[i-1]^1; // x+1 ->y

    for(int i=x-1; i>=1; i--) p[i] = p[i+1]^1; // 1 -> x-1

    for(int i=n; i>y; i--) p[i] = p[(i+1)%n ==0 ? n : (i+1)%n]^1;// y+1 -> n

    

    if((y-x -1 )%2 == 0 && (n-y+x-1)%2 == 0) p[y]=1;

    for(int i=1; i<=n; i++) cout<<p[i]<<" ";

    cout<<"\n";

}



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    

    int t=1;

    cin>>t;



    for(int i=01;i<=t;i++) {

        // cout<<"Case #"<<i<<"\n";

        solve();

    }



    return 0;

}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

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



using namespace std;



#define ll long long

#define vi vector < int >

#define pii pair < int, int >

#define vpii vector < pair < int, int >>

#define pb push_back

#define f first

#define s second



const ll MOD = 1e9 + 7;

const int N = 200005;



void solve() {

    string str; cin>>str;

    int n=str.length();

    int sum =0, cnt2=0, cnt3=0,i=0;

    while(i<n) {

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

        if((str[i]-'0') == 2) cnt2++;

        if((str[i]-'0') == 3) cnt3++;

        i++;

    }

    int ans = 0, mod =sum%9;

    if(mod == 0 ) ans = 1;

    else if(mod ==1 && (cnt2>=4 || (cnt2&&cnt3))) ans =1;

    else if(mod ==3 && (cnt2>=3 || cnt3)) ans = 1;

    else if(mod ==5 && (cnt2 >=2)) ans = 1;

    else if(mod ==7 && (cnt2)) ans = 1;

    else if(mod ==2 && (cnt2>=8 || (cnt2>=5&&cnt3) || (cnt2>=2&&cnt3>=3))) ans =1;

    else if(mod ==4 && (cnt2>=7 || (cnt2>=4&&cnt3) || (cnt2&&cnt3>=2))) ans =1;

    else if(mod ==6 && (cnt2>=6 || (cnt3>=2) || (cnt2>=3&&cnt3>=1))) ans =1;

    else if(mod ==8 && (cnt2>=5 || (cnt2>=2&&cnt3))) ans =1;

    if(ans == 1) cout<<"YES\n";

    else cout<<"NO\n";

}



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    

    int t = 1; cin >> t;

    while (t--) solve();

    

    return 0;

}

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



using namespace std;



#define ll long long

#define vi vector < int >

#define pii pair < int, int >

#define vpii vector < pair < int, int >>

#define pb push_back

#define f first

#define s second



const ll MOD = 1e9 + 7;

const int N = 200005;



void solve() {

    string str; cin>>str;

    int n=str.length();

    int sum =0, cnt2=0, cnt3=0,i=0;

    while(i<n) {

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

        if((str[i]-'0') == 2) cnt2++;

        if((str[i]-'0') == 3) cnt3++;

        i++;

    }

    int temp = sum%9;

    while(cnt2--) {

        if((temp + 2 )%6 == 0) { cout<<"YES\n"; return; }

        temp+=2;

    }

    temp = sum%9;

    while(cnt3--) {

        if((temp + 6 )%2 == 0) { cout<<"YES\n"; return; }

        temp+=6;

    }

    cout<<"NO\n";

}



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    

    int t = 1; cin >> t;

    while (t--) solve();

    

    return 0;

}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

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



using namespace std;



#define ll long long

#define vi vector < int >

#define pii pair < int, int >

#define vpii vector < pair < int, int >>

#define pb push_back

#define f first

#define s second



const ll MOD = 1e9 + 7;

const int N = 200005;



void solve() {

    string str; cin>>str;

    int n=str.length();

    int sum =0, cnt2=0, cnt3=0,i=0;

    while(i<n) {

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

        if((str[i]-'0') == 2) cnt2++;

        if((str[i]-'0') == 3) cnt3++;

        i++;

    }

    int temp = sum%9;

    while(cnt2--) {

        if((temp + 2 )%6 == 0) { cout<<"YES\n"; return; }

        temp+=2;

    }

    temp = sum%9;

    while(cnt3--) {

        if((temp + 6 )%2 == 0) { cout<<"YES\n"; return; }

        temp+=6;

    }

    cout<<"NO\n";

}



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    

    int t = 1; cin >> t;

    while (t--) solve();

    

    return 0;

}

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



using namespace std;



#define ll long long

#define vi vector < int >

#define pii pair < int, int >

#define vpii vector < pair < int, int >>

#define pb push_back

#define f first

#define s second



const ll MOD = 1e9 + 7;

const int N = 200005;



void solve() {

    string str; cin>>str;

    int n=str.length();

    int sum =0, cnt2=0, cnt3=0,i=0;

    while(i<n) {

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

        if((str[i]-'0') == 2) cnt2++;

        if((str[i]-'0') == 3) cnt3++;

        i++;

    }

    int temp = sum%9;

    for(i=0; i<=min(cnt2,8); i++) {

        if((temp %9) == 0|| (cnt3 && ((temp +6)%9 == 0)) || (cnt3>=2 && ((temp +3)%9 == 0)) ) { cout<<"YES\n"; return; }

        temp += 2; 

        temp %=9;

    }

    cout<<"NO\n";

}



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    

    int t = 1; cin >> t;

    while (t--) solve();

    

    return 0;

}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)


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



using namespace std;



#define ll long long

#define vi vector < int >

#define pii pair < int, int >

#define vpii vector < pair < int, int >>

#define pb push_back

#define f first

#define s second



const ll MOD = 1e9 + 7;

const int N = 200005;



void solve() {

    string str; cin>>str;

    int n=str.length();

    int sum =0, cnt2=0, cnt3=0,i=0;

    while(i<n) {

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

        if((str[i]-'0') == 2) cnt2++;

        if((str[i]-'0') == 3) cnt3++;

        i++;

    }

    int ans = 0, mod =sum%9;

    if(mod == 0 ) ans = 1;

    else if(mod ==1 && (cnt2>=4 || (cnt2&&cnt3))) ans =1;

    else if(mod ==3 && (cnt2>=3 || cnt3)) ans = 1;

    else if(mod ==5 && (cnt2 >=2)) ans = 1;

    else if(mod ==7 && (cnt2)) ans = 1;

    else if(mod ==2 && (cnt2>=8 || (cnt2>=5&&cnt3) || (cnt2>=2&&cnt3>=3))) ans =1;

    else if(mod ==4 && (cnt2>=7 || (cnt2>=4&&cnt3) || (cnt2&&cnt3>=2))) ans =1;

    else if(mod ==6 && (cnt2>=6 || (cnt3>=2) || (cnt2>=3&&cnt3>=1))) ans =1;

    else if(mod ==8 && (cnt2>=5 || (cnt2>=2&&cnt3))) ans =1;

    if(ans == 1) cout<<"YES\n";

    else cout<<"NO\n";

}



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    

    int t = 1; cin >> t;

    while (t--) solve();

    

    return 0;

}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
// Problem: C. Cirno and Operations
// Contest: Codeforces - Ethflow Round 1 (Codeforces Round 1001, Div. 1 + Div. 2)
// URL: https://codeforces.com/problemset/problem/2062/C
// Memory Limit: 512 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include<bits/stdc++.h>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		vector<int>v(n);
		for(int i=0;i<n;i++){
			cin>>v[i];
		}
		long long maxS=INT_MIN,maxs=0;
		int now=n;
		for(int i=0;i<n;i++){
			long long sum=0;
			for(int j=0;j<now;j++){
				sum+=v[j];
			}
			if(i==0){
				maxs=max(maxS,sum);
			}
			else{
				maxs=max(maxs,max(sum,(-sum)));
			}
			for(int j=0;j<now-1;j++){
				v[j]=v[j+1]-v[j];	
			}
			now--;
		}
		cout<<maxs<<endl;
	}
}

Submission (verdict: Accepted):
// Problem: C. Cirno and Operations
// Contest: Codeforces - Ethflow Round 1 (Codeforces Round 1001, Div. 1 + Div. 2)
// URL: https://codeforces.com/problemset/problem/2062/C
// Memory Limit: 512 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include<bits/stdc++.h>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		long long n;
		cin>>n;
		vector<long long>v(n);
		for(int i=0;i<n;i++){
			cin>>v[i];
		}
		long long maxS=INT_MIN;
		long long maxs=0;
		int now=n;
		for(int i=0;i<n;i++){
			long long sum=0;
			for(int j=0;j<now;j++){
				sum+=v[j];
			}
			if(i==0){
				maxs=max(maxS,sum);
			}
			else{
				maxs=max(maxs,max(sum,(-sum)));
			}
			for(int j=0;j<now-1;j++){
				v[j]=v[j+1]-v[j];	
			}
			now--;
		}
		cout<<maxs<<endl;
	}
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
// Problem: C. Cirno and Operations
// Contest: Codeforces - Ethflow Round 1 (Codeforces Round 1001, Div. 1 + Div. 2)
// URL: https://codeforces.com/problemset/problem/2062/C
// Memory Limit: 512 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include<bits/stdc++.h>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		vector<int>v(n);
		for(int i=0;i<n;i++){
			cin>>v[i];
		}
		long long maxS=INT_MIN,maxs=0;
		int now=n;
		for(int i=0;i<n;i++){
			long long sum=0;
			for(int j=0;j<now;j++){
				sum+=v[j];
			}
			if(i==0){
				maxs=max(maxS,sum);
			}
			else{
				maxs=max(maxs,max(sum,(-sum)));
			}
			for(int j=0;j<now;j++){
				v[j]=v[j+1]-v[j];	
			}
			now--;
		}
		cout<<maxs<<endl;
	}
}

Submission (verdict: Wrong answer on test 2):
// Problem: C. Cirno and Operations
// Contest: Codeforces - Ethflow Round 1 (Codeforces Round 1001, Div. 1 + Div. 2)
// URL: https://codeforces.com/problemset/problem/2062/C
// Memory Limit: 512 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include<bits/stdc++.h>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		vector<int>v(n);
		for(int i=0;i<n;i++){
			cin>>v[i];
		}
		long long maxS=INT_MIN,maxs=0;
		int now=n;
		for(int i=0;i<n;i++){
			long long sum=0;
			for(int j=0;j<now;j++){
				sum+=v[j];
			}
			if(i==0){
				maxs=max(maxS,sum);
			}
			else{
				maxs=max(maxs,max(sum,(-sum)));
			}
			for(int j=0;j<now-1;j++){
				v[j]=v[j+1]-v[j];	
			}
			now--;
		}
		cout<<maxs<<endl;
	}
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
// Problem: C. Cirno and Operations
// Contest: Codeforces - Ethflow Round 1 (Codeforces Round 1001, Div. 1 + Div. 2)
// URL: https://codeforces.com/problemset/problem/2062/C
// Memory Limit: 512 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include<bits/stdc++.h>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		vector<int>v(n);
		for(int i=0;i<n;i++){
			cin>>v[i];
		}
		long long maxS=INT_MIN,maxs=0;
		int now=n;
		for(int i=0;i<n;i++){
			long long sum=0;
			for(int j=0;j<now;j++){
				sum+=v[j];
			}
			if(i==0){
				maxs=max(maxS,sum);
			}
			else{
				maxs=max(maxs,max(sum,(-sum)));
			}
			for(int j=0;j<now;j++){
				v[j]=v[j+1]-v[j];	
			}
			now--;
		}
		cout<<maxs<<endl;
	}
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)


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

void solve(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    long long ans=INT64_MIN;
    long long sum=0;
    for(int i=0;i<n;i++) sum=(sum+(long long)(a[i]));
    ans=max(ans,sum);
    int curSize=n-1;
    for(int i=1;i<n;i++){
        // long long sum=0;
        // for(int i=0;i<curSize;i++) sum=(sum+(long long)(a[i]));
        // if(i==0)  ans=max(ans,sum);
        for(int i=0;i<curSize;i++) a[i]=(a[i+1]-a[i]);
        if(curSize==1) ans=max(ans,abs((long long)a[0]));
        else ans=max(ans,abs((long long)a[0]-(long long)a[curSize-1]));
        // else ans=max(ans,max(sum,(-sum)));
        curSize--;
        

    }
    cout<<ans<<endl;
}

int main(){
    int tc;
    cin>>tc;
    while(tc--){
        solve();
    }
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

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

void solve(){
    int n;
    cin>>n;
    vector<long long> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    long long ans=INT64_MIN;
    long long sum=0;
    for(int i=0;i<n;i++) sum=(sum+(a[i]));
    ans=max(ans,sum);
    int curSize=n-1;
    for(int i=1;i<n;i++){
        // long long sum=0;
        // for(int i=0;i<curSize;i++) sum=(sum+(long long)(a[i]));
        // if(i==0)  ans=max(ans,sum);
        for(int i=0;i<curSize;i++) a[i]=(a[i+1]-a[i]);
        if(curSize==1) ans=max(ans,abs(a[0]));
        else ans=max(ans,abs(a[0]-a[curSize-1]));
        // else ans=max(ans,max(sum,(-sum)));
        curSize--;
        

    }
    cout<<ans<<endl;
}

int main(){
    int tc;
    cin>>tc;
    while(tc--){
        solve();
    }
}

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

void solve(){
    int n;
    cin>>n;
    vector<long long> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    long long ans=INT64_MIN;
    int curSize=n;
    for(int i=0;i<n;i++){
        long long sum=0;
        for(int i=0;i<curSize;i++) sum=(sum+(long long)(a[i]));
        if(i==0)  ans=max(ans,sum);
        else ans=max(ans,max(sum,(-sum)));
        for(int i=0;i<curSize;i++) a[i]=(a[i+1]-a[i]);
        curSize--;
    }
    cout<<ans<<endl;
}
int main(){
    int tc;
    cin>>tc;
    while(tc--){
        solve();
    }
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

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

void solve(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    long long ans=INT64_MIN;
    long long sum=0;
    for(int i=0;i<n;i++) sum=(sum+(long long)(a[i]));
    ans=max(ans,sum);
    int curSize=n-1;
    for(int i=1;i<n;i++){
        // long long sum=0;
        // for(int i=0;i<curSize;i++) sum=(sum+(long long)(a[i]));
        // if(i==0)  ans=max(ans,sum);
        for(int i=0;i<curSize;i++) a[i]=(a[i+1]-a[i]);
        if(curSize==1) ans=max(ans,abs((long long)a[0]));
        else ans=max(ans,abs((long long)a[0]-(long long)a[curSize-1]));
        // else ans=max(ans,max(sum,(-sum)));
        curSize--;
        

    }
    cout<<ans<<endl;
}

int main(){
    int tc;
    cin>>tc;
    while(tc--){
        solve();
    }
}

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

void solve(){
    int n;
    cin>>n;
    vector<long long> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    long long ans=INT64_MIN;
    long long sum=0;
    for(int i=0;i<n;i++) sum=(sum+(a[i]));
    ans=max(ans,sum);
    int curSize=n-1;
    for(int i=1;i<n;i++){
        // long long sum=0;
        // for(int i=0;i<curSize;i++) sum=(sum+(long long)(a[i]));
        // if(i==0)  ans=max(ans,sum);
        for(int i=0;i<curSize;i++) a[i]=(a[i+1]-a[i]);
        if(curSize==1) ans=max(ans,abs(a[0]));
        else ans=max(ans,abs(a[0]-a[curSize-1]));
        // else ans=max(ans,max(sum,(-sum)));
        curSize--;
        

    }
    cout<<ans<<endl;
}

int main(){
    int tc;
    cin>>tc;
    while(tc--){
        solve();
    }
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)

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


int32_t main(){
    
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vector<int>v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    reverse(v.begin(),v.end());
    vector<pair<int,int>>ans;
    // x and y 
    
    for(int i=0;i<n;i++){
        
        // x ///i+1 greater means  x is ahead of those 
        // lesser means x is back now cross
        // x v[i+1]<x;
        
        // i-1
        // smaller values already ahead now don't cross; now cross;
        // larger values behind  it's crossed before ..now it's your turn to cross
        // x v[i-1]>x
        for(int j=i+1;j<n;j++){
            // if v[j]<v[i]  already v[j]
            // if v[i]<v[j] its already ahead 
            if(v[i]>v[j]){
                ans.push_back({v[i],v[j]});
            }
        }
        for(int j=0;j<i;j++){
            ans.push_back({v[i],v[j]});
        }
    }
    cout<<ans.size()<<"\n";
    for(auto i:ans){
        cout<<i.first<<" "<<i.second<<"\n";
    }
    
}

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


int32_t main(){
    
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vector<int>v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    reverse(v.begin(),v.end());
    vector<pair<int,int>>ans;
    // x and y 
    
    for(int i=0;i<n;i++){
        
        // x ///i+1 greater means  x is ahead of those 
        // lesser means x is back now cross
        // x v[i+1]<x;
        
        // i-1
        // smaller values already ahead now don't cross; now cross;
        // larger values behind  it's crossed before ..now it's your turn to cross
        // x v[i-1]>x
        for(int j=0;j<i;j++){
            ans.push_back({v[i],v[j]});
        }
        for(int j=i+1;j<n;j++){
            // if v[j]<v[i]  already v[j]
            // if v[i]<v[j] its already ahead 
            if(v[i]>v[j]){
                ans.push_back({v[i],v[j]});
            }
        }
        
    }
    cout<<ans.size()<<"\n";
    for(auto i:ans){
        cout<<i.first<<" "<<i.second<<"\n";
    }
    
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)

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


int32_t main(){
    
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vector<int>v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    reverse(v.begin(),v.end());
    vector<pair<int,int>>ans;
    // x and y 
    
    for(int i=0;i<n;i++){
        
        // x ///i+1 greater means  x is ahead of those 
        // lesser means x is back now cross
        // x v[i+1]<x;
        
        // i-1
        // smaller values already ahead now don't cross; now cross;
        // larger values behind  it's crossed before ..now it's your turn to cross
        // x v[i-1]>x
        for(int j=i+1;j<n;j++){
            if(v[i]>v[j]){
                ans.push_back({v[i],v[j]});
            }
        }
        for(int j=0;j<i;j++){
            ans.push_back({v[i],v[j]});
        }
    }
    cout<<ans.size()<<"\n";
    for(auto i:ans){
        cout<<i.first<<" "<<i.second<<"\n";
    }
    
}

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


int32_t main(){
    
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vector<int>v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    reverse(v.begin(),v.end());
    vector<pair<int,int>>ans;
    // x and y 
    
    for(int i=0;i<n;i++){
        
        // x ///i+1 greater means  x is ahead of those 
        // lesser means x is back now cross
        // x v[i+1]<x;
        
        // i-1
        // smaller values already ahead now don't cross; now cross;
        // larger values behind  it's crossed before ..now it's your turn to cross
        // x v[i-1]>x
        for(int j=i+1;j<n;j++){
            // if v[j]<v[i]  already v[j]
            // if v[i]<v[j] its already ahead 
            if(v[i]>v[j]){
                ans.push_back({v[i],v[j]});
            }
        }
        for(int j=0;j<i;j++){
            ans.push_back({v[i],v[j]});
        }
    }
    cout<<ans.size()<<"\n";
    for(auto i:ans){
        cout<<i.first<<" "<<i.second<<"\n";
    }
    
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)


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


int32_t main(){
    
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vector<int>v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    reverse(v.begin(),v.end());
    vector<pair<int,int>>ans;
    // x and y 
    
    for(int i=0;i<n;i++){
        
        // x ///i+1 greater means  x is ahead of those 
        // lesser means x is back now cross
        // x v[i+1]<x;
        
        // i-1
        // smaller values already ahead now don't cross; now cross;
        // larger values behind  it's crossed before ..now it's your turn to cross
        // x v[i-1]>x
        for(int j=i+1;j<n;j++){
            if(v[i]>v[j]){
                ans.push_back({v[i],v[j]});
            }
        }
        for(int j=0;j<i;j++){
            ans.push_back({v[i],v[j]});
        }
    }
    cout<<ans.size()<<"\n";
    for(auto i:ans){
        cout<<i.first<<" "<<i.second<<"\n";
    }
    
}