Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02743 (python)

Fixed submission:
from math import sqrt
from decimal import Decimal, getcontext

a, b, c = map(int, input().split())
if c - a - b > 0 and (c - a - b) ** 2 > 4 * a * b:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
from math import sqrt, isclose

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

if isclose(sqrt(c) - (sqrt(a) + sqrt(b)), 0):
    print("Yes")
else:
    print("No")
Problem p02786 (python)

Fixed submission:
from math import log, floor

H = int(input())

a = 0
for i in range(floor(log(H, 2)) + 1):
    a += 2 ** i
print(a)

Buggy submission (verdict: Runtime Error):
from math import log2, floor

H = int(input())

a = 0
for i in range(floor(log2(H)) + 1):
    a += 2 ** i
print(a)
Problem p02803 (python)

Fixed submission:

from itertools import chain

H, W = map(int, input().split())
M = [list(input()) for _ in range(H)]
inf = float('inf')

def flatten(list_of_lists):
    "Flatten one level of nesting"
    return chain.from_iterable(list_of_lists)


def bfs(start, end):
    distance = [[inf for i in range(W)] for j in range(H)]
    queue = [(end, start)]
    distance[end][start] = 0

    while queue:
        y, x = queue.pop()
        for i in range(0, 4):
            nx, ny = x + [1, 0, -1, 0][i], y + [0, 1, 0, -1][i]
            if 0 <= nx < W and 0 <= ny < H and M[ny][nx] != '#' and distance[ny][nx] == inf:
                queue.insert(0, (ny, nx))
                distance[ny][nx] = distance[y][x] + 1
    return distance


m = 0
for i in range(W):
    for j in range(H):
        if M[j][i] != "#":

            for length in list(flatten(bfs(i, j))):
                if length != inf and m < length:
                    m = length

print(m)

Buggy submission (verdict: Runtime Error):
from collections import deque
from itertools import chain

H, W = map(int, input().split())
M = [list(input()) for _ in range(H)]
inf = float('inf')


def flatten(list_of_lists):
    return chain.from_iterable(list_of_lists)


def bfs(start, end):
    distance = [[inf for i in range(W)] for j in range(H)]
    queue = deque((end, start))
    distance[end][start] = 0

    while queue:
        y, x = queue.pop()
        for i in range(0, 4):
            nx, ny = x + [1, 0, -1, 0][i], y + [0, 1, 0, -1][i]
            if 0 <= nx < W and 0 <= ny < H and M[ny][nx] != '#' and distance[ny][nx] == inf:
                queue.insert(0, (ny, nx))
                distance[ny][nx] = distance[y][x] + 1
    return distance


m = 0
for i in range(W):
    for j in range(H):
        if M[j][i] != "#":

            for length in list(flatten(bfs(i, j))):
                if length != inf and m < length:
                    m = length

print(m)

Buggy submission (verdict: Runtime Error):
from math import inf
from itertools import chain

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


def flatten(list_of_lists):
    "Flatten one level of nesting"
    return chain.from_iterable(list_of_lists)


def bfs(start, end):
    distance = [[inf for i in range(W)] for j in range(H)]
    queue = [(end, start)]
    distance[end][start] = 0

    while queue:
        y, x = queue.pop()
        for i in range(0, 4):
            nx, ny = x + [1, 0, -1, 0][i], y + [0, 1, 0, -1][i]
            if 0 <= nx < W and 0 <= ny < H and M[ny][nx] != '#' and distance[ny][nx] == inf:
                queue.insert(0, (ny, nx))
                distance[ny][nx] = distance[y][x] + 1
    return distance


m = 0
for i in range(W):
    for j in range(H):
        if M[j][i] != "#":

            for length in list(flatten(bfs(i, j))):
                if length != inf and m < length:
                    m = length

print(m)
Problem p02844 (python)

Fixed submission:
N = int(input())
S = input()

targets = tuple("{:0>3}".format(i) for i in range(1000))
ans = []
for target in targets:
    a, b, c = target
    a_index = S.find(a)
    b_index = S.find(b, a_index + 1)
    c_index = S.find(c, b_index + 1)
    ret = (a_index, b_index, c_index)
    if -1 not in ret:
        # print(target, ret)
        ans.append(ret)
print(len(ans))

Buggy submission (verdict: Runtime Error):
from itertools import permutations, compress

N = int(input())
S = input()

targets = tuple(f"{i:0>3}" for i in range(1000))
ans = []
for target in targets:
    a, b, c = target
    a_index = S.find(a)
    b_index = S.find(b, a_index + 1)
    c_index = S.find(c, b_index + 1)
    ret = (a_index, b_index, c_index)
    if -1 not in ret:
        # print(target, ret)
        ans.append(ret)
print(len(ans))
Problem p02900 (python)

Fixed submission:
from fractions import gcd


def prime_factorize(n):
    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)
    return a


A, B = tuple(map(int, input().split(" ")))

print(len(set(prime_factorize(gcd(A, B)))) + 1)

Buggy submission (verdict: Runtime Error):
from math import gcd


def prime_factorize(n):
    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)
    return a


A, B = tuple(map(int, input().split(" ")))

print(len(set(prime_factorize(gcd(A, B)))) + 1)
Problem p03126 (python)

Fixed submission:
N, M = map(int, input().split())
favorites = set(i for i in range(1, M + 1))
for _ in range(N):
    K, *fav = map(int, input().split())
    favorites = favorites & set(fav)
print(len(favorites))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
favorites = {*tuple(range(1, M + 1))}
for _ in range(N):
    K, *fav = map(int, input().split())
    favorites = favorites & set(fav)
print(len(favorites))
Problem p03545 (python)

Fixed submission:
from itertools import product

A, B, C, D = input()
for op1, op2, op3 in product("+-", repeat=3):
    expr = "{}{}{}{}{}{}{}".format(A, op1, B, op2, C, op3, D)
    if eval(expr) == 7:
        print("{}{}{}{}{}{}{}=7".format(A, op1, B, op2, C, op3, D))
        break

Buggy submission (verdict: Runtime Error):
from itertools import product

A, B, C, D = input()
for op1, op2, op3 in product("+-", repeat=3):
    expr = f"{A}{op1}{B}{op2}{C}{op3}{D}"
    if eval(expr) == 7:
        print(f"{A}{op1}{B}{op2}{C}{op3}{D}=7")
        break
Problem p03633 (python)

Fixed submission:
from fractions import gcd
from functools import reduce


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


N = int(input())
T = list(int(input()) for _ in range(N))

print(reduce(lcm, T))

Buggy submission (verdict: Runtime Error):
from math import gcd
from functools import reduce


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


N = int(input())
T = list(int(input()) for _ in range(N))

print(reduce(lcm, T))
Problem p03759 (python)

Fixed submission:
a, b, c = map(int, input().split(" "))

print("YES" if b - a == c - b else "NO")

Buggy submission (verdict: Runtime Error):
a, b, c = input().split(" ")

print("YES" if b - a == c -b else "NO")
Problem p03998 (python)

Fixed submission:
from collections import deque

A = deque(input())
B = deque(input())
C = deque(input())

current = "a"

while True:
    if current == "a":
        current = A.popleft()
    elif current == "b":
        current = B.popleft()
    elif current == "c":
        current = C.popleft()
    if current == "a" and len(A) == 0:
        print("A")
        break
    elif current == "b" and len(B) == 0:
        print("B")
        break
    elif current == "c" and len(C) == 0:
        print("C")
        break

Buggy submission (verdict: Runtime Error):
from collections import deque

A = deque(input())
B = deque(input())
C = deque(input())

current = A.popleft()

while True:
    if current == "a":
        current = A.popleft()
    elif current == "b":
        current = B.popleft()
    elif current == "c":
        current = C.popleft()
    if current == "a" and len(A) == 0:
        print("A")
        break
    elif current == "b" and len(B) == 0:
        print("B")
        break
    elif current == "c" and len(C) == 0:
        print("C")
        break
Problem p02630 (python)

Fixed submission:
n=int(input())
c=list(map(int,input().split()))
q=int(input())
su=0
d=[]
for i in range(1000003):
	d.append(0)
for i in range(len(c)):
	d[c[i]]=d[c[i]]+1
	su=su+c[i]
for j in range(q):
	r,s=map(int,input().split())
	su=su-d[r]*r+d[r]*s
	d[s]=d[s]+d[r]
	d[r]=0
	print(su)

Buggy submission (verdict: Runtime Error):
n=int(input())
c=list(map(int,input().split()))
q=int(input())
su=0
w={}
for i in range(len(c)):
	su=su+c[i]
	if(c[i] not in w):
		w[c[i]]=1
	else:
		w[c[i]]=w[c[i]]+1
for j in range(q):
	r,s=map(int,input().split())
	count=w[r]
	if(s in w):
		w[s]=w[s]+count
	else:
		w[s]=count
	su=su-count*r+count*s
	print(su)
Problem p02657 (python)

Fixed submission:
a,b=map(int,input().split())
print(a*b)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=list(map(int,input().split()))
print(b)
c=1
for i in range(a):
  c=c*b[i]
if(c>1000000000000000000):
  print(-1)
else:
  print(c)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=list(map(int,input().split()))
c=1
for i in range(a):
  c=c*b[i]
if(c>1000000000000000000):
  print(-1)
else:
  print(c)
Problem p02657 (python)

Fixed submission:
a, b = map(int, input().split())
print(a*b)

Buggy submission (verdict: Runtime Error):
list_a=list(map(int, input().split()))
result=1
for a in range(list_a):
  result = result*a
  
if result > 10**18:
  print('-1')
else:
  print(result)
Problem p02696 (python)

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

x = min(b - 1, n)
ans = int(a * x / b)

#if a == 1 or b == 1 or b == n:
#    print(0)
#else:
print(ans)

Buggy submission (verdict: Runtime Error):
a, b, n = map(int, input().split())

x = min(b. n)
print(int(a * x / b))
Problem p02713 (python)

Fixed submission:
import math
from functools import reduce

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

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

n = int(input())

sum_ = 0
for a in range(1, n+1):
  for b in range(1, n+1):
    for c in range(1, n+1):
      sum_ += gcd(a, b, c)
    
print(sum_)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())

sum_ = 0
for a in range(1, n+1):
  for b in range(1, n+1):
    for c in range(1, n+1):
      sum_ += math.gcd(a, b, c)
    
print(sum_)
Problem p02732 (python)

Fixed submission:
#!/usr/bin/env python3
import collections as cl
from math import factorial

def comb(n, r):
    if n >= r:
        return factorial(n) // (factorial(n - r) * factorial(r))
    else:
        return 0
  
n = int(input())
a = list(map(int, input().split()))

clc = cl.Counter(a)

# 1. 数字が等しいペアを選ぶ総数
npair = 0
for (k, v) in clc.items():
    npair += comb(v, 2)

# 2. (取り除いた数字と同じ数字を選ぶ総数) - (1)
for a_ in a:
    print(npair - (clc[a_] - 1))

Buggy submission (verdict: Runtime Error):
import collections as cl
from math import factorial

def comb(n, r):
  if n >= r:
    return int(factorial(n) / factorial(r) / factorial(n - r))
  elif n == 1:
      return 1
  else:
    return 0
  
n = int(input())
a = list(map(int, input().split()))

clc = cl.Counter(a)

# 1. 数字が等しいペアを選ぶ総数
npair = 0
for (k, v) in clc.items():
  npair += comb(v, 2)

# 2. (取り除いた数字と同じ数字を選ぶ総数) - (1)
for a_ in a:
  print(npair - (clc[a_] - 1))

Buggy submission (verdict: Runtime Error):
import collections as cl
from math import factorial

def comb(n, r):
  if n >= r:
    return int(factorial(n) / factorial(r) / factorial(n - r))
  elif n == 1:
      return 1
  else:
    return 0
  
n = int(input())
a = list(map(int, input().split()))

clc = cl.Counter(a)

# 1. 数字が等しいペアを選ぶ総数
npair = 0
for (k, v) in clc.items():
  npair += comb(v, 2)

# 2. (取り除いた数字と同じ数字を選ぶ総数) - (1)
for a_ in a:
  print(npair - (clc[a_] - 1))

Buggy submission (verdict: Runtime Error):
import collections as cl
from math import factorial

def comb(n, r):
  if n >= r:
    return int(factorial(n) / factorial(r) / factorial(n - r))
  elif n == 1:
      return 1:
  else:
    return 0
  
n = int(input())
a = list(map(int, input().split()))

clc = cl.Counter(a)

# 1. 数字が等しいペアを選ぶ総数
npair = 0
for (k, v) in clc.items():
  npair += comb(v, 2)

# 2. (取り除いた数字と同じ数字を選ぶ総数) - (1)
for a_ in a:
  print(npair - (clc[a_] - 1))

Buggy submission (verdict: Runtime Error):
import collections as cl
from math import factorial

def comb(n, r):
  if n >= r:
    return int(factorial(n) / factorial(r) / factorial(n - r))
  elif:
    n == 1:
      return 1:
  else:
    return 0
  
n = int(input())
a = list(map(int, input().split()))

clc = cl.Counter(a)

# 1. 数字が等しいペアを選ぶ総数
npair = 0
for (k, v) in clc.items():
  npair += comb(v, 2)

# 2. (取り除いた数字と同じ数字を選ぶ総数) - (1)
for a_ in a:
  print(npair - (clc[a_] - 1))

Buggy submission (verdict: Runtime Error):
import collections as cl
from math import factorial

def comb(n, r):
  if n >= r:
    return int(factorial(n) / factorial(r) / factorial(n - r))
  else:
    return 0
  
n = int(input())
a = list(map(int, input().split()))

clc = cl.Counter(a)

# 1. 数字が等しいペアを選ぶ総数
npair = 0
for (k, v) in clc.items():
  npair += comb(v, 2)

# 2. (取り除いた数字と同じ数字を選ぶ総数) - (1)
for a_ in a:
  print(npair - (clc[a_] - 1))
Problem p02756 (python)

Fixed submission:
s  = input()
n  = int(input())

s_mae = ''
s_ato = s

for _ in range(n):
    ipt = input()

    if ipt[0] == '1':
        s_mae, s_ato = s_ato, s_mae
    else:
        _, id_, s_ = ipt.split()
        is_head = True if id_ == '1' else False
        if is_head:
            s_mae += s_
        else:
            s_ato += s_

print(s_mae[::-1] + s_ato)

Buggy submission (verdict: Runtime Error):
s  = input()
n  = int(input())

is_seiichi = True
s_head_append = ''

for _ in range(n):
    ipt = input()

    if ipt[0] == '1':
        is_seiichi = not is_seiichi
    else:
        _, id_, s_ = ipt.split()
        is_head = True if id_ == '1' else False
        if is_seiichi ^ is_head:
            #s = s + s_
            s_head_append += s
        else:
            s = s_ + s_head_append + s
            s_head_append = ''

print(s + s_head_append if is_seiichi else s_head_append[::-1] + s[::-1])
Problem p02780 (python)

Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
n, k  = map(int, input().split())
p  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

q = sum(p[:k])
max_ = (q, 0, k)
for i in range(k, n):
    q = q + p[i] - p[i-k]
    if max_[0] < q:
        max_ = (q, i-k+1, i+1)

ans = 0
for p_ in p[max_[1]:max_[2]]:
    ans += 1 + (p_ - 1) * 0.5

#print(max_)
print(ans)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import numpy as np
 
n, k = map(int, input().split())
p = list(map(int, input().split()))

E = lambda x: 1 + (x - 1) * 0.5
p = [E(p_) for p_ in p]
q = np.cumsum(p)
sum_ = [q[i+k] - q[i] for i in range(n-k)]
print(max(sum_))

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import numpy as np
 
n, k = map(int, input().split())
p = list(map(int, input().split()))

E = lambda x: 1 + (x - 1) * 0.5
p = [E(p_) for p_ in p]
q = np.cumsum(p)
sum_ = [q[i+k] - q[i] for i in range(n-k)]
print(max(sum_))

Buggy submission (verdict: Runtime Error):
# A = input()
# A = int(input())
# A = map(int, input().split())
# A = list(map(int, input().split()))
# A = [int(input()) for i in range(N)]
#
# c = collections.Counter()

import collections

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

ma = sum(p[:K])
idx = 0

kukan = [sum(p[i:i+K]) for i in range(N-K)]
idx = kukan.index(max(kukan))

ans = 0
for i in range(K):
  ans += (0.5 * (p[idx+i]-1) + 1)

print(ans)

Buggy submission (verdict: Runtime Error):
# A = input()
# A = int(input())
# A = map(int, input().split())
# A = list(map(int, input().split()))
# A = [int(input()) for i in range(N)]
#
# c = collections.Counter()

import collections

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

ma = sum(p[:K])
idx = 0

kukan = [sum(p[i:i+K]) for i in range(N-K)]
idx = kukan.index(max(kukan))

ans = 0
for i in range(K):
  ans += sum(list(range(1, p[idx+i]+1)))/p[idx+i]

print(ans)
Problem p02837 (python)

Fixed submission:
#!/usr/bin/env pypy3
import collections
import itertools as it
import math
#import numpy as np
 
n  = int(input())
#  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))i
xy = []
for _ in range(n):
    a = int(input())
    xy.append([tuple(map(int, input().split())) for _ in range(a)])
#
# c = collections.Counter()

for i in range(2 ** n): # 嘘つき・正直者の総当り
    is_honest = [not(bool(int(s))) for s in list('{:015b}'.format(i)[-n:])]
    is_ok = True
    for i, h in enumerate(list(is_honest)): # 人の総当り
        for x, y in xy[i]: # 証言の総当り
            if is_honest[i] == False:
                continue

            x = x - 1
            v = bool(int(y))
            
            #print(is_honest[x], bool(y), v, )
            if is_honest[x] == v:
                pass
            else:
                is_ok = False
    
    if is_ok:
        i#print(is_honest)
        print(sum(is_honest))
        break

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env pypy3
import collections
import itertools as it
import math
#import numpy as np
 
n  = int(input())
#  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))i
xy = []
for _ in range(n):
    a = int(input())
    xy.append([tuple(map(int, input().split())) for _ in range(a)])
#
# c = collections.Counter()

for i in range(2 ** n): # 嘘つき・正直者の総当り
    is_honest = [not(bool(int(s))) for s in list(f'{i:015b}'[-n:])]
    is_ok = True
    for i, h in enumerate(list(is_honest)): # 人の総当り
        for x, y in xy[i]: # 証言の総当り
            if is_honest[i] == False:
                continue

            x = x - 1
            v = bool(int(y))
            
            #print(is_honest[x], bool(y), v, )
            if is_honest[x] == v:
                pass
            else:
                is_ok = False
    
    if is_ok:
        i#print(is_honest)
        print(sum(is_honest))
        break
Problem p02843 (python)

Fixed submission:
import collections
import itertools as it
import math
import numpy as np

# A = input()
# A = int(input())
# A = map(int, input().split())
# A = list(map(int, input().split()))
# A = [int(input()) for i in range(N)]
#
# c = collections.Counter()

X = int(input())
nshohin = X // 100
amari = X % 100

print(0 if nshohin * 5 < amari else 1)

Buggy submission (verdict: Runtime Error):
import collections
import itertools as it
import math
import numpy as np

# A = input()
# A = int(input())
# A = map(int, input().split())
# A = list(map(int, input().split()))
# A = [int(input()) for i in range(N)]
#
# c = collections.Counter()

X = int(input())
nshina = X // 100
kingaku = X - nshina * 100
# print(kingaku)

is_exist = False
for i0 in range(nshina):
    for i1 in range(nshina - i0):
        for i2 in range(nshina - i0 - i1):
            for i3 in range(nshina - i0 - i1 - i2):
                for i4 in range(nshina - i0 - i1 - i2 - i3):
                    # print(nshina, i0, i1, i2, i3, i4, (nshina - i4 - i3 - i2 - i1 - i0))
                    # print(i1 + i2 * 2 + i3 * 3 + i4 * 4 + (nshina-i4-i3-i2-i1-i0) * 5)
                    if i1 + i2 * 2 + i3 * 3 + i4 * 4 + (nshina-i4-i3-i2-i1-i0) * 5 == kingaku:
                        print(1)
                        exit()

print(0)
Problem p02885 (python)

Fixed submission:
A, B = map(int, input().split())

if A > B*2:
  print(A - B*2)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())

if A > B*2:
  print(A - B*2)
  else:
    print(0)
Problem p02921 (python)

Fixed submission:
S = input()
T = input()

c = 0
for s, t in zip(S, T):
  if s == t:
    c += 1

print(c)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
n = N -1
print((n//2) * (2*1 + (n-1)*1))
Problem p02995 (python)

Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
a, b, c, d  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

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

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)

nlcmc = b // c
nlcmd = b // d
nlcmcd = b // lcm(c, d)
nb = b - (nlcmc + nlcmd - nlcmcd)

a -= 1
nlcmc = a // c
nlcmd = a // d
nlcmcd = a // lcm(c, d)
na = a - (nlcmc + nlcmd - nlcmcd)

print(nb - na)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
a, b, c, d  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

nlcmc = b // c
nlcmd = b // d
nlcmcd = b // lcm(c, d)
nb = b - (nlcmc + nlcmd - nlcmcd)

a -= 1
nlcmc = a // c
nlcmd = a // d
nlcmcd = a // lcm(c, d)
na = a - (nlcmc + nlcmd - nlcmcd)

print(nb - na)
Problem p03000 (python)

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))
 
c = 1
d = 0
for i in range(0, len(L)):
  d += L[i]
  
  if d > X:
    break
  else:
    c += 1
    
print(c)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))

c = 0
zahyo = 0
for i in range(100000):
  c += 1
  zahyo += L[i]
  
  if zahyo > X:
    break
    
print(c)
Problem p03150 (python)

Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
s  = input()
#  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

query = list('keyence')

import re

for p in range(8):
    b = ''.join(query[:p])
    a = ''.join(query[p:])

    pattern1 = r'{}{}'.format(b, a)
    pattern2 = r'^{}.*{}$'.format(b, a)
    #print(re.findall(pattern1, s))
    #print(re.findall(pattern2, s))
    if re.findall(pattern1, s) or re.findall(pattern2, s):
        print('YES')
        break
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
s  = input()
#  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

query = list('keyence')

import re

for p in range(8):
    b = ''.join(query[:p])
    a = ''.join(query[p:])

    pattern = f'.*{b}.*{a}.*'
    if re.findall(pattern, s):
        print('YES')
        break
else:
    print('NO')