我目前的级别大概只需要这些:
ll q_pow(ll a, ll b, ll p) {
ll ret = 1;
for (; b; a = a * a % p, b >>= 1) if (b & 1) ret = ret * a % p;
return ret;
}
ll inv(ll x, ll p) { return q_pow(x, p - 2, p); }
int tree[MAXN];
inline int lowbit(int x) { return x & -x; }
void insert(int pos, int k) { for (; pos <= N; pos +