Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
mod = 10**9 + 7
ans = 0

f = 1
for i in range(1, n+1):
  f *= i
  f %= mod
     
# n!^-1 の計算
inv = pow(f, mod - 2, mod)
# n!^-1 - 1!^-1 の計算
invs = [1] * (n + 1)
invs[n] = inv
for m in range(n, 1, -1):
    inv *= m
    inv %= mod
    invs[m - 1] = inv

def comb(n,k):
  if k==0 or k==n: return 1
  return (f*invs[k]*invs[n-k])%mod

for i in range(1, n+1):
    if i != a and i != b:
        ans += (comb(n, i))
print(ans)

Fixed submission:
# import sys
# sys.setrecursionlimit(10000)

N, K = map(int, input().split())
mod = 10**9 + 7
# def cmb(n, r):
#     if n - r < r: r = n - r
#     if r == 0: return 1
#     if r == 1: return n

#     numerator = [n - r + k + 1 for k in range(r)]
#     denominator = [k + 1 for k in range(r)]

#     for p in range(2,r+1):
#         pivot = denominator[p - 1]
#         if pivot > 1:
#             offset = (n - r) % p
#             for k in range(p-1,r,p):
#                 numerator[k - offset] /= pivot
#                 denominator[k] /= pivot

#     result = 1
#     for k in range(r):
#         if numerator[k] > 1:
#             result *= int(numerator[k])

#     return result


def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


for i in range(1, K+1):
    # print(cmb(N-K+1, i) , cmb(K-1, i-1))
    ans = cmb(N-K+1, i, mod) * cmb(K-1, i-1, mod) % mod
    print(ans)

Buggy python submission (verdict: Runtime Error):
from math import factorial

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

f = 1
for i in range(1, n+1):
  f *= i
  f %= mod
     
# n!^-1 の計算
inv = pow(f, mod - 2, mod)
# n!^-1 - 1!^-1 の計算
invs = [1] * (n + 1)
invs[n] = inv
for m in range(n, 1, -1):
    inv *= m
    inv %= mod
    invs[m - 1] = inv

def comb(n,k):
  if k==0 or k==n: return 1
  return (f*invs[k]*invs[n-k])%mod

for i in range(1, n+1):
    if i != a and i != b:
        ans += (comb(n, i))
print(ans)

Fixed submission:
# import sys
# sys.setrecursionlimit(10000)

N, K = map(int, input().split())
mod = 10**9 + 7
# def cmb(n, r):
#     if n - r < r: r = n - r
#     if r == 0: return 1
#     if r == 1: return n

#     numerator = [n - r + k + 1 for k in range(r)]
#     denominator = [k + 1 for k in range(r)]

#     for p in range(2,r+1):
#         pivot = denominator[p - 1]
#         if pivot > 1:
#             offset = (n - r) % p
#             for k in range(p-1,r,p):
#                 numerator[k - offset] /= pivot
#                 denominator[k] /= pivot

#     result = 1
#     for k in range(r):
#         if numerator[k] > 1:
#             result *= int(numerator[k])

#     return result


def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


for i in range(1, K+1):
    # print(cmb(N-K+1, i) , cmb(K-1, i-1))
    ans = cmb(N-K+1, i, mod) * cmb(K-1, i-1, mod) % mod
    print(ans)