#include "partition.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back

std::vector<int> solve(std::vector<int> A) {
    map<int,vector<int>> mp;
    for(int i = 0; i < A.size(); i++) mp[A[i]].push_back(i);
    vector<int> ans;
    for(auto &[key, val] : mp) {
        for(int i = 0; i < val.size()/2;i++) ans.pb(val[i]);
    }
    for(auto &[key, val] : mp) {
        for(int i = val.size()/2; i < val.size();i++) ans.pb(val[i]);
    }
    return ans;
}
