Easy CPP Soln
Code\ncpp []\nclass Solution {\npublic:\n    long long gcd(long long a, long long b)\n    {\n        if(b==0)\n        {\n            return a;\n        }\n    
# Code\n```cpp []\nclass Solution {\npublic:\n    long long gcd(long long a, long long b)\n    {\n        if(b==0)\n        {\n            return a;\n        }\n        return gcd(b,a%b);\n    }\n    long long countPairs(vector<int>& nums, int k) \n    {\n        unordered_map<long long,long long>m;\n        long long c = 0;\n        for(auto val: nums)\n        {\n            long long hcf = gcd(k,val);\n            for(auto it=m.begin();it!=m.end();it++)\n            {\n                if((hcf*it->first)%k==0)\n                {\n                    c+=it->second;\n                }\n            }\n            m[hcf]++;\n        }\n        return c;\n    }\n};\n```
['C++']