Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())

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

v = sorted(v, reverse = False)

sum = v[0] / 2**(N-1)
for i in range(1, N):
    sum += v[i]/2**(N-i)

pprint(sum)

Fixed submission:
N = int(input())

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

v = sorted(v, reverse = False)

sum = v[0] / pow(2, N-1)
for i in range(1, N):
    sum += v[i]/pow(2, (N-i))

print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
#input
N, K = map(int, input().split())
h = list(map(int, input().split()))

#output
dp = [0] * N
dp[1] = abs(h[1]-h[0])

for i in range(2, N):
    temp = abs(h[i]-h[i-1]) + dp[i-1]
    for j in range(2, K+1):
        if 0<= i-j <= N-1:
            temp = min(temp, dp[i-j]+abs(h[i]-h[i-j]))
    dp[i] = temp

print(dp[N-1])

Fixed submission:
#input
N, K = map(int, input().split())
h = list(map(int, input().split()))

#output
dp = [0] * N
dp[1] = abs(h[1]-h[0])

for i in range(2, N):
    temp = abs(h[i]-h[i-1]) + dp[i-1]
    for j in range(2, K+1):
        if 0<= i-j <= N-1:
            temp = min(temp, dp[i-j]+abs(h[i]-h[i-j]))
    dp[i] = temp

print(dp[N-1])
Buggy python submission (verdict: Runtime Error):
#input
N, W = map(int, input().split())
w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

#output
import numpy as np
dp = np.zeros((N+1, W+1), int)

for i in range(N):
    for j in range(W+1):
        if j-w[i] < 0:
            dp[i+1, j] = dp[i, j]
        else:
            dp[i+1, j] = max(dp[i, j], dp[i, j-w[i]]+v[i])

print(dp[-1, -1])

Fixed submission:
#input
N, W = map(int, input().split())
w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

#output
import numpy as np
dp = np.zeros((N+1, W+1), int)

for i in range(N):
    dp[i+1, w[i]:] = np.maximum(dp[i, w[i]:], dp[i, :-w[i]] + v[i])
    dp[i+1, :w[i]] = dp[i, :w[i]]

print(dp[-1, -1])

Buggy python submission (verdict: Time Limit Exceeded):
#input
N, W = map(int, input().split())
w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

#output
import numpy as np
dp = np.zeros((N+1, W+1), int)

for i in range(N):
    for j in range(W+1):
        if j-w[i] < 0:
            dp[i+1, j] = dp[i, j]
        else:
            dp[i+1, j] = max(dp[i, j], dp[i, j-w[i]]+v[i])

print(dp[-1, -1])

Fixed submission:
#input
N, W = map(int, input().split())
w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

#output
import numpy as np
dp = np.zeros((N+1, W+1), int)

for i in range(N):
    dp[i+1, w[i]:] = np.maximum(dp[i, w[i]:], dp[i, :-w[i]] + v[i])
    dp[i+1, :w[i]] = dp[i, :w[i]]

print(dp[-1, -1])
Buggy python submission (verdict: Time Limit Exceeded):
#input
N, W = map(int, input().split())
w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

#output
import numpy as np
V = max(v)
INF = 10**10
dp = np.full((N+1, N*V+1), INF)
dp[0, 0] = 0

for i in range(N):
    for j in range(N*V+1):
        if j < v[i]:
            dp[i+1, j] = dp[i, j]
        else:
            dp[i+1, j] = min(dp[i, j], dp[i, j-v[i]]+w[i])
        
answer = 0
for i in range(N*V+1):
    if dp[N, i] <= W:
        answer = i

print(answer)

Fixed submission:
#input
N, W = map(int, input().split())
w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

#output
import numpy as np
V = max(v)
INF = 10**10
dp = np.full((N+1, N*V+1), INF)
dp[0, 0] = 0

for i in range(N):
    dp[i+1, v[i]:] = np.minimum(dp[i, v[i]:], dp[i, :-v[i]]+w[i])
    dp[i+1, :v[i]] = dp[i, :v[i]]

answer = 0
for i in range(N*V+1):
    if dp[N, i] <= W:
        answer = i

print(answer)

Buggy python submission (verdict: Runtime Error):
#input
N, W = map(int, input().split())
w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

#output
import numpy as np
V = max(v)
INF = 10**6
dp = np.zeros((N+1, N*V+1), int)
dp[0] = INF
dp[0, 0] = 0

for i in range(N):
    for j in range(N*V+1):
        if j < v[i]:
            dp[i+1, j] = dp[i, j]
        else:
            dp[i+1, j] = min(dp[i, j], dp[i, j-v[i]] + w[i])

answer = 0
for i in range(N*V+1):
    if dp[N, i] <= W:
        answer = i

print(answer)

Fixed submission:
#input
N, W = map(int, input().split())
w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

#output
import numpy as np
V = max(v)
INF = 10**10
dp = np.full((N+1, N*V+1), INF)
dp[0, 0] = 0

for i in range(N):
    dp[i+1, v[i]:] = np.minimum(dp[i, v[i]:], dp[i, :-v[i]]+w[i])
    dp[i+1, :v[i]] = dp[i, :v[i]]

answer = 0
for i in range(N*V+1):
    if dp[N, i] <= W:
        answer = i

print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
#input
N, W = map(int, input().split())
w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

#output
import numpy as np
V = max(v)
INF = 10**6
dp = np.zeros((N+1, N*V+1), int)
dp[0] = INF
dp[0, 0] = 0

for i in range(N):
    for j in range(N*V+1):
        if j < v[i]:
            dp[i+1, j] = dp[i, j]
        else:
            dp[i+1, j] = min(dp[i, j], dp[i, j-v[i]] + w[i])

answer = 0
for i in range(N*V+1):
    if dp[N, i] <= W:
        answer = i

print(answer)

Fixed submission:
#input
N, W = map(int, input().split())
w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

#output
import numpy as np
V = max(v)
INF = 10**10
dp = np.full((N+1, N*V+1), INF)
dp[0, 0] = 0

for i in range(N):
    dp[i+1, v[i]:] = np.minimum(dp[i, v[i]:], dp[i, :-v[i]]+w[i])
    dp[i+1, :v[i]] = dp[i, :v[i]]

answer = 0
for i in range(N*V+1):
    if dp[N, i] <= W:
        answer = i

print(answer)
Buggy python submission (verdict: Runtime Error):
#input
D, N = map(int, input().split())

#output
if D == 0:
    if N = 100:
        print(101)
    else:
        print(N)
elif D == 1:
    if N == 100:
        print(10100)
    else:
        print(100*N)
else:
    if N == 100:
        print(1010000)
    else:
        print(100**2*N)

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

#output
if D == 0:
    if N == 100:
        print(101)
    else:
        print(N)
elif D == 1:
    if N == 100:
        print(10100)
    else:
        print(100*N)
else:
    if N == 100:
        print(1010000)
    else:
        print(100**2*N)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
array = []
array += map(int,input().split())
sumarray = sum(array)
step = 0
while array != []:
    rearray=array[array.index(max(array)):]
    step+=len(rearray)*max(array)
    del array[array.index(max(array)):]
ans=step-sumarray
print(ans)


Fixed submission:
N = int(input())
array = []
array+=map(int,input().split())
ans=0
premax=0
for n in range(N):
    premax=max(array[n],premax)
    ans+=premax-array[n]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
array = []
array += map(int,input().split())
sumarray = sum(array)
step = 0
while array != []:
    rearray=array[array.index(max(array)):]
    step+=len(rearray)*max(array)
    del array[array.index(max(array)):]
ans=step-sumarray
print(ans)


Fixed submission:
N = int(input())
array = []
array+=map(int,input().split())
ans=0
premax=0
for n in range(N):
    premax=max(array[n],premax)
    ans+=premax-array[n]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
X,K,D = map(int,input().split())
X = abs(X)
if X-K*D>=0:
    print(X-K*D)
else:
    while(X > 0 and K > 0):
        K = K-1
        X = X-D
    if K % 2 == 0:
        print(abs(X))
    else:
        X = X+D
        print(X)

Fixed submission:
X,K,D = map(int,input().split())
X = abs(X)
N = X//D
if N>K:
    N=K
X = X-N*D
K -= N
if K%2 == 0:
    print(X)
else:
    X -= D
    print(abs(X))

Buggy python submission (verdict: Time Limit Exceeded):
X,K,D = map(int,input().split())
X = abs(X)
while(X > 0 and K > 0):
    K = K-1
    X = X-D
if K % 2 == 0:
    print(abs(X))
else:
    X = X+D
    print(X)

Fixed submission:
X,K,D = map(int,input().split())
X = abs(X)
N = X//D
if N>K:
    N=K
X = X-N*D
K -= N
if K%2 == 0:
    print(X)
else:
    X -= D
    print(abs(X))
Buggy python submission (verdict: Runtime Error):
import math

N,D = map(int,input().split())
cnt = 0
for n in range(N):
    a,b = map(int,input().split())
    if sqrt(a**2 + b**2)-D>=0:
        cnt+=1
print(cnt)

Fixed submission:
import math

N,D = map(int,input().split())
cnt = 0
for n in range(N):
    a,b = map(int,input().split())
    if math.sqrt(a**2 + b**2)-D<=0:
        cnt+=1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
array=[]
array+=map(int,input().split())
flag=0
flag2=0
s=1
for m in range(len(array)):
    if array[m]==0:
        flag=1
        break
    s=s*array[m]

if flag==1:
    print("0")
elif s>10**18:
    print("-1")
else:print(s)



Fixed submission:
n=int(input())
array=[]
array+=map(int,input().split())
flag=0
flag2=0
s=1
for m in range(len(array)):
    if array[m]==0:
        flag=1
        break
    s=s*array[m]
    if s>10**18:
        flag2=1
        break
flag3=0
if flag==1:
    print("0")
elif flag2==1:
    for i in range(m,len(array)):
        if array[i]==0:
            flag3=1
            print("0")
    if flag3==0:
        print("-1")

else:print(s)

Buggy python submission (verdict: Runtime Error):
n=int(input())
array=[]
for i in range(n):
    array+=[int(input())]
flag=0
flag2=0
s=1
for m in range(len(array)):
    if array[m]==0:
        flag=1
        break
    s=s*array[m]
    if s>10**18:
        flag2=1
        break

if flag==1:
    print("0")
elif flag==2:
    print("-1")
else:print(s)



Fixed submission:
n=int(input())
array=[]
array+=map(int,input().split())
flag=0
flag2=0
s=1
for m in range(len(array)):
    if array[m]==0:
        flag=1
        break
    s=s*array[m]
    if s>10**18:
        flag2=1
        break
flag3=0
if flag==1:
    print("0")
elif flag2==1:
    for i in range(m,len(array)):
        if array[i]==0:
            flag3=1
            print("0")
    if flag3==0:
        print("-1")

else:print(s)
Buggy python submission (verdict: Runtime Error):
import math

N, x, T = map(int, input().split)

print(math.ceil(N / x) * T)

Fixed submission:
import math

N, x, T = map(int, input().split())

print(math.ceil(N / x) * T)

Buggy python submission (verdict: Runtime Error):
import math

N,x,t = map(int,input().split)

print(math.ceil(N / x)*T)

Fixed submission:
import math

N, x, T = map(int, input().split())

print(math.ceil(N / x) * T)

Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
x = int(input())
T = int(input())

print(str(T * math.ceil(N / x)))

Fixed submission:
import math

N, x, T = map(int, input().split())

print(math.ceil(N / x) * T)

Buggy python submission (verdict: Runtime Error):
N = int(intput())
x = int(input())
T = int(input())

print(str(T*floor(N/x)))

Fixed submission:
import math

N, x, T = map(int, input().split())

print(math.ceil(N / x) * T)

Buggy python submission (verdict: Runtime Error):


n = input()
x = input()
t = input()

print((n//x+1)*t)

Fixed submission:
import math

N, x, T = map(int, input().split())

print(math.ceil(N / x) * T)

Buggy python submission (verdict: Runtime Error):
import numpy

n = input()
x = input()
t = input()

print((n//x+1)*t)

Fixed submission:
import math

N, x, T = map(int, input().split())

print(math.ceil(N / x) * T)
Buggy python submission (verdict: Runtime Error):
X = input()
if X < 30:
  print('No')
else:
  print('Yes')

Fixed submission:
X = int(input())
if X < 30:
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
N = int(input())
eList = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
n = N
mod = N
numList = []
 
while n > 0:
  n, mod = divmod(n,26)
  if mod != 0:
    numList.insert(0, mod - 1)
  else:
    numList.insert(0, 25)
    n -= 1
for num in numList:
  ans += eList[num]
print(ans)

Fixed submission:
str = input()
if str.islower():
  print('a')
else:
  print('A')
Buggy python submission (verdict: Runtime Error):
N = int(input())
eList = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
n = N
mod = N
numList = []
 
while n > 0:
  n, mod = divmod(n,26)
  if mod != 0:
    numList.insert(0, mod - 1)
  else:
    numList.insert(0, 25)
    n -= 1
for num in numList:
  ans += eList[num]
print(ans)

Fixed submission:
N = int(input())
eList = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
n = N
mod = N
numList = []
 
while n > 0:
  n, mod = divmod(n,26)
  if mod != 0:
    numList.insert(0, mod - 1)
  else:
    numList.insert(0, 25)
    n -= 1
ans =''
for num in numList:
  ans += eList[num]
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
eList = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
n = N
mod = N
numList = []

while n > 0:
  n, mod = divmod(n,26)
  if mod != 0:
    numList.insert(0, mod - 1)
  else:
    numList.insert(0, 25)
    n -= 1
for num in numList:
  if num != 0:
    ans += eList[num]
print(ans)

Fixed submission:
N = int(input())
eList = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
n = N
mod = N
numList = []
 
while n > 0:
  n, mod = divmod(n,26)
  if mod != 0:
    numList.insert(0, mod - 1)
  else:
    numList.insert(0, 25)
    n -= 1
ans =''
for num in numList:
  ans += eList[num]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
S = [list(map(int, input().split())) for l in range(Q)]

numList = {}

for n in range(N):
  if A[n] not in numList:
    numList[A[n]] = 0
  numList[A[n]] += 1

for q in range(Q):
  if S[q][0] in numList:
    if S[q][1] not in numList:
      numList[S[q][1]] = 0
    numList[S[q][1]] += numList[S[q][0]]
    numList[S[q][0]] = 0
  sum = 0
  for key, value in numList.items():
    sum += key * value
  print(sum)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
S = [list(map(int, input().split())) for l in range(Q)]
 
numList = {}
sum = 0

for n in range(N):
  if A[n] not in numList:
    numList[A[n]] = 0
  numList[A[n]] += 1
  sum += A[n]

for q in range(Q):
  if S[q][0] in numList:
    if S[q][1] not in numList:
      numList[S[q][1]] = 0
    sum += (S[q][1] - S[q][0]) * numList[S[q][0]]
    numList[S[q][1]] += numList[S[q][0]]
    numList[S[q][0]] = 0
  print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
S = [list(map(int, input().split())) for l in range(Q)]

for q in range(Q):
  for n in range(N):
    if A[n] == S[q][0]:
      A[n] = S[q][1]
  print(sum(A))

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
S = [list(map(int, input().split())) for l in range(Q)]
 
numList = {}
sum = 0

for n in range(N):
  if A[n] not in numList:
    numList[A[n]] = 0
  numList[A[n]] += 1
  sum += A[n]

for q in range(Q):
  if S[q][0] in numList:
    if S[q][1] not in numList:
      numList[S[q][1]] = 0
    sum += (S[q][1] - S[q][0]) * numList[S[q][0]]
    numList[S[q][1]] += numList[S[q][0]]
    numList[S[q][0]] = 0
  print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A.sort()
count = 0
for i in range(N):
  judge = 0
  for j in range(N):
    if A[j] > A[i] and i != j:
      break
    if A[i] % A[j] == 0 and i != j:
      judge = 1
      break
  if judge == 0:
    count += 1
print(count)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
countList = [0]*(10**6 + 1)
answer = 0

# Aにnがm個あるときcountList[n] = m
for i in A:
  countList[i] += 1

for j in range(10**6 + 1):
  # Aにjが含まれていれば、jの倍数をすべてcountListから除外
  # jの倍数pはjで割り切れるので除外可能
  # pの倍数qはjでも割り切れるのでjの時の処理によって除外される
  if countList[j] > 0:
    for k in range(2 * j, 10**6 + 1, j):
      countList[k] = 0
  # jが2個以上ある場合にはそれを正解としてカウントしない
  if countList[j] == 1:
      answer += 1

print(answer)
Buggy python submission (verdict: Runtime Error):
N = int(input())
pri_cnt = {}
n = N
i = 2

while i ** 2 <= N
  while n % i == 0:
    if i not in div_cnt:
      pri_cnt[i] = 1
    else:
      pri_cnt[i] += 1
    
    n = n / i

if n > 1:
  pri_cnt[N] = 1

ans = 0
for pri, cnt in pri_knt:
  count = 1
  remain = cnt
  while remain > count:
    ans += 1
    remain -= count
    count += 1
print(ans)

Fixed submission:
N = int(input())
pri_cnt = {}
n = N
i = 2

while i ** 2 <= N:
  while n % i == 0:
    if i not in pri_cnt:
      pri_cnt[i] = 1
    else:
      pri_cnt[i] += 1
    n = n / i
  if (i == 2):
    i += 1
  else:
    i += 2

if n > 1:
  pri_cnt[int(n)] = 1

ans = 0
for pri, cnt in pri_cnt.items():
  count = 1
  remain = cnt
  while remain >= count:
    ans += 1
    remain -= count
    count += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
X = int(input())
Y = int(input())
flag =0
for crane in range(X + 1):
  if (Y - crane*2 - (X-crane)*4 ) == 0:
    print("Yes")
    flag =1
    break
if flag == 0:
    print("No")

Fixed submission:
def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()


X, Y = list(map(int, input().split()))
Turtle = (Y - 2*X ) / 2
Crane = X - Turtle
if Turtle >= 0 and Crane >= 0 and is_integer(Turtle) and is_integer(Crane):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()


X = int(input())
Y = int(input())
Turtle = (Y - 2*X ) / 2
Crane = X - Turtle
if Turtle >= 0 and Crane >= 0 and is_integer(Turtle) and is_integer(Crane):
    print("Yes")
else:
    print("No")

Fixed submission:
def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()


X, Y = list(map(int, input().split()))
Turtle = (Y - 2*X ) / 2
Crane = X - Turtle
if Turtle >= 0 and Crane >= 0 and is_integer(Turtle) and is_integer(Crane):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
X = int(input())
Y = int(input())
if (Y-2*X) % 2 == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()


X, Y = list(map(int, input().split()))
Turtle = (Y - 2*X ) / 2
Crane = X - Turtle
if Turtle >= 0 and Crane >= 0 and is_integer(Turtle) and is_integer(Crane):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n,x,t = map(int,input.split())
a = (n//x + 1)*t
print(a)

Fixed submission:
n,x,t = map(int,input().split())
if n%x==0:
    print((n//x)*t)
else:
    print(((n//x)+1)*t)

Buggy python submission (verdict: Runtime Error):
n,x,t = map(int(input.split()))
a = (n//x + 1)*t
print(a)

Fixed submission:
n,x,t = map(int,input().split())
if n%x==0:
    print((n//x)*t)
else:
    print(((n//x)+1)*t)

Buggy python submission (verdict: Runtime Error):
n,x,t = int(input.split())
a = n//x + 1
print(a)

Fixed submission:
n,x,t = map(int,input().split())
if n%x==0:
    print((n//x)*t)
else:
    print(((n//x)+1)*t)
Buggy python submission (verdict: Runtime Error):
m,n = map(int,input().split())
l = list(map(int,input().split()))
for i in range(n):
  s += l[i]
print(max(m-s,-1))

Fixed submission:
m,n = map(int,input().split())
l = list(map(int,input().split()))
s = 0
for i in range(n):
  s += l[i]
print(max(m-s,-1))
Buggy python submission (verdict: Runtime Error):
print(int(inpu())**2)

Fixed submission:
print(int(input())**2)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
ans = 0
for i in range(3):
  if s[i]==s[t]:
    ans+=1
print(ans)

Fixed submission:
s = input()
t = input()
ans = 0
for i in range(3):
  if s[i]==t[i]:
    ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for i in range(1,n):
    ans +=i
print(ans)

Fixed submission:
n = int(input())
if n%2:
    p = ((n-1)//2)*n
    print(int(p))
else:
    p = (n//2)*(n-1)
    print(int(p))
Buggy python submission (verdict: Runtime Error):
a.b,c = map(int,input().split())
print(c-(a-b))

Fixed submission:
a,b,c = map(int,input().split())
ans = c-(a-b)
if ans <0:
  print("0")
else:
  print(ans)
Buggy python submission (verdict: Runtime Error):
t,d = map(int,input().split())
p_a = t//(2d+1)
p_b = t%(2d+1)
if p_b == 0:
  print(p_a)
else:
  print(p_a + 1)
  


Fixed submission:
t,d = map(int,input().split())
p_a = t//(2*d+1)
p_b = t%(2*d+1)
if p_b == 0:
  print(p_a)
else:
  print(p_a + 1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a  =[]
for i in range(n):
  a.append(int(inpit())
ma = max(a)
b = sorted(a)
for i in range(n):
  if a[i] != ma:
    print(ma)
  else:
    print(b[-2])
    
  


Fixed submission:
n = int(input())
a  =[]
for i in range(n):
  x = int(input())
  a.append(x)
ma = max(a)
b = sorted(a)
for i in range(n):
  if a[i] != ma:
    print(ma)
  else:
    print(b[-2])

Buggy python submission (verdict: Time Limit Exceeded):
import copy
n = int(input())
a = [int(input()) for _ in range(n)]

for i in range(n):
  tmp = copy.deepcopy(a)
  tmp[i] = 0
  print(max(tmp))
  tmp = a

Fixed submission:
n = int(input())
a  =[]
for i in range(n):
  x = int(input())
  a.append(x)
ma = max(a)
b = sorted(a)
for i in range(n):
  if a[i] != ma:
    print(ma)
  else:
    print(b[-2])

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input()), for _ in range(n)]

for i in range(n):
  tmp = a
  tmp[i-1] = 0
  print(max(tmp))
  tmp = a

Fixed submission:
n = int(input())
a  =[]
for i in range(n):
  x = int(input())
  a.append(x)
ma = max(a)
b = sorted(a)
for i in range(n):
  if a[i] != ma:
    print(ma)
  else:
    print(b[-2])
Buggy python submission (verdict: Runtime Error):
n,d = map(int,input().split())
x = [list(map(int,input().split())) for _ in range(n)]

c=0
for i in range(n-1):
  for j in range(i+1,n):
    c+=(sum((a-b)**2 for a,b in zip(x[i],x[j]))**0.5).is_integer

print(c)

Fixed submission:
n,d = map(int,input().split())
x = [list(map(int,input().split())) for _ in range(n)]

c=0
for i in range(n-1):
  for j in range(i+1,n):
    c+=(sum((a-b)**2 for a,b in zip(x[i],x[j]))**0.5).is_integer()

print(c)