func_code_string: #include <bits/stdc++.h>   using namespace std;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   inline long long int rand(long long int x, long long int y) {     ++y;     return (rng() % (y - x)) + x;   }   long long int n, q, fw[300006], st[300006], en[300006], co, dist[300006], zero,       line[300006], lines, sizee[300006];   vector<long long int> v[300006];   struct fen {     long long int n;     vector<long long int> fw;     void init(long long int x) {       fw.resize(x + 2 + 1);       n = fw.size() - 1;     }     void update(long long int x, long long int y, long long int nv) {       ++y;       for (; x <= n; x += x & (-x)) fw[x] += nv;       for (; y <= n; y += y & (-y)) fw[y] -= nv;     }     long long int sum(long long int x) {       long long int res = 0;       for (; x; x -= x & (-x)) res += fw[x];       return res;     }   } fen[300006];   struct fen2 {     void update(long long int x, long long int y, long long int nv) {       ++y;       for (; x <= n; x += x & (-x)) fw[x] += nv;       for (; y <= n; y += y & (-y)) fw[y] -= nv;     }     long long int sum(long long int x) {       long long int res = 0;       for (; x; x -= x & (-x)) res += fw[x];       return res;     }   } depth;   void dfs(long long int x, long long int p) {     st[x] = co++;     if (p != 1)       line[x] = line[p], sizee[line[p]]++;     else if (x != 1)       line[x] = lines++, sizee[line[x]]++;     for (auto i : v[x]) {       if (i == p) continue;       dist[i] = dist[x] + 1;       dfs(i, x);     }     en[x] = co;   }   int main() {     cin >> n >> q;     for (long long int i = 0; i < n - 1; i++) {       long long int a, b;       cin >> a >> b;       v[a].push_back(b);       v[b].push_back(a);     }     dfs(1, 1);     for (long long int i = 0; i < lines; i++) fen[i].init(sizee[i]);     for (long long int i = 1; i <= q; i++) {       long long int op;       cin >> op;       if (op == 0) {         long long int v, x, d;         cin >> v >> x >> d;         long long int overflow = d - dist[v];         if (overflow >= 0) depth.update(1, overflow + 1, x);         if (v == 1) continue;         if (overflow >= 0)           fen[line[v]].update(overflow + 2, dist[v] + d + 1, x);         else           fen[line[v]].update(dist[v] - d + 1, dist[v] + d + 1, x);       } else {         long long int v;         cin >> v;         cout << depth.sum(dist[v] + 1) + fen[line[v]].sum(dist[v] + 1) <<   n ;       }     }   }   