struct Fenwick
{
LL d[N];voidinit(){rep(i, n +1) d[i]=0;}voidmodify(int x, LL val){while(x <= n){ d[x]+= val; x += x &-x;}}
LL query(int x){ LL ret =0;while(x){ ret += d[x]; x -= x &-x;}return ret;}} fen;
二维树状数组
struct TwoD_Fenwick
{
LL d[N][N];voidinit(){rep(i, n +1)rep(j, m +1) d[i][j]=0;}voidadd(int x,int y, LL val){for(int i = x; i <= n; i += i &-i)for(int j = y; j <= m; j += j &-j)
d[i][j]+= val;}
LL query(int x,int y){
LL ret =0;for(int i = x; i >0; i -= i &-i)for(int j = y; j >0; j -= j &-j)
ret += d[i][j];return ret;}} fen;