Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02784 (python)

Fixed submission:
h, n = map(int, input().split())
a = list(map(int,input().split()))
sum = 0

for i in a:
  sum += i
  
if sum >= h:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
h, n = map(int, input().split())
a = []
a.append(map(int,input().split()))
sum = 0

for i in a:
  sum += i
  
if sum >= h:
  print("Yes")
else:
  print("No")
Problem p03719 (python)

Fixed submission:
a, b, c = map(int, input().split())
if a > 100 or a < -100:
 exit()
elif -100 > b or 100 < b:
 exit()
elif -100 > c or 100 < c:
 exit()
if a <= c and c <= b:
 print("Yes")
else:
 print("No")

Buggy submission (verdict: Runtime Error):
N = []
K = []
key_num, tmp = map(int, input().split())
x = 0
while x < key_num:
    a, b = map(int, input().split())
    N.append(a)
    K.append(b)
    x += 1
#print(N, K)
input_data = []
n = 0
for i in N:
    now = 1
    while now <= K[n]:
        input_data.append(i)
        now += 1
    n += 1
#print(input_data)
input_data.sort()
print(input_data[key_num])

Buggy submission (verdict: Runtime Error):
N = []
K = []
while True:
    a, b = map(int, input().split())
    if a == -1:
        break
    N.append(a)
    K.append(b)
key = K[0]
del N[0]
del K[0]
print(N, K)
input_data = []
n = 0
for i in N:
    now = 1
    while now <= K[n]:
        input_data.append(i)
        now += 1
    n += 1
print(input_data)
input_data.sort()
print
print(input_data[key])
Problem p03455 (python)

Fixed submission:
a,b = map(int,input().split())
if a*b % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a,b = int(input())
if a*b % 2 == 0:
  print('Even')
else:
  print('Odd')
Problem p03493 (python)

Fixed submission:
print(input().count("1"))

Buggy submission (verdict: Runtime Error):
print(input().count("1")
Problem p03494 (python)

Fixed submission:
import math
n = input()
a = list(map(int,input().split()))
ans = float("inf")
for i in a:
  ans = min(ans,len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))

Buggy submission (verdict: Runtime Error):
import math
n = input()
a = list(map(int,input().split()))
ans = float("inf")
for i in a:
  ans = min(ans,len(bin(i) - bin(i).rfind("1") - 1)
print(round(ans))
Problem p02755 (python)

Fixed submission:
def f():
  a = list(map(float,input().split()))

  for i in range(0, 1251):
    if i >= a[0]/0.08 and i < (a[0]+1)/0.08 and i >= a[1]/0.1 and i < (a[1]+1)/0.1:
      print(i)
      return

  print(-1)

f()

Buggy submission (verdict: Runtime Error):
b = input()
a = list(map(float,b.split()))
 
for i in range(0, 1251):
  if i >= a[0]/0.08 and i < (a[0]+1)/0.08 and i >= a[1]/0.1 and i < (a[1]+1)/0.1:
    print(i)
    return

print(-1)

Buggy submission (verdict: Runtime Error):
a = list(map(float,input().split()))

for i in range(0, 1251):
  if i >= a[0]/0.08 and i < (a[0]+1)/0.08 and i >= a[1]/0.1 and i < (a[1]+1)/0.1:
    print(i)
    return

print(-1)

Buggy submission (verdict: Runtime Error):
a = list(map(float,input().split()))
 
for i in range(0, 1251):
  if a[0]/0.08 >= i and (a[0]-1.0)/0.08 < i and a[1]/0.1 >= i and (a[1]-1.0)/0.1 < i:
    print(i)
    return
print(-1)

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
 
for i in range(0, 1251):
  if a[0]/0.08 >= i and (a[0]-1)/0.08 < i and a[1]/0.1 >= i and (a[1]-1)/0.1 < i:
    print(i)
    return
print(-1)

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))

for i in range(0, 1251):
  if a[0]/0.08 >= i and (a[0]-1)/0.08 < i and a[1]/0.1 >= i and (a[1]-1)/0.1:
    print(i)
    return
print(-1)
Problem p02885 (python)

Fixed submission:
a,b = map(int,input().split())
if a > 2*b:
  print(a-2*b)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a > 2b:
  print(a-2b)
else:
  print(0)
Problem p02898 (python)

Fixed submission:
n,k = map(int,input().split())
h = list(map(int,input().split()))
x = 0
for i in range(n):
  if h[i-1]>=k:
    x += 1
print(x)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = list(map(int,input().split()))
x = 0
for i in n:
  if h[i-1]>=k:
    x += 1
print(x)
Problem p02917 (python)

Fixed submission:
N = int(input())
B = list(map(int,input().split()))
A = sum(B)*2
for i in range(N-2):
  if B[i] <= B[i+1]:
    A -= B[i+1]
  else:
    A -= B[i]
print(A)

Buggy submission (verdict: Runtime Error):
N = int(input())
B = list(map(int,input.split()))
A = sum(B)*2
for i in range(N-1):
  if B[i] <= B[i+1]:
    A -= B[i+1]
  else:
    A -= B[i]
print(A)
Problem p02921 (python)

Fixed submission:
s = input()
t = input()
x = 0
for i in range(3):
  x += s[i-1]==t[i-1]
print(x)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
x = 0
for i in 3:
  x += s[i-1]!=t[i-1]
print(x)
Problem p02934 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a = [1/a[i] for i in range(n)]
print(1/sum(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(1/(int,input().split())))
print(1/sum(a))
Problem p02945 (python)

Fixed submission:
a,b = map(int,input().split())
print(max([a+b,a-b,a*b]))

Buggy submission (verdict: Runtime Error):
a,b = open(0)
print(max( [a+b, a-b, a*b]))
Problem p03128 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

ma_map = [ -1, 2, 5, 5, 4, 5, 6, 3, 7, 6 ]
N, M = (int(i) for i in input().split())
ma = list(int(i) for i in input().split())
memo = [-1] * 100000

def dfs(num):
	if memo[num] != -1: return memo[num]
	if num == 0: return 0

	ret = -1
	for p in ma:
		if 0 <= num - ma_map[p]:
			d = dfs(num - ma_map[p])
			if d == -1: continue
			ret = max(dfs(num - ma_map[p]) * 10 + p, ret)

	memo[num] = ret
	return ret

ma.sort()
print("{}".format(dfs(N)))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000000000)
 
ma_map = [ -1, 2, 5, 5, 4, 5, 6, 3, 7, 6 ]
N, M = (int(i) for i in input().split())
ma = list(int(i) for i in input().split())
memo = [-1] * 100000
 
def dfs(num):
	if memo[num] != -1: return memo[num]
	if num == 0: return 0
 
	ret = -1
	for p in ma:
		if 0 <= num - ma_map[p]:
			ret = max(dfs(num - ma_map[p]) * 10 + p, ret)
 
	memo[num] = ret
	return ret
 
ma.sort()
print(dfs(N))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000)

ma_map = [ -1, 2, 5, 5, 4, 5, 6, 3, 7, 6 ]
N, M = (int(i) for i in input().split())
ma = list(int(i) for i in input().split())
memo = [-1] * 100000

def dfs(num):
	if memo[num] != -1: return memo[num]
	if num == 0: return 0

	ret = -1
	for p in ma:
		if 0 <= num - ma_map[p]:
			d = dfs(num - ma_map[p])
			if d == -1: continue
			ret = max(dfs(num - ma_map[p]) * 10 + p, ret)

	memo[num] = ret
	return ret

print(ma_map[2])
ma.sort()
println("{}".format(dfs(N)))

Buggy submission (verdict: Runtime Error):
ma_map = [ -1, 2, 5, 5, 4, 5, 6, 3, 7, 6 ]
N, M = (int(i) for i in input().split())
ma = list(int(i) for i in input().split())
memo = [-1] * 100000

def dfs(num):
	if memo[num] != -1: return memo[num]
	if num == 0: return 0

	ret = -1
	for p in ma:
		if 0 <= num - ma_map[p]:
			d = dfs(num - ma_map[p])
			if d == -1: continue
			ret = max(dfs(num - ma_map[p]) * 10 + p, ret)

	memo[num] = ret
	return ret

print(ma_map[2])
ma.sort()
print(dfs(N))

Buggy submission (verdict: Runtime Error):
ma_map = [ -1, 2, 5, 5, 4, 5, 6, 3, 7, 6 ]
N, M = (int(i) for i in input().split())
ma = list(int(i) for i in input().split())
memo = [-1] * 100000

def dfs(num):
	if memo[num] != -1: return memo[num]
	if num == 0: return 0

	ret = -1
	for p in ma:
		if 0 <= num - ma_map[p]:
			ret = max(dfs(num - ma_map[p]) * 10 + p, ret)

	memo[num] = ret
	return ret

print(ma_map[2])
ma.sort()
print(dfs(N))
Problem p02841 (python)

Fixed submission:
m1,d1 = map(int,input().split())
m2,d2= map(int,input().split())
if m1!=m2:
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
m1,d1 = map(int,input().aplit())
m2,d2= map(int,input().split())
if m1!=m2:
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
m1,d1 = map(int,input().aplit())
m2,d2= map(int,input().split())
if m1!=m2:print(1)
else: print(0)
Problem p02937 (python)

Fixed submission:
from bisect import bisect

#Aのなかでlより大きな最小の値を得る.Aはソート済み

s = input()
t = input()
a = 'abcdefghijklmnopqrstuvwxyz'
d = {}
for ch in a:
  d[ch] = []
for ch,n in zip(s,range(len(s))):
  d[ch].append(n)

rep = 0
p = -1
for ch in t:
  if len(d[ch])==0:
    print("-1")
    exit()
  else:
    i = bisect(d[ch],p)
    if i!=len(d[ch]):p=d[ch][i]
    else:
      p = d[ch][0]
      rep+=1

print(len(s)*rep + p + 1)

Buggy submission (verdict: Runtime Error):
from bisect import bisect

#Aのなかでlより大きな最小の値を得る.Aはソート済み

s = input()
t = input()
a = 'abcdefghijklmnopqrstuvwxyz'
d = {}
for ch in a:
  d[ch] = []
for ch,n in zip(s,range(len(s))):
  d[ch].append(n)

rep = 0
p = -1
for ch in t:
  if len(d[ch])==0:
    print("-1")
    exit()
  else:
    i = bisect(d[ch],p)
    if i!=len(d[ch]):p=d[ch][i]
    else:
      p = d[ch][0]
      rep+=1
for i in range(1,len(t)):
  if ret[i] < ret[i-1]:rep+=1

e = len(s) - ret[-1]

print(len(s)*rep - e + 1)
Problem p02945 (python)

Fixed submission:
fs= [int(f) for f in input().split()]
a,b = fs[0],fs[1]
print(max(a+b,a*b,a-b))

Buggy submission (verdict: Runtime Error):
a,b = map(int(input().split()))
print(max(a+b,a-b,a*b))
Problem p02996 (python)

Fixed submission:
n = int(input())
A=[]
for i in range(n):
  a,b = map(int,input().split())
  A.append((b,a))
A.sort()
c = 0
for a in A:
  c+=a[1]
  if c>a[0]:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n = int(input())
X = [0]*100000000
for i in range(n):
  a,b = map(int,input().split())
  p = b
  for j in range(a):
    while X[p]!=0:
      p-=1
      if p<0:
        print("No")
        exit()
    X[p]=1
    p-=1
    if p<0:
        print("No")
        exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

class Solver7
    {
        /*
         * https://atcoder.jp/contests/abc131/tasks/abc131_d
         * 
         * 
         */
                public void Solve7()
        {
            var nnum = 99999999;
            var n = int.Parse(Console.ReadLine());
            int[] X = new int[nnum];
            
            try
            {
                for (int i = 0; i < n; i++)
                {
                    var ab = u.readIntArrayBySplit();
                    var a = ab[0];
                    var b = ab[1];
                    var p = b;
                    for (int j = 0; j < a; j++)
                    {
                      	var xx = X[p];
                      	
                        while (X[p]!=null && X[p] == 1)
                        {
                            p--;
                        }
                        X[p] = 1;
                    }
                }
                Console.WriteLine("Yes");
            }
            catch(Exception ex)
            {
                Console.WriteLine("No");
            }


        }
        static void Main()
        {
            var solver = new Solver7();
            solver.Solve7();
        }
    }
    static class u
    {
        public static void outA(int[] A) { Console.WriteLine(string.Join(" ", A)); }
        public static void outInt(int i) { Console.WriteLine(i.ToString()); }
        public static void outLong(long i) { Console.WriteLine(i.ToString()); }
        static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }
        public static int readInt() { return int.Parse(Console.ReadLine()); }
        public static  string readStr() { return Console.ReadLine(); }
        public static int[] readIntArrayBySplit() { return Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        public static int[] readIntArrayZeroIchiRenzoku() { return Console.ReadLine().Select(s => int.Parse(s.ToString())).ToArray(); }

    }
Problem p03035 (python)

Fixed submission:
a,b = map(int,input().split())
if a >12:print(b)
elif a >5:print(b//2)
else: print(0)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a >12:print(b)
else if a <6:print(b//2)
else: print(0)
Problem p03316 (python)

Fixed submission:
def f(x):
  if x<10:
    return x
  else:
    a = x%10
    x//=10
    return a+f(x)
n = int(input())
a = f(n)
if n%a==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
def f(x):
  if x<10:
    return x
  else:
    a = x%10
    x%=10
    return a+f(x)
n = int(input())
a = f(n)
if n%a==0:
  print("Yes")
else:
  print("No")
Problem p02755 (python)

Fixed submission:
a,b=(int(x) for x in input().split())
 
import math 
 
i=0
while i<10001:
  i+=1
  if math.floor(i*0.08)==a and math.floor(i*0.1)==b:
    print(i)
    break
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
a,b=(int(x) for x in input().split())
 
import math 
 
i=0
while i<10001:
  i++
  if math.float(i)==a and math.float(i)==b:
    print(i)
    break
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
a,b=(int(x) for x in input().split())
 
import math 
 
i=0
while i<10001:
  i++
  if math.float(i)==a and math.float(i)==b:
    print(i)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
a,b=(int(x) for x in input().split())

import math 

i=0
while i<10001:
  i++
  if math.float(i)==a and math.float(i)==b:
    print(i)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
a,b=(int(x) for x in input().split())

for _ in range(10000):
  if i//100*8==a and i//100*10==b:
    print(i)
  else:
    print(-1)
Problem p02778 (python)

Fixed submission:
a=input()
print("".join(["x" for x in a]))

Buggy submission (verdict: Runtime Error):
s=input()
ans=''
for _ in len(s):
  ans+='x'
Problem p03285 (python)

Fixed submission:
N = int(input())
f = False
for i in range(N//4+1):
    for j in range(N//7+1):
        if i*4 + j*7 == N:
            f = True
            break
if f:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
d_cnt =(int(x) for x in input().split()) 

if d_cnt//4==0 or d_cnt//7==0 or d_cnt//11:
  print('Yes')
else:
  print('No')
Problem p02921 (python)

Fixed submission:
pred = input()
real = input()
length = len(pred)
count = 0
for i in range(length):
  if pred[i] == real[i]:
    count += 1
    
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(lambda x:int(x), input().split()))
count = 0
ans = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    count += 1
  else:
    count = 0
  ans = max(ans, count)

print(ans)
Problem p02923 (python)

Fixed submission:
N = int(input())
H = list(map(lambda x:int(x), input().split()))
count = 0
ans = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    count += 1
  else:
    count = 0
  ans = max(ans, count)

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(lambda x:int(x), input().split()))

ans = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    count += 1
  else:
    count = 0
  ans = max(ans, count)

print(ans)
Problem p02783 (python)

Fixed submission:
H, A = map(int, input().split())

x = 0
while True:
  if H <= 0:
    break
  if H > 0:
    H -= A
    x += 1
print(x)

Buggy submission (verdict: Runtime Error):
H, A = map(int, input().split())

x = 0
while True:
H = H - A
  if H < 0:
    break
  else:
    x += 1
print(x)

Buggy submission (verdict: Runtime Error):
H, A = int(input().split())

x = 1
while True:
  if 0 =< H/(A*x):
    H -= A
    a += 1
  else:
    break
print(x)

Buggy submission (verdict: Runtime Error):
H, A = int(input().split())

x = 1
while True:
  if 0 <= H/(A*x):
    H -= A
    a += 1
  else:
    break
print(x)

Buggy submission (verdict: Runtime Error):
from sys import stdin
H, A = map(int,stdin.readline().rstrip().split)

x = 1
while True:
  if 0 <= H/(A*x):
    H -= A
    a += 1
  else:
    break
print(x)

Buggy submission (verdict: Runtime Error):
from sys import stdin
H, A = map(int,stdin.readline().rstrip().split)

a = 0
while True:
  if x <= H/A:
    H - A
    a += 1
  else:
    break
print(a)

Buggy submission (verdict: Runtime Error):
from sys import stdin
H, A = map(int,stdin.readline().rstrip().split)

a = 0
while True
  if x <= H/A:
    H - A
    a += 1
  else:
    break
print(a)
Problem p02854 (python)

Fixed submission:
# https://atcoder.jp/contests/ddcc2020-qual/tasks/ddcc2020_qual_b

import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n = int(input())
    al = list(map(int, input().split()))

    cum_len = [0] * len(al)
    cum_len[0] = al[0]
    for i in range(1, len(al)):
        cum_len[i] = cum_len[i-1] + al[i]

    # print(sum(al))
    ans = 10**10
    for i in range(len(al)):
        left = cum_len[i]
        right = cum_len[-1] - cum_len[i]
        # print(left, right)
        ans = min(ans, abs(left - right))

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/ddcc2020-qual/tasks/ddcc2020_qual_b

import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n = int(input())
    al = list(map(int, input().split()))

    cum_len = [0] * len(al)
    cum_len[0] = al[0]
    for i in range(1, len(al)):
        cum_len[i + 1] = cum_len[i] + al[i]

    ans = 1000000
    for i in range(len(al)-1):
        left = cum_len[i]
        right = cum_len[-1] - cum_len[i]
        ans = min(ans, abs(left - right))

    print(ans)


if __name__ == '__main__':
    main()
Problem p02887 (python)

Fixed submission:
#
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n = int(input())
    s = input()
    ans = 1

    for i in range(1, n):
        if s[i-1] != s[i]:
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n = int(input())
    s = input()
    ans = 1

    for i in range(1, n):
        if s[i-1] != s[i]:
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()
v
Problem p02972 (python)

Fixed submission:
#

#

import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop
import math

def main():
    n = int(input())
    al = list(map(int, input().split()))

    ans = [0] * n

    half = math.ceil(n/2)
    for i in range(half, n):
        ans[i] = al[i]

    for i in range(half-1, -1, -1):
        num = i + 1
        val = 0
        for j in range(num * 2 - 1, n, num):
            # print(j)
            val += ans[j]

        val %= 2
        ans[i] = 0 if val == al[i] else 1

    c = ans.count(1)
    print(c)
    if c > 0:
        boxes = []
        for i in range(len(ans)):
            if ans[i] == 1:
                boxes.append(i + 1)
        print(' '.join(map(str, boxes)))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#

#

import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop
import math

def main():
    n = int(input())
    al = list(map(int, input().split()))

    ans = [0] * n

    half = math.ceil(n/2)
    for i in range(half, n):
        ans[i] = al[i]

    for i in range(half, -1, -1):
        num = i + 1
        val = 0
        for j in range(num * 2 - 1, n, num):
            # print(j)
            val += ans[j]

        val %= 2
        ans[i] = 0 if val == al[i] else 1

    c = ans.count(1)
    print(c)
    if c > 0:
        boxes = []
        for i in range(len(ans)):
            if ans[i] == 1:
                boxes.append(i + 1)
        print(' '.join(map(str, boxes)))


if __name__ == '__main__':
    main()
Problem p03006 (python)

Fixed submission:
#

import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop

def main():
    N = int(input())
    xy = []
    for _ in range(N):
        x, y = map(int, input().split())
        xy.append((x, y))

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

    xy.sort(key=lambda p: (p[0], p[1]))
    # print(xy)

    cand = defaultdict(lambda:0)

    for i in range(N-1):
        for j in range(i+1, N):
            p = xy[j][0] - xy[i][0]
            q = xy[j][1] - xy[i][1]
            key = '{},{}'.format(p, q)
            cand[key] += 1
    counter = Counter(cand)
    pq_count = counter.most_common()[0][1]
    # print(counter.most_common()[0])
    print(N - pq_count)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#

import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop

def main():
    N = int(input())
    xy = []
    for _ in range(N):
        x, y = map(int, input().split())
        xy.append((x, y))

    xy.sort(key=lambda p: (p[0], p[1]))
    # print(xy)

    cand = defaultdict(lambda:0)

    for i in range(N-1):
        for j in range(i+1, N):
            p = xy[j][0] - xy[i][0]
            q = xy[j][1] - xy[i][1]
            key = '{},{}'.format(p, q)
            cand[key] += 1
    counter = Counter(cand)
    pq_count = counter.most_common()[0][1]
    # print(counter.most_common()[0])
    print(N - pq_count)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#

import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop

def main():
    N = int(input())
    xy = []
    for _ in range(N):
        x, y = map(int, input().split())
        xy.append((x, y))

    xy.sort(key=lambda p: (p[0], p[1]))
    # print(xy)

    cand = defaultdict(lambda :0)
    ans = 0
    for i in range(N-1):
        for j in range(1, N):
            p = xy[j][0] - xy[i][0]
            q = xy[j][1] - xy[i][1]
            key = '{},{}'.format(p, q)
            cand[key] += 1
    counter = Counter(cand)
    pq_count = counter.most_common()[0][1]
    # print(counter.most_common()[0])
    print(N - pq_count)




if __name__ == '__main__':
    main()