Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
A = raw_input()
B = raw_input()
C = raw_input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1	
	turn = pop

print(turn.upper())



Fixed submission:
A = input()
B = input()
C = input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1	
	turn = pop

print(turn.upper())

Buggy python submission (verdict: Runtime Error):
A = raw_input()
B = raw_input()
C = raw_input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1	
	turn = pop

print(turn.upper())



Fixed submission:
A = input()
B = input()
C = input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1	
	turn = pop

print(turn.upper())

Buggy python submission (verdict: Runtime Error):
A = raw_input()
B = raw_input()
C = raw_input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1	
	turn = pop

print(turn)



Fixed submission:
A = input()
B = input()
C = input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1	
	turn = pop

print(turn.upper())

Buggy python submission (verdict: Runtime Error):
A = raw_input()
B = raw_input()
C = raw_input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'
print(S)

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1	
	turn = pop

print(turn)



Fixed submission:
A = input()
B = input()
C = input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1	
	turn = pop

print(turn.upper())

Buggy python submission (verdict: Runtime Error):
A = raw_input()
B = raw_input()
C = raw_input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'
print(S)

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1
	print(turn, pop, cnt)
	
	turn = pop

print(turn)

Fixed submission:
A = input()
B = input()
C = input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1	
	turn = pop

print(turn.upper())
Buggy python submission (verdict: Runtime Error):
s = int(input())
s = max(min(s, 100), 1)

f = lambda x: x * 0.5 if x % 2 == 0 else 3*x + 1
array = [s]
while s != 1:
    s = f(int(s))
    array.append(s)
array.append(4)
freq = len(array)
idx = 0
for n, i in enumerate(array):
    for j in array[n:]:
        if s == j:
            idx = n + 2
            break
print(idx)

Fixed submission:
import numpy as np
ab, bc, ca = list(map(int, input().split()))
ab = np.clip(ab, 1, 100)
bc = np.clip(bc, 1, 100)
ca = np.clip(ca, 1, 100)

area = ab * bc * 0.5
print(int(area))
Buggy python submission (verdict: Time Limit Exceeded):
import math

def is_prime(n: int)-> bool:
    if n == 2:
        return True
    if n < 2 or n % 2 == 0:
        return False
    # when n is a prime number
    # x^(n-1) ≡ 1 (mod n)
    return pow(2, (n-1), n) == 1


def prime_factorize(n: int):
    prime_factors = []

    for i in range(2, n+1):
        if not is_prime(i):
            continue
        while True:
            div, mod = divmod(n, i)
            if mod == 0:
                prime_factors.append(i)
                n = div
            else:
                break
        if n == 1:
            break
    return prime_factors


def main():
    N, P = map(int, input().split())
    prime_factors = prime_factorize(P)

    gcd = 1
    for i in set(prime_factors):
        i_count = prime_factors.count(i) // N
        gcd *= pow(i, i_count)

    print(gcd)
    return

main()

Fixed submission:
import math
from collections import defaultdict

def is_prime(n: int)-> bool:
    if n == 2:
        return True
    if n < 2 or n % 2 == 0:
        return False
    # when n is a prime number
    # x^(n-1) ≡ 1 (mod n)
    return pow(2, (n-1), n) == 1


def prime_factorize(n: int):
    prime_factors = defaultdict(int)

    for i in range(2, int(math.sqrt(n)) + 1):
        if not is_prime(i):
            continue
        while True:
            div, mod = divmod(n, i)
            if mod == 0:
                prime_factors[i] += 1
                n = div
            else:
                break
        if n == 1:
            break
    if n != 1:
        prime_factors[n] = 1

    return prime_factors


def main():
    N, P = map(int, input().split())
    prime_factors = prime_factorize(P)

    gcd = 1
    for k, v in prime_factors.items():
        v_cnt = v // N
        gcd *= pow(k, v_cnt)

    print(gcd)
    return

main()
Buggy python submission (verdict: Runtime Error):
import bisect

def main():
    _ = int(input())
    nums = list(map(int, input().split()))
    n = len(nums)
    nums.sort()
    used = [False] * n
    
    cnt = 0
    #print(num_bin_digits)

    for cur in reversed(range(n)):
        continue
        if used[cur]:
            continue
        num = nums[cur]
        power_of_2 = 1 << len("{:b}".format(num))

        pair = power_of_2 - num

        idx = bisect.bisect_left(nums, pair)
        if idx >= cur or nums[idx] != pair:
            #print('continue',pair, idx)
            continue

        while used[idx]:
            idx += 1

        if nums[idx] == pair:
            used[idx] = True
            cnt += 1

        #print(idx, num, power_of_2, pair)
        #print(cnt, nums, used)

    print(cnt)

    return

main()

Fixed submission:
def main():
    txt = input()

    w_cnt = 0
    cnt = 0
    for char in reversed(txt):
        if char == 'W':
            w_cnt += 1
        else:
            cnt += w_cnt
    print(cnt)
    return

main()
Buggy python submission (verdict: Runtime Error):
def enum_divisors(n, reverse=False):
    divisors = []
    for i in range(1, int(math.sqrt(n)) ):
        if n % i == 0:
            divisors.append(i)
            if i != 1 and i * i != n:
                divisors.append(n//i)
    return sorted(divisors, reverse=reverse)

divisors = enum_divisors(M, reverse=True)
divisors = filter(lambda x: x <= M//N, divisors)

for cand in divisors:
    if M % cand == 0:
        print(cand)
        exit()

Fixed submission:
import math
N, M = map(int, input().split())
 
def enum_divisors(n, reverse=False):
    divisors = []
    for i in range(1, int(math.sqrt(n)) + 1 ):
        if n % i == 0:
            divisors.append(i)
            divisors.append(n//i)
    return sorted(divisors, reverse=reverse)
 
 
divisors = enum_divisors(M, reverse=True)
divisors = filter(lambda x: x <= M//N, divisors)
 
for cand in divisors:
    if M % cand == 0:
        print(cand)
        exit()

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
cand = M // N

while cand > 0:
    if M % cand == 0:
        print(cand)
        exit()
    cand -= 1

Fixed submission:
import math
N, M = map(int, input().split())
 
def enum_divisors(n, reverse=False):
    divisors = []
    for i in range(1, int(math.sqrt(n)) + 1 ):
        if n % i == 0:
            divisors.append(i)
            divisors.append(n//i)
    return sorted(divisors, reverse=reverse)
 
 
divisors = enum_divisors(M, reverse=True)
divisors = filter(lambda x: x <= M//N, divisors)
 
for cand in divisors:
    if M % cand == 0:
        print(cand)
        exit()

Buggy python submission (verdict: Time Limit Exceeded):
def canPartition(M, N, ret_cand):
    if ((M - (ret_cand * N)) % ret_cand) == 0:
        return True
    return False

N, M = map(int, input().split())
cand = M // N

while cand > 0:
    if canPartition(M, N, cand):
        print(cand)
        exit()
    cand -= 1

Fixed submission:
import math
N, M = map(int, input().split())
 
def enum_divisors(n, reverse=False):
    divisors = []
    for i in range(1, int(math.sqrt(n)) + 1 ):
        if n % i == 0:
            divisors.append(i)
            divisors.append(n//i)
    return sorted(divisors, reverse=reverse)
 
 
divisors = enum_divisors(M, reverse=True)
divisors = filter(lambda x: x <= M//N, divisors)
 
for cand in divisors:
    if M % cand == 0:
        print(cand)
        exit()
Buggy python submission (verdict: Runtime Error):
def main():
    S = input()
    T = input()

    DICT = {}

    for ch_s, ch_t in zip(S, T):
        #print(ch_s, ch_t)
        if ch_s in DICT.keys():
            #print('swap')
            ch_s = DICT[ch_s]

        if ch_t in DICT.values():
            #print(DICT)
            print(ch_s, ch_t, DICT[ch_t])
            if DICT[ch_t] != ch_t:
                print('No')
                return
        DICT[ch_s] = ch_t
    print('Yes')
    return


main()

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

    s_dict = {}
    t_dict = {}

    for ch_s, ch_t in zip(S, T):
        if ch_t in t_dict.keys():
            if t_dict[ch_t] != ch_s:
                print("No")
                return
        else:
            t_dict[ch_t] = ch_s

        if ch_s in s_dict.keys():
            if s_dict[ch_s] != ch_t:
                print("No")
                return
        else:
            s_dict[ch_s] = ch_t
        #print("s",s_dict)
        #print("t",t_dict)

    print('Yes')
    return


main()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

ans = N

for i in range(N):
    X = S[:i]
    Y = S[i+1:]
    res = 0
    
    num = X.count("W") + Y.count("E")
    
    ans = min(ans, num)
    
print(ans)

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

X = ""
Y = S[1:]

leader = S[0]
num_x = 0
num_y = Y.count("E")

num = num_y

for i in range(1, N):
    
    X_new = leader
    
    if X_new == "W":
        num_x += 1
    
    leader = S[i]
    
    if leader == "E": 
        num_y -= 1
    
    num = min(num, num_x+num_y)
    
print(num)
Buggy python submission (verdict: Runtime Error):
data = list(map(int,input().split()))

A = data[0]
B = data[1]
K = data[2]

ans = []
for i in range(K):
    a = A+i
    b = B-i
    
    if a <= b:
        ans.append(a)
    if a >= b:
        break
    
    ans.append(b)
    
ans.sort()

for i in ans:
    print(i)

Fixed submission:
s = input()
 
if s.count("a") and s.count("b"):
  if s.count("c") and len(s) == 3:
    print("Yes")
  else:
    print("No")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from sys import stdin, stdout

rem=10**9+7
sys.setrecursionlimit(10 ** 6)
take = lambda: map(int, stdin.readline().split())

n=input()
ans=[1 for i in range(n+1)]
pos={}
for i in range(1,n+1):
    x=input()
    pos[x]=i
for i in range(n-1,0,-1):
    if pos[i]<pos[i+1]:
        ans[i]=ans[i+1]+1
#print(ans)
print n-max(ans)

Fixed submission:
import sys
from sys import stdin, stdout

rem=10**9+7
sys.setrecursionlimit(10 ** 6)
take = lambda: map(int, stdin.readline().split())

n=input()
ans=[1 for i in range(n+1)]
pos={}
for i in range(1,n+1):
    x=take()[0]
    pos[x]=i
for i in range(n-1,0,-1):
    if pos[i]<pos[i+1]:
        ans[i]=ans[i+1]+1
#print(ans)
print n-max(ans)
Buggy python submission (verdict: Runtime Error):
import sys

num1 = input()
num2 = input()
num3 = input()
num4 = input()

strTarget = "1974"

isValidation1 = num1 in strTarget

if isValidation1 :
    strTarget.replace(num1,"")
else:
    print("NO")
    sys.exit()

isValidation2 = num2 in strTarget
if isValidation2 :
    strTarget.replace(num2,"")
else:
    print("NO")
    sys.exit()

isValidation3 = num3 in strTarget
if isValidation3 :
    strTarget.replace(num3,"")
else:
    print("NO")
    sys.exit()

isValidation4 = num4 in strTarget
if isValidation4 :
    strTarget.replace(num4,"")
else:
    print("NO")
    sys.exit()

print("YES")


Fixed submission:
import sys
#
# num = input()
#
# num1 = num[0]
# num2 = num[1]
# num3 = num[2]
# num4 = num[3]

num1, num2, num3, num4 = (int(i) for i in input().split())

num1 = str(num1)
num2 = str(num2)
num3 = str(num3)
num4 = str(num4)


strTarget = "1974"
isCheck1 = False
isCheck2 = False
isCheck3 = False
isCheck4 = False

isValidation1 = num1 in strTarget
if isValidation1 :
    strTarget = strTarget.replace(num1,"")
    isCheck1 = True

isValidation2 = num2 in strTarget
if isValidation2 :
    strTarget = strTarget.replace(num2,"")
    isCheck2 = True

isValidation3 = num3 in strTarget
if isValidation3 :
    strTarget = strTarget.replace(num3,"")
    isCheck3 = True

isValidation4 = num4 in strTarget
if isValidation4 :
    strTarget = strTarget.replace(num4,"")
    isCheck4 = True

if isCheck1 and isCheck2 and isCheck3 and isCheck4:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input())
if 8 < a or 8 < b:
  print(":(")
else:
  print("Yay!")


Fixed submission:
a, b = map(int, input().split())
if 8 < a or 8 < b:
  print(":(")
else:
  print("Yay!")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, raw_input().split())
axb = a * b
if axb % 2:
    print('Odd')
else:
    print('Even')


Fixed submission:
a, b = map(int, raw_input().split())
if a * b % 2:
    print('Odd')
else:
    print('Even')
Buggy python submission (verdict: Time Limit Exceeded):
import math
def sieve_of_erastosthenes(num):
    input_list = [0 if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else 1 for i in range(num)]
    input_list[0] = input_list[1] = 0
    input_list[2] = input_list[3] = input_list[5] = 1
    sqrt = math.sqrt(num)
    for serial in range(3, num, 2):
        if serial >= sqrt:
            return input_list
        for s in range(serial ** 2, num, serial): 
            input_list[s] = 0

q = int(input())
l_list = []
r_list = []
for i in range(q):
    l, r = map(int, input().split())
    l_list.append(l)
    r_list.append(r)
minval = min(l_list)
maxval = max(r_list)
sieve = sieve_of_erastosthenes(maxval+1)
def is_prime(x):
    # print(x)
    return sieve[x]
def is_like2017(x):
    return is_prime(x) * is_prime(int((x+1)/2))
like2017 = list(range(maxval+1))
for i in like2017:
    like2017[i] = is_like2017(i)
for l, r in zip(l_list, r_list):
    print(sum(like2017[l:r+1]))


Fixed submission:
import math
def sieve_of_erastosthenes(num):
    input_list = [0 if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else 1 for i in range(num)]
    input_list[0] = input_list[1] = 0
    input_list[2] = input_list[3] = input_list[5] = 1
    sqrt = math.sqrt(num)
    for serial in range(3, num, 2):
        if serial >= sqrt:
            return input_list
        for s in range(serial ** 2, num, serial): 
            input_list[s] = 0
q = int(input())
l_list = []
r_list = []
for i in range(q):
    l, r = map(int, input().split())
    l_list.append(l)
    r_list.append(r)
minval = min(l_list)
maxval = max(r_list)
sieve = sieve_of_erastosthenes(maxval+1)
def is_prime(x):
    return sieve[x]
def is_like2017(x):
    return is_prime(x) * is_prime(int((x+1)/2))
like2017 = list(range(maxval+1))
for i in like2017:
    like2017[i] = is_like2017(i)

integral = like2017
for i in range(1, len(integral)):
    integral[i] = integral[i] + integral[i-1]
for l, r in zip(l_list, r_list):
    print(integral[r] - integral[l-1])
Buggy python submission (verdict: Runtime Error):
import math
from decimal import *

k, a, b = map(int, input().split())
inc = a - b
if inc < 0:
    if k <= a:
        print(1)
    else:
        print(-1)
    exit()

getcontext().prec = 500
print(math.ceil(Decimal(k-a) / Decimal(inc))*2+1)



Fixed submission:
import math

k, a, b = map(int, input().split())
inc = a - b
if k <= a:
    print(1)
elif inc < 0:
    if k <= a:
        print(1)
    else:
        print(-1)
elif inc == 0:
    print(-1)
else:
    from decimal import *
    getcontext().prec = 500
    print(math.ceil(Decimal(k-a) / Decimal(inc))*2+1)

Buggy python submission (verdict: Runtime Error):
import math

k, a, b = map(int, input().split())
p = 0
inc = a - b

if inc < 0:
    if k >= a:
        print(1)
    else:
        print(-1)
    exit()
print(math.ceil((k-a) / inc)*2+1)




Fixed submission:
import math

k, a, b = map(int, input().split())
inc = a - b
if k <= a:
    print(1)
elif inc < 0:
    if k <= a:
        print(1)
    else:
        print(-1)
elif inc == 0:
    print(-1)
else:
    from decimal import *
    getcontext().prec = 500
    print(math.ceil(Decimal(k-a) / Decimal(inc))*2+1)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, raw_input().split())

f = dict()
for i in range(m):
    a, b = map(int, raw_input().split())
    if a in f:
        f[a].append(b)
    else:
        f[a] = [b]
if m < 2:
    print("IMPOSSIBLE")
    exit()

for k, v in f.iteritems():
    if k == 1:
        for vv in v:
            if n in f[vv]:
                print("POSSIBLE")
                exit()
print("IMPOSSIBLE")

Fixed submission:
n, m = map(int, raw_input().split())

f = dict()
for i in range(m):
    a, b = map(int, raw_input().split())
    if a in f:
        f[a].append(b)
    else:
        f[a] = [b]
if m < 2:
    print("IMPOSSIBLE")
    exit()

for k, v in f.iteritems():
    if k == 1:
        for vv in v:
            if vv not in f:
                continue
            if n in f[vv]:
                print("POSSIBLE")
                exit()
print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
n, m = map(int, raw_input().split())

f = dict()
for i in range(m):
    a, b = map(int, raw_input().split())
    f[a] = b

if m == 1:
    print("IMPOSSIBLE")
    exit()

for k, v in f.iteritems():
    if k == 1:
        if f[v] == n:
            print("POSSIBLE")
            exit()
print("IMPOSSIBLE")

Fixed submission:
n, m = map(int, raw_input().split())

f = dict()
for i in range(m):
    a, b = map(int, raw_input().split())
    if a in f:
        f[a].append(b)
    else:
        f[a] = [b]
if m < 2:
    print("IMPOSSIBLE")
    exit()

for k, v in f.iteritems():
    if k == 1:
        for vv in v:
            if vv not in f:
                continue
            if n in f[vv]:
                print("POSSIBLE")
                exit()
print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, raw_input().split())


if a % 3 == 0 or b % 3 == 0 or (a+b)%3==0:
    print("Possible")
else:
    print("Impossible")



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


if a % 3 == 0 or b % 3 == 0 or (a+b)%3==0:
    print("Possible")
else:
    print("Impossible")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())

aa = []
for i in range(n):
    t = int(raw_input())
    aa.append(t)

cnt = 0
b = [1]
a = aa[0]
while 1:
    cnt += 1
    if a == 2:
        print cnt
        exit()
    a = aa[a-1]
    if a in b:
        print -1
        exit()
    b.append(a)
    if cnt == n:
        print -1
        exit()

Fixed submission:
n = int(raw_input())

aa = []
for i in range(n):
    t = int(raw_input())
    aa.append(t)

cnt = 0
b = dict({1: True})
a = aa[0]
while 1:
    cnt += 1
    if a == 2:
        print cnt
        exit()
    a = aa[a-1]
    if a in b:
        print -1
        exit()
    b[a] = True
    if cnt == n:
        print -1
        exit()

Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())

aa = []
for i in range(n):
    t = int(raw_input())
    aa.append(t)

cnt = 0
b = [1]
a = aa[0]
while 1:
    cnt += 1
    if a == 2:
        print cnt
        exit()
    a = aa[a-1]
    if a in b:
        print -1
        exit()
    b.append(a)
    if cnt == n:
        print -1

Fixed submission:
n = int(raw_input())

aa = []
for i in range(n):
    t = int(raw_input())
    aa.append(t)

cnt = 0
b = dict({1: True})
a = aa[0]
while 1:
    cnt += 1
    if a == 2:
        print cnt
        exit()
    a = aa[a-1]
    if a in b:
        print -1
        exit()
    b[a] = True
    if cnt == n:
        print -1
        exit()

Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())

aa = []
for i in range(n):
    t = int(raw_input())
    aa.append(t)

cnt = 0
b = [1]
a = aa[0]
while 1:
    cnt += 1
    if a == 2:
        print cnt
        exit()
    a = aa[a-1]
    if a in b:
        print -1
        exit()
    b.append(a)
    if cnt == n:
        print -1

Fixed submission:
n = int(raw_input())

aa = []
for i in range(n):
    t = int(raw_input())
    aa.append(t)

cnt = 0
b = dict({1: True})
a = aa[0]
while 1:
    cnt += 1
    if a == 2:
        print cnt
        exit()
    a = aa[a-1]
    if a in b:
        print -1
        exit()
    b[a] = True
    if cnt == n:
        print -1
        exit()
Buggy python submission (verdict: Runtime Error):
h, w = map(int, raw_input().split())
for i in range(h):
    row = raw_input()
    print(row)
    print(row)


Fixed submission:
h, w = map(int, raw_input().split())
for i in range(h):
    row = raw_input()
    print(row)
    print(row)
Buggy python submission (verdict: Runtime Error):


num_list = input()
key = 'keyence'

i = 0
ans =False
while num_list[i]==key[i]:
    i+=1
n = i
if n >= 6:
    print('YES')



i = -1
while num_list[i]==key[i]:
    i -= 1
    n += 1

if n >= 6:
    print('YES')
else:
    print('NO')

Fixed submission:
num_list = input()
key = 'keyence'
i = 0
l = len(num_list)

n = 0

while num_list[i]==key[i]:
    i+=1
    n +=1
    if n==7:
        print('YES')
        exit()

i = -1
while num_list[i]==key[i]:
    n += 1
    i -= 1
    if n==7:
        print('YES')
        exit()
print('NO')

Buggy python submission (verdict: Runtime Error):
num_list = input()
key = 'keyence'

i = 0
ans =False
while num_list[i]==key[i]:
    i+=1
n = i
if n >= 6:
    print('YES')
else:
    print('NO')


i = -1
while num_list[i]==key[i]:
    i -= 1
    n += 1

if n >= 6:
    print('YES')
else:
    print('NO')

Fixed submission:
num_list = input()
key = 'keyence'
i = 0
l = len(num_list)

n = 0

while num_list[i]==key[i]:
    i+=1
    n +=1
    if n==7:
        print('YES')
        exit()

i = -1
while num_list[i]==key[i]:
    n += 1
    i -= 1
    if n==7:
        print('YES')
        exit()
print('NO')

Buggy python submission (verdict: Runtime Error):


num_list = input()
key = 'keyence'

i = 0
ans =False
while num_list[i]==key[i] and i<100:
    i+=1
n = i

i = -1
while num_list[i]==key[i] and i>-100:
    i -= 1
    n += 1

if n >= 6:
    print('YES')
else:
    print('NO')

Fixed submission:
num_list = input()
key = 'keyence'
i = 0
l = len(num_list)

n = 0

while num_list[i]==key[i]:
    i+=1
    n +=1
    if n==7:
        print('YES')
        exit()

i = -1
while num_list[i]==key[i]:
    n += 1
    i -= 1
    if n==7:
        print('YES')
        exit()
print('NO')

Buggy python submission (verdict: Runtime Error):

num_list = input()
key = 'keyence'

i = 0
ans =False
while num_list[i]==key[i]:
    i+=1
n = i

i = -1
while num_list[i]==key[i]:
    i -= 1
    n += 1

if n >= 6:
    print('YES')
else:
    print('NO')

Fixed submission:
num_list = input()
key = 'keyence'
i = 0
l = len(num_list)

n = 0

while num_list[i]==key[i]:
    i+=1
    n +=1
    if n==7:
        print('YES')
        exit()

i = -1
while num_list[i]==key[i]:
    n += 1
    i -= 1
    if n==7:
        print('YES')
        exit()
print('NO')