Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02975 (python)

Fixed submission:
def equal_list(lst1, lst2):
    lst = lst1.copy()
    for element in lst2:
        try:
            lst.remove(element)
        except ValueError:
            break
    else:
        if not lst:
            return True
    return False


N = int(input())
a = list(map(int, input().split()))

if a == [0]*N:
    print("Yes")
    exit()

if N % 3 == 0:
    n = N // 3
    sets = list(set(a))
    order = max(a).bit_length()
    if len(sets) == 3:
        for s in sets:
            if a.count(s) != n:
                print("No")
                exit()

        for i in range(order):
            b = [sets[0] >> i & 1, sets[1] >> i & 1, sets[2] >> i & 1]
            if b == [0, 0, 0]:
                continue
            if not equal_list(b, [0, 1, 1]):
                print("No")
                exit()
    elif len(sets) == 2:
        if a.count(sets[0]) == n:
            for i in range(order):
                b = [sets[0] >> i & 1, sets[1] >> i & 1]
                if b == [0, 0]:
                    continue
                if b != [0, 1]:
                    print("No")
                    exit()
        elif a.count(sets[1]) == n:
            for i in range(order):
                b = [sets[0] >> i & 1, sets[1] >> i & 1]
                if b == [0, 0]:
                    continue
                if b != [1, 0]:
                    print("No")
                    exit()
        else:
            print("No")
            exit()
    else:
        print("No")
        exit()

    print("Yes")

else:
    print("No")
    exit()

Buggy submission (verdict: Runtime Error):
def equal_list(lst1, lst2):
    lst = lst1.copy()
    for element in lst2:
        try:
            lst.remove(element)
        except ValueError:
            break
    else:
        if not lst:
            return True
    return False


N = int(input())
a = list(map(int, input().split()))

if a == [0]*N:
    print("Yes")
    exit()

if N % 3 == 0:
    n = N // 3
    sets = list(set(a))
    if len(sets) != 3:
        print("No")
        exit()

    for s in sets:
        if a.count(s) != n:
            print("No")
            exit()

    order = max(a).bit_length()

    for i in range(order):
        b = [sets[0] >> i & 1, sets[1] >> i & 1, sets[2] >> i & 1]
        if not equal_list(b, [0, 1, 1]):
            print("No")
            exit()

    print("Yes")

else:
    print("No")
Problem p03164 (python)

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

inf = float("inf")

max_v = 1000 * N + 1
dp = [inf for _ in range(max_v)]
dp[0] = 0
sum_v = 0

for i in range(N):
    w, v = map(int, input().split())
    for j in range(max_v, v-1, -1):
        new = dp[j-v] + w
        if new > W:
            continue
        if dp[j] > new:
            dp[j] = new

ans = 0
for sum_v in range(max_v):
    if dp[sum_v] <= W:
        ans = sum_v
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N, W = map(int, input().split())

inf = float("inf")

max_v = 1000 * N + 1
dp = [inf for _ in range(max_v)]
dp[0] = 0
sum_v = 0

for i in range(N):
    w, v = map(int, input().split())
    for j in range(max_v, v-1, -1):
        new = dp[j-v] + w
        if new > W:
            continue
        if dp[j] > new:
            dp[j] = new

ans = 0
for sum_v in range(max_v):
    if dp[sum_v] <= W:
        ans = sum_v
print(ans)
Problem p03436 (python)

Fixed submission:
from collections import deque

H, W = map(int, input().split())
matrix = [input() for _ in range(H)]
(sy, sx) = (0, 0)
(gy, gx) = (H - 1, W - 1)

dist = [[None for _ in range(W)] for _ in range(H)]

q = deque([(sy, sx)])
dist[sy][sx] = 1

count_dots = 0
for i in range(H):
    count_dots += matrix[i].count(".")

while q:
    cy, cx = q.popleft()
    if (cy, cx) == (gy, gx):
        break

    for (dy, dx) in ((0, 1), (1, 0), (0, -1), (-1, 0)):
        ny, nx = cy + dy, cx + dx

        if 0 <= nx < W and 0 <= ny < H and matrix[ny][nx] == ".":
            if dist[ny][nx] is None:
                q.append((ny, nx))
                dist[ny][nx] = dist[cy][cx] + 1

if dist[gy][gx] is None:
    print(-1)
    exit()

print(count_dots - dist[gy][gx])

Buggy submission (verdict: Runtime Error):
from collections import deque

H, W = map(int, input().split())
matrix = [input() for _ in range(H)]
(sy, sx) = (0, 0)
(gy, gx) = (H - 1, W - 1)

dist = [[None for _ in range(W)] for _ in range(H)]

q = deque([(sy, sx)])
dist[sy][sx] = 1

count_dots = 0
for i in range(H):
    count_dots += matrix[i].count(".")

while q:
    cy, cx = q.popleft()
    if (cy, cx) == (gy, gx):
        break

    for (dy, dx) in ((0, 1), (1, 0), (0, -1), (-1, 0)):
        ny, nx = cy + dy, cx + dx

        if 0 <= nx < W and 0 <= ny < H and matrix[ny][nx] == ".":
            if dist[ny][nx] is None:
                q.append((ny, nx))
                dist[ny][nx] = dist[cy][cx] + 1

print(count_dots - dist[gy][gx])
Problem p03447 (python)

Fixed submission:
X, A, B = map(int, [input() for i in range(3)])
print((X - A) % B)

Buggy submission (verdict: Runtime Error):
A, B, C, X = map(int, [input() for i in range(4)])

count = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if 500 * a + 100 * b + 50 * c == X:
                count += 1

print(count)
Problem p03448 (python)

Fixed submission:
A, B, C, X = map(int, [input() for i in range(4)])

count = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if 500 * a + 100 * b + 50 * c == X:
                count += 1

print(count)

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, [input() for i in range(4)])
X = int(input()) / 50

count = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if 10 * a + 2 * b + c == X:
                count += 1

print(count)
Problem p03469 (python)

Fixed submission:
print("2018"+input()[4:])

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
Y = Y / 1000

for i in range(N+1):
    for j in range(N-i+1):
        if 10*i + 5*j + N-i-j == Y:
            print("{} {} {}".format(i, j, N-i-j))
            exit()

print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
Y = Y / 1000

isTrue = False
for i in range(N+1):
    for j in range(N-i+1):
        for k in range(N-i-j+1):
            if 10*i + 5*j + k == Y:
                isTrue = True
                print("{} {} {}".format(i, j, k))
                break
        else:
            continue
        break
    else:
        continue
    break

if not isTrue:
    print("-1 -1 -1")
Problem p03612 (python)

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

ans = 0
flag = False
for i in range(N - 1):
    if flag:
        n = p[i+1]
    else:
        n = p[i]
    if n == i+1:
        ans += 1
        flag = True
    else:
        flag = False
if flag:
    n = p[-2]
else:
    n = p[-1]
if n == N:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
p = list(map(int, input().split()))

ans = 0
flag = False
for i in range(N):
    if flag:
        n = p[i+1]
    else:
        n = p[i]
    if n == i+1:
        ans += 1
        flag = True
    else:
        flag = False
print(ans)
Problem p03220 (python)

Fixed submission:
import sys
N = input()
TA = input()
T, A = TA.split()
Hinp = input()
H = Hinp.split()
ansnum = None
ans = 0
def getdiff(A, ans):
    return abs(max(ans, A) - min(ans, A))
def chk(A, _ans, ans):
    new_d, old_d = getdiff(A, _ans), getdiff(A, ans)
    if new_d < old_d:
        return True
    return False
for i, x in enumerate(H):
    _ans = int(T) - int(x) * 0.006
    if _ans == A:
        break
    if not ansnum or chk(int(A), _ans, ansnum):
        ans = i+1
        ansnum = _ans
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
N = input()
TA = input()
T, A = TA.split()
Hinp = input()
H = Hinp.split()
ans = None
for x in range(H):
    _ans = T - x * 0.006
    if _ans == ans:
        print(ans)
        sys.exit()
    if not ans or abs(A - _ans) < abs(A - ans):
        ans = _ans
print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
TA = input()
T, A = TA.split()
Hinp = input()
H = Hinp.split()
ans = None
for x in range(H):
    _ans = T - x * 0.006
    if _ans == ans:
        print(ans)
        return
    if not ans or abs(A - _ans) < abs(A - ans):
        ans = _ans
print(ans)
Problem p02713 (python)

Fixed submission:
import math
k = int(input())

ans = 0
for a in range(1,k+1):
  for b in range(1,k+1):
    tmp = math.gcd(a,b)
    for c in range(1,k+1):
      ans += math.gcd(c,tmp)

print(ans)

Buggy submission (verdict: Runtime Error):
import nampy as np
k = int(input())

ans = 0
for a in range(1,k+1):
  for b in range(1,k+1):
    tmp = np.gcd(a,b)
    for c in range(1,k+1):
      ans += np.gcd(tmp,c)

print(ans)
Problem p03273 (python)

Fixed submission:
h,w = [int(_) for _ in input().split()]
board = [ list(input())  for _ in range(h)]

goodx = [False] * h
goody = [False] * w

for i in range(h):
  for j in range(w):
#    print("i={}\tj={}\tboard={}".format(i,j,board[i][j]))
    if board[i][j] == '#':
      goodx[i] = True
      goody[j] = True

for i in range(h):
  if goodx[i]:
    for j in range(w):
      if goody[j]:
        print(board[i][j], end='')
    print("")

Buggy submission (verdict: Runtime Error):
h,w = [int(_) for _ in input().split()]
board = [ list(input())  for _ in range(h)]

goodx = [False] * w
goody = [False] * h

for i in range(w):
  for j in range(h):
    if board[i][j] == '#':
      goodx[i] = True
      goody[j] = True

for i in range(w):
  if goodx[i]:
    for j in range(h):
      if goody[j]:
        print(board[i][j], end='')
    print("")

Buggy submission (verdict: Runtime Error):
h,w = [int(_) for _ in input().split()]
board = [ list(input())  for _ in range(h)]

goodx = [False] * w
goody = [False] * h

for i in range(w):
  for j in range(h):
    print("i ={}, j ={}".format(i,j))
    if board[i][j] == '#':
      goodx[i] = True
      goody[j] = True

for i in range(w):
  if goodx[i]:
    for j in range(h):
      if goody[j]:
        print(board[i][j], end='')
    print("")
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())

for i in range(k):
  if s[i] != "1":
    print(s[i])
    exit()
print("1")

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())

if s[0] != "1":
  print(s[0])
elif s[1] != "1":
  print(s[1])
elif s[2] != "1":
  print(s[2])
elif s[3] != "1":
  print(s[3])
Problem p03293 (python)

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

if S == T:
  print("Yes")
  exit()

for i in range(len(S)):
  S = S[-1]+S[:-1]
  if S == T:
    print("Yes")
    exit()

print("No")

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

if S == T:
  print("Yes")
  exit()

nibun = int(len(S)/2)

startline = 0
while nibun > 1:
  if not S[0:nibun] in T:
    startline = ninbun
  nibun = int(nibun / 2)

for i in range(startline, len(S)):
  if not S[0:i] in T:
      sep = i
      break

try:
  sep
except NameError:
  print("No")
  exit()

if S[sep:len(S)] in T[0:len(S)-4+1]:
  print("Yes")
else:
  print("No")
Problem p02657 (python)

Fixed submission:
x, y = input().split()
print(int(x)*int(y))

Buggy submission (verdict: Runtime Error):
print(int(input())*int(input()))

Buggy submission (verdict: Runtime Error):
print(int(input())*int(input()))
Problem p02934 (python)

Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]
ans = 1/sum(1/x for x in a)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(x) for x in input()]
ans = 1/sum(1/x for x in a)
print(ans)
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())

n = -1
for i, ki in enumerate(s):
  if ki!='1':
    n = i+1
    break
    
if n<0 or k<n:
  print(1)
else:
  print(s[n-1])

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())

n = -1
for i, ki = enumerate(s):
  if ki!='1':
	n = i+1
    break
    
if n<0 or k<n:
  print(1)
else:
  print(s[n-1])
Problem p02717 (python)

Fixed submission:
x, y ,z = map(int,input().split())
 
print(z, x, y)

Buggy submission (verdict: Runtime Error):
k = int(input())
i = 1 #数回す用
c = 0 #ルンルン数カウント

if k > 13000:
    i = 34454557
    c = 13000

while c < k:
  j = str(i)
  if i < 13: #13未満なら
    c = c + 1 #ルンルン数
    #print(c, i)
  else: #それ以外なら
    x = 0
    for n in range(len(j)-1): #ルンルン数判定を行う
      if abs(int(j[n]) - int(j[n+1])) > 1:#桁の差が1より大きかったら
        x = 1
        break
    if x == 0:
      c = c + 1
      #print(c, i)
  i = i + 1 #iに1を足す

print(i-1)
Problem p02730 (python)

Fixed submission:
s = input()
n = len(s)
ans=""
 
half = s[:int((n-1)/2)]
 
if s==s[::-1] and half==half[::-1]:
	ans = "Yes"
else:
	ans = "No"
  
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
n = s.size()
ans=""
 
half = s[0:(n-1)/2]
 
if s==s[::-1] and half==half[::-1]:
	ans = "Yes"
else:
	ans = "No"
  
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
n = s.size()
ans=""
 
half = s[0:(n-1)/2]
 
if(s==s[::-1] && half==half[::-1]){
	ans = "Yes";
}
else
	ans = "No";
  
print(ans)
}
Problem p02756 (python)

Fixed submission:
ans = input()
q = int(input())
top = 0
first = str()
last = str()

for i in range(q):
    li =input().split()
    if li[0] =="1":
        top = (top+1)%2
    else:
        if li[1] == "1":
            if top ==0:
                first += li[2]
            else:
                last += li[2]
        else:
            if top ==1:
                first += li[2]
            else:
                last += li[2]

if top == 0:
    ans = first[::-1] + ans + last
else:
    ans = last[::-1] + ans[::-1] + first

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

def main():
    ans = list(input().rstrip())
    n = int(input())
    li = [input().split() for i in range(n)]
    a = 0 #先頭がどっちかという情報

    for x in li:
        if x[0] == "1": #反転クエリ
            a = (a+1)%2
        else: #追加クエリ
            if (x[1] == "1" and a == 0) or (x[1] == "2" and a == 1):
                ans = x[2] + ans
            else:
                ans += x[2]

    if a == 0: #先頭が前なら
        print(ans)
    else: #先頭が後なら
        print(ans[::-1])

if __name__ == '__main__':
    main()
Problem p02760 (python)

Fixed submission:
a=[]
for i in range(3):
  a.append(list(map(int,input().split())))
n = int(input())
x = 0

for i in range(n):
  b = int(input())
  for j in range(3):
    for k in range(3):
      if a[j][k] == b:
        a[j][k] = 0

if (a[0][0] == 0 and a[2][2] == 0 and a[1][1] == 0) or (a[0][2] == 0 and a[2][0] == 0 and a[1][1] == 0): #斜めに揃っていたら
  print("Yes")
  x = 1
for i in range(3):
  if a[i][0] == 0 and a[i][1] == 0 and a[i][2] == 0 and x == 0: #横に揃っていたら
    print("Yes")
    x = 1
    break
  elif a[0][i] == 0 and a[1][i] == 0 and a[2][i] == 0 and x == 0: #縦に揃っていたら
    print("Yes")
    x = 1
    break
if x == 0:
  print("No")

Buggy submission (verdict: Runtime Error):
a=[]
for i in range(3):
  a.append(list(map(int,input().split())))
n = int(input())
x = 0

for i in range(n):
  b = int(input())
  for j in range(3):
    for k in range(3):
      if a[j][k] == b:
        a[j][k] = 0

print(a)

if (a[0][0] == 0 and a[2][2] == 0 and a[1][1] == 0) or (a[0][2] == 0 and a[2][0] == 0 and a[1][1] == 0): #斜めに揃っていたら
  print("Yes")
  x = 1
for i in range(3):
  if a[i][0] == 0 and a[i][1] == 0 and a[i][2] and x == 0: #横に揃っていたら
    print("Yes")
    x = 1
    break
  elif a[0][i] == 0 and a[1][i] == 0 and a[2][i] and x == 0: #縦に揃っていたら
    print("Yes")
    x = 1
    break
if x == 0:
  print("No")a=[]
for i in range(3):
  a.append(list(map(int,input().split())))
n = int(input())
x = 0

for i in range(n):
  b = int(input())
  for j in range(3):
    for k in range(3):
      if a[j][k] == b:
        a[j][k] = 0

if (a[0][0] == 0 and a[2][2] == 0 and a[1][1] == 0) or (a[0][2] == 0 and a[2][0] == 0 and a[1][1] == 0): #斜めに揃っていたら
  print("Yes")
  x = 1
for i in range(3):
  if a[i][0] == 0 and a[i][1] == 0 and a[i][2] and x == 0: #横に揃っていたら
    print("Yes")
    x = 1
    break
  elif a[0][i] == 0 and a[1][i] == 0 and a[2][i] and x == 0: #縦に揃っていたら
    print("Yes")
    x = 1
    break
if x == 0:
  print("No")

Buggy submission (verdict: Runtime Error):
import itertools

A=[]
for i in range(3):
    try:
        A.append(list(map(int,input().split())))
    except:
        break;
A = list(itertools.chain.from_iterable(A))
n = int(input())
b=[int(input()) for i in range(n)]

for i in b:
    if i in A:
        
#print(A)
#print(b)
Problem p02818 (python)

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

if a >= k:
    a = a - k
else:
    b = b - k + a
    a = 0
    if b < 0:
        b = 0

print(a, b)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int,input().split())

for i in range k:
  if a > 0:
    a = a - 1
  elif b > 0
  	b = b - 1

print(a, b)
Problem p02923 (python)

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
x = []
y = 0

if n == 1:
    print(0)

else:
    for i in range(n-1):
        if h[i] < h[i+1]:
            y = 0
        else:
            y = y + 1
        x.append(y)
 
    print(max(x))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
x = []
y = 0

for i in range(n-1):
    if h[i] < h[i+1]:
        y = 0
    else:
        y = y + 1
    x.append(y)
 
print(max(x))
Problem p02971 (python)

Fixed submission:
import heapq

n = int(input())
a = [int(input()) for i in range(n)]
b = heapq.nlargest(2, set(a))
c = a.count(b[0])

if len(b) == 1 or c > 1: #bの長さが1または、最大値が2回以上存在するなら
    for i in range(n):
        print(b[0]) #最大値のみを表示

else: #bの長さが2以上なら
    for i in range(n):
        if a[i] == b[0]: #i番目が最大値だったら
            print(b[1]) #2番目に大きい値を出力
        else: #そうでなければ
            print(b[0]) #最大値を出力

Buggy submission (verdict: Runtime Error):
import heapq

n = int(input())
a = [int(input()) for i in range(n)]
b = heapq.nlargest(2, set(a))
c = [i for i, x in enumerate(a) if x == b[0]] #最大値の位置

for i in range(n):
    if a[i] == b[0]: #最大値だったら
        print(b[1]) #最大値から2番目を出力
    else: #そうでなければ
        print(b[0]) #最大値を出力

Buggy submission (verdict: Runtime Error):
import heapq

n = int(input())
a = [int(input()) for i in range(n)]
b = heapq.nlargest(2, set(a))
c = [i for i, x in enumerate(a) if x == b[0]] #最大値の位置

for i in range(n):
    if i in c: #最大値だったら
        print(b[1]) #最大値から2番目を出力
    else: #そうでなければ
        print(b[0]) #最大値を出力
Problem p02994 (python)

Fixed submission:
n, l = map(int,input().split())
m = list(range(l, l+n))

if 0 in m:
  print(sum(m))
  
else:
  if m[0] < 0:
    print(sum(m)-max(m))
  else:
    print(sum(m)-min(m))

Buggy submission (verdict: Runtime Error):
n, l = map(int,input().split())
m = list(range(l, n))

if 0 in m:
  print(sum(m))
  
else:
  if m[0] < 0:
    print(sum(m)-max(m))
  else:
    print(sum(m)-min(m))
Problem p03035 (python)

Fixed submission:
a, b = map(int,input().split())
 
if a > 12:
  print(b)
elif a > 5:
  print(int(b/2))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a, b = map(int,input().split())

if b > 12:
  print(b)
elif: b > 5:
  print(int(b/2))
else:
  print(0)
Problem p03076 (python)

Fixed submission:
n = [int(input()) for i in range(5)]
m = 10
x = n[0]
#1の位が最も小さいものはそのまま足す・残りは1の位を切り上げて足す

for i in n:
  if int(str(i)[-1]) < m and int(str(i)[-1]) > 0:
    m = int(str(i)[-1])
    x = i



n.remove(x)
    
for i in range(len(n)):
  if n[i]%10 != 0:
    n[i] = n[i] + 10 - int(str(n[i])[-1])

print(sum(n) + x)

Buggy submission (verdict: Runtime Error):
n = [int(input()) for i in range(5)]
m = 10
#1の位が最も小さいものはそのまま足す・残りは1の位を切り上げて足す

for i in n:
  if int(str(i)[-1]) < m and int(str(i)[-1]) > 0:
    m = int(str(i)[-1])
    x = i

n.remove(x)
    
for i in range(len(n)):
  if n[i]%10 != 0:
    n[i] = n[i] + 10 - int(str(n[i])[-1])

print(sum(n) + x)

Buggy submission (verdict: Runtime Error):
n = [int(input()) for i in range(5)]
m = 9
#1の位が最も小さいものはそのまま足す・残りは1の位を切り上げて足す

for i in n:
  if int(str(i)[-1]) < m and int(str(i)[-1]) > 0:
    m = int(str(i)[-1])
    x = i

n.remove(x)
    
for i in range(len(n)):
  if n[i]%10 != 0:
    n[i] = n[i] + 10 - int(str(n[i])[-1])

print(sum(n) + x)

Buggy submission (verdict: Runtime Error):
n = [int(input()) for i in range(5)]
m = 9
#1の位が最も小さいものはそのまま足す・残りは1の位を切り上げて足す

for i in n:
  if int(str(i)[-1]) < m:
    m = int(str(i)[-1])
    x = i

n.remove(x)
    
for i in range(len(n)):
  if n[i]%10 != 0:
    n[i] = n[i] + 10 - int(str(n[i])[-1])

print(sum(n) + x)
Problem p03106 (python)

Fixed submission:
a, b, k = map(int,input().split())
 
def cf(x1,x2):
    cf=[]
    for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

ans = cf(a,b)
ans.sort(reverse=True)

print(ans[k-1])

Buggy submission (verdict: Runtime Error):
a, b, k = map(int,input().split())

def cf(x1,x2):
    cf=[]
    for i in range(2,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

ans = cf(a,b)
ans.sort(reverse=True)

print(ans[k-1])
Problem p03125 (python)

Fixed submission:
a, b = map(int,input().split())
  
if b%a == 0:
  print(a+b)
else:
  print(b-a)

Buggy submission (verdict: Runtime Error):
x, y = map(int,input().split()))
  
if b%a == 0:
  print(a+b)
else:
  print(b-a)
Problem p03150 (python)

Fixed submission:
s = input()
n = len(s)
w = "keyence"
 
for i in range(7):
    if s[:i] == w[:i] and s[n-7+i:] == w[i:]:
        print("YES")
        exit()

print("NO")

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
w = "keyence"

for i in range(7):
    if S[:i] == w[:i] and s[n-7+i:] == w[i:]:
        print("YES")
        exit()

print("NO")

Buggy submission (verdict: Runtime Error):
s = list(input())
ans = list("keyence")
x = 0

for c in s:
    if c == ans[x]:
        x += 1

if x >= 6:
    print("YES")
else:
    print("NO")
Problem p03200 (python)

Fixed submission:
s = list(input())
n = len(s)
ans = 0
count = 0

for i in range(n):
    if s[i] == "W":
        ans += i
        count += 1

print(ans-count*(count-1)//2)

Buggy submission (verdict: Runtime Error):
s = input()

def fact(n):
    if n > 1:
        return n * fact(n-1)
    else:
        return 1

print(fact(s.count("B")))
Problem p03210 (python)

Fixed submission:
x = int(input())
 
if x == 7 or x == 5 or x == 3:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
x = int(imput())

if x == 7 or x == 5 or x == 3:
  print("YES")
else:
  print("NO")
Problem p03239 (python)

Fixed submission:
n, t = map(int,input().split())
ans = []

for i in range(n):
  c, x = map(int,input().split())
  if x <= t:
    ans.append(c)

if len(ans) == 0:
    print("TLE")
else:
    ans.sort()
    print(ans[0])

Buggy submission (verdict: Runtime Error):
n, t = map(int,input().split())
ans = []

for i in range(n):
  c, x = map(int,input().split())
  if x <= t:
    ans.append(c)
    
ans.sort()
print(ans[0])