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

Fixed submission:
N,Q =map(int,input().split())
S = input()
t = [0]* (N+1)
for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2]=='AC' else 0)
for i in range(Q):
    l,r =map(int,input().split())
    print(t[r-1]-t[l-1])

Buggy submission (verdict: Runtime Error):
N,Q =map(int,input().split())
S = input()
t = [0]* (N+1)
for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2]=='AC' else 0)
for i in range(N):
    l,r =map(int,input().split())
    print(t[r-1]-t[l-1])
Problem p03635 (python)

Fixed submission:
a,b = map(int,input().split())
print((a-1)*(b-1))

Buggy submission (verdict: Runtime Error):
a,b = map(input().split())
print((a-1)*(b-1))
Problem p03854 (python)

Fixed submission:
s = list(input())
s.reverse()
s = "".join(s)

for _ in range(10**5):
    before_s = s
    if s[:5]=="maerd" or s[:5] =="esare":
        s = s[5:]
    elif s[:7]=="remaerd" :
        s = s[7:]
    elif s[:6] == "resare":
        s = s[6:]
    if s == "":
        ans = "YES"
        break
    if s == before_s:
        ans ="NO"
        break
print(ans)

Buggy submission (verdict: Runtime Error):
s = list(input())
s.reverse()
s = "".join(s)
before_s = s
for _ in range(10**5):
    if s[:5]=="maerd" or s[:5] =="esare":
        s = s[5:]
    elif s[:7]=="remaerd" :
        s = s[7:]
    elif s[:6] == "resare":
        s = s[6:]
    if s == "":
        ans = "YES"
        break
    if s == before_s:
        ans ="NO"
        break
print(ans)
Problem p03043 (python)

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

ans = 0
ans1 = 0
j = 1
flag = False
for i in range(n, 0, -1):

    if(i >= k):
        ans1 += 1
        continue

    if(flag == False):
        flag = True
        while(i*2**j < k): j += 1

        tmp = j
        ans += 1
    else:
        while(i*2**j >= k): j -= 1
        j += 1

        if(tmp != j):
            ans *= 2
            ans += 1
            tmp = j
        else: ans += 1

print((ans+ans1*2**j) / (n*2**j))

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

ans = 0
ans1 = 0
flag = False
for i in range(n, 0, -1):

    if(i >= k):
        ans1 += 1
        continue

    if(flag == False):
        flag = True
        j = 1
        while(i**(j+1) < k): j += 1

        tmp = j
        ans += 1
    else:
        while(i**(j+1) >= k): j -= 1
        j += 1

        if(tmp != j):
            ans *= 2
            ans += 1
            tmp = j
        else: ans += 1

print((ans+ans1*2**j) / (n*2**j))

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

ans = 0
ans1 = 0
flag = False
for i in range(n, 0, -1):
    if(k % n == 0): count = k // n
    else: count = k // n + 1

    if(i >= k):
        ans1 += 1
        continue

    if(flag is False):
        flag = True
        j = 1
        while(i**(j+1) < k): j += 1

        tmp = j
        ans += 1
    else:
        while(i**(j+1) >= k): j -= 1
        j += 1

        if(tmp != j):
            ans *= 2
            ans += 1
            tmp = j
        else: ans += 1

print((ans+ans1*2**j) / (n*2**j))
Problem p03246 (python)

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

v1 = {}
v2 = {}
for i in range(n):
    if(i % 2 == 0):
        if((v[i] in v1) == True):
            v1[v[i]] += 1
        else:
            v1[v[i]] = 1
    else: 
        if((v[i] in v2) == True):
            v2[v[i]] += 1
        else:
            v2[v[i]] = 1

max_k1 = max(v1, key=v1.get)
max_k2 = max(v2, key=v2.get)

ans1 = 1e9
ans2 = 1e9
if(max_k1 == max_k2):
    tmp = v1[max_k1]
    v1[max_k1] = 0
    max_k1 = max(v1, key=v1.get)
    ans1 = n - v1[max_k1] - v2[max_k2]
    v1[max_k1] = tmp
    max_k1 = max(v1, key=v1.get)

    v2[max_k2] = 0
    max_k2 = max(v2, key=v2.get)
    ans2 = n - v1[max_k1] - v2[max_k2]
else: ans1 = n - v1[max_k1] - v2[max_k2]

print(min(ans1, ans2))

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

v1 = {}
v2 = {}
for i in range(len(v)):
    if(i % 2 == 0):
        if((v[i] in v1) == True):
            v1[v[i]] += 1
        else:
            v1[v[i]] = 1
    else: 
        if((v[i] in v2) == True):
            v2[v[i]] += 1
        else:
            v2[v[i]] = 1


if(max_k1 == max_k2):
    if(v1[max_k1] > v2[max_k2]):
        v2[max_k2] = 0
        max_k2 = max(v2, key=v2.get)
    else:
        v1[max_k1] = 0
        max_k1 = max(v1, key=v1.get)


ans = n // 2 - v1[max_k1]
ans += n // 2 - v2[max_k2]

print(ans)
Problem p03276 (python)

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

if((0 in x) == True):
    state = x.index(0)
    k -= 1
else:
    x.append(0)
    x = sorted(x)
    state = x.index(0)

ans = int(1e10)
for left in range(k+1):
    right = k - left
    if(((state - left) >= 0) and ((state + right) <= (len(x) - 1))):
        if(right > 0): tmp = -2 * x[state-left]
        else: tmp = -1 * x[state-left]
        tmp += x[state+right]
        if(ans > tmp): ans = tmp

        tmp = -1 * x[state-left]
        if(left > 0): tmp += 2 * x[state+right]
        else: tmp += x[state+right]
        if(ans > tmp): ans = tmp

print(ans)

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

if((0 in x) == True):
    state = x.index(0)
    count = 1
else:
    x.append(0)
    x = sorted(x)
    state = x.index(0)
    count = 0

ans = int(1e9)
for left in range(k-count+1):
    right = k - count - left
    if(((state - left) >= 0) and ((state + right) <= (len(x)))):
        if(right > 0): tmp = -2 * x[state-left]
        else: tmp = -1 * x[state-left]
        tmp += x[state+right]
        if(ans > tmp): ans = tmp

print(ans)
Problem p03380 (python)

Fixed submission:
import sys

sys.setrecursionlimit(10000)

def search(a, b, left, right):
    mid = int(left + (right - left) / 2)
    if(b[mid] == a):
        return b[mid]
    if(len(b) <= mid + 1):
        return b[mid]
    if(b[mid] >= a and a >= b[mid+1]):
        if(b[mid]- a >= a - b[mid+1]):
            return b[mid+1]
        else:
            return b[mid]
    if(b[mid] <= a):
        return search(a, b, left, mid)
    else:
        return search(a, b, mid, right)

n = int(input())
a = list(map(int, input().split(" ")))

b = sorted(a, reverse=True)
for i in b:
    m = i/2
    j = search(m, b, 0, len(b))
    print("%d %d" %(i, j))
    break

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10000)

def search(a, b, left, right):
    mid = int(left + (left - right) / 2)
    if(b[mid] == a):
        return b[mid]
    if(b[mid] >= a and a >= b[mid+1]):
        if(b[mid]- a >= a - b[mid+1]):
            return  b[mid+1]
        else:
            return b[mid]
    if(b[mid] >= a):
        return search(a, b, 0, mid)
    else:
        return search(a, b, mid, right)

n = int(input())
a = list(map(int, input().split(" ")))

b = sorted(a, reverse=True)
for i in b:
    m = i/2
    j = search(m, b, 0, len(b))
    print("%d %d" %(i, j))
    break

Buggy submission (verdict: Runtime Error):
import scipy.misc as scm

def search(a, b, left, right):
    mid = int(left + (left - right) / 2)
    if(b[mid] == a):
        return b[mid]
    if(b[mid] >= a and a >= b[mid+1]):
        if(b[mid]- a >= a - b[mid+1]):
            return  b[mid+1]
        else:
            return b[mid]
    if(b[mid] >= a):
        return search(a, b, 0, mid)
    else:
        return search(a, b, mid, right)

n = int(input())
a = list(map(int, input().split(" ")))

b = sorted(a, reverse=True)
for i in b:
    m = i/2
    j = search(m, b, 0, len(b))
    print("%d %d" %(i, j))
    break
Problem p03591 (python)

Fixed submission:
s = input()

txt = "YAKI"

for i in range(4):
    if(len(s) < 4):
        flag = 0
        break
    if(s[i] == txt[i]):
        flag = 1
    else:
        flag = 0
        break

if(flag == 1):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np

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

flag = 0
for i in range(n + 1):
    for j in range(m + 1): 
        if(i * n - i * j + j * m - i * j == k):
            flag = 1

if(flag == 1):
    print("Yes")
else:
    print("No")
Problem p03607 (python)

Fixed submission:
import numpy as np

n = int(input())

a = np.zeros(n, dtype = int)

for i in range(n):
    a[i] = int(input())

a = np.sort(a)

sum = 0
for i in range(n):
    if(i == 0):
        flag = 1
    elif(a[i - 1] == a[i]):
        flag += 1
    else:
        if(flag % 2 == 1):
            sum += 1
        else:
            flag = 1

if(flag % 2 == 1):
    sum += 1

print(sum)

Buggy submission (verdict: Runtime Error):
import numpy as np

n = int(input())

num = np.zeros(10 ** 9, dtype = bool)

for i in range(n):
    a = int(input())

    num[a] = not(num[a])

sum = np.where(num == True) 

print(len(sum[0]))
Problem p03068 (python)

Fixed submission:
N = int(input())
S = input()
K = int(input())
a = S[K-1]
ans = ""
for i in range(N):
    if S[i] != a:
        ans += "*"
    else:
        ans += S[i]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
K = int(input())
a = S[K]
for i in range(N):
    if S[i] != a:
        S[i] = "*"
print(S)
Problem p03069 (python)

Fixed submission:
N = int(input())
S = input()
r1 = [0] * N
r2 = [0] * (N+1)
r1[0] = 1 * (S[0] == '#')
for i in range(1, N):
    if S[i] == "#":
        r1[i] = r1[i - 1] + 1
    else:
        r1[i] = r1[i - 1]
#print(r1)
r2[N - 1] = 1 * (S[N - 1] == ".")
r2[N] = r2[N-1]
for i in range(N - 2, -1, -1):
    if S[i] == ".":
        r2[i] = r2[i + 1] + 1
    else:
        r2[i] = r2[i + 1]
#print(r2)
c1 = S.count("#")
c2 = S.count(".")
ans = N
for i in range(N):
    ans = min(ans, r1[i] + r2[i + 1])
print(min(ans, c1, c2))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
c = 0
for i in range(N - 1, -1, -1):
    if S[i] == ".":
        c1 = i
        break
cc = 0
for i in range(N - 1, c1, -1):
    if S[i] == "#":
        cc += 1
a = S[:i + 1].count(".")
b = S[:i + 1].count("#")
ans = min(a, b, cc)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
c = 0
for i in range(N - 1, -1, -1):
    if S[i] == ".":
        c1 = i
        break
cc = 0
for i in range(N - 1, c1, -1):
    if S[i] == "#":
        cc += 1
a = S[:i + 1].count(".")
b = S[:i + 1].count("#")
ans = min(a, b, c2)
print(ans)
Problem p03079 (python)

Fixed submission:
a, b, c = map(int, input().split())
l = {a, b, c}
if len(l) == 1:
  	print('Yes')
else:
  	print('No')

Buggy submission (verdict: Runtime Error):
a, b, c  = map(int, input().split())
if len(set(a, b, c)) == 1:
  	print('Yes')
else:
  	print('No')
Problem p03086 (python)

Fixed submission:
s = input()
cnt = 0
res = []
res.append(0)
for a in s:
    if a in ["A", "G", "C", "T"]:
        cnt += 1
    else:
        res.append(cnt)
        cnt = 0
    res.append(cnt)
print(max(res))

Buggy submission (verdict: Runtime Error):
s = input()
c = 0
ans = []
for a in s:
    if a in ["A", "C","G", "T"]:
        c += 1
    else:
        ans.append(c)
        c = 0
print(max(ans))

Buggy submission (verdict: Runtime Error):
s = input()
c = 0
ans = []
for a in s:
    if a in ["A", "C","G", "T"]:
        c += 1
    else:
        ans.append(cnt)
        c = 0
print(max(ans))
Problem p03047 (python)

Fixed submission:
N, K = map(int,input().split())
print(N-K+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = []
for i in range(N):
    S.append(input())

count_AB = 0
lefter_B = 0
righter_A = 0
only_lefter_B = 0
only_righter_A = 0
for i in range(N):
    count_AB += S[i].count('AB')
    if S[i][0] == 'B':
        lefter_B += 1
    if S[i][len(S[i])-1] == 'A':
        righter_A += 1
    if (S[i][0] == 'B')and(S[i][len(S[i])-1] != 'A'):
        only_lefter_B += 1
    if (S[i][0] != 'B')and(S[i][len(S[i])-1] == 'A'):
        only_righter_A += 1
        
if (only_lefter_B==0) and (only_righter_A==0):
    Appearing_AB = max(min(lefter_B,righter_A) - 1 , 0)
else:
    Appearing_AB = min(lefter_B,righter_A)


print(count_AB + Appearing_AB)
Problem p03061 (python)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
  


N = int(input())
A = input().split()
for i in range(N):
    A[i] = int(A[i])
    
if N == 2:
    print(max(A[0],A[1]))
if N >= 3:
    gcd_all = gcd(A[0], A[1])
    gcd_without_1 = A[0]
    gcd_without_2 = A[1]
    gcd_without_1 = max(gcd_all, max( gcd(gcd_without_1, A[i]),gcd(gcd_without_2, A[i])))
    gcd_all = gcd(gcd_all,A[2])
    for i in range(3,N):
        gcd_without_1 = max(gcd_all, gcd(gcd_without_1, A[i]))
        gcd_all = gcd(gcd_all,A[i])
    print(max(gcd_all, gcd_without_1))

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
  


N = int(input())
A = input().split()
for i in range(N):
    A[i] = int(A[i])
    
if N == 2:
    print(max(A[0],A[1]))
if N >= 3:
    gcd_all = gcd(A[0], A[1])
    gcd_without_1 = A[0]
    gcd_without_2 = A[1]
    gcd_without_1 = max(gcd_all, max( gcd(gcd_without_1, A[i]),gcd(gcd_without_2, A[i])))
    gcd_all = math.gcd(gcd_all,A[2])
    for i in range(3,N):
        gcd_without_1 = max(gcd_all, gcd(gcd_without_1, A[i]))
        gcd_all = gcd(gcd_all,A[i])
    print(max(gcd_all, gcd_without_1))

Buggy submission (verdict: Runtime Error):
import math


N = int(input())
A = input().split()
for i in range(N):
    A[i] = int(A[i])
    
if N == 2:
    print(max(A[0],A[1]))
if N >= 3:
    gcd_all = math.gcd(A[0], A[1])
    gcd_without_1 = A[0]
    gcd_without_2 = A[1]
    gcd_without_1 = max(gcd_all, max( math.gcd(gcd_without_1, A[i]),math.gcd(gcd_without_2, A[i])))
    gcd_all = math.gcd(gcd_all,A[2])
    for i in range(3,N):
        gcd_without_1 = max(gcd_all, math.gcd(gcd_without_1, A[i]))
        gcd_all = math.gcd(gcd_all,A[i])
    print(max(gcd_all, gcd_without_1))

Buggy submission (verdict: Runtime Error):
import math


N = int(input())
A = input().split()
for i in range(N):
    A[i] = int(A[i])
    
if N == 2:
    print(max(A[0],A[1]))
if N >= 3:
    gcd_all = math.gcd(A[0], A[1])
    gcd_without_1 = A[0]
    gcd_without_2 = A[1]
    gcd_without_1 = max(gcd_all, max( math.gcd(gcd_without_1, A[i]),math.gcd(gcd_without_2, A[i])))
    gcd_all = math.gcd(gcd_all,A[2])
    for i in range(3,N):
        gcd_without_1 = max(gcd_all, math.gcd(gcd_without_1, A[i]))
        gcd_all = math.gcd(gcd_all,A[i])
    print(max(gcd_all, gcd_without_1))
Problem p03125 (python)

Fixed submission:
A, B = map(int, input().split())
if B%A==0:
    print("{}".format(A+B))
else:
    print("{}".format(B-A))

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


def gcd_list(numbers):
    return reduce(fraction.gcd, numbers)


N = input()
A = input().split()
for i in range(len(A)):
    A[i] = int(A[i]) 
print("{}".format(gcd_list(A)))
Problem p03059 (python)

Fixed submission:
n = input().split(" ")
 
a = int(n[0])
b = int(n[1])
t = int(n[2])
 
w = int(t / a)
print(w * b)

Buggy submission (verdict: Runtime Error):
n = input().split(" ")

a = int(n[0])
b = int(n[1])
t = int(n[2])

w = (t / a)
pritn(w * b)
Problem p03060 (python)

Fixed submission:
n = int(input())
vs = input().split(" ")
cs = input().split(" ")
 
xy = 0
for i in range(n):
  v = int(vs[i])
  c = int(cs[i])
  if v>c:
    xy += v-c
 
print(xy)

Buggy submission (verdict: Runtime Error):
n = int(input())
vs = input().split(" ")
cs = input().split(" ")

xy = 0
for i in range(n):
  v = vs[i]
  c = cs[i]
  if v>c:
    xy += v-c

print(xy)
Problem p03062 (python)

Fixed submission:
n = int(input())
w = input().split(" ")

a = []
m = 0
k = False
for i in range(n):
    a.append(int(w[i]))
    if a[i] < 0:
        a[i] *= -1
        k = not (k)
    if i == 0:
        m = a[i]
    if a[i] < m:
        m = a[i]

sum = sum(a)
if k:
    sum -= m*2
print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
w = input().split(" ")

a = []
k = False
z = False
for i in range(n):
    a.append(int(w[i]))
    if a[i] < 0:
        a[i] *= -1
        k = not (k)
    if a[i] == 0:
        z = True
    if i == 1:
        min = a[i]
    if a[i] < min:
        min = a[i]

sum = sum(a)
if k and not(z):
    sum -= min
print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
w = input().split(" ")

a = []
k = False
for i in range(n):
    a.append(int(w[i]))
    if a[i] < 0:
        a[i] *= -1
        k = not(k)
    if i == 1:
        min = a[i]
    if a[i] < min:
        min = a[i]

sum = sum(a)
if k:
    sum -= min
print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
w = input().split(" ")

a = []
k = False
for i in range(n):
    a.append(int(w[i]))
    if a[i] < 0:
        a[i] *= -1
        k = not(k)
    if i == 1:
        min = a[i]
    if a[i] < min:
        min = a[i]

sum = sum(a)
if k:
    sum -= min
print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
w = input().split(" ")

a = []
k = False
for i in range(n):
    a.append(int(w[i]))
    if a[i] < 0:
        a[i] *= -1
        k = not(k)
    if i == 1:
        min = a[i]
    if a[i] < min:
        min = a[i]

sum = sum(a)
if k:
    sum -= min
print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
w = input().split(" ")

a = []
k = False
for i in range(n):
    a.append(int(w[i]))
    if a[i] < 0:
    	a[i] *= -1
        k= not(k)
    if i == 1:
        min = a[i]
    if a[i] < min:
        min = a[i]
2
sum = sum(a)
if k:
    sum -= min
print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
w = input().split(" ")

a = []
k = False
for i in range(n):
    a.append(int(w[i]))
    if a[i] < 0:
       a[i] *= -1
       k = not(k)
    if i == 1:
        min = a[i]
    if a[i] < min:
        min = a[i]
2
sum = sum(a)
if k:
    sum -= min
print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
w = input().split(" ")

a = []
k = False
for i in range(n):
    a.append(int(w[i]))
    if a[i] < 0:
       a[i] *= -1
       k = not(k)
    if i == 1:
        min = a[i]
    if a[i] < min:
        min = a[i]
2
sum = sum(a)
if k:
    sum -= min
print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
w = input().split(' ')

a = []
k = False
for i in range(n):
    a.append(int(w[i]))
    if a[i] < 0:
       a[i] *= -1
       k = not(k)
    if i == 1:
        min = a[i]
    if a[i] < min:
        min = a[i]

sum = sum(a)
if k:
    sum -= min
print(sum)
Problem p03067 (python)

Fixed submission:
a = input().split(' ')
h1 = int(a[0])
h2 = int(a[1])
h3 = int(a[2])
 
if h1 < h3 and h3 < h2:
  print('Yes')
else:
  if h2 < h3 and h3 < h1:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
a = input().split(' ')
h1 = int(a[0])
h2 = int(a[1])
h3 = int(a[2])
 
if h1 < h3 && h3 < h2:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a = input().split(" ")
h1 = int(a[0])
h2 = int(a[1])
h3 = int(a[2])

if h1 <= h3 && h3 <= h2:
  print('Yes')
else:
  print('No')
Problem p03068 (python)

Fixed submission:
N = int(input())
S = input()
K = int(input())
 
moji = S[K-1]
ns = ''
for s in S:
  if moji == s:
    ns += moji
  else:
    ns += '*'
print(ns)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
K = input()
 
moji = S[K-1]
ns = ''
for s in S:
  if moji == s:
    ns += moji
  else:
    ns += '*'
print(ns)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
K = input()
 
moji = S[K-1]
ns = ''
for s in S:
  if moji == s:
    ns += moji
  else:
    ns += '*'
print(ns)

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

moji = S[K-1]

for s in S:
  if moji == s:
    print(moji, end='')
  else:
    print('*', end='')
print()
Problem p03071 (python)

Fixed submission:
w = input().split()
 
a = int(w[0])
b = int(w[1])
 
c = 0
for i in range(2):
  if a>=b:
    c += a
    a -= 1
  else:
    c += b
    b -= 1
 
print(c)

Buggy submission (verdict: Runtime Error):
w = input().split()

a = w[0]
b = w[1]

c = 0
for i in range(2):
  if a>=b:
    c += a
    a -= 1
  else:
    c += b
    b -= 1

print(c)
Problem p03262 (python)

Fixed submission:
import fractions
from functools import reduce
 
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
 
ip = input().split()
st = int(ip[1])
 
li = []
 
ip2 = input().split()
for i in ip2:
    li.append(abs(int(i) - st))
 
print(gcd_list(li))

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

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

ip = input().split()
st = int(ip[1])

li = []

ip2 = input().split()
for i in ip2:
    li.append(abs(int(i) - st))

print(gcd_list(li))
Problem p03369 (python)

Fixed submission:
# -*- coding: utf-8 -*-

ramen_basic = 700

data = list(input())

def is_yes(topping):
    if topping == "o":
        return True
    else:
        return False

count = 0

for topping in data:
    if is_yes(topping):
        count = count + 1

print(ramen_basic + count * 100)

Buggy submission (verdict: Runtime Error):
import math

data = input().split()

loop_count = int(data[0])
moto = int(data[1])
least_donut = 100000
one = 0

for i in range(loop_count):
    gram = int(input())
    one = one + gram
    if gram < least_donut:
        least_donut = gram

nokori = moto - one
print(loop_count + math.floor(nokori / least_donut))
Problem p03061 (python)

Fixed submission:
#!/usr/bin/env python3
 
from fractions import gcd
 
def all_gcd(numbers):
    result = numbers[0]
    for v in numbers:
        result = gcd(result, v)
    return result
 
def main():
    n = int(input())
    a = list(map(int, input().split()))
    # x[i] = gcd 0 to i
    x = []
    for i in range(n):
        prev = 0 if i == 0 else x[i - 1]
        x.append(gcd(a[i], prev))
    # y[i] = gcd i to n
    y = [0] * n
    y[n-1] = a[n-1]
    for i in range(2, n + 1):
        y[n-i] = gcd(y[n-i+1], a[n-i])

    max_gcd = 0
    for i in range(n):
        if i == 0:
            now_gcd = y[1]
        elif i == n-1:
            now_gcd = x[n-2]
        else:
            now_gcd = gcd(x[i-1], y[i+1])
        if now_gcd > max_gcd:
            max_gcd = now_gcd
    print(max_gcd)
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

from copy import copy
from math import gcd

def all_gcd(numbers):
    result = numbers[0]
    for v in numbers:
        result = gcd(result, v)
    return result

def main():
    n = int(input())
    a = list(map(int, input().split()))
    max_gcd = 0
    for i in range(n):
        b = copy(a)
        del b[i]
        bgcd = all_gcd(b)
        if max_gcd < bgcd:
            max_gcd = bgcd
    print(max_gcd)




if __name__ == '__main__':
    main()