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())
lst=[None]*M
for i in range(M):
    p, S=input().split()
    lst[i]=(int(p), S)

#print(N, M, lst)
#count AC
AC_count = 0
WA_count = 0
AC_check=[0]*N
for i in range(M-1,-1,-1):
    #print(i)
    if lst[i][1]=='AC':
        AC_check[lst[i][0]-1]=i
#print(AC_check)


for i in range(1, N+1):
    if AC_check[i-1]:
        AC_count += 1
        WA_count+=lst[:AC_check[i-1]].count((i, 'WA'))

print(AC_count, WA_count)

Submission status: Wrong Answer

Solution code:
N,M = [int(x) for x in input().split()]
s = []
for i in range(M):
    array = list(map(str,input().split()))
    s.append(array)

answer = 0
penalty = 0

t = ["WA" for i in range(N)]
#print(t)
for i in range(M):
    if t[int(s[i][0])-1] == "WA":
        if s[i][1] == "WA":
            penalty+= 1
        else:
            answer += 1
            t[int(s[i][0])-1] = "AC"
print(answer,penalty)

Submission status: Wrong Answer

Solution code:
N,M = [int(x) for x in input().split()]
s = []
t = []
for i in range(M):
    array = list(map(str,input().split()))
    array1 = array[0]
    t.append(array1)
    s.append(array)

answer = 0
penalty = 0

import collections
c = collections.Counter(t)
t1 = list(c.keys())

for i in range(M):
    for j in range(len(t1)):
        if s[i][0] == t1[j]:
            if s[i][1] == "WA":
                penalty += 1
            else:
                answer += 1
                t1[j] = 0
print(answer,penalty)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split( ))
l = []
pen=0
ans=0
for i in range(m):
    I = list(input().split( ))
    if I[0] not in l:
        if(I[1]=='WA'):
            pen+=1
        else:
            ans+=1
            l.append(I[0])
print(ans,pen)

Submission status: Wrong Answer

Solution code:
problem,answer = map(int, input().split())
list = []
ac_count = 0
wa_count = 0
for i in range(answer):
    a,b = input().split()
    if not a in list:
        if b == "AC":
            list.append(a)
            ac_count += 1
        elif b == "WA":
            wa_count += 1
print("{} {}".format(ac_count, wa_count))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac_cnt = 0
wa_cnt = 0
ac_set = set() 
for i in range(m):
  blen = len(ac_set)
  p,s = input().split()
  if s == "AC":
    ac_set.add(p)
  alen = len(ac_set)
  if alen != blen and s == "AC":
    ac_cnt += 1
  if p not in ac_set and s == "WA":
    wa_cnt += 1
   
print(ac_cnt,wa_cnt)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac_cnt = 0
wa_cnt = 0
ac_list = []
for i in range(m):
  s = list(input().split())
  if s[0] not in ac_list:
    if s[1] == "AC":
      ac_cnt += 1
      ac_list.append(s[0])
    else:
      wa_cnt += 1
print(ac_cnt,wa_cnt)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict


def main():
    a = list(map(int, input().split()))
    inputs = [input().split() for i in range(a[1])]
    num_wa = 0
    num_ac = 0
    results = defaultdict(int)
    for i in inputs:
        if not results[i[0]]:
            if i[1] == "WA":
                num_wa += 1
            elif i[1] == "AC":
                num_ac += 1
                results[i[0]] = 1
    print(num_ac, num_wa)

 
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n,m = list(map(int,input().split()))
q = [list(map(str,input().split())) for i in range(m)]
res_list = [False]*n
pen_cnt = 0
for data in q:
    num = int(data[0])-1
    if res_list[num]:
        continue
    if str(data[1]) == "AC":
        res_list[num] = True
    else:
        pen_cnt += 1
print(str(res_list.count(True)) + " " + str(pen_cnt) )

Submission status: Wrong Answer

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

import sys
#input = sys.stdin.readline


def resolve():
    n, m = map(int, input().split())
    all_wa = 0
    all_ac = 0
    ac_list = []
    p_list, s_list = [], []
    first_ac_dic = {}

    wa_count_dic = {}
    wa_num = 0
    for i in range(m):
        p, s = input().split()
        p = int(p)
        p_list.append(p)
        s_list.append(s)

        if s == "AC":
            ac_list.append(p)
            all_ac += 1
            wa_num += wa_count_dic.get(p, 0)
        else:
            wa_count_dic[p] = wa_count_dic.get(p, 0) + 1

    sub_ac = len(ac_list) - len(set(ac_list))

    ans_ac = all_ac-sub_ac

    print(ans_ac, wa_num)


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

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

import sys
#input = sys.stdin.readline


def resolve():
    n, m = map(int, input().split())
    all_wa = 0
    all_ac = 0
    ac_list = []
    p_list, s_list = [], []
    first_ac_dic = {}
    for i in range(m):
        p, s = input().split()
        p = int(p)
        p_list.append(p)
        s_list.append(s)

        if s == "AC":
            ac_list.append(p)
            if not p in first_ac_dic.keys():
                first_ac_dic[p] = i
            all_ac += 1
        else:
            all_wa += 1

    sub_ac = len(ac_list) - len(set(ac_list))

    ans_ac = all_ac-sub_ac

    sub_wa = 0
    for i in range(m):
        if s_list[i] == "WA":
            if not p_list[i] in first_ac_dic.keys():
                continue
            if first_ac_dic[p_list[i]] < i:
                sub_wa += 1

    ans_wa = all_wa - sub_wa

    print(ans_ac, ans_wa)


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

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

import sys
#input = sys.stdin.readline


def resolve():
    n, m = map(int, input().split())
    p_list, s_list = [], []
    for i in range(m):
        p, s = input().split()
        p_list.append(int(p))
        s_list.append(s)

    sum_wa = 0
    ac_num = 0
    ac_list = []
    for i in range(m):
        if p_list[i] in ac_list:
            continue

        if s_list[i] == "AC":
            ac_num += 1
            ac_list.append(p_list[i])
        else:
            sum_wa += 1

    print(ac_num, sum_wa)

if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

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

P = ['WA'] * N
S = [0] * N

for _ in range(M):
    pi, si = list(input().split())
    pi = int(pi) - 1
    if P[pi] == 'WA':
        if si == 'WA':
            S[pi] += 1
        else:
            P[pi] = si


sum_AC = P.count('AC')
sum_WA = sum(S)

print(sum_AC, sum_WA)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
st = [list(input().split()) for i in range(m)]
if st != []:
  st.sort(key=lambda x: x[0])
  st.append(st[-1])
ans_cnt = 0
pnl_cnt = 0
flag = True
for i in range(m):
  if (flag == True) and (st[i][1] == 'WA'):
    pnl_cnt += 1
  elif (flag == True) and (st[i][1] == 'AC'):
    ans_cnt += 1
    flag = None 
  if st[i][0] != st[i+1][0]:
    flag = True
print(ans_cnt,pnl_cnt)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
st = [list(input().split()) for i in range(m)]
if st != []:
  st.append(st[-1])
ans_cnt = 0
pnl_cnt = 0
flag = True
for i in range(m):
  if (flag == True) and (st[i][1] == 'WA'):
    pnl_cnt += 1
  elif (flag == True) and (st[i][1] == 'AC'):
    ans_cnt += 1
    flag = None
    
  if st[i][0] != st[i+1][0]:
    flag = True
  
print(ans_cnt,pnl_cnt)

Submission status: Wrong Answer

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

WAc = 0
ACc = 0
temp = 0
for i in range(N):
    for j in range(len(ps[i])):
        if ps[i][j] == "WA": 
            temp += 1
        else:
            ACc += 1
            WAc += temp
            temp = 0
            break
print(ACc, WAc)

Submission status: Wrong Answer

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

WAc = 0
ACc = 0
for i in range(N):
    for j in range(len(ps[i])):
        if ps[i][j] == "WA": 
            WAc += 1
        else:
            ACc += 1
            break
print(ACc, WAc)

Submission status: Wrong Answer

Solution code:
n , m = map(int,input().split(" "))
c = []
ans = 0
pen = 0
for i in range(n):
    c.append(0)
for i in range(m):
    x , s = input().split(" ")
    p = int(x)
    if s == "AC":
        if c[p-1] == 0:
            c[p-1] = 1
            ans += 1
    elif s == "WA":
        if c[p-1] == 0:
            pen += 1
print(str(ans) + " " + str(pen))

Submission status: Wrong Answer

Solution code:
N,M = list(map(int,input().split()))
A = ['a']*N
B = [0]*N
ans1 = 0
ans2 = 0
for i in range(M):
  C,D = input().split()
  C = int(C)-1
  if A[C] == D == 'WA':
    ans1 += 1
    B[C] += 1
  if A[C] == 'a' and D == 'WA':
    ans1 += 1
    B[C] += 1
  if A[C] == 'WA' and D == 'AC':
    ans2 += 1
    A[C] = 'AC'
  if A[C] == 'a' and D == 'AC':
    ans2 += 1
    A[C] = 'AC'
for i in range(N):
  if A[i] == 'a':
    ans1 -= B[i]
print('{0} {1}'.format(ans1,ans2))

Submission status: Wrong Answer

Solution code:
N,M = list(map(int,input().split()))
A = ['a']*N
ans1 = 0
ans2 = 0
for i in range(M):
  C,D = input().split()
  C = int(C)-1
  if A[C] == D == 'WA':
    ans1 += 1
  if A[C] == 'a' and D == 'WA':
    ans1 += 1
  if A[C] == 'WA' and D == 'AC':
    ans2 += 1
    A[C] = 'AC'
  if A[C] == 'a' and D == 'AC':
    ans2 += 1
    A[C] = 'AC'
print('{0} {1}'.format(ans2,ans1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

n, m = map(int, input().split())
X = []

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


for _ in range(m):
    x, y = input().split()
    X += [(int(x), y)]

# X = sorted(X, key=itemgetter(0))

for (x, y) in X:
    if ac[x] == 0:
        if y == 'AC':
            ac[x] = 1
        if y == 'WA':
            wa[x] += 1
    print(x, y, sum(ac), sum(wa))


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

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

n, m = map(int, input().split())
X = []

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


for _ in range(m):
    x, y = input().split()
    X += [(int(x), y)]

X = sorted(X, key=itemgetter(0))

for (x, y) in X:
    if ac[x] == 0:
        if y == 'AC':
            ac[x] = 1
        if y == 'WA':
            wa[x] += 1

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

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
P = []
S = []
ac_list = []
pn = 0
for _ in range(m):
  P_, S_ = input().split()
  P.append(P_)
  S.append(S_)
for p, s in zip(P,S):
  if not p in ac_list:
    if s == 'WA':
      pn += 1
    elif s == 'AC':
      ac_list.append(p)
print(len(ac_list), pn)

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
ac_list = [0] * n
wa_list = [0] * n
for _ in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == "AC":
        ac_list[p] = 1
    if s == "WA":
        if 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())

d = {}

for i in range(m):
    p, s = map(str,input().split())
    if not p in d:
        d[p] = [0, 0]
    if s == 'WA' and d[p][1] == 0:
        d[p][0] += 1
    elif s == 'AC':
        d[p][1] = 1

ans = 0
pena = 0

for dict in d.values():
    pena += dict[0]
    if dict[1] == 1:
        ans += 1

print('{} {}'.format(ans, pena))

Submission status: Wrong Answer

Solution code:
n,m=list(map(int,input().split()))
ac,wa=0,0
aclis=[0]*n

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

Submission status: Wrong Answer

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

#新しい配列をfor文で任意の数作るコード
p=[]
q=[]
a_input=[0]*2
for i in range(num[1]):
    a_input=input().split()
    #print(a_input)
    #print(a_input[1])
    p.append(a_input[0])#受験した問題
    q.append(a_input[1])#結果（AC or WA）
r=[[0 for i in range(num[0])] for j in range(2)]
for i in range(num[1]):
    if (r[1][int(p[i])-1]==0) & (q[i]=="WA"):#ペナルティの計算
        r[0][int(p[i])-1]+=1#ペナルティ数増加
    if (r[1][int(p[i])-1]==0) & (q[i]=="AC"):#正解したことあるかどうかの判定
        r[1][int(p[i])-1]=1#正解したかどうかの記憶
seikaisu=0
pena=0
for i in range(num[0]):
    seikaisu+=r[1][i]
    pena+=r[0][i]
print(seikaisu,pena)

Submission status: Wrong Answer

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

wa = 0
ac = 0
ans = len(set(p))
for i, j in zip(p, S):
  if j == 'AC':
    ac += 1
    if ac == ans:
      break
  else:
    wa += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
Counted = []
num1 = 0
num2 = 0

for j in range(M):
  p, S = input().split()
  if S == "AC" and not p in Counted:
    num1 += 1
    Counted.append(p)
  elif S == "WA" and not p in Counted:
    num2 += 1
  else:
    continue

print("{} {}".format(num1, num2))

Submission status: Wrong Answer

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

#新しい配列をfor文で任意の数作るコード
p=[]
q=[]
a_input=[0]*2
for i in range(num[1]):
    a_input=input().split()
    #print(a_input)
    #print(a_input[1])
    p.append(a_input[0])#受験した問題
    q.append(a_input[1])#結果（AC or WA）
#print(p)
#print(q)
r=[[0]*num[0]]*2
#print(r)
#print()
for i in range(num[1]):
    #print(q[i],p[i])
    if (r[1][int(p[i])-1]==0) & (q[i]=="WA"):#ペナルティの計算
        r[0][int(p[i])-1]+=1
    if (r[1][int(p[i])-1]==0) & (q[i]=="AC"):#正解したことあるかどうかの判定
        r[1][int(p[i])-1]=1
seikaisu=0
pena=0
for i in range(num[0]):
    seikaisu+=r[1][i]
    pena+=r[0][i]
print(seikaisu,pena)

Submission status: Wrong Answer

Solution code:
nm = input().split()
n = int(nm[0])
m = int(nm[1])

p = []
r = []

for i in range(m):
	pr = input().split()
	p.append(int(pr[0]))
	r.append(pr[1])

ac = 0
wa = 0
flg = [False for i in range(n)]

if m != 0:
	for l in range(m):
		if r[l] == 'AC' and flg[p[l]-1] == False :
			ac += 1
			flg[p[l]-1] = True
		elif  flg[p[l]-1] == False :
			wa += 1

print(ac)
print(wa)

Submission status: Wrong Answer

Solution code:
nm = input().split()
n = int(nm[0])
m = int(nm[1])

p = []
r = []

for i in range(m):
	pr = input().split()
	p.append(int(pr[0]))
	r.append(pr[1])

ac = 0
wa = 0
cnt = 1

if m != 0:
	for l in range(m):
		if cnt < p[l]:
			while True:
				cnt += 1
				if cnt >= p[l]:
					break

			if r[l] == 'AC' :
				ac += 1
				cnt += 1
			else :
				wa += 1
		elif cnt > p[l]:
			continue
		else :
			if r[l] == 'AC':
				ac += 1
				cnt += 1 
			else: wa += 1

print(ac)
print(wa)

Submission status: Wrong Answer

Solution code:
nm = input().split()
n = int(nm[0])
m = int(nm[1])

p = []
r = []

for i in range(m):
	pr = input().split()
	p.append(int(pr[0]))
	r.append(pr[1])

ac = 0
wa = 0
cnt = 1

if m != 0:
	   for l in range(m):
	    if cnt < p[l]: 
	    	cnt += 1
	    elif cnt > p[l]:
	    	continue
	    else :
		    if r[l] == 'AC':
		        ac += 1
		        cnt += 1 
		    else: wa += 1

            
print(ac)
print(wa)

Submission status: Wrong Answer

Solution code:
nm = input().split()
n = int(nm[0])
m = int(nm[1])

p = []
r = []

for i in range(m):
	pr = input().split()
	p.append(int(pr[0]))
	r.append(pr[1])

ac = 0
wa = 0
cnt = 1

if m != 0:
	   for l in range(m):
	    if cnt < p[l]: 
	    	cnt += 1
	    elif cnt > p[l]:
	    	continue
	    else :
		    if r[l] == 'AC':
		        ac += 1
		        cnt += 1 
		        break
		    else: wa += 1

            
print(ac)
print(wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

wa = [0] * n
ac = [0] * n
for p, result in query:
    p = int(p) - 1
    if result == 'AC':
        ac[p] = 1
    if result == 'WA':
        if ac[p] == 0:
            wa[p] += 1

accept = 0
penalty = 0
for i in range(n):
    if ac[i]:
        penalty += wa[p]
        accept += 1

print(accept, penalty)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
li = []
ac = wa = 0
wa_temp = 0

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

for i in range(len(li)):

    if li[i][1] == "AC":
        ac += 1
        for j in range(0, i):  # 再検索
            if li[j] == li[i]:  # 同一AC
                ac -= 1
                wa_temp = 0
                break
            elif li[j] == [li[i][0], "WA"]:  # 同一問題のWA
                wa_temp += 1
        else:
            print("for else")
            wa += wa_temp
            wa_temp = 0

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac_li = []
ac = wa = 0

for i in range(m):
    p, s = input().split()
    p = int(p)
    for j in ac_li:
        if p == j:  # すでにACしてた場合
            break
    else:                  # ACリストにない場合
        if s == "WA":  # WAのとき
            wa += 1
        else:                 # ACのとき
            ac_li.append(p)
            ac += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
li = []
ac_li = []
ac = wa = 0

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

for i in range(len(li)):
    for j in ac_li:
        if li[i][0] == j:  # すでにACしてた場合
            break
    else:                  # ACリストにない場合
        if li[i][1] == "WA":  # WAのとき
            wa += 1
        else:                 # ACのとき
            ac_li.append(li[i][0])
            ac += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
li = []
ac_li = [[0, 0]]
ac = 0
wa = 0

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

for i in range(len(li)):
    for j in range(len(ac_li)):
        if li[i][0] == ac_li[j][0]:  # すでにACしてた場合
            break
    else:
        if li[i][1] == "WA":  # WAのとき
            wa += 1
        else:                 # 新たにACしとき
            ac_li.append(li[i],)
            ac += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m=map(int, input().split())
a=set()
d={}
pena=0
for i in range(m):
    p, s=input().split()
    if s=="AC" and p not in a:
        a.add(int(p))
        if p in d:
            pena+=d.pop(p)
    else:
        if p in d:
            d[p]+=1
        else:
            d[p]=1
print(len(a), pena)

Submission status: Wrong Answer

Solution code:
n, m=map(int, input().split())
a=set()
d={}
pena=0
for i in range(m):
    p, s=input().split()
    if s=="AC":
        a.add(int(p))
        if p in d:
            pena+=d.pop(p)
    else:
        if p in d:
            d[p]+=1
        else:
            d[p]=1
print(len(a), pena)

Submission status: Wrong Answer

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

pena=[0]*N
status=[0]*N


for i in range(M):
  p,s=tuple(input().split())
  p=int(p)
  if s=="WA":
    if status[p-1]!=1:
      pena[p-1]+=1
  if s=="AC":
    if status[p-1]!=1:
      status[p-1]=1
nac=sum(status)
npena=sum(pena)
print(nac, npena)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ac=[False for _ in range(N+1)]
wa=[0 for _ in range(N+1)]
for i in range(M):
    p,S=input().split()
    p=int(p)
    if S=='AC':
        ac[p]=True
    elif ac[p]==False:
        wa[p]+=1
print(sum(ac),sum(wa))

Submission status: Wrong Answer

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

l=list(input().split() for _ in range(m))

w=[0]*n
a=[0]*n

for i in l:
    k=int(i[0])-1
    if a[k]==0:
        if i[1]=="AC":
            a[k]+=1
        else:
            w[k]+=1

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

Submission status: Wrong Answer

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

l=list(input().split() for _ in range(m))

w=[0]*n
a=[0]*n

for i in l:
    k=int(i[0])-1
    if a[k]==0:
        if i[1]=="WA":
            w[k]+=1
        elif i[1]=="AC":
            a[k]+=1

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

Submission status: Wrong Answer

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

l=list(input().split() for _ in range(m))

q=[0]*n

w=0
a=0

for i in l:
    if q[int(i[0])-1]==0:
        if i[1]=="WA":
            w+=1
        elif i[1]=="AC":
            a+=1
            q[int(i[0])-1]+=1

print(a,w)

Submission status: Wrong Answer

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

l=list(input().split() for _ in range(m))

q=[0]*n

w=0
a=0

for i in l:
    if q[int(i[0])-1]==0:
        if i[1]=="WA":
            w+=1
        else:
            a+=1
            q[int(i[0])-1]+=1

print(a,w)

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

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

p = []
S = []
ans = 0
pena = 0
check = set()
for _ in range(M):
    l = list(map(str, input().split()))
    p.append(int(l[0]))
    S.append(l[1])

for i in range(M-1, -1, -1):
    if p[i] not in check:
        if S[i] == 'AC':
            check.add(p[i])
            ans += 1
    else:
        if S[i] == 'WA':
            pena += 1

print(ans, pena)

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

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

p = []
S = []
ans = 0
pena = 0
check = set()
for _ in range(M):
    l = list(map(str, input().split()))
    p.append(int(l[0]))
    S.append(l[1])

for i in range(M):
    if p[i] not in check:
        if S[i] == 'WA':
            pena += 1
        if S[i] == 'AC':
            check.add(p[i])
            ans += 1

print(ans, pena)

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 = input().split()
  p, s = int(p), str(s)
  if ac[p] == 1: continue

  if s == 'AC': ac[p] = 1
  else: wa[p] += 1

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

Submission status: Wrong Answer

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

for i in range(m):
  p1,s1 = map(str,input().split())
  p.append(int(p1))
  s.append(s1)

#0が正答したかどうか（正答が1）、1がペナルティの数
ans = [[0,0] for i in range(n)]

for i in range(m) :
  if s[i] == 'AC' :
    ans[p[i]-1][0] = 1
  if s[i] == 'WA' and ans[p[i]-1][0] == 0 :
    ans[p[i]-1][1] += 1

ac = 0
pe = 0
for i in range(n) :
  ac += ans[i][0]
  pe += ans[i][1]

print(ac,pe)

Submission status: Wrong Answer

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

for i in range(m):
  p1,s1 = map(str,input().split())
  p.append(int(p1))
  s.append(s1)

#0が正答したかどうか（正答が1）、1がペナルティの数
ans = [[0,0] for i in range(n)]

for i in range(m) :
  if s[i] == 'AC' :
    ans[p[i]-1][0] = 1
  if s[i] == 'WA' and ans[p[i]-1][0] == 0 :
    ans[p[i]-1][1] += 1

ac = 0
pe = 0
for i in range(n) :
  if ans[i][0] == 1 :
    ac += 1
  pe += ans[i][1]

print(ac,pe)

Submission status: Wrong Answer

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

wal=[0]*n
acl=[0]*n

for p,s in ps:
    p=int(p)-1
    if s=='AC' and acl[p] ==0:
        acl[p]+=1
    elif s=='WA' and acl[p] ==0:
        wal[p]+=1
print(acl)
print(wal)
wa=0
for i,ac in enumerate(acl):
    if ac == 1:
        wa+=wal[i]    
    
print(sum(acl),wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac_dir = {}
wa_dir = {}

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

print(sum(ac_dir.values()), sum(wa_dir.values()))

Submission status: Wrong Answer

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

for i in range(m):
    sub[i][0] = int(sub[i][0])

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

for i in range(m):
    if not sub[i][0] in set(solve_p) and sub[i][1] == 'WA':
        wa[sub[i][0]-1] +=1
    
    elif not sub[i][0] in set(solve_p) and sub[i][1] == 'AC':
        solve_p.append(sub[i][0])
        ac[sub[i][0]-1] += 1
    
    elif sub[i][0] in set(solve_p) and sub[i][1] == 'WA':
        continue
    
    elif sub[i][0] in set(solve_p) and sub[i][1] == 'AC':
        continue

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

Submission status: Wrong Answer

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

for i in range(m):
    sub[i][0] = int(sub[i][0])

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

for i in range(m):
    if not sub[i][0] in solve_p and sub[i][1] == 'WA':
        wa[sub[i][0]-1] +=1
    
    elif not sub[i][0] in solve_p and sub[i][1] == 'AC':
        solve_p.append(sub[i][0])
        ac[sub[i][0]-1] += 1
    
    elif sub[i][0] in solve_p and sub[i][1] == 'WA':
        continue
    
    elif sub[i][0] in solve_p and sub[i][1] == 'AC':
        continue

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

Submission status: Wrong Answer

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

for i in range(m):
    sub[i][0] = int(sub[i][0])

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

for i in range(m):
    if not sub[i][0] in solve_p and sub[i][1] == 'WA':
        wa[sub[i][0]-1] +=1
    
    elif not sub[i][0] in solve_p and sub[i][1] == 'AC':
        solve_p.append(sub[i][0])
        ac[sub[i][0]-1] += 1
    
    elif sub[i][0] in solve_p and sub[i][1] == 'WA':
        continue
    
    else:
        continue

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split(' '))
AC_dir = {}
WA_dir = {}
for i in range(M):
    p, S = input().split(' ')
    if int(p) <= N and S == 'AC' and p not in AC_dir:
        AC_dir[p] = 1
    elif int(p) <= N and S == 'WA' and p not in WA_dir and p not in AC_dir:
        WA_dir[p] = 1
    elif int(p) <= N and S == 'WA' and p in WA_dir and p not in AC_dir:
        WA_dir[p] += 1
print(sum(AC_dir.values()), sum(WA_dir.values()), sep=' ')

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split(' '))
AC_dir = {}
WA_dir = {}
for i in range(M):
    p, S = input().split(' ')
    if S == 'AC' and p not in AC_dir:
        AC_dir[p] = 1
    elif S == 'WA' and p not in WA_dir and p not in AC_dir:
        WA_dir[p] = 1
    elif S == 'WA' and p in WA_dir and p not in AC_dir:
        WA_dir[p] += 1
print(sum(AC_dir.values()), sum(WA_dir.values()), sep=' ')

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split(' '))
WA, AC, WA_tmp = 0, 0, 0
AC_dir = {}
for i in range(M):
    p, S = input().split(' ')
    if S == 'WA':
        WA_tmp += 1
    elif S == 'AC' and p not in AC_dir:
        WA += WA_tmp
        WA_tmp, AC_dir[p] = 0, 1
        AC += 1
print(AC, WA, sep=' ')

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
tlist = [input().split() for i in range(m)]
ac_count = 0
wa_count = 0
for i in range(m):
  if tlist[i][1] == "AC":
    ac_count += 1
    for j in range(i+1,m):
      if tlist[j][0] == tlist[i][0]:
        tlist[j][1] = "RE"
  elif tlist[i][1] != "RE":
    wa_count += 1
print(ac_count)
print(wa_count)

Submission status: Wrong Answer

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

q = [0]*n
t = [0]*n

for [p,s] in ps:
    p = int(p) - 1
    if s == "AC" and q[p] == 0:
        q[p] += 1
    elif s == "WA" and q[p]== 0:
        t[p] += 1



for nothing in range(m):
    a = int(q[p])
    b = int(t[p])
    if a == 0 and b != 0:
        t[p] == 0



print(sum(q),sum(t))

Submission status: Wrong Answer

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

q = [0]*n
t = [0]*n

for [p,s] in ps:
    p = int(p) - 1
    if s == "AC" and q[p] == 0:
        q[p] += 1
    elif s == "WA" and q[p]== 0:
        t[p] += 1

if sum(q) == 0:
    print(0,0)
    exit()


print(sum(q),sum(t))

Submission status: Wrong Answer

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

q = [0]*n
t = [0]*n

for [p,s] in ps:
    p = int(p) - 1
    if s == "AC" and q[p] == 0:
        q[p] += 1
    elif s == "WA" and q[p]== 0:
        t[p] += 1



print(sum(q),sum(t))

Submission status: Wrong Answer

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

q = [0]*n
t = [0]*n

for [p,s] in ps:
    p = int(p) - 1
    if s == "AC" and q[p] == 0:
        q[p] += 1
    elif s == "WA" and q[p]== 0:
        t[p] += 1



print(sum(q),sum(t))

Submission status: Wrong Answer

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

q = [0]*n
t = [0]*n

for [p,s] in ps:
    p = int(p) - 1
    if s == "AC" and q[p] == 0:
        q[p] += 1
    elif s == "WA" and q[p]== 0:
        t[p] += 1

print(sum(q),sum(t))