Problem p03006 (python)

Fixed submission:
N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i],y[i] = map(int,input().split())

if N == 1:
    print(1)
else:
    memo = {}

    for i in range(N-1):
        for j in range(i+1,N):
            dx = x[j] - x[i]
            dy = y[j] - y[i]
            if (dx,dy) in memo:
                memo[(dx,dy)] += 1
            elif (-dx,-dy) in memo:
                memo[(-dx,-dy)] += 1
            else:
               memo[(dx,dy)] = 1
            #print(memo)

    M = max(memo.values())

    print(N-M)

Buggy submission (verdict: Runtime Error):
N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i],y[i] = map(int,input().split())

if N == 1:
    print(1)
memo = {}

for i in range(N-1):
    for j in range(i+1,N):
        dx = x[j] - x[i]
        dy = y[j] - y[i]
        if (dx,dy) in memo:
            memo[(dx,dy)] += 1
        elif (-dx,-dy) in memo:
            memo[(-dx,-dy)] += 1
        else:
            memo[(dx,dy)] = 1
        #print(memo)

M = max(memo.values())

print(N-M)

Buggy submission (verdict: Runtime Error):
N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i],y[i] = map(int,input().split())

memo = {}

for i in range(N-1):
    for j in range(i+1,N):
        dx = x[j] - x[i]
        dy = y[j] - y[i]
        if (dx,dy) in memo:
            memo[(dx,dy)] += 1
        elif (-dx,-dy) in memo:
            memo[(-dx,-dy)] += 1
        else:
            memo[(dx,dy)] = 1
        #print(memo)

M = max(memo.values())

print(N-M)

Buggy submission (verdict: Runtime Error):
N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i],y[i] = map(int,input().split())

memo = {}

for i in range(N-1):
    for j in range(i+1,N):
        dx = x[j] - x[i]
        dy = y[j] - y[i]
        if ((dx,dy) in memo) or ((-dx,-dy) in memo):
            memo[(dx,dy)] += 1
        else:
            memo[(dx,dy)] = 1
        #print(memo)

M = max(memo.values())

print(N-M)

Buggy submission (verdict: Runtime Error):
N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i],y[i] = map(int,input().split())

memo = {}

for i in range(N-1):
    for j in range(i+1,N):
        dx = x[j] - x[i]
        dy = y[j] - y[i]
        if ((dx,dy) in memo) or ((-dx,-dy) in memo):
            memo[(dx,dy)] += 1
        else:
            #memo[(dx,dy)] = 1
        print(memo)

M = max(memo.values())

print(N-M)

Buggy submission (verdict: Runtime Error):
N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i],y[i] = map(int,input().split())

memo = {}

for i in range(N-1):
    for j in range(i+1,N):
        dx = x[j] - x[i]
        dy = y[j] - y[i]
        if ((dx,dy) in memo) or ((-dx,-dy) in memo):
            memo[(dx,dy)] += 1
        else:
            memo[(dx,dy)] = 1

M = max(memo.values())

print(N-M)

Buggy submission (verdict: Runtime Error):
N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i],y[i] = map(int,input().split())

memo = {}

for i in range(N-1):
    for j in range(i+1,N):
        dx = abs(x[j] - x[i])
        dy = abs(y[j] - y[i])
        if (dx,dy) in memo:
            memo[(dx,dy)] += 1
        else:
            memo[(dx,dy)] = 1

M = max(memo.values())

print(N-M)