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:
# input here
_INPUT = """\
2 5
1 WA
1 AC
2 WA
2 AC
2 WA
"""

def main():
    n, m = map(int,input().split())
    ps = []
    for i in range(m):
        a,b=input().split()
        ps.append((int(a), b))

    if not ps:
        print(0,0)

    seikai = 0
    seikai2 = 0
    matigai = 0
    mozi = []
    

    for i in range(1,len(ps)):
        if ps[i-1][0] == ps[i][0]:
            if (ps[i-1][1] == "AC")&(ps[i][1]=="AC"):
                mozi.append(ps[i-1][0])
                continue
            else:
                if i == len(ps):
                    if ps[i][1] == "AC":
                        seikai += 1 
                if ps[i-1][1] == "AC":
                    seikai += 1
                else:
                    matigai += 1
                



        elif ps[i-1][1] == "AC":
            seikai += 1
        else:
            matigai += 1

    mozi = set(mozi) 
    seikai2 = len(mozi)
    seikai = seikai + seikai2
    
    print(seikai, matigai)

 
            
if __name__ == '__main__':
    import io
    import sys
    import math
    import itertools
    from collections import deque

    # sys.stdin = io.StringIO(_INPUT)
    main()

Submission status: Wrong Answer

Solution code:
# input here
_INPUT = """\
2 5
1 WA
1 AC
2 WA
2 AC
2 WA
"""

def main():
    n, m = map(int,input().split())
    ps = []
    for i in range(m):
        a,b=input().split()
        ps.append((int(a), b))

    if not ps:
        print(0,0)

    seikai = 0
    seikai2 = 0
    matigai = 0
    mozi = []
    

    for i in range(1,len(ps)):
        print(i)
        if ps[i-1][0] == ps[i][0]:
            if (ps[i-1][1] == "AC")&(ps[i][1]=="AC"):
                mozi.append(ps[i-1][0])
                continue
            else:
                if i == len(ps):
                    if ps[i][1] == "AC":
                        seikai += 1 
                if ps[i-1][1] == "AC":
                    seikai += 1
                else:
                    matigai += 1
                



        elif ps[i-1][1] == "AC":
            seikai += 1
        else:
            matigai += 1

    mozi = set(mozi) 
    seikai2 = len(mozi)
    seikai = seikai + seikai2
    
    print(seikai, matigai)

 
            
if __name__ == '__main__':
    import io
    import sys
    import math
    import itertools
    from collections import deque

    # sys.stdin = io.StringIO(_INPUT)
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n, m = map(int,input().split())
    solved = []
    missed = 0
    for i in range(m):
        temp = input().split()
        if(temp[0] in solved):
            pass
        else:
            if(temp[1]=='AC'):
                solved.append(temp[0])
            else:
                missed += 1
    print(len(solved), missed)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from sys import stdin
def main():
    n, m = map(int,input().split())
    problem = []
    ac = []
    for i in range(m):
        temp = stdin.readline().split()
        problem.append(temp[0])
        ac.append(temp[1])
    tuckled_problem = set(problem)
    solved = 0
    missed = 0
    for t in tuckled_problem:
        temp = [a for p,a in zip(problem, ac) if(p == t)]
        if('AC' in temp):
            solved += 1
            missed += temp.index('AC')
        else:
            missed += len(temp)
    print(solved, missed)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# input here
_INPUT = """\
2 5
1 WA
1 AC
2 WA
2 AC
2 WA
"""

def main():
    n, m = map(int,input().split())
    ps = []
    for i in range(m):
        a,b=input().split()
        ps.append((int(a), b))

    if not ps:
        print(0,0)

    seikai = 0
    seikai2 = 0
    matigai = 0
    mozi = []
    

    for i in range(1,len(ps)):
        if ps[i-1][0] == ps[i][0]:
            if (ps[i-1][1] == "AC")&(ps[i][1]=="AC"):
                mozi.append(ps[i-1][0])
                continue
            else:
                if ps[i-1][1] == "AC":
                    seikai += 1
                else:
                    matigai += 1


        elif ps[i-1][1] == "AC":
            seikai += 1

    mozi = set(mozi) 
    seikai2 = len(mozi)
    seikai = seikai + seikai2
    
    print(seikai, matigai)

 

        

            
if __name__ == '__main__':
    import io
    import sys
    import math
    import itertools
    from collections import deque

    # sys.stdin = io.StringIO(_INPUT)
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n, m = map(int,input().split())
    problem = []
    ac = []
    for i in range(m):
        temp = input().split()
        problem.append(temp[0])
        ac.append(temp[1])
    tuckled_problem = set(problem)
    solved = 0
    missed = 0
    for t in tuckled_problem:
        temp = [a for p,a in zip(problem, ac) if(p == t)]
        if('AC' in temp):
            solved += 1
            missed+= temp.index('AC')
        else:
            missed += len(temp)
    print(solved, missed)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

wa = Counter()

ac = set()

for i in range(M):
    p, s = input().split()
    p = int(p)
    if p in ac: continue
    if s == 'WA':
        wa[p] += 1
    else:
        ac.add(p)
print(len(ac), sum(wa.values()))

Submission status: Wrong Answer

Solution code:
import numpy as np

N, M = map(int,input().split())
AC = np.array([0 for i in range(N)])
WA = np.array([0 for i in range(N)])

for _ in range(M):
  p, S = map(str,input().split())
  p = int(p)
  if AC[p-1] == 0 and S == 'AC':
    AC[p-1] += 1
  elif AC[p-1] == 0 and S == 'WA':
    WA[p-1] += 1
    
for i in range(N):
  if AC[i] == 1:
    WA[i] = 0
    
print(AC.sum(),WA.sum())

Submission status: Wrong Answer

Solution code:
import numpy as np

N, M = map(int,input().split())
AC = np.array([0 for i in range(N)])
WA = np.array([0 for i in range(N)])

for _ in range(M):
  p, S = map(str,input().split())
  p = int(p)
  if AC[p-1] == 0 and S == 'AC':
    AC[p-1] += 1
  elif AC[p-1] == 0 and S == 'WA':
    WA[p-1] += 1
    
for i in range(N):
  if AC[i] >= 1:
    WA[i] = 0
    
print(AC.sum(),WA.sum())

Submission status: Wrong Answer

Solution code:
import numpy as np

N, M = map(int,input().split())
AC = np.array([0 for i in range(N)])
WA = np.array([0 for i in range(N)])

for _ in range(M):
  p, S = map(str,input().split())
  p = int(p)
  if AC[p-1] == 0 and S == 'AC':
    AC[p-1] += 1
  elif AC[p-1] == 0 and S == 'WA':
    WA[p-1] += 1
    
print(AC.sum(),WA.sum())

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
a=[0]*(10**5+1)
w=[0]*(10**5+1)

for _ in range(M):
  p,s=input().split()
  p=int(p)
  if s=='AC':
    a[p]=1
  else:
    if a[p]==0:
      w[p]+=1

print(sum(a), sum(w))

Submission status: Wrong Answer

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

penalty = 0
correct = 0
ok = [False] * (N + 1)
for i in range(M):
    query = input().split()
    p = int(query[0])
    S = query[1]
    if ok[p] == False:
        if S == 'AC':
            ok[p] = True
            correct += 1
        else: # S = 'WA'
            penalty += 1

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

Submission status: Wrong Answer

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

print(ac, pena)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


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


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


def solve():
    N, M = map(int, input().split())

    ac = [0] * N
    num_ac = 0
    num_pe = 0
    for i in range(M):
        P, S = input().split()
        P = int(P) - 1

        if S == "AC":
            if ac[P]:
                continue
            else:
                ac[P] = 1
                num_ac += 1
        else:
            if ac[P]:
                continue
            else:
                num_pe += 1

    print(num_ac, num_pe)


def main():
    solve()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
pp=[0]*n
qq=[True]*n
for i in range(m):
    i,j=input().split()
    i=int(i)
    i-=1
    if qq[i] and j=="AC":
        qq[i]=False
    if qq[i]:
        pp[i]+=1
a=qq.count(False)
b=sum(pp)
print(a,b)

Submission status: Wrong Answer

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

num = 0
w = 0
answered = False
ac = 0
wa = 0

for i in range(m):
  x,y = input().split()
  if x != num:
    num = x
    answered = False
    if y == 'AC':
      ac += 1
      w = 0
      answered = True
    else:
      w = 1
  else:
    if answered == False:
      if y == 'AC':
        ac += 1
        wa += w
        w = 0
        answered = True
      else:
        w = 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
d={}
ok=0
ng=0
for i in range(m):
    p,s=map(str,input().split())
    if not p in d:
        if s=="AC":
            ok+=1
            d[p]=s
        else:
            ng+=1
            d[p] = s
    else:
        if d[p]=="WA" and s=="AC":
            ok+=1
            d[p]="AC"
        elif d[p]=="WA" and s=="WA":
            ng+=1
print(ok,ng)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ll = [0 for _ in range(n+1)]
ac = 0
wa = 0
for i in range(m):
    pp, s = map(str, input().split())
    p = int(pp)
    if s == "AC" and ll[p] == 0:
        ac += 1
        ll[p] = 1
    elif s == "WA" and ll[p] == 0:
        wa += 1
    else:
        pass

print(ac,wa)

Submission status: Wrong Answer

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

print(ac,wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=[0]*n
d=[0]*n
for i in range(m):
    s=input().split()
    x=int(s[0])
    if(s[1]=='AC'):
        l[x-1]=1
    else:
        if(l[x-1]==1):
            continue
        else:
            d[x-1]+=1
print(sum(l),sum(d))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
a, w = 0, 0
P = set()
for _ in range(M):
    p, S = map(str, input().split())
    if p in P:
        continue
    if S == 'WA':
        w += 1
    if S == 'AC':
        a += 1
        P.add(p)
print(a, w)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ac = 0
wa = 0
arr = [0] * N
if M == 0:
  print(0)
  exit()
  
for i in range(M):
  p, s = list(input().split())
  p = int(p)
  if arr[p-1] != "AC":
    if s == "AC":
      arr[p-1] = "AC"
      ac += 1
    else:
      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)]
ac = 0
wa = 0
judge = [0]*n
for i in range(m): 
    if ps[i][1] == "AC" and judge[int(ps[i][0]) - 1] == 0:
        ac += 1
        judge[int(ps[i][0]) - 1] = 1
    elif ps[i][1] == "WA" and judge[int(ps[i][0]) - 1] == 0:
        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)]
ac = 0
wa = 0
for i in range(1, n+1):
    for j in range(m):
        if int(ps[j][0]) == i: 
            if ps[j][1] == "AC":
                ac += 1
                break
            elif ps[j][1] == "WA":
                wa += 1
print(ac, wa)

Submission status: Wrong Answer

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

will_AC = [False] * N
curr_AC = [False] * N
ac_count = penalty_count = 0
P = []
S = []

for _ in range(M):
    p, s = list(input().split())
    p = int(p) - 1

    P.append(p)
    S.append(s)

    if s == 'AC':
        will_AC[p] = True

for i in range(M):
    if S[i] == 'WA' and will_AC[P[i]] and not curr_AC[P[i]]:
        curr_AC[P[i]] = True
        penalty_count += 1

print(sum(will_AC), penalty_count)

Submission status: Wrong Answer

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

questions = [False] * N
ac_count = penalty_count = 0
P = []
S = []

for _ in range(M):
    p, s = list(input().split())
    p = int(p) - 1

    P.append(p)
    S.append(s)

    if s == 'AC':
        questions[p] = True

for i in range(M):
    if S[i] == 'WA' and questions[P[i]]:
        penalty_count += 1

print(sum(questions), penalty_count)

Submission status: Wrong Answer

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

questions = [False] * N
ac_count = penalty_count = 0

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

    if S == 'AC':
        if not questions[p]:
            ac_count += 1
            questions[p] = True
    else:
        if not questions[p]:
            penalty_count += 1

print(ac_count, penalty_count)

Submission status: Wrong Answer

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

ac=[0 for i in range(n+1)]
wa=[0 for i in range(n+1)]
for i in range(m):
    if pS[i][1]=="WA" and ac[int(pS[i][0])]==0:
        wa[int(pS[i][0])]+=1
    elif pS[i][1]=="AC":
        ac[int(pS[i][0])]=1
print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
AC=[0]*N
pts=0
pena=0
for i in range(M):
    a,b=map(str,input().split())
    if b=='AC':
        if AC[int(a)-1]==0:
            AC[int(a)-1]=1
            pts+=1
    else:
        if AC[int(a)-1]==0:
            pena+=1
print(pts,pena)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
account, wacount = 0, 0
acdic = [False] * (n + 10)
for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == "AC" and acdic[p] == False:
        account += 1
        acdic[p] = True
    elif s == "WA" and acdic[p] == False:
        wacount += 1
print(account, wacount)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
AC_List=[]
WA_ct = 0
for i in range(M):
    p,s = map(str,input().split())
    if s == "AC":
        AC_List.append(int(p))
    elif int(p) in AC_List:
        continue
    else:
        WA_ct += 1
AC_ct = len(set(AC_List))
print(str(AC_ct) + " " + str(WA_ct))

Submission status: Wrong Answer

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

ans = [["",0] for i in range(N)]
for i in range(M):
    p,S = map(str,input().split())
    p = int(p)-1
    if ans[p][0] != "AC":
        if S == "AC":
            ans[p][0] = "AC"
        else:
            ans[p][1] += 1

AC = 0
WA = 0
for i in ans:
    WA += i[1]
    if i[0] == "AC":
        AC += 1

print(AC,WA)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
count = [0]*N
ans = 0
ok = 1
for _ in range(M):
    p, s = input().split()
    if count[int(p)-1] >= 0 and s == "WA":
        count[int(p) - 1] += 1
    elif count[int(p)-1] >= 0 and s == "AC":
        ans += count[int(p)-1]
        count[int(p)-1] = -1
        ok += 1
print(ok, ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

n = M*[0]
m = M*['']
for i in range(M):
  n[i],m[i] = input().split()
  
n = list(map(lambda pi:int(pi),n))

wa = 0
ac = 0
pt = 0
for i in range(N):
  for j in range(M):
    if not n[pt] == i+1:
      break
    if m[pt] == 'WA':
      wa += 1
      pt += 1
    else:
      ac += 1
      pt += 1
      break
      
print(ac,wa)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readlines

from collections import defaultdict

def main():

    ac_num = 0
    pt_num = 0

    C = defaultdict(lambda: {"status":False, "penaulty":0} )

    lines = input()
    N, M = list(map(int, lines[0].split()))
    for i in range(1, M):
        pi, si = lines[i].split()
        pi = int(pi)
        if C[pi]["status"]:
            continue
        else:
            if si == "AC":
                C[pi]["status"] = True
                ac_num += 1
            else:
                C[pi]["penaulty"] += 1

    for i in range(1, N+1):
        if C[i]["status"]:
            pt_num += C[i]["penaulty"]

    print(ac_num, pt_num)

main()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readlines

from collections import defaultdict

def main():

    ac_num = 0
    pt_num = 0

    C = defaultdict(lambda:False)

    lines = input()
    N, M = list(map(int, lines[0].split()))
    for i in range(1, M):
        pi, si = lines[i].split()
        if C[pi]:
            continue
        else:
            if si == "AC":
                C[pi] = True
                ac_num += 1
            else:
                pt_num += 1

    print(ac_num, pt_num)

main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
hashmap = defaultdict(lambda: False)

N, M = map(int,input().split())
ac = 0
wa = 0
for i in range(M):
  p, s = input().split()
  if s == 'WA':
    if not hashmap[p]:
      wa+=1
  else:
    if not hashmap[p]:
      ac+=1
    hashmap[p] = True
print(ac, wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
hashmap = {}
ac = 0
wa = 0
for i in range(M):
  p, s = input().split()
  if s == 'WA':
    if p not in hashmap:
      hashmap[p] = False
      wa+=1
    elif not hashmap[p]:
      wa+=1
  else:
    if p not in hashmap:
      hashmap[p] = True
      ac+=1
    elif not hashmap[p]:
      hashmap[p] = True
      ac+=1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
hashmap = {}
ac = 0
wa = 0
for i in range(M):
  p, s = input().split()
  if s == 'WA':
    if p not in hashmap:
      hashmap[p] = False
      wa+=1
    elif not hashmap[p]:
      wa+=1
  else:
    if p not in hashmap:
      hashmap[p] = True
      ac+=1
    elif not hashmap[p]:
      ac+=1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
#C - Welcome to AtCoder
N,M = map(int,input().split())
S_P_list = []
for _ in range(M):
    p,s = input().split()
    S_P_list.append((int(p),s))
S_P_list = sorted(S_P_list,key = lambda x:x[0],reverse = False)    
print(S_P_list)
AC_list = list(set([i[0] for i in S_P_list if i[1] == 'AC']))
print(AC_list)
WA = 0
AC = 0
for i in range(M):
    if (S_P_list[i][0] in AC_list):
        if S_P_list[i][1] == 'AC':
            AC += 1
            AC_list.remove(S_P_list[i][0])
        else:
            WA += 1
print(AC,WA)

Submission status: Wrong Answer

Solution code:
#C - Welcome to AtCoder
N,M = map(int,input().split())
P = []
S = []
for _ in range(M):
    p,s = input().split()
    S.append(s)
    P.append(p)
    
WA = 0
AC = 0
AC_list = []
for i in range(M):
    if (P[i] in AC_list) == False:
        if S[i] == 'AC':
            AC += 1
            AC_list.append(P[i])
        else:
            WA += 1
print(AC,WA)

Submission status: Wrong Answer

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

pena=[0]*(n+1)
seitou=[0]*(n+1)

for i in range(m):
    p,s = map(str,input().split()) 
    p=int(p)
    if s=="WA" and seitou[p]==0:
        pena[p]+=1
    if s=="AC":
        seitou[p]=1

pena_kazu=0

for i in range(n):
    if seitou[i]==1:
        pena_kazu+=pena[i]

seitou_kazu=sum(seitou)

print(str(seitou_kazu)+" "+str(pena_kazu))

Submission status: Wrong Answer

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

pena=[0]*(n+1)
seitou=[0]*(n+1)

for i in range(m):
    p,s = map(str,input().split()) 
    p=int(p)
    if s=="WA" and seitou[p]==0:
        pena[p]+=1
    if s=="AC":
        seitou[p]=1

pena_kazu=sum(pena)
seitou_kazu=sum(seitou)

print(str(seitou_kazu)+" "+str(pena_kazu))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
dic = {}
ac = 0
wa = 0
for _ in range(m):
    p,s = map(str,input().split())
    p = int(p)
    if p not in dic:
        if s =='AC':
            ac += 1
            dic[p] = s
        else:
            wa += 1
            dic[p] = 1
    elif dic[p]=='AC':
        continue
    else:
        if s =='AC':
            ac += 1
            dic[p] = s
        else:
            wa += 1
            dic[p] += 1
for i in dic.values():
    if i !='AC':
        wa-=1
print(str(ac) + ' ' + str(wa))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
dic = {}
ac = 0
wa = 0
for _ in range(m):
    p,s = map(str,input().split())
    p = int(p)
    if p not in dic:
        if s =='AC':
            ac += 1
        else:
            wa += 1
        dic[p]=s
    elif dic[p]=='AC':
        continue
    else:
        if s =='AC':
            ac += 1
            dic[p] = s
        else:
            wa += 1
print(str(ac) + ' ' + str(wa))

Submission status: Wrong Answer

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

n,m = map(int, input().split())
p = [list(map(str,input().split())) for i in range(m)]
#p = [list(map(str,input().split())) for i in range(m)]


acNum = 0
peNum = 0

#acNumを求める
acd = {}
for i in range(m):
    if p[i][0] in acd:
        if p[i][1] == "AC" and acd[p[i][0]] == "WA":
            acNum+=1
            acd[p[i][0]] = "AC"

    else:
        if p[i][1] == "AC":
            acNum+=1
            acd[p[i][0]] = "AC"

ped = {}
pedNum = {}
for i in range(m):
    if p[i][0] in ped:
        if p[i][1] == "AC" and ped[p[i][0]] == "WA":
            peNum += pedNum[p[i][0]]
            ped[p[i][0]] ="AC"
        elif p[i][1] == "WA" and ped[p[i][0]] == "WA":
            pedNum[p[i][0]] += 1
    else:
        if p[i][1] == "WA":
            ped[p[i][0]] = "WA"
            pedNum[p[i][0]] = 1

print(acNum, peNum)

Submission status: Wrong Answer

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

n,m = map(int, input().split())
p = [list(map(str,input().split())) for i in range(m)]
#p = [list(map(str,input().split())) for i in range(m)]


acNum = 0
peNum = 0

#acNumを求める
acd = {}
for i in range(m):
    if p[i][0] in acd:
        if p[i][1] == "AC" and acd[p[i][0]] == "WA":
            acNum+=1
            acd[p[i][0]] = "AC"

    else:
        if p[i][1] == "AC":
            acNum+=1
            acd[p[i][0]] = "AC"

ped = {}
pedNum = {}
for i in range(m):
    if p[i][0] in ped:
        if p[i][1] == "AC" and ped[p[i][0]] == "WA":
            peNum += pedNum[p[i][0]]
            continue
        elif p[i][1] == "WA" and ped[p[i][0]] == "WA":
            pedNum[p[i][0]] += 1
    else:
        if p[i][1] == "WA":
            ped[p[i][0]] = "WA"
            pedNum[p[i][0]] = 1

print(acNum, peNum)

Submission status: Wrong Answer

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

n,m = map(int, input().split())
p = [list(map(str,input().split())) for i in range(m)]
#p = [list(map(str,input().split())) for i in range(m)]


acNum = 0
peNum = 0

#acNumを求める
acd = {}
for i in range(m):
    if p[i][0] in acd:
        if p[i][1] == "AC" and acd[p[i][0]] == "WA":
            acNum+=1
            acd[p[i][0]] = "AC"

    else:
        if p[i][1] == "AC":
            acNum+=1
            acd[p[i][0]] = "AC"

ped = {}
for i in range(m):
    if p[i][0] in ped:
        if p[i][1] == "AC" and ped[p[i][0]] == "WA":
            continue
    else:
        if p[i][1] == "WA":
            peNum+=1
            ped[p[i][0]] = "WA"

print(acNum, peNum)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ll = []
for i in range(M):
  a,b = input().split()
  ll.append((int(a),b))
chk = [False for i in range(N+1)]
ac_cnt = 0
pn_cnt = 0

for i in range(M):
  if not chk[ll[i][0]]:
    if ll[i][1]=='WA':
      pn_cnt += 1
    elif ll[i][1]=='AC':
      ac_cnt += 1
      chk[ll[i][0]] = True
print(ac_cnt, pn_cnt)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
k=[0]*(n+1)
wa_count=0
ac_count=0
for i in range(m):
    p,s=map(str,input().split())
    if s== "AC":
        if k[int(p)]==0:
            k[int(p)]=1
            ac_count += 1
    else:
        if k[int(p)]==0:
            wa_count += 1
ac=str(ac_count)
wa=str(wa_count)
print(ac+" "+wa)

Submission status: Wrong Answer

Solution code:
N,a=list(map(int,input().split()))
H=[input().split() for i in range(a)]
ans=[0]*2
end=[]
for i in range(a):
  if H[i][0] in end:
    pass
  elif H[i][1]=="WA":
    ans[1]+=1
  elif H[i][1]=="AC":
    ans[0]+=1
    end.append(H[i][0])
ans=" ".join(map(str,ans))
print(ans)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
ps = []
for i in range(m):
    p,s = map(str, input().split())
    ps.append((int(p),s))
num = [0]*n
ac = 0
wa = 0
for h in ps:
    if num[h[0]-1] != '@' and h[1] =='WA':
        num[h[0]-1] += 1
        wa += 1
    elif num[h[0]-1] != '@' and h[1] == 'AC':
        ac += 1
        num[h[0]-1] = '@'
print(ac,wa)

Submission status: Wrong Answer

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

ans = [[] for _ in range(N)]

for P in P:
    p = int(P[0])
    S = P[1]
    if ans[p - 1].count("AC") == 0:
        ans[p - 1].append(S)

AC = 0
WA = 0

for ans in ans:
    AC += ans.count("AC")
    WA += ans.count("WA")

print(AC, WA)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
r = {}
a = {}
for i in range(M):
    l = input().split()
    p = int(l[0])
    q = l[1]
    w = q + str(p)
    if r.get(p) == 'AC':
        pass
    else:
        r.update([(p, q)])
        if a.get(w) != None:
            a[w] += 1
        else:
            a.update([(w, 1)])
ks = [k for k, v in r.items() if v == 'AC']
wa = 0
ac = 0
for i in ks:
    wk = 'WA' + str(i)
    ak = 'AC' + str(i)
    if a.get(wk) != None:
        wa += a[wk]
    ac += a[ak]
print(wa, ac)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
r = {}
a = {'AC':0, 'WA':0}
for i in range(M):
    l = input().split()
    p = int(l[0])
    q = l[1]
    if r.get(p) == 'AC':
        pass
    else:
        r.update([(p, q)])
        a[q] += 1
o = '{} {}'.format(a['AC'], a['WA'])
print(o)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
r = {}
a = {'AC':0, 'WA':0}
for i in range(M):
    l = input().split()
    p = int(l[0])
    q = l[1]
    if r.get(p) == 'AC':
        pass
    else:
        r.update([(p, q)])
        a[q] += 1
print(a['AC'], a['WA'])