#include <bits/stdc++.h>
#include "partition.h"
using namespace std;
vector<int> solve(vector<int> a)
{
    vector<int> k = a;
    int sum = 0, br = 0, gsum, gbr = k.size(), bsum = 1000000, bbr = 1000000, s, c;
    for(int i = 0; i < gbr; i++)gsum += k[i];
    sort(k.begin(), k.end());
    for(int i = gbr - 1; i >= 0; i--)
    {
        sum = 0;
        br = 0;
        for(int j = i; j >= 0; j--)
        {
            sum += k[j];
            if(gsum - 2 * sum < bsum || (gsum - 2 * sum == bsum && br < bbr))
            {
                bbr = br;
                bsum = gsum - 2 * sum;
                s = i;
                c = j;
            }
            if(sum > gsum / 2)break;
        }
    }
    for(ll i = c; i <= s; i++)cout << i << " ";
    for(ll i = 0; i < c; i++)cout << i << " ";
    for(ll i = s + 1; i < gbr; i++)cout << i << " ";
    cout << endl;
}
