#include "partition.h"
#include <vector>
std::vector<int> solve(std::vector<int> A) {
    int n=A.size();
    if (n==1) return A;
    std::vector <int> ras;
    int m=(n+1)/2;
    long long ss=0;
    for (int i=0;i<n;++i)
    {
        ss=ss+A[i];
    }
    long long sss=0;
    for (int i=0;i<m;++i)
        sss=sss+A[i];
    int ok=1;
    int tt=m+n+1;
    for (int i=m;i<=tt;++i)
    {
        sss+=A[i%n];
        sss-=A[(i-m)%n];
        if (ss>2*sss) {ok=0;}
        else if (ok==0)
            {
                for (int j=i-m+1;j<=i;++j)
                {
                    ras.push_back(j%n);
                }
                int t=i-m+1+n;
                for (int j=i+1;j<t;++j)
                    ras.push_back(j%n);
                    return ras;
            }
    }
    return A;

}