qyliang/CodeNanoFix huggingface dataset:
Buggy code:
T=int(input())
si=[]
sum=0
for i in range(T):
  si.append(int(input()))
sorted(si)
for k in range(T):
    sum=sum+si[k]
if sum%10!=0:
    print(sum)
else:
    for j in range(T):
        if si[j]%10!=0:
            sum=sum-si[j]
            print(sum)
            break
        else:
            sum=sum-si[j]
    print(sum)        


Fixed code:
T=int(input())
si=[]
sum=0
for i in range(T):
  si.append(int(input()))
si.sort()
for k in range(T):
    sum=sum+si[k]
if sum%10!=0:
    print(sum)
else:
    for j in range(T):
        if si[j]%10!=0:
            sum=sum-si[j]
            break
        else:
            pass
    if sum%10==0:
        sum=0
    else:
        pass
    print(sum)
Buggy code:
n = int(input())
s = list(int(input()) for i in range(n))

ans = sum(S)
sort_S = sorted(S)

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

Fixed code:
n = int(input())
S = list(int(input()) for i in range(n))

ans = sum(S)
sort_S = sorted(S)

if ans % 10 != 0:
    print(ans)
    exit()
else:
    for s in sort_S:
        if s % 10 != 0:
            ans -= s
            print(ans)
            exit()
print(0)
Buggy code:
import itertools

N = int(input())
S = []

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

a = sum(S)

if a % 10 != 0:
    print(a)
else:
    T = [s for s in S if s%10!=0]
    if len(T) == 0:
       ans = 0
    else:
        ans = A-min(T)

print(ans)

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

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

a = sum(S)
ans = 0

if a % 10 != 0:
    ans = a
else:
    T = [s for s in S if s%10!=0]
    if len(T) == 0:
       ans = 0
    else:
        ans = a-min(T)

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


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

Fixed code:
n = int(input())
s = []
for i in range(n):
    s.append(int(input()))
s.sort()
score = sum(s)
if score % 10 == 0:
    for i in range(n):
        if s[i]%10>0:
            score -= s[i]
            break
    if score % 10 == 0:
        print(0)
    else:
        print(score)
else:
    print(score)
Buggy code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    s = []
    for i in range(N):
        tmp = inputInt()
        s.append(tmp)
        
    flg = True
    ni = False
    iti = False
    for i in s:
        if i % 10 != 0:
            flg = False
            if iti == False:
                iti = True
            else:
                ni = True
    
    if flg == True:
        print(0)
        sys.exit()
        
    if sum(s) % 10 != 0:
        print(sum(s))
        sys.exit()
        
    tmp = min(s)
    if tmp % 10 == 0:
        print(sum(s)-tmp)
        sys.exit()
        
        
if __name__ == "__main__":
	main()


Fixed code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    s = []
    flg = False
    onry = False
    tmp_max = 0
    tmp_arr = []
    for i in range(N):
        tmp = inputInt()
        s.append(tmp)
        if tmp % 10 != 0:
            tmp_max += tmp
            tmp_arr.append(tmp)
            flg = True
            if onry == False:
                onry = True
            else:
                onry = None
            
    if flg == False:
        print(0)
        sys.exit()
        
    if onry == True or tmp_max % 10 != 0:
        print(sum(s))
        sys.exit()
        
    print(sum(s)-min(tmp_arr))
        
        
if __name__ == "__main__":
	main()
Buggy code:
#ABC063C
N = int(input())
s = [int(input()) for _ in range(N)]
ans = -1
s.sort()    
if ans % 10 != 0:
    ans = sum(s)
else:
    for i in range(1, len(s)):
        if s[i]%10 != 0:
            s.pop(i)
            ans = sum(s)
            break
    if ans != -1:
        ans = 0
print(ans)

Fixed code:
#ABC063C
N = int(input())
s = [int(input()) for _ in range(N)]
ans = -1
s.sort()    
if sum(s) % 10 != 0:
    ans = sum(s)
else:
    for i in range(len(s)):
        if s[i]%10 != 0:
            s.pop(i)
            ans = sum(s)
            break
    if ans == -1:
        ans = 0
print(ans)
Buggy code:
#ABC063C
N = int(input())
s = [int(input()) for _ in range(N)]
ans = -1
s.sort()
for _ in range(N+1):
    ans = sum(s)
    if ans % 10 != 0:
        break
    elif len(s) == 0:
        ans = 0
        break
    elif len(s) >= 2:
        for i in range(1, len(s)):
            if (ans - s[0])%10 == 0 and (ans - s[i])%10 != 0:
                s.pop(i)
                del_ok = True
        if not del_ok:
            s.pop(0)
    else:
        s.pop(0)
print(ans)

Fixed code:
#ABC063C
N = int(input())
s = [int(input()) for _ in range(N)]
ans = -1
s.sort()
for _ in range(N+1):
    ans = sum(s)
    if ans % 10 != 0:
        break
    elif len(s) == 0:
        ans = 0
        break
    elif len(s) >= 2:
        del_ok = False
        for i in range(1, len(s)):
            if s[0]%10 == 0 and s[i]%10 != 0:
                s.pop(i)
                del_ok = True
                break
        if not del_ok:
            s.pop(0)
    else:
        s.pop(0)
print(ans)
Buggy code:
n = int(input())
S = []
for _ in range(n):
    S.append(int(input()))

min_not_ten = 1000
for i in range(n):
    if S[i] <= min_not_ten and S[i] % 10 != 0:
        min_not_ten = S[i]
if min_not_ten == 1000:
    min_not_ten = 0

ans = sum(S) - min_not_ten
if ans % 10 == 0:
    ans = 0
print(ans)



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

min_not_ten = 1000
for i in range(n):
    if S[i] <= min_not_ten and S[i] % 10 != 0:
        min_not_ten = S[i]
if min_not_ten == 1000:
    min_not_ten = 0

if sum(S) % 10 != 0:
    ans = sum(S)
elif min_not_ten == 0:
    ans = 0
else:
    ans = sum(S) - min_not_ten

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


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


Fixed code:
N = int(input())
s = [int(input()) for _ in range(N)]
s.sort()
ans = sum(s)
if ans % 10:
    print(ans)
else:
    for i in range(N):
        if (ans - s[i]) % 10:
            print(ans - s[i])
            break
    else:
        print(0)
Buggy code:
# -*- coding:utf-8 -*-
import sys

N = int(input())
Sn = sorted([int(input()) for i in range(N)])
total = sum(Sn)
if total % 10 != 0:
    print(total)
    sys.exit()
else:
    i = 0
    while True:
        total -= Sn[i]
        if total % 10 != 0:
            print(total)
            sys.exit()

print(0)

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

N = int(input())
Sn = sorted([int(input()) for i in range(N)])
total = sum(Sn)
if total % 10 != 0:
    print(total)
    sys.exit()
else:
    i = 0
    while True:
        if (total - Sn[i]) % 10 != 0:
            print(total - Sn[i])
            sys.exit()
        i += 1
        if i == N:
            break
print(0)
Buggy code:
n = int(input())
s = [int(input()) for s in range(n)]
s1 = []
sum0 = 0
for i in s:
    if i%10 == 0:
        sum0 += i
    else:
        s1.append(i)

if len(s1) == 0:
    print(0)
else:
    sum1 = sum(s1)
    if sum1%10 != 0:
        print(sum0 + sum1)
    else:
        print(sum0 + sum1 + min(s1))

Fixed code:
n = int(input())
s = [int(input()) for s in range(n)]
s1 = []
sum0 = 0
for i in s:
    if i%10 == 0:
        sum0 += i
    else:
        s1.append(i)

if len(s1) == 0:
    print(0)
else:
    sum1 = sum(s1)
    if sum1%10 != 0:
        print(sum0 + sum1)
    else:
        print(sum0 + sum1 - min(s1))
Buggy code:
import sys

n=int(input())
a=[int(input())for _ in range(n)]
a.sort()
ans=0

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

Fixed code:
import sys

n=int(input())
a=[int(input())for _ in range(n)]
a.sort()
ans=0

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

s.sort()
s_max = sum(s)

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

print(0)

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

s.sort()
s_max = sum(s)

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

print(0)
Buggy code:
n = int(input())
x = 0
mn = 101
for i in range(n):
    s = int(input())
    x += s
    if x % 10 != 0
        if s < mn:
            mn = s
if x % 10 != 0:
    print(x)
else:
    x -= mn
    if x % 10 == 0:
        print(0)
    else:
        if x < 0:
            print(0)
            exit()
        print(x)
        

Fixed code:
n = int(input())
x = 0
mn = 100
for i in range(n):
  s = int(input())
  x += s
  if s % 10 != 0:
    if s <= mn:
      mn = s
if x % 10 != 0:
  print(x)
else:
  x -= mn
  if x % 10 == 0:
    print(0)
  else:
    if x < 0:
      print(0)
      exit()
    print(x)
Buggy code:
N = int(input())
s = [int(input()) for _ in range(N)]
s.sort()
ans = sum(s)

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


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

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

n = int(input())
s = [int(input()) for _ in range(n)]
s.sort()
res = sum(s)
for i in range(n):
    if res%10==0:
        res -= s[i]
    else:
        print(res)
        exit()

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

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

if sum(s) % 10 != 0:
  s -= min([for x in s if s % 10 == 0] + [s])

print(s)


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

ssum = sum(s)
if sum(s) % 10 == 0:
  ssum -= min([x for x in s if x % 10 != 0] + [ssum])

print(ssum)
Buggy code:
n=int(input())
ans=0
m=999999
for i in range(n):
  a=int(input())
  ans+=a
  if a%10>0 and m>a:
    m=a
print(max(0,ans-m))

Fixed code:
n=int(input())
ans=0
m=999999
for i in range(n):
  a=int(input())
  ans+=a
  if a%10>0 and m>a:
    m=a
if ans%10>0:
  print(ans)
else:
  print(max(0,ans-m))
Buggy code:
N = int(input())
s = []
t = []
for _ in range(N):
  tmp = int(input())
  s.append(tmp)
  if tmp % 10 != 0:
    t.append(tmp)

ans = sum(s)

if s % 10 != 0:
  print(ans)
else:
  print(ans - min(t))

Fixed code:
N = int(input())
s = []
t = []
for _ in range(N):
  tmp = int(input())
  s.append(tmp)
  if tmp % 10 != 0:
    t.append(tmp)

ans = sum(s)

if ans % 10 != 0:
  print(ans)
else:
  if not t:
    print(0)
  else:
  	print(ans - min(t))
Buggy code:
n = int(input())
s = [int(input()) for _ in range(n)]
s_0 = [num for num in s if num % 10 != 0]
if len(s_0) == 0: print(0)
else: print(sum(s) - min(s_0))

Fixed code:
n = int(input())
s = [int(input()) for _ in range(n)]
s_0 = [num for num in s if num % 10 != 0]
if len(s_0) == 0: print(0)
elif sum(s) % 10 == 0: print(sum(s) - min(s_0))
else: print(sum(s))
Buggy code:
n = int(input())
sn = sorted([int(input()) for _ in range(n)])
sum_sn = sum(sn)
answer = sum_sn
i = 0
while i < n and sn[i] % 10 == 0:
    i += 1
if i == n:
    print(0)
else:
    print(answer-sn[i])


Fixed code:
n = int(input())
sn = sorted([int(input()) for _ in range(n)])
sum_sn = sum(sn)
answer = sum_sn
i = 0
while i < n and sn[i] % 10 == 0:
    i += 1
if i == n:
    print(0)
else:
    print(answer-sn[i] if answer % 10 == 0 else answer)
Buggy code:
#-*-coding:utf-8-*-

def main():
    n = int(input())
    s_list = [int(input()) for _ in range(n)]
    s_list.sort()
    s_sum = sum(s_list)

    for i in s_list:
        if s_sum % 10 != 0:
            break
        if i % 10 == 0:
            continue
        else:
            s_sum -= i

    print(s_sum)

if __name__ == '__main__':
    main()

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

def main():
    n = int(input())
    s_list = [int(input()) for _ in range(n)]
    s_list.sort()
    s_sum = sum(s_list)

    for i in s_list:
        if s_sum % 10 != 0:
            break
        if i % 10 == 0:
            continue
        else:
            s_sum -= i
    if s_sum % 10 != 0:
        print(s_sum)
    else:
        print(0)

if __name__ == '__main__':
    main()
Buggy code:
a=int(input())
b=[int(input()) for i in range(a)]
b.sort()
ans=sum(b)
d=0
for i in range(a):
	if b[i]%10!=0 and sum(b)%10==0 :
		ans=sum(b)-b[i]
		d=1
		break
if d==1:
	print(ans)
else:
	print(0)

Fixed code:
a=int(input())
b=[int(input()) for i in range(a)]
b.sort()
ans=sum(b)
d=0
for i in range(a):
	if b[i]%10!=0 and sum(b)%10==0 :
		ans=sum(b)-b[i]
		d=1
		break
if d==1 or ans%10!=0:
	print(ans)
else:
	print(0)
Buggy code:
n=int(input())
l=[]
for i in range(n):
  v=int(input())
  l.append(v)
l.sort()
sum=0
for i in range(n):
  sum+=l[i]
if sum%10==0:
  for i in range(n):
    if l[i]%10!=0:
      print(sum-l[i])
      break
else:
  print(sum)

Fixed code:
n=int(input())
l=[]
for i in range(n):
  v=int(input())
  l.append(v)
l.sort()
sum=0
for i in range(n):
  sum+=l[i]
if sum%10==0:
  for i in range(n):
    if l[i]%10!=0:
      print(sum-l[i])
      break
    if i==n-1:
      print(0)
else:
  print(sum)
Buggy code:
n=int(input())
s=[int(input()) for _ in range(n)]
x=sum(s)
if x%10:
  print(x)
else:
  a=[]
  for i in s:
    if i%10:
      a.appned(i)
  if a:
    print(x-min(a))
  else:
    print(0)
  

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

ans = sum(s)
x = []

for i in s:
    if i % 10 != 0:
        x.append(i)
x = sorted(x)

for i in x:
    if ans % 10 == 0:
        ans = ans - i
print(ans)

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

ans = sum(s)
x = []

for i in s:
    if i % 10 != 0:
        x.append(i)
x = sorted(x)

for i in x:
    if ans % 10 == 0:
        ans = ans - i
if ans % 10 == 0:
    print(0)
else:
    print(ans)
Buggy code:
N = int(input())
s = [int(input()) for _ in range(N)]
S = sorted(s)
Res = sum(s)
flag = False

if Res % 10 == 0:
    for i in s:
        if (Res - i) % 10 != 0:
            Res -= i
            flag = True
            break

print(Res if flag else 0)

Fixed code:
N = int(input())
s = [int(input()) for _ in range(N)]
S = sorted(s)
Res = sum(s)
flag = False

if Res % 10 == 0:
    for i in S:
        if (Res - i) % 10 != 0:
            Res -= i
            flag = True
            break
else:
    flag = True

print(Res if flag else 0)
Buggy code:
def main():
    n = int(input())
    s = [int(input()) for i in range(n)]

    sum_max = sum(s)

    if sum_max % 10 == 0:
        min_p = 101
        for i in s:
            if i % 10 != 0 and i < min_p:
                min_p = i

        if min_p == 101:
            sum_max = 0

    print(sum_max)


if __name__ == '__main__':
    main()


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

    sum_max = sum(s)

    if sum_max % 10 == 0:
        min_p = 101
        for i in s:
            if i % 10 != 0 and i < min_p:
                min_p = i

        if min_p == 101:
            sum_max = 0
        else:
            sum_max -= min_p

    print(sum_max)


if __name__ == '__main__':
    main()
Buggy code:
N = int(input())
s = sorted([int(input()) for _ in range(N)])
if sum(s)%10 != 0:
    print(sum(s))
else:
    for i in range(N):
        if s[i]%10 != 0:
            print(sum(s)-s[i])
            break

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

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

for n in range(N):
  li.append(int(input()))

li.sort()
S=sum(li)


while S%10==0 and li!=[]:
  if li[0]%10==0:
    li.pop(0)
  else:
    S-=li.pop(0)
if li==[]:
  print(0)
else:
  print(S)
Buggy code:
n=int(input())
q=[]
for i in range(n):
  q.append(int(input()))
s=sum(q)
check=s%10
if check!=0:
  print(s)
else:
  r=max(q)
  cnt=0
  for i in q:
    if i%10!=0 and i<r:
      r=i
      cnt+=1
  if cnt=0:
    print(0)
  else:
    print(q-r)

Fixed code:
n=int(input())
q=[]
for i in range(n):
  q.append(int(input()))
q.sort()
s=sum(q)
check=s%10
if check!=0:
  print(s)
else:
  r=max(q)
  cnt=0
  for i in q:
    if i%10!=0 and i<=r:
      r=i
      cnt+=1
  if cnt==0:
    print(0)
  else:
    print(s-r)
Buggy code:
N = int(input())
s=[]
for i in range(N):
    s.append(int(input()))
t=[]
for i in range(N):
    if s[i]%10 != 0:
        t.append(s[i])
        s[i] = 0

t.sort()
sum_s=sum(s)
sum_t=sum(t)
if len(t) != 0:
    if sum_t%10 == 0:
        sum_t -= t[0]
sum = sum_s + sum_t
print(sum)

Fixed code:
N = int(input())
s=[]
for i in range(N):
    s.append(int(input()))
t=[]
for i in range(N):
    if s[i]%10 != 0:
        t.append(s[i])
        s[i] = 0

t.sort()
sum_s=sum(s)
sum_t=sum(t)
if len(t) != 0:
    if sum_t%10 == 0:
        sum_t -= t[0]
sum = sum_s + sum_t
if sum%10 == 0:
    print(0)
else:
    print(sum)
Buggy code:
n = int(input())
A = [int(input()) for i in range(n)]

B = []

for a in A:
    if a % 10 != 0:
        B.append(a)

ans = sum(A)
if ans % 10 == 0:
    ans -= min(B)
    

print(ans)

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

B = []

for a in A:
    if a % 10 != 0:
        B.append(a)

ans = sum(A)
if ans % 10 == 0 and len(B) != 0:
    ans -= min(B)
elif ans % 10 == 0 and len(B) == 0:
    ans = 0
    

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

Fixed code:
N = int(input())
S = []
for _ in range(N):
    S.append(int(input()))
sums = sum(S)
if sums % 10 != 0:
    print(sums)
else:
    S.sort()
    for s in S:
        if s % 10 != 0:
            print(sums - s)
            break
    else:
        print(0)
Buggy code:
n = int(input())
a = [int(input()) for i in range(n)]
b = min([i for i in a if i % 10] + [0])
if sum(a) % 10:
    print(sum(a))
elif b:
    print(sum(a) - b)
else:
    print(0)

Fixed code:
n = int(input())
a = [int(input()) for i in range(n)]
b = min([i for i in a if i % 10] + [sum(a)])
if sum(a) % 10:
    print(sum(a))
else:
    print(sum(a) - b)
Buggy code:
N=int(input())
s=[0]*N
for i in range(N):
  s[i] = int(input())
s.sort()
s_sum=sum(s)

if s_sum%10 !=0:
  ans = s_sum
else:
  for num in s:
    if (s_sum-num)%10 !=0:
      maxi_1 = s_sum-num
      #print(num,maxi_1)
      break
    else:
      maxi_1=0
  tmp=0
  for num in s:
    tmp += num
    if (s_sum-tmp)%10 !=0:
      maxi_2= s_sum-tmp
      #print(num,maxi_2)
      break
    else:
      maxi_2=0
    ans=max(maxi_1,maxi_2)
print(ans)

Fixed code:
N=int(input())
s=[0]*N
for i in range(N):
  s[i] = int(input())
s.sort()
s_sum=sum(s)

if s_sum%10 !=0:
  ans = s_sum
else:
  for num in s:
    if (s_sum-num)%10 !=0:
      maxi_1 = s_sum-num
      #print(num,maxi_1)
      break
    else:
      maxi_1=0
  tmp=0
  for num in s:
    tmp += num
    if (s_sum-tmp)%10 !=0:
      maxi_2= s_sum-tmp
      #print(num,maxi_2)
      break
    else:
      maxi_2=0
  ans=max(maxi_1,maxi_2)
print(ans)
Buggy code:
n = int(input())
S = [0]*n
for i in range(n):
    S[i] = int(input())
r = sum(S)
S.sort()
for i in range(n):
    if r%10 == 0 and S[i]%10!=0:
        r -= S[i]
    elif r%10!=0:
        break
print(r)

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

r = sum(S)
S.sort()
for i in range(n):
    if r%10 != 0:
        break
    if r%10 == 0 and S[i]%10!=0:
        r -= S[i]
        break
    if i==n-1:
        r = 0
print(r)
Buggy code:
N = int(input())
L = [int(input()) for i in range(N)]
L = sorted(L)
ans = sum(L)

if ans % 10 == 0 :
    for l in L :
        if l % 10 != 0 :
            ans -= l
            break
print(ans)

Fixed code:
N = int(input())
L = [int(input()) for i in range(N)]
L = sorted(L)
ans = sum(L)
if ans % 10 == 0 :
    for l in L :
        if l % 10 != 0 :
            ans -= l
            break
    else :
        ans = 0
print(ans)
Buggy code:
n = int(input())
ten = []
notten = []
for _ in range(n):
  s = int(input())
  if s % 10:
    notten.append(s)
  else:
    ten.append(s)
ans = sum(notten) + sum(ten)
if sum(notten) % 10 == 0:
  print(ans - min(notten))
elif ans % 10 == 0:
  print(0)
else:
  print(ans)
  

Fixed code:
n = int(input())
ten = []
notten = []
for _ in range(n):
  s = int(input())
  if s % 10:
    notten.append(s)
  else:
    ten.append(s)
ans = sum(notten) + sum(ten)
if notten and sum(notten) % 10 == 0:
  print(ans - min(notten))
elif ans % 10 == 0:
  print(0)
else:
  print(ans)