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:
# -*- coding: utf-8 -*-
import sys

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

#str_lines = [x.strip("\n") for x in sys.stdin.readlines()]

#list_str_P_S = [input().split() for i in range(M)]
#print("list_str_P_S=",list_str_P_S)
#-----

count_AC=0
count_WA=0
check_question_no={}

#for L in list_str_P_S:
#  str_number = L[0]
#  result = L[1]

for i in range(M):
  str_number,result = input().split()
  
  #if ( str_number in check_question_no ):
  if (str_number in check_question_no):
    #print("continue")
    continue
  else:
    if result == "WA":
      count_WA += 1
      #print("L",L,count_AC,count_WA)
    elif result == "AC":
      count_AC += 1
      #check_question_no.append(str_number)
      check_question_no[str_number] = 1
      #print("L",L,count_AC,count_WA)
      
#print("ans=",count_AC,count_WA)
print(count_AC,count_WA)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
c=[0]*n
d=[0]*n
ans=0
res=0
#print(c,d)
while(k):
    a, b = list(map(str, input().split()))
    a=int(a)-1
    if d[a]==1:
        break
    elif b=="AC":
        d[a]=1
        ans+=1
        res+=c[a]
    elif b=='WA':
         c[a]+=1
    k-=1
print(ans,res)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
x = [0]*(n+1)
p,q=0,0
for i in range(m):
  k,l = map(str,input().split())
  y=int(k)
  if x[y-1]==0:
    if l=="WA":
      q+=1
    elif l=="AC":
      x[y-1]=1
      p+=1
print(p,q)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
resultList = [0 for i in range(n)]
#print(resultList)
ansAC = 0
ansWA = 0
for i in range(m) :
    result = input().split()
    prob = int(result[0]) - 1
    if result[1] == 'AC' and resultList[prob] == 0 :
        resultList[prob] = 1
        ansAC += 1
    if result[1] == 'WA' and resultList[prob] == 0 :
        ansWA += 1

print(ansAC, ansWA)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys

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

#str_lines = [x.strip("\n") for x in sys.stdin.readlines()]

#list_str_P_S = [input().split() for i in range(M)]
#print("list_str_P_S=",list_str_P_S)
#-----

count_AC=0
count_WA=0
check_question_no=[]

#for L in list_str_P_S:
#  str_number = L[0]
#  result = L[1]

for i in range(M):
  str_number,result = input().split()
  
  if ( str_number in check_question_no ):
    #print("continue")
    continue
  else:
    if result == "WA":
      count_WA += 1
      #print("L",L,count_AC,count_WA)
    elif result == "AC":
      count_AC += 1
      check_question_no.append(str_number)
      #print("L",L,count_AC,count_WA)
      
#print("ans=",count_AC,count_WA)
print(count_AC,count_WA)

Submission status: Wrong Answer

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

is_ac = [0] *(N + 1)
ans = [0,0]

for i in range(M):
    p, s = input().split()
    p = int(p)
    if not is_ac[p]:
        if s == "AC":
            is_ac[p] = 1
        else:
            ans[1] += 1

ans[0]=is_ac.count(1)
print(*ans)

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=input().split()
    p=int(p)
    if ac[p-1] == 1:#このテストをクリアしていたら飛ばす。
        continue
    
    if s=='AC':#テストをクリアしたらフラグをつける
        ac[p-1] = 1
    else:#テストをクリアするまでは失敗を繰り返す。
        wa[p-1] += 1
        
# 最終的に出力するものを決める
AC=0
WA=0
for i in range(n):
    AC += ac[i]#クリアした回数
    WA += wa[i]#クリアできなかった回数
print("{} {}".format(AC,WA))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
x = ['0']*(n+1)
p,q=0,0
for i in range(m):
  k,l = map(str,input().split())
  y=int(k)
  if x[y]!="AC":
    if l=="WA":
      q+=1
    else:
      x[y]="AC"
      p+=1
  	
print(p,q)

Submission status: Wrong Answer

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

is_ac = [0] *(N + 1)
ans = [0,0]

for i in range(M):
    p, s = input().split()
    p = int(p)
    if not is_ac[p]:
        if s == "AC":
          is_ac[p] = 1
        else:
          ans[1] += 1

ans[0]=is_ac.count(1)
print(*ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys

N,M = map( int, input().split() )
list_str_P_S = [input().split() for i in range(M)]
#-----

count_AC=0
count_WA=0
check_question_no=[]

for L in list_str_P_S:
  str_number = L[0]
  result = L[1]
  
  if ( str_number in check_question_no ):
    continue
  else:
    if result == "WA":
      count_WA += 1
    elif result == "AC":
      count_AC += 1
      check_question_no.append(str_number)
      
print(count_AC,count_WA)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
j=[0]*n #当たり保管所
c=[0]*n #はずれ保管所
print(j)
print(c)
pe=0
ac=0
for i in range(m):
  p,s=input().split()
  p=int(p)-1
  if s[0]=="A" and j[p]==0:
    #正解かつ当たり保管所のp番目が0(まだ正解はない)なら
    j[p]=1#正解が入る
    ac+=1#出力の正解数+1
    pe+=c[p]#正解が入ったタイミングではずれ保管所に蓄積したWAを出力の不正解に追加
  elif s[0]=="W":c[p]+=1#もしはずれだったらはずれ判定所のp番目を+1する(はずれの蓄積)
print(ac,pe)

Submission status: Wrong Answer

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

ac_list = [0] * (N + 1)
a = 0
w = 0
wa = 0
for i in range(M):
    l = input().split()
    if ac_list[int(l[0])]!='AC':
        if l[1] == 'AC':
            ac_list[int(l[0])] = 'AC'
            a += 1
            w = wa
        else:
            wa += 1

print('{} {}'.format(a, w))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
correct = defaultdict(bool)

N, M = map(int, input().split())
p = []
s = []
for i in range(M):
    a, b = input().split()
    p.append(int(a))
    s.append(b)
    
ac = 0
wa = 0
local_wa = 0


for pp in p:
    correct[pp] = False

for pp, ss in zip(p,s):
    if correct[pp]:
        continue
    else:
        if ss == 'AC':
            correct[pp] = True
            ac += 1
            wa += local_wa
            local_wa = 0

        elif ss == 'WA':
            local_wa += 1
print(ac, wa)

Submission status: Wrong Answer

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

ac_list = [0] * (N + 1)
a = 0
w = 0
wa = 0
for i in range(M):
    l = input().split()
    if ac_list[int(l[0])]!='AC':
        if l[1] == 'AC':
            ac_list[int(l[0])-1] = 'AC'
            a += 1
            w = wa
        else:
            wa += 1

print('{} {}'.format(a, w))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = []
s = []
for i in range(M):
    a, b = input().split()
    p.append(int(a))
    s.append(b)
from collections import defaultdict
correct = defaultdict(bool)

ac = 0
wa = 0
local_wa = 0
for pp in p:
    correct[pp] = False

for pp, ss in zip(p,s):
    if correct[pp]:
        wa += local_wa
        local_wa = 0
    else:
        if ss == 'AC':
            correct[pp] = True
            ac += 1
        elif ss == 'WA':
            local_wa += 1
print(ac, wa)

Submission status: Wrong Answer

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

ac = 0
wa = 0

x = 1
i = 0
cnt = 0
while x <= N:
    if i >= M:
        break
    if pS[i][0] != str(x):
        x += 1
        cnt = 0
        continue
    if pS[i][1] == 'WA':
        cnt += 1
        i += 1
    elif pS[i][1] == 'AC':
        ac += 1
        wa += cnt
        cnt = 0
        x += 1
        i += 1

print(ac, wa)

# 100000 6
# 7 WA
# 7 AC
# 8 WA
# 9 WA
# 9 AC
# 9 AC

Submission status: Wrong Answer

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

ac = 0
wa = 0

x = 1
i = 0
cnt = 0
while x <= N:
    if i >= M:
        break
    if pS[i][0] != str(x):
        x += 1
        continue
    if pS[i][1] == 'WA':
        cnt += 1
        i += 1
    elif pS[i][1] == 'AC':
        ac += 1
        wa += cnt
        cnt = 0
        x += 1
        i += 1

print(ac, wa)

# 100000 6
# 7 WA
# 7 AC
# 8 WA
# 9 WA
# 9 AC
# 9 AC

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
A = [input().split() for i in range(M)]
s1=list()
s2=list()
p=0
w=0
for i in range(M):
    if A[i][0] not in s2 and A[i][1]=="WA":
        s1 +=A[i][0]
        
    if A[i][0] not in s2 and A[i][1]=="AC":
        p+=1 
        s2 +=A[i][0]
        w += int(s1.count(A[i][0]))
print(p,w)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
A = [input().split() for i in range(M)]
s1=list()
s2=set()
p=0
w=0
for i in range(M):
    if A[i][0] not in s2 and A[i][1]=="WA":
        s1 +=A[i][0]
        
    if A[i][0] not in s2 and A[i][1]=="AC":
        p+=1 
        s2.add(A[i][0])
        w += int(s1.count(A[i][0]))
print(p,w)

Submission status: Wrong Answer

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

l = [input().split() for i in range(M)]

n = []
m = []

AC_cnt = 0
PE_cnt = []
for i in range(len(l)):
  n.append(l[i][0])
  m.append(l[i][1])
n = sorted(list(set(n)), key=n.index)

for j in range(len(n)):
  AC = 0
  PE = 0
  for i in range(M):
    if l[i][0] == n[j]:
      if l[i][1] == "AC":
        AC += 1
      else:
        if AC == 0:
          PE += 1
    else:
      pass
  if AC >= 1:
    AC_cnt += 1
  if PE >= 1:
    PE_cnt.append(PE)

print(AC_cnt,sum(PE_cnt))

Submission status: Wrong Answer

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

ac = 0
wa = 0

x = 1
i = 0
cnt = 0
while x <= N:
    if i >= M:
        break
    if pS[i][0] != str(x):
        x += 1
        cnt = 0
        continue
    if pS[i][1] == 'WA':
        cnt += 1
        i += 1
    elif pS[i][1] == 'AC':
        ac += 1
        wa += cnt
        x += 1
        i += 1

print(ac, wa)

# 100000 6
# 7 WA
# 7 AC
# 8 WA
# 9 WA
# 9 AC
# 9 AC

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
A = [input().split() for i in range(M)]
s1=list()
s2=set()
p=0
w=0
for i in range(M):
    if A[i][1]=="WA":
        s1 +=A[i][0]
        
    if A[i][0] not in s2 and A[i][1]=="AC":
        p+=1 
        s2.add(A[i][0])
        w += int(s1.count(A[i][0]))
print(p,w)

Submission status: Wrong Answer

Solution code:
n, m = [int(i) for i in input().split(" ")]
score_dict = {}
 
for i in range(m):
    p, s = input().split(" ")
    if p not in score_dict:
        score_dict[p] = []
    
    score_dict[p].append(s)
 
ac_count = 0
wa_count = 0
 
for i in score_dict.values():

    if "AC" in i:
        ac_count += 1
        wa_count += i.index("AC")
    else:
        wa_count += len(i)
 
print("{0} {1}".format(ac_count, wa_count))

Submission status: Wrong Answer

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

ac = 0
wa = 0

x = 1
i = 0
while x <= N:
    if i >= M:
        break
    if pS[i][0] != str(x):
        x += 1
        continue
    if pS[i][1] == 'WA':
        wa += 1
        i += 1
    elif pS[i][1] == 'AC':
        ac += 1
        x += 1
        i += 1

print(ac, wa)

# 100000 3
# 7 WA
# 7 AC
# 9 WA

Submission status: Wrong Answer

Solution code:
N , M = map(int , input().split(" "))
#N = 100000
#M = 100000
solve_problem = [0] * N 
ans = [0,0]

for i in range(0,M):
    ps = input().split(" ")
    if ps[1] == "AC":
        if solve_problem[ int(ps[0]) -1] == 0:
            solve_problem[int(ps[0]) -1] = 1
            ans[0] += 1
    elif ps[1] == "WA":
        if solve_problem[ int(ps[0])-1] == 0:
            ans[1] += 1

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

Submission status: Wrong Answer

Solution code:
import sys

inputs = list(map(lambda x: x.replace('\n',''), sys.stdin.readlines()))
n, m = map(int, inputs[0].split())

ans = []
for a in inputs[1:]:
  ans.append(a.split())


cc = 0
pc = 0

for i in range(n):
  for j in range(m):
    if int(ans[j][0]) == i+1:
      if ans[j][1] == "WA":
        pc = pc + 1
      elif ans[j][1] == "AC":
        cc = cc + 1
        break

print(cc, pc)

Submission status: Wrong Answer

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

l = [input().split() for i in range(M)]

n = []
m = []

AC_cnt = 0
PE_cnt = []
for i in range(len(l)):
  n.append(l[i][0])
  m.append(l[i][1])
n = sorted(list(set(n)), key=n.index)

for j in range(len(n)):
  AC = 0
  PE = 0
  for i in range(M):
    if l[i][0] == n[j]:
      if l[i][1] == "AC":
        AC += 1
      else:
        if AC == 0:
          PE += 1
    else:
      pass
  if AC >= 1:
    AC_cnt += 1
  if PE >= 1:
    PE_cnt.append(PE)

print(AC_cnt,sum(PE_cnt))

Submission status: Wrong Answer

Solution code:
'''input
100000 3
7777 AC
7777 AC
7777 AC
'''
# A coding delight
from sys import stdin, stdout
import gc
gc.disable()
input = stdin.readline



# main starts
n, m = list(map(int, input().split()))
ac = dict()
wa = dict()
w = 0
for _ in range(m):
	a, t = list(input().split())
	a = int(a)
	if t == 'AC':
		if a in ac:
			pass
		else:
			w += len(ac)
			if a in wa:
				w += wa[a]
			ac[a] = 1

	else:
		if a in ac:
			pass
		else:
			if a in wa:
				wa[a] += 1
			else:
				wa[a] = 1
print(len(ac), w)

Submission status: Wrong Answer

Solution code:
def main():
    N,M = map(int, input().split())
    l = []
    count_ac = 0
    for i in range(M):
        p,S = input().split()
        if S in 'AC':
            l.append([p,S])
            count_ac += 1
        else:
            if [p, 'AC'] in l:
                continue
            else:
                l.append([p, S])
    anc_wa = len(l) - count_ac
    print(count_ac, anc_wa)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
'''input
100000 3
7777 AC
7777 AC
7777 AC
'''
# A coding delight
from sys import stdin, stdout
import gc
gc.disable()
input = stdin.readline



# main starts
n, m = list(map(int, input().split()))
ac = dict()
wa = dict()
for _ in range(m):
	a, t = list(input().split())
	a = int(a)
	if t == 'AC':
		if a in ac:
			pass
		else:
			ac[a] = 1
	else:
		if a in ac:
			pass
		else:
			if a in wa:
				wa[a] += 1
			else:
				wa[a] = 1
count = len(ac)
count2 = 0

for i in wa:
	count2 += wa[i]
print(count, count2)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
 
n, m = map(int, input().split())
ac = 0
wa = defaultdict(lambda: 0) # wa = {} だと 存在しないkeyにおいて wa[key] = ○ で代入できない
already = set()
for line in range(m):
    p, s = input().split() # forでその都度入力を受け取る
    p = int(p)
    if p in already: # acを見つけたときのみalreadyにpをいれすので、ac後のwaのカウントを避けている。
        continue
    if s == 'AC':
        ac += 1
        already.add(p) # acするとalreadyにpを追加 集合への値追加はaddを用いる。
    else:
        wa[p] += 1 #{1: 3, 2: 2, 3: 0, 4: 5 ...}のように辞書が作られていく。
 
print(ac, sum(wa[i] for i in wa.keys()))

Submission status: Wrong Answer

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

l = [input().split() for i in range(M)]

n = []
m = []

AC_cnt = 0
PE_cnt = 0
for i in range(len(l)):
  n.append(l[i][0])
  m.append(l[i][1])
n = sorted(list(set(n)), key=n.index)

for j in range(len(n)):
  AC = 0
  PE = 0
  for i in range(M):
    if l[i][0] == n[j]:
      if l[i][1] == "AC":
        AC += 1
      else:
        if AC == 0:
          PE += 1
    else:
      pass
  if AC >= 1:
    AC_cnt += 1
  if PE >= 1:
    PE_cnt += 1

print(AC_cnt,PE_cnt)

Submission status: Wrong Answer

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

grid = []

for i in range(M):
    array = list(map(str, input().strip().split()))
    grid.append(array)

ac_list = [0]*N
wa_list = [0]*N

for a in grid:
    if a[1] == 'AC':
        ac_list[int(a[0]) - 1] = 1
    elif a[1] == 'WA' and ac_list[int(a[0]) - 1] != 1:
        wa_list[int(a[0]) - 1] = 1

print(str(sum(ac_list)) + ' ' + str(sum(wa_list)))

Submission status: Wrong Answer

Solution code:
'''input
100000 3
7777 AC
7777 AC
7777 AC
'''
# A coding delight
from sys import stdin, stdout
import gc
gc.disable()
input = stdin.readline



# main starts
n, m = list(map(int, input().split()))
ac = dict()
wa = dict()
for _ in range(m):
	a, t = list(input().split())
	a = int(a)
	if t == 'AC':
		if a in ac:
			pass
		else:
			ac[a] = 1
	else:
		if a in ac:
			pass
		else:
			if a in wa:
				wa[a] += 1
			else:
				wa[a] = 1
count = 0
count2 = 0
for i in ac:
	count += 1
for i in wa:
	count2 += wa[i]
print(count, count2)

Submission status: Wrong Answer

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

ans = []
for i in range(m):
  ans.append(input().split(" "))


cc = 0
pc = 0

for i in range(n):
  for j in range(m):
    if int(ans[j][0]) == i+1:
      if ans[j][1] == "WA":
        pc = pc + 1
      elif ans[j][1] == "AC":
        cc = cc + 1
        break

print(cc, pc)

Submission status: Wrong Answer

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

l = [input().split() for i in range(M)]

n = []
m = []
AC = 0
PE = 0
AC_cnt = 0
PE_cnt = 0
for i in range(len(l)):
  n.append(l[i][0])
  m.append(l[i][1])
n = sorted(list(set(n)), key=n.index)

for j in range(len(n)):
  for i in range(M):
    if l[i][0] == n[j]:
      if l[i][1] == "AC":
        AC += 1
      else:
        if AC == 0:
          PE += 1
    else:
      pass
  if AC >= 1:
    AC_cnt += 1
  if PE >= 1:
    PE_cnt += 1

print(AC_cnt,PE_cnt)

Submission status: Wrong Answer

Solution code:
'''input
100000 3
7777 AC
7777 AC
7777 AC
'''
# A coding delight
from sys import stdin, stdout
import gc
gc.disable()
input = stdin.readline



# main starts
n, m = list(map(int, input().split()))
ac = dict()
wa = dict()
for _ in range(m):
	a, t = list(input().split())
	a = int(a)
	if t == 'AC':
		if a in ac:
			pass
		else:
			ac[a] = 1
	else:
		if a in ac:
			pass
		else:
			if a in wa:
				wa[a] += 1
			else:
				wa[a] = 1
count = 0
count2 = 0
for i in ac:
	count += 1
for i in wa:
	count2 += 1
print(count, count2)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac_lst = [False] * (n + 1)
wa_lst = [0] * (n + 1)
w = ac = 0
for _ in range(m):
    a, b = input().split()
    a = int(a)
    if ac_lst[a]:
        continue
    if b == 'WA':
        wa_lst[a] += 1
    else:
        ac += 1
        w += wa_lst[a]
        ac_lst[a] = False
print(ac, w)

Submission status: Wrong Answer

Solution code:
import numpy as np

x = list(map(int, input().split()))

N, M = x[0], x[1]

ac, wa = np.array([0 for i in range(N)]), np.array([0 for i in range(N)])

for i in range(M):
    num, result = input().split()
    num = int(num) - 1

    if ac[num] == 1:
        pass
    else:
        if result == "AC":
            ac[num] = 1
        else:
            wa[num] += 1

print(np.sum(ac), np.sum(wa))

Submission status: Wrong Answer

Solution code:
import numpy as np

x = list(map(int, input().split()))

N, M = x[0], x[1]

ac, wa = np.array([0 for i in range(N)]), np.array([0 for i in range(N)])

for i in range(M):
    num, result = input().split()
    num = int(num) - 1
    print(num, result)

    if ac[num] == 1:
        pass
    else:
        if result == "AC":
            ac[num] = 1
        else:
            wa[num] += 1
            
print(np.sum(ac), np.sum(wa))

Submission status: Wrong Answer

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

a=[]
count=0
count_1=0

for j in range(M):
    if ps[j][0] in a:
        pass
    else:
        if ps[j][1]=="AC":
            count_1+=1
            a.append(ps[j][0])
        else:
            count+=1
print(count_1,count)

Submission status: Wrong Answer

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

penalty = 0

corrected = {}

for i in range(m):
  pi, si = input().split()
  if (si == 'AC' and not corrected.get(pi, False)):
    corrected[pi] = True
  elif (si == 'WA' and not corrected.get(pi, False)):
    penalty += 1

correct = len(corrected.keys())
print("{} {}".format(correct, penalty))

Submission status: Wrong Answer

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

penalty = 0

corrected = {}

for i in range(m):
  pi, si = input().split()
  if (si == 'AC' and not corrected.get(pi)):
    corrected[pi] = True
  elif (si == 'WA' and not corrected.get(pi)):
    penalty += 1

correct = len(corrected.keys())
print("{} {}".format(correct, penalty))

Submission status: Wrong Answer

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

a=[]
count=0
count_1=0

for j in range(M):
    if ps[j][0] in a:
        pass
    else:
        if ps[j][1]=="AC":
            count_1+=1
            a.append(ps[j][0])
        else:
            count+=1
print(count_1,count)

Submission status: Wrong Answer

Solution code:
# C - Welcome to AtCoder
n, m = map(int, input().split())

point = 0
pena_cnt = 0
penalty = 0
no = [0] * n

for i in range(0, m - 1):
    p, s = input().split()

    if no[int(p) - 1] == 1:
        pena_cnt = 0
        continue

    if s == 'WA':
        pena_cnt += 1
    else:
        point += 1
        penalty += pena_cnt
        pena_cnt = 0
        no[int(p) - 1] = 1

print(str(point) + " " + str(penalty))

Submission status: Wrong Answer

Solution code:
w,*d=[0]*10**6
a={0}
for t in open(0):
  p,s=t.split()
  p=int(p)
  if'AC'==s*(not p in a):w+=d[p];a|={p}
  d[p]+=1
print(len(a)-1,w)

Submission status: Wrong Answer

Solution code:
# C - Welcome to AtCoder
n, m = map(int, input().split())

point = 0
pena_cnt = 0
penalty = 0
no = [0] * n

for i in range(0, m - 1):
    p, s = input().split()

    if no[int(p) - 1] == 1:
        continue

    if s == 'WA':
        pena_cnt += 1
    else:
        point += 1
        penalty += pena_cnt
        pena_cnt = 0
        no[int(p) - 1] = 1

print(str(point) + " " + str(penalty))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac,wa=0,0
aced=0
p,s=0,0
l=[0 for _ in range(m)]
for i in range(m):
  p,s=input().split()
  p=int(p)
  l[i]=[p,s,i+1]
l.sort(key=lambda x: (x[0],x[2]))
#print(l)
cw=0
p=0
for i in range(m):
  s=l[i][1]
  r=p
  p=l[i][0]
  if aced!=p:
    if s=='AC':
      ac+=1
      aced=p
      wa+=cw
      cw=0
    else:
      if r==p:
        cw+=1
      else:
        cw=1

  #print(ac,wa,aced)

  
  

print(ac,wa)

Submission status: Wrong Answer

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

del_l = []
for j in range(m):
    if p[j][1] == 'AC':
        del_l.append(p[j][0])
        p[j][0] = ''
        p[j][1] = ''
    if p[j][1] == 'WA':
        p[j][0] = ''
        p[j][1] = ''
pen = 0
for s in range(m):
    if p[s][1] == 'WA' and p[s][0] in del_l:
        pen += 1
print(len(collections.Counter(del_l)),pen)

Submission status: Wrong Answer

Solution code:
import unittest


class TestC(unittest.TestCase):
    def test_1(self):
        self.assertEqual(
            think(2, [[1, 'WA'], [1, 'AC'], [2, 'WA'], [2, 'AC'], [2, 'WA']]),
            (2, 2)
        )

    def test_2(self):
        self.assertEqual(
            think(100000, [[7777, 'AC'], [7777, 'AC'], [7777, 'AC']]),
            (1, 0)
        )

    def test_3(self):
        self.assertEqual(
            think(6, []),
            (0, 0)
        )


def solve():
    n, list_of_p_and_s = read()
    result = think(n, list_of_p_and_s)
    write(result)


def read():
    n, m = read_int(2)
    list_of_p_and_s = []
    for _ in range(m):
        p_and_s = input().split(' ')[:2]
        list_of_p_and_s.append([int(p_and_s[0]), p_and_s[1]])
    return n, list_of_p_and_s


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(n, list_of_p_and_s):
    ac = [False for _ in range(n + 1)]
    penalty = [0 for _ in range(n + 1)]

    for p, s in list_of_p_and_s:
        if s == 'AC':
            ac[p] = True
        elif s == 'WA':
            if ac[p]:
                continue
            penalty[p] += 1
        else:
            raise RuntimeError()

    return len(list(filter(lambda x: x, ac))), sum(penalty)


def write(result):
    print('{0:d} {1:d}'.format(result[0], result[1]))


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

Submission status: Wrong Answer

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

is_ac = [0 for i in range(n)]
cnt_wa = [0 for i in range(n)]
for p, s in ans:
  p = int(p) - 1
  if is_ac[p]:
    continue
  if s == 'AC':
    is_ac[p] = 1
  else:
    cnt_wa[p] += 1

cor = sum(is_ac)
pena = 0
for c in is_ac:
  if c:
    pena += 1

print(cor, pena)

Submission status: Wrong Answer

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

ac = 0
wac = 0
count = [0 for x in range(n+1)]

for i in range(m):
  a , b = input().split()
  c = int(a)
  if n >= 0:
    if b == "AC":
      ac += 1
      wac += count[c]
      count[c] = -1
    else:
      count[c] += 1

print(ac, wac)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac,wa=0,0
aced=0
p,s=0,0
l=[0 for _ in range(m)]
for i in range(m):
  p,s=input().split()
  p=int(p)
  l[i]=[p,s,i+1]
l.sort(key=lambda x: (x[0],x[2]))
#print(l)
cw=0
p=0
for i in range(m):
  s=l[i][1]
  p=l[i][0]
  if aced!=p:
    if s=='AC':
      ac+=1
      aced=p
      wa+=cw
      cw=0
    else:
      cw+=1

  #print(ac,wa,aced)

  
  

print(ac,wa)

Submission status: Wrong Answer

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

ac = 0
wac = 0
count = [0 for x in range(n+1)]

for i in range(m):
  a , b = input().split()
  c = int(a)
  if n >= 0:
    if n == "AC":
      ac += 1
      wac += count[c]
      count[c] = -1
    else:
      count[c] += 1

print(ac, wac)

Submission status: Wrong Answer

Solution code:
a,b = map(int, input().split())
List = [input().split() for i in range(b)]
Wnum = 0
Cnum = 0
aclist = []
for i in range(len(List)):
#  print(i)
  if List[i][1] == 'WA':
    if [List[i][0], 'AC']  in aclist:
      break
    else:
      Wnum += 1
 #     print("WA", Wnum)
  else:
    if List[i] in aclist:
      break
    else:
      aclist.append(List[i])
      Cnum += 1
#      print(aclist)

print(Cnum, Wnum)

Submission status: Wrong Answer

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

count=0
count_1=0

for i in range(1,N+1):
    for j in range(M):
        if ps[j][0]==str(i):
            if ps[j][1]=="AC":
                count_1+=1
                break
            else:
                count+=1
print(count_1,count)

Submission status: Wrong Answer

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

del_l = []
for j in range(m):
    if p[j][1] == 'AC':
        del_l.append(p[j][0])
        p[j][0] = ''
        p[j][1] = ''
    if p[j][1] =='WA' and p[j][0] in del_l:
        p[j][0] = ''
        p[j][1] = ''
pen = 0
for s in range(m):
    if p[s][1] == 'WA':
        pen += 1
print(len(collections.Counter(del_l)),pen)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

#numAC = [0]*N
numWA = [0]*N
flgAC = [0]*N

#print(num)

for ii in range(M):
  pi,Si = input().split()
  pi = int(pi) - 1 #indexとして使うので-1する
  
  if flgAC[pi] == 0:
    if Si == "AC":
      #numAC[pi] = 1
      flgAC[pi] = 1
    elif Si == "WA":
      numWA[pi] += 1

countWA = 0
for ii in range(N):
  if flgAC == 1:
    countWA += numWA[ii]
print(np.sum(flgAC),countWA)

Submission status: Wrong Answer

Solution code:
# C - Welcome to AtCoder
n, m = map(int, input().split())

point = 0
pena_cnt = 0
penalty = 0
now = 0
flg = False
for i in range(0, m - 1):
    p, s = input().split()

    if p == now and flg:
        continue

    flg = False

    if s == 'WA':
        pena_cnt += 1
    else:
        point += 1
        penalty += pena_cnt
        flg = True
        pena_cnt = 0

    now = p

print(str(point) + " " + str(penalty))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC = set([])
ans_wa = 0
for i in range(M):
    p, S = input().split()
    p = int(p)
    if p in AC:
        continue
    if S == "AC":
        AC.add(p)
    else:
        ans_wa += 1
print(len(AC), ans_wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
if M==0:
    print(0,0)
    exit()
    
ACCNT=[False]*N
Asum=0
Wsum=0

for i in range(M):
    PI,SI=input().split()
    iii=int(PI)-1
    if ACCNT[iii]==False:
        if SI=="WA" :
            Wsum=Wsum+1
        elif SI=="AC" :
            ACCNT[iii]=True
            Asum=Asum+1

print(Asum,Wsum)

Submission status: Wrong Answer

Solution code:
# C - Welcome to AtCoder
n, m = map(int, input().split())

point = 0
pena_cnt = 0
penalty = 0
now = 0
flg = False
for i in range(0, m):
    p, s = input().split()

    if p == now and flg:
        continue

    flg = False

    if s == 'WA':
        pena_cnt += 1
    else:
        point += 1
        penalty += pena_cnt
        flg = True
        pena_cnt = 0

    now = p

print(str(point) + " " + str(penalty))

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
list_WA = [0] * N
list_Flag = [0] * N
for i in range(M):
  a, b = list(map(str, input().split()))
  a=int(a)
  if not list_Flag[a-1] == 1:
    if b=='WA':
      list_WA[a-1]=list_WA[a-1]+1
    elif b=='AC':
      list_Flag[a-1]=1
WA=sum(list_WA)
AC=sum(list_Flag)
print(AC,WA)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
f=set()
a,b=0,0
for i in range(m):
    x,y=input().split()
    z=int(x)
    if z not in f:
        if y=='WA':
            a+=1
        if y=='AC':
            b+=1
            f.add(z)
print(str(b)+' '+str(a))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

AC=[]
WA=[]
for i in range(M):
  p,s=input().split()
  if s=='AC':
    if not p in AC:
      AC.append(p)
  else:
    if not p in AC:
      WA.append(p)

print(len(AC),len(WA))