Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
AC = 0
WA = 0
lis = [0] * N
for i in range(M):
  a,b = map(input().split())
  if lis[int(a)-1] < 0:
    pass
  elif b == 'AC':
    WA += lis[int(a)-1]
    AC += 1
    lis[int(a)-1] = -1
  else:
    lis[int(a)-1] += 1
print(AC, WA)


Fixed submission:
N,M = map(int,input().split())
AC = 0
WA = 0
lis = [0] * N
for i in range(M):
  a,b = input().split()
  if lis[int(a)-1] < 0:
    pass
  elif b == 'AC':
    WA += lis[int(a)-1]
    AC += 1
    lis[int(a)-1] = -1
  else:
    lis[int(a)-1] += 1
print(AC, WA)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
AC = 0
WA = 0
lis = [0] * N
for i in range(M):
  a,b = map(input().split())
  if lis[int(a)-1] < 0:
    pass
  elif b == 'AC'
    WA += lis[int(a)-1]
    AC += 1
    lis[int(a)-1] = -1
  else:
    lis[int(a)-1] += 1
print(AC, WA)

Fixed submission:
N,M = map(int,input().split())
AC = 0
WA = 0
lis = [0] * N
for i in range(M):
  a,b = input().split()
  if lis[int(a)-1] < 0:
    pass
  elif b == 'AC':
    WA += lis[int(a)-1]
    AC += 1
    lis[int(a)-1] = -1
  else:
    lis[int(a)-1] += 1
print(AC, WA)

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
AC = 0
WA = 0
lis_ac = []
dic_wa ={}
if M == 0:
  print(0,0)
else:
  A = [list(input().split()) for i in range(M)]
  A.sort(key = lambda x: int(x[0]))
  for i in range(M):
    if A[i][0] not in lis_ac:
      if A[i][1] == 'AC':
        lis_ac.append(A[i][0])
        if A[i][0] in dic_wa.keys():
          WA += dic_wa[A[i][0]]
      elif A[i][0] in dic_wa.keys():
        dic_wa[A[i][0]] += 1
      else:
        dic_wa[A[i][0]] = 1
  print(len(lis_ac), WA)


Fixed submission:
N,M = map(int,input().split())
AC = 0
WA = 0
lis = [0] * N
for i in range(M):
  a,b = input().split()
  if lis[int(a)-1] < 0:
    pass
  elif b == 'AC':
    WA += lis[int(a)-1]
    AC += 1
    lis[int(a)-1] = -1
  else:
    lis[int(a)-1] += 1
print(AC, WA)

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
AC = 0
WA = 0
lis_ac = []
dic_wa ={}
if M == 0:
  print(0,0)
else:
  A = [list(input().split()) for i in range(M)]
  for i in range(M):
    if A[i][0] not in lis_ac:
      if A[i][1] == 'AC':
        lis_ac.append(A[i][0])
        if A[i][0] in dic_wa.keys():
          WA += dic_wa[A[i][0]]
      elif A[i][0] in dic_wa.keys():
        dic_wa[A[i][0]] += 1
      else:
        dic_wa[A[i][0]] = 1
  print(len(lis_ac), WA)


Fixed submission:
N,M = map(int,input().split())
AC = 0
WA = 0
lis = [0] * N
for i in range(M):
  a,b = input().split()
  if lis[int(a)-1] < 0:
    pass
  elif b == 'AC':
    WA += lis[int(a)-1]
    AC += 1
    lis[int(a)-1] = -1
  else:
    lis[int(a)-1] += 1
print(AC, WA)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
AC = 0
WA = 0
lis_ac = []
dic_wa ={}
if M == 0:
  print(0,0)
else:
  A = [list(input().split()) for i in range(M)]
  for i in range(M):
    if A[i][0] not in lis_ac:
      if A[i][1] == 'AC':
        lis_ac.append(A[i][0])
        WA += dic_wa[A[i][0]]
      elif A[i][0] in dic_wa.keys():
        dic_wa[A[i][0]] += 1
      else:
        dic_wa[A[i][0]] = 1
  print(len(lis_ac), WA)


Fixed submission:
N,M = map(int,input().split())
AC = 0
WA = 0
lis = [0] * N
for i in range(M):
  a,b = input().split()
  if lis[int(a)-1] < 0:
    pass
  elif b == 'AC':
    WA += lis[int(a)-1]
    AC += 1
    lis[int(a)-1] = -1
  else:
    lis[int(a)-1] += 1
print(AC, WA)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
AC = 0
WA = 0
lis_ac = []
dic_wa ={}
if M == 0:
  print(0,0)
else:
  for i in range(M):
    A = list(input().split())
    if A[0] not in lis_ac:
      if A[1] == 'AC':
        lis_ac.append(A[0])
        WA += dic_wa[A[0]]
      elif A[0] in dic_wa.keys():
        dic_wa[A[0]] += 1
      else:
        dic_wa[A[0]] = 1
  print(len(lis_ac), WA)


Fixed submission:
N,M = map(int,input().split())
AC = 0
WA = 0
lis = [0] * N
for i in range(M):
  a,b = input().split()
  if lis[int(a)-1] < 0:
    pass
  elif b == 'AC':
    WA += lis[int(a)-1]
    AC += 1
    lis[int(a)-1] = -1
  else:
    lis[int(a)-1] += 1
print(AC, WA)