qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n = int(input())
s = []
grade = 0
for i in range(n):
    si = int(input())
    s.append(si)
    grade += si
if grade % 10 != 0:
    print(grade)
else:
    s.sort()
    for i in range(n):
        if s[i] % 10 != 0:
            grade -= s[i]
            break
if grade %10 != 0:
    print(grade)
else:
    print(0)


Fixed code:
n = int(input())
s = []
grade = 0
for i in range(n):
    si = int(input())
    s.append(si)
    grade += si
if grade % 10 != 0:
    print(grade)
else:
    s.sort()
    for i in range(n):
        if s[i] % 10 != 0:
            grade -= s[i]
            break
    if grade %10 != 0:
        print(grade)
    else:
        print(0)
Buggy code:
N=int(input())
s_n=[int(input()) for i in range(N)]

ans=sum(s_n)
while ans%10==0:
    ans-=min(s_n)
    if ans%10==0:
        ans+=min(s_n)
        s_n.remove(min(s_n))


print(ans)

Fixed code:
N=int(input())
s_n=[int(input()) for i in range(N)]

ans=sum(s_n)
while ans%10==0:
    if s_n==[]:
        ans=0
        break
    ans-=min(s_n)
    if ans%10==0:
        ans+=min(s_n)
        s_n.remove(min(s_n))


print(ans)
Buggy code:
n = int(input())
ans = []
for i in range(n):
  ans.append(int(input()))
nm = 0
for i in ans:
  if i %10 != 0:
    nm = i
    print(i)
    break
if sum(ans) % 10 != 0:
  print(sum(ans))
elif nm !=0:
  print(sum(ans)-i)
else:
  print(0)

Fixed code:
n = int(input())
ans = []
for i in range(n):
  ans.append(int(input()))
nm = 0
ans.sort()
for i in ans:
  if i %10 != 0:
    nm = i
    break
if sum(ans) % 10 != 0:
  print(sum(ans))
elif nm !=0:
  print(sum(ans)-i)
else:
  print(0)
Buggy code:
N = int(input())
a = [int(input()) for i in range(N)]

a.sort()
ans = sum(a)

S = [ans - i for i in a]
maxtenga = 0

for i in range(len(S)):
    if S[i] % 10 != 0:
        maxtenga = S[i]

flag = False
for i in range(len(a)):
    if a[i] % 10 != 0:
        flag = True

if ans % 10 != 0:
    print(ans)
elif flag is False:
    print(0)
else:
    print(maxtenga)

Fixed code:
N = int(input())
a = [int(input()) for i in range(N)]

a.sort()
ans = sum(a)

S = [ans - i for i in a]
maxtenga = 0

for i in range(len(S)):
    if S[i] % 10 != 0:
        maxtenga = S[i]
        break

flag = False
for i in range(len(a)):
    if a[i] % 10 != 0:
        flag = True

if ans % 10 != 0:
    print(ans)
elif flag is False:
    print(0)
else:
    print(maxtenga)
Buggy code:
n = int(input())

a = list(int(input()) for i in range(n))
a = sorted(a)
A = sum(a)
if A%10!=0:
  print(A)
else:
  for i in range(n):
    if(A-a[i])%10!=0:
      print(A-a[i])
      exit()
print(0)

Fixed code:
n = int(input())

a = list(int(input()) for i in range(n))
a = sorted(a)
A = sum(a)
if A%10!=0:
  print(A)
else:
  for i in range(n):
    if(A-a[i])%10!=0:
      print(A-a[i])
      exit()
  print(0)
Buggy code:
n = int(input())
li = []
for i in range(n):
    li.append(int(input()))
li.sort()
flag1 = False
flag2 = False
flag3 = False
for i in range(n):    
    if (sum(li) - li[i])%10 != 0:
        flag1 = True
        break
    elif sum(li)%10 != 0:
        flag2 = True
        break
    else:
        flag3 =True    
if flag1:
    print (sum(li) - li[i])
elif flag2:   
    print(sum(li))
elif flag3:
    print(0)

Fixed code:
n = int(input())
li = []
for i in range(n):
    li.append(int(input()))
li.sort()
flag1 = False
flag2 = False
flag3 = False
if sum(li)%10 != 0:
    flag2 = True

for i in range(n):
    if (sum(li) - li[i])%10 != 0 and flag2 == False:
        flag1 = True
        break
    else:
        flag3 =True
    
if flag1:
    print (sum(li) - li[i])
elif flag2:   
    print(sum(li))
elif flag3:
    print(0)
Buggy code:
n = int(input())
a = [int(input()) for i in range(n)]

res = sum(a)
if res%10 !=0:
    print(res)
    exit()

b = sorted(list(filter(lambda x:x%10!=0, a)))
if len(b) == 0:
    print(0)
    exit()
print(b)
print(res-b[0])


Fixed code:
n = int(input())
a = [int(input()) for i in range(n)]

res = sum(a)
if res%10 !=0:
    print(res)
    exit()

b = sorted(list(filter(lambda x:x%10!=0, a)))
if len(b) == 0:
    print(0)
    exit()
print(res-b[0])
Buggy code:
# Bugged

n = int(input())
s = []
for i in range(n):
    s.append(int(input()))

a = []
for ss in s:
    if ( ss%10!=0 ):
        a.append(ss)
if ( len(a)==0 ):
    print(0)
else:
    print(sum(s)-min(a))  

Fixed code:
# Bugged

n = int(input())
s = []
for i in range(n):
    s.append(int(input()))

a = []
for ss in s:
    if ( ss%10!=0 ):
        a.append(ss)
ssum = sum(s)
if ( ssum%10!=0 ):
    print(ssum)
else:
    if ( len(a)==0 ):
        print(0)
    else:
        print(ssum-min(a))
Buggy code:
# coding = SJIS

n = int(input())
s = []
for i in range(n):
    s.append(int(input()))

s.sort()

for i in s:
    if i % 10 != 0:
        print(sum(s) - i)
        exit()

print(0)

Fixed code:
# coding = SJIS

n = int(input())
s = []
for i in range(n):
    s.append(int(input()))

s.sort()

if sum(s) % 10 != 0:
    print(sum(s))
    exit()
else:
    for i in s:
        if i % 10 != 0:
            print(sum(s) - i)
            exit()

print(0)
Buggy code:
N = int(input())
s = [int(input()) for _ in range(N)]
s.sort()
sums = sum(s)

if sums % 10 != 0:
    print(sums)
else:
    for p in s:
        if p % 10 != 0:
            print(sums - p)
    else:
        print(0)

Fixed code:
N = int(input())
s = [int(input()) for _ in range(N)]
s.sort()
sums = sum(s)

if sums % 10 != 0:
    print(sums)
else:
    for p in s:
        if p % 10 != 0:
            print(sums - p)
            break
    else:
        print(0)
Buggy code:
n=int(input())
S=sorted([int(input()) for i in range(n)])
not_10=[i for i in S if i%10!=0]
sums=sum(S)
if sums%10!=0:
  print(sums)
else:
  print(sums-not_10[0])

Fixed code:
n=int(input())
S=sorted([int(input()) for i in range(n)])
not_10=[i for i in S if i%10!=0]
sums=sum(S)
if sums%10!=0:
  print(sums)
else:
  print(sums-not_10[0] if not_10 else 0)
Buggy code:
n = int(input())
s = [0] * n
for i in range(0,n):
    s[i] = int(input())

#print(s)

l0 = []
l1 = []
for i in range(0,n):
    if s[i] % 10 == 0:
        l1.append(s[i])
    else:
        l0.append(s[i])

#print(l)

w = sum(s)

if w % 10 != 0:
    ans = w

elif l[0] == []:
    ans = 0

else:

    l0.sort
    
    #print(l)
    
    ans = w - l0[0]

print(ans)

Fixed code:
n = int(input())
s = [0] * n
for i in range(0,n):
    s[i] = int(input())

#print(s)

l0 = []
l1 = []
for i in range(0,n):
    if s[i] % 10 == 0:
        l1.append(s[i])
    else:
        l0.append(s[i])

#print(l)

w = sum(s)

if w % 10 != 0:
    ans = w

elif l0 == []:
    ans = 0

else:

    l0.sort()
    
    #print(l)
    
    ans = w - l0[0]

print(ans)
Buggy code:
import sys
N = int(input())
S = [int(input()) for _ in range(N)]
S.sort()
t = sum(S)
if t % 10 != 0:
    print(t)
    sys.exit()

for s in range(S):
    if (t - s) % 10 != 0:
        print(t - s)
        sys.exit()
print(0)


Fixed code:
import sys
N = int(input())
S = [int(input()) for _ in range(N)]
S.sort()
t = sum(S)
if t % 10 != 0:
    print(t)
    sys.exit()

for s in S:
    if (t - s) % 10 != 0:
        print(t - s)
        sys.exit()
print(0)
Buggy code:
n = int(input())
s = [int(input()) for _ in range(n)]

sumNum = sum(s)
if sumNum % 10 != 0:
  print(sumNum)
  exit()

t = 0
for i in s:
  if (sumNum - i)%10 != 0:
    t = max(t, sum-i)
print(t)

Fixed code:
n = int(input())
s = [int(input()) for _ in range(n)]

sumNum = sum(s)
if sumNum % 10 != 0:
  print(sumNum)
  exit()

t = 0
for i in s:
  if (sumNum - i)%10 != 0:
    t = max(t, sumNum-i)
print(t)
Buggy code:
N = int(input())
h = [int(input()) for _ in range(N)]
ans = sum(h)
if ans%10!=0:
    print(ans)
else:
    s = [i for i in s if s%10]
    print(ans - min(s))


Fixed code:
N = int(input())
h = [int(input()) for _ in range(N)]
ans = sum(h)
if ans%10!=0:
    print(ans)
else:
    s = [i for i in h if i%10]
    print(ans - min(s) if len(s) else 0)
Buggy code:
N = int(input())
S = []
for i in range(N):
    S.append(int(input()))
S.append(0)
Sum = sum(S)
S.sort()

for i in range(len(S)):
    if (Sum-S[i])%10!=0:
        print(Sum-S[i])
        exit()


Fixed code:
N = int(input())
S = []
for i in range(N):
    S.append(int(input()))

Sum = sum(S)
S.sort()

for i in range(len(S)):
    if (Sum)%10!=0:
        print(Sum)
        exit()
    else:
        if S[i]%10!=0:
            Sum -=S[i]
print(0)
Buggy code:
def solve():
    N = int(input())
    a = sorted([int(input()) for _ in range(N)])

    s = sum(a)

    if s % 10 != 0:
        return s

    for x in a:
        if (s-x)%10 != 0:
            print(x)
            return s - x
    return 0


def main():
    print(solve())


if __name__ == '__main__':
    main()

Fixed code:
def solve():
    N = int(input())
    a = sorted([int(input()) for _ in range(N)])

    s = sum(a)

    if s % 10 != 0:
        return s

    for x in a:
        if (s-x)%10 != 0:
            return s - x
    return 0


def main():
    print(solve())


if __name__ == '__main__':
    main()
Buggy code:
n  = int(input())
s = [int(input()) for i in range(n)]

s.sort()
ans = sum(s)
if (ans % 10 != 0):
    print(ans)
else:
    for i in s:
        if (i % 10 != 0):
            print(ans - i)
            break
    print(0)

Fixed code:
N=int(input())
s=[int(input()) for i in range(N)]
ans=sum(s)
s.sort()
if ans%10!=0:
    print(ans)
else:
    for i in range(N):
        if(ans-s[i])%10!=0:
            ans-=s[i]
            break
    if ans%10==0:
        print(0)
    else:
        print(ans)
Buggy code:
n = int(input())
s = sorted([int(input()) for _ in range(n)])

grade = 0 if sum(s) % 10 == 0 else (sum(s))
print(grade)

if grade == 0:
    for i in s:
        if i % 10 != 0:
            print(sum(s) - i)
            exit()

print(grade)


Fixed code:
n = int(input())
s = sorted([int(input()) for _ in range(n)])

grade = 0 if sum(s) % 10 == 0 else (sum(s))

if grade == 0:
    for i in s:
        if i % 10 != 0:
            print(sum(s) - i)
            exit()

print(grade)
Buggy code:
N = int(input())
S = []
for _ in range(N):
    S.append(int(input()))
S.sort(reverse=True)   

for _ in range(len(S)):
    total = sum(S)
    if total % 10 == 0:
        total -= S.pop()
    if total % 10 != 0:
        print(total)
        break

Fixed code:
N = int(input())
S = []
for _ in range(N):
    S.append(int(input()))
S.sort(reverse=True)   
AAA = sum(S)
for _ in range(len(S)):
    total = AAA
    if total % 10 == 0:
        total -= S.pop()
    if total % 10 != 0:
        print(total)
        break
else:
    print(0)
Buggy code:
import sys
N = int(input())
S = []
for _ in range(N):
    S.append(int(input()))
S.sort()
ans = sum(S)
if ans % 10 != 0:
    print(ans)
    sys.exit()
for i in S:
    if i % 10 != 0:
        ans -= i
        print(ans)
        break

Fixed code:
import sys
N = int(input())
S = []
for _ in range(N):
    S.append(int(input()))
S.sort()
ans = sum(S)
if ans % 10 != 0:
    print(ans)
    sys.exit()
for i in S:
    if i % 10 != 0:
        ans -= i
        print(ans)
        sys.exit()
print(0)
Buggy code:
n=int(input())
s=[int(input()) for i in range(n)]

li=[]
for i in s:
    if i%10!=0:
        li.append(i)
        
li.sort()

if len(li)>0:
    print(sum(s)-li[0])
else:
    print(0)

Fixed code:
n=int(input())
s=[int(input()) for i in range(n)]

li=[]
for i in s:
    if i%10!=0:
        li.append(i)
        
li.sort()

if n==1:
    print(0 if s[0]%10==0 else li[0])
elif len(li)>0:
    print(sum(s)-li[0] if sum(s)%10==0 else sum(s))
else:
    print(0)
Buggy code:
n = int(input())
a = [int(input()) for _ in range(n)]

sum_a = sum(a)

if sum_a % 10 == 0:
	can_nums = filter(lambda x: x%10 != 0, set(a))
	if len(list(can_nums)) == 0:
		print(0)
	else:
		print(sum_a - min(can_nums))
else:
	print(sum_a)

Fixed code:
n = int(input())
a = [int(input()) for _ in range(n)]

sum_a = sum(a)

if sum_a % 10 == 0:
	can_nums = list(filter(lambda x: x%10 != 0, set(a)))
	if len(can_nums) == 0:
		print(0)
	else:
		print(sum_a - min(can_nums))
else:
	print(sum_a)
Buggy code:
n=int(input())
tens=[]
others=[]
for i in range(n):
    s=int(input())
    if s%10==0:
        tens.append(s)
    else:
        others.append(s)
tens.sort(reverse=True)
others.sort(reverse=True)

score=sum(tens)+sum(others)
if score%10==0:
    print(score-min(others))
else:
    print(score)

Fixed code:
n=int(input())
tens=[]
others=[]
for i in range(n):
    s=int(input())
    if s%10==0:
        tens.append(s)
    else:
        others.append(s)
tens.sort(reverse=True)
others.sort(reverse=True)

score=sum(tens)+sum(others)
if score%10==0:
    if len(others)!=0:
        print(score-min(others))
    else:
        print(0)
else:
    print(score)
Buggy code:
#16
n = int(input())
s = [int(input()) for i in range(n)]

Max = sum(s)
s.sort()

if Max%10 ==0:
    for i in range(n):
        if i%1 != 0:
            Max -= s[i]
        if Max%10 !=0:
            break
    
    
print(Max)

Fixed code:
#16
n = int(input())
s = [int(input()) for i in range(n)]

Max = sum(s)
s.sort()

if Max%10 ==0:
    for i in range(n):
        if s[i]%10 != 0:
            Max -= s[i]
        if Max%10 !=0:
            break
if Max%10 == 0:
    Max = 0
    
print(Max)
Buggy code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9 + 7

n = int(input())
li = [int(input()) for i in range(n)]
sumli = sum(li)
li.sort()
ans = 0
for i in range(len(li)):
    d = sumli - li[i]
    if d%10 != 0:
        ans = max(ans,d)
    else:
        d = 0
        ans = max(ans,d)
print(ans)

Fixed code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9 + 7

n = int(input())
li = [int(input()) for i in range(n)]
li.sort()
sumli = sum(li)
if sumli%10 != 0:
    print(sumli)
else:
    ans = 0
    for i in range(n):
        d = sumli - li[i]
        if d%10 != 0:
            ans = max(ans,d)
    print(ans)
Buggy code:
import itertools

DIM = int(input())
args = [int(input()) for a in range(DIM)]
i = DIM
while(i>0):
    comb = list(itertools.combinations(args, DIM))
    combMax = list(map(sum, comb))
    for c in sorted(combMax, reverse=True):
        if c%10==0:
            continue
        else:
            print(c)
            exit()
    i = i -1
print(0)
exit()

Fixed code:
import itertools

DIM = int(input())
args = [int(input()) for a in range(DIM)]
temp = list(map(lambda x:x%10, args))
if sum(temp) == 0:
    print(0)
    exit()
i = DIM
while(i>0):
    comb = list(itertools.combinations(args, i))
    combMax = list(map(sum, comb))
    for c in sorted(combMax, reverse=True):
        if c%10==0:
            continue
        else:
            print(c)
            exit()
    i = i -1
print(0)
exit()
Buggy code:
N = int(input())
S = sorted([int(input()) for _ in range(N)])
s = sum(S)
if s % 10 != 0:
    print(s)
    exit()

for si in range(S):
    if si % 10 != 0:
        print(s - si)
        exit()

print(0)


Fixed code:
N = int(input())
S = sorted([int(input()) for _ in range(N)])
s = sum(S)
if s % 10 != 0:
    print(s)
    exit()

for si in S:
    if si % 10 != 0:
        print(s - si)
        exit()

print(0)
Buggy code:
# Problem C - Bugged

# input
N = int(input())

# initialization
max_score = 0
score_list = []
for i in range(N):
    tmp = int(input())
    score_list.append(tmp)
score_list = sorted(score_list, reverse=True)

# score update
min_score = 10**4 + 1
for score in score_list:
    max_score += score
    if tmp%10!=0 and min_score>score:
        min_score = score

# output
ans = 0
if max_score%10==0:
    ans = max(0, max_score-min_score)
print(ans)


Fixed code:
# Problem C - Bugged

# input
N = int(input())

# initialization
max_score = 0
score_list = []
for i in range(N):
    tmp = int(input())
    score_list.append(tmp)
score_list = sorted(score_list, reverse=True)

# score update
min_score = 10**4 + 1
for score in score_list:
    max_score += score
    if score%10!=0 and min_score>score:
        min_score = score

# output
ans = max_score
if max_score%10==0:
    ans = max(0, max_score-min_score)
print(ans)
Buggy code:
N=int(input())
S=[]
table=[2**i for i in range(7)]

for i in range(N):
    s=int(input())
    S.append(s)

a=sum(S)

if a%10 !=0:
    print(a)
else:
    for i in range(N):
        if S[i]%10 !=0:
            a=a-int(S[i])
            print(a)
            break

Fixed code:
N=int(input())
S=[]
table=[2**i for i in range(7)]

for i in range(N):
    s=int(input())
    S.append(s)
S.sort()
a=sum(S)

if a%10 !=0:
    print(a)
else:
    for i in range(N):
        if S[i]%10 !=0:
            a=a-int(S[i])
            print(a)
            break
    else:
        print(0)
Buggy code:
n=int(input())
a =[]
for i in range(n):
    a.append(int(input()))

a.sort(reverse=True)
s=sum(a)
if s%10==0:
    for i in a:
        if i%10>0:
            s-=i
            break
if s%10>0:
    print(s)
else:
    print(0)



Fixed code:
n=int(input())
a =[]
for i in range(n):
    a.append(int(input()))
 
a.sort()
s=sum(a)
if s%10==0:
    for i in a:
        if i%10>0:
            s-=i
            break
if s%10>0:
    print(s)
else:
    print(0)
Buggy code:
n = int(input())
s = [int(input()) for _ in range(n)]
s.sort()
ans = sum(s)
i = 0
if ans%10 == 0:
    for c in s:
        if c%10 != 0:
            ans-=c
            break
print(ans)


Fixed code:
n = int(input())
s = [int(input()) for _ in range(n)]
s.sort()
ans = sum(s)
i = 0
if ans%10 == 0:
    for c in s:
        if c%10 != 0:
            ans-=c
            break

if ans%10 == 0:
    ans = 0    
print(ans)
Buggy code:
n=int(input())
s=[]
for i in range(n):
  h=int(input())
  s.append(h)
s.sort()
d=sum(s)
ss=d
if d%10!=0:
  print(d)
else:
  while d%10==0 and ss>0:
    if s[0]%10!=0:
      d-=s[0]
    else:
      ss-=s[0]
      s.pop(0)
      
  print(d)


Fixed code:
n=int(input())
s=[]
for i in range(n):
  h=int(input())
  s.append(h)
s.sort()
d=sum(s)
ss=d
if d%10!=0:
  print(d)
else:
  while d%10==0 and ss>0:
    if s[0]%10!=0:
      d-=s[0]
    else:
      ss-=s[0]
      s.pop(0)
      
  if ss==0:
    print(0)
  else:
    print(d)
Buggy code:
# -*- coding: utf-8 -*-

def main(N,S):
    flag = True
    S = sorted(S, reverse=True)
    ttl = sum(S)
    tmp = 0
    if(ttl%10==0):
        for i in range(N+1):
            if(i==N):
                flag = False
                break
            if(S[i]%10!=0):
                tmp = S[i]
                break
            else:
                continue
        
    print(ttl-tmp) if flag else print(0)
    
if __name__ == '__main__':
    N = int(input())
    S = []
    for i in range(N):
        S.append(int(input()))
    
    main(N,S)

Fixed code:
# -*- coding: utf-8 -*-

def main(N,S):
    flag = True
    S = sorted(S)
    ttl = sum(S)
    tmp = 0
    if(ttl%10==0):
        for i in range(N+1):
            if(i==N):
                flag = False
                break
            if(S[i]%10!=0):
                tmp = S[i]
                break
            else:
                continue
                
    print(ttl-tmp) if flag else print(0)
    
if __name__ == '__main__':
    N = int(input())
    S = []
    for i in range(N):
        S.append(int(input()))
    
    main(N,S)
Buggy code:
 N = int(input())
 S = [int(input()) for i in range(N)]

 ans = sum(S)
 S.sort()

 for s in S:
   if ans%10 == 0 and s%10 != 0:
     ans = ans - s
     break

 if ans%10 != 0:
   print(ans)
 else:
   print(0)


Fixed code:
N = int(input())
S = [int(input()) for i in range(N)]

ans = sum(S)
S.sort()

for s in S:
  if ans%10 == 0 and s%10 != 0:
    ans = ans - s
    break

if ans%10 != 0:
  print(ans)
else:
  print(0)
Buggy code:
N = int(input())
s = [int(input()) for _ in range(N)]

result = sum(s)

if result % 10 == 0:
    while True:
        min_s = min(s)
        if min_s % 10 == 0:
            s.remove(min_s)
        else:
            result -= min_s
            break

print(result)


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

result = sum(s)

if result % 10 == 0:
    for _ in range(N):
        min_s = min(s)
        if min_s % 10 == 0:
            s.remove(min_s)
        else:
            result -= min_s
            break

    if result % 10 == 0:
        result = 0

print(result)
Buggy code:
n = int(input())

a = []
b = []

for i in range(n):
    k = int(input())
    if k % 10 == 0:
        a.append(k)
    else:
        b.append(k)

su = sum(a)

b.sort()

su += sum(b) - b[0]
print(su)

Fixed code:
n = int(input())

a = []
b = []

for i in range(n):
    k = int(input())
    if k % 10 == 0:
        a.append(k)
    else:
        b.append(k)

if len(b) == 0:
    print(0)
else:
    b.sort()
    su = sum(a) + sum(b)
    if su % 10 == 0:
        su -= b[0]
    print(su)
Buggy code:
n = int(input())
notlist = []
s = 0
for i in range(n):
    a = int(input())
    if a%10 != 0:
        notlist.append(a)
    s += a
print(s-min(notlist) if notlist != [] else 0)

Fixed code:
n = int(input())
notlist = []
s = 0
for i in range(n):
    a = int(input())
    if a%10 != 0:
        notlist.append(a)
    s += a
print(s if s%10 != 0 else s-min(notlist) if notlist != [] else 0)
Buggy code:

N = int(input())
s = []
for i in range(N):
    s.append(int(input()))

sei=0
s = sorted(s)
total = sum(s)
flg=0

if total%10!=0:
    out=total
    flg=1
else:
    scr=total
    for i in range(N):
        if s[i] %10!=0:
            print(sum(s)-s[i])
            break
        elif i==N-1:
            print(0)
            break

Fixed code:

N = int(input())
s = []
for i in range(N):
    s.append(int(input()))

s = sorted(s)
total = sum(s)

if total%10!=0:
    out=total
    print(out)
else:
    scr=total
    for i in range(N):
        if s[i] %10!=0:
            print(sum(s)-s[i])
            break
        elif i==N-1:
            print(0)
            break
Buggy code:
N = int(input())
S = []

for i in range(N):
  S.append(int(input()))
  
S.sort()
ans = sum(S)

if ans % 10 != 0:
  print(ans)
  
for i in range(N):
  if A[i] % 10 != 0:
    ans -= a[i]
    print(ans)
    exit()

print(0)

Fixed code:
N = int(input())
S = []

for i in range(N):
  S.append(int(input()))
  
S.sort()
ans = sum(S)

if ans % 10 != 0:
  print(ans)
  exit()
  
for i in range(N):
  if S[i] % 10 != 0:
    ans -= S[i]
    print(ans)
    exit()

print(0)
Buggy code:
_, s = map(int, open(0))
S = sum(s)
t = [i for i in s if i%10]
print(S if S%10 else S-min(t) if t else 0)

Fixed code:
_, *s = map(int, open(0))
S = sum(s)
t = [i for i in s if i%10]
print(S if S%10 else S-min(t) if t else 0)
Buggy code:
n=int(input())
ans=0
S=[]
for i in range(n):
    s=int(input())
    ans+=s
    S.append(s)
if ans%10!=0:
    print(ans)
else:
    S.sort()
    for j in range(n):
        if S[j]%10!=0:
            print(ans-S[j])
            break
    if ans==sum(S):
        print(0)
    


Fixed code:
n=int(input())
ans=0
S=[]
for i in range(n):
    s=int(input())
    ans+=s
    S.append(s)
if ans%10!=0:
    print(ans)
else:
    S.sort()
    for j in range(n):
        if S[j]%10!=0:
            ans-=S[j]
            print(ans)
            break
    if ans==sum(S):
        print(0)
Buggy code:
a=int(input())
b=[int(input()) for i in range(a)]
b.sort()
c=sum(b)
if c%10!=0:
  print(c)
else:
  for k in range(a):
    c=c-b[k]
    if c%10!=0:
      print(c)
      break

Fixed code:
a=int(input())
b=[int(input()) for i in range(a)]
b.sort()
c=sum(b)
d=0
if c%10!=0:
  print(c)
else:
  for i in range(a):
    if b[i]%10!=0:
      c=c-b[i]
      print(c)
      break
  if sum(b)==c:
    print(0)
Buggy code:
N = int(input())

A=[]
for i in range(N):
    A.append(int(input()))

A.sort()

gokei = sum(A)

if gokei%10 != 0:
    print(gokei)
else:
    for i in range(N):
        if (gokei - A[i])%10 != 0:
            print(gokei - A[i])
    else:
        print(0)

Fixed code:
N = int(input())

A=[]
for i in range(N):
    A.append(int(input()))

A.sort()

gokei = sum(A)

if gokei%10 != 0:
    print(gokei)
else:
    for i in range(N):
        if (gokei - A[i])%10 != 0:
            print(gokei - A[i])
            break
    else:
        print(0)