Buggy python submission (verdict: Runtime Error):
N,M = map(int, input().split())
A = {}
C = 0
P = 0
for i in range(M):
    p,S = map(str, input().split())
    if S == 'AC' and A.get(p+S) is None:
        A[p+S] = 0
        C += 1
    elif S == 'WA' and A.get(p+'AC') is None and A.get(p+S) is None:
        A[p+S] = 1
    elif S == 'WA' and A.get(p+'AC') is None:
        A[p+S] += 1
for i in range(1,N+1):
    if A.get(str(i)+'AC') is not None:
        P += A[str(i)+'WA']
print(C,P)

Fixed submission:
N,M = map(int, input().split())
A = {}
C = 0
P = 0
for i in range(M):
    p,S = map(str, input().split())
    if S == 'AC' and A.get(p+S) is None:
        A[p+S] = 0
        C += 1
    elif S == 'WA' and A.get(p+'AC') is None and A.get(p+S) is None:
        A[p+S] = 1
    elif S == 'WA' and A.get(p+'AC') is None:
        A[p+S] += 1
for i in range(1,N+1):
    if A.get(str(i)+'AC') is not None and A.get(str(i)+'WA') is not None:
        P += A[str(i)+'WA']
print(C,P)

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
L = []
C = 0
P = 0
for i in range(M):
    p,S = map(str, input().split())
    if S == 'AC' and [p,S] not in L:
        L.append([p,S])
        C += 1
    elif S == 'WA' and [p,'AC'] not in L:
        L.append([p,S])
        P += 1
print(C,P)

Fixed submission:
N,M = map(int, input().split())
A = {}
C = 0
P = 0
for i in range(M):
    p,S = map(str, input().split())
    if S == 'AC' and A.get(p+S) is None:
        A[p+S] = 0
        C += 1
    elif S == 'WA' and A.get(p+'AC') is None and A.get(p+S) is None:
        A[p+S] = 1
    elif S == 'WA' and A.get(p+'AC') is None:
        A[p+S] += 1
for i in range(1,N+1):
    if A.get(str(i)+'AC') is not None and A.get(str(i)+'WA') is not None:
        P += A[str(i)+'WA']
print(C,P)

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
L = []
for i in range(M):
    p,S = map(str, input().split())
    L.append([p,S])
C = 0
P = 0
A = []
for k in range(M):
    if L[k][1] == 'AC' and L[k] not in A:
        A.append(L[k])
        C += 1
    elif L[k][1] == 'WA' and [L[k][0],'AC'] not in A:
        A.append(L[k])
        P += 1
print(C,P)

Fixed submission:
N,M = map(int, input().split())
A = {}
C = 0
P = 0
for i in range(M):
    p,S = map(str, input().split())
    if S == 'AC' and A.get(p+S) is None:
        A[p+S] = 0
        C += 1
    elif S == 'WA' and A.get(p+'AC') is None and A.get(p+S) is None:
        A[p+S] = 1
    elif S == 'WA' and A.get(p+'AC') is None:
        A[p+S] += 1
for i in range(1,N+1):
    if A.get(str(i)+'AC') is not None and A.get(str(i)+'WA') is not None:
        P += A[str(i)+'WA']
print(C,P)

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
L = []
for i in range(M):
    p,S = map(str, input().split())
    L.append([p,S])
C = 0
P = 0

A = []
for k in range(M):
    if L[k][1] == 'AC' and L[k] not in A:
        A.append(L[k])
    elif L[k][1] == 'WA' and [L[k][0],'AC'] not in A:
        A.append(L[k])
for i in range(len(A)):
    if A[i][1] == 'AC':
        C += 1
    else:
        P += 1
print(C,P)

Fixed submission:
N,M = map(int, input().split())
A = {}
C = 0
P = 0
for i in range(M):
    p,S = map(str, input().split())
    if S == 'AC' and A.get(p+S) is None:
        A[p+S] = 0
        C += 1
    elif S == 'WA' and A.get(p+'AC') is None and A.get(p+S) is None:
        A[p+S] = 1
    elif S == 'WA' and A.get(p+'AC') is None:
        A[p+S] += 1
for i in range(1,N+1):
    if A.get(str(i)+'AC') is not None and A.get(str(i)+'WA') is not None:
        P += A[str(i)+'WA']
print(C,P)