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 = [int(n) for n in input.split(' ')]

list_AC = []
count_WA = {}

for i in range(M):
    p , S = input.split(' ')
    
    if (p in list_AC):
        # 既にAC済みの場合は何もしない
        continue 
    else:
        if S = 'AC':
            list_AC.append(p)
        else:
            if p in count_WA:
                count_WA[p] += 1
            else:
                count_WA[p] = 1
        
for i in list_AC:
    if i in count_WA:
        print(count_WA[i])
    else:
        print(0)

Submission status: Runtime Error

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

points    = [0] * n
penalties = [0] * n

for i in range(m):
  q, ans = input().split()
  # まだ正解が出ていない場合
  if(int(q) == 0):
    continue:
  if(points[int(q) - 1] == 0):
    # 正解の場合
    if(ans == 'AC'):
      points[int(q) - 1] = 1
    # 不正解の場合
    else:
      penalties[int(q) - 1] += 1

print(sum(points), sum(penalties))

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
row=m
number=[]
judgment=[]
for i in range(row):
    a,b=input().split()
    number.append(int(a))
    judgment.append(b)
 
z = 0
seitou,sippai = 0,0
kuria = [0] * (n+1)
if m > 0:
    for i in range(0,m+1):
        if kuria[number[i]] == 0 and judgment[i] == 'AC':
            seitou += 1
            kuria[number[i]] = 1
        elif kuria[number[i]] == 0 and judgment[i] == 'WA':
            sippai += 1
else:
    pass
print(seitou,sippai)

Submission status: Runtime Error

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


N = input_int_list[0]
M = input_int_list[1]

Q_ans_list = [0] * N

ans_correct = 0
ans_penalty = 0

for i in range(M):
	input_list_i = list( input().split())
	Q_num = int(input_list_i[0])
	if input_list_i[1] == "WA":
		if Q_ans_list[Q_num] != -1:
			Q_ans_list[Q_num] = Q_ans_list[Q_num] + 1
	elif input_list_i[1] == "AC":
		if Q_ans_list[Q_num] != -1:
			ans_correct = ans_correct + 1
			ans_penalty = ans_penalty + Q_ans_list[Q_num]
			Q_ans_list[Q_num] = -1





print(ans_correct,ans_penalty)

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
row=m
number=[]
judgment=[]
for i in range(row):
    a,b=input().split()
    number.append(int(a))
    judgment.append(b)
 
z = 0
seitou,sippai = 0,0
kuria = [0] * m
for i in range(0,len(judgment)):
    if kuria[number[i]] == 0 and judgment[i] == 'AC':
        seitou += 1
        kuria[number[i]] = 1
    elif kuria[number[i]] == 0 and judgment[i] == 'WA':
        sippai += 1
print(seitou,sippai)

Submission status: Runtime Error

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

acs = set()
was = 0
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if p not in acs:
        if S == 'AC':
            acs.add(p)
            wa = was
            was = 0
        else:
            was += 1
print(len(acs), wa)

Submission status: Runtime Error

Solution code:
'n(問題数), m(提出数)を抽出'
n, m = (int(x) for x in input().split())
d = {}
p = 0

for _ in range(m):
  a, b = (input().split())
  'Siが辞書にないかつPiが"WA"の場合はペナルティをカウント, Piが"AC"の場合辞書に追加'
  if a not in d:
    if b == 'WA':
      p +=1
      continue
    if b == 'AC':
      d[a] = b
      continue
  'Siが辞書にある場合はスキップ'
  else:
    continue

'辞書の要素数をカウントして正答数を計算、ペナルティはそのまま出力'
print(len(d), p)

Submission status: Runtime Error

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

nAC=0
nWA=0
for i in range(N):
    if len(A[i])==0:
        pass
    else:
        j=0 
        while A[i][j]=="WA":
            nWA+=1
            j+=1
            if j==len(A[i])-1:
                break
            else:
                pass
        if A[i][j]=="AC":
            nAC+=1
        else:
            pass
print("{:1}{:2}".format(nAC,nWA))

Submission status: Runtime Error

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

nAC=0
nWA=0
for i in range(N):
    if len(A[i])==0:
        pass
    else:
        j=0 
        while A[i][j]=="WA":
            nWA+=1
            j+=1
            if j==len(A[i]):
                break
            else:
                pass
        if A[i][j]=="AC":
            nAC+=1
        else:
            pass
print("{:1}{:2}".format(nAC,nWA))

Submission status: Runtime Error

Solution code:
lines = []
while True:
    line = input()
    if line:
        lines.append(line)
    else:
        break

c = 0
p = 0
curr_no = -1
for line in lines[1:]:
    curr = line.split()
    if(curr_no != curr[0]):
        curr_no = curr[0]
        curr_flag = True
    if(curr_flag):
        if(curr[1] == "AC"):
            c += 1
            curr_flag = False
        else:
            p += 1

print(str(c) + " " + str(p))

Submission status: Runtime Error

Solution code:
lines = []
while True:
    line = input()
    if line:
        lines.append(line)
    else:
        break

c = 0
p = 0
curr_no = -1
for line in lines[1:]:
    curr = line.split()
    if(curr_no != curr[0]):
        curr_no = curr[0]
        curr_flag = True
    if(curr_flag):
        if(curr[1] == "AC"):
            c += 1
            curr_flag = False
        else:
            p += 1

print(c, p)

Submission status: Runtime Error

Solution code:
#n = int(input())
#L = list(map(int, input().split()))
#import math
#import sys
#import heapq
#import fractions
#import bisect
#import numpy




NM = list(map(int, input().split()))
ps = [list(input().split()) for i in range(NM[1])]
a=[0]*NM[0]
flg = [True]*NM[0]
for i in range(NM[1]):
    ps[i][0] = int(ps[i][0])

ans = [0]*NM[0]
ac = 0
for i in range(NM[1]):
    if ps[i][1] == "AC":
        flg[ps[i][0]-1] = False
        ans[ps[i][0]-1] = a[ps[i][0]-1]
    if ps[i][1] == "WA" and flg[ps[i][0]-1]:
        a[ps[i][0]-1] += 1

for i in range(NM[0]):
    if flg[i]== False:
        ac += 1
print(ac,sum(ans))#n = int(input())
#L = list(map(int, input().split()))
#import math
#import sys
#import heapq
#import fractions
#import bisect
#import numpy




NM = list(map(int, input().split()))
ps = [list(input().split()) for i in range(NM[1])]
a=[0]*NM[0]
flg = [True]*NM[0]
for i in range(NM[1]):
    ps[i][0] = int(ps[i][0])

ans = [0]*NM[0]
ac = 0
for i in range(NM[1]):
    if ps[i][1] == "AC":
        flg[ps[i][0]-1] = False
        ans[ps[i][0]-1] = a[ps[i][0]-1]+1
    if ps[i][1] == "WA" and flg[ps[i][0]-1]:
        a[ps[i][0]-1] += 1

for i in range(NM[0]):
    if flg[i]== False:
        ac += 1
print(ac,sum(ans)-ac)

Submission status: Runtime Error

Solution code:
listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
        
N = listA[0][0]
M = listA[0][1]
ans = [0] * N
pena = [0] * N
        
        
for i in range(1, M):
    num=listA[i][0] -1
    res=listA[i][1]
    if res=="WA" and ans[num] == 0:
        pena[num] =  pena[num]+1
    if res=="AC":
        ans[num] = ans[num] + 1
        
print('%d %d' % (sum(ans), sum(pena) ))

Submission status: Runtime Error

Solution code:
listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
        
N = listA[0][0]
M = listA[0][1]
ans = [0] * N
pena = [0] * N
        
        
for i in range(1, M-1):
    num=listA[i][0] -1
    res=listA[i][1]
    if(res=="WA" and ans[num] == 0):
        pena[num] =  pena[num]+1
    if(res=="AC"):
        ans[num] = ans[num] + 1                      
        
print('%d %d' % (sum(ans), sum(pena) ))

Submission status: Runtime Error

Solution code:
listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
        
N = listA[0][0]
M = listA[0][1]

ans = [0] * N
pena = [0] * N

for i in range(1, M):
    num=listA[i][0] -1
    res=listA[i][1]
    if(res=="WA" and ans[num] == 0):
        pena[num] =  pena[num]+1
    if(res=="AC"):
        ans[num] = ans[num] + 1                      
        
print('%d %d' % (sum(ans), sum(pena) ))

Submission status: Runtime Error

Solution code:
listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
        
N = listA[0][0]
M = listA[0][1]

ans = [0] * N
pena = [0] * N

for i in range(M):
    num=listA[i+1][0] -1
    res=listA[i+1][1]
    if(res=="WA" and ans[num] == 0):
        pena[num] =  pena[num]+1
    if(res=="AC"):
        ans[num] = ans[num] + 1            
        
print('%d %d' % (sum(ans), sum(pena) ))

Submission status: Runtime Error

Solution code:
listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
        
N = listA[0][0]
M = listA[0][1]

ans = []
pena = []
for i in range(N): 
    ans.insert(0,0)
    pena.insert(0,0)
for i in range(M):
    num=listA[i+1][0] -1
    res=listA[i+1][1]
    if(res=="WA" and ans[num] == 0):
        pena[num] =  pena[num]+1
    if(res=="AC"):
        ans[num] = ans[num] + 1   
print(sum(ans),sum(pena))

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
score = [(False, 0) for i in range(n)]
for i in range(m):
	problem, s = input().split()
	p = int(problem)-1
	if not score[p][0]:
		if s=="AC":
			score[p][0] = True
		else:
			score[p][1] += 1
	

print(sum(i[0] for i in score), sum(j if i else 0 for i, j in score))

Submission status: Runtime Error

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

ac = [0] * n
wa = [0] * n
pena = 0

for i in range(m):
    question, answer = input().split()
    question = int(question)
    if (answer == "AC") and (ac[question] == 0):
        ac[question] = 1
        pena += wa[question]
    elif (answer == "WA") and (ac[question] == 0):
        wa[question] += 1

print(sum(ac), pena)

Submission status: Runtime Error

Solution code:
n,m = list(map(int, input().split()))
 
ac = [0]*n
wa = [0]*n
pena = 0
 
for i in range(m):
  question, answer = input().split()
  question = int(question)
  
  if (answer=="AC") and (ac[question]==0):
    ac[ques] = 1
    pena += wa[ques]
  elif (answer=="WA") and (ac[question]==0):
    wa[question] += 1
    
print(sum(ac), pena)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
list = [0]*a
t_cnt = 0
f_cnt = 0
for i in range(b):
  c, d = map(str,input().split())
  if d == 'AC':
    if list[c-1] == 0:
      list[c-1] = 1
      t_cnt += 1
  else:
    if list[c-1] == 0:
      f_cnt += 1
print("{} {}".format(t_cnt, f_cnt))

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
list = [0]*a
t_cnt = 0
f_cnt = 0
for i in range(b):
  c, d = map(str,input().split())
  if d == 'AC':
    if list[c] == 0:
      list[c] = 1
      t_cnt += 1
  else:
    if list[c] == 0:
      f_cnt += 1
print("{} {}".format(t_cnt, f_cnt))

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
ac_list = [0] * N
wa_list = [0] * N
#Piは問題番号、answerは正解したかどうか
for i in range(M):
    Pi, answer = input().split()
    number=int(Pi)
    if answer =='AC':
        #正解は一回だけカウントされるので1を入れるだけで良い
        ac_list[number] =1
        #ACの箱に1が入っていなければWAの箱に1を足す、不正解は何回もカウントされる
    else:
        if ac_list[number]!=1:
            wa_list[number] =wa_list[number]+1

wa_num = 0
ac_num = 0
for i in range(N):
    if ac_list[i] == 1:
       ac_num=ac_num+1
       wa_num=wa_list[i]
    
print(ac_num, wa_num)

Submission status: Runtime Error

Solution code:
a,b=(int(x) for x in input().split())
list = []
t_cnt = 0
f_cnt = 0
for i in range(b):
  s = input().split()
  if s[1] == 'AC':
    if not (s[0] in list):
    	list.append(s[0])
        t_cnt += 1
  else:
    if not (s[0] in list):
      f_cnt += 1
print("{} {}".format(t_cnt, f_cnt))

Submission status: Runtime Error

Solution code:
def main():
    n,m = map(int,input().split())
    flag = [False for i in range(n+1)]
    AC = 0
    WA = 0
    for i in range(m):
        input_line = input().split()
        p,s = int(input_line[0]), input_line[1]
        if flag[p] == False:
            if s == "AC":
                AC += 1
                flag[p] = def main():
    n,m = map(int,input().split())
    flag = [False for i in range(n+5)]
    AC = 0
    WA = [0 for i in range(n+5)]
    _WA = 0
    for i in range(m):
        input_line = input().split()
        p,s = int(input_line[0]), input_line[1]
        if flag[p] == False:
            if s == "AC":
                AC += 1
                _WA += WA[p]
                flag[p] = True
            else:
                WA[p] += 1
    print(AC,_WA)
    return


if __name__ == "__main__":
    main()
            else:
                WA += 1
    print(AC,WA)
    return 0


if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

ac = [False] * n
wa = [0] * n
for i in range(m):
    if not ac[ps[i][0]]:
        if ps[i][1] == "WA":
            wa[ps[i][0]] += 1
        elif ps[i][1] == "AC":
            ac[ps[i][0]] = True

print(str(ac.count(True)) + " " + str(sum(wa)))

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
check = [0]*(N+1)
ac = 0
penalty = 0
for i in range(M):
  pi, si = input().split()
  pi = int(pi)
  if check[pi] == -1:
    continue
  if si == 'WA':
    check[pi] += 1
  else:
    ac += 1
    penalty += check[pi]
    check[pi] = -1
print(ac,wa)

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
check = [0]*N
ac = 0
penalty = 0
for i in range(M):
  pi, si = input().split()
  pi = int(pi)
  if check[pi-1] == -1:
    continue
  if si == 'WA':
    check[pi-1] += 1
  else:
    ac += 1
    penalty += check[pi-1]
    check[pi-1] = -1
print(ac,wa)

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
penalty =0
check = [0]*N
ac = 0
wa = 0
for i in range(M):
  pi, si = input().split()
  pi = int(pi)
  if check[pi] == -1:
    continue
  if si = 'WA':
    check[pi] += 1
  else:
    ac += 1
    wa += check[pi]
    check[pi] = -1
print(ac,wa)

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
acf,waf=[0]*n,[0]*n
ac,wa=0,0
for i in range(m):
    x,y=input().split()
    x=int(x)
    if y=='AC':
        if acf[x]==0:
            ac+=1
            wa+=waf[x-1]
            acf[x-1]+=1
    else:
        waf[x-1]+=1
print(ac,wa)

Submission status: Runtime Error

Solution code:
NM = input().split()
N = int(NM[0])
M = int(NM[1])
P = []
S = []
for i in range(M):
  PS = input().split()
  P.append(int(PS[0]))
  S.append(PS[1])

ac = 0
wa = 0
pr = [0]*N
for p, s in zip(P,S):
  if pr[p] == 0:
    if s == 'AC':
      pr[p] = 1
      ac += 1
    elif s == 'WA':
      wa += 1

print(ac, wa)

Submission status: Runtime Error

Solution code:

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

AC = 0
WA = 0


was = [0]*(N+1)
acs = [0]*(N+1)

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

	if s = "AC":
		if acs[p] == 0:
			AC += 1
			WA += was[p]
			acs[p] = 1
	else:
		was[p] += 1

print(AC,WA)

Submission status: Runtime Error

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

count = 0
sset = set()

for i in range(n):
  qn,res = input().split()
  if res == "AC":
    sset.add(qn)
  else:
    if qn not in a:
      count+=1
      
print("{} {}".format(len(sset),count))

Submission status: Runtime Error

Solution code:
import sys
n,m = map(int,input().split())
li=[]
cnt_ac = 0
cnt_pn = 0
for i in range(m):
    p,s = input().split()
    li.append([int(p),s])
if m==0:
    print(cnt_pn,cnt_ac)
    sys.exit()
else:
    f = li[0][0]
    g = li[-1][0]+1
    j = 0
    while f != g:
        if li[j][1] != "AC":
            cnt_ac+=1
        else:
            f+=1
            cnt_pn+=1
        j+=1
    print(cnt_pn,cnt_ac)

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
l=list(input().split() for _ in range(m))
l=sorted(l,key=lambda x:x[0])
ll=[l[i][0] for i in range(m)]
import itertools
for (k,g) in itertools.groupby(l,key=lambda x:x[0]):
    lll.append(list(g))
a=0
w=0
for i in range(len(lll)):
    for j in lll[i]:
        if j[1]=="WA":
            w+=1
        elif j[1]=="AC":
            a+=1
            break
print(a,w)

Submission status: Runtime Error

Solution code:
from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
from heapq import *
from fractions import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 1000001
MOD = 10**9+7
spf = [i for i in range(MAXN)]
spf[0]=spf[1] = -1
def sieve():
    for i in range(2,MAXN,2):
        spf[i] = 2
    for i in range(3,int(MAXN**0.5)+1):
        if spf[i]==i:
            for j in range(i*i,MAXN,i):
                if spf[j]==j:
                    spf[j]=i
def fib(n,m):
    if n == 0:
        return [0, 1]
    else:
        a, b = fib(n // 2)
        c = ((a%m) * ((b%m) * 2 - (a%m)))%m
        d = ((a%m) * (a%m))%m + ((b)%m * (b)%m)%m
        if n % 2 == 0:
            return [c, d]
        else:
            return [d, c + d]

def charIN(x= ' '):
    return(sys.stdin.readline().strip().split(x))

def arrIN(x = ' '):
    return list(map(int,sys.stdin.readline().strip().split(x)))

def ncr(n,r):
    num=den=1
    for i in range(r):
        num = (num*(n-i))%MOD
        den = (den*(i+1))%MOD

    return (num*(pow(den,MOD-2,MOD)))%MOD

def flush():
    return sys.stdout.flush()

'''*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*'''
n,m = arrIN()

d = defaultdict(list)

for i in range(m):
    a,b = input().split()
    d[int(a)].append(b)
ca = pe = 0
for i in range(1,n+1):
    if "AC" in d[i]:
        ca+=1
        pe+=d[i].index("AC")
print(ca,de)

Submission status: Runtime Error

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

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

a = 0
b = 0
for i in range(N):
   if ac[i]:
      a += 1
      b += wa[i]
      print(*[a, b])

Submission status: Runtime Error

Solution code:
from sys import stdin
n,m = map(int, stdin.readline().rstrip().split())

count = 0
penalty = 0
qb = [0]*n
was = [0]*n

for i in range(m):
    p,s = map(str,stdin.readline().rstrip().split())
    p = int(p)
    if s == "AC" and qb[p-1] != "AC":
        qb[p-1] = "AC"
        pentalty += was[p-1]
        count += 1
    elif s == "WA":
        was[p-1] += 1
    else:
        pass

print(count, penalty)

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
lip,lis=[],[]
old=0
ansa=0
wa=0
for i in range(1,m):
    p,s=input().split()
    lip.append(p)
    lis.append(s)
    if len(lip)==1:
        if s=="AC": #1問目がACの時
            ansa+=1
            old=lip[0]
        else:
            wa+=1
    elif old!=p:
        if s=="AC":#その問題で初めてのAC
            ansa+=1
            old=p #最後のACの問題番号 = old
            ansb=wa #その問題のペナが反映
        else:
            wa+=1
    else:
        wa=0
print(ansa,ansb)

Submission status: Runtime Error

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

a = [0]*N

ac = 0
wa = 0

for i in range(M):
  if a[P[i]-1] == 0:
    if S[i] == "AC":
      ac += 1
      a[P[i]-1] = 1
    else:
      wa += 1
print(ac + " " + wa)

Submission status: Runtime Error

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

count_ac = 0
count_wa = 0
a = set()

for i in range(M):
    if S[i] == 'AC' and p[i] not in a:
        a.add(p[i])
        count_ac += 1
    if S[i] == 'WA' and p[i] not in a:
        for i in range(M):
            if s[i] == 'AC':
                count_wa += 1

print(count_ac, count_wa)

Submission status: Runtime Error

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

count_ac = 0
count_wa = 0
a = set()

for i in range(M):
    if S[i] == 'AC' and p[i] not in a:
        a.add(p[i])
        count_ac += 1
    if S[i] == 'WA' and p[i] not in a:
        for i in range(M):
            s[i] == 'AC'
            count_wa += 1

print(count_ac, count_wa)

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
a = [input().split() for i in rabge(m)]
p = [int(i[0]) for i in a]
q = [j[1] for j in a]

ac = 0
wa = 0
wa_c = [0]*n
ac_c = [False]*n

for t in range(m):
    if ac_c[p[t]-1]:
        continue
    if q[t] == "AC":
        ac += 1
        ac_c[p[t]-1] = True
        wa += wa_c[p[t]-1]
    else:
        wa_c[p[t]-1] += 1
print(ac,wa)

Submission status: Runtime Error

Solution code:
n , m = map(int,input().split())
AC,WA = 0,0
was = [0]*(n+1)
acs = [0]*(n+1)
for i in range(m):
    a, b = input().split()
    if b == 'AC':
        if was[a] == 0:
            AC += 1
            WA +=was[a]
            acs [a]=1
    else:
        was[a] +=1
print(AC,WA)

Submission status: Runtime Error

Solution code:
import numpy as np
n,p = map(int,input().split())
ac = np.array([0]*n)
wa = np.array([0]*n)

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

if sum(ac) == 0:
    print(0,0)
else:
    print(sum(ac),sum(wa))

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
     
seikai = 0
miss = 0
     
seikai_list = []  ##既に正解した問題番号のリスト
input_list = [[0 for i in range(2)] for j in range(M)]  ##入力のリスト 問題番号と正誤
     
for i in range(M):
   tmp = input().split()
   input_list[i][0] = tmp[0]
   input_list[i][1] = tmp[1]
     
a = False
     
for i in range(M):
  if input_list[i][1] =='AC':
     if (input_list[i][0] in seikai_list) == False:   ##正解リストの中に無ければ
        seikai += 1
            
      for k in range(i):
         if input_list[k][0] == input_list[i][0]:
            if input_list[k][1] == 'WA':
               miss += 1
                    
      seikai_list.append(input_list[i][0])
                
print("{} {}".format(seikai, miss))

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split(" "))
question_list = []
res_list = []
ac_list = []
for i in range(m):
    a,b = input().split(" ")
    a = int(a)
    question_list.append(a)
    res_list.append(b)
correct = 0
mistake = 0




for i,j in enumerate(res_list):
    if i == 0:
        if j == "WA":
            mistake += 1
        else:
            correct += 1
            ac_list.append(question_list[i])
            
    elif question_list[i] not in ac_list:      
    	if j == "WA":
      		mistake += 1
     	else:
      		correct += 1
        	ac_list.append(question_list[i])
                
            
    if len(ac_list) == n:
        break
            
for i,j in enumerate(res_list):
    if question_list[i] not in ac_list:
        mistake -= 1
        
      
print(correct,mistake)

Submission status: Runtime Error

Solution code:
    N, M = map(int, input().split())
     
    seikai = 0
    miss = 0
     
    seikai_list = []  ##既に正解した問題番号のリスト
    input_list = [[0 for i in range(2)] for j in range(M)]  ##入力のリスト 問題番号と正誤
     
    for i in range(M):
      tmp = input().split()
      input_list[i][0] = tmp[0]
      input_list[i][1] = tmp[1]
     
    a = False
     
    for i in range(M):
      if input_list[i][1] =='AC':
          if (input_list[i][0] in seikai_list) == False:   ##正解リストの中に無ければ
            seikai += 1
            
            for k in range(i):
              if input_list[k][0] == input_list[i][0]:
                if input_list[k][1] == 'WA':
                  miss += 1
                    
            seikai_list.append(input_list[i][0])
                
    print("{} {}".format(seikai, miss))

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
a = [0] * M
b = [0] * M
for i in range(M):
    a[i],b[i]= map(str, input().split())
s1=list()
s2=list()
p=0
w=0
for i in range(M) :
    if a[i] not in s2 and (b[i]=="WA"):
        s1 += a[i] 
    if a[i] not in s2 and (b[i]=="AC"):
        print(s2)
        p += 1 
        s2.append(a[i])
        w += int(s1.count(a[i]))
print(min(N,p),w)

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
A = [input().split() for i in range(M)]
s1=list()
s2=list()
p=0
w=0
for i in range(M):
    if A[i][0] not in s2 and A[i][1]=="WA":
        s1 +=A[i][0]
        print(s1)
    if A[i][0] not in s2 and A[i][1]=="AC":
        p+=1 
        s2 +=A[i][0]
        w += int(s1.count(A[i][0]))
        print(s1,s2)
print(p,w)

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
A=[] #appendのために宣言が必要
while True:
    try:
        A.append(list(map(int,input().split())))

    except:
        break;
s1=list()#ACがまだでWAの数
s2=list()#ACした問題
p=0
w=0
for i in range(M):
    if A[i][1]=="WA":
        s1.append(A[i][0])

    if A[i][0] not in s2 and A[i][1]=="AC":
        p+=1
        s2.append(A[i][0])
        w+=int(s1.count(A[i][0])

print(p,w)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

n, m = map(int, input().split())
p = ["" for _ in range(m)]
s = ["" for _ in range(m)]
for i in range(m):
    tmp = input().split()
    p[i] = int(tmp[0])
    s[i] = tmp[1]

isACed = [0 for _ in range(m)]

n_correct = 0
n_penalty = 0

for i in range(m):
    if isACed[p[i]-1] != 1:
        if s[i] == "AC":
            n_correct += 1

            #正解ラベルを付ける
            isACed[p[i]-1] = 1
        else: #"WA"の時
            n_penalty += 1
print(n_correct, n_penalty)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import logging
logging.basicConfig(level = logging.DEBUG,
                    format = " %(levelname)s - %(message)s")
logging.disable()

n, m = map(int, input().split())
p = ["" for _ in range(m)]
s = ["" for _ in range(m)]
for i in range(m):
    tmp = input().split()
    p[i] = int(tmp[0])
    s[i] = tmp[1]

isACed = [0 for _ in range(m)]

logging.debug("p: {}".format(p))
logging.debug("s: {}".format(s))
logging.debug("isACed: {}".format(isACed))

n_correct = 0
n_penalty = 0

for i in range(m):
    logging.debug("range({})開始".format(i))
    if isACed[p[i]-1] != 1:
        logging.debug("isACed[{}] != 1".format(p[i]-1))
        if s[i] == "AC":
            n_correct += 1

            #正解ラベルを付ける
            isACed[p[i]-1] = 1
        else: #"WA"の時
            n_penalty += 1
print(n_correct, n_penalty)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import logging
logging.basicConfig(level = logging.DEBUG,
                    format = " %(levelname)s - %(message)s")
logging.disable()

n, m = map(int, input().split())
p = ["" for _ in range(m)]
s = ["" for _ in range(m)]
for i in range(m):
    tmp = input().split()
    p[i] = int(tmp[0])
    s[i] = tmp[1]

isACed = [0 for _ in range(n)]

logging.debug("p: {}".format(p))
logging.debug("s: {}".format(s))
logging.debug("isACed: {}".format(isACed))

n_correct = 0
n_penalty = 0

for i in range(m):
    logging.debug("range({})開始".format(i))
    if isACed[p[i]-1] != 1:
        logging.debug("isACed[{}] != 1".format(p[i]-1))
        if s[i] == "AC":
            n_correct += 1

            #正解ラベルを付ける
            isACed[p[i]-1] = 1
        else: #"WA"の時
            n_penalty += 1
print(n_correct, n_penalty)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

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

AC = [False for _ in range(N)]
WA = [0 for _ in range(N)]

for _ in range(M):
    p,s = input().split()
    p = int(p)
    if AC[p]:
        continue
    if s=='AC':
        AC[p] = True
    else:
        WA[p] += 1

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

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
WAC = [0 for i in range(M)]
TF = {}
for i in range(M):
    p, S = input().split()
    p = int(p)
    if p in TF.keys():
        if S == 'AC':
            TF[p] = True
    else:
        if S == 'AC':
            TF[p] = True
        else:
            TF[p] = False
    if  TF[p] == False and S == 'WA':
        WAC[p-1] += 1
count = 0
for k in TF:
    if TF[k]:
        count += 1
print(count, sum(WAC))

Submission status: Runtime Error

Solution code:
import numpy as np
def LI():
  return [int(s) for s in input().split()]

N,M = LI()

correct_answers = np.zeros(N,dtype = 'int')
warnings = np.zeros(N,dtype = 'int')
warning_count = 0

for i in range(M):
  p_num, answer = [s for s in input().split()]
  p_num = int(p_num)
  include_answers = True if correct_answers[p_num-1] == 1 else False
  
  if not include_answers:
  	if answer == 'AC':
    	correct_answers[p_num-1] = 1
      warning_count += warnings[p_num-1]
  else answer == 'WA':
    warning_count+=1
    
print(sum(correct_answers) ,warning_count)

Submission status: Runtime Error

Solution code:

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

#print(N,M)

num=[]
answer=[]
correct=[False] * N
correctCount = 0
wrongCount = 0
wrong=[0] * N
for k in range(M):
    n,a=input().split()
    num.append(int(n))
    answer.append(a)
    if a == "AC":
        if correct[int(n)] == False:
            correct[int(n)] = True
            correctCount += 1
            wrongCount += wrong[int(n)]
    else:
        if correct[int(n)] == False:
            wrong[int(n)] += 1



    
#print(num)
#print(answer)
    
'''
preCorrect = False
correctCount=0
wrongCount = 0
temp_wrongCount = 0


for i in range(M):
    if i > 0 and num[i] != num[i-1]:
        if preCorrect == True:
            preCorrect = False
            temp_wrongCount = 0
        else:
            temp_wrongCount = 0
    
    
    if preCorrect == True:
        continue

    if answer[i] == "AC":
        correctCount += 1
        preCorrect = True
        wrongCount += temp_wrongCount
    if answer[i] == "WA":
        temp_wrongCount += 1
'''
print(correctCount, wrongCount)