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())
fin=set()
AC=0
WA=0
for i in range(M):
  p,s=input().split()
  p=int(p)
  if not p in fin:
    if s=="AC":
      AC+=1
      fin.add(p)
    else:
      WA+=1
print(AC,WA)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
fin=set()
AC=0
WA=0
for i in range(M):
  p,s=input().split()
  if not p in set(fin):
    if s=="AC":
      AC+=1
      fin.add(p)
    else:
      WA+=1
print(AC,WA)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
fin=[]
AC=0
WA=0
for i in range(M):
  p,s=input().split()
  if not p in set(fin):
    if s=="AC":
      AC+=1
      fin+=[p]
    else:
      WA+=1
print(AC,WA)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

acs = set()
wcs = dict()
wc = 0

n,m = nm()
for i in range(m):
  p,s = input().split()
  if s == 'AC':
    acs.add(p)
    if p in wcs:
      wc+=wcs[p]
    continue
  if p not in acs:
    if p not in wcs:
      wcs[p]=0
    wcs[p]+=1

print(len(acs))
print(wc)

Submission status: Wrong Answer

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

acs = set()
wc = 0

n,m = nm()
for i in range(m):
  p,s = input().split()
  if s == 'AC':
    acs.add(p)
    continue
  if p not in acs:
    wc+=1

print(len(acs))
print(wc)

Submission status: Wrong Answer

Solution code:
def main():
    #input
    N,M=map(int,input().strip().split())
    cnt=[0 for n in range(N)]
    flag=[0 for n in range(N)]
    
    for _ in range(M):
        pS=list(input().strip().split())
        x=int(pS[0])
        y=pS[1]
        if flag[x-1]==0:
            if y=="WA":
                cnt[x-1]+=1
            else:
                flag[x-1]=1
                
    num_AC=sum(flag)
    num_WA=sum(cnt)
                
    print(str(num_AC)+" "+str(num_WA))

if __name__=="__main__":
   main()

Submission status: Wrong Answer

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

num = [0]*n
flag = [False]*n

for _ in range(m):
  p,s = input().split()
  p = int(p)-1
  if flag[p]:
    continue
  else:
    if s == "AC":
      flag[p] = True
    else:
      num[p] += 1
print(flag.count(True),sum(num))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
P,S=[],[]
ans,pen=0,0
task=[0]*N
for _ in range(M):
    A,B=map(str,input().split())
    P.append(int(A))
    S.append(B)

for j in range(M):
    if task[P[j]-1]!=-1 and S[j]=="WA":
        pen+=1
    elif task[P[j]-1]!=-1 and S[j]=="AC":
        ans+=1
        task[P[j]-1]=-1
print(ans,pen)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
P,S=[],[]
ans,pen=0,0
task=[0]*N
for _ in range(M):
    A,B=map(str,input().split())
    P.append(int(A))
    S.append(B)

for j in range(M):
    if task[P[j]-1]!=-1 and S[j]=="WA":
        pen+=1
    elif task[P[j]-1]!=-1 and S[j]=="AC":
        ans+=1
        task[P[j]-1]=-1
        break
print(ans,pen)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
P,S=[],[]
ans,pen=0,0
for _ in range(M):
    A,B=map(str,input().split())
    P.append(int(A))
    S.append(B)
for i in range(1,N+1):
    for j in range(M):
        if i==P[j] and S[j]=="WA":
            pen+=1
        elif i==P[j] and S[j]=="AC":
            ans+=1
            break
print(ans,pen)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
flag = [False]*n
penalty = 0
corr = 0
for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == 'AC':
        if flag[p]:
            continue
        else:
            corr += 1
            flag[p] = True
    else:
        if flag[p]:
            continue
        else:
            penalty += 1
print(corr, penalty)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
flag = [False]*n
penalty = 0
corr = 0
for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == 'AC':
        flag[p] = True
    else:
        if flag[p]:
            continue
        else:
            penalty += 1
for j in range(n):
    if flag[j]:
        corr += 1
print(corr, penalty)

Submission status: Wrong Answer

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

sP = {}
WA =0
AC =0
for _ in range(M):
    data = input()
    number, result = data.split()
    if data not in sP:
        if number + " AC" not in sP:
            if result == "WA":
                sP[data] = 1
                WA += 1

            elif result == "AC":
                sP[data] = 1
                AC += 1
        else:
            pass
    else:
        sP[data] += 1
        if number + " AC" not in sP:
            if result == "WA":
                WA += 1

            elif result == "AC":
                AC += 1
        else:
            pass


print(AC, WA)

Submission status: Wrong Answer

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

sP = {}
WA =0
AC =0
for _ in range(M):
    data = input()
    number, result = data.split()
    if data not in sP:
        sP[data] =1
        if number + " AC" not in sP:
            if result == "WA":
                WA += 1

            elif result == "AC":
                AC += 1
        else:
            pass
    else:
        sP[data] += 1
        if number + " AC" not in sP:
            if result == "WA":
                WA += 1

            elif result == "AC":
                AC += 1
        else:
            pass


print(AC, WA)

Submission status: Wrong Answer

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

sP = {}
WA =0
AC =0
for _ in range(M):
    data = input()
    number, result = data.split()
    if data not in sP:
        sP[data] =1
        if number + " AC" not in sP:
            if result == "WA":
                WA += 1
            elif result == "AC":
                AC +=1
    else:
        sP[data] += 1
        if number + " AC" not in sP:
            if result == "WA":
                WA += 1

            elif result == "AC":
                AC += 1
        else:
            pass


print(AC, WA)

Submission status: Wrong Answer

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

sP = {}
WA =0
AC =0
for _ in range(M):
    data = input()
    number, result = data.split()
    if data not in sP:
        sP[data] =1
        if result == "WA":
            WA += 1
        elif result == "AC":
            AC +=1
    else:
        sP[data] += 1
        if number + " AC" not in sP:
            if result == "WA":
                WA += 1

            elif result == "AC":
                AC += 1
        else:
            pass


print(AC, WA)

Submission status: Wrong Answer

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

sP = {}
WA =0
AC =0
for _ in range(M):
    data = input()
    number, result = data.split()
    if data not in sP:
        sP[data] =1
        if result == "WA":
            WA += 1
        if result == "AC":
            AC +=1
    else:
        sP[data] += 1
        if number + " AC" not in sP:
            if result == "WA":
                WA += 1

            if result == "AC":
                AC += 1

            

print(AC, WA)

Submission status: Wrong Answer

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

for i in range(m):
    p,s = input().split()
    p = int(p)
    if s == "AC":
        if ACc[p-1] == 0:
            ACc[p-1] += 1
    else:
        if ACc[p-1] != 1:
            WAc[p-1] += 1

print(sum(ACc),sum(WAc))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
num = [1]*(n + 1)
AC_cnt = 0
WA_cnt = 0
for i in range(m):
    p,s=input().split()
    if s == 'AC':
        if num[int(p)]:
            num[int(p)] = 0
            AC_cnt += 1
    else:
        WA_cnt += 1
print(AC_cnt,WA_cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
num = []
AC_cnt = 0
WA_cnt = 0
for i in range(m):
    p,s=input().split()
    if s == 'AC' and int(p) not in num:
        num.append(int(p))
        AC_cnt += 1
    elif s == 'WA' and int(p) not in num:
        WA_cnt += 1
print(AC_cnt,WA_cnt)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
mylist = []
ACset = set()
WAcount = 0
for i in range(m):
    mylist.append(input().split())
    mylist[i][0] = int(mylist[i][0])

for i in range(m):
    if not (mylist[i][0] in ACset):
        if mylist[i][1] == 'AC':
            ACset.add(mylist[i][0])
        else:
            WAcount+=1

print(len(ACset),WAcount)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
mylist = []
ACset = set()
WAcount = 0

for i in range(m):
    mylist.append(input().split())
    mylist[i][0] = int(mylist[i][0])

for i in range(m):
    if mylist[i][1] == 'AC':
        ACset.add(mylist[i][0])
    elif not(mylist[i][0] in ACset) and mylist[i][1] == 'WA':
            WAcount += 1
print(len(ACset),WAcount)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
mylist = []
ACset = set()
WAcount = 0

for i in range(m):
    mylist.append(input().split())
    mylist[i][0] = int(mylist[i][0])

for i in range(m):
    if mylist[i][1] == 'AC':
        ACset.add(mylist[i][0])
    elif (mylist[i][0] in ACset) == False and mylist[i][1] == 'WA':
            WAcount += 1
print(len(ACset),WAcount)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ac = [0] * N
wa = [0] * N
check = [False] * N

for i in range(M):
    if check[p[i]-1]:
        continue
    else:
        if s[i] == "WA":
            wa[p[i]-1] += 1
        else:
            ac[p[i]-1] = 1
            check[p[i]-1] = True
print(sum(ac),sum(wa))

Submission status: Wrong Answer

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

ac = [0] * N
wa = [0] * N
check = [False] * N

for i in range(M):
    if s[i] == "WA":
        if check[p[i]-1]:
            continue
        else:
            wa[p[i]-1] += 1
    else:
        if check[p[i]-1]:
            continue
        else:
            ac[p[i]-1] = 1
            check[p[i]-1] = True
a,w = sum(ac),sum(wa)
print(a,w)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M = list(map(int,input().split()))
PS = [input().split() for _ in range(M)]
status = {}
countac = 0
countwa = 0
for ps in PS:
    if ps[0] not in status:
        if ps[1] == 'AC':
            status[ps[0]] = 'AC'
            countac += 1
        else:
            countwa += 1
print(str(countac)+' '+str(countwa))

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline


def main():
    N, M = map(int, input().split())
    submits = list(input().split() for _ in range(M))
    problems = [0]*(N+1)
    penalty = 0
    ac = 0
    for submit in submits:
        if problems[int(submit[0])] == 0 and submit[1] == "AC":
            problems[int(submit[0])] = 1
            ac += 1
        elif problems[int(submit[0])] == 0 and submit[1] == "WA":
            penalty += 1
    print(ac, penalty)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N,M = LI()
pS = [LS() for _ in range(M)]
count_AC,count_WA = 0,0
set_AC_NO = set()
for x in pS:
    p,S = int(x[0]),x[1]
    if p in set_AC_NO:
        continue
    if S=='AC':
        count_AC += 1
        set_AC_NO.add(p)
    else:
        count_WA += 1
print(count_AC,count_WA)

Submission status: Wrong Answer

Solution code:
import sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N,M = LI()
pS = [LS() for _ in range(M)]
count_AC,count_WA = 0,0
set_AC_NO = set()
for x in pS:
    p,S = int(x[0]),x[1]
    if not(p in set_AC_NO) and S=='AC':
        count_AC += 1
        set_AC_NO.add(p)
    elif not(p in set_AC_NO) and S=='WA':
        count_WA += 1
print(count_AC,count_WA)

Submission status: Wrong Answer

Solution code:
import sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N,M = LI()
pS = [LS() for _ in range(M)]
count_AC,count_WA = 0,0
now = 0
for x in pS:
    p,S = int(x[0]),x[1]
    if now!=p and S=='WA':
        count_WA += 1
    elif now!=p and S=='AC':
        count_AC += 1
        now = p
print(count_AC,count_WA)

Submission status: Wrong Answer

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

ans_dic = {}
pena_dic = {}
for ps in ps_list:
    p = int(ps[0])
    ans_dic[p] = 0
    pena_dic[p] = 0
ans = 0
pen = 0

for ps in ps_list:
    p, s = ps
    p = int(p)
    if s == 'WA':
        pena_dic[p] += 1
        if ans_dic[p] == 0:
            pen += 1
    elif s == 'AC':
        if ans_dic[p] == 0:
            ans += 1
        ans_dic[p] = 1
print(ans, pen)

Submission status: Wrong Answer

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

ac=[True]*n
tw=0
ta=0
for i in a:
  j=int(i[0])-1
  if (ac[j]):
    if (i[1]=="WA"):
      tw+=1
    else :
      ta+=1
      ac[j]=False
print(ta,tw)

Submission status: Wrong Answer

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


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n, m = input_to_int_map()
    ps = [input().split() for i in range(m)]

    success_cnt = [0] * (n + 1)
    wrong_cnt = [0] * (n + 1)

    for p, s in ps:
        if success_cnt[int(p)] > 0:
            continue

        if s == "AC":
            success_cnt[int(p)] += 1
        elif s == "WA":
            wrong_cnt[int(p)] += 1

    print(" ".join([str(sum(success_cnt)), str(sum(wrong_cnt))]))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
results = {}
for _ in range(M):
    q_val, res = input().split()
    if q_val not in results:
        results[q_val] = [res]
    else:
        results[q_val].append(res)
num_corr, num_wro = 0, 0

if not results:
    print(num_corr, num_wro)
else:
    for q in results.keys():
        for res in results[q]:
            if res == 'AC':
                num_corr += 1
                break
            elif res == 'WA':
                num_wro += 1

    print(num_corr, num_wro)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
AC = 0
WA = 0
lst = []
for _ in range(M):
    lst.append(list(input().split()))
#print(lst)

#ques = [[0,0]]*N # lest:AC right:WA
ques = [0]*N
#print(ques)

#tries = []
for i in range(M):
#    print(lst[i] in tries)
#    tries.append(lst[i])
    if ques[int(lst[i][0])-1] != 1:
        if lst[i][1] == 'WA':
            WA += 1
        else:
            AC += 1
            ques[int(lst[i][0])-1] = 1
print(str(AC) + ' ' + str(WA))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
AC = 0
WA = 0
lst = []
for _ in range(M):
    lst.append(list(input().split()))
ques = [0]*N

tries = []
for i in range(M):
    if ques[int(lst[i][0])-1] != 1:
        if lst[i][1] == 'WA':
            WA += 1
        else:
            AC += 1
            ques[int(lst[i][0])-1] += 1
print(str(AC) + ' ' + str(WA))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac_c = [False]*(n+1)
wa_c = [0]*(n+1)

for i in range(m):
    p,s=input().split()
    p = int(p)
    if(ac_c[p]):
        continue
    if(s=='WA'):
        wa_c[p] += 1
    if(s=='AC'):
        ac_c[p] = True

print(sum(ac_c),sum(wa_c))

Submission status: Wrong Answer

Solution code:
# 多分だめ
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 s=="WA":
        if AC[p]==0:
            WA[p]+=1
    else:
        AC[p]=1

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
done=[0]*n
pena=0
for i in range(m):
    p,s=input().split()
    p=int(p)-1
    if s=="WA":
        if done[p]==0:
            pena+=1
    else:
        done[p]=1

print(sum(done),pena)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
dicts = {key: [False,0] for key in range(1, n+1)}
for i in range(m):
    p, s = input().split()
    p = int(p)
    if s == "AC":
        dicts[p][0] = True
        continue
    else:
        if dicts[p][0]==True:
            continue
        else:
            dicts[p][1] += 1
print(dicts)
ans_list = [v[1] for k, v in dicts.items() if v[0]==True]
ans_n = len(ans_list)
penal = sum(ans_list)
print(ans_n,penal)

Submission status: Wrong Answer

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

AC, WA = [0] * n, [0] * n

ac, wa = 'AC', 'WA'

for i in range(m):
    if L[i][1] == ac and AC[int(L[i][0]) - 1] == 0:
        AC[int(L[i][0]) - 1] = 1
    elif L[i][1] == wa and AC[int(L[i][0]) - 1] == 0:
        WA[int(L[i][0]) - 1] += 1
sum_ac = sum(AC)
sum_wa = sum(WA)
print(sum_ac, end = ' ')
print(sum_wa)

Submission status: Wrong Answer

Solution code:
import sys
from io import StringIO
import unittest


def resolve():
    N, M = [int(i) for i in input().split()]
    pp = []
    SS = []
    for _ in range(M):
        p, s = [i for i in input().split()]
        pp.append(int(p))
        SS.append(s)
    AC = 0
    WA = 0
    flgs = [False] * N
    for i in range(M):
        if not flgs[pp[i] - 1]:
            if SS[i] == "AC":
                AC += 1
                flgs[pp[i] - 1] = True
            else:
                WA += 1

    print(AC, WA)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2 5
1 WA
1 AC
2 WA
2 AC
2 WA"""
        output = """2 2"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """100000 3
7777 AC
7777 AC
7777 AC"""
        output = """1 0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """6 0"""
        output = """0 0"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p_s = [input().split() for _ in range(m)]
problem = [0]*n
pena = 0
for i in range(m):
    if p_s[i][1] == 'WA':
        if problem[int(p_s[i][0])-1] == 0:
            pena += 1
    elif p_s[i][1] == 'AC':
        problem[int(p_s[i][0])-1] = 1

print(sum(problem), pena)

Submission status: Wrong Answer

Solution code:
NM = list(map(int, input().split()))
N = NM[0]; M = NM[1]
pS = [list(map(str, input().split())) for _ in range(M)]

process = [0]*N
resultWA = [0]*N
resultAC = 0

for i in range(M):
     if pS[i][1] == 'WA' and resultWA[int(pS[i][0])-1] == 0:
         process[int(pS[i][0])-1] += 1
     elif pS[i][1] == 'AC' and resultWA[int(pS[i][0])-1] == 0:
         resultWA[int(pS[i][0])-1] = process[int(pS[i][0])-1]
         resultAC += 1
L = [resultAC, sum(resultWA)]
print(' '.join(map(str, L)))

Submission status: Wrong Answer

Solution code:
n,m= list(map(int, input().split()))
ans_box=[0]*n
wa=0
ac=0
for j in range(m):
    k,l=input().split()
    h=int(k)-1
    if ans_box[h]==0:
        if l=="AC":
            ac+=1
            ans_box[h]+=1
        else:
            wa+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
L = []
cnt = 0
for _ in range(m):
    p, s = input().split()
    if p in L:
        continue
    else:
        if s == 'AC':
            L.append(p)
        else:
            cnt += 1
print(len(L), cnt)

Submission status: Wrong Answer

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

AC_count = 0
WA_count = 0
is_not_AC = {}

for m in range(M):
    p, S = input().split()
    p = int(p)
    
    if p not in is_not_AC.keys():
        is_not_AC[p] = True
        
    if is_not_AC[p]:
        if S=="WA":
            WA_count += 1
        else:
            AC_count += 1
            is_not_AC[p] = False
            
print(AC_count, WA_count)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
st,be,AC,WA="","",0,0

for i in range(m):
  p,s=input().split()
  
  if be==p:
    if st=="":
      if s=="WA":
        WA+=1
      else:
        AC+=1
        st="AC"
        
  else:
    st=""
    if s=="WA":
      WA+=1
    else:
      AC+=1
      st="AC"
      
  be=p
  
print(AC,WA)

Submission status: Wrong Answer

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

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+=1
  
print(sum(ac),wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
p = []
s = []
for _ in range(m):
    temp = input().split()
    p.append(int(temp[0]))
    s.append(temp[1])

ac = 0
pena = 0
flag = [False]*n

for pe, se in zip(p, s):
    if se == "AC":
        flag[pe-1] = True
    else:
        if flag[pe-1] is False:
            pena += 1

for i in range(n):
    if flag[i]:
        ac += 1

print(ac, pena)

Submission status: Wrong Answer

Solution code:
# ABC151C

n, m = map(int, input().split())
p = [0] * m
s = [0] * m
for i in range(m):
    p[i], s[i] = input().split()
    p[i] = int(p[i])
qno = set(p)
wa = 0
ac = 0
for q in qno:
    for i in range(m):
        if p[i] == q:
            if s[i] == 'WA':
                wa += 1
            else:
                ac += 1
                break
print(ac, wa)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N,M = map(int, input().split())
List = [list(input().split()) for i in range(M)]

ACList=[0]*N
WAList=[0]*N

i=0
while i<M:
    
    #print(ACList)
    #print(WAList)    
    
    if List[i][1]=="AC":
        ACList[int(List[i][0])-1]=1
    if List[i][1]=="WA" and ACList[int(List[i][0])-1]==0:
        WAList[int(List[i][0])-1]+=1
    i+=1

print(sum(ACList),sum(WAList))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = {}
ac = []
for i in range(M):
    p, s = map(str, input().split())
    if int(p) not in ac:
        if int(p) not in A.keys(): 
            if int(p) >0 and int(p) <=N :
                if s == "WA":
                    A[int(p)] =1
                elif s =="AC":
                    A[int(p)] =0
                    ac.append(int(p))
        elif int(p) in A.keys():
            if s == "WA":
                    A[int(p)] +=1
            elif s =="AC":
                    A[int(p)] +=0
                    ac.append(int(p))
        
total=0
count = 0
for k,v in A.items():
    if k in ac:
        count += 1
        total += v

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = {}
ac = []
for i in range(M):
    p, s = map(str, input().split())
    if int(p) not in ac:
        if int(p) not in A.keys(): 
            if int(p) >0 and int(p) <=N :
                if s == "WA":
                    A[int(p)] =1
                elif s =="AC":
                    A[int(p)] =0
        elif int(p) in A.keys():
            if s == "WA":
                    A[int(p)] +=1
            elif s =="AC":
                    A[int(p)] +=0
                    ac.append(int(p))
        
total=0
count = 0
for k,v in A.items():
    if k in ac:
        count += 1
        total += v
print(count, total)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = {}
ac = []
for i in range(M):
    p, s = map(str, input().split())
    if int(p) not in ac:
        if int(p) not in A.keys(): 
            if int(p) >0 and int(p) <=N :
                if s == "WA":
                    A[int(p)] =1
                elif s =="AC":
                    A[int(p)] =0
        elif int(p) in A.keys():
            if s == "WA":
                    A[int(p)] +=1
            elif s =="AC":
                    A[int(p)] +=0
                    ac.append(int(p))
        
total=0
count = 0
for k,v in A.items():
    if k in ac:
        count += 1
        total += i
print(count, total)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = {}
ac = []
for i in range(M):
    p, s = map(str, input().split())
    if int(p) not in ac:
        if int(p) not in A.keys(): 
            if int(p) >0 and int(p) <=N :
                if s == "WA":
                    A[int(p)] =1
                elif s =="AC":
                    A[int(p)] =0
        elif int(p) in A.keys():
            if s == "WA":
                    A[int(p)] +=1
            elif s =="AC":
                    A[int(p)] +=0
                    ac.append(int(p))
        
total=0
count = 0
for i in A.values():
    count += 1
    total += i
print(count, total)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
pl, sl = [], []

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

ac_F = [False] * (n + 1)
ans = [0, 0]

for i in range(m):
    if sl[i] == "AC":
        if not ac_F[pl[i]]:
            ans[0] += 1
            ac_F[pl[i]] = True
    else:
        if not ac_F[pl[i]]:
            ans[1] += 1

print(*ans)

Submission status: Wrong Answer

Solution code:


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

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

for i in range(m):
    if ps[i][1]=='WA' and ac[int(ps[i][0])-1]==0:
        wa[int(ps[i][0])-1]+=1
    else:
        if ac[int(ps[i][0])-1]==0:
            ac[int(ps[i][0])-1]+=1
        else:
            pass

ac_num=sum(ac)
wa_num=sum(wa)

print(ac_num,wa_num)

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
S = [input().split() for _ in range(m)]
S = [[int(s[0]), s[1]] for s in S]
acf = [0] * n
p = 0
for s in S:
    if s[1] == 'AC':
        acf[s[0] - 1] = 1
        continue
    elif acf[s[0] - 1] == 0:
        p += 1
        continue
ans = ' '.join(list(map(str, [sum(acf), p])))
print(ans)

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 = map(str, input().split())
    p = int(p) - 1
    if s == "AC":
        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())
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
    elif s=='WA':
      wa[p]+=1
  
print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
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
  
print(sum(ac),sum(wa))

Submission status: Wrong Answer

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

# check
AC_cnt = 0
WA_cnt = 0
AC_questions = {}
for i in range(M):
    P, S = map(str, input().split())

    if P not in AC_questions:
        AC_questions[P] = False

    if AC_questions[P] is True:
        continue
    elif S == "AC":
        AC_cnt += 1
        AC_questions[P] = True
    # S == "WA"
    else:
        WA_cnt += 1

print(AC_cnt, WA_cnt)

Submission status: Wrong Answer

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

# check
AC_cnt = 0
WA_cnt = 0
AC_questions = {}
for i in range(M):
    P, S = map(str, input().split())

    if P not in AC_questions:
        AC_questions[P] = False

    if AC_questions[P] is True:
        continue
    elif S == "AC":
        AC_cnt += 1
        AC_questions[P] = True
    else:
        WA_cnt += 1

print(AC_cnt, WA_cnt)