fork download
  1. #include <cmath>
  2. #include <cstdio>
  3. #include <vector>
  4. #include <iostream>
  5. #include <algorithm>
  6. using namespace std;
  7.  
  8. int main() {
  9. vector<long> arr={1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152};
  10. int t;
  11. cin>>t;
  12.  
  13. while(t--){
  14. long n,k;
  15. cin>>n>>k;
  16. if(n==0){
  17. cout<<k<<endl;
  18. continue;
  19. }
  20. long count=0;
  21. vector<long> ele(n,0);
  22. for(int i=0;i<n;i++){
  23. cin>>ele[i];
  24. long p = ele[i];
  25. for(int j=0;j<arr.size();j++){
  26. if(p==arr[j])
  27. {count++;}
  28. }
  29.  
  30. }
  31.  
  32. cout<<k-count<<endl;
  33. }
  34.  
  35. return 0;
  36. }
  37.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty