Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n,m= map(int,input().split())

B = []
C = [0]*n
ans = 0
pna = 0
for i in range(m):
    a,b= input().split()
    if ans == n:
        break
    if b=="AC":
        if a not in B :
            B.append(a)
            ans += 1
            pna += C[int(a)-1]
    else:
        C[int(a)-1] += 1 
print(ans,pna)

Fixed submission:
N,M = [int(x) for x in input().split()]
count = [0]*N
ac = 0
wa = 0
ireta = []
for i in range(M):
    a,b = input().split()
    a = int(a)
    if b == "AC" and count[a-1] == 0:
        count[a-1] = 1
        ac += 1
    elif count[a-1] == 0:
        ireta.append(a)
        wa += 1
for i in range(len(ireta)):
    if count[ireta[i]-1] == 0:
        wa -= 1
print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
n,m= map(int,input().split())

B = []
C = [0]*n
ans = 0
pna = 0
for i in range(m):
    A = list(map(str,input().split()))
    if ans == n:
        break
    if A[0] not in B:
        if A[1]=="AC" :
            B.append(A[0])
            ans += 1
            pna += C[int(A[0])-1]
        else:
      	  C[int(A[0])-1] += 1 
print(ans,pna)

Fixed submission:
N,M = [int(x) for x in input().split()]
count = [0]*N
ac = 0
wa = 0
ireta = []
for i in range(M):
    a,b = input().split()
    a = int(a)
    if b == "AC" and count[a-1] == 0:
        count[a-1] = 1
        ac += 1
    elif count[a-1] == 0:
        ireta.append(a)
        wa += 1
for i in range(len(ireta)):
    if count[ireta[i]-1] == 0:
        wa -= 1
print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
n,m= map(int,input().split())

B = []
C = [0]*n
ans = 0
pna = 0
for i in range(m):
    a,b= map(str,input().split())
    if ans == n:
        break
    if b=="AC":
        if a not in B :
            B.append(a)
            ans += 1
            pna += C[int(a)-1]
    else:
        C[int(a)-1] += 1 
print(ans,pna)

Fixed submission:
N,M = [int(x) for x in input().split()]
count = [0]*N
ac = 0
wa = 0
ireta = []
for i in range(M):
    a,b = input().split()
    a = int(a)
    if b == "AC" and count[a-1] == 0:
        count[a-1] = 1
        ac += 1
    elif count[a-1] == 0:
        ireta.append(a)
        wa += 1
for i in range(len(ireta)):
    if count[ireta[i]-1] == 0:
        wa -= 1
print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n,m= map(int,input().split())

B = []
C = [0]*n
ans = 0
pna = 0
for i in range(m):
    A = list(map(str,input().split()))
    if A[0] not in B:
        if A[1]=="AC" :
            B.append(A[0])
            ans += 1
            pna += C[int(A[0])-1]
        else:
      	  C[int(A[0])-1] += 1 
print(ans,pna)

Fixed submission:
N,M = [int(x) for x in input().split()]
count = [0]*N
ac = 0
wa = 0
ireta = []
for i in range(M):
    a,b = input().split()
    a = int(a)
    if b == "AC" and count[a-1] == 0:
        count[a-1] = 1
        ac += 1
    elif count[a-1] == 0:
        ireta.append(a)
        wa += 1
for i in range(len(ireta)):
    if count[ireta[i]-1] == 0:
        wa -= 1
print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n,m= map(int,input().split())

B = []
C = [0]*n
ans = 0
pna = 0
for i in range(m):
    A = list(map(str,input().split()))
    if A[1]=="AC":
        if A[0] not in B :
            B.append(A[0])
            ans += 1
            pna += C[int(A[0])-1]
    else:
        C[int(A[0])-1] += 1 
print(ans,pna)

Fixed submission:
N,M = [int(x) for x in input().split()]
count = [0]*N
ac = 0
wa = 0
ireta = []
for i in range(M):
    a,b = input().split()
    a = int(a)
    if b == "AC" and count[a-1] == 0:
        count[a-1] = 1
        ac += 1
    elif count[a-1] == 0:
        ireta.append(a)
        wa += 1
for i in range(len(ireta)):
    if count[ireta[i]-1] == 0:
        wa -= 1
print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n,m= map(int,input().split())

B = []
C = [0]*n
ans = 0
pna = 0
for i in range(m):
    A = list(map(str,input().split()))
    if ans == n:
        break
    if A[1]=="AC":
        if A[0] not in B :
            B.append(A[0])
            ans += 1
            pna += C[int(A[0])-1]
    if A[1]=="WA"  :
        C[int(A[0])-1] += 1 
print(ans,pna)

Fixed submission:
N,M = [int(x) for x in input().split()]
count = [0]*N
ac = 0
wa = 0
ireta = []
for i in range(M):
    a,b = input().split()
    a = int(a)
    if b == "AC" and count[a-1] == 0:
        count[a-1] = 1
        ac += 1
    elif count[a-1] == 0:
        ireta.append(a)
        wa += 1
for i in range(len(ireta)):
    if count[ireta[i]-1] == 0:
        wa -= 1
print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n,m= map(int,input().split())

B = []
C = [0]*n
ans = 0
pna = 0
for i in range(m):
    A = list(map(str,input().split()))
    if A[1]=="AC":
        if A[0] not in B :
            B.append(A[0])
            ans += 1
            pna += C[int(A[0])-1]
    if A[1]=="WA"  :
        C[int(A[0])-1] += 1 
print(ans,pna)

Fixed submission:
N,M = [int(x) for x in input().split()]
count = [0]*N
ac = 0
wa = 0
ireta = []
for i in range(M):
    a,b = input().split()
    a = int(a)
    if b == "AC" and count[a-1] == 0:
        count[a-1] = 1
        ac += 1
    elif count[a-1] == 0:
        ireta.append(a)
        wa += 1
for i in range(len(ireta)):
    if count[ireta[i]-1] == 0:
        wa -= 1
print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
n,m= map(int,input().split())
B = []
C = []
ans = 0
pna = 0
for i in range(m):
    A = list(map(str,input().split()))
    if A[1]=="AC":
        if A[0] not in B :
            B.append(A[0])
            ans += 1
            pna += C.count(A[0])
    if A[1]=="WA"  :
        C.append(A[0])
print(ans,pna)

Fixed submission:
N,M = [int(x) for x in input().split()]
count = [0]*N
ac = 0
wa = 0
ireta = []
for i in range(M):
    a,b = input().split()
    a = int(a)
    if b == "AC" and count[a-1] == 0:
        count[a-1] = 1
        ac += 1
    elif count[a-1] == 0:
        ireta.append(a)
        wa += 1
for i in range(len(ireta)):
    if count[ireta[i]-1] == 0:
        wa -= 1
print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n,m= map(int,input().split())
B = []
C = []
ans = 0
pna = 0
for i in range(m):
    A = list(map(str,input().split()))
    if A[1]=="AC":
        if A[0] not in B :
            B.append(A[0])
            ans += 1
            pna += C.count(A[0])
    if A[1]=="WA"  :
        C.append(A[0])
print(ans,pna)
        

Fixed submission:
N,M = [int(x) for x in input().split()]
count = [0]*N
ac = 0
wa = 0
ireta = []
for i in range(M):
    a,b = input().split()
    a = int(a)
    if b == "AC" and count[a-1] == 0:
        count[a-1] = 1
        ac += 1
    elif count[a-1] == 0:
        ireta.append(a)
        wa += 1
for i in range(len(ireta)):
    if count[ireta[i]-1] == 0:
        wa -= 1
print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
n,m= map(int,input().split())
A =[list(map(str,input().split())) for _ in range(m)]
B = []
C = []
ans = 0
pna = 0
for i in range(m):
    if A[i][1]=="AC":
        if A[i][0] not in B :
            B.append(A[i][0])
            ans += 1
            pna += C.count(A[i][0])
    if A[i][1]=="WA"  :
        C.append(A[i][0])
print(ans,pna)
        

Fixed submission:
N,M = [int(x) for x in input().split()]
count = [0]*N
ac = 0
wa = 0
ireta = []
for i in range(M):
    a,b = input().split()
    a = int(a)
    if b == "AC" and count[a-1] == 0:
        count[a-1] = 1
        ac += 1
    elif count[a-1] == 0:
        ireta.append(a)
        wa += 1
for i in range(len(ireta)):
    if count[ireta[i]-1] == 0:
        wa -= 1
print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n,m= map(int,input().split())
A =[list(map(str,input().split())) for _ in range(m)]
B = []
C = []
ans = 0
pna = 0
for i in range(m):
    if A[i][1]=="AC":
        if A[i][0] not in B :
            B.append(A[i][0])
            ans += 1
            pna += C.count(A[i][0])
    if A[i][1]=="WA"  :
        C.append(A[i][0])
print(ans,pna)

Fixed submission:
N,M = [int(x) for x in input().split()]
count = [0]*N
ac = 0
wa = 0
ireta = []
for i in range(M):
    a,b = input().split()
    a = int(a)
    if b == "AC" and count[a-1] == 0:
        count[a-1] = 1
        ac += 1
    elif count[a-1] == 0:
        ireta.append(a)
        wa += 1
for i in range(len(ireta)):
    if count[ireta[i]-1] == 0:
        wa -= 1
print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
n,m= map(int,input().split())
A =[list(map(str,input().split())) for _ in range(m)]
B = []
C = []
ans = 0
pna = 0
for i in range(m):
    if A[i][1]=="AC":
        if A[i][0] not in B :
            B.append(A[i][0])
            ans += 1
            pna += C.count(A[i][0])
    if A[i][1]=="WA"  :
        C.append(A[i][0])
print(ans,pna)
        

Fixed submission:
N,M = [int(x) for x in input().split()]
count = [0]*N
ac = 0
wa = 0
ireta = []
for i in range(M):
    a,b = input().split()
    a = int(a)
    if b == "AC" and count[a-1] == 0:
        count[a-1] = 1
        ac += 1
    elif count[a-1] == 0:
        ireta.append(a)
        wa += 1
for i in range(len(ireta)):
    if count[ireta[i]-1] == 0:
        wa -= 1
print(ac,wa)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
a = [0] * M
b = [0] * M
for i in range(M):
    a[i],b[i]= map(str, input().split())
s1=list()
s2=list()
p=0
w=0
for i in range(M) :
    if a[i] not in s2 and (b[i]=="WA"):
        s1 += a[i] 
    if a[i] not in s2 and (b[i]=="AC"):
        print(s2)
        p += 1 
        s2.append(a[i])
        w += int(s1.count(a[i]))
print(min(N,p),w)

Fixed submission:
N,M = [int(x) for x in input().split()]
count = [0]*N
ac = 0
wa = 0
ireta = []
for i in range(M):
    a,b = input().split()
    a = int(a)
    if b == "AC" and count[a-1] == 0:
        count[a-1] = 1
        ac += 1
    elif count[a-1] == 0:
        ireta.append(a)
        wa += 1
for i in range(len(ireta)):
    if count[ireta[i]-1] == 0:
        wa -= 1
print(ac,wa)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = [input().split() for i in range(M)]
s1=list()
s2=list()
p=0
w=0
for i in range(M):
    if A[i][0] not in s2 and A[i][1]=="WA":
        s1 +=A[i][0]
        print(s1)
    if A[i][0] not in s2 and A[i][1]=="AC":
        p+=1 
        s2 +=A[i][0]
        w += int(s1.count(A[i][0]))
        print(s1,s2)
print(p,w)

Fixed submission:
N,M = [int(x) for x in input().split()]
count = [0]*N
ac = 0
wa = 0
ireta = []
for i in range(M):
    a,b = input().split()
    a = int(a)
    if b == "AC" and count[a-1] == 0:
        count[a-1] = 1
        ac += 1
    elif count[a-1] == 0:
        ireta.append(a)
        wa += 1
for i in range(len(ireta)):
    if count[ireta[i]-1] == 0:
        wa -= 1
print(ac,wa)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
A=[] #appendのために宣言が必要
while True:
    try:
        A.append(list(map(int,input().split())))

    except:
        break;
s1=list()#ACがまだでWAの数
s2=list()#ACした問題
p=0
w=0
for i in range(M):
    if A[i][1]=="WA":
        s1.append(A[i][0])

    if A[i][0] not in s2 and A[i][1]=="AC":
        p+=1
        s2.append(A[i][0])
        w+=int(s1.count(A[i][0])

print(p,w)

Fixed submission:
N,M = [int(x) for x in input().split()]
count = [0]*N
ac = 0
wa = 0
ireta = []
for i in range(M):
    a,b = input().split()
    a = int(a)
    if b == "AC" and count[a-1] == 0:
        count[a-1] = 1
        ac += 1
    elif count[a-1] == 0:
        ireta.append(a)
        wa += 1
for i in range(len(ireta)):
    if count[ireta[i]-1] == 0:
        wa -= 1
print(ac,wa)