Buggy python submission (verdict: Runtime Error):
import math

A,B = (int(x) for x in input().split())

if A==B:
    print(A)
else:
    ans = 0
    if A*2 <= B+1 and B > 4:
        n = int(math.log2(A))
        m = int(math.log2(B))

        if n <= 1:
            for i in range(A,4):
                ans = ans ^ i
            A=4
            n=2
            
        if 2**n != A:
            n += 1
            for i in range(A,2**n):
                ans = ans ^ i

        for i in range(2**m,B+1):
            ans = ans ^ i

    else:
        for i in range(A,B+1):
            ans = ans ^ i

    print(ans)


Fixed submission:
A,B = map(int,input().split())

if A == B:
    print(A)
elif B - A == 1:
    print(A^B)
else:
    ans = 0
    if A % 2 != 0:
        ans ^= A
        A += 1
    if B % 2 == 0:
        ans ^= B
        B -= 1
    ans ^= ((B-A+1)//2)%2

    print(ans)

Buggy python submission (verdict: Runtime Error):
import math

A,B = (int(x) for x in input().split())

if A==B:
    print(A)
else:
    ans = 0
    if A*2 <= B+1 and B > 4:
        n = int(math.log2(A))
        m = int(math.log2(B))

        if n <= 1:
            for i in range(A,4):
                ans = ans ^ i
            A=4
            n=2
            
        if 2**n != A:
            n += 1
            ans = A
            for i in range(A+1,2**n):
                ans = ans ^ i

        for i in range(2**m,B+1):
            ans = ans ^ i

    else:
        for i in range(A+1,B+1):
            ans = ans ^ i

    print(ans)


Fixed submission:
A,B = map(int,input().split())

if A == B:
    print(A)
elif B - A == 1:
    print(A^B)
else:
    ans = 0
    if A % 2 != 0:
        ans ^= A
        A += 1
    if B % 2 == 0:
        ans ^= B
        B -= 1
    ans ^= ((B-A+1)//2)%2

    print(ans)

Buggy python submission (verdict: Runtime Error):
import math

A,B = (int(x) for x in input().split())

if A==B:
    print(A)
else:
    ans = 0
    if A*2 <= B-1 and B > 4:
        n = int(math.log2(A))
        m = int(math.log2(B))

        if n <= 1:
            for i in range(A,4):
                ans = ans ^ i
            A=4
            n=2
            
        if 2**n != A:
            n += 1
            ans = A
            for i in range(A+1,2**n):
                ans = ans ^ i

        for i in range(2**m,B+1):
            ans = ans ^ i

    else:
        for i in range(A+1,B+1):
            ans = ans ^ i

    print(ans)


Fixed submission:
A,B = map(int,input().split())

if A == B:
    print(A)
elif B - A == 1:
    print(A^B)
else:
    ans = 0
    if A % 2 != 0:
        ans ^= A
        A += 1
    if B % 2 == 0:
        ans ^= B
        B -= 1
    ans ^= ((B-A+1)//2)%2

    print(ans)

Buggy python submission (verdict: Runtime Error):
import math

A,B = (int(x) for x in input().split())

if A==B:
    print(A)
else:
    ans = 0
    if A*2 <= B and B > 4:
        n = int(math.log2(A))
        m = int(math.log2(B))

        if n <= 1:
            for i in range(A,4):
                ans = ans ^ i
            A=4
            n=2
            
        if 2**n != A:
            n += 1
            ans = A
            for i in range(A+1,2**n):
                ans = ans ^ i

        for i in range(2**m,B+1):
            ans = ans ^ i

    else:
        for i in range(A,B+1):
            ans = ans ^ i

    print(ans)

Fixed submission:
A,B = map(int,input().split())

if A == B:
    print(A)
elif B - A == 1:
    print(A^B)
else:
    ans = 0
    if A % 2 != 0:
        ans ^= A
        A += 1
    if B % 2 == 0:
        ans ^= B
        B -= 1
    ans ^= ((B-A+1)//2)%2

    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
A,B = (int(x) for x in input().split())

if A==B:
    print(A)
else:
    ans = A^(A+1)

    for i in range(A+2,B+1):
        ans = ans ^ i

    print(ans)

Fixed submission:
A,B = map(int,input().split())

if A == B:
    print(A)
elif B - A == 1:
    print(A^B)
else:
    ans = 0
    if A % 2 != 0:
        ans ^= A
        A += 1
    if B % 2 == 0:
        ans ^= B
        B -= 1
    ans ^= ((B-A+1)//2)%2

    print(ans)

Buggy python submission (verdict: Runtime Error):
A,B = (int(x) for x in input().split())

if A=B:
    print(A)
else:
    ans = A^(A+1)

    for i in range(A+2,B+1):
        ans = ans ^ i

    print(ans)

Fixed submission:
A,B = map(int,input().split())

if A == B:
    print(A)
elif B - A == 1:
    print(A^B)
else:
    ans = 0
    if A % 2 != 0:
        ans ^= A
        A += 1
    if B % 2 == 0:
        ans ^= B
        B -= 1
    ans ^= ((B-A+1)//2)%2

    print(ans)