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:
# -*- coding: utf-8 -*-
import numpy as np
iNum, iM = list(map(int, input().split()))
naB = np.zeros(iNum, dtype = "bool")
iW = 0
for _ in range(iM):
  l = input().split()
  iP = int(l[0]) - 1
  if not(naB[iP]):
    if l[1] == "AC":
      naB[iP] = True
    else:
      iW += 1
print("{} {}".format(np.count_nonzero(naB), iW))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
iNum, iM = list(map(int, input().split()))
naB = np.zeros(iNum, dtype = "bool")
lPM= []
for _ in range(iM):
  l = input().split()
  lPM.append( [int(l[0]), l[1]] )
iW = 0
for iP, s in lPM:
  if not(naB[iP-1]):
    if s == "AC":
      naB[iP-1] = True
    else:
      iW += 1
print("{} {}".format(np.count_nonzero(naB), iW))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
class A:
  def __init__(self):
    self.l = []
    self.i = 0
  def find(self):
    l = self.l
    while l != []:
      if l[0] == self.i:
        break
      if l[0] > self.i:
        l = l[1]
      else:
        l = l[2]
    if l == []:
      self.b = True
    else:
      self.b = False
  def toroku(self):
    l = self.l
    while l != []:
      if l[0] > self.i:
        l = l[1]
      else:
        l = l[2]
    l.append(self.i)
    l.append([])
    l.append([])
    
    

iNum, iM = list(map(int, input().split()))
lPM= []
a  = A()
for _ in range(iM):
  l = input().split()
  lPM.append( [int(l[0]), l[1]] )
iC = 0
iW = 0
for iP, s in lPM:
  a.i = iP
  a.find()
  #print(iP, a.b)
  if a.b:
    if s == "AC":
      iC += 1
      a.toroku()
    else:
      iW += 1
print("{} {}".format(iC, iW))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
class A:
  def __init__(self, iNum):
    self.l = []
    self.i = 0
  def find(self, l):
    if l == []:
      self.b = True
    elif l[0] == self.i:
      self.b = False
    elif l[0] > self.i:
      self.find(l[1])
    elif l[0] < self.i:
      self.find(l[2])
  def toroku(self, l):
    if l == []:
      l.append(self.i)
      l.append([])
      l.append([])
    elif l[0] > self.i:
      self.toroku(l[1])
    elif l[0] < self.i:
      self.toroku(l[2])
    

iNum, iM = list(map(int, input().split()))
lPM= []
a  = A(iNum)
for _ in range(iM):
  l = input().split()
  lPM.append( [int(l[0]), l[1]] )
iC = 0
iW = 0
for iP, s in lPM:
  a.i = iP
  #print(iP, a.find(a.l))
  a.find(a.l)
  if a.b:
    if s == "AC":
      iC += 1
      a.toroku(a.l)
    else:
      iW += 1
print("{} {}".format(iC, iW))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
class A:
  def __init__(self, iNum):
    self.l = []
    self.i = 0
  def find(self, l):
    if l == []:
      return True
    elif l[0] == self.i:
      return False
    elif l[0] > self.i:
      return self.find(l[1])
    elif l[0] < self.i:
      return self.find(l[2])
  def toroku(self, l):
    if l == []:
      l.append(self.i)
      l.append([])
      l.append([])
    elif l[0] > self.i:
      self.toroku(l[1])
    elif l[0] < self.i:
      self.toroku(l[2])
    

iNum, iM = list(map(int, input().split()))
lPM= []
a  = A(iNum)
for _ in range(iM):
  l = input().split()
  lPM.append( [int(l[0]), l[1]] )
iC = 0
iW = 0
for iP, s in lPM:
  a.i = iP
  #print(iP, a.find(a.l))
  if a.find(a.l):
    if s == "AC":
      iC += 1
      a.toroku(a.l)
    else:
      iW += 1
print("{} {}".format(iC, iW))

Submission status: Wrong Answer

Solution code:
class A:
  def __init__(self, iNum):
    self.l = [iNum/2 +0.1, [], []]
    self.i = 0
  def find(self, l):
    if l == []:
      return False
    elif l[0] == self.i:
      return True
    elif l[0] > self.i:
      return self.find(l[1])
    elif l[0] < self.i:
      return self.find(l[2])
  def toroku(self, l):
    if l == []:
      l.append(self.i)
      l.append([])
      l.append([])
    elif l[0] > self.i:
      self.toroku(l[1])
    elif l[0] < self.i:
      self.toroku(l[2])
    

iNum, iM = list(map(int, input().split()))
lPM= []
a  = A(iNum)
for _ in range(iM):
  l = input().split()
  lPM.append( [int(l[0]), l[1]] )
iC = 0
iW = 0
for iP, s in lPM:
  a.i = iP
  if a.find(a.l):
    continue
  elif s == "AC":
    iC += 1
    a.toroku(a.l)
  else:
    iW += 1
print("{} {}".format(iC, iW))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
class A:
  def __init__(self):
    self.l = []
    self.i = 0
  def find(self, l):
    if l == []:
      return False
    elif l[0] == self.i:
      return True
    elif l[0] > self.i:
      return self.find(l[1])
    elif l[0] < self.i:
      return self.find(l[2])
  def toroku(self, l):
    if l == []:
      l.append(self.i)
      l.append([])
      l.append([])
    elif l[0] > self.i:
      self.toroku(l[1])
    elif l[0] < self.i:
      self.toroku(l[2])
    

iNum, iM = list(map(int, input().split()))
lPM= []
lC = []
a  = A()
for _ in range(iM):
  l = input().split()
  lPM.append( [int(l[0]), l[1]] )
iC = 0
iW = 0
for iP, s in lPM:
  a.i = iP
  if a.find(a.l):
    continue
  elif s == "AC":
    iC += 1
    a.toroku(a.l)
  elif s == "WA":
    iW += 1
print("{} {}".format(iC, iW))

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
N,M=map(int,input().split())
result=[0]*N
AC=0
pena=0
for _ in range(M):
    p,S=map(str,input().split())
    p=int(p)
    if S=='AC':
        if result[p-1]==0:
            AC+=1
            result[p-1]=1
    else:
        if result[p-1]==0:
            pena+=1
print(AC,pena)

Submission status: Wrong Answer

Solution code:
#AtCoder
from collections import defaultdict
N, M = map(int, input().split())

d = defaultdict(list)
for i in range(M):
    p, S = input().split()
    d[int(p)].append(S)

a = 0
p = 0
for i in d.items():
    if 'AC' not in i[1]:
        p += len(i[1])
        continue

    ac_index = i[1].index('AC')
    a += 1

    if 'WA' in i[1]:
        wanum = i[1][:ac_index]
        p += len(wanum)

print(a, p)

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
N,M=map(int,input().split())
result=[0]*N
AC=0
pena=0
for _ in range(M):
    p,S=map(str,input().split())
    p=int(p)
    if S=='AC' and result[p-1]==0:
            AC+=1
            result[p-1]=1
    else:
        if result[p-1]==0:
            pena+=1
print(AC,pena)

Submission status: Wrong Answer

Solution code:
#AtCoder
from collections import defaultdict
N, M = map(int, input().split())

d = defaultdict(list)
for i in range(M):
    p, S = input().split()
    d[int(p)].append(S)

a = 0
p = 0

for i in d.items():
    if 'AC' not in i[1]:
        p += len(i[1])
        continue

    ac_index = i[1].index('AC')
    a += 1
    wanum = i[1][:ac_index]
    p += len(wanum)

print(a, p)

Submission status: Wrong Answer

Solution code:

n, m = map(int, input().split())
solved = {}
penalty = {}
for case in range(m):
    p, s = input().split()
    p = int(p)

    if s=='AC':
        solved[p] = True
    else: ## s is WA
        if p in solved:
            continue ## ignore
        else:
            penalty[p] = True

print(len(solved), len(penalty))

Submission status: Wrong Answer

Solution code:

n, m = map(int, input().split())
solved = {}
penalty = 0
for case in range(m):
    p, s = input().split()
    p = int(p)

    if s=='AC':
        solved[p] = True
    else: ## s is WA
        if p in solved:
            continue ## ignore
        else:
            penalty+=1

print(len(solved), penalty)

Submission status: Wrong Answer

Solution code:
#AtCoder
from collections import defaultdict
N, M = map(int, input().split())

d = defaultdict(list)
for i in range(M):
    p, S = input().split()
    d[int(p)].append(S)

a = 0
p = 0

for i in d.items():
    if 'AC' not in i[1]:
        p += len(i[1])
        continue

    if i[1].index('AC'):
        ac_index = i[1].index('AC')
        a += 1
        wanum = i[1][:ac_index]
        p += len(wanum)

print(a, p)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ERR = COR = 0
correct = []

num = [0]*M
res = [0]*M

for i in range(M):
    num[i], res[i] = input().split()

    if (res[i] == 'AC' and correct.count(num[i]) == 0 ):
        COR += 1
        correct.append(num[i])
    if (res[i] == 'WA' and correct.count(num[i]) == 0):
        ERR += 1

print(COR, ERR)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ps = []
d = {}
for i in range(M):
    p, s = input().split()
    ps.append([p, s])
    d[p] = "WA"

ac, wa = 0, 0
for p, s in ps:
    if s == "AC" and d[p] == "WA":
        d[p] = s
        ac += 1
        continue

    if s == "WA" and d[p] == "WA":
        wa += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:

N,M = map(int,input().split())
ps = [list(map(str,input().split())) for _ in range(M)]

wacnt = [0]*(N+1)
is_ac = [False]*(N+1)
for pp,s in ps:
    p = int(pp)
    if s=='AC':
        is_ac[p] = True
    else:
        if not is_ac[p]:
            wacnt[p] += 1

ans = 0
for l in range(N+1):
    if is_ac[l]:
       ans += wacnt[l]
       
print(ans)

Submission status: Wrong Answer

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

problem_list = {}

for i in range(m):
    p, s = list(input().split())
    if p in problem_list.keys():
        if problem_list[p][1] == 1:
            continue
        else:
            if s == "AC":
                problem_list[p][1] += 1
            else:
                problem_list[p][0] += 1
    else:
        if s == "AC":
            problem_list[p] = [0, 1]
        else:
            problem_list[p] = [1, 0]
            
correct = 0
penalty = 0

for v in problem_list.values():
    p, c = v
    correct += c
    penalty += p
    
print(str(correct) + " " + str(penalty))

Submission status: Wrong Answer

Solution code:
data=[int(x) for x in input().split()]
AC=set()
count=0
for i in range(data[1]):
  score=[x for x in input().split()]
  if score[1].find("AC")==0:
    AC.add(score[0])
  elif score[1].find("WA")==0 and not score[0] in AC:
    count=count+1
print(len(AC),count)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
results = []
passed = 0
failed = 0
dicto = {}
for item in results:
    key = item[0]
    status = item[1]
    if key not in dicto.keys():
        dicto[key] = []
        dicto[key].append(status)
    else:
        # status exists in dicto[key] already
        if 'AC' not in dicto[key]:
            dicto[key].append(status)
for item in dicto:
    if 'AC' in item:
        for i in item:
            if i == 'WA':
                failed += 1
        passed += 1

print(passed, failed)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
passed = 0
failed = 0
passtest = False
temphldr = 0
failtracker = 0
for i in range(m):
    key, status = input().split()
    if temphldr != key and temphldr != 0:
        # test you are looking at has changed
        if passtest:
            failed += failtracker
            failtracker = 0
        passtest = False
    temphldr = key
    if not passtest:
        if status == 'AC':
            passed += 1
            passtest = True
        else:
            failtracker += 1
if passtest:
    failed += failtracker
# passed = 0
# failed = 0
# dicto = {}
# for item in results:
#     key = item[0]
#     status = item[1]
#     if key not in dicto.keys():
#         dicto[key] = []
#         dicto[key].append(status)
#     else:
#         # status exists in dicto[key] already
#         if 'AC' not in dicto[key]:
#             dicto[key].append(status)
# for item in dicto:
#     if 'AC' in item:
#         for i in item:
#             if i == 'WA':
#                 failed += 1
#         passed += 1

print(passed, failed)

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()
  
  if s == "AC":
    AC[int(p)-1] = 1
  elif s == "WA" and AC[int(p)-1] < 1:
    WA[int(p)-1] += 1
  
print(sum(AC), sum(WA))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
results = []
for i in range(m):
    results.append(input().split())
passed = 0
failed = 0
dicto = {}
for item in results:
    key = item[0]
    status = item[1]
    if key not in dicto.keys():
        dicto[key] = []
        dicto[key].append(status)
        if status == 'WA':
            failed += 1
        else:
            passed += 1
    else:
        # key exists already and has something in it
        if status not in dicto[key]:
            # status not in dicto[key]
            if status == 'AC':
                # failed is in dicto[key]
                passed += 1
            dicto[key].append(status)
        else:
            # status already exists in dicto[key]
            if 'AC' not in dicto[key]:
                # you got WA and didn't finish the challenge already
                failed += 1
print(passed, failed)

Submission status: Wrong Answer

Solution code:

n,m=list(map(int,input().split()))
wa=[0 for _ in range(n)]
ac=[False for _ in range(n)]
for _ in range(m):
    p,s=input().split()
    p=int(p)-1
    if ac[p]:
        continue
    if s=="AC":
        ac[p]=True
    else:
        wa[p]+=1
print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
results = []
for i in range(m):
    results.append(input().split())
passed = 0
failed = 0
dicto = {}
for item in results:
    key = item[0]
    status = item[1]
    if key not in dicto.keys():
        dicto[key] = []
        dicto[key].append(status)
        if status == 'WA':
            failed += 1
        else:
            passed += 1
    else:
        # key exists already and has something in it
        if status not in dicto[key]:
            # status not in dicto[key]
            if status == 'AC':
                # failed is in dicto[key]
                passed += 1
            dicto[key].append(status)
        else:
            # status already exists in dicto[key]
            if status == 'WA' and 'AC' not in dicto[key]:
                failed += 1
print(passed, failed)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
results = []
for i in range(m):
    results.append(input().split())
passed = 0
failed = 0
dicto = {}
for item in results:
    key = item[0]
    status = item[1]
    if key not in dicto.keys():
        dicto[key] = []
        dicto[key].append(status)
        if status == 'WA':
            failed += 1
        else:
            passed += 1
    else:
        # key exists already and has something in it
        if status not in dicto[key]:
            # status not in dicto[key]
            if status == 'AC':
                # failed is in dicto[key]
                passed += 1
            dicto[key].append(status)
        else:
            # status already exists in dicto[key]
            if status == 'WA' and 'AC' not in dicto[key]:
                failed += 1
print(failed, passed)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
results = []
for i in range(m):
    results.append(input().split())
passed = 0
failed = 0
dicto = {}
for item in results:
    key = item[0]
    status = item[1]
    if key not in dicto.keys():
        dicto[key] = []
        dicto[key].append(status)
        if status == 'WA':
            failed += 1
        else:
            passed += 1
    else:
        # key exists already and has something in it
        if status not in dicto[key]:
            # item not in dicto[key]
            if status == 'AC':
                # failed is in dicto[key]
                passed += 1
            dicto[key].append(status)
        else:
            # status already exists in dicto[key]
            if status == 'WA' and 'AC' not in dicto[key]:
                failed += 1
print(passed, failed)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
results = []
for i in range(m):
    results.append(input().split())
passed = 0
failed = 0
dicto = {}
for item in results:
    key = item[0]
    status = item[1]
    if key not in dicto.keys():
        dicto[key] = []
        dicto[key].append(status)
        if status == 'WA':
            failed += 1
        else:
            passed += 1
    else:
        # key exists already and has something in it
        if status not in dicto[key]:
            # item not in dicto[key]
            if status == 'AC':
                # failed is in dicto[key]
                passed += 1
            dicto[key].append(status)
        else:
            # status already exists in dicto[key]
            if status == 'WC':
                if 'AC' not in dicto[key]:
                    failed += 1
print(passed, failed)

Submission status: Wrong Answer

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

flags = [False]*N
kari = [0]*N
good = 0
bad = 0

for i in range(M):
    p,S = input().split()

    if flags[int(p)-1]:
        continue
    if S == 'AC':
        good+=1
        flags[int(p)-1] = True
    elif S == 'WA':
        bad+=1

print(str(good) + ' ' + str(bad))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split(' '))
a = {}
b = 0
c = 0
for q in range(m):
    p, s = map(str, input().split(' '))
    if p not in a:
        if s == 'AC':
            a[p] = 1
            b += 1
        else:
            a[p] = 0
            c += 1
    else:
        if a[p] == 1:
            continue
        else:
            if s == 'AC':
                a[p] = 1
                b += 1
            else:
                c += 1
print(b, c)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
results = []
for i in range(m):
    results.append(input().split())
passed = 0
failed = 0
dicto = {}
for item in results:
    if item[0] not in dicto.keys():
        dicto[item[0]] = []
        dicto[item[0]].append(item[1])
        if item[1] == 'WA':
            failed += 1
        else:
            passed += 1
    else:
        # key exists already
        if item[1] not in dicto[item[0]]:
            # item not in dict
            if item[1] == 'AC':
                passed += 1
            dicto[item[0]].append(item[1])
        else:
            # item already exists in dict
            if item[1] == 'WC':
                if 'AC' not in dicto[item[0]]:
                    failed += 1
print(passed, failed)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split(' '))
a = {}
b = 0
c = 0
for l in range(m):
    p, s = map(str, input().split(' '))
    if p not in a:
        if s == 'AC':
            a[p] = 1
            b += 1
        else:
            a[p] = 0
            c += 1
    else:
        if a[p] == 1:
            continue
        else:
            if s == 'AC':
                a[p] = 1
                b += 1
            else:
                c += 1
print(b, c)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
results = []
for i in range(m):
    results.append(input().split())
passed = 0
failed = 0
dicto = {}
for item in results:
    if item[0] not in dicto.keys():
        dicto[item[0]] = []
        dicto[item[0]].append(item[1])
        if item[1] == 'WA':
            failed += 1
        else:
            passed += 1
    else:
        if item[1] not in dicto[item[0]]:
            dicto[item[0]].append(item[1])
            if item[1] == 'AC':
                passed += 1
        else:
            if item[1] == 'WA' and 'AC' not in dicto[item[0]]:
                dicto[item[0]].append(item[1])
                failed += 1
print(passed, failed)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split(' '))
a = {}
b = 0
c = 0
for n in range(m):
    p, s = map(str, input().split(' '))
    if p not in a:
        if s == 'AC':
            a[p] = 1
            b += 1
        else:
            a[p] = 0
            c += 1
    else:
        if a[p] == 1:
            continue
        else:
            if s == 'AC':
                a[p] = 1
                b += 1
            else:
                c += 1
print(b, c)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
results = []
for i in range(m):
    results.append(input().split())
passed = 0
failed = 0
dicto = {}
for item in results:
    if item[0] not in dicto.keys():
        dicto[item[0]] = []
        dicto[item[0]].append(item[1])
        if item[1] == 'WA':
            failed += 1
        else:
            passed += 1
    else:
        if item[1] not in dicto[item[0]]:
            dicto[item[0]].append(item[1])
            if item[1] == 'AC':
                passed += 1
        else:
            if item[1] == 'WA' and 'AC' not in dicto[item[0]]:
                failed += 1
print(passed, failed)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split(' '))
a = {}
b = 0
for n in range(m):
    p, s = map(str, input().split(' '))
    if p not in a:
        if s == 'AC':
            a[p] = 1
        else:
            a[p] = 0
            b += 1
    else:
        if a[p] == 1:
            continue
        else:
            if s == 'AC':
                a[p] = 1
            else:
                a[p] += 1
                b += 1
print(len(a), b)

Submission status: Wrong Answer

Solution code:
import numpy as np

N,M = map(int, input().split())
p = [input().split() for i in range(int(M))]

p = np.array(p)

cnt_penalty =0
cnt_answer =0

# print(p)
for j in range(N):
    for i in range(M):
        if p[i][1] =="AC":
            cnt_answer = cnt_answer +1
#                 print("cnt_answer")
            break
        elif p[i][1] =="WA":
            cnt_penalty = cnt_penalty +1
#                 print("cnt_penalty")
#     else:
#         continue
#     continue
                
print(cnt_answer)
print(cnt_penalty)

Submission status: Wrong Answer

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

cnt_penalty =0
cnt_answer =0

# print(p)
for j in range(N):
    for i in range(M):
        if int(p[i][0]) == j +1:
            if p[i][1] =="AC":
                cnt_answer = cnt_answer +1
#                 print("cnt_answer")
                break
            elif p[i][1] =="WA":
                cnt_penalty = cnt_penalty +1
#                 print("cnt_penalty")
#     else:
#         continue
#     continue
                
print(cnt_answer)
print(cnt_penalty)

Submission status: Wrong Answer

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


cnt_penalty =0
cnt_answer =0

# print(p)
for j in range(N):
    for i in range(M):
        if int(p[i][0]) == j +1:
            if p[i][1] =="AC":
                cnt_answer = cnt_answer +1
#                 print("cnt_answer")
                break
                j = j +1
            elif p[i][1] =="WA":
                cnt_penalty = cnt_penalty +1
#                 print("cnt_penalty")
#     else:
#         continue
#     continue
                
print(cnt_answer)
print(cnt_penalty)

Submission status: Wrong Answer

Solution code:
n = [int(e) for e in input().split(" ")]
h = [False for i in range(n[0])]
ac = 0
wa = 0
for _ in range(n[1]):
    raw = input().split(" ")
    line = [int(raw[0]) - 1, raw[1] == "AC"]
    if(not h[line[0]]):
        if(not line[1]):
            wa += 1
        else:
            h[line[0]] = True
            ac += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n = [int(e) for e in input().split(" ")]
h = [False for i in range(n[0])]
ac = 0
wa = 0
for _ in range(n[1]):
    raw = input().split(" ")
    line = [int(raw[0]) - 1, raw[1] == "AC"]
    if(not h[line[0]]):
        if(not line[1]):
            wa += 1
        else:
            h[line[0]] = True
            ac += 1

print(ac, end=" ")
print(wa)

Submission status: Wrong Answer

Solution code:
#python3

class Problem:
    def __init__(self, status):
        self.status = status
        self.penalties = 0

n,m = map(int, input().split())
data = []
for _ in range(m):
    x, y = map(str, input().split())
    data.append((x, y))

problems = {str(i+1): Problem('-') for i in range(n)}



for number, isAC  in data:
    if problems[number].status == 'AC':
        continue
    else: 
        if isAC == 'AC':
            problems[number].status = 'AC'
        elif isAC == 'WA':
            problems[number].penalties += 1 

cntACproblems = 0
cntPenalties = 0

for problem in problems.values():
    if problem.status == 'AC': 
        cntACproblems += 1 
    cntPenalties += problem.penalties

print(str(cntACproblems) + ' ' + str(cntPenalties))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
action = [list(input().split()) for _ in range(m)]
answer_dict = {}
score = 0
penalty = 0

for a in action:
    if a[0] not in answer_dict:
        if a[1] == 'WA':
            answer_dict[a[0]] = 1
            penalty += 1
        else:
            score += 1
            answer_dict[a[0]] = 'AC'
    else:
        if answer_dict[a[0]] != 'AC':
            if a[1] == 'WA':
                answer_dict[a[0]] += 1
                penalty += 1
            else:
                score += 1
                answer_dict[a[0]] = 'AC'

print(score,penalty)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
count=0
number=0
for q in range(M):
    q = input().rstrip().split(' ')
    if q[0]==str(N) and q[1]=="AC":
        number+=1
        break
    elif q[1]=="WA":
        count+=1
    elif q[0]!=str(N) and q[1]=="AC":
        number+=1
if count==0:
    print(1,0)
else:
    print(count,number)

Submission status: Wrong Answer

Solution code:
N, M = input().split()
li = []
wr = 0
ri = 0
for i in range(int(M)):
    p,S = input().split()
    if p in li:
        continue
    if S == 'AC':
        ri+=1
        li.append(p)
    elif S == 'WA':
        wr+=1

print(str(ri) + ' ' + str(wr))

Submission status: Wrong Answer

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

kari_wr = [0]*int(N)
ans_wr=[0]*int(N)
ans_ri=[0]*int(N)

for i in range(int(M)):
    p,S = input().split()
    if S == 'WA': 
        kari_wr[int(p)-1]+=1
    elif S == 'AC':
        ans_wr[int(p)-1] = kari_wr[int(p)-1]
        ans_ri[int(p)-1] = 1
        
print(str(sum(ans_ri))+' '+ str(sum(ans_wr)))

Submission status: Wrong Answer

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

flags = [False] * N

penalty = 0
score = 0
for _ in range(M):
    p_num, result = input().split()
    p_num = int(p_num) - 1
    if result == 'AC':
        if flags[p_num] is False:
            score += 1
        flags[p_num] = True
    elif result == 'WA' and flags[p_num] is False:
        penalty += 1

print(score, penalty)

Submission status: Wrong Answer

Solution code:
N,M= [int(i) for i in input().split()]
tmp=[]
scr=[0]*2
rec=[0]*N
r=0
ts=0
for i in range(M):
        tmp = ([x for x in input().split()])
        q=int(tmp[0])
        if q!=r: ts=0
        if rec[q-1] == 1:
                continue
        else:
                if tmp[1] == 'AC':
                        rec[q-1]=1
                        scr[0]+=1
                        scr[1]+=ts
                        ts=0
                elif tmp[1]=='WA':
                        ts+=1
        r=q

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
cnt=0
acc=0
ac={}
for i in range(m):
    p,s= map(str,input().split())
    if s=='AC':
        if p in ac:
            continue
        else:
            acc+=1
            ac[p]=1
    else:
        if p in ac:
            continue
        else:
            cnt+=1
print(acc,cnt)

Submission status: Wrong Answer

Solution code:
N,M= [int(i) for i in input().split()]
tmp=[]
scr=[0]*2
rec=[0]*N
for i in range(M):
        tmp = ([x for x in input().split()])
        q=int(tmp[0])
        if rec[q-1] == 1:
                continue
        else:
                if tmp[1] == 'AC':
                        rec[q-1]=1
                        scr[0]+=1
                elif tmp[1]=='WA':
                        scr[1]+=1
print(scr[0],scr[1])

Submission status: Wrong Answer

Solution code:
N,M= [int(i) for i in input().split()]
tmp=[]
scr=[0]*2
rec=[0]*N
for i in range(M):
        tmp = ([x for x in input().split()])
        q=int(tmp[0])
        if rec[q-1] == 1: continue
        else:
                if tmp[1] == 'AC':
                        rec[q-1]=1
                        scr[0]+=1
                elif tmp[1]=='WA':
                        scr[1]+=1
print(scr[0],scr[1])

Submission status: Wrong Answer

Solution code:
times = [int(idx) for idx in  input().split()]
datas = [input().split() for idx in range(times[1])]

pen = 0
ans = 0
num = 0
get_ = False
tmp = ""

for i in datas:
  if tmp != i[0]:
      get_ = False
  tmp = i[0]
  num = int(i[0])
  if i[1] == "WA":
        if get_ == False:
            pen += 1
  elif i[1] == "AC":
    if get_ == False:
        ans += 1
    get_=True
print(str(ans) + " " + str(pen))

Submission status: Wrong Answer

Solution code:
import sys
n,m = map(int,input().split())
l = []
wa = 0
ac = 0
for i in range(m):
    p,s = input().split()
    p = int(p)
    hoge = [p,s]
    l.append(hoge)
if m == 0:
    print('{} {}'.format(0,0))
    sys.exit()
l.sort(key=lambda x:x[0])
key = l[0][0]
flag = False
for i in range(m):
    if key == l[i][0] and flag ==False:
        if l[i][1] == 'WA':
            wa += 1
        else:
            ac += 1
            flag = True
    elif key != l[i][0]:
        flag = False
        key = l[i][0]
        if l[i][1] == 'WA':
            wa += 1
        else:
            ac += 1
            flag =True
print('{} {}'.format(ac,wa))

Submission status: Wrong Answer

Solution code:
def t(n, ps):
    ac = 0
    wa = 0
    a = [False]*(n + 1)
    for p, s in ps:
        if a[int(p)] is True:
            continue
        if s == 'AC':
            ac += 1
            a[int(p)] = True
        else:
            wa += 1
    return (ac, wa)


if __name__ == '__main__':
    n, m = map(int, input().split())
    ps = [input().split() for i in range(m)]
    print(' '.join(map(str, t(n, ps))))