Divisibility Testing

You will be given a list of n integers, < a1 a2 a3 ...an > and an integer k. Find out the number of ways of choosing 2 integers (ai,aj), such that ai ≤ aj and 1 ≤ i,j ≤ n and i ̸= j and (ai +aj) is divisible by k. Every pair must be distinct. Two pairs, (a, b) and (c, d), are equal if a is equal to c and b is equal to d. Suppose we are given 5 integers < 41223 > and k = 1. There are 7 ways of choosing different pairs that meets the above restrictions: (1, 2)(1, 3)(1, 4)(2, 2)(2, 3)(2, 4)(3, 4). Input The first line of input contains an integer T that determines the number of test cases. Each test case contains two lines. The first line consists of two integers n and k. The next line contains n integers. The i-th integer gives the value of ai. Output For each test case, output the case number followed by the number of ways to choose the pairs. Constraints • T < 100 • 1<n<100001 • 0<k<501 • |ai| < 10000001 for any i Sample Input 2 51 41223 52 41223 Sample Output Case 1: 7 Case 2: 3