Problem:


Score : 300 points

Problem Statement

Takahashi participated in a contest on AtCoder.

The contest had N problems.

Takahashi made M submissions during the contest.

The i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).

The number of Takahashi's correct answers is the number of problems on which he received an AC once or more.

The number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.

Find the numbers of Takahashi's correct answers and penalties.

Constraints

N, M, and p_i are integers.

1 \leq N \leq 10^5

0 \leq M \leq 10^5

1 \leq p_i \leq N

S_i is AC or WA.

Input

Input is given from Standard Input in the following format:

N M
p_1 S_1
:
p_M S_M

Output

Print the number of Takahashi's correct answers and the number of Takahashi's penalties.

Sample Input 1

2 5
1 WA
1 AC
2 WA
2 AC
2 WA

Sample Output 1

2 2

In his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.

In his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.

Thus, he has two correct answers and two penalties.

Sample Input 2

100000 3
7777 AC
7777 AC
7777 AC

Sample Output 2

1 0

Note that it is pointless to get an AC more than once on the same problem.

Sample Input 3

6 0

Sample Output 3

0 0



Sample input:
2 5
1 WA
1 AC
2 WA
2 AC
2 WA


Sample output:
2 2

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().strip().split(" "))


p = []
s = []
ans = [0]*N
c_wa = 0

for i in range(M):
    temp1, temp2 = input().strip().split(" ")
    p.append(int(temp1))
    s.append(str(temp2))
  

for j in range(M):
    
    if s[j] == "WA":
        if ans[p[j]-1] == 0:
            c_wa += 1
        elif ans[p[j]-1] == 1:
            pass
        
                
            
    elif s[j] == "AC":
        if ans[p[j]-1] == 0:
            ans[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
        
            
print(sum(ans), c_wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().strip().split(" "))


p = []
s = []
ans = [0]*N
c_wa = 0

for i in range(M):
    temp1, temp2 = input().strip().split(" ")
    p.append(int(temp1))
    s.append(str(temp2))
  

for j in range(M):
    
    if s[j] == "WA":
        if ans[p[j]-1] == 0:
            c_wa += 1
            
    elif s[j] == "AC":
        if ans[p[j]-1] == 0:
            ans[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
        
            
print(sum(ans), c_wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().strip().split(" "))


p = []
s = []
ans = [0]*N
c_wa = 0

for i in range(M):
    temp1, temp2 = input().strip(" ").split(" ")
    p.append(int(temp1))
    s.append(str(temp2))
  

for j in range(M):
    
    if s[j] == "WA":
        if ans[p[j]-1] == 0:
            c_wa += 1
            
    elif s[j] == "AC":
        if ans[p[j]-1] == 0:
            ans[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
        
            
print(sum(ans), c_wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().strip().split(" "))


p = []
s = []
ans = [0]*N
c_wa = 0

for i in range(M):
    temp1, temp2 = input().strip(" ").split(" ")
    p.append(int(temp1))
    s.append(str(temp2))
  

for j in range(M):
    
    if s[j] == "WA":
        if ans[p[j]-1] == 0:
            c_wa += 1
            
    elif s[j] == "AC":
        if ans[p[j]-1] == 0:
            ans[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            continue
        
            
print(sum(ans), c_wa)

Submission status: Wrong Answer

Solution code:
a=[int(i) for i in input().split()]
s = [input().split() for i in range(a[1])]
if a[1]==0:
    print(0,0) 
else:
    wa=0
    ac=0
    ac_count=[]
    wa_count=[]
    num=int(s[0][0])
    for i in range(len(s)):
        if int(s[i][0])==num:
            if s[i][1]=="WA":
                if ac!=1:
                    wa+=1
            else:
                ac=1
            if i==len(s)-1 and ac==1:
                ac_count.append(ac)
                wa_count.append(wa)
        else:
            if ac==1:
                ac_count.append(ac)
                wa_count.append(wa)
            ac=0
            wa=0
            num=int(s[i][0])
            if s[i][1]=="WA":
                if ac!=1:
                    wa+=1
            else:
                ac=1
            if i==len(s)-1 and ac==1:
                ac_count.append(ac)
                wa_count.append(wa)
    print(sum(ac_count),sum(wa_count))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().strip().split(" "))


p = []
s = []
ans = [0]*N
c_wa = 0

for i in range(M):
    temp1, temp2 = input().strip(" ").split(" ")
    p.append(int(temp1))
    s.append(str(temp2))
  

for j in range(M):
    
    if s[j] == "WA":
        if ans[p[j]-1] == 0:
            c_wa += 1
            
    elif s[j] == "AC":
        if ans[p[j]-1] == 1:
            continue
        elif ans[p[j]-1] == 0:
            ans[p[j]-1] += 1
            
print(sum(ans), c_wa)

Submission status: Wrong Answer

Solution code:
a=[int(i) for i in input().split()]
s = [input().split() for i in range(a[1])]
if a[1]==0:
    print(0,0) 
else:
    wa=0
    ac=0
    ac_count=[]
    wa_count=[]
    num=int(s[0][0])
    for i in range(len(s)):
        if int(s[i][0])==num:
            if s[i][1]=="WA":
                if ac!=1: 
                    wa+=1
            else:
                ac=1
            if i==len(s)-1:
                ac_count.append(ac)
                wa_count.append(wa)
        else:
            ac_count.append(ac)
            wa_count.append(wa)
            ac=0
            wa=0
            num=int(s[i][0])
            if s[i][1]=="WA":
                if ac!=1:
                    wa+=1
            else:
                ac=1
            if i==len(s)-1:
                ac_count.append(ac)
                wa_count.append(wa)
    print(sum(ac_count),sum(wa_count))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())

p_judge = {}
p_lsit = []
ac = 0
wa = 0
for i in range(m):
    p_name, result = input().split()

    if (len(p_lsit) == n):
        if p_judge[p_name] == True:
            continue

    if p_name in p_lsit:
        if p_judge[p_name] == False:
            if result == "AC":
                p_judge[p_name] = True
                ac += 1
            else:
                wa += 1
    else:
        if result == "WA":
            wa += 1
            p_judge[p_name] = False
        else:
            ac += 1
            p_judge[p_name] = True

        p_lsit.append(p_name)

print(str(ac) + " " + str(wa))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())

p_judge = {}
p_lsit = []
ac = 0
wa = 0
for i in range(m):
    p_name, result = input().split()

    if (len(p_lsit) == n):
        if p_judge[p_name] == True:
            continue

    if p_name in p_lsit:
        if p_judge[p_name] == False and result == "AC":
            p_judge[p_name] = True
            ac += 1

        else:
            wa += 1
    else:
        if result == "WA":
            wa += 1
            p_judge[p_name] = False
        else:
            ac += 1
            p_judge[p_name] = True

        p_lsit.append(p_name)

print(str(ac) + " " + str(wa))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())

p_judge = {}
p_lsit = []
already_flag = True
ac = 0
wa = 0
for i in range(m):
    p_name, result = input().split()

    if p_name in p_lsit:
        if p_judge[p_name] == False:
            if result == "AC":
                p_judge[p_name] = True
                ac += 1
            else:
                wa += 1
    else:
        if result == "WA":
            wa += 1
            p_judge[p_name] = False
        else:
            ac += 1
            p_judge[p_name] = True
        
        p_lsit.append(p_name)

print(str(ac) + " " + str(wa))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())

p_judge = {}
p_lsit = []
already_flag = True
ac = 0
wa = 0
for i in range(m):
    p_name, result = input().split()

    if p_name in p_lsit:
        if p_judge[p_name] == False:
            if result == "AC":
                p_judge[p_name] = True
                ac = ac+1
                continue
            else:
                wa = wa+1
                continue
    else:
        if result == "WA":
            wa = wa + 1
            p_judge[p_name] = False
            continue
        else:
            ac = ac + 1
            p_judge[p_name] = True
            continue
        
        p_lsit.append(p_name)

print(str(ac) + " " + str(wa))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())

p_judge = {}
p_lsit = []
already_flag = True
ac = 0
wa = 0
for i in range(m):
    p_name, result = input().split()

    if p_name in p_lsit:
        if p_judge[p_name] == False:
            if result == "AC":
                p_judge[p_name] = True
                ac = ac +1
            else:
                wa = wa +1
    else:
        if result == "WA":
            wa = wa + 1
            p_judge[p_name] = False
        else:
            ac = ac + 1
            p_judge[p_name] = True
        
        p_lsit.append(p_name)

print(str(ac) + " " + str(wa))

Submission status: Wrong Answer

Solution code:
a=[int(i) for i in input().split()]
s = [input().split() for i in range(a[1])]
if a[1]==0:
    print(0,0) 
else:
    wa=0
    ac=0
    ac_count=[]
    wa_count=[]
    num=int(s[0][0])
    for i in range(len(s)):
        if int(s[i][0])==num:
            if s[i][1]=="WA":
                if ac!=1: 
                    wa+=1
            else:
                ac=1
            if i==len(s)-1:
                ac_count.append(ac)
                wa_count.append(wa)
        else:
            ac_count.append(ac)
            wa_count.append(wa)
            ac=0
            wa=0
            num=int(s[i][0])
            if s[i][1]=="WA":
                if ac!=1:
                    wa+=1
            else:
                ac=1
    print(sum(ac_count),sum(wa_count))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=0
wa=0

acl=[0]*n

for i in range(m):
    p,s=input().split()
    p=int(p)
    
    if s=="AC" and acl[p-1]==0:
        acl[int(p-1)]=1
        ac+=1
    elif s=="WA" and acl[p-1]==0:
        wa+=1
        
print(ac, wa)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

n,m = list(map(int, input().split(" ")))
dic = defaultdict(lambda : [0,0])

for i in range(m):
    task,status = input().split(" ")
    if status == "AC":
        dic[task][0] += 1
    if dic[task][0] == 0 and status == "WA":
        dic[task][1] += 1

acCnt = 0
waCnt = 0

for _, v in dic.items():
    a,b = v
    if a > 0:
        acCnt += 1
    waCnt += b
print(str(acCnt) + " " + str(waCnt))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p = [list(input().split()) for _ in range(m)]

ac = 0
wa = 0
prob = 0

for i in range(m):
    if int(p[i][0]) != prob:
        if p[i][1] == "WA":
            wa += 1
        elif p[i][1] == "AC":
            ac += 1
            prob = p[i][0]
            
print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p = [list(input().split()) for _ in range(m)]

ac = 0
wa = 0
prob = []

for i in range(m):
    if p[i][0] not in prob:
        if p[i][1] == "WA":
            wa += 1
        else:
            ac += 1
            prob.append(p[i][0])
            
print(ac, wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
C = [ [0,0] for _ in range(N) ]
for i in range(M):
    p, s = input().split()
    p = int(p) - 1
    if s == "AC":
        C[p][1] = 1
    else:
        if C[p][1] == 0:
            C[p][0] += 1
ans = 0
pena = 0
for i in range(N):
    ans += C[i][1]
    pena += C[i][0]
print(ans,pena)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
params = list(map(int, input().split()))
result_parse = lambda x:[int(x[0]),x[1]]
results = [result_parse(input().split()) for i in range(params[1])]
fails = [0]*params[0]
suceeds = [False]*params[0]
for result in results:
    index = result[0]-1
    if result[1] == 'AC':
        suceeds[index] = True
    elif suceeds[index] is False:
        fails[index] += 1
print(str(sum(suceeds)) + ' ' + str(sum(fails)))

Submission status: Wrong Answer

Solution code:
params = list(map(int, input().split()))
fails = [0]*params[0]
suceeds = [False]*params[0]
for _ in range(params[1]):
    result = input().split()
    index = int(result[0])-1
    if result[1] == 'AC':
        suceeds[index] = True
        if sum(suceeds) == params[0]:
            break;
    elif suceeds[index] is False:
        fails[index] += 1    
print(str(sum(suceeds)) + ' ' + str(sum(fails)))

Submission status: Wrong Answer

Solution code:
#n:問題数／m:回答数
n,m = map(int,input().split())

#正誤フラグ
a=[0]*n
#誤答数カウント
b=[0]*n
#問題数だけ繰り返し
for _ in range(0,m):
#正誤情報読み込み（p:問題No.／s:正誤）
  p,s = input().split()
#正答数カウント
  if s=="AC":
    a[int(p)-1]=1
#誤答数カウント
  else:
    if a[int(p)-1]!=1:
      b[int(p)-1] +=1
print(sum(a),sum(b))

Submission status: Wrong Answer

Solution code:
params = list(map(int, input().split()))
result_parse = lambda x:[int(x[0]),x[1]]
results = [result_parse(input().split()) for i in range(params[1])]
fails = [0]*params[0]
suceeds = [False]*params[0]
for result in results:
    index = result[0]-1
    if result[1] == 'AC':
        suceeds[index] = True
    else:
        if suceeds[index] is False:
            fails[index] += 1
print(str(sum(suceeds)) + ' ' + str(sum(fails)))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
dic = {}

for _ in range (M):
  p, s = input().split()
  if p not in dic and s == 'AC':
    dic[p] = [1,0]
  elif p not in dic and s == 'WA':
    dic[p] = [0,1]
  elif s == 'AC' and dic[p][0] == 0:
    dic[p][0] += 1
  elif s == 'WA'and dic[p][0]:
    dic[p][1] += 1

right = 0
wrong = 0

for item in dic.values():
  right += item[0]
  if item[0]== 1:
    wrong += item[1]

print(right, wrong)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
dic = {}

for _ in range (M):
  p, s = input().split()
  if p not in dic and s == 'AC':
    dic[p] = [1,0]
  elif p not in dic and s == 'WA':
    dic[p] = [0,1]
  elif s == 'AC' and dic[p][0] == 0:
    dic[p][0] += 1
  elif s == 'WA' and dic[p][0] == 0:
    dic[p][1] += 1

right = 0
wrong = 0

for item in dic.values():
  right += item[0]
  wrong += item[1]

print(right, wrong)

Submission status: Wrong Answer

Solution code:
import sys

def solve(N: int, M:int, p_list:list, S_list:list):
    AC_count = [False for _ in range(N)]
    WA_count = [0 for _ in range(N)]
    point = 0
    pena = 0

    for i in range(M):
        if S_list[i] == 'AC':
            AC_count[p_list[i]-1] = True
        else:
            if AC_count[p_list[i]-1] == False:
                WA_count[p_list[i]-1] += 1
        
    for i in range(N):
        if AC_count[i]:
            point += 1
        pena += WA_count[i]

    print(str(point) + " " + str(pena))

    return

 
if __name__ == "__main__":
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    
    tokens = iterate_tokens()
    N = int(next(tokens))
    M = int(next(tokens))
    p_list = []
    S_list = []
    for i in range(M):
        p_list.append(int(next(tokens)))
        S_list.append(next(tokens))

    solve(N, M, p_list, S_list)

Submission status: Wrong Answer

Solution code:
params = input().split(' ')
n = eval(params[1])
 
acfoundfor = []
 
penalties = 0
points = 0
 
for i in range(n):
    submission = input().split(' ')
    p = eval(submission[0])
    status = submission[1]
    
    if p in acfoundfor:
        continue
 
    if status == 'AC':
        points += 1
        acfoundfor.append(p)
    else:
        penalties += 1
print(points, penalties)

Submission status: Wrong Answer

Solution code:
params = input().split(' ')
n = eval(params[1])

acfoundfor = []

penalties = 0
points = 0

for i in range(n):
    submission = input().split(' ')
    p = eval(submission[0])
    status = submission[1]
    
    if p in acfoundfor:
        continue

    if status == 'AC':
        points += 1
        acfoundfor.append(p)
    else:
        penalties += 1

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac = "AC"
ac_dic= {}
wa_dic = {}
wa_num = 0
for _ in range(m):
  p, s = input().split()
  if s == ac:
    ac_dic[p] = 1
  else:
    if p in wa_dic:
      wa_dic[p]+=1
    else:
      wa_dic[p] = 1
for key, value in wa_dic.items():
  if key in ac_dic:
    wa_num += value
ans = len(ac_dic)
print(ans, wa_num)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac = "AC"
ac_dic= {}
wa_num = 0
for _ in range(m):
  p, s = input().split()
  if p in ac_dic:
    continue
  if s == ac:
    ac_dic[p] = 1
  else:
    wa_num += 1
ans = len(ac_dic)
if ans >= n:
  ans = n
print(ans, wa_num)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p = [0 for _ in range(n)]
ansWA = 0
ansAC = 0

for i in range(m):
    pi,str=input().split()
    pi=int(pi)-1
    if p[pi] != -1:
        if str == 'AC':
            p[pi] = -1
            ansAC += 1
        else:
            ansWA += 1

print(ansAC,ansWA)

Submission status: Wrong Answer

Solution code:
from collections import deque, defaultdict
from itertools import chain, combinations
import json


def main():
    # N = int(input())
    N, M = [int(a) for a in input().split()]
    # A = [int(a) for a in input().split()]
    pS = [
        [a for a in input().split()]
        for _ in range(M)
    ]

    seitou = 0
    pen = 0
    mem = defaultdict(int)
    for p, S in pS:
        p = int(p)
        if S == 'AC':
            if mem[p] < 0:
                continue
            seitou += 1
            pen += mem[p]
            mem[p] = -1
        else:
            mem[p] = mem[p] + 1
    print(seitou, pen)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

AC_flag = [0] * N
WA_count = 0
for i in range(M):
    p, S = input().split()
    if S == 'AC':
        if AC_flag[int(p)-1] == 0:
            AC_flag[int(p)-1] = 1
    else:
        if AC_flag[int(p)-1] == 0:
            WA_count += 1

print('%d %d' % (sum(AC_flag), WA_count))

Submission status: Wrong Answer

Solution code:
from collections import *
r = set()
c = defaultdict(int)
n, m = map(int, input().split())

for _ in range(m):
  l = input().split()
  i = int(l[0])
  if l[1] == 'AC':
    r.add(i)
  elif i not in r:
    c[i] += 1

print(len(r), sum(c.values()))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
inp = []
ans = [(0, False) for _ in range(n)]

for _ in range(m):
    inp.append(input().split())

for i in inp:
    q, r = int(i[0]) - 1, i[1]
    count = ans[q][0]
    flag = ans[q][1]
    if r == 'WA' and not flag:
        ans[q] = (count+1, False)
    if r == 'AC':
        ans[q] = (count, True)
ac = list(filter(lambda x: x[1], ans))
print(len(ac), sum(map(lambda x: x[0], ans)))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
inp = []
ans = [(0, False) for _ in range(n)]

for _ in range(m):
    inp.append(input().split())

for i in inp:
    q, r = int(i[0]) - 1, i[1]
    count = ans[q][0]
    flag = ans[q][1]
    if r == 'WA' and not flag:
        ans[q] = (count+1, False)
    if r == 'AC':
        ans[q] = (count, True)

print(len(list(filter(lambda x: x[1], ans))), sum(map(lambda x: x[0], ans)),)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

N,M = map(int, input().split())

lst_ans = [0] * N

correct = 0
penalty = 0
for _ in range(M):

	p, S = input().split()
	p = int(p)
	if (S == 'AC'):
		penalty += lst_ans[p-1]
		correct += 1
	else :
		lst_ans[p-1]+=1

print(correct, penalty)

Submission status: Wrong Answer

Solution code:
N, M  = map(int, input().split())
wa = [0] * (N+1)
ac = set()
cnt = 0
for _ in range(M):
    p,S = input().split()
    p = int(p)
    if p in ac:
        continue
    if S == "AC":
        ac.add(p)
    else:
        wa[p] += 1
        cnt += 1
print(len(ac),cnt)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
AC_list = []
Pena_list = [0]*N
for i in range(M):
    p,s = input().split()
    p = int(p)
    if s == "AC":
        if p in AC_list:
            continue
        else:
            AC_list.append(p)
    else:
        if p in AC_list:
            continue
        Pena_list[p-1] += 1
print(len(AC_list),end=" ")
print(sum(Pena_list))

Submission status: Wrong Answer

Solution code:
N, M  = map(int, input().split())
wa = [0] * (N+1)
ac = set()
for _ in range(M):
    p,S = input().split()
    p = int(p)
    if p in ac:
        continue
    if S == "AC":
        ac.add(p)
    else:
        wa[p] += 1
print(len(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
N, M  = map(int, input().split())
wa = [0] * (N+1)
ac = [0] * (N+1)
for _ in range(M):
    p,S = input().split()
    p = int(p)
    if ac[p] > 0:
        continue
    if S == "AC":
        ac[p] = 1
    else:
        wa[p] += 1

print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
# from collections import defaultdict 
N, M  = map(int, input().split())
wa = [0] * (N+1)
ac = [0] * (N+1)
cnt = 0
for i in range(M):
    p,S =input().split()
    p = int(p)
    if ac[p] == 0:
        if S == "AC":
            ac[p] = 1
        else:
            wa[p] += 1

print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
# from collections import defaultdict 
N, M  = map(int, input().split())
wa = [0] * 100001
ac = [0] * 100001
cnt = 0
for i in range(M):
    p,S =input().split()
    p = int(p)
    if S == "AC":
        if ac[p] == 0:
            ac[p] += 1
    else:
        if ac[p] == 0:
            wa[p] += 1

print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())

p = []
S = []

if M==0:
  AC_count = 0
  vwrong_number = 0
  
for i in range(M):
    s1,P1 = [i for i in input().split()]
    p.append(s1)
    S.append(P1)
    
x = []
for i in range(M):
    if S[i] == 'AC':
        k = p[i]
        x.append(k)
    
    y=list(dict.fromkeys(x))
    AC_count = len(y)
z=0   
for i in range(M):
    if p[i] in y:
        z += 1
        
# zは'AC'を出した問題について提出した合計回数

A = S.count('AC')

# Aは'AC'を出した回数

vwrong_number = z - A

print('{0} {1}'.format(AC_count,vwrong_number))

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
AC_Set = set()
WA_Count = 0
for i in range(M):
    num,result = list(input().split())
    if num in AC_Set:
        continue
    else:
        if result == "AC":
            AC_Set.add(num)
        else:
            WA_Count += 1

print("{} {}".format(len(AC_Set),WA_Count))

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
AC_Set = set()
WA_Count = 0
for i in range(M):
    num,result = list(input().split())
    if num in AC_Set:
        break
    else:
        if result == "AC":
            AC_Set.add(num)
        else:
            WA_Count += 1

print("{} {}".format(len(AC_Set),WA_Count))

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
AC_List = []
WA_Count = 0
for i in range(M):
    num,result = list(input().split())
    if num in AC_List:
        break
    else:
        if result == "AC":
            AC_List.append(num)
        else:
            WA_Count += 1

print("{} {}".format(len(AC_List),WA_Count))

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
AC_List = []
WA_Count = 0
for i in range(M):
    cur = list(input().split())
    if cur[0] in AC_List:
        break
    if cur[1] == "AC":
        AC_List.append(cur[0])
    elif cur[1] == "WA": 
        WA_Count += 1

print("{} {}".format(len(AC_List),WA_Count))

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
AC_List = []
WA_Count = []
for i in range(M):
    cur = list(input().split())
    if cur[0] in AC_List:
        break
    if cur[1] == "AC":
        AC_List.append(cur[0])
    elif cur[1] == "WA": 
        WA_Count.append(cur[0])

print("{} {}".format(len(AC_List),len(WA_Count)))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p,s = ["0"]*m,["WJ"]*m
for i in range(0,m):
    p[i],s[i] = input().split()
p = [int(s) for s in p]
PN_count = [0]*(n)
AC_count = [0]*(n)
for i in range(len(s)):
    if(s[i] == "AC"):
        AC_count[p[i]-1] = 1
    else:
        if(AC_count[p[i]-1] != 1):
            PN_count[p[i]-1] += 1
print(sum(AC_count),sum(PN_count))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p,s = ["0"]*m,["WJ"]*m
for i in range(0,m):
    p[i],s[i] = input().split()
p = [int(s) for s in p]
PN_count = [0]*(n)
AC_count = [0]*(n)
for i in range(len(s)):
    if(s[i] == "AC"):
        AC_count[p[i]-1] = 1
    else:
        if(AC_count[p[i]-1] != 0):
            PN_count[p[i]-1] += 1
print(sum(AC_count),sum(PN_count))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p,s = ["0"]*m,["WJ"]*m
for i in range(0,m-1):
    p[i],s[i] = input().split()
p = [int(s) for s in p]
PN_count = [0]*(n+1)
AC_count = [0]*(n+1)
for i in range(m):
    if(s[i] == "AC"):
        AC_count[p[i]-1] = 1
    else:
        if(AC_count[p[i]-1] == 0):
            PN_count[p[i]-1] += 1
print(sum(AC_count),sum(PN_count))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p,s = ["0"]*m,["WJ"]*m
for i in range(0,m-1):
    p[i],s[i] = input().split()
p = [int(s) for s in p]
PN_count = [0]*(n+1)
AC_count = [0]*(n+1)
for i in range(m):
    if(s[i] == "AC"):
        AC_count[p[i]-1] = 1
    else:
        if(AC_count[p[i]] == 0):
            PN_count[p[i]-1] += 1
#print(AC_count,PN_count)
print(sum(AC_count),sum(PN_count))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
memo = [False for i in range(N)]

ac = 0
wa = 0
for i in range(M):
  p, s = input().split()
  p = int(p)-1
  if not memo[p]:
    if s == 'WA':
      wa += 1
    else:
      ac += 1
      memo[p] = True

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n,m = list(map(int,input().split()))
counter = 0
data = []
checkd = []
tmp = {}#問題番号をkeyとしてWAをカウント

wa = 0
#入力処理
for i in range(m):
  a,b = input().split() #入力処理
  if b == "WA": #解答がWA→tmpに問題番号をkeyとしてカウント
    if int(a) not in tmp:
      tmp[int(a)] = 0
    tmp[int(a)] += 1
  if int(a) not in tmp: #WA無しのACの対応 
    tmp[int(a)] = 0
  if (( b == "AC") and (tmp[int(a)] != -1)):#解答がACでtmp[問題番号]が出力済みでない場合
    counter += 1
    #checkd.append(int(a))
    if int(a) not in tmp:
      tmp[int(a)] = 0  
    wa += tmp[int(a)] #問題番号aの値をWAの合計に加算
    tmp[int(a)] = -1#問題番号aが加算済み


"""
for i in range(m):
  if data[i][1] == "WA":
    if int(data[i][0]) not in tmp:
      tmp[int(data[i][0])] = 0
    tmp[int(data[i][0])] += 1  
  elif ((data[i][1]) == "AC") and (int(data[i][0]) not in checkd):
    counter += 1
    checkd.append(int(data[i][0]))
    if int(data[i][0] ) not in tmp:
      tmp[int(data[i][0])] = 0  
    wa += tmp[int(data[i][0])]
"""    
print(counter,wa)

Submission status: Wrong Answer

Solution code:
n,m = list(map(int,input().split()))
counter = 0
data = []
checkd = []
tmp = {}

wa = 0
#入力処理
for i in range(m):
  a,b = input().split()
  if b == "WA":
    if int(a) not in tmp:
      tmp[int(a)] = 0
    tmp[int(a)] += 1
  if int(a) not in tmp:  
    tmp[int(a)] = 0
  if (( b == "AC") and (tmp[int(a)] != -1)):
    counter += 1
    #checkd.append(int(a))
    if int(a) not in tmp:
      tmp[int(a)] = 0  
    wa += tmp[int(a)]
    tmp[int(a)] = -1


"""
for i in range(m):
  if data[i][1] == "WA":
    if int(data[i][0]) not in tmp:
      tmp[int(data[i][0])] = 0
    tmp[int(data[i][0])] += 1  
  elif ((data[i][1]) == "AC") and (int(data[i][0]) not in checkd):
    counter += 1
    checkd.append(int(data[i][0]))
    if int(data[i][0] ) not in tmp:
      tmp[int(data[i][0])] = 0  
    wa += tmp[int(data[i][0])]
"""    
print(counter,wa)

Submission status: Wrong Answer

Solution code:
n,m = list(map(int,input().split()))
counter = 0
data = []
checkd = []
tmp = {}

wa = 0
#入力処理
for i in range(m):
  a,b = input().split()
  if b == "WA":
    if int(a) not in tmp:
      tmp[int(a)] = 0
    tmp[int(a)] += 1
  if int(a) not in tmp:  
    tmp[int(a)] = 0
  elif (( b == "AC") and (tmp[int(a)] != -1)):
    counter += 1
    #checkd.append(int(a))
    if int(a) not in tmp:
      tmp[int(a)] = 0  
    wa += tmp[int(a)]
    tmp[int(a)] = -1


"""
for i in range(m):
  if data[i][1] == "WA":
    if int(data[i][0]) not in tmp:
      tmp[int(data[i][0])] = 0
    tmp[int(data[i][0])] += 1  
  elif ((data[i][1]) == "AC") and (int(data[i][0]) not in checkd):
    counter += 1
    checkd.append(int(data[i][0]))
    if int(data[i][0] ) not in tmp:
      tmp[int(data[i][0])] = 0  
    wa += tmp[int(data[i][0])]
"""    
print(counter,wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
p = [0] * m
s = [0] * m
for i in range(m):
    p[i], s[i] = map(str, input().split())
for i in range(m):
    p[i] = int(p[i])

ans1 = 0
ans2 = 0

aclis = [0] * (n+1)
walis = [0] * (n+1)


for i in range(m):
    if s[i] == 'AC':
        aclis[p[i]] = 1


    elif aclis[p[i]] == 0 and s[i] == 'WA':
        walis[p[i]] += 1
ans1 = aclis.count(1)

for i in range(n):
    if aclis[i] == 1:
        ans2 += walis[i]

print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
p = [0] * m
s = [0] * m
for i in range(m):
    p[i], s[i] = map(str, input().split())
for i in range(m):
    p[i] = int(p[i])

ans1 = 0
ans2 = 0

aclis = [0] * (n+1)
walis = [0] * (n+1)


for i in range(m):
    if s[i] == 'AC':
        aclis[p[i]] = 1


    elif aclis[p[i]] == 0 and s[i] == 'WA':
        walis[p[i]] += 1
ans1 = aclis.count(1)

for i in range(n):
    if aclis[i] == 1:
        ans2 += walis[i]

print(ans1, ans2+1)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
if m == 0:
    print(0, 0)
else:
    p = [0] * m
    s = [0] * m
    for i in range(m):
        p[i], s[i] = map(str, input().split())
    for i in range(m):
        p[i] = int(p[i])
    p.append(int(1e9))

    probcnt = p[0]
    ACval = False
    ACcnt = 0
    wa = 0
    pena = 0
    for i in range(m):
        if probcnt == p[i]:
            if ACval == False:
                if s[i] == 'WA':
                    wa += 1
                    if p[i] !=p[i+1]:
                        wa = 0
                else:
                    ACval = True
                    ACcnt += 1
                    pena += wa
                    wa = 0

        else:
            ACval = False
            probcnt = p[i]
            if ACval == False:
                if s[i] == 'WA':
                    wa += 1
                    if p[i] !=p[i+1]:
                        wa = 0
                else:
                    ACval = True
                    ACcnt += 1
                    pena += wa
                    wa = 0


    print(ACcnt, pena)