#include "partition.h"

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi2,popcnt,lzcnt")

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

std::vector<int> solve(std::vector<int> A) {
  int n = A.size();
  vector <int> f, s;
  f.reserve(n / 2);
  s.reserve(n / 2);
  if (n % 2 == 1) {
    for (int i = 0; i < n; i++) {
      if (i % 2 == 0) f.push_back(i);
      else s.push_back(i);
    }
  } else {
    for (int i = 0; i < n; i++) {
      if (i % 2 == (i >= n / 2 - (n % 4) / 2)) {
        f.push_back(i);
      } else {
        s.push_back(i);
      }
    }
  }
  vector <int> ans;
  ans.reserve(n);
  for (int i : f) {
    ans.push_back(i);
  }
  for (int i : s) {
    ans.push_back(i);
  }
  return ans;
}
