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

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define ld long double
#define vii vector<ll>
#define vll vector<ll>
#define vss vector<string>
#define vcc vector<char>
#define vld vector<ld>
#define vbb vector<bool>
#define re register
#define il inline
#define pii pair<ll,ll>
#define pll pair<ll,ll>
#define pcc pair<char,char>
#define mii map<ll,ll>
#define mci map<char,ll>
#define mll map<ll,ll>
#define sii set<ll>
#define sll set<ll>
#define msi map<string,ll>
#define msl map<char,ll>
#define usii unordered_set<ll>
#define usll unordered_set<ll>
#define umii unordered_map<ll,ll>
#define umll unordered_map<ll,ll>
#define umci unordered_map<char,ll>
#define pb push_back
#define pf push_front
#define fi first
#define so second
const ll MOD = 1e9 + 7;
const ll inf = 0x3f3f3f3f;
const ll MAXX = LLONG_MAX;
const ll INF = 0x3f3f3f3f3f3f3f3f;
using namespace std;
const ll MAXN = 362880 + 5; // 876543210的hash值为362880，即最多出现362880种可能
const int dirma[8][2] = { {-2,1},{-2,-1},{-1,2},{-1,-2},{1,2},{1,-2},{2,1},{2,-1} };
const int dir[4][2] = { {-1,0},{1,0},{0,1},{0,-1} };
const int mod = 1e6 + 7;
struct ooo
{

};

void solve()
{
    int n;
    cin >> n;
    vii res(n + 1);
    for (int i = 1; i <= n; i++)
    {
        cin >> res[i];
    }
    int cnt = 0;
    for (int i = 1; i < n; i++)
    {
        for (int j = i + 1; j <= n; j++)
        {
            if (res[i] > res[j])
            {
                cnt++;
            }
            else
            {
                cnt += 2;
            }
        }
    }
    cout << cnt << endl;
    for (int i = 1; i < n; i++)
    {
        for (int j = i + 1; j <= n; j++)
        {
            if (res[i] > res[j])
            {
                cout << res[i] << " " << res[i + 1] << endl;
            }
            else
            {
                cout << res[i + 1] << " " << res[i] << endl;
                cout << res[i] << " " << res[i + 1] << endl;
            }
        }
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


Submission (verdict: Wrong answer on test 4):
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define ld long double
#define vii vector<ll>
#define vll vector<ll>
#define vss vector<string>
#define vcc vector<char>
#define vld vector<ld>
#define vbb vector<bool>
#define re register
#define il inline
#define pii pair<ll,ll>
#define pll pair<ll,ll>
#define pcc pair<char,char>
#define mii map<ll,ll>
#define mci map<char,ll>
#define mll map<ll,ll>
#define sii set<ll>
#define sll set<ll>
#define msi map<string,ll>
#define msl map<char,ll>
#define usii unordered_set<ll>
#define usll unordered_set<ll>
#define umii unordered_map<ll,ll>
#define umll unordered_map<ll,ll>
#define umci unordered_map<char,ll>
#define pb push_back
#define pf push_front
#define fi first
#define so second
const ll MOD = 1e9 + 7;
const ll inf = 0x3f3f3f3f;
const ll MAXX = LLONG_MAX;
const ll INF = 0x3f3f3f3f3f3f3f3f;
using namespace std;
const ll MAXN = 362880 + 5; // 876543210的hash值为362880，即最多出现362880种可能
const int dirma[8][2] = { {-2,1},{-2,-1},{-1,2},{-1,-2},{1,2},{1,-2},{2,1},{2,-1} };
const int dir[4][2] = { {-1,0},{1,0},{0,1},{0,-1} };
const int mod = 1e6 + 7;
struct ooo
{

};

void solve()
{
    int n;
    cin >> n;
    vii res(n + 1);
    for (int i = 1; i <= n; i++)
    {
        cin >> res[i];
    }
    int cnt = 0;
    for (int i = 1; i < n; i++)
    {
        for (int j = i + 1; j <= n; j++)
        {
            if (res[i] > res[j])
            {
                cnt++;
            }
            else
            {
                cnt += 2;
            }
        }
    }
    cout << cnt << endl;
    for (int i = 1; i < n; i++)
    {
        for (int j = i + 1; j <= n; j++)
        {
            if (res[i] > res[j])
            {
                cout << res[i] << " " << res[j] << endl;
            }
            else
            {
                cout << res[j] << " " << res[i] << endl;
                cout << res[i] << " " << res[j] << endl;
            }
        }
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}