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())
wro = dict()
cor = set()

for _ in range(M):
    p, s = input().split()
    if s == 'AC':
        cor.add(p)
    elif s == 'WA' and p not in cor:
        wro[p] = wro.get(p, 0) + 1

print(len(cor), sum(wro.values()))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = dict()
t = []
ans, penalty = 0, 0
for _ in range(M):
  tmp = input().split()
  if tmp[0] in p:
    continue
  if tmp[1] == 'AC':
    p[tmp[0]] = 1
    ans += 1
  else:
    penalty += 1
print(ans, penalty)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = dict()
ans, penalty = 0, 0
for _ in range(M):
  tmp = input()
  if tmp[0] in p:
    continue
  if tmp[1] == 'AC':
    p[tmp[0]] = 1
    ans += 1
  else:
    penalty += 1
print(ans, penalty)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
(n, m,), *sub = [i.split() for i in open(0)]

r = {str(i+1): 0 for i in range(int(n))}
pen = 0
ac = 0
for p, s in sub:
    if r[p]<1:
        if s == "WA":
            pen += 1
        else:
            ac += 1
            r[p] = 1
print(ac, pen)

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
lst = [[] for i in range(N+1)]
for i in range(M):
    p,s = map(str,input().split())
    lst[int(p)].append(s)


ac = 0
wa = 0
for i in range(1,N+1):
    for submit in lst[i]:
        if submit == 'WA':
            wa += 1
        else:
            ac += 1
            break
print(ac,wa)

Submission status: Wrong Answer

Solution code:
import sys
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def Main():
    n,m = IL()
    sub = [0]*n
    c = 0
    t = 0
    for _ in range(m):
        p,s = SL()
        p = int(p)
        if sub[p-1]==1: continue

        if s=='AC':
            sub[p-1] = 1
            c += 1
        elif s=='WA':
            t += 1
    print(c,t)
    return

if __name__=='__main__':
    Main()

Submission status: Wrong Answer

Solution code:
import sys
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def Main():
    n,m = IL()
    sub = [0]*n
    t = 0
    for _ in range(m):
        p,s = SL()
        p = int(p)
        if sub[p-1]==0:
            if s=='AC':
                sub[p-1] = 1
            else:
                t += 1
    print(sub.count(1),t)
    return

if __name__=='__main__':
    Main()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
cnt = 0
pena = 0
L = [-1]*(n+1)
for _ in range(m):
  p, s = input().split()
  p = int(p)
  if s == "WA":
    if L[p] == -1:
      pena += 1
  else:
    if L[p] == -1:
      L[p] = 1
      cnt += 1
print(cnt, pena)

Submission status: Wrong Answer

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

WA=[0 for _ in range(N+1)]
solved=[False for _ in range(N+1)]
AC=0

for _ in range(M):
    P,S=input().split()
    P=int(P)
    
    if S=="AC" and solved[P]==False:
        AC+=1
        solved[P]=True
    elif S=="WA" and solved[P]==False:
        WA[P]+=1

print(AC,sum(WA))

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

N, M = I()
AC = [0]*N
WA = [0]*N
ac,wa = 0,0
for _ in range(M):
    s,t = L()
    s = int(s)-1
    if AC[s] == 0 and t == "WA":
        WA[s] += 1
    elif AC[s] == 0 and s == "AC":
        AC[s] = 1
        wa += WA[p]
        ac += 1

print(ac,wa)

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

N, M = I()
num = []
aa = []
WA = 0
AC = 0
correct = []

for i in range(M):
    s, t = L()
    if s in num:
        continue
    else:
        if t == "AC":
            AC += 1
            num.append(s)
            WA += count
            count = 0
        else:
            count += 1

print("{} {}".format(AC,WA))

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

N, M = I()
num = []
aa = []
WA = 0
AC = 0
correct = []

for i in range(M):
    s, t = L()
    if s in num:
        continue
    else:
        if t == "AC":
            AC += 1
            num.append(s)
        else:
            WA += 1

print("{} {}".format(AC,WA))

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

N, M = I()
num = []
aa = []
WA = 0
AC = 0
correct = []

for i in range(M):
    s, t = L()
    if s in num and t == "AC":
        continue
    else:
        if t == "AC":
            aa.append(t)
            num.append(s)
        else:
            aa.append(t)


for i in range(len(aa)-1,-1,-1):
    if aa[i] == "WA":
        count += 1
    else:
        break

a = aa.count("WA")-count
b = aa.count("AC")

print("{} {}".format(b,a))

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

N, M = I()
at = []
WA = 0
AC = 0
correct = []

for i in range(M):
    s = L()
    at.append(s)

for i in at:
    if i[1] == "WA":
        count += 1
    else:
        if i in correct:
            pass
        else:
            correct.append(i)
            WA += count
            AC += 1
            count =0

print("{} {}".format(AC,WA))

Submission status: Wrong Answer

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

AC = {}
WA = {}

for i in range(M):
    if P[i][0] in AC:  # すでにAC済みの場合
        continue
    if P[i][1] == "AC":  # はじめてのAC
        AC[P[i][0]] = True
        continue
    if not P[i][0] in WA:  # はじめてのWA
        WA[P[i][0]] = 1
    else:  # WA2回目以降
        WA[P[i][0]] += 1

WAsum = sum(WA.values())
print(len(AC), WAsum)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
lst=[0]*n
ac=0
wa=0
for i in range(m):
    num,result=input().split()
    num=int(num)-1
    if result=="AC":
        if lst[num]!=-1:
            lst[num]=-1
            ac+=1
    else:
        if lst[num]!=-1:
            wa+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
L=[0]*N
R=[0]*N
right=0
pena=0
for _ in range(M):
    p,s=input().split()
    p=int(p)
    p-=1
    if R[p]==0:
        if s=='AC':
          right+=1
          R[p]==1
          pena+=L[p]
        else:
            L[p]+=1

print(right,pena)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
L=[0]*N
right=0
pena=0
for _ in range(M):
    p,s=input().split()
    p=int(p)
    p-=1
    if L[p]==0:
        if s=='AC':
            right+=1
            L[p]=1
        else:
            pena+=1

print(right,pena)

Submission status: Wrong Answer

Solution code:
N,M = list(map(int,input().split()))
lis_AC = []
lis_WA = []
for i in range(M):
    p,s = input().split()
    if s == "AC":
        lis_AC.append(p)
    else:
        if p not in lis_AC:
            lis_WA.append(p)
lis_AC = set(lis_AC)
print(len(lis_AC), end = " ")
print(len(lis_WA))

Submission status: Wrong Answer

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

WA = [0] * (100000+1)
AC = [0] * (100000+1)

for i in range(M):
    p, s = list(map(str, input().split()))
    p = int(p)
    if s == 'AC':
        AC[p] = 1
    else:
        if AC[p] == 0:
            WA[p] += 1

for i in range(N):
    if AC[i] == 0:
        WA[i] = 0

print(sum(AC),end=' ')
print(sum(WA))

Submission status: Wrong Answer

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

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

for i in range(M):
    p, s = list(map(str, input().split()))
    p = int(p)
    if s == 'AC':
        AC[p] = 1
    else:
        if AC[p] == 0:
            WA[p] += 1

for i in range(N):
    if AC[i] == 0:
        WA[i] = 0

print(sum(AC),end=' ')
print(sum(WA))

Submission status: Wrong Answer

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

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

for i in range(M):
    p, s = list(map(str, input().split()))
    p = int(p)
    if s == 'AC':
        AC[p] = 1
    else:
        if AC[p] == 0:
            WA[p] += 1

print(sum(AC),end=' ')
print(sum(WA))

Submission status: Wrong Answer

Solution code:
def main():
    n, m = map(int, input().split())
    indic = {}
    wadic = {}
    AC = 0
    for i in range(m):
        a, b = map(str, input().split())
        a = int(a)
        if a in indic:
            if indic[a] == "WA" and b == "WA":
                wadic[a] += 1
            elif indic[a] == "WA" and b == "AC":
                indic[a] = "AC"
                AC += 1
        else:
            if b == "AC":
                indic[a] = "AC"
                AC += 1
            else:
                indic[a] = "WA"
                wadic[a] = 1
    WA = 0
    for key in wadic:
        WA += wadic[key]
    print(AC, WA)
                

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n, m = map(int, input().split())
    indic = {}
    wadic = {}
    AC = 0
    for i in range(m):
        a, b = map(str, input().split())
        a = int(a)
        if a in indic:
            if indic[a] == "WA" and b == "WA":
                if a in wadic:
                    wadic[a] += 1
                else:
                    wadic[a] = 1
            elif indic[a] == "WA" and b == "AC":
                indic[a] = "AC"
                AC += 1
        else:
            if b == "AC":
                indic[a] = "AC"
                AC += 1
            else:
                indic[a] = "WA"
                wadic[a] = 1
    WA = 0
    for key in wadic:
        WA += wadic[key]
    print(AC, WA)
                

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n, m = map(int, input().split())
    indic = {}
    wadic = {}
    AC = 0
    for i in range(m):
        a, b = map(str, input().split())
        a = int(a)
        if a in indic:
            if indic[a] == "WA" and b == "WA":
                if a in wadic:
                    wadic[a] += 1
                else:
                    wadic[a] = 1
            if indic[a] == "WA" and b == "AC":
                indic[a] = "AC"
                AC += 1
        else:
            if b == "AC":
                indic[a] = "AC"
                AC += 1
            else:
                indic[a] = "WA"
                wadic[a] = 1
    WA = 0
    for key in wadic:
        WA += wadic[key]
    print(AC, WA)
                

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, M = map(int, readline().split())

    AC = [False] * N
    ans = 0
    for _ in range(M):
        p, s = readline().split()
        p = int(p) - 1

        if AC[p]:
            continue
        if s == 'AC':
            AC[p] = True
        else:
            ans += 1

    print(sum(AC), ans)
    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


from collections import defaultdict
n,m = map(int, input().split())
d = {}
was = 0
acs = 0
for i in range(m):
    p, s = input().split()
    p = int(p)
    if s=="WA":
        if p not in d:
            d[p] = 1
        elif d[p]==-1:
            pass
        else:
            d[p] += 1
    else:
        if p not in d:
            d[p] = -1
            acs += 1
        elif d[p]>=0:
            was += d[p]
            acs += 1
print(acs, was)

Submission status: Wrong Answer

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

flag =[0]*n
count = 0

for i in range(m):
    if flag[int(ps[i][0])-1] == 0:
        if ps[i][1] == 'AC':
            flag[int(ps[i][0])-1] = 1
        elif ps[i][1] == 'WA':
            count += 1

print(sum(flag), count)

Submission status: Wrong Answer

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

li=[0]*M
for i in range(M):
    li[int(i)]=input().split()
#print(li)

count=0
flg=[0]*N
for i in range(M):
    if li[int(i)][1] == "AC":
        flg[int(li[int(i)][0])-1]=1
    if flg[int(li[int(i)][0])-1] == 0:
        count+=1

print(sum(flg), count)

Submission status: Wrong Answer

Solution code:
import numpy as np

N, M = map(int, input().split())
AC = np.zeros(N)
WA = np.zeros(N)

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

  if s == 'WA' and AC[int(p) - 1] == 0:
    WA[int(p) - 1] += 1
  else:
    AC[int(p) - 1] = 1

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
P = [0] * N
S = [0] * N
P_count = 0
S_count = 0

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

  if s == 'WA' and p not in P:
    S_count += 1
  if s == 'AC' and p not in P:
    P.append(p)
    P_count += 1

print(P_count, S_count)

Submission status: Wrong Answer

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

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

  if s == 'WA' and p not in P:
    S_count += 1
  if s == 'AC' and p not in P:
    P.append(p)
    P_count += 1

print(P_count, S_count)

Submission status: Wrong Answer

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

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

  if s == 'WA' and int(p) not in P:
    S_count += 1
  if s == 'AC' and int(p) not in P:
    P.append(int(p))
    P_count += 1

print(P_count, S_count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
A = [list(input().split()) for _ in range(M)]
C = {i:0 for i in range(1,N+1)}
cnt = 0
for j in range(M):
    p,s = A[j]
    p = int(p)
    if C[p]==0:
        if s=="WA":
            cnt += 1
        else:
            C[p] += 1
ac = 0
for i in range(1,N+1):
    ac += C[i]
print(ac,cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
AC = [0]*n
WA = [0]*n

for i in range(m):
    p, s = map(str, input().split())
    p = int(p)
    p -= 1
    if s == 'AC':
        AC[p] = 1
    else:
        if AC[p] != 1:
            WA[p] += 1

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    n,m = map(int, input().split())
    wa = 0
    ac = 0
    used = {}
    wa_tmp = 0
    for _ in range(m):
        p,s = map(str, input().split())
        if used.get(p):
            continue
        if s == 'WA':
            wa_tmp += 1
        if s == 'AC':
            ac += 1
            used[p] = True
            wa += wa_tmp
            wa_tmp = 0
    print(ac, wa)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    n,m = map(int, input().split())
    wa = 0
    ac = 0
    used = {}
    for _ in range(m):
        p,s = map(str, input().split())
        if used.get(p):
            continue
        if s == 'WA':
            wa += 1
        if s == 'AC':
            ac += 1
            used[p] = True
    print(ac, wa)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

questions = {i:False for i in range(1, N + 1)}
count_AC = 0
count_WA = 0

for _ in range(M):
    p, S = input().split()
    if not questions[int(p)]:
        if S == "WA":
            count_WA += 1
        elif S == "AC":
            count_AC += 1
            questions[int(p)] = True

print(count_AC, count_WA)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-06-29 12:50:48 +0900
# LastModified: 2020-06-29 12:58:45 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    n, m = map(int, input().split())
    which_ans = [0]*(n+1)
    penalty_cnt = [0]*(n+1)
    for _ in range(m):
        p, s = map(str, input().split())
        if which_ans[int(p)] == 0 and s == 'WA':
            penalty_cnt[int(p)] += 1
        elif which_ans[int(p)] == 0 and s == 'AC':
            which_ans[int(p)] = 1
    print(sum(which_ans), sum(penalty_cnt))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N, M = (int(x) for x in input().split())
B = [False]*N
ans = 0
pena = 0
for i in range(M):
  p, S = (str(x) for x in input().split())
  p = int(p)
  if S=="AC" and B[p-1]==False:
    B[p-1]=True
    ans+=1
  elif S=="WA" and B[p-1]==False:
    pena+=1
print(ans, end=" ")
print(pena)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac_list = [0]+[0]*n
wa_list = [0]+[0]*n

for _ in range(m):
    p,s = input().split()
    p = int(p)
    if s == 'AC':
        ac_list[p] = 1
    elif s == 'WA' and ac_list[p] == 0:
        wa_list[p] += 1

print(sum(ac_list),sum(wa_list))

Submission status: Wrong Answer

Solution code:
N,M  = map(int,input().split())
p_list=["WA"]*N
count = [0]*2
for  i in range(M):
    p,s = input().split()
    p = int(p)
    if(p_list[p-1]=="WA" and s=="WA"):
        count[1]+=1
    elif(p_list[p-1]=='WA' and s=="AC"):
        p_list[p-1]=s
        count[0]+=1 
print(' '.join(list(map(str,count))))

Submission status: Wrong Answer

Solution code:
N,M  = map(int,input().split())
p_list=["WA"]*N
count = [0]*2
for  i in range(M):
    p,s = input().split()
    p = int(p)
    if(p_list[p-1]==s and s=="WA"):
        count[1]+=1
    elif(p_list[p-1]=='WA' and s=="AC"):
        p_list[p-1]=s
        count[0]+=1 
print(' '.join(list(map(str,count))))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac = [0]*(n+1)
wa = [0]*(n+1)
for _ in range(m):
  p,s = tuple(input().split())
  p = int(p)
  if ac[p]==1: continue
  if s == 'WA': wa[p]+=1
  else: ac[p] = 1
print(sum(ac),sum(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):
  p,s = tuple(input().split())
  p = int(p)
  if ac[p]==1: continue
  if s == 'WA': wa[p]+=1
  else: ac[p]+=1
print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p = [0]*m
s = [0]*m
ans = [0]*n
pe = [0]*n

for i in range(m):
	p[i],s[i] = map(str,input().split())
	p[i] = int(p[i])
	if s[i] == 'AC' and ans[p[i]-1] == 0:
		ans[p[i]-1] += 1
		
	if ans[p[i]-1] == 0 and s[i] == 'WA':
		pe[p[i]-1] += 1
print(*[sum(ans),sum(pe)])

Submission status: Wrong Answer

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

A = []

for i in range(M):
    B = set(A)
    a, b = map(str, input().split())    
    a = int(a)
    if a in B:
        continue
    if b == "WA":
        p_temp += 1
    else:
        A.append(a)
        ans += 1
        p += p_temp
        p_temp = 0

print(ans, p)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    n,m = map(int, input().split())
    wa = 0
    ac = 0
    used = {}
    for i in range(m):
        p,s = map(str, input().split())
        if used.get(p):
            continue
        if s == 'WA':
            wa += 1
        if s == 'AC':
            ac += 1
            used[p] = True
            continue
    print(ac, wa)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    n,m = map(int, input().split())
    wa = 0
    ac = 0
    used = []
    for i in range(m):
        p,s = map(str, input().split())
        if p in used:
            continue
        if s == 'WA':
            wa += 1
        if s == 'AC':
            ac += 1
            used.append(p)
            continue
    print(ac, wa)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#import sys
#import numpy as np
#from collections import defaultdict



#input = sys.stdin.readline

def main():
    N,M = map(int,input().split())
    accept =[0] *(N+1)

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

    for i in range(M):
        p, s = input().split()
        p = int(p)
        if accept[p] ==0:
            if s =="AC":
                accept[int(p)] =1
                ac +=1
            else:
                wa[p] +=1
    print(ac,sum(wa))



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#import sys
#import numpy as np
#from collections import defaultdict



#input = sys.stdin.readline

def main():
    N,M = map(int,input().split())
    accept =[0] *(N+1)
    ac = 0
    wa = 0

    for i in range(M):
        p, s = input().split()
        if accept[int(p)] ==0:
            if s =="AC":
                accept[int(p)] =1
                ac +=1
            else:
                wa +=1
    print(ac,wa)



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
sp=[input().split() for _ in range (m)]
ac=[False]*(n+1)
a=0
b=0
for i in range(m):
    p=int(sp[i][0])
    s=sp[i][1]
    if ac[p]==False:
        if s=="AC":
            ac[p]=True
            a+=1
        else:
            b+=1
print(a,b)

Submission status: Wrong Answer

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

correct=[]
pena=0
for i in range(M):
    
    p,S = input().split()
    p = int(p)
    if S=='AC':
        correct.append(p)
    if S == 'WA':
        if p not in correct:
            pena+=1

print(len(set(correct)),pena)

Submission status: Wrong Answer

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

correct=[]
cor=0
pena=0
for i in range(M):
    
    p,S = input().split()
    p = int(p)
    if cor == N:
        ans.append([p,S])
    else:
        if S=='AC':
            if p not in correct:
                cor+=1
                correct.append(p)
        if S == 'WA':
            if p not in correct:
                pena+=1

print(cor,pena)

Submission status: Wrong Answer

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

correct=[]
cor=0
pena=0
for i in range(M):
    if cor == N:
        break
    if ans[i][1]=='AC':
        if ans[i][0] not in correct:
            cor+=1
            correct.append(ans[i][0])
    if ans[i][1]== 'WA':
        if ans[i][0] not in correct:
            pena+=1

print(cor,pena)

Submission status: Wrong Answer

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

correct=[]
cor=0
pena=0
for i in range(M):
    if ans[i][1]=='AC':
        if ans[i][0] not in correct:
            cor+=1
            correct.append(ans[i][0])
    if ans[i][1]== 'WA':
        if ans[i][0] not in correct:
            pena+=1

print(cor,pena)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
a = [0]*n
answ = [0, 0] 
for i in range(m):
    ind, ans = input().split()
    ind = int(ind)
    if a[ind-1] in [0, -1] and ans == 'WA':
        a[ind-1] = -1
        answ[1]+=1;
    elif a[ind-1] in [0, -1] and ans == 'AC':
        a[ind-1] = 1
        answ[0]+=1
    a[ind-1] = 1 if ans == 'AC' else -1
print(answ[0], answ[1])

Submission status: Wrong Answer

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

co = 0
pe = 0

ac= [0] * (n+1)

for _ in range(m):
    p, s = map(str, input().split())
    p = int(p)
    if ac[p]==0 and s == 'AC':
        co += 1
        ac[p] =1
    elif ac[p] == 0 and s == 'WA':
        pe += 1

print('{} {}'.format(co, pe))

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
answer_p = set()
submit_p= set()
count_pena=0
count_ans=0
count_wa=0

for _ in range(M):
  p,S= input().split()
  if p not in submit_p:
    count_wa=0
    submit_p.add(p)
  if p in answer_p:
    continue

  if S=='AC':
    count_ans+=1
    answer_p.add(p)
    count_pena+=count_wa
    count_wa=0
    continue
  else:
    count_wa+=1

print(count_ans, count_pena)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
answer_p = set()
submit_p= set()
L=[]
count_pena=0
count_ans=0
count_wa=0

for _ in range(M):
  p,S= input().split()
  if p not in submit_p:
    count_wa=0
    submit_p.add(p)
  if p in answer_p:
    continue

  L.append((p,S))
  if (p, 'AC') in L:
    count_ans+=1
    answer_p.add(p)
    count_pena+=count_wa
    count_wa=0
    continue
  else:
    count_wa+=1

print(count_ans, count_pena)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
answer_p = set()
submit_p= set()
count_ans=0
count_pena=0
count_wa=0
 
for _ in range(M):
  p,S= input().split()
 
  if p in answer_p:
    continue
  else:
    if p not in submit_p:
      count_wa = 0
    submit_p.add(p)
 
    if S=='WA':
      count_wa += 1
    elif S=='AC':
      count_ans += 1
      count_pena += count_wa
      answer_p.add(p)
 
print(count_ans, count_pena)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
answer_p = set()
submit_p= set()
count_pena=0
count_wa=0

for _ in range(M):
  p,S= input().split()

  if p in answer_p:
    continue
  else:
    #if p not in submit_p:
    #  count_wa = 0
    #submit_p.add(p)

    if S=='WA':
      count_wa += 1
    elif S=='AC':
      count_pena += count_wa
      answer_p.add(p)

print(len(answer_p), count_pena)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
answer_p = set()
submit_p= set()
count_pena=0
count_wa=0

for _ in range(M):
  p,S= input().split()

  if p in answer_p:
    continue
  else:
    if p not in submit_p:
      count_wa = 0
    submit_p.add(p)

    if S=='WA':
      count_wa += 1
    elif S=='AC':
      count_pena += count_wa
      answer_p.add(p)

print(len(answer_p), count_pena)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
set_p = set()
temp_p= set()
count_a=0
count_p=0
count_wa=0

for _ in range(M):
  p,S= input().split()

  if p in set_p:
    continue
  else:
    if p not in temp_p:
      count_wa = 0
    temp_p.add(p)

    if S=='WA':
      count_wa+=1
    else:
      count_a+=1
      count_p+=count_wa
      count_wa=0
      set_p.add(p)

print(count_a, count_p)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
set_p = set()
temp_p= set()
count_a=0
count_p=0
count_wa=0

for _ in range(M):
  p,S= input().split()

  if p in set_p:
    continue
  else:
    if p not in temp_p:
      count_wa = 0
    temp_p.add(p)

    if S=='WA':
      count_wa+=1
    else:
      count_a+=1
      count_p+=count_wa
      cont_wa=0
      set_p.add(p)

print(count_a, count_p)