#include "bits/stdc++.h"
#include "partition.h"
// #include "grader.cpp"

using namespace std;

#define SZ(s) (int)s.size()
#define ll long long
#define ff first
#define ss second

vector<int> solve(vector<int> a) {
    int n = SZ(a);
    ll s = 0;
    vector <pair <int, int>> v;
    deque <int> p;
    for(int i = 0; i < n; i++) {
        s += a[i];
        mp[a[i]]++;
        if(mp[a[i]] % 2 == 1) p.push_back(i);
        else p.push_front(i);
        v.push_back({a[i], i});
    }
    sort(v.begin(), v.end());
    return {p.begin(), p.end()};
}
