Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
A, B, C, D, E, F = tuple(map(int, input().split()))
max_con = 0
res = None
for i in range(31):
    for j in range(31):
        for k in range(31):
            for l in range(31):
                x = 100 * A * i + 100 * B * j
                y = C * k + D * l
                if x + y != 0 and x + y <= F and y <= (x // 100) * E \
                        and max_con < y / (x + y):
                    max_con = y / (x + y)
                    res = (x + y, y)
                    # print(x + y, y)
print(*res)


Fixed submission:
A, B, C, D, E, F = tuple(map(int, input().split()))
max_con = 0
res = (100 * A, 0)
for i in range(F // (100 * A) + 1):
    for j in range(F // (100 * B) + 1):
        if i == 0 and j == 0:
            continue
        wat = (A * i + B * j)
        x = 100 * wat
        if F < x:
            continue
        for k in range(wat * E // C + 1):
            for l in range(wat * E // D + 1):
                y = C * k + D * l
                if wat * E < y:
                    continue
                total = x + y
                if F < total:
                    continue
                if max_con < y / total:
                    max_con = y / total
                    res = (total, y)
                    # print(x + y, y)
print(*res)

Buggy python submission (verdict: Runtime Error):
A, B, C, D, E, F = tuple(map(int, input().split()))
max_con = 0
res = None
for l in range(100*A, F+1, 100):
    if l % (100 * A) == 0 or l % (100 * B) == 0:
        for e in range(1, E*(l//100)+1):
            if (e % C == 0 or e % D == 0) and  l + e <= F:
                if max_con < e / (l + e):
                    max_con = e / (l + e)
                    res = (l+e, e)
print(*res)

Fixed submission:
A, B, C, D, E, F = tuple(map(int, input().split()))
max_con = 0
res = (100 * A, 0)
for i in range(F // (100 * A) + 1):
    for j in range(F // (100 * B) + 1):
        if i == 0 and j == 0:
            continue
        wat = (A * i + B * j)
        x = 100 * wat
        if F < x:
            continue
        for k in range(wat * E // C + 1):
            for l in range(wat * E // D + 1):
                y = C * k + D * l
                if wat * E < y:
                    continue
                total = x + y
                if F < total:
                    continue
                if max_con < y / total:
                    max_con = y / total
                    res = (total, y)
                    # print(x + y, y)
print(*res)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N, M, R = map(int, input().split())
r = list(map(int, input().split()))
r = [x - 1 for x in r]
d = [[float("inf")] * N for i in range(N)]
for _ in range(M):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    d[a][b] = c
    d[b][a] = c


def warshall_floyd(d):
    # d[i][j]: iからjへの最短距離
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    return d

warshall_floyd(d)
# print(d)
ans = float('inf')
for x in itertools.permutations(r):
    cost = 0
    # print(x)
    for i in range(len(x) - 1):
        # print(i)
        cost += d[x[i]][x[i+1]]
    ans = min(ans, cost)
print(ans)

Fixed submission:
import itertools
N, M, R = map(int, input().split())
r = list(map(int, input().split()))
r = [x - 1 for x in r]
d = [[float("inf")] * N for i in range(N)]
for _ in range(M):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    d[a][b] = c
    d[b][a] = c


def warshall_floyd(d):
    # d[i][j]: iからjへの最短距離
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    return d

warshall_floyd(d)
# print(d)
ans = float('inf')
for x in itertools.permutations(r):
    cost = 0
    # print(x)
    for i in range(len(x) - 1):
        # print(i)
        cost += d[x[i]][x[i+1]]
    ans = min(ans, cost)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
count = 0
while True:
    for i in range(N-1):
        if i + 1 == P[i]:
            P[i], P[i+1] = P[i+1], P[i]
            count += 1
    flag = True
    for i in range(1, N+1):
        if i == P[i-1]:
            flag = False
            break
    if flag:
        break

print(count)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
count = 0
for i in range(N-1):
    if i + 1 == P[i]:
        P[i], P[i+1] = P[i+1], P[i]
        count += 1

if N == P[N-1]:
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

N = int(input())
T = [int(input()) for _ in range(N)]
base = lcm(T[0], T[1])
for i in range(2, N):
    base = lcm(base, T[i])
print(base)


Fixed submission:
# 最大公約数
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


# 最小公倍数
def lcm(a, b):
    return a * b // gcd(a, b)


N = int(input())
T = [int(input()) for _ in range(N)]
if N == 1:
    print(T[0])
    exit()

base = lcm(T[0], T[1])
for i in range(2, N):
    base = lcm(base, T[i])
print(base)
Buggy python submission (verdict: Runtime Error):
N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N-1):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append((b, c))
    edges[b].append((a, c))

depth = [0] * N

def dfs(v, p, d):
    depth[v] = d
    for e in edges[v]:
        if e[0] == p:
            continue
        dfs(e[0], v, d + e[1])


Q, K = map(int, input().split())
K -= 1

dfs(K, -1, 0)

for i in range(Q):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    print(depth[x] + depth[y])



Fixed submission:
import sys

sys.setrecursionlimit(10 ** 7)

N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N-1):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append((b, c))
    edges[b].append((a, c))

depth = [0] * N

def dfs(v, p, d):
    depth[v] = d
    for e in edges[v]:
        if e[0] == p:
            continue
        dfs(e[0], v, d + e[1])


Q, K = map(int, input().split())
K -= 1

dfs(K, -1, 0)

for i in range(Q):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    print(depth[x] + depth[y])
Buggy python submission (verdict: Runtime Error):
H, W = list(map(int, input().split()))
N = int(input())
A = list(map(int, input().split()))
res = [["" for _ in range(W)] for h in range(H)]
start_y, start_x = 0, -1
pos_y, pos_x = start_y, start_x
dy, dx = 0, 1
for idx, a in enumerate(A, 1):
    for i in range(a):
        pos_x += dx
        pos_y += dy
        res[pos_y][pos_x] = str(idx)
        if pos_x == W - 1:
            if dy == 0:
                dx = 0
                dy = 1
            else:
                dx = -1
                dy = 0
        elif not pos_y == 0 and pos_x == 0:
            if dy == 0:
                dx = 0
                dy = 1
            else:
                dx = 1
                dy = 0
res = ["".join(x) for x in res]
res = "\n".join(res)
print(res)



Fixed submission:
H,W=map(int,input().split())
N=int(input())
a=list(map(int,input().split()))
a_all=[]
c=[[""]*W for i in range(H)]

for i in range(N):
    b=[i+1]*a[i]
    a_all.extend(b)

i=0
for j in range(H):
    if j%2==0:
        for k in range(W):
            c[j][k]=str(a_all[i])
            i+=1
    else:
        for k in range(W-1,-1,-1):
            c[j][k]=str(a_all[i])
            i+=1

for i in range(H):
    print(" ".join(c[i]))
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


N, K = map(int, input().split())
A = list(map(int, input().split()))
if K in A:
    print("POSSIBLE")
    exit()

max_val = max(A)
if max_val < K:
    print("IMPOSSIBLE")
    exit()

gcd_val = A[0]
for a in A[1:]:
    gcd_val = gcd(gcd_val, a)

ans = max_val
while K <= ans:
    if K == ans:
        print("POSSIBLE")
        exit()
    else:
        ans -= gcd_val
print("IMPOSSIBLE")

Fixed submission:
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


N, K = map(int, input().split())
A = list(map(int, input().split()))
if K in A:
    print("POSSIBLE")
    exit()

max_val = max(A)
if max_val < K:
    print("IMPOSSIBLE")
    exit()

gcd_val = A[0]
for a in A[1:]:
    gcd_val = gcd(gcd_val, a)

ans = max_val
while K <= ans:
    if K == ans:
        print("POSSIBLE")
        exit()
    else:
        ans -= gcd_val
print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
if N == 2:
    print(abs(A[0] - A[1]))
    exit()

ans = []
for i in range(1, N-1):
    cards1 = A[:i]
    cards2 = A[i:]
    ans.append(abs(sum(cards1) - sum(cards2)))
print(min(ans))


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = float('inf')
X = sum(A)
partial_sum = 0
for i in range(N-1):
    partial_sum += A[i]
    ans = min(ans, abs(X - 2 * partial_sum))
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append(b)
    edges[b].append(a)

dist = [0] * N
def dfs(u, d, p=-1):
    global dist
    dist[u] = d
    for v in edges[u]:
        if v == p:
            continue
        dfs(v, d + 1, u)
    return dist

dist1 = dfs(0, 0, -1)
dist = [0] * N
dist2 = dfs(N - 1, 0, -1)

cnt = 0
for d1, d2 in zip(dist1, dist2):
    if d1 <= d2:
        cnt += 1
if N - cnt < cnt:
    print("Fennec")
else:
    print("Snuke")

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)
N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append(b)
    edges[b].append(a)

dist = [0] * N
def dfs(u, d, p=-1):
    global dist
    dist[u] = d
    for v in edges[u]:
        if v == p:
            continue
        dfs(v, d + 1, u)
    return dist

dist1 = dfs(0, 0, -1)
dist = [0] * N
dist2 = dfs(N - 1, 0, -1)

cnt = 0
for d1, d2 in zip(dist1, dist2):
    if d1 <= d2:
        cnt += 1
if N - cnt < cnt:
    print("Fennec")
else:
    print("Snuke")
Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())
w, v = [], []
for _ in range(N):
    x, y = map(int, input().split())
    w.append(x)
    v.append(y)
dp = [[0 for _ in range(W+2)] for _ in range(N+2)]
for i in range(N):
    for j in range(W+1):
        if j < w[i]:
            dp[i+1][j] = dp[i][j]
        else:
            dp[i+1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i])
print(dp[N][W])


Fixed submission:
from collections import defaultdict

N, W = map(int, input().split())
wv = defaultdict(list)
for _ in range(N):
    w, v = map(int, input().split())
    wv[w].append(v)

for k in wv.keys():
    wv[k].sort(reverse=True)

kw = list(wv.keys())
kw.sort()
l = [len(wv[k]) for k in kw]
l = l + (4 - len(l)) * [0]
# print(l)

ans = 0
for i in range(l[0] + 1):
    wi = kw[0] * i
    if W < wi:
        break
    vi = sum(wv[kw[0]][:i])
    if l[1] == 0:
        ans = max(ans, vi)
    for j in range(l[1] + 1):
        if 2 <= len(kw):
            wj = wi + kw[1] * j
            if W < wj:
                break
            vj = vi + sum(wv[kw[1]][:j])
            if l[2] == 0:
                ans = max(ans, vj)
            for k in range(l[2] + 1):
                if 3 <= len(kw):
                    wk = wj + kw[2] * k
                    if W < wk:
                        break
                    vk = vj + sum(wv[kw[2]][:k])
                    if l[3] == 0:
                        ans = max(ans, vk)
                    for m in range(l[3] + 1):
                        if 4 <= len(kw):
                            wm = wk + kw[3] * m
                            if W < wm:
                                break
                            vm = vk + sum(wv[kw[3]][:m])
                            ans = max(ans, vm)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
power = 1
for i in range(1, N+1):
    power *= i
print(power % 1000000007)

Fixed submission:
import math

N = int(input())
power = math.factorial(N)
print(power % 1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
power = 1
for i in range(1, N+1):
    power *= i
print(power % 1000000007)

Fixed submission:
import math

N = int(input())
power = math.factorial(N)
print(power % 1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = list(map(int, input().split()))
if N >= M:
    print(M // 2)
else:
    while N * 2 < M:
        N += 1
        M -= 2
    print(M // 2)

Fixed submission:
N, M = list(map(int, input().split()))
count = 0
if N >= (M // 2):
    count += (M // 2)
else:
    count += N
    M -= (2 * N)
    count += (M // 4)
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A, B = [], []
for _ in range(N):
    a, b = tuple(map(int, input().split()))
    A.append(a)
    B.append(b)
count = 0
for i in range(N-1, -1, -1):
    A[i] += count
    while True:
        if A[i] % B[i] == 0:
            break
        else:
            count += 1
            A[i] += 1
print(count)

Fixed submission:
N = int(input())
A, B = [], []
for _ in range(N):
    a, b = tuple(map(int, input().split()))
    A.append(a)
    B.append(b)
count = 0
for i in range(N-1, -1, -1):
    if (A[i] + count) % B[i] == 0:
        continue
    count += (B[i] - ((A[i] + count) % B[i]))
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N-1):
    for j in range(i+1, N):
        if i + 1 == A[j] and j + 1 == A[i]:
            ans += 1
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N):
    if i + 1 == A[A[i]-1]:
        ans += 1
print(ans // 2)
Buggy python submission (verdict: Runtime Error):
s = input()
K = int(input())
base_count = ord("z") + 1
ans = ""
for c in s:
    if (base_count - ord(c)) <= K:
        ans += "a"
        K -= (base_count - ord(c))
    else:
        ans += c
if K > 0:
    ans = ans[:-1] + chr(ord(ans[-1]) + K)
print(ans)

Fixed submission:
s = input()
K = int(input())
base_count = ord("z") + 1
ans = ""
for c in s:
    t = (base_count - ord(c)) % 26
    if t <= K:
        ans += "a"
        K -= t
    else:
        ans += c
if K > 0:
    K = K % 26
    ans = ans[:-1] + chr((ord(ans[-1]) + K))
print(ans)
Buggy python submission (verdict: Runtime Error):

def main():
    n = int(input())
    
    if n//100 == 7:
        return "Yes"
    
    n %= 100
    if n // 10 == 7:
        return "Yes"
    
    n %= 10
    if n == 7:
        return "Yes"
    
    return "No"


if __name__ == '__main__':
    print main()

Fixed submission:
def qqq(n):

    a = int(n/100)
    if a == 7: 
        return "Yes" 
    
    n %= 100
    b = int(n/10)
    if b == 7:
        return "Yes"
    
    n %= 10
    if n == 7:
        return "Yes"

    return "No"

if __name__ == '__main__':
    N = int(raw_input())
    print qqq(N)

Buggy python submission (verdict: Runtime Error):
    def qqq(n):
     
        a = int(n/100)
        if a == 7: 
            return "Yes" 
        
        n %= 100
        b = int(n/10)
        if b == 7:
            return "Yes"
        
        n %= 10
        if n == 7:
            return "Yes"
     
        return "No"
     
    if __name__ == '__main__':
        N = int(input())
        print (qqq(N))

Fixed submission:
def qqq(n):

    a = int(n/100)
    if a == 7: 
        return "Yes" 
    
    n %= 100
    b = int(n/10)
    if b == 7:
        return "Yes"
    
    n %= 10
    if n == 7:
        return "Yes"

    return "No"

if __name__ == '__main__':
    N = int(raw_input())
    print qqq(N)

Buggy python submission (verdict: Runtime Error):
def qqq(n):

    a = int(n/100)
    if a == 7: 
        return "Yes" 
    
    n %= 100
    b = int(n/10)
    if b == 7:
        return "Yes"
    
    n %= 10
    if n == 7:
        return "Yes"

    return "No"

if __name__ == '__main__':
    N = int(input())
    print qqq(N)

Fixed submission:
def qqq(n):

    a = int(n/100)
    if a == 7: 
        return "Yes" 
    
    n %= 100
    b = int(n/10)
    if b == 7:
        return "Yes"
    
    n %= 10
    if n == 7:
        return "Yes"

    return "No"

if __name__ == '__main__':
    N = int(raw_input())
    print qqq(N)
Buggy python submission (verdict: Runtime Error):
    def ans():
        n ,m = map(int, raw_input().split())
        A = list(map(int, raw_input().split()))
     
        divider = sum(A) / (4 * m + 1e-16)
     
        stack = 0
        for a in A:            
            if a >= divider:
                stack += 1
     
            if stack == m:
                return "Yes"
        return "No"        
     
     
    print ans()

Fixed submission:
n ,m = map(int, raw_input().split())
A = sorted(list(map(int, raw_input().split())), reverse = True)
divider = sum(A) / (4.0 * m) 

stack = 0

for a in A:
    if a >= divider:
        stack += 1

if stack >= m:
    print 'Yes'
else:
    print 'No'
Buggy python submission (verdict: Runtime Error):
n=input()
N=n//10

if n=2　or 4 or 5 or 7 or 9:
  print(hon)
elif n=0 or 1 or 6 or 8:
  print(pon)
else:
  print(bon)


Fixed submission:
N=input()
n=int(N)%10

if n==2:
  print('hon')
elif n==4:
  print('hon')
elif n==5:
  print('hon')
elif n==7:
  print('hon')
elif n==9:
  print('hon')
elif n==0:
  print('pon')
elif n==1:
  print('pon')
elif n==6:
  print('pon')
elif n==8:
  print('pon')
elif n==3:
  print('bon')
Buggy python submission (verdict: Runtime Error):
S=input()
K=input()
if l>=int(S):
    print(K[:1]+'...')
else:
    print(K)

Fixed submission:
S=int(input())
K=input()
k=len(K)

if k>S:
    print(K[:S]+'...')
else:
    print(K)
Buggy python submission (verdict: Runtime Error):
import math
HL,ML,h,m=(int(x) for x in input().split())
HW=int((60*h+m)/2)
MW=int(6*m)

if HW >= MW:
    if HW-MW>180:
        w=360-(HW-MW)
    else:
        w=HW-MW
    print(math.sqrt(HL*HL+ML*ML-2*HL*ML*math.cos(math.radians(w))))
else:
    if HW-MW>180:
        w=360-(HW-MW)
    else:
        w=HW-MW
    print(math.sqrt(HL*HL+ML*ML-2*HL*ML*math.cos(mthradians(-w))))

Fixed submission:
import math
HL,ML,h,m=(int(x) for x in input().split())
HW=float((60*h+m)/2)
MW=float(6*m)

if HW > MW:
    if HW-MW>180:
        w=360-(HW-MW)
    else:
        w=HW-MW
    print(math.sqrt(HL*HL+ML*ML-2*HL*ML*math.cos(math.radians(w))))
else:
    if HW-MW>180:
        w=360-(HW-MW)
    else:
        w=HW-MW
    print(math.sqrt(HL*HL+ML*ML-2*HL*ML*math.cos(math.radians(-w))))

Buggy python submission (verdict: Runtime Error):
import math
HL,ML,h,m=(int(x) for x in input().split())
HW=int((60*h+m)/2)
MW=int(6*m)

print(HW,MW)

if HW >= MW:
    if HW-MW>180:
        w=360-(HW-MW)
    else:
        w=HW-MW
    print(math.sqrt(HL*HL+ML*ML-2*HL*ML*math.cos(math.radians(w))))
else:
    if HW-MW>180:
        w=360-(HW-MW)
    else:
        w=HW-MW
    print(math.sqrt(HL*HL+ML*ML-2*HL*ML*math.cos(mthradians(-w))))

Fixed submission:
import math
HL,ML,h,m=(int(x) for x in input().split())
HW=float((60*h+m)/2)
MW=float(6*m)

if HW > MW:
    if HW-MW>180:
        w=360-(HW-MW)
    else:
        w=HW-MW
    print(math.sqrt(HL*HL+ML*ML-2*HL*ML*math.cos(math.radians(w))))
else:
    if HW-MW>180:
        w=360-(HW-MW)
    else:
        w=HW-MW
    print(math.sqrt(HL*HL+ML*ML-2*HL*ML*math.cos(math.radians(-w))))
Buggy python submission (verdict: Runtime Error):
n=int(raw_input())
last=n % 10
hon=[2,4,5,7,9]
pon=[0,1,6,8]
bon=[3]
if last in hon:
  print("hon")
if last in pon:
  print("pon")
if last in bon:
  print("bon")

Fixed submission:
n=int(input())
last=n % 10
hon=[2,4,5,7,9]
pon=[0,1,6,8]
bon=[3]
if last in hon:
  print("hon")
if last in pon:
  print("pon")
if last in bon:
  print("bon")

Buggy python submission (verdict: Runtime Error):
N=int(input())
m=N[-1]
if m== 2 or m==4 or m==5 or m==7 or m==9:
  print("hon")
elif m==0 or m==1 or m==6 or m==8:
  print("pon")
else
  print("bon"


Fixed submission:
N=input()
m=int(N[-1])
if m== 2 or m==4 or m==5 or m==7 or m==9:
  print("hon")
elif m==0 or m==1 or m==6 or m==8:
  print("pon")
else:
  print("bon")
Buggy python submission (verdict: Runtime Error):
n=int(input())
chara=input()
nc=len(chara)

if n=>nc:
  print(chara)
else:	
  print(chara[1:n])
  
  

Fixed submission:
n=int(input())
chara=input()
nc=len(chara)

if n>=nc:
  print(chara)
else:	
  print(chara[0:n]+"...")
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
count=0

for i in range(len(s)-3):
  for j in range(i+4,len(s)+1):
    #print(i,j)
    n= int(s[i:j])
    if n % 2019 == 0:
      #print("!")
      count=count+1
      
print(count)

Fixed submission:
s=input()
s_rev=s[::-1]

mod_count=[0]*2019
mod_count[0]=1
d=1
num=0

for char in s_rev:
  num=num+int(char)*d
  num=num%2019
  d=d*10
  d=d%2019
  #print(type(num),type(mod_count))
  mod_count[num]=mod_count[num]+1

ans=0
for cnt in mod_count:
  ans=ans+cnt*(cnt-1)/2
  
print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))

l.sort()

cnt = 0

for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            if l[i] + l[j] > l[k] and l[i] + l[k] > l[j]:
                cnt += 1

print(cnt)


Fixed submission:
import bisect

n = int(input())
l = list(map(int, input().split()))

l.sort()
# print(l)

cnt = 0

for i in range(n):
    for j in range(i+1, n-1):
        t = l[i] + l[j]
        idx = bisect.bisect_left(l, t)
        cnt += idx - (j + 1)
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
import math
n, k = map(int, input().split())
"""
def cmb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

mod = 10**9+7
"""
def cmb(n, r):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r]

mod = 10**9+7 #出力の制限
N = 2000
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

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

for i in range(1, k + 1):
    print(cmb(n - k + 1, i) * cmb(k - 1, i - 1) % mod)

Fixed submission:
import math
n, k = map(int, input().split())
"""
def cmb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

mod = 10**9+7
"""
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

mod = 10**9+7 #出力の制限
N = 2000
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, mod) * cmb(k - 1, i - 1, mod)) % mod)
    #print(cmb(n - k + 1, i))
    #print(cmb(k - 1, i - 1))

Buggy python submission (verdict: Runtime Error):
import math
n, k = map(int, input().split())

def cmb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

mod = 10**9+7

for i in range(1, k + 1):
    print(cmb(n - k + 1, i) * cmb(k - 1, i - 1) % mod)

Fixed submission:
import math
n, k = map(int, input().split())
"""
def cmb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

mod = 10**9+7
"""
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

mod = 10**9+7 #出力の制限
N = 2000
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, mod) * cmb(k - 1, i - 1, mod)) % mod)
    #print(cmb(n - k + 1, i))
    #print(cmb(k - 1, i - 1))