int inv2 = inv(2); inlinevoidOr(int &x, int &y){ y = addmod(y + x); } inlinevoidOrInv(int &x, int &y){ y = redmod(y - x); } inlinevoidAnd(int &x, int &y){ x = addmod(x + y); } inlinevoidAndInv(int &x, int &y){ x = redmod(x - y); } inlinevoidXor(int &x, int &y){ int u = x, v = y; x = addmod(u + v); y = redmod(u - v); } inlinevoidXorInv(int &x, int &y){ int u = x, v = y; x = addmod(u + v) * inv2 % MOD; y = redmod(u - v) * inv2 % MOD; } voidFMTFWT(int n, int *a, void (*oper)(int &, int &)){ for (int len = 2, halflen = 1; len <= n; len <<= 1, halflen <<= 1) { for (int l = 0, r = len - 1; r < n; l += len, r += len) { for (int i = l, j = l + halflen; j <= r; ++i, ++j) { oper(a[i], a[j]); } } } }