func_code_string: #include <bits/stdc++.h>   const int MN = 1e5 + 4;   int N, Q, ecnt, ch[MN], depth[MN], len[MN];   long long rt, bit1[MN], *bit2[MN];   std::vector<int> adj[MN];   inline void upd(long long *bit, int ind, int cap, long long val) {     for (; ind < cap; ind += ind & -ind) bit[ind] += val;   }   inline long long qry(long long *bit, int ind) {     long long res = 0;     for (; ind; ind -= ind & -ind) res += bit[ind];     return res;   }   void dfs1(int src, int p, int d, int b) {     ++ecnt;     ch[src] = b;     depth[src] = d++;     for (int i : adj[src]) {       if (i == p) continue;       dfs1(i, src, d, b);     }   }   int main() {     scanf( %d%d , &N, &Q);     for (int i = 1, a, b; i < N; ++i) {       scanf( %d%d , &a, &b);       adj[a].emplace_back(b);       adj[b].emplace_back(a);     }     int cnt = 0;     for (int i : adj[1]) {       dfs1(i, 1, 1, ++cnt);       len[cnt] = ecnt + 1;       bit2[cnt] = (long long *)calloc(ecnt + 1, sizeof(long long));       ecnt = 0;     }     for (int i = 0, a, b, c, d; i < Q; ++i) {       scanf( %d , &a);       if (a) {         scanf( %d , &b);         if (b == 1)           printf( %lld n , rt);         else           printf( %lld n , qry(bit1, depth[b]) + qry(bit2[ch[b]], depth[b]));       } else {         scanf( %d%d%d , &b, &c, &d);         if (b == 1) {           upd(bit1, 1, MN, c);           upd(bit1, d + 1, MN, -c);           rt += c;         } else {           if (d < depth[b]) {             upd(bit2[ch[b]], depth[b] - d, len[ch[b]], c);             upd(bit2[ch[b]], depth[b] + d + 1, len[ch[b]], -c);           } else {             upd(bit2[ch[b]], 1, len[ch[b]], c);             upd(bit2[ch[b]], depth[b] + d + 1, len[ch[b]], -c);             if (depth[b] != d) {               upd(bit1, 1, MN, c);               upd(bit1, d - depth[b] + 1, MN, -c);               upd(bit2[ch[b]], 1, len[ch[b]], -c);               upd(bit2[ch[b]], d - depth[b] + 1, len[ch[b]], c);             }             rt += c;           }         }       }     }   }   