Accepted C++ solution
class Solution {\npublic:\n    int countPairs(vector& nums, int k) {\n        int ans=0;\n        for(int i=0;i<nums.size();i++){\n            for(int j=i+1;j<n
class Solution {\npublic:\n    int countPairs(vector<int>& nums, int k) {\n        int ans=0;\n        for(int i=0;i<nums.size();i++){\n            for(int j=i+1;j<nums.size();j++){\n                if(nums[i]==nums[j]   &&  (i*j)%k==0){\n                    ans++;\n                }\n            }\n        }\n        return ans;\n    }\n};
['C']