Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
h_list=[int(x) for x in input().split()]

flag=True

for j in range(1,len(h_list)):
    for i in range(len(h_list)-j):  
        if h_list[i]-h_list[i+j]>=2:
            flag=False
            break
    
if flag:
    print("Yes")
else:
    print("No")

Fixed submission:
N=int(input())
h_list=[int(x) for x in input().split()]

flag=True

m=h_list[0]
for j in range(len(h_list)-1):
    if m<h_list[j]:
        m=h_list[j]
    if m-h_list[j+1]>=2:
        flag=False
        break        
    
if flag:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N=int(input())
h_list=[int(x) for x in input().split()]

flag=True

for j in range(1,len(tmp)):
    for i in range(len(h_list)-j):  
        if h_list[i]-h_list[i+j]>=2:
            flag=False
            break
    
if flag:
    print("Yes")
else:
    print("No")

Fixed submission:
N=int(input())
h_list=[int(x) for x in input().split()]

flag=True

m=h_list[0]
for j in range(len(h_list)-1):
    if m<h_list[j]:
        m=h_list[j]
    if m-h_list[j+1]>=2:
        flag=False
        break        
    
if flag:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
h_list=[int(x) for x in input().split()]
flag=True
for i in range(len(h_list)-1):   
    if sorted(h_list)==h_list:
        flag=True
        break
        
    tmp=h_list[i:]
    if tmp[0]-min(tmp[1:])>=2:
        flag=False
        break
        
if flag:
    print("Yes")
else:
    print("No")

Fixed submission:
N=int(input())
h_list=[int(x) for x in input().split()]

flag=True

m=h_list[0]
for j in range(len(h_list)-1):
    if m<h_list[j]:
        m=h_list[j]
    if m-h_list[j+1]>=2:
        flag=False
        break        
    
if flag:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
h_list=[int(x) for x in input().split()]

flag=True
for i in range(len(h_list)-1):    
    tmp=h_list[i:]
    if tmp[0]-min(tmp[1:])>=2:
        flag=False
        break
        
if flag:
    print("Yes")
else:
    print("No")

Fixed submission:
N=int(input())
h_list=[int(x) for x in input().split()]

flag=True

m=h_list[0]
for j in range(len(h_list)-1):
    if m<h_list[j]:
        m=h_list[j]
    if m-h_list[j+1]>=2:
        flag=False
        break        
    
if flag:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
h_list=[int(x) for x in input().split()]

flag=True

for j in range(1,len(h_list)):
    for i in range(len(h_list)-j):
        tmp=h_list[i:i+1+j]
        if tmp[0]-tmp[j]>=2:
            flag=False
            break
    
if flag:
    print("Yes")
else:
    print("No")

Fixed submission:
N=int(input())
h_list=[int(x) for x in input().split()]

flag=True

m=h_list[0]
for j in range(len(h_list)-1):
    if m<h_list[j]:
        m=h_list[j]
    if m-h_list[j+1]>=2:
        flag=False
        break        
    
if flag:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
h_list=[int(x) for x in input().split()]
flag=True
for i in range(len(h_list)-1):    
    tmp=h_list[i:]
    for i in range(len(tmp)-1):        
        if tmp[0]-tmp[i+1]>=2:
            flag=False
            break
        
if flag:
    print("Yes")
else:
    print("No")

Fixed submission:
N=int(input())
h_list=[int(x) for x in input().split()]

flag=True

m=h_list[0]
for j in range(len(h_list)-1):
    if m<h_list[j]:
        m=h_list[j]
    if m-h_list[j+1]>=2:
        flag=False
        break        
    
if flag:
    print("Yes")
else:
    print("No")