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())
pS = [list(input().split()) for i in range(M)]
c = [0 for _ in range(N)]
penalty = [0 for _ in range(N)]
ac = 0
sum_penalty = 0

for i in range(M):
    num = int(pS[i][0])
    if c[num - 1] == 0:
        if pS[i][1] == 'WA':
            penalty[num - 1] += 1
        else:
            c[num - 1] = 1
            sum_penalty += penalty[num - 1]
            ac += 1

print(ac, sum(penalty))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
P = []
S = []
flag = [False for i in range(0, N)]
for i in range(0, M):
    x, y = map(str, input().split())
    P.append(int(x)-1)
    S.append(y)
ans = [0, 0]
for i in range(0, M):
    if not flag[P[i]]:
        if S[i] == 'AC':
            flag[P[i]] = True
            ans[0] += 1
        else:
            ans[1] += 1
print(*ans)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
P = []
S = []
flag = [False for i in range(0, N)]
for i in range(0, M):
    x, y = map(str, input().split())
    P.append(int(x)-1)
    S.append(y)
ans = [0, 0]
for i in range(0, M):
    if flag[P[i]]:
        continue
    else:
        if S[i] == 'AC':
            flag[P[i]] = True
            ans[0] += 1
        else:
            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)]
c = [0 for _ in range(N)]
penalty = 0
ac = 0

for i in range(M):
    num = int(pS[i][0])
    if c[num - 1] == 0:
        if pS[i][1] == 'WA':
            penalty += 1
        else:
            c[num - 1] = 1
            ac += 1

print(ac, penalty)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
P = []
S = []
flag = [False for i in range(0, N)]
for i in range(0, M):
    x, y = map(str, input().split())
    P.append(int(x))
    S.append(y)
ans = [0, 0]
for i in range(0, M):
    if flag[P[i]-1]:
        continue
    else:
        if S[i] == 'AC':
            flag[P[i]-1] = True
            ans[0] += 1
        else:
            ans[1] += 1
print(*ans)

Submission status: Wrong Answer

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

ac = 0
wa = 0

temp = -1
is_ac = False
temp_wa = 0
for i in range(M):
  s = input().split()
  no = int(s[0])
  result = s[1]

  if temp != no:
    temp = no
    temp_wa = 0
    is_ac = False
  
  if (not is_ac) and result == 'AC':
    is_ac = True
    ac += 1
    wa += temp_wa
  elif (not is_ac) and result == 'WA':
    temp_wa += 1

print(str(ac) + " " +  str(wa))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    n, m = map(int, input().split())
    ac = []
    wa = 0
    for i in range(m):
        p, s = input().split()
        if p in ac:
            continue
            if s == 'AC':
                ac.append(p)
            else:
                wa += 1
    print(len(ac), wa)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    n, m = map(int, input().split())
    ac = []
    wa = []
    for i in range(m):
        p, s = input().split()
        if [p, 'AC'] in ac:
            continue
        if s == 'AC':
            ac.append([p, s])
        else:
            wa.append([p, s])
    print(len(ac), len(wa))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    n, m = map(int, input().split())
    ac = []
    wa = []
    for i in range(m):
        p, s = input().split()
        if not [p, 'AC'] in ac and s == 'AC':
            ac.append([p, s])
        elif not [p, 'AC'] in ac and not [p, 'AC'] in ac:
            wa.append([p, s])
    print(len(ac), len(wa))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=[]
pen=0
for i in range(m):
    p,s=input().split()
    if s=="AC":
        ac.append(p)
    else:
        if p in ac:
            continue
        else:
            pen += 1
t_ac=set(ac)
print(len(t_ac),pen)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=[]
pen=0
for i in range(m):
    p,s=input().split()
    if s=="AC":
        ac.append(p)
    else:
        if p in ac:
            pass
        else:
            pen += 1
t_ac=list(set(ac))
print(len(t_ac),pen)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()

def indexs(l, x, default=-1):
    if x in l:
        return l.index(x)
    else:
        return -1

if M == 0:
	print(0, 0)
else:
	temp = [input().split() for _ in range(M)]
	temp.append([N+1, "WA"])
	temp.sort(key=lambda x:int(x[0]))
	temp = [list(x) for x in zip(*temp)]
	p, S = list(map(int, temp[0])), temp[1]

	index = 0
	AC = 0
	WC = 0
	a = []
	for i in range(M):
		if p[i]!=p[i+1]:
			a.append(indexs(S[index:i+1], "AC"))
			index = i+1
	index = 0
	print(a)
	for i in range(M):
		if p[i]!=p[i+1]:
			if a[index]>=0:
				AC += 1
				WC += a[index]
			index += 1	
	print(AC, WC)

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()

def indexs(l, x, default=-1):
    if x in l:
        return l.index(x)
    else:
        return -1

if M == 0:
	print(0, 0)
else:
	temp = [input().split() for _ in range(M)]
	temp.append([N+1, "WA"])
	temp.sort(key=lambda x:int(x[0]))
	temp = [list(x) for x in zip(*temp)]
	p, S = list(map(int, temp[0])), temp[1]

	index = 0
	AC = 0
	WC = 0
	a = []
	for i in range(M):
		if p[i]!=p[i+1]:
			a.append(indexs(S[index:i+1], "AC"))
			index = i+1
	index = 0
	for i in range(M):
		if p[i]!=p[i+1]:
			if a[index]>=0:
				AC += 1
				WC += a[index]
				index += 1
	print(AC, WC)

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()

def indexs(l, x, default=-1):
    if x in l:
        return l.index(x)
    else:
        return -1

if M == 0:
	print(0, 0)
else:
	temp = [input().split() for _ in range(M)]
	temp.append([N+1, "WA"])
	temp.sort(key=lambda x:int(x[0]))
	temp = [list(x) for x in zip(*temp)]
	p, S = list(map(int, temp[0])), temp[1]

	index = 0
	AC = 0
	WC = 0
	for i in range(M):
		if p[i]!=p[i+1]:
			a = indexs(S[index:i+1], "AC")
			if a>=0:
				AC += 1
				WC += a
	print(AC, WC)

Submission status: Wrong Answer

Solution code:
import sys

lines = [l.rstrip() for l in sys.stdin.readlines()[1:]]

ac = []
w = 0

for l in lines:
    p_raw, s = l.split(" ")
    p = int(p_raw)

    if p in ac:
        continue

    if s == "WA":
        w += 1
    elif s == "AC":
        ac += [p]

print("%d %d" % (len(ac), w))

Submission status: Wrong Answer

Solution code:
import sys

lines = sys.stdin.readlines()[1:]

ac = []
w = 0

for l in lines:
    p_raw, s = l.split(" ")
    p = int(p_raw)

    if p in ac:
        continue

    if s == "WA":
        w += 1
    elif s == "AC":
        ac += [p]

print("%d %d" % (len(ac), w))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
a_s = []
for i in range(m):
  a, s = map(str, input().split())
  a = int(a)
  a_s.append([a,s])
if n == 0 or m == 0:
  print("0 0")
else:
  num_now = a_s[0][0]
  ac_frag = False
  sum_ac = 0
  sum_pe = 0
  for i in range(m):
    if num_now == a_s[i][0]:
      if not ac_frag:
        if a_s[i][1] == "AC":
          sum_ac += 1
          ac_frag = True
        else:
          sum_pe += 1
    else:
      num_now = a_s[i][0]
      ac_frag = False
      if a_s[i][1] == "AC":
        sum_ac += 1
        ac_frag = True
      else:
        sum_pe += 1
  print(str(sum_ac) + " " + str(sum_pe))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
a_s = []
for i in range(m):
  a, s = map(str, input().split())
  a = int(a)
  a_s.append([a,s])
if n == 0 or m == 0:
  print("0 0")
else:
  num_now = a_s[0][0]
  ac_frag = False
  sum_ac = 0
  sum_pe = 0
  for i in range(m):
    if num_now == a_s[i][0]:
      if a_s[i][1] == "AC" and not ac_frag:
        sum_ac += 1
        ac_frag = True
      else:
        if not ac_frag:
          sum_pe += 1
    else:
      num_now = a_s[i][0]
      ac_frag = False
      if a_s[i][1] == "AC":
        sum_ac += 1
        ac_frag = True
      else:
        sum_pe += 1
  print(str(sum_ac) + " " + str(sum_pe))

Submission status: Wrong Answer

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

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

x = {}  
for _ in range(M):
  a,w = map(str,input().split())
  x.setdefault(int(a),[]).append(w)

ac = wa = 0  
for i in x.keys():
  for j in x[i]:
    if j == 'AC':
      ac += 1
      break
    elif j =='WA':
      wa += 1

print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
AC = [0]*N
WA = [0]*N
for _ in range(M):
    p,s = input().split()
    if AC[int(p)-1] == 0:
        if s == "WA":
            WA[int(p)-1] += 1
        elif s == "AC":
            AC[int(p)-1] = 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 _ in range(M):
    p,s = input().split()
    if AC[int(p)-1] == 0:
        if s == "WA":
            WA[int(p)-1] += 1
        else:
            AC[int(p)-1] = 1
print(sum(AC),sum(WA))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
cache = 0
ans = 0
ac = 0
plis = []
for i in range(m):
    p, s = input().split()
    p = int(p)
    if s == "WA":
        cache += 1
    else:
        if p in plis:
            continue
        plis.append(p)
        ac += 1
        ans += cache
        cache = 0
print("{} {}".format(ac, ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
wa, ac = [0]*(N+1), [0]*(N+1)
for i in range(1, M+1):
  pi, Si = input().split()
  pi = int(pi)
  if Si == 'WA' and ac[pi] == 0: 
    wa[pi] += 1
  elif Si == 'AC' and ac[pi] == 0:
    ac[pi] += 1
 
print('{} {}'.format(sum(ac), sum(wa)))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
wa, ac = [0]*(N+1), [0]*(N+1)
for i in range(1, M+1):
  pi, Si = input().split()
  pi = int(pi)
  if Si == 'WA' and ac[pi] == 0: 
    wa[pi] += 1
  elif Si == 'AC' and ac[pi] == 0:
    ac[pi] += 1

print('{} {}'.format(sum(ac), sum(wa)))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
wa, ac = [0]*(N+1), [0]*(N+1)
p, S = [], []
p.append(0)
S.append('')
for i in range(1, M+1):
  pi, Si = input().split()
  p.append(int(pi))
  S.append(Si)

for i in range(1, M+1):
  if S[i] == 'WA':
    if ac[p[i]] == 1:
      pass
    else:
      wa[p[i]] += 1
  elif S[i] == 'AC':
    if ac[p[i]] == 1:
      pass
    else:
      ac[p[i]] += 1

print('{} {}'.format(sum(ac), sum(wa)))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
wa, ac = [0]*N, [0]*N
p, S = [], []
for i in range(0, M):
  pi, Si = input().split()
  p.append(int(pi))
  S.append(Si)

for i in range(0, M):
  if S[i] == 'WA':
    if ac[p[i]-1] == 1:
      pass
    else:
      wa[p[i]-1] += 1
  elif S[i] == 'AC':
    if ac[p[i]-1] == 1:
      pass
    else:
      ac[p[i]-1] += 1

print('{} {}'.format(sum(ac), sum(wa)))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
wa, ac = [0]*N, [0]*N
p, S = [], []
for i in range(0, M):
  pi, Si = input().split()
  p.append(int(pi))
  S.append(Si)

for i in range(0, M):
  if S[i] == 'WA':
    if ac[p[i]-1] == 1:
      break
    else:
      wa[p[i]-1] += 1
  elif S[i] == 'AC':
    if ac[p[i]-1] == 1:
      break
    else:
      ac[p[i]-1] += 1

print('{} {}'.format(sum(ac), sum(wa)))

Submission status: Wrong Answer

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

# N, M = 2, 5
# P = [1, 1, 2, 2, 2]
# S = ["WA", "AC", "WA", "AC", "WA"]
point = 0
pena = 0
ind = 0

for p in set(P):
    isAC = False
    for i in range(P.count(p)):
        if S[ind] == "AC" and isAC == False:
            isAC = True
            point += 1
        if S[ind] == "WA" and isAC == True:
            pena += 1
        ind += 1

print(point, pena)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC = set()
second = 0
for i in range(M):
    P, S = input().split()
    P = int(P)
    if S == "AC":
        AC.add(P)
    elif P not in AC:
        second += 1

print(len(AC), second)

Submission status: Wrong Answer

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

# N, M = 2, 5
# P = [1, 1, 2, 2, 2]
# S = ["WA", "AC", "WA", "AC", "WA"]
point = 0
pena = 0
ind = 0

for p in set(P):
    isAC = False
    for i in range(P.count(p)):
        if S[ind] == "WA" and isAC == True:
            pena += 1
        if S[ind] == "AC" and isAC == False:
            isAC = True
            point += 1
        ind += 1

print(point, pena)

Submission status: Wrong Answer

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

point = 0
pena = 0
ind = 0

for p in set(P):
    isAC = False
    for i in range(P.count(p)):
        if S[ind] == "WA" and isAC == False:
            pena += 1
        if S[ind] == "AC" and isAC == False:
            isAC = True
            point += 1
        ind += 1

print(point, pena)

Submission status: Wrong Answer

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

point = 0
pena = 0
ind = 0

for p in set(P):
    isAC = False
    for i in range(P.count(p)):
        if S[ind] == "AC" and isAC == False:
            isAC = True
            point += 1
        if S[ind] == "WA" and isAC == False:
            pena += 1
        ind += 1

print(point, pena)

Submission status: Wrong Answer

Solution code:
def main():
    n,m=map(int,input().split())
    r=set()
    x={}
    for _ in range(m):
        p,s=input().split()
        print(p,s)
        if p not in r:
            if s=='WA':
                x[p]=x.setdefault(p,0)+1
            else:
                x[p]=x.setdefault(p,0)
                r.add(p)
    print(len(r),sum(x[p] for p in r)) 

main()

Submission status: Wrong Answer

Solution code:
a = input()
a,b = a.split(" ")
N= int(a)
M= int(b)

temp=[]
for i in range(M):
    temp.append(input())

tc=[0]*(N+1)
tr=[0]*(N+1)
for i in temp:
    _1, _2 = i.split(" ")
    if _2 == "WA":
        if tc[int(_1)] == 1:
            pass
        else :            
            tr[int(_1)] += 1
    elif _2 == "AC":
        tc[int(_1)] = 1
export = str(sum(tc))+" " + str(sum(tr))
print(export)

Submission status: Wrong Answer

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

flags = [False for _ in range(n)]

ans = [0, 0]
for _ in range(m):
    pstr, s = input().split()
    p = int(pstr)
    if(flags[p-1]):
        continue
    if(s == "AC"):
        ans[0] += 1
        flags[p-1] = True
    else:
        ans[1] += 1

print("{} {}".format(*ans))

Submission status: Wrong Answer

Solution code:
N, M = [int(i) for i in input().split()]
pS = {}

for _ in range(M):
    a, s = [i for i in input().split()]
    if a not in pS:
        pS[a] = {}
        if s == 'AC':
            pS[a]['AC'] = True
        else:
            pS[a]['count'] = 1
    else:
        if s == 'AC':
            pS[a]['AC'] = True
        elif 'AC' not in pS[a]:
            pS[a]['count'] += 1

s = 0
a = 0
for v in pS.values():
    if 'count' in v:
        s += v['count']
    if 'AC' in v:
        a += 1
    
print(a, s)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N, M = map(int, input().split())
d = defaultdict(list)
penalty = 0
accepted = 0

for p, S in (input().split() for _ in range(M)):
    d[p].append(S)

for k, v in d.items():
    for i in v:
        if i=="AC":
            accepted += 1
            break
        else:
            penalty += 1

print(accepted, penalty)

Submission status: Wrong Answer

Solution code:
N, M = [int(i) for i in input().split()]
p_S = [[str(i) for i in input().split()] for i in range(M)]
AC_flg = [0]*(N+1)
AC_cnt = 0
WA_cnt = 0
for i in range(M):
    if int(p_S[i][0]) <= N:
        if AC_flg[int(p_S[i][0])]==0:
            if p_S[i][1] == "WA":
                WA_cnt += 1
            elif p_S[i][1] == "AC":
                AC_cnt += 1
                AC_flg[int(p_S[i][0])] = 1
print(str(AC_cnt)+" "+str(WA_cnt))

Submission status: Wrong Answer

Solution code:
N, M = [int(i) for i in input().split()]
p_S = [[str(i) for i in input().split()] for i in range(M)]
AC_flg = [0]*(N+1)
AC_cnt = 0
WA_cnt = 0
for i in range(M):
    if AC_flg[int(p_S[i][0])]==0:
        if p_S[i][1] == "WA":
            WA_cnt += 1
        else:
            AC_cnt += 1
            AC_flg[int(p_S[i][0])] = 1
print(str(AC_cnt)+" "+str(WA_cnt))

Submission status: Wrong Answer

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

seikai = [False] * (n + 1)
wa = 0
ac = 0
for i in range(m):
    p, s = input().split()

    if not seikai[int(p)]:
        if s == "WA":
            wa += 1
        else:
            ac += 1
            seikai[int(p)] = True
print(ac, wa)

Submission status: Wrong Answer

Solution code:
s = 0
p = 0
l = []
sk = 0

n, m = map(int, input().split())
for _ in range(m):
    i, j = input().split()
    i = int(i)
    l.append([i, j])
l.sort(key = lambda  x:x[0])

for i in l:
    if sk == 0:
        if i[1] == "WA":
            p += 1
        else:
            t = i[0]
            s += 1
            sk += 1
    else:
        if i[0] != t:
            t = i[0]
            sk = 0
            if i[1] == "WA":
                p += 1
            else:
                s += 1
                sk += 1
        
print(s, p)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
prbs = [ [0] for _ in range(1,n+1)]
#print(prbs)
for _ in range(m):
    i,j = map(str,input().split())
    i = int(i)
    i -= 1
    if prbs[i][-1] != "AC":
        prbs[i].append(j)
pen = 0
for i in range(n):
    pen += prbs[i].count("WA")
ans = 0
for i in range(n):
    ans += prbs[i].count("AC")
#print(prbs)
print(ans,pen)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
ACL = [0] * N
WAL = [0] * N 
for i in range(M):
  p, s = input().split()
  p = int(p)-1
  if ACL[p] > 0:
    continue
  if s == "AC":
    ACL[p] = 1
    continue
  WAL[p] += 1
  
print(sum(ACL), sum(WAL))

Submission status: Wrong Answer

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

ans={}
for i in range(1, N+1):
  ans[str(i)]=False

AC=0
WA=0

for i in p_S:
  if i[1]=='WA' and not ans[i[0]]:
    WA+=1
  elif i[1]=='AC' and not ans[i[0]]:
    AC+=1
    ans[i[0]]=True

print(AC, WA)

Submission status: Wrong Answer

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

ans={}
for i in range(1, N+1):
  ans[str(i)]=False

AC=0
WA=0

for i in p_S:
  if i[1]=='WA' and not ans[i[0]]:
    WA+=1
  elif i[1]=='AC' and not ans[i[0]]:
    AC+=1
    ans[i[0]]=True

print(ans)
print(AC, WA)

Submission status: Wrong Answer

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

ans=[]
AC=0
WA=0

for i in p_S:
  if i[1]=='WA' and i[0] not in ans:
    WA+=1
  elif i[1]=='AC' and i[0] not in ans:
    AC+=1
    ans.append(i[0])

print(ans)

print(AC, WA)

Submission status: Wrong Answer

Solution code:
N, M = [int(i) for i in input().split()]
p_S = [[i for i in input().split()] for _ in range(M)]
p_S = list(map(list, set(map(tuple, p_S))))

AC = len([i for i in p_S if i[1] == 'AC'])
WA = len([i for i in p_S if i[1] == 'WA'])
print(AC, WA)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
r = [0]*N
ans = 0
pen = 0
for _ in range(M):
  p,S = input().split()
  p = int(p)
  if S == 'AC':
    r[p-1] = 1
  elif S == 'WA':
    if r[p-1] == 0:
      pen += 1
    else:
      pen += 0
for i in r:
  ans += i
print(ans,pen)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
num = []
apb = []

for i in range(M):
    n, a = input().split()
    num.append(int(n))
    apb.append(a)

num_wa = 0
num_ac = 0
for i in range(N):
    for j in apb[num.count(i):(num.count(i)+(num.count(i+1)))]:
        if j == 'wa':
            num_wa += 1
        if j == 'ac':
            num_ac += 1
            break
print(num_ac, num_wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
A = [0]*(N+1)
mod = 10**8

for i in range(M):
    p,S = input().split()
    p = int(p)
    if S == 'AC':
        if A[p]//mod==0:
            A[p] += mod
    else:
        if A[p]//mod==0:
            A[p] += 1
            
AC = sum(A)//mod
WA = sum(A)%mod
print(AC,WA)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

N, M = map(lambda x: int(x), input().split())

Pdict = {}
for i in range(M):
    p_i, S_i = input().split()
    Pdict[p_i] = Pdict.get(p_i, []) + [S_i]

ACNum = 0
PenaltyNum = 0
for i in Pdict.values():
    temp = 0
    for j in i:
        if j == "AC":
            ACNum += 1
            PenaltyNum += temp
            break
        else:
            temp += 1

print(ACNum, PenaltyNum)
print(Pdict)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

ifAC = np.zeros(N, dtype='bool')
WAcount = np.zeros(N, dtype='int')

for i in range(M):
    pi, Si = input().split()
    pi = int(pi) - 1
    if Si == 'AC':
        ifAC[pi] = True
    if ifAC[pi] == False and Si == 'WA':
        WAcount[pi] += 1

print(np.sum(ifAC), np.sum(WAcount))

Submission status: Wrong Answer

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

cnt_penalty = 0
flag_ac = [0]*n

for _ in range(m):
    p, s = input().split()
    if flag_ac[int(p)-1] == 0 and s == "WA":
        cnt_penalty += 1
    if s == "AC":
        flag_ac[int(p)-1] = 1
print(sum(flag_ac), cnt_penalty)

Submission status: Wrong Answer

Solution code:
N = input().split()
N = [int(i) for i in N]
Pi = [0 for i in range(N[0])]
#print(Pi)

Nac = 0
Nwa = 0
for i in range(N[1]):
    M = input().split()
    p = int(M[0])
    judge = str(M[1])

    if(Pi[p-1] == 0):
        if(judge == 'AC'):
            Nac += 1
            Pi[p-1] = 1
        else:
            Nwa += 1
print(Nac, Nwa)

Submission status: Wrong Answer

Solution code:
N = input().split()
N = [int(i) for i in N]
Pi = [[0,0] for i in range(N[0])]
#print(Pi)

Nac = 0
Nwa = 0
for i in range(N[1]):
    M = input().split()
    p = int(M[0])
    judge = str(M[1])

    if(Pi[p-1][1] == 0):
        if(judge == 'AC'):
            Pi[p-1][1] = 1
            Nac += 1
        else:
            Pi[p-1][0] += 1
            Nwa += 1
print(Nac, Nwa)

Submission status: Wrong Answer

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

if M == 0 or N == 0:
    print("{} {}".format(0, 0))
else:

    p = [0]*M
    S = [0]*M

    for i in range(M):
        tmp = input().split()
        p[i] = int(tmp[0])
        S[i] = tmp[1]

    penalty = 0
    correct = 0

    correct_set = set()
    for i in range(M):
        if p[i] not in correct_set and S[i] == "AC":
            correct += 1
            correct_set.add(p[i])

        elif p[i] not in correct_set and S[i] == "WA":
            penalty += 1

    print("{} {}".format(correct, penalty))

Submission status: Wrong Answer

Solution code:
n, m = [int(i) for i in input().split()]
results = [False for _ in range(n)]

total_success = 0
total_fail = 0

for _ in range(m):
    res = input().split()
    p = int(res[0])
    if not results[p - 1]:
        if res[1] == "AC":
            results[p - 1] = True
            total_success += 1
        else:
            total_fail += 1

print(total_success, total_fail)

Submission status: Wrong Answer

Solution code:
nm = [int(i) for i in input().split()]
dic = {}

co = 0
pe = 0

for i in range(0,nm[1]):
  tmp = [j for j in input().split()]
  val = dic.setdefault(tmp[0],'NEW')
  
  if (val == 'NEW') or (val == 'WA'):	#新規追加
    if tmp[1] == 'WA':
      pe += 1
      dic[tmp[0]] = 'WA'
    elif tmp[1] == 'AC':
      co += 1
      dic[tmp[0]] = 'AC'

print(co, pe)

Submission status: Wrong Answer

Solution code:
nm = [int(i) for i in input().split()]
dic = {}

co = 0
pe = 0

for i in range(0,nm[1]):
  tmp = [i for i in input().split()]
  val = dic.setdefault(tmp[0],'NEW')
  
  if (val == 'NEW') or (val == 'WA'):	#新規追加
    if tmp[1] == 'WA':
      pe += 1
      dic[tmp[0]] = 'WA'
    elif tmp[1] == 'AC':
      co += 1
      dic[tmp[0]] = 'AC'

print(co, pe)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

N, M = map(lambda x: int(x), input().split())

Pdict = {}
for i in range(M):
    p_i, S_i = input().split()
    Pdict[p_i] = Pdict.get(p_i, []) + [S_i]

ACNum = 0
PenaltyNum = 0
for i in Pdict.values():
    for j in i:
        if j == "AC":
            ACNum += 1
            break
        else:
            PenaltyNum += 1
            continue

print(ACNum, PenaltyNum)

Submission status: Wrong Answer

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

if M == 0:
    print("{} {}".format(0, 0))
else:

    p = [0]*M
    S = [0]*M

    for i in range(M):
        tmp = input().split()
        p[i] = int(tmp[0])
        S[i] = tmp[1]

    penalty = 0
    correct = 0

    correct_set = set()
    for i in range(M):
        if p[i] not in correct_set and S[i] == "AC":
            correct += 1
            correct_set.add(p[i])

        elif p[i] not in correct_set and S[i] == "WA":
            penalty += 1

    print("{} {}".format(correct, penalty))

Submission status: Wrong Answer

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

A = sorted(A, key=lambda a: a[0])
ac = set()

ac_cnt = 0
wa_cnt = 0

for a in A:
    if a[1] == 'AC':
        if not a[0] in ac:
            ac.add(a[0])
            ac_cnt += 1
    else:
        if not a[0] in ac:
            wa_cnt += 1

print(ac_cnt, wa_cnt)

Submission status: Wrong Answer

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

wa_cnt = [0]*N
ac_flag = [False]*N

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

    if not ac_flag[p]:
        if S == 'WA':
            wa_cnt[p] += 1
        else:
            ac_flag[p] = True


print(sum(ac_flag), sum(wa_cnt))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
rec = []
for i in range(M):
    p, S = map(str, input().split())
    p = int(p)
    rec.append([p,S])
N_list = [False for i in range(N)]
AC_cnt=WA_cnt=0
for i in range(M):
    if rec[i][1] == "AC":
        if N_list[rec[i][0]-1] == False:
            AC_cnt += 1
            N_list[rec[i][0]-1] = True
    if rec[i][1] == "WA":
        if N_list[rec[i][0]-1] == False:
            WA_cnt += 1
print(AC_cnt, WA_cnt)