Easy Solution cpp
Please Upvote......\n```\nclass Solution {\npublic:\n    int countbits(int ele,long long &ans,int k){\n        int ct=0;\n        while(ele){\n            ct++;
**Please Upvote......**\n```\nclass Solution {\npublic:\n    int countbits(int ele,long long &ans,int k){\n        int ct=0;\n        while(ele){\n            ct++;\n            ele=ele&(ele-1);\n        }\n        \n        if(2*ct>=k)ans++;\n        \n        return ct;\n    }\n    \n    long long countExcellentPairs(vector<int>& nums, int k) {\n        long long ans=0;\n        \n        unordered_set<int>s;\n        for(auto ele:nums){\n            s.insert(ele);\n        }\n        \n        vector<int>v;\n        for(auto ele:s){\n            v.push_back(countbits(ele,ans,k));\n        }\n        \n        sort(v.begin(),v.end());\n        \n        int start=0,end=v.size()-1;\n        \n        while(start<end){\n            if(v[start]+v[end]>=k){\n                ans+=2*(end-start);\n                end--;\n            }\n            \n            else start++;\n        }\n        \n        return ans;\n    }\n};
['C++']