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()))
d = dict()
for i in range(m):
	p, stat = input().split()
	p = int(p)
	if p not in d:
		d[p] = list()
	if stat == "AC":
		d[p].append(1)
	else:
		d[p].append(0)


score = 0
penalty = 0
for problem in d.keys():
	for solution in d[problem]:
		if solution:
			score += 1
			break
		else:
			penalty += 1
print("{0} {1}".format(score, penalty))

Submission status: Wrong Answer

Solution code:
n, m = [int(i) for i in input().split()]
ac = 0
wa = 0
answers = [False] * n
for i in range(m):
    inp = input().split()
    p, s = int(inp[0]), inp[1]
    index = p - 1
    if not answers[index] and s == "AC":
        ac += 1
        answers[index] = True
    if not answers[index] and s == "WA":
        wa += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
n , m = map(int,input().split())
p = []
s = []
for i in range(m):
    a, b = input().split()
    p.append(int(a))
    s.append(0 if b=='WA' else 1)

ac = 0
pena = 0
for i in set(p):
    for j in range(m):
        if s[j] ==0:
            pena +=1
        if s[j] == 1:
            pena = pena
            ac +=1
            break

print(ac,pena)

Submission status: Wrong Answer

Solution code:
n,m = [int(i) for i in input().split()]
p = [0]*m
s = [False]*m
for i in range(0,m):
    p[i],s[i] = input().split()
    p[i] = int(p[i])
    s[i] = (s[i] == 'AC')
ac = [False]*(n+1)
numWA = 0
numAC = 0
for i in range(0,m):
    if not(s[i]) and not(ac[p[i]]):
        numWA += 1
    elif s[i] and not(ac[p[i]]):
        numAC += 1
        ac[p[i]] = True
print(str(numAC) + ' ' + str(numWA))

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
dp = [0]*(100010)
qp = [0]*(100010)
for i in range(b):
    ta,tb = map(str,input().split())
    ta = int(ta)
    if tb == 'WA' and qp[ta] == 0 :dp[ta]+=1
    elif tb == 'AC' and qp[ta] == 0 :qp[ta]+=1
print(sum(qp),sum(dp))

Submission status: Wrong Answer

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

ac = 0
wa_temp = dict()
wa = 0
q_get_ac = []

for s in s_list:
  if s[0] in q_get_ac:
    break
  elif s[1] == 'AC':
    ac += 1
    q_get_ac.append(s[0])
    if s[0] in wa_temp:
      wa += wa_temp[s[0]]     
  elif s[1] == 'WA':
    if s[0] in wa_temp:
      wa_temp[s[0]] += 1
    else:
      wa_temp[s[0]] = 1

print('{} {}'.format(ac, wa))

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
from itertools import groupby
from operator import itemgetter
def print_ans(N, M, ar):
    """Test Case
    >>> print_ans(2, 5, [['1', 'WA'], ['1', 'AC'], ['2', 'WA'], ['2', 'AC'], ['2', 'WA']])
    2 2
    >>> print_ans(100000, 3, [['7777', 'AC'], ['7777', 'AC'], ['7777', 'AC']])
    1 0
    >>> print_ans(6, 0, [])
    0 0
    """
    correct = 0
    wrong = 0
    if M == 0:
        print(0, 0)
    else:
        for (k, g) in groupby(ar, key=itemgetter(0)):
            tmp_wrong = 0
            ac_flg = False
            for item in g:
                if item[1] == "AC":
                    correct += 1
                    ac_flg = True
                    break
                else:
                    tmp_wrong += 1
            if ac_flg == True:
                wrong += tmp_wrong
        #print("{} {}".format(correct, wrong))
        #print(str(correct) + " " + str(wrong))

if __name__ == '__main__':
    N, M = map(int, input().rstrip().split())
    if M == 0:
        ar = []
    else:
        ar = [list(map(str, input().rstrip().split())) for i in range(M)]
    print_ans(N, M, ar)

Submission status: Wrong Answer

Solution code:
def find(n, list): #n番目の問題がlistにあるかどうか
  counter = 0
  for i in range(0, len(list)):
    if list[i] == n:
      counter += 1
  if counter >= 1:
    return 1
  else:
    return 0

n,m = map(int, input().split())
p = []
s = []
wacounter = 0
point = 0
point_to_num = [] #acをとった問題
for i in range(0, m):
  list = input().split()
  p.append(int(list[0]))
  s.append(list[1])
 
for i in range(0, m):
  if s[i] == "AC" and not p[i] in point_to_num: #もし正解で、今までにその問題に正解していなかったら
    point_to_num.append(p[i]) #正解リストにその問題を追加
    point = point + 1 #正解ポイントをあげる
  else: #不正解だったら
    if s[i] == "WA" and not p[i] in point_to_num: #今まで正解を出したことがない
      wacounter += 1
print(point, wacounter)

Submission status: Wrong Answer

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

N,M = list(map(int, input().split()))
data = [input().split() for i in range(M)] if M>0 else[]

CA = []
PN = 0

for d in data:
    if d[0] in CA:
        continue
    if d[1]=='AC':
        CA.append(d[0])
    else:
        PN += 1

print("{} {}".format(len(CA),PN))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split(" "))
question_list = []
res_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

#print(question_list)
#print(res_list)

count = 0
for i,j in enumerate(res_list):
    if i == 0:
        if j == "WA":
            count += 1
            mistake += 1
            memory = question_list[i]
        else:
            correct += 1
            count = 0
            memory = question_list[i]
    else:
        #直前で正解かつ問題番号同じ
        if count == 0 and memory == question_list[i]:
            if j == "WA":
                memory = question_list[i]
                count = 0
            else:
                memory = question_list[i]
                count = 0
        #直前で正解かつ問題番号別
        elif count == 0 and memory != question_list[i]:
            if j == "WA":
                count += 1
                mistake += 1
                memory = question_list[i]
            else:
                count = 0
                correct += 1
                memory = question_list[i]
        #直前で不正解かつ同じ問題    
        elif count != 0 and memory == question_list[i]:
            if j == "WA":
                mistake += 1
                count += 1
                memory = question_list[i]
                
            else:
                correct += 1
                count = 0
                memory = question_list[i]
        #直前で不正解かつ違う問題
        else:
            if j == "WA":
                mistake += 1
                count += 1
                memory = question_list[i]
                
            else:
                correct += 1
                count = 0
                memory = question_list[i]
                
print(correct,mistake)

Submission status: Wrong Answer

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

aclist = []
wacount = 0

for i in range(M):
  if in2[i][1] == "WA" and not in2[i][0] in aclist:
    wacount += 1
  elif in2[i][1] == "AC" and not in2[i][0] in aclist:
    aclist.append(in2[i][0])

print(len(aclist), wacount)

Submission status: Wrong Answer

Solution code:

inputA =  list(map(int,input().split()))

mondai = 0
wrong = 0
seikaicount = 0
seikai = False

for count in range(0,inputA[1]):
    inputB = input().split()
    if count == 0:
        mondai = 1

    if inputB[0] != mondai:
        mondai = inputB[0]
        seikai = False

    if inputB[1] == "AC":
        if seikai   == False:
            seikaicount += 1
        seikai = True
    elif inputB[1] == "WA" and seikai == False:
        wrong += 1

print(seikaicount,wrong)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
lst = [0 for _ in range(N)]
count1=0
count2=0
for i in range (M):
    a,b = input().split()
    a = int(a) -1
    if lst[a] == 0:
        if b=="WA":
            count1 =count1 + 1
        elif b=="AC":
            lst[a]=1
            count2=count2+1
print(str(count2)+" "+str(count1))

Submission status: Wrong Answer

Solution code:
def main(n, m, p_s: list):
    data = {"WA": set(), "AC": set()}
    for p, s in p_s:
        data[s].add(int(p))

    print(len(data["AC"]), len(data["WA"]))


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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac = 0
wa = 0
al = [0 for i in range(n + 1)]
if m == 0:
  k = [0, 0]
  print(*k)
  exit()
for i in range(m):
  k = list(input().split())
  a = int(k[0])
  if al[a] == 1:
    continue
  if al[a] == 0 and k[1] == "WA":
    wa += 1
  if al[a] == 0 and k[1] == "AC":
    ac += 1
    al[a] = 1
lis = [ac, wa]
print(*lis)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ps=[]
p=[]
s=[]
cnt=0
cntac=0

flag=[0 for i in range(n)]
for i in range(m):
  a=input()
  ps.append(a)
for i in range(m):
  b=ps[i][0]
  p.append(int(b))
  c=ps[i][2]+ps[i][3]
  s.append(c)
for i in range(m):
  if s[i]=="WA" and flag[p[i]-1]==0:
    cnt+=1
  if s[i]=="AC" and flag[p[i]-1]==0:
    flag[p[i]-1]=1
    cntac+=1
    #print(flag)
print(cntac,cnt)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math


def inputIntList():
  return [int(s) for s in input().split()]


def inputInt():
  return int(input())


def main():
  N, M = inputIntList()

  ac = 0
  wa = 0
  problem = ['' for _ in range(N)]
  for _ in range(M):
    i, s = input().split()
    i = int(i)-1
    if problem[i] == 'AC':
      continue
    else:
      problem[i] = s

    if problem[i] == 'WA':
      wa += 1
    else:
      ac += 1

  return '{} {}'.format(ac, wa)


if __name__ == "__main__":
  print(main())

Submission status: Wrong Answer

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

a={}
for i in range(1,n+1):
    a[str(i)]='WA'
    
ans=0
pen=0
for i in range(m):
    p,s=input().split()
    if s=='AC' and a[p]=='WA':
        ans+=1
        a[p]=s
    elif a[p]=='AC' :
        pen+=0
    else:    
        pen+=1
    
print(ans,pen)

Submission status: Wrong Answer

Solution code:
import numpy as np
DEB = False
N,M = map(int, input().split())
res = np.zeros((N+1,2))


for i in range(M):
    p, s = input().split()
    p = int(p)
    if res[p][0] == 0:
        if s == 'AC':
            res[p][0] += 1
        elif s == 'WA':
            res[p][1] += 1
    
if DEB:
    for r in res:
        print(r)

print(int(res[:,0].sum()), int(res[:,1].sum()))

Submission status: Wrong Answer

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

# wa
wa_num = 0
ac_q = []
for i in range(m):
    if score_list[i][1] == "WA" and score_list[i][0] not in ac_q:
        wa_num = wa_num + 1
    elif score_list[i][1] == "AC":
        if score_list[i][0] not in ac_q:
            ac_q.append(score_list[i][0])

ac_num = len(ac_q)

print(ac_num,wa_num)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac = 0
wa = 0
aclist = {}
for i in range(n):
    aclist[i + 1] = 0

for i in range(m):
    a,b = input().split()
    a = int(a)
    if aclist[a] == 0:
        if b == 'WA':
            wa += 1
        if b == 'AC':
            aclist[a] += 1
            ac += 1
print(ac, wa, end="")

Submission status: Wrong Answer

Solution code:


N, M = [int(x) for x in input().split(" ")]

subms = [input().split(" ") for i in range(M)]

setto = set()
penalties = 0 
correct = 0 
for sub in subms:
    sub[0] = int(sub[0])
    if sub[0] not in setto and sub[0] <= N:
        if sub[1] == "WA":
            penalties += 1
        if sub[1] == "AC":
            correct += 1
            setto.add(sub[0])

print(correct, penalties)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split(' '))
ans = []
c = 0
p = 0 
p_ = 0
for i in range(m):
  arr = list( input().split(' '))
  if ans.count(arr[0]) == 0:
    if arr[1] == 'WA':
      p += 1
    if arr[1] == 'AC':
      c += 1
      ans.append(arr[0])
      p_ += p
      p = 0
      
print(c,p_)

Submission status: Wrong Answer

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

an1=0
an2=0
li=[]

if m==0:
    print(an1,an2)
    exit()

for i in range(m):
    p,s=map(str,input().split())
    
    if s=="AC":
        if p not in li:
            li.append(p)
            an1+=1
    else:
        if p not in li:
            an2+=1

print(an1,an2)

Submission status: Wrong Answer

Solution code:
import math
import numpy as np
from fractions import gcd
import fractions
import statistics
import collections
from functools import reduce
import itertools
from collections import defaultdict

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

wa_cnt = 0
ans = defaultdict(int)
for i in range(M):
    P,S = map(str, input().split())
    if (S == 'AC'):
        ans[P] = 1
    else:
        if (ans[P] != 1):
            wa_cnt +=1
 
print(len(ans), wa_cnt)

Submission status: Wrong Answer

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

num = [0]*n
nn = []
WA = 0
AC = 0

for i in range(m):
  text = input().strip().split()
  p = int(text[0])
  s = text[1]
  
  if p not in nn:
    if s == 'AC':
      AC += 1
      nn.append(p)
    elif s == 'WA':
      num[p-1] += 1
      
for i in range(len(nn)):
    WA += num[i-1]
    
print(AC, WA)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
sub = [list(input().split()) for j in range(m)]
li = [[0 for i in range(n)]for j in range(2)]
for i in range(m):
    x = int(sub[i][0])-1
    if sub[i][1] == 'AC':
        if li[0][x] == 0:
            li[0][x] += 1
    elif li[0][x] == 0:
        li[1][x] += 1
    else:
        break

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

print('{} {}'.format(ac,wa))

Submission status: Wrong Answer

Solution code:
if __name__=="__main__":
    n, m = map(int, input().split())
    p, s=[], []
    for i in range(m):
        pin, sin = map(str, input().split())
        p.append(int(pin))
        s.append(sin)

    cnt_wa = 0
    cnt_ac = 0
    pfin = 0
    for i in range(m):
        if pfin < p[i]:
            if s[i]=="WA":  
                cnt_wa += 1
            else:
                cnt_ac += 1
                pfin = p[i]
                if pfin==n:
                    break
        
    print("{} {}".format(cnt_ac, cnt_wa))

Submission status: Wrong Answer

Solution code:
cin=input().split()
N=int(cin[0])
M=int(cin[1])


result={}
ac=0
wa=0
for i in range(M):
    cin=input().split()
    p=int(cin[0])
    S=str(cin[1])

    log=result.get(p,None)
    if S == "AC" and log != "AC":
        ac+=1
        result[p]="AC"

    if S == "WA" and log != "AC":
        wa+=1

print(str(ac)+" "+str(wa))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
check = []
answer = {'AC':0,'WA':0}
for i in range(m):
    p, s = input().split()
    if p in check:
        continue
    answer[s] += 1
    if s == 'AC':
        check.append(p)

print(answer['AC'], answer['WA'])

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac,wa=0,0
t=0
flg=True
for i in range(m):
  p,s=input().split()
  if t!=p:
    flg=True
    t=p
    wa_t=0
    if s=="WA":
      wa_t+=1
    elif s=="AC" and flg:
      ac+=1
      wa+=wa_t
      wa_t=0
      flg=False
  else:
    if s=="WA":
      wa_t+=1
    elif s=="AC" and flg:
      ac+=1
      wa+=wa_t
      wa_t=0
      flg=False
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
d=[ input().split() for i in range(m)]
ans=[[0,0] for i in range(m+n+1)]
count=0
ac=0
wa=0

for i in range(m):
  if count!=d[i][0]:
    if ans[count][0]==0 and ans[count][1]>=1:
      ans[count][1]=0
    count=int(d[i][0])
  if d[i][1]=="WA" and ans[count][0]==0:
    ans[count][1]+=1
  elif d[i][1]=="AC" and ans[count][0]==0:
    ans[count][0]+=1
if ans[count][0]==0 and ans[count][1]>=1:
      ans[count][1]=0
for i in range(n+m+1):
  ac+=int(ans[i][0])
  wa+=int(ans[i][1])
print(ac,wa)

Submission status: Wrong Answer

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

seikai = 0
pena = 0
for i in range(M):
  for n in range(N):
    if int(p[i]) == n+1:
      if s[i] == "AC":
        if b[n] == False:
          seikai += 1
          b[n] = True
      else:
        if b[n] == False:
          pena += 1

print("{0} {1}".format(seikai, pena))

Submission status: Wrong Answer

Solution code:
def main(n, m, p_s: list):
    data = {"WA": set(), "AC": set()}
    for p, s in p_s:
        data[s].add(int(p))

    print(len(data["AC"]), len(data["WA"]))


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

Submission status: Wrong Answer

Solution code:
import itertools

n, m = input().split(" ")
submit = list()
for i in range(0, int(m)):
    submit.append((input().split(" ")))

wa = list()
ac = list()
for i in submit:
    if i[1] == "WA":
        wa.append(i)
    else:
        ac.append(i)

ac.sort()
ac = list(ac for ac,_ in itertools.groupby(ac))
print(len(ac))
wa.sort()
wa = list(wa for wa,_ in itertools.groupby(wa))
print(len(wa))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
import sys
input = sys.stdin.readline

m = defaultdict(int)
ac = defaultdict(int)


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

ans = 0
penalty = 0
for _ in range(M):
    p, s = input().split()
    p = int(p)
    s = s.strip()
    if s == "AC":
        if p not in ac:
            penalty += m[p]
            ans += 1
        ac[p] = 1

    else:
        if p not in ac:
            m[p] += 1


print(str(len(m.keys())) + " " + str(penalty))

Submission status: Wrong Answer

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

acs = [0] * N
was = [0] * N 

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

ac, wa = 0, 0
for i in range(N):
    ac += acs[i]
    wa += was[i]

print(ac, wa)

Submission status: Wrong Answer

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

N = Input[0]
M = Input[1]

Ar = []

for i in range(M):
  Input = list(map(str,input().split()))
  Ar.append([])
  Ar[i].append(int(Input[0]))
  Ar[i].append(Input[1])

ac = 0
pn = 0

ac_ar=[]
pn_ar=[]

chk  = 1

for i in range(M):
  if Ar[i][1]=="AC":
    ac_ar.append(Ar[i][0])
    chk+=1
  elif (chk<=Ar[i][0])and(Ar[i][1]=="WA"):
    pn_ar.append(Ar[i][0])

ac = len(set(ac_ar))
pn = len(pn_ar)

print(ac,pn)

Submission status: Wrong Answer

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

D=['WA']*N
p=0
a=0
for i in range(M):
  if D[P[i]-1]=='WA'and A[i]=='WA':
    p+=1
  elif D[P[i]-1]=='WA' and A[i]=='AC':
    a+=1
    D[P[i]-1]='AC'

print(a,p)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p = list()
s = list()
for i in range(m):
    a,b = input().split()
    p.append(int(a))
    s.append(b)
toi = set(p)
x = 0
ac = 0
pen = 0
for i in toi:
    count = p.count(i)
    kari = s[x:x+count]
    if kari.count("AC") == 0:
        pen += count
    else:
        pen += kari.index("AC")
        ac += 1
    x = count
print(ac, pen)

Submission status: Wrong Answer

Solution code:
s=[]
N,M=map(int, input().split())
wacount=0
account=0
#s=[list(input()) for i in range(2)] 
#for range(M):
#print(N,M)

for i in range(M):
     s.append(input().split())

#s.sort()
for i in range(N):
    for j in range(M):
        if s[j][0]==str(i+1):
            if s[j][1]=="WA":
                wacount=wacount+1
            else:
                account=account+1
                break
                   
print(wacount,account)

Submission status: Wrong Answer

Solution code:
class Question:
    def __init__(self, num, result):
        self.num = int(num)
        self.result = result


n, m = map(int, input().split())
p_list = [input().split() for _ in range(m)]
questions = [Question(num, result) for num, result in p_list]

collect_list = []
wa_count = 0

for q in questions:
    if not(q.num in collect_list):
        if q.result == 'AC':
            collect_list.append(q.num)
        elif q.result == 'WA':
            wa_count += 1
print('{} {}'.format(len(collect_list), wa_count))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
data = [list(map(str, input().split())) for _ in range(m)]
data = list(zip(*data))
try:
  p = list(data[0])
  q = list(data[1])
except:
  p = []
  q = []
panel = 0
ac = 0
acichi = []
for i in range(m):
  if p[i] not in  acichi:
    if q[i] == "AC":
      acichi.append(p[i])
      ac += 1
    else:
      panel += 1
print(ac,panel)

Submission status: Wrong Answer

Solution code:
s=list(map(int,input().split()))
ans=[list(map(str,input().split())) for i in range(s[1])]
que=[0 for i in range(s[0])]
a=0
b=0
for i in range(s[1]):
  if que[int(ans[i][0])-1]==0:
    if ans[i][1]=='WA':
      a+=1
    else:
      b+=1
      que[int(ans[i][0])-1]+=1
p=[]
p.append(b)
p.append(a)
print(*p)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=[list(input().split()) for i in range(m)]
from collections import defaultdict
cnt_ac=defaultdict(lambda:0)

count_wa=0
count_ac=0
for i in range(m):
    if l[i][1]=='WA' and cnt_ac[l[i][0]]==0:
        count_wa+=1
    elif l[i][1]=='AC' and cnt_ac[l[i][0]]==0:
        cnt_ac[l[i][0]]=1
        count_ac+=1
        
print(count_ac,count_wa)

Submission status: Wrong Answer

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

rs = []
for i in range(m):
    a,s = map(str,input().split())
    r = [int(a),s]
    rs.append(r)


c = 0
d = 0
acs = [0] * n 
was = [0] * n
for i in range(m):
    if rs[i][1] == 'AC':
        acs[rs[i][0] - 1]  += 1
    elif (rs[i][1] == 'WA') & (acs[rs[i][0] - 1] == 0):
        d += 1

for i in range(n):
    if acs[i] != 0:
        c += 1

print(("{} {}").format(c,d))

Submission status: Wrong Answer

Solution code:
input1 = input().split()
N = int(input1[0])
M = int(input1[1])
SUBMIT = []

for i in range(M):
    input2 = list(input().split())
    SUBMIT.append(input2)


CHECK = []

for i in range(N):
    CHECK.append([i+1,0,"yet"])



for i in range(M):
    if SUBMIT[i][1] == "WA":
        if CHECK[int(SUBMIT[i][0]) - 1][2] == "yet":
            CHECK[int(SUBMIT[i][0]) - 1][1] += 1
    else:
        CHECK[int(SUBMIT[i][0]) - 1][2] = "done"
    
result_1 = 0
result_2 = 0

for i in range(N):
    result_1 += CHECK[i][1]
    if CHECK[i][2] == "done":
        result_2 += 1
        
print(result_2,result_1)

Submission status: Wrong Answer

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

wa = 0
ac = 0
ac_list = []
for i, s in enumerate(S):
    if p[i] not in ac_list:
        if s == "WA":
                wa += 1
        else:
                ac += 1
                ac_list.append(p[i])

print(ac, wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
List = [0]*N
correct , penalties = 0,0
for i in range(M):
    p,s = input().split()
    pro = int(p)-1
    if pro > len(List):
        penalties+=1
        continue
    if List[pro]=="AC":
        continue
    if s == "WA":
        penalties+=1
        List[pro]=s
    else:
        List[pro]=s
        correct+=1
print("%d %d"%(List.count("AC"),penalties))

Submission status: Wrong Answer

Solution code:
x = input().split()
n = int(x[0])
m = int(x[1])

d = {}

ac = 0
pe = 0

for i in range(m):
    k = input().split()
    pi = int(k[0])
    s = k[1]
    if pi in d:
        continue
    if s == "AC":
        ac += 1
        d[pi] = True
    else:
        pe += 1

print("{} {}".format(ac, pe))

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict

N,M = list(map(int, sys.stdin.readline().strip().split()))
counter = {"WA":0, "AC":0}
solv = defaultdict(list)
pre = None
for i in range(M):
  p, s = sys.stdin.readline().strip().split()
  if "AC" not in solv[p]:
    solv[p].append(s)
    counter[s] += 1

print(counter["AC"], counter["WA"])

Submission status: Wrong Answer

Solution code:
import numpy as np

x = list(map(int, input().split()))

N, M = x[0], x[1]

if M == 0:
    AC, WA = 0, 0
else:
    input_line = np.array([input() for i in range(M)])
    data = np.array([[0, "x"] for j in range(M)])

    for i in range(M):
        data[i] = input_line[i].split()

    WA, AC = 0, 0
    if data[0][1] == "AC":
        AC += 1
    else:
        WA += 1
    for i in range(1, M):
        if data[i][0] == data[i - 1][0] and data[i][1] == "WA" and data[i - 1][1] != "AC":
            WA += 1
        elif data[i][0] == data[i - 1][0] and data[i][1] == "AC" and data[i - 1][1] != "AC":
            AC += 1
        elif data[i][0] == data[i - 1][0] and data[i - 1][1] == "AC":
            pass
        elif data[i][0] != data[i - 1][0]:
            if data[i][1] == "AC":
                AC += 1
            else:
                WA += 1

print(AC, WA)

Submission status: Wrong Answer

Solution code:
def find(n, list): #n番目の問題がlistにあるかどうか
  counter = 0
  for i in range(0, len(list)):
    if list[i] == n:
      counter += 1
  if counter >= 1:
    return 1
  else:
    return 0

n,m = map(int, input().split())
p = []
s = []
wacounter = 0
point = 0
point_to_num = [] #acをとった問題
for i in range(0, m):
  list = input().split()
  p.append(int(list[0]))
  s.append(list[1])
 
for i in range(0, m):
  if s[i] == "AC" and find(p[i], point_to_num) == 0: #もし正解で、今までにその問題に正解していなかったら
    point_to_num.append(p[i]) #正解リストにその問題を追加
    point = point + 1 #正解ポイントをあげる
  else: #不正解だったら
    if s[i] == "WA" and find(p[i], point_to_num) == 0: #今まで正解を出したことがない
      wacounter += 1
print(point, wacounter)

Submission status: Wrong Answer

Solution code:
def main():
    N, M = list(map(int, input().split()))
    inputs = [input().split() for i in range(M)]

    dic = {}

    for i in inputs:
        num = int(i[0])
        if num not in dic:
            dic[num] = [i[1]]
        else:
            dic[num].append(i[1])
    
    penalty = 0
    correct = 0
    for key in dic.keys():
        l = dic[key]
        for li in l:
            if li == 'AC':
                correct += 1
                break
            elif li == 'WA':
                penalty += 1
    print('{} {}'.format(correct, penalty))
        

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

ac = 0
wa = 0
wa_ = 0
ac_ = 0

if m > 0:
    p = 1
    p_count = 0
    for ps in psl:
        if p == int(ps[0]):
            p_count += 1
            if ps[1] == 'WA':
                wa_ += 1
            elif ps[1] == 'AC' and wa_ == 0:
                ac_ += 1
            elif ps[1] == 'AC' and wa_ > 0:
                ac_ += 1
                wa += wa_
                wa_ = 0
        else:
            if ac_ > 0:
                ac += 1
            wa_, ac_ = 0, 0
            p = int(ps[0])
            if ps[1] == 'WA':
                wa_ += 1
    if ac_ > 0:
        ac += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
acls = [False]*n
acs = 0
was = 0
for _ in range(m):
    p,s = input().split()
    p = int(p)
    if acls[p-1] == False:
        if s == "AC":
            acs += 1
            acls[p-1] = True
        else:
            was += 1
print(acs, was)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = []
s = []
for _ in range(M):
	tp,ts = map(str,input().split())
	p.append(int(tp))
	s.append(ts)

cnt = [0] * (N+1)
flg = [0] * (N+1)
cnt_AC = 0
cnt_WA = 0
for i in range(M):
	cp = p[i]
	if flg[cp] == 1:
		continue
	else:
		if s[i] == 'AC':
			cnt_AC += 1
			cnt_WA += cnt[cp]
			flg[cp] = 1
		else:
			cnt[cp] += 1
print(cnt_AC, end = " ")
print(sum(cnt))

Submission status: Wrong Answer

Solution code:

class Result:
    def __init__(self, num, result):
        self.num = num
        self.result = result


def WelcomeTo():
    N, M = map(int, input().split())
    resultlist = []
    for _ in range(M):
        templist = input().split()
        resultlist.append(Result(int(templist[0]), templist[1]))
    WAnum = 0
    AClist = []
    for lst in resultlist:
        if lst.num in AClist:continue
        if lst.result == 'WA':
            WAnum += 1
        elif lst.result == 'AC':
            AClist.append(lst.num)

    print('{} {}'.format(len(AClist), WAnum))


WelcomeTo()

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
sub = [list(input().split()) for _ in range(M)]
A = 0
W = 0
num = []
for k in range(M):
    if (sub[k][0] not in num) and (sub[k][1] == "AC"):
            A += 1
            num.append(sub[k][0])
    elif (sub[k][0] not in num) and (sub[k][1] == "WA"):
            W += 1
print(A,end=" ")
print(W)

Submission status: Wrong Answer

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

T = [0] * (N + 1)
ans = [0,0]

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

for i in range(M):
  p = PS[i][0]
  s = PS[i][1]

  if T[p] == 0:
    if s == "AC":
      ans[0] += 1
      T[p] = "AC"
    elif s == "WA":
      ans[1] += 1
      T[p] = "WA"
      
  elif T[p] == "AC":
    continue

  elif T[p] == "WA":
    if s == "AC":
      T[p] = "AC"
      ans[0] += 1
    elif s == "WA":
      ans[1] += 1

      
print(ans[0],ans[1])

Submission status: Wrong Answer

Solution code:
n,m = map(lambda x: int(x),input().split())
err = 0
ans_count = 0
err_count = 0

dict = {}
for _ in range(m):
    p,s = input().split()
    p = int(p)
    if not (p in dict.keys()) :
        dict[p] = s
        if s == 'WA' :
            err += 1
        elif s == 'AC' :
            ans_count += 1

    elif (p, 'WA') in dict.items() and s == 'WA':
        err += 1
    elif (p, 'WA') in dict.items() and s == 'AC':
        dict[p] = s
        ans_count += 1
        err_count += err
        err = 0
        
print(ans_count,err_count)