Buggy python submission (verdict: Runtime Error):
mod = 10**9+7
def combination(n, r, mod):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res


X,Y = map(int,input().split())
s = (2*Y-X)//3
t = (2*X-Y)//3

if (2*Y-X)%3==0 and (2*X-Y)%3==0 :
    ans =  combination(s+t,t,mod)
    print(ans)
else:
    print(0)
    

Fixed submission:
def combination(n, k, p):
    numerator = 1
    for i in range(k):
        numerator = (numerator * (n-i)) % p
 
    denominator = 1
    for i in range(1, k+1):
        denominator = (denominator * i) % p
 
    return (numerator * pow(denominator, p-2, p)) % p
 
 
X, Y = map(int, input().split())
 
a = (2*Y-X) / 3
b = (2*X-Y) / 3
 
if a >= 0 and b >= 0 and a == int(a) and b == int(b):
    a = int(a)
    b = int(b)
 
    print(combination(a+b, a, 10**9+7))
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
import math
mod = 10**9+7
def mod_combination(n, k, mod):
    # nCk (mod m)
    def mod_permutation(n, k, mod):
        if n<=k:
            return 1
        else:
            return (n * mod_permutation(n-1,k,mod))%mod

    def mod_inv_permutation(k, mod):
        k, mod = int(k), int(mod)
        if k<=1:
            return 1
        else:
            return (pow(k,mod-2,mod) * mod_inv_permutation(k-1, mod))%mod

    return (mod_permutation(n,n-k,mod) * mod_inv_permutation(k, mod))%mod


X,Y = map(int,input().split())
s = (2*Y-X)//3
t = (2*X-Y)//3

if (X+Y)%3 == 0 :
    ans =  mod_combination(s+t, s, mod)
    print(ans)
else:
    print(0)
    

Fixed submission:
def combination(n, k, p):
    numerator = 1
    for i in range(k):
        numerator = (numerator * (n-i)) % p
 
    denominator = 1
    for i in range(1, k+1):
        denominator = (denominator * i) % p
 
    return (numerator * pow(denominator, p-2, p)) % p
 
 
X, Y = map(int, input().split())
 
a = (2*Y-X) / 3
b = (2*X-Y) / 3
 
if a >= 0 and b >= 0 and a == int(a) and b == int(b):
    a = int(a)
    b = int(b)
 
    print(combination(a+b, a, 10**9+7))
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
import math
mod = 1000000007

def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

def power(x, y):
    if   y == 0: 
        return 1
    elif y == 1: 
        return x % mod
    elif y % 2 == 0 : 
        return power(x, y//2)**2 % mod
    else: 
        return power(x, y//2)**2 * x % mod

def div(a, b):
    return mul(a, power(b, mod-2))
X,Y = map(int,input().split())
s = (2*Y-X)//3
t = (2*X-Y)//3
if (2*Y-X)%3!=0 or (2*X-Y)%3!=0:
    print(0)
else:
    a = math.factorial(s+t)%mod
    
    b = math.factorial(s)
    c = math.factorial(t)
    ans = div(div(a,b),c)
    print(ans)

Fixed submission:
def combination(n, k, p):
    numerator = 1
    for i in range(k):
        numerator = (numerator * (n-i)) % p
 
    denominator = 1
    for i in range(1, k+1):
        denominator = (denominator * i) % p
 
    return (numerator * pow(denominator, p-2, p)) % p
 
 
X, Y = map(int, input().split())
 
a = (2*Y-X) / 3
b = (2*X-Y) / 3
 
if a >= 0 and b >= 0 and a == int(a) and b == int(b):
    a = int(a)
    b = int(b)
 
    print(combination(a+b, a, 10**9+7))
else:
    print(0)