D. Martial Arts Tournament
#include<bits/stdc++.h>using namespace std;const int N = 1e5 + 10;int a[N], c[N];int n;int calc (int tar) { int j = 0; while((1 << j) < tar) j ++; return (1 << j) - tar;} int get (int x, int y) { retur