Buggy python submission (verdict: Runtime Error):
from operator import mul
from functools import reduce
n, a, b = map(int, input().split())

def inv_felmat(a, p):
    return pow(a, p-2, p)

def cmb(n,r):
    r = min(n-r, r)
    if r == 0: return
    over = reduce(mul, range(n, n-r, -1))
    under = reduce(mul, range(1, r+1))
    under = inv_felmat(under, 10**9 + 7)
    return over * under

all = pow(2, n, 10**9 + 7) - 1 
tmp1 = 1
tmp2 = 1
# for i in range(n-a+1, n+1):
#     tmp1 *= i
# for i in range(1, a+1):
#     tmp2 *= i
tmp1 = cmb(n,a) % (10**9 + 7)
tmp3 = cmb(n,b) % (10**9 + 7)
# for i in range(n-b+1, n+1):
#     tmp3 *= i
# for i in range(1, b+1):
#     tmp4 *= i

result = all - tmp1 - tmp3
print(result%(10**9 + 7))

Fixed submission:
n, a, b = [int(i) for i in input().split()]
mod = 10**9 + 7
 
total = pow(2, n, mod) - 1
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res
 
at = combination(n,a)
bt = combination(n,b)
 
result = total - at - bt
result %= mod
if result < 0:
  result += mod
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int, input().split())

def iterative_square_method(N, P, M):

    if P == 0:
        return 1
    elif P%2 == 0:
        return (iterative_square_method(N, P//2, M) ** 2) % M
    else:
        return (N * iterative_square_method(N, P-1, M)) % M

def inv_felmat(a, p):
    return iterative_square_method(a, p-2, p)

all = iterative_square_method(2, n, 10**9 + 7) - 1 
tmp1 = 1
tmp2 = 1
for i in range(n-a+1, n+1):
    tmp1 *= i % (10**9 + 7)
for i in range(1, a+1):
    tmp2 *= i % (10**9 + 7)
tmp1 = (tmp1 * inv_felmat(tmp2, 10**9 + 7)) % (10**9 + 7)
tmp3 = 1
tmp4 = 1
for i in range(n-b+1, n+1):
    tmp3 *= i % (10**9 + 7)
for i in range(1, b+1):
    tmp4 *= i % (10**9 + 7)
tmp3 = (tmp3 * inv_felmat(tmp4, 10**9 + 7)) % (10**9 + 7)

result = all - tmp1 - tmp3
print(result%(10**9 + 7))

Fixed submission:
n, a, b = [int(i) for i in input().split()]
mod = 10**9 + 7
 
total = pow(2, n, mod) - 1
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res
 
at = combination(n,a)
bt = combination(n,b)
 
result = total - at - bt
result %= mod
if result < 0:
  result += mod
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int, input().split())

def iterative_square_method(N, P, M):

    if P == 0:
        return 1
    elif P%2 == 0:
        return (iterative_square_method(N, P//2, M) ** 2) % M
    else:
        return (N * iterative_square_method(N, P-1, M)) % M

def inv_felmat(a, p):
    return iterative_square_method(a, p-2, p)

all = iterative_square_method(2, n, 10**9 + 7) - 1 
tmp1 = 1
tmp2 = 1
for i in range(n-a+1, n+1):
    tmp1 *= i % (10**9 + 7)
for i in range(1, a+1):
    tmp2 *= i % (10**9 + 7)
tmp1 = (tmp1 * inv_felmat(tmp2, 10**9 + 7)) % (10**9 + 7)
tmp3 = 1
tmp4 = 1
for i in range(n-b+1, n+1):
    tmp3 *= i
for i in range(1, b+1):
    tmp4 *= i
tmp3 = (tmp3 * inv_felmat(tmp4, 10**9 + 7)) % (10**9 + 7)

result = all - tmp1 - tmp3
print(result%(10**9 + 7))

Fixed submission:
n, a, b = [int(i) for i in input().split()]
mod = 10**9 + 7
 
total = pow(2, n, mod) - 1
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res
 
at = combination(n,a)
bt = combination(n,b)
 
result = total - at - bt
result %= mod
if result < 0:
  result += mod
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int, input().split())
all = (2**n - 1) % (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

mod = 10**9+7 #出力の制限
N = n
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

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

tmp1, tmp2 = cmb(n,a,mod), cmb(n,b,mod)
result = (all - tmp1 - tmp2)%(10**9 + 7)
print(result)


Fixed submission:
n, a, b = [int(i) for i in input().split()]
mod = 10**9 + 7
 
total = pow(2, n, mod) - 1
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res
 
at = combination(n,a)
bt = combination(n,b)
 
result = total - at - bt
result %= mod
if result < 0:
  result += mod
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int, input().split())

all = 2**n - 1
tmp1 = 1
tmp2 = 1
tmp3 = 1
tmp4 = 1
for i in range(1, a+1):
    tmp1 *= n - i + 1
for i in range(1, a+1):
    tmp2 *= i
for i in range(1, b+1):
    tmp3 *= n - i + 1
for i in range(1, b+1):
    tmp4 *= i
result = all - ((tmp1//tmp2) + (tmp3//tmp4)) 
print(result%(10**9 + 7))

Fixed submission:
n, a, b = [int(i) for i in input().split()]
mod = 10**9 + 7
 
total = pow(2, n, mod) - 1
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res
 
at = combination(n,a)
bt = combination(n,b)
 
result = total - at - bt
result %= mod
if result < 0:
  result += mod
print(result)