int@n,u[n],v[];rd((u--,v--)(n-1)); graph g; g.setEdge(n,n-1,u,v); rep(i,n){ ll z=0; rep[g.edge[i]](j,g.es[i]){ z+=g.es[j]-1; } wt(z); }