Rosetta Problems

Strange Dance

https://atcoder.jp/contests/agc044/tasks/agc044_c