Rosetta Problems

AtCoder 10th Anniversary

https://atcoder.jp/contests/ahc012/tasks/ahc012_a