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:
import numpy as np

n, m = map(int, input().split())

answer = [[False, 0] for i in range(n)]

for i in range(m):
  p, s = input().split()
  p = int(p) - 1
  if s == 'AC':
    answer[p][0] = True
  elif s == 'WA' and answer[p][0] == False:
    answer[p][1] += 1

arr = np.array(answer)

print(*sum(arr))

Submission status: Wrong Answer

Solution code:
import sys
from pprint import pprint

def solve(n, m, p, s):
    solved = {}
    for i in range(n):
        solved[i] = False

    n_ac = 0
    n_wa = 0
    for i in range(m):
        if not solved[p[i]-1] and s[i] == "WA":
            n_wa += 1
        if not solved[p[i]-1] and s[i] == "AC":
            n_ac += 1
            solved[p[i]-1] = True
    print(n_ac, n_wa)


if __name__ == '__main__':
    n, m = map(int,sys.stdin.readline().strip().split(" "))
    p = [0] * m
    s = [""] * m
    for i in range(m):
        p_i, s[i]  = sys.stdin.readline().strip().split(" ")
        p[i] = int(p_i)
    
    solve(n, m, p, s)

Submission status: Wrong Answer

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

re = [[] for _ in range(n)]

for p, s in ps:
  p = int(p) - 1
  re[p].append(s)

c = 0
pe = 0

for r in re:
  for x in r:
    if x == 'AC':
      c += 1
      break
    else:
      pe += 1

print(c, pe)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

correct = 0
penalty = 0

ans = set([])

for _ in range(M):
    p, S = input().split()
    if p in ans:
        break
    elif S == 'WA':
        penalty += 1
    else:
        correct += 1
        ans.add(p)

print(correct, penalty)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p = []
q = []
for i in range(m):
  s = list(map(str,input().split()))
  p.append(s[0])
  q.append(s[1])
kotae = {}
panel = 0
ac = 0
acichi = [[],[]] # 問題、位置の順
for i in range(m):
  if p[i] not in kotae:
    kotae[p[i]] = []
  if p[i] not in  acichi[0]:
    if q[i] == "AC":
      acichi[0].append(p[i])
      acichi[1].append(q[i])
      ac += 1
    else:
      panel += 1
print(ac,panel)

Submission status: Wrong Answer

Solution code:
n,m = list(map(int, input().split()))
wa_cnt = 0
ac = set()
for _ in range(m):
  p, s = input().split()
  if(s == "AC"):
    ac.add(p)
  if (p not in ac and s=="WA"): 
    wa_cnt += 1
print(len(ac), wa_cnt)

Submission status: Wrong Answer

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

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

    if p in my_dict:
        my_dict[p].append(s)
    else:
        my_dict[p] = [s]

a_count = 0
w_count = 0

for key, items in my_dict.items():
    flag = False
    for s in items:
        if s == "AC":
            a_count += 1
            flag = True
            break
        else:
            w_count += 1

print(a_count, w_count)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
#AC, WA
nn = [ [0, 0] for i in range(n)]
ps = []
for i in range(m):
    p, s = input().split()
    p = int(p)
    if s == "AC":
        if nn[p - 1][0] == 0:
            nn[p - 1][0] += 1
        else:
            pass
    else:
        if nn[p - 1][0] == 0:
            nn[p - 1][1] += 1
        else:
            pass

ac = 0
wa = 0
for i in range(n):
    ac += min(1, nn[i][0])
    wa += nn[i][1]
print(str(ac) + " " + str(wa))

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    pre = set()
    ans, ans2 = 0, 0
    for _ in range(M):
        p, s = input().split()
        
        if N < int(p):
            continue

        if s == 'AC' and  int(p) in pre:
            continue
        if s == 'AC':
            pre.add(int(p))
            ans += 1
        elif not int(p) in pre:
            ans2 += 1
    print(ans, ans2)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

c = 0
ans = 0
ok = set()
for num, r in scores:
    if r == 'AC' and num not in ok:
        ans += 1
        ok.add(num)
    elif r == 'WA' and num not in ok:
        c += 1
    p = num
print(ans, c)

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())
dic={}
w=ac=0
for _ in range(m):
  a,b=readline().split()
  if a in dic:
    if dic[a]:
      if b == b'WA':
        w+=1
      else:
        ac+=1
        dic[a]=False
  else:
    dic[a]=True
    if b == b'WA':
      w+=1
      print(w)
    else:
      ac+=1
      dic[a]=False
print(ac,w)

Submission status: Wrong Answer

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

ac_list = [0] * N

ac_count = 0
wa_count = 0

for p, s in ps_list:

    p = int(p)-1

    if s == 'AC':
        if not ac_list[p]:
            ac_count += 1
            ac_list[p] = 1
    elif s == 'WA':
        if not ac_list[p]:
            wa_count += 1

print(' '.join([str(ac_count), str(wa_count)]))

Submission status: Wrong Answer

Solution code:
N,M = [int(i) for i in input().split()]
nes = ['0'] * M
for i in range(M) :
    li = input().split()
    nes[i] = li
sum_ac = 0
sum_wa = 0
l = [0] * (N+1)
for i in range(N+1) :
    l[i] = True
for i in range(M) :
    if nes[i][1] == "AC" :
        if l[int(nes[i][0])] :
            sum_ac+=1
            l[int(nes[i][0])] = False
    if nes[i][1] == "WA" :
        if l[int(nes[i][0])] :
            sum_wa +=1
print(sum_ac,sum_wa)

Submission status: Wrong Answer

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

pena = [0 for i in range(n)]
acc = [0 for i in range(n)]

for i in range(m):
    pp, ss = input().split(' ')
    p = int(pp) - 1

    if acc[p] == 0:
        if ss == 'WA':
            if pena[p] == 0:
                pena[p] = 1
            else:
                pena[p] += 1
        else:
            acc[p] = 1

print(sum(acc), sum(pena))

Submission status: Wrong Answer

Solution code:
def main():
  N, M = map(int, input().split())
  
  correct = [0] * N
  penalty = [0] * N
  pena = 0
  
  for _ in range(M):
    pi, si = input().split()
    pi = int(pi)
    
    if si == 'WA' and correct[pi-1] == 0:
      penalty[pi-1] += 1
    elif si =='AC':
      correct[pi-1] = True
      pena += penalty[pi-1]

  print(sum(correct), pena)       

main()

Submission status: Wrong Answer

Solution code:
[N,M] = list(map(int,input().split()))
P = []
S = []
for i in range(M):
    [ptmp,stmp] = list(input().split())
    P.append(ptmp)
    S.append(stmp)
ans1 = [0]*N
ans2 = [0]*N
for i in range(M):
    prob = int(P[i])
    resu = S[i]
    if resu=="AC":
        ans1[prob-1]=1
    elif resu=="WA" and ans1[prob-1]!=1:
        ans2[prob-1]+=1

cnt1=0
cnt2=0
for i in range(N):
    if ans1[i]==1:
        cnt1+=ans1[i]
        cnt2+=ans2[i]

output = str(cnt1) + " " + str(cnt2)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ca = [0]*(n+1)
cw = [0]*(n+1)
for i in range(m):
    a,b = map(str,input().split())
    if b == "WA" and ca[int(a)]==0:
        cw[int(a)] = 1
    elif b == "AC":
        ca[int(a)] = 1
print(sum(ca),sum(cw))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ps = [list(input().split()) for _ in range(m)]
wa = 0
ac = 0
flag = -1
for i in range(m):
  if flag == ps[i][0]:
    continue
  else:
    if ps[i][1] == "AC":
      ac += 1
      flag = ps[i][0]
    else:
      wa += 1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N, M = [int(i) for i in input().split()]
a = [0] * 100010
wa = 0
ac = 0
for i in range(M):
    t, s = input().split()
    t = int(t)-1
    if s == 'AC':
        if a[t]==0:
            a[t] = 1
            ac += 1
    elif s == 'WA':
        if a[t]==0:
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

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

if m == 0:
    print(0, 0)
else:
    check_list = [0]*200000
    wa = 0
    ac = 0
    for i in range(m):
        p, s = input().split()
        p = int(p)
        if check_list[p] == 1:
            continue
        elif check_list[p] == 0 and s == 'AC':
            check_list[p] = 1
            ac += 1
        elif check_list[p] ==0 and s == 'WA':
            wa += 1
    print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
ans = [0]*n
AC = 0
WA = 0
for i in range(m):
    temp = list(map(str, input().split()))
    if ans[int(temp[0])-1] == 0:
        if temp[1] == "AC":
            ans[int(temp[0])-1] = 1
            AC += 1 
        else:
            WA += 1
print(AC, WA)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
if m == 0:
  print(0,0)
  exit()
A=[[0,0] for _ in range(n+1)]
for i in range(m):
  p,s=input().split()
  p=int(p)
  if A[p][0]==1:
    continue
  elif s=='AC':
    A[p][0]=1
  else:
  	A[p][1]+=1
ac=0
wa=0
for a in A:
  ac+=a[0]
  wa+=a[1]
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
A={}
for i in range(m):
    num,result=input().split()
    if num not in A:
        A[num]=[result]
    else:
        A[num] +=[result]

ans,cnt=0,0
for v,m in A.items():
    flag=0
    for i in m:
        if i=="AC":
            flag=1
            ans +=1
            break
        if flag==0 and i=="WA":
            cnt +=1

print(ans,cnt)

Submission status: Wrong Answer

Solution code:
n,m=list(map(int, input().split()))
cor,wro=0,0
dic={}
for i in range(m):
  x,y=list(map(str, input().split()))
  if y=="AC" and x not in dic:
    cor+=1
    dic[x]="ok"
  elif y=="WA":
    if x not in dic:
      wro+=1
  
print(cor,wro)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
fin=[False]*(10**5+10)
pena=0
corr=0
for _ in range(m):
    p,s=input().split()
    p=int(p)
    
    if fin[p]==True:
      continue
    
    if s=="WA":
        pena+=1
    if s=="AC":
        corr+=1
        fin[p]=True
        
print(corr,pena)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
cnt = 0
ac_cnt = 0
wa_cnt = 0
ans_flag = 0
bp = -1
for _ in range(m):
    p, s = map(str, input().split())
    if bp != p:
        cnt = 0
        ans_flag = 0
    if s == 'WA' and ans_flag == 0:
        cnt += 1
    elif bp == p and s == 'AC' and ans_flag == 0:
        ac_cnt += 1
        wa_cnt += cnt
        cnt = 0
        ans_flag = 1
    bp = p

print(ac_cnt, wa_cnt)

Submission status: Wrong Answer

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

from collections import defaultdict
d = defaultdict(list)
ab = [tuple(input().split()) for i in range(m)]

nAC = 0
nWA = 0


for a,b in ab:
    a = int(a)

    if len(d[a]) == 0:
        flag = 0

    if flag == 1:
        continue

    if flag == 0 and b == 'AC':
        flag = 1
        nAC += 1

    if flag == 0 and b == 'WA':
        nWA += 1

    d[a].append(b)

print(nAC, nWA)

Submission status: Wrong Answer

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

ac_list = []
ac = 0
wa = 0

for i in range(m):
  p, s = input().split()
  
  if (p not in ac_list) and s == 'WA':
    wa += 1
  elif (p not in ac_list) and s == 'AC':
    ac += 1
    ac_list.append(p)
  
print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
ac = [0] * n
numac = 0
numwa = 0
p = 0
for i in range(m):
    _a, _s = list(input().split())
    _a = int(_a)
    if _s == "AC":
        if ac[_a - 1] == 0:
            numac += 1
            ac[_a - 1] = 1
    elif _s == "WA":
        if ac[_a - 1] == 0:
            numwa += 1
print("{} {}".format(numac, numwa))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
L=[]
AC=0
WA=0
for i in range(m):
    p,s=input().split()
    if p not in L and s=="WA":
        WA+=1
    if p not in L and s=="AC":
        AC+=1
        L.append(p)
print(AC,WA)

Submission status: Wrong Answer

Solution code:
n, m = [int(i) for i in input().split()]
wrong_count = [0 for i in range(n)]
correct_count = [0 for i in range(n)]
for i in range(m):
    p, s = input().split()
    if s == 'AC':
        correct_count[int(p)-1] = 1
    elif correct_count[int(p)-1] == 0:
        wrong_count[int(p)-1] += 1
print(sum(correct_count), sum(wrong_count))

Submission status: Wrong Answer

Solution code:
def main():
    n, m = list(map(int, input().split()))
    ac_list = [0] * n
    wa_list = [0] * n
    for _ in range(m):
        tmp = input().split()
        contest_num = int(tmp[0]) - 1
        if ac_list[contest_num]:
            continue
        ret = tmp[1]
        if ret == "AC":
            ac_list[contest_num] = 1
        else:
            wa_list[contest_num] = 1

    print(sum(ac_list), sum(wa_list))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


m = {}

N, M = list(map(int, input().split()))
penalty = 0
for i in range(M):
    p, s = input().split()
    p = int(p)
    if s == "AC":
        m[p] = 1
    elif s == "WA" and p not in m:
        penalty += 1


print(str(len(m.keys())) + " " + str(penalty))

Submission status: Wrong Answer

Solution code:
import math

def main():
    N, M = map(int, input().split())

    ans = [False for _ in range(N)]

    ac = 0
    wa = 0

    for _ in range(M):
        i, result = input().split()
        i = int(i)

        if ans[i-1] == False:
            if result == "AC":
                ac += 1
                ans[i-1] = True
            else:
                wa += 1
    print(sum(ans), wa)
    return 0
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import re
import math
#import numpy as np


#main
n,m=map(int,input().split())
MAP={}
PS=[]
for a in range(m):
    s,t=input().split()
    if(not s in MAP):MAP[s]=[]
    MAP[s].append(t)
ac=0
wa=0
for a,b in MAP.items():
    if(not "AC" in MAP[a]):continue
    for c in b:
        if(c=="WA"):
            ac+=1
        else:
            wa+=1
            break
print(ac,wa)

Submission status: Wrong Answer

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

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

for p, s in ps:
    p = int(p) - 1
    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:
l = input().split(" ")
N = int(l[0])
M = int(l[1])

answered = []

ac_count = 0
wa_count = 0

for n in range(M):
    result = [i for i in input().split(" ")]
    p = result[0]
    if p in answered:
        continue
    s = result[1]
    if s == "WA":
    	wa_count += 1
    else:
        ac_count += 1
        answered.append(p)

print(ac_count, wa_count)

Submission status: Wrong Answer

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

ac = []
wa = 0

for i in range(M):
    [p, S] = A[i]
    if not p in ac:
        if S == 'WA':
            wa += 1
        else:
            ac.append(p)

print(len(ac), wa)

Submission status: Wrong Answer

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

ac = []
now = 0

cnt_ac = 0
cnt_pen = 0

for i in range(m):
    p, s = map(str, input().split())
    
    if p not in ac:
        if s == 'AC':
            ac.append(p)
            cnt_ac += 1
        if s == 'WA':
            cnt_pen += 1
    
    if p in ac:
        if s == 'AC':
            continue
        if s == 'WA':
            continue


print(cnt_ac, cnt_pen)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
results = [False] * (n + 1)
ac, wa = 0, 0
for i in range(m):
    p, s = input().split()
    p = int(p)
    if results[p]:
      continue
    if s == "AC":
        ac += 1
        results[p] = True
    else:
        wa += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
ans = 0
ans2 = 0
t = -3
tt = 0
ps = [tuple(map(str,input().split())) for i in range(M)]
pss = set(sorted(ps))
for i in pss:
    if "AC" in i:
        ans += 1
for i in range(len(ps)):
    if ps[i][1] == "WA":
        t = ps[i][0]
        tt += 1
    if ps[i][0] == t and ps[i][1] == "AC":
        ans2 += tt
        tt = 0
print(ans, 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] = input().split()
    p[i] = int(p[i])

ac = 0
wa = 0
untilAC = [True for _ in range(n)]

for i in range(m):
    if s[i] == "AC" and untilAC[p[i]-1]:
        untilAC[p[i]-1] = False
        ac += 1
    elif untilAC[p[i]-1] and s[i] == "WA":
        wa += 1
print(ac, 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()
    if s == 'AC':
        ac[int(p)] = 1
    elif (not ac[int(p)]):
        wa[int(p)] += 1
print(sum(ac), sum(wa))

Submission status: Wrong Answer

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

N, M = list(map(int, input().split()))
ps_list = [[] for _ in range(N)]

for _ in range(M):
    p, s = list(input().split())
    p = int(p) - 1
    ps_list[p].append(s)

wa_c = 0
ac_c = 0

for i, ss in enumerate(ps_list):
    for s in ss:
        if s == "WA":
            wa_c += 1
        else:
            ac_c += 1
            break

ans = "{} {}".format(ac_c, wa_c)
print(ans)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
flag = [False] * (10**5 + 100)
wa = 0
for i in range(m):
    p, s = map(str, input().split())
    p = int(p)

    if flag[p] == False:
        if s == "AC":
            flag[p] = True
        else:
            wa += 1

print(sum(flag), wa)

Submission status: Wrong Answer

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

ps = [ list(input().split()) for _ in range(m) ]

ac_list = []
ac_count = 0
wa_count = 0
for i in range(m):
    q = str(ps[i][0])
    if q in ac_list:
        pass
    else:
        if ps[i][1] == "AC":
            ac_count += 1
            ac_list.append(str(ps[i][0]))
        else:
            wa_count += 1

print(ac_count,wa_count)

Submission status: Wrong Answer

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

N, M = map(int, input().split())
p = []
s = []

for _ in range(M):
    a, b = input().split()
    p.append(int(a))
    s.append(0 if b == 'WA' else 1)

sl = []
ans = 0
pen = 0
for i in range(M):
    if p[i] in sl:
        continue

    if s[i]:
        ans += 1
        sl.append(p[i])
    else:
        pen += 1

print(ans, pen)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#solve
def solve():
    n, m = LI()
    d = [0] * n
    wa = [0] * n
    for _ in range(m):
        p, s = input().rstrip().split()
        p = int(p) - 1
        if d[p]:
            continue
        if s == "AC":
            d[p] = 1
        else:
            wa[p] += 1
    ans = 0
    for i in range(n):
        if d[i]:
            ans += wa[p]
    print(sum(d), ans)

    return


#main
if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
n,m=input().strip().split(" ")
n,m=[int(n),int(m)]
f=[0 for _ in range(n+1)]
f1=[0 for _ in range(n+1)]
for i in range(m):
    a,b=input().strip().split(" ")
    a,b=[int(a),str(b)]
    if b=="AC":
        f[a]=1
    elif b=="WA":
        if f[a]==0:
            f1[a]+=1
print(sum(f),sum(f1))

Submission status: Wrong Answer

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

memo=[]
wa=0
ac=0
for i in range(M):
	p,s=input().split(" ")
	if not p in memo:
		if s=="AC":
			ac+=1
			memo.append(p)
		else:
			wa+=1
print("{} {}".format(ac,wa))

Submission status: Wrong Answer

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

List=[list(input().split()) for i in range(M)]

AC = []
accnt = 0
wacnt = 0
a = 0
for i in range(M):
  num = List[i][0]
  res = List[i][1]
 
  if res == "AC":
    if num in AC:
      a = 0
    else:
      accnt = accnt + 1
      AC.append(num)
    
  if res == "WA":
    if num in AC:
      a = 0
    else:
      wacnt = wacnt + 1
  
ans = [accnt,wacnt]
print(*ans)

Submission status: Wrong Answer

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

check = 0
sum_ok = 0
sum_miss = 0
former_ok = []
for i in range(m):
    if s[i] == 'AC' and p[i] not in former_ok:        
        sum_ok += 1
        former_ok.append(p[i])
    elif s[i] == 'WA' and check == 1:
        sum_miss += 1
        check = 1
    else:
        check = 1
print(sum_ok, sum_miss)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
li_AC = []
count_WA = 0
for i in range(M):
    p, S = input().split()
    p = int(p)
    if p not in li_AC:
        if S == "AC":
            li_AC.append(p)
        if S == "WA":
            count_WA += 1
print(len(list(set(li_AC))), count_WA)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
d={}
for i in range(m):
    p,s=map(str,input().split())
    if p not in d:
        d[p]=[s,1]
    elif d[p][0]=="WA":
        d[p][0]=s
        d[p][1]+=1
ans=[0,0]
for i in d:
    if d[i][0]=="AC":
        ans[0]+=1
        ans[1]+=d[i][1]-1
    else:
        ans[1]+=d[i][1]
print(*ans)

Submission status: Wrong Answer

Solution code:
N , M = map(int,input().split())
lst = []
AC_list = [False] * N
for _ in range(M):
    r , s = input().split()
    lst.append([int(r) - 1, s])

wa_cnt_list = [0] * N
for question_num , judge in lst:
    if AC_list[question_num]:
        continue
    elif judge == "WA":
        wa_cnt_list[question_num] += 1
    elif judge == "AC":
        AC_list[question_num] = True
print(sum(AC_list), sum(wa_cnt_list))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
bl = [True]*N
ac,wa = 0,0
for i in range(M):
    p,s = input().split()
    p = int(p)
    if bl[p-1]:
        if s == "WA":
            wa += 1
        else:
            ac += 1
            bl[p-1] = False
print(ac,wa)

Submission status: Wrong Answer

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

T = [0] * (N + 1)
ans = [0,0]


for i in range(M):
  p,s = input().split()
  p = int(p)
  if T[p] == 0:
    T[p] = s
    if s == "AC":
      ans[0] += 1
    else:
      ans[1] += 1
  elif T[p] == "AC":
    continue
  elif T[p] == "WA":
    if s == "AC":
      T[p] == s
      ans[0] += 1
      
print(ans[0],ans[1])

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

N, M = map(int, input().split())
P = list()
S = list()
for i in range(M):
    p, s = map(str, input().split())
    P.append(int(p))
    S.append(s)

ac = 0
wa = 0
if M == 0:
    print(ac, wa)
    exit()

now = P[0]
for p, s in zip(P, S):
    if p == now and s == 'WA':
        wa += 1
    elif p == now and s== 'AC':
        ac += 1
        now += 1

print(ac, wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
ps = dict()
for m in range(M):
    a = input().split()
    if a[0] not in ps:
        ps[a[0]] = [a[1]]
    else:
        ps[a[0]].append(a[1])
ans = [0, 0]
for x in ps:
    for y in ps[x]:
        if y == "WA":
            ans[1] += 1
        else:
            ans[0] += 1
            break
print(ans[0],ans[1])

Submission status: Wrong Answer

Solution code:
# ABC151 C
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(str, input().split())
nl = lambda: list(map(int, input().split()))
n,m=map(int, input().split())
ac=set()
ac_cnt=0
wa_cnt=0
for i in range(m):
    p,s=nm()
    if s=='AC':
        if int(p) in ac:
            continue
        else:
            ac.add(int(p))
            ac_cnt+=1
    elif s=='WA':
        if int(p) in ac:
            continue
        else:
            wa_cnt+=1
print(ac_cnt,wa_cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
AC=[]
WA=0
for _ in range(M):
  p,S=input().split()
  if S=="AC":
    AC.append(p)
  elif p not in AC:
    WA+=1
print(len(set(AC)),WA)

Submission status: Wrong Answer

Solution code:
import math
import fractions

n, m = map(int, input().split())
ac_list = [0 for i in range(n)]
wa_cnt = 0
cnt = 1
while cnt <= m:
    p, s = input().split()
    p = int(p)
    if s == "AC":
        ac_list[p - 1] = 1
    else:
        if ac_list[p - 1] == 0:
            wa_cnt += 1
    cnt += 1
print(sum(ac_list), wa_cnt)

Submission status: Wrong Answer

Solution code:
n,m=[int(x) for x in input().split()]
mark=[0]*(n+1)
d=dict()
pnt=0
crt=0
for i in range(0,m):
    a,v=[x for x in input().split()]
    a=int(a)
    if mark[a]==0:
        if v=='AC':
            mark[a]=1
        else:
            pnt+=1
for i in range(0,n+1):
    if mark[i]==1:
        crt+=1
print(crt,pnt)

Submission status: Wrong Answer

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

ansAC=0
ansP=0

n=[0]*N
f=[False]*N

for i in range(M):
    p,s =map(str,input().split())
    p=int(p)-1

    if s=="AC":
        ansP+=n[p]
        if f[p]==False:
            ansAC += 1
            f[p]=True
    else:
        n[p]+=1

print(ansAC,ansP)

Submission status: Wrong Answer

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

AB=[]
for i in range(M):
    a,b=map(str,input().split())
    AB.append([a,b])

AC,WA=0,0
cu=AB[0][0]
L=[[0,0] for i in range(N+1)]

for i in range(M):
    t,s=int(AB[i][0]),AB[i][1]
    if L[t][0]==1:
        continue
    elif s=='AC':
        L[t][0]+=1
    else:
        L[t][1]+=1

for i in range(N+1):
    AC+=L[i][0]
    WA+=L[i][1]

#print(AB)
#print(L)
print(AC,WA)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    n,m=mis()
    lis=[0]*(n+1)
    ac,wa=0,0
    for i in range(m):
        P,s=input().split()
        p=int(P)
        if lis[p]==0:
            if s=='WA': wa+=1
            else: lis[p]=1
    print(sum(lis),wa)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

p=list(map(int,p))

for i in range(m):
    if k[p[i]-1]:
        if s[i]=="AC":
            k[p[i]-1]=False
            ac+=1
        else:
            wa+=1

print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
A=0
W=0
li=[[0 for i in range(1)] for j in range(n)]
for i in range(m):
    p,s=map(str,input().split())
    p=int(p)
    if s=="AC":
        if li[p-1][0]==0:
            li[p-1][0]+=1
            A+=1
    else:
        if li[p-1][0]==0:
            W+=1

print(A,W)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
AC=[0]*(N+1)
WA=[0]*(N+1)
for i in range(M):
    p,S=input().split()
    p=int(p)
    if S=='WA' and AC[p]==0:
        WA[p]+=1
    if S=='AC' and AC[p]==0:
        AC[p]+=1
        
#結局正解できなかった場合はWA=0になる
for j in range(N):
    WA[j] = WA[j]*AC[j]
    
print(sum(AC),sum(WA))

Submission status: Wrong Answer

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


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    pe=0
    ac=[False]*N
    for i in range(M):
        if S[i]=="AC":
            ac[p[i]-1]=True
        if S[i]=="WA" and ac[p[i]-1]==False:
            pe+=1

    a=0
    for i in range(N):
        if ac[i]==True: a+=1

    print(a, pe)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()