Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
L = [list(input().split()) for i in range(M)]
P = []
S = [0] * (N + 1)
for i in L:
  s, p = int(i[0]), i[1]
  if s not in P:
    if p == 'AC':
      P.append(s)
    else:
      S[s] += 1
A = sum([S[i] for i in P])
print(len(P), A)

Fixed submission:
N, M = map(int, input().split())
P = [0] * (N + 1)
S = [0] * (N + 1)
for i in range(M):
  x, p = input().split()
  s = int(x)
  if P[s] == 0:
    if p == 'AC':
      P[s] = 1
    else:
      S[s] += 1
A = sum([S[i] for i in range(N + 1) if P[i] == 1])
print(P.count(1), A)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
P = []
S = [0] * (N + 1)
for i in range(M):
  s, p = input().split()
  s = int(s)
  if s not in P:
    if p == 'AC':
      P.append(s)
    else:
      S[s] += 1
A = sum([S[i] for i in P])
print(len(P), A)

Fixed submission:
N, M = map(int, input().split())
P = [0] * (N + 1)
S = [0] * (N + 1)
for i in range(M):
  x, p = input().split()
  s = int(x)
  if P[s] == 0:
    if p == 'AC':
      P[s] = 1
    else:
      S[s] += 1
A = sum([S[i] for i in range(N + 1) if P[i] == 1])
print(P.count(1), A)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, M = map(int, input().split())
L = [list(input().split()) for i in range(M)]
AC = np.array([L[j] for j in range(M) if [L[j][0], 'AC'] not in L[:j]])
print(np.count_nonzero(AC == 'AC', axis = 1), np.count_nonzero(AC == 'WA', axis = 1))

Fixed submission:
N, M = map(int, input().split())
P = [0] * (N + 1)
S = [0] * (N + 1)
for i in range(M):
  x, p = input().split()
  s = int(x)
  if P[s] == 0:
    if p == 'AC':
      P[s] = 1
    else:
      S[s] += 1
A = sum([S[i] for i in range(N + 1) if P[i] == 1])
print(P.count(1), A)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
L = [list(input().split()) for i in range(M)]
AC = list(set([L[j][0] for j in range(M) if L[j][1] == 'AC']))
P = [L[:L.index([k, 'AC'])].count([k, 'WA']) for k in AC]
print(len(AC), sum(P))

Fixed submission:
N, M = map(int, input().split())
P = [0] * (N + 1)
S = [0] * (N + 1)
for i in range(M):
  x, p = input().split()
  s = int(x)
  if P[s] == 0:
    if p == 'AC':
      P[s] = 1
    else:
      S[s] += 1
A = sum([S[i] for i in range(N + 1) if P[i] == 1])
print(P.count(1), A)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
L = [list(input().split()) for i in range(M)]
AC = list(set([L[j][0] for j in range(M) if L[j][1] == 'AC']))
P = 0
for k in AC:
  P += L[:L.index([k, 'AC'])].count([k, 'WA'])
print(len(AC), P)

Fixed submission:
N, M = map(int, input().split())
P = [0] * (N + 1)
S = [0] * (N + 1)
for i in range(M):
  x, p = input().split()
  s = int(x)
  if P[s] == 0:
    if p == 'AC':
      P[s] = 1
    else:
      S[s] += 1
A = sum([S[i] for i in range(N + 1) if P[i] == 1])
print(P.count(1), A)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
L = [list(input().split()) for i in range(M)]
AC = list(set([L[j][0] for j in range(M) if L[j][1] == 'AC']))
P = 0
for k in AC:
  n = L.index([k, 'AC'])
  P += L[:n].count([k, 'WA'])
print(len(AC), P)

Fixed submission:
N, M = map(int, input().split())
P = [0] * (N + 1)
S = [0] * (N + 1)
for i in range(M):
  x, p = input().split()
  s = int(x)
  if P[s] == 0:
    if p == 'AC':
      P[s] = 1
    else:
      S[s] += 1
A = sum([S[i] for i in range(N + 1) if P[i] == 1])
print(P.count(1), A)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
L = [list(input().split()) for i in range(M)]
ac = [L[j][0] for j in range(M) if L[j][1] == 'AC']
AC = list(set(ac))
P = 0
for k in AC:
  n = L.index([k, 'AC'])
  P += L[:n].count([k, 'WA'])
print(len(AC), P)

Fixed submission:
N, M = map(int, input().split())
P = [0] * (N + 1)
S = [0] * (N + 1)
for i in range(M):
  x, p = input().split()
  s = int(x)
  if P[s] == 0:
    if p == 'AC':
      P[s] = 1
    else:
      S[s] += 1
A = sum([S[i] for i in range(N + 1) if P[i] == 1])
print(P.count(1), A)