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())
wac=0
acc=0
p=0
ac=0
P=0
wa=0
for i in range(m):
    p,s=map(str,input().split())
    if s=="WA":
        wac+=1
    else:
        if int(p)!=P:
            ac+=1
            wa=wac
        P=int(p)
        
print(ac,wa)

Submission status: Wrong Answer

Solution code:
import sys
import fractions
from functools import reduce
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m = na()
flgs = [-1 for i in range(n)]
wa = 0
for i in range(m):
    p, s = stdin.readline().split()
    p = int(p)
    if flgs[p-1] == -1:
        if s == 'WA':
            wa += 1
        else:
            flgs[p-1] = 1
print(flgs.count(True), wa)

Submission status: Wrong Answer

Solution code:
import sys
import fractions
from functools import reduce
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m = na()
flgs = [False for i in range(n)]
wa = 0
for i in range(m):
    p, s = stdin.readline().split()
    p = int(p)
    if flgs[p-1] is False:
        if s == 'WA':
            wa += 1
        else:
            flgs[p-1] = True
    else:
        if s == 'WA':
            wa += 1
print(flgs.count(True), wa)

Submission status: Wrong Answer

Solution code:
import sys
import fractions
from functools import reduce
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m = na()
flgs = [False for i in range(n)]
wa = 0
for i in range(m):
    p, s = stdin.readline().split()
    p = int(p)
    if flgs[p-1] is False:
        if s == 'WA':
            wa += 1
        else:
            flgs[p-1] = True
print(flgs.count(True), wa)

Submission status: Wrong Answer

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

def main():
    n,m=map(int,input().split())
    w=0
    a=[0]*(n+1)
    for i in range(m):
        p,s=map(str,input().split())
        p=int(p)
        if a[p]==0:
            if s=='WA':
                w+=1
            else:
                a[p]=1
    print(sum(a),w)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

def main():
    n,m=map(int,input().split())
    w=[0]*(n+1)
    a=[0]*(n+1)
    for i in range(m):
        p,s=map(str,input().split())
        p=int(p)
        if a[p]==0:
            if s=='WA':
                w[p]+=1
            else:
                a[p]=1
    print(sum(a),sum(w))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

N, M = i_l()
ac = 0
wa = 0
arr = []
h = {}
for _ in range(M):
    p, s = input().split()
    arr.append([int(p), s])
    if h.get(int(p)) is None:
        h[int(p)] = [s] 
    else:
        h[int(p)].append(s)
        
        
for k in h.keys():
    for v in h[k]:
        if v == 'AC':
            ac += 1
            break
        else:
            wa += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ans = 0;pel = 0
ansArray = [0] * n
for i in range(m):
	a,b = map(str,input().split())
	a = int(a)
	if ansArray[a-1] == 0:
		if b == "AC":#first AC
			ans += 1
			ansArray[a-1] = 1
		else:
			pel += 1
print(' '.join(map(str,[ans,pel])))

Submission status: Wrong Answer

Solution code:
import math
N, M = map(int, input().split())
judge = [0]*N
ac = 0
wa = 0
for i in range(M):
  p, S = input().split()
  if judge[int(p)-1] == 'AC':
    pass
  elif S == 'AC':
    judge[int(p)-1] = 'AC'
    ac += 1
  else:
    wa += 1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
import math
N, M = map(int, input().split())
judge = [0]*10**5
ac = 0
wa = 0
for i in range(M):
  p, S = input().split()
  if judge[int(p)-1] == 'AC':
    pass
  elif S == 'AC':
    judge[int(p)-1] = 'AC'
    ac += 1
  else:
    wa += 1
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):
    problem,status=input().split()
    problem=int(problem)
 
    if status=='WA':
        if AC[problem-1]==1:
            continue
        else:
            WA[problem-1]+=1
    elif status=='AC':
        AC[problem-1]=1

for i in range(n):
    if AC[i]==0:
        WA[i]=0
print(AC,WA)
print(sum(AC),sum(WA))

Submission status: Wrong Answer

Solution code:

n,m=map(int,input().split())

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

for i in range(m):
    problem,status=input().split()
    problem=int(problem)

    if status=='WA' and AC[problem-1]==0:
        WA[problem-1]+=1
    elif status=='AC':
        AC[problem-1]+=1
print(sum(WA),sum(AC))

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
p=[0]*M
S=['']*M
for i in range(M):
	p[i],S[i]=input().split()
P=[int(s) for s in p]
a=0
b=0
c=0
d=0
for j,k in zip(P,S):
	if d!=j:
		c=0
	else:
		c=c
	if k=='AC':
		if c!=j:
			a+=1
			c+=j
		else:
			continue
	else:
		if c!=j:
			b+=1
	d=j
print(a)
print(b)

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
p=[0]*M
S=['']*M
for i in range(M):
	p[i],S[i]=input().split()
P=[int(s) for s in p]
a=0
b=0
c=0
d=0
for j,k in zip(P,S):
	if d!=j:
		c=0
	if k=='AC':
		if c!=j:
			a+=1
			c+=j
		else:
			continue
	else:
		if c!=j:
			b+=1
	d=j
print(a)
print(b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC = []
c = 0
p = 0
for _ in range(M):
    st = list(input())
    if st[-2:] == ["A","C"]:
        if st[:-3] not in AC:
            c += 1
            AC.append(st[:-3])
    else:
        if st[:-3] not in AC:
            p += 1
print(c, p)

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

lis = [0] * n
num = 0
for i in range(m):
     if lis[int(p[i])-1] == 0:
          if s[i] == 'WA':
               num += 1
          else:
               lis[int(p[i])-1] = 1
print(sum(lis),num)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def solve():
    N, M = map(int, input().split())
    d = defaultdict(int)
    e = defaultdict(int)
    for _ in range(M):
        a, b = input().split()
        a = int(a)
        if b == 'AC':
            e[a] = 1 # AC
        elif b == 'WA' and e[a] == 0:
            d[a] += 1 # WA

    ac = sum(e.values())

    wa = 0
    for k, v in e.items():
        wa += d[k]
    ans = [ac, wa]
    print(*ans)

# print(solve())

# def solve()が@return voidのとき
solve()

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':

	n,m = map(int,input().split())

	ac = 0
	wa = 0
	mae_x = 0
	flg = False

	for i in range(m):
		x,y = input().split()

		#違うなら無条件に追加
		if mae_x != x:
			flg = False
			if y == "AC":
				ac += 1
				flg = True
			else:
				wa += 1
		else:#同じなら
			if flg == False:
				if y == "AC":
					ac += 1
					flg = True
				else:
					wa += 1
		mae_x = x

	print(ac,wa)

Submission status: Wrong Answer

Solution code:
def resolve():
    import sys
    input = sys.stdin.readline
    n, m = map(int, input().split())
    a = list(input().split() for _ in range(m))
    flag = [-1]*n
    if m == 0:
        print("{} {}".format(0, 0))
        exit()
    miss = 0
    correct = 0
    for i in range(m):
        if flag[int(a[i][0])-1] == -1:
            if a[i][1] == "WA":
                miss += 1
            elif a[i][1] == "AC":
                correct += 1
                flag[int(a[i][0])-1] = 0
    print("{} {}".format(correct, miss))
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    import sys
    input = sys.stdin.readline
    n, m = map(int, input().split())
    if m == 0:
        print("{} {}".format(0, 0))
        exit()

    a = list(input().split() for _ in range(m))
    flag = [0]*2*n
    miss = 0
    correct = 0
    for i in range(m):
        if flag[int(a[i][0])] == 0:
            if a[i][1] == "WA":
                miss += 1
            elif a[i][1] == "AC":
                correct += 1
                flag[int(a[i][0])] = 1
    print("{} {}".format(correct, miss))
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    import sys
    input = sys.stdin.readline
    n, m = map(int, input().split())
    a = list(input().split() for _ in range(m))
    flag = [0]*2*n
    if m == 0:
        print("{} {}".format(0, 0))
        exit()
    miss = 0
    correct = 0
    for i in range(m):
        if flag[int(a[i][0])] == 0:
            if a[i][1] == "WA":
                miss += 1
            elif a[i][1] == "AC":
                correct += 1
                flag[int(a[i][0])] = 1
    print("{} {}".format(correct, miss))
resolve()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p, s = [], []
acdic = []
ans, tmp = 0, 0
for i in range(m):
    te, mp = input().split()
    p.append(te), s.append(mp)
    if p[i] not in acdic:
        if s[i] == 'WA':
            tmp += 1
        else:
            acdic.append(p[i])  
            ans += tmp  
            tmp = 0

print(len(acdic), ans)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p, s = [], []
acdic = []
ans, tmp = 0, 0
for i in range(m):
    te, mp = input().split()
    p.append(te), s.append(mp)
    if p[i] not in acdic:
        if s[i] == 'WA':
            tmp += 1
        else:
            acdic.append(p[i])  
            ans += tmp  

print(len(acdic), ans)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p, s = [], []
acdic = []
ans = 0
for i in range(m):
    te, mp = input().split()
    p.append(te), s.append(mp)
    if p[i] not in acdic:
        if s[i] == 'WA':
            ans += 1
        else:
            acdic.append(p[i])    

print(len(acdic), ans)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p, s = [], []
for i in range(m):
    te, mp = input().split()
    p.append(te), s.append(mp)

acdic = []
ans = 0
for i in range(m):
    if p[i] not in acdic:
        if s[i] == 'WA':
            ans += 1
        else:
            acdic.append(p[i])

print(len(acdic), ans)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p, s = [], []
for i in range(m):
    te, mp = input().split()
    p.append(te), s.append(mp)

acdic = []
ans = 0
for i in range(m):
    if p[i] not in acdic:
        if s[i] == 'WA':
            ans += 1
        else:
            acdic.append(p[i])

print(ans)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
A_list=[]
PS=[list(map(str,input().split())) for i in range(M) ]
ans=0
pena=0
for x in range(M):
    if PS[x][0] not in A_list:
        if PS[x][1]=='AC':
            A_list.append(PS[x][0])
            ans+=1
        else:
            pena+=1

print(ans,pena)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
A_list=[0]
PS=[list(map(str,input().split())) for i in range(M) ]
ans=0
pena=0
for x in range(M):
    if PS[x][0] not in A_list:
        if PS[x][1]=='AC':
            A_list.append(PS[x][0])
            ans+=1
        elif PS[x][1]=='WA':
            pena+=1

print(ans,pena)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
A_list=[N*0]
PS=[list(map(str,input().split())) for i in range(M) ]
ans=0
pena=0
for x in range(M):
    if PS[x][0] not in A_list:
        if PS[x][1]=='AC':
            A_list.append(PS[x][0])
            ans+=1
        else:
            pena+=1

print(ans,pena)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
A_list=[N*0]
PS=[list(map(str,input().split())) for i in range(M) ]
ans=0
pena=0
for x in range(M):
    if PS[x][0] not in A_list:
        if PS[x][1]=='AC':
            A_list.append(PS[x][0])
            ans+=1
    
    elif PS[x][0] not in A_list:
        if PS[x][1]=='WA':
            pena+=1

print(ans,pena)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
A_list=[N*0]
PS=[list(map(str,input().split())) for i in range(M) ]
ans=0
pena=0
for x in range(M):
    if PS[x][1]=='AC' and PS[x][0] not in A_list:
        A_list.append(PS[x][0])
        ans+=1
    
    elif PS[x][1]=='WA' and PS[x][0] not in A_list:
        pena+=1

print(ans,pena)

Submission status: Wrong Answer

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

print(cntAC, cntWA)

Submission status: Wrong Answer

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

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

print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
P=list(input().split() for _ in range(M))
manage={}
for n in range(N):
    manage[str(n+1)] = 0
wa=0
ac=0
for p in P:
    now=manage[p[0]]
    if p[1] == 'WA' and now == 0:
        wa+=1
    elif p[1] == 'AC' and now == 0:
        ac+=1
        manage[p[0]] = 1

print(ac,wa)

Submission status: Wrong Answer

Solution code:
print('reference')

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

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

a = 0
b = 0
for i in range(N):
    if ac[i]:
        a += 1
        b += wa[i]
print(*[a, b])

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l = [input().split(" ") for _ in range(m)]
#print(l)

x=[]
for k in range(m):
    x.append(int(l[k][0]))
x=list(set(x))
#print(x)    


temp=0
wa=0
ac=0
for i in x:
    for j in range(m):
        if l[j][0] == str(i):
            #print(l[j][0], str(i+1))
            if l[j][1]=='WA':
                temp+=1
            else:
                ac+=1
                wa+=temp
                temp=0
                break

    
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ac_list = []
wa = 0
for i in range(M):
    p, s = input().split()
    p = int(p)
    if p in ac_list: continue

    if s == 'WA':
        wa += 1
        
    else:
        ac_list.append(p)
        

print(len(ac_list), wa)

Submission status: Wrong Answer

Solution code:
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import heapq
import collections
import itertools
sys.setrecursionlimit(100001)

# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n, m = map(int, input().split())

data = []
for i in range(m):
    input_data = input().split()
    tmp_int = int(input_data[0]) -1
    tmp_str = str(input_data[1])
    data.append([tmp_int, tmp_str])
data.reverse()

bool_table = [False]*n

ans_ac = 0
ans_wa = 0

for d in data:
    if bool_table[d[0]] == False:
        if d[1] == "AC":
            ans_ac += 1
            bool_table[d[0]] = True
            continue
    if bool_table[d[0]] == True:
        if d[1] == "WA":
            ans_wa += 1

print(ans_ac, ans_wa)

Submission status: Wrong Answer

Solution code:
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import heapq
import collections
import itertools
sys.setrecursionlimit(100001)

# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n, m = map(int, input().split())

data = []
for i in range(m):
    input_data = input().split()
    tmp_int = int(input_data[0]) -1
    tmp_str = str(input_data[1])
    data.append([tmp_int, tmp_str])
data.reverse()

bool_table = [False]*n

ans_ac = 0
ans_wa = 0

for d in data:
    if bool_table[d[0]] == False:
        if d[1] == "AC":
            ans_ac += 1
            bool_table[d[0]] = True
    if bool_table[d[0]] == True:
        if d[1] == "WA":
            ans_wa += 1

print(ans_ac, ans_wa)

Submission status: Wrong Answer

Solution code:
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import heapq
import collections
import itertools
sys.setrecursionlimit(100001)

# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n, m = map(int, input().split())

data = []
for i in range(m):
    input_data = input().split()
    tmp_int = int(input_data[0]) -1
    tmp_str = str(input_data[1])
    data.append([tmp_int, tmp_str])

bool_table = [False]*n

ans_ac = 0
ans_wa = 0

for d in data:
    if bool_table[d[0]] == False:
        if d[1] == "WA":
            ans_wa += 1
        elif d[1] == "AC":
            ans_ac += 1
            bool_table[d[0]] = True

print(ans_ac, ans_wa)

Submission status: Wrong Answer

Solution code:
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import heapq
import collections
import itertools
sys.setrecursionlimit(100001)

# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n, m = map(int, input().split())

data = []
for i in range(m):
    input_data = input().split()
    tmp_int = int(input_data[0]) -1
    tmp_str = str(input_data[1])
    data.append([tmp_int, tmp_str])

bool_table = [False]*n

ans_ac = 0
ans_wa = 0

for d in data:
    if bool_table[d[0]] == False:
        if d[1] == "WA":
            ans_wa += 1
        else:
            ans_ac += 1
            bool_table[d[0]] = True

print(ans_ac, ans_wa)

Submission status: Wrong Answer

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

a = [0]*n
b = [False]*n
for i in range(m):
  p,s = input().split()
  p = int(p) - 1
  if s == 'AC':
    b[p] = True
  elif b[p] == False:
    a[p] += 1

ac = b.count(True)
wa = sum(a)
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
s = sorted([list(map(str,input().split())) for i in range(M)], key = lambda x: x[0])
for i in range(M):
    s[i][0] = int(s[i][0])
clear = 0
pena = 0
pena_pre = 0
if(M == 0):
    print("0 0")
else:
    problem = s[0][0]
    AC_flag = 0
    for i in range(M):
        if(s[i][0] != problem):
            problem = s[i][0]
            AC_flag = 0
        if(s[i][1] == "AC" and AC_flag == 0):
            clear += 1
            AC_flag = 1
            pena += pena_pre
            pena_pre = 0
        elif(s[i][1] == "WA" and AC_flag == 0):
            pena_pre += 1

    print(str(clear) + " " + str(pena))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
s = sorted([list(map(str,input().split())) for i in range(M)], key = lambda x: x[0])
for i in range(M):
    s[i][0] = int(s[i][0])
clear = 0
pena = 0
if(M == 0):
    print("0 0")
else:
    problem = s[0][0]
    AC_flag = 0
    for i in range(M):
        if(s[i][0] != problem):
            problem = s[i][0]
            AC_flag = 0
        if(s[i][1] == "AC" and AC_flag == 0):
            clear += 1
            AC_flag = 1
        elif(s[i][1] == "WA" and AC_flag == 0):
            pena += 1

    print(str(clear) + " " + str(pena))

Submission status: Wrong Answer

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

ans =[]
for i in range(m):
  if not(ps[i][0] in ans) :
    ans.append(ps[i][0])
    
wa = 0
ac = 0
for i in ans:
  for j in range(m):
    #問題番号の確認
    if ps[j][0] == str(i):
      if ps[j][1] =="WA":
        wa += 1
      elif ps[j][1] == "AC":
        ac += 1
        break

    else:
      continue
      
      
print(ac,wa)

Submission status: Wrong Answer

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

ans =[]
for i in range(m):
  if not(ps[i][0] in ans) :
    ans += ps[i][0]
    


wa = 0
ac = 0
for i in ans:
  for j in range(m):
    
    #問題番号の確認
    if ps[j][0] == str(i):
      if ps[j][1] =="WA":
        wa += 1
      elif ps[j][1] == "AC":
        ac += 1
        break

    else:
      continue
      
      
print(ac,wa)

Submission status: Wrong Answer

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

wa = 0
ac = 0
for i in range(1,n+1):
  for j in range(m):
    
    #問題番号の確認
    if ps[j][0] == str(i):
      if ps[j][1] =="WA":
        wa += 1
      elif ps[j][1] == "AC":
        ac += 1
        break

    else:
      continue
      
      
print(ac,wa)

Submission status: Wrong Answer

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

wa = 0
ac = 0
for i in range(1,n+1):
  for j in range(m):
    
    #問題番号の確認
    if ps[j][0] == str(i):
      if ps[j][1] =="WA":
        wa += 1
      elif ps[j][1] == "AC" and ac < i:
        ac += 1
        break

    else:
      continue
      
      
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
p = []
S = []
for i in range(M):
    a,b = map(str,input().split())
    p.append(int(a))
    S.append(b)
clear = 0
pena = 0
if(M == 0):
    print("0 0")
else:
    problem = p[0]
    AC_flag = 0
    for i in range(M):
        if(p[i] != problem):
            problem = p[i]
            AC_flag = 0
        if(S[i] == "AC" and AC_flag == 0):
            clear += 1
            AC_flag = 1
        elif(S[i] == "WA" and AC_flag == 0):
            pena += 1

    print(str(clear) + " " + str(pena))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ac=0
wa=0
mydict={}
w=[]
p=[]
for i in range(M):
    P,S=input().split()
    if S=="WA":
        if w.count(P)==0:
            mydict[P]=1
            w.append(P) 
        else:
            mydict[P]=mydict[P]+1
    else:
        if w.count(P)==0:
            ac=ac+1
            p.append(P)
            if w.count(P)!=0:
                wa=wa+mydict[P]
        else:
            pass
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ac=0
wa=0
mydict={}
w=[]
p=[]
for i in range(M):
    P,S=input().split()
    if S=="WA":
        if w.count(P)==0:
            mydict[P]=1
            p.append(P) 
        else:
            mydict[P]=mydict[P]+1
    else:
        if p.count(P)==0:
            ac=ac+1
            p.append(P)
            if w.count(P)!=0:
                wa=wa+mydict[P]
        else:
            pass
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ac=0
wa=0
mydict={}
w=[]
p=[]
for i in range(M):
    P,S=input().split()
    if S=="WA":
        if w.count(P)==0:
            mydict[P]=1
            p.append(P) 
        else:
            mydict[P]=mydict[P]+1
    else:
        if p.count(P)==0:
            ac=ac+1
            p.append(P)
            if w.count(P)!=0:
                wa=wa+mydict[P]
        else:
            pass
print(wa,ac)

Submission status: Wrong Answer

Solution code:
#C
n,m=map(int,input().split())
f=False
ps=[]
AC=[0]*n
WA=[0]*n
for i in range(m):
    ps.append(list(input().split()))
for i in range(m):
    if ps[i][1]=='AC'and AC[int(ps[i][0])-1]==0:
        AC[int(ps[i][0])-1]=1
    if ps[i][1]=='WA'and WA[int(ps[i][0])-1]==0:
        WA[int(ps[i][0])-1]+=1
wasum=0
for i in range(n):
    if AC[i]==1:
        wasum+=WA[i]
print(sum(AC),wasum)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
ps = []
AC = [0]*N
WA = [0]*N
for _ in range(M):
  ps.append(list(input().split()))
for i in range(len(ps)):
  if ps[i][1] == 'AC' and AC[int(ps[i][0])-1] == 0:
    AC[int(ps[i][0])-1] = 1
  if ps[i][1] == 'WA' and AC[int(ps[i][0])-1] == 0:
    WA[int(ps[i][0])-1] += 1
print(sum(AC), sum(WA))

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
ps = []
AC = [0]*N
WA = [0]*N
for _ in range(M):
  ps.append(list(input().split()))
for i in range(M):
  if ps[i][1] == 'AC' and AC[int(ps[i][0])-1] == 0:
    AC[int(ps[i][0])-1] = 1
  if ps[i][1] == 'WA' and AC[int(ps[i][0])-1] == 0:
    WA[int(ps[i][0])-1] += 1
print(sum(AC), sum(WA))

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
ps = []
AC = [0]*N
WA = [0]*N
for _ in range(M):
  ps.append(list(input().split()))
for i in range(M):
  if ps[i][1] == 'AC' and AC[int(ps[i][0])-1] == 0:
    AC[int(ps[i][0])-1] = 1
  elif ps[i][1] == 'WA' and AC[int(ps[i][0])-1] == 0:
    WA[int(ps[i][0])-1] += 1
print(sum(AC), sum(WA))

Submission status: Wrong Answer

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

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

P, S = [], []
counter1 = {}
counter2 = {}
for _ in range(M):
    p, s = input().split()
    p = int(p)
    P.append(p)
    S.append(s)

    if s == 'WA':
        if p not in counter2:
            counter2[p] = 1
        elif p not in counter1:
            counter2[p] += 1
    else:
        if p not in counter1:
            counter1[p] = 1

v1 = sum(counter1.values())
v2 = sum(counter2.values())
print(v1, v2)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
p=[0]*M
S=[" "]*M
t=[0]*N
acnt=0
pcnt=0
for i in range(M):
    p[i],S[i]=input().split()
    p[i]=int(p[i])
    if t[p[i]-1]==0:
        if S[i]=="AC":
            acnt+=1
            t[p[i]-1]=1
        else:
            pcnt+=1
print(acnt,pcnt)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
p=[0]*M
S=[" "]*M
t=[0]*16777216
acnt=0
pcnt=0
for i in range(M):
    p[i],S[i]=input().split()
    p[i]=int(p[i])
    if t[p[i]]==0:
        if S[i]=="AC":
            acnt+=1
            t[p[i]]=1
        else:
            pcnt+=1
print(acnt,pcnt)

Submission status: Wrong Answer

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

wa = 0
for _ in range(M):
  p, s = input().split()
  index = int(p)-1
  if s == 'AC':
    wa += P[index]
    P[index] = -1
  elif P[index] != -1:
      P[index] += 1
  
print(P.count(-1), wa)

Submission status: Wrong Answer

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

wa = 0
for _ in range(M):
  p, s = input().split()
  p = int(p)
  if s == 'AC':
    P[p-1] = False
  elif P[p-1]:
      wa += 1
  
print(P.count(False), wa)