#include "bits/stdc++.h"
#include "partition.h"
// #include "grader.cpp"
#define pb push_back
#define all(v) v.begin(), v.end()
#define ll long long
#define ff first
#define ss second
#define pii pair<int, int>
using namespace std;

vector<int> solve(vector<int> a){
    int n=(int)a.size();
    ll S=0;
    vector<pii> v;
    for(int i = 0; i < n; ++i)
        S+=a[i], v.pb({a[i], i});
    sort(all(v));
    ll mid=(S+1)/2;
    auto f=[&](int x) -> int {
        int den;
        if(n%2==0)
            den=n/2;
        else
            den=n/2+1;
        return abs(n-2*x);
    };
    int mn=1e9;
    int l=-1, r=-1;
    for(int i = 0; i < n; ++i)
        for(int j = i; j < n; ++j){
            ll sm=0;
            for(int k = i; k <= j; ++k)
                sm+=v[k].ff;
            if(sm>mid)
                continue;
            int cost=f(j-i+1);
            if(mn>cost)
                mn=cost, l=i, r=j;
        }
    // printf("%d %d\n", l, r);
    vector<int> ans;
    assert(~l and ~r);
    for(int i = 0; i < l; ++i)
        ans.pb(v[i].ss);
    for(int i = r+1; i < n; ++i)
        ans.pb(v[i].ss);
    for(int i = l; i <= r; ++i)
        ans.pb(v[i].ss);
    // printf("%d\n", mn);
    // puts("ine");
    return ans;
}