Harryxun/stf_run huggingface dataset:
N = int(input())
A = sorted(map(int, input().split()))
res = 1

if 0 in A :
    res = 0

for x in range(N) :
    res = res*A[x]
    if res > 10E+18
        res = -1
        break

print(res)


### FIXED CODE ###

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

limit = 10 ** 18
A.sort()
result = A[0]
for a in A[1:]:
    result *= a
    if result > limit:
        print(-1)
        exit()
print(result)
N, M = [int(elem) for elem in input().split(' ')]
coord_list = [[int(elem) for elem in input().split(' ')] for _ in range(N)]
assert len(coord_list) == N
assert len(coord_list[0]) == 3


def search_max(sorted_coord_list, M, key):
    len_list = len(sorted_coord_list)
    if M == len_list:
        total_x, total_y, total_z = 0, 0, 0
        for x, y, z in sorted_coord_list:
            total_x += x
            total_y += y
            total_z += z
        total = abs(total_x) + abs(total_y) + abs(total_z)
        return total

    elif M == 1:
        x, y, z = sorted_coord_list[0]
        total = abs(x) + abs(y) + abs(z)
        return total

    # 2 <= M < N
    else:
        if sorted_coord_list[M - 1][key] == sorted_coord_list[M][key]:
            considering_val = coord_list[M - 1][key]
            current_idx = M - 1
            candidate_list = list()
            while (coord_list[current_idx][key] == considering_val) or (current_idx != len_list):
                candidate_list.append(sorted_coord_list[current_idx])
                current_idx += 1
            total_x, total_y, total_z = 0, 0, 0
            for x, y, z in sorted_coord_list[:M - 1]:
                total_x += x
                total_y += y
                total_z += z
            max_total = 0
            for x, y, z in candidate_list:
                total = abs(total_x + x) + abs(total_y + y) + abs(total_z + z)
                max_total = max(max_total, total)
            return max_total

        else:
            total_x, total_y, total_z = 0, 0, 0
            for x, y, z in sorted_coord_list[:M]:
                total_x += x
                total_y += y
                total_z += z
            total = abs(total_x) + abs(total_y) + abs(total_z)
            return total


max_candidates = [0] * 6
for i in range(3):
    # sort coord_list: O(NlogN)
    sorted_coord_list = sorted(coord_list, key=lambda x: x[i])
    max_candidates[2 * i] = search_max(sorted_coord_list, M, i)
    max_candidates[2 * i + 1] = search_max(sorted_coord_list[::-1], M, i)

print(max(max_candidates))


### FIXED CODE ###

from itertools import product

N, M = [int(elem) for elem in input().split(' ')]
coord_list = [[int(elem) for elem in input().split(' ')] for _ in range(N)]
assert len(coord_list) == N
assert len(coord_list[0]) == 3

max_total = 0
for f_x, f_y, f_z in product([-1, 1], repeat=3):
    sum_list = [(f_x * x + f_y * y + f_z * z, i) for i, (x, y, z) in enumerate(coord_list)]
    # sort with index
    sum_list = sorted(sum_list, key=lambda x: x[0])[::-1]
    total_x, total_y, total_z = 0, 0, 0
    for _, idx in sum_list[:M]:
        total_x += coord_list[idx][0]
        total_y += coord_list[idx][1]
        total_z += coord_list[idx][2]
    total = abs(total_x) + abs(total_y) + abs(total_z)
    max_total = max(total, max_total)

print(max_total)
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, q = read_line(int, int)
s, = read_line(str)

p = []
for i in range(len(s) - 1):
    if s[i:i+2] == 'AC':
        p.append(i)

for i in range(q):
    l, r = read_line(int, int)
    l, r = l - 1, r - 1

    c = 0
    print(s[l:r + 1])
    for pp in p:
        if l <= pp and pp + 1 < r:
            c += 1
    print(c)


### FIXED CODE ###

def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, q = read_line(int, int)
s, = read_line(str)

m = [0 for _ in range(len(s) + 1)]

c = 0
for i in range(len(s)):
    if s[i:i+2] == 'AC':
        c += 1
    m[i + 1] = c

for i in range(q):
    l, r = read_line(int, int)

    if c == 0:
        print(0)
        continue
    print(m[r - 1] - m[l - 1])
n_vec = list(map(int, input().split()))
n1 = n_vec[0]
n2 = n_vec[1]
n3 = n_vec[2]
def metricf1(w,a,b) :
    if (a+w < b) :
        return b-a-w
    elif (a-w <= b <= a+w) :
        return 0
    else :
        return a-b-w
print(metricf1(n1,n2,n3))

### FIXED CODE ###

l_vec = input().split()
def classifier1(l) :
    if ((l[0] == 'H') and (l[1] == 'H')) or ((l[0] == 'D') and (l[1] == 'D')) :
        return 'H'
    else :
        return 'D'
print(classifier1(l_vec))
N = int(input())
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]
AB = sorted(list(set(A + B)))
D = {ab: i+1 for i, ab in enumerate(AB)}
A = [D[a] for a in A]
B = [D[a] for a in B]

ans = 1 << 100
for m in range(1<<N):
    if bin(m).count("1") & 1: continue
    C = [[], []]
    for i in range(N):
        p = m >> i & 1
        q = p + i & 1
        C[q].append(((A[i] if p == 0 else B[i]) << 5) + i)
    if len(C[1]) != N // 2: continue
    C[0].sort()
    C[1].sort()
    CC = [C[i&1][i//2] for i in range(N)]
    for i in range(1, N):
        if CC[i-1] >> 5 > CC[i] >> 5: break
    else:
        CCC = [c % 32 for c in CC]
        ans = min(ans, chk(CCC))
print(ans if ans < 1 << 100 else -1)

### FIXED CODE ###

N = int(input())
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]
AB = sorted(list(set(A + B)))
D = {ab: i+1 for i, ab in enumerate(AB)}
A = [D[a] for a in A]
B = [D[a] for a in B]
def chk(L):
    NN = 5
    BIT=[0] * (2**NN+1)
    def addbit(i):
        while i <= 2**NN:
            BIT[i] += 1
            i += i & (-i)
 
    def getsum(i):
        ret = 0
        while i != 0:
            ret += BIT[i]
            i -= i&(-i)
        return ret
    s = 0
    for l in L[::-1]:
        s += getsum(l+1)
        addbit(l+1)
    return s
ans = 1 << 100
for m in range(1<<N):
    if bin(m).count("1") & 1: continue
    C = [[], []]
    for i in range(N):
        p = m >> i & 1
        q = p + i & 1
        C[q].append(((A[i] if p == 0 else B[i]) << 5) + i)
    if len(C[1]) != N // 2: continue
    C[0].sort()
    C[1].sort()
    CC = [C[i&1][i//2] for i in range(N)]
    for i in range(1, N):
        if CC[i-1] >> 5 > CC[i] >> 5: break
    else:
        CCC = [c % 32 for c in CC]
        ans = min(ans, chk(CCC))
print(ans if ans < 1 << 100 else -1)
a=input()
if(a >0):
	s=str(a)
	if(s[-1] in ('2','4','5','7','9')):
		print('hon')
	elif(s[-1] in ('0','1','6','8')):
		print('pon')
	elif(s[-1] == '3'):
		print('bonn')

### FIXED CODE ###

a=input()
s = str(a)
if(s[-1] in ('2','4','5','7','9')):
	print('hon')
elif(s[-1] in ('0','1','6','8')):
	print('pon')
elif(s[-1] == '3'):
	print('bon')
print(int(input()) * int(input()))

### FIXED CODE ###

a,b = map(int,input().split())
print(a*b)
def resolve():
    li = input().split()

    if li[0]+li[1]+li[2] => 22:
        print("bust")
    else:
        print("win")


### FIXED CODE ###

a = list(map(int,input().split()))
if a[0]+a[1]+a[2] <= 21:
  print('win')
else:
  print('bust')
s=input().rstrip()
t=input().rstrip()
print(s+t)


### FIXED CODE ###

s,t=input().split()
print(t+s)
N=[int(x) for x in input().split()]
if not N[2]%N[1]==0:
   c=N[2]//N[1]+1
else:
    c=N[2]//N[1]

if not N[0]%N[3]==0:
   c=N[0]//N[3]+1

   d=N[0]//N[3]+1
else:
    d=N[0]//N[3]
if d>=c:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N=[int(x) for x in input().split()]
if N[0]>N[1]:
    print("safe")
else:
   print("unsafe")
from math import log2

def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    if K > log2(N):
        return print(*[N]*N,sep = " ")
    for _ in range(K):
        imos = [0]*(N + 1)
        for i in range(N):
            imos[max(0,i  - A[i])] += 1
            imos[min(N,i + 1 + A[i])] -= 1
        for j in range(N):
            imos[j+1] += imos[j]
            flag += 1 if imos[j] == N else 0
        A = imos[:N].copy()
    print(*A,sep=" ")
    return 

if __name__ == "__main__":
    main()

### FIXED CODE ###

from math import log2

def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    if K > log2(N)+ 50:
        return print(*[N]*N,sep = " ")
    for _ in range(K):
        imos = [0]*(N + 1)
        for i in range(N):
            imos[max(0,i  - A[i])] += 1
            imos[min(N,i + 1 + A[i])] -= 1
        for j in range(N):
            imos[j+1] += imos[j]
        A = imos[:N].copy()
    print(*A,sep=" ")
    return

if __name__ == "__main__":
    main()
s = input()
k = int(input())

i=0
while(s[i]=="1"):
    i +=1
print(s[i])

### FIXED CODE ###

s = input()
k = int(input())

i=0
while(s[i]=="1"):
    if i==(len(s)-1):
        break
    i +=1
    
if k<(i+1):
    print(1)
else:
    print(s[i])
c = inuput()
if c == 'a' or c == 'i' or c == 'u' or c == 'e' or c == 'o':
  print('vowel')
else:
  print("consonant")
  

### FIXED CODE ###

c = input()
if c == 'a' or c == 'i' or c == 'u' or c == 'e' or c == 'o':
  print('vowel')
else:
  print("consonant")
s = sorted(input().split())
ans = 0
for i in s:
    if s[i] == '+':
        ans+=1
    else:
        ans -=1
print('ans')

### FIXED CODE ###

s = sorted(input())
ans = 0
for i in s:
    if i == '+':
        ans+=1
    else:
        ans -=1
print(ans)
k,s = input().split()
a = 0
n = 0
while a <= k:
  b = 0
  while b <= k:
    c = 0
    while c <= k:
      if (a+b+c) == s:
        n += 1
      c += 1
    b += 1
  a += 1
print(n)


### FIXED CODE ###

print(input().replace(',',' '))
A,B = map(int,input().split())

if A  == 1:
  if A < B:
    print('Alice')
  else:
    print('Draw')
if B == 1:
  if B < A:
    print('Bob')
  else:
    print(Draw)
else:
  if A > B:
    print('Alice')
  elif A == B:
    print('Draw')
  else:
    print('Bob')

### FIXED CODE ###

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

if A  == 1:
  if A < B:
    print('Alice')
  else:
    print('Draw')
elif B == 1:
  if B < A:
    print('Bob')
else:
  if A > B:
    print('Alice')
  elif A == B:
    print('Draw')
  else:
    print('Bob')
from collections import deque, defaultdict
from copy import deepcopy

N ,u, v = map(int,input().split())
graph = defaultdict(deque)
for _ in range(1,N):
    a, b = map(int,input().split())
    graph[a].append(b)
    graph[b].append(a)

depth = dict(zip(list(range(1,N+1)),[-1]*N))

def bfs(s):
    if graph[s]:
        for v in graph[s]:
            if depth[v] == -1:
                depth[v] = depth[s] + 1
                bfs(v)

depth = dict(zip(list(range(1,N+1)),[-1]*N))
depth[v] = 0
bfs(v)
depth_v = deepcopy(depth)

depth = dict(zip(list(range(1,N+1)),[-1]*N))
depth[u] = 0
bfs(u)
depth_u = depth
depth_v = sorted(depth_v.items(), key = lambda x:x[0])
depth_u = sorted(depth_u.items(), key= lambda x:x[0])
print(depth_v)
print(depth_u)
MAX = 0
for v,u in zip(depth_v, depth_u):
    print(v[1],u[1])
    if u[1] < v[1]:
        MAX = max(MAX,v[1])
print(MAX-1)

### FIXED CODE ###

from collections import deque, defaultdict
from copy import deepcopy
import sys
import resource

sys.setrecursionlimit(10**5)

N ,u, v = map(int,input().split())
graph = defaultdict(deque)
for _ in range(1,N):
    a, b = map(int,input().split())
    graph[a].append(b)
    graph[b].append(a)

depth = dict(zip(list(range(1,N+1)),[-1]*N))

def bfs(s):
    if graph[s]:
        for v in graph[s]:
            if depth[v] == -1:
                depth[v] = depth[s] + 1
                bfs(v)

depth = dict(zip(list(range(1,N+1)),[-1]*N))
depth[v] = 0
bfs(v)
depth_v = deepcopy(depth)

depth = dict(zip(list(range(1,N+1)),[-1]*N))
depth[u] = 0
bfs(u)
depth_u = depth
depth_v = sorted(depth_v.items(), key = lambda x:x[0])
depth_u = sorted(depth_u.items(), key= lambda x:x[0])

MAX = 0
for v,u in zip(depth_v, depth_u):
    if u[1] < v[1]:
        MAX = max(MAX,v[1])
print(MAX-1)
K = input()
D = int(input())
dp = [[0] * D for _ in range(len(K))]
mod = 10 ** 9 + 7
#桁DP
#0 ~ K[0] - 1までの数をトップとする場合
for i in range(int(K[0])):
  dp[0][i % D] += 1
#tightは上限付近の制御に使う
#K[0]をトップとする場合がtight
#tightは上限ギリギリを攻める
tight = int(K[0]) % D
for k in range(int(K[1])):
    dp[1][(tight + k) % D] += 1
tight = (tight + int(K[1])) % D
if len(K) > 1:
  for i in range(len(K) - 1):
    for j in range(D):
      for k in range(10):
        dp[i + 1][(j + k) % D] += dp[i][j]
        dp[i + 1][(j + k) % D] %= mod
  #Kを超えないようにしている
  for k in range(int(K[i + 1])):
    dp[i + 1][(tight + k) % D] += 1
  #上から(i + 1)桁まで見たもので、上限ギリギリのものの剰余
  tight = (tight + int(K[i + 1])) % D
#tightは最終的に上限の剰余に一致するので、0でないならその分を除く
print((dp[len(K) - 1][0] + (tight == 0) - 1) % mod)



### FIXED CODE ###

K = input()
D = int(input())
dp = [[0] * D for _ in range(len(K))]
mod = 10 ** 9 + 7
#桁DP
#0 ~ K[0] - 1までの数をトップとする場合
for i in range(int(K[0])):
  dp[0][i % D] += 1
#tightは上限付近の制御に使う
#K[0]をトップとする場合がtight
#tightは上限ギリギリを攻める
tight = int(K[0]) % D
if len(K) > 1:
  for i in range(len(K) - 1):
    for j in range(D):
      for k in range(10):
        dp[i + 1][(j + k) % D] += dp[i][j]
        dp[i + 1][(j + k) % D] %= mod
    #Kを超えないようにしている
    for k in range(int(K[i + 1])):
      dp[i + 1][(tight + k) % D] += 1
    #上から(i + 1)桁まで見たもので、上限ギリギリのものの剰余
    tight = (tight + int(K[i + 1])) % D
#tightは最終的に上限の剰余に一致するので、0でないならその分を除く
print((dp[len(K) - 1][0] + (tight == 0) - 1) % mod)
n,m=map(int,input().split())
S=input()
if S[m]=="A":S[m]="a"
elif S[m]=="B":S[m]="b"
else:S[m]="c"
print(S)

### FIXED CODE ###

N,K = map(int,input().split())
S = list(input())
if S[K-1] == 'A':
    S[K-1] = 'a'
elif S[K-1] == 'B':
    S[K-1] = 'b'
else:
    S[K-1] = 'c'
print(''.join(S))
a = int(input())
if a==000:
    print(0)
eif a==001 or 010 or 100:
    print(1)
elif a==111:
    print(3)
else:
    print(2)    

### FIXED CODE ###

a = int(input())
print(a%9)
n, k = map(int, input().split())
mod = 10**9+7
edges = []
for _ in range(n-1):
  edges.append(list(map(int, input().split())))

edge_dict = {}
for i in range(1, n+1):
  edge_dict[i] = set()

for edge in edges:
  edge_dict[edge[0]].add(edge[1])
  edge_dict[edge[1]].add(edge[0])

visited = set()
ans = 1
def visit(node, parent, grand_parent):
  global ans
  if parent is not None:
    ans = (ans * (k - 1 - len(visited & (edge_dict[parent]))))%mod
  else:
    ans = (ans * k)%mod
  
  visited.add(node)
  
  for child in (edge_dict[node] - visited):
    visit(child, node, parent)

visit(1, None, None)
print(ans)

### FIXED CODE ###

import queue

n, k = map(int, input().split())
edges = []
for _ in range(n-1):
  edges.append(list(map(int, input().split())))
mod = 10**9+7

edge_dict = {}
for i in range(1, n+1):
  edge_dict[i] = set()

for edge in edges:
  edge_dict[edge[0]].add(edge[1])
  edge_dict[edge[1]].add(edge[0])

visited = set()
q = queue.LifoQueue()
q.put(1)

num_cases = 1
while not q.empty():
  node = q.get()
  
  visited.add(node)
  num_available_colors = k -2 if node is not 1 else k -1
  
  for child in (edge_dict[node] - visited):
    num_cases *= num_available_colors
    num_available_colors -= 1
    num_cases %= mod
    q.put(child)

print((k*num_cases)%mod)
import bisect
import sys
sys.setrecurtionlimit(10**7)

def dfs(v,l,tr):
  ans[v]=l
  for u in g[v]:
    if checked[u]==0:
      checked[u]=1
      pos=bisect.bisect_left(tr,arr[u])
      if pos==l:
        dfs(u,l+1,tr+[arr[u]])
      elif tr[pos]==arr[u]:
        dfs(u,l,tr)
      else:
        dfs(u,l,tr[:pos]+[arr[u]]+tr[pos+1:])

n=int(input())
arr=[0]+list(map(int,input().split()))
g=[[] for _ in range(n+1)]
for _ in range(n-1):
  a,b=map(int,input().split())
  g[a].append(b)
  g[b].append(a)
ans=[0]*(n+1)
checked=[0]*(n+1)
checked[1]=1
dfs(1,1,[arr[1]])
for i in range(1,n+1):
  print(ans[i])

### FIXED CODE ###

import bisect
import sys
sys.setrecursionlimit(10**7)

def dfs(v):
  pos=bisect.bisect_left(dp,arr[v])
  changes.append((pos,dp[pos]))
  dp[pos]=arr[v]
  ans[v]=bisect.bisect_left(dp,10**18)
  for u in g[v]:
    if checked[u]==0:
      checked[u]=1
      dfs(u)
  pos,val=changes.pop()
  dp[pos]=val

n=int(input())
arr=[0]+list(map(int,input().split()))
g=[[] for _ in range(n+1)]
for _ in range(n-1):
  a,b=map(int,input().split())
  g[a].append(b)
  g[b].append(a)
ans=[0]*(n+1)
checked=[0]*(n+1)
checked[1]=1
dp=[10**18 for _ in range(n+1)]
changes=[]
dfs(1)
for i in range(1,n+1):
  print(ans[i])
a,b,c,d = input().split()
print(max(a*b,c*d))

### FIXED CODE ###

a,b,c,d = map(int, input().split())
print(max(a*b,c*d))
from collections import defaultdict

def DFS(G,v,seen=None,path=None):
    if seen is None: seen = []
    if path is None: path = [v]

    seen.append(v)

    paths = []
    for t in G[v]:
        if t not in seen:
            t_path = path + [t]
            paths.append(tuple(t_path))
            paths.extend(DFS(G, t, seen[:], t_path))
    return paths
N, M = map(int,input().split())
# Build graph dictionary
G = defaultdict(list)
for _ in range(M):
  s, t = input().split()
  G[s].append(t)
  G[t].append(s)

# Run DFS, compute metrics
all_paths = [p for ps in [DFS(G, n) for n in set(G)] for p in ps]
max_len   = max(len(p) for p in all_paths)
print(max_len)

### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
  
N, M = map(int,input().split()) 
uf = UnionFind(N)
for _ in range(M):
  a, b = map(int,input().split())
  uf.union(a-1,b-1)

ans = 0
for i in range(N):
  ans=max(ans, uf.size(i))
print(ans)
import math
a, b, h, m =map(int,input().split())
angle_m = m*6
angle_h1 = h*30
angle_h2 = angle_h1 + m*0.5
angle = angle_h2 - angle_m
print((a**2-2*a*b*math.cos(math.radians(angle))+b**2)**0.5)


### FIXED CODE ###

n=input()
if n[-1] == "2" or n[-1] == "4" or n[-1] == "5" or n[-1] == "7" or n[-1] == "9":
    print("hon")
elif n[-1] == "0" or n[-1] == "1" or n[-1] == "6" or n[-1] == "8":
    print("pon")
elif n[-1] == "3":
    print("bon")
M, N = map(int, input().split())
A = list(map(int, input().split()))

j = 0
sum = []

for i in range(M+1):
    if i == A[j]:
        sum.append(0)
        if j < M-1:
            j += 1
    elif i == 0 or i == 1:
        sum.append(1)
    else:
        sum.append(sum[i-2] + sum[i-1])


print(sum[N]%1000000007)

### FIXED CODE ###

N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

j = 0
sum = []

for i in range(N+1):
    if j < M and i == A[j]:
        sum.append(0)
        if j < M-1:
            j += 1
    elif i == 0 or i == 1:
        sum.append(1)
    else:
        sum.append(sum[i-2] + sum[i-1])


print(sum[N]%1000000007)
import math

def lcm(p,q):
    return p*q//math.gcd(p,q)
n,m = map(int, input().split())
a = list(map(int, input().split()))
x = 1
for i in range(n):
    a[i] = a[i]//2
    x = lcm(x,a[i])
p = m//x
if p%2==0:
    ans = p//2
else:
    ans = p//2 +1
print(ans)


### FIXED CODE ###

from fractions import gcd
def lcm(p,q):
    return p*q//gcd(p,q)

n,m = map(int, input().split())
a = list(map(int, input().split()))
x = 1
for i in range(n):
    a[i] = a[i]//2
    x = lcm(x,a[i])
    if x>m:
        print(0)
        exit()
for i in range(n):
    if (x//a[i])%2==0:
        print(0)
        exit()
p = m//x
if p%2==0:
    ans = p//2
else:
    ans = p//2 +1
print(ans)
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
a,b = map(int,input().split())

print(lcm(a, b))

### FIXED CODE ###

import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
a,b = map(int,input().split())

print(lcm(a, b))
N=int(input())
edge=[list(map(int,input().split())) for i in range(N-1)]
inf=10**15
c=[[] for i in range(N)]
for i,j,w in edge:
    c[i-1].append((j-1,w))
    c[j-1].append((i-1,w))
Q,K=map(int, input().split())
d=[inf]*N
d[K-1]=0
v=[0]*N
def dfs(p,v,d):
    for n,w in c[p]:
        if v[n]==0:
            d[n]=min(d[n],d[p]+w)
            v[n]=1
            dfs(n,v,d)
dfs(K-1,v,d)
xy=[list(map(int,input().split())) for i in range(Q)]
for x,y in xy:
    print(d[x-1]+d[y-1])

### FIXED CODE ###

N=int(input())
edge=[list(map(int,input().split())) for i in range(N-1)]
inf=10**15
c=[[] for i in range(N)]
for i,j,w in edge:
    c[i-1].append((j-1,w))
    c[j-1].append((i-1,w))
Q,K=map(int, input().split())
d=[inf]*N
d[K-1]=0
v=[0]*N
import sys
sys.setrecursionlimit(10**5+9)
def dfs(p,v,d):
    for n,w in c[p]:
        if v[n]==0:
            d[n]=min(d[n],d[p]+w)
            v[n]=1
            dfs(n,v,d)
dfs(K-1,v,d)
xy=[list(map(int,input().split())) for i in range(Q)]
for x,y in xy:
    print(d[x-1]+d[y-1])
import sys
from collections import deque

mod = 10**9 + 7
n = int(input())
a = deque(sorted(list(map(int, (input().split())))))

if n % 2 == 0:
    for i in range(n//2):
        b = a.pop()
        c = a.pop()
        if b == (i+1)*2 and c = (i+1)*2:
            print(0)
            sys.exit()
    print(pow(2, n//2, mod))

if n % 2 == 1:
    if a.pop() != 0:
        print(0)
        sys.exit()
    for i in range(n//2):
        b = a.pop()
        c = a.pop()
        if b == (i+1)*2 and c = (i+1)*2:
            print(0)
            sys.exit()
    print(pow(2, n//2, mod))


### FIXED CODE ###

import sys
from collections import deque


mod = 10**9 + 7
n = int(input())
a = deque(sorted(list(map(int, (input().split())))))
if n % 2 == 0:
    for i in range(n//2):
        b = a.popleft()
        c = a.popleft()
        if b != i*2+1 or c != i*2+1:
            print(0)
            sys.exit()
    print(pow(2, n//2, mod))

if n % 2 == 1:
    if a.popleft() != 0:
        print(0)
        sys.exit()
    for i in range(n//2):
        b = a.popleft()
        c = a.popleft()
        if b != (i+1)*2 or c != (i+1)*2:
            print(0)
            sys.exit()
    print(pow(2, n//2, mod))
a, b = input().split()
b = b + "*" + "100"
total = a + "*" + b
print(eval(total)//100))


### FIXED CODE ###

a, b = input().split()
a=int(a)
b = int(b.replace('.',''))
c = a*b
c = c//100
print(c)
a,b,c = map(str,raw_input().split())
d,e,f = map(str,raw_input().split())
if a==f and b==e and c==d:
	print 'YES' 
else:
	print 'NO'

### FIXED CODE ###

a = raw_input()
b = raw_input()
if a[0]==b[2] and a[1]==b[1] and a[2]==b[0]:
	print 'YES' 
else:
	print 'NO'
from math import ceil
n = int(input())

total = 0
for i in range(ceil(n ** 0.5) + 1):
  if n % (i + 1) == 0:
    a = n // (i + 1) - 1
    if n // a == n % a:
      total += a

print(total)

### FIXED CODE ###

from math import ceil
n = int(input())

total = 0
for i in range(ceil(n ** 0.5) + 1):
  if n % (i + 1) == 0:
    a = n // (i + 1) - 1
    if a >= 2 and n // a == n % a:
      total += a

print(total)
if __name__ == '__main__':
  S = raw_input
  Sdate = datetime.date(S.year, S.month)
  if Sdate <= datetime(2019, 4, 30):
    return Heisei
  else:
    return TBD

### FIXED CODE ###

from datetime import datetime

if __name__ == '__main__':
  S = raw_input()
  Sdate = datetime.strptime(S, '%Y/%m/%d')
  if Sdate <= datetime(2019, 4, 30):
    print('Heisei')
  else:
    print('TBD')
f = lambda: map(int,input().split())
import math
n, X = f()
x = list(f())
ans = abs(x[0]-X)

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

### FIXED CODE ###

f = lambda: map(int,input().split())


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


n, X = f()
x = list(f())
ans = x[0]-X

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