_Sam's submission of Sort the Leaves | CodeChef