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:
#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline().strip()

def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    solved = [0 for i in range(N + 1)]
    penalties = 0
    for prob, verd in zip(p, S):
        if not solved[prob]:
            penalties += verd == 'WA'
            solved[prob] = 1 if verd == 'AC' else 0
    print(sum(solved), penalties)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline().strip()

def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    solved = [False for i in range(N + 1)]
    penalties = 0
    for prob, verd in zip(p, S):
        if not solved[prob]:
            penalties += verd == 'WA'
            solved[prob] = verd == 'AC'
    print(sum(solved), penalties)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n,m = (int(x) for x in input().split())

s= [input().split() for i in range(m)]
ok = 0
batu = 0
matigai = 0
seikai = []


for i in range(len(s)):
    

    if s[i][0] not in seikai:
        if s[i][1] == "AC":
            seikai.append(s[i][0])
            ok += 1
            matigai = matigai + batu
            batu = 0


    if s[i][1] == "WA":
        batu += 1 


print(ok,matigai)

Submission status: Wrong Answer

Solution code:
n,m = (int(x) for x in input().split())

s= [input().split() for i in range(m)]
ok = 0
batu = 0
seikai = []


for i in range(len(s)):

    if s[i][0] not in seikai:
        if s[i][1] == "AC":
            seikai.append(s[i][0])
            ok += 1
        elif s[i][1] == "WA":
            batu += 1 


print(ok,batu)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N,M = map(int, readline().split())

    is_solved = [False] * (N + 1)
    wa_cnt = [0] * (N + 1)

    for _ in range(M):
        p, s = readline().split()
        p = int(p)
        if s == "WA":
            if is_solved[p]:
                continue
            else:
                wa_cnt[p] += 1
        else:
            if not is_solved[p]:
                is_solved[p] = True
            else:
                continue

    solve = sum(is_solved)
    wa = sum(wa_cnt)

    print(solve, wa)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N,M = map(int, readline().split())

    is_solved = [False] * (N + 1)
    wa_cnt = [0] * (N + 1)

    for _ in range(M):
        p, s = readline().split()
        p = int(p)
        if s == "WA":
            if is_solved[p]:
                continue
            else:
                wa_cnt[p] += 1
        else:
            is_solved[p] = True

    solve = sum(is_solved)
    wa = sum(wa_cnt)

    print(solve, wa)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

    if s == "AC":
        res[int(p)-1]=1
    if s == "WA" and not res[int(p)-1]:
        pena += 1
print(sum(res), pena)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
n, m = map(int, input().split())
s = [list(map(str, input().split())) for _ in range(m)]
ac = []
wa = 0
for i in s:
    i[0] = int(i[0])
    wa += i[1] == 'WA' and i[0] not in ac
    if i[1] == 'AC' and i[0] not in ac:
        ac.append(i[0])
print(len(ac))
print(wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
P = [0] * M
S = [0] * M
dic = {}
pen = 0
ac = 0
for k in range(M):
  P[k], S[k] = input().split()
  P[k] = int(P[k])

for k in range(M):
  if P[k] in dic and dic[P[k]] == 'AC':
    pass
  else:
    dic[P[k]] = S[k]
    if S[k] == 'AC':
      ac += 1
    else:
      pen += 1

print(ac, pen)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
P = [0] * M
S = [0] * M
dic = {}
pen = 0
ac = 0
for k in range(M):
  P[k], S[k] = input().split()
  P[k] = int(P[k])

for k in range(M):
  if (P[k] not in dic) or (dic[P[k]] == 'WA'):
    dic[P[k]] = S[k]
    if S[k] == 'AC':
      ac += 1
    else:
      pen += 1

print(ac, pen)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
P = [0] * M
S = [0] * M
dic = {}
pen = 0
ac = 0
for k in range(M):
  P[k], S[k] = input().split()
  P[k] = int(P[k])
for k in range(M):
  if P[k] not in dic or dic[P[k]] == 'WA':
    dic[P[k]] = S[k]
    if S[k] == 'AC':
      ac += 1
    else:
      pen += 1

print(ac, pen)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if M == 0:
    print("0 0")
    exit()

for i in range(M):
    p, S = map(str, input().split())
    p = int(p)
    if S == "WA":
        if arr[p-1][1] == 0:
            arr[p-1][0] += 1
    elif S == "AC":
        arr[p-1][1] = 1

ac_sum = sum(arr[j][1] for j in range(N))
wa_sum = sum(arr[j][0] for j in range(N))

print(str(ac_sum) + ' ' + str(wa_sum))

Submission status: Wrong Answer

Solution code:

NM=list(map(int,input().split()))
ac_count=0
wa_count=0

#dic={}
ac_flag={}
for i in range(NM[0]+1):
    s=str(i)
    #dic[s]=0
    ac_flag[s]=False

for i in range(NM[1]):
    ps=list(input().split())
    p=ps[0]
    S=ps[1]
    if S=="WA" and ac_flag[p]==False:
        #dic[p]+=1
        wa_count+=1
    elif S=="AC" and ac_flag[p]==False:
        ac_count+=1
        #wa_count+=dic[p]
        ac_flag[p]=True
    else:pass
    
print(str(ac_count)+" "+str(wa_count))

Submission status: Wrong Answer

Solution code:


NM=list(map(int,input().split()))
ac_count=0
wa_count=0

dic={}
ac_dict={}
for i in range(NM[0]+1):
    s=str(i)
    dic[s]=0
    ac_dict[s]=0

for i in range(NM[1]):
    ps=list(input().split())
    p=ps[0]
    S=ps[1]
    if S=="WA":
        dic[p]+=1
    else:
        ac_dict[p]=1
        wa_count+=dic[p]
        

for i in ac_dict:
    s=str(i)
    if ac_dict[s]==1:
        ac_count+=1
    
print(str(ac_count)+" "+str(wa_count))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ps=[list(input().split()) for i in range(M)]
correct=[0]*N
failed=[0]*N
for i in range(M):
  num=int(ps[i][0])
  if ps[i][1]=="AC" and correct[num-1]!=1:
    correct[num-1]=1
  elif ps[i][1]=="AC" and correct[num-1]==1:
    continue
  elif ps[i][1]=="WA" and correct[num-1]==1:
    continue
  else:
    failed[num-1]+=1
totalc=sum(correct)
totalf=sum(failed)
print(totalc,totalf)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ps=[list(input().split()) for i in range(M)]
correct=[0]*N
failed=[0]*N
for i in range(M):
  num=int(ps[i][0])
  if ps[i][1]=="AC" and correct[num-1]!=1:
    correct[num-1]=1
  elif ps[i][1]=="AC" and correct[num-1]==1:
    continue
  elif ps[i][1]=="WA" and correct[num-1]!=1:
    failed[num-1]+=1
totalc=sum(correct)
totalf=sum(failed)
print(totalc,totalf)

Submission status: Wrong Answer

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

for _ in range(m):
  p,s = input().split()
  p = int(p) - 1
  if number[p]!=1:
    if s == "WA":
      number[p]+=1
    elif s == "AC":
      ac+=1
      wa+=number[p]
      number[p]=-1
print(ac,wa)

Submission status: Wrong Answer

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

for m in range(m):
  p,s = input().split()
  p = int(p) - 1
  if number[p]!=1:
    if s == "WA":
      number[p]+=1
    elif s == "AC":
      ac+=1
      wa+=number[p]
      number[p]=-1
print(ac,wa)

Submission status: Wrong Answer

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

ac = set()
wa = 0
for p,s in ps:
  if p in ac:
    continue

  if s == 'AC':
    ac.add(p)
    continue

  wa += 1

print(len(ac) , wa)

Submission status: Wrong Answer

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

for i in range(m):
    p,s = input().split()
    p = int(p)-1
    if s == 'AC' and j[p] == 0:
        ac += 1
        j[p] = 1
    elif s == 'WA' and j[p] == 0:
        wa += 1

print(ac,wa)

Submission status: Wrong Answer

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

acline = [0]*n
wanum = [0]*n

for i in range(m):
    num, acwa = map(str, input().split())
    
    num = int(num) -1
    
    if acwa == "AC":
        acline[num] = 1
    else:
        if acline[num] == 1:
            continue
        else:
            wanum[num] += 1
            
print(sum(acline), sum(wanum))

Submission status: Wrong Answer

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

p = []
d = []
a = {}
for i in range(M):
    if X[i][1] == 'AC':
        a[X[i][0]] = 'AC'
        p.append(d.count([X[i][0],'WA']))
    elif X[i][1] == 'WA':
        d.append([X[i][0],X[i][1]])

print(len(a),sum(p))

Submission status: Wrong Answer

Solution code:
#ABC 151
N,M = map(int,input().split())
P=[0 for i in range(N)]
WA = 0
AC = 0
for m in range(M):
    p,s = map(str,input().split())
    p=int(p)
    if P[p-1]==0 and s=="AC":
        P[p-1]=1
        AC+=1
    elif P[p-1]==0 and s=="WA":
        WA+=1

print(AC,WA)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#ABC 151
N,M = map(int,input().split())
P=[[]]*N
WA = 0
AC = 0
for m in range(M):
    p,s = map(str,input().split())
    p=int(p)
    if P[p-1]=='AC':
        pass
    elif P[p-1]!='AC' and s=="AC":
        P[p-1]="AC"
        AC+=1
    elif P[p-1]!='AC' and s=="WA":
        WA+=1

print(AC,WA)

Submission status: Wrong Answer

Solution code:
#ABC 151
N,M = map(int,input().split())
P=[[]]*N
WA = 0
AC = 0
for m in range(M):
    p,s = map(str,input().split())
    p=int(p)
    if P[p-1]=='AC':
        pass
    elif P[p-1]!='AC' and s=="AC":
        P[p-1]="AC"
        AC+=1
    elif P[p-1]!='AC' and s=="WA":
        WA+=1
    print(P)
print(AC,WA)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    N,M = map(int, input().split())
    ac = [0]*N
    wa = [0]*N
    for i in range(M):
        p,s = input().split()
        p = int(p)-1
        if ac[p]==0:
            if s=='AC':
                ac[p] += 1
            else:
                wa[p] += 1
    ans = [sum(ac), sum(wa)]
    print(*ans)

main()

Submission status: Wrong Answer

Solution code:
def main():
    N,M = map(int, input().split())
    ac = [0]*N
    wa = [0]*N
    for i in range(M):
        p,s = input().split()
        p = int(p)-1
        if ac[p]==0:
            if s=='AC':
                ac[p] = 1
            else:
                wa[p] += 1
    ans = [sum(ac), sum(wa)]
    print(*ans)

main()

Submission status: Wrong Answer

Solution code:
def main():
    N,M = map(int, input().split())
    ac = [0]*N
    wa = [0]*N
    for i in range(M):
        p,s = input().split()
        p = int(p)-1
        if ac[p]==0:
            if s=="AC":
                ac[p] = 1
            else:
                wa[p] += 1
    ans = [sum(ac), sum(wa)]
    print(*ans)

main()

Submission status: Wrong Answer

Solution code:
def main():
    from sys import stdin
    input = stdin.readline
    N, M = map(int, input().split())
    SP = [list(input().split()) for i in range(M)]
    was = [0] * N
    acs = [0] * N
    for sp in SP:
        if acs[int(sp[0])-1] == 1:
            continue
        if acs[int(sp[0])-1] == 0 and sp[1] == "WA":
            was[int(sp[0])-1] += 1
        elif acs[int(sp[0])-1] == 0 and sp[1] == "AC":
            acs[int(sp[0])-1] = 1

    print(sum(acs), sum(was))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

ans = [0] * (n+1)
pen = [0] * (n+1)
for i in range(m):
  p,s = ps[i].split()
  if ans[int(p)] == 0:
    if s == "AC" :
      ans[int(p)] += 1
    else :
      pen[int(p)] += 1

print("{} {}".format(sum(ans),sum(pen)))

Submission status: Wrong Answer

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

p = 0
w = 0
dic = {}
for i in range(M):
    if X[i][1] == 'AC':
        dic[X[i][0]] = X[i][1]
        p = w
        
    elif X[i][1] == 'WA':
        if (X[i][0],'AC') in dic.items():
            continue
        else:
            w += 1
print(len(dic),p)

Submission status: Wrong Answer

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

w = 0
dic = {}
for i in range(M):
    if X[i][1] == 'AC':
        dic[X[i][0]] = X[i][1]
        
    elif X[i][1] == 'WA':
        if (X[i][0],'AC') in dic.items():
            continue
        else:
            w += 1
print(len(dic),w)

Submission status: Wrong Answer

Solution code:
import numpy as np

n,m = map(int,input().split())
base = np.zeros(n)
pena = np.zeros(n)

for i in range(m):
  s = list(input().split())
  if (s[1] == "WA") and (base[int(s[0])-1] == 0):
    pena[int(s[0])-1] += 1
  elif (s[1] == "AC"):
    base[int(s[0])-1] = 1
    
print(int(np.sum(base)),int(np.sum(pena)))

Submission status: Wrong Answer

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

w = 0
dic = {}
for i in range(M):
    if X[i][1] == 'AC':
        dic[X[i][0]] = X[i][1]
    elif X[i][1] == 'WA':
        if (X[i][0],'AC') not in dic.items():
            w += 1
        else:
            continue
print(len(dic),w)

Submission status: Wrong Answer

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

ans = []
for i in range(M):
    ans.append(X[i][0])

l = sorted(set(ans) , key=ans.index)

w = 0
dic = {}
for i in range(M):
    if X[i][1] == 'AC':
        dic[X[i][0]] = X[i][1]
    elif X[i][1] == 'WA':
        if (X[i][0],'AC') not in dic.items():
            w += 1
        else:
            continue
print(len(l),w)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
number=0
ac,wa,rwa=0,0,0
for m in range(M):
    p,s=input().split()
    if number!=int(p):
        if s == "WA":
            wa+=1
        elif s == "AC":
            ac+=1
            rwa+=wa
            wa=0
            number = int(p)
print(ac,rwa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
number=0
ac,wa=0,0
for m in range(M):
    p,s=input().split()
    if number!=int(p):
        if s == "WA":
            wa+=1
        elif s == "AC":
            ac+=1
            number = int(p)
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
number=[0]*N
ac,wa=0,0
for m in range(M):
    p,s=input().split()
    if number!=-1:
        if s == "AC":
             ac+=1
             number[int(p)-1]=-1
        else:
            wa+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
number=[]
ac,wa=0,0
for m in range(M):
    p,s=input().split()
    if int(p) not in number:
        if s == "AC":
             ac+=1
             number.append(int(p))
        else:
            wa+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
number=0
ac,wa=0,0
for m in range(M):
    p,s=input().split()
    if number!=int(p):
        if s == "AC":
             ac+=1
             number=int(p)
        else:
            wa+=1
print(ac,wa)

Submission status: Wrong Answer

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

ac = {}
wa = 0

for _ in range(m):
    a, b = input().split()
    if b == 'AC':
        ac[a] = 1
    else:
        if ac.get(a, 0) == 0:
            wa += 1
print(len(ac), wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M=map(int,input().split())
 
ans=[0]*N
pena=[0]*N
AC=[0]*N
 
for i in range(M):
    p,s=input().split()
    p=int(p)
    if s=="WA":
        pena[p-1]+=1
        print(pena)
    else:
        if AC[p-1]==0:
            ans[p-1]+=pena[p-1]
        AC[p-1]=1
        print(AC)
 
print(AC.count(1),sum(ans))

Submission status: Wrong Answer

Solution code:
n,m = list(map(int, input().split()))
correct=[0]*n
penalty=[0]*n
for _ in range(m):
    p,s = input().split()
    i=int(p)-1
    if correct[i]==1:
        continue

    if s=='AC':
        correct[i]=1
    else:
        penalty[i]+=1
        
print(sum(correct), sum(penalty))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m = list(map(int, input().split()))
correct=[0]*n
penalty=[0]*n
for _ in range(m):
    p,s = input().split()
    i=int(p)-1
    if s=='AC':
        correct[i]=1
    elif s=='WA' and correct[i]==0:
        penalty[i]+=1
print('{} {}'.format(sum(correct), sum(penalty)))

Submission status: Wrong Answer

Solution code:
n,m = list(map(int, input().split()))
correct=[0]*n
penalty=[0]*n
for _ in range(m):
    p,s = input().split()
    i=int(p)-1
    if s=='AC':
        correct[i]=1
    elif correct[i]==0:
        penalty[i]+=1
print('{} {}'.format(sum(correct), sum(penalty)))

Submission status: Wrong Answer

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

ac={i:0 for i in range(1,n+1)}
wa={i:0 for i in range(1,n+1)}

for i in range(m):
    if A[i][1]=='AC':
        tmp=int(A[i][0])
        ac[tmp]=1
    else:
        tmp=int(A[i][0])
        if ac[tmp]==1:
            pass
        else:
            wa[tmp]+=1
    
print(str(sum(ac.values()))+' '+str(sum(wa.values())))

Submission status: Wrong Answer

Solution code:
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n,m = mi()

wa = [0] * n
ac  = [0] * n
for i in range(m):
    a = input().split()
    p,s = int(a[0]), a[1] 
    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:
#https://atcoder.jp/contests/abc151/tasks/abc151_c

n,m=map(int,input().split())
res_ac=[-1 for i in range(n)]
ac=0
wa=0

for i in range(m):
    sbmt=input().split()
    problem_num=int(sbmt[0])-1
    problem_ans=sbmt[1]
    if (problem_ans=="WA")&(res_ac[problem_num]==-1):#まだACしてない
        wa+=1
    if (problem_ans=="AC")&(res_ac[problem_num]==-1):
        res_ac[problem_num]=1
        ac+=1

print(ac,wa)

Submission status: Wrong Answer

Solution code:
import math

def main():
    n, m = map(int, input().split())
    ac = [0] * n
    pena = [0] * n
    for i in range(m):
        p = input().split()
        if ac[int(p[0])-1] > 0:
                continue
        elif p[1] == "AC":
            ac[int(p[0])-1] += 1
        else:
            pena[int(p[0])-1] += 1
    print(sum(ac), sum(pena))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC = [0]*N
WA = [0]*N
L = []
for m in range(M):
    p, S = map(str, input().split())
    p = int(p)
    L.append([p, S])
for m in range(M):
    if not AC[L[m][0]-1] == 0:
        continue    
    if L[m][1] == 'AC':
        AC[L[m][0]-1] = 1
    elif L[m][1] == 'WA':
        WA[L[m][0]-1] += 1
A = sum(AC)
W = sum(WA)
print(A, W)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC = [0]*N
WA = [0]*N
L = []
for m in range(M):
    p, S = map(str, input().split())
    p = int(p)
    L.append([p, S])
for m in range(M):
    if not AC[L[m][0]-1] == 0:
        continue    
    if L[m][1] == 'AC':
        AC[L[m][0]-1] = 1
    elif L[m][1] == 'WA':
        WA[L[m][0]-1] += 1
A = sum(AC)
W = 0
for n in range(N):
    if AC[n] == 1:
        W += AC[n]
print(A, W)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC = [0]*N
WA = [0]*N
L = []
for m in range(M):
    p, S = map(str, input().split())
    p = int(p)
    L.append([p, S])
for m in range(M):
    if not AC[L[m][0]-1] == 0:
        continue
    if L[m][1] == 'AC':
        AC[L[m][0]-1] = 1
    elif L[m][1] == 'WA':
        WA[L[m][0]-1] += 1
A = sum(AC)
W = sum(WA)
print(A, W)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
#p = []
#S = []
AC = [0]*N
WA = [0]*N
for i in range(M):
  pp, SS = input().split()
  #p.append(int(pp))
  #S.append(SS)
  
  if SS == "AC" and AC[int(pp)-1] == 0:
    AC[int(pp)-1] += 1
  elif SS == "WA" and AC[int(pp)-1] == 0:
    WA[int(pp)-1] += 1
    
print(sum(AC), sum(WA))
#print(p, S)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
#p = []
#S = []
AC = [0]*N
WA = [0]*N
for i in range(M):
  pp, SS = input().split()
  #p.append(int(pp))
  #S.append(SS)
  
  if SS == "AC":
    AC[int(pp)-1] += 1
  elif SS == "WA" and AC[int(pp)-1] == 0:
    WA[int(pp)-1] += 1
    
print(N - AC.count(0), sum(WA))
#print(p, S)

Submission status: Wrong Answer

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

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

print(ac, pena)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
d = 0
flag = [False]*(N+1)
for _ in range(M):
    p,s = map(str,input().split())
    if s=="WA" and flag[int(p)]==False:
        d += 1
    if s=="AC":
        flag[int(p)] = True
ans = []
ans.append(sum(flag))
ans.append(d)
print(" ".join(map(str,ans)))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
d = [0]*(N+1)
flag = [False]*(N+1)
for _ in range(M):
    p,s = map(str,input().split())
    if s=="WA" and flag[int(p)]==False:
        d[int(p)] += 1
    if s=="AC":
        flag[int(p)] = True
ans = []
ans.append(sum(flag))
ans.append(sum(d))
print(" ".join(map(str,ans)))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
d = [0]*(N+1)
flag = [False]*(N+1)
for _ in range(M):
    p,s = map(str,input().split())
    if s=="WA" and d[int(p)]==False:
        d[int(p)] += 1
    if s=="AC":
        flag[int(p)] = True
ans = []
ans.append(sum(d))
ans.append(sum(flag))
print(" ".join(map(str,ans)))

Submission status: Wrong Answer

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

inputs = [ input().split() for _ in range(m) ]

collectNum = 0
penaltyNum = 0


status = [False] * (n+1)

for inp in inputs:
    questNum = int(inp[0])
    result = inp[1]

    if status[questNum] == False:
        if result == 'AC':
            collectNum += 1
            status[questNum] = True
        elif result == 'WA':
            penaltyNum += 1

print("{} {}".format(collectNum, penaltyNum))

Submission status: Wrong Answer

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

AC_count = 0
WA_count = 0

problem_list = [0]*N
result_list = [0]*N

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

    if problem_list[p] == 1:
        if result_list[p] == 'AC':
            continue
        elif result_list[p] == 'WA' and s=='AC':
            result_list[p] = 'AC'
            AC_count += 1
        else:
            WA_count += 1
            
    else:
        problem_list[p] = 1
        result_list[p] = s

        if s == 'AC':
            AC_count += 1
        else:
            WA_count += 1


print(AC_count, WA_count)

Submission status: Wrong Answer

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

AC_count = 0
WA_count = 0

problem_list = []
result_list = []

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

    if p in problem_list:
        if result_list[problem_list.index(p)] == 'AC':
            continue
        elif result_list[problem_list.index(p)] == 'WA' and s=='AC':
            result_list[problem_list.index(p)] = 'AC'
            AC_count += 1
        else:
            WA_count += 1
            
    else:
        problem_list.append(p)
        result_list.append(s)

        if s == 'AC':
            AC_count += 1
        else:
            WA_count += 1


print(AC_count, WA_count)

Submission status: Wrong Answer

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

WA=[]
AC=[]
for i in range(N):
    WA.append(0)
    AC.append(0)

for i in range(M):
    if P[i][1]=="WA" and  AC[int(P[i][0])-1]==0:
        WA[int(P[i][0])-1]+=1
    elif P[i][1]=="AC":
        WA[int(P[i][0])-1]=0
        AC[int(P[i][0])-1]=1

print(sum(AC),sum(WA))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
L = list()
for m in range(M):
    l = input().split()
    L.append(l)
AC = 0
WA = 0
cnt = ''
res = False
for m in range(M):
    if cnt != L[m][0]:
        res = False
    cnt = L[m][0]
    if L[m][1] == 'AC':
        if res:
            continue
        AC += 1
        res = True
    elif L[m][1] == 'WA':
        if res:
            continue
        WA += 1
print('{} {}'.format(AC, WA))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
L = list()
for m in range(M):
    l = input().split()
    L.append(l)
AC = 0
WA = 0
cnt = 0
A   = 0
man = 0
i = 0
for m in range(M):
    if i > 0:
        man = L[m-1][0]
    if L[m][1] == 'AC':
        A = 0
        if cnt == L[m][0]:
            continue
        A += 1
        AC += 1
        cnt = L[m][0]
    if L[m][1] == 'WA':
        if A > 0 and man == L[m][0]:
            continue
        WA += 1
    i += 1
print('{} {}'.format(AC, WA))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
L = list()
for m in range(M):
    l = input().split()
    L.append(l)
AC = 0
WA = 0
cnt = 0
A   = 0
man = 0
for m in range(M):
    man = L[m][0]
    if L[m][1] == 'AC':
        A = 0
        if cnt == L[m][0]:
            continue
        A += 1
        AC += 1
        cnt = L[m][0]
    if L[m][1] == 'WA':
        if A > 0 and man == L[m][0]:
            continue
        WA += 1
print('{} {}'.format(AC, WA))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
L = list()
for m in range(M):
    l = input().split()
    L.append(l)
AC = 0
WA = 0
cnt = 0
A   = 0
man = 0
for m in range(M):
    if L[m][1] == 'AC':
        A = 0
        if cnt == L[m][0]:
            continue
        A += 1
        AC += 1
        cnt = L[m][0]
    if L[m][1] == 'WA':
        if A > 0 and man == L[m][0]:
            continue
        WA += 1
        man = L[m][0]
print('{} {}'.format(AC, WA))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
L = list()
for m in range(M):
    l = input().split()
    L.append(l)
AC = 0
WA = 0
cnt = 0
A   = 0
man = 0
for m in range(M):
    if L[m][1] == 'AC':
        A = 0
        if cnt == L[m][0]:
            continue
        A += 1
        AC += 1
        cnt = L[m][0]
    elif L[m][1] == 'WA':
        if A > 0 and man == L[m][0]:
            continue
        WA += 1
        man = L[m][0]
print('{} {}'.format(AC, WA))