#include "bits/stdc++.h"
#include "partition.h"
// #include "grader.cpp"
using namespace std;

#define ll long long

ll n, ans, S, s;

vector <int> solve(vector<int> A) {
    ios::sync_with_stdio(0);cin.tie(0);
    n = (int)A.size();
    S = (n * (n + 1)) / 2;
    for(int i = 0; i < n; i++) {
        if(i < n / 2) s += A[i];
    }
    int i = n - 1, j = max(0ll,n / 2 - 1);
    while(s * 2 < S && j >= 0 && i >= 0) {
        s -= A[j];
        s += A[i];
        swap(A[j],A[i]);
        i--;
        j--;
    }
    for(int i = 0; i < n; i++) {
        A[i]--;
    }
    return A;
}