qyliang/CodeNanoFix huggingface dataset:
Buggy code:
f=lambda:[*map(int,input().split())]
n,x=f()
l=f()
d=[l[i+1]-l[i] for i in range(n-1)]
a=x-l[0]
from math import *
for i in d:
  a=gcd(a,i)
print(a)

Fixed code:
f=lambda:[*map(int,input().split())]
n,x=f()
l=f()
d=[x-l[0]]
for i in range(n-1):
  d+=[l[i+1]-l[i]]
a=d[0]
from math import *
for i in d:
  a=gcd(a,i)
print(a)
Buggy code:
def lcm(a, b):
  if b > a:
    a, b = b, a
  
  while b != 0:
    a, b = b, a % b
  
  return a

city_num, start = map(int, input().split())

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

for i in range(len(cities)):
  cities[i] = abs(start - cities[i])

cities.sort()
  
a = reduce(lcm, cities)  

print(a)


Fixed code:
def lcm(a, b):
  if b > a:
    a, b = b, a
  
  while b != 0:
    a, b = b, a % b
  
  return a

city_num, start = map(int, input().split())

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

for i in range(len(cities)):
  cities[i] = abs(start - cities[i])

cities.sort()

a = cities[0]
for num in cities[1:]:
  a = lcm(a, num)
  
print(a)
Buggy code:
def gcd (a,b):
    if b == 0:
        return a
        
    return gcd(b, a % b)

inp = input().split()
inp = [int(x) for x in inp]

p = input().split()
p = [int(x) for x in p]

ans = gcd(abs(inp[1]-p[0]), abs(inp[1]-p[1]))
for i in range(len(p)):
    ans = gcd(ans, abs(inp[1]-p[i]))

print(ans)

Fixed code:
def gcd (a,b):
    if b == 0:
        return a
        
    return gcd(b, a % b)

inp = input().split()
inp = [int(x) for x in inp]

p = input().split()
p = [int(x) for x in p]

ans = gcd(abs(inp[1]-p[0]), abs(inp[1]-p[0]))
for i in range(len(p)):
    ans = gcd(ans, abs(inp[1]-p[i]))

print(ans)
Buggy code:
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return(a)

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

#x_list.append(X)
#x_list_new=sorted(x_list)
x_list_new_dif=[abs(x_list_new[i]-X) for i in range(len(x_list_new))]

for i in range(len(x_list_new_dif)):
    if i==0:
        skip=x_list_new_dif[0]
    else:
        skip=gcd(skip,x_list_new_dif[i])
print(skip)

Fixed code:
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return(a)

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

#x_list.append(X)
x_list_new=sorted(x_list)
x_list_new_dif=[abs(x_list_new[i]-X) for i in range(len(x_list_new))]

for i in range(len(x_list_new_dif)):
    if i==0:
        skip=x_list_new_dif[0]
    else:
        skip=gcd(skip,x_list_new_dif[i])
print(skip)
Buggy code:
n,X = map(int,input().split())
x = list(map(int,input().split()))
x.append(X)
x.sort()
a=[]
for i in range(n-1):
        a.append(x[i+1]-x[i])        

def gcd(m,n):
        while n!=0:
                s = m%n
                m = n
                n = s
        return m

ans=min(a)
for j in a:
        if j%min(a) != 0:
                ans = gcd(j,ans)
print(ans)

Fixed code:
n,X = map(int,input().split())
x = list(map(int,input().split()))
x.append(X)
x.sort()
a=[]
for i in range(len(x)-1):
        a.append(x[i+1]-x[i])        

def gcd(m,n):
        while n:
                m,n = n,m%n
        return m

ans=a[0]
for j in a:
        if j%ans != 0:
                ans = gcd(j,ans)
print(ans)
Buggy code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
def gcd(n,m):
  a=max(n,m)
  b=min(n,m)
  while b!=0:
    a,b=b,a%b
  return a
a=abs(l[0]-x)
for i in range(l):
  a=gcd(a,abs(l[i]-x))
print(a)

Fixed code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
def gcd(n,m):
  a=max(n,m)
  b=min(n,m)
  while b!=0:
    a,b=b,a%b
  return a
a=abs(l[0]-x)
for i in range(n):
  a=gcd(a,abs(l[i]-x))
print(a)
Buggy code:
N,X = map(int, input().split())
List = [int(x) for x in input().split()]

import math
List.append(X)
List.sort()

distance = []
for i in range(N):
    distance.append(List[i+1]-List[i])

d_min = min(distance)

num_list = []

c = 1
while c <= math.sqrt(d_min):
    if d_min%c == 0:
        num_list.append(c)
    c += 1

num_list2 = [1]*len(num_list)
for i in range(len(num_list)):
    num_list2[len(num_list)-i-1] = int(d_min/num_list[i])

num_list = num_list + num_list2


j = len(num_list)-1
c2 = 0
while j >= 0:
    for k in range(len(distance)):
        if distance[k]%num_list[j] == 0:
            c2 += 1
    if c2 == len(distance):
        ans = num_list[j]
        j = 0
    j -= 1

print(ans,distance,num_list)

Fixed code:
N,X = map(int, input().split())
List = [int(x) for x in input().split()]
 
import math
List.append(X)
List.sort()
 
distance = []
for i in range(N):
    distance.append(List[i+1]-List[i])
 
d_min = min(distance)
 
num_list = []
 
c = 1
while c <= math.sqrt(d_min):
    if d_min%c == 0:
        num_list.append(c)
    c += 1
 
num_list2 = [0]*len(num_list)
for i in range(len(num_list)):
    num_list2[len(num_list)-i-1] = int(d_min/num_list[i])
 
num_list = num_list + num_list2

num_list.append(d_min)

j = len(num_list)-1

while j >= 0:
    c2 = 0
    for k in range(len(distance)):
        if distance[k]%num_list[j] == 0:
            c2 += 1
    if c2 == len(distance):
        ans = num_list[j]
        j = 0
    j -= 1
 
print(ans)
Buggy code:
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)
  
n,x=map(int,input())
arr=list(map(int,input().split()))
arr.append(x)
arr=sorted(arr)
arr2=[]
for i in range(n-1):
  arr2.append(arr[i+1]-arr[0])
if n==1:
  print(abs(arr[0]-x))
else:
  ans=gcd(arr2[0],arr2[1])
  for i in range(1,n):
    ans=gcd(ans,arr2[i])
  print(ans)

Fixed code:
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)
  
n,x=map(int,input().split())
arr=list(map(int,input().split()))
arr.append(x)
arr=sorted(arr)
arr2=[]
for i in range(n):
  arr2.append(arr[i+1]-arr[0])
if n==1:
  print(arr2[0])
else:
  ans=gcd(arr2[0],arr2[1])
  for i in range(1,n):
    ans=gcd(ans,arr2[i])
  print(ans)
Buggy code:
def gcd(a, b):
    if (b == 0):
        return a
    return gcd(b, a % b)

n, x = map(int,input().split())
arr = list(map(int,input().split()))
diff = []
arr.sort()
g = 0
for i in range(n-1):
    diff.append(abs(arr[i]-arr[i+1]))
for item in diff:
    g = gcd(g,item)
print(g)

Fixed code:
def gcd(a, b):
    if (b == 0):
        return a
    return gcd(b, a % b)

n, x = map(int,input().split())
arr = list(map(int,input().split()))
diff = []
arr.sort()
g = abs(arr[0] - x)
for i in range(1,n):
    g = gcd(g, abs(arr[i] - x))
print(g)
Buggy code:
n, x = map(int, input().split())
xlis = list(map(int, input().split()))
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

d = gcd(abs(xlis[0]-x), abs(xlis[1]-x))
for i in range(2, n):
    d = gcd(d, abs(xlis[i]-x))
print(d)

Fixed code:
n, x = map(int, input().split())
xlis = list(map(int, input().split()))
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
if n > 1:
    d = gcd(abs(xlis[0]-x), abs(xlis[1]-x))
    for i in range(2, n):
        d = gcd(d, abs(xlis[i]-x))
    print(d)
else:
    print(abs(xlis[0] - x))
Buggy code:
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)
  divisors.append(n)
  return divisors
n,x=map(int,input().split())
y=list(map(int,input().split()))
y.append(x)
y.sort()
z=[]
for i in range(n-1):
  z.append(y[i+1]-y[i])
z.sort()
p=make_divisors(z[0])
a=[]
for i in p:
  for j in z:
    if j%i:
      break
  else:
    a.append(i)
print(max(a))

Fixed code:
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)
  divisors.append(n)
  return divisors
n,x=map(int,input().split())
y=list(map(int,input().split()))
y.append(x)
y.sort()
z=[]
for i in range(n):
  z.append(y[i+1]-y[i])
z.sort()
p=make_divisors(z[0])
a=[]
for i in p:
  for j in z:
    if j%i:
      break
  else:
    a.append(i)
print(max(a))
Buggy code:
n,x0=map(int,input().split())
x=list(map(int,input().split()))

def gcd(x,y):
    if y==0:
        return x
    else:
        return gcd(y,x%y)

ans=gcd(abs(x[0]-x0),abs(x[1]-x0))
for i in range(n):
    ans=gcd(ans,abs(x[0]-x0))
print(ans)

Fixed code:
n,x0=map(int,input().split())
x=list(map(int,input().split()))

def gcd(x,y):
    if y==0:
        return x
    else:
        return gcd(y,x%y)
if n==1:
    ans=abs(x[0]-x0)
else:
    ans=gcd(abs(x[0]-x0),abs(x[1]-x0))
    for i in range(n):
        ans=gcd(ans,abs(x[i]-x0))
print(ans)
Buggy code:
n,x = map(int,input().split())
s = list(map(int,input().split()))

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
        return a

for i in range(n):
    s[i] = s[i] - x

if s[0] != 0:
    t = s[0]
    for i in range(n-1):
        if s[i+1] == 0:
            continue
        else:
            t = gcd(t,s[i+1])
else:
    t = s[-1]
    for i in range(n-1):
        if s[-i-2] == 0:
            continue
        else:
            t = gcd(t,s[-i-1])

print(t)

Fixed code:
n,x = map(int,input().split())
s = list(map(int,input().split()))

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

for i in range(n):
    s[i] = abs(s[i] - x)

if s[0] != 0:
    t = s[0]
    for i in range(n-1):
        if s[i+1] == 0:
            continue
        else:
            t = gcd(t,s[i+1])
else:
    t = s[-1]
    for i in range(n-1):
        if s[-i-2] == 0:
            continue
        else:
            t = gcd(t,s[-i-1])

print(t)
Buggy code:
n,x=map(int,input().split())
pos=list(map(int,input().split()))
pos2=[abs(p-x) for p in pos]
def make_divisor_list(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return divisor_list

maxpos= max(pos2)
divs=make_divisor_list(maxpos)[::-1]
for j in divs:
    if all(x%j==0 for x in pos2):
        ans=j
        break
print(ans)

Fixed code:
n,x=map(int,input().split())
pos=list(map(int,input().split()))
pos2=[abs(p-x) for p in pos]
def make_divisor_list(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)
 
        return divisor_list

if n==1: ans=pos2[0]
else:
    minpos= min(pos2)
    divs=make_divisor_list(minpos)[::-1]
    if divs[0]==1:ans=1
    else:
        for j in divs:
            if all(x%j==0 for x in pos2):
                ans=j
                break
print(ans)
Buggy code:
import math
n,x=map(int,input().split())
a=list(map(int,input().split()))
x=[]
for i in a:
  x+=[abs(i-x)]
  
if len(x)==1:
  print(x[0])
  
else:
  pin=x[0]
  for i in range(1,len(x)):
    pin=math.gcd(pin,x[i])
    
  print(pin)

Fixed code:
import math
n,p=map(int,input().split())
a=list(map(int,input().split()))
x=[]
for i in a:
  x.append(abs(i-p))
  
if len(x)==1:
  print(x[0])
  
else:
  pin=x[0]
  for i in range(1,len(x)):
    pin=math.gcd(pin,x[i])
    
  print(pin)
Buggy code:
import numpy as np

def gcd_core(a, b):
    if b == 0:
        return a
    else:
        return gcd_core(b, a % b)

def gcd(arr):
    g = gcd_core(arr[0], arr[1])
    for i in range(2, len(arr)):
        g = gcd_core(g, arr[i])
    return g
n,x = map(int,input().split())
arr = list(map(int,input().split()))
arr = np.array(arr)
arr -= x
arr = np.abs(arr)
# print(arr)

print(gcd(arr))

Fixed code:
import numpy as np

def gcd_core(a, b):
    if b == 0:
        return a
    else:
        return gcd_core(b, a % b)

def gcd(arr):
    g = gcd_core(arr[0], arr[1])
    for i in range(2, len(arr)):
        g = gcd_core(g, arr[i])
    return g
n,x = map(int,input().split())
arr = list(map(int,input().split()))
arr = np.array(arr)
arr -= x
arr = np.abs(arr)
# print(arr)

if len(arr) == 1:
    print(arr[0])
else:
    print(gcd(arr))
Buggy code:
# -*- coding: utf-8 -*-
#ABC109C
import sys

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

tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))
n=hoge[0]
x=hoge[1]

tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))

res = x-hoge[0]
for i in range(1,n):
	res=gcd(res, hoge[i]-hoge[i-1])
print(res)


Fixed code:
# -*- coding: utf-8 -*-
#ABC109C
import sys

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

tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))
n=hoge[0]
x=hoge[1]

tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))

res = abs(x-hoge[0])
for i in range(1,n):
	res=gcd(res, abs(hoge[i]-hoge[i-1]))
print(res)
Buggy code:
def gcd(a,b):
    if a < b:
        a,b = b,a
    if a % b == 0:
        return b
    else:
        return gcd(b,(a % b))

N,X=map(int,input().split())
inputcities=list(map(int, input().split()))
cities=[abs(inputcities[i]-X) for i in range(N)].sort()
D=cities[0]
for i in range(N):
  D=gcd(D,cities[i])
print(D)

Fixed code:
def gcd(a,b):
    if a < b:
        a,b = b,a
    if a % b == 0:
        return b
    else:
        return gcd(b,(a % b))
 
N,X=map(int,input().split())
inputcities=list(map(int, input().split()))
cities=[abs(inputcities[i]-X) for i in range(N)]
cities.sort()
D=cities[0]
for i in range(N):
  D=gcd(D,cities[i])
print(D)
Buggy code:
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

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

x.append(X)
x.sort()

D = []
for n in range(N-1):
    D.append(x[n+1]-x[n])
    
ans = 0
for d in D:
    ans = gcd(ans,d)
    
print(ans)

Fixed code:
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

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

x.append(X)
x.sort()

D = []
for n in range(N):
    D.append(x[n+1]-x[n])
    
ans = 0
for d in D:
    ans = gcd(ans,d)
        
print(ans)
Buggy code:
import numpy as np


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


_, X = map(int, input().split())
x = np.array(list(map(int, input().split())))

X = np.array([X])
x = np.concatenate([x, X])
x.sort()

ans = x[0]
for i in x:
    ans = gcd(ans, i)

print(ans)

Fixed code:
import numpy as np


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


_, X = map(int, input().split())
x = np.array(list(map(int, input().split())))

X = np.array([X])

x = np.concatenate([x, X])
x.sort(0)
x = np.abs(np.diff(x))

ans = x[0]
for i in x:
    ans = gcd(ans, i)

print(ans)
Buggy code:
N,X=map(int,input().split())
x = list(map(int,input().split()))
if not X in x:
    x.append(X)
x.sort()
d = []
for i in range(len(x)-1):
    d.append( x[i+1] - x[i] )

def GCD(a,b):
    if a%b==0: return b
    return GCD(b,a%b)

g = d[0]
lcm = d[0]
for i in range( len(d)-1 ):
    lcm = g * d[i+1] // GCD(g,d[i+1])
print(lcm)



Fixed code:
N,X=map(int,input().split())
x = list(map(int,input().split()))
if not X in x:
    x.append(X)
x.sort()
d = []
for i in range(len(x)-1):
    d.append( x[i+1] - x[i] )

def GCD(a,b):
    if a%b==0: return b
    return GCD(b,a%b)

g = d[0]
for i in range( len(d)-1 ):
    g = GCD(g,d[i+1])
print(g)
Buggy code:
def gcd(a,b):
  while b:
    a,b = b, a % b
    return a

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

ans = x[0] - X

for i in range(1,N):
  ans = gcd(ans, x[i] - X)

print(abs(ans))

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

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

ans = x[0] - X

for i in range(1,N):
  ans = gcd(ans, x[i] - X)

print(abs(ans))
Buggy code:

c, d = (int(i) for i in input().split())  
a = [int(i) for i in input().split()]
b = a.copy()

k = 0
for i in a:
    b[k] = abs(i - d)
    k += 1

m = min(b) 

lo = []

while i > 0:
    if m% i == 0: 
        lo.append(i)
    i -=1

    
def dec():
    k = 0
    for i in lo:
        for j in b:
            if j%i ==0:
                k+=1
        if k==len(b):
            return i
                
print(dec())



Fixed code:
c, d = (int(i) for i in input().split())  
a = [int(i) for i in input().split()]
b = a.copy()
 
k = 0
for i in a:
    b[k] = abs(i - d)
    k += 1
 
m = min(b) 
 
def dec():
 
    i = m
    while i > 0:
        if m% i == 0: 
            k = 0
            for j in b:
                if j%i ==0:
                    k +=1
                if k==len(b):
                    return i
                
            if i == m:
                i -= i//2
                
        i -=1
 
 
 
 
                
print(dec())
Buggy code:
def gcd(a, b):
    if b==0: return a
    else: return gcd(b, a%b)
n, x = map(int, input().split())
L = list(map(int, input().split()))
d = 100
for l in L:
    d = gcd(d, abs(x-l))
print(d)


Fixed code:
def gcd(a, b):
    if b==0: return a
    else: return gcd(b, a%b)
n, x = map(int, input().split())
L = list(map(int, input().split()))
d = 0
for l in L:
    d = gcd(d, abs(x-l))
print(d)
Buggy code:
n,x = map(int, input().split())
city = []
sub = []
city = list(map(int, input().split()))

for i in range(len(city)):
	sub.append(abs(x - city[i]))

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

p = gcd(sub[0], sub[1])
for i in range(2,len(sub)):
	ans = gcd(p,sub[i])

print(ans)

Fixed code:
n,x = map(int, input().split())
city = []
sub = []
city = list(map(int, input().split()))

for i in range(len(city)):
	sub.append(abs(x - city[i]))

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


if len(sub) == 1:
	print(sub[0])
elif len(sub) == 2:
	print(gcd(sub[0],sub[1]))
else:
	p = gcd(sub[0], sub[1])
	for i in range(2,len(sub)):
		p = gcd(p,sub[i])
	print(p)
Buggy code:
n,x=map(int,input().split())
a=sorted(list(map(int,input().split())))
b=[a[i+1]-a[i]for i in range(n-1)]
b.insert(0,a[0]-x)

def search_common_divisor(x,y):
    if x<y:
        x,y=y,x
    while y!=0:
        x,y=y,x%y
    return x

def search_list_common_divisor(*numbers):
    b=[search_common_divisor(numbers[0],numbers[1])]
    for i in numbers:
        b.append(search_common_divisor(b[-1],i))
    return b[-1]


if n!=1:
    print(search_list_common_divisor(*b))
else:
    print(b[0])


Fixed code:
n,x=map(int,input().split())
a=sorted(list(map(int,input().split())))
b=[a[i+1]-a[i]for i in range(n-1)]
b.insert(0,abs(a[0]-x))

def search_common_divisor(x,y):
    if x<y:
        x,y=y,x
    while y!=0:
        x,y=y,x%y
    return x

def search_list_common_divisor(*numbers):
    b=[search_common_divisor(numbers[0],numbers[1])]
    for i in numbers:
        b.append(search_common_divisor(b[-1],i))
    return b[-1]


if n!=1:
    print(search_list_common_divisor(*b))
else:
    print(b[0])
Buggy code:
N,X = map(int,input().split())
u = list(map(int,input().split()))
def gcd_list(numbers):
    gct = numbers[0]
    for i in range(len(numbers)-1):
        r = numbers[i+1] % gct
        while r != 0:
            ka = r
            r = gct
            gct = ka
            r = r % gct
    return gct
u.append(X)
u.sort()
sa = []
for i in range(len(u)-2):
    sa.append(u[i+1]-u[i])
print(gcd_list(sa))

Fixed code:
N,X = map(int,input().split())
u = list(map(int,input().split()))
def gcd_list(numbers):
    gct = numbers[0]
    for i in range(len(numbers)-1):
        r = numbers[i+1] % gct
        while r != 0:
            ka = r
            r = gct
            gct = ka
            r = r % gct
    return gct
u.append(X)
u.sort()
sa = []
for i in range(len(u)-1):
    sa.append(u[i+1]-u[i])
if len(sa) > 1:
    print(gcd_list(sa))
else:
    print(sa[0])
Buggy code:
def gcd(a,b):
    if b == 0:
        return abs(a)
    else:
        return gcd(b, a%b)


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

if not(St in X):
    X.append(St)
X = sorted(X)

del_X = []
for i in range(len(X)-1):
    del_X.append(X[i+1] - X[i])
del_X = sorted(list(set(del_X)))

# print(X)
# print(del_X)

for i in range(len(del_X)):
    if i == 0:
        tmp = gcd(del_X[i],del_X[i])
    else:
        tmp = gcd(tmp, X_del[i])
print(tmp)


Fixed code:
def gcd(a,b):
    if b == 0:
        return abs(a)
    else:
        return gcd(b, a%b)


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

X.append(St)
X = sorted(X)

del_X = []
for i in range(N):
    del_X.append(X[i+1] - X[i])
del_X = sorted(list(set(del_X)))

# print(X)
# print(del_X)

for i in range(len(del_X)):
    if i == 0:
        tmp = gcd(del_X[i],0)
    else:
        tmp = gcd(tmp, del_X[i])
print(tmp)
Buggy code:
N, X = map(int, input().split())
x_lst = [int(i) for i in input().split()]
# N, X = map(int, '3 81'.split())
# x_list = [abs(int(i) - X) for i in '33 105 57'.split()]
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
res = [x_list[0]]
for i in range(1, N):
    res.append(gcd(res[i-1], x_list[i]))
print(min(res))

Fixed code:
N, X = map(int, input().split())
x_list = [abs(int(i) - X) for i in input().split()]
# N, X = map(int, '3 81'.split())
# x_list = [abs(int(i) - X) for i in '33 105 57'.split()]
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
res = [x_list[0]]
for i in range(1, N):
    res.append(gcd(res[i-1], x_list[i]))
print(min(res))
Buggy code:
#! /usr/bin/env python3

# from fractions import gcd
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

from functools import reduce

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

N, X = [int(_) for _ in input().split()]
x = [int(_) for _ in input().split()]

ret = []
x.append(X)
now = x[0]

for i in x[1:]:
    ret += [i - now]
    now = i

ret = sorted(ret)

print(gcd_list(ret))

Fixed code:
#! /usr/bin/env python3

# from fractions import gcd
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

from functools import reduce

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

N, X = [int(_) for _ in input().split()]
x = [int(_) for _ in input().split()]

if N != 1:
    ret = []
    x.append(X)
    now = x[0]

    for i in x[1:]:
        ret += [i - now]
        now = i

    ret = sorted(ret)

    print(gcd_list(ret))

else:
    print(abs(x[0] - X))
Buggy code:
N, X = map(int, input().split())
x = list(map(int, input().split()))
d = []
min=abs(x[0]-X)
for i in range(N):
    d.append(abs(x[i] - X))

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

g = gcd(d[0], d[1])
for i in range(2,N):
    g=gcd(g,d[i])
print(g)

Fixed code:
N, X = map(int, input().split())
x = list(map(int, input().split()))
d = []
min=abs(x[0]-X)
for i in range(N):
    d.append(abs(x[i] - X))

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

if len(d) == 1:
    print(d[0])
else:    
    g = gcd(d[0], d[1])
    for i in range(2,N):
        g=gcd(g,d[i])
    print(g)