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
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()
		p, S = inp.split(" ")
		pp = int(p)
		S = S[:-1]
		#print(S)
		if S == "AC":
			if ansrs_AC[pp-1] == 1:
				continue
			else:
				ansrs_AC[pp-1] = 1
				ans1 += 1
				#print("iiii")
		else:
			if ansrs_AC[pp-1] == 1:
				continue
			else:
				ans2 += 1
				#print("iiii")


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

if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
# M submissions
# i-th problem, pi-th problem recieved Si verdict ("AC" or "WA")
# Penalty: recieve WA before AC

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

problem_ac = set()
problem_penalty = dict()

for _ in range(M):
    problem, verdict = input().split()

    if problem in problem_ac:
        continue
    elif verdict == "WA":
        problem_penalty[problem] = problem_penalty.get(problem, 0) + 1
    elif verdict == "AC":
        problem_ac.add(problem)

num_ac = len(problem_ac)
num_penalties = sum(problem_penalty.values())
print(num_ac, num_penalties)

Submission status: Wrong Answer

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

correct = [0] * n
penalty = [0] * n
for i in range(m):
    target_problem = p[i] - 1
    if correct[target_problem] == 1:
        continue
    if s[i] == 'AC':
        correct[target_problem] += 1
    else:
        penalty[target_problem] += 1

print('{0} {1}'.format(sum(correct), sum(penalty)))

Submission status: Wrong Answer

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

s.sort()

memo = 0

acc = 0
mis = 0

for i in range(m):

    if s[i][0] != memo:
        if s[i][1] == "AC":
            acc += 1
            memo = s[1][0]
        elif s[i][1] == "WA":
            mis += 1

print(acc, mis)

Submission status: Wrong Answer

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

result_list = []
for i in range(m):
    a,b=input().split()
    result_list.append((int(a), b))

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


for result in result_list:
    if result[0] in done_list:
        pass
    elif result[1] == "WA":
        pn += 1
    elif result[1] == "AC":
        done_list.append(result[0])
        correct += 1
    if len(done_list) == n:
        break

print(correct, pn)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
n,m = map(int, input().split())
L = {}
ac = 0
wa = 0
for i in range(m):
    p,s = input().split()
    try:
        if L[p] == 'AC':
            pass
        else:
            if s == 'AC':
                ac += 1
                L[p] = 'AC'
            else:
                wa += 1
    except:
        if s == 'AC':
            ac += 1
            L[p] = 'AC'
        else:
            wa += 1
            L[p] = 'WA'
        
print(ac, wa)

Submission status: Wrong Answer

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

wa = 0
ac_number = []
for i in range(M):
  if S[i] == "AC":
    ac_number.append(P[i])
  else:
    if not P[i] in ac_number:
      wa += 1

print(len(set(ac_number)), wa)

Submission status: Wrong Answer

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

pena = 0
a = 0

for i in ans:
    if i[1] == 'WA' and ac[int(i[0])-1] == 0:
        pena += 1
    if i[1] == 'AC':
        if ac[int(i[0])-1] == 0:
            a +=1
        ac[int(i[0])-1] = 1

print(a, pena)

Submission status: Wrong Answer

Solution code:
def solve(N, M, A):
    if M == 0:
        return 0, 0
    A = [[int(x[0]), x[1]] for x in A]
    wa = 0
    ac = 0
    num = A[0][0]
    for i in range(M):
        if A[i][0] == num and A[i][1] == 'WA':
            wa += 1
        elif A[i][0] == num and A[i][1] == 'AC':
            ac += 1
            num += 1
    return ac, wa

def main():
    N, M = map(int, input().split())
    A = [list(x for x in input().split()) for _ in range(M)]
    ans = solve(N, M, A)
    print(*ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

ac_flag = [0 for _ in range(N)]
wa = ac_flag.copy()
ac = ac_flag.copy()

for i in range(M):

    question, result = input().split(" ")
    question = int(question)

    if not ac_flag[question-1] and result == 'WA':
        wa[question - 1] = 1
    
    if result == 'AC':
        ac_flag[question-1] = 1
        ac[question-1] = 1

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

Submission status: Wrong Answer

Solution code:

def main():
    n, m = map(int, input().split())
    dic = {}
    ac, wa = "AC", "WA"
    for _ in range(m):
        p, s = input().split()
        if p not in dic:
            dic[p] = [0, False]  # (wa_count, accepted)
        if dic[p][1]:
            continue
        if s == wa:
            dic[p][0] += 1
        else:
            dic[p][1] = True

    ac_num, wa_num = 0, 0
    for _, (wa_count, accepted) in dic.items():
        ac_num += accepted
        wa_num += wa_count

    print(ac_num, wa_num)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
wa = 0
ac = 0
ac_list = []
if m==0:
    print(0,0)
else:
    for i in range(m):
        p,s = input().split()
        if (s=='WA') & (ac_list.count(p) ==0):
            wa += 1
        elif ac_list.count(p) ==0:
            ac_list.append(p)
            ac += 1
        else:
            pass
    print(ac, wa)

Submission status: Wrong Answer

Solution code:
import numpy as np

N_M = input()
N = int(N_M.split(" ")[0])
M = int(N_M.split(" ")[1])

input_list = []
for i in range(M):
	input_list.append(tuple(input().split(" ")))

AC_list = np.zeros(N, dtype=bool)
WA_list = np.zeros(N, dtype=int)

for data in input_list:

	if data[1] == 'AC':
		AC_list[int(data[0]) - 1] = True

	if data[1] == 'WA':
		if not AC_list[int(data[0]) - 1]:
			WA_list[int(data[0]) - 1] += 1

print(np.count_nonzero(AC_list), np.sum(WA_list))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
question = list(range(1, n+1))
ac_counter = 0
wa_counter = 0
for i in range(m):
    p, s = input().split()
    p = int(p)
    if p in question:
        if s == 'AC':
            ac_counter += 1
            question.remove(p)
        else:
            wa_counter += 1
print('{} {}'.format(ac_counter, wa_counter))

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; pre_num = 0; pre_code = ''
for pi, Si in zip(p, S):
    if pre_num == pi and pre_code == 'AC':
        continue
    else:
        if Si == 'WA':
            penalty += 1
            pre_num = pi
            pre_code = 'WA'
        else:
            correct += 1
            pre_num = pi
            pre_code = 'AC'
    
print(correct, penalty)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
wa = 0
ac = 0
totalResult = {}
for i in range(m):
    p, result = input().split()
    resultProblem = totalResult.get(p, 'None')
    if result == 'AC' and (resultProblem == 'None' or resultProblem != 'AC'):
        ac += 1
        totalResult[p] = 'AC'
    elif result == 'WA' and (resultProblem == 'None'):
        wa += 1
print(ac, wa, end=' ')

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
AC = {}
WA = {}
for i in range(M):
    prb ,ans = input().split()
    if ans == "AC":
        AC[prb] = 1
    else:
        if (prb in WA) == False:
            WA[prb] = 1
        else:
            if (prb in AC) ==  False:
                WA[prb] +=1
wa = 0
for i,v in WA.items():
    if prb in AC:
        wa += v
print("{} {}".format(len(AC),wa))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
P, S = [], [] 
PS = set()
for _ in range(m):
    p, s = map(str, input().split())
    P.append(int(p))
    S.append(s)
    PS.add((int(p),s))

gotou = 0

sudeni_seitou = set()
for i in range(m):
    if S[i] == 'AC':
        sudeni_seitou.add(P[i])
    elif (S[i] == 'WA') and (P[i] not in sudeni_seitou):
        gotou += 1

seitou = len(sudeni_seitou)

print(str(seitou) + ' ' + str(gotou))

Submission status: Wrong Answer

Solution code:
n,q=map(int,input().split())
d=[]
wa=0
ac=0
for i in range(q):
  x=input().split()
  a=x[1]
  q=x[0]
  if q not in d and a=='WA':
    wa+=1
  elif q not in d and a=='AC':
    d.append(q)
    ac+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
from sys import stdin
n,m = [int(x) for x in stdin.readline().rstrip().split()]

li = [list(stdin.readline().rstrip().split()) for _ in range(m)]
lin = [0]*(n+1)

cor = 0
wor = 0

for i in li:
    if lin[int(i[0])] == 0:
        if i[1] == "WA":
            wor += 1
        elif i[1] == "AC":
            cor += 1
            lin[int(i[0])] = 1
print(cor,wor)

Submission status: Wrong Answer

Solution code:
N ,M = map(int,input().split())
P_list = [0 for i in range(N+1)]
AC_count = 0
WA_count = 0

for i in range(M):
    box = input().split()
    if P_list[int(box[0])] == 0:
        if box[1] == "AC":
            AC_count += 1
            P_list[int(box[0])] = "AC"
        elif box[1] =="WA":
            WA_count += 1


print(AC_count,WA_count)

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
AC=[]
WA=0
for _ in range(M):
  p,S=input().split()
  if S=="AC":
    AC.append(p)
  elif p not in AC:
    WA+=1
  else:
    pass
print(len(set(AC)),WA)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
lp=[]
lc=[]
pen=0
corr=0
for _ in range (m):
  a,s = input().split()
  a=int(a)
  if s=='AC':
    if a not in lc:
      corr+=1
      lc.append(a)
  else:
    if a not in lp:
      pen+=1
      lp.append(a)
print(corr,pen)

Submission status: Wrong Answer

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

tasks = [] # [0]がAC、[1]がWA数
for i in range(n):
    tasks.append([0, 0])

sub = []
for i in range(m):
    i, j = map(str, input().split())
    i = int(i)
    sub.append([i, j])

penal = 0
ac = 0
for p, s in sub:
    if tasks[p-1][0] == 1:
        continue
    else:
        if s == "AC":
            ac += 1
            tasks[p-1][0] = 1
        else:
            penal += 1

print(ac, penal)

Submission status: Wrong Answer

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

for i in range(M):
    p[i] = int(p[i])

AC = 0
P = 0

Q = []
for i in range(N):
    Q.append(0)

for i in range(M):
    if Q[p[i] - 1] == 0 and S[i] == 'AC':
        AC = AC + 1
        Q[p[i] - 1] = 1
    elif Q[p[i] - 1] == 0 and S[i] == 'WA':
        P = P + 1

print(AC, P)

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    n, m = MAP()
    ac = defaultdict(int)
    wa = defaultdict(int)
    for i in range(m):
        p, s = input().split()
        p = int(p)
        if s == "AC":
            ac[p] = 1
        else:
            if ac[p] == 0:
                wa[p] += 1

    # print(ac)
    # print(wa)
    print(len(ac), len(wa))


if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
N, M = list(map(lambda x: int(x), input().split()))
cleared = [False for i in range(N+1)]
ac = 0
wa = 0
for _ in range(M):
  p, s = input().split()
  p = int(p)
  
  if cleared[p]:
    continue
  if s == "AC":
    cleared[p] = True
    ac = ac + 1
  elif s == "WA":
    wa = wa + 1

print(ac, wa)

Submission status: Wrong Answer

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

ac=set()
wa=0

q=[[0,-1] for i in range(n+1)]

for x,y in li:
  if y=="AC" and q[int(x)][1]==-1:
    wa+=q[int(x)][0]
    q[int(x)][1]==0
    ac.add(x)
  elif y=="WA" and q[int(x)][1]==-1:
    q[int(x)][0]+=1

print(len(ac),wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = [[] for i in range(N + 1)] 
for i in range(M):
        j, ans = input().split()
        p[int(j)].append(ans)

wa = 0 
ac = 0 
for i in range(1, N + 1): 
        if not p[i]:
                continue
        else:
                for s in p[i]:
                        if s == "WA":
                                wa += 1
                        elif s == "AC":
                                ac += 1
                                break    

print(str(ac) + " " + str(wa))

Submission status: Wrong Answer

Solution code:
import sys


def main():
    n, m = map(int, sys.stdin.readline().split(" "))
    mem = dict()
    try_count = 0
    wrong_count = 0
    for _ in range(m):
        t, result = sys.stdin.readline().strip().split(" ")
        test_no = int(t)
        if test_no > n:
            continue
        if test_no in mem:
            if not mem[test_no]:
                if result == "WA":
                    wrong_count += 1
                else:
                    mem[test_no] = True
        else:
            try_count += 1
            mem[test_no] = result == "AC"
            if result == "WA":
                wrong_count += 1
    print("%d %d" % (try_count, wrong_count))


if __name__ == '__main__':
    main()

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
    else:
        continue
print(sum(A), sum(Pen))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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 s == 'AC':
    if p not in ac:
      ac.append(p)
      ac.sort
  if s == 'WA':
    if p not in ac:
      wa += 1

print(len(ac), wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
q = ["" for i in range(N)]
wa = 0
ac = 0
for i in range(M):
    p,s = map(str,input().split())
    if s == "WA" and (q[int(p)-1] == "" or q[int(p)-1] == "WA"):
        q[int(p)-1] = "WA"
        wa+=1
    elif s == "AC" and (q[int(p)-1] == "" or q[int(p)-1] == "WA"):
        q[int(p)-1] = "AC"
        ac+=1
print(ac,wa)

Submission status: Wrong Answer

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

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

AC = []
accnt = 0
wacnt = 0

for i in range(M):
  num = List[i][0]
  res = List[i][1]
  
  if num in AC:
    a = 0
  else:
    
    if res == "AC":
      accnt = accnt + 1
      AC.append(num)

    if res == "WA":
      wacnt = wacnt + 1
  
ans = [accnt,wacnt]
print(*ans)

Submission status: Wrong Answer

Solution code:
question_num, my_submit = list(map(int, input().split(' ')))
sub_list = ['']*my_submit

for i in range(my_submit):
    sub_list[i] = input().split(' ')

question_results = ['hoge'] + [False]*question_num
ac = 0
wa = 0

for j in sub_list:
    if question_results[int(j[0])] == False:
        if j[1] == 'AC':
            question_results[int(j[0])] = True
            ac += 1
        elif j[1] == 'WA':
            wa += 1
    
print(ac, wa)

Submission status: Wrong Answer

Solution code:
H = list(map(int, input().split()))
N = H[0]
M = H[1]
C = [0]*N
A = 0
W = 0
for i in range(M):
    X = input().split()
    if (C[int(X[0])-1]==0):
        if (X[1]=="AC"):
            C[int(X[0])-1]=1
            A += 1
        else:
            W += 1
print(str(A)+" "+str(W))

Submission status: Wrong Answer

Solution code:
N , M = map(lambda x: int(x),input().split())
isAC = ["WA"] * N
score=0
penalty = 0
for i in range(M):
    p,r = input().split()
    #print(p,r)
    p = int(p)
    p -= 1
    if isAC[p] =="AC":
        continue
    if r == "WA":
        penalty += 1
        #print(penalty)
    elif r == "AC":
        isAC[p] = "AC"
        score+=1
        #print(score)
    #print(isAC)
print(score,penalty)

Submission status: Wrong Answer

Solution code:
import collections
import itertools as it
import math
import numpy as np

# A = input()
# A = int(input())
# A = map(int, input().split())
# A = list(map(int, input().split()))
# A = [int(input()) for i in range(N)]
#
# c = collections.Counter()

N, M = map(int, input().split())
nAC = [False for i in range(N)]
nWA  = 0

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

    if nAC[p]:
        pass
    else:
        if S == 'AC':
            nAC[p] = True
        else:
            nWA += 1

print(sum(nAC), nWA)

Submission status: Wrong Answer

Solution code:
N,M = [int(i) for i in input().split()]
submissions = {str(i):[] for i in range(1,N+1)}
AC,WA = 0,0
for i in range(M):
    P,S = [j for j in input().split()]
    submissions[P].append(S)
for i in submissions:
    for j in submissions[i]:
        if j == 'WA':
            WA+=1
        else:
            AC +=1
            break
print(AC,WA)

Submission status: Wrong Answer

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

#print(ps)
ac = [0 for i in range(N)]
wa = [0 for i in range(N)]

for i in range(M):
    s = int(ps[i][0])-1
    if ps[i][1] == "WA" and ac[s] == 0:
        wa[s] += 1

    if ps[i][1] == "AC":
        ac[s] = 1

print(str(sum(ac)) + " " + str(sum(wa)))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
sub_ls = []
for i in range(m):
    p, s = list(map(str, input().split()))
    p = int(p)
    sub_ls.append([p,s])
ac_cnt = []
wa_cnt = []
for i in range(n):
    ac_cnt.append(0)
    wa_cnt.append(0)
#print(ac_cnt, wa_cnt)
for i in range(m):
    if ac_cnt[sub_ls[i][0]-1] == 0:
        #print(sub_ls[i][1], ac_cnt[i])
        if sub_ls[i][1] == "AC":
            ac_cnt[sub_ls[i][0]-1] = 1
        else:
            wa_cnt[sub_ls[i][0]-1]+=1
ac_sum = 0
wa_sum = 0
for i in range(n):
    if ac_cnt[i] == 1:
        ac_sum+=1
    wa_sum+=wa_cnt[i]
print(ac_sum, wa_sum)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p = []
S = []
p_count = 0
a_count = 0
for i in range(m):
    temp1,temp2 = input().split()
    p.append(int(temp1))
    S.append(temp2)
n_table = [0  for i in range(n)]
for p,s in zip(p,S):
    if s == "AC":
        n_table[p-1] = 1
    if s == "WA" and n_table[p-1] == 0:
        p_count += 1
a_count = n_table.count(1)
print(a_count,p_count)

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
P = [0] * M
S = [0] * M
ac_list = []
wa_cnt = 0
for i in range(M):
    P[i],S[i] = map(str, input().split())
    if (P[i] in ac_list):
        continue
    if (S[i] == 'AC'):
        ac_list.append(P[i])
    else:
        wa_cnt +=1

print(len(set(ac_list)), wa_cnt)

Submission status: Wrong Answer

Solution code:
import sys

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

if m == 0:
  print('{} {}'.format(0, 0))
  sys.exit()

result = {}
ac_result = 0
wa_result = 0
for i in range(m):
  x = input().split()
  p = int(x[0])
  s = x[1]
  if s == 'AC':
    try:
      if result[p] == 'AC':
        pass
      else:
        wa_result += result[p]
        ac_result += 1
        result[p] = 'AC'
    except:
      ac_result += 1
      result[p] = 'AC'
      pass
  else:
    try:
      result[p] += 1
    except:
      result[p] = 1

print('{} {}'.format(ac_result, wa_result))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

def main():
    syutudai,teisyutsu_count = map(int, input().split())
    result_list = [input().split() for i in range(teisyutsu_count)]
    ac_list = [0] * syutudai

    ac_count = 0
    penalty_count = 0
    for result in result_list:
        problem = int(result[0])
        result = result[1]
        if ac_list[problem-1] == 1:
            continue
        if result == 'AC':
            ac_list[problem-1] = 1
            ac_count += 1
        else:
            penalty_count += 1

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




if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n,m = (int(i) for i in input().split())
p = []
ac = 0
wa = 0
for i in range(m):
  a,b = (input().split())
  a = int(a)
  p.append([a,b])
x = [0]*n
for i in range(m):
  tmp = p[i][0] - 1
  if p[i][1] == "AC":
    x[tmp] = 1
  elif p[i][1] == "WA":
    if x[tmp] == 0:
      wa += 1
for i in range(n):
  if x[i] == 1:
    ac += 1
print(ac,wa)

Submission status: Wrong Answer

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

if M == 0:
    print(0,0)
    exit()

pS = [list(input().split()) for _ in range(M)]
pS = sorted(pS, key = lambda x:x[0])

if N == 1:
    if pS[0][1] == "AC":
        print(1,0)
    else:
        print(0,1)
    exit()

n_ac = 1 if pS[0][1] == "AC" else 0
n_pena = 0 if pS[0][1] == "AC" else 1
q_before = 0
q_now = 1
ACed = True if pS[0][1] == "AC" else False

for q_now in range(1, M):
    if pS[q_before][0] != pS[q_now][0]:
        ACed = False
        if pS[q_now][1] == "AC" and ACed == False:
            n_ac += 1
            ACed = True
        elif pS[q_now][1] == "WA" and ACed == False:
            n_pena += 1
    elif ACed == False:
        if pS[q_now][1] == "AC":
            n_ac += 1
            ACed = True
        else:
            n_pena += 1
    q_before += 1

print(n_ac, n_pena)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
check = [0]*(N+3)
fail = [0]*(N+3)

cnt=0
for i in range(M):
    pi,si=input().split()
    pi = int(pi)
    if si=='AC' and check[pi]==0:
        check[pi] = 1
        fail[pi] = cnt
        cnt=0
    elif si=='AC' and check[pi]==1:
        cnt=+0
    elif si=='WA' and check[pi]==1:
        cnt+=0
    else:
        cnt+=1
print(sum(check), sum(fail))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
pS = [tuple(input().split()) for i in range(M)]
pS.sort(key=lambda x: x[0])
problems = [False]*N
AC = 0
penalty = 0
WA = 0
for p, S in pS:
    p = int(p)
    if problems[p-1] == True:
        continue
    else:
        if S == "AC":
            problems[p-1] = True
            AC += 1
            penalty += WA
            WA = 0
        else:
            WA += 1

print(AC, penalty)

Submission status: Wrong Answer

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

no = 0
correct = 0
penalty = 0

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

    if p > no:
        if s == "WA":
            penalty += 1
        elif s == "AC":
            correct += 1
            no = p + 1 

print(correct, penalty)

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]), tmp[1]
  if s[p-1][1] < 0:
    if S == "AC": s[p-1][1] = s[p-1][0] + 1
    else: s[p-1][0] += 1
print(len([i for i in s if i[1]>=0]), sum([i[0] for i in s]))

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
wrong = [0] * n
wrongAns = [0] * n
goodAns = [0] * n
badAnsF = 0
greatAnsF = 0
#print(wrong)
for i in range(m):
  p,s = input().split()
  if(s == "WA"):
    wrong[int(p)-1] += 1
  elif(s == "AC"):
    wrongAns[int(p)-1] = wrong[int(p)-1]
    goodAns[int(p)-1] = 1
    
for i in wrongAns:
  badAnsF += i
for i in goodAns:
  greatAnsF += i
print(greatAnsF,badAnsF)

Submission status: Wrong Answer

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

for _ in range(m):
  num, ans = input().split()
  num = int(num) - 1
  if ans == 'AC':
    if problems[num] == 0:
      problems[num] = 1
  else:
    if problems[num] == 0:
      was[num] += 1

print('{} {}'.format(sum(problems), sum(was)))

Submission status: Wrong Answer

Solution code:
import math
n, m = map(int, input().split())
ans = {}
ac = "AC"
wa = "WA"
ac_num = []
wa_num =  [] 
for _ in range(m):
  p, s = input().split()
  if s == ac:
    ac_num.append(p)
  elif not(p in set(ac_num)):
    wa_num.append(p)
print(len(set(ac_num)), len((wa_num)))

Submission status: Wrong Answer

Solution code:
N, M = list(map(lambda x: int(x), input().split()))
cleared = [False for i in range(N+1)]
ac = 0
wa = 0
for _ in range(M):
  p, s = input().split()
  p = int(p)
  
  if cleared[p]:
    continue
  print(s)
  if s == "AC":
    cleared[p] = True
    ac = ac + 1
  elif s == "WA":
    wa = wa + 1

print(ac, wa)

Submission status: Wrong Answer

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

count=[[i+1,0,0,1] for i in range(n)]

for i in l:
  for j in count:
    if i[0]==j[0]:
      if j[3]==1:
        if i[1]=='WA':
          j[2]+=1
        else:
          j[1]+=1
          j[3]*=0
ans=0
pen=0
for i in count:
  ans+=i[1]
  pen+=i[2]
print(ans,pen)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 12 21:17:12 2020

@author: over-
"""

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

Submission status: Wrong Answer

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

correct = 0
penalty = 0

ans = set([])

for _ in range(M):
    p, S = input().split()
    if p in ans:
        continue
    elif S == 'WA':
        penalty += 1
    else:
        correct += 1
        ans.add(p)

print(correct, penalty)

Submission status: Wrong Answer

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

    ac = 0
    wa = 0

    for _ in range(M):
        i, result = input().split()
        i = int(i)
        #print(i, result)
        if ans[i-1] == False:
            if result == "AC":
                ac += 1
                ans[i-1] = True
            elif result == "WA":
                wa += 1
        elif ans[i-1] == True:
            pass

    print(sum(ans), wa)
    return 0
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
import math
import functools
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n, m = na()
p = []
c = 0
penalty = 0
for _ in range(m):
    ps = stdin.readline().rstrip().split(" ")
    pi, si = int(ps[0]), ps[1]
    if not pi in p:
        if si == "AC":
            c += 1
            p.append(pi)
        else:
            penalty+=1
print(c, penalty)

Submission status: Wrong Answer

Solution code:


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

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

setto = set()
penalties = 0 
correct = 0 
for sub in subms:
    if sub[0] not in setto:
        if sub[1] == "WA":
            penalties += 1
        if sub[1] == "AC":
            correct += 1
            setto.add(sub[0])

print(correct, penalties)

Submission status: Wrong Answer

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

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

ac_dict = {}

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

    #  ACだった時の処理
    if s == 'AC':
        ac_dict[p] = 1
    elif s == 'WA' and ac_dict.get(p, 0) != 1:
        wa_count += 1

print(len(ac_dict), wa_count)