Andrey Kim's submission of Fun with Rotation | CodeChef