Problem:


Score : 300 points

Problem Statement

Takahashi participated in a contest on AtCoder.

The contest had N problems.

Takahashi made M submissions during the contest.

The i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).

The number of Takahashi's correct answers is the number of problems on which he received an AC once or more.

The number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.

Find the numbers of Takahashi's correct answers and penalties.

Constraints

N, M, and p_i are integers.

1 \leq N \leq 10^5

0 \leq M \leq 10^5

1 \leq p_i \leq N

S_i is AC or WA.

Input

Input is given from Standard Input in the following format:

N M
p_1 S_1
:
p_M S_M

Output

Print the number of Takahashi's correct answers and the number of Takahashi's penalties.

Sample Input 1

2 5
1 WA
1 AC
2 WA
2 AC
2 WA

Sample Output 1

2 2

In his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.

In his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.

Thus, he has two correct answers and two penalties.

Sample Input 2

100000 3
7777 AC
7777 AC
7777 AC

Sample Output 2

1 0

Note that it is pointless to get an AC more than once on the same problem.

Sample Input 3

6 0

Sample Output 3

0 0



Sample input:
2 5
1 WA
1 AC
2 WA
2 AC
2 WA


Sample output:
2 2

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
p = []
s = []
for _ in range(M):
    p_i, s_i = list(input().split())
    p += [int(p_i)]
    s += [s_i]

passed_problem = set()
penalty = 0
for i, p_i in enumerate(p):
    if s[i] == 'WA':
        if not p[i] in passed_problem:
            penalty += 1
    elif s[i] == 'AC':
        passed_problem.add(p[i])

print("{} {}".format(len(passed_problem), penalty))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
n,m=map(int,input().split())
p=[]
s=[]
r=np.zeros(n)
w=np.zeros(n)
for i in range(m):
	li=list(input().split())
	p.append(int(li[0]))
	s.append(str(li[1]))
#print(p)
#print(s)

for i in range(m):
	if s[i]=='AC':
		r[p[i]-1]=1
	if s[i]=='WA' and r[p[i]-1]!=1:
		w[p[i]-1]+=1
	
print(int(sum(r)),int(sum(w)))

Submission status: Wrong Answer

Solution code:
import numpy as np
n,m=map(int,input().split())
p=[]
s=[]
r=np.zeros(n)
w=np.zeros(n)
for i in range(m):
	li=list(input().split())
	p.append(int(li[0]))
	s.append(str(li[1]))
print(p)
print(s)

for i in range(m):
	if s[i]=='AC':
		r[p[i]-1]=1
	if s[i]=='WA' and r[p[i]-1]!=1:
		w[p[i]-1]+=1
	
print(int(sum(r)),int(sum(w)))

Submission status: Wrong Answer

Solution code:
# import sys
# sys.setrecursionlimit(10 ** 6)
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(N, M, pSs):
    result = [0] * (N + 1)
    penalty = 0
    for p, S in pSs:
        if S == 'AC':
            result[p] = 1
        else:
            if result[p] == 0:
                penalty += 1
    print(sum(result), penalty)


if __name__ == '__main__':
    N, M = map(int, input().split())
    pSs = []
    for _ in range(M):
        x = input().split()
        x[0] = int(x[0])
        pSs.append(x)
    solve(N, M, pSs)

Submission status: Wrong Answer

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

if int(M)==0:
    print(0,0)
    exit()
else:
    pass

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
print(sum(L1),sum(L2))

Submission status: Wrong Answer

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
print(sum(L1),sum(L2))

Submission status: Wrong Answer

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

arr = []
for i in range(m):
    c = input().split()
    arr.append([(int)(c[0]), c[1]])
#print("{}".format(arr))

penalty_log = {}    # まだACでないWAはここに溜める
success_log = []    # 一度でも成功したACはここに溜める

for elem in arr:
    if elem[1] == 'WA':
        if elem[0] not in success_log:
            if elem[0] not in penalty_log:
                penalty_log[elem[0]] = 1
            else:
                penalty_log[elem[0]] += 1

    elif elem[1] == 'AC':
        if elem[0] not in success_log:
            success_log.append(elem[0])

#print("success_log = {}".format(success_log))
#print("penalty_log = {}".format(penalty_log))

success = len(success_log) # ACの個数
penalty = 0 # WAの個数
for p in penalty_log.values():
    penalty += p
print("{} {}".format(success, penalty))

Submission status: Wrong Answer

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

for _ in range(M):
    number,ans=input().split()
    number=int(number)
    if ans=='AC':
        ac[number]=1
    elif ac[number]==0:
        wa[number]+=1

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
correct = [False] * n
correct_count = 0
wrong_count = 0

for i in range(m):
    p, s = input().split()
    if correct[int(p) - 1]:
        continue

    if s == 'AC':
        correct[int(p) - 1] = True
        correct_count += 1
    else:
        wrong_count += 1
print(correct_count, wrong_count)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
p=[list(input().split()) for _ in range(m)]
a=[]
ac=wa=0
f=True

for pr in p:
	if pr[0] not in a:
		if pr[1]=='WA':
			wa+=1
		else:
			ac+=1
			a.append(pr[0])
print(ac, wa)

Submission status: Wrong Answer

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

arr = []
for i in range(m):
    c = input().split()
    arr.append([(int)(c[0]), c[1]])
#print("{}".format(arr))

success = 0
penalty = 0
success_log = []
for elem in arr:
    if success_log.count(elem[0]) <= 0:
        if elem[1] == 'WA':
            penalty += 1
        elif elem[1] == 'AC':
            success += 1
            success_log.append(elem[0])

print("{} {}".format(success, penalty))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
p=[list(input().split()) for _ in range(m)]
a=[]
ac=wa=0
f=True

for pr in p:
	if pr[0] not in a:
		f=True
		if f:
			if pr[1]=='WA':
				wa+=1
			else:
				ac+=1
				a.append(pr[0])
				f=False
print(ac, wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
p=[list(input().split()) for _ in range(m)]
p=sorted(p)
a=0
ac=wa=0
f=True

for pr in p:
	if int(pr[0])!=a:
		f=True
		if f:
			if pr[1]=='WA':
				wa+=1
				a=int(pr[0])
			else:
				ac+=1
				a=int(pr[0])
				f=False
	else:
		if f:
			if pr[1]=='WA':
				wa+=1
				a=int(pr[0])
			else:
				ac+=1
				a=int(pr[0])
				f=False
print(ac, wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
p=[list(input().split()) for _ in range(m)]
a=0
ac=wa=0
f=True

for pr in p:
	if int(pr[0])!=a:
		f=True
		if f:
			if pr[1]=='WA':
				wa+=1
				a=int(pr[0])
			else:
				ac+=1
				a=int(pr[0])
				f=False
	else:
		if f:
			if pr[1]=='WA':
				wa+=1
				a=int(pr[0])
			else:
				ac+=1
				a=int(pr[0])
				f=False
print(ac, wa)

Submission status: Wrong Answer

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

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

for i in range(m):
  p, s = 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))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac = set()
pn = 0
for i in range(m):
  p, s = map(str, input().split())
  if s == 'AC':
    ac.add(p)
  if p not in ac and s == 'WA':
    pn += 1

print(len(list(ac)), pn)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
# 正答数, ペナルティー数
q_list = [False] * n
p_count = 0
for _ in range(m):
    q_num, j = map(str, input().split())
    q_num = int(q_num)
    q_num -= 1
    if q_list[q_num] == False:
        if j == "WA":
            p_count += 1
        else:
            q_list[q_num] = True

print(q_list.count(True), p_count)

Submission status: Wrong Answer

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

for a in p:
  e=int(a[0])-1
  if a[1]=="WA":
    q[e]+=1
  else:
    r[e]=q[e]+1
c=0
d=0
for b in r:
  if b>0:
    c+=1
    d+=b-1
print(c,d)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=[0]*n
LAC=0
PEN=[]
pena=0
for i in range(m):
  p,s=input().split()
  p=int(p)
  if s=="AC":
    if ac[p-1]==0:
      ac[p-1]=1
      LAC=i
  else:
    if ac[p-1]==0:
      pena+=1
  PEN.append(pena)
if m==0:
  print("0 0")
else:
  print("{} {}".format(ac.count(1),PEN[LAC]))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=[0]*n
LAC=0
PEN=[]
pena=0
for i in range(m):
  p,s=input().split()
  p=int(p)
  if s=="AC":
    if ac[p-1]==0:
      ac[p-1]=1
      LAC=i
  else:
    if ac[p-1]==0:
      pena+=1
  PEN.append(pena)
print(PEN)
print(ac)
if m==0:
  print("0 0")
else:
  print("{} {}".format(ac.count(1),PEN[LAC]))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=[0]*n
LAC=0
PEN=[]
pena=0
for i in range(m):
  p,s=input().split()
  p=int(p)
  if s=="AC":
    ac[p-1]=1
    LAC=i
  else:
    if ac[p-1]==0:
      pena+=1
  PEN.append(pena)
if m==0:
  print("0 0")
else:
  print("{} {}".format(ac.count(1),PEN[LAC]))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=[0]*n
LAC=0
PEN=[]
pena=0
for i in range(m):
  p,s=input().split()
  p=int(p)
  if s=="AC":
    ac[p-1]=1
    LAC=i
  else:
    pena+=1
  PEN.append(pena)
if m==0:
  print("0 0")
else:
  print("{} {}".format(ac.count(1),PEN[LAC]))

Submission status: Wrong Answer

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

ac, wc = [0]*N, [0]*N

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

Submission status: Wrong Answer

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

ac, wc = [0]*N, [0]*N

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

Submission status: Wrong Answer

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

ac, wc = [0]*N, [0]*N

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

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
 
p = [0]*(M+1)
s = [0]*(M+1)
 
for i in range(1,M+1):
  p[i],s[i] = input().split()
p = list(map(lambda pi:int(pi),p))
 
wa=0
ac = 0
m=0
for i in range(1,N+1):
	if not i in p:
		continue
	m += 1
	if p[m]==i:
		if s[m]=='AC':
			ac += 1
			continue
		elif s[m] == 'WA':
			wa += 1
	if m == N:
		break    
if N==wa:
  wa = 0
print(str(ac)+' '+str(wa))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
 
p = [0]*(M+1)
s = [0]*(M+1)
 
for i in range(1,M+1):
  p[i],s[i] = input().split()
p = list(map(lambda pi:int(pi),p))
 
wa=0
ac = 0
m=0
for i in range(1,N+1):
	if not i in p:
		continue
	m += 1
	if p[m]==i:
		if s[m]=='AC':
			ac += 1
			break
		elif s[m] == 'WA':
			wa += 1
	if m == N:
		break    
if N==wa:
  wa = 0
print(str(ac)+' '+str(wa))

Submission status: Wrong Answer

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

p = [0]*(M+1)
s = [0]*(M+1)

for i in range(1,M+1):
  p[i],s[i] = input().split()
p = list(map(lambda pi:int(pi),p))

wa = 0
ac = 0
for i in range(1,N+1):
  for m in range(1,M+1):
    if p[m]==i:
      if s[m]=='AC':
      	ac += 1
      	break
      elif s[m] == 'WA':
      	wa += 1
        
print(str(ac)+' '+str(wa))

Submission status: Wrong Answer

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

res = [0, 0]
stat = ['WA' for i in range(n)]
for i in range(m):
    if ps[i][1] == 'AC':
        if stat[int(ps[i][0]) - 1] == 'WA':
            res[0] += 1
            stat[int(ps[i][0]) - 1] = 'AC'
    if ps[i][1] == 'WA':
        if stat[int(ps[i][0]) - 1] == 'WA':
            res[1] += 1
print('{} {}'.format(res[0], res[1]))

Submission status: Wrong Answer

Solution code:

N,M = map(int,input().split())
PS =[""]*N
PENALTY = 0
AC = 0
for m in range(M):
    p,s = map(str,input().split())
    p=int(p)-1
    if PS[p]!="AC" and s=="WA":
        PENALTY+=1
    elif PS[p]!="AC" and s=="AC":
        AC+=1
        PS[p]="AC"
print(AC,PENALTY)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
S = []
A = [0] * (N + 1)
for i in range(0, M):
  a = input().split()
  S.append(a)
  
ac = 0
wa = 0
for a in S:
  s = int(a[0])
  p = a[1]
  if p == 'WA':
    if A[s] == 0:
      wa += 1
  else:
    if A[s] == 0:
      A[s] = 1
      ac += 1
      
print(*[ac, wa], sep = ' ')

Submission status: Wrong Answer

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

done = [0]*n
AC_cnt = 0
WA_cnt = 0
for _ in range(m):
  p, s = input().split()
  p = int(p)-1
  if done[p] == 1:
    continue
  else:
    if s=='AC':
      done[p] = 1
      AC_cnt += 1
    elif s=='WA':
      WA_cnt += 1

print(AC_cnt, WA_cnt)

Submission status: Wrong Answer

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

done = [0]*n
AC_cnt = 0
WA_cnt = 0
for _ in range(m):
  p, s = input().split()
  p = int(p)-1
  if done[p]:
    continue
  else:
    if s=='AC':
      done[p]=1
      AC_cnt += 1
    else:
      WA_cnt += 1

print(AC_cnt, WA_cnt)

Submission status: Wrong Answer

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

A = [0 for _ in range(N)]

for _ in range(M):
    p, s = input().split()
    if s == "AC":
        if not A[int(p)-1]:
            ac += 1
            A[int(p)-1] = 1
    else:
        if not A[int(p)-1]:
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

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

def main():
    n, m = map(int, input().split())
    penalty = dict()
    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
    print(len(ans), sum(penalty.values()))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
a = [-1 for _ in range(n+1)]
countWa = 0
for i in range(m):
  ps,s = input().split()
  pi = int(ps)
  if(a[pi-1] == 1):
    continue
  elif(s == 'WA'):
    countWa += 1
  elif(s == 'AC'):
    a[pi-1] = 1
print(a.count(1),countWa)

Submission status: Wrong Answer

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

if m == "0":
    print("0", "0")

p=[list(map(str,list(input().split()))) for i in range(int(m))]

acs = []
correctans = 0
penaluties = 0
for i in p:
    if i[1] == "AC" and i[0] not in acs:
        correctans += 1
        acs.append(i[0])
    elif i[1] == "WA" and i[0] not in acs:
        penaluties += 1
print(correctans, penaluties)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
a = [-1 for _ in range(n)]
countWa = 0
for i in range(m):
  ps,s = input().split()
  pi = int(ps)
  if(a[pi-1] == 1):
    continue
  elif(s == 'WA'):
    countWa += 1
  elif(s == 'AC'):
    a[pi-1] = 1
print(a.count(1),countWa)

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
Pn = [0] * N
Wrong = 0
Accept = 0
for i in range(M):
    p, S = map(str, input().split())
    p = int(p)
    if S == "WA" and Pn[p-1] <= 1:
        Pn[p-1] = 1
        Wrong += 1
    elif S=="AC" and Pn[p-1] <= 1:
        Pn[p-1] = 2
        Accept += 1
print(Accept, Wrong)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
ok = 0
ng = 0
Q = [False]*N
for _ in range(M):
    p,s = map(str,input().split())
    if Q[int(p)-1]==False and s == "AC":
        ok += 1
        Q[int(p)-1]= True
    elif Q[int(p)-1]==False and s == "WA":
        ng += 1
print(ok,ng)

Submission status: Wrong Answer

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

ac = [False] * n
res_ac = 0
res_wa = 0
for _ in range(m):
    p, s = input().split()
    p = int(p)

    if s == "AC":
        if not ac[p-1]:
            ac[p-1] = True
            res_ac += 1
    else:
        if not ac[p-1]:
            res_wa += 1

print(res_ac, res_wa)

Submission status: Wrong Answer

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

a = []
pnt = {}
ac = {}
for i in range(M):
	p,s = input().split()
	p = int(p)
	if not p in pnt:
		pnt[p] = 0
		ac[p] = 0

	if s == "WA" and ac[p] == 0:
		pnt[p] += 1
	elif s == "AC" and ac[p] == 0:
		ac[p] += 1

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

Submission status: Wrong Answer

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

a = []
pnt = {}
ac = {}
for i in range(M):
	p,s = input().split()
	p = int(p)
	if not p in a:
		a.append(p)
		pnt[p] = 0
		ac[p] = 0

	if s == "WA" and ac[p] == 0:
		pnt[p] += 1
	elif s == "AC" and ac[p] == 0:
		ac[p] += 1

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

Submission status: Wrong Answer

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 in x:
    continue
  else:
    if t=='AC':
      a+=1
      x.append(s)
    else:
      b+=1
print(a,b)

Submission status: Wrong Answer

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)
  elif t=='WA':
      b+=1
print(a,b)

Submission status: Wrong Answer

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: Wrong Answer

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

ac={}
wa={}

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


erro = 0
for j in wa:
    erro += wa[j]

print(len(ac),erro)

Submission status: Wrong Answer

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 and s == "AC":
    a += 1
    lis[p] = 1
  elif lis[p] != 0 and s == "AC":
    continue
  elif lis[p] < 1 and s == "WA":
    w += 1
  elif lis[p] != 0 and s == "WA":
    continue
    
print(a,w)

Submission status: Wrong Answer

Solution code:
import sys
n,m=map(int,input().split())
submit=[list(map(str,input().split())) for i in range(m)]
wa=0
ac=0
number=[]
for i in range(m):
    number+=[int(submit[i][0])]
number=list(set(number))
if m==0:
    print(0,0)
    sys.exit()
else:
    for j in number:
        for i in range(m):
            if int(submit[i][0])==j:
                if submit[i][1]=="WA":
                    wa+=1
                else:
                    ac+=1
                    break
print(ac,wa)

Submission status: Wrong Answer

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] == 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: Wrong Answer

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] == 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: Wrong Answer

Solution code:
import sys
n,m=map(int,input().split())
submit=[list(map(str,input().split())) for i in range(m)]
wa=0
ac=0
if m==0:
    print(0,0)
    sys.exit()
else:
    number=int(submit[0][0])
    for i in range(m):
        if number==int(submit[i][0]):
            if submit[i][1]=="WA":
                wa+=1
            else:
                ac+=1
                number+=1
    print(ac,wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
apple = []
w = 0
cat = []
for _ in range(m):
    apple.append(list(map(str, input().split())))
r = 0
for i in apple:
    if i[0] not in cat:
        if i[1] != "AC":
            w += 1
        else:
            cat.append(i[0])
            r += 1
    else:
        pass

w = max(w, 0)
print(r, w)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac = 0
wa = 0
ls = [e for e in range(1,n+1)]
for i in range(m):
    a,b = map(str,input().split())
    if int(a) in ls:
        if b == "AC":
            ac += 1
            ls.remove(int(a))
        else:
            wa += 1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
#C
N,M=map(int,input().split())
re=[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":
        x+=1
    elif S=="AC":
        re[p]="AC"
        y+=1
print(y,x)

Submission status: Wrong Answer

Solution code:
N,M = input().split()
l = []
a =0
for i in range(int(M)):
    s = input().split()
    if s[1]=="AC":
        l.append(s[0])
    elif s[1]=="WA":
        if s[0] in l:
            pass
        elif s[0] not in l:
            a +=1

print(len(set(l)),a)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
penalty = 0
ac_list = [False]*N
for i in range(M):
    p, S = input().split()
    if S == 'AC':
        ac_list[int(p)-1]=True
    else:
        if ac_list[int(p)-1]==False:
            penalty +=1
print(sum(ac_list), penalty)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
penalty = 0
ac_list = [False]*N
for i in range(M):
    p, S = input().split()
    if S == 'WA' and ac_list[int(p)-1]==False:
        penalty += 1
    else:
        ac_list[int(p)-1]=True
print(sum(ac_list), penalty)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
penalty = 0
ac_list = [False]*N
for i in range(M):
    p, S = input().split()
    if S == 'WA' and ac_list[int(p)-1]==False:
        penalty += 1
    else:
        ac_list[int(p)-1]=True
ACs = [a for a in ac_list if a]
print(len(ACs), penalty)

Submission status: Wrong Answer

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

ACflg = [0] * N
WAflg = [0] * N

WAcnt = 0
for _ in range(M):
    p, S = list(input().split())
    p = int(p)
    if(S == "AC"):
        if(ACflg[p-1] == 0):
            ACflg[p - 1] = 1
            WAcnt += WAflg[p-1]
    
    else:
        if(ACflg[p - 1] == 0):
            WAflg[p - 1] += 1

#    print(ACflg)
#    print(WAflg)

print(sum(ACflg), sum(WAflg))

Submission status: Wrong Answer

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

ACflg = [0] * N
WAflg = [0] * N

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

#    print(ACflg)
#    print(WAflg)

print(sum(ACflg), sum(WAflg))

Submission status: Wrong Answer

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

ACflg = [0] * N
WAflg = [0] * N

for _ in range(M):
    p, S = list(input().split())
    p = int(p)
    if(S == "AC"):
        ACflg[p - 1] = 1
    
    elif(S == "WA"):
        if(ACflg[p - 1] == 0):
            WAflg[p - 1] += 1

#    print(ACflg)
#    print(WAflg)

print(sum(ACflg), sum(WAflg))

Submission status: Wrong Answer

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

ACflg = [0] * 10 ** 5
WAflg = [0] * 10 ** 5

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

print(sum(ACflg), sum(WAflg))

Submission status: Wrong Answer

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

submit = [input().split() for i in range(M)]
ans = [[0, 0] for i in range(N)]

for i in range(M):
    tmp = int(submit[i][0]) - 1
    if submit[i][1] == 'AC' and ans[tmp][0] == 0:
        ans[tmp][0] += 1
    elif submit[i][1] == 'WA' and ans[tmp][0] == 0:
        ans[tmp][1] += 1

print(sum(ans[i][0] for i in range(N)), sum(ans[i][1] for i in range(N)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

A = []
for i in range(M):
    S = list(input().split())
    A.append(S)

if M == 0:
    print(0, 0)

else:
    A.sort(key = lambda x : x[1])

    tmp = A[0]

    if 'AC' in tmp:
        G = 1
        P = 0
        for i in range(1, M):
            if tmp == A[i]:
                continue
            elif 'AC' in A[i]:
                tmp = A[i]
                G += 1
        for i in range(1, M):
            if 'WA' in A[i] and tmp[0] == A[i][0]:
                P += 1
    else:
        G = 0
        P = 0
    
    print(G, P)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
A=[]
P=[]
wa=0
ac=0
for _ in range(m):
    p,s=input().split()
    P.append(int(p))
    A.append(s)

for j in range(n):
    for i in range(m):
        if P[i]==j and  A[i]=="AC":
            ac+=1
            break
        elif P[i]==j:
            wa+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
A=[]
P=[]
wa=0
ac=0
for i in range(m):
    p,s=input().split()
    P.append(int(p))
    A.append(s)

for j in range(n):
    for i in range(m):
        if P[i]==j and  A[i]=="ac":
            ac+=1
            break
        elif P[i]==j:
            wa+=1
print(ac,wa)

Submission status: Wrong Answer

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

right = [False]*n
penalty = [0]*n

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

print(right.count(True),sum(penalty))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

def main():
    N, M = map(int, input().split())
    # [AC, WA]
    cnt = [[0, 0] for _ in range(N)]
    for _ in range(M):
        num, status = input().split()
        num = int(num) -1
        if status == "AC":
            if cnt[num][0] == 0:
                cnt[num][0] += 1
        if status == "WA":
            if cnt[num][0] == 0:
                cnt[num][1] += 1

    ac_cnt, wa_cnt = 0, 0
    for i in range(N):
        ac_cnt += cnt[i][0]
        wa_cnt += cnt[i][1]

    print(ac_cnt, wa_cnt, sep=" ")

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
num_of_problems, num_of_submittions = map(int, input().split())
submittions = []
for _ in range(num_of_submittions):
    submittions.append(list(input().split()))

WAs = [0] * num_of_problems
ACs = [0] * num_of_problems

for submittion in submittions:
    problem_index = int(submittion[0]) - 1
    result = submittion[1]
    if result == 'WA' and ACs[problem_index] == 0:
        WAs[problem_index] = WAs[problem_index] + 1

    if result == 'AC' and ACs[problem_index] == 0:
        ACs[problem_index] = 1

print(str(ACs.count(1)) + ' ' + str(sum(WAs)))

Submission status: Wrong Answer

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())
ac = [0] * n
wa = [0] * n

for i in range(m):
    p, s = readline().decode().rstrip().split()
    if ac[int(p) - 1] == 0:
        if s == 'AC':
            ac[int(p) - 1] += 1
        else:
            wa[int(p) - 1] += 1

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