Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
h = int(input())  # Monster health
a = int(input())  # Servant attack
x = a
attack = 1

while h > x :
    h -= x
    attack += 1

print(attack)


Fixed submission:

h, a = input().split()
h = int(h)
a = int(a)
x = a
attack = 1

while h > x :
    h -= x
    attack += 1

print(attack)

Buggy python submission (verdict: Runtime Error):
H,A = int(input()),int(input())
if(H%A != 0): print((H//A) + 1)
else: print(H/A)

Fixed submission:
import math
H,A = map(int,input().split())
print(math.ceil(H/A))
Buggy python submission (verdict: Runtime Error):
x=int(input())
if x==1:
  print("0")
else:
  print("1!)

Fixed submission:
x=int(input())

if x==1:
  print("0")
else:
  print("1")
Buggy python submission (verdict: Runtime Error):
a=input().split()
if int(a[0])>int(a[1])*int(a[2]):
  print("No")
else:
print("Yes")

Fixed submission:
a=input().split()
if int(a[0])>int(a[1])*int(a[2]):
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
S=input()
Sc=S.count("R")
SSc=S.count("RR")
if Sc==3:
  print(3)
elif SSc=1:
  print(2)
elif Sc==0:
  print(0)
else:
  print(1)

Fixed submission:
S=input()
Sc=S.count("R")
SSc=S.count("RR")
if Sc==3:
  print(3)
elif SSc==1:
  print(2)
elif Sc==0:
  print(0)
else:
  print(1)
Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
a=7
count=1
if k%2==0:
  print(-1)
else:
  while True:
    if a%k==0:
      print(count)
      break
    else:
      a=a*10+7
      count+=1


Fixed submission:
k=int(input())
a=0
for i in range(k):
  a=(a*10+7)%k
  if a==0:
    print(i+1)
    exit()
    
print(-1)

Buggy python submission (verdict: Runtime Error):
k=int(input())
count=1
if k%2==0:
  print(-1)
else:
  while True:
    if a%k==0:
      print(count)
      break
    else:
      a=a*10+7
      count+=1


Fixed submission:
k=int(input())
a=0
for i in range(k):
  a=(a*10+7)%k
  if a==0:
    print(i+1)
    exit()
    
print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
a,b='','7'
count=1
if k%2==0:
  print(-1)
else:
  while True:
    a=a+b
    if int(a)%k==0:
      print(count)
      break
    else:
      count+=1


Fixed submission:
k=int(input())
a=0
for i in range(k):
  a=(a*10+7)%k
  if a==0:
    print(i+1)
    exit()
    
print(-1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(1, N+1):
  	if len(str(i)) % 2 == 1:
        ans += 1

print(ans)

Fixed submission:
N = int(input())
ans = 0
for i in range(1, N+1):
    if len(str(i)) % 2 == 1:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A_LIST = []

for _ in range(N):
    A = int(input())
    A_LIST.append(A)

for i in range(N):
    temp = A_LIST[i]
    A_LIST[i] = 0
    print(max(A_LIST))
    A_LIST[i] = temp


Fixed submission:
N = int(input())
A_LIST = []

for _ in range(N):
    A = int(input())
    A_LIST.append(A)

sorted_A_LIST = sorted(A_LIST)
largest = sorted_A_LIST[-1]
second_largest = sorted_A_LIST[-2]

for i in range(N):
    if A_LIST[i] < largest:
        print(largest)
    else:
        print(second_largest)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A_LIST = []

for _ in range(N):
    A = int(input())
    A_LIST.append(A)

for i in range(N):
    temp = A_LIST[i]
    A_LIST[i] = 0
    print(max(A_LIST))
    A_LIST[i] = temp


Fixed submission:
N = int(input())
A_LIST = []

for _ in range(N):
    A = int(input())
    A_LIST.append(A)

sorted_A_LIST = sorted(A_LIST)
largest = sorted_A_LIST[-1]
second_largest = sorted_A_LIST[-2]

for i in range(N):
    if A_LIST[i] < largest:
        print(largest)
    else:
        print(second_largest)
Buggy python submission (verdict: Runtime Error):
S = input()
 
result = 0
for i in range(len(S) - 1):
    if S[i] == S[i+1]:
        print("Bad")
    	break
else:
    print("Good")

Fixed submission:
S = input()

result = 0
for i in range(len(S) - 1):
    if S[i] == S[i+1]:
        result += 1

if result == 0:
    print("Good")
else:
    print("Bad")

Buggy python submission (verdict: Runtime Error):
S = input()
 
result = 0
for i in range(len(S) - 1):
    if S[i] == S[i+1]:
        print("Bad")
    	break 
	else:
    	print("Good")

Fixed submission:
S = input()

result = 0
for i in range(len(S) - 1):
    if S[i] == S[i+1]:
        result += 1

if result == 0:
    print("Good")
else:
    print("Bad")

Buggy python submission (verdict: Runtime Error):
S = int(input())

result = 0
for i in range(len(S) - 1):
    if S[i] == S[i+1]:
        result += 1

if result == 0:
    print("Good")
else:
    print("Bad")
 

Fixed submission:
S = input()

result = 0
for i in range(len(S) - 1):
    if S[i] == S[i+1]:
        result += 1

if result == 0:
    print("Good")
else:
    print("Bad")
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))

D = 0
bound_count = 0

i = 0
while D <= X:
    D += L[i]
    bound_count += 1
    i += 1

print(bound_count)

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = [0 for i in range(N + 1)]
bounding = 0
for i in range(N):
    D[i + 1] = D[i] + L[i]

for d in D:
    if d <= X:
        bounding += 1

print(bounding)
Buggy python submission (verdict: Runtime Error):
N = int(input())
W = map(int, input().split())
ans = 0

for T in range(N-1):
    tmp = abs(sum(W[1:T]) - sum(W[T:N]))
    if ans > tmp:
        ans = tmp
 
print(ans)

Fixed submission:
N = int(input())
M = list(map(int, input().split()))
ans = sum(M)

for T in range(1, N):
    ans = min(abs(sum(M[0:T]) - sum(M[T:N])), ans)

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
S = []
result = 0
A_count = 0
B_count = 0
BA_count = 0

for i in range(n):
    Si = str(input())
    S.append(Si)

for i in range(n):
    Si = S[i]
    result += Si.count("AB")
    if Si[0] == "B":
        B_count += 1
    if Si[-1] == "A":
        A_count += 1
    if Si[0] == "B" and Si[-1] == "A"
        BA_count += 1 

if BA_count >= 2:
    result += (BA_count - 1)

if BA_count >= 1
    if B_count >= 1:
        result += 1
        B_count -= 1
    if A_count >= 1:
        result += 1
        A_count -= 1

if B_count >= 1 and A_count >= 1:
    result += min(B_count, A_count)

print(result)  

Fixed submission:
n = int(input())
S = []
result = 0
A_count = 0
B_count = 0
BA_count = 0

for i in range(n):
    Si = str(input())
    S.append(Si)

for i in range(n):
    Si = S[i]
    result += Si.count("AB")
    if Si[0] == "B" and Si[-1] != "A":
        B_count += 1
    if Si[0] != "B" and Si[-1] == "A":
        A_count += 1
    if Si[0] == "B" and Si[-1] == "A":
        BA_count += 1 

if BA_count >= 2:
    result += (BA_count - 1)

if BA_count >= 1:
    if B_count >= 1:
        result += 1
        B_count -= 1
    if A_count >= 1:
        result += 1
        A_count -= 1

if B_count >= 1 and A_count >= 1:
    result += min(B_count, A_count)

print(result)
Buggy python submission (verdict: Runtime Error):
def round_up(n: int) -> int:
    if n%10 != 0:
        return n + 10 - (n%10)
    else:
        return n

def round_up_count(n: int) -> int:
    if n%10 != 0:
        return 10 - n%10
    else:
        return 0

orders = []

max_rc: int = 0
last_order_index: int = 0
last_order_time: int = 0

for i in range(5):
    order = int(input())
    orders.append(order)
    last_order_time += round_up(order)
    rc = round_up_count(order)
    if max_rc <= rc:
        last_order_index = i
        max_rc = rc

print(last_order_time - round_up_count(orders[last_order_index]))

Fixed submission:
def round_up(n):
    if n%10 != 0:
        return n + 10 - (n%10)
    else:
        return n

def round_up_count(n):
    if n%10 != 0:
        return 10 - n%10
    else:
        return 0

orders = []

max_rc = 0
last_order_index = 0
last_order_time = 0

for i in range(5):
    order = int(input())
    orders.append(order)
    last_order_time += round_up(order)
    rc = round_up_count(order)
    if max_rc <= rc:
        last_order_index = i
        max_rc = rc

print(last_order_time - round_up_count(orders[last_order_index]))
Buggy python submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
B = list(map(int, input().split()))

correct_answer = 0

for i in range(N):
    A = list(map(int, input().split()))
    
    for j in range(M):
        sum_AB += A[j]*B[j]
    if sum_AB + C > 0:
        correct_answer += 1

print(correct_answer)

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

correct_answer = 0

for i in range(N):
    A = list(map(int, input().split()))
    sum_AB = 0
    for j in range(M):
        sum_AB += A[j]*B[j]
    if sum_AB + C > 0:
        correct_answer += 1

print(correct_answer)
Buggy python submission (verdict: Time Limit Exceeded):
# Educational DP contest B frog_2 -> TLE

N, K = map(int, input().split())
h = list(map(int, input().split()))

INF = 10**9
dp = [INF for _ in range(N)]
dp[0] = 0

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

print(dp[-1])

Fixed submission:
import sys
import numpy as np

input = sys.stdin.readline

N, K = map(int, input().split())
h = [int(i) for i in input().split()]

dp = np.zeros(N, dtype=int)
h = np.array(h)

for i in range(1, N):
    start = max(0, i-K)
    dp[i] = min(dp[start:i] + np.abs(h[i] - h[start:i]))

print(dp[N-1])

Buggy python submission (verdict: Time Limit Exceeded):
# Educational DP contest B frog_2

N, K = map(int, input().split())
h = list(map(int, input().split()))

INF = 10**9
dp = [INF for _ in range(N)]
dp[0] = 0
dp[1] = abs(h[1] - h[0])

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

print(dp[-1])

Fixed submission:
import sys
import numpy as np

input = sys.stdin.readline

N, K = map(int, input().split())
h = [int(i) for i in input().split()]

dp = np.zeros(N, dtype=int)
h = np.array(h)

for i in range(1, N):
    start = max(0, i-K)
    dp[i] = min(dp[start:i] + np.abs(h[i] - h[start:i]))

print(dp[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
t = str(input())
s_length = len(s) 
t_length = len(t)

if s_length < t_length:
    s, t = t, s
    s_length, t_length = t_length, s_length

dp = [[0 for j in range(s_length + 1)] for i in range(t_length + 1)]

for i in range(0, t_length):
    for j in range(0, s_length):
        if s[j] == t[i]:
            dp[i + 1][j + 1] = dp[i][j] + 1
        else:
            dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j])

lcs = ""
i = t_length
j = s_length

while (i > 0 and j > 0):
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        lcs += s[j-1]
        i -= 1
        j -= 1

print(lcs[::-1])

Fixed submission:
s = str(input())
t = str(input())
s_length = len(s) 
t_length = len(t)

if s_length < t_length:
    s, t = t, s
    s_length, t_length = t_length, s_length

dp = [[0 for j in range(s_length + 1)] for i in range(t_length + 1)]

for i in range(0, t_length):
    for j in range(0, s_length):
        if s[j] == t[i]:
            dp[i + 1][j + 1] = dp[i][j] + 1
        else:
            dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j])

lcs = ""
i = t_length
j = s_length

while (i > 0 and j > 0):
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        lcs += s[j-1]
        i -= 1
        j -= 1

print(lcs[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

p = list(map(float, input().split()))

dp = [[0 for j in range(N+2)] for i in range(N+1)]
dp[0][1] = 1

for i in range(N):
    for j in range(i+2):
        dp[i+1][j+1] = dp[i][j+1] * (1 - p[i]) + dp[i][j] * p[i]

print(sum(dp[N][N + N//-2 + 2:]))


Fixed submission:
N = int(input())

p = list(map(float, input().split()))

dp = [[0 for j in range(N+2)] for i in range(N+1)]
dp[0][1] = 1

for i in range(N):
    for j in range(i+2):
        dp[i+1][j+1] = dp[i][j+1] * (1 - p[i]) + dp[i][j] * p[i]

print(sum(dp[N][N + N//-2 + 2:]))
Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np
 
input = sys.stdin.readline
 
N, K = map(int, input().split())
a = [int(i) for i in input().split()]

dp = [True for j in range(K+1)]
dp[0] = False

for j in range(K):
    for i in range(N):
        if j+1 - a[i] >= 0:
            dp[j+1] = dp[j+1] and dp[j+1 - a[i]]
    dp[j+1] = not dp[j+1]

if dp[-1]:
    print("First")
else:
    print("Second")

Fixed submission:
import sys
 
input = sys.stdin.readline
 
N, K = map(int, input().rstrip("\n").split())
a = [int(i) for i in input().rstrip("\n").split()]

dp = [True for j in range(K+1)]
dp[0] = False

for j in range(K):
    for i in range(N):
        if j+1 - a[i] >= 0:
            dp[j+1] = dp[j+1] and dp[j+1 - a[i]]
    dp[j+1] = not dp[j+1]

if dp[-1]:
    print("First")
else:
    print("Second")

Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np
 
input = sys.stdin.readline
 
N, K = map(int, input().split())
a = [int(i) for i in input().split()]

dp = [True for j in range(K+1)]
dp[0] = False

for j in range(K):
    for i in range(N):
        if j+1 - a[i] >= 0:
            dp[j+1] = dp[j+1] and dp[j+1 - a[i]]
    dp[j+1] = not dp[j+1]

if dp[-1]:
    print("First")
else:
    print("Second")

Fixed submission:
import sys
 
input = sys.stdin.readline
 
N, K = map(int, input().rstrip("\n").split())
a = [int(i) for i in input().rstrip("\n").split()]

dp = [True for j in range(K+1)]
dp[0] = False

for j in range(K):
    for i in range(N):
        if j+1 - a[i] >= 0:
            dp[j+1] = dp[j+1] and dp[j+1 - a[i]]
    dp[j+1] = not dp[j+1]

if dp[-1]:
    print("First")
else:
    print("Second")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
 
input = sys.stdin.readline
 
N, K = map(int, input().split())
a = [int(i) for i in input().split()]

dp = [True for j in range(K+1)]
dp[0] = False

for j in range(K):
    for i in range(N):
        if j+1 - a[i] >= 0:
            dp[j+1] = dp[j+1] and dp[j+1 - a[i]]
    dp[j+1] = not dp[j+1]

if dp[-1]:
    print("First")
else:
    print("Second")

Fixed submission:
import sys
 
input = sys.stdin.readline
 
N, K = map(int, input().rstrip("\n").split())
a = [int(i) for i in input().rstrip("\n").split()]

dp = [True for j in range(K+1)]
dp[0] = False

for j in range(K):
    for i in range(N):
        if j+1 - a[i] >= 0:
            dp[j+1] = dp[j+1] and dp[j+1 - a[i]]
    dp[j+1] = not dp[j+1]

if dp[-1]:
    print("First")
else:
    print("Second")
Buggy python submission (verdict: Runtime Error):
N = int(input())
items = []
for _ in range(N):
    item = int(input())
    items.append(item)

items.sort()

print(int(sum(items[0:N-1]) + items[N]/2))

Fixed submission:
N = int(input())
items = []
for _ in range(N):
    item = int(input())
    items.append(item)

items.sort()

print(int(sum(items[0:N-1]) + items[-1]/2))
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
trees = []
for _ in range(N):
    tree = int(input())
    trees.append(tree)

trees.sort()

m = max(trees[0:K]) - min(trees[0:K])
for i in range(1, N-K+1):
    m = min(m, max(trees[i:i+K]) - min(trees[i:i+K]))

print(m)

Fixed submission:
N, K = map(int, input().split())
trees = []
for _ in range(N):
    tree = int(input())
    trees.append(tree)

trees.sort()

m = trees[K-1] -trees[0]
for i in range(1, N-K+1):
    m = min(m, trees[i+K-1] - trees[i])

print(m)
Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split())).sort()
print(a[-1] * 10 + a[0] + a[1])

Fixed submission:
a = sorted(map(int, input().split()))
print(a[-1] * 10 + a[0] + a[1])
Buggy python submission (verdict: Runtime Error):
row, col, num = map(int, input().split())

tmp_l = []
board = []
for i in range(row):
  str = input()
  for j in range(col):
    if str[j] == '.':
      tmp_l.append(0)
    if str[j] == '#':
      tmp_l.append(1)
  board.append(tmp_l)
  tmp_l = []

onoff = []
bi = [32, 16, 8, 4, 2, 1]
for i in range(64):
  tmp = i
  for j in bi:
    tmp_l.insert(0, int(tmp / j))
    tmp = tmp % j
  onoff.append(tmp_l)
  tmp_l = []

count = 0
ans = 0
for i in range(2**row):
  for j in range(2**col):
    for k in range(row):
      if onoff[i][k] == 1:
        for l in range(col):
          if onoff[j][l] == 1:
            if board[l][k] == 1:
              count += 1
    if count == num:
      ans += 1
    count = 0

print(ans)

Fixed submission:
row, col, num = map(int, input().split())

tmp_l = []
board = []
for i in range(row):
  str = input()
  for j in range(col):
    if str[j] == '.':
      tmp_l.append(0)
    if str[j] == '#':
      tmp_l.append(1)
  board.append(tmp_l)
  tmp_l = []

onoff = []
bi = [32, 16, 8, 4, 2, 1]
for i in range(64):
  tmp = i
  for j in bi:
    tmp_l.insert(0, int(tmp / j))
    tmp %= j
  onoff.append(tmp_l)
  tmp_l = []

count = 0
ans = 0
for i in range(2**row):
  for j in range(2**col):
    for k in range(row):
      if onoff[i][k] == 1:
        for l in range(col):
          if onoff[j][l] == 1:
            if board[k][l] == 1:
              count += 1
    if count == num:
      ans += 1
    count = 0

print(ans)

Buggy python submission (verdict: Runtime Error):
row, col, num = map(int, input().split())

tmp_list = []
board = []
for i in range(row):
  str = input()
  for j in range(col):
    if str[j] == '.':
      tmp_list.append(0)
    if str[j] == '#':
      tmp_list.append(1)
  board.append(tmp_list)
  tmp_list = []

onoff = []
bi = [32, 16, 8, 4, 2, 1]
for i in range(64):
  tmp = i
  for j in bi:
    tmp_list.insert(0, int(tmp / j))
    tmp %= j
  onoff.append(tmp_list)
  tmp_list = []

count = 0
ans = 0
for i in range(2**row):
  for j in range(2**col):
    for k in range(row):
      if onoff[i][k] == 1:
        for l in range(col):
          if onoff[j][l] == 1:
            if board[l][k] == 1:
              count += 1
    if count == num:
      ans += 1
    count = 0

print(ans)

Fixed submission:
row, col, num = map(int, input().split())

tmp_l = []
board = []
for i in range(row):
  str = input()
  for j in range(col):
    if str[j] == '.':
      tmp_l.append(0)
    if str[j] == '#':
      tmp_l.append(1)
  board.append(tmp_l)
  tmp_l = []

onoff = []
bi = [32, 16, 8, 4, 2, 1]
for i in range(64):
  tmp = i
  for j in bi:
    tmp_l.insert(0, int(tmp / j))
    tmp %= j
  onoff.append(tmp_l)
  tmp_l = []

count = 0
ans = 0
for i in range(2**row):
  for j in range(2**col):
    for k in range(row):
      if onoff[i][k] == 1:
        for l in range(col):
          if onoff[j][l] == 1:
            if board[k][l] == 1:
              count += 1
    if count == num:
      ans += 1
    count = 0

print(ans)
Buggy python submission (verdict: Runtime Error):
s = input().split()
N = int(s[0])
K = int(s[1])

ans = N // K 

if K % 2 == 0:
  ans = ans + N//(K%2)

print(ans**3 ) 

Fixed submission:
s = input().split()
N = int(s[0])
K = int(s[1])

ans = N // K 
ans = ans ** 3

ans_ev = 0
if K % 2 == 0:
  ans_ev = (N+(K//2)) // (K)
  ans_ev = ans_ev ** 3
                         

print(ans+ ans_ev )
Buggy python submission (verdict: Runtime Error):
n = int(input())
k = int(input())

if(n % k > 0):
    print(1)
else:
    print(0)


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

if(n % k > 0):
    print(1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

if T in S:
    ans = 0
else:
    for i in range(1, len(T)):
#         print(T[i:])
#         print(T[:-i])
#         print('--------------')
        if T[i:] in S or T[:-i] in S:
            ans = i
            break
print(ans)

Fixed submission:
S = input()
T = input()

iteration = len(S) - len(T) + 1

if T in S:
    ans = 0
else:
    minimum = len(T)
    for i in range(iteration):
#         print('---------------')
        s = S[i:len(T)+i]
#         print(s)
#         print(T)
        count = 0
        for j in range(len(T)):
            if s[j] != T[j]:
                count += 1
#             print(count)
        minimum = min(minimum, count)
    ans = minimum
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce

n, k = map(int, input().split())
A = list(map(int, input().split()))


res = [0] * (n-k+1)
res[0] = reduce(lambda x, y: x*y , A[0:k+1])

for i in range(1, n-k+1):
    res[i] = res[i-1]//A[i-1]*A[i+k-1]
    print('Yes' if res[i-1] < res[i] else 'No')




Fixed submission:
from functools import reduce

n, k = map(int, input().split())
A = list(map(int, input().split()))

for i in range(0, n-k):
    print('Yes' if A[i] < A[i+k] else 'No')

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce

n, k = map(int, input().split())
A = list(map(int, input().split()))


res = [0] * (n-k+1)
res[0] = reduce(lambda x, y: x*y , A[0:k+1])

for i in range(1, n-k+1):
    res[i] = res[i-1]//A[i-1]*A[i+k-1]
    print('Yes' if res[i-1] < res[i] else 'No')




Fixed submission:
from functools import reduce

n, k = map(int, input().split())
A = list(map(int, input().split()))

for i in range(0, n-k):
    print('Yes' if A[i] < A[i+k] else 'No')

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce

n, k = map(int, input().split())
A = list(map(int, input().split()))


res = [0] * (n-k+1)
res[0] = reduce(lambda x, y: x*y , A[0:k+1])

for i in range(1, n-k+1):
    res[i] = res[i-1]//A[i-1]*A[i+k-1]

for j in range(n-k):
    ans = 'Yes' if res[j] < res[j+1] else 'No'
    print(ans)



Fixed submission:
from functools import reduce

n, k = map(int, input().split())
A = list(map(int, input().split()))

for i in range(0, n-k):
    print('Yes' if A[i] < A[i+k] else 'No')
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(a[i] + A[i])

ans, j = o, 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)


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):
from collections import deque


n, m, k = map(int, input().split())

A = deque(int(a) for a in input().split())
B = deque(int(b) for b in input().split())

ans = 0
while (len(A) or len(B)) and k:
    a = A[0] if len(A) else k + 1
    b = B[0] if len(B) else K + 1
    if a >= b:
        if k - b >= 0:
            k -= B.popleft()
            ans += 1
            continue
        else:
            break
    else:
        if k - a >= 0:
            k -= A.popleft()
            ans += 1
            continue
        else:
            break

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)