Rosetta Problems

Beans on the Grid

https://atcoder.jp/contests/kupc2020/tasks/kupc2020_h