Rosetta Problems

Problem 2

https://atcoder.jp/contests/hokudai-hitachi2017-2/tasks/hitachi2017_2_a