/tmp/solutions/build/vertex_add_subtree_sum-main.cpp:
    1|       |#include <common.h>
    2|       |prelude;
    3|       |
    4|       |namespace {
    5|       |
    6|       |constexpr int N = 5e5;
    7|       |
    8|       |int a[N];
    9|       |int p[N];
   10|       |int l[N];
   11|       |u64 b[N + 1];
   12|       |
   13|       |} // namespace
   14|       |
   15|      1|int main() {
   16|      1|  rd rd;
   17|      1|  wt wt;
   18|      1|  int n = rd.uh();
   19|      1|  int q = rd.uh();
   20|      1|#ifdef LOCAL
   21|      1|  std::memset(l, 0, 4 * n);
   22|      1|#endif
   23|    533|  for (int i = 0; i < n; ++i) a[i] = rd.uw();
                                       ^532 ^532
  ------------------
  |  Branch (23:19): [True: 99.81%, False: 0.19%]
  ------------------
   24|    532|  for (int i = 1; i < n; ++i) p[i] = rd.uh();
                                       ^531 ^531
  ------------------
  |  Branch (24:19): [True: 99.81%, False: 0.19%]
  ------------------
   25|    532|  for (int i = n - 1; i > 0; --i) l[p[i]] += (l[i] += 1);
                                           ^531 ^531
  ------------------
  |  Branch (25:23): [True: 99.81%, False: 0.19%]
  ------------------
   26|      1|  l[0] = p[0] = n;
   27|    532|  for (int i = 1; i < n; ++i) {
                                       ^531
  ------------------
  |  Branch (27:19): [True: 99.81%, False: 0.19%]
  ------------------
   28|    531|    int j = p[i];
   29|    531|    int li = l[i];
   30|    531|    int lj = l[j];
   31|    531|    l[i] = p[i] = lj;
   32|    531|    l[j] -= li;
   33|    531|  }
   34|    533|  for (int i = 0; i < n; ++i) b[l[i]] = a[i];
                                       ^532 ^532
  ------------------
  |  Branch (34:19): [True: 99.81%, False: 0.19%]
  ------------------
   35|    533|  for (int i = 1; i <= n; ++i) b[i] += b[i - 1];
                                        ^532 ^532
  ------------------
  |  Branch (35:19): [True: 99.81%, False: 0.19%]
  ------------------
   36|    533|  for (int i = n; i >= 1; --i) b[i] -= b[i - (i & -i)];
                                        ^532 ^532
  ------------------
  |  Branch (36:19): [True: 99.81%, False: 0.19%]
  ------------------
   37|    814|  while (q--) {
  ------------------
  |  Branch (37:10): [True: 99.88%, False: 0.12%]
  ------------------
   38|    813|    let t = rd.u1();
   39|    813|    if (t == 0) {
  ------------------
  |  Branch (39:9): [True: 49.20%, False: 50.80%]
  ------------------
   40|    400|      int k = l[rd.uh()];
   41|    400|      int x = rd.uw();
   42|  2.58k|      for (; k <= n; k += k & -k) b[k] += x;
                                   ^2.18k       ^2.18k
  ------------------
  |  Branch (42:14): [True: 84.50%, False: 15.50%]
  ------------------
   43|    400|    }
   44|    813|    if (t == 1) {
  ------------------
  |  Branch (44:9): [True: 50.80%, False: 49.20%]
  ------------------
   45|    413|      int x = rd.uh();
   46|    413|      int L = l[x] - 1;
   47|    413|      int R = p[x];
   48|    413|      u64 sum = 0;
   49|  2.20k|      for (; L > 0; L -= L & -L) sum -= b[L];
                                  ^1.79k       ^1.79k
  ------------------
  |  Branch (49:14): [True: 81.30%, False: 18.70%]
  ------------------
   50|  2.29k|      for (; R > 0; R -= R & -R) sum += b[R];
                                  ^1.88k       ^1.88k
  ------------------
  |  Branch (50:14): [True: 82.00%, False: 18.00%]
  ------------------
   51|    413|      wt.ud(sum);
   52|    413|    }
   53|    813|  }
   54|      1|  return 0;
   55|      1|}