Buggy python submission (verdict: Runtime Error):
N = int(input())
h = list(map(int,input().split()))
ans = True
for i in range(N-1,-1,-1):
    if h[i] > h[i+1]:
        h[i]-=1
for i in range(N-1):
    if h[i] <= h[i+1]:
        ans = True
    else:
        ans = False
        break
if ans:
    print('Yes')
else:
    print('No')

Fixed submission:
N = int(input())
h = list(map(int,input().split()))
ans = True
for i in range(N-2,-1,-1):
    if h[i] > h[i+1]:
        h[i]-=1
for i in range(N-1):
    if h[i] <= h[i+1]:
        ans = True
    else:
        ans = False
        break
if ans:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
N = int(input())
h = list(map(int,input().split()))
flag = True

for i in range(N-1):
    if h[i] > h[i+1]:
        h[i] -= 1
for i in range(N-1):
    if h[i] > h[i+1]:
        print('No')
        sys.exit()
print('Yes')

Fixed submission:
N = int(input())
h = list(map(int,input().split()))
ans = True
for i in range(N-2,-1,-1):
    if h[i] > h[i+1]:
        h[i]-=1
for i in range(N-1):
    if h[i] <= h[i+1]:
        ans = True
    else:
        ans = False
        break
if ans:
    print('Yes')
else:
    print('No')

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

Fixed submission:
N = int(input())
h = list(map(int,input().split()))
ans = True
for i in range(N-2,-1,-1):
    if h[i] > h[i+1]:
        h[i]-=1
for i in range(N-1):
    if h[i] <= h[i+1]:
        ans = True
    else:
        ans = False
        break
if ans:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
N = int(input())
h = list(map(int,input().split()))
flag = 0

for i in range(1,N):
    if h[i-1] > h[i]:
        h[i-1] -= 1

for i in range(1,N):
    if h[i-1] <= h[i]:
        flag = 1
    else:
        flag = 0
        break

if flag == 1:
    print('Yes')
else:
    print('No')
N = int(input())
h = list(map(int,input().split()))
flag = 0

for i in range(1,N):
    if h[i-1] > h[i]:
        h[i-1] -= 1

for i in range(1,N):
    if h[i-1] <= h[i]:
        flag = 1
    else:
        flag = 0
        break

if flag == 1:
    print('Yes')
else:
    print('No')


Fixed submission:
N = int(input())
h = list(map(int,input().split()))
ans = True
for i in range(N-2,-1,-1):
    if h[i] > h[i+1]:
        h[i]-=1
for i in range(N-1):
    if h[i] <= h[i+1]:
        ans = True
    else:
        ans = False
        break
if ans:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
N = int(input())
h = list(map(int,input().split()))

for i in range(1,N):
    if h[i-1] > h[i]:
        h[i-1] -= 1

for i in range(1,N):
    if h[i-1] <= h[i]:
        flag = 1
    else:
        flag = 0
        break

if flag == 1:
    print('Yes')
else:
    print('No')


Fixed submission:
N = int(input())
h = list(map(int,input().split()))
ans = True
for i in range(N-2,-1,-1):
    if h[i] > h[i+1]:
        h[i]-=1
for i in range(N-1):
    if h[i] <= h[i+1]:
        ans = True
    else:
        ans = False
        break
if ans:
    print('Yes')
else:
    print('No')