Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#import numpy as np
#import math
#from decimal import *
#from numba import njit
from bisect import bisect_left

#@njit
def main():
    N = int(input())
    a = list(map(int, input().split()))
    edges = [[] for _ in range(N+1)]
    for _ in range(N-1):
        u,v = map(int, input().split())
        edges[u] += v,
        edges[v] += u,

    ans = [0]*(N+1)
    lastLis = []
    visited = [False]*(N+1)
    parent = {}
    n = 1
    stack = []

    def rec(n):
        nonlocal lastLis,stack
        #print(n, lastLis, stack)
        if not visited[n]:
            if len(lastLis) == 0 or a[n-1] > lastLis[-1]:
                lastLis.append(a[n-1])
                stack += (len(lastLis)-1, -1),
            else:
                index = bisect_left(lastLis, a[n-1])
                stack += (index, lastLis[index]),
                lastLis[index] = a[n-1]
            ans[n] = len(lastLis)
            visited[n] = True
        else:
            pass
        hasNext = False
        for d in edges[n]:
            if not visited[d]:
                parent[d] = n
                rec(d)
                hasNext = True
        # 巻き戻し
        index, value = stack.pop(len(stack)-1)
        if value < 0:
            lastLis.pop(index)
        else:
            lastLis[index] = value

    rec(1)
    for i in range(1, len(ans)):
        print(ans[i])




main()


Fixed submission:
#import numpy as np
#import math
#from decimal import *
#from numba import njit
from bisect import bisect_left

#@njit
def main():
    N = int(input())
    a = list(map(int, input().split()))
    edges = [[] for _ in range(N+1)]
    for _ in range(N-1):
        u,v = map(int, input().split())
        edges[u] += v,
        edges[v] += u,

    ans = [0]*(N+1)
    lastLis = []
    visited = [False]*(N+1)
    parent = {}
    n = 1
    stack = []
    while True:
        #print(n, lastLis, stack)
        if not visited[n]:
            if len(lastLis) == 0 or a[n-1] > lastLis[-1]:
                lastLis.append(a[n-1])
                stack += (len(lastLis)-1, -1),
            else:
                index = bisect_left(lastLis, a[n-1])
                stack += (index, lastLis[index]),
                lastLis[index] = a[n-1]
            ans[n] = len(lastLis)
            visited[n] = True
        hasNext = False
        for d in edges[n]:
            if not visited[d]:
                parent[d] = n
                n = d
                hasNext = True
        if not hasNext:
            if n == 1:
                n = 0
                break
            n = parent[n]
            # 巻き戻し
            index, value = stack.pop(len(stack)-1)
            if value < 0:
                lastLis.pop(index)
            else:
                lastLis[index] = value

    for i in range(1, len(ans)):
        print(ans[i])




main()
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
#import math
#from decimal import *
#from numba import njit

#@njit
def main():
    N = int(input())
    A = list(map(int, input().split()))

    A = sorted(enumerate(A), key = lambda x: x[1])[::-1]

    dp = np.zeros((N+1,N+1), dtype='int64')
    #dp = [[0]*(N+1-i) for i in range(N+1)]

    #m = 0
    for i in range(1,len(A)+1):
        index,a = A[i-1]
        for j in range(i+1):
            if (i-j,j) == (0,0):
                dp[i-j][j] = 0
            elif i-j == 0:
                dp[i-j][j] = dp[i-j][j-1] + (N-j-index)*a
            elif j == 0:
                dp[i-j][j] = dp[i-j-1][j] + (abs(index-(i-j-1)))*a
            else:
                dp[i-j][j] = max(dp[i-j][j-1] + (N-j-index)*a, dp[i-j-1][j] + (abs(index-(i-j-1)))*a)
            #if i == len(A):
            #    m = max(m, dp[i-j][j])

    #print(dp)
    print(np.max(dp))
    #print(m)

main()


Fixed submission:
#import numpy as np
#import math
#from decimal import *
#from numba import njit

#@njit
def main():
    N = int(input())
    A = list(map(int, input().split()))

    A = sorted(enumerate(A), key = lambda x: x[1])[::-1]

    #dp = np.zeros((N+1,N+1), dtype='int64')
    dp = [[0]*(N+1-i) for i in range(N+1)]

    m = 0
    for i in range(1,len(A)+1):
        index,a = A[i-1]
        for j in range(i+1):
            if (i-j,j) == (0,0):
                dp[i-j][j] = 0
            elif i-j == 0:
                dp[i-j][j] = dp[i-j][j-1] + (N-j-index)*a
            elif j == 0:
                dp[i-j][j] = dp[i-j-1][j] + (abs(index-(i-j-1)))*a
            else:
                dp[i-j][j] = max(dp[i-j][j-1] + (N-j-index)*a, dp[i-j-1][j] + (abs(index-(i-j-1)))*a)
            if i == len(A):
                m = max(m, dp[i-j][j])

    #print(dp)
    #print(np.max(dp))
    print(m)

main()
Buggy python submission (verdict: Runtime Error):
import numpy as np
#from numba import njit

#(N, K) = map(int, input().split())
#A = np.array(list(map(int, input().split())))
(N,M) = map(int, input().split())
X = map(int, input().split())
X = sorted(X)

Y = []
for i in range(1,M):
    Y.append((i,X[i] - X[i-1]))

Y = sorted(Y, key=lambda x: (x[1]))
Y.reverse()

Z = []
last = 0
for i in range(0,min(N-1, len(Y))):
    Z.append(X[last:Y[i][0]])
    last = Y[i][0]
Z.append(X[last:])
if len(Z) == 0:
    Z.append(X)

s = 0
for array in Z:
    u = max(array)
    l = min(array)
    s += u - l

print(s)

Fixed submission:
import numpy as np
#from numba import njit

#(N, K) = map(int, input().split())
#A = np.array(list(map(int, input().split())))
(N,M) = map(int, input().split())
X = map(int, input().split())
X = sorted(X)

Y = []
for i in range(1,M):
    Y.append((i,X[i] - X[i-1]))

Y = sorted(Y, key=lambda x: (x[1]))
Y.reverse()

I = list(map(lambda x: x[0], Y[0:min(N-1, len(Y))]))
I.sort()

Z = []
last = 0
for i in range(0,min(N-1, len(Y))):
    if last < I[i]:
        Z.append(X[last:I[i]])
        last = I[i]
Z.append(X[last:])
if len(Z) == 0:
    Z.append(X)

s = 0
for array in Z:
    if len(array) > 0:
        u = max(array)
        l = min(array)
        s += u - l

print(s)

Buggy python submission (verdict: Runtime Error):
import numpy as np
#from numba import njit

#(N, K) = map(int, input().split())
#A = np.array(list(map(int, input().split())))
(N,M) = map(int, input().split())
X = map(int, input().split())
X = sorted(X)

Y = []
for i in range(1,M):
    Y.append((i,X[i] - X[i-1]))

Y = sorted(Y, key=lambda x: (x[1]))
Y.reverse()

Z = []
last = 0
for i in range(0,min(N-1, len(Y))):
    Z.append(X[last:Y[i][0]])
    last = Y[i][0]
if len(Z) == 0:
    Z.append(X)

s = 0
for array in Z:
    u = max(array)
    l = min(array)
    s += u - l

print(s)

Fixed submission:
import numpy as np
#from numba import njit

#(N, K) = map(int, input().split())
#A = np.array(list(map(int, input().split())))
(N,M) = map(int, input().split())
X = map(int, input().split())
X = sorted(X)

Y = []
for i in range(1,M):
    Y.append((i,X[i] - X[i-1]))

Y = sorted(Y, key=lambda x: (x[1]))
Y.reverse()

I = list(map(lambda x: x[0], Y[0:min(N-1, len(Y))]))
I.sort()

Z = []
last = 0
for i in range(0,min(N-1, len(Y))):
    if last < I[i]:
        Z.append(X[last:I[i]])
        last = I[i]
Z.append(X[last:])
if len(Z) == 0:
    Z.append(X)

s = 0
for array in Z:
    if len(array) > 0:
        u = max(array)
        l = min(array)
        s += u - l

print(s)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
#from numba import njit

#(N, K) = map(int, input().split())
#A = np.array(list(map(int, input().split())))
N = int(input())
A = np.array(list(map(int, input().split())))
l = 0
r = 0
c = 0

while (l < len(A)):
    x = np.bitwise_xor.reduce(A[l:r])
    s = np.add.reduce(A[l:r])
    while (x == s):
        r += 1
        if (r > len(A)):
            break
        x = x ^ A[r-1]
        s += A[r-1]
    r -= 1
    c += (r - l)
    #print((l,r,r))
    l += 1

print(c)

Fixed submission:
import numpy as np
#from numba import njit

#(N, K) = map(int, input().split())
#A = np.array(list(map(int, input().split())))
N = int(input())
A = np.array(list(map(int, input().split())))
l = 0
r = 0
c = 0

x = 0
s = 0

while (l < len(A)):
    while (x == s):
        r += 1
        if (r > len(A)):
            break
        x = x ^ A[r-1]
        s += A[r-1]
    if (r <= len(A)):
        x = x ^ A[r-1]
        s -= A[r-1]
    r -= 1
    c += (r - l)
    x = x ^ A[l]
    s -= A[l]
    l += 1

print(c)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
#from numba import njit

#(N, K) = map(int, input().split())
#A = np.array(list(map(int, input().split())))
N = int(input())
A = np.array(list(map(int, input().split())))
l = 0
r = 0
c = 0

while (l < len(A)):
    x = np.bitwise_xor.reduce(A[l:r])
    s = np.add.reduce(A[l:r])
    while (x == s):
        r += 1
        if (r > len(A)):
            break
        x = np.bitwise_xor.reduce(A[l:r])
        s = np.add.reduce(A[l:r])
    r -= 1
    c += (r - l)
    #print((l,r,r))
    l += 1

print(c)

Fixed submission:
import numpy as np
#from numba import njit

#(N, K) = map(int, input().split())
#A = np.array(list(map(int, input().split())))
N = int(input())
A = np.array(list(map(int, input().split())))
l = 0
r = 0
c = 0

x = 0
s = 0

while (l < len(A)):
    while (x == s):
        r += 1
        if (r > len(A)):
            break
        x = x ^ A[r-1]
        s += A[r-1]
    if (r <= len(A)):
        x = x ^ A[r-1]
        s -= A[r-1]
    r -= 1
    c += (r - l)
    x = x ^ A[l]
    s -= A[l]
    l += 1

print(c)
Buggy python submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
	a.append(a[i] + A[i])
for i in range(M):
	b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
	a[i] > K:
		break
	while b[j] > K - a[i]:
		j -= 1
	ans = max(ans, i + j)
print(ans)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
	a.append(a[i] + A[i])
for i in range(M):
	b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
	if a[i] > K:
		break
	while b[j] > K - a[i]:
		j -= 1
	ans = max(ans, i + j)
print(ans)

Buggy python submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
a.append(a[i] + A[i])
for i in range(M):
b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
a[i] > K:
break
while b[j] > K - a[i]:
j -= 1
ans = max(ans, i + j)
print(ans)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
	a.append(a[i] + A[i])
for i in range(M):
	b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
	if a[i] > K:
		break
	while b[j] > K - a[i]:
		j -= 1
	ans = max(ans, i + j)
print(ans)
Buggy python submission (verdict: Runtime Error):
inputs = list(map(int, (input().split())))

n = inputs[0]
x = inputs[1] - 1  # 3
y = inputs[2] - 1  # 7
z = y - x - 1  # 3
c = y - x + 1
k = [0 for i in range(n-1)]

for i in range(n - 1):
    for j in range(i + 1, n):
        if i <= x and j >= y:
            d = j - i - z
        elif i <= x and not j >= y:
            d = min(j - i, c - j + x + x - i)
        elif not i <= x and j >= y:
            d = min(j - i, c - y + i + j - y)
        else:
            d = j - i
        # print(str(i+1) + " "+str(j+1)+" "+str(d))
        k[d - 1] += 1

for e in k:
    print(e)


Fixed submission:
# inputs = list(map(int, (input().split())))

s = input()
if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input)
if (N%1000==0):
  print(0)
else:
  print(1000 - (N%1000))

Fixed submission:
N = int(input())
if (N%1000==0):
  print(0)
else:
  print(1000 - (N%1000))

Buggy python submission (verdict: Runtime Error):
N = int(input)
print(1000 - (N%1000))

Fixed submission:
N = int(input())
if (N%1000==0):
  print(0)
else:
  print(1000 - (N%1000))
Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().split())

if (Y%2 == 1):
  print("No")
elif (Y > (X*4)):
  print("No")
else:
  yes = False
  for i in range(1,X+1):
    fNum = i
    tNum = X-i
    if ((fNum*4)+(tNum*2)==Y):
      print("Yes")
      yes = True
  if not (false):
    print("No")
  

Fixed submission:
X, Y = map(int, input().split())

if (Y%2 == 1):
  print("No")
elif (Y > (X*4)):
  print("No")
else:
  yes = False
  for i in range(0,X+1):
    fNum = i
    tNum = X-i
    if ((fNum*4)+(tNum*2)==Y):
      print("Yes")
      yes = True
  if not (yes):
    print("No")

Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().split())

if (Y%2 == 1):
  print("No")
elif (Y > (X*4)):
  print("No")
else:
  yes = false
  for i in range(1,X+1):
    fNum = i
    tNum = X-i
    if ((fNum*4)+(tNum*2)==Y):
      print("Yes")
      yes = True
  if not (false):
    print("No")
  

Fixed submission:
X, Y = map(int, input().split())

if (Y%2 == 1):
  print("No")
elif (Y > (X*4)):
  print("No")
else:
  yes = False
  for i in range(0,X+1):
    fNum = i
    tNum = X-i
    if ((fNum*4)+(tNum*2)==Y):
      print("Yes")
      yes = True
  if not (yes):
    print("No")

Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().s .- 0   			111						/plit())

if (Y%2 == 1):
  print("No")
elif (Y > (X*4)):
  print("No")
else:
  print("Yes")
  

Fixed submission:
X, Y = map(int, input().split())

if (Y%2 == 1):
  print("No")
elif (Y > (X*4)):
  print("No")
else:
  yes = False
  for i in range(0,X+1):
    fNum = i
    tNum = X-i
    if ((fNum*4)+(tNum*2)==Y):
      print("Yes")
      yes = True
  if not (yes):
    print("No")
Buggy python submission (verdict: Runtime Error):
X, N = map(int, input().split())
nums = list(map(int, input().split()))
nums.sort()
low = nums[0]
high = nums[-1]
minDiff = 100000000
minNum = -1
for i in range(low+1, high):
  if i in nums:
    continue
  else:
    Dif = abs(X-i)
    if (Dif < minDiff):
      minDiff = Dif
      minNum=i

if (minNum == -1):
  print(X)
else:
  print(minNum)


  

Fixed submission:
X, N = map(int, input().split())
if (N == 0):
  print(X)
else:
  nums = list(map(int, input().split()))
    
  nums.sort()
  low = nums[0]
  high = nums[-1]
  minDiff = 100000000
  minNum = -1
  for i in range(-10, 110):
    if i in nums:
      continue
    else:
      Dif = abs(X-i)
    if (Dif < minDiff):
      minDiff = Dif
      minNum=i
  print(minNum)
Buggy python submission (verdict: Runtime Error):
H1, M1, H2, M2, K = map(int, input().split())

startTime = (H1*60)+M1
endTime = (H2*60)+M2
time = endTime - startTime
posTime = time - k
if (posTime < 0):
  print(0)
else:
  print(posTime)

Fixed submission:
H1, M1, H2, M2, K = map(int, input().split())

startTime = (H1*60)+M1
endTime = (H2*60)+M2
time = endTime - startTime
posTime = time - K
if (posTime < 0):
  print(0)
else:
  print(posTime)
Buggy python submission (verdict: Runtime Error):
N = int(input())
nums = list(map(int, input().split()))
nodes = []
currentLeaf = 1
fail = False
#check from top
for i in range(N + 1):
	nodes.append(currentLeaf)
	currentLeaf = (currentLeaf-nums[i])*2
	if (currentLeaf < 0):
		fail = True
		break 
if (fail):
	print(-1)
#check from bottom
currentLeaf = 0
totalNode = 0
for i in reversed(range(N+1)):
	currentLeaf += nums[i]
	currentLeaf = min(currentLeaf, nodes[i])
	totalNode += currentLeaf

if (fail):
	print(-1) 
else:
	print(totalNode)

Fixed submission:
N = int(input())
nums = list(map(int, input().split()))
nodes = []
currentLeaf = 1
fail = False
#check from top
for i in range(N + 1):
	nodes.append(currentLeaf)
	currentLeaf = (currentLeaf-nums[i])*2
	if (currentLeaf < 0):
		fail = True
		break 
if (fail):
	print(-1)
else:
  #check from bottom
  currentLeaf = 0
  totalNode = 0
  for i in reversed(range(N+1)):
      currentLeaf += nums[i]
      currentLeaf = min(currentLeaf, nodes[i])
      totalNode += currentLeaf

  if (fail):
      print(-1) 
  else:
      print(totalNode)
Buggy python submission (verdict: Runtime Error):
import math 
A, B, H, M = map(int,input().split())

timeHr = H + (M / 60)
angVelA = (1/6) * 180
angVelB = (2) * 180

degA = (angVelA * timeHr)
degB = (angVelB * timeHr) 

defDiff = math.radians(abs(degB - degA))

disX_2 = math.pow(B, 2) + math.pow(A, 2) - (2 * A * B * math.cos(degDiff))
disX = math.sqrt(disX_2)

print(disX)

Fixed submission:
import math 
A, B, H, M = map(int,input().split())

timeHr = H + (M / 60)
angVelA = (1/6) * 180
angVelB = (2) * 180

degA = (angVelA * timeHr)
degB = (angVelB * timeHr) 

degDiff = math.radians(abs(degB - degA))

disX_2 = math.pow(B, 2) + math.pow(A, 2) - (2 * A * B * math.cos(degDiff))
disX = math.sqrt(disX_2)

print(disX)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
tenbo_height = list(map(int, input().split()))
roads = []
for i in range(M):
  #road[0] = start, road[1] = goal
  road = list(map(int, input().split()))
  roads.append(road)

good_tenbo = 0
for tenbo in range(N):
  adjacent_tenbo = []
  #good tenbo if no road or adjacent tenbo is all lower
  #count number of road connected to this tenbo
  for road in roads:
    if (road[0] == tenbo):
      adjacent_tenbo.append(road[1])
    elif (road[1] == tenbo):
      adjacent_tenbo.append(road[0])
  
  #check if no road connected
  if (len(adjacent_tenbo) == 0):
    good_tenbo += 1
    continue
  #check if adjacent tenbo is all lower
  all_lower = True
  for a_tenbo in adjacent_tenbo:
    if (tenbo_height[a_tenbo] >= tenbo_height[tenbo]):
      all_lower = False
      break
  if (all_lower):
    good_tenbo += 1
    continue
    
print(good_tenbo)

Fixed submission:
N, M = map(int, input().split())
tenbo_height = list(map(int, input().split()))
adj_height = [0]*N

for i in range(M):
  #road[0] = start, road[1] = goal
  road = list(map(int, input().split()))
  adj_height[road[0]-1] = max(adj_height[road[0]-1], tenbo_height[road[1]-1])
  adj_height[road[1]-1] = max(adj_height[road[1]-1], tenbo_height[road[0]-1])
  
good_tenbo = 0
for tenbo in range(N):
  if ((tenbo_height[tenbo] > adj_height[tenbo])) or (adj_height[tenbo] == 0):
    good_tenbo += 1
print(good_tenbo)
Buggy python submission (verdict: Time Limit Exceeded):
a = input()
a = int(a)
sum = 0
for i in range(1,a+1):
  for j in range(1,a+1):
    for k in range(1,a+1):
      if i==1:
        sum += 1
      else:
        for b in range(i,0,-1):
          if i%b==0 and j%b==0 and k%b==0:
            sum += b
            break
print(sum)

Fixed submission:
import math
K = int(input())
sum = 0
for i in range(1, K+1):
  for j in range(i, K+1):
    #2i or 3i
    if (i == j):
      for k in range(i, K+1):
        #print("i"+str(i)+"j"+str(j)+"k"+str(k))
        if ((i == j) and (i == k)):
          sum += math.gcd(i, math.gcd(j, k))
        else:
          sum += (3*math.gcd(i, math.gcd(j, k)))
    #1i
    else:
      for k in range(i+1, K+1):
        #print("i"+str(i)+"j"+str(j)+"k"+str(k))
        sum += (3*math.gcd(i, math.gcd(j, k)))
      
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
a = input()
a = int(a)
sum = 0
for i in range(1,a+1):
  for j in range(1,a+1):
    for k in range(1,a+1):
      for b in range(a,0,-1):
        if i%b==0 and j%b==0 and k%b==0:
          sum += b
          break
print(sum)

Fixed submission:
import math
K = int(input())
sum = 0
for i in range(1, K+1):
  for j in range(i, K+1):
    #2i or 3i
    if (i == j):
      for k in range(i, K+1):
        #print("i"+str(i)+"j"+str(j)+"k"+str(k))
        if ((i == j) and (i == k)):
          sum += math.gcd(i, math.gcd(j, k))
        else:
          sum += (3*math.gcd(i, math.gcd(j, k)))
    #1i
    else:
      for k in range(i+1, K+1):
        #print("i"+str(i)+"j"+str(j)+"k"+str(k))
        sum += (3*math.gcd(i, math.gcd(j, k)))
      
print(sum)

Buggy python submission (verdict: Runtime Error):
a = input()
a = int(a)
sum = 0
for i in range(1,a+1):
  for j in range(1,a+1):
    for k in range(1,a+1):
      for b in [a:0:-1]:
        if i%b==0 and j%b==0 and k%b==0:
          sum += b
print(b)

Fixed submission:
import math
K = int(input())
sum = 0
for i in range(1, K+1):
  for j in range(i, K+1):
    #2i or 3i
    if (i == j):
      for k in range(i, K+1):
        #print("i"+str(i)+"j"+str(j)+"k"+str(k))
        if ((i == j) and (i == k)):
          sum += math.gcd(i, math.gcd(j, k))
        else:
          sum += (3*math.gcd(i, math.gcd(j, k)))
    #1i
    else:
      for k in range(i+1, K+1):
        #print("i"+str(i)+"j"+str(j)+"k"+str(k))
        sum += (3*math.gcd(i, math.gcd(j, k)))
      
print(sum)
Buggy python submission (verdict: Runtime Error):
N, M = input().split()
N= int(N)
M = int(M)
itemList = input().split()
itemList.sort()
index = -1
answer = true
for i in range(M):
  if itemList[index] < (N*(1/(4*M))):
    answer = false
    break
  index -= 1
  
if answer:
  print("Yes")
else:
  print("No")

Fixed submission:
N, M = input().split()
N= int(N)
M = int(M)
itemList = list(map(int, input().split()))
itemList.sort()
index = -1
answer = True
for i in range(M):
  if itemList[index] < (sum(itemList)*(1/(4*M))):
    answer = False
    break
  index -= 1
  
if answer:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
N = N%K
min_num = 0
while True:
  if (N==0):
    min_num = N
    break
  elif N in history:
    min_num = min(history)
    break 
  history.append(N)
  N = abs(N-K)

print(min_num)

      


Fixed submission:
N, K = input().split()
N = int(N)
K = int(K)

middle = N % K
answer = middle
while True:
  if abs(answer-K) > N:
    answer = N
    break
  if abs(answer - K) < answer:
    answer = abs(answer-K)
  else:
    break
    
print(str(answer))

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
N = N%K
min_num = 0
while True:
  if (N==0):
    min_num = N
    break
  elif N in history:
    min_num = min(history)
    break 
  history.append(N)
  N = abs(N-K)

print(min_num)

      


Fixed submission:
N, K = input().split()
N = int(N)
K = int(K)

middle = N % K
answer = middle
while True:
  if abs(answer-K) > N:
    answer = N
    break
  if abs(answer - K) < answer:
    answer = abs(answer-K)
  else:
    break
    
print(str(answer))

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
N = N%K
while True:
  if (N==0):
    min_num = N
    break
  elif N in history:
    min_num = min(history)
    break 
  history.append(N)
  N = abs(N-K)

print(min_num)

Fixed submission:
N, K = input().split()
N = int(N)
K = int(K)

middle = N % K
answer = middle
while True:
  if abs(answer-K) > N:
    answer = N
    break
  if abs(answer - K) < answer:
    answer = abs(answer-K)
  else:
    break
    
print(str(answer))

Buggy python submission (verdict: Runtime Error):
N, K = input().split()
N = int(N)
K = int(K)

middle = N % K
answer = middle
while True:
  if abs(answer-k) > N:
    answer = N
    break
  if abs(answer - K) < answer:
    answer = abs(answer-K)
  else:
    break
    
print(str(answer))

Fixed submission:
N, K = input().split()
N = int(N)
K = int(K)

middle = N % K
answer = middle
while True:
  if abs(answer-K) > N:
    answer = N
    break
  if abs(answer - K) < answer:
    answer = abs(answer-K)
  else:
    break
    
print(str(answer))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = input().split()
N = int(N)
K = int(K)

while True:
  if abs(N-K) < N:
    N = abs(N-K)
  else:
    break
    
print(str(N))


Fixed submission:
N, K = input().split()
N = int(N)
K = int(K)

middle = N % K
answer = middle
while True:
  if abs(answer-K) > N:
    answer = N
    break
  if abs(answer - K) < answer:
    answer = abs(answer-K)
  else:
    break
    
print(str(answer))
Buggy python submission (verdict: Runtime Error):
s = input()
if s[2] == 2[3] and s[4] == s[5]:
  print("Yes")
else:
  print("No")

Fixed submission:
s = input()
if s[2] == s[3] and s[4] == s[5]:
  print("Yes")
else:
  print("No")