Buggy python submission (verdict: Time Limit Exceeded):
import sys
from math import factorial
from functools import lru_cache

def input(): return sys.stdin.readline().rstrip()

def main():
    MOD = 10 ** 9 + 7
    n, a, b = map(int, input().split())

    @lru_cache(maxsize=None)
    def f(n):
        return factorial(n)

    def comb_c(n, r):
        if r > n - r:
            r = n - r 
        a = f(n) % MOD
        b = f(n - r) * f(r)
        return a * pow(b, MOD - 2, MOD) % MOD

    n2 = (n - 1) // 2
    ans = 1
    for i in range(1, n2 + 1):
        ans += comb_c(n, i) * 2
    if n % 2 == 0:
        ans += comb_c(n, n2 + 1)
    ans -= comb_c(n, a)
    ans -= comb_c(n, b)
    ans %= MOD
    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    MOD = 10 ** 9 + 7
    n, a, b = map(int, input().split())

    def comb_c(n, r):
        if r > n - r:
            r = n - r
        a, b = 1, 1
        for i in range(r):
            a = a * (n - i) % MOD
            b = b * (i + 1) % MOD
        return a * pow(b, MOD-2, MOD)

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

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from math import factorial
from functools import lru_cache

def input(): return sys.stdin.readline().rstrip()

def main():
    MOD = 10 ** 9 + 7
    n, a, b = map(int, input().split())

    @lru_cache(maxsize=None)
    def f(n):
        return factorial(n)

    def comb_c(n, r):
        if r > n - r:
            r = n - r 
        a = f(n) % MOD
        b = f(n - r) * f(r)
        return a * pow(b, MOD - 2, MOD) % MOD

    n2 = (n - 1) // 2
    ans = 1
    for i in range(1, n2 + 1):
        ans += comb_c(n, i) * 2
    if n % 2 == 0:
        ans += comb_c(n, n2 + 1)
    ans -= comb_c(n, a)
    ans -= comb_c(n, b)
    ans %= MOD
    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    MOD = 10 ** 9 + 7
    n, a, b = map(int, input().split())

    def comb_c(n, r):
        if r > n - r:
            r = n - r
        a, b = 1, 1
        for i in range(r):
            a = a * (n - i) % MOD
            b = b * (i + 1) % MOD
        return a * pow(b, MOD-2, MOD)

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

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from operator import mul
from functools import reduce

def input(): return sys.stdin.readline().rstrip()

def main():
    MOD = 10 ** 9 + 7
    n, a, b = map(int, input().split())
    ab = set([a, b])

    def comb_c(n, r):
        r = min(r, n - r)
        a = reduce(mul, range(n, n - r, -1), 1) % MOD
        b = reduce(mul, range(1, r + 1), 1)
        return a * pow(b, MOD - 2, MOD) % MOD

    n2 = (n - 1) // 2
    ans = 1
    for i in range(1, n2 + 1):
        ans += comb_c(n, i) * 2
    if n % 2 == 0:
        ans += comb_c(n, n2 + 1)
    ans -= comb_c(n, a)
    ans -= comb_c(n, b)
    ans %= MOD
    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    MOD = 10 ** 9 + 7
    n, a, b = map(int, input().split())

    def comb_c(n, r):
        if r > n - r:
            r = n - r
        a, b = 1, 1
        for i in range(r):
            a = a * (n - i) % MOD
            b = b * (i + 1) % MOD
        return a * pow(b, MOD-2, MOD)

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

if __name__ == '__main__':
    main()