//#include "partition.h"
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

vector<int> solve(vector<int> a) {
    int n = (int)a.size();
    ll tar = 0;
    for(int x : a) tar += x;
    tar /= 2;
    int ans = n + 1;
    vector<ll> dp(1 << n);
    int res = -1;
    for(int mask = 1; mask < (1 << n); mask++) {
        int x = __builtin_ctz(mask);
        dp[mask] = a[x] + dp[mask ^ (1 << x)];
        if(dp[mask] > tar) {
            int sz = __builtin_popcount(mask);
            if(ans > abs(sz - (n - sz))) {
                ans = abs(sz - (n - sz));
                res = mask;
            }
        }
    }
    vector<int> v;
    for(int i = 0; i < n; i++) {
        if(res >> i & 1) {
            v.push_back(i);
        }
    }

    for(int i = 0; i < n; i++) {
        if(!(res >> i & 1)) {
            v.push_back(i);
        }
    }
    return v;
}
