Problem p03006 (python)

Fixed submission:
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()

Buggy submission (verdict: Runtime Error):
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()

Buggy submission (verdict: Runtime Error):
from math import Fraction


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 = []
        for s in range(self.N):
            section_list = []
            for e in range(s + 1, self.N):
                slope = self.__cal_slope(self.points[s], self.points[e])
                for i in range(self.N):
                    section = self.__cal_section(slope, self.points[i])
                    if section not in section_list:
                        section_list.append(section)
                pattern_list.append(len(section_list))

        print(min(pattern_list))

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

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


pickingUp = PickingUp()
pickingUp.main()

Buggy submission (verdict: Runtime Error):
from fractions import Fraction


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 = []
        for s in range(self.N):
            section_list = []
            for e in range(s + 1, self.N):
                slope = self.__cal_slope(self.points[s], self.points[e])
                for i in range(self.N):
                    section = self.__cal_section(slope, self.points[i])
                    if section not in section_list:
                        section_list.append(section)
                pattern_list.append(len(section_list))

        print(min(pattern_list))

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

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


pickingUp = PickingUp()
pickingUp.main()