Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())

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

ans = [0]*N
[ans[j-1]=i+1 for i,j in enumerate(A)]
print(*ans)

Fixed submission:
N = int(input())

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

ans = [0]*N
for i,j in enumerate(A):
    ans[j-1]=i+1
print(*ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())

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

ans = [0]*N
[ans[i-1]=i+1 for i, j in range(N)]
print(*ans)

Fixed submission:
N = int(input())

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

ans = [0]*N
for i,j in enumerate(A):
    ans[j-1]=i+1
print(*ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())

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

ans = []
[ans.append(j+1) for i, j in enumarate(A)]
print(*ans)

Fixed submission:
N = int(input())

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

ans = [0]*N
for i,j in enumerate(A):
    ans[j-1]=i+1
print(*ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())

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

ans = []
[ans.extend(A.index(i)+1) for i in range(1,N+1)]
print(*ans)

Fixed submission:
N = int(input())

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

ans = [0]*N
for i,j in enumerate(A):
    ans[j-1]=i+1
print(*ans)

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

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

ans = []
[ans.append(A.index(i)+1) for i in range(1,N+1)]
print(*ans)

Fixed submission:
N = int(input())

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

ans = [0]*N
for i,j in enumerate(A):
    ans[j-1]=i+1
print(*ans)

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

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

for i in range(1,N+1):
    #print(i)
    print(A.index(i)+1, end=" ")

Fixed submission:
N = int(input())

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

ans = [0]*N
for i,j in enumerate(A):
    ans[j-1]=i+1
print(*ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())

A = list(map(int, input().split()))
ans=[]
for i in range(1,N):
    ans.append(A.index(i))

print(' '.join(map(str,ans))

Fixed submission:
N = int(input())

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

ans = [0]*N
for i,j in enumerate(A):
    ans[j-1]=i+1
print(*ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
s = input()

for i in range(0,len(s)):
  if (i%2==1)and(s[i]=="L"):
    print("No")
    exit()
  elif (i%2==0)s[i]=="R":
    print("No")
    exit()
print("Yes")

Fixed submission:
# -*- coding: utf-8 -*-
s = input()

for i in range(0,len(s)):
  if (i%2==0)and(s[i]=="L"):
    print("No")
    exit()
  elif (i%2==1)and(s[i]=="R"):
    print("No")
    exit()
print("Yes")
Buggy python submission (verdict: Runtime Error):
import heapq
n, m = map(int, input().split())

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

for i in range(m):
    heapq.heappush(a, int(heapq.heappop(a)/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: Runtime Error):
inputs = map(int, input().split(" "))

is_denied = False
for i in inputs:
  if i % 2 ==0:
    if i % 3 != 3 or i % 5 != 5
    	is_denied = True
      
if is_denied:
  print("DENIED")
else:
  print("APPROVED")

Fixed submission:
input()
inputs = map(int, input().split(" "))

is_denied = False
for i in inputs:
  if i % 2 ==0 and ( i % 3 != 0 and i % 5 != 0):
      is_denied = True
      
if is_denied:
  print("DENIED")
else:
  print("APPROVED")

Buggy python submission (verdict: Runtime Error):
inputs = map(int, input.split(" "))

is_denied = False

for i in inputs:
  if i % 2 ==0:
    if i % 3 != 0 or i % 5 == 0:
      is_denied = True
      

if is_denied:
  print("DENIED")
else:
  print("APPROVED")

Fixed submission:
input()
inputs = map(int, input().split(" "))

is_denied = False
for i in inputs:
  if i % 2 ==0 and ( i % 3 != 0 and i % 5 != 0):
      is_denied = True
      
if is_denied:
  print("DENIED")
else:
  print("APPROVED")
Buggy python submission (verdict: Runtime Error):
N = int(input())

hash = {}
for i in range(N):
	key = input()
	if key in hash:
		hash[key] += 1
	else:
		hash[key] = 1
        
max = 0
results = []
for i, v in hash.items():
	if max == v:
		results.append(v)
	elif max < v::
		results = [v]
        
for i in results:
	print(v)


Fixed submission:
N = int(input())

hash = {}
for i in range(N):
	key = input()
	if key in hash:
		hash[key] += 1
	else:
		hash[key] = 1
        
max = 0
results = []
for i, v in hash.items():
	if max == v:
		results.append(i)
	elif max < v:
		results = [i]
		max = v

results.sort()
for i in results:
	print(i)
Buggy python submission (verdict: Runtime Error):
a = input().split()
a2 = 0
for i in range(len(a)):
    a2 += int(a[i])
print(a2)
if a2 >= bust:
    print('win')
elif a2 <= 21:
    print('win')

Fixed submission:
a = input().split()
a2 = 0
for i in range(len(a)):
    a2 += int(a[i])
#print(a2)
if a2 >= 22:
    print('bust')
elif a2 <= 21:
    print('win')
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
H = list(map(int,input().split()))
ans = 0

if N <= K:
  print(ans)
else:
  H.sort(reverse=True)
  for i in range(K):
    H.pop(0)
  ans = sum(H)
  print(ans)

Fixed submission:
N,K = map(int,input().split())
H = list(map(int,input().split()))
ans = 0

if N <= K:
  print(ans)
else:
  H.sort(reverse=True)
  del H[:K]
  ans = sum(H)
  print(ans)
Buggy python submission (verdict: Runtime Error):
a,b = int(input().split())

if a <= 8 and b <= 8:
  print('Yay!')
else:
  print(':(')

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

if a <= 8 and b <= 8:
  print('Yay!')
else:
  print(':(')
Buggy python submission (verdict: Time Limit Exceeded):
import collections
import sys

N = int(input())
S = [input() for _ in range(N)]
# print(S)
if len(set(S)) == 1:
    print(S[0])
    sys.exit(0)
c = collections.Counter(S)
# print(c.most_common())

outputs = []
for i, (key, value) in enumerate(c.most_common()):
    outputs.append(key)
    if i == len(c.most_common())-1 or c.most_common()[i+1][1] != value:
        break
outputs.sort()
for x in outputs:
    print(x)

Fixed submission:
N = int(input())
S = [input() for _ in range(N)]
S.sort()

ans = []
counter = 1
memo = 0

for i in range(1, N):
    if S[i] == S[i-1]:
        counter += 1
    else:
        if counter == memo:
            ans.append(S[i-1])
        elif counter > memo:
            ans.clear()
            ans.append(S[i-1])
            memo = counter
        counter = 1
if counter == memo:
    ans.append(S[N-1])
elif counter > memo:
    ans.clear()
    ans.append(S[N-1])
    memo = counter
for a in ans:
    print(a)

Buggy python submission (verdict: Time Limit Exceeded):
import collections

N = int(input())
S = [input() for _ in range(N)]
# print(S)

c = collections.Counter(S)
# print(c.most_common())

outputs = []
for i, (key, value) in enumerate(c.most_common()):
    outputs.append(key)
    if i == len(c.most_common())-1 or c.most_common()[i+1][1] != value:
        break
outputs.sort()
for x in outputs:
    print(x)
    

Fixed submission:
N = int(input())
S = [input() for _ in range(N)]
S.sort()

ans = []
counter = 1
memo = 0

for i in range(1, N):
    if S[i] == S[i-1]:
        counter += 1
    else:
        if counter == memo:
            ans.append(S[i-1])
        elif counter > memo:
            ans.clear()
            ans.append(S[i-1])
            memo = counter
        counter = 1
if counter == memo:
    ans.append(S[N-1])
elif counter > memo:
    ans.clear()
    ans.append(S[N-1])
    memo = counter
for a in ans:
    print(a)

Buggy python submission (verdict: Runtime Error):
import collections
import sys

N = int(input())
S = [input() for _ in range(N)]
# print(S)

c = collections.Counter(S)
# print(c.most_common())

outputs = []
for i, (key, value) in enumerate(c.most_common()):
    outputs.append(key)
    if not (i == len(c.most_common())-1 and c.most_common()[i+1][1] == value):
        break
for x in reversed(outputs):
    print(x)
    

Fixed submission:
N = int(input())
S = [input() for _ in range(N)]
S.sort()

ans = []
counter = 1
memo = 0

for i in range(1, N):
    if S[i] == S[i-1]:
        counter += 1
    else:
        if counter == memo:
            ans.append(S[i-1])
        elif counter > memo:
            ans.clear()
            ans.append(S[i-1])
            memo = counter
        counter = 1
if counter == memo:
    ans.append(S[N-1])
elif counter > memo:
    ans.clear()
    ans.append(S[N-1])
    memo = counter
for a in ans:
    print(a)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

print(S+T)

Fixed submission:
S, T = input().split()
print(T+S)
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input())

if a*b % 2 == 0:
  print('Even')
else:
  print('Odd')

Fixed submission:
a, b = map(int, input().split())
if a*b % 2 == 0:
    print('Even')
else:
    print('Odd')
Buggy python submission (verdict: Runtime Error):
x=int(input())
if x==3||x==5||x==7:
  print("YES")
else:
  print("NO")


Fixed submission:
x=int(input())
if x==3 or x==5 or x==7:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
N=int(input())
l = [int(input()) for i in range(1,n+1)]
print(len(set(l)))

Fixed submission:
N = int(input())
d = [input() for i in range(N)]
print(len(set(d)))
Buggy python submission (verdict: Runtime Error):
N,Y=map(int,input().split())
res=(-1,-1,-1)
for x in range(N+1):
    for y in range(N+1-x);
    if N-x-y>=0 and 10000*x+5000*y+1000*(N-x-y)==Y:
        res=(x,y,N-x-y)
print(res[0],res[1],res[2])

Fixed submission:
N, Y = map(int, input().split())
res = (-1, -1, -1)
for x in range(N + 1):
    for y in range(N + 1 - x):
        if N - x - y >= 0 and 10000*x + 5000*y + 1000*(N - x - y) == Y:
            res = (x, y, N - x - y)
print(res[0], res[1], res[2])
Buggy python submission (verdict: Runtime Error):
print(input.count("1"))

Fixed submission:
print(input().count("1"))
Buggy python submission (verdict: Runtime Error):
H, A = int(input().split())

ans = -(-H // A)

print(ans)

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

ans = -(-H // A)

print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
results = [input().split() for _ in range(M)]
solved = set()
missed = dict()
penalty = 0

for p, S in results:
    if p in solved:
        continue

    if S == 'AC':
        solved.add(p)
        penalty += missed[p]
    elif p not in missed:
        missed[p] = 1
    else:
        missed[p] += 1

print(len(solved), penalty)

Fixed submission:
N, M = map(int, input().split())
results = [input().split() for _ in range(M)]
solved = set()
missed = dict()
penalty = 0

for p, S in results:
    if p in solved:
        continue

    if S == 'AC':
        solved.add(p)
        penalty += missed[p] if p in missed else 0
    else:
        missed[p] = missed[p] + 1 if p in missed else 1

print(len(solved), penalty)
Buggy python submission (verdict: Runtime Error):
from collections import deque
from itertools import chain
from math import inf

H, W = map(int, input().split())
maze = [list(input()) for _ in range(H)]
directions = [(1, 0), (0, 1), (-1, 0), (0, -1)]


def bfs(start):
    queue = deque()
    queue.append(start)

    distance = [[inf] * W for _ in range(H)]
    sx, sy = start
    distance[sx][sy] = 0

    while len(queue) > 0:
        x, y = queue.popleft()
        for dx, dy in directions:
            nx = x + dx
            ny = y + dy
            if nx >= 0 and nx < H and ny >= 0 and ny < W and maze[nx][ny] == '.' and distance[nx][ny] == inf:
                queue.append((nx, ny))
                distance[nx][ny] = distance[x][y] + 1

    return max(filter(lambda d: d != inf, chain.from_iterable(distance)))


ans = 0
for i in range(H):
    for j in range(W):
        if maze[i][j] == '.':
            ans = max(ans, bfs((i, j)))

print(ans)

Fixed submission:
from collections import deque
from itertools import chain

H, W = map(int, input().split())
maze = [list(input()) for _ in range(H)]
directions = [(1, 0), (0, 1), (-1, 0), (0, -1)]
max_d = 400


def bfs(start):
    queue = deque()
    queue.append(start)

    distance = [[max_d] * W for _ in range(H)]
    sx, sy = start
    distance[sx][sy] = 0

    while len(queue) > 0:
        x, y = queue.popleft()
        for dx, dy in directions:
            nx = x + dx
            ny = y + dy
            if nx >= 0 and nx < H and ny >= 0 and ny < W and maze[nx][ny] == '.' and distance[nx][ny] == max_d:
                queue.append((nx, ny))
                distance[nx][ny] = distance[x][y] + 1

    return max(filter(lambda d: d != max_d, chain.from_iterable(distance)))


ans = 0
for i in range(H):
    for j in range(W):
        if maze[i][j] == '.':
            ans = max(ans, bfs((i, j)))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())
score = {'r': P, 'p': S, 's': R}
ans = 0

for i in range(N):
    count = 0
    k = K
    while i - k >= 0 and T[i] == T[i - k]:
        count += 1
        k += K

    if count % 2 == 0:
        ans += score[T[i]]

print(ans)

Fixed submission:
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())
score = {'r': P, 'p': S, 's': R}
ans = 0

for i in range(K):
    flag = True

    while i < N:
        if i >= K and T[i] == T[i-K]:
            flag = not flag
        else:
            flag = True

        if flag:
            ans += score[T[i]]

        i += K

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())
score = {'r': P, 'p': S, 's': R}
ans = 0

for i in range(N):
    flag = True
    for j in range(i // K - 1, -1, -1):
        if T[i - K * j] == T[i - K * (j + 1)]:
            flag = not flag
        else:
            flag = True

    if flag:
        ans += score[T[i]]

print(ans)

Fixed submission:
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())
score = {'r': P, 'p': S, 's': R}
ans = 0

for i in range(K):
    flag = True

    while i < N:
        if i >= K and T[i] == T[i-K]:
            flag = not flag
        else:
            flag = True

        if flag:
            ans += score[T[i]]

        i += K

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for _ in range(N)]
current = 0
ans = 0

while True:
    current = A[current] - 1
    ans += 1
    if current == 0:
        print(-1)
        break

    if current == 1:
        print(ans)
        break

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]
current = 0
visited = {0}
ans = 0

while True:
    current = A[current] - 1
    ans += 1

    if current in visited:
        print(-1)
        break

    if current == 1:
        print(ans)
        break

    visited.add(current)
Buggy python submission (verdict: Runtime Error):
import math

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

if gcd == 1 and C != 0 or gcd != 1 and math.gcd(gcd, C) != 1:
    print('YES')
else:
    print('NO')

Fixed submission:
import fractions

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

if gcd == 1 and C != 0 or gcd != 1 and fractions.gcd(gcd, C) != 1:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
ans = 0

for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x + y + z == S:
                ans += 1

print(ans)

Fixed submission:
K, S = map(int, input().split())
ans = 0

for x in range(K+1):
    for y in range(K+1):
        if S - (x + y) <= K and S - (x + y) >= 0:
            ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
l = [*map(int, input().split())]
l.sort()
if l[0] != l[2] and (l[0] == l[1] or l[1] == l[2]):
    print("Yes")
else:
    print("No")

Fixed submission:
a, b, c = map(int, input().split())
if (a == b and a != c) or (a ==c and a != b) or (b == c and b != a):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
l = [*map(int, input().split())]
l.sort()
if l[0] == l[1] and l[0] != l[2]:
    print("YES")
elif l[0] == l[2] and l[0] != l[1]:
    print("YES")
else:
    print("NO")

Fixed submission:
a, b, c = map(int, input().split())
if (a == b and a != c) or (a ==c and a != b) or (b == c and b != a):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split())
if sum(a)>=22:
    print("bust")
else:
    print("win")

Fixed submission:
a = list(map(int, input().split()))
if sum(a)>=22:
    print("bust")
else:
    print("win")

Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split())
if sum(a)>=22:
    print(bust)
else:
    print(win)

Fixed submission:
a = list(map(int, input().split()))
if sum(a)>=22:
    print("bust")
else:
    print("win")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split())
s = [0] * n
for i,j in enumerate(a):
    s[j-1] = i+1
print(*s)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = [0] * n
for i in range(n):
    s[a[i]-1] += i+1 
print(*s)
Buggy python submission (verdict: Runtime Error):
n = int(input())
lista = [4:101:4]
listb = [7:101:7]
flag = False
for i in lista:
    for j in listb:
        if i+j == n:
            flag = True
            break
if flag:
    print('Yes')
else:
    print('No')    


Fixed submission:
n = int(input())
lista = [4*i for i in range((100//4)+1)]
listb = [7*i for i in range((100//7)+1)]
flag = False
for i in lista:
    for j in listb:
        if i+j == n:
            flag = True
if flag:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
n = int(input())
lista = [4:101:4]
listb = [7:101:7]
flag = False
for i in lista:
    for j in listb:
        if i+j == n:
            flag = True
            break
if flag:
    print('Yes')
else:
    print('No')    


Fixed submission:
n = int(input())
lista = [4*i for i in range((100//4)+1)]
listb = [7*i for i in range((100//7)+1)]
flag = False
for i in lista:
    for j in listb:
        if i+j == n:
            flag = True
if flag:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split()))
s = sorted(a).reverse
ans = [s[i+1]-s[i] for i in range(2)]
print(sum(ans))

Fixed submission:
a = list(map(int, input().split()))
s = sorted(a, reverse=True)
ans = [s[i]-s[i+1] for i in range(2)]
print(sum(ans))
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
ss = s+s+s
f=0
for i in range(len(s)):
    if ss[i:len(s)+i] == t:
    f = 1
if f:
    print("Yes")
else:
    print("No")


Fixed submission:
s = input()
t = input()
ss = s+s
f=0
for i in range(len(s)):
    if ss[i:len(s)+i] == t:
        f = 1
if f:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
ss = s+s
f=0
for i in range(len(s)):
    if ss[i:len(s)+i] == t:
    f = 1
if f:
    print("Yes")
else:
    print("No")


Fixed submission:
s = input()
t = input()
ss = s+s
f=0
for i in range(len(s)):
    if ss[i:len(s)+i] == t:
        f = 1
if f:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):

num = input()
a = input().split()
flag = 0
for item in a:
    if item%2==0:
        if item%3==0 or item%5==0:
            pass
        else:
            flag=1

if flag==0:
    print("APPROVED")
else:
    print("DENIED")

Fixed submission:

num = input()
a = input().split()
flag = 0
for item in a:
    item=int(item)
    if item%2==0:
        if item%3==0 or item%5==0:
            pass
        else:
            flag=1

if flag==0:
    print("APPROVED")
else:
    print("DENIED")
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input.split())

if a == b == c:
  print('No')
elif a != b and a != c and b != c:
  print('No')
else:
  print('Yes')

Fixed submission:
a, b, c  = (int(x) for x in input().split())
 
if a == b == c:
  print('No')
elif a != b and a != c and b != c:
  print('No')
else:
  print('Yes')

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

if a == b == c:
  print('No')
elif a != b and a != c and b != c:
  print('No')
else:
  print('Yes')

Fixed submission:
a, b, c  = (int(x) for x in input().split())
 
if a == b == c:
  print('No')
elif a != b and a != c and b != c:
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
n = int(input().split())

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

flag == True

for i in range(n):
  if a[i]%2 == 0:
    if a[i]%3 != 0 or a[i]%5 != 0:
      print('DENIED')
      flag = False
      break
      
if flag:
  print('APPROVED')


Fixed submission:
n = int(input())

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

flag = True

for i in range(n):
  if a[i]%2 == 0:
    if a[i]%3 != 0 and a[i]%5 != 0:
      print('DENIED')
      flag = False
      break
      
if flag:
  print('APPROVED')
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
 
p = list(map(int, input().split()))
 
p = [(e+1) / 2 for e in p]
 
s = sum(p[0:k])
s_max = s
 
for i in range(n-k):
  s = s - p[i] + p[i+k]
  if s_max < s:
    s_max = s
    
print(s_max)

Fixed submission:
s, t = map(str, input().split())

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

u = input()

if u == t:
  b = b -1
else:
  a = a -1
  
print(a,b)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

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

Flag = True

for i in range(n):
  for j in range(n):
    if i != j and a[i] == a[j]:
      print('NO')
      Flag = False
      break
  if Flag == False:
    break
if Flag:
  print('YES')

Fixed submission:
n = int(input())

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

Flag = True

a = sorted(a)

for i in range(n-1):
  if a[i] == a[i+1]:
    print('NO')
    Flag = False
    break
  
if Flag:
  print('YES')