#include <bits/stdc++.h>
using namespace std;
//#define int long long

std::vector<int> solve(std::vector<int> A){
    int n;
    n=A.size();
    vector<int>ANS;
    int s=0;
    vector<pair<int,int>>l;
    for(int i=0;i<n;i++){
        l.push_back({A[i],i});
    }
    sort(l.begin(),l.end());
    /*for(auto x:l){
        cout<<x.first<<" cu indice "<<x.second<<"\n";
    }*/
    int m=(n+1)/2;
    int cnt=0;
    for(int i=0;i<m;i++){
        cnt+=l[i].first;
    }
    int k=0;
    while(2*cnt<s){
        cnt-=l[m-k].first;
        cnt+=l[n-1-k].first;
        k++;
    }
    pair<int,int>sp;
    if(k==0){
        sp=l[m-1];
    }else{
        sp=l[n-k];
    }
    vector<pair<int,int>>pr;
    vector<pair<int,int>>sf;
    for (int i=0;i<m-k;i++){
        if(k==0&&i==m-1)continue;
        pr.push_back(l[i]);
    }
    for(int i=n-k+1;i<n;i++){
        pr.push_back(l[i]);
    }
    for(int i=m-k;i<n-k;i++){
        sf.push_back(l[i]);
    }

    for(auto x:pr){
        ANS.push_back(x.second);
    }
    ANS.push_back(sp.second);
    for(auto x:sf){
        ANS.push_back(x.second);
    }


    return ANS;

}