Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

n,m = map(int,input().split(" "))
q_list = []
res_list = []
for i in range(m):
    a,b = input().split(" ")
    q_list.append(int(a))
    res_list.append(b)
    


ac = 0
wa = 0
ac_list = []

for i,j in enumerate(res_list):
    if i == 0:
        if j == "AC":
            ac += 1
            ac_list.append(q_list[i])
        else:
            wa += 1
    elif q_list[i] not in ac_list:
        if j == "AC":
            ac += 1
            ac_list.append(q_list[i])
        else:
            wa += 1
    
    if len(ac_list) == n:
        break

for i,j in enumerate(res_list):
    if q_list[i] not in ac_list:
        wa -= 1



print(ac,wa)

Fixed submission:
# coding: utf-8

n,m = map(int,input().split(" "))
ac_list = [0] * n
wa_list = [0] * n


wa = 0

for i in range(m):
    a,b = input().split(" ")
    if ac_list[int(a) - 1]:
        continue
    if b == "AC":
        ac_list[int(a) - 1] = 1
        wa += wa_list[int(a)-1]
    else:
        wa_list[int(a)-1] += 1
        
print(sum(ac_list),wa)

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split(" "))
question_list = []
res_list = []
ac_list = []
for i in range(m):
    a,b = input().split(" ")
    a = int(a)
    question_list.append(a)
    res_list.append(b)
correct = 0
mistake = 0




for i,j in enumerate(res_list):
    if i == 0:
        if j == "WA":
            mistake += 1
        else:
            correct += 1
            ac_list.append(question_list[i])
            
    elif question_list[i] not in ac_list:      
    	if j == "WA":
      		mistake += 1
     	else:
      		correct += 1
        	ac_list.append(question_list[i])
                
            
    if len(ac_list) == n:
        break
            
for i,j in enumerate(res_list):
    if question_list[i] not in ac_list:
        mistake -= 1
        
      
print(correct,mistake)
            

    



Fixed submission:
# coding: utf-8

n,m = map(int,input().split(" "))
ac_list = [0] * n
wa_list = [0] * n


wa = 0

for i in range(m):
    a,b = input().split(" ")
    if ac_list[int(a) - 1]:
        continue
    if b == "AC":
        ac_list[int(a) - 1] = 1
        wa += wa_list[int(a)-1]
    else:
        wa_list[int(a)-1] += 1
        
print(sum(ac_list),wa)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split(" "))
q_list = []
res_list = []
for i in range(m):
    a,b = input().split(" ")
    q_list.append(int(a))
    res_list.append(b)
    


ac = 0
wa = 0
ac_list = []

for i,j in enumerate(res_list):
    if i == 0:
        if j == "AC":
            ac += 1
            ac_list.append(q_list[i])
        else:
            wa += 1
    elif q_list[i] not in ac_list:
        if j == "AC":
            ac += 1
            ac_list.append(q_list[i])
        else:
            wa += 1

for i,j in enumerate(res_list):
    if q_list[i] not in ac_list:
        wa -= 1



print(ac,wa)

Fixed submission:
# coding: utf-8

n,m = map(int,input().split(" "))
ac_list = [0] * n
wa_list = [0] * n


wa = 0

for i in range(m):
    a,b = input().split(" ")
    if ac_list[int(a) - 1]:
        continue
    if b == "AC":
        ac_list[int(a) - 1] = 1
        wa += wa_list[int(a)-1]
    else:
        wa_list[int(a)-1] += 1
        
print(sum(ac_list),wa)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split(" "))
question_list = []
res_list = []
ac_list = []
for i in range(m):
    a,b = input().split(" ")
    a = int(a)
    question_list.append(a)
    res_list.append(b)
correct = 0
mistake = 0




for i,j in enumerate(res_list):
    if i == 0:
        if j == "WA":
            mistake += 1
        else:
            correct += 1
            ac_list.append(question_list[i])
            
    else:
        #今やっている問題がまだ正解していない
        if question_list[i] not in ac_list:
            if j == "WA":
                mistake += 1
            else:
                correct += 1
                ac_list.append(question_list[i])
                
            
    if len(ac_list) == n:
        break
            
for i,j in enumerate(res_list):
    if question_list[i] not in ac_list:
        mistake -= 1
        
      
print(correct,mistake)
            

    



Fixed submission:
# coding: utf-8

n,m = map(int,input().split(" "))
ac_list = [0] * n
wa_list = [0] * n


wa = 0

for i in range(m):
    a,b = input().split(" ")
    if ac_list[int(a) - 1]:
        continue
    if b == "AC":
        ac_list[int(a) - 1] = 1
        wa += wa_list[int(a)-1]
    else:
        wa_list[int(a)-1] += 1
        
print(sum(ac_list),wa)