#include "partition.h"
#include "bits/stdc++.h"
using namespace std;
#define ls(v) (ll)v.size()
#define ll long long
#define all(v) v.begin(), v.end()
#define pb push_back
vector<int> solve(vector<int> A) {
    ll n = ls(A);
    vector<int> a = A;
    ll S = accumulate(a.begin(), a.end(), 0LL);
    ll ans = n + 1;
    vector<int> answer;
    for(ll k = 0;k < (1 << n);++k){
        vector<ll> v;
        ll sum = 0;
        ll cnt = 0;
        for(ll i = 0;i<n;++i){
            if(k >> i & 1){
                sum += a[i];
                cnt += 1;
                v.pb(a[i]);
            }
        }
        if(sum >= S / 2){
            sort(all(v));
            ll ok = 1;            
            ll pr = 0;
            for(ll i = 0;i<cnt - 1;++i){
                pr += v[i];
                if(pr >= S / 2) ok = 0;
            }
            if(ok and ans > abs(n - 2 * cnt)){
                answer.clear();
                for(int i = 0;i<n;++i) if(k >> i & 1) answer.pb(i);
            }
            if(ok) ans = min(ans, abs(((n - cnt) - cnt)));
        }
    }
    set<int>st(answer.begin(), answer.end());
    for(int i = 0;i<n;++i) if(st.count(i) == 0) answer.pb(i);
    return answer;
}
