Harryxun/stf_run huggingface dataset:
p = int(input())
A = list(map(int,input().split()))
a = list(range(1,p+1))
count = 0
for j,i in zip(a,A):
  if i == a[A.index(j)]:
    count += 1
print(count//2)

### FIXED CODE ###

p = int(input())
ans = 0
*A,= map(int,input().split())
for j,i in enumerate(A):
  if A[A[j]-1]==j+1:
    ans+=1
print(ans//2)
import math
from functools import reduce

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

N=int(input())
A=[]
A=list(map(int,input().split(" ",N)))
len=len(A)
gcd=1

for i in range(len):
    x=A.pop(i)
    if gcd_list(A)>gcd:
        gcd=gcd_list(A)
    A.insert(i,x)

print(gcd)


### FIXED CODE ###

import sys

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

n=int(input())
al=input().split()
al_i = [int(s) for s in al]

if (n == 2):
   print(max(al_i[0],al_i[1]))
   sys.exit()

fg = [0] * n
bg = [0] * n

for x in range(n):
   if (x == 0):
       fg[0] = al_i[0]
       y = 1
   else:
      while y <= x:
         fg[y] = gcd(fg[y-1], al_i[y])
         y += 1

for x in range(n):
   if (x == 0):
      bg[0] = al_i[n-1]
      y = 1
   else:
      while y <= x:
         bg[y] = gcd(bg[y-1], al_i[n-1-y])
         y += 1

m = 0
gm = 0

for x in range(n):
   if (x == 0):
      g = bg[n-2]
   elif (x == n-1):
      g = fg[n-2]
   else:
      g = gcd(fg[x-1],bg[n-2-x])
   if (g > gm):
      gm = g

print(gm)
time = int(input))
if time != 0:
    h = time // 3600
    time = time % 3600
    m = time // 60
    s = time % 60
    print(str(h) + ':' + str(m) + ':' + str(s))
else:
    print('0:0:0')

### FIXED CODE ###

time = int(input())
if time != 0:
  h = time // 3600
  time = time % 3600
  m = time // 60
  s = time % 60
  print(str(h) + ':' + str(m) + ':' + str(s))
else:
  print('0:0:0')
n = int(input())
red = [list(map(int,input().split())) for _ in range(n)]
blue = [list(map(int,input().split())) for _ in range(n)]
red_count = []
import copy

for i in range(n):
  index_list = []
  for j in range(n):
    if blue[j][0]>red[i][0] and blue[j][1]>red[i][1]:
      index_list.append(j)
  red_count.append(index_list)
red_count.sort(key=lambda x: len(x))

def redcounter(count,i,removed_index):
  if i == len(red_count)-1 and set(red_count[i])-set(removed_index):
    return count+1
  elif  i == len(red_count)-1: 
    return count
  
  if red_count[i]:
    for index in range(len(red_count[i])): ## removeするindex
      if red_count[i][index] not in removed_index:
        removed_index_copy = copy.copy(removed_index)
        c = count
        removed_index_copy.append(red_count[i][index])
        c = max(c,redcounter(count,i+1,removed_index_copy))
    return c+1
  else:
    return redcounter(count,i+1,removed_index)
   
print(redcounter(0,0,[]))
  


    

### FIXED CODE ###

n = int(input())
lired = [list(map(int,input().split())) for _ in range(n)]
liblue = [list(map(int,input().split())) for _ in range(n)]
lired = sorted(lired,key = lambda x:-x[1])
liblue = sorted(liblue,key = lambda x:x[0])
li = list(range(n))
count = 0

for i in range(n):
  for j in li:
    if lired[i][0] < liblue[j][0] and lired[i][1] < liblue[j][1]:
      count += 1
      li.remove(j)
      break
print(count)
xN =int(input())
l = N * 2
if N % 2 == 0:
    print(N)
else:
    print(N*2)

### FIXED CODE ###

N =int(input())
l = N * 2
if N % 2 == 0:
    print(N)
else:
    print(N*2)
# if 2 * N % 0 and N * N % 0
if __name__ == "__main__":
    A = int(input())
    B = int(input())
    C = int(input())
    K = int(input())
    
    if (K <= A + B):
        print(A)
    else:
        print(A - K + A + B)


### FIXED CODE ###

if __name__ == "__main__":
    num = list(map(int, input().split()))

    if (num[3] == 0):
        print(0)
    elif (num[0] == 0 and num[1] == 0 and num[2] == 0):
        print(0)
    elif (num[3] <= num[0]):
        print(num[3])
    else:
        print(num[0] - num[3] + num[0] + num[1])
s = input()
t = ''
i = 0
while i <= len(s-1):
  t += s[i]
  i += 2
print(t)

### FIXED CODE ###

s = input()
t = ''
i = 0
while i <= len(s)-1:
  t += s[i]
  i += 2
print(t)
N, M = map(int, input().split(' '))

q = []	

for _ in range(N):
	c = int(input())
	
	if c in q:
		q.remove(c)
		q.append(c)
	else:	
		if len(q) == M:
			q.pop(0)
	
		q.append(c)
	
for _ in reversed(q):
	print(_)

### FIXED CODE ###

N, M = map(int, raw_input().split(' '))

q = [ int(input()) for _ in range(N) ]
poll = set()

cnt = 0

for _ in reversed(q):
	if not _ in poll:
		print(_)
		
		cnt = cnt + 1
		
		if cnt == M:
			break	
		
		poll.add(_)
N = input()
T = map(int,raw_input().split(" "))
A = map(int,raw_input().split(" "))




note = [1 for i in range(N)]
fx = [0 for i in range(N)]

def solve():
    global note
    if T[-1] != A[0]:
        return 0
    
    prev = 0
    for i in range(N):
        if prev > T[i]:
            return 0
        elif prev == T[i]:
            note[i] = prev
        else:
            note[i] = 1
            prev = T[i]
            fx[i] = T[i]
    prev = 0
    for i in range(N-1,-1,-1):
        if prev > A[i]:
            return 0
        elif prev == A[i]:
            if not fx[i]:
                note[i] = min(note[i],prev)
            else:
                if fx[i] > A[i]:
                    return 0

        else:
            if fx[i] and fx[i] != A[i]:
                return 0
            note[i] = 1
            prev = A[i]

    ans = 1
    for i in range(N):
        if not fx[i]:
            ans = (ans * note[i])%(10**9+7)
    return ans



    





print solve()


### FIXED CODE ###

S = raw_input()
c = 0
f = 0
for s in S:
    if s == "C":
        c = 1
    if s == "F" and c:
        f = 1
print "Yes" if f else "No"
n = map(int, input().split())
for i in range(5):
  if n[i] == 0:
    print(i+1)
	exit()

### FIXED CODE ###

print(list(input().split()).index("0")+1)
a,b=input().split();print(max(a+b,a-b,a*b))

### FIXED CODE ###

a,b=map(int,input().split());print(max(a+b,a-b,a*b))
n, i = map(int,input().aplit())

print(n - i + 1)

### FIXED CODE ###

n, i = map(int,input().split())
print(n-i+1)
n = input()
a = [long(x) for x in input().split(" ")]
b = [long(x) for x in input().split(" ")]

if sum(a) <= sum(b):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

n = input()
a = [int(x) for x in input().split(" ")]
b = [int(x) for x in input().split(" ")]

negatives = 0
positives = 0

for aa, bb in zip(a,b):
    if aa - bb < 0:
        negatives += (bb-aa)//2*2
    else:
        positives += aa-bb

if negatives >= 2*positives:
    print("Yes")
else:
    print("No")
N, K = list(map(int, input().split()))
links = [list(map(int, input().split())) for _ in range(N-1)]

def perm(a, b):
    s = 1
    for i in range(a-b+1, a+1):
        s *= i
    return s

if N == 1:
    print(K)
elif K == 1:
    print(0)
else:
    mod = 1000000007
    d = {}
    for a, b in links:
        if a in d:
            d[a].append(b)
        else:
            d[a] = [b]
    ans = K * perm(K - 1, len(d[1]))
    root = d[1]
    a = K - 2
    while True:
        children = []
        for i in root:
            if i in d:
                b = len(d[i])
                if a < b:
                    print(0)
                    break
                ans *= perm(a, b)
                children.extend(d[i])
        else:
            if children == []:
                print(ans % mod)
                break
            root = children
            continue
        break

### FIXED CODE ###

N, K = list(map(int, input().split()))
l = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    a, b = list(map(int, input().split()))
    l[a].append(b)
    l[b].append(a)

deg1 = [0] * (N + 1)
deg2 = [0] * (N + 1)
history = [True] * (N + 1)
stack = [1]
ans = 1

while stack:
    node = stack.pop()
    ans *= K - deg1[node] - deg2[node]
    ans %= 1000000007
    history[node] = False
    for child in l[node]:
        if history[child]:
            deg1[child] += 1
            deg2[child] += deg1[node]
            deg1[node] += 1
            stack.append(child)
            
print(ans)
x=int(input())
t=int(x**0.2)
for i in [t-1,t,t+1,t+2,t+3]:
  if  i**5+1==x:
    print(i,-1,sep=' ')
  elif i**5-1==x:
    print(i,1,sep=' ')

### FIXED CODE ###

n,m=map(int,input().split())
h=list(map(int,input().split()))
l=[[] for _ in range(n)]
for _ in range(m):
  a,b=map(int,input().split())
  l[a-1].append(b-1)
  l[b-1].append(a-1)
ans=0
for i in range(n):
  f=1
  for j in l[i]:
    if h[i]<=h[j]:
      f=0
  if f:
    ans+=1
print(ans)
i = 0
k_n = []
k_n_all = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

p_price, k_number = map(int, input().split())
k_n = map(int, input().split())
result_number = list(set(k_n_all) - set(k_n))
result_price = p_price

while True:
    x = 0
    y = 0
    z = list(map(int, str(result_price)))
    while x < len(z):
        if z[x] in result_number:
            y += 0
        else:
            y += 1
        x += 1

    if y == 0:
        print(result_price)
        break
    else:
        result_price += 1

### FIXED CODE ###

n_5 = 0
n_7 = 0

a = map(int, input().split())
for i in a:
    if i == 5:
        n_5 += 1
    elif i == 7:
        n_7 += 1

if n_5 == 2 and n_7 == 1:
    print("YES")
else:
    print("NO")
N,H=map(int,input().split())
ab=[input().split() for i in range(N)]
a = [int(ab[i][0]) for i in range(N)]
maxa = max(a)
b = np.array([int(ab[i][1]) for i in range(N)])
b_effective = b[b > maxa]
b = np.sort(b_effective)[::-1]
s = 0
for i in range(len(b)):
    s += b[i]
    if s >= Y:
        c = i + 1
        break
rest = max(H-sum(b_effective), 0)
if rest % maxa == 0:
    d = rest//maxa
else:
    d = rest//maxa + 1
print(c+d)

### FIXED CODE ###

import numpy as np
N,H=map(int,input().split())
ab=[input().split() for i in range(N)]
a = [int(ab[i][0]) for i in range(N)]
maxa = max(a)
b = np.array([int(ab[i][1]) for i in range(N)])
b_effective = b[b > maxa]
d = 0
if sum(b_effective) < H:
    c = len(b_effective)
    rest = H - sum(b_effective)
    if rest % maxa == 0:
        d = rest//maxa
    else:
        d = rest//maxa + 1
else:
    b = np.sort(b_effective)[::-1]
    s = 0
    for i in range(len(b)):
        s += b[i]
        if s >= H:
            c = i + 1
            d = 0
            break
print(c+d)
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

d = [[None]*n for _ in range(n)]
for i in range(n):
    for j in range(n):
        d[i][j] = min(i, n-1-i, j, n-1-j)
vacant = [[False]*n for _ in range(n)]
from numba import njit
@njit
def sub(x,y):
    v = d[x][y]
    q = [(v, x, y)]
    dx = [0,1,0,-1]
    dy = [1,0,-1,0]
    while q:
        v,i,j = q.pop()
        for xx, yy in zip(dx,dy):
            ii = i+xx
            jj = j+yy
            if ii<0 or jj<0 or ii>=n or jj>=n:
                continue
            if d[ii][jj]>v:
                d[ii][jj] = v
                nv = v+1 if not vacant[ii][jj] else v
                q.append((nv, ii, jj))
ans = 0
for v in p:
    v -= 1
    x,y = v//n, v%n
    ans += d[x][y]
#     print(v, d[x][y], d)
    sub(x,y)
    vacant[x][y] = True
print(ans)

### FIXED CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

d = [None] * (n**2)
for i in range(n):
    for j in range(n):
        d[i*n+j] = min(i, n-1-i, j, n-1-j)
vacant = [False] * (n**2)

ans = 0
for pos in p:
    pos -= 1
    ans += d[pos]
    vacant[pos] = True
    q = [pos]
    while q:
        pos = q.pop()
        tmp = not vacant[pos]
#         for diff in (-1, 1, -n, n):
#             ppos = diff+pos
#             if ppos<0 or ppos>=n*n:
#                 continue
#             if d[ppos]>d[pos]+tmp:
#                 d[ppos] = d[pos] + tmp
#                 q.append(ppos)
        if pos+n<n*n:
            ppos = pos + n
            if d[ppos]>d[pos]+tmp:
                d[ppos] = d[pos] + tmp
                q.append(ppos)
        if pos-n>=0:
            ppos = pos - n
            if d[ppos]>d[pos]+tmp:
                d[ppos] = d[pos] + tmp
                q.append(ppos)
        if pos+1<n*n:
            ppos = pos + 1
            if d[ppos]>d[pos]+tmp:
                d[ppos] = d[pos] + tmp
                q.append(ppos)
        if pos-1>=0:
            ppos = pos - 1
            if d[ppos]>d[pos]+tmp:
                d[ppos] = d[pos] + tmp
                q.append(ppos)
print(ans)
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math

N,M = map(int,input().split())
S = input()
N = len(S)-1
if "1"*M in S:
  print(-1)
  exit()  

if M>=N:
  print(N)
  exit()

max_n = [0 for i in range(N+1)]

for i in range(1,N+1):
  s = S[max(0,i-M):i]
  l = len(s)
  if l == 0:
    continue
  mask = (1<<l) -1
  b = (~int(s, 2)) & mask
  max_n[i] = math.floor(math.log(b)/math.log(2))+1
  
now = N
deme = []
while now != 0:
  x = max_n[now]
  now = now-x
  deme.append(x)
print(*deme[::-1])

### FIXED CODE ###

import sys
input = sys.stdin.readline

import math
import bisect

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

if "1"*M in S:
  print(-1)
  exit()  

S = [int(S[i]) for i in range(N+1)]

L = [(1<<i) -1 for i in range(1,M+1)]

max_n = [0]
mask = (1<<M) -1
b = 0
for i in range(N):
  b = ((b<<1) + (1- S[i])) & mask
  max_n.append(bisect.bisect_left(L,b)+1)

now = N
deme = []
while now != 0:
  x = max_n[now]
  now -= x
  deme.append(x)
print(*deme[::-1])
N = int(input())
B = list(map(int, input().split()))
s = 0
for i in range(B):
  if i == 0:
    s += B[0]
  else:
    s += min(B[i-1], B[i])
print(s + B[N-1])

### FIXED CODE ###

N = int(input())
B = list(map(int, input().split()))
s = 0
for i in range(N-1):
  if i == 0:
    s += B[0]
  else:
    s += min(B[i-1], B[i])
print(s + B[N-2])
x, y = map(int, input().split())

b = abs(abs(x)-abs(y))
if x * y < 0:
    print(b+1)
elif 0 =< y < x or y < x <= 0:
    print(b+2)
else:
    print(b) 

### FIXED CODE ###

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

b = abs(abs(x)-abs(y))
if x * y < 0:
    print(b+1)
elif 0 < y < x or y < x < 0:
    print(b+2)
elif (y == 0 and x > 0) or (x == 0 and y < 0):
    print(b+1)
else:
    print(b)
n = int(input())
a = list(map(int,input().split()))
ans = 1

check = True
zero = False

for i in a:
    ans = ans*i

    if i==0:
        zero = True
        break;

    if ans>1000000000000000000:
        check = False
        break;




if zero:
    print(0)
else:
    if check:
        print(ans)
    else:
        print(-1)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
ans = 1

check = True
zero = False

for i in range(0,n):
    if a[i]==0:
        zero = True
        break;




for i in range(0,n):
    ans = ans*a[i]

    if ans>1000000000000000000:
        check = False
        break;




if zero:
    print(0)
else:
    if check:
        print(ans)
    else:
        print(-1)
n,m=map(int,input().split())
k=[]
a=[]
for i in range(n):
  b=list(map(int,input().split()))
  k.append(b[0])
  a.append(b[1:])
d={}
for i in range(n):
  for j in range(k[i]):
    if a[i][j] not in d:
      d[a[i][j]]=1
    else:
      d[a[i][j]]+=1
nd=list(d.values())
cnt=0
for i in range(len(nd)):
  if nd[i]==n:
    cnt+=1
print(cnt

### FIXED CODE ###

n,m=map(int,input().split())
k=[]
a=[]
for i in range(n):
  b=list(map(int,input().split()))
  k.append(b[0])
  a.append(b[1:])
d={}
for i in range(n):
  for j in range(k[i]):
    if a[i][j] not in d:
      d[a[i][j]]=1
    else:
      d[a[i][j]]+=1
nd=list(d.values())
cnt=0
for i in range(len(nd)):
  if nd[i]==n:
    cnt+=1
print(cnt)
from collections import deque
s = deque(input())
n = len(s)

temp = [0]*2019
t = 1
num = 0
for i in range(n):
    num += int(s.pop())*t % 2019
    temp[num] += 1
    t *= 10

ans = temp[0]
for t in temp:
    if t > 1:
        ans += t*(t-1)/2

print(int(ans))

### FIXED CODE ###

S=input()
N=len(S)
M=2019

remainder=[0]*M
val=0
for i in range(N):
  val=(int(S[N-1-i])*pow(10,i,M)+val)%M
  remainder[val]+=1

ans=remainder[0]
for i in range(2019):
  ans+=remainder[i]*(remainder[i]-1)//2
print(ans)
n, q = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n-1)]
px = [list(map(int, input().split())) for _ in range(q)]

cnt = [0 for _ in range(n)]
for p, x in px:
    cnt[p-1] += x

edge = [[] for _ in range(n)]
for a, b in ab:
    edge[a-1].append(b)
    edge[b-1].append(a)


def dfs(now, bef):
    for nxt in edge[now]:
        if nxt != bef:
            cnt[nxt] += cnt[now]
            dfs(nxt, now)


dfs(1, 0)
print(*cnt[1:])


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)


def input(): return sys.stdin.readline()


N, Q = map(int, input().split())
ab = [[] for _ in range(N)]
for i in range(N-1):
  a, b = map(int, input().split())
  ab[a-1].append(b)
  ab[b-1].append(a)

P = [0 for _ in range(N)]
for i in range(Q):
  p, x = map(int, input().split())
  P[p-1] += x


def dfs(p, par):
  for i in ab[p-1]:
    if i != par:
      P[i-1] += P[p-1]
      dfs(i, p)


dfs(1, -12345)
print(" ".join(map(str, P)))
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

d,n = map(int,input().split())
a = 100**d
c = [1]
for i in range(n):
    if i%100 == 0:
        continue
    c.append(a*i)
print(c[n])

### FIXED CODE ###

import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

d,n = map(int,input().split())
if n != 100:
    print(n*100**d)
else:
    print(101*100**d)
n=int(input())
a=list(map(int,input().split()))

jyoshi=[0]*n
for i in range(n-1):
  jyo=a[i]
  jyoshi[jyo-1]=jyoshi[jyo-1]+1
  
for k in jyoshi:
  print k


### FIXED CODE ###

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

jyoshi=[0]*n
for i in range(n-1):
  jyo=a[i]
  jyoshi[jyo-1]=jyoshi[jyo-1]+1
  
for k in jyoshi:
  print(k)
x = input()

if x >= 30 :
  print('Yes')
else :
  print('No')

### FIXED CODE ###

x = int(input())

if x >= 30 :
  print('Yes')
else :
  print('No')
a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for K in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                ans += 1
print(ans)

### FIXED CODE ###

a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                ans += 1
print(ans)
import itertools
n,m=map(int,input().split())
edge=[[]for i in range(m+1)]

for i in range(m):
    a,b=map(int,input().split())
    edge[a].append(b)
    edge[b].append(a)
    
ans=0
for i in itertools.permutations(range(1,n+1)):
    if i[0]!=1:
        continue
    for j in range(n-1):
        if i[j+1] not in edge[i[j]]:
            break
    else:
        ans+=1
print(ans)

### FIXED CODE ###

import itertools
n,m=map(int,input().split())
edge=[[]for i in range(n+1)]

for i in range(m):
    a,b=map(int,input().split())
    edge[a].append(b)
    edge[b].append(a)
    
ans=0
for i in itertools.permutations(range(1,n+1)):
    if i[0]!=1:
        continue
    for j in range(n-1):
        if i[j+1] not in edge[i[j]]:
            break
    else:
        ans+=1
print(ans)
import sys

lst = []
for line in sys.stdin:
    num = int(line.split())
    if num == 0:
        print lst.pop()
    else:
        lst.append(num)
sys.exit(0)

### FIXED CODE ###

import sys

lst = []
for line in sys.stdin:
    if line.strip() :
        num = int(line.strip())
        if num == 0:
            print lst.pop()
        else:
            lst.append(num)
N = int(input())
a = list(map(int, input().split()))
flag = [0]*9
ans = 0
ans_max =0
for i in range(N):
    num = a[i]//400
    if num>8:
        flag[num]+=1
    else:
        flag[num]=1
ans = sum(flag[:-1])
if flag[8]>8:
    ans_sum = ans + 8
else:
    ans_sum = ans + flag[8]
    
print(ans, ans_sum)

### FIXED CODE ###

# coding: utf-8

N = int(input())
a = list(map(int, input().split()))
flag = [0]*9
ans = 0
ans_max =0
for i in range(N):
    num = a[i]//400
    if num>=8:
        flag[8]+=1
    else:
        flag[num]=1
ans = sum(flag[:-1])
if ans == 0:
    ans =1
    ans_sum = flag[8]
else: 
    ans_sum= ans+flag[8]
    
print(ans, ans_sum)
n = input()
if n[0]=n[2]:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

n = input()
if n[0]==n[2]:
  print('Yes')
else:
  print('No')
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import functools
import math

input = sys.stdin.readline
n, x = map(int, input().split())
a = input().split()
b = list(map(int, a))
b.append(x)
b.sort()
c = []
for i in range(1, n):
    c.append(b[i] - b[i - 1])
gcd = functools.reduce(math.gcd, c)
print(gcd)


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys

input = sys.stdin.readline
n, x = map(int, input().split())
a = input().split()
b = list(map(int, a))
b.append(x)
b.sort()
if len(b) == 2:
    print(b[1] - b[0])
    exit(0)
c = [abs(a - x) for a in b]


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


ans = c[0]
for i in range(len(c)):
    ans = gcd(c[i], ans)
print(ans)
import sys

input = sys.stdin.readline


def main():
    n, x = [int(i) for i in input().split()]
    l_list = [int(i) for i in input().split()]
    d_list = [0]
    d = d_list[0]
    for i in range(1, n):
        d = d + l_list[i - 1] * (i <= n + 1)
        d_list.append(d)
    print(len(filter(lambda i: i <= x, d_list)))


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys

input = sys.stdin.readline


def main():
    n, x = [int(i) for i in input().split()]
    l_list = [int(i) for i in input().split()]
    n += 1
    d = 0
    num = 1
    for i in range(1, n):
        d = d + l_list[i - 1] * (i <= n + 1)
        if d > x:
            break
        num += 1
    print(num)


if __name__ == "__main__":
    main()
import math
N, K = map(int, input().split())
def comb(n, r):
    if n < 0 or r < 0:
        return 1
    else:
        return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
for i in range(1, K + 1):
    print((comb(K-1,i-1) * comb(N-K+1,i))%(10**9+7))


### FIXED CODE ###

import math
N, K = map(int, input().split())
def comb(n, r):
    if n < r or n < 0 or r < 0:
        return 0
    else:
        return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
for i in range(1, K + 1):
    print((comb(K-1,i-1) * comb(N-K+1,i))%(10**9+7))
s = input()
K = int(input())

substringList = []
if(len(s) < 50):
    for i in range(len(s)):
            for j in range(i, len(s)):
                #print(i,j)
                if(s[i:j+1] in substringList):
                    pass
                else:
                    substringList.append(s[i:j+1])
else:
    for i in range(len(s)):
            for j in range(i, I+3):
                #print(i,j)
                if(s[i:j+1] in substringList):
                    pass
                else:
                    substringList.append(s[i:j+1])
#substringList = list(set(substringList))
print(sorted(substringList)[K-1])


### FIXED CODE ###

s = input()
K = int(input())

substringList = []
if(len(s) < 50):
    for i in range(len(s)):
            for j in range(i, len(s)):
                #print(i,j)
                if(s[i:j+1] in substringList):
                    pass
                else:
                    substringList.append(s[i:j+1])
else:
    for i in range(len(s)):
            for j in range(i, i+5):
                substringList.append(s[i:j+1])
#substringList = list(set(substringList))
print(sorted(list(set(substringList)))[K-1])