Harryxun/stf_run huggingface dataset:
l, n = map(int, input().split())
s = []
sort = []
for i in range(n):
    s.append(input())
s.sort()
print(''.join(s))

### FIXED CODE ###

n, l = map(int, input().split())
s = []
sort = []
for i in range(n):
    # print(i)
    s.append(input())
s.sort()
print(''.join(s))
N = int(input())
maxnum = 0

if (N%(int("1" + (len(str(N)) - 1)*"0"))) == int((len(str(N)) - 1) * "9"):
    tmp = list(str(N))
    tmp = [int(item) for item in tmp]
    print(sum(tmp))
else:
    tmp = list(str(N - (N%(int("1" + (len(str(N)) - 1)*"0"))) - 1))
    tmp = [int(item) for item in tmp]
    print(sum(tmp))




### FIXED CODE ###

N = int(input())

if N > 9:
    if (N%(int("1" + (len(str(N)) - 1)*"0"))) == int((len(str(N)) - 1) * "9"):
        tmp = list(str(N))
        tmp = [int(item) for item in tmp]
        print(sum(tmp))
    else:
        tmp = list(str(N - (N%(int("1" + (len(str(N)) - 1)*"0"))) - 1))
        tmp = [int(item) for item in tmp]
        print(sum(tmp))
else:
    print(N)
s = input()
k = int(input())
idx = 0
while idx < len(s) and s[idx] == '1':
    idx += 1
if k < idx:
    print(1)
else:
    print(s[idx])


### FIXED CODE ###

s = input()
k = int(input())
idx = 0
while idx < len(s) and s[idx] == '1':
    idx += 1
if k <= idx or idx == len(s):
    print(1)
else:
    print(s[idx])
N,M=map(int,input().split())
A=[int(x) for x in input().split()]
num=[2,5,5,4,5,6,3,7,6]

#最小本数で作成可能な数字をリスト化
creat_A=[]
deff_A=[]
for n in A:
  creat_A.append(num[n-1])
mA=min(creat_A)

#dp[N]:N本のマッチ棒を使って作ることのできる最大桁数
dp=[-1 for i in range(N+1)]
for i in range(M):
  dp[creat_A[i]]=1

for i in range(mA,N):
  for j in range(M):
    if i+creat_A[j] <= N and dp[i] > 0:
      dp[i+creat_A[j]]=max(dp[i+creat_A[j]],dp[i]+1)

#dp[N]から使用した数字の数を算出。
ans=[0 for x in range(10)]

now=N
while dp[now] > 0:
  res=-1
  temp_i=-1
  for i in range(M):
    if dp[now-creat_A[i]]==dp[now]-1:
      if res < A[i]:
        res=A[i]
        temp_i=i
  if res==-1:
    break
  else:
    ans[res]+=1
    now-=creat_A[temp_i]
temp2=0
for i in range(M):
  if creat_A[i]==now:
    temp2=max(temp2,A[i])
ans[temp2]+=1

#答えの出力。最小から加えて逆向きに読めばOK
ansans=""
for i in range(10):
  if ans[i]>0:
    ansans+=(str(i)*ans[i])
ansans=ansans[::-1]
print(ansans)

### FIXED CODE ###

N,M=map(int,input().split())
A=[int(x) for x in input().split()]
num=[2,5,5,4,5,6,3,7,6]

#最小本数で作成可能な数字をリスト化
creat_A=[]
for n in A:
  creat_A.append(num[n-1])

#dp[N]:N本のマッチ棒を使って作ることのできる最大桁数
dp=[-1 for _ in range(N+1)]
for i in range(M):
  if creat_A[i] <= N:
    dp[creat_A[i]]=1

for i in range(N):
  if dp[i]>0:
    for j in range(M):
      if i+creat_A[j] <= N:
        dp[i+creat_A[j]]=max(dp[i+creat_A[j]],dp[i]+1)

#dp[N]から使用した数字の数を算出。
ans=[0 for _ in range(10)]

now=N
while dp[now] > 0:
  res=-1
  temp_i=-1
  for i in range(M):
    if now-creat_A[i] >0 and dp[now-creat_A[i]]==dp[now]-1:
      if res < A[i]:
        res=A[i]
        temp_i=i
  if res==-1:
    break
  else:
    ans[res]+=1
    now-=creat_A[temp_i]
    
temp2=0
for i in range(M):
  if creat_A[i]==now:
    temp2=max(temp2,A[i])
ans[temp2]+=1

#答えの出力。最小から加えて逆向きに読めばOK
ansans=""
for i in range(10):
  if ans[i]>0:
    ansans+=(str(i)*ans[i])
ansans=ansans[::-1]
print(ansans)
import math
n = int(input())
half = math.floor(n**0.5)
#print(half)

for i in range(half+1,0,-1):
  if n % i == 0 and 1 <=n/i<=9 :
    num1,num2 = i,n//i  
    #print("Yes")
    break

print(num1+num2-2)
    

### FIXED CODE ###

import math
n = int(input())
half = math.floor(n**0.5)
#print(half)

num1 = 0
for i in range(half+1,0,-1):
  if n % i == 0:
    num1,num2 = i,n//i  
    #print("Yes")
    break

if num1 == 0:
  print(n-1)
else:
  print(num1+num2-2)
int(r*r)

### FIXED CODE ###

x = int(input())
print(x**2)
n = int(input())
c = input()
l = 0
r = n-1
ans = 0
while l<r:
    while l<n and c[l]=='R':
        l+=1
    while l>=0 and c[r]=='W':
        r-=1
    if l>r:
        break
    ans += 1
    l += 1
    r -= 1
print(ans)

### FIXED CODE ###

n = int(input())
c = input()
l = 0
r = n-1
ans = 0
while l<r:
    while l<n and c[l]=='R':
        l+=1
    while r>=0 and c[r]=='W':
        r-=1
    if l>r:
        break
    ans += 1
    l += 1
    r -= 1
print(ans)
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m=map(int,input().split())
uf=UnionFind(n)
G=[[] for _ in range(n)]
for _ in range(m):
  a,b=map(int,input().split())
  uf.union(a,b)
  
print(uf.group_count()-1)

### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m=map(int,input().split())
uf=UnionFind(n)
for _ in range(m):
  a,b=map(int,input().split())
  uf.union(a-1,b-1)
  
print(uf.group_count()-1)
n = int(input)
for i in range(n):
    std_in = input().split()
    dat.append([std_in[0], int(std_in[1])])

for i, e in enumerate(dat, start=1):
    e[1] = -e[1]  # 点数を降順ソートするために点数をマイナスにする。
    e.append(i)  # ソート前の順序
 
    sorted_list = sorted(dat)  # 都市名と点数のマイナス値で昇順ソート
 
for i, s in enumerate(sorted_list):
    # 順序を出力
    print(sorted_list[i][2])


### FIXED CODE ###

n = int(input())
dat = []
for i in range(n):
    std_in = input().split()
    dat.append([std_in[0], int(std_in[1])])
     
for i, e in enumerate(dat, start=1):
    e[1] = -e[1]  # 点数を降順ソートするために点数をマイナスにする。
    e.append(i)  # ソート前の順序
     
sorted_list = sorted(dat)  # 都市名と点数のマイナス値で昇順ソート
     
for i, s in enumerate(sorted_list):
    # 順序を出力
    print(sorted_list[i][2])
A = int(input())

print(a+a**2+a**3)

### FIXED CODE ###

a = int(input())

print(a+a**2+a**3)
def solve(l):
    for i in range(l,L):
        if S[i] == '1': return (2*solve(i+1) + pow(3,L-1-i,mod)) %mod
    return 1
mod = 10**9+7
S = input()
L = len(S)
print(solve(0))


### FIXED CODE ###

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9 + 7

def solve(l):
    tmp = 0
    tmpS = ''
    for i in range(l,L):
        if S[i] == '1':
            return (2*solve(i+1) + pow(3,L-1-i,mod))%mod
    else:
        return 1

S = input()
L = len(S)
print(solve(0)%mod)
a=int(input())
b=a[-1]
if b==3:
  print("bon")
elif b==2 or b==4 or b==5 or b==7 or b==9:
  print("hon")
else:
  print("pon")

### FIXED CODE ###

a=int(input())
b = a % 10
if b==3:
  print("bon")
elif b==2 or b==4 or b==5 or b==7 or b==9:
  print("hon")
else:
  print("pon")
from functools import reduce
import fractions

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

def gcd(data):
    if len(data) == 1:
        return data[0]
    return reduce(lambda x, y: fractions.gcd(x, y), data)

gcds = []

for i in range(1, n-1):
    gcds.append(gcd(A[0:i] + A[i+1:n]))

print(max(gcds))


### FIXED CODE ###

# coding: utf-8

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

def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    return gcd(b, a%b)

L = [0]
R = [0]

for i in range(n):
    L.append(gcd(L[i], A[i]))
    R.append(gcd(R[i], A[n-1-i]))
R.reverse()

result = []

for i in range(n):
    result.append(gcd(L[i], R[i+1])) 

print(max(result))
a,b,c=map(int,input().split())
x=c-a-b
if 4*a*b<x**2:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

num=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k=int(input())
print(num[k-1])
import sys
input = sys.stdin.readline


n = int(input())
s = input()
s = list(s)
# print(s)



pre = s[0]
for i in range(1, n):
    if pre=='#' and s[i]=='.':
        temp = i
        break
    pre = s[i]


# print(temp)
try:
    s = s[temp:]
    ans = sum(1 for x in s if x=='.')
    ans2 = sum(1 for x in s if x=='#') + 1
    if s[-1]=='#':
        ans -=1
        ans2 -=1

    print(min(ans, ans2))
except:
    print(0)

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

flag = False
if a<=c and c<=b:
    flag = True

if b<=c and c<=a:
    flag = True


if flag:
    print('Yes')
else:
    print('No')
K = int(input())
N = 10
a = [i for i in range(N)]
for k in range(K//N):
    a[k]+=K//N
for i in range(K%N):
    for j in range(N):
        if i==j:
            a[j]+=N
        else:
            a[j]-=1
print(N)
print(str(a)[1:][:-1].replace(", ", " "))


### FIXED CODE ###

K = int(input())
N = 50
a = [i+K//N for i in range(N)]
for i in range(K%N):
    for j in range(N):
        if i%N==j:
            a[j]+=N
        else:
            a[j]-=1
print(N)
print(str(a)[1:][:-1].replace(", ", " "))
import math
H, W = [int(_) for _ in input().split(" ")]
if (H == 1 or W == 1):
  print(1)
else if (H % 2 == 0):
  print(int(H/2*W))
else:
  print(int(H/2)*W+math.ceil(W/2))

### FIXED CODE ###

import math
H, W = [int(_) for _ in input().split(" ")]
if (H == 1 or W == 1):
  print(1)
elif (H % 2 == 0):
  print(int(H/2*W))
else:
  print(int(H/2)*W+math.ceil(W/2))
a = sorted(list(map(int,input().split())))

print(a[2]-[0])

### FIXED CODE ###

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

print(a[2]-a[0])
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def visiting(values,hp,vp,item):
	if not (0<=hp<len(values)): return
	if not (0<=vp<len(values[hp])): return
	if item!=values[hp][vp]: return
	values[hp][vp]=True
	visiting(values,hp-1,vp,item)
	visiting(values,hp+1,vp,item)
	visiting(values,hp,vp-1,item)
	visiting(values,hp,vp+1,item)

def solve(values):
	count=0
	for i in range(len(values)):
		for j in range(len(values[i])):
			if values[i][j] in ['@','#','*']:
				visiting(values,i,j,values[i][j])
				count+=1
	return count

def main():
	line,values=input(),list()
	while line!='0 0':
		H,W = list(map(int,line.strip().split(' ')))
		value = list()
		for _ in range(H):
			value.append(list(x for x in input().strip()))
		values.append(value)
		line = input()
	for value in values:
		print(solve(value))

if __name__=='__main__':
	main()

### FIXED CODE ###

# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10**6)

def search(field,hp,vp,item):
	if not (0<=hp<len(field)): return
	if not (0<=vp<len(field[hp])): return
	if item!=field[hp][vp]: return
	field[hp][vp]=True
	for dh,dv in [[0,1],[0,-1],[1,0],[-1,0]]:
		search(field,hp+dh,vp+dv,item)
#	search(field,hp-1,vp,item)
#	search(field,hp+1,vp,item)
#	search(field,hp,vp-1,item)
#	search(field,hp,vp+1,item)

def solve(field):
	count,valid_items=0,set(['@','#','*'])
	for i in range(len(field)):
		for j in range(len(field[i])):
			if field[i][j] in valid_items:
				search(field,i,j,field[i][j])
				count+=1
	return count

def main():
	line = input().strip()
	while line!='0 0':
		H,W = list(map(int,line.split(' ')))
		field = list()
		for _ in range(H):
			field.append(list(input().strip()))
		print(solve(field))
		line = input().strip()

if __name__=='__main__':
	main()
import numpy as np

N = int(input())
H = [ int(s) for s in str(input()).split()]
dp = np.full(10**5 + 10, np.inf)

def rec(i):
    if dp[i] < np.inf:
        return dp[i]
    
    if i==0:
        return 0
    
    res = np.inf
    res = rec(i-1) + abs(H[i]-H[i-1])
    if i > 1:
	    res = min(res, rec(i-2) + abs(H[i]-H[i-2]))
    
    dp[i] = res
    return dp[i]

def main3():
    print(int(rec(N-1)))
    
if __name__ == '__main__':
    main3()

### FIXED CODE ###

import numpy as np

N = int(input())
H = [ int(s) for s in str(input()).split()]
dp = np.full(10**5 + 10, np.inf)

def rec(i):
    if dp[i] < np.inf:
        return dp[i]
    
    if i==0:
        return 0
    
    res = np.inf
    res = min(res, rec(i-1) + abs(H[i] -H[i-1]))
    if i > 1:
        res = min(res, rec(i-2) + abs(H[i] - H[i-2]))
    
    dp[i] = res
    return res

def main3():
    print(int(rec(N-1)))

def main2():
    dp = np.full(10**5 + 10, np.inf)
    dp[0] = 0
    
    for i in range(0, N):
        if i+1 < N:
            dp[i+1] = min(dp[i+1], dp[i] + abs(H[i] - H[i+1]))
        if i+2 < N:
            dp[i+2] = min(dp[i+2], dp[i] + abs(H[i] - H[i+2]))
    
    print(int(dp[N-1]))
    
if __name__ == '__main__':
    main2()
a,b,c,d = map(int,input().split())
if abc(a-c) <= d or (abs(a-b) <= d and abs(b-c) <= d):
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a,b,c,d = map(int,input().split())
if abs(a-c) <= d or (abs(a-b) <= d and abs(b-c) <= d):
  print('Yes')
else:
  print('No')
n,m = map(int,input().split())
b = [True] * n
for i in range(m):
    x = int(input())
    b[x-1] = False

dp = [0] * n

if(b[0]):
    dp[0] = 1
    if(b[1]):dp[1] = 2
else:
    if(b[1]):dp[1] = 1

for i in range(2,n):
    if(b[i]):
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= 1000000007
print(dp[-1])

### FIXED CODE ###


n,m = map(int,input().split())
b = [True] * n
for i in range(m):
    x = int(input())
    b[x-1] = False

dp = [0] * n
if(n == 1):
    print(1)
    exit()
if(b[0]):
    dp[0] = 1
    if(b[1]):dp[1] = 2
else:
    if(b[1]):dp[1] = 1

for i in range(2,n):
    if(b[i]):
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= 1000000007
print(dp[-1])
S = input()
Q = int(input())
if Q != 1:
    Qr = [list(input().split()) for i in range(Q)]
isForward = True
for i in range(Q):
    if Qr[i][0] == "1":
        isForward = not(isForward)
    elif (isForward and  Qr[i][1] == "1") or (not(isForward) and Qr[i][1] == "2"):
        S = Qr[i][2] + S
    else:
        S = S + Qr[i][2]
if not(isForward):
    S = S[::-1]
print(S)

### FIXED CODE ###

from collections import deque
S = deque(input())
Q = int(input())
Qr = [list(input().split()) for i in range(Q)]
isForward = True
for i in range(Q):
    if Qr[i][0] == "1":
        isForward = not(isForward)
    elif (isForward and  Qr[i][1] == "1") or (not(isForward) and Qr[i][1] == "2"):
        S.appendleft(Qr[i][2])
    else:
        S.append(Qr[i][2])
S = list(S)
if not(isForward):
    S.reverse()
print("".join(S))
from collections import defaultdict
from fractions import Fraction
def powmod(x, n,mod):
 if n == 0:
  return 1
 K = 1
 while n > 1:
  if n % 2 != 0:
   K = K * x%mod
   x = x ** 2%mod
   n = (n - 1) // 2
  else:
   x = x ** 2%mod
   n = n // 2%mod
  return K * x # 指数を割り続け n が 1 に至ったら終了
import sys
input = sys.stdin.readline
N=int(input())
mod=10**9+7
dic=defaultdict(lambda: [0,0])
c=0
d=0
e=0
for i in [0]*N:
 A,B = map(int,input().split())
 if A==0 and B==0:
  e+=1
 elif A==0:
  c+=1
 elif B==0:
  d+=1
 else:
  if Fraction(A,B)>0:
   dic[Fraction(A,B)][0]+=1
  else:
   dic[-1/Fraction(A,B)][1]+=1
ans=1
for k in dic:
 ans*=(powmod(2,dic[k][0],mod)+powmod(2,dic[k][1],mod) -1)
 ans%=mod
ans*=(powmod(2,c,mod)+powmod(2,d,mod)-1)
print((ans-1+e)%mod)

### FIXED CODE ###

from collections import defaultdict
from math import gcd
import sys
input = sys.stdin.readline
N=int(input())
mod=10**9+7
dic=defaultdict(lambda: [0,0])
c=0
d=0
e=0
for i in [0]*N:
 A,B = map(int,input().split())
 if A==0 and B==0:
  e+=1
 elif A==0:
  c+=1
 elif B==0:
  d+=1
 else:
  g=gcd(A,B)
  A//=g
  B//=g
  if A*B>0:
   dic[(abs(A),abs(B))][0]+=1
  else:
   dic[(abs(B),abs(A))][1]+=1
ans=1
for k in dic:
 ans=ans*(pow(2,dic[k][0],mod)+pow(2,dic[k][1],mod) -1)
ans=ans*(pow(2,c,mod)+pow(2,d,mod)-1)
print((ans-1+e)%mod)
A, B = map(int, input().split())
print(max([A + b, A - B, A * B]))

### FIXED CODE ###

A, B = map(int, input().split())
l = [A + B, A - B, A * B]
print(max(l))
int a = input()
  int b = input()
  
  if a * b % 2 = 0
  	print("Even")
  else
  	print("Odd")

### FIXED CODE ###

a, b = map(int, input().split())
print("Odd" if a * b % 2 else "Even")
n = int(input())
flag = 0
for i in range(15):
  for j in range(26):
    if 7*i + 4*j == n:
      flag = 1
      exit

if flag == 1:
  print("Yes")
else :
  print("No")

### FIXED CODE ###

n, k = map(int, input().split())
if n%k != 0:
  print((n//k)+1 - (n//k))
else:
  print(0)
text = raw_input()
count = {} #a~zの出現回数を記録

for i in range(26):
    count[(i)] = 0
    
for i in range(len(text)):
    if(ord(text[i]) >= ord('a') and ord(text[i]) <= ord('z')):
        count[(ord(text[i]))-ord('a')] += 1

#出現回数の表示
for i in range(26):
    print '%s : %d' %(unichr(i+ord('a')), count[(i)])

### FIXED CODE ###

count = {}
for i in range(26):
    count[(i)] = 0

while True:
    try:
        x = raw_input()
    except:
        break
    for i in range(len(x)):
        if(ord('a') <= ord(x[i]) and ord(x[i]) <= ord('z')):
            count[(ord(x[i])-ord('a'))] += 1
        elif(ord('A') <= ord(x[i]) and ord(x[i]) <= ord('Z')):
            count[(ord(x[i])-ord('A'))] += 1

for i in range(26):
    print '%s : %d' %(chr(i+ord('a')), count[(i)])
exit(0)
N,M,C=[int(x) for x in str(input()).split()]
r=[int(x) for x in str(input()).split()]
ABC=[[0 for i in range(4)]]

dis=[[100001 for i in range(N+1)]]

for i in range(N):
  dis.append([100001 for i in range(N+1)])


for i in range(M):
  x=[0]+[int(x) for x in str(input()).split()]
  ABC.append(x)
  dis[x[1]][x[2]]=x[3]
  dis[x[2]][x[1]]=x[3]
  y=[0,x[2],x[1],x[3]]
  ABC.append(y)

for i in range(1,N+1):
  dis[i][i]=0




from itertools import permutations
mi=1000000
BASH=[]
for item in permutations([int(i) for i in range(1,M+1)]):
    BASH.append(list(item))

for i in BASH:

  p=0
  for j in range(0,len(i)-1):
    p+=dis[i[j]][i[j+1]]
  mi=min(mi,p)
print(mi)

### FIXED CODE ###

N,M,C=[int(x) for x in str(input()).split()]
r=[int(x) for x in str(input()).split()]
ABC=[[0 for i in range(4)]]

dis=[[1000000000000 for i in range(N+1)]]

for i in range(N):
  dis.append([1000000000000 for i in range(N+1)])


for i in range(M):
  x=[0]+[int(x) for x in str(input()).split()]
  ABC.append(x)
  dis[x[1]][x[2]]=x[3]
  dis[x[2]][x[1]]=x[3]
  y=[0,x[2],x[1],x[3]]
  ABC.append(y)

for i in range(1,N+1):
  dis[i][i]=0


for k in range(1,N+1):
  for i in range(1,N+1):
    for j in range(1,N+1):
      dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j])


mi=1000000000000
def perm(a,i):
  global mi
  if i==len(a):      

    p=0
    for x in range(len(a)-1):
      p+=dis[a[x]][a[x+1]]

    mi=min(mi,p)


  else:
    for j in range(i,len(a)):
      a[i],a[j]=a[j],a[i]
      perm(a,i+1)
      a[i],a[j]=a[j],a[i]


perm(r,0)

print(mi)
from fractions import gcd

d = gcd(*map(int, input().split()))
r = 1
for i in range(2, int(d ** 0.5) + 1):
    if d % i == 0:
        d //= i
        r += 1
    while d % i == 0:
        d //= i
print(r + (d > 1))


### FIXED CODE ###

R = lambda: map(int, input().split())
n, = R()
a = list(R())
print(*sorted(range(1, n + 1), key=lambda x: a[x - 1]))
a, b = map(int, input())
if a == 1:
  a == 14
if b == 1:
  b == 14
if a > b:
  print('Alice')
elif a == b:
  print('Draw')
else:
  print('Bob')

### FIXED CODE ###

a, b = map(int, input().split())
if a == 1:
  a = 14
if b == 1:
  b = 14
if a > b:
  print('Alice')
elif a == b:
  print('Draw')
else:
  print('Bob')
import math

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

total = 0

for i in range(n-m+1):
    p = n - i - 1
    q = m - 1

    c = int(math.factorial(p) / math.factorial(p-q) / math.factorial(q))

    total -= c * a[i]
    total += c * a[-1-i]

print(total % (10**9 + 7))


### FIXED CODE ###

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

f = [1, 1]
for i in range(2, n):
    f.append((f[i-1] * i) % mod)

total = 0
for i in range(n - k + 1):
    p = n - i - 1
    q = k - 1

    c = f[p] * pow(f[p-q], mod-2, mod) * pow(f[q], mod-2, mod) % mod
    total += c * (a[-1-i] - a[i])
    total = total % mod

print(total)
N = int(input())
A = [int(i) for i in input().split()]
diff = [0] * N
for i in range(N):
    diff[i] = A[i] - (i+1)
diff.sort

b1 = diff[len(diff) // 2]
b2 = diff[len(diff) // 2 + 1]

ans1 = 0
for i, a in enumerate(A):
    ans1 += abs(a - (i+1+b1))
ans2 = 0
for i, a in enumerate(A):
    ans2 += abs(a - (i+1+b2))
print(min(ans1, ans2))


### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]
for i in range(N):
    A[i] = A[i] - (i+1)
A.sort()
b = A[N//2]
ans = 0
for a in A:
    ans += abs(a - b)
print(ans)
import fractions
a, b = map(int, input().split())

c =fractions.gcd(a,b)
c2 = c
F = []
while c2%2==0:
    c2 //= 2
if c2<c:
    F.append(2)
f = 3
while f*f<=c2:
    while c2 %f ==0:
        c2//=f 
        if F[-1]<f:
            F.append(f)
    f += 2
if c2 !=1:
  F.append(c2)
#print(F)
print(len(F)+1)    


### FIXED CODE ###

import fractions
a, b = map(int, input().split())
 
c =fractions.gcd(a,b)
c2 = c
F = []
while c2%2==0:
    c2 //= 2
if c2<c:
    F.append(2)
f = 3
while f*f<c2:
    while c2 %f ==0:
        c2//=f 
        if F:
            if F[-1]<f:
                F.append(f)
        else:
            F.append(f)
    f += 2
if c2>1:
    F.append(f)
print(len(F)+1)
n = input()
A = input().split(' ')
A.sort()
q = input()
M = input().split(' ')

for m in M:
    print_yn(search(0, m))
    
def search(sum_base, m):
    if sum_base == m:
        return true
    result = false
    for a in A:
        if sum_base + a <= m:
            r_branch = search(sum_base + a, m)
            result = result || r_branch
    return result

def print_yn(result):
    if result:
        print('yes')
    else:
        print('no')
    return

### FIXED CODE ###

n = input()
A = input().split(' ')
A.sort()
A.reverse()
q = input()
M = input().split(' ')

A = list(map(int,A))
M = list(map(int,M))
A.sort()

A_sum = [0]
for a in A:
    A_sum.append(a+A_sum[-1])
A_sum.pop(0)

A.reverse()
A_sum.reverse()


#memo = [True]*(len(A))

def search(base, m, n):
    if base == m:
        return True
    if len(A)-1 < n or m - base > A_sum[n]:
        return False
    result = False
    for i in range(len(A)-1,n-1,-1):
        if base + A[i] <= m: # and memo[i]:
#           memo[i] = False
#           print(str(A[i]) + ',' + str(base+A[i]) + ',')
            if search(base+A[i], m, i+1):
                return True
#           memo[i] = True
    return result

def print_yn(result):
    if result:
        print('yes')
    else:
        print('no')

for m in M:
#   print(str(m)+':')
    print_yn(search(0,m,0))
s=list(input())
t=list(input())
ans=[]
for i in range(len(s)-len(t)):
  cnt=0
  for j in range(i,len(t)+i):
    if s[j]!=t[j]:
      cnt+=1
  ans.append(cnt)
print(min(ans))

### FIXED CODE ###

s=list(input())
t=list(input())
ans=[]
for i in range(len(s)-len(t)+1):
  cnt=0
  for j in range(i,len(t)+i):
    if s[j]!=t[j-i]:
      cnt+=1
  ans.append(cnt)
print(min(ans))