#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 (auto i : A)
    {
        meme[i] = !meme[i];
        if (meme[i])
            aa.push_back(i);
        else
            bb.push_back(i);     

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

    return aa;
}
