#K36617. Pair Sum Divisibility
Pair Sum Divisibility
Pair Sum Divisibility
You are given an array of N integers A and an integer K. Your task is to count the number of pairs (i, j) with i < j such that the sum A[i] + A[j] is divisible by K. In other words, count the number of pairs satisfying
$$ A[i] + A[j] \equiv 0 \pmod{K} $$
The input is read from standard input (stdin) and the result should be output to standard output (stdout).
inputFormat
The first line contains two integers N and K, separated by a space. The second line contains N space-separated integers representing the array A.
outputFormat
Output a single integer: the number of pairs (i, j) such that A[i] + A[j] is divisible by K.## sample
5 4
1 2 3 4 5
2