C++
Lets assume,\nA -> 101011\nB ->  100011\n\nset bits in A&B = no_of_set_bits(B);\nset bits in A|B = no_of_set_bits(A);\n\nTotal Set Bits = ( A&B + A|B )  = ( no_
Lets assume,\nA -> 101011\nB ->  100011\n\nset bits in A&B = no_of_set_bits(B);\nset bits in A|B = no_of_set_bits(A);\n\nTotal Set Bits = ( A&B + A|B )  = ( no_of_set_bits(B) + no_of_set_bits(A) );\n\n\n```\nlong long countExcellentPairs(vector<int>& nums, int k) {\n        unordered_map<int,set<int>> umap;\n        for(auto i:nums){\n            int a = __builtin_popcount(i);\n            umap[a].insert(i);\n        }\n        long long ans=0;\n        for(auto& i:umap){\n            for(auto& j:umap){\n                if((i.first+j.first)>=k){                 \n                    int n1 = i.second.size();\n                    int n2 = j.second.size();\n                    ans+= (n1*n2);\n                }\n            }\n        }\n        return ans;\n    }\n};\n
['C']