Rosetta Problems

Three Circuits

https://atcoder.jp/contests/agc032/tasks/agc032_c