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().split())
t_ans = []
for _ in range(M):
  t_ans.append(list(map(str,input().split())))

flg_num = 0
flg_ac = 0
sum_wa = 0
ans_pe = 0
ans_num = 0

for i in range(M):
  if flg_num != t_ans[i][0] or i == (M-1):
    flg_num = t_ans[i][0]
    ans_pe += sum_wa
    sum_wa = 0
    if flg_ac == 1:
      ans_num += 1
    flg_ac = 0
  if flg_ac == 0:
    if t_ans[i][1] == 'WA':
      sum_wa += 1
    else:
      flg_ac = 1

print(f'{ans_num} {ans_pe}')

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
t_ans = []
for _ in range(M):
  t_ans.append(list(map(str,input().split())))

flg_num = 0
flg_ac = 0
sum_wa = 0
ans_pe = 0
ans_num = 0

for i in range(M):
  if flg_num != t_ans[i][0]:
    flg_num = t_ans[i][0]
    sum_wa = 0
    flg_ac = 0
  if flg_ac == 0:
    if t_ans[i][1] == 'WA':
      sum_wa += 1
    else:
      ans_pe += sum_wa
      ans_num += 1
      flg_ac = 1

print(f'{ans_num} {ans_pe}')

Submission status: Wrong Answer

Solution code:
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n, m = MI()
    ac = [False]*(n+1)
    wa = [0]*(n+1)
    for _ in range(m):
        temp = input().split()
        p, s = int(temp[0]), temp[1]
        if not ac[p]:
            if s == 'AC':
                ac[p] = True
            else:
                wa[p] += 1
    print('{} {}'.format(sum(ac), sum(wa)))



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:

def solve():
    dp = [0]*(N+1)
#    ac = 0
    wa = 0
    for i in range(M):
        if dp[int(ps[i][0])] == 1:
            continue
        if ps[i][1] == "AC":
            dp[int(ps[i][0])] = 1
        else:
            wa += 1
#    print(dp)
    print(sum(dp), int(wa))


if __name__ == "__main__":
    N,M = list(map(int, input().split()))
    ps  = [list(map(str, input().split())) for _ in range(M)]  
    solve()

Submission status: Wrong Answer

Solution code:

def solve():
    dp = [0]*(N+1)
#    ac = 0
    wa = 0
    for i in range(M):
        if ps[i][1] == "AC":
            if dp[int(ps[i][0])] == 0:
                dp[int(ps[i][0])] = 1
        else:
            if dp[int(ps[i][0])] == 0:
                wa += 1
#    print(dp)
    print(sum(dp), wa)


if __name__ == "__main__":
    N,M = list(map(int, input().split()))
    ps  = [list(map(str, input().split())) for _ in range(M)]  
    solve()

Submission status: Wrong Answer

Solution code:

def solve():
    dp = [0]*(N+1)
    ac = 0
    wa = 0
    for i in range(M):
        if ps[i][1] == "AC":
            if dp[int(ps[i][0])] == 0:
                dp[int(ps[i][0])] = 1
        else:
            if dp[int(ps[i][0])] == 0:
                wa += 1
#    print(dp)
    print(ac, wa)


if __name__ == "__main__":
    N,M = list(map(int, input().split()))
    ps  = [list(map(str, input().split())) for _ in range(M)]  
    solve()

Submission status: Wrong Answer

Solution code:

def solve():
    dp = [False]*(N+1)
    ac = 0
    wa = 0
    for i in range(M):
        if ps[i][1] == "AC":
            if not dp[int(ps[i][0])]:
                ac += 1
                dp[int(ps[i][0])] = True
        else:
            if not dp[int(ps[i][0])]:
                wa += 1
    print(ac, wa)


if __name__ == "__main__":
    N,M = list(map(int, input().split()))
    ps  = [list(map(str, input().split())) for _ in range(M)]  
    solve()

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
L = [input().split() for _ in range(M)]
L = sorted(L, key=lambda l: int(l[0]))
c, p, i = 0, 0, 0
normal = True
while i<=M-1:
  if normal and L[i][1]=="WA":
    p += 1
    i += 1
  elif normal and L[i][1]=="AC":
    c += 1
    normal = False
    i += 1
  else:
    if L[i][0]!=L[i-1][0]:
      normal = True
    else:
      i += 1
print(c, p)

Submission status: Wrong Answer

Solution code:
def main():
    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())
    # p = [int(s) for s in p]
    # 問題によってカウントしたい
    # WA = [0] * (n+1)
    # 全体として何個かがわかればいい
    AC = [False] * (n+1)
    wa = 0
    for i in range(m):
        p = int(P[i])
        if AC[p]:
            continue
        else:
            if S[i] == 'WA':
                # WA[p] += 1
                wa += 1
            else:
                AC[p] = True
                # wa += WA[p]
    # なぜか都度足さないとWAを間違えている？
    # wa = sum(WA)
    ac = sum(AC)
    print(ac, wa)
        
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

for ps in P:
  p, s = int(ps[0]), ps[1]
  if ac[p-1]:
    continue
  elif s == 'AC':
    ac[p-1] = True
  else:
    wa[p-1] += 1

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

Submission status: Wrong Answer

Solution code:
def main():
    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())
    # p = [int(s) for s in p]
    # 問題によってカウントしたい
    WA = [0] * (n+1)
    # 全体として何個かがわかればいい
    AC = [False] * (n+1)
    for i in range(m):
        p = int(P[i])
        s = S[i]
        if AC[p]:
            continue
        else:
            if s == 'WA':
                WA[p] += 1
            else:
                AC[p] = True
    wa = sum(WA)
    ac = sum(AC)
    print(ac, wa)
        
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    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())
    # p = [int(s) for s in p]
    # 問題によってカウントしたい
    WA = [0] * (n+1)
    # 全体として何個かがわかればいい
    AC = [False] * (n+1)
    for i in range(m):
        p = int(P[i])
        s = S[i]
        # AC出ててなくて、WAでたらカウント、AC出たらフラグ変更        
        if not AC[p]:
            if s == 'WA':
                WA[p] += 1
            else:
                AC[p] = True
        # AC出てるから次へ
        else:
            continue
    wa = sum(WA)
    ac = sum(AC)
    print(ac, wa)
        
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter, defaultdict
import sys

sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools

import queue
from collections import deque


def main():
    num, submit = map(int, input().split())
    fin_flg = [0 for i in range(num + 1)]
    count_ac, count_wa = 0, 0

    for i in range(submit):
        a, b = input().split()
        a = int(a)
        if fin_flg[a]:
            continue
        if b == "AC":
            count_ac += 1
            fin_flg[a] = 1
        else:
            count_wa += 1

    print(count_ac, count_wa)




if __name__ == '__main__':
    main()

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())
fin=[0]*(n+1)
correct=0
false=0
for i in range(m):
  x=int(p[i])
  if fin[x]==0:
    if s[i]=='AC':
      correct+=1
      fin[x]=1
    else:
      false+=1
print(correct,false)

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())
fin=[0]*n
correct=0
false=0
for i in range(m):
  x=int(p[i])
  if fin[x-1]==0:
    if s[i]=='AC':
      correct+=1
      fin[x-1]=1
    else:
      false+=1
print(correct,false)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
AC=[0]*n
cnt=[0]*n
ans=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    s=str(s)
    if s=='WA' and AC[p-1]==0:
        cnt[p-1]+=1
    if s=='AC' and AC[p-1]==0:
        AC[p-1]=1
        ans+=cnt[p-1]
print(sum(AC),sum(cnt))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
point = 0 ; penalty = 0
false = [0] * n
correct = [0] * n
for i in range(m) :
    p, s = input().split()
    p = int(p)
    if s == "WA" :
        false[p-1] += 1
    if s == "AC" :
        correct[p-1] = 1

for i in range(n) :
    if false[i] > 0 and correct[i] == 1 :
        penalty += 1

print(sum(correct),penalty)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
p,s=[],[]
for i in range(m):
    a,b=map(str,input().split())
    p.append(int(a))
    s.append(b)
c,e=0,0
l=[0]*n
for i in range(m):
    if s[i]=="WA" and l[p[i]-1]==0:
        e+=1
    elif s[i]=="AC" and l[p[i]-1]==0:
        c+=1
        l[p[i]-1]=1
print(str(c)+" "+str(e))

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split(" "))
a=[list(map(str, input().split(" "))) for i in range(m)]
check = [False for i in range(n + 1)]

count = 0
for i in range(m):
  #print(check)
  #print(a[i])
  if check[(int)(a[i][0])] == False and a[i][1] == "AC":
    #print("OK")
    check[(int)(a[i][0])] = True
  elif check[(int)(a[i][0])] == False and a[i][1] == "WA":
    count += 1
    #print("MISS")

print(check.count(True), count)

Submission status: Wrong Answer

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

a = [False]*(N+1)
b = [0]*(N+1)

for i in range(M):
    c = input().split()
    if c[1] == "AC":
        a[int(c[0])] = True
    elif c[1] == "WA" and a[int(c[0])] == False:
        b[int(c[0])] += 1
            
print(sum(a),sum(b))

Submission status: Wrong Answer

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

k = [0]*n
l = [0]*n

for a,b in p:
    if b == 'AC':
        if k[int(a)-1] != 1:
            k[int(a)-1] = 1
    if b == 'WA':
        if k[int(a)-1] != 1:
            l[int(a)-1] +=1
print(k.count(1),sum(l))

Submission status: Wrong Answer

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

k = [0]*n
l = [0]*n

for a,b in p:
    if b == 'AC':
        if k[int(a)-1] != 1:
            k[int(a)-1] = 1
    if b == 'WA':
        if k[int(a)-1] != 1:
            l[int(a)-1] +=1
print(k.count(1),l.count(1))

Submission status: Wrong Answer

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

k = [0]*n
l = [0]*n

for a,b in p:
    if b == 'AC':
        if k[int(a)-1] == 1:
            continue
        if k[int(a)-1] != 1:
            k[int(a)-1] = 1
    if b == 'WA':
        if k[int(a)-1] == 1:
            continue
        if k[int(a)-1] != 1:
            l[int(a)-1] +=1
print(sum(k),sum(l))

Submission status: Wrong Answer

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

k = [0]*n
l = [0]*n

for a,b in p:
    if b == 'AC':
        if k[int(a)-1] == 1:
            pass
        if k[int(a)-1] != 1:
            k[int(a)-1] = 1
    if b == 'WA':
        if k[int(a)-1] != 1:
            l[int(a)-1] +=1
        if k[int(a)-1] == 1:
            pass
print(sum(k),sum(l))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC = [False] * (N + 1)
WA = 0
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if S =='AC':
        AC[p] = True
    elif S == 'WA' and AC[p] == False:
        WA += 1
print(sum(AC), WA)

Submission status: Wrong Answer

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

ac = set()
wa = 0

for i in range(m):
    p, s = input().split()
    if s == 'AC':
        ac.add(p)
    else:
        if not p in ac:
            wa += 1

print(len(ac), wa)

Submission status: Wrong Answer

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

ac = set()
wa = 0

for i in range(m):
    p, s = input().split()
    p = int(p)

    if s == 'AC':
        ac.add(p)
    else:
        if not p in ac:
            wa += 1

print(len(ac), wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
correct=[]
penalty=0
for i in range(M):
  p,S=input().split()
  p=int(p)
  if S=="AC":correct.append(p)
  else:
    if p not in correct: penalty += 1
print(' '.join([str(len(set(correct))), str(penalty)]))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ps = [list(map(str, input().split())) for _ in range(M)]
ans = [0,0]
memo = [0]*(N+1)
for i in range(M):
    p = int(ps[i][0])
    s = ps[i][1]
    if memo[p] == 1:
        continue
    else:
        if s == "WA":
            ans[1] += 1
        else:
            ans[0] += 1
            memo[p] = 1

print(*ans)

Submission status: Wrong Answer

Solution code:
n,m =map(int, input().split())
ac_dic = {}
wa_dic = {}
for _ in range(m):
  p,s = input().split()
  if s == 'AC':
    if p in ac_dic:
      continue
    else:
      ac_dic[p] = 1
  else:
    if p in ac_dic:
      continue
    else:
      if p in wa_dic:
        wa_dic[p] += 1
      else:
        wa_dic[p] = 1

print(f'{sum(ac_dic.values())} {sum(wa_dic.values())}')

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
AClst=[0]*n
AC=0
WA=0
for i in range(m):
  res = input().rstrip().split(' ')
  no=int(res[0])
  ans=str(res[1])
  if AClst[no-1]==0 and ans=="WA":
    WA+=1
  elif AClst[no-1]==0 and ans=="AC":
    AC+=1
    AClst[no-1]=1
print(AC, WA)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
WA = [0] * (N+1)
AC = [0] * (N+1)
Q = [list(input().split()) for _ in range(M)]
for p, s in Q:
  p = int(p)
  if AC[p] == 1:
    continue
  if s == "WA":
    WA[p] += 1
  else:
    AC[p] = 1
print(sum(AC), sum(WA))

Submission status: Wrong Answer

Solution code:
n ,m = map(int,input().split())
ok = [False] * n
wa_cnt = 0
for i in range(m):
    p,s = input().split()
    if s == 'AC':
        ok[int(p)-1] = True
    elif not(ok[int(p)-1]):
        wa_cnt += 1
print(sum(ok),wa_cnt)

Submission status: Wrong Answer

Solution code:
def II(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
ans,pena=0,0
N,M=MI()
P=[0]*N
for i in range(M):
  p,s=input().split()
  p=int(p)
  p-=1
  if s=='AC':
    if P[p]==0:
      ans+=1
      P[p]=1
  if s=='WA':
    if P[p]==0:
      pena+=1
print(ans,pena)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = [False] * N
cnt = 0
_cnt = 0
for i in range(M):
    p, S = input().split()
    if not A[int(p) - 1]:
        if S == 'AC':
            cnt += 1
            A[int(p) - 1] = True
        else:
            _cnt += 1
print(cnt, _cnt)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = [False] * N
cnt = 0
_cnt = 0
for i in range(M):
    p, S = input().split()
    if S == 'AC' and not A[int(p) - 1]:
        cnt += 1
    if S == 'WA' and not A[int(p) - 1]:
        _cnt += 1
    A[int(p) - 1] = A[int(p) - 1] or S == 'AC'
print(cnt, _cnt)

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())
    
AC_list=[0]*N
pena=[0]*N
for i in range(M):
    if S[i]=='AC':
        AC_list[int(p[i])-1]+=1
    else:
        if AC_list[int(p[i])-1]==0:
            pena[int(p[i])-1]+=1
num=0
for i in range(N):
    if AC_list[i]!=0:
        num+=1
print(num ,sum(pena))

Submission status: Wrong Answer

Solution code:
n, m = [int(w) for w in input().split()]

wa_n = [0] * n
ac_n = [0] * n

for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == "AC":
        ac_n[p] = 1
    else:
        if ac_n[p] == 1:
            continue
        else:
            wa_n[p] += 1

print(sum(ac_n), sum(wa_n))

Submission status: Wrong Answer

Solution code:
n, m = [int(w) for w in input().split()]

wa_n = [0] * n
ac_n = [False] * n

for i in range(m):
    p, s = input().split()
    if s == "AC":
        ac_n[int(p) - 1] = True
    else:
        if ac_n[int(p) - 1]:
            continue
        else:
            wa_n[int(p) - 1] += 1

print(sum(ac_n), sum(wa_n))

Submission status: Wrong Answer

Solution code:
# !/usr/bin/python3

"""
https://atcoder.jp/contests/abc151/tasks/abc151_c
Welcome at atcoder
"""


if __name__ == "__main__":
    n, m = list(map(int, input().split()))

    accepted = [False]*(100007+1)
    ac = wa = 0

    for _ in range(m):
        p, s = input().split()
        p = int(p)

        if accepted[p] == True: continue
        elif s == "WA": wa += 1
        elif s == "AC":
            ac += 1
            accepted[p] = True

    print(ac, wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
if m != 0:
    l = [list(input().split()) for i in range(m)]
    p,s = [list(i) for i in zip(*l)]
t = []
x = 0
y = 0

for i in range(m):
    if not p[i] in t:
        if s[i] == 'WA':
            y += 1
        else:
            t.append(p[i])
            x += 1

print(x,y)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
cnt = [0]*n
total = 0
for i in range(m):
    P=list(input().split())
    p = int(P[0]) - 1
    if P[1] == 'WA' and cnt[p] == 0:
        total += 1
    if P[1] == 'AC' and cnt[p] == 0:
        cnt[p] = True
print(sum(cnt),total)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
cnt = [0]*n
total = 0
for i in range(m):
    P=list(input().split())
    p = int(P[0]) - 1
    if P[1] == 'WA' and cnt[p] == 0:
        total += 1
    if P[1] == 'AC' and cnt[p] == 0:
        cnt[p] = 1
print(sum(cnt),total)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
cnt = [0]*n
total = 0
for i in range(m):
    P=list(input().split())
    P[0] = int(P[0]) - 1
    if P[1] == 'WA':
        total += (cnt[P[0]] == 0)
    elif P[1] == 'AC':
        cnt[P[0]] = (cnt[P[0]] == 0)
print(sum(cnt),total)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
cnt = [0]*n
total = 0
for i in range(m):
    P=list(input().split())
    P[0] = int(P[0]) - 1
    if P[1] == 'WA':
        total += cnt[P[0]] == 0
    elif P[1] == 'AC':
        cnt[P[0]] = cnt[P[0]] == 0
print(sum(cnt),total)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
cnt = [0]*n
total = 0
for i in range(m):
    P=list(input().split())
    P[0] = int(P[0]) - 1
    if P[1] == 'WA' and cnt[P[0]] == 0:
        total += 1
    elif P[1] == 'AC' and cnt[P[0]] == 0:
        cnt[P[0]] += 1
print(sum(cnt),total)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n, m = [int(x) for x in input().split()]
    ac = set()
    pen = 0
    for _ in range(m):
        p, ss = [x for x in input().split()]
        if ss == 'AC':
            ac.add(p)
        else:
            if not p in ac:
                pen += 1
    print(len(ac), pen)

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""


"""

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np
N, M = map(int, input().split())
l = np.zeros((N, 2), dtype = int)
for i in range(M):
    p, S = map(str, input().split())
    if S == 'AC':
        l[int(p) - 1, 0] = 1
    else:
        l[int(p) - 1, 1] += 1
print(np.sum(l[:, 0]), np.sum(l[l[:, 0] == 1, 1]))

Submission status: Wrong Answer

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

for _ in range(m) :
    pS[_][0] = int(pS[_][0])

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

for i in range(m) :
    if pS[i][1] == "AC" :
        if ac[pS[i][0]-1] == 0 :
            ac[pS[i][0]-1] += 1
    elif pS[i][1] == "WA" :
        if ac[pS[i][0]-1] == 0 :
            wa[pS[i][0] - 1] += 1

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

Submission status: Wrong Answer

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

for _ in range(m) :
    pS[_][0] = int(pS[_][0])

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

for i in range(m) :
    if pS[i][1] == "AC" :
        if ac[pS[i][0]-1] == 0 :
            ac[pS[i][0]-1] += 1
    elif pS[i][1] == "WA" :
        wa[pS[i][0] - 1] += 1

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

def solve(n,l):
    accepted = [False]*n
    rejected = [0]*n
    ac = 0
    pen = 0
    for test in l:
        if accepted[test[0]]:
            continue
        elif test[1] == "WA":
            rejected[test[0]] += 1
        elif test[1] == "AC":
            accepted[test[0]] = True
            ac += 1
            pen += rejected[test[0]]
    return ac,pen



def main():
    N,M = map(int,input().split())
    l = []
    for i in range(M):
        tmp = input()
        num = int(tmp[0]) -1
        result = tmp[2:]
        l.append([num,result])
    print(*(solve(N,l)))
    return

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

judge = [False]*N
WAcnt = 0
ACcnt = 0
for i in range(M):
    p,S = (x for x in input().split())
    p = int(p)
    if judge[p-1] == False:
        if S == "AC":
            judge[p-1] = True
            ACcnt += 1
        else:
            WAcnt += 1

print(ACcnt,WAcnt)

Submission status: Wrong Answer

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

judge = [False]*N
WAcnt = [0]*N
ACcnt = 0
for i in range(M):
    p,S = (x for x in input().split())
    p = int(p)
    if judge[p-1] == False:
        if S == "AC":
            judge[p-1] = True
            ACcnt += 1
        else:
            WAcnt[p-1] += 1

print(ACcnt,sum(WAcnt))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ps = [input().split() for _ in range(M)]

correct = [0] * N
penalty = [0] * N
for p, s in ps:
    p = int(p)
    if correct[p-1] == 0:
        if s == 'AC':
            correct[p-1] = 1
        else:
            penalty[p-1] += 1
print(sum(correct), sum(penalty))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ps = [input().split() for _ in range(M)]

correct = [0] * N
penalty = [0] * N
for p, s in ps:
    p = int(p)
    if correct[p-1] == 1:
        continue
    if s == 'AC':
        correct[p-1] = 1
    else:
        penalty[p-1] += 1
print(0, 0)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ps = [input().split() for _ in range(M)]

correct = [0] * N
penalty = [0] * N
for p, s in ps:
    p = int(p)
    if correct[p-1] != 0:
        continue
    if s == 'AC':
        correct[p-1] = 1
    else:
        penalty[p-1] += 1
print(sum(correct), sum(penalty))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ps = [input().split() for _ in range(M)]

correct = [0] * N
penalty = [0] * N
for p, s in ps:
    p = int(p)
    if correct[p-1] != 1:
        continue
    if s == 'AC':
        correct[p-1] = 1
    else:
        penalty[p-1] += 1
print(sum(correct), sum(penalty))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ps = [input().split() for _ in range(M)]

correct = [0] * N
penalty = [0] * N
for p, s in ps:
    p = int(p)
    if correct[p-1] == 1:
        continue
    if s == 'AC':
        correct[p-1] = 1
    else:
        penalty[p-1] += 1
print(sum(correct), sum(penalty))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ps = [input().split() for _ in range(M)]

correct = [0] * N
cnt = [0] * N
for p, s in ps:
    p = int(p)
    if correct[p-1] == 1:
        continue
    if s == 'AC':
        correct[p-1] = 1
    else:
        cnt[p-1] += 1
print(sum(correct), sum(cnt))

Submission status: Wrong Answer

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

a = [0]*n
w = [0]*n

for i in range(m):
    p,s = input().split()
    
    if s == "AC":
        a[int(p)-1] = 1
        
    if a[int(p)-1] == 0 and s == "WA":
        w[int(p)-1] += 1

print(sum(a),sum(w))

Submission status: Wrong Answer

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

cnt = [[0, 0] for _ in range(N + 1)]
for p, s in X:
    if s == "AC":
        cnt[p][0] = 1
    elif cnt[p][0] == 0:
        cnt[p][1] += 1

print(sum(v for v, _ in cnt), sum(v for _, v in cnt))

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())
    
AC = [0]*N
ACcount = 0
WAcount = 0
for i in range(M):
    if AC[int(P[i])-1]==0:
        if S[i] == 'WA':
            WAcount += 1
        if S[i] == 'AC':
            ACcount += 1
            AC[int(P[i])-1] = 1 
print(ACcount,WAcount)

Submission status: Wrong Answer

Solution code:
def main():
  N, M = map(int, input().split())
  
  p = ['']*M
  s = ['']*M
  for i in range(M):
    p[i], s[i] = input().split()
    
  cnt = ['']*(N+1)
  cntAC = 0
  cntWA = 0
  
  for i in range(M):
    #もしクリアしたことがあったらノーカウント
    if cnt[int(p[i])] == 'clear':
      continue
    
    #WAならカウント＋１
    if s[i] == 'WA':
      cntWA += 1
    
    #ACならクリアしたことを記録してカウント＋１
    if s[i] == 'AC':
      cnt[int(p[i])] = 'clear'
      cntAC += 1
    
  print(cntAC, cntWA)
  
  
  
main()

Submission status: Wrong Answer

Solution code:
def solve():
  ans = [0,0]
  N, M = map(int, input().split())
  WAs = [0]*N
  for i in range(M):
    p, S = input().split()
    p = int(p)
    if WAs[p-1]>=0:
      if S=='WA':
        WAs[p-1] += 1
        ans[1] += 1
      if S=='AC':
        ans[0] += 1
        WAs[p-1] = -1
  return ans
print(*solve())

Submission status: Wrong Answer

Solution code:
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,M = map(int,readline().split())
A = []
cnt = 0
for _ in range(M):
    p,S = readline().decode().split()
    if (S == 'WA') and (p in A) == False:
        cnt += 1
    if S == 'AC':
        A.append(p) 
print(len(set(A)),cnt)

Submission status: Wrong Answer

Solution code:
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,M = map(int,readline().split())
A = []
cnt = 0
for _ in range(M):
    p,S = readline().decode().split()
    if S == 'WA':
        cnt +=1
    else:
        A.append(p) 
print(len(set(A)),cnt)

Submission status: Wrong Answer

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

question = {}

for m in range(M):
    num, result = input().split()
    if question.get(num):
        if result == 'WA' and not question[num]['AC']:
            question[num]['WA_c'] += 1
        elif result == 'AC' and not question[num]['AC']:
            question[num]['AC'] = True
    else:
        question[num] = {'WA_c': 0, 'AC': False}
        if result == 'WA':
            question[num]['WA_c'] += 1
        else:
            question[num]['AC'] = True


wa_c = 0
ac_c = 0
for key, value in question.items():
    wa_c += question[key]['WA_c']
    if question[key]['AC']:
        ac_c += 1

print(ac_c, wa_c)

Submission status: Wrong Answer

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

question = {}

for m in range(M):
    num, result = input().split()
    if question.get(num):
        if result == 'WA' and not question[num]['AC']:
            question[num]['WA_c'] += 1
        elif result == 'AC':
            question[num]['AC'] = True
    else:
        question[num] = {'WA_c': 0, 'AC': False}
        if result == 'WA':
            question[num]['WA_c'] += 1
        else:
            question[num]['AC'] = True


wa_c = 0
ac_c = 0
for key, value in question.items():
    wa_c += question[key]['WA_c']
    if question[key]['AC']:
        ac_c += 1

print(ac_c, wa_c)

Submission status: Wrong Answer

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

pi = set()
ac = 0
wa = 0
for p, s in ps:
    p = int(p)
    if p not in pi:
        if s == 'AC':
            ac += 1
            pi.add(p)
        if s == 'WA':
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

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

ok = 0
ng = 0
end = set()


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

    if not p in end:
        if S == 'AC':
            ok += 1
            end.add(p)
        else:
            ng += 1

print('{} {}'.format(ok, ng))

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 = input().split()
    p = int(p) 

    if S == "AC":
        AC[p-1] = 1
    elif S == "WA" and AC[p-1] != 1:
        WA[p-1] += 1

for j in range(N):
    if AC[j]==0:
        WA[j]==0

print(sum(AC), sum(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 = input().split()
    p = int(p) 

    if S == "AC":
        AC[p-1] = 1
    elif S == "WA" and not AC[p-1]:
        WA[p-1] += 1

for j in range(N):
    if AC[j]==0:
        WA[j]==0

print(sum(AC), sum(WA))