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

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);

void solve()
{
    int n;
    cin >> n;
    vector<int> c(n);
    for (int i = 0; i < n; i++)
    {
        cin >> c[i];
    }
    vector<int> v1(n);
    for (int i = 0; i < n; i++)
    {
        v1[i] = i + 1;
    }
    vector<pair<int, int>> chk;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (i != j)
            {
                chk.push_back({i + 1, j + 1});
            }
        }
    }
    int hash[n + 1][n + 1];
    for (int i = 0; i < n + 1; i++)
    {
        for (int j = 0; j < n + 1; j++)
        {
            hash[i][j] = 0;
        }
    }
    vector<pair<int, int>> ans;
    for (int i = 0; i < n; i++)
    {
        int idx = find(v1.begin(), v1.end(), c[i]) - v1.begin();
        for (int j = idx; j > i; j--)
        {
            ans.push_back({v1[j], v1[j - 1]});
            swap(v1[j], v1[j - 1]);
            hash[v1[j]][v1[j-1]] = 1;
        }
    }
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            if (i != j)
            {
                if (hash[i][j] == 0 && hash[j][i] == 0)
                {
                    ans.push_back({i, j});
                    ans.push_back({j, i});
                    hash[i][j] = 1;
                    hash[j][i] = 1;
                }
            }
        }
    }
    cout<<ans.size()<<endl;
    for(auto e: ans){
        cout<<e.first<<" "<<e.second<<endl;
    }
    cout<<endl;
}

signed main()
{
    fast;
    int t=1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


Submission (verdict: Wrong answer on test 4):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);

void solve()
{
    int n;
    cin >> n;
    vector<int> c(n);
    for (int i = 0; i < n; i++)
    {
        cin >> c[i];
    }
    vector<int> v1(n);
    for (int i = 0; i < n; i++)
    {
        v1[i] = i + 1;
    }
    vector<pair<int, int>> chk;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (i != j)
            {
                chk.push_back({i + 1, j + 1});
            }
        }
    }
    int hash[n + 1][n + 1];
    for (int i = 0; i < n + 1; i++)
    {
        for (int j = 0; j < n + 1; j++)
        {
            hash[i][j] = 0;
        }
    }
    vector<pair<int, int>> ans;
    for (int i = 0; i < n; i++)
    {
        int idx = find(v1.begin(), v1.end(), c[i]) - v1.begin();
        for (int j = idx; j > i; j--)
        {
            ans.push_back({v1[j], v1[j - 1]});
            swap(v1[j], v1[j - 1]);
            hash[v1[j]][v1[j - 1]] = 1;
        }
    }
    for (int i = 0; i < n - 1; i++)
    {
        if (hash[c[i]][c[i + 1]] == 0 && hash[c[i + 1]][c[i]] == 0)
        {
            ans.push_back({c[i + 1], c[i]});
            ans.push_back({c[i], c[i + 1]});
        }
    }
    cout << ans.size() << endl;
    for (auto e : ans)
    {
        cout << e.first << " " << e.second << endl;
    }
    cout << endl;
}

signed main()
{
    fast;
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}