Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n,a,b = map(int,input().split())
    MOD = 10**9 +7
    s = pow(2,n,MOD)-1
    P_ni = 1
    F_i = 1

    for i in range(1,b + 1):
        P_ni*=(n-i+1)%MOD
        F_i*= i % MOD
        if i == a or i == b:
            s-=P_ni*pow(F_i,MOD-2,MOD)
    print(s%MOD)

if __name__=='__main__':
    main()


Fixed submission:
def main():
    n,a,b = map(int,input().split())
    MOD = 10**9 +7
    s = pow(2,n,MOD)-1
    P_ni = 1
    F_i = 1


    for i in range(1,b + 1):
        P_ni=P_ni*(n-i+1)%MOD
        F_i=F_i* i % MOD
        if i == a or i == b:
            s-=P_ni*pow(F_i,MOD-2,MOD)



    print(s%MOD)

if __name__=='__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n,a,b = map(int,input().split())
    MOD = 10**9 +7
    s = pow(2,n,MOD)-1
    P_ni = 1
    F_i = 1


    for i in range(1,b + 1):
        P_ni*=(n-i+1)%MOD
        F_i*= i % MOD
        if i == a or i == b:
            s-=P_ni*pow(F_i,MOD-2,MOD)



    print(s%MOD)

if __name__=='__main__':
    main()


Fixed submission:
def main():
    n,a,b = map(int,input().split())
    MOD = 10**9 +7
    s = pow(2,n,MOD)-1
    P_ni = 1
    F_i = 1


    for i in range(1,b + 1):
        P_ni=P_ni*(n-i+1)%MOD
        F_i=F_i* i % MOD
        if i == a or i == b:
            s-=P_ni*pow(F_i,MOD-2,MOD)



    print(s%MOD)

if __name__=='__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n,a,b = map(int,input().split())
    MOD = (10**9)+7
    s = pow(2,n,MOD)-1
    u = 1
    bb = 1


    for i in range(1,(max(a,b) + 1)):
        u*=(n-i+1)%MOD
        bb*= i % MOD
        if i == a or i == b:
            s-=u*pow(bb,MOD-2,MOD)



    print(s%MOD)
#


if __name__=='__main__':
    main()


Fixed submission:
def main():
    n,a,b = map(int,input().split())
    MOD = 10**9 +7
    s = pow(2,n,MOD)-1
    P_ni = 1
    F_i = 1


    for i in range(1,b + 1):
        P_ni=P_ni*(n-i+1)%MOD
        F_i=F_i* i % MOD
        if i == a or i == b:
            s-=P_ni*pow(F_i,MOD-2,MOD)



    print(s%MOD)

if __name__=='__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n,a,b = map(int,input().split())
    MOD = (10**9)+7
    s = pow(2,n,MOD)-1
    u = 1
    bb = 1


    for i in range(1,(max(a,b) + 1)):
        u*=(n-i+1)%MOD
        bb*= i % MOD
        if i == a or i == b:
            s-=u*pow(bb,MOD-2,MOD)



    print(s%MOD)
#


if __name__=='__main__':
    main()


Fixed submission:
def main():
    n,a,b = map(int,input().split())
    MOD = 10**9 +7
    s = pow(2,n,MOD)-1
    P_ni = 1
    F_i = 1


    for i in range(1,b + 1):
        P_ni=P_ni*(n-i+1)%MOD
        F_i=F_i* i % MOD
        if i == a or i == b:
            s-=P_ni*pow(F_i,MOD-2,MOD)



    print(s%MOD)

if __name__=='__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n,a,b = map(int,input().split())
    MOD = (10**9)+7
    # s = powpow(2,n)
    s=pow(2,n,MOD) -1
    f,inv_f=comInit(MOD,n)

    s-=calCom(n,a,MOD,f,inv_f)
    s-=calCom(n,b,MOD,f,inv_f)

    print(s)

def powpow(a,n):
    mod = (10**9)+7
    x = 1
    i = 0
    while n > 0:
        print(bin(n))
        if bin(n & 1):
            x=x*a
            # x%=mod
        a*=a
        print(x)
        # a%=mod
        i+=1
        n=n>>1

    print('aaa')
    return x

def comInit(MOD, n):
    fact=[1,1] # fact[n]はnの階乗
    invr=[0,1] # invr[n]はnの逆元
    invr_fact=[1,1] # invr_fact[n]は逆元の階乗

    for i in range(2,n+1):
        fact.append(fact[-1]*i%MOD)
        invr.append(-invr[MOD%i]*(MOD//i)%MOD)
        invr_fact.append(invr_fact[-1]*invr[-1]%MOD)
    return fact,invr_fact

def calCom(n,k,MOD,fact,invr_fact):
    k=min(k,n-k)
    return fact[n]*invr_fact[k]*invr_fact[n-k]%MOD



if __name__=='__main__':
    main()


Fixed submission:
def main():
    n,a,b = map(int,input().split())
    MOD = 10**9 +7
    s = pow(2,n,MOD)-1
    P_ni = 1
    F_i = 1


    for i in range(1,b + 1):
        P_ni=P_ni*(n-i+1)%MOD
        F_i=F_i* i % MOD
        if i == a or i == b:
            s-=P_ni*pow(F_i,MOD-2,MOD)



    print(s%MOD)

if __name__=='__main__':
    main()