484A. Bits
This task is mainly about using ‘|’ (按位或), which can guanrantee the number of '1' to be maximum.
The source code is relatively easy.
n = input()
for i in xrange(n):
l, r = map(int, raw_input().split())
while (l | (l + 1) <= r):
l |= l + 1
print l