_Sam's submission of Counting The Important Pairs | CodeChef