#include<bits/stdc++.h>
#include "partition.h"

using namespace std;

vector<int> solve(vector<int>v)
{
    

    long long sum=0;

    for (long long i=0; i<A.size(); i++)
    {
        sum+=A[i];
    }

    sum=sum/2+(sum%2);

    //sort(v.begin(), v.end());

    long long ans=1e8;
    long long ansL=0;
    long long ansR=1e8;
    long long currsum=0;


    long long l=0;
    long long r=-1;
    long long sz=v.size();
    while (1)
    {
        if (r==v.size()-1) break;
        //cout<<l<<" "<<r<<endl;
        r++;
        currsum+=v[r];

        while (currsum>=sum)
        {
            long long szl=r-l+1;
            long long szr=v.size()-szl;

            if (abs(szr-szl)<ans)
            {
                ans=abs(szr-szl);
                ansR=r;
                ansL=l;
            }

            currsum-=v[l];
            l++;
            //if (abs(l-(sz-l))>=ans) break;
        }
        //if (abs(l-(sz-l))>=ans) break;
    }

    vector<int>ret;

    for (long long i=ansL; i<=ansR; i++)
    {
        ret.push_back(i);
    }

    for (long long i=0; i<ansL; i++)
    {
        ret.push_back(i);
    }

    for (long long i=ansR+1; i<v.size(); i++)
    {
        ret.push_back(i);
    }
    //cout<<ans<<endl;
    return ret;
}

