Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
n,m = map(int, input().split())
 
arS = [False] * (n+1)
 
score = 0
penalty = 0
for i in range(m):
	id, res = input().split()
	id = int(id)
#	print(type(id),type(res))
	if (res == "AC") and (arS[id]==False):
		arS[id] = True
		score = score+1
	if (res == "WA"): 
		penalty = penalty + 1
        
print(score, penalty)

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

arS = [0] * 100000
#arP = [0] * 100000

score = 0
penalty = 0
for i in range(m):
	id, res = input().split()
	id = int(id)
	if res == "AT" and arS[id]==0:
		arS[id] = 1
		score = score+1
	if res =="WA": 
#		arP[id] = arP[id] + 1
		penalty = penalty + 1
print(score, penalty)

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

arS = [0] * 100000

score = 0
penalty = 0

for i in range(m):
	id, res = input().split()
	id = int(id)
	if res == "AT" and arS[id]==0:
		arS[id] = 1
		score = score + 1
	if res =="WA" and arS[id]==0: 
		penalty = penalty + 1
print(score, penalty)

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

arS = [False] * n

score = 0
penalty = 0
for i in range(m):
	id, res = input().split()
	id = int(id)
#	print(type(id),type(res))
	if (res == "AC") and (arS[id]==False):
		arS[id] = True
		score = score+1
	if (res == "WA") and (arS[id]==False): 
		penalty = penalty + 1
        
print(score, penalty)

n,m = map(int, input().split())
 
arS = [False] * (n+1)
arP = [False] * (n+1)
 
score = 0
penalty = 0

for i in range(m):
	id, res = input().split()
	id = int(id)
	if (res == "AC") and (arS[id]==False):
		arS[id] = True
		score = score+1
        penalty = penalty * arP[id]
	if (res == "WA"): 
		arP[id] = arP[id] + 1
        
print(score, penalty)

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

arS = [0] * 100000
arP = [0] * 100000

score = 0
penalty = 0
for i in range(m):
	id, res = input().split()
	id = int(id)
	if res == "AT" and arS[id]==0:
		arS[id] = 1
		score = score+1
	if res =="WA": 
		arP[id] = arP[id] + 1
		penalty = penalty + 1
print(score, penalty)
    

n,m = map(int, input().split())
 
arS = [False] * (n+1)
 
score = 0
penalty = 0
for i in range(m):
	id, res = input().split()
	id = int(id)
#	print(type(id),type(res))
	if (res == "AC") and (arS[id]==False):
		arS[id] = True
		score = score+1
	if (res == "WA")  # and (arS[id]==False): 
		penalty = penalty + 1
        
print(score, penalty)

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

arS = [0] * 100000
#arP = [0] * 100000

score = 0
penalty = 0
for i in range(m):
	id, res = input().split()
	id = int(id)
	if res == "AT" and arS[id]==0:
		arS[id] = 1
		score = score+1
	if res =="WA" and arS[id]==0: 
#		arP[id] = arP[id] + 1
		penalty = penalty + 1
print(score, penalty)
    

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

arS = [0] * 100000

score = 0
penalty = 0
for i in range(m):
	id, res = input().split()
	id = int(id)
	if res == "AT" and arS[id]==0:
		arS[id] = 1
		score = score+1
	if res =="WA" and arS[id]==0: 
		penalty = penalty + 1
print(score, penalty)

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

arS = [0] * 100
#arP = [0] * 100000

score = 0
penalty = 0
for i in range(m):
	id, res = input().split()
	id = int(id)
	if res == "AT" and arS[id]==0:
		arS[id] = 1
		score = score+1
	if res =="WA": 
#		arP[id] = arP[id] + 1
		penalty = penalty + 1
print(score, penalty)

n,m = map(int, input().split())
 
arS = [False] * (n+1)
arP = [False] * (n+1)
 
score = 0
penalty = 0

for i in range(m):
	id, res = input().split()
	id = int(id)
	if (res == "AC") and (arS[id]==False):
		arS[id] = True
		score = score+1
		penalty = penalty + arP[id]
	if (res == "WA"): 
		arP[id] = arP[id] + 1
        
print(score, penalty)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Accepted