#include "partition.h"
#include "iostream"
#include <vector>
#include <unordered_map>
using namespace std;


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

 //   unordered_map <int, bool> meme;
    vector <int> aa, bb;
    aa.reserve(A.size());
    bb.reserve(A.size() / 2);
    int64_t BalanseOfTheWorld = 0;
    for (size_t io = 0; io < A.size(); io++)   
    {
        auto i = A[io];
    //    meme[i] = !meme[i];
        if (BalanseOfTheWorld > 0)
        {
            aa.push_back(io);
            BalanseOfTheWorld -= i;
        }
        else
        {
            bb.push_back(io);
            BalanseOfTheWorld += i;
        }

    }
    for (auto i : bb) aa.push_back(i);
    
    

    return aa;
}
