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-----
2 5
1 WA
1 AC
2 WA
2 AC
2 WA

-----Sample Output-----
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.
[{"code": "N, M = [int(n) for n in input().split()]\n\nsubmit = []\nAC = [0] * N\nWA = [0] * N\n\nfor i in range(M):\n    p, s = [n for n in input().split()]\n    p = int(p)\n\n    if AC[p-1] == 1:\n        continue\n\n    if s == 'AC':\n        AC[p-1] = 1\n \n    elif s == 'WA':\n        WA[p-1] += 1\n\npen = [x*y for x, y in zip(AC, WA)]\n\nprint(sum(AC), sum(pen))", "passed": true, "time": 0.16, "memory": 15688.0, "status": "done"}, {"code": "N, M = map(int, input().split(' '))\nac_set = set()\nwa_cnt_list = [0] * N\nac_cnt, wa_cnt = 0, 0\nfor i in range(M):\n    num, res = input().split(' ')\n    num = int(num) - 1\n    if num not in ac_set:\n        if res == 'AC':\n            ac_cnt += 1\n            wa_cnt += wa_cnt_list[num]\n            ac_set.add(num)\n        else:\n            wa_cnt_list[num] += 1\nprint(ac_cnt, wa_cnt)", "passed": true, "time": 0.15, "memory": 14108.0, "status": "done"}, {"code": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Tue Sep  8 16:23:28 2020\n\n@author: liang\n\"\"\"\n\nN, M = map(int, input().split())\nAC_list = [0]*N\nWA_list = [0]*N\n\nfor i in range(M):\n    p, j = input().split()\n    p = int(p)\n    if j == 'AC':\n        AC_list[p-1] += 1\n    else:\n        if AC_list[p-1] == 0:\n            WA_list[p-1] += 1\n\nAC = 0\nWA = 0\nfor i in range(N):\n    if AC_list[i] >= 1:\n        AC += 1\n        WA += WA_list[i]\n    \nprint(AC, WA)", "passed": true, "time": 0.16, "memory": 14972.0, "status": "done"}, {"code": "N, M = map(int, input().split(' '))\nac_set = set()\nwa_cnt_ls = [0] * N\nwa_cnt = 0\nfor i in range(M):\n    p, s = input().split(' ')\n    idx = int(p) - 1\n    if not idx in ac_set:\n        if s == 'AC':\n            wa_cnt += wa_cnt_ls[idx]\n            ac_set.add(idx)\n        else:\n            wa_cnt_ls[idx] += 1\nprint(len(ac_set), wa_cnt)", "passed": true, "time": 0.15, "memory": 14276.0, "status": "done"}, {"code": "import sys\ndef readint():\n    return int(sys.stdin.readline())\n\ndef readints():\n    return tuple(map(int,sys.stdin.readline().split()))\n\ndef readintslist(n):\n    return [tuple(map(int,sys.stdin.readline().split())) for _ in range(n)]\n\ndef main():\n    n,m = readints()\n    frag = [False]*(n+1)\n    penalties = [0]*(n+1)\n    for _ in range(m):\n        p,s = input().split()\n        p = int(p)\n        if frag[p]:\n            continue\n        if s==\"AC\":\n            frag[p] = True\n        else:\n            penalties[p] += 1\n    print(sum(frag),sum([penalties[i] for i in range(n+1) if frag[i]]))\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.15, "memory": 14912.0, "status": "done"}, {"code": "n, m = map(int,input().split())\nac = set()\nw, x = 0, [0 for i in range(n)]\nfor i in range(m):\n  p, s = input().split()\n  l = int(p) -1\n  if not l in ac:\n    if s == \"AC\":\n      ac.add(l)\n      w += x[l]\n    else:\n      x[l] += 1\nprint(len(ac),w)", "passed": true, "time": 0.15, "memory": 14296.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nanswers = []\nfor _ in range(m):\n    num,res = input().split()\n    num = int(num)\n    answers.append([num, res])\n\nAC_cnt = 0\nWA_cnt = 0\n\nAC_problems = [0]*n\nWA_problems = [0]*n\nfor answer in answers:\n    if answer[1] == 'WA' and AC_problems[answer[0]-1] != 1:\n        WA_problems[answer[0]-1] += 1\n    else:\n        if AC_problems[answer[0]-1] == 0:\n            AC_problems[answer[0]-1] += 1\n        else:\n            continue\nfor i in range(len(AC_problems)):\n    AC_cnt += AC_problems[i]\n    if AC_problems[i] == 1:\n        WA_cnt += WA_problems[i]\n\nprint(AC_cnt, WA_cnt)", "passed": true, "time": 0.16, "memory": 14924.0, "status": "done"}, {"code": "n, m = list(map(int,input().split()))\np = [input().split() for _ in range(m)]\nac = [0] * n\nwa = [0] * n\nfor i in p:\n    if i[1] == \"AC\" and ac[int(i[0])-1] == 0:\n        ac[int(i[0])-1] = 1\n    elif i[1] == \"WA\" and ac[int(i[0])-1] == 0:\n        wa[int(i[0])-1] += 1\nwasum = 0\nfor i in range(n):\n    if ac[i] == 1:\n        wasum += wa[i]\nprint(f\"{sum(ac)} {wasum}\")\n", "passed": true, "time": 0.15, "memory": 15012.0, "status": "done"}, {"code": "n, m= map(int, input().split())\nps = [list(map(str,input().split())) for _ in range(m)]\n\nstr_l = [\"WA\"]*n\nint_l = [0]*n\nnum = 0\nac = 0\n\nfor pp, s in ps:\n    p = int(pp)-1\n    if s == \"AC\":\n        str_l[p] = \"AC\"\n    else:\n        if str_l[p] != \"AC\":\n            int_l[p] += 1\n\nfor i in range(n):\n    if str_l[i] == \"AC\":\n        num += int_l[i]\n        ac += 1\n\nprint(ac,num)", "passed": true, "time": 0.23, "memory": 14668.0, "status": "done"}, {"code": "N, M = map(int, input().split())\np_S = [input().split() for _ in range(M)]\n\n# N, M=O(10^5)\u306a\u306e\u3067\u3001O(N+M)\u3067\u89e3\u304f\uff01\nAC = [False]*N\nWA = [0]*N\n \n# i\u756a\u76ee\u306e\u63d0\u51fa\u306b\u304a\u3044\u3066\u3001\n# (1) \u307e\u3060'AC'\u3055\u308c\u3066\u304a\u3089\u305a\u3001\u63d0\u51fa\u304cWA\u3060\u3063\u305f\u5834\u5408\uff1aWA += 1\n# (2) \u307e\u3060'AC'\u3055\u308c\u3066\u304a\u3089\u305a\u3001\u63d0\u51fa\u304cAC\u3060\u3063\u305f\u5834\u5408\uff1aAC += 1 \n# (3) \u3059\u3067\u306b'AC'\u3055\u308c\u3066\u3044\u308b\u5834\u5408\uff1a\u4f55\u3082\u3057\u306a\u3044\nfor i in range(M):    \n  num = int(p_S[i][0])-1\n  if AC[num] == 0 and p_S[i][1] == 'WA': WA[num] += 1\n  elif AC[num] == 0 and p_S[i][1] == 'AC': AC[num] = True\n  else: continue\n\n# 'AC'\u3092\u51fa\u3057\u305f\u5404\u554f\u984c\u306b\u304a\u3044\u3066\u3001\u521d\u3081\u3066'AC'\u3092\u51fa\u3059\u307e\u3067\u306b\u51fa\u3057\u305f'WA'\u306e\u6570\u306e\u548c\u3092\u6c42\u3081\u308b\ns = 0\nfor i in range(N):\n  if AC[i]:\n    s += WA[i]\n    \nprint(sum(AC), s)", "passed": true, "time": 0.24, "memory": 15048.0, "status": "done"}, {"code": "N,M = map(int,input().split())\nP = []\nS = []\nAC = [0]*(N+1)\nWA = [0]*(N+1)\nac = 0\nwa = 0\nfor i in range(M):\n    p,s = input().split()\n    P.append(int(p))\n    S.append(s)\nfor i in range(M):\n    if(S[i] == \"WA\" and AC[P[i]] == 0):\n        WA[P[i]] += 1\n    if(S[i] == \"AC\"):\n        AC[P[i]] += 1\nfor i in range(1,N+1):\n    if(AC[i] >= 1):\n        ac += 1\n        wa += WA[i]\nprint(ac,wa)", "passed": true, "time": 0.15, "memory": 15128.0, "status": "done"}, {"code": "N,M = map(int,input().split())\n\n#AC,WA\nP = [0]*N\nPenalty = 0\nAccepted = 0\n\nfor i in range(M) :\n    p,S = input().split()\n    p = int(p)\n    \n    if S == \"AC\" and P[p-1] != -1:\n        Penalty += P[p-1]\n        Accepted += 1\n        P[p-1] = -1\n    elif S == \"WA\" and P[p-1] != -1:\n        P[p-1] += 1\n\nprint(Accepted,Penalty)", "passed": true, "time": 0.21, "memory": 14212.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\nac = 0\nwa = 0\ncur_n = 0\ncur_wa = 0\ncur_ac = False\npset = []\nfor i in range(m):\n    p, s = input().split()\n    pset.append((int(p), s))\npset.sort(key= lambda x:x[0])\n\nfor j in range(m):\n    if cur_n != pset[j][0]:\n        cur_n = pset[j][0]\n        cur_ac = False\n        cur_wa = 0\n    if cur_ac == False:\n        if pset[j][1] == 'AC':\n            ac += 1\n            wa += cur_wa\n            cur_ac = True\n        else:\n            cur_wa += 1\n\nprint(f'{ac} {wa}')\n", "passed": true, "time": 0.14, "memory": 14344.0, "status": "done"}, {"code": "n,m = map(int, input().split())\nl = [[] for _ in range(n)]\nac,wa = (0,0)\nfor i in range(m):\n  p,s = input().split()\n  p = int(p)\n  if s == \"AC\":\n    if s not in l[p-1]:\n      l[p-1].append(s)\n      ac += 1\n      wa += l[p-1].count(\"WA\")\n  else:\n    l[p-1].append(s)\nprint(ac,wa)", "passed": true, "time": 0.17, "memory": 20252.0, "status": "done"}, {"code": "N,M = map(int, input().split())\nans = [0]*N\nac = 0\np = 0\n\nfor m in range(M):\n    a,b = map(str, input().split())\n    a = int(a) - 1\n\n    if ans[a] != -1 and b == 'WA':\n        ans[a] += 1\n    if ans[a] != -1 and b == 'AC':\n        ac += 1\n        p += ans[a]\n        ans[a] = -1\n\nprint(ac,p)", "passed": true, "time": 0.15, "memory": 14332.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nac = set()\npena = 0\nwalen = [0]*N\n\nfor i in range(M):\n    p, S = map(str, input().split())\n    p = int(p) - 1\n    if p in ac:\n        continue\n    elif S == 'AC':\n        ac.add(p)\n        pena += walen[p]\n    else:\n        walen[p] += 1\n\nprint(len(ac), pena)", "passed": true, "time": 0.22, "memory": 14332.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nps = [list(input().split()) for _ in range(m)]\nans = [0]*n\nwa = [0]*n\nac = [0]*n\nfor i in range(m):\n    p, s = int(ps[i][0]), ps[i][1]\n    if ac[p-1] == 0:\n        if s == 'WA':\n            wa[p-1] += 1\n        else:\n            ans[p-1] = wa[p-1]\n            ac[p-1] += 1\nprint(sum(ac), sum(ans))", "passed": true, "time": 0.14, "memory": 15940.0, "status": "done"}, {"code": "from collections import defaultdict\ndef main():\n    n, m = map(int, input().split(\" \"))\n    d = defaultdict(lambda:\"\")\n    dp = defaultdict(lambda:0)\n    cnt_p=0\n    cnt_ca=0\n    for i in range(m):\n        p,s = input().split(\" \")\n        if d[p] == \"\":\n            if s == \"AC\":\n                d[p] = 1\n                cnt_ca += 1\n                cnt_p += dp[p]\n            else:\n                dp[p] += 1\n    print(f\"{cnt_ca} {cnt_p}\")\n\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nAC = [0]*(N+1)\nWA = [0]*(N+1)\n\nfor i in range (0, M):\n    A, B = map(str, input().split())\n    A = int(A)\n    if B == 'WA':\n        if AC[A] == 0:\n            WA[A]+=1\n    else:\n        if AC[A] == 0:\n            AC[A] = 1\n\nWronganswer = 0\nfor i in range (0, N+1):\n    Wronganswer+=(AC[i]*WA[i])\nprint(sum(AC), Wronganswer)", "passed": true, "time": 0.15, "memory": 15096.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nps = [list(input().split()) for _ in range(m)]\n\nc = [0] * n\nfor p, s in ps:\n    if s == 'AC':\n        c[int(p)-1] = 1\nd = [0] * n\nwa = 0\nac = 0\nfor p, s in ps:\n    if d[int(p)-1] == 0:\n        if s == 'WA':\n            if c[int(p)-1] == 1:\n                wa += 1\n        else:\n            ac += 1\n            d[int(p)-1] = 1\nprint(ac, wa)", "passed": true, "time": 0.14, "memory": 14944.0, "status": "done"}, {"code": "n, m = map(int, input().split())\np = []\ns = []\nfor i in range(m):\n    p_i, s_i = input().split()\n    p.append(int(p_i))\n    s.append(s_i)\n\ncorrect = [0]*n\npenalty = [0]*n\n\nfor i in range(m):\n    no = p[i]\n    if correct[no-1] == 1:\n        continue\n    elif s[i] == 'WA':\n        penalty[no-1] += 1\n    elif s[i] == 'AC':\n        correct[no-1] = 1\n\npen = 0\nfor i in range(n):\n    if correct[i] == 1:\n        pen += penalty[i]\nprint(sum(correct), pen)", "passed": true, "time": 0.14, "memory": 15064.0, "status": "done"}, {"code": "n,m=map(int,input().split())\nl1 = [0]*n\nl2 = [0]*n\nfor i in range(m):\n        p,s=map(str,input().split())\n        p= int(p)\n        if s == 'AC':\n                l2[p-1] +=1\n        else:\n                if l2[p-1] == 0:\n                        l1[p-1] +=1\ncntac = 0\ncntwa = 0\nfor i in range(n):\n        if l2[i] != 0:\n                cntac +=1\n                cntwa += l1[i]\n\n                \n                \nprint(cntac,cntwa)", "passed": true, "time": 0.14, "memory": 15080.0, "status": "done"}, {"code": "n,m = map(int,input().split())\np,s =[],[]\nfor _ in range(m):\n    p_ ,s_ = input().split()\n    p.append(int(p_))\n    s.append(s_)\n\nAC = [0]*n\nWA = [0]*n\n\nfor i in range(m):\n    if s[i]==\"WA\" and AC[p[i]-1]==0:\n        WA[p[i]-1] += 1\n    elif s[i]==\"AC\" and AC[p[i]-1]==0:\n        AC[p[i]-1] += 1\n    \nfor i in range(m):\n    if AC[p[i]-1]==0:\n        WA[p[i]-1]=0\nprint(sum(AC),sum(WA))", "passed": true, "time": 0.14, "memory": 14868.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nd = [0] * (n+1)\nac = 0\nwa = 0\nfor i in range(m):\n  p, s = input().split()\n  p = int(p)\n  if d[p] == -1:\n    continue\n  elif s == \"AC\":\n    ac += 1\n    wa += d[p] \n    d[p] = -1\n  else:\n    d[p] += 1\nprint(ac, wa)", "passed": true, "time": 0.22, "memory": 14104.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nq = [0 for i in range(n)]\na = [False for i in range(n)]\nans1 = 0\nans2 = 0\nfor i in range (m):\n  p, S = input().split()\n  p = int(p) - 1\n  if S == 'AC':\n    a[p] = True\n  else:\n    if a[p] == False:\n      q[p] += 1\nfor i in range(n):\n  if a[i] == True:\n    ans1 += 1\n    ans2 += q[i]\nprint(ans1, ans2)", "passed": true, "time": 0.14, "memory": 14904.0, "status": "done"}, {"code": "N, M = map(int, input().split())\npS = [list(input().split()) for _ in range(M)]\n\nb = 0\nlst = [0 for _ in range(N)]\nfor p, S in pS:\n  p = int(p)\n  if S == \"WA\" and lst[p-1] <= 0:\n    lst[p-1] -= 1\n  if S == \"AC\" and lst[p-1] <= 0:\n    b += - lst[p-1]\n    lst[p-1] = 1\n\nprint(lst.count(1), b)", "passed": true, "time": 0.15, "memory": 14464.0, "status": "done"}, {"code": "N, M = map(int, input().split(' '))\nac_set = set()\nwa_cnt, wa_cnt_ls = 0, [ 0 for i in range(N) ]\nfor i in range(M):\n    p, s = input().split(' ')\n    idx = int(p) - 1\n    if not idx in ac_set:\n        if s == 'AC':\n            ac_set.add(idx)\n            wa_cnt += wa_cnt_ls[idx]\n        else:\n            wa_cnt_ls[idx] += 1\nprint(len(ac_set), wa_cnt)", "passed": true, "time": 0.14, "memory": 14392.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nAC = [0] * N\nWA1 = [0] * N\nWA2 = [0] * N\nfor i in range(M):\n  p, s = input().split()\n  if s == 'AC':\n    if AC[int(p) - 1] == 0:\n      AC[int(p) - 1] = 1\n      WA2[int(p) - 1] = WA1[int(p) - 1]\n  elif AC[int(p) - 1] == 0:\n    WA1[int(p) - 1] += 1\nprint(str(AC.count(1))+' '+ str(sum(WA2)))", "passed": true, "time": 0.15, "memory": 15604.0, "status": "done"}, {"code": "N, M = map(int, input().split(' '))\nac_set = set()\nwa_cnt_list = [0] * N\nac_cnt, wa_cnt = 0, 0\nfor i in range(M):\n    num, res = input().split(' ')\n    num = int(num) - 1\n    if num not in ac_set:\n        if res == 'AC':\n            ac_cnt += 1\n            wa_cnt += wa_cnt_list[num]\n            ac_set.add(num)\n        else:\n            wa_cnt_list[num] += 1\nprint(ac_cnt, wa_cnt)", "passed": true, "time": 0.15, "memory": 14176.0, "status": "done"}, {"code": "n,m = map(int,input().split())\np = []\ns = []\nfor i in range(m):\n    P,S = input().split()\n    p.append(int(P))\n    s.append(S)\nquestion = [0] * n #\u305d\u308c\u305e\u308c\u306e\u554f\u984c\u306eWA\u306e\u6570\nac = 0\nwa = 0\nfor i in range(m):\n    if question[p[i] - 1] != -1:\n        if s[i] == \"AC\":\n            ac += 1\n            wa += question[p[i] - 1]\n            question[p[i] - 1] = -1\n        else:\n            question[p[i] - 1] += 1\nprint(str(ac) + \" \" + str(wa))", "passed": true, "time": 0.14, "memory": 14336.0, "status": "done"}, {"code": "N,M = map(int,input().split())\nP_S = [input().split() for _ in range(M)]\nwa_cnt = [0] * N\nac = 0\nwa = 0\nfor p,s in P_S:\n  index = int(p)-1\n  # AC\u306e\u5834\u5408\n  if s == \"AC\":\n    # \u521d\u3081\u3066\u3067\u306f\u306a\u3044\u5834\u5408\n    if wa_cnt[index] != -1:\n      wa += wa_cnt[index]\n      wa_cnt[index] = -1\n      ac += 1\n  else:\n    if wa_cnt[index] != -1:\n      wa_cnt[index] += 1\n\nprint(ac,wa)", "passed": true, "time": 0.14, "memory": 14308.0, "status": "done"}, {"code": "n,m=map(int,input().split())\na=[input().split()for _ in range(m)]\nc=[0]*n\nw=[0]*n\nfor i in range(m):\n    if c[int(a[i][0])-1]==0:\n        if a[i][1]==\"AC\":\n            c[int(a[i][0])-1]+=1\n        else:\n            w[int(a[i][0])-1]+=1\n    else:\n         pass\nfor i in range(n):\n    if c[i]==0:\n        w[i]=0\n    else:\n        pass\nprint(sum(c),sum(w))", "passed": true, "time": 0.16, "memory": 15124.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\nanswer = 0\npenalty = 0\nans = [0] * n\npen = [0] * n\n\nfor x in range(m):\n  p, s = input().split()\n  pi = int(p) - 1\n  if ans[pi] == 1:\n    continue\n\n  if s == 'AC':\n    answer += 1\n    ans[pi] = 1\n    penalty += pen[pi]\n  elif s == 'WA':\n    pen[pi] += 1\n\nprint(f'{answer} {penalty}')\n\n", "passed": true, "time": 0.14, "memory": 15072.0, "status": "done"}, {"code": "n,m = map(int,input().split())\np,s = [],[]\nfor _ in range(m):\n  a,b = map(str,input().split())\n  p.append(a)\n  s.append(b)\np = list(map(int,p))\nchecker = [0] * n\npenalty = [0] * n\nans = 0\nfor i,j in enumerate(s):\n  if j == \"AC\" and checker[p[i]-1] == 0:\n    checker[p[i]-1] = 1\n  elif j == \"WA\" and checker[p[i]-1] == 0:\n    penalty[p[i]-1] += 1\nfor k,l in enumerate(checker):\n  if l:\n    ans += penalty[k]\nprint(sum(checker),ans)", "passed": true, "time": 0.15, "memory": 14676.0, "status": "done"}, {"code": "N,M=map(int,input().split())\nWA=[0]*N\nAC=[0]*N\nfor i in range(M):\n    p,S=map(str,input().split())\n    if S=='WA' and AC[int(p)-1]!=1:\n        WA[int(p)-1]+=1\n    elif S=='AC':\n        AC[int(p)-1]=1\n\nQ=0\nfor i in range(N):\n    if AC[i]>0:\n        Q+=WA[i]\nprint(sum(AC),Q)", "passed": true, "time": 0.14, "memory": 15044.0, "status": "done"}, {"code": "N,M = map(int,input().split())\nnum_AC,num_WA = 0,0\nres = [list(input().split()) for i in range(M)]\ncheck = ['v']*N\nWA_check = [0]*N\nfor i,j in res:\n  i = int(i)\n  if check[i-1] == 'v':\n    if j == 'WA':\n      WA_check[i-1] += 1\n    if j == 'AC':\n      num_AC += 1\n      num_WA += WA_check[i-1]\n      check[i-1] = '.'\nprint(num_AC,num_WA)", "passed": true, "time": 0.57, "memory": 14944.0, "status": "done"}, {"code": "N,M = map(int, input().split())\nd = {'AC':0,'WA':0,}\nb = 0\nfor i in range(N + 1):\n  d[i] = 0\nfor j in range(M):\n  p,s = input().split()\n  p = int(p)\n  if s == 'AC':\n    if d[p] != -1:\n      b = d[p]\n      d[p] = -1\n      d['AC'] += 1\n      d['WA'] += b\n      b = 0  \n  if s == 'WA':\n    if d[p] != -1:\n       d[p] += 1\nprint(d['AC'],end = ' ')\nprint(d['WA'])\n  \n\n", "passed": true, "time": 0.26, "memory": 23668.0, "status": "done"}, {"code": "N, M = map(int, input().split())\ncount1 = 0\ncount2 = 0\nlis = [0] * N\nlis2 = [0] * N\nfor i in range(M):\n  p, S = input().split()\n  p = int(p)\n  if lis[p-1] == 0 and S == \"WA\":\n    lis2[p-1] += 1\n  elif lis[p-1] == 0 and S == \"AC\":\n    count1 += 1\n    lis[p-1] = 1\n  elif lis[p-1] == 1 and S == \"WA\":\n    continue\n  elif lis[p-1] == 1 and S == \"AC\":\n    continue\nfor i in range(N):\n  if lis[i] == 0:\n    lis2[i] = 0\ncount2 = sum(lis2)\nprint(str(count1) + \" \" + str(count2))", "passed": true, "time": 0.15, "memory": 15168.0, "status": "done"}, {"code": "N,M=map(int,input().split())\npenalty=[0]*N\nresult=[\"WA\"]*N\n\nfor i in range(M):\n  P,S=input().split()\n  if S==\"AC\":\n    result[int(P)-1]=\"AC\"\n  elif S==\"WA\" and result[int(P)-1]==\"WA\":\n    penalty[int(P)-1]+=1\n  else:\n    continue\n\nfor j in range(N):\n  if result[j]==\"WA\":\n    penalty[j]=0\n\nprint(result.count(\"AC\"),sum(penalty))", "passed": true, "time": 0.16, "memory": 15012.0, "status": "done"}, {"code": "n, m = map(int, input().split())\np_s = [ list(map(str, input().split())) for _ in range(m) ]\nac = [False] * n\nwa = [0] * n\nfor p, s in p_s:\n    if ac[int(p)-1] is False:\n        if s == 'AC':\n            ac[int(p)-1] = True\n        else:\n            wa[int(p)-1] += 1\nprint(sum([1 for i in ac if i == True ]), sum([i for i,j in zip(wa,ac) if j == True ]))", "passed": true, "time": 0.15, "memory": 15100.0, "status": "done"}, {"code": "n, m = map(int, input().split())\n\nlst = [ [i for i in input().split() ] for j in range(m) ]\n\nac = {}\nwa = {}\nvisited = []\nfor d in lst:\n  if d[0] in ac.keys():\n    continue\n  if d[1] == \"AC\":\n    if d[0] not in ac.keys():\n      ac[d[0]] = 1\n  else:\n    if d[0] in wa.keys():\n      wa[d[0]] += 1\n    else:\n      wa[d[0]] = 1\n\nac_count = 0\nwa_count = 0\n\nfor d in ac.keys():\n  ac_count += 1\n  if d in wa.keys():\n    wa_count += int(wa[d])\nprint(ac_count,wa_count)", "passed": true, "time": 0.58, "memory": 14124.0, "status": "done"}, {"code": "N, M = map(int, input().split(' '))\nac_set = set()\nwa_cnt_ls, wa_cnt = [0] * N, 0\n\nfor i in range(M):\n    p, s = input().split(' ')\n    idx = int(p) - 1\n    if not idx in ac_set:\n        if s == 'AC':\n            ac_set.add(idx)\n            wa_cnt += wa_cnt_ls[idx]\n        else:\n            wa_cnt_ls[idx] += 1\nprint(len(ac_set), wa_cnt)", "passed": true, "time": 0.14, "memory": 14152.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nA = [0]*(N+1)\nW = A.copy()\nfor _ in range(M):\n    P, S = input().split()\n    p = int(P)\n    if S == \"AC\":\n        A[p] = 1\n    elif A[p] == 0:\n        W[p] += 1\n\nprint(sum(A), sum(a*w for a, w in zip(A, W)))", "passed": true, "time": 0.15, "memory": 14980.0, "status": "done"}, {"code": "from collections import defaultdict as dc\nn, m = [int(i) for i in input().split()]\ncq_dic = {}\nwa_dic = dc(int)\nfor _ in range(m):\n  p, w = input().split()\n  if w == 'AC':\n    cq_dic[p] = 1\n  elif (not p in cq_dic) and  w == 'WA':\n    wa_dic[p] += 1\nans = sum([wa_dic[k] for k in cq_dic])\nprint(len(cq_dic), ans)", "passed": true, "time": 0.15, "memory": 14160.0, "status": "done"}, {"code": "n,m = map(int,input().split())\nAC = [0]*n\nWA = [0]*n\nans = 0\nfor i in range(m):\n    p,s = input().split()\n    p = int(p)-1\n    if s == \"AC\" and AC[p] == 0:\n        AC[p] = 1\n        ans += WA[p]\n    WA[p] += 1\nprint(sum(AC),ans)", "passed": true, "time": 0.23, "memory": 15128.0, "status": "done"}, {"code": "N, M = map(int, input().split(' '))\nac_set = set()\nwa_cnt_ls, wa_cnt = [ 0 for i in range(N) ], 0\nfor i in range(M):\n    p, s = input().split(' ')\n    idx = int(p) - 1\n    if not idx in ac_set:\n        if s == 'AC':\n            ac_set.add(idx)\n            wa_cnt += wa_cnt_ls[idx]\n        else:\n            wa_cnt_ls[idx] += 1\nprint(len(ac_set), wa_cnt)", "passed": true, "time": 0.14, "memory": 14236.0, "status": "done"}, {"code": "N, M = map(int, input().split(' '))\nac_set = set()\nwa_cnt, wa_cnt_ls = 0, [0] * N\nfor i in range(M):\n    p, s = input().split(' ')\n    idx = int(p) - 1\n    if not idx in ac_set:\n        if s == 'AC':\n            ac_set.add(idx)\n            wa_cnt += wa_cnt_ls[idx]\n        else:\n            wa_cnt_ls[idx] += 1\nprint(len(ac_set), wa_cnt)", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "N,M=map(int,input().split())\nx=[0]*N\ny=[0]*N\nP=[]\ns=[]\n\nfor i in range(M):\n    p,S=map(str,input().split())\n    P.append(int(p))\n    s.append(S)\nfor j in range(M-1,-1,-1):\n    if s[j]=='AC':\n        if x[P[j]-1]==0:\n            x[P[j]-1]=1\n        else:\n            y[P[j]-1]=0\n    elif s[j]=='WA':\n        if x[P[j]-1]==1:\n            y[P[j]-1]+=1\nprint(x.count(1),sum(y))", "passed": true, "time": 0.14, "memory": 14928.0, "status": "done"}, {"code": "n,m = map(int,input().split())\nl = [0]*n\nwcount = 0\nacount = 0\nfor i in range(m):\n  A,B = input().split()\n  a = int(A)\n  b = str(B)\n  if l[a-1] != -1 and b ==\"WA\":\n    l[a-1] += 1\n  elif l[a-1] != -1 and b ==\"AC\":\n    acount += 1\n    wcount += l[a-1]\n    l[a-1] = -1\nprint(acount,wcount)", "passed": true, "time": 0.14, "memory": 14416.0, "status": "done"}, {"code": "N, M = map(int, input().split(' '))\nac_set = set()\nwa_cnt_ls, wa_cnt = [0] * N, 0\nfor i in range(M):\n    p, s = input().split(' ')\n    idx = int(p) - 1\n    if not idx in ac_set:\n        if s == 'AC':\n            wa_cnt += wa_cnt_ls[idx]\n            ac_set.add(idx)\n        else:\n            wa_cnt_ls[idx] += 1\nprint(len(ac_set), wa_cnt)", "passed": true, "time": 0.14, "memory": 14268.0, "status": "done"}, {"code": "import sys\nimport math\nfrom collections import defaultdict, deque, Counter\nfrom copy import deepcopy\nfrom bisect import bisect, bisect_right, bisect_left\nfrom heapq import heapify, heappop, heappush\n    \ninput = sys.stdin.readline\ndef RD(): return input().rstrip()\ndef F(): return float(input().rstrip())\ndef I(): return int(input().rstrip())\ndef MI(): return map(int, input().split())\ndef MF(): return map(float,input().split())\ndef LI(): return list(map(int, input().split()))\ndef TI(): return tuple(map(int, input().split()))\ndef LF(): return list(map(float,input().split()))\ndef Init(H, W, num): return [[num for i in range(W)] for j in range(H)]\n    \n    \ndef main():\n    AC = defaultdict(int)\n    WA = defaultdict(int)\n    N, M = MI()\n    wa = 0\n    for i in range(M):\n        p, S = input().split()\n\n        if AC[p] == 0:\n            if S == \"WA\":\n                WA[p] +=1\n            else:\n                AC[p] = 1\n                wa += WA[p]\n\n    ac = sum(AC.values())\n    print(ac, wa)\n    \ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14168.0, "status": "done"}, {"code": "def resolve():\n    n,m = map(int,input().split())\n    ac_list = [0]*n\n    wa_count = [0]*n\n    ac = 0\n    wa = 0\n    for _ in range(m):\n        p,s = input().split()\n        if s == 'WA' and (ac_list[int(p)-1]==0):\n            wa_count[int(p)-1] += 1\n        elif s == 'AC' and (ac_list[int(p)-1]==0):\n            ac += 1\n            ac_list[int(p)-1] = 1\n    for (i,j) in zip(wa_count,ac_list):\n        if j: wa+=i\n    print(f'{ac} {wa}')\nresolve()", "passed": true, "time": 0.14, "memory": 14944.0, "status": "done"}, {"code": "from collections import defaultdict\nN, M = map(int, input().split())\nwa = defaultdict(int)\nac = {}\nfor i in range(M):\n    p, S = input().split()\n    if S == 'AC':        \n        ac[p] = True\n    else:\n        if p not in ac:\n            wa[p] += 1\nprint(len(ac), sum([wa[x] for x in ac.keys()]))", "passed": true, "time": 0.14, "memory": 14220.0, "status": "done"}, {"code": "n, m = map(int, input().split())\na = [input().split() for i in range(m)]\nwa =[0]*n #AC\u307e\u3067\u306eWA\u6570\nac = [0]*n\n\nfor i in range(m):\n    if a[i][1] == 'AC':\n      ac[int(a[i][0])-1] = 1\n    else:\n      if ac[int(a[i][0])-1]==0:\n        wa[int(a[i][0])-1] +=1\ncnt1, cnt2= 0,0\nfor i in range(n):\n  if ac[i] ==1:\n    cnt1 += ac[i]\n    cnt2 += wa[i]\n        \nprint(cnt1, cnt2)", "passed": true, "time": 0.14, "memory": 15076.0, "status": "done"}, {"code": "n,m=map(int,input().split())\nac_cnt = set()\nwa_cnt = 0\npenalty = [0]*n\nfor i in range(m):\n    p,s = input().split()\n    num = int(p) - 1\n    if num not in ac_cnt:\n        if s == \"AC\":\n            ac_cnt.add(num)\n            wa_cnt += penalty[num]\n        else:\n            penalty[num] += 1\nprint(len(set(ac_cnt)),wa_cnt)", "passed": true, "time": 0.14, "memory": 14120.0, "status": "done"}, {"code": "n,m = map(int, input().split())\nres = [0 for i in range(n)]\nP = [0 for i in range(n)]\nans = 0\np = 0\n \nfor i in range(m) :\n    pi, si = input().split()\n    pi = int(pi) - 1\n    if(res[pi]) :\n        continue\n    if(si == \"AC\") :\n        res[pi] = 1\n        ans += 1\n        p += P[pi]\n    else :\n        P[pi] += 1\nprint(ans, p)", "passed": true, "time": 0.14, "memory": 15112.0, "status": "done"}, {"code": "N,M = map(int, input().split())\n\nAC = [0] * N\nWA = [0] * N\n\nfor _ in range(M):\n    p,S = input().split()\n    p = int(p) - 1\n    if AC[p] == 1:\n        continue\n    else:\n        if S == 'AC':\n            AC[p] = 1\n        else:\n            WA[p] += 1\n\nPen = [x*y for (x, y) in zip(AC, WA)]\n\nprint(sum(AC), sum(Pen))", "passed": true, "time": 0.19, "memory": 15744.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nP = [0]*n\nAC = 0\nWA = 0\nfor i in range(m):\n    p, S = input().split()\n    p = int(p)\n    if S == \"AC\" and P[p-1] != -1:\n        WA += P[p-1]\n        AC += 1\n        P[p-1] = -1\n    elif S == \"WA\" and P[p-1] != -1:\n        P[p-1] += 1\nprint(AC, WA)", "passed": true, "time": 0.14, "memory": 14200.0, "status": "done"}, {"code": "N,M = map(int,input().split())\n \n#AC,WA\nP = [0]*N\nPenalty = 0\nAccepted = 0\n \nfor i in range(M) :\n    p,S = input().split()\n    p = int(p)\n    \n    if S == \"AC\" and P[p-1] != -1:\n        Penalty += P[p-1]\n        Accepted += 1\n        P[p-1] = -1\n    elif S == \"WA\" and P[p-1] != -1:\n        P[p-1] += 1\n\nprint(Accepted,Penalty)", "passed": true, "time": 0.14, "memory": 14316.0, "status": "done"}, {"code": "N,M=map(int,input().split())\nS=[0]*(N)\nQ=[0]*(N)\nfor i in range(M):\n    p,s=map(str,input().split())\n    p=int(p)\n    if  s=='AC':\n        S[p-1]=1\n    elif s=='WA' and S[p-1] ==0:\n        Q[p-1]+=1\n    else:\n        pass\nQ_com= [x * y for (x, y) in zip(S, Q)]\nprint (S.count(1),sum(Q_com))", "passed": true, "time": 0.14, "memory": 15840.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nACs = [0] * (N+1)\nPs = [0] * (N+1)\nfor _ in range(M):\n    p, s = input().split()\n    p = int(p)\n    if s == 'AC':\n        ACs[p] = 1\n    elif s == 'WA': # WA\n        if ACs[p] == 0: \n            Ps[p] += 1\n\nans1 = sum(ACs)\nans2 = 0\nfor i in range(1, N+1):\n    if ACs[i] == 1:\n        ans2 += Ps[i]\nprint(ans1, ans2)", "passed": true, "time": 0.15, "memory": 15068.0, "status": "done"}, {"code": "n,m = list(map(int, input().split()))\nwa = [0] * (n + 1)\nac = [0] * (n + 1)\nfor _ in range(m):\n    p,s = input().split()\n    p = int(p)\n    if s == 'WA' and ac[p] == 0:\n        wa[p] += 1\n    elif s == 'AC':\n        ac[p] = 1\n\nfor i,ok in enumerate(ac):\n    if not ok:\n        wa[i] = 0\n\nprint(('{} {}'.format(sum(ac), sum(wa))))\n", "passed": true, "time": 0.15, "memory": 14960.0, "status": "done"}, {"code": "\ndef i_input(): return int(input())\ndef i_map(): return map(int, input().split())\ndef i_list(): return list(map(int, input().split()))\ndef i_row(N): return [int(input()) for _ in range(N)]\ndef i_row_list(N): return [list(input().split()) for _ in range(N)]\n\nn,m=i_map()\nps=i_row_list(m)\nac=[0]*n\nwa=[0]*n\nfor p,s in ps:\n    if s=='AC':\n        ac[int(p)-1]=1\n    if s=='WA':\n        if ac[int(p)-1]==0:\n            wa[int(p)-1]+=1\nfor i in range(n):\n    if ac[i]==0:\n        wa[i]=0\nprint(sum(ac),sum(wa))", "passed": true, "time": 0.15, "memory": 15076.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nans = [0, 0]\nac = [0 for _ in range(n)]\nfor _ in range(m):\n  p, s = input().split()\n  p = int(p) - 1\n  if ac[p] == -1:\n    continue\n  elif s == \"AC\":\n    ans[0] += 1\n    ans[1] += ac[p]\n    ac[p] = -1\n  else:\n    ac[p] += 1\nprint(*ans)", "passed": true, "time": 0.15, "memory": 14444.0, "status": "done"}, {"code": "N,M=map(int, input().split())\nACList=[0]*(N+1)\nansAC=0\nansP=0\nfor i in range(M):\n\tp,S=map(str, input().split())\n\tp=int(p)\n\tif S==\"AC\" and ACList[p]!=-1:\n\t\tansAC+=1\n\t\tansP+=ACList[p]\n\t\tACList[p]=-1\n\telif S==\"WA\" and ACList[p]!=-1:\n\t\tACList[p]+=1\n\telse:\n\t\tcontinue\n\nprint(ansAC,ansP)", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "N, M = map(int, input().split(' '))\nac_set = set()\nwa_cnt, wa_cnt_ls = 0, [ 0 for i in range(N) ]\n\nfor i in range(M):\n    p, s = input().split(' ')\n    idx = int(p) - 1\n    if not idx in ac_set:\n        if s == 'AC':\n            ac_set.add(idx)\n            wa_cnt += wa_cnt_ls[idx]\n        else:\n            wa_cnt_ls[idx] += 1\nprint(len(ac_set), wa_cnt)", "passed": true, "time": 0.14, "memory": 14272.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nanswer = 0\npenalty = 0\nans = [0] * n\npen = [0] * n\n \nfor x in range(m):\n  p, s = input().split()\n  pi = int(p) - 1\n  if ans[pi] == 1:\n    continue\n \n  if s == 'AC':\n    answer += 1\n    ans[pi] = 1\n    penalty += pen[pi]\n  elif s == 'WA':\n    pen[pi] += 1\n \nprint(f'{answer} {penalty}')", "passed": true, "time": 0.14, "memory": 15036.0, "status": "done"}]