apple pie's submission of Average Permutation | CodeChef