Rosetta Problems

Finite Encyclopedia of Integer Sequences

https://atcoder.jp/contests/arc084/tasks/arc084_c