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())
ac = [False] * (n+1)
pena = 0

for i in range(m):
    p, s = input().split()
    p = int(p)
    if s == "AC":
        ac[p] = True
    else:
        if not ac[p]:
            pena += 1

print(sum(ac), pena)

Submission status: Wrong Answer

Solution code:
N, M = [int(x) for x in input().split()]
A = []
for _ in range(M): A.append([x for x in input().split()])
AC, WA, tmp = 0, 0, 0
for _ in range(M):
    if A[_][1] == 'WA' and tmp != int(A[_][0]): WA += 1
    elif A[_][1] == 'AC' and tmp != int(A[_][0]): AC, tmp = AC+1, int(A[_][0])
print(AC, WA)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ac = set()
wa_count = 0
tmp = 0
for i in range(M):
  p, S = map(str, input().split())
  if S == "AC":
    ac.add(p)
    tmp = 0
  elif S == "WA" and not p in ac:
    wa_count += 1
    tmp += 1
print(len(ac), wa_count - tmp)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split(" "))
WA = 0
AC = 0
ar = {}
br = []
cr = []
for i in range(m):
    l = input().split(" ")
    if l[0] not in cr:
        if l[0] not in br:
            br.append(l[0])
            ar[l[0]] = []
            w = 0
        if l[1] == "AC":
            ar[l[0]].append(l[1])
            cr.append(l[0])
            AC += 1
            WA += w
        else:
            if "AC" not in ar[l[0]]:
                w += 1
print(AC,WA)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ac = set()
wa_count = 0
for i in range(M):
  p, S = map(str, input().split())
  if S == "AC":
    ac.add(p)
  elif S == "WA" and not p in ac:
    wa_count += 1
print(len(ac), wa_count)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split(" "))
count = 0
w = 0
a = 0
nw = ""
ar = []
for i in range(m):
    l = input().split(" ")
    if l[0] != nw:
        nw = l[0]
        w = 0
    if l[1] == "WA":
        w += 1
    else:
        count += w
        w = 0
        if l[0] not in ar:
            a += 1
            ar.append(l[0])
print(a,count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m = (int(x) for x in input().split())
p = [0]*m
s = [0]*m
penal = [0]*105000
clear = [0]*105000
for i in range(m):
    p[i],s[i] = (x for x in input().split())
    p[i] = int(p[i])
    if s[i] == 'AC':
        clear[p[i]-1] = 1
    elif clear[p[i]-1] == 0:
        penal[p[i]-1] += 1
print(str(sum(clear)) + " " + str(sum(penal)))

Submission status: Wrong Answer

Solution code:
n,m = (int(x) for x in input().split())
p = [0]*m
s = [0]*m
penal = [0]*n
clear = [0]*n
for i in range(m):
    p[i],s[i] = (x for x in input().split())
    p[i] = int(p[i])
    if s[i] == 'AC':
        clear[p[i]-1]=1
    elif clear[p[i]-1] == 0:
        penal[p[i]-1] += 1
print(str(sum(clear)) + " " + str(sum(penal)))

Submission status: Wrong Answer

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

prob = {i: 0 for i in range(1, n+1)}
ac, wa = 0, 0

for i in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'WA':
        prob[p] += 1
    elif prob[p] >= 0:
        ac += 1
        wa += prob[p]
        prob[p] = -1

print(ac, wa)

Submission status: Wrong Answer

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

Qa,Qw = {}, {}
for _ in range(M):
    p, S = input().split()
    p = int(p)-1

    if p not in Qa:
        Qa[p] = 0

    if p not in Qw:
        Qw[p] = 0

    if S == 'AC':
        Qa[p] = 1
    elif S == 'WA':
        if Qa[p] <= 0:
            Qw[p] += 1

AC = sum([ac for ac in Qa.values()])
WA = sum([Qw[p] for q in Qa.keys()])
print( AC, WA)

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
if b == 0:
    print(0,0)
    exit()
L1,L2=[],[]
for i in range(b):
    c,d = map(str,input().split())
    L1.append(c)
    L2.append(d)

no = L1[0]
wac = 0
pre_wac = 0
acc = 0
flag = False
for i in range(b):
    if L1[i] == no:
        if L2[i] == "WA" and flag == False:
            pre_wac +=1
        elif L2[i] == "AC" and flag == False:
            acc +=1
            wac += pre_wac
            pre_wac = 0
            flag = True
    if L1[i] != no:
        no = L1[i]
        flag = False
        if L2[i] == "WA" and flag == False:
            pre_wac +=1
        elif L2[i] == "AC" and flag == False:
            acc +=1
            wac += pre_wac
            pre_wac = 0
            flag = True

print(acc,wac)

Submission status: Wrong Answer

Solution code:
N,M = list(map(int,input().split()))
Q = [0 for _ in range(N)]
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if S == 'AC':
        Q[p-1] *= -1
    elif S == 'WA':
        if Q[p-1] <= 0:
            Q[p-1] -= 1

AC = len([q for q in Q if q > 0])
WA = sum([q for q in Q if q > 0])

print(AC,WA)

Submission status: Wrong Answer

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

Q = [0 for _ in range(N)]

WA = 0
for i in range(M):
    p, S = input().split()
    p = int(p)
    if S == 'AC':
        Q[p-1] = 1
    elif S == 'WA':
        if Q[p-1] == 0:
            WA += 1

AC = len([q for q in Q if q == 1])

print(AC,WA)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
passed = 0
failed = 0
dicto = {}

for i in range(0, n+1):
    dicto[i] = [False, 0]

for i in range(m):
    key, status = input().split()
    key = int(key)
    if status == 'WA':
        dicto[key][1] += 1
    else:
        dicto[key][0] = True
        break

for i in dicto:
    if dicto[i][0]:
        failed += dicto[i][1]
        passed += 1

print(passed, failed)

Submission status: Wrong Answer

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

correction = 0
penalty = 0

for _ in range(M):
    p, s = input().split()
    p = int(p)
    s = s == "AC"

    if p in R:
        if R[p]:
            continue
        else:
            R[p] = s
            if s:
                correction += 1
            else:
                penalty += 1
    else:
        R[p] = s
        if s:
            correction += 1
        else:
            penalty += 1

print(correction, penalty)

Submission status: Wrong Answer

Solution code:
N, M=map(int,input().split())
if M==0:
	print("0 0")
else:
	ac=0
	pe=0
	ch=[]
	for i in range(M):
		a, b=input().split()
		a=int(a)
		if a in ch:
			continue
		elif b=="AC":
			ch.append(a)
			ac+=1
		else:
			pe+=1
	print(ac,pe)

Submission status: Wrong Answer

Solution code:
N, M=map(int,input().split())
if M==0:
	print("0 0")
else:
	ac=0
	pe=0
	ch=[]
	for i in range(M):
		a=list(map(str,input().split()))
		if a[0] in ch:
			continue
		elif a[1]=="AC":
			ch.append(a[0])
			ac+=1
		else:
			pe+=1
	print(ac,pe)

Submission status: Wrong Answer

Solution code:
N, M=map(int,input().split())
if M==0:
	print("0 0")
else:
	ac=0
	pe=0
	ch=[]
	for i in range(M):
		a=list(map(str,input().split()))
		if a[0] in ch:
			pass
		elif a[1]=="AC":
			ch.append(a[0])
			ac+=1
		else:
			pe+=1
	print(ac,pe)

Submission status: Wrong Answer

Solution code:
import numpy as np
import math
import sys
 
lines = sys.stdin.readlines()
N, M = list(map(int, lines[0].split()))
 

if M == 0:
  print("0 0")
else:
  lines = lines[1:]
  d = []
  [ d.extend(list(map(int, l.replace("\n", "").replace("AC", "1").replace("WA", "0").split()))) for l in lines ]
  d = np.array(d).reshape((-1,2)).astype(int)
  QID = np.unique(d[:, 0])
  OK = 0
  NG = 0
  for qid in QID:
    dd = d[d[:, 0]==qid]
    if not (1 in set(dd[:, 1])):
      continue
    else:
      pass
#      ACt = np.where(dd[:, 1]==1)[0]
#    if len(ACt)>0:
#      OK += 1
#      NG += ACt[0]
#  print(OK, NG)

Submission status: Wrong Answer

Solution code:
import numpy as np
import math
import sys
 
lines = sys.stdin.readlines()
N, M = list(map(int, lines[0].split()))
 

if M == 0:
  print("0 0")
else:
  lines = lines[1:]
  d = []
  [ d.extend(list(map(int, l.replace("\n", "").replace("AC", "1").replace("WA", "0").split()))) for l in lines ]
  d = np.array(d).reshape((-1,2)).astype(int)
  QID = np.unique(d[:, 0])
  OK = 0
  NG = 0
  for qid in QID:
    dd = d[np.where(d[:, 0]==qid)]
    if not (1 in set(dd[:, 1])):
      continue
    else:
      pass
#      ACt = np.where(dd[:, 1]==1)[0]
#    if len(ACt)>0:
#      OK += 1
#      NG += ACt[0]
#  print(OK, NG)

Submission status: Wrong Answer

Solution code:
import numpy as np
import math
import sys
 
lines = sys.stdin.readlines()
N, M = list(map(int, lines[0].split()))
 

if M == 0:
  print("0 0")
else:
  lines = lines[1:]
  d = []
  [ d.extend(list(map(int, l.replace("\n", "").replace("AC", "1").replace("WA", "0").split()))) for l in lines ]
  d = np.array(d).reshape((-1,2)).astype(int)
  QID = np.unique(d[:, 0])
  OK = 0
  NG = 0
#  for qid in QID:
#    dd = d[np.where(d[:, 0]==qid)]
#    if not (1 in set(dd[:, 1])):
#      continue
#    else:
#      ACt = np.where(dd[:, 1]==1)[0]
#    if len(ACt)>0:
#      OK += 1
#      NG += ACt[0]
#  print(OK, NG)

Submission status: Wrong Answer

Solution code:
N, M = (int(x) for x in input().split())
ac_dir = {n:False for n in range(1, N+1)}
ac_count = 0
wa_count = 0
for _ in range(M):
    data = input().split()
    p = int(data[0])
    S = data[1]
    if ac_dir[p]:
        continue
    else:
        if S == "AC":
            ac_dir[p] = True
            ac_count += 1
        elif S == "WA":
            wa_count += 1
print(ac_count, wa_count)

Submission status: Wrong Answer

Solution code:
N, M = (int(x) for x in input().split())
ac_dir = {} # dir(int:boolean)
ac_count = 0
wa_count = 0
for c in range(M):
    data = input().split()
    p = int(data[0])
    S = data[1]
    if p in ac_dir:
        if not ac_dir[p]:
            if S == "AC":
                ac_dir[p] = True
                ac_count += 1
            else:
                wa_count += 1
    else:
        if S == "AC":
            ac_dir[p] = True
            ac_count += 1
        else:
            ac_dir[p] = False
            wa_count += 1
print(ac_count, wa_count)

Submission status: Wrong Answer

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

for i in range(M):
    p,S=map(str,input().split())
    p=int(p)
    L.append([p,S])

# print(L)

Pcount=0
Acount=0

for i in range(N):
    for j in range(M):
        if L[j][0]==i+1:
            if L[j][1]=="WA":
                Pcount+=1
            else:
                Acount+=1
                break

print(Pcount,Acount)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int,input().split()))
a = [False for i in range(N)]
wa = 0
for i in range(M):
  p, s = input().split()
  pi = int(p)-1
  if s=="AC":
      a[pi] = True
  elif not a[pi]:
      wa += 1
print(sum([1 for ai in a if ai]), wa)

Submission status: Wrong Answer

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

Ques = [0]*(N + 1)

correct = 0
incorrect = 0

for i in range(M):
    p,S = input().split()
    p = int(p)
    if Ques[p] == 1:
        continue
    
    if S == "AC":
        correct += 1
        Ques[p] = 1
    else:
        incorrect += 1


print(str(correct) + " " + str(incorrect))

Submission status: Wrong Answer

Solution code:
n, m = [int(x) for x in input().split()]
lst = [0]*(n+1)
a = 0
b = 0
for i in range(m):
  p, s = input().split()
  p = int(p)
  if s == 'AC' and lst[p] != True:
    a += 1
    b += lst[p]
    lst[p] = True
  elif s == 'WA' and lst[p] != True:
    lst[p] += 1
print(a,b)

Submission status: Wrong Answer

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

p = [0]*M
S = [0]*M
Ques = [0]*(N + 1)

correct = 0
incorrect = 0

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

for i in range(M):
    if Ques[p[i]] == 0 and S[i] == "WA":
        incorrect += 1
    elif Ques[p[i]] == 0 and S[i] == "AC":
        correct += 1
        Ques[p[i]] = 1

print(str(correct) + " " + str(incorrect))

Submission status: Wrong Answer

Solution code:
n, m = [int(x) for x in input().split()]
lst = [None]*(n+1)
a = 0
b = 0
for i in range(m):
  p, s = input().split()
  p = int(p)
  if s == 'AC' and lst[p] is None:
    a += 1
    lst[p] = True
  elif s == 'WA' and lst[p] is None:
    b += 1
print(a,b)

Submission status: Wrong Answer

Solution code:
import numpy as np

if __name__=="__main__":
    n, m = map(int, input().split())
    p, s = [], []
    for i in range(m):
        pin, sin = map(str, input().split())
        p.append(int(pin))
        s.append(sin)

    cnt_wa = np.zeros(n)
    p_ac = []
    for i in range(m-1,-1,-1):
        if s[i]=="AC":
            p_ac.append(p[i])
            cnt_wa[p[i]-1] = 0
        else:
            cnt_wa[p[i]-1] += 1

    print(np.unique(p_ac).size, int(np.sum(cnt_wa)))

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
ac = set()
wa = 0
for i in range(m):
  p, s = input().split()
  p = int(p)
  if p in ac:
    continue
  if s == 'WA':
    wa += 1
  else:
    ac.add(p)
print("%d %d" % (len(ac), wa))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
pS = [list(input().split()) for _ in range(M)]
chk = [0]*N
was = [0]*N
for pSi in pS:
    pi, Si = int(pSi[0]), pSi[1]
    if chk[pi-1] == 1:
        continue
    if Si == 'WA':
        was[pi-1] += 1
    else:
        chk[pi-1] = 1

print(sum(chk), sum(was))

Submission status: Wrong Answer

Solution code:
def getinput(_debug):
    N = 0
    M = 0
    p = []
    S = []
    
    if _debug == 0:
        N, M = map(int,input().split())
        lines = [input() for x in range(M)]

    elif _debug == 1:
        f = open("3_sample1.txt").readlines()
        f = [x.rstrip() for x in f]
        N, M = map(int,f[0].split())
        lines = f[1:]
    
    elif _debug == 2:
        f = open("3_sample2.txt").readlines()
        f = [x.rstrip() for x in f]
        N, M = map(int,f[0].split())
        lines = f[1:]
    
    elif _debug == 3:
        f = open("3_sample3.txt").readlines()
        f = [x.rstrip() for x in f]
        N, M = map(int,f[0].split())
        lines = f[1:]
    
    # データ取得
    for l in lines:
        ls = l.split(" ")
        p.append(int(ls[0]))
        S.append(ls[1])

    return N,M,p,S

N,M,p,S = getinput(0)

AC = [0] * N  # 実施した問題数は1,まだの場合0
WA = [0] * N  # ペナルティのカウント

#       
for i in range(M):
    q = int(p[i]) - 1
    if AC[q] == 0 and S[i] == "AC":
        AC[q] = 1
        WA[q] += 1        

print("%d %d"%(sum(AC),sum(WA)))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
from collections import defaultdict as dd
d_ac = dd(lambda:0)
d_wa = dd(lambda:0)
for i in range(m):
  p, sc = input().split()
  if sc == "AC":
    d_ac[p] = 1
  if sc == "WA":
    if d_ac[p] == 0:
      d_wa[p] += 1

total_ac = len(d_ac.keys())
total_wa = 0
for key in d_ac.keys():
  total_wa += d_wa[key]
print(total_ac, total_wa)

Submission status: Wrong Answer

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

solved = [0]* 10**5
penalty = [0]* 10**5
penalty_sum = 0
for _ in range(m):
    q, result = input().split()
    q = int(q) - 1
    
    if result == 'AC':
        if solved[q] == 0:
            solved[q] = 1
            penalty_sum = penalty[q]
    else:
        if solved[q] == 0:
            penalty[q] += 1

print(str(sum(solved)) + " " + str(penalty_sum))

Submission status: Wrong Answer

Solution code:
def getinput(_debug):
    N = 0
    M = 0
    p = []
    S = []
    header = ""

    
    if _debug == 0:
        header = input().split(" ")[0:]
        N, M = int(header[0]), int(header[1])
        lines = [input() for x in range(M)]

    elif _debug == 1:
        f = open("3_sample1.txt").readlines()
        f = [x.rstrip() for x in f]
        header = f[0].split(" ")[0:]
        N, M = int(header[0]), int(header[1])
        lines = f[1:]
    
    elif _debug == 2:
        f = open("3_sample2.txt").readlines()
        f = [x.rstrip() for x in f]
        header = f[0].split(" ")[0:]
        N, M = int(header[0]), int(header[1])
        lines = f[1:]
    
    elif _debug == 3:
        f = open("3_sample3.txt").readlines()
        f = [x.rstrip() for x in f]
        header = f[0].split(" ")[0:]
        N, M = int(header[0]), int(header[1])
        lines = f[1:]
    
    # データ取得
    for l in lines:
        ls = l.split(" ")
        p.append(int(ls[0]))
        S.append(ls[1])

    return N,M,p,S

N,M,p,S = getinput(0)

success = [0] * (N+1)  # 実施した問題数は1,まだの場合0
penalty = [0] * (N+1)  # ペナルティのカウント

#       
for x in range(M):
    q = p[x]
    if success[q] == 0:
        if S[x] == "AC":
            success[q] = 1
        elif S[x] == "WA":
            penalty[q] += 1
        

print("%d %d"%(sum(success),sum(penalty)))

Submission status: Wrong Answer

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

solved = [0]* 10**5
penalty_sum = 0
penalty = 0

for _ in range(m):
    q, result = input().split()
    q = int(q) - 1
    
    if result == 'AC':
        if solved[q] == 0:
            penalty_sum += penalty
            penalty = 0
            solved[q] = 1
    else:
        if solved[q] == 0:
            penalty += 1

print(str(sum(solved)) + " " + str(penalty_sum))

Submission status: Wrong Answer

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

solved = [0]* 10**5
penalty_sum = 0
penalty = 0

for _ in range(m):
    q, result = input().split()
    q = int(q)
    
    if result == 'AC':
        if solved[q] == 0:
            penalty_sum += penalty
            penalty = 0
            solved[q] = 1
    else:
        if solved[q] == 0:
            penalty += 1

print(str(sum(solved)) + " " + str(penalty_sum))

Submission status: Wrong Answer

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

solved = [0]* 10**5
penalty_sum = 0
penalty = 0

for _ in range(m):
    q, result = input().split()
    q = int(q)
    
    if result == 'AC':
        if solved[q] == 0:
            penalty_sum += penalty
            penalty = 0
    else:
        if solved[q] == 0:
            penalty += 1

print(str(sum(solved)) + " " + str(penalty_sum))

Submission status: Wrong Answer

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

ac = []
penalty = 0

for i in range(m):
    q, result = input().split()
    
    if result == 'AC':
        if q not in ac:
            ac.append(q)
    else:
        if q not in ac:
            penalty += 1

print(str(len(ac)) + " " + str(penalty))

Submission status: Wrong Answer

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

ac = []
penalty = 0

for i in range(m):
    q, result = input().split()
    q = int(q)
    
    if result == 'AC':
        if q not in ac:
            ac.append(q)
    else:
        if q not in ac:
            penalty += 1

print(str(len(ac)) + " " + str(penalty))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
check = {'AC' : [],
        'WA' : 0}

for i in range(m):
    q, result = input().split()
    q = int(q)
    if result == 'AC':
        if q not in check['AC']:
            check['AC'].append(q)
    else:
        if q not in check['AC']:
            check['WA'] += 1

print(str(len(check['AC'])) + " " + str(check['WA']))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
dic={}
ans=0
pen=0
for i in range(m):
    p,s=input().split()
    if p not in dic.keys():
        dic[p]={}
    if s=='AC':
        dic[p][s]=1
    if 'AC' not in dic[p].keys():
        if 'WA' not in dic[p].keys():
            dic[p][s]=0
        dic[p][s]+=1

for key in dic.keys():
    if 'AC' in dic[key].keys():
        ans+=1
    if 'WA' in dic[key].keys():
        pen+=dic[key]['WA']

print(str(ans)+' '+str(pen))

Submission status: Wrong Answer

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

b = [0 for i in range(n)]

acnt = 0
wcnt = 0

for i in range(m):
    p, s = map(str, input().split())
    if s == "WA":
        if b[int(p)-1] == 0:
            wcnt += 1
    else:
        if b[int(p)-1] == 0:
            acnt += 1
            b[int(p)-1] = 1
    

print(acnt, end=" ")
print(wcnt)

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())
PS = [line.split() for line in readlines()]

AC = [False] * (N+1)
WA_cnt = [0] * (N+1)

penal = 0
for p,s in PS:
    p = int(p)
    if AC[p]:
        continue
    if s == 'WA':
        WA_cnt[p] += 1
    else:
        AC[p] = True
        penal += WA_cnt[p]

ac = sum(AC)
print(ac, penal)

Submission status: Wrong Answer

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

ans_AC=AC.count(True)
ans_WA=0
for i in range(N):
    if AC[i]:
        ans_WA+=WA[p]
print(ans_AC,ans_WA)

Submission status: Wrong Answer

Solution code:
N,M=[int(i) for i in input().split()]
AC,WA=[False]*N,[0]*N
for i in range(M):
    p,s=input().split()
    p=int(p)-1
    if AC[p]==False:
        if s=="AC":
            AC[p]=True
        if s=="WA":
            WA[p]+=1
ans_WA=0
for i in range(N):
    if AC[i]:
        ans_WA+=WA[p]

ans_AC=AC.count(True)

print(ans_AC,ans_WA)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
Ans = [0] * N
Cnt_Pen = 0
Cnt_Ans = 0

for i in range(M):
    S, T = input().split()
    S = int(S)
    if Ans[S-1] == 0 and T == "AC":
        Ans[S-1] = 1
        Cnt_Ans += 1
    elif Ans[S-1] == 0 and T == "WA":
        Cnt_Pen += 1
    else:
        continue

print(Cnt_Ans, Cnt_Pen)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
Ans = [0] * N
Cnt = 0

for i in range(M):
    S, T = input().split()
    S = int(S)
    if Ans[S-1] == 0 and T == "AC":
        Ans[S-1] = 1
    elif Ans[S-1] == 0 and T == "WA":
        Cnt += 1
    else:
        continue

print(sum(Ans), Cnt)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
Ans = [0] * N
Pen = [0] * N
Cnt = 0
for i in range(M):
    S, T = input().split()
    S = int(S)
    if Ans[S-1] == 0 and T == "AC":
        Ans[S-1] = 1
    elif Ans[S-1] == 0 and T == "WA":
        Cnt += 1

print(sum(Ans), Cnt)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
Ans = [0] * N
Pen = [0] * N
Cnt = 0
for i in range(M):
    S, T = input().split()
    S = int(S)
    if Ans[S-1] == 0 and T == "AC":
        Ans[S-1] = 1
    elif Ans[S-1] == 0 and T == "WA":
        Pen[S-1] += 1
        Cnt += 1

print(sum(Ans), Cnt)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
li = list()
for i in range(m):
  li.append(input().split())
print(li)
ac_cnt=0
wa_cnt=0

s_ac=set()
d_wa=dict()
for l in li:
  if l[1] == 'WA':
    d_wa[l[0]] = d_wa.get(l[0],0) + 1
  elif l[1] == 'AC':
    if l[0] not in s_ac:
      s_ac.add(l[0])
      ac_cnt +=1
      wa_cnt +=d_wa.get(l[0],0)
    else:
      pass

print(ac_cnt,wa_cnt)

Submission status: Wrong Answer

Solution code:
def strr():
 a=raw_input()
 return a
def sstrr():
 a=raw_input().split()
 return a
def intt():
 a=int(raw_input())
 return a
def iintt():
 a=[int(s) for s in raw_input().split()]
 return a
def nestt(t):
 a=[raw_input().split() for s in range(t)] 
 return a

n,m=iintt()
ps=nestt(m)
a_={}
aa=0
ab=0
for p,s in ps:
 int(p)
 if p in a_:
  if a_[p]=="WA":
   ab+=1
   a_[p]=s
 else:
  a_[p]=s
for o in a_.keys():
 if a_[o]=="AC":
  aa+=1
print(str(aa)+" "+str(ab))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
WAlist = [[0,"WA"]  for i in range(N)]
AC= 0
for i in range(M):
    p,S = input().split()
    p = int(p)
    if S=="WA"and WAlist[p-1][1]=="WA":
        WAlist[p-1][0] += 1
    elif S=="WA" and WAlist[p-1][1]=="AC" or S=="AC"and WAlist[p-1][1]=="AC":
        continue
    elif S=="AC" and WAlist[p-1][1]=="WA":
        WAlist[p-1][1] = "AC"
        AC += 1
WA = sum(list(map(lambda x: x[0],WAlist)))
print(AC,WA)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
answer = [False for _ in range(n)]
penalty = [0 for _ in range(n)]
for i in range(m):
    number, result = input().split()
    number = int(number)
    if result == 'AC':
        answer[number-1] = True
    elif answer[number-1] != True:
        penalty[number-1] += 1

print(answer.count(True), sum(penalty))

Submission status: Wrong Answer

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

for i in range(m):
    if fa[p[i]-1] == 0:
        if s[i] == 'AC':
            fa[p[i]-1] = 1
        else:
            fw[p[i]-1] += 1
        
print(sum(fa), sum(fw))

Submission status: Wrong Answer

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

correct = 0
penalty = 0
answered = set()

for _ in range(M):
  p, s = input().split()
  pn = int(p)
  if s == 'AC':
    if pn not in answered:
      correct += 1
      answered.add(pn)
  elif s == 'WA':
    if pn not in answered:
      penalty += 1

print(correct, penalty)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
action = [list(input().split()) for _ in range(m)]
answer_dict = {}
score = 0
penalty = 0

for a in action:
    if a[1] == 'WA' and a[0] not in answer_dict:
        penalty += 1
    elif a[1] == 'AC' and a[0] not in  answer_dict:
        score += 1
        answer_dict[a[0]] = True


print(score,penalty)

Submission status: Wrong Answer

Solution code:
n,m =map(int, input().split())
a =[list(input().split()) for i in range(m)]
ends = [0]*n
was = [0]*n
for num, kekka in a:
    num=int(num)-1
    if kekka=='AC':
        ends[num]=1
    else:
        if ends[num]!=1:
            was[num]+=1
print(sum(ends), sum(was))

Submission status: Wrong Answer

Solution code:
# ABC151 C
n, m = list(map(int, input().split()))
ac = set()
wa = {}
for _ in range(1, m):
    res = input().split()
    if res[1] == "AC":
        ac.add(res[0])

    elif res[0] not in ac:
        if res[0] in wa:
            wa[res[0]] += 1
        else:
            wa[res[0]] = 1

wa_cnt = 0
for v in ac:
    if v in wa:
        wa_cnt += wa[v]

print(len(ac), wa_cnt)

Submission status: Wrong Answer

Solution code:
# ABC151 C
n, m = list(map(int, input().split()))
ac = set()
wa = {}
for _ in range(1, m):
    res = input().split()
    if res[1] == "AC":
        ac.add(res[0])
    else:
        if res[0] not in ac:
            if res[0] in wa:
                wa[res[0]] += 1
            else:
                wa[res[0]] = 1

wa_cnt = 0
for v in ac:
    if v in wa:
        wa_cnt += wa[v]

print(len(ac), wa_cnt)

Submission status: Wrong Answer

Solution code:
# ABC151 C
n, m = list(map(int, input().split()))
ac = set()
wa = {}
for _ in range(1, m):
    res = input().split()
    if res[1] == "AC":
        ac.add(res[0])
    else:
        if res[0] in wa:
            wa[res[0]] += 1
        else:
            wa[res[0]] = 1

wa_cnt = 0
for v in ac:
    if v in wa:
        wa_cnt += wa[v]

print(len(ac), wa_cnt)

Submission status: Wrong Answer

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

    input_list = []
    for i in range(m):
        input_list.append(input().split(' '))

    ac_set = set([])
    num_list = []
    result_list = []
    counter = 0
    for num, result in reversed(input_list):
        if result == 'AC':
            ac_set.add(num)
        elif (result == 'WA') and (num in ac_set):
            counter = counter + 1

    print(len(ac_set), counter)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    n, m = list(map(int, input().split(' ')))
    ac_set = set([])
    counter = 0
    for i in range(m):
        num, result = input().split(' ')
        if result == 'AC':
            ac_set.add(num)
        elif (result == 'WA') and ((num in ac_set) is False):
            counter = counter + 1

    print(len(ac_set), counter)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    n, m = list(map(int, input().split(' ')))
    hist = {}
    ac_list = []
    pena_conut = 0
    for i in range(m):
        num, result = input().split(' ')
        if result == 'AC':
            ac_list.append(num)
        elif (result == 'WA') and ((num in ac_list) is False):
            pena_conut = pena_conut + 1

    print(len(list(set(ac_list))), pena_conut)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
li_q = list()
for i in range(m):
    li_q.append(tuple(input().split()))

ac_count = 0
wa_count = 0

s_ac = set()
for l in li_q:
    if l[1] == 'AC':
        if l[0] not in s_ac:
            s_ac.add(l[0])
            ac_count += 1
        else:
            pass
    elif l[1] == 'WA':
        if l[0] not in s_ac:
            wa_count += 1
        else:
            pass

print(ac_count, wa_count)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
li_q = list()
for i in range(m):
    li_q.append(tuple(input().split()))

ac_count = 0
wa_count = 0

li_ac = set()
for l in li_q:
    if l[1] == 'AC':
        if l[0] not in li_ac:
            li_ac.add(l[0])
            ac_count += 1
        else:
            pass
    elif l[1] == 'WA':
        if l[0] not in li_ac:
            wa_count += 1
        else:
            pass

print(ac_count, wa_count)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
iNum, iM = list(map(int, input().split()))
naB = np.zeros(iNum, dtype = "bool")
iC = 0
iW = 0
for _ in range(iM):
  l = input().split()
  iP = int(l[0]) - 1
  if not(naB[iP]):
    if l[1] == "AC":
      naB[iP] = True
      iC += 1
    else:
      iW += 1
print(iC, iW)