For this Question: Given an array of N integers and an integer K, your task is to calculate the count of pairs whose sum is divisible by K.The first line of input contains two integers N and K, the next line contains N space-separated integers depicting values of an array.

Constraints:-
1 < = N < = 100000
1 < = Arr[i] <= 100000
1 <= K <= 100000Print the count of required pairs.Sample Input
5 4
1 2 3 4 5

Sample Output
2

Sample Input
5 3
1 2 3 4 5

Sample Output
 4

Explanation:-
In Sample 2,
(1 5), (1 2), (2 4), and (4 5) are the required pairs, I have written this Solution Code: def countKdivPairs(A, n, K): 
    freq = [0] * K 
    for i in range(n): 
        freq[A[i] % K]+= 1
    sum = freq[0] * (freq[0] - 1) / 2; 
    i = 1
    while(i <= K//2 and i != (K - i) ): 
        sum += freq[i] * freq[K-i] 
        i+= 1
    if( K % 2 == 0 ): 
        sum += (freq[K//2] * (freq[K//2]-1)/2); 
    return int(sum) 
a,b=input().split()
a=int(a)
b=int(b)
arr=input().split()
for i in range(0,a):
	arr[i]=int(arr[i])
print (countKdivPairs(arr,a, b)), In this Programming Language: Python, Now tell me if this Code is compilable or not?