Buggy python submission (verdict: Runtime Error):
import sys
import os
f = open('input.txt', 'r')
sys.stdin = f

N, M = list(map(int, input().split()))
list_WA = [0] * N
list_Flag = [0] * N
for i in range(M):
  a, b = list(map(str, input().split()))
  a=int(a)
  if list_Flag[a-1] == 1:
      pass
  else:
    if b=='WA':
      list_WA[a-1]=list_WA[a-1]+1
    elif b=='AC':
      list_Flag[a-1]=1
    else:
      pass
WA=sum(list_WA)
AC=sum(list_Flag)
ans=[AC,WA]
print(' '.join(map(str, ans)))


Fixed submission:
N, M = list(map(int, input().split()))
list_WA = [0] * N
list_Flag = [0] * N
for i in range(M):
  a, b = list(map(str, input().split()))
  a=int(a)
  if not list_Flag[a-1] == 1:
    if b=='WA':
      list_WA[a-1]=list_WA[a-1]+1
    elif b=='AC':
      list_Flag[a-1]=1
penalty = [0] * N
for p in range(N):
    penalty[p]=list_WA[p]*list_Flag[p]
PE=sum(penalty)
AC=sum(list_Flag)
print(AC,PE)

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

Fixed submission:
N, M = list(map(int, input().split()))
list_WA = [0] * N
list_Flag = [0] * N
for i in range(M):
  a, b = list(map(str, input().split()))
  a=int(a)
  if not list_Flag[a-1] == 1:
    if b=='WA':
      list_WA[a-1]=list_WA[a-1]+1
    elif b=='AC':
      list_Flag[a-1]=1
penalty = [0] * N
for p in range(N):
    penalty[p]=list_WA[p]*list_Flag[p]
PE=sum(penalty)
AC=sum(list_Flag)
print(AC,PE)

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

Fixed submission:
N, M = list(map(int, input().split()))
list_WA = [0] * N
list_Flag = [0] * N
for i in range(M):
  a, b = list(map(str, input().split()))
  a=int(a)
  if not list_Flag[a-1] == 1:
    if b=='WA':
      list_WA[a-1]=list_WA[a-1]+1
    elif b=='AC':
      list_Flag[a-1]=1
penalty = [0] * N
for p in range(N):
    penalty[p]=list_WA[p]*list_Flag[p]
PE=sum(penalty)
AC=sum(list_Flag)
print(AC,PE)

Buggy python submission (verdict: Runtime Error):
N, M = list(map(int, input().split())) #問題数(リストサイズ）と提出数（ループ回数）を受ける
list_WA = [0] * N
list_Flag = [0] * N
for i in range(M):
  a, b = list(map(int, input().split()))
  if list_Flag[a-1] == 1:
	pass
  else:
    if b=='WA':
      list_WA[a-1]=list_WA[a-1]+1
    else:
      list_Flag[a-1]=list_Flag[a-1]+1
WA=sum(list_WA)
AC=sum(list_Flag)
ans=[AC,WA]
print(' '.join(map(str, ans)))

Fixed submission:
N, M = list(map(int, input().split()))
list_WA = [0] * N
list_Flag = [0] * N
for i in range(M):
  a, b = list(map(str, input().split()))
  a=int(a)
  if not list_Flag[a-1] == 1:
    if b=='WA':
      list_WA[a-1]=list_WA[a-1]+1
    elif b=='AC':
      list_Flag[a-1]=1
penalty = [0] * N
for p in range(N):
    penalty[p]=list_WA[p]*list_Flag[p]
PE=sum(penalty)
AC=sum(list_Flag)
print(AC,PE)