Harryxun/stf_run huggingface dataset:
import sys
input = sys.stdin.readline
from fractions import Fraction
def solve():
    N = int(input())
    AB = [tuple(map(int,input().split())) for i in range(N)]
    MOD = 10**9+7

    from collections import Counter
    ctr = Counter()
    az = bz = zz = 0
    for a,b in AB:
        if a==b==0:
            zz += 1
        elif a==0:
            az += 1
        elif b==0:
            bz += 1
        else:
            f = Fraction(a,b)
        ctr[f] += 1
    ans = pow(2,az,MOD) + pow(2,bz,MOD) - 1

    used = set()
    for f1,v in ctr.items():
        if f1 in used: continue
        f2 = -1/f1
        if f2 in ctr:
            used.add(f2)
        r = pow(2,v,MOD) + pow(2,ctr[f2],MOD) - 1
        ans *= r
        ans %= MOD
    ans += zz - 1
    ans %= MOD
    print(ans)
solve()

### FIXED CODE ###

import sys
input = sys.stdin.readline
from math import gcd
def solve():
    N = int(input())
    AB = [tuple(map(int,input().split())) for i in range(N)]
    MOD = 10**9+7

    from collections import Counter
    ctr = Counter()
    az = bz = zz = 0
    for a,b in AB:
        if a==b==0:
            zz += 1
        elif a==0:
            az += 1
        elif b==0:
            bz += 1
        else:
            g = gcd(a,b)
            a,b = a//g, b//g
            if b < 0:
                b *= -1
                a *= -1
            ctr[(a,b)] += 1
    ans = pow(2,az,MOD) + pow(2,bz,MOD) - 1

    used = set()
    for (a1,b1),v in ctr.items():
        if (a1,b1) in used: continue
        a2,b2 = -b1,a1
        if b2 < 0:
            b2 *= -1
            a2 *= -1
        if (a2,b2) in ctr:
            used.add((a2,b2))
        r = pow(2,v,MOD) + pow(2,ctr[(a2,b2)],MOD) - 1
        ans *= r
        ans %= MOD
    ans += zz - 1
    ans %= MOD
    print(ans)
solve()
N = int(input())
arr = [i for i in range(1, N + 1)]
# N == len(arr)
nums = N*[0]
for j in range(N):
    target = arr[j]
    num = 0
    while target % 2 == 0:
        num += 1
        target /= 2
    nums[j] = num
 
max_index = 0
for k in range(N):
    if nums[k] > max:
        max_index = k
 
print(arr[max_index])

### FIXED CODE ###

N = int(input())
arr = [i for i in range(1, N + 1)]
# N == len(arr)
nums = N*[0]
for j in range(N):
    target = arr[j]
    num = 0
    while target % 2 == 0:
        num += 1
        target /= 2
    nums[j] = num

# print(nums)

max = 0
for k in range(N):
    if nums[k] > max:
        max_index = k
        max = nums[k]
    elif N == 1:
        max_index=0
 
print(arr[max_index])
n = int( raw_input() )
A = map( int , raw_input().split() )
q = int( raw_input() )
m = map( int , raw_input().split() )

for i in range( len(A) + 1 ):
  def solve(i, m)
    if m == 0 or solve( i+1 , m ) or solve( i+1 , m-A[i] ):
      return yes
    if i >= n or m < 0:
      return no
   

### FIXED CODE ###

n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"
def main:
  s= raw_input().split()
  ab=abs(s[0]-s[1])
  bc=abs(s[1]-s[2])
  ac=abs(s[0]-s[2])
  
  if ac<=s[3]:
    print("Yes")
  else:
    if ab<=s[3] and bc<=s[3]:
      print("Yes")
    else:
      print("No")

### FIXED CODE ###

s= input().split()
ab=abs(int(s[0])-int(s[1]))
bc=abs(int(s[1])-int(s[2]))
ac=abs(int(s[0])-int(s[2]))

if ac<=int(s[3]):
  print("Yes")
else:
  if ab<=int(s[3]) and bc<=int(s[3]):
    print("Yes")
  else:
    print("No")
import numpy as np
from scipy.sparse.csgraph import dijkstra

def get_path(start, goal, pred):
    return get_path_row(start, goal, pred[start])

def get_path_row(start, goal, pred_row):
    path = []
    i = goal
    while i != start and i >= 0:
        path.append(i)
        i = pred_row[i]
    if i < 0:
        return []
    path.append(i)
    return path[::-1]
N, M = map(int,input().split())
g = [[np.inf]*(2*N) for _ in range(2*N)]
for i in range(M):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    g[a][b] = 1
    g[a][b+N] = 1
    g[a+N][b] = 1

ans = np.inf
d = dijkstra(g,return_predecessors=True)

for i in range(N):
    if d[0][i][i+N] != np.inf:
        if ans != np.inf and len(ans)+1 <= d[0][i][i+N]:
            continue
        path = get_path(i,i+N,d[1])[::-1][:-1]
        path = [node%N for node in path]
        if len(path)==len(set(path)):
            if ans==np.inf or len(ans) > len(path):
                ans = path

if ans != INF:
    print(len(ans))
    for i in range(len(ans)):
        print(ans[i]+1)
else:
    print(ans)

### FIXED CODE ###

import numpy as np
from scipy.sparse.csgraph import dijkstra

def get_path(start, goal, pred):
    return get_path_row(start, goal, pred[start])

def get_path_row(start, goal, pred_row):
    path = []
    i = goal
    while i != start and i >= 0:
        path.append(i)
        i = pred_row[i]
    if i < 0:
        return []
    path.append(i)
    return path[::-1]
N, M = map(int,input().split())
g = [[np.inf]*(2*N) for _ in range(2*N)]
for i in range(M):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    g[a][b] = 1
    g[a][b+N] = 1
    g[a+N][b] = 1

ans = np.inf
j = -1
d = dijkstra(g,return_predecessors=True)

for i in range(N):
    if d[0][i][i+N] < ans:
        ans = int(d[0][i][i+N])
        j = i

if ans != np.inf:
    path = get_path(j,j+N,d[1])[::-1][:-1]
    path = [node%N for node in path]
    print(ans)
    for node in path:
        print(node+1)
else:
    print(-1)
a , b = map(int,input().split())
if b>= a:
  print("safe")
elif :
  print("unsafe")

### FIXED CODE ###

s,w = map(int,input().split())
if w >= s :
  print("unsafe")
else:
  print("safe")
n = int(input())

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= int(i)
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(n)
  return table

a = [1]*(n+1)
for i in range(3,n+1,2):
    il = mymath.prime_decomposition(i)
    il_unique = list(set(il))
    ans = 1
    for j in il_unique:
        ans *= (il.count(j)+1)
    a[i] = max(a[i],ans)


print(a.count(8))

### FIXED CODE ###

n = int(input())

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= int(i)
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(n)
  return table

a = [1]*(n+1)
for i in range(3,n+1,2):
    il = prime_decomposition(i)
    il_unique = list(set(il))
    ans = 1
    for j in il_unique:
        ans *= (il.count(j)+1)
    a[i] = max(a[i],ans)


print(a.count(8))
import math

base = 998244353

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

fac = [1] * (n + 1)
rev = [1] * (n + 1)
for i in range(1, n + 1):
    fac[i] = fac[i - 1] * i % base
    rev[i] = pow(fac[i], base -2, base)



def comb(n,r):
    hoge = (fac[n] * rev[r] * rev[n - r] ) % base
    return hoge





count = 0

an = 0 

for an in range(n+1):
    if k - an * a < 0 or (k - an * a) % b != 0:
        continue
    bn = (k -an * a) // b
    if not 0 <= bn <= n:
        continue

    count += comb(n, an) * comb(n, bn) % base
    count %= base



print(count)







    



### FIXED CODE ###

import math


def digitSum(n):
    count = 0
    while n != 0:
        count += n % 10
        n //= 10
    return count


n =  int(input())


# 0が多くなるようにする
ans = digitSum(n)
if ans == 1:
    print(10)
else :
    print(ans)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)

def main():
    S = input()
    N = len(S)

    # S = [int(s) if s!="?" else -1 for s in S ]
    dp = [[0] * 13 for _ in range(N+1)]

    s = S[0]
    if s == "?":
        for j in range(10):
            dp[0][j] += 1
    else:
        dp[0][int(s)%13] += 1
    for i in range(1,N):
        s = S[i]
        if s == "?":
            X = range(10)
        else:
            X = [int(s)]

        for j in range(0,13):
            ten_j = j*10
            for x in X:
                k = (ten_j+x)%13
                dp[i][k] += dp[i-1][j]
                # print(i,j,k)

    # print(dp)
    print(dp[N-1][5] % (10**9+7))



if __name__ == "__main__":
  main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

def main():
    S = input()
    N = len(S)
    MOD = 10**9+7

    # S = [int(s) if s!="?" else -1 for s in S ]
    dp = [[0] * 13 for _ in range(N+1)]

    s = S[0]
    if s == "?":
        for j in range(10):
            dp[0][j] += 1
    else:
        dp[0][int(s)%13] += 1
    for i in range(1,N):
        s = S[i]
        if s == "?":
            for j in range(0,13):
                for x in range(10):
                    k = (j*10+x)%13
                    dp[i][k] += dp[i-1][j]
                    dp[i][k] %= MOD
        else:
            for j in range(0,13):
                k = (j*10+int(s))%13
                dp[i][k] += dp[i-1][j]
                dp[i][k] %= MOD


    print(dp[N-1][5])


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

def keta(m):
    an=0
    while m>0:
        an+=m%10
        m=m//10
    return an

ans=0
for i in range(1.n+1):
    j=keta(i)
    if j<=b and j>=a:
        ans+=1
print(ans)

### FIXED CODE ###

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

def keta(m):
    an=0
    while m>0:
        an+=m%10
        m=m//10
    return an

ans=0
for i in range(1,n+1):
    j=keta(i)
    if j<=b and j>=a:
        ans+=i
print(ans)
# メモ化再帰
import math
import numpy as np
import copy
from collections import defaultdict, Counter
from itertools import product
from bisect import bisect_left, bisect_right

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

INF = float("inf")

# 最小化問題なのでINFに初期化
dp = [ INF for _ in range(1000100) ]

def solve(i):
    # DPの値が更新されていたらそのまま
    if dp[i] < INF:
        return dp[i]

    # 足場0のコストは0
    if i == 0:
        return 0

    # dp[i]の計算
    res = INF
    ## 足場i-1から来た場合
    res = min(res, solve(i-1) + abs(h[i] - h[i-1]))
    ## 足場i-2から来た場合
    if i > 1:
        res = min(res, solve(i-2) + abs(h[i] - h[i-2]))

    # メモ
    dp[i] = res

    return res

N = int(input())
h = inpl()

print(solve(N-1))

### FIXED CODE ###

import math
import numpy as np
import copy
from collections import defaultdict, Counter
from itertools import product
from bisect import bisect_left, bisect_right

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

N = int(input())
h = inpl()

INF = 10e11

# 最小化問題なのでINFに初期化
dp = [ INF for _ in range(100010) ]

# 初期状態
dp[0] = 0

# ループ
for i in range(1, N):
    dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
    if i > 1:
        dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))

print(dp[N-1])
a,b=(int(i) for i in input().split())
if a<=5:
  print 0
elif a<12:
  print b/2
else:
  print b


### FIXED CODE ###

a,b=(int(i) for i in input().split())
if a<=5:
  print(0)
elif 5<a<=12:
  print(b//2)
else:
  print(b)
import sys
input = sys.stdin.readline
s = input()
S = [int(s[i]) for i in range(len(s))]
# print(S)
count = 0
before = 0
while 1:
    #print("S:", S)
    is_continue = False
    # print(len(S))
    #deleted = False
    for i in range(max([before, 0]), len(S) - 1):
        #print(before, i)
        #print(S[i], S[i + 1])
        # print(S)
        if S[i] != S[i + 1]:
            # print(count)
            del S[i]
            del S[i]
            count += 2
            is_continue = True
            before = i - 2
            #deleted = True
            break
    if not is_continue:
        break
print(count)


### FIXED CODE ###

S=list(input())
ans=0

print(len(S)-abs(S.count('0')-S.count('1')))
import collections

s = input()
t = input()
c1 = collections.Counter(s)
c2 = collections.Counter(t)
s_values = sorted(list(c1.values()))
t_values = sorted(list(c2.values()))

if len(s) == len(t):
  if len(list(set(s))) == len(list(set(t))):
    if s_values == v_values():
      print("Yes")
    else:
      print("No")
  else:
    print("No")
else:
  print("No")

### FIXED CODE ###

import collections

s = input()
t = input()
c1 = collections.Counter(s)
c2 = collections.Counter(t)
s_values = sorted(list(c1.values()))
t_values = sorted(list(c2.values()))

if len(s) == len(t):
  if len(list(set(s))) == len(list(set(t))):
    if s_values == t_values:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
else:
  print("No")
# coding: utf-8


def main():
    
    takahashi_cookie, aoki_cookie, action_count = map(int, input().split(' '))

    if action_count > takahashi_cookie:
        takahashi_result = 0
        aoki_result = aoki_cookie - (action_count - takahashi_cookie)
    elif action_count < takahashi_cookie:
        takahashi_result = takahashi_cookie - action_count
        aoki_result = aoki_result
    elif action_count >= (takahashi_cookie + aoki_cookie):
        takahashi_result = 0
        aoki_result = 0
        
    print(takahashi_result, aoki_result)

    return 0
    

if __name__ == '__main__':
    main()


### FIXED CODE ###

#coding:utf-8
 
 
def main():
    list1  = list(map(int, input().split(' '))) 
    a, b, k = list1
  
    if a > k:
        a = a - k
      
    elif a + b >= k:
        b = b - (k - a)
        a = 0
        
    else:
        a = 0
        b = 0
        
    print(a, b)
  
    return 0
 
 
if __name__ == '__main__':
    main()
x = int(input())
a = []
for i in range(-50, 50):
  for j in range(-50, 50):
    if i**5 - j**5 == x:
      a.append([i, j])
      break
      
print(*a[0])

### FIXED CODE ###

x = int(input())
a = []
for i in range(-200, 200):
  for j in range(-200, 200):
    if i**5 - j**5 == x:
      a.append([i, j])
      break
      
print(*a[0])
import math

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

#最小公倍数a * b / gcd(a, b)
kobaisu=C//math.gcd(C,D)*D


ans=B -(B//C+B//D-B//kobaisu)

ans2=(A-1)-((A-1)//C +(A-1)//D - (A-1)//kobaisu)

print(int(ans-ans2))

### FIXED CODE ###

import fractions

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


kobaisu=C//fractions.gcd(C,D)*D


ans=B -(B//C+B//D-B//kobaisu)

ans2=(A-1)-((A-1)//C +(A-1)//D - (A-1)//kobaisu)

print(int(ans-ans2))
n=int(input())
a=[0]*10
#print(a)
m=list(map(int,input().split()))
#print(m)
for i in range(n):
    a[m[i]-1]=i+1
for i in range(n):
    print(a[i],end=" ")
    

### FIXED CODE ###

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

fib_l = [-1] * (n+1)

def fib(step):
    if step < 0:
        return 0
    if fib_l[step] != -1:
        return fib_l[step]
    if 0 <= step <= 1:
        return 1
    else:
        t = fib(step-1) + fib(step-2)
        fib_l[step] = t
        return t

ret = 1
for i in range(m+1):
    ret *= fib(a[i+1] - a[i] - 2)
print(ret % 1000000007)

### FIXED CODE ###

n, m = [int(i) for i in input().split()]
a = [-1] + [int(input()) for _ in range(m)] + [n+1]

fib_l = [-1] * (n+3)

def make_fib(n):
    fib_l[0] = fib_l[1] = 1
    for i in range(2, n):
        fib_l[i] = fib_l[i-1] + fib_l[i-2]

make_fib(n+3)
ret = 1
for i in range(m+1):
    t = a[i+1] - a[i] - 2
    if t < 0:
        ret = 0
        break
    ret *= fib_l[t]
print(ret % 1000000007)
n, h, w = [int(i) for i in input().split()]
print(sum(h <= a and w <= b for a, b in ([int(i) for i in input().split()] for _ in range(n))))

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
m = max([a, b, c, d, e])
n = min([a, b, c, d, e])
print('Yay!' if k >= (m - n) else ':(')
H , W = map(int,input().split())
stage = list(list(input()) for _ in range(H))

dx = [0,1,0,-1]
dy = [1,0,-1,0]
for i in range(H):
    for j in range(W):
        if stage[i][j] == ".":
            continue
        Flag = True
        for k in range(4):
            if 0 <= i + dx[k] < W and 0 <= j + dy[k] < H  and stage[i + dx[k]][j + dy[k]] == "#":
                Flag = False
                break
        if Flag:
            print("No")
            exit()
print("Yes")

### FIXED CODE ###

H , W = map(int,input().split())
stage = list(list(input()) for _ in range(H))

dx = [0,1,0,-1]
dy = [1,0,-1,0]
for i in range(H):
    for j in range(W):
        if stage[i][j] == ".":
            continue
        Flag = True
        for k in range(4):
            if 0 <= j + dx[k] < W and 0 <= i + dy[k] < H and stage[i + dy[k]][j + dx[k]] == "#":
                Flag = False
                break
        if Flag:
            print("No")
            exit()
print("Yes")
N=int(input())
a=list(map(int,input().split()))
sum_=1
for i in range(N):
    while sum_ < 10**18:
        sum_ *= a[i]
        if sum_ > 10**18:
            sum_ =-1
        break
        if sum_ = 0:
            break
print(sum_)

### FIXED CODE ###

N=int(input())
a=list(map(int,input().split()))
sum_=1
if 0 in a:
    print (0)
else:
    for i in range(N):
        sum_ *= a[i]
        if sum_> 10**18:
            sum_ =-1
            break
    print(sum_)
N,M =  map(int,input().split())
A = list(map(int,input().split()))
ans = N
for i in range(M):
  ans = ans - A[i]
if ans < 0:
  print(-1)
else
	print(ans)

### FIXED CODE ###

def resolve():
    N,M =  map(int,input().split())
    A = list(map(int,input().split()))
    ans = N
    for i in range(M):
        ans = ans - A[i]
    if ans < 0:
        print(-1)
    else:
        print(ans)
resolve()
#132 12:55
n,k=map(int,input().split())
def C(i,j):
    def a(n):
        b=1
        if n==0:
            return 1
        else:
            for x in range(1,n+1):
                b=b*x
            return b
    return int(a(i)/(a(j)*a(i-j)))

answer=[]
for i in range(1,k+1):
    if n-k-i+1<0:
        answer.append(0)
    else:
        answer.append( C(k-1,i-1)*C(n-k+1,i) )
for i in range(k):
    print(answer[i]%(7+10**9))


### FIXED CODE ###

N, K = map(int, input().split())
R = N-K
RR = R-1
mod = 10**9+7

def nCr(n,r):
    K = 1
    for j in range(1,r+1):
        K = K*(n+1-j)//j
    return K

    
for i in range(K):
    ans = (nCr(K-1,i)%mod)*(nCr(N-K+1,i+1)%mod)
    ans = ans%mod
    print(ans)
import sys
s=str(input())
s=list(s)
x,y=map(int,input().split())
fora=0
side=[]
updw=[]
while s[0]=="F":
  fora+=1
  s.pop(0)
flag=1#1のとき横向き、-1のときたて向き
step=0
while s:
  if s[0]=="T":
    s.pop(0)
    if flag==-1: updw+=[step]
    else: side+=[step]
    flag=flag*(-1)
    step=0
  else:
    s.pop(0)
    if len(s)==0:
      if flag==-1: updw+=[step]
      else: side+=[step]
    step+=1
yoko,tate=fora,0
ypossi=len(side)
tpossi=len(updw)
for i in range(1<<len(side)):
  yoko1=yoko
  for j in range(len(side)):
    if (1<<j &i):yoko1+=side[j]
    else :yoko1-=side[j]
  if yoko1==x: break
else: 
  print("No")
  sys.exit()
for i in range(1<<len(updw)):
  tate1=tate
  for j in range(len(updw)):
    if (1<<j &i):tate1+=updw[j]
    else :tate1-=updw[j]
  if tate1==y:
    print("Yes")
    break
else: 
  print("No")
  sys.exit()

### FIXED CODE ###

S=str(input())
s=list(S)
x,y=map(int,input().split())
fora=0
side=[]
updw=[]
while s[0]=="F":
  fora+=1
  s.pop(0)
  if len(s)==0:break
flag=1#1のとき横向き、-1のときたて向き
step=0
while s:
  if s[0]=="T":
    s.pop(0)
    if step:
      if flag==-1: updw+=[step]
      else: side+=[step]
    flag=flag*(-1)
    step=0
  elif s[0]=="F":
    s.pop(0)
    step+=1
    if len(s)==0:
      if flag==-1: updw+=[step]
      else: side+=[step]
  else: break
ypossi=len(side)
tpossi=len(updw)
X=sum(side)+fora+abs(x)
Y=sum(updw)+abs(y)
xdp=[[0 for i in range(2*X+1)] for j in range(ypossi+1)]
#dp[i][j] i個文字使ったときにj+len(s)は達成できるか
xdp[0][fora+X]=1 
for i in range(ypossi):
  for j in range(2*X+1):
    if j-side[i]>=0:
      if xdp[i][j-side[i]]==1:xdp[i+1][j]=1
    if j+side[i]<2*X+1:
      if xdp[i][j+side[i]]==1:xdp[i+1][j]=1

ydp=[[0 for i in range(2*Y+1)] for j in range(tpossi+1)]
#dp[i][j] i個文字使ったときにj+len(s)は達成できるか
ydp[0][Y]=1 
for i in range(tpossi):
  for j in range(2*Y+1):
    if j-updw[i]>=0:
      if ydp[i][j-updw[i]]==1:ydp[i+1][j]=1
    if j+updw[i]<2*Y+1:
      if ydp[i][j+updw[i]]==1:ydp[i+1][j]=1
if xdp[ypossi][x+X]==1 and ydp[tpossi][y+Y]==1:
  print("Yes")
else: print("No")
from itertools import accumulate

n = int(input())
a = [[0] * 10 for _ in range(10)]
for x1, y1, x2, y2 in (map(int, input().split()) for _ in range(n)):
    a[x1][y1] += 1
    a[x1][y2] -= 1
    a[x2][y1] -= 1
    a[x2][y2] += 1
print(max(map(max, map(accumulate, zip(*map(accumulate, a))))))

### FIXED CODE ###

from itertools import accumulate

n = int(input())
a = [[0] * 1001 for _ in range(1001)]
for x1, y1, x2, y2 in (map(int, input().split()) for _ in range(n)):
    a[x1][y1] += 1
    a[x1][y2] -= 1
    a[x2][y1] -= 1
    a[x2][y2] += 1
print(max(map(max, map(accumulate, zip(*map(accumulate, a))))))
from sys import stdin
N=(stdin.readline().rstrip())
for i in range(7):
    mae="keyence"[0:i+1]
    if re.match("%s.*%s"%(mae, ato),N):
        print("YES")
        break
if i==6:
    print("NO")

### FIXED CODE ###

import re
from sys import stdin
N=(stdin.readline().rstrip())
for i in range(7):
    mae="keyence"[0:i+1]
    ato="keyence"[i+1:8]
    if re.search(".*keyencekeyence",N):
        if (re.sub('.*keyencekeyence', '', N)=="")==True:
            print("YES")
            break
    if re.search("keyencekeyence.*",N):
        if (re.sub('keyencekeyence.*', '', N)=="")==True:
            print("YES")
            break
    if (re.sub('.*keyence', '', N)=="")==True:
        print("YES")
        break
    if (re.sub('keyence.*', '', N)=="")==True:
        print("YES")
        break
    if re.match("%s.*%s"%(mae, ato),N):
        if (re.sub('%s.*%s'%(mae,ato) ,"", N)=="")==True:
            print("YES")
            break
if i==6:
    print("NO")
n=int(input())
a=int(input())
n//500=m
if m<=a:
    print("Yes")
else :
    print("No")


### FIXED CODE ###

n=int(input())
a=int(input())

if n<500:
    if n<=a:
        print("Yes")
    else:
        print("No")
elif n>500 and (n%500)<=a:
    print("Yes")
else :
    print("No")
ABCDE = []
for i in range(5):
    ABCDE.append(int(input()))
K = int(input())

out = 0
for i in range(5):
    for j in range(i+1,5):
        if ABCDE[j] - ABCDE[i] > K:
            out += 1
            break

print(['Yay!',':('][out])

### FIXED CODE ###

ABCDE = []
for i in range(5):
    ABCDE.append(int(input()))
K = int(input())

out = 0
for i in range(5):
    for j in range(i+1,5):
        if ABCDE[j] - ABCDE[i] > K:
            out += 1
            break

if out == 0:
    print('Yay!')
else:
    print(':(')
import sys
input = sys.stdin.readline

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

dp = [None] * N
for n in range(N):
    if n == 0:
        min_num = 0
    else:
        l = min(n, K)
        min_num = 10 ** 10
        for k in range(1, l + 1):
            min_num = min(abs(A[n] - A[n - k]) + dp[n - k], min_num)
    dp[n] = min_num

print(dp[-1])


### FIXED CODE ###

import sys

N, K = map(int, sys.stdin.readline().split())
A = list(map(int, sys.stdin.readline().split()))

dp = [0] + [None] * (N - 1)
for n, a in enumerate(A):
    if n:
        l = max(0, n - K)
        dp[n] = min(abs(a - a2) + d for a2, d in zip(A[l : n], dp[l : n]))

print(dp[-1])
import sys
n, m = list(map(int, input().split()))
res = [list(map(int, input().split())) for _ in range(m)]

ans = [-1 for _ in range(n)]

for r in res:
	if ans[r[0] - 1] >= 0:
		if ans[r[0] - 1] != r[1]:
			print(-1)
			sys.exit()
	ans[r[0] - 1] = r[1]

flag = 0
for i in range(3):
	if ans[i] == -1:
		if flag:
			ans[i] = 0
		else:
			ans[i] = 1
	else:
		flag = 1


print("".join([str(a) for a in ans]))

### FIXED CODE ###

import sys
n, m = list(map(int, input().split()))
res = [list(map(int, input().split())) for _ in range(m)]

ans = [-1 for _ in range(n)]



if n == 1:
	tmp = 0
	for i in range(m):
		tmp += res[i][1]
	if tmp == 0:
		print(0)
		sys.exit()

for r in res:
	if ans[r[0] - 1] >= 0:
		if ans[r[0] - 1] != r[1]:
			print(-1)
			sys.exit()
	ans[r[0] - 1] = r[1]

#print(res)
#print(ans)
flag = 0
for i in range(n):
	if ans[i] == -1:
		if flag:
			ans[i] = 0
		else:
			ans[i] = 1
	if i == 0 and ans[i] == 0:
		print(-1)
		sys.exit()
	else:
		flag = 1


print("".join([str(a) for a in ans]))