Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int, input().split())
k = 0

while True:
    if 2**(k-1) <= B < 2**k:
        break
    k += 1


def sum_xor(n):
    res = []
    for i in range(k):
        if i == 0:
            res.append(1) if n % 4 == 1 or n % 4 == 2 else res.append(0)
        else:
            nmod = n % (2 ** (i + 1))
            if (2**(i+1))/2 <= nmod < 2**(i+1) and nmod % 2 == 0:
                res.append(1)
            else:
                res.append(0)
    res.reverse()
    return res


ax = sum_xor(A-1)
bx = sum_xor(B)

ans = []
for j in range(k):
    ans.append(1) if (ax[j] + bx[j]) % 2 == 1 else ans.append(0)

ans = "".join(map(str, ans))
print(int(ans, 2))


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

while True:
    if B == 0:
        break
    if 2**(k-1) <= B < 2**k:
        break
    k += 1


def sum_xor(n):
    res = []
    for i in range(k):
        if i == 0:
            res.append(1) if n % 4 == 1 or n % 4 == 2 else res.append(0)
        else:
            nmod = n % (2 ** (i + 1))
            if (2**(i+1))/2 <= nmod < 2**(i+1) and nmod % 2 == 0:
                res.append(1)
            else:
                res.append(0)
            # odd = [2**i+2*j for j in range(2**(i-1))]
            # tmp = n % 2**(i+1)
            # res.append(1) if tmp in odd else res.append(0)
    res.reverse()
    return res


ax = sum_xor(A-1)
bx = sum_xor(B)

ans = []
for j in range(k):
    ans.append(1) if (ax[j] + bx[j]) % 2 == 1 else ans.append(0)

ans = "".join(map(str, ans))
print(int(ans, 2))

Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int, input().split())
k = 0

while True:
    if 2**(k-1) <= B < 2**k:
        break
    k += 1


def sum_xor(n):
    res = []
    for i in range(k):
        if i == 0:
            res.append(1) if n % 4 == 1 or n % 4 == 2 else res.append(0)
        else:
            nmod = n % 2 ** (i + 1)
            if (2**(i+1))/2 <= nmod < 2**(i+1) and nmod % 2 == 0:
                res.append(1)
            else:
                res.append(0)
    res.reverse()
    return res


ax = sum_xor(A-1)
bx = sum_xor(B)

ans = []
for i in range(k):
    ans.append(1) if (ax[i] + bx[i]) % 2 == 1 else ans.append(0)

ans = "".join(map(str, ans))
print(int(ans, 2))


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

while True:
    if B == 0:
        break
    if 2**(k-1) <= B < 2**k:
        break
    k += 1


def sum_xor(n):
    res = []
    for i in range(k):
        if i == 0:
            res.append(1) if n % 4 == 1 or n % 4 == 2 else res.append(0)
        else:
            nmod = n % (2 ** (i + 1))
            if (2**(i+1))/2 <= nmod < 2**(i+1) and nmod % 2 == 0:
                res.append(1)
            else:
                res.append(0)
            # odd = [2**i+2*j for j in range(2**(i-1))]
            # tmp = n % 2**(i+1)
            # res.append(1) if tmp in odd else res.append(0)
    res.reverse()
    return res


ax = sum_xor(A-1)
bx = sum_xor(B)

ans = []
for j in range(k):
    ans.append(1) if (ax[j] + bx[j]) % 2 == 1 else ans.append(0)

ans = "".join(map(str, ans))
print(int(ans, 2))

Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int, input().split())
k = 0

while True:
    if 2**(k-1) <= B < 2**k:
        break
    k += 1


def sum_xor(n):
    res = []
    for i in range(k):
        if i == 0:
            res.append(1) if n % 4 == 1 or n % 4 == 2 else res.append(0)
        else:
            nmod = n % 2 ** (i + 1)
            if (2**(i+1))/2 <= nmod < 2**(i+1) and nmod % 2 == 0:
                res.append(1)
            else:
                res.append(0)
            # odd = [2**i+2*j for j in range(2**(i-1))]
            # tmp = n % 2**(i+1)
            # res.append(1) if tmp in odd else res.append(0)
    res.reverse()
    return res


ax = sum_xor(A-1)
bx = sum_xor(B)

ans = []
for i in range(k):
    ans.append(1) if (ax[i] + bx[i]) % 2 == 1 else ans.append(0)

ans = "".join(map(str, ans))
print(int(ans, 2))


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

while True:
    if B == 0:
        break
    if 2**(k-1) <= B < 2**k:
        break
    k += 1


def sum_xor(n):
    res = []
    for i in range(k):
        if i == 0:
            res.append(1) if n % 4 == 1 or n % 4 == 2 else res.append(0)
        else:
            nmod = n % (2 ** (i + 1))
            if (2**(i+1))/2 <= nmod < 2**(i+1) and nmod % 2 == 0:
                res.append(1)
            else:
                res.append(0)
            # odd = [2**i+2*j for j in range(2**(i-1))]
            # tmp = n % 2**(i+1)
            # res.append(1) if tmp in odd else res.append(0)
    res.reverse()
    return res


ax = sum_xor(A-1)
bx = sum_xor(B)

ans = []
for j in range(k):
    ans.append(1) if (ax[j] + bx[j]) % 2 == 1 else ans.append(0)

ans = "".join(map(str, ans))
print(int(ans, 2))