Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
from itertools import product
n = int(input())
x = [None] * n
y = [None] * n
for i in range(n):
    x[i], y[i] = map(int, input().split())

ps = set()
qs = set()
for s, t in product(range(n), repeat=2):
    if s == t:
        continue
    ps.add(x[t] - x[s])
    qs.add(y[t] - y[s])

m = 0
for p, q in product(ps, qs):
    c = 0
    for s, t in product(range(n), repeat=2):
        if s == t:
            continue
        if x[t] - x[s] == p and y[t] - y[s] == q:
            c += 1
    m = max(m, c)

print(n - m)


Fixed submission:
#!/usr/bin/env python3
from itertools import product
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]

m = 0
xy.sort(key=lambda x: (x[0], x[1]))
for l in range(n - 1):
    for r in range(l + 1, n):
        p = xy[r][0] - xy[l][0]
        q = xy[r][1] - xy[l][1]
        c = 0
        for i in range(n - 1):
            for j in range(i + 1, n):
                if xy[j][0] - xy[i][0] != p: continue
                if xy[j][1] - xy[i][1] != q: continue
                c += 1
                break
        m = max(m, c)

xy.sort(key=lambda x: (x[1], x[0]))
for l in range(n - 1):
    for r in range(l + 1, n):
        p = xy[r][0] - xy[l][0]
        q = xy[r][1] - xy[l][1]
        c = 0
        for i in range(n - 1):
            for j in range(i + 1, n):
                if xy[j][0] - xy[i][0] != p: continue
                if xy[j][1] - xy[i][1] != q: continue
                c += 1
                break
        m = max(m, c)

print(n - m)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
from itertools import product
n = int(input())
x = [None] * n
y = [None] * n
for i in range(n):
    x[i], y[i] = map(int, input().split())

ps = set()
qs = set()
for s, t in product(range(n), repeat=2):
    if s == t:
        continue
    ps.add(x[t] - x[s])
    qs.add(y[t] - y[s])

m = 0
for p, q in product(ps, qs):
    c = 0
    for s, t in product(range(n), repeat=2):
        if s == t:
            continue
        if x[t] - x[s] == p and y[t] - y[s] == q:
            c += 1
    m = max(m, c)

print(n - m)


Fixed submission:
#!/usr/bin/env python3
from itertools import product
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]

m = 0
xy.sort(key=lambda x: (x[0], x[1]))
for l in range(n - 1):
    for r in range(l + 1, n):
        p = xy[r][0] - xy[l][0]
        q = xy[r][1] - xy[l][1]
        c = 0
        for i in range(n - 1):
            for j in range(i + 1, n):
                if xy[j][0] - xy[i][0] != p: continue
                if xy[j][1] - xy[i][1] != q: continue
                c += 1
                break
        m = max(m, c)

xy.sort(key=lambda x: (x[1], x[0]))
for l in range(n - 1):
    for r in range(l + 1, n):
        p = xy[r][0] - xy[l][0]
        q = xy[r][1] - xy[l][1]
        c = 0
        for i in range(n - 1):
            for j in range(i + 1, n):
                if xy[j][0] - xy[i][0] != p: continue
                if xy[j][1] - xy[i][1] != q: continue
                c += 1
                break
        m = max(m, c)

print(n - m)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
from itertools import product
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]

xy.sort(key=lambda x: (x[0], x[1]))
ps = set()
for i, j in product(range(n), range(n)):
    if i >= j:
        continue
    ps.add(xy[j][0] - xy[i][0])
qs = set()
for i, j in product(range(n), range(n)):
    if i >= j:
        continue
    qs.add(xy[j][1] - xy[i][1])

m = 0
for p, q in product(ps, qs):
    c = 0
    for i in range(n - 1):
        for j in range(i + 1, n):
            if xy[j][0] - xy[i][0] != p:
                continue
            if xy[j][1] - xy[i][1] != q:
                continue
            c += 1
            break
    m = max(m, c)

xy.sort(key=lambda x: (x[1], x[0]))
ps = set()
for i, j in product(range(n), range(n)):
    if i >= j:
        continue
    ps.add(xy[j][0] - xy[i][0])
qs = set()
for i, j in product(range(n), range(n)):
    if i >= j:
        continue
    qs.add(xy[j][1] - xy[i][1])

for p, q in product(ps, qs):
    c = 0
    for i in range(n - 1):
        for j in range(i + 1, n):
            if xy[j][0] - xy[i][0] != p:
                continue
            if xy[j][1] - xy[i][1] != q:
                continue
            c += 1
            break
    m = max(m, c)

print(n - m)


Fixed submission:
#!/usr/bin/env python3
from itertools import product
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]

m = 0
xy.sort(key=lambda x: (x[0], x[1]))
for l in range(n - 1):
    for r in range(l + 1, n):
        p = xy[r][0] - xy[l][0]
        q = xy[r][1] - xy[l][1]
        c = 0
        for i in range(n - 1):
            for j in range(i + 1, n):
                if xy[j][0] - xy[i][0] != p: continue
                if xy[j][1] - xy[i][1] != q: continue
                c += 1
                break
        m = max(m, c)

xy.sort(key=lambda x: (x[1], x[0]))
for l in range(n - 1):
    for r in range(l + 1, n):
        p = xy[r][0] - xy[l][0]
        q = xy[r][1] - xy[l][1]
        c = 0
        for i in range(n - 1):
            for j in range(i + 1, n):
                if xy[j][0] - xy[i][0] != p: continue
                if xy[j][1] - xy[i][1] != q: continue
                c += 1
                break
        m = max(m, c)

print(n - m)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
from itertools import product
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]

xy.sort(key=lambda x: (x[0], x[1]))
ps = set()
for i, j in product(range(n), range(n)):
    if i >= j:
        continue
    ps.add(xy[j][0] - xy[i][0])
qs = set()
for i, j in product(range(n), range(n)):
    if i >= j:
        continue
    qs.add(xy[j][1] - xy[i][1])

m = 0
for p, q in product(ps, qs):
    c = 0
    for i in range(n - 1):
        for j in range(i + 1, n):
            if xy[j][0] - xy[i][0] != p:
                continue
            if xy[j][1] - xy[i][1] != q:
                continue
            c += 1
            break
    m = max(m, c)

xy.sort(key=lambda x: (x[1], x[0]))
ps = set()
for i, j in product(range(n), range(n)):
    if i >= j:
        continue
    ps.add(xy[j][0] - xy[i][0])
qs = set()
for i, j in product(range(n), range(n)):
    if i >= j:
        continue
    qs.add(xy[j][1] - xy[i][1])

for p, q in product(ps, qs):
    c = 0
    for i in range(n - 1):
        for j in range(i + 1, n):
            if xy[j][0] - xy[i][0] != p:
                continue
            if xy[j][1] - xy[i][1] != q:
                continue
            c += 1
            break
    m = max(m, c)

print(n - m)


Fixed submission:
#!/usr/bin/env python3
from itertools import product
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]

m = 0
xy.sort(key=lambda x: (x[0], x[1]))
for l in range(n - 1):
    for r in range(l + 1, n):
        p = xy[r][0] - xy[l][0]
        q = xy[r][1] - xy[l][1]
        c = 0
        for i in range(n - 1):
            for j in range(i + 1, n):
                if xy[j][0] - xy[i][0] != p: continue
                if xy[j][1] - xy[i][1] != q: continue
                c += 1
                break
        m = max(m, c)

xy.sort(key=lambda x: (x[1], x[0]))
for l in range(n - 1):
    for r in range(l + 1, n):
        p = xy[r][0] - xy[l][0]
        q = xy[r][1] - xy[l][1]
        c = 0
        for i in range(n - 1):
            for j in range(i + 1, n):
                if xy[j][0] - xy[i][0] != p: continue
                if xy[j][1] - xy[i][1] != q: continue
                c += 1
                break
        m = max(m, c)

print(n - m)