Andrey Kim's submission of Restore the Permutation | CodeChef