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

Code 1:
#include<bits/stdc++.h>
#define Akhaja ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#include<math.h>
#define ll long long 
using namespace std;
 
void init(){
    // Now its my turn
}

void solve(){
    ll n;
    cin>>n;
    vector<ll>a(n);
    for(ll i=0;i<n;i++){
        cin>>a[i];
    }
    set<pair<ll,ll>> mali;
    vector<pair<ll,ll>> ans;
    vector<ll> pos(n);
    map<ll,ll> mp;
    for(ll i=0;i<n;i++){
        pos[i]=(i+1);
        mp[i+1]=i;
    }

    for(ll i=0;i<n-1;i++){
        ll bando=a[i];
        ll idx=mp[bando];
        for(ll j=idx+1;j<n;j++){
            if(mali.find({pos[j],bando})==mali.end()){
                ans.push_back({pos[j],bando});
                mali.insert({pos[j],bando});
            }
        }
        for(ll j=n-1;j>=idx+1;j--){
            if(mali.find({bando,pos[j]})==mali.end()){
                ans.push_back({bando,pos[j]});
                mali.insert({bando,pos[j]});
            }
        }
        for(ll j=idx-1;j>=0;j--){
            if(mali.find({bando,pos[j]})==mali.end()){
                ans.push_back({bando,pos[j]});
                mali.insert({bando,pos[j]});
            }
            mp[bando]--;
            mp[pos[j]]++;
            pos[j+1]=pos[j];
        }
        pos[i]=bando;

        // for(auto it:pos){
        //     cout<<it<<" ";
        // }
        // cout<<endl;
    }
    cout<<ans.size()<<endl;
    for(auto it:ans){
        cout<<it.first<<" "<<it.second<<endl;
    }
}   
    
int main(){
    Akhaja;
    // init();
    // ll t;
    // cin>>t;
    // while(t--){
        solve();
    // }
    return 0;
}

Code 2:
#include<bits/stdc++.h>
#define Akhaja ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#include<math.h>
#define ll long long 
using namespace std;
 
void init(){
    // Now its my turn
}

void solve(){
    ll n;
    cin>>n;
    vector<ll>a(n);
    for(ll i=0;i<n;i++){
        cin>>a[i];
    }
    set<pair<ll,ll>> mali;
    vector<pair<ll,ll>> ans;
    vector<ll> pos(n);
    map<ll,ll> mp;
    for(ll i=0;i<n;i++){
        pos[i]=(i+1);
        mp[i+1]=i;
    }

    for(ll i=0;i<n-1;i++){
        ll bando=a[i];
        ll idx=mp[bando];
        for(ll j=idx+1;j<n;j++){
            if(mali.find({pos[j],bando})==mali.end()){
                ans.push_back({pos[j],bando});
                mali.insert({pos[j],bando});
            }
        }
        for(ll j=n-1;j>=idx+1;j--){
            if(mali.find({bando,pos[j]})==mali.end()){
                ans.push_back({bando,pos[j]});
                mali.insert({bando,pos[j]});
            }
        }
        for(ll j=idx-1;j>=i;j--){
            if(mali.find({bando,pos[j]})==mali.end()){
                ans.push_back({bando,pos[j]});
                mali.insert({bando,pos[j]});
            }
            mp[bando]--;
            mp[pos[j]]++;
            pos[j+1]=pos[j];
        }
        pos[i]=bando;

        // for(auto it:pos){
        //     cout<<it<<" ";
        // }
        // cout<<endl;
    }
    cout<<ans.size()<<endl;
    for(auto it:ans){
        cout<<it.first<<" "<<it.second<<endl;
    }
}   
    
int main(){
    Akhaja;
    // init();
    // ll t;
    // cin>>t;
    // while(t--){
        solve();
    // }
    return 0;
}

Answer: 2