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

# xのn乗
def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2

    return K * x

# nCkの導出
def comb(n,k):
    nCk = 1
    # X
    for i in range(n-k+1, n+1):
        nCk *= i
        # nCk %= mod

    # Y
    for i in range(1,k+1):
        nCk *= pow(i,mod-2,mod)
        nCk %= mod
    return nCk

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

# ans = pow_k(2,n) - c(n,a) - c(n,b) - 1

ans = pow(2,n,mod) - 1 - comb(n,a) - comb(n,b)

print(ans%mod)
# print(ans%mod)

Fixed submission:
import math

# xのn乗
def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2

    return K * x

# nCkの導出
def comb(n,k):
    nCk = 1
    # X
    for i in range(n-k+1, n+1):
        nCk *= i
        nCk %= mod

    # Y
    for i in range(1,k+1):
        nCk *= pow(i,mod-2,mod)
        nCk %= mod
    return nCk

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

# ans = pow_k(2,n) - c(n,a) - c(n,b) - 1

ans = pow(2,n,mod) - 1 - comb(n,a) - comb(n,b)

print(ans%mod)

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

# xのn乗
def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2

    return K * x

# nCkの導出
def comb(n,k):
    nCk = 1
    # X
    for i in range(n-k+1, n+1):
        nCk *= i
        # nCk %= mod

    # Y
    for i in range(1,k+1):
        nCk *= pow(i,mod-2,mod)
        nCk %= mod
    return nCk

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

# ans = pow_k(2,n) - c(n,a) - c(n,b) - 1

ans = pow(2,n,mod) - 1 - comb(n,a) - comb(n,b)

print(ans)
# print(ans%mod)

Fixed submission:
import math

# xのn乗
def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2

    return K * x

# nCkの導出
def comb(n,k):
    nCk = 1
    # X
    for i in range(n-k+1, n+1):
        nCk *= i
        nCk %= mod

    # Y
    for i in range(1,k+1):
        nCk *= pow(i,mod-2,mod)
        nCk %= mod
    return nCk

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

# ans = pow_k(2,n) - c(n,a) - c(n,b) - 1

ans = pow(2,n,mod) - 1 - comb(n,a) - comb(n,b)

print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
import math
def c(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# xのn乗
def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2

    return K * x

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

ans = pow_k(2,n) - c(n,a) - c(n,b) - 1

print(ans%(10**9+7))

Fixed submission:
import math

# xのn乗
def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2

    return K * x

# nCkの導出
def comb(n,k):
    nCk = 1
    # X
    for i in range(n-k+1, n+1):
        nCk *= i
        nCk %= mod

    # Y
    for i in range(1,k+1):
        nCk *= pow(i,mod-2,mod)
        nCk %= mod
    return nCk

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

# ans = pow_k(2,n) - c(n,a) - c(n,b) - 1

ans = pow(2,n,mod) - 1 - comb(n,a) - comb(n,b)

print(ans%mod)