Problem p02802 (python)

Fixed submission:
N,M = map(int, input().split())
p = [0]*M
S = [0]*M
for i in range(M):
    p[i],S[i] = input().split()
q = [int(s)-1 for s in p]
X = [0]*N
Y = [0]*N
A = 0
B = 0
for i in range(M):
    if S[i] == "AC":
        if Y[q[i]]==0:
            Y[q[i]]+=1
            A += 1
            B += X[q[i]]
    else:
        if Y[q[i]]==0:
            X[q[i]] += 1
print(str(A)+" "+str(B))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
p = [0]*M
S = [0]*M
for i in range(M):
    p[i],S[i] = input().split()
q = [int(s) for s in p]
X = [0]*N
Y = [0]*N
A = 0
B = 0
for i in range(M):
    if S[i] == "AC":
        if Y[q[i]]==0:
            Y[q[i]]+=1
            A += 1
            B += X[q[i]]
    else:
        if Y[q[i]]==0:
            X[q[i]] += 1
print(str(A)+" "+str(B))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
p = [0]*M
S = [0]*M
X = [0]*N
Y = [0]*N
A = 0
B = 0
for i in range(M):
    p[i],S[i] = input().split()
q = [int(s) for s in p]
for i in range(M):
    if S[i] == "AC":
        if Y[q[i]]==0:
            Y[q[i]]+=1
            A += 1
            B += X[q[i]]
        else:
            A = A
            B = B
    else:
        if Y[q[i]]==0:
            X[q[i]] += 1
        else:
            A = A
            B = B
print(str(A)+" "+str(B))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
p = [0]*M
S = [0]*M
X = [0]*N
Y = [0]*N
A = 0
B = 0
for i in range(M):
    p[i],S[i] = input().split()
q = [int(s) for s in p]
for i in range(M):
    if Y[q[i]]==1:
        break
    if S[i] == "AC":
        if Y[q[i]]==0:
            Y[q[i]]+=1
            A += 1
            B += X[q[i]]
    else:
        if Y[q[i]]==0:
            X[q[i]] += 1
print(str(A)+" "+str(B))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
p = [0]*M
S = [0]*M
X = [0]*N
Y = [0]*N
A = 0
B = 0
for i in range(M):
    p[i],S[i] = input().split()
q = [int(s) for s in p]
for i in range(M):
    if S[i] == "AC":
        if Y[q[i]]==0:
            Y[q[i]]+=1
            A += 1
            B += X[q[i]]
    else:
        if Y[q[i]]==0:
            X[q[i]] += 1
print(str(A)+" "+str(B))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
p = [0]*M
S = [0]*M
X = [0]*N
Y = [0]*N
X = [int(s) for s in X]
Y = [int(s) for s in Y]
A = 0
B = 0
for i in range(M):
    p[i],S[i] = input().split()
q = [int(s) for s in p]
for i in range(M):
    if S[i] == "AC":
        if Y[q[i]]==0:
            Y[q[i]]+=1
            A += 1
            B += X[q[i]]
    else:
        if Y[q[i]]==0:
            X[q[i]] += 1
print(str(A)+" "+str(B))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
p = [0]*M
S = [0]*M
X = [0]*N
Y = [0]*N
X = [int(s) for s in X]
Y = [int(s) for s in Y]
A = 0
B = 0
for i in range(M):
    p[i],S[i] = input().split()
q = [int(s) for s in p]
for i in range(M):
    if S[i] == "AC":
        if Y[q[i]]==0:
            Y[q[i]]+=1
            A += 1
            B += X[q[i]]
    else:
        if Y[q[i]]==0:
            X[q[i]] += 1
print(str(A)+" "+str(B))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
p = [0]*M
S = [0]*M
X = [0]*N
Y = [0]*N
X = [int(s) for s in X]
Y = [int(s) for s in Y]
A = 0
B = 0
for i in range(M):
    p[i],S[i] = input().split()
p = [int(s) for s in p]
for i in range(M):
    if S[i] == "AC":
        if Y[p[i]]==0:
            Y[p[i]]+=1
            A += 1
            B += X[p[i]]
    else:
        if Y[p[i]]==0:
            X[p[i]] += 1
print(str(A)+" "+str(B))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
p = [0]*M
S = [0]*M
for i in range(M):
    p[i],S[i] = input().split()
import numpy as np
p = [int(s) for s in p]
p1 = np.array(p)
S1 = [1 if i=="AC" else 0 for i in S]
N1 = list(set(p1 * S1))
p2 = [1 if i in N1 else 0 for i in p1]
p2 = np.array(p2)
p3 = list(p1 * p2)
p4 = [i for i in p3 if i != 0]

A = 0
B = 0
j = 0
for i in p4:
    if i in N1:
        A += S1[j]
        B += (1-S1[j])
        j +=1
        if S1[i] ==1:
            N1.remove(i)
print(str(A)+" "+str(B))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
p = [0]*M
S = [0]*M
for i in range(M):
    p[i],S[i] = input().split()
import numpy as np
p = [int(s) for s in p]
p1 = np.array(p)
S1 = [1 if i=="AC" else 0 for i in S]
N1 = list(set(p1 * S1))

A = 0
B = 0
for i in range(M):
    if p1[i] in N1:
        A += S1[i]
        B += (1-S1[i])
        if S1[i] ==1:
            N1.remove(p1[i])
print(str(A)+" "+str(B))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
p = [0]*M
S = [0]*M
for i in range(M):
    p[i],S[i] = input().split()
import numpy as np
p = [int(s) for s in p]
p1 = np.array(p)
S1 = [1 if i=="AC" else 0 for i in S]
N1 = list(set(p1 * S1))


if p ==[]:
    print("0 0")
else:
    A = 0
    B = 0
    for i in range(M):
        if p1[i] in N1:
            A += S1[i]
            B += (a-S1[i])
            if S1[i] ==1:
                N1.remove(p1[i])
    print(str(A)+" "+str(B))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
p = [0]*M
S = [0]*M
for i in range(M):
    p[i],S[i] = input().split()
import numpy as np
p = [int(s) for s in p]
p1 = np.array(p)
S1 = [1 if i=="AC" else 0 for i in S]
N1 = list(set(p1 * S1))


if p ==[]:
    print("0 0")
else:
    A = 0
    B = 0
    for i in range(M):
        if p1[i] in N1:
            A += S1[i]
            B += (a-S1[i])
            if S1[i] ==1:
                N1.remove(p1[i])
    print(str(A)+" "+str(B))