problem_id
stringclasses
100 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
6
806
p02578
s666243675
Wrong Answer
from sys import stdin input = stdin.readline n = input().rstrip() a = list(map(int, input().split())) ans = 0 for i in range(len(a)-1): if a[i] > a[i+1]: diff = a[i] - a[i+1] ans += diff print(ans)
p02578
s348360146
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: ans+=-diff a[i]=a[i]-diff print(diff) print(ans)
p02578
s800999753
Wrong Answer
#中身の数 n = int(input()) #リスト a = list(map(int,input().split())) #過去最大 p = 0 #前が使った土 q = 0 for i in range(n-1): #前の人との差 e = a[i+1]-a[i]-q if e>0: if e>q: q = 0 else: q -= e else: if p < q-e: p = q-e q = p else: q = q-e print(p)
p02578
s759555699
Wrong Answer
import sys input = sys.stdin.readline N = int(input()) A = list(map(int,input().split())) stool = 0 for i in range(N): for j in range(i+1,i+2): if j >= N: break if A[i] > A[j]: stool += A[i] - A[j] A[j] += 1 continue print(stool)
p02578
s799779697
Wrong Answer
n = int(input()) a = list(map(int, input().split())) Max = a[0] ans = 0 for i in range(n-1): if a[i] < a[i+1]: Max = a[i+1] else: ans += Max-a[i+1] print(ans)
p02578
s553258122
Wrong Answer
N = int(input()) lst = list(map(int, input().split())) lst2 = sorted(lst, reverse=True) l_count = N count = 0 for i in lst2: k_index = lst.index(i) count += (l_count - k_index) * i l_count = k_index for x in lst: count -=x print(count)
p02578
s260844847
Wrong Answer
n = int(input()) a = list(map(int,input().split())) s = a[0] ans = 0 for i in range(1,n): ans += max(0,a[i]-s) s = max(s,a[i]) print(ans)
p02578
s714753728
Wrong Answer
def main(): n = int(input()) a = list(map(int, input().split())) cnt = 0 for i in range(0, n-1): if a[i] < a[i+1]: step = a[i+1] - a[i] cnt = cnt+step print(cnt) main()
p02578
s861062270
Wrong Answer
N = int(input()) L = list(map(int, input().split())) sum = 0 for i in range(N): if L[i-1]>L[i]: sum += L[i-1] - L[i] L[i] = L[i-1] print(sum)
p02578
s994981496
Wrong Answer
N = int(input()) A = list(map(int,input().split())) ans = 0 for i in range(N): if(i == 0): pass else: if(A[i] - A[i-1] <= 0): pass else: tmp = A[i] - A[i-1] ans += tmp A[i] += tmp print(ans)
p02578
s149986365
Wrong Answer
N=int(input()) A=[int(_) for _ in input().split(" ")] ans=0 max=max(A) a=A.index(max) tmp=0 for i in range(a): if tmp < i: tmp=i total=0 for i in range(a): total += a - A[i] for i in range(a,len(A)): total += max -A[i] print(total)
p02578
s897640684
Wrong Answer
n=int(input()) a_list=list(map(int,input().split())) ans=0 tmp=a_list[0] for i in range(n-1): if a_list[i]>=a_list[i+1]: #print(tmp,ans) ans+=tmp-a_list[i+1] else: tmp=a_list[i+1] print(ans)
p02578
s640464343
Wrong Answer
N = int(input()) lst = list(map(int, input().split())) l_count = N count = 0 for i in lst: k_index = lst.index(i) if k_index < l_count: count += (l_count - k_index) * i l_count = k_index for x in lst: count -=x print(count)
p02578
s467894139
Wrong Answer
N = int(input()) A = [int(z) for y, z in enumerate(input().split()) if y < N and z.isdigit()] a = min(A) b = max(A) c = b - a print(c)
p02578
s932805079
Wrong Answer
import sys def main(lines): line = lines if __name__ == '__main__': lines = [] for l in sys.stdin: lines.append(l.rstrip('\r\n')) main(lines)
p02578
s496059758
Wrong Answer
n = int(input()) arr = list(map(int,input().split())) ans = 0 for i in range(1,n): if arr[i]<arr[i-1]: arr[i] += arr[i-1]-arr[i] ans += arr[i-1]-arr[i] print(ans)
p02578
s629105209
Wrong Answer
lst = [] count = 0 n = int(input()) lst = list(map(int, input().split(' ')[:n])) for j in range(len(lst)-1): if lst[j]<lst[j+1]: count = count + (lst[j+1]-lst[j]) else: count = count - (lst[j+1]-lst[j]) print(count)
p02578
s521268298
Wrong Answer
N = int(input()) A = list(map(int, input().split())) print(type(A)) #current height now = 0 total = 0 for a in A: print(type(a)) if a >= now: now = a pass else: total += now - a print(total)
p02578
s263043051
Wrong Answer
# -*- coding: utf-8 -*- 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)
p02578
s085111952
Wrong Answer
n = int(input()) a_L = list(map(int,input().split())) if len(a_L) == 1: print(0) exit() ans = 0 for i in range(0,len(a_L)-1): if a_L[i] > a_L[i+1]: ans += abs(a_L[i+1] - a_L[i]) a_L[i+1] = a_L[i] print(ans) if a_L[-2] > a_L[-1]: ans += abs(a_L[-1]-a_L[-2]) print(ans)
p02578
s516870812
Wrong Answer
n = int(input()) a = [int(i) for i in input().split()] ans=0 for i in range(n-1): d = a[i-1] - a[i] if d<0: ans+= d+1 a[i]=a[i]+d+1 else: continue print(abs(ans))
p02578
s649438263
Wrong Answer
n = int(input()) H = list(map(int, input().split())) mh = 0 cnt = 0 for i in range(n - 1): mh = max(mh, H[i]) if H[i] <= H[i + 1]: continue else: if H[i + 1] < H[i]: cnt += max(cnt, mh - H[i + 1]) print(cnt)
p02578
s002473438
Wrong Answer
from sys import stdin length = int(stdin.readline()) heights = stdin.readline().split(" ") stool = 0 for i in range(1, length): if heights[i-1] > heights[i]: stool += (int(heights[i-1]) - int(heights[i])) heights[i] = heights[i-1] print(int(stool))
p02578
s731255157
Wrong Answer
import numpy as np N = int(input()) A = list(map(int, input().split())) A = np.array(A) max_ind = np.argmax(A) min_array = np.full(max_ind, A[0]) max_array = np.full(len(A)-max_ind, max(A)) bin_array = np.hstack((min_array, max_array)) hikizan = bin_array - A y = np.where(hikizan < 0) if y != 0: hikizan[y] = 0 print(np.sum(hikizan))
p02578
s718689781
Wrong Answer
N = int(input()) members = list(map(int, input().strip().split())) stands = [] for i, member in enumerate(members): if i>0: if members[i] > members[i-1]: stands.append(0) else: stands.append(members[i-1] - members[i]) print(sum(stands))
p02578
s943680981
Wrong Answer
n = int(input()) l = list(map(int,input().split())) m = l[0] s = 0 for x in range(1,n): if l[x-1]>l[x]: s+=(m - l[x]) else: m = l[x] print(s)
p02578
s811572181
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)
p02578
s206465653
Wrong Answer
n = int(input()) a = list(map(int,input().split())) hights = int() for i in range(n-1): if(i == n): break if(a[i] > a[i+1]): hights =hights + a[i] - a[i+1] # a[i+1] =a[i+1] + (a[i] - a[i+1]) else: continue #print(a) print(hights)
p02578
s468947545
Wrong Answer
N = int(input()) A = list(map(int, input().split())) step = max(A)-min(A) print(step)
p02578
s395673892
Wrong Answer
if __name__ == "__main__": n = int(input()) x =list((int(x) for x in input().split())) print(x) tmp1 = 0 tmp2 = x[0] for i in range(1,n): if tmp2 > x[i]: tmp3 = tmp2 - x[i] tmp1 += tmp3 x[i] = x[i] + tmp3 tmp2 = x[i] else: tmp1 += 0 tmp2 = x[i] print(tmp1)
p02578
s069960650
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: ans+=-diff a[i]=a[i]-diff
p02578
s408034483
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)
p02578
s943184626
Wrong Answer
n = int(input()) inputs = input().split() As = [] sum = 0 step =0 for i in inputs: As.append(int(i)) try: for i in range(len(As)): if As[i] < As[i + 1]: step = As[i + 1] - As[i] sum += step except: pass print(sum)
p02578
s621784025
Wrong Answer
n=int(input()) a=[int(x) for x in input().split()] mx=0 mae=a[0] for i in a: mx+=i-mae mae=i print(mx)
p02578
s056044397
Wrong Answer
N = int(input()) A = list(map(int,input().split())) count=0 for i in range(N): try: a = A[i] b = A[i+1] if a <= b: pass else: c = abs(a-b) count+=c except: pass print(count)
p02578
s213225444
Wrong Answer
def solve(): n = int(input()) a = list(map(int, input().split())) mi = 0 le = len(a) cost = 0 for i in range(le-1): if a[i] > a[i+1]: mi = max(a[i], mi) cost += mi - a[i+1] print(cost) return 0 if __name__ == "__main__": solve()
p02578
s807833772
Wrong Answer
n=int(input()) arr=list(map(int,input().split())) prev=arr[0] ma=0 for i in arr[1:]: if i>=prev: ma=max(ma,i-prev) prev=i print(ma)
p02578
s633027968
Wrong Answer
n = int(input()) a = list(map(int,input().split())) res=0 if n==1: print(0) for i in range(1,n): if a[i]<a[i-1]: res= ( a[i-1] - a[i] ) + res a[i] = a[i-1] print(res)
p02578
s659357678
Wrong Answer
n = int(input()) a = list(map(int, input().split())) ans = 0 tmp = 0 for i in range(1,n): tmp = max(a[i-1], tmp) ans += tmp - a[i] print(ans)
p02578
s192848568
Wrong Answer
n = int(input()) a = list(map(int,input().split())) c = 0 for i in range(n): if a[i-1] > a[i]: b = a[i-1]-a[i] c += b else: c +=0 print(c)
p02578
s053335879
Wrong Answer
n=int(input()) a=list(map(int,input().split())) b=0 c=[] for i in range(n-1): c.append(a[i]) if a[i]>a[i+1]: b+=max(c)-a[i+1] print(b)
p02578
s992988265
Wrong Answer
N = int(input()) A = list(map(int, input().split())) ans = 0 gap = 0 for i in range(1, N): if A[i-1] > A[i]: ans += A[i-1]-A[i] + gap gap += A[i-1]-A[i] else: gap = 0 print(ans)
p02578
s006288620
Wrong Answer
n = int(input()) a = input() a = a.split() count = 0 boo = False for i in a: if int(i) >= n: boo = True else: count += 1 if(boo): print(count) else: print(0)
p02578
s180995203
Wrong Answer
n = int(input()) a = list(map(int, input().split())) ans = 0 t = a[0] for i in range(1, n): ans += max(a[i] - a[i-1], 0) print(ans)
p02578
s003033134
Wrong Answer
n=int(input()) a=list(map(int,input().split())) m=0 ans=0 for i in range(n): if i==0: m=max(a[i],m) else: if a[i]<m: ans+=1 else: m=a[i] print(ans)
p02578
s556333835
Wrong Answer
n = int(input()) a = list(map(int, input().split())) max_int = max(a) ans = 0 for i in range(n): if i == 0 and max_int: continue elif i < max_int: ans += 1 print(ans)
p02578
s773006448
Wrong Answer
N = int(input()) A = input().split() # print(A) A_list = list(map(float, A)) sa = 0 for i in range(N-1): # print(i) if A_list[i] > A_list[i+1]: sa += A_list[i] - A_list[i+1] A_list[i+1] = A_list[i] print(sa)
p02578
s921349806
Wrong Answer
a=input() b=input() c=b.split() d=map(int,c) main=list(d) sum=0 print(main) for i in range(len(main)-2): stool=main[i]-main[i+1] if stool>0: main[i+1]+=stool sum+=stool stool=main[len(main)-2]-main[len(main)-1] if stool>0: sum+=stool main[len(main)-1]+=stool print("sum = ",sum, "main = ",main)
p02578
s068486885
Wrong Answer
n=int(input()) a=list(map(int,input().split())) s=0 i=n while i>1: maxi=max(a[0:i]) s+=(i-a.index(maxi))*maxi i=a.index(maxi) print(s-sum(a))
p02578
s284514606
Wrong Answer
N=int(input()) A = list(map(int,input().split())) target=A[0] cost=0 for v in range(N-1): B=A[v+1]-A[v] if B>=0: target=A[v+1] elif B<0: cost+=target-A[v+1] print(cost)
p02578
s862145968
Wrong Answer
lst = [] count = 0 n = int(input()) lst = list(map(int, input().split(' ')[:n])) for j in range(len(lst)-1): if lst[j]<=lst[j+1]: count = count + (lst[j+1]-lst[j]) else: count = count + 0 print(count)
p02578
s961374078
Wrong Answer
def c_step(n, ls): acc = 0 for i in range(n - 1): if ls[i] > ls[i + 1]: stool = ls[i] - ls[i + 1] ls[i + 1] += stool acc += stool return acc
p02578
s196278397
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)
p02578
s917274541
Wrong Answer
n=int(input()) a=list(map(int,input().split(" "))) s=0 for x in range(1,n): s=s+max(0,a[x]-a[x-1]) print(s)
p02578
s058104525
Wrong Answer
N = int(input()) A = list(map(int, list(input().split()))) total = 0 for i in range(0, N-1): step = A[i+1] - A[i] if step > 0 : total = total + step A[i] = A[i] + step print(total)
p02578
s064737054
Wrong Answer
n = int(input()) wa = 0 l = list(map(int, input().split())) for i in range(1, n): m = max(l[i], max(l[:i])) if m >= l[i]: wa += max(l[:i]) - l[i] print(wa)
p02578
s679286570
Wrong Answer
N = int(input()) A = list(map(int, input().split())) max_num = 0 for num in A: if num > max_num: max_num = num border = A.index(max_num) height = [] before_h = A[0] for h in A[:border]: if before_h <= h: height.append(0) elif before_h > h: height.append(before_h-h) before_h = h for h in A[border:]: height.append(max_num-h) print(sum(height))
p02578
s591456237
Wrong Answer
n = int(input()) A = list(map(int,input().split())) smallest = A[0] ans = 0 for x in range(len(A)-1): if A[x] < A[x+1]: ans += A[x+1] - A[x] print(ans)
p02578
s920831376
Wrong Answer
n = input() a_list = list(map(int, input().split())) score = 0 for i in range(len(a_list) - 1): if a_list[i] > a_list[i+1]: score += a_list[i] - a_list[i+1] print(score)
p02578
s485184616
Wrong Answer
import sys import math def get_array(): return list(map(int, sys.stdin.readline().strip().split())) def get_ints(): return map(int, sys.stdin.readline().strip().split()) def input(): return sys.stdin.readline().strip() n=int(input()) a=get_array() print(max(a)-min(a))
p02578
s211982446
Wrong Answer
N = int(input()) array = list(map(int,input().split())) d,f = 0,0 ans = [0] for i in range(1,N): n = array[i] d = f - n if d >= 0: ans.append(d) else: ans.append(0) f = max(ans[0:i]) print( sum(ans) )
p02578
s707817403
Wrong Answer
n = int(input()) a_list = list(map(int, input().split())) _sum = 0 for e in range(len(a_list)): # print('aaa') if e != 0 : # print('bbb') if a_list[e] < a_list[e - 1] : # print('ccc') _sum = _sum + (a_list[e - 1] - a_list[e]) print(_sum)
p02578
s646929669
Wrong Answer
N = int(input()) A = list(map(int,input().split())) tmp = [0]*N s = 0 for i in range(1,N): if A[i] >= A[i-1]+s: s = A[i] - A[i-1] - s tmp[i] = s ans = sum(tmp) print(ans)
p02578
s185713621
Wrong Answer
n = int(input()) input_line = input().split() member = [int(input_line[i]) for i in range(n)] stands = 0 for i in range(1,n): stand = member[i] - member[i-1] if stand > 0: stands += stand member[i] += stand print(stands)
p02578
s904459466
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) a[j] += stepping_stone else: list_ans.append(0) ans = sum(list_ans) print(ans)
p02578
s576793674
Wrong Answer
N = int(input()) A = list(map(int, input().split())) max_num = 0 for num in A: if num > max_num: max_num = num border = A.index(max_num) height = [] before_h = A[0] for h in A[:border]: if before_h <= h: height.append(0) elif before_h > h: height.append(before_h-h) before_h = h for h in A[border:]: height.append(max_num-h) print(sum(height))
p02578
s918831096
Wrong Answer
As = list(map(int, input().split())) sum_humidai = 0 for person_idx, person_height in enumerate(As): if person_idx == 0: continue max_front_person = max(As[:person_idx]) if max_front_person > person_height: humidai = max_front_person - person_height sum_humidai += humidai print(sum_humidai)
p02578
s308718428
Wrong Answer
N = int(input()) A = list(map(int,input().split())) K = 0 for i in range(0,N-2): if A[i+1] < A[i] + K: K += A[i]-A[i+1] + K else: K += 0 print(K)
p02578
s769405848
Wrong Answer
n = input() a = input().split() b = int(a[0]) c = 0 for i in range(int(n)): if int(a[i]) < b: c = b - int(a[1]) else: b = int(a[i]) print(c)
p02578
s708406638
Wrong Answer
N = int(input()) A = list(map(int, input().split())) maxi = max(A) index_maxi = A.index(maxi) sum = 0 if index_maxi != 0: mini_max = max(list(A[:index_maxi])) for i in A[index_maxi:]: sum += (maxi - i) for j in A[:index_maxi]: sum += (mini_max - j) print(sum)
p02578
s052143522
Wrong Answer
N = int(input()) A = list(map(int,input().split())) A.reverse() mx1 = A[0] mx2 = 0 for i in range(1,N): mx1 = max(mx1,A[i]) mx2 = max(mx2,mx1-A[i]) print(mx2)
p02578
s899766882
Wrong Answer
N=int(input()) A=list(map(int,input().split())) fum=0 for i in range(N): if (A[i]<A[i-1]): B=A[i-1]-A[i] fum = fum+B else: fum=fum print(fum)
p02578
s537486939
Wrong Answer
n = int(input()) wa = 0 m = 0 l = list(map(int, input().split())) for i in range(1, n): m = max(l[i], m) if m >= l[i]: wa += max(l[:i]) - l[i] print(wa)
p02578
s923546368
Wrong Answer
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(1,n): print(a[i-1], a[i]) if a[i-1] <= a[i]: continue else: ans += a[i-1] - a[i] a[i] = a[i-1] print(ans)
p02578
s342958744
Wrong Answer
n=int(input()) arr=list(map(int,input().split())) ma=0 for i in range(1,n): ma=max(ma,arr[i]-arr[i-1]) print(ma)
p02578
s359711479
Wrong Answer
N=int(input()) A=list(map(int,input().split())) a=0 s=[] for i in A: if i<a: s.append(i-a) a=i print(sum(s))
p02578
s050221231
Wrong Answer
#coding: utf-8 from collections import defaultdict import sys N = int(input()) A = [int(x) for x in input().split()] step = 0 prev = 0 for a in A: if a < prev: step = max(step, prev-a + 1) a += step prev = a # print(a) print(step)
p02578
s588362596
Wrong Answer
n = int(input()) lis = list(map(int, input().split())) count = 0 for i in range(n-1): if lis[i] < lis[i+1]: count += lis[i+1] - lis[i] print(count)
p02578
s536196115
Wrong Answer
n = int(input()) a = list(map(int,input().split())) ans = 0 for i in range(1,n-1): ans += max(0,a[i+1]-a[i]) print(ans)
p02578
s621836644
Wrong Answer
n = int(input()) a = list(map(int, input().split())) max_a = max(a) min_a = min(a) ans = max_a - min_a print(ans)
p02578
s394948880
Wrong Answer
n = int(input()) A = list(map(int, input().split())) dp = [0 for i in range(n)] dp[0] = A[0] cnt = 0 for i in range(1, len(A)): # if(A[i] > dp[i-1]+A[i-1] if(A[i] <= A[i-1]): dp[i] = dp[i-1] cnt += dp[i] - A[i] else: dp[i] = A[i] print(cnt)
p02578
s550498792
Wrong Answer
n = int(input()) a = list(map(int,input().split())) b = [] c = 0 for i in range(1,n): s = a[i-1]-a[i] if s >= 0: s = s+c b.append(s) c = s else: c = 0 print(sum(b))
p02578
s736011264
Wrong Answer
N = int(input()) A = list(map(int,input().split())) cost = 0 if N == 1: print(0) for i in range(1,N): if A[i-1] > A[i]: cost += A[i-1] - A[i] A[i] = A[i-1] print(cost)
p02578
s205983748
Wrong Answer
n = int(input()) As = list(map(int, input().split())) h = 0 for i in range(n - 1): d = As[i + 1] - As[i] if d > 0: As[i+1] += d h += d print(h)
p02578
s815707144
Wrong Answer
n = int(input()) row = list(map(float, input().split())) ans = 0 for index in range(1,n): if row[index] < row[index - 1]: ans += row[index - 1] - row[index] row[index] = row[index - 1] print(ans)
p02578
s779376131
Wrong Answer
n = int(input()) a = list(map(int, input().split())) ans = 0 tmp = 0 for i in range(1,n): if a[i-1] > a[i]: tmp = max(a[i-1], tmp) ans += tmp - a[i] print(ans)
p02578
s640714952
Wrong Answer
N = int(input()) A = list(map(int,input().split())) K = 0 for i in range(0,N-2): if A[i+1]-A[i]<0: K += A[i]-A[i+1] else: K += 0 print(K)
p02578
s502184697
Wrong Answer
n,*a=map(int,open(0).read().split()) ma=a[0] ans=0 for q in a: if q>ma: ans+=(q-ma) ma=q print(ans)
p02578
s103017761
Wrong Answer
n = int(input()) a = list(map(int,input().split())) s = 0 for i in range(n-1): s += max(a[i+1] - a[i],0) print(s)
p02578
s692546731
Wrong Answer
N = int(input()) line = input() A = [int(l) for l in line.split()] total = 0 for i in range(N-1): diff = A[i-1] - A[i] if diff > 0 : total = total + diff A[i] = A[i] + diff print(total)
p02578
s864018719
Wrong Answer
n=int(input()) s=list(map(int,input().split())) ans=0 for i in range(n-1): ans+=max(s[i+1]-s[i],0) s[i+1]=max(s[i+1],s[i]) print(ans)
p02578
s052093801
Wrong Answer
n = int(input()) a=list(map(int, input().split())) ans = 0 print(len(a)) for i in range(n-1): x = max(0, a[i+1] - a[i]) ans += x a[i+1] += x print(ans)
p02578
s379495628
Wrong Answer
n=int(input()) l=list(map(int,input().split())) t=0 x=0 for i in range(n): if t>l[i]: x+=t-l[i] t=l[i] print(x)
p02578
s802711728
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))
p02578
s123184345
Wrong Answer
N = int(input()) A = [int(x) for x in input().split()[:N]] temp = 0 overall = 0 # for i in range(N): # S = int(input()) # A.append(S) for i in range(0, len(A) -1 ): if A[i] > A[i+1]: temp = A[i] - A[i+1] A[i + 1] += 1 overall += temp print(overall)
p02578
s199427306
Wrong Answer
n=int(input()) a=list(map(int, input().split())) list=[0] hl=[a[0]] for i in range(1,n): if a[i]>=a[i-1]: list.append(0) else: mn=max(hl) tmp=mn-a[i] list.append(tmp) hl.append(a[i]) print(sum(list))
p02578
s580636520
Wrong Answer
n=int(input()) a=list(map(int,input().split())) s=0 for i in range(1,n): s+=max(0,a[i-1]-a[i]) print(s)
p02578
s106747300
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)
p02578
s036721350
Wrong Answer
N = int(input()) A = list(map(int,input().split())) total=0 for i in range(N): if A[i]<A[i-1]: total+=A[i-1]-A[i] else: total+=0 print(total)
p02578
s375286613
Wrong Answer
N = int(input()) A = list(map(int,input().split())) B = A[0] ans = 0 for i in range(N): if B < A[i]: ans += B - A[i] B = A[i] print(ans)