Harryxun/stf_run huggingface dataset:
'''
https://atcoder.jp/contests/abc150/tasks/abc150_d
'''
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

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

    if n == 1:
        if m >= a[0]//2:
            print((m-a[0]//2) // a[0] + 1)
        else:
            print(0)
        exit()

    def gcd(a, b):
        if b == 0:
            return a
        else:
            return gcd(b, a % b)
    
    def gcd_group(arr):
        g = gcd(arr[0], arr[1])
        for i in range(2, len(arr)):
            g = gcd(g, arr[i])
        return g
    
    def lcm(a, b):
        g = gcd(a, b)
        return (a*b)//g
    
    def lcm_group(arr):
        l = lcm(arr[0], arr[1])
        for i in range(2, len(arr)):
            l = lcm(l, arr[i])
        return l
    g = gcd_group(a)
    for i in a:
        if (i//g)%2 == 0:
            print(0)
            exit()
    lcm = lcm_group(a)
    semi_lcm = lcm // 2
    if m >= semi_lcm:
        print((m-semi_lcm)//lcm + 1)
    else:
        print(0)


if __name__ == '__main__':
    main()

### FIXED CODE ###

'''
https://atcoder.jp/contests/abc150/tasks/abc150_d
'''
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

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

    if len(a) == 1:
        if m >= a[0]//2:
            print((m-a[0]//2) // a[0] + 1)
        else:
            print(0)
        exit()

    def gcd(a, b):
        if b == 0:
            return a
        else:
            return gcd(b, a % b)
    
    def gcd_group(arr):
        g = gcd(arr[0], arr[1])
        for i in range(2, len(arr)):
            g = gcd(g, arr[i])
        return g
    
    def lcm(a, b):
        g = gcd(a, b)
        return (a*b)//g
    
    def lcm_group(arr):
        l = lcm(arr[0], arr[1])
        for i in range(2, len(arr)):
            l = lcm(l, arr[i])
        return l
    g = gcd_group(a)
    for i in a:
        if (i//g)%2 == 0:
            print(0)
            exit()
    lcm = lcm_group(a)
    semi_lcm = lcm // 2
    if m >= semi_lcm:
        print((m-semi_lcm)//lcm + 1)
    else:
        print(0)


if __name__ == '__main__':
    main()
N, M = map(int, input().split())
l = 1
r = N
for i in range(M):
  L, R = map(int, input().split())
  if L > l:
    l = L
  if r > R:
    r = R
if l > r:
  print(0)
else:
  print(r-l+1)

### FIXED CODE ###

A, B = map(int, input().split())
if A >= 13:
  print(B)
elif A <= 5:
  print(0)
else:
  print(B//2)
import collections
n,x,y=map(int,input().split())
lit=[]
for i in range(1,N+1):
  for j in range(i+1,N+1):
     lit.append(min(abs(i-j),abs(x-j)+abs(y-i)+1,abs(y-j)+abs(x-i)+1))
a=lit.collections.Counter
for i in range(1,N):
  print(a[i])

### FIXED CODE ###

import collections
N,x,y=map(int,input().split())
lit=[]
for i in range(1,N+1):
  for j in range(i+1,N+1):
     lit.append(min(abs(i-j),abs(x-j)+abs(y-i)+1,abs(y-j)+abs(x-i)+1))
a=collections.Counter(lit)
for i in range(1,N):
  print(a[i])
attack=list(map(int,input().split()))
damage=list(map(int,input().split()))
A=0

N=attack[0]
K=attack[1]
damage.sort(reverse=True)
#print(damage)
if N>K:
  for i in range(K):
    del damage[i]

  A=sum(damage)
  print(A)

else:
  print(0)  

### FIXED CODE ###

attack=list(map(int,input().split()))
damage=list(map(int,input().split()))
A=0

N=attack[0]
K=attack[1]
damage.sort(reverse=True)

if N>K:
  del damage[:K]
  print(sum(damage))

else:
  print(0)
n = int(input())
a = input().split(' ')
for i in range(n):
  a[i] = int(a[i])
print(a)

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

bunshi = 1
bunbo = a[0]
for i in range(1, n):
  bunshi = bunbo + a[i]
  bunbo = bunbo * a[i]
  gcd = gcd(bunbo, bunshi)
  bunbo = bunbo / gcd
  bunshi = bunshi / gcd
print(bunbo / bunshi)

### FIXED CODE ###

n = int(input())
a = input().split(' ')
for i in range(n):
  a[i] = int(a[i])
  
res = 0.0
for i in range(n):
  res += 1 / a[i]

print(1 / res)
n=int(input())
a=list(map(int,input().split())
b=0
for _ in a:
    for i in range(n-1,0,-1):
        if a[i]<a[i-1]:
            a[i],a[i-1]=a[i-1],a[i]
            b+=1
print(*a)
print(b)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=0
for _ in a:
    for i in range(n-1,0,-1):
        if a[i]<a[i-1]:
            a[i],a[i-1]=a[i-1],a[i]
            b+=1
print(*a)
print(b)
from collections import deque

import numpy as np
import sys
#input = sys.stdin.readline

sys.setrecursionlimit(5000)

def get_adj_tiles(v):
  i, j = v
  res = [(i-1, j), (i+1, j), (i, j-1), (i, j+1)]
  return res

def bfs(point):
  visited = []
  que = deque()
  que.append((point, 1))

  while len(que) > 0:
    v, depth = que.popleft()
    visited.append(v)
    adjs = get_adj_tiles(v)
    for a in adjs:
      if field[a[0]][a[1]] == '.' and a not in visited:
        if a == (H, W):
          return depth + 1
        else:
          que.append((a, depth+1))
          if len(que) == 0:
            return 0

          H, W = list(map(int, input().split()))
          field = [['#'] * (W + 2) for _ in range(H + 2)]
          for i in range(H):
            values = list(input())
            field[i+1][1:-1] = values

            number_of_whites = 0
            for i in range(H+2):
              for j in range(W+2):
                if field[i][j] == '.':
                  number_of_whites += 1
                  shortest_path = bfs((1, 1))
                  if shortest_path > 0:
                    print(number_of_whites - shortest_path)
                    else:
                      print(-1)

### FIXED CODE ###

H, W = list(map(int, input().split()))
M = [[-1]*(W+2)]
ans = 0
for _ in range(H):
    s = input()
    ans += s.count('.')
    M.append([-1]+[0 if c=='.' else -1 for c in s]+[-1])
M += [[-1]*(W+2)]

queue = [(1,1)]
M[1][1] = 1
dr = [(+1,0),(-1,0),(0,+1),(0,-1)]
turn = 1
while len(queue)>0:
    turn += 1
    queue_new = []
    for qx, qy in queue:
        for dx, dy in dr:
            x, y = qx+dx, qy+dy
            if M[y][x]==0:
                M[y][x] = turn
                queue_new.append((x,y))
    queue = queue_new

print(ans-M[H][W] if M[H][W]>0 else -1)
n, m, k = map(int, input().split())

def dfs(u):
    if visited[u]:
        return

    visited[u] = True

    for v in graph[u]:
        s.add(v)
        dfs(v)

graph = {}

for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1

    graph[a] = graph.get(a, set())
    graph[a].add(b)

    graph[b] = graph.get(b, set())
    graph[b].add(a)

blocks = {}

for _ in range(k):
    c, d = map(int, input().split())
    c -= 1
    d -= 1

    blocks[c] = blocks.get(c, set())
    blocks[c].add(d)

    blocks[d] = blocks.get(d, set())
    blocks[d].add(c)

ans = [0] * n

visited = [False] * n

for u in range(n):
    if not visited[u]:
        s = set()

        dfs(u)

        l = len(s)

        for i in s:
            ans[i] += l - 1

            if i in blocks:
                ans[i] -= len(blocks[i].intersection(s))

            if i in graph:
                ans[i] -= len(graph[i].intersection(s))

print(*ans)

### FIXED CODE ###

from sys import setrecursionlimit
setrecursionlimit(2 * 10 ** 9)

n, m, k = map(int, input().split())

def dfs(u):
    if visited[u]:
        return

    visited[u] = True

    for v in graph[u]:
        s.add(v)
        dfs(v)

graph = {i: set() for i in range(n)}
blocks = {i: set() for i in range(n)}

for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1

    graph[a].add(b)
    graph[b].add(a)

for _ in range(k):
    c, d = map(int, input().split())
    c -= 1
    d -= 1

    blocks[c].add(d)
    blocks[d].add(c)

ans = [0] * n

visited = [False] * n

for u in range(n):
    if not visited[u]:
        s = set()

        dfs(u)

        l = len(s)

        for i in s:
            ans[i] += l - 1
            ans[i] -= len(blocks[i].intersection(s))
            ans[i] -= len(graph[i].intersection(s))

print(*ans)
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import deque
def main():
    n=int(input())
    A=list(map(int,input().split()))
    A.sort(reverse=True)
    Large=deque(A)
    Small=deque()
    while len(Large)>=2:
        if Large[-1]>=0:break
        Small.append(Large.pop())
    if not Small:Small.append(Large.pop())
    ans=[]
    while len(Large)>=2:
        a=Large.pop()
        b=Small.pop()
        ans.append((b,a))
        Small.append(b-a)  
    large=Large.pop()
    while len(Small)>=2:
        b=Small.popleft()
        ans.append((b,a))
        large+=-b
    small=Small.pop()
    ans.append((large,small))
    print(large-small)
    for a,b in ans:
        print(a,b)

if __name__=='__main__':
    main()

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().rstrip()
from collections import deque
def main():
    n=int(input())
    A=list(map(int,input().split()))
    A.sort(reverse=True)
    Large=deque([a for a in A if a>=0])
    Small=deque([a for a in A if a<0])
    if not Large:Large.append(Small.popleft())
    if not Small:Small.append(Large.pop())
    ans=[]
    while len(Small)>=2:
        a,b=Large.pop(),Small.pop()
        ans.append((a,b))
        Large.append(a-b)
    small=Small.pop()
    while len(Large)>=2:
        a=Large.pop()
        ans.append((small,a))
        small-=a
    large=Large.pop()
    ans.append((large,small))
    print(large-small)
    for a,b in ans:
        print(a,b)

if __name__=='__main__':
    main()
from math import gcd
a,b=map(int,input().split())
print(a*b//gcd(a,b))

### FIXED CODE ###

from fractions import gcd
a,b=map(int,input().split())
print(a*b//gcd(a,b))
a,b,k=map(int,input().split())
for i in range(k):
    if i%2==0:
        b+=a//2
        a=a//2
    if i%2!=0:
        a+=b//2
        b=b//2
print(a,b)

### FIXED CODE ###

s=input()
S=list(s)
if len(S)==2:
    print(s)
else:
    print(S[2]+S[1]+S[0])
n = int(input())

if n == 1:
    print("Hello World")
else:
    a, b = map(int, input().split())
    print(a + b)

### FIXED CODE ###

n = int(input())

if n == 1:
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a + b)
def solve(S):
    if S == "":
        return True
    
    if S in ["dream","dreamer","erase","eraser"]:
        return True
    elif len(S) <= 6:
        return False

    if S[0:7] == "dreamer":
        return solve(S[7:]) or solve(S[5:])
    elif S[0:5] == "dream":
        return solve(S[5:])
    if S[0:6] == "eraser":
        return solve(S[6:]) or solve(S[5:])
    elif S[0:5] == "erase":
        return solve(S[5:])

    return False

print("YES" if solve(input()) else "NO")

### FIXED CODE ###

s = input()[::-1]
flag = 1
i = 0
while i < len(s):
    if s[i:i+5] == "maerd" or s[i:i+5] == "esare":
        i += 5
    elif s[i:i+6] == "resare":
        i += 6
    elif s[i:i+7] == "remaerd":
        i += 7
    else:
        flag = 0
        break

print("YES" if flag else "NO")
K,X = map(int,input().split())

list = []

for i in range(X-K+1,X+K):
    list.append(i)

print(" ".join(map(int,list))


### FIXED CODE ###

K,X = map(int,input().split())

list = []

for i in range(X-K+1,X+K):
    list.append(i)

print(" ".join(map(str,list)))
input_line = int(input())
out_selection = input().split()
out_bubble = out_bubble[:]

# bubblesort                                                                                  
for i in range(n):
    for j in range(n-1, i, -1):
        if out_bubble[j][1] < out_bubble[j-1][1]:
            out_bubble[j], out_bubble[j-1] = out_bubble[j-1],out_bubble[j]
print(*out_bubble)
print("Stable")

# selectionsort                                                                               
for i in range(n):
    minj = i
    for j in range(i, n):
        if out_selection[j][1] < out_selection[minj][1]:
            minj = j
    out_selection[i], out_selection[minj] = out_selection[minj], out_selection[i]

print(*out_selection)
print("Stable" if out_bubble == out_selection else "Not stable")



### FIXED CODE ###

input_line = int(input())
out_selection = input().split()
out_bubble = out_selection[:]

# bubblesort                                                                                  
for i in range(input_line):
    for j in range(input_line-1, i, -1):
        if out_bubble[j][1] < out_bubble[j-1][1]:
            out_bubble[j], out_bubble[j-1] = out_bubble[j-1],out_bubble[j]
print(*out_bubble)
print("Stable")

# selectionsort                                                                               
for i in range(input_line):
    minj = i
    for j in range(i, input_line):
        if out_selection[j][1] < out_selection[minj][1]:
            minj = j
    out_selection[i], out_selection[minj] = out_selection[minj], out_selection[i]

print(*out_selection)
print("Stable" if out_bubble == out_selection else "Not stable")
n, k = map(int, input().split())
a = (list)(map(int, input().split()))

# print(-(-(n-1)//(k-1)))
print((n + (k - 1)) // k)


### FIXED CODE ###

from functools import reduce
n = (int)(input())
a = (list)(map(int, input().split()))


def gcd(a, b):
    # a>b
  while(b):
    c = a % b
    a = b
    b = c
  return a


def calcMod(a, m):
  return sum([m % v for v in a])


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


def lcm_list(l):
  g = reduce(lcm, l)
  return g


def mul(a, b):
  return a*b


#print(calcMod(a, (int)(lcm_list(a)-1)))
print(calcMod(a, reduce(mul, a)-1))
a,p = map(int,input())
print((a * 3 + p)//2)

### FIXED CODE ###

a,p = map(int,input().split())
print((a * 3 + p)//2)
a,b = [int(x) for x in input().split()]

if a==b:
 print("a == b")
elif a>b:
 print("a > b")
eles:
 print("a < b")

### FIXED CODE ###

a, b = map(int,input().split())
 
if a < b:
    print("a < b")
elif a > b:
    print("a > b")
else:
    print("a == b")
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

C = [A[i]-B[i] for i in range(N)]
if 0 in C:
    print("Yes")
    exit()

Cplus = list(filter(lambda x:x>0, C))
Cminas = list(filter(lambda  x:x<0, C))

Cplus.sort(reverse=True)
pl = len(Cplus)
Cminas.sort()
ml = len(Cminas)

i = 0
j = 0
while True:
    if Cplus[i] > 0:
        if Cminas[j] <= -2:
            Cplus[i] -= 1
            Cminas[j] += 2
        else:
            j += 1
            if j >= ml:
                print("No")
                break
    else:
        i += 1
        if i >= pl:
            print("No")
            break

    if (Cplus[-1] <= 0) & (Cminas[-1] <= 0):
        print("Yes")
        break





### FIXED CODE ###

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

C = [B[i]-A[i] for i in range(N)]

P = sum(filter(lambda x: x<0, C))
M = list(filter(lambda x: x>1, C))
M = list(map(lambda x: x//2, M))

M = sum(M)
if abs(M) >= abs(P):
    print("Yes")
else:
    print("No")
n, q = map(int, input().split())
s = input()
l = []
r = []
t = [0]*len(s)

for i in range(q):
    temp1, temp2 = map(int, input().split())
    l.append(temp1)
    r.append(temp2)

for i in range(1, len(s)):
    if s[i-1] + s[i] ==	'AC':
		t[i] = t[i-1] + 1
    else:
        t[i] = t[i-1]

#print(t)

for i in range(q):
    left = l[i]	- 1
    right = r[i] - 1
    # print(left)
    # print(right)
    print(t[right] - t[left])


### FIXED CODE ###

n, q = map(int, input().split())
s = input()
l = []
r = []
t = [0]*len(s)

for i in range(q):
    temp1, temp2 = map(int, input().split())
    l.append(temp1)
    r.append(temp2)

for i in range(1, len(s)):
    if s[i-1] + s[i] == 'AC':
        t[i] = t[i-1] + 1
    else:
        t[i] = t[i-1]

#print(t)

for i in range(q):
    left = l[i] - 1
    right = r[i] - 1
    # print(left)
    # print(right)
    print(t[right] - t[left])
s = input()
t = input()
max_len = 0

for i in range(len(t)):
    for j in range(i, len(t)+1):
        print(t[i:j])
        if t[i:j] in s[i:len(s)-j+1]:
            max_len = max(max_len, j-i)

print(len(t) - max_len)

### FIXED CODE ###

s = input()
t = input()
max_count = 0

for i in range(len(s)-len(t)+1):
    count = 0
    s_ = s[i:i+len(t)+1]
    for j in range(len(t)):
        if s_[j] == t[j]:
            count += 1
    max_count = max(max_count, count)

print(len(t) - max_count)
A = []
for P in range(1,max(X)+1):
    for i in range(N):
        A.append((X[i]-P)**2)
    if sum(A[0:N]) <= sum(A[N:2*N]) or len(A) == N:
        A = A[0:N]
    else:
        A = A[N:2*N]
print(sum(A))

### FIXED CODE ###

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

A = []
for P in range(1,101):
    for i in range(N):
        A.append((X[i]-P)**2)
    if sum(A[0:N]) <= sum(A[N:2*N]) or len(A) == N:
        A = A[0:N]
    else:
        A = A[N:2*N]
print(sum(A))
n, m = map(int, input().split())
ans = [0] * m

for _ in range(n):
    a = list(map(int, input().split()))
    for i in a[1:]:
        ans[i] += 1

print(ans.count(n))


### FIXED CODE ###

n, m = map(int, input().split())
ans = [0] * m
for _ in range(n):
    a = list(map(int, input().split()))
    
    for i in a[1:]:
        ans[i-1] += 1

print(ans.count(n))
n,t=map(int,input().split())
x=[]
for i in range(n):
  c,d=map(int,input().split())
  if d<=t:
    x+=c
if x==[]:
  print('TLE')
else:
  print(min(x))
    


### FIXED CODE ###

n,t=map(int,input().split())
x=1234
for i in range(n):
  c,d=map(int,input().split())
  if d<=t:
    if c<=x:
      x=c
if x==1234:
  print('TLE')
else:
  print(x)
N = int(input())

if N%2==0: 
         print(N)
else:
         print(2 ＊ N)


### FIXED CODE ###

n = int(input())

if n%2==0:
    print(n)

else:
    print(2 * n)
import math
import copy
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

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

max=0
for i in range(N):
    x = copy.deepcopy(A)
    del x[i]
    c = gcd_list(x)
    if c >= max:
        max = c
print(max)


### FIXED CODE ###

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

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

AL=[0]*N
AR=[0]*N
for i in range(N):
    if i == 0:
        AL[0] = A[0]
        AR[0] = A[N-1]
    else:
        AL[i] = gcd(AL[i-1],A[i])
        AR[i] = gcd(AR[i-1],A[N-i-1])

max=0
for i in range(N):
    if i == 0:
        n_ex_gcd =  AR[N-2]
    elif i == N-1:
        n_ex_gcd = AL[N-2]
    else:
        n_ex_gcd = gcd(AL[i-1],AR[N-i-2])
    if n_ex_gcd > max:
        max = n_ex_gcd
print(max)
N, M = map(int, input().split())
all_dish = []

for n in range(N):
    K_n_list = list(map(int, input().split()))
    del K_n_list[0]
#    all_dish = [K_n_list_num for K_n_list_num in K_n_list]

   for K_n_list_num in K_n_list:
       all_dish.append(K_n_list_num)

prefer_dish = []
dish_kind = list(set(all_dish))
prefer_dish = [dish_kind_num for dish_kind_num in dish_kind if all_dish.count(dish_kind_num) == N]
#for dish_kind_num in dish_kind:
#    if all_dish.count(dish_kind_num) == N:
#        prefer_dish.append(dish_kind_num)

print(len(prefer_dish))

### FIXED CODE ###

N, M = map(int, input().split())
all_dish = []

for n in range(N):
    K_n_list = list(map(int, input().split()))
    del K_n_list[0]
    for K_n_list_num in K_n_list:
        all_dish.append(K_n_list_num)

prefer_dish = []
dish_kind = list(set(all_dish))
for dish_kind_num in dish_kind:
    if all_dish.count(dish_kind_num) == N:
        prefer_dish.append(dish_kind_num)

print(len(prefer_dish))
N,M=map(int,input().split(" "))

listing=[]
for i in range(M):
    a=list(map(int,input().split(" ")))
    listing.append(a)

#listing.sort()
#print(listing)
aa=list(map(list, set(map(tuple, listing))))
#aa.sort()


if(N==1 and aa[0][0]==1):
    print(aa[0][1])
    exit()
elif(N==1):
    print(0)
    exit()


a1=[]
a2=[]
for i in aa:
    a1.append(i[0])
    a2.append(i[0])
if(len(a1)!=len(set(a2))):
    print(-1)
    exit()

num=""
#print(aa)
digit=1
digit1=1
for i in range(N):
    for j in aa:
        if(j[0]==1 and j[1]==0):
            print(-1)
            exit()
        if(j[0]==digit):
            num+=str(j[1])
            digit1=digit+1
            break
    if(digit1==digit):
        if(digit==1):
            num+="1"
        else:
            num+="0"
    digit+=1
print(num)
            


### FIXED CODE ###

N,M=map(int,input().split(" "))

if(M==0):
    if(N==1):
        print(0)
    elif(N==2):
        print(10)
    elif(N==3):
        print(100)
    exit()



listing=[]

for i in range(M):
    a=list(map(int,input().split(" ")))
    listing.append(a)


aa=list(map(list, set(map(tuple, listing))))




a1=[]
a2=[]
for i in aa:
    a1.append(i[0])
    a2.append(i[0])
if(len(a1)!=len(set(a2))):
    print(-1)
    exit()

if(N==1 and aa[0][0]==1):
    print(aa[0][1])
    exit()
num=""
#print(aa)
digit=1
digit1=1
for i in range(N):
    digit1=digit
    for j in aa:
        if(j[0]==1 and j[1]==0):
            print(-1)
            exit()
        if(j[0]==digit):
            num+=str(j[1])
            digit1=digit+1
            break
    if(digit1==digit):
        if(digit==1):
            num+="1"
        else:
            num+="0"
    digit+=1
print(num)
s=input()
word='keyence'
basho=0
for i in s:
  if word[basho]==i:
    basho+=1
print('YES' if basho==7 else 'NO')

### FIXED CODE ###

s=input()
word='keyence'
flag=0
if s[:6]==word:
    flag=1
if s[-7:]==word:
    flag=1
for i in range(7):
    if s[:i]+s[-(7-i):]==word:
        flag=1
print('YES' if flag else 'NO')
s = input()
print(s[0] + len(s)-2 + s[-1]) 


### FIXED CODE ###

s = input()
print(s[0] + str(len(s)-2) + s[-1])
n = int(input())
l = list(map(int,input().split()))
s = 1
f = 1
x = 1000000000000000000
for i in l:
	s *= i
	if s>x:
      print(-1)
      f = 0
      break
if f==1:
  print(s)

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
s = 1
f = 1
x = 1000000000000000000
l.sort()
if l[0]==0:
  print(0)
elif l[0]==1 and l[-1]==1:
  print(1)
else:
  l = l[::-1]
  for i in l:
      s *= i
      if s>x:
          print(-1)
          f = 0
          break
  if f==1:
    print(s)
import math
n = int(input())
ln = int(math.log10(n))
if ln == 0:
  print(n)
else:
  a = n // (10 ** ln)
  b = a * (10 ** ln )- 1
  c = [int(x) for x in list(str(b))]

  print(sum(c))

### FIXED CODE ###

import math
n = int(input())
k = int(math.log10(n))

a = n // (10 ** k)
b = n % (10 ** k)

if k == 0:
  ans = n
elif n % 10 == 9:
  ans = k * 9 + a
else:
  ans = k * 9 + a -1

print(ans)
n,k = map(int,input().split())

if k%2==1:
    ans = (n//k)**3
else:
    even = n//k
    odd  = (2*n)//k - even
    ans = even**3 + odd**3
print(ans)

### FIXED CODE ###

K = int(input())
list = [i for i in range(1, K + 1)]
odd = list[1::2]
even = list[0::2]

cnt = 0

for i in odd:
    for j in even:
        cnt += 1

print(cnt)
A = int(input()) #500
B = int(input()) #100
C = int(input()) #50
X = int(input())
count = 0 //初期値
           
#全件走査


### FIXED CODE ###

A = int(input()) #500
B = int(input()) #100
C = int(input()) #50
X = int(input())
count = 0 #初期値
           
#全件走査
maxA = X // 500 if 500 * A > X else A
for i in range(maxA + 1):
  maxB = (X - 500 * i) // 100 if 100 * B > (X - 500 * i) else B
  for j in range(maxB + 1):
    q,mod = divmod (X - 500 * i - 100 * j ,50)
    if mod == 0 and q <= C:count += 1    
print(count)
N = raw_input()
N = int(N)

a = []
for i in range(N):
	s_input = input()
	s_input = int(s_input)
	if s_input in a:
		a.remove(s_input)
	else:
		a.append(s_input)

print(len(a))

### FIXED CODE ###

N = raw_input()
N = int(N)

num10 = N/10
num1 = N - num10*10

if num10 == 9 or num1 == 9:
	print('Yes')
else:
	print('No')