problem_id
stringclasses
100 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
6
806
p02578
s606113618
Wrong Answer
for _ in range(1): n=int(input()) a=list(map(int,input().split())) k=a[0] ans=0 for i in range(n): if i==0: m=a[i] a[i]=0 else: m=max(m,a[i]) a[i]=m-a[i] u=0 for i in range(n): ans+=max(0,a[i]-u) u=a[i] print(ans)
p02578
s192492300
Wrong Answer
N = int(input()) A = list(map(int, input().split()))[::-1] max_val = 0 ret = 0 for i in range(1,N): if A[i] > max_val: max_val = A[i] for j in range(0, i): ret += max_val - A[j] print(ret)
p02578
s519095255
Wrong Answer
def abc176_c(): n = int(input()) a = list(map(int, input().split(' '))) ans = 0 current_h = 0 # 前の人が大きい時はa[i-1] - a[i]分の台が必要 for i in range(1, len(a)): if i == 1: current_h = a[i] if a[i - 1] > a[i]: current_h = max(a[i - 1], current_h) ans += current_h - a[i] print(ans) if __name__ == '__main__': abc176_c()
p02578
s091791932
Wrong Answer
# coding=utf-8 if __name__ == '__main__': N = int(input()) li = list(map(int, input().split())) M = max(li) # print(M) MV = li[0] C = 0 hai = li.index(M) #print(hai) for i in range(N): if i < hai: if MV > li[i]: C += MV - li[i] else: C += M - li[i] #print(C) print(C)
p02578
s030445633
Wrong Answer
N=int(input()) *A,=map(int,input().split()) Step=[0] maxt=A[0] i=0 while i<N-1: if A[i]<A[i+1]: maxt=max(maxt,A[i+1]) s=0 else: # A[i]>=A[i+1] s=maxt-A[i+1] Step+=[s] i+=1 print(sum(Step))
p02578
s866825431
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)
p02578
s403686424
Wrong Answer
n=int(input()) arr=list(map(int,input().split())) ans=0 for i in range(n-1): val=max(0,arr[i+1]-arr[i]) ans+=val arr[i]+=val print(ans)
p02578
s142343274
Wrong Answer
N = int(input()) an = list(map(int,input().split())) solve = [] ans = 0 maxnum = 0 for i in range(1,N): if maxnum < i: ans += max(an[maxnum:i+1]) - an[i] maxnum = an[i] if maxnum >= i: ans += maxnum - an[i] print(ans)
p02578
s188261495
Wrong Answer
n = int(input()) a = list(map(int, input().split())) highest = 0 diff = 0 a = a[::-1] for i in a: diff = max(highest - i, diff) if i > highest: highest = i print(diff)
p02578
s950106613
Wrong Answer
n=int(input()) ppl=(input().split()) answer=0 for x in range(0,n-1): ppl[x]=int(ppl[x]) ppl[x+1]=int(ppl[x+1]) if ppl[x]>ppl[x+1]: answer+=ppl[x]-ppl[x+1] ppl[x+1]=ppl[x] answer
p02578
s582844753
Wrong Answer
# t=int(input()) # for _ in range(t): n=int(input()) arr=[int(x) for x in input().split()] maxa=arr[0] count=0 for i in range(n): if arr[i] > maxa: maxa=arr[i] else: count+=1 print(count)
p02578
s428151364
Wrong Answer
from math import ceil def mlt(): return map(int, input().split()) x = int(input()) s = list(mlt()) res = 0 for n in range(1, x): if s[n] < s[n-1]: d = s[n-1]-s[n] res += d s[n] += 1 print(res)
p02578
s003429047
Wrong Answer
N=int(input()) Alist=list(map(int,input().split())) sum=0 if N==1: print(0) else: for i in range(1,N): if Alist[i]<Alist[i-1]: sum=sum+Alist[i-1]-Alist[i] Alist[i]=Alist[i-1] print(sum)
p02578
s446174789
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
s661619785
Wrong Answer
n = int(input()) a = list(map(int,input().split())) ans = 0 cnt = a[0] for i in range(1,n): ans += max(cnt-a[i],0) cnt = max(a[i-1],a[i]) print(ans)
p02578
s498253381
Wrong Answer
n = int(input()) a = list(map(int, input().split())) ans = 0 maxi = 0 for i in range(n-1): if a[i] > a[i + 1]: if a[i] > maxi: maxi = a[i] ans += maxi - a[i+1] print(ans)
p02578
s064319897
Wrong Answer
# AtCoder Beginner Contest 176 # C - Step N=int(input()) Als=list(map(int,input().split())) ans=0 for i in range (1,N): if Als[i]>=Als[i-1]: pass else : ans+= max(Als[0:i])-Als[i] print(ans)
p02578
s766566134
Wrong Answer
n = int(input()) a = list(map(int,input().split())) b = [] c = 0 for i in range(n-1): s = a[i]-a[i+1] s = max(c,s) if s >= 0: b.append(s) c = s print(sum(b))
p02578
s883864508
Wrong Answer
n=int(input()) l=list(map(int,input().split())) ans=0 maxt=0 for i in l: if i<maxt: ans+=matx-1 maxt=max(i,maxt) print(ans)
p02578
s068427557
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 print(tmp1)
p02578
s991305491
Wrong Answer
N = int(input()) lst = list(map(int, input().split())) lst2 = sorted(set(lst), reverse=True) l_count = N count = 0 for i in lst2: k_index = lst.index(i) count = count + (l_count - k_index) * i l_count = k_index print(count-sum(lst))
p02578
s043569810
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 = max(c,s) else: c = 0 b.append(c) print(sum(b))
p02578
s722608937
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(int(sum(s)))
p02578
s913257918
Wrong Answer
N=int(input()) A=list(map(int,input().split())) S=0 i=N while i>1: saidai=max(A[0:i]) S +=(i-A.index(saidai))*saidai i=A.index(saidai) print(S-sum(A))
p02578
s886322143
Wrong Answer
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(1, n): if a[i] > a[i - 1]: ans += a[i] - a[i - 1] print(ans)
p02578
s291209293
Wrong Answer
#N=int(input()) #A=list(map(int,input().split())) N=200000 A=[i for i in range(1,200001)] ans=sum(A) s=N+1 j=s if A==sorted(A): print(0) exit() for i in range(N//2): x=max(A[:s]) s=A.index(x) A[s:j]=[x]*len(A[s:j]) j=s if A==sorted(A): break print(sum(A)-ans)
p02578
s163653805
Wrong Answer
n = int(input()) H = list(map(int, input().split())) mh = 0 ans = 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(ans, mh - H[i + 1]) ans += cnt print(ans)
p02578
s345902933
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)): hoge = maxV-list[j] # print("no", i, "maxV hoge=", hoge) ans += hoge break if ele > list[i+1]: hoge = ele - list[i+1] # print("no", i, "minus hoge=", hoge) ans += hoge print(ans)
p02578
s725612250
Wrong Answer
n=int(input()) a=list(map(int,input().split())) ans,k=0,a[0] for i in range(1,n): if a[i]>k: ans+=a[i]-k k=a[i] print(ans)
p02578
s027415096
Wrong Answer
n = int(input()) list = list(map(int,input().split())) ans = 0 maxV = max(list) maxI = list.index(maxV) sumV = sum(list[maxI+1:len(list)]) maxM = maxV * (len(list)-1-maxI) ans += maxM - sumV if maxI != 0: for i in range(0,maxI): if i != maxI: x = list[i] - list[i+1] if x > 0: ans += x print(ans)
p02578
s481927614
Wrong Answer
N=int(input()) A=list(map(int,input().split())) X=0 for i in range(N-1): if A[i+1]>A[i]: X+=A[i+1]-A[i] print(X)
p02578
s052722659
Wrong Answer
N = int(input()) Alist = list(map(int,input().split())) dailist = [0]*N Alist.append(0) dailist.append(0) max = 0 for i in range(N): if Alist[i]>max: max=Alist[i] if Alist[i]>Alist[i+1]: dailist[i+1]=max-Alist[i+1] del dailist[-1] print (sum(dailist))
p02578
s672857131
Wrong Answer
n = int(input()) a = list(map(int, input().split())) ans = 0 maxh = 0 for i in range(len(a)-1): if maxh < a[i]: maxh = a[i] if a[i] > a[i+1]: ans += maxh - a[i+1] print(ans)
p02578
s727062062
Wrong Answer
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(len(a)-1): if a[i]>a[i+1]: ans += a[i] - a[i+1] print(ans)
p02578
s067647852
Wrong Answer
n=int(input()) l=map(int,input().split()) ans=0 maxt=0 for i in l: if i<maxt: ans+=maxt-i maxt=max(i,maxt) print(ans)
p02578
s578134793
Wrong Answer
import sys input = sys.stdin.readline import numpy as np n = int(input()) A = [int(a) for a in input().strip().split()] pre = A[0] s = 0 for a in A: ad = max(0, a-pre) pre = a + ad s += ad print(s)
p02578
s416797330
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)
p02578
s108962594
Wrong Answer
N = int(input()) A = list(map(int,input().split())) pre = A[0] ans = 0 for i in range(len(A)): now = A[i] if pre < now: ans += now - pre pre = now print(ans)
p02578
s831212830
Wrong Answer
N = int(input()) A = list(map(int,input().split())) B = [0] * N # 踏み台の高さ ans = 0 for i in range(1,N): h = 0 if A[i] < A[i-1]: h = B[i-1]+A[i-1] - A[i] else: h = 0 B[i] = h for i in range(N): ans += B[i] # print(B) print(ans)
p02578
s286506240
Wrong Answer
import numpy as np N = int(input()) A = list(map(int, input().split())) A = np.array(A) maximum = max(A) if len(set(A)) == 1: print(0) else: max_point = int(np.where(A == maximum)[0]) ans = [A[0]] for i in range(1, max_point): ans.append(A[0]) for j in range(max_point+1): ans.append(maximum) print(sum(ans) - sum(A))
p02578
s079978645
Wrong Answer
x = [list(map(int, input().split())) for i in range(2)] print(x) A = x[1] step = 0 num_min = 1000 for i in range(len(A)-1): if A[i] > A[i+1]: for j in range(A[i] - A[i+1]): step += 1 A[i+1] += 1 else: continue print(step)
p02578
s821272036
Wrong Answer
n = int(input()) s = list(map(int, input().split())) print(s) top = s[0] count = 0 for x in s : if x <= top : count = count + top - x else : top = x print(count)
p02578
s930150082
Wrong Answer
N = int(input()) A_high_list = list(map(int,input().split())) Fumidai = 0 s = 0 B_list = [] for n in range(N): if n > 0 and A_high_list[n-1] > A_high_list[n]: B_list.append(A_high_list[n-1]) s = max(B_list) - A_high_list[n] Fumidai += s else: continue print(Fumidai)
p02578
s495052379
Wrong Answer
import bisect,collections,copy,heapq,itertools,math,numpy,string import sys sys.setrecursionlimit(10**7) def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LS(): return list(sys.stdin.readline().rstrip().split()) def main(): N = I() A = LI() a_max = A[0] ans = 0 for i in range(1,len(A)): if A[i]>a_max: ans += A[i]-A[i-1] a_max = A[i] print(ans) main()
p02578
s433666335
Wrong Answer
item = input().split() total_num = item[0] fumidai_sum = 0 before_tall = 0 for idx, tall in enumerate(item[1:]): tall = int(tall) if idx == 0: before_tall = tall continue else: if before_tall > tall: fumidai_sum += (before_tall - tall) else: before_tall = tall print(fumidai_sum)
p02578
s995066492
Wrong Answer
def main(): n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(1, len(a)): humidai = max(0, a[i] - a[i-1]) ans += humidai a[i] += humidai print(ans) if __name__ == '__main__': main()
p02578
s235130312
Wrong Answer
N = int(input()) A = list(map(int, input().split())) ans = 0 h = A[0] for a in A: if h > a: ans += h - a h = a print(ans)
p02578
s186710954
Wrong Answer
N = input() A = list(map(int,input().split())) raw =sum(A) con = 0 if len(A) == 1: print(A[0]) else: for i in A: if A[con] > A[con+1]: A[con+1] = A[con] if A[con+1] == A[-1]: break con += 1 ans = sum(A) - raw print(ans)
p02578
s744397675
Wrong Answer
N = int(input())#整数 A = list(map(int, input().split()))#配列Int型 ans = 0 max_val = A[0] for i in range(1, N): if max_val > A[i]: ans = max_val - A[i] else: max_val = A[i] print(ans)
p02578
s990656197
Wrong Answer
n = int(input()) a_list = list(map(int, input().split())) step_ttl = 0 step = 0 for i, a in enumerate(a_list): if i == 0: continue if a_list[i-1] < a: step = 0 continue if a < step + a_list[i-1]: step = (step + a_list[i-1]) - a step_ttl += step print(step_ttl)
p02578
s472392869
Wrong Answer
import sys li = lambda : [int(x) for x in sys.stdin.readline().strip().split()] rw = lambda : sys.stdin.readline().strip().split() ni = lambda : int(sys.stdin.readline().strip()) nsi = lambda : sys.stdin.readline().strip() from collections import defaultdict as df import math n=ni() l=list(map(int,input().split())) mn=l[0] ans=0 for i in range(1,n): if(mn<l[i]): mn=l[i] print(l[i]) else: ans+=mn-l[i] print(ans)
p02578
s712631604
Wrong Answer
N=int(input()) Alist=list(map(int,input().split())) sum=0 if N==1: print(0) else: for i in range(1,N): if Alist[i]<=Alist[i-1]: sum=sum+Alist[i-1]-Alist[i] Alist[i]=Alist[i-1] print(sum)
p02578
s741720573
Wrong Answer
n = int(input()) a = list(map(int,input().split())) b = [] c = 0 for i in range(1,n): c = max(c,a[i-1]) s = c-a[i] if s >= 0: b.append(s) print(b)
p02578
s466863958
Wrong Answer
N = int(input()) array = list(map(int,input().split())) d,f = 0,0 ans = [] for i in range(N): if i == 0: ans.append(0) f = array[0] continue n = array[i] d = n - f if d >= 0: ans.append(d) else: ans.append(0) f = n print( sum(ans) )
p02578
s425812124
Wrong Answer
n = int(input()) vals = list(map(int, input().split())) ma = vals[0] res = [0 for _ in range(n)] for i, val in enumerate(vals): if val < ma: res[i] = ma - val if ma < val: ma = val print(max(res))
p02578
s388889916
Wrong Answer
N = int(input()) A = list(map(int, input().split())) A.sort() diff = [] for i in range(N - 1): diff.append(A[i + 1] - A[i]) print(sum(diff))
p02578
s974532749
Wrong Answer
n = int(input()) a = list(map(int,input().split())) ans = 0 #a.insert(0,0) a.append(999999999) tmp = 0 for i in range(n): #print(tmp) if a[i] <= a[i+1]: tmp = 0 continue else: tmp = a[i] - a[i+1] a[i+1] += tmp ans += tmp print(ans) #print(a)
p02578
s315974729
Wrong Answer
# -*- coding: utf-8 -*- # スペース区切りの整数の入力 #N, K = map(int, input().split()) # 文字列の入力 N = input() #開業されたN個要素を受け付ける input_list = list(map(int, input().split())) i=1 ans = 0 while i < len(input_list): if(input_list[i] < input_list[i-1]): tmp = input_list[i-1] - input_list[i] ans = ans + tmp input_list[i] = input_list[i] + 1 i = i+1 print(ans)
p02578
s467154202
Wrong Answer
n = int(input()) a = list(map(int, input().split())) s = [0] * n for i in range(1, n): if a[i] - a[i - 1] <= 1: s[i] = a[i - 1] - a[i] a[i] = a[i - 1] print(sum(s))
p02578
s892684109
Wrong Answer
n = int(input()) a_L = list(map(int,input().split())) tall = a_L[0] ans = 0 diff = 0 for i in range(1,len(a_L)): if tall < a_L[i]: diff = abs(tall - a_L[i]) tall = a_L[i] else: tall = a_L[i] diff = 0 ans += diff print(ans)
p02578
s712340962
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
s160975533
Wrong Answer
N = int(input()) A = list(map(int, input().split())) sum_ = 0 for i in range(N - 1): if A[i] > A[i - 1]: diff = A[i] - A[i - 1] sum_ += diff print(sum_)
p02578
s611304311
Wrong Answer
n = int(input()) a = list(map(int, input().split())) result = 0 for i in range(1, n): hoge = a[i] a[i] = a[i]+(a[i]-a[i-1]) if a[i]-a[i-1] > 0 else a[i] result += a[i] - hoge print(result)
p02578
s239776923
Wrong Answer
a= int(input()) mod = a%9 if mod==0: print('Yes') else: print('No')
p02578
s499647027
Wrong Answer
N = int(input()) A = list(map(int, input().split())) ans=0 for i in range(1, len(A)): if A[i] >= A[i-1]: ans = ans + A[i] - A[i-1] print(ans)
p02578
s889253070
Wrong Answer
import copy n = int(input()) a = input().split() list = copy.copy(a) ans = 0 for i in range(1,n): if a[i] < a[i-1]: a[i] = a[i-1] for j in range(n): if a[j] != list[j]: ans += int(a[j]) - int(list[j]) print(ans)
p02578
s602942361
Wrong Answer
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) # print(sumV, maxM) ans += maxM - sumV if maxI != 0: for i in range(0,maxI): if i != maxI: x = list[i] - list[i+1] if x > 0: ans += x print(ans)
p02578
s418480625
Wrong Answer
N = int(input()) A = [int(i) for i in input().split()] s = [0]*N for i,n in enumerate(A[1:]): s[i] = max(0, A[i] - A[i-1]) print(sum(s))
p02578
s532954469
Wrong Answer
number = int(input()) values = [int(i) for i in input().split()] sum = 0 max = max(values) min = min(values) while max != min: temp = max/2 for element in values: if max >= element > temp: sum += (int(max) - element) print(max, element) if int(temp) <= min: sum += (int(max) - min) max = int(temp) print(sum)
p02578
s865572460
Wrong Answer
N = int(input()) A = input().replace(" ","") Alist = list(A) An = list(map(int,Alist)) sum = 0 for i in range(1,N): if An[i-1]<=An[i]: continue else: sum += (An[i-1]-An[i]) An[i] = An[i-1] print(sum)
p02578
s695182800
Wrong Answer
n = int(input()) a = list(map(int,input().split())) c = 0 for i in range(1,n): if a[i-1]>a[i]: c += (a[i-1]-a[i]) print(c)
p02578
s021047868
Wrong Answer
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(n-1): if a[i] > a[i+1]: ans += a[i]-a[i+1] a[i-1] = a[i] print(ans)
p02578
s120535546
Wrong Answer
n = int(input()) s = list(map(int, input().split())) print(s) top = s[0] count = 0 for x in s : if x <= top : count = count + top - x else : top = x print(str(count))
p02578
s308353131
Wrong Answer
n=int(input()) a=list(map(int,input().split())) print(max(a)-min(a))
p02578
s228155749
Wrong Answer
N = input() lists = list(map(int, input().split())) high_sum = 0 for x in range(int(N)): if lists[x - 1] < lists[x]: a = lists[x] - lists[x - 1] high_sum += a else: continue print(high_sum)
p02578
s493734994
Wrong Answer
N=int(input()) A=list(map(int,input().split())) B=list() B.append(A[0]) for i in range(1,N): if A[i-1]-A[i]>0: B.append(B[i-1]) else: B.append(A[i]) print(sum(B)-sum(A))
p02578
s748804034
Wrong Answer
N = int(input()) ary_A = list(map(int, input().split())) h_sum = 0 for i in range(len(ary_A) - 1): diff = ary_A[i + 1] - ary_A[i] if diff > 0: h_sum += diff print(h_sum)
p02578
s273375462
Wrong Answer
N=int(input()) A=list(map(int, input().split())) sum=0 for i in range(N-1): if A[i]>A[i+1]: sum+=A[i]-A[i+1] A[i+1]=2*A[i]-A[i+1] #print(sum) #print(A) print(sum)
p02578
s785611179
Wrong Answer
n = int(input()) a = list(map(int,input().split())) b = [] c = 0 for i in range(n-1): s = a[i]-a[i+1] if s >= 0: s = s+c b.append(s) c = s else: c = 0 print(sum(b))
p02578
s930893710
Wrong Answer
N = input() lists = list(map(int, input().split())) high_sum = 0 for x in range(int(N)): if lists[x - 1] < lists[x]: a = lists[x] - lists[x - 1] high_sum += a else: continue print(high_sum)
p02578
s406955919
Wrong Answer
n = int(input()) a = list(map(int,input().split())) x = 0 total = 0 for i in range(n): if a[i-1] >= a[i]: x = a[i-1] - a[i] total += x i = i+1 else: total += 0 i = i+1 print(total)
p02578
s047746779
Wrong Answer
N = int(input()) A = list(map(int,input().split())) sum_height = 0 max_height = A[0] for i in range(1,len(A)): if A[i] < A[i-1]: sum_height += max_height - A[i] else: max_height = A[i] print(sum_height)
p02578
s605351322
Wrong Answer
N = int(input()) A = list(map(int, input().split())) sum=0 for i in range(N-1): if A[i+1]>A[i]: sum+=A[i+1]-A[i] A[i+1]=A[i] print(sum)
p02578
s938261904
Wrong Answer
# -*- coding: utf-8 -*- # 整数の入力 N = int(input()) Ai = input().split() Ai_i = list(map(int, Ai)) now_ind = -1 tmp_list = Ai_i count = 0 while True: max_value = max(tmp_list) now_ind = tmp_list.index(max_value) if now_ind == 0: break count = count + sum(list(map(lambda x: max_value - x, tmp_list[now_ind:len(tmp_list)]))) tmp_list = tmp_list[0:now_ind] print(count)
p02578
s980002913
Wrong Answer
def main(): n = int(input()) As = list(map(int, input().split())) r = 0 max_a = max(As) for a in range(n-1, -1, -1): if(a == 0): break splitAs = As[0:a-1] if As[a] < As[a-1]: if(max_a not in splitAs): max_a = As[a-1] tmp = As[a-1] - As[a] r += tmp if tmp + As[a] < max_a: r += max_a - (tmp + As[a]) print(r) main()
p02578
s499920333
Wrong Answer
total = int(input()) tall = list(map(int, input().split())) dif = 0 for i in range(total - 1): if tall[i] > tall[i+1]: var = tall[i] - tall[i+1] tall[i+1] += var dif += var else: pass print(dif) print(tall)
p02578
s489905775
Wrong Answer
N = int(input()) As = list(map(int , input().split())) mx = As[-1] sm = 0 for i in range(len(As)-2,-1,-1): if As[i] < mx: sm+= mx - As[i] mx = As[i] print(sm)
p02578
s193644064
Wrong Answer
n = int(input()) a = list(map(int, input().split())) s = 0 for i in range(0, n - 1): h = a[i] - a[i+1] if h > 0: s += h a[i] += h print(str(s))
p02578
s087971529
Wrong Answer
addNum = 0 n = input() s = input().split() for i in range(len(s)-1): if(s[i]>s[i+1]): print a = int(s[i]) b = int(s[i+1]) c = a-b s[i+1] = s[i] addNum += c print(addNum)
p02578
s516602731
Wrong Answer
import sys N = int(sys.stdin.readline()) A = list(map(int, sys.stdin.readline().split())) count = 0 for i in range(N-1): A[i] > A[i+1] A[i + 1] = A[i + 1] + 1 count += 1 print(count)
p02578
s267992377
Wrong Answer
N = int(input()) H = list(map(int, input().split())) T = 0 for i in range(N): if int(H[i-1]) - int(H[i]) > 0: T += int(H[i-1]) - int(H[i]) H[i-1] = H[i] print(T)
p02578
s782338586
Wrong Answer
N = int(input()) A = list(map(int,input().split())) total = 0 mxm = A[0] for i in range(1,N): if A[i-1]<A[i]: mxm = A[i] else: total += (mxm - A[i]) print(total)
p02578
s605883446
Wrong Answer
N = int(input()) A = [int(i) for i in input().split()] for i in range(N-1): if A[i] > A[i+1]: S = A[i] - A[i+1] K = A[i+1] + S A[i+1] = K print(A)
p02578
s809118769
Wrong Answer
# AtCoder Beginner Contest 176 # C - Step N=int(input()) Als=list(map(int,input().split())) ans=0 for i in range (1,N): if Als[i]>=Als[i-1]: pass else : ans+= abs(max(Als[0:i])-Als[i]) print(ans)
p02578
s307216783
Wrong Answer
N = int(input()) A = list(map(int,input().split())) total = 0 mxm = A[0] for i in range(1,N): if A[i-1]<=A[i]: mxm = A[i] else: total += (mxm - A[i]) print(total)
p02578
s849061142
Wrong Answer
N = int(input()) A = [int(x) for x in input().split()] buf = 0 for i in range(N-1) : if A[i] - A[i+1] >0 : buf += A[i] - A[i+1] if A[N-2] - A[N-1] >0 : buf += A[N-2] - A[N-1] print(buf)
p02578
s543762946
Wrong Answer
l=list(map(int,input().split())) ans=0 max=0 for i in l: if i<max: ans+=max-1 max=max(i,max) print(ans)
p02578
s922686075
Wrong Answer
a=int(input()) b=list(map(int,input().split())) c=0 for i in range(a-1): if b[i]>b[i+1]: c=c+b[i]-b[i+1] print(c)
p02578
s266759249
Wrong Answer
n=int(input()) l=map(int,input().split()) ans=0 maxt=0 for i in l: if i<maxt: ans+=maxt-1 maxt=max(i,maxt) print(ans)
p02578
s959161387
Wrong Answer
n = int(input()) a = list(map(int, input().split( ))) front = 0 step = 0 for height in a : x = 0 if front > height : x = front - height step += x print(front, height, x) if front < height: front = height print(step)