Problem: 2052A - Adrenaline Rush
Language: c++17 

Code 1:
#include <bits/stdc++.h>
#define ll long long int 
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define vl vector <ll>
#define pl pair <ll,ll>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define big_prime 1000000000+7
struct P {
    ll x;
    ll y;
    bool operator<(const P& other) const {
        return y < other.y || (y == other.y && x < other.x);
    }
    
};

bool comp(const P &p1, const P &p2) {
    if (p1.y != p2.y) return p1.y < p2.y;
    else return p1.x < p2.x;
}
#define yon(pass) if(pass){cout << "YES" << "\n";}else{cout << "NO" << "\n";}
ll gcd(ll a, ll b) {
    while (b != 0) {
    ll tmp = a % b;
    a = b;
    b = tmp;
    }
    return a;
}
ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}
 
long long binExpo(long long base, long long exponent, long long mod) {
long long result = 1;
base = base % mod;
 
while (exponent > 0) {
 
    if (exponent % 2 == 1) {
        result = (result * base) % mod;
    }
 
 
    base = (base * base) % mod;
    exponent /= 2;
}
 
return result;
}
 
using namespace std;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //ll t;
    //cin >> t;
    //while (t--) {
        ll n;
        cin >> n;
        vl v(n);
        rep(i, 0, n) cin >> v[i];
        vector<vector<ll>> vv(n,vector<ll>(n));
        vector<P> overtakes;
        rep(i, 1, n) {
            for(ll j= i;j>0;j--){
                if(v[j] < v[j-1]){
                    vv[j][j-1]++,vv[j-1][j]++;
                    P p;
                    p.x = v[j-1], p.y = v[j];
                    overtakes.PB(p);
                    swap(v[j],v[j-1]);
                }
            }
            for(ll j= 1;j<n;j++){
                if(v[j] > v[j-1] && vv[j][j-1] == 0){
                    vv[j][j-1]+=2;
                    vv[j-1][j]+=2;
                    P p;
                    p.x = v[j-1], p.y = v[j];
                    overtakes.PB(p);
                    swap(p.x, p.y);
                    overtakes.PB(p);
                }
            }
        }
        cout << overtakes.size() << "\n";
        reverse(overtakes.begin(), overtakes.end());
        for(auto a : overtakes){
            cout << a.x << " " << a.y << "\n"; 
        }


    //}
    return 0;
}

Code 2:
#include <bits/stdc++.h>
#define ll long long int 
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define vl vector <ll>
#define pl pair <ll,ll>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define big_prime 1000000000+7
struct P {
    ll x;
    ll y;
    bool operator<(const P& other) const {
        return y < other.y || (y == other.y && x < other.x);
    }
    
};

bool comp(const P &p1, const P &p2) {
    if (p1.y != p2.y) return p1.y < p2.y;
    else return p1.x < p2.x;
}
#define yon(pass) if(pass){cout << "YES" << "\n";}else{cout << "NO" << "\n";}
ll gcd(ll a, ll b) {
    while (b != 0) {
    ll tmp = a % b;
    a = b;
    b = tmp;
    }
    return a;
}
ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}
 
long long binExpo(long long base, long long exponent, long long mod) {
long long result = 1;
base = base % mod;
 
while (exponent > 0) {
 
    if (exponent % 2 == 1) {
        result = (result * base) % mod;
    }
 
 
    base = (base * base) % mod;
    exponent /= 2;
}
 
return result;
}
 
using namespace std;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //ll t;
    //cin >> t;
    //while (t--) {
        ll n;
        cin >> n;
        vl v(n), v2(n);
        rep(i, 0, n){ cin >> v[i]; v2[i] = (i+1);}
        vector<P> overtakes;
        for(ll i=n-1;i>0;i--){
            ll ind = -1;
            rep(j,0,n){
                if(v2[j] == v[i]){
                    ind = j;
                    break;
                }
            }
            for(ll j = ind;j>0;j--){
                P p;
                p.x = v2[j], p.y = v2[j-1];
                overtakes.PB(p);
                swap(v2[j],v2[j-1]);

            }
            rep(j,0,i){
                P p;
                p.x = v2[j+1], p.y = v2[j];
                overtakes.PB(p);
                swap(v2[j], v2[j+1]);
            }
        }
        cout << overtakes.size() << "\n";
        for(auto a : overtakes){
            cout << a.x << " " << a.y << "\n"; 
        }


    //}
    return 0;
}

Answer: 2