Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
bricks = [int(a) for a in input().split()]

result = 0
numbers = []
for i in range(1, n + 1):
  try:
    number_index = bricks.index(i)
    numbers.append(i)
    result = result + number_index
    del bricks[0:number_index+1]
  except:
    if len(numbers) != 0:
      result = result + len(bricks)
    break

if len(numbers) == 0:
  print(-1)
else:
  print(result)


Fixed submission:
import sys

n = int(input())
bricks = [int(a) for a in input().split()]

try:
  bricks.index(1)
except:
  print(-1)
  sys.exit()

result = 0
numbers = []
watch = 1
for i in range(n):
  if bricks[i] == watch:
    watch = watch + 1
  else:
    result = result + 1

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
bricks = [int(a) for a in input().split()]

result = 0
numbers = []
for i in range(1, n + 1):
  try:
    number_index = bricks.index(i)
    numbers.append(i)
    result = result + number_index
    for j in range(number_index + 1):
      bricks.pop(0)
  except:
    if len(numbers) != 0:
      result = result + len(bricks)
    break

if len(numbers) == 0:
  print(-1)
else:
  print(result)

Fixed submission:
import sys

n = int(input())
bricks = [int(a) for a in input().split()]

try:
  bricks.index(1)
except:
  print(-1)
  sys.exit()

result = 0
numbers = []
watch = 1
for i in range(n):
  if bricks[i] == watch:
    watch = watch + 1
  else:
    result = result + 1

print(result)
Buggy python submission (verdict: Time Limit Exceeded):
big = 10**18
n = int(input())
things = list(map(int, input().split()))
result = 1
for x in things:
	result *= x

print(-1) if result > big else print(result)

Fixed submission:
big = 10**18
n = int(input())
things = list(map(int, input().split()))
result = 1
good = True
if 0 in things:
	print(0)
else:
	for x in things:
		result *= x
		if result > big:
			print(-1)
			good = False
			break
	if good:
		print(result)

Buggy python submission (verdict: Time Limit Exceeded):
big = 10**18
bad = False
n = int(input())
start = 1
numbs = list(map(int, input().split()))
for x in numbs:
	start *= x
if start > big:
	bad = True


print(-1) if bad else print(start)

Fixed submission:
big = 10**18
n = int(input())
things = list(map(int, input().split()))
result = 1
good = True
if 0 in things:
	print(0)
else:
	for x in things:
		result *= x
		if result > big:
			print(-1)
			good = False
			break
	if good:
		print(result)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
withSnacks = []
for x in range(K):
  nUmsnakes = int(input)
  snakes = list(map(int, input().split()))
  withSnacks.extend(snakes)
withSnacks = list(set(withSnacks))
count = 0
for x in range(1, x + 1):
  if not x in withSnacks:
    count += 1

print(count)
  
    

Fixed submission:
N, K = map(int, input().split())
withSnacks = []
for x in range(K):
	nUmsnakes = int(input())
	snakes = list(map(int, input().split()))
	withSnacks.extend(snakes)
withSnacks = list(set(withSnacks))
count = 0
for x in range(1, N + 1):
	if not x in withSnacks:
		count += 1
 
print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
items = []
count = 0
for x in range(N):
  thing = input()
  if thing not x in items:
    count += 1
  	items.append(thing)
print(count)

Fixed submission:
N = int(input())
arr = []
for x in range(N):
  arr.append(input())

print(len(list(set(arr))))

Buggy python submission (verdict: Runtime Error):
N = int(input())
items = []
count = 0
for x in range(N):
  thing = input()
  if thing is not in items:
    count += 1
  items.append(thing)
print(count)

Fixed submission:
N = int(input())
arr = []
for x in range(N):
  arr.append(input())

print(len(list(set(arr))))
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

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

A.sort()

ans = 1
for a in A:
  ans = ans * a
  if ans > 1000000000000000000:
    print -1
    quit()

print(ans)


Fixed submission:
import sys
input = sys.stdin.readline

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

A.sort()

ans = 1
for a in A:
  ans = ans * a
  if ans > 1000000000000000000:
    print(-1)
    quit()

print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
root = [[] for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    root[A-1].append(B-1)
    root[B-1].append(A-1)
ans = [[-1, -1] for _ in range(N)]

def dfs(i, ib, l):
    global ans
    if ans[i][0] == -1 or l < ans[i][0]:
        ans[i][0] = l
        ans[i][1] = ib
        for next in root[i]:
            dfs(next, i, l+1)

dfs(0, 0, 0)
print("Yes")
for a in ans[1:]:
    print(a[1]+1)


Fixed submission:
N, M = map(int, input().split())
root = [[] for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    root[A-1].append(B-1)
    root[B-1].append(A-1)
ans = [[-1, -1] for _ in range(N)]

S = [[0, 0, 0]]

while len(S) > 0:
    S_ = []
    for s in S:
        if ans[s[0]][0] == -1 or s[2] < ans[s[0]][0]:
            ans[s[0]][0] = s[2]
            ans[s[0]][1] = s[1]
            for next in root[s[0]]:
                S_.append([next, s[0], s[2]+1])
    S = S_

print("Yes")
for a in ans[1:]:
    print(a[1]+1)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = [int(n)-1 for n in input().split()]

def step(pos, root, cnt, k, lst):
    if cnt == k:
        return pos
    if pos in root:
        return lst[root[pos] + (K-root[pos]) % (cnt-root[pos])]
    root[pos] = cnt
    lst.append(pos)
    cnt += 1
    return step(A[pos], root, cnt, k, lst)

print(step(0, {}, 0, K, []) + 1)


Fixed submission:
N, K = map(int, input().split())
A = [int(n)-1 for n in input().split()]

pos, root, cnt, lst = 0, {}, 0, []
while True:
    if cnt == K:
        ans = pos + 1
        break
    if pos in root:
        ans = lst[root[pos] + (K-root[pos]) % (cnt-root[pos])] + 1
        break
    root[pos] = cnt
    lst.append(pos)
    cnt += 1
    pos = A[pos]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
X = int(input())

def calc():
    A = 0
    while True:
        for i in [-1, 1]:
            A_ = A * i
            # B^5 = A^5 - X
            right = A_**5 - X
            if right >= 0:
                p = right**(-0.2)
            else:
                p = (-right)**(-0.2)
            if right >= 0:
                array = range(math.floor(p), math.ceil(p) + 1)
            else:
                array = range(-math.ceil(p), -math.floor(p) + 1)
            #print(A_, p, array)
            for B in array:
                left = B**5
                if left == right:
                    print(A_, B)
                    return
        A += 1

calc()


Fixed submission:
X = int(input())

def calc():
    for A in range(-200, 201, 1):
        for B in range(-200, 201, 1):
            if pow(A, 5) - pow(B, 5) == X:
                print(A, B)
                return

calc()

Buggy python submission (verdict: Time Limit Exceeded):
import math
X = int(input())

def calc():
    A = 0
    while True:
        for i in [-1, 1]:
            A_ = A * i
            # B^5 = A^5 - X
            right = A_**5 - X
            if right >= 0:
                p = right**(-0.2)
            else:
                p = (-right)**(-0.2)
            if right >= 0:
                array = range(math.floor(p) - 5, math.ceil(p) + 6)
            else:
                array = range(-math.ceil(p) - 5, -math.floor(p) + 6)
            #print(A_, p, array)
            for B in array:
                left = B**5
                if left == right:
                    print(A_, B)
                    return
        A += 1

calc()


Fixed submission:
X = int(input())

def calc():
    for A in range(-200, 201, 1):
        for B in range(-200, 201, 1):
            if pow(A, 5) - pow(B, 5) == X:
                print(A, B)
                return

calc()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A1 = [[-a-i,i] for i, a in enumerate(A)]
A2 = [[a-i,i] for i, a in enumerate(A)]
A1.sort()
A2.sort()
i = j = 0
cnt = 0
while i < N and j < N:
    if A1[i][0] == A2[j][0]:
        buf1 = 1
        for k in range(i+1, N):
            if A1[k][0] != A1[i][0]:
                break
            buf1 += 1
        buf2 = 1
        for k in range(j+1, N):
            if A2[k][0] != A2[j][0]:
                break
            buf2 += 1
        for i_ in range(i, i+buf1):
            for j_ in range(j, j+buf2):
                if A1[i_][1] < A2[j_][1]:
                    cnt += 1
        i += buf1
        j += buf2
    elif A1[i][0] < A2[j][0]:
        i += 1
    else:
        j += 1
print(cnt)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A1 = [[-a-i,i] for i, a in enumerate(A)]
A2 = [[a-i,i] for i, a in enumerate(A)]
A1.sort()
A2.sort()
i = j = 0
cnt = 0
while i < N and j < N:
    if A1[i][0] == A2[j][0]:
        buf1 = 1
        for k in range(i+1, N):
            if A1[k][0] != A1[i][0]:
                break
            buf1 += 1
        buf2 = 1
        for k in range(j+1, N):
            if A2[k][0] != A2[j][0]:
                break
            buf2 += 1
        cnt += buf1 * buf2
        i += buf1
        j += buf2
    elif A1[i][0] < A2[j][0]:
        i += 1
    else:
        j += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
cnt = 0
for i in range(N-1):
    for j in range(i+A[i]+1, N):
        if j-i == A[i] + A[j]:
            cnt += 1
print(cnt)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A1 = [[-a-i,i] for i, a in enumerate(A)]
A2 = [[a-i,i] for i, a in enumerate(A)]
A1.sort()
A2.sort()
i = j = 0
cnt = 0
while i < N and j < N:
    if A1[i][0] == A2[j][0]:
        buf1 = 1
        for k in range(i+1, N):
            if A1[k][0] != A1[i][0]:
                break
            buf1 += 1
        buf2 = 1
        for k in range(j+1, N):
            if A2[k][0] != A2[j][0]:
                break
            buf2 += 1
        cnt += buf1 * buf2
        i += buf1
        j += buf2
    elif A1[i][0] < A2[j][0]:
        i += 1
    else:
        j += 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
# 等間隔でなく3つとも異なる文字である組み合わせ数
Ir, Ig, Ib = [], [], []
Sr = Sg = Sb = 0
for i, c in enumerate(S):
    if c == 'R':
        Ir.append(i)
        Sr += 1
    elif c == 'G':
        Ig.append(i)
        Sg += 1
    else:
        Ib.append(i)
        Sb += 1
A = Sr * Sg * Sb
for ir in Ir:
    for ig in Ig:
        if 2*ig-ir in Ib:
            A -= 1
        if 2*ir-ig in Ib:
            A -= 1
        irg = ir+ig
        if irg%2 == 0 and irg//2 in Ib:
            A -= 1
print(A)


Fixed submission:
N = int(input())
S = input()
Sr = Sg = Sb = 0
for c in S:
    if c == 'R':
        Sr += 1
    elif c == 'G':
        Sg += 1
    else:
        Sb += 1
A = Sr * Sg * Sb
for sep in range(1,(N+1)//2):
    for i in range(N-2*sep):
        if S[i] != S[i+sep] and S[i+sep] != S[i+2*sep] and S[i] != S[i+2*sep]:
            A -= 1
print(A)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
B = []
s = [0, 0, 0]
for c in S[::-1]:
    s[['R', 'G', 'B'].index(c)] += 1
    B.append([s[0], s[1], s[2]])
B.reverse()
A = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        if S[i] == S[j]:
            continue
        D = [0, 1, 2]
        D.remove(['R', 'G', 'B'].index(S[i]))
        D.remove(['R', 'G', 'B'].index(S[j]))
        A += B[j+1][D[0]]
        n = 2*j-i
        if n < N and S[n] == ['R', 'G', 'B'][D[0]]:
            A -= 1
print(A)


Fixed submission:
N = int(input())
S = input()
Sr = Sg = Sb = 0
for c in S:
    if c == 'R':
        Sr += 1
    elif c == 'G':
        Sg += 1
    else:
        Sb += 1
A = Sr * Sg * Sb
for sep in range(1,(N+1)//2):
    for i in range(N-2*sep):
        if S[i] != S[i+sep] and S[i+sep] != S[i+2*sep] and S[i] != S[i+2*sep]:
            A -= 1
print(A)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
# 等間隔でなく3つとも異なる文字である組み合わせ数
Ir, Ig, Ib = [], [], []
for i, c in enumerate(S):
    if c == 'R':
        Ir.append(i)
    elif c == 'G':
        Ig.append(i)
    else:
        Ib.append(i)
A = 0
for ir in Ir:
    for ig in Ig:
        for ib in Ib:
            B = [ir, ig, ib]
            B.sort()
            if B[2] - B[1] != B[1] - B[0]:
                A += 1
print(A)


Fixed submission:
N = int(input())
S = input()
Sr = Sg = Sb = 0
for c in S:
    if c == 'R':
        Sr += 1
    elif c == 'G':
        Sg += 1
    else:
        Sb += 1
A = Sr * Sg * Sb
for sep in range(1,(N+1)//2):
    for i in range(N-2*sep):
        if S[i] != S[i+sep] and S[i+sep] != S[i+2*sep] and S[i] != S[i+2*sep]:
            A -= 1
print(A)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = [int(n) for n in input().split()]
A = [1 for _ in range(N)]

for _ in range(M):
    L, R = [int(n) for n in input().split()]
    for i in range(0, L-1, 1):
        A[i] = 0
    for i in range(R, N, 1):
        A[i] = 0

cnt = 0
for i in range(N):
    if A[i] == 1:
        cnt += 1

print(cnt)


Fixed submission:
N, M = [int(n) for n in input().split()]
left, right = 1, N

for _ in range(M):
    L, R = [int(n) for n in input().split()]
    if left < L:
        left = L
    if R < right:
        right = R

if left <= right:
    print(right - left + 1)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
V = [int(n) for n in input().split()]
C = [int(n) for n in input().split()]

take = [0 for _ in range(N)]
ans = 0

def up(i):
    if i == N:
        return False
    take[i] += 1
    if take[i] == 2:
        take[i] = 0
        return up(i + 1)
    return True

while True:
    sum = 0
    for i in range(N):
        if take[i] == 1:
            sum += V[i] - C[i]
    if sum > ans:
        ans = sum
    if not up(0):
        break

print(ans)


Fixed submission:
N = int(input())
V = [int(n) for n in input().split()]
C = [int(n) for n in input().split()]

ans = 0
for i in range(N):
    ans = max([ans, ans + V[i] - C[i]])

print(ans)
Buggy python submission (verdict: Runtime Error):
import re
inp = input().split()
print(re.sub("[^" + str(inp[1][int(inp[2]) - 1]) + "]", "*", inp[1]))

Fixed submission:
import re
N = input()
S = input().strip()
K = int(input())
print(re.sub("[^" + str(S[K - 1]) + "]", "*", S))
Buggy python submission (verdict: Runtime Error):

from collections import deque


def bfs(u):
    queue = deque([u])
    d = [None] * N  # uからの距離の初期化
    d[u] = 0  # 自分との距離は0
    ans = [0] * N
    while queue:
        v = queue.popleft()
        for i in g[v]:

            if d[i] is None:
                d[i] = d[v] + 1
                queue.append(i)
                ans[i] = v + 1
    return ans

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

for _ in range(M):
    a, b = [int(x) for x in input().split()]
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)

ans = bfs(0)
if 0 in ans[1:]:
    print('No')
else:
    print('Yes')
    for i in ans[1:]:
        print(i)


Fixed submission:

from collections import deque


def bfs(u):
    queue = deque([u])
    d = [None] * N  # uからの距離の初期化
    d[u] = 0  # 自分との距離は0
    ans = [0] * N
    while queue:
        v = queue.popleft()
        for i in g[v]:

            if d[i] is None:
                d[i] = d[v] + 1
                queue.append(i)
                ans[i] = v + 1
    return ans

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

for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)

ans = bfs(0)
if 0 in ans[1:]:
    print('No')
else:
    print('Yes')
    for i in ans[1:]:
        print(i)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(x) for x in input().split()]
for i in range(N):
    print(A.count(i+1))

Fixed submission:

N = int(input())
A = [int(x) for x in input().split()]
d = {}
for i in range(N-1):
    try:
        d[A[i]] += 1
    except:
        d[A[i]] = 1
for i in range(N):
    try:
        print(d[i+1])
    except:
        print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(x) for x in input().split()]
for i in range(N):
    print(A.count(i+1))

Fixed submission:

N = int(input())
A = [int(x) for x in input().split()]
d = {}
for i in range(N-1):
    try:
        d[A[i]] += 1
    except:
        d[A[i]] = 1
for i in range(N):
    try:
        print(d[i+1])
    except:
        print(0)
Buggy python submission (verdict: Runtime Error):
def check(x, A, B):
    if int(x * 0.08) == A and int(x * 0.1) == B:
        return True
    else:
        return False

def solve(A, B):
    left = 0
    right = 1250
    ans = []
    for i in range(0, 1251):
        if check(i, A, B):
            print(i)
            exit()
	print(-1)


def main():
    A, B = map(int, input().split())

    solve(A, B)

if __name__ == "__main__":
    main()

Fixed submission:
def check(x, A, B):
    if int(x * 0.08) == A and int(x * 0.1) == B:
        return True
    else:
        return False

def solve(A, B):
    left = 0
    right = 1250
    ans = []
    for i in range(0, 1251):
        if check(i, A, B):
            print(i)
            exit()
    print(-1)

def main():
    A, B = map(int, input().split())

    solve(A, B)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def solve(S, Q):
    flg = 0
    for i in range(Q):
        que = input().split()
        if len(que) == 1:
            flg += 1
        else:
            if flg % 2 == 0:
                if que[1] == '1':
                    S = que[2] + S
                elif que[1] == '2':
                    S = S + que[2]
            elif flg % 2 == 1:
                if que[1] == '1':
                    S = S + que[2]
                elif que[1] == '2':
                    S = que[2] + S
    if flg % 2 == 1:
        S = S[::-1]
    print(S)

def main():
    S = input()
    Q = int(input())
    solve(S, Q)

if __name__ == "__main__":
    main()

Fixed submission:
from collections import deque
def solve(S, Q):
    S = deque(S)
    flg = 0
    for _ in range(Q):
        que = input().split()
        if len(que) == 1:
            flg += 1
        else:
            if flg % 2 == 0:
                if que[1] == '1':
                    S.extendleft(que[2])
                elif que[1] == '2':
                    S.extend(que[2])
            elif flg % 2 == 1:
                if que[1] == '1':                 
                    S.extend(que[2])
                elif que[1] == '2':                
                    S.extendleft(que[2])
    S = ''.join(S)
    if flg % 2 == 1:
        S = S[::-1]
    print(S)

def main():
    S = input()
    Q = int(input())
    solve(S, Q)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def kitai(P):
    kitai = 0
    for i in range(len(P)):
        for j in range(1, P[i]+1):
            kitai += j / P[i]
    return kitai

N, K = map(int, input().split())
P = [int(x) for x in input().split()]
ans = 0
for i in range(K-1, N):
    ans = max(kitai(P[i-K+1:i+1]), ans)

print(ans)

Fixed submission:
N, K = map(int, input().split())
P = [int(x) for x in input().split()]
B = [0] * (N+1)
for i in range(1, N+1):
    B[i] = P[i-1] + B[i-1]
ans = 0
for i in range(K, N+1):
    ans = max(ans, B[i] - B[i-K])

print((ans+K)/2)
Buggy python submission (verdict: Time Limit Exceeded):

def solve(N, M, A):
    A = [[int(x[0]), x[1]] for x in A]

    Unsolve = [0]*(N+1)
    Solved = []
    ac = 0
    wa = 0
    for i in range(M):
        if A[i][0] not in Solved:
            if A[i][1] == 'WA':
                Unsolve[A[i][0]] += 1
            elif A[i][1] == 'AC':
                Solved.append(A[i][0])
                wa += Unsolve[A[i][0]]
                ac += 1

    return ac, wa

def main():
    N, M = map(int, input().split())
    A = [list(x for x in input().split()) for _ in range(M)]
    ans = solve(N, M, A)
    print(*ans)

if __name__ == "__main__":
    main()

Fixed submission:

def solve(N, M, A):

    A = [[int(x[0]), x[1]] for x in A]

    Unsolve = [0]*(N+1)
    Solved = set()
    ac = 0
    wa = 0
    for i in range(M):
        if A[i][0] not in Solved:
            if A[i][1] == 'WA':
                Unsolve[A[i][0]] += 1
            elif A[i][1] == 'AC':
                Solved.add(A[i][0])
                wa += Unsolve[A[i][0]]
                ac += 1

    return ac, wa

def main():
    N, M = map(int, input().split())
    A = [list(x for x in input().split()) for _ in range(M)]
    ans = solve(N, M, A)
    print(*ans)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):

def solve(N, M, A):

    Unsolve = [0]*(N+1)
    Solved = []
    ac = 0
    wa = 0
    for i in range(M):
        if A[i][0] not in Solved:
            if A[i][1] == 'WA':
                Unsolve[A[i][0]] += 1
            elif A[i][1] == 'AC':
                Solved.append(A[i][0])
                wa += Unsolve[A[i][0]]
                ac += 1
    return ac, wa

def main():
    N, M = map(int, input().split())
    A = [list(x for x in input().split()) for _ in range(M)]
    ans = solve(N, M, A)
    print(*ans)

if __name__ == "__main__":
    main()

Fixed submission:

def solve(N, M, A):

    A = [[int(x[0]), x[1]] for x in A]

    Unsolve = [0]*(N+1)
    Solved = set()
    ac = 0
    wa = 0
    for i in range(M):
        if A[i][0] not in Solved:
            if A[i][1] == 'WA':
                Unsolve[A[i][0]] += 1
            elif A[i][1] == 'AC':
                Solved.add(A[i][0])
                wa += Unsolve[A[i][0]]
                ac += 1

    return ac, wa

def main():
    N, M = map(int, input().split())
    A = [list(x for x in input().split()) for _ in range(M)]
    ans = solve(N, M, A)
    print(*ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):

def solve(N,K,R,S,P,T):
    check = [0]*N
    ans = 0
    for i in range(N):
        if i < K or T[i] != T[i-K] or not check[i-K]:
            ans += P if T[i] == 'r' else R if T[i] == 's' else S
            check[i] = 1
    print(ans)

def main():
    N, K = map(int, input().split())
    R, S, P = map(int, input().split())
    T = input()
    solve()

if __name__ == "__main__":
    main()

Fixed submission:
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
check = [0]*N
ans = 0
for i in range(N):
    if i < K or T[i] != T[i-K] or not check[i-K]:
        ans += P if T[i] == 'r' else R if T[i] == 's' else S
        check[i] = 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
l = list(map(int, input().split()))
ans = [1 if i >= K else 0 for i in l]
print(sum(ans))

Fixed submission:
import math
N = int(input())

print(math.ceil(N/2)/N)

Buggy python submission (verdict: Runtime Error):
import math
print(math.ceil(int(input()) // 2) / int(input()))

Fixed submission:
import math
N = int(input())

print(math.ceil(N/2)/N)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
l = [map(int, input().spilt())]
ans = [i if i >= K for i in l]
print(len(ans))

Fixed submission:
N, K = map(int, input().split())
l = list(map(int, input().split()))
ans = [1 if i >= K else 0 for i in l]
print(sum(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

a = list(map(int, input().split()))
for i in range(M):
    k = a.index(max(a))
    a[k] //= 2

print(sum(a))

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

a = list(map(lambda x: -int(x), input().split()))
heapq.heapify(a)

for i in range(M):
    heapq.heappush(a, int(heapq.heappop(a)/2))

print(-sum(a))

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

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

for i in range(M):
    A.sort()
    A[-1] = A[-1] // 2
print(sum(A))

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

a = list(map(lambda x: -int(x), input().split()))
heapq.heapify(a)

for i in range(M):
    heapq.heappush(a, int(heapq.heappop(a)/2))

print(-sum(a))