TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n=int(input())
l=[input() for i in range(n)]

if l.most_common()[0][1] != 1:
  ans="No"
else:
  l_head = [i[0] for i in l]
  l_tail = [i[-1] for i in l]
  if l_head == l_tail:
    ans="Yes"
  else:
    ans="No"
    
print(ans)
  

from collections import Counter

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

if Counter(l).most_common()[0][1] != 1:
  ans="No"
else:
  l_head = [l[i+1][0] for i in range(n-1)]
  l_tail = [l[i][-1] for i in range(n-1)]
  if l_head == l_tail:
    ans="Yes"
  else:
    ans="No"
    
print(ans)
  

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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))

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,x=map(int,input().split())
X=list(map(int,input().split()))
for i in X:
  i=abs(i-x)
def gcd(x,y):
  if y==0:
    return x
  else:
    return(y,x%y)
stack=X[0]
for i in range(n-1):
  stack=gcd(stack,X[i+1])
print(stack)

n,x=map(int,input().split())
X=list(map(int,input().split()))
for i in range(n):
  X[i]=abs(X[i]-x)
def gcd(x,y):
  if y==0:
    return x
  else:
    return(y,x%y)
stack=X[0]
for i in range(n-1):
  stack=gcd(stack,X[i+1])
print(stack)

n,x=map(int,input().split())
X=list(map(int,input().split()))
for i in range(n):
  X[i]=abs(X[i]-x)
def gcd(p,q):
  if q==0:
    return p
  else:
    return gcd(q,p%q)
stack=X[0]
for i in range(n-1):
  stack=gcd(stack,X[i+1])
print(stack)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


N, X = LI()
X_list = LI()
X_list.sort()

bisect.insort_left(X_list, X)
#  print(X_list)
X_diff = [j-i for i, j in zip(X_list[:-1], X_list[1:])]
print(min(X_diff)


import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


N, X = LI()
X_list = LI()
X_list.sort()

bisect.insort_left(X_list, X)
#  print(X_list)
X_diff = [j-i for i, j in zip(X_list[:-1], X_list[1:])]
result = min(X_diff)




for i in range(result+1, 0, -1):
    if all(x % i == 0 for x in X_diff):
        print(i)
        exit()



Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
def A(a,b):
    if a<b:
        tmp = a
        a = b
        b = tmp
    r = a % b
    while r!=0:
      a = b
      b = r
      r = a % b
    return b
n,X=map(int,input().split())
x=list(map(int,input().split()))
x.append(X)
x.sort()
x2=[]
for i in range(1,n+1):
    x2.append(x[i]-x[i-1])
print(x2)
if len(x2)==1:
    p=x2[0]
else:
    for i in range(n):
        if i==0:
            p=A(x2[i-1],x2[i])
        elif i!=1:
            p=A(p,x2[i])
print(p)



def A(a,b):
    if a<b:
        tmp = a
        a = b
        b = tmp
    r = a % b
    while r!=0:
      a = b
      b = r
      r = a % b
    return b
n,X=map(int,input().split())
x=list(map(int,input().split()))
x.append(X)
x.sort()
x2=[]
for i in range(1,n+1):
    x2.append(x[i]-x[i-1])
if len(x2)==1:
    p=x2[0]
else:
    for i in range(n):
        if i==0:
            p=A(x2[i-1],x2[i])
        elif i!=1:
            p=A(p,x2[i])
print(p)



Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

N, X = [int(n) for n in input().split()]
xs = [int(n) - X for n in input().split()]

if all([n == xs[0] for n in xs]):
    m = min(xs)
    xs = [n - m for n in xs]
    g = gcd(max(xs[0], xs[1]), min(xs[0], xs[1]))
    for n in xs[2:]:
        g = gcd(max(g, n), min(g, n))
    print(g)
else:
    print(xs[0])


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

N, X = [int(n) for n in input().split()]
xs = [int(n) for n in input().split()]

xs.append(X)

m = min(xs)
xs = [n - m for n in xs]
g = gcd(max(xs[0], xs[1]), min(xs[0], xs[1]))
for n in xs[2:]:
    g = gcd(max(g, n), min(g, n))
print(g)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
#coding: utf-8
import numpy as np
import fraction
from functools import reduce

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

y = np.asarray(list(map(int,input().split())))
y -= x

print(reduce(fraction.gcd, y))




#coding: utf-8
import numpy as np
from functools import reduce

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

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

y = np.asarray(list(map(int,input().split())))
y -= x
y = map(abs,y)

print(reduce(gcd, y))


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N,X = map(int,input().split(' '))
L = list(map(int,input().split(' ')))

def algGCF(a,b):
  if a % b == 0:
    return b
  else:
    return algGCF(b,a%b)
GCF = abs(X-L[0])
for i in range(1,N):
  GCF = algGCF(GCF,X-L[i])
print(GCF)  

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

def algGCF(a,b):
  if a % b == 0:
    return b
  else:
    return algGCF(b,a%b)
GCF = abs(X-L[0])
for i in range(1,N):
  GCF = algGCF(GCF,abs(X-L[i]))
print(GCF)  
  
  

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math
from functools import reduce

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

if N == 1:
    print(abs(x[0] - X))
else:
    x.append(X)
    x.sort()
    print(x)
    x = [n - x[0] for n in x]
    print(x)
    D = reduce(math.gcd, x)
    print(D)

#import math
from functools import reduce

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

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

if N == 1:
    print(abs(x[0] - X))
else:
    x.append(X)
    x.sort()
    x = [n - x[0] for n in x]
    D = reduce(gcd, x)
    print(D)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
from fractions import gcd


def main():
    n, s = map(int, input().split())
    xs = sorted(list(map(int, input().split())))

    for i, x in enumerate(xs):
        if i == 0:
            ans = x-s
        else:
            ans = gcd(ans, x-s)
    print(ans)


if __name__ == "__main__":
    main()


from math import gcd


def main():
    n, x = map(int, input().split())
    xs = list(map(int, input().split()))
    xs.append(x)
    xs.sort()
    diff = []
    for i in range(1, n+1):
        diff.append(xs[i] - xs[i-1])
    ans = diff[0]
    for i in range(1, n):
        ans = gcd(ans, diff[i])
    print(ans)


if __name__ == "__main__":
    main()


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, X = map(int, input().strip().split())
xs = list(map(int, input().strip().split()))

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

isis = False
if N == 1:
  print(xs[0] - X)
  isis = True

max_dis = max(abs(xs[i] - xs[i+1]) for i in range(len(xs) - 1))
min_dis = min(abs(xs[i] - xs[i+1]) for i in range(len(xs) - 1))
a, b = max_dis, min_dis
while isis:
  if b == 0:
    print(a)
    break
  c = a % b
  if c == 0:
    print(b)
    break
  a = b
  b = c

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

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

mx = abs(xlist[0] - x)
for _x in xlist[1:]:
  mx = gcd(max(abs(_x-x), mx), min(abs(_x-x), mx))
print(mx)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N, X = map(int, input().split())
cities = [int(i) for i in input().split()]
cities.sort()
dist = [int(abs(i-X)) for i in cities]
dist.sort()
print(dist)
 
if N==1:
    print(max(dist))
else:
    while len(dist)>0:
        m = min(dist)
        dist = [int(i%m) for i in dist]
        dist.sort()
        while len(dist)>0 and dist[0]==0:
            dist.remove(0)
        if len(dist)==0:
            break
        else:
            dist.append(m)
    print(m)

N, X = map(int, input().split())
cities = [int(i) for i in input().split()]
cities.sort()
dist = [int(abs(i-X)) for i in cities]
dist.sort()
 
if N==1:
    print(max(dist))
else:
    while len(dist)>0:
        m = min(dist)
        dist = [int(i%m) for i in dist]
        dist.sort()
        while len(dist)>0 and dist[0]==0:
            dist.remove(0)
        if len(dist)==0:
            break
        else:
            dist.append(m)
    print(m)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import fraction
N, X = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
if N > 1:
    mini = x[1] - x[0]
    if mini > abs(X - x[0]) and abs(X - x[0]) != 0:
        mini = abs(X - x[0])
elif N == 1:
    mini = abs(x[0] - X)
for i in range(1, N):
    if mini > x[i] - x[i - 1]:
        mini = x[i] - x[i - 1]
    if mini> abs(X - x[i]) and abs(X - x[i]) != 0:
        mini = abs(X - x[i])
    if (x[i] - x[i - 1]) % mini != 0:
        #break
        mini = fraction.gcd(mini, x[i] - x[i - 1])
    if abs(X - x[i]) % mini != 0:
        #break
        mini = fraction.gcd(mini, X - x[i])
        

print(mini)


import fractions
N, X = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
if N > 1:
    mini = x[1] - x[0]
    if mini > abs(X - x[0]) and abs(X - x[0]) != 0:
        mini = abs(X - x[0])
elif N == 1:
    mini = abs(x[0] - X)
for i in range(1, N):
    if mini > x[i] - x[i - 1]:
        mini = x[i] - x[i - 1]
    if mini> abs(X - x[i]) and abs(X - x[i]) != 0:
        mini = abs(X - x[i])
    if (x[i] - x[i - 1]) % mini != 0:
        #break
        mini = fractions.gcd(mini, x[i] - x[i - 1])
    if abs(X - x[i]) % mini != 0:
        #break
        mini = fractions.gcd(mini, X - x[i])
        

print(mini)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):

n,x = map(int,input().split())
x = list(map(int,input().split()))
l = [abs(i-x) for i in x]


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

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


n,x = map(int,input().split())
x = list(map(int,input().split()))
l = [abs(i-x) for i in x]


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

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

n,x = map(int,input().split())
a = list(map(int,input().split()))
new_lst=[abs(i-x) for i in a]

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

ans=new_lst[0]
for i in range(1,n):
	ans =gcd(new_lst[i],ans)

print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N, X = map(int, input().split())
x_lst = [int(i) for i in input().split()]
# N, X = map(int, '3 81'.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))

N, X = map(int, input().split())
x_list = [abs(int(i) - X) for i in input().split()]
# N, X = map(int, '3 81'.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))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)



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)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):

import math
from functools import reduce

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

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


import sys

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


x_div =[abs(X-x[0])] 
for i in range(N):
    x_div.append(abs(x[i] -x[i+1]))


if N ==1:
    ans =abs(x[0] -X)
else:
    ans =gcd_list(x_div)
print(ans)


import math
from functools import reduce

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

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


import sys

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


x_div =[abs(X-x[0])] 
for i in range(N-1):
    x_div.append(abs(x[i] -x[i+1]))


if N ==1:
    ans =abs(x[0] -X)
else:
    ans =gcd_list(x_div)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import fraction

N,X = map(int,input().split())
x = [int(i) for i in input().split()]
ans = abs(X-x[0])
now = X
for i in x:
    if abs(now - i) % ans:
        ans = fraction.gcd(ans, abs(now-i))
    now = i

print(ans)

def gcd(a,b):
    while b:
        a, b = b, a % b
    return a
N,X = map(int,input().split())
x = [int(i) for i in input().split()]
ans = abs(X-x[0])
now = X
for i in x:
    ans = gcd(ans, abs(now-i))
    now = i

print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import fractions
from functools import reduce

n,x = map(int,input().split())
lst=list(map(int,input().split()))
new_lst=[abs(i-x) for i in lst]

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

print(gcd(*new_lst))


n,x = map(int,input().split())
lst=list(map(int,input().split()))
new_lst=[abs(i-x) for i in lst]

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

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
def mapt(fn, *args):
    return list(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))

def main():
    N, X = Input()
    if N == 1:
        print(abs(N-X))
        exit()
        
    x = Input()
    x.append(X)
    x.sort()
    data = [abs(x[i] - x[i+1]) for i in range(N)]

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



main()

def mapt(fn, *args):
    return list(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))

def main():
    N, X = Input()
    x = Input()

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

    x.append(X)
    x.sort()
    data = [abs(x[i] - x[i+1]) for i in range(N)]

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



main()

def mapt(fn, *args):
    return list(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))

def main():
    N, X = Input()
    x = Input()

    data = [abs(X - x[i]) for i in range(N)]
    ans = data[0]
    for i in range(1, len(data)):
        ans = gcd(data[i], ans)
    print(ans)



main()

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

def mapt(fn, *args):
    return list(map(fn, *args))
 
 
def Input():
    return mapt(int, input().split(" "))
 
def main():
    N, X = Input()
    x = Input()
 
    if N == 1:
        print(abs(x[0] - X))
        exit()
 
    x.append(X)
    x.sort()
    data = [abs(x[i] - x[i+1]) for i in range(N)]
 
    ans = data[0]
    for i in range(1, N):
        ans = gcd(data[i], ans)
    print(ans)
 
 
 
main()

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
# C - Skip

import numpy as np
import fractions

N, X = map(int, input().split())
x = list(int(x) for x in input().split())
x.append(X)
x.sort()
x = np.array(x)
x = x - x[0]

ans = 10**18
if N == 1:
    print(x[1] - x[0])
else:
    for i in range(N-1):
        ans = min(ans, fractions.gcd(x[i], x[i+1]))
    print(ans)

# C - Skip

import numpy as np
import fractions

N, X = map(int, input().split())
x = list(int(x) for x in input().split())
x.append(X)
x.sort()
x = np.array(x)
x = x - x[0]

ans = 10**18
if N == 1:
    print(x[1] - x[0])
else:
    for i in range(N):
        ans = fractions.gcd(ans, fractions.gcd(x[i], x[i+1]))
    print(ans)

# C - Skip

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

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

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)

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)

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)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
from functools import reduce
from math import gcd

n, x = map(int, input().split())
a = [abs(int(A) - x) for A in input().split()]
a.sort()
print(a)
print(reduce(gcd, a))


from functools import reduce
from math import gcd

n, x = map(int, input().split())
a = [abs(int(A) - x) for A in input().split()]
a.sort()
print(reduce(gcd, a))


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N,A = map(int,input().split())
X = sorted(map(int,input().split()))
Y = []
for x in X:
    Y.append(abs(A-x))
ans = Y[0]%Y[1]
for y in Y:
    for i in range(y-1,0,-1):
        if y%i == 0:
            ans = max(ans,i)
            break
print(ans)

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

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

new_X = []
for x in X:
    new_X.append(abs(S-x))

ans = new_X[0]
for x in new_X:
    ans = min(ans,gcd(ans,x))
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)


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)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import fractions
n,m=map(int,input().split())
tosi = list(map(int,input().split()))
for i in range(n):
    tosi[i]=abs(m-tosi[i])
answer=min(tosi)
print(tosi)
while max(tosi)!=0:
    for i in range(n):
        if tosi[i]%answer==0:
            tosi[i]=0
        else:
            answer=fractions.gcd(answer,tosi[i])
print(answer)

import fractions
n,m=map(int,input().split())
tosi = list(map(int,input().split()))
for i in range(n):
    tosi[i]=abs(m-tosi[i])
answer=min(tosi)
while max(tosi)!=0:
    for i in range(n):
        if tosi[i]%answer==0:
            tosi[i]=0
        else:
            answer=fractions.gcd(answer,tosi[i])
print(answer)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def gcd(a,b):
    if b==0:
        return a
    else:
        gcd(b,a%b)


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

if n==1:
    a=int(input())
    print(abs(a-x))
    exit()
else:
    str=input()
    lst=str.split(" ")
    a=int(lst[0])
    b=int(lst[1])
    maxim=gcd(abs(a-x),abs(b-x))
    for i in range(2,n):
        c=int(lst[i])
        maxim=gcd(maxim,abs(c-x))
print(maxim)


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


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

if n==1:
    a=int(input())
    print(abs(a-x))
    exit()
else:
    str=input()
    lst=str.split(" ")
    a=int(lst[0])
    b=int(lst[1])
    maxim=gcd(abs(a-x),abs(b-x))
    for i in range(2,n):
        c=int(lst[i])
        maxim=gcd(maxim,abs(c-x))
print(maxim)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n, x = map(int, input().split())
c = list(map(int, input().split()))
c = set([abs(x-c[i]) for i in range(n)])
l = min(c)
f = [l]
if l < 999999999:
    for i in range(1, l):
        if l % i == 0:
            f.append(i)
for i in range(len(f), 0, -1):
    d = True
    for item in c:
        if item % f[i-1] != 0:
            d = False
    if d:
        print(f[i-1])
        break

n, x = map(int, input().split())
c = list(map(int, input().split()))
c = set([abs(x-c[i]) for i in range(n)])
l = min(c)
f = [l]
if n > 1:
    for i in range(1, l):
        if l % i == 0:
            f.append(i)
for i in range(len(f), 0, -1):
    d = True
    for item in c:
        if item % f[i-1] != 0:
            d = False
    if d:
        print(f[i-1])
        break

n, x = map(int, input().split())
c = list(map(int, input().split()))
c = set([abs(x-c[i]) for i in range(n)])
l = min(c)
f = [l]
if l < 100000000:
    for i in range(1, l):
        if l % i == 0:
            f.append(i)
for i in range(len(f), 0, -1):
    d = True
    for item in c:
        if item % f[i-1] != 0:
            d = False
    if d:
        print(f[i-1])
        break


n, x = map(int, input().split())
c = list(map(int, input().split()))
c = set([abs(x-c[i]) for i in range(n)])
l = min(c)
for i in range(l+1, 0, -1):
    if l % i == 0:
        d = True
        for item in c:
            if item % i != 0:
                d = False
        if d:
            print(i)
            break

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from functools import reduce
N, X = map(int, input().split())
loc = list(map(int, input().split()))

a = min([abs(l-X) for l in loc])
b = reduce(lambda x, y: abs(x-y), sorted(loc)[:2])
print(a,b)
if max([a,b]) % min([a,b]):
    print(abs(min(loc)-X))
else:
    print(min([a,b]))

from functools import reduce
N, X = map(int, input().split())
loc = list(map(int, input().split()))


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


print(reduce(gcd, [abs(l-X) for l in loc]))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def gcd(n,m):
    n,m = max(n,m),min(n,m)
    r = n % m
    while r > 0:
        n,m = m,r
        r = n % m
    return m
N,X = map(int,input().split())
x = [X - y for y in list(map(int,input().split()))]
ans = x[0]
for i in range(1,N):
    ans = gcd(ans, x[i])
print(abs(ans))

from math import gcd
N,X = map(int,input().split())
g = None
for x in map(int,input().split()):
    if g == None:
        g = x-X
    else:
        g = gcd(g,x-X)
print(abs(g))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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=[x_list_new[i+1]-x_list_new[i] for i in range(len(x_list_new)-1)]

min(x_list_new_dif)

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

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)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N, X = map(int, input().split())
x_list = list(map(int, input().split()))

def gcd(l):
    x = max(l)
    y = min(l)
    if x % y == 0:
        return y
    else:
        while x%y!=0:
            z = x%y
            x = y
            y = z
        else:
            return z
        
if N == 1:
    print(x_list[0] - X)
    exit()

values = np.sort(np.array(x_list))[1:] - min(x_list)
print(gcd(values))



N, X = map(int, input().split())
x_list = list(map(int, input().split()))
x_list.append(X)
def gcd_1(l):
    x = max(l)
    y = min(l)
    if x % y == 0:
        return y
    else:
        while x%y!=0:
            z = x%y
            x = y
            y = z
        else:
            return z
        
if N == 1:
    print(x_list[0] - X)
    exit()

values = np.sort(np.array(x_list))[1:] - min(x_list)

if N == 2:
    print(values[0])
    exit()

print(gcd_1(values))



N,X=map(int,input().split())
x=list(map(int,input().split()))
x.append(X)
mx=min(x)
x=list(map(lambda t:t-mx,x))
def gcd(a,b):
    while b:
        a,b=b,a%b
    return(a)
a=10**10
for i,j in zip(x,x[1:]):
    a=min(a,gcd(i,j))
print(a)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math
from functools import reduce
N, X = map(int, input().slpit())
x = list(map(int,input().split()))
 
for i in range(N):
    x[i] = abs(x[i]-X)
 
x = sorted(x)[::-1]
cnt = 0
 
for i in range(N):
    cnt = math.gcd(cnt, x[i])
 
print(cnt)

import fractions
from functools import reduce
N, X = map(int, input().split())
x = [int(input()) for i in range(N)]


x.insert(0,X)
x = sorted(x)

y = [0 for i in range(N)]

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

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

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

print(gcd(*y))

import fractions
from functools import reduce
N, X = map(int, input().split())
x = [int(input()) for i in range(N)]
 
 
x.insert(0,X)
x = sorted(x)
 
y = [0]*N
 
for i in range(N):
    y[i] = x[i+1]-x[i]
 
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)
 
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
 
print(gcd(*y))

import math
from functools import reduce
N, X = map(int, input().slpit())
x = [int(input()) for i in range(N)]

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

x = sorted(x)[::-1]
cnt = 0

for i in range(N):
    cnt = math.gcd(cnt, x[i])

print(cnt)

import math
from functools import reduce
N, X = map(int, input().split())
x = list(map(int,input().split()))
 
for i in range(N):
    x[i] = abs(x[i]-X)
 
x = sorted(x)[::-1]
cnt = 0
 
for i in range(N):
    cnt = math.gcd(cnt, x[i])
 
print(cnt)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted