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

Fixed submission:
x, y = input().split()
if x < y:
    print("<")
elif x > y:
    print(">")
else:
    print("=")

Buggy submission (verdict: Runtime Error):
x, y = int(input())
if x < y:
    print("<")
elif x > y:
    print(">")
else:
    print("=")
Problem p03609 (python)

Fixed submission:
x, t = [int(i) for i in input().split()]
ans = max(x-t, 0)
print(ans)

Buggy submission (verdict: Runtime Error):
print(max(int(input())-int(input()), 0))
Problem p03711 (python)

Fixed submission:
x, y = [int(i) for i in input().split()]

if x == y == 2:
  print("Yes")
elif x in (4, 6, 9, 11) and y in (4, 6, 9, 11):
  print("Yes")
elif x in (1, 3, 5, 7, 8, 10, 12) and y in (1, 3, 5, 7, 8, 10, 12):
  print("Yes")
else:
  print("No")

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

if x == y == 2:
  print("Yes")
elif x in (4, 6, 9, 11) and y in (4, 6, 9, 11):
  print("Yes")
elif x in (1, 3, 5, 7, 8, 10, 12) and y in (1, 3, 5, 7, 8, 10, 12):
  print("Yes")
else:
  print("No")
Problem p03760 (python)

Fixed submission:
from itertools import zip_longest

odds, evens = [input() for _ in range(2)]
chars = []
for odd, even in zip_longest(odds, evens, fillvalue=""):
    chars.append(odd)
    chars.append(even)
ans = "".join(chars)
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import zip_longest

odds, evens = [input() for _ in range(2)]
if len(odds) > len(evens):
    evens.append("")
chars = []
for odd, even in zip_longest(odd, even, fillvalue=""):
    chars.append(odd)
    chars.append(even)
ans = "".join(chars)
print(ans)

Buggy submission (verdict: Runtime Error):
odds, evens = input().split()
chars = []
for odd, even in zip(odds, evens):
    chars.append(odd)
    chars.append(even)
ans = "".join(chars)
print(ans)
Problem p03830 (python)

Fixed submission:
from collections import deque, defaultdict
from functools import reduce
from operator import mul

N = int(input())
MOD = 10**9 + 7

# 素数の一覧
prime_nums = set([2]) if N > 1 else set()
prime_nums = prime_nums.union(set(range(3, N+1, 2)))
queue = deque([i for i in prime_nums if i*i <= N+1])
while queue:
    num = queue.popleft()
    prime_nums.difference_update({i for i in range(num*2, N+1, num)})
prime_nums = sorted(list(prime_nums))

# 素因数分解
factors = defaultdict(int)
for i in range(2, N+1):
    for j in prime_nums:
        while True:
            if i % j == 0:
                factors[j] += 1
                i //= j
            else:
                break

if N == 1:
    ans = 1
else:
    ans = reduce(mul, [(v+1) % MOD for v in factors.values()])
print(ans % MOD)

Buggy submission (verdict: Runtime Error):
from collections import deque, defaultdict
from functools import reduce
from operator import mul

N = int(input())
MOD = 10**9 + 7

# 素数の一覧
prime_nums = set([2]) if N > 1 else set()
prime_nums = prime_nums.union(set(range(3, N+1, 2)))
queue = deque([i for i in prime_nums if i*i <= N+1])
while queue:
    num = queue.popleft()
    prime_nums.difference_update({i for i in range(num*2, N+1, num)})
prime_nums = sorted(list(prime_nums))

# 素因数分解
factors = defaultdict(int)
for i in range(2, N+1):
    for j in prime_nums:
        while True:
            if i % j == 0:
                factors[j] += 1
                i //= j
            else:
                break


ans = reduce(mul, [(v+1) % MOD for v in factors.values()])
print(ans % MOD)
Problem p03860 (python)

Fixed submission:
_, s, _ = input().split()
print("A{}C".format(s[0]))

Buggy submission (verdict: Runtime Error):
_, s, _ = input().split()
print(f"A{s[0]}C")
Problem p04044 (python)

Fixed submission:
N, _ = [int(i) for i in input().split()]
S = [input() for _ in range(N)]
ans = "".join(sorted(S))
print(ans)

Buggy submission (verdict: Runtime Error):
N, _ = [int(i) for i in input().split()]
S = [input() for _ in range(N)]
ans = "".join(sorted(s))
print(ans)
Problem p03061 (python)

Fixed submission:
import numpy as np

def gcd(a,b):    
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
    
N = int(input())
A_list = list(map(int, input().split()))

# =====
# initialize L and R
# =====
L = np.zeros(N+1)
R = np.zeros(N+1)

for idx, element in enumerate(A_list):
    if L[idx] == 0:
        L[idx+1] = element
    else:
        L[idx+1] = gcd(L[idx], element)

for idx, element in enumerate(A_list[-1::-1]):
    idx = N-idx
    if R[idx] == 0:
        R[idx-1] = element
    else:
        R[idx-1] = gcd(R[idx], element)

ans = 0
for i in range(N):
    if L[i] == 0:
        M = R[i+1]
    elif R[i+1] == 0:
        M = L[i]
    else:
        M = gcd(L[i], R[i+1])
    if ans < M:
        ans = M

print(int(ans))

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

A_list = list(map(int, input().split()))

import math
import copy
from functools import reduce

def gcd(numbers):
    return reduce(math.gcd, numbers)

max_gcd = 0
for idx in range(N):
    cleaned = copy.copy(A_list)
    del cleaned[idx]
    gcd_value = gcd(tuple(cleaned))
    if max_gcd < gcd_value:
        max_gcd = gcd_value
print(max_gcd)
Problem p03085 (python)

Fixed submission:
b = input()
if  b == "A":
    print("T")
elif b == "C":
    print("G")
elif b == "T":
    print("A")
else:
    print("C")

Buggy submission (verdict: Runtime Error):
b = inout()
if  b == "A":
    print("T")
elif b == "C":
    print("G")
elif b == "T":
    print("A")
else:
    print("C")
Problem p03106 (python)

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

waru = []
for i in range(1, max(A,B)+1, 1):
    if A%i == 0 and B%i == 0:
        waru.append(i)
print(waru[-K])

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

waru = []
for i in range(1, max(A,B)+1, 1):
    if len(waru) == K-1:
        break
    if A%i == 0 and B%i == 0:
        waru.append(i)
print(waru[-1])
Problem p03136 (python)

Fixed submission:
import numpy as np
N = int(input())
L_list = list(map(int, input().split()))

max_ = max(L_list)
L_list.remove(max_)

if max_ < np.sum(L_list):
    print("Yes")
else:
    print("No")

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

max_ = max(L_list)
L_list.remove(max_)

if max_ < np.sum(L_list):
    print("Yes")
else:
    print("No")

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

max_ = max(L_list)
L_list.remove(max_)

if max_ < np.sum(L_list):
    print("Yes")
else:
    print("No")
Problem p03251 (python)

Fixed submission:
n, m, X, Y = map(int, input().split())
x = map(int, input().split())
y = map(int, input().split())

if(max(max(x), X) < min(min(y), Y)):
    print("No War")
else:
    print("War")

Buggy submission (verdict: Runtime Error):
n, m, X, Y = map(int, input().split())
x = map(int, input().split())
y = map(int, input().split())

if(max(x, X) < min(y, Y)):
    print("No War")
else:
    print("War")
Problem p03262 (python)

Fixed submission:
#C - Skip
import sys

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

residual = [abs(x - X) for x in x_list]

def gcd(a,b):
    if(b==0):
        return a
    else:
        return gcd(b, a%b)
        
max_ = 0
for i in range(len(residual)):
    if(N==1):
        print(residual[0])
        break
    
    if(i == 0):
        max_ = gcd(residual[i], residual[i+1])
    elif(i == N-1):
        print(max_)
    else:
        max_ = gcd(residual[i], max_)

Buggy submission (verdict: Runtime Error):
#C - Skip
N, X = map(int, input().split())
x_list = list(map(int, input().split()))

residual = [abs(x - X) for x in x_list]

def gcd(a,b):
    if(b==0):
        return a
    else:
        return gcd(b, a%b)
        
max_ = 0
for i in range(len(residual)):
    if(i == 0):
        max_ = gcd(residual[i], residual[i+1])
    elif(i == N-1):
        print(max_)
    else:
        max_ = gcd(residual[i], max_)

Buggy submission (verdict: Runtime Error):
#C - Skip
N, X = map(int, input().split())
x_list = list(map(int, input().split()))

residual = [abs(x - X) for x in x_list]

def gcd(a,b):
    if(b==0):
        return a
    else:
        gcd(b, a%b)
        
max_ = 0
for i in range(len(residual)):
    if(i == 0):
        max_ = gcd(residual[i], residual[i+1])
    elif(i == N-1):
        print(max_)
    else:
        max_ = gcd(residual[i], max_)
Problem p02922 (python)

Fixed submission:
n = 0
a, b = map(int, input().split())
while n*(a-1)+1 < b:
  n += 1

print(n)

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

while n*(a-1)+1 < b:
  n += 1

print(n)
Problem p03160 (python)

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

dp = [100000000] * N
dp[0] = 0
dp[1] = abs(H[0] - H[1])

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

print(dp[N - 1])

Buggy submission (verdict: Runtime Error):
def min_cost(i, total):
    if i < 1:
        return 0

    total += min_cost(i - 1, abs(h[i] - h[i - 1]))
    total += min_cost(i - 2, abs(h[i] - h[i - 2]))
    return total


def chmin(a, b):
    if a > b:
        return b
    else:
        return a

      
N = int(input())
H = list(map(int, input().split(' ')))

dp = [10000] * 10000
dp[0] = 0

for i in range(1, N):
    dp[i] = chmin(dp[i], dp[i - 1] + abs(H[i] - H[i - 1]))
    if i > 1:
        dp[i] = chmin(dp[i], dp[i - 2] + abs(H[i] - H[i - 2]))

print(dp[N - 1])

Buggy submission (verdict: Runtime Error):
def min_cost(i, total):
    if i < 1:
        return 0

    total += min_cost(i - 1, abs(h[i] - h[i - 1]))
    total += min_cost(i - 2, abs(h[i] - h[i - 2]))

    return total


def chmin(a, b):
    if a > b:
        return b
    else:
        return a


N = int(input())
H = list(map(int, input().split(' ')))

dp = [10000] * 10
dp[0] = 0  # 足場0のコストは0

for i in range(1, N):
    dp[i] = chmin(dp[i], dp[i - 1] + abs(H[i] - H[i - 1]))
    if i > 1:
        dp[i] = chmin(dp[i], dp[i - 2] + abs(H[i] - H[i - 2]))

print(dp[N - 1])
Problem p03378 (python)

Fixed submission:
N, M, X = map(int, input().split(' '))
A = list(map(int, input().split(' ')))

r_count = 0
l_count = 0

tmp_1 = X
tmp_2 = X


while tmp_1 != N:
    tmp_1 += 1
    if tmp_1 in A:
        r_count += 1

while tmp_2 != 0:
    tmp_2 -= 1
    if tmp_2 in A:
        l_count += 1


res = min(l_count, r_count)
print(res)

Buggy submission (verdict: Runtime Error):
import math

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

pits = []

cost = 0

for i in range(0, N+1):
    pits.append(i)

half = int(len(pits) / 2)


if X == half:
    cost_r = 0
    cost_l = 0
    for a in A:
        # 右側
        if X < a:
            cost_r += 1
        # 左側
        if X > a:
            cost_l += 1
    cost = min(cost_l, cost_r)
elif half < X:
    for a in A:
        if X < a:
            count += 1
else:
    for a in A:
        if X > a:
            count += 1

print(cost)

Buggy submission (verdict: Runtime Error):
import math

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

pits = []

cost = 0

for i in range(0, N+1):
    pits.append(i)

half = int(len(pits) / 2)


# 真ん中
if X == half:
    cost_r = 0
    cost_l = 0
    for a in A:
        # 右側
        if X < a:
            cost_r += 1
        # 左側
        if X > a:
            cost_l += 1
    cost = min(cost_l, cost_r)
# 右側
elif half < X:
    for a in A:
        if X < a:
            count += 1
# 左側
else:
    for a in A:
        if X > a:
            count += 1

print(cost)
Problem p02742 (python)

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

if W == 1:
    print(1)
elif H == 1:
    print(1)
else:
    ans = W * (H // 2)
    if H % 2 == 1:
        if W % 2 == 0:
            ans += W // 2
        else:
            ans += W // 2 + 1
    print(ans)

Buggy submission (verdict: Runtime Error):
H,W = map(int, input().split())

if H == 1:
    print(1)
elif W == 1: 
    print(1)
else:
    ans = H*(W // 2)
    if H % 2 == 1:
        if W % 2 == 0:
            ans += W // 2
        else:
            ans += W // 2 + 1
print(ans)
Problem p02767 (python)

Fixed submission:
N=int(input())
X=list(map(int,input().split()))
def D(x,a):
	ans=0
	for i in range(len(a)):
		ans+=(x-a[i])**2
	return ans
for i in range(0,101):
	if D(i,X)<D(i+1,X):
		print(D(i,X))
		break

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

def D(x, a):
    ans = 0
    for i in range(len(a)):
        ans += (x - a[i])**2
    return ans

for i in range(0, 101):
    if D(x, X) < D(i+1, X):
        print(D(i, X))
        break

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

def D(X,a):
	ans = 0
	for i in range(len(a)):
		ans += (x - a[i])**2
	return ans

for i in range(0,101):
	if D(i,X) < D(i+1,X):
		print(D(i,X))
		break

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

def D(X,a):
	ans = 0
	for i in range(len(a)):
		ans += (x - a[i])**2
	return ans

for i in range(0,101):
	if D(i,X) < D(i+1,X):
		print(D(i,X))
		break
Problem p02842 (python)

Fixed submission:
n=int(input())
for i in range(n+1):
    if int(i*1.08)==n:
        print(i)
        exit()
print(':(')

Buggy submission (verdict: Runtime Error):
N = int(input())
for i in raNge(N+1):
    if int(i*1.08)==N:
        primt(i)
        exit()
print(':(')

Buggy submission (verdict: Runtime Error):
N = int(input())
for i in range(N+1):
    if int(i*1.08)==n:
        print(i)
        exit()
print(':(')

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

for i in range(N+1):
    if int(i*1.08)==n:
        print(i)
        exit()
print(':(')

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(n+1):
	if int(i*1.08)==n:
  		print(i)
    	exit()
print(':(')

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(n+1):
	if int(i*1.08)==n:
  	print(i)
    exit()
print(':(')
Problem p02922 (python)

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

ans = 0
consent = 1

while consent < B:
    ans += 1
    consent -= 1
    consent += A
print(ans)

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

ans = 0
consent = 1

while consent < B
    ans += 1
    consent -= 1
    consent -= A
print(ans)

Buggy submission (verdict: Runtime Error):
zA, B = map(int, input().split())
 
ans = 0
consent = 1
 
while consent < B:
    ans += 1
    consent -= 1
    consent += A
print(ans)

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

K = 1
ans = 0

while(K < B):
	K -= 1
	L += A
	ans += 1

print(ans)
Problem p03456 (python)

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

c = a + b
c = int(c)

for i in range(400)[1:]:
    if c == i**2:
        print('Yes')
        exit()

print('No')

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

c = a + b
c = int(c)

for i in range(400)[1:]:
    if c = i**2:
        print('Yes')
        exit()

print('No')

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

c = a + b
c = int(c)

for i in range(400)[1:]:
    if c = i**2:
        print('Yes')
        break

print('No')
Problem p03971 (python)

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

total = 0
kaigai = 0

for i in range(0, len(L)):
	if L[i] == 'a':
		if total < A + B:
			print('Yes')
			total += 1
		else:
			print('No')
	elif L[i] == 'b':
		if total < A + B and kaigai < B:
			print('Yes')
			total += 1
			kaigai += 1
		else:
			print('No')
	else:
		print('No')

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
S = str(input())

total = 0
kaigai = 0

for i in range(0, len(S)):
    if L[i] == 'a':
        if total < A+B:
            print('Yes')
            total += 1
        else:
            print('No')
    elif L[i] == 'b':
        if total < A+B & kaigai <B:
            print('Yes')
            total += 1
            kaigai += 1
        else:
            print('No')
    else:
        print('No')
Problem p02767 (python)

Fixed submission:
def cal_cost(X, P):
    cost = 0
    for x in X:
        cost += (x - P) ** 2
    return cost


def main(N, X):
    return min(cal_cost(X, p) for p in range(max(X) + 1))


if __name__ == "__main__":
    N = int(input())
    X = list(map(int, input().split()))
    ans = main(N, X)
    print(ans)

Buggy submission (verdict: Runtime Error):
input()
print(min(sum((x-p)**2 for x in map(int, input().split())) for p in range(101)))

Buggy submission (verdict: Runtime Error):
N = int(input())
X = list(map(int, input().split()))
print(min(lambda p: sum((x-p)**2 for x in X) for i in range(max(X)+1)))
Problem p02971 (python)

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

mls = [-1 for _ in range(N+1)]
for i, a in enumerate(A, 1):
    mls[i] = max(mls[i-1], a)

mrs = [-1 for _ in range(N+1)]
for i, a in enumerate(A[::-1], 1):
    mrs[i] = max(mrs[i-1], a)
mrs = mrs[::-1]

for i in range(N):
    print(max(mls[i], mrs[i+1]))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for _ in range(N)]

m1, m2 = sorted(A, reversed=True)[0:2]
for a in A:
    print(m2 if a == m1 else m1)
Problem p03229 (python)

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()

if N % 2 == 0:
    c = N // 2
    S = -2 * sum(A[:c]) + 2 * sum(A[c:]) + A[c-1] - A[c]
else:
    c = (N-1) // 2
    tmp1 = -2 * sum(A[:c]) + 2 * sum(A[c+2:]) + A[c] + A[c+1]
    tmp2 = -2 * sum(A[:c-1]) + 2 * sum(A[c+1:]) - A[c-1] - A[c]
    S = max(tmp1, tmp2)

print(S)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()

s = int((N - 1) / 2)
m = A[0:s+1]
M = A[s+1:][::-1]

n = N-1 if N % 2 == 1 else N
ans = [0 for _ in range(n)]

li = s
ri = s + 1

for i, (a, b) in enumerate(zip(m, M)):
    if i % 2 == 1:
        a, b = b, a
    ans[li] = a
    ans[ri] = b
    li -= 1
    ri += 1

if N % 2 == 1:
    if ans[0] < ans[-1]:
        ans = [m[-1]] + ans
    else:
        ans = ans + [m[-1]]

print(ans)

S = 0
for i, j in zip(ans[1:], ans[:-1]):
    S += abs(i - j)

print(S)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()

s = int((N - 1) / 2)
m = A[0:s+1]
M = A[s+1:][::-1]

if N % 2 == 1:
    N -= 1
ans = [0 for _ in range(N)]

li = s
ri = s + 1

for i, (a, b) in enumerate(zip(m, M)):
    if i % 2 == 1:
        a, b = b, a
    ans[li] = a
    ans[ri] = b
    li -= 1
    ri += 1

if N % 2 == 1:
    if ans[0] < ans[-1]:
        ans = [m[-1]] + ans
    else:
        ans = ans + [m[-1]]

print(ans)

S = 0
for i, j in zip(ans[1:], ans[:-1]):
    S += abs(i - j)

print(S)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()

s = int((N - 1) / 2)
m = A[0:s+1]
M = A[s+1:][::-1]

ans = [0 for _ in range(N)]

if (N - 7) % 4 == 0:
    flag = True

if (flag):
    li = s - 1
    ri = s + 1
else:
    li = s
    ri = s + 1

for i, (a, b) in enumerate(zip(m, M)):
    if i % 2 == 1:
        a, b = b, a
    ans[li] = a
    ans[ri] = b
    li -= 1
    ri += 1

if N % 2 == 1:
    if (flag):
        ans[-1] = m[-1]
    else:
        ans[0] = m[-1]

S = 0
for i, j in zip(ans[1:], ans[:-1]):
    S += abs(i - j)

print(S)
Problem p03238 (python)

Fixed submission:
N = int(input())


if N == 1:
    print("Hello World")
else:
    A = int(input())
    B = int(input())
    print(A+B)

Buggy submission (verdict: Runtime Error):
border = 101


def manhattan_distance(Cx, Cy, H, X, Y):
    return max(H - abs(X - Cx) - abs(Y - Cy), 0)


def judge_center(Cx, Cy, cords):
    for x, y, h in cords:
        if h > 0:
            H = abs(cords[0][0] - Cx) + abs(cords[0][1] - Cy) + cords[0][2]
            break
    for x, y, h in cords:
        tmp = manhattan_distance(Cx, Cy, H, x, y)
        if (h > 0 and H != tmp) or (h == 0 and H > tmp):
            return -1
    return H


def main():
    N = int(input())
    cords = [list(map(int, input().split(' '))) for _ in range(N)]

    for tmp_Cx in range(border):
        for tmp_Cy in range(border):
            h = judge_center(tmp_Cx, tmp_Cy, cords)
            if h != -1:
                print('{} {} {}'.format(tmp_Cx, tmp_Cy, h))
                return 0


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())

if N == 1:
    print("Hello World")
else:
    print(A+B)
Problem p03262 (python)

Fixed submission:
import fractions

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

min_distance = abs(x[0] - X)
for i in x: min_distance = fractions.gcd(abs(i - X), min_distance)

print(min_distance)

Buggy submission (verdict: Runtime Error):
import fraction

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

min_distance = abs(x[0] - X)
for i in x: min_distance = fraction.gcd(abs(i - X), min_distance)

print(min_distance)

Buggy submission (verdict: Runtime Error):
import math

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

min_distance = abs(x[0] - X)
for i in x: min_distance = math.gcd(abs(i - X), min_distance)

print(min_distance)

Buggy submission (verdict: Runtime Error):
import math

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

min_distance = abs(x[0] - X)
for i in x[1:]: min_distance = math.gcd(abs(i - X), min_distance)

print(min_distance)
Problem p03282 (python)

Fixed submission:
S = input()
K = int(input())

s = ''
for i in S:
    s += i
    if i != '1':
        break

if K < len(s):
    print(s[K-1])
else:
    print(s[-1])

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

s = ''
for i in S:
    s += i
    if i != '1':
        break

if K > len(s):
    print(s[-1])
else:
    print(s[K])
Problem p03316 (python)

Fixed submission:
N = int(input())
S =  sum((int(i) for i in str(N)))
if N % S == 0: print('Yes')
else: print('No')

Buggy submission (verdict: Runtime Error):
N = input()
if N % sum([int(i) for i in str(N)]) == 0: print('Yes')
else: print('No')