#include "partition.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

vector<int> solve(vector<int> v) {
    int n = v.size();
    vector <int> ramase, ans;
    map <int, int> fr;

    for (int i = 0; i < n; i++) {
        if (fr[v[i]] % 2 == 0) ans.push_back(i);
        else ramase.push_back(i);

        fr[v[i]]++;
    }

    for (auto it : ramase) {
        ans.push_back(it);
    }

    return ans;
}

