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
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, 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)]
mod = 1000000007
inf = float('INF')

#solve
def solve():
    n, m = LI()
    d = [0] * n
    wa = 0
    for _ in range(m):
        p, s = input().rstrip().split()
        p = int(p) - 1
        if d[p]:
            continue
        if s == "AC":
            d[p] = 1
        else:
            wa += 1
    print(sum(d), wa)

    return


#main
if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
	N, M = map(int, input().split())
	prob_list = [0] * (N+1)
	wa = 0
	for i in range(M):
		p, s = input().split()
		p = int(p)
		if s == "AC":
			prob_list[p] = 1
		else:
			if prob_list[p] == 0:
				wa += 1
		# print(prob_list)
	ac = 0
	for i in range(N+1):
		ac += prob_list[i]
	print("{0} {1}".format(ac, wa))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
mode = 0
ac_count = 0
miss_count = 0
for i in range(M):
    s = input().split()
    if i == 0:
        mode = int(s[0])
    if s[1] == "AC":
        if mode<=int(s[0]):
            mode = int(s[0])+1
            ac_count += 1
    else:
        if mode <= int(s[0]):
            miss_count += 1
print(ac_count,miss_count)

Submission status: Wrong Answer

Solution code:
import math
import itertools
import fractions
import heapq
import collections
import bisect
import sys

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

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
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()

n,m = LI()

l = [False]*n
ans=0
for i in range(m):
    p,s = LS()
    if s=="AC":
        l[int(p)-1]=True
    else:
        if l[int(p)-1]==False:
            ans+=1
print(l.count(True),ans)

Submission status: Wrong Answer

Solution code:
from bisect import bisect_right, bisect_left
from itertools import groupby, permutations, combinations
from fractions import gcd
import numpy as np
from sys import stdin, stderr


def lcm(x, y):
    return (x * y) // gcd(x, y)


def main():
    N, M = [int(x) for x in input().split()]
    isAC = [False] * (N+1)
    cntAC = 0
    cntPN = 0
    for i in range(M):
        p, s = input().split()
        p = int(p)
        if s == "AC":
            if not isAC[p]:
                isAC[p] = True
                cntAC += 1
        else:
            if not isAC[p]:
                cntPN += 1

    return " ".join([str(cntAC), str(cntPN)])


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

Submission status: Wrong Answer

Solution code:
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def my_round(a,dig=0):
    p = 10 ** dig
    return (a * p * 2 + 1) // 2 / p

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b): #最小公倍数
    return a/gcd(a,b)*b

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): #素因数分解
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

def main():
    n,m = map(int,input().split())
    p = []
    s = []
    for i in range(m):
        a,b = input().split()
        p.append(int(a))
        s.append(b)
    mp = {}
    pena = 0
    for i in range(m):
        if p[i] in mp.keys():
            if s[i] == 'AC':
                mp[p[i]] = 1
            elif mp[p[i]] == 0:
                pena += 1
        else:
            if s[i] == 'AC':
                mp[p[i]] = 1
            else:
                mp[p[i]] = 0
                pena += 1
    ans = 0
    for key in mp.keys():
        if mp[key] == 1:
            ans += 1
    print(ans,pena)
    return

if __name__=='__main__':
    main()

Submission status: Wrong Answer

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

AClist = [0 for i in range(N)]
WAlist = [0 for i in range(N)]

for p,S in pSlist:
    if AClist[p]==0 and S=="AC":
        AClist[p]=1
    elif AClist[p]==0 and S=="WA":
        WAlist[p]+=1

print(sum(AClist),sum(WAlist))

Submission status: Wrong Answer

Solution code:
#coding:utf-8

n, m = map(int, input().split(' '))
pro = [None for _ in range(n + 1)]

ac_cnt = 0
wa_cnt = 0
for i in range(m):
    idx, res = input().split(' ')
    idx = int(idx)
    if pro[idx] == 'AC':
        continue
    if res == 'AC':
        pro[idx] = 'AC'
        ac_cnt += 1
    else:
        wa_cnt += 1
print(ac_cnt, wa_cnt)

Submission status: Wrong Answer

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

print(ans,pn)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
d = {}
for i in range(1,N+1):
    d[i] = 0
P = 0
AC = 0
for i in range(M):
    p,s = map(str,input().split())
    q = int(p)
    if d[q] == 1:
        continue
    if s == 'AC':
        d[q] = 1
        AC += 1
    else:
        P += 1
print(AC,P)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
pS = [[i for i in map(str,input().split())] for j in range(m)]
acd = [False for i in range(n)]
WAs = 0

for i in range(m):
  if pS[i][1]=="AC":
    acd[int(pS[i][0])-1]=True
  if acd[int(pS[i][0])-1]==False and pS[i][1]=="WA":
    WAs += 1

acds = sum(acd)
print(str(acds) + ' ' + str(WAs))

Submission status: Wrong Answer

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

d={}
for i in range(m):
    p,s=map(str,input().split())
    p=int(p)
    if p in d:
        d[p].append(s)
    else:
        d[p]=[s]

a,b=0,0
for i in d:
    x=d[i]
    for j in range(len(x)):
        if x[j]=="WA":
            b+=1
        else:
            a+=1
            break

print(a,b)

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 = Counter()
    for i in range(M):
        if S[i] == 'AC':
            ac.add(P[i])
        elif P[i] not in ac:
            wa[i] += 1
    return '%d %d' % (len(ac), sum(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:
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 = 0
    for p, s in ps:
        if s == "WA":
            if p not in ac:
                wa += 1
        if s == "AC":
            ac[p] += 1
    print(len(ac), wa)


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
# 2020/01/12

n,m=map(int,input().split())
ps=[0]*(n+1)
ac=0
wa=0
cnt=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if ps[p]:continue
    if s=='WA':
        cnt+=1
    else:
        ps[p]=1
        ac+=1
        wa+=cnt
        cnt=0
print(*[ac,wa])

Submission status: Wrong Answer

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

result_AC = [False]*N # 正答したかどうかを保存する
correct_num = 0
penalty_num = 0

for i in range(0, M):
  p, S = input().split(" ")
  p = int(p) - 1
  # pをみて，もしresult_ACがtrueならばnext
  if(result_AC[p]):
    continue
  # そうでない場合，
  else:
    ## ACならば，result_ACをtrueにして，correct_num += 1
    if S == 'AC':
      result_AC[p] = True
      correct_num += 1
    ## WAならば，penalty_num += 1
    else:
      penalty_num += 1

print(correct_num, penalty_num)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n, m = map(int, input().split())

cnt_ac = 0
cnt_wa = 0
ac_set = set()

for i in range(m):
    str_list = input().split()
    p = int(str_list[0])
    s = str_list[1]
    if p not in ac_set:
        if s == 'AC':
            cnt_ac = cnt_ac + 1
            ac_set.add(p)
        else:
            cnt_wa = cnt_wa + 1

print(str(cnt_ac) + ' ' + str(cnt_wa))

Submission status: Wrong Answer

Solution code:
import sys
from math import factorial
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n, m = MAP()
submits = [[] for i in range(n)]
for i in range(m):
    p, S = input().split()
    p = int(p)
    submits[p-1].append(S)

ac = 0
wa = 0

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

print(str(ac) + ' ' + str(wa))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ans_ac = 0
ans_wa = 0
lst = []
for i in range(m):
  p, s = input().split()
  if p in lst:
    continue
  if s == 'WA':
    ans_wa += 1
  else:
    ans_ac += 1
    lst.append(p)
print(ans_ac, ans_wa)

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    pre = 0
    ans, ans2 = 0, 0
    for i in range(M):
        p, s = input().split()
        pp = int(p)
        if s == 'AC' and pre == pp:
            continue
        if s == 'AC':
            pre = pp
            ans += 1
        elif pre != pp:
            ans2 += 1
    print(ans, ans2)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

for r in l:
  if r[1]=='AC' and arr[int(r[0])-1]==False:
    ac+=1
    arr[int(r[0])-1]=True
    continue
  elif r[1]=='WA' and arr[int(r[0])-1]==False:
    wa+=1
    continue
print(ac,wa)

Submission status: Wrong Answer

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

ac_list = []

wa_cnt = 0

for i in range(M):
    if (P[i] in ac_list):
        continue
    if (S[i] == 'AC'):
        ac_list.append(P[i])
    else:
        wa_cnt += 1

print(len(set(ac_list)), wa_cnt)

Submission status: Wrong Answer

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

print(len(ac), wa)

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n, m = LI()
    was = [0 for i in range(n+1)]
    ans = [0 for i in range(n+1)]
    ps = []
    ss = []

    for i in range(m):
        p, s = LS()
        # print(p, s)
        ps.append(int(p[0]))
        ss.append(s[0])
    count = 0
    for p, s in zip(ps, ss):
        if s == "A":
            ans[p] = 1
        elif s == "W" and ans[p] == 0:
            was[p] += 1

    # print(sum(ans), sum(was))
    print(" ".join([str(sum(ans)), str(sum(was))]))



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

b = [[0] for i in range(n)]

acnt = 0
wcnt = 0

for i in range(m):
    p, s = map(str, input().split())
    if s == "WA":
        if b[int(p)-1][0] == 0:
            wcnt += 1
    else:
        if b[int(p)-1][0] == 0:
            acnt += 1
            b[int(p)-1][0] = 1
    

print(acnt, wcnt)

Submission status: Wrong Answer

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

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

for i in range(m):
    if que[p[i]] == True:
        if s[i] == "WA":
            wa += 1
        else:
            ac += 1
            que[p[i]] = False
    
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac = 0
wa = 0
al = []
for i in range(m):
  k = list(input().split())
  k[0] = int(k[0])
  if k[0] in al:
    continue
  if not k[0] in al and k[1] == "WA":
    wa += 1
  if not k[0] in al and k[1] == "AC":
    ac += 1
    al.append(k[0])
lis = [ac, wa]
print(*lis)

Submission status: Wrong Answer

Solution code:
# coding: utf-8


def solve(*args: str) -> str:
    n, m = map(int, args[0].split())
    AC = [False]*n
    WA = [0]*n
    for p, s in map(str.split, args[1:]):
        i = int(p)-1
        if s == 'AC':
            AC[i] |= True
        elif s == 'WA' and not AC[i]:
            WA[i] += 1

    return '{} {}'.format(sum(AC), sum(WA))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Wrong Answer

Solution code:
N, M = [int(i) for i in input().split()]
a = set()
wa = 0
ac = 0
for i in range(M):
    t, s = input().split()
    t = int(t)
    if s == 'AC':
        if not (t in a):
            a.add(t)
            ac += 1
    if s == 'WA':
        if not (t in a):
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    n,m = map(int, input().split())
    
    num = 0
    ac = 0
    wa = 0
    flg = 0
    for i in range(m):
        p,s = input().split()
        if num != p:
            tmp = 0
            flg = 0
            num = p
        if num == p and flg == 1:
            continue
        if s == 'WA':
            tmp += 1
        if s == 'AC':
            ac += 1
            wa += tmp
            tmp = 0
            flg = 1
    print(ac,wa)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

AC = [0] * (N+1)
WA = [0] * (N+1)
block = [0] * (N+1)

for p, s in zip(P, S):
  if s == 'AC':
    AC[p] = 1
    block[p] = 1
  if s == 'WA':
    if block[p] == 0:
      WA[p] += 1
print(sum(AC), sum(WA))

Submission status: Wrong Answer

Solution code:
N, M =[int(i) for i in input().split()]
isfinish=[0]*N
isfail=[0]*N
for i in range(M):
    p, S = input().split()
    p=int(p)
    if S=="AC" and isfinish[p-1]==0:
        isfinish[p-1]=1
    elif S=="WA" and isfinish[p-1]==0:
        isfail[p-1] +=1

print(str(sum(isfinish)) + " "+ str(sum(isfail)))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ps = []
memo = [0 for i in range(n)]
pena = [0 for i in range(n)]
for i in range(m):
    p, s = input().split()
    p = int(p)
    if s == "AC":
        memo[p-1] = 1
    else:
        if memo[p-1] == 0:
            pena[p-1] += 1
print(sum(memo), sum(pena))

Submission status: Wrong Answer

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

list = [0 for i in range(n)]
cnt = [0 for i in range(n)]
for i in range(m):
	tmp, s = input().split()
	p = int(tmp)
	if s == "AC":
		if list[p-1] == 0:
			list[p-1] += 1
	else:
		if list[p-1] == 0:
			cnt[p-1] += 1

print(list.count(1), sum(cnt))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
PS=[list(input().split()) for i in range(M)]
chk=[0]*N
seito=0
pena=0
for p,s in PS:
  p=int(p)
  if chk[p-1]==0:
    if s=='WA':
      pena+=1
    elif s=='AC':
      seito+=1
      chk[p-1]=1
  else:
    pass
print(seito,pena)

Submission status: Wrong Answer

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


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

    ac = 0
    wa = 0

    for i in range(M):
        if x[p[i]-1] == 0:
            if S[i] == "AC":
                ac += 1
                x[p[i]-1] = 1
            else:
                wa += 1
    print(ac, wa)


    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


def main():
    sc = Scan()
    N, M = sc.intarr()
    array = []
    for i in range(M):
        p, s = sc.strarr()
        array.append([p, s])

    now_Q = '0'
    AC_cnt = 0
    WA_cnt = 0
    for ss in array:
        if now_Q == ss[0]:
            continue

        if ss[1] == 'AC':
            AC_cnt += 1
            now_Q = ss[0]
        elif ss[1] == 'WA':
            WA_cnt += 1

    print(AC_cnt, WA_cnt)


def perm(p):
    if len(p) == 1:
        return [p]
    else:
        s = []
        for i in range(len(p)):
            q = p[i]
            r = perm(p[:i]+p[i+1:])
            for t in r:
                s.append([q] + t)
        return s


class Scan():

    def intarr(self):
        num_array = list(map(int, input().split()))
        return num_array

    def intarr_ver(self, n):
        return [int(input()) for _ in range(n)]

    def strarr(self):
        line = input()
        array = line.split(' ')
        array[-1] = array[-1].strip('\n')
        return array


def display(array):
    for a in range(len(array)):
        if len(array) - a != 1:
            print(array[a], end=' ')
        else:
            print(array[a])


def gcd(a, b):  # 最大公約数
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):  # 最小公倍数
    return a * b // gcd(a, b)


main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import factorial
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def MI(): return map(int, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def MS(): return map(str, input().split())

YN = ['No', 'Yes']
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']


# show_flg = False
show_flg = True

p = None
XY = None
N = None


def main():
    N, M = MI()
    ans = 0
    p = [0] * M
    S = [0] * M
    dic = {}
    # x = LI()

    for i in range(M):
        p[i], S[i] = MS()
        dic[p[i]] = {'AC': False, 'WA': 0}

    for i in range(M):
        if S[i] == 'WA' and dic[p[i]]['AC'] is False:
            dic[p[i]]['WA'] += 1
        elif S[i] == 'AC':
            dic[p[i]]['AC'] = True

    AC = 0
    WA = 0
    for key in dic.keys():
        if dic[key]['AC']:
            AC += 1
        WA += dic[key]['WA']

    print(AC, WA)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

answers = []
alreadyACed = set()
AC_num = 0
WA_num = 0
for i in range(M):
    p,S = list(input().split())
    if p in alreadyACed:
        continue
    else:
        if S == "WA":
            WA_num += 1
        elif S == "AC":
            AC_num += 1
            alreadyACed.add(p)
print(AC_num,WA_num)

Submission status: Wrong Answer

Solution code:
#標準入力を高速に
import sys 
input = sys.stdin.readline

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

#penalties=[0]*N
penalties=0
flag=[True]*N
for i in range(M):
    if flag[p[i]]:
        if S[i] == "WA":
            #penalties[p[i]] += 1
            penalties += 1

        else:
            flag[p[i]] = False

corrects = 0
for i in range(N):
    if not flag[i]:
        corrects += 1

print(corrects)
print(penalties)
#print(sum(penalties))

Submission status: Wrong Answer

Solution code:
n, nSubms = map(int, input().split())
waCnt = [0] * (n + 1)
ac = [0] * (n + 1)
for _ in range(nSubms):
    id, res = input().split()
    id = int(id)
    if res == 'WA':
        if not ac[id]:
            waCnt[id] += 1
    elif res == 'AC':
        if not ac[id]:
            ac[id] = 1
    else:
        raise Exception
print('%d %d' % (sum(ac), sum(waCnt)))

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 in c_l:
    continue
  else:
    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(i) for i in input().split())
p = [None] * m
s = [None] * m
for i in range(m):
    p[i], s[i] = (i for i in input().split())
    p[i] = int(p[i])

pena = [0] * n
ac   = [0] * n
for i in range(m):
    q_index = p[i]-1
    if s[i] == 'AC':
        if ac[q_index] != 1: ac[q_index] = 1
    else:
        if ac[q_index] == 0: pena[q_index] += 1

print(sum(ac), sum(pena))

Submission status: Wrong Answer

Solution code:
n,m=[int(x) for x in input().split()]
d=dict()
pnt=0
crt=0
for i in range(0,m):
    a,v=[x for x in input().split()]
    a=int(a)
    if a not in d:
        if v=='AC':
            d[a]=1
            crt+=1
        else:
            pnt+=1
print(crt,pnt)

Submission status: Wrong Answer

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

ac = 0
wa = 0
c = set()
for i in range(m):
    if not pi[i] in c:
        if si[i] == 'AC':
            c.add(pi[i])
            ac += 1
        else:
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = [0]*M
S = [0]*M
for i in range(M):
    l = input().split()
    p[i] = int(l[0])
    S[i] = l[1]
# print(N, M, p, S)
ans = {(x + 1): [0, 0] for x in range(N)}
# print(ans)
for i in range(M):
    a = p[i]
    b = S[i]
    if b == 'AC':
        ans[a][0] += 1
    else:
        if ans[a][0] == 0:
            ans[a][1] += 1
# print(ans)
ac = 0
wa = 0
for i in range(1, N + 1):
    if ans[i][0] > 0:
        ac += 1
    wa += ans[i][1]

print(ac, wa)

Submission status: Wrong Answer

Solution code:
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def my_round(a,dig=0):
    p = 10 ** dig
    return (a * p * 2 + 1) // 2 / p

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b): #最小公倍数
    return a/gcd(a,b)*b

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): #素因数分解
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

def main():
    n,m = map(int,input().split())
    p = []
    s = []
    for i in range(m):
        a,b = input().split()
        p.append(int(a))
        s.append(b)
    mp = {}
    pena = 0
    for i in range(m):
        if p[i] in mp.keys():
            if s[i] == 'AC':
                mp[p[i]] = 1
        else:
            if s[i] == 'AC':
                mp[p[i]] = 1
            else:
                mp[p[i]] = 0
                pena += 1
    ans = 0
    for key in mp.keys():
        if mp[key] == 1:
            ans += 1
    print(ans,pena)
    return

if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
AC=[]
WA=[]
for _ in range(M):
  p,S=input().split()
  if S=="AC":
    AC.append(p)
  else:
    WA.append(p)
print(len(set(AC)),len(set(WA)))

Submission status: Wrong Answer

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


m = {}

N, M = list(map(int, input().split()))
penalty = 0
ans = 0
for i in range(M):
    p, s = input().split()
    p = int(p)
    if s == "AC" and p not in m:
        m[p] = 1
        ans += 1
    elif s == "WA" and p not in m:
        penalty += 1


print(str(ans) + " " + str(penalty))

Submission status: Wrong Answer

Solution code:

N, M = map(int, input().split())
P = [ {"WA": False, "AC": False} for i in range(N+1) ]

wa = 0
ac = 0

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

  if s == "WA" and not P[p]["WA"]:
    P[p]["WA"] = True
    wa += 1
  elif s == "AC" and not P[p]["AC"]:
    P[p]["AC"] = True
    ac += 1

print(ac, wa)