Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

mod = 1000000007

def nCr(n, r):

    r = min(r, n-r)

    bunsi = 1
    for i in range(n, n-r, -1):
        bunsi *= i

    bunbo = 1
    for i in range(r, 1, -1):
        bunbo *= i

    return bunsi // bunbo


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

hana_kind_cnt = n

result = 0
for hanataba_koho_select_cnt in range(1, hana_kind_cnt + 1):
    if not(hanataba_koho_select_cnt == a or hanataba_koho_select_cnt == b):
        result += nCr(n, hanataba_koho_select_cnt) % mod

print(int(result))


Fixed submission:
# -*- coding: utf-8 -*-
from functools import reduce

MOD = 1000000007

def power_func(a, b, mod):
    if b == 0: return 1
    if b % 2 == 0:
        d = power_func(a, b // 2, mod)
        return d * d % mod
    if b % 2 == 1:
        return (a * power_func(a, b - 1, mod)) % mod

def nCr(n, r, mod):

    min_r = min(r, n-r)

    if min_r == 1: return n


    bunsi = reduce(lambda x, y: (x * y) % mod, range(n, n-r, -1))
    bunbo = reduce(lambda x, y: (x * y) % mod, range(r, 1, -1))

    return bunsi * power_func(bunbo, mod - 2, mod) % mod


n, a, b = [int(i) for i in input().split()]

print(((power_func(2, n, MOD) -1) - nCr(n, a, MOD)- nCr(n, b, MOD)) % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

mod = 1000000007
def choiceCnt(target_cnt, select_cnt):

    ret_1 = 0
    temp_list = []
    for temp in range(select_cnt):
        temp_list.append(target_cnt - temp)

    bunnsi = 1
    for sub in temp_list:
        bunnsi *= sub

    bunbo = 1
    for sub in range(1, select_cnt + 1):
        bunbo *= sub

    return bunnsi // bunbo


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

hana_kind_cnt = n

result = 0
for hanataba_koho_select_cnt in range(1, hana_kind_cnt + 1):
    if not(hanataba_koho_select_cnt == a or hanataba_koho_select_cnt == b):
        result += choiceCnt(n, hanataba_koho_select_cnt) % mod

print(int(result))


Fixed submission:
# -*- coding: utf-8 -*-
from functools import reduce

MOD = 1000000007

def power_func(a, b, mod):
    if b == 0: return 1
    if b % 2 == 0:
        d = power_func(a, b // 2, mod)
        return d * d % mod
    if b % 2 == 1:
        return (a * power_func(a, b - 1, mod)) % mod

def nCr(n, r, mod):

    min_r = min(r, n-r)

    if min_r == 1: return n


    bunsi = reduce(lambda x, y: (x * y) % mod, range(n, n-r, -1))
    bunbo = reduce(lambda x, y: (x * y) % mod, range(r, 1, -1))

    return bunsi * power_func(bunbo, mod - 2, mod) % mod


n, a, b = [int(i) for i in input().split()]

print(((power_func(2, n, MOD) -1) - nCr(n, a, MOD)- nCr(n, b, MOD)) % MOD)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

mod = 1000000007
def choice(target, i, select_cnt):
    ret = 0
    temp_list = list(target)
    temp = []
    for n in range(i, len(target)):
        temp.append(target[n])
        if len(temp) == select_cnt:
            ret += 1
            temp.pop()

    return ret


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

hana_kind = list(range(1, n + 1))

hanataba_koho = list(set(hana_kind) - {a, b})

result = 0
for hanataba_koho_select_cnt in hanataba_koho:
    for i in range(len(hana_kind) - hanataba_koho_select_cnt + 1):
        result += choice(hana_kind, i, hanataba_koho_select_cnt) % mod

print(result)


Fixed submission:
# -*- coding: utf-8 -*-
from functools import reduce

MOD = 1000000007

def power_func(a, b, mod):
    if b == 0: return 1
    if b % 2 == 0:
        d = power_func(a, b // 2, mod)
        return d * d % mod
    if b % 2 == 1:
        return (a * power_func(a, b - 1, mod)) % mod

def nCr(n, r, mod):

    min_r = min(r, n-r)

    if min_r == 1: return n


    bunsi = reduce(lambda x, y: (x * y) % mod, range(n, n-r, -1))
    bunbo = reduce(lambda x, y: (x * y) % mod, range(r, 1, -1))

    return bunsi * power_func(bunbo, mod - 2, mod) % mod


n, a, b = [int(i) for i in input().split()]

print(((power_func(2, n, MOD) -1) - nCr(n, a, MOD)- nCr(n, b, MOD)) % MOD)