Buggy python submission (verdict: Runtime Error):
N=int(input())
matchNums=input().split(" ")
matchNums=list(map(int, matchNums))
plus_flgs=[]

if len(matchNums)==1:
    print("Yes")
    
else:
    check_array=[]
    check_array_all=[]
    
    for i in range(len(matchNums)-1):
        check_array.append((matchNums[i+1] - matchNums[i]))
    
#     for i in range(len(check_array)-1):
#         check_array_all.append((check_array[i+1] + check_array[i]))
    #プラスとプラスの間を足す
    #プラスのinedex取得
    for i,val in enumerate(check_array):
        if val > 0:
            plus_flgs.append(i)
    
    # 最後がマイナスで終わるとき対策
    plus_flgs.append(len(check_array))
    for i in range(len(plus_flgs)-1):
        check_array_all.append(sum(check_array[plus_flgs[i]+1: plus_flgs[i+1]]))
    
    # 微分値が-2の物があったらＮＧ
    if min(check_array_all)<-1:
        print("No")
    else:
        print("Yes")

Fixed submission:
N=int(input())
matchNums=input().split(" ")
matchNums=list(map(int, matchNums))
plus_flgs=[-1]

if len(matchNums)==1:
    print("Yes")
    
else:
    check_array=[]
    check_array_all=[]
    
    for i in range(len(matchNums)-1):
        check_array.append((matchNums[i+1] - matchNums[i]))
    
#     for i in range(len(check_array)-1):
#         check_array_all.append((check_array[i+1] + check_array[i]))
    #プラスとプラスの間を足す
    #プラスのinedex取得
    for i,val in enumerate(check_array):
        if val > 0:
            plus_flgs.append(i)
    
    # 最後がマイナスで終わるとき対策
    plus_flgs.append(len(check_array))
#     print(plus_flgs)
#     print(check_array)
    for i in range(len(plus_flgs)-1):
        check_array_all.append(sum(check_array[plus_flgs[i]+1: plus_flgs[i+1]]))
#     print(check_array_all)
    # プラスとプラスの間の和が-2の物があったらＮＧ
    if min(check_array_all)<-1:
        print("No")
    else:
        print("Yes")

Buggy python submission (verdict: Runtime Error):
N=int(input())
matchNums=input().split(" ")
matchNums=list(map(int, matchNums))
plus_flgs=[]

if len(matchNums)==1:
    print("Yes")
    
else:
    check_array=[]
    check_array_all=[]
    
    for i in range(len(matchNums)-1):
        check_array.append((matchNums[i+1] - matchNums[i]))
    
#     for i in range(len(check_array)-1):
#         check_array_all.append((check_array[i+1] + check_array[i]))
    #プラスとプラスの間を足す
    #プラスのinedex取得
    for i,val in enumerate(check_array):
        if val > 0:
            plus_flgs.append(i)
    
    # 最後がマイナスで終わるとき対策
    plus_flgs.append(len(check_array))
    for i in range(len(plus_flgs)-1):
        check_array_all.append(sum(check_array[plus_flgs[i]+1: plus_flgs[i+1]]))
    
    # 微分値が2の物があったらＮＧ
    if max(check_array[:-1])>1 or min(check_array[:-1])<-1:
        print("No")
    else:
        if min(check_array_all)<-1:
            print("No")
        else:
            print("Yes")

Fixed submission:
N=int(input())
matchNums=input().split(" ")
matchNums=list(map(int, matchNums))
plus_flgs=[-1]

if len(matchNums)==1:
    print("Yes")
    
else:
    check_array=[]
    check_array_all=[]
    
    for i in range(len(matchNums)-1):
        check_array.append((matchNums[i+1] - matchNums[i]))
    
#     for i in range(len(check_array)-1):
#         check_array_all.append((check_array[i+1] + check_array[i]))
    #プラスとプラスの間を足す
    #プラスのinedex取得
    for i,val in enumerate(check_array):
        if val > 0:
            plus_flgs.append(i)
    
    # 最後がマイナスで終わるとき対策
    plus_flgs.append(len(check_array))
#     print(plus_flgs)
#     print(check_array)
    for i in range(len(plus_flgs)-1):
        check_array_all.append(sum(check_array[plus_flgs[i]+1: plus_flgs[i+1]]))
#     print(check_array_all)
    # プラスとプラスの間の和が-2の物があったらＮＧ
    if min(check_array_all)<-1:
        print("No")
    else:
        print("Yes")