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

vector<int> solve(vector<int> a) {
    ll n = a.size();
    ll Sum = 0;
    for (auto& el : a) Sum += el;
    ll BestAnsValue = n+1; vector<int> ans;
    for (ll mask = 0; mask < (1LL << (n)); mask++)
    {
        ll cnt = 0, Ans = 0;
        for (ll i = n - 1; i >= 0; i--)
        {
            if ((mask & (1LL << i)))
            {
                cnt++;
                Ans += (1LL << n);
            }
        }
        if (Ans * 2 >= Sum)
        {
            if (abs(cnt - (n - cnt)) < BestAnsValue)
            {
                BestAnsValue = (cnt - (n - cnt));
                for (ll i = n - 1; i >= 0; i--)
                {
                    if ((mask & (1LL << i)))
                    {
                        ans.push_back(i);
                    }
                }
                for (ll i = n - 1; i >= 0; i--)
                {
                    if (!(mask & (1LL << i)))
                    {
                        ans.push_back(i);
                    }
                }
            }
        }
    }

    return ans;
}
