Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import math
from collections import deque

import time

n, m = map(int, input().split())

graph = []

for i in range(m):
  a, b = map(int, input().split())
  graph.append([a, b])
  
dist = [-1] * (n+1)
dist[0] = 0
dist[1] = 0

d = deque()
d.append(1)

guidepost = [-1] * (n+1)

while d:
  v = d.popleft()
  for i, j in graph:
    if dist[i] != -1 and dist[j] != -1:
      continue
    elif i == v:
      dist[j] = 1
      d.append(j)
      if guidepost[j] != -1:
        print("No")
        exit()
      else:
        guidepost[j] = v
    elif j == v:
      dist[i] = 1
      d.append(i)
      if guidepost[i] != -1:
        print("No")
        exit()
      else:
        guidepost[i] = v
  
for i in range(2, n+1):
  if guidepost[i] == -1:
    print("No")
    exit()

print("Yes")
for i in range(2, n+1):
  print(guidepost[i])

Fixed submission:
import math
from collections import deque

n, m = map(int, input().split())

graph = [[] for _ in range(n+1)]

for i in range(m):
  a, b = map(int, input().split())
  graph[a].append(b)
  graph[b].append(a)

flag = [0] * (n+1)
flag[0] = 1
flag[1] = 1

d = deque()
d.append(1)

guidepost = [-1] * (n+1)

while d:
  v = d.popleft()
  for i in graph[v]:
    if flag[i] != 0:
      continue
    flag[i] = 1
    d.append(i)
    if guidepost[i] != -1:
      print("No")
      exit()
    else:
      guidepost[i] = v
  
if not all(guidepost):
  print("No")
  exit()

ans = guidepost[2:]    

print("Yes")
print(*ans, sep="\n")

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

n, m = map(int, input().split())

graph = []

for i in range(m):
  a, b = map(int, input().split())
  graph.append([a, b])

dist = [-1] * (n+1)
dist[0] = 0
dist[1] = 0

d = deque()
d.append(1)

guidepost = [-1] * (n+1)

while d:
  v = d.popleft()
  for i, j in graph:
    if dist[i] != -1 and dist[j] != -1:
      continue
    elif i == v:
      dist[j] = dist[v] + 1
      d.append(j)
      if guidepost[j] == -1:
        guidepost[j] = v
      else:
        print("No")
        exit()
    elif j == v:
      dist[i] = dist[v] + 1
      d.append(i)
      if guidepost[i] == -1:
        guidepost[i] = v
      else:
        print("No")
        exit()
  
for i in range(2, len(guidepost)):
  if guidepost[i] == -1:
    print("No")
    exit()

print("Yes")
for i in range(2, len(guidepost)):
  print(guidepost[i])

Fixed submission:
import math
from collections import deque

n, m = map(int, input().split())

graph = [[] for _ in range(n+1)]

for i in range(m):
  a, b = map(int, input().split())
  graph[a].append(b)
  graph[b].append(a)

flag = [0] * (n+1)
flag[0] = 1
flag[1] = 1

d = deque()
d.append(1)

guidepost = [-1] * (n+1)

while d:
  v = d.popleft()
  for i in graph[v]:
    if flag[i] != 0:
      continue
    flag[i] = 1
    d.append(i)
    if guidepost[i] != -1:
      print("No")
      exit()
    else:
      guidepost[i] = v
  
if not all(guidepost):
  print("No")
  exit()

ans = guidepost[2:]    

print("Yes")
print(*ans, sep="\n")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10 ** 9)

x = int(input())

def per(year):
  if year == 0:
    return 100
  else:
    return int(per(year-1) * 1.01)
  
year = 0
while True:
  if per(year) >= x:
    print(year)
    break
  else:
    year += 1

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 9)

x = int(input())

def per(year):
  if year == 0:
    return 100
  else:
    return int(per(year-1) * 1.01)
  
year = 0
while True:
  if per(year) >= x:
    print(year)
    break
  else:
    year += 1
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))


for i in range(n-1):
  print(a.count(i+1))

print("0")

Fixed submission:
import collections
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)

for i in range(n-1):
  print(c[i+1])

print("0")

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

n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)

for i in range(n):
  print(c[a[i]])

Fixed submission:
import collections
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)

for i in range(n-1):
  print(c[i+1])

print("0")
Buggy python submission (verdict: Runtime Error):
from functools import lru_cache

n, m = map(int, input().split())
a = []
for i in range(m):
  a.append(int(input()))
  
@lru_cache(maxsize=100000)
def comb(n):
  if n in a:
    return 0
  elif n in (0, 1):
    return 1
  else:
    return (comb(n-1) + comb(n-2))%(10**9 + 7)

print(comb(n)%(10**9 + 7))

Fixed submission:
n, m = list(map(int,input().split()))
a = []
for i in range(m):
  a.append(int(input()))
c = [0] * (n+2) #combination
for i in a:
  c[i] = -1
c[0] = 1

for i in range(n):
    if c[i] < 0:
      continue
    if c[i+1] >= 0:
        c[i+1] = c[i] + c[i+1]
    if c[i+2] >= 0:
        c[i+2] = c[i] + c[i+2]
    c[i] = c[i] % 10**9+7
print(c[n]%(10**9+7))

Buggy python submission (verdict: Runtime Error):
from functools import lru_cache

n, m = map(int, input().split())
a = []
for i in range(m):
  a.append(int(input()))
  
@lru_cache(maxsize=100000)
def comb(n):
  if n in a:
    return 0
  elif n in (0, 1):
    return 1
  else:
    return (comb(n-1) + comb(n-2))

print(comb(n)%(10**9 + 7))

Fixed submission:
n, m = list(map(int,input().split()))
a = []
for i in range(m):
  a.append(int(input()))
c = [0] * (n+2) #combination
for i in a:
  c[i] = -1
c[0] = 1

for i in range(n):
    if c[i] < 0:
      continue
    if c[i+1] >= 0:
        c[i+1] = c[i] + c[i+1]
    if c[i+2] >= 0:
        c[i+2] = c[i] + c[i+2]
    c[i] = c[i] % 10**9+7
print(c[n]%(10**9+7))

Buggy python submission (verdict: Runtime Error):
from functools import lru_cache

n, m = map(int, input().split())
a = []
for i in range(m):
  a.append(int(input()))
  
@lru_cache(maxsize=100000)
def comb(n):
  if n in a:
    return 0
  if 1 not in a and n == 1:
    return 0
  elif n in (0, 1):
    return 1
  else:
    return (comb(n-1) + comb(n-2))

print(comb(n)%(10**9 + 7))

Fixed submission:
n, m = list(map(int,input().split()))
a = []
for i in range(m):
  a.append(int(input()))
c = [0] * (n+2) #combination
for i in a:
  c[i] = -1
c[0] = 1

for i in range(n):
    if c[i] < 0:
      continue
    if c[i+1] >= 0:
        c[i+1] = c[i] + c[i+1]
    if c[i+2] >= 0:
        c[i+2] = c[i] + c[i+2]
    c[i] = c[i] % 10**9+7
print(c[n]%(10**9+7))

Buggy python submission (verdict: Runtime Error):
from functools import lru_cache

n, m = map(int, input().split())
a = []
for i in range(m):
  a.append(int(input()))
  
@lru_cache(maxsize=100000)
def comb(n):
  for i in a:
    if n == i:
      return 0
  if a.count(1) == 0 and n == 1:
    return 1
  elif a.count(1) != 0 and n == 1:
    return 0
  elif n == 0:
    return 1
  else:
    return (comb(n-1) + comb(n-2))

print(comb(n)%(10**9 + 7))

Fixed submission:
n, m = list(map(int,input().split()))
a = []
for i in range(m):
  a.append(int(input()))
c = [0] * (n+2) #combination
for i in a:
  c[i] = -1
c[0] = 1

for i in range(n):
    if c[i] < 0:
      continue
    if c[i+1] >= 0:
        c[i+1] = c[i] + c[i+1]
    if c[i+2] >= 0:
        c[i+2] = c[i] + c[i+2]
    c[i] = c[i] % 10**9+7
print(c[n]%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [float('inf') for _ in range(n)]
dp[0] = 0


for i in range(n-1):
  for j in range(1, k+1):
    if i+j <= n-1 and dp[i] + abs(h[i+j]-h[i]) < dp[i+j]:
      dp[i+j] = dp[i] + abs(h[i+j]-h[i])

print(dp[n-1])

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

dp = [float('inf') for _ in range(n)]
dp[0] = 0


for i in range(n-1):
  for j in range(1, k+1):
    if i+j <= n-1 and dp[i] + abs(h[i+j]-h[i]) < dp[i+j]:
      dp[i+j] = dp[i] + abs(h[i+j]-h[i])

print(dp[n-1])
Buggy python submission (verdict: Runtime Error):
l = list(map(int, input().split()))
N = int(l[0])
K = int(l[1])
R1 = (N // K)
R2 = (N // (K // 2))
if K % 2 == 1:
  print(R1**3)
else:
  print(R2**3 - R2 * 5 - 3)

Fixed submission:
l = list(map(int, input().split()))
N = int(l[0])
K = int(l[1])
R1 = N // K
R2 = (N - (K // 2))// K + 1
if K % 2 == 1:
  print(R1**3)
else:
  print(R1**3 + R2**3)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
print("{} {}".format((A - 1) * (B - 1)))

Fixed submission:
l = list(map(int, input().split()))
print((l[0] - 1 ) * (l[1] - 1))

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
print("{} {}".format((A - 1)(B - 1)))

Fixed submission:
l = list(map(int, input().split()))
print((l[0] - 1 ) * (l[1] - 1))

Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
print(format((A - 1)(B - 1)))

Fixed submission:
l = list(map(int, input().split()))
print((l[0] - 1 ) * (l[1] - 1))

Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
print("{} {}".format((A - 1)(B - 1)))

Fixed submission:
l = list(map(int, input().split()))
print((l[0] - 1 ) * (l[1] - 1))
Buggy python submission (verdict: Runtime Error):
d,t,s　=　map(int,input.split())

if t <= d/s:
  print("Yes")
else:
  print("No")

Fixed submission:
##A - Don't be late
D,T,S = map(int,input().split())
if D / S <= T:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
##C - Sum of product of pairs
##累積和
N = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(N-1):
    ans += A[i]*sum(A[i+1:])
print(ans % (10**9+7))

Fixed submission:
##C - Sum of product of pairs
##累積和
N = int(input())
A = list(map(int,input().split()))
S = sum(A)
ans = 0
for i in range(N-1):
    ans += A[i]*(S - A[i])
    S -= A[i]
print(ans % (10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
##C - Sum of product of pairs
N = int(input())
A = list(map(int,input().split()))
import itertools
B = list(itertools.combinations(A,2))
print(sum (list(map(lambda x: x[0] * x[1], B))) % (10**9+7) )

Fixed submission:
##C - Sum of product of pairs
##累積和
N = int(input())
A = list(map(int,input().split()))
S = sum(A)
ans = 0
for i in range(N-1):
    ans += A[i]*(S - A[i])
    S -= A[i]
print(ans % (10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
##C - Sum of product of pairs
N = int(input())
A = list(map(int,input().split()))
import itertools
B = list(itertools.combinations(A,2))
ans = 0
for i in B:
    ans += i[0]*i[1]
print(ans % (10**9+7))

Fixed submission:
##C - Sum of product of pairs
##累積和
N = int(input())
A = list(map(int,input().split()))
S = sum(A)
ans = 0
for i in range(N-1):
    ans += A[i]*(S - A[i])
    S -= A[i]
print(ans % (10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
##C - Step(TLE)
N = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(N):
    ##print(i,A)
    if A != []:
        maxi = max(A)
        Idx = A.index(maxi)
        ans += maxi*(len(A) - Idx) - sum(A[Idx::])
        del A[Idx::]
    else:
        break
print(ans)

Fixed submission:
##C - Step(TLE)
N = int(input())
A = list(map(int,input().split()))
ans = 0
maxi = 0
for i in A:
    ans += max(0,maxi-i)
    maxi = max(maxi,i)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
##C - Step
N = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(N):
    ##print(i,A)
    if A != []:
        Idx = A.index(max(A))
        ans += max(A)*(len(A) - Idx) - sum(A[Idx::])
        del A[Idx::]
    else:
        break
print(ans)

Fixed submission:
##C - Step(TLE)
N = int(input())
A = list(map(int,input().split()))
ans = 0
maxi = 0
for i in A:
    ans += max(0,maxi-i)
    maxi = max(maxi,i)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
##C - Step
N = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(N):
    if A:
        Idx = A.index(max(A))
        ans += max(A)*(len(A) - Idx) - sum(A[Idx::])
        del A[Idx::]
    else:
        break
print(ans)

Fixed submission:
##C - Step(TLE)
N = int(input())
A = list(map(int,input().split()))
ans = 0
maxi = 0
for i in A:
    ans += max(0,maxi-i)
    maxi = max(maxi,i)
print(ans)
Buggy python submission (verdict: Runtime Error):
##B
N = int(input())
S = list(input() for i in range(N))
a=0
b=0
c=0
d=0
for i in S:
    if i =="AC":
        a +=1
    elif i =="WA":
        b +=1
    elif i =="TLE":
        c +=1
    elif i =="RE":
        d +=1
print("AC x "+ str(a))
print("WA x "+ str(b))
print("TLE x "+ str(c))
print("RE x "+ str(d))
AC x 3
WA x 1
TLE x 2
RE x 0

Fixed submission:
##B
N = int(input())
S = list(input() for i in range(N))
a=0
b=0
c=0
d=0
for i in S:
    if i =="AC":
        a +=1
    elif i =="WA":
        b +=1
    elif i =="TLE":
        c +=1
    elif i =="RE":
        d +=1
print("AC x "+ str(a))
print("WA x "+ str(b))
print("TLE x "+ str(c))
print("RE x "+ str(d))
Buggy python submission (verdict: Runtime Error):
##C
X,N = map(int,input().split())
P = list(map(int,input().split()))
i=0

while X+i<=100:
    if X+i not in P:
        ans1 = X+i
        break
    i += 1
while X-i>=-100:
    if X-i not in P:
        ans2 = X-i
        break
    i += 1
if ans1-X>=X-ans2:
    print(ans2)
else:
    print(ans1)

Fixed submission:
##C
X,N = map(int,input().split())
P = list(map(int,input().split()))
i=0
j = 0
while X+i<=101:
    if X+i not in P:
        ans1 = X+i
        break
    i += 1
while X-j>=-1:
    if X-j not in P:
        ans2 = X-j
        break
    j += 1
if ans1-X>=X-ans2:
    print(ans2)
else:
    print(ans1)

Buggy python submission (verdict: Runtime Error):
##C
X,N = map(int,input().split())
P = list(map(int,input().split()))
i=0

while X+i<=100:
    if X+i not in P:
        ans1 = X+i
        break
    i += 1
while X-i>=0:
    if X-i not in P:
        ans2 = X-i
        break
    i += 1
if ans1-X>=X-ans2:
    print(ans2)
else:
    print(ans1)

Fixed submission:
##C
X,N = map(int,input().split())
P = list(map(int,input().split()))
i=0
j = 0
while X+i<=101:
    if X+i not in P:
        ans1 = X+i
        break
    i += 1
while X-j>=-1:
    if X-j not in P:
        ans2 = X-j
        break
    j += 1
if ans1-X>=X-ans2:
    print(ans2)
else:
    print(ans1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
ans = 0
i=0
if A in 0:
  print(0)
else:
  while N > i:
  	if ans > 10**18:
    	print(-1)
        exit()
    else:
      ans *= A[i]
      i += 1
print(ans)

Fixed submission:
##169

##B
N = int(input())
A = list(map(int,input().split()))
ans = 1
i=0
if 0 in A:
  print(0)
else:
  while N > i:
    if ans <= 10**18:
        ans *= A[i]
        i += 1
    else:
        ans = -1
        break
  
  if ans > 10**18:
        print(-1)
  else:
    print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
ans = 0

if A in 0:
  print(0)
else:
  while N > i:
  	if ans > 10**18:
    	print(-1)
        exit()
    else:
      ans *= A[i]
print(ans)

Fixed submission:
##169

##B
N = int(input())
A = list(map(int,input().split()))
ans = 1
i=0
if 0 in A:
  print(0)
else:
  while N > i:
    if ans <= 10**18:
        ans *= A[i]
        i += 1
    else:
        ans = -1
        break
  
  if ans > 10**18:
        print(-1)
  else:
    print(ans)

Buggy python submission (verdict: Runtime Error):
N ＝　int(input())
A ＝　list(map(int,input().split()))

ans ＝　1
if A in 0:
  print(0)
else:
  while N > i:
    if ans <= 10**18:
      ans *= A[i]
    else:
      print(-1)
      exit()
print(ans)

Fixed submission:
##169

##B
N = int(input())
A = list(map(int,input().split()))
ans = 1
i=0
if 0 in A:
  print(0)
else:
  while N > i:
    if ans <= 10**18:
        ans *= A[i]
        i += 1
    else:
        ans = -1
        break
  
  if ans > 10**18:
        print(-1)
  else:
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
ans = 1
for i in range(N):
    ans *= A[i]
if ans > 10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
##169

##B
N = int(input())
A = list(map(int,input().split()))
ans = 1
i=0
if 0 in A:
  print(0)
else:
  while N > i:
    if ans <= 10**18:
        ans *= A[i]
        i += 1
    else:
        ans = -1
        break
  
  if ans > 10**18:
        print(-1)
  else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
##C
A,B = map(float,input().split())
A = int(A)
B = int(B.replace('.',''))
print((A*B)//100)

Fixed submission:
##C
A,B = map(str,input().split())
A = int(A)
B = int(B.replace('.',''))
print((A*B)//100)

Buggy python submission (verdict: Runtime Error):
##C
A,B = map(float,input().split())
A = int(A)
B = B.replace('.','')
print((A*B)//100)

Fixed submission:
##C
A,B = map(str,input().split())
A = int(A)
B = int(B.replace('.',''))
print((A*B)//100)
Buggy python submission (verdict: Runtime Error):
##E
X,Y,A,B,C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

psum = 0
plist = []

for i in range(X):
        plist.append(p[i])
for i in range(Y):
        plist.append(q[i])
        
plist.sort()
        
for i in range(C):
    if r[i] > plist[0]:
        plist.pop(i)
        plist.append(r[i])
    else:
        break
        
print(sum(plist))

Fixed submission:
##E
X,Y,A,B,C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

psum = 0

for i in range(X):
        r.append(p[i])
for i in range(Y):
        r.append(q[i])
        
r.sort(reverse=True)
ans = 0

for i in range(X+Y):
		ans += r[i]

        
print(ans)

Buggy python submission (verdict: Runtime Error):
##E
X,Y,A,B,C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

psum = 0
plist = []

for i in range(X):
        plist.append(p[i])
for i in range(Y):
        plist.append(q[i])
        
plist.sort()
        
for i in range(C):
    if r[i] > plist[0]:
        plist.pop(i)
        plist.append(r[i])
        
print(sum(plist))

Fixed submission:
##E
X,Y,A,B,C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

psum = 0

for i in range(X):
        r.append(p[i])
for i in range(Y):
        r.append(q[i])
        
r.sort(reverse=True)
ans = 0

for i in range(X+Y):
		ans += r[i]

        
print(ans)

Buggy python submission (verdict: Runtime Error):
##E
X,Y,A,B,C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

psum = 0

for i in range(X):
    if p[i] > r[0]:
        psum += p[i]
    else:
        psum += rsort[0]
        r.pop(0)
for i in range(Y):
    if q[i] > r[0]:
        psum += q[i]
    else:
        psum += r[0]
        r.pop(0)
print(psum)

Fixed submission:
##E
X,Y,A,B,C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

psum = 0

for i in range(X):
        r.append(p[i])
for i in range(Y):
        r.append(q[i])
        
r.sort(reverse=True)
ans = 0

for i in range(X+Y):
		ans += r[i]

        
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
##C
N = int(input())
S = list(input() for i in range(N))

import collections

c = collections.Counter(S)
ans = 0

if c.most_common()[0][1] == N:
    print(S[0])
else:
    for j in range(N):
        if c.most_common()[0][1] == c.most_common()[j][1]:
            ans += 1
        else:
            break
    ansl = list()
    for k in range(ans):
        ansl.append((c.most_common()[k][0]))
    ansl.sort()
    for l in ansl:
        print(l)

Fixed submission:
N = int(input())
S = list(input() for i in range(N))

import collections

c = collections.Counter(S)
max = max(c.values())
 
max_k_list = [kv[0] for kv in c.items() if kv[1] == max]
max_k_list.sort()
for l in max_k_list:
    print(l)

Buggy python submission (verdict: Runtime Error):
##C
N = int(input())
S = list(input() for i in range(N))

import collections

c = collections.Counter(S)
ans = 0
for j in range(N):
    if c.most_common()[0][1] == c.most_common()[j][1]:
        ans += 1
    else:
        break
ansl = list()
for k in range(ans):
    ansl.append((c.most_common()[k][0]))
ansl.sort()
for l in ansl:
    print(l)

Fixed submission:
N = int(input())
S = list(input() for i in range(N))

import collections

c = collections.Counter(S)
max = max(c.values())
 
max_k_list = [kv[0] for kv in c.items() if kv[1] == max]
max_k_list.sort()
for l in max_k_list:
    print(l)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = [input().split() for i in rabge(m)]
p = [int(i[0]) for i in a]
q = [j[1] for j in a]

ac = 0
wa = 0
wa_c = [0]*n
ac_c = [False]*n

for t in range(m):
    if ac_c[p[t]-1]:
        continue
    if q[t] == "AC":
        ac += 1
        ac_c[p[t]-1] = True
        wa += wa_c[p[t]-1]
    else:
        wa_c[p[t]-1] += 1
print(ac,wa)

Fixed submission:
n,m = map(int,input().split())
a = [input().split() for i in range(m)]
p = [int(i[0]) for i in a]
q = [j[1] for j in a]

ac = 0
wa = 0
wa_c = [0]*n
ac_c = [False]*n

for t in range(m):
    if ac_c[p[t]-1]:
        continue
    if q[t] == "AC":
        ac += 1
        ac_c[p[t]-1] = True
        wa += wa_c[p[t]-1]
    else:
        wa_c[p[t]-1] += 1
print(ac,wa)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
p = [0]*M
s = [a]*M
for i in range(M):
    p[i],s[i] = map(str,input().split())
pans = 0
sans = 0

for j in range(N):
    for k,val in enumerate(p):
        if val == str(j+1) and s[k] == "WA":
            sans += 1
        elif val == str(j+1) and s[k] == "AC":
            pans += 1
            break
print(pans,sans)

Fixed submission:
n,m = map(int,input().split())
a = [input().split() for i in range(m)]
p = [int(i[0]) for i in a]
q = [j[1] for j in a]

ac = 0
wa = 0
wa_c = [0]*n
ac_c = [False]*n

for t in range(m):
    if ac_c[p[t]-1]:
        continue
    if q[t] == "AC":
        ac += 1
        ac_c[p[t]-1] = True
        wa += wa_c[p[t]-1]
    else:
        wa_c[p[t]-1] += 1
print(ac,wa)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
p = [0]*M
s = [a]*M
for i in range(M):
    p[i],s[i] = map(str,input().split())
pans = 0
sans = 0

for j in range(N):
    for k,val in enumerate(p):
        if val == str(j+1) and s[k] == "WA":
            sans += 1
        elif val == str(j+1) and s[k] == "AC":
            pans += 1
            break
print(int(pans),int(sans))

Fixed submission:
n,m = map(int,input().split())
a = [input().split() for i in range(m)]
p = [int(i[0]) for i in a]
q = [j[1] for j in a]

ac = 0
wa = 0
wa_c = [0]*n
ac_c = [False]*n

for t in range(m):
    if ac_c[p[t]-1]:
        continue
    if q[t] == "AC":
        ac += 1
        ac_c[p[t]-1] = True
        wa += wa_c[p[t]-1]
    else:
        wa_c[p[t]-1] += 1
print(ac,wa)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
p = [0]*M
s = [a]*M
for i in range(M):
    p[i],s[i] = map(str,input().split())
pans = 0
sans = 0

for j in range(N):
    for k,val in enumerate(p):
        if val == str(j+1) and s[k] == "WA":
            sans += 1
        elif val == str(j+1) and s[k] == "AC":
            pans += 1
            break
print(pans,sans)

Fixed submission:
n,m = map(int,input().split())
a = [input().split() for i in range(m)]
p = [int(i[0]) for i in a]
q = [j[1] for j in a]

ac = 0
wa = 0
wa_c = [0]*n
ac_c = [False]*n

for t in range(m):
    if ac_c[p[t]-1]:
        continue
    if q[t] == "AC":
        ac += 1
        ac_c[p[t]-1] = True
        wa += wa_c[p[t]-1]
    else:
        wa_c[p[t]-1] += 1
print(ac,wa)