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())
li = [input().split() for _ in range(m)]
ans = [0,0]

check = [[] for i in range(n)]

for i in range(m):
    s = int(li[i][0])
    check[s-1].append(li[i][1])
    
for i in range(n):
    if len(check[i]) > 0:
        for j in range(len(check[i])):
            if check[i][j] == "WA":
                ans[1] += 1
            elif check[i][j] == "AC":
                ans[0] += 1
                break

print(*ans)

Submission status: Wrong Answer

Solution code:
# s = input()
# n = int(input())
# a, b = map(int, input().split())
# l = list(map(int, input().split()))
n, m = map(int, input().split())
ps = []
for i in range(m):
    ps.append(list(map(str, input().split())))

ac = 0
wa = 0
prob = [0]*n

for i in range(m):
    if ps[i][1] == "AC" and prob[int(ps[i][0]) - 1] == 0:
        ac += 1
        prob[int(ps[i][0]) - 1] = 1
    elif ps[i][1] == "WA" and prob[int(ps[i][0]) - 1] == 0:
        wa += 1

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

Submission status: Wrong Answer

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

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

AC = [0]*n
WA = [0]*n

for p, S in pS:
    p = int(p)
    if AC[p-1] == 0:
        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 = 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
    else:
        if s == 'AC':
            d[q] = 1
            AC += 1
        else:
            P += 1
print(AC,P)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
n,m = map(int, input().split())
L = [''] * n
ac = 0
wa = 0
for i in range(m):
    p,s = input().split()
    p = int(p)-1
    if L[p] == '':
        L[p] = s
        if s == 'WA':
            wa += 1
        else:
            ac += 1
    elif L[p] == 'WA':
        if s == 'WA':
            wa += 1
        else:
            L[p] = 'AC'
            ac += 1
    else:
        pass
print(ac, wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = list(map(lambda x: int(x), input().split()))
cleared = [False for i in range(N+1)]
ac = 0
wa = 0
for i in range(M):
  p, s = input().split()
  p = int(p)
  if s == "AC":
    cleared[p] = True
    ac = ac + 1
  
  if cleared[p]:
    continue
  
  wa = wa + 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
PS = [list(input().split()) for _ in range(M)]
l = [False]*N
pena = 0
for p,s in PS:
  p = int(p)
  if s=='AC':
    if not l[p-1]:
      l[p-1]=True
  elif s=='WA':
    if not l[p-1]:
      pena+=1
      
ans = sum(l)
print(ans,pena)

Submission status: Wrong Answer

Solution code:
def c_welcome_to_atcoder():
    from collections import defaultdict
    N, M = [int(i) for i in input().split()]
    Results = []
    for _ in range(M):
        p, s = input().split()
        Results.append((int(p), s))

    count_wa = [0] * (N + 1)
    is_already_ac = [False] * (N + 1)

    for p, s in Results:
        if is_already_ac[p]:
            continue

        if s == 'AC':
            is_already_ac[p] = True
        elif s == 'WA':
            count_wa[p] += 1

    ans_ac = sum(is_already_ac)
    ans_wa = sum(count_wa)
    return '{} {}'.format(ans_ac, ans_wa)

print(c_welcome_to_atcoder())

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 == "WA":
            if p not in ac:
                wa[p] += 1
        if s == "AC":
            ac[p] += 1
    wac = 0
    for k, v in wa.items():
        if k in ac:
            wac += 1
    print(len(ac), wac)


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    cnt = 0
    answer_list = [[] for _ in range(N)]
    for i in range(M):
        p, S = input().split()
        p = int(p) - 1
        answer_list[p].append(S)

    ac = 0
    wa = 0
    for answers in answer_list:
        for a in answers:
            tmp_wa = 0
            if a == 'AC':
                ac += 1
                wa += tmp_wa
                break
            else:
                tmp_wa += 1
    
    print(ac, wa)

    

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
PS = [input().split() for i in range(M)]
Flag = [0 for i in range(N)]
WA_count = [0 for i in range(N)]

for i in range(M):
  p = int(PS[i][0])-1
  s = PS[i][1]
  
  if s =="AC":
    Flag[p]=1
  else:
    if Flag[p]==0:
      WA_count[p]+=1

print(sum(Flag),sum(WA_count))

Submission status: Wrong Answer

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n,m=INTM()
    li=[]
    ct=[0  for i in range(100000)]
    check=[0  for i in range(100000)]
    for i in range(m):
        p,s=STRM()
        p=int(p)
        li.append([p,s])
    for i in range(len(li)):
        if check[li[i][0]]==0:
            if li[i][1]=='WA':
                ct[li[i][0]]+=1
            else:
                check[li[i][0]]=1
        else:
            pass
    ct_s=sum(ct)
    ck_s=sum(check)
    print(ck_s,ct_s)
if __name__ == '__main__':
    do()

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split(' '))
suc_list = []
fai_count = 0
for i in range(M):
    p, s = input().split(' ')
    if p not in suc_list and s == 'WA':
        fai_count += 1
    elif p not in suc_list and s == 'AC':
        suc_list.append(p)

print('{} {}'.format(len(suc_list), fai_count))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
record = [1]*(n+1)
ans = 0
penalty = 0
for i in range(m):
    p, s = input().split()
    if record[int(p)]:
        if s == "AC":
            ans += 1
            record[int(p)] = 0
            continue
        elif s == "WA":
            penalty += 1
            continue
    else:
        continue

print(ans, penalty)

Submission status: Wrong Answer

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

for i in range(M) :
  tmp = input().split()
  p.append(int(tmp[0]))
  S.append(tmp[1])

w_cnt = 0
a_cnt = 0
skip = []
for i in range(M) :
  if p[i] not in skip :
    if S[i] == 'WA' :
      w_cnt += 1
    elif S[i] == 'AC' :
      a_cnt += 1
      skip.append(p[i])
  else :
    continue
  # print(a_cnt, w_cnt)

print(a_cnt, w_cnt)

Submission status: Wrong Answer

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

submit = []
for i in range(m):
    temp = [x for x in input().split()]
    submit.append(temp)

done = [0] * 100000
ac = 0
wa = 0

for i in range(m):
    if submit[i][1] == 'AC' and done[int(submit[i][0])] == 0:
        done[int(submit[i][0])] = 1
        ac += 1
    elif submit[i][1] == 'WA' and done[int(submit[i][0])] == 0:
        wa += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]

n, m = ril()
ls = rsls(m)

ac = 0
wa = 0
done = set()
for p, s in ls:
    if p not in done:
        if s == 'AC':
            ac += 1
            done.add(p)
        else:
            wa += 1
print(ac, wa)

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):
  p, s = input().split()
  P.append(int(p))
  S.append(s)
d = {}
d1 = {}
for i in range(M):
  if S[i] == "WA":
    if i not in d1.keys():
      d1[P[i]] = 1
  elif S[i] == "AC":
    if i not in d.keys():
      d[P[i]] = 1
print(sum(d.values()), sum(d1.values()))

Submission status: Wrong Answer

Solution code:
def A():
    c = input()
    print(chr(ord(c)+1))

def B():
    temp = [int(k) for k in input().split()]
    N = temp[0]
    K = temp[1]
    M = temp[2]
    A = [int(k) for k in input().split()]
    ans = M*N - sum(A)
    if ans <= K:
        print(max(0, ans))
    else:
        print(-1)

def C():
    temp = [int(k) for k in input().split()]
    N = temp[0]
    M = temp[1]
    ac = 0
    penal = 0
    P = []
    S = []
    for i in range(M):
        temp = input().split()
        P.append(int(temp[0]))
        S.append(temp[1])
    ac_problems = set()
    for i in range(M-1, -1, -1):
        if P[i] not in ac_problems and S[i] == 'AC':
            ac_problems.add(P[i])
            ac += 1
        elif P[i] in ac_problems and S[i] == 'WA':
            penal += 1
    print(ac, penal)
C()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(4100000)

import math

import logging

logging.basicConfig(level=logging.DEBUG)

logger = logging.getLogger(__name__)


def resolve():
    N, M = [int(x) for x in sys.stdin.readline().split()]
    pS_list = [[x for x in sys.stdin.readline().split()] for _ in range(M)]

    aced_list = [False for _ in range(N)]
    penal_list = [0 for _ in range(N)]
    for p, s in pS_list:
        p = int(p) - 1
        if s == 'AC':
            aced_list[p] = True
        else:
            if not aced_list[p]:
                penal_list[p] += 1

    print(sum(aced_list), sum(penal_list))


if __name__ == "__main__":
    resolve()

# AtCoder Unit Test で自動生成できる, 最後のunittest.main は消す
# python -m unittest template/template.py で実行できる
# pypy3 -m unittest template/template.py で実行できる
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2 5
1 WA
1 AC
2 WA
2 AC
2 WA"""
        output = """2 2"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """100000 3
7777 AC
7777 AC
7777 AC"""
        output = """1 0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """6 0"""
        output = """0 0"""
        self.assertIO(input, output)

Submission status: Wrong Answer

Solution code:
#C
N, M = map(int, input().split())
flags = [0] * (N+1)
true_answer = 0
penalty = 0

for _ in range(M):
    pi, Si = input().split()
    pi = int(pi)
    if Si == "AC":
        if flags[pi] == 0:
            flags[pi] = 1
            true_answer += 1
        else:#すでにAC済みの場合
            pass
    else:#Si == "WA"の場合
        if flags[pi] == 0:
            penalty += 1
        else:#すでにAC済みの場合
            pass
        
print(true_answer, penalty)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

flag = 0
AC_count = 0
WA_count = 0
for i in range(m):
    if ps[i][0] != flag:
        if ps[i][1] == 'AC':
            AC_count += 1
            flag = ps[i][0]
        else:
            WA_count += 1
print(AC_count, WA_count)

Submission status: Wrong Answer

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

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

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

wa_cnt = 0
ac_cnt = 0
ac_list = [0] * n

for i in range(m):
    if ac_list[p[i] - 1] == 0:
        if s[i] == "WA":
            wa_cnt += 1
        else:
            ac_list[p[i] - 1] = 1
            ac_cnt += 1

print(ac_cnt, wa_cnt)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
n, m = map(int, input().split())
data = [input().split() for i in range(m)]
check = [False] * (n + 1)
ac = 0
wa = 0

for i in range(m):
    if data[i][1] == 'WA':
        if check[int(data[i][0])]:
            continue
        else:
            wa += 1
    else:
        if check[int(data[i][0])]:
            continue
        else:
            check[int(data[i][0])] = True
            ac += 1

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

Submission status: Wrong Answer

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import bisect

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))

N, M = LI()
ps = [0 for i in range(M)]
for i in range(M):
    p,s = input().split()
    p = int(p)
    p -= 1
    s = str(s)
    ps[i] = [p,s]

ACs = [0 for i in range(N)]
tmp = 0
ans = [0,0] # AC, WA
for i in range(M):
    p, s = ps[i]
    if ACs[p]:
        pass
    else:
        if s == "AC":
            ACs[p] = 1
            ans[0] += 1
        else:
            ans[1] += 1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    if flag[p] == False:
        if s == "AC":
            flag[p] = True
        else:
            wa += 1

print(sum(flag), wa)

Submission status: Wrong Answer

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

acList = [False] * n
waCountList = [0] * n
for i in range(m):
  p, s = map(str, input().split())
  p = int(p) - 1 # インデックスの調整
  if acList[p]:
    continue
  if s == 'WA':
    waCountList[p] += 1
    continue
  acList[p] = True

print(sum(acList), sum(waCountList))

Submission status: Wrong Answer

Solution code:
_,m = list(map(int,input().split()))
c = set()
wa = set()
for i in range(m):
    pc,s = input().split()
    p = int(pc)
    if s=='AC':
        c.add(p)
    else:
        wa.add(p)
print(len(c),len(wa))

Submission status: Wrong Answer

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

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

for i in range(1, M+1):
  p, S = input().split()
  p = int(p)
  if S == WA and ac[p] == 0:
    wa[p] += 1
  elif S == AC and ac[p] == 0:
    ac[p] = 1

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC_list = []
WA = 0
AC = 0
for i in range(M):
    p, S = map(str, input().split())
    if S == "AC" and p in AC_list:
        continue
    elif S == "AC" and p not in AC_list:
        AC += 1
        AC_list.append(p)
    elif S == "WA" and p not in AC_list:
        WA += 1
    elif S == "WA" and p in AC_list:
        continue
print(AC, WA)

Submission status: Wrong Answer

Solution code:
N, M = [int(x) for x in input().split(" ")]
submit = dict()

for _ in range(M):
    p, S = [x for x in input().split(" ")]
    p = int(p)
    if p in submit:
        submit[p].append(S)
    else:
        submit[p] = [S]


cor = 0
fail = 0

for _, res in submit.items():
    fail_one = 0
    for pat in res:
        if pat == "AC":
            cor += 1
            break
        else:
            fail_one += 1
    fail += fail_one

print(cor, fail)

Submission status: Wrong Answer

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

for i in range(m):
    p, s = input().split()
    L[int(p)-1].append(s)

AC, WA = 0, 0

for q in L:
    for a in q:
        if a == 'WA':
            WA += 1
        if a == 'AC':
            AC += 1
            break

print(AC, WA)

Submission status: Wrong Answer

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

ps = []
for i in range(M):
    ps.append(input().split())

penalties = [0] * N
corrects = [0] * N

for p, s in ps:
    if s == 'AC' and corrects[int(p) - 1] == 0:
        corrects[int(p) - 1] = 1
    elif s == 'WA' and corrects[int(p) - 1] == 0:
        penalties[int(p) - 1] += 1

print(sum(corrects), sum(penalties))

Submission status: Wrong Answer

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

p, s = [], []
result = [0] * (n + 1)
ac, wa = 0, 0

for _ in range(m):
    tmpp, tmps = map(str, input().split())
    p.append(int(tmpp)), s.append(tmps)

for i in range(m):
    if result[p[i]] == 0:
        if s[i] == "AC":
            result[p[i]] = 1
            ac += 1

        else:
            wa += 1

print(ac, wa)

Submission status: Wrong Answer

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

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

print(len(ans), wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=[0]*(n+1)
wa=[0]*(n+1)
for _ in range(m):
    i,j=input().split()
    i=int(i)
    if j=="AC":
        ac[i]=1
    elif ac[i]==0 and j=="WA":
        wa[i]+=1
print(sum(ac),sum(wa))

Submission status: Wrong Answer

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

cnt_crr = 0
cnt_pnt = 0

for e in ls:
    for _e in e:
        if _e == "AC":
            cnt_crr += 1
            break
        cnt_pnt += 1
        
print(cnt_crr, cnt_pnt)

Submission status: Wrong Answer

Solution code:
# N問出題
# M回提出

ans = []
pena = 0
N, M = map(int, input().split())
for m in range(M):
    p, s = input().split()
    # 次の問題へ
    if s == "AC":
        ans.append(p)
    if s == "WA" and (p not in ans):
        pena +=1

print(len(set(ans)), pena)

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
ansY = [0]*N
ansWA = [0]*N
for i in range(M):
  id,ans = input().split()
  id = int(id)-1
  if ans=='AC':
    ansY[id]=1
  elif ans=='WA' and ansY[id]==0:
    ansWA[id]+=1
print(sum(ansY),sum(ansWA))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
plist = [0 for _ in range(n)]
acornot = [0]*n
ans = 0
for i in range(m):
    p,s = input().split()
    p = int(p)
    p -= 1
    if s == "AC" and acornot[p] != 1:
        
        ans += 1
        acornot[p] = 1
    elif s == "AC" and acornot[p] ==1:
        continue
    elif s == "WA" and acornot[p] == 1:
        continue
    else:
        plist[p]+=1
print(ans)
print(sum(plist))

Submission status: Wrong Answer

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


c = 0
a = 0

temp = []

for i in range(m):
    s = input().split()
    if s[1] == 'AC' and s[0] not in temp:
        a += 1
        temp.append(s[0])
    elif s[1] == 'WA' and s[0] not in temp:
        c += 1

print(a, c)

Submission status: Wrong Answer

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

penalty=0
ok=0
ac = [0]*n

for i in range(m):
    p,s = input().split()
    p=int(p)
    if s=="WA":
        if ac[p-1]==0:
            penalty+=1
    elif s=="AC":
        if ac[p-1]==0:
            ok+=1
            ac[p-1]=1
print(ok,penalty)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split(" "))
ac = 0
wa = 0
en_li = []
for i in range(m):
    a, b = input().split(' ')
    if a in en_li:
        continue
    if b == 'WA':
        wa += 1
    else:
        ac += 1
        en_li.append(a)
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ps = []
for i in range(m):
  p,s = input().split()
  p = int(p)
  ps.append((p,s))
  
ans = [[0]*2 for _ in range(n)]
for i in range(m):
    if ans[ps[i][0]-1][1] == 1:
        continue
    if ps[i][1] == "AC":
        ans[ps[i][0]-1][1] = 1
        continue
    if ps[i][1] == "WA":
        ans[ps[i][0]-1][0]  += 1
        
p = 0
q = 0
for i in ans:
    p += i[0]
    if i[1] == 1:
        q += 1

print(q,p)

Submission status: Wrong Answer

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

anslist = [0]*(N+1)
AC = 0
WA = 0
for i in range(M):
    if anslist[int(data[i][0])] == 1:
        continue
    else:
        if data[i][1] == "AC":
            anslist[int(data[i][0])] = 1
            AC += 1
        else:
            WA += 1

print(AC, WA)

Submission status: Wrong Answer

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

ACWAList = []
for i in range(N):
    ACWAList.append([0, 0])

for i in range(M):
    P = int(PSList[i][0])
    if PSList[i][1] == "AC":
        ACWAList[P-1][0] = 1
    else:
        if ACWAList[P-1][0] != 1:
            ACWAList[P-1][1] += 1

ACSum = 0
WASum = 0
for i in range(N):
    ACSum += ACWAList[i][0]
    WASum += ACWAList[i][1]

print(str(ACSum) + " " + str(WASum))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ps_lis = []
for i in range(m):
    p, s = input().split()
    ps_lis.append([int(p), s])
ac_lis = [0] * (n + 1)
pe_lis = [0] * (n + 1)
for p, s in ps_lis:
    if s == 'WA' and ac_lis[p] == 0:
        pe_lis[p] += 1
    elif s == 'AC':
        ac_lis[p] = 1
for i, ac in enumerate(ac_lis):
    if ac_lis == 0:
        pe_lis[i] = 0
print(sum(ac_lis), sum(pe_lis))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split(" "))
s = []
for i in range(m):
    s.append(tuple(input().split()))
ac = 0
pn = 0
end = set()
for i, x in s:
    if x == 'AC':
        if i in end:
            continue
        else:
            ac += 1
            end.add(i)
    else:
        if i not in end:
            pn += 1
        else:
            continue
print(str(ac) + " " + str(pn))

Submission status: Wrong Answer

Solution code:
def main():
  N, M = map(int, input().split())
  
  correct = [0] * N
  penalty = [0] * N
  
  for _ in range(M):
    pi, si = input().split()
    pi = int(pi)
    
    if si == 'WA' and correct[pi-1] == 0:
      penalty[pi-1] += 1
    elif si =='AC':
      correct[pi-1] = True

  print(sum(correct), sum(penalty))
           
main()

Submission status: Wrong Answer

Solution code:
import math
n, m = map(int, input().split())
ans = {}
ac = "AC"
wa = "WA"
ac_num = []
wa_num =  [] 
for _ in range(m):
  p, s = input().split()
  if s == ac:
    ac_num.append(p)
  elif s not in set(ac_num):
    wa_num.append(p)
print(len(set(ac_num)), len(set(wa_num)))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
flags = [False for _ in range(N)]
ACs = 0
WAs = 0
for i in range(M):
    p, S = input().split()
    p = int(p)-1
    if S == 'AC' and not flags[p]:
        flags[p]=True
        ACs += 1
    if not flags[p]:
        WAs += 1
print(ACs, WAs)

Submission status: Wrong Answer

Solution code:
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
ans = [[] for i in range(N)]
for i in range(M):
    p,s = [(x) for x in stdin.readline().rstrip().split()]
    ans[int(p)-1].append(s)

ac = 0
pe = 0
flag = False
for j in range(N):
    for k in ans[j]:
        if k == "WA":
            pe += 1
        else:
            ac += 1
            break
print(ac,pe)

Submission status: Wrong Answer

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

ls.sort(key=lambda x:int(x[0]))

idx = 1
w=0
a=0
wp = 0
for i in range(m):
    if idx<int(ls[i][0]):
        idx = int(ls[i][0])
    if idx==int(ls[i][0]):
        if ls[i][1]=='WA':
            wp += 1
        else:
            w += wp
            wp = 0
            a += 1
            idx += 1

print(a,w)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
#from itertools import permutations

def gcd(a: int, b: int):
    """ https://cocodrips.hateblo.jp/entry/2014/03/05/143623
    """
    while b: a, b = b, a%b
    return a

def lcm(a: int, b: int):
    return a * b // gcd(a, b)


def main():
    #N = int(input())
    N,M = map(int, input().split())
    #vP = tuple(map(int, input().split()))
    #vA = list(map(int, input().split()))
    #vA = list(range(1,N+1))
    vS = [input().split() for _ in [0,]*M]
    vN = [False,]*(N+1)

    x,p = 0,0
    for a,s in vS:
        i = int(a)
        v = s=="AC"
        if vN[i]==False:
            if v:
                x += 1
                vN[i] = True
            else:
                p += 1

    print(x,p)

    #print(l, file=sys.stderr)
    #l //= 2
    #S = input().rstrip()
    #print(S)
    #print(chr(ord(S)+1))
    #print(lcm(N, M))
    #print("Yes" if N<=500*M else "No")
    #print(S.count("ABC"))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

false_count = 0
ans = 0

p, s = input().split()
now = int(p)
if s == "WA":
    false_count += 1
elif s == "AC":
    ans += 1
    now += 1

for i in range(M-1):
    p, s = input().split()
    if int(p) == now:
        if s == "WA":
            false_count += 1
        elif s == "AC":
            ans += 1
            now += 1

print(ans, false_count)

Submission status: Wrong Answer

Solution code:
def solve():
    N, M = map(int, input().split())
    errcnt = [0] * N
    isSolved = [False] * N
    
    for i in range(M):
        p, S = input().split()
        p = int(p) - 1

        if not isSolved[p]:
            if S == 'WA':
                errcnt[p] += 1
            else:
                isSolved[p] = True

    print(sum(isSolved), sum(errcnt))

if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
n,m=map(int,input().split())
s=[]
for i in range(m):
    s.append(input().split())
    s[i][0]=int(s[i][0])
cnt=[0]*n
cnt1=[0]*n
#print(s)
for i in range(m):
    if s[i][1]=='WA':
        if cnt[s[i][0]-1]!=0:
            continue
        else:
            cnt1[s[i][0]-1]+=1
    if s[i][1]=='AC':
        if cnt[s[i][0]-1]!=0:
            continue
        else:
            cnt[s[i][0]-1]+=1
    #print(cnt)
    #print(cnt1)
print(sum(cnt),sum(cnt1))

Submission status: Wrong Answer

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

ac = 0
wa = 0

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

    if(l[p-1]):
        continue
    
    if(s=="AC"):
        l[p-1] = True
        ac += 1
        continue

    wa += 1


print(ac, wa)

Submission status: Wrong Answer

Solution code:
n1,m1 = map(int,input().split())
dic = {i:0 for i in range(n1)}
se = set()
for i in range(m1):
    n,m = input().split()
    if n not in se and m == "WA":
        dic[int(n)-1] += 1
    else:
        se.add(n)
print(len(se),sum([dic[i] for i in range(n1)]))

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)]
lin = [0]*(n+1)

cor = 0
wor = 0

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

Submission status: Wrong Answer

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


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


N, M = read_ints()
flgs = [False] * N  # N問をACしたか
n_ac = 0
n_wa = 0
for _ in range(M):
    p, s = input().split()
    p = int(p) - 1
    if flgs[p]:
        continue

    if s == 'AC':
        flgs[p] = True
        n_ac += 1
    elif s == 'WA':
        n_wa += 1

print(n_ac, n_wa)

Submission status: Wrong Answer

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