class Solution
{
public:
long long countKdivPairs(int A[], int n, int K)
{
//code here
long ans=0;
unordered_map<int,int>m;
for(int i=0;i<n;i++)
{
int rem=A[i]%K;
if(rem!=0)
{
ans+=m[K-rem];
}
else ans+=m[0];
m[rem]++;
}
return ans;
}
};