Rosetta Problems

Ball in the Box 2

https://atcoder.jp/contests/tkppc6-2/tasks/tkppc6_2_k