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())
correct = [0]*N
penalty = [0]*N
ans_c,ans_p = 0,0
for i in range(M):
    p,s = input().split()
    p = int(p)
    if s=="AC":
        if correct[p-1]==0:
            ans_c += 1
        correct[p-1]+=1
    if s=="WA":
        if correct[p-1]>0:
            x=1
        else:
            ans_p += 1

print(ans_c,ans_p)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
# sub_list = []
ac_list = []
ac = 0
penalty = 0
for i in range(M):
    pi, Si = input().split()
    if Si == "AC" and pi not in ac_list:
        ac_list.append(pi)
        ac += 1
    if Si == "WA":
        if pi not in ac_list:
            penalty += 1
print(ac, penalty)

Submission status: Wrong Answer

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

for i in range(M):
    p,s = input().split()
    p = int(p)
    if s=="AC":
        if correct[p-1]==0:
            correct[p-1] += 1
    if s=="WA":
        if correct[p-1]==0:
            penalty[p-1] += 1

print(sum(correct),sum(penalty))

Submission status: Wrong Answer

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

problems = []
results = []

for _ in range(m):
    line = input().split()
    problems.append(int(line[0]))
    results.append(line[1])

count_penalty = 0
count_ac = 0
ac_p = ""

for p, r in zip(problems, results):
    if r == "AC" and p != ac_p:
        ac_p = p
        count_ac += 1
    if r == "WA" and p != ac_p:
        count_penalty += 1
    
print("{} {}".format(count_ac, count_penalty))

Submission status: Wrong Answer

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

problems = []
results = []

for _ in range(m):
    line = input().split()
    problems.append(int(line[0]))
    results.append(line[1])

count_penalty = 0
count_ac = 0
ac_p = ""

for p, r in zip(problems, results):
    if r == "AC":
        ac_p = p
        count_ac += 1
    if r == "WA" and p != ac_p:
        count_penalty += 1
    
print("{} {}".format(count_ac, count_penalty))

Submission status: Wrong Answer

Solution code:
import collections

n, m = map(int, input().split())
problems = []
results = []
count = 0

for _ in range(m):
    line = input().split()
    problems.append(int(line[0]))
    results.append(line[1])

count_problems = len(collections.Counter(problems))
ac_p = ""
for p, r in zip(problems, results):
    if r == "AC":
        ac_p = p
    if r == "WA" and p != ac_p:
        count += 1
    
print("{} {}".format(count_problems, count))

Submission status: Wrong Answer

Solution code:
import collections

n, m = map(int, input().split())
problems = []
results = []
count = 0

for _ in range(m):
    line = input().split()
    problems.append(int(line[0]))
    results.append(line[1])

count_problems = len(collections.Counter(problems))

ac_p = ""
for p, r in zip(problems, results):
    if r == "AC":
        ac_p = p
    if r == "WA" and p != ac_p:
        count += 1
    
print(count_problems, count)

Submission status: Wrong Answer

Solution code:
import sys
n,m = map(int,input().split())
p = [list(map(str,input().split())) for _ in range(m)]
p.sort(key=lambda x:x[0])
acnt,wcnt,tmp = 0,0,0
if m == 0:
	print(0,0)
	sys.exit()
inx = '0'
for i in range(m):
	if p[i][0] != inx:
		if p[i][1] == 'AC':
				inx = p[i][0]
				acnt += 1
				wcnt += tmp
				tmp = 0
				print(inx)
				
		else:
			tmp += 1
print(acnt,wcnt)

Submission status: Wrong Answer

Solution code:
import sys
n,m = map(int,input().split())
p = [list(map(str,input().split())) for _ in range(m)]
box = []
acnt,wcnt,tmp = 0,0,0
if m == 0:
	print(0,0)
	sys.exit()
inx = '0'
for i in range(m):
	if p[i][0] != inx:
		if p[i][1] == 'AC':
				inx =p[i][0]
				acnt += 1
				wcnt += tmp
				tmp = 0
		else:
			tmp += 1
print(acnt,wcnt)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p = [list(map(str,input().split())) for _ in range(m)]
box = []
acnt,wcnt,tmp = 0,0,0
if m == 0:
	print(0,0)
#inx = p[0][0]
for i in range(m):
	if not p[i][0] in box:
		if p[i][1] == 'AC':
				box.append(p[i][0])
				acnt += 1
				wcnt += tmp
				tmp = 0
		else:
			tmp += 1
print(acnt,wcnt)

Submission status: Wrong Answer

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

correct=[]
data={}

for j in range(m):
    if p[j][0] in data.keys():
        if p[j][0] in correct:
            continue
        else:
            if p[j][1]=='WA': 
                data[p[j][0]]+=1
            else:
                correct.append(p[j][0])
    else:
        if p[j][0] in correct:
            continue
        else:
            if p[j][1]=='AC':
                correct.append(p[j][0])
            else:
                data[p[j][0]]=1

print(len(correct),sum(data.values()))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
lst=[list(input().split()) for i in range(m)]
x,y=0,0
cnt=['?']+[0]*n
for i in lst:
  if i[1]=='WA':
    pin=int(i[0])
    if cnt[pin]!='AC':
      y+=1
  elif i[1]=='AC':
    cnt[int(i[0])]='AC'

x=cnt.count('AC')

print(x,y)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
progress = {}
# initialize
for i in range(N):
  progress[str(i+1)] = "notCorrect"
correct = 0
penalty = 0
for i in range(M):
  question, result = map(str, input().split())
  if (progress[question] == "notCorrect"):
    if (result == "WA"):
      penalty += 1
    else:
      progress[question] = "correct"
      correct += 1
  else:
    continue
print(str(correct)+" "+str(penalty))

Submission status: Wrong Answer

Solution code:
# abc151_c.py
# https://atcoder.jp/contests/abc151/tasks/abc151_c

# C - Welcome to AtCoder /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 300点

# 問題文
# 高橋君は AtCoder のコンテストに参加しています。
# このコンテストでは、 N問の問題が出題されます。
# 高橋君はコンテスト中に M回の提出を行いました。
# i回目の提出は pi 番目の問題への提出であり、結果は Si(AC または WA) でした。
# 高橋君の正答数は、AC を 1回以上出した問題の数です。
# 高橋君のペナルティ数は、高橋君が AC を 1回以上出した各問題において、初めて AC を出すまでに出した WA の数の総和です。
# 高橋君の正答数とペナルティ数を答えてください。

# 制約
#     N, M , piは整数
#     1≤N≤10^5
#     0≤M≤10^5
#     1≤pi≤N
#     Siは AC か WA のいずれか

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N M
# p1 S1
# :
# pM SM

# 出力
# 高橋君の正答数とペナルティ数を出力せよ。

# 入力例 1
# 2 5
# 1 WA
# 1 AC
# 2 WA
# 2 AC
# 2 WA

# 出力例 1
# 2 2

# 高橋君が 1番目の問題に初めて AC を出したのは 2 回目の提出であり、これまでに 1 番目の問題で 1回 WA を出しています。
# 高橋君が 2番目の問題に初めて AC を出したのは 4 回目の提出であり、これまでに 2 番目の問題で 1回 WA を出しています。
# 以上より、高橋君の正答数は 2であり、ペナルティ数も 2です。

# 入力例 2
# 100000 3
# 7777 AC
# 7777 AC
# 7777 AC

# 出力例 2
# 1 0

# 同じ問題で何度 AC を出しても無意味であることに注意してください。

# 入力例 3
# 6 0

# 出力例 3
# 0 0


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    # S = lines[0]
    # N = int(lines[0])
    N, M = list(map(int, lines[0].split()))
    # values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    values = list()
    for i in range(M):
        values.append(lines[i+1])
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    lst = [[0, 0]] * N

    for m in range(M):
        p, S = values[m].split()
        p = int(p)
        if S == 'AC':
            # 正解フラグ
            # lst[p-1][0] = 1
            lst[p-1] = 1, lst[p-1][1]
        else:
            # ペナルティ数
            if lst[p-1][0] != 1:
                # lst[p-1][1] += 1
                lst[p-1] = lst[p-1][0], lst[p-1][1]+1

    log(f'lst=[{lst}]')

    ac = 0
    wa = 0
    for n in range(N):
        if lst[n][0] == 1:
            ac += 1
        wa += lst[n][1]

    result = str(ac) + ' ' + str(wa)

    return [result]


# 引数を取得
def get_input_lines():
    line = input()
    N, M = list(map(int, line.split()))
    lines = list()
    lines.append(line)
    for _ in range(M):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['2 5', '1 WA', '1 AC', '2 WA', '2 AC', '2 WA']
        lines_export = ['2 2']
    if pattern == 2:
        lines_input = ['100000 3', '7777 AC', '7777 AC', '7777 AC']
        lines_export = ['1 0']
    if pattern == 3:
        lines_input = ['6 0']
        lines_export = ['0 0']
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines()
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

maru = [0]*n
pena = [0]*n

for i in range(m):
    p,s = input().split()
    p = int(p)
    if s =="AC":
        maru[p-1] = 1
    else:
        if maru[p-1]==0:
            pena[p-1]+=1



print(maru.count(1),sum(pena))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import math
N, M = map(int,input().split())
#N = int(input())
#K = int(input())
#S = input()
ans = 0
#l = list(map(int,input().split()))
#A = list(map(int,input().split()))
F = [False] * (N+1)
P = [0] * (N+1)
l = []
for i in range(M):
    p, s = map(str,input().split())
    p = int(p)
    l.append([p, s])
    if s == "WA" and not F[p]:
        P[p] += 1
    if s == "AC" and not F[p]:
        ans += 1
        F[p] = True
pen = 0
#print(l)
for i in range(M):
    p = l[i][0]
    if F[p]:
        pen += P[p]
print(ans, pen)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import math
N, M = map(int,input().split())
#N = int(input())
#K = int(input())
#S = input()
ans = 0
#l = list(map(int,input().split()))
#A = list(map(int,input().split()))
F = [False] * (N+1)
pen = 0
for i in range(M):
    p, s = map(str,input().split())
    p = int(p)
    if s == "WA" and not F[p]:
        pen += 1
    if s == "AC" and not F[p]:
        ans += 1
        F[p] = True

print(ans, pen)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
data = [0]*N
solved = [False]*N
for _ in range(M):
    p, S = input().split()
    p = int(p) - 1
    if solved[p] == False and S == "WA":
        data[p] += 1
    if solved[p] == False and S == "AC":
        solved[p] = True

print(sum(solved),sum(data))

Submission status: Wrong Answer

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

for i in range(M):
  p, s = input().split()
  if s == "AC":
    if flag[int(p)-1] == False:
      ac+=1
      flag[int(p)-1] = True
  if s == "WA":
    if flag[int(p)-1] == False:
      wa+=1

print(ac,wa)

Submission status: Wrong Answer

Solution code:
from sys import stdin
import sys
import math
from functools import reduce
import itertools

n,m = [int(x) for x in stdin.readline().rstrip().split()]

check = [0 for i in range(n)]
count = [0 for i in range(n)]

for i in range(m):
    p, q = [x for x in stdin.readline().rstrip().split()]
    p = int(p)

    if q == 'AC':
        check[p-1] = 1

    if q == 'WA' and check[p-1] == 0:
        count[p-1] = count[p-1] + 1

print(sum(check), sum(count))

Submission status: Wrong Answer

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


for i in range(M):
    # print(AC_list)
    # print(WA_list)
    p, S = map(str,input().split())
    p = int(p)-1
    if S == "AC" and AC_list[p] == 0:
        AC_list[p] = 1
    elif S == "WA" and AC_list[p] == 0:
        WA_list[p] +=1
    else:
        continue


print("{} {}".format(sum(AC_list), sum(WA_list)))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
memo2 = [False for i in range(n)]
count1,count2 = 0,0
for i in range(m):
    p,l = input().split()
    p = int(p)-1
    if memo2[p]:
        continue
    else:
        if l == 'WA':
            count1+=1
        else:
            count2+=1
            memo2[p] = True
print(count2,count1)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
S = [[] for _ in range(n)]
pe = [0] * n
co = [0] * n
for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    S[p] += [s]
for i, s_ in enumerate(S):
    for s in s_:
        if s == 'AC':
            co[i] = 1
            break
        else:
            pe[i] += 1
print(sum(co), sum(pe))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ans = [0]*n
pen = [0]*n
for i in range(m):
  inp = input().split()
  if inp[1] == "AC":
    ans[int(inp[0])-1] = 1
  elif inp[1] == "WA":
    if ans[int(inp[0])-1] == 0:
      pen[int(inp[0])-1] += 1
        
print("{0} {1}".format(sum(ans),sum(pen)))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
memo2 = [False for i in range(n)]
count1,count2 = 0,0
for i in range(m):
    p,m = input().split()
    p = int(p)
    if memo2[p-1]:
        continue
    else:
        if m == 'WA':
            count1+=1
        else:
            count2+=1
            memo2[p-1] = True
print(count2,count1)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ans = [0]*n
pen = [0]*n
for i in range(m):
  inp = input().split()
  if inp[1] == "AC":
    ans[int(inp[0])-1] = 1
  else:
    if ans[int(inp[0])-1] == 0:
    	pen[int(inp[0])-1] += 1
        
print("{0} {1}".format(ans.count(1),sum(pen)))

Submission status: Wrong Answer

Solution code:
(N,M),*ps = [s.split() for s in open(0)]

ps = [(int(p),s=='WA') for p,s in ps]

cnt = 0
acs = set()

for p,s in ps:
    if p not in acs:
        if s:
            cnt += 1
        else:
            acs.add(p)

print(len(acs),cnt)

Submission status: Wrong Answer

Solution code:
(N,M),*ps = [s.split() for s in open(0)]

N,M = map(int, (N,M))

ps = [(int(p),s=='WA') for p,s in ps]

from collections import defaultdict
c = defaultdict(int)
acs = defaultdict(bool)

for p,s in ps:
    if not acs[p]:
        if s:
            c[p] += 1
        else:
            acs[p] += 1

print(sum(acs.values()), sum(c.values()))

Submission status: Wrong Answer

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

solved = [False] * n
ac_cnt = 0
wa_cnt = 0

for i in range(m):
    cn, cj = int(a[i][0]) - 1, a[i][1]
    if not solved[cn]:
        if cj == 'WA':
            wa_cnt += 1
        else:
            ac_cnt += 1
            solved[cn] = True
print(ac_cnt, wa_cnt)

Submission status: Wrong Answer

Solution code:
import sys
import time
import math
import itertools as it
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

N, M = inpl()
dp = [False] * (N+10)
ac = 0
wa = 0
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if S == 'WA':
        if not dp[p]:
            wa += 1
    else:
        if not dp[p]:
            ac += 1
            dp[p] = True
print(ac, wa)


# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)

Submission status: Wrong Answer

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import numpy as np
import sys
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

# N =I()
N,M= LI()
if M==0:
    print(0,0)
    exit()
pS = [LS() for _ in range(M)]
# print(pS)

_p,S = zip(*pS)

p = list(map(int,_p))

WA = np.zeros(N+1)
AC = np.full(N+1,False, dtype=bool)

for i in range(M):
    if AC[p[i]]:
        continue
    if S[i]=='AC':
        AC[p[i]]=True
        continue
    else:
        WA[p[i]] += + 1

AC_count = np.count_nonzero(AC)        
WA_count = np.sum(WA)

# space output
print(AC_count,int(WA_count))

#Ap = np.array(A)



# if ans:
#     print('Yes')
# else:
#     print('No')

Submission status: Wrong Answer

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import numpy as np
import sys
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

# N =I()
N,M= LI()
if M==0:
    print(0,0)
    exit()
pS = [LS() for _ in range(M)]
# print(pS)

_p,S = zip(*pS)

p = list(map(int,_p))

WA = np.zeros(N+1)
AC = np.full(N+1,False, dtype=bool)

for i in range(M):
    if AC[p[i]]:
        continue
    if S[i]=='AC':
        AC[p[i]]=True
    if S[i]=='WA':
        WA[p[i]] = WA[p[i]] + 1
        

WA_count = np.sum(WA)
AC_count = np.count_nonzero(AC)

# space
print(AC_count,int(WA_count))

#Ap = np.array(A)



# if ans:
#     print('Yes')
# else:
#     print('No')

Submission status: Wrong Answer

Solution code:
n,m = list(map(int,input().split()))
d = {}
ac = 0
wa = [0] * (n+1)

for i in range(m):
  p,s = input().split()
  p = int(p)
  if p in d:
    if d[p] == 'AC':
      pass
    else:
      if s == 'AC':
        d[p] = 'AC'
        ac += 1
      else:
        wa[p] += 1
  else:
    d[p] = s
    if s == 'AC':
      ac += 1
    else:
      wa[p] += 1

print(ac,sum(wa))

Submission status: Wrong Answer

Solution code:
n,m=[int(i) for i in input().split()]
l=[]
w=0
c=0
for i in range(m):
    a,b=[str(i) for i in input().split()]
    a=int(a)
    if(a not in l):
        if(b=='WA'):
            w=w+1
        else:
            c=c+1
            l.append(a)
print(c,w)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
dict={}
r1,r2=0,0
for _ in range(m):
  p,s=input().split()
  if not p in dict:
    dict[p] = ['WA']
  if s == 'WA' and dict[p][-1]=='WA':
    dict[p].append('WA')
  elif s == 'AC' and dict[p][-1] == 'WA':
    dict[p].append('AC')
r1 = len(dict)
for i in dict.values():
  r2 += len(i)-2
print(r1,r2)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
dict={}
result=[0,0]
for i in range(1,n+1):
  dict[str(i)] = 'WA'
for _ in range(m):
  p,s=input().split()
  if s == 'WA':
    if dict[p]=='WA':
      result[1] += 1
  else:
    if dict[p]=='WA':
      dict[p] = 'AC'
      result[0] += 1
print(*result, sep=' ')

Submission status: Wrong Answer

Solution code:
n,m = list(map(int,input().split()))
clear= []
penalty = 0


for i in range(m):
  p,s = list(map(str,input().split()))
  if s == 'AC':
    if p not in clear:
      clear.append(p)
  else:
    if p not in clear:
      penalty += 1

print(len(clear),penalty)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
ls2 = []
for i in range(M):
    A,B = map(str,input().split())
    ls = [int(A)-1,B]
    ls2.append(ls)

Pena = 0
corr = 0

#ls3 = sorted(ls2, key=lambda x: x[0])
lsans = [[] for i in range(N)]
for i in range(M):
    lsans[ls2[i][0]].append(ls2[i][1])

for i in range(N):
    #if bool(lsans[i]):
    for ans in lsans[i]:
        if ans == 'WA':
            Pena += 1
        if ans == 'AC':
            corr += 1
            break
print(corr,Pena)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
ls2 = []
for i in range(M):
    A,B = map(str,input().split())
    ls = [int(A)-1,B]
    ls2.append(ls)

Pena = 0
corr = 0

#ls3 = sorted(ls2, key=lambda x: x[0])
lsans = [[] for i in range(N)]
for i in range(M):
    lsans[ls2[i][0]].append(ls2[i][1])

for i in range(N):
    if bool(lsans[i]):
        for ans in lsans[i]:
            if ans == 'WA':
                Pena += 1
            if ans == 'AC':
                corr += 1
                break
print(corr,Pena)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
ls2 = []
for i in range(M):
    A,B = map(str,input().split())
    ls = [int(A)-1,B]
    ls2.append(ls)

Pena = 0
corr = 0

ls3 = sorted(ls2, key=lambda x: x[0])
lsans = [[] for i in range(N)]
for i in range(M):
    lsans[ls2[i][0]].append(ls2[i][1])

for i in range(N):
    if bool(lsans[i]):
        for ans in lsans[i]:
            if ans == 'WA':
                Pena += 1
            if ans == 'AC':
                corr += 1
                break
print(corr,Pena)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ac = 0
is_AC = [False] * ((10 ** 5) + 1)
WA_cnt = [0] * ((10 ** 5) + 1)
for i in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'WA':
        if is_AC[p]:
            continue
        else:
            WA_cnt[p] += 1
    else:
        if is_AC[p]:
            continue
        else:
            is_AC[p] = True
            ac += 1

print(ac, sum(WA_cnt))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ac = 0
is_AC = [False] * (10 ** 5)
WA_cnt = [0] * (10 ** 5)
for i in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'WA':
        if is_AC[p]:
            continue
        else:
            WA_cnt[p] += 1
    else:
        if is_AC[p]:
            continue
        else:
            is_AC[p] = True
            ac += 1

print(ac, sum(WA_cnt))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split()) 
L=[list(input().split()) for i in range(M)]
W=[0]*N
A=[0]*N
a=0
w=0
for i in range(M):
  if L[i][1]=="AC":
    A[int(L[i][0])-1]=1
  elif L[i][1]=="WA" and A[int(L[i][0])-1]==0:
    W[int(L[i][0])-1]+=1
for i in A:
  a+=i
for i in W:
  w+=i
print(a,w)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split()) 
L=[list(input().split()) for i in range(M)]
W=[0]*N
A=[0]*N
a=0
w=0
for i in range(M):
  if L[i][1]=="WA" and A[int(L[i][0])-1]!=1:
    W[int(L[i][0])-1]+=1
  elif L[i][1]=="AC":
    A[int(L[i][0])-1]=1
for i in A:
  a+=i
for i in W:
  w+=i
print(a,w)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
wa_dict = {}
is_AC = []
ac_cnt = 0
for i in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'WA':
        if is_AC.count(p) == 0:
            if wa_dict.get(p) is None:
                wa_dict[p] = 1
            else:
                wa_dict[p] += 1
        else:
            continue
    else:
        if is_AC.count(p) == 0:
            ac_cnt += 1
            is_AC.append(p)

print(ac_cnt, sum(wa_dict.values()))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
aa=[[] for i in range(n)]
for x in range(m):
  a,b=input().split()
  d=int(a)-1
  aa[d].append(b)
  
print(aa)
ans_ac=0
ans_wa=0
for y in range(n):
  ans1=0
  ans2=0
  for z in range(len(aa[y])):
    if aa[y][z]=='WA':
      ans1+=1
    else:
      ans2+=1
      break
  if ans2==1:
    ans_wa+=ans1
    ans_ac+=1
    
print(str(ans_ac)+' '+str(ans_wa))

Submission status: Wrong Answer

Solution code:
import itertools
# import math

# N = int(input())
# S = input()
# n, *a = map(int, open(0))
N, M = map(int, input().split())
# P = list(map(int, input().split()))
# Q = list(map(int, input().split()))
# S = input()

aced = {}

cnt_ac = 0
cnt_pena = 0
for i in range(M):
    p_i, S_i = input().split()
    if S_i == 'WA':
        if not p_i in aced:
            cnt_pena += 1
    if S_i == 'AC':
        if not p_i in aced:
            cnt_ac += 1
            aced[p_i] = 1

print(cnt_ac, cnt_pena)

Submission status: Wrong Answer

Solution code:
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


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

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

    ans = 0
    e = [0]*(N+1)

    for i in range(M):
        if e[int(p[i])] == 0:
            if S[i] == "WA":
                ans += 1
            elif S[i] == "AC":
                e[int(p[i])] = 1

    sum_e = sum(e)
    print(sum_e, ans)

if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


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

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

    ans = 0
    e = [0]*(N+1)

    for i in range(M):
        if e[int(p[i])] == 0:
            if S[i] == "WA":
                ans += 1
            elif S[i] == "AC":
                e[int(p[i])] += 1

    sum_e = sum(e)
    print(sum_e, ans)

if __name__ == "__main__":
	main()

Submission status: Wrong Answer

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

AC = [0]*N
WA = [0]*N
AC_cnt = 0
WA_cnt = 0
p = [0]*M
S = [0]*M

for i in range(M):
    p[i],S[i] = map(str, input().split())

for i in range(M):
    q_num = int(p[i])
    if AC[q_num-1] == 0:
        if S[i] == "AC":
            AC[q_num-1] = 1
        else:
            WA[q_num-1] += 1

for i in range(N):
    WA_cnt += WA[i]

print(sum(AC),WA_cnt)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
if M == 0:
    ans = 0
    print(ans,ans)
    exit()

AC = [0]*N
WA = [0]*N
AC_cnt = 0
WA_cnt = 0
p = [0]*M
S = [0]*M

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

for i in range(N):
    WA_cnt += WA[i]

print(sum(AC),WA_cnt)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
if M == 0:
    AC_cnt = 0
    WA_cnt = 0
    print(AC_cnt,WA_cnt)
    exit()

AC = [0]*N
WA = [0]*N
AC_cnt = 0
WA_cnt = 0
p = [0]*M
S = [0]*M

for i in range(M):
    p[i],S[i] = map(str, input().split())
    p[i] = int(p[i])

    q_num = p[i]
    if AC[q_num-1] == 0:
        if S[i] == "AC":
            AC[q_num-1] = 1
        else:
            WA[q_num-1] += 1

for i in range(N):
    WA_cnt += WA[i]


print(sum(AC),WA_cnt)

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
wa = [0] * n
isAC = [False] * n
c, p = 0, 0
if m > 0:
    a = [input().split() for _ in range(m)]
    a = list(zip(*a))
    for i in range(m):
        if a[1][i] == "WA" and isAC[int(a[0][i]) - 1] is False:
            wa[int(a[0][i]) - 1] += 1
        if a[1][i] == "AC" and isAC[int(a[0][i]) - 1] is False:
            isAC[int(a[0][i]) - 1] = True
    c = isAC.count(True)
    p = sum(wa)
print(c, p)

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
c, p = 0, 0
aced = False
if m != 0:
    a = [input().split() for _ in range(m)]
    za = list(zip(*a))
    q = za[0][0]
    j = za[1][0]
    for i in range(m):
        if i > 0:
            q = za[0][i]
            j = za[1][i]
            if aced and za[0][i] != za[0][i - 1]:
                aced = False
        if j == "AC" and aced is False:
            c += 1
            aced = True
        elif j == "WA" and aced is False:
            p += 1
print(c, p)

Submission status: Wrong Answer

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

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

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

r1 = sum(ac)
r2 = sum(wa)

print(r1, r2)

Submission status: Wrong Answer

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

ac = [False for _ in range(n)]
wa = [False for _ in range(n)]

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

r1 = sum(ac)
r2 = sum(ac[i] and wa[i] for i in range(n))

print(r1, r2)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
if m != 0:
    l = [list(input().split()) for i in range(m)]
    p,s = [list(i) for i in zip(*l)]
t = [0] * n
ac = 0
wa = 0

for i in range(m):
    if s[i] == 'WA' and t[int(p[i])-1] == 0:
        wa += 1
    elif s[i] == 'AC' and t[int(p[i])-1] == 0:
        ac += 1
        t[int(p[i])-1] = 1

print(ac,wa)

Submission status: Wrong Answer

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

ans_num = [0]*(N+1)
ans_pe = [0]*(N+1)

for i in range(M):
  result = t_ans[i][1]
  question = int(t_ans[i][0])
  if result == 'AC' and ans_num[question] == 0:
    ans_num[question] = 1
  elif result == 'WA' and ans_num[question] == 0:
    ans_pe[question] += 1
  
for i in range(N):
  if ans_num[i] != 1:
    ans_pe[i] = 0

print(f'{sum(ans_num)} {sum(ans_pe)}')

Submission status: Wrong Answer

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

ans_num = [0]*(N+1)
ans_pe = [0]*(N+1)

for i in range(M):
  result = t_ans[i][1]
  question = int(t_ans[i][0])
  print(question)
  if result == 'AC' and ans_num[question] == 0:
    ans_num[question] = 1
  elif result == 'WA' and ans_num[question] == 0:
    ans_pe[question] += 1
  
for i in range(N):
  if ans_num[i] != 1:
    ans_pe[i] = 0

print(f'{sum(ans_num)} {sum(ans_pe)}')

Submission status: Wrong Answer

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


for i in range(M):
    if S[i] == "AC":
        if ans_AC[int(p[i])] != 1:
            ans_AC[int(p[i])] = 1
    else:
        if ans_AC[int(p[i])] != 1:
            ans_WA[int(p[i])] += 1
print(sum(ans_AC),sum(ans_WA))