Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=map(int,input().split())
x=0
for i in range(n+1):
  if x<=((a*i)//b)-a*(i//b):
    x=((a*i)//b)-a*(i//b)
print(x)

Fixed submission:
a,b,n=map(int,input().split())

if n<b:
  print((a*n)//b)
else:
  print(a*(b-1)//b)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
 
for i in range(1,n+1):
  print(a.count(i))

Fixed submission:
import math
print(int(input())*2*math.pi)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
 
for i in range(1,n+1):
  print(a.count(i))

Fixed submission:
import collections

n=int(input())
a=list(map(int,input().split()))
coun=collections.Counter(a)
for i in range(1,n+1):
  print(coun[i])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
 
for i in range(1,n+1):
  print(a.count(i))

Fixed submission:
import collections

n=int(input())
a=list(map(int,input().split()))
coun=collections.Counter(a)
for i in range(1,n+1):
  print(coun[i])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))

for i in range(1,n+1):
  print(a.count(i))

Fixed submission:
import collections

n=int(input())
a=list(map(int,input().split()))
coun=collections.Counter(a)
for i in range(1,n+1):
  print(coun[i])
Buggy python submission (verdict: Runtime Error):
N,K=mapp(int,input().split())

print(min(N%K,abs(N%K-K)))


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

print(min(N%K,abs(N%K-K)))

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

print(min(N%K,abs(N%K-K)))

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

print(min(N%K,abs(N%K-K)))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=[str(input()) for _ in range(N)]
dic=[]
n=0
for i in S:
  m=S.count(i)
  if n<m:
    n=m
    dic=[]
    dic.append(i)
  if n==m:
    n=m
    dic.append(i)
    
for j in sorted(set(dic)):
  print(j)

Fixed submission:
from collections import Counter
n=int(input())
s=[input() for _ in range(n)]

sc=Counter(s).most_common()
max_idx=sc[0][1]

ans=[]
for i,j in sc:
  if j==max_idx:
    ans.append(i)

for ll in sorted(ans):
  print(ll)
Buggy python submission (verdict: Runtime Error):
a,b=int(input(),input())

if a <= b or a <= 2*b:
  print(0)

if a>b:
  c=a-2*b
  print(c)

Fixed submission:
num1,num2=input().split()

a=int(num1)
b=int(num2)

if a <= b or a <= 2*b:
  print(0)

elif a>b:
  c=a-2*b
  print(c)
Buggy python submission (verdict: Runtime Error):
abc=list(map(int,input().split()))
abc.sort()
if A ==[5, 5, 7]:
  print("Yes")
else:
  print("No")

Fixed submission:
abc=list(map(int,input().split()))
abc.sort()
if abc ==[5, 5, 7]:
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
a,b,c=input().split()

if a==b==5:
  if c==7:
    return print("Yes")
  else:
    return print("No")
elif a==c==5:
  if b==7:
    return print("Yes")
  else:
    return print("No")
elif b==c==5:
  if a==7:
    return print("Yes")
  else:
    return print("No")
else:
  return print("No")

Fixed submission:
abc=list(map(int,input().split()))
abc.sort()
if abc ==[5, 5, 7]:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
dict = {}

for i in range(N):
  s=input()
  if s in dict:
    dict[s]=dict[s]+1
  else:
    dict[s]=1
    
keys = [k for k, v in dict.items() if v == max(dict.values())]
res = sorted(keys)
for word in res:
  print(word)

Fixed submission:
N=int(input())
dict = {}
 
for i in range(N):
  s=input()
  if s in dict:
    dict[s]=dict[s]+1
  else:
    dict[s]=1

dict_maxval=max(dict.values())
    
res = [k for k, v in dict.items() if v == dict_maxval]
res.sort()
for word in res:
  print(word)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = [int(n) for n in input().split()]

cur = 1
for i in range(k):
    cur *= a[i]

for i in range(k,n):
    nxt = cur // a[i - k] * a[i]
    if (nxt > cur):
        print("Yes")
    else:
        print("No")
    cur = nxt


Fixed submission:
n,k = map(int,input().split())
a = [int(n) for n in input().split()]

for i in range(k,n):
    if (a[i] > a[i - k]):
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().rstrip().rsplit()))
A_dict = {}

for val in A:
    A_dict[val] = A_dict.get(val, 0) + 1

limit = 10**18
ans = 1
for val in A_dict:
    ans *= val ** A_dict[val]

if ans > limit:
    ans = -1

print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().rstrip().rsplit()))
A_dict = {}

for val in A:
    A_dict[val] = A_dict.get(val, 0) + 1

limit = 10**18
ans = 1

if A_dict.get(0, 0) > 0:
    ans = 0
else:
    for val in A_dict:
        ans *= val ** A_dict[val]

        if ans > limit:
            ans = -1
            break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().rstrip().rsplit()))

limit = 10**18
ans = 1
for val in A:
    ans *= val

if ans > limit:
    ans = -1
print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().rstrip().rsplit()))
A_dict = {}

for val in A:
    A_dict[val] = A_dict.get(val, 0) + 1

limit = 10**18
ans = 1

if A_dict.get(0, 0) > 0:
    ans = 0
else:
    for val in A_dict:
        ans *= val ** A_dict[val]

        if ans > limit:
            ans = -1
            break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = sorted(list(map(int, input().rstrip().rsplit())))

ans = 1
for val in A:
    ans *= val

    if ans == 0:
        break

    if ans > 10**18:
        ans = -1

print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().rstrip().rsplit()))
A_dict = {}

for val in A:
    A_dict[val] = A_dict.get(val, 0) + 1

limit = 10**18
ans = 1

if A_dict.get(0, 0) > 0:
    ans = 0
else:
    for val in A_dict:
        ans *= val ** A_dict[val]

        if ans > limit:
            ans = -1
            break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().rstrip().rsplit()))

ans = 1
for val in A:
    ans *= val

    if ans == 0:
        break

    if ans > 10**18:
        ans = -1

print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().rstrip().rsplit()))
A_dict = {}

for val in A:
    A_dict[val] = A_dict.get(val, 0) + 1

limit = 10**18
ans = 1

if A_dict.get(0, 0) > 0:
    ans = 0
else:
    for val in A_dict:
        ans *= val ** A_dict[val]

        if ans > limit:
            ans = -1
            break

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

# 初期化周り
N, M = map(int, input().rstrip().split())
G = [[] for i in range(N+1)]
for i in range(M):
    A, B = map(int, input().rstrip().split())
    G[A].append(B)
    G[B].append(A)

# 目印
sign = [-1]*(N+1)
sign[0] = None
sign[1] = 0

queue = deque([1])

while queue:
    node = queue.popleft()
    for next in G[node]:
        if sign[next] > -1:
            continue
        sign[next] = node
        queue.append(next)

ans = "Yes"

for i in range(2, N+1):
    S = sign[i]
    while S > 0:
        S = sign[S]

    if not S == 0:
        ans = "No"

print(ans)
if ans == "Yes":
    for i in range(2, N+1):
        print(sign[i])


Fixed submission:
from collections import deque

# 初期化周り
N, M = map(int, input().rstrip().split())
G = [[] for i in range(N+1)]
for i in range(M):
    A, B = map(int, input().rstrip().split())
    G[A].append(B)
    G[B].append(A)

# 目印
sign = [-1]*(N+1)
sign[0] = None
sign[1] = 0

queue = deque([1])

while queue:
    node = queue.popleft()
    for next in G[node]:
        if sign[next] > -1:
            continue
        sign[next] = node
        queue.append(next)

if -1 in sign:
    print("No")
else:
    print("Yes")
    for i in range(2, N+1):
        print(sign[i])
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().rstrip().split())
route = [0] + list(map(int, input().rstrip().split()))

# 愚直解 計算時間大
current = 1
for _ in range(K):
    current = route[current]

print(current)

Fixed submission:
from collections import deque
N, K = map(int, input().rstrip().split())
route = [0] + list(map(int, input().rstrip().split()))

# 町1から町nまでの距離
dis = [0] * (N+1)

# 訪問済み
checked = [0] * (N+1)

queue = deque([1])
hop_count = 0
offset = 0

ans = 1
while queue:
    i = queue.popleft()

    if hop_count == K:
        ans = i
        break

    A_i = route[i]

    if checked[A_i] == 1:
        roop_node_count = abs(hop_count+1 - dis[A_i])
        offset = (K - hop_count) % roop_node_count

        for _ in range(offset):
            i = route[i]
        ans = i
        break

    queue.append(A_i)
    hop_count += 1
    dis[A_i] = dis[i] + 1
    checked[i] = 1

print(ans)
Buggy python submission (verdict: Runtime Error):
h, w, k = [int(i) for i in input().split()]
masu = [input() for _ in range(h)]
ans = 0
for mark_h in range(2**h):
    for mark_w in range(2**w):
        black = 0
        for i in range(h):
            for j in range(w):
                if (mark_h>>i)&1==1 and (mark_w>>j)&1==1:
                    if c[i][j]=="#":
                        black+=1
        if black=k:
            ans+=1
print(ans)

Fixed submission:
h, w, k = [int(i) for i in input().split()]
masu = [input() for _ in range(h)]
ans = 0
for mark_h in range(2**h):
    for mark_w in range(2**w):
        black = 0
        for i in range(h):
            for j in range(w):
                if (mark_h>>i)&1==1 and (mark_w>>j)&1==1:
                    if masu[i][j]=="#":
                        black+=1
        if black==k:
            ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
friendly = list(map(int, input().split()))
friendly.sort(reverse=True)
if len(friendly)<=2:
    print(sum[0:n-1])
else:
    ans = friendly[0]+sum(friendly[1:(n+1)//2-1])*2+friendly[(n+1)//2-1]*((n+1)%2+1)
    print(ans)

Fixed submission:
n = int(input())
friendly = list(map(int, input().split()))
friendly.sort(reverse=True)
if len(friendly)<=2:
    print(sum(friendly[0:n-1]))
else:
    ans = friendly[0]+sum(friendly[1:(n+1)//2-1])*2+friendly[(n+1)//2-1]*((n+1)%2+1)
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
friendly = [int(i) for i in input().split()]
friendly.sort(reverse=True)
place = []
place.append(friendly[0])
place=place*2
ans=0
for i in friendly[1:]:
    comfortable=[min(place[i], place[i+1]) for i in range(len(place)-1)]
    ans += max(comfortable)
    place.insert(comfortable.index(max(comfortable))+1, i)
print(ans)

Fixed submission:
n = int(input())
friendly = list(map(int, input().split()))
friendly.sort(reverse=True)
if len(friendly)<=2:
    print(sum(friendly[0:n-1]))
else:
    ans = friendly[0]+sum(friendly[1:(n+1)//2-1])*2+friendly[(n+1)//2-1]*((n+1)%2+1)
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a = [0]+[sum(a[:i+1]) for i in range(len(a))]
b = [0]+[sum(b[:i+1]) for i in range(len(b))]
ans = 0
for i in range(n+1):
    if a[i]>k:
        break
    for j in reversed(range(m+1)):
        if a[i]+b[j]<=k:
            ans = max(ans, i+j)
            m=j
            break
print(ans)

Fixed submission:
n, m, k = list(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 = 0
for i in range(n+1):
    if a[i]>k:
        break
    for j in reversed(range(m+1)):
        if a[i]+b[j]<=k:
            ans = max(ans, i+j)
            m=j
            break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for a in range(1,n+1):
    y = n//a
    ans+=int((y*(y+1)*a)/2)
print(ans)

Fixed submission:
n = int(input())
ans = 0
for a in range(1,n+1):
    y = n//a
    ans+=(y*(y+1)*a)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a_list = list(map(int, input().split()))
sum_a = sum(a_list)
num_a = [0]*(10**5)
for i in a_list:
    num_a[i] += 1
    
q = int(input())
for _ in range(q):
    b, c = list(map(int, input().split()))
    sum_a = sum_a + c * num_a[b] - b *num_a[b]
    num_a[c] += num_a[b]
    num_a[b] = 0
    print(sum_a)

Fixed submission:
n = int(input())
a_list = list(map(int, input().split()))
sum_a = sum(a_list)
num_a = [0]*(10**5)
for i in a_list:
    num_a[i-1] += 1
    
q = int(input())
for _ in range(q):
    b, c = list(map(int, input().split()))
    sum_a = sum_a + c * num_a[b-1] - b *num_a[b-1]
    num_a[c-1] += num_a[b-1]
    num_a[b-1] = 0
    print(sum_a)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_list = list(map(int, input().split()))
q = int(input())
for _ in range(q):
    b, c = list(map(int, input().split()))
    a_list.sort()
    index = []
    for i,j in enumerate(a_list):
        if j>b:
            break
        elif j==b:
            a_list[i]=c
    print(sum(a_list))

Fixed submission:
n = int(input())
a_list = list(map(int, input().split()))
sum_a = sum(a_list)
num_a = [0]*(10**5)
for i in a_list:
    num_a[i-1] += 1
    
q = int(input())
for _ in range(q):
    b, c = list(map(int, input().split()))
    sum_a = sum_a + c * num_a[b-1] - b *num_a[b-1]
    num_a[c-1] += num_a[b-1]
    num_a[b-1] = 0
    print(sum_a)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_list = list(map(int, input().split()))
q = int(input())
for _ in range(q):
    b, c = list(map(int, input().split()))
    index = [i for i, x in enumerate(a_list) if x == b]
    for i in index:
        a_list[i] = c
    print(sum(a_list))

Fixed submission:
n = int(input())
a_list = list(map(int, input().split()))
sum_a = sum(a_list)
num_a = [0]*(10**5)
for i in a_list:
    num_a[i-1] += 1
    
q = int(input())
for _ in range(q):
    b, c = list(map(int, input().split()))
    sum_a = sum_a + c * num_a[b-1] - b *num_a[b-1]
    num_a[c-1] += num_a[b-1]
    num_a[b-1] = 0
    print(sum_a)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_list = list(map(int, input().split()))
ans = [0]*n
for i in range(n):
    for j,a in enumerate(a_list):
        if j != i:
            ans[i]=ans[i]^a
ans = " ".join([str(i) for i in ans])
print(ans)

Fixed submission:
n = int(input())
a_list = list(map(int, input().split()))
base_xor = 0
for i in a_list:
    base_xor = base_xor^i
ans = [0]*n
for i in range(n):
    ans[i] = a_list[i]^base_xor
ans = " ".join([str(i) for i in ans])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N = int(input())
A = [int(i) for i in input().split()]
for i,a in enumerate(A):
    if a in A[i+1:]:
        print("NO")
        sys.exit(0)
print("YES")

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
def test(A):
    return len(A)!= len(set(A))
if test(A)==False:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
import sys
N = int(input())
A = [int(i) for i in input().split()]
for i,a in enumerate(A):
    if a in A[i+1:]
        print("NO")
        sys.exit(0)
print("YES")

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
def test(A):
    return len(A)!= len(set(A))
if test(A)==False:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N = int(input())
A = [int(i) for i in input().split()]
for i,a in enumerate(A):
    for b in A[i+1:]:
        if a==b:
            print("NO")
            sys.exit(0)
print("YES")

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
def test(A):
    return len(A)!= len(set(A))
if test(A)==False:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, K = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
obj_list=[0]
for i, a in enumerate(p):
   if np.sum(obj_list)<np.sum(p[i:i+K]):
       obj_list = p[i:i+K]
ans = 0
for i in obj_list:
    a = sum(range(0,i+1,1))/i
    ans += a
print(ans)

Fixed submission:
N, K = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
s = m = sum(p[:K])
for i in range(K,N):
    s += p[i]-p[i-K]
    m = max(m,s)
print((m+K)/2)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
obj_list=[0,0]
for i, a in enumerate(p):
    if sum(obj_list)< sum(p[i:i+K]):
        obj_list = p[i:i+K]
ans = 0
for i in obj_list:
    a = sum(range(0,i+1,1))/i
    ans += a
print(ans)

Fixed submission:
N, K = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
s = m = sum(p[:K])
for i in range(K,N):
    s += p[i]-p[i-K]
    m = max(m,s)
print((m+K)/2)
Buggy python submission (verdict: Runtime Error):
import math
A, B = [int(i) for i in input().split()]
print(int(A*B/math.gcd(A,B)))

Fixed submission:
import fractions
A, B = [int(i) for i in input().split()]
print(int(A*B/fractions.gcd(A,B)))
Buggy python submission (verdict: Runtime Error):
n = list(map(int, input().split()))
if(n[1] == 0):
  print(n[0])
  exit()
x = list(map(int, input().split()))

for i in range(1,102):
  if n[0] - i not in x:
    print(n[0] - i)
    break
  elif n[0] + i not in x:
    print(n[0] + i)
    break


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

for i in range(5):
  if(n[i] != i+1):
    print(i+1)
    exit()

Buggy python submission (verdict: Runtime Error):
n = list(map(int, input().split()))
if(n[1] == 0):
  print(n[0])
  exit()
x = list(map(int, input().split()))
print(n)
print(type(x))
  
for i in range(1,100):
  if(('n[0] - i' in x) == False):
    print(n[0] - i)
    exit()
  elif(('n[0] + i' in x) == False):
    print(n[0] + i)
    exit()

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

for i in range(5):
  if(n[i] != i+1):
    print(i+1)
    exit()
Buggy python submission (verdict: Runtime Error):
str = input()

if(str == 'ABC'):
  print("ARC")
  el:
    print("ABC")

Fixed submission:
str = input()

if str == 'ABC':
  print("ARC")
else:
  print("ABC")
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
data = input()

w = []
r = []
for i in range(len(data)):
  if data[i] == "W":
    w.append(i)
  else:
    r.append(i)

ans = 0
if len(w) == 0:
  print(ans)
elif len(r) == 0:
  print(ans)
else:
  r = r[::-1]
  for i in range(len(data)):
    tmp_w = w.pop(0)
    tmp_r = r.pop(0)
    if tmp_w <= tmp_r:
      r.append(tmp_w)
      w.append(tmp_r)
      ans += 1
    else:
      print(ans)
      break

Fixed submission:
n = input()
data = input()

w = []
r = []
for i in range(len(data)):
  if data[i] == "W":
    w.append(i)
  else:
    r.append(i)

ans = 0
if len(w) == 0:
  print(ans)
elif len(r) == 0:
  print(ans)
else:
  r = r[::-1]
  for i in range(min(len(w), len(r))):
    tmp_w = w[i]
    tmp_r = r[i]
    if tmp_w <= tmp_r:
      r.append(tmp_w)
      w.append(tmp_r)
      ans += 1
    else:
      break
  print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
dp=[0]*(N)
dp[0]=0
dp[1]=0
dp[2]=abs(A[1]-A[0])
for i in range(3,N):
    dp[i]=min(dp[i-1]+abs(A[i-1]-A[i-2]),dp[i-2]+abs(A[i-1]-A[i-3]))

print(dp[N-1])

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
dp=[0]*(N)
dp[0]=0
dp[1]=abs(A[1]-A[0])
for i in range(2,N):
    dp[i]=min(dp[i-1]+abs(A[i]-A[i-1]),dp[i-2]+abs(A[i]-A[i-2]))
# print(dp)
print(dp[N-1])
Buggy python submission (verdict: Runtime Error):
from collections import *
def dfs(x):
    visited[x]=True
    for i in range(len(adj[x])):
        t=adj[x][i]
        distance[t]=max(distance[t],distance[x]+1)
        indegree[t]-=1
        if(indegree[t]==0):
            dfs(t)

MAX = 10**5+5
indegree=[0]*(MAX)
distance=[0]*(MAX)
visited = [False]*(MAX)
adj = defaultdict(list)
N,M=list(map(int,input().split()))
for i in range(M):
    a,b=list(map(int,input().split()))
    adj[a].append(b)
    indegree[b]+=1
ans=0
for i in range(1,N+1):
    if(visited[i]==False and indegree[i]==0):
        dfs(i)
for i in range(1,N+1):
    ans=max(ans,distance[i])

print(ans)


Fixed submission:
import sys
from collections import *
sys.setrecursionlimit(10**5)
def dfs(x):
    visited[x]=True
    for i in range(len(adj[x])):
        t=adj[x][i]
        distance[t]=max(distance[t],distance[x]+1)
        indegree[t]-=1
        if(indegree[t]==0):
            dfs(t)

MAX = 10**5+5
indegree=[0]*(MAX)
distance=[0]*(MAX)
visited = [False]*(MAX)
adj = defaultdict(list)
N,M=list(map(int,input().split()))
for i in range(M):
    a,b=list(map(int,input().split()))
    adj[a].append(b)
    indegree[b]+=1
ans=0
for i in range(1,N+1):
    if(visited[i]==False and indegree[i]==0):
        dfs(i)
for i in range(1,N+1):
    ans=max(ans,distance[i])

print(ans)
Buggy python submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
K = int(input())
flag = False

l=[]
for i in range(K):
  for j in range(K):
    for k in range(K):
      if i+j+k == K:
        m=[i, j, k]
        l.append(m)

for i in range(len(l)):
  m = l[i]
  a=A*(2**m[0])
  b=B*(2**m[1])
  c=C*(2**m[k])

  if a<b and b<c:
    flag = False
    print("Yes")
    break
  else:
    flag = True
if flag:
  print("No")

Fixed submission:
A, B, C = map(int, input().split())
K = int(input())
flag = False

l=[]
for i in range(K+1):
  for j in range(K+1):
    for k in range(K+1):
      if i+j+k == K:
        m=[i, j, k]
        l.append(m)

for i in range(len(l)):
  m = l[i]
  a=A*(2**m[0])
  b=B*(2**m[1])
  c=C*(2**m[2])

  if a<b and b<c:
    flag = False
    print("Yes")
    break
  else:
    flag = True
if flag:
  print("No")

Buggy python submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
K = int(input())
flag = False

l=[]
for i in range(K):
  for j in range(K):
    for k in range(K):
      if i+j+k == K:
        m=[i+1, j+1, k+1]
        l.append(m)

for i in range(len(l)):
  m = l[i]
  a=A*(2**m[0])
  b=B*(2**m[1])
  c=C*(2**m[k])

  if a<b and b<c:
    flag = False
    print("Yes")
    break
  else:
    flag = True
if flag:
  print("No")

Fixed submission:
A, B, C = map(int, input().split())
K = int(input())
flag = False

l=[]
for i in range(K+1):
  for j in range(K+1):
    for k in range(K+1):
      if i+j+k == K:
        m=[i, j, k]
        l.append(m)

for i in range(len(l)):
  m = l[i]
  a=A*(2**m[0])
  b=B*(2**m[1])
  c=C*(2**m[2])

  if a<b and b<c:
    flag = False
    print("Yes")
    break
  else:
    flag = True
if flag:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
x = list(map(int, input().split()))

for i in range(K+1, N+1):
  s = x[i-1]
  for j in range(1, K//2):
    s *= x[i-1-j]*x[i-1-(j+1)]
  if K%2==0:
    s=s
  else:
    s=s*(x[i-K])

  u = s/(x[i-1])*(x[i-K-1])
  u=int(u)

  if u<s:
    print("Yes")
  else:
    print("No")

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


for i in range(K+1, N+1):
  

  if x[i-K-1]<x[i-1]:
    print("Yes")
  else:
    print("No")

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

for i in range(K+1, N+1):
  s = x[i-1]
  for j in range(1, K):
    s *= x[i-1-j]
  u = s/(x[i-1])*(x[i-K-1])
  u=int(u)

  if u<s:
    print("Yes")
  else:
    print("No")

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


for i in range(K+1, N+1):
  

  if x[i-K-1]<x[i-1]:
    print("Yes")
  else:
    print("No")

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

for i in range(K+1, N+1):
  s = x[i-1]
  t = x[i-2]
  for j in range(1, K):
    s *= x[i-1-j]
    t *= x[i-2-j]
  if t<s:
    print("Yes")
  else:
    print("No")

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


for i in range(K+1, N+1):
  

  if x[i-K-1]<x[i-1]:
    print("Yes")
  else:
    print("No")