/tmp/solutions/build/unionfind-main.cpp:
    1|       |#include <common.h>
    2|       |prelude;
    3|       |
    4|       |namespace {
    5|       |
    6|       |int pa[200000];
    7|       |
    8|     14|def find(int u) -> int {
    9|     14|  int w = pa[u], v;
   10|     14|  if (w < 0) return u;
                           ^9
  ------------------
  |  Branch (10:7): [True: 64.29%, False: 35.71%]
  ------------------
   11|      5|  while (pa[w] >= 0) w = pa[w];
                                   ^0
  ------------------
  |  Branch (11:10): [True: 0.00%, False: 100.00%]
  ------------------
   12|      5|  while (pa[u] != w) v = u, u = pa[u], pa[v] = w;
                                   ^0
  ------------------
  |  Branch (12:10): [True: 0.00%, False: 100.00%]
  ------------------
   13|      5|  return w;
   14|     14|};
   15|       |
   16|       |} // namespace
   17|       |
   18|      1|int main() {
   19|      1|  rd rd;
   20|      1|  wt wt;
   21|      1|  int n = rd.uh();
   22|      1|  int q = rd.uh();
   23|      1|  std::memset(pa, -1, 4 * n);
   24|      8|  while (q--) {
  ------------------
  |  Branch (24:10): [True: 87.50%, False: 12.50%]
  ------------------
   25|      7|    let t = rd.u1();
   26|      7|    let u = find(rd.uh());
   27|      7|    let v = find(rd.uh());
   28|      7|    if (t == 0 && u != v) {
                                ^3
  ------------------
  |  Branch (28:9): [True: 42.86%, False: 57.14%]
  |  Branch (28:19): [True: 100.00%, False: 0.00%]
  ------------------
   29|      3|      if (pa[u] < pa[v])
  ------------------
  |  Branch (29:11): [True: 0.00%, False: 100.00%]
  ------------------
   30|      0|        pa[v] = u;
   31|      3|      else if (pa[v] < pa[u])
  ------------------
  |  Branch (31:16): [True: 0.00%, False: 100.00%]
  ------------------
   32|      0|        pa[u] = v;
   33|      3|      else
   34|      3|        pa[u] = v, --pa[v];
   35|      3|    }
   36|      7|    if (t == 1) {
  ------------------
  |  Branch (36:9): [True: 57.14%, False: 42.86%]
  ------------------
   37|      4|      wt.u1(u == v);
   38|      4|    }
   39|      7|  }
   40|      1|  return 0;
   41|      1|}