#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);

    for (size_t io = 0; io < A.size(); io++)   
    {
        auto i = A[io];
        meme[i] = !meme[i];
        if (meme[i])
            aa.push_back(io);
        else
            bb.push_back(io);     

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

    return aa;
}
