#include "bits/stdc++.h"
#include "partition.h"
// #include "grader.cpp"

using namespace std;

#define SZ(s) (int)s.size()
#define ll long long
#define ff first
#define ss second

vector<int> solve(vector<int> a) {
    int n = SZ(a);
    ll s = 0;
    vector <pair <int, int>> v;
    vector <int> p;
    for(int i = 0; i < n; i++) {
        s += a[i];
        v.push_back({a[i], i});
    }
    sort(v.begin(), v.end());
    int mn = 1e9;
    for(int i = 1; i <= n; i++) {
        ll sm = 0;
        vector <int> vis(n, 0), d;
        int cnt = 0;
        for(int j = 0; j < i; j++) {
            if(sm * 2 >= s) break;
            sm += (v[j].ff);
            vis[j] = true;
            d.push_back(v[j].ss);
            cnt++;
        }
        for(int j = n-1; j >= i; j--) {
            if(sm * 2 >= s) break;
            sm += (v[j].ff);
            vis[j] = true;
            d.push_back(v[j].ss);
            cnt++;
        }
        for(int j = 0; j < n; j++) {
            if(!vis[j]) d.push_back(v[j].ss);
        }
        if(abs((n - cnt) - cnt) < mn) {
            mn = abs((n - cnt) - cnt);
            p = d;
        }
    }
    // cout << mn << '\n';
    return p;
}
