namespace BIT {
int tr[/*数据范围 qwq*/], N;
void init(int n) { N = n; for (int i = 1; i <= n; i ++) tr[i] = 0;}
void update(int x, int y) { for (; x <= N; x += (x & (-x))) tr[x] += y;}
int query(int x) { int res = 0; for (; x; x -= (x & (-x))) res += tr[x]; return res;}
} using namespace BIT;
标签:树状,int,void,tr,数组,模板
From: https://www.cnblogs.com/yh2021shx/p/17758824.html