Rosetta Problems

ロストテクノロジー

https://atcoder.jp/contests/kupc2018/tasks/kupc2018_d