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 = list(map(int, input().split(" ")))
list_p = [0 for i in range(N)]
penalty = 0
while(True) :
  try :
    temp = input()
    p, S = temp.split(" ")
    p = int(p)
    if(S == "AC") :
      list_p[p-1] = 1
    else :
      if(list_p[p-1] == 0) :
        penalty += 1
  except EOFError :
    break
    
print(sum(list_p), penalty)

Submission status: Wrong Answer

Solution code:

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

#print(N,M)

num=[]
answer=[]
correct=[]
for k in range(M):
    n,a=input().split()
    num.append(int(n))
    answer.append(a)
#print(num)
#print(answer)
    
preNum=0
preCorrect = False
correctCount=0
wrongCount = 0
temp_wrongCount = 0


for i in range(M):
    if i > 0 and num[i] != num[i-1]:
        preCorrect = False
        temp_wrongCount = 0
    
    if preCorrect:
        continue

    if answer[i] == "AC":
        correctCount += 1
        preCorrect = True
        wrongCount += temp_wrongCount
    if answer[i] == "WA":
        temp_wrongCount += 1

print(correctCount, wrongCount)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
num_ac = 0
num_wa = 0
tmp_num_wa = 0
answerd = []

for i in range(m):
  p,s = input().split()
  if p in answerd:
    continue
  if s == 'WA':
    tmp_num_wa += 1
  if s == 'AC':
    num_ac += 1
    num_wa += tmp_num_wa
    tmp_num_wa = 0
    answerd.append(p)
    
print(num_ac, num_wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
p = []
s = []
for i in range(m):
  _p,_s = input().split()
  p.append(int(_p))
  s.append(_s)

num_ac = 0
num_wa = 0
tmp_num_wa = 0
answerd = []
for _p, _s in zip(p,s):
  if _p in answerd:
    continue
  if _s == 'WA':
    tmp_num_wa += 1
  if _s == 'AC':
    num_ac += 1
    num_wa += tmp_num_wa
    tmp_num_wa = 0
    answerd.append(_p)
    
print(num_ac, num_wa)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
ass=0
q=0
w=0
for i in range(b):
  f,g=map(str,input().split())
  if int(f)>ass:
    if g=="WA":
      w+=1
    elif g=="AC":
      q+=1
      ass=int(f)
print(q,w)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
ass=0
q=0
w=0
for i in range(b):
  f,g=map(str,input().split())
  if int(f)>ass:
    if g=="WA":
      w+=1
    elif g=="AC":
      q+=1
      ass+=1
print(q,w)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
X = [False] * N
ans = 0
for i in range(M):
    p, s = input().split()
    p = int(p) - 1

    if X[p] is False:
        if s == 'WA':
            ans += 1
        else:
            X[p] = True

print(sum(X), ans)

Submission status: Wrong Answer

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

ac = [False]*n
wa = [0]*n

for i in range(m):
    no, re = input().split()
    no = int(no) - 1
    if re == "AC":
        ac[no] = True
    else:
        if not ac[no]:
            wa[no] += 1

a = sum(ac)
b = sum(wa)

print("{} {}".format(a, b))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split(' '))
score = 0
penalty = 0
penalties = {}
acs = set()
for _ in range(m):
    num,result = input().split(' ')
    if num in acs:
        continue
    
    if result == "WA":
        if 'num' in penalties:
            penalties['num'] +=1
        else:
            penalties['num'] =1
    else:
        score +=1
        if 'num' in penalties:
            penalty += penalties['num']
        acs.add(num)

print(score,penalty)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split(' '))
score = 0
penalty = 0
problems = set()
for _ in range(m):
    num,result = input().split(' ')
    if num in problems:
        continue
    
    if result == "WA":
        penalty +=1
    else:
        score +=1
        problems.add(num)

print(score,penalty)

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc151/tasks/abc151_c

n_prob, m_sub = map(int, input().split())

n_answer = 0
n_penalty = 0
p_prev = 0
for j in range(m_sub):
    pi, si = input().split()
    if p_prev == int(pi) and pi_ans_state == 'AC':
        pass
    elif si == 'AC':
        n_answer += 1
        pi_ans_state = 'AC'
    elif si == 'WA':
        n_penalty += 1
    if p_prev != int(pi) and si == 'WA':
        pi_ans_state = 'WA'
    p_prev = int(pi)

print("{} {}".format(n_answer, n_penalty))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split(' '))
score = 0
penalty = 0
problems = set()
for _ in range(m):
    num,result = input().split(' ')
    if num in problems:
        continue
    elif result == "WA":
        penalty +=1
    else:
        score +=1
        problems.add(num)

print(score,penalty)

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc151/tasks/abc151_c

n_prob, m_sub = map(int, input().split())

n_answer = 0
n_penalty = 0
p_prev = 0
for j in range(m_sub):
    pi, si = input().split()
    if p_prev == int(pi) and res_prev == 'AC':
        pass
    elif si == 'AC':
        n_answer += 1
    elif si == 'WA':
        if p_prev == int(pi):
            continue
        n_penalty += 1
    p_prev = int(pi)
    res_prev = si

print("{} {}".format(n_answer, n_penalty))

"""
n_prob, m_sub = map(int, input().split())

n_answer = 0
n_penalty = 0
p_prev = 0
pnum_list = []
ans_list = []
for j in range(m_sub):
    pi, si = input().split()
    pnum_list.append(int(pi))
    ans_list.append(si)

uniq_pnum = list(set(pnum_list))

for p in range(len(uniq_pnum)):
    cur_p_num = uniq_pnum[p]

    for j in range(m_sub):
        if ans_list[j] == 'WA':
            n_penalty += 1
        elif ans_list[j] == 'AC':
            n_answer += 1
            break

print("{} {}".format(n_answer, n_penalty))

"""

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc151/tasks/abc151_c

n_prob, m_sub = map(int, input().split())

n_answer = 0
n_penalty = 0
p_prev = 0
for j in range(m_sub):
    pi, si = input().split()
    if p_prev == int(pi) and res_prev == 'AC':
        continue
    if si == 'AC':
        n_answer += 1
    elif si == 'WA':
        if p_prev == int(pi):
            continue
        n_penalty += 1
    else:
        a = 1
    p_prev = int(pi)
    res_prev = si

print("{} {}".format(n_answer, n_penalty))

"""
n_prob, m_sub = map(int, input().split())

n_answer = 0
n_penalty = 0
p_prev = 0
pnum_list = []
ans_list = []
for j in range(m_sub):
    pi, si = input().split()
    pnum_list.append(int(pi))
    ans_list.append(si)

uniq_pnum = list(set(pnum_list))

for p in range(len(uniq_pnum)):
    cur_p_num = uniq_pnum[p]

    for j in range(m_sub):
        if ans_list[j] == 'WA':
            n_penalty += 1
        elif ans_list[j] == 'AC':
            n_answer += 1
            break

print("{} {}".format(n_answer, n_penalty))

"""

Submission status: Wrong Answer

Solution code:
#c welcome to atcoder
import sys
n,m=map(int,input().split())
ps=[]
num={}
#辞書
ac=0
pena=0
if m==0:
    print('0 0')
    sys.exit()
for i in range(m):
    result=input().split()
    ps.append(result)

for x in ps:
    if x[0] not in num:
        num[x[0]]=0
    if x[1]=="WA" and num[x[0]]==0:
        pena+=1
    if x[1]=="AC" and num[x[0]]==0:
        ac+=1
        num[x[0]]=1



print(ac,pena)

Submission status: Wrong Answer

Solution code:
#c welcome to atcoder
import sys
n,m=map(int,input().split())
ps=[]
num={}
#辞書
ac=0
pena=0
if m==0:
    print('0 0')
    sys.exit()
for i in range(m):
    result=input().split()
    ps.append(result)

for x in ps:
    print(x[0])
    if x[0] not in num:
        num[x[0]]=0
    print(num[x[0]])
    if x[1]=="WA" and num[x[0]]==0:
        pena+=1
    if x[1]=="AC" and num[x[0]]==0:
        ac+=1
        num[x[0]]=1

print(num)

print(ac,pena)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
d={}
for _ in range(m):
  i,ans = input().split()
  if i in d:
    d[i].append(ans)
  else:
    d.update({i:[ans]})
a=p=0
for i in d:
  if 'AC' in d[i]:
    a+=1
  if 'WA' in d[i]:
    p+=1
print(a,p)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
wa=0
ac=0
Q=[0]*N

for i in range(M):
    p,s=input().split()
    p=int(p)
    if s=="AC":
        if Q[p-1]==1:
            pass
        else:
            ac=ac+1
            Q[p-1]=1
    else:
        if Q[p-1]==1:
            pass
        else:
            wa=wa+1

print(ac,wa)

Submission status: Wrong Answer

Solution code:
def main():
    N, M = [int(x) for x in input().split()]

    accepted = set()
    ans = 0
    for i in range(M):
        p, s = input().split()
        if p in accepted:
            continue
        if s == "WA":
            ans += 1
        else:
            accepted.add(p)
    print(len(accepted), ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, M = [int(x) for x in input().split()]

    accepted = set()
    ans = 0
    for i in range(M):
        p, s = input().split()
        if p in accepted:
            continue
        if s == "WA":
            ans += 1
        else:
            accepted.add(p)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def resolve():
    n,m=map(int,input().split())
    kekka=[[0]*n,[0]*n]
    for i in range(m):
        p,s=map(str,input().split())
        if s=='AC':
            kekka[0][int(p)-1]=1
        elif s=='WA' and kekka[0][int(p)-1]==0:
            kekka[1][int(p)-1]+=1
    print('{} {}'.format(sum(kekka[0]),sum(kekka[1])))

resolve()

Submission status: Wrong Answer

Solution code:
s = input().split()
n=int(s[0])
m=int(s[1])
acc=0
penalty={}
ans={}
for i in range(n+1):
    penalty[str(i)]=0
    ans[str(i)]=0
for i in range(m):
    s = input().split()
    if s[1]=='AC':
        ans[s[0]]=1
    if ans[s[0]]==0 and s[1]=='WA':
        penalty[s[0]]+=1

print(list(ans.values()).count(1),sum(list(penalty.values())))

Submission status: Wrong Answer

Solution code:
#input
N, M = map(int, input().split())
L = [[] for _ in range(N)]
for i in range(M):
    x, y = input().split()
    x = int(x)
    L[x-1].append(y)

#output
point = 0
penalty = 0
for i in range(N):
    if not "AC" in L[i]:
        break
    for j in range(len(L[i])):
        if L[i][j] == "WA":
            penalty += 1
        else:
            point += 1
            break

print(point, penalty, sep = " ")

Submission status: Wrong Answer

Solution code:
#c welcome to atcoder
import sys
n,m=map(int,input().split())
ps=[]
num={}
#辞書
ac=0
pena=0
if m==0:
    print('0 0')
    sys.exit()
for i in range(m):
    result=input().split()
    ps.append(result)

for x in ps:
    if x[0] not in num:
        num[x[0]]=0
    if x[1]=="WA" and num[x[0]]==0:
        pena+=1
    if x[1]=="AC" and num[x[0]]==0:
        ac+=1
        num[x[0]]=1
print(ac," ",pena)
#間違えた 問題が順番に並んでるとは限らない

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N, M = map(int, input().split())
L = []
for i in range(M):
  L += [input().split()]

#WA = defaultdict(lambda: 0)
cnt_AC = 0
cnt_WA = 0
alr = set()
for j, k in L:
  j = int(j)
  if j in alr:
    continue
  if k == 'AC':
    cnt_AC += 1
    alr.add(int(j))
  else:
    cnt_WA += 1
    #WA[j] += 1
print(cnt_AC, cnt_WA)

Submission status: Wrong Answer

Solution code:
#input
N, M = map(int, input().split())
L = [[] for _ in range(N)]
for i in range(M):
    x, y = input().split()
    x = int(x)
    L[x-1].append(y)

#output
point = 0
penalty = 0
for i in range(N):
    for j in range(len(L[i])):
        if L[i][j] == "WA":
            penalty += 1
        else:
            point += 1
            break

print(point, penalty, sep = " ")

Submission status: Wrong Answer

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

for i in range(m):
  p,s = input().split()
  p=int(p)-1
  #print(ac,wa,flag)
  if flag[p]!='AC':
    if s=='WA':
      wa+=1
    else:
      ac+=1
      flag[p]='AC'
print(ac, wa)

Submission status: Wrong Answer

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

cnt_WA = 0
cnt_AC = 0
alr = set()
for j, k in L:
  if int(j) in alr:
    continue
  if k == 'AC':
    cnt_AC += 1
    alr.add(int(j))
  else:
    cnt_WA += 1
print(cnt_AC, cnt_WA)

Submission status: Wrong Answer

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

cnt_WA = 0
cnt_AC = 0
alr = set()
for j, k in L:
  if j in alr:
    continue
  if k == 'WA':
    cnt_WA += 1
  if k == 'AC':
    cnt_AC += 1
    alr.add(j)
print(cnt_AC, cnt_WA)

Submission status: Wrong Answer

Solution code:
#c welcome to atcoder
import sys
n,m=map(int,input().split())
ps=[]
num=[]
#空集合
ac=0
pena=0
if m==0:
    print('0 0')
    sys.exit()
for i in range(m):
    result=input().split()
    ps.append(result)
    if ps[i][0] not in num:
        num.append(ps[i][0])
now=0
i=0
for x in ps:
    if x[0]!=num[now]:
        continue
    elif x[1]=="WA":
        pena+=1
    elif x[1]=="AC":
        ac+=1
        now+=1
    if now==len(num):
        break
print(ac," ",pena)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
    
if M==0 :
    print(0,0)
    exit()

ACCNT=[False]*N
Asum=0
WACNT=[0]*N

for i in range(M):
    PI,SI=input().split()
    iii=int(PI)-1
    if ACCNT[iii]==False:
        if SI=="WA" :
            WACNT[iii]=WACNT[iii]+1
        elif SI=="AC" :
            ACCNT[iii]=True
            Asum=Asum+1

Wsum=0
for i in range(N):
    if ACCNT[i]==True:
        Wsum=Wsum+WACNT[iii]

print(Asum,Wsum)

Submission status: Wrong Answer

Solution code:
import sys


def solve(inp):
    (N, M) = map(int, inp.readline().strip().split(' '))
    PS = [inp.readline().strip().split(' ') for i in range(M)]

    total_penalty = 0
    total_ac = 0
    pena = {}
    ac = {}
    for (P, S) in PS:
        P = int(P) - 1
        if S == "WA":
            if P not in pena:
                pena[P] = 0
            pena[P] += 1
        elif S == "AC":
            if P not in ac:
                total_ac += 1
                ac[P] = 1
            if P in pena:
                total_penalty += pena[P]
    return "{} {}".format(total_ac, total_penalty)


def main():
    result = solve(sys.stdin)
    if result:
        print(result)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N,M = list(map(int, input().split()))
ps = []
for i in range(M):
    p, s = input().split()
    ps.append([int(p), s])

ac = {}
wa = 0
for i in range(M):
    if ps[i][1] == 'AC':
        if not ac.get(ps[i][0]):
            ac[ps[i][0]] = 1
    else:
        if not ac.get(ps[i][0]):
            wa += 1

print(len(ac.keys()), wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
    
if M==0 :
    print(0,0)
    exit()

ACCNT=[False]*N
Asum=0
WACNT=[0]*N

for i in range(M):
    PI,SI=input().split()
    iii=int(PI)-1
    if ACCNT[iii]==False:
        if SI=="WA" :
            WACNT[iii]=WACNT[iii]+1
        elif SI=="AC" :
            ACCNT[iii]=True
            Asum=Asum+1

Wsum=0
for i in range(N):
    if ACCNT[iii]==True:
        Wsum=Wsum+WACNT[iii]

print(Asum,Wsum)

Submission status: Wrong Answer

Solution code:
N,M = list(map(int, input().split()))
ps = []
for i in range(M):
    p, s = input().split()
    ps.append([int(p), s])

ac = {}
wa = {}
m = 0
for i in range(M):
    if ps[i][1] == 'AC':
        if not ac.get(ps[i][0]):
            ac[ps[i][0]] = 1
            m += 1
    else:
        wa[ps[i][0]] = 1
    if m == M:
        break

print(len(ac.keys()), len(wa.keys()))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
P = [0 for _ in range(N+1)]
S = [0 for _ in range(N+1)]

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

for i in range(N):
    if S[i] == 0 and P[i] > 0:
      P[i] = 0
        
print(sum(S), sum(P))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ls = []
for i in range(m):
    p,m = map(str,input().split())
    ls.append([p,m])
    
ac = 0
wa = 0
now = ""
p = 0
c = 0
for i in range(len(ls)):
    if now == ls[i][0]:
        continue
    if ls[i][0] != ls[i-1][0] and c == 0:
        wa -= p
        p = 0
    if ls[i][1] == "AC":
        now = ls[i][0]
        ac += 1
        c = 1
        p = 0
    elif ls[i][1] == "WA":
        wa += 1
        c = 0
        p += 1
    if i == len(ls)-1:
      if ls[i][0] != ls[i-1][0] and c == 0:
        wa -= p
        p = 0
      
        
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ls = []
for i in range(m):
    p,m = map(str,input().split())
    ls.append([p,m])
    
ac = 0
wa = 0
now = ""
p = 0
c = 0
for i in range(len(ls)):
    if now == ls[i][0]:
        continue
    if ls[i][0] != ls[i-1][0] and c == 0:
        wa -= p
        p = 0
    if ls[i][1] == "AC":
        now = ls[i][0]
        ac += 1
        c = 1
    elif ls[i][1] == "WA":
        wa += 1
        c = 0
        p += 1
        
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
AC = {} # 1:AC済のみ
WA = {}
acNum = 0
peNum = 0

for i in range(M):
    p,S = input().split()
    p = int(p)
    if S == 'AC':
        if p in AC:
            pass
        else:
            AC[p] = 1
            acNum += 1
    else:
        # S == 'WA'
        if not p in AC:
            if not p in WA:
                WA[p] = 0
            WA[p]+=1
            peNum += 1

print(acNum,peNum)

Submission status: Wrong Answer

Solution code:
import sys

n, m = map(int, sys.stdin.readline().split())
pv = []
for _ in range(m):
    p, v = sys.stdin.readline().split()
    p = int(p)
    v = 1 if v == 'AC' else 0
    pv.append((p, v))

def main():
    return pv
    ac = [0] * (n + 1)
    wa = [0] * (n + 1)
    for p, v in pv:
        wa[p] += (ac[p] | v) ^ 1
        ac[p] |= v
    
    for p in range(1, n+1):
        wa[p] *= ac[p]

    return sum(ac), sum(wa)

if __name__ == '__main__':
    ans = main()
    print(*ans, sep=' ')

Submission status: Wrong Answer

Solution code:
import sys

n, m = map(int, sys.stdin.readline().split())
pv = []
for _ in range(m):
    p, v = sys.stdin.readline().split()
    p = int(p)
    v = 1 if v == 'AC' else 0
    pv.append((p, v))

def main():
    ac = [0] * (n + 1)
    wa = [0] * (n + 1)
    for p, v in pv:
        wa[p] += (ac[p] | v) ^ 1
        ac[p] |= v
    
    return sum(ac), sum(wa)

if __name__ == '__main__':
    ans = main()
    print(*ans, sep=' ')

Submission status: Wrong Answer

Solution code:
n, m = [int(s) for s in input().split()]
a = [0 for _ in range(n)]
for i in range(m):
  p, res = input().split()
  p = int(p) - 1
  if a[p]%2==0:
  	a[p] += 2 if res=='WA' else 1
  
print(sum([tmp%2 for tmp in a]), sum([tmp//2 for tmp in a]))

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
ac = []
ans = 0
for i in range(M):
    p,s = input().split()
    if p in ac:
        continue
    else:
        if s == 'AC':
            if p not in ac:
                ac.append(p)
        else:
            if p not in ac:
                ans+=1

print( len(ac), ans)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
wa = []
ac = []
ans = 0
for i in range(M):
    p,s = input().split()
    if p in ac:
        continue
    else:
        if s == 'AC':
            if p in wa:
                wa.pop(wa.index(p))
            ac.append(p)
        else:
            if p not in wa: 
                wa.append(p)   
            if p not in ac:
                ans+=1

print( len(ac), ans)

Submission status: Wrong Answer

Solution code:
"""
author : dokueki
"""
n,m = map(int,input().split())
d = dict()
if m == 0:
    print(0,0)
else:
    for i in range(m):
        a, b = input().split()
        if b not in d:
            d[b] = list()
            d[b].append(a)
        else:
            d[b].append(a)
    if len(d)==2:
        print(len(set(d["AC"])),len(set(d["WA"])))
    elif len(d) == 1:
        if "AC" in d.keys():
            print(len(set(d["AC"])),0)
        else:
            print(0,len(set(d["WA"])))
    else:
        print(0,0)

Submission status: Wrong Answer

Solution code:
"""
author : dokueki
"""
n,m = map(int,input().split())
d = dict()
for i in range(m):
    a,b = input().split()
    if b not in d:
        d[b] = set(a)
        d[b].add(a)
    else:
        d[b].add(a)
for k,v in d.items():
    print(len(v),end=" ")

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ans_list = [False] * N

now = 0
false_count = 0
ans_false = 0
ans = 0



for i in range(M):
    p, s = input().split()
    p = int(p) - 1
    if ans_list[p]:
        continue
    if now != p:
        now = p
        false_count = 0
    if s == "AC":
        ans += 1
        ans_false = ans_false +  false_count
        ans_list[p] = True
    else:
        false_count += 1
 
print(ans, ans_false)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ans_list = [False] * N

now = 0
false_count = 0
ans_false = 0
ans = 0



for i in range(M):
    p, s = input().split()
    if ans_list[int(p) - 1]:
        continue
    if now != int(p) - 1:
        now = int(p) - 1
        false_count = 0
    if s == "AC":
        ans += 1
        ans_false = ans_false +  false_count
        ans_list[int(p) - 1] = True
    else:
        false_count += 1
 
print(ans, ans_false)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = [0]*(M+1)
S = [None]*M

for i in range(M):
    p[i], S[i] = input().split()

p[M] = -1
p = list(map(int, p))
clear_flag = [False]*(N+1)
correct_N = 0
wrong_N = 0

for i in range(M):
    if i == 0:
        x = p[0]

    #print(p[i], x, clear_flag[x])

    if p[i] != x:
        x = p[i]
    
    if clear_flag[x] == False:
        if S[i] == 'AC':
            correct_N += 1
            clear_flag[x] = True
        else:
            wrong_N += 1

    #print(i, correct_N, wrong_N)

print(correct_N, wrong_N)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ans_list = [False] * 100000

now = 0
false_count = 0
ans_false = 0
ans = 0



for i in range(M):
    p, s = input().split()
    if ans_list[int(p) - 1]:
        continue
    if now != int(p) - 1:
        now = int(p) - 1
        false_count = 0
    if s == "AC":
        now = int(p) - 1
        ans += 1
        ans_false = ans_false +  false_count
        ans_list[int(p) - 1] = True
    else:
        now = int(p) - 1
        false_count += 1
 
print(ans, ans_false)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ans_list = [False] * 100000

now = 0
false_count = 0
ans_false = 0
ans = 0



for i in range(M):
    p, s = input().split()
    if ans_list[int(p) - 1]:
        continue
    if now != int(p) - 1:
        now = int(p) - 1
        false_count = 0
    if s == "AC":
        ans += 1
        ans_false = ans_false +  false_count
        ans_list[int(p) - 1] = True
    else:
        now = int(p) - 1
        false_count += 1
 
print(ans, ans_false)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ans_list = [False] * 100000

now = 0
false_count = 0
ans_false = 0
ans = 0



for i in range(M):
    p, s = input().split()
    if ans_list[int(p) - 1]:
        continue
    if now != int(p) - 1:
        now = int(p) - 1
        false_count = 0
    if s == "WA":
        now = int(p) - 1
        false_count += 1
    else:
        ans += 1
        ans_false = ans_false +  false_count
        ans_list[int(p) - 1] = True
 
print(ans, ans_false)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = [None]*(M+1)
S = [None]*M

for i in range(M):
    p[i], S[i] = input().split()

p[M] = -1
p = list(map(int, p))

clear_flag = [False]*(N+1)

correct_N = 0
wrong_N = 0

for i in range(M):
    if i == 0:
        x = p[0]

    #print(p[i], x, clear_flag[x])
    
    if clear_flag[x] == False:
        if S[i] == 'AC':
            correct_N += 1
            clear_flag[x] = True
        else:
            wrong_N += 1

    if p[i+1] != x:
        x = p[i+1]
    #print(i, correct_N, wrong_N)

print(correct_N, wrong_N)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = [None]*(M+1)
S = [None]*M

for i in range(M):
    p[i], S[i] = input().split()

p[M] = -1
p = list(map(int, p))


clear_flag = [False]*(N+1)

correct_N = 0
wrong_N = 0

for i in range(M):
    if i == 0:
        x = p[0]
    #print(p[i], x, clear_flag[x])

    if p[i] != x:
        x = p[i+1]
    
    if clear_flag[x] == False:
        if S[i] == 'AC':
            correct_N += 1
            clear_flag[x] = True
        else:
            wrong_N += 1
    
    #print(i, correct_N, wrong_N)

print(correct_N, wrong_N)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())  # n: num problem, m: num submit
lst = [input().split() for i in range(m)]

ac = [False] * n
wa = [0] * n

for i in range(m):
    p_i = int(lst[i][0])
    s_i = lst[i][1]
    if s_i == 'AC':
        ac[p_i-1] = True
    else:
        if ac[p_i-1] is False:
            wa[p_i-1] += 1

num_ac = sum(ac)
pnlt = sum(wa)

print(*[num_ac, pnlt])

Submission status: Wrong Answer

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

AC, WA, C = 0, 0, [False] * N
for _ in range(M):
    p, S = input().split()
    n = int(p) - 1
    if not C[n]:
        if S == 'AC':
            AC += 1
            C[n] = True
        else:
            WA += 1

print(AC, WA)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
lst = [input().split() for i in range(m)]

ac = [0] * n
wa = [0] * n

for i in range(m):
    p_i = int(lst[i][0])
    if lst[i][1] == 'AC':
        ac[p_i-1] = 1
    else:
        if ac[p_i-1] == 0:
            wa[p_i-1] += 1

num_ac = sum(ac)
pnlt = sum(wa)

print(num_ac, pnlt)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
lst = [input().split() for i in range(m)]

ac = [0] * n
wa = [0] * n

for i in range(m):
    p_i = int(lst[i][0])
    if lst[i][1] == 'AC':
        ac[p_i-1] = 1
    else:
        if ac[p_i-1] == 0:
            wa[p_i-1] += 1

print(ac)
print(wa)

num_ac = sum(ac)
pnlt = sum(wa)

print(num_ac, pnlt)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
lst = [input().split() for i in range(m)]

ac = [False] * n
wa = [0] * n

for i in range(m):
    p_i = int(lst[i][0])
    if lst[i][1] == 'AC':
        ac[p_i-1] = True
    else:
        if not ac[p_i-1]:
            wa[p_i-1] += 1

num_ac = sum(ac)
pnlt = sum(wa)

print(num_ac, pnlt)

Submission status: Wrong Answer

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

AC, WA, C = 0, 0, [False] * N
for _ in range(M):
    p, S = input().split()
    p = int(p) - 1
    if not C[p]:
        if S == 'AC':
            AC += 1
            C[p] = True
        else:
            WA += 1

print(AC, WA)

Submission status: Wrong Answer

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

for i in range(m):
    p,s = map(str,input().split())
    p = int(p)-1 
    if s == "WA" and ac[p] == 0:
        wa[p] += 1
    elif s == "AC" and ac[p] == 0:
        ac[p] = 1
        pena += wa[p]   #waのみの問題はペナカウントされず、acして初めてwaの回数を加算
    elif ac[p] == 1:
        continue

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

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ps = []
for i in range(m):
    p,s = input().split()
    ps.append([int(p),s])
ps.sort(key=lambda x:x[0])
t = 0
ac = 0
wa = 0
cnt = 0

for res in ps:
    if t != res[0]:
        if res[1] == "WA":
            cnt += 1
        else:
            ac += 1
            wa += cnt
            t = res[0]
            cnt = 0

print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ps = []
for i in range(m):
    p,s = input().split()
    ps.append([int(p),s])
ps.sort(key=lambda x:x[0])
t = 0
ac = 0
wa = 0
cnt = 0

for res in ps:
    if t != res[0]:
        if res[1] == "WA":
            cnt += 1
        else:
            ac += 1
            wa += cnt
            t = res[0]

print(ac,wa)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y


N,M=LI()
RES=[0]*(N+1)
WA=0
for i in range(M):
    ps, re = input().split()
    n = int(ps)
    if not RES[n]:
        if re == "AC": RES[n] = 1
        else: WA += 1

print("{} {}".format(sum(RES), WA))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
x = [0]*(n+1)
p=q=0
for i in range(m):
  k,l = input().split()
  y=int(k)-1
  if x[y]==0:
    if l=='WA':
      q+=1
    else:
      p+=1
      x[y]=1
print(x.count(1),q)

Submission status: Wrong Answer

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

cnt_ac = [0]*(N + 1)
cnt_pena = [0]*(N + 1)
is_ac = [False]*(N + 1)
ans=[0,0]

for i in range(M):
    p, s = input().split()
    p = int(p)
    if not is_ac[p]:
        if s == "AC":
            cnt_ac[p] += 1
            is_ac[p] = True
        else:
            cnt_pena[p] += 1

ans[0]=sum(cnt_ac)
ans[1]=sum(cnt_pena)
print(*ans)