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:
# input
N, M = map(int, input().split())

# check
AC_cnt = 0
WA_cnt = 0
AC_questions = {}
for i in range(M):
    P, S = map(str, input().split())

    if P not in AC_questions:
        AC_questions[P] = False

    if AC_questions[P] is True:
        continue

    if S == "AC":
        AC_cnt += 1
        AC_questions[P] = True
    else:
        WA_cnt += 1


print(AC_cnt, WA_cnt)

Submission status: Wrong Answer

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

# check
AC_cnt = 0
WA_cnt = 0
AC_questions = []
AC_append = AC_questions.append
for i in range(M):
    P, S = map(str, input().split())

    if not AC_questions or P in AC_questions:
        continue

    if S == "AC":
        AC_cnt += 1
        AC_append(P)
    else:
        WA_cnt += 1

print(AC_cnt, WA_cnt)

Submission status: Wrong Answer

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

answer = []
ans_append = answer.append


# check
AC_cnt = 0
WA_cnt = 0
AC_questions = []
AC_append = AC_questions.append
for i in range(M):
    P, S = map(str, input().split())
    
    if P in AC_questions:
        continue
    
    if S == "AC":
        AC_cnt += 1
        AC_append(P)
    else:
        WA_cnt += 1

print(AC_cnt, WA_cnt)

Submission status: Wrong Answer

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

answer = []
ans_append = answer.append

for i in range(M):
    P, S = map(str, input().split())
    ans_append(
        {
            "question": int(P),
            "result": S
        }
    )

# check
AC_cnt = 0
WA_cnt = 0
AC_questions = []
all_question = list(set([a["question"] for a in answer]))
AC_append = AC_questions.append
for i in answer:

    if len(AC_questions) == len(all_question):
        break

    if i["question"] in AC_questions:
        continue

    if i["result"] == "AC":
        AC_cnt += 1
        AC_append(i["question"])
    else:
        WA_cnt += 1

print(AC_cnt, WA_cnt)

Submission status: Wrong Answer

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

answer = []
ans_append = answer.append

for i in range(M):
    P, S = map(str, input().split())
    ans_append(
        {
            "question": int(P),
            "result": S
        }
    )

# check
AC_cnt = 0
WA_cnt = 0
AC_questions = []
AC_append = AC_questions.append
for i in answer:
    
    if len(AC_questions) == N:
        break
    
    if i["question"] in AC_questions:
        continue

    if i["result"] == "AC":
        AC_cnt += 1
        AC_append(i["question"])
    if i["result"] == "WA":
        WA_cnt += 1

print(AC_cnt, WA_cnt)

Submission status: Wrong Answer

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

answer = []
ans_append = answer.append

# check
AC_cnt = 0
WA_cnt = 0
AC_questions = []
AC_append = AC_questions.append
for i in range(M):
    P, S = map(str, input().split())
    
    if P in AC_questions:
        continue

    if S == "AC":
        AC_cnt += 1
        AC_append(P)
    if S == "WA":
        WA_cnt += 1

print(AC_cnt, WA_cnt)

Submission status: Wrong Answer

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

answer = []
append = answer.append

for i in range(M):
    P, S = map(str, input().split())
    append(
        {
            "question": int(P),
            "result": S
        }
    )

# check
AC_cnt = 0
WA_cnt = 0
AC_questions = []
for i in answer:
    if i["question"] in AC_questions:
        continue

    if i["result"] == "AC":
        AC_cnt += 1
        AC_questions.append(i["question"])
    if i["result"] == "WA":
        WA_cnt += 1

print(AC_cnt, WA_cnt)

Submission status: Wrong Answer

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

for i in range(m):
    p, s = map(str, input().split())
    p = int(p) - 1
    if s == "AC":
        AC[p] = 1
    elif s == "WA":
        WA[p] = 1

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

Submission status: Wrong Answer

Solution code:
import numpy as np

def solve():
    dp = np.zeros((2, N+1))
#    print(dp)
    ac = 0
    wa = 0
    for i in range(M): 
        if (dp[0][S[i][0]] == 0):
            if(S[i][1] == "WA"):
                dp[1][S[i][0]] += 1
            elif(S[i][1] == "AC"):
                ac += 1
                dp[0][S[i][0]] = 1
                wa += dp[1][S[i][0]]
    print(ac, wa)

if __name__=="__main__":

    N, M = list(map(int, input().split()))
    S = []
    for i in range(M):
        a,b = input().split()
        S.append([int(a), b])
#    print(S)
    
    solve()

Submission status: Wrong Answer

Solution code:

def solve():
    dp = [0] * (N+1)
    ac = 0
    wa = 0
    for i in range(M): 
        if (dp[S[i][0]] == 0):
            if(S[i][1] == "WA"):
                wa += 1
            elif(S[i][1] == "AC"):
                ac += 1
                dp[S[i][0]] = 1
    print(ac, wa)

if __name__=="__main__":

    N, M = list(map(int, input().split()))
    S = []
    for i in range(M):
        a,b = input().split()
        S.append([int(a), b])
#    print(S)
    
    solve()

Submission status: Wrong Answer

Solution code:

def solve():
    ac = 0
    wa = 0
    for i in range(M): 
        if (dp[S[i][0]] == 0):
            if(S[i][1] == "WA"):
                wa += 1
            elif(S[i][1] == "AC"):
                ac += 1
                dp[S[i][0]] = 1
    print(ac, wa)

if __name__=="__main__":

    N, M = list(map(int, input().split()))
    S = []
    for i in range(M):
        a,b = input().split()
        S.append([int(a), b])
#    print(S)
    dp = [0] * (N+1)
    solve()

Submission status: Wrong Answer

Solution code:

def solve():
    ac = 0
    wa = 0
    for i in range(M): 
        if (dp[S[i][0]] == 0):
            if(S[i][1] == "WA"):
                wa += 1
            elif(S[i][1] == "AC"):
                ac += 1
                dp[S[i][0]] = 1
    print(ac, wa)

if __name__=="__main__":

    N, M = list(map(int, input().split()))
    S = []
    for i in range(M):
        a,b = input().split()
        S.append((int(a), b))
    dp = [0] * (N+1)
    solve()

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
acset=set()
penalty=0
for i in range(m):
	p,s=input().split()
	p=int(p)
	
	if s == "AC":
		acset.add(p)
	else:
		if not p in acset:
			penalty += 1

output=[str(len(acset))," ",str(penalty)]
print("".join(output))

Submission status: Wrong Answer

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

wa = [0] * (n + 1)
ac = [0] * (n + 1)

for p, s in ps:
    i = int(p)
    if s == "WA":
        if ac[i] != 1:
            wa[i] += 1
    else:
        if ac[i] != 1:
            ac[i] = 1

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ac_cnt = 0
wa_cnt = 0
ref = [0] * N
for i in range(M):
  p, s = map(str, input().split())
  p = int(p) - 1
  if s == 'AC':
    if ref[p] == 0:
      ref[p] = s
      ac_cnt += 1
    elif ref[p] == 'AC':
      continue
    elif ref[p] == 'WA':
      ref[p] = s
      ac_cnt += 1
  elif s == 'WA':
    if ref[p] == 0:
      ref[p] = s
      wa_cnt += 1
    elif ref[p] == 'AC':
      continue
    elif ref[p] == 'WA':
      wa_cnt += 1
print('{0:d} {1:d}'.format(ac_cnt, wa_cnt))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ac_cnt = 0
wa_cnt = 0
ref = [0] * N
for i in range(M):
  p, s = map(str, input().split())
  p = int(p) - 1
  if s == 'AC':
    if ref[p] == 0:
      ref[p] = s
      ac_cnt += 1
    elif ref[p] == 'AC':
      ac_cnt += 0
    elif ref[p] == 'WA':
      ref[p] = s
      ac_cnt += 1
  elif s == 'WA':
    if ref[p] == 0:
      ref[p] = s
      wa_cnt += 1
    elif ref[p] == 'AC':
      ac_cnt += 0
    elif ref[p] == 'WA':
      ref[p] = s
      wa_cnt += 1
print('{0:d} {1:d}'.format(ac_cnt, wa_cnt))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ac_cnt = 0
wa_cnt = 0
ref = [0] * N
for i in range(M):
  p, s = map(str, input().split())
  p = int(p) - 1
  if s == 'AC':
    if ref[p] == 0:
      ref[p] = s
      ac_cnt += 1
    elif ref[p] == 'AC':
      ac_cnt += 0
    elif ref[p] == 'WA':
      ref[p] = s
      ac_cnt += 1
  elif s == 'WA':
    if ref[p] == 0:
      ref[p] = s
      wa_cnt += 1
    elif ref[p] == 'AC':
      ac_cnt += 0
    elif ref[p] == 'WA':
      ref[p] = s
      wa_cnt += 1
  print(ref, ac_cnt, wa_cnt)
print('{0:d} {1:d}'.format(ac_cnt, wa_cnt))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
a = [list(input().split()) for nesya in range(m)]
ac_list = [0]*n
wa = 0
ac = 0
for ans in a:
  x = int(ans[0])-1
  y = ans[1]
  if ac_list[x] == 1:
    continue
  if y == 'AC':
    wa += abs(ac_list[x])
    ac_list[x] += 1
    ac += 1
  else:
    ac_list[x] -= 1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
a = [list(input().split()) for nesya in range(m)]
ac_list = [0]*n
wa = 0
ac = 0
for ans in a:
  x = int(ans[0])-1
  y = ans[1]
  if ac_list[x] == 1:
    continue
  if y == 'AC':
    ac_list[x] += 1
    ac += 1
  else:
    wa += 1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
a = [list(input().split()) for nesya in range(m)]
ac_list = [0]*n
wa = 0
for ans in a:
  x = int(ans[0])
  y = ans[1]
  if y == 'AC':
    ac_list[x-1] = 1
  else:
    if ac_list[x-1] == 0:
      wa += 1
ac = ac_list.count(1)
print(ac,wa)

Submission status: Wrong Answer

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

AC = [0] * N
wa = 0
ac = 0
for i in range(M):
    p,S = input().split()
    if S == 'AC':
        if AC[int(p)-1] == 0:
            ac += 1
            AC[int(p)-1] = 1
    elif AC[int(p)-1] == 0:
        wa += 1

print(str(ac) + ' ' + str(wa))

Submission status: Wrong Answer

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

ans_ac = 0
ans_wa = 0
flag_ac = 0
flag_wa = 0

for i in range(M):
    if flag_ac != ps[i][0] and ps[i][1] == 'AC':
        ans_ac += 1
        flag_ac = ps[i][0]
    if flag_wa != ps[i][0] and ps[i][1] == 'WA':
        ans_wa += 1
        flag_wa = ps[i][0]
print(ans_ac, ans_wa)

Submission status: Wrong Answer

Solution code:
N,M=list(map(int,input().split()))
S=[list(map(str,input().split())) for i in range(M)]
D={}
D2={}
for i in S:
    if D.get(int(i[0]),0)!='AC':
        D[int(i[0])]=i[1] 
        D2[i[1]]=D2.get(i[1],0)+1

print(D2.get('AC',0),D2.get('WA',0))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=[]
for _ in range(n):l.append(0)
wa=0
for i in range(m):
    p,s=map(str,input().split())
    if s=="AC":l[int(p)-1]=1
    elif l[int(p)-1]==0:wa+=1
    else:continue
print(sum(l),wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
answered = []
result = [0, 0]

il1 = [int(k) for k in input().split()]
N = il1[0]
M = il1[1]

tmp_wa = 0

for i in range(M):
    il = input().split()
    p = int(il[0])
    s = il[1]
    if (p in answered):
        pass
    else:
        if (s == 'AC'):
            result[0] = result[0]+1
            answered.append(p)
            result[1] = result[1]+tmp_wa
            tmp_wa = 0
        else:
            tmp_wa = tmp_wa+1

print(str(result[0])+" "+str(result[1]))

Submission status: Wrong Answer

Solution code:
answered = []
result = [0, 0]

il1 = [int(k) for k in input().split()]
N = il1[0]
M = il1[1]

for i in range(M):
    il = input().split()
    p = int(il[0])
    s = il[1]
    if (p in answered):
        pass
    else:
        if (s == 'AC'):
            result[0] = result[0]+1
            answered.append(p)
        else:
            result[1] = result[1]+1

print(str(result[0])+" "+str(result[1]))

Submission status: Wrong Answer

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

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

for s in sub:
    if s[1] == 'AC':
        ac[int(s[0])-1] += 1
    elif ac[int(s[0])-1] == 0:
            wa[int(s[0])-1] += 1
# print(ac)
# print(wa)
print(n-ac.count(0), sum(wa))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict


def main():
    N, M = map(int, input().split())
    pS = defaultdict(list)
    for i in range(M):
        p, S = input().split()
        pS[p].append(S)

    ac = 0
    wa = 0
    for pp in pS:
        tmp = pS[pp]
        for t in tmp:
            wa_tmp = 0
            if t == 'WA':
                wa_tmp += 1
            else:
                ac += 1
                wa += wa_tmp
                break
    print(ac, wa)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict


def main():
    N, M = map(int, input().split())
    pS = defaultdict(list)
    for i in range(M):
        p, S = input().split()
        pS[p].append(S)

    ac = 0
    wa = 0
    for pp in pS:
        tmp = pS[pp]
        for t in tmp:
            if t == 'WA':
                wa += 1
            else:
                ac += 1
                break
    print(ac, wa)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
li = [[0,0] for _ in range(n)]
t1,t2 = 0,0
for i in range(m):
    a,b = input().split()
    if li[int(a)-1][0] != 1:
        if b == "WA":
            li[int(a)-1][1] += 1
        else:
            li[int(a)-1][0] += 1
for i in range(n):
    t1 += li[i][0]
    t2 += li[i][1]
print(t1,t2)

Submission status: Wrong Answer

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

for i in range(m):
    p,s = input().split()
    p = int(p)-1
    if s=='AC':
        penalty[p][0]=1
    else:
        if penalty[p][0]==0:
            penalty[p][1]+=1
a = 0
b = 0
for i in range(n):
    a += penalty[i][0]
    b += penalty[i][1]
print(a,b)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ps = [list(input().split()) for i in range(m)]
ac = [0] * n
wa = [0] * n
for i in range(m):
    if ac[int(ps[i][0])-1] == 0:
        if ps[i][1] == "AC":
            ac[int(ps[i][0])-1] = 1
        else:
            wa[int(ps[i][0])-1] += 1
print(sum(ac), sum(wa))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
sub = []
ansac=0
answa=0
for i in range(n):
  sub.append(0)
for i in range(m):
  p,s = input().split()
  p = int(p)-1
  if(s == "AC"):
    if(sub[p]==0):
      sub[p]=1
      ansac+=1
  else:
    if(sub[p]==0):
      answa+=1
print(ansac,answa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
sub = []
ansac=0
answa=0
for i in range(n):
  sub.append(0)
for i in range(m):
  p,s = input().split()
  p = int(p)
  if(s == "AC"):
    if(sub[p-1]==0):
      sub[p-1]=1
      ansac+=1
  else:
    if(sub[p-1]==0):
      answa+=1
print(ansac,answa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
sub = []
ansac=0
answa=0
for i in range(n):
  sub.append(0)
for i in range(m):
  p,s = input().split()
  p = int(p)
  if(s == "AC"):
    sub[p-1]=1
    ansac+=1
  else:
    if(sub[p-1]==0):
      answa+=1
print(ansac,answa)

Submission status: Wrong Answer

Solution code:
from sys import stdin, setrecursionlimit


def main():
    n, m = map(int, stdin.readline().split())
    ac = [0] * n
    wa = [0] * n
    for _ in range(m):
        p, s = map(str, stdin.readline().split())
        p = int(p) - 1
        if ac[p] == 0 and s == 'WA':
            wa[p] += 1
        elif s == 'AC':
            ac[p] = 1
    n_ac = 0
    n_wa = 0
    for i in range(n):
        n_ac += ac[i]
        n_wa += wa[i]

    print(n_ac, n_wa)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Wrong Answer

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

co = 0
pe = 0

ans_check = [0]*n
wa_check = [0]*n
temp = 0

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

print(co,pe)

Submission status: Wrong Answer

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

co = 0
pe = 0

ans_check = [0]*(n+1)
wa_check = [0]*(n+1)
temp = 0

for i in range(m):
    p,s = input().split()
    if ans_check[int(p)] == 0 and s == "AC":
       ans_check[int(p)] += 1
       co += 1
    elif ans_check[int(p)] == 0 and s == "WA":
        wa_check[int(p)] += 1
    
pe = sum(wa_check)

print(co,pe)

Submission status: Wrong Answer

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

co = 0
pe = 0

ans_check = [0]*(n+1)
wa_check = [0]*(n+1)
temp = 0

for i in range(m):
    p,s = input().split()
    if ans_check[int(p)] == 0 and s == "AC":
       ans_check[int(p)] += 1
       co += 1
       pe += temp
       temp = 0
    elif ans_check[int(p)] == 0 and s == "WA":
        wa_check[int(p)] += 1
    
pe = sum(wa_check)

print(co,pe)

Submission status: Wrong Answer

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

co = 0
pe = 0

ans_check = [0]*n
temp = 0
for i in range(m):
    p,s = input().split()
    if ans_check[int(p)-1] == 0 and s == "AC":
       ans_check[int(p)-1] += 1
       co += 1
       pe += temp
       temp = 0
    elif  ans_check[int(p)-1] == 0 and s == "WA":
        temp += 1

print(co,pe)

Submission status: Wrong Answer

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

co = 0
pe = 0

ans_check = [0]*n

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

print(co,pe)

Submission status: Wrong Answer

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

co = 0
pe = 0
temp =0
for i in range(m):
    p,s = input().split()
    if temp == 0:
        check = int(p)
        temp +=1

    #print("check,p,s",check,p,s)
    if check == int(p) and s == "WA":
        pe += 1
    elif check == int(p) and s =="AC":
        co += 1
        check += 1

print(co,pe)

Submission status: Wrong Answer

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

co = 0
pe = 0
temp =0
for i in range(m):
    p,s = input().split()
    if temp == 0:
        check = int(p)
        temp +=1

    print("check,p,s",check,p,s)
    if check == int(p) and s == "WA":
        pe += 1
    elif check == int(p) and s =="AC":
        co += 1
        check += 1

print(co,pe)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

AC = AC.count(1)
    
print(AC, WA)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac,wa = 0,0
d = {}
for i in range(m):
  p,s = input().split()
  if p in d:
    if d[p][1]:
      pass
    else:
      if s=="WA":
          d[p][0]+=1
      elif s=="AC":
          d[p][1]=True
          ac+=1
          wa+=d[p][0]
  else:
    if s=="WA":
      d[p]=[1,False]
      wa+=1
    elif s=="AC":
      d[p]=[0,True]
      ac+=1
print(ac,wa)

Submission status: Wrong Answer

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

WA = 0
AC = 0
AC_ = [True] * 110000
past = []
for i in range(M):
    p, s = input().split()
    p = int(p)
    
    if AC_[p]:
        if s == "WA":
            WA += 1
        elif s == "AC":
            AC += 1
            AC_[p] = False
            continue
    
print(AC, WA)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac,wa = 0,0
d = {}
for i in range(m):
  p,s = input().split()
  if p in d:
    d[p].append(s)
  else:
    d[p] = [s]
for l in d.values():
  if set(l)=={"WA"}:
    break
  else:
    for si in l:
      if si=="WA":
        wa+=1
      else:
        ac+=1
        break
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac,wa = 0,0
d = {}
for i in range(m):
  p,s = input().split()
  if p in d:
    d[p].append(s)
  else:
    d[p] = [s]
for l in d.values():
  for si in l:
    if si=="WA":
      wa+=1
    else:
      ac+=1
      break
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
P=[];S=[]
judge=[0]*N
wa_c=[0]*N

for m in range(M):
  p,s = input().split()
  P.append(int(p))
  S.append(s)
  
for m in range(M):
  if judge[P[m]-1]==0 and S[m]=="WA":
    wa_c[P[m]-1] +=1
   
  elif judge[P[m]-1]==0 and S[m]=="AC":
    judge[P[m]-1]=1
    
  if m<M-1 and judge[P[m]-1] !=judge[P[m+1]-1] and  judge[P[m]-1]==0:
    wa_c[P[m]-1] =0
    
  if m==M-1 and judge[P[m]-1]==0:
    wa_c[P[m]-1] =0
    
print(sum(judge),sum(wa_c))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
P=[];S=[]
judge=[0]*N
wa_c=0

for m in range(M):
  p,s = input().split()
  P.append(int(p))
  S.append(s)
  
for m in range(M):
  if judge[P[m]-1]==0 and S[m]=="WA":
    wa_c +=1
   
  elif judge[P[m]-1]==0 and S[m]=="AC":
    judge[P[m]-1]=1
  
print(sum(judge),wa_c)

Submission status: Wrong Answer

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

WA = 0
AC = 0
past = []
for i in range(M):
    p, s = input().split()
    if p not in past:
        if s == "WA":
            WA += 1
        elif s == "AC":
            AC += 1
            past.append(p)
    
print(AC, WA)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
pena = [0]*(N+1)
ac = [0]*(N+1)
for i in range(0,M,1):
    p,s = input().split()
    if s =="AC":
        ac[int(p)]=1
    elif s=="WA":
        if ac[int(p)] == 0:
            pena[int(p)]+=1

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
n,m = [int(i) for i in readline().split()]
ps = []
for _ in range(m):
    p,s = [i for i in readline().split()]
    ps.append([int(p),s])

acs = 0
was = 0
solved = {}
for p,s in ps:
    if p in solved and solved[p] == 1:
        pass
    elif p in solved and solved[p] == 0 and s == 'AC':
        acs += 1
        solved[p] = 1
    elif p in solved and solved[p] == 0 and s == 'WA':
        was += 1
    elif s == 'AC':
        acs += 1
        solved[p] = 1
    else:
        was += 1
        solved[p] = 0
print(acs, was)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
n,m = [int(i) for i in readline().split()]
ps = []
for _ in range(m):
    p,s = [i for i in readline().split()]
    ps.append([int(p),s])

acs = 0
was = 0
solved = {}
for p,s in ps:
    if p in solved and solved[p] == 1:
        continue
    elif p in solved and solved[p] == 0 and s == 'AC':
        acs += 1
        solved[p] = 1
    elif p in solved and solved[p] == 0 and s == 'WA':
        was += 1
    elif s == 'AC':
        acs += 1
        solved[p] = 1
    else:
        was += 1
        solved[p] = 0
print(acs, was)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
accepted = [0] * N
penalty = 0
for _ in range(M):
    p, ac = [func(c) for func, c in zip([lambda n: int(n) - 1, lambda s: s == "AC"], input().split())]
    accepted[p] |= ac
    penalty += not accepted[p]
print(sum(accepted), penalty)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
accepted = [False] * N
penalty = 0
for _ in range(M):
    p, S = [func(c) for func, c in zip([int, str], input().split())]
    penalty += not accepted[p - 1] and S == "WA"
    accepted[p - 1] |= S == "AC"
print(sum(accepted), penalty)

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=map(str,input().split())
    if s=="WA" and AC[int(p)-1]==0:
        WA[int(p)-1]+=1
    elif AC[int(p)-1]==0 and s=="AC":
        AC[int(p)-1]=1
print(sum(AC),sum(WA))

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
pro_pen = [0]*N
pro_ac  = [0]*N
for i in range(M):
    p_i,s_i = map(str, input().split())
    if pro_ac[int(p_i)-1] == 0 and s_i == "WA":
        pro_pen[int(p_i)-1] += 1
    if pro_ac[int(p_i)-1] == 0 and s_i == "AC":
        pro_ac[int(p_i)-1] = 1
print(sum(pro_ac),sum(pro_pen))

Submission status: Wrong Answer

Solution code:
import bisect

n, m = map(int, input().split())
problem = [0] * m
sol = [0] * m

for i in range(m):
    p, s = map(str, input().split())
    problem[i], sol[i] = int(p), s

problemSet = set(problem)
data = list(problemSet)

ac = 0
wa = 0

# bisectで、X問目の左端と右端を取る
# if (target == 'WA' : count += 1)
#
for i, val in enumerate(data):
    left = bisect.bisect_left(problem, val)
    right = bisect.bisect_right(problem, val)

    check = sol[left:right]
    # print(check)
    if ('AC' in check):
        ac += 1

        ll = check.index('AC')
        # print(ll)
        wa += ll
    # else:
    #    wa += len(check)

print(ac, wa)

Submission status: Wrong Answer

Solution code:
import bisect

n, m = map(int, input().split())
problem = [0] * m
sol = [0] * m

for i in range(m):
    p, s = map(str, input().split())
    problem[i], sol[i] = int(p), s

problemSet = set(problem)
data = list(problemSet)

ac = 0
wa = 0

# bisectで、X問目の左端と右端を取る
# if (target == 'WA' : count += 1)
#
for i, val in enumerate(data):
    left = bisect.bisect_left(problem, val)
    right = bisect.bisect_right(problem, val)

    check = sol[left:right]
    # print(check)
    if ('AC' in check):
        ac += 1

        ll = check.index('AC')
        # print(ll)
        wa += ll
    else:
        wa += len(check)

print(ac, wa)

Submission status: Wrong Answer

Solution code:
import bisect

n, m = map(int, input().split())
problem = [0] * m
sol = [0] * m

for i in range(m):
    p, s = map(str, input().split())
    problem[i], sol[i] = int(p), s

problemSet = set(problem)
data = list(problemSet)

ac = 0
wa = 0

# bisectで、X問目の左端と右端を取る
# if (target == 'WA' : count += 1)
#
for i, val in enumerate(data):
    left = bisect.bisect_left(problem, val)
    right = bisect.bisect_right(problem, val)

    check = sol[left:right]
    #print(check)
    if ('AC' in check):
        ac += 1

        ll = check.index('AC')
        #print(ll)
        wa += ll
    else:
        wa += left - right + 1

print(ac, wa)

Submission status: Wrong Answer

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

n, m = map(int, input().split())
cnt = [0 for _ in range(n + 1)]
visited = [False for _ in range(n + 1)]
ac = 0

for _ in range(m):
    x, s = input().split()
    x = int(x)
    if s == "WA":
        if visited[x] == False:
            cnt[x] += 1
    else:
        visited[x] = True
        ac += 1
wa = 0
for i in range(n + 1):
    if visited[i] == True:
        wa += cnt[i]

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
acl=["WA"]*(n+1)
ans=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if(acl[p]=="WA"):
        if s=="WA":
            ans+=1
        else:
            acl[p]="AC"
print(acl.count("AC"),ans)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ps=[list(input().split()) for x in range(m)]
 
cnt=0
for p,s in ps:
  if s=='AC':
    cnt+=1
l=[[]]*n
for i in range(1,n+1):
  for p,s in ps:
    if p==i:
      l[i-1].append([p,s])

ans=0
for ll in l:
  for lll in ll:
    if all(lll[1]=='WA'):
      ans+=len(ll)
print(cnt,ans)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
acs=[0]*n
was=[0]*n
for i in range(m):
    p,s=input().split()
    p=int(p)
    if acs[p-1]==0:
        if s=="AC":
            acs[p-1]=1
        else:
            was[p-1]+=1
print(sum(acs),sum(was))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
WA,wa,ac=0,0,0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if i==0 and s=="AC":
        ac+=1
        before=p
    if i>0 and p!=before:
        wa=0
    if s=="WA":
        wa+=1
    elif s=="AC" and p!=before:
        WA+=wa
        ac+=1
    before=p
print(ac,WA)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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