fork(15) download
  1. // One zero, by Errichto
  2. // O(log^2(n))
  3. #include<bits/stdc++.h>
  4. using namespace std;
  5.  
  6. int main() {
  7. long long a, b;
  8. scanf("%lld%lld", &a, &b);
  9. int c = 0;
  10. for(int i = 0; (1LL << i) / 2 <= b; ++i)
  11. for(int j = 0; j <= i - 2; ++j) {
  12. long long x = (1LL << i) - 1 - (1LL << j);
  13. c += a <= x && x <= b;
  14. }
  15. printf("%d\n", c);
  16. return 0;
  17. }
Success #stdin #stdout 0s 3464KB
stdin
Standard input is empty
stdout
1711