fork download
  1. #include<iostream>
  2. #define ll long long int
  3. using namespace std;
  4. int main()
  5. {
  6. int t;
  7. cin>>t;
  8. while(t--)
  9. {
  10. ll N;
  11. int c=0;
  12. cin>>N;
  13. while(N)
  14. {
  15. c++;
  16. N=N&(N-1);
  17. }
  18. cout<<c<<endl;
  19. }
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 4236KB
stdin
Standard input is empty
stdout
Standard output is empty