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:
def ACWA(p,j,p_list):
    if j=="AC":
        p_list[p][0]=1
    else:
        p_list[p][1]+=1
    return p_list
    
N,M = map(int,input().split(" "))
p_list = {}
wa_count = 0

for _ in range(M):
    In = input().split()
    if (In[0] in p_list) == False:
        p_list[In[0]]=[0,0]
        p_list = ACWA(In[0],In[1],p_list)
    else:
        if p_list[In[0]][0]==1:
            continue
        else:
            p_list = ACWA(In[0],In[1],p_list)
                
List = list(p_list.values())
a = 0
b = 0

for i in range(len(List)):
    if List[i][0]==1:
        a+=List[i][0]
        b+=List[i][0]

print("{} {}".format(a,b))

Submission status: Wrong Answer

Solution code:
def ACWA(p,j,p_list,wa_count):
    if j=="AC":
        p_list[p]=1
    else:
        wa_count+=1
    return p_list, wa_count
    
N,M = map(int,input().split(" "))
p_list = {}
wa_count = 0

for _ in range(M):
    In = input().split()
    if (In[0] in p_list) ==False:
        p_list[In[0]]=0
        p_list, wa_count = ACWA(In[0],In[1],p_list,wa_count)
    else:
        if p_list[In[0]]==1:
            continue
        else:
            p_list, wa_count = ACWA(In[0],In[1],p_list,wa_count)
                
ac = sum(list(p_list.values()))
print("{} {}".format(ac, wa_count))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split(" "))
p_list = [0]*N
wa_count = 0
for _ in range(M):
    In = input().split()
    p = int(In[0])
    if p_list[p-1]>0:
        continue
    else:
        if In[1]=="AC":
            p_list[p-1]=1
        else:
            wa_count+=1
print("{} {}".format(sum(p_list),wa_count))

Submission status: Wrong Answer

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

question = [0]*(N+1)
wrong = [0]*(N+1)

for i in range(M):
    if PS[i][1] == 'AC':
        if question[int(PS[i][0])] == 0:
            question[int(PS[i][0])] = 1
    else:
        if question[int(PS[i][0])] == 0:
            wrong[int(PS[i][0])] += 1

print(sum(question), sum(wrong))

Submission status: Wrong Answer

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

for i in range(N):
	Box[i]=[i+1,0,0] # 問,AC,WA

for i in range(M):
	target = int(S[i][0]) - 1
	if Box[target][1] == 0:
		if S[i][1] == 'AC':
			Box[target][1] = 1
		if S[i][1] == 'WA':
			Box[target][2] += 1

AC=0
WA=0
for i in range(N):
	AC+=Box[i][1]
	WA+=Box[i][2]
print(AC,WA)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ps_lst = [list(map(str,input().split())) for _ in range(m)]
ac_count = 0
wa_count = 0

pc_dic = {}
for i in range(m):
    number = str(ps_lst[i][0])
    tmp_dic = {number:'WA'}
    pc_dic.update(tmp_dic)

for i in range(m):
    number = ps_lst[i][0]
    answer = ps_lst[i][1]

    if answer=='AC' and pc_dic[number]=='WA':
        ac_count += 1
        tmp_dic = {number:'AC'}
        pc_dic.update(tmp_dic)
    elif answer=='WA' and pc_dic[number]=='WA':
        wa_count += 1
    else:
        continue

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
AC=[0]*n
WA=[0]*n
ACs=set()
for _ in range(m):
    p,c=input().split(); p=int(p)
    if p in ACs:continue
    if c=='AC':
        AC[p-1]+=1
        ACs.add(p)
    else:
        WA[p-1]+=1
print(sum(AC),sum(WA))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ps_lst = [list(map(str,input().split())) for _ in range(m)]
ac_count = 0
wa_count = 0
number_lst = []
answer_lst = []

for i in range(m):
    number = ps_lst[i][0]
    answer = ps_lst[i][1]

    if number not in number_lst and len(number_lst)==0:
        number_lst.append(number)
    elif number not in number_lst and len(number_lst)!=0:
        number_lst.clear()
        answer_lst.clear()
        number_lst.append(number)

    number_lst.append(number)
    answer_lst.append(answer)
    if answer=='WA' and 'AC' not in answer_lst:
        wa_count += 1
    elif answer=='AC' and answer_lst.count('AC')==1:
        ac_count += 1

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

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
cor, war = 0,0
c = [0]*3
for i in range(m):
  p,s = list(input().split())
  p = int(p)
  if p != c[0]:
    c[0] = p
    c[1],c[2] = 0,0 
  if s == "AC" and c[1] == 0:
    cor += 1
    c[1] = 1
    war += c[2]
  if s == "WA" and c[1] == 0:
    c[2] += 1
print(cor,war)

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
cor, war = 0,0
c = [0]*3
for i in range(m):
  p,s = list(input().split())
  p = int(p)
  if p != c[0]:
    c[0] = p
    c[1],c[2] = 0,0 
  if s == "AC" and c[1] == 0:
    cor += 1
    c[1] = 1
  if s == "WA" and c[1] == 0:
    war += 1
print(cor,war)

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
cor, war = 0,0
c = [0]*3
for i in range(m):
  p,s = list(input().split())
  p = int(p)
  if p != c[0]:
    c[0] = p
    c[1],c[2] = 0,0 
  if s == "AC" and c[1] == 0:
    cor += 1
    c[1] = 1
  if s == "WA" and c[2] == 0:
    war += 1
    c[2] = 1
print(cor,war)

Submission status: Wrong Answer

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

wa = 0
WA = 0
AC = 0
collect = []
for i in range(M):
    if pS[i][1] == 'AC' and pS[i][0] not in collect:
        collect.append(pS[i][0])
        AC += 1
        WA += wa
        wa = 0
    elif pS[i][1] == 'WA':
        wa += 1

print(AC, WA)

Submission status: Wrong Answer

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

right = 0
wrong = 0
question = [0 for i in range(N+1)]

for i in range(M):
    if list[i][1] == "AC" :
        if question[int(list[i][0])] != 1 :
            right += 1
            question[int(list[i][0])] = 1
    else :
        if question[int(list[i][0])] != 1:
            wrong += 1

print("{} {}".format(right, wrong))

Submission status: Wrong Answer

Solution code:
from numpy import *

N, M = map(int, input().split())
p = zeros(M, dtype=int)
S = []
for i in range(M):
    x, y = input().split()
    p[i] = int(x) - 1
    S.append(y)

ac = zeros(N, dtype=int)
wa = zeros(N, dtype=int)

for i in range(M):
    if ac[p[i]] == 0:
        if S[i] == 'AC':
            ac[p[i]] += 1
        elif S[i] == 'WA':
            wa[p[i]] += 1
    else:
        pass

s_ac = 0
s_wa = 0        
for i in range(N):
    s_ac += ac[i]
    s_wa += wa[i]

print('{} {}'.format(s_ac, s_wa))

Submission status: Wrong Answer

Solution code:
from numpy import *

N, M = map(int, input().split())
p = zeros(M, dtype=int)
S = []
for i in range(M):
    x, y = input().split()
    p[i] = int(x)
    S.append(y)

ac = zeros(N, dtype=int)
wa = zeros(N, dtype=int)

for i in range(M):
    if ac[p[i] - 1] == 0:
        if S[i] == 'AC':
            ac[p[i] - 1] += 1
        elif S[i] == 'WA':
            wa[p[i] - 1] += 1
    else:
        pass

s_ac = 0
s_wa = 0        
for i in range(N):
    s_ac += ac[i]
    s_wa += wa[i]

print('{} {}'.format(s_ac, s_wa))

Submission status: Wrong Answer

Solution code:
from numpy import *

N, M = map(int, input().split())
p = zeros(M, dtype=int)
S = []
for i in range(M):
    x, y = input().split()
    p[i] = int(x)
    S.append(y)

ac = zeros(N, dtype=int)
wa = zeros(N, dtype=int)

for i in range(M):
    if S[i] == 'AC':
        if ac[p[i]-1] == 1:
            continue
        ac[p[i]-1] += 1
    elif S[i] == 'WA':
        if ac[p[i]-1] == 1:
            continue
        wa[p[i]-1] += 1
s_ac = 0
s_wa = 0        
for i in range(N):
    s_ac += ac[i]
    s_wa += wa[i]

print('{} {}'.format(s_ac, s_wa))

Submission status: Wrong Answer

Solution code:
from numpy import *

N, M = map(int, input().split())
p = zeros(M, dtype=int)
S = []
for i in range(M):
    x, y = input().split()
    p[i] = int(x)
    S.append(y)

ac = zeros(N, dtype=int)
wa = zeros(N, dtype=int)

for i in range(M):
    if S[i] == 'AC':
        if ac[p[i]-1] == 1:
            continue
        ac[p[i]-1] += 1
    elif S[i] == 'WA':
        if ac[p[i]-1] == 1:
            continue
        wa[int(p[i])-1] += 1
s_ac = 0
s_wa = 0        
for i in range(N):
    s_ac += ac[i]
    s_wa += wa[i]

print('{} {}'.format(s_ac, s_wa))

Submission status: Wrong Answer

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

answer_list = {}
for i in range(N):
    answer_list[str(i+1)] = "WA"

for i in range(M):
    p, S = input().split()
    if answer_list[p] == "WA":
        if S == "AC":
            AC += 1
            answer_list[p] = "AC"
        else:
            WA += 1
    else:
        pass

print(AC, WA)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac = [False for _ in range(n+1)]
wa = [0 for _ in range(n+1)]

acCount = 0
waCount = 0

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

for i in range(n+1):
    if(ac[i] == True):
        acCount += 1
        waCount += wa[p]

print(acCount, waCount)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac = [False for _ in range(n+1)]

acCount = 0
waCount = 0

for i in range(m):
    p, s = input().split()
    p = int(p)
    if(ac[p] == False):
        if (s == "AC"):
            acCount += 1
            ac[p] = True
        else:
            waCount += 1

print(acCount, waCount)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

Q = np.zeros((N,2),dtype=int)
for i in range(M):
  p,S = input().split()
  p = int(p)-1
  if Q[p,0] == 0 and S == "AC":
    Q[p,0] = 1
  elif Q[p,0] == 0 and S == "WA":
    Q[p,1] += 1
  else:
    pass

ret = Q.sum(axis=0)
print(ret[0],ret[1])

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
i=0
points=[]
while i<M:
    y=input().split()
    p,s=int(y[0]),y[1]
    z=(p,s)
    points.append(z)
    i+=1
prolist=[]
col=0
co=0
so=0
pe=0
for index,num in enumerate(points):
    so+=1
    if num[1]=="AC":
        co+=1
        if num[0] in prolist:
            continue
        else:
            col+=1
            prolist.append(num[0])
            pe=so-co
   
print(col,pe)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
i=0
points=[]
while i<M:
    y=input().split()
    p,s=int(y[0]),y[1]
    z=(p,s)
    points.append(z)
    i+=1
prolist=[]
col=0
so=0
pe=0
for index,num in enumerate(points):
    so+=1
    if num[1]=="AC":
        if num[0] in prolist:
            continue
        else:
            col+=1
            prolist.append(num[0])
            pe=so-len(prolist)
   
print(col,pe)

Submission status: Wrong Answer

Solution code:
from sys import stdin
input = stdin.readline
N, M = map(int, input().split())
ac = [False] * N
wa = [0] * N
wa_cnt = 0
for i in range(M):
  p, s = input().split()
  p = int(p) - 1
  if ac[p] is False and s == "AC":
    wa_cnt += 1
    ac[p] = True
  elif s == "WA":
    wa[p] += 1
print(ac.count(True), wa_cnt)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
# List to store grades
num = []
apb = []
tmp = []
# num and apb convert to type dict
for i in range(M):
    n, a = input().split()
    num += n
    tmp += [a]

    if a == 'AC':
      tmp_copy = tmp.copy()
      apb += [tmp_copy]
      tmp.clear()

# count
count = 0
for word in apb:
  words = word.count('WA')
  count += words

print(len(set(num)), count)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
A = []
for _ in range(m):
    a,b = input().split()
    tmp = [int(a),b]
    A.append(tmp)
dict = {}
for a in A:
    dict.update({a[0]:False})
ac = 0
wa = 0
for a in A:
    if dict[a[0]] == False:
        if a[1] == "WA":
            wa += 1
        else:
            dict[a[0]] = True
            ac += 1
print("{} {}".format(ac,wa))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
A = []
for _ in range(m):
    a,b = input().split()
    tmp = [int(a),b]
    A.append(tmp)
dict = {}
for i in range(1,n+1):
    dict.update({i:False})
ac = 0
wa = 0
for a in A:
    if dict[a[0]] == False:
        if a[1] == "WA":
            wa += 1
        else:
            dict[a[0]] = True
            ac += 1
print("{} {}".format(ac,wa))

Submission status: Wrong Answer

Solution code:
questions , my_answers = map(int,input().split())

answer_list = ["na"]*questions

wrong_number = 0


for i in range(my_answers):
    q_number , active_answer = input().split()
    q_number = int(q_number)
    if active_answer == "AC":
        answer_list[q_number -1] = "AC"
    else:
        if answer_list[q_number - 1] == "AC":
            continue
        else:
            wrong_number += 1
print(answer_list.count("AC"),wrong_number)

Submission status: Wrong Answer

Solution code:
questions , my_answers = map(int,input().split())

answer_list = ["na"]*questions

wrong_number = 0


for i in range(my_answers):
    q_number , active_answer = input().split()
    q_number = int(q_number)
    if active_answer == "AC":
        answer_list[q_number -1] = "AC"
    else:
        if answer_list[q_number - 1] == "AC":
            continue
        else:
            wrong_number += 1
print(answer_list.count("AC"),wrong_number)

Submission status: Wrong Answer

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

ac = 0
wa = 0

stat = ['NA'] * N
for _ in range(M):
    p, S = input().split()
    key = int(p) - 1
    if S == 'WA' and stat[key] != 'AC':
        wa += 1
    elif S == 'AC' and stat[key] != 'AC':
        ac += 1
        stat[key] = 'AC'

print(ac, wa)

Submission status: Wrong Answer

Solution code:
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10 ** 9

N, M = map(int, readline().split())
AC = 0
WA = 0
li = set()
for _ in range(M):
    p, s = readline().decode('utf8').split()
    if p not in li:
        if s != 'AC':
            WA += 1
        else:
            AC += 1
            li.add(s)

print(AC, WA)

Submission status: Wrong Answer

Solution code:
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10 ** 9

N, M = map(int, readline().split())
AC = 0
WA = 0
li = []
for i in range(M):
    p, s = map(str, readline().decode('utf8').strip().split())
    if p not in li:
        if s != 'AC':
            WA += 1
        else:
            AC += 1
            li.append(p)

print(AC, WA)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
wa_dict = defaultdict(lambda: 0)
n, m = map(int, input().split())
ac_set = set([])
ac = 0
wa = 0
for _ in range(m):
    p, s = input().split()
    if s == 'AC':
        ac_set.add(p)
        if p not in ac_set:
            wa += wa_dict[p]
    else:
        if p not in ac_set:
            wa_dict[p] += 1
print(len(ac_set), wa)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
wa_dict = defaultdict(lambda: 0)
n, m = map(int, input().split())
ac_set = set([])
ac = 0
wa = 0
for _ in range(m):
    p, s = input().split()
    if s == 'AC':
        ac_set.add(p)
        wa += wa_dict[p]
    else:
        if p not in ac_set:
            wa_dict[p] += 1
print(len(ac_set), wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac_set = set([])
ac = 0
wa = 0
for _ in range(m):
    p, s = input().split()
    if s == 'AC':
        ac_set.add(p)
    else:
        if p not in ac_set:
            wa += 1
print(len(ac_set), wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac_list = []
ac = 0
wa = 0
for _ in range(m):
    p, s = input().split()
    if s == 'AC':
        if p not in ac_list:
            ac_list.append(p)
            ac += 1
    else:
        if p not in ac_list:
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

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

ac = 0
wa = 0

for i, v in A:
    if c[int(i)-1] == 0:
        if v == 'WA':
            wa += 1
        elif v == 'AC':
            ac += 1
            c[int(i)-1] = 1

print(ac, wa)

Submission status: Wrong Answer

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

ac = 0
wa = 0

for i, v in A:
    if c[int(i)-1] == 0:
        if v == 'WA':
            wa += 1
        elif v == 'AC':
            ac += 1
            c[int(i) - 1] += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m = (int(x) for x in input().split())
ps = []
for _ in range(m):
    p, s = (x for x in input().split())
    ps.append([int(p), s])
ans = [0] * n
pen = 0
tmp = 0
for p, s in ps:
    if s == 'WA':
        tmp += 1
        continue
    else:
        ans[p - 1] = 1
        pen += tmp
        tmp = 0 
print(sum(ans), pen)

Submission status: Wrong Answer

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

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

    ac_list = []
    penalties = 0
    for q, r in zip(list_q, list_r):
        if q not in ac_list:
            if r == 'WA':
                penalties += 1

            elif r == 'AC':
                ac_list.append(q)

    print(len(ac_list), penalties)

resolve()

Submission status: Wrong Answer

Solution code:
def main(n,m,r):
    ac = [0]*n
    wa = [0]*n
    for i in range(len(r)):
        seq = int(r[i][0])
        judge = r[i][1]
        if judge == "WA" and ac[seq-1] != 1:
            wa[seq-1] += 1
        else:
            ac[seq-1] = 1
    return "{0} {1}".format(sum(ac), sum(wa))

n,m = map(int, input().split())
r = list(input().split() for _ in range(m))
print(main(n,m,r))

Submission status: Wrong Answer

Solution code:
def main(n,m,r):
    c_ac = 0
    c_wa = 0
    for i in range(n):
        wa = 0
        for j in range(len(r)):
            if int(r[j][0]) != i+1:
                continue
            if r[j][1] == "WA":
                wa += 1
            elif r[j][1] == "AC":
                c_ac += 1
                c_wa += wa
    return "{0} {1}".format(c_ac, c_wa)


n,m = map(int, input().split())
r = list(input().split() for _ in range(m))
print(main(n,m,r))

Submission status: Wrong Answer

Solution code:
import numpy as np
N, M = map(int, raw_input().split())
Trial = np.zeros(N, int)
Penalty = 0
Finish = np.zeros(N, bool)
for i in xrange(M):
    a, b = raw_input().split()
    A = int(a) - 1
    if not Finish[A]:
        if b == 'AC':
            Penalty += Trial[A]
            Finish[A] = True
        else:
            Trial[A] += 1
    else:
        pass
    
Accept = Finish.sum()
print(Accept, Penalty)

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split(' '))
    ac_list, wc_list = list(), list()
    for i in range(M):
        num, result = input().split(' ')
        if num in ac_list:
            continue
        if result == 'AC':
            ac_list.append(num)
        else:
            wc_list.append(num)
    print(len(ac_list), len(wc_list))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split(' '))
ac_list, wc_list = list(), list()
for i in range(M):
    num, result = input().split(' ')
    if result == 'AC':
        if not (num in ac_list):
            ac_list.append(num)
    elif not (num in ac_list):
        wc_list.append(num)
print(len(ac_list), len(wc_list))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split(' '))
ac_list, wc_list = list(), list()
for i in range(M):
    num, result = input().split(' ')
    if result == 'AC' and not (num in ac_list):
        ac_list.append(num)
    elif not (num in ac_list):
        wc_list.append(num)
print(len(ac_list), len(wc_list))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split(' '))
ac_list, wc_list = list(), list()
for i in range(M):
    num, result = input().split(' ')
    if num in ac_list: continue
    if result == 'AC':
        ac_list.append(num)
    else:
        wc_list.append(num)
print(len(ac_list), len(wc_list))

Submission status: Wrong Answer

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

flag = [0]*N
num_AC = 0
num_penalty = 0

for i in range(M):
	input_temp = input().split()
	p = int(input_temp[0])
	s = input_temp[1]
	#print(p,s)
	#p,s = list(map(int,input().split()))
	if flag[p-1] == 0:
		if s == "WA":
			num_penalty += 1
		else:
			num_AC += 1
			flag[p-1] = 1
print(num_AC,num_penalty)

Submission status: Wrong Answer

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

flag = [0]*N
num_AC = 0
num_penalty = 0

for i in range(M):
	input_temp = input().split()
	p = int(input_temp[0])
	s = input_temp[1]
	#p,s = list(map(int,input().split()))
	if flag[p-1] == 0:
		if s == "WA":
			num_penalty += 1
		else:
			num_AC += 1
			flag[p-1] = 1
print(num_AC,num_penalty)

Submission status: Wrong Answer

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

is_solved = [0]*(N+1)

solved = 0
penalties = 0

for i in range(M):
    p_idx, verdict = input().split()
    p_idx = int(p_idx)

    if verdict == "WA" and (not is_solved[p_idx]):
        penalties += 1
    elif verdict == "AC" and (not is_solved[p_idx]):
        solved += 1
        is_solved[p_idx] = 1


print(solved, penalties)

Submission status: Wrong Answer

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

is_solved = [0]*(N+1)

solved = 0
penalties = 0
for i in range(M):
    p_idx, verdict = input().split()
    p_idx = int(p_idx)

    if not is_solved[p_idx] and verdict == "WA":
        penalties += 1
    elif verdict == "AC" and not is_solved[p_idx]:
        solved += 1
        is_solved[p_idx] = 1


print(solved, penalties)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=[0]*(n+1)
p=0
for _ in range(m):
  a,b=list(input().split())
  if str(b)=="AC" and l[int(a)]!=-1:
    p+=l[int(a)]
    l[int(a)]=-1
  elif str(b)=="WA" and l[int(a)]==0:
    l[int(a)]+=1
print(l.count(-1),p)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=[0]*(n+1)
p=0
for _ in range(m):
  a,b=list(input().split())
  if str(b)=="AC" and l[int(a)]!=-1:
    p+=l[int(a)]
    l[int(a)]-=1
  elif str(b)=="WA" and l[int(a)]==0:
    l[int(a)]+=1
print(l.count(1),p)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=[0]*(n+1)
p=0
for _ in range(m):
  a,b=list(input().split())
  if str(b)=="AC" and l[int(a)]==0:
    l[int(a)]=1
  elif str(b)=="WA" and l[int(a)]==0:
    p+=1
print(l.count(1),p)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=[0]*(n+1)
p=0
for _ in range(m):
  a,b=list(input().split())
  if str(b)=="AC" and l[int(a)]==0:
    l[int(a)]==1
  elif str(b)=="WA" and l[int(a)]==0:
    p+=1
print(l.count(1),p)

Submission status: Wrong Answer

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

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

for i in range(m):
    if p[i][1] == "AC":
        ac[p[i][0] - 1] = 1
    if p[i][1] == "WA":
        if ac[p[i][0] - 1] == 1:
            continue
        else:
            wa[p[i][0] - 1] += 1
print(sum(ac), sum(wa))

Submission status: Wrong Answer

Solution code:
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('01-handmade-05.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    N, M = read_int_list()
    p = [0] * M
    S = [''] * M
    for i in range(M):
      l = read_str_list()
      p[i] = int(l[0])
      S[i] = l[1]
      
    correct, penalties = 0, 0
    f = set()  
    r = set()    
    for i in range(M):
      if S[i] == 'AC':
        if p[i] not in r:
          r.add(p[i])

      if S[i] == 'WA':
        if p[i] not in r and p[i] in f:
          r.add(p[i])

      if S[i] == 'AC':
        if p[i] not in f:
          f.add(p[i])
          correct += 1
      
      if S[i] == 'WA':
        if p[i] not in f and p[i] in r:
          penalties += 1

    print(correct, penalties)

main()

Submission status: Wrong Answer

Solution code:
def InS(): return input()


def InL(): return list(map(int, input().split()))


def InI(): return int(input())


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

i = 0
WAcnt = 0
stack = [False] * N
# stack = []

data_list = [list(map(str, input().split(" "))) for i in range(M)]

tmp = 0
if M == 0:
    print(0, 0)
else:
    while M > i:
        if stack[int(data_list[i][0]) - 1] == False:
            if data_list[i][1] == "AC":
                stack[int(data_list[i][0]) - 1] = True
                WAcnt += tmp
                tmp = 0
            else:
                tmp += 1
        i += 1
    print(sum(stack), WAcnt)

Submission status: Wrong Answer

Solution code:
def InS(): return input()


def InL(): return list(map(int, input().split()))


def InI(): return int(input())


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

i = 0
ACcnt = 0
WAcnt = 0
stack = [False] * N
# stack = []

data_list = [list(map(str, input().split(" "))) for i in range(M)]

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

else:
    while M > i:
        if stack[int(data_list[i][0]) - 1]:
            i = i + 1
        else:
            if data_list[i][1] == "AC":
                ACcnt = ACcnt + 1
                # stack.append(data_list[i][0])
                stack[int(data_list[i][0]) - 1] = True
                i += 1
            else:
                WAcnt = WAcnt + 1
                i = i + 1

    print(ACcnt, WAcnt)

Submission status: Wrong Answer

Solution code:
def InS(): return input()


def InL(): return list(map(int, input().split()))


def InI(): return int(input())


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

i = 0
ACcnt = 0
WAcnt = 0
stack = [False] * N
# stack = []

data_list = [list(map(str, input().split(" "))) for i in range(M)]

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

else:
    while M > i:
        if stack[int(data_list[i][0]) - 1]:
            i = i + 1
        else:
            if data_list[i][1] == "AC":
                ACcnt = ACcnt + 1
                # stack.append(data_list[i][0])
                stack[int(data_list[i][0]) - 1] = True
            else:
                WAcnt = WAcnt + 1
                i = i + 1

    print(ACcnt, WAcnt)

Submission status: Wrong Answer

Solution code:
def InS(): return input()


def InL(): return list(map(int, input().split()))


def InI(): return int(input())


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

i = 0
ACcnt = 0
WAcnt = 0
# stack = [False] * N
stack = []

data_list = [list(map(str, input().split(" "))) for i in range(M)]

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

else:
    while M > i:
        if data_list[i][0] in stack:
            i = i + 1
        else:
            if data_list[i][1] == "AC":
                ACcnt = ACcnt + 1
                stack.append(data_list[i][0])
                # stack[int(data_list[i][0]) - 1] = True
            else:
                WAcnt = WAcnt + 1
                i = i + 1

    print(ACcnt, WAcnt)

Submission status: Wrong Answer

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

ls = [False for _ in range(n+1)]

pen = 0

for _ in range(m):
  p,s = input().split()
  p = int(p)
  
  if ls[p] == True:
    pass
  elif s == "WA":
    pen += 1
  else:
    ls[p] = True
print(sum(ls),pen)

Submission status: Wrong Answer

Solution code:
#list検索

N,M=list(map(int,input().split()))
A=[input().split() for _ in range(M)]

p=[int(A[i][0]) for i in range(M)]
s=[str(A[i][1]) for i in range(M)]

d=0
c=0
cor=[]
for i in range(M):
    if (p[i] in cor)==False:
        if s[i]=='WA':
            d+=1
        else:
            c+=1
            cor.append(p[i])
            
print("{} {}".format(c,d))

Submission status: Wrong Answer

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

p=[int(A[i][0]) for i in range(M)]
s=[str(A[i][1]) for i in range(M)]

d=0
c=0
cor=[]
for i in range(M):
    if s[i]=='WA':
        if (p[i] in cor)==False:
            d+=1
    else:
        if (p[i] in cor)==False:
            c+=1
            cor.append(p[i])
print("{} {}".format(c,d))

Submission status: Wrong Answer

Solution code:
from sys import stdin
n,m = map(int,stdin.readline().split())
prob = dict()
AC,WA = 0,0
for _ in range(m):
	p,s = stdin.readline().split()
	p = int(p)
	if p in prob:
		if s == "AC":
			if prob[p] > 0:
				AC += 1
				WA += prob[p]
				prob[p] = 0
		else:
			prob[p] += 1
	else:
		if s == "AC":
			prob[p] = 0
			AC += 1
		else:
			prob[p] = 1
print(AC,WA)

Submission status: Wrong Answer

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

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

for b in a:
  p = int(b[0]) - 1
  if ac[p] == 1:
    next
  else:
    if b[1] == 'AC':
      ac[p] = 1
    else:
      wa[p] += 1
print('{} {}'.format(sum(ac),sum(wa)))

Submission status: Wrong Answer

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

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

for b in a:
  p = int(b[0]) - 1
  if ac[p] == 1:
    break
  else:
    if b[1] == 'AC':
      ac[p] = 1
    else:
      wa[p] += 1
print('{} {}'.format(sum(ac),sum(wa)))