#include <iostream>
#include <assert.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <string.h>
#include <cmath>
#include <memory.h>
#include <algorithm>
using namespace std;
typedef long long ll;
int bitCount(int i)
{
i = i - ((i >> 1) & 0x55555555);
i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}
int main()
{
clock_t T = clock();
ll s = 0;
for (int i = 0; i<250000000; ++i)
s += __builtin_popcount(i);
printf("%lld\n", s);
printf("%.3lf\n", double(clock() - T) / CLOCKS_PER_SEC);
T = clock();
s = 0;
for (int i = 0; i<250000000; ++i)
s += bitCount(i);
printf("%lld\n", s);
printf("%.3lf\n", double(clock() - T) / CLOCKS_PER_SEC);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YXNzZXJ0Lmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHRpbWUuaD4KI2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDx2ZWN0b3I+CiNpbmNsdWRlIDxzZXQ+CiNpbmNsdWRlIDxtYXA+CiNpbmNsdWRlIDxxdWV1ZT4KI2luY2x1ZGUgPHN0YWNrPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8c3RyaW5nLmg+CiNpbmNsdWRlIDxjbWF0aD4KI2luY2x1ZGUgPG1lbW9yeS5oPgojaW5jbHVkZSA8YWxnb3JpdGhtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwp0eXBlZGVmIGxvbmcgbG9uZyBsbDsKaW50IGJpdENvdW50KGludCBpKQp7CglpID0gaSAtICgoaSA+PiAxKSAmIDB4NTU1NTU1NTUpOwoJaSA9IChpICYgMHgzMzMzMzMzMykgKyAoKGkgPj4gMikgJiAweDMzMzMzMzMzKTsKCXJldHVybiAoKChpICsgKGkgPj4gNCkpICYgM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