apple pie's submission of Make all equal using Pairs | CodeChef