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 = input().split()
n = int(n)
m = int(m)

result_list = []

# 正解した問題を入れるlist
done_list = []
correct = 0
pn = 0

for i in range(m):
    a,b=input().split()
    
    if a in done_list:
        pass
    elif b == "WA":
        pn += 1
    elif b == "AC":
        done_list.append(a)
        correct += 1

print(correct, pn)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ST=['WA'] * N
OK=0
NG=0
for i in range(M):
  c,s = map(str,input().split())
  c = int(c)
  if s == 'WA':
    if ST[c-1] != 'AC':
      NG += 1
  else:
    if ST[c-1] != 'AC':
      ST[c-1] = 'AC'
      OK += 1
print("{} {}".format(OK,NG))

Submission status: Wrong Answer

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

p = []
S = []

wa = 0
ac = 0

for i in range(M):
    P, s = list(map(str, input().split()))

    if s == 'WA':
        if int(P) in p:
            pass
        else:
            wa += 1
    else:
        if int(P) in p:
            pass
        else:
            ac += 1
            p.append(int(P))

print(ac, wa)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	N,M = inputMap()
	ansrs_AC = [0 for i in range(N)]
	ans1 = 0
	ans2 = 0
	for i in range(M):
		inp = input()
		inp = inp[:-1]
		p, S = inp.split(" ")
		pp = int(p)
		if S == "AC":
			if ansrs_AC[pp-1] == 1:
				continue
			else:
				ansrs_AC[pp-1] = 1
				ans1 += 1
		else:
			if ansrs_AC[pp-1] == 1:
				continue
			else:
				ans2 += 1

	ans = 0
	for i in ansrs_AC:
		if i == 1:
			ans += 1

	print("{} {}".format(ans, ans2))

if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
N, M = [int(i) for i in input().split()]
ans_list = [list(input().split()) for i in range(M)]
ref_list = [0]*N
pena_num = 0
for i, j in ans_list:
    if ref_list[int(i)-1]==0:
        if j == "WA":
            pena_num += 1
        else:
            ref_list[int(i)-1]=1
ok_count = 0
for i in ref_list:
    if i == 1:
        ok_count += 1
print(ok_count, pena_num)

Submission status: Wrong Answer

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

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

ans=0
pen=0

for i in l:
  for j in count:
    if i[0]==j[0]:
      if j[1]==1:
        if i[1]=='WA':
          pen+=1
        else:
          ans+=1
          j[1]*=0

print(ans,pen)

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))
#print(ps)
p_flag = [0]*N
ans_flag = [0]*N
cnt_ans = 0
cnt_p = 0
semi_cnt_p = 0
for i in range(M):
	if(p_flag[ps[i][0]-1] == 0 and ps[i][1] == "WA"):
		semi_cnt_p+=1
	if(ans_flag[ps[i][0]-1] == 0 and ps[i][1] == "AC"):
		cnt_ans+=1
		ans_flag[ps[i][0]-1]+=1
		p_flag[ps[i][0]-1]+=1
		cnt_p+=semi_cnt_p
		semi_cnt_p = 0
print(cnt_ans,cnt_p)

Submission status: Wrong Answer

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

ACList = []
WAcnt = 0
for i in range(M):
    s = input().split()
    if s[1] == 'AC' and s[0] not in ACList:
        ACList.append(s[0])
    elif s[1] == 'WA' and s[0] not in ACList:
        WAcnt += 1

print("{} {}".format(len(ACList), WAcnt))

Submission status: Wrong Answer

Solution code:
from sys import stdin as s
n,m=map(int,s.readline().split())
l=[0]*n
wa=[0]*n
pen=0
for i in range(m):
  x,y=s.readline().split()
  x=int(x)-1
  if y=="AC":
    l[x]=1
  elif not l[x] and not wa[x]:
    wa[x]=1
    pen+=1
print(sum(l),pen)

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()
    if AC[int(p)-1] ==0:
       if S == "WA":
            WA[int(p)-1] += 1
       else:
            AC[int(p)-1] = 1
    elif AC == [1]*N:
        break

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

Submission status: Wrong Answer

Solution code:
n, m = (int(i) for i in input().split())
p = [None] * m
s = [None] * m
for i in range(m):
    p[i], s[i] = (j for j in input().split())
    p[i] = int(p[i])

pena = [0] * n
ac   = [0] * n
for i in range(m):
    q_index = p[i]-1
    if s[i] == 'AC': 
        ac[q_index] = 1
    if s[i] == 'WA':
        if ac[q_index] == 0: pena[q_index] += 1

print(sum(ac), sum(pena))

Submission status: Wrong Answer

Solution code:
_,M = map(int,input().split())
result = {}
for i in range(M):
    P, Q = input().split()
    if P not in result:
        result[P] = [Q]
    else:
        if result[P][-1]=='AC':
            pass
        else:
            result[P].append(Q)
AC = 0
WA = 0
numbers = list(result.values())
for i in range(len(numbers)):
    AC += numbers[i].count('AC')
    WA += numbers[i].count('WA')
print(AC,WA)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

n, m = map(int, input().split())

an = [0]*n

sc = 0
er = 0

for i in range(m):
    t, s = map(str, input().split())
    p = int(t)-1
    if (an[p] == 0 and s == "AC"):
        sc += 1
        an[p] = 1
    elif (an[p] == 0 and s == "WA"):
        er += 1


print("{} {}".format(sc, er))

Submission status: Wrong Answer

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

p = [int(i[0]) for i in pS]
S = [i[1] for i in pS]

aced = [False for _ in range(N)]
penalty = [0 for _ in range(N)]
pena = 0

for i in range(len(pS)):
    if not aced[int(pS[i][0])-1]:
        if pS[i][1] == 'WA':
            # penalty[int(pS[i]i[0])-1] += 1
            pena += 1
        if pS[i][1] == 'AC':
            aced[int(pS[i][0])-1] = True

print(aced.count(True), pena)
# print(aced.count(True), sum(penalty))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
sub = [list(input().split()) for j in range(m)]
li = [[0 for i in range(n)]for j in range(2)]
for i in range(m):
    x = int(sub[i][0])-1
    if sub[i][1] == 'AC':
        if li[0][x] == 0:
            li[0][x] += 1
    elif li[0][x] == 0:
      	li[1][x] += 1
    else:
        break

ac = sum(li[0])
wa = sum(li[1])

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

Submission status: Wrong Answer

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

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:
n, m = map(int, input().split(' '))
ans = []
c = 0
p = 0 
for i in range(m):
  arr = list( input().split(' '))
  if ans.count(arr[0]) == 0:
    if arr[1] == 'WA':
      p += 1
    if arr[1] == 'AC':
      c += 1
      ans.append(arr[0])
      
print(c,p)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = []
S = []
flag = [0 for i in range(N)]
wa_cnt = [0 for i in range(N)]
ac_cnt = 0
#print(flag)

for i in range(M):
    pi, Si = input().split()
    p.append(int(pi))
    S.append(Si)
    

# print(p)
# print(S)

for i in range(M):
    # print("now",i)
    if(flag[p[i]-1]==1):
        continue
    else:
        if(S[i]=='WA'):
            wa_cnt[p[i]-1] += 1
        else:
            flag[p[i]-1] = 1
            ac_cnt += 1

# print(sum(wa_cnt))
# print(ac_cnt)
#print(flag)

print(ac_cnt, sum(wa_cnt))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

sumi = set()

correct = 0
penalty = 0

for i in range(NM[1]):
    s = input().split()
    if (s[0] in sumi):
        continue
    else:
        if (s[1] == "WA"):
            penalty += 1
        else:
            correct += 1
            sumi.add(s[0])

print(correct,penalty)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, Counter
from heapq import heapify, heappop, heappush
from sys import stdin

def main():
    n, m = map(int, input().split())
    ac_status = defaultdict(bool)
    wa_count = defaultdict(int)
    for _ in range(m):
        p, s = input().split()
        p = int(p)
        if s == "AC":
            ac_status[p] = True
        else:
            if ac_status[p] == False:
                wa_count[p] += 1
    ac = len([v for v in ac_status.values() if v])
    wa = sum([v for v in wa_count.values()])
    #print(ac_status)
    #print(wa_count)
    print(ac, wa)


input = lambda: stdin.readline().rstrip()
main()

Submission status: Wrong Answer

Solution code:
# N: 問題数
# M: 提出数
N, M = list(map(int, input().split()))

# 各問題の正答状態
answer_dict = {}

# 問題解答状態
class AnswerState:
    
    def __init__(self):
        self.wrong_num = 0         # 正解するまでのWA数
        self.is_corrected = False # 正解しているか
    
    def submit(self, is_correct):
        # まだ正解していない状態でWAを出した場合はペナルティ数を増やす
        if not is_correct and not self.is_corrected:
            self.wrong_num += 1
        # 正解したかどうか記録
        if is_correct:
            self.is_corrected = True

for _ in range(M):
    tmp = input().split()
    p_index = int(tmp[0])
    p_result = tmp[1]
    
    if not p_index in answer_dict:
        answer_dict[p_index] = AnswerState()
    
    answer_dict[p_index].submit(p_result == 'AC')

# 正解数、ペナルティ数を数える
correct_num = 0
penalty_num = 0

for state in answer_dict.values():
    if state.is_corrected:
        correct_num += 1
    penalty_num += state.wrong_num

print('%d %d' % (correct_num, penalty_num))

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000000)

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

ac_set = set()
wa_count = 0

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

    #  ACだった時の処理
    if s == 'AC':
        ac_set.add(p)
    elif s == 'WA':
        if p not in ac_set:
            wa_count += 1
    else:
        pass

ac_count = len(ac_set)

print('{} {}'.format(ac_count, wa_count))

Submission status: Wrong Answer

Solution code:
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]

n,m=map(int,input().split())
if m == 0:
  print(0)
s = [input().split() for i in range(m)]
p = get_unique_list(s)
ac = 0
wa = 0
for i in range(len(p)):
  if p[i][1] == 'AC':
    ac += 1
  elif p[i][1] == 'WA':
    wa += 1
print(str(ac)+" "+str(wa))

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys
input = sys.stdin.readline

N, M = list(map(int, input().split()))
# print(type(N))
arr = np.zeros((2, N), dtype=np.int)
for n in range(M):
    p, S = input().split()
    p = int(p)
    if arr[0][p-1] == 1:
        continue
    if S == 'AC':
        arr[0][p-1] = 1
    else:
        arr[1][p-1] += 1
ans = str(sum(arr[0])) + ' ' + str(sum(arr[1]))
print(ans)

Submission status: Wrong Answer

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

WA = [0 for i in range(N+1)]
AC = [0 for i in range(N+1)]

for i in range(M):
    if PS[i][1] == "WA":
        if AC[PS[i][0]] == 0:
            WA[PS[i][0]] += 1
    else:
        AC[PS[i][0]] = 1

pen,cor = 0,0
for i in range(N+1):
    pen += WA[i]
    cor += AC[i]

print(str(cor)+" "+str(pen))

Submission status: Wrong Answer

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

for _ in range(M):
  p_str, s = map(str, input().split())
  p = int(p_str)
  if p in ac:
    continue
  if s == 'AC':
    ac.append(p)
    ac.sort
  if s == 'WA':
    wa += 1

print(len(ac), wa)

Submission status: Wrong Answer

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

ac=[]
wa=0
for i in range(m):
  if l[i][1]=="AC":
    ac.append(l[i][0])
  elif l[i][1]=="WA":
    if (l[i][0] in ac) == False:
      wa += 1
    

    
print(len(set(ac)),wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
seikai = 0
matigai = 0
list = []
oklist = []
oklist.append(0)
for i in range(m):
    a,b=input().split()
    list.append((int(a), b))
    
for i in range(m):
    if list[i][1] == "WA":
        for j in range(len(oklist)):
            if list[i][0] == oklist[j]:
                break
            elif j == len(oklist) - 1:
                matigai += 1
    elif list[i][1] == "AC":
        for j in range(len(oklist)):
            if list[i][0] == oklist[j]:
                break
            elif j == len(oklist) - 1:
                seikai += 1
                oklist.append(list[i][0])
            
print(str(seikai)+" "+str(matigai))

Submission status: Wrong Answer

Solution code:
import numpy as np
N,M=map(int,input().split())

string_list=[input() for i in range(M)]
checkAC=np.zeros((N,2),np.int16)
for i in string_list:
    Ni,Si = i.split()
    Ni = int(Ni)-1
    if checkAC[Ni,0]==0:
        if Si=='AC':
            checkAC[Ni,0]=1
        else:
            checkAC[Ni,1]+=1

print(str(checkAC.sum(axis=0)[0])+' '+str(checkAC.sum(axis=0)[1]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
from itertools import groupby
from operator import itemgetter
def print_ans(N, M, ar):
    """Test Case
    >>> print_ans(2, 5, [['1', 'WA'], ['1', 'AC'], ['2', 'WA'], ['2', 'AC'], ['2', 'WA']])
    2 2
    >>> print_ans(100000, 3, [['7777', 'AC'], ['7777', 'AC'], ['7777', 'AC']])
    1 0
    >>> print_ans(6, 0, [])
    0 0
    """
    correct = 0
    wrong = 0
    if M == 0:
        print(0, 0)
    else:
        for (k, g) in groupby(ar, key=itemgetter(0)):
            tmp_worng = 0
            ac_flg = False
            for item in g:
                if item[1] == "AC":
                    correct += 1
                    ac_flg = True
                    break
                else:
                    tmp_worng += 1
            if ac_flg == True:
                wrong += tmp_worng
        print("{} {}".format(correct, wrong))

if __name__ == '__main__':
    N, M = map(int, input().rstrip().split())
    if M == 0:
        ar = []
    else:
        ar = [list(map(str, input().rstrip().split())) for i in range(M)]
    print_ans(N, M, ar)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math


def inputIntList():
  return [int(s) for s in input().split()]


def inputInt():
  return int(input())


def main():
  N, M = inputIntList()

  ac = 0
  wa = 0
  problem = ['' for _ in range(N)]
  for _ in range(M):
    for i, s in [input().split()]:
      i = int(i)-1
      if problem[i] == 'AC':
        continue
      else:
        problem[i] = s

      if problem[i] == 'WA':
        wa += 1
      else:
        ac += 1

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


if __name__ == "__main__":
  print(main())

Submission status: Wrong Answer

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

ac = 0
wa = 0
d = [False]*n

for _ in range(m):
    p, s = input().split()
    p = int(p)-1
    if not d[p] and s == 'AC':
        ac += 1
        d[p] = True
    elif s == 'WA':
        if not d[p]:
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split(' '))
wa_count = [0] * N
ac = [False] * N
rest_ac_num = N

WA = 'WA'

for i in range(M):
    _p, S = input().split(' ')
    p = int(_p) - 1

    #print(p, S)
    #print('wa_count', wa_count)
    #print('ac', ac)
    #print('rest_ac_num', rest_ac_num)
    if ac[p]:
        if rest_ac_num == 0:
            break
        continue

    if S == WA:
        wa_count[p] += 1
    else:
        ac[p] = True
        rest_ac_num -= 1

wa_total = 0
for c in wa_count:
    wa_total += c

print(N - rest_ac_num, wa_total)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
s = [[0,-1] for i in range(N)]
for i in range(M):
  tmp = input().split()
  p,S = int(tmp[0])-1, tmp[1]
  if s[p][1] < 0:
    if S == "AC": s[p][1] = s[p][0] + 1
    else: s[p][0] += 1
n_s, n_p = len([j for i,j in s if j>=0]), sum([i for i,j in s])
print(n_s, n_p)

Submission status: Wrong Answer

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

ok = 0
ng = 0
ng_tmp = 0
ok_l = []

for i in range(m):
  tmp = input().split()
  p = int(tmp[0])
  s = tmp[1]
  if s == 'AC' and ok_l.count(p) == 0:
    ok_l.append(p)
    ok += 1
    if ok_l.count(p) == 1:
      ng += ng_tmp
      ng_tmp = 0
  if s == 'WA' and ok_l.count(p) == 0:
    ng_tmp += 1
  
print(ok, ng)

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
p = []
S = []
for i in range(M):
    a, b = map(str,input().split())
    a = int(a)
    p.append(a)
    S.append(b)
ac_ans = 0
pn_ans = 0
ac_dict = dict()
pn_dict = dict()
for i in range(N):
    ac_dict[i] = 0
    pn_dict[i] = 0

for i in range(M):
    if S[i] == "AC":
        #tmp_dict[p[i]] = pn_dict[p[i]]
        if ac_dict[p[i]-1] == 0:
            ac_dict[p[i]-1] += 1
        else:
            pass
    else:
        if ac_dict[p[i]-1] == 0:
            pn_dict[p[i]-1] += 1
        else:
            pass
for i in range(N):
    ac_ans += ac_dict[i]
for i in range(N):
    pn_ans += pn_dict[i]
ac_ans = str(ac_ans)
pn_ans = str(pn_ans)
print(ac_ans + " " + pn_ans)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ps=[]
p=[]
s=[]
cnt=0
flag=[0 for i in range(n)]
for i in range(m):
  a=input()
  ps.append(a)
for i in range(m):
  b=ps[i][0]
  p.append(int(b))
  c=ps[i][2]+ps[i][3]
  s.append(c)
for i in range(m):
  if s[i]=="WA" and flag[p[i]-1]==0:
    cnt+=1
  if s[i]=="AC" and flag[p[i]-1]==0:
    flag[p[i]-1]=1
    #print(flag)
print(cnt)

Submission status: Wrong Answer

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

flg = [True] * N
A = [0] * N
Pen = [0] * N
for i, j in zip(p, S):
    if j == "AC":
        A[i - 1] = 1
        flg[i - 1] = False
    elif j == "WA" and flg[i - 1] == True:
        Pen[i - 1] += 1
    elif j == "WA" and flg[i - 1] == False:
        continue
print(sum(A), sum(Pen))

Submission status: Wrong Answer

Solution code:
N,  M = map(int, input().split())
p = []; S = []
for _ in range(M):
    pi, Si = input().split()
    p.append(pi)
    S.append(Si)

correct = 0; penalty = 0; AC_list = []; pre_code = ''
for pi, Si in zip(p, S):
    if pi in AC_list and pre_code == 'AC':
        continue
    else:
        if Si == 'WA':
            penalty += 1
            pre_code = 'WA'
        else:
            correct += 1
            AC_list.append(pi)
            pre_code = 'AC'
    
print(correct, penalty)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	N,M = inputMap()
	ansrs_AC = [0 for i in range(N)]
	ans1 = 0
	ans2 = 0
	for i in range(M):
		inp = input()
		inp = inp[:-1]
		p, S = inp.split(" ")
		pp = int(p)
		if S == "AC":
			if ansrs_AC[pp-1] == 1:
				continue
			else:
				ansrs_AC[pp-1] = 1
				ans1 += 1
		else:
			if ansrs_AC[pp-1] == 1:
				continue
			else:
				ans2 += 1


	print("{} {}".format(ans1, ans2))

if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
inf = [ int(a) for a in input().rstrip().split(' ')]
results = [[a for a in input().rstrip().split(' ')] for i in range(inf[1])]

solved = []
pennalty = 0

for sub in results:
    if not(sub[0] in solved):
        if sub[1] == 'AC':
            solved.append(sub[0])
        else:
            pennalty += 1
            
print('{} {}'.format(len(solved), pennalty))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p_L,s_L = [],[]
dic = {}
for i in range(10**5+1):
    dic[str(i)] = "0"
ac_dic = {}
wa_dic = {}
wa_L = []

counter = 0
for i in range(m):
    p,s = map(str,input().split())
    if s =="AC":
        ac_dic[p] = "AC"

    if dic[p] == "0":
        #wa_L.append(counter)
        counter = 0
    if s == "WA" and dic[p] != "0":
        counter += 1
        dic[p] = "WA"

mondai = set(p_L)

print(len(ac_dic),sum(wa_L))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = []
S = []
for _ in range(M):
    n, s = input().split()
    p.append(int(n))
    S.append(s)
wa = 0
ac = 0
ac_list = []
for i, s in enumerate(S):
    if s == "WA":
        if p[i] not in ac_list:
            wa += 1
    else:
        if p[i] not in ac_list:
            ac += 1
            ac_list.append(p[i])

print(ac, wa)

Submission status: Wrong Answer

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


for i in range(M):
    a,b = map(str,input().split())
    P.append(a)
    S.append(b)
ok = 0
pena = 0

for (i,j) in zip(P,S):
    if not i in total:
        
        if j=='WA':
            pena+=1
        else:
            ok+=1
            total.append(i)
print(str(ok)+' '+str(pena))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
x = []
y = []
z = []
for i in range(1, m+1):
    p, s = input().split()
    if s == 'AC':
        x.append(p)
    else:
        y.append(p)
for i in y:
    if i in x:
        z.append(i)
z = len(set(z))
x = len(set(x))
print(x, z)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
t = dict()
account,pena = 0,0
for i in range(m):
	s = input().split()
	if not s[0] in t.keys():
		t[s[0]] = s[1]
	else:
		if t[s[0]] == 'WA' and s[1] == 'WA':
			pena += 1
		elif t[s[0]] == 'WA' and s[1] == 'AC':
			pena += 1
			t[s[0]] = 'AC'
account = list(t.values()).count('AC')
pena += list(t.values()).count('WA')
print(account,pena)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
arr = []
pre_idx = '-1'
pre_s = 'start'
cnt = 0
errors = 0
ans = 0
flag = False
for i in range(M):
  idx,s = input().split()
  if pre_idx != idx:
    cnt = 0
    flag = False
  if flag:
    continue
  else:
    if s=='WA':
      cnt += 1
    else:
      errors += cnt
      ans += 1
      flag = True
  pre_idx = idx
  pre_s = s
    
print(ans,errors)

Submission status: Wrong Answer

Solution code:
N, M = [int(num) for num in input().split()]
c_sum = 0
c = []
f_sum = 0
for i in range(M):
    p, S = input().split()
    if S == 'WA' and p not in c:
        f_sum += 1
    elif S == 'AC' and p not in c:
        c.append(p)
print("{} {}".format(len(c), f_sum))

Submission status: Wrong Answer

Solution code:
import math
import numpy as np
from fractions import gcd
import fractions
import statistics
import collections
from functools import reduce
import itertools
from collections import defaultdict

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

wa_cnt = 0
ans = defaultdict(int)
for i in range(M):
    P,S = map(str, input().split())
    if (ans[P] == 1):
        continue
    if (S == 'AC'):
        ans[P] = 1
    else:
        wa_cnt +=1
 
print(len(ans), wa_cnt)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000000)

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

ac_set = set()
wa_count = 0

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

    #  ACだった時の処理
    if s == 'AC':
        ac_set.add(p)
    elif s == 'WA':
        if s not in ac_set:
            wa_count += 1
    else:
        pass

ac_count = len(ac_set)

print('{} {}'.format(ac_count, wa_count))

Submission status: Wrong Answer

Solution code:
a,s=input().split()
a=int(a) 
s=int(s)
A=[]
B=[]
ac=0
wa=0
for i in range(s):
  d,f=input().split()
  A.append(d)
  A.append(f)
  if f=="AC" and d not in B:
    ac+=1
    B.append(d)
for i in range(0,s,2):
  if A[i] in B and A[i+1]=="WA":
    wa+=1
print(ac,wa)

Submission status: Wrong Answer

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

p = [int(i[0]) for i in pS]
S = [i[1] for i in pS]

aced = [False for _ in range(N)]
penalty = [0 for _ in range(N)]
pena = 0

for i in pS:
    if not aced[int(i[0])-1]:
        if i[1] == 'WA':
            penalty[int(i[0])-1] += 1
            pena += 1
        if i[1] == 'AC':
            aced[int(i[0])-1] = True

print(aced.count(True), pena)
# print(aced.count(True), sum(penalty))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac = []
wa = []
for i in range(m):
  p,s = input().split()
  if p in ac:
    continue
  if s == 'AC':
    ac.append(p)
  else:
    wa.append(p)
print(len(ac),len(wa))

Submission status: Wrong Answer

Solution code:
n,m=list(map(int,input().split()))
question_dict_ac={}
question_dict_wa={}
question_list=[]
question_counter=0
answer_counter=m
while answer_counter > 0:
  question_num,result = input().split()
  if result=='AC':
    question_dict_ac[question_num]=[result]
  if result=='WA':
    if question_num not in question_dict_ac.keys():
       question_dict_wa[question_num]=[result]
  answer_counter-=1

print (len(question_dict_ac),len(question_dict_wa))

Submission status: Wrong Answer

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

ans = int(sum(record))
print(ans, penalty)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
n,m=map(int,input().split())
wa=0
ac=0
ig=0
l=[(input().split()) for _ in range(m)]
l=sorted(l, key=itemgetter(0))

for t in l:
  c,r=t[0],t[1]
  if c == ig:
    continue
  
  if r == 'WA':
    wa+=1
  elif r == 'AC':
    ac+=1
    ig=c
    
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
t=[]
while m>0:
    inp = input().split()
    t.append((inp[0], inp[1]))
    m-=1
a=[ele[1]for ele in set(t)]
print(a.count('AC'), a.count('WA'))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = [0] * M
S = [0] * M
count_AC = [0] * N
count_WA = [0] * N
for i in range(M):
    p[i],S[i] =  input().split()
    p[i] = int(p[i]) - 1

    if S[i] == 'AC':
        if count_AC[p[i]] == 0:
            count_AC[p[i]] = 1
            
    if S[i] == 'WA':
        if count_AC[p[i]] == 0:
            count_WA[p[i]] = count_WA[p[i]] + 1
            
print(sum(count_AC) , sum(count_WA))

Submission status: Wrong Answer

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

ans_list = []

for i in range(M):
    ans_list.append(input().split())

wa = 0
ac = 0
flag = 0

for n in range(1,N+1):

    for t in range(M):
        if ans_list[t][0] == str(n) and ans_list[t][1] == "AC":
            ac += 1
            break

        elif ans_list[t][0] == str(n) and ans_list[t][1] == "WA":
            wa += 1

print(ac, wa)

Submission status: Wrong Answer

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

for i in range(m):
    p, s =input().split()
    if s == "AC":
        if p in l:
            continue
        else:
            l.append(p)
    else:
        if p not in l:
            ans += 1

print(len(l), end=" ")
print(ans)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
s = [list(map(str, input().split())) for i in range(m)]
k = {}
for i in range(m):
    k[s[i][0]]=[]

for i in range(m):
    k[s[i][0]].append(s[i][1])

pena =0
ac =0

for i in k.keys():
    if "AC" not in k[str(i)]:
        pena += len(k[str(i)])
    else:
        for j in k[str(i)]:
            if j== "AC":
                ac+= 1
                break
            else: 
                pena+=1

print(ac,pena)