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

Fixed submission:
N, X = map(int, input().split())
xs = list(map(int, input().split()))
xs.append(X)
xs.sort()
xs = [_ - xs[0] for _ in xs]
diffs = [xs[i]-xs[i-1] for i in range(1, len(xs))]
def gcd(a, b):
    if(a<b): return gcd(b, a)
    if a % b == 0:
      return b
    else:
      r = a % b
      return gcd(b, r)

prev = diffs[0]
for cur in diffs[1:]:
    prev = gcd(prev, cur)
print(prev)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
xs = list(map(int, input().split()))
xs.append(X)
xs.sort()
xs = [_ - xs[0] for _ in xs]
diffs = [xs[i]-xs[i-1] for i in range(1, len(xs))]
def gcd(a, b):
    if(a>b): return gcd(b, a)
    if a % b == 0:
      return b
    else:
      r = a % b
      return gcd(b, r)

prev = diffs[0]
for cur in diffs[1:]:
    prev = gcd(prev, cur)
print(prev)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
xs = list(map(int, input().split()))
xs.append(X)
xs.sort()
xs = [_ - xs[0] for _ in xs]
diffs = [xs[i]-xs[i-1] for i in range(1, len(xs))]
def gcd(a, b):
  if(a>b): return gcd(b, a)
  if a % b == 0:
    return b
  else:
    r = a % b
    return gcd(b, r)

prev = diffs[0]
for cur in diffs[1:]:
  prev = gcd(prev, cur)
print(prev)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
xs = map(int, input().split())
xs.append(X)
xs.sort()
xs = [_ - xs[0] for _ in xs]
diffs = [xs[i]-xs[i-1] for i in range(1, len(xs))]
def gcd(a, b):
  if(a>b): return gcd(b, a)
  if a % b == 0:
    return b
  else:
    r = a % b
    return gcd(b, r)

prev = diffs[0]
for cur in diffs[1:]:
  prev = gcd(prev, cur)
print(prev)
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):
N=input()

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

Fixed submission:
n=input()
N=int(n)
tmp=list(n)

c=0
for i in tmp:
    c+=int(i)

if N%c==0:
    print("Yes")
else:
    print("No")

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

c=0
for i in tmp():
    c+=int(i)

if N%c==0:
    print("yes")
else:
    print("no")
Problem p03323 (python)

Fixed submission:
A,B=map(int,input().split())
if A>8 or B>8:
    print(":(")
else:
    print("Yay!")

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

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
if A>8 or b>8:
    print(":(")
else:
    print("Yay!")
Problem p03359 (python)

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

a,b=map(int,input().split())

if b<a:
    print(a-1)
else:
    print(a)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

tmp=list(map(int,input().split()))
tmp.sort()
K=int(input())
ans=tmp[0]+tmp[1]+(tmp[2]*(2**K))
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

tmp=list(map(int,input().split()))
tmp.sort()
K=int(input())
ans=tmp[0]+tmp[1]+(tmp[2]*(2**K))
print(ans)
Problem p03360 (python)

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

tmp=list(map(int,input().split()))
tmp.sort()
K=int(input())
ans=tmp[0]+tmp[1]+(tmp[2]*(2**K))
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

tmp=list(map(int,input().split()))
tmp_list.sort()
K=int(input())
ans=tmp[0]+tmp[1]+(tmp[2]*(2**K))
print(ans)
Problem p03238 (python)

Fixed submission:
N = int(input())
if N == 1:
  print('Hello World')
elif N == 2:
    A = int(input())
    B = int(input())
    print(A+B)
else:
  pass

Buggy submission (verdict: Runtime Error):
N = int(input())
if N == 1:
  print('Hello World')
elif N == 2:
 {
   A = int(input())
   B = int(input())
   print(A+B)
 }
else:
  pass
Problem p03359 (python)

Fixed submission:
l = map(int, raw_input().split())
a = l[0]
b = l[1]

if a <= b:
    print(a)
else:
    print(a - 1)

Buggy submission (verdict: Runtime Error):
import math

N = int(raw_input())

def genprimes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0

    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]

primes = genprimes(55556)

ans = []
for p in primes:
    if str(p)[-1] == '1':
        ans.append(p)

print(' '.join(map(str, ans[:N])))
Problem p03382 (python)

Fixed submission:
import numpy as np
import itertools

N = int(raw_input())
A = map(int, raw_input().split())

def mul(x, y):
    return x * y

def nCr(n, r):
    print n, r
    if r == 0:
        return 1
    if n/2 < r:
        return nCr(n, n-r)
    print range(n, n - r, -1), range(1, r+1)
    return np.prod(range(n, n - r, -1)) / np.prod(range(1, r+1))

def nCrMax(n):
    return nCr(n, n/2)

sortedA = sorted(A, reverse = True)

max = -1
for i in range(N - 1):
    n = sortedA[i]
    target = n/2
    newA = sortedA[:i] + sortedA[i+1:]
    r = newA[np.argmin(map(lambda x: abs(x - target), newA))]
    #ncr = nCr(n, r)
    #if(nCr > max):
    #    max = nCr
    #else:
    #    break
    #if nCrMax(sortedA[i+1]) < max:
    #    break
    break
    
print n, r

Buggy submission (verdict: Runtime Error):
import numpy
N = int(raw_input())
A = map(int, raw_input().split())

def mul(x, y):
    return x * y

def nCr(n, r):
    if r == 0:
        return 1
    if n/2 < r:
        return nCr(n, n-r)
    return reduce(mul, range(n, n - r, -1)) / reduce(mul, range(1, r+1))

def nCrMax(n):
    return nCr(n, n/2)

sortedA = sorted(A, reverse = True)

max = -1
for i in range(N - 1):
    n = sortedA[i]
    target = n/2
    newA = sortedA[:i] + sortedA[i+1:]
    r = newA[numpy.argmin(map(lambda x: abs(x - target), newA))]
    ncr = nCr(n, r)
    if(nCr > max):
        max = nCr
    else:
        break
    if nCrMax(sortedA[i+1]) < max:
        break

print n, r

Buggy submission (verdict: Runtime Error):
import numpy
N = int(raw_input())
A = map(int, raw_input().split())

def mul(x, y):
    return x * y

def nCr(n, r):
    if r == 0:
        return 1
    return reduce(mul, range(n, n - r, -1)) / reduce(mul, range(1, r+1))

def nCrMax(n):
    return nCr(n, n/2)

sortedA = sorted(A, reverse = True)

max = -1
for i in range(N - 1):
    n = sortedA[i]
    target = n/2
    newA = sortedA[:i] + sortedA[i+1:]
    r = newA[numpy.argmin(map(lambda x: abs(x - target), newA))]
    ncr = nCr(n, r)
    if(nCr > max):
        max = nCr
    else:
        break
    if nCrMax(sortedA[i+1]) < max:
        break

print n, r
Problem p03238 (python)

Fixed submission:
if int(input()) == 1:
    print("Hello World")
else:
    print(int(input()) + int(input()))

Buggy submission (verdict: Runtime Error):
input_data = [int(i) for i in input().split(" ")]

if input_data[0] == 1:
    print("Hello World")
    exit()

print(input_data[1] + input_data[2])
Problem p03239 (python)

Fixed submission:
NT_in = input()
NT = NT_in.split()
N = int(NT[0])
T = int(NT[1])
d = {}
for i in range(N):
	str_num = input()
	num = str_num.split()
	d[int(num[0])] = int(num[1])
for c, t in sorted(d.items(), key=lambda x: x[0]):
	if t <= T:
		print(c)
		break
else:
	print("TLE")

Buggy submission (verdict: Runtime Error):
N = int(input())
T = int(input())
d = {}
for i in range(N):
	c = int(input())
	t = int(input())
	d[c] = t
for c, t in sorted(d.items(), key=lambda x: x[0]):
	if t <= T:
		print(c)
		break
else:
	print("TLE")
Problem p03243 (python)

Fixed submission:
n = input()
num = int(n)
ans = 0
for digit in range(1,10):
    if num/digit == float(111):
        ans = num
        break
    elif num/digit < float(111):
        ans = digit*100+digit*10+digit
        break
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
num = input(n)
ans = 0
for digit in range(1,10):
    if int(num/digit) == 111:
        ans = num
        break
    elif int(num/digit) < 111:
        ans = digit*100+digit*10+digit
        break
print(ans)
Problem p03264 (python)

Fixed submission:
k = int(input())
if k % 2 == 0:
    print( (k // 2) * (k // 2 ))
else:
    print( ((k - 1) // 2 + 1) * ((k - 1) // 2) )

Buggy submission (verdict: Runtime Error):
x1, y1, x2, y2 = map(int, input().split())
diff_x, diff_y = x2 - x1, y2 - y1
print('%s %s %s %s'%(x2 - diff_y, y2 + diff_x, x1 - diff_y, y1 + diff_x))

Buggy submission (verdict: Runtime Error):
x1, y1, x2, y2 = map(int, input().split())
diff_x, diff_y = x2 - x1, y2 - y1
print(x2 - diff_y, y2 + diff_x, x1 - diff_y, y1 + diff_x)

Buggy submission (verdict: Runtime Error):
x1, y1, x2, y2 = map(int, input().split())
diff_x, diff_y = x2 - x1, y2 - y1

x3 = x2	- diff_y
y3 = y2 + diff_x

x4 = x1	- diff_y
y4 = y1 + diff_x


print(x3, y3, x4, y4)
Problem p03284 (python)

Fixed submission:
n, k = map(int, input().split())
if n % k ==0:
    print(0)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input())
if n % k ==0:
    print(0)
else:
    print(1)
Problem p03294 (python)

Fixed submission:
n = int(input())                                                                                                                     
a = map(int, input().split())                                                                               
print(sum([aa-1 for aa in a]))

Buggy submission (verdict: Runtime Error):
7
994 518 941 851 647 2 581
Problem p03494 (python)

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


count = 0
while True:
    flag = True
    for i in range(N):
        Ai = int(A[i])
        if Ai % 2 != 0:
            flag = False
            break
        A[i] = Ai / 2
        
    if flag == False:
        break
    count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N = input()
A = input().split(",")
count = 0

while True:
    roop = False
    for i in range(0, int(N)):
        if int(int(A[i])) % 2 != 0:
            roop = True
            break
        A[i] = int(A[i]) / 2
    if roop:
        break
    count+=1


print(count)

Buggy submission (verdict: Runtime Error):
N = input()
A = input().split(",")
count = 0

while True:
    roop = False
    for i in range(0, int(N)):
        if int(A[i]) % 2 != 0:
            roop = True
            break
        A[i] = int(A[i]) / 2
    if roop:
        break
    count+=1


print(count)

Buggy submission (verdict: Runtime Error):
N = input()
A = input().split(",")
count = 0
roop = False

while True:
    for i in range(0, int(N)):
        if int(A[i]) % 2 != 0:
            roop = True
            break
        A[i] = int(A[i]) / 2
    if roop:
        break
    count+=1


print(count)
Problem p03262 (python)

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

D=[]

for i in range(N):
    D.append(abs(X-Z[i]))
    
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
res = D[0]

for j in range(1, N):
    res = gcd(res, D[j])

print(res)

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

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

D=[]

for i in range(N):
    D.append(abs(X-x[i]))
    
def gcd(D):
    return reduce(math.gcd, D)
    
def gcd_list(numbers):
    return reduce(math.gcd, D)

print(gcd(D))
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=int(input())
B=int(input())

if A<=8 and B<=8:
    print("Yay!")
else:
    print(":(")
Problem p03324 (python)

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


if N==100:
    N=101
print(100**D*N)

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


if N==100:
    N=101
print(100**D)*N
Problem p03386 (python)

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

L = B - A + 1

if L >= 2*K:
    for i in range(A, A+K):
        print(i)
    for i in range(B-K+1,B+1):
        print(i)
        
else:
    for i in range(A,B+1):
        print(i)

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

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

C = np.arange(A,B+1)

if len(C)>2*K:
    for i in range(A, A+K):
        print(i)
    for i in range(B-K+1,B+1):
        print(i)

else:
    for i in range(A,B+1):
        print(i)

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

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

C = np.arange(A,B+1)

if len(C)<2*K:
    for x in range(len(C)):
        print(C[x])
        
        
else:
    for y in range(K):
        print(C[y])
    for z in range(len(C)-K,len(C)):
        print(C[z])

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

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

C = np.arange(A,B+1)

if len(C)<2*K:
    for x in range(len(C)):
        print(C[x])
        
        
else:
    for y in range(K):
        print(C[y])
    for z in range(B-K-2,B-2):
        print(C[z])

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

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

C = np.arange(A,B+1)

if len(C)<=K:
    for x in range(len(C)):
        print(C[x])

        
elif len(C)<2*K:
    for y in range(K):
        print(C[y])
    for z in range(B-K-2,B-3):
        print(C[z])
        
        
else:
    for y in range(K):
        print(C[y])
    for z in range(B-K-2,B-2):
        print(C[z])

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

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

C = np.arange(A,B+1)

if max(C)<=K:
    for x in range(B):
        print(C[x])

        
else:
    for y in range(K):
        print(C[y])
    for z in range(B-K-2,B-2):
        print(C[z])

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

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

C = np.arange(A,B+1)

if max(C)<=K:
    for x in range(B):
        print(C[x])

        
else:
    for y in range(K):
        print(C[y])
    for z in range(B-K-2,B):
        print(C[z])

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

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

C = np.arange(A,B+1)

E=C[B-K-2:]


if max(C)<=K:
    for x in range(B):
        print(C[x])


        
else:
    for y in range(K):
        print(C[y])
    for z in range(B-K-2,B):
        print(C[z])

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

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

C = np.arange(A,B+1)

print(C)

E=C[B-K-2:]


if max(C)<=K:
    for x in range(B):
        print(C[x])


        
else:
    for y in range(K):
        print(C[y])
    for z in range(B-K-2,B):
        print(C[z])
Problem p03611 (python)

Fixed submission:
from collections import Counter

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

b=[x+1for x in a]
c=[x-1for x in a]

d=a+b+c

print(max(Counter(d).values()))

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

count = [0]*100002

for a in a_list:
    count[a] += 1
    count[a+1] += 1
    count[a+2] += 1
    
print(max(count))
Problem p03644 (python)

Fixed submission:
N=int(input())

if N==1:
    print(1)
elif 2<=N<=3:
    print(2)
elif 4<=N<=7:
    print(4)
elif 8<=N<=15:
    print(8)
elif 16<=N<=31:
    print(16)
elif 32<=N<=63:
    print(32)
elif 64<=N<=100:
    print(64)

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

if N=1:
    print(1)
elif 2<=N<=3:
    print(2)
elif 4<=N<=7:
    print(4)
elif 8<=N<=15:
    print(8)
elif 16<=N<=31:
    print(16)
elif 32<=N<=63:
    print(32)
elif 64<=N<=100:
    print(64)

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

if N=1:
    print(1)
elif 2<=N<=3:
    print(2)
elif 4<=N<=7:
    print(4)
elif 8<=N<=15:
    print(8)
elif 16<=N<=31:
    print(16)
elif 32<=N<=64:
    print(32)
elif 64<=N<=100:
    print(64)

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

if N=1:
    print(1)
elif 2<=N<=3:
    print(2)
elif 4<=N<=7:
    print(4)
elif 8<=N<=15:
    print(8)
elif 16<=N<=31:
    print(16)
elif 32<=N<=64:
    print(32)
else 64<=N<=100:
    print(64)
Problem p03719 (python)

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

if c>=a and c<=b:
    print("Yes")
else:
    print("No")

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

if c>=a and c<=b:
    print("YES")
else:
    print("NO")
Problem p03737 (python)

Fixed submission:
abc = (input())
a,b,c = abc.split()

d = a[0]
e = b[0]
f = c[0]

print ((d+e+f).upper())

Buggy submission (verdict: Runtime Error):
a=(input())
b=(input())

a=int(a)
b=int(b)

if a>b:
    print ('GREATER')

elif a<b:
    print ('LESS')

else:
    print ('EQUAL')
Problem p04043 (python)

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

if A==5 and B==5 and C==7:
    print("YES")
    
elif A==5 and B==7 and C==5:
    print("YES")

elif A==7 and B==5 and C==5:
    print("YES")
    
else:
    print("NO")

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

S.sort()

A=''.join(S)

print(A)
Problem p04044 (python)

Fixed submission:
N, L = map(int,input().split())
S = [input() for i in range(N)]

S.sort()


print("".join(S))

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

S.sort()


print("".join(S))

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

B=sorted(S)

A=''.join(B)

print(str(A))

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

S=sorted(S)

A=''.join(S)

print(str(A))

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

S.sort()

A=''.join(S)

print(str(A))

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

S.sort()

A=''.join(S)

print(A)

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

S.sort()

A=''.join(S)

print(A)
Problem p03282 (python)

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

for i in range(k):
    if s[i] != '1':
        print(s[i])
        break
else:
    print('1')

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

if s[0] != '1':
    print(s[1])
Problem p03262 (python)

Fixed submission:
import fractions
from functools import reduce

N, X = map(int, input().split())
if N == 1:
    x = abs(X - int(input()))
    print(x)
else:
    x = list(map(int, input().split()))
    x = list(map(lambda i: abs(X - i), x))
    print(reduce(fractions.gcd, x))

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

N, X = map(int, input().split())
if N == 1:
    x = abs(X - int(input()))
    print(x)
else:
    x = list(map(int, input().split()))
    x = list(map(lambda i: abs(X - i), x))
    print(reduce(math.gcd, x))
Problem p03240 (python)

Fixed submission:
n = int(input())
l = []
for i in range(n):
    ex,ey,eh = map(int,input().split())
    if eh != 0:
        l.append([ex,ey,eh])

def func2(cx,cy,l):
    ans = l[2] + abs(l[0]-cx) +  abs(l[1]-cy)
    return ans

if len(l) == 1:
    print(l[0][0], l[0][1], l[0][2])
    exit()

for i in range(101):
    for j in range(101):
        for k in range(len(l)-1):
            if func2(i,j,l[k]) == func2(i,j,l[k+1]):
                if k == len(l)-2:
                    print(i, j, func2(i,j,l[k]))
                    exit()
            else:
                break

Buggy submission (verdict: Runtime Error):
n = int(input())
#x = []
#y = []
#h = []
l = []
for i in range(n):
    ex,ey,eh = map(int,input().split())
    #x.append(ex)
    #y.append(ey)
    #h.append(eh)
    if eh != 0:
        l.append([ex,ey,eh])

def func(cx,cy,l1,l2):
    ans1 = -abs(l1[0]-cx)+abs(l2[0]-cx)-abs(l1[1]-cy)+abs(l2[1]-cy)
    ans2 = l1[2]-l2[2]
    if ans1 == ans2:
        return True
    else:
        return False

def func2(cx,cy,l):
    ans = l[2] + abs(l[0]-cx) +  abs(l[1]-cy)
    return ans

cx = -1
cy = -1
flag = False
for i in range(101):
    for j in range(101):
        for k in range(n-1):
            if func(i,j,l[k],l[k+1]):
                if k == n-2:
                    cx = i
                    cy = j
                    flag = True
                    break
            else:
                break
        if flag:
            break
    if flag:
        break
h = func2(cx,cy,l[0])

print(cx, cy, h)
Problem p03262 (python)

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

def gcd(x1,x2):
    while x2 != 0:
        x1,x2 = x2, x1%x2
    return x1

for i in range(len(x)):
    x[i] = abs(x[i]-X)

ans = x[0]
for i in range(1,len(x)):
    ans = gcd(ans,x[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import math

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

for i in range(len(x)):
    x2.append(abs(x[i]-X))

gcd = x2[0]
for i in range(1,len(x2)):
    gcd = math.gcd(gcd,x2[i])
print(gcd)

Buggy submission (verdict: Runtime Error):
import math

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

for i in range(len(x)):
    x2.append(abs(x[i]-X))

gcd = x2[0]
for i in range(1,len(x2)-1):
    gcd = math.gcd(gcd,x2[i])
print(gcd)

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

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

for i in range(len(x)):
    x2.append(abs(x[i]-X))

gcd = functools.reduce(math.gcd, x2)
print(gcd)
Problem p03260 (python)

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

if a % 2 == 0 or b % 2 == 0:
    print('No')
else:
    print('Yes')

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

x_list.append(x)
x_list.sort()

min_diff = 99999999999
for i in range(len(x_list) - 1):
    diff = x_list[i + 1] - x_list[i]
    if min_diff > diff:
        min_diff = diff

# 差分の最小を約分していく
x_diff = [xx - x_list[0] for xx in x_list]

for i in range(1, min_diff):
    if min_diff % i != 0:  # 約分できない場合は次の数に進む
        continue
    xx = min_diff // i
    is_divided = [j for j in x_diff if j % xx != 0]
    if len(is_divided) == 0:
        print(xx)
        exit()
Problem p03262 (python)

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

if x in x_list:
    pass
else:
    x_list.append(x)
    x_list.sort()

min_diff = 99999999999
for i in range(len(x_list) - 1):
    diff = x_list[i + 1] - x_list[i]
    if min_diff > diff:
        min_diff = diff

# 差分の最小を約分していく
x_diff = [xx - x_list[0] for xx in x_list]

for i in range(1, min_diff):
    if min_diff % i != 0:  # 約分できない場合は次の数に進む
        continue
    xx = min_diff // i
    is_divided = [j for j in x_diff if j % xx != 0]
    if len(is_divided) == 0:
        print(xx)
        exit()
print(1)

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

x_list.append(x)
x_list.sort()

min_diff = 999_999_999_999
for i in range(len(x_list) - 1):
    diff = x_list[i + 1] - x_list[i]
    if min_diff > diff:
        min_diff = diff

# 差分の最小を約分していく
x_diff = [xx - x_list[0] for xx in x_list]

for i in range(1, min_diff):
    if min_diff % i != 0:  # 約分できない場合は次の数に進む
        continue
    xx = min_diff // i
    is_divided = [j for j in x_diff if j % xx != 0]
    if len(is_divided) == 0:
        print(xx)
        exit()
Problem p03294 (python)

Fixed submission:
from functools import reduce

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

def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)


a_lcm = reduce(lambda x, y: (x * y) // gcd(x, y), a)
m = a_lcm - 1
a_mod = [m % ax for ax in a]

print(sum(a_mod))

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

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

a_lcm = reduce(lambda x, y: (x * y) // math.gcd(x, y), a)
m = a_lcm - 1
a_mod = [m % ax for ax in a]

print(sum(a_mod))