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())

AC = {}
WA = {}

if M == 0:
    print("0 0")
    exit()
for i in range(M):
    prob,sub = input().split()
    if sub == "WA":
        if (prob in AC) == False:
            if (prob in WA) == False:
                WA[prob] = 1
            else:
                WA[prob] += 1
    
    if sub == "AC":
         if (prob in AC) == False:
            AC[prob] = 1
         else:
            AC[prob] += 1
            
print(len(AC.values()),sum(WA.values()))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n,m=map(int,input().split())
p,s=[],[]
for i in range(m):
    P,S=input().split()
    p.append(int(P))
    s.append(S)

pena=0
cnt=defaultdict(lambda :0)
temp=0
for x,y in zip(p,s):
    if y=='AC':
        cnt[x]=1
        pena+=temp
        temp=0

    elif cnt[x]!=1 and y=='WA':
        temp+=1

print(sum(cnt.values()),pena)

Submission status: Wrong Answer

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

AC = {}
WA = {}

for i in range(M):
    prob,sub = input().split()
    if sub == "WA":
        if (prob in AC) == False:
            if (prob in WA) == False:
                WA[prob] = 1
            else:
                WA[prob] += 1
    
    if sub == "AC":
         if (prob in AC) == False:
            AC[prob] = 1
         else:
            AC[prob] += 1
            
print(sum(AC.values()),sum(WA.values()))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
d = {}
s_ac = set()
ac = 0
pen = 0
for i in range(m):
    p, s = map(str, input().split())
    p = int(p)
    if s == 'AC':
        if p not in s_ac:
            ac += 1
            s_ac.add(p)
        if p in d:
            pen += d[p]
    else:
        if p not in d:
            d[p] = 1
        else:
            d[p] += 1
print(ac, pen)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n,m=map(int,input().split())
p,s=[],[]
for i in range(m):
    P,S=input().split()
    p.append(int(P))
    s.append(S)

pena=0
cnt=defaultdict(lambda :0)
temp=0
for x,y in zip(p,s):
    if y=='AC':
        cnt[x]=1
        pena+=temp

    elif cnt[x]!=1 and y=='WA':
        temp+=1

print(sum(cnt.values()),pena)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n,m=map(int,input().split())
p,s=[],[]
for i in range(m):
    P,S=input().split()
    p.append(int(P))
    s.append(S)

pena=0
cnt=defaultdict(lambda :0)
for x,y in zip(p,s):
    if y=='AC':
        cnt[x]=1

    elif cnt[x]!=1 and y=='WA':
        pena+=1

print(sum(cnt.values()),pena)

Submission status: Wrong Answer

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

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

for i in range(m):
    p, s = input().split()
    p = int(p)
    if s=="AC": ac[p-1] = 1
    else:
        if ac[p-1]==0: wa[p-1] += 1
print(sum(ac), sum(wa))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p = [0]*n
ac = [0]*n

for i in range(m):
  a, b = input().split()
  a = int(a)-1
  
  if ac[a]==0:
    if b=="WA":
      p[a]+=1
    else:
      ac[a]=1
print(sum(ac), sum(p))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p = [0]*n
ac = [0]*n

for i in range(m):
  a, b = input().split()
  a = int(a)-1
  
  if ac[a]==0:
    if b=="WA":
      p[a]+=1
    else:
      ac[a]=1
print(ac.count(1), sum(p))

Submission status: Wrong Answer

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

correct = []
miss = 0

for i in range(M):
    p,S = list(map(str,input().split()))
    if S == 'AC' and p not in correct:
        correct.append(p)
    elif S == 'AC' and p in correct:
        continue
    elif S == 'WA' and p not in correct:
        miss += 1
    elif S == 'WA' and p in correct:
        continue
        
print(len(correct),miss)

Submission status: Wrong Answer

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

AC = [False] * (N+1)
WA_cnt = [0] * (N+1)
ans = 0
pena = 0

print(PS)

for p, s in PS:
    p = int(p)
    if AC[p]:
        continue
    elif s == "WA":
        WA_cnt[p] += 1
        # pena = 1 これだと、AC確定時にpenalty加算されるというルールが守られない
    elif s == "AC":
        ans += 1
        pena += WA_cnt[p]
        AC[p] = True

print(ans, pena, sep=' ')

Submission status: Wrong Answer

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

AC = [False] * (N+1)
ans = 0
tmp_pena = 0
pena = 0

print(PS)

for p, s in PS:
    p = int(p)
    if AC[p]:
        continue
    elif s == "WA":
        tmp_pena += 1
        # pena = 1 これだと、AC確定時にpenalty加算されるというルールが守られない
    elif s == "AC":
        ans += 1
        pena += tmp_pena
        AC[p] = True

print(ans, pena, sep=' ')

Submission status: Wrong Answer

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

AC = [False] * (N+1)
ans = 0
tmp_pena = 0
pena = 0

print(PS)

for p, s in PS:
    p = int(p)
    if AC[p]:
        continue
    elif s == "WA":
        tmp_pena += 1
    elif s == "AC":
        ans += 1
        pena = tmp_pena
        AC[p] = True

print(ans, pena, sep=' ')

Submission status: Wrong Answer

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

AC = [False] * (N+1)
ans = 0
pena = 0

for p, s in PS:
    p = int(p)
    if AC[p]:
        continue
    elif s == "WA":
        pena += 1
    elif s == "AC":
        ans += 1
        AC[p] = True


print(ans, pena, sep=' ')

Submission status: Wrong Answer

Solution code:

INPUT = """2 5
1 WA
1 AC
2 WA
2 AC
2 WA
"""

OUTPUT = "2 2"

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

P = []
S = []

# ACのインデックスを確認
# CounterでPのdictを作成

tmp = 0
ans = 0
pena = 0
cur_p = 0

for i in range(M):
    tmp_p, tmp_s = input().split()
    if i == 0:
        cur_p = int(tmp_p)

    if cur_p == int(tmp_p):
        if tmp_s == 'AC':
            ans += 1
            pena += tmp
            tmp = 0
            cur_p = int(tmp_p) + 1
        else:
            tmp += 1
    elif cur_p == int(tmp_p) - 1:
        tmp = 0
        cur_p = int(tmp_p) + 1
    else:
        pass

print(ans, pena, sep=' ')

Submission status: Wrong Answer

Solution code:

INPUT = """2 5
1 WA
1 AC
2 WA
2 AC
2 WA
"""

OUTPUT = "2 2"

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

P = []
S = []

# ACのインデックスを確認
# CounterでPのdictを作成

tmp = 0
ans = 0
pena = 0
cur_p = 0

for i in range(M):
    tmp_p, tmp_s = input().split()
    if i == 0:
        cur_p = int(tmp_p)

    if cur_p == int(tmp_p):
        if tmp_s == 'AC':
            ans += 1
            pena += tmp
            tmp = 0
            cur_p = int(tmp_p) + 1
        else:
            tmp += 1
    else:
        pass

print(ans, pena, sep=' ')

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
l = [False] * n
c = [0, 0]
for i in range(k):
  p, r = map(str, input().split())
  if l[int(p) - 1] == False:
    if r == "WA":
      c[0] += 1
    elif r == "AC":
      l[int(p) - 1] = True
      c[1] += 1
print(c[1], c[0])

Submission status: Wrong Answer

Solution code:
def main():
    k, n = map(int, input().split())
    dp = [0] * (k+1)
    pen = 0
    for i in range(n):
        p,q = input().split()
        p = int(p)
        if dp[p] == 0:
            if q == 'WA':
                pen += 1
            elif q == 'AC':
                dp[p] = 1
    print(sum(dp), pen)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
p = ['0']*M
S = ['0']*M
for i in range(M):
  p[i],S[i]= map(str,input().split())
AC = [0]*(N+1)
WA = [0]*(N+1)
i = 0
for i in range(M):
  if S[i] == 'WA':
    if AC[int(p[i])] == 0:
      WA[int(p[i])] = WA[int(p[i])]+1
    else:
      None
  else:
    AC[int(p[i])]=1
count = 0
for i in range(N+1):
  if AC[i]==0:
    count = count+WA[i]
print(sum(AC),sum(WA))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
p = [0]*M
S = [0]*M
for i in range(M):
  p[i],S[i]= map(str,input().split())
AC = [0]*(N+1)
WA = [0]*(N+1)
i = 0
while i < M:
  if S[i] == 'WA':
    if AC[int(p[i])] == 0:
      WA[int(p[i])] = WA[int(p[i])]+1
    i = i+1
  else:
    AC[int(p[i])]=1
    i = i+1
print(sum(AC),sum(WA))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
p = [0]*M
S = [0]*M
for i in range(M):
  p[i],S[i]= map(str,input().split())
NM = N+M
AC = [0]*NM
WA = [0]*NM
i = 0
while i < M:
  if S[i] == 'WA':
    if AC[int(p[i])] == 0:
      WA[int(p[i])] = WA[int(p[i])]+1
    i = i+1
  else:
    AC[int(p[i])]=1
    i = i+1
print(sum(AC),sum(WA))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
p = [0]*M
S = [0]*M
for i in range(M):
  p[i],S[i]= map(str,input().split())
NM = N+M
AC = [0]*NM
WA = [0]*NM
i = 0
while i < M:
  if S[i] == 'WA':
    if AC[int(p[i])] != 1:
      WA[int(p[i])] = WA[int(p[i])]+1
    i = i+1
  else:
    AC[int(p[i])]=1
    i = i+1
print(sum(AC),sum(WA))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
p = [0]*M
S = [0]*M
for i in range(M):
  p[i],S[i]= map(str,input().split())
NM = N+M
AC = [0]*NM
WA = [0]*NM
i = 0
while i < M:
  if S[i] == 'WA':
    if AC[int(p[i])] != 1:
      WA[int(p[i])] = WA[int(p[i])]+1
    i = i+1
  elif S[i] == 'AC':
    AC[int(p[i])]=1
    i = i+1
  else:
    i = i+1
print(sum(AC),sum(WA))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
pS = [[0,0] for i in range(M)]
for i in range(M):
  pS[i]= list(map(str,input().split()))
p = [0]*M
S = [0]*M
for i in range(M):
  p[i] = pS[i][0]
  S[i] = pS[i][1]
AC = 0
WA = 0
p1 = '0'
i = 0
while i < M:
  if p[i] == 'fin':
    i = i+1
  elif p[i] != p1 and S[i] != 'AC':
    WA = WA+1
    i = i+1
  elif p[i] != p1 and S[i] == 'AC':
    p1 = p[i]
    for j in range(M):
      if p[j] == p1:
        p[j] = 'fin'
    AC = AC+1
    i = i+1
  else:
    i = i+1
print(AC,WA)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
p = [0]*M
S = [0]*M
pS = [[0,0] for i in range(M)]
for i in range(M):
  pS[i]= list(map(str,input().split()))
pS.sort(key=lambda x:x[0])
for i in range(M):
  p[i] = pS[i][0]
  S[i] = pS[i][1]
AC = 0
WA = 0
p1 = '0'
i = 0
while i < M:
  if p[i] != p1 and S[i] != 'AC':
    WA = WA+1
    i = i+1
  elif p[i] != p1 and S[i] == 'AC':
    p1 = p[i]
    AC = AC+1
    i = i+1
  else:
    i = i+1
print(AC,WA)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
p = [0]*M
S = [0]*M
for i in range(M):
  p[i],S[i] = map(str,input().split())
AC = 0
WA = 0
p1 = '0'
i = 0
while i < M:
  if p[i] != p1 and S[i] != 'AC':
    WA = WA+1
    i = i+1
  elif p[i] != p1 and S[i] == 'AC':
    p1 = p[i]
    AC = AC+1
    i = i+1
  else:
    i = i+1
print(AC,WA)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
c = [input().split() for i in range(m)]
for i in range(m):
    c[i][0] = int(c[i][0])
AC, WA = 0, 0
aclist = [0 for i in range(n)]
for i in range(m):
    if aclist[c[i][0] - 1] == 0:
        if c[i][1] == 'AC':
            aclist[c[i][0] - 1] += 1
            AC += 1
        else:
            WA += 1
print(AC, WA)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
c = [input().split() for i in range(m)]
for i in range(m):
    c[i][0] = int(c[i][0])
AC, WA, i =0, 0, 0
for i in range(n):
    for j in range(m):
        if c[j][0] == i + 1:
            if c[j][1] == 'WA':
                WA += 1
            else:
                AC += 1
                break  
print(AC, WA)

Submission status: Wrong Answer

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

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

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

a = 0
b = 0

a = ac.count(True)
for i in wa:
  b += i
print(a,b)

Submission status: Wrong Answer

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

x = 0
y = 0

s = [False]*n
for i in range(m):
  a,b = input().split()
  a = int(a)
  if s[a-1] == False and b == 'WA':
    y += 1
    
  if b == 'AC' and s[a-1] == False:
    s[a-1] = True
    x += 1
print(x,y)

Submission status: Wrong Answer

Solution code:
x=input().split()
n=int(x[0])
m=int(x[1])
p=[]
ref=[]
for k in range(m):
  x=input().split()
  p.append(int(x[0]))
  ref.append(x[1])
first=[-1]*(n+1)
penalties=[0]*(n+1)
for k in range(m):
  prob=p[k]
  outcome=ref[k]
  if first[prob]==-1:
    if outcome=='AC':
      first[prob]=k
    else:
      penalties[prob]+=1
pb=0
pen=0
for k in range(n+1):
  if first[k]!=-1:
    pb+=1
    pen+=penalties[prob]
print(pb,pen)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
submit=[]
ans_table={}
ans1=0
ans2=0
cnt1=0
cnt2=0
if m==0:
    print("0 0")
else:
    for i in range(m):
        submit.append(list(input().split()))
    submit.sort(key=lambda x:x[0])

    tmp=submit[0][0]
    for i in submit:
        if i[0]!=tmp:
           tmp = i[0]
           cnt2 = 0
        if i[1]=="WA":
            cnt2+=1
        else:
            if i[1] in ans_table:
                continue
            else:
                ans_table[i[0]]="AC"
                ans2+=cnt2
                ans1+=1
    print(ans1,ans2)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
L = ["WA" for i in range(n + 1)]
ac = 0
wa = 0
for i in range(m):
    s, p = map(str, input().split())
    s = int(s)
    if L[s] == "AC":
        continue

    if L[s] == "WA" and p == "WA":
        wa += 1
    elif L[s] == "WA" and p == "AC":
        L[s] = "AC"
        ac += 1


print(ac, wa)

Submission status: Wrong Answer

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

    if L[s] == "WA" and p == "WA":
        wa += 1
    elif L[s] == "WA" and p == "AC":
        L[s] = "AC"
        ac += 1
    else:
        continue

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
L = []
ans = 0
for i in range(m):
    s, p = map(str, input().split())
    s = int(s)
    if p == "AC":
        if L.count(s) == 0:
            L.append(s)
        else:
            continue
    else:
        if L.count(s) == 0:
            ans += 1
        else:
            continue

print(len(L), ans)

Submission status: Wrong Answer

Solution code:
D=[]
N,M=map(int,input().split())
if M!=0:
  for i in range(M):
    p,S=input().split()
    D.append((int(p),S))
  countAC=0
  countWA=0  
  for i in range(1,N+1):
    for j in range(M):
      if D[j][0]==i:
        if D[j][1]=='WA':
          countWA+=1
        else:
          countAC+=1
          break
  print(countAC,countWA)
  
else:
  print(0,0)

Submission status: Wrong Answer

Solution code:
D=[]
N,M=map(int,input().split())
for i in range(M):
  p,S=input().split()
  D.append((int(p),S))
countAC=0
countWA=0  
for i in range(1,N+1):
  for j in range(M):
    if D[j][0]==i:
      if D[j][1]=='WA':
        countWA+=1
      else:
        countAC+=1
        break

        
print(countAC,countWA)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac = []
sb = []
for i in range(m):
    p, s = input().split()
    p = int(p)
    sb.append([p, s])
    if s == "AC":
        ac.append(p)
a = 0
w = 0
for q, st in sb:
    if q in ac:
        if st == "AC":
            a += 1
            ac.remove(q)
        else:
            w += 1
print(str(a) + " " + str(w))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
t = {}
for i in range(1, n+1):
    t[i] = "WA"
w = 0
a = 0
for i in range(m):
    p, s = input().split()
    p = int(p)
    if t[p] == "WA" and s == "WA":
        w += 1
    elif t[p] == "WA" and s == "AC":
        a += 1
        t[p] = "AC"
print(a, w)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main(n: int, m: int, p_s: list):
    flg = [False for _ in range(n)]
    ac, wa = 0, 0
    for p, s in p_s:
        if flg[int(p) - 1]:
            continue

        if s == 'AC':
            flg[int(p) - 1] = True
            ac += 1
        else:
            wa += 1

    print(ac, wa)


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

    main(n, m, p_s)

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
l = [0]*(a+1)
ac = 0
wa = 0

for i in range(b):
  x,y = map(str,input().split())
  if l[int(x)] == 0 and y == "AC":
    ac += 1
    l[int(x)] = 1
  elif l[int(x)] == 0 and y == "WA":
    wa += 1

print(ac,wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
d = {}
for i in range(m):
    p, s = input().split()
    d.setdefault(p, [])
    d[p].append(s)

correct = 0
cnt = 0
for v in d.values():
    if "AC" in v:
        correct += 1
        cnt += v.index("AC")
    else:
        cnt += len(v)

print(correct, cnt)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
d = {}
for i in range(m):
    p, s = input().split()
    d.setdefault(p, [])
    d[p].append(s)

correct = 0
cnt = 0
for v in d.values():
    if "AC" in v:
        correct += 1
        cnt += len(v[:v.index("AC")])
    else:
        cnt += len(v)

print(correct, cnt)

Submission status: Wrong Answer

Solution code:
import sys
lines = sys.stdin.read().split("\n")
n, m = map(int, lines[0].split())

ac_flags = [0] * (n + 1)
ac_count = 0
wa_count = 0

for line in lines[1:-1]:
    p, s = line.split()
    p = int(p)
    if ac_flags[p] == 0:
        if s == "AC":
            ac_count += 1
            ac_flags[p] = 1
        else:
            wa_count += 1

print ac_count, wa_count

Submission status: Wrong Answer

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

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

for i in range(m):
    p, s = input().split()
    p = int(p) - 1

    if s == 'WA':
        if not b[p]:
            wa[p] += 1
    else:
        if not b[p]:
            ac += 1
            b[p] = True

print(ac, sum(wa))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
c=[0]*(N+1)
AC=0
WA=0
for i in range(M):
    p,s=input().split()
    p=int(p)
    if(c[p]==0 and s=="AC"):
        c[p]+=1
        AC+=1
    elif(c[p]==0 and s=="WA"):
        WA+=1
print(AC,WA)

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 = [False for i in range(N)]
cntwa = 0
cntac = 0
for i in range(M):
    if num[int(P[i][0]) - 1] == False:
        if P[i][1] == "AC":
            num[int(P[i][0]) - 1] = True
            cntac += 1
        else:
            cntwa += 1
print(cntac, cntwa)

Submission status: Wrong Answer

Solution code:
inp = input().split()
n,m = map(int, inp)
ind_l = []
re_l =[]
ac = 0
wa = 0
a_kind = []
for i in range(m):
    ind,re = input().split()
    ind_l.append(int(ind))
    re_l.append(re)
for i in range(m):
    if ind_l[i] not in a_kind:
        if re_l[i] == "AC":
            ac += 1
            a_kind.append(ind_l[i])
        else:
            wa += 1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
inp = input().split()
n,m = map(int, inp)
ind_l = []
re_l =[]
ac = 0
wa = 0
a_kind = []
for i in range(m):
    ind,re = input().split()
    ind_l.append(int(ind))
    re_l.append(re)
for i in range(m):
    if i == 0:
        if re_l[i] == "AC":
            ac += 1
            a_kind.append(ind_l[i])
        else:
            wa += 1
    else:
        if re_l[i] == "AC":
            if ind_l[i] in a_kind:
                continue
            else:
                ac += 1
                a_kind.append(ind_l[i])
        if re_l[i] == "WA":
            if ind_l[i] in a_kind:
                continue
            else:
                wa += 1
print(ac,wa)

Submission status: Wrong Answer

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

acn = 0
wan = 0
qj = [False] * (n+1)

for i in range(m):
    p[i], s[i] = input().split()
    p[i] = int(p[i])
    if not qj[p[i]]:
        if s[i] == 'AC':
            qj[p[i]] =  'True'
            acn += 1
        else:
            wan += 1

print(acn, wan)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
d={} #正解の辞書
e={} #誤答の辞書
for _ in range(M):
    p,s=input().split()
    d.setdefault(p,0)
    e.setdefault(p,0)
    if s=="WA" and d[p]!=1:
        e[p]+=1
    elif s=="AC":
        d[p]=1

print(sum(d.values()),sum(e.values()))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
d={}
e={}
for _ in range(M):
    p,s=input().split()
    d.setdefault(p,0)
    e.setdefault(s,0)
    if s=="WA" and d[p]!=1:
        e[s]+=1
    elif s=="AC":
        d[p]=1

print(sum(d.values()),sum(e.values()))

Submission status: Wrong Answer

Solution code:
N, M =map(int,input().split())
Q = [0]*N
w = 0
a = 0

for i in range(M):
  b, c =input().split()
  if Q[int(b)-1] != "AC" and c != "AC":
    w += 1
  elif Q[int(b)-1] != "AC" and c == "AC":
    a += 1
    Q[int(b)-1] =c

print(a,w)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
AC = [0] * n
WA = [0] * n

for i in range(m):
    x = input().split()
    num = int(x[0]) - 1
    if x[1]=='AC':
        AC[num]+=1
    elif x[1]=='WA' and AC[num]==0:
        WA[num]+=1
print(sum(AC), sum([w for i, w in enumerate(WA) if AC[i]]))

Submission status: Wrong Answer

Solution code:
nm = list(map(int, input().split()))
N = nm[0]
M = nm[1]

p = [0] * M
s = [0] * M
for i in range(M):
    ps = list(map(str, input().split()))
    p[i] = int(ps[0])
    s[i] = ps[1]

acc = [0] * N
for i in range(M):
    if s[i] == "AC":
        acc[p[i]-1] = 1

point = 0
for i in range(N):
    point = point + acc[i]

penalty = 0
pnc =[ [0] * N for i in range(2)]
for i in range(M):
    if s[i] == "WA" and pnc[1][p[i]-1] == 0:
        pnc[0][p[i]-1] = pnc[0][p[i]-1] + 1
    elif s[i] == "AC":
        pnc[1][p[i]-1] = 1

for i in range(N):
    penalty = penalty + pnc[0][i]

print(str(point)+" "+str(penalty))

Submission status: Wrong Answer

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

Counted = []
num1 = 0
num2 = 0

for j in range(M):
  if S[j] == "AC" and not p[j] in Counted:
    num1 += 1
    Counted.append(p[j])
  elif S[j] == "WA" and not p[j] in Counted:
    num2 += 1

print("{} {}".format(num1, num2))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
correct = [0 for _ in range(N)]
missed = [0 for _ in range(N)]
penalty = 0

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

    if s == "AC" and correct[p - 1] == 0:
        correct[p - 1] = 1
        penalty += missed[p - 1]
    elif s == "WA" and correct[p - 1] == 0:
        missed[p - 1] += 1

print(len(correct), penalty)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
mp = [0 for i in range(N)]
ans = 0
penalty = 0
for i in range(M):
    p, s = input().split()
    p = int(p)

    if s == "AC" and mp[p - 1] == 0:
        ans += 1
        mp[p - 1] = 1
    elif s == "WA" and mp[p - 1] == 0:
        penalty += 1
    elif s == "AC" and mp[p - 1] == 1:
        pass
    elif s == "WA" and mp[p - 1] == 1:
        pass

print(ans, penalty)

Submission status: Wrong Answer

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

m = [0 for i in range(N)]

ans = 0
penalty = 0
for i in range(M):
    if pS[i][1] == "AC" and m[pS[i][0] - 1] == 0:
        m[pS[i][0] - 1] = 1
        ans += 1
    elif pS[i][1] == "WA" and m[pS[i][0] - 1] == 0:
        penalty += 1


print(ans, penalty)

Submission status: Wrong Answer

Solution code:
import sys
from operator import itemgetter

n,m = map(int,input().split())
tei =[]
if m == 0:
    print(0,0)
    sys.exit()
for i in range(m):
    tei.append(list(input().split()))
tei.sort(key=itemgetter(0))

sei = pen = 0
cop = copw = com =coa = 0
i = j = 0
wk = int(tei[i][0])
while i < m:
    copw = 0
    while j < m:
        if wk == int(tei[j][0]):
            if tei[j][1] == 'AC':
                coa += 1
                cop += copw
                wk += 1
                j += 1
                i = j
                break
            else:
                copw += 1
                j += 1
                i += 1
        else:
            j += 1
            i += 1
            break
    else:
        if coa != 0:
            print(coa,cop)
            sys.exit()
        else:
            print(0,0)
            sys.exit()
else:
    if coa != 0:
        print(coa,cop)
    else:
        print(0,0)

Submission status: Wrong Answer

Solution code:
import sys
n,m = map(int,input().split())
tei =[]
if m == 0:
    print(0,0)
    sys.exit()
for i in range(m):
    tei.append(list(input().split()))
tei.sort

sei = pen = 0
cop = copw = com =coa = 0
i = j = 0
wk = int(tei[i][0])
while i < m:
    
    copw = 0
    while j < m:
        if wk == int(tei[j][0]):
            if tei[j][1] == 'AC':
                coa += 1
                cop += copw
                wk += 1
                j += 1
                i = j
                break
            else:
                copw += 1
                j += 1
                i += 1
        else:
            j += 1
            i += 1
            break
    else:
        if coa != 0:
            print(coa,cop)
            sys.exit()
        else:
            print(0,0)
            sys.exit()
else:
    if coa != 0:
        print(coa,cop)
    else:
        print(0,0)

Submission status: Wrong Answer

Solution code:
import math
n, m = map(int, input().split())
false_count = [1]*n
ans_false_count = [0]*n
ans_success_count = [0]*n

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

    if s=='WA':
        false_count[p-1] = int(false_count[p-1]*2)
    else:
        ans_false_count[p-1] += int(false_count[p-1])
        ans_success_count[p-1] = 1
        false_count[p-1] = 0

for j in range(n):
    if false_count[j] != 0:
        false_count[j] = math.log(false_count[j],2)
    if ans_false_count [j] != 0:
        ans_false_count[j] = math.log(ans_false_count[j],2)

new_ans_false_count = false_count + ans_false_count
print(sum(ans_success_count), int(sum(new_ans_false_count)))

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)-1)
    S.append(str(s))

AC_list = [0]*N
WA_list = [0]*N
for i in range(M):
    if S[i] == "AC":
        AC_list[P[i]] = 1
    if S[i] == "WA" and AC_list[P[i]] == 0:
        WA_list[P[i]] += 1

correct = sum(AC_list)
penalty = sum(WA_list)
print(correct, penalty)

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)-1)
    S.append(str(s))

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

correct = sum(AC_list)
print(correct, penalty)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
false_count = [1]*n
ans_false_count = [0]*n
ans_success_count = [0]*n

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

    if s=='WA':
        false_count[p-1] *= 2 
    else:
        ans_false_count[p-1] += false_count[p-1]
        ans_success_count[p-1] = 1
        false_count[p-1] = 0

new_ans_false_count = map(lambda x: x//2, ans_false_count)
print(sum(ans_success_count), sum(new_ans_false_count))

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 P[i] in AC_list:
        continue
    if S[i] == "AC" and P[i] not in AC_list:
        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)