Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
pS = [[0,0] for i in range(M)]
for i in range(M):
  pS[i]= list(map(str,input().split()))
p = [0]*M
S = [0]*M
for i in range(M):
  p[i] = pS[i][0]
  S[i] = pS[i][1]
NM = N*M
AC = [0]*NM
WA = [0]*NM
i = 0
while i < M:
  if S[i] == 'WA':
    if AC[int(p[i])] != 1:
      WA[int(p[i])] = WA[int(p[i])]+1
    i = i+1
  elif S[i] == 'AC':
    AC[int(p[i])]=1
    i = i+1
  else:
    i = i+1
print(sum(AC),sum(WA))

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

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
pS = [[0,0] for i in range(M)]
for i in range(M):
  pS[i]= list(map(str,input().split()))
p = [0]*M
S = [0]*M
for i in range(M):
  p[i] = pS[i][0]
  S[i] = pS[i][1]
NM = N*M
AC = [0]*NM
WA = [0]*NM
i = 0
while i < M:
  if S[i] == 'WA':
    if AC[int(p[i])] == 0:
      WA[int(p[i])] = WA[int(p[i])]+1
    i = i+1
  elif S[i] == 'AC':
    AC[int(p[i])]=1
    i = i+1
  else:
    i = i+1
print(sum(AC),sum(WA))

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

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
pS = [[0,0] for i in range(M)]
for i in range(M):
  pS[i]= list(map(str,input().split()))
p = [0]*M
S = [0]*M
for i in range(M):
  p[i] = pS[i][0]
  S[i] = pS[i][1]
NM = N*M
AC = [0]*NM
WA = [0]*NM
i = 0
while i < M:
  if S[i] != 'AC':
    if AC[int(p[i])] == 0:
      WA[int(p[i])] = WA[int(p[i])]+1
    i = i+1
  elif S[i] == 'AC':
    AC[int(p[i])]=1
    i = i+1
  else:
    i = i+1
print(sum(AC),sum(WA))

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

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
pS = [[0,0] for i in range(M)]
for i in range(M):
  pS[i]= list(map(str,input().split()))
p = [0]*M
S = [0]*M
for i in range(M):
  p[i] = pS[i][0]
  S[i] = pS[i][1]
AC = [0]*N
WA = [0]*N
i = 0
while i < M:
  if S[i] != 'AC':
    if AC[int(p[i])] == 0:
      WA[int(p[i])] = WA[int(p[i])]+1
    i = i+1
  elif S[i] == 'AC':
    AC[int(p[i])]=1
    i = i+1
  else:
    i = i+1
print(sum(AC),sum(WA))

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

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
p = [0]*M
S = [0]*M
pS = [[0,0] for i in range(M)]
for i in range(M):
  pS[i]= list(map(str,input().split()))
pS.sort()
for i in range(M):
  p[i] = pS[i,0]
  S[i] = PS[i,1]
AC = 0
WA = 0
p1 = '0'
i = 0
while i < M:
  if p[i] != p1 and S[i] != 'AC':
    WA = WA+1
    i = i+1
  elif p[i] != p1 and S[i] == 'AC':
    p1 = p[i]
    AC = AC+1
    i = i+1
  else:
    i = i+1
print(AC,WA)

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