ZhenlongDai/ACPR huggingface dataset:
Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
H = list(map(int, input().split()))


result = "Yes"

for i in range(1, N):
    if H[i] + 1 < H[i - 1]:
        H[i] -= 1
        result = "No"
        
        
print(result)

Failing test case input:
4
1 3 2 1

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
H = list(map(int, input().split()))

result = "Yes"


for i in range(1, N)[::-1]:
    if H[i - 1] <= H[i]:
        continue
    elif H[i - 1] - H[i] == 1:
        H[i - 1] -= 1
    else:
        result = "No"

print(result)

Problem: p02953
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
h=list(map(int,input().split()))

for i in range(h.index(max(h))+1,n):
    if max(h)-h[i]>=2:
        print('No')
        exit()
print('Yes')

Failing test case input:
5
2 2 0 1 5

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
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
x=sorted(h)

print('Yes' if x==h else 'No')

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
h = [int(i) for i in input().split()]
count = 0
if n == 1:
    count += 1
else:
    for i in range(1,n-1):
        if h[i-1] <=h[i] and h[i] <=h[i+1]:
            count += 1
if count >0:
    print('Yes')
else:
    print('No')

Failing test case input:
5
1 2 0 1 5

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
h = [int(i) for i in input().split()]
hmax = h[0]
count = 0
for i in range(1,n):
    if hmax-1 <= h[i]:
        count += 1
        hmax = max(hmax,h[i])
    else:
        break
if n-1 == count:
    print('Yes')
else:
    print('No')

Problem: p02953
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))
first = 0
for i in range(N):
    m = max(first,A[i])
    if A[i] < first-1:
        print("No")
        exit()

print("Yes")

Failing test case input:
5
0 2 0 3 6

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
first = 0
for i in range(N):
    first = max(first,A[i])
    if A[i] < first-1:
        print("No")
        exit()

print("Yes")
Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
h = list(map(int, input().split()))
threshold = 0
answer = 'Yes'
if n >= 2:
    for i in range(n-1):
        if h[i] > h[i+1]:
            if threshold > h[i+1]:
                answer = 'No'
                break
            elif h[i] == h[i+1] + 1:
                threshold = h[i+1]
print(answer)

Failing test case input:
4
0 0 4 0

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
h = list(map(int, input().split()))
threshold = 0
answer = 'Yes'
if n >= 2:
    for i in range(n-1):
        if h[i] > h[i+1]:
            if (threshold > h[i+1]) or (h[i] > h[i+1] +1):
                answer = 'No'
                break
            elif h[i] == h[i+1] + 1:
                threshold = h[i+1]
print(answer)

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
H = list(map(int,input().split()))
ans = "Yes"
for i in range(1,N-1):
    if H[i] > H[i+1] + 1:
        ans = "No"
        break
print(ans)


Failing test case input:
4
1 3 2 1

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
H = list(map(int,input().split()))
for i in range(N-2,0,-1):
 if H[i]> H[i+1]:
   H[i] -=1
   if H[i] > H[i+1]:
     print('No')
     break
else:
 print('Yes')

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))
frag = 0
tmp = 0

for i in range(0,N-1):
    if A[i] > A[i+1]:
        A[i] = A[i] - 1
        if A[i] > tmp:
            tmp = A[i]
            if A[i-1] > A[i] or tmp > A[i]:
                frag += 1
                break

if frag >= 1:
    print("No")
else:
    print("Yes")

Failing test case input:
4
0 0 11 0

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
pre = -999
frag = 0

for i in range(N):
    if A[i]-1 >= pre:
        pre = A[i] - 1
    elif A[i] >= pre:
        pre = A[i]
    else:
        frag += 1
        break
        
if frag == 1:
    print("No")
else:
    print("Yes")
Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
H = list(map(int,input().split()))
 
flag = 0
tmp = H[0]
d = len(H) - 1
if d == 0:
    print("Yes")
    exit()
 
if d == 1:
    if H[0] - 1 <= H[1]:
        print("Yes")
        exit()
    print("No")    
    exit()
 
 
for i_b in range(0, len(H)):
    i = i_b + 1 
    i_f = i + 1
 
    if H[i] > H[i_f]:
        H[i] -= 1
        if H[i_b] > H[i]:
            print("No")
            exit()

 
    if i_f == d:
        break    
print("Yes")

Failing test case input:
5
1 2 0 1 3

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
H = list(map(int,input().split()))
 
flag = 0
tmp = H[0]
d = len(H) - 1
if d == 0:
    print("Yes")
    exit()
 
if d == 1:
    if H[0] - 1 <= H[1]:
        print("Yes")
        exit()
    print("No")    
    exit()
 
H[0] -= 1
for i in range(1, len(H)):
    if  not(H[i - 1] > H[i] - 1):
        H[i] -= 1
    if H[i] > H[i + 1]:
        print("No")
        exit()

    if i + 1 == d:
        break    
print("Yes")

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

N = int(input())
H = list(map(int,input().split()))

if N == 1:
    print("Yes")
    sys.exit()
if H[0] > H[1]:
    H[0] -= 1
if H[0] > H[1]:
    print("No")
else:
    for i in range(1, N-1):
        if H[i] > H[i+1]:
            H[i] -= 1
        if H[i-1] > H[i] or H[i] > H[i-1]:
            print("No")
            sys.exit()
print("Yes") 

Failing test case input:
5
4 2 -1 1 3

Expected output:
No


Actual output:
No
Yes


Fixed submission (verdict: Accepted):
import sys

N = int(input())
H = list(map(int,input().split()))

if N == 1:
    print("Yes")
    sys.exit()
if H[0] >= H[1]:
    H[0] -= 1
if H[0] > H[1]:
    print("No")
else:
    for i in range(1, N-1):
        H[i] -= 1
        if H[i-1] <= H[i] and H[i] <= H[i+1]:
            continue
        else:
            H[i] += 1
        if H[i-1] <= H[i] and H[i] <= H[i+1]:
            continue
        else:
            print("No")
            sys.exit()
    print("Yes")

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
h=list(map(int,input().split()))
for i in range(1,n):
  if h[n-i]<h[n-i-1]:
    h[n-i-1]-=1
print(h)
for i in range(1,n):
  if h[i]<h[i-1]:
    print('No')
    exit()
print('Yes')

Failing test case input:
4
0 0 11 1

Expected output:
No


Actual output:
[0, 0, 10, 1]
No


Fixed submission (verdict: Accepted):
n=int(input())
h=list(map(int,input().split()))
for i in range(1,n):
  if h[n-i]<h[n-i-1]:
    h[n-i-1]-=1
for i in range(1,n):
  if h[i]<h[i-1]:
    print('No')
    exit()
print('Yes')
Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
H = list(map(int, input().split()))

pre = -999
for i in range(N):
  if pre <= H[i-1]:
    pre = H[i]-1
  elif pre <= H[i]:
    pre = H[i]
  else:
    print("No")
    exit()
  
print("Yes")

Failing test case input:
5
2 2 -1 1 1

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
H = list(map(int, input().split()))

pre = -999
for i in range(N):
  if pre <= H[i]-1:
    pre = H[i]-1
  elif pre <= H[i]:
    pre = H[i]
  else:
    print("No")
    exit()
  
print("Yes")

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N= int(input())
if N ==1:
  print("Yes")
else:
  H =[int(i) for i in input().split()]
  n = 0
  for i in range(N-1):
    if H[i+1] -H[i] <0:
      n += 1
    if n > 1:
      print("No")
      break
    if i == N-2:
      print("Yes")
      
    

Failing test case input:
5
2 2 0 0 0

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
H = [int(i) for i in input().split()]
H[0]-=1
s = True
for i in range(N-1):
    if H[i] < H[i+1]:
        H[i+1]-=1
    if H[i] > H[i+1]:
        s = False
        break
if s:
    print("Yes")
else:
    print("No")

Problem: p02953
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
H = list(map(int, input().split()))
flag = True

for i in range(0, N-1):
  if H[i] - H[i-1] == 1:
    H[i] -= 1
  elif H[i] - H[i-1] > 1:
    flag = False
    break
  
if flag:
  print("Yes")
else:
  print("No")
    
  

Failing test case input:
5
1 2 0 1 3

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
H = list(map(int, input().split()))
flag = True

for i in range(N-1):
  if H[i] - H[i+1] == 1:
    H[i+1]+= 1
  elif H[i] - H[i+1] > 1:
    flag = False
    break

if flag:
  print("Yes")
else:
  print("No")

Problem: p02953
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
li = list(map(int,input().split()))
ans = "Yes"
max_n = 0

if n == 1:
    print(ans)
else:
    for i in li:
        if i < max_n - 1:
            ans = "No"
            break
        max_n = max(i,max_n)

Failing test case input:
5
0 1 0 1 3

Expected output:
Yes


Actual output:

Fixed submission (verdict: Accepted):
n = int(input())
li = list(map(int,input().split()))
ans = "Yes"
max_n = 0


for i in li:
    if i < max_n - 1:
        ans = "No"
        break
    max_n = max(i,max_n)
print(ans)

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
s=list(map(int, input().split()))



for i in range(N-1):    
    if s[i]>=s[i+1]:
        s[i]=s[i]-1


        
if s==sorted(s):
    print("Yes")
else:
    print("No")


Failing test case input:
5
0 1 0 0 6

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
N=int(input())
s=list(map(int, input().split()))




for i in range(len(s)-2,-1,-1):    
    if s[i]>s[i+1]:
        s[i]=s[i]-1


        
if s==sorted(s):
    print("Yes")
else:
    print("No")
Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def solve(N, H):

    if(N == 1):
        return 1
    
    else:

        highest = H[0]

        for i in range(1,N):

            if(highest - H[i] > 1):
                return 0

            else:
                if(highest < H[i]):
                    highest = H[i]
    
    return 1


N = int(input())
H = list(map(int,input().split()))

if(solve(N,H) == 1):
    print('YES')
else:
    print('NO')

Failing test case input:
4
1 5 2 1

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
def solve(N, H):

    if(N == 1):
        return 1
    
    else:

        highest = H[0]

        for i in range(1,N):

            if(highest - H[i] > 1):
                return 0

            else:
                if(highest < H[i]):
                    highest = H[i]
    
    return 1


N = int(input())
H = list(map(int,input().split()))

if(solve(N,H) == 1):
    print('Yes')
else:
    print('No')

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

N = int(input())
boxes = input().split(" ")
for i in range(N):
    boxes[i] = int(boxes[i])

if N == 1:
    print("Yes")
    sys.exit()

ok = True
for i in range(0, N-1):
    diff = boxes[i+1] - boxes[i]
    if diff >= 0:
        continue
    elif diff == -1:
        boxes[i] -= 1
        if i > 1 and boxes[i] - boxes[i-1] <= -1:
        	ok = False
        	break
    elif diff >= -2:
        ok = False
        break

if ok:
    print("Yes")
else:
    print("No")


Failing test case input:
5
0 4 0 0 6

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
boxes = input().split(" ")
for i in range(N):
    boxes[i] = int(boxes[i])

ok = True
max_value = 1
for i in range(N-1):
    if max_value < boxes[i]:
        max_value = boxes[i]

    diff = boxes[i+1] - boxes[i]
    if diff >= 0:
        pass
    elif diff == -1:
        boxes[i] -= 1
        if max_value - 1 > boxes[i]:
            ok = False
    else:
        ok = False

    if not ok:
        break

if ok:
    print("Yes")
else:
    print("No")

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N = int(input())
H = list(map(int, input().split()))
flag = True
for i in range(N-1):
    if H[i+1] - H[i] < 0:
        flag = False
        break
print("Yes" if flag else "No")

Failing test case input:
5
0 1 0 2 5

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):

N = int(input())
H = list(map(int, input().split()))
flag = True
for i in range(1, N):
    if H[i] < H[i-1]:
        flag = False
        break
    else:
        if H[i-1] < H[i]:
            H[i] -= 1
print("Yes" if flag else "No")
Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
H = list(map(int, input().split()))

res = True
if N >= 2:
    for i in range(N - 1):
        if H[i] - H[i + 1] >= 2:
            res = False

y_card = 0
if N >= 3 and res == True:
    for i in range(N - 1):
        if H[i] - H[i + 1] == 1:
            y_card += 1
            if y_card == 2:
                res == False
                break
        elif H[i] == H[i + 1]:
            pass
        elif H[i + 1] - H[i] >= 1:
            y_card -= H[i + 1] - H[i]
            if y_card < 0:
                y_card = 0


if res == True:
    print('Yes')
else:
    print('No')


Failing test case input:
4
1 3 2 1

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
H = list(map(int, input().split()))

res = True
if N >= 2:
    for i in range(N - 1):
        if H[i] - H[i + 1] >= 2:
            res = False

y_card = 0
if N >= 3 and res == True:
    for i in range(N - 1):
        if H[i] - H[i + 1] == 1:
            y_card += 1
            if y_card == 2:
                res = False
                break
        elif H[i] == H[i + 1]:
            pass
        elif H[i + 1] - H[i] >= 1:
            y_card -= H[i + 1] - H[i]
            if y_card < 0:
                y_card = 0


if res == True:
    print('Yes')
else:
    print('No')

Problem: p02953
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
ls=list(map(int,input().split()))
ls.insert(0,0)

flag=True
for i in range(1,n):
    a,b,c=ls[i-1],ls[i],ls[i+1]
    if b>a and b>c:
        ls[i]-=1
    if b>=a and c>=a:
        pass
    else:
        flag=False
        break

ls_set=list(set(ls))
if max(ls_set)-min(ls_set)==1:
    flag=True

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

Failing test case input:
4
0 0 6 1

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
import copy
n=int(input())
ls=list(map(int,input().split(' ')))
new_ls=copy.copy(ls)
new_ls.insert(0,0)

flag=True
for i in range(1,n):
    new_ls[i]=new_ls[i]-1
    if new_ls[i]>=new_ls[i-1] and new_ls[i+1]>=new_ls[i]:
        pass
    else:
        new_ls[i]+=1
        if new_ls[i]<new_ls[i-1] or new_ls[i+1]<new_ls[i]:
            flag=False
            break

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

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
h = list(map(int, input().split()))

mini = h[0]
for i in range(1,n-1):
    
    if h[i]-1 > mini:
        print("No")
        exit()
    else:
        mini = h[i]

print("Yes")

Failing test case input:
5
5 3 0 0 3

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
h = list(map(int, input().split()))

prev = -999
for i in range(n):
    if prev <= h[i]-1: prev = h[i]-1
    elif prev <= h[i]: prev = h[i]
    else:
        print("No")
        exit()

print("Yes")
Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
l=list(map(int, input().split()))
for i in range(1, n-1):
  if l[i] > l[i+1] and l[i-1] >= l[i]:
    print('No')
    exit()
print('Yes')

Failing test case input:
4
0 0 5 1

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n=int(input())
l=list(map(int, input().split()))
l[0] -= 1
ans="Yes"
for i in range(1, n):
  if l[i] > l[i-1]:
    l[i] -= 1
  if l[i] < l[i-1]:
    print("No")
    exit()
print(ans)

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=input().split()
b=[int(x) for x in a]

for i in range(len(b)-1):
	if b[i]<=b[i+1]:
		pass
	elif b[i-1]<=(b[i]-1) and (b[i]-1)<=b[i+1]:
		b[i]-=1
	else:
		print("No")
		break
else:
	print("Yes")

Failing test case input:
4
1 0 11 1

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
a0=input()
a=input().split()
b=[int(x) for x in a]

for i in range(len(b)-1):
	if b[i]<=b[i+1]:
		pass
		if b[i-1]<=(b[i]-1) and (b[i]-1)<=b[i+1]:
			b[i]-=1
	elif b[i-1]<=(b[i]-1) and (b[i]-1)<=b[i+1]:
		b[i]-=1
	else:
		print("No")
		break
else:
	print("Yes")

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
h = list(map(int,input().split()))
ans = 'Yes'
dif = []
for i in range(n-2):
    if h[i+1]-h[i]>1:
        ans = 'No'
    elif h[i+1]-h[i]==1:
        h[i+1]-=1
print(ans)

Failing test case input:
5
5 3 0 0 3

Expected output:
No


Actual output:
Yes


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

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
h=list(map(int,input().split()))
result='Yes'

if n == 2:
  if h[1] < h[0]:
    h[1] -=1
    if h[1] < h[0]:
      result='No'

if 3 <=n:
  for i in range(1, n-1):
    print(i)
    if h[i-1] <= h[i] and h[i] <= h[i+1]:
      continue
    else:
      h[i]-=1
      if h[i-1] <= h[i] and h[i] <= h[i+1]:
        continue
      else:
        result='No'
        break

print(result)

Failing test case input:
5
5 3 -1 0 3

Expected output:
No


Actual output:
1
No


Fixed submission (verdict: Accepted):
n=int(input())
h=list(map(int,input().split()))
result='Yes'
 
for i in range(n-1):
  if i==0:
    if h[1] < h[0]:
      h[0]-=1
    if h[1] < h[0]:
      result='No'
      break
  else:
    if h[i-1] <= h[i] and h[i] <= h[i+1]:
      if h[i-1] <= h[i]-1 and h[i]-1 <= h[i+1]:
        h[i]-=1
      continue
    else:
      h[i]-=1
      if h[i-1] <= h[i] and h[i] <= h[i+1]:
        continue
      else:
        result='No'
        break

if n == 2:
  if h[1] < h[0]:
    h[1]-=1
    if h[1] < h[0]:
      result='No'

print(result)
Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
H = list(map(int, input().split()))
if N == 1:
  ans = 'Yes'
else:
  for i in range(N-1):
    if H[i] - 1 < H[i+1]:
      continue
    else:
      ans = 'No'
      break
  else:
    ans = 'Yes'
print(ans)

Failing test case input:
5
0 1 0 1 3

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
N = int(input())
H = list(map(int, input().split()))
if H[0] > 0:
  H[0] -= 1
if N == 1:
  ans = 'Yes'
else:
  for i in range(N-1):
    if H[i] == H[i+1]:
      pass
    elif H[i] < H[i+1]:
      H[i+1] -= 1
    else:
      ans = 'No'
      break
  else:
    ans = 'Yes'
print(ans)

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
H = list(map(int,input().split()))
state = 0
cnt = 0
cnt2 = 0
for i in range(1,len(H)):
    d = H[i]-H[i-1]
    if d<=0 and H[i-1]!=1:
       H[i-1] = H[i-1] - 1
for i in range(1,len(H)):
    d = H[i]-H[i-1]
    if d<0:
        cnt+=1
if cnt>0:
    print("No")
else:
    print("Yes")


Failing test case input:
5
0 1 0 0 6

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
N = int(input())
H = list(map(int,input().split()))

state = 0
for i in range(1,len(H))[::-1]:
    if H[i]<H[i-1]:
        H[i-1] = H[i-1] -1

for i in range(1,len(H)):
    if H[i] - H[i-1]<0:
        state = 1
        break
if state == 1:
    print("No")
else:
    print("Yes")

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
lis = list(map(int,input().split()))
lis[0]-=1

print(lis)
for i in range(n-1):
  if lis[i] < lis[i+1]:
    lis[i+1] -= 1
  elif lis[i] > lis[i+1]:
    print("No")
    exit()
print("Yes")

Failing test case input:
1
1110111001

Expected output:
Yes


Actual output:
[1110111000]
Yes


Fixed submission (verdict: Accepted):
n = int(input())
lis = list(map(int,input().split()))
lis[0]-=1

for i in range(n-1):
  if lis[i] < lis[i+1]:
    lis[i+1] -= 1
  elif lis[i] > lis[i+1]:
    print("No")
    exit()
print("Yes")

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
h = list(map(int, input().split()))

for i in range(0, n-1):
    if h[i] > h[i+1] -1:
        print('No')
        break
    h[i+1] -= 1
else:
    print('Yes')

Failing test case input:
5
0 0 0 0 10

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())
h = list(map(int, input().split()))


h[0] -= 1
for i in range(0, n-1):
    if h[i] <= h[i+1] -1:
        h[i+1] -= 1
    elif h[i] > h[i+1]:
        print('No')
        break
else:
    print('Yes')
Problem: p02953
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N=int(input())
W=list(map(int,input().split()))
for i in range(N-1,0,-1):
  if W[i-1]+1<W[i]:
    print("No")
    exit()
    if W[i-1]-1==W[i]:
      W[i-1]-=1
print("Yes")

Failing test case input:
5
2 2 0 0 1

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N=int(input())
W=list(map(int,input().split()))
for i in range(N-1,0,-1):
  if W[i-1]>W[i]+1:
    print("No")
    exit()
  elif W[i-1]==W[i]+1:
    W[i-1]-=1
print("Yes")

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
Hn = list(map(int,input().split()))[::-1]
minnum = Hn[0]
check = True
for i in range(1,len(Hn)):
    if Hn[i]-Hn[i-1]<=-1:
        check = False
        break
    elif Hn[i]-Hn[i-1]==-1:
        Hn[i]-=1
    else:
        continue
if check:
    print("Yes")
else:
    print("No")

Failing test case input:
5
1 2 3 4 5

Expected output:
Yes

Actual output:
No


Fixed submission (verdict: Accepted):
N = int(input())
Hn = list(map(int,input().split()))[::-1]
minnum = Hn[0]
check = True
for i in range(1,len(Hn)):
    if Hn[i-1]-Hn[i]<-1:
        check = False
        break
    elif Hn[i-1]-Hn[i]==-1:
        Hn[i]-=1
    else:
        continue
if check:
    print("Yes")
else:
    print("No")

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
inputs = [int(i) for i in input().split()]

count = 0
for i in range(1, N):
    if inputs[i-1] - inputs[i] >= 1:
        count += 1
    if count >= 2:
        print('No')
        break
else:
    print('Yes')

Failing test case input:
5
2 2 0 0 1

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
inputs = [int(i) for i in input().split()]

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

for i in range(1, N):
    if inputs[i-1] > inputs[i]:
        print('No')
        break
else:
    print('Yes')

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
H = list(map(int,input().split()))
ans = "Yes"
for i in range(1,N):
    if H[-i] < H[-i-1]:
        if H[-i]+1 == H[-i-1]:
            H[-i] += -1
        else:
            ans = "No"
            break
print(ans)

Failing test case input:
4
1 3 2 1

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
H = list(map(int,input().split()))
ans = "Yes"
for i in range(1,N):
    if H[-i] < H[-i-1]:
        if H[-i]+1 == H[-i-1]:
            H[-i-1] += -1
        else:
            ans = "No"
            break
print(ans)
Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
h = list(map(int,input().split())) + [10**9+1]
cnt = 0
for i in range(n):
    if h[i]-1>=h[i+1]:
        cnt +=1
    if cnt ==2:
        print('No')
        exit()
print('Yes')

Failing test case input:
4
0 0 5 1

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
h = list(map(int,input().split())) + [10**10+1]
MAX = h[0]
for i in h:
    MAX = max(MAX, i)
    if MAX-1>i:
        print('No')
        exit()
print('Yes')

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
H = list(map(int, input().split()))
H.reverse()
now = H[0]
for h in H[1:]:
    if h > now:
        h -= 1
        if h > now:
            print("No")
            exit()
        else:
            now = h

print("Yes")


Failing test case input:
5
4 3 0 -1 4

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
H = list(map(int, input().split()))
H.reverse()
for i in range(N - 1):
    if H[i + 1] > H[i]:
        H[i + 1] -= 1
        if H[i + 1] > H[i]:
            print("No")
            exit()

print("Yes")

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
H = list(map(int, input().split()))

h0 = H[0]-1
for i in range(1, n):
    h = H[i]
    if h < h0:
        H[i] = h-1
    h0 = h

flg = True
h0 = H[0]-1
for h in H[1:]:
    flg &= h0 <= h
    h0 = h
if flg:
    print('Yes')
else:
    print('No')

Failing test case input:
5
0 1 0 2 5

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())
H = list(map(int, input().split()))

H[0] -= 1
for i in range(1, n):
    if H[i-1] < H[i]:
        H[i] -= 1

if all(H[i-1] <= H[i] for i in range(1, n)):
    print('Yes')
else:
    print('No')

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
ans = 'YES'
for i in range(n-1, 1, -1):
    if a[i] < a[i-1]:
        a[i-1] -= 1
        if a[i] < a[i-1]:
            ans = 'NO'
            break
print(ans)



Failing test case input:
5
0 2 0 3 6

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
ans = 'Yes'
for i in range(n-1, 1, -1):
    if a[i] < a[i-1]:
        a[i-1] -= 1
        if a[i] < a[i-1]:
            ans = 'No'
            break
print(ans)
Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
Hs = [int(i) for i in input().split()]
print(Hs)

for i,H in enumerate(Hs):
    if i == N - 1:
        break

    if H > Hs[i+1]:
        H -= 1
        Hs[i] = H
    if H > Hs[i+1]:
        print('No')
        exit()
    if i == 0:
        continue
    if H < Hs[i-1]:
        print('No')
        exit()

print('Yes')


Failing test case input:
1
0000001000

Expected output:
Yes


Actual output:
[1000]
Yes


Fixed submission (verdict: Accepted):
N = int(input())
Hs = [int(i) for i in input().split()]

for i in range(N):
    decr = None
    if i+1 != N:
        if Hs[i] > Hs[i+1]:
            decr = True
            Hs[i] -= 1
        if Hs[i] > Hs[i+1]:
            print('No')
            exit()

    if i == 0:
        continue

    if Hs[i] > Hs[i-1]:
        if not decr:
            Hs[i] -= 1
    if Hs[i] < Hs[i-1]:
        print('No')
        exit()

print('Yes')

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
H = [int(x) for x in input().split()]

flag = False
for i in range(n-1):
    if not H[i] <= H[i+1]:
        flag = True
        if H[i] - H[i+1] > 1:
            flag = True
        else:
            flag = False

if not flag:
    print("Yes")
else:
    print("No")


Failing test case input:
5
1 2 0 6 5

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
H = [int(x) for x in input().split()]

flag = True
for i in reversed(range(1, n)):
    if H[i-1] <= H[i]:
        continue
    elif H[i-1] - H[i] == 1:
        H[i-1] -= 1
    else:
        flag = False

if flag:
    print("Yes")
else:
    print("No")

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
nums = list(map(int, input().split()))

if n == 1:
    print("Yes")

for i in range(1, n, 1):
    if nums[i] < nums[i - 1]:
        print("No")
        exit()

    if nums[i] > nums[i - 1]:
        nums[i] -= 1

print("Yes")


Failing test case input:
1
1010001000

Expected output:
Yes


Actual output:
Yes
Yes


Fixed submission (verdict: Accepted):
n = int(input())
nums = list(map(int, input().split()))

for i in range(1, n, 1):
    if nums[i] < nums[i - 1]:
        print("No")
        exit()

    if nums[i] > nums[i - 1]:
        nums[i] -= 1

print("Yes")
Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
cells = list(map(int, input().split()))
count = []

for i in range(N-2):
    if cells[N - 1 - i] - cells[N - 2 - i] <= -2:
        print('No')
        break
    elif cells[N - 1 - i] - cells[N - 2 - i] == -1:
        cells[N - 2 - i] = cells[N - 2 - i] - 1
    else:
        count.append('o')
        continue

if len(count) == N - 2:
    print('Yes')

Failing test case input:
1
0110011001

Expected output:
Yes


Actual output:

Fixed submission (verdict: Accepted):
N = int(input())
cells = list(map(int, input().split()))
count = []
if N == 1:
    print('Yes')
else:
    for i in reversed(range(1, N)):
        if cells[i] <= cells[i - 1] - 2:
            print('No')
            break
        elif cells[i] == cells[i - 1] - 1:
            count.append('o')
            cells[i - 1] = cells[i - 1] - 1
        else:
            count.append('o')
    if len(count) == N - 1:
        print('Yes')

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = input()
H_list = list(map(int, input().split()))

H_edit_list = [0, 0]

for h in H_list:
    if h - H_edit_list[-1] < 0:
        H_edit_list[-1] -= 1
    if H_edit_list[-2] > H_edit_list[-1]:
        print('No')
        exit()
    H_edit_list.append(h)

print('Yes')

Failing test case input:
4
1 1 4 0

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = input()
H_list = list(map(int, input().split()))
H_edit_list = [10**10]

for h in list(reversed(H_list)):
    if h - H_edit_list[-1] > 0:
        H_edit_list.append(h - 1)
    else:
        H_edit_list.append(h)
    if H_edit_list[-2] < H_edit_list[-1]:
        print('No')
        exit()

print('Yes')

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
h = list(map(int, input().split()))
max = 0

for i in range(n):
    if i == 0:
        continue

    if h[i] > h[i - 1]:
        if h[i] > max:
            max = h[i]

    if max - h[i] >= 2:
        print("NO")
        exit()

print("YES")


Failing test case input:
5
0 2 0 0 6

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
n = int(input())
h = [0]
h.extend(list(map(int, input().split())))
max = 0
flag = False

for i in range(n + 1):
    if h[i] > h[i - 1]:
        max = h[i]
    if max - h[i] >= 2:
        flag = True

if flag:
    print("No")
else:
    print("Yes")

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
H = list(map(int, input().split(' ')))
i = 1
while i < N:
    if H[i-1] > H[i]:
        if H[i-1] - 1 == H[i]:
            H[i-1] = H[i-1] - 1
        else:
            print("No")
            quit()
    i += 1
print("Yes")

Failing test case input:
4
1 3 2 1

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
H = list(map(int, input().split(' ')))
i = 1
a = 0
while i < N:
    if H[i-1] <= H[i]-1:
        H[i] = H[i] - 1
    i += 1
i = 1
while i < N:
    if H[i-1] > H[i]:
        print("No")
        quit()
    i += 1
print("Yes")
Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
H=list(map(int,input().split()))
ans='Yes'

for i in range(1,n-1):
    if H[i]<H[i-1]-1 or H[i]-1>H[i+1]:
        ans='No'
        break
print(ans)

Failing test case input:
4
1 3 2 1

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
n=int(input())
H=list(map(int,input().split()))
ans='Yes'
ma=0
for i in range(1,n):
    if ma-1>H[i]:
        ans='No'
        break
    ma=max(ma,H[i])
print(ans)

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
H = list(map(int, input().split()))

maxH = H[0]
for i in range(N-1):
    if H[i+1]-H[i] < -1 or maxH-1 > H[i]:
        print('No')
        exit()
    else:
        maxH = max(H[i], maxH)
print('Yes')

Failing test case input:
4
1 3 2 1

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
H = list(map(int, input().split()))

maxH = H[0]
for i in range(1,N):
    if maxH-1 > H[i]:
        print('No')
        exit()
    else:
        maxH = max(H[i], maxH)
print('Yes')

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
H = list(map(int, input().split()))

H[0] -= 1
for i in range(1, n):
    if H[i] < H[i-1]:
        H[i] -= 1

if all(H[i-1] <= H[i] for i in range(1, n)):
    print('Yes')
else:
    print('No')

Failing test case input:
5
1 2 3 6 5

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())
H = list(map(int, input().split()))

H[0] -= 1
for i in range(1, n):
    if H[i-1] < H[i]:
        H[i] -= 1

if all(H[i-1] <= H[i] for i in range(1, n)):
    print('Yes')
else:
    print('No')

Problem: p02953
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import os
N = int(input())
H = list(map(int,input().split()))
flg = True
for i in range(1,N):
    if H[i] >= H[i-1]:
        continue
    elif H[i] >= H[i-1]-1:
        H[i-1] -= 1
    else:
        print("No")
        flg = False
if flg == True:
    print("Yes")
    

Failing test case input:
4
1 -1 4 1

Expected output:
No


Actual output:
No
No


Fixed submission (verdict: Accepted):
N = int(input())
H = list(map(int,input().split()))
flg = True
H[0]-=1
for i in range(1,N):
    if H[i] >= H[i-1]+1:
        H[i] -= 1
    elif H[i] >= H[i-1]:
        continue
    else:
        print("No")
        flg = False
        break
if flg == True:
    print("Yes")

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
H = list(map(int, input().split()))

for i in range(N-1, 0, -1):
    if H[i-1] - H[i] == 1:
        H[i-1] -= 1
    elif H[i-1] - H[i] > 1:
        print('No')
        break
    if i == 1:
        print('Yes')


Failing test case input:
1
1110011001

Expected output:
Yes


Actual output:

Fixed submission (verdict: Accepted):
N = int(input())
H = list(map(int, input().split()))

exit_flag = False
for i in range(N-1, 0, -1):
    if H[i-1] - H[i] == 1:
        H[i-1] -= 1
    elif H[i-1] - H[i] > 1:
        exit_flag = True
        print('No')
        break

if not exit_flag:
    print('Yes')
Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
a.sort()
a.reverse()
print(a)
for i in range(n-1):
  if a[i]+1==a[i+1]:
    a[i+1]-=1
  elif a[i]+1<a[i+1]:
    print("No")
    exit()
  else:
    pass
print("Yes")


Failing test case input:
1
0001000010

Expected output:
Yes


Actual output:
[1000010]
Yes


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))

a.reverse()

for i in range(n-1):
  if a[i]+1==a[i+1]:
    a[i+1]-=1
  elif a[i]+1<a[i+1]:
    print("No")
    exit()
  else:
    pass
print("Yes")

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

def main():
    n = int(input())
    h  = list(map(int, input().split()))
    
    if n == 1:
        print('Yes')
    else:
        for i in range(n-1):
            if h[i+1]-h[i] >= 2:
                print('No')
                break
            elif h[i+1]-h[i] == -1:
                h[i+1] += 1

            if i == n-2:
                print('Yes')
                break

    
    
if __name__ == '__main__':
    main()



Failing test case input:
5
2 2 0 1 1

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):

def main():
    n = int(input())
    h  = list(map(int, input().split()))
    h = h[::-1]
    
    if n == 1:
        print('Yes')
    else:
        for i in range(n-1):
            if h[i+1] - h[i] == 1:
                h[i+1] -= 1

            elif h[i+1] <= h[i]:
                pass

            elif h[i+1] > h[i]:
                print('No')
                break 

            if i == n-2:
                print('Yes')
                break

    
    
if __name__ == '__main__':
    main()

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
H=list(map(int,input().split()))
A=0
for i in range(N-2):
    if H[i]-H[i+1]>0 and H[i+1]-H[i+2]>0:
        A+=H[i]-H[i+1]+H[i+1]-H[i+2]
if A>1:
    print('No')
else:
    print('Yes')

Failing test case input:
5
2 2 0 1 5

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
import sys
N=int(input())
H=list(map(int,input().split()))
A=0
for i in range(N-1):
    if H[i]-H[i+1]>1 :
        print('No')
        sys.exit()
    elif H[i]-H[i+1]==1:
        H[i+1]=H[i+1]+1
    else:
        continue
print('Yes')

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin
n = int(input())
a = [int(x) for x in stdin.readline().rstrip().split()]
for i in range(n-1):
  if a[i] > a[i+1] :
    a[i] -= 1 
  if a[i] > a[i+1] :
    print("No")
    exit()
    if i > 0:
      if a[i] < a[i-1]:
        print("No")
        exit()
        
print("Yes")

Failing test case input:
4
1 3 2 1

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
from sys import stdin
n = int(input())
a = [int(x) for x in stdin.readline().rstrip().split()]
for i in range(n-1):
  if a[n-1-i] < a[n-1-i-1] :
    a[n-1-i-1] -= 1 
  if a[n-1-i] < a[n-1-i-1] :
    
    print("No")
    exit()
  
        
print("Yes")
Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
h = list(map(int,input().split()))

ans = 1
for i in range (n-1):
    if (h[i]-h[n-1] >= 2):
        ans = 0
        break

if (ans == 1):
    print("Yes")

else :
    print("No")

Failing test case input:
5
4 3 0 -1 4

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
h = list(map(int,input().split()))

ans = 1
m = h[0]
for i in range (n):
    if (h[i] > m):
        m = h[i]
    elif (m-h[i] >= 2):
        ans = 0
        break

if (ans == 1):
    print("Yes")
else :
    print("No")

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
num = list(map(int, input().split()))
left = 0
for i in range(n):
  right = num[i]
  if right - left >= -1:
    left = right
  else:
    print("No")
    exit()  
print("Yes")

Failing test case input:
4
1 3 2 1

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
num = list(map(int, input().split()))
left = 0
for i in range(n):
  right = num[i]
  if right - left >= 0:
    left = right
  elif right - left >= -1:
    continue
  else:
    print("No")
    exit()  
print("Yes")

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
H=[int(i) for i in input().split()]
A=1
if N>1:
    for i in range(N-1):
        if H[-(i+1)-1] <= H[-(i+1)]:
            A+=1
            print(A)
        elif H[-(i+1)-1]-1 == H[-(i+1)]:
            A+=1
            H[-(i+1)-1]-=1
    if A==N:
        print('Yes')
    else:
        print('No')
elif N==1:
    print('Yes')

Failing test case input:
4
1 3 2 1

Expected output:
No

Actual output:
3
No


Fixed submission (verdict: Accepted):
N=int(input())
H=[int(i) for i in input().split()]
A=1
if N>1:
    for i in range(N-1):
        if H[-(i+1)-1] <= H[-(i+1)]:
            A+=1
        elif H[-(i+1)-1]-1 == H[-(i+1)]:
            A+=1
            H[-(i+1)-1]-=1
    if A==N:
        print('Yes')
    else:
        print('No')
elif N==1:
    print('Yes')

Problem: p02953
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def main():
	n = int(input())
	arr = list(map(int,input().split()))
	for i in range(len(arr)-1):
		if arr[i]-1>arr[i-1]:
			
			print("No")
			return
	print("Yes")
	return


main()

Failing test case input:
5
0 1 0 2 5

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
def main():
	n = int(input())
	arr = list(map(int,input().split()))
	for i in range(1,len(arr)):
		if arr[i]>arr[i-1]:
			arr[i]-=1
		elif arr[i]<arr[i-1]:
			print("No")
			return
	print("Yes")
	return


main()
Problem: p02953
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))
 


ans = 'Yes'
for i in range(N-1, 0, -1):
  print(i)
  if A[i] < A[i-1]: A[i-1] -= 1
  if A[i] < A[i-1]:
    ans = 'No'
    break

print(ans)

Failing test case input:
5
5 3 -1 -1 4

Expected output:
No


Actual output:
4
3
2
No


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
 


ans = 'Yes'
for i in range(N-1, 0, -1):
  if A[i] < A[i-1]: A[i-1] -= 1
  if A[i] < A[i-1]:
    ans = 'No'
    break

print(ans)

Problem: p02953
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
squeres = list(map(int, input().split()))
flag = True
now_max = squeres[0]
for i in range(n - 1):
    if squeres[i] > squeres[i + 1] and squeres[i] - 1 <= squeres[i + 1]:
        now_max = squeres[i] - 1

    elif not squeres[i] <= squeres[i + 1] or squeres[i] < now_max:
        flag = False
    
    else:
        now_max = squeres[i]
if flag:
    print("Yes")
else:
    print("No")


Failing test case input:
4
1 3 2 1

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
squeres = list(map(int, input().split()))
flag = True
before_down = 0
for i in range(n - 1):
    if squeres[i] > squeres[i + 1] and squeres[i] - 1 <= squeres[i + 1] and before_down == 0:
        before_down = 1

    elif not squeres[i] <= squeres[i + 1]:
        flag = False
    
    else:
        if squeres[i] < squeres[i + 1]:
            before_down = 0
if flag:
    print("Yes")
else:
    print("No")

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
H = list(map(int, input().split()))

for i in range(N-1):
    if H[N-1-i] < H[N-1-i-1]:
        H[N-1-i-1] -= 1

imp = 0
for i in range(1,N):
    if H[i] < H[i-1]:
        imp += 1

if imp == 0:
    print(H,'Yes')
else:
    print(H,'No')

Failing test case input:
4
2 0 11 1

Expected output:
No


Actual output:
[1, 0, 10, 1] No


Fixed submission (verdict: Accepted):
N = int(input())
H = list(map(int, input().split()))

for i in range(N-1):
    if H[N-1-i] < H[N-1-i-1]:
        H[N-1-i-1] -= 1

imp = 0
for i in range(1,N):
    if H[i] < H[i-1]:
        imp += 1

if imp == 0:
    print('Yes')
else:
    print('No')

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N = int(input())
H = list(map(int,input().split()))

ans = 'Yes'
diff = 0

for i in range(N - 1):
	diff = H[i + 1] - H[i]

	if diff > 1:
		H[i + 1] -= 1
	elif diff < 0:
		ans = 'No'
print(ans)

Failing test case input:
5
0 1 0 0 10

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):

N = int(input())
H = list(map(int,input().split()))

ans = 'Yes'
diff = 0

for i in range(N - 1):
	diff = H[i + 1] - H[i]

	if diff >= 1:
		H[i + 1] -= 1
	elif diff < 0:
		ans = 'No'

print(ans)
Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
H=list(map(int,input().split()))
count=0
if max(H)-H[N-1]>1:
  print("No")
  count+=1
  exit()
for i in range(1,N):
  D=H[i-1]-H[i]
  if D<-2:
    print("No")
    count+=1
if count==0:
  print("Yes")

Failing test case input:
5
0 1 0 0 6

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
N=int(input())
H=list(map(int,input().split()))
count2=0
C=0
for i in range(0,N):
  C=max(C,H[i])
  if C-H[i]>1:
    print("No")
    count2 +=1
    exit()
if count2==0:
  print("Yes")

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
h=list(map(int, input().split()))
revh=h[::-1]
for i in range(1,n):
	if revh[i-1]<revh[i]:
		h[i]-=1
h.sort(reverse=True)
if h==revh:
	print('Yes')
else:
	print('No')

Failing test case input:
5
0 1 0 2 5

Expected output:
Yes


Actual output:
No


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

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N = int(input())
H = []
H = input().split(" ")
for i in range(N):
    H[i] = int(H[i])

ochinchin = True
for i in range(1, N-1):
    if H[i]<H[i-1]:
        H[i-1] -= 1
        if H[i]<H[i-1]:
            ochinchin = False
            break
        elif i > 2:
            if H[i-1]<H[i-2]:
                ochinchin = False
                break

Failing test case input:
4
0 1 4 0

Expected output:
No


Actual output:

Fixed submission (verdict: Accepted):
N = int(input())
H = []
H = input().split(" ")
for i in range(N):
    H[i] = int(H[i])-1

ochinchin = True
for i in range(1, N):
    if H[i] < H[i-1]:
        H[i] += 1
        if H[i] < H[i-1]:
            ochinchin = False
            break
            

if ochinchin:
    print("Yes")
else:
    print("No")

Problem: p02953
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
h = list(map(int,input().split()))

ans = 1
for i in range (n):
    if (h[i]-h[n-1] >= 2 or h[0]-h[i] >= 2):
        ans = 0
        break

if (ans == 1):
    print("Yes")

else :
    print("No")

Failing test case input:
5
0 2 0 2 6

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
h = list(map(int,input().split()))

ans = 1
m = h[0]
for i in range (n):
    if (h[i] > m):
        m = h[i]
    elif (m-h[i] >= 2):
        ans = 0
        break

if (ans == 1):
    print("Yes")
else :
    print("No")
Problem: p03393
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys


alph="abcdefghijklmnopqrstuvwxyz"
allis=list(alph)
S=input()
if(S=="zyxwvutsrqponmlkjihgfedcba"):
    print(-1)
    sys.exit()


for i in alph:
    if(i not in S):
        print(S+i)
        sys.exit()
        

l=-1
for i in range(len(S)-1)[::-1]:
    if(ord(S[i])<ord(S[i+1])):
        l=i
        break
        
x=sorted(S[i+1:])
for i in x:
    if(i>S[l]):
        print(S[:l-1]+i)
        sys.exit()
print("b")


Failing test case input:
xyzwvutsrqponmlkjihgfedcba

Expected output:
xz


Actual output:
z


Fixed submission (verdict: Accepted):
import sys


alph="abcdefghijklmnopqrstuvwxyz"
allis=list(alph)
S=input()
if(S=="zyxwvutsrqponmlkjihgfedcba"):
    print(-1)
    sys.exit()


for i in alph:
    if(i not in S):
        print(S+i)
        sys.exit()
        

l=-1
for i in range(len(S)-1)[::-1]:
    if(ord(S[i])<ord(S[i+1])):
        l=i
        break
        
x=sorted(S[i+1:])
for i in x:
    if(i>S[l]):
        print(S[:l]+i)
        sys.exit()
print("b")

Problem: p03393
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
alph = "abcdefghijklmnopqrstuvwxyz"
S = input()
for c in S:
    alph = alph.replace(c, "")
if alph != "":
    print(S+alph[0])
else:
    alph = "abcdefghijklmnopqrstuvwxyz"
    if S == alph[::-1]:
        print(-1)
    else:
        for i in range(len(S)):
            if S[i] != alph[i]:
                print(S[:i-1]+alph[i])
                break


Failing test case input:
xyzwvutsrqponmlkjihgfedcba

Expected output:
xz


Actual output:
xyzwvutsrqponmlkjihgfedcba


Fixed submission (verdict: Accepted):
def solv(S):
    c = []
    for i in range(25, 0, -1):
        for j in range(i-1, -1, -1):
            if S[i] > S[j]:
                c.append(S[:j]+S[i])
    print(sorted(c)[0])
    return


alph = "abcdefghijklmnopqrstuvwxyz"
S = input()
for c in S:
    alph = alph.replace(c, "")
if alph != "":
    print(S+alph[0])
else:
    alph = "abcdefghijklmnopqrstuvwxyz"
    if S == alph[::-1]:
        print(-1)
    else:
        solv(S)