Buggy python submission (verdict: Runtime Error):
    sum_ = sum(s)
    if (sum_ % 10) != 0:
        return sum_
    else:
        st = sorted(s)
        m = 0
        for i in range(len(st)):
            s2 = sum(s[:i-1]+s[i+1:])
            if (s2 % 10) != 0:
                return s2

        for i in range(len(st)):
            s2 = sum(s[:i-1]+s[i+2:])
            if (s2 % 10) != 0:
                return s2
    return 0

N = int(input())
a = [int(input()) for i in range(N)]
print(max_of(a)) # [a1, a2, a3, ..., aN]



Fixed submission:
import sys

def gen_list(lst):
    length = len(lst)
    dp = [{}] * length
    dp[0] = {lst[0]: True}
    dp[0][0] = True

    # s[i]までで出る数字
    for i in range(1, length):
        s = lst[i]
        dp[i] = dp[i-1]
        keys = [k for k in dp[i].keys()]
        for val in keys:
            dp[i][val + s] = True
    
    return sorted(dp[length-1].keys(), reverse=True)

N = int(input())
s = [int(input()) for _ in range(N)]

for m in gen_list(s):
    if m % 10 != 0:
        print(m)
        sys.exit()

print('0')

Buggy python submission (verdict: Runtime Error):
import sys

import math


class Solution(object):
    def __init__(self):
        self.N, self.A, self.B = map(int, sys.stdin.readline().split(' '))
        self.h = []
        for _ in range(self.N):
            self.h.append(int(sys.stdin.readline()))
        self.extra_damage = self.A - self.B

    def solve(self):
        max_h = max(self.h)
        at_most = int(max_h / self.B) + 1
        at_least = int(max_h / self.A) + 1
        result = self.binary_search_lowest_kaisu(at_least, at_most)
        print(result)

    def binary_search_lowest_kaisu(self, low, high):
        if low == high:
            return low
        mid = low + (high - low) // 2
        if self.enough(mid):
            return self.binary_search_lowest_kaisu(low, mid)
        else:
            return self.binary_search_lowest_kaisu(mid + 1, high)

    def enough(self, kaisu):
        hps_remain = []
        for x in self.h:
            hp_remain = x - kaisu * self.B
            if hp_remain > 0:
                hps_remain.append(hp_remain)
        counter = 0
        for hp_remain in hps_remain:
            counter += math.ceil(hp_remain / self.extra_damage)
            if counter > kaisu:
                return False
        return True

Solution().solve()


Fixed submission:
import sys


class Solution(object):
    def __init__(self):
        self.N = int(sys.stdin.readline())
        self.s = []
        for _ in range(self.N):
            self.s.append(int(sys.stdin.readline()))

    # def solve(self):
    def naive_solve(self):
        sums = [0]
        for num in self.s:
            sums.extend([s + num for s in sums])
        for r in sorted(sums, reverse=True):
            if r % 10:
                return r
        return 0

    def answer_solve(self):
        S = sum(self.s)
        if S % 10:
            return S
        smallest = float('inf')
        for num in self.s:
            if num % 10:
                smallest = min(smallest, num)
        if smallest != float('inf'):
            return S - smallest
        return 0




print(Solution().answer_solve())

Buggy python submission (verdict: Time Limit Exceeded):
import sys

def solve():
    N = int(sys.stdin.readline())
    s = []
    for _ in range(N):
        s.append(int(sys.stdin.readline()))
    sums = [0]
    for num in s:
        sums = sums + [s + num for s in sums]
    for r in sorted(sums, reverse=True):
        if r % 10:
            return r
    return 0

print(solve())

Fixed submission:
import sys


class Solution(object):
    def __init__(self):
        self.N = int(sys.stdin.readline())
        self.s = []
        for _ in range(self.N):
            self.s.append(int(sys.stdin.readline()))

    # def solve(self):
    def naive_solve(self):
        sums = [0]
        for num in self.s:
            sums.extend([s + num for s in sums])
        for r in sorted(sums, reverse=True):
            if r % 10:
                return r
        return 0

    def answer_solve(self):
        S = sum(self.s)
        if S % 10:
            return S
        smallest = float('inf')
        for num in self.s:
            if num % 10:
                smallest = min(smallest, num)
        if smallest != float('inf'):
            return S - smallest
        return 0




print(Solution().answer_solve())