#include "rotate.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T>
bool assign_min(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T>
bool assign_max(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void energy(int n, vector<int> v) {
    vector<int> ord(n);
    iota(ord.begin(), ord.end(), 0);
    sort(ord.begin(), ord.end(), [&](int x, int y) {
        return v[x] < v[y];
    });
    int half = n / 2;
    vector<vector<int>> rot(20);
    for (int i = 0; i < half; i++) {
        int x = (25000 - v[ord[i]] + 50000) % 50000;
        for (int b = 0; b < 20; b++) {
            if (x & (1 << b)) {
                rot[b].push_back(ord[i]);
            }
        }
    }
    for (int i = half; i < v.size(); i++) {
        int x = (0 - v[ord[i]] + 50000) % 50000;
        for (int b = 0; b < 20; b++) {
            if (x & (1 << b)) {
                rot[b].push_back(ord[i]);
            }
        }
    }
    for (int b = 0; b < 19; b++) {
        if (rot[b].empty()) {
            continue;
        }
        rotate(rot[b], (1 << b));
    }
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |