eolymp
bolt
Try our new interface for solving problems
Problems

Divisible Sum Pairs

Divisible Sum Pairs

You are given an array of integers $A = (a_0, a_1, ..., a_{n-1})$ and a positive integer $k$. Find and print the number of pairs $(i, j)$ where $i < j$ and $a_i + a_j$ is divisible by $k$. \InputFile The first line contains integer $n~(2 \le n, k \le 100)$ and $k$. The second line contains $n$ integers describing the values of $A = (a_0, a_1, ..., a_{n-1})~(1 \le a_i \le 100)$. \OutputFile Print the number of pairs $(i, j)$ where $i < j$ and $a_i + a_j$ is divisible by $k$.
Time limit 1 second
Memory limit 128 MiB
Input example #1
6 3
1 3 2 6 1 2
Output example #1
5