Harryxun/stf_run huggingface dataset:
n,m = map(int, input().split())
ac_list = [False]*(n+1)
pena_count = [0]*(n+1)
for i in range(m):
  p, s = map(int, input().split())
  if not ac_list[p]:
    if s == "AC":
      ac_list[p] = True
    else:
      pena_count[p] += 1
ac_count = 0
pena_c = 0
for i in range(1, n+1):
  if ac_list[i]:
    ac_count += 1
    pena_c += pena_count[i]
print(ac_count, pena_c)
      

### FIXED CODE ###

n,m = map(int, input().split())
ac_list = [False]*(n+1)
pena_count = [0]*(n+1)
for i in range(m):
  p, s = input().split()
  p = int(p)
  if not ac_list[p]:
    if s == "AC":
      ac_list[p] = True
    else:
      pena_count[p] += 1
ac_count = 0
pena_c = 0
for i in range(1, n+1):
  if ac_list[i]:
    ac_count += 1
    pena_c += pena_count[i]
print(ac_count, pena_c)
#!/usr/bin/env python3
import bisect
import heapq
import itertools
import math
import numpy as np
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor
def cmb(n,r,mod):
  bunshi=1
  bunbo=1
  for i in range(r):
    bunbo = bunbo*(i+1)%mod
    bunshi = bunshi*(n-i)%mod
  return (bunshi*pow(bunbo,mod-2,mod))%mod
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]



#いまいるところ,
#listとnが与えられたときn回テレポートしたところを出力する
def now_place(li,n):
    now = 1
    for i in range(n):
        now = li[now-1]
    return now

#p回のテレポートでたどってきた道筋のルートを返す

def root(li,p):
    ans = []
    now = 1
    for j in range(p):
        ans.append(now_place(li,j+1))
    return ans



n,k = MI()
a = LI()
#訪れたところのメモがtown
town　= []
#訪れたかどうかを0と1で管理
visit=[0]*n
p = 1
while visit[p-1] == 0:
    town.append(p)
    visit[p-1] = 1
    p = a[p-1]
#香りだかい町がいつでてきたか→周期に入るまでのテレポート回数
#len(town[l:])は周期を表す
l = town.index(p)
if k <len(town):
    print(town[k])
else:
    print(town[l + (k-l)%(len(town[l:])))

### FIXED CODE ###

#!/usr/bin/env python3
import bisect
import heapq
import itertools
import math
import numpy as np
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor
def cmb(n,r,mod):
  bunshi=1
  bunbo=1
  for i in range(r):
    bunbo = bunbo*(i+1)%mod
    bunshi = bunshi*(n-i)%mod
  return (bunshi*pow(bunbo,mod-2,mod))%mod
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]



#いまいるところ,
#listとnが与えられたときn回テレポートしたところを出力する
def now_place(li,n):
    now = 1
    for i in range(n):
        now = li[now-1]
    return now

#p回のテレポートでたどってきた道筋のルートを返す

def root(li,p):
    ans = []
    now = 1
    for j in range(p):
        ans.append(now_place(li,j+1))
    return ans



n,k = MI()
a = LI()
#訪れたところのメモがtown
town = []
#訪れたかどうかを0と1で管理
visit=[0]*n
p = 1
while visit[p-1] == 0:
    town.append(p)
    visit[p-1] = 1
    p = a[p-1]
l = town.index(p)
if k <len(town):
    print(town[k])
else:
    print(town[l + (k-l)%(len(town[l:]))])
#N,Q=8,3
#S="ACACTACG"
#L = [3,2,1]
#R = [7,3,8]

N,Q=map(int, input().split(" "))
S=input()
L=[]
R=[]
for _ in range(Q):
    l,r=map(int,input.split(" "))
    L.append(l)
    R.append(r)


sh=[0]
n=0
for i in range(1,N):
    if S[i-1] == "A" and S[i] == "C":
        n+=1
    sh.append(n)
for (l,r) in zip(L, R):
    print(sh[r-1]-sh[l-1])


### FIXED CODE ###

#N,Q=8,3
#S="ACACTACG"
#L = [3,2,1]
#R = [7,3,8]

N, Q = map(int, input().split(" "))
S = input()
L = []
R = []
for _ in range(Q):
    l, r = map(int, input().split(" "))
    L.append(l)
    R.append(r)

sh = [0]
n = 0
for i in range(1, N):
    if S[i - 1] == "A" and S[i] == "C":
        n += 1
    sh.append(n)
for (l, r) in zip(L, R):
    print(sh[r - 1] - sh[l - 1])
n=int(input())
a=list(map(int,input().split()))
ans=0
cnt=1
for i in range(n):
    if a[i]==a[i+1]:
        cnt+=1
    else:
        ans+=cnt/2
        cnt=1
print(cnt)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=0
cnt=0
for i in range(1,n):
    if a[i]==a[i-1]:
        cnt+=1
        a[i]=0
print(cnt)
from collections import deque
H,W=map(int,input().split())
S=[]
count=0
for _ in range (H):
    A=list(input())
    for a in A:
        if a=='.':
            count+=1
    S.append(A)

mas=deque([(0,0,0)])
while mas:
    y,x,n=mas.popleft()
    if 0<=y<=H-1 and 0<=x<=W-1:
        if S[y][x]=='.':
            S[y][x]=n
            mas.append((y+1,x,n+1))
            mas.append((y,x+1,n+1))
            mas.append((y-1,x,n+1))
            mas.append((y,x-1,n+1))
short=S[H-1][W-1]
print(count-(short+1))

### FIXED CODE ###

from collections import deque
H,W=map(int,input().split())
S=[]
count=0
for _ in range (H):
    A=list(input())
    for a in A:
        if a=='.':
            count+=1
    S.append(A)

mas=deque([(0,0,0)])
while mas:
    y,x,n=mas.popleft()
    if 0<=y<=H-1 and 0<=x<=W-1:
        if S[y][x]=='.':
            S[y][x]=n
            mas.append((y+1,x,n+1))
            mas.append((y,x+1,n+1))
            mas.append((y-1,x,n+1))
            mas.append((y,x-1,n+1))
short=S[H-1][W-1]
if short=='.':
    print(-1)
else:
    print(count-(short+1))
T = stdin.readline().rstrip()
X = stdin.readline().rstrip()

print(float(T)/float(X))

### FIXED CODE ###

T,X =map(int, input().split())
print(float(T)/float(X))
def resolve():
    N = int(input())
    conds = [list(map(int, input().split(" "))) for i in range(N)]
    
    # [[cx, cy, H]]
    candidates = []

    cond = conds[0]
    for cx in range(101):
        for cy in range(101):
            H = abs(cond[0]-cx)+abs(cond[1]-cy)+cond[2]
            if 1 <= H:
                candidates.append([cx, cy, H])
    
    ans = []
    for cand in candidates:
        ansflg = True
        for n in range(1, N):
            cond = conds[n]
            if cond[2] == 0:
                if abs(cond[0]-cand[0])+abs(cond[1]-cand[1]) < cond[2]: 
                    ansflg = False
                    break
            else:
                H = abs(cond[0]-cand[0])+abs(cond[1]-cand[1])+cond[2]
                if H != cand[2]:
                    ansflg = False
                    break
        if ansflg:
            ans = cand
            break
    
    print("{} {} {}".format(ans[0], ans[1], ans[2]))

    


if '__main__' == __name__:
    resolve()

### FIXED CODE ###

def resolve():
    N = int(input())
    conds = [list(map(int, input().split(" "))) for i in range(N)]
    
    first = sorted(conds, reverse=True, key=lambda x:x[2])[0]
    for cx in range(101):
        for cy in range(101):
            H = abs(first[0]-cx)+abs(first[1]-cy)+first[2]
            for n in range(N):
                cond = conds[n]
                if cond[2] == 0:
                    if abs(cond[0]-cx)+abs(cond[1]-cy) < H: 
                        break
                elif abs(cond[0]-cx)+abs(cond[1]-cy)+cond[2] != H:
                    break
            else:
                print("{} {} {}".format(cx, cy, H))
                exit()


if '__main__' == __name__:
    resolve()
n=int(input())
ans="APPROVED"
for i in list(map(int,input().split())):
  if a%2==0:
    if a%3!=0 and a%5!=0:ans="DENIED"
print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
ans="APPROVED"
for i in a:
  if i%2==0:
    if i%3!=0 and i%5!=0:ans="DENIED"
print(ans)
n,m = map(int,input()>split())
homework = list(map(int,input().split()))

if n >= sum(homework):
  print(n-sum(homework))

else:
  print(-1)

### FIXED CODE ###

n,m = map(int,input().split())
homework = list(map(int,input().split()))

if n >= sum(homework):
  print(n-sum(homework))

else:
  print(-1)
a, b=input().split()
 
print(min(a＊(int(b)),b＊(int(a) ) )


### FIXED CODE ###

N,M=map(int,input().split())
print("Yes" if N==M else "No")
a=int(input()
b=int(input()
h=int(input()
print((a+b)*h//2)

### FIXED CODE ###

a=int(input())
b=int(input())
h=int(input())
print((a+b)*h//2)
def main():
    import sys
     input=sys.stdin.readline
    n = int(input())
    hp = sorted([tuple(map(int, input().split()))
                 for _ in [0]*n], key=lambda x: sum(x))
    dp = [10**10]*(n+1)
    dp[0] = 0
    for c, (h, p) in enumerate(hp):
        for k in range(c, -1, -1):
            if dp[k] <= h:
                dp[k+1] = min(dp[k+1], dp[k]+p)
    for i in range(n, -1, -1):
        if dp[i] != 10**10:
            print(i)
            break


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    import sys
    input=sys.stdin.readline
    n=int(input())
    hp=sorted([list(map(int,input().split())) for _ in [0]*n],key=lambda x:sum(x))
    dp=[10**10]*(n+1)
    dp[0]=0
    for c,[h,p] in enumerate(hp):
        for k in range(c,-1,-1):
            if dp[k]<=h:
                dp[k+1]=min(dp[k+1],dp[k]+p)
    for i in range(n,-1,-1):
        if dp[i]!=10**10:
            print(i)
            break
if __name__=='__main__':
    main()
alphabet = "abcdefghijklmnopqrstrvwxyz"


n = int(input()) - 1

A = []
while n > 0:
    A.append(n % 26)
    n //= 26

m = len(A)

if m == 1:
    print(alphabet[A[0]])
    exit()

ANS = []
ANS.append(alphabet[A[0]])
for i in range(1, m - 1):
    if A[i] == 0:
        ANS.append("z")
        A[i + 1] -= 1
    else:
        ANS.append(alphabet[A[i] - 1])
if A[-1]:
    ANS.append(alphabet[A[-1] - 1])

print("".join(ANS[::-1]))


### FIXED CODE ###

alphabets = "abcdefghijklmnopqrstuvwxyz"


n = int(input())

A = []
while True:
    A.append(n % 26)
    n //= 26
    if n == 0:
        break

for i in range(len(A) - 1):
    if A[i] <= 0:
        A[i] += 26; A[i + 1] -= 1

ANS = []
for a in A[::-1]:
    if a == 0:
        continue
    ANS.append(alphabets[a - 1])

print("".join(ANS))
import math

def func(b,n):
  if b > n:
    return n
  else:
    return func(b, math.floor(n/b)) + (n % b)

def solve(n,s):
  for b in range(2,math.floor(math.sqrt(n))+1):
    if func(b,n) == s:
      return b

  for p in range(1,math.floor(math.sqrt(n))+1):
    if (n-s) % p == 0:
      b = int((n-s)/p)+1
      if func(b, n) == s:
        return b

  return -1

if __name__  == "__main__":
  n = int(input())
  s = int(input())
  ans = solve(n,s)
  print(ans)


### FIXED CODE ###

import math

def func(b,n):
  if b > n:
    return n
  else:
    return func(b, math.floor(n/b)) + (n % b)

def _func(b,n):
  x = n
  ret = 0
  while True:
    if b > x:
      return ret + x
    else:
      ret += x % b
      x = math.floor(x/b)

def solve(n,s):
  if n == s:
    return n+1
  ans = float('inf')
  for b in range(2,math.floor(math.sqrt(n))+1):
    if _func(b,n) == s:
      return b

  for p in range(1,math.floor(math.sqrt(n))+1):
    if (n-s) % p == 0:
      b = int((n-s)/p)+1
      if b < 2:
        continue
      if _func(b, n) == s:
        ans = min(ans, b)

  if ans < float('inf'):
    return ans
  else:
    return -1

if __name__  == "__main__":
  n = int(input())
  s = int(input())
  ans = solve(n,s)
  print(ans)
a = int(input())
for i in range(1,a+1):
    if i % 3 == 0 or i % 10 == 3:
        print(" {}".format(i), end = "")
    else:
        while x < 0:
            int(x/=10)
            if x % 10 == 3:
                print(" {}".format(i), end = "")

print()


### FIXED CODE ###

a = int(input())
for i in range(1,a+1):
    x = i
    if i % 3 == 0 or i % 10 == 3:
        print(" {}".format(i), end = "")
    else:
        while int(x) > 0:
            x /= 10
            if int(x) % 10 == 3:
                print(" {}".format(i), end = "")
                break
print()
import math
input = list(map(int,input().split()))
A = input[0]
B = input[1]
C = input[2]
D = input[3]

betweenAandB = B-A+1

cA = math.ceil(A/C)
cB = int(B/C)
cDiv = cB - cA + 1

dA = math.ceil(A/D)
dB = int(B/D)
dDiv = dB - dA + 1

GCD = math.gcd(C,D)
LCM = C*D/GCD

lcmA = math.ceil(A/LCM)
lcmB = int(B/LCM)
lcmDiv = max(lcmA, lcmB) - min(lcmA, lcmB) + 1

ans = betweenAandB - cDiv - dDiv + lcmDiv
print(betweenAandB)
print(cDiv)
print(dDiv)
print(lcmDiv)
print(ans)


### FIXED CODE ###

import math
A,B,C,D = map(int, input().split())

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

betweenAandB = B-A+1

cA = (A-1)//C
cB = B//C
cDiv = cB - cA

dA = (A-1)//D
dB = B//D
dDiv = dB - dA

GCD = gcd(C,D)
LCM = C*D//GCD

lcmA = (A-1)//LCM
lcmB = B//LCM
lcmDiv = lcmB - lcmA

ans = betweenAandB - cDiv - dDiv + lcmDiv
print(ans)
import numpy as np
import itertools
 
H, W, K = list(map(int, input().split())) 
c = [input().split() for l in range(H)]
b=[]
d=[]
for m in range(len(c)):
  for item in c[m]:
    item_mod = item.replace("."  , "0")
    item_mod = item_mod.replace("#" , "1")
    b.append(item_mod)
  d.append(b)
  b=[]

C_arr = np.array(d , dtype = "int")
 
In = np.array(list(itertools.product([0,1] , repeat=H)))
Out = np.array(list(itertools.product([0,1] , repeat=W)))
 
ans = 0
for i in range(2**H):
  for j in range(2**W):
    In_matrix = np.diag(In[i])
    Out_matrix = np.diag(Out[j])
    
    In_C = np.dot(In_matrix , C_arr)
    In_C_Out = np.dot(In_C , Out_matrix)
    
    ICO = In_C_Out.flatten()
    ICO = ICO.tolist()
    
    if ICO.count(1) == K:
      ans += 1
      
print(ans)

### FIXED CODE ###

H, W, K = list(map(int, input().split()))
 
c = [list(input()) for i in range(H)]
 
cnt = 0
for i in range(2**H):
    for j in range(2**W):
        cnt_black = 0
        for k in range(H):
            if (i >> k) & 1:
                continue
            for l in range(W):
                if (j >> l) & 1:
                    continue
                if c[k][l] == '#':
                    cnt_black += 1
        if cnt_black == K:
            cnt += 1
 
print(cnt)
n = int(input())

def f(a, b):
    x = max(a, b)
    return len(str(x))

results = []

for i in range(1, (n // 2) + 1):
    if n % i == 0:
        a = i
        b = int(n / i)
    result = f(a, b)
    results.append(result)

print(min(results))

### FIXED CODE ###

n = int(input())

def f(a, b):
    x = int(max(a, b))
    return len(str(x))

results = []

for i in range(1, int(n ** (1/2)) + 1):
    if n % i == 0:
        a = i
        b = n / i
    result = f(a, b)
    results.append(result)

print(min(results))
N,Q=map(int,input().split())
graph=[[]for _ in range(N)]
point=[0]*N
for _ in range(N-1):
    a,b=map(int,input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)
for _ in range(Q):
    a,b=map(int,input().split())
    a=a-1
    point[a]=point[a]+b

def dfs(now,prev=-1):
    for i in graph[now]:
        if i==prev:
            continue
        point[i]=point[i]+point[now]
        dfs(i,now)
dfs(0)
print(*point)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)
def input():
    return sys.stdin.readline()[:-1]

N,Q=map(int,input().split())
graph=[[]for _ in range(N)]
point=[0]*N
for _ in range(N-1):
    a,b=map(int,input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)
for _ in range(Q):
    a,b=map(int,input().split())
    a=a-1
    point[a]=point[a]+b

def dfs(now,prev=-1):
    for next in graph[now]:
        if next==prev:
            continue
        point[next]=point[next]+point[now]
        dfs(next,now)
dfs(0)
print(*point)
nn,kk=map(int,input.split())
num_value = list(map(int, input().split())) 
num_value.sort()
gokei=0
for i in range(kk):
   gokei=gokei+num_value[i]
print(gokei)



### FIXED CODE ###

nn,kk=map(int,input().split())
num_value = list(map(int, input().split())) 
num_value.sort()
gokei=0
for i in range(kk):
   gokei=gokei+num_value[i]
print(gokei)
N, M = map(int,input().split()) 
P = [list(map(int,input().split())) for i in range(M)]

def zeroPadding(num):
    return "%06d"%num

class Row:
    def __init__(self, i, pref_id, year):
        self.i = i
        self.pref_id = pref_id
        self.year = year
        self.city_id = -1
        
    def __str__(self):
        return "{i: %d, pref_id: %d, year: %d, city_id: %d}"%(self.i, self.pref_id, self.year, self.city_id)
        
    def set_city_id(self, city_id):
        self.city_id = city_id
            
    def get_sort_key(self):
        return zeroPadding(self.pref_id ) + zeroPadding(self.year ) 
            
    def get_str(self):
        return zeroPadding(self.pref_id ) + zeroPadding(self.city_id)

row_list = [Row(i, d[0], d[1]) for i,d in enumerate(P)]
del P
row_list = sorted(row_list, key=lambda x: x.get_sort_key())

now_pref_id = -1
cnt = 1

result = []
for i, row in enumerate(sorted_row_list):
    if row.pref_id != now_pref_id:
        now_pref_id = row.pref_id
        cnt = 1
    
    row.set_city_id(cnt)
    sorted_row_list[i] = row
    cnt += 1

[print(x.get_str()) for x in sorted(sorted_row_list, key=lambda x: x.i)]

### FIXED CODE ###

def zeroPadding(num):
    return "%06d"%num

def zeroPadding10(num):
    return "%010d"%num

class Row:
    def __init__(self, i, pref_id, year):
        self.i = i
        self.pref_id = pref_id
        self.year = year
        self.city_id = -1
        
    def __str__(self):
        return "{i: %d, pref_id: %d, year: %d, city_id: %d}"%(self.i, self.pref_id, self.year, self.city_id)
        
    def set_city_id(self, city_id):
        self.city_id = city_id
            
    def get_sort_key(self):
        return zeroPadding(self.pref_id ) + zeroPadding10(self.year) 
            
    def get_str(self):
        return zeroPadding(self.pref_id ) + zeroPadding(self.city_id)

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

row_list = []

for i in range(M):
    d = list(map(int,input().split())) 
    row_list.append(Row(i, d[0], d[1]))

row_list = sorted(row_list, key=lambda x: x.get_sort_key())

now_pref_id = -1
cnt = 1

result = []
for i, row in enumerate(row_list):
    if row.pref_id != now_pref_id:
        now_pref_id = row.pref_id
        cnt = 1
    
    row.set_city_id(cnt)
    row_list[i] = row
    cnt += 1

[print(x.get_str()) for x in sorted(row_list, key=lambda x: x.i)]
from heapq import *

def calcInk(wdt,val):
    maxval=val[-1]
    histnum=maxval//wdt
    hist=[]
    for i in range(histnum+1):
        hist.append([])
    vl=len(val)
    for i in range(vl):
        v=heappop(val)
        hist[v//wdt].append(v)
    
    highest=0
    for i in range(len(hist)):
        highest=max(highest,len(hist[i]))
    ink=0
    for i in range(len(hist)):
        ink+=(1-i/histnum)*(len(hist[i])/highest)
    return ink+0.01

if __name__=='__main__':
    while True:
        n,w=map(int,input().split())
        if n==w==0:
            break
        V=[]
        for _ in range(n):
            heappush(V,int(input()))

        print(calcInk(w,V))


### FIXED CODE ###

while 1:
    n,w=map(int,input().split())
    if n==w==0:break
    a=[0]*100
    s=h=int(0)
    while n:
        b=int(input())
        a[b//w]+=1
        s=max(s,b//w)
        h=max(h,a[b//w])
        n-=1
    ans=0.01
    for i in range(int(s)+1):
        ans+=a[i]/h*(s-i)/s
    print(ans)
n, m = map(int, input().split())
A = list(map(int, input().split()))

CB = []
for _ in range(m):
    b, c = map(int, input().split())
    CB.append([c, b])

CB.sort(reverse=True)
A.sort()
index = 0
for i in range(m):
    if index >= n:
        break
    elif A[index] >= CB[i][0]:
        break

    for j in range(CB[i][1]):
        if A[index] >= CB[i][0]:
            break

        A[index] = CB[i][0]
        index += 1

print(sum(A))


### FIXED CODE ###

n, m = map(int, input().split())
A = list(map(int, input().split()))

CB = []
for _ in range(m):
    b, c = map(int, input().split())
    CB.append([c, b])

CB.sort(reverse=True)
A.sort()
index = 0
for i in range(m):
    if index >= n:
        break
    elif A[index] >= CB[i][0]:
        break

    for j in range(CB[i][1]):
        if index >= n:
            break
        elif A[index] >= CB[i][0]:
            break

        A[index] = CB[i][0]
        index += 1

print(sum(A))
N = int(input())
T, A = map(int, input().split())
H = list(map(int,input().split()))
ans = 100

for i in N:
    s = T - H(i)*0.006
    ans = min(A-s,ans) 
print(ans)

### FIXED CODE ###

N = int(input())
T, A = map(int, input().split())
H = list(map(int,input().split()))
ans= 0
tmp = 100000
for i in range(N):
    s = T - H[i]*0.006
    if tmp > abs(A - s):
        tmp = abs(A - s )
        ans = i + 1
print(ans)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def make_codivisors(n):
    divisors = []
    n0divisors = make_divisors(n[0])
    n0len = len(n0divisors)
    for i in n0divisors:
        for j in range(1, len(n)):
            if n[j] % i != 0:
                break
            if j == len(n)-1:
                divisors.append(i)
            
    # divisors.sort()
    return max(divisors)


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

print(b)
print(a)

print(make_codivisors(b))

### FIXED CODE ###

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def make_codivisors(n):
    divisors = []
    n0divisors = make_divisors(n[0])
    n0len = len(n0divisors)
    for i in n0divisors:
        for j in range(1, len(n)):
            if n[j] % i != 0:
                break
            if j == len(n)-1:
                divisors.append(i)
            
    # divisors.sort()
    return max(divisors)


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

#print(b)
#print(a)
if len(b) >= 2:
  print(make_codivisors(b))
else:
  print(b[0])
w = int(input())
n = int(input())

amida = []

for i in range(0,w+1):
    amida.append(i)
    
for i in range(n):
    ai,bi = map(int,input().split())
    aa = amida[ai]
    bb = amida[bi]
    amida[ai] = bb
    amida[bi] = aa
    
for i in range(1,w+1):
    print(w[i])
    


### FIXED CODE ###

w = int(input())
n = int(input())

amida = []

for i in range(0,w+1):
    amida.append(i)
    
for i in range(n):
    ai,bi = map(int,input().split(","))
    aa = amida[ai]
    bb = amida[bi]
    amida[ai] = bb
    amida[bi] = aa
    
for i in range(1,w+1):
    print(amida[i])
n = int(input())

aList = []
bList = []
for i in range(n):
    a, b = map(int, input().split())
    aList.append(a)
    bList.append(b)

aList.sort()
bList.sort()

half = n // 2
if not n % 2 == 0:
    print(bList[half] - aList[half] + 1)
else:
    print(bList[half] + bList[half+1] - aList[half] + aList[half+1] + 1)



### FIXED CODE ###

n = int(input())

aList = []
bList = []
for i in range(n):
    a, b = map(int, input().split())
    aList.append(a)
    bList.append(b)

aList.sort()
bList.sort()


if not n % 2 == 0:
    half = (n+1) // 2 - 1
    print(bList[half] - aList[half] + 1)
else:
    half = (n) // 2 - 1
    print(bList[half] + bList[half+1] - (aList[half] + aList[half+1]) + 1)
import fractions
N = int(input())
T = [int(input()) for i in range(N)]
T = list(set(T))
pro = T[0]
for i in range(1,N):
    gcd = fractions.gcd(pro,T[i])
    lcm = (pro * T[i]) // gcd
    pro = lcm
print(lcm)

### FIXED CODE ###

from functools import reduce
from fractions import gcd
N = int(input())
T = [int(input()) for i in range(N)]
def lcm(x,y):
    return (x * y) // gcd(x,y)
ans = reduce(lcm,T)
print(ans)