qyliang/CodeNanoFix huggingface dataset:
# Buggy code:
N = int(input())
H = list(map(int, input().split()))
ans = True
b = 999999
if ans == True:
  for i, x in enumerate(H[::-1]):
    if i != 0:
      if x <= b:
        b = x
      elif (x-1) <= b:
        b = x-1
      else:
        ans = False
        break
    else:
      b = x
print(ans)

# Fixed code:
N = int(input())
H = list(map(int, input().split()))
ans = True
b = 999999
if ans == True:
  for i, x in enumerate(H[::-1]):
    if i != 0:
      if x <= b:
        b = x
      elif (x-1) <= b:
        b = x-1
      else:
        ans = False
        break
    else:
      b = x
if ans:
  print("Yes")
else:
  print("No")
# Buggy code:
n=int(input())
h=list(map(int,input().split()))
if n==1:
  print("Yes")
else:
  for i in range(n-1):
    if h[i]>h[i+1]+1:
      print("No")
      break
  else:
    print("Yes")


# Fixed code:
n=int(input())
arr=list(map(int,input().split()))
for i in range(n-2,-1,-1):
  if arr[i]>arr[i+1]:
    arr[i]-=1
    if arr[i]>arr[i+1]:
      print('No')
      break
else:
  print('Yes')
# Buggy code:
N = int(input())
h = list(map(int,input().split()))
ans = 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]:
        ans = True
    else:
        ans = False
        break
if ans:
    print('Yes')
else:
    print('No')

# Fixed code:
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 code:
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')

# Fixed code:
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')
# Buggy code:
N = int(input())
H = list(map(int, input().split()))
ans = ("Yes")

for i in range(N-1):
    if H[i] - H[i+1] == 1:
        H[i+1] -= 1
    elif H[i] - H[i+1] >= 2:
        ans = ("No")

print(ans)

# Fixed code:
N = int(input())
H = list(map(int, input().split()))
ans = "Yes"
for i in range(N - 1, 1, -1):
    if H[i - 1] - H[i] >= 2:
        ans = "No"
    elif H[i] < H[i - 1]:
        H[i - 1] -= 1

print(ans)
# Buggy code:
n=int(input())
a=list(map(int,input().split()))
b=0
c=a.reverse()
d=0
for i in range(n-1):
  if a[i]-a[i+1]==1:
    a[i+1]=a[i+1]-1
  elif a[i]-a[i+1]>=2:
    b+=1
  else:
    d=d
    
if b==0:
  print("Yes")
else:
  print("No")

# Fixed code:
n=int(input())
a=list(map(int,input().split()))
b=0
c=a.reverse()
d=0
for i in range(n-1):
  if a[i]-a[i+1]==-1:
    a[i+1]=a[i+1]-1
  elif a[i]-a[i+1]<=-2:
    b+=1
  else:
    d=d
    
if b==0:
  print("Yes")
else:
  print("No")
# Buggy code:
N = int(input())
H = map(int,input().split())

for i in range(N-1):
  if H(N-i-1) < H(N-i-2):
    H(N-i-2) -= 1
    
f = 0
for i in range(N-1):
  if H(N-i-1) < H(N-i-2):
    f = 1
    
if f = 0:
  print("No")
else:
  print("Yes")

# Fixed code:
N = int(input())
H = list(map(int,input().split()))

for i in range(N-1):
  if H[N-i-1] < H[N-i-2]:
    H[N-i-2] -= 1
    
f = 0
for i in range(N-1):
  if H[N-i-1] < H[N-i-2]:
    f = 1
    
if f == 0:
  print("Yes")
else:
  print("No")
# Buggy code:
n = int(input())
hoge_list = list(map(int,input().split()))
h_list = hoge_list[::-1]
mae = h_list[-1]
s = 0
for h in h_list:
  if h <= mae:
    mae = h
  elif h-1 = mae:
    mae = h-1
  else:
    print('No')
    s += 1
    break
if s == 0:
  print('Yes')

# Fixed code:
n = int(input())
hoge_list = list(map(int,input().split()))
h_list = hoge_list[::-1]
mae = h_list[0]
s = 0
for h in h_list:
  if h <= mae:
    mae = h
  elif h-1 == mae:
    mae = h-1
  else:
    print('No')
    s += 1
    break
if s == 0:
  print('Yes')
# Buggy code:
N=int(input())
p=list(map(int,input().split()))
false_num=0
for i in range(N-1):
    if p[i]+1==p[i+1]:
        continue
    else:
        false_num+=1

if false_num=0 or 2:
    print('YES')
else:
    print('NO')


    
        

# Fixed code:
N=int(input())
p=list(map(int,input().split()))
false_num=0
for i in range(N):
    if p[i] != i+1:
        
        false_num+=1

if false_num==0 or false_num==2:
    print('YES')
else:
    print('NO')
# Buggy code:
#create date: 2020-07-05 10:48

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n = ni()
    p = na()
    for i in range(n-1):
        for j in range(i, n):
            q = p.copy()
            q[i] = p[j]; q[j] = p[i]
            now = q[i]
            f = True
            for qi in q:
                if now > qi:
                    f = False
                    break
                now = qi
            if f:
                print("Yes")
                quit()
    print("No")



if __name__ == "__main__":
    main()

# Fixed code:
#create date: 2020-07-05 10:48

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n = ni()
    p = na()
    for i in range(n-1):
        for j in range(i, n):
            q = p.copy()
            q[i] = p[j]; q[j] = p[i]
            now = q[0]
            f = True
            for qi in q:
                if now > qi:
                    f = False
                    break
                now = qi
            if f:
                print("YES")
                quit()
    print("NO")



if __name__ == "__main__":
    main()
# Buggy code:
# -*- coding: utf-8 -*-
#B
import sys
import math


n = int(input())
tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))

#print(hoge)

for i in range(0,n-1):
	if(hoge[i]<hoge[i+1]):
		if(i==n-2):
			print("YES")
			sys.exit()
	else:
		break

for i in range(0,n-1):
	for j in range(i+1,n):
		k=hoge[j]
		hoge[j]=hoge[i]
		hoge[i]=k
		for m in range(0,n-1):
			if(hoge[m]<hoge[m+1]):
				if(m==n-2):
					print("YES")
					sys.exit()
			else:
				break

print("NO")

# Fixed code:
# -*- coding: utf-8 -*-
#B
import sys
#import math


n = int(input())
tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))

#print(hoge)

for i in range(0,n-1):
	if(hoge[i]<hoge[i+1]):
		if(i==n-2):
			print("YES")
			sys.exit()
	else:
		break

for i in range(0,n-1):
	for j in range(i+1,n):
		k=hoge[j]
		hoge[j]=hoge[i]
		hoge[i]=k
		for m in range(0,n-1):
			if(hoge[m]<hoge[m+1]):
				if(m==n-2):
					print("YES")
					sys.exit()
			else:
				break
		k=hoge[j]
		hoge[j]=hoge[i]
		hoge[i]=k

print("NO")
# Buggy code:
n = int(input())

li = [int(i) for i in input().split()]

sortli = sorted(li)

count = 0

for i in range(n):
    if li[i] == sortli[i]:
        count += 1

if count + 2 == n:
    print('YES')
else:
    print('NO')


# Fixed code:
n = int(input())

li = [int(i) for i in input().split()]

sortli = sorted(li)

count = 0

for i in range(n):
    if li[i] == sortli[i]:
        count += 1

if count == n:
    print('YES')


elif count + 2 == n:
    print('YES')
else:
    print('NO')
# Buggy code:
n = int(input())
p = list(map(int, input().split()))

s_p=sorted(p, reverse=True)

cnt=0

for i in range(n-1):
  if p[i]!=s_p[i]:
    cnt +=1
  else:
    pass

if cnt >2:
  print('NO')
else:
  print('YES')

# Fixed code:
n = int(input())
p = list(map(int, input().split()))

s_p=sorted(p)

cnt=0

for i in range(n):
  if p[i]!=s_p[i]:
    cnt +=1
  else:
    pass

if cnt >2:
  print('NO')
else:
  print('YES')
# Buggy code:
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(len(p)):
  if p[i] != i + 1:
    cnt += 1
if cnt == 0 or 2:
  print("YES")
else:
  print("NO")

# Fixed code:
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(len(p)):
  if p[i] != i + 1:
    cnt += 1
if cnt == 0 or cnt == 2:
  print("YES")
else:
  print("NO")
# Buggy code:
import copy
N=int(input())
p=list(map(int,input().split()))
s=sorted(p)
flag=0
tmp=[]
for i in range(N):
  for j in range(i+1,N):
    tmp=copy.deepcopy(p)
    tmp[i],tmp[j]=tmp[j],tmp[i]
    if tmp == s:
      flag=1
print('NYOE S'[flag::2])

# Fixed code:
import copy
N=int(input())
p=list(map(int,input().split()))
s=sorted(p)
if s==p:
  print('YES')
else:
  flag=0
  tmp=[]
  for i in range(N):
    for j in range(i+1,N):
      tmp=copy.deepcopy(p)
      tmp[i],tmp[j]=tmp[j],tmp[i]
      if tmp == s:
        flag=1
  print('NYOE S'[flag::2])
# Buggy code:
a = int(input())
l=list(map(int ,input().split()))
count=0
for i in range(a-1):
        if l[i]>l[i+1]:
                count+=1

if count<=2:
        print("YES")
else:
        print("NO")    

# Fixed code:
a = int(input())
l=list(map(int ,input().split()))
count=0
for i in range(a):
        if i+1!=l[i]:
                count+=1
if count<=2:
        print("YES")
else:
        print("NO")
# Buggy code:
import itertools
import copy
n = int(input())
ps = list(map(int, input().split()))

c = list(itertools.combinations(range(n), 2))

ps_sort = sorted(ps)

for i in range(len(c)):
  nps  = copy.copy(ps)
  nps[c[i][0]], nps[c[i][1]] = nps[c[i][1]], nps[c[i][0]]
  if nps == ps_sort:
    print('YES')
    exit()
else:
  print('NO')
  
                                                
  

# Fixed code:
import itertools
import copy
n = int(input())
ps = list(map(int, input().split()))

c = list(itertools.combinations(range(n), 2))

ps_sort = sorted(ps)
if ps == ps_sort:
  print('YES')
  exit()
else:
  for i in range(len(c)):
    nps  = copy.copy(ps)
    nps[c[i][0]], nps[c[i][1]] = nps[c[i][1]], nps[c[i][0]]
    if nps == ps_sort:
      print('YES')
      exit()
  else:
    print('NO')
# Buggy code:
n = int(input())
p = list(map(int,input().split()))
nlst = [x for x in range(1,n+1)]
lst = [0]*n
for i in range(n):
  if nlst[i] == p[i]:
    lst[i] = 1
print('YES' if sum(lst) in [0,2] else 'NO')

# Fixed code:
n = int(input())
p = list(map(int,input().split()))
nlst = [x for x in range(1,n+1)]
lst = [0]*n
#print(nlst,lst)
for i in range(n):
    if nlst[i] != p[i]:
        lst[i] = 1
    #print(lst)
print('YES' if sum(lst) in [0,2] else 'NO')
# Buggy code:
import numpy as np
n = int(input())
p = [int(i) for i in input().split(" ")]
if len(p) == 0:
    print("YES")
else:
    c = [0 if p[i]==i+1 else 0 for i in range(n)]
    if np.sum(c) > 3:
        print("NO")
    else:
        print("YES")


# Fixed code:
import numpy as np
n = int(input())
p = [int(i) for i in input().split(" ")]
c = [0 if p[i]==i+1 else 1 for i in range(n)]
if np.sum(c) >= 3:
    print("NO")
else:
    print("YES")
# Buggy code:
N = int(input())
p = list(map(int, input().split()))

cnt = 0
for idx, val in enumerate(p):
    if idx + 1 != val:
        cnt += 1
        if cnt == 3:
            print('NO')
print('YES')

# Fixed code:
N = int(input())
p = list(map(int, input().split()))

cnt = 0
for idx, val in enumerate(p):
    if idx + 1 != val:
        cnt += 1
        if cnt == 3:
            print('NO')
            exit()
print('YES')
# Buggy code:
cnt = 0
n = int(input())
p = list(map(int, input().split())
for i in range(1, n + 1):
  if int(i) != p[i - 1] :
    cnt += 1
    if cnt >= 2:
      break
if cnt <= 1 :
  print("YES")
else :
   print("NO")


# Fixed code:
cnt = 0
n = int(input())
p = list(map(int, input().split()))
for i in range(1, n + 1):
  if int(i) != p[i - 1] :
    cnt += 1
    if cnt >= 3:
      break
if cnt <= 2 :
  print("YES")
else :
   print("NO")
# Buggy code:
N = int(input())
p = list(map(int, input().split()))
cnt = 0

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

if cnt <= 2:
    print('YES')
else: print('NO')


# Fixed code:
N = int(input())
p = list(map(int, input().split()))
cnt = 0
l = list()

for i in range(N-1):
    if p[i] > p[i+1]:
        cnt += 1
        l.append(i)

if cnt > 2:
    print('NO')
if cnt == 1:
    print('NO')
if cnt == 0:
    print('YES')
if cnt == 2:
    p[l[0]], p[l[1]+1] = p[l[1]+1], p[l[0]]
    cnt = 0
    for i in range(N-1):
        if p[i] > p[i+1]:
            cnt += 1
            l.append(i)
    if cnt == 0:
        print('YES')
    else:
        print('NO')
# Buggy code:
N=int(input())
P=[int(x) for x in input().split()]

N_J=list(range(1,N+1))
ans='NO'
for i in range(N):
    for j in range(N):
        P_temp=P.copy()
        p_i=P[i]
        p_j=P[j]

        P_temp[i]=p_j
        P_temp[j]=p_i
        
        if P==N_J:
            ans='YES'
print(ans)

# Fixed code:
N=int(input())
P=[int(x) for x in input().split()]
 
N_J=list(range(1,N+1))
ans='NO'
for i in range(N):
    for j in range(N):
        P_temp=P.copy()
        p_i=P[i]
        p_j=P[j]
 
        P_temp[i]=p_j
        P_temp[j]=p_i
        
        if P_temp==N_J:
            ans='YES'
print(ans)
# Buggy code:
n = int(input())
A = list(map(int, input().split()))
def check(L):
  for i in range(1, len(L)):
    if L[i] < L[i - 1]:
      return False
  return True
for i in range(n):
  for j in range(i + 1, n):
    if check(A[0:i] + [A[j]] + A[i+1:j] + [A[i]] + A[j+1:]):
      print('YES')
      return
print('NO')

# Fixed code:
def solve(n, A):
    def check(L):
        for i in range(1, len(L)):
            if L[i] < L[i - 1]:
                return False
        return True
    if check(A):
        return 'YES'
    for i in range(n):
        for j in range(i + 1, n):
            if check(A[0:i] + [A[j]] + A[i + 1:j] + [A[i]] + A[j + 1:]):
                return 'YES'
    return 'NO'

_n = int(input())
_A = list(map(int, input().split()))
print(solve(_n, _A))
# Buggy code:
n = int(input())
lis = list(map(int,input().split()))
li = sorted(lis)
cou = 0
for i in range(n):
  if lis[i] != li[i]:
    cou += 1
if cou >= 2:
  print("YES")
else:
  print("NO")

# Fixed code:
n = int(input())
lis = list(map(int,input().split()))
li = sorted(lis)
cou = 0
for i in range(n):
    if lis[i] != li[i]:
        cou += 1
    if cou > 2:
        print("NO")
        exit()
print("YES")
# Buggy code:
n = int(input())
p = list(map(int,input().split()))
count=0
#print(p)
p_sorted = sorted(p)
print(p_sorted)

for i in range(n):
    #print(i)
    if p[i]!=p_sorted[i]:
        count+=1
        #print(count)

if count==2:
    print("YES")
else :
    print("NO")

# Fixed code:
n = int(input())
p = list(map(int,input().split()))
count=0
#print(p)
p_sorted = sorted(p)
#print(p_sorted)

for i in range(n):
    #print(i)
    if p[i]!=p_sorted[i]:
        count+=1
        #print(count)

if count==0 or count==2:
    print("YES")
else :
    print("NO")
# Buggy code:
n = int(input())
xn = map(int,input().split())
k = 0
for i in range(1,n+1)
	if xn[i-1] != i:
    	k += 1
print("NO" if k > 2 else "YES")

# Fixed code:
n = int(input())
xn = [int(x) for x in input().split()]
k = 0
for i in range(1,n+1):
	if xn[i-1] != i:k += 1
        
print("NO" if k > 2 else "YES")
# Buggy code:
n = int(input())
p = list(map(int,input().split()))
q = sort(p)
for i in range(1,n):
    if p[i]  != q[i]:
        a += 1
if a  <= 2:
    print('YES')
else:
    print('NO')

# Fixed code:
n = int(input())
p = list(map(int,input().split()))
q = sorted(p)
a = 0
for i in range(n):
    if int(p[i])  != int(q[i]):
        a += 1
if a  <= 2:
    print('YES')
else:
    print('NO')
# Buggy code:
N=int(input())
P=list(map(int,input().split()))
L=sorted(P)
cnt=0
for i in range(N):
  if P[i]!=L[i]:
    cnt+=1
    
if cnt==2:
  print("YES")
else:
  print("NO")

# Fixed code:
N = int(input())
P = list(map(int, input().split()))

Ps = sorted(P)

cnt = 0
for i in range(N):
    if Ps[i]!=P[i]:
        cnt+=1
if cnt==2 or cnt==0:
    print('YES')
else:
    print('NO')
# Buggy code:
n = int(input())
p = map(int, input().split())

for i in range(1, n+1):
  if p[i-1] != i:
    count += 1
    
if count == 0 or count == 2:
  print("YES")
else:
  print("No")

# Fixed code:
n = int(input())
p = list(map(int, input().split()))
count = 0

for i in range(1, n+1):
  if p[i-1] != i:
    count += 1
    
if count == 0 or count == 2:
  print("YES")
else:
  print("NO")
# Buggy code:
n = int(input())
p = list(map(int, input().split()))


for i in range(n):
    for j in range(n):
        temp = list(copy(p))
        temp[i], temp[j] = temp[j], temp[i]
        sorted_temp = sorted(temp)

        if sorted_temp  == temp:
            print("YES")
            exit()

print("NO")

# Fixed code:
n = int(input())
p = list(map(int, input().split()))

for i in range(n):
    for j in range(n):
        temp = p.copy()
        temp[i], temp[j] = temp[j], temp[i]
        sorted_temp = sorted(temp)

        if sorted_temp  == temp:
            print("YES")
            exit()

print("NO")
# Buggy code:

s = input()
s = int(s)

nums = list(map(int,input().split()))

count = 0

for val in range(s):
    if val+1 != nums[val]:
        count +=1

if count <= 2:
    print('Yes')
else: 
    print('NO')


# Fixed code:
s = int(input())

nums = list(map(int,input().split()))

count = 0

for val in range(s):
    if val+1 != nums[val]:
        count += 1

if count <= 2:
    print('YES')
else: 
    print('NO')
# Buggy code:
n = int(input())
a = [int(k) for k in input().split()]
cnt = 0
for i in range(n):
  if a[i] != i+1:cnt += 1
print("YES" if k <= 2 else "NO")

# Fixed code:
n = int(input())
a = [int(k) for k in input().split()]
cnt = 0
for i in range(n):
  if a[i] != i+1:cnt += 1
print("YES" if cnt <= 2 else "NO")
# Buggy code:
N = int(input())
p = list(map(int, input().split()))
n = [i+1 in range(N)]
c = 0
for i in range(N):
  if n[i] != p[i]:
    c += 1
if c == 0 or c == 2:
  print("YES")
else:
  print("NO")
	

# Fixed code:
N = int(input())
p = list(map(int, input().split()))
n = [i+1 for i in range(N)]
c = 0
for i in range(N):
    if n[i] != p[i]:
        c += 1
if c == 0 or c == 2:
    print("YES")
else:
    print("NO")
# Buggy code:
N=int(input())
A=list(map(int,input().split()))
li=[]
for i in range(N):
  if A[i]!=AA[i]:
    li.append(A[i])
if len(li)>2:
  print("NO")
else:
  print("YES")

# Fixed code:
N=int(input())
A=list(map(int,input().split()))
AA=sorted(A)
li=[]
for i in range(N):
  if A[i]!=AA[i]:
    li.append(A[i])
if len(li)>2:
  print("NO")
else:
  print("YES")
# Buggy code:
N = int(input())
suuretsu_str = input().split()
suuretsu = [int(i) for i in suuretsu_str]
suuretsu_order = [i for i in range(1,N+1)]
count = 0
for i in range(N):
    if suuretsu[i] != suuretsu_order[i]
    count += 1
if count == 2:
    print("YES")
else:
    print("NO")

# Fixed code:
N = int(input())
suuretsu_str = input().split()
suuretsu = [int(i) for i in suuretsu_str]
suuretsu_order = [i for i in range(1,N+1)]
count = 0
for i in range(N):
    if suuretsu[i] != suuretsu_order[i]:
        count += 1
if count == 2 or count == 0:
    print("YES")
else:
    print("NO")
# Buggy code:
N = int(input())
lis = list(map(int,input().split()))
counter = 0
for i in N:
  if lis[i-1] - N != 0:
    counter += 1
if counter > 2:
  print('NO')
else:
  print('YES')

# Fixed code:
N = int(input())
lis = list(map(int,input().split()))
counter = 0
for i in range(N):
  if lis[i] - i-1 != 0:
    counter += 1
if counter > 2:
  print('NO')
else:
  print('YES')
# Buggy code:
def solve(string):
    n, *p = map(int, string.split())
    return "NO" if sum([i != _p for i, _p in enumerate(p, start=1)]) > 2 else "YES"


if __name__ == '__main__':
    print(solve(input()))


# Fixed code:
def solve(string):
    n, *p = map(int, string.split())
    return "NO" if sum([i != _p for i, _p in enumerate(p, start=1)]) > 2 else "YES"


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))
# Buggy code:
N, D = map(int, input().split())
print((N+1)//(2*D+1)+1)

# Fixed code:
N, D  = map(int, input().split())
print(-(-N//(2*D+1)))
# Buggy code:
import math
n,d = map(int, input().split())
print(math.ceil((n/((d+1)*2)) + 1))


# Fixed code:
import math
n, d = map(int, input().split())
print(math.ceil(n / (2*d+1)))
# Buggy code:
n,d=list(map(int,input().split()))

cnt = n // (2*d+1)

if cnt == 0:
    print(cnt)
else:
    print(cnt + 1)

# Fixed code:
n,d=list(map(int,input().split()))

cnt = n // (2*d+1)

if n%(2*d+1) == 0:
    print(cnt)
else:
    print(cnt + 1)
# Buggy code:
n,d=map(int,input().split())
if n%2==0:
    print(n//(d*2)+1)
else:
    print(n//(d+1))




# Fixed code:
n,d = map(int,input().split())
k = 1 + 2*d
if n%k == 0:
    print(n//k)
else:
    print(n//k+1)
# Buggy code:
N, D = map(int, input().split())

i = 1
left = 1
res = 0
while i <= N:
    if i - D == left:
        print(i, left)
        left = i + D + 1
        res += 1
    i += 1

if left <= N: res += 1

print(res)

# Fixed code:
N, D = map(int, input().split())

i = 1
left = 1
res = 0
while i <= N:
    if i - D == left:
        left = i + D + 1
        res += 1
    i += 1

if left <= N: res += 1

print(res)
# Buggy code:
N, D = map(int, input().split())
D = 2*D + 1
print(N//D)

# Fixed code:
N,D = map(int,input().split())
print((N+2*D)//(2*D+1))
# Buggy code:
n,d=map(int,input().split())
ans=n//(2*d+1)+1
print(ans)

# Fixed code:
n,d = map(int,input().split())
print((n + 2 * d) // (2 * d + 1))
# Buggy code:
n,s=map(int,input().split())

count=n//(2*d+1)

if n%(2*d+1)==0:
    print(count)
else:
    print(count+1)

# Fixed code:
n,d=map(int,input().split())
if n%(2*d+1)==0:
    s=0
else:
    s=1
print(n//(2*d+1)+s)
# Buggy code:
n,d=map(int,input().split())
print((n+2*d-1)//(2*d))

# Fixed code:
n,d=map(int,input().split())
d=2*d+1
print((n+(d-1))//d)
# Buggy code:
N,D=map(int,input().split())
print((N//(2*D+1))+1)

# Fixed code:
N, D = map(int, input().split())
print((2*D+N)//(2*D+1))
# Buggy code:
import math
n,d=map(int,input().split())
print(math,ceil(n/(d*2+1)))

# Fixed code:
import math

n,d = map(int,input().split())

k = n/(d*2+1)
print(math.ceil(k))
# Buggy code:
import math
n,d = map(int,input().split())
print(math.ceil(n//(d*2+1)))

# Fixed code:
from math import ceil
n,d = map(int,input().split())
print(ceil(n/(d*2+1)))
# Buggy code:
import math

S = input()

S = S.split()

N = int(S[0])
D = int(S[1])

print(math.ceil(N*(2*D+1)))

# Fixed code:
import math

S = input()

S = S.split()

N = int(S[0])
D = int(S[1])

print(math.ceil(N/(2*D+1)))
# Buggy code:
n, d = map(int, input().split())

ans = round((n + 2 * d) / (2 * d + 1)) 
print(ans)


# Fixed code:
n, d = map(int, input().split())

ans = (n + 2 * d) / (2 * d + 1) 
print(int(ans))
# Buggy code:
N,D = map(int,input(),split()))
a = (N-1)/(2*D)
if (N-1)%(2*D)==0:
	print(a)
else :
 	print((N-1)//2*D+1)

# Fixed code:
N,D = map(int,input().split())
a = N//(2*D+1)
if N%(2*D+1) == 0:
	print(a)
else:
 	print(a+1)
# Buggy code:
a,b=map(int,input().split())
d=b*2+1

c=a/d
if c>b:
  print(c+1)
else:
  print(c)

# Fixed code:
a,b=map(float,input().split())

d=b*2+1

c=a/d

if c>int(c):
  print(int(c)+1)
else:
  print(int(c))
# Buggy code:
n, d = map(int, input().split())

print(n // (2 * d + 1) + 1)


# Fixed code:
n, d = map(int, input().split())

print((n + 2 * d) // (2 * d + 1))
# Buggy code:
nd = list(map(int, input().split(' ')))

a = nd[0] // (nd[1]*2)

if (nd[0]%(nd[1]*2)) != 0:
    a += 1

print(a)


# Fixed code:
nd = list(map(int, input().split(' ')))

a = nd[0] // (nd[1]*2+1)

if (nd[0]%(nd[1]*2+1)) != 0:
    a += 1

print(a)
# Buggy code:
import math

n,d=list(map(int(input().split()))
         
print (math.ceil(n/1+2*d))

# Fixed code:
import math

n, d = list(map(int, input().split()))

print(math.ceil(n / (1+2*d)))
# Buggy code:
n,d=map(int, input().split())
print(n//(2*d+1)+1)


# Fixed code:
n, d = map(int, input().split())
print(-(-n // (d * 2 + 1)))
# Buggy code:
import math
N, D = map(int, input().split())

print(math.ceil(N/(2*D+1))

# Fixed code:
import math
N, D = map(int, input().split())
k = 2 * D + 1
print(math.ceil(N / k))