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:
import numpy as np

def main():
    NM = [int(i) for i in input().split(" ")]
    if NM[1] == 0:
        ans = "0 0"
    else:
        pss = np.array([np.array(input().split(" ")) for j in range(NM[1])])

        probs = pss[:,0]
        answs = pss[:,1]

        ans_ac = 0
        ans_wa = 0

        probs_uniq = list(set(probs))
        for p in probs_uniq:
            res = list(answs[probs == p])
            if "AC" in res:    
                ind_ac = res.index("AC")
                ans_ac += 1
                ans_wa += ind_ac
            else:
                ans_wa += len(res)
        ans = str(ans_ac) + " " + str(ans_wa)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

pena = [0 for i in range(n)]
acc = [0 for i in range(n)]

for i in range(m):
    pp, ss = input().split(' ')
    p = int(pp) - 1

    if acc[p] == 0:
        if ss == 'WA':
            pena[p] += 1
        else:
            acc[p] = 1

print(sum(acc), sum(pena))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
acs = [0] * N
was = [0] * N
for m in range(M):
    p, S = input().split()
    # print(p, S)
    if S == 'AC':
        acs[int(p) - 1] = 1
    else:
        if acs[int(p) - 1] == 0:
            was[int(p) - 1] += 1

ac_count = sum(acs)
wa_count = sum(was)
print(ac_count, wa_count)
# print(acs)
# print(was)

Submission status: Wrong Answer

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

n, m = map(int, input().split())
check_list = [0] * n
ac_count = 0
wa_count = 0
for i in range(0, m):
    p, s = input().split()
    if check_list[int(p) - 1] == 0:
        if s == "WA":
            wa_count += 1
        else:
            ac_count += 1
            check_list[int(p) - 1] = 1
print(ac_count, wa_count)

Submission status: Wrong Answer

Solution code:
n, m = [int(x) for x in input().split()]
nac = 0
nwa = 0
pold = 0
tmp_wa = 0
past_ac = []
for i in range(m):
    p, s = [x for x in input().split()]
    if p != pold:
        pold = p
        tmp_wa = 0
    if s == 'AC' and p not in past_ac:
        nac += 1
        nwa += tmp_wa
        past_ac.append(p)
    else:
        tmp_wa += 1
print(nac, nwa)

Submission status: Wrong Answer

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

cnt = [[0, 0] for _ in range(N)]

res = [0, 0]
for i in range(M):
    p, s = input().split()
    p = int(p) - 1

    if cnt[p][0] > 0:
        continue

    if s == "AC":
        cnt[p][0] += 1
        res[0] += 1
    elif s == "WA":
        cnt[p][1] += 1
        res[1] += 1

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

Submission status: Wrong Answer

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

ans_count = 0
err_count = 0
cheak = 0
for _ in range(m):
    p,s = input().split()
    p = int(p)
    if p > cheak and s == 'AC':
        ans_count += 1
        cheak = p
    elif p > cheak and s == 'WA' :
        err_count += 1
print(ans_count,err_count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p = [0 for _ in range(m)]
s = ["" for _ in range(m)]
for i in range(m):
    pi, si = input().split()
    p[i] = int(pi)
    s[i] = si
ac = set()
wa = 0
for i in range(m):
    if s[i] == "AC" and p[i] not in ac:
        ac.add(p[i])
    elif s[i] == "WA" and p[i] not in ac:
        wa += 1

print(len(ac), wa)

Submission status: Wrong Answer

Solution code:
n, m = [int(x) for x in input().split(" ")]
ac = [False for i in range(0, n)]
wa_count = [0 for i in range(0, n)]

for i in range(0, m):
    pi, si = [x for x in input().split(" ")]
    pi = int(pi)
    if si == "WA" and not ac[pi-1] :
        wa_count[pi-1] += 1
    else:
        ac[pi-1] = True

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

submit = defaultdict(list)
for i in range(M):
    p,s = map(str, input().split())
    submit[p].append(s)


wa = 0
ac = 0
for k in submit.keys():
    for i in range(len(submit[k])):
        if submit[k][i] == "AC":
            wa += i
            ac += 1
            break
        elif i == len(submit[k])-1 and submit[k][i] == "WA":
            wa += i+1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
sl=[]
pl=[]
for i in range(m):
    p,s=map(str,input().split())
    pl.append(int(p))
    sl.append(s)
pena=0
ac=0
ac_p=[]

for i in range(m):
    p=pl[i]
    s=sl[i]
    if s=="WA":
        if not p in ac_p:
            pena+=1
    else:
        if not p in ac_p:
            ac+=1
            ac_p.append(p)
print("{0} {1}".format(ac,pena))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
AC = [False]*N
WA = [0]*N
for m in range(M):
    p,s = map(str,input().split())
    p = int(p)
    if AC[p-1] == False and s == 'WA':
        WA[p-1] += 1
    elif AC[p-1] == False and s == 'AC':
        AC[p-1] = True
print(AC.count(True),sum(WA))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
AC=[False]*N
pena=0
for i in range(M):
  p,s=map(str,input().split())
  p=int(p)-1
  if s=='WA' and AC[p]==False:
    pena +=1
  elif s=='AC':
    AC[p]=True
answer=0
for i in range(N):
  if AC[i]==True:
    answer +=1
print(answer,pena)

Submission status: Wrong Answer

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

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


for i in range(M):
  p,s = input().split()
  p = int(p)
  if T[p] == 0:
    T[p] = s
    if s == "AC":
      ans[0] += 1
    elif s == "WA":
      ans[1] += 1
      
  elif T[p] == "AC":
    continue
  elif T[p] == "WA":
    if s == "AC":
      T[p] == s
      ans[0] += 1
    elif s == "WA":
      ans[1] += 1
      
print(ans[0],ans[1])

Submission status: Wrong Answer

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

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

result_dic = {}

for i in range(n):
    result_dic[str(i+1)] = {'AC': 0, 'WA': 0}

for aa in a:
    if result_dic[aa[0]]['AC'] == 0:
        result_dic[aa[0]][aa[1]] += 1


ac_sum = 0
wa_sum = 0
for i in range(n):
    ac_sum += result_dic[str(i+1)]['AC']
    wa_sum += result_dic[str(i+1)]['WA']

print(str(ac_sum) + ' ' + str(wa_sum))

Submission status: Wrong Answer

Solution code:
import queue
import copy
import math

# 2つの入力を空白で分割し、数値化
N, M = map(int, input().split())

ac = set()
submits_count_until_AC = {} #

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

    prev = None

    if p in ac:
        continue

    if p in submits_count_until_AC:
        prev = submits_count_until_AC[p]
    else:
        prev = 0

    if S == "AC":
        ac.add(p)
    else:
        submits_count_until_AC[p] = prev + 1


ac_coount = len(ac)

pena = 0

for v in submits_count_until_AC.values():
    pena += v

print("{} {}".format(ac_coount, pena))

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
Penalty = 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':
        Penalty = Penalty + 1

print(AC, Penalty)

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" and isAC[p] == "WA":
        penalty += 1
        #print(penalty)
    elif r == "AC" and isAC[p] == "WA":
        isAC[p] = "AC"
        score+=1
        #print(score)
    #print(isAC)
print(score,penalty)

Submission status: Wrong Answer

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

d = {}
ans = [0, 0]

for i in range(M):
  p, s = input().split()
  r = d.get(p)
  if r == 'AC':
    pass
  else:
    if s == 'AC':
      ans[0] += 1
      d[p] = 'AC'
    elif s == 'WA':
      ans[1] += 1
      d[p] = 'WA'

print(*ans)

Submission status: Wrong Answer

Solution code:
n, m = [int(el) for el in input().split(' ')]
df = []
for i in range(m):
	df.append(input().split(' '))

record = []
for i in range(n):
	record.append([0,0])

for i in range(m):
	x = df[i][1]
	q = int(df[i][0])
	if record[q-1][0] == 1:
		pass
	else:
		if x == "AC":
			record[q-1][0] = 1
		else:
			record[q-1][1] += 1

ans = 0
for i in range(n):
	ans += record[i][0]


pen = 0
for i in range(n):
	pen += record[i][1]

print(ans, pen)

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 s not in set(ac_num):
    wa_num.append(p)
print(len(set(ac_num)), len((wa_num)))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
mem = set()
ac =0;wa =0
for i in range(m):
    a,b = input().split()
    if a not in mem:
        if b == 'AC':
            mem.add(a)
            ac+=1
        else:
            wa+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
nlis = [0] * n
ac = 0
wa = 0
for _ in range(m):
    p, s = input().split()
    p = int(p) -1
    if nlis[p]:
        continue
    if s == "WA":
        wa += 1
    else:
        ac += 1
        nlis[p] = 1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p = [list(map(str,input().split())) for i in range(m)]
answa = [0] * (n+1)
ans = [False] * (n+1)

#print(p)
for i in range(m):
    #print(p[i][1])
    #print(ans[int(p[i][0])])
    #print(sum(ans),sum(answa))
    #print(ans)
    if p[i][1] == "WA" and ans[int(p[i][0])] == False:
        answa[int(p[i][0])] += 1
    elif p[i][1] == "AC":
        ans[int(p[i][0])] = True

print(sum(ans),sum(answa))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
d = {}
b = 0
for _ in range(m):
    p, s = input().split()
    if p in d:
        continue
    else:
        if s == 'WA':
            b += 1
        else:
            d[p] = 'AC'
print(len(d), b)

Submission status: Wrong Answer

Solution code:
def main():
    n, m = list(map(int, input().split()))
    ac_list = [0] * n
    wa_list = [0] * n
    for _ in range(m):
        tmp = input().split()
        contest_num = int(tmp[0]) - 1
        if ac_list[contest_num]:
            continue
        ret = tmp[1]
        if ret == "AC":
            ac_list[contest_num] = 1
        else:
            wa_list[contest_num] = 1

    penalty = [1 if ac_list[i] and wa_list[i] else 0 for i in range(n)]

    print(sum(ac_list), sum(penalty))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
list_ac = []
count_wa = 0

for i in range(m):
    p, s = map(str,input().split())
    if s =='AC':
        list_ac.append(int(p))
    else:
        if int(p) not in list_ac:
            count_wa +=1
print(len(set(list_ac)), count_wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
answer = set()
n =0
for i in range(m):
    num,ans = input().split()
    if ans == 'AC':
        answer.add(int(num))
    else:
        if(int(num) in answer):
            pass
        else:
            n +=1
print(len(answer),n)

Submission status: Wrong Answer

Solution code:
num_problem, num_submit = map(int, input().split())

accepted = set()
wrong_ans = 0

for _ in range(0, num_submit):
    sp = input().split()
    prob = int(sp[0])
    ac = sp[1] == "AC"

    if prob in accepted:
        continue
    if ac:
        accepted.add(prob)
    else:
        wrong_ans += 1

num_ac = len(accepted)
print(num_ac, wrong_ans)

Submission status: Wrong Answer

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

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

    if S == "AC":
        if ac[p-1] == 0:
            ac[p-1] += 1
            
    else:
        if ac[N-1] == 0:
            wa[p-1] += 1

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

Submission status: Wrong Answer

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

count = 0

tmp = 0

prev = 1
for ptext, S in pS:
  p = int(ptext)
  if p == prev:
    if S == 'WA':
      tmp += 1
    elif S == 'AC':
      count += tmp
      tmp = 0
      prev += 1
print(prev-1, count)

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))

seitou = 0
Seitou_num = []
for x in PS:
    if x[1] == 'AC':
        seitou += 1
        Seitou_num.append(x[0])

gotou = [0 for _ in range(n)]
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[P[i]-1] += 1

gotou_all = sum(gotou)

print(str(seitou) + ' ' + str(gotou_all))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
k = []
ac_count = 0
miss_count = 0
for i in range(M):
    s = input().split()
    if s[1] == "AC":
        if int(s[0]) in k:
            continue
        else:
            k.append(int(s[0]))
            ac_count += 1
    else:
        if int(s[0]) in k:
            continue
        else:
            miss_count += 1
print(ac_count,miss_count)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


N, M = read_ints()
from collections import defaultdict
flgs = defaultdict(lambda: False)  # N問をACしたか
n_ac = 0
n_wa = 0
for _ in range(M):
    p, s = input().split()
    p = int(p) - 1
    if flgs[p]:
        continue

    if s == 'AC':
        flgs[p] = True
        n_ac += 1
    elif s == 'WA':
        n_wa += 1

print(n_ac, n_wa)

Submission status: Wrong Answer

Solution code:
N, M = input().split()
pS = [input().split() for i in range(int(M))]
ans = {}
for i in pS:
    if i[0] not in ans.keys():
        ans[i[0]] = [0, 0]
        if i[1] == "AC":
            if ans[i[0]][0] == 0:
                ans[i[0]][0] += 1
        elif i[1] == "WA":
            if ans[i[0]][0] > 0:
                pass
            else:
                ans[i[0]][1] += 1
    else:
        if ans[i[0]][0] == 0:
                ans[i[0]][0] += 1
        elif i[1] == "WA":
            if ans[i[0]][0] > 0:
                pass
            else:
                ans[i[0]][1] += 1
ac = 0
wa = 0
for i in ans.values():
    ac += i[0]
    wa += i[1]
print(ac, wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
a=[]
for i in range(n):
    a.append([0,0])
b=[]
c=0
d=0
for i in range(m):
    b.append(list(input().split()))
    b[i][0]=int(b[i][0])
a=sorted(a,key=lambda x:x[0])
for i in range(m):
    if b[i][1]=='WA':
        if a[b[i][0]-1][0]==0:
            a[b[i][0]-1][1]+=1
    else:
        if a[b[i][0]-1][0]==0:
            a[b[i][0]-1][0]=1
for i in range(n):
    c+=a[i][0]
    d+=a[i][1]
print(c,d)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
wa=0
ac=0
ig=0

for i in range(m):
  c,r=input().split()
  if c==ig:
    continue
  
  if r == 'WA':
    wa+=1
  elif r == 'AC':
    ac+=1
    ig=c
    
print(ac,wa)

Submission status: Wrong Answer

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

ac_list = [0] * (N+1)
wa_cnt = 0
ac_cnt = 0

for _ in range(M):
  p, S = map(str, input().split())
  if S == 'AC':
    if ac_list[int(p)] == 0:
      ac_cnt += 1
      ac_list[int(p)] = 1
    else:
      pass
  else:
    if ac_list[int(p)] == 0:
      wa_cnt += 1
    else:
      pass
  
print(ac_cnt, wa_cnt)

Submission status: Wrong Answer

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


sub = [list(input().split()) for _ in range(M)]

AC_set = set()

AC_cnt = 0
WA_cnt = 0

for p, ans in sub:
    p = int(p)
    if ans == 'AC':
        if p not in AC_set:
            AC_cnt += 1
            AC_set.add(p)
    else:
        if p not in AC_set:
            WA_cnt += 1


print(AC_cnt, WA_cnt)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
a = [0] * n
ans_1 = 0
ans_2 = 0
for i in range(m):
    p, s = map(str, input().split())
    if a[int(p) - 1] >= 0:
        if s == "WA":
            a[int(p) - 1] += 1
            ans_2 += 1
        else:
            a[int(p) - 1] = -1
            ans_1 += 1
print(ans_1, ans_2)

Submission status: Wrong Answer

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


def main():
    n, m = map(int, input().split())
    ac_count = [0 for _ in range(n)]
    wa_count = [0 for _ in range(n)]

    for i in range(m):
        pi, si = input().split()
        pi = int(pi)
        pi -= 1

        if si == 'WA':
            if ac_count[pi] == 0:
                wa_count[pi] += 1
        else:
            if ac_count[pi] == 0:
                ac_count[pi] = 1

    print(sum(ac_count), sum(wa_count))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p = []
s = []
ans = [0, 0]
for i in range(m):
    input_p, input_s = input().split()
    p.append(int(input_p))
    s.append(input_s)

ac_list = []
for i in range(m):
    if p[i] not in ac_list and s[i] == 'AC':
        ans[0] += 1
        ac_list.append(p[i])
    elif p[i] not in ac_list and s[i] == 'WA':
        ans[1] += 1
print(ans[0], ans[1])

Submission status: Wrong Answer

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

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

print(sum(correct),penalty)

Submission status: Wrong Answer

Solution code:
N, M=list(map(int, input().split()))
problem = []
result  = []
for _ in range(M):
    str_list = input().split(' ')
    problem.append(int(str_list[0]))
    result.append(str_list[1])

first_AC = [False]*N
pena     = [0]*N
for (p, r) in zip(problem, result):
    if first_AC[p-1]==False:
        if r=='WA':
            pena[p-1] += 1
        elif r=='AC':
            first_AC[p-1]=True
collect    = sum(first_AC)
total_pena = sum(pena)
print('%d %d' % (collect, total_pena))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

dic = {x: [] for x in range(1, n+1)}
for p, s in arr:
    dic[int(p)].append(s)

ac = 0
wa = 0
for k, v in dic.items():
    for x in v:
        if x == 'AC':
            ac += 1
            break
        else:
            wa += 1

print(ac, wa)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
count = 0
ans = []
penal = 0
p = [0]*m
x = [0]*m
for i in range(m):
    p[i], x[i] = map(str, input().split())
    if x[i] == "AC":
        ans.append(p[i])
        ans = list(set(ans))
    elif x[i] == "WA":
        for j in range(len(ans)):
            if ans[j] == p[i]:
                break
            penal += 1

print("{}".format(len(ans)) + " {}".format(penal))

Submission status: Wrong Answer

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


c = 0
a = 0

t = 0

temp = []

for i in range(m):
    s = input().split()
    if s[0] not in temp:
        if s[1] == 'AC':
            a += 1
            c += t
            t = 0
            temp.append(s[0])
        elif s[1] == 'WA':
            t += 1

print(a, c)

Submission status: Wrong Answer

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

print(sum(record), penalty)

Submission status: Wrong Answer

Solution code:
N,M = list(map(int,input().split()))
S = [0]*N
ac = 0
wa = 0
for i in range(M):
    p,s = input().split()
    p = int(p)
    #未正解の時
    if S[p-1] == 0:
        #正解すると
        if s == "AC":
            ac += 1
            S[p-1] = 1
        else:
            wa += 1
    #すでに正解している時
    else:
        pass
    
print(ac,wa)

Submission status: Wrong Answer

Solution code:
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def my_round(a,dig=0):
    p = 10 ** dig
    return (a * p * 2 + 1) // 2 / p

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b): #最小公倍数
    return a/gcd(a,b)*b

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): #素因数分解
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

def main():
    n,m = map(int,input().split())
    p = []
    s = []
    for i in range(m):
        a,b = input().split()
        p.append(int(a))
        s.append(b)
    mp = {}
    ans = 0
    pena = 0
    for i in range(m):
        if p[i] in mp.keys():
            if mp[p[i]] == 1:
                continue
            elif s[i] == 'AC':
                mp[p[i]] = 1
                ans += 1
            else:
                pena += 1
        else:
            if s[i] == 'AC':
                mp[p[i]] = 1
                ans += 1
            else:
                mp[p[i]] = 0
                pena += 1
    print(ans,pena)
    return

if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
hist = {}
count_ac = count_wa = 0
for i in range(m):
  p,s = input().split()
  if p in hist:
    continue
  if s == 'AC':
    hist[p] = True
    count_ac += 1
  else:
    count_wa += 1
print('{} {}'.format(count_ac, count_wa))

Submission status: Wrong Answer

Solution code:
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
ans = [[] for i in range(N)]
for i in range(M):
    p,s = [(x) for x in stdin.readline().rstrip().split()]
    ans[int(p)-1].append(s)

ac = 0
pe = 0
tmp = 0
flag = False
for j in range(N):
    for k in ans[j]:
        if k == "WA":
            tmp += 1
        else:
            ac += 1
            pe += tmp
            break
print(ac,pe)

Submission status: Wrong Answer

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

ps = set(ps)
ps = list(ps)
AC = 0
WA = 0
for i in range(len(ps)):
    if ps[i][1] == "AC":
        AC += 1
    else:
        WA += 1

print(str(AC) + " " + str(WA))

Submission status: Wrong Answer

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

AC = [0]*(n+1)
WA = [0]*(n+1)

for i in range(m):
  p_number, p_status = input().split()
  p_number =int(p_number)
  if (p_status =='WA') & (AC[p_number]==0):
    WA[p_number]+=1
  if (p_status =='AC') & (AC[p_number]==0):
    AC[p_number]+=1

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p = [0]*n
num_wa = 0
for i in range(m):
    a, b= map(str, input().split())
    if 0 == p[int(a)-1] and b == "WA":
        num_wa += 1
    else:
        p[int(a)-1] = 1

print(sum(p), num_wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC_list = set()
WA = 0
AC = 0
for i in range(M):
    p, S = map(str, input().split())
    if S == "AC":
        if p in AC_list:
            continue
        else:
            AC += 1
            AC_list.add(p)
    elif S == "WA":
        if p not in AC_list:
            WA += 1
        else:
            continue
print(AC, WA)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
P = [0 for _ in range(N+1)]
S = [0 for _ in range(N+1)]

for _ in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'WA' and S[p] == 0:
        P[p] += 1
    elif s == 'AC' and S[p] == 0:
        S[p] = 1

print(sum(S), sum(P))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
A=[]
W=[]
L=[]
ac=0
wa=0

for i in range(m):
    a,b=map(str,input().split())
    if int(a) not in A and b == "AC":
        ac+=1
        A.append(int(a))

    elif int(a) not in A and b=="WA":
        wa+=1
    
    
print(ac,wa)

Submission status: Wrong Answer

Solution code:
import math

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)

        if ans[i-1] == False:
            if result == "AC":
                ac += 1
                ans[i-1] = True
            elif result == "WA":
                wa += 1
    print(sum(ans), wa)
    return 0
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

print(AC, WA)

Submission status: Wrong Answer

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

ans = 0
pena = 0
for p, s in [input().split() for _ in range(M)]:
    p = int(p)
    if flags[p-1] is not False:
        if s == "WA":
            pena += 1
        else:
            flags[p-1] = False
            ans += 1

print(ans, pena)

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
list = [list(input().split()) for i in range(M)]
flag_ac = [0] * N
ans_seitou = 0
ans_penalty = 0
for i in range(M):
    if list[i][1] == "AC":
        if flag_ac[int(list[i][0]) - 1] == 1:
            continue

        flag_ac[int(list[i][0]) - 1] = 1
        ans_seitou += 1
    
    if list[i][1] == "WA":
        if flag_ac[int(list[i][0]) - 1] != 1:
            ans_penalty += 1

print(ans_seitou,ans_penalty)

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 = input().split(" ")
    pi, si = int(ps[0]), ps[1]

    if si == "AC" and (not pi in p):
        c += 1
        p.append(pi)
    elif si == "WA" and (not pi in p):
        penalty += 1
print(c, penalty)

Submission status: Wrong Answer

Solution code:
from collections import Counter
n, m = map(int, input().split())
ac = Counter()
wa = Counter()
for _ in range(m):
    p, s = input().split()
    if s == 'WA':
        if ac[p] == 0:
            wa[p] += 1
    else:
        ac[p] = 1

acs = sum(ac.values())
was = sum(wa.values())

print(acs, was)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N, M = map(int, input().split())
l = {}
for i in range(M):
    tmp = input().split()
    if int(tmp[0]) not in l.keys():
        l[int(tmp[0])] = [tmp[1]]
    else:
        if tmp[1] == "AC" and tmp[1] not in l[int(tmp[0])]:
            l[int(tmp[0])].append(tmp[1])
        else:
            if "AC" not in l[int(tmp[0])]:
                l[int(tmp[0])].append(tmp[1])
ac, wa = 0, 0
v = l.items()
for k in l.keys():
    for i in range(len(l[k])):
        if l[k][i] == "AC":
            ac += 1
        else:
            wa += 1
print(ac, wa)