Problem:


Score : 300 points

Problem Statement

Takahashi participated in a contest on AtCoder.

The contest had N problems.

Takahashi made M submissions during the contest.

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

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

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

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

Constraints

N, M, and p_i are integers.

1 \leq N \leq 10^5

0 \leq M \leq 10^5

1 \leq p_i \leq N

S_i is AC or WA.

Input

Input is given from Standard Input in the following format:

N M
p_1 S_1
:
p_M S_M

Output

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

Sample Input 1

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

Sample Output 1

2 2

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

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

Thus, he has two correct answers and two penalties.

Sample Input 2

100000 3
7777 AC
7777 AC
7777 AC

Sample Output 2

1 0

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

Sample Input 3

6 0

Sample Output 3

0 0



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


Sample output:
2 2

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
list_num = list([] for i in range(n))
test = [input().split() for i in range(m)]
check = [0] * n
for i in test:
  list_num[int(i[0]) - 1].append(i[1])
count = 0
count_ac = 0
count_wa = 0
check = 0
for i in list_num:
  for j in range(len(i)):
    if(i[j] =='WA'):
      count += 1
    else:
      count_ac += 1
      check = 1
      break
  if(check == 1):
    count_wa += count
    count = 0
    check = 0 

print(count_ac , count_wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
list_num = list([] for i in range(n))
test = [input().split() for i in range(m)]
check = [0] * n
for i in test:
  list_num[int(i[0]) - 1].append(i[1])
count = 0
count_ac = 0
count_wa = 0
check = 0j
for i in list_num:
  for j in range(len(i)):
    if(i[j] =='WA'):
      count += 1
    else:
      count_ac += 1
      check = 1
      break
  if(check == 1):
    count_wa += count
    count = 0
    check = 0 

print(count_ac , count_wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
list_num = list([] for i in range(n))
test = [input().split() for i in range(m)]
check = [0] * n
for i in test:
  list_num[int(i[0]) - 1].append(i[1])
count_ac = 0
count_wa = 0
for i in list_num:
  for j in range(len(i)):
    if(i[j] =='WA'):
      count_wa += 1
    else:
      count_ac += 1
      break

print(count_ac , count_wa)

Submission status: Wrong Answer

Solution code:
import sys
n, m = map(int, sys.stdin.readline().split())
li = [[] for _ in range(n)]
for _ in range(m):
  i, k = map(str, sys.stdin.readline().split())
  k = k.strip()
  i = int(i)
  li[i-1].append(k)
wa = 0
ac = 0
for i in li:
  for k in i:
    if k == 'WA':
      wa += 1
    elif k == 'AC':
      ac += 1
      break
print(ac, wa)

Submission status: Wrong Answer

Solution code:
import sys
n, m = map(int, sys.stdin.readline().split())
li = [[] for _ in range(n)]
for _ in range(m):
  i, k = map(str, sys.stdin.readline().split())
  k = k.strip()
  i = int(i)
  li[i-1].append(k)
wa = 0
ac = 0
for i in li:
  for k in i:
    if k == 'WA':
      wa += 1
    if k == 'AC':
      ac += 1
      break
print(ac, wa)

Submission status: Wrong Answer

Solution code:
import sys
n, m = map(int, sys.stdin.readline().split())
li = [[] for _ in range(n)]
for _ in range(m):
  i, k = map(str, sys.stdin.readline().split())
  i = int(i)
  li[i-1].append(k)
wa = 0
ac = 0
for i in li:
  for k in i:
    if k == 'WA':
      wa += 1
    if k == 'AC':
      ac += 1
      break
print(ac, wa)

Submission status: Wrong Answer

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

x=[True]*n
cnt=[0]*n
y=0

for i in range(m):
    p,s=input().split()
    if s=="AC":
        x[int(p)-1]=False
    elif x[int(p)-1]:
        cnt[int(p)-1]+=1


for i in range(n):
    if x[i]==False:
        y+=1

print(y,sum(cnt))

Submission status: Wrong Answer

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

ac_time = {}
wa_time = {}
acs = 0
for i in range(m):
    p,s = input().split()
    if s == "AC":
        if p not in ac_time:
            acs += 1
            ac_time[p] = i
    else:
        if p in ac_time:
            continue
        else:
            if p in wa_time:
                wa_time[p] += 1
            else:
                wa_time[p] = 1

w = 0
for val in wa_time.values():
    w += val

print(acs,w)

Submission status: Wrong Answer

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

print(ac,wa)

Submission status: Wrong Answer

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

print(ac,wa)

Submission status: Wrong Answer

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

submit_set = {input() for _ in range(M)}

correct_ans_num = 0
penalty = 0
for i in range(1, N + 1):
  results = [result.split()[1] for result in submit_set if int(result.split()[0]) == i]
  
  if not 'AC' in results: continue
  
  correct_ans_num += 1
  penalty += len(results) - 1
  
print('{} {}'.format(correct_ans_num, penalty))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
test = list(map(list, set(map(tuple, [input().split() for i in range(m)]))))
count = 0
for i in test:
  if(i[1] == 'WA'):
    count += 1

print(len(test) - count , count)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
test = list(map(list, set(map(tuple, [input().split() for i in range(m)]))))
count = 0
for i in test:
  if(i[1] == 'WA'):
    count += 1

print(len(test), count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import math

n,m = map(int,input().split())
ps = [input().split() for i in range(m)]
import numpy as np
flag = np.zeros(n,dtype=np.int16)
count = 0
wa = 0
for i in range(m):
  if ps[i][1]=='AC' and flag[int(ps[i][0])-1]==0:
    flag[int(ps[i][0])-1]=1
    count+=1
  elif ps[i][1]=='WA' and flag[int(ps[i][0])-1]==0:
  	wa+=1
  else:
    count=count
    wa=wa
  if count==n:
    print(count,wa)
    sys.exit()
print(np.sum(flag),wa)

Submission status: Wrong Answer

Solution code:
import sys
import math

n,m = map(int,input().split())
ps = [input().split() for i in range(m)]
import numpy as np
flag = np.zeros(n,dtype=np.int16)
count = 0
wa = 0
for i in range(m):
  if ps[i][1]=='AC' and flag[int(ps[i][0])-1]==0:
    flag[int(ps[i][0])-1]=1
    count+=1
  elif ps[i][1]=='WA' and flag[int(ps[i][0])-1]==0:
  	wa+=1
  else:
    count=count
    wa=wa
  if count==n:
    print(count,wa)
    sys.exit()
print(sum(flag),wa)

Submission status: Wrong Answer

Solution code:
import sys
import math

n,m = map(int,input().split())
ps = [input().split() for i in range(m)]
import numpy as np
flag = np.zeros(n,dtype=np.int16)
count = 0
wa = 0
for i in range(m):
  if ps[i][1]=='AC' and flag[int(ps[i][0])-1]==0:
    flag[int(ps[i][0])-1]=1
    count+=1
  elif ps[i][1]=='WA' and flag[int(ps[i][0])-1]==0:
  	wa+=1
    
  if count==n:
    print(count,wa)
    sys.exit()
print(sum(flag),wa)

Submission status: Wrong Answer

Solution code:
import sys
import math

n,m = map(int,input().split())
ps = [input().split() for i in range(m)]
import numpy as np
flag = np.zeros(n,dtype=np.int16)
count = 0
wa = 0
for i in range(m):
  if ps[i][1]=='AC' and flag[int(ps[i][0])-1]==0:
    flag[int(ps[i][0])-1]=1
    count+=1
  elif ps[i][1]=='WA':
  	wa+=1
    
  if count==n:
    print(count,wa)
    sys.exit()
print(sum(flag),wa)

Submission status: Wrong Answer

Solution code:
import sys
import math

n,m = map(int,input().split())
ps = [input().split() for i in range(m)]
import numpy as np
flag = np.zeros(n,dtype=np.int16)
count = 0
wa = 0
for i in range(m):
  if ps[i][1]=='AC' and flag[int(ps[i][0])-1]==0:
    flag[int(ps[i][0])-1]=1
    count+=1
  elif ps[i][1]=='WA':
  	wa+=1
    
  if count==2:
    print(count,wa)
    sys.exit()
print(sum(flag),wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
a=[]
for i in range(m):
	p,s=input().split()
	if p in a:
		continue
	if s=="AC":
		a.append(p)
print(len(a))

Submission status: Wrong Answer

Solution code:
N,M=[int(x) for x in input().rstrip().split()]
ac=0
penalty=0
now_p=0
mae=0
l=[]
for i in range(M):
  p,S=[x for x in input().rstrip().split()]
  if l.count([p,S])==0:
    if S=="AC":
      ac+=1
      penalty+=now_p
      now_p=0
    l.append([p,S])

  if S=="WA":
    now_p+=1

print(ac,penalty)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ac_counter = [0 for _ in range(N)]
wa_counter = [0 for _ in range(N)]
for _ in range(M):
    line = input().split()
    problem = int(line[0])
    result = line[1]
    if not ac_counter[problem-1] == 1:
        if result == 'AC':
            ac_counter[problem-1] = 1
        else:
            wa_counter[problem-1] += 1

answer = []
answer.append(str(sum(ac_counter)))
answer.append(str(sum(wa_counter)))
print(" ".join(answer))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ac_counter = [0 for _ in range(N)]
wa_counter = [0 for _ in range(N)]
for _ in range(M):
    line = input().split()
    problem = int(line[0])
    result = line[1]
    if result == 'AC':
        ac_counter[problem-1] = 1
    else:
        if ac_counter[problem-1] == 0:
            wa_counter[problem-1] += 1

answer = []
answer.append(str(sum(ac_counter)))
answer.append(str(sum(wa_counter)))
print(" ".join(answer))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
a=[[i for i in input().split()] for j in range(m)]
WANum=[0]*(n+1)
EndFlag=[0]*(n+1)
for x in a:
    if x[1]=="WA" and EndFlag[int(x[0])]==0:WANum[int(x[0])]+=1
    if x[1]=="AC":EndFlag[int(x[0])]=1
print(sum(EndFlag),sum(WANum))

Submission status: Wrong Answer

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

# acするまでのwaをそれぞれの問題でカウントする
cnts = [0] * n

# key：acした問題番号、value：waした回数の辞書を作成する
at_dict = {}

for i in range(m):
    question, result = map(str, input().split())
    if result == 'AC':
        # ACした時点で上記で作成した辞書に、key：問題番号、value:wa回数を記入
        at_dict[question] = cnts[int(question)-1]
    elif result == 'WA':
        # WAなら上記のwa回数のリストにカウント
        cnts[int(question)-1] += 1
    
ac = len(at_dict)
wa = sum(v for v in at_dict.values())

print(ac, wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
keep=[]
lis=[]
ac=0
wa=0
for i in range(M):
    ps=input().split()
    keep.append(ps)
for j in range(M):
    if not keep[j][0] in lis and keep[j][1]=="AC":
        ac+=1
        lis.append(keep[j][0])
for j in range(M):
    if keep[j][0] in lis and keep[j][1]=="WA":
        wa+=1
    
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
keep=[]
lis=[]
ac=0
wa=0
for i in range(M):
    ps=input().split()
    keep.append(ps)
for j in range(M):
    if not keep[j][0] in lis:
        if keep[j][1]=="AC":
            ac+=1
            lis.append(keep[j][0])
        else:
            wa+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
keep=[]
lis=[]
ans=0
for i in range(M):
    ps=input().split()
    keep.append(ps)
for j in range(M):
    if keep[j][1]=="AC":
        if not keep[j][0] in lis:
            ans+=1
        else:
            lis.append(keep[j][0])
print(ans)

Submission status: Wrong Answer

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

N, M = map(int, input().split())
AC = set()
WA = 0
WA_cnt = 0

for _ in range(M):
    p, S = input().split()
    if p in AC:
        continue
    if S == "AC":
        AC.add(p)
        WA += WA_cnt
        WA_cnt = 0
    else:
        WA_cnt += 1

print(len(AC), WA)

Submission status: Wrong Answer

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

N, M = map(int, input().split())
AC = []
WA = 0
WA_cnt = 0

for _ in range(M):
    p, S = input().split()
    if p in AC:
        continue
    if S == "AC":
        AC.append(p)
        WA += WA_cnt
        WA_cnt = 0
    else:
        WA_cnt += 1

print(len(AC), WA)

Submission status: Wrong Answer

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

N, M = map(int, input().split())
AC = []
WA_cnt = 0

for _ in range(M):
    p, S = input().split()
    if p in AC:
        continue
    if S == "AC":
        AC.append(p)
    else:
        WA_cnt += 1

print(len(AC), WA_cnt)

Submission status: Wrong Answer

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

N, M = map(int, input().split())
AC = []
WA = []
AC_cnt = 0
WA_cnt = 0
for i in range(M):
    p, S = input().split()
    if p in AC:
        continue
    if S == "WA":
        WA_cnt += 1
    else:
        AC_cnt += 1
        AC.append(p)

print(AC_cnt, WA_cnt)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
PS = [list(map(str,input().split())) for i in range(M)]
A_num = [0]*N
W_num = [0]*N
w=0
#print(PS)
for j in range(M):
    #print(A_num)
    if PS[j][1] == 'WA'and A_num[int(PS[j][0])-1]==0:
        W_num[int(PS[j][0])-1]=1 
    if PS[j][1]== 'AC' and A_num[int(PS[j][0])-1]==0:
        A_num[int(PS[j][0])-1]=1
s = sum(A_num)
for k in range(N):
    if A_num[k] == 0:
        W_num[k]=0
w = sum(W_num)
print(s,w)

Submission status: Wrong Answer

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

N, M = map(int, input().split())
AC = []
WA = []
for i in range(M):
    p, S = input().split()
    if S == "WA" and p not in AC:
        WA.append(p)
    if S == "AC" and p not in AC:
        AC.append(p)

print(len(AC), len(WA))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
PS = [list(map(str,input().split())) for i in range(M)]
A_num = [0]*N
w=0
#print(PS)
for j in range(M):
    #print(A_num)
    if PS[j][1] == 'WA'and A_num[int(PS[j][0])-1]==0:
        w+=1
    if PS[j][1]== 'AC' and A_num[int(PS[j][0])-1]==0:
        A_num[int(PS[j][0])-1] =1
s = sum(A_num)
print(s,w)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
PS = [list(map(str,input().split())) for i in range(M)]
A_num = [0]*N
w=0
print(PS)
for j in range(M):
    print(A_num)
    if PS[j][1] == 'WA'and A_num[int(PS[j][0])-1]==0:
        w+=1
    if PS[j][1]== 'AC' and A_num[int(PS[j][0])-1]==0:
        A_num[int(PS[j][0])-1] =1
s = sum(A_num)
print(s,w)

Submission status: Wrong Answer

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

S=list(dict.fromkeys(s))
for i in range(len(S)):
    S[i]=S[i].split()

x=0
for i in range(len(S)):
    if S[i][1]=="AC":
        x+=1

for i in range(m):
    s[i]=s[i].split()
y=0
a=0
for i in range(len(s)-1,-1,-1):
    if s[i][1]=="AC":
        a=s[i][0]
    if s[i][0]==a and s[i][1]=="WA":
        y+=1

print(x,y)

Submission status: Wrong Answer

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

A=list(dict.fromkeys(s))

for i in range(len(A)):
    A[i]=A[i].split()

x=0
for i in range(len(A)):
    if A[i][1]=="AC":
        x+=1

y=0
for i in range(len(A)-1):
    if A[i][1]=="WA" and A[i][0]==A[i+1][0]:
        y+=1

print(x,y)

Submission status: Wrong Answer

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

aclist = [0] * n
walist = [0] * n

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

Submission status: Wrong Answer

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

A=list(dict.fromkeys(s))

for i in range(len(A)):
    A[i]=A[i].split()

cnt=0
for i in range(len(A)):
    if A[i][1]=="AC":
        cnt+=1

print(cnt,end=" ")

if len(A)-cnt<=0:
    print(0)
else:
    print(len(A)-cnt)

Submission status: Wrong Answer

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

cnt_ac = 0
tmp_wa = 0
cnt_wa = 0

pre_p = ''

for i in range(m):
    p, s = input().split()
    if s == 'WA' and pre_p != p:
        tmp_wa+=1

    if s == 'AC' and pre_p != p:
        pre_p = p
        cnt_ac+=1
        cnt_wa+=tmp_wa
        tmp_wa = 0

print(cnt_ac, cnt_wa)

Submission status: Wrong Answer

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

cnt_ac = 0
cnt_wa = 0

pre_p = ''

for i in range(m):
    p, s = input().split()
    if s == 'WA' and pre_p != p:
        cnt_wa+=1

    if s == 'AC' and pre_p != p:
        pre_p = p
        cnt_ac+=1

print(cnt_ac, cnt_wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
wa = 0
submission = set()
for i in range(m):   
    p, s = input().split()
    if p in submission:
        continue

    if s == "AC":
        submission.add(p)
    else:
        wa += 1
print(len(submission), wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac = 0
wa = 0
submission = []
for i in range(m):   
    p, s = input().split()
    if p not in submission:
        if s == "AC":
            ac += 1
            submission.append(p)
        else:
            wa += 1
print("{} {}".format(ac, wa))

Submission status: Wrong Answer

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

num = 0 
pena = 0

lis2=[0]*n 
sw = [0]*n

for i in range(m): 
    if y[i] == 'WA' and sw[int(x[i])-1]==0: 
        pena += 1 
        
    elif y[i] == 'AC' and sw[int(x[i])-1]==0: 
        lis2[int(x[i])-1] = 1 
        sw[int(x[i])-1] = 1

num = sum(lis2)

print(num,pena)

Submission status: Wrong Answer

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

num = 0 
pena = 0

lis2=[0]*n 
sw = [0]*n

for i in range(m): 
    if y[i] == 'WA' and sw[int(x[i])-1]== 0: 
        pena += 1 
    else: 
        lis2[int(x[i])-1] = 1 
        sw[int(x[i])-1] = 1

num = sum(lis2)

print(num,pena)

Submission status: Wrong Answer

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

num = 0
pena = 0

lis2=[0]*n
sw = [0]*n

for i in range(m):
    if y[i] == 'WA' and sw[int(x[i])-1]== 0:
        pena += 1
    else:
        lis2[int(x[i])-1] = 1
        sw[int(x[i])-1] = 1
        
num = sum(lis2)

print(num,pena)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
pro = []
wasum = 0
ac = 0
wa = 0
for i in range(m):
  p,s = map(str,input().split())
  p = int(p)
  if p not in pro:
    if s == 'WA':
      wa += 1
    else:
      ac += 1
      pro.append(p)
      wasum += wa
      wa = 0
print(ac,wasum)

Submission status: Wrong Answer

Solution code:

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

ac_flg = [0]*N
wa_count = 0
ac_count = 0

for i in range(M):
    p, s = input().split()
    if s == 'WA' and ac_flg[int(p)-1] == 0:
        wa_count += 1

    if s == 'AC' and ac_flg[int(p)-1] == 0:
        ac_count += 1
        ac_flg[int(p)-1] =1

print(ac_count, wa_count)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
pro = []
wa = 0
ac = 0
for i in range(m):
  p,s = map(str,input().split())
  p = int(p)
  if p in pro:
    continue
  else:
    if s == 'WA':
      wa += 1
    else:
      ac += 1
      pro.append(p)
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p, s = [], []
pslist = []
for i in range(m):
  row = list(input().split( ))
  pslist.append(row)
aclist = [0] * n
walist = [0] * n
for j, k in pslist:
  j = int(j)
  if k == 'AC':
    if aclist[j - 1] == 0:
      aclist[j - 1] = 1
  if k == 'WA':
    if aclist[j - 1] == 0:
      walist[j - 1] += 1

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC_counter = 0
Error_counter = 0
finish_list = set()
for i in range(M):
  if AC_counter < N:
    pS = input().split()
    if pS[0] not in finish_list:
      if 'AC' == pS[1]:
        AC_counter += 1
        finish_list.add(pS[0])
      else:
        Error_counter += 1
print(AC_counter,Error_counter)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC_counter = 0
Error_counter = 0
finish_list = []
for i in range(M):
  if AC_counter < N:
    pS = input().split()
    if pS[0] not in finish_list:
      if 'AC' == pS[1]:
        AC_counter += 1
        finish_list.append(pS[0])
      else:
        Error_counter += 1
print(AC_counter,Error_counter)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC_counter = 0
Error_counter = 0
finish_list = []
for i in range(M):
  if AC_counter < N:
    pS = input().split()
    if pS[0] not in finish_list:
      if 'AC' == pS[1]:
        AC_counter += 1
        finish_list.append(pS[0])
      else:
        Error_counter += 1
  else:
    break
print(AC_counter,Error_counter)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC_counter = 0
Error_counter = 0
finish_list = []
for i in range(M):
  pS = input().split()
  if pS[0] not in finish_list:
    if 'AC' == pS[1]:
      AC_counter += 1
      finish_list.append(pS[0])
    else:
      Error_counter += 1
print(AC_counter,Error_counter)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC_counter = 0
Error_counter = 0
finish_list = []
for i in range(M):
  pS = input().split()
  if 'AC' == pS[1]:
    if pS[0] not in finish_list:
      AC_counter += 1
      finish_list.append(pS[0])
  elif 'WA' == pS[1]:
    if pS[0] not in finish_list:
      Error_counter += 1
print(AC_counter,Error_counter)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
pS = [list(input().split()) for _ in range(M)]
AC_counter = 0
Error_counter = 0
finish_list = []
for i in range(M):
  if 'AC' == pS[i][1]:
    if pS[i][0] not in finish_list:
      AC_counter += 1
      finish_list.append(pS[i][0])
  elif 'WA' == pS[i][1]:
    if pS[i][0] not in finish_list:
      Error_counter += 1
print(AC_counter,Error_counter)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
pS = [list(input().split()) for _ in range(M)]
AC_counter = 0
Error_counter = 0
for i in range(M):
  if 'AC' == pS[i][1]:
    AC_counter += 1
  elif 'WA' == pS[i][1]:
    if int(pS[i][0]) > AC_counter:
      Error_counter += 1
print(AC_counter,Error_counter)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
mistake = [0] * (n + 1)
done = [False] * (n + 1)
miss = 0
for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'WA':
        if done[p] == False:
            mistake[p] += 1
    else:
        done[p] = True
        miss += mistake[p]
print(sum(done), miss)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
penalty = 0
acc = 0
ac_flag = [False for i in range(n)]

for i in range(m):
    p, s = input().split()
    q_num = int(p) - 1
    # WA
    if s == 'WA':
        if ac_flag[q_num]:
            continue
        else:
            penalty += 1
    # AC
    else:
        if ac_flag[q_num]:
            continue
        else:
            ac_flag[q_num] = True
            acc += 1
print('{} {}'.format(acc, penalty))

Submission status: Wrong Answer

Solution code:
from collections import Counter
n, m = map(int, input().split())
done = [False] * (n + 1)
ans = 0
for _ in range(m):
    p, s = input().split()
    if s == 'WA':
        if done[int(p)] == False:
            ans += 1
    else:
        done[int(p)] = True
counter = Counter(done)
print(counter[True], ans)

Submission status: Wrong Answer

Solution code:
stdin = open(0).read().split('\n')
N, M = map(int,stdin[0].split())
AC = 0
WA = 0
d = {}
for i in range(1,M):
    p, S = stdin[i].split()
    if p in d:
        if d[p]!=0:
            if S=='AC':
                AC += 1
                WA += d[p]
                d[p] = 0
            else:
                d[p] += 1
    else:
        if S=='AC':
            d[p] = 0
            AC += 1
        else:
            d[p] = 1
print(AC,WA)

Submission status: Wrong Answer

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

is_AC = dict()
for i in range(N):
    is_AC[i] = False

for i in range(M):
    p, s = input().split()
    p = int(p) - 1
    if is_AC[p] == False:
        if s == "AC":
            is_AC[p] = True
            correct_cnt += 1
        else:
            pena_cnt += 1

print(str(correct_cnt), str(pena_cnt))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
if m == 0:
  print(0, 0)
else:
  wa_dic = {}
  ac_dic = {}
  for _ in range(m):
    p, s = input().split()
    if s == 'WA' and (p not in ac_dic):
      if p in wa_dic:
        wa_dic[p] += 1
      else:
        wa_dic[p] = 1
    elif s == 'AC' and (p not in ac_dic):
      ac_dic[p] = 1
  ac = 0
  for v in ac_dic.values():
    ac += v
  wa = 0
  for v in wa_dic.values():
    wa += v
  print(ac, wa)

Submission status: Wrong Answer

Solution code:
# 初期入力
N,M = (int(x) for x in input().split(" "))
S = []

#　問題種類をキー、ac,waを値の辞書
mondai_acwa ={i:list() for i in range(1,N+1) }
q_id =0
result =""
for i in range(M):
    q_id_str,result = (x for x in input().split())
    mondai_acwa[int(q_id_str)].append(result)

# ACが初めてでた時のindex＝その問題のWAの数（各問題）
ac_sum=0
wa_sum=0

for i,v_wa in mondai_acwa.items():
    if 0 < len(v_wa):
        if "AC" in v_wa:
            ac_i =v_wa.index("AC")
            ac_sum +=1
            wa_sum += ac_i
        else:
            wa_sum += len(v_wa)
print(ac_sum,wa_sum)

Submission status: Wrong Answer

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

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

for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == "WA":
        if not isAC[p]:
            penalty[p] += 1
    else:
        isAC[p] = True
print(sum(isAC), sum(penalty))

Submission status: Wrong Answer

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

flag = [0] * n
AC_cnt = 0
WA_cnt = 0
for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == "WA":
        if flag[p] == 0:
            WA_cnt += 1
    else:
        if flag[p] == 0:
            flag[p] = 1
            AC_cnt += 1
print(AC_cnt, WA_cnt)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n, m = map(int, input().split())
L = [[] for i in range(n)]
ACcnt = 0
PTcnt = 0
for i in range(m):
    p, S = input().split()
    L[int(p)-1].append(S)
for l in L:
    flag = 0
    for i in range(len(l)):
        if l[i] == 'WA' and flag == 0:
            PTcnt += 1
        elif l[i] == 'AC' and flag == 0:
            ACcnt += 1
            flag = 1
print(ACcnt, PTcnt)

Submission status: Wrong Answer

Solution code:
import sys

readline = sys.stdin.readline

def main():
    N, M = map(int, readline().split())
    aclist = [0] * N
    wrongcount = 0
    for _ in range(M):
        p, S = readline().split()
        if aclist[int(p)-1] == 0 and S == 'WA':
            wrongcount += 1
        if S == 'AC':
            aclist[int(p)-1] = 1

    print(sum(aclist), wrongcount)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys

readline = sys.stdin.readline

def main():
    N, M = map(int, readline().split())
    aclist = [0] * N
    wrongcount = 0
    for _ in range(M):
        p, S = readline().split()
        if aclist[int(p)-1] == 0 and S == 'WA':
            wrongcount += 1
        if S == 'AC':
            aclist[int(p)-1] = 1
    
    print('{} {}'.format(sum(aclist), wrongcount))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys

readline = sys.stdin.readline

def main():
    N, M = map(int, readline().split())
    aclist = [0] * N
    wrongcount = 0
    for _ in range(M):
        p, S = readline().split()
        if aclist[int(p)-1] == 0 and S == 'WA':
            wrongcount += 1
            continue
        if S == 'AC':
            aclist[int(p)-1] = 1
    
    print('{} {}'.format(sum(aclist), wrongcount))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

ac_list = [0 for _ in range(N)]
wrong = 0

for i in range(M):
    if ac_list[int(L[i][0]) - 1] != 1:
        if L[i][1] == 'AC':
            ac_list[int(L[i][0]) - 1] = 1
        else:
            wrong += 1

print(sum(ac_list), wrong)

Submission status: Wrong Answer

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

ac_list = [0 for _ in range(N)]
wrong = 0
accept = 0

for i in range(M):
    if ac_list[int(L[i][0]) - 1] == 1:
        pass
    else:
        if L[i][1] == 'AC':
            ac_list[int(L[i][0]) - 1] = 1
        else:
            wrong += 1

print(sum(ac_list), wrong)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
L = [list(map(str, input().split())) for _ in range(M)]
ac_list = []
wrong = 0
accept = 0
for i in range(M):
    if L[i][0] in ac_list:
        pass
    else:
        if L[i][1] == 'AC':
            ac_list.append(L[i][0])
            accept += 1
        else:
            wrong += 1
            
print(accept, wrong)

Submission status: Wrong Answer

Solution code:
import itertools

N, M = map(int, input().split())
L = [list(map(str, input().split())) for _ in range(M)]
tmp = []
wrong = 0
accept = 0
for i in range(M):
    if L[i] in tmp:
        pass
    else:
        tmp.append(L[i])
        if L[i][1] == 'WA':
            wrong += 1
        else:
            accept += 1

print(accept, wrong)