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: import java.io.*;
import java.util.*;



class Main {
	 public static long subarraysDivByK(int[] A, int k)
    {
        long ans =0 ;
        int rem;
        int[] freq = new int[k];
        for(int i=0;i<A.length;i++)
        {
            rem = A[i]%k;

            ans += freq[(k - rem)% k] ;

            freq[rem]++;

        }

        return ans;
    }
	public static void main (String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] str = br.readLine().split(" ");
		String[] input = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int k = Integer.parseInt(str[1]);
      	int [] a = new int [n];
      	for(int i=0; i<n; i++)
         	a[i] = Integer.parseInt(input[i]);

		System.out.println(subarraysDivByK(a, k));



	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?