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())
L = list()
for m in range(M):
    l = input().split()
    L.append(l)
AC = 0
WA = 0
cnt = 0
A   = 0
for m in range(M):
    if L[m][1] == 'AC':
        A = 0
        if cnt == L[m][0]:
            continue
        A += 1
        AC += 1
        cnt = L[m][0]
    elif L[m][1] == 'WA':
        if A > 0 and cnt == L[m][0]:
            continue
        WA += 1
print('{} {}'.format(AC, WA))

Submission status: Wrong Answer

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

# In[32]:


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


# In[33]:


mydict = {}
for i in range(N):
    mydict[i+1] = {}
    mydict[i+1]["time"] = 0
    mydict[i+1]["AC"] = False
for x in pS:
    if x[1] == "AC":
        mydict[int(x[0])]["AC"] = True
    else: # x[1] == "WA"
        if mydict[int(x[0])]["AC"] == False:
            mydict[int(x[0])]["time"] += 1
t = sum([d["time"] for d in list(mydict.values())])
ac = sum([1 for d in list(mydict.values()) if d["AC"]])
print(ac, t)


# In[ ]:

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
tmp=[0]*n
wtmp=[0]*n
for _ in range(m):
    P,s=map(str,input().split())
    p=int(P)
    p-=1
    if not tmp[p]==0:
        continue
    if s=='AC':
        tmp[p]=1
    else:
        wtmp[p]+=1
ans1=sum(tmp)
for i in range(n):
    ans2=0
    if tmp[i]==1:
        ans2+=wtmp[i]
print(ans1,ans2)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
tmp=[0]*n
wtmp=[0]*n
for _ in range(m):
    P,s=map(str,input().split())
    p=int(P)
    p-=1
    if not tmp[p]==0:
        continue
    if s=='AC':
        tmp[p]=1
    else:
        wtmp[p]+=1
ans1=sum(tmp)
ans2=sum(wtmp)
print(ans1,ans2)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
tmp=list(range(1,N+1))
ans1=0
ans2=0
for _ in range(M):
    p,s=map(str,input().split())
    if int(p) in tmp:
        if s=='AC':
            tmp.remove(int(p))
            ans1+=1
        else:
            ans2+=1
print(ans1,ans2)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
L = list()
for m in range(M):
    l = input().split()
    L.append(l)
AC = 0
WA = 0
cnt = 0
res = False
for m in range(M):
    if L[m][1] == 'AC':
        if cnt == L[m][0]:
            continue
        AC += 1
        cnt = L[m][0]
    if L[m][1] == 'WA':
        if cnt == L[m][0]:
            continue
        WA += 1
print('{} {}'.format(AC, WA))

Submission status: Wrong Answer

Solution code:
import numpy as np
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])

answer = np.zeros([N,2], dtype=int)
for i in range(M):
  if S[i] == 'AC' and answer[p[i]-1][0] == 0:
    answer[p[i]-1][0] += 1
  elif S[i] == 'WA' and answer[p[i]-1][1] == 0:
    answer[p[i]-1][1] += 1

total = [0, 0]
for i in range(N):
  if answer[i][0] == 1:
    total[0] += answer[i][0]
    total[1] += answer[i][1]
print(total[0], total[1])

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
L = list()
for m in range(M):
    l = input().split()
    L.append(l)
AC = 0
WA = 0
cnt = 0
for m in range(M):
    res = False
    if L[m][1] == 'AC':
        # if cnt == L[m][0]:
        #     continue
        AC += 1
        res = True
        cnt = L[m][0]
    elif L[m][1] == 'WA':
        WA += 1
    if int(L[m][0]) == N and res == True:
        break
print('{} {}'.format(AC, WA))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
L = list()
for m in range(M):
    l = input().split()
    L.append(l)
AC = 0
WA = 0
cnt = 0
for m in range(M):
    res = False
    if L[m][1] == 'AC':
        if cnt == L[m][0]:
            continue
        AC += 1
        res = True
        cnt = L[m][0]
    elif L[m][1] == 'WA':
        WA += 1
    if int(L[m][0]) == N and res == True:
        break
print('{} {}'.format(AC, WA))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
L = list()
for m in range(M):
    l = input().split()
    L.append(l)
AC = 0
WA = 0
cnt = 0
for m in range(M):
    res = False
    if L[m][1] == 'AC':
        AC += 1
        res = True
        if res:
            cnt += 1
    elif L[m][1] == 'WA':
        WA += 1
    if int(L[m][0]) == N and res == True:
        break
if AC > 0:
    AC = AC // cnt
print('{} {}'.format(AC, 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])

past_p = [0]
tmp_AC, tmp_WA = 0, 0
total_AC, total_WA = 0, 0
flag = 1
for i in range(M):
  if p[i] not in past_p:	# 新しい問題を提出している場合
    if S[i] == 'AC':
      total_AC += 1
      flag = 0
    elif S[i] == 'WA':
      tmp_WA = 1
      flag = 1
    past_p.append(p[i])
  else:					# 同じ問題を提出している場合
    if S[i] == 'AC' and flag == 1:
      tmp_AC += 1
      total_AC += tmp_AC
      total_WA += tmp_WA
      tmp_AC, tmp_WA = 0, 0	# 初期化
      flag = 0
    elif S[i] == 'WA' and flag == 1:
      tmp_WA += 1
    
print(total_AC, total_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])

prev_p = 0
tmp_AC, tmp_WA = 0, 0
total_AC, total_WA = 0, 0
flag = 1
for i in range(M):
  if p[i] != prev_p:	# 新しい問題を提出している場合
    if S[i] == 'AC':
      total_AC += 1
      flag = 0
    elif S[i] == 'WA':
      tmp_WA = 1
      flag = 1
    prev_p = p[i]
  else:					# 同じ問題を提出している場合
    if S[i] == 'AC' and flag == 1:
      tmp_AC += 1
      total_AC += tmp_AC
      total_WA += tmp_WA
      tmp_AC, tmp_WA = 0, 0	# 初期化
      flag = 0
    elif S[i] == 'WA' and flag == 1:
      tmp_WA += 1
    
print(total_AC, total_WA)

Submission status: Wrong Answer

Solution code:
n1, n2 = [int(i) for i in input().split()]

a1 = []
d1 = {}
r1 = 0
r2 = 0

for i1 in range(n2):
    tt1, t2 = [i for i in input().split()]
    t1 = int(tt1)
    if t1 in d1:
        t3 = d1.get(t1)
        if t3 != 0:
            if t2 == "AC":
                r1 += 1
                r2 += t3
                d1 = {t1: 0} 
            else:
                d1 = {t1: t3 + 1} 
    else:
        if t2 == "AC":
            d1 = {t1: 0}
            r1 += 1
        else:
            d1 = {t1: 1}
        
print(str(r1) + " " + str(r2))

Submission status: Wrong Answer

Solution code:
n1, n2 = [int(i) for i in input().split()]

a1 = []
d1 = {}
r1 = 0
r2 = 0

for i1 in range(n2):
    t1, t2 = [i for i in input().split()]
    if t1 in d1:
        t3 = d1.get(t1)
        if t3 != 0:
            if t2 == "AC":
                r1 += 1
                r2 += t3
                d1 = {t1: 0} 
            else:
                d1 = {t1: t3 + 1} 
    else:
        if t2 == "AC":
            d1 = {t1: 0}
            r1 += 1
        else:
            d1 = {t1: 1}
        
print(str(r1) + " " + str(r2))

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10000000)
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue

# import fractions

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M = il()
    ANS = [sl() for _ in range(M)]

    keys = set()
    for p, S in ANS:
        keys.add(p)

    ret = {key:False for key in keys}
    ac, wa = 0, 0
    for p, S in ANS:
        if ret[p]: continue
        if S == 'WA':
            wa += 1
        if S == 'AC':
            ac += 1
            ret[p] = True
    print(ac, wa)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10000000)
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue

# import fractions

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M = il()

    AC = False
    P, ret, mis = 0, 0, 0
    for m in range(M):
        p, s = sl()
        p = int(p)
        if P != p:
            P = p
            AC = False
        if not AC and s == 'WA':
            mis += 1
        if not AC and s == 'AC':
            AC = True
            ret += 1
    print(ret, mis)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# import sys
# import math
# import itertools
# from collections import deque
# from collections import defaultdict
# import heapq
# import copy
# import bisect
# import numpy as np
# from scipy.special import comb

# def my_input(): return sys.stdin.readline().rstrip()
# sys.setrecursionlimit(100000)
# INF = 1001001001001
# MOD = 1000000007

def main():

    N, M = map(int, input().split())
    ac = [0 for _ in range(N)]
    wa = [0 for _ in range(N)]

    for _ in range(M):
        p, s = input().split()
        p = int(p) - 1
        if s == 'AC':
            ac[p] = 1
        else:
            if ac[p] == 0:
                wa[p] += 1

    # print(ac)
    # print(wa)

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

List = []
ans = [0  for i in range(N+1)]
WA = [0  for i in range(N+1)]

for i in range(M):
  p,S = input().split()
  p = int(p)
  
  if ans[p] == 0:
    if S == "AC":
      ans[p] = 1
    else:
      WA[p] += 1
      
A = sum(ans)
W = sum(WA)

print(A,W)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
Q = [0] * N
ac = set()
wa = []
penalty = 0
for i in range(M):
    p, S = input().split()
    if S == 'AC':
        ac.add(p)
    if S == 'WA':
        if p not in ac:
            wa.append(p)
for p in wa:
    if p not in ac:
        wa.remove(p)
print(len(ac), len(wa))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
right = set()
penalty = 0
for i in range(M):
    p, S = input().split()
    if S == 'AC':
        right.add(p)
    elif S == 'WA':
        if p not in right:
            penalty += 1
print(len(right), penalty)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
right = set()
penalty = 0
for i in range(M):
    p, S = input().split()
    if S == 'AC':
        right.add(p)
    if S == 'WA':
        if p not in right:
            penalty += 1
print(len(right), penalty)

Submission status: Wrong Answer

Solution code:
n,m = [int(x) for x in input().split(' ')]

info = {
    
}

for i in range(m):
    p,s = [x for x in input().split(' ')]
    if p not in info:
        if s == "WA":
            info[p] = [0, 1]
        elif s == "AC":
            info[p] = [1,0]
    else:
        if s == "WA":
            if info[p][0] == 0:
                info[p][1] += 1
        elif s == "AC":
            if info[p][0] == 0:
                info[p][0] = 1
    
ac = 0
wa = 0

for a in info.values():
    ac += a[0]
    wa += a[1]

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
walist = [0]*n
aclist = [0]*n

for i in range(m):
  p,s = input().split()
  if s == 'AC':
    aclist[int(p)-1] = 1
  elif s == 'WA' and aclist[int(p)-1] == 0:
    walist[int(p)-1] += 1 
    
print(sum(aclist),sum(walist))

Submission status: Wrong Answer

Solution code:
import collections
k,n = map(int, raw_input().split(' '))


cc = {'AC': collections.Counter(), 'WA': collections.Counter()}
for _ in range(n):
	i,res = raw_input().split(' ')
	i = int(i)
	if res == 'AC':
		cc['AC'][i] += 1
	elif res == 'WA':
		cc['WA'][i] += 1
s = 0
for p in cc['AC']:
	s += cc['WA'][p]
print len(cc['AC']), s #len(penalties)

Submission status: Wrong Answer

Solution code:
import collections
k,n = map(int, raw_input().split(' '))


cc = {'AC': collections.Counter(), 'WA': collections.Counter()}
penalties= set([])
for _ in range(n):
	i,res = raw_input().split(' ')
	i = int(i)
	if res == 'AC':
		if cc['AC'][i] == 0 and cc['WA'][i] > 0:
			penalties.add(i)
		cc['AC'][i] += 1
	elif res == 'WA':
		cc['WA'][i] += 1
		
print len(cc['AC']), len(penalties)

Submission status: Wrong Answer

Solution code:

def resolve():
    n,m=map(int,input().split())
    dic={}
    correct=0
    wrong=0
    passed=[]
    for _ in range(m):
        p,s=input().split()
        if not p in passed:
            if s=="AC":
            
                passed.append(p)
                correct+=1
            else:
                wrong+=1
    print(correct,wrong)
            
resolve()

Submission status: Wrong Answer

Solution code:
from bisect import bisect_left


N, M = map(int, input().split())
subs = {i: [] for i in range(1, N + 1)}
for _ in range(M):
    p, s = input().split()
    subs[int(p)].append(s == 'AC')
ac_cnt = 0
pn_cnt = 0
for sub in subs.values():
    if True not in sub:
        continue
    ac_cnt += 1
    pn_cnt += bisect_left(sub, True)
print(ac_cnt, pn_cnt)

Submission status: Wrong Answer

Solution code:
n,m = list(map(int,input().split(" ")))
ac_count = 0
wa_count = 0
p_dic = {}

for i in range(m):
    x = list(map(str,input().split(" ")))
    x0 = int(x[0])
    x1 = str(x[1])
    if (x0 in p_dic) and p_dic[x0] == 1:
        pass
    elif x0 not in p_dic:
        if x1 == "AC":
            ac_count += 1
            p_dic[x0] = 1
        else:
            wa_count += 1
            p_dic[x0] = 0
            # print(p_dic)
    else:
        if x1 == "AC":
            ac_count += 1
            p_dic[x0] = 1
            # print(p_dic)
        else:
            wa_count += 1
            p_dic[x0] = 0
            # print(p_dic)
print(ac_count,wa_count)

Submission status: Wrong Answer

Solution code:
n,m = list(map(int,input().split(" ")))
ac_count = 0
wa_count = 0
p_dic = {}

for i in range(m):
    x = list(map(str,input().split(" ")))
    x0 = int(x[0])
    x1 = str(x[1])
    if x0 not in p_dic:
        if x1 == "AC":
            ac_count += 1
            p_dic[x0] = 1
        else:
            wa_count += 1
            p_dic[x0] = 0
            print(p_dic)
    else:
        if x1 == "AC":
            if p_dic[x0] == 1:
                pass
            else:
                ac_count += 1
                p_dic[x0] = 1
                print(p_dic)
        else:
            if p_dic[x0] == 1:
                pass
            else:
                wa_count += 1
                p_dic[x0] = 0
                print(p_dic)
print(ac_count,wa_count)

Submission status: Wrong Answer

Solution code:
n,m = list(map(int,input().split(" ")))
ac_count = 0
wa_count = 0
p_dic = {}

for i in range(m):
    x = list(map(str,input().split(" ")))
    x0 = int(x[0])
    x1 = str(x[1])
    if x0 not in p_dic:
        if x1 == "AC":
            ac_count += 1
            p_dic[x0] = 1 #その問題がすでにACだったら1をいれる
        else:
            wa_count += 1
            p_dic[x0] = 0
    else:
        if x1 == "AC":
            if p_dic[x0] == 1:
                pass
            else:
                ac_count += 1
                p_dic[x0] = 1
        else:
            if p_dic[x0] == 1:
                pass
            else:
                wa_count += 1
                p_dic[x0] = 1

print(ac_count,wa_count)

Submission status: Wrong Answer

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

ps=[]
pena=[[0,False] for _ in range(n)]
for i in range(m):
    ps.append(input().split())
 
for i in range(m):
    if pena[int(ps[i][0])-1][1]==False and ps[i][1]=="WA":
        pena[int(ps[i][0])-1][0]+=1
    else:
        pena[int(ps[i][0])-1][1]=True

p=[pena[i][0] for i in range(len(pena))]
t=[pena[i][1] for i in range(len(pena))]
print(t.count(True),sum(p))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
cleared = [0 for i in range(N)]
penalty = 0
for i in range(M):
  p, s = map(str, input().split())
  p = int(p) - 1
  if cleared[p] == 1:
    continue
  else:
    if s == "AC":
      cleared[p] = 1
    else:
      penalty += 1
print(sum(cleared), penalty)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
cleared = [0 for i in range(N)]
penalty = 0
for i in range(M):
  p, s = map(str, input().split())
  p = int(p) - 1
  if cleared[p] == 1:
    continue
  if s == "AC":
    cleared[p] = 1
  else:
    penalty += 1
print(sum(cleared), penalty)

Submission status: Wrong Answer

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

cleared = set()
penalties = 0

for _ in range(M):
    q, result = input().split(' ')
    if result == 'AC':
        cleared.add(q)
    elif q not in cleared:
        penalties += 1

print(len(cleared), penalties)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

clears = defaultdict(int)
penalties = defaultdict(int)

for _ in range(M):
    q, result = input().split(' ')
    if result == 'AC':
        clears[q] += 1
    elif clears[q] == 0:
        penalties[q] += 1

n_cleared = len([0 for q in clears.keys() if clears[q] > 0])
n_penalty = sum([p for p in penalties.values()])

print(n_cleared, n_penalty)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
dicwa = {}
dicac = {}
wan = 0
acn = 0

for i in range(m):
  p,s = input().split()
  if p not in dicwa and s == 'WA' and p not in dicac:
    dicwa[p] = 1
  elif p not in dicac and s == 'AC':
    dicac[p] = 1
  elif p not in dicac and s == 'WA':
    dicwa[p] += 1
    
for i in range(1,n+1):
  if str(i) not in dicwa:
    dicwa[str(i)] = 0
  if str(i) not in dicac:
    dicac[str(i)] = 0

for i in range(1,n+1):
  wan += dicwa[str(i)]
  acn += dicac[str(i)]
  
print(acn,wan)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
p=[True]*n
y=[0]*n
i=0
l=0
for  _ in range(m):
    k,o=input().split()
    k=int(k)-1
    if p[k]==True:
        if o=="AC":
            i+=1
            p[k]=False
            y[k]=1
        elif y[k]==0:
            l+=1
print(i,l)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
p=[True]*n
i=0
l=0
for  _ in range(m):
    k,o=input().split()
    k=int(k)-1
    if p[k]==True:
        if o=="AC":
            i+=1
            p[k]=False
        else:
             l+=1
print(i,l)

Submission status: Wrong Answer

Solution code:
# C - Welcome to AtCoder
# https://atcoder.jp/contests/abc151/tasks/abc151_c

n,m = map(int,input().split())
submits = [list(input().split()) for i in range(0,m)]

ac = 0
wa = 0

AC = "AC"
WA = "WA"

tmp_wa = 0
tmp_ac = []


for i in range(len(submits)):
    # ACなら正解数をカウントアップ
    if submits[i][1] == AC:
        # 同じ問題に正解してないかチェック
        if submits[i] in tmp_ac:
            # tmp_ac = submits[i]
            continue
        ac += 1
        # WAの数をカウント
        wa += tmp_wa
        # WAを初期化
        tmp_wa = 0
    else:
        if submits[i] in tmp_ac:
            # tmp_ac = submits[i]
            continue
        # WAならwa+1
        tmp_wa += 1
    tmp_ac.append(submits[i])


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

Submission status: Wrong Answer

Solution code:
# C - Welcome to AtCoder
# https://atcoder.jp/contests/abc151/tasks/abc151_c

n,m = map(int,input().split())
submits = [list(input().split()) for i in range(0,m)]

ac = 0
wa = 0

AC = "AC"
WA = "WA"

tmp_wa = 0
tmp_ac = []


for i in range(len(submits)):
    # ACなら正解数をカウントアップ
    if submits[i][1] == AC:
        # 同じ問題に正解してないかチェック
        if submits[i] in tmp_ac:
            # tmp_ac = submits[i]
            continue
        ac += 1
        # WAの数をカウント
        wa += tmp_wa
        # WAを初期化
        tmp_wa = 0
        tmp_ac.append(submits[i])
    else:
        # WAならwa+1
        tmp_wa += 1

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

Submission status: Wrong Answer

Solution code:
# C - Welcome to AtCoder
# https://atcoder.jp/contests/abc151/tasks/abc151_c

n,m = map(int,input().split())
submits = [list(input().split()) for i in range(0,m)]

ac = 0
wa = 0

AC = "AC"
WA = "WA"

tmp_wa = 0
tmp_ac = []


for i in range(len(submits)):
    # ACなら正解数をカウントアップ
    if submits[i][1] == AC:
        # 同じ問題に正解してないかチェック
        if submits[i] == tmp_ac:
            # tmp_ac = submits[i]
            continue
        ac += 1
        # WAの数をカウント
        wa += tmp_wa
        # WAを初期化
        tmp_wa = 0
        tmp_ac = submits[i]
    else:
        # WAならwa+1
        tmp_wa += 1

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

Submission status: Wrong Answer

Solution code:
# C - Welcome to AtCoder
# https://atcoder.jp/contests/abc151/tasks/abc151_c

n,m = map(int,input().split())
submits = [list(input().split()) for i in range(0,m)]

ac = 0
wa = 0

AC = "AC"
WA = "WA"

tmp_wa = 0
tmp_ac = []


for i in range(len(submits)):
    # ACなら正解数をカウントアップ
    if submits[i][1] == AC:
        # 同じ問題に正解してないかチェック
        if submits[i] == tmp_ac:
            tmp_ac = submits[i]
            continue
        ac += 1
        # WAの数をカウント
        wa += tmp_wa
        # WAを初期化
        tmp_wa = 0
        tmp_ac = submits[i]
    else:
        # WAならwa+1
        tmp_wa += 1

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

Submission status: Wrong Answer

Solution code:
# C - Welcome to AtCoder
# https://atcoder.jp/contests/abc151/tasks/abc151_c

n,m = map(int,input().split())
submits = [list(input().split()) for i in range(0,m)]

ac = 0
wa = 0

AC = "AC"
WA = "WA"

tmp_wa = 0
tmp_ac = 0


for i in range(len(submits)):
    # ACなら正解数をカウントアップ
    if submits[i][1] == AC:
        # 同じ問題に正解してないかチェック
        if submits[i] == tmp_ac:
            tmp_ac = submits[i]
            continue
        ac += 1
        # WAの数をカウント
        wa += tmp_wa
        # WAを初期化
        tmp_wa = 0
        tmp_ac = submits[i]
    else:
        # WAならwa+1
        tmp_wa += 1

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

Submission status: Wrong Answer

Solution code:
# C - Welcome to AtCoder
# https://atcoder.jp/contests/abc151/tasks/abc151_c

n,m = map(int,input().split())
submits = [list(input().split()) for i in range(0,m)]

ac = 0
wa = 0

AC = "AC"
WA = "WA"

tmp_wa = 0
tmp_ac = 0


for i in range(len(submits)):
    # ACなら正解数をカウントアップ
    if submits[i][1] == AC:
        # 同じ問題に正解してないかチェック
        if submits[i][0] == tmp_ac:
            tmp_ac = submits[i][0]
            continue
        ac += 1
        # WAの数をカウント
        wa += tmp_wa
        # WAを初期化
        tmp_wa = 0
        tmp_ac = submits[i][0]
    else:
        # WAならwa+1
        tmp_wa += 1

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

Submission status: Wrong Answer

Solution code:
# C - Welcome to AtCoder
# https://atcoder.jp/contests/abc151/tasks/abc151_c

n,m = map(int,input().split())
submits = [list(input().split()) for i in range(0,m)]

ac = 0
wa = 0

AC = "AC"
WA = "WA"

tmp_wa = 0
tmp_ac = 0


for i in range(len(submits)):
    # ACなら正解数をカウントアップ
    if submits[i][1] == AC:
        # 同じ問題に正解してないかチェック
        if submits[i][0] == tmp_ac:
            continue
        ac += 1
        # WAの数をカウント
        wa += tmp_wa
        # WAを初期化
        tmp_wa = 0
        tmp_ac = submits[i][0]
    else:
        # WAならwa+1
        tmp_ac = submits[i][0]
        tmp_wa += 1

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

Submission status: Wrong Answer

Solution code:
# C - Welcome to AtCoder
# https://atcoder.jp/contests/abc151/tasks/abc151_c

n,m = map(int,input().split())
submits = [list(input().split()) for i in range(0,m)]

ac = 0
wa = 0

AC = "AC"
WA = "WA"

tmp_wa = 0
tmp_ac = 0


for i in range(len(submits)):
    # ACなら正解数をカウントアップ
    if submits[i][1] == AC:
        # 同じ問題に正解してないかチェック
        if submits[i][0] == tmp_ac:
            continue
        ac += 1
        # WAの数をカウント
        wa += tmp_wa
        # WAを初期化
        tmp_wa = 0
        tmp_ac = submits[i][0]
    else:
        # WAならwa+1
        tmp_wa += 1

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ans = []
for m in range(M):
    ans.append(input().split())

ac = 0
wa = 0
for n in range(1, N+1):
    for a in ans:
        if a[0] != str(n):
            continue
        if a[1] == "AC":
            ac += 1
            break
        elif a[1] == "WA":
            wa += 1
            continue
        
print(ac, wa)

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import numpy

rl = sys.stdin.readline

n, k= map(int, rl().split())
li = [[0, 0] for _ in range(n)]
for _ in range(k):
    a, b = rl().split()
    b = b.rstrip()
    a = int(a) - 1
    if b == 'WA':
        li[a][0] += 1
    elif li[a][1] == 0:
        li[a][1] = 1
ac = 0
wa = 0
for lis in li:
    i, v = lis
    wa += i
    if v == 1:
        ac += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import numpy

rl = sys.stdin.readline

n, k= map(int, rl().split())
li = [[0, 0] for _ in range(n)]
for _ in range(k):
    a, b = rl().split()
    b = b.rstrip()
    a = int(a) - 1
    if li[a][1] == 0:
        if b == 'WA':
            li[a][0] += 1
        else:
            li[a][1] = 1
ac = 0
wa = 0
for lis in li:
    i, v = lis
    wa += i
    if v == 1:
        ac += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import numpy

rl = sys.stdin.readline

n, k= map(int, rl().split())
li = [[0, 0] for _ in range(n)]
for _ in range(k):
    a, b = rl().split()
    a = int(a) - 1
    if li[a][1] == 0:
        if b == 'WA':
            li[a][0] += 1
        else:
            li[a][1] = 1
ac = 0
wa = 0
for lis in li:
    i, v = lis
    wa += i
    if v == 1:
        ac += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import numpy

rl = sys.stdin.readline

n, k= map(int, rl().split())
li = [[0, 0]]*n
for _ in range(k):
    a, b = rl().split()
    a = int(a) - 1
    if li[a][1] == 0:
        if b == 'WA':
            li[a][0] += 1
        else:
            li[a][1] = 1
ac = 0
wa = 0
for lis in li:
    i, v = lis
    wa += i
    if v == 1:
        ac += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import numpy

rl = sys.stdin.readline

n, k= map(int, rl().split())
li = [[0, 0]]*n
for _ in range(k):
    a, b = rl().split()
    a = int(a) - 1
    if li[a][1] == 0:
        if b == 'WA':
            li[a][0] += 1
        else:
            li[a][1] = 1
ac = 0
wa = 0
print(li)
for lis in li:
    i, v = lis
    wa += i
    if v == 1:
        ac += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import numpy

rl = sys.stdin.readline

n, k= map(int, rl().split())
li = [['WA'] for _ in range(n)]
for _ in range(k):
    a, b = rl().split()
    a = int(a)
    a -= 1
    if li[a][-1] == 'WA':
        li[a].append(b)
ac = 0
wa = 0
for i in li:
    for v in i:
        if v == 'AC':
            ac += 1
        elif v == 'WA':
            wa += 1
print(ac, wa-len(li))

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import numpy

rl = sys.stdin.readline

n, k= map(int, rl().split())
li = [['WA'] for _ in range(n)]
for _ in range(k):
    a, b = rl().split()
    a = int(a)
    a -= 1
    if li[a][-1] == 'WA':
        li[a].append(b)
print(li)
ac = 0
wa = 0
for i in li:
    for v in i:
        if v == 'AC':
            ac += 1
        elif v == 'WA':
            wa += 1
print(ac, wa-len(li))

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
ans = [0,0]
pt = []
for i in range(m):
    p,s = input().split()
    if p in pt:
        continue
    else:
        if s == 'AC':
            pt.append(p)
            ans[0]+=1
        else :
            ans[1]+=1
print(*ans)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
ans = [0,0]
pt = []
for i in range(m):
    p,s = input().split()
    if p not in pt and s == 'WA':
        ans[1]+=1
    elif p not in pt :
        ans[0]+=1
        pt.append(p)
print(*ans)

Submission status: Wrong Answer

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

miss=[[0,False] for _ in range(N)]

for p,s in PS:
  p=int(p)
  if miss[p-1][1]==False and s=="WA":
    miss[p-1][0]+=1
  if s=="AC":
    miss[p-1][1]=True
pena=0
ac=0
for m,tf in miss:
  pena+=m*tf
  ac+=tf

print(str(pena)+" "+str(ac))

Submission status: Wrong Answer

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

miss=[[0,False] for _ in range(N)]

for p,s in PS:
  p=int(p)
  if miss[p-1][1]==False and s=="WA":
    miss[p-1][0]+=1
  if s=="AC":
    miss[p-1][1]=True
pena=0
ac=0
for m,tf in miss:
  pena+=m
  ac+=tf

print(str(pena)+" "+str(ac))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
fin=set()
AC=0
WA=0
for i in range(M):
  p,s=input().split()
  p=int(p)
  if not p in fin:
    if s=="AC":
      AC+=1
      fin.add(p)
    if s=="WA":
      WA+=1
print(AC,WA)