https://atcoder.jp/contests/practice2/tasks
1. Disjoint Set Union
from atcoder.dsu import DSU
n, q = map(int, input().split())
uf = DSU(n)
for qi in range(q):
t, a, b = map(int, input().split())
if t == 0:
uf.merge(a, b)
else:
if uf.same(a, b):
print(1)
else:
print(0)
2. Fenwick Tree
from atcoder.fenwicktree import FenwickTree
def read():
return map(int, input().split())
n, q = read()
a = list(read())
t = FenwickTree(n)
for i in range(n):
t.add(i, a[i])
for qi in range(q):
qs = list(read())
if qs[0] == 0:
t.add(qs[1], qs[2])
else:
print(t.sum(qs[1], qs[2]))
3. Floor Sum
from atcoder.math import floor_sum
def read():
return map(int, input().split())
t = int(input())
for ti in range(t):
n, m, a, b = read()
print(floor_sum(n, m, a, b))