I was solving 691E - Xor-sequences, and in the problem asked to find number of ones in binary representation of a number, I was using C++ STL __builtin_popcount() function to find Number of ones, but when I submitted I got wrong answer verdict, and then I wrote my own function to count Number of ones and then my solution passed. Can anyone explain to me why this is happening? My AC 69283580 code and WA 69283537 code.
int __builtin_popcount(unsigned int)
It returns the numbers of set bits in an integer (the number of ones in the binary representation of the integer). val is long long
Thanks, it was a stupid mistake.
Use __builtin_popcountll(x) for long long ints.
69284505 : Accepted code with __builtin_popcountll(x) in place of __builtin_popcount(x)
Ya man got it, Thanks.