Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
    if a<b:
     c=a
     a=b
     b=c
     
    c=a%b
    
    if c==0:
     return a
    else:
     return b
 
def lcm(a,b):
    c=gcd(a,b)
    return a/c*b
 
 
 
n=int(input())
t=[0]*n
 
for lop2 in range(n):
    t[lop2]=int(input())
 
ans=t[0]
 
for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))


Fixed submission:
N = input()
n=int(N)
n2=(n%10)*100
n2+=(n%100)-n%10
n2+=(n-n%100)/100
if n==n2 :
	print('Yes\n')
else:
	print('No\n')
quit()

Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
    if a<b:
     c=a
     a=b
     b=c
     
    c=a%b
    return b
 
def lcm(a,b):
    c=gcd(a,b)
    return a/c*b
 
 
 
n=int(input())
t=[0]*n
 
for lop2 in range(n):
    t[lop2]=int(input())
 
ans=t[0]
 
for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))


Fixed submission:
N = input()
n=int(N)
n2=(n%10)*100
n2+=(n%100)-n%10
n2+=(n-n%100)/100
if n==n2 :
	print('Yes\n')
else:
	print('No\n')
quit()

Buggy python submission (verdict: Runtime Error):

def gcd(a,b):
    if a<b:
        d=a
        a=b
        b=d
    c=a%b

    if c==0:
        return b
    else:
        return gcd(b,c)

def lcm(a,b):
    c=gcd(a,b)
    return a/c*b

n=int(input())
t=[0]*n

for lop2 in range(n):
    t[lop2]=int(input())

ans=t[0]

for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))

Fixed submission:
N = input()
n=int(N)
n2=(n%10)*100
n2+=(n%100)-n%10
n2+=(n-n%100)/100
if n==n2 :
	print('Yes\n')
else:
	print('No\n')
quit()

Buggy python submission (verdict: Runtime Error):

def gcd(a,b):
        return b


def lcm(a,b):
    c=gcd(a,b);
    return a/c*b

n=int(input())
t=[0]*n

for lop2 in range(n):
    t[lop2]=int(input())

ans=t[0]

for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))

Fixed submission:
N = input()
n=int(N)
n2=(n%10)*100
n2+=(n%100)-n%10
n2+=(n-n%100)/100
if n==n2 :
	print('Yes\n')
else:
	print('No\n')
quit()

Buggy python submission (verdict: Runtime Error):

def gcd(a,b):
            return b


def lcm(a,b):
    c=gcd(a,b);
    return a/c*b

n=int(input())
t=[0]*n

for lop2 in range(n):
    t[lop2]=int(input())

ans=t[0]

for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))

Fixed submission:
N = input()
n=int(N)
n2=(n%10)*100
n2+=(n%100)-n%10
n2+=(n-n%100)/100
if n==n2 :
	print('Yes\n')
else:
	print('No\n')
quit()

Buggy python submission (verdict: Runtime Error):

def gcd(a,b):
    if a<b:
        d=a;
        a=b;
        b=d;
    c=a%b

    if c==0:
        return b
    else:
        return gcd(b,c)

def lcm(a,b):
    c=gcd(a,b);
    return a/c*b

n=int(input())
t=[0]*n

for lop2 in range(n):
    t[lop2]=int(input())

ans=t[0]

for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))

Fixed submission:
N = input()
n=int(N)
n2=(n%10)*100
n2+=(n%100)-n%10
n2+=(n-n%100)/100
if n==n2 :
	print('Yes\n')
else:
	print('No\n')
quit()
Buggy python submission (verdict: Runtime Error):
import math
import os
import random
import re
import sys
from collections import defaultdict

sys.stdin = open('input.in', 'r')
sys.stdout = open('output.out', 'w') 

def count(n, h):
	count = 0
	if len(h) < 1:
		return count
	max = h[0]
	for i in h:
		if i >= max:
			max = i 
			count += 1

	return count

if __name__ == '__main__':
	n = int(input())
	h = list(map(int, input().rstrip().split()))
	print(count(n, h))

Fixed submission:
import math
import os
import random
import re
import sys
from collections import defaultdict

# sys.stdin = open('input.in', 'r')
# sys.stdout = open('output.out', 'w') 

def count(n, h):
	count = 0
	if len(h) < 1:
		return count
	max = h[0]
	for i in h:
		if i >= max:
			max = i 
			count += 1

	return count

if __name__ == '__main__':
	n = int(input())
	h = list(map(int, input().rstrip().split()))
	print(count(n, h))

Buggy python submission (verdict: Runtime Error):
import math
import os
import random
import re
import sys
from collections import defaultdict

def count(n, h):
	count = 0
	if len(h) < 1:
		return count
	max = h[0]
	for i in h:
		if i >= max:
			max = i 
			count += 1

	return count

if __name__ == '__main__':
	n = int(input())
    h = list(map(int, input().rstrip().split()))
    print(count(n, h))

Fixed submission:
import math
import os
import random
import re
import sys
from collections import defaultdict

# sys.stdin = open('input.in', 'r')
# sys.stdout = open('output.out', 'w') 

def count(n, h):
	count = 0
	if len(h) < 1:
		return count
	max = h[0]
	for i in h:
		if i >= max:
			max = i 
			count += 1

	return count

if __name__ == '__main__':
	n = int(input())
	h = list(map(int, input().rstrip().split()))
	print(count(n, h))
Buggy python submission (verdict: Runtime Error):
import math
import os
import random
import re
import sys
from collections import defaultdict

sys.stdin = open('input.in', 'r')
sys.stdout = open('output.out', 'w') 

def onezero(a):
	count = 0
	for i in range(0, len(a), 2):
		if a[i] == 0:
			count += 1
	for i in range(1, len(a), 2):
		if a[i] == 1:
			count += 1
	return count

def zeroone(a):
	count = 0
	for i in range(0, len(a), 2):
		if a[i] == 1:
			count += 1
	for i in range(1, len(a), 2):
		if a[i] == 0:
			count += 1
	return count


def count(n):
	return min(onezero(n),zeroone(n))

if __name__ == '__main__':
	N = [int(d) for d in input()]
	print(count(N))

Fixed submission:
import math
import os
import random
import re
import sys
from collections import defaultdict

# sys.stdin = open('input.in', 'r')
# sys.stdout = open('output.out', 'w') 

def onezero(a):
	count = 0
	for i in range(0, len(a), 2):
		if a[i] == 0:
			count += 1
	for i in range(1, len(a), 2):
		if a[i] == 1:
			count += 1
	return count

def zeroone(a):
	count = 0
	for i in range(0, len(a), 2):
		if a[i] == 1:
			count += 1
	for i in range(1, len(a), 2):
		if a[i] == 0:
			count += 1
	return count


def count(n):
	return min(onezero(n),zeroone(n))

if __name__ == '__main__':
	N = [int(d) for d in input()]
	print(count(N))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

power_level = 1

for i in range(N):
    power_level *= (i + 1)


print(power_level % (10**9 + 7))

Fixed submission:
N = int(input())

power_level = 1

for i in range(N):
    power_level *= (i + 1)
    power_level %= (10**9 + 7)


print(power_level)
Buggy python submission (verdict: Runtime Error):
def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]
def zeros(n): return [0]*n
# def zeros(n): return np.zeros(n, dtype=np.longlong)
def zeros2(n, m): return [zeros(m) for i in range(n)] # obsoleted zeros((n, m))で代替

INF = 10**18

class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                w = cmt + ': ' + str(x)
            else:
                w = str(x)
            print(w)
        return x

def prob():
    d = Debug()
    d.off()
    N = 5
    dish = zeros(N)
    for i in range(N):
        dish[i] = int(input())
    d.dmp((dish),'dish')
    minDigit1 = 10
    idx = N
    time = 0
    for i in range(N):
        if dish[i] % 10 > 0 and minDigit1 > dish[i] % 10:
            idx = i
            minDigit1 = dish[i] % 10
        time += (dish[i]+9)//10*10
        d.dmp((time),'time')
    d.dmp((time),'time')
    d.dmp((idx),'idx')
    time -= (dish[idx]+9)//10*10
    time += dish[idx]
    return time
    

ans = prob()
print(ans)


Fixed submission:
def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]
def zeros(n): return [0]*n
# def zeros(n): return np.zeros(n, dtype=np.longlong)
def zeros2(n, m): return [zeros(m) for i in range(n)] # obsoleted zeros((n, m))で代替

INF = 10**18

class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                w = cmt + ': ' + str(x)
            else:
                w = str(x)
            print(w)
        return x

def prob():
    d = Debug()
    d.off()
    N = 5
    dish = zeros(N)
    for i in range(N):
        dish[i] = int(input())
    d.dmp((dish),'dish')
    minDigit1 = 10
    idx = N
    time = 0
    for i in range(N):
        if dish[i] % 10 > 0 and minDigit1 > dish[i] % 10:
            idx = i
            minDigit1 = dish[i] % 10
        time += (dish[i]+9)//10*10
        d.dmp((time),'time')
    d.dmp((time),'time')
    d.dmp((idx),'idx')
    if idx < N:
        time -= (dish[idx]+9)//10*10
        time += dish[idx]
    return time
    

ans = prob()
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
#import numpy as np

def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]

ALPHABET = [chr(i+ord('a')) for i in range(26)]
DIGIT = [chr(i+ord('0')) for i in range(10)]
MOD = 10**9 + 7
INF = 10**18

class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                w = cmt + ': ' + str(x)
            else:
                w = str(x)
            print(w)
        return x


def prob():
    d = Debug()
    d.off()
    N, K = getIntList()
    d.dmp((N, K), 'N, K')
    A = getIntList()
    d.dmp((A), 'A')
    if K == 0:
        x = 0
    else:
        lg = int(math.log2(K))
        mask = 1 << lg
        x = mask
        d.dmp(x,'x')
        mask >>= 1
        lessK = False
        while mask > 0:
            cz, co = 0, 0
            if K & mask == 0 and not lessK:
                pass
            else:
                for i in range(N):
                    if A[i] & mask == 0:
                        cz += 1
                    else:
                        co += 1
                if cz > co:
                    ans += mask
                    lessK = True
            mask >>= 1
            d.dmp((mask,x),'mask,x')
    d.dmp((x),'x')
    ans = 0
    for i in range(N):
        ans += x ^ A[i]
    return ans


ans = prob()
print(ans)


Fixed submission:
import math
def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]
# def getIntList(): return np.array(input().split(), dtype=np.longlong)
def zeros(n): return [0]*n
# def zeros(n): return np.zeros(n, dtype=np.longlong)
def zeros2(n, m): return [zeros(m) for i in range(n)] # obsoleted zeros((n, m))で代替

class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                w = cmt + ': ' + str(x)
            else:
                w = str(x)
            print(w)
        return x

def getMask(n):
    mask = 2**60
    while n & mask == 0:
        mask >>= 1
    return mask

def prob():  # WA 2
    d = Debug()
    d.off()
    N, K = getIntList()
    d.dmp((N, K), 'N, K')
    A = getIntList()
    d.dmp((A), 'A')
    if K == 0:
        x = 0
    else:
        #lg = int(math.log2(K+0.1))
        #mask = 1 << lg
        mask = getMask(K)
        x = 0
        d.dmp(x,'x')
        #mask >>= 1
        lessK = False  # x<Kか否か
        while mask > 0:
            cz, co = 0, 0
            for i in range(N):
                if A[i] & mask == 0:
                    cz += 1
                else:
                    co += 1
            if cz > co:
                if K & mask or lessK:
                    x += mask
            if (x & mask == 0) and mask & K:
                lessK = True
            mask >>= 1
            d.dmp((mask,x),'mask,x')
    d.dmp((x),'x')
    ans = 0
    for i in range(N):
        d.dmp((x ^ A[i]),'x ^ A[i]')
        ans += x ^ A[i]
    return ans


ans = prob()
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#C - 755 解2
Set753 = {7, 5, 3}

num = int(input())
count = 0
for i in range(357, num+1):
    nSet = set([])
    n = i
    while n>0:
        d = n%10
        if d in Set753:
            nSet.add(d)
            n //= 10
        else: 
            nSet = set([])
            break
    if nSet=={}: continue 
    elif nSet==Set753: 
        #print(i,end=', ') #
        count += 1
print(count) 

Fixed submission:
#C - 755 解3
Set753 = {7, 5, 3}
List753 = [7, 5, 3]

N = int(input())

def getDigitList(n):
    list = []
    while n>0:
        list.append(n%10)
        n //= 10
    list.reverse()
    if list==[]: list = [0]
    return list

def gen(n):
    if n>N: return []
    else:
        d = getDigitList(n)
        #print(d) #
        if set(d)==Set753: 
            result = [n]
        else:
            result = []
        for a in List753:  result += gen(n*10+a)
        return result
                
result = gen(0)
#print(result) #
print(len(result))

Buggy python submission (verdict: Time Limit Exceeded):
Num753 = {7, 5, 3}

def getDigitList(n):
    list = []
    while n>0:
        list.append(n%10)
        n //= 10
    list.reverse()
    if list==[]: list = [0]
    return list

def getDigitSet(n):
    nSet = set([])
    while n>0:
        nSet.add(n%10)
        n //= 10
    if nSet=={}: nSet = {0}
    return nSet

S = input()
num = int(S)
count = 0
for i in range(357, num+1):
    nSet = getDigitSet(i)
#    if len(nSet)!=3: continue
#    is753 = True
#    for d in nSet:
#        if not (d in Num753):
#            is753 = False 
#            break
    if nSet==Num753: 
        #print(i,end=', ') #
        count += 1
print(count) 

Fixed submission:
#C - 755 解3
Set753 = {7, 5, 3}
List753 = [7, 5, 3]

N = int(input())

def getDigitList(n):
    list = []
    while n>0:
        list.append(n%10)
        n //= 10
    list.reverse()
    if list==[]: list = [0]
    return list

def gen(n):
    if n>N: return []
    else:
        d = getDigitList(n)
        #print(d) #
        if set(d)==Set753: 
            result = [n]
        else:
            result = []
        for a in List753:  result += gen(n*10+a)
        return result
                
result = gen(0)
#print(result) #
print(len(result))
Buggy python submission (verdict: Time Limit Exceeded):
#C
def zeros(n): return [0 for i in range(n)]

N, M = [int(x) for x in input().split()]
city = []
for i in range(M):  
    pref, year = [int(x) for x in input().split()]
    city.append([pref, year, i, ''])

#print(N, M) #
#print(city) #
city.sort()
#print(city) #

nth = zeros(N+1)
for i in range(M):
    pref, year, seq, id = [x for x in city[i]]
    nth[pref] += 1
    city[i][3] = '%06d%06d' % (pref, nth[pref])
    #for j in range(4): print(city[i][j],end=',') #
for i in range(M):
    for j in range(M):
        if city[j][2]==i: print(city[j][3])



Fixed submission:
#C
def zeros(n): return [0 for i in range(n)]

N, M = [int(x) for x in input().split()]
city = []
for i in range(M):  
    pref, year = [int(x) for x in input().split()]
    city.append([pref, year, i, ''])

#print(N, M) #
#print(city) #
city.sort()
#print(city) #

nth = zeros(N+1)
for i in range(M):
    pref, year, seq, id = [x for x in city[i]]
    nth[pref] += 1
    city[i][3] = '%06d%06d' % (pref, nth[pref])
    city[i][0] = city[i][2] # seqを最初に
    #for j in range(4): print(city[i][j],end=',') #
    
city.sort()
for i in range(M): print(city[i][3])
Buggy python submission (verdict: Runtime Error):
# A
N = int(input())
if N==1: print('hello, world')
else:
    A, B = [int(x) for x in input().split()]
    print(A+B)
    

Fixed submission:
# A
N = int(input())
if N==1: print('Hello World')
else:
    A = int(input())
    B = int(input())
    print(A+B)
Buggy python submission (verdict: Runtime Error):
# ABC 106
def db(x): 
    global debug
    if debug: print(x)
debug = False
S = input()
K = int(input())
c5000 = 5*10**15
k = 0
for i in range(100):
    n = ord(S[i])-ord('0')
    if n>1: n *= c5000
    k += n
    db((i,k))
    if k>=K:
          print(S[i])
          break



Fixed submission:
# ABC 106
def db(x): 
    global debug
    if debug: print(x)
debug = False
S = input()
K = int(input())
for i in range(len(S)):
    if S[i]!='1': break
if i>=K: print('1')
else:   print(S[i])
Buggy python submission (verdict: Runtime Error):
# ABC 070
import math
def getInt(): return int(input())
def getIntFromRows(n): return [int(input()) for i in range(n)]
N1019 = 10**19
N = getInt()
T = getIntFromRows(N)
a = T[0]
lcm = T[0]
for i in range(1, N):
    gcd = math.gcd(a, T[i])
    lcm = a * T[i] // gcd
    a = gcd
print(lcm)

Fixed submission:
# ABC 070
import math
# gcdはエラーになる
def getInt(): return int(input())
def getIntFromRows(n): return [int(input()) for i in range(n)]
def gcd(x, y):
    m = max(x,y)
    n = min(x,y)
    while m%n != 0:
        w = m%n
        m = n
        n = w
    return n
def lcm(x, y): return x*y//gcd(x,y)

N = getInt()
T = getIntFromRows(N)
lc = T[0]
for i in range(1, N):
    lc = lcm(lc,T[i])
print(lc)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 2019/3/23
Solved on 2019/3/
@author: shinjisu
"""


# ABC 068 C - Cat Snuke and a Voyage

def getInt(): return int(input())

def getIntList(): return [int(x) for x in input().split()]

class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                print(cmt, ':  ', end='')
            print(x)
        return x


def prob():
    d = Debug()
    d.off()
    N, M = getIntList()
    d.dmp((N, M), 'N, M')
    ship = []
    for i in range(M):
        a, b = getIntList()
        ship.append((a, b))
    d.dmp((ship), 'ship')
    for i in range(2, N):
        if ((1, i) in ship or (i, 1) in ship) and\
             ((i, N) in ship or (N, 1) in ship):
            return 'POSSIBLE'
    return 'IMPOSSIBLE'


ans = prob()
if ans is None:
    pass
elif type(ans) == tuple and ans[0] == 1:  # 1,ans
    for elm in ans[1]:
        print(elm)
else:
    print(ans)


Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 2019/3/23
Solved on 2019/3/
@author: shinjisu
"""


# ABC 068 C - Cat Snuke and a Voyage
import bisect
#import numpy as np

def getInt(): return int(input())

def getIntList(): return [int(x) for x in input().split()]
# def getIntList(): return np.array(input().split(), dtype=np.longlong)

def zeros(n): return [0]*n
# def zeros(n): return np.zeros(n, dtype=np.longlong)

def zeros2(n, m): return [zeros(m) for i in range(n)] # obsoleted zeros((n, m))で代替

class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                print(cmt, ':  ', end='')
            print(x)
        return x


def prob():
    d = Debug()
    d.off()
    N, M = getIntList()
    d.dmp((N, M), 'N, M')
    ship = set()
    for i in range(M):
        a, b = getIntList()
        ship.add((a, b))
    d.dmp((ship), 'ship')
    for i in range(2, N):
        if ((1, i) in ship or (i, 1) in ship) and\
             ((i, N) in ship or (N, 1) in ship):
            return 'POSSIBLE'
    return 'IMPOSSIBLE'


ans = prob()
if ans is None:
    pass
elif type(ans) == tuple and ans[0] == 1:  # 1,ans
    for elm in ans[1]:
        print(elm)
else:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 2019/2/
Solved on 2019/2/
@author: shinjisu
"""


# ARC 078 C  Splitting Pile
def getInt(): return int(input())


def getIntList(): return [int(x) for x in input().split()]


def zeros(n): return [0]*n


def getIntLines(n): return [int(input()) for i in range(n)]


def getIntMat(n):
    mat = []
    for i in range(n):
        mat.append(getIntList())
    return mat


def zeros2(n, m): return [zeros(m)]*n


ALPHABET = [chr(i+ord('a')) for i in range(26)]
DIGIT = [chr(i+ord('0')) for i in range(10)]
N1097 = 10**9 + 7


def dmp(x, cmt=''):
    global debug
    if debug:
        if cmt != '':
            print(cmt, ':  ', end='')
        print(x)
    return x


def probC():
    N = getInt()
    A = getIntList()
    dmp((N, A))
    diff = 10**(9+6)
    for i in range(1, N):
        diff = min(diff, abs(sum(A[:i])-sum(A[i:])))
    return diff


debug = False  # True False
ans = probC()
print(ans)
#for row in ans:
#    print(row)


Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 2019/2/
Solved on 2019/2/
@author: shinjisu
"""


# ARC 078 C  Splitting Pile
def getInt(): return int(input())


def getIntList(): return [int(x) for x in input().split()]


def zeros(n): return [0]*n


def getIntLines(n): return [int(input()) for i in range(n)]


def getIntMat(n):
    mat = []
    for i in range(n):
        mat.append(getIntList())
    return mat


def zeros2(n, m): return [zeros(m)]*n


ALPHABET = [chr(i+ord('a')) for i in range(26)]
DIGIT = [chr(i+ord('0')) for i in range(10)]
N1097 = 10**9 + 7


def dmp(x, cmt=''):
    global debug
    if debug:
        if cmt != '':
            print(cmt, ':  ', end='')
        print(x)
    return x


def probC():
    N = getInt()
    A = getIntList()
    dmp((N, A))
    sumFormer = A[0]
    sumLatter = sum(A[1:])
    diff = abs(sumFormer-sumLatter)
    dmp(diff,'init')
    for i in range(1, N-1):
        sumFormer += A[i]
        sumLatter -= A[i]
        diff = min(diff, abs(sumFormer-sumLatter))
    return diff


def probC_v1():  # 5/16 AC 残りはTLE
    N = getInt()
    A = getIntList()
    dmp((N, A))
    diff = 10**(9+6)
    for i in range(1, N):
        diff = min(diff, abs(sum(A[:i])-sum(A[i:])))
    return diff


debug = False  # True False
ans = probC()
print(ans)
#for row in ans:
#    print(row)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 10 10:05:08 2019

@author: shinjisu
"""


# ARC 073 C
def getInt(): return int(input())


def getIntLines(n): return [int(input()) for i in range(n)]


def zeros(n): return [0]*n


def genBits(n):  # n個の0/1のリストを生成　[0]から変化
    bits = zeros(n)
    for i in range(2**n):
        for k in range(n):
            bits[k] = i % 2
            i //= 2
        yield bits


def dmp(x):
    global debug
    if debug:
        print(x)


def probC():
    N = getInt()
    S = getIntLines(N)
    dmp((N, S))
    maxPoint = 0
    for bit in genBits(N):
        point = 0
        for i in range(N):
            point += S[i]*bit[i]
        if point % 10 == 0:
            point = 0
        maxPoint = max(point, maxPoint)
        dmp((point, maxPoint))
    return maxPoint


debug = False
print(probC())


Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 10 10:05:08 2019

@author: shinjisu
"""


# ARC 073 C
def getInt(): return int(input())


def getIntLines(n): return [int(input()) for i in range(n)]


def zeros(n): return [0]*n


def genBits(n):  # n個の0/1のリストを生成　[0]から変化
    bits = zeros(n)
    for i in range(2**n):
        for k in range(n):
            bits[k] = i % 2
            i //= 2
        yield bits


def dmp(x):
    global debug
    if debug:
        print(x)


def probC_TLE():
    N = getInt()
    S = getIntLines(N)
    dmp((N, S))
    maxPoint = 0
    for bit in genBits(N):
        point = 0
        for i in range(N):
            point += S[i]*bit[i]
        if point % 10 == 0:
            point = 0
        maxPoint = max(point, maxPoint)
        dmp((point, maxPoint))
    return maxPoint


def probC():
    N = getInt()
    S = getIntLines(N)
    dmp((N, S))
    tens = []
    nonTens = []
    for i in range(N):
        if S[i] % 10 == 0:
            tens.append(S[i])
        else:
            nonTens.append(S[i])
    total = sum(nonTens)
    dmp(total)
    if total > 0 and total % 10 == 0:
        total -= min(nonTens)
    dmp(total)
    if total > 0:
        total += sum(tens)
    dmp(total)
    return total


debug = False
print(probC())