Lang:G++
Edit123456789101112131415161718192021222324#include <cstdio>#include <cstdlib>#include <cstring>#include <iostream>#include <algorithm>using namespace std;long long solve(long long n){if(n==0) return 1;if(n%2==0) return solve(n>>1)+solve((n>>1)-1);else return solve(n>>1);}int main(){long long n;while(scanf("%lld",&n)!=EOF){printf("%lld\n",solve(n));}return 0;}