Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
answer = 0
ans = []
pen = []
penal = 0
p = [0]*m
x = [0]*m
for i in range(m):
    p[i], x[i] = map(str, input().split())
    if x[i] == "AC":
        ans.append(p[i])
    elif x[i] == "WA":
        for j in range(len(ans)):
            if p[i] == ans[j]:
                penal -= 1
                break
        penal += 1
        pen.append((p[i], x[i]))

ans = tuple(set(ans))

for i in range(len(pen)):
    if pen[i][0] not in ans:
        penal -= 1


print("{}".format(len(ans)) + " {}".format(penal))

Fixed submission:
n, m = map(int, input().split())

problem = [0] * n
count = [0] * n

penal = 0

for i in range(m):
    p, x = map(str, input().split())
    p = int(p) - 1
    if x == "AC":
        if problem[p] == 0:
            problem[p] = 1
    elif x == "WA":
        if problem[p] == 0:
            count[p] += 1

for i in range(n):
    if problem[i] == 0:
        count[i] = 0

print("{}".format(sum(problem)) + " {}".format(sum(count)))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
answer = 0
ans = []
pen = []
penal = 0
p = [0]*m
x = [0]*m
for i in range(m):
    p[i], x[i] = map(str, input().split())
    if x[i] == "AC":
        if p[i] not in ans:
            ans.append(p[i])
            answer += 1
    elif x[i] == "WA":
        for j in range(len(ans)):
            if p[i] == ans[j]:
                penal -= 1
                break
        penal += 1
        pen.append((p[i], x[i]))
    if answer == n:
        break

for i in range(len(pen)):
    if pen[i][0] not in ans:
        penal -= 1


print("{}".format(answer) + " {}".format(penal))

Fixed submission:
n, m = map(int, input().split())

problem = [0] * n
count = [0] * n

penal = 0

for i in range(m):
    p, x = map(str, input().split())
    p = int(p) - 1
    if x == "AC":
        if problem[p] == 0:
            problem[p] = 1
    elif x == "WA":
        if problem[p] == 0:
            count[p] += 1

for i in range(n):
    if problem[i] == 0:
        count[i] = 0

print("{}".format(sum(problem)) + " {}".format(sum(count)))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
count = 0
ans = []
pen = []
penal = 0
p = [0]*m
x = [0]*m
for i in range(m):
    p[i], x[i] = map(str, input().split())
    if x[i] == "AC":
        ans.append(p[i])
    elif x[i] == "WA":
        for j in range(len(ans)):
            if p[i] == ans[j]:
                penal -= 1
                break
        penal += 1
        pen.append((p[i], x[i]))

ans = list(set(ans))

for i in range(len(pen)):
    if pen[i][0] not in ans:
        penal -= 1


print("{}".format(len(ans)) + " {}".format(penal))


Fixed submission:
n, m = map(int, input().split())

problem = [0] * n
count = [0] * n

penal = 0

for i in range(m):
    p, x = map(str, input().split())
    p = int(p) - 1
    if x == "AC":
        if problem[p] == 0:
            problem[p] = 1
    elif x == "WA":
        if problem[p] == 0:
            count[p] += 1

for i in range(n):
    if problem[i] == 0:
        count[i] = 0

print("{}".format(sum(problem)) + " {}".format(sum(count)))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
count = 0
ans = []
pen = []
penal = 0
p = [0]*m
x = [0]*m
for i in range(m):
    p[i], x[i] = map(str, input().split())
    if x[i] == "AC":
        ans.append(p[i])
    elif x[i] == "WA":
        for j in range(len(ans)):
            if p[i] == ans[j]:
                penal -= 1
                break
        penal += 1
        pen.append((p[i], x[i]))
    if len(ans) == n:
        break


ans = list(set(ans))

for i in range(len(pen)):
    if pen[i][0] not in ans:
        penal -= 1

if penal < 0:
    penal = 0

print("{}".format(len(ans)) + " {}".format(penal))

Fixed submission:
n, m = map(int, input().split())

problem = [0] * n
count = [0] * n

penal = 0

for i in range(m):
    p, x = map(str, input().split())
    p = int(p) - 1
    if x == "AC":
        if problem[p] == 0:
            problem[p] = 1
    elif x == "WA":
        if problem[p] == 0:
            count[p] += 1

for i in range(n):
    if problem[i] == 0:
        count[i] = 0

print("{}".format(sum(problem)) + " {}".format(sum(count)))