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:
mod = 10 ** 9 + 7
mod2 = 2 ** 61 + 1
from collections import deque
import heapq
from bisect import bisect_left, insort_left, bisect_right

_NUMINT_ALL = list(range(10))


def main():
    ans = solve()

    if ans is True or ans is False:
        YesNo(ans)
    elif ans is not None:
        print(ans)


def solve():
    N, M = iip(False)
    A = iipt(M)
    d = {}

    for p, s in A:
        d[p] = [0, 0]

    for p, s in A:
        if d[p][1] == 1:
            continue
        elif s == "WA":
            d[p][0] += 1
        else:
            d[p][1] = 1

    e = 0
    f = 0
    for a, b in d.values():
        if b == 0:
            continue
        e += a
        f += b

    split_print_space([e, f])



#####################################################ライブラリ集ここから

def kiriage_warizan(a, b):
    return -(-a//b)


def iip(listed=True):  # 数字のinputをlistで受け取る
    d = input().split()
    try:
        ret = [int(i) for i in d]
    except:
        ret = [int(i) if i in _NUMINT_ALL else i for i in d]
        if len(ret) == 1:
            return ret[0]

    if len(ret) == 1 and not listed:
        return ret[0]
    return ret

def iipt(l, listed=False, num_only=True):  # 縦向きに並んでいるデータをリストに落とし込む(iip利用)
    ret = []
    for i in range(l):
        ret.append(iip(listed=listed))
    return ret


def saidai_kouyakusuu(A):  # 最大公約数
    l = len(A)
    while True:
        m = min(A)
        mx = max(A)
        if m == mx:
            return m

        for i in range(l):
            if A[i] % m == 0:
                A[i] = m
            else:
                A[i] %= m


def make_graph_edge_flat(N):  # グラフ作成のための辺をリストで返す
    ret = []
    for i in range(N-1):
        a, b, c = iip()
        a -= 1
        b -= 1
        ret[a].append((b, c))
        ret[b].append((a, c))
    return ret


def sort_tuples(l, index):  # タプルのリストを特定のインデックスでソートする
    if isinstance(l, list):
        l.sort(key=lambda x: x[index])
        return l
    else:
        l = list(l)
        return sorted(l, key=lambda x: x[index])


def count_elements(l):  # リストの中身の個数を種類分けして辞書で返す
    d = {}
    for i in l:
        if i in d:
            d[i] += 1
        else:
            d[i] = 1
    return d


def safeget(l, index, default="exception"):  # listの中身を取り出す時、listからはみ出たり
    if index >= len(l):                      # マイナスインデックスになったりするのを防ぐ
        if default == "exception":
            raise Exception("".join(["safegetに不正な値 ", index, "が渡されました。配列の長さは", len(l), "です"]))
        else:
            return default
    elif index < 0:
        if default == "exception":
            raise Exception("".join(["safegetに不正な値 ", index, "が渡されました。負の値は許可されていません"]))
        else:
            return default
    else:
        return l[index]


def sortstr(s):  # 文字列をソートする
    return "".join(sorted(s))


def iip_ord(startcode="a"):  # 文字列を数字の列に変換する(数字と文字は1:1対応)
    if isinstance(startcode, str):
        startcode = ord(startcode)
    return [ord(i) - startcode for i in input()]


def YesNo(s):  # TrueFalseや1, 0をYesNoに変換する
    if s:
        print("Yes")
    else:
        print("No")


def fprint(s):  # リストを平たくしてprintする(二次元リストを見やすくしたりとか)
    for i in s:
        print(i)


def bitall(N):  # ビット全探索用のインデックスを出力
    ret = []
    for i in range(2 ** N):
        a = []
        for j in range(N):
            a.append(i % 2)
            i //= 2
        ret.append(a)
    return ret

def split_print_space(s):  # リストの中身をスペース区切りで出力する
    print(" ".join([str(i) for i in s]))


def split_print_enter(s):  # リストの中身を改行区切りで出力する
    print("\n".join([str(i) for i in s]))


def soinsuu_bunkai(n):  # 素因数分解
    ret = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):  # nCrをmodを使って計算する
    if n <= 0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n - r + 1, n + 1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r + 1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        # print(f"{n}C{r} = {ret}")
        pass
    return ret


def inv(n, mod):  #  modnにおける逆元を計算
    return power(n, mod - 2)


def power(n, p, mod_=mod):  # 繰り返し二乗法でn**p % modを計算
    if p == 0:
        return 1
    if p % 2 == 0:
        return (power(n, p // 2, mod_) ** 2) % mod_
    if p % 2 == 1:
        return (n * power(n, p - 1, mod_)) % mod_


def nibutan_func(func, target, left, right, side="left"): # 関数を二分探索
    l = left
    r = right
    while r-l > 1:
        x = (l+r)//2
        if func(x) == target:
            return x
        elif func(x) > target:
            r = x
        else:
            l = x

    if side == "left" or func(x) == target:
        return l
    else:
        return r


def nibutan_list(list_, target, side="left"):  # リストを二分探索
    if not isinstance(list_, list):
        list_ = list(list_)

    l = 0
    r = len(list_)
    while r-l > 1:
        x = (l+r)//2
        if list_[x] == target:
            return x
        elif list_[x] > target:
            r = x
        else:
            l = x

    if side == "left" or list_[x] == target:
        return l
    else:
        return r

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
n=[list(input().split()) for _ in range(M)]
ans,ct=0,0

for i in range(len(n)-1):
    if n[i][1]=="AC":
        ct+=1
        if n[i+1][0]==n[i][0] and n[i+1][1]==n[i][1]:
            ct-=1
            if ct==0:
                ct+=1
            continue


    elif n[i][1]=="WA":
        ans+=1

print(ct, ans)

Submission status: Wrong Answer

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

dict_ac = {}
dict_wa = {}
number = True
index = 0
for i, j in lists:
    if j == "WA":
        if number:
            if i not in dict_wa.keys():
                if i in dict_ac.keys():
                    continue
                else:
                    dict_wa[i] = 1
                    number = False
            else:
                continue
        elif i in dict_wa.keys():
            dict_wa[i] += 1
        else:
            continue
    elif j == "AC":
        if i not in dict_ac.keys():
            dict_ac[i] = 1
            number = True
        else:
            dict_ac[i] = 1
            number = True
    else:
        continue

# print("AC", dict_ac)
# print("WA", dict_wa)


for i in dict_wa.keys():
    if i not in dict_ac.keys():
        dict_wa[i] = 0
    else:
        continue



# print("AC", dict_ac)
# print("WA", dict_wa)

print(sum(dict_ac.values()), sum(dict_wa.values()))

Submission status: Wrong Answer

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

dict_ac = {}
dict_wa = {}
number = True
index = 0
for i, j in lists:
    if j == "WA":

        if number:
            if i not in dict_wa.keys():
                dict_wa[i] = 1
                number = False
            else:
                continue
        elif i in dict_wa.keys():
            dict_wa[i] += 1
        else:
            continue
    elif j == "AC":
        if i not in dict_ac.keys():
            dict_ac[i] = 1
            number = True
        else:
            dict_ac[i] = 1
            number = True
    else:
        continue

# print("AC", dict_ac)
# print("WA", dict_wa)


for i in dict_wa.keys():
    if i not in dict_ac.keys():
        dict_wa[i] = 0
    else:
        continue



# print("AC", dict_ac)
# print("WA", dict_wa)

print(sum(dict_ac.values()), sum(dict_wa.values()))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
judge = [0]*n
counter = [0, 0]
for i in range(m):
  p, s = map(str, input().split())
  p = int(p)
  if s == "WA":
    if judge[p-1] == 0:
      counter[0] += 1
  if s == "AC":
    if judge[p-1] == 0:
      counter[1] += 1
      judge[p-1] += 1
print(counter[1], counter[0])

Submission status: Wrong Answer

Solution code:
def main(n, m, p_s):
    st = [False for _ in range(n)]
    ac, wa = 0, 0

    for p, s in p_s:
        if st[int(p) - 1]:
            continue

        if s == "AC":
            ac += 1
            st[int(p) - 1] = True
        if s == "WA":
            wa += 1

    print(ac, wa)


if __name__ == "__main__":
    n, m = map(int, input().split())
    p_s = [list(input().split()) for _ in range(m)]

    main(n, m, p_s)

Submission status: Wrong Answer

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

dict_ac = {}
dict_wa = {}
number = True

for i, j in lists:
    if j == "WA":
        if number:
            if i not in dict_wa.keys():
                dict_wa[i] = 1
                number = False
            else:
                continue
        elif i in dict_wa.keys():
            dict_wa[i] += 1
        else:
            continue
    elif j == "AC":
        if i not in dict_ac.keys():
            dict_ac[i] = 1
            number = True
        else:
            dict_ac[i] = 1
            number = True
    else:
        continue

# print("AC", dict_ac)
# print("WA", dict_wa)

for i in dict_ac.keys():
    for j in dict_wa.keys():
        if i == j:
            continue
        else:
            dict_wa[j] = 0

# print("AC", dict_ac)
# print("WA", dict_wa)

print(sum(dict_ac.values()), sum(dict_wa.values()))

Submission status: Wrong Answer

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

AC = 0
Pena = 0
number = 0
isWA = False

for p in P:
    if number != int(p[0]):
        isWA = False

    if isWA == False and p[1] == 'AC':
        number = int(p[0])
        isWA = True
        AC += 1
        continue
    
    if isWA == True and number == int(p[0]):
        if p[1] == 'WA':
            Pena += 1

print('{} {}'.format(AC, Pena))

Submission status: Wrong Answer

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

dict_ac = {}
dict_wa = {}
number = True

for i, j in lists:
    if j == "WA":
        if number:
            if i not in dict_wa.keys():
                dict_wa[i] = 1
                number = False
            else:
                continue
        elif i in dict_wa.keys():
            dict_wa[i] += 1
        else:
            continue
    elif j == "AC":
        if i not in dict_ac.keys():
            dict_ac[i] = 1
            number = True
        else:
            dict_ac[i] = 1
            number = True
    else:
        continue

# print("AC", dict_ac)
# print("WA", dict_wa)

print(sum(dict_ac.values()), sum(dict_wa.values()))

Submission status: Wrong Answer

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

dict_ac = {}
dict_wa = {}
number = 0

for i, j in lists:
    if j == "WA":
        if number == 0:
            dict_wa[i] = 1
            number += 1
        elif i in dict_wa.keys():
            dict_wa[i] += 1
        else:
            continue
    elif j == "AC":
        if i not in dict_ac.keys():
            dict_ac[i] = 1
            number = 0
        else:
            dict_ac[i] = 1
            number = 0
    else:
        continue

# print("AC", dict_ac)
# print("WA", dict_wa)

print(sum(dict_ac.values()), sum(dict_wa.values()))

Submission status: Wrong Answer

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

dict_ac = {}
dict_wa = {}
number = 0

for i, j in lists:
    if j == "WA":
        if number == 0:
            dict_wa[i] = 1
            number += 1
        elif i in dict_wa.keys():
            dict_wa[i] += 1
        else:
            continue
    elif j == "AC":
        if i not in dict_ac.keys():
            dict_ac[i] = 1
            number = 0
        else:

            dict_ac[i] += 1
            number = 0
    else:
        continue

# print("AC", dict_ac)
# print("WA", dict_wa)

print(sum(dict_ac.values()), sum(dict_wa.values()))

Submission status: Wrong Answer

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

dict_ac = {}
dict_wa = {}
number = 0

for i, j in lists:
    if j == "WA":
        if number == 0:
            dict_wa[i] = 1
            number += 1
        elif i in dict_wa.keys():
            dict_wa[i] += 1
        else:
            continue
    elif j == "AC":
        dict_ac[i] = 1
        number = 0
    else:
        continue

# print(dict_ac)
# print(dict_wa)
print(sum(dict_ac.values()), sum(dict_wa.values()))

Submission status: Wrong Answer

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

for i in range(M):
    p, S=input().split()
    p=int(p)
    if ac[p-1]==0:
        if S=="AC":
            ac[p-1]=1
        elif S=="WA":
            wa[p-1]+=1
    elif ac[p-1]>=1:
        ac[p-1]=1
        if S=="WA":
            wa[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 i in range(M):
    p, S=input().split()
    p=int(p)
    if ac[p-1]==0:
        if S=="AC":
            ac[p-1]=1
        elif S=="WA":
            wa[p-1]+=1

accnt=sum(ac)
wacnt=sum(wa)
print(accnt, wacnt)

Submission status: Wrong Answer

Solution code:
import sys
import math

from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s
def factorial(n):
    if n == 1:
        return 1
    return n * factorial(n-1)
def mCn(m, n):
    def factorial_ntimes(m, n):
        r = 1
        while n:
            r *= m
            m -= 1
            n -= 1
        return r
    return int(factorial_ntimes(m, n) / factorial(n))


n, m = load_list()

ac = dict()

a, b = 0, 0
for _ in range(m):
    p, r = input().split(" ")
    p = int(p)
    r = r.strip()
    if r == 'AC' and p not in ac:
        a += 1
        ac[p] = 1
    elif r == 'WA' and p not in ac:
        b += 1
print(a,b)

Submission status: Wrong Answer

Solution code:
import os

def main():
	wa_result = []
	ac_result = []
	num,count = map(int, input().split())
	for i in range(count):
		n,m = map(str, input().split())
		if m == "WA":
			if n in wa_result:
				pass
			else:
				wa_result.append(n)
		else:
			if n in ac_result:
				pass
			else:
				ac_result.append(n)

	print(len(ac_result), len(wa_result)) 

if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
import os

def main():
	wa_result = []
	ac_result = []
	num,count = map(int, input().split())
	for i in range(count):
		n,m = map(str, input().split())
		if m == "WA":
			if n in wa_result:
				continue
			else:
				wa_result.append(n)
		else:
			if n in ac_result:
				continue
			else:
				ac_result.append(n)
	print(len(ac_result), len(wa_result)) 

if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ACs = [False] * N
wa = 0
ac = 0
for _ in range(M):
    p, s = input().split()
    if s == "WA" and ACs[int(p)-1] == False:
        wa += 1
    if s == "AC" and ACs[int(p)-1] == False:
        ACs[int(p)-1] = True
        ac += 1
print("{} {}".format(ac, wa))

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
A = {}
C = 0
P = 0
for i in range(M):
    p,S = map(str, input().split())
    if S == 'AC' and A.get(p+S) is None:
        A[p+S] = 0
        C += 1
    elif S == 'WA' and A.get(p+'AC') is None:
        P += 1
print(C,P)

Submission status: Wrong Answer

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

Check_AC = [0]*N
WA_Counter = 0

for i in range(M):
    pi,Si = input().split()
    pi = int(pi)
    # まだ正解していない問題
    if Check_AC[pi-1] == 0:
        if Si == "AC":
            Check_AC[pi-1] = 1
        else:
            WA_Counter += 1
    
print(str(sum(Check_AC)) + " " + str(WA_Counter))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
AC = 0
WA = 0
wa = 0
l = [input().split() for i in range(m)]
d = dict()
for i in range(m):
    if i != 0 and l[i][0] != l[i - 1][0]:
        wa = 0
    if l[i][0] not in d or l[i][0] in d and d[l[i][0]] != "AC":
        d[l[i][0]] = l[i][1]
        if l[i][1] == "AC":
            AC += 1
            WA += wa
        else:
            wa += 1
print(AC, WA)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ar=[0]*(n+1)
ac=wa=0
for _ in range(m):
    p,s=input().split()
    p=int(p)
    if ar[p]:
        continue
    if s=='AC':
        ar[p]=1
        ac+=1
    else:
        wa+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
lis = [list(input().split()) for _ in range(m)]
d = {}
ac, wa = 0, 0
for i in range(m):
    if lis[i][0] not in d:
        if lis[i][1] == 'AC':
            ac += 1
            d[lis[i][0]] = 'AC'
        else:
            d[lis[i][0]] = 1
    else:
        if lis[i][1] == 'AC':
            if type(d[lis[i][0]]) == int:
                ac += 1
                wa += d[lis[i][0]]
                d[lis[i][0]] = 'AC'
print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
lis = [list(input().split()) for _ in range(m)]
d = {}
ac, wa = 0, 0
for i in range(m):
    if lis[i][0] not in d:
        if lis[i][1] == 'AC':
            ac += 1
            d[lis[i][0]] = 'AC'
        else:
            d[lis[i][0]] = 1
    else:
        if lis[i][1] == 'AC':
          if type(d[lis[i][0]]) == int:
            ac += 1
            wa += d[lis[i][0]]
            d[lis[i][0]] = 'AC'
print(' '.join(map(str, [ac, wa])))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac = 0
wa = 0
l = [input().split() for i in range(m)]
d = dict()
for i in range(m):
    if l[i][0] not in d or l[i][0] in d and d[l[i][0]] != "AC":
        d[l[i][0]] = l[i][1]
        if l[i][1] == "AC":
            ac += 1
        else:
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
lis = [list(input().split()) for _ in range(m)]
d = {}
ac, wa = 0, 0
for i in range(m):
    if lis[i][0] not in d:
        if lis[i][1] == 'AC':
            ac += 1
        else:
            d[lis[i][0]] = 1
    else:
        if lis[i][1] == 'AC':
            ac += 1
            wa += d[lis[i][0]]
print(' '.join(map(str, [ac, wa])))

Submission status: Wrong Answer

Solution code:
n, m = (int(i) for i in input().split());

task = [[0, 0] for i in range(n)];
solved = 0;
penalty = 0;

for i in range(m):
    p, s = (j for j in input().split());
    p = int(p) - 1;
    if task[p][0] == 1:
        break;
    if s == "AC":
        solved += 1;
        penalty += task[p][1];
        task[p][0] = 1;
    else:
        task[p][1] += 1;

print(solved, penalty);

Submission status: Wrong Answer

Solution code:
n, m = (int(i) for i in input().split());

task = [[0, 0] for i in range(n)];
solved = 0;
penalty = 0;

for i in range(m):
    p, s = (i for i in input().split());
    p = int(p) - 1;
    if task[p][0] == 1:
        break;
    if s == "AC":
        solved += 1;
        penalty += task[p][1];
        task[p][0] = 1;
    else:
        task[p][1] += 1;

print(solved, penalty);

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
L = [0 for _ in range(N)]

ac = 0
wa = 0
for _ in range(M):
  x = input().split()
  p = int(x[0])
  S = x[1]
  if S == "AC" and L[p-1] == 0:
    L[p-1] = 1
    ac +=1
  elif L[p-1] != 1:
    wa +=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
L = [[0,0] for _ in range(N)]

for _ in range(M):
  x = input().split()
  p = int(x[0])
  S = x[1]
  if S == "AC":
    L[p-1][0] = 1
  elif L[p-1][0] != 1:
    L[p-1][1] +=1

print(sum([L[i][0] for i in range(N)]),sum([L[i][1] for i in range(N)]))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
PS=[]
for i in range(M):
  x,y=input().split()
  PS.append((int(x),y))
ac=[0]*N
wa=[0]*N
for i in range(M):
  if PS[i][1]=="AC" and ac[PS[i][0]-1]==0:
    ac[PS[i][0]-1]=1
  elif PS[i][1]=="WA" :
    if ac[PS[i][0]-1]!=1:
      wa[PS[i][0]-1]+=1
sac=sum(ac)
swa=sum(wa)
print(sac,swa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
PS=[]
for i in range(M):
  x,y=input().split()
  PS.append((int(x),y))
ac=[0]*N
wa=[0]*N
for i in range(M):
  if PS[i][1]=="AC" and ac[PS[i][0]-1]==0:
    ac[PS[i][0]-1]=1
  elif PS[i][1]=="WA" :
    if ac[PS[i][0]-1]!=1:
      wa[PS[i][0]-1]+=1
sac=sum(ac)
swa=0
for i in wa:
  swa+=i
print(sac,swa)

Submission status: Wrong Answer

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

a=[0]*n

ac=0
wa=0

for i in range(m):

  p,s=input().split()
  p=int(p)

  if a[p-1]==0:
    if s=="AC":
      ac+=1
      a[p-1]=1
    else:
      wa+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac_set = set()
wa_cnt = 0
for i in range(m):
    p, s = input().split()
    if s == 'AC':
        ac_set.add(p)
    else:
        if p not in ac_set:
            wa_cnt += 1
print(len(ac_set), wa_cnt)

Submission status: Wrong Answer

Solution code:
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
problems = [False] * N
AC, WA = 0, 0
for _ in range(M):
    p, S = sr().split(); p = int(p) - 1
    if not problems[p] and S == 'WA':
        WA += 1
    if not problems[p] and S == 'AC':
        problems[p] = True
        AC += 1

print(AC, WA)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
n, m = map(int, input().split())
ac = 0
wa = 0
tmp = 0
d = set()
for _ in range(m):
    p, s = map(str, input().split())
    if p not in d and s == "AC":
        ac += 1
        wa += tmp
        tmp = 0
        d.add(p)
    if p not in d and s == "WA":
        tmp += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
n, m = map(int, input().split())
ac = 0
pe = 0
d = set()
for _ in range(m):
    p, s = map(str, input().split())
    if p not in d and s == "AC":
        ac += 1
        d.add(p)
    if p not in d and s == "WA":
        pe += 1
print(ac, pe)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
n, m = map(int, input().split())
ac = 0
pe = 0
d = set()
for _ in range(m):
    p, s = map(str, input().split())
    if p not in d and s == "WA":
        pe += 1
    if p not in d and s == "AC":
        ac += 1
        d.add(p)
print(ac, pe)

Submission status: Wrong Answer

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

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        lst[p-1][0] = 1
    elif lst[p-1][0] == 0:
        lst[p-1][1] += 1

correct = 0
wrong = 0
for i in range(n):
    correct += lst[i][0]
    if lst[i][0] == 1:
        wrong += lst[i][1]
print(correct, wrong)
print(lst)

Submission status: Wrong Answer

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

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        lst[p-1][0] = 1
    elif lst[p-1][0] == 0:
        lst[p-1][1] += 1

correct = 0
wrong = 0
for i in range(n):
    correct += lst[i][0]
    wrong += lst[i][1]
print(correct, wrong)

Submission status: Wrong Answer

Solution code:
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
from datetime import datetime as dt

def main():
  n,m = map(int, readline().split())
  p = [0]*m
  s = ['']*m
  count = [0]*n
  AC = [0]*n
  for i in range(m):
    tmp, s[i] = input().split()
    p[i] = int(tmp)
  for i in range(m):
    if AC[p[i]-1]==0:
      if s[i]=='WA':
        count[p[i]-1] += 1
      else:
        AC[p[i]-1] = 1
  print('{} {}'.format(sum(AC),sum(count)))
  
  
  
if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
from datetime import datetime as dt

def main():
  n,m = map(int, readline().split())
  p = [0]*m
  s = ['']*m
  count = [0]*n
  AC = [0]*n
  for i in range(m):
    tmp, s[i] = input().split()
    p[i] = int(tmp)
  for i in range(m):
    if AC[p[i]-1]==0:
      if s[i]=='WA':
        count[p[i]-1] += 1
      else:
        AC[p[i]-1] = 1
  print('{} {}'.format(sum(count),sum(AC)))
  
  
  
if __name__ == '__main__':
  main()

Submission status: Wrong Answer

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

ac_cnt = 0
ac_index = 0
wa_cnt = 0
for p, s in h:
  if ac_index != int(p):
    if s == "WA":
      wa_cnt+=1

    if s == "AC":
      ac_cnt += 1
      ac_index = int(p)
print(str(ac_cnt) + " " + str(wa_cnt))

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    PS = [list(input(_).split()) for _ in range(M)]
#    PS = [list(int(a),b) for a, b in PS]
    CNT = [0] * N
    PENA = [0] * N
    for p, s in PS:
        p = int(p)
        if s == "AC": CNT[p-1] = 1
        else:
            if CNT[p-1] == 0:
                PENA[p-1] += 1

    ans = 0
    for idx,val in enumerate(PENA):
        if CNT[idx] == 1:
            ans += val

    print(sum(CNT),ans)

main()

Submission status: Wrong Answer

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

for i in range(m):
    p, s = input().split()
    p = int(p)
    if ac[p-1] == 0:
        if s == "AC":
            ac[p-1] = 1
        elif s == "WA":
            wa[p-1] += 1

print(sum(ac), sum(wa))

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n,m = map(int, input().split())
    result = [0]*n
    wa = 0
    ac = 0
    for _ in range(m):
        i = input().rstrip()
        i = i.split()
        p, s = int(i[0]), i[1]
        if s=='WA':
            if result[p-1]==0:
                wa += 1
        else:
            if result[p-1]==0:
                result[p-1] = 1
                ac += 1
    print(ac, wa)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

penalties = [0 for _ in range(N)]
acs = [0 for _ in range(N)]

for i, submit in enumerate(submits):
    p = int(submit[0])-1
    if acs[p]:
        continue
    if submit[1] == 'AC':
        acs[p] = 1
    else:
        penalties[p] += 1

ac_num = sum(acs)
penalty_num = sum([p for i, p in enumerate(penalties) if acs[i]])
print("{} {}".format(sum(acs), sum(penalties)))