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 = [int(i) for i in input().split()]
P = []
S = []
for _ in range(M):
    p, s = [x for x in input().split()]
    P.append(int(p))
    S.append(str(s))

AC_list = []
penalty = 0
for i in range(M):
    if S[i] == "AC":
        AC_list.append(P[i])
    if S[i] == "WA" and P[i] not in AC_list:
        penalty +=1

correct = len(set(AC_list))
print(correct, penalty)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
N, M = map(int, input().split(" "))
prob = {i: [0, False] for i in range(1, N + 1)}
wa = 0
ac = 0
for _ in range(M):
    p, S = input().split(" ")
    p = int(p)
    if prob[p][1] == False:
        if S == "WA":
            wa += 1
        else:
            ac += 1
            prob[p][1] = True
print(ac, wa)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
N, M = map(int, input().split(" "))
prob = {i: [0, 0] for i in range(1, N + 1)}
wa = 0
ac = 0
for _ in range(M):
    p, S = input().split(" ")
    p = int(p)
    if prob[p][1] == False:
        if S == "WA":
            wa += 1
        else:
            ac += 1
            prob[p][1] = True
print(ac, wa)

Submission status: Wrong Answer

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

seikai = []
matigai = 0

for _ in range(m):
    p, s = input().split()
    if s == "WA":
        if p not in seikai:
            matigai = matigai + 1
    elif p not in seikai:
        seikai.append(p)

print(len(seikai), matigai)

Submission status: Wrong Answer

Solution code:
class Solution:
    #    def solve(self, N: int, P: List[int]) -> int:
    def solve(self, N: int, M: int, p_and_S):

        solved = []
        for n in range(N+1):
            solved.append([0, 0])

        ac_count = 0
        wa_count = 0

        for p_and_S_ in p_and_S:
            p, S = p_and_S_

            if solved[p][0] == 0:
                if S == "AC":
                    solved[p][0] += 1
                    ac_count += 1
                else:
                    solved[p][1] += 1
                    wa_count += 1

        return (ac_count, wa_count)


if __name__ == '__main__':

    # standard input
    N, M = list(map(int, input().split()))
    p_and_S = []
    for m in range(M):
        p_and_S_ = input().split()
        p_and_S.append([int(p_and_S_[0]), p_and_S_[1]])

    # solve
    solution = Solution()
    ans = solution.solve(N, M, p_and_S)
    print(ans[0], ans[1])

Submission status: Wrong Answer

Solution code:
class Solution:
    #    def solve(self, N: int, P: List[int]) -> int:
    def solve(self, N: int, M: int, p_and_S):

        solved = []
        for n in range(N+1):
            solved.append([0, 0])

        ac_count = 0
        wa_count = 0

        for p_and_S_ in p_and_S:
            p, S = p_and_S_

            if solved[p][0] == 0:
                if S == "AC":
                    solved[p][0] += 1
                    ac_count += 1
                else:
                    solved[p][1] += 1
                    wa_count += 1

        return (ac_count, wa_count)


if __name__ == '__main__':

    # standard input
    N, M = list(map(int, input().split()))
    p_and_S = []
    for m in range(M):
        p_and_S_ = input().split()
        p_and_S.append([int(p_and_S_[0]), p_and_S_[1]])

    # solve
    solution = Solution()
    print(solution.solve(N, M, p_and_S))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
box = [0]*N
cor = 0
fal = 0

for i in range(M):
  p,s = input().split()
  p = int(p)
  s = str(s)
  
  if s == "WA":
    if box[p-1] != -1:
      box[p-1] += 1
  else:
    if box[p-1] != -1:
      cor += 1
      fal = box[p-1]
      box[p-1] = -1

print(cor,fal)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
box = [0]*N
cor = 0
fal = 0

for i in range(M):
  p,s = input().split()
  p = int(p)
  s = str(s)
  
  if s == "WA":
    if box[p-1] != -1:
      fal += 1
  else:
    if box[p-1] != -1:
      cor += 1
      box[p-1] = -1

print(cor,fal)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ps = [list(input().split()) for _ in range(m)]
aw = ["WA"] * n
ac = 0
wa = 0
for i in ps:
    if i[1] == "WA":
        if aw[int(i[0])-1] == "WA":
            wa += 1
        else:
            pass
    else:
        if aw[int(i[0])-1] =="WA":
            ac += 1
            aw[int(i[0])-1] = "AC"
        else:
            pass
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ps = [list(input().split()) for _ in range(m)]
aw = ["WA"] * n
ac = 0
wa = 0

for i in ps:
    if aw[int(i[0])-1] == "WA":
        if i[1] == "AC":
            ac += 1
            aw[int(i[0])-1] = "AC"
        else:
            wa += 1
    else:
        pass

print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=0
wa=0
bo=[0]*n
for i in range(m):
    p,s=map(str,input().split())
    p=int(p)-1

    if s=="WA":
        if bo[p]==0:
            wa+=1

    if s=="AC":
        if bo[p]==0:
            ac+=1
            bo[p]+=1

print(ac,wa)

Submission status: Wrong Answer

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

ac=0
wa=0

bo=[0]*n
for i in range(m):
    p,s=map(str,input().split())
    p=int(p)-1

    if s=="WA":
        if bo[p]==0:
            wa+=1

    if s=="AC":
        if bo[p]==0:
            ac+=1
            bo[p]=1

print(ac,wa)

Submission status: Wrong Answer

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

chk = [False]*n
c_ac = 0;
c_wa = 0;

for i in range(m):
    _p,_s=input().split()
    j=int(_p)-1
        
    if _s == "WA":
      if chk[j] == False:
        c_wa+=1
    
    elif _s == "AC":
      if chk[j] == False:
        c_ac += 1
        chk[j] =True

print(c_ac,c_wa,sep= ' ')

Submission status: Wrong Answer

Solution code:
#ABC151C
n,m=list(map(int,input().split()))
p=[]
s=[]

chk = ''

for i in range(m):
    _p,_s=input().split()
    if chk != _p:
        chk = _p
        c1 = 0
        c2 = 0
        
    if _s == "WA":
        c1+=1
    
    elif _s == "AC":
        c2+=1
        s.append(int(_p))
        if c2 == 1:
          p.append(c1)

ac=len(set(s))
wa=sum(p)
print(ac,wa,sep= ' ')

Submission status: Wrong Answer

Solution code:
#ABC151C
n,m=list(map(int,input().split()))
p=[]
s=[]

chk = ''

for i in range(m):
    _p,_s=input().split()
    if chk != _p:
        chk = _p
        c1 = 0
        c2 = 0
        
    if _s != "AC":
        c1+=1
    
    if _s == "AC":
        c2+=1
        s.append(int(_p))
        if c2 == 1:
          p.append(c1)

ac=len(set(s))
wa=sum(p)
print(ac,wa,sep= ' ')

Submission status: Wrong Answer

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

ac = [False]*n
c_ac = 0
c_wa = 0
c_wa_tmp = 0
for _ in range(m):
    pi,si = input().split()
    pi = int(pi) - 1
    
    if ac[pi] == False:
        if si == 'WA':
            c_wa_tmp += 1
        elif si == 'AC':
            c_ac += 1
            c_wa += c_wa_tmp
            c_wa_tmp = 0
            ac[pi] = True

print(c_ac, c_wa)

Submission status: Wrong Answer

Solution code:
listA=[]

try:
    listA = list(input().split())
    #listA<-[1,2,2,3,1]
    #print(listA)
    #ここに逐次処理を書けばいいと思う。
except:
    quit();
    #または、quit(),os.exit()をして止める。


N=int(listA[0])
M=int(listA[1])

dic={}

count_WA=0
count_AC=0

for i in range(N):
    dic[i+1]='WA'

for i in range(M):
    try:
        listing=list(input().split())
        #listA<-[1,2,2,3,1]
        #print(listA)
        #ここに逐次処理を書けばいいと思う。
    except:
        break;
        #または、quit(),os.exit()をして止める。


    if dic[int(listing[0])] == 'WA':

        if listing[1] == 'WA':
            count_WA+=1
        else:
            count_AC+=1
            dic[int(listing[0])]='AC'

print(count_AC, count_WA)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
q,sub=map(int,input().split())
ac=[0 for i in range(q)]
sum_wa=[0 for i in range(q)]
for i in range(sub):
    m,n=input().split()
    m=int(m)
    if n=='WA':
        sum_wa[m-1]+=1
    elif n=='AC' and ac[m-1]==0:
        ac[m-1]+=1
print(len(ac) ,max(sum_wa))

Submission status: Wrong Answer

Solution code:
q,sub=map(int,input().split())

ac=[0 for i in range(q)]
sum_wa=[0 for i in range(q)]
for i in range(sub):
    m,n=input().split()
    m=int(m)
    if n=='WA':
        sum_wa[m-1]+=1
    elif ac[m-1]==0:
        ac[m-1]+=1
print(sum(ac) ,max(sum_wa))

Submission status: Wrong Answer

Solution code:
q,sub=map(int,input().split())
p=[]
s=[]
ac=[0 for i in range(q)]
sum_wa=[0 for i in range(q)]
for i in range(sub):
    m,n=input().split()
    p.append(int(m))
    s.append(n)
    if n=='WA':
        sum_wa[p[i]-1]+=1
    elif ac[p[i]-1]==0:
        ac[p[i]-1]+=1
print(sum(ac) ,max(sum_wa))

Submission status: Wrong Answer

Solution code:
q,sub=map(int,input().split())
p=[]
s=[]
ac=0
sum_wa=[0 for i in range(q)]
for i in range(sub):
    m,n=input().split()
    p.append(int(m))
    s.append(n)
    if n=='WA':
        sum_wa[p[i]-1]+=1
    else:
        ac+=1
print(ac ,max(sum_wa))

Submission status: Wrong Answer

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

score = 0
penalty = 0
for i in range(1,N+1):
    Ss = [S for p, S in pS if int(p) == i]
    if "AC" in Ss:
        score += 1
        penalty += Ss.index("AC")
    else:
        penalty += len(Ss)

print(score, penalty)

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
p=[]
S=[]
for i in range(M):
    P,s=input().split()
    p.append(int(P))
    S.append(s)
A=set()
W=[0 for i in range(0,N)]
w=0
for i in range(0, M):
    if S[i]=='AC':
        w+=W[p[i]-1]
        if p[i]-1 not in A:
            A.add(p[i]-1)
    elif S[i]=='WA':
        if p[i]-1 not in A:
            W[p[i]-1]+=1
print(len(A), w)

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
p=[]
S=[]
for i in range(M):
    P,s=input().split()
    p.append(int(P))
    S.append(s)
A=set()
W=[0 for i in range(0,N)]
w=0
for i in range(0, M):
    if S[i]=='AC':
        A.add(p[i]-1)
        w+=W[p[i]-1]
    elif S[i]=='WA':
        if p[i]-1 not in A:
            W[p[i]-1]+=1
print(len(A), w)

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
p=[]
S=[]
for i in range(M):
    P,s=input().split()
    p.append(int(P))
    S.append(s)
A=set()
W=0
for i in range(0, M):
    if S[i]=='AC':
        A.add(p[i])
    elif S[i]=='WA':
        if p[i] not in A:
            W+=1
print(len(A), W)

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
p=[]
S=[]
for i in range(M):
    P,s=input().split()
    p.append(int(P))
    S.append(s)
A=[]
W=0
for i in range(0, M):
    if S[i]=='AC':
        if p[i] not in A:
            A.append(p[i])
    elif S[i]=='WA':
        if p[i] not in A:
            W+=1
print(len(A), W)

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
p=[]
S=[]
for i in range(M):
    P,s=input().split()
    p.append(int(P))
    S.append(s)
A=[]
W=0
for i in range(0, M):
    if S[i]=='AC':
        A.append(p[i])
    elif S[i]=='WA':
        if not p[i] in A:
            W+=1
print(len(set(A)), W)

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
p, s = [], []
for i in range(m):
    ps = list(input().split())
    p.append(int(ps[0]))
    s.append(ps[1])
ac_list = [0 for i in range(n)]
wa_list = [0 for i in range(n)]
for i in range(m):
    if s[i] == "AC":
        ac_list[p[i] - 1] = 1
    else:
        if ac_list[p[i] - 1] == 0:
            wa_list[p[i] - 1] += 1
# print(str(sum(ac_list)) + " " + str(penl))
for i in range(n):
    if ac_list[i] == 0:
        wa_list[i] == 0
print(*[sum(ac_list), sum(wa_list)])

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
p, s = [], []
for i in range(m):
    ps = list(input().split())
    p.append(int(ps[0]))
    s.append(ps[1])
ac_list = [0 for i in range(n)]
penl = 0
for i in range(m):
    if s[i] == "AC":
        ac_list[p[i] - 1] = 1
    elif s[i] == "WA":
        if ac_list[p[i] - 1] == 0:
            penl += 1
print(str(sum(ac_list)) + " " + str(penl))

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
p, s = [], []
for i in range(m):
    ps = list(input().split())
    p.append(int(ps[0]))
    s.append(ps[1])
ac_list = [0 for i in range(n)]
penl = 0
for i in range(m):
    if s[i] == "AC":
        ac_list[p[i] - 1] = 1
    else:
        if ac_list[p[i] - 1] == 0:
            penl += 1
print(str(sum(ac_list)) + " " + str(penl))

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
p, s = [], []
for i in range(m):
    ps = list(input().split())
    p.append(int(ps[0]))
    s.append(ps[1])
ac_list = [0 for i in range(n)]
penl = 0
for i in range(m):
    if s[i] == "AC":
        ac_list[p[i] - 1] = 1
    if ac_list[p[i] - 1] == 0:
        penl += 1
print(str(sum(ac_list)) + " " + str(penl))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
p=[0]*m
temp=['a']*m
s=["qw"]*m
judge=[0]*n
  
for i in range(0,m):
  temp[i],s[i]=input().split()
  p[i]=int(temp[i])
  
ac=0
wa=0
for i in range(0,m):
  if s[i][0]=='W' and s[i][1]=='A':
    if judge[p[i]-1]==0:
      wa+=1
  elif s[i][0]=='A' and s[i][1]=='C' and judge[p[i]-1]==0:
    ac+=1
    judge[p[i]-1]=1
print("%d %d"% (ac,wa))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
p=[0]*m
temp=['a']*m
s=["qw"]*m
judge=[0]*n
  
for i in range(0,m):
  temp[i],s[i]=input().split()
  p[i]=int(temp[i])
  
ac=0
wa=0
for i in range(0,m):
  if s[i][0]=='W' and s[i][1]=='A':
    if judge[p[i]-1]==0:
      wa+=1
  elif judge[p[i]-1]==0:
    ac+=1
    judge[p[i]-1]=1
print("%d %d"% (ac,wa))

Submission status: Wrong Answer

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

for i in range (0,M):
    [a,b]=input().split()
    p.append(int(a))
    S.append(b)


for i in range (0,M):
    if S[i]=="WA":
        if ac[int(p[i]-1)]==0:
            WA=WA+1
    else:
        if ac[int(p[i]-1)]==0:
            ac[int(p[i]-1)]=1

AC=ac.count(1)

print(str(AC)+" "+str(WA))

Submission status: Wrong Answer

Solution code:

a,b=map(int,input().split())

c=[]
for i in range(b):
    d,e=map(str,input().split())
    c.append([int(d),e])

acans=0
waans=0
ac=[0]*(a+1)
wa=[0]*(a+1)
for i in range(b):
    if c[i][1]=="AC":
        if ac[c[i][0]-1]==0:
            acans+=1
            ac[c[i][0]-1]+=1
            waans+=wa[c[i][0]-1]
    else:
        wa[c[i][0]-1]+=1
print(ac)
#print(wa)
print(acans,waans)

Submission status: Wrong Answer

Solution code:


a,b=map(int,input().split())

c=[]
for i in range(b):
    d,e=map(str,input().split())
    c.append([int(d),e])

acans=0
waans=0
ac=[0]*(a+1)
wa=[0]*(a+1)
for i in range(b):
    if c[i][1]=="AC":
        if ac[c[i][0]-1]==0:
            acans+=1
            ac[c[i][0]-1]==1
            waans+=wa[c[i][0]-1]
    else:
        wa[c[i][0]-1]+=1
#print(wa)
print(acans,waans)

Submission status: Wrong Answer

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

num = 1
cntac = 0
cntwa = 0
for i in range(M):
    if P[i][0] == str(num):
        if P[i][1] == "AC":
            cntac += 1
            num += 1
        else:
            cntwa += 1

print(cntac, cntwa)

Submission status: Wrong Answer

Solution code:
N, submit = list(map(int, input().split()))
res = list(list(map(str, input().split())) for _ in range(submit))
ac_list = []
ac, wa = 0, 0
res_list = []
for i in res:
    res_list.append(i[1][:1])
    if i in ac_list:
        pass
    elif i[1] == "AC":
        ac_list.append(i)
        ac += 1

for i in range("".join(res_list).rfind("A")):
    if res[i][1] == "WA":
        wa += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m = [int(i) for i in input().split(' ')]
wa = [0] * n
ac = [0] * n
for _ in range(m):
    problem, status = input().split(' ')
    problem = int(problem) - 1
    if status == 'WA':
        if ac[problem] == 0:
            wa[problem] += 1
        continue
    ac[problem] = 1

no_ac = sum(ac)
no_wa = sum(wa)

print(str(no_ac) + ' ' + str(no_wa))

Submission status: Wrong Answer

Solution code:
n, m = [int(i) for i in input().split(' ')]
wa = [0] * n
ac = [0] * n
for _ in range(m):
    problem, status = input().split(' ')
    problem = int(problem) - 1
    if status == 'WA':
        if ac[problem] == 0:
            wa[problem] += 1
        continue
    ac[problem] = 1

no_ac = sum(ac)
no_wa = sum(wa)

Submission status: Wrong Answer

Solution code:
n, m = [int(i) for i in input().split(' ')]
wa = [0] * n
ac = [0] * n
for _ in range(m):
    problem, status = input().split(' ')
    problem = int(problem) - 1
    if status == 'WA':
        if ac[problem] == 0:
            wa[problem] += 1
        continue
    ac[problem] = 1

Submission status: Wrong Answer

Solution code:
n, m = [int(i) for i in input().split(' ')]
wa = [0] * n
ac = [0] * n
for _ in range(m):
    problem, status = input().split(' ')
    problem = int(problem) - 1
    if status == 'WA':
        if ac[problem] == 0:
            wa[problem] += 1
        continue

Submission status: Wrong Answer

Solution code:
n, m = [int(i) for i in input().split(' ')]
wa = [0] * n
ac = [0] * n
for _ in range(m):
    problem, status = input().split(' ')
    problem = int(problem) - 1
    if status == 'WA':
        if ac[problem] == 0:
            wa[problem] += 1

Submission status: Wrong Answer

Solution code:
n, m = [int(i) for i in input().split(' ')]
wa = [0] * n
ac = [0] * n
for _ in range(m):
    problem, status = input().split(' ')
    problem = int(problem) - 1

Submission status: Wrong Answer

Solution code:
n, m = [int(i) for i in input().split(' ')]
wa = [0] * n
ac = [0] * n
for _ in range(m):
    problem, status = input().split(' ')

Submission status: Wrong Answer

Solution code:
n, m = [int(i) for i in input().split(' ')]
wa = [0] * n
ac = [0] * n

Submission status: Wrong Answer

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

P_ans = [0] * n

WA = 0
AC = 0

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

print("{} {}".format(AC,WA))

Submission status: Wrong Answer

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

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

print(ac, wa)

Submission status: Wrong Answer

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

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

a = 0
b = sum(wa)

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

print(*[a, b])

Submission status: Wrong Answer

Solution code:
#ABC151C
n,m=list(map(int,input().split()))
p=[]
s=[]

chk = ''

for i in range(m):
    _p,_s=input().split()
    if chk != _p:
        chk = _p
        c1 = 0
        c2 = 0
        
    if _s != "AC":
        c1+=1
    
    if _s == "AC":
        c2+=1
        s.append(int(_p))
        if c2 == 1:
          p.append(c1)

ac=len(set(s))
wa=sum(p)
print("{} {}".format(str(ac),str(wa)))

Submission status: Wrong Answer

Solution code:
#ABC151C
n,m=list(map(int,input().split()))
p=[]
s=[]

chk = ''

for i in range(m):
    _p,_s=input().split()
    if chk != _p:
        chk = _p
        c1 = 0
        c2 = 0
        
    if _s != "AC":
        c1+=1
        c2+=1
    
    if _s == "AC":
        s.append(int(_p))
        if c2 == 1:
          p.append(c1)

ac=len(set(s))
wa=sum(p)
print("{} {}".format(str(ac),str(wa)))

Submission status: Wrong Answer

Solution code:
#ABC151C
n,m=list(map(int,input().split()))
p=[]
s=[]

chk = ''

for i in range(m):
    _p,_s=input().split()
    if chk != _p:
        chk = _p
        cnt = 0
    if _s != "AC":
        cnt+=1
    
    if _s == "AC":
        s.append(int(_p))
        p.append(cnt)

ac=len(set(s))
wa=sum(p)
print("{} {}".format(str(ac),str(wa)))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
right = 0
wrong = 0
now = 1
for i in range(M):
    p, S = input().split()
    if S == 'AC':
        if int(p) == now:
            now += 1
            right += 1
    else:
        if int(p) == now:
            wrong += 1

print(right, wrong, sep=' ')

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
right = 0
wrong = 0
now = 1
for i in range(M):
    p, S = list(input().split())
    if S == 'AC':
        if p == now:
            now += 1
            right += 1
    else:
        if p == now:
            wrong += 1

print(right, wrong, sep=' ')

Submission status: Wrong Answer

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

f = [True]*(n+1)
ans = [0, 0]

for _ in range(m):
    p, s = map(str, input().split())
    p = int(p)

    if f[p]:
        if s == "AC":
            ans[0] += 1
            f[p] = False
        else:
            ans[1] += 1

print(*ans)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
S = [False] * (N+1)
count = [0] * (N+1)

for i in range(M):
  p, s = input().split()
  p = int(p)
  
  if S[p]: continue
  if s == 'AC': S[p] = True
  else: count[p] += 1
    
print(sum(S), sum(count))

Submission status: Wrong Answer

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

countAC = 0
pS_set = set(pS)
pS_list = list(pS_set)
for i in pS_list:
    if i[1] == 'AC':
        countAC += 1

countWA_dict = {}
countWA_final = {}
countWA = 0

for i in pS:
    if i[1] == 'WA':
        if i[0] not in countWA_dict.keys():
            countWA_dict[i[0]] = 1
        else:
            countWA_dict[i[0]] += 1
    else:
        if i[0] not in countWA_final.keys() and i[0] in countWA_dict.keys():
            countWA_final[i[0]] = countWA_dict[i[0]]
            countWA += countWA_dict[i[0]]

print(str(countAC) + ' ' + str(countWA))

Submission status: Wrong Answer

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

countAC = 0
pS_set = set(pS)
pS_list = list(pS_set)
for i in pS_list:
    if i[1] == 'AC':
        countAC += 1

countWA = {}
countWA_list = []

for i in pS:
    if i[1] == 'WA':
        if i[0] not in countWA.keys():
            countWA[i[0]] = 1
        else:
            countWA[i[0]] += 1
    else:
        if i[0] in countWA.keys():
            countWA_list.append(countWA[i[0]])
countWA = sum(countWA_list)

print(str(countAC) + ' ' + str(countWA))

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
n,m = map(int, input().split())

res = []
for i in range(m):
  res.append(input().split())

que = []
for a1,a2 in res:
  que.append(a1)
num = set(que)

ac = 0
wa = 0
c = ''
for b in num:
  for c1,c2 in res:
    if c1 == b and c2 == 'AC':
      ac += 1
      break
    elif c1 == b and c2 =='WA':
      wa += 1

print(ac,wa)

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
n,m = map(int, input().split())
a = []

ans = []

for i in range(m):
  a.append(input().split())

#no = ''
#for x,y in a:
#  if y == 'AC' and x != no:
#    ans.append([x,y])
#    no = x
#  if y == 'WA' and x != no:
#    #print(x, no)
#    ans.append([x,y])

ac = 0
wa = 0
c = ''
for p1,p2 in reversed(a):
  #print(p1,p2)
  if p2 == 'AC' and p1 != c:
    ac +=1
    c = p1
  if p2 == 'WA' and p1 == c:
    wa +=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
n,m = map(int, input().split())
a = []

ans = []

for i in range(m):
  a.append(input().split())

no = ''
for x,y in a:
  if y == 'AC' and x != no:
    ans.append([x,y])
    no = x
  if y == 'WA' and x != no:
    #print(x, no)
    ans.append([x,y])

ac = 0
wa = 0
c = ''
for p1,p2 in reversed(ans):
  #print(p1,p2)
  if p2 == 'AC':
    ac +=1
    c = p1
  if p2 == 'WA' and p1 == c:
    wa +=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
n,m = map(int, input().split())
a = []

ans = []

for i in range(m):
  a.append(input().split())

no = ''
for x,y in a:
  if y == 'AC' and x != no:
    ans.append([x,y])
    no = x
  if y == 'WA' and x != no:
    #print(x, no)
    ans.append([x,y])

ac = 0
wa = 0
c = ''
for p1,p2 in reversed(ans):
  print(p1,p2)
  if p2 == 'AC':
    ac +=1
    c = p1
  if p2 == 'WA' and p1 == c:
    wa +=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
n,m = map(int, input().split())
a = []

ans = []

for i in range(m):
  a.append(input().split())

no = ''
for x,y in a:
  if y == 'AC' and x != no:
    ans.append([x,y])
    no = x
  if y == 'WA' and x != no:
    #print(x, no)
    ans.append([x,y])

ac = 0
wa = 0
for p1,p2 in ans:
  if p2 == 'AC':
    ac +=1
  else:
    wa +=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
n,m = map(int, input().split())
a = []

ans = []

for i in range(m):
  a.append(input().split())

no = ''
for x,y in a:
  if y == 'AC' and x != no:
    ans.append([x,y])
    no = x
  if x != no:
    #print(x, no)
    ans.append([x,y])

ac = 0
wa = 0
for p1,p2 in ans:
  if p2 == 'AC':
    ac +=1
  else:
    wa +=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N, M, *p_NM = open(0).read().split()

ac_num = 0
wa_num = 0
ac_problem = ''

for i in range(0,len(p_NM),2):
    if(p_NM[i] == ac_problem):
        continue
    if(p_NM[i+1] == 'AC'):
        ac_num += 1
        ac_problem = p_NM[i]
    else:
        wa_num += 1
        
print(ac_num, wa_num)

Submission status: Wrong Answer

Solution code:
N, M, *p_NM = open(0).read().split()

ac_num = 0
wa_num = 0
ac_problem = ''

for i in range(0,len(p_NM),2):
    if(p_NM[i] == ac_problem):
        continue
    if(p_NM[i+1] == 'WA'):
        wa_num += 1
    else:
        ac_num += 1
        ac_problem = p_NM[i]
        
print(ac_num, wa_num)

Submission status: Wrong Answer

Solution code:
import sys
N, M, *PS = sys.stdin.read().strip().split()
N = int(N)
ac = [0] * N
wa = [0] * N
for p, s in zip(*[iter(PS)] * 2):
  p = int(p) -1
  if s == "AC":
    ac[p] = 1
  elif ac[p] == 0:
    wa[p] += 1
penalties = sum([w or a for a, w in zip(ac, wa)])
print("{} {}".format(sum(ac), penalties))

Submission status: Wrong Answer

Solution code:
import sys
N, M, *PS = sys.stdin.read().strip().split()
N = int(N)
ac = [0] * N
wa = [0] * N
for p, s in zip(*[iter(PS)] * 2):
  p = int(p) -1
  if s == "AC":
    ac[p] = 1
  elif ac[p] == 0:
    wa[p] += 1
penalties = sum([w * a for a, w in zip(ac, wa)])
print("{} {}".format(sum(ac), sum(wa)))

Submission status: Wrong Answer

Solution code:
import sys
N, M, *PS = sys.stdin.read().strip().split()
N = int(N)
ac = [0] * N
wa = [0] * N
for p, s in zip(*[iter(PS)] * 2):
  p = int(p) -1
  if s == "AC":
    ac[p] = 1
  elif ac[p] == 0:
    wa[p] += 1
penalties = sum([w if a else 0 for a, w in zip(ac, wa)])
print("{} {}".format(sum(ac), sum(wa)))

Submission status: Wrong Answer

Solution code:
import sys
N, M, *PS = sys.stdin.read().strip().split()
N = int(N)
ac = [0] * N
wa = [0] * N
for p, s in zip(*[iter(PS)] * 2):
  p = int(p) -1
  if s == "AC":
    ac[p] = 1
  elif ac[p] == 0:
    wa[p] += 1
penalties = sum([w if a > 0 else 0 for a, w in zip(ac, wa)])
print("{} {}".format(sum(ac), sum(wa)))

Submission status: Wrong Answer

Solution code:
import sys
N, M, *PS = sys.stdin.read().strip().split()
N = int(N)
ac = [0] * N
wa = [0] * N
for p, s in zip(*[iter(PS)] * 2):
  p = int(p) -1
  if s == "AC":
    ac[p] = 1
  elif ac[p] == 0:
    wa[p] += 1
penalties = sum([w or a for a, w in zip(ac, wa)])
print("{} {}".format(sum(ac), sum(wa)))

Submission status: Wrong Answer

Solution code:
import sys
N, M, *PS = sys.stdin.read().strip().split()
N = int(N)
ac = [0] * N
wa = [0] * N
for p, s in zip(*[iter(PS)] * 2):
  p = int(p) -1
  if s == "AC":
    ac[p] = 1
  elif ac[p] == 0:
    wa[p] += 1
print("{} {}".format(sum(ac), sum(wa)))

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
# List to store grades
apb = [[] for i in range(10 ** 5)]

# num and apb convert to type dict
for i in range(M):
    n, a = input().split()
    apb[int(n)] += [a]
    if a == 'AC':
      continue

apb_new = list(filter(lambda a: a != [], apb))

# count
count = 0
for words in apb_new:
  for word in words:
    if word == 'WA':
      count += 1
    else:
      break
print(len(apb_new), count)

Submission status: Wrong Answer

Solution code:

def ACWA(p,j,p_list):
    if j=="AC":
        p_list[p][0]=1
    else:
        p_list[p][1]+=1
    return p_list
    
N,M = map(int,input().split(" "))
p_list = {}
wa_count = 0

for _ in range(M):
    In = input().split()
    if (In[0] in p_list) == False:
        p_list[In[0]]=[0,0]
        p_list = ACWA(In[0],In[1],p_list)
    else:
        if p_list[In[0]][0]==1:
            continue
        else:
            p_list = ACWA(In[0],In[1],p_list)
                
List = list(p_list.values())
print(List)
a = 0
b = 0

for i in range(len(List)):
    if List[i][0]==1:
        a+=List[i][0]
        b+=List[i][1]

print("{} {}".format(a,b))