Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from sys import stdin, exit
import itertools
#stdin = open("input.txt")

if __name__ == "__main__":
    N, K = [int(item) for item in stdin.readline().split()]
    li = [int(item) for item in stdin.readline().split()]
    
    li.sort()
    
    if sum(li) == K:
        print(N)
    elif sum(li) < K:
        print(N-1)
    else:
        cumsum = itertools.accumulate(li)
        index = [i for i, item in enumerate(cumsum) if item<=K]
        print(index[-1] + 1)

Fixed submission:
from sys import stdin, exit
import itertools
#stdin = open("input.txt")

if __name__ == "__main__":
    N, K = [int(item) for item in stdin.readline().split()]
    li = [int(item) for item in stdin.readline().split()]
    
    li.sort()
    
    if sum(li) == K:
        print(N)
    elif sum(li) < K:
        print(N-1)
    else:
        cumsum = itertools.accumulate(li)
        index = [i for i, item in enumerate(cumsum) if item<=K]
        print(len(index))
Buggy python submission (verdict: Runtime Error):
from sys import stdin

if __name__ == "__main__":
  l = [int(i) for i in stdin.readline().split(' ')]
  sort(l)
  if l[0]%2 == l[1]%2:
    ex = 2
  else:
    ex = 0
  print((l[-1]*2 - (l[0] + l[1]))/2 + ex)
  

Fixed submission:
from sys import stdin

if __name__ == "__main__":
  l = [int(i) for i in stdin.readline().split(' ')]
  l = sorted(l)
  if l[0]%2 == l[1]%2:
    ex = 0
  else:
    ex = 2
  print((l[-1]*2 - (l[0] + l[1]))//2 + ex)
Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
 
K, N, *A = map(int, read().split())
A.append([A[0] + K])
gap = max(y - x for x, y in zip(A, A[1:]))
print(K - gap)

Fixed submission:
import sys
read = sys.stdin.buffer.read
 
K, N, *A = map(int, read().split())
A += [A[0] + K]
gap = max(y-x for x,y in zip(A, A[1:]))
print(K - gap)
Buggy python submission (verdict: Runtime Error):
height,width = map(int, input().split())
map_list = []
for i in range(height):
    map_list.append(list(input()))
    map_list[i].append('0')
map_list.append(['0'] * width)

for h in range(height):
    for w in range(width):
        if map_list[h][w] == '#':
            if '#' in [map_list[h-1][w], map_list[h+1][w], map_list[h][w-1], map_list[h][w+1]]:

            else:
                print("No")
                exit()

print("Yes")


Fixed submission:
height,width = map(int, input().split())
map_list = []
flag = False
for i in range(height):
    map_list.append(list(input()))
    map_list[i].append('0')
map_list.append(['0'] * width)
#print(map_list)

for h in range(height):
    for w in range(width):
        if map_list[h][w] == '#':
            #print("a")
            if '#' in [map_list[h-1][w], map_list[h+1][w], map_list[h][w-1], map_list[h][w+1]]:
                flag = True
                #print("b")
                if flag == True:
                    flag = False
                    #print("c")
            else:
                print("No")
                exit()

print("Yes")
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())

list_irioha = [a, b, c]
count = 0
if a + b + c == 17:
    for i in list_iroha:
        if i == 5:
            count += 1
            if count == 2:
                print("YES")
                exit()
print("NO")
exit()


Fixed submission:
a, b, c = map(int, input().split())

list_iroha = [a, b, c]
count = 0
if a + b + c == 17:
    for i in list_iroha:
        if i == 5:
            count += 1
            if count == 2:
                print("YES")
                exit()
print("NO")
exit()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/python3
# li = list(map(int,input().split()))	

s = input()

li = [1]*len(s)

for _ in range((len(s)//2)*2+2):

    next_li=[0]*len(s)
    for i,c in enumerate(s):        
        if c=="R":
            next_li[i+1]+=li[i]
        else :
            next_li[i-1]+=li[i]
        li[i]=0
    li=next_li

for c in li:
    print(c,end=" ")
print("")

Fixed submission:
#!/usr/bin/python3
# li = list(map(int,input().split()))	

s = input()

li = [1]*len(s)

for i,c in enumerate(s[:len(s)-1]):
   if c == "R":
       if s[i+1]=="R":
           li[i+1]+=li[i]
           li[i]=0

for i in range(len(s)-1,0,-1):
    if s[i]=="L":
        if s[i-1]=="L":
            li[i-1]+=li[i]
            li[i]=0


# print(li)
for i in range(len(s)):
    if li[i]!=0 and s[i]=="R":
        tmp=li[i]+li[i+1]
        if (tmp)%2==0:
            li[i]=li[i+1]=(tmp)/2
        else:
            # print(i)
            if li[i]%2!=0:
                # print("?")
                li[i]=((tmp)//2) + 1
                li[i+1]=(tmp)//2
            else:
                # print("!")
                li[i]=(tmp)//2
                li[i+1]=((tmp)//2) + 1
# print(li)
for c in li:
    print(int(c),end=" ")
print("")
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
B = Counter(A)
seen = [-1]*(5*10**5)
nc2 = [-1]*(5*10**5)
for i in range(N):
    if seen[A[i]] != -1:
        print(seen[A[i]])
        continue
    B[A[i]] -= 1
    ans = 0
    for n in B.values():
        if nc2[n] != -1:
            ans += nc2[n]
            continue
        ans += n*(n-1)//2
    print(ans)
    seen[A[i]] = ans
    B[A[i]] += 1

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
B = Counter(A)

ans = 0
for i in B.values():
    ans += i*(i-1)//2

for a in A:
    k = B[a]
    print(ans - (k*(k-1)//2)+((k-1)*(k-2)//2))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
B = Counter(A)
seen = [-1]*(5*10**5)
for i in range(N):
    if seen[A[i]] != -1:
        print(seen[A[i]])
        continue
    B[A[i]] -= 1
    ans = 0
    for n in B.values():
        ans += n*(n-1)//2
    print(ans)
    seen[A[i]] = ans
    B[A[i]] += 1

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
B = Counter(A)

ans = 0
for i in B.values():
    ans += i*(i-1)//2

for a in A:
    k = B[a]
    print(ans - (k*(k-1)//2)+((k-1)*(k-2)//2))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
B = Counter(A)
seen = [-1]*(10**6)
for i in range(N):
    if seen[A[i]] != -1:
        print(seen[A[i]])
        continue
    B[A[i]] -= 1
    ans = 0
    for n in B.values():
        ans += n*(n-1)//2
    print(ans)
    seen[A[i]] = ans
    B[A[i]] += 1

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
B = Counter(A)

ans = 0
for i in B.values():
    ans += i*(i-1)//2

for a in A:
    k = B[a]
    print(ans - (k*(k-1)//2)+((k-1)*(k-2)//2))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
B = Counter(A)
for i in range(N):
    B[A[i]] -= 1
    ans = 0
    for n in B.values():
        ans += n*(n-1)//2
    print(ans)
    B[A[i]] += 1

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
B = Counter(A)

ans = 0
for i in B.values():
    ans += i*(i-1)//2

for a in A:
    k = B[a]
    print(ans - (k*(k-1)//2)+((k-1)*(k-2)//2))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N = int(input())
A = list(map(int, input().split()))

for i in range(N):
    B = Counter(A[:i] + A[i+1:])
    #print(B)
    ans = 0
    for n in B.values():
        ans += n*(n-1)//2
    print(ans)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
B = Counter(A)

ans = 0
for i in B.values():
    ans += i*(i-1)//2

for a in A:
    k = B[a]
    print(ans - (k*(k-1)//2)+((k-1)*(k-2)//2))
Buggy python submission (verdict: Time Limit Exceeded):
N, X, Y = [int(_) for _ in input().split()]

INF = 10 ** 9
dp = [[INF] * N for _ in range(N)]

for i in range(N - 1):
    dp[i][i + 1] = 1
    dp[i+1][i] = 1

dp[X - 1][Y - 1] = 1
dp[Y - 1][X - 1] = 1

for k in range(N):
    for i in range(N):
        for j in range(N):
            # k経由でiからjへ
            dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])

cnt = [0] * N
for i in range(N):
    for j in range(i+1, N):
        v = dp[i][j]
        cnt[v]+=1
for i in range(1,N):
    print(cnt[i])


Fixed submission:
N, X, Y = [int(_) for _ in input().split()]

INF = 10 ** 9
dp = [[INF] * N for _ in range(N)]

for i in range(N - 1):
    for j in range(i + 1, N):
        dp[i][j] = j - i
        dp[j][i] = j - i

dp[X - 1][Y - 1] = 1
dp[Y - 1][X - 1] = 1

for k in [X - 1, Y - 1]:
    for i in range(N):
        for j in range(N):
            # k経由でiからjへ
            dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])

cnt = [0] * N
for i in range(N):
    for j in range(i + 1, N):
        v = dp[i][j]
        cnt[v] += 1
for i in range(1, N):
    print(cnt[i])
Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(_) for _ in input().split()]

P = [int(_) for _ in input().split()]

for i in range(N):
    P[i] = int(P[i] * (1 + P[i]) / 2) / P[i]

ans = 0
for i in range(N - K+1):
    ans = max(sum(P[i:i + K]),ans)
print(ans)



Fixed submission:
N, K = [int(_) for _ in input().split()]

P = [int(_) for _ in input().split()]

for i in range(N):
    P[i] = int(P[i] * (1 + P[i]) / 2) / P[i]

ans = 0
tmp = 0
for i in range(N):
    tmp += P[i]
    if i < K - 1: continue
    ans = max(tmp, ans)
    tmp -= P[i - K + 1]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(_) for _ in input().split()]

P = [int(_) for _ in input().split()]

for i in range(N):
    P[i] = int(P[i] * (1 + P[i]) / 2) / P[i]

ans = 0
for i in range(N - K+1):
    ans = max(sum(P[i:i + K]),ans)
print(ans)



Fixed submission:
N, K = [int(_) for _ in input().split()]

P = [int(_) for _ in input().split()]

for i in range(N):
    P[i] = int(P[i] * (1 + P[i]) / 2) / P[i]

ans = 0
tmp = 0
for i in range(N):
    tmp += P[i]
    if i < K - 1: continue
    ans = max(tmp, ans)
    tmp -= P[i - K + 1]
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())

g = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
    a = int(str(i)[0])
    b = int(str(i)[-1])
    g[a][b] += 1
ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += g[i][j]*g[j][i]

print(ans)

Fixed submission:
N = int(input())

g = [[0] * (10) for _ in range(10)]
for i in range(1, N + 1):
    a = int(str(i)[0])
    b = int(str(i)[-1])
    g[a][b] += 1
ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += g[i][j]*g[j][i]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

g = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
    a = int(str(i)[0])
    b = int(str(i)[-1])
    g[a][b] += 1
ans = 0
for i in range(1, N + 1):
    for j in range(1, N + 1):
        ans += g[i][j]*g[j][i]

print(ans)

Fixed submission:
N = int(input())

g = [[0] * (10) for _ in range(10)]
for i in range(1, N + 1):
    a = int(str(i)[0])
    b = int(str(i)[-1])
    g[a][b] += 1
ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += g[i][j]*g[j][i]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(_) for _ in input().split()]

ans = 0
MOD = 10**9+7
for i in range(60):
    b = 1 << i
    cnt_1 = sum([a & b > 0 for a in A])
    cnt_0 = N - cnt_1
    b_sum = cnt_1 * cnt_0
    ans += (b_sum << i) % MOD
print(ans%MOD)


Fixed submission:
N = int(input())
A = [int(_) for _ in input().split()]

ans = 0
MOD = 10**9+7
for i in range(60):
    b = 1 << i
    cnt_1 = sum([a & b > 0 for a in A])
    cnt_0 = N - cnt_1
    b_sum = cnt_1 * cnt_0
    ans += (b_sum << i) % MOD
print(ans%MOD)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

sys.setrecursionlimit(10**6)
N = int(input())
P = [[] for _ in range(N + 1)]
P2 = [[0] * (N + 1) for _ in range(N + 1)]
AB = []
for _ in range(N - 1):
    a, b = [int(_) for _ in input().split()]
    P[a].append(b)
    P[b].append(a)
    AB.append((a,b))
C = 0

for p in P:
    if len(p) > C:
        C = len(p)


def f(n, pre, used):
    c = 1
    for i, next_n in enumerate(P[n]):
        if pre == next_n: continue
        if c == used: c += 1
        P2[n][next_n] = c
        P2[next_n][n] = c
        f(next_n, n, c)
        c += 1


print(C)
f(1, -1, 0)
# print(P2)
for a,b in AB:
    print(P2[a][b])


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

for p in P:
    if len(p) > C:
        C = len(p)


P2 = dict()
def f(n, pre, used):
    c = 1
    for i, next_n in enumerate(P[n]):
        if pre == next_n: continue
        if c == used: c += 1
        # P2[n][next_n] = c
        # P2[next_n][n] = c
        if n > next_n:
            a, b = next_n, n
        else:
            b,a = next_n, n
        P2[(a,b)] = c
        f(next_n, n, c)
        c += 1


print(C)
f(1, -1, 0)
for ab in AB:
    print(P2[ab])

Buggy python submission (verdict: Time Limit Exceeded):
import sys

sys.setrecursionlimit(10**6)
N = int(input())
P = [[] for _ in range(N + 1)]
P2 = [[0] * (N + 1) for _ in range(N + 1)]
AB = []
for _ in range(N - 1):
    a, b = [int(_) for _ in input().split()]
    P[a].append(b)
    P[b].append(a)
    AB.append((a,b))
C = 0

for p in P:
    if len(p) > C:
        C = len(p)


def f(n, pre, used):
    c = 1
    for i, next_n in enumerate(P[n]):
        if pre == next_n: continue
        if c == used: c += 1
        P2[n][next_n] = c
        P2[next_n][n] = c
        f(next_n, n, c)
        c += 1


print(C)
f(1, -1, 0)
# print(P2)
for a,b in AB:
    print(P2[a][b])


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

for p in P:
    if len(p) > C:
        C = len(p)


P2 = dict()
def f(n, pre, used):
    c = 1
    for i, next_n in enumerate(P[n]):
        if pre == next_n: continue
        if c == used: c += 1
        # P2[n][next_n] = c
        # P2[next_n][n] = c
        if n > next_n:
            a, b = next_n, n
        else:
            b,a = next_n, n
        P2[(a,b)] = c
        f(next_n, n, c)
        c += 1


print(C)
f(1, -1, 0)
for ab in AB:
    print(P2[ab])
Buggy python submission (verdict: Time Limit Exceeded):
def solve(n):
    res = set()
    for i in range(2, n):
        while n % i == 0:
            res.add(i)
            n /= i
        if(n<=1): break
    res.add(1)
    return res
 
 
A, B = [int(_) for _ in input().split()]
print(len(solve(A) & solve(B)))

Fixed submission:
from math import sqrt


def solve(n):
    res = set()
    for i in range(2, int(sqrt(n))+1):
        while n % i == 0:
            res.add(i)
            n /= i
        if(n<=1): break
    if n>1:
        res.add(n)
    res.add(1)
    return res


A, B = [int(_) for _ in input().split()]
print(len(solve(A) & solve(B)))

Buggy python submission (verdict: Runtime Error):
def solve(n):
    res = set()
    for i in range(2, n):
        while n % i == 0:
            res.add(i)
            n /= i
        if(n<=1) break
    res.add(1)
    return res
 
 
A, B = [int(_) for _ in input().split()]
print(len(solve(A) & solve(B)))

Fixed submission:
from math import sqrt


def solve(n):
    res = set()
    for i in range(2, int(sqrt(n))+1):
        while n % i == 0:
            res.add(i)
            n /= i
        if(n<=1): break
    if n>1:
        res.add(n)
    res.add(1)
    return res


A, B = [int(_) for _ in input().split()]
print(len(solve(A) & solve(B)))

Buggy python submission (verdict: Time Limit Exceeded):
def solve(n):
    res = set()
    for i in range(2, n):
        while n % i == 0:
            res.add(i)
            n /= i
    res.add(1)
    return res


A, B = [int(_) for _ in input().split()]
print(len(solve(A) & solve(B)))

Fixed submission:
from math import sqrt


def solve(n):
    res = set()
    for i in range(2, int(sqrt(n))+1):
        while n % i == 0:
            res.add(i)
            n /= i
        if(n<=1): break
    if n>1:
        res.add(n)
    res.add(1)
    return res


A, B = [int(_) for _ in input().split()]
print(len(solve(A) & solve(B)))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

dp = [[0] * (N + 1) for _ in range(N + 1)]
ans = 0

for i in range(N - 1, -1, -1):
    for j in range(N - 1, -1, -1):
        if i >= j: break
        if S[i] == S[j]:
            dp[i][j] = min(1 + dp[i + 1][j + 1], j - i)
            if dp[i][j] > ans:
                ans = dp[i][j]
print(ans)


Fixed submission:
N = int(input())
S = input()

dp = [[0] * (N + 1) for _ in range(N + 1)]
ans = 0

for i in range(N - 1, -1, -1):
    for j in range(N - 1, -1, -1):
        if i >= j: break
        if S[i] == S[j]:
            dp[i][j] = min(1 + dp[i + 1][j + 1], j - i)
            if dp[i][j] > ans:
                ans = dp[i][j]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
print(sum([i for i in range(N)]))


Fixed submission:
N = int(input())
# print(sum([i for i in range(N)]))
print(N*(0 + N-1)//2)
Buggy python submission (verdict: Time Limit Exceeded):
def f(x):
    return ord(x) - ord('a')


N = int(input())
cnts = [[0] * 26 for _ in range(N)]

for i in range(N):
    for c in input():
        cnts[i][f(c)] += 1

res = 0
for i in range(N):
    for j in range(i + 1, N):
        chk = 1
        for k in range(26):
            if cnts[i][k] != cnts[j][k]:
                chk = 0
                break
        res += chk
print(res)

Fixed submission:
def f(x):
    return 10 ** (ord(x) - ord('a') + 1)


import math


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


from collections import Counter

N = int(input())
counter = Counter()
for i in range(N):
    counter[sum([f(i) for i in input()])] += 1
res = 0
for v in counter.values():
    if v > 1:
        res += combinations_count(v, 2)
print(res)

Buggy python submission (verdict: Time Limit Exceeded):

N = int(input())
S = []
for i in range(N):
    S.append(sorted(list(input())))

res = 0
for i in range(N):
    for j in range(i + 1, N):
        res += int(S[i] == S[j])
print(res)

Fixed submission:
def f(x):
    return 10 ** (ord(x) - ord('a') + 1)


import math


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


from collections import Counter

N = int(input())
counter = Counter()
for i in range(N):
    counter[sum([f(i) for i in input()])] += 1
res = 0
for v in counter.values():
    if v > 1:
        res += combinations_count(v, 2)
print(res)

Buggy python submission (verdict: Time Limit Exceeded):

N = int(input())
S = []
for i in range(N):
    S.append(sorted(list(input())))

res = 0
for i in range(N):
    for j in range(i + 1, N):
        res += int(S[i] == S[j])
print(res)

Fixed submission:
def f(x):
    return 10 ** (ord(x) - ord('a') + 1)


import math


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


from collections import Counter

N = int(input())
counter = Counter()
for i in range(N):
    counter[sum([f(i) for i in input()])] += 1
res = 0
for v in counter.values():
    if v > 1:
        res += combinations_count(v, 2)
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N = int(input())
cnts = []
for i in range(N):
    cnts.append(Counter(list(input())))

res = 0
for i in range(N):
    for j in range(i + 1, N):
        chk = 1
        for k in range(26):
            kc = chr(ord('a') + k)
            if cnts[i][kc] != cnts[j][kc]:
                chk = 0
                break
        res += chk
print(res)

Fixed submission:
def f(x):
    return 10 ** (ord(x) - ord('a') + 1)


import math


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


from collections import Counter

N = int(input())
counter = Counter()
for i in range(N):
    counter[sum([f(i) for i in input()])] += 1
res = 0
for v in counter.values():
    if v > 1:
        res += combinations_count(v, 2)
print(res)
Buggy python submission (verdict: Runtime Error):
N = input()

D = sorted([int(v) for v in input().split()])
arc = N // 2
abc = arc - 1
print(D[arc] - D[abc])


Fixed submission:
N = int(input())

D = sorted([int(v) for v in input().split()])
arc = N // 2
abc = arc - 1
print(D[arc] - D[abc])
Buggy python submission (verdict: Runtime Error):
from math import factorial

N, K = [int(_) for _ in input().split()]
# N = 10
MOD = 10 ** 9 + 7

kaijo = [0] * (N + 1)
kaijo[0] = kaijo[1] = 1
for i in range(2, N + 1):
    kaijo[i] = (kaijo[i - 1] * i) % MOD

gyaku = [0] * (N + 1)
gyaku[0] = gyaku[1] = 1

for i in range(2, N + 1):
    # gyaku[i] = (gyaku[i - 1] * pow(i, MOD - 2, MOD)) % MOD
    gyaku[i] = pow(kaijo[i], MOD - 2, MOD)


def calc(n, k):
    # return (kaijo[n] * gyaku[n - k] * gyaku[k]) % MOD
    return factorial(n) // (factorial(n - k) * factorial(k))


def solve():
    for i in range(1, K + 1):
        n = N - K + 1
        k = i
        print((calc(n, k) * calc(K - 1, i - 1)) % MOD)


solve()


Fixed submission:
from math import factorial

N, K = [int(_) for _ in input().split()]
# N = 10
MOD = 10 ** 9 + 7

kaijo = [0] * (N + 1)
kaijo[0] = kaijo[1] = 1
for i in range(2, N + 1):
    kaijo[i] = (kaijo[i - 1] * i) % MOD

gyaku = [0] * (N + 1)
gyaku[0] = gyaku[1] = 1

for i in range(2, N + 1):
    # gyaku[i] = (gyaku[i - 1] * pow(i, MOD - 2, MOD)) % MOD
    gyaku[i] = pow(kaijo[i], MOD - 2, MOD)


def calc(n, k):
    # return (kaijo[n] * gyaku[n - k] * gyaku[k]) % MOD
    return factorial(n) // (factorial(n - k) * factorial(k))


def solve():
    for i in range(1, K + 1):
        n = N - K + 1
        k = i
        if k <= n:
            print((calc(n, k) * calc(K - 1, i - 1)) % MOD)
        else:
            print(0)


solve()
Buggy python submission (verdict: Runtime Error):
a,p = [int(_) for _ in input()]
print((a*3+p)//2)

Fixed submission:
a,p = [int(_) for _ in input().split()]
print((a*3+p)//2)

Buggy python submission (verdict: Runtime Error):
a,p = [int(_) for _ in input()]
print((a*3+p)//2)

Fixed submission:
a,p = [int(_) for _ in input().split()]
print((a*3+p)//2)
Buggy python submission (verdict: Runtime Error):
N = int(input())
nodes = [[[], -1] for _ in range(N + 1)]

for i in range(N - 1):
    u, v, w = [int(_) for _ in input().split()]
    nodes[u - 1][0].append((v - 1, w))
    nodes[v - 1][0].append((u - 1, w))


def f(i, c):
    if nodes[i][1] >= 0: return
    nodes[i][1] = c
    for n in nodes[i][0]:
        f(n[0], (c + (n[1] % 2)) % 2)

# print(nodes)
f(0,0)
for i in range(N):
    print(nodes[i][1])


Fixed submission:
import sys
sys.setrecursionlimit(10**6)

N = int(input())
nodes = [[[], -1] for _ in range(N + 1)]

for i in range(N - 1):
    u, v, w = [int(_) for _ in input().split()]
    nodes[u - 1][0].append((v - 1, w))
    nodes[v - 1][0].append((u - 1, w))


def f(i, c):
    if nodes[i][1] >= 0: return
    nodes[i][1] = c
    for n in nodes[i][0]:
        f(n[0], (c + (n[1] % 2)) % 2)

# print(nodes)
f(0, 0)
for i in range(N):
    print(nodes[i][1])