Harryxun/stf_run huggingface dataset:
s = input()
t = input()
count = 0
res = ''
ans = ''

for x in t:
  if x not in s:
    continue
  elif t.index(x) > s.index(x):
    continue
  else:
    i = s.index(x)
    ans = x
  
res = s[i-t.index(ans):i-t.index(ans)+len(t)]

if res:
  if len(res) < len(t):
    print(len(t))
  else:
    for i in range(len(res)):
      if res[i] != t[i]:
        count += 1
    print(count)
else:
  print(len(t))

### FIXED CODE ###

s = input()
t = input()
res = []
for i in range(len(s)-len(t)+1):
    x = s[i:i+len(t)]
    count = sum(1 for a, b in zip(t, x) if a != b)
    res.append(count)

print(min(res))
N,K=map(int,(input().split()))
TO=list(map(int,input().split()))

visit_flag=[[0]*2 for i in [1]*N]
visit_count=0
first_visit=0
last_visit=0
next_town=1
visit_flag[0][0]=1
visit_flag[0][1]=0

for i in range(K):
    visit_count+=1
    next_town = TO[next_town-1]
    if visit_flag[next_town-1][0]==0:
        visit_flag[next_town-1][0]=1
        visit_flag[next_town-1][1]=visit_count
    else:
        first_visit=visit_flag[next_town-1][1]
        last_visit=visit_count
        break

roop=last_visit-first_visit
span=visit_flag[next_town-1][1]

if K<=roop:
    next_town = 1
    for i in range(K):     
        next_town = TO[next_town-1]
    ans=next_town
else:
    if roop==0:
        ans=ans=next_town
    else:
        for i in range((K-span)%roop):
            next_town = TO[next_town-1]
            ans=next_town

print(ans)

### FIXED CODE ###

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

visit_flag=[[0]*2 for i in [1]*N]
visit_count=0
first_visit=0
last_visit=0
next_town=1
visit_flag[0][0]=1
visit_flag[0][1]=0

for i in range(K):
    visit_count+=1
    next_town = TO[next_town-1]
    if visit_flag[next_town-1][0]==0:
        visit_flag[next_town-1][0]=1
        visit_flag[next_town-1][1]=visit_count
    else:
        first_visit=visit_flag[next_town-1][1]
        last_visit=visit_count
        break

roop=last_visit-first_visit
span=visit_flag[next_town-1][1]

if K<=roop:
    next_town = 1
    for i in range(K):     
        next_town = TO[next_town-1]
    ans=next_town
else:
    if roop==0:
        ans=next_town
    else:
        for i in range((K-span)%roop):
            next_town = TO[next_town-1]
        ans=next_town

print(ans)
r,l=map(int,input().split())
if l-r>=2019 or r%2019==0 or l%2019==0:
    print(0)
else:
    ans=2018
    for i in range(r,l):
        for j in range(i+1,l+1):
            ans=min(ans,(i*j)%2019)
print(ans)

### FIXED CODE ###

r,l=map(int,input().split())
v1,v2=r//2019,l//2019
if v2-v1>=1 or r%2019==0 or l%2019==0:
    print(0)
else:
    ans=2018
    for i in range(r,l):
        for j in range(i+1,l+1):
            ans=min(ans,(i*j)%2019)
    print(ans)
from collections import Counter
N = int(input())
v = list(map(int, input().split()))
e = []
o = []
for idx, i in enumerate(v):
    if idx % 2 == 0:
        o.append(i)
    else:
        e.append(i)

e = Counter(e).most_common()
o = Counter(o).most_common()
ea = N // 2
e1 = e[0][1]
e2 = e[1][1]
oa = N - ea
o1 = o[0][1]
o2 = o[1][1]
cnt = 0
if e1 != o1:
    cnt = N - e1 - o1
else:
    if o2 > e1:
        cnt = N - e2 - o1
    else:
        cnt = N - e1 - o2
print(cnt)

### FIXED CODE ###

from collections import Counter
N = int(input())
v = list(map(int, input().split()))
e = []
o = []
for idx, i in enumerate(v):
    if idx % 2 == 0:
        o.append(i)
    else:
        e.append(i)

e = Counter(e).most_common()
o = Counter(o).most_common()
e1 = e[0][1]
e2 = e[1][1] if len(e) > 1 else 0
o1 = o[0][1]
o2 = o[1][1] if len(o) > 1 else 0
cnt = 0
if e[0][0] != o[0][0]:
    cnt = N - e1 - o1
else:
    o = N - e1 - o2
    e = N - e2 - o1
    cnt = min(o, e)
print(cnt)
num = list(map(int, input().split()))

X= num[0]
Y =num[1]

for i in range(X+1):
  if 4*X - 2*i == Y:
    print("Yes")
    braek;
  else:
    print("No")
    break;

### FIXED CODE ###

num = list(map(int, input().split()))
X= num[0]
Y =num[1]

ans = "No"
for i in range(X+1):
  if 4*X - 2*i == Y:
    ans = "Yes"
    break;
print(ans)
n=int(input())
import math
ans=[]
for i in range(1,int(math.sqrt(n))):
    if n%i==0:
        tmp=n//i
        ans.append(abs(i-1)+abs(tmp-1))
print(min(ans))



### FIXED CODE ###

#a,b=map(int,input().split())
n=int(input())
import math
ans=[]
for i in range(1,int(math.sqrt(n))+1):
    if n%i==0:
        dis=abs(i-1)+abs(n//i-1)
        ans.append(dis)
print(min(ans))
import sys
sys.setrecursionlimit(1000000000)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    A,B=mis
    print(A*b if 0<A<10 and 0<B<10 else '-1')


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000000)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    A,B=mis()
    print(A*B if 0<A<10 and 0<B<10 else '-1')


if __name__ == "__main__":
    main()
print(chr(ord(input())+1)

### FIXED CODE ###

print(chr(1+ord(input())))
n = int(input())
s = input()

tmp = n // 2
if s[0:tmp + 1] == s[tmp + 1:]:
    return tmp

res = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        tt = res
        mx = min(j - i, n - j)
        if tt >= mx:
            continue
        while tt <= mx:
            tt += 1
            if s[i:i + tt] != s[j:j + tt]:
                break
        _res = tt - 1
        res = max(res, _res)

print(res)

### FIXED CODE ###

n = int(input())
s = input()

dp = [[0 for i in range(5005)] for j in range(5005)]

for i in range(n - 1, -1, -1):
    for j in range(n - 1, -1, -1):
        dp[i][j] = 0 if s[i] != s[j] else dp[i + 1][j + 1] + 1

res = 0
for i in range(n):
    for j in range(n):
        if i >= j:
            continue
        curr = min(dp[i][j], j - i)
        res = max(res, curr)

print(res)
import fractions
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b / fractions.gcd(a, b)

n = int(input())

ans = 1
for i in range(n):
    ti = int(input())
    ans = int(lcm(ti, ans))
while True:
    try:
        input()
    except EOFError:
        break
print(ans)


### FIXED CODE ###

import fractions
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b // fractions.gcd(a, b)

n = int(input())

ans = 1
for i in range(n):
    ti = int(input())
    ans = int(lcm(ti, ans))
print(ans)
n = int(input())
print(n.count(9))

### FIXED CODE ###

n = input()
print('Yes' if n.count('9') else 'No')
N,M = map(int, input().split())
piys = [[] for _ in range(M)] 
for i in range(M):
    p, y = map(int, input().split())
    piys[p-1].append((y,i))
    
ans = [None]*M
for p,iys in enumerate(piys):
    iys.sort()
    for k,(y,i) in enumerate(iys):
        ans[i] = "%06d%06d" % (p+1,k+1)

for i in ans:
    print(i)

### FIXED CODE ###

N,M = map(int, input().split())
piys = [[] for _ in range(N)] 
for i in range(M):
    p, y = map(int, input().split())
    piys[p-1].append((y,i))
    
ans = [None]*M
for p,iys in enumerate(piys):
    iys.sort()
    for k,(y,i) in enumerate(iys):
        ans[i] = "%06d%06d" % (p+1,k+1)
 
for i in ans:
    print(i)
n=int(input())
l=[str(input()) for i in range(n)]
ans = 0
for i in range(n):
    if list(l[i])[-1] == list(l[i+1])[0] and l.count(l[i]) == 1:
        ans += 1
    else:
        ans += 0
print('Yes' if ans==n else'N0')

### FIXED CODE ###

n=int(input())
l=[str(input()) for i in range(n)]
ans = 'Yes'
for i in range(1,n):
    if l[i][0] != l[i-1][-1]:
        ans = 'No'
        break
if len(set(l)) != n:
  ans = 'No'
print(ans)
x = int(input())
A = list(map(int, input().split()))

kabu=0
money=1000
x=x-1
for i in range(len(A)):
    if A[x-i]>A[x-i-1]:
        lastday=x-i
        break
    
for i in range(lastday):
    if A[i]<A[i+1]:#翌日の方が高い⇒購入
        buy=money//A[i]
        money-=A[i]*buy
        kabu+=buy
    elif A[i]>A[i+1]:#前日の方が低い⇒売却
        money+=A[i]*kabu
        kabu=0

money+=A[lastday]*kabu
print(money)
        

### FIXED CODE ###

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

kabu=0
money=1000
x=x-1
lastday=0
for i in range(len(A)):
    if A[x-i]>A[x-i-1]:
        lastday=x-i
        break
    
for i in range(lastday):
    if A[i]<A[i+1]:
        buy=money//A[i]
        money-=A[i]*buy
        kabu+=buy
    elif A[i]>A[i+1]:
        money+=A[i]*kabu
        kabu=0

money+=A[lastday]*kabu
print(money)
N = int(input())
S = input()

ans = 0
for kosu in range(1, N//2+1):
    hantei = False
    for i in range(N-kosu):
        if hantei:
            break
        else:
            temp = S[i:i+kosu]
            # print("temp:", temp)
            # print("比較する文字列",S[0:i] + "|" + S[i+1:])
        if temp in S[0:i]+S[i+1:]:
            # print("Trueの時")
            ans = len(list(temp))
            hantei = True
            breaks
print(ans)


### FIXED CODE ###

def main():
    N = int(input())
    S = input()
    l1 = length = 0
    l2 = 1

    while (l2 + length < N):
        if S[l1:l2] in S[l2:]:
            length = l2 - l1
            l2 += 1
        else:
            l1 += 1
            l2 = l1 + length + 1
    print(length)

main()
from sys import stdin

A = int(stdin.readline().rstrip())

if A%2 == 0:
    print(A/(A/2))
else:
    print(A/(A//2))



### FIXED CODE ###

from sys import stdin

A = int(stdin.readline().rstrip())

if A%2 == 0:
    print((A/2)/A)
else:
    print((A//2 + 1)/A)
t = input()
s = t.replace('?', 'D')
n = 0
for i in range(0, len(s)):
	if s[i:i+1]=='P' and s[i+1:i+2]=='D':
		n+=1
	else if s[i:i+1]:
		n+=1
print(n)

### FIXED CODE ###

t = input()
s = t.replace('?', 'D')
print(s)
k=input()
pair=0
odd=0
even=0
for i in range(1,k+1) 
     if i%2==0:
        even+=1
     else:
            odd+=1
print(odd*even)



### FIXED CODE ###

k=int(input())
if (k%2)==1 and k<=100:
    a=k//2
    b=k//2+1
elif (k%2)==0 and k<=100:
    a=k//2
    b=k//2
print(a*b)
#import sys
#input = sys.stdin.readline
from itertools import accumulate
def main():
    N = int( input())
    A = list( map( int, input().split()))
    C = [0]*(N*2+2)
    L = [0]*(N*2+2)
    cnt = 0
    if sum(A)%(N*(N+1)//2) != 0:
        print("NO")
        return
    t = sum(A)//(N*(N+1)//2)
    for i in range(N):
        if (A[i] - A[i-1] + (N-1)*t)%N != 0:
            print("NO")
            return
        k =  (A[i] - A[i-1] + (N-1)*t)//N
        C[i] += t-k
        C[i+N] -= t-k
        cnt += t-k
        L[i+N] -= (t-k)*N
    S = list( accumulate(C))
    if cnt > t:
        print("NO")
        break
    for i in range(N*2+1):
        S[i+1] += S[i] + L[i+1]

    for i in range(N):
        if A[i] != S[i] + S[i+N]:
            print("NO")
            return
    print("YES")
    
            
if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline
def main():
    N = int( input())
    A = list( map( int, input().split()))
    if sum(A)%(N*(N+1)//2) != 0:
        print("NO")
        return
    t = sum(A)//(N*(N+1)//2)
    d = [0]*N
    for i in range(N):
        d[i] = A[i] - A[i-1] - t
    for i in range(N):
        if d[i] > 0 or d[i]%N != 0:
            print("NO")
            return
    print("YES")
    
if __name__ == '__main__':
    main()
n = input()
A, B = input().split()
c = ""

for i in range(n):
  c = c+A[i]
  c = c+B[i]

print(c)

### FIXED CODE ###

n = int(input())
A, B = input().split()
c = ""

for i in range(n):
  c = c+A[i]
  c = c+B[i]

print(c)
# -*- coding: utf-8 -*-
# Range Minimum Query

n,q = map(int,raw_input().split())
A = [2**31-1 for i in range(n)]
B = [2**31-1]*101
for i in range(q):
    comi,xi,yi = map(int,raw_input().split())
    if comi and abs(yi-xi)<=199:
        print min(A[xi:yi+1])
    elif comi and 200<= abs(yi-xi):
        print min(min(A[xi:(xi/100+1)*100]),min(B[xi/100+1:yi/100]),min(A[yi/100:]))
    else:#comi == 0
        A[xi]=yi
        B[xi/100] = min(B[xi/100],yi)

### FIXED CODE ###

# coding: utf-8

n, q = map(int,raw_input().split())
A = [(1<<31) - 1 for i in xrange(100000)]
B = [(1<<31) - 1 for i in xrange(101)]
 
def update(i,x):
    if A[i] == (1<<31) - 1:
        A[i] = x
        B[i/1000] = min(x, B[i/1000])
    else:
        A[i] = x
        MIN = (1<<31) - 1
        for j in xrange(i/1000 * 1000, (i/1000 + 1) * 1000):
            if A[j] < MIN:
                MIN = A[j]
        B[i/1000] = MIN
 
def find(s,t):
    MIN = (1<<31) - 1
    if s/1000 == t/1000 or s/1000 + 1 == t/1000:
        for i in xrange(s, t+1):
            if A[i] < MIN:
                MIN = A[i]
    else:
        #left range
        for i in xrange(s, (s/1000 + 1) * 1000):
            if A[i] < MIN:
                MIN = A[i]
        #middle range
        for j in xrange(s/1000 + 1, t/1000):
            if B[j] < MIN:
                MIN = B[j]
         
        #right range
        for i in xrange(t/1000 * 1000, t+1):
            if A[i] < MIN:
                MIN = A[i]
    print MIN   
     
for i in xrange(q):
    com, s, t = map(int,raw_input().split())
    if com: #find
        find(s,t)
    else: #update
        update(s,t)
N = int(input())
A = list(map(int, input().split()))

ok = N
ng = 0
mid = (ok + ng) // 2
while ok - ng > 1:
    ng_flg = 0
    word = [1] * A[0]
    for i in range(1, N):
        if A[i] > A[i-1]:
            word.extend([1] * (A[i] - A[i-1]))
        else:
            word_prev = word[:A[i]]
            k = A[i] - 1
            while True:
                if k == -1:
                    ng_flg = 1
                    break
                if word_prev[k] != mid:
                    word_prev[k] += 1
                    word = word_prev
                    break
                else:
                    word_prev[k] = 1
                    k -= 1
        if ng_flg == 1:
            break
    if not ng_flg:
        ok = mid
    else:
        ng = mid
    mid = (ok + ng) // 2

print(ok)


### FIXED CODE ###

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

flg = 1
prev = 0
A = []
for i in range(N):
    if A_raw[i] <= prev:
        flg = 0
    prev = A_raw[i]
    if A_raw[i] <= 50:
        A.append(A_raw[i])

if flg:
    print(1)
    exit()

N = len(A)
if N <= 1:
    print(2)
    exit()

ok = N
ng = 1
mid = (ok + ng) // 2
while ok - ng > 1:
    ng_flg = 0
    word = [1] * A[0]
    for i in range(1, N):
        if A[i] > A[i-1]:
            word.extend([1] * (A[i] - A[i-1]))
        else:
            word_prev = word[:A[i]]
            k = A[i] - 1
            while True:
                if k == -1:
                    ng_flg = 1
                    break
                if word_prev[k] != mid:
                    word_prev[k] += 1
                    word = word_prev
                    break
                else:
                    word_prev[k] = 1
                    k -= 1
        if ng_flg == 1:
            break
    if not ng_flg:
        ok = mid
    else:
        ng = mid
    mid = (ok + ng) // 2

print(ok)
import math

r = float( input())
s =  r * r * math.PI
l = ( r + r) * math.PI

print( '{0:.5f} {1:.5f}'.format( s, l))

### FIXED CODE ###

import math

r = float( input())
s =  r * r * math.pi
l = ( r + r) * math.pi

print( '{0:.5f} {1:.5f}'.format( s, l))
n = int(input())
a = int(input())
print(N**2 - a)

### FIXED CODE ###

n = int(input())
a = int(input())
print(n**2 - a)
# ABC 116 C

N = int(input())

h = list(map(int, input().split()))

def chomp0(arr):
    while len(arr) != 0 and arr[0] == 0:
        del arr[0]

    while len(arr) != 0 and arr[-1] == 0:
        del arr[-1]

    return arr

def solve(arr):
    if len(arr) == 0:
        return 0

    arr = chomp0(arr)

    ans = 0

    num0 = arr.count(0)
    if num0 != 0:
        for _ in range(num0):
            idx = arr.index(0)
            ans += solve(arr[:idx])
            arr = arr[idx+1:]

    minVal = min(arr)
    ans += minVal
    for i in range(len(arr)):
        arr[i] -= minVal

    if arr.count(0) != len(arr):
        ans += solve(arr)

    return ans

print(solve(h))


### FIXED CODE ###

# ABC 116 C

N = int(input())

h = list(map(int, input().split()))

def chomp0(arr):
    while len(arr) != 0 and arr[0] == 0:
        del arr[0]

    while len(arr) != 0 and arr[-1] == 0:
        del arr[-1]

    return arr

def solve(arr):
    arr = chomp0(arr)

    if len(arr) == 0:
        return 0

    ans = 0

    num0 = arr.count(0)
    if num0 != 0:
        for _ in range(num0):
            idx = arr.index(0)
            ans += solve(arr[:idx])
            arr = arr[idx+1:]

    minVal = min(arr)
    ans += minVal
    for i in range(len(arr)):
        arr[i] -= minVal

    if arr.count(0) != len(arr):
        ans += solve(arr)

    return ans

print(solve(h))
def main():
  n, k = map(int, input().split())
  
  kids = list()
  sum = 0
  
  for i in k:
    dustbox = input()
    kids += list(map(int, input().split()))
    
  for i in range(1, n+1):
    if i not in kids:
      sum += 1
      
  print(sum)
  
main()

### FIXED CODE ###

def main():
  n, k = map(int, input().split())
  
  kids = list()
  sum = 0
  
  for i in range(k):
    dustbox = input()
    kids += list(map(int, input().split()))
    
  for i in range(1, n+1):
    if i not in kids:
      sum += 1
      
  print(sum)
  
main()
n,k=map(int,input().split())
Mod=10**9+7
M=n
fac=[0]*M
finv=[0]*M
inv=[0]*M

#finvに逆元、facに階乗のmod
def COMinit():
  fac[0]=fac[1]=1
  finv[0]=finv[1]=1
  inv[1]=1
  for i in range(2,M):
    fac[i]=(fac[i-1]*i%Mod)%Mod
    inv[i]=Mod-inv[Mod%i]*(Mod//i) %Mod
    finv[i]=(finv[i-1]*inv[i]%Mod)%Mod
def COM(n,k):
  if n<k:
    return 0
  if n<0 or k<0:
    return 0
  return (fac[n]*(finv[k]*finv[n-k]%Mod)%Mod)%Mod

COMinit()
for i in range(1,k+1):
  print((COM(k-1,i-1)*COM(n-k+1,i))%Mod)


### FIXED CODE ###

n,k=map(int,input().split())
Mod=10**9+7
M=n+10
fac=[0]*M
finv=[0]*M
inv=[0]*M

#finvに逆元、facに階乗のmod
def COMinit():
  fac[0]=fac[1]=1
  finv[0]=finv[1]=1
  inv[1]=1
  for i in range(2,M):
    fac[i]=(fac[i-1]*i%Mod)%Mod
    inv[i]=Mod-inv[Mod%i]*(Mod//i) %Mod
    finv[i]=(finv[i-1]*inv[i]%Mod)%Mod
def COM(n,k):
  if n<k:
    return 0
  if n<0 or k<0:
    return 0
  return (fac[n]*(finv[k]*finv[n-k]%Mod)%Mod)%Mod

COMinit()
for i in range(1,k+1):
  print((COM(k-1,i-1)*COM(n-k+1,i))%Mod)
import numpy as np
N, M = map(int, input().split())
A_list = sorted(list(map(int, input().split())))
A_ar = np.array(A_list)[::-1]
for i in range(M):
    A_ar[0] = A_ar[0]//2
    if A_ar[0] < A_ar[1]:
        A_ar = np.sort(A_ar)[::-1]
print(sum(A_ar))



### FIXED CODE ###

import heapq
N, M = map(int, input().split())
A_list = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(A_list)
for i in range(M):
    max_num = heapq.heappop(A_list) * (-1)
    heapq.heappush(A_list, (-1) * (max_num // 2))
print((-1) * sum(A_list))
from fractions import gcd
def lcm(a,b):
    return a * b // gcd(a,b)
n = int(input())
print(reduce(lcm, [int(input()) for i in range(n)]))

### FIXED CODE ###

from functools import reduce
from fractions import gcd
def lcm(a,b):
    return a * b // gcd(a,b)
n = int(input())
print(reduce(lcm, [int(input()) for i in range(n)]))
a = input().split()

N = int(a[0])
A = int(a[1])
B = int(a[2])

i = int(N/(A+B))

cut = N - (A+B)*i
if n < A:
  Blue_Ball_Num = N
elif N < A+B:
  Blue_Ball_Num = A
elif cut > A:
  Blue_Ball_Num = A*i
else:
  Blue_Ball_Num = A*i + (N - (A+B)*i)
  
print(Blue_Ball_Num)

### FIXED CODE ###

a = input().split()

N = int(a[0])
A = int(a[1])
B = int(a[2])

i = int(N/(A+B))

cut = N - (A+B)*i

if N < A:
  Blue_Ball_Num = N
elif N < A+B:
  Blue_Ball_Num = A
elif cut > A:
  Blue_Ball_Num = A*(i+1)
else:
  Blue_Ball_Num = A*i + (N - (A+B)*i)
  
print(Blue_Ball_Num)
import math, sys
a, b, c = map(int, input().split())
for i in [x*a for x in range(1, a*b//math.gcd(a,b))]:
    if i % b == c:
        print("YES")
        sys.exit()
print("NO")


### FIXED CODE ###

import fractions, sys
a, b, c = map(int, input().split())
for i in [x*a for x in range(1, a*b//fractions.gcd(a,b)+1)]:
    if i % b == c:
        print("YES")
        sys.exit()
print("NO")
n, q = map(int, input().split())
s = input()
q_l = [tuple(map(int, input().split())) for _ in range(q)]

accum_sum = [0] * (len(s)+1)

for i in range(len(s)):
    if s[i] == "A" and s[i+1] == "C":
        accum_sum[i+1] = accum_sum[i] + 1
    else:
        accum_sum[i+1] = accum_sum[i]

for l, r in q_l:
    print(accum_sum[r-1]-accum_sum[l-1])





### FIXED CODE ###

n, q = list(map(int, input().split()))
s = input()
ran = [list(map(int, input().split())) for i in range(q) ]

table = [0] * n
for i in range(1, n):
    if s[i] == "C" and s[i-1] == "A":
        table[i] = table[i - 1] + 1
    else:
        table[i] = table[i - 1]

for l, r in ran:
    print(table[r-1]  - table[l - 1] )
import sys
sys.setrecursionlimit(10**9)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

H, W = mi()
C = li2(10)
a = li2(H)
memo = [C[i][1] for i in range(10)]
'''
tmp = -1
def dfs(column, m):
    if column == 1:
        global tmp
        tmp = max(m, tmp)
    for i in range(10):
        if i != column and C[column][i] < m:
            dfs(i, m-C[column][i])
    #return

for i in range(10):
    if i != 1:
        dfs(i, C[i][1])
        if tmp != -1:
            memo[i] = C[i][1] - tmp
        tmp = -1
'''
INF = 10**9
tmp = 10**9
'''
def dfs(col, m):
    if col == 1:
        global tmp
        tmp = min(m, tmp)
    for i in range(10):
        if i != col and m + C[col][i] < lim:
            dfs(i, m + C[col][i])

for i in range(10):
    if i != 1:
        tmp = INF
        lim = C[i][1]
        dfs(i, 0)
        memo[i] = min(tmp, memo[i])
'''
from collections import deque
for i in range(10):
    que = deque()
    lim = C[i][1]
    for j in range(10):
        if C[i][j] < lim:
            que.append([j, C[i][j]])
    while que != deque():
        #print(que)
        k = que.popleft()
        for j in range(10):
            if C[k[0]][j] + k[1] < lim and k[0] != j:
                if j == 1:
                    memo[i] = min(memo[i], C[k[0]][j] + k[1])
                else:
                    que.append([j, C[k[0]][j] + k[1]])

ans = 0
for i in range(H):
    for j in range(W):
        if abs(a[i][j]) != 1:
            ans += memo[a[i][j]]

print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

S = input()

for i in range(2):
    if S[i] == S[i+1] == S[i+2]:
        print('Yes')
        exit()
print('No')
import math
n,x=map(int,input().split())
pl=list(map(int,input().split()))
ans=abs(pl[1]-pl[0])
if len(pl)>1:
    for i in range(len(pl)-2):
        ans=math.gcd(ans,abs(pl[i+2]-pl[i+1]))
print(ans)

### FIXED CODE ###

import fractions
n,x=map(int,input().split())
pl=sorted(list(map(int,input().split()))+[x])
ans=abs(pl[1]-pl[0])
if len(pl)>1:
    for i in range(len(pl)-2):
        ans=fractions.gcd(ans,abs(pl[i+2]-pl[i+1]))
print(ans)