peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n, m = map(int,input().split())
def divisor(m): 
    i = 1
    table = []
    while i * i <= m:
        if m%i == 0:
            table.append(i)
            table.append(m//i)
        i += 1
    table = list(set(table))
    return table
L = divisor(m)
ans = 0
for l in L:
  if l <= m/n:
    ans = max(ans, l)
print(ans)
# Judge status: Accepted
N = int(input())

if N%2==0:
  print(N//2)
else:
  print(N//2+1)
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))

now = 1
cnt = 0
for a in A:
    if a == now:
        now += 1
        cnt += 1

if cnt == 0:
    print(-1)
else:
    print(n-cnt)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,M=MI()
    M+=N*2
    print(M//4)

main()
# Judge status: Accepted
Q,H,S,D=map(int,input().split())
N=int(input())
ans=min(4*N*Q,2*N*H,N*S,N//2*D)
if ans==N//2*D and N%2==1:
    ans+=min(4*Q,2*H,S)
    ans=min(ans,4*N*Q,2*N*H,N*S)
print(ans)
# Judge status: Wrong Answer
S = str(input())
Q = int(input())
querry = [list(map(str, input().split())) for i in range(Q)]
A_S = ''
S_A = ''
for i in range(Q):
    if querry[i][0] == '1':
        S = S[::-1]
        A_S = A_S[::-1]
        S_A = S_A[::-1]
    elif querry[i][0] == '2':
        if querry[i][1] == '1':
            A_S += querry[i][2] 
        elif querry[i][1] == '2':
            S_A += querry[i][2]

print(A_S + S + S_A)
# Judge status: Accepted
n=list(map(int,input().split()))
n.sort()
a=n[0]
b=n[1]
c=n[2]
if (a+c)%2==1:
  if (a+b)%2==1:
    print(1+(c-b)//2+(c+1-a)//2)
  else:
    print((c-(b+1))//2+(c-(a+1))//2+1)
else:
  if (a+b)%2==0:
    print((c-b)//2+(c-a)//2)
  else:
    print((c-a)//2+(c+1-b)//2+1)
# Judge status: Accepted
from collections import Counter
n = int(input())
A = tuple(map(int, input().split()))
C = Counter(A)
A = list(set(A))
ok = [True] * (10**6+1)

for a in A:
    temp = a+a
    while temp < 10**6+1:
        ok[temp] = False
        temp += a

c = 0
for a in A:
    if C[a] == 1 and ok[a] == True:
        c += 1
print(c)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
ma = max(A)

X = [0] * (ma + 1)
ans = 0
A.sort()

for a in A:
    X[a] += 1
for a in A:
    if X[a] ==1:
        ans += 1
    num = 1
    while num * a <= ma:
        X[num * a] += 2
        num += 1

print(ans)
# Judge status: Accepted
n=int(input())
f=list(map(int,input().split()))
c=0
for i in range(n-1):
    if f[i]==i+1:
        c+=1
        f[i],f[i+1]=f[i+1],f[i]
if f[n-1]==n:
    c+=1

print(c)
# Judge status: Wrong Answer
antennas = []
for i in range(5):
    antennas.append(int(input()))
k = int(input())

for e in antennas[:0:-1]:
    if e == antennas[0]:
        print(':(')
        break
else:
    print('Yay!')
# Judge status: Wrong Answer
import heapq  # heapqライブラリのimport
import sys
input = sys.stdin.readline
N,M=map(int,input().split())
lsta=[set() for i in range(10**5+1)]
lst=[]
ans=0
for i in range(N):
 A,B=map(int,input().split())
 lsta[A].add(-B)
heapq.heapify(lst)  # リストを優先度付きキューへ
for i in range(1,M+1):
 for j in lsta[i]:
  heapq.heappush(lst, j)
 if lst!=[]:
  ans+=heapq.heappop(lst)
print(-ans)
# Judge status: Wrong Answer
from collections import defaultdict
from fractions import Fraction
N = int(input())
A = [0 for  _ in range(N)]
B = [0 for  _ in range(N)]
for i in range(N):
    A[i], B[i] = [int(i) for i in input().split()]
A.sort()
B.sort()

if N%2 == 1:
    target = ((N+1)//2)-1
    print(B[target]-A[target]+1)
else:
    target1 = ((N)//2)-1
    target2 = (N)//2
    print((B[target2]-A[target1]) * 2-1)
# Judge status: Wrong Answer
N, *A = map(int, open(0).read().split())
ans = sum(c//2 for c in A)
A = [c%2 for c in A]
for i in range(N-1):
  if A[i]==A[i+1]==1:
    A[i+1] = 0
    ans += 1
print(ans)
# Judge status: Wrong Answer
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if abs(a - e) >= k:
  print(":(")
else:
  print("Yay!")
# Judge status: Accepted
n=int(input())
ans=float("inf")
for i in range(1,n):
    j=n-i
    tmp=0
    I=str(i)
    J=str(j)
    for ii in range(len(I)):
        tmp+=int(I[ii])
    for jj in range(len(J)):
        tmp+=int(J[jj])
    if tmp<ans:
        ans=tmp
print(ans)
# Judge status: Accepted
n=int(input())
w=list(map(int,input().split()))
z=sum(w)
s=z
for i in range(n):
  z-=2*w[i]
  s=min(s,abs(z))
print(s)
# Judge status: Accepted
N=int(input())
s=[input()for i in range(N)]

M=int(input())
t=[input()for i in range(M)]

ans=0
for i in s:
    ans=max(ans,s.count(i)-t.count(i))
print(ans)
# Judge status: Accepted
n = int(input())

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n) - 1, n) + chr(97 + X % n)
    return chr(97 + X % n)

print(Base_10_to_n(n - 1, 26))
# Judge status: Wrong Answer
import numpy as np
from functools import reduce
from operator import add,sub,mul,truediv
from fractions import gcd

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


ans = 1
x = a

while x < b:
    ans = ans + 1
    x = x + a-1

print(ans)
# Judge status: Accepted
n = int(input())
p_input = list(map(int,input().split()))

dp=[0]*n
if p_input[0]==1:
    dp[0]=1
for i in range(1,n):
    if p_input[i]==i+1:
        dp[i]=dp[i-1]+1
        dp[i-1]=0
ans=0
for i in range(n):
    if dp[i]%2==0:
        ans+=dp[i]//2
    else:
        ans+=dp[i]//2+1
print(ans)
# Judge status: Wrong Answer
import numpy as np
a, b ,x = map(float, input().split())
s = np.degrees([np.arctan(a*np.power(b, 2)/(2*x)), np.arctan(2*(np.power(a, 2)*b-x)/(np.power(a, 3)))])
print(s[0] if np.degrees(np.arctan(a/b))<=s[0] else s[1])
# Judge status: Wrong Answer

url = "https://atcoder.jp//contests/abc098/tasks/arc098_a"

def main():
    input()
    s = input()
    w_count = s.count('W')
    right_we = {"W": w_count, "E": len(s) - w_count}
    left_we = {"W": 0, "E": 0}
    ans = 100000
    for v in s:
        right_we[v] -= 1
        ans = min(ans, right_we["E"] + left_we["W"])
        left_we[v] += 1
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
#!/usr/bin/env python3
n = int(input()) 
a = list(map(int, input().split()))
l = list(range(1, len(a)+1, 1))
d = dict(zip(a, l))
ans = [str(d[x]) for x in l]
print(' '.join(ans))
# Judge status: Accepted
from bisect import bisect_left as bil
from bisect import bisect_right as bir
from itertools import accumulate


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

A.sort()
B.sort()
C.sort()

t = [0]*(N+1)

for i, b in enumerate(B):
    j = bil(A, b)
    t[i+1] = j


t = list(accumulate(t))


ans = 0
for c in C:
    i = bil(B, c)
    ans += t[i]

print(ans)
# Judge status: Wrong Answer
x = int(input())

if 400 <= x <= 599:
    print(8)
elif 600 <= x <= 799:
    print(7)
elif 800 <= x <= 999:
    print(6)
elif 1000 <= x <= 1199:
    print(5)
elif 1200 <= x <= 1399:
    print(4)
elif 1400 <= x <= 1599:
    print(3)
elif 1600 <= x <= 1799:
    print(2)
elif 1900 <= x <= 1999:
    print(1)
# Judge status: Wrong Answer
O=input()
E=input()
for i in range(len(O)):
    print(O[i],end="")
    if i!=len(O)-1:
        print(E[i],end="")
# Judge status: Accepted
a,b=map(int, input().split())

if a<=5:
    ans=0

elif 6<=a<=12:
    ans=b//2
    
else:
    ans=b
    
print(ans)
# Judge status: Wrong Answer
N=int(input())
print((N**2+N)/2)
# Judge status: Wrong Answer
n=int(input())
key=[]
value=[]
for i in range(1,n+1):
    a,b=input().split()
    b=100-int(b)
    c="{0}+{1}".format(a,b)
    key.append(c)
    value.append(i)
dic=dict(zip(key,value))
key.sort()
for j in key:
    print(dic[j])
# Judge status: Accepted
import sys
import bisect
input = sys.stdin.readline

def slove():
    n = int(input())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))
    C = list(map(int,input().split()))

    A = sorted(A)
    B = sorted(B)
    C = sorted(C)

    ans = 0

    for i in range(n):
        k = B[i]
        a = bisect.bisect_left(A,k)
        c = n-bisect.bisect_right(C,k)
        ans += a*c
        
    return ans


if __name__ == "__main__":
    print(slove())
# Judge status: Accepted
A,B,K=map(int, input().split())

M = min(A,B)
S = []

for i in range(1,M+1):
    if A%i==0 and B%i==0:
        S.append(i)

S=sorted(S)[::-1]
print(S[K-1])
# Judge status: Wrong Answer
S = list(str(input()))

def ss(string):
    if len(string)&2==1:
        retrun(False)
    else:
        for i in range(len(string)//2):
            if S[i]!=S[len(string)-1-i]:
                return(False)
        return(True)

while True:
    if ss(S):
        print(len(S))
        exit()
    else:
        del S[-1]
        del S[-1]
# Judge status: Accepted
n = int(input())
s = input()
l_cnt = 0
r_cnt = 0
l_ans = 0
for i in s:
    if i == ')':
        if l_cnt:
            l_cnt -= 1
        else:
            l_ans += 1
    else:
        l_cnt += 1

print(l_ans*'(' + s + l_cnt*')')
# Judge status: Wrong Answer
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('b1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    A, B, K = read_int_list()
    a = A - K
    if a < 0:
      a = 0
    
    b = B - abs(A - K)
    if A > K:
      b = B

    if A == 0 and B == 0:
      a = b = 0
    print(a, b)


main()
# Judge status: Accepted
s = input()
t = input()
l = len(t)
if s == t[:l-1]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N, A, B = map(int, input().split())
if A > B:
  print(0)
else:
  if N == 1 and A == B:
    print(1)
  elif N == 1:
    print(0)
  else:
    print((B-A)*(N-2)+1)
# Judge status: Wrong Answer
import itertools

n,i = map(int,input().split())
a = [i + 10**100 for i in range(n+1)]
#a = [i + 10**1 for i in range(n+1)]
ans = {}
s = 0
m = i
print(i,n)
while i <= n+1:
  wrk = list(itertools.combinations(a,i))
  for l in wrk:
    s = sum(l)
    if s not in ans:
      ans[s] = int(1)
    else:
      ans[s] += int(1)
  i += 1
print(len(ans))
# Judge status: Wrong Answer
N = int(input())
A = []
for _ in range(N):
  A.append(int(input()))
  
maxA = sorted(set(A), reverse=True)
maxA1 = maxA[0]
maxA2 = -1 if len(maxA) == 1 else maxA[1]

for i in range(N):
  if A[i] == maxA1 and maxA2 != -1:
    print(maxA2)
  else:
    print(maxA1)
# Judge status: Accepted
from decimal import *
H,W=map(int,input().split())
if H==1 or W==1:
	print(1)
	exit()
t = H//2 + H%2
t2 = t + H//2
x = Decimal((W//2*t2)) + Decimal((W%2*t))
print(x)
# Judge status: Accepted
n = int(input())
h = list(map(int, input().split()))
#b = list(map(int, input().split()))
flag = [0]*n
for i in reversed(range(1, n)):
    if h[i] < h[i-1]:
        h[i-1] -= 1

for i in range(n-1):
    if h[i] > h[i+1]:
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
# coding: utf-8
import math
import itertools

n = int(input())

ans = [0] * n

for x, y, z in itertools.product(range(1, int(math.sqrt(n))), range(1, int(math.sqrt(n))), range(1, int(math.sqrt(n)))):
    idx = x**2 + y**2 + z**2 + x*y + y*z + z*x
    if idx <= n:
        ans[idx-1] += 1

print(*ans, sep="\n")
# Judge status: Wrong Answer
x = int(input())
min = 10000
for i in range(1,1000):
	for j in range(2,40):
		if x-i**j < min and 0 < x-i**j:
			min = x-i**j
if min > 1000:
	print(x)
else:
	print(x-min)
# Judge status: Accepted
S=input()
T=input()
d=[[] for i in range(26)]
for i,c in enumerate(S):
    d[ord(c)-ord('a')].append(i)
d2=[[]for i in range(26)]
for i,c in enumerate(T):
    d2[ord(c)-ord('a')].append(i)
print(['No','Yes'][set((tuple(x) for x in d))==set((tuple(x) for x in d2))])
# Judge status: Accepted
n = int(input())
l = [0 for _ in range(n)]
already = set()
next = 1
c = 0
for i in range(n):
  a = int(input())
  l[i] = a
while c <= n:
  next = l[next-1]
  c += 1
  if next == 2:
    print(c)
    break
  elif next in already:
    print(-1)
    break
  already.add(next)
# Judge status: Accepted
import sys
import math
import bisect


def main():
    n = int(input())
    A = list(map(int, input().split()))
    if sum(A) - max(A) > max(A):
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()
# Judge status: Accepted
n,c,k = map(int,input().split())
t = sorted([int(input()) for i in range(n)])
ans = 0
j = 1
rimit = 0
for i in t:
    if j<c and rimit>=i:
        j+=1
    else:
        ans+=1
        rimit=i+k
        j=1
print(ans)
# Judge status: Accepted
from math import log
N = int(input())
print(2 ** int(log(N, 2)))
# Judge status: Accepted
a, b, c = map(int, input().split())
ans = min(c, b // a)
print(ans)
# Judge status: Accepted
S = input()
N = len(S)
if S == S[::-1] and S[:int((N-1)/2)] == S[:int((N-1)/2)][::-1]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
val= list(input())
flag=0
for i in range(0,len(val)):
    if val[i]=="7":
        flag=1
if flag == 1:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n=int(input())
h=list(map(int,input().split()))
k=h[0]-1
for i in range(1,n-1):
    if k<=h[i]-1:k=h[i]-1
    if k>h[i+1]:
        print('No')
        exit()
print('Yes')
# Judge status: Wrong Answer
S = input()
T = input()
ans = 0
for i in range(len(S)):
  if S[i] != T[i]:
    ans += 1
print(i)
# Judge status: Accepted
N,Q=map(int,input().split())
S=input()
LR=[]
for i in range(Q):
  LR.append(list(map(int,input().split())))
t=[0]*(N+1)
for i in range(N):
  if S[i:i+2]=='AC':
    t[i+1]=t[i]+1
  else:
    t[i+1]=t[i]
for i in range(Q):
  print(t[LR[i][1]-1]-t[LR[i][0]-1])
# Judge status: Accepted
import sys
readline = sys.stdin.readline
N,K = map(int,readline().split())
A = [0] + list(map(int,readline().split()))
c = 1
while K:
  if K & 1:
    c = A[c]
  A = [A[A[i]] for i in range(len(A))]
  K >>= 1
print(c)
# Judge status: Accepted
n=input()

if "7" in n:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import math
N,K=map(int,input().split())
A=list(map(int,input().split()))
saishou=A.index(1)
if K==N:
    print(1)
elif saishou==0 or saishou==N-1:
    answer=math.ceil((N-1)/(K-1))
    print(answer)
elif saishou+1<=K:
    answer=1+math.ceil((N-K)/(K-1))
    print(answer)
elif N-saishou<=K:
    answer=math.ceil((N-K)/(K-1))+1
    print(answer)
else:
    print(math.ceil(saishou/(K-1))+math.ceil((N-1-saishou)/(K-1)))
# Judge status: Accepted
X,Y=map(int,input().split())
mod=10**9+7
if (X+Y)%3!=0:
    print(0);exit()
if X*2<Y or Y*2<X:
    print(0);exit()
t=(X+Y)//3
f=[1]
for i in range(1,t+100):
    f.append(f[-1]*i%mod)
def comb(a,b,m):
    return f[a]*pow(f[b],m-2,m)*pow(f[a-b],m-2,m)%m
print(comb(t,X-t,mod))
# Judge status: Accepted
x,y = map(int,input().split())
if x%y==0:
    print(-1)
else:
    print(x)
# Judge status: Accepted
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
# from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

s=int(input())
x=(10**9-s%(10**9))%(10**9)
y=(s+x)//(10**9)
print(0, 0, 10**9,1,x,y)
# print(10**9,1)
# print(10**9-s%(10**9),s//(10**9))
# Judge status: Accepted
S = input()
count=0
if S[0]=="A":
  for i in range(2,max([len(S)-1,3]),1):
    if S[i]=="C":
      count+=1
      idx=i
  if count==1:
    s=S[1:idx]+S[idx+1:]
    if s==s.lower():
      print("AC")
    else:
      print("WA")
  else:
    print("WA")
else:
  print("WA")
# Judge status: Wrong Answer
from math import factorial

N = int(input())
P = input().split()
Q = input().split()

# P = ''.join(P)
# Q = ''.join(Q)

f_N_1 = factorial(N - 1)

def foo(digits, numbers, nth):
    if digits == 0: return 0
    return factorial(digits - 1) * (int(numbers[nth]) - 1) + foo(digits - 1, numbers, nth + 1)

a = foo(N, P, 0)
b = foo(N, Q, 0)

answer = abs(a - b)
# print(a, b)
print(answer)
# Judge status: Accepted
n = int(input())
s = input()
from collections import deque
q = deque([])
cnt = 0
for i in range(n):
    if s[i]==')':
        if cnt >0:
            cnt-=1
        else:
            q.appendleft('(')
        q.append(')')
    else:
        q.append('(')
        cnt += 1
if cnt:
    for _ in range(cnt):
        q.append(')')
print(''.join(q))
# Judge status: Wrong Answer
def main():
    N, A, B = (int(i) for i in input().split())
    if (N == 1 and A != B) or (B - A < 0):
        print(0)
    elif N == 1:
        print(1)
    elif N == 2:
        print(1)
    else:
        print((B-A)*B - (B-A)*A + 1)


if __name__ == '__main__':
    main()
# Judge status: Accepted
def main():
    n = int(input())
    s = ["".join(sorted(input())) for i in range(n)]
    
    from collections import Counter
    c = Counter(s)
    res = 0
    for i in c.values():
        if i < 2:
            continue
        else:
            res += i * (i-1) // 2
    print(res)
    
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
S = list(input())

S.sort()
#print(S)

if S[0] == S[1]:
    if S[2] == S[3]:
        print("Yes")
    else:
        print("No")


else:
    print("No")
# Judge status: Accepted
import math

N = int(input())
a = math.ceil(N/(10**9))
b = a*10**9-N
print(0, 0, 10**9, b, 1, a)
# Judge status: Accepted
N, M = map(int, input().split())
X = sorted(list(map(int, input().split())))

D = []
for i in range(1, M):
    d = X[i] - X[i - 1]
    D.append(d)
D.sort()

if N != 1:
    D = D[:-1 * (N - 1)]

print(sum(D))
# Judge status: Wrong Answer
l=int(input())
if l==1:
	print("%.18f"%((1/3)**3))
	exit()
if l==2:
	tt=2/3
	print("%.18f"%((tt)**3))
	exit()
a=l/3
b=l/3
c=l/3
temp=l%3
# ans=0 
if temp==0:
	ans=(a*b*c)
	print("%.18f"%(ans))
	exit()
if temp==1:
	a+=(1/3)
	b+=(1/3)
	c+=(1/3)
	ans=a*b*c
	print("%.18f"%(ans))
	exit()
if temp==2:
	tt=2/3
	ans=(a+tt)*(b+tt)*(c+tt)
	print("%.18f"%(ans))
	exit()
# Judge status: Wrong Answer
sx, sy, tx, ty = map(int, input().split())
ans = ""
gx, gy = (tx - sx, ty - sy)
# go
ans += "R" * gx + "U" * gy
ans += "R" + "D" * (gy + 1) + "L" * gx + "U"

# return
ans += "U" * gx + "R" * gy
ans += "U" + "L" * (gx + 1) + "D" * gy + "R"

print(ans)
# Judge status: Wrong Answer
import fractions
from functools import reduce

def gcd_list(numbers):
  if numbers != []:
    return reduce(fractions.gcd, numbers)
  else:
    return 0

if __name__ == '__main__':
  n = int(input())
  a_lst = [int(elem) for elem in input().split()] 
  left_gcd = [0] * n
  right_gcd = [0] * n
  ans = 0
  for i in range(0,n):
    left_gcd[i] = gcd_list(a_lst[:i])
    right_gcd[i] = gcd_list(a_lst[i+1:])
  print(left_gcd, right_gcd)
  for i in range(n):
    ans = max(ans, fractions.gcd(left_gcd[i],right_gcd[i]))
  print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
ans = 0
lst = []
for i in range(1,int(m**0.5)+1):
    if m%i == 0:
        if m//i < n:
            break
        else:
            ans = i
            lst.append(m//i)
lst.sort()
for i in lst:
    if m//i < n:
        break
    else:
        ans = i

print(ans)
# Judge status: Accepted
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  n = int(input())
  s = 0
  ans = []
  for i in range(50):
    if (n - s) % (2**(i+1)) == 0:
      ans.append('0')
    else:
      ans.append('1')
      s += ((-2) ** i)
    if s == n:
      break
  print(''.join(ans[::-1]))
    
if __name__=='__main__':
  main()
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
l = []

#aに１～bの数をかけたリストを作る
for i in range(b + 1):
  if i == 0:
    pass
  else:
    l.append((i * a) % b)
  
if c in l == True:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
while True:
    s = input()
    if 1 <= len(s) <= 10:
        break

flag = False

for l in range(len(s)):
    print(s[len(s)-2] + s[len(s)-1])
    if s[len(s)-2]=="h" and s[len(s)-1]=="i":
        print("Yes")
        flag = True
        break
    
    if s[l]=="h" and s[l+1]=="i" and s[l+2]!="i":
        print("Yes")
        flag = True
        break
        
    
if flag == False:
    print("No")
# Judge status: Accepted
s = input()
t = input()

flag = False

for i in range(1, len(s)+1):
    s1 = s[:i]
    s2 = s[i:]
    if s2 + s1 == t:
        flag = True
if flag:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import numpy as np

n, m = map(int, input().split())
possibility = [0 for _ in range(n)]
ball = [1 for _ in range(n)]
possibility[0] = 1
for i in range(m):
    x, y = map(int, input().split())
    if ball[x-1] != 0:
        possibility[y-1] = 1
    ball[x-1] -= 1
    ball[y-1] += 1
print(np.sum(np.array(possibility) > 0))
# Judge status: Wrong Answer
import math
a, b, h, m = map(int, input().split())
m_rad = 6 * m
h_rad = 30 * h + m / 2
rad = abs(h_rad - m_rad)
rad = rad
if rad > 180:
    rad = 360 - rad
    print(rad)
length_2 = a**2 + b**2 - 2*a*b*math.cos(math.radians(rad))
print(length_2**0.5)
# Judge status: Wrong Answer
a = int(input())
s = input()

if a >= 3200:
  print(s)
else:
  print("res")
# Judge status: Accepted
lst = input().split()
a = int(lst[0])
b = int(lst[1])

if a <= b:
   print(a)
else:
   print(a - 1)
# Judge status: Accepted
n, d=(int(x) for x in input().split())
d *= d
ans = 0
for i in range(n):
    a, b = (int(x) for x in input().split())
    if a*a + b*b <= d:
        ans += 1;

print(ans)
# Judge status: Accepted
n,m=map(int,input().split())

if 2*n<m:
    ans=n+(m-(2*n))//4
else:
    ans=m//2

print(ans)
# Judge status: Accepted
A,B = [int(s) for s in input().split()]
 
print('Yay!') if A <= 8 and B <= 8 else print(':(')
# Judge status: Accepted
a, b = (int(i) for i in input().split())
x = 1
y = 0
while(100000):
  if b == 1:
    print(0)
    break
  if (a - 1) * y + a >= b:
    print(y + 1)
    break
  else:
    y += 1
# Judge status: Accepted
n,a,b = map(int, input().split())
if a > b : a,b = b,a #swap
### 差が偶数
if (b-a)%2 == 0:
    print((b-a)//2)
if (b-a)%2 == 1:
    ### 1側で調整
    ichi = a + (b-a-1)//2
    ### n側で調整
    b = n-b
    a = n-a
    enu = b + 1 + (a-b-1)//2
    print(min(ichi,enu))
# Judge status: Accepted
x, a,b = map(int, input().split())
xa = abs(a-x)
xb = abs(b-x)
if xa > xb:
	print('B')
else:
	print('A')
# Judge status: Accepted
N=int(input())
if N==10 or N==10**2 or N==10**3 or N==10**4 or N==10**5:
  print(10)
else:
  a=list(str(N))
  b=sum([int(i) for i in a])
  print(b)
# Judge status: Accepted
A,V = (int(x) for x in input().split())
B,W = (int(x) for x in input().split())
T = int(input())

if V>W and abs(A-B)/(V-W)<=T:
    Flag = True
else:
    Flag = False
    
if Flag:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
[A,B] = list(map(int,input().split()))
if A<=8 and B<=8:
    print("Yay!")
else:
    print(":(")
# Judge status: Wrong Answer
def main():
    N, K = map(int, input().split())
    R, S, P = map(int, input().split())
    T = input()
    scores = []
    for t in T:
        if t == 'r':
            scores.append(P)
        elif t == 's':
            scores.append(R)
        else:
            scores.append(S)
    for i in range(N-K):
        if scores[i] == scores[i+K]:
            scores[i+K] = 0
    print(sum(scores))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n = int(input())
s = input()
t = input()
cnt = 0
for i in range(n):
    print(s[i:])
    print(t[:n-i])
    if s[i:] == t[:n-i]:
        cnt += n - i
        break
print(2 * n - cnt)
# Judge status: Accepted
s = input()
s = list(str(s))

for i in range(len(s)):
    if s[i] == '?':
        s[i] = 'D'

print(''.join(s))
# Judge status: Accepted

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

amin=min(a)
amax=max(a)

smin=(amax**2)*n
for y in range(amin,amax+1):
    ssum=0
    for i in range(n):
        ssum=ssum+(a[i]-y)**2
    smin=min(smin,ssum)

print(smin)
# Judge status: Accepted
from collections import Counter

N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

cntA = Counter(A)
cntvalA = sorted(list(cntA.values()))
ans = sum(cntvalA[i] for i in range(len(cntvalA) - K))
print(ans)