Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())

root = [[] for i in range(n)]
for _ in range(m):
    a, b = (int(x) for x in input().split())
    root[b-1].append(a-1)
    root[a-1].append(b-1) 

stack=[0]
check = [-1]*n
check[0] = 0

while len(stack)>0:
    v = stack.popleft()
    for i in root[v]:
        if check[i] == -1:
            check[i]=v+1
            stack.append(i)


print('Yes')
for i in range(1,n):
    print(check[i])

Fixed submission:
N, M = map(int, input().split())
root = [[] for _ in range(N+1)]
 
for i in range(M):
    a, b = map(int, input().split())
    root[a].append(b)
    root[b].append(a)
 
ans = [10**9] * (N+1)
ans[0] = 0
ans[1] = 0
 
from collections import deque
q = deque([1])
 
while q:
    p = q.popleft()
    for i in root[p]:
        if ans[i] == 10**9:
            ans[i] = p
            q.append(i)
 
if 10**9 in set(ans):
    print('No')
else:
    print('Yes')
    for i in range(2, N+1):
        print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

root = [[] for i in range(n)]
for _ in range(m):
    a, b = (int(x) for x in input().split())
    root[b-1].append(a-1)
    root[a-1].append(b-1) 

stack=[0]
check = [-1]*n
check[0] = 0

while len(stack)>0:
    v = stack.pop(0)
    for i in root[v]:
        if check[i] == -1:
            check[i]=v+1
            stack.append(i)


print('Yes')
for i in range(1,n):
    print(check[i])
    

Fixed submission:
N, M = map(int, input().split())
root = [[] for _ in range(N+1)]
 
for i in range(M):
    a, b = map(int, input().split())
    root[a].append(b)
    root[b].append(a)
 
ans = [10**9] * (N+1)
ans[0] = 0
ans[1] = 0
 
from collections import deque
q = deque([1])
 
while q:
    p = q.popleft()
    for i in root[p]:
        if ans[i] == 10**9:
            ans[i] = p
            q.append(i)
 
if 10**9 in set(ans):
    print('No')
else:
    print('Yes')
    for i in range(2, N+1):
        print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

root = [[] for i in range(n)]
for _ in range(m):
    a, b = (int(x) for x in input().split())
    root[b-1].append(a-1)
    root[a-1].append(b-1) 

stack=[0]
check = [-1]*n
check[0] = 0

while len(stack)>0:
    v = stack.pop(0)
    for i in root[v]:
        if check[i] == -1:
            check[i]=v+1
            stack.append(i)

if -1 in check:
    print('No')
else:
    print('Yes')
    for i in range(1,n):
        print(check[i])

Fixed submission:
N, M = map(int, input().split())
root = [[] for _ in range(N+1)]
 
for i in range(M):
    a, b = map(int, input().split())
    root[a].append(b)
    root[b].append(a)
 
ans = [10**9] * (N+1)
ans[0] = 0
ans[1] = 0
 
from collections import deque
q = deque([1])
 
while q:
    p = q.popleft()
    for i in root[p]:
        if ans[i] == 10**9:
            ans[i] = p
            q.append(i)
 
if 10**9 in set(ans):
    print('No')
else:
    print('Yes')
    for i in range(2, N+1):
        print(ans[i])
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())

h = list(map(int,input().split()))

root = [[] for i in range(n)]
for _ in range(n-1):
    a, b = (int(x) for x in input().split())
    root[b-1].append(a-1)
    root[a-1].append(b-1)

ans = 0

for i in range(n):
    flag = True
    if len(root[i]) > 0:
        for j in root[i]:
            if h[i] <= h[j]:
                flag = False
                break
    if flag:
        ans += 1
print(ans)

Fixed submission:
n,m = map(int,input().split())

h = list(map(int,input().split()))

root = [[] for i in range(n)]
for _ in range(m):
    a, b = (int(x) for x in input().split())
    root[b-1].append(a-1)
    root[a-1].append(b-1)

ans = 0

for i in range(n):
    flag = True
    if len(root[i]) > 0:
        for j in root[i]:
            if h[i] <= h[j]:
                flag = False
                break
    if flag:
        ans += 1
print(ans)

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

h = list(map(int,input().split()))

root = [[] for i in range(n)]
for _ in range(n-1):
    a, b = (int(x) for x in input().split())
    root[b-1].append(a-1)
    root[a-1].append(b-1)

ans = 0

for i in range(n):
    flag = True
    for j in root[i]:
        if h[i] <= h[j]:
            flag = False
            break
    if flag:
        ans += 1
print(ans)

Fixed submission:
n,m = map(int,input().split())

h = list(map(int,input().split()))

root = [[] for i in range(n)]
for _ in range(m):
    a, b = (int(x) for x in input().split())
    root[b-1].append(a-1)
    root[a-1].append(b-1)

ans = 0

for i in range(n):
    flag = True
    if len(root[i]) > 0:
        for j in root[i]:
            if h[i] <= h[j]:
                flag = False
                break
    if flag:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

t = list(map(int,input().split()))

ans = 0
    
for i in range(n-1):
    for j in range(i+1,n):
        if j-i == t[i]+t[j]:
            ans += 1
print(ans)

Fixed submission:
n=int(input())

t = list(map(int,input().split()))

ans = 0

sa = [0]*(n+1)

for i in range(n):
    if i+1-t[i] > 0:
        sa[i+1-t[i]] += 1

for i in range(n):
    if 0 < i+1+t[i] < n:
        ans += sa[i+1+t[i]]
    if i+1-t[i] > 0:
        sa[i+1-t[i]] -= 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
h,w = (int(x) for x in input().split())
ab = []
for _ in range(h):
    a = input()
    a = a+'#'
    ab.append(list(a))
ab.append(list('#'*w))
dp = [[100000000000000000 for a in range(w+1)] for b in range(h+1)]
if ab[0][0] == '#':
    dp[0][0] = 1
else:
    dp[0][0] = 0
step = [[0, 0]]
 
while len(step) > 0:
    y, x = step.pop(0)
    
    if h-1<y or w-1 < x:continue
    
    if ab[y+1][x] == '#':
        step.append([y+1, x])
        dp[y+1][x] = min(dp[y][x] + 1, dp[y+1][x])
    else:
        step.append([y+1, x])
        dp[y+1][x] = min(dp[y][x], dp[y+1][x])
    if ab[y][x+1] == '#':
        step.append([y, x+1])
        dp[y][x+1] = min(dp[y][x] + 1, dp[y][x+1])
    else:
        step.append([y, x+1])
        dp[y][x+1] = min(dp[y][x],dp[y][x+1])
 
print(dp[h-1][w-1])

Fixed submission:
h,w = (int(x) for x in input().split())
ab = []
for _ in range(h):
    a = input()
    a = a+'#'
    ab.append(list(a))
ab.append(list('#'*w))
dp = [[100000000000000000 for a in range(w+1)] for b in range(h+1)]
if ab[0][0] == '#':
    dp[0][0] = 1
else:
    dp[0][0] = 0
step = [[0, 0]]
 
while len(step) > 0:
    y, x = step.pop(0)
    
    if h-1<y or w-1<x :continue
    
    if dp[y+1][x] == 100000000000000000:
        step.append([y+1, x])
    if dp[y][x+1] == 100000000000000000:
        step.append([y, x+1])

    if ab[y][x+1] == '#' and ab[y][x] == '.' :
        dp[y][x+1] = min(dp[y][x] + 1, dp[y][x+1])
    else:
        dp[y][x+1] = min(dp[y][x],dp[y][x+1])
    
    if ab[y+1][x] == '#' and ab[y][x] == '.' :
        dp[y+1][x] = min(dp[y][x] + 1, dp[y+1][x])
    else:
        dp[y+1][x] = min(dp[y][x], dp[y+1][x])
    
 
print(dp[h-1][w-1])
Buggy python submission (verdict: Time Limit Exceeded):
import copy
n,m,k = map(int,input().split())
ab = [[] for _ in range(n)]
for _ in range(m):
    a, b= (int(x) for x in input().split())
    ab[a-1].append(b-1)
    ab[b-1].append(a-1)
bl = [[] for _ in range(n)]
for _ in range(k):
    a, b= (int(x) for x in input().split())
    bl[a-1].append(b-1)
    bl[b-1].append(a-1)
ans = []
#print(ab)
#print(bl)
check = [0]*n
for i in range(n):
    check = [0]*n
    first = copy.copy(ab[i])
    #print(ab)
    #print(first)
    move = []
    check[i] = 1
    while len(first)>0:
        p = first.pop(0)
        check[p] = 1
        for q in ab[p]:
            #print(q)
            move.append(q)
    #print(move)
    count = 0
    while len(move):
        j = move.pop(0)
        if check[j] == 0 :
            check[j] = 1
            if j not in bl[i]:
                count += 1
            for k in ab[j]:
                move.append(k)
    ans.append(count)
#print(ans)
print(' '.join(map(str,ans)))

Fixed submission:
import sys
input = sys.stdin.readline

N, M, K = map(int, input().split())
friends_table = [[] for i in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    friends_table[a-1] += [b-1]
    friends_table[b-1] += [a-1]

group_list = [i for i in range(N)]
friends_candidate = [[] for i in range(N)]

for i in range(N):
    # すでにDFS済み
    if i != group_list[i]:
        continue
    next_stack = [i]
    friend = [i]
    while next_stack:
        u = next_stack.pop(-1)
        for v in friends_table[u]:
            # 訪問済み
            if i == group_list[v]:
                continue
            friend += [v]
            group_list[v] = i
            next_stack += [v]
    for f in friend:
        friends_candidate[f] = friend

blocks_table = [[] for i in range(N)]
for _ in range(K):
    a, b = map(int, input().split())
    if group_list[a-1] == group_list[b-1]:
        blocks_table[a-1] += [b-1]
        blocks_table[b-1] += [a-1]

for i in range(N):
    print(len(friends_candidate[i]) - len(friends_table[i]) - len(blocks_table[i])-1)
Buggy python submission (verdict: Runtime Error):
w, h = (int(x) for x in input().split())
ab = []
for _ in range(h):
    a, b = (int(x) for x in input().split())
    ab.append([a, b])

dp = [0 for i in range(w+1)]

for j in range(1, w+1):
    dp[j] = min(dp[j-a]+b for a, b in ab)

print(dp[w])

Fixed submission:
h,n=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)]
 
max_a=max(a for a,_ in ab)
dp = [0] * (h+max_a)
 
for i in range(0,h+max_a):
    if i==0:
        dp[i]=0
    else:
        dp[i]=min(dp[i-a]+b for a,b in ab)
print(dp[h])

Buggy python submission (verdict: Time Limit Exceeded):
w, h = (int(x) for x in input().split())
ab = []
for _ in range(h):
    a, b = (int(x) for x in input().split())
    ab.append([a, b])

dp = [10000000000000 for i in range(w+1)]

for j in range(w+1):
    for i in range(h):
        if j <= ab[i][0]:
            dp[j] = min(dp[j], ab[i][1])
        else:
            dp[j] = min(dp[j], dp[j-ab[i][0]]+ab[i][1])

print(dp[w])

Fixed submission:
h,n=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)]
 
max_a=max(a for a,_ in ab)
dp = [0] * (h+max_a)
 
for i in range(0,h+max_a):
    if i==0:
        dp[i]=0
    else:
        dp[i]=min(dp[i-a]+b for a,b in ab)
print(dp[h])
Buggy python submission (verdict: Time Limit Exceeded):
import math

mod = 1000000007

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

n=int(input())

a = list(map(int,input().split()))

memo = a[0]

for i in range(1,n):
    memo = lcm(memo,a[i])

ans = 0

for i in range(n):
    ans += memo//a[i]
    ans %= mod

print(ans)

Fixed submission:
import math
 
mod = 1000000007
 
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
 
n=int(input())
 
a = list(map(int,input().split()))
 
memo = a[0]
 
for i in range(1,n):
    memo = lcm(memo,a[i])
 
ans = 0
 
for i in range(n):
    ans += memo*pow(a[i], mod-2, mod)%mod
    ans %= mod
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
mod = 1000000007        

import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

n=int(input())

t = list(map(int,input().split()))

max_gcm = 1

for i in t:
    max_gcm = lcm(i,max_gcm)

ans = 0

for i in t:
    ans += max_gcm//i
    ans %= mod

print(ans)

Fixed submission:
import math
 
mod = 1000000007
 
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
 
n=int(input())
 
a = list(map(int,input().split()))
 
memo = a[0]
 
for i in range(1,n):
    memo = lcm(memo,a[i])
 
ans = 0
 
for i in range(n):
    ans += memo*pow(a[i], mod-2, mod)%mod
    ans %= mod
 
print(ans)
Buggy python submission (verdict: Runtime Error):
h,w = (int(x) for x in input().split())
ab = []
count = 0
for _ in range(h):
    a = input()
    a = a+'#'
    ab.append(list(a))
ab.append(list('#'*w))
mx = 0

for i in range(h):
    for j in range(w):
        dp = [[0 for i in range(w)] for j in range(h)]
        step = [[i, j]]

        while len(step) > 0:
            y, x = step.pop(0)
            if ab[y+1][x] == '.' and dp[y+1][x] == 0 :
                step.append([y+1, x])
                dp[y+1][x] = dp[y][x] + 1
            if ab[y][x+1] == '.' and dp[y][x+1] == 0 :
                step.append([y, x+1])
                dp[y][x+1] = dp[y][x] + 1
            if ab[y-1][x] == '.' and dp[y-1][x] == 0 :
                step.append([y-1, x])
                dp[y-1][x] = dp[y][x] + 1
            if ab[y][x-1] == '.' and dp[y][x-1] == 0 :
                step.append([y, x-1])
                dp[y][x-1] = dp[y][x] + 1
        mx = max([mx, max(list(itertools.chain.from_iterable(dp)))])

print(mx)

Fixed submission:
import itertools

import copy
    
h,w = (int(x) for x in input().split())
ab = []
count = 0
for _ in range(h):
    a = input()
    a = a+'#'
    ab.append(list(a))
ab.append(list('#'*w))
mx = 0

for i in range(h):
    for j in range(w):
        if ab[i][j] == '.':
            dp = [[0 for a in range(w)] for b in range(h)]
            step = [[i, j]]

            while len(step) > 0:
                y, x = step.pop(0)
                if ab[y+1][x] == '.' and dp[y+1][x] == 0 :
                    step.append([y+1, x])
                    dp[y+1][x] = dp[y][x] + 1
                if ab[y][x+1] == '.' and dp[y][x+1] == 0 :
                    step.append([y, x+1])
                    dp[y][x+1] = dp[y][x] + 1
                if ab[y-1][x] == '.' and dp[y-1][x] == 0 :
                    step.append([y-1, x])
                    dp[y-1][x] = dp[y][x] + 1
                if ab[y][x-1] == '.' and dp[y][x-1] == 0 :
                    step.append([y, x-1])
                    dp[y][x-1] = dp[y][x] + 1
            dp[i][j] = 0
            mx = max([mx, max(list(itertools.chain.from_iterable(dp)))])

print(mx)
Buggy python submission (verdict: Time Limit Exceeded):
import math
 
def combination(n, k):
    return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

n, k = map(int, input().split())
a = list(map(int,input().split()))
mod = 10 ** 9 + 7

ans = 0

a.sort()

for i in range(n-k+1):
    ans -= a[i] * combination(n-i-1, k-1) % mod
    ans %= mod

a.sort(reverse=True)

for i in range(n-k+1):
    ans += a[i] * combination(n-i-1, k-1) % mod
    ans %= mod

print(ans%mod)


Fixed submission:
N, K = map(int,input().split())

A = list(map(int,input().split()))
 
MAX = 10 ** 5 + 1
MOD = 10 ** 9 + 7
 
fac = [0] * (MAX + 1)
fac[0] = 1
fac[1] = 1
for i in range(2, MAX + 1):
    fac[i] = fac[i - 1] * i % MOD
    
finv = [0] * (MAX + 1)
finv[MAX] = pow(fac[MAX], MOD - 2, MOD)
  
for i in range(MAX, 0, -1):
    finv[i - 1] = finv[i] * i % MOD
 
def comb(n, k):
    if n < k or k < 0:
        return 0
    return (fac[n] * finv[k] * finv[n - k]) % MOD

A.sort()
ans = 0
for i in range(N):
    if i >= K - 1:
        ans += comb(i, K - 1) * A[i]
    if i + K - 1 < N:
        ans -= comb(N - i - 1, K - 1) * A[i]
    ans %= MOD
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s=list(input())

right = [0]

left = [0]

count = 0
for i in range(len(s)):
    if s[i] == '<':
        count += 1
    else:
        count = 0
    right.append(count)
count = 0
for i in range(len(s)-1,-1,-1):
    if s[i] == '>':
        count += 1
    else:
        count = 0
    left.insert(0,count)

ans = 0

for i in range(len(s)+1):
    ans += max(right[i],left[i])
print(ans)


Fixed submission:
s=list(input())

right = [0]

left = [0]

count = 0
for i in range(len(s)):
    if s[i] == '<':
        count += 1
    else:
        count = 0
    right.append(count)
count = 0
for i in range(len(s)-1,-1,-1):
    if s[i] == '>':
        count += 1
    else:
        count = 0
    left.append(count)
left.reverse()

ans = 0

for i in range(len(s)+1):
    ans += max(right[i],left[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n=int(input())

t = list(map(int,input().split()))

count = 0

for x, y, z in itertools.combinations(t, 3):
    if x+y>z and y+z>x and z+x>y:
        count += 1
print(count)

Fixed submission:
import bisect
N = int(input())
L = sorted([int(x) for x in input().split()])
cnt = 0
#print(L)
for i in range(N-2):
    for j in range(i+1, N-1):
        #print(i, j)
        #print(bisect.bisect_left(L, L[i]+L[j]))
        cnt +=  bisect.bisect_left(L, L[i]+L[j]) - (j+1)
print(cnt)
Buggy python submission (verdict: Runtime Error):
s=input()

n=int(input())

ss = s+s[0]

ss=list(ss)

ss.reverse()

if ss[0] == ss[1] and ss[1] != ss[2]:
    sa = 1
else:
    sa = 0

count = 0

for i in range(1,len(ss)):
    if ss[i] == ss[i-1]:
        ss[i] = '!'
        count += 1
print(count*n-sa)
    

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

if list(S).count(S[0])==len(S):
    print(len(S)*K//2)

else:
    S_count=0
    i=0
    while i<len(S)-1:
        if S[i]==S[i+1]:
            S_count+=1
            i+=1
        i+=1

    if S[0]==S[-1]:
        a=1
        i=0
        while i<len(S)-1:
            if S[i]==S[i+1]:
                a+=1
                i+=1
            else:
                break
        b=1
        i=len(S)-1
        while i>0:
            if S[i]==S[i-1]:
                b+=1
                i+=-1
            else:
                break

        S_count*=K
        S_count-=(K-1)*(a//2 + b//2 - (a+b)//2)

    else:
        S_count*=K
    print(S_count)
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import insort

n,m = map(int,input().split())

a = list(map(int,input().split()))

a.sort()

for _ in range(m):
    max_product = a.pop(-1)
    max_product //= 2
    insort(a,  max_product)
print(sum(a))

Fixed submission:
import heapq
n,m = map(int,input().split())

t = list(map(int,input().split()))

for i in range(n):
    t[i] = -t[i]

t.sort()

for i in range(m):
    x=heapq.heappop(t)
    x = -x
    x = int(x/2)
    heapq.heappush(t,-x)
    #print(t)
print(-sum(t))

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

t = list(map(int,input().split()))

t.sort(reverse=True)

memo = []

for i in range(m):
    if len(memo) == 0:
        x=t.pop(0)
    elif len(t) == 0:
        x=memo.pop(0)
    elif t[0] >= memo[0]:
        x=t.pop(0)
    else:
        x=memo.pop(0)
    x = int(x/2)
    memo.append(x)
    #print(t)
print(sum(t)+sum(memo))

Fixed submission:
import heapq
n,m = map(int,input().split())

t = list(map(int,input().split()))

for i in range(n):
    t[i] = -t[i]

t.sort()

for i in range(m):
    x=heapq.heappop(t)
    x = -x
    x = int(x/2)
    heapq.heappush(t,-x)
    #print(t)
print(-sum(t))

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import insort

n,m = map(int,input().split())

t = list(map(int,input().split()))

t.sort()

for i in range(m):
    x=t.pop(-1)
    x = int(x/2)
    insort(t, x)
    #print(t)
print(sum(t))

Fixed submission:
import heapq
n,m = map(int,input().split())

t = list(map(int,input().split()))

for i in range(n):
    t[i] = -t[i]

t.sort()

for i in range(m):
    x=heapq.heappop(t)
    x = -x
    x = int(x/2)
    heapq.heappush(t,-x)
    #print(t)
print(-sum(t))
Buggy python submission (verdict: Runtime Error):
import math
    
a,b,c,d = map(int,input().split())
cd = c*d//math.gcd(c, d)
 
c1 = b//c
d1 = b//d
cd1 = b//(cd)
 
c2 = (a-1)//c
d2 = (a-1)//d
cd2 = (a-1)//cd
 
c3 = c1-c2
d3 = d1-d2
cd3 = cd1-cd2
 
print(b-a+1-c3-d3+cd3)

Fixed submission:
import fractions
    
a,b,c,d = map(int,input().split())
cd = c*d//fractions.gcd(c, d)

c1 = b//c
d1 = b//d
cd1 = b//(cd)

c2 = (a-1)//c
d2 = (a-1)//d
cd2 = (a-1)//cd

c3 = c1-c2
d3 = d1-d2
cd3 = cd1-cd2

print(b-a+1-c3-d3+cd3)

Buggy python submission (verdict: Runtime Error):
import math
    
a,b,c,d = map(int,input().split())
cd = c*d//math.gcd(c, d)

c1 = b//c
d1 = b//d
cd1 = b//(cd)

c2 = (a-1)//c
d2 = (a-1)//d
cd2 = (a-1)//cd

c3 = c1-c2
d3 = d1-d2
cd3 = cd1-cd2

print(b-a+1-c3-d3+cd3)

Fixed submission:
import fractions
    
a,b,c,d = map(int,input().split())
cd = c*d//fractions.gcd(c, d)

c1 = b//c
d1 = b//d
cd1 = b//(cd)

c2 = (a-1)//c
d2 = (a-1)//d
cd2 = (a-1)//cd

c3 = c1-c2
d3 = d1-d2
cd3 = cd1-cd2

print(b-a+1-c3-d3+cd3)
Buggy python submission (verdict: Runtime Error):
n=int(input())
ball_xy = []
for _ in range(n):
    x, y = (int(x) for x in input().split())
    ball_xy.append([x, y])

distance = {}

for i in range(n):
    for j in range(n):
        if i == j:
            continue
        if (ball_xy[i][0]-ball_xy[j][0], ball_xy[i][1]-ball_xy[j][1]) in distance:
            distance[(ball_xy[i][0]-ball_xy[j][0], ball_xy[i][1]-ball_xy[j][1])] += 1
        else:
            distance[(ball_xy[i][0]-ball_xy[j][0], ball_xy[i][1]-ball_xy[j][1])] = 1

cost_0 = max(distance.values())

print(n-cost_0)

Fixed submission:
n=int(input())

if n == 1:
    print(1)
    exit()

ball_xy = []
for _ in range(n):
    x, y = (int(x) for x in input().split())
    ball_xy.append([x, y])

distance = {}

for i in range(n):
    for j in range(n):
        if i == j:
            continue
        if (ball_xy[i][0]-ball_xy[j][0], ball_xy[i][1]-ball_xy[j][1]) in distance:
            distance[(ball_xy[i][0]-ball_xy[j][0], ball_xy[i][1]-ball_xy[j][1])] += 1
        else:
            distance[(ball_xy[i][0]-ball_xy[j][0], ball_xy[i][1]-ball_xy[j][1])] = 1

cost_0 = max(distance.values())

print(n-cost_0)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = (int(x) for x in input().split())
ab = []
for _ in range(m):
    a=int(input())
    ab.append(a)
dp = [0]*(n+1)
dp[0] = 1

for i in range(1,n+1):
    dp[i] += (dp[i-1]+dp[i-2])%1000000007
    if i in ab:
        dp[i] = 0
print(dp[-1])

Fixed submission:
N, M = map(int, input().split())
a = set([int(input()) for i in range(M)])
 
dp = [0] * (N+1)
dp[0] = 1
for i in range(1, N+1):
    dp[i] = (dp[i-1] + dp[i-2]) % (10**9+7)
    if i in a:
        dp[i] = 0
print(dp[N])

Buggy python submission (verdict: Runtime Error):
n, m = (int(x) for x in input().split())
ab = []
for _ in range(m):
    a=int(input())
    ab.append(a)
dp = [0]*(n+1)
dp[0] = 1
ana = ab.pop(0)

for i in range(1,n+1):
    dp[i] += (dp[i-1]+dp[i-2])%1000000007
    if i == ana:
        dp[i] = 0
        if len(ab):
            ana = ab.pop(0)
print(dp[-1])

Fixed submission:
N, M = map(int, input().split())
a = set([int(input()) for i in range(M)])
 
dp = [0] * (N+1)
dp[0] = 1
for i in range(1, N+1):
    dp[i] = (dp[i-1] + dp[i-2]) % (10**9+7)
    if i in a:
        dp[i] = 0
print(dp[N])

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
ab = []
for _ in range(m):
    a=int(input())
    ab.append(a)

dp = [0]*(n+1)
dp[0] = 1

for i in range(1, n+1):
    dp[i] = (dp[i-1] + dp[i-2])%1000000007
    if i in ab:
        dp[i] = 0

print(dp[-1])

Fixed submission:
N, M = map(int, input().split())
a = set([int(input()) for i in range(M)])
 
dp = [0] * (N+1)
dp[0] = 1
for i in range(1, N+1):
    dp[i] = (dp[i-1] + dp[i-2]) % (10**9+7)
    if i in a:
        dp[i] = 0
print(dp[N])

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
ab = []
for _ in range(m):
    a=int(input())
    ab.append(a)

dp = [0]*(n+1)
dp[0] = 1

for i in range(1, n+1):
    dp[i] = (dp[i-1] + dp[i-2])%1000000007
    if i in ab:
        dp[i] = 0

print(dp[-1])

Fixed submission:
N, M = map(int, input().split())
a = set([int(input()) for i in range(M)])
 
dp = [0] * (N+1)
dp[0] = 1
for i in range(1, N+1):
    dp[i] = (dp[i-1] + dp[i-2]) % (10**9+7)
    if i in a:
        dp[i] = 0
print(dp[N])

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
ab = []
for _ in range(m):
    a=int(input())
    ab.append(a)

dp = [0]*(n+1)
dp[0] = 1

for i in range(1, n+1):
    dp[i] = (dp[i-1] + dp[i-2])
    if i in ab:
        dp[i] = 0

print(dp[-1]%1000000007)

Fixed submission:
N, M = map(int, input().split())
a = set([int(input()) for i in range(M)])
 
dp = [0] * (N+1)
dp[0] = 1
for i in range(1, N+1):
    dp[i] = (dp[i-1] + dp[i-2]) % (10**9+7)
    if i in a:
        dp[i] = 0
print(dp[N])