Buggy python submission (verdict: Time Limit Exceeded):
def comb2(n, r):
    if r<0 or r>n:
        return 0
    r=min(r, n-r)
    res=1
    for i in range(r):
        res*=(n-i)%MOD*pow(i+1, MOD-2, MOD)%MOD
    return res

MOD=10**9+7

N, A, B=map(int, input().split())
ans=pow(2, N, MOD)-comb2(N, A)-comb2(N, B)-1
print(ans%MOD)

Fixed submission:
def comb2(n, r):
    if r<0 or r>n:
        return 0
    r=min(r, n-r)
    res=1
    for i in range(r):
        res=res*(n-i)%MOD*pow(i+1, MOD-2, MOD)%MOD
    return res

MOD=10**9+7

N, A, B=map(int, input().split())
ans=pow(2, N, MOD)-comb2(N, A)-comb2(N, B)-1
print(ans%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
def comb2(n, r):
    if r<0 or r>n:
        return 0
    r=min(r, n-r)
    res=1
    for i in range(r):
        res*=(n-i)%MOD*pow(i+1, MOD-2, MOD)%MOD
    return res%MOD

MOD=10**9+7

N, A, B=map(int, input().split())
ans=pow(2, N)-comb2(N, A)-comb2(N, B)-1
print(ans)

Fixed submission:
def comb2(n, r):
    if r<0 or r>n:
        return 0
    r=min(r, n-r)
    res=1
    for i in range(r):
        res=res*(n-i)%MOD*pow(i+1, MOD-2, MOD)%MOD
    return res

MOD=10**9+7

N, A, B=map(int, input().split())
ans=pow(2, N, MOD)-comb2(N, A)-comb2(N, B)-1
print(ans%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
def comb(n, r):
    if r<0 or r>n:
        return 0
    r=min(r, n-r)
    return g1[n]*g2[r]*g2[n-r]%MOD

MOD=10**9+7
MAXN=10**9+10
g1=[1, 1]
g2=[1, 1]
inverse=[0, 1]

for i in range(2, MAXN+1):
    g1.append((g1[-1]*i)%MOD)
    inverse.append(-inverse[MOD%i]*(MOD//i)%MOD)
    g2.append((g2[-1]*inverse[-1])%MOD)

def binary(n):
    return bin(n)[2:]

def pow_by_binary_exponentiation(a, x):
    x=[int(b) for b in binary(x)]
    y=a
    for i in range(1, len(x)):
        y=(y**2)%MOD
        if x[i]==1:
            y=(y*a)%MOD
    return y

N, A, B=map(int, input().split())
ans=pow_by_binary_exponentiation(2, N)-comb(N, A)-comb(N, B)-1
print(ans)

Fixed submission:
def comb2(n, r):
    if r<0 or r>n:
        return 0
    r=min(r, n-r)
    res=1
    for i in range(r):
        res=res*(n-i)%MOD*pow(i+1, MOD-2, MOD)%MOD
    return res

MOD=10**9+7

N, A, B=map(int, input().split())
ans=pow(2, N, MOD)-comb2(N, A)-comb2(N, B)-1
print(ans%MOD)

Buggy python submission (verdict: Runtime Error):
def comb(n, r):
    if r<0 or r>n:
        return 0
    r=min(r, n-r)
    return g1[n]*g2[r]*g2[n-r]%MOD

MOD=10**9+7
MAXN=200000+10
g1=[1, 1]
g2=[1, 1]
inverse=[0, 1]

for i in range(2, MAXN+1):
    g1.append((g1[-1]*i)%MOD)
    inverse.append(-inverse[MOD%i]*(MOD//i)%MOD)
    g2.append((g2[-1]*inverse[-1])%MOD)

def binary(n):
    return bin(n)[2:]

def pow_by_binary_exponentiation(a, x):
    x=[int(b) for b in binary(x)]
    y=a
    for i in range(1, len(x)):
        y=(y**2)%MOD
        if x[i]==1:
            y=(y*a)%MOD
    return y

N, A, B=map(int, input().split())
ans=pow_by_binary_exponentiation(2, N)-comb(N, A)-comb(N, B)-1
print(ans)

Fixed submission:
def comb2(n, r):
    if r<0 or r>n:
        return 0
    r=min(r, n-r)
    res=1
    for i in range(r):
        res=res*(n-i)%MOD*pow(i+1, MOD-2, MOD)%MOD
    return res

MOD=10**9+7

N, A, B=map(int, input().split())
ans=pow(2, N, MOD)-comb2(N, A)-comb2(N, B)-1
print(ans%MOD)