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: Runtime Error

Solution code:
#151c
n,w=map(int,input().split())
ac=0
wa=0
wa_cnt=0
ac_flg=[0]*n
for i in range(w):
	p,s=input().split()
	p=int(p)-1
	if ac_flg[p]==1:
		continue
	else:
		if s=='AC':
			ac_flg[p]=1
			ac+=1
			wa[p] =wa_cnt
			wa_cnt=0
		else:
			wa_cnt+=1

wa_ans=0
for i in (n):
	wa_ans+=wa[i]
print(ac,wa)

Submission status: Runtime Error

Solution code:
#151c
n,w=map(int,input().split())
ac=0
wa=0
wa_cnt=0
ac_flg=[0]*n
for i in range(w):
	p,s=input().split()
	p=int(p)-1
	if ac_flg[p]==1:
		continue
	else:
		if s=='AC':
			ac_flg[p]=1
			ac+=1
			wa[p]+=wa_cnt
			wa_cnt=0
		else:
			wa_cnt+=1

wa_ans=0
for i in (n):
	wa_ans+=wa[i]
print(ac,wa)

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
wa=0
ac=0
already=[]
for i in range(M):
    P,S=map(input().split())
    if S=="WA" and already.count(P)==0:
        wa=wa+1
    if S=="AC" and already.count(P)==0:
        ac=ac+1
        already.append(P)
    else:
        pass
print(wa,ac)

Submission status: Runtime Error

Solution code:
#151c
n,w=map(int,input().split())
ac=0
wa=0
wa_cnt=0
ac_flg=[0]*w
for i in range(w):
	p,s=input().split()
	p=int(p)-1
	if ac_flg[p]==1:
		continue
	else:
		if s=='AC':
			ac_flg[p]=1
			ac+=1
			wa+=wa_cnt
		else:
			wa_cnt+=1
print(ac,wa)

Submission status: Runtime Error

Solution code:
# ABC 151C
n, m = map(int, input().split())
ps = list(input().split() for _ in range(m))
ac = 0
wa = 0
a = int(ps[0][0])
if m == 0:
    print(0, 0)
    exit()
for i in range(1, m):
    while int(ps[i][0]) <= int(ps[m-1][0]):
        if int(ps[i][0]) == a and ps[i][1] == 'WA':
            wa += 1
        elif int(ps[i][0]) == a and ps[i][1] == 'AC':
            ac += 1
            a += 1
        else:
            continue
print(ac, wa)

Submission status: Runtime Error

Solution code:
#151c
n,w=map(int,input().split())
ac=0
wa=0
wa_cnt=0
ac_flg=[0]*n
for i in range(w):
	p=int(input())-1
	s=input()
	if ac_flg[p]==1:
		continue
	else:
		if s=='AC':
			ac_flg[p]=1
			ac+=1
			wa+=wa_cnt
		else:
			wa_cnt+=1
print(ac,wa)

Submission status: Runtime Error

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

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

for i in range(m):
    if l[i][1] == 'WA':
        if ac[l[i][0]] == 0:
            wa[l[i][0]] += 1
    elif l[i][1] == 'AC':
        if ac[l[i][0]] == 0:
            ac[l[i][0]] += 1
            
print(sum(ac), sum(wa))

Submission status: Runtime Error

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


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    d = dict([(i, []) for i in set(p)])
    for _p, _s in zip(p, S):
        d[_p].append(_s)
    # print(d)
    A = 0
    W = 0
    for v in d.values():
        _a = v.index('AC')
        # print(_a)
        A += 1
        W += _a
    print(A, W)


# 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()

Submission status: Runtime Error

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

tempP = ""
ac = []
wa = []

for count in range(N):
    ac.append(0)
    wa.append(0)

for count in range(M):
    P,S = input().split()
    P = int(P)
    P -= 1
    
    if ac[P] == 0:
        if S == "AC":
            ac[P] = 1
        else:
            wa[P] +=1



a = 0
b = 0
 
for i in range(n):
    if ac[i] == 1:
        a += 1
        b += wa[i]
 
print(*[a, b])

Submission status: Runtime Error

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

tempP = ""
ac = []
wa = []

for count in range(M):
    ac.append(0)
    wa.append(0)

for count in range(M):
    P,S = input().split()
    P = int(P)
    P -= 1
    
    if ac[P] == 0:
        if S == "AC":
            ac[P] = 1
        else:
            wa[P] +=1


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

Submission status: Runtime Error

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

ac_cnt=[False]*n
wa_cnt=[0]*n

for _ in range(m):
    a,b=input().split()
    a=int(a)-1
    if b == "AC":
        ac_cnt[a] = True
    else:
        if ac_cnt[a] == False:
            wa_cnt[a] += 1
c=0
d=0

for i in range(n):
    if ac_cnt[a]:
        c += 1
        d += wa_cnt[i]

print(c,d)

Submission status: Runtime Error

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

ac_cnt=[False]*n
wa_cnt=[0]*n

for _ in range(m):
    a,b=input().split()
    a=int(a)-1
    if b == "AC":
        ac_cnt[a] = True
    else:
        if ac_cnt[a] == False:
            wa_cnt[a] += 1

print(ac_cnt)
c=0
d=0

for i in range(n):
    if ac_cnt[a]:
        c += 1
        d += wa_cnt[i]

print(c,d)

Submission status: Runtime Error

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

ac_cnt=[False]*n
wa_cnt=[0]*n

p=int(p-1)

for _ in range(m):
    a,b=input().split()
    if b == "AC":
        ac_cnt[a] == True
    else:
        if ac_cnt[a] == False:
            wa_cnt[a] += 1
a=0
b=0

for i in range(n):
    if ac_cnt[a]:
        a += 1
        b += wa_cnt[i]

print(a,b)

Submission status: Runtime Error

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

ac_cnt=0
wa_cnt=0
flag=0
no=-1

for i in range(m):
    a,b=input().split()
    if flag == 1 and no!= a:
        flag=0
    else:
        if flag == 0 and b == "WA":
            wa_cnt += 1
        elif flag == 0 and b == "AC":
            ac_cnt += 1
            flag += 1
            no=a
    else:
        continue

print(ac_cnt,wa_cnt)

Submission status: Runtime Error

Solution code:
import sys
N, M, *PS = sys.stdin.read().strip().split()
N = int(N)
ac = [0] * N
wa = [0] * N
for p, s in zip(*[iter(PS)] * 2):
  p = int(p) - 1
  if s == "AC":
    ac[p] = 1
  elif ac[p] == 0:
    wa[p] += 1
penalties = sum(w * a else 0 for a, w in zip(ac, wa))
print(sum(ac), penalties)

Submission status: Runtime Error

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

N=[]

for i in range(n):
    N.append([0,0])

co=0
pe=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if s=='WA':
        N[p-1][0]+=1
    elif N[p-1][1]!=1:
        pe+=N[p][0]
        co+=1
        N[p-1][1]=1

print(str(co)+' '+str(pe))

Submission status: Runtime Error

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

N=[[0,0]*n]
co=0
pe=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if s=='WA':
        N[p-1][0]+=1
    elif N[p-1][1]!=1:
        pe+=N[p-1][0]
        co+=1
        N[p-1][1]=1

print(str(co)+' '+str(pe))

Submission status: Runtime Error

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

s = {i + 1 for i in range(n)}

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


for i in range(m):
  if int(p[i][0]) in s:
    if p[i][1] == 'WA':
      wa[int(p[i][0])][0] += 1
    else:
      ac += 1
      s.discard(int(p[i][0]))
      wa[int(p[i][0])][1] = True
      
wa_wa = 0
for i in range(1, n + 1):
  if wa[i][1]:
    wa_wa += wa[i][0]
print(ac, wa_wa)
n, m = list(map(int, input().split()))
p = [input().split() for i in range(m)]

s = {i + 1 for i in range(n)}

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


for i in range(m):
  if int(p[i][0]) in s:
    if p[i][1] == 'WA':
      wa[int(p[i][0])][0] += 1
    else:
      ac += 1
      s.discard(int(p[i][0]))
      wa[int(p[i][0])][1] = True
      
wa_wa = 0
for i in range(1, n + 1):
  if wa[i][1]:
    wa_wa += wa[i][0]
print(ac, wa_wa)

Submission status: Runtime Error

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


a = 0
b = 0
c = 0
mon = []
for i in range(kiso[1]):
	res = input().split()

	if  res[0] in mon:
                c = 0
		continue

	if res[1] == "AC":
		a += 1
                b += c
		mon.append(res[0])

	else:
		c += 1


print(str(a)+" "+str(b))

Submission status: Runtime Error

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


a = 0
b = 0

mon = "0"
for i in range(kiso[1]):
	res = input().split()
	if mon == res[0]:
		continue

	if res[1] == "AC":
		a += 1
		mon = res[0]

	else:
		b += 1


print(str(a)+" "+str(b))

Submission status: Runtime Error

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


a = 0
b = 0

mon = "0"
for i in range(kiso[1]):
	res = input().split()
	if mon == res[0]:
		continue

	if res[1] == "AC":
		a += 1
		mon = rs[0]

	else:
		b += 1


print(str(a)+" "+str(b))

Submission status: Runtime Error

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

AC = {}
WA = {}

if M == 0:
    print("0 0")
    exit()
for i in range(M):
    prob,sub = input().split()
    if sub == "WA":
        if (prob in AC) == False:
            if (prob in WA) == False:
                WA[prob] = 1
            else:
                WA[prob] += 1
    
    if sub == "AC":
         if (prob in AC) == False:
            AC[prob] = 1
         else:
            AC[prob] += 1
            
ans_WA = 0
for prob,sub in WA.items:
    if (prob in AC) == True:
        ans_WA += int(sub)
            
print(len(AC.values()),ans_WA)

Submission status: Runtime Error

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

AC = {}
WA = {}

if M == 0:
    print("0 0")
    exit()
for i in range(M):
    prob,sub = input().split()
    if sub == "WA":
        if (prob in AC) == False:
            if (prob in WA) == False:
                WA[prob] = 1
            else:
                WA[prob] += 1
    
    if sub == "AC":
         if (prob in AC) == False:
            AC[prob] = 1
         else:
            AC[prob] += 1
            
ans_WA = 0
for prob,sub in WA.items:
    if (prob in AC) = True:
        ans_WA += int(sub)
            
print(len(AC.values()),ans_WA)

Submission status: Runtime Error

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

AC = {}
WA = {}

if M == 0:
    print("0 0")
    exit()
for i in range(M):
    prob,sub = input().split()
    if sub == "WA":
        if (prob in AC) == False:
            if (prob in WA) == False:
                WA[prob] = 1
            else:
                WA[prob] += 1
    
    if sub == "AC":
         if (prob in AC) == False:
            AC[prob] = 1
         else:
            AC[prob] += 1
            
ans_WA = 0
for prob,sub in WA.items:
    if (prob in AC) = True:
        ans_WA += sub
            
print(len(AC.values()),ans_WA)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
l = [False] * n
c = [0, 0]
for i in range(k):
  p, r = map(input().split())
  if l[int(p) - 1] == False:
    if r == "WA":
      c[0] += 1
    elif r == "AC":
      l[int(p) - 1] = True
      c[1] += 1
print(c[1], c[0])

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
l = [False] * n
ans = [0, 0]
for i in range(k):
  p, r = map(input().split())
  if l[int(p) - 1] == False:
    if r == "WA":
      c[0] += 1
    elif r == "AC":
      l[int(p) - 1] = True
      c[1] += 1
print(c[1], c[0])

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
l = [False] * n
ans = [0, 0]
for i in range(n):
  p, r = map(input().split())
  if l[int(p) - 1] == False:
    if r == "WA":
      c[0] += 1
    elif r == "AC":
      l[int(p) - 1] = True
      c[1] += 1
print(c[1], c[0])

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
l = [False] * n
ans = [0, 0]
for i in range(n):
  p, r = map(input().split())
  if l[int(p) - 1] == False:
    if r == "WA":
      c[0] += 1
    elif r == "AC":
      l[int(p) - 1] == True
      c[1] += 1
print(c[1], c[0])

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
pS = [[0,0] for i in range(M)]
for i in range(M):
  pS[i]= list(map(str,input().split()))
p = [0]*M
S = [0]*M
for i in range(M):
  p[i] = pS[i][0]
  S[i] = pS[i][1]
NM = N*M
AC = [0]*NM
WA = [0]*NM
i = 0
while i < M:
  if S[i] == 'WA':
    if AC[int(p[i])] != 1:
      WA[int(p[i])] = WA[int(p[i])]+1
    i = i+1
  elif S[i] == 'AC':
    AC[int(p[i])]=1
    i = i+1
  else:
    i = i+1
print(sum(AC),sum(WA))

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
pS = [[0,0] for i in range(M)]
for i in range(M):
  pS[i]= list(map(str,input().split()))
p = [0]*M
S = [0]*M
for i in range(M):
  p[i] = pS[i][0]
  S[i] = pS[i][1]
NM = N*M
AC = [0]*NM
WA = [0]*NM
i = 0
while i < M:
  if S[i] == 'WA':
    if AC[int(p[i])] == 0:
      WA[int(p[i])] = WA[int(p[i])]+1
    i = i+1
  elif S[i] == 'AC':
    AC[int(p[i])]=1
    i = i+1
  else:
    i = i+1
print(sum(AC),sum(WA))

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
pS = [[0,0] for i in range(M)]
for i in range(M):
  pS[i]= list(map(str,input().split()))
p = [0]*M
S = [0]*M
for i in range(M):
  p[i] = pS[i][0]
  S[i] = pS[i][1]
NM = N*M
AC = [0]*NM
WA = [0]*NM
i = 0
while i < M:
  if S[i] != 'AC':
    if AC[int(p[i])] == 0:
      WA[int(p[i])] = WA[int(p[i])]+1
    i = i+1
  elif S[i] == 'AC':
    AC[int(p[i])]=1
    i = i+1
  else:
    i = i+1
print(sum(AC),sum(WA))

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
pS = [[0,0] for i in range(M)]
for i in range(M):
  pS[i]= list(map(str,input().split()))
p = [0]*M
S = [0]*M
for i in range(M):
  p[i] = pS[i][0]
  S[i] = pS[i][1]
AC = [0]*N
WA = [0]*N
i = 0
while i < M:
  if S[i] != 'AC':
    if AC[int(p[i])] == 0:
      WA[int(p[i])] = WA[int(p[i])]+1
    i = i+1
  elif S[i] == 'AC':
    AC[int(p[i])]=1
    i = i+1
  else:
    i = i+1
print(sum(AC),sum(WA))

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
p = [0]*M
S = [0]*M
pS = [[0,0] for i in range(M)]
for i in range(M):
  pS[i]= list(map(str,input().split()))
pS.sort()
for i in range(M):
  p[i] = pS[i,0]
  S[i] = PS[i,1]
AC = 0
WA = 0
p1 = '0'
i = 0
while i < M:
  if p[i] != p1 and S[i] != 'AC':
    WA = WA+1
    i = i+1
  elif p[i] != p1 and S[i] == 'AC':
    p1 = p[i]
    AC = AC+1
    i = i+1
  else:
    i = i+1
print(AC,WA)

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
c = [input().split() for i in range(m)]
for i in range(m):
    c[i][0] = int(c[i][0])
AC, WA = 0, 0
aclist = [0 for i in range(n)]
for i in range(m):
    if aclist[c[i][0]] == 0:
        if c[i][1] == 'AC':
            aclist[c[i][0]] += 1
            AC += 1
        else:
            WA += 1
print(AC, WA)

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
c = [input().split() for i in range(m)]
for i in range(m):
    c[i][0] = int(c[i][0])
AC, WA = 0, 0
aclist = [0 for i in range(n)]
for i in range(n):
    if aclist[c[i][0]] == 0:
        if c[i][1] == 'AC':
            aclist[c[i][0]] += 1
            AC += 1
        else:
            WA += 1
print(AC, WA)

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
c = [input().split() for i in range(m)]
for i in range(m):
    c[i][0] = int(c[i][0])
AC, WA, i =0, 0, 0
for i in range(n):
    for j in range(m):
        if c[j][0] == i + 1:
            if c[j][1] == 'WA':
                WA += 1
                if j == m:
                    break
            elif c[j][i] == 'AC':
                AC += 1
                break 
print(AC, WA)

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
c = [list(map(int, input().split())) for i in range(n)]
AC, WA, i =0, 0, 0
while i < n:
    if c[i][0] == i + 1:
        if c[i][1] == 'WA':
            WA += 1
        else:
            AC += 1
            i += 1
print(AC, WA)

Submission status: Runtime Error

Solution code:

N, M=map(int(input().split())
AC=[0]*(a+1)
WA=[0]*(a+1)
ac=0
wa=0
t=0
for i in range(M):
    x,y=map(str(input().split())
    if y=="WA":
        WA[int(x)]+=1   
    elif x=="AC" and AC[int(x)]==0:
        wa+=WA[int(x)]
        ac+=1     
        AC[int(x)]=1
print(ac, wa)

Submission status: Runtime Error

Solution code:
N, M=map(int(input().split())
AC=[0]*(a+1)
WA=[0]*(a+1)
ac=0
wa=0
t=0
for i in range(M):
    x,y=map(str(input().split())
    if y=="WA":
        WA[int(x)]+=1   
    elif x=="AC" and AC[int(x)]==0:
        wa+=WA[int(x)]
        ac+=1     
        AC[int(x)]=1
print(ac, wa)

Submission status: Runtime Error

Solution code:

N, M=list(map(int(input().split()))
AC=[0]*(a+1)
WA=[0]*(a+1)
ac=0
wa=0
t=0
for i in range(M):
    x,y=map(str(input().split())
    if y=="WA":
        WA[int(x)]+=1   
    elif x=="AC" and AC[int(x)]==0:
        wa+=WA[int(x)]
        ac+=1     
        AC[int(x)]=1
print(ac, wa)

Submission status: Runtime Error

Solution code:
import numpy as np
N, M=list(map(int(input().split()))
AC=[0]*(a+1)
WA=[0]*(a+1)
ac=0
wa=0
t=0
for i in range(M):
    x,y=map(str(input().split())
    if y=="WA":
        WA[int(x)]+=1   
    elif x=="AC" and AC[int(x)]==0:
        wa+=WA[int(x)]
        ac+=1     
        AC[int(x)]=1
print(ac, wa)

Submission status: Runtime Error

Solution code:
import numpy as np
N, M=list(map(int(input().split()))
AC=[0]*(a+1)
WA=[0]*(a+1)
ac=0
wa=0
t=0
for i in range(M):
    x,y=list(map(str(input().split()))
    if y=="WA":
        WA[int(x)]+=1   
    elif x=="AC" and AC[int(x)]==0:
        wa+=WA[int(x)]
        ac+=1     
        AC[int(x)]=1
print(ac, wa)

Submission status: Runtime Error

Solution code:
import numpy as np
N, M=list(map(int(input().split()))
AC=[0]*(a+1)
WA=[0]*(a+1)
ac=0
wa=0
t=0
for i in range(M):
    x,y=list(map(str(input().split()))
    if y=="WA":
        WA[x]+=1   
    elif x=="AC" and AC[x]==0:
        wa+=WA[x]
        ac+=1     
        AC[x]=1
print(ac, wa)

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
d = {}
for i in range(m):
    p, s = input().split()
    d.setdefault(p, [])
    d[p].append(s)

correct = 0
cnt = 0
for v in d.values():
    tmp = len(v[:v.index("AC")])
    if tmp > 0: correct += 1
    cnt += len(v[:v.index("AC")])

print(correct, cnt)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
inp = input().split()
n,m = map(int, inp)
ind_l = []
re_l =[]
ac = 0
wa = 0
a_kind = []
for i in range(m):
    ind,re = input().split()
    ind_l = int(ind)-1
    re_l = re
for i in range(m):
    if i == 0:
        if re_l[i] == "AC":
            ac += 1
            a_kind.append(ind_l[i])
        else:
            wa += 1
    else:
        if re_l[i] == "AC":
            if ind_l[i] in a_kind:
                continue
            else:
                ac += 1
                a_kind.append(ind_l[i])
        if re_l[i] == "WA":
            if ind_l[i] in a_kind:
                continue
            else:
                wa += 1
print(ac,wa)

Submission status: Runtime Error

Solution code:
inp = input().split()
n,m = map(int, inp)
ind_l = []
re_l =[]
ac = 0
wa = 0
a_kind = []
for i in range(m):
    ind,re = input().split()
    ind_l = int(ind)
    re_l = re
for i in range(m):
    if i == 0:
        if re_l[i] == "AC":
            ac += 1
            a_kind.append(ind_l[i])
        else:
            wa += 1
    else:
        if re_l[i] == "AC":
            if ind_l[i] in a_kind:
                continue
            else:
                ac += 1
                a_kind.append(ind_l[i])
        if re_l[i] == "WA":
            if ind_l[i] in a_kind:
                continue
            else:
                wa += 1
print(ac,wa)

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
d={} #正解の辞書
e={} #誤答の辞書
for _ in range(M):
    p,s=input().split()
    d.setdefault(p,0)
    e.setdefault(p,0)
    if s=="WA" and d[p]!=1:
        e[s]+=1
    elif s=="AC":
        d[p]=1

print(sum(d.values()),sum(e.values()))

Submission status: Runtime Error

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

p = [0] * m
s = [0] * m
ac = [0] * n
wa = [0] * n

for i in range(m):
    p[i], s[i] = input().split()
 
for i in range(m):
    if ac[p[i] - 1] == 0:
        if s[i] == 'AC':
            ac[p[i] - 1] = 1
        else:
            wa[p[i] - 1] += 1

for i in range(n):
    if ac[i] == 0:
        wa[i] = 0

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

Submission status: Runtime Error

Solution code:
from collections import Counter

n,m = map(lambda x: int(x), input().split())
x = [0 for i in range(10005)]
tot=0
ac=0
for i in range(m):
	p, s = input().split()
	p=int(p)
	if x[p] == -1:
		continue
	if s == 'AC':
		ac +=1
		tot+=x[p]
		x[p]=-1
	elif s == 'WA':
		x[p] += 1
print(ac, tot)

Submission status: Runtime Error

Solution code:
import math
n, m = map(int, input().split())
false_count = [1]*n
ans_false_count = [0]*n
ans_success_count = [0]*n

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

    if s=='WA':
        false_count[p-1] = false_count[p-1]*2 
    else:
        ans_false_count[p-1] += false_count[p-1]
        ans_success_count[p-1] = 1
        false_count[p-1] = 0

for j in range(n):
    if false_count[j] != 0:
        false_count = math.log(false_count[j],2)
    if ans_false_count [j] != 0:
        ans_false_count[j] = math.log(ans_false_count[j],2)

new_ans_false_count = false_count + ans_false_count
print(sum(ans_success_count), int(sum(new_ans_false_count)))

Submission status: Runtime Error

Solution code:
import math
n, m = map(int, input().split())
false_count = [1]*n
ans_false_count = [0]*n
ans_success_count = [0]*n

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

    if s=='WA':
        false_count[p-1] = false_count[p-1]*2 
    else:
        ans_false_count[p-1] += false_count[p-1]
        ans_success_count[p-1] = 1
        false_count[p-1] = 0

false_count = [math.log(i,2) for i in false_count] 

new_ans_false_count = false_count + ans_false_count
print(sum(ans_success_count), int(sum(new_ans_false_count)))

Submission status: Runtime Error

Solution code:
from typing import List


class Solution:
    #    def solve(self, N: int, P: List[int]) -> int:
    def solve(self, N: int, M: int, p_and_S):

        solved = []
        for n in range(N+1):
            solved.append([0, 0])

        ac_count = 0
        wa_count = 0

        for p_and_S_ in p_and_S:
            p, S = p_and_S_

            if solved[p][0] == 0:
                if S == "AC":
                    solved[p][0] += 1
                    ac_count += 1
                else:
                    solved[p][1] += 1
                    wa_count += 1

        return (ac_count, wa_count)


if __name__ == '__main__':

    # standard input
    N, M = list(map(int, input().split()))
    p_and_S = []
    for m in range(M):
        p_and_S_ = input().split()
        p_and_S.append([int(p_and_S_[0]), p_and_S_[1]])

    # solve
    solution = Solution()
    print(solution.solve(N, M, p_and_S))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

ac = [False]*n
c_ac = 0
c_wa = 0

for _ in range(m):
    pi,si = input().split()
    pi = int(pi)
    
    if ac[pi] == False:
        if si == 'WA':
            c_wa += 1
        elif si == 'AC':
            c_ac += 1
            ac[pi] = True

print(c_ac, c_wa)

Submission status: Runtime Error

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

for _ in range(M):
    p, S = input().split()
    p = int(p) - 1
    if S == 'AC':
        ac[p] = True
    else:
        if not ac[p]:
            wa[p] += 1

a = 0
b = 0

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

print(*[a, b])

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
#include <string>
#define M 1e5+5
using namespace std;
int main()
{
int n,t,i=0,ws=0,cs=0;
vector <int> vc(M,0);
map<int, int> mw;
cin>>n>>t;
vector<pair<int, string> >p(t);
while(t--)	
{
	int x;
	string s;
	cin>>x >> s;
	p[i]=make_pair(x,s);
	i++;
}

for(auto it= p.begin();it!=p.end();it++)
{
    
    cout<<it->first<<" "<<it->second<<endl;
	if(it->second=="AC")
	vc[it->first]++;
	
if(it->second=="WA")
mw[it->first]++;

if(it->second=="AC"&&vc[it->first]==1)
{
	cs++;
	ws+=mw[it->first];
}

}
cout<<cs<<" "<<ws;

	return 0;
}

Submission status: Runtime Error

Solution code:
n, m = [int(i) for i in input().split(' ')]
wa = [0] * n
ac = [0] * n
for _ in range(m):
    problem, status = input().split(' ')
    problem = int(problem) - 1
    if status == 'WA':
        if ac[problem] == 0:
            wa[problem] += 1
        continue
    ac[problem] = 1

no_ac = sum(ac)
no_wa = sum(wa)

print(str(no_acc) + ' ' + str(no_wa))

Submission status: Runtime Error

Solution code:
n, m = [int(i) for i in input().split(' ')]
wa = [0] * n
ac = [0] * n
for _ in range(m):
    problem, status = input().split(' ')
    problem = int(problem) - 1
    if status == 'WA':
        if ac[problem] == 0:
            wa[problem] += 1
        continue
    ac[problem] = 1

no_ac = sum(ac)
no_wa = sum(wa)

print('{} {}'.format(no_acc, no_wa))

Submission status: Runtime Error

Solution code:
n, m = [int(i) for i in input().split(' ')]
wa = [0] * n
ac = [0] * n
for _ in range(m):
    problem, status = input().split(' ')
    problem = int(problem) - 1
    if status == 'WA':
        if ac[problem] == 0:
            wa[problem] += 1
        continue
    ac[problem] = 1

no_ac = sum(ac)
no_wa = sum(wa)

print(f'{no_ac} {no_wa}')

Submission status: Runtime Error

Solution code:
import sys
N, M, *PS = sys.stdin.read().strip().split()
N = int(N)
ac = [0] * N
wa = [0] * N
for p, s in zip(*[iter(PS)] * 2):
  p = int(p) -1
  if s == "AC":
    ac[p] = 1
  elif ac[p] == 0:
    wa[p] += 1
penalties = sum([w or a for a, w in zip(ac, wa)])
print("{} {}".format(sum(ac),penalties)

Submission status: Runtime Error

Solution code:
n, m = map(int,input().split())
cor, war = 0,0
c = [[0,0] for k in range(n)] #[ACしたか,WA数]
for i in range(m):
  p,s = list(input().split())
  p = int(p)
  if s == "AC" and c[p][0] == 0: #初めてのACなら正答数を増やしてフラグを立て、ペナルティを誤答数分増やす
    cor += 1
    c[p][0] = 1
    war += c[p][1]
  if s == "WA" and c[p][0] == 0: #ACしていない状態でのWA数を記録
    c[p][1] += 1
print(cor,war)

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
i=0
points=[]
while i<M:
    y=input().split()
    p,s=int(y[0]),y[1]
    z=(p,s)
    points.append(z)
    i+=1
prolist=[]
col=0
so=0
for index,num in enumerate(points):
    so+=1
    if num[1]=="AC":
        if num[0] in prolist:
            continue
        else:
            col+=1
            prolist.append(num[0])
            pe=so-len(prolist)
   
print(col,pe)

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
ac = [0]*n
wa = [0]*n
a = 0
w = 0
for i in range(m):
  p, s = input().split()
  p = int(p)-1
  if ac[p] == 0, s == "AC":
    ac[p] += 1
    a += 1
    w += wa[p] 
  elif ac[p] == 0, s == "WA":
    wa[p] += 1
print(a,w)

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
ac = [0]*n
wa = [0]*n
a = 0
w = 0
for i in range(m):
  p, s = input().split()
  p = int(p)-1
  if ac[p] == 0, s == "AC":
    acs[p] += 1
    a += 1
    w += was[p] 
  elif ac[p] == 0, s == "WA":
    was[p] += 1
print(a,w)

Submission status: Runtime Error

Solution code:
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10 ** 9

N, M = map(int, readline().split())
PS = [line.split() for line in read().decode('utf8')]
AC = [False] * (N + 1)
WA = [0] * (N + 1)

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

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

Submission status: Runtime Error

Solution code:
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10 ** 9

N, M = map(int, readline().split())
AC = 0
WA = 0
li = set()
for _ in range(M):
    p, s = readline().decode('utf8').strip().split()
    if p not in li:
        if s != 'AC':
            WA += 1
        else:
            AC += 1
            li.add(s)

print(AC, WA)

Submission status: Runtime Error

Solution code:
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10 ** 9

N, M = map(int, readline().split())
AC = 0
WA = 0
li = []
for _ in range(M):
    p, s = readline().decode('utf8').strip().split()
    if p not in li:
        if s != 'AC':
            WA += 1
        else:
            AC += 1
            li.append(p)

print(AC, WA)