AmazonOA #368
Get Discount Pairs
估计中等可在线判题
Count the index pairs i<j such that prices[i]+prices[j] is divisible by x. Items have their own identities, so repeated prices can form several pairs, and an item cannot be paired with itself.
输入格式
The first line contains n x and the second line contains n prices. The original bounds are 1≤n≤100000, 1≤x≤2×10^9, prices[i]≥1. Only the superscript 9 of the original upper bound on prices survives and its base is missing, so this site explicitly adds price≤10^9 and does not claim this restores the original upper bound.
输出格式
Output a single integer, the answer.
样例 1
输入:
5 60
31 25 85 29 35
输出:
3
样例 2
输入:
3 2
1 1 1
输出:
3
样例 3
输入:
1 1
1
输出:
0
样例说明
The outputs of the three public examples are 3; 3; and 0, checked by independent enumeration or direct simulation.