ZhenlongDai/ACPR huggingface dataset:
Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
3
10
20
40

Expected output:
0


Actual output:
70


Fixed submission (verdict: Accepted):
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)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
3
8
10
15

Expected output:
33


Actual output:
33
0


Fixed submission (verdict: Accepted):
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)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
3
1
8
1

Expected output:
9


Actual output:
9
0


Fixed submission (verdict: Accepted):
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
    else:
        print(0)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [int(input()) for _ in range(n)]

a.sort()

suma = sum(a)

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


Failing test case input:
3
10
20
40

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
n = int(input())
a = [int(input()) for _ in range(n)]

a.sort()

suma = sum(a)

if suma % 10 != 0:
  print(suma)
  exit()
else:
  for i in a:
    if i % 10 != 0:
      print(suma - i)
      exit()
print(0)
Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

s = [int(input()) for x in range(N)]

fullmax = sum(s)
s_sorted = sorted(s)

cur_max = 0

if fullmax % 10 != 0 :
    print(fullmax)
else :
    
    div_flg = True
    for i in s :
        if i % 10 != 0 :
            div_flg = False
            
    if div_flg == True :
        print("0")
    else :
        for i in range(N) :
            if fullmax - s_sorted[i] % 10 != 0 :
                cur_max = max(fullmax - s_sorted[i], cur_max)
        
        print(cur_max)

Failing test case input:
3
2
8
0

Expected output:
8


Actual output:
10


Fixed submission (verdict: Accepted):
N = int(input())

s = [int(input()) for x in range(N)]

fullmax = sum(s)
s_sorted = sorted(s)

cur_max = 0

if fullmax % 10 != 0 :
    print(fullmax)
else :
    
    div_flg = True
    for i in s :
        if i % 10 != 0 :
            div_flg = False
            
    if div_flg == True :
        print("0")
    else :
        for i in range(N) :
            if (fullmax - s_sorted[i]) % 10 != 0 :
                cur_max = max(fullmax - s_sorted[i], cur_max)
        
        print(cur_max)

Problem: p03699
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
S = []
for i in range(n):
  S.append(int(input()))
S.sort()
for i in range(n):
  total = sum(S) - S[i]
  if total % 10 == 0:
    continue
  else:
    print(total)
    break
else:
  print(0)

Failing test case input:
3
-390
0
-1

Expected output:
-391


Actual output:
-1


Fixed submission (verdict: Accepted):
n = int(input())
S = []
for i in range(n):
  S.append(int(input()))
S.sort()
if sum(S) % 10 != 0:
  print(sum(S))
else:
  for i in range(n):
    total = sum(S) - S[i]
    if total % 10 == 0:
      continue
    else:
      print(total)
      break
  else:
    print(0)

Problem: p03699
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import itertools

N=int(input())
A=[0]*N
for i in range(N):
    A[i]=int(input())

m=sum(A)

if(m%10==0):
    A=sorted(A)
    for a in A:
        if a%10!=0:
            print(m-a)
            exit()

else:
    print(0)



Failing test case input:
3
0
0
-22

Expected output:
-22


Actual output:
0


Fixed submission (verdict: Accepted):
import itertools

N=int(input())
A=[0]*N
for i in range(N):
    A[i]=int(input())

m=sum(A)

if(m%10==0):
    A=sorted(A)
    for a in A:
        if a%10!=0:
            print(m-a)
            exit()
    print(0)
else:
    print(m)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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()
    else:
      print(0)
      exit()

Failing test case input:
3
2
8
0

Expected output:
8


Actual output:
0


Fixed submission (verdict: Accepted):
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)
Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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


Failing test case input:
3
10
20
40

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
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)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
S = sorted(int(input()) for i in range(n))
ans = sum(S)
for i in range(n):
  if ans % 10 == 0:
    if S[i] % 10 != 0:
      ans -= S[i]
    else:
      continue
print(ans)

Failing test case input:
3
10
20
40

Expected output:
0


Actual output:
70


Fixed submission (verdict: Accepted):
n = int(input())
S = sorted(int(input()) for i in range(n))
ans = sum(S)
cnt = 0
for i in range(n):
  if ans % 10 == 0:
    if S[i] % 10 != 0:
      ans -= S[i]
    else:
      cnt += 1
if cnt == n:
  print(0)
else:
  print(ans)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
3
10
20
40

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
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)

Problem: p03699
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
s = [int(input()) for i in range(N)]

if all(i%10 == 0 for i in s):
    print(0)
    exit()

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

s = sorted(s)

for i in range(N):
    test = s
    del test[i]
    if sum(test)%10 != 0:
        print(sum(test))
        exit()


Failing test case input:
3
2
8
0

Expected output:
8


Actual output:
2


Fixed submission (verdict: Accepted):
N = int(input())
s = [int(input()) for i in range(N)]

if all(i%10 == 0 for i in s):
    print(0)
    exit()

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

test = []
s = sorted(s)
for i in s:
    test.append(i)

for i in range(N):
    test[i] = 0
    if sum(test)%10 != 0:
        print(sum(test))
        exit()
    else:
        test[i] = s[i]
Problem: p03699
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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 S[i] % 10 != 0:
    ans -= S[i]
    print(ans)
    exit()

print(0)


Failing test case input:
3
7
38
40

Expected output:
85


Actual output:
85
78


Fixed submission (verdict: Accepted):
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)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
input_list = sorted([int(input()) for i in range(N)])

result = sum(input_list)

if result % 10 != 0:
    print(result)
else:
    for i in input_list:
        if i % 5 == 0 and i % 10 != 0:
            print(result - i)
            break
    else:
        print(0)

Failing test case input:
3
1
8
1

Expected output:
9


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
input_list = sorted([int(input()) for i in range(N)])

result = sum(input_list)


if result % 10 != 0:
    print(result)

else:
    for i in input_list:
        if i % 10 != 0:
            print(result-i)
            break
    else:
        print(0)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
scr=[int(input()) for i in range(n)]
s=sum(scr)
if s%10==0:
  print(s)
  exit()
scr.sort()
for i in range(n):
  if scr[i]%10!=0:
    print(s-scr[i])
    exit()
print(0)

Failing test case input:
3
5
10
19

Expected output:
34


Actual output:
29


Fixed submission (verdict: Accepted):
n=int(input())
scr=[int(input()) for i in range(n)]
s=sum(scr)
if s%10!=0:
  print(s)
  exit()
scr.sort()
for i in range(n):
  if scr[i]%10!=0:
    print(s-scr[i])
    exit()
print(0)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
s = [int(input()) for _ in range(N)]
s.sort()
ans = 0
if sum(s) % 10 != 0:
  ans = sum(s)
else:
  for S in s:
    if S % 10 != 0 and S % 5 == 0:
      ans = sum(s) - S
      break
print(ans)

Failing test case input:
3
-4
2
22

Expected output:
24


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
s = [int(input()) for _ in range(N)]
s.sort()
ans = 0
if sum(s) % 10 != 0:
  ans = sum(s)
else:
  for S in s:
    if S % 10 != 0:
      ans = sum(s) - S
      break
print(ans)
Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
S = sorted([int(input()) for _ in range(n)])
ans = 0
caution = 0
flag = 1
for s in S:
    ans += s
    if flag:
        if not s%10:
            caution = s
            flag = 0
if ans % 10 == 0:
    if caution:
        ans -= caution
    else:
        ans = 0
print(ans)        

Failing test case input:
3
10
20
30

Expected output:
0

Actual output:
50


Fixed submission (verdict: Accepted):
n = int(input())
S = sorted([int(input()) for _ in range(n)])
ans = 0
caution = 0
flag = 1
for s in S:
    ans += s
    if flag:
        if s % 10:
            caution = s
            flag = 0
if ans % 10 == 0:
    if caution:
        ans -= caution
    else:
        ans = 0
print(ans)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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()

Failing test case input:
3
2
8
0

Expected output:
8


Actual output:
2
8


Fixed submission (verdict: Accepted):
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()

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

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

B = []
for i in range(2**N):
    gokei = 0
    for j in range(N):
        if ((i >> j) & 1):
            gokei += A[j]
    B.append(gokei)

B.sort(reverse=True)

for i in B:
    if i%10 != 0:
        print(i)
        break

Failing test case input:
3
-14
1
2

Expected output:
-11


Actual output:
3


Fixed submission (verdict: Accepted):
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)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
sl = list(int(input()) for _ in range(n))
sl_s = sorted(sl, reverse=True)

add = []
num = 0

for s in sl_s:
    num += s
    add.append(num)

add_s = sorted(add, reverse=True)

for a in add_s:
    if a % 10 != 0:
        print(a)
        break
else:
    print(0)


Failing test case input:
3
-19
9
1

Expected output:
-9


Actual output:
9


Fixed submission (verdict: Accepted):
n = int(input())
sl = list(int(input()) for _ in range(n))

ans_max = sum(sl)
if ans_max % 10 != 0:
    print(ans_max)
else:
    sl_s = sorted(sl)
    for s in sl_s:
        if (ans_max - s) % 10 != 0:
            print(ans_max - s)
            break
    else:
        print(0)
Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    n = int(input())
    test = [int(input()) for i in range(n)]
    score = sum(test)
    test.sort()
    x_test = list(filter(lambda x:x % 10 != 0, test))
    if len(x_test) == 0:
        print(0)
        exit()
    x_test.sort()
    print(score - x_test[0])

if __name__ == '__main__':
    main()


Failing test case input:
3
-166
-2
-1

Expected output:
-169


Actual output:
-3


Fixed submission (verdict: Accepted):
def main():
    n = int(input())
    test = [int(input()) for i in range(n)]
    score = sum(test)
    test.sort()
    x_test = list(filter(lambda x:x % 10 != 0, test))
    if len(x_test) == 0:
        print(0)
        exit()
    elif score % 10 != 0:
        print(score)
        exit()
    x_test.sort()
    print(score - x_test[0])

if __name__ == '__main__':
    main()

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=[0]*n
for i in range(n):
  s[i]=int(input())
s.sort()
ans=sum(s)
temp=0
if ans%10==0:
  for i in range(n):
    if s[i]%10==0:
      temp=temp+1
    else:
      print(ans-s[i])
  if temp==n:
    print(0)
else:
  print(ans)

Failing test case input:
3
1
8
1

Expected output:
9


Actual output:
9
9
2


Fixed submission (verdict: Accepted):
n=int(input())
s=[0]*n
for i in range(n):
  s[i]=int(input())
s.sort()
ans=sum(s)
temp=0
if ans%10==0:
  for i in range(n):
    if s[i]%10==0:
      temp=temp+1
    else:
      print(ans-s[i])
      break
  if temp==n:
    print(0)
else:
  print(ans)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
inputs = [int(input()) for i in range(N)]

points = [int(s) for s in inputs]
points_sorted = sorted(points)

get_point = sum(points)
non_10 = [x for x in points_sorted if (x % 10 != 0)]

if get_point % 10 != 0:
    print(get_point)
elif non_10 == []:
    print(0)
else:
    print(get_point - min(points_sorted))

Failing test case input:
3
2
8
0

Expected output:
8


Actual output:
10


Fixed submission (verdict: Accepted):
N = int(input())
inputs = [int(input()) for i in range(N)]

points = [int(s) for s in inputs]
points_sorted = sorted(points)

get_point = sum(points_sorted)
non_10 = [x for x in points_sorted if (x % 10 != 0)]

if get_point % 10 != 0:
    print(get_point)
elif non_10 == []:
    print(0)
else:
    print(get_point - min(non_10))
Problem: p03699
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
L = [0] * N
for i in range(N):
    L[i] = int(input())

ten = [0]
non = [0]
for i in L:
    if i % 10 == 0:
        ten.append(i)
    else:
        non.append(i)
if (sum(ten) + sum(non))%10 != 0:
    print(sum(ten) + sum(non))
elif non == [0]:
    print(0)
else:
    print((sum(ten) + sum(non))-min(non))

Failing test case input:
3
1
8
1

Expected output:
9


Actual output:
10


Fixed submission (verdict: Accepted):
N = int(input())
L = [0] * N
for i in range(N):
    L[i] = int(input())

ten = []
non = []
for i in L:
    if i % 10 == 0:
        ten.append(i)
    else:
        non.append(i)
if (sum(ten) + sum(non))%10 != 0:
    print(sum(ten) + sum(non))
elif non == []:
    print(0)
else:
    print((sum(ten) + sum(non))-min(non))

Problem: p03699
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

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)

Failing test case input:
3
10
20
40

Expected output:
0


Actual output:
70


Fixed submission (verdict: Accepted):

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)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


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))  

Failing test case input:
3
-34
-1
1

Expected output:
-34


Actual output:
0


Fixed submission (verdict: Accepted):


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))

Problem: p03699
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
S = []
for _ in range(N):
    S.append(int(input()))

s = sum(S)
S.sort()
i = 0
while s != 0:
    if s % 10 != 0:
        break
    s -= S[i]
    i += 1
if s >= 0:
    print(s)
else:
    print(0)

Failing test case input:
3
-156
-1
-1

Expected output:
-158


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
S = []
for _ in range(N):
    S.append(int(input()))

s = sum(S)
if s % 10 != 0:
    print(s)
else:
    S.sort()
    for i in S:
        if i % 10 != 0:
            s -= i
            break
    if s % 10 == 0:
        print(0)
    else:
        print(s)
Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
3
-34
1
0

Expected output:
-33


Actual output:
[-34, 1, 0]
-33


Fixed submission (verdict: Accepted):
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)

Problem: p03699
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

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
    
    
print(Max)

Failing test case input:
3
10
20
30

Expected output:
0

Actual output:
60


Fixed submission (verdict: Accepted):

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)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
s = [int(input()) for i in range(N)]
s.sort()
ans = sum(s)
if ans % 10 != 0:
  print(s)
  exit()
else:
  for i in s:
    if i % 10 != 0:
      print(ans-i)
      exit()
print(0)


Failing test case input:
3
-156
-1
-1

Expected output:
-158


Actual output:
[-156, -1, -1]


Fixed submission (verdict: Accepted):
N = int(input())
s = [int(input()) for i in range(N)]
s.sort()
ans = sum(s)
if ans % 10 != 0:
  print(ans)
  exit()
else:
  for i in s:
    if i % 10 != 0:
      print(ans-i)
      exit()
print(0)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
l=sorted([int(input()) for i in range(n)])
if sum(l)%10!=0:
  print(sum(l))
else:
  ans=sum(l)
  for i in range(n):
    ans-=l[-1-i]
    if ans%10!=0:
      print(ans)
      quit()
  print(0)

Failing test case input:
3
1
8
1

Expected output:
9


Actual output:
2


Fixed submission (verdict: Accepted):
n=int(input())
l=sorted([int(input()) for i in range(n)])
if sum(l)%10!=0:
  print(sum(l))
else:
  ans=sum(l)
  for i in range(n):
    if l[i]%10!=0:
      ans-=l[i]
      print(ans)
      quit()
  print(0)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)


Failing test case input:
3
10
20
40

Expected output:
0


Actual output:
70


Fixed submission (verdict: Accepted):
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)
Problem: p03699
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
s = [int(input()) for _ in range(N)]

ten = 0
other = []

for num in s:
  if num % 10 == 0:
    ten += num
  else:
    other.append(num)
    
if other:
  other.sort()
  print(ten + sum(other[1:]))
  
else:
  print(0)

Failing test case input:
3
-2
0
3

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
N = int(input())
s = [int(input()) for _ in range(N)]

res = 0
other = []

for num in s:
  if num % 10 == 0:
    res += num
  else:
    other.append(num)
    
if other:
  other.sort()
  res += sum(other)
  if res % 10 == 0:
    res -= other[0]
  print(res)
  
else:
  print(0)

Problem: p03699
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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)


Failing test case input:
3
-1
9
14

Expected output:
22


Actual output:
22
22


Fixed submission (verdict: Accepted):
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)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = [int(input()) for i in range(n)]
s.sort()
score = sum(s)
score2 = score
for i in range(n):
    if score2%10 == 0:
        score2 = score - s[i]
    else:
        break
if i ==n-1:
    score2=0
print(score2)


Failing test case input:
3
2
8
0

Expected output:
8


Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input())
s = [int(input()) for i in range(n)]
s.sort()
score = sum(s)
score2 = score
c=0
for i in range(n):
    if score2%10 == 0:
        score2 = score - s[i]
        c+=1
    else:
        break
if c==n:
    score2=0
print(score2)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

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

B = [0]*N
B[0] = A[0]
for i in range(1, N):
    B[i] += B[i-1]+A[i]

B.sort(reverse=True) 

for i in B:
    if i%10 != 0:
        print(i)
        break
else:
    print(0)

Failing test case input:
3
-512
0
-1

Expected output:
-513


Actual output:
-512


Fixed submission (verdict: Accepted):
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)
Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = [int(input()) for i in range(n)]
s.sort()
j = sum([ i % 10 for i in s ])
if j == 0:
    ans = 0
else:
    for i in range(n):
        tmp = sum(s[:i+1])+sum(s[i:])
        if tmp % 10 != 0:
            ans = tmp
            break
print(ans)

Failing test case input:
3
-38
0
0

Expected output:
-38


Actual output:
-76


Fixed submission (verdict: Accepted):
n = int(input())
s = [int(input()) for i in range(n)]
s.sort()
j = sum([ i % 10 for i in s ])
if j == 0:
    ans = 0
else:
    if sum(s) % 10 != 0:
        ans = sum(s)
    else:
        for i in range(n):
            tmp = sum(s)-s[i]
            if tmp % 10 != 0:
                ans = tmp
                break
print(ans)

Problem: p03699
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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)

Failing test case input:
3
1
8
1

Expected output:
9


Actual output:
9
9
2
0


Fixed submission (verdict: Accepted):
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)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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))

Failing test case input:
3
-34
1
0

Expected output:
-33


Actual output:
1


Fixed submission (verdict: Accepted):
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))

Problem: p03699
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
s = sorted([int(input()) for _ in range(n)])
ans = sum(s)
for v in s:
  if ans%10!=0:
    print(ans)
    break
  if v%10==0:
    continue
  ans -= v
else:
  print(ans)

Failing test case input:
3
10
20
40

Expected output:
0


Actual output:
70


Fixed submission (verdict: Accepted):
n = int(input())
s = sorted([int(input()) for _ in range(n)])
ans = sum(s)
for v in s:
  if ans%10!=0:
    print(ans)
    break
  if v%10!=0:
    ans -= v
else:
  print(0)
Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
3
-15
9
1

Expected output:
-5


Actual output:
0


Fixed submission (verdict: Accepted):
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)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


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()

Failing test case input:
3
10
20
30

Expected output:
0

Actual output:
60


Fixed submission (verdict: Accepted):


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()

Problem: p03699
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
s=[int(input()) for _ in range(n)]
t=sum(s)
if t%10!=0 or t==0:
  print(t)
else:
  s.sort()
  for i in s:
    if i%10!=0:
      print(t-i)
      break

Failing test case input:
3
10
20
30

Expected output:
0

Actual output:

Fixed submission (verdict: Accepted):
n=int(input())
s=[int(input()) for _ in range(n)]
t=sum(s)
if t%10!=0 or t==0:
  print(t)
else:
  ans=0
  s.sort()
  for i in s:
    if i%10!=0:
      ans=t-i
      break
  print(ans)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
3
10
20
40

Expected output:
0


Actual output:
60


Fixed submission (verdict: Accepted):
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)
Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
3
-166
-1
1

Expected output:
-166


Actual output:
-166
-166


Fixed submission (verdict: Accepted):
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)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):




n = int(input())
s_list = list()
s_sum = 0
for i in range(n):
    s = int(input())
    s_list.append(s)
    s_sum = s_sum + s


s_list.sort()
print(s_list)


i = 0
while s_sum > 0 and s_sum % 10 == 0:
    if s_list[i] % 10 != 0:
        s_sum = s_sum - s_list[i]
    i = i + 1
    if i >= n:
        s_sum = 0

ans = s_sum


print(ans)

Failing test case input:
3
-2
0
3

Expected output:
1


Actual output:
[-2, 0, 3]
1


Fixed submission (verdict: Accepted):




n = int(input())
s_list = list()
s_sum = 0
for i in range(n):
    s = int(input())
    s_list.append(s)
    s_sum = s_sum + s


s_list.sort()


i = 0
while s_sum > 0 and s_sum % 10 == 0:
    if s_list[i] % 10 != 0:
        s_sum = s_sum - s_list[i]
    i = i + 1
    if i >= n:
        s_sum = 0

ans = s_sum


print(ans)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n = int(input())
s = [int(input()) for _ in range(n)]
s_5 = [s[i] for i in range(n) if s[i] % 10 == 5]

sum_s = sum(s)
s_5.sort()
if sum_s % 10 == 5:
    print(sum_s)
else:
    if len(s_5) == 0:
        print(0)
    else: print(sum_s - s_5[0])

Failing test case input:
3
-166
-2
-1

Expected output:
-169


Actual output:
0


Fixed submission (verdict: Accepted):

n = int(input())
s = [int(input()) for _ in range(n)]
s_5 = [s[i] for i in range(n) if s[i] % 10 != 0]

sum_s = sum(s)
s_5.sort()

if sum_s % 10 != 0:
    print(sum_s)
else:
    if len(s_5) == 0:
        print(0)
    else: print(sum_s - s_5[0])

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
N = int(input())
s, f = [], []
for i in range(N):
    s.append(int(input()))
if sum(s)%10 != 0:
    print(sum(s))
else:
    s.sort()
    for i in range(N):
        f.append(s[i]%10)
    for x in f:
        if x != 0:
            print(sum(s)-x)
            sys.exit()
    print(0)

Failing test case input:
3
-4
2
22

Expected output:
24


Actual output:
14


Fixed submission (verdict: Accepted):
import sys
N = int(input())
s, f = [], []
for i in range(N):
    s.append(int(input()))
if sum(s)%10 != 0:
    print(sum(s))
else:
    s.sort()
    for i in range(N):
        f.append(s[i]%10)
    for i, x in enumerate(f):
        if x != 0:
            print(sum(s)-s[i])
            sys.exit()
    print(0)
Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import itertools

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

Failing test case input:
3
-4
2
22

Expected output:
24


Actual output:
-2


Fixed submission (verdict: Accepted):
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()

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
lst = []
for i in range(n):
  lst.append(int(input()))

not10nums = [i for i in lst if i%10!=0]
subnum=0
if len(not10nums)>0:
  subnum=min(not10nums)
  


  

Failing test case input:
3
-58
-1
0

Expected output:
-59


Actual output:

Fixed submission (verdict: Accepted):


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

not10nums = [i for i in lst if i%10!=0]
subnum=0
if len(not10nums)>0:
  subnum=min(not10nums)
  
sm =sum(lst)
if sm%10==0:
  sm-=subnum
if sm%10==0:
  sm=0
print(sm)

Problem: p03699
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=list(map(int,[input() for i in range(n)]))
a=sum(s)
if a%10!=0:
  print(a)
else:
  s.sort()
  for i in s:
    if i%10!=0:
      a-=i
      print(a)
      break

Failing test case input:
3
10
20
30

Expected output:
0

Actual output:

Fixed submission (verdict: Accepted):
import sys
n=int(input())
s=list(map(int,[input() for i in range(n)]))
a=sum(s)
if a%10!=0:
  print(a)
else:
  s.sort()
  for i in s:
    if i%10!=0:
      a-=i
      print(a)
      sys.exit()
  print(0)

Problem: p03699
Buggy submission (Python (3.8.2), verdict: Wrong Answer):


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

t = []

while sum(s) % 10 == 0 and len(s) > 0:
    if min(s) % 10 != 0:
        s.remove(min(s))
    else:
        t.append(min(s))
        s.remove(min(s))

print(sum(s) + sum(t))

Failing test case input:
3
10
20
40

Expected output:
0


Actual output:
70


Fixed submission (verdict: Accepted):


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)
Problem: p02578
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input(''))
A = input('')
A_N = A.split()
num = 0 
for i in range(1,N):
    if int(A_N[i]) >= int(A_N[i-1]):
        num += 0
    elif (A_N[i]) < (A_N[i-1]):
        num += int(A_N[i-1]) - int(A_N[i])
print(num)

Failing test case input:
5
16 2 5 6 2

Expected output:
49


Actual output:
4


Fixed submission (verdict: Accepted):
N = int(input(''))
A = input('')
a_n = A.split()
A_N = list(map(int, a_n))
num = 0 
for i in range(1,N):
    if A_N[i] >= A_N[i-1]:
        num += 0
    elif A_N[i] < A_N[i-1]:
        num += A_N[i-1] - A_N[i]
        A_N[i] = A_N[i-1]
print(num)

Problem: p02578
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
list = list(map(int,input().split()))

ans = 0
maxV = max(list)
for i,ele in enumerate(list):
    if i == len(list)-1:
        continue

    if ele == maxV:
        for j in range(i+1,len(list)-1):
            
            hoge = maxV-list[j]
            
            ans += hoge
            break

    if ele > list[i+1]:
        
        hoge = ele - list[i+1]
        ans += hoge

print(ans)


Failing test case input:
5
13 0 0 -2 0

Expected output:
54


Actual output:
28


Fixed submission (verdict: Accepted):
n = int(input())
list = list(map(int,input().split()))

ans = 0
maxV = max(list)
maxI = list.index(maxV)

sumV = sum(list[maxI:len(list)])
maxM = maxV * (len(list)-maxI)
ans += maxM - sumV

if maxI != 0:
    for i in range(0,maxI):
        if i != maxI-1:
            x = list[i] - list[i+1]
            if x > 0:
                ans += x
                list[i+1] = list[i+1]+x
print(ans)

Problem: p02578
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
max = a[0]
sum = 0
count = 0
result = 0

for i in range(0,n):
  if max > a[i]:
    count+=1
    sum+=a[i]
    if i == n-1:
      result += max*count-sum
  else:
    result += max*count-sum
    
print(result)

Failing test case input:
5
1 2 -2 44 2

Expected output:
46


Actual output:
6


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
amax = a[0]
asum = 0
acount = 0
result = 0

for i in range(0,n):
  if amax > a[i]:
    acount+=1
    asum+=a[i]
    if i == n-1:
      result += amax*acount-asum
  else:
    result += amax*acount-asum
    amax = a[i]
    asum = 0
    acount = 0

    
print(result)

Problem: p02578
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
total = 0
for i in range(1, n):
  if a[i-1] > a[i]:
    total += a[i-1] - a[i]
    a[i] = a[i-1]

Failing test case input:
5
10 1 5 2 3

Expected output:
29


Actual output:

Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
total = 0
for i in range(1, n):
  if a[i-1] > a[i]:
    total += a[i-1] - a[i]
    a[i] = a[i-1]
print(total)
Problem: p02578
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(1, n):
    if a[i-1] - a[i] < 0:
        ans += abs(a[i-1] - a[i])
print(ans)


Failing test case input:
5
1 2 -2 36 2

Expected output:
38


Actual output:
39


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
ans = 0
m = a[0]
for i in range(1, n):
    m = max(a[i-1], m)
    if a[i] - m < 0:
        ans += abs(a[i] - m)
print(ans)

Problem: p02578
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
ans = 0
for i in range(n-2):
  s = a[i+1] -a[i] 
  if s < 0:
      ans = ans - s
      a[i+1]=a[i]
print(ans)

Failing test case input:
5
2 1 2 16 6

Expected output:
11


Actual output:
1


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
ans = 0
for i in range(n-1):
  s = a[i+1] -a[i] 
  if s < 0:
      ans = ans - s
      a[i+1]=a[i]
print(ans)

Problem: p02578
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = input()
m = input().split()
m = [int(i) for i in m]

mx = max(m)
ind = m.index(mx)

c = 0
j = len(m)
for i in reversed(m[ind:]):
    if i < mx:
        d = mx - i
        c += d
ind_i = 0
for i in m[1:ind]:
    if m[ind_i] > i:
        num = m[ind_i] - i
        c+= num
    ind_i += 1
    
print(c)

Failing test case input:
5
4 0 0 96 -1

Expected output:
105


Actual output:
101


Fixed submission (verdict: Accepted):
n = input()
m = input().split()
m = [int(i) for i in m]
mx = max(m)
ind = m.index(mx)
 
c = 0
j = len(m)
for i in reversed(m[ind:]):
    if i < mx:
        d = mx - i
        c += d
        
ind_i = 0
for i in m[1:ind]:
    
    if m[ind_i] > i:
        num = m[ind_i] - i
        m[ind_i+1] += num
        c+= num
    
    ind_i += 1
    
print(c)

Problem: p02578
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))

list_ans = []

for j in range(1,n):
    stepping_stone = a[j] - a[j-1]
    if stepping_stone > 0:
        list_ans.append(stepping_stone)
    else:
        list_ans.append(0)

ans = sum(list_ans)
print(ans)

Failing test case input:
5
1 0 -6 36 3

Expected output:
41


Actual output:
42


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int,input().split()))

list_ans = []

for j in range(1,n):
    stepping_stone = a[j-1] - a[j]
    if stepping_stone > 0:
        list_ans.append(stepping_stone)
        a[j] += stepping_stone
    else:
        list_ans.append(0)

ans = sum(list_ans)
print(ans)

Problem: p02578
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split())) 
s = [0]*(N-1)
 
for n in range(N-1):
  s[n] = A[n] - A[n+1]
  if s[n] <= 0: 
    continue
  else:
    A[n+1] += s[n]
 
print(sum(s))

Failing test case input:
5
0 1 2 25 1

Expected output:
24


Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split())) 
ans = 0
 
for n in range(N-1):
  t = A[n] - A[n+1]
  if t <= 0: continue
  else:
    A[n+1] += t
    ans += t

print(ans)
Problem: p02578
Buggy submission (Python (3.8.2), verdict: Wrong Answer):


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

diff_sum = 0
for i in range(N-1):
    diff = A[i+1] - A[i]
    if diff > 0:
        diff_sum += diff

print(diff_sum)



Failing test case input:
5
13 1 5 1 2

Expected output:
43


Actual output:
5


Fixed submission (verdict: Accepted):


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

diff_sum = 0
for i in range(N-1):
    if A[i+1] < A[i]:
        diff = A[i] - A[i+1] 
        diff_sum += diff
        A[i+1] += diff


print(diff_sum)

Problem: p02578
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input().rstrip())
As = list(map(int, input().rstrip().split(' ')))

ans = 0

for i in range(N - 1):
    diff = max(As[i + 1] - As[i], 0)
    ans += diff
    As[i + 1] += diff

print(ans)


Failing test case input:
5
4 -1 76 3 0

Expected output:
154


Actual output:
77


Fixed submission (verdict: Accepted):
N = int(input().rstrip())
As = list(map(int, input().rstrip().split(' ')))

ans = 0

for i in range(N - 1):
    diff = max(As[i] - As[i + 1], 0)
    ans += diff
    As[i + 1] += diff

print(ans)

Problem: p02578
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))
S = 0
h = A[0]

for i in range(1, len(A)):
  if A[i] < h:
    S += (h - A[i])
    h = A[i-1]
  else:
    h = A[i]

print(S)

Failing test case input:
5
13 1 5 1 2

Expected output:
43


Actual output:
20


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split()))
S = 0
h = A[0]

for i in range(1, len(A)):
  if A[i] < h:
    S += (h - A[i])
    h = max(h, A[i-1])
  else:
    h = A[i]

print(S)

Problem: p02578
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a=[int(x) for x in input().split()]
mx=0
mae=a[0]
for i in a:
    if i-mae>mx:
        mx=i-mae
    mae=i
print(mx)

Failing test case input:
5
6 0 0 96 -2

Expected output:
110


Actual output:
96


Fixed submission (verdict: Accepted):
n=int(input())
a=[int(x) for x in input().split()]
mx=0
mae=a[0]
for i in a:
    if i<mae:
        mx=mx+mae-i
    else:
        mae=i
print(mx)

Problem: p02578
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
max = a[0]
sum = 0
count = 0
result = 0

for i in range(0,n):
  if max > a[i]:
    count+=1
    sum+=a[i]
  else:
    result += max*count-sum
    
print(result)

Failing test case input:
5
1 0 -6 36 3

Expected output:
41


Actual output:
16


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
amax = a[0]
asum = 0
acount = 0
result = 0

for i in range(0,n):
  if amax > a[i]:
    acount+=1
    asum+=a[i]
    if i == n-1:
      result += amax*acount-asum
  else:
    result += amax*acount-asum
    amax = a[i]
    asum = 0
    acount = 0

    
print(result)
Problem: p02578
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
L = list(map(int,input().split()))
ans = 0
for i in range(0, N-1):
  b = L[i] - L[i+1]
  c = int(b)
  if c >> 0:
    ans = ans + c
    L[i + 1] = L[i]
print(ans)  


Failing test case input:
5
2 1 2 8 4

Expected output:
5


Actual output:
-7


Fixed submission (verdict: Accepted):
N = int(input())
L = list(map(int,input().split()))
ans = 0
for i in range(0, N-1):
  a = L[i]
  b = L[i + 1]
  if a - b > 0:
    ans +=(a - b)
    L[i + 1] = L[i]
print(ans)

Problem: p02578
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
def minimumStoolHeight(A):
    stool_tot = 0
    height_min = 0
    
    if len(A) == 1:
        return A
    
    height_min = A[0]
    for i in range(1, len(A)):
        if A[i] < A[i-1]:
            
            if A[i-1] > height_min:
                height_min = A[i-1]
            stool_tot += (height_min - A[i])
            
            print(i, height_min, stool_tot)
          
    return stool_tot        
        
N = int(input())
A = list(map(int, input().rstrip().split()))
print(minimumStoolHeight(A))

Failing test case input:
5
2 1 0 96 0

Expected output:
99


Actual output:
1 2 1
2 2 3
4 96 99
99


Fixed submission (verdict: Accepted):
def minimumStoolHeight(A):
    stool_tot = 0
    height_min = 0
    
    if len(A) == 1:
        return 0
    
    height_min = A[0]
    for i in range(1, len(A)):
        if A[i] < height_min:
            stool_tot += (height_min - A[i])
        else:
            height_min = A[i]         
            
    return stool_tot  
  
N = int(input())
A = list(map(int, input().rstrip().split()))
print(minimumStoolHeight(A))

Problem: p02578
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))
ans = 0

for i in range(1,N):
    diff = A[i] - A[i - 1]
    if diff <= 0:
        pass
    else:
        ans += diff
        A[i] += diff
print(ans)

Failing test case input:
5
6 0 0 96 -2

Expected output:
110


Actual output:
96


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
ans = 0

for i in range(1,N):
    diff = A[i - 1] - A[i]
    if diff <= 0:
        pass
    else:
        ans += diff
        A[i] += diff
print(ans)

Problem: p02578
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
A = list(map(int, input().split()))

a=0
result=0

for i in range(n-1):
  if A[i] > A[i+1]:
    a = A[i] - A[i+1]
    result += a
    
print(result)

Failing test case input:
5
4 -1 38 3 0

Expected output:
78


Actual output:
43


Fixed submission (verdict: Accepted):
n = int(input())
A = list(map(int, input().split()))

a=0
result=0

for i in range(n-1):
  if A[i] > A[i+1]:
    a = A[i] - A[i+1]
    A[i+1] += a
    result += a
    
print(result)