Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
N, K = map(int, input().split())
s = input()
  
group = []
sign = s[0]
curr = 0
for i in range(N):
  curr += 1
  if s[i] != sign: 
    group += [curr-1]
    curr = 1
    sign = s[i]
else:group += [curr]

if s[0] == '0' :
  if s[N-1] == '0':
    m = (len(group)+1)//2
    if K >= m:
      print(N)
      sys.exit()
    score = [sum(group[:2*K])]
    for i in range(m-K):
      score += [score[-1] - group[2*i] + group[2*i+2*K]]
  else :
    m = (len(group)+1)//2
    if K >= m:
      print(N)
      sys.exit()
    score = [sum(group[:2*K])]
    for i in range(m-K):
      score += [score[-1] - group[2*i] + group[2*i+2*K]]
    score[-1] += group[-1]
else:
  0/0
  m = len(group)//2
  group += [0]
  if K >= m:
    print(N)
    sys.exit()
  score = [sum(group[:2*K+1])]
  for i in range(m-K):
    score += [score[-1] - group[2*i] - group[2*i+1] + group[2*i+2*K+1]+group[2*i+2*K +2]]

print(max(score))

Fixed submission:
a,b = map(int,input().split())
if a == b:
  print(2*a)
else:
  print(2*max(a,b)-1)
Buggy python submission (verdict: Runtime Error):
s=input()
if s="A":
  print("T")
if s="T":
  print("A")

if s="G":
  print("C")
if s="C":
  print("G")

Fixed submission:
s=input()
if s=="A":
  print("T")
if s=="T":
  print("A")

if s=="G":
  print("C")
if s=="C":
  print("G")
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())

cand = []
for i in range(101,1,-1):
  if A%i == 0 and B%i == 0:
    cand += [i]
    
    
print(cand[K-1])

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

cand = []
for i in range(100,0,-1):
  if A%i == 0 and B%i == 0:
    cand += [i]
    
    
print(cand[K-1])

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

cand = []
for i in range(1,101):
  if A%i == 0 and B%i == 0:
    cand += [i]
    
    
print(cand[K+1])

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

cand = []
for i in range(100,0,-1):
  if A%i == 0 and B%i == 0:
    cand += [i]
    
    
print(cand[K-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(N):
  x, u = map(str, input().split())
  if u == "JPY":
    ans += float(x)
  else:
    ans += float(x * 38000.0)
    
print(ans)

Fixed submission:

N = int(input())
ans = 0
for i in range(N):
  x, u = map(str, input().split())
  if u == "JPY":
    ans += float(x)
  else:
    ans += float(x) * 380000.0
    
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int, input().split()))
honsuu = [0,2,5,5,4,5,6,3,7,6]
aval = []
for a in A:
  aval += [honsuu[a]]
aval.sort()

dp = [0] 
# i 本のマッチで作れる最高の桁数
for i in range(1,N+1):
  for b in aval:
    if i < b:
      continue
    else:
      dp += [dp[i-b] + 1]
      break
  else:
    dp += [0]

#作れる桁数はdp[-1]=dp[N] で, 最高桁にi が使えるかどうかの条件は, 
#a in A かつ dp[N- honsuu[a]] = dp[N] -1
A.sort(reverse=True)
ans = []
for i in range(dp[N],1,-1):
  for a in A:
    if N - honsuu[a] < 0:continue
    if dp[N - honsuu[a]] == dp[N] - 1:
      N -= honsuu[a]
      ans += [a]
      break
      
final = 0
for i in range(10):
  if i in A and honsuu[i] == N:
    final = i
    break
ans += [final]
print(''.join(map(str, ans)))

Fixed submission:
A, B = map(int, input().split())
if B%A == 0:
  print(A+B)
else:
  print(B-A)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int, input().split()))
honsuu = [0,2,5,5,4,5,6,3,7,6]
aval = []
for a in A:
  aval += [honsuu[a]]
aval.sort()

dp = [0]+ [-float("INF")]*N 
# i 本のマッチで作れる最高の桁数
for i in range(1,N+1):
  for b in aval:
    if i < b:
      continue
    else:
      dp[i] = dp[i-b] + 1
      break
      
#作れる桁数はdp[-1]=dp[N] で, 最高桁にi が使えるかどうかの条件は, 
#a in A かつ dp[N- honsuu[a]] = dp[N] -1
A.sort(reverse=True)
ans = []
for i in range(dp[N],1,-1):
  for a in A:
    if N - honsuu[a] < 0:continue
    if dp[N - honsuu[a]] == dp[N] - 1:
      N -= honsuu[a]
      ans += [a]
      break
      
final = 0
for i in range(10):
  if i in A and honsuu[i] == N:
    final = i
ans += [final]
print(''.join(map(str, ans)))

Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
honsuu = [0,2,5,5,4,5,6,3,7,6]
aval = []
for a in A:
  aval += [honsuu[a]]
aval.sort()

dp = [0]+ [-float("INF")]*N 
# i 本のマッチで作れる最高の桁数
for i in range(1,N+1):
  for b in aval:
    if i < b:
      continue
    elif dp[i-b] >= 0:
      dp[i] = dp[i-b] + 1
      break
      
#作れる桁数はdp[-1]=dp[N] で, 最高桁にi が使えるかどうかの条件は, 
#a in A かつ dp[N- honsuu[a]] = dp[N] -1
A.sort(reverse=True)
ans = []
for i in range(dp[N],1,-1):
  for a in A:
    if N - honsuu[a] < 0:continue
    if dp[N - honsuu[a]] == dp[N] - 1:
      N -= honsuu[a]
      ans += [a]
      break
      
final = 0
for i in range(10):
  if i in A and honsuu[i] == N:
    final = i
ans += [final]
print(''.join(map(str, ans)))
Buggy python submission (verdict: Runtime Error):
#https://atcoder.jp/contests/yahoo-procon2019-qual/tasks/yahoo_procon2019_qual_d
#2019-02-11

#DP
L = int(input())
DP = [0 for i in range(5)]

def cost(a):
    if a:
        return [a, a%2, (a+1)%2, a%2, a]
    else:
        return [0, 2, 1, 2, 0]

for i in range(L):
    n = [min(DP[:i+1]) for i in range(5)]
    cos = cost(int(input()))
    DP[4] = n[4] + cos[4]
    DP[3] = n[3] + cos[3]
    DP[2] = n[2] + cos[2]
    DP[1] = n[1] + cos[1]
    DP[0] = n[0] + cos[0]

print(min(DP))

Fixed submission:
N, K = map(int, input().split())
if K <=(N+1)//2:
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):

#DP
import numpy as np
L = int(input())
A = [int(input()) for i in range(L)]

DP = np.zeros(5, dtype = int)

def cost(a:int) -> np.array:
    if a:
        return np.array([a,a%2,(a+1)%2,a%2,a])
    else:
        return np.array([0,2,1,2,0])

for i in range(L):
    n  = np.array([np.min(DP[:i+1]) for i in range(5)])
    DP = n + cost(A[i])

print(np.min(DP))

Fixed submission:
N, K = map(int, input().split())
if K <=(N+1)//2:
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
#https://atcoder.jp/contests/yahoo-procon2019-qual/tasks/yahoo_procon2019_qual_d
#2019-02-10

#DP

L = int(input())
A = [int(input()) for i in range(L)]

DP = [[0 for i in range(5)] for j in range(L+1)]

def cost(s, a):
    if s == 0 or s == 4:
        return a
    elif s == 1 or s == 3:
        if a > 0:
            return a%2
        else:
            return 2
    else:
        return (a+1)%2

for i in range(L):
    a = A[i]
    DP[i+1][0] = min(DP[i][:1]) + cost(0, a)
    DP[i+1][1] = min(DP[i][:2]) + cost(1, a)
    DP[i+1][2] = min(DP[i][:3]) + cost(2, a)
    DP[i+1][3] = min(DP[i][:4]) + cost(3, a)
    DP[i+1][4] = min(DP[i][:5]) + cost(4, a)



print(min(DP[L]))

Fixed submission:
N, K = map(int, input().split())
if K <=(N+1)//2:
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
#https://atcoder.jp/contests/yahoo-procon2019-qual/tasks/yahoo_procon2019_qual_d
#2019-02-10

#DP

L = int(input())
A = [int(input()) for i in range(L)]

DP = [[0 for i in range(5)] for j in range(L+1)]

def cost(s, i, A):
    if s == 0 or s == 4:
        return A[i]
    elif s == 1 or s == 3:
        if A[i] > 0:
            if A[i]%2 == 0:
                return 0
            else:
                return 1
        else:
            return 2
    else:
        if A[i]%2 == 1:
            return 0
        else:
            return 1

for i in range(L):
    DP[i+1][0] = DP[i][0] + cost(0, i, A)
    DP[i+1][1] = min(DP[i][:2]) + cost(1, i, A)
    DP[i+1][2] = min(DP[i][:3]) + cost(2, i, A)
    DP[i+1][3] = min(DP[i][:4]) + cost(3, i, A)
    DP[i+1][4] = min(DP[i][:5]) + cost(4, i, A)



print(min(DP[L]))

Fixed submission:
N, K = map(int, input().split())
if K <=(N+1)//2:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
from collections import deque
N, M = map(int, input().split())
graph = [] 
for i in range(N + M - 1):
    a, b = map(int, input().split())
    graph += [[a,b]]

path = [[] for i in range(N)]  
parent = [[] for i in range(N)]
ans = [-1 for i in range(N)]
for p in graph:
    parent[p[1]-1] += [p[0]-1]
    path[p[0]-1] += [p[1]-1]

root = -1
for i in range(N):
    if parent[i] == []:
        root = i
        ans[i] = -1
    
que = deque()
for v in path[root]:
    que.append([root, v])
while que:
    u, V = que.popleft()
    ans[V] = u
    for v in path[V]:
        que.append([V, v])

for i in range(N):
    print(ans[i]+1)

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

ans1 = min(A,B)
ans2 = max(0, A+B-N)
print(ans1, ans2)
Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/dp/tasks/dp_b
#2019-01-13
N, K = map(int, input().split())
h = list(map(int, input().split()))

DP = [0]
for i in range(N-1):
    act = float("inf")
    for k in range(K):
        if i-k < 0 : continue
        act = min(DP[-1-k] + abs(h[i-k]-h[i+1]) , act)
    DP += [act]

print(DP[-1])

Fixed submission:
#https://atcoder.jp/contests/dp/tasks/dp_b
#2019-01-13
N, K = map(int, input().split())
h = list(map(int, input().split()))

DP = [0]
for i in range(N-1):
    act = float("inf")
    for k in range(K):
        if i-k < 0 : continue
        act = min(DP[-1-k] + abs(h[i-k]-h[i+1]) , act)
    DP += [act]

print(DP[-1])
Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/dp/tasks/dp_d
#2019-01-13
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
    a, b = map(int, input().split())
    w += [a]
    v += [b]

DP = [0] * (W+1)
# i 円以下で買える商品の最大価値
for i in range(N):
    for weight in range(W,-1,-1):
        if weight - w[i] < 0 :continue
        DP[weight] = max(DP[weight], DP[weight - w[i]] +v[i])
print(DP[-1])

Fixed submission:
#https://atcoder.jp/contests/dp/tasks/dp_d
#2019-01-13
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
    a, b = map(int, input().split())
    w += [a]
    v += [b]

DP = [0] * (W+1)
# i 円以下で買える商品の最大価値
for i in range(N):
    for weight in range(W,-1,-1):
        if weight - w[i] < 0 :continue
        DP[weight] = max(DP[weight], DP[weight - w[i]] +v[i])
print(DP[-1])

Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/dp/tasks/dp_d
#2019-01-13
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
    a, b = map(int, input().split())
    w += [a]
    v += [b]

ans = 0
for i in range(1 << N):
    cnt = 0
    weight = 0
    for j in range(N):
        if i & 1<<j:
            cnt += v[j]
            weight += w[j]
    if weight <= W:
        ans = max(ans, cnt)
print(ans)

Fixed submission:
#https://atcoder.jp/contests/dp/tasks/dp_d
#2019-01-13
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
    a, b = map(int, input().split())
    w += [a]
    v += [b]

DP = [0] * (W+1)
# i 円以下で買える商品の最大価値
for i in range(N):
    for weight in range(W,-1,-1):
        if weight - w[i] < 0 :continue
        DP[weight] = max(DP[weight], DP[weight - w[i]] +v[i])
print(DP[-1])

Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/dp/tasks/dp_d
#2019-01-13
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
    a, b = map(int, input().split())
    w += [a]
    v += [b]

ans = 0
for i in range(1 << N):
    cnt = 0
    weight = 0
    for j in range(N):
        if i & 1<<j:
            cnt += v[j]
            weight += w[j]
    if weight <= W:
        ans = max(ans, cnt)
print(ans)

Fixed submission:
#https://atcoder.jp/contests/dp/tasks/dp_d
#2019-01-13
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
    a, b = map(int, input().split())
    w += [a]
    v += [b]

DP = [0] * (W+1)
# i 円以下で買える商品の最大価値
for i in range(N):
    for weight in range(W,-1,-1):
        if weight - w[i] < 0 :continue
        DP[weight] = max(DP[weight], DP[weight - w[i]] +v[i])
print(DP[-1])
Buggy python submission (verdict: Runtime Error):
#https://atcoder.jp/contests/dp/tasks/dp_e
#2019-01-13
import numpy as np
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
    a, b = map(int, input().split())
    w += [a]
    v += [b]

DP = np.ones(N*1000+1,dtype = int) *(W+1)
DP[0] = 0
#総価値 i 円を得るために最低限必要な重量
for i in range(N):
    for j in range(N*1000,-1,-1):
        DP[j] = min(DP[j- v[i]] + w[i], DP[j])
ans = 0
for k in range(N*1000+1):
    if DP[k] <= W:
        
        ans = k
print(ans)

Fixed submission:
#https://atcoder.jp/contests/dp/tasks/dp_e
#2019-01-13
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
    a, b = map(int, input().split())
    w += [a]
    v += [b]

DP = [float("inf")] * (N*1000+1)
DP[0] = 0
#総価値 i 円を得るために最低限必要な重量
for i in range(N):
    for j in range(N*1000,-1,-1):
        DP[j] = min(DP[j- v[i]] + w[i], DP[j])
ans = 0
for k in range(N*1000+1):
    if DP[k] <= W:
        
        ans = k
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/dp/tasks/dp_e
#2019-01-13
import numpy as np
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
    a, b = map(int, input().split())
    w += [a]
    v += [b]

DP = np.ones(N*1000+1,dtype = int) *(W+1)
DP[0] = 0
#総価値 i 円を得るために最低限必要な重量
for i in range(N):
    for j in range(N*1000,-1,-1):
        DP[j] = min(DP[j- v[i]] + w[i], DP[j])
ans = 0
for k in range(N*1000+1):
    if DP[k] <= W:
        
        ans = k
print(ans)

Fixed submission:
#https://atcoder.jp/contests/dp/tasks/dp_e
#2019-01-13
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
    a, b = map(int, input().split())
    w += [a]
    v += [b]

DP = [float("inf")] * (N*1000+1)
DP[0] = 0
#総価値 i 円を得るために最低限必要な重量
for i in range(N):
    for j in range(N*1000,-1,-1):
        DP[j] = min(DP[j- v[i]] + w[i], DP[j])
ans = 0
for k in range(N*1000+1):
    if DP[k] <= W:
        
        ans = k
print(ans)

Buggy python submission (verdict: Runtime Error):
#https://atcoder.jp/contests/dp/tasks/dp_d
#2019-01-13
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
    a, b = map(int, input().split())
    w += [a]
    v += [b]

DP = [0] * (W+1)
# i 円以下で買える商品の最大価値
for i in range(N):
    for weight in range(W,-1,-1):
        if weight - w[i] < 0 :continue
        DP[weight] = max(DP[weight], DP[weight - w[i]] +v[i])
print(DP[-1])

Fixed submission:
#https://atcoder.jp/contests/dp/tasks/dp_e
#2019-01-13
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
    a, b = map(int, input().split())
    w += [a]
    v += [b]

DP = [float("inf")] * (N*1000+1)
DP[0] = 0
#総価値 i 円を得るために最低限必要な重量
for i in range(N):
    for j in range(N*1000,-1,-1):
        DP[j] = min(DP[j- v[i]] + w[i], DP[j])
ans = 0
for k in range(N*1000+1):
    if DP[k] <= W:
        
        ans = k
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter

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

cnt1 = Counter(v[::2]).most_common()
cnt2 = Counter(v[1::2]).most_common()
if cnt1[0][0] != cnt2[0][0]:
    print(n - (cnt1[0][1] + cnt2[0][1]))
else:
    print(n - min(cnt1[1][1] + cnt2[0][1], cnt1[1][1] + cnt2[0][1]))

Fixed submission:
from collections import Counter

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

cnt1 = Counter(v[::2]).most_common()
cnt2 = Counter(v[1::2]).most_common()
cnt1 += [(-1,0)]
cnt2 += [(-1,0)]
if cnt1[0][0] != cnt2[0][0]:
    print(n - (cnt1[0][1] + cnt2[0][1]))
else:
    print(n - max(cnt1[1][1] + cnt2[0][1], cnt1[0][1] + cnt2[1][1]))
Buggy python submission (verdict: Runtime Error):
A = list(map(int, input().split()))
A.sort()
ans(A[0]+A[1]+10*A[2])

Fixed submission:
A = list(map(int, input().split()))
A.sort()
print(A[0]+A[1]+10*A[2])
Buggy python submission (verdict: Runtime Error):
N = int(input())
word = []
flag = 1
for i in range(N):
  st = input()
  if i > 0 :
    if final != st[0]:
      flag = 0
    elif st in word:
      flag = 0
    else:
      final = st[-1]
      word += [st]
if flag:
  print("Yes")
else :
  print("No")

Fixed submission:
N = int(input())
word = []
flag = 1
for i in range(N):
  st = input()
  if i > 0 :
    if final != st[0]:
      flag = 0
    elif st in word:
      flag = 0
    else:
      final = st[-1]
      word += [st]
  else:
    final = st[-1]
    word += [st]
if flag:
  print("Yes")
else :
  print("No")
Buggy python submission (verdict: Runtime Error):
N, C = map(int, input().split())
D = [list(map(int, input().split())) for i in range(C)]
line1 = [0]*C
line2 = [0]*C
line0 = [0]*C
for i in range(N):
  c = list(map(int, input().split()))
  for j in range(N):
    if (i+j)%3 == 0:
      line0[c[j]-1] +=+1
    if (i+j)%3 == 1:
      line1[c[j]-1] +=+1
    if (i+j)%3 == 2:
      line2[c[j]-1] +=+1
ans = float("inf")
#line0をi+1に、1をj+1に, 2をk+1にそろえよう
#print(line0,line1,line2)
for i in range(C):
  for j in range(C):
    if j !=i :
      for k in range(C):
        if k !=i and k!=j: 
#          print(i,j,k)
          curr = 0
          for l in range(C):
            curr += line0[l]*D[l][i]
            curr += line1[l]*D[l][j]
            curr += line2[l]*D[l][k]
#          print(curr)
          ans = min(ans, curr)
print(ans)

Fixed submission:
N= int(input())
if N>999:
  print("ABD")
else:
  print("ABC")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
possible = [1]
i=1
while i <= 100000:
  i = i*6
  possible+=[i]
i=1
while i <= 100000:
  i = i*9
  possible+=[i]
possible.sort(reverse =1)
ans = 1
table = set(possible)
while True:
  if n in table:
    print(ans)
    break
  ans+=1
  nexttable = set()
  for num in table:
    for p in possible:
      if num + p <100000:
        nexttable.add(num+p)
  table = table | nexttable

Fixed submission:
n = int(input())
possible = [1]
i=1
while i <= 100000:
  i = i*6
  possible+=[i]
i=1
while i <= 100000:
  i = i*9
  possible+=[i]
possible.sort(reverse =1)
ans = 0
table = set([n])
while True:
  if 0 in table:
    print(ans)
    break
  ans+=1
  nexttable = set()
  for num in table:
    for p in possible:
      if num - p >= 0:
        nexttable.add(num-p)
  table =nexttable

Buggy python submission (verdict: Runtime Error):
n = int(input())
possible = [1]
i=1
while i <= 100000:
  i = i*6
  possible+=[i]
i=1
while i <= 100000:
  i = i*9
  possible+=[i]
possible.sort(reverse =1)
ans = 1
table = set(possible)
while True:
  if n in table:
    print(ans)
    break
  ans+=1
  nexttable = set()
  for num in table:
    for p in possible:
      if num + p <100000
        nexttable.add(num+p)
  table = table | nexttable

Fixed submission:
n = int(input())
possible = [1]
i=1
while i <= 100000:
  i = i*6
  possible+=[i]
i=1
while i <= 100000:
  i = i*9
  possible+=[i]
possible.sort(reverse =1)
ans = 0
table = set([n])
while True:
  if 0 in table:
    print(ans)
    break
  ans+=1
  nexttable = set()
  for num in table:
    for p in possible:
      if num - p >= 0:
        nexttable.add(num-p)
  table =nexttable

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
possible = [1]
i=1
while i <= 100000:
  i = i*6
  possible+=[i]
i=1
while i <= 100000:
  i = i*9
  possible+=[i]
possible.sort(reverse =1)
ans = 1
table = set(possible)
while True:
  if n in table:
    print(ans)
    break
  ans+=1
  nexttable = set()
  for num in table:
    for p in possible:
      nexttable.add(num+p)
  table = table | nexttable

Fixed submission:
n = int(input())
possible = [1]
i=1
while i <= 100000:
  i = i*6
  possible+=[i]
i=1
while i <= 100000:
  i = i*9
  possible+=[i]
possible.sort(reverse =1)
ans = 0
table = set([n])
while True:
  if 0 in table:
    print(ans)
    break
  ans+=1
  nexttable = set()
  for num in table:
    for p in possible:
      if num - p >= 0:
        nexttable.add(num-p)
  table =nexttable
Buggy python submission (verdict: Runtime Error):
N = int(input())
lis = [i for i in range(2,55555)]
primes = []
p=1
while(p*p < 55555):
  p = lis.pop(0)
  primes.append(p)
  for num in lis:
    if num%p == 0: lis.remove(num)
primes = primes + lis
print(' '.join(map(str, primes[:N])))

Fixed submission:
a, b = map(int,input().split())
print(a - (b<a))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
lis = [i for i in range(2,55555)]
primes = []
p=1
while(p*p < 55555):
  p = lis.pop(0)
  primes.append(p)
  for num in lis:
    if num%p == 0: lis.remove(num)
primes = primes + lis
prime2 = []
for p in primes:
  if p%5 ==1 :primes+=[p]

print(' '.join(map(str, prime2[:N])))


Fixed submission:
N = int(input())
lis = [i for i in range(2,55555)]
primes = []
p=1
while(p*p < 55555):
  p = lis.pop(0)
  if p%5==1:primes.append(p)
  for num in lis:
    if num%p == 0: lis.remove(num)
while(len(primes)<=56):
  p = lis.pop(0)
  if p%5==1:primes.append(p)

print(' '.join(map(str, primes[:N])))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
lis = [i for i in range(2,55555)]
primes = []
p=1
while(lis):
  p = lis.pop(0)
  primes.append(p)
  for num in lis:
    if num%p == 0: lis.remove(num)
print(' '.join(map(str, primes[:N])))

Fixed submission:
N = int(input())
lis = [i for i in range(2,55555)]
primes = []
p=1
while(p*p < 55555):
  p = lis.pop(0)
  if p%5==1:primes.append(p)
  for num in lis:
    if num%p == 0: lis.remove(num)
while(len(primes)<=56):
  p = lis.pop(0)
  if p%5==1:primes.append(p)

print(' '.join(map(str, primes[:N])))
Buggy python submission (verdict: Runtime Error):
N,M,X=map(int,input().split())
A=list(map(int,input().split()))
l, h =0,0
for i in range(M):
  if A[i]<X:l+=1
  if A[i]>X:h+=1
print(min(l,h))

Fixed submission:
A,B,X=map(int,input().split())
if A<=X<=A+B:print("YES")
else: print("NO")
Buggy python submission (verdict: Runtime Error):
str = input()
if "a" in str and "b in str and "c"  str:
  print("Yes")
else: 
  print("No")

Fixed submission:
str = input()
if "a" in str and "b" in str and "c"  in str:
  print("Yes")
else: 
  print("No")
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print((a-2)*(b-2))

Fixed submission:
print(input()[0]+input()[1]+input()[2])

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(abs((a-2)*(b-2)))

Fixed submission:
print(input()[0]+input()[1]+input()[2])
Buggy python submission (verdict: Runtime Error):
H, W, D = map(int,input().split())
dist = [[float("inf") for i in range(H*W+1)] for j in range(H*W+1)]
for i in range(H*W+1):
  dist[i][i] = 0
#dist[i][j]は隣接行列
pos = [[0,0] for i in range(H*W+1)]
for i in range(H):
  A = list(map(int,input().split()))
  for j in range(W):
    pos[A[j]] = [i+1, j+1]
for i in range(H*W+1-D):
  dist[i][i+D] = abs(pos[i][0]-pos[i+D][0])+abs(pos[i][1]-pos[i+D][1])
distances = [[] for i in range(D)]#あまりがiの距離
for i in range(1,H*W+1-D):
  d = dist[i][i+D]
  distances[i%D]+=[d]
distances2 = [[0] for i in range(D)]#累積和に直す
for i in range(D):
  K = len(distances[i])
  for j in range(K):
    distances2[i]+=[distances2[i][-1]+distances[i][j]]
Q = int(input())
for i in range(Q):
  L, R = map(int, input().split())
  q = L%D
  l, r = (L-1)//D, (R-1)//D
  print(distances2[q][r]-distances2[q][l])

Fixed submission:
N= int(input())
print(N//3)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
count = - sum(A) + sum(B)
for i in range(N):
  inv = max(0, A[i] - B[i])
  
if count >= 0 and inv <= count:
  print("Yes")
else :
  print("No")

Fixed submission:
X ,Y = map(int,input().split())
if X%Y == 0:
  print(-1)
else:
  print(X)