Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 7):
#include "bits/stdc++.h"
#ifdef AlRntn
#include "debug.hpp"
#else
#define debug(...) 
#define tstr(...) 
#endif
using int64 = int64_t;
using uint64 = uint64_t;
using ll = intptr_t;
using ull = uintptr_t;
using ld = long double;
#define fi first
#define se second
#define sz(x) int64(x.size())
#define all(x) x.begin(), x.end()
#define spc ' '
#define endl '\n'
#define pb push_back
#define mp make_pair
#define ever ;1;
constexpr int64 inf = 5e18 + 100;
constexpr int64 mod1 = 1e9+7;
constexpr int64 mod2 = 998244353;
constexpr int64 mod3 = 1e9+9;
constexpr int64 mod4 = (1ll<<31) - 1;
constexpr long double PI = 2*asinl(1.0);
int dx[4] = {0 , 1 , 0 , -1}; // clockwise from north
int dy[4] = {-1 , 0 , 1 , 0};
int dx2[8] = {0 , 1 , 1 , 1 , 0 , -1 , -1 , -1}; // clockwise from north
int dy2[8] = {-1 , -1 , 0 , 1 , 1 , 1 , 0 , -1};
const int N = 1e6 + 50, L = 25;
ll n;
std::vector<ll> A;
int32_t main(){
#ifdef AlRntn
freopen("inputf.in" , "r" , stdin); freopen("outputf.out" , "w" , stdout); freopen("errorf.out" , "w" , stderr);
#endif
    using namespace std;
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    int32_t tc=1;
//#define TestCases
#ifdef TestCases
    std::cin >> tc;
#endif
    while(tc--){
        cin>>n;A.resize(n);
        for(auto &a : A) cin>>a;
        std::vector<std::pair<ll,ll>> C;
        std::vector<ll> B;
        for(ll i = 1; i <= n; i++) B.pb(i);
        for(ll i = n-1; i >= 0; i--){
            ll cur = A[i];
            ll pos = 0;
            for(ll j = 0; j < n; j++) if(B[i] == cur) pos = i;
            for(ll k = pos-1; k >= 0; k--){
                C.pb({B[k+1], B[k]});
                std::swap(B[k+1], B[k]);
            }
            for(ll k = 0; k < i; k++){
                C.pb({B[k+1], B[k]});
                std::swap(B[k+1], B[k]);
            }
        }
        cout << sz(C) << endl;for(auto &c: C) cout << c.fi << spc << c.se << endl;
    }
    return 0;
}

Submission (verdict: Wrong answer on test 1):
#include "bits/stdc++.h"
#ifdef AlRntn
#include "debug.hpp"
#else
#define debug(...) 
#define tstr(...) 
#endif
using int64 = int64_t;
using uint64 = uint64_t;
using ll = intptr_t;
using ull = uintptr_t;
using ld = long double;
#define fi first
#define se second
#define sz(x) int64(x.size())
#define all(x) x.begin(), x.end()
#define spc ' '
#define endl '\n'
#define pb push_back
#define mp make_pair
#define ever ;1;
constexpr int64 inf = 5e18 + 100;
constexpr int64 mod1 = 1e9+7;
constexpr int64 mod2 = 998244353;
constexpr int64 mod3 = 1e9+9;
constexpr int64 mod4 = (1ll<<31) - 1;
constexpr long double PI = 2*asinl(1.0);
int dx[4] = {0 , 1 , 0 , -1}; // clockwise from north
int dy[4] = {-1 , 0 , 1 , 0};
int dx2[8] = {0 , 1 , 1 , 1 , 0 , -1 , -1 , -1}; // clockwise from north
int dy2[8] = {-1 , -1 , 0 , 1 , 1 , 1 , 0 , -1};
const int N = 1e6 + 50, L = 25;
ll n;
std::vector<ll> A;
int32_t main(){
#ifdef AlRntn
freopen("inputf.in" , "r" , stdin); freopen("outputf.out" , "w" , stdout); freopen("errorf.out" , "w" , stderr);
#endif
    using namespace std;
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    int32_t tc=1;
//#define TestCases
#ifdef TestCases
    std::cin >> tc;
#endif
    while(tc--){
        cin>>n;A.resize(n);
        for(auto &a : A) cin>>a;
        std::vector<std::pair<ll,ll>> C;
        std::vector<ll> B(n, 0); iota(all(B), 1);
        std::map<ll,ll> Ind;
        for(ll i = n-1; i >= 0; i--){
            ll cur = A[i];
            ll pos = 0;
            for(ll j = 0; j < n; j++) if(B[j] == cur) pos = j;
            for(ll k = pos-1; k >= 0; k--){
                cout << B[k+1] << spc << B[k] << endl;
                std::swap(B[k+1], B[k]);
            }
            for(ll k = 0; k < i; k++){
                cout << B[k+1] << spc << B[k] << endl;
                std::swap(B[k+1], B[k]);
            }
        }
    }
    return 0;
}