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())
ques = [0] * N
ans = 0
pen = 0
for i in range(M):
    a, b = map(str, input().split())
    if ques[int(a)-1] == 0 and b == "WA":
        pen += 1
    elif ques[int(a)-1] == 0 and b == "AC":
        ans += 1
        ques[int(a)-1] = 1
print(ans, pen)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ans = [False for _ in range(n)]
t = 0
f = 0
for i in range(m):
    a, b = input().split()
    if not ans[int(a) - 1]:
        if b == 'AC':
            t += 1
            ans[int(a) - 1] = True
        else:
            f += 1
print(t, f)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ans = [False for _ in range(n)]
t = 0
f = 0
for i in range(m):
    a, b = input().split()
    if ans[int(a) - 1]: continue
    if b == 'AC':
        t += 1
        ans[int(a) - 1] = True
    else:
        f += 1
print(t, f)

Submission status: Wrong Answer

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

for i in range(M):
    index, value = input().split()
    ARR.append([int(index), value])


def calculate(n, m, arr):
    acResult = [-1 for i in range(n)]
    waResult = [0 for i in range(n)]

    for index in range(M):
        i = arr[index][0] - 1
        if arr[index][1] == 'AC':
           if acResult[i] == -1:
               acResult[i] = index
           else:
               if acResult[i] > index:
                   acResult[i] = index

    for index in range(M):
        i = arr[index][0] - 1
        if arr[index][1] == 'WA':
            if index < acResult[i] and acResult[i] > -1:
                waResult[i] = waResult[i] + 1


    result1 = 0
    result2 = 0
    for index,ac in enumerate(acResult):
        if ac > 0:
            result1 = result1 + 1
            result2 = result2 + waResult[index]



    print(result1,result2)

calculate(N, M, ARR)

Submission status: Wrong Answer

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

ac, wa = 0, 0
for i in range(m):
    p, s = input().split()
    p = int(p)
    if is_ac[p-1]: continue
    else:
        if s == 'AC':
            is_ac[p-1] = True
            ac += 1
        else:
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

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

ac = 0
wa = 0
for i in range(m):
    p, s = input().split()
    if is_ac[int(p)-1]: continue
    else:
        if s == 'AC':
            is_ac[int(p)-1] = True
            ac += 1
        else:
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:

N, M = map(int, input().split())
ARR = []

for i in range(M):
    index, value = input().split()
    ARR.append([int(index), value])


def calculate(n, m, arr):
    acResult = [-1 for i in range(n)]
    waResult = [[] for i in range(n)]

    for index in range(M):
        i = arr[index][0] - 1
        if arr[index][1] == 'AC':
           if acResult[i] == -1:
               acResult[i] = index+1
           else:
               if acResult[i] > index+1:
                   acResult[i] = index+1

    for index in range(M):
        i = arr[index][0] - 1
        if arr[index][1] == 'WA':
            if acResult[i] == -1:
                waResult[i].append(index+1)
            else:
                if acResult[i] > index + 1:
                    waResult[i].append(index + 1)

    result1 = 0
    for ac in acResult:
        if ac > 0:
            result1 = result1 + 1

    result = 0
    for wa in waResult:
        result = result + len(wa)


    print(result1,result)

calculate(N, M, ARR)

Submission status: Wrong Answer

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

for i in range(M):
    index, value = input().split()
    ARR.append([int(index), value])


def calculate(n, m, arr):
    acResult = [-1 for i in range(n)]
    waResult = [[] for i in range(n)]

    for index in range(M):
        i = arr[index][0] - 1
        if arr[index][1] == 'AC':
           if acResult[i] == -1:
               acResult[i] = index+1
           else:
               if acResult[i] > index+1:
                   acResult[i] = index+1

        if arr[index][1] == 'WA':
            if acResult[i] == -1:
                waResult[i].append(index+1)
            else:
                if acResult[i] > index + 1:
                    waResult[i].append(index + 1)

    result1 = 0
    for ac in acResult:
        if ac > 0:
            result1 = result1 + 1

    result = 0
    for wa in waResult:
        result = result + len(wa)


    print(result1,result)

calculate(N, M, ARR)

Submission status: Wrong Answer

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


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    ac = set()
    wcc = 0
    for pp, ss in zip(p, S):
        if pp in ac:
            continue
        if ss == 'WA':
            wcc += 1
        else:
            ac.add(pp)
    print(len(ac), wcc)


# 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())
p_list = [input().split() for i in range(m)]

ans_list = [[0 for i in range(2)] for j in range(n)]
#print(ans_list[0])
for i in range(m):
    p_num = int(p_list[i][0])
    if ans_list[p_num-1][0] != 1:
        if p_list[i][1] == "WA":
            ans_list[p_num-1][1]  =  ans_list[p_num-1][1] + 1
        else:
            ans_list[p_num-1][0]  = 1
count1 = 0
count2 = 0
for i in range(n):
    if ans_list[i][0] == 1:
        count1 += 1
        if ans_list[i][1] == 1:
            count2 += 1
print(count1,count2)

Submission status: Wrong Answer

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

ans_list = [[[0] for i in range(2)] for j in range(n)]
#print(ans_list[0])
for i in range(m):
    p_num = int(p_list[i][0])
    if p_list[i][1] == "WA":
        ans_list[p_num-1][1]  = 1
    else:
        ans_list[p_num-1][0]  = 1
count1 = 0
count2 = 0
for i in range(n):
    if ans_list[i][0] == 1:
        count1 += 1
        if ans_list[i][1] == 1:
            count2 += 1
print(count1,count2)

Submission status: Wrong Answer

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

ans_list = [[[0] for i in range(2)] for j in range(n)]
#print(ans_list[0])
for i in range(m):
    p_num = int(p_list[i][0])
    if p_list[i][1] == "WA":
        ans_list[p_num-1][1]  = 1
    else:
        ans_list[p_num-1][0]  = 1
count = 0
for i in range(n):
    if ans_list[i][0] == 1:
        count += 1
        if ans_list[i][1] == 1:
            count += 1
print(count)

Submission status: Wrong Answer

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

for _ in range(M):
    p, S = input().split()
    
    if S == "AC":
        AC[int(p) - 1] = 1
    else:
        if AC[int(p) - 1] != 1:
            penalty[int(p) - 1] += 1

print("{} {}".format(sum(AC), sum(penalty)))

Submission status: Wrong Answer

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

for _ in range(M):
    p, S = input().split()
    
    if S == "AC":
        AC[int(p) - 1] = True
    else:
        if not AC[int(p) - 1]:
            penalty[int(p) - 1] += 1

print("{} {}".format(sum(AC), sum(penalty)))

Submission status: Wrong Answer

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

for _ in range(M):
    p, S = input().split()
    
    if S == "AC":
        AC[int(p) - 1] = True
    else:
        if not AC[int(p) - 1]:
            penalty += 1

print("{} {}".format(sum(AC), penalty))

Submission status: Wrong Answer

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

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

print("{} {}".format(sum(AC), penalty))

Submission status: Wrong Answer

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

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

print("{} {}".format(sum(AC), penalty))

Submission status: Wrong Answer

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

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

print("{} {}".format(sum(AC), penalty))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
p=[]
s=[]
ac=["WA"]*n
for i in range(m):
	pp,ss=input().split()
	p.append(int(pp))
	s.append(ss)
pena=0
for i in range(m):
	if s[i]=="AC":
		ac[p[i]-1]="AC"
	else:
		if ac[p[i]-1]=="WA":
			pena+=1

print(ac.count("AC"),pena)

Submission status: Wrong Answer

Solution code:

N, M = map(int, input().split())
ARR = []

for i in range(M):
    index, value = input().split()
    ARR.append([int(index), value])


def calculate(n, m, arr):
    countResult = [[] for i in range(n)]
    for index in range(M):
        i = arr[index][0] - 1

        if len(countResult[i]) == 0:
            countResult[i].append(arr[index][1])
        else:
            if countResult[i][-1] == 'AC':
                continue
            else:
                countResult[i].append(arr[index][1])

    accuracy = 0
    penity = 0

    for ar in countResult:
        if len(ar) != 0:
            if ar[-1] == 'AC':
                accuracy = accuracy + 1
                penity = penity + len(ar) - 1
            else:
                penity = penity + len(ar)
    print(accuracy, penity)


calculate(N, M, ARR)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

A, B = rl()

import math
for i in range(1, 2000):
    if math.floor(i*8/100) == A and math.floor(i*10/100) == B:
        print(i)
        exit()
print(-1)

Submission status: Wrong Answer

Solution code:
N, M = (int(x) for x in input().split())
p = [0]*M
S = ["a"]*M
wa = 0
ac = 0
index = []
for i in range(M):
  p[i], S[i] = (x for x in input().split())
for i in range(M):
  if S[i] == "AC" and p[i] not in index:
    ac = ac + 1
    index.append(p[i])
  elif S[i] == "WA":
    wa = wa + 1
    if p[i] in index:
      wa = wa-1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
N, M = (int(x) for x in input().split())
p = [0]*M
S = ["a"]*M
wa = 0
ac = 0
index = []
for i in range(M):
  p[i], S[i] = (x for x in input().split())
P = (int(x) for x in p)
for i in range(M):
  if S[i] == "AC" and p[i] not in index:
    ac = ac + 1
    index.append(p[i])
  elif S[i] == "WA" and p[i] not in index:
    wa = wa + 1
print(ac, wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for ind in range(m):
    p, s = input().split()
    p = int(p)
    if s == "WA" and success[p] == 0:
        penalty += 1
    if s == "AC":
        success[p] = 1
print("{} {}".format(sum(success), penalty))

Submission status: Wrong Answer

Solution code:
n, m = [int(_) for _ in input().split()]
ps_dict = {}
for i in range(m):
    p_, s = input().split()
    p = int(p_)
    if not p in ps_dict.keys():
        ps_dict[p] = [s]
    else:
        ps_dict[p].append(s)

res_ac = 0
res_wa = 0
for k, v in ps_dict.items():
    for vi in v:
        if vi == 'AC':
            res_ac += 1
            break
        else:
            res_wa += 1
print(res_ac, res_wa)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
check = [0]*n
ac = 0
wa = 0
for _ in range(m):
  p,s = input().split()
  if check[int(p)-1] == 0:
    if s == "AC":
      ac += 1
      check[int(p)-1] = 1
    else:
      wa += 1
print("{} {}".format(ac,wa))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
checked_num = []
completed_num = []
AC = 0
WA = 0
for _ in range(m):
    ps = list(map(str, input().split()))
    if ps[0] in checked_num:
        if ps[0] not in completed_num:
            if ps[1] == "AC":
                completed_num.append(ps[0])
                AC += 1
            else:
                WA += 1
    else:
        checked_num.append(ps[0])
        if ps[1] == "AC":
            completed_num.append(ps[0])
            AC += 1
        else:
            WA += 1

print(AC, WA)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
checked_num = []
completed_num = []
AC = 0
WA = 0
for _ in range(m):
    ps = list(map(str, input().split()))
    if ps[0] in checked_num:
        if ps[0] not in completed_num:
            if ps[1] == "AC":
                completed_num.append(ps[0])
                AC += 1
    else:
        checked_num.append(ps[0])
        if ps[1] == "AC":
            completed_num.append(ps[0])
            AC += 1
        else:
            WA += 1

print(AC, WA)

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
checked_num =[]
completed_num = []
AC = 0
WA = 0
for _ in range(m):
    ps = list(map(str,input().split()))
    if ps[0] in checked_num:
        if ps[0] not in completed_num:
            if ps[1] == "AC":
                completed_num.append(ps[0])
                AC += 1
    elif ps[0] not in checked_num:
        checked_num.append(ps[0])
        if ps[1] == "AC":
            completed_num.append("AC")
            AC += 1
        else:
            WA += 1

print(AC,WA)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
Win=[0]*N
Penalty=[0]*N
L=[list(input().split()) for j in range(M)]
win,penalty=0,0
for i in range(M):
  m=int(L[i][0])
  re=str(L[i][1])
  if re=="AC":
    Win[m-1]=1
  else:
    if Win[m-1]==0:
      Penalty[m-1]+=1
for k in range(N):
  if Win[k]==1:
    win+=1
  else:
    penalty+=Penalty[k]
print(win,penalty)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
Win=[0]*(N+1)
Penalty=[0]*(N+1)
L=list(list(input().split()) for j in range(M))
if M==0:
  print(0,0)
else:
  for i in range(M):
    m=int(L[i][0])
    re=str(L[i][1])
    if re=="AC":
      Win[m]=1
    else:
      if Win[m]==0:
        Penalty[m]+=1
  print(sum(Win),sum(Penalty))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
N=[[0,0]]*(N+1)
L=list(list(input().split()) for j in range(M))
win=0
penalty=0
if M==0:
  print(0,0)
else:
  for i in range(M):
    m=int(L[i][0])
    eff=str(L[i][1])
    if eff=="WA":
      if N[m][0]!=1:
        N[m][1]+=1
      else:
        continue
    else:
      if N[m][0]!=1:
        N[m][0]=1
        win+=1
        penalty+=N[m][1]
      else:
        continue
  print(win,penalty)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
N=[0]*(N+1)
penalty=0
win=0
L=list(list(map(str,input().split())) for j in range(M))
if M==0:
  print(0,0)
else:
  for i in range(M):
    m=int(L[i][0])
    eff=L[i][1]
    if eff=="WA":
      if N[m]!=1:
        penalty+=1
      else:
        continue
    else:
      if N[m]!=1:
        N[m]=1
        win+=1
      else:
        continue
  print(win,penalty)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
N=[[0,0]]*(N+1)
if M==0:
  print(0,0)
else:
  penalty=0
  win=0
  for j in range(M):
    L=list(map(str,input().split()))
    m=int(L[0])
    if L[1]=="WA":
      if N[m][1]!=1:
        penalty+=1
      else:
        continue
    else:
      if N[m][1]!=1:
        N[m][1]=1
        win+=1
      else:
        continue
  print(win,penalty)

Submission status: Wrong Answer

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

A = [0]*m;
B = [0]*m;

for i in range(m):
  a, b = input().split();
  A[i] = int(a);
  B[i] = b;
  
#ACの数
AC_list = list(set(A));

AC_count = len(AC_list);

#WAの数
WA_count = 0;

for j in AC_list:
  indexes = [i for i, x in enumerate(A) if x == j];
  for k in indexes:
    if B[k] == "WA":
      WA_count += 1;
      continue;
    else:
      break;
      
print(AC_count, WA_count);

Submission status: Wrong Answer

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

A = [];
B = [];

for i in range(m):
  a, b = input().split();
  A.append(int(a));
  B.append(b);
  
#ACの数
AC_list = list(set(A));

AC_count = len(AC_list);

#WAの数
WA_count = 0;

for j in AC_list:
  indexes = [i for i, x in enumerate(A) if x == j];
  for k in indexes:
    if B[k] == "WA":
      WA_count += 1;
      continue;
    else:
      break;
      
print(AC_count, WA_count);

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ans = [0,0]
cur_n = 1
for i in range(m):
    p, s = map(str, input().split())
    p = int(p)
    if i == 0: cur_n = p
    if cur_n == p:
        if s == 'AC':
            ans[0] += 1
            cur_n += 1
        else: ans[1] += 1
print(ans[0], ans[1])

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ans = [0,0]
cur_n = 1
for i in range(m):
    p, s = map(str, input().split())
    p = int(p)
    if i == 0: cur_n = p
    if cur_n == p:
        if s == 'AC':
            ans[0] += 1
            cur_n += 1
        else: ans[1] += 1
print(ans)

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
a = [0 for _ in range(N)]
pen = 0
cor = 0
for m in range(M):
    p, s = input().split()
    p = int(p)
    p -= 1
    if s == "WA":
        if a[p] == 0:
            pen += 1
    else:
        if a[p] == 0:
            a[p] = 1
            cor += 1

print(cor, pen)

Submission status: Wrong Answer

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

for i in range(m):
  a, b = input().split();
  a = int(a);
  A.append(a);
  B.append(b);

AC_count = 0;
WA_count = 0;
AC_list = [];

for i in range(m):
  if A[i] in AC_list:
    continue;
  else:
    if B[i] == "AC":
      AC_count += 1;
      AC_list.append(A[i]);
    else:
      WA_count += 1;
    
print(AC_count, WA_count);

Submission status: Wrong Answer

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

for i in range(m):
  a, b = input().split();
  a = int(a);
  A.append(a);
  B.append(b);

AC_count = 0;
WA_count = 0;
AC_list = [];

for i in range(len(B)):
  if B[i] == "AC" and A[i] not in AC_list:
    AC_count += 1;
    AC_list.append(A[i]);
    continue;
  elif B[i] == "WA" and A[i] not in AC_list:
    WA_count += 1;
    continue;

print(AC_count, WA_count);

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
P,S=[],[]
A = {}# {num: (fixed, WA)}
ac,wa = 0,0
for i in range(m):
  p,s=input().split()
  P.append(int(p))
  S.append(s)
for i in range(m):
  num = P[i]
  res = A.get(num)[0] if A.get(num)!=None else False
  
  if S[i]=='AC':
    if res==False:
      ac += 1
      A[num] = (True, A.get(num)[1]) if A.get(num)!=None else (True,0)
  else:
    if res==False:
      A[num] = (False,A.get(num)[1]+1) if A.get(num)!=None else (False,1)

for a in A.values():
  wa += a[1]
print(ac,wa)

Submission status: Wrong Answer

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

flag = [0]*n
wa_count = 0
for i in range(m):
    if s[i] == "WA" and flag[p[i]-1] == 0:
        wa_count += 1
    elif s[i] == "AC" and flag[p[i]-1] == 0:
        flag[p[i]-1] = 1
        
print(flag.count(1), wa_count)

Submission status: Wrong Answer

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

flag = [0]*n
wa_count = 0
for i in range(m):
    if s[i] == "WA" and flag[p[i]-1] == 0:
        wa_count += 1
    elif s[i] == "AC" and flag[p[i]-1] == 0:
        flag[p[i]-1] = 1
    elif flag[p[i]-1] == 1:
        continue
print(flag.count(1), wa_count)

Submission status: Wrong Answer

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

flag = [0]*n
wa_count = 0
for i in range(m):
    if s[i] == "WA" and flag[p[i]-1] == 0:
        wa_count += 1
    elif s[i] == "AC" and flag[p[i]-1] == 0:
        flag[p[i]-1] = 1
    else:
        continue
print(flag.count(1), wa_count)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac, wa=['F']*n,[0]*n
for i in range(m):
  p,s = map(str, input().split())
  p=int(p)
  if s=='AC': ac[p-1]='T'
  elif (s=='WA') and (ac[p-1]=='F'): wa[p-1]+=1
penalty = sum(wa)
clear = len([i for i in ac if i=='T'])
print('%d %d'%(clear,penalty))

Submission status: Wrong Answer

Solution code:
import collections
n,m = map(int,input().split())
ac, wa=[], []
for i in range(m):
  p,s = map(str, input().split())
  if s=='AC': ac.append(p)
  elif (s=='WA') and (p not in ac): wa.append(p)
penalty = len(wa)
clear = len(set(ac))
print('%d %d'%(clear,penalty))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac, wa=[], {}
for i in range(m):
  p,s = map(str, input().split())
  if s=='AC': ac.append(p)
  elif (s=='WA') and (p not in ac):
    if p not in wa.keys(): wa[p]=1
    else: wa[p]+=1
penalty = sum(wa.values())
clear = len(set(ac))
print('%d %d'%(clear,penalty))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac, wa=[], {}
for i in range(m):
  p,s = map(str, input().split())
  if s=='AC': ac.append(p)
  elif (s=='WA') and (p not in ac):
    if p not in wa.keys(): wa[p]=1
    else: wa[p]+=1
penalty = sum(wa.values())
clear = len(ac)
print('%d %d'%(clear,penalty))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
PS = [[x for x in input().split()] for _ in range(M)]
tmp = [0] * (10**5+1)
ac = wa = 0

for P, S in PS:
    if S=='WA':
        tmp[int(P)] += 1
    elif S=='AC' and tmp[int(P)]!=-1:
        ac+=1
        wa+=tmp[int(P)]
        tmp[int(P)] = -1
        
print(ac,wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ps = []
for _ in range(m):
	p,s = map(str,input().split())
	p = int(p)-1
	ps.append([p,s])

ac = [-1 for _ in range(n)]
ans_ac = 0
ans_wa = 0
for i in range(m):
	if ps[i][1] == 'WA':
		if ac[ps[i][0]] == -1:
			ans_wa += 1
	else:
		if ac[ps[i][0]] == -1:
			ac[ps[i][0]] = 1
			ans_ac += 1
print(ans_ac,ans_wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l1=[list(input().split()) for i in range(m)]
l2=["WA"]*n
account=0
wacount=0
for i in range(m):
  if l1[i][1]=="WA" and l2[int(l1[i][0])-1]=="WA":
    wacount+=1
  if l1[i][1]=="AC":
    l2[int(l1[i][0])-1]="AC"

for i in range(n):
  if l2[i]=="AC":
    account+=1
print(account,wacount)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#C

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

ac = {i+1:0 for i in range(N)}
wa = {i+1:0 for i in range(N)}

for p, S in pS:
  p = int(p)
  if S=="AC":
    ac[p] = 1
  if S=="WA" and ac[p]==0:
    wa[p] += 1

print(sum(ac.values()), sum(wa.values()))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
list=[]
sum=0
for i in range(m):
  p,s=input().split()
  if int(p) not in list:
    sum=sum+1
    if s=='AC':
      list.append(int(p))
print(len(list),sum-len(list))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=[]
cnt_WA=0
cnt_AC=0
for i in range(m):
    s=list(map(str,input().split()))
    #print(s)
    l.append(s)
cnt_all_AC = 0
cnt_AC = 0
for j in range(m-1):
    if int(l[j][0])==int(l[j+1][0]):
        if l[j][1]=='WA' :
            #print('WAl[j][0]',l[j][0])
            cnt_WA +=1
            #if l[j+1][1]=="AC":
            #    print('ACl[j][0]',l[j][0])
            #    cnt_AC +=1
                
        if l[j][1]=="AC":
            if cnt_AC ==0:
                cnt_AC +=1
                cnt_all_AC += cnt_AC


    else:
        if l[j][1]=="AC":
            cnt_AC += 1
            cnt_all_AC += cnt_AC
        else:
            if cnt_AC ==0:
                cnt_WA +=1
            cnt_all_AC += cnt_AC
        cnt_AC = 0
    if j+1==m:
        if cnt_AC == 0 and l[j+1][1]=="WA":
            cnt_AC += 1
            cnt_all_AC += cnt_AC
    


print(cnt_all_AC,cnt_WA)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=[]
cnt_WA=0
cnt_AC=0
for i in range(m):
    s=list(map(str,input().split()))
    #print(s)
    l.append(s)
cnt_all_AC = 0
cnt_AC = 0
for j in range(m-1):
    if int(l[j][0])==int(l[j+1][0]):
        if l[j][1]=='WA' :
            #print('WAl[j][0]',l[j][0])
            cnt_WA +=1
            #if l[j+1][1]=="AC":
            #    print('ACl[j][0]',l[j][0])
            #    cnt_AC +=1
                
        if l[j][1]=="AC":
            if cnt_AC ==0:
                cnt_AC +=1
                cnt_all_AC += cnt_AC

            #print('PACl[j][0]',l[j][0])
            #break
    else:
        if l[j][1]=="AC":
            cnt_AC += 1
            cnt_all_AC += cnt_AC
        else:
            if cnt_AC ==0:
                cnt_WA +=1
            cnt_all_AC += cnt_AC
        cnt_AC = 0
    if j+1==m:
        if cnt_AC == 0 and l[j+1][1]=="WA":
            cnt_AC += 1
            cnt_all_AC += cnt_AC
    print('cnt_AC','cnt_all_AC','cnt_WA',cnt_AC,cnt_all_AC,cnt_WA)



print(cnt_all_AC,cnt_WA)