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

mod = 10**9+7

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

if X>0 and Y>0 and (2*X - Y)%3 == 0 and (2*Y - X)% 3==0 and 2*Y >= X and Y <= 2*X: 
    m = int((2*X - Y)/ 3)
    n = int((2*Y - X)/ 3)
    
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル
    for i in range( 2, m+n + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )
    ret = cmb(m+n, m, mod)
else:
    print('0')
print(ret)

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

mod = 10**9+7

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

if X>0 and Y>0 and (2*X - Y)%3 == 0 and (2*Y - X)% 3==0 and 2*Y >= X and Y <= 2*X: 
    m = int((2*X - Y)/ 3)
    n = int((2*Y - X)/ 3)
    
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル
    for i in range( 2, m+n + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )
    ret = cmb(m+n, m, mod)
else:
    ret = 0
print(ret)

Buggy python submission (verdict: Runtime Error):
import numpy as np
import math

X, Y = list(map(int, input().strip().split()))

mod = 10**9+7
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

if X>0 and Y>0 and (2*X - Y)%3 == 0 and (2*Y - X)% 3==0 and 2*Y >= X and Y <= 2*X: 
    m = int((2*X - Y)/ 3)
    n = int((2*Y - X)/ 3)
    
    for i in range( 2, m+n + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )
    
    
    ret = cmb(m+n, m, mod)
print(ret)

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

mod = 10**9+7

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

if X>0 and Y>0 and (2*X - Y)%3 == 0 and (2*Y - X)% 3==0 and 2*Y >= X and Y <= 2*X: 
    m = int((2*X - Y)/ 3)
    n = int((2*Y - X)/ 3)
    
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル
    for i in range( 2, m+n + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )
    ret = cmb(m+n, m, mod)
else:
    ret = 0
print(ret)

Buggy python submission (verdict: Runtime Error):
import numpy as np
import math

X, Y = list(map(int, input().strip().split()))

mod = 10**9+7
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

if X>0 and Y>0 and (2*X - Y)%3 == 0 and (2*Y - X)% 3==0: 
    m = int((2*X - Y)/ 3)
    n = int((2*Y - X)/ 3)
    
    for i in range( 2, m+n + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )
    
    
    ret = cmb(m+n, m, mod)
print(ret)

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

mod = 10**9+7

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

if X>0 and Y>0 and (2*X - Y)%3 == 0 and (2*Y - X)% 3==0 and 2*Y >= X and Y <= 2*X: 
    m = int((2*X - Y)/ 3)
    n = int((2*Y - X)/ 3)
    
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル
    for i in range( 2, m+n + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )
    ret = cmb(m+n, m, mod)
else:
    ret = 0
print(ret)

Buggy python submission (verdict: Runtime Error):
import numpy as np

X, Y = list(map(int, input().strip().split()))

ret = 0
def back(X, Y):
    if X == 0 and Y == 0:
        global ret
        ret += 1
        return 0
    elif X>0 and Y > 0:
        back(X-1, Y-2)
        back(X-2, Y-1)
    else:
        return 0

back(X,Y)
print(ret%(10**9+7))

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

mod = 10**9+7

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

if X>0 and Y>0 and (2*X - Y)%3 == 0 and (2*Y - X)% 3==0 and 2*Y >= X and Y <= 2*X: 
    m = int((2*X - Y)/ 3)
    n = int((2*Y - X)/ 3)
    
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル
    for i in range( 2, m+n + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )
    ret = cmb(m+n, m, mod)
else:
    ret = 0
print(ret)