Given an array of integers and a positive integer $\boldsymbol{\mbox{k}}$, determine the number of $(i,j)$ pairs where $i<j$ and $ar[i]$ + $ar[j]$ is divisible by $\boldsymbol{\mbox{k}}$.  

Example  

$ar=[1,2,3,4,5,6]$ 

$k=5$   

Three pairs meet the criteria:  $[1,4],[2,3],$ and $[4,6]$.  

Function Description

Complete the divisibleSumPairs function in the editor below.   

divisibleSumPairs has the following parameter(s):  

int n: the length of array $\boldsymbol{ar}$  
int ar[n]: an array of integers  
int k: the integer divisor   

Returns 

-   int: the number of pairs  

Input Format

The first line contains $2$ space-separated integers, $n$ and $\boldsymbol{\mbox{k}}$. 

The second line contains $n$ space-separated integers, each a value of $arr\left[i\right]$.  

Constraints

$2\leq n\leq100$
$1\leq k\leq100$
$1\leq ar[i]\leq100$

Sample Input
STDIN           Function
-----           --------
6 3             n = 6, k = 3
1 3 2 6 1 2     ar = [1, 3, 2, 6, 1, 2]

Sample Output
 5

Explanation

Here are the $5$ valid pairs when $k=3$: 

$(0,2)\rightarrow ar[0]+ar[2]=1+2=3$   
$(0,5)\rightarrow ar[0]+ar[5]=1+2=3$   
$(1,3)\rightarrow ar[1]+ar[3]=3+6=9$   
$(2,4)\rightarrow ar[2]+ar[4]=2+1=3$   
$(4,5)\rightarrow ar[4]+ar[5]=1+2=3$

Difficulty: EASY

Solutions:
import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
result = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if not (a[i] + a[j]) % k:
			result += 1
print(result)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
count = 0
for i in range(len(a)):
	for j in range(i + 1, len(a)):
		if (a[i] + a[j]) % k == 0:
			count += 1
print(count)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
ans = sum((1 for i in range(n) for j in range(i + 1, n) if (a[i] + a[j]) % k == 0))
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			ans += 1
print(ans)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
counter = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			counter += 1
print(counter)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
acc = 0
for (i, e) in enumerate(a):
	for j in range(i + 1, len(a)):
		acc += (e + a[j]) % k == 0
print(acc)


import sys
count = 0
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			count += 1
print(count)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
total = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		total += (a[i] + a[j]) % k == 0
print(total)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
c = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			c += 1
print(c)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
qt = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			qt += 1
print(qt)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
c = 0
for j in range(1, n):
	for i in range(j):
		if (a[i] + a[j]) % k == 0:
			c += 1
print(c)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
c = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			c += 1
print(c)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
count = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			count += 1
print(count)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
res = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			res += 1
print(res)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
count = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			count += 1
print(count)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
count = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			count += 1
print(count)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
total = 0
for (i, x) in enumerate(a):
	for y in a[i + 1:]:
		if (x + y) % k == 0:
			total += 1
print(total)


import sys
(n, k) = input().split()
(n, k) = [int(n), int(k)]
a = [int(x) for x in input().split()]
count = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			count += 1
print(count)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
total = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			total += 1
print(total)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
sum_total = 0
for i in range(len(a) - 1):
	for j in range(i + 1, len(a)):
		if (a[i] + a[j]) % k == 0:
			sum_total += 1
print(sum_total)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
count = 0
for i in range(len(a) - 1):
	for j in range(i + 1, len(a)):
		if (a[i] + a[j]) % k == 0:
			count += 1
print(count)


(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
arr = []
for i in range(n):
	for j in range(i + 1, n):
		arr.append(a[i] + a[j])
ans = 0
for x in arr:
	if x % k == 0:
		ans += 1
print(ans)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
pairs = i = 0
while i < n - 1:
	j = i + 1
	while j < n:
		if (a[i] + a[j]) % k == 0:
			pairs += 1
		j += 1
	i += 1
print(pairs)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
co = 0
for i in range(len(a)):
	for j in range(i + 1, len(a)):
		if (a[i] + a[j]) % k == 0:
			co += 1
print(co)


import sys
(n, k) = list(map(int, input().strip().split(' ')))
a = list(map(int, input().split()))
count = 0
for i in range(n):
	a_i = a[i]
	for j in range(i + 1, n):
		a_j = a[j]
		if (a_i + a_j) % k == 0:
			count += 1
print(count)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
cnt = 0
for i in range(n):
	for j in range(i + 1, n):
		cnt += 1 if (a[i] + a[j]) % k == 0 else 0
print(cnt)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
sol = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			sol += 1
print(sol)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
counter = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			counter += 1
print(counter)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
res = 0
j = len(a)
for (i, l) in enumerate(a):
	while i < j - 1:
		i += 1
		if (l + a[i]) % k == 0:
			res += 1
print(res)


(N, K) = map(int, input().split())
A = [int(a) for a in input().split()]
ans = 0
for i in range(N - 1):
	for j in range(i + 1, N):
		if (A[i] + A[j]) % K == 0:
			ans += 1
print(ans)


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
ans = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			ans += 1
print(ans)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
l = len(a)
res = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			res += 1
print(res)


(n, k) = map(int, input().split())
a = sorted(map(int, input().split()))
ans = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			ans += 1
print(ans)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
out = 0
for i in range(0, n - 1):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			out = out + 1
print(out)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
count = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			count += 1
print(count)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
A = [int(a_temp) for a_temp in input().strip().split(' ')]
ans = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if (A[i] + A[j]) % k == 0:
			ans += 1
print(ans)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
pairs = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			pairs += 1
print(pairs)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
count = 0
for i in range(len(a)):
	for j in a[i + 1:]:
		if (a[i] + j) % k == 0:
			count += 1
print(count)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
count = 0
for i in range(len(a)):
	for j in range(len(a)):
		if i < j and (a[i] + a[j]) % k == 0:
			count += 1
print(count)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
r = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			r += 1
print(r)


(n, k) = [int(t) for t in input().strip().split(' ')]
arr = [int(t) for t in input().strip().split(' ')]
c = 0
for x in range(0, n - 1):
	for y in range(x + 1, n):
		if (arr[x] + arr[y]) % k == 0:
			c += 1
print(c)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
pairs = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			pairs += 1
print(pairs)


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
r = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			r += 1
print(r)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
count = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			count += 1
print(count)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
total = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			total += 1
print(total)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
res = 0
for j in range(n):
	for i in range(j + 1, n):
		if (a[i] + a[j]) % k == 0:
			res += 1
print(res)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
res = 0
for j in range(n):
	for i in range(j):
		if (a[i] + a[j]) % k == 0:
			res += 1
print(res)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
c = 0
for i in range(n):
	for j in range(i + 1, n):
		t = (a[i] + a[j]) % k
		if t == 0:
			c += 1
print(c)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
count = 0
for x in range(len(a)):
	for y in range(x + 1, len(a)):
		if (a[x] + a[y]) % k is 0:
			count += 1
print(count)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
a.sort()
count = 0
for lower in range(n - 1):
	for higher in range(lower + 1, n):
		if (a[lower] + a[higher]) % k == 0:
			count += 1
print(count)


from itertools import combinations
(n, k) = map(int, input().split())
a = map(int, input().split())
print(sum(((i + j) % k == 0 for (i, j) in combinations(a, 2))))


import sys
count = 0
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
for i in range(len(a)):
	for j in range(i + 1, len(a)):
		if (a[i] + a[j]) % k == 0:
			count += 1
print(count)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
count = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if (l[i] + l[j]) % k == 0:
			count += 1
print(count)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
s = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			s += 1
print(s)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
count = 0
for j in range(n):
	for i in range(j):
		if (a[i] + a[j]) % k == 0:
			count += 1
print(count)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
for i in a:
	i = i % k
total = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			total += 1
print(total)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
count = 0
for i in range(len(a)):
	for j in range(i + 1, len(a)):
		if (a[i] + a[j]) % k == 0:
			count += 1
print(count)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
a.sort()
count = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			count += 1
print(count)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
ans = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			ans += 1
print(ans)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
c = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if not (a[i] + a[j]) % k:
			c += 1
print(c)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
c = 0
for i in range(len(a)):
	for j in range(i + 1, len(a)):
		if (a[i] + a[j]) % k == 0:
			c += 1
print(c)


import sys
(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
result = 0
for ii in range(len(a)):
	i = a[ii]
	for yy in range(ii + 1, len(a)):
		j = a[yy]
		if (i + j) % k == 0:
			result += 1
print(result)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
pairs = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			pairs += 1
print(pairs)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
result = 0
for j in range(1, n):
	for i in range(j):
		if (a[i] + a[j]) % k == 0:
			result += 1
print(result)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
length = len(a)
counter = 0
for i in range(length):
	for j in range(i + 1, length):
		if (a[i] + a[j]) % k == 0:
			counter += 1
print(counter)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
ans = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			ans += 1
print(ans)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
ret = 0
for i in range(len(a) - 1):
	for j in range(i + 1, len(a)):
		if (a[i] + a[j]) % k == 0:
			ret += 1
print(ret)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
ans = 0
for i in range(len(a)):
	for j in range(i, len(a)):
		if j > i and (a[i] + a[j]) % k == 0:
			ans += 1
print(ans)


(n, k) = map(int, input().split(' '))
a = [int(i) for i in input().split(' ')]
pairs = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			pairs += 1
print(pairs)


(n, k) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
c = 0
for i in range(len(a) - 1):
	for j in range(i + 1, len(a)):
		if (a[i] + a[j]) % k == 0:
			c = c + 1
print(c)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
c = 0
for i in range(len(a) - 1):
	for j in range(i, len(a)):
		if (a[i] + a[j]) % k == 0 and i < j:
			c = c + 1
print(c)


import sys
c = 0
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
for i in range(n):
	for j in range(i + 1, n):
		if i < j:
			if (a[i] + a[j]) % k == 0:
				c += 1
print(c)


(n, k) = map(int, input().strip().split())
a = [int(i) for i in input().strip().split()]
ret = 0
for i in range(0, n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			ret = ret + 1
print(ret)


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
hlp = [0 for x in range(k)]
cnt = 0
for i in range(n):
	val = a[i] % k
	cnt += hlp[(k - val) % k]
	hlp[val] += 1
print(cnt)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
output = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			output += 1
print(output)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
counter = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			counter += 1
print(counter)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
count = 0
for i in range(len(a) - 1):
	for j in range(i + 1, len(a)):
		if (a[i] + a[j]) % k == 0:
			count += 1
print(count)


import sys

def divEven(a, k):
	n = 0
	for i in range(len(a)):
		j = i + 1
		while j < len(a):
			if (a[i] + a[j]) % k == 0:
				n += 1
			j += 1
	print(n)
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
divEven(a, k)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
count = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			count += 1
print(count)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
count = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if (arr[i] + arr[j]) % k == 0:
			count += 1
print(count)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
count = 0
for (i, num) in enumerate(a):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			count += 1
print(count)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
rest = [0] * k
ans = 0
for x in a:
	ans += rest[(k - x % k) % k]
	rest[x % k] += 1
print(ans)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
count = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			count += 1
print(count)


from sys import stderr

def logf(fmt, *args):
	print(fmt % args, file=stderr)

def readlist(f):
	return [f(x) for x in input().split()]
(N, K) = readlist(int)
A = readlist(int)
result = 0
for i in range(N):
	for j in range(i + 1, N):
		if (A[i] + A[j]) % K == 0:
			result += 1
print(result)


from itertools import combinations

def main():
	(n, k) = map(int, input().split())
	arr = map(int, input().split())
	print(sum([(x + y) % k == 0 for (x, y) in combinations(arr, 2)]))
main()


def divisible_sum_pairs(l, k):
	count = 0
	for (i, ai) in enumerate(l[:-1]):
		for aj in l[i + 1:]:
			if (ai + aj) % k == 0:
				count += 1
	return count

def test():
	(n, k) = (6, 3)
	l = [1, 3, 2, 6, 1, 2]
	n_good = divisible_sum_pairs(l, k)
	assert n_good == 5

def main():
	(n, k) = [int(i) for i in input().split()]
	l = [int(i) for i in input().split()]
	print(divisible_sum_pairs(l, k))
main()


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
counter = 0
for i in range(0, n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			counter += 1
print(counter)


import sys

def get_divisible_pairs(array, k):
	pair_counter = 0
	for i in range(0, len(array)):
		for j in range(i + 1, len(array)):
			sum = array[i] + array[j]
			if sum % k == 0:
				pair_counter += 1
	return pair_counter
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
print(get_divisible_pairs(a, k))


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
tot = 0
for i in range(len(a) - 1):
	for j in range(i + 1, len(a)):
		if (a[i] + a[j]) % k == 0:
			tot += 1
print(tot)


import sys
count = 0
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			count += 1
print(count)


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
cont = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if (A[i] + A[j]) % k == 0:
			cont += 1
print(cont)


import sys

def solve(a, k):
	count = 0
	for i in range(len(a)):
		for j in range(i + 1, len(a)):
			v = a[i] + a[j]
			if v % k == 0:
				count += 1
	return count
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
print(solve(a, k))


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
total = 0
for i in range(len(a)):
	for j in range(len(a)):
		if i < j and (a[i] + a[j]) % k == 0:
			total += 1
print(total)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
count = 0
for i in range(n):
	for j in range(i + 1, n):
		if (a[i] + a[j]) % k == 0:
			count += 1
print(count)


import sys
from itertools import combinations
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
cases = combinations(range(len(a)), 2)
counter = 0
for c in cases:
	if (a[c[0]] + a[c[1]]) % k == 0:
		counter += 1
print(counter)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
nbOcc = 0
for i in range(len(a) - 1):
	for j in range(len(a)):
		if i < j:
			if (a[i] + a[j]) % k == 0:
				nbOcc += 1
print(nbOcc)


import sys
import itertools as it
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
x = list(it.combinations(range(n), 2))
mylist = []
[mylist.append(r) for r in x if (a[r[0]] + a[r[1]]) % k == 0]
print(len(mylist))


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
result = 0
index = 0
for i in a:
	index += 1
	for j in a[index:]:
		if (j + i) % k == 0:
			result += 1
print(result)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
pairs = []
for j in range(n):
	for i in range(j):
		pairs.append([a[i], a[j]])
pocet = 0
for i in pairs:
	zvysok = (i[0] + i[1]) % k
	if zvysok == 0:
		pocet = pocet + 1
print(pocet)