Rosetta Problems

Unionfind with Potential

https://judge.yosupo.jp/problem/unionfind_with_potential