Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def gcd(x,y):
	if x < y:
		x,y = y,x
	while y > 0:
		r = x % y
		x = y
		y = r
	return x

N=int(input())
T=[0]*N
for i in range(N):
	T[i] = int(input())

curr=1
ans=1
for i in range(N):
	g=gcd(curr,T[i])
	ans=T[i]/g*curr
	curr=ans

print(int(ans))

Fixed submission:
def gcd(x,y):
	if x < y:
		x,y = y,x
	while y > 0:
		r = x % y
		x = y
		y = r
	return x

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

N=int(input())
T=[0]*N
for i in range(N):
	T[i] = int(input())

ans=1
for i in range(N):
	ans=lcm(ans,T[i])

print(int(ans))

Buggy python submission (verdict: Runtime Error):
def gcd(x,y):
	if x < y:
		x,y = y,x
	while y > 0:
		r = x % y
		x = y
		y = r
	return x

N=int(input())
T=[0]*N
for i in range(N):
	T[i] = int(input())

curr=1
ans=1
for i in range(N):
	g=gcd(curr,T[i])
	ans=curr*T[i]/g
	curr=ans

print(int(ans))

Fixed submission:
def gcd(x,y):
	if x < y:
		x,y = y,x
	while y > 0:
		r = x % y
		x = y
		y = r
	return x

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

N=int(input())
T=[0]*N
for i in range(N):
	T[i] = int(input())

ans=1
for i in range(N):
	ans=lcm(ans,T[i])

print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int,input().split())
edges = [[] for _ in range(N)]

for i in range(M):
	a, b = map(int,input().split())
	edges[a-1] += [b-1]
	edges[b-1] += [a-1]

res = False
for u in edges[0]:
	if u in edges[N-1]:
		res = True
		break

print("POSSIBLE" if res == True else "IMPOSSIBLE")

Fixed submission:
N, M = map(int,input().split())

from1 = []
gotoN = []

for i in range(M):
	a, b = map(int,input().split())
	if a == 1:
		from1.append(b)
	if b == N:
		gotoN.append(a)

res = set(from1) & set(gotoN)

print("POSSIBLE" if len(res) > 0 else "IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
class UnionFind():
	def __init__(self,size):
		self.table = [-1 for _ in range(size)]

	def find(self,x):
		while self.table[x] >= 0:
			x = self.table[x]
		return x

	def unite(self,x,y):
		s1 = self.find(x)
		s2 = self.find(y)
		if s1 != s2:
			if self.table[s1] != self.table[s2]:
				if self.table[s1] < self.table[s2]:
					self.table[s2] = s1
				else:
					self.table[s1] = s2
			else:
				self.table[s1] += -1
				self.table[s2] = s1
		return

	def same(self,x,y):
		return self.find(x) == self.find(y)


N, M = map(int,input().split())
edges = [[] for _ in range(N)]

for i in range(M):
	a, b = map(int,input().split())
	if a == 1 or a == N or b == 1 or b == N:
		edges[a-1] += [b-1]
		edges[b-1] += [a-1]

uf = UnionFind(N)

for u in edges[0]:
	if N-1 not in edges[0]:
		uf.unite(0,u)

for v in edges[N-1]:
	if 0 not in edges[N-1]:
		uf.unite(N-1,v)

print("POSSIBLE" if uf.same(0,N-1) == True else "IMPOSSIBLE")

Fixed submission:
N, M = map(int,input().split())

from1 = []
gotoN = []

for i in range(M):
	a, b = map(int,input().split())
	if a == 1:
		from1.append(b)
	if b == N:
		gotoN.append(a)

res = set(from1) & set(gotoN)

print("POSSIBLE" if len(res) > 0 else "IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
class UnionFind():
	def __init__(self,size):
		self.table = [-1 for _ in range(size)]

	def find(self,x):
		while self.table[x] >= 0:
			x = self.table[x]
		return x

	def unite(self,x,y):
		s1 = self.find(x)
		s2 = self.find(y)
		if s1 != s2:
			if self.table[s1] != self.table[s2]:
				if self.table[s1] < self.table[s2]:
					self.table[s2] = s1
				else:
					self.table[s1] = s2
			else:
				self.table[s1] += -1
				self.table[s2] = s1
		return

	def same(self,x,y):
		return self.find(x) == self.find(y)


N, M = map(int,input().split())
edges = [[] for _ in range(N)]

for i in range(M):
	a, b = map(int,input().split())
	edges[a-1] += [b-1]
	edges[b-1] += [a-1]

uf = UnionFind(N)

for u in edges[0]:
	if N-1 not in edges[0]:
		uf.unite(0,u)

for v in edges[N-1]:
	if 0 not in edges[N-1]:
		uf.unite(N-1,v)

print("POSSIBLE" if uf.same(0,N-1) == True else "IMPOSSIBLE")

Fixed submission:
N, M = map(int,input().split())

from1 = []
gotoN = []

for i in range(M):
	a, b = map(int,input().split())
	if a == 1:
		from1.append(b)
	if b == N:
		gotoN.append(a)

res = set(from1) & set(gotoN)

print("POSSIBLE" if len(res) > 0 else "IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
DAYDREAM = ["dream", "dreamer", "erase", "eraser" ]
S = input()

ind = len(S)
res = True

while ind > 0:
	ok = False
	for i in DAYDREAM:
#		print("ind:", ind, "subS: ", S[ind - len(i):ind], file=sys.stderr)
		if S[ind - len(i):ind] == i:
			ind -= len(i)
			ok = True
			break;
	if ok == False:
		res = False

print("YES" if res == True else "NO")

Fixed submission:
import sys
DAYDREAM = ["dream", "dreamer", "erase", "eraser" ]
S = input()

ind = len(S)
res = True

while ind > 0:
	ok = False
	for i in DAYDREAM:
#		print("ind:", ind, "subS: ", S[ind - len(i):ind], file=sys.stderr)
		if S[ind - len(i):ind] == i:
			ind -= len(i)
			ok = True
			break;
	if ok == False:
		res = False
		break

print("YES" if res == True else "NO")
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = {y: x for x, y in zip("abcdefghijklmnopqrstuvwxyz", range(1, 27))}
array = []
while n > 0:
    array.append(n % 26)
    n //= 26
print("".join([d[x] for x in array[::-1]]))

Fixed submission:
def Base_10_to_n(X, n):
    X_dumy = X
    out = []
    while X_dumy > 0:
        X_dumy-=1
        out.append(X_dumy % n)
        X_dumy = int(X_dumy / n)
    return out

n = int(input())
d = {y: x for x, y in zip("abcdefghijklmnopqrstuvwxyz", range(26))}

res = []
array = Base_10_to_n(n, 26)

print("".join([d[x] for x in array[::-1]]))
Buggy python submission (verdict: Runtime Error):
print("Yes" if s[2]==s[3] and s[4] == s[5] else "No")

Fixed submission:
s = input()
print("Yes" if s[2]==s[3] and s[4] == s[5] else "No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
print((n/3)**3)

Fixed submission:
s = input()
n = len(s)
ss = s[:(n - 1) // 2]
sss = s[(n + 3) // 2 - 1:]
flag = True;
for i in range(len(s)//2):
    if s[i] != s[n - 1 - i]:
        flag = False
if not flag:
    print("No")
    exit()

for i in range(len(ss)//2):
    if ss[i] != ss[len(ss) - 1 - i]:
        flag = False
if not flag:
    print("No")
    exit()

for i in range(len(sss)//2):
    if sss[i] != sss[len(sss) - 1 - i]:
        flag = False
if not flag:
    print("No")
    exit()
print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt
from decimal import *

getcontext().prec = 40000

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

tmp = 2 * sqrt(Decimal(a)) * sqrt(Decimal(b))
print("Yes" if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt() else "No")


Fixed submission:
from math import sqrt
from decimal import *


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

tmp = 2 * sqrt(Decimal(a)) * sqrt(Decimal(b))
print("Yes" if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt() else "No")

Buggy python submission (verdict: Runtime Error):
from math import sqrt
from decimal import *

getcontext().prec = 40000

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

tmp = 2 * sqrt(Decimal(a)) * sqrt(Decimal(b))
print("Yes" if Decimal(a) ** 0.5 + Decimal(b) ** 0.5 < Decimal(c) ** 0.5 else "No")


Fixed submission:
from math import sqrt
from decimal import *


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

tmp = 2 * sqrt(Decimal(a)) * sqrt(Decimal(b))
print("Yes" if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt() else "No")
Buggy python submission (verdict: Runtime Error):
from math import log2, floor

h = int(input())
tmp = floor(log2(h)) + 1
print(2 ** tmp - 1)


Fixed submission:
from math import log2, floor

h = int(input())
tmp = floor(log2(h)) + 1
print(2 ** tmp - 1)
Buggy python submission (verdict: Runtime Error):
n, k , s = map(int, input().split())
ans = []
for i in range(n):
    if k != 0:
        ans.append(s)
        k -= 1
    else:
      	if s == 10**9:
          ans.append(s-1)
        else if s == 1:
          ans.append(s+1)
        else:
          ans.append(s+1)
print(" ".join([str(x) for x in ans]))


Fixed submission:
n, k , s = map(int, input().split())
ans = []
for i in range(n):
    if k != 0:
        ans.append(s)
        k -= 1
    else:
        ans.append(s+1 if s != 10**9 else s-1)
print(" ".join([str(x) for x in ans]))

Buggy python submission (verdict: Runtime Error):
n, k , s = map(int, input().split())
ans = []
for i in range(n):
    if k != 0:
        ans.append(s)
        k -= 1
    else:
      	if s == 10**9:
          ans.append(s-1)
        else if s == 1:
          ans.append(s+1)
		else:
          ans.append(s+1)
print(" ".join([str(x) for x in ans]))


Fixed submission:
n, k , s = map(int, input().split())
ans = []
for i in range(n):
    if k != 0:
        ans.append(s)
        k -= 1
    else:
        ans.append(s+1 if s != 10**9 else s-1)
print(" ".join([str(x) for x in ans]))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
print("Yes" if n % 2 == 0 and s[:n/2] == s[n/2:] else "No")


Fixed submission:
n = int(input())
s = input()
print("Yes" if n % 2 == 0 and s[:int(n/2)] == s[int(n/2):] else "No")
Buggy python submission (verdict: Runtime Error):
from itertools import permutations

n = int(input())
distance_array = [[0 for x in range(2)] for y in range(n)]
for i in range(n):
    x, y = map(int, input().split())
    distance_array[i][0] = x
    dustance_array[i][1] = y
p = permutations([x for x in range(n)], 8)
print(p)
                  

Fixed submission:
from itertools import permutations


def calc_distance(x1, y1, x2, y2):
    return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5


n = int(input())
xy_array = [[int(x) for x in input().split()] for y in range(n)]
p = permutations([x for x in range(n)])

sum_distance = 0
for order in p:
    for index in range(n - 1):
        x1 = xy_array[order[index]][0]
        x2 = xy_array[order[index + 1]][0]
        y1 = xy_array[order[index]][1]
        y2 = xy_array[order[index + 1]][1]
        sum_distance += calc_distance(x1, y1, x2, y2)
tmp = 1
for i in range(2, n + 1):
    tmp *= i
print(sum_distance / tmp)
Buggy python submission (verdict: Runtime Error):
s = input()
direction = []
cnt_array = []
cnt = 1
for i in range(1, len(s)):
    if s[i] != s[i - 1]:
        direction.append(s[i - 1])
        cnt_array.append(cnt)
        cnt = 1
    else:
        cnt += 1
else:
    direction.append(s[i])
    cnt_array.append(cnt)

ans = 0
now = 0
ans_array = [now]
for i in range(1, len(direction)):
    if direction[i - 1] == "<" and direction[i] == ">":
        ans_array.append(max(cnt_array[i - 1], cnt_array[i]))
        if cnt_array[i - 1] < cnt_array[i]:
            ans_array.append(cnt_array[i - 1] - 1)
        elif cnt_array[i] < cnt_array[i - 1]:
            ans_array.append(cnt_array[i] - 1)
else:
    if direction[-1] == "<":
        ans += 1
print(ans + sum([(x * (x + 1)) // 2 for x in ans_array]))

Fixed submission:
s = input()
len_s = len(s)
ans_array = [0 for x in range(len_s+1)]
for index in range(len_s):
    if s[index] == "<":
        ans_array[index + 1] = ans_array[index]+1
for index in reversed(range(len_s)):
    if s[index] == ">":
        ans_array[index] = max(ans_array[index+1]+1, ans_array[index])
print(sum(ans_array))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()

l_array = [0 for x in range(n)]
l_reverse = []
r_array = [0 for x in range(n)]
r_reverse = []

cnt = []
l_cnt = 0
r_cnt = 0
now = s[0]
for index, ss in enumerate(s):
    if ss == "L":
        if now == ss:
            l_cnt += 1
        else:
            cnt.append(r_cnt)
            r_cnt = 0
            l_cnt = 1
            now = "L"
    else:
        if now == ss:
            r_cnt += 1
        else:
            cnt.append(l_cnt)
            l_cnt = 0
            r_cnt = 1
            now = "R"
else:
    cnt.append(max(l_cnt, r_cnt))

len_cnt = len(cnt)
res = []
for i in range(0, len_cnt, 2):
    if i+1>=len_cnt: continue
    res.append(cnt[i]+cnt[i+1])
res = sorted(res, reverse=True)
ans = 0
for j in range(k):
    ans += res[j]
print(ans)


Fixed submission:
n, k = map(int, input().split())
s = input()

cnt = 0
for i, j in zip(s, s[1:]):
    if i == j:
        cnt += 1
print(min(n-1, cnt+2*k))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
a_array = [int(x) for x in input().split()]
INF = 10**9+7

cnt_array = [0 for x in range(n+1)]
a_array2 = []
ans = 0
for a in a_array:
    cnt_array[a] += 1
    a_array2.append(sum(cnt_array[a+1:]))
a_array3 = []
for i in a_array:
    tmp = 0
    for j in a_array[::-1]:
        if j > i:
            tmp += 1
    a_array3.append(tmp)
for cnt, d in zip(a_array2, a_array3):
    ans += (k*(2*cnt+(k-1)*d))//2
    ans = ans % INF
print(ans)


Fixed submission:
n, k = map(int, input().split())
a_array = [int(x) for x in input().split()]
INF = 10**9+7

cnt_array = [0 for x in range(2000+1)]
a_array2 = []
ans = 0
for a in a_array:
    cnt_array[a] += 1
    a_array2.append(sum(cnt_array[a+1:]))
a_array3 = []
for i in a_array:
    tmp = 0
    for j in a_array[::-1]:
        if j > i:
            tmp += 1
    a_array3.append(tmp)
for cnt, d in zip(a_array2, a_array3):
    ans += (k*(2*cnt+(k-1)*d))//2
    ans = ans % INF
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
array = [sorted(input()) for x in range(n)]
set_array = set()
for i in array:
  set_array.add(i)
print(len(array) - len(set_array))


Fixed submission:
from collections import Counter

n = int(input())
array = sorted(["".join(sorted(input())) for x in range(n)])
counter = Counter(array)

res = 0
for key, value in counter.items():
    res += value*(value-1)//2
print(res)

Buggy python submission (verdict: Runtime Error):
n = int(input())
array = [sorted(input()) for x in range(n)]
print(len(set(array)) )


Fixed submission:
from collections import Counter

n = int(input())
array = sorted(["".join(sorted(input())) for x in range(n)])
counter = Counter(array)

res = 0
for key, value in counter.items():
    res += value*(value-1)//2
print(res)

Buggy python submission (verdict: Runtime Error):
n = int(input())
array = [sorted(input()) for x in range(n)]
print(len(array) - len(set(array)))

Fixed submission:
from collections import Counter

n = int(input())
array = sorted(["".join(sorted(input())) for x in range(n)])
counter = Counter(array)

res = 0
for key, value in counter.items():
    res += value*(value-1)//2
print(res)
Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
l_array = [int(x) for x in input().split()]
d = 0
cnt = 1
for i in range(n+1):
    d = d + l_array[i]
    if d > x:
        break
    cnt += 1
print(cnt)

Fixed submission:
n, x = map(int, input().split())
l_array = [int(x) for x in input().split()]
cnt = 1
now = 0
for l in l_array:
    now += l
    if now > x:
        break
    cnt += 1
print(cnt)

Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
l_array = [int(x) for x in input().split()]
d = 0
cnt = 0
while d <= x:
    d = d + l_array[cnt]
    cnt += 1
print(cnt)

Fixed submission:
n, x = map(int, input().split())
l_array = [int(x) for x in input().split()]
cnt = 1
now = 0
for l in l_array:
    now += l
    if now > x:
        break
    cnt += 1
print(cnt)

Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
l_array = [int(x) for x in input().split()]
d = 0
cnt = 0
while d <= x:
  d = d+l_array[d]
  cnt += 1
print(cnt)

Fixed submission:
n, x = map(int, input().split())
l_array = [int(x) for x in input().split()]
cnt = 1
now = 0
for l in l_array:
    now += l
    if now > x:
        break
    cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
from itertools import combinations

n = int(input())
xy_array = [[int(x) for x in input().split()] for y in range(n)]
comb_xy = combinations(xy_array, 2)
ans = float("INF")
res_x = 0
res_y = 0

for i, j in comb_xy:
    xx = j[0]-i[0]
    yy = j[1]-i[1]
    tmp = 0
    base_x = xy_array[0][0]
    base_y = xy_array[0][1]
    for x, y in xy_array[1:]:
        if base_x + xx == x and base_y + yy == y:
            pass
        else:
            tmp += 1
        base_x = x
        base_y = y
    tmp = min(tmp, ans)
print(tmp+1)

Fixed submission:
from itertools import combinations
from collections import Counter

n = int(input())
xy_array = [[int(x) for x in input().split()] for y in range(n)]
comb_xy = combinations(xy_array, 2)
ans = float("INF")
res_x = 0
res_y = 0

vector = []
for i, j in comb_xy:
    xx = j[0] - i[0]
    yy = j[1] - i[1]
    vector.append((xx, yy))
    xx = i[0] - j[0]
    yy = i[1] - j[1]
    vector.append((xx, yy))

if n == 1:
    print(1)
    exit()
print(n - max(Counter(vector).values()))
Buggy python submission (verdict: Time Limit Exceeded):
from math import ceil

r, g, b, n = map(int, input().split())
cnt = 0
for i in range(ceil(n / r) + 1):
    for j in range(ceil(n / g) + 1):
        if i * r + j * g > n:
            break
        if i * r + j * g == n:
            cnt += 1
            continue
        else:
            tmp = n - (i * r + j * g)
            if tmp % b == 0:
                cnt += 1
print(cnt)


Fixed submission:
from math import ceil

r, g, b, n = map(int, input().split())
cnt = 0
for i in range(ceil(n / r) + 1):
    for j in range(ceil(n / g) + 1):
        if i * r + j * g > n:
            break
        if i * r + j * g == n:
            cnt += 1
            continue
        else:
            tmp = n - (i * r + j * g)
            if tmp % b == 0:
                cnt += 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
h, w = map(int, input().split())
a_array = [input() for x in range(h)]
black = set()
white = set()
for row in range(h):
    for column in range(w):
        if a_array[row][column] == "#":
            black.add((row, column))
        else:
            white.add((row, column))

move = [[1, 0], [0, 1], [-1, 0], [0, -1]]
cnt = 0
next = black.copy()
while not (white <= black):
    tmp = set()
    cnt += 1
    for row, column in next:
        for i, j in move:
            if (row + i, column + j) in black or not (0 <= row + i < h and 0 <= column + j < w):
                continue
            black.add((row + i, column + j))
            tmp.add((row + i, column + j))
    next = tmp.copy()
print(cnt)


Fixed submission:
h, w = map(int, input().split())
a_array = [input() for x in range(h)]
black = [[False for x in range(w)] for y in range(h)]
next = set()
for row in range(h):
    for column in range(w):
        if a_array[row][column] == "#":
            black[row][column] = True
            next.add((row, column))

move = [[1, 0], [0, 1], [-1, 0], [0, -1]]
cnt = 0
while next:
    tmp = set()
    # print(next)
    cnt += 1
    for row, column in next:
        for i, j in move:
            if not (0 <= row + i < h and 0 <= column + j < w) or black[row+i][column+j]:
                continue
            black[row+i][column+j] = True
            tmp.add((row + i, column + j))
    next = tmp
print(cnt-1)

Buggy python submission (verdict: Time Limit Exceeded):
h, w = map(int, input().split())
a_array = [input() for x in range(h)]
black = set()
white = set()
for row in range(h):
    for column in range(w):
        if a_array[row][column] == "#":
            black.add((row, column))
        else:
            white.add((row, column))

move = [[1, 0], [0, 1], [-1, 0], [0, -1]]
cnt = 0
next = black.copy()
while not (white <= black):
    tmp = set()
    cnt += 1
    for row, column in next:
        for i, j in move:
            if (row + i, column + j) in black or not (0 <= row + i < h and 0 <= column + j < w):
                continue
            black.add((row + i, column + j))
            tmp.add((row + i, column + j))
    next = tmp.copy()
print(cnt)


Fixed submission:
h, w = map(int, input().split())
a_array = [input() for x in range(h)]
black = [[False for x in range(w)] for y in range(h)]
next = set()
for row in range(h):
    for column in range(w):
        if a_array[row][column] == "#":
            black[row][column] = True
            next.add((row, column))

move = [[1, 0], [0, 1], [-1, 0], [0, -1]]
cnt = 0
while next:
    tmp = set()
    # print(next)
    cnt += 1
    for row, column in next:
        for i, j in move:
            if not (0 <= row + i < h and 0 <= column + j < w) or black[row+i][column+j]:
                continue
            black[row+i][column+j] = True
            tmp.add((row + i, column + j))
    next = tmp
print(cnt-1)
Buggy python submission (verdict: Time Limit Exceeded):
x, y, z, k = map(int, input().split())
a_array = sorted([int(x) for x in input().split()], reverse=True)
b_array = sorted([int(x) for x in input().split()], reverse=True)
c_array = sorted([int(x) for x in input().split()], reverse=True)


def solver1():
    ab_array = [x + y for x in a_array for y in b_array]
    abc_array = sorted([ab + c for ab in ab_array for c in c_array], reverse=True)
    for abc in abc_array[:k]:
        print(abc)


solver1()


Fixed submission:
x, y, z, k = map(int, input().split())
a_array = sorted([int(x) for x in input().split()], reverse=True)
b_array = sorted([int(x) for x in input().split()], reverse=True)
c_array = sorted([int(x) for x in input().split()], reverse=True)


def solver1():
    ab_array = sorted([x + y for x in a_array for y in b_array], reverse=True)[:3000]
    abc_array = sorted([ab + c for ab in ab_array for c in c_array], reverse=True)
    for abc in abc_array[:k]:
        print(abc)


solver1()
Buggy python submission (verdict: Runtime Error):
s = input()
tmp = "keyence"
# if s == "keyence":
#     print("YES")
#     exit()
cnt = 0
aaa = True
for i in s:
    if i == tmp[0]:
        aaa = True
        tmp = tmp[1:]
    else:
        if aaa and cnt == 0:
            aaa = False
            cnt += 1
        elif not aaa and cnt == 1:
            pass
        else:
            break

print("YES" if len(tmp) == 0 else "NO")

Fixed submission:
s = input()
tmp = "keyence"
# if s == "keyence":
#     print("YES")
#     exit()
for i in range(len(s)):
    for j in range(i, len(s)):
        tmp2 = s[:i] + s[j:]
        if tmp2 == "keyence":
            print("YES")
            exit()
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h_array = [int(x) for x in input().split()]
res = [0 for x in range(n)]
for index in range(n):
    ret = float("inf")
    if index == 1:
        res[index] = abs(h_array[index] - h_array[index - 1])
        continue
    elif index == 0:
        res[index] = 0
        continue
    for i in range(1, k + 1):
        if index - i < 0:
            continue
        ret = min(ret, abs(h_array[index] - h_array[index - i]) + res[index - i])
    res[index] = ret

print(res[-1])


Fixed submission:
n, k = map(int, input().split())
h_array = [int(x) for x in input().split()]
res = [0 for x in range(n)]
for index in range(n):
    ret = float("inf")
    if index == 1:
        res[index] = abs(h_array[index] - h_array[index - 1])
        continue
    elif index == 0:
        res[index] = 0
        continue
    for i in range(1, k + 1):
        if index - i < 0:
            continue
        ret = min(ret, abs(h_array[index] - h_array[index - i]) + res[index - i])
    res[index] = ret

print(res[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n, w = map(int, input().split())
wv_array = [[int(x) for x in input().split()] for y in range(n)]

dp = [[0 for x in range(w + 1)] for y in range(n+1)]

index = 1
for ww, vv in wv_array:
    for capacity in range(1, w + 1):
        if ww <= capacity:
            dp[index][capacity] = max(dp[index - 1][capacity - ww] + vv, dp[index-1][capacity])
        else:
            dp[index][capacity] = dp[index - 1][capacity]
    index += 1
print(max(dp[n]))

Fixed submission:
n, w = map(int, input().split())
wv_array = [[int(x) for x in input().split()] for y in range(n)]

dp = [[0 for x in range(w + 1)] for y in range(n+1)]

index = 1
for ww, vv in wv_array:
    for capacity in range(1, w + 1):
        if ww <= capacity:
            dp[index][capacity] = max(dp[index - 1][capacity - ww] + vv, dp[index-1][capacity])
        else:
            dp[index][capacity] = dp[index - 1][capacity]
    index += 1
print(max(dp[n]))