Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().split())

a = (4*Y-2*X)//6
b = (Y-2*X)//-3
if a == 0 and b == 0:
    print(0)
    import sys
    sys.exit()

from math import factorial
print(factorial(a+b)//factorial(a)*factorial(b)%(10e9+7))


Fixed submission:
X, Y = map(int, input().split())

MD = pow(10, 9) + 7

def choose(n, a):
    x, y = 1, 1
    for i in range(a):
        x = x * (n - i) % MD
        y = y * (i + 1) % MD
    return x * pow(y, MD - 2, MD) % MD


a = (2*Y-X)//3
b = (Y-2*X)//-3

if a < 0 or b < 0 or (X+Y) % 3 != 0:
    print(0)
    import sys
    sys.exit()

print(choose(a+b, min(a,b)))

Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().split())

# dp = [[0 for _ in range(X+1)] for __ in range(Y+1)]
# dp[1][2] = 1
# dp[2][1] = 1

# for xi in range(X + 1):
#     for yi in range(Y + 1):
#         dp[xi][yi] = dp[xi - 1][yi - 2] + dp[xi - 2][yi - 1]

# print(dp[X][Y])
import sys
sys.setrecursionlimit(100000)  # RecursionError対策

def help(x, y):
    if x < 0 or y < 0:
        return 0
    if (x == 1 and y == 2) or (x == 2 and y == 1):
        return 1
    else:
        return (help(x - 1, y - 2) + help(x - 2, y - 1))%(10e9+7)

print(help(X, Y))

Fixed submission:
X, Y = map(int, input().split())

MD = pow(10, 9) + 7

def choose(n, a):
    x, y = 1, 1
    for i in range(a):
        x = x * (n - i) % MD
        y = y * (i + 1) % MD
    return x * pow(y, MD - 2, MD) % MD


a = (2*Y-X)//3
b = (Y-2*X)//-3

if a < 0 or b < 0 or (X+Y) % 3 != 0:
    print(0)
    import sys
    sys.exit()

print(choose(a+b, min(a,b)))

Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().split())

sys.setrecursionlimit(10000)  # RecursionError対策

def help(x, y):
    if x < 0 or y < 0:
        return 0
    if (x == 1 and y == 2) or (x == 2 and y == 1):
        return 1
    else:
        return (help(x - 1, y - 2) + help(x - 2, y - 1))%(10e9+7)

print(help(X, Y))

Fixed submission:
X, Y = map(int, input().split())

MD = pow(10, 9) + 7

def choose(n, a):
    x, y = 1, 1
    for i in range(a):
        x = x * (n - i) % MD
        y = y * (i + 1) % MD
    return x * pow(y, MD - 2, MD) % MD


a = (2*Y-X)//3
b = (Y-2*X)//-3

if a < 0 or b < 0 or (X+Y) % 3 != 0:
    print(0)
    import sys
    sys.exit()

print(choose(a+b, min(a,b)))

Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().split())

# dp = [[0 for _ in range(X+1)] for __ in range(Y+1)]
# dp[1][2] = 1
# dp[2][1] = 1

# for xi in range(X + 1):
#     for yi in range(Y + 1):
#         dp[xi][yi] = dp[xi - 1][yi - 2] + dp[xi - 2][yi - 1]

# print(dp[X][Y])

def help(x, y):
    if x < 0 or y < 0:
        return 0
    if (x == 1 and y == 2) or (x == 2 and y == 1):
        return 1
    else:
        return (help(x - 1, y - 2) + help(x - 2, y - 1))%(10e9+7)

print(help(X, Y))

Fixed submission:
X, Y = map(int, input().split())

MD = pow(10, 9) + 7

def choose(n, a):
    x, y = 1, 1
    for i in range(a):
        x = x * (n - i) % MD
        y = y * (i + 1) % MD
    return x * pow(y, MD - 2, MD) % MD


a = (2*Y-X)//3
b = (Y-2*X)//-3

if a < 0 or b < 0 or (X+Y) % 3 != 0:
    print(0)
    import sys
    sys.exit()

print(choose(a+b, min(a,b)))