Buggy python submission (verdict: Runtime Error):
import math

MOD = 10 ** 9 + 7


def cmb(n, r):
    total = 1
    for i in range(r):
        total *= (n - i) % MOD
    return total * pow(math.factorial(r), MOD - 2, MOD) % MOD


def calc(n, r):
    ret = 1
    for i in range(r):
        ret = ret * (n - i) % MOD
    return ret * pow(factorial(r), MOD - 2, MOD) % MOD


if __name__ == '__main__':
    n, a, b = list(map(int, input().split(" ")))

    total = pow(2, n, MOD)
    a_total = calc(n, a)
    b_total = calc(n, b)
    print((total - a_total - b_total - 1) % MOD)

Fixed submission:
from math import factorial
N, A, B = map(int, input().split())
MOD = 10 ** 9 + 7

def calc(n):
    ret = 1
    for i in range(n):
        ret = ret * (N - i) % MOD
    return ret * pow(factorial(n), MOD - 2, MOD) % MOD

print(max(0, (pow(2, N, MOD) - ((calc(A) + calc(B)) % MOD) - 1) % MOD))

Buggy python submission (verdict: Time Limit Exceeded):
import math

MOD = 10 ** 9 + 7


def cmb(n, r):
    total = 1
    for i in range(r):
        total *= (n - i) % MOD
    return total * pow(math.factorial(r), MOD - 2, MOD) % MOD


if __name__ == '__main__':
    n, a, b = list(map(int, input().split(" ")))

    total = pow(2, n, MOD)
    a_total = cmb(n, a)
    b_total = cmb(n, b)
    # print((total - a_total - b_total - 1) % MOD)

    print(max(0, (pow(2, n, MOD) - ((cmb(n, a) + cmb(n, b)) % MOD) - 1) % MOD))

Fixed submission:
from math import factorial
N, A, B = map(int, input().split())
MOD = 10 ** 9 + 7

def calc(n):
    ret = 1
    for i in range(n):
        ret = ret * (N - i) % MOD
    return ret * pow(factorial(n), MOD - 2, MOD) % MOD

print(max(0, (pow(2, N, MOD) - ((calc(A) + calc(B)) % MOD) - 1) % MOD))

Buggy python submission (verdict: Time Limit Exceeded):
import math

MOD = 10 ** 9 + 7
n, a, b = list(map(int, input().split(" ")))


def cmb(r):
    total = 1
    for i in range(r):
        total *= (n - i) % MOD
    return total * pow(math.factorial(r), MOD - 2, MOD) % MOD


total = pow(2, n, MOD)
a_total = cmb(a)
b_total = cmb(b)
print((total - a_total - b_total - 1) % MOD)

Fixed submission:
from math import factorial
N, A, B = map(int, input().split())
MOD = 10 ** 9 + 7

def calc(n):
    ret = 1
    for i in range(n):
        ret = ret * (N - i) % MOD
    return ret * pow(factorial(n), MOD - 2, MOD) % MOD

print(max(0, (pow(2, N, MOD) - ((calc(A) + calc(B)) % MOD) - 1) % MOD))

Buggy python submission (verdict: Time Limit Exceeded):
import math

MOD = 10 ** 9 + 7


def cmb(n, r):
    total = 1
    for i in range(r):
        total *= (n - i) % MOD
    return total * pow(math.factorial(r), MOD - 2, MOD) % MOD


if __name__ == '__main__':
    n, a, b = list(map(int, input().split(" ")))
    # for i in range(2, N + 1):
    #     fact.append((fact[-1] * i) % P)
    #     inv.append((-inv[P % i] * (P // i)) % P)
    #     factinv.append((factinv[-1] * inv[-1]) % P)

    total = pow(2, n, MOD)
    # print(total)
    a_total = cmb(n, a)
    # print(a_total)
    b_total = cmb(n, b)
    print((total - a_total - b_total - 1) % MOD)

Fixed submission:
from math import factorial
N, A, B = map(int, input().split())
MOD = 10 ** 9 + 7

def calc(n):
    ret = 1
    for i in range(n):
        ret = ret * (N - i) % MOD
    return ret * pow(factorial(n), MOD - 2, MOD) % MOD

print(max(0, (pow(2, N, MOD) - ((calc(A) + calc(B)) % MOD) - 1) % MOD))

Buggy python submission (verdict: Time Limit Exceeded):
P = 10 ** 9 + 7
N = 10 ** 9  # N は必要分だけ用意する
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]


def cmb(n, r):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % P


# def combinations_count(n, r):
#     return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


if __name__ == '__main__':
    n, a, b = list(map(int, input().split(" ")))
    for i in range(2, N + 1):
        fact.append((fact[-1] * i) % P)
        inv.append((-inv[P % i] * (P // i)) % P)
        factinv.append((factinv[-1] * inv[-1]) % P)

    total = pow(2, n, P)
    # print(total)
    a_total = cmb(n, a)
    # print(a_total)
    b_total = cmb(n, b)
    print(total - a_total - b_total - 1)

Fixed submission:
from math import factorial
N, A, B = map(int, input().split())
MOD = 10 ** 9 + 7

def calc(n):
    ret = 1
    for i in range(n):
        ret = ret * (N - i) % MOD
    return ret * pow(factorial(n), MOD - 2, MOD) % MOD

print(max(0, (pow(2, N, MOD) - ((calc(A) + calc(B)) % MOD) - 1) % MOD))