Problem p03006 (python)

Fixed submission:
import sys
N = int(input())
arr = []

for i in range(N):
    arr.append(list(map(int, input().split())))

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

d = {}

for i in range(N):
    for j in range(N):
        if i != j:
            x = arr[i][0] - arr[j][0]
            y = arr[i][1] - arr[j][1]
            if (x, y) in list(d.keys()):
                d[(x, y)] += 1
            else:
                d[(x, y)] = 1

print(N - max(list(d.values())))

Buggy submission (verdict: Runtime Error):
import sys
N = int(input())
arr = []

def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]

for i in range(N):
    arr.append(list(map(int, input().split())))

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

C = []
for i in range(N):
    for j in range(N):
        if i < j:
            x = arr[i][0]-arr[j][0]
            y = arr[i][1]-arr[j][1]
            C.append([x, y])


C = get_unique_list(C)
S = [0 for i in range(len(C))]

for c in range(len(C)):
    tmp = [[[arr[0][0], arr[0][1]]]]
    for i in range(1, N):
        l = len(tmp)
        for j in range(l):
            for k in range(len(tmp[j])):
                x_t = tmp[j][k][0] - arr[i][0]
                y_t = tmp[j][k][1] - arr[i][1]
                arr_i = [arr[i][0], arr[i][1]]
                if C[c][0] == 0 and y_t%C[c][1] == 0:
                    if x_t == 0:
                        tmp[j].append(arr_i)
                        break
                    elif j == l - 1:
                        tmp.append(arr_i)
    
                elif C[c][1] == 0 and x_t%C[c][0] == 0:
                    if y_t == 0:
                        tmp[j].append(arr_i)
                        break
                    elif j == l - 1:
                        tmp.append(arr_i)
                else:
                    if x_t*C[c][1] == y_t*C[c][0]:
                        tmp[j].append(arr_i)
                        break
                    elif j == l - 1:
                        tmp.append(arr_i)
                        
    S[c] = len(tmp)
    
print(min(S))

Buggy submission (verdict: Runtime Error):
from fractions import gcd
N = int(input())
arr = []

def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]


for i in range(N):
    arr.append(list(map(int, input().split())))

C = []
for i in range(N):
    for j in range(N):
        if i < j:
            x = arr[i][0]-arr[j][0]
            y = arr[i][1]-arr[j][1]
            g = gcd(x, y)
            x = int(x / g)
            y = int(y / g)
            C.append([x, y])

C = get_unique_list(C)
S = [0 for i in range(len(C))]

for c in range(len(C)):
    tmp = [[arr[0][0], arr[0][1]]]
    for i in range(1, N):
        l = len(tmp)
        for j in range(l):
            if (tmp[j][0] - arr[i][0])%C[c][0] == 0 and (tmp[j][1] - arr[i][1])%C[c][1] == 0:
                pass
            else:
                tmp.append([arr[i][0], arr[i][1]])
    S[c] = len(tmp)

print(min(S))

Buggy submission (verdict: Runtime Error):
from fractions import gcd
N = int(input())
arr = []

def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]


for i in range(N):
    arr.append(list(map(int, input().split())))

C = []
for i in range(N):
    for j in range(N):
        if i < j:
            x = arr[i][0]-arr[j][0]
            y = arr[i][1]-arr[j][1]
            g = gcd(x, y)
            x = int(x / g)
            y = int(y / g)
            C.append([x, y])

C = get_unique_list(C)
S = [0 for i in range(len(C))]

for c in range(len(C)):
    tmp = []
    for i in range(N):
        if C[c][0] != 0:
            tmp.append(round(arr[i][1] - arr[i][0]/C[c][0]*C[c][1],15))
        else:
            tmp.append(round(arr[i][0] - arr[i][1]/C[c][1]*C[c][0],15))
    tmp = list(set(tmp))
    S[c] = len(tmp)

print(min(S))

Buggy submission (verdict: Runtime Error):
from fractions import gcd
N = int(input())
arr = []

def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]


for i in range(N):
    arr.append(list(map(int, input().split())))

C = []
for i in range(N):
    for j in range(N):
        if i < j:
            x = arr[i][0]-arr[j][0]
            y = arr[i][1]-arr[j][1]
            g = gcd(x, y)
            x = int(x / g)
            y = int(y / g)
            C.append([x, y])

C = get_unique_list(C)
S = [0 for i in range(len(C))]

for c in range(len(C)):
    tmp = []
    for i in range(N):
        if C[c][0] != 0:
            tmp.append(round(arr[i][1] - arr[i][0]/C[c][0]*C[c][1],10))
        else:
            tmp.append(round(arr[i][0] - arr[i][1]/C[c][1]*C[c][0],10))
    tmp = list(set(tmp))
    S[c] = len(tmp)

print(min(S))