alexjercan/bugnet huggingface dataset:
Problem p02999 (Python) — buggy submission, verdict: Runtime Error

# A Rounding

x, a = map(int, input().split())
if x < a:
    print(0)
else:
    print(10)


Error: ValueError: invalid literal for int() with base 10: ' '
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02999/Python/s947229710.py", line 1, in <module>
    x, a = map(int, input())
ValueError: invalid literal for int() with base 10: ' '


Fixed submission:

x, a = map(int, input())
if x < a:
    print(0)
else:
    print(10)
Problem p02999 (Python) — buggy submission, verdict: Runtime Error

# -*- coding: utf-8 -*-

x, a = map(int, input().split())

if x < a:
    print("0")
else:
    print("10")


Error: ValueError: invalid literal for int() with base 10: '3 5'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02999/Python/s027313793.py", line 3, in <module>
    x, a = int(input()), int(input())
ValueError: invalid literal for int() with base 10: '3 5'


Fixed submission:

# -*- coding: utf-8 -*-

x, a = int(input()), int(input())

if x < a:
    print("0")
else:
    print("10")
Problem p02999 (Python) — buggy submission, verdict: Runtime Error

X, A = map(int, input().split())
if X < A:
    print(0)
else:
    print(10)


Error: ValueError: invalid literal for int() with base 10: ' '
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02999/Python/s897076551.py", line 1, in <module>
    X, A = map(int, input())
ValueError: invalid literal for int() with base 10: ' '


Fixed submission:

X, A = map(int, input())
if X < A:
    print(0)
else:
    print(10)
Problem p03000 (Python) — buggy submission, verdict: Runtime Error

N, X = map(int, input().split())
positions = list(map(int, input().split()))


ans = 1
D = 0
for i in range(N):
    if D + positions[i] <= X:
        D += positions[i]
        ans += 1
    else:
        print(ans)
        exit()
print(ans)


Error: 0

Fixed submission:

N, X = map(int, input().split())
positions = list(map(int, input().split()))


ans = 1
D = 0
for i in range(N + 1):
    if D + positions[i] <= X:
        D += positions[i]
        ans += 1
    else:
        print(ans)
        exit()
print(ans)
Problem p03000 (Python) — buggy submission, verdict: Runtime Error

a, b = map(int, input().split())
c = list(map(int, input().split()))
d = 1
e = 0
for i in range(a):
    e += c[i]
    if e <= b:
        d += 1
    else:
        break
print(d)


Error: EOFError: EOF when reading a line
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03000/Python/s443147037.py", line 10, in <module>
    a, b = map(int, input().split())
EOFError: EOF when reading a line


Fixed submission:

a, b = map(int, input().split())
c = list(map(int, input().split()))
d = 1
e = 0
for i in range(a):
    e += c[i]
    if e <= b:
        d += 1
print(d)
a, b = map(int, input().split())
c = list(map(int, input().split()))
d = 1
e = 0
for i in range(a):
    e += c[i]
    if e <= b:
        d += 1
    else:
        break
print(d)
Problem p03000 (Python) — buggy submission, verdict: Runtime Error

N, X = map(int, input().split())
L = list(map(int, input().split()))
x = 0
ans = 1
for i in range(N):
    x += L[i]
    if x > X:
        break
    else:
        ans += 1
print(ans)


Error: 0

Fixed submission:

N, X = map(int, input().split())
L = list(map(int, input().split()))
x = 0
i = 0
while x <= X:
    x += L[i]
    i += 1
print(i)
Problem p03000 (Python) — buggy submission, verdict: Runtime Error

def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    [n, x] = li()
    l_list = li()

    bound = 0
    bound_x = 0
    index = 0
    bound = bound + 1
    while bound_x + l_list[index] <= x:
        bound = bound + 1
        bound_x = bound_x + l_list[index]
        index = index + 1
        if index >= len(l_list):
            break

    print(bound)


Error: 0

Fixed submission:

def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    [n, x] = li()
    l_list = li()

    bound = 0
    bound_x = 0
    index = 0
    while bound_x <= x:
        bound = bound + 1
        bound_x = bound_x + l_list[index]
        index = index + 1
    print(bound)
Problem p03000 (Python) — buggy submission, verdict: Runtime Error

n, x = map(int, input().split())
ls = list(map(int, input().split()))

d = 0
count = 1
for a in ls:
    d += a
    if d <= x:
        count += 1

print(count)


Error: 0

Fixed submission:

n, x = map(int, input().split())
ls = list(map(int, input().split()))

d = 0
count = 0
while d <= x:
    d += ls[count]
    count += 1

print(count)
Problem p03000 (Python) — buggy submission, verdict: Runtime Error

# 入力の取得(1行目。数値)
i = list(map(int, input().split()))

# 変数セット
boundCnt = i[0]
limit = i[1]

# 入力の取得(2行目。数値)
landpoints = list(map(int, input().split()))
# 1回目のバウンド情報を加算(0座標)
landpoints.insert(0, 0)
boundCnt += 1

nowCnt = 0
nowLandpoints = 0

for i in range(boundCnt):

    nowLandpoints += landpoints[i]
    if nowLandpoints > limit:
        break

    nowCnt += 1

print(nowCnt)


Error: 0

Fixed submission:

# 入力の取得(1行目。数値)
i = list(map(int, input().split()))

# 変数セット
boundCnt = i[0]
limit = i[1]

# 入力の取得(2行目。数値)
landpoints = list(map(int, input().split()))

nowCnt = 0
nowLandpoints = 0
for i in range(boundCnt + 1):
    if nowLandpoints > limit:
        break
    nowCnt += 1
    nowLandpoints += landpoints[i]

print(nowCnt)
Problem p03000 (Python) — buggy submission, verdict: Runtime Error

N, X = map(int, input().split())
L = list(map(int, input().split()))

i = 0
D = 0
cnt = 1

for i in range(N):
    D += L[i]
    if D <= X:
        cnt += 1
print(cnt)


Error: 0

Fixed submission:

N, X = map(int, input().split())
L = list(map(int, input().split()))

i = 0
D = 0

if L[0] > X:
    print(1)
    exit()
elif L[0] == X:
    print(2)
    exit()

while D <= X and i <= N:
    D += L[i]
    i += 1

print(i)
Problem p03000 (Python) — buggy submission, verdict: Runtime Error

def main():
    N, X = map(int, input().split())
    L = list(map(int, input().split()))
    D = 0

    for cnt in range(2, N + 2):
        D += L[cnt - 2]
        if D > X:
            cnt -= 1
            break

    print(cnt)


if __name__ == "__main__":
    main()


Error: 0

Fixed submission:

def main():
    N, X = map(int, input().split())
    L = list(map(int, input().split()))
    cnt = 1
    D = 0

    while True:
        if D > X:
            cnt -= 1
            break
        if cnt > N + 1:
            cnt -= 1
            break
        D += L[cnt - 1]
        cnt += 1

    print(cnt)


if __name__ == "__main__":
    main()
Problem p03001 (Python) — buggy submission, verdict: Runtime Error

import sys

input = sys.stdin.readline

w, h, x, y = map(int, input().split())

if w % 2 == 0 and h % 2 == 0 and w // 2 == x and h // 2 == y:
    print(str(w * h / 2) + " " + "1")
else:
    print(str(w * h / 2) + " " + "0")


Error: WA

Fixed submission:

import sys

input = sys.stdin.readline

w, h, x, y = map(int, input().split())

if w == h:
    print(f"{w * h / 2} 1")
else:
    print(f"{w * h / 2} 0")
Problem p03001 (Python) — buggy submission, verdict: Runtime Error

# 真ん中を通れば必ず二分できてこれが最大値だが、自分自身が真ん中の座標の場合は自分自信を通るどんな直線も二分できる
w, h, x, y = map(int, input().split())
ans1 = (w * h) / 2.0
ans2 = 1 if w / 2 == x and h / 2 == y else 0
print(ans1, ans2)


Error: WA

Fixed submission:

# 真ん中を通れば必ず二分できてこれが最大値だが、自分自身が真ん中の座標の場合は自分自信を通るどんな直線も二分できる
w, h, x, y = map(int, input().split())
ans1 = (w * h) / 2.0
ans2 = 1 if w // x == h // y == 2 else 0
print(ans1, ans2)
Problem p03001 (Python) — buggy submission, verdict: Runtime Error

W, H, x, y = map(int, input().split())
jufuku = 0
if W / 2 == x and H / 2 == y:
    jufuku = 1
print(W * H / 2, jufuku)


Error: WA

Fixed submission:

W, H, x, y = map(int, input().split())
jufuku = 0
if x == 0 and y == 0:
    if y / x == H / W:
        naname = W * H / 2
        jufuku = 1
        kiri = naname
else:
    # 縦
    tate = min((W - x) * H, x * H)
    # 横
    yoko = min(W * (H - y), W * y)
    if tate == yoko:
        jufuku = 1
    kiri = max(tate, yoko)
print(kiri, jufuku)
Problem p03001 (Python) — buggy submission, verdict: Runtime Error

W, H, x, y = map(int, input().split())
print(W * H / 2, 1 if x != 0 and y != 0 and W / x == 2 and H / y == 2 else 0)


Error: WA

Fixed submission:

W, H, x, y = map(int, input().split())
print(W * H / 2, 1 if W / x == 2 and H / y == 2 else 0)
Problem p03001 (Python) — buggy submission, verdict: Runtime Error

W, H, x, y = map(int, input().split())
if W / 2 == x and H / 2 == y:
    p = 1
else:
    p = 0

print("{} {}".format(W * H / 2, p))


Error: WA

Fixed submission:

W, H, x, y = map(int, input().split())

s = W * H
if W % x == 0 and H % y == 0:
    print("{0} {1}".format(W * H // 2, 1))
else:
    a = W * y
    b = H * x
    p = 1 if a == b else 0
    print("{0} {1}".format(min(a, b), p))
Problem p03003 (Python) — buggy submission, verdict: Time Limit Exceeded

# dp[i][j] SとTの最後の文字を採用するような文字列の個数。これにより各DPテーブルの値が排反になる。元の文字列の最後を必ず採用するので
N, M = map(int, input().split())
S = list(map(int, input().split()))
T = list(map(int, input().split()))
MOD = 10**9 + 7
dp = [[0] * (M + 2) for _ in range(N + 2)]
sdp = [[0] * (M + 2) for _ in range(N + 2)]
dp[0][0] = 1
sdp[1][1] = 1
for i in range(N + 1):
    for j in range(M + 1):
        if i - 1 >= 0 and j - 1 >= 0 and S[i - 1] == T[j - 1]:
            dp[i][j] = sdp[i][j]
        sdp[i + 1][j + 1] = sdp[i + 1][j] + sdp[i][j + 1] - sdp[i][j] + dp[i][j]
        sdp[i + 1][j + 1] %= MOD
        sdp[i + 1][j + 1] %= MOD
print(sdp[N + 1][M + 1])


Error: TLE

Fixed submission:

N, M = map(int, input().split())
S = list(map(int, input().split()))
T = list(map(int, input().split()))
MOD = 10**9 + 7
dp = [[0] * (M + 2) for _ in range(N + 2)]
sdp = [[0] * (M + 2) for _ in range(N + 2)]
dp[0][0] = 1
sdp[1][1] = 1
for i in range(N + 1):
    for j in range(M + 1):
        if i - 1 >= 0 and j - 1 >= 0 and S[i - 1] == T[j - 1]:
            dp[i][j] = sdp[i][j]
        sdp[i + 1][j + 1] = sdp[i + 1][j] + sdp[i][j + 1] - sdp[i][j] + dp[i][j]
        sdp[i + 1][j + 1] %= MOD
        sdp[i + 1][j + 1] %= MOD
print(sdp[N + 1][M + 1])
Problem p03006 (Python) — buggy submission, verdict: Runtime Error

from itertools import permutations
from collections import Counter


n = int(input())
balls = []

for _ in range(n):
    x, y = map(int, input().split())
    balls.append((x, y))

if n == 1:
    print(1)
else:
    counter = Counter()
    for b1, b2 in permutations(balls, 2):
        p, q = b1[0] - b2[0], b1[1] - b2[1]
        counter[(p, q)] += 1

    (p, q), val = counter.most_common(1)[0]
    print(n - val)


Error: 0

Fixed submission:

from itertools import permutations
from collections import Counter


n = int(input())
balls = []

for _ in range(n):
    x, y = map(int, input().split())
    balls.append((x, y))

counter = Counter()
for b1, b2 in permutations(balls, 2):
    p, q = b1[0] - b2[0], b1[1] - b2[1]
    counter[(p, q)] += 1

(p, q), val = counter.most_common(1)[0]
print(n - val)
Problem p03006 (Python) — buggy submission, verdict: Runtime Error

import sys
from collections import Counter

N = int(input())
points = []
for i, line in enumerate(sys.stdin):
    x, y = map(int, line.split())
    points.append([x, y])
    if i == N - 1:
        break
if len(points) == 1:
    print(1)
    sys.exit(0)

counts = []
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        p = points[j][0] - points[i][0]
        q = points[j][1] - points[i][1]
        counts.append((p, q))

pq = Counter(counts).most_common()[0][1]
cost = N - pq
print(cost)


Error: 0

Fixed submission:

import sys
from collections import Counter

N = int(input())
points = []
for i, line in enumerate(sys.stdin):
    x, y = map(int, line.split())
    points.append([x, y])
    if i == N - 1:
        break

counts = []
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        p = points[j][0] - points[i][0]
        q = points[j][1] - points[i][1]
        counts.append((p, q))

pq = Counter(counts).most_common()[0][1]
cost = N - pq
print(cost)
Problem p03006 (Python) — buggy submission, verdict: Runtime Error

# https://atcoder.jp/contests/diverta2019-2/tasks/diverta2019_2_b


from itertools import combinations
from collections import defaultdict

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

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

# points.sort()  # 先にソートしておくと大小関係の処理が楽

cnts = defaultdict(lambda: 0)
for pa, pb in combinations(points, 2):
    dx = pa[0] - pb[0]
    dy = pa[1] - pb[1]
    if dx < 0:  # 事前にソートしておくとココらへんの処理がいらなくなるよ
        dx *= -1
        dy *= -1
    if dx == 0:
        dy = max(dy, -dy)
    if dy == 0:
        dx = max(dx, -dx)
    cnts[(dx, dy)] += 1

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


Error: 0

Fixed submission:

# https://atcoder.jp/contests/diverta2019-2/tasks/diverta2019_2_b
# 問題文はよく読もうね！

# 実際にボールを拾っていくシミュレーションをしていっても十分間に合う

from itertools import combinations
from collections import defaultdict
from operator import itemgetter

N = int(input())
points = [tuple(map(int, input().split())) for _ in range(N)]
ans = 0


def is_online(x0, y0, xa, ya, p, q):
    # x0,y0を通る直線がp,qで与えられたときに、xa,yaがその線上にあるか判別
    dx = xa - x0
    dy = ya - y0
    if dx == 0 and dy == 0:
        return True
    elif dx == 0 or dy == 0:
        return False
    # print(x0, y0, xa, ya, p, q)
    return (dy / dx) == (q / p)  # 傾きが同じならば線上にある


def pickballs(balls):
    # cnt most frequent p,q
    global ans

    # 最適なpq探索
    cnts = defaultdict(lambda: 0)
    for pa, pb in combinations(balls, 2):
        dx = pa[0] - pb[0]
        dy = pa[1] - pb[1]
        if dx == 0 or dy == 0:
            continue
        if dx < 0:
            dx *= -1
            dy *= -1
        cnts[(dx, dy)] += 1
    p, q = max(cnts.items(), key=itemgetter(1))[0]

    # 最適な最初のpickball探索
    cnts = defaultdict(lambda: 0)
    for p0 in balls:
        for p1 in balls:
            if p0 == p1:
                continue
            if is_online(p0[0], p0[1], p1[0], p1[1], p, q):
                cnts[p0] += 1
    x, y = max(cnts.items(), key=itemgetter(1))[0]

    # 実際にpickball
    ans += 1
    ret = []
    for p1 in balls:
        if is_online(x, y, p1[0], p1[1], p, q):
            continue
        ret.append(p1)
    return ret


while points:
    points = pickballs(points)
print(ans)
Problem p03006 (Python) — buggy submission, verdict: Runtime Error

n = int(input())
a = [tuple(map(int, input().split())) for i in range(n)]
t = set(a)
assert len(t) == len(a)
minans = 1000000000000
for i in range(n):
    for j in range(i + 1, n):
        r = t.copy()
        p = a[i][0] - a[j][0]
        q = a[i][1] - a[j][1]
        curans = 0
        while r:
            curans += 1
            m = r.pop()
            z = m
            while (m[0] + p, m[1] + q) in r:
                m = (m[0] + p, m[1] + q)
                r.remove(m)
            m = z
            while (m[0] - p, m[1] - q) in r:
                m = (m[0] - p, m[1] - q)
                r.remove(m)
        minans = min(minans, curans)
if minans == 1000000000000:
    print(1)
else:
    print(minans)


Error: AttributeError: 'tuple' object has no attribute 'copy'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03006/Python/s146476051.py", line 14, in <module>
    z = m.copy()
AttributeError: 'tuple' object has no attribute 'copy'


Fixed submission:

n = int(input())
a = [tuple(map(int, input().split())) for i in range(n)]
t = set(a)
minans = 1000000000000
for i in range(n):
    for j in range(i + 1, n):
        r = t.copy()
        p = a[i][0] - a[j][0]
        q = a[i][1] - a[j][1]
        curans = 0
        while r:
            curans += 1
            m = r.pop()
            z = m.copy()
            while (m[0] + p, m[1] + q) in r:
                m = (m[0] + p, m[1] + q)
                r.remove(m)
            m = z.copy()
            while (m[0] - p, m[1] - q) in r:
                m = (m[0] - p, m[1] - q)
                r.remove(m)
        minans = min(minans, curans)
print(minans)
Problem p03006 (Python) — buggy submission, verdict: Runtime Error

import collections


def calc(balla, ballb):
    xa, ya = balla
    xb, yb = ballb
    return xa - xb, ya - yb


n = int(input())
balls = [tuple(map(int, input().split())) for _ in range(n)]

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

a = []
for i in range(0, n - 1):
    for j in range(i + 1, n):
        tmp = calc(balls[i], balls[j])
        a += [tmp, tuple(-i for i in tmp)]
counts = collections.Counter(a)

print(n - max(counts.values()))


Error: 0

Fixed submission:

import collections


def calc(balla, ballb):
    xa, ya = balla
    xb, yb = ballb
    return xa - xb, ya - yb


n = int(input())
balls = [tuple(map(int, input().split())) for _ in range(n)]

a = []
for i in range(0, n - 1):
    for j in range(i + 1, n):
        tmp = calc(balls[i], balls[j])
        a += [tmp, tuple(-i for i in tmp)]
counts = collections.Counter(a)

print(n - max(counts.values()))
Problem p03006 (Python) — buggy submission, verdict: Runtime Error

n = int(input())
xy = set(tuple(map(int, input().split())) for _ in range(n))

costs = []
for a in xy:
    besides_a = xy - {a}
    for b in besides_a:
        p = b[0] - a[0]
        q = b[1] - a[1]
        arrow_num = 0
        for c in xy:
            if (c[0] + p, c[1] + q) in xy:
                arrow_num += 1
        cost = n - arrow_num
        costs.append(cost)

if n == 1:
    print(1)
else:
    print(min(costs))


Error: 0

Fixed submission:

n = int(input())
xy = set(tuple(map(int, input().split())) for _ in range(n))

costs = []
for a in xy:
    besides_a = xy - {a}
    for b in besides_a:
        p = b[0] - a[0]
        q = b[1] - a[1]
        arrow_num = 0
        for c in xy:
            if (c[0] + p, c[1] + q) in xy:
                arrow_num += 1
        cost = n - arrow_num
        costs.append(cost)

print(min(costs))
Problem p03006 (Python) — buggy submission, verdict: Runtime Error

from collections import Counter


def main():
    N = int(input())
    points = [tuple(map(int, input().split())) for _ in range(N)]
    counter = Counter()

    if N == 1:
        print(1)
        return

    for i in range(N):
        for j in range(N):
            if j == i:
                continue
            a = points[i]
            b = points[j]
            dx = b[0] - a[0]
            dy = b[1] - a[1]
            counter[(dx, dy)] += 1

    vec, _ = counter.most_common()[0]
    dx, dy = vec
    visited = set()
    pointset = set(points)
    cost = 0

    for p in points:
        if p in visited:
            continue
        visited.add(p)
        x, y = p
        cost += 1

        i = 1
        while True:
            n = (x + i * dx, y + i * dy)
            i += 1
            if n in pointset:
                visited.add(n)
            else:
                break
        i = 1
        while True:
            n = (x - i * dx, y - i * dy)
            i += 1
            if n in pointset:
                visited.add(n)
            else:
                break

    print(cost)


main()


Error: 0

Fixed submission:

from collections import Counter

N = int(input())
points = [tuple(map(int, input().split())) for _ in range(N)]
counter = Counter()

for i, a in enumerate(points):
    for j in range(N):
        if j == i:
            continue
        b = points[j]
        dx = b[0] - a[0]
        dy = b[1] - a[1]
        counter[(dx, dy)] += 1

vec, _ = counter.most_common()[0]
dx, dy = vec
visited = set()
cost = 0

for p in points:
    if p in visited:
        continue
    x, y = p
    visited.add(p)
    if (x + dx, y + dy) in visited or (x - dx, y - dy) in visited:
        continue
    cost += 1

print(cost)
Problem p03006 (Python) — buggy submission, verdict: Runtime Error

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

    d = {}
    for i in range(N):
        tmp = set()
        for j in range(N):
            if i == j:
                continue
            dx = xy[i][0] - xy[j][0]
            dy = xy[i][1] - xy[j][1]

            if (dx, dy) in tmp:
                continue
            if (dx, dy) not in d:
                d[(dx, dy)] = 1
            else:
                d[(dx, dy)] += 1
            tmp.add((dx, dy))

    d = sorted(d.items(), key=lambda x: x[1], reverse=True)
    cnt = d[0][1]
    print(N - cnt)


main()


Error: 0

Fixed submission:

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

d = {}
for i in range(N):
    tmp = set()
    for j in range(N):
        if i == j:
            continue
        dx = xy[i][0] - xy[j][0]
        dy = xy[i][1] - xy[j][1]

        if (dx, dy) in tmp:
            continue
        if (dx, dy) not in d:
            d[(dx, dy)] = 1
        else:
            d[(dx, dy)] += 1
        tmp.add((dx, dy))

d = sorted(d.items(), key=lambda x: x[1], reverse=True)
cnt = d[0][1]
print(N - cnt)
Problem p03006 (Python) — buggy submission, verdict: Runtime Error

from itertools import combinations

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

memo = dict()
for (a, b) in combinations(P, 2):
    p, q = a[0] - b[0], a[1] - b[1]
    if p < 0:
        p, q = -p, -q
    elif p == 0 and q < 0:
        q = -q
    if (p, q) in memo:
        memo[(p, q)] += 1
    else:
        memo[(p, q)] = 1

print(N - max(memo.values()) if N > 1 else 1)


Error: 0

Fixed submission:

from itertools import combinations

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

memo = dict()
for (a, b) in combinations(P, 2):
    p, q = a[0] - b[0], a[1] - b[1]
    if p < 0:
        p, q = -p, -q
    elif p == 0 and q < 0:
        q = -q
    if (p, q) in memo:
        memo[(p, q)] += 1
    else:
        memo[(p, q)] = 1

print(N - max(memo.values()))
Problem p03006 (Python) — buggy submission, verdict: Runtime Error

from collections import Counter


class PickingUp:
    def __init__(self):
        self.N = int(input())
        self.points = []
        for n in range(self.N):
            self.points.append([int(n) for n in input().split()])

    def main(self):
        dif_list = []

        if self.N == 1:
            print(1)
            return

        for s in range(self.N):
            for e in range(self.N):
                if s == e:
                    continue
                dif = self.__cal_dif(self.points[s], self.points[e])
                dif_list.append("{},{}".format(dif[0], dif[1]))

        c = Counter(dif_list)
        most = c.most_common()[0][1]

        print(self.N - most)

    def __cal_dif(self, s, e):
        dif_x = s[0] - e[0]
        dif_y = s[1] - e[1]
        return [dif_x, dif_y]


pickingUp = PickingUp()
pickingUp.main()


Error: 0

Fixed submission:

from fractions import Fraction
from collections import Counter


class PickingUp:
    def __init__(self):
        self.N = int(input())
        self.points = []
        for n in range(self.N):
            self.points.append([int(n) for n in input().split()])

    def main(self):
        pattern_list = []
        slope_list = []
        for s in range(self.N):
            for e in range(s + 1, self.N):
                slope = self.__cal_slope(self.points[s], self.points[e])
                slope_list.append(slope)

        c = Counter(slope_list)
        most = c.most_common()[0][1]

        if self.N == 1:
            pattern_list.append(1)
        else:
            print(self.N - most)

    def __cal_slope(self, s, e):
        if s[0] != e[0]:
            return Fraction((s[1] - e[1]), (s[0] - e[0]))
        else:
            return None

    def __cal_section(self, slope, point):
        if slope is not None:
            return point[1] - slope * point[0]
        else:
            return point[0]


pickingUp = PickingUp()
pickingUp.main()