Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import fractions
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

N,M = (int(x) for x in input().split())
a = list(map(int, input().split()))
temp = [a[0],a[0]//2]
broke = False
for i in range(1,N):
    gcd = xgcd(temp[0],a[i])
    if temp[1] % gcd[0] != (a[i]//2) % gcd[0]:
        broke = True
        break
    else:
        x = temp[1] + temp[0]*((a[i]//2)-temp[1])//gcd[0]*gcd[1]
        temp[0] = (temp[0] * a[i]) // math.gcd(temp[0], a[i])
        temp[1] = x % temp[0]
if broke:
    print('0')
else:
    dm = divmod(M,temp[0])
    if dm[1] >= temp[1]:
        print(dm[0]+1)
    else:
        print(dm[0])

Fixed submission:
import fractions
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

N,M = (int(x) for x in input().split())
a = list(map(int, input().split()))
temp = [a[0],a[0]//2]
broke = False
for i in range(1,N):
    gcd = xgcd(temp[0],a[i])
    if temp[1] % gcd[0] != (a[i]//2) % gcd[0]:
        broke = True
        break
    else:
        x = temp[1] + temp[0]*((a[i]//2)-temp[1])//gcd[0]*gcd[1]
        temp[0] = (temp[0] * a[i]) // fractions.gcd(temp[0], a[i])
        temp[1] = x % temp[0]
if broke:
    print('0')
else:
    dm = divmod(M,temp[0])
    if dm[1] >= temp[1]:
        print(dm[0]+1)
    else:
        print(dm[0])

Buggy python submission (verdict: Runtime Error):
import math
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

N,M = (int(x) for x in input().split())
a = list(map(int, input().split()))
temp = [a[0],a[0]//2]
broke = False
for i in range(1,N):
    gcd = xgcd(temp[0],a[i])
    if temp[1] % gcd[0] != (a[i]//2) % gcd[0]:
        broke = True
        break
    else:
        x = temp[1] + temp[0]*((a[i]//2)-temp[1])//gcd[0]*gcd[1]
        temp[0] = (temp[0] * a[i]) // math.gcd(temp[0], a[i])
        temp[1] = x % temp[0]
if broke:
    print('0')
else:
    dm = divmod(M,temp[0])
    if dm[1] >= temp[1]:
        print(dm[0]+1)
    else:
        print(dm[0])

Fixed submission:
import fractions
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

N,M = (int(x) for x in input().split())
a = list(map(int, input().split()))
temp = [a[0],a[0]//2]
broke = False
for i in range(1,N):
    gcd = xgcd(temp[0],a[i])
    if temp[1] % gcd[0] != (a[i]//2) % gcd[0]:
        broke = True
        break
    else:
        x = temp[1] + temp[0]*((a[i]//2)-temp[1])//gcd[0]*gcd[1]
        temp[0] = (temp[0] * a[i]) // fractions.gcd(temp[0], a[i])
        temp[1] = x % temp[0]
if broke:
    print('0')
else:
    dm = divmod(M,temp[0])
    if dm[1] >= temp[1]:
        print(dm[0]+1)
    else:
        print(dm[0])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
count = [0] * 60
m = 1000000007
def pow_k(x, n):
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K = (K * x) % 1000000007
        x = (x * x) % 1000000007
        n //= 2
    return (K * x) % 1000000007
mul = [pow_k(2,59-i) for i in range(60)]
for a in A:
    b = bin(a)
    for i in range(1,len(b)-1):
        if b[-i] == '1':
            count[-i] += 1
print(sum([count[i]*(N-count[i])*mul[i]%m for i in range(60)])%m)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
count = [0] * 60
m = 1000000007
def pow_k(x, n):
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K = (K * x) % 1000000007
        x = (x * x) % 1000000007
        n //= 2
    return (K * x) % 1000000007
mul = [pow_k(2,59-i) for i in range(60)]
for a in A:
    b = bin(a)
    for i in range(1,len(b)-1):
        if b[-i] == '1':
            count[-i] += 1
print(sum([count[i]*(N-count[i])*mul[i]%m for i in range(60)])%m)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
N = int(input())
A = list(map(int, input().split()))
m = 1000000007
b = [(c[0]^c[1])%m for c in combinations(A,2)]
print(sum(b)%m)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
count = [0] * 60
m = 1000000007
def pow_k(x, n):
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K = (K * x) % 1000000007
        x = (x * x) % 1000000007
        n //= 2
    return (K * x) % 1000000007
mul = [pow_k(2,59-i) for i in range(60)]
for a in A:
    b = bin(a)
    for i in range(1,len(b)-1):
        if b[-i] == '1':
            count[-i] += 1
print(sum([count[i]*(N-count[i])*mul[i]%m for i in range(60)])%m)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
N = int(input())
A = list(map(int, input().split()))
m = 1000000007
b = [(c[0]^c[1])%m for c in combinations(A,2)]
print(sum(b)%m)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
count = [0] * 60
m = 1000000007
def pow_k(x, n):
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K = (K * x) % 1000000007
        x = (x * x) % 1000000007
        n //= 2
    return (K * x) % 1000000007
mul = [pow_k(2,59-i) for i in range(60)]
for a in A:
    b = bin(a)
    for i in range(1,len(b)-1):
        if b[-i] == '1':
            count[-i] += 1
print(sum([count[i]*(N-count[i])*mul[i]%m for i in range(60)])%m)
Buggy python submission (verdict: Runtime Error):
N,*A = map(int, open(0).read().split())
group = [0] * 3
ans = 1
for x in A:
    ans = (ans*group.count(x)) % (10**9+7)
    group[group.index(x)] += 1
print(ans)

Fixed submission:
N,*A = map(int, open(0).read().split())
group = [0] * 3
ans = 1
for x in A:
    ans = (ans*group.count(x)) % 1000000007
    if ans == 0:
        print(0)
        break
    else:
        group[group.index(x)] += 1
else:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10000000)
X,Y = (int(x) for x in input().split())
def route(x,y):
    d = min(x,y) - ((x+y)//3)
    if d == 0:
        return 1
    else:
        return (route(x-2,y-1) + route(x-1,y-2))%1000000007
if (X+Y) % 3 != 0 or min(X,Y) < (X+Y) // 3:
    print('0')
else:
    print(route(X,Y))

Fixed submission:
from functools import reduce
X,Y = (int(x) for x in input().split())
def route(x,y):
    d = min(x,y) - ((x+y)//3)
    if d == 0:
        return 1
    else:
        return (route(x-2,y-1) + route(x-1,y-2))%1000000007
def modmul(a,b):
    return a * b % 1000000007
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0
def modinv(a, m):
    g, x, y = xgcd(a, m)
    return x % m
def comb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(modmul, range(n, n - r, -1))
    under = reduce(modmul, range(1,r + 1))
    return over * modinv(under, 1000000007)
if (X+Y) % 3 != 0 or min(X,Y) < (X+Y) // 3:
    print('0')
else:
    d = min(X,Y) - ((X+Y)//3)
    if d == 0:
        print('1')
    else:
        t = (X+Y) // 3
        print((comb(t-1,d)+comb(t-1,d-1))%1000000007)
Buggy python submission (verdict: Runtime Error):
import numpy as np

N,T,*ABf = map(int, open(0).read().split())
AB = np.array(ABf).reshape(N,2).tolist()
dp = [[0] * 2 for _ in range(6000)]
filled = set([0])
for x in AB:
    temp = set()
    change = []
    for y in filled:
        if y + x[0] <= (T-1) + max(dp[y][1],x[0]):
            if dp[y+x[0]][0] < dp[y][0]+x[1]:
                change.append((y,y+x[0],dp[y][0]+x[1],x[0]))
                temp.add(y+x[0])
    for y in change:
        dp[y[1]][0] = y[2]
        dp[y[1]][1] = max(dp[y[0]][1],y[3])
    filled = filled | temp
print(max(dp)[0])

Fixed submission:
N,T,*ABf = map(int, open(0).read().split())
AB = [ABf[i:i+2] for i in range(0, len(ABf), 2)]
AB.sort()
dp = [[0] * 2 for _ in range(6000)]
filled = set([0])
for x in AB:
    temp = set()
    change = []
    for y in filled:
        if y + x[0] <= (T-1) + max(dp[y][1],x[0]):
            if dp[y+x[0]][0] <= dp[y][0] + x[1]:
                change.append((y,y+x[0],dp[y][0]+x[1],x[0]))
    for y in change:
        if dp[y[1]][0] == y[2]:
            dp[y[1]][1] = y[3]
        else:    
            dp[y[1]][0] = y[2]
            dp[y[1]][1] = y[3]
            temp.add(y[0]+x[0])
    filled = filled | temp
print(max(dp)[0])
Buggy python submission (verdict: Time Limit Exceeded):
import math

N,K,*AF = map(int, open(0).read().split())
A = sorted(AF[:N])
F = sorted(AF[N:],reverse=True)
left = 0
right = max(A) * max(F)
while left != right:
    mid = (left+right) // 2
    if sum([max(A[i]-math.floor(mid/F[i]),0) for i in range(N)]) <= K:
        right = mid
    else:
        left = mid + 1
print(left)

Fixed submission:
import math

N,K,*AF = map(int, open(0).read().split())
A = sorted(AF[:N])
F = sorted(AF[N:],reverse=True)
left = 0
right = max(A) * max(F)
while left != right:
    mid = (left+right) // 2
    temp = 0
    for i in range(N):
        temp += max(A[i]-math.floor(mid/F[i]),0)
        if temp > K:
            left = mid + 1
            break
    else:
        right = mid
print(left)

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

N,K,*AF = map(int, open(0).read().split())
A = sorted(AF[:N])
F = sorted(AF[N:],reverse=True)
init = [A[i] * F[i] for i in range(N)]
left = 0
right = max(init)
while left != right:
    mid = (left+right) // 2
    temp = [max(A[i]-math.floor(mid/F[i]),0) for i in range(N)]
    if sum(temp) <= K:
        right = mid
    else:
        left = mid + 1
print(left)

Fixed submission:
import math

N,K,*AF = map(int, open(0).read().split())
A = sorted(AF[:N])
F = sorted(AF[N:],reverse=True)
left = 0
right = max(A) * max(F)
while left != right:
    mid = (left+right) // 2
    temp = 0
    for i in range(N):
        temp += max(A[i]-math.floor(mid/F[i]),0)
        if temp > K:
            left = mid + 1
            break
    else:
        right = mid
print(left)

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

N,K,*AF = map(int, open(0).read().split())
A = sorted(AF[:N])
F = sorted(AF[N:],reverse=True)
init = [A[i] * F[i] for i in range(N)]
left = 0
right = max(init)
while left != right:
    mid = (left+right) // 2
    temp = [max(A[i]-math.floor(mid/F[i]),0) for i in range(N)]
    if sum(temp) <= K:
        right = mid
    else:
        left = mid + 1
print(left)

Fixed submission:
import math

N,K,*AF = map(int, open(0).read().split())
A = sorted(AF[:N])
F = sorted(AF[N:],reverse=True)
left = 0
right = max(A) * max(F)
while left != right:
    mid = (left+right) // 2
    temp = 0
    for i in range(N):
        temp += max(A[i]-math.floor(mid/F[i]),0)
        if temp > K:
            left = mid + 1
            break
    else:
        right = mid
print(left)
Buggy python submission (verdict: Time Limit Exceeded):
A,B = (int(x) for x in input().split())
def make_divisors(n):
    divisors = set()
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.add(i)
            if i != n // i:
                divisors.add(n//i)
    return divisors
a = make_divisors(A)
b = make_divisors(B)
c = a & b
count = 1
for x in c:
    if len(make_divisors(x)) == 2:
        count += 1
print(count)

Fixed submission:
A,B = (int(x) for x in input().split())
def make_divisors(n):
    divisors = set()
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.add(i)
            if i != n // i:
                divisors.add(n//i)
    return divisors
a = make_divisors(A)
b = make_divisors(B)
c = a & b
count = 1
if 2 in c:
    count += 1
for x in c:
    if x % 2 == 1:
        if len(make_divisors(x)) == 2:
            count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
import heapq
from numpy import sum
N,M = (int(x) for x in input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(A)
for i in range(M):
    t1 = heapq.heappop(A)
    t2 = t1 // 2
    heapq.heappush(A, t2)
print(int(sum(B)*(-1)))

Fixed submission:
import heapq
from numpy import ceil,sum
N,M = (int(x) for x in input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(A)
for i in range(M):
    t1 = heapq.heappop(A)
    t2 = t1 / 2
    heapq.heappush(A, t2)
B = ceil(A)
print(int(sum(B)*(-1)))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
from numpy import floor,sum
N,M = (int(x) for x in input().split())
A = list(map(int, input().split()))
A.sort()
for i in range(M):
    if A[N-1] >= A[N-2]:
        A[N-1] = A[N-1] / 2
        if A[N-1] < A[N-2]:
            bisect.insort_left(A,A[N-1])
            del A[-1]
B = floor(A)
print(int(sum(B)))

Fixed submission:
import heapq
from numpy import ceil,sum
N,M = (int(x) for x in input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(A)
for i in range(M):
    t1 = heapq.heappop(A)
    t2 = t1 / 2
    heapq.heappush(A, t2)
B = ceil(A)
print(int(sum(B)*(-1)))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
import numpy as np
N,M = (int(x) for x in input().split())
A = list(map(int, input().split()))
A.sort()
while M > 0:
    if A[N-1] >= A[N-2]:
        A[N-1] = A[N-1] / 2
        M -= 1
    else:
        temp = A[N-1]
        bisect.insort_left(A,temp)
        del A[-1]
B = np.floor(A)
print(int(np.sum(B)))

Fixed submission:
import heapq
from numpy import ceil,sum
N,M = (int(x) for x in input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(A)
for i in range(M):
    t1 = heapq.heappop(A)
    t2 = t1 / 2
    heapq.heappush(A, t2)
B = ceil(A)
print(int(sum(B)*(-1)))
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)
S = input()
def div(strings):
    if len(strings) == 0:
        return 0
    elif len(strings) == 1:
        return 1
    elif len(strings) == 2:
        if S[0] == S[1]:
            return 1
        else:
            return 2
    elif strings[len(strings)-1] != strings[len(strings)-2]:
        return div(strings[0:len(strings)-1]) + 1
    else:
        return div(strings[0:len(strings)-3]) + 2
print(div(S))

Fixed submission:
S = input()
count = 1
i = 0
initial_length = len(S)-1
l = S[0]
S = S + '&' + '%'
while i < initial_length:
    if l == S[i+1]:
        if i == initial_length-1:
            break
        elif S[i+2] == S[i+3]:
            l = S[i+3]
            i += 3
            count += 1
        else:
            l = S[i+1:i+3]
            i += 2
    else:
        l = S[i+1]
        i += 1
    count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
S = input()
def div(strings):
    if len(strings) == 0:
        return 0
    elif len(strings) == 1:
        return 1
    elif len(strings) == 2:
        if S[0] == S[1]:
            return 1
        else:
            return 2
    elif strings[len(strings)-1] != strings[len(strings)-2]:
        return div(strings[0:len(strings)-1]) + 1
    else:
        return div(strings[0:len(strings)-3]) + 2
print(div(S))

Fixed submission:
S = input()
count = 1
i = 0
initial_length = len(S)-1
l = S[0]
S = S + '&' + '%'
while i < initial_length:
    if l == S[i+1]:
        if i == initial_length-1:
            break
        elif S[i+2] == S[i+3]:
            l = S[i+3]
            i += 3
            count += 1
        else:
            l = S[i+1:i+3]
            i += 2
    else:
        l = S[i+1]
        i += 1
    count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
S = input()
def div(strings):
    if len(strings) == 0:
        return 0
    elif len(strings) == 1:
        return 1
    elif len(strings) == 2:
        if S[0] == S[1]:
            return 1
        else:
            return 2
    elif strings[len(strings)-1] != strings[len(strings)-2]:
        return div(strings[0:len(strings)-1]) + 1
    else:
        return div(strings[0:len(strings)-3]) + 2
if len(S) == 1:
    print(1)
elif len(S) == 2:
    if S[0] == S[1]:
        print(1)
    else:
        print(2)
else:
    print(div(S))

Fixed submission:
S = input()
count = 1
i = 0
initial_length = len(S)-1
l = S[0]
S = S + '&' + '%'
while i < initial_length:
    if l == S[i+1]:
        if i == initial_length-1:
            break
        elif S[i+2] == S[i+3]:
            l = S[i+3]
            i += 3
            count += 1
        else:
            l = S[i+1:i+3]
            i += 2
    else:
        l = S[i+1]
        i += 1
    count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
m = [[0, 4, 8, 12, 3, 7, 11, 2, 6, 10],[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],[0, 10, 7, 4, 1, 11, 8, 5, 2, 12],[0, 9, 5, 1, 10, 6, 2, 11, 7, 3],[0, 12, 11, 10, 9, 8, 7, 6, 5, 4],[0, 3, 6, 9, 12, 2, 5, 8, 11, 1]]
S = list(input())
d = len(S)
dp = [[0] * 13 for _ in range(d)]
if S[0] == '?':
    for x in m[d%6]:
        dp[0][x] = 1
else:
    dp[0][m[d%6][int(S[0])]] = 1
for i in range(1,d):
    if S[i] == '?':
        for j in range(13):
            dp[i][j] = sum(dp[i-1][(13+j-x) % 13] for x in m[(d-i)%6]) % 1000000007
    else:
        for j in range(13):
            dp[i][j] = dp[i-1][(13+j-m[(d-i)%6][int(S[i])])%13]
print(dp[d-1][5])

Fixed submission:
m = [[0, 4, 8, 12, 3, 7, 11, 2, 6, 10],[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],[0, 10, 7, 4, 1, 11, 8, 5, 2, 12],[0, 9, 5, 1, 10, 6, 2, 11, 7, 3],[0, 12, 11, 10, 9, 8, 7, 6, 5, 4],[0, 3, 6, 9, 12, 2, 5, 8, 11, 1]]
S = list(input())
d = len(S)
dp = [[0] * 13 for _ in range(d)]
if S[0] == '?':
    for x in m[d%6]:
        dp[0][x] = 1
else:
    dp[0][m[d%6][int(S[0])]] = 1
for i in range(1,d):
    if S[i] == '?':
        for j in range(13):
            dp[i][j] = sum(dp[i-1][(13+j-x) % 13] for x in m[(d-i)%6]) % 1000000007
    else:
        for j in range(13):
            dp[i][j] = dp[i-1][(13+j-m[(d-i)%6][int(S[i])])%13]
print(dp[d-1][5])
Buggy python submission (verdict: Time Limit Exceeded):
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

N = int(input())
a = list(map(int, input().split()))
b = []
multiple = [[i] for i in range(1,N+1)]
balls = [0] * N

for i in range(N,0,-1):
    if balls[i-1] % 2 != a[i-1]:
        for x in make_divisors(i):
            balls[x-1] += 1
        b.append(i)
print(len(b))
print(*b)

Fixed submission:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

N = int(input())
a = list(map(int, input().split()))
b = []
multiple = [[i] for i in range(1,N+1)]
balls = [0] * N

for i in range(N,0,-1):
    if balls[i-1] % 2 != a[i-1]:
        for x in make_divisors(i):
            balls[x-1] += 1
        b.append(i)
print(len(b))
print(*b)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N = int(input())
A = []
for i in range(N):
    a = int(input())
    b = bisect.bisect_left(A,a)
    if b == 0:
        A.insert(0,a)
    else:
        A[b-1] = a
print(len(A))

Fixed submission:
import bisect
N = int(input())
A = []
for i in range(N):
    a = int(input()) * (-1)
    b = bisect.bisect_right(A,a)
    if b == len(A):
        A.append(a)
    else:
        A[b] = a
print(len(A))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N = int(input())
A = []
for i in range(N):
    a = int(input())
    b = bisect.bisect_left(A,a)
    if b == 0:
        A.insert(0,a)
    else:
        A[b-1] = a
print(len(A))

Fixed submission:
import bisect
N = int(input())
A = []
for i in range(N):
    a = int(input()) * (-1)
    b = bisect.bisect_right(A,a)
    if b == len(A):
        A.append(a)
    else:
        A[b] = a
print(len(A))
Buggy python submission (verdict: Runtime Error):
from functools import reduce
def pow_k(x, n):
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K = (K * x)
        x = (x * x)
        n //= 2
    return (K * x)
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0
def modinv(a, m):
    g, x, y = xgcd(a, m)
    return x % m
def modmul(a,b):
    return a * b % 1000000007
def comb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(modmul, range(n, n - r, -1))
    under = reduce(modmul, range(1,r + 1))
    return over * modinv(under, 1000000007)

N,K = (int(x) for x in input().split())
for i in range(1,K+1):
    a = comb(K-1,i-1)
    b = comb(N-K+1,i)
    print(a*b%1000000007)

Fixed submission:
from functools import reduce
def pow_k(x, n):
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K = (K * x)
        x = (x * x)
        n //= 2
    return (K * x)
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0
def modinv(a, m):
    g, x, y = xgcd(a, m)
    return x % m
def modmul(a,b):
    return a * b % 1000000007
def comb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(modmul, range(n, n - r, -1))
    under = reduce(modmul, range(1,r + 1))
    return over * modinv(under, 1000000007)

N,K = (int(x) for x in input().split())
for i in range(1,K+1):
    if i > N-K+1:
        print('0')
    else:
        a = comb(K-1,i-1)
        b = comb(N-K+1,i)
        print(a*b%1000000007)
Buggy python submission (verdict: Runtime Error):
from itertools import permutations
from collections import Counter

N,*xyf = map(int, open(0).read().split())
xy = [(xyf[i*2],xyf[i*2+1]) for i in range(N)]
count = []
for a, b in permutations(xy,2):
    count.append((b[0]-a[0],b[1]-a[1]))
c = Counter(count)
print(N-max(c.values()))

Fixed submission:
from itertools import permutations
from collections import Counter

N,*xyf = map(int, open(0).read().split())
xy = [(xyf[i*2],xyf[i*2+1]) for i in range(N)]
if N == 1:
    print(1)
else:
    count = []
    for a, b in permutations(xy,2):
        count.append((b[0]-a[0],b[1]-a[1]))
    c = Counter(count)
    print(N-max(c.values()))