Harryxun/stf_run huggingface dataset:
s=input()
t=input()

if len(s)==len(t):
  num=0
  for i,j in zip(s,t):
    if i!=j:
      num+=1
else:
  for i in range(len(s)-len(t)+1):
    a=s[i:len(t)+i]
    num=0
    for i,j in zip(t,a):
      if i!=j:
        num+=1
    num=min(1000,num)

print(num)
    
    

### FIXED CODE ###

d,t,s=map(int,input().split())

num=t*s

if num>=d:
  print("Yes")
else:
  print("No")
from sys import stdin
import numpy as np


def main():
    n, m = list(map(int, stdin.readline().split()))
    hList = list(map(int, stdin.readline().split()))
    ABList = [list(map(int, stdin.readline().split())) for _ in range(m)]
    hRelations = np.zeros((n, n))
    for a, b in ABList:
        if hList[a-1] >= hList[b-1]:
            hRelations[b-1][a-1] = 1
        if hList[b-1] >= hList[a-1]:
            hRelations[a-1][b-1] = 1
    total = 0
    for hRelation in hRelations:
        if np.sum(hRelation) == 0:
            total += 1
    print(total)


if __name__ == '__main__':
    main()


### FIXED CODE ###

from sys import stdin
import numpy as np


def main():
    n, m = list(map(int, stdin.readline().split()))
    hList = list(map(int, stdin.readline().split()))
    ABList = [list(map(int, stdin.readline().split())) for _ in range(m)]
    maxHeights = np.zeros(n)
    for a, b in ABList:
        if hList[a-1] >= maxHeights[b-1]:
            maxHeights[b-1] = hList[a-1]
        if hList[b-1] >= maxHeights[a-1]:
            maxHeights[a-1] = hList[b-1]
    total = 0
    i = 0
    for maxHeight in maxHeights:
        if maxHeight < hList[i]:
            total += 1
        i += 1
    print(total)


if __name__ == '__main__':
    main()
a,b,c = map(int,input().split())
if a == b == c:
  if a%2 == b%2 == c%2 == 0:
    print(-1)
  else:
    print(0)
t = 0
else:
  while t > -1:
    if a%2 == 1 or b%2 == 1 or c%2 == 1:
      break
    (a,b,c) = ((b+c)//2,(a+c)//2,(a+b)//2)
    t += 1
  print(t)

### FIXED CODE ###

a,b,c = map(int,input().split())
if a == b == c:
  if a%2 == b%2 == c%2 == 0:
    print(-1)
  else:
    print(0)
else:
  t = 0
  while t > -1:
    if a%2 == 1 or b%2 == 1 or c%2 == 1:
      break
    (a,b,c) = ((b+c)//2,(a+c)//2,(a+b)//2)
    t += 1
  print(t)
N=int(input())
S=input()

ans = S.count("R")*S.count("G")*S.count("B")

tmp=0

for i in range(N):
  for j in range(i,N):
    if j-i+j < N:
      if S[i]==S[j] and S[j]==S[j-i+j] and S[i]==S[j-i+j]
        tmp += 1

ans = ans - tmp
print(ans)

### FIXED CODE ###

N=int(input())
S=input()

ans = S.count("R")*S.count("G")*S.count("B")

tmp=0

for i in range(N):
  for j in range(i,N):
    if j-i+j < N:
      if S[i]!=S[j] and S[j]!=S[j-i+j] and S[i]!=S[j-i+j]:
        tmp += 1

ans = ans - tmp
print(ans)
n,k = map(int,input().split())
p = list(map(int,input().split()))
c = list(map(int,input().split()))

ans=-10**18
for i in range(n):
    start,count=i,1
    val=c[start]
    while p[start]-1 != i:
        start = p[start]-1
        count += 1
        val += c[start]
    start = i
    if val > 0:
        a = (k//count-1)*val
        ans=max(a,ans)
        num=count+k%count
    else:
        a=0
        num=min(k,count)
    for _ in range(num):
        a += c[start]
        start=p[start]-1
        ans=max(a,ans)
print(ans)

### FIXED CODE ###

s=list(input())
count=0
for d in s:
    if d=="R":
        count += 1
if count == 2:
    if s[1]=="S":
        print(1)
    else:
        print(2)
else:
    print(count)
line = input()
A, B, X = [int(u) for u in line.split()]
u=[A,B,C]
j = max(u)
u.remove(j)
u.append(j*2**K)
print(sum(u))

### FIXED CODE ###

a, b, c = map(int, input().split())
k = int(input())
if a >= b and a >= c:
	print(a * 2 ** k + b + c)
elif b >= a and b >= c:
	print(b * 2 ** k + a + c)
else:
	print(c * 2 ** k + b + a)
N = int(input())
X = input()

x_num = int(X, 2)
cnt1 = X.count('1')

p_zero = x_num % (cnt1 + 1)
p_one = x_num % (cnt1 - 1)


def f(cnt):
    if (cnt > 0):
        pcount = p_count(cnt)
        return f(cnt % pcount) + 1
    else:
        return 0


def p_count(x):
    cnt = 0
    while (x > 0):
        if x % 2 != 0:
            cnt += 1
        x //= 2
    return cnt


def f1(x):
    cnt = 0
    while (x > 0):
        x %= bin(x).count('1')
        cnt += 1
    return cnt


for i, x in enumerate(list(X)):
    if (x == '1'):
        #x_num = int(''.join(X), 2)
        if cnt1 - 1 > 0:
            xxx = (p_one - pow(2, (N - (i + 1)), cnt1 - 1)) % (cnt1 - 1)
            xxx += cnt1 - 1 if xxx < 0 else 0
            print(f1(xxx) + 1)
        else:
            print(0)
    else:
        #x_num = int(''.join(X), 2)
        xxx = (p_zero - pow(2, (N - (i + 1)), cnt1 + 1)) % (cnt1 + 1)
        xxx += cnt1 + 1 if xxx < 0 else 0
        print(f1(xxx) + 1)

### FIXED CODE ###

#!/usr/bin/env python3
N = int(input())
X = input()

x_num = int(X, 2)
cnt1 = X.count('1')

p_zero = x_num % (cnt1 + 1)
p_one = (x_num % (cnt1 - 1) if cnt1 - 1 > 0 else 1)


def f(cnt):
    if (cnt > 0):
        pcount = p_count(cnt)
        return f(cnt % pcount) + 1
    else:
        return 0


def p_count(x):
    cnt = 0
    while (x > 0):
        if x % 2 != 0:
            cnt += 1
        x //= 2
    return cnt


def f1(x):
    cnt = 0
    while (x > 0):
        x %= bin(x).count('1')
        cnt += 1
    return cnt


for i, x in enumerate(list(X)):
    if (x == '1'):
        #x_num = int(''.join(X), 2)
        if cnt1 - 1 > 0:
            xxx = (p_one - pow(2, (N - (i + 1)), cnt1 - 1)) % (cnt1 - 1)
            xxx += cnt1 - 1 if xxx < 0 else 0
            print(f1(xxx) + 1)
        else:
            print(0)
    else:
        #x_num = int(''.join(X), 2)
        xxx = (p_zero + pow(2, (N - (i + 1)), cnt1 + 1)) % (cnt1 + 1)
        xxx += cnt1 + 1 if xxx < 0 else 0
        print(f1(xxx) + 1)
# import numpy as np
from fractions import math
from functools import reduce

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



def lcm(a, b):
    # return (a * b) // np.gcd(a, b)
    return (a * b) // math.gcd(a, b)

L = reduce(lcm, a)

# print(L)

for i in range(n):
    ans += (L // a[i])
    ans %= mod

print(ans)

### FIXED CODE ###

from functools import reduce

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

def gcd(a, b):
    # 大きい方を被除数、小さい方を除数とする
    dividend = max(a, b)
    divider = min(a, b)

    if divider == 0:
        return dividend

    # 最大公約数を見つけるまで繰り返す
    while dividend % divider != 0:
        # 除算を行い、その除数を次回の被除数、剰余を次回の除数として処理を繰り返す
        r = dividend % divider
        dividend = divider
        divider = r

    # 一方がもう一方を割り切れた時点で、その除数を最大公約数とみなせる
    return divider


def lcm(a, b):
    return (a * b) // gcd(a, b)

def modinv(x):
    return pow(x, mod-2, mod)

b = list(set(a))
# for i in range(n):

# L = reduce(lcm, a)
L = reduce(lcm, b)

# print(L)

for i in range(n):
    # ans += (L // a[i])
    ans += L * modinv(a[i])

print(ans % mod)
N=int(input())
T_N=int(input().split())
list_time = []
for i in range(N):
    list_time.append(T_N[i])
#Ti秒の総和を求める
sum=sum(list_time)
M=int(input())
for i in range(M):
    p,x=map(int,input().split())
    #ドリンク飲んだ時と飲まないときの差を元の合計に足す。
    ans=sum+x-list_time[p-1]
print(ans)

### FIXED CODE ###

n = int(input())
t_N = input().split()
list_Time = []
for id in range(n):
    list_Time.append(int(t_N[id]))
sum = sum(list_Time)
m = int(input())
for id in range(m):
    p, x = map(int, input().split())
    answer = sum + x - list_Time[p - 1]
    print(answer)
n=input()
m=n
s=0
while True:
  q,mod=divmod(m,10)
  s+=mod
  m=q
  if q<=0:
    break
if n%s==0:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

n=int(input())
m=n
s=0
while True:
  q,mod=divmod(m,10)
  s+=mod
  m=q
  if q<=0:
    break
if n%s==0:
  print("Yes")
else:
  print("No")
# -*- coding: utf-8 -*-
qS = input()


def replace(s, count):
    fi = s.find('ABC')
    if fi >= 0:
        newS = s[:fi] + 'BCA' + s[fi+3:]
        return replace(newS, count + 1)
    else:
        return count


print(replace(qS, 0))


### FIXED CODE ###

# -*- coding: utf-8 -*-
s = input()

a_num = 0
bc_num = 0
ans = 0
i = 0
while i < len(s):
    if s[i] == 'A':
        a_num += 1
        i += 1
    elif s[i:i+2] == 'BC':
        ans += a_num
        i += 2
    else:
        a_num = 0
        b_num = 0
        i += 1

print(ans)
import sys
import numpy as np
inputs = sys.stdin.readlines()

h, w, k = map(int, inputs[0].split())
r = iter(range(1, k+1))
A = [list(map(lambda y: 0 if y == '.' else next(r), x)) for x in inputs[1:]]
B = np.array(A)

def f(x, y, val, dx0, dx1, dy0, dy1, search=True):
    if search and 0 <= x+dx0-1 < w and B[y, x+dx0-1] == 0:
        B[y, x+dx0-1] = val
        search = f(x, y, val, dx0-1, dx1, dy0, dy1)
    elif search and 0 <= x+dx1+1 < w and B[y, x+dx1+1] == 0:
        B[y, x+dx1+1] = val
        search = f(x, y, val, dx0, dx1+1, dy0, dy1)
    elif search and 0 <= y+dy0-1 < h and np.all(B[y+dy0-1, x+dx0:x+dx1+1] == 0):
        B[y+dy0-1, x+dx0:x+dx1+1] = val
        search = f(x, y, val, dx0, dx1, dy0-1, dy1)
    elif search and 0 <= y+dy1+1 < h and np.all(B[y+dy1+1, x+dx0:x+dx1+1] == 0):
        B[y+dy1+1, x+dx0:x+dx1+1] = val
        search = f(x, y, val, dx0, dx1, dy0, dy1+1)
    return False

traveled = set()
for y in range(h):
    for x in range(w):
        if B[y, x] != 0 and B[y, x] not in traveled:
            dummy = f(x, y, B[y, x], 0, 0, 0, 0)
            traveled.add(B[y, x])
for b in B:
    print(*b)

### FIXED CODE ###

import numpy as np
inputs = open(0).readlines()

def main(inputs):
    h, w, k = map(int, inputs[0].split())
    cake, count, coords = np.zeros((h, w), dtype=np.uint), 0, {}
    for i, s in enumerate(inputs[1:]):
        for j, c in enumerate(s):
            if c == '#':
                count += 1
                cake[i, j] = count
                coords[count] = (j, i)
    empty_rows = {i for i, rows in enumerate(cake) if not np.any(rows)}

    for i in range(1, count+1):
        x, y = coords[i]
        x0, y0 = x-1, y-1
        x1, y1 = x+1, y+1
        while 0 <= x0 and cake[y, x0] == 0:
            cake[y, x0] = i
            x0 -= 1
        x0 += 1
        while x1 < w and cake[y, x1] == 0:
            cake[y, x1] = i
            x1 += 1
        while 0 <= y0 and y0 in empty_rows:
            cake[y0, x0:x1] = i
            y0 -= 1
        while y1 < h and y1 in empty_rows:
            cake[y1, x0:x1] = i
            y1 += 1

    for rows in cake:
        print(*rows)

main(inputs)
n = int(input())
s = list(input())

m = {'R': 0, 'G': 0, 'B': 0}

for i, c in enumerate(s):
  if c == 'R':
    m['R'] += 1
  elif c == 'G':
    m['G'] += 1
  else:
    m['B'] += 1

result = m['R'] * m['G'] * m['B']

for i in range(1, n - 1):
  for j in range(i + 1, n):
    k = 2 * j - i

    if k > n or not (s[i - 1] != s[j - 1] and s[j - 1] != s[k - 1] and s[k - 1] != s[i - 1]):
      continue
    result -= 1

print(result)

### FIXED CODE ###

import math

k = int(input())

sum = 0

for a in range(1, k+1):
  for b in range(1, k+1):
    for c in range(1, k+1):
      tmp = math.gcd(a, b)
      sum += math.gcd(tmp, c)

print(sum)
import numpy as np

mod = 10**9+7
p = list(input())
# p = list("?"*10**4)

# アルゴリズム
dp = np.zeros(13, dtype=int)
dp[0] = 1
mul = 1
for key in reversed(p):
    new_dp = np.zeros(13, dtype=int)
    if key == "?":
        for i in range(10):
            for j in range(13):
                new_dp[(j + i * mul) % 13] += dp[j]
                new_dp[(j + i * mul) % 13] %= mod
    else:
        
        for j in range(13):
            new_dp[(j + int(key) * mul) % 13] += dp[j]
            new_dp[(j + int(key) * mul) % 13] %= mod
    dp = new_dp.copy()
    mul *= 10

print(dp[5])


### FIXED CODE ###

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

ans = (a+b)/2
if ans % 1 == 0:
    print("{}".format((int)(ans)))
else:
    print("IMPOSSIBLE")
(h,n),*t=[list(map(int,o.split()))for o in open(0)]
d=[0]*(h+100)
for i in range(1,h+1):d[i]=min(d[i-a]+b for a,b in t)
print(d[h])

### FIXED CODE ###

def chmin(dp, i, *x):
  dp[i] = min(dp[i], *x)
INF = float("inf")

# dp[i] := min 消耗する魔力 to H -= i
h, n = map(int, input().split())
dp = [0] + [INF]*h
for _ in [None]*n:
  a, b = map(int, input().split())
  for j in range(h + 1):
    chmin(dp, min(j + a, h), dp[j] + b)
print(dp[h])
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n = int(input())
    a = [int(x)-1 for x in input().split()]
    ans = 0
    for i in range(n):
        if a[i] == i:
            if 1:
                a[i], a[i+1] = a[i+1], a[i]
            elif i + 1 == n:
                a[i], a[i-1] = a[i-1], a[i]
            ans += 1

    print(ans)

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

abc

"""


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n = int(input())
    a = [int(x)-1 for x in input().split()]
    ans = 0
    for i in range(n):
        if a[i] == i:
            if i + 1 < n:
                a[i], a[i+1] = a[i+1], a[i]
            else:
                a[i], a[i-1] = a[i-1], a[i]
            ans += 1

    print(ans)

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

abc

"""
s=input()

count=0
for i in range(len(s)):
    if s[i]!=s[i+1]: count+=1

print(count)

### FIXED CODE ###


s=input()

count=0
for i in range(len(s)-1):
    if s[i]!=s[i+1]: count+=1

print(count)
h,w=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(h)]
z=[]
for i in range(w):
  if i%2==0:
    for j in range(h):
      z.append([j,i])
  else:
    for j in range(h):
      z.append([h-j-1,i])
count=0
ans=[]
for i,(y,x) in enumerate(z):
  if a[y][x]%2!=0:
    count+=1
    ans.append(i)
    a[z[i+1][0]][z[i+1][1]]+=1
print(count)
for i in ans:
  print(z[i][0]+1,z[i][1]+1,z[i+1][0]+1,z[i+1][1]+1)

### FIXED CODE ###

h,w=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(h)]
z=[]
for i in range(w):
  if i%2==0:
    for j in range(h):
      z.append([j,i])
  else:
    for j in range(h):
      z.append([h-j-1,i])
count=0
ans=[]
for i,(y,x) in enumerate(z):
  if a[y][x]%2!=0 and i<len(z)-1:
    count+=1
    ans.append(i)
    a[z[i+1][0]][z[i+1][1]]+=1
print(count)
for i in ans:
  print(z[i][0]+1,z[i][1]+1,z[i+1][0]+1,z[i+1][1]+1)
def main():
    #input
    N=int(input())
    l=list("zabcdefghijklmnopqrstuvwxy")

    name=[]
    n=N
    while n>=26:
        mod=n%26
        if mod!=0:
            n//=26
        else:
            n//=26
            n-=1
        name.append(l[mod])
    if mod!=0:
       name.append(l[n])
    name=[name[n] for n in reversed(range(len(name)))]
    print("".join(name))

if __name__=="__main__":
    main()

### FIXED CODE ###

def main():
    #input
    N=int(input())
    l=list("zabcdefghijklmnopqrstuvwxy")
    if N<26:
        print(l[N])
    else:
        name=[]
        n=N
        while n>=26:
            mod=n%26
            if mod!=0:
                n//=26
            else:
                n//=26
                n-=1
            name.append(l[mod])
        if n!=0:
            name.append(l[n])
        name=[name[n] for n in reversed(range(len(name)))]
        print("".join(name))

if __name__=="__main__":
    main()
import math
import statistics

n = int(input())
xl = []
yl = []

for i in range(n):
    x,y = map(int, input().split())
    xl.append(x)
    yl.append(y)

def d(x1,y1,x2,y2):
    return math.sqrt((x1-x2)**2 - (y1-y2)**2)

dd = []
for i in range(n):
    for j in range(i,n):
        dd.append(d(xl[i], yl[i], xl[j], yl[j]))

ans = statistics.mean(dd)
print(ans)

### FIXED CODE ###

import math
import statistics
import itertools

n = int(input())
xl = []
yl = []

for i in range(n):
    x,y = map(int, input().split())
    xl.append(x)
    yl.append(y)

def d(x1,y1,x2,y2):
    return math.sqrt((x1-x2)**2 + (y1-y2)**2)

dd = []
for m in itertools.permutations(range(n)):
    dsum = 0
    for i in range(n-1):
        ii = m[i]
        iii = m[i+1]
        dsum += d(xl[ii], yl[ii], xl[iii], yl[iii])
    dd.append(dsum)
ans = statistics.mean(dd)

print(ans)
h,w,d = map(int,input().split())
hw = [[0,0] for _ in range(h*w+1)]
for i in range(h):
    row = list(map(int,input().split()))
    for j in range(w):
        hw[row[j]] = [i,j]

a = [0]*(h*w)
for i in range(d,h*w):
    a[i] = a[i-d] + abs(hw[i][0] - hw[i-d][0]) + abs(hw[i][1] - hw[i-d][1])

q = int(input())
for i in range(q):
    L,R = map(int,input().split())
    print(a[R] - a[L])

### FIXED CODE ###

h,w,d = map(int,input().split())
hw = [[] for _ in range(h*w+1)]
for i in range(h):
    row = list(map(int,input().split()))
    for j in range(w):
        hw[row[j]] = [i,j]
 
a = [0 for _ in range(h*w+1)]
for i in range(d+1,h*w+1):
    a[i] = a[i-d] + abs(hw[i][0] - hw[i-d][0]) + abs(hw[i][1] - hw[i-d][1])
 
q = int(input())
for i in range(q):
    L,R = map(int,input().split())
    print(a[R] - a[L])
A,B = map(int,input())

res = 0
if A>B:
    res = A-1
else:
    res = A
print(res)

### FIXED CODE ###

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

res = 0
if A>B:
    res = A-1
else:
    res = A
print(res)
import math

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

def andiv(M,N):
    return((N//M)*(M-1)+N%M)

def lcm(a,b):
    return(int((a*b / math.gcd(a,b))))

E = andiv(C,B) + andiv(D,B) - andiv(lcm(C,D),B)
F = andiv(C,A-1) + andiv(D,A-1) - andiv(lcm(C,D),A-1)

print(E-F)

### FIXED CODE ###

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

def andiv(M,N):
    return((N//M) * (M-1) + N%M)

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

def lcm(a,b):
    return(a*b // gcd(a,b))

E = andiv(C,B) + andiv(D,B) - andiv(lcm(C,D),B)
F = andiv(C,A-1) + andiv(D,A-1) - andiv(lcm(C,D),A-1)

print(int(E-F))
import sys
sys.setrecursionlimit(2147483647)

N, M, K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
Asum = []
Bsum = []
count = 0
for p in A:
    count += p
    Asum.append(count)
count = 0
for p in B:
    count += p
    Bsum.append(count)
best = 0
Blast = M-1
for t in range(N):
    if Asum(t) > K:
        break
    if best < t+1:
        best=t+1
    for s in reversed(range(0,Blast+1)):
        if Asum[t]+Bsum[s]<=K:
            if best < t+1+s+1:
                best=t+1+s+1
            Blast = s
            break
print(best)



### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)

N, M, K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
Asum = [0]
Bsum = [0]
count = 0
for p in A:
    count += p
    Asum.append(count)
count = 0
for p in B:
    count += p
    Bsum.append(count)
best = 0
Blast = M
for t in range(N+1):
    if Asum[t] > K:
        break
    if best < t:
        best=t
    for s in reversed(range(0,Blast+1)):
        if Asum[t]+Bsum[s]<=K:
            if best < t+s:
                best=t+s
            Blast = s
            break
print(best)
from fractions import gcd  # in math module python >= 3.5
from functools import reduce


def gcdall(numlist):
    return reduce(gcd, numlist)


def main():
    _ = int(input())
    a = list(map(int, input().split()))
    if len(a) < 3:
        print(max(a))
        return

    a = list(set(map(int, input().split())))
    if len(a) < 3:
        print(max(a))
        return

    gcds = []
    for i in range(len(a)):
        excepted = [a[j] for j in range(len(a)) if j != i]
        b = 0
        while all([k % 2 == 0 for k in excepted]):
            b += 1
            excepted = [k // 2 for k in excepted]

        if b > 0:
            gcds.append(gcdall(excepted) * 2 * b)
        else:
            gcds.append(gcdall(excepted))
    print(max(gcds))


main()

### FIXED CODE ###

from fractions import gcd  # in math module python >= 3.5


def main():
    n = int(input())
    a = list(map(int, input().split()))
    if len(a) < 3:
        print(max(a))
        return

    ls = []
    for i in range(n+1):
        if i == 0:
            ls.append(0)
        else:
            ls.append(gcd(ls[i-1], a[i-1]))

    rs = []
    for i in range(n+1):
        if i == 0:
            rs.append(0)
        else:
            rs.append(gcd(rs[i-1], a[-i]))
    rs = list(reversed(rs)) + [0]

    m = [gcd(ls[i], rs[i+1]) for i in range(n+1)]

    print(max(m))


main()
# メタデータ入力
n, m = map(int,input().split())

# 座標入力
pos = list(map(int,input().split()))
# ソート
pos.sort()

# 差分計算
distances = []
for i, x in enumerate(pos):
  if i == 0:
    continue
  distances.append(abs(pos[i] - pos[i-1]))

distances.sort()
for i in range(n-1):
	distances.pop()
print(sum(distances))

### FIXED CODE ###

import sys
# メタデータ入力
n, m = map(int,input().split())

if n >= m:
  print(0)
  sys.exit()
# 座標入力
pos = list(map(int,input().split()))
# ソート
pos.sort()

# 差分計算
distances = []
for i, x in enumerate(pos):
  if i == 0:
    continue
  distances.append(abs(pos[i] - pos[i-1]))

distances.sort()
for i in range(n-1):
	distances.pop()
print(sum(distances))
a = list.map(int,input().split())
if a[1] >= a[0]:
  print("unsafe")
else:
  print("safe")

### FIXED CODE ###

a = list(map(int,input().split()))
if a[1] >= a[0]:
  print("unsafe")
else:
  print("safe")
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

ans = []
l = range(1, N + 1)
import itertools


for v in itertools.permutations(l, N):
    if list(v) == P:
      a = v.index(P)
        
    if list(v) == Q:
      b = v.index(Q)  
    

print(abs(b - a))


### FIXED CODE ###

import itertools
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

permutations = list(itertools.permutations(range(1, N+1)))
p = permutations.index(P)
q = permutations.index(Q)
print(abs(p-q))
N = int(raw_input())
As = [(int(i), 2) for i in raw_input().split(" ")]
Bs = [(int(i), 1) for i in raw_input().split(" ")]
Cs = [(int(i), 0) for i in raw_input().split(" ")]

l = sorted(As + Bs + Cs)


count = (0, 0, 0, 1)
for i in l:
    count[i[1]] += count[i[1] + 1]
print count[0]

### FIXED CODE ###



N = int(raw_input())
As = raw_input().split(" ")
Bs = raw_input().split(" ")
Cs = raw_input().split(" ")

As = [(int(i), 2) for i in As]
Bs = [(int(i), 1) for i in Bs]
Cs = [(int(i), 0) for i in Cs]

l = sorted(As + Bs + Cs, key=lambda x: x[0] + x[1] * 0.1)

ac = 0
bc = 0
cc = 0

for i in l:
    if i[1] == 2:
        ac += 1
    elif i[1] == 1:
        bc += ac
    elif i[1] == 0:
        cc += bc
print cc
import numpy as np
h,n=map(int,input().split())
d=sorted([list(map(int,input().split()))for i in range(n)])
p=np.array([float("INF")]*max(h+1,2*d[-1][0]+1))
p[0]=0
s=max(h+1,2*d[-1][0]+1)
for i in range(n):
    a,b=d[i][0],d[i][1]
    j=1
    while j*a<=s:
        p[j*a:]=np.minimum(p[j*a:],p[:-j*a]+j*b)
        j+=1
print(int(min(p[h:])))

### FIXED CODE ###

h,n=map(int,input().split())
p=[float("INF")]*(h+1)
p[0]=0
for i in range(n):
    a,b=map(int,input().split())
    for j in range(h+1):
        if p[min(h,j+a)]>p[j]+b:
            p[min(j+a,h)]=p[j]+b
print(p[-1])
s = input().split()
n = s[0]
m = s[1]
if (1<=n && n<=100 && 0<=m && m<=n):
  if (isinstance(n, int) && isinstance(m, int)):
    print(Yes)
  else:
    print(No)
else:
  print(No)

### FIXED CODE ###

s = input().split()
n = int(s[0])
m = int(s[1])
if(n==m):
    print('Yes')
else:
    print('No')
from functools import reduce
from fanctions import gcd
#from math import gcd

n,x0=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=abs(x[i]-x0)

print(reduce(gcd, x))
 

### FIXED CODE ###

def gcdf(a):
    a.sort()
    a0=a[0]
    a=[int(x%a0) for x in a if x%a0 != 0]
    if len(a)==0:
        return a0
    else:
        a.append(a0)
        a0=min(a)
        return gcdf(a) 
    
n,x=map(int,input().split())
xi=list(map(int,input().split()))

for i in range(n):
    if xi[i]>x:
        xi[i]=xi[i]-x
    else:
        xi[i]=x-xi[i]
    
gcdx=gcdf(xi)
print(gcdx)