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

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def combi(n,r,mod=10**9+7):
    fac = [0]*(n+1)
    fac[0] = 1
    fac[1] = 1
    for i in range(2,n+1):
        fac[i] = fac[i-1] * i % mod
    return( ( fac[n] * modinv(fac[r]) )%mod * modinv(fac[n-r]) % mod)

if ( X + Y ) % 3 != 0:
    print(0)
else:
    n = X - (X + Y)//3
    m = (X + Y)//3 - n
    print(combi(n+m,m))

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

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def combi(n,r,mod=10**9+7):
    fac = [0]*(n+1)
    fac[0] = 1
    fac[1] = 1
    for i in range(2,n+1):
        fac[i] = fac[i-1] * i % mod
    return( ( fac[n] * modinv(fac[r]) )%mod * modinv(fac[n-r]) % mod)

if (X+Y) % 3 != 0 or X > 2*Y or Y > 2*X:
    print(0)
else:
    n = X - (X + Y)//3
    m = (X + Y)//3 - n
    print(combi(n+m,m))

Buggy python submission (verdict: Time Limit Exceeded):
X,Y = map(int,input().split())
dp = [[0 for i in range(Y+10)] for _ in range(X+10)]
dp[2][1] = 1
dp[1][2] = 1

for i in range(2,X+1):
    for j in range(max(2,i//2),min(Y+1,i*2+1)):
        if (i+j) % 3 == 0:
            dp[i][j] = (dp[i-2][j-1] + dp[i-1][j-2]) % (10**9+7)

print(dp[X][Y])

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

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def combi(n,r,mod=10**9+7):
    fac = [0]*(n+1)
    fac[0] = 1
    fac[1] = 1
    for i in range(2,n+1):
        fac[i] = fac[i-1] * i % mod
    return( ( fac[n] * modinv(fac[r]) )%mod * modinv(fac[n-r]) % mod)

if (X+Y) % 3 != 0 or X > 2*Y or Y > 2*X:
    print(0)
else:
    n = X - (X + Y)//3
    m = (X + Y)//3 - n
    print(combi(n+m,m))

Buggy python submission (verdict: Runtime Error):
X,Y = map(int,input().split())
dp = [[0]*(X+10) for _ in range(Y+10)]
dp[2][1] = 1
dp[1][2] = 1

for i in range(2,X+1):
    for j in range(max(2,i//2),min(Y+1,i//2+1)):
        dp[i][j] = (dp[i-2][j-1] + dp[i-1][j-2]) % (10**9+7)

print(dp[X][Y])

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

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def combi(n,r,mod=10**9+7):
    fac = [0]*(n+1)
    fac[0] = 1
    fac[1] = 1
    for i in range(2,n+1):
        fac[i] = fac[i-1] * i % mod
    return( ( fac[n] * modinv(fac[r]) )%mod * modinv(fac[n-r]) % mod)

if (X+Y) % 3 != 0 or X > 2*Y or Y > 2*X:
    print(0)
else:
    n = X - (X + Y)//3
    m = (X + Y)//3 - n
    print(combi(n+m,m))

Buggy python submission (verdict: Runtime Error):
X,Y = map(int,input().split())
dp = [[0]*(X+10) for _ in range(Y+10)]
dp[2][1] = 1
dp[1][2] = 1

for i in range(2,X+1):
    for j in range(2,Y+1):
        dp[i][j] = ( dp[i-2][j-1] + dp[i-1][j-2] ) % (10**9+7)

print(dp[X][Y])

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

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def combi(n,r,mod=10**9+7):
    fac = [0]*(n+1)
    fac[0] = 1
    fac[1] = 1
    for i in range(2,n+1):
        fac[i] = fac[i-1] * i % mod
    return( ( fac[n] * modinv(fac[r]) )%mod * modinv(fac[n-r]) % mod)

if (X+Y) % 3 != 0 or X > 2*Y or Y > 2*X:
    print(0)
else:
    n = X - (X + Y)//3
    m = (X + Y)//3 - n
    print(combi(n+m,m))

Buggy python submission (verdict: Runtime Error):
from math import factorial as fac
X,Y = map( int, input().split() )
if ( X + Y ) % 3 != 0:
    print(0)
else:
    N = ( X + Y ) // 3
    k = X - N
    print( ( fac(N) // ( fac(k) * fac(N - k) ) ) % (10**9 +7) )

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

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def combi(n,r,mod=10**9+7):
    fac = [0]*(n+1)
    fac[0] = 1
    fac[1] = 1
    for i in range(2,n+1):
        fac[i] = fac[i-1] * i % mod
    return( ( fac[n] * modinv(fac[r]) )%mod * modinv(fac[n-r]) % mod)

if (X+Y) % 3 != 0 or X > 2*Y or Y > 2*X:
    print(0)
else:
    n = X - (X + Y)//3
    m = (X + Y)//3 - n
    print(combi(n+m,m))