Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int, input().split())
ans = 0
cnt = 0
def f(arg):
    ans = 0
    for pos in range(40):
        v = 1 << pos
        if v > arg:
            break
        cnt = sum([int((n & v) / v) for n in range(arg+1)])
        ans += cnt%2 * v
    return ans
print(f(A-1)^f(B))


Fixed submission:
A, B = map(int, input().split())
ans = 0
cnt = 0
def f(arg):
    ans = 0
    if arg < 0:
        return 0
    for pos in range(1, 41):
        # ループする数
        loop = 1 << pos
        # cnt = sum([int((n & v) / v) for n in range(arg+1)])
        cnt = int((arg + 1) / loop) * (loop >> 1)
        cnt += max(0, (arg + 1) % (loop) - (loop >> 1))
        ans += cnt%2 * (loop>>1)
        # print(arg, pos, loop, cnt, ans)
        if loop > arg:
            break
    return ans
print(f(A-1)^f(B))

Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int, input().split())
ans = 0
cnt = 0
def f(arg):
    ans = 0
    for pos in range(40):
        v = 1 << pos
        if v > arg:
            break
        cnt = sum([(n & v) / v for n in range(arg+1)])
        ans += int(cnt%2) << pos
        # print(pos, v, cnt, ans)
    return ans
print(f(A-1)^f(B))


Fixed submission:
A, B = map(int, input().split())
ans = 0
cnt = 0
def f(arg):
    ans = 0
    if arg < 0:
        return 0
    for pos in range(1, 41):
        # ループする数
        loop = 1 << pos
        # cnt = sum([int((n & v) / v) for n in range(arg+1)])
        cnt = int((arg + 1) / loop) * (loop >> 1)
        cnt += max(0, (arg + 1) % (loop) - (loop >> 1))
        ans += cnt%2 * (loop>>1)
        # print(arg, pos, loop, cnt, ans)
        if loop > arg:
            break
    return ans
print(f(A-1)^f(B))

Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
ans = 0
cnt = 0
def f(arg):
    ans = 0
    for pos in range(40):
        v = 1 << pos
        if v > arg:
            break
        cnt = sum([(n & v) / v for n in range(arg+1)])
        ans += int(cnt%2) << pos
        # print(pos, v, cnt, ans)
    return ans
print(f(A-1)^f(B))


Fixed submission:
A, B = map(int, input().split())
ans = 0
cnt = 0
def f(arg):
    ans = 0
    if arg < 0:
        return 0
    for pos in range(1, 41):
        # ループする数
        loop = 1 << pos
        # cnt = sum([int((n & v) / v) for n in range(arg+1)])
        cnt = int((arg + 1) / loop) * (loop >> 1)
        cnt += max(0, (arg + 1) % (loop) - (loop >> 1))
        ans += cnt%2 * (loop>>1)
        # print(arg, pos, loop, cnt, ans)
        if loop > arg:
            break
    return ans
print(f(A-1)^f(B))

Buggy python submission (verdict: Runtime Error):
A, B = map(int, raw_input().split())
ans = 0
cnt = 0

for pos in range(40):
    v = 1 << pos
    if v > B:
        break
    cnt = [(n & v) / v for n in range(A, B+1)]
    ans += sum(cnt)%2 << pos
    # print(pos, v, cnt, ans)
print(ans)


Fixed submission:
A, B = map(int, input().split())
ans = 0
cnt = 0
def f(arg):
    ans = 0
    if arg < 0:
        return 0
    for pos in range(1, 41):
        # ループする数
        loop = 1 << pos
        # cnt = sum([int((n & v) / v) for n in range(arg+1)])
        cnt = int((arg + 1) / loop) * (loop >> 1)
        cnt += max(0, (arg + 1) % (loop) - (loop >> 1))
        ans += cnt%2 * (loop>>1)
        # print(arg, pos, loop, cnt, ans)
        if loop > arg:
            break
    return ans
print(f(A-1)^f(B))

Buggy python submission (verdict: Runtime Error):
A, B = map(long, raw_input().split())
ans = 0
msb = B >> (B.bit_length()-1) << (B.bit_length() - 1)
if msb + A > B:
    begin = B
    end = A
else:
    begin = B
    end = msb + A
for i in range(begin, end - 1, -1):
    ans ^= i
if (B - A) % 2 == 1:
    ans += msb
print(ans)


Fixed submission:
A, B = map(int, input().split())
ans = 0
cnt = 0
def f(arg):
    ans = 0
    if arg < 0:
        return 0
    for pos in range(1, 41):
        # ループする数
        loop = 1 << pos
        # cnt = sum([int((n & v) / v) for n in range(arg+1)])
        cnt = int((arg + 1) / loop) * (loop >> 1)
        cnt += max(0, (arg + 1) % (loop) - (loop >> 1))
        ans += cnt%2 * (loop>>1)
        # print(arg, pos, loop, cnt, ans)
        if loop > arg:
            break
    return ans
print(f(A-1)^f(B))

Buggy python submission (verdict: Runtime Error):
A, B = map(long, raw_input().split())
ans = 0
msb = B >> (B.bit_length()-1) << (B.bit_length() - 1)
if msb + A > B:
    begin = B
    end = A
else:
    begin = B
    end = msb + A
for i in range(begin, end - 1, -1):
    ans ^= i
if A%2 ^ B%2:
    ans += msb
print(ans)


Fixed submission:
A, B = map(int, input().split())
ans = 0
cnt = 0
def f(arg):
    ans = 0
    if arg < 0:
        return 0
    for pos in range(1, 41):
        # ループする数
        loop = 1 << pos
        # cnt = sum([int((n & v) / v) for n in range(arg+1)])
        cnt = int((arg + 1) / loop) * (loop >> 1)
        cnt += max(0, (arg + 1) % (loop) - (loop >> 1))
        ans += cnt%2 * (loop>>1)
        # print(arg, pos, loop, cnt, ans)
        if loop > arg:
            break
    return ans
print(f(A-1)^f(B))

Buggy python submission (verdict: Runtime Error):
A, B = map(long, raw_input().split())
ans = 0
msb = B >> (B.bit_length()-1) << (B.bit_length() - 1)
if msb + A > B:
    pos = A
else:
    pos = msb + A
for i in range(B, A-1, -1):
    ans ^= i
print(ans)


Fixed submission:
A, B = map(int, input().split())
ans = 0
cnt = 0
def f(arg):
    ans = 0
    if arg < 0:
        return 0
    for pos in range(1, 41):
        # ループする数
        loop = 1 << pos
        # cnt = sum([int((n & v) / v) for n in range(arg+1)])
        cnt = int((arg + 1) / loop) * (loop >> 1)
        cnt += max(0, (arg + 1) % (loop) - (loop >> 1))
        ans += cnt%2 * (loop>>1)
        # print(arg, pos, loop, cnt, ans)
        if loop > arg:
            break
    return ans
print(f(A-1)^f(B))

Buggy python submission (verdict: Runtime Error):
A, B = map(long, raw_input().split())
ans = 0
for i in range(B, A-1, -1):
    ans ^= i
    if ((B - B >> 1) == i):
        print(ans)
        exit()
    # print(ans, i)
print(ans)


Fixed submission:
A, B = map(int, input().split())
ans = 0
cnt = 0
def f(arg):
    ans = 0
    if arg < 0:
        return 0
    for pos in range(1, 41):
        # ループする数
        loop = 1 << pos
        # cnt = sum([int((n & v) / v) for n in range(arg+1)])
        cnt = int((arg + 1) / loop) * (loop >> 1)
        cnt += max(0, (arg + 1) % (loop) - (loop >> 1))
        ans += cnt%2 * (loop>>1)
        # print(arg, pos, loop, cnt, ans)
        if loop > arg:
            break
    return ans
print(f(A-1)^f(B))

Buggy python submission (verdict: Runtime Error):
A, B = map(long, raw_input().split())
ans = 0
for i in range(A, B+1):
    ans ^= i
    # print(ans, i)
print(ans)


Fixed submission:
A, B = map(int, input().split())
ans = 0
cnt = 0
def f(arg):
    ans = 0
    if arg < 0:
        return 0
    for pos in range(1, 41):
        # ループする数
        loop = 1 << pos
        # cnt = sum([int((n & v) / v) for n in range(arg+1)])
        cnt = int((arg + 1) / loop) * (loop >> 1)
        cnt += max(0, (arg + 1) % (loop) - (loop >> 1))
        ans += cnt%2 * (loop>>1)
        # print(arg, pos, loop, cnt, ans)
        if loop > arg:
            break
    return ans
print(f(A-1)^f(B))

Buggy python submission (verdict: Runtime Error):
A, B = map(long, raw_input().split())
ans = 0
for i in range(A, B+1):
    ans ^= i
    # print(ans, i)÷
print(ans)


Fixed submission:
A, B = map(int, input().split())
ans = 0
cnt = 0
def f(arg):
    ans = 0
    if arg < 0:
        return 0
    for pos in range(1, 41):
        # ループする数
        loop = 1 << pos
        # cnt = sum([int((n & v) / v) for n in range(arg+1)])
        cnt = int((arg + 1) / loop) * (loop >> 1)
        cnt += max(0, (arg + 1) % (loop) - (loop >> 1))
        ans += cnt%2 * (loop>>1)
        # print(arg, pos, loop, cnt, ans)
        if loop > arg:
            break
    return ans
print(f(A-1)^f(B))

Buggy python submission (verdict: Runtime Error):
A, B = map(int, raw_input().split())
ans = 0
for i in range(A, B+1):
    ans ^= i
    # print(ans, i)
print(ans)


Fixed submission:
A, B = map(int, input().split())
ans = 0
cnt = 0
def f(arg):
    ans = 0
    if arg < 0:
        return 0
    for pos in range(1, 41):
        # ループする数
        loop = 1 << pos
        # cnt = sum([int((n & v) / v) for n in range(arg+1)])
        cnt = int((arg + 1) / loop) * (loop >> 1)
        cnt += max(0, (arg + 1) % (loop) - (loop >> 1))
        ans += cnt%2 * (loop>>1)
        # print(arg, pos, loop, cnt, ans)
        if loop > arg:
            break
    return ans
print(f(A-1)^f(B))