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())
seikai = 0
matigai = 0
list = []
oklist = []
for i in range(m):
    a,b=input().split()
    list.append((int(a), b))
    
for i in range(m):
    if len(oklist) == n:
        break
    if list[i][1] == "WA" and list[i][0] not in oklist:
        matigai += 1
    elif list[i][1] == "AC" and list[i][0] not in oklist:
        seikai += 1
        oklist.append(list[i][0])
            
print(str(seikai)+" "+str(matigai))

Submission status: Wrong Answer

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

wa = 0
ac_number = []
for i in range(M):
  p, s = input().split()
  if s == "AC" and not p in ac_number:
    ac_number.append(p)
  elif s == "WA" and not p in ac_number:
      wa += 1

print(len(ac_number), wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
# P = np.array([0]*N)
P = [input().split() for _ in range(M)]
X = [0] * N
ac = 0
wa = 0
# print(P)
for pi in P:
    # li = input().split()
    if X[int(pi[0])-1] == 0:
        if pi[1] == 'WA':
            wa += 1
        else:
            ac += 1
            X[int(pi[0])-1] = 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:

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

ac = 0
wa = 0


AcFlag = False
if M > 0:
    p, S = input().split()
    check = int(p)

    if AcFlag == False and S == 'AC':
        # print("ok")
        ac += 1
        AcFlag = True
    elif AcFlag == False and S == 'WA':
        wa += 1


for i in range(1,M):
    p, S = input().split()
    # print("---")
    # print(check)
    # print(p)
    # print("---")
    if check != int(p):
        # print("change")
        AcFlag = False
        check = int(p)

    if AcFlag == False and S == 'AC':
        # print("ok")
        ac += 1
        AcFlag = True

    elif AcFlag == False and S == 'WA':
        wa += 1


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

    # if AcFlag == False and S == 'AC':
    #     ac += 1
    #     AcFlag = True
    # else AcFlag == False and S == 'WA':
    #     wa += 1

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

Submission status: Wrong Answer

Solution code:


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

subms = [input().split(" ") for i in range(M)]

setto = {k:False for k in range(1,N+1)}
penalties = 0 
correct = 0 
for sub in subms:
    sub[0] = int(sub[0])
    if setto[sub[0]] == False:
        if sub[1] == "WA":
            penalties += 1
        else:
            correct += 1
            setto[sub[0]] = True

print(correct, penalties)

Submission status: Wrong Answer

Solution code:
N, M = [int(x) for x in input().split(" ")]
P = []
correct = 0
penalty = 0
for x in range(M):
    temp = [x for x in input().split(" ")]
    if temp[1] == "AC" and temp not in P:
        correct += 1
    elif temp[1] == "WA" and [temp[0], "AC"] not in P:
        penalty += 1
        continue
    else:
        continue
    P.append(temp)

print(correct, end=" ")
print(penalty)

Submission status: Wrong Answer

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

AC =0
WA =0
AClist= []
for l in reversed(L):
    if l[1] == 'AC' and l[0] not in AClist:
        AClist.append(l[0])
        AC += 1
    if l[1] == 'WA' and l[0] in AClist:
        WA += 1
print(str(AC)+ ' '+str(WA))

Submission status: Wrong Answer

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

tasks = [] # [0]がAC、[1]がWA数
for i in range(n):
    tasks.append([0, 0])

sub = []
for i in range(m):
    i, j = map(str, input().split())
    i = int(i)
    sub.append([i, j])


penal = 0
ac = 0
for p, s in sub:
    if tasks[p-1][0] == 1:
        continue
    else:
        if s == "AC":
            ac += 1
            tasks[p-1][0] = 1
        else:
            penal += 1

for b, q in tasks:
    if b:
        penal += q

print(ac, penal)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = [0] * M
S = [""] * M
for i in range(M):
    p[i], S[i] = map(str, input().split())
    p[i] = int(p[i]) - 1

A = [0] * N
Pen = [0] * N
for i, j in zip(p, S):
    if j == "WA" and A[i] == 0:
        Pen[i] = 1
    elif j == "WA" and A[i] == 1:
        continue
    elif j == "AC":
        A[i] = 1
print(sum(A), sum(Pen))

Submission status: Wrong Answer

Solution code:
import sys

N, M = map(int, sys.stdin.readline().split())
P = [None]*M
S = [None]*M
for i in range(M):
    string = sys.stdin.readline().split()
    P[i] = int(string[0])
    S[i] = string[1]


ac = [0]*N
AC = 0
WA = 0
for i in range(M):
    if S[i] == "AC":
        ac[P[i]-1] += 1
        for j in range(i):
            if P[j] == P[i] and S[j] == "WA":
                WA += 1

for i in range(N):
    if ac[i] > 0:
        AC += 1
print(AC, WA)

Submission status: Wrong Answer

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

if M > 0:
    wa = [0] * (N+1)
    ac = set()
    for s in S:
        if s[1] == "AC":
            ac.add(int(s[0]))
        elif s[1] == "WA" and int(s[0]) not in ac:
            wa[int(s[0])] += 1
    print(len(ac), sum(wa))
else:
    print(0, 0)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ac_count = 0
penalty_count = 0
ac_number_list = list()

for i in range(1, M + 1):
    temp_number, temp_result = map(str, input().split())
    if temp_result == 'AC' :
        if temp_number in ac_number_list :
            pass
        else :
            ac_count += 1
            ac_number_list.append(temp_number)
    else :
        if temp_number in ac_number_list :
            pass
        else :
            penalty_count += 1    

print('{} {}'.format(ac_count, penalty_count))

Submission status: Wrong Answer

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

def f(s):
  lst = s.split()
  return int(lst[0]),lst[1]



for i in range(M):
  p, s = f(input())
  P.append(p)
  S.append(s)

correct = 0
penalty = 0
q = []

for i, j in enumerate(S):
  if 'AC' in j:
    if P[i] not in q:
      q.append(P[i])
      correct += 1
  if 'WA' in j:
    if P[i] not in q:
      penalty += 1

print(correct, penalty)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
pS = []
pS_dict = {i:[] for i in range(10**5)}
shutugen = set()
for i in range(M):
    tmp = input().split()
    if tmp[1] == "AC":
        pS_dict[int(tmp[0])].append(1)
    else:
        pS_dict[int(tmp[0])].append(0)
    shutugen.add(int(tmp[0]))
    
seitou = 0
penaru = 0
for i in shutugen:
    set_i = pS_dict[i]
    for s in set_i:
        if s == 0:
            penaru += 1
        else:
            seitou += 1
            break
print(seitou, penaru)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=[]
wa=0


for i in range(m):
    c=list(input().split())
    res=str(c[0]+c[1])
    if c[1]=="AC":
        ac.append(res)
    elif str(c[0]+"AC") not in ac:
        wa+=1
    #else
    
    
ac2=set(ac)    
#print(ac2)
print(len(ac2), end=" ")
print(wa)

Submission status: Wrong Answer

Solution code:
n,m = (int(i) for i in input().split())

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

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

for v in score.values():
    if not "AC" in v: wa += len(v)
    else:
        wa += len(v[:v.index("AC")])
        ac += 1

print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=[0]*n
p=0
s=0
for i in range(m):
  li=input().split()
  if li[1]=='AC' and l[int(li[0])-1]==0:
    l[int(li[0])-1]=1
    s+=1
  if li[1]=='WA' and l[int(li[0])-1]==0:
    p+=1
print('%d %d' % (s,p))

Submission status: Wrong Answer

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

c_l = list()
a = 0
w = 0

for i in range(M):
  p,s = input().split()
  p = int(p)
  if p not in c_l:
    if s == "AC":
      a += 1
      c_l.append(p)
    else:
      w += 1
print("{} {}".format(a,w))

Submission status: Wrong Answer

Solution code:
N, M =[int(n) for n in input().split()]
p = {}
s = {}
for i in range(M):
    P, S = input().split()
    if S=='WA' and P not in p:
        c = s.setdefault(P, 0)
        c += 1
        s[P] = c
    else:
        if p.setdefault(P, 0):
            break
        else:
            p[P] = 1
print(sum(p.values()), sum(s.values()))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
a = 0
b = 0
sp = dict()
correct = []
wrong = dict()
for _ in range(M):
    s, p = input().split()
    if not s in sp.keys():
        if p == "AC":
            a +=1
            correct.append(s)
        else:
            wrong[s] = 1
        sp[s] = p
    else:
        if sp[s] == "AC":
            continue
        else:
            if p == "AC":
                a += 1
                correct.append(s)
            else:
                wrong[s] = 1
            sp[s] = p
for w, wn in wrong.items():
    if w in correct:
      b+=wn
      
print(a, b)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
Alist = [[]]*M
for i in range(M):
  Alist[i] = list(map(str, input().split()))
collect = [False]*N
NP = 0
NAC = 0
for j in range(M):
  if Alist[j][1] == 'WA':
    NP += 1
  elif collect[int(Alist[j][0])-1] == False and Alist[j][1] == 'AC':
    NAC += 1
    collect[int(Alist[j][0])-1] = True
print(collect)
print(NAC, " ", NP)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=[list(input().split()) for i in range(m)]
from collections import defaultdict
cnt_ac=defaultdict(lambda:0)

count_wa=0
count_ac=0
for i in range(m):
    if cnt_ac[l[i][0]]==0:
        
        if l[i][1]=='WA':
            count_wa+=1
        
        elif l[i][1]=='AC':
            cnt_ac[l[i][0]]=1
            count_ac+=1
        
print(count_ac,count_wa)

Submission status: Wrong Answer

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

S=[[] for _ in range(N)]
done=[]
for i in range(M):
    p,s=input().split()
    p=int(p)
    if  not p in done:
        S[p-1].append(s)
        if s=="AC":
            done.append(p)
            
countA,countB=0,0
for i in range(N):
    countA+=S[i].count("AC")
    countB+=S[i].count("WA")
print(countA,countB)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
abc = {"AC":[],"WA":[]}
for i in range(m):
    p,s = map(str, input().split())
    if p not in abc["AC"]:
        abc.setdefault(s, []).append(p)
ac_len = len(set(abc["AC"]))
wa_len = len(abc["WA"])
print(ac_len, wa_len)

Submission status: Wrong Answer

Solution code:
N,M = list(map(int,input().split(" ")))
dic = {}
Acount = 0
Wcount = 0
for i in range(M):
    x1,y1=[i for i in input().split(" ")]
    if x1 in dic:
        if dic[x1] == "WA" and y1 == "AC":
            Acount += 1
            Wcount += 1
            dic[x1] = y1
    else:
        if y1 == "AC":
            Acount += 1
            dic[x1] = y1
        else:
            dic[x1] = y1
print(Acount,Wcount)

Submission status: Wrong Answer

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

if m == 0:
  print('0 0')
else:
  outputs = [input().split(' ') for i in range(m)]

  problem_ac = []  # ACになった問題番号のリスト
  problem_wa = {}  # 問題番号:WAの数
  # 逆順にして、各問題に関して、最後にACになったもの以降のWAの数がWAのカウント対象。
  for o in reversed(outputs):
    num = o[0]
    result = o[1]
    if result == 'AC':
      if num not in problem_ac:
        problem_ac.append(num)
    else:
      if num in problem_ac:
        problem_wa[num] = problem_wa[num] + 1 if num in problem_wa.keys() else 1
  # print('{} {}'.format(str(problem_ac), str(problem_wa)))
  ac_count = len(problem_ac)
  wa_count = sum(problem_wa.values()) if len(problem_wa) > 0 else 0
  print('{} {}'.format(ac_count, wa_count))

Submission status: Wrong Answer

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

n, m = [int(i) for i in input().split()]

submits = [0] * m
for i in range(m):
    p, s = input().split()
    submits[i] = (int(p), s.strip())

answer = [0] * (n+1)
for i in range(n):
    answer[i+1] = {'AC':0, 'WA':0}

for submit in submits:
    p, s = submit[0], submit[1]
    if s == 'WA' and answer[p]['AC'] == 0:
        answer[p]['WA'] += 1
        continue
    if s == 'AC':
        answer[p]['AC'] = 1
        continue

ac_num = 0
wa_num = 0
for a in answer[1:]:
    ac_num += a['AC']
    wa_num += a['WA']
print(ac_num, wa_num)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


def LI(): return list(map(int, input().split()))


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(list, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x == x]


def sosu(x):
    for i in range(2, int(sqrt(x)+1)):
        if x % i == 0:
            return False
    return True


mod = 1000000007
inf = float('INF')


def A():
    A = 'abcdefghijklmnopqrstuvwxyz'
    C = input().rstrip()
    p = 0
    for i in A:
        if C == i:
            p = 1
            continue
        if p == 1:
            print(i)
            return

    return

# B


def B():
    N,K,M = LI()
    A = LI()
    ans=M*N- sum(A)
    if ans>K:
        print(-1)
    elif ans<0:
        print(0)
    else:
        print(ans)


    return

# C


def true():
    S = input()
    S = S[:-1]

    tmp = 0
    for x in range(1 << (len(S)-1)):
        func = S[-1]
        for i in range(len(S)-1):
            if(x & (1 << i)):
                tmp += int(func)
                func = S[-2-i]
            else:
                func = S[-2-i]+func
        tmp += int(func)
    print(tmp)

    return


def C():
    N, M = LI()
    P=[]
    S=[]
    count=set([])
    ans=[0]*1000000
    realans=0
    for i in range(M):
        p,s=input().split()
        p=int(p)
        if s=='AC':
            realans+=ans[p]
            count.add(p)
            ans[p]=0
        if s=='WA':
            
            ans[p]+=1
  


    
    print(len(count),realans)
    

        


        

# D


def D():

    a, b, x = LI()
    BIG = a*a*b/2
    if x > BIG:
        y = 2*b-(2*x/a/a)
        print(math.degrees(math.atan(y/a)))
    else:
        y = 2*x/a/b
        print(math.degrees(math.atan(b/y)))
    return

# E


def E():
    N, K = LI()
    A = LI()
    F = LI()
    A.sort(reverse=True)
    F.sort()
    cost = []
    for i in range(len(N)):
        cost.append(A[i]*F[i])

    a = F[cost.index(max(cost))]

    return

# F


def F():
    N, M = LI()

    value = [0] * M
    power = [0] * M
    for i in range(M):
        a, b = LI()
        value[i] = a
        c = LI()
        L = ['0'] * N
        for k in c:
            L[k - 1] = '1'
        bint = ''.join(L)
        power[i] = int(bint, 2)
    bint = ''.join(list(['1'] * N))
    dp = [inf] * (int(bint, 2)+1)
    t = 0
    cost = 0

    dp[0] = 0
    for s in range(int(bint, 2) + 1):
        for i in range(M):
            t = s | power[i]
            cost = dp[s] + value[i]
            dp[t] = min(dp[t], cost)
    print(-1) if(dp[-1] == inf) else print(dp[-1])

    return

    # you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")


def solution(S):
    # write your code in Python 3.6
    N = len(S)

    pass


# Solve
if __name__ == '__main__':

    C()

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
q = []
j = 1

seitou = 0
pena = 0

for i in range(M):
    p, s = input().split()
    if q.count(p) == 0:
        if s == "AC":
            q.append(p)
            seitou += 1
        if s == "WA":
            pena += 1
else:
    print(seitou, pena)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
q = ["WA" for i in range(N)]
wa = 0
ac = 0
for i in range(M):
    p,s = map(str,input().split())
    if s == "WA" and q[int(p)-1] == "WA":
        wa+=1
    elif s == "AC" and q[int(p)-1] == "WA":
        q[int(p)-1] = "AC"
        #ac+=1
ac = q.count("AC")
print(ac,wa)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":

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

    accepted = [False] * N
    penalties = [0] * N
    for _ in range(M):
        p, S = input().split()
        p = int(p)
        # S = 'AC' or 'WA'
        if S == "AC":
            accepted[p - 1] = True
        if S == "WA" and not accepted[p - 1]:
            penalties[p - 1] += 1

    N_accepted = len([a for a in accepted if a])
    print(N_accepted, sum(penalties))

Submission status: Wrong Answer

Solution code:
import numpy as np
N,M=map(int,input().split())
string_list=[input() for i in range(M)]
checkAC=np.zeros((N,2),np.int16)
for i in string_list:
    Ni,Si = i.split()
    Ni = int(Ni)-1
    if checkAC[Ni,0]==0:
        if Si=='AC':
            checkAC[Ni,0]=1
        else:
            checkAC[Ni,1]+=1
strlist = checkAC.sum(axis=0)
print(str(strlist[0])+' '+str(strlist[1]))

Submission status: Wrong Answer

Solution code:
# coding:utf-8

import sys
import math
import time
import numpy as np
import collections


NM = str(raw_input()).split()
N = int(NM[0])
M = int(NM[1])
A = []
B= []
C = [0]*100100
D = [0]*100100

poi1 = 100100
poi2 = 100100


for i in xrange(M):
  temp = str(raw_input()).split()
  A.append(int(temp[0]))
  B.append(temp[1])

for i in xrange(M):
  if(B[i] == "AC"):
    C[A[i]] += 1
  else:
    D[A[i]] += 1

c = collections.Counter(C)
d = collections.Counter(D)

poi1 -= c[0]
poi2 -= d[0]


print (str(poi1)+ " " + str(poi2));

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
pi = []
Si = []
for i in range(M):
    p, S = map(str,input().split())
    pi.append(p)
    Si.append(S)
score = 0
penalty = 0
AC_flag = True
WA_flag = True
now_num = 1
for i in range(M):
    if now_num != int(pi[i]):
        now_num = int(pi[i])
        AC_flag = True
        WA_flag = True
    if Si[i] == 'AC' and AC_flag:
        score += 1
        AC_flag = False
        WA_flag = False
    elif WA_flag:
        penalty += 1
print(str(score) + ' ' + str(penalty))

Submission status: Wrong Answer

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

ok = [False for _ in range(n)]
ok_num = 0
wrong = 0
for _ in range(m):
    p, s = input().split(" ")
    if ok[int(p) - 1]:
        pass
    else:
        if s == "AC":
            ok[int(p) - 1] = True
            ok_num += 1
        else:
            wrong += 1

print(ok_num, wrong)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
dp = [0]*(100010)
qp = [0]*(100010)
for i in range(b):
    ta,tb = map(str,input().split())
    ta = int(ta)
    if tb == 'WA' and qp[ta] == 0 :dp[ta]+=1
    elif tb == 'AC' and qp[ta] == 0 :qp[ta]=1
print(sum(qp),sum(dp))

Submission status: Wrong Answer

Solution code:
[n,m] = [int(x) for x in input().split()]
ok=[]
c_ok=0
c_ng=0
for i in reversed(range(m)):
	[p,s]=[x for x in input().split()]
	if (p in ok)==False:
		if s=="AC":
			c_ok+=1
			ok.append((p))
		else:
			c_ng+=1

print(int(c_ok),int(c_ng))

Submission status: Wrong Answer

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

for i in range(m):
    a, b = input().split()
    a = int(a) - 1
    l[a].append(b)


ac = 0
wa = 0

for i in range(n):
    for j in range(len(l[i])):
        if l[i][j] == 'AC':
            ac += 1
            break
        else:
            wa += 1

print(ac, wa)

Submission status: Wrong Answer

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


li = []

for i in range(m):
    p,q = map(str, input().split())
    li.append((int(p),q))

wa = 0

se = {i for i in li if i[1]=='AC'}
ac = len(se)

flag = True
for i in range(m-1):
    if li[i][0]!=li[i+1][0]:
        flag = True
    elif li[i][0]==li[i+1][0] and li[i][1]=='AC':
        flag = False
    elif li[i][0]==li[i+1][0] and li[i][1]=='WA' and flag:
        wa += 1

print(ac, wa)

Submission status: Wrong Answer

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

wa = 0
ac = 0

dic = {}
for q, a in results:
    if q not in dic.keys():
        dic[q] = {"ac": False, "wa": 0}
    if dic[q]["ac"] is False and a == "WA":
        wa += 1
    elif dic[q]["ac"] is False and a == "AC":
        ac += 1
        dic[q]["ac"] = True
    elif dic[q]["ac"] is True:
        pass

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
nset=set()
acount=0
pcount=0
for i in range(m):
    s,p=map(str,input().split())
    if int(s) not in nset:
        if p=="WA":
            pcount+=1
        elif p=="AC":
            nset.add(int(s))
            acount+=1
print(acount,pcount)

Submission status: Wrong Answer

Solution code:
N,M = list(map(int,input().split()))
AC_list = [0] * N
WA_count = 0
AC_count = 0
for i in range(M):
    A = list(input().split())
    if AC_list[int(A[0])-1] == 1:
        continue
    else:
        if A[1] == "AC":
            AC_count += 1
            AC_list[int(A[0])-1] = 1
        else:
            WA_count += 1
print(AC_count,WA_count)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
li = []
for m in range(M):
  li.append(input().split())

ac = 0
wa = 0

for n in range(N + 1):
  if n == 0:
    continue

  for index, i in enumerate(li):
    if int(i[0]) == n and i[1] == 'WA':
      wa += 1
    if int(i[0]) == n and i[1] == 'AC':
      ac += 1
      break

print('{0} {1}'.format(ac, wa))

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
p = []
s = []
wacounter = 0
point = 0
point_to_num = [] #acをとった問題
for i in range(0, m):
  list = input().split()
  p.append(int(list[0]))
  s.append(list[1])
 
for i in range(0, m):
  if s[i] == "AC" and not p[i] in point_to_num: #もし正解で、今までにその問題に正解していなかったら
    point_to_num.append(p[i]) #正解リストにその問題を追加
    #point = point + 1 正解ポイントをあげる
  else: #不正解だったら
    if s[i] == "WA" and not p[i] in point_to_num: #今まで正解を出したことがない
      wacounter += 1
#print(point_to_num)
print(len(point_to_num), wacounter)

Submission status: Wrong Answer

Solution code:
import sys

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

L = []

d = {}

for _ in range(M):
    P,S = input().split()
    P = int(P)
    L.append([P,S])

for i in range(M):
    p,s = L[i]
    if p in d:
        if s=="AC" and d[p]["AC"]==0:
            d[p]["AC"] = 1
        elif s=="WA" and d[p]["AC"]==0:
            d[p]["WA"] = d[p]["WA"] + 1
    else:
        d[p] = {}
        d[p]["AC"] = 0
        d[p]["WA"] = 0
        if s=="AC":
            d[p]["AC"] = 1
        else:
            d[p]["WA"] = 1

ac_count = 0
wa_count = 0

for i in range(1,N+1,1):
    if not (i in d):
        continue    
    ac_count = ac_count + d[i]["AC"]
    if ac_count!=0:
        wa_count = wa_count + d[i]["WA"]

print(ac_count, wa_count)

Submission status: Wrong Answer

Solution code:

a,b = map(int,input().split())
dp = [0]*(100010)
qp = [0]*(100010)
for i in range(b):
    ta,tb = map(str,input().split())
    ta = int(ta)
    if tb == 'WA' and qp[ta] == 0 :dp[ta]+=1
    elif tb == 'AC' and qp[ta] == 0 :qp[ta]==1
print(sum(qp),sum(dp))

Submission status: Wrong Answer

Solution code:
"""
flag がTrueのときAC済み。falseのときWAのみ
flag == Falseかつ


"""

n, m = map(int, input().split())
ps = []
for i in range(m):
    p, s = input().split()
    ps.append([int(p), s])
flag = [False for _ in range(n)]
ac = 0
wa = 0
i = 0

while i < m :
    p = ps[i][0]
    s = ps[i][1]
    if s == "WA" and flag[p - 1] == False:
        wa += 1
    elif s == "AC" and flag[p - 1] == False:
        ac += 1
        flag[p - 1] = True
    i += 1

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

Submission status: Wrong Answer

Solution code:
import numpy as np
def LI():
  return [int(s) for s in input().split()]

correct_answers = []
warning_count = 0
import numpy
N,M = LI()

correct_answers = np.zeros(N,dtype = 'int')

for i in range(M):
  p_num, answer = [s for s in input().split()]
  p_num = int(p_num)
  include_answers = True if correct_answers[p_num-1] == 1 else False
  
  if answer == 'AC' and not include_answers:
    correct_answers[p_num-1] = 1
  elif answer == 'WA' and not include_answers:
    warning_count+=1
    
print(sum(correct_answers),warning_count)

Submission status: Wrong Answer

Solution code:
import math
n,m = map(int,input().split())
p_s = [input().split() for i in range(m)]
dic = {}
penalty = 0
acc = 0
num_list=[]
for i in range(m):
  num = int(p_s[i][0])
  if p_s[i][1] == "WA":
    if num in dic:
      dic[num]+=1
    else:
      dic[num]=1
  else:
    if num not in num_list:
      num_list.append(num)
      acc += 1
    if num in dic:
      penalty += dic[num]

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

Submission status: Wrong Answer

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

count_ac = 0
count_wa = 0
flag_ac = [False]*n
for i in l:
    if not flag_ac[int(i[0])-1]:
        if i[1] == "AC":
            count_ac += 1
            flag_ac[int(i[0])-1] = True 
        elif i[1] == "WA":
            count_wa += 1

print(count_ac, count_wa)

Submission status: Wrong Answer

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

for i in range(M):
	S = list(input().split())
	# print(S)
	num = int(S[0])
	res = S[1]
	if res == "AC":
		seitou[num - 1] = 1
	else:
		if seitou[num - 1] == 0:
			penalty[num - 1] += 1
			
# print(*seitou)
# print(*penalty)
print(sum(seitou), end=" ")
print(sum(penalty))

Submission status: Wrong Answer

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

r = ['WA']*(N+1)
o = []
c = 0
ac_c = 0
p_c =0

for i in range(M):
    ps = input().split()
    index = int(ps[0])
    if ps[1] == 'WA':
        if r[index] == 'WA':
            c+=1

    else: # AC
        if r[index] == 'WA':
            r[index] = 'AC'
            p_c += c
            ac_c+=1
        else:
            pass
        c=0

print(ac_c, p_c)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
p=[];s=[]
if m==0:
    print(0,0)
    exit()
for i in range(m):
    x,y=input().split()
    p.append(int(x))
    s.append(y)
ac=0
wa=0
t=[0]*(n+1)
for i in range(m):
    if t[p[i]]>=1:
        continue
    elif s[i]=="WA":
        wa+=1
    elif s[i]=="AC":
        t[p[i]]+=1
        ac+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
res = 0
for i in range(0,M):
  p, S = map(str, input().split())
  pp = int(p)
  if(pp <= N):
      if(S == 'AC'):
          res=res+1
      else:
          res=res+0
  else:
      break
print(res)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ans = 0
pena = 0
clear = ['']
for i in range(M):
    s = input().split()
    if s[0] not in clear:
        if s[1] == 'AC':
            ans += 1
            clear.append(str(s[0]))
        else:
            pena += 1
print('{} {}'.format(ans, pena))

Submission status: Wrong Answer

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

ok = 0
ng = 0
ng_tmp = 0
ok_l = []

for i in range(m):
  tmp = input().split()
  p = int(tmp[0])
  s = tmp[1]
  if ok_l.count(p) == 0:
    if s == 'AC':
      ok_l.append(p)
      ok += 1
      ng += ng_tmp
      ng_tmp = 0
    if s == 'WA':
      ng_tmp += 1
  
print(ok, ng)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac,wa=0,0
aced=0
l=[0 for _ in range(m)]
for i in range(m):
  p,s=input().split()
  p=int(p)
  l[i]=[p,s]
l.sort(key=lambda x: x[0])
#print(l)
for i in range(m):
  s=l[i][1]
  q=l[i][0]
  if aced!=q:
    if s=='AC':
      ac+=1
      aced=q
    else:
      wa+=1

  #print(ac,wa,aced)

  
  

print(ac,wa)

Submission status: Wrong Answer

Solution code:
s=list(map(int,input().split()))
AC=[]
WA=0
for b in range(s[1]):
  t=input().split()
  if t[0] not in AC:
    if t[1]=="AC":
      AC.append(t[0])
    else:
      WA+=1
print(str(len(AC))+" "+str(WA))

Submission status: Wrong Answer

Solution code:
hist = []
nm = list(map(int, input().split()))
for i in range(nm[1]):
    a,b=input().split()
    hist.append((int(a), b))

ac = [0] * nm[0]
wa = [0] * nm[0]

for i in range(nm[1]):
    if hist[i][1] == "AC":
        if ac[hist[i][0]-1] != 1:
            ac[hist[i][0]-1] = 1
    elif hist[i][1] == "WA":
        if ac[hist[i][0]-1] != 1:
            wa[hist[i][0]-1] = wa[hist[i][0]-1] + 1

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
import sys
input = sys.stdin.readline

m = defaultdict(int)
ac = {}


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

ans = 0
for _ in range(M):
    p, s = input().split()
    p = int(p)
    s = s.strip()
    if s == "AC":
        if p not in ac:
            ans += 1
        ac[p] = 1

    else:
        if p not in ac:
            m[p] += 1


print(str(ans) + " " + str(sum(m.values())))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p_L,s_L = [],[]
dic = {}
for i in range(10**5+1):
    dic[str(i)] = "0"
ac_dic = {}
wa_dic = {}
wa_L = []
wa_c = 0
counter = 0
for i in range(m):
    p,s = map(str,input().split())
    if s =="AC":
        dic[p] = "AC"
        ac_dic[p] = "AC"

    if dic[p] == "0":
        counter = 0
    if s == "WA" and dic[p] == "0":
        wa_L.append(1)
        dic[p] = "WA"
        wa_c += 1



print(len(ac_dic),wa_c)