Problem:


Score : 300 points

Problem Statement

Takahashi participated in a contest on AtCoder.

The contest had N problems.

Takahashi made M submissions during the contest.

The i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).

The number of Takahashi's correct answers is the number of problems on which he received an AC once or more.

The number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.

Find the numbers of Takahashi's correct answers and penalties.

Constraints

N, M, and p_i are integers.

1 \leq N \leq 10^5

0 \leq M \leq 10^5

1 \leq p_i \leq N

S_i is AC or WA.

Input

Input is given from Standard Input in the following format:

N M
p_1 S_1
:
p_M S_M

Output

Print the number of Takahashi's correct answers and the number of Takahashi's penalties.

Sample Input 1

2 5
1 WA
1 AC
2 WA
2 AC
2 WA

Sample Output 1

2 2

In his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.

In his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.

Thus, he has two correct answers and two penalties.

Sample Input 2

100000 3
7777 AC
7777 AC
7777 AC

Sample Output 2

1 0

Note that it is pointless to get an AC more than once on the same problem.

Sample Input 3

6 0

Sample Output 3

0 0



Sample input:
2 5
1 WA
1 AC
2 WA
2 AC
2 WA


Sample output:
2 2

Submission status: Wrong Answer

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

n_flg = [False for _ in range(n)]
pena_tmp = [0 for _ in range(n)]

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

    p = int(p) - 1

    if n_flg[p]:
        pass
    elif s == 'WA':
        pena_tmp[p] += 1
    elif s == 'AC':
        # pena += pena_tmp[p]
        n_flg[p] = True

print(n_flg.count(True), sum(pena_tmp))

Submission status: Wrong Answer

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

ac = 0
aced = set()
pindex = set()
s = []
if nm[1] != 0 :
    ps = input().split()
    pindex.add(ps[0])
    s.append(0)
    if ps[1] == 'WA':
        s[list(pindex).index(ps[0])] += 1
    else:
        ac += 1
        aced.add(ps[0])
    for i in range(nm[1] - 1):
        ps = input().split()
        if ps[0] not in aced:
            if ps[0] not in pindex:
                pindex.add(ps[0])
                s.append(0)
            if ps[1] == 'WA':
                s[list(pindex).index(ps[0])] += 1
            else:
                ac += 1
                aced.add(ps[0])

    print(str(ac) + ' ' + str(sum(s)))
else:
    print('0 0')

Submission status: Wrong Answer

Solution code:
nm = list(map(int, input().split()))
wa = 0
watmp = 0
ac = 0
aced = []
if nm[1] != 0 :
    ps = input().split()
    if ps[1] == 'WA':
        watmp += 1
    elif ps[0] not in aced:
        wa += watmp
        ac += 1
        watmp = 0
        aced.append(ps[0])
    for i in range(nm[1] - 1):
        ps = input().split()
        if ps[1] == 'WA':
            watmp += 1
        elif ps[0] not in aced:
            wa += watmp
            ac += 1
            watmp = 0
            aced.append(ps[0])
            
    print(str(ac) + ' ' + str(wa))
else:
    print('0 0')

Submission status: Wrong Answer

Solution code:
nm = list(map(int, input().split()))
wa = 0
watmp = 0
ac = 0
aced = []
if nm[1] != 0 :
    ps = input().split()
    if ps[1] == 'WA':
        watmp += 1
    else:
        wa += watmp
        ac += 1
        watmp = 0
        aced.append(ps[0])
    for i in range(nm[1] - 1):
        ps = input().split()
        if ps[1] == 'WA':
            watmp += 1
        elif ps[0] not in aced:
            wa += watmp
            ac += 1
            watmp = 0
            aced.append(ps[0])
            
    print(str(ac) + ' ' + str(wa))
else:
    print('0 0')

Submission status: Wrong Answer

Solution code:
nm = list(map(int, input().split()))
wa = 0
watmp = 0
ac = 0
aced = []
if nm[1] != 0 :
    ps = input().split()
    if ps[1] == 'WA':
        watmp += 1
    else:
        wa += watmp
        ac += 1
        watmp = 0
    for i in range(nm[1] - 1):
        ps = input().split()
        if ps[1] == 'WA':
            watmp += 1
        elif ps[0] not in aced:
            wa += watmp
            ac += 1
            watmp = 0
            aced.append(ps[0])
            
    print(str(ac) + ' ' + str(wa))
else:
    print('0 0')

Submission status: Wrong Answer

Solution code:
nm = list(map(int, input().split()))
wa = 0
watmp = 0
ac = 0
if nm[1] != 0 :
    ps = input().split()
    if ps[1] == 'WA':
        watmp += 1
    else:
        wa += watmp
        ac += 1
        watmp = 0
    for i in range(nm[1] - 1):
        ps = input().split()
        if ps[1] == 'WA':
            watmp += 1
        else:
            wa += watmp
            ac += 1
            watmp = 0
    print(str(ac) + ' ' + str(wa))
else:
    print('0 0')

Submission status: Wrong Answer

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

n_flg = [False for _ in range(n)]

pena = 0

for _ in range(m):
    p,s = input().split()
    p = int(p) - 1
    if n_flg[p]:
        pass
    elif s == 'WA':
        pena += 1
    elif s == 'AC':
        n_flg[p] = True

print(n_flg.count(True), pena)

Submission status: Wrong Answer

Solution code:
# ABC 151C
n, m = map(int, input().split())
ac = 0
wa = 0
cnt = [0]*n
for i in range(m):
    p, s = input().split()
    p = int(p)
    p -= 1
    if cnt[p] == -1:
        continue
    if s == 'AC':
        ac += 1
        wa += cnt[p]
        cnt[p] = 0
    else:
        cnt[p] += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
#151c
n,w=map(int,input().split())
ac=0
wa=[0]*n
wa_cnt=0
ac_flg=[0]*n
for i in range(w):
	p,s=input().split()
	p=int(p)-1
	if ac_flg[p]==1:
		continue
	else:
		if s=='AC':
			ac_flg[p]=1
			ac+=1
			wa[p] +=wa_cnt
			wa_cnt=0
		else:
			wa_cnt+=1

wa_ans=0
for i in range(n):
	wa_ans+=wa[i]

print(ac,wa_ans)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
s=set()
ac,w=0,0
for _ in range(m):
    a,b=map(str,input().split())
    if b=='AC' and (a not in  s):
        s.add(a)
        ac+=1
    elif b=='WA' and (a not in s):
        w+=1
print(ac,'',w)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
s=set()
ac,w=0,0
for _ in range(m):
    a,b=map(str,input().split())
    if b=='AC' and a not in  s:
        s.add(a)
        ac+=1
    if b=='WA' and a not in s:
        w+=1
print(ac,'',w)

Submission status: Wrong Answer

Solution code:
#151c
n,w=map(int,input().split())
ac=0
wa=0
wa_cnt=0
ac_flg=[0]*n
for i in range(w):
	p,s=input().split()
	p=int(p)-1
	if ac_flg[p]==1:
		continue
	else:
		if s=='AC':
			ac_flg[p]=1
			ac+=1
			wa+=wa_cnt
			wa_cnt=0
		else:
			wa_cnt+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
#151c
n,w=map(int,input().split())
ac=0
wa=0
wa_cnt=0
ac_flg=[0]*n
for i in range(w):
	p,s=input().split()
	p=int(p)-1
	if ac_flg[p]==1:
		continue
	else:
		if s=='AC':
			ac_flg[p]=1
			ac+=1
			wa+=wa_cnt
		else:
			wa_cnt+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N, M = map(int, input().split())
WA = defaultdict(int)
AC = defaultdict(int)
boollist = [False]*N

for _ in range(M):
    p,s = input().split()
    p = int(p)
    if s == 'WA' and not boollist[p-1]:
        WA[p] += 1
    elif s == 'AC':
        boollist[p-1] = True
        AC[p] = 1
print(sum(AC.values()), sum([a for a,b in zip(WA.values(), boollist) if b==True]))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N, M = map(int, input().split())
WA = defaultdict(int)
AC = defaultdict(int)
boollist = [False]*N

for _ in range(M):
    p,s = input().split()
    p = int(p)
    if s == 'WA' and not boollist[p-1]:
        WA[p] += 1
    elif s == 'AC':
        boollist[p-1] = True
        AC[p] = 1
print(sum(AC.values()), sum(WA.values()))

Submission status: Wrong Answer

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

ac_set = set()
wa_count = 0
for p, s in PS:
    if s == 'AC':
        ac_set.add(p)
    else:
        if p not in ac_set:
            wa_count += 1
print(len(ac_set), wa_count)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N, M = map(int, input().split())
WA = defaultdict(int)
AC = defaultdict(int)
pena = [0]*N

for _ in range(M):
    p,s = input().split()
    p = int(p)
    if s == 'WA':
        WA[p] += 1
    elif s == 'AC':
        AC[p] = 1
        if pena[p-1] == 0:
            pena[p-1] = WA[p]
print(sum(AC.values()), sum(pena))

Submission status: Wrong Answer

Solution code:
def solve():
    N,M = map(int, input().split())
    accepted = [False]*(N+1)
    res = [0,0]
    for _ in range(M):
        p, submit_res = input().split()
        p = int(p)
        if not accepted[p]:
            if submit_res == 'WA':
                res[1] += 1
            else:
                res[0] += 1
                accepted[p] = True
                
    print(' '.join(map(str, res)))
    
solve()

Submission status: Wrong Answer

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


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    d = dict([(i, []) for i in set(p)])
    for _p, _s in zip(p, S):
        d[_p].append(_s)
    # print(d)
    A = 0
    W = 0
    for v in d.values():
        if 'AC' in v:
            _a = v.index('AC')
            # print(_a)
            A += 1
            W += _a
        else:
            W += len(v)
    print(A, W)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ps=[list(map(int,input().replace('WA','0').replace('AC','1').split())) for i in range(m)]
tmp_p=0
ac_cnt=0
wa_cnt=0
wa=0
flg=0
for i in range(m):
  p=ps[i][0]
  s=ps[i][1]
  if tmp_p!=p:
    wa=0
    flg=0
  if s==1 and flg==0:
    flg=1
    ac_cnt+=1
    wa_cnt+=wa
  elif s==0 and flg==0:
    wa+=1
  tmp_p=p
print(ac_cnt, wa_cnt)

Submission status: Wrong Answer

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

tempP = ""
ac = []
wa = []

for count in range(N):
    ac.append(0)
    wa.append(0)

for count in range(M):
    P,S = input().split()
    P = int(P)
    P -= 1
    
    if ac[P] == 0:
        if S == "AC":
            ac[P] = 1
        else:
            wa[P] +=1


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

Submission status: Wrong Answer

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

ACFlag = False
ACCount = 0
WACount = 0
tempP = ""

for count in range(M):
    P,S = input().split()
    P = int(P)
    S = str(S)

    if count == 0:
       tempP = P

    if tempP != P:
       tempP = P
       ACFlag = False

    if ACFlag == False and S == "AC":
        ACCount += 1
        ACFlag = True
    elif ACFlag == False and S == "WA":
        WACount += 1


print(str(ACCount) + " " + str(WACount))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ss=set()
penality=0
for _ in range(m):
  p,s=input().split()
  p=int(p)
  if (p not in ss) and s=="WA":
    penality+=1
  if s=="AC":
    ss.add(p)
print(len(ss),penality)

Submission status: Wrong Answer

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

ac = 0
wa = 0
status = ["WA" for i in range(n)]

for i in lst:
    if status[i[0]-1]=="WA":
        if i[1]=="AC":
            ac += 1
            status[i[0]-1] = "AC"
        else:
            wa += 1

print(ac,wa)

Submission status: Wrong Answer

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

is_ac = [0] * (n+1)
count_ac = count_wa = 0
for pp, ss in zip(p, s):
    if not is_ac[pp]:
        if ss == 'WA':
            count_wa += 1
        else:
            count_ac += 1
            is_ac[pp] = 1

print(count_ac, count_wa)

Submission status: Wrong Answer

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

ac=[0]*n
ac_cnt=0
wa_cnt=0
for i in range(len(l)):
    num = int(l[i][0])-1
    acwa= l[i][1]

    if acwa == "AC" and ac[num]==0:
        ac_cnt+=1
        ac[num]=1
    if acwa=="WA" and ac[num]==0:
        wa_cnt+=1
print(ac_cnt,wa_cnt)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ans = 0 
pen = 0
p = 0
l = {}
for i in range(m):
    s = input().split()
    s1,s2 = int(s[0]),s[1]
    if s2 == "AC":
        try:
            a = l[s1] 
        except KeyError:
            l[s1] = 0
    if s2 == "WA":
        p += 1
    else:
        l[s1] += 1
        if l[s1] == 1:
            ans += 1
            pen += p
            p = 0
print(ans,pen)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ans = 0 
pen = 0
p = 0
l = []
for i in range(m):
    s = input().split()
    s1,s2 = int(s[0]),s[1]
    if s2 == "WA":
        p += 1
    elif s1 not in l and s2 == "AC":
        ans += 1
        pen += p
        p = 0
        l.append(s1)
print(ans,pen)

Submission status: Wrong Answer

Solution code:
n, m = [int(elem) for elem in input().split()]

result = {}
for i in range(m):
  idx, res = input().split()
  if not idx in result:
    result[idx] = [res]
  else:
    if 'AC' in result[idx]:
      pass
    else:
      result[idx].append(res)

ac = 0
wa = 0
for k in result.keys():
  if 'AC' in result[k]:
    ac += 1
  if 'WA' in result[k]:
    wa += result[k].count('WA')
print(ac, wa)

Submission status: Wrong Answer

Solution code:
# 問題数 = n と 回答数 = m を取得
n, m = map(int, input().split())

# 必要な変数を定義
ac = [0] * n
wa = [0] * n

for i in range(m):
    # i+1 回目の結果を取得
    p, s = list(input().split())
    p = int(p) - 1

    # ACではない場合
    if s == "WA" and ac[p] != 1:
        wa[p] = 1

    # ACである場合
    if s == "AC":
        ac[p] = 1

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

Submission status: Wrong Answer

Solution code:
# 問題数 = n と 回答数 = m を取得
n, m = map(int, input().split())

# 必要な変数を定義
ac = [0] * n
wa = [0] * n

for i in range(m):
    # i+1 回目の結果を取得
    p, s = list(input().split())
    p = int(p) - 1

    # ACではない場合
    if ac[p] != 1:
        wa[p] = 1

    # ACである場合
    if s == "AC":
        ac[p] = 1

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

Submission status: Wrong Answer

Solution code:
# 問題数 = n と 回答数 = m を取得
n, m = map(int, input().split())

# 必要な変数を定義
ac = [0] * n
wa = [0] * n

for i in range(m):
    # i+1 回目の結果を取得
    p, s = list(input().split())
    p = int(p) - 1

    # ACではない場合
    if ac[p] != 1:
        wa[p] = 1

    # ACである場合
    if s == "AC":
        ac[p] = 1

    print(ac, wa)

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

Submission status: Wrong Answer

Solution code:
# 必要な変数を定義
ansList = []
acNum, waNum = 0, 0

# 問題数 = n と 回答数 = m を取得
n, m = map(int, input().split())

for i in range(m):
    # i+1 回目の結果を取得
    p, s = list(input().split())
    p = int(p)

    # 既にACであれば何もしない
    if ansList.count(p) > 0:
        continue

    # ACである場合
    if s == "AC":
        acNum += 1
        ansList.append(p)
        continue

    # ACではない場合
    waNum += 1

print(acNum, waNum)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
prev_p = 0
cnt_ac = 0
cnt_wa = 0

aced_state = [False for i in range(N+1)]

for i in range(M):
    p,s = map(str,input().split())
    p = int(p)
    if aced_state[p] == True:
        continue
    else:
        if s == "AC":
            cnt_ac += 1
            aced_state[p] = True
        else:
            cnt_wa += 1

print(cnt_ac,cnt_wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
prev_p = 0
aced = False
cnt_ac = 0
cnt_wa = 0
for i in range(M):
    p,s = map(str,input().split())
    p = int(p)
    if prev_p != p:
        prev_p = p
        aced = False
    if aced:
        continue
    else:
        if s == "AC":
            cnt_ac += 1
            aced = True
        else:
            cnt_wa += 1
print(cnt_ac,cnt_wa)

Submission status: Wrong Answer

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


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):

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

    collect = 0
    penalty = 0
    for i in range(M):
        if state[str(p[i])] == "WA" and S[i] == "AC":
            state[str(p[i])] = S[i]
            collect += 1
        elif state[str(p[i])] == "WA" and S[i] == "WA":
            penalty += 1

    print(collect, penalty)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)


if __name__ == "__main__":
    main()

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) - 1
    if s == 'AC':
        ac[p] = 1
    if not ac[p] and s == 'WA':
        wa[p] += 1

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
missed = {str(i): 0 for i in range(1, N + 1)}
answered = {}
for _ in range(M):
    idx_q, status = input().split()
    if status == 'AC':
        answered[idx_q] = 'AC'
    else:
        if idx_q not in answered:
            missed[idx_q] += 1
print(len(answered), sum(missed.values()))

Submission status: Wrong Answer

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

ac_cnt=0
wa_cnt=0
flag=0
no=-1

for i in range(m):
    a,b=input().split()
    if flag == 1 and no!= a:
        flag=0
    else:
        if flag == 0 and b == "WA":
            wa_cnt += 1
        elif flag == 0 and b == "AC":
            ac_cnt += 1
            flag += 1
            no=a

print(ac_cnt,wa_cnt)

Submission status: Wrong Answer

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

ans=dict()
AC=0
WA=0

for i in range(M):
    P,S= map(str,input().split())
    if((P in ans)==False):
        ans[P]=[S]
    else:
        ans[P].append(S)

for i in ans.values():
    for value in i:
        if(value=='AC'):
            AC+=1
            break
        else:
            WA+=1
print(AC,WA)

Submission status: Wrong Answer

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

ac_cnt=0
wa_cnt=0
flag=0
no=-1

for i in range(m):
    a,b=input().split()
    if no != a:
        flag = 0
        if flag == 0 and b == "WA":
            wa_cnt += 1
        elif flag == 0 and b == "AC":
            ac_cnt += 1
            flag += 1
            no=a
    else:
        continue

print(ac_cnt,wa_cnt)

Submission status: Wrong Answer

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

ans=dict()
AC=0
WA=0

for i in range(M):
    P,S= map(str,input().split())
    if((P in ans)==False):
        if(S=='AC'):
            AC+=1
        ans[P]=S
    if(ans[P]=='WA'):
        if(S=='AC'):
            AC+=1
            ans[P]=S
        elif(S=='WA'):
            WA+=1
print(AC,WA)

Submission status: Wrong Answer

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

ans=dict()
AC=0
WA=0

for i in range(M):
    P,S= map(str,input().split())
    if((P in ans)==False):
        if(S=='AC'):
            AC+=1
        ans[P]=S
    if(S=='AC' and ans[P]!='AC'):
        AC+=1
        ans[P]=S
    if(ans[P]=='WA' and S=='WA'):
        WA+=1
print(AC,WA)

Submission status: Wrong Answer

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

l = [list(input().split()) for _ in range(m)]
wa_cnt = 0
ac_cnt=0
flag=0

for i in range(m):
    if i == 0 or l[i-1][0]==l[i][0]:
        if l[i][1]=="WA" and flag==0:
            wa_cnt += 1
        else:
            ac_cnt += 1
            flag = 1
    else:
        flag=0
        if l[i][1]=="WA" and flag==0:
            wa_cnt += 1
        else:
            ac_cnt += 1
            flag = 1

print(ac_cnt,wa_cnt)

Submission status: Wrong Answer

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

x = [False]*n
y = [0]*n

for i in range(m):
  a,b = input().split()
  a = int(a) - 1
  if b =='AC' and x[a] == False:
    x[a] = True
  elif b == 'WA' and x[a] == False:
    y[a] += 1

print(x.count(True), sum(y))

Submission status: Wrong Answer

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

fls = 0
tr = 0
for i in range(m):
    a, b = input().split()
    a = int(a)
    if b == "WA" and a not in A:
        fls += 1
    elif b == "AC" and a not in A:
        A.append(a)
        tr += 1

print(tr, fls)

Submission status: Wrong Answer

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

if num[1] == 0:     
  count_ac_all = 0
  count_wa_all = 0 
  
else:  
  group=set()
  new_num = []
  num_list = []
  
  for i in range(0,num[1]):
    num_list.append(list(input().split()))
#    group.add(num_list[i][0])
    
#
#  set_list = list(group)
#  num_list_1 = num_list
#  for i in range(0,len(set_list)):
#    for j in range(0,len(num_list_1)):
#      if num_list[j][0] == set_list[i]:
##        new_num.append(num_list[j])
#        num_list_1.remove(num_list[j])
#    num_list = num_list_1


  count_ac = 0
  count_wa = 0
  count_ac_all = 0
  count_wa_all = 0
  base = num_list[0][0]
  count = 0
  set_list = []


  for i in range(0,len(num_list)):
    if num_list[i][0] not in set_list:
      if not num_list[i][0] == base:
        base = num_list[i][0]
        count = 0
        count_ac = 0
        count_wa = 0

      if count == 0:
        if num_list[i][1] == 'WA':
          count_wa = count_wa+1
        elif num_list[i][1] == 'AC':
          count_ac = count_ac+1
          count = 1

      if count == 1:
        count_ac_all = count_ac_all + count_ac
        count_wa_all = count_wa_all + count_wa
        count = -1
        set_list.append(num_list[i][0])

print(count_ac_all,count_wa_all)

Submission status: Wrong Answer

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

if num[1] == 0:     
  count_ac_all = 0
  count_wa_all = 0 
  
else:  
  group=set()
  new_num = []
  num_list = []
  
  for i in range(0,num[1]):
    num_list.append(list(input().split()))
#    group.add(num_list[i][0])
    
#
#  set_list = list(group)
#  num_list_1 = num_list
#  for i in range(0,len(set_list)):
#    for j in range(0,len(num_list_1)):
#      if num_list[j][0] == set_list[i]:
##        new_num.append(num_list[j])
#        num_list_1.remove(num_list[j])
#    num_list = num_list_1


  count_ac = 0
  count_wa = 0
  count_ac_all = 0
  count_wa_all = 0
  base = num_list[0][0]
  count = 0
  set_list = []


  for i in range(0,len(num_list)):
    if not num_list[i][0] in set_list:
      if not num_list[i][0] == base:
        base = num_list[i][0]
        count = 0
        count_ac = 0
        count_wa = 0

      if count == 0:
        if num_list[i][1] == 'WA':
          count_wa = count_wa+1
        elif num_list[i][1] == 'AC':
          count_ac = count_ac+1
          count = 1

      if count == 1:
        count_ac_all = count_ac_all + count_ac
        count_wa_all = count_wa_all + count_wa
        count = -1
        set_list.append(num_list[i][0])

print(count_ac_all,count_wa_all)

Submission status: Wrong Answer

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

for m in range(M):
  pi, ans = input().split()
  pi = int(pi)
  if ac[pi-1] == 0:
    if ans == 'WA':
        pen += 1
    elif ans == 'AC':
      corr += 1
      ac[pi-1] = 1
    
  
print('{} {}'.format(corr, pen))

Submission status: Wrong Answer

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

s = {i + 1 for i in range(n)}

ac = 0
wa = 0


for i in range(m):
  if int(p[i][0]) in s:
    if p[i][1] == 'WA':
      wa += 1
    else:
      ac += 1
      s.discard(int(p[i][0]))
      
print(ac, wa)

Submission status: Wrong Answer

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

AC = 0
WA = 0
PS = {}
for _ in range(M):
    p, S = input().split()
    tmp = PS.get(p)

    if tmp == None:
        if S == "AC":
            PS[p] = S
            AC = 1
        else:
            PS[p] = 1
    elif tmp != "AC":
        if S == "AC":
            PS[p] = S
            AC += 1
            WA += tmp
        else:
            PS[p] += 1
print(AC, WA)

Submission status: Wrong Answer

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

AC = 0
WA = 0
PS = {}
for i in range(M):
    # print(PS)
    p, S = input().split()
    tmp = PS.get(p)
    # if tmp != None:
        # print("\t" + tmp)

    if tmp != "AC":
        if S == "AC":
            AC += 1
        elif S == "WA":
            WA += 1
        PS[p] = S
# print(str(AC) + " " + str(WA))
print(AC, WA)

Submission status: Wrong Answer

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

AC = 0
WA = 0
PS = {}
for i in range(M):
    p, S = input().split()
    tmp = PS.get(p)
    if tmp != None:
        print("\t" + tmp)

    if tmp != "AC":
        if S == "AC":
            AC += 1
        elif S == "WA":
            WA += 1
        PS[p] = S
print(str(AC) + " " + str(WA))

Submission status: Wrong Answer

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

AC = 0
WA = 0
PS = {}
for i in range(M):
    p, S = map(str, input().split())
    tmp = PS.get(p)
    # print(tmp)
    if tmp == None:
        PS[p] = S
        if S == "AC":
            AC += 1
        else:
            WA += 1
    elif tmp == "WA":
        PS[p] = S
        if S == "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
WA = 0
PS = {}
for i in range(M):
    p, S = map(str, input().split())
    tmp = PS.get(p)
    if tmp == None:
        PS[p] = S
        if S == "AC":
            AC += 1
        else:
            WA += 1
    elif tmp == "WA":
        PS[p] = S
        if S == "AC":
            AC += 1
        else:
            WA += 1
print(str(AC) + " " + str(WA))

Submission status: Wrong Answer

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


a = 0
b = 0
c = 0
mon = []
for i in range(kiso[1]):
	res = input().split()

	if  res[0] in mon:
		c = 0
		continue

	if res[1] == "AC":
		a += 1
		b += c
		mon.append(res[0])

	else:
		c += 1


print(str(a)+" "+str(b))

Submission status: Wrong Answer

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

a = 0
b = 0

mon = []

for i in range(kiso[1]):
	mons, res = input().split()

	if mons in mon:
		continue

	if res == "AC":
		a += 1
		mon.append(mons)

	else:
		b += 1

print(str(a)+" "+str(b))

Submission status: Wrong Answer

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


a = 0
b = 0

mon = []
for i in range(kiso[1]):
	res = input().split()

	if  res[0] in mon:
		continue

	if res[1] == "AC":
		a += 1
		mon.append(res[0])

	else:
		b += 1


print(str(a)+" "+str(b))

Submission status: Wrong Answer

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


a = 0
b = 0

mon = "0"
for i in range(kiso[1]):
	res = input().split()
	if mon == res[0]:
		continue

	if res[1] == "AC":
		a += 1
		mon = res[0]

	else:
		b += 1


print(str(a)+" "+str(b))

Submission status: Wrong Answer

Solution code:
import numpy as np

ini = np.array(list(map(int, input().split())))
num = [input().split() for i in range(ini[1])]
group = []

if ini[1] == 0:
  count_ac_all = 0
  count_wa_all = 0
else:
  base = num[0][0]
  sign = 0
  count_ac = 0
  count_wa = 0
  count_ac_all = 0
  count_wa_all = 0

  for i in range(0,ini[1]):
    each = num[i]
    
    if each[0] in group:
      continue
    
    if not base == each[0]:
      base = each[0]
      sign = 0
      count_ac = 0
      count_wa = 0
    if sign == 0:
      
      if each[1] == "WA":
        count_wa = count_wa + 1
      elif each[1] == "AC":
        count_ac = count_ac + 1
        sign = 1
    if sign == 1:
        count_ac_all = count_ac_all + count_ac
        count_wa_all = count_wa_all + count_wa
        count_ac = 0
        count_wa = 0
        group.append(each[0])
      

print(count_ac_all,count_wa_all)

Submission status: Wrong Answer

Solution code:
import numpy as np

ini = np.array(list(map(int, input().split())))
num = [input().split() for i in range(ini[1])]

if ini[1] == 0:
  count_ac_all = 0
  count_wa_all = 0
else:
  base = num[0][0]
  sign = 0
  count_ac = 0
  count_wa = 0
  count_ac_all = 0
  count_wa_all = 0

  for i in range(0,ini[1]):
    each = num[i]
    if not base == each[0]:
      base = each[0]
      sign = 0
      count_ac = 0
      count_wa = 0
    if sign == 0:
      if each[1] == "WA":
        count_wa = count_wa + 1
      elif each[1] == "AC":
        count_ac = count_ac + 1
        sign = 1
    if sign == 1:
        count_ac_all = count_ac_all + count_ac
        count_wa_all = count_wa_all + count_wa
        count_ac = 0
        count_wa = 0
      

print(count_ac_all,count_wa_all)

Submission status: Wrong Answer

Solution code:
import numpy as np

ini = np.array(list(map(int, input().split())))
num = [input().split() for i in range(ini[1])]

if ini[1] == 0:
  count_ac = 0
  count_wa = 0
else:
  base = num[0][0]
  sign = 0
  count_ac = 0
  count_wa = 0

  for i in range(0,ini[1]):
    each = num[i]
    if not base == each[0]:
      base = each[0]
      sign = 0
    if sign == 0:
      if each[1] == "WA":
        count_wa = count_wa + 1
      elif each[1] == "AC":
        count_ac = count_ac + 1
        sign = 1

print(count_ac,count_wa)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n,m=map(int,input().split())
p,s=[],[]
for i in range(m):
    P,S=input().split()
    p.append(int(P))
    s.append(S)

pena=0
cnt_ac=defaultdict(lambda :0)
cnt_wa=defaultdict(lambda :0)
for x,y in zip(p,s):
    if y=='AC':
        cnt_ac[x]=1
        pena+=cnt_wa[x]

    elif cnt_ac[x]!=1 and y=='WA':
        cnt_wa[x]+=1

print(sum(cnt_ac.values()),pena)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
L=[]
for i in range (M):
	L.append(list(input().split()))	
AC=[]
count=0
X=0
for i in range (M):
	if L[i][1]=="AC":
		AC.append(int(L[i][0]))
		X=i
for i in range(X):
	if L[i][1]=="WA":
		count+=1
print(len(set(AC)),end=" ")
print(count)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n,m=map(int,input().split())
l=[list(input().split()) for i in range(m)]

pena=0
cnt=defaultdict(lambda :0)
temp=0
for i in l:
    if i[1]=='AC':
        cnt[i[0]]=1
        pena+=temp
        temp=0

    elif cnt[i[0]]!=1 and i[1]=='WA':
        temp+=1

print(sum(cnt.values()),pena)