Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
N, M = map(int, input().split())
p = [0]
ans = [0]
D = deque()
for i in range(N):
    p.append(list())
    if i == 0:
        ans.append(0)
    else:
        ans.append(-1)
for i in range(M):
    A, B = map(int, input().split())
    p[A].append(B)
    p[B].append(A)
D.append(1)
while len(D) != 0:
    ind = D.popleft()
    for i in p[ind]:
        if ans[i] == -1:
            D.append(i)
            ans[i] = ind
    if -1 not in ans[2:]:
        break
if -1 in ans[2:]:
    print('No')
else:
    print('Yes')
    for i in ans[2:]:
        print(i)

Fixed submission:
from collections import deque
N, M = map(int, input().split())
p = [0]
ans = [0]
for i in range(N):
    p.append(list())
    if i == 0:
        ans.append(0)
    else:
        ans.append(-1)
for i in range(M):
    A, B = map(int, input().split())
    p[A].append(B)
    p[B].append(A)
D = deque([1])
while D:
    ind = D.popleft()
    for i in p[ind]:
        if ans[i] == -1:
            D.append(i)
            ans[i] = ind

if -1 in ans[2:]:
    print('No')
else:
    print('Yes')
    for i in ans[2:]:
        print(i)
Buggy python submission (verdict: Time Limit Exceeded):
N, A, B = list(map(int, input().split()))
C = 0

while True:
    if N <= 0:
        break
    C += min(N, A)
    N -= A + B

print(C)

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

Q = N // (A + B)
r = N - Q * (A + B)

print(A * Q + min(A, r))
Buggy python submission (verdict: Runtime Error):
print('YNeos'[len(set(input()))!=2::2]

Fixed submission:
print('YNeos'[len(set(input()))!=2::2])
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a>=13:
elif a>=6:
  b=b//2
else:
  b=0
print(b)

Fixed submission:
a,b=map(int,input().split())
if a>=13:
  b=b
elif a>=6:
  b=b//2
else:
  b=0
print(b)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(max(a,b)+max(max(a,b)-1,min(a,b))

Fixed submission:
a,b=map(int,input().split())
if a == b:
  print(a*2)
else :
  print(2*max(a,b)-1)
Buggy python submission (verdict: Runtime Error):
s="Christmas"
for i in range(25-int(input()):
  s += " Eve"
print(s)

Fixed submission:
s="Christmas"
for i in range(25-int(input())):
  s += " Eve"
print(s)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print((int)a%b==0)

Fixed submission:
a,b=map(int,input().split())
print(int(a%b!=0))
Buggy python submission (verdict: Runtime Error):
n=int(input())
if n - 999 > 0:
  print('ABD')
elif:
  print('ABC')

Fixed submission:
n=int(input())
if n - 999 > 0:
  print('ABD')
else:
  print('ABC')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 1
nums = list(map(int, input().split()))
for num in nums:
    ans *= num
if ans > 10 ** 18:
    print(-1)
else:
    print(ans)

Fixed submission:
def main():
    n = int(input())
    nums = list(map(int, input().split()))
    s = set(nums)
    if 0 in s:
        print(0)
        return
    ans = 1
    bound = 10 ** 18
    for num in nums:
        ans *= num
        if ans > bound:
            print(-1)
            return
    print(ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    nums = list(map(int, input().split()))
    n, k = nums[0], nums[1]
    graph = {}
    out = list(map(int, input().split()))
    for i in range(n):
        graph[i + 1] = out[i]
    
    cycle_length = None
    visited = {}
    ans = None

    def go(x, rem):
        while rem:
            x = graph[x]
            rem -= 1
        
        nonlocal ans
        ans = x
        return x

    def dfs(i, rem):
        #print("visit", i)
        nonlocal ans
        if rem == 0:
            ans = i
            return
        if i in visited:
            nonlocal cycle_length
            cycle_length = visited[i] - rem
            steps = rem % cycle_length
            ans = go(i, steps)
            return 
        visited[i] = rem
        dfs(graph[i], rem - 1)
        return

    dfs(1, k)
    print(ans)

if __name__ == "__main__":
    main()

Fixed submission:
def main():
    nums = list(map(int, input().split()))
    n, k = nums[0], nums[1]
    graph = {}
    out = list(map(int, input().split()))
    for i in range(n):
        graph[i + 1] = out[i]
    
    cycle_length = None
    visited = {}
    ans = None

    def go(x, rem):
        while rem:
            x = graph[x]
            rem -= 1
        
        nonlocal ans
        ans = x
        return x

    def dfs(i, rem):
        j = i
        while rem:
            if j in visited:
                nonlocal cycle_length
                cycle_length = visited[j] - rem
                steps = rem % cycle_length
                go(j, steps)
                return
            visited[j] = rem
            rem -= 1
            j = graph[j]

        nonlocal ans
        if not ans:
            ans = j
        return j

    dfs(1, k)
    print(ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
def rev_string(original_string):
  reverse_string = ""
  for a in original_string:
    reverse_string = a + reverse_string
  return reverse_string
ans = ""
l = ""
r = ""
c = 0
for _ in range(q):
  t = input().split()
  if t[0] == '1':
    c += 1
    a = l
    l = r
    r = a
  else:
    if t[1] == '1':
      l += t[2]
    else:
      r += t[2]
if c%2 ==0:
  print(rev_string(l) + s + r)
else:
  print(rev_string(l) + rev_string(s) + r)

Fixed submission:
s = input()
q = int(input())
l = []
r = []
c = 0
for _ in range(q):
  t = input().split()
  if t[0] == '1':
    c += 1
    a = l
    l = r
    r = a
  else:
    if t[1] == '1':
      l.append(t[2])
    else:
      r.append(t[2])
l = "".join(l[::-1])
r = "".join(r)
if c%2 ==0:
  print(l + s + r)
else:
  print(l + s[::-1] + r)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
ans = ""
for _ in range(q):
  t = input().split()
  if t[0] == '1':
    s=s[::-1]
  else:
    if t[1] == '1':
      s = (str(t[2]) +str(s))
    else:
      s = (str(s) + str(t[2]))
print(str(s))

Fixed submission:
s = input()
q = int(input())
l = []
r = []
c = 0
for _ in range(q):
  t = input().split()
  if t[0] == '1':
    c += 1
    a = l
    l = r
    r = a
  else:
    if t[1] == '1':
      l.append(t[2])
    else:
      r.append(t[2])
l = "".join(l[::-1])
r = "".join(r)
if c%2 ==0:
  print(l + s + r)
else:
  print(l + s[::-1] + r)
Buggy python submission (verdict: Runtime Error):
import math
a = []
b = []
toki = []
h, n = map(int, input().split())
for i in range(n):
  ai, bi =  map(float, input().split())
  toki.append((ai, bi))

def yeah(hp, toki):
  mp = 0
  dps = 0
  kou = 0
  for ai, bi in toki:
    t = ai
    if (hp - ai) <= 0:
      t = hp
    dps2 = float(t/bi)
    if dps <= dps2:
      dps = dps2
      mp = bi
      kou = t
  return (hp-kou, mp)
mp = 0
zan = h
while True:
  zan, mp2 = yeah(zan, toki)
  mp += mp2
  if zan <=0:
    break
print(int(mp))
  

Fixed submission:
import math 
h = int(input())
ans = 0
t = int(math.log2(h)+1)

for i in range(t):
  ans += 2**i
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
N = input()
A = [100, 101, 102, 103, 104, 105]
if len(str(N))  < 2:
  print(0)
  quit()
last = int(N[-2] + N[-1])
head = int(N[0:-2])
if 105 * head >= int(N):
  print(1)
else:
  print(0)

Fixed submission:
import math
N = input()
A = [100, 101, 102, 103, 104, 105]
if len(str(N))  <= 2:
  print(0)
  quit()
last = int(N[-2] + N[-1])
head = int(N[0:-2])
if 105 * head >= int(N):
  print(1)
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
import math
N = input()
A = [100, 101, 102, 103, 104, 105]
if len(str(N))  < 2:
  print(0)
  quit()
last = int(N[-2] + N[-1])
head = int(N[0:-2])
if last / head <= 5:
  print(1)
else:
  print(0)

Fixed submission:
import math
N = input()
A = [100, 101, 102, 103, 104, 105]
if len(str(N))  <= 2:
  print(0)
  quit()
last = int(N[-2] + N[-1])
head = int(N[0:-2])
if 105 * head >= int(N):
  print(1)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = sum(range(1, n))
print(ans)

Fixed submission:
n = int(input())
ans = 0
if n %2 ==0:
  ans = (n-1) * (n//2)
else:
  ans = n * (n//2)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A =[]
for _ in range(N):
  A.append(int(input()))
for i in range(N):
  ta = A[:]
  ta.pop(i)
  print(max(ta))

Fixed submission:
N = int(input())
A =[]
for _ in range(N):
  A.append(int(input()))
a = max(A)
a2= max(sorted(A)[:-1])
f = False
if(a == a2):
  f = True
for i in range(N):
  if(f):
    print(a)
  elif(A[i] == a):
    print(a2)
  else:
    print(a)
Buggy python submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
 
N, K = map(int, input().split())

for i in range(1,K+1):
  blue = cmb(K-1, i-1)
  red = cmb(N-K+1, i)
  print((blue * red) % (10**9+7))

Fixed submission:
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
 
N, K = map(int, input().split())

for i in range(1,K+1):
  if N-K+1 < i:
    print(0)
    continue
  blue = cmb(K-1, i-1)
  red = cmb(N-K+1, i)
  print((blue * red) % (10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
N, M  = map(int, input().split())
a  = []
for _ in range(M):
  a.append(int(input()))
sdic  = {}
nn1 = 1
nn2 = 0
for n in reversed(range(N)):
  if n in a:
    nn2 = nn1
    nn1 = 0
    continue
  t = nn1 + nn2
  if t == 0:
    print(0)
    quit()
  nn2 = nn1
  nn1 = t
  
print(nn1%1000000007)

Fixed submission:
N, M  = map(int, input().split())
a  = {}
for _ in range(M):
  a[int(input())] = 1
sdic  = {}
nn1 = 1
nn2 = 0
for n in reversed(range(N)):
  if n in a:
    nn2 = nn1
    nn1 = 0
    continue
  t = nn1 + nn2
  if t == 0:
    print(0)
    quit()
  nn2 = nn1
  nn1 = t
  
print(nn1%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
N, M  = map(int, input().split())
a  = []
for _ in range(M):
  a.append(int(input()))
sdic  = {}
ans = 0
sdic[N] = 1
sdic[N+1] = 0
for n in reversed(range(N)):
  if n in a:
    sdic[n] = 0
    continue
  t = sdic[n+1] + sdic[n+2]
  if t == 0:
    print(0)
    quit()
  sdic[n] = t
  
print(sdic[0]%1000000007)

Fixed submission:
N, M  = map(int, input().split())
a  = {}
for _ in range(M):
  a[int(input())] = 1
sdic  = {}
nn1 = 1
nn2 = 0
for n in reversed(range(N)):
  if n in a:
    nn2 = nn1
    nn1 = 0
    continue
  t = nn1 + nn2
  if t == 0:
    print(0)
    quit()
  nn2 = nn1
  nn1 = t
  
print(nn1%1000000007)
Buggy python submission (verdict: Runtime Error):
N = map(int, input())
print((N -2) * 180)

Fixed submission:
N = int(input())
print((N -2) * 180)
Buggy python submission (verdict: Runtime Error):
import sys
_args = sys.argv
_A = _args[1]
_P = _args[2]

if _A > 0 :
    _P=_P+_A*3

_ANS =math.floor(_P/2)

print(_ANS)

Fixed submission:
A, P = map(int, input().split())
print((A * 3 + P)//2)
Buggy python submission (verdict: Time Limit Exceeded):
N, A, B, C, D, E= [float(input()) for _ in range(6)]
cities = [A, B, C, D, E]
P = [N, 0, 0, 0, 0, 0]
t = 0
while True:
  t += 1
  for i in range(5)[::-1]:
    if P[i] > 0:
      s = P[i] - cities[i]
      if s < 0 :
        P[i+1] += P[i]
        P[i] = 0
      else :
        P[i+1] += cities[i]
        P[i] = s
  if(N <= P[5]):
    break
print(t)

Fixed submission:
N, A, B, C, D, E= [float(input()) for _ in range(6)]
cities = [A, B, C, D, E]
P = [N, 0, 0, 0, 0, 0]
t = 0
while True:
  for i, c in enumerate(cities):
    s = P[i] - c
    if s < 0 :
      P[i+1] += P[i]
      P[i] = 0
    else :
      P[i+1] += c
      P[i] = s
    t += 1
  if(P[5] > 0):
    break
print(int(-(-N//P[5]) + t - 1))
Buggy python submission (verdict: Time Limit Exceeded):
N, Y = map(int, input().split())
for i in range(N):
  for j in range(N-i):
    k = N - i - j
    if Y == 10000 * k + 5000 * j + 1000 * i:
        print(" ".join(map(str, [k, j, i])))
        quit(0)
    elif Y == 10000 * k + 5000 * i + 1000 * j:
        print(" ".join(map(str, [k, i, j])))
        quit(0)
    elif Y == 10000 * i + 5000 * j + 1000 * k:
        print(" ".join(map(str, [i, j, k])))
        quit(0)
    elif Y == 10000 * i + 5000 * k + 1000 * j:
        print(" ".join(map(str, [i, k, j])))
        quit(0)
    elif Y == 10000 * k + 5000 * j + 1000 * i:
        print(" ".join(map(str, [k, j, i])))
        quit(0)
    elif Y == 10000 * k + 5000 * i + 1000 * j:
        print(" ".join(map(str, [k, i, j])))
        quit(0)
print("-1 -1 -1")

Fixed submission:
N, Y = map(int, input().split())
for i in range(N + 1):
  for j in range(N- i + 1):
    k = N - i - j
    if Y == 10000 * i + 5000 * j + 1000 * k:
        print(" ".join(map(str, [i, j, k])))
        quit(0)
print("-1 -1 -1")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
from collections import defaultdict
import itertools
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

N, = map(int, input().split())
L = []
for i in range(N):
    c = int(input())
    a = [[int(v) for v in input().split()] for _ in range(c)]
    L.append(a)

def dfs(index, al):
    for v in L[index]:
        c = v[0] - 1
        if c not in al:
            if v[1]:
                al = dfs(c, al + [c])

    return al

t = [None] * N
for i in range(N):
    t[i] = dfs(i, [i])

ans = 0
for i in range(1 << N):
    a = set()
    for j in range(N):
        if (i >> j) & 1:
            a.add(j)

    for p in list(a):
        for v in t[p]:
            a.add(v)

    s = [-1] * N
    f = True

    for v in a:
        s[v] = 1

    for v in a:
        for x, y in L[v]:
            if s[x-1] == -1:
                s[x-1] = y
            elif s[x-1] != y:
                f = False
    if f:
        ans = max(ans, len(a))

print(ans)

Fixed submission:
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
from collections import defaultdict
import itertools
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

N, = map(int, input().split())
L = []
for i in range(N):
    c = int(input())
    a = [[int(v) for v in input().split()] for _ in range(c)]
    L.append(a)

def dfs(index, al):
    for v in L[index]:
        c = v[0] - 1
        if c not in al:
            if v[1]:
                al = dfs(c, al + [c])

    return al

t = [None] * N
for i in range(N):
    t[i] = dfs(i, [i])

ans = 0
for i in range(1 << N):
    a = set()
    for j in range(N):
        if (i >> j) & 1:
            a.add(j)

    for p in list(a):
        for v in t[p]:
            a.add(v)

    s = [-1] * N
    f = True

    for v in a:
        s[v] = 1

    for v in a:
        for x, y in L[v]:
            if s[x-1] == -1:
                s[x-1] = y
            elif s[x-1] != y:
                f = False
    if f:
        ans = max(ans, len(a))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
from collections import defaultdict
import itertools
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

N, = map(int, input().split())
S = input().strip()

ans = 0
for i in range(1000):
    s = str(i).zfill(3)
    t = 0
    for v in S:
        if s[t] == v:
            t += 1
        if t == 3:
            break
    if t == 3:
        ans += 1
print(ans)

Fixed submission:
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
from collections import defaultdict
import itertools
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

N, = map(int, input().split())
S = input().strip()

ans = 0
for i in range(1000):
    s = str(i).zfill(3)
    t = 0
    for v in S:
        if s[t] == v:
            t += 1
        if t == 3:
            break
    if t == 3:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
from collections import defaultdict
import itertools
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

N, = map(int, input().split())
S = input().strip()

s = set()
for i in range(N):
    for j in range(i + 1, N):
        for k in range(j + 1, N):
            s.add("".join([S[i], S[j], S[k]]))

print(len(s)) # very slow

Fixed submission:
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
from collections import defaultdict
import itertools
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

N, = map(int, input().split())
S = input().strip()

ans = 0
for i in range(1000):
    s = str(i).zfill(3)
    t = 0
    for v in S:
        if s[t] == v:
            t += 1
        if t == 3:
            break
    if t == 3:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import defaultdict, deque
from heapq import *
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

def gcd(a, b):
    if a < b:
        a, b = b, a
    if a % b == 0:
        return b
    return gcd(b, a % b)

g = gcd(N, M)

pp = []
for i in range(2, g + 1):
    if g % i == 0:
        pp.append(i)

ans = pp.copy()
for i in range(len(pp)):
    t = pp[i]
    ans = [v for v in ans if v % t != 0 or v == t]

print(len(ans) + 1)

Fixed submission:
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial
sys.setrecursionlimit(200000)
input = sys.stdin.readline

A, B = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

def gcd(a, b):
    if a < b:
        a, b = b, a
    if a % b == 0:
        return b
    return gcd(b, a % b)

# https://en.wikipedia.org/wiki/Trial_division
def f(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1: a.append(n)
    # Only odd number is possible
    return a

c = gcd(A, B)

print(len(set(f(c))) + 1)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N = int(input())
L = [input().strip() for _ in range(N)]

m = [{} for _ in range(N)]
for i in range(N):
    for v in L[i]:
        if m[i].get(v) == None:
            m[i][v] = 0
        m[i][v] += 1
        
ans = 0
# very slow
for i in range(N):
    for j in range(i + 1, N):
        if m[i] == m[j]:
            ans += 1
            
print(ans)

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

N = int(input())
L = [input().strip() for _ in range(N)]

m = [0 for _ in range(N)]
for i in range(N):
    p = list(L[i])
    p.sort()
    
    
    m[i] = "".join(p)

mm = {}
for i in range(N):
    if mm.get(m[i]) == None:
        mm[m[i]] = 0
    mm[m[i]] += 1


ans = 0
for v in mm.values():
    if v != 1:
        ans += v * (v - 1) // 2

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

N, = map(int, input().split())
L = [[int(v) for v in input().split()] for _ in range(N)]

m = {}
for i in range(N):
    for j in range(i, N):
        if i != j:
            x, y = L[i]
            x2, y2 = L[j]

            key = (x - x2, y - y2)

            if m.get(key) == None:
                m[key] = 0
            m[key] += 1

print(N - max(m.values()))

Fixed submission:
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

N, = map(int, input().split())
L = [[int(v) for v in input().split()] for _ in range(N)]

m = {}
for i in range(N):
    for j in range(N):
        if i != j:
            x, y = L[i]
            x2, y2 = L[j]

            key = (x - x2, y - y2)

            if m.get(key) == None:
                m[key] = 0
            m[key] += 1

if m == {}:
    print(1)
    exit()
print(N - max(m.values()))
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
L = set([int(input()) - 1 for _ in range(M)])
ans = [0] * N

if 0 not in L:
    ans[0] = 1
    
if 1 not in L:
    ans[1] = ans[0] + 1

for i in range(2, N):
    if i in L:
        continue
    
    if ans[i - 2] != 0 or ans[i - 1] != 0:
        ans[i] = ans[i - 2] + ans[i - 1]
        
print(ans[-1] % (1000000007))

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

N, M = map(int, input().split())
L = set([int(input()) - 1 for _ in range(M)])
ans = [0] * N

if 0 not in L:
    ans[0] = 1
    
if N > 1 and 1 not in L:
    ans[1] = ans[0] + 1

for i in range(2, N):
    if i in L:
        continue
    
    if ans[i - 2] != 0 or ans[i - 1] != 0:
        ans[i] = ans[i - 2] + ans[i - 1]
        
print(ans[-1] % (1000000007))