peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n,m=map(int,input().split())
a=[input() for _ in range(n)]
b=[input() for _ in range(m)]
b1=b[0]
res="No"
for i in range(n-m+1):
    if b1 in a[i]:
        x=a[i].index(b1)
        match=1
        for j in range(1,m):
            if a[i+j][x:x+m]!=b[j]:
                match=0
        if match:
            res="Yes"
print(res)
# Judge status: Accepted
n = int(input())%500
if n<=int(input()):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())
B = list(map(int, input().split()))
A = [0]*(N+1); A[0] = B[0]
B.append(B[N-2])
for i in range(1, N):
  A[i] = min(B[i-1], B[i])
print(sum(A))
# Judge status: Wrong Answer
s = input()
a = []
ans = 0
for i in range(len(s)):
    dainari = 0
    syonari = 0
    for j in reversed(range(i)):
        if s[j] == "<":
            dainari += 1
        else:
            break
    for j in range(i,len(s)):
        if s[j] == ">":
            syonari += 1
        else:
            break
    ans += max(dainari,syonari)
    #print(max(dainari,syonari),s[i],a)
print(sum(a)+(s[-1] == "<"))
# Judge status: Accepted
def f(n):
    k = 0
    while n*2**k<K:
        k += 1
    return k
N,K = map(int,input().split())
if K<=N:
    P = (N-K+1)/N
    for i in range(1,K):
        P += 2**(-f(i))/N
else:
    P = 0
    for i in range(1,N+1):
        P += 2**(-f(i))/N
print(P)
# Judge status: Accepted
from collections import Counter
s = input()
l = len(s)

a = s.count('a')
b = s.count('b')
c = s.count('c')

if max([a, b, c]) - min([a, b, c]) <= 1:
    print('YES')
    exit(0)
print('NO')
# Judge status: Wrong Answer
# AGC008 A Simple Calculator

x, y = map(int, input().split())
_x = abs(x)
_y = abs(y)

if x >= 0 and y >= 0:
    if x <= y:
        print(y-x)
    else:
        print(x-y+2)
elif x * y <= 0:
    print(abs(_y-_x)+1)
else:
    if _x < _y:
        print(_y-_x+2)
    else:
        print(_x-_y)
# Judge status: Accepted
N = int(input())
List = list(map(int,input().split()))
count = 0
while all(li % 2 == 0 for li in List):
    List = [i // 2 for i in List]
    count += 1
print(count)
# Judge status: Accepted
import bisect

n, m, k = map(int, input().split())
a = [int(_) for _ in input().split()]
b = [int(_) for _ in input().split()]

for i in range(1, n):
    a[i] += a[i-1]
for i in range(1, m):
    b[i] += b[i-1]

a = [0] + a
b = [0] + b

ans = 0

for i in range(n+1):
    can = k - a[i]
    if can < 0:
        break
    j = bisect.bisect_right(b, can)
    ans = max(ans, i+j-1)
print(ans)
# Judge status: Accepted
# -*- coding: utf-8 -*-
X = int(input())

q500 = int(X/500)
mod = X - (q500*500)

q5 = int(mod/5)

print(q500*1000 + q5*5)
# Judge status: Accepted

a,b,c,d = input()

print('Yes' if a==b==c or b==c==d else 'No')
# Judge status: Accepted
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

n = int(input())
cnt = [[0] * 10 for _ in range(10)]

for i in range(1, n+1):
    s = str(i)
    front = int(s[0])
    end = int(s[-1])
    cnt[front][end] += 1

ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += cnt[i][j] * cnt[j][i]
print(ans)
# Judge status: Accepted
S = input()

if S == 'Sunny':
    print('Cloudy')
elif S == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')
# Judge status: Accepted
X,Y = map(int,input().split())
ans = 0
while X <= Y:
    ans += 1
    X *= 2
print(ans)
# Judge status: Accepted
str = input().split()
print(len(set(str)))
# Judge status: Wrong Answer
_,a=open(0);print('ADPEPNRIOEVDE D'[any(a%3*a%5&~a for a in map(int,a.split()))::2])
# Judge status: Wrong Answer
n = int(input())
A = list(map(int, input().split()))

x = int((sum(A) / n) + 0.5)
ans = 0
for a in A:
    ans += (a - x) ** 2
print(ans)
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 11:36:51 2020

@author: shinba
"""

n = list(input())

if (n[0] == n[1] and n[1] == n[2]) or (n[1] == n[2] and n[2] == n[3]):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
Num = str(input())
L = len(Num)
if Num[1:] == '9'*(L-1):
  val = int(Num[0]) + 9*(L-1)
else:
  val = int(Num[0])-1 + 9*(L-1)
print(val)
# Judge status: Wrong Answer
def solution():
    n, k = map(int, input().split())
    ans = 0
    for i in range(k, n+2):
        smallest = (i-1) * i / 2
        largest = (n-i+1) * i + smallest
        ans += largest - smallest + 1
    ans %= 10 ** 9 + 7
    print(ans)

solution()
# Judge status: Wrong Answer
n = int(input())
s = input()
from collections import Counter
c = Counter(s)
cnt = 0
for i in range(n):
    for a in range(1,n//2):
        j = i + a
        k = j + a
        if k >= n:
            break
        if (s[i] != s[j])&(s[j] != s[k])&(s[i] != s[k]):
            cnt += 1  
        else:
            continue
                
print(c['R']*c['B']*c['G'] - cnt)
# Judge status: Wrong Answer
x, y = map(int, input().split())
if x == y:
    print(0)
    exit()


if abs(y) > abs(x):
    ans = abs(y) - abs(x)
    if x < 0:
        ans += 1
    if y < 0:
        ans += 1

    print(ans)

else:
    print(abs(x) - abs(y) + 1)
# Judge status: Accepted
N, K = map(int, input().split())
S = list(input())

A = S[K-1]
S[K-1] = A.lower()

print("".join(S))
# Judge status: Accepted
N = int(input())
S = input()

a = S[1:].count("E")
ans = [a]
for i in range(1,N):
  if S[i]=="E" and S[i-1]=="E":
    a -= 1
  elif S[i]=="E" and S[i-1]=="W":
    a += 0
  elif S[i]=="W" and S[i-1]=="E":
    a += 0
  elif S[i]=="W" and S[i-1]=="W":
    a += 1
  ans.append(a)

print(min(ans))
# Judge status: Accepted
N = int(input())
S = input()
T = list(1 if c == "(" else -1 for c in S)
l, l_min = 0, 0
r, r_min = 0, 0
for i in range(N):
    l += T[i]
    l_min = min(l_min, l)
    r -= T[N - i - 1]
    r_min = min(r_min, r)
print("".join(["(" * -l_min, S, ")" * -r_min]))
# Judge status: Wrong Answer
import fractions
N,M = list(map(int,input().split()))
a = list(map(int,input().split()))

for i in range(N):
	a[i] = a[i]//2

semi_lcm = a[0]
for i in range(1,N):
	semi_lcm = semi_lcm*a[i]//fractions.gcd(semi_lcm,a[i])

m = M//semi_lcm
if m == 0:
	print(0)
else:
	if m%2 == 1:
		print((m+1)//2)
	else:
		print(m//2)
# Judge status: Accepted
x = int(input())

if x <= 6:
    print(1)
elif x <= 11:
    print(2)
else:
    ans = (x // 11) * 2
    tmp = x % 11
    if tmp == 0:
        print(ans)
    elif tmp <= 6:
        print(ans+1)
    else:
        print(ans+2)
# Judge status: Accepted
c = [list(map(int,input().split())) for i in range(3)]
if c[0][1]-c[0][0] == c[1][1]-c[1][0] == c[2][1]-c[2][0] and c[0][2]-c[0][1] == c[1][2]-c[1][1] == c[2][2]-c[2][1] and c[0][0]-c[1][0] == c[0][1]-c[1][1] == c[0][2]-c[1][2] and c[1][0]-c[2][0] == c[1][1]-c[2][1] == c[1][2]-c[2][2]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
boin = ['a','e','i','o','u']
print(['consonant','vowel'][input() in boin])
# Judge status: Wrong Answer
s=input()
print('Yes'if all(s.count(i)%2==0for i in s)else'No')
# Judge status: Accepted
abc = list(map(int, input().split()))
k = int(input())
mx = abc.pop(abc.index(max(abc)))
print(mx * pow(2, k) + sum(abc))
# Judge status: Accepted
name = input().split()

print(name[0][0]+name[1][0]+name[2][0])
# Judge status: Wrong Answer
S=input()
T=input()
S = S[0:-1]

if S == T:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N = int(input())
s = input()
t = input()

ans = 2 * N
for i in range(N):
    for j in range(N - i):
        if s[i + j] != t[j]:
            break
    else:
        ans = min(ans, N + i)
print(ans)
# Judge status: Accepted
def INT():
    return int(input())

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

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

x, y = MI()
ans = 0

if abs(x) == abs(y):
    ans = int(x * y < 0)

elif abs(x) < abs(y):
    ans = abs(abs(y) - abs(x)) + int(x < 0) + int(y < 0)

else:
    ans = abs(abs(y) - abs(x)) + int(x * y <= 0) + int(x > 0 and y > 0) * 2
    if x < 0 and y == 0:
        ans -= 1

print(ans)
# Judge status: Wrong Answer
n = int(input())
result = ['AC','WA','TLE','RE']
c = [0]*4

for i in range(n):
    str = input()
    for n,r in enumerate(result):
        if str == r:
            c[n] += 1

for i in range(4):
    print(result[i], ' × ', c[i])
# Judge status: Accepted
h,w=map(int,input().split())
if h==1 or w==1:
    print(1)
    exit()
if h%2==1 and w%2==1:
    print((h*w+1)//2)
else:
    print(h*w//2)
# Judge status: Wrong Answer
import collections
N = int(input())
S = [input() for i in range(N)]

#重複チェック
c = collections.Counter(S)
value,count = zip(*c.most_common(len(c)))

if len(set(count)) == 1:
    s = sorted(value)
    for i in s:
        print(i)
else:
    for i in value:
        print(i)
        exit()
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    a = list(map(int, input().split()))

    num = 1
    count = 0

    for i in a:
        if i == num:
            num += 1
        else:
            count += 1
    
    if num == 1:
        print(-1)
    else:
        print(count)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer

def c169(x):
    x = x.split()
    x = map(lambda x:int(x),x)
    return(sum(x))


    
if __name__=="__main__":
    input = input()
    print(c169(input))
# Judge status: Accepted

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


alist.sort()

hurui=[0]*(alist[-1]+1)

for i in range(n):
    for j in range(1,alist[-1]//alist[i]+1):
        hurui[alist[i]*j]+=1
ans=0
for i in range(n):
    if hurui[alist[i]]==1:
        ans+=1
print(ans)
# Judge status: Wrong Answer
N, X, T = map(int, input().split())

if N%X == 0:
    ans = (N/X)*T

else:
    ans = (N//X +1)*T

print(ans)
# Judge status: Accepted

def resolve():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    ans = 1 << 60

    for i in range(N - K + 1):
        l = A[i]
        r = A[i + K - 1]
        l_to_r = abs(l) + abs(l - r)
        r_to_l = abs(r) + abs(r - l)
        res = min(l_to_r, r_to_l)
        ans = min(ans, res)

    print(ans)


if __name__ == "__main__":
    resolve()
# Judge status: Accepted
import itertools


def read():
    N = int(input())

    return N,


def solve(N, ):
    move = 1000000000000
    a = 1
    b = N
    while a < b:
        b = N // a
        if N % a == 0:
            move = min(move, a + b - 2)
        a += 1
    return move


if __name__ == '__main__':
    input = read()
    print(solve(*input))
# Judge status: Accepted
import sys
readline = sys.stdin.readline

def main():
    N, M = map(int, readline().rstrip().split())
    path = [[] for _ in range(N)]
    for _ in range(M):
        a, b = map(int, readline().rstrip().split())
        path[a-1].append(b-1)
        path[b-1].append(a-1)
    for p in path[0]:
        if N-1 in path[p]:
            print('POSSIBLE')
            return

    print('IMPOSSIBLE')
    return 
    

if __name__ == '__main__':
    main()
# Judge status: Accepted
n,k = map(int,input().split())
ans = n
ans = min(ans,n%k)
ans = min(ans,abs(k-n%k))
print(ans)
# Judge status: Accepted
N,K = map(int,input().split(" "))
H = sorted([int(input()) for _ in range(N)])
Min = 10**10
for i in range(K-1,len(H))[::-1]:
    Abs = H[i]-H[i-(K-1)]
    if Abs<Min:
        Min = Abs
print(Min)
# Judge status: Accepted
import sys

readline = sys.stdin.readline
N, M = map(int, readline().split())
A = [readline().rstrip() for _ in range(N)]
B = [readline().rstrip() for _ in range(M)]

for i in range(N-M+1):
    for j in range(N-M+1):
        if all(A[i+x][j:j+M] == B[x] for x in range(M)):
            print('Yes')
            sys.exit()
print('No')
# Judge status: Accepted
N=int(input())
p=list(map(int,input().split()))
count=0
for i in range(N):
  if p[i]!=i+1:
    count+=1
print("YES" if count<=2 else "NO")
# Judge status: Accepted
A,B=map(int,input().split())
if B==100:
  print((100**A)*101)
  exit()
print((100**A)*B)
# Judge status: Wrong Answer
K, A, B = map(int, input().split())
if B - A <= 2 :
  print(K + 1)
elif K < A + 1:
  print(K + 1)
else :
  ans = B 
  count = K - A - 1
  loop = count // (A + 2)
  amari = count % (A + 2)
  ans += B * loop + amari
  print(ans)
# Judge status: Wrong Answer
N, M = map(int,input().split())

ans = 0
if N * 2 <= M//2:
    ans += N
    nokori_c = M - N * 2
    ans += nokori_c // 4
    print(ans)
else:
    ans += M//2
    print(ans)
# Judge status: Accepted
c = str(input())

if c=="a" or c=="i" or c=="u" or c=="e" or c=="o":
    print("vowel")
else:
    print("consonant")
# Judge status: Accepted
from collections import Counter
import math

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

a.sort()

is_prime = [True]*(10**6 + 1)

is_prime[0] = False

maxA = max(a)

for i in set(a):
    for j in range(2 * i, maxA+1, i):
        is_prime[j] = False

result = 0
c = Counter(a)

for e in set(a):
        if is_prime[e] and c[e] == 1:
    #        print('e = {}'.format(e))
             result += 1

print(result)
# Judge status: Accepted
N,X = list(map(int,input().split()))
L_list = list(map(int,input().split()))

ans = 1
current = 0

for i in range(N):
  current += L_list[i]
  if current <= X:
    ans += 1
    
print(ans)
# Judge status: Accepted
N = int(input())
S = input()

ans = 0
for i in range(N):
    x = set(S[:i])
    y = set(S[i:])
    ans = max(ans, len(x & y))
print(ans)
# Judge status: Accepted
letter = input()

print(chr(ord(letter) + 1))
# Judge status: Accepted
N = int(input())
dp = [float("inf") for i in range(N+1)]
for i in range(6):
  if i <= N:
    dp[i] = i

for i in range(N+1):
  c = 1
  while i+6**c <= N:
    dp[i+6**c] = min(dp[i+6**c],dp[i]+1)
    c += 1
  c = 1
  while i+9**c <= N:
    dp[i+9**c] = min(dp[i+9**c],dp[i]+1)
    c += 1

for i in range(N,0,-1):
  if dp[i] != 0:
    ans = dp[i] + N-i
    break
print(ans)
# Judge status: Wrong Answer
n = int(input())
x = list(map(int, input().split()))

sort_x = sorted(x)
l = sort_x[n//2 - 1]
r = sort_x[n//2]

for xi in x:
  print(l if xi <= l else r)
# Judge status: Wrong Answer
def resolve():
    s = input()
    lis = []
    ans = ""
    for i in range(len(s)):
        if s[i] != "B":
            lis.append(s[i])
        elif s[i] == "B" and len(lis) != 0:
            lis.remove(lis[-1])
    for j in range(len(lis)):
        ans += lis[j]
    print(ans)
resolve()
# Judge status: Accepted
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
g=a[0]
for i in range(n):
  g=gcd(g,a[i])
print(g)
# Judge status: Accepted
n = int(input())
a = [0] + list(map(int, input().split()))
b = [0]*(n+1)
b[-1] = a[-1]
ans = []
for i in range(n, 0, -1):
    cnt = 0
    bi = i
    i += bi
    while i <= n:
        cnt += b[i]
        i += bi

    if (cnt%2) == a[bi]:
        b[bi] = 0
    else:
        b[bi] = 1
        ans.append(bi)

print(len(ans))
if ans:
    print(*ans)
# Judge status: Wrong Answer
li=list(map(int,input().split()))
a=li.pop(-1)
k=int(input())
a=a*(2**k)
for i in li:
  a+=i
print(a)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**8)

INF = 10**8

def rec(x, memo):
    if x == 0: return 0
    if memo[x] != -1: 
        return memo[x]
    
    res = INF
    pow6 = 1
    while x - pow6 >= 0:
        res = min(res, rec(x-pow6, memo)+1)
        pow6*=6
    
    pow9 = 1
    while x - pow9 >= 0:
        res = min(res, rec(x-pow9, memo)+1)
        pow9*=9

    memo[x] = res
    return res

n = int(input())
memo = [-1]*(n+1)
print(rec(n, memo))
# Judge status: Accepted
N=int(input())
li = []

now = 0
ans = -1
count = 0

for n in range(N):
  li.append(int(input()))

for n in range(N + 1):
  if n == 0:
    now = li[0]
    count += 1

    if now == 2:
      ans = count
      break

  now = li[now - 1]
  count += 1

  if now == 2:
    ans = count
    break

print(ans)
# Judge status: Accepted
n, *XY = map(int, open(0).read().split())
XY = list(zip(XY[::2], XY[1::2]))
A = [x+y for x, y in XY]
B = [x-y for x, y in XY]
print(max(max(A) - min(A), max(B) - min(B)))
# Judge status: Wrong Answer
A, B, K = map(int, input().split())
l = []
for i in range(1, min(A, B) + 1):
  if A % i == 0 and B % i == 0:
    l.append(i)
l.sort()
print(l[K-1])
# Judge status: Accepted
a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h/2))
# Judge status: Accepted
import sys
from collections import defaultdict

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    S = [0] * N
    for i in range(N):
        S[i] = readline().strip()

    ans = 0
    d = defaultdict(int)
    for s in S:
        s = ''.join(sorted(s))
        if s in d:
            ans += d[s]
        d[s] += 1

    print(ans)
    return


if __name__ == '__main__':
    main()
# Judge status: Accepted
S = int(input())

x1 = 0
y1 = 0
x2 = 10 ** 9
y2 = 1

y3_, x3_  =  divmod(S, x2)
if y3_ == 10 ** 9:
  y3 = y3_
  x3 = x3_
else:
  y3 = y3_ + 1
  x3 = 10 ** 9 - x3_

print(x1, y1, x2, y2, x3, y3)
# Judge status: Accepted
N = int(input())
ans = 0
tmp = 0
for _ in range(N):
    a = int(input())
    if a != 0:
        tmp += a
    else:
        ans += tmp // 2
        tmp = 0
ans += tmp//2

print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
B[0]+=A[0]
for i in range(1,N):
    A[i] += A[i-1]
    B[i]+=max(A[i],B[i-1])
print(B[N-1])
# Judge status: Accepted
def Maximum_Volume(l):

    ans = l / 3

    return ans ** 3

def main():
    l = int(input())
    print(Maximum_Volume(l))
if __name__ == '__main__':
    main()
# Judge status: Accepted
import math
N = int(input())

for i in range(1,46298):
    if math.floor(i*1.08) == N:
        print(i)
        exit()
print(":(")
# Judge status: Wrong Answer
S = input()
x = 0
y = 0
for i in S:
    if i == 'N':
        y += 1
    elif i == 'W':
        x -= 1
    elif i == 'S':
        y -= 1
    elif i == 'E':
        x += 1
if x == 0 and y == 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
x = int(input())
cnt = 0
for i in range(a + 1):
  for j in range(b + 1):
    for k in range(c + 1):
      if 500*i + 100*j + 50*k == x:
        cnt += 1
print(cnt)
# Judge status: Accepted
N=int(input())
ans=0
for i in range(1,N+1):
    if len(str(i))%2==1:
        ans+=1
        
print(ans)
# Judge status: Accepted
N = int(input())

al = 'abcdefghijk'


def next(digits, kind, cur):
    if digits == N:
        print(cur)
        return
    for i in range(kind+1):
        if i == kind:
            next(digits+1, kind+1, cur+al[i])
        else:
            next(digits+1, kind, cur+al[i])


next(1, 1, 'a')
# Judge status: Accepted
N = int(input())
T, A = map(int, input().split())
X = list(map(int, input().split()))
Tem = [0]*N
for i in range(N):
  Tem[i] = T-X[i]*0.006
D = [0]*N
for i in range(N):
  D[i] = abs(Tem[i]-A)
ans = D.index(min(D))+1
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3

from math import gcd

def solve(a,b,c):
  d = gcd(a,b)
  if c % d == 0:
    return "YES"
  else:
    return "NO"



def main():
  a,b,c = map(int,input().split())
  print(solve(a,b,c))
  return

if __name__ == '__main__':
  main()
# Judge status: Accepted
# -*- coding: utf-8 -*-
# B - Comparing Strings
import  sys

def solve152B(a, b):
	minI, maxI = a, b
	if a > b:
		maxI, minI = a, b
	
	st = ""
	for i in range(maxI):
		st += str(minI)
	
	print(st)


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

	solve152B(a, b)
# Judge status: Accepted
def solve(l,r):
  l_max = max(l)
  r_min = min(r)
  return max(r_min - l_max + 1, 0)
  
N,M = map(int,input().split())
L = [0]*M
R = [0]*M
for i in range(M):
  L[i],R[i] = map(int,input().split())
print(solve(L,R))
# Judge status: Wrong Answer
l=[list(map(int,input().split())) for i in range(3)]
l=sum(l,[])
n=int(input())
li=set([input() for ini in range(n)])
d=[0 for i in range(9)]
for g in range(9):
  if l[g] in li:d[g]=1
if set([1]) in [set(d[h::3])for h in range(3)]+[set(d[h:h+3])for h in {0,3,6}]+[set([d[0],d[4],d[8]]),set([d[2],d[4],d[6]])]:
  print("Yes")
else:print("No")
# Judge status: Wrong Answer
N=int(input())
a_list=list(map(int,input().split()))
a_list.sort(reverse=True)
c_list=[None]*N

c_list[0]=2**(len(bin(a_list[0])[2:]))
b=a_list[0]

for i,a in enumerate(a_list[1:]):
    c_list[1+i]=b^a^c_list[i]
    b=a

ans=" ".join(list(map(str,c_list)))
print(ans)
# Judge status: Accepted
x, n = map(int, input().split())
p = list(map(int, input().split()))

for i in range(100):
    if not p.count(x-i):
        print(x-i)
        exit()
    elif not p.count(x+i):
        print(x+i)
        exit()
# Judge status: Wrong Answer
N=int(input())
print(N/2+N%2)
# Judge status: Accepted
N = int(input())
list = []

for i in range(1, 10):
  for j in range(1, 10):
    list.append(i * j)
    
if N in list:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
k,n = map(int,input().split())

s = list(map(int,input().split()))
longest = 0
for i in range(n-1):
    long = s[i+1] - s[i]
    if long > longest:
        longest = long
if longest >= k - s[n-1] + s[0]:
    print(k - longest)
else:
    print(k - s[n-1] + s[0])
# Judge status: Accepted
import collections

N = int(input())
ans = 0

a = []
while N % 2 == 0:
    a.append(2)
    N //= 2
f = 3
while f * f <= N:
    if N % f == 0:
        a.append(f)
        N //= f
    else:
        f += 2
if N != 1:
    a.append(N)

A = collections.Counter(a)

A = list(A.values())

for i in range(len(A)):
    cnt = 1
    val = A[i]
    while val >= cnt:
        ans += 1
        val -= cnt
        cnt += 1
print(ans)
# Judge status: Accepted
S = input()

if S[-1] == "s" :
    print(S + "es")
else :
    print(S + "s")
# Judge status: Accepted
h,a = map(int,input().split())
if h % a == 0:
  print(h//a)
else:
  print(h//a+1)
# Judge status: Accepted
N = int(input()[-1])
if N in [2,4,5,7,9]:
  print('hon')
elif N in [0,1,6,8]:
  print('pon')
elif N in [3]:
  print('bon')
# Judge status: Wrong Answer
x = int(input())

ans = 0
for i in range(1, x):
    for j in range(2, x):
        if i**j <= x:
            ans = max(ans, i**j)
        elif i**j > x:
            break

print(ans)
# Judge status: Wrong Answer
a,b,c,d = map(int, input().split())
if a>0 and c>0: print(b*d)
else:
  if b>0 and d>0:
    print(b*d)
  elif b<0 and d>0:
    print(max(a,b)*min(c,d))
  elif d<0 and b>0:
    print(min(a,b)*max(c,d))
  else:
    print(min(a,b)*min(c,d))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
num = 1
b_num = 0

for i in range(n):
    if num != a[i]:
        b_num += 1
    else:
        num += 1

if b_num == n:
    b_num = -1

print(b_num)
# Judge status: Accepted
N, A, B = map(int, input().split())

if N==1 and A==B:
  ans = 1
elif N==1:
  ans = 0
elif A > B:
  ans = 0
else:
  ans = (B-A) * (N-2) + 1
print(ans)
# Judge status: Accepted
from collections import Counter as counter
ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(li() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########
def main(n,s):
    res = 0
    for i in counter(s).values():
        if 1 < i :
            res += int(i*(i-1)/2)
    print(res)

n = ii()
s = list("".join(sorted(input())) for _ in range(n))
main(n,s)
# Judge status: Wrong Answer
#ABC072-C
import collections
import itertools

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

c = collections.Counter(a)
acc = list(itertools.accumulate(c.values()))

acc.insert(0,0)
tmp = 0
tmp_prev = 0
if len(acc) >= 3:
    for i in range(3,len(acc)):
        tmp = acc[i] - acc[i-3]
        if tmp >= tmp_prev:
            tmp_prev = tmp
    print(tmp_prev)
        
else:
    print(acc[-1])
# Judge status: Accepted
import collections
def main():
    n,k=map(int, input().split())
    A=[int(i) for i in input().split()]
    dd = collections.defaultdict(int)
    for i in A:
        dd[i]+=1
    res = []

    for i in dd.keys():
        res.append([i,dd[i]])

    res.sort(key = lambda x:x[1])
    type = len(res)
    result = 0
    i=0
    while(type > k):
        result += res[i][1]
        type-=1
        i+=1

    print(result)


if __name__ == '__main__':
    main()
# Judge status: Accepted
s=input()
n=len(s)
for i in range(1,n//2):
  if s[0:n//2-i]==s[n//2-i:n-2*i]:
    print(n-2*i)
    break
  #print(s[0:n//2-i],s[n//2-i:n-2*i])