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: Runtime Error

Solution code:
n,m = map(int,input().split())
#ac,wa列を作成（pi問題がACならac[i]がTRUE、AC,WAに問わずwa[i]はwaの数）
ac, wa=[False]*n,[0]*n
for i in range(m):
  p,s = input().split()
  p=int(p)
  if s=='AC':
    ac[p-1]=True
  elif (s=='WA') and (ac[p-1]==False):
    wa[p-1]+=1

penalty, clear=0,0
for i,tf in enumerate(ac): #iはインデックス、tfはac[i]
  if tf:
    penalty += wa[i] #piがACされているとき、ペナルティ値を増やす
    clear += 1
print(clear penalty)

Submission status: Runtime Error

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

A = []*m;
B = []*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: Runtime Error

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

A = []*m;
B = []*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: Runtime Error

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
a=np.array(a)
w=np.array(w)
aw=a*w
print(sum(a),sum(aw))

Submission status: Runtime Error

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 = [];

#AC_listの作成
for i in range(m):
  if B[i] == "AC":
    if A[i] not in AC_list: 
      AC_list.append(A[i]);

AC_count = len(AC_list);

#WA_countの作成
for j in range(m):
  if A[i] in AC_list:
    if B[i] == "WA":
      WA_count += 1;

 print(AC_count, WA_count);

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
PS = [[x for x in input().split()] for _ in range(M)]
tmp = [0] * N
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: Runtime Error

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
        wa_number=int(p)
    elif s=="AC" and ac_number!=int(p): #ac_numberは最後にacした問題の番号
        ac+=1
        ac_number=int(p)
    if wa_number==ac_number:
        last_wa+=wa
print(ac,last_wa)

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
L = [0]*n
AC = 0
WA = 0
tmp = [0]*n
for i in range(m):
	x,y = input().split()
	x = int(x)
	if L[x-1] == 0:
		if y == "WA":
			tmp[x-1] += 1
		else:
			AC += 1
			WA += tmp[x-1]
			L[x-1]=1
print(A,W)

Submission status: Runtime Error

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

Submission status: Runtime Error

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: Runtime Error

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

WA_count = 0
AC_count = 0
Penal = 0
d = {}
d_W = {}

for i in range(1, M+1):
    p, S = list(map(str, input().split()))
    if S == "WA":
        if p not in d_W.keys():
            d_W[p] = 1
        else:
            d_W[p] += 1
    else:
        if p not in d.keys():
            d[p] = d_W[p]

    # if S == "WA":
    #     WA_count += 1
    # else:
    #     if p not in d.keys():
    #         d[p] = WA_count
    #         WA_count = 0
    #     else:
    #         WA_count = 0
        # cor.append(p)
        # if AC_count != set(cor):
        #     AC_count = set(cor)
        #     Penal += WA_count
        #     WA_count = 0
        # else:
        #     WA_count = 0

print(len(d), sum(d.values()))

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
ps=[list(input().split()) for i in range(m)]
pen=[0]*n
rig=[0]*n

for i in range(m):
  if ps[i][1] == "AC":
    rig[int(ps[i][0])-1]=1
  else:
    if rig[int(ps[i][0]-1)] == 0:
      pen[int(ps[i][0]-1)]+=1

cnt1,cnt2=0,0
for i in range(n):
  if rig[i]==1:
    cnt1+=rig[i]
    cnt2+=pen[i]
    
print(str(cnt1)+" "+str(cnt2))

Submission status: Runtime Error

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

for i in range(m):
  if ps[i][1] == "AC":
    rig[int(ps[i][0])-1]=1
  else:
    if rig[int(ps[i][0]-1)] == 0:
      pen[int(ps[i][0]-1)]+=1

cnt1,cnt2=0,0
for i in range(n):
  if rig[i]==1:
    cnt1+=rig[i]
    cnt2+=pen[i]
    
print(str(cnt1)+" "+str(cnt2))

Submission status: Runtime Error

Solution code:

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

data = {}
ps = [0] * N
ACs = []

num_ac = 0
num_wa = 0


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

    if ps[p] == 0:
        ps[p] = 1
        data[p] = {'AC':0, 'WA':0}

    if S == 'AC' and data[p]['AC'] == 0:
        ACs.append(p)
        data[p]['AC'] += 1
        num_ac += 1
        num_wa += data[p]['WA']

    if S == 'WA' and data[p]['AC'] == 0:
        data[p][S] += 1

print(num_ac, num_wa)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
d = [0]*10**5

a = set()
w = 0

for t in open(0):
    p, s = t.split
    p = int(p)
    if "AC" == s and p not in a:
        w += d[p]
        a.add(p)
    if "WA" == s:
        d[p] += 1

print(len(a), w)

Submission status: Runtime Error

Solution code:
N,M = list(map(int,input().split()))
p = []
for i in range(M):
    x,y = list(map(str, input().split()))
    p.append([int(x),y])
count = [[0,0]for i in range(M)]
ansac = 0
answa = 0
for i in range(M):
    if count[p[i][0]-1][1] != 0:
        pass
    else:
        if p[i][1] == 'AC':
            count[p[i][0]-1][1] += 1
        else:
            count[p[i][0]-1][0] += 1
for i in range(N):
    answa += count[i][0]
    ansac += count[i][1]
print(str(ansac) + ' ' + str(answa))

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
p_li = [list(input().split()) for _ in range(m)]
from collections import defaultdict
wa_d = defaultdict(int)
wa = 0
ac = []
for x in p_li:
    if x[0] not in ac:
        if x[1]=="AC":
            ac.append(x[0])
            wa+=wa_d[x[0]]
        else:
            wa_d[x[0]] += 1
        
print(len(ac),sum(wa))

Submission status: Runtime Error

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

submits = []
for _ in range(m):
  p, s = map(str, input().split())
  submits.append([int(p), s])
  
wrongs = [0] * 10000
accepteds = [0] * 10000

i = 0
while i < m:
  order = submits[i][0]
  if submits[i][1] == "AC":
    if accepteds[order] == 0:
      accepteds[order] += 1
  else:
    if accepteds[order] == 0:
      wrongs[order] += 1
  i += 1

print(sum(accepteds), sum(wrongs))

Submission status: Runtime Error

Solution code:
    N,M = map(int, input().split())
	ac = [0]*N
	wa = [0]*N
	for i in range(M):
		p,s = input().split()
		if s == 'AC':
			if ac[int(p) - 1] != 0:
				continue
			else:	
				ac[int(p) - 1] = 1
		else:
			if ac[int(p) - 1] != 0:
				continue
			else:
				wa[int(p) - 1] += 1
	AC,WA = 0,0

	for i in range(N):
		AC += ac[i]
		if ac[i] >= 1:
			WA += wa[i]
	print(AC,WA)

Submission status: Runtime Error

Solution code:
from collections import deque

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

for a in range(M):
    p,s = input().split()
    
    p = int(p) - 1

    if ac[p]:
        continue
    if s == 'AC':
        ac[p] = 1
    else:
        pena[p] += 1

AC = 0
PENA = 0

for a in range(N):
    AC += ac[a]
    if ac[a]:
        PENA += pena[a]

print(AC,PENA)

Submission status: Runtime Error

Solution code:
from collections import deque

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

for a in range(M):
    p,s = input().split()
    
    p = int(p) - 1

    if ac[p]:
        continue
    if s == 'AC':
        ac[p] = 1
    else:
        pena[p] += 1

AC = 0
PENA = 0

for a in range(M):
    AC += ac[a]
    if ac[a]:
        PENA += pena[a]

print(AC,PENA)

Submission status: Runtime Error

Solution code:
from collections import deque

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

for a in range(M):
    p,s = input().split()
    
    p = int(p) - 1

    if ac[p]:
        continue
    if s == 'AC':
        ac[p] = 1
    else:
        pena[p] += 1

AC = 0
PENA = 0

for a in ac:
    AC += a
    if a:
        PENA += pena[ac.index(a)]

print(AC,PENA)

Submission status: Runtime Error

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

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


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

for i in range(m):
	if ac[i]=0:
		wa[p]=0
        
print(sum(ac),sum(wa))

Submission status: Runtime Error

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

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


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

for i in range(m):
	if ac[i]=0:
		wa[p]=0
        
print(sum(ac),sum(wa))

Submission status: Runtime Error

Solution code:
x, y = map(int, input().split())
li = []
k = 0 #カウント数
for _ in range(y):
    a, b = map(str, input().split())
    if b == 'AC':
        if a in li:
            continue
        else:
            li.append(a)
    elif b == 'WA':
        if a in li:
            continue
        else:
            k += 1
s = 0
for _ in dd:
    s += 1
            
print(s, k)

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
s = [list(input().split()) for i in range(m)]
s = sorted(s, key = lambda x: x[0])
cnt1,cnt2 = [0]*n,[0]*n
qnum = int(s[0][0])
if m == 0:
    print(0,0)
else:
    for i in range(m):
        if qnum == int(s[i][0]):
            if cnt1[qnum-1] == 0 and s[i][1] == 'AC': #その問題での初AC
                cnt1[qnum-1] = 1
            elif cnt1[qnum-1] == 0 and s[i][1] == 'WA':#ACはまだでWAのとき
                cnt2[qnum-1] += 1
        else:
            qnum = int(s[i][0])
            if s[i][1] == 'AC':
                cnt1[qnum-1] = 1
            else:
                cnt2[qnum-1] += 1
    print(sum(cnt1),sum(cnt2))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
WA = [0] * N
AC = [0] * N
for i in range(M):
    p,s = input().split()
    p = int(p)
    if AC[p-1] == 0:
        if s == "AC":
            AC[p-1] = 1
        else:
            WA[p-1] += 1
wa = 0
for j in range(M):
    if AC[j] == 1:
        wa += WA[j]
print(sum(AC),wa)

Submission status: Runtime Error

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

str_list = ["WA"] * n # 問題数分のリスト
int_list = [0] * n    # 問題数分のリスト
num = 0
ac = 0    

for p_, s in  ps: # p：問題番号 s：AC or WA
    p = int(p_) - 1
    if s == "AC":
        str_list[p] = "AC" # WAリスト
    else: # s!= WA
        if str_list[p] !="AC": # まだACされていない問題が、WAだったら
            int_list[p] += 1   # 問題ごとのWAの回数

for i in range(n): 
    if str_list[i] == "AC": ペナルティはACできた問題のみ
        num += int_list[i] # WAの回数
        ac += 1            # ACの数

print(ac, num)

Submission status: Runtime Error

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

seito = 0
pena  = 0

str_list = ["WA"] * n # 問題数分のリスト
int_list = [0] * n　　# 問題数分のリスト
num = 0
ac = 0    

for p_, s in  ps: # p：問題番号　s：AC or WA
    p = int(p_) - 1
    if s == "AC":
        str_list[p] = "AC"  # WAリスト
    else: # s!= WA
        if str_list[p] !="AC": # まだACされていない問題が、WAだったら
            int_list[p] += 1   # 問題ごとのWAの回数

for i in range(n): #
    if str_list[i] == "AC": ペナルティはACできた問題のみ
        num += int_list[i] # WAの回数
        ac += 1　　　　　　# ACの数

print(ac, num)

Submission status: Runtime Error

Solution code:
from collections import defaultdict

n, m = map(int, input().split()) 

d = defaultdict(int)
ans = 0
pena = 0

for _ in range(m):
    p, s = input().split()
    if s == "AC":
        if d[p] == -1:
            continue
        else:
            ans += 1
            pena += d[p]
            d[p] = -1
    else:
        if d[p] == -1:
            continue
        else;
            d[p] += 1

print(ans, pena)

Submission status: Runtime Error

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

seito = 0
pena  = 0

for i in range(n):
    flg = False
    for j in range(m):
        if sp[j][0] == i and ps[j][1] == "AC":
            if flg == False:
                seito += 1
                flg = True
            elif ps[j][0] == i and ps[j][1] == "WA":
                if flg == False:
                    pena += 1
            else:
                pass

print(seito, pena)

Submission status: Runtime Error

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

wa,ac = 0,0
if m==0:
    print(0,0)
else:
    k = [[] for i in range(2)]
    f=0
    temp=up[0]
    for t in up:
        if not temp[0]==t[0]:
            f+=1
        k[f].append(t)
        temp=t
    temp = False
    for qrs in k:
        for qr in qrs:
            if qr[1] == "WA":
                wa+=1
            elif qr[1] == "AC" and not temp:
                ac+=1
                break
    print(ac,wa)

Submission status: Runtime Error

Solution code:
up = [input().split() for i in range(m)]

wa,ac = 0,0
if m==0:
    print(0,0)
else:
    k = [[] for i in range(2)]
    f=0
    temp=up[0]
    for t in up:
        if not temp[0]==t[0]:
            f+=1
        k[f].append(t)
        temp=t
    temp = False
    for qrs in k:
        for qr in qrs:
            if qr[1] == "WA":
                wa+=1
            elif qr[1] == "AC" and not temp:
                ac+=1
                break
    print(ac,wa)

Submission status: Runtime Error

Solution code:
def main(n, m, p_s):
    st = [False for _ in range(n)]
    ac, wa = 0, 0

    for p, s in p_s:
        if st[p - 1]:
            continue

        if s == "AC":
            ac += 1
            st[p - 1] = True
        if s == "WA":
            wa += 1

    print(ac, wa)


if __name__ == "__main__":
    n, m = map(int, input().split())
    p_s = [list(map(int, input().split())) for _ in range(m)]

    main(n, m, p_s)

Submission status: Runtime Error

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

for i in range(M):
    p, S=input().split()
    p=int(p)
    if ac[p-1]==0:
        if S=="AC":
            ac[p-1]=1
        elif S=="WA":
            wa[p-1]+=1
            
wacnt=0
for i in range(N):
	if ac[i]>=1:
      wacnt+=wa[i]
		
print(sum(ac), wacnt)

Submission status: Runtime Error

Solution code:
N,M = map(int, input().split())
A = {}
C = 0
P = 0
for i in range(M):
    p,S = map(str, input().split())
    if S == 'AC' and A.get(p+S) is None:
        A[p+S] = 0
        C += 1
    elif S == 'WA' and A.get(p+'AC') is None and A.get(p+S) is None:
        A[p+S] = 1
    elif S == 'WA' and A.get(p+'AC') is None:
        A[p+S] += 1
for i in range(1,N+1):
    if A.get(str(i)+'AC') is not None:
        P += A[str(i)+'WA']
print(C,P)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
lis = [list(input().split()) for _ in range(m)]
d = {}
ac, wa = 0, 0
for i in lis:
    if i[0] not in d:
        if i[1] == 'AC':
            ac += 1
            d[i[0]] = 'AC'
        else:
            d[i[0]] = 1
    else:
        if i[1] == 'AC':
            if d[i[0]] != 'AC':
                ac += 1
                wa += d[i[0]]
                d[i[0]] = 'AC'
        else:
            d[i[0]] += 1
print(ac, wa)

Submission status: Runtime Error

Solution code:
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
problems = [False] * N
AC = [0] * N
WA = [0] * N
for _ in range(M):
    p, S = sr().split(); p = int(p) - 1
    if not problems[p] and S == 'WA':
        WA[p] += 1
    if not problems[p] and S == 'AC':
        problems[p] = True
        AC += 1

AC_total = sum(AC)
WA_total = sum(y for x, y in zip(AC, WA) if x)
print(AC_total, WA_total)

Submission status: Runtime Error

Solution code:
import numpy as np
n, m = map(int, input().split())
lst = []
for _ in range(n):
    lst.append([0, 0])

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        lst[p-1][0] = 1
    elif lst[p-1][0] == 0:
        lst[p-1][1] += 1

correct = 0
wrong = 0
for i in range(n):
    correct += lst[i][0]
    wrong += lst[i][1]
print(correct, wrong)

Submission status: Runtime Error

Solution code:
def main():
    N, M = map(int, input().split())
    PS = [list(input(_).split()) for _ in range(M)]
#    PS = [list(int(a),b) for a, b in PS]
    CNT = [0] * N
    PENA = [0] * N
    for p, s in PS:
        p = int(p)
        if CNT[p]: continue
        if s == "AC": CNT[p-1] = 1
        else:
            if CNT[p-1] == 0:
                PENA[p-1] += 1

    ans = 0
    for idx,val in enumerate(PENA):
        if CNT[idx] == 1:
            ans += val

    print(sum(CNT),ans)

main()

Submission status: Runtime Error

Solution code:
n, m = [int(i) for i in input().split()]
ac = [0] * n
wa = [0] * n

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

wa_sum = 0
for i in range(n):
    if ac[i] >= 1: wa_sum += wa[i]

print(sum(ac), sum_wa)

Submission status: Runtime Error

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

for i in range(m):
  p,s=input().split()
  p=int(p)
  if s=="AC":
    if AC_list[p]==0:
      AC=AC+1
      AC_list[p]=1
  else:
    if AC_list[p]==0:
      WA=WA+1
    
print(AC,WA)

Submission status: Runtime Error

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

for i in range(m):
  p,s=input().split()
  p=int(p)
  if s=="AC":
    if AC_list[p]==0:
      AC=AC+1
      WA=WA+WA_list[p]
      AC_list[p]=1
  else:
    if AC_list[p]==0:
      WA_list[p]=WA_list[p]+1
    
print(AC,WA)

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
p_li, s_li = [], []
for _ in range(m):
    p, s = input().split()
    p_li.append(int(p))
    s_li.append(s)

ac = [0] * n
wa = [0] * n
for i in range(m):
    p, s = p_li[i] - 1, s_li[i]
    if s == 'AC':
        ac[p] += 1
    elif ac[p] == 0:
        wa[p] += 1
    else:
        continue
n_ac, n_wa = 0, 0
for i in range(n):
    if ac[i] != 0:
        n_ac += 1
        n_wa += wa[i]
print('{} {}'.format(ans[0], ans[1]))

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
ac_list = [0]*n
wa_list = [0]*n
pena = 0
for i in range(m):
    p,s = input().split()
    if s == 'AC':
        if ac_list[int(p)-1] == 0:
            ac_list[int(p)-1] =1
            pena += wa_list[int(p)-1]
        
    if s == 'WA':
        if ac_list[int(p)-1] == 0:
            wa_list[int(p)-1] += 1
            
print('{0} {1}'.format(sum(ac_list) , pena)

Submission status: Runtime Error

Solution code:
d = dict()
wa = ac = 0
N, M= map(int,input().split())
for i in range(M):
  a, b = input().split()
    if a not in d:
        d[a] = 0
    if d[a] >= 0 and b == "AC":
        ac += 1
        wa += d[a]
        d[a] = -1
    elif d[a] >= 0:
        d[a] += 1
print(ac,wa)

Submission status: Runtime Error

Solution code:
d = dict()
wa = ac = 0
N, M= map(int,input().split())
for i in range(M):
  a, b = input().split()
  if a not in d:
    d[a] = 0
if d[a] >= 0 and b == "AC":
    ac += 1
    wa += d[a]
    d[a] = -1
elif d[a] >= 0:
    d[a] += 1
print(ac,wa)

Submission status: Runtime Error

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

for i in range(m):
	id, res = input().split()
	id = int(id)
	if (res == "AC") and (arS[id]==False):
		arS[id] = True
		score = score+1
        penalty = penalty * arP[id]
	if (res == "WA"): 
		arP[id] = arP[id] + 1
        
print(score, penalty)

Submission status: Runtime Error

Solution code:
n,m = map(int, input().split())
 
arS = [False] * (n+1)
 
score = 0
penalty = 0
for i in range(m):
	id, res = input().split()
	id = int(id)
#	print(type(id),type(res))
	if (res == "AC") and (arS[id]==False):
		arS[id] = True
		score = score+1
	if (res == "WA")  # and (arS[id]==False): 
		penalty = penalty + 1
        
print(score, penalty)

Submission status: Runtime Error

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

arS = [False] * n

score = 0
penalty = 0
for i in range(m):
	id, res = input().split()
	id = int(id)
#	print(type(id),type(res))
	if (res == "AC") and (arS[id]==False):
		arS[id] = True
		score = score+1
	if (res == "WA") and (arS[id]==False): 
		penalty = penalty + 1
        
print(score, penalty)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
/* 만든 사람 <xrssa> */
/* 불타오르네, 불타오르네, 불타오르네 */
#include <bits/stdc++.h>
using namespace std;

#define f(i,n)        for(int i=0;i<n;i++)
#define fab(i,a,b)    for(int i=a;i<b;i++)
#define fa(elem, arr) for(auto &elem:arr)
#define all(a)        a.begin(),a.end()

void solve(){
    int n,m;cin>>n>>m;
    map<string,pair<int,int>> ar;
    int ac=0,penal=0;
    f(i,m){
        string id,res;
        cin>>id>>res;
        if(ar[id].first==0){
            if(res=="WA") ar[id].second+=1;
            else {
                ar[id].first=1;
                penal+=ar[id].second;
                ac+=1;
            }
        }
    }
    cout << ac << " " << penal << "\n";
}

int main()
{   ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // 여러 테스트 사례 사용
    solve();
    return 0;
}

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
ar={f"{m}":[0,0] for m in range(1,n+1)}
ac=0
penal=0
for _ in range(m):
    id_,res=input().split()
    if ar[id_][0] == 0:
        if res=='WA':
            ar[id_][1]+=1
        else:
            ar[id_][0]=1
            penal+=ar[id_][1]
            ac+=1
print(ac, penal)

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
ac=0
penal=0
ar={f"{m}":-1 for m in range(1,n+1)}
for _ in range(m):
    id_,res=input().split()
    if ar[id_]==-1 and res=='WA':
        penal+=1
    elif ar[id_]==-1 and res=='AC':
        ac+=1
        ar[id_]=1
print(ac, penal)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
ac = [False] * N
wa = [0] * N
ans = [0, 0]
for i in range(M):
    p, S = input().split()
    p = int(p) - 1
    if not ac[p]:
        if S == 'WA':
            wa[p] += 1
        elif S == 'AC':
            ac[p] = True
for i in wa:
    if ac[i]:
        ans[0] += wa[i]
        ans[1] += 1
print(ans[0], ans[1])

Submission status: Runtime Error

Solution code:
def main():
    n, m = map(int, input().split())
    ac = [0] * m
    pena = [0] * m

    for _ in range(m):
        p, s = map(str, input().split())
        p = int(p) - 1
        if ac[p] == 0 and s == 'WA':
            pena[p] += 1
        else:
            ac[p] = 1
    print()


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
L=[0]*N
A=0
W=0
tmp=[0]*M
for i in range(M):
	x,y=input().split()
	t=int(x)
	if L[t-1]==0:
		if y=="WA":
			tmp[t-1]+=1
		else:
			A+=1
			W+=tmp[t-1]
			L[t-1]=1
print(A,W)

Submission status: Runtime Error

Solution code:
N, M = map(int,input().split())
lst=[None]*M
for i in range(M):
    p, S=input().split()
    lst[i]=(int(p), S)

#print(N, M, lst)
#count AC
AC_count = 0
WA_count = 0
AC_check={}
for i in range(M-1,-1,-1):
    #print(i)
    if lst[i][1]=='AC':
        AC_check[lst[i][0]-1]=i
#print(AC_check)

AC_count=len(AC_check)

for i in range(1, N+1):
    if AC_check[i-1]!=None:
        #AC_count += 1
        WA_count+=lst[:AC_check[i-1]].count((i, 'WA'))

print(AC_count, WA_count)

Submission status: Runtime Error

Solution code:
N,M=map(int, input().split())
q=list([] for m in range(M))
if 1<=M:
    x0,y0=input().split()
    q[0].append(y0)
    for m in range(M-1):
        x,y=input().split()
        q[int(x)-int(x0)].append(y)
wa=[0]*M
ac=[0]*M
for i in range(len(q)):
    for j in range(len(q[i])):
        if (q[i][j]=='AC')&(ac[i]==0):
            ac[i]=1
            wa[i]=j
print(sum(ac),sum(wa))

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
wa=0
hoge=[0 for i in range(n)]
huga=[0 for i in range(n)]
for i in range(m):
  a,b=map(str,input().split())
  if(hoge[int(a)-1]==0 and b=="AC"):
    hoge[int(a)-1]=1
  if(hoge[int(a)-1]==0 and b=="WA"):
    huga[int(a)-1]=1
    
for i in range(n):
  if(hoge[i]==0):
    huga=0
    
print(sum(hoge),sum(huga))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n, m = list(map(int, input().split()))
ac_list = [0] * n
wa_list = [0] * n
for _ in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == "AC":
        ac_list[p] = 1
    if s == "WA":
        if ac_list[p] == 0:
            wa_list[p] += 1
for k in range(m):
    if ac_list[k] == 0:
        wa_list[k] = 0
print(sum(ac_list), sum(wa_list))

Submission status: Runtime Error

Solution code:
n,m=list(map(int,input().split()))
ac,wa=0,0
aclis=[0]*n
walis=[0]*n

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