Rosetta Problems

Problem B

https://atcoder.jp/contests/hokudai-hitachi2019-1/tasks/hokudai_hitachi2019_1_b