Rosetta Problems

Takahashi in Narrow Road

https://atcoder.jp/contests/abc371/tasks/abc371_f