Buggy python submission (verdict: Runtime Error):
# coding: utf-8
def modcomb(n, r, mod):
    "nCr = X/Yとおく"
    r = min(r, n - r)
    X, Y = 1, 1
    # a, b, c = 1, 1, 1
    for i in range(1, n + 1):
        X = X * (n + 1 - i) % mod
        Y = Y * i % mod
        a = a * i % mod
    for i in range(1, r + 1):
        b = b * i % mod
        c = c * (n - i + 1) % mod
    return a * pow((b * c) % mod, mod-2, mod) % mod
    # return X * pow(Y, mod-2, mod) % mod

N, A, B = map(int, input().split())
mod = 10 ** 9 + 7
ans = pow(2, N, mod) - 1
a = modcomb(N, A, mod)
# ans %= mod
b = modcomb(N, B, mod)
ans -= a + b
print(ans % mod)

Fixed submission:
# coding: utf-8
def modcomb(n, r, mod):
    "nCr = X/Yとおく"
    r = min(r, n - r)
    X, Y = 1, 1
    for i in range(1, r + 1):
        X = X * (n + 1 - i) % mod
        Y = Y * i % mod
    # return ue * modpow(sita, mod-2, mod)
    return X * pow(Y, mod-2, mod) % mod

N, A, B = map(int, input().split())
mod = 10 ** 9 + 7
ans = pow(2, N, mod) - 1
a = modcomb(N, A, mod)
# ans %= mod
b = modcomb(N, B, mod)
ans -= a + b
print(ans % mod)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
def modpow(x, n, mod):
    if n == 0:
        return 1
    elif n % 2 == 0:
        return modpow((x**2) % mod, n // 2, mod)
    else:
        return x * modpow(x, n - 1, mod) % mod
def modcomb(n, r, mod):
    "nCr = X/Yとおく"
    r = min(r, n - r)
    ue, sita = 1, 1
    for i in range(1, r + 1):
        ue *= (n + 1 - i) % mod
        sita *= i % mod
    # return ue * modpow(sita, mod-2, mod)
    return ue * pow(sita, mod-2, mod)

N, A, B = map(int, input().split())
mod = 10 ** 9 + 7

ans = pow(2, N, mod) - 1
ans -= modcomb(N, A, mod)
# ans -= cmb(N, A, mod) % mod
ans %= mod
ans -= modcomb(N, B, mod)
# ans -= cmb(N, B, mod) % mod
ans %= mod
print(ans % mod)

Fixed submission:
# coding: utf-8
def modcomb(n, r, mod):
    "nCr = X/Yとおく"
    r = min(r, n - r)
    X, Y = 1, 1
    for i in range(1, r + 1):
        X = X * (n + 1 - i) % mod
        Y = Y * i % mod
    # return ue * modpow(sita, mod-2, mod)
    return X * pow(Y, mod-2, mod) % mod

N, A, B = map(int, input().split())
mod = 10 ** 9 + 7
ans = pow(2, N, mod) - 1
a = modcomb(N, A, mod)
# ans %= mod
b = modcomb(N, B, mod)
ans -= a + b
print(ans % mod)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
from math import factorial
def modpow(x, n, mod):
    if n == 0:
        return 1
    elif n % 2 == 0:
        return modpow((x**2) % mod, n // 2, mod)
    else:
        return x * modpow(x, n - 1, mod) % mod
def modcomb(n, r, mod):
    "nCr = X/Yとおく"
    X = factorial(n) % mod
    Y = factorial(n-r) % mod * factorial(r) % mod 
    Y_over = modpow(Y, mod - 2, mod)
    return (X * Y) % mod

N, A, B = map(int, input().split())
mod = 10 ** 9 + 7
def cmb(n, r, mod):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % mod
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod // i)) % mod)
    factinv.append((factinv[-1] * inv[-1]) % mod)
ans = modpow(2, N, mod) - 1
# ans -= modcomb(N, A, mod)
# ans -= modcomb(N, B, mod)
ans %= mod
ans -= cmb(N, A, mod) % mod
ans %= mod
ans -= cmb(N, B, mod) % mod
ans %= mod
print(ans)

Fixed submission:
# coding: utf-8
def modcomb(n, r, mod):
    "nCr = X/Yとおく"
    r = min(r, n - r)
    X, Y = 1, 1
    for i in range(1, r + 1):
        X = X * (n + 1 - i) % mod
        Y = Y * i % mod
    # return ue * modpow(sita, mod-2, mod)
    return X * pow(Y, mod-2, mod) % mod

N, A, B = map(int, input().split())
mod = 10 ** 9 + 7
ans = pow(2, N, mod) - 1
a = modcomb(N, A, mod)
# ans %= mod
b = modcomb(N, B, mod)
ans -= a + b
print(ans % mod)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
from math import factorial
def modpow(x, n, mod):
    if n == 0:
        return 1
    elif n % 2 == 0:
        return modpow((x**2) % mod, n // 2, mod)
    else:
        return x * modpow(x, n - 1, mod) % mod
def modcomb(n, r, mod):
    "nCr = X/Yとおく"
    X = factorial(n) % mod
    Y = factorial(n-r) % mod * factorial(r) % mod 
    Y_over = modpow(Y, mod - 2, mod)
    return (X * Y) % mod

N, A, B = map(int, input().split())
mod = 10 ** 9 + 7
def cmb(n, r, mod):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % mod
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod // i)) % mod)
    factinv.append((factinv[-1] * inv[-1]) % mod)
ans = modpow(2, N, mod) - 1
# ans -= modcomb(N, A, mod)
# ans -= modcomb(N, B, mod)
ans %= mod
ans -= cmb(N, A, mod) % mod
ans %= mod
ans -= cmb(N, B, mod) % mod
ans %= mod
print(ans)

Fixed submission:
# coding: utf-8
def modcomb(n, r, mod):
    "nCr = X/Yとおく"
    r = min(r, n - r)
    X, Y = 1, 1
    for i in range(1, r + 1):
        X = X * (n + 1 - i) % mod
        Y = Y * i % mod
    # return ue * modpow(sita, mod-2, mod)
    return X * pow(Y, mod-2, mod) % mod

N, A, B = map(int, input().split())
mod = 10 ** 9 + 7
ans = pow(2, N, mod) - 1
a = modcomb(N, A, mod)
# ans %= mod
b = modcomb(N, B, mod)
ans -= a + b
print(ans % mod)