Rosetta Problems

AtCoder Group Contest

https://atcoder.jp/contests/agc012/tasks/agc012_a