Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def solve(field):
  for i in range(1, h + 1):
    for j in range(1, w + 1):
      if field[i][j] == '#':
        continue
        if field[i-1][j] == field[i][j-1] == field[i][j+1] == field[i+1][j] == '.':
        '''上下左右に黒がない場合、黒色にできない（隣も塗らざるを得ないから）。
        また黒色にできないのはその場合に限る（1つ以上あれば――ダブってても白には戻らないため――べたべた塗ればよい）'''
          return False
        return True

h, w = list(map(int, input().split()))
field = ['.' + input() + '.' for _ in range(1, h + 1)]
#左右の端についてもsolve(field)を適用するため、入力に左右を付け加える
field = ['.'*(w+2)] + field + ['.'*(w+2)]
'''上下の端についても同様の処理。fieldは例えば['.....', '..#..', '.###.', '..#..', '.....']となる。
これのi番目のリストのj項が、field[i][j]によって指示される。'''
print('Yes' if solve(field) else 'No')#solve(field)だけで、Trueが返ってくるということを意味する。


Fixed submission:
def solve(field):
  for i in range(1, h + 1):
    for j in range(1, w + 1):
      if field[i][j] == '.':
        continue
        #それ以後の処理がスキップされ、次のループに。つまり#の場合のみ次に進める。
      if field[i-1][j] == field[i][j-1] == field[i][j+1] == field[i+1][j] == '.':
      #上下左右に黒がない場合（全部白の場合）、黒色にできない（隣も塗らざるを得ないから）。
      #また黒色にできないのはその場合に限る（1つ以上あれば――ダブってても白には戻らないため――べたべた塗ればよい）
        return False
  return True
#インデント注意。任意の#のfieldに対してFalse返らなかったらTrueということなので、最初の条件節を出る（同じインデントかそれより前）。
h, w = list(map(int, input().split()))
field = ['.' + input() + '.' for _ in range(h)]
#左右の端についてもsolve(field)を適用するため、入力に左右を付け加える
field = ['.'*(w+2)] + field + ['.'*(w+2)]
#上下の端についても同様の処理。fieldは例えば['.....', '..#..', '.###.', '..#..', '.....']となる。
#これのi番目のリストのj項が、field[i][j]によって指示される。

print('Yes' if solve(field) else 'No')
#solve(field)だけで、Trueが返ってくるということを意味する。
Buggy python submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    from itertools import accumulate

    B = [0] + A
    # 累積和を格納したリスト．A[l:r]の総和はB[r] - B[l]
    B = list(accumulate(B))
    BB = Counter(B)

    cnt = 0
    for k, v in BB.items():
        if v >= 2:
            cnt += (v*(v - 1) // 2)
    print(cnt)


resolve()

Fixed submission:
from collections import Counter, deque  # https://note.nkmk.me/python-scipy-connected-components/
# from copy import copy, deepcopy
# from functools import reduce
# from heapq import heapify, heappop, heappush
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import string
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    from itertools import accumulate

    B = [0] + A
    # 累積和を格納したリスト．A[l:r]の総和はB[r] - B[l]
    B = list(accumulate(B))
    BB = Counter(B)

    cnt = 0
    for k, v in BB.items():
        if v >= 2:
            cnt += (v*(v - 1) // 2)
    print(cnt)


resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    N,M=map(int,input().split())
    if N==1 or M==1:
        print(N*M-2)
    else:
        print((N-2)*(M-2))

resolve()

Fixed submission:
def resolve():
    N=int(input())
    A=list(map(int,input().split()))
    A=[0]+A+[0]
    total=sum([abs(A[i+1]-A[i]) for i in range(N+ 1)])

    for i in range(N):
        print(total-(abs(A[i+1]-A[i])+abs(A[i+2]-A[i+1]))+abs(A[i+2]-A[i]))



resolve()
Buggy python submission (verdict: Runtime Error):
A,B,C=map(int,input().split())
if A+B=>C:
    print('Yes')
else:
    print('No')

Fixed submission:
A,B,C=map(int,input().split())
if A+B>=C:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    N = input()
    M = [int(c) for c in N]

    lm=len(M)
    cnt=0
    if set(M[1:])=={9}:
        for i in M:
            cnt+=i
        print(cnt)
    else:
        print(9*(lm-1)+M[0]-1)

resolve()

Fixed submission:
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    N = input()
    M = [int(c) for c in N]
    lm=len(M)
    NN=int(N)
    if lm==1:
        print(NN)
    else:
        if set(M[1:])=={9}:
            print(M[0]+(lm-1)*9)
        else:

            print(M[0]-1+(lm-1)*9)



resolve()
Buggy python submission (verdict: Runtime Error):
S=input()
S[3]=8
print(S)

Fixed submission:
S=list(input())
S[3]='8'
print(''.join(S))
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
def dfs(i,f,sum):#ストップする段階（i）、式（f）、sumカウンタの3つの引数を用意。
    if i == 3:
        if sum==7:
            print(f+"=7")
            exit()
    
    return dfs(i+1, f+"+"+s[i+1],sum+int(s[i+1]))
    dfs(i+1, f+"-"+s[i+1],sum-int(s[i+1]))

s=input()
dfs(0, s[0],int(s[0]))


Fixed submission:
def resolve():
    I = input()
    L = [int(c) for c in I]
    # bit全探索
    # https://qiita.com/gogotealove/items/11f9e83218926211083a#%E4%BE%8B%E9%A1%8C-1
    for i in range(2 ** 3):
        val=L[0]
        ans=[]
        for j in range(3):  # このループが一番のポイント
            if ((i >> j) & 1):
                val+=L[j+1]
                ans.append('+')
            else:
                val-=L[j+1]
                ans.append('-')
                # 順に右にシフトさせ最下位bitのチェックを行う
        if val==7:
            for k in range(3):
                print('{}{}'.format(L[k],ans[k]),end='')
            print('{}=7'.format(L[3]))
            break





resolve()

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
def dfs(i,f,sum):#ストップする段階（i）、式（f）、sumカウンタの3つの引数を用意。
    if i == 3:
        if sum==7:
            print(f+"=7")
            exit()
    
    return dfs(i+1, f+"+"+s[i+1],sum+int(s[i+1]))
    dfs(i+1, f+"-"+s[i+1],sum-int(s[i+1]))

s=input()
dfs(0, s[0],int(s[0]))


Fixed submission:
def resolve():
    I = input()
    L = [int(c) for c in I]
    # bit全探索
    # https://qiita.com/gogotealove/items/11f9e83218926211083a#%E4%BE%8B%E9%A1%8C-1
    for i in range(2 ** 3):
        val=L[0]
        ans=[]
        for j in range(3):  # このループが一番のポイント
            if ((i >> j) & 1):
                val+=L[j+1]
                ans.append('+')
            else:
                val-=L[j+1]
                ans.append('-')
                # 順に右にシフトさせ最下位bitのチェックを行う
        if val==7:
            for k in range(3):
                print('{}{}'.format(L[k],ans[k]),end='')
            print('{}=7'.format(L[3]))
            break





resolve()
Buggy python submission (verdict: Runtime Error):
import string

X,Y=map(int,input().split())
if ord(X)>ord(Y):
    print('>')
elif ord(X)==ord(Y):
    print('=')
else:
    print('<')

Fixed submission:
X,Y=map(str,input().split())
if ord(X)>ord(Y):
    print('>')
elif ord(X)==ord(Y):
    print('=')
else:
    print('<')

Buggy python submission (verdict: Runtime Error):
X,Y=map(int,input().split())
if ord(X)>ord(Y):
    print('>')
elif ord(X)==ord(Y):
    print('=')
else:
    print('<')

Fixed submission:
X,Y=map(str,input().split())
if ord(X)>ord(Y):
    print('>')
elif ord(X)==ord(Y):
    print('=')
else:
    print('<')
Buggy python submission (verdict: Runtime Error):
C=[list(input()) for i in range(2)]
if C[0]==reverse(C[1]):
    print('YES')
else:
    print('NO')

Fixed submission:
C=[list(input()) for i in range(2)]
if C[0][0]==C[1][2] and C[0][1]==C[1][1] and C[0][2]==C[1][0]:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
from scipy.sparse.csgraph import connected_components  # https://note.nkmk.me/python-scipy-connected-components/
from scipy.sparse import csr_matrix

N, M = map(int, input().split())  # 頂点数、辺数
A, B, C = [0] *  M, [0] * M, [1] * (M-1)
for i in range(M):
    A[i], B[i] = map(int, input().split())
    A[i]-=1
    B[i]-=1

cnt = 0
for i in range(M):
    csr = csr_matrix((C, (A[:i] + A[i + 1:], B[:i] + B[i + 1:])), shape=(N, N))
    n, labels = connected_components(csr)
    if n == 2:
       cnt += 1
print(cnt)


Fixed submission:
from scipy.sparse.csgraph import connected_components  # https://note.nkmk.me/python-scipy-connected-components/
from scipy.sparse import csr_matrix

N, M = map(int, input().split())  # 頂点数、辺数
A, B, C = [0] *  M, [0] * M, [1] * (M-1)
for i in range(M):
    A[i], B[i] = map(int, input().split())
    A[i]-=1
    B[i]-=1

cnt = 0
for i in range(M):
    csr = csr_matrix((C, (A[:i] + A[i + 1:], B[:i] + B[i + 1:])), shape=(N, N))
    n, labels = connected_components(csr)
    if n == 2:
       cnt += 1
print(cnt)

Buggy python submission (verdict: Runtime Error):
def input(): return sys.stdin.readline().strip()


def resolve():
    from scipy.sparse.csgraph import connected_components  # https://note.nkmk.me/python-scipy-connected-components/
    from scipy.sparse import csr_matrix

    N, M = map(int, input().split())  # 頂点数、辺数
    A, B, C = [0] *  M, [0] * M, [1] * (M-1)
    for i in range(M):
        A[i], B[i] = map(int, input().split())
        A[i]-=1
        B[i]-=1

    cnt = 0
    for i in range(M):
        #print(B[:i] + B[i + 1:i + M] + B[i + M + 1:])
        #print(A[:i] + A[i + 1:i + M] + A[i + M + 1:])
        csr = csr_matrix((C, (A[:i] + A[i + 1:], B[:i] + B[i + 1:])), shape=(N, N))
        #print(csr)
        #print('haha')
        n, labels = connected_components(csr)
        if n == 2:
           cnt += 1
    print(cnt)


resolve()

Fixed submission:
from scipy.sparse.csgraph import connected_components  # https://note.nkmk.me/python-scipy-connected-components/
from scipy.sparse import csr_matrix

N, M = map(int, input().split())  # 頂点数、辺数
A, B, C = [0] *  M, [0] * M, [1] * (M-1)
for i in range(M):
    A[i], B[i] = map(int, input().split())
    A[i]-=1
    B[i]-=1

cnt = 0
for i in range(M):
    csr = csr_matrix((C, (A[:i] + A[i + 1:], B[:i] + B[i + 1:])), shape=(N, N))
    n, labels = connected_components(csr)
    if n == 2:
       cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():

        H,W=map(int,input().split())
        grid=[[_ for _ in input()] for _ in range(H)]
        for g in grid:
            gg=Counter(g)
            cnt=0
            for i in gg.values():
                if i%2==1:
                    cnt+=1
            if not ((cnt==1 and W%2==1) or (cnt==0 and W%2==0)):
                return 'No'

        grid=zip(*grid)
        W=H
        for g in grid:
            gg=Counter(g)
            cnt=0
            for i in gg.values():
                if i%2==1:
                    cnt+=1
            if not ((cnt==1 and W%2==1) or (cnt==0 and W%2==0)):
                return 'No'
        return 'Yes'
    print(main())







resolve()

Fixed submission:
# ノートに考察メモあり。
from collections import Counter, deque  # https://note.nkmk.me/python-scipy-connected-components/
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()


def resolve():
    def main():
        gg = Counter([])
        H, W = map(int, input().split())
        grid = [[_ for _ in input()] for _ in range(H)]
        for g in grid:
            gg.update(Counter(g))

        if H % 2 == 0 and W % 2 == 0:
            for i in gg.values():
                if i % 4 != 0:
                    return 'No'
            return 'Yes'

        elif H % 2 == 0 and W % 2 == 1:
            cnt = 0
            for i in gg.values():
                if i % 4 == 2:
                    cnt += 2
                elif i % 4 == 1 or i % 4 == 3:
                    return 'No'

            if cnt <= H:
                return 'Yes'
            else:
                return 'No'

        elif H % 2 == 1 and W % 2 == 0:
            cnt = 0
            for i in gg.values():
                if i % 4 == 2:
                    cnt += 2
                elif i % 4 == 1 or i % 4 == 3:
                    return 'No'

            if cnt <= W:
                return 'Yes'
            else:
                return 'No'

        else:
            cnt1 = 0
            cnt2 = 0
            for i in gg.values():
                if i % 4 == 1:
                    cnt1 += 1
                elif i % 4 == 2:
                    cnt2 += 2
                elif i % 4 == 3:
                    cnt2 += 2
                    cnt1 += 1
            if cnt1 == 1 and cnt2 <= (H + W - 2):
                return 'Yes'
            else:
                return 'No'

    print(main())


resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    N=int(input())
    A=list(map(int,input().split()))
    cnt=[0]*N
    for i in range(N):
        for j in range(N):
            if abs(A[i]-A[j])<=1:
                cnt[i]+=1
    print(max(cnt))




resolve()


Fixed submission:
from collections import Counter, deque
# from copy import copy, deepcopy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    A=list(map(int,input().split()))
    AA=Counter(A)
    maxval=0
    for i in AA.keys():
        maxval=max(AA[i-1]+AA[i]+AA[i+1],maxval)

    print(maxval)



resolve()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    A=list(map(int,input().split()))
    cnt=[0]*N
    for i in range(N):
        for j in range(N):
            if abs(A[i]-A[j])<=1:
                cnt[i]+=1
    print(max(cnt))




resolve()

Fixed submission:
from collections import Counter, deque
# from copy import copy, deepcopy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    A=list(map(int,input().split()))
    AA=Counter(A)
    maxval=0
    for i in AA.keys():
        maxval=max(AA[i-1]+AA[i]+AA[i+1],maxval)

    print(maxval)



resolve()
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    n=int(input())
    A=list(map(int,input().split()))
    val=max(A)
    val2=0
    minabs=10**10
    for i in range(n):
        if abs(A[i]-(val//2))<minabs:
            minabs=abs(A[i]-(val//2))
            val2=A[i]
    print(val,val2)    



    
resolve()

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():


    H, W = map(int, input().split())
    N=int(input())
    A = list(map(int,input().split()))

        


    route = []
    for h in range(H):
        if h % 2 == 0:
            route.extend([(h, w) for w in range(W)])
        else:
            route.extend([(h, w) for w in reversed(range(W))])
    
    ans=[[0]*W for _ in range(H)]
    val=1
    i=0
    cnt=0
    for i in range(N):
        for j in range(A[i]):
            ans[route[cnt][0]][route[cnt][1]]=i+1
            cnt+=1
    for i in ans:
        print(*i)



resolve()
Buggy python submission (verdict: Runtime Error):
N=str(inputN=input()
print('ABC{}'.format(N))

Fixed submission:
N=input()
print('ABC{}'.format(N))
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    n,k=map(int,input().split())
    A=list(map(int,input().split()))

    from functools import reduce
    from math import gcd
    G=reduce(gcd,A)

    if k%G==0 and k<=max(A):
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')

resolve()

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    N,K=map(int,input().split())
    A=list(map(int,input().split()))

    ma=max(A)

    from functools import reduce
    from fractions import gcd

    g=reduce(gcd,A)
    if K%g==0 and K<=ma:
        print('POSSIBLE')
    else: print('IMPOSSIBLE')

resolve()

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    N,K=map(int,input().split())
    A=list(map(int,input().split()))

    ma=max(A)

    from functools import reduce
    from math import gcd

    g=reduce(gcd,A)
    if K%g==0 and K<=ma:
        print('POSSIBLE')
    else: print('IMPOSSIBLE')

resolve()

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    N,K=map(int,input().split())
    A=list(map(int,input().split()))

    ma=max(A)

    from functools import reduce
    from fractions import gcd

    g=reduce(gcd,A)
    if K%g==0 and K<=ma:
        print('POSSIBLE')
    else: print('IMPOSSIBLE')

resolve()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    N,P=map(int,input().split())
    A=list(map(int,input().split()))

    # bit全探索
    # https://qiita.com/gogotealove/items/11f9e83218926211083a#%E4%BE%8B%E9%A1%8C-1
    ans=0
    for i in range(2 ** N):
        cnt = 0
        for j in range(N):  # このループが一番のポイント
            if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
                cnt+=A[j]
        if cnt%2==P:
            ans+=1
    print(ans)



resolve()

Fixed submission:
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    N, P = map(int, input().split())
    A = list(map(int, input().split()))
    even=0
    odd=0
    for i in range(N):
        if A[i] % 2==0:
            even+=1
    odd=N-even

    if odd==0:
        print(2**N if P==0 else 0)
    else:
        print(2**(N-1))

resolve()
Buggy python submission (verdict: Runtime Error):
python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    s= str(input())
    ls=len(s)
    cur=ls//2
    i=0
    while True:
        i+=1
        cur-=1
        if s[:cur]==s[cur:ls-i*2]:
            print(ls-i*2)
            break


    
resolve()

Fixed submission:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():
    S=list(input())
    while True:
        S.pop(-1)
        l=len(S)
        if S[:l//2]==S[l//2:]:
            print(l)
            break



resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ls = [False] * 8
    cnt = 0
    for i in A:

        if i<3200:
            ls[i//400]=True
        else:
            cnt += 1

    if ls.count(True)==0:
        if cnt==0:
            minval=0
        else:
            minval=1
    if ls.count(False) <= cnt:
        maxval = 8
    else:
        maxval = 8 - (ls.count(False) - cnt)

    print(minval, maxval)


resolve()

Fixed submission:
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ls = [False] * 8
    cnt = 0
    for i in A:

        if i < 3200:
            ls[i // 400] = True
        else:
            cnt += 1

    if ls.count(True) == 0:
        if cnt == 0:
            minval = 0
        else:
            minval = 1
    else:
        minval = ls.count(True)

    if ls.count(False) <= cnt:
        maxval = 8+cnt-ls.count(False)
    else:
        maxval = 8 - (ls.count(False) - cnt)

    print(minval, maxval)


resolve()
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
# from operator import xor
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    S=[int(input()) for i in range(N)]
    ls=[]
    for i in range(1, N + 1):
        for j in combinations(S,i):
            val=sum(j)
            if val%10!=0:
                ls.append(val)

    print(max(ls,default=0))


resolve()

Fixed submission:
def resolve():
    N=int(input())
    S=sorted([int(input()) for i in range(N)])
    total=sum(S)
    if total%10!=0:
        print(total)
    else:
        for i in range(N):
            if S[i]%10!=0:
                print(total-S[i])
                break
            elif i==N-1:print(0)


resolve()

Buggy python submission (verdict: Runtime Error):
from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
# from operator import xor
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    S=[int(input()) for i in range(N)]
    ls=[]
    for i in range(1, N + 1):
        for j in combinations(S,i):
            val=sum(j)
            if val%10!=0:
                ls.append(val)

    print(max(ls,default=0))


resolve()

Fixed submission:
def resolve():
    N=int(input())
    S=sorted([int(input()) for i in range(N)])
    total=sum(S)
    if total%10!=0:
        print(total)
    else:
        for i in range(N):
            if S[i]%10!=0:
                print(total-S[i])
                break
            elif i==N-1:print(0)


resolve()

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
# from operator import xor
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    S=[int(input()) for i in range(N)]
    ls=[]
    for i in range(1, N + 1):
        for j in combinations(S,i):
            ls.append(j)
    ans=0
    for i in ls:
        if sum(i)%10!=0:
            ans=max(ans,sum(i))
    print(ans)


resolve()

Fixed submission:
def resolve():
    N=int(input())
    S=sorted([int(input()) for i in range(N)])
    total=sum(S)
    if total%10!=0:
        print(total)
    else:
        for i in range(N):
            if S[i]%10!=0:
                print(total-S[i])
                break
            elif i==N-1:print(0)


resolve()
Buggy python submission (verdict: Runtime Error):
A,B,C=map(int,input().split())
#print(sorted(B)[0])
if b-a==c-b:
    print('YES')
else:
    print('NO')

Fixed submission:
a,b,c=map(int,input().split())
#print(sorted(B)[0])
if b-a==c-b:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
A,B,C=map(str,input().split())
#print(sorted(B)[0])
if b-a==c-b:
    print('YES')
else:
    print('NO')

Fixed submission:
a,b,c=map(int,input().split())
#print(sorted(B)[0])
if b-a==c-b:
    print('YES')
else:
    print('NO')