Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
h_=list()
cnt=0
for i in range(n-1):
  if h[i]>h[i+1]:
    h_.append(h[i]-1)
  else:
    h_.append(h[i])
h_.append(h[n-1])
for i in range(n-1):
  if h_[i]>h_[i+1]:
    cnt=1
if cnt=0:
  print('Yes')
else:
  print('No')


Fixed submission:
n=int(input())
h=list(map(int,input().split()))
for i in range(1,n):
  if h[-i]+1==h[-i-1]:
    h[-i-1]-=1
  elif h[-i]+1<h[-i-1]:
    print('No')
    exit()
print('Yes')

Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
h_=list()
cnt=0
for i in range(n-1):
  if h[i]>h[i+1]:
    h_.append(h[i]-1)
  else:
    h_.append(h[i])
h_.append(h[i])
for i in range(n-1):
  if h_[i]>h_[i+1]:
    cnt=1
if cnt=0:
  print('Yes')
else:
  print('No')


Fixed submission:
n=int(input())
h=list(map(int,input().split()))
for i in range(1,n):
  if h[-i]+1==h[-i-1]:
    h[-i-1]-=1
  elif h[-i]+1<h[-i-1]:
    print('No')
    exit()
print('Yes')

Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
h_=list()
cnt=0
for i in range(n-1):
  if h[i]>h[i+1]:
    h_.append(h[i]-1)
  else:
    h_.append(h[i])
for i in range(n-1):
  if h_[i]>h_[i+1]:
    cnt=1
if cnt=0:
  print('Yes')
else:
  print('No')


Fixed submission:
n=int(input())
h=list(map(int,input().split()))
for i in range(1,n):
  if h[-i]+1==h[-i-1]:
    h[-i-1]-=1
  elif h[-i]+1<h[-i-1]:
    print('No')
    exit()
print('Yes')

Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
h_=list()
cnt=0
for i in range(n-1):
  if h[i]>h[i+1]:
    h_.append(h[i]-1)
  else:
    h_.append(h[i])
for i in range(n-1):
  if l[i]>l[i+1]:
    cnt=1
if cnt=0:
  print('Yes')
else:
  print('No')


Fixed submission:
n=int(input())
h=list(map(int,input().split()))
for i in range(1,n):
  if h[-i]+1==h[-i-1]:
    h[-i-1]-=1
  elif h[-i]+1<h[-i-1]:
    print('No')
    exit()
print('Yes')

Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
cnt=0
for i in range(n-1):
  if h[i+1]<h[i]:
    cnt=1
if cnt==1:
  if min(h)=<max(h)=<1+min(h):
    print('Yes')
  else:
    print('No')
else:
  print('Yes')


Fixed submission:
n=int(input())
h=list(map(int,input().split()))
for i in range(1,n):
  if h[-i]+1==h[-i-1]:
    h[-i-1]-=1
  elif h[-i]+1<h[-i-1]:
    print('No')
    exit()
print('Yes')

Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
cnt=0
for i in range(n):
  if h[i+1]<h[i]:
    cnt=1
if cnt==1:
  if min(h)=<max(h)=<1+min(h):
    print('Yes')
  else:
    print('No')
else:
  print('Yes')

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
for i in range(1,n):
  if h[-i]+1==h[-i-1]:
    h[-i-1]-=1
  elif h[-i]+1<h[-i-1]:
    print('No')
    exit()
print('Yes')

Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
cnt=0
for i in range(n):
  if h[i+1]>h[i]+1:
    cnt=1
if cnt==0:
  print('Yes')
else:
  print('No')
    


Fixed submission:
n=int(input())
h=list(map(int,input().split()))
for i in range(1,n):
  if h[-i]+1==h[-i-1]:
    h[-i-1]-=1
  elif h[-i]+1<h[-i-1]:
    print('No')
    exit()
print('Yes')

Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
for i in range(n):
  if h[i+1]>h[i]+1:
    print('No')
    exit()
print('Yes')
    

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
for i in range(1,n):
  if h[-i]+1==h[-i-1]:
    h[-i-1]-=1
  elif h[-i]+1<h[-i-1]:
    print('No')
    exit()
print('Yes')