fork(2) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define dbg(x) cout << #x << " : " << x << endl
  5. #define rep(i, a, b) for (int i = (a); i <= (b); i++)
  6. #define inf 1000000000000000000
  7. priority_queue<ll, vector<ll>, greater<int>> qp;
  8. priority_queue<ll> qr;
  9. #define maxn 100005
  10. #define mod 1000000007
  11. // #define __builtin_popcount cnt_ones
  12. ll po(ll a, ll n)
  13. {
  14. ll res = a, ans = 1;
  15. while (n)
  16. {
  17. if (n % 2)
  18. ans = ans * res;
  19. res = res * res;
  20. n /= 2;
  21. }
  22. return ans;
  23. }
  24. /**************TEMPLATES**********************/
  25.  
  26. int main()
  27. {
  28.  
  29. ll tc;
  30. cin >> tc;
  31. while (tc--)
  32. {
  33. ll n;
  34. cin >> n;
  35. ll res = __builtin_popcount(n);
  36. cout << po(2, res) << '\n';
  37. }
  38.  
  39. return 0;
  40. }
Success #stdin #stdout 0s 5636KB
stdin
Standard input is empty
stdout
Standard output is empty