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=[False]*N
wa=[0]*N

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

    if s=="AC":
        ac[p]=True
    else:
        wa[p]+=1

a=0
b=0

for i in range(N):
    if ac[i]==True:
        a+=1
        b+=wa[i]

print(a,b,sep=" ")

Submission status: Runtime Error

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

ac=[False]*N
wa=[0]*N

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

    if s=="AC":
        ac[p]=True
    else:
        wa[p]+=1

a=0
b=0

for i in range(N):
    if ac[p]==True:
        a+=1
        b+=wa[i]

print(a,b,sep=" ")

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
dp=[0]*(n+1)
cnt=0
for i in range(m):
  q=input()
  if dp[int(q[:-3])]!="A" and q[-2]=="W":
    dp[int(q[:-3])]="W"
    cnt+=1
  elif dp[int(q[i])]!="A" and q[-2]=="A":
    dp[int(q[:-3])]="A"
print(dp.count("A"),cnt)

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
dp=[0]*(n+1)
cnt=0
for i in range(m):
  q=input()
  if dp[int(q[i])]!="A" and q[-2]=="W":
    dp[int(q[:-3])]="W"
    cnt+=1
  elif dp[int(q[i])]!="A" and q[-2]=="A":
    dp[int(q[:-3])]="A"
print(dp.count("A"),cnt)

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
a=[(0,0) for _ in range(n+1)]
x=[]
for i in range(m):
    x.append(list(input().split()))
    x[i][0]=int(x[i][0])
for i in range(m):
    if x[i][1]=="AC":
        a[x[i][0]][1]=1
    else:
        if a[x[i][0]][1]==1:
            continue
        else:
            a[x[i][0]][0]+=1
c=0
d=0
for i in range(n+1):
    c+=a[i][1]
    if a[i][1]:
        d+=a[i][0]
print(c,d)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
p = []
S = []
for _ in range(M):
    a, b = input().split()
    p.append(int(a))
    S.append(b)

ans = [[] for i in range(N)]
WA, AC = 0, 0
for p, S in zip(p, S):
    if ans[p - 1].count("AC") != 0:
        pass
    else:
        ans[p - 1].append(S)
        if S == "WA":
            WA += 1
        if S == "AC"
            AC += 1

print(AC, WA)

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
wa=0
ac=0
check = [0]*n
for _ in range(m):
	a, b = input().split()
	i = int(a)
	if check[i]==0:
		if b == "WA":
			wa+=1
		elif b == "AC":
			ac+=1
			check[i]=1
print(ac,wa)

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
wa=0
ac=0
check = [0]*n
for _ in range(m):
	a, b = input().split()
    i = int(a)
	if check[i]==0:
		if b == "WA":
			wa+=1
		elif b == "AC":
			ac+=1
			check[i]=1
print(ac,wa)

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
wa=0
ac=0
check = [0]*n
for _ in range(m):
	a, b = input().split()
	if check[int(a)]==0:
		if b == "WA":
			wa+=1
		elif b == "AC":
			ac+=1
			check[int(a)]=1
print(ac,wa)

Submission status: Runtime Error

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

tr = 0
fl = 0
a = PS[0][0]
flag = False
for i in range(M):
    if PS[i][0] == a :
        if PS[i][1] == 'AC':
            if flag == False:
                tr +=1
                flag = True
        elif PS[i][1] == 'WA' and flag == False:
            fl +=1
    elif PS[i][0] != a:
        a=PS[i][0]
        flag =False
        if PS[i][1] == 'AC':
            if flag == False:
                tr +=1
                flag = True
        elif PS[i][1] == 'WA' and flag == False:
            fl +=1
        
print(tr,fl)

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
acs=[0 for i in range(N)]
wa=[0 for i in range(N)]

for  i in range(M):
    p,S=map(str,input().split())
    p=int(p)
    if S=='AC':
        acs[p-1]=1
    elif S=='WA' and acs[p-1]==0: 
        wa[p-1]+=1
for i in range(M):
    if acs[i]==0:
        wa[i]=0
ans=[sum(acs),sum(wa)]

Submission status: Runtime Error

Solution code:
N, M = [int(s) for s in input().split(' ')]
ac = 0
wa = 0
result = dict()
fail = dict()
for m in range(M):
    p, s = input().split(' ')
    if p in result and result[p] == 'AC':
        continue
    if s == 'WA':
        fail[p] = fail.get(p, 0) + 1
        result[p] = s
    elif s == 'AC': # AC
        ac += 1
        wa += fail[p]
        result[p] = s
    
print(str(ac) + ' ' + str(wa))

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
ac = [False] * N
wa_cnt = [0] * N
ac_cnt = 0
for i in range(M):
    p, s = input().split()
    p_i = int(p) - 1
    if s == 'WA':
        if not ac[p_i]:
            wa_cnt[p_i] += 1
    else:
        if not ac[p_i]:
            ac[p_i] = True
            ac_cnt += 1

wa_cnt_sum = 0
for i in range(N):
    if ac_cnt[i]:
        wa_cnt_sum += wa_cnt[i]

print(ac_cnt,wa_cnt_sum)

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
s = list(tuple(input().split()) for _ in range(k))
ss,cnt_ac,cnt_wa = sorted(list(set(s))), 0, 0
for i in ss:
  if i[1]=='AC':
    cnt_ac+=1
  elif i[1]==‘WA’:
    cnt_wa+=1
print(cnt_ac,'',cnt_wa)

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
s = [[] for i in range(n)]
for i in range(m):
    p, S = input().split()
    s[int(p) - 1] += [S]
print(sum('AC' in si for si in s), end=' ')
print(sum(si[:si.index('AC')].count('WA') for si in s))

Submission status: Runtime Error

Solution code:
r = int(input())
g = int(input())

print(int(g * 2 - r))

Submission status: Runtime Error

Solution code:
import sys
n,m = map(int,input().split())
p = [list(map(str,input().split())) for _ in range(m)]
box = []
acnt,wcnt,tmp = 0,0,0
if m == 0:
	print(0,0)
	sys.exit()
inx = 0
for i in range(m):
	if p[i][0] != inx
		if p[i][1] == 'AC':
				inx =p[i][0]
				acnt += 1
				wcnt += tmp
				tmp = 0
		else:
			tmp += 1
print(acnt,wcnt)

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
p = [list(map(str,input().split())) for _ in range(m)]
box = []
acnt,wcnt,tmp = 0,0,0
inx = p[0][0]
for i in range(m):
	if not p[i][0] in box:
		if p[i][1] == 'AC':
				box.append(inx)
				acnt += 1
				wcnt += tmp
				tmp = 0
		else:
			tmp += 1
print(acnt,wcnt)

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
p = [list(map(str,input().split())) for _ in range(m)]
box = []
acnt,wcnt,tmp = 0,0,0
inx = p[0][0]
for i in range(m):
		if p[i][1] == 'AC':
			if not p[i][0] in box:
				box.append(inx)
				acnt += 1
				wcnt += tmp
				tmp = 0
		else:
			tmp += 1
print(acnt,wcnt)

Submission status: Runtime Error

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

correct=[]
data={}

for j in range(m):
    if p[j][0] in correct:
        continue
    if p[j][0] in data.keys():
        if p[j][1]=='WA': 
            data[p[j][0]]+=1
        else:
            correct.append(p[j][0])
    else:
        if p[j][1]=='WA':
            data[p[j][0]]=1
        else:
            correct.append(p[j][0])

#print(correct,data)
#print(len(correct),sum(data.values()))
sum_wa=0
for i in correct:
    sum_wa+=data[i]
#print(sum_wa)
print(len(correct),sum_wa)

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
lst=[list(input().split()) for i in range(m)]
x,y=0,0
cnt=['?']+[0]*n
cnt2=[0]+[0]*n
for i in lst:
  if i[1]=='WA':
    pin=int(i[0])
    if cnt[pin]!='AC':
      cnt2[pin]+=1
  elif i[1]=='AC':
    cnt[int(i[0])]='AC'

x=cnt.count('AC')

for i in range(len(cnt)+1):
  if cnt[i]=='AC':
    y+=cnt2[i]
print(x,y)

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
lst=[list(map(int,input().split())) for i in range(m)]
x,y=0,0
cnt=['?']+[0]*n
for i in lst:
  if i[1]=='WA':
    if cnt[i[0]]!='AC':
      y+=1
  elif i[1]=='AC':
    cnt[i[0]]='AC'

x=cnt.count('AC')

print(x,y)

Submission status: Runtime Error

Solution code:
import sys
import time
import math
import itertools as it
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

N, M = inpl()
dp = [False] * (N+10)
ac = 0
wa = 0
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if S == 'WA':
        if !dp[p]:
            wa += 1
    else:
        if !dp[p]:
            ac += 1
            dp[p] = True
print(ac, wa)


# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
ls2 = []
for i in range(M):
    A,B = map(str,input().split())
    ls = [int(A)-1,B]
    ls2.append(ls)

Pena = 0
corr = 0

ls3 = sorted(ls2, key=lambda x: x[0])
lsans = [[] for i in range(M)]
for i in range(M):
    lsans[ls2[i][0]].append(ls2[i][1])

for i in range(M):
    if bool(lsans[i]):
        for ans in lsans[i]:
            if ans == 'WA':
                Pena += 1
            if ans == 'AC':
                corr += 1
                break
print(corr,Pena)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
ac = 0
is_AC = [False] * (10 ** 5) + 1
WA_cnt = [0] * (10 ** 5) + 1
for i in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'WA':
        if is_AC[p]:
            continue
        else:
            WA_cnt[p] += 1
    else:
        if is_AC[p]:
            continue
        else:
            is_AC[p] = True
            ac += 1

print(ac, sum(WA_cnt))

Submission status: Runtime Error

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

print(ac, sum(WA_cnt))

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split()) 
L=[list(input().split()) for i in range(M)]
W=[0]*N
A=[0]*N
a=0
w=0
for i in range(M):
  if L[i][1]=="AC":
    A[int(L[i][0])-1]=1
    
  elif L[i][1]=="WA" and A[int(L[i][0])-1]==0:
    W[int(L[i][0])-1]+=1
#for i in A:
  #a+=i
#for i in W:
  #w+=i
for i in range(n):
  if A[i]>0:
    a+=1
    w+=W[i]
print(a,w)

Submission status: Runtime Error

Solution code:
import sys
def main():
    n,m = map(int, input().split())
    p_list = []
    ans_ac = 0
    ans_pn = 0
    for i in range (m):
        a,b=input().split()
        p_list.append((int(a), b))
        if p_list[i][1] == 'AC':
            ans_ac += 1
        elif p_list[i][1] == 'WA':
            ans_pn += 1
    if p_list[m-1][1] == 'WA':
        ans_pn -= 1

    print(ans_ac,ans_pn)
    
   
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
wa_dict = {}
is_AC = []
ac_cnt = 0
for i in range(N):
    p, s = input().split()
    p = int(p)
    if s == 'WA':
        if is_AC.count(p) == 0:
            if wa_dict.get(p) is None:
                wa_dict[p] = 1
            else:
                wa_dict[p] += 1
        else:
            continue
    else:
        if is_AC.count(p) == 0:
            ac_cnt += 1
            is_AC.append(p)

print(ac_cnt, sum(wa_dict.values()))

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
p = [0]*M
S = [0]*M
ans_AC = [0]*N
ans_WA = [0]*N
for i in range(M):
    p[i],S[i] = map(str,input().split())


for i in range(M):
    pi = int(p[i])
    if S[i] == "AC":
        if ans_AC[pi] != 1:
            ans_AC[pi] = 1
    else:
        if ans_AC[pi] != 1:
            ans_WA[pi] += 1
print(sum(ans_AC),sum(ans_WA))

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
ans_num_lis = [0 for i in range(N)]
pre_ans_lis = [0 for i in range(N)]
ans_lis = [0 for i in range(N)]
for i in range(M):
  problem, result = input().split()
  problem_num = int(problem)
  if result == "WA":
    pre_ans_lis[problem_num] += 1
  if result == "AC" and not ans_num_lis[problem_num]:
    ans_num_lis[problem_num] = 1
    ans_lis[problem_num] = pre_ans_lis[problem_num]

print(sum(ans_num_lis), sum(ans_lis))

Submission status: Runtime Error

Solution code:
n,m =map(int, input().split())
ac_dic = {}
wa_dic = {}
for _ in range(m):
  p,s = input().split()
  if s == 'AC':
    if p in ac_dic:
      continue
    else:
      ac_dic[p] = 1
  else:
    if p in ac_dic:
      continue
    else:
      if p in wa_dic:
        wa_dic[p] += 1
      else:
        wa_dic[p] = 1

wa_count = 0
for i,c in wa_dic.items():
  if ac_dic[i]:
    wa_count += c

print(f'{sum(ac_dic.values())} {wa_count}')

Submission status: Runtime Error

Solution code:
def II(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
ans,pena=0,0
N,M=MI()
P=[0]*N
PENA=[0]*N
for i in range(M):
  p,s=input().split()
  p=int(p)
  p-=1
  if s=='AC':
    if P[p]==0:
      ans+=1
      P[p]=1
  if s=='WA':
    if P[p]==0:
      PENA[p]+=1
for i in range(N):
  if P[p]!=1:
    PENA[p]=0
pena=sum(PENA)  
print(ans,pena)

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
l = [list(input().split()) for i in range(m)]
p,s = [list(i) for i in zip(*l)]
t = []
x = 0
y = 0

for i in range(m):
    if not p[i] in t:
        if s[i] == 'WA':
            y += 1
        else:
            t.append(p[i])
            x += 1

print(x,y)

Submission status: Runtime Error

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

ac_dict = {str(i): False for i in range(1, n + 1)}
wa_dict = {str(i): 0 for i in range(1, n + 1)}
ac_num = 0
wa_num = 0
for p_i, s_i in zip(p, s):
    if ac_dict[p_i] == False:
        if s_i == 'AC':
            ac_num += 1
            wa_num += wa_dict[p_i]
            ac_dict[p_i] = True
        elif s_i == 'WA':
            wa_dict[p_i] += 1
print('{} {}'.format(ac_num, wa_num))

Submission status: Runtime Error

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

judge = [False]*N
WAcnt = [0] * N
ACcnt = 0
for i in range(M):
    p,S = (x for x in input().split())
    p = int(p)
    if judge[p-1] == False:
        if S == "AC":
            judge[p-1] = True
            ACcnt += 1
        else:
            WAcnt[p-1] += 1

WAans = 0
for i in range(N):
    if judge[i] == True:
        WAans += WAans[i]

print(ACcnt,WAans)

Submission status: Runtime Error

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

judge = [False]*N
WAcnt = [0] * N
ACcnt = 0
for i in range(M):
    p,S = (x for x in input().split())
    p = int(p)
    if judge[p-1] == False:
        if S == "AC":
            judge[p-1] = True
            ACcnt += 1
        else:
            WAcnt[p-1] += 1

WAans = 0
for i in range(N):
    if judge[i-1] == True:
        WAans += WAans[i-1]

print(ACcnt,WAans)

Submission status: Runtime Error

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

judge = [False]*N
WAcnt = [0] * N
ACcnt = 0
for i in range(M):
    p,S = (x for x in input().split())
    p = int(p)
    if judge[p-1] == False:
        if S == "AC":
            judge[p-1] = True
            ACcnt += 1
        else:
            WAcnt[p-1] += 1

WAans = 0
for i in range(N):
    if judge[p-1] == True:
        WAans += WAans[p-1]

print(ACcnt,WAans)

Submission status: Runtime Error

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

correct = [0] * N
penalty = [0] * N
for p, s in ps:
    p = int(p)
    if correct[p-1] == 1:
        continue
    if s == 'AC':
        correct[p-1] = 1
    else:
        penalty[p-1] += 1
print(sum(correct), sum([p*c for p, c in zip(penalty, correct)]))))

Submission status: Runtime Error

Solution code:
def main():
  N, M = map(int, input().split())
  
  p = ['']*M
  s = ['']*M
  for i in range(M):
    p[i], s[i] = input().split()
    
  cnt = ['']*N
  cntAC = 0
  cntWA = 0
  
  for i in range(M):
    #もしクリアしたことがあったらノーカウント
    if cnt[int(p[i])] == 'clear':
      continue
    
    #WAならカウント＋１
    if s[i] == 'WA':
      cntWA += 1
    
    #ACならクリアしたことを記録してカウント＋１
    if s[i] == 'AC':
      cnt[int(p[i])] = 'clear'
      cntAC += 1
    
  print(cntAC, cntWA)
  
  
  
main()

Submission status: Runtime Error

Solution code:
def main():
  N, M = map(int, input().split())
  
  p = ['']*M
  s = ['']*M
  for i in range(M):
    p[i], s[i] = input().split()
    
  cnt = ['']*M
  cntAC = 0
  cntWA = 0
  
  for i in range(M):
    #もしクリアしたことがあったらノーカウント
    if cnt[int(p[i])] == 'clear':
      continue
    
    #WAならカウント＋１
    if s[i] == 'WA':
      cntWA += 1
    
    #ACならクリアしたことを記録してカウント＋１
    if s[i] == 'AC':
      cnt[int(p[i])] = 'clear'
      cntAC += 1
    
  print(cntAC, cntWA)
  
  
  
main()

Submission status: Runtime Error

Solution code:
N, M = [int(x) for x in input().split()]

ok = 0
ng = 0
ng_l = {}
end = set()

for _ in range(M):
    p, S = [x for x in input().split()]
    p = int(p)

    if not p in end:
        if S == 'AC':
            ok += 1
            ng += ng_l[p]
            end.add(p)
        else:
            if p in ng_l:
                ng_l[p] += 1
            else:
                ng_l[p] = 1

print('{} {}'.format(ok, ng))

Submission status: Runtime Error

Solution code:
import collections

n, m = map(int, input().split())
list_ac = set()
dic = collections.defaultdict(lambda:0)

ac = 0
wa = 0

for _ in range(m):
    p, s = input().split()
    if s == "WA" and p not in list_ac:
        dic[p] += 1
    elif s =="AC" and p not in list_ac:
        list_ac.append(p)
        ac += 1
        if p in dic:
            wa += dic[p]
            
print(ac, wa)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    n,m = map(int, input().split())
    wa = 0
    ac = 0
    used = {}
    wa_tmp = {}
    for _ in range(m):
        p,s = map(str, input().split())
        if used.get(p):
            continue
        if s == 'WA':
            if not wa_tmp.get(p):
                wa_tmp[p] = 0
            wa_tmp[p] += 1
        if s == 'AC':
            ac += 1
            used[p] = True
            wa += wa_tmp[p]
    print(ac, wa)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
A = [0 for _ in range(N+1)]
B = [0 for _ in range(N+1)]
for _ in range(M):
    p,S = input().split()
    p = int(p)
    if S=="AC":
        if A[p]==0:
            A[p]=1
    else:
        if A[p]==0:
            B[p] += 1
for i in range(N+1):
    if A[p]==0:
        B[p]=0
print(sum(A),sum(B))

Submission status: Runtime Error

Solution code:
# unihernandez22
# https://atcoder.jp/contests/abc151/tasks/abc151_c
# implementation

class Counter(dict):
    def __missing__(self, i):
        return 0

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

passed = 0
penalties = Counter()

ac = {}

for i in range(m):
    p, s = input().split()
    if not ac.get(p, False):
        if s == "WA": penalties[p] += 1
        elif s == "AC":
            passed += 1
            ac[p] = True

x = 0
for i in penalties:
    if ac[i]:
        x += penalties[i]

print(passed, x)

Submission status: Runtime Error

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

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

acCount = 0
waCount = 0
check = [0] * n
waCheck = [0] * n

for i in range(m):
    p, s = map(str, input().split())
    # print(p,s)
    p = int(p)
    if (check[p - 1] == 0):
        if (s == 'WA'):
            waCheck[p - 1] += 1

        else:
            acCount += 1
            waCheck += waCheck[p - 1]

            check[p - 1] = 1
    else:
        continue

print(acCount, waCount)

Submission status: Runtime Error

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

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

for i in range(n+1):
    if AC[i]==0:
        WA[i]=0

cnt=AC.count(0)
answer=len(AC)-cnt
ans=sum(WA)
print(answer,ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

l=[0 for i in range(n)]
t=""
w=0
ww=0
a=0
for i in range(m):
    p,s=input().split()
    if(l[int(p)-1]==1):continue
    if(s=="WA"):
        w+=1
        ww+=1
    if(s=="AC"):
        ww=0
        a+=1
        l[int(p-1)]=1
print(a,w-ww)

Submission status: Runtime Error

Solution code:
n,k,m=map(int,input().split())
a=list(map(int,input().split()))
sowa=0
for i in range(len(a)):
  sowa+=a[i]
if m*n>sowa+k:
  print(-1)
else:
  if m*n-sowa<0:
    print(0)
  else:
  	print(m*n-sowa)

Submission status: Runtime Error

Solution code:
N, M=map(int, input().split())
solved=[False]*N
ac=0
wa=0
for _ in range(M):
  p, s=input().split()
  p=int(p)-1
  if solved[p]:
    continue
  if s=="AC":
    solved[p]=True
    ac+=1
  else:
    wa+=1
print(as, wa)

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
L1=[0]*(N+1) #正解判定、iは問題分中と一致
L2=[0]*(N+1) #WAのカウント用、iは問題分中と一致

for i in range(M):
    p,S=input().split()
    if L1[int(p)]==1:
        pass
    else:
        if S=='AC':
            L1[int(p)]=1
        else:
            L2[int(p)]+=1

for j in range (M):
    if L1[j]==0 and L2[j]>0:
        L2[j]=0

print(sum(L1),sum(L2))

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=="WA" and ac[int(p)-1]==0:
    wa[int(p)-1]+=1
  elif s=="AC" and ac[int(p)-1]==0:
    ac[int(p)-1]+=1

penalty=[w[k] for k in [i for i,j in enumerate(ac) if j!=0]]    
print("%d %d" % (sum(ac),sum(penalty)))

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=="WA" and ac[int(p)-1]==0:
    wa[int(p)-1]+=1
  elif s=="AC" and ac[int(p)-1]==0:
    ac[int(p)-1]+=1

penalty=[w[k] for k in [i for i,j in enumerate(ac) if j!=0]]    
print("%d %d" %(sum(ac),sum(penalty)))

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=="WA" and ac[int(p)-1]==0:
    wa[int(p)-1]+=1
  elif s=="AC" and ac[int(p)-1]==0:
    ac[int(p)-1]+=1

penalty=[w(k) for k in [i for i,j in enumerate(ac) if j!=0]]    
print("%d %d" %())

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=="WA" and ac(int(p)-1)==0:
    wa[int(p)-1]+=1
  elif s=="AC" and ac(int(p)-1)==0:
    ac[int(p)-1]+=1

penalty=[w(k) for k in [i for i,j in enumerate(ac) if j!=0]]    
print("%d %d" %(sum(ac),sum(penalty)))

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=="WA" and ac(int(p)-1)==0:
    wa[int(p)-1]+=1
  elif s=="AC" and ac(int(p)-1)==0:
    ac[int(p)-1]+=1

penalty=[w(k) for k in [i for i,j in enumerate(ac) if j!=0]]    
print("%d %d" %())

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

penalty=[wa[j] for j,k in enumerate(ac) if not K==0]
print("%d %d" %(sum(ac),sum()))

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 == 'WA' and ac[int(p)-1] == 0:
            wa[int(p)-1] += 1
    elif s == 'AC' and ac[int(p)-1] == 0:
            ac[int(p)-1] += 1

print('%d %d' % (sum(ac), sum([wa[k] for k in [i for i,j in enumerete(ac) if j != 0]])))

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 == 'WA' and ac[int(p)-1] == 0:
        wa[int(p)-1] += 1
    elif s == 'AC' and ac[int(p)-1] == 0:
        ac[int(p)-1] += 1

print('%d %d' % (sum(ac), sum([wa[k] for k in [i for i,j in enumerete(ac) if j != 0]])))

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 == 'WA' and ac[int(p)-1] == 0:
    wa[int(p)-1] += 1
  elif s == 'AC' and ac[int(p)-1] == 0:
    ac[int(p)-1] += 1

print('%d %d' % (sum(ac), sum([wa[k] for k in [i for i,j in enumerete(ac) if j != 0]])))

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

  if s == 'WA' and ac[p] == 0:
    wa[p] += 1
  elif s == 'AC' and ac[p] == 0:
    ac[p] += 1

print('%d %d' % (sum(ac), sum([wa[k] for k in [i for i,j in enumerete(ac) if j != 0]])))

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

  if s == 'WA' and ac[p] == 0:
    wa[p] += 1
  elif s == 'AC' and ac[p] == 0:
    ac[p] += 1

print('%d %d' % (sum(ac), sum(wa[k] for k in [i for i,j in enumerete(ac) if j != 0])))

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

  if s == 'WA' and ac[p] == 0:
    wa[p] += 1
  elif s == 'AC' and ac[p] == 0:
    ac[p] += 1

print(sum(ac), sum(wa[k] for k in [i for i,j in enumerete(ac) if j != 0]))

Submission status: Runtime Error

Solution code:
def f(S,start_num,j):
  start=start_num[j-1]
  s=0
  for i in range(0,strat_num[j]-start_num[j-1]):
    if S[start+i]=="WA":
      s=s+1
      continue
    else:
      break
return s

N,M=map(int,input().split())
P_str=[0]*M
S=[0]*M
for i in range(M):
  P_str[i],S[i]=map(str,input().split())
P=[int(P_str[j]) for j in range(M)]

start_num=[0]*N
start_num[0]=0
for i in range(1,M):
    if not P[i-1]==P[i]:
      i=start_num[P[i]-1]

correct=0
for j in range(1,N+1):
  if f(S,start_num,j)<(start_num[j]-start_num[j-1]):
    correct+=1

penalty=0
for j in range(1,N+1):
  penalty+=f(S,start_num,j)

print(correct,"",penalty)

Submission status: Runtime Error

Solution code:
def f(S,start_num,j):
  start=start_num[j-1]
  s=0
  for i in range(0,strat_num[j]-start_num[j-1]):
    if S[start+i]=="WA":
      s=s+1
      continue
    else:
      break
return s

N,M=map(int,input().split())
P_str=[0]*M
S=[0]*M
for i in range(M):
  P_str[i],S[i]=map(str,input().split())
P=[int(P_str[j]) for j in range(M)]

start_num=[0]*N
start_num[0]=1
for i in range(1,M):
    if not P[i-1]==P[i]:
      i=start_num[P[i]-1]

correct=0
for j in range(1,N+1):
  if f(S,start_num,j)<(start_num[j]-start_num[j-1]):
    correct+=1
penalty=0
for j in range(1,N+1):
  penalty+=f(S,start_num,j)

print(correct,"",penalty)

Submission status: Runtime Error

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n, m = map(int, input().split())
    penalty = dict()
    penalty_cnt = 0
    ans = set()
    for _ in range(m):
        num, result = input().split()
        if result == 'AC':
            ans.add(num)
        elif num not in ans:
            if num not in penalty:
                penalty[num] = 1
            else:
                penalty[num] += 1
    ans = list(ans)
    for i in range(len(ans)):
        penalty_cnt += penalty[ans[i]]
    print(len(ans), penalty_cnt)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
a = 0
w = 0
lis = [[] for _ in range(N)]
for i in range(M):
  p,s = map(int,input().split())
  p = int(p)
  lis[p - 1].append(s)
for j in range(N):
  if lis[j].count("AC") > 0:
    a += 1
    w += lis[j].index("AC")

    
print(a,w)

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
a = 0
w = 0
lis = [[] for i in range(N)]
for i in range(M):
  p,s = map(int,input().split())
  p = int(p)
  lis[p - 1].append(s)
for j in range(N):
  if lis[j].count("AC") > 0:
    a += 1
    w += lis[j].index("AC")

    
print(a,w)

Submission status: Runtime Error

Solution code:
import numpy as np
N,M = map(int,input().split())
a = 0
w = 0
lis = np.zeros(N + 1)
for i in range(M):
  p,s = map(str,input().split())
  p = int(p)
  if lis[p + 1] == 0 and s == "AC":
    a += 1
    lis[p] = 1
  elif lis[p + 1] > 0 and s == "AC":
    continue
  elif lis[p + 1] == 0 and s == "WA":
    w += 1
  elif lis[p + 1] > 0 and s == "WA":
    continue
    
print(a,w)

Submission status: Runtime Error

Solution code:
import numpy as np
N,M = map(int,input().split())
a = 0
w = 0
lis = np.zeros(N + 1)
for i in range(M):
  p,s = map(str,input().split())
  if lis[p] == 0 and s == "AC":
    a += 1
    lis[p] = 1
  elif lis[p] != 0 and s == "AC":
    continue
  elif lis[p] == 0 and s == "WA":
    w += 1
  elif lis[p] != 0 and s == "WA":
    continue
    
print(a,w)

Submission status: Runtime Error

Solution code:
#C
N,M=map(int,input().split())
re=[0 for i in range(N+1)]
P=[0 for i in range(N+1)]
x=0
y=0
for i in range(M):
    p,S=input().split()
    p=int(p)
    if re[p]=="AC":
        continue
    elif S=="WA":
        P[p]+=1
    elif S=="AC":
        re[p]="AC"
        y+=1
for i in range(1,N+1):
    if re[p]=="AC":
        x+=P[p]
print(y,x)