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:
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    seito = 0
    pena = 0

    AC = [False] * (N+1)
    WA = [0]*(N+1)
    for pp, ss in zip(p, S):
        if ss == "AC":
            if AC[pp] == False:
                AC[pp] = True
        else:
            if AC[pp] == False:
                WA[pp] += 1
    print(sum(AC), sum(WA))

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=0
wa=0
ac_problem=[]
for i in range(m):
    p,s=map(str,input().split())
    p=int(p)
    if ac_problem.count(p)>=1 and s=='AC':
        ac_problem.append(p)
        ac+=1
    elif ac_problem.count(p)>=1 and s=='WA':
        wa+=1
print(ac,wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a = []
AC_count = 0
WA_count = 0
for i in range(m):
    if ps[i][0] not in a:
        if ps[i][1] == 'AC':
            AC_count += 1
            a.append(ps[i][0])
        else:
            WA_count += 1
print(AC_count, WA_count)

Submission status: Wrong Answer

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

count = {}
for _ in range(m):
    p,s = input().split()
    if p not in count:
        count[p] = [0,0]
    if s == 'AC':
        count[p][0] = 1
    elif s == 'WA' and count[p][0] == 0:
        count[p][1] += 1

ac,pena = 0,0
for a,w in count.values():
    ac += a
    pena += w
print(ac, pena)

Submission status: Wrong Answer

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

n,m=map(int,input().split())
a=[list(input().split()) for i in range(m)]
a=sorted(a, key=lambda x: x[0])
ac=0
wa=0
if m==0:
    print(0,0)
    exit()
now=a[0][0]
my_bool=True
for i in range(m):
    if now!=a[i][0]:
        now=a[i][0]
        my_bool=True
    if not my_bool:
        continue
    if a[i][1]=="AC":
        ac+=1
        my_bool=False
    else:
        wa+=1
print(ac,wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline

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

WA = [0] * (N + 1)
AC = [False] * (N + 1)
for _ in range(M):
    p, S = readline().split()
    p = int(p)
    if S == 'AC':
        AC[p] = True
    else:
        if not AC[p]:
            WA[p] += 1

print(sum(AC), sum(WA))

Submission status: Wrong Answer

Solution code:
import sys
#import numpy as np

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N, M = rl()
solve = [False] * (N+1)
count = 0
for i in range(M):
    p, s = input().split()
    p = int(p)
    if solve[p]:
        continue
    if s == 'WA':
        count += 1
    else:
        solve[p] = True

print(sum(solve), count)

Submission status: Wrong Answer

Solution code:
import numpy as np
N, M = map(int, input().split())

succ = [0] * N
fail = [0] * N

for i in range(M):
    p, S = input().split()
    p = int(p) - 1

    if S == 'AC':
        succ[p] = 1
    else:
        if succ[p] == 0:
            fail[p] += 1


succ = np.array(succ)
fail = np.array(fail)

print(succ.sum(), fail.sum())

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
a = [False] * (n+1)

ac = 0
wa = 0
for i in range(m):
  p,s = input().split()
  p = int(p)
  
  if (not a[p]) and s == "WA":
    wa += 1
  elif (not a[p]) and s == "AC":
    ac += 1
    a[p] = True
    
    
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ans = set()
WA = 0
for i in range(M):
    q, result = input().split()
    if result == "AC":
        ans.add(q)
    else:
        if not q in ans:
            WA += 1
print(len(ans), WA)

Submission status: Wrong Answer

Solution code:
N,M= map(int,input().split())
P = [0 for _ in range(N+1)]
S = [0 for _ in range(N+1)]
for i in range(M):
    p, s = input().split()
    if s == "WA" and S[int(p)] != 1:P[int(p)] += 1
    if s == "AC":S[int(p)] = 1
print(sum(S),sum(P))

Submission status: Wrong Answer

Solution code:
n, m = map(int, raw_input().split())
l = []
ac = set()
wa = {}
for i in range(m):
	a, b = raw_input().split()
	a = int(a)
	
	if a not in ac:
		if b == 'WA':
			if b in wa:
				wa[b] += 1
			else:
				wa[b] = 1
		else:
			ac.add(a)
ans = 0
for i in list(ac):
	if i in wa:
		ans += wa[i]
print len(ac), ans

Submission status: Wrong Answer

Solution code:
mon,sub=map(int,input().split())
sei,pen=0,0
l=[0 for i in range(mon)]#ACで1
for i in range(sub):
  n,re=input().split()
  n=int(n)
  if l[n-1]==1:continue
  if re=="WA":pen+=1
  else:
    l[n-1]=1
    sei+=1
print(sei,pen)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ac = [False for _ in range(N)]
n_ac, n_wa = 0, 0
for _ in range(M):
    p, s = input().split()
    p = int(p) - 1
    if not ac[p]:
        if s == 'WA':
            n_wa += 1
        else:
            n_ac += 1
            ac[p] = True
print(n_ac, n_wa)

Submission status: Wrong Answer

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

A = []
for  i in range(M):
    x = [x for x in input().split()]
    x[0] = int(x[0])
    A.append(x)

p = [0]*N
a = [False]*N

for i in range(M):
    t = A[i][0]-1
    if a[t]==True:
        pass
    else:
        if A[i][1] =='AC':
            a[t] = True
        else:
            p[t] += 1
print(sum(a), sum(p))

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)
    if s=="AC":
        AC[p-1]=1
    else:
        if AC[p-1]==0:
            WA[p-1]+=1

print(sum(AC),sum(WA))

Submission status: Wrong Answer

Solution code:
from sys import stdin
n,m = [int(x) for x in stdin.readline().rstrip().split()]

if m == 0:
    print(0,0)
    exit()

li = [list(stdin.readline().rstrip().split()) for _ in range(m)]
li.sort()

cor = 0
wor = 0
now = int(li[0][0])
for i in li:
    if int(i[0]) == now:
        if i[1] == "WA":
            wor += 1
        else:
            cor += 1
            now += 1
print(cor,wor)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n,m = map(int, input().split())
ps = [input().split() for _ in range(m)]

ac = 0
wa = 0
solve = [False for _ in range(n+1)]
for p,s in ps:
    p = int(p)
    if s=="AC":
        if not solve[p]:
            ac += 1
        solve[p] = True
    else:
        if not solve[p]:
            wa += 1

print(ac,wa)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N,M=map(int,input().split())

l=[0]*N

ans=[0,0]
for _ in range(M):
    num,judge=input().split()
    num=int(num)
    num-=1
    if l[num]==1:
        continue
    else:
        if judge=="AC":
            ans[0]+=1
            l[num]=1
        else:
            ans[1]+=1
    

print(*ans)

Submission status: Wrong Answer

Solution code:
N, M=map(int, input().split())
ps=[[0, 0] for i in range(M)]
ACnum=[0]*(N+1)
WAnum=[0]*(N+1)
for i in range(M):
  p, s=input().split()
  p=int(p)
  
  if ACnum[p]==0:
    if s=='AC':
      ACnum[p]=1
    else:
      WAnum[p]+=1

out=[sum(ACnum), sum(WAnum)]
print(*out)

Submission status: Wrong Answer

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]
n,m=map(int,input().split())
ps=[list(input().split()) for i in range(m)]
li=[0]*(n+1)
wa=0
ac=0
# print(ps)
for i in range(m):
    if li[int(ps[i][0])]==0:
        if ps[i][1]=="AC":
            if li[int(ps[i][0])]==0:
                ac+=1
            li[int(ps[i][0])]+=1
        else:
            wa+=1
    else:
        continue
print(ac)
print(wa)

Submission status: Wrong Answer

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

Q = [False] * N
ok = 0
ng = 0
for _ in range(M):
    p,S = map(str,input().split())
    p = int(p)
    if not Q[p-1]:
        if S == "AC":
            Q[p-1] = True
            ok += 1
        else:
            ng += 1
        continue
    else:
        continue

print(ok,ng)

Submission status: Wrong Answer

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

print(sum(ac),pn)

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N, M = LI()
    res = [[] for _ in range(N)]
    for _ in range(M):
        p, s = LS()
        p = int(p)
        p -= 1
        res[p].append(s)
    seito = 0
    pena = 0
    for re in res:
        for s in re:
            if s == 'AC':
                seito += 1
                break
            else:
                pena += 1
    print(seito, pena)

main()

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ps = sorted([input().split() for i in range(M)], key=lambda x: x[0])

ans = set()
wa = 0
for p, s in ps:
    if s == 'AC':
        ans.add(p)
    if s == 'WA' and p not in ans:
        wa += 1

print(len(ans), wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
problems = [False]*n
ans = 0
pen = 0
for i in range(m):
    a,b = input().split()
    a = int(a)-1
    if not problems[a]:
        if b[0] == 'A':
            problems[a] = True
            ans += 1
        else:
            pen += 1
print(ans,pen)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
l = [0 for i in range(N)]
cnt = 0
for i in range(M):
    p,s = map(str, input().split())
    p = int(p)-1
    if s == "AC":
        l[p] = 1
    else:
        if l[p] == 0:
            cnt += 1
print(sum(l), cnt)

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline
n,m=map(int,input().split())
ac=[0]*n
c=0
w=0
for _ in range(m):
    p,s=input().split()
    p=int(p)
    s=s.rstrip()
    if s=='AC':
        if ac[p-1]==0:
            c+=1
            ac[p-1]=1
        else:
            pass
    else:
        if ac[p-1]==0:
            w+=1
        else:
            pass
print(c,w)

Submission status: Wrong Answer

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

goal = [0] * (N + 1)
ans = [0, 0]

for i in range(M):
  p, s =  map(str, input().split())
  if goal[int(p)] == 0:
    if s == "AC":
      ans[0] += 1
      goal[int(p)] = 1
    else:
      ans[1] += 1
      
print(ans[0], ans[1])

Submission status: Wrong Answer

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

import sys
sys.setrecursionlimit(300000)


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    a = 0
    w = 0
    ac = [0] * (N + 1)
    wa = [0] * (N + 1)
    for i in range(M):
        if S[i] == 'WA' and not ac[p[i]]:
            w += 1
        if S[i] == 'AC' and not ac[p[i]]:
            ac[p[i]] = 1
            a += 1
            w += wa[p[i]]
    print(a, w)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
def I(): return int(sys.stdin.readline())
def LI(): return [int(x) for x in sys.stdin.readline().split()]

def main():
    N,M = LI()
    WA = [0] * N
    AC = [False] * N

    for i in range(M):
        P,S = input().split()
        p = int(P)-1
        if S == 'AC':
            AC[p] = True
        if not(AC[p]):
            WA[p] += 1
    print(sum(AC),sum(WA))




if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
f = [False]*N
ac = 0
wa = 0
for _ in range(M):
    p, s = list(input().split())
    p = int(p)
    if s == 'AC' and not f[p-1]:
        f[p-1] = True
        ac += 1
    elif not f[p-1]:
        wa += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]
n,m=map(int,input().split())
ps=[list(input().split()) for i in range(m)]
li=[0]*(n+1)
wa=0
ac=0
print(ps)
for i in range(m):
    if li[int(ps[i][0])]==0:
        if ps[i][1]=="AC":
            if li[int(ps[i][0])]==0:
                ac+=1
            li[int(ps[i][0])]+=1
        else:
            wa+=1
    else:
        continue
print(ac)
print(wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# coding: utf-8

from collections import Counter
def ri():
    return int(input())

def rl():
    return list(input().split())

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

def main():
    n, m = rli()
    wa = [0 for _ in range(n)]
    ac = [0 for _ in range(n)]
    for i in range(m):
        p, s = rl()
        p = int(p)
        p -= 1
        if ac[p] > 0:
            continue
        if s == "WA":
            wa[p] += 1
        else:
            ac[p] = 1
    print(sum(ac), sum(wa))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
inputs = sys.stdin.readlines()
n, m = map(int, inputs[0].split())
P, S = [], []
for s in inputs[1:]:
    x, y = s.split()
    P.append(int(x))
    S.append(y)

num_wa = 0
acs = [0]*n
for p, s in zip(P, S):
    if acs[p-1]:
        continue
    if s == 'WA':
        num_wa += 1
    else:
        acs[p-1] = 1
print(*[sum(acs), num_wa])

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac = 0
wa = 0
a = []
for _ in range(m):
    q, j = input().split()
    if not q in a:
        if j == 'AC':
            ac += 1
            a.append(q)
        else:
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
submits = [tuple(input().split()) for _ in range(M)]
accepted = {i: False for i in range(1, N+1)}
ACs = 0
WAs = 0
for p, S in submits:
    p = int(p)
    if accepted[p]: continue
    if S == 'AC':
        accepted[p] = True
        ACs += 1
    else:
        WAs += 1
print(ACs, WAs)

Submission status: Wrong Answer

Solution code:
import math
import sys


(N, M) = list(map(int,input().split()))
# print(N,M)
nwa = 0
nac = 0

ac = [ "" for _ in range(N+1)]
for i in range(0,M):
    (x,S)  = input().split()
    p = int(x)
    # print(p,S)
    if ac[p] == "AC":
        continue
    if S == "AC":
        nac = nac + 1
        ac[p] = "AC"
    else:
        nwa = nwa + 1
print(nac,nwa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
AC=[0]*n
WA=[0]*n
for _ 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
print(sum(AC),sum(WA))

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 = input().split()
    p = int(p) - 1
    if S == 'AC':
        ac[p] = 1
    if S == 'WA' and ac[p] == 0:
        wa[p] = 1
print(sum(ac), sum(wa))

Submission status: Wrong Answer

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]
N,M=map(int, input().split())
l=[0]*N
w=0
for i in range(M):
    p,S=input().split()
    p=int(p)
    if S=="AC":
        l[p-1]=1
    else:
        if not l[p-1]:
            w+=1
print(sum(l),w)

Submission status: Wrong Answer

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

seikai = set()
pena = 0

for i in range(m):
    p, s = map(str, input().split())
    if s == 'WA':
        if p not in seikai:
            pena += 1
        else:
            continue
    else:
        if p not in seikai:
            seikai.add(p)
        else:
            continue
print(len(seikai), pena)

Submission status: Wrong Answer

Solution code:
n, m = map(int, raw_input().split())
l = []
ac = set()
wa = {}
for i in range(m):
	a, b = raw_input().split()
	a = int(a)
	
	if a not in ac:
		if b == 'WA':
			if b in wa:
				wa[b] += 1
			else:
				wa[b] = 1
		else:
			ac.add(a)

print len(ac), sum(wa.values())

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 = input().split()
    p = int(p)
    if ac[p-1]>0:
        continue
    else:
        if s=="AC":
            ac[p-1] = 1
        else:
            wa[p-1] +=1
print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
n, m = [ int(v) for v in input().split() ]
status = [ "WA" for i in range(n) ]
penarty = 0
for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if status[p] == "WA":
        if s == "WA":
            penarty += 1
        elif s == "AC":
            status[p] = "AC"
print(status.count("AC"), penarty)

Submission status: Wrong Answer

Solution code:
import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, m = list(map(int, readline().split()))
    ps = [list(map(str, readline().rstrip().decode('utf-8').split())) for _ in range(m)]
    ac = collections.defaultdict(int)
    wa = collections.defaultdict(int)
    for p, s in ps:
        if s == "AC":
            ac[p] += 1
    for p, s in ps:
        if s == "WA":
            if p in ac:
                wa[p] += 1
    print(len(ac), len(wa))


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
N, M = [int(x) for x in input().split()]
ans = [0] * N
pen = [0] * N
for _ in range(M):
    ps, S = [x for x in input().split()]
    p = int(ps)-1
    if S == 'WA':
        if ans[p] == 0:
            pen[p] += 1
    else:
        ans[p] = 1
print(sum(ans), sum(pen))

Submission status: Wrong Answer

Solution code:
import itertools

N ,M = list(map(int,input().split(" ")))
ac = 0
wa = 0
ac_probs = set()
wa_probs = set()
for _ in range(M):
    p, s =  input().split(" ")
    if s == "AC":
        ac_probs.add(p)
    elif s == "WA":
        if p not in ac_probs:
            wa += 1
print(len(ac_probs),wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac = [0 for _ in range(n)]
wa = 0
for _ in range(m):
  a,b = input().split()
  a = int(a) - 1
  if b == 'AC':
    ac[a] = 1
  elif ac[a] == 0:
    wa += 1
print(sum(ac),wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

problems = [False]*N
AC = 0
penalty = 0
WA = 0
for p, S in pS:
    p = int(p)
    if problems[p-1] == True:
        continue
    else:
        if S == "AC":
            problems[p-1] = True
            AC += 1
            penalty += WA
            WA = 0
        else:
            WA += 1

print(AC, penalty)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict


def solve():
    N, M = map(int, input().split())
    ac_dict = defaultdict(int)
    wa_dict = defaultdict(int)
    for _ in range(M):
        p, s = map(str, input().split())
        if s == 'AC':
            ac_dict[p] = 1
        else:
            if ac_dict[p] != 1:
                wa_dict[p] += 1
    
    print(sum(ac_dict.values()), sum(wa_dict.values()))


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n, m = [int(x) for x in input().strip().split()]
ac = [0] * n
cnt = [0] * n
for i in range(m):
    p, s = [x for x in input().strip().split()]
    p = int(p)
    if ac[p-1]:
        continue
    if s == 'AC':
        ac[p-1] = 1
    elif s == 'WA':
        cnt[p-1] += 1
print(sum(ac), sum(cnt))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
flags = [False]*n
num_ac = 0
num_wa = 0

for i in range(m):
    p, s = input().split()
    p = int(p)
    if flags[p-1]:
        continue
    else:
        if s=='WA':
            num_wa += 1
        else:
            flags[p-1] = True
            num_ac += 1

print(num_ac, num_wa)

Submission status: Wrong Answer

Solution code:
from heapq import heappush, heappop
from collections import deque
import re
import math
import functools
import itertools
import fractions

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))


INF = 1 << 29


def mk1d(n, val=INF):
    return [val for i in range(n)]

def mk2d(h, w, val=INF):
    return [[val for i in range(w)]for i in range(h)]

DIV = 998244353


def convolve(a, b):
    p, g = 1107296257, 5
    n0, n1 = len(a), len(b)
    n = 1 << (max(n0, n1) - 1).bit_length() + 1
    a = a + [0] * (n-n0)
    b = b + [0] * (n-n1)
    w = pow(g, (p - 1) // n, p)
    invw = pow(w, p-2, p)

    def fft(f):
        d = n // 2
        v = w
        while d >= 1:
            u = 1
            for i in range(d):
                for j in range(i, n, 2*d):
                    f[j], f[j+d] = (f[j] + f[j+d]) % p, u * (f[j] - f[j+d]) % p
                u = u * v % p
            v = v * v % p
            d //= 2

    def ifft(f):
        d = 1
        while d < n:
            v = pow(invw, n // (2 * d), p)
            u = 1
            for i in range(d):
                for j in range(i, n, 2*d):
                    f[j+d] *= u
                    f[j], f[j+d] = (f[j] + f[j+d]) % p, (f[j] - f[j+d]) % p
                u = u * v % p
            d *= 2

    fft(a), fft(b)
    for i in range(n):
        a[i] = a[i] * b[i] % p
    ifft(a)
    invn = pow(n, p - 2, p)
    return [a[i] * invn % p for i in range(n0 + n1 - 1)]


def gcd(a, b):
    if(b == 0):
        return a
    return gcd(b, a % b)

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)


def lcm(*numbers):
    return functools.reduce(lcm_base, numbers, 1)


def lcm_list(numbers):
    return functools.reduce(lcm_base, numbers, 1)

def main():
    N,M = isRaw()
    isAC = [False]*N
    pena = [0]*N
    for idx in range(M):
        p,S = ssRaw()
        p = int(p)
        if S=="AC":
            isAC[p-1]=True
        if S=="WA":
            if not isAC[p-1]:
                pena[p-1]+=1
    return str(sum(isAC))+" "+str(sum(pena))
        


if __name__ == "__main__":
    print(main())

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


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


def read_float():
    return float(input())


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


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, P, S):
    ac = set()
    wa = 0
    for i in range(M):
        if S[i] == 'AC':
            ac.add(P[i])
        elif P[i] not in ac:
            wa += 1
    return '%d %d' % (len(ac), wa)


def main():
    N, M = read_int_n()
    P, S = [], []
    for _ in range(M):
        p, s = read_str_n()
        p = int(p)
        P.append(p)
        S.append(s)
    print(slv(N, M, P, S))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

ac = sum([item>0 for item in ac])
wa = sum(wa)
print(ac, wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
#AC, WA
nn = [ [0, 0] for i in range(n)]
ps = []
for i in range(m):
    p, s = input().split()
    p = int(p)
    if s == "AC":
        if nn[p - 1][0] == 0:
            nn[p - 1][0] += 1
        else:
            pass
    else:
        if nn[p - 1][0] == 0:
            nn[p - 1][1] += 1
        else:
            pass

ac = 0
wa = 0
for i in range(n):
    ac += nn[i][0]
    wa += nn[i][1]
print(str(ac) + " " + str(wa))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
pS=[input().split() for i in range(M)]
ac=0
wa=0

acd=[0 for i in range(N)]
for p,S in pS:
    p=int(p)
    if not acd[p-1]:
        if S=="WA":
            wa+=1
        else:
            ac+=1
            acd[p-1]=1
print(ac,wa)

Submission status: Wrong Answer

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

ans = 0
flag = [0] * n

for _ in range(m):
    P, s = input().split(' ')
    p = int(P) - 1
    if s == 'AC':
        flag[p] = 1
    elif flag[p] == 0:
        ans += 1

print(sum(flag), ans)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC, WA, ps = 0, 0, set(list(range(1, N+1)))
for _ in range(M):
    p, S = input().split()
    if int(p) in ps:
        if S == 'AC':
            AC += 1
            ps.remove(int(p))
        else:
            WA += 1
print(AC, WA)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC = set()
WA = set()
for i in range(M):
    p, S = input().split()
    p = int(p) - 1
    S = S == 'AC'
    if S:
        AC.add(p)
    else:
        WA.add(p)
print(len(AC), len(AC & WA))

Submission status: Wrong Answer

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

ans=0
p=0
answered=set()

for _ in range(M):
    P,S=input().split()
    if not P in answered:
        if S=='WA':
            p+=1
        elif S=='AC':
            answered.add(P)
            ans+=1

print(ans,p)