foo.cpp: In function 'void add(int, ll)':
foo.cpp:37:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(x=top[x])up[f[x]]+=p*(size[f[x]]-size[x]),x=f[x];
^
foo.cpp: In function 'int main()':
foo.cpp:46:72: error: invalid types 'int[int]' for array subscript
for(dfs(i=1),dfs2(1,1);i<=n;i++)read(x),add(i,x),up[i]+=(ll)x*(size[i]-1);
^
foo.cpp:51:45: error: invalid types 'int[int]' for array subscript
if(ch=='S')add(x,y),up[x]+=(ll)y*(size[x]-1);
^
foo.cpp:52:34: error: invalid types 'int[int]' for array subscript
if(ch=='M')add(x,(ll)y*size[x]),modify(loc[x],y,1),modify(en[x]+1,-y,1);
^