This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io._ | |
import java.util._ | |
import java.math._ | |
class InputReader(stream: InputStream) | |
{ | |
val br : BufferedReader = new BufferedReader(new InputStreamReader(stream)) | |
var tokenizer : StringTokenizer = null | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _all5 0x55555555 | |
#define _all3 0x33333333 | |
#define _all0F 0x0F0F0F0F | |
#define _all01 0x01010101 | |
#define _to64(x) (((long long)x)<<32 + x) | |
int NumberOfSetBits64(long long i) | |
{ | |
i = i - ((i >> 1) & _to64(_all5)); | |
i = (i & _to64(_all3)) + ((i >> 2) & _to64(_all3)); |
NewerOlder