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

MOD = 10 ** 9 + 7

def comb(n, r):
    ret = 1
    for i in range(r):
        ret *= n - i
    for i in range(r):
        ret *= pow(i+1, MOD-2, MOD)

    return ret % MOD
    

ans = pow(2, n, MOD) - 1 - comb(n, a) - comb(n, b)
ans %= MOD
print(ans)


Fixed submission:
n, a, b = map(int, input().split())

MOD = 10 ** 9 + 7

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

    return ret % MOD
    

ans = pow(2, n, MOD) - 1 - comb(n, a) - comb(n, b)
ans %= MOD
print(ans)

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

MOD = 10 ** 9 + 7

def comb(n, r):
    fn = 1
    finv_r = 1
    for i in range(r):
        fn *= n - i
        finv_r *= pow(i+1, MOD-2, MOD)

    return fn * finv_r % MOD
    

ans = pow(2, n, MOD) - 1 - comb(n, a) - comb(n, b)
ans %= MOD
print(ans)


Fixed submission:
n, a, b = map(int, input().split())

MOD = 10 ** 9 + 7

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

    return ret % MOD
    

ans = pow(2, n, MOD) - 1 - comb(n, a) - comb(n, b)
ans %= MOD
print(ans)

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

MOD = 10 ** 9 + 7

def comb(n, r):
    fn = 1
    fr = 1
    for i in range(1, r+1):
        fn *= n - (i-1)
        fr *= i % MOD
    finv_r = pow(fr, MOD-2, MOD)

    return fn * finv_r % MOD
    

ans = pow(2, n, MOD) - 1 - comb(n, a) - comb(n, b)
ans %= MOD
print(ans)


Fixed submission:
n, a, b = map(int, input().split())

MOD = 10 ** 9 + 7

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

    return ret % MOD
    

ans = pow(2, n, MOD) - 1 - comb(n, a) - comb(n, b)
ans %= MOD
print(ans)

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

MOD = 10 ** 9 + 7

def comb(n, r):
    fn = 1
    fr = 1
    for i in range(1, r+1):
        fn *= n - (i-1)
        fr *= i
    finv_r = pow(fr, MOD-2, MOD)

    return fn * finv_r % MOD
    

ans = pow(2, n, MOD) - 1 - comb(n, a) - comb(n, b)
ans %= MOD
print(ans)


Fixed submission:
n, a, b = map(int, input().split())

MOD = 10 ** 9 + 7

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

    return ret % MOD
    

ans = pow(2, n, MOD) - 1 - comb(n, a) - comb(n, b)
ans %= MOD
print(ans)

Buggy python submission (verdict: Runtime Error):
def prepare(N, MOD):
    fac = [None] * (N+2)
    finv = [None] * (N+2)
    inv = [None] * (N+2)
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, N+1):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD
    return fac, finv

def combination(N, K, fac, finv, MOD):
    if N < K:
        return 0
    if N < 0 or K < 0:
        return 0
    else:
        return fac[N] * (finv[K] * finv[N - K] % MOD) % MOD

n, a, b = map(int, input().split())

MOD = 10 ** 9 + 7
fac, finv = prepare(n, MOD)
ans = 2**n-1 - combination(n, a, fac, finv, MOD) - combination(n, b, fac, finv, MOD)
print(ans)

Fixed submission:
n, a, b = map(int, input().split())

MOD = 10 ** 9 + 7

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

    return ret % MOD
    

ans = pow(2, n, MOD) - 1 - comb(n, a) - comb(n, b)
ans %= MOD
print(ans)