cpp
\nclass Solution {\npublic:\n    int countPairs(vector<int>& nums, int k) \n    {\n        \n       int count=0;\n        for(int i=0;i<nums.size()-1;i++)\n    
```\nclass Solution {\npublic:\n    int countPairs(vector<int>& nums, int k) \n    {\n        \n       int count=0;\n        for(int i=0;i<nums.size()-1;i++)\n        {\n            for(int j=i+1;j<nums.size();j++)\n            {\n                if(nums[i]==nums[j]&&(i*j)%k==0)\n                {\n                    count++;\n                }\n            }\n        }\n        return count;\n    }\n};\n```
[]