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 = [int(s) for s in input().split()]

p = [-1 for _ in range(m)]
s = [-1 for _ in range(m)]

for i in range(m):
    x = input().split()
    p[i] = int(x[0])
    s[i] = x[1]


dic_ac = {}
dic_wa = {}
dic_wa_num = {}

for i in range(m):
    if(s[i] == "AC"):
        if not (p[i] in dic_ac):
            dic_ac[p[i]] = 1
    
    if(s[i] == "WA" and p[i] not in dic_ac):
        if(p[i] in dic_wa):
            dic_wa_num[p[i]] += 1
        else:
            dic_wa[p[i]] = 1
            dic_wa_num[p[i]] = 1
            

wa = 0
ac = 0
for v in dic_wa_num.values():
    wa += v

for v in dic_ac.values():
    ac += v
    
print(ac,wa)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

cnt = defaultdict(int)
d = defaultdict()
for p, s in ps:
    if s == "AC":
        if not d.get(p):
            d[p] = cnt[p]
    else:
        cnt[p] += 1

correct = 0
pena = 0
for k, v in d.items():
    correct += 1
    pena += v

print(correct, pena)

Submission status: Wrong Answer

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

    problem_number = 1

    ac = 0
    ac_count = 0
    wa_count = 0
    wa = 0

    for i in range(M):
        if(problem_number == int(pS[i][0])):
            if(pS[i][1] == 'WA'):
                wa_count += 1
            if(pS[i][1] == 'AC'):
                if(ac_count == 0):
                    print(ac_count)
                    ac += 1
                    ac_count += 1
                    wa += wa_count
                    wa_count = 0

        else:
            wa_count = 0
            #ac_count = 0
            problem_number += 1
            if(pS[i][1] == 'WA'):
                wa_count += 1
            if(pS[i][1] == 'AC'):
                if(ac_count == 0):
                    ac_count += 1
                    ac+=1

    #ac_count = 0
    #wa_count = 0

    print(ac,wa)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

    problem_number = 1

    ac = 0
    wa_count = 0
    wa = 0

    for i in range(M):
        #print(wa_count)
        #print("i:",i)
        #print(pS[i][0])
        #print(pS[i][0])
        #print()
        if(problem_number == int(pS[i][0])):
            if(pS[i][1] == 'WA'):
        #        print('WWWWWAAAA')
                wa_count += 1
            if(pS[i][1] == 'AC'):
        #        print('AAAAACCCC')
                ac += 1
                wa += wa_count
                wa_count = 0
        else:
            wa_count = 0
            problem_number += 1
            if(pS[i][1] == 'WA'):
        #        print('ELSEWWWWWAAAA')
                wa_count += 1
            if(pS[i][1] == 'AC'):
        #        print('ELSEAAAAACCCC')
                ac+=1

    wa_count = 0

    print(ac,wa)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

wa = 0
for _ in range(M):
  p, s = input().split()
  p = int(p)
  if s == 'AC':
    P[p-1] = False
  else:
    if P[p-1]:
      wa += 1
  
print(P.count(False), wa)

Submission status: Wrong Answer

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

wa = 0
for _ in range(M):
  p, s = input().split()
  p = int(p)
  if s == 'AC':
    P[p-1] = False
  else:
    if P[p-1]:
      wa += 1
  
print(P.count(1), wa)

Submission status: Wrong Answer

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

wa = 0
for _ in range(M):
  p, s = input().split()
  p = int(p)
  if s == 'AC':
    P[p-1] = 1
  else:
    if P[p-1] == 0:
      wa += 1
  
print(P.count(1), wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
AC={}
WA={}
for i in range(M):
    a,b=input().split()
    if not(a in AC.keys()):
        if b=="AC":
            AC[a]=1
        else:
            if a in WA.keys():
                WA[a]+=1
            else:
                WA[a]=1
print(sum(AC.values()),sum(WA.values()))

Submission status: Wrong Answer

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

n, m = map(int, input().split())
p = [""]*m
s = [""]*m
check = [0]*n
ac = 0
wa = 0

for i in range(m):
    p[i], s[i] = map(str, input().split())
    p[i] = int(p[i])
for i in range(n):
    check[i] = [0,0]


for i in range(m):
    if check[p[i]-1] == 1:
        continue
    else:
        if s[i] == "WA":
            wa += 1
        elif s[i] == "AC":
            check[p[i]-1] = 1
            ac += 1

print(ac,wa)

Submission status: Wrong Answer

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

n, m = map(int, input().split())
p = [""]*m
s = [""]*m
check = {}
ac = 0
wa = 0

for i in range(m):
    p[i], s[i] = map(str, input().split())
    p[i] = int(p[i])
for i in range(n):
    check[i] = [0,0]


for i in range(m):
    if check[p[i]-1][0] == 1:
        continue
    else:
        if s[i] == "WA":
            check[p[i]-1][1]+= 1
        elif s[i] == "AC":
            check[p[i]-1][0] = 1
            ac += 1

for key in check.keys():
    wa += check[key][1]
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC = set()
wa = [0] * (N+1)

for _ in range(M):
    p, s = input().split()
    p = int(p)
    if not p in AC:
        if s == 'AC':
            AC.add(p)
        if s == 'WA':
            wa[p] += 1

wa_ans = 0
for i in range(1,N+1):
    if i in AC:
        wa_ans += wa[p]

print(len(AC), wa_ans)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC = set()
wa = 0
for _ in range(M):
    p, s = input().split()
    p = int(p)
    if not p in AC:
        if s == 'AC':
            AC.add(p)
        if s == 'WA':
            wa += 1

print(len(AC), wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
S = set()
ac = 0
wa = 0
for _ in range(M):
    p, s = input().split()
    p = int(p)
    if not p in S:
        if s == 'AC':
            S.add(p)
            ac += 1
        if s == 'WA':
            wa += 1

print(ac, wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ps=[list(input().split()) for i in range(m)]
l=[0]*n
countac=0
countwa=0
for i in range(m):
  if l[int(ps[i][0])-1]==0:
    if ps[i][1]=='AC':
      countac+=1
      l[int(ps[i][0])-1]=1
    else:
      countwa+=1
print(countac,countwa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ps=[list(input().split()) for i in range(m)]
l=[str(i) for i in range(1,n+1)]
countac=0
countwa=0
for i in range(m):
  if l.count(ps[i][0])==1:
    if ps[i][1]=='AC':
      countac+=1
      l.remove(ps[i][0])
    else:
      countwa+=1
print(str(countac)+' '+str(countwa))

Submission status: Wrong Answer

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

tmp = 0
pen = 0
for i in list_1:
    if i[1] == 'WA':
        tmp += 1
    elif i[1] == 'AC':
        pen += tmp
new_list = [j for j in list_1 if j[1] == 'AC']
ans_list = list(map(list, set(map(tuple, new_list))))
print(len(ans_list),pen)

Submission status: Wrong Answer

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

tmp = 0
pen = 0
for i in list_1:
    if i[1] == 'WA':
        tmp += 1
    elif i[1] == 'AC':
        pen = tmp
new_list = [j for j in list_1 if j[1] == 'AC']
ans_list = list(map(list, set(map(tuple, new_list))))
print(len(ans_list),pen)

Submission status: Wrong Answer

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

for _ in range(M):
    prob, wa_ac = input().split()
    prob = int(prob) - 1
    if wa_ac == 'AC':
        AC_or_not[prob] = True
    else:
        if not AC_or_not[prob]:
            n_penalty[prob] += 1

print(sum(AC_or_not), sum(n_penalty))

Submission status: Wrong Answer

Solution code:
"""
注意点：ACしていないWAはペナルティ数とはカウントされない
      また、ACの後にペナルティしたものはカウントされない
データ構造：
  WA:dict形式でカウントアップ
  AC:配列で末尾に挿入
一通り舐めた後AD配列をforで回してペナルティ数合計するか？
"""

N,M = list(map(lambda x: int(x), input().split()))
wa_count = [0] * N
ac_list = [False] * N
answer = 0

for _ in range(M):
  p,s = input().split()
  p = int(p)
  if s == 'WA':
    wa_count[p-1] += 1
  if s == 'AC' and ac_list[p-1] == False:
    answer += wa_count[p-1]
    ac_list[p-1] = True

print(len(ac_list), answer)

Submission status: Wrong Answer

Solution code:
"""
注意点：ACしていないWAはペナルティ数とはカウントされない
      また、ACの後にペナルティしたものはカウントされない
データ構造：
  WA:dict形式でカウントアップ
  AC:配列で末尾に挿入
一通り舐めた後AD配列をforで回してペナルティ数合計するか？
"""

N,M = list(map(lambda x: int(x), input().split()))
results = []
for n in range(M):
  results.append(input().split())


l = [(str(n + 1) , 0) for n in range(N)]
wa_count = dict(l)
ac_list = []
answer = 0

for p, s in results:
  if s == 'WA':
    wa_count[p] += 1
  else:
    if p not in ac_list:
      answer += wa_count[p]
    ac_list.append(p)
    

print(len(ac_list), answer)

Submission status: Wrong Answer

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

eva = {}

ac = 0
wa = 0

for i in range(m):
    q, s = input().split()
    if q in eva.keys():
        pass
    else:
        if s == "AC":
            ac += 1
            eva[q] = "AC"
        else:
            wa += 1

print(ac, wa)

Submission status: Wrong Answer

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

eva = [0 for _ in range(n)]

ac = 0
wa = 0

for i in range(m):
    a = input().split()
    q = int(a[0])
    s = a[1]
    if eva[q - 1] == "AC":
        pass
    else:
        if s == "AC":
            ac += 1
            eva[q - 1] = "AC"
        else:
            wa += 1

print(ac, wa)

Submission status: Wrong Answer

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

eva = [0 for _ in range(n)]

ac = 0
wa = 0

for i in range(m):
    a = input().split()
    q = int(a[0])
    s = a[1]
    if eva[q - 1] == "AC":
        pass
    else:
        if s == "AC":
            ac += 1
            eva[q - 1] = "AC"
        else:
            wa += 1
            eva[q - 1] += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
AC = 0
WA = 0
N, M =map(int, input().split())
A = [0]*N
if M == 0:
    print(0, 0)
else:
    for i in range(M):
        p, S = input().split()
        q = int(p)-1
        if S == 'AC' and A[q] != -1:
            AC += 1
            A[q] = -1
        elif S == 'WA' and A[q] != -1:
            WA += 1
    print(AC, WA)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
a=[]
c=[0]*n
cnt=0
b=[0]*n
for _ in range(m):
  p,s=input().split()
  p=int(p)
  p-=1
  if s=="AC":
    a.append(p)
    if c[p]==0:
          c[p]=1
  else:
        if c[p]==0:    
          b[p]+=1
for i in a:
  cnt+=b[i]
print(len(set(a)),cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
pS = []
N,M = [int(i) for i in input().split(" ")]
for _ in range(M):
    pS.append(input().split(" "))

ac = dict()
wa = dict()
count = 0
for i in pS:
    if i[0] not in ac and i[1] == 'WA':
        count+=1
    if i[1] == 'AC':
        ac[i[0]] = i[1]
print("{0} {1}".format(len(ac),count))

Submission status: Wrong Answer

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

ac = []
wa = 0
for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC":
        ac.append(p_i)
    elif s_i == "WA":
        if p_i not in ac:
            wa += 1

print(len(set(ac)), wa)

Submission status: Wrong Answer

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

ac = []
wa = 0
for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC":
        ac.append(p_i)
    else:
        if p_i not in ac:
            wa += 1

print(len(set(ac)), wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
now=0
count=0
P=[]
cnt=0
wa=0
c=[]
for i in range(m):
  p,s=map(str,input().split())
  p=int(p)
  P.append(p)
  if i==0:
    if s=="WA":
      count=1
    else:
      cnt=1
      c.append(p)
  if i!=0 and P[i]==P[i-1]:
    if s=="WA":
      count+=1
      
    else:
      if p not in c:
        cnt+=1
        wa+=count
        c.append(p)
      
  if i!=0 and P[i]!=P[i-1]:
    if s=="WA":
      count=1
     
    else:
      if p not in c:
        cnt+=1
        c.append(p)
print(cnt,wa)

Submission status: Wrong Answer

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

flag = [False] * n
cnt = [0 for i in range(n)]
for i in ps:
    if i[1] == 'WA' and flag[int(i[0]) - 1] == False:
        cnt[int(i[0]) - 1] += 1
    elif i[1] == 'AC':
        flag[int(i[0]) - 1] = True
print(sum(flag), sum(cnt))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
isAC = [False for _ in range(N)]
correct = 0
penalty = [0 for _ in range(N)]
for _ in range(M):
    tmp = input().split()
    pi, Si = int(tmp[0]), tmp[1]
    if not isAC[pi-1]: # すでにAC
        if Si == 'AC':
            isAC[pi-1] = True
            correct += 1
        else:
            penalty[pi-1] += 1
 
print(correct, sum(penalty))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
isAC = [False for _ in range(N)]
correct = 0
penalty = 0
for _ in range(M):
    tmp = input().split()
    pi, Si = int(tmp[0]), tmp[1]
    if not isAC[pi-1]: # すでにAC
        if Si == 'AC':
            isAC[pi-1] = True
            correct += 1
        else:
            penalty += 1

print(correct, penalty)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
isAC = [False for _ in range(N)]
correct = 0
penalty = 0
for _ in range(M):
    tmp = input().split()
    pi, Si = int(tmp[0]), tmp[1]
    if isAC[pi-1]: # すでにAC
        if Si == 'AC':
            pass
        else :
            pass
    else:       # まだWA
        if Si == 'AC':
            isAC[pi-1] = True
            correct += 1
        else:
            penalty += 1

print(correct, penalty)

Submission status: Wrong Answer

Solution code:
# import math
# from fractions import gcd

import numpy as np
# import scipy as scp

# 入力の受け取り
n,m = map(int,input().split())
# 列ベクトルとかの受け取り
times = m
table = []
for _ in range(times):
    table.append(list(input().split()))

statusAC = {}
penalty = 0

for question_num , ACorWA in table:
    question_num = int(question_num)
    if question_num in statusAC:
        continue
    else:
        if ACorWA == "AC":
            statusAC[question_num] = "AC"
        else:
            penalty += 1

ans = len(statusAC)
print(ans,penalty)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a = [False]*n
b = [0]*n

for i in range(m):
  x,y = input().split()
  x = int(x)
  if y == 'AC':
    a[x-1] = True
  elif y == 'WA' and a[x-1] == False:
    b[x-1] += 1

print(a.count(True), sum(b))

Submission status: Wrong Answer

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

ac_list = []
wa_dict = {}
num_wa = 0

for ps in ps_list:
    p = int(ps[0])
    s = ps[1]
    
    if s == 'AC':
        ac_list.append(p)
        if p in wa_dict.keys():
            num_wa += wa_dict[p]
    elif p not in ac_list:
        if p not in wa_dict.keys():
            wa_dict[p] = 1
        else:
            wa_dict[p] += 1
            
num_ac = len(ac_list)
        
print(num_ac, num_wa)

Submission status: Wrong Answer

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

ac_list = []
wa_dict = {}

for ps in ps_list:
    p = int(ps[0])
    s = ps[1]
    
    if s == 'AC':
        ac_list.append(p)
    elif p not in ac_list:
        if p not in wa_dict.keys():
            wa_dict[p] = 1
        else:
            wa_dict[p] += 1
            
num_ac = len(ac_list)
num_wa = 0
for p in ac_list:
    if p in wa_dict.keys():
        num_wa += wa_dict[p]
        
print(num_ac, num_wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ac,wa=0,0
task=[False]*N
for m in range(M):
    p,S=input().split()
    p=int(p)-1
    if task[p]==False and S=="WA":
        wa+=1
    elif task[p]==False and S=="AC":
        ac+=1
        task[p]=True
print(ac,wa)

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()
n,m=map(int,input().split())
wa=[0]*n
ac=[0]*n
for _ in range(m):
    x,y=map(str,input().split())
    x=int(x)
    if y=='WA':
        if ac[x-1]==0:
            wa[x-1]+=1
    if y=='AC':
        ac[x-1]=1
print(sum(ac),sum(wa))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


answer =[]
count = 0

for i in range(len(ps)):
  if ps[i][0] not in answer:
    if ps[i][1] == "AC":
      answer.append(ps[i][0])
    else:
      count += 1

print(len(answer),count)

Submission status: Wrong Answer

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

for i in range(len(ps)):
  ps[i][0] = int(ps[i][0])

answer =[]
count = 0

for i in range(len(ps)):
  if ps[i][0] not in answer:
    if ps[i][1] == "AC":
      answer.append(ps[i][0])
    elif ps[i][1] == "WA":
      count += 1

print(len(answer),count)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=[0]*n
wa=ac
for i in range(m):
  p,s=map(str,input().split())
  p=int(p)-1
  if ac[p]==0:
    if s=='AC':
      ac[p]=1
    else:
      wa[p]+=1

w=0
for i in range (n):
  w+=ac[i]*wa[i]
print(sum(ac),w)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=[0]*n
wa=0
for i in range(m):
  p,s=map(str,input().split())
  p=int(p)
  if ac[p-1]==0:
    if s=='AC':
      ac[p-1]=1
    else:
      wa+=1

print(sum(ac),wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

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

if m == 0:
    print("{} {}".format(0, 0))
    sys.exit()
    
score = 0
penalty = 0
before_q_num = '0'
is_clear = False

for i in range(m):
    q_num, result = map(str, input().split())
    
    if before_q_num != q_num:
        is_clear = False
        before_q_num = q_num

    if result == 'AC':
        if not is_clear:
            score += 1
            is_clear = True
    else:
        if not is_clear: penalty += 1

print("{} {}".format(score, penalty))

Submission status: Wrong Answer

Solution code:
import sys

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

if m == 0:
    print("{} {}".format(0, 0))
    sys.exit()
    
score = 0
penalty = 0
before_q_num = '0'
skip_flg = False
is_clear = False
for i in range(m):
    q_num, result = map(str, input().split())
    
    if before_q_num != q_num:
        before_q_num = q_num
        is_clear = False

    if result == 'AC':
        if not is_clear:
            score += 1
        is_clear = True
    else:
        if not is_clear:
            penalty += 1

print("{} {}".format(score, penalty))

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
input = sys.stdin.buffer.readline
def inputS(): return input().rstrip().decode()
readlines = sys.stdin.buffer.readlines 

N, M = map(int, input().split())
AC = ["WA"]*N
ans = {"WA":0, "AC":0}

for _ in range(M):
  i, s = input().split()
  i = int(i)
  s = s.decode()
  if AC[i-1] != "AC":
    ans[s] += 1
    AC[i-1] = s

print(ans["AC"], ans["WA"])

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N, M = map(int, input().split())
ac = 0
penalty = 0
accepted = [False] * N

for _ in range(M):
    P, S = input().split()
    p = int(P) - 1
    if (S == "WA") and (not accepted[p]):
        penalty += 1
    if (S == "AC") and (not accepted[p]):
        accepted[p] = True
        ac += 1

print(" ".join(map(str, [ac, penalty])))

Submission status: Wrong Answer

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

check = [0]*N
count_W = 0
count_A = 0
for i in range(M):
    p, S = input().split()
    p = int(p)
    if check[p-1] == 0:
        if S == "WA":
            count_W = count_W + 1
        else:
            count_A = count_A + 1
            check[p-1] = 1
print(count_A, count_W)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
is_ac = [False] * n
wa = [0] * n
a = 0 
b = 0

for _ in range(m):
    p, s = map(str, input().split())
    p = int(p) - 1
    if s == 'AC':
        is_ac[p] = True
        continue
    else:
        wa[p] += 1


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

print(a, b)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
A=[[0,0] for i in range(n)] #ACしたか、WA数
AC=0
pen=0
for i in range(m):
    a,b=map(str,input().split())
    a=int(a)
    if b=="AC":
        A[a-1][0]=1
    elif b=="WA" and A[a-1]==0:
        A[a-1][1]+=1
for i in range(n):
    if A[i][0]==1:
        AC+=1
        pen+=A[i][1]
print(AC,pen)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
pen=0
A=[0 for i in range(n)]
q=[]
for i in range(m):
  a,b=map(str,input().split())
  a=int(a)
  q.append([a-1,b])
  if b=="AC":
    A[a-1]=1
for i in range(m):
  a,b=q[i]
  if b=="WA" and A[a-1]==1:
    pen+=1
print(sum(A),pen)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
pen=0
A=[0 for i in range(n)]
for i in range(m):
  a,b=map(str,input().split())
  a=int(a)
  if b=="AC":
    A[a-1]=1
  else:
    pen+=1
print(sum(A),pen)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
PS=[input().split() for i in range(M)]
ACzumi=[]
i=0
WA_count=0
for i in range(M):
    if PS[i][0] in ACzumi:
        i+=0
    else:
        if PS[i][1]=="AC":
            ACzumi.append(PS[i][0])
        else:
            WA_count+=1
#print(ACzumi)
print(len(ACzumi),WA_count)

Submission status: Wrong Answer

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

WAlist = [0]*N
ACflag = [0]*N

for i in range(M):
    p, s = input().split()
    p=int(p)
    if ACflag[p-1] == 0:
        if   s == "WA":
            WAlist[p-1] += 1
        elif s == "AC":
            ACflag[p-1] = 1

print(sum(ACflag), sum(WAlist))

Submission status: Wrong Answer

Solution code:
p = []
WA = 0

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

ACflag = [0]*N

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

print(sum(ACflag), WA)

Submission status: Wrong Answer

Solution code:
p = []
WA = 0

def con(a):
    if a.isdigit():
        return int(a)-1
    elif a == "WA":
        return 0
    elif a == "AC":
        return 1

N, M= map(int, input().split())
for i in range(M):
    tmp = list(map(con, input().split()))
    p.append(tmp)

AC = [0]*N


for i in range(M):
    tmp = p[i] 
    if AC[tmp[0]]==0:
        if tmp[1]==0:
            WA += 1
        elif tmp[1]==1:
            AC[tmp[0]]=1


print(sum(AC), WA)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
PS=[input().split() for i in range(M)]
ACzumi=[]
i=0
WA_count=0
while i<M:
    if PS[i][0] in ACzumi:
        i+=0
    else:
        if PS[i][1]=="AC":
            ACzumi.append(PS[i][0])
        else:
            WA_count+=1
    i+=1
AC=set(ACzumi)
print(len(AC),WA_count)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
PS=[input().split() for i in range(M)]
ACzumi=[]
i=0
WA_count=0
while i<M:
    if PS[i][0] in ACzumi:
        i+=0
    else:
        if PS[i][1]=="AC":
            ACzumi.append(PS[i][0])
        else:
            WA_count+=1
    i+=1
print(len(ACzumi),WA_count)

Submission status: Wrong Answer

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

AC = 0
WA = 0
A = [0]*N #flag管理,n番目の問題がACになったらn-1番目の配列に1を入れる
for _ in range(M):
	p, S = input().split() #注意!ここのpはstrで入っている
	if A[int(p)-1] == 0:
		if S == "WA":
			WA += 1
		else:
			A[int(p)-1] = 1
			AC += 1
	else:
		continue

print(AC,WA)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
dic = {}
cnt = 0
for _ in range(m):
    p,s = input().split()
    if p not in dic.keys():
        if s == 'AC':
            dic[p] = 1
        else:
            cnt += 1
cor = sum(dic.values())
print('{} {}'.format(cor, cnt))

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
ans = [input() for i in range(m)]
dic = {}
cnt = 0
for i in range(m):
    p,s = ans[i].split()
    if p not in dic.keys():
        if s == 'AC':
            dic[p] = 1
        else:
            cnt +=1
cor = sum(dic.values())
print('{} {}'.format(cor, cnt))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
hasAC = [False] * n #AC or WAの配列を用意
wa = [0] * n #waの回数を格納
a = 0
b = 0

for _ in range(m):
    p, s = map(str, input().split())
    p = int(p) - 1
    if s == 'AC':    
        hasAC[p] = True
    else:
        wa[p] += 1


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

print(a, b)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

sub_st = defaultdict(list)
for p, s in ps:
    sub_st[p].append(s)

solved = 0
error = 0
for k, v in sub_st.items():
    temp_error = 0
    for history in v:
        if 'AC' in v:
            error += temp_error
            solved += 1
            break
        temp_error += 1

print(solved, error)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

sub_st = defaultdict(list)
for p, s in ps:
  sub_st[p].append(s)

solved = 0
error = 0
for k, v in sub_st.items():
  temp_error = 0
  for history in v:
    temp_error += 1
    if 'AC' in v:
      error += temp_error
      solved += 1
      break

print(solved, error)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
wa=0
ac=0
already=[]
for i in range(M):
    P,S=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
if ac==0:
    print(0,0)
else:
    print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
wa=0
ac=0
already=[]
for i in range(M):
    P,S=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(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
wa=0
ac=0
already=[]
for i in range(M):
    P,S=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: Wrong Answer

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

p = []
s = []
ps = []

uoo = []

ans2 = 0

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

    if not(p in uoo):
        if s == 'AC':
           uoo.append(p)
        elif s == 'WA':
            ans2 += 1
        
        

ans1 = len(uoo)

print(str(ans1) + ' ' + str(ans2))