Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
// JAY SHREE RAM
// ChineseBheL

#include<bits/stdc++.h>
using namespace std ;

#define ll              long long 
#define pb              push_back
#define all(v)          v.begin(),v.end()
#define allr(v)          v.rbegin(),v.rend()
#define sz(a)           (ll)a.size()
#define F               first
#define S               second
#define INF             2000000000000000000
#define popcount(x)     __builtin_popcountll(x)
#define pll             pair<ll,ll>
#define pii             pair<int,int>
#define ld              long double

const int M = 1000000007;
const int MM = 998244353;

template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }

#ifdef LOCAL
#define debug(...) debug_out(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) 2351
#endif


void ChineseBheL()
{
    int n;
    cin>>n;
    vector<int> v(n);
    for(int i = 0 ; i < n ; i++){
        cin>>v[i];
    }
    vector<pair<int,int>> ans;
    for(int i = n-1 ; i >= 0 ; i--){
        int x = v[i];
        int j = 1;
        while(j<x){
            ans.pb({x , j});
            j++;
        }
        for(int k = 0 ; k < i ; k++){
            if(v[k] < x) ans.pb({v[k] , x});
        }
    }
    cout<<ans.size()<<"\n";
    for(int i = 0 ; i < ans.size() ; i++){
        cout<<ans[i].first<<" "<<ans[i].second<<"\n";
    }
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #ifdef runSieve
        sieve();
    #endif
    #ifdef NCR
        initialize();
    #endif
    int t = 1;
    // cin >> t;
    while(t--)
        ChineseBheL();
    return 0;
}

Submission (verdict: Accepted):
// JAY SHREE RAM
// ChineseBheL

#include<bits/stdc++.h>
using namespace std ;

#define ll              long long 
#define pb              push_back
#define all(v)          v.begin(),v.end()
#define allr(v)          v.rbegin(),v.rend()
#define sz(a)           (ll)a.size()
#define F               first
#define S               second
#define INF             2000000000000000000
#define popcount(x)     __builtin_popcountll(x)
#define pll             pair<ll,ll>
#define pii             pair<int,int>
#define ld              long double

const int M = 1000000007;
const int MM = 998244353;

template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }

#ifdef LOCAL
#define debug(...) debug_out(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) 2351
#endif


void ChineseBheL()
{
    int n;
    cin>>n;
    vector<int> v(n);
    for(int i = 0 ; i < n ; i++){
        cin>>v[i];
    }
    vector<pair<int,int>> ans;
    for(int i = n-1 ; i >= 0 ; i--){
        vector<int> temp;
        for(int j = 0 ; j < i ; j++){
            temp.pb(v[j]);
        }
        sort(all(temp));
        for(int j = temp.size() - 1 ; j >= 0 ; j--){
            if(temp[j] < v[i]) ans.pb({v[i] , temp[j]});
        }
        for(int j = 0 ; j < temp.size() ; j++){
            if(temp[j] < v[i]) ans.pb({temp[j] , v[i]});
        }
        for(int j = 0 ; j < temp.size() ; j++){
            if(temp[j] > v[i]) ans.pb({temp[j] , v[i]});
        }
    }
    cout<<ans.size()<<"\n";
    for(int i = 0 ; i < ans.size() ; i++){
        cout<<ans[i].first<<" "<<ans[i].second<<"\n";
    }
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #ifdef runSieve
        sieve();
    #endif
    #ifdef NCR
        initialize();
    #endif
    int t = 1;
    // cin >> t;
    while(t--)
        ChineseBheL();
    return 0;
}