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

Fixed submission:
from bisect import bisect_right

sum_list = []
nm = 1
sm = 1
while sm <= 10**8:
    sum_list.append(sm)
    nm += 1
    sm += nm
    
n = int(input())

k = bisect_right(sum_list, n)

ans_set = set([i for i in range(1,k+2)])
ans_set.remove(sum_list[k] - n)
ans = list(ans_set)

for a in ans:
    print(a)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_right

sum_list = []
nm = 1
sm = 1
while sm <= 10**7:
    sum_list.append(sm)
    nm += 1
    sm += nm
    
n = int(input())

k = bisect_right(sum_list, n)

ans_set = set([i for i in range(1,k+2)])
ans_set.remove(sum_list[k] - n)
ans = list(ans_set)

for a in ans:
    print(a)
Problem p03952 (python)

Fixed submission:
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

n,x = li()

if n == 2 and x == 2:
    print("Yes")
    for i in range(1,4):
        print(i)
        
elif (n == 2 and x == 1) or (n == 2 and x == 3):
    print("No")

elif x == 1 or x == 2*n-1:
    print("No")

elif x == 2:
    ans = [i for i in range(1,x-1)] + [i for i in range(x+3, 2*n)]
    ans = ans[:n-2] + [x+2, x, x-1, x+1] + ans[n-2:]
    
    print("Yes")
    for ai in ans:
        print(ai)
    
else:
    ans = [i for i in range(1,x-2)] + [i for i in range(x+2, 2*n)]
    ans = ans[:n-2] + [x-1, x, x+1, x-2] + ans[n-2:]
    
    print("Yes")
    for ai in ans:
        print(ai)

Buggy submission (verdict: Runtime Error):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**7) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

N, x = li()

if x == 1 or x == 2*N-1:
    print('No')
    
else:
    ans = [0]*(2*N-1)
    ans[N-1] = x
    
    if x == 2:
        ans[N-2] = x+2
        ans[N] = x-1
        ans[N+1] = x+1
        used = [x-1,x,x+1,x+2]
        
    else:
        ans[N-2] = x-1
        ans[N] = x+1
        ans[N+1] = x-2
        used = [x-2,x-1,x,x+1]
    
    rem = []
    for i in range(1,2*N):
        if i in used:
            continue
        else:
            rem.append(i)
            
    rem = rem[::-1]
    
    for i in range(2*N-1):
        if N-2 <= i <= N+1:
            continue
        
        else:
            ans[i] = rem.pop()
            
    print('Yes')
    for ai in ans:
        print(ai)
Problem p03994 (python)

Fixed submission:
# 入力
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

# ここから処理
s = ns()
k = ni()

chl = list(s)
res = k

for i, c in enumerate(chl):
    if c == "a":
        continue
    
    elif res >= ord("z") - ord(c) + 1:
        chl[i] = "a"
        res -= (ord("z") - ord(c) + 1)

chl[-1] = chr(ord(chl[-1]) + res%26)

print("".join(chl))

Buggy submission (verdict: Runtime Error):
# 入力
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

# ここから処理
s = ns()
k = ni()

chl = list(s)
res = k

for i, c in enumerate(chl):
    if res >= ord("z") - ord(c) + 1:
        chl[i] = "a"
        res -= (ord("z") - ord(c) + 1)

chl[-1] = chr(ord(chl[-1]) + res)

print("".join(chl))
Problem p04013 (python)

Fixed submission:
import collections

N,A = map(int, input().split())
X = list(map(int,input().split()))

for i in range(N):
    X[i] -= A

sums = collections.Counter([0,X[0]])

for i in X[1:]:
    c = collections.Counter()
    for p,q in sums.items():
        c[i+p] = q
    sums += c

print(sums[0]-1)

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

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n, a = li()
x = list(li())

dp = [[[0]*(n*max(x)+1) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1

for i in range(1, n+1):
    for j in range(n+1):
        for k in range(n*max(x) + 1):
            dp[i][j][k] += (dp[i-1][j-1][k-x[i-1]] if (j-1 >= 0 and k-x[i-1] >= 0) else 0)\
                            + dp[i-1][j][k]

ans = 0
for i in range(1,n+1):
    ans += dp[n][i][a*i]

print(ans)
Problem p03266 (python)

Fixed submission:
n, k = map(int, raw_input().split())
if k % 2 == 1:
    print((n / k) ** 3)
else:
    print((n / k) ** 3 + ((n + k / 2) / k) ** 3)

Buggy submission (verdict: Runtime Error):
n, k = map(int, raw_input().split())
if k % 2 == 1:
    print((n / k) ** 3)
else:
    print((n / k) ** 3 + ((n + k / 2) / k) ** 3)
Problem p03035 (python)

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

if a >= 13:
  print(b)
elif 6 <= a <= 12:
  print(int(b/2))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l, r = list(map(int, [input().split() for i in range(m)]))

max_l = max(l)
min_r = min(r)
print(max(min_r - max_l, 0))
Problem p03316 (python)

Fixed submission:
n = int(input())
s = sum(map(int, list(str(n))))

if n % s == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = sum(map(int, list(str(n)))

if n % s == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = sum(map(int,(list(str(n))))

if n % s == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = sum(int(list(str(n))))

if n % s == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = sum(list(n))

if n % s == 0:
  print("Yes")
else:
  print("No")

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

if n % sum(s) == 0:
  print("Yes")
else:
  print("No")

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

if n % sum(s):
  print("Yes")
else:
  print("No")
Problem p03323 (python)

Fixed submission:
a, b = map(int, input().split())
if a <= 8 and b <= 8:
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a <= 8 and b <= 8:
  print("Yay!")
elif:
  print(":(")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a <= 8 or b <= 8:
  print("Yay!")
elif:
  print(":(")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a > 8 or b > 8:
  print(":(")
elif:
  print("Yay!")

Buggy submission (verdict: Runtime Error):
a, b = int(input().split())
if a > 8 or b > 8:
  print(":(")
elif:
  print("Yay!")
Problem p03325 (python)

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

count = 0
for i in a:
  count += len(bin(i)) - bin(i).rfind("1") - 1

print(count)

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

for i in a:
  count += bin(i).rfind("1") - 1

print(count)

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

for i in a:
  count += bin(i).rfind("1") - 1

  print(count)

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

count = 0
for i in range(n+1):
  b = a[i].rfind(1) - 1
  count += b

print(count)
Problem p02582 (python)

Fixed submission:
r = input()
if r == 'RRR':
    print(3)
elif r == 'RRS' or r == 'SRR':
    print(2)
elif r == 'RSR' or r == 'RSS' or r =='SSR' or r =='SRS':
    print(1)
elif r == 'SSS':
    print(0)

Buggy submission (verdict: Runtime Error):
r = input()
if r == 'RRR':
    print(3)
elif r == 'RRS' or r == 'SRR':
    print(2)
elif r == 'RSR' or r == 'RSS' or r =='SSR' or r =='SRS':
    print(1)
else rainy_days == 'SSS':
    print(0)

Buggy submission (verdict: Runtime Error):
rainy_days = input()
if rainy_days == 'RRR':
    print(3)
elif rainy_days == 'RRS' or 'SRR':
    print(2)
elif rainy_days == 'RSR' or 'RSS' or 'SSR' or 'SRS':
    print(1)
else rainy_days == 'SSS':
    print(0)

Buggy submission (verdict: Runtime Error):
rainy_days = input()
if rainy_days = 'RRR':
    print(3)
elif rainy_days == 'RRS' or 'SRR':
    print(2)
elif rainy_days == 'RSR' or 'RSS' or 'SSR' or 'SRS':
    print(1)
else rainy_days == 'SSS':
    print(0)

Buggy submission (verdict: Runtime Error):
rainy_days = input()
if rainy_days = 'RRR':
    print(3)
elif rainy_days == 'RRS' or 'SRR':
    print(2)
elif rainy_days == 'RSR' or 'RSS' or 'SSR' or 'SRS':
    print(1)
elif rainy_days == 'SSS':
    print(0)

Buggy submission (verdict: Runtime Error):
rainy_days = input()
if rainy_days = RRR:
    print(3)
elif rainy_days == RRS or SRR:
    print(2)
elif rainy_days == RSR or RSS or SSR or SRS:
    print(1)
elif rainy_days == SSS:
    print(0)

Buggy submission (verdict: Runtime Error):
rainy_days = input('3日間で連続した雨の日は？:')
if rainy_days = RRR:
    print(3)
elif rainy_days == RRS or SRR:
    print(2)
elif rainy_days == RSR or RSS or SSR or SRS:
    print(1)
elif rainy_days == SSS:
    print(0)

Buggy submission (verdict: Runtime Error):
rainy_days = input('3日間で連続した雨の日は？:')
if rainy_days = rrr:
    print(3)
elif rainy_days == rrs or srr:
    print(2)
elif rainy_days == rsr or rss or ssr or srs:
    print(1)
elif rainy_days == sss:
    print(0)
Problem p02612 (python)

Fixed submission:
money = int(input())
while money > 1000 :
    money -= 1000
print(1000 - money)

Buggy submission (verdict: Runtime Error):
money = int(input())
while money > 1000
    money -= 1000
print(1000 - money)
Problem p03161 (python)

Fixed submission:
# atcoder Educational DP contest/DP まとめコンテスト
# B-Frog2

def get_inputs():
    [n, k] = [int(x) for x in input().split()]
    h = list(map(int, input().split()))
    
    return n, k, h


if __name__ == "__main__":
    # 入力を受け取る
    # n 足場の数 2<= N <= 10**5
    # k k本先の足場まで飛ぶことができる 1<=K<=100
    # h 足場の高さ 配列
    n, k, h = get_inputs()
    
    ########## first try
    # for文の二重ループではTLEになってしまう
    # dp = [10000000000] * (n + k)        # k個分を含む配列を用意し最大値で初期化する
    # h= h + [100000] * k
    # dp[0] = 0                             # 0番目の足場はコスト0
    # 足場iからj個先まで行く場合の最小コストを求める
    # for i in range(0, n - 1):
    #    for j in range(1, k + 1):
    #        dp[i + j] = min(dp[i] + abs(h[i + j] - h[i]), dp[i + j])
    # print(dp[n-1])
    
    ########## second try
    # 前案より速度は改善したが、まだ一部の問題でTLEになる
    # dp = [10**9] * n
    # dp[0] = 0
    #
    # for i in range(1, n):
    #     mc = 10**9
    #     for j in range(max(0, i - k), i):
    #         mc = min(mc, dp[j] + abs(h[i] - h[j]))
    #    dp[i] = mc
    # print(dp[n-1])
    
    ########## third try
    # 二重ループを内包表記表現に変更
    # zipを使うのがミソ
    
    dp = [10**9] * n
    dp[0] = 0
    for i in range(1, n):
        j = max(0, i - k)
        dp[i] = min([dd + abs(h[i] - hh) for (dd, hh) in zip(dp[j:i], h[j:i])])
    print(dp[n-1])

Buggy submission (verdict: Runtime Error):
# atcoder Educational DP contest/DP まとめコンテスト
# B-Frog2

def get_inputs():
    [n, k] = [int(x) for x in input().split()]
    h = list(map(int, input().split()))
    
    return n, k, h


if __name__ == "__main__":
    # 入力を受け取る
    # n 足場の数 2<= N <= 10**5
    # k k本先の足場まで飛ぶことができる 1<=K<=100
    # h 足場の高さ 配列
    n, k, h = get_inputs()
    
    # dp[i]はi番目(0<=i<n)の足場に到達するまでに必要な最小コスト
        
    dp = [10000000000] * (n + 100)        # k個分を含む配列を用意し最大値で初期化する
    dp[0] = 0                             # 0番目の足場はコスト0
    
    # 足場iからj個先まで行く場合の最小コストを求める
    for i in range(0, n - 1):
        for j in range(1, k + 1):
            dp[i + j] = min(dp[i] + abs(h[i + j] - h[i]), dp[i + j])
    
    print(dp[n-1])
Problem p03175 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)
 
BLK = 1
WHT = 0
MOD = 10 ** 9 + 7
 
 
def calcdp(r, p, bw):
    if dp[r][bw] != -1:
        return dp[r][bw]
 
    if p == 0:
        cs = H[r]
    else:
        cs = H[r] - {p}
 
    if len(cs) == 0:
        dp[r][bw] = 1
        return 1
    else:
        if bw == BLK:
            res = 1
            for c in cs:
                res = (res * calcdp(c, r, WHT)) % MOD
            dp[r][BLK] = res
            return res
        else:
            res = 1
            for c in cs:
                res = (res * (calcdp(c, r, WHT) + calcdp(c, r, BLK))) % MOD
            dp[r][WHT] = res
 
            return res
 
 
N = int(input())
H = [set() for _ in range(N + 1)]
for _ in range(1, N):
    x, y = map(int, input().split())
    H[x].add(y)
    H[y].add(x)
 
dp = [[-1] * 2 for _ in range(N + 1)]
 
print((calcdp(1, 0, BLK) + calcdp(1, 0, WHT)) % MOD)

Buggy submission (verdict: Runtime Error):
BLK = 1
WHT = 0
MOD = 10 ** 9 + 7


def calcdp(r, p, bw):
    if dp[r][bw] != -1:
        return dp[r][bw]

    if p == 0:
        cs = H[r]
    else:
        cs = H[r] - {p}

    if len(cs) == 0:
        dp[r][bw] = 1
        return 1
    else:
        if bw == BLK:
            res = 1
            for c in cs:
                res = (res * calcdp(c, r, WHT)) % MOD
            dp[r][BLK] = res
            return res
        else:
            res = 1
            for c in cs:
                res = (res * (calcdp(c, r, WHT) + calcdp(c, r, BLK))) % MOD
            dp[r][WHT] = res

            return res


N = int(input())
H = [set() for _ in range(N + 1)]
for _ in range(1, N):
    x, y = map(int, input().split())
    H[x].add(y)
    H[y].add(x)

dp = [[-1] * 2 for _ in range(N + 1)]

print((calcdp(1, 0, BLK) + calcdp(1, 0, WHT)) % MOD)
Problem p03337 (python)

Fixed submission:
A, B = map(int, input().split())
print(max(A + B, A - B, A * B))

Buggy submission (verdict: Runtime Error):
a、b=map(int, input(),split())
x =a+b
y =a-b
z =a*b
print(max(x,y,z))
Problem p03478 (python)

Fixed submission:
# -*- coding: utf-8 -*-
strList = list(map(int, input().split()))

N = strList[0]
A = strList[1]
B = strList[2]

outValue = 0
for n in range(N+1):
    strList = [int(c) for c in str(n)]
    if A <= sum(strList) <= B:
        outValue += n

print(outValue)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N = int(input())
A = int(input())
B = int(input())

outValue = 0
for n in range(N+1):
    #inputList = [int(c) for c in str(n)]
    #if A <= sum(inputList) <= B:
    #    outValue += n

print(outValue)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N = int(input())
A = int(input())
B = int(input())

outValue = 0
for n in range(N+1):
    inputList = [int(c) for c in str(n)]
    #if A <= sum(inputList) <= B:
    #    outValue += n

print(outValue)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N = int(input())
A = int(input())
B = int(input())

outValue = 0
for n in range(N+1):
    inputList = [int(c) for c in str(n)]
    if A <= sum(inputList) and sum(inputList) <= B:
        outValue += n

print(outValue)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N = int(input())
A = int(input())
B = int(input())

outValue = 0
for n in range(N+1):
    inputList = []
    for c in str(n):
        inputList.append(int(c))

    if A <= sum(inputList) <= B:
        outValue += n

print(outValue)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N = int(input())
A = int(input())
B = int(input())

outValue = 0
for n in range(N+1):
    inputList = [int(c) for c in str(n)]
    if A <= sum(inputList) <= B:
        outValue += n

print(outValue)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N = int(input())
A = int(input())
B = int(input())

outValue = 0
for n in range(N+1):
    inputList = [int(c) for c in str(n)]
    if A <= sum(inputList) <= B:
        outValue += n

print(outValue)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N = int(input())
A = int(input())
B = int(input())

outValue = 0
for n in range(N+1):
    inputList = [int(c) for c in str(n)]
    if A <= sum(inputList) <= B:
        outValue += n

print(outValue)
Problem p02583 (python)

Fixed submission:
n = int(input())
L = list(map(int,input().split()))
L.sort()
ans = 0
for i in range(n):
  for j in range(i+1, n):
    for k in range(j+1, n):
      if L[i] < L[j] < L[k] and L[i] + L[j] > L[k] :
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
L = list(map(int,input().split()))
L.sort()
ans = 0
for i in range(n):
  for j in range(i+1, n):
    for k in range(j+1, n):
      if i < l < k and L[i] + L[j] > L[k] :
        ans += 1
print(ans)
Problem p02613 (python)

Fixed submission:
n = int(input())
A = [input() for _ in range(n)]

print("AC x " + str(A.count("AC")))
print("WA x " + str(A.count("WA")))
print("TLE x " + str(A.count("TLE")))
print("RE x " + str(A.count("RE")))

Buggy submission (verdict: Runtime Error):
n = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for _ in range(n):
  a = input()
  if a = "AC":
    AC += 1
  elif a = "WA":
    WA += 1
  elif a = "TLE":
    TLE += 1
  else:
    RE += 1
  
print("AC x "+ AC)
print("WA x "+ WA)
print("TLE x "+ TLE)
print("RE x "+ RE)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = [input().split() for _ in range(n)]
print("AC x "+ A.count("AC"))
print("WA x "+ A.count("WA"))
print("TLE x "+ A.count("TLE"))
print("RE x "+ A.count("RE"))

Buggy submission (verdict: Runtime Error):
n = int(input())
A = [input() for _ in range(n)]
print("AC x "+ A.count("AC"))
print("WA x "+ A.count("WA"))
print("TLE x "+ A.count("TLE"))
print("RE x "+ A.count("RE"))
Problem p02783 (python)

Fixed submission:
import math
a,b = [int(x) for x in input().split()]

print(math.ceil(a/b))

Buggy submission (verdict: Runtime Error):
h,n = [int(x) for x in input().split()]

# dp[i] = min magic points to decrease i health points
maxmax = 99999999
dp = [maxmax for x in range(h+1)]
dp[0] = 0
for x in range(n):
    a,b = [int(r) for r in input().split()]
    
    for j in range(h):
        dp[min(j+a, h)] = min(dp[min(j+a, h)], dp[j]+b)

print(dp[h])
Problem p02606 (python)

Fixed submission:
L, R, d = map(int, input().split())

a = 1
cnt = 0
while 1:
    s = d*a
    if (L<=s)and(R>=s):
        cnt += 1
    elif R<s:
        break
    a += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
 
ans=[0]*(n+1)
 
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            f= x**2 + y**2 + z**2 + x*y + y*z + z*x
            if f<=n:
                ans[f]+=1
 
for i in range(1,n+1):
    print(ans[i])
Problem p02664 (python)

Fixed submission:
T = input()

T = T.replace('?', 'D')
	
print(''.join(T))

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

s = T.count('?')

for i in range(s):
    a = T.index('?')
    if a == 0:
        if T[a+1] == 'D':
            T[a] = 'P'
        else:
            T[a] = 'D'
    else:
        T[a] = 'D'
print(''.join(T))

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

s = T.count('?')

for i in range(s):
    a = T.index('?')
    if a == 0:
        if T[T.index('?')+1] == 'D':
            T[a] = 'P'
        else:
            T[a] = 'D'
    else:
        T[a] = 'D'
print(''.join(T))

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

s = T.count('?')

for i in range(s):
    a = T[T.index('?')]
    if a == 0:
        if T[T.index('?')+1] == 'D':
            T[T.index('?')] = 'P'
        else:
            T[T.index('?')] = 'D'
    elif a == len(T):
         T[T.index('?')] = 'D'
    else:
        if T[T.index('?')-1] == 'P':
            T[T.index('?')] = 'D'
        elif T[T.index('?')+1] == 'P':
            T[T.index('?')] = 'D'
        else:
            T[T.index('?')] = 'P'
print(''.join(T))
Problem p02719 (python)

Fixed submission:
N, K = map(int, input().split())
c = 0
a = []

while 1:
    if K==1:
        print(0)
        break
    if N==0:
        print(0)
        break
    if N==1:
        print(1)
        break
    
    for i in range(2):
        if i==0:
            N = N-((N//K)*K)
        N = abs(N-K)
        a.append(N)
    b = min(a)
    print(b)  
    break

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
c = 0
a = []

while 1:
    if (N%2==0)and(K%2==0)and(N>=K):
        print(0)
        break
    if K==1:
        print(0)
        break
    if N==0:
        print(0)
        break
    if N==1:
        print(1)
        break
    
    for i in range(2):
        if i==0:
            N = N-((N//K)*K)
        N = abs(N-K)
        a.append(N)
    b = min(a)
        
    break
print(b)
Problem p02741 (python)

Fixed submission:
K = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(a[K-1])

Buggy submission (verdict: Runtime Error):
K = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[K+1])
Problem p02767 (python)

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
total = 0
p = []
for i in range(min(X),max(X)+1):
    for j in X:
        total += (i-j)**2
    p.append(total)
    total = 0

print(min(p))

Buggy submission (verdict: Runtime Error):
N = int(input())
X = list(map(int, input().split()))
total = 0
p = []
for i in range(min(X),max(X)):
    for j in X:
        total += (i-j)**2
    p.append(total)
    total =0

print(min(p))
Problem p03262 (python)

Fixed submission:
import fractions
from functools import reduce

N, X = map(int, input().split())
a = list(map(int, input().split()))
y = []

def gcd_list(num):
    return reduce(fractions.gcd, num)

for i in a:
    y.append(abs(X-i))

print(gcd_list(y))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

N, X = map(int, input().split())
a = list(map(int, input().split()))
y = []

def gcd_list(num):
    return reduce(math.gcd, num)

for i in a:
    y.append(abs(X-i))

print(gcd_list(y))

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
x = list(map(int, input().split()))
y = []
import math
from functools import reduce
def gcd_list(num):
    return reduce(math.gcd, num)

for i in x:
    y.append(abs(X-i))

print(gcd_list(y))

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
x = list(map(int, input().split()))
y = []
import math
from functools import reduce
def gcd_list(num):
    return reduce(math.gcd, num)

for i in x:
    y.append(abs(X-i))

print(gcd_list(y))
Problem p03543 (python)

Fixed submission:
N = input()

if (N[0]==N[1])and(N[1]==N[2]):
    print('Yes')
elif (N[1]==N[2])and(N[2]==N[3]):
    print('Yes')
else:
    print('No')

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

if (N[0]==N[1])and(N[1]==N[2):
    print('Yes')
elif (N[1]==N[2])and(N[2]==N[3):
    print('Yes')
else:
    print('No')