Problem:


Score : 300 points

Problem Statement

There are N cities on a number line. The i-th city is located at coordinate x_i.

Your objective is to visit all these cities at least once.

In order to do so, you will first set a positive integer D.

Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like:

Move 1: travel from coordinate y to coordinate y + D.

Move 2: travel from coordinate y to coordinate y - D.

Find the maximum value of D that enables you to visit all the cities.

Here, to visit a city is to travel to the coordinate where that city is located.

Constraints

All values in input are integers.

1 \leq N \leq 10^5

1 \leq X \leq 10^9

1 \leq x_i \leq 10^9

x_i are all different.

x_1, x_2, ..., x_N \neq X

Input

Input is given from Standard Input in the following format:

N X
x_1 x_2 ... x_N

Output

Print the maximum value of D that enables you to visit all the cities.

Sample Input 1

3 3
1 7 11

Sample Output 1

2

Setting D = 2 enables you to visit all the cities as follows, and this is the maximum value of such D.

Perform Move 2 to travel to coordinate 1.

Perform Move 1 to travel to coordinate 3.

Perform Move 1 to travel to coordinate 5.

Perform Move 1 to travel to coordinate 7.

Perform Move 1 to travel to coordinate 9.

Perform Move 1 to travel to coordinate 11.

Sample Input 2

3 81
33 105 57

Sample Output 2

24

Sample Input 3

1 1
1000000000

Sample Output 3

999999999



Sample input:
3 3
1 7 11


Sample output:
2

Submission status: Runtime Error

Solution code:
N,X=map(int,input().split())
x=list(map(int,input().split()))+[X]

from fractions import gcd

x=[x[i+1]-x[i] for i in range(N)]

def gcd_many(_list):
    if len(_list)==1:
        return abs(_list[0])
    elif len(_list)==2:
        return gcd(_list[0],_list[1])
    else:
        return gcd(_list[0],gcd_many(_list[1:]))
        
print(abs(gcd_many(x)))

Submission status: Runtime Error

Solution code:
N,X=map(int,input().split())
x=list(map(int,input().split()))+[X]

from fractions import gcd

x=[x[i+1]-x[i] for i in range(N)]

def gcd_many(_list):
    if len(_list)==1:
        return abs(_list[0])
    elif len(_list)==2:
        return gcd(_list[0],_list[1])
    else:
        return gcd(_list[0],gcd_many(_list[1:]))
        
print(gcd_many(x))

Submission status: Runtime Error

Solution code:
N,X=map(int,input().split())
x=list(map(int,input().split()))+[X]

from fractions import gcd

x=[x[i+1]-x[i] for i in range(N)]

def gcd_many(_list):
    if len(_list)==2:
        return gcd(_list[0],_list[1])
    else:
        return gcd(_list[0],gcd_many(_list[1:]))
        
print(gcd_many(x))

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

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

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

# INPUT
n, x = map(int, input().split())
capitals = list(map(int, input().split()))

# PROCESS
distance_cap = list(map(lambda c: abs(x-c), capitals))
answer = gcd_list(distance_cap)

# OUTPUT
print(answer)

Submission status: Runtime Error

Solution code:
# coding: utf-8
import time
import re
import math

def main():
    n,start=map(int,input().split())
    X=list(map(int,input().split()))
    mx=0
    dmx=0
    for a in X:
        dmx=max([dmx,abs(start-x)])
    for D in range(1,dmx+1):
        f=1
        for a in range(n):
            if (X[a]-start)%D!=0:
                f=0
        if f==1:
            mx=max([mx,D])
    print(mx)
main()

Submission status: Runtime Error

Solution code:
n,x = list(map(int,input().split()))
data = [int(s) for s in input().split()]
dis = [None] * (n-1)
#distanceの生成
for i in range(n-1):
    dis[i] = abs(data[i+1] - data[i])
if n == 1:
    print(abs(data[0]-x))
    exit()
dis.sort()
#distanceのGCD
ans = 0
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

for i in range(n-2):
    dis[i+1] = gcd(dis[i+1],dis[i])
    
print(dis[i+1])

Submission status: Runtime Error

Solution code:
n,x = list(map(int,input().split()))
data = [int(s) for s in input().split()]
dis = [None] * (n-1)
#distanceの生成
for i in range(n-1):
    dis[i] = abs(data[i+1] - data[i])
if n == 1:
    print(abs(data[0]-x))
    exit()
dis.sort()
#distanceのGCD
ans = 0
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)
for i in range(n-1):
    ans = gcd(dis[i+1],dis[i])
    
print(ans)

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

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

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

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

print(gcd_list(x))

Submission status: Runtime Error

Solution code:
from functools import reduce
from math import gcd

N, X = map(int, input().split())
x = list(map(int, input().split()))
x.append(X)
x.sort()
diff = []
for i in range(N):
    diff.append(x[i+1] - x[i])

print(reduce(gcd, diff))

Submission status: Runtime Error

Solution code:
import math

n,x = map(int,input().split())

def dist(n):
    return abs(int(n)-x)

a = list(map(dist,input().split()))

ans = a[n-1]

for i in range(n):
    ans = math.gcd(ans,a[i])

print(ans)

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

n,x = map(int,input().split())

def dist(n):
    return abs(int(n)-x)

a = list(map(dist,input().split()))

def gcds(*s):
    return reduce(math.gcd, s)

print(gcds(*a))

Submission status: Runtime Error

Solution code:
import math

n,x = map(int,input().split())

ans = abs(int(input())-x)

if n > 1:
	for _ in range(n-1):
  		ans = math.gcd(ans, abs(int(input())-x) )

print(ans)

Submission status: Runtime Error

Solution code:
from math import gcd
N, X = map(int, input().split())
x = list(map(int, input().split()))
l = []
for xx in x:
    l.append(abs(xx - X))

g = l[0]

for i in range(1, len(l)):
    g = gcd(g, l[i])

print(g)

Submission status: Runtime Error

Solution code:
N,X = [int(i) for i in input().split()]
L = [int(i) for i in input().split()]

P = [0]*N
P[0] = abs(min(L) - X)
for i in range(1,N):
    P[i] = abs(L[i]-L[i-1])

def gcd( x, y ):
    while y != 0:
        x, y = y, x%y
    return x

ans = gcd(P[0],P[1])

for i in range(2,N):
    ans = gcd(ans,P[i])

print(ans)

Submission status: Runtime Error

Solution code:
from functools import reduce
from fractions import gcd

N,X=map(int,input().split())
x=[abs(i-X) for i in input().split()]

print(reduce(gcd,x))

Submission status: Runtime Error

Solution code:
import functools
import fractions
N, X = [int(i) for i in input().split()]
X_N = [int(i) for i in input().split()]
list = []
for e in [int(i) for i in input().split()]:
    list.append(abs(e - X))
gcd = functools.reduce(fractions.gcd, list)
print(gcd)

Submission status: Runtime Error

Solution code:
# PROXY

import functools
import fractions
N, X = [int(i) for i in input().split()]
X_N = [int(i) for i in input().split()]
list = []
for e in [int(i) for i in input().split()]:
    list.append(abs(e - X))
gcd = functools.reduce(fractions.gcd, list)
print(gcd)

Submission status: Runtime Error

Solution code:
# PROXY

import functools
import math
N, X = [int(i) for i in input().split()]
X_N = [int(i) for i in input().split()]
list = []
for e in [int(i) for i in input().split()]:
    list.append(abs(e - X))
gcd = functools.reduce(math.gcd, list)
print(gcd)

Submission status: Runtime Error

Solution code:
import math

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

if N == 1:
    print(x[0] - X)

else:
    diff = []

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

    g = math.gcd(diff[0],diff[1])

    for i in range(1,len(diff)):
        g = math.gcd(g,diff[i])

    print(g)

Submission status: Runtime Error

Solution code:
import fractions

N,X = map(int,input().split())
x = [int(i) for i in input().split()]
x.append(X)
x.sort()
y = [0]*N
for i in range(N):
    y[i] = x[i+1]-x[i]

answer = fractions.gcd(y[0],y[1])
for i in range(2,N):
    answer = fractions.gcd(answer,y[i])

print(answer)

Submission status: Runtime Error

Solution code:
import fractions

N,X = map(int,input().split())
x = [int(input()) for i in range(N)]
x.append(X)
x.sort()
y = [0]*N
for i in range(N):
    y[i] = x[i+1]-x[i]

answer = fractions.gcd(y[0],y[1])
for i in range(2,N):
    answer = fractions.gcd(answer,y[i])

print(answer)

Submission status: Runtime Error

Solution code:
from math import gcd
N, X = map(int, input().split())
l = list(map(int, input().split()))
g = X - l[0]
for i in l[1:N]:
	if i == X: continue
	g = gcd(g, abs(X-i))

print(abs(g))

Submission status: Runtime Error

Solution code:
N, X = map(int, input().split())
l = list(map(int, input().split()))
g = X - l[0]
from math import gcd
for i in l[1:N]:
	if i == X: continue
	g = gcd(g, abs(X-i))

print(abs(g))

Submission status: Runtime Error

Solution code:
n,x = map(int,input().split())
s = list(map(int,input().split()))
import math
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 = math.gcd(t,s[i+1])
else:
    t = s[-1]
    for i in range(n-1):
        if s[-i-2] == 0:
            continue
        else:
            t = math.gcd(t,s[-i-1])

print(t)

Submission status: Runtime Error

Solution code:
n,x = map(int,input().split())
s = list(map(int,input().split()))
import math
for i in range(n):
    s[i] = s[i] - x

t = s[0]
for i in range(n-1):
    t = math.gcd(t,s[i+1])

print(t)

Submission status: Runtime Error

Solution code:
N, *X = map(int, open(0).read().split())
X.sort()
y = []
for i in range(N):
  y.append(X[i + 1] - X[i])

ans = y[0]
for v in y[1:]:
  ans = gcd(ans, v)
print(ans)

Submission status: Runtime Error

Solution code:
from functools import reduce

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

if X not in x_list:
    x_list.append(X).sort()
    N += 1    

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

if N >= 3:
    space = [abs(x_list[i + 1] - x_list[i]) for i in range(N - 1)]
    print(reduce(gcd, space))
elif N == 2:
    space = x_list[1] - x_list[0]
    print(space)
elif N == 1:
    space = x_list[0]
    print(space)

Submission status: Runtime Error

Solution code:
import math

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

if N != 1:
    A = [0]*(N-1)
    for i in range(N-1):
        A[i] = x[i+1]-x[i]

    a = A[0]
    for i in range(N-1):
        a = math.gcd(a,A[i])
    print(a)
else:
    print(x[1]-x[0])

Submission status: Runtime Error

Solution code:
from sys import stdin
import math

N, X = [int(k) for k in stdin.readline().rstrip().split()]
x = [int(k) for k in stdin.readline().rstrip().split()]
y = [abs(k - X) for k in x]
C = y[0]
for l in range(N):
    C = math.gcd(C, y[l])
print(C)

Submission status: Runtime Error

Solution code:
def gcd(*args):
    a, *args = args
    if len(args) == 0:
        return a
    elif len(args) > 1:
        return gcd(a, gcd(*args))
    else:
        b = args[0]
        if a < b:
            a, b = b, a
        while b != 0:
            a, b = b, a % b
        return a


n, x = map(int, input().split())
c = [abs(x - xn) for xn in map(int, input().split())]
print(gcd(*c))

Submission status: Runtime Error

Solution code:
# ABC109C - Skip
from math import gcd

n, x = list(map(int, input().rstrip().split()))
lst = list(map(int, input().rstrip().split()))
d = abs(x - lst[0])
for i in range(n):
    dif = abs(x - lst[i])
    if dif % d == 0:
        continue
    d = gcd(d, dif)
print(d)

Submission status: Runtime Error

Solution code:
# ABC109C - Skip
from math import gcd

n, x = list(map(int, input().rstrip().split()))
lst = list(map(int, input().rstrip().split()))
d = abs(x - lst[0])
for i in range(n):
    dif = abs(x - lst[i])
    if dif % d == 0:
        continue
    else:
        d = gcd(d, dif)
print(d)

Submission status: Runtime Error

Solution code:
import math
N,X = map(int,input().split())
x = [int(_) for _ in input().split()]
y = [x[i]-X for i in range(N)]
ans = 0
for i in range(N):
    ans = math.gcd(ans,y[i])
print(ans)

Submission status: Runtime Error

Solution code:
N,X=map(int,input().split())
x=list(map(int,input().split()))
l=[]
for i in range(N):
    l.append(abs(X-x[i]))
from hase import gcd

ll=[0]*(N+1)
for i in range(N):
    ll[i+1]=gcd(ll[i],l[i])
print(ll[N])

Submission status: Runtime Error

Solution code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N,X = [int(x) for x in input().split()]
xls = sorted([int(x) for x in input().split()])

sublist =[]
for i in range(N-1):
    sublist.append(xls[i+1]-xls[i])
sublist.sort()
m = min(sublist)



a =[]
for i in range(1,m+1):
    count = 0
    for j in sublist:
        if j%i == 0:
            count += 1
    if count == len(sublist):
        a.append(i)

b = list(reversed(a))

count = 0

while True:
    
    if (abs(xls[0]-X)) % b[count] == 0:
        print(b[count])
        break
    else:
        count+= 1

Submission status: Runtime Error

Solution code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N,X = [int(x) for x in input().split()]
xls = [int(x) for x in input().split()]

sublist =[]
for i in range(N-1):
    sublist.append(xls[i+1]-xls[i])
sublist.sort()
m = min(sublist)


a =[]
for i in range(i,m+1):
    count = 0
    for j in sublist:
        if j%i == 0:
            count += 1
    if count == len(sublist):
        a.append(i)

b = list(reversed(a))
print(b)
count = 0
while True:
    
    if (xls[0]-X) % b[count] == 0:
        print(b[count])
        break
    else:
        count+= 1

Submission status: Runtime Error

Solution code:
# coding: utf-8
import math
from functools import reduce

N,X = map(int,input().split())
xs = sorted(list(map(int,input().split())))
l = []

def main():
    l.append(min([(max(xs) - X),(X - min(xs))]))
    for i in range(len(xs)-1):
        l.append(xs[i+1] - xs[i])
    print(abs(gcd_list(l)))

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

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
# coding: utf-8
import math
from functools import reduce

N,X = map(int,input().split())
xs = sorted(list(map(int,input().split())))
l = []

def main():
    l.append(min([(max(xs) - X),(X - min(xs))]))
    for i in range(len(xs)-1):
        l.append(xs[i+1] - xs[i])
    print(abs(gcd_list(l)))

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

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
# coding: utf-8
import math
from functools import reduce

N,X = map(int,input().split())
xs = sorted(list(map(int,input().split())))
l = []

def main():
    print(xs)
    l.append(min([(max(xs) - X),(X - min(xs))]))
    for i in range(len(xs)-1):
        l.append(xs[i+1] - xs[i])

    print(abs(gcd_list(l)))

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

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def gcd(a,b) :
    if b>0 :
        return gcd(b,a % b)
    elif b == 0:
        return a


N,X = map(int,input().split())
x = list(map(int,input().split()))
if N == 1:
    print(abs(x[0] - X))
else:
    xlen = []
    for i in range(N):
        xlen.append(x[i] - X)
    ans = xlen[0]
    for i in range(1,N):
        ans = gcd(ans,xlen[i])
    print(ans)

Submission status: Runtime Error

Solution code:
import math

N,X = map(int,input().split())
x = list(map(int,input().split()))
if N == 1:
    print(abs(x[0] - X))
else:
    xlen = []
    for i in range(N):
        xlen.append(x[i] - X)
    ans = xlen[0]
    for i in range(1,N):
        ans = math.gcd(ans,xlen[i])
    print(ans)

Submission status: Runtime Error

Solution code:
import math

N,X = map(int,input().split())
x = list(map(int,input().split()))
if N == 1:
    print(abs(x[0] - X))
else:
    xlen = [abs(x[0]-X)]
    for i in range(N-1):
        xlen.append(x[i+1] - X)
    ans = xlen[0]
    for i in range(1,N):
        ans = math.gcd(ans,xlen[i])
    print(ans)

Submission status: Runtime Error

Solution code:
import math

N,X = map(int,input().split())
x = list(map(int,input().split()))
if N == 1:
    print(abs(x[0] - X))
else:
    xlen = [abs(x[0]-X)]
    for i in range(N-1):
        xlen.append(x[i+1]- x[i])
    ans = xlen[0]
    for i in range(1,N):
        ans = math.gcd(ans,xlen[i])
    print(ans)

Submission status: Runtime Error

Solution code:
import math

N,X = map(int,input().split())
x = list(map(int,input().split()))
if N == 1:
    print((x[0] - X))
else:
    xlen = [(x[0]-X)]
    for i in range(N-1):
        xlen.append(x[i+1]- x[i])
    ans = xlen[0]
    for i in range(1,N):
        ans = math.gcd(ans,xlen[i])
    print(ans)

Submission status: Runtime Error

Solution code:
import math

N,X = map(int,input().split())
x = list(map(int,input().split()))
if N == 1:
    print(abs(x[0] - X))
else:
    xlen = [abs(x[0]-X)]
    for i in range(N-1):
        xlen.append(x[i+1]- x[i])
    ans = xlen[0]
    for i in range(N-1):
        ans = math.gcd(ans,xlen[i+1])
    print(ans)

Submission status: Runtime Error

Solution code:
import math

N,X = map(int,input().split())
x = list(map(int,input().split()))
if N == 1:
    print(abs(x[0] - X))
else:
    xlen = [abs(x[0]-X)]
    for i in range(N-1):
        xlen.append(x[i+1]- x[i])
    ans = xlen[0]
    for i in range(N-2):
        ans = math.gcd(ans,xlen[i+1])
    print(ans)

Submission status: Runtime Error

Solution code:
def gcd(l):
    if len(l) == 1:
        return l[0]

    return gcd([gcd2(l[0], l[1])] + l[2:])


def gcd2(a, b):
    if b == 0:
        return a

    return gcd2(b, a % b)


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

x = [abs(xi - s) for xi in x]
print(gcd(x))

Submission status: Runtime Error

Solution 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-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)

Submission status: Runtime Error

Solution 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)

Submission status: Runtime Error

Solution code:
from fractions import gcd


def liner_search(n, l):
    for i in range(len(l)):
        if n < l[i]:
            return i
    return len(l)


N, X = map(int, input().split())
x = sorted(list(map(int, input().split())))
x.insert(liner_search(X, x), X)
sabun = [None] * N
for i in range(1, len(x)):
    sabun[i - 1] = x[i] - x[i - 1]
res = gcd(sabun[0], sabun[1])
for i in range(1, len(sabun)):
    res = gcd(res, sabun[i])
print(res)

Submission status: Runtime Error

Solution code:
def liner_search(n, l):
    for i in range(len(l)):
        if n <= l[i]:
            return i


N, X = map(int, input().split())
x = sorted(list(map(int, input().split())))
x.insert(liner_search(X, x), X)
sabun = [None] * N
for i in range(1, len(x)):
    sabun[i - 1] = x[i] - x[i - 1]
print(sorted(sabun)[0])

Submission status: Runtime Error

Solution code:

import numpy as np

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

x = np.abs(x)

M = x[0]
from fractions import gcd

for i in x[1:]:
  M = gcd(M, i)

print(M)

Submission status: Runtime Error

Solution code:
n,x=map(int,input().split())
x_list=list(map(int,input().split()))
d_list=[]
for i in x_list:
    d_list.append(abs(x-i))
import fractions
answer=fractions.gcd(d_list[0],d_list[1])
for i in range(2,n):
    answer=fractions.gcd(answer,d_list[i])
print(answer)

Submission status: Runtime Error

Solution code:
from math import gcd
N, X = map(int, input().split())
x_list = list(map(int, input().split()))
kyori_list = [abs(X-i) for i in x_list]
ans_gcd = kyori_list[0]
for i in kyori_list[1:]:
    ans_gcd = gcd(ans_gcd, i)
print(ans_gcd)

Submission status: Runtime Error

Solution code:
N,X=map(int,input().split())

from math import gcd

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

kyori_list = [abs(X-i) for i in x_list]

ans_gcd = kyori_list[0]
for i in kyori_list[1:]:
    ans_gcd = gcd(ans_gcd, i)
print(ans_gcd)

Submission status: Runtime Error

Solution code:
from math import gcd
N, X = map(int, input().split())
x = [abs(X - i) for i in map(int, input().split())]
d = x[0]
for X in x[1:]:
    d = gcd(d,X)
print(d)

Submission status: Runtime Error

Solution code:
N, X =map(int,input().split())
x = list(map(int,input().split()))
result = abs(abs(np.array(x))-X)
import fractions
D= result[0]
for i in range (1,len(result)):
    D=fractions.gcd(D,result[i])
print(D)

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if b > 0:
        return gcd(b,a%b)
    elif b == 0:
        return a

N,X = map(int,input().split())
x = list(map(int,input().split()))
if N == 1:
    print(abs(x[0] - X))
else:
    xlen = [abs(x[0]-X)]
    for i in range(N-1):
        xlen.append(x[i+1]- x[i])
    ans = xlen[0]
    for i in range(N-2):
        ans = gcd(ans,xlen[i+1])
    #print(ans)
    print(ans)

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if b > 0:
        return gcd(b,a%b)
    elif b == 0:
        return a

N,X = map(int,input().split())
x = list(map(int,input().split()))
xlen = [abs(x[0]-X)]
for i in range(N-1):
    xlen.append(x[i+1]- x[i])
ans = xlen[0]
for i in range(N-2):
    ans = gcd(ans,xlen[i+1])
    #print(ans)
print(ans)

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

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

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

y = (i-X for i in x)
print(gcd(y))

Submission status: Runtime Error

Solution 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)

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

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

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

if __name__ == "__main__":
    a = input().split()
    b = input().split()
    c = []
    for num in b:
        c.append(abs(int(num)-int(a[1])))
    print(gcd_list(c))

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

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

if __name__ == "__main__":
    a = input().split()
    b = input().split()
    c = []
    for num in b:
        c.append(abs(int(num)-int(a[1])))
    print(gcd_list(c))

Submission status: Runtime Error

Solution code:
N, X = map(int, input().split())
x = [abs(X - int(i)) for i in input().split()]

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

tmp = 1
for i in range(len(x)-1):
    x[i+1] = f(x[i], x[i+1])

print(x[len(x)])

Submission status: Runtime Error

Solution code:
import math
from functools import reduce
n,X=map(int,input().split())
x=list(map(int,input().split()))
y=[]
for i in range(n):
  y.append(abs(x[i]-X))
def GCD(*numbers):
  return reduce(math.gcd,numbers)
print(GCD(*y))

Submission status: Runtime Error

Solution code:
import math
from functools import reduce
n,X=map(int,input().split())
x=list(map(int,input().split()))
y=[]
for i in range(n):
  y.append(abs(x[i]-X))
def gcd(*numbers):
  return reduce(math.gcd,numbers)
print(gcd(*y))

Submission status: Runtime Error

Solution code:
import math
from functools import reduce
n,X=map(int,input().split())
x=list(map(int,input().split()))
y=[]
for i in range(n):
  y.append(abs(x[i]-X))
def gcd(*numbers):
  return reduce(math.gcd,numbers)
print(gcd(y))

Submission status: Runtime Error

Solution code:
from functools import reduce
import math
n,X=map(int,input().split())
x=list(map(int,input().split()))
y=[]
for i in range(n):
  y.append(x[i]-X)
def gcd(*numbers):
  return reduce(math.gcd,numbers)
print(gcd(y))

Submission status: Runtime Error

Solution code:
from functools import reduce
import math
n,X=map(int,input().split())
x=list(map(int,input().split()))
for i in range(n):
  x[i]=x[i]-X
def gcd(*numbers):
  return reduce(math.gcd,numbers)
print(gcd(x))

Submission status: Runtime Error

Solution code:
import math
import functools
N,X = map(int,input().split())
Visits = [abs(int(i)-X) for i in input().split()]
print(functools.reduce(math.gcd, Visits))

Submission status: Runtime Error

Solution code:
import math

n, start = list(map(int, input().split()))
x = list(map(int, input().split()))

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

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

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

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


def main():
    num, start = map(int, input().split())
    data = list(map(int, input().split()))
    kyori = [0 for i in range(num)]

    for i in range(num):
        kyori[i] = abs(data[i] - start)

    ans = gcd(*kyori)

    print(ans)





if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import math

N, X = map(int, input().split())
cities = list(map(int, input().split()))
cities.append(X)
cities.sort()
distances = list(map(lambda x: cities[x + 1] - cities[x], range(len(cities) - 1)))
ans = distances[0]
for distance in distances:
    ans = math.gcd(ans, distance)
print(ans)

Submission status: Runtime Error

Solution code:
import math
import reduce 

n,x = map(int,input().split())
city = list(map(int,input().split()))
dist = [abs(city[i]-x) for i in range(len(city))]

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

print(int(gcd(*dist))

Submission status: Runtime Error

Solution code:
import math
from functools import reduce 

n,x = map(int,input().split())
city = list(map(int,input().split()))
dist = [abs(city[i]-x) for i in range(len(city))]

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

print(int(gcd(*dist)))

Submission status: Runtime Error

Solution code:
import math
from functools import reduce 

n,x = map(int,input().split())
city = list(map(int,input().split()))
dist = [abs(city[i]-x) for i in range(len(city))]


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


print(int(gcd(*dist)))

Submission status: Runtime Error

Solution code:
import math
from functools import reduce 

n,x = map(int,input().split())
city = list(map(int,input().split()))
#print(city)
dist = [abs(city[i]-x) for i in range(len(city))]
#print(dist)

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


print(int(gcd(*dist)))

Submission status: Runtime Error

Solution code:
import math
from functools import reduce 

n,x = map(int,input().split())
city = list(map(int,input().split()))
#print(city)
dist = [abs(city[i]-x) for i in range(len(city))]
#print(dist)

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


print(gcd(*dist))

Submission status: Runtime Error

Solution code:
import math

N, X = map(int,input().split())
city = list(map(int,input().split()))
X_diff = [0]*N
for i in range(N):
    X_diff[i] = abs(X-city[i])
    
ans = X_diff[0]
for i in range(1,N):
    ans = gcd(ans,X_diff[i])

print(ans)

Submission status: Runtime Error

Solution code:
import math

N, X = map(int,input().split())
city = list(map(int,input().split()))
X_diff = [0]*N
for i in range(N):
    X_diff[i] = abs(X-city[i])
    
ans = X_diff[0]
for i in range(1,N):
    ans = math.gcd(ans,X_diff[i])

print(ans)

Submission status: Runtime Error

Solution code:
import math

def reduce(function, iterable, initializer=None):
    it = iter(iterable)
    if initializer is None:
        value = next(it)
    else:
        value = initializer
    for element in it:
        value = function(value, element)
    return value

N, X = map(int,input().split())
city = list(map(int,input().split()))
X_diff = [0]*N
for i in range(N):
    X_diff[i] = abs(X-city[i])

ans = reduce(math.gcd, X_diff)
print(ans)

Submission status: Runtime Error

Solution code:
import functools
import math
N, X = map(int,input().split())
city = list(map(int,input().split()))
X_diff = [0]*N
for i in range(N):
    X_diff[i] = abs(X-city[i])

ans = functools.reduce(math.gcd, X_diff)
print(ans)

Submission status: Runtime Error

Solution code:
n,x=map(int,input().split())
a=list(map(int,input().split()))
b=[]
for i in a:b.append(abs(x-i))
while len(b)>1:b.append(fractions.gcd(b.pop(-1),b.pop(-1)))
print(b[0])

Submission status: Runtime Error

Solution code:
import math

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

ans = 0


x = list(map(int, input().split()))
x.append(X)
x.sort()
a = []

for i in range(N):
    a.append(abs(x[i] - x[i+1]))
    ans = math.gcd(ans, a[i])


print(ans)

Submission status: Runtime Error

Solution code:
from functools import reduce
import fractions
n, x = list(map(int, input().split()))
x_li = list(map(int, input().split()))
x_li.append(x)
x_li.sort()
d = []
for i in range(n):
    d.append(x_li[i + 1] - x_li[i])


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


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


if len(d) > 1:
    print(gcd_list(d))
else:
    print(d[0])

Submission status: Runtime Error

Solution code:
from functools import reduce
import math
n, x = list(map(int, input().split()))
x_li = list(map(int, input().split()))
x_li.append(x)
x_li.sort()
d = []
for i in range(n):
    d.append(x_li[i + 1] - x_li[i])


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


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


if len(d) > 1:
    print(gcd_list(d))
else:
    print(d[0])

Submission status: Runtime Error

Solution code:
n,x=map(int,input().split())
m=list(map(lambda x:int(x)-x,input().split()))
if 0 in m:
  m.remove(0)
ans=abs(m[0])
for i in m:
  i=abs(i)
  while 1:
    ans%=i
    ans,i=i,ans
    if i==0:
      break
print(ans)

Submission status: Runtime Error

Solution code:
from fractions import gcd
from functools import reduce
n,x=map(int,input().split())
y=list(map(int,input().split()))
def gcd(num):
    return reduce(fractions.gcd, num)
ya=[abs(y[i]-x) for i in range(n)]
print(gcd(ya))

Submission status: Runtime Error

Solution code:
n, a = map(int, input().split())
x = list(map(int, input().split()))

x.append(a)
x.sort()

diff_all = []
for i in range(len(x) - 1):
    diff_all.append(abs(x[i] - x[i+1]))

import fraction
from functools import reduce

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

print(gcd_list(diff_all))

Submission status: Runtime Error

Solution code:
n, X = map(int, input().split())
x = list(map(int, input().split()))

x.append(X)
x.sort()

diff_all = []
for i in range(len(x) - 1):
    diff_all.append(abs(x[i] - x[i+1]))

import math
from functools import reduce

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

print(gcd_list(diff_all))

Submission status: Runtime Error

Solution code:
n, X = map(int, input().split())
x = list(map(int, input().split()))

diff_all = []
x.append(X)
x.sort()

for i in range(len(x) - 1):
    diff_all.append(abs(x[i] - x[i+1]))

import math
from functools import reduce

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