#include "partition.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;

const int MAXN=4*1e7;

int c[MAXN];
int n;
bool v1[MAXN];
bool v2[MAXN];
int c1[MAXN];

vector<int> solve(vector<int> a)
{
    n=a.size();
    vector<int> ans;
    vector<int> ans1;
    for(int i=0; i<n; i++)
    {
        c[a[i]]++;
    }
    for(int i=0; i<n; i++)
    {
        if(c1[a[i]]>=c[a[i]]/2)
        {
            ans1.push_back(i);
            continue;
        }
        ans.push_back(i);
        v1[i]=1;
        c1[a[i]]++;
    }
    for(int i=0; i<n/2; i++)
    {
        ans.push_back(ans1[i]);
    }
    return ans;
}
