Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left

def main():
	N, X = map(int, input().split(" "))
	L = input().split(" ")
	L = [int(s) for s in L]
	
	if N == 1:
		print(abs(L[0]-X))
		sys.exit()
	
	L.sort()
	tmp = bisect_left(L, X)
	max1 = L[tmp]
	min1 = 2000000001
	if tmp != 0:
		min1 = L[tmp-1]
	
	ans = min(abs(max1-X), abs(X-min1))
	
	print(ans)
		
	
if __name__ == "__main__":
	main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left

def gcd(a, b):
	if a > b:
		a, b = b, a
		
	while a > 0:
		a, b = b % a, a
	return b
	
def main():
	N, X = map(int, input().split(" "))
	L = input().split(" ")
	L = [int(s) for s in L]
	
	if N == 1:
		print(abs(L[0]-X))
		sys.exit()
	
	L.sort()
	tmp = bisect_left(L, X)
	
	max1 = 2000000001
	if tmp < len(L):
		max1 = L[tmp]
	
	min1 = 2000000001
	if tmp != 0:
		min1 = L[tmp-1]
	
	seed = 0
	mark = -1
	if abs(max1-X) < abs(X-min1):
		seed = abs(max1-X)
		mark = tmp
	else:
		seed = abs(X-min1)
		mark = tmp-1
	
	ans = 2000000001
	for i, val in enumerate(L):
		if i == mark:
			continue
		tmp = abs(L[i] - L[mark])
		ans_tmp = gcd(tmp, seed)
		if ans > ans_tmp:
			ans = ans_tmp
	
	print(ans)
		
	
if __name__ == "__main__":
	main()
k = int(input())
s = input()
i = ""
if len(s) <= k:
  print(s)
  else: 
    for j in range(k):
      i = i + s[j]
    print(i + '...')

### FIXED CODE ###

k = int(input())
s = input()
i = ""
if len(s) <= k:
    print(s)
else:
    for j in range(k):
        i = i + s[j]
    print(i+"...")
while 1:
????????T,U,N,E,W,S=1,6,5,3,4,2
????????n=input()
????????if n==0:
        break
????????ans=T
????????for i in range(n):
????????????????di=raw_input()
????????????????if di=="North":
????????????????????????N,T,S,U=T,S,U,N
????????????????elif di=="East":
????????????????????????E,U,W,T=T,E,U,W
????????????????elif di=="South":
????????????????????????T,S,U,N=N,T,S,U
????????????????elif di=="West":
????????????????????????T,E,U,W=E,U,W,T
????????????????elif di=="Left":
????????????????????????E,S,W,N=S,W,N,E
????????????????elif di=="Right":
????????????????????????S,W,N,E=E,S,W,N
????????????????ans+=T
????????print ans

### FIXED CODE ###

while(1):
    num=int(raw_input())
    if num==0:
        break
    else:
        d=[0,1,2,3,4,5,6]
        sum=1
        for i in range(num):
            dir=num=raw_input()
            if dir=="North":
                d=[0,d[2],d[6],d[3],d[4],d[1],d[5]]
            elif dir=="East":
                d=[0,d[4],d[2],d[1],d[6],d[5],d[3]]
            elif dir=="West":
                d=[0,d[3],d[2],d[6],d[1],d[5],d[4]]
            elif dir=="South":
                d=[0,d[5],d[1],d[3],d[4],d[6],d[2]]
            elif dir=="Right":
                d=[0,d[1],d[3],d[5],d[2],d[4],d[6]]
            else:
                d=[0,d[1],d[4],d[2],d[5],d[3],d[6]]
            sum=sum+d[1]
        print sum
import sys
import numpy as np
input = sys.stdin.readline

def main():
    N, M = map(int, input().split())
    abc = []
    for i in range(M):
        a, b = map(int, input().split())
        c = np.array(list(map(int, input().split()))) - 1
        abc.append((a, b, c))
    abc = sorted(abc)
    INF = int(1e10)
    dp = np.full(N, INF, dtype=int)

    ans = 0
    for i in range(M):
        # print(dp)
        a, b, c = abc[i]
        if any(dp[c] == INF):
            dp[c] = np.minimum(dp[c], a)
            ans += a

    ok = True
    for i in range(N):
        if dp[i] == INF:
            ok = False
            break
    
    if ok:
        print(ans)
    else:
        print(-1)


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
import numpy as np
input = sys.stdin.readline

def main():
    N, M = map(int, input().split())
    INF = int(1e10)
    dp = [INF] * (1 << N)
    dp[0] = 0
    bits = set()
    bits.add(0)
    for i in range(M):
        a, b = map(int, input().split())
        c = list(map(int, input().split()))
        key = 0
        for t in c:
            key += 1 << (t - 1)
        add_bits = set()
        for bit in bits:
            tmp = bit | key
            if dp[bit] + a < dp[tmp]:
                dp[tmp] = dp[bit] + a
                add_bits.add(tmp)
        bits |= add_bits
    
    if dp[(1 << N) - 1] == INF:
        print(-1)
    else:
        print(dp[(1 << N) - 1])

if __name__ == "__main__":
    main()
import sys
import math
s=list(map(str,input()))
for i in range(math.ceil(len(s)/2)):
    if s[2*i]!='L' and s[2*i]!='U' and s[2*i]!='D':
        print('No')
        sys.exit()
for j in range(len(s)//2):
    if [2*i+1]!='R' and s[2*i+1]!='U' and s[2*i+1]!='D':
        print('No')
        sys.exit()
print('Yes')   

### FIXED CODE ###

import sys
s=list(map(str,input()))
for i in range(len(s)):
    if i%2==0 and s[i]=='L':
        print('No')
        sys.exit()
    else:
        if i%2==1 and s[i]=='R':
            print('No')
            sys.exit()
print('Yes')
N, X, M = map(int, input().split())

ans = 0
chck = 0
flag = [0]*(10**5 +1)
lst = [X]

for i in range(N):
    X = (X**2)%M

    if flag[X] == 1:
        break

    flag[X] = 1
    lst.append(X)

preindex = lst.index(X)

preloop = lst[:index]
loop = lst[index:]

loopnum = (N - len(preloop))//len(loop)
loopafternum = (N - len(preloop))%len(loop)

ans = sum(preloop) + sum(loop)*loopnum + sum(loop[:loopafternum])
print(ans)

### FIXED CODE ###

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

ans = 0
flag = [0]*(10**5 + 2)
lst = [X]

for i in range(N):
    X = (X**2)%M

    if flag[X] == 1:
        break

    flag[X] = 1
    lst.append(X)

preindex = lst.index(X)

preloop = lst[:preindex]
loop = lst[preindex:]

loopnum = (N - len(preloop))//len(loop)
loopafternum = (N - len(preloop))%len(loop)

ans = sum(preloop) + sum(loop)*loopnum + sum(loop[:loopafternum])
print(ans)
S, T = int.split()
print(T + S)

### FIXED CODE ###

S, T = input().split()
print(T + S)
x, y = map(int, input().split())
a = x*y/2
if (x%2 != 1) and (y%2 != 1):
    a += 1
print(int(a))

### FIXED CODE ###

k = int(input())
s =  "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1,  51"
l = s.split(",")
print(int(l[k-1]))
a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a,b)+min(c+d))

### FIXED CODE ###

a = (int)(input())
b = (int)(input())
c = (int)(input())
d = (int)(input())
print(min(a,b)+min(c,d))
A, B, N = map(int, input().split())
x = min(N,B-1)
return A*x//B-A*(x//B)

### FIXED CODE ###

A, B, N = map(int, input().split())
x = min(N,B-1)
print(A*x//B-A*(x//B))
import math
a,b,c,d = map(int,input().split())
a=a-1
x=(c*d)//math.gcd(c,d)
n=b//c-a//c
m=b//d-a//d
o=b//x-a//x
ans=b-a-n-m+o
print(ans)

### FIXED CODE ###

import fractions
a,b,c,d = map(int,input().split())
a=a-1
x=(c*d)//fractions.gcd(c,d)
n=b//c-a//c
m=b//d-a//d
o=b//x-a//x
ans=b-a-n-m+o
print(ans)
N, X, T = map(int, input().split())
 
print(T * ((N//X + 1))

### FIXED CODE ###

N, X, T = map(int, input().split())
 
print(T * ((N+(X-1))//X))
l = sorted([int(input)) for i in range(2)])
if l[1]-1>=l[0]:
  print(l[1]*2-1)
elif: l[1] == l[0]:
  print(l[0]*2)
else:
  print(l[0]+l[1]-1)

  
  

### FIXED CODE ###

l = sorted([int(i) for i in input().split()])
if l[1]-1>=l[0]:
  print(l[1]*2-1)
else:
  print(l[0]+l[1])
n,m = map(int,input().split())
a = list(map(int,input().split()))
for i in range(m):
    b,c = map(int,input().split())
    a.extend([c] * b)
a.sort(reverse=True)
print(sum(a[:n]))

### FIXED CODE ###

n,m = map(int,input().split())
L = []
R = []
for i in range(m):
    l,r = map(int,input().split())
    L.append(l)
    R.append(r)
ans = 0
L = max(L)
R = min(R)
for i in range(1,n+1):
    if L <= i and R >= i:
        ans += 1
print(ans)
N = int(input())
dp = [[]for i in range(87)] 
dp[0] = 2
dp[1] = 1

for i in range(2,87):
    dp[i] = dp[i-1]+dp[i-2]
    if i == N:
        print(dp[i])
        break
else:
    print(dp[N])

### FIXED CODE ###

moji = str(input())
A,B,C,D = int(moji[0]),int(moji[1]),int(moji[2]),int(moji[3])

mojiretsu = str(A-B) + str(B-C) + str(C-D)
if ("00" in mojiretsu ):
    print("Yes")
else:
    print("No")
S = input()
T = input()

N = len(S)
M = len(T)

if N < M:
    print('UNRESTORABLE')
    exit()

ans = 'UNRESTORABLE'
for i in range(N-M+1):
    make = True
    for j in range(M):
        if S[i+j] == '?':
            continue
        if S[i+j] != T[j]:
            make = False
    if make:
        ans = S[:i] + T + S[i+M:]
ans = list(ans)
for i in range(N):
    if ans[i] == '?':
        ans[i] = 'a'
print(''.join(ans))


### FIXED CODE ###

S = list(input())
T = list(input())
lenS = len(S)
lenT = len(T)
change = 0
for i in range(lenS-lenT,-1,-1):
    a = 1
    for j in range(lenT):
        if S[i+j] != T[j] and S[i+j] != '?':
            a = 0
    if a == 1:
        for j in range(lenT):
            S[i+j] = T[j]
        change = 1
        break

for i in range(lenS):
    if S[i] == '?':
        S[i] = 'a'

if change == 1:
    print(''.join(S))
else:
    print('UNRESTORABLE')
a = int(input())
b = str(input())
 
if (a/2)%2==1:
  print('No')
elif: b[0:int(a/2)]==b[int(a/2):]:
    print('Yes')
else:
  print('No')

### FIXED CODE ###

a = int(input())
b = str(input())
 
if (a%2)==1:
  print('No')
elif b[0:int(a/2)]==b[int(a/2):]:
    print('Yes')
else:
  print('No')
import numpy as np

l = map(int, input().split())
if l[0]==l[1]:
	print(l[2])
elif l[0] ==l[2]:
	print(l[1])
elif l[1] ==l[2]:
	print(l[0])

### FIXED CODE ###

l = list(map(int, input().split()))
if l[0]==l[1]:
	print(l[2])
elif l[0] ==l[2]:
	print(l[1])
elif l[1] ==l[2]:
	print(l[0])
N=int(input())
if N==1:
  print(1)
  exit()
XL=[list(map(int,input().split())) for i in range(N)]
XL.sort(key=lambda x:x[0]-x[1])
i=0
normv=0
rmv=0
while True:
  if XL[i][0]+XL[i][1]<=XL[i+1][0]-XL[i+1][1]:
    i+=1
    normv+=1
  else:
    if XL[i]>XL[i+1]:
      XL.pop(i)
      rmv+=1
    elif XL[i][0]+XL[i][1] < XL[i+1][0]+XL[i+1][1]:
      XL.pop(i+1)
      i+=1
      normv+=1
      rmv+=1
    else:
      XL.pop(i)
      rmv+=1
  if rmv+normv==N-1:
    break
if len(XL)<2:
  pass
elif XL[-1][0]-XL[-1][0]<XL[-2][0]-XL[-2][0]:
  rmv+=1
else:
  normv+=1
print(len(XL))


### FIXED CODE ###

N=int(input())
XL=[list(map(int,input().split())) for i in range(N)]
XL.sort(key=lambda x:x[0]+x[1])
ans=1
left=XL[0][0]+XL[0][1]
for i in range(1,N):
  if XL[i][0]-XL[i][1] >= left:
    ans+=1
    left=XL[i][0]+XL[i][1]
  else:
    pass
print(ans)
N,i = int(input().split())
print(N-i+1)


### FIXED CODE ###

N,i = map(int,input().split())
print(N-i+1)
import numpy as np
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix
import collections

N, M = map(int, input().split())
edge = np.array([input().split() for _ in range(M)], dtype=np.int8).T

if M == 0:
    print(1)
else:

    tmp = np.ones(M, dtype=np.int8).T
    graph = csr_matrix((tmp, (edge[:] - 1)), (N, N))

    n, labels = connected_components(graph)

    c = collections.Counter(labels)

    print(max(c.values()))

### FIXED CODE ###

import numpy as np
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix
import collections

N, M = map(int, input().split())
edge = np.array([input().split() for _ in range(M)], dtype=np.int64).T

if M == 0:
    print(1)
else:
    tmp = np.ones(M, dtype=np.int64).T
    graph = csr_matrix((tmp, (edge[:] - 1)), (N, N))

    n, labels = connected_components(graph)

    c = collections.Counter(labels)

    print(max(c.values()))
N = int(input())
ans = N /2
print(ans)
N = int(input())
if N % 2 ==0:
  ans = 0.5
else:
  ans = (N + 1) / N / 2

print(ans)


### FIXED CODE ###

N = int(input())
if N % 2 ==0:
  ans = 0.5
else:
  ans = (N + 1) / N / 2

print(ans)
import math

def nPr(n, r):
    return math.factorial(n) // math.factorial(n - r)



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

ab = []
dic = {}
ans = 1

for i in range(N-1):

    a,b = map(int,input().split())
    ab.append([a,b])


while True:

    #print (ab)

    dic = {}

    if len(ab) == 0:
        ans *= K
        break
    elif len(ab) == 1:
        ans *= K * (K-1)
        break

    for i in ab:
        
        if i[0] in dic:
            dic[i[0]].append(i[1])
        
        else:
            dic[i[0]] = [i[1]]

        if i[1] in dic:
            dic[i[1]].append(i[0])
        
        else:
            dic[i[1]] = [i[0]]

    
    miki = []
    for i in dic:

        if len(dic[i])>=2:
            miki.append(i)

    for i in miki:

        lin_mik = 0
        for j in dic[i]:

            if j in miki:
                lin_mik += 1

        ans *= nPr( K - (1 + lin_mik) , len(dic[i])-lin_mik )
        #print (i,"のまわりは",nPr( K - (1 + lin_mik) , len(dic[i])-lin_mik ),"とおり")

    nab = []
    for i in ab:

        if (i[0] in miki) and (i[1] in miki):

            nab.append(i)

    ab = nab.copy()
    #print (miki,"みき",ans)

print (ans % (1000000007))


### FIXED CODE ###

from collections import deque
import sys

#modの掛け算

def modmal(a,b,mod): #a*bをmodを法にして求める

    return a * b % mod


#modの割り算

def moddiv(a,b,mod): #a/bをmodを法にして求める

    return (a * pow(b,mod-2,mod)) % mod


#逆元

def inverse(a,mod): #aのmodを法にした逆元を返す
    return pow(a,mod-2,mod)



#modのn!と、n!の逆元を格納したリストを返す(拾いもの)
#factorialsには[1, 1!%mod , 2!%mod , 6!%mod… , n!%mod] が入っている
#invsには↑の逆元が入っている

def modfac(n, MOD):
 
    f = 1
    factorials = [1]
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    inv = pow(f, MOD - 2, MOD)
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv
    return factorials, invs


def modnCr(n,r,mod,fac,inv): #上で求めたfacとinvsを引数に入れるべし(上の関数で与えたnが計算できる最大のnになる)

    return fac[n] * inv[n-r] * inv[r] % mod



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

mod = 10**9+7
fac,inv = modfac(max(N,K)+100 , mod)

dic = {}

for i in range(N-1):

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

    if a not in dic:
        dic[a] = []
    if b not in dic:
        dic[b] = []

    dic[a].append(b)
    dic[b].append(a)

ans = K

for i in dic:

    if i == 0:

        ans *= fac[K-1] * inv[K-len(dic[i])-1]
        ans %= mod

        if len(dic[i]) >= K:
            print (0)
            sys.exit()

    else:

        ans *= fac[K-2] * inv[K-len(dic[i])-1]
        ans %= mod

        if len(dic[i]) >= K:
            print (0)
            sys.exit()

print (ans)
# Useful data structures
from collections import Counter, defaultdict, deque, namedtuple

# Most useful math functions
from math import gcd

# For sys.std*, sys.argv etc...
import sys

# For cases when input tokens are spread unevenly over many lines.
# This provides methods for reading tokens of various types.
class BufferedTokenizer:
    pass

def read_ints():
    return [int(token) for token in input().split()]

def read_tokens():
    return input().split()

def main():
    print("Yes" if len(set(read_ints())) == 2 else "No")

if __name__ == '__main__':
    main()


### FIXED CODE ###

# For sys.std*, sys.argv etc...
import sys

# For cases when input tokens are spread unevenly over many lines.
# This provides methods for reading tokens of various types.
class BufferedTokenizer:
    pass

def read_ints():
    return [int(token) for token in input().split()]

def read_tokens():
    return input().split()

def main():
    print("Yes" if len(set(read_ints())) == 2 else "No")

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


ind = 0
num = 1


for i in range(len(s)):
    ind = i+1
    if s[i] != 1:
        num = int(s[i])
        break
        
if k>= ind:
    ans = num
else:
    ans = 1
    
print(ans)

### FIXED CODE ###

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



num = 1


for i in range(len(s)):
    ind = i+1
    if s[i] != '1':
        num = int(s[i])
        break
        
if k>= ind:
    ans = num
else:
    ans = 1
    
print(ans)
n,m=[int(i) for i in input().split()]
c={}
for _ in range(n):
  a,b=[int(i) for i in input().split()]
  if a in c:
    c[a].append(b)
  else:
    c[a]=[b]
k=0
l=[]
for i in range(m+1):
  if i in c:
    j=sorted(c[i],reverse=True)
    if l:
      if max(j)>l[0]:
        k+=max(j)
        if len(j)>1:
          l=l+j[1:]
      else:
        k+=max(l)
        del l.index(max(l))
        l=l+j
    else:
      k+=j[0]
      l=j[1:]
  else:
    if l:
      k+=l[0]
      del l.index(max(l))
  if len(l)>m:
    l=l[:m]
print(k)


### FIXED CODE ###

import heapq
n, m = [int(i) for i in input().split()]
ab = []
for _ in range(n):
    a, b = [int(i) for i in input().split()]
    ab.append([a, -b])
ab.sort()
j = 0
ans=0
h = []
for i in range(1, m + 1):
    while j<n and ab[j][0] <= i:
        heapq.heappush(h, ab[j][1])
        j += 1
    if h:
        ans += heapq.heappop(h)
print(-ans)
import sys
from collections import deque
def input(): return sys.stdin.readline().strip()
mod = 10**9+7

class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

comb = Combination(10**6)

def main():
    K = int(input())
    S = deque(input())
    L = len(S)
    """
    dpではなく単純に組み合わせ論だった。。。
    """
    ans = 0
    for x in range(K + 1):
        ans += comb(K - x + L - 1, L - 1) * pow(25, K - x, mod) * pow(26, x, mod)
        ans %= mod
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
from collections import deque
def input(): return sys.stdin.readline().strip()
mod = 10**9+7

class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

comb = Combination(2 * 10**6)

def main():
    K = int(input())
    S = deque(input())
    L = len(S)
    """
    dpではなく単純に組み合わせ論だった。。。
    """
    ans = 0
    for x in range(K + 1):
        ans += comb(K - x + L - 1, L - 1) * pow(25, K - x, mod) * pow(26, x, mod)
        ans %= mod
    print(ans)


if __name__ == "__main__":
    main()
from functools import reduce
from fractions import gcd
from math import gcd

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

gcd_all = reduce(gcd, A)
list = []

for i in range(N):
    #gcd_1 = reduce(gcd, (A[:i]+A[i+1:]))
    for j in range(N):
        if i == j:
            continue
        list.append(gcd(A[i],A[j]))
    #print(list)
    #print(max(list))
    if gcd_all == max(list):
        index = i
        #print(index)
    list = []

    #if gcd_1 >= gcd_all:
     #   gcd_all = gcd_1
A.pop(index)
print(reduce(gcd, A))
#print(gcd_all)


### FIXED CODE ###

from fractions import gcd
from functools import reduce
N = int(input())
A = list(map(int, input().split()))

L = [0] * (N+1)
R = [0] * (N+1)
for i in range(N):
    L[i+1] = gcd(L[i], A[i])
    R[N-i-1] = gcd(R[N-i], A[N-i-1])

max_m = 0
for i in range(N):
    m = gcd(L[i], R[i+1])
    if max_m < m:
        max_m = m
print(max_m)
n,K = map(int,input().split())
v = [int(x) for x in input().split()]

dp = [float("inf") for i in range(n+10)]
dp[0] = 0
dp[1] = abs(v[1]-v[0])
for i in range(n-2):
    for k in range(K):
        if i+1-k>=0:
            dp[i+2] = min(dp[i+2],dp[i+1-k]+abs(v[i+2]-v[i+1-k]))


print(dp[n-1])


### FIXED CODE ###

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

dp = [float("inf") for i in range(n+10)]
dp[0] = 0
dp[1] = abs(v[1]-v[0])
for i in range(n-2):
    dp[i+2] = min(dp[i+1]+abs(v[i+1]-v[i+2]),dp[i]+abs(v[i]-v[i+2]))

print(dp[n-1])
N = int(input())
S, T = map(input().split())

s=""
for i in range(N):
  s = s + S[i] + T[i]
  
print(s)
  

### FIXED CODE ###

N = int(input())
S, T = map(str, input().split())

s=""
for i in range(N):
  s = s + S[i] + T[i]
  
print(s)
N, W = map(int, input().split())
w = []
v = []
for i in range(N):
    a, b = map(int, input().split())
    w.append(a)
    v.append(b)
w_adjust = []
for i in range(N):
    w_adjust.append(w[i]-w[0])

a = w[0]
dp = [[[0 for i in range(N+1)] for j in range(N*3+10)] for k in range(N+1)]
#i個目までの物のうちk個選んで重さの和がjになる中での最大価値
for i in range(N):
    for j in range(3*N):
        for k in range(N):
            dp[i+1][j][k] = max(dp[i+1][j][k], dp[i][j][k])
            dp[i+1][j+w_adjust[i]][k+1] = max(dp[i+1][j+w_adjust[i]][k+1], dp[i][j][k] + v[i])

ans = []
for i in range(N+1):
    if W - a*i >= 0 and W - a*i <= N*3 + 5
        ans.append(dp[N][W-a*i][i])
    else:
        ans.append(0)
print(max(ans))


### FIXED CODE ###

N, W = map(int, input().split())
w = []
v = []
for i in range(N):
    a, b = map(int, input().split())
    w.append(a)
    v.append(b)
w_adjust = []
for i in range(N):
    w_adjust.append(w[i]-w[0])

a = w[0]
dp = [[[0 for i in range(N+1)] for j in range(N*3+10)] for k in range(N+1)]
#i個目までの物のうちk個選んで重さの和がjになる中での最大価値
for i in range(N):
    for j in range(3*N):
        for k in range(N):
            if j + w_adjust[i] > W - a*(k+1):
                dp[i+1][j][k] = max(dp[i+1][j][k], dp[i][j][k])
            else:
                dp[i+1][j+w_adjust[i]][k+1] = max(dp[i+1][j+w_adjust[i]][k+1], dp[i][j][k] + v[i])
                dp[i+1][j][k] = max(dp[i+1][j][k], dp[i][j][k])
ans = [0]
for i in range(1, N+1):
    if W - a*i >= 0 and W - a*i < N*3 + 3:
        ans.append(dp[N][W-a*i][i])

if W - a*N > N*3:
    things = W//w[0]
    if things > N:
        ans.append(sum(v))

elif len(ans) == 1:
    things = W//w[0]
    v.sort()
    v.reverse()
    ans_1 = 0
    for i in range(things):
        ans_1 += v[i]
    ans.append(ans_1)

print(max(ans))
print(''.join((lambda s:s[3]='8')(list(input()))))

### FIXED CODE ###

# coding: utf-8
#map(int,input().split())
print('2018'+input()[4:])
num,time = map(int,raw_input().split())
t = map(int, raw_input().split())
ans = 0
for i in range(len(t)-1):
	if t(i)<time:
		ans += t(i)
	else:
	ans += time
ans += time
print ans

### FIXED CODE ###

num,time = map(int, raw_input().split())
t = raw_input().split()
ans = time
for i in range(0,num-1):
	if int(t[i+1])-int(t[i]) < time:
		ans += int(t[i+1])-int(t[i])
	else:
		ans += time
print ans