C++ || Separately  solving smaller and larger numbers
\nclass Solution {\npublic:\n    long long countExcellentPairs(vector<int>& nums, int k) {\n        long long ans=0 , size=0  ;\n        unordered_map<int,int> 
```\nclass Solution {\npublic:\n    long long countExcellentPairs(vector<int>& nums, int k) {\n        long long ans=0 , size=0  ;\n        unordered_map<int,int> m;\n        vector<long long> v;\n        for(auto it : nums)\n        {\n           if(m[it]==0)\n           {\n               long long t=__builtin_popcount(it);\n               if(t<k)\n               v.emplace_back(t);\n               size++;\n           }\n            m[it]=1;\n        }\n        sort(v.begin(),v.end());\n        int n=v.size();\n        for(int i=0;i<n;i++)\n        {\n            long long x= k-v[i];\n            auto add =lower_bound(v.begin(), v.end(), x);\n            long long y= (add-v.begin());\n            ans+=(n-y);\n        }\n       // cout<<size<<" "<<n;\n        ans+= ((size-n)*n*2);\n        size=size-n;\n        ans+= size*(size-1);\n        ans+= size;\n        \n        return ans;\n        \n    }\n};\n```
[]