Buggy python submission (verdict: Runtime Error):
def get_sum(n, index, s, slist):
    if index == n:
        if s % 10 == 0:
            s = 0
        return s
    left = get_sum(n, index + 1, s + slist[index], slist)
    right = get_sum(n, index + 1, s, slist)
    return max(left, right)


N = int(input())
sl = []
for n in range(N):
    sl.append(int(input()))

sum = sum(sl)
sorted_sl = sorted(filter(lambda s: s % 10 == 0,sl))
if len(sorted_sl) == 0:
    print(0)
    exit()
count = 0
while sum % 10 == 0 and count < N:
    sum -= sorted_sl[count]
    count += 1

print(sum)

Fixed submission:
N = int(input())
sl = []
for n in range(N):
    sl.append(int(input()))

sum = sum(sl)
sorted_sl = sorted(filter(lambda s: s % 10 != 0,sl))
if len(sorted_sl) == 0:
    print(0)
    exit()
count = 0
while sum % 10 == 0 and count < len(sorted_sl):
    sum -= sorted_sl[count]
    count += 1

print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
def get_sum(n, index, s, slist):
    if index == n:
        if s % 10 == 0:
            s = 0
        return s
    left = get_sum(n, index + 1, s + slist[index], slist)
    right = get_sum(n, index + 1, s, slist)
    return max(left, right)


N = int(input())
sl = []
for n in range(N):
    sl.append(int(input()))

sum = 0
index = 0
for s in sorted(sl)[::-1]:
    if (sum + s) % 10 == 0:
        break
    sum += s
    index += 1

print(get_sum(N, index, sum, sl))

Fixed submission:
N = int(input())
sl = []
for n in range(N):
    sl.append(int(input()))

sum = sum(sl)
sorted_sl = sorted(filter(lambda s: s % 10 != 0,sl))
if len(sorted_sl) == 0:
    print(0)
    exit()
count = 0
while sum % 10 == 0 and count < len(sorted_sl):
    sum -= sorted_sl[count]
    count += 1

print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
def get_sum(n, index, s, slist):
    if index == n:
        if s % 10 == 0:
            s = 0
        return s
    left = get_sum(n, index + 1, s + slist[index], slist)
    right = get_sum(n, index + 1, s, slist)
    return max(left, right)


N = int(input())
sl = []
for n in range(N):
    sl.append(int(input()))

sum = 0
index = 0
for s in sl[::-1]:
    if (sum + s) % 10 == 0:
        break
    sum += s
    index += 1

print(get_sum(N, index, sum, sl))

Fixed submission:
N = int(input())
sl = []
for n in range(N):
    sl.append(int(input()))

sum = sum(sl)
sorted_sl = sorted(filter(lambda s: s % 10 != 0,sl))
if len(sorted_sl) == 0:
    print(0)
    exit()
count = 0
while sum % 10 == 0 and count < len(sorted_sl):
    sum -= sorted_sl[count]
    count += 1

print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
def get_sum(n, index, s, slist):
    if index == n:
        if s % 10 == 0:
            s = 0
        return s
    left = get_sum(n, index + 1, s + slist[index], slist)
    right = get_sum(n, index + 1, s, slist)
    return max(left, right)


N = int(input())
sl = []
for n in range(N):
    sl.append(int(input()))

sum = 0
print(get_sum(N, 0, sum, sl))


Fixed submission:
N = int(input())
sl = []
for n in range(N):
    sl.append(int(input()))

sum = sum(sl)
sorted_sl = sorted(filter(lambda s: s % 10 != 0,sl))
if len(sorted_sl) == 0:
    print(0)
    exit()
count = 0
while sum % 10 == 0 and count < len(sorted_sl):
    sum -= sorted_sl[count]
    count += 1

print(sum)