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())
set_p = set()
count_a=0
count_p=0
for _ in range(M):
  p,S= input().split()
  if p in set_p:
    continue
  else:
    if S=='WA':
      count_p+=1
    else:
      count_a+=1
      set_p.add(p)
    
print(count_a, count_p)

Submission status: Wrong Answer

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

ac = 0
wa = 0
for _ in range(M):
    a,b = input().split()
    a = int(a)

    if not p[a]:
        if b == "AC":
            p[a] = 1
            ac += 1
        else:
            wa += 1

print(ac,wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC = [0 for i in range(N)]
WA = [0 for i in range(N)]
a = [0 for i in range(N)]
for i in range(M):
  p, S = input().split()
  p = int(p)
  if S == 'AC':
    AC[p-1] = 1
    a[p-1] = 0
  else:
    WA[p-1] += 1
    a[p-1] = 1
c = sum(AC)
wa = sum(WA) - sum(a)
print(c, wa, sep=' ')

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC = [0 for i in range(N)]
WA = [0 for i in range(N)]
a = [0 for i in range(N)]
for i in range(M):
  p, S = input().split()
  p = int(p)
  if S == 'AC':
    AC[p-1] = 1
    a[p-1] = 0
  else:
    WA[p-1] += 1
    a[p-1] += 1
c = sum(AC)
wa = sum(WA) - sum(a)
print(c, wa, sep=' ')

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC = [0 for i in range(N)]
WA = [0 for i in range(N)]
for i in range(M):
  p, S = input().split()
  p = int(p)
  if S == 'AC':
    AC[p-1] = 1
  else:
    if AC[p-1] == 0:
      WA[p-1] += 1
c = sum(AC)
wa = sum(WA)
print(c, wa, sep=' ')

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC = []
WA = []
wa = 0
for i in range(M):
  p, S = input().split()
  p = int(p)
  if S == 'AC':
    if p in set(AC):
      continue
    else:
      AC.append(p)
      if p in set(WA):
        wa += AC.count(p)
  else:
    if p in set(AC):
      continue
    else:
      WA.append(p)
c = len(AC)
print(c, wa, sep=' ')

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ac=[0]*(10**5+1)
wa=[0]*(10**5+1)
for i in range(M):
  p,S=input().split()
  if ac[int(p)]==0:
    if S=="WA":
      wa[int(p)]+=1
    else:
      ac[int(p)]=1
print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC = []
WA = []
for i in range(M):
  p, S = input().split()
  p = int(p)
  if S == 'AC':
    AC.append(p)
  else:
    if p in AC:
      continue
    else:
      WA.append(p)
AC = list(set(AC))
c = len(AC)
w = len(WA)
print(c, w, sep=' ')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
A = [0 for _ in range(N+1)]
B = [0 for _ in range(N+1)]
for _ in range(M):
    p,S = input().split()
    p = int(p)
    if S=="AC":
        if A[p]==0:
            A[p]=1
    else:
        if A[p]==0:
            B[p] += 1
print(sum(A),sum(B))

Submission status: Wrong Answer

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n,m = readInts()
dic = defaultdict(int)
for i in range(m):
    a,b = input().split()
    if dic['AC'+a] != 1:
        if b == 'AC':
            dic['AC'] += 1
            dic['AC'+a] = 1
        else:
            dic['WA'] += 1
print(dic['AC'],dic['WA'])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

w_c = 0
a_c = 0
lis = []
for i in range(m):
    p,s = list(input().split())
    if s == 'AC' and p not in lis:
        a_c += 1
        lis.append(p)
    elif s == 'WA' and i != m-1:
        w_c += 1

print(a_c,w_c)

Submission status: Wrong Answer

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

dict = {}

for i in range(m):
  p, s = map(str, input().split())
  p = int(p)
  if p not in dict:
    dict[p] = (0, 0)
  if s == 'AC':
    dict[p] = (dict[p][0] + 1, dict[p][1])
  elif dict[p][0] == 0:
    dict[p] = (dict[p][0], dict[p][1] + 1)

correct = 0
penalty = 0

for key in dict.keys():
  if dict[p][0] > 0:
    correct += 1
    penalty += dict[p][1]

print(str(correct) + ' ' + str(penalty))

Submission status: Wrong Answer

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

for _ in range(M):
    p, s = input().split()
    p = int(p)
    if Q[p] == 0:
        if s == "WA":
            WA += 1
        else:
            AC += 1
            Q[p] = 1
    else:
        continue

print(AC, WA)

Submission status: Wrong Answer

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

pen = 0
ac = 0
ac_ques = set()

for _ in range(m):
    p,s = map(str, input().split())
    if p not in ac_ques:
        if s == "WA":
            pen += 1
        else:
            ac_ques.add(p)

print(len(ac_ques),pen)

Submission status: Wrong Answer

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

pen = 0
ac = 0
ac_ques = []

for _ in range(m):
    p,s = map(str, input().split())
    if p not in ac_ques:
        if s == "WA":
            pen += 1
        else:
            ac_ques.append(p)

print(len(ac_ques),pen)

Submission status: Wrong Answer

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

isACs = [0] * N
numPenalty = 0
for _ in range(M):
    p, res = input().split()
    p = int(p) - 1
    if res == 'AC':
        isACs[p] = 1
    else:
        if not isACs[p]:
            numPenalty += 1

numAC = sum(isACs)
print(numAC, numPenalty)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
if m == 0:
  print('0 0')
  exit()
acornot = [False] * n
wasum = 0
acsum = 0
for i in range(m):
  subnum, res = input().split()
  subnum = int(subnum) - 1
  if acornot[subnum] == False:
    if res == 'AC':
      acornot[subnum] = True
      acsum += 1
    else:
      wasum += 1
print(acsum, wasum)

Submission status: Wrong Answer

Solution code:
# unihernandez22
# https://atcoder.jp/contests/abc151/tasks/abc151_c
# implementation

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

passed = 0
penalies = 0

ac = {}
wa = {}

for i in range(m):
    p, s = input().split()
    if ac.get(p, True):
        if s == "WA" and wa.get(p, True):
            penalies += 1
            wa[p] = False
        elif s == "AC":
            passed += 1
            ac[p] = False

print(passed, penalies)

Submission status: Wrong Answer

Solution code:
# unihernandez22
# https://atcoder.jp/contests/abc151/tasks/abc151_c
# implementation

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

passed = 0
penalies = 0

a = {}

for i in range(m):
    p, s = input().split()
    if a.get(p, True):
        if s == "WA": penalies += 1
        elif s == "AC":
            passed += 1
            a[p] = False

print(passed, penalies)

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())
n, m = map(int, input().split())

acCount = 0
waCount = 0
check = [0] * n

for i in range(m):
    p, s = map(str, input().split())
    # print(p,s)
    p = int(p)
    if (check[p - 1] == 0):
        if (s == 'WA'):
            waCount += 1
        else:
            acCount += 1
            check[p - 1] = 1

    else:
        continue

print(acCount, waCount)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
penalty=0
result=["WA"]*N

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

  print(result.count("AC"),penalty)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
penalty=[0]*N
result=["WA"]*N

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

  print(result.count("AC"),sum(penalty))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
penalty=[0]*N
result=["WA"]*N

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

print(result.count("AC"),sum(penalty))

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())
acCount = 0
waCount = 0
check = [0] * n

for i in range(m):
    p, s = map(str, input().split())
    #print(p,s)
    p = int(p)
    if (check[p - 1] == 0):
        if (s == 'WA'):
            waCount += 1
        else:
            acCount += 1
            check[p - 1] = 1

    else:
        continue

print(acCount, waCount)

Submission status: Wrong Answer

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

check = {}

for i in range(M):
    p,S = input().split()
    p = int(p)
    if p not in check:
        if S == 'WA':
            check[p] = 1
        else:
            ans += 1
            check[p] = -1
    else:
        if S == 'WA' and check[p] != -1:
            check[p] += 1
        elif S == 'AC' and check[p] != -1:
            pen += check[p]
            ans += 1
            check[p] == -1

print(ans,pen)

Submission status: Wrong Answer

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

check = {}

for i in range(M):
    p,S = input().split()
    p = int(p)
    if p not in check:
        if S == 'WA':
            check[p] = 1
        else:
            ans += 1
            check[p] = -1
    else:
        if S == 'WA':
            check[p] += 1
        elif S == 'AC' and check[p] != -1:
            pen += check[p]
            ans += 1
            check[p] == -1

print(ans,pen)

Submission status: Wrong Answer

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

check = {}

for i in range(M):
    p,S = input().split()
    p = int(p)
    if p not in check:
        if S == 'WA':
            check[p] = 1
        else:
            ans = 1
            check[p] = -1
    else:
        if S == 'WA':
            check[p] += 1
        elif S == 'AC' and check[p] != -1:
            pen += check[p]
            ans += 1
            check[p] == -1

print(ans,pen)

Submission status: Wrong Answer

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

check = {}

for i in range(M):
    p,S = input().split()
    p = int(p)
    if p not in check:
        if S == 'WA':
            check[p] = 1
        else:
            ans = 1
    else:
        if S == 'WA':
            check[p] += 1
        elif S == 'AC' and check[p] != -1:
            pen += check[p]
            ans += 1
            check[p] == -1

print(ans,pen)

Submission status: Wrong Answer

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

check = {}

for i in range(M):
    if len(check) == N:
        break
    p,S = input().split()
    p = int(p)
    if p not in check:
        if S == 'WA':
            check[p] = 0
        else:
            ans = 1
    else:
        if S == 'WA':
            check[p] += 1
        elif S == 'AC' and check[p] != -1:
            pen += check[p]
            ans += 1
            check[p] == -1

print(ans,pen)

Submission status: Wrong Answer

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

import numpy as np

ans = 0
pen = 0

check = set()

for i in range(M):
    if len(check) == N:
        break
    q,S = input().split()
    p = int(q)
    if p not in check:
        if S == 'WA':
            pen += 1
        elif S == 'AC':
            ans += 1
            check.add(p)
    else:
        continue

print(ans,pen)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split(' '))
P_n = [input().split(' ') for _ in range(M)]
cnt = [0, 0]
already = []
for p in P_n:
    if p[0] not in already:
        if p[1] == 'AC':
            cnt[0] += 1
            already.append(p[0])
        elif p[1] == 'WA':
            cnt[1] += 1
print(str(cnt[0]) + ' ' + str(cnt[1]))

Submission status: Wrong Answer

Solution code:
#151
N, M = map(int,input().split())
AC = [0]*N
WA = [0]*N
for i in range(M):
    p, s = input().split()
    p = int(p)
    if(s=='WA' and AC[p-1]==0):
        WA[p-1] += 1
        continue
    if(s=='AC' and AC[p-1]==0):
        AC[p-1] += 1
        continue
print(sum(AC), sum(WA))

Submission status: Wrong Answer

Solution code:
def resolve():
    N, M = list(map(int, input().split()))
    resolved = []
    ac, wa = 0, 0
    for i in range(M):
        p, S = list(input().split())
        if p not in resolved:
            if S == 'AC':
                ac += 1
                resolved.append(p)
            else:
                wa += 1

    print(ac, wa)


resolve()

Submission status: Wrong Answer

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

C = [0 for _ in range(N + 1)]

cnt = 0
ans = 0
for p, s in PS:
    if C[int(p)] == 0:
        if s == "WA":
            cnt += 1
        else:
            C[int(p)] += 1
            ans += 1


print(ans, cnt)

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys

N, M = [int(_) for _ in input().split()]

if M == 0:
    print("0 0")
    sys.exit()

P, S = np.array([[_ for _ in input().split()] for i in range(M)]).T

dict = {}
for i in range(M):
    if not (P[i] in dict):
        dict.update({P[i]: {"AC": False, "WA": 0}})

    value = dict[P[i]]

    if not value["AC"]:
        if S[i] == "AC":
            dict[P[i]] = {"AC": True, "WA": value["WA"]}
        else:
            dict[P[i]] = {"AC": False, "WA": value["WA"] + 1}

ac = sum(value["AC"] for value in dict.values())
wa = sum(value["WA"] for value in dict.values())

print(f"{ac} {wa}")

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys

N, M = [int(_) for _ in input().split()]

if M == 0:
    print("0 0")
    sys.exit()

P, S = np.array([[_ for _ in input().split()] for i in range(M)]).T

dict = {}
for i in range(M):
    if not (P[i] in dict):
        dict.update({P[i]: {"AC": False, "WA": 0}})

    if S[i] == "AC":
        value = dict[P[i]]
        dict[P[i]] = {"AC": True, "WA": value["WA"]}
    else:
        value = dict[P[i]]
        if not value["AC"]:
            dict[P[i]] = {"AC": False, "WA": value["WA"] + 1}

ac = sum(value["AC"] for value in dict.values())
wa = sum(value["WA"] for value in dict.values())

print(f"{ac} {wa}")

Submission status: Wrong Answer

Solution code:
f=lambda:input().split()
n,m=map(int,f())
n+=1
a,w=[0]*n,[0]*n
for _ in range(m):
  p,s=f()
  p=int(p)
  if s=='AC': a[p]=1
  elif a[p]<1: w[p]+=1
print(sum(a),sum(w))

Submission status: Wrong Answer

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

import numpy as np

ans = 0
pen = 0

check = set()

for i in range(M):
    if len(check) == N:
        break
    p,S = input().split()
    p = int(p)
    if p not in check:
        if S == 'WA':
            pen += 1
        elif S == 'AC':
            ans += 1
            check.add(p)
    else:
        continue

print(ans,pen)

Submission status: Wrong Answer

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

import numpy as np

ans = 0
pen = 0

check = []

for i in range(M):
    if len(check) == N:
        break
    p,S = input().split()
    p = int(p)
    if p not in check:
        if S == 'WA':
            pen += 1
        elif S == 'AC':
            ans += 1
            check.append(p)
    else:
        continue

print(ans,pen)

Submission status: Wrong Answer

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

import numpy as np

ans = 0
pen = 0

check = list(np.linspace(1,N,N))

for i in range(M):
    if len(check) == 0:
        break
    p,S = input().split()
    p = int(p)
    if p in check:
        if S == 'WA':
            pen += 1
        elif S == 'AC':
            ans += 1
            o = check.index(p)
            check.pop(o)
    else:
        continue

print(ans,pen)

Submission status: Wrong Answer

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

import numpy as np

ans = 0
pen = 0

check = list(np.linspace(1,N,N))

for i in range(M):
    p,S = input().split()
    p = int(p)
    if p in check:
        if S == 'WA':
            pen += 1
        elif S == 'AC':
            ans += 1
            o = check.index(p)
            check.pop(o)
    else:
        continue

print(ans,pen)

Submission status: Wrong Answer

Solution code:

import sys

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

if len(PS) == 0:
    print(0, 0)
    sys.exit()

ansed = []
wc = 0
ac = 0
a = 0
for i, ps in enumerate(PS):
    if ps[0] not in ansed:
        if ps[1] == "WA":
            wc = wc + 1
        else:
            ac = ac + 1
            a = a + wc
            ansed.append(ps[0])
            wc = 0

print(ac, a)

Submission status: Wrong Answer

Solution code:

import sys

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

if len(PS) == 0:
    print(0, 0)
    sys.exit()

ansed = []
wc = 0
ac = 0
for i, ps in enumerate(PS):
    if ps[0] not in ansed:
        if ps[1] == "WA":
            wc = wc + 1
        else:
            ac = ac + 1
            ansed.append(ps[0])

print(ac, wc)

Submission status: Wrong Answer

Solution code:
import sys

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

if len(ps) == 0:
    print(0, 0)
    sys.exit()

pn = ps[0]
pn = pn[0]

wc = 0
ac = 0
flg = False
for i, PS in enumerate(ps):
    if PS[0] != pn:
        pn = PS[0]
        flg = False

    if flg == False:
        if PS[0] == pn:
            if PS[1] == "WA":
                wc = wc + 1
            else:
                ac = ac + 1
                flg = True
print(ac, wc)

Submission status: Wrong Answer

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

    if m == 0:
        print(0, 0)
        return 
    else:
        wa = [0 for i in range(n+1)]
        ac = [0 for i in range(n+1)]

        for pro, s in p:
            if ac[int(pro)] == 0:
                if s == 'WA':
                    wa[int(pro)] += 1
                elif s == 'AC':
                    ac[int(pro)] += 1
        
        print(sum(ac), sum(wa))
    

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n, m = map(int, input().split())
    ac = [0] * n
    wanum = [0] * n
    for _ in range(m):
        p, s = input().split()
        p = int(p) - 1
        if ac[p]:
            continue
        else:
            if s == 'AC':
                ac[p] = 1
            else:
                wanum[p] += 1
    print(sum(ac), sum(wanum))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
q=[0 for q in range(n)]
t=0
p=[]
for i in range(m):
    a=list(input().split())
    p.append(a)
    a[0]=int(a[0])
    if a[1]=="AC":
        q[a[0]-1]=1
    else:
        if q[a[0]-1]==0:
            t+=1
            
for i in range(m):
    if p[i][1]=="WA":
        if q[a[0]-1]==0:
            t-=1
print(str(q.count(1))+" "+str(t))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
q=[0 for q in range(n)]
t=0

for i in range(m):
    a=list(input().split())
    a[0]=int(a[0])
    if a[1]=="AC":
        q[a[0]-1]=1
    else:
        if q[a[0]-1]==0:
            t+=1
print(str(q.count(1))+" "+str(t))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
if m==0:
  print("{} {}".format(0,0))
else:
  ac_count=0
  wa_count=0
  ac_list=[0]*n
  for i in range(m):
    p,s=input().split()
    if ac_list[int(p)-1]==0:
      if s=="AC":
        ac_count+=1
        ac_list[int(p)-1]+=1
      else:
        wa_count+=1
  print("{} {}".format(ac_count,wa_count))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
if n==0:
  print("{} {}".format(0,0))
else:
  ac_count=0
  wa_count=0
  ac_list=[0]*n
  for i in range(m):
    p,s=input().split()
    if ac_list[int(p)-1]==0:
      if s=="AC":
        ac_count+=1
        ac_list[int(p)-1]+=1
      else:
        wa_count+=1
  print("{} {}".format(ac_count,wa_count))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
p=[0]
p*=n
ac=set()
wa=0
for i in range(m):
    pi,si=input().split()
    pi=int(pi)
    if si=='AC':
        ac.add(pi) 
        wa+=p[pi-1]
    else:
        p[pi-1]+=1
ans=len(ac)
print(ans,wa,end=' ')

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
if M==0:
  print('0 0')
AC=[0]*(N+1)
WA=[0]*(N+1)
for i in range(M):
  p,s=map(str,input().split())
  if s=='AC':
    key=int(p)
    AC[key]+=1
  elif s=='WA' and AC[int(p)]==0:
    WA[int(p)]+=1
for i in range(N+1):
  if AC[i]==0:
    WA[i]=0
ansc=AC.count(0)
ANSC=len(AC)-ansc
ANSW=sum(WA)
print(ANSC,ANSW)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
if M==0:
  print('0 0')
  exit()
AC=[0]*(N+1)
WA=[0]*(N+1)
for i in range(M):
  p,s=map(str,input().split())
  if s=='AC':
    key=int(p)
    AC[key]+=1
  elif s=='WA' and AC[int(p)]==0:
    WA[int(p)]+=1
ansc=AC.count(0)
ANSC=len(AC)-ansc
ANSW=sum(WA)
print(ANSC,ANSW)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
a=[[0,0] for _ in range(n)]
for i in range(m):
  dk,*d=list(map(str,input().split()))
  if d==['AC']:
    a[int(dk)-1][0]=1
  else:
    if a[int(dk)-1][0]==0:
      a[int(dk)-1][1]+=1
ntp=list(zip(*a))
ans=str(sum(ntp[0]))+' '+str(sum(ntp[1]))
print(ans)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
a=[[0,0] for _ in range(n)]
for i in range(m):
  dk,*d=list(map(str,input().split()))
  print(d)
  if d==['AC']:
    a[int(dk)-1][0]=1
  else:
    if a[int(dk)-1][0]==0:
      a[int(dk)-1][1]+=1
ntp=list(zip(*a))
ans=str(sum(ntp[0]))+' '+str(sum(ntp[1]))
print(ans)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
cor = set()
wa = 0
for i in range(m):
  p, s = input().split()
  p = int(p)
  if s == 'AC':
    cor.add(p)
  else:
    if not p in cor:
      wa += 1

print(*[len(cor), wa])

Submission status: Wrong Answer

Solution code:
n , m = (int(a) for a in input().split())
ans = []
ng = 0
for i in range(m) :
    p,s = input().split()
    if int(p) not in ans :
        if s == "AC" :
            ans.append(int(p))
        else : ng += 1

print(len(ans) , ng)

Submission status: Wrong Answer

Solution code:
n , m = (int(a) for a in input().split())
check = []
for i in range(m) :
    p,s = input().split()
    check.append([int(p),s])

ans = []
ng = 0
for i in range(m) :
    if check[i][0] not in ans :
        if check[i][1] == "AC" :
            ans.append(check[i][0])
        else : ng += 1

print(len(ans) , ng)

Submission status: Wrong Answer

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

l=[0]*n
ll=[0]*n
no_ac=0
no_pen=0

for i in range(m):
  a,b=map(str,input().split())
  a=int(a)
  if b=='AC':
    if l[a-1]==0:      
      no_ac+=1
    l[a-1]=1
  else:
    if l[a-1]==0:
      ll[a-1]+=1

for i in range(n):
  if l[i]==1:
    no_pen+=ll[a-1]
print(no_ac,no_pen)

Submission status: Wrong Answer

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

l=[0]*n
no_ac=0
no_pen=0

for i in range(m):
  a,b=map(str,input().split())
  a=int(a)
  if b=='AC':
    if l[a-1]==0:      
      no_ac+=1
    l[a-1]=1
  else:
    if l[a-1]==0:
      no_pen+=1
print(no_ac,no_pen)

Submission status: Wrong Answer

Solution code:
N,M = (int(x) for x in input().split())
Problem = [False]*N
WACount = [0]*N

for T in range(0,M):
    p,s = input().split()
    p = int(p)
    if (not Problem[p-1]) and s=='AC':
        Problem[p-1] = True
    elif (not Problem[p-1]) and s=='WA':
        WACount[p-1] += 1
print('{} {}'.format(sum(Problem),sum(WACount)))

Submission status: Wrong Answer

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

accurate=[False]*n

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

ac_count=accurate.count(True)
print(ac_count, wa_count)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
acCheck = [False] * (N + 1)
waCnt = 0
acCnt = 0
for i in range(M):
    query = list(input().split())
    ok = acCheck[int(query[0])]
    if ok:
        continue
    if query[1] == "AC":
        acCheck[int(query[0])] = True
        acCnt += 1
    else:
        waCnt += 1
print(str(acCnt), str(waCnt))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
penalty = {key: 0 for key in range(N)}
accept = {key: 0 for key in range(N)}
ac = 0
wa = 0

for i in range(M):
    tmp = list(input().split())
    if tmp[1] == 'WA':
        if accept[int(tmp[0])-1] == 0:
            penalty[int(tmp[0])-1] += 1
            wa += 1
    else:
        if accept[int(tmp[0])-1] != 1:
            accept[int(tmp[0])-1] = 1
            ac += 1

print(ac, wa)

Submission status: Wrong Answer

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

print(ans[0],ans[1])

Submission status: Wrong Answer

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

for m in range(M):
    p,s = input().split()
    p=int(p)
    
    #対象の問題：pがAC済か判定
    if AC_list[p-1]==1:
        continue
    else:
        if s=='AC':
            AC_list[p-1]=1
        else:
            ans_list[p-1]=ans_list[p-1]+1
    
AC_list_=[]
for n in range(N):
    AC_list_.append(AC_list[n]*ans_list[n])
    
print(sum(AC_list_),sum(ans_list))

Submission status: Wrong Answer

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

for m in range(M):
    p,s = input().split()
    p=int(p)
    
    #対象の問題：pがAC済か判定
    if AC_list[p-1]==1:
        continue
    else:
        if s=='AC':
            AC_list[p-1]=1
        else:
            ans_list[p-1]=ans_list[p-1]+1
            
print(sum(AC_list),sum(ans_list))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n , m = map(int,input().split())
if m == 0:
    print(0,0)
    exit()
ps = [0] * m
ss = [0] * m
for i in range(m):
    p,s = map(str,input().split())
    ps[i],ss[i] = int(p),s

ac = [0] * (n + 1)
wa = [0] * (n + 1)

for i in range(m):
    if ac[ps[i]] == 1:
        continue
    if ss[i] == 'AC':
        ac[ps[i]] = 1
    else:
        wa[ps[i]] += 1

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

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

Submission status: Wrong Answer

Solution code:
n , m = map(int,input().split())
if m == 0:
    print(0,0)
    exit()
ps = [0] * (m)
ss = [0] * (m)
for i in range(m):
    p,s = map(str,input().split())
    ps[i],ss[i] = int(p),s

ac = [0] * (n + 1 )
wa = [0] * (n + 1 )

for i in range(m):
    if ac[ps[i]] == 1:
        continue
    if ss[i] == 'AC':
        ac[ps[i]] = 1
    else:
        wa[ps[i]] += 1

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

Submission status: Wrong Answer

Solution code:
n , m = map(int,input().split())
if m == 0:
    print(0,0)
    exit()
ps = [0] * (m)
ss = [0] * (m)
for i in range(m):
    p,s = map(str,input().split())
    ps[i],ss[i] = int(p),s

ac = [0] * (max(ps) + 1 )
wa = [0] * (max(ps) + 1 )

for i in range(m):
    if ac[ps[i]] == 1:
        continue
    if ss[i] == 'AC':
        ac[ps[i]] = 1
    else:
        wa[ps[i]] += 1

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

Submission status: Wrong Answer

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

ac = [0] * (max(ps) + 1 )
wa = [0] * (max(ps) + 1 )

for i in range(m):
    if ac[ps[i]] == 1:
        continue
    if ss[i] == 'AC':
        ac[ps[i]] = 1
    else:
        wa[ps[i]] += 1

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

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
wa = 0
ac = 0
L = []
for i in range(m):
    a,b = map(str,input().split())
    L.append((int(a),b))


for i in range(n):
    li = []
    for j in range(m):
        if L[j][0] == i+1:
            li.append(L[j][1])

    for p in range(len(li)):
        if li[p] == "WA":
            wa +=1
        elif li[p] == "AC":
            ac +=1
            break
print(ac,wa)