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




vector<int> solve(vector<int> A) {
    sort(A.begin(),A.end());
    int N = A.size();
    int n = (N + 1) / 2;
    int num = 0;
    int sum = 0;
    for(int i = 0; i < n; ++i){
        num += A[i];
        sum += A[i];
    }
    for(int i = n; i < N; ++i){
        sum += A[i];
    }
    sum /= 2;
    sum -= num;
    int t = 0;
    while(sum > 0){
        sum += A[t];
        sum -= A[(N - 1) - t];
        t++;
    }
    vector<int> vec;
    for(int i = t; i < n; ++i){
        vec.push_back(A[i]);
    }
    for(int i = N - t; i < N; ++i){
        vec.push_back(A[i]);
    }
    for(int i = n; i < N - t; ++i){
        vec.push_back(A[i]);
    }
    for(int i = 0; i < t; ++i){
        vec.push_back(A[i]);
    }
    return vec;

}













