problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p02802
u183657342
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["import math\nn, m = map(int, input().split())\nfalse_count = [1]*n\nans_false_count = [0]*n\nans_success_count = [0]*n\n\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n s = str(s)\n\n if s=='WA':\n false_count[p-1] = false_count[p-1]*2 \n else:\n ans_false_count[p-1] += false_count[p-1]\n ans_success_count[p-1] = 1\n false_count[p-1] = 0\n\nfalse_count = [math.log(i,2) for i in false_count] \n\nnew_ans_false_count = false_count + ans_false_count\nprint(sum(ans_success_count), int(sum(new_ans_false_count))) ", "import math\nn, m = map(int, input().split())\nfalse_count = [1]*n\nans_false_count = [0]*n\nans_success_count = [0]*n\n\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n s = str(s)\n\n if s=='WA':\n false_count[p-1] = int(false_count[p-1]*2)\n else:\n ans_false_count[p-1] += int(false_count[p-1])\n ans_success_count[p-1] = 1\n false_count[p-1] = 0\n\nfor j in range(n):\n if ans_false_count [j] != 0:\n ans_false_count[j] = math.log(ans_false_count[j],2)\n\nnew_ans_false_count = ans_false_count\nprint(sum(ans_success_count), int(sum(new_ans_false_count))) "]
['Runtime Error', 'Accepted']
['s315687099', 's269961332']
[5620.0, 7796.0]
[570.0, 564.0]
[549, 604]
p02802
u185034753
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['def main():\n N, M = [int(x) for x in input().split()]\n\n accepted = set()\n ans = 0\n for i in range(M):\n p, s = input().split()\n if p in accepted:\n continue\n if s == "WA":\n ans += 1\n else:\n accepted.add(p)\n print(ans)\n\n\nif __name__ == \'__main__\':\n main()', 'def main():\n N, M = [int(x) for x in input().split()]\n\n accepted = set()\n ans = 0\n from collections import defaultdict\n wa_count = defaultdict(int)\n for i in range(M):\n p, s = input().split()\n if p in accepted:\n continue\n if s == "WA":\n wa_count[p] += 1\n else:\n accepted.add(p)\n ans += wa_count[p]\n print(len(accepted), ans)\n\n\nif __name__ == \'__main__\':\n main()']
['Wrong Answer', 'Accepted']
['s297389291', 's860529481']
[14060.0, 21560.0]
[196.0, 261.0]
[331, 457]
p02802
u185037583
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n, m = map(int, input().split())\n\nresult = [[0] * 2 for i in range(n)]\n\nfor _ in range(m):\n tmp_i, s = input().split()\n i = int(tmp_i)\n if result[i][0] == 1:\n continue\n if s == 'AC':\n result[i][0] += 1\n else:\n result[i][1] += 1\n\nprint(sum([result[i][0] for i in range(n)]),\n sum([result[i][1] for i in range(n)]))\n", "n, m = map(int, input().split())\n\nac = [0] * n\nwa = [0] * n\nwa_total = 0\nfor _ in range(m):\n tmp_i, s = input().split()\n i = int(tmp_i) - 1\n if ac[i] == 1:\n continue\n if s == 'AC':\n ac[i] = 1\n wa_total += wa[i]\n else:\n wa[i] += 1\n\nprint(sum(ac), wa_total)\n"]
['Runtime Error', 'Accepted']
['s845870530', 's291328317']
[14152.0, 4596.0]
[317.0, 286.0]
[355, 299]
p02802
u185424824
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N,M = map(int,input().split())\nP,S = [map(int,input().split()) for i in range(M)]\n\na = [0]*N\n\nac = 0\nwa = 0\n\nfor i in range(M):\n if a[P[i]-1] == 0:\n if S[i] == "AC":\n ac += 1\n a[P[i]-1] = 1\n else:\n wa += 1\nprint(ac + " " + wa)\n ', 'N,M = map(int,input().split())\n\nwa = [0]*N\nac = [0]*N\n\nwac = 0\nacc = 0\n\nfor i in range(M):\n p,s = input().split()\n p = int(p)\n if s == "AC":\n if ac[p-1] != 1:\n ac[p-1] = 1\n acc += 1\n wac += wa[p-1]\n else:\n if ac[p-1] == 0:\n wa[p-1] += 1\nprint(str(acc) +" "+ str(wac))']
['Runtime Error', 'Accepted']
['s624294284', 's782610966']
[48776.0, 4596.0]
[320.0, 304.0]
[251, 297]
p02802
u188827677
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["# -*- coding:utf-8 -*-\nn,m = map(int, input().split())\na = []\n\nans = []\n\nfor i in range(m):\n a.append(input().split())\n\nno = ''\nfor x,y in a:\n if y == 'AC' and x != no:\n ans.append([x,y])\n no = x\n if y == 'WA' and x != no:\n #print(x, no)\n ans.append([x,y])\n\nac = 0\nwa = 0\nc = ''\nfor p1,p2 in reversed(ans):\n print(p1,p2)\n if p2 == 'AC':\n ac +=1\n c = p1\n if p2 == 'WA' and p1 == c:\n wa +=1\nprint(ac,wa)", 'n,m = map(int, input().split())\n\nflag = [False]*n\nnums = [0]*n\nfor _ in range(m):\n p,s = input().split()\n p = int(p)-1\n if s == "AC": flag[p] = True\n elif flag[p] == False: nums[p] += 1\nac = flag.count(True)\nwa = 0\nfor i in range(n):\n if flag[i]: wa += nums[i]\nprint(ac, wa)']
['Wrong Answer', 'Accepted']
['s966408702', 's686854097']
[43636.0, 10340.0]
[394.0, 196.0]
[428, 279]
p02802
u189089176
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['# C - Welcome to AtCoder\n\n\nn,m = map(int,input().split())\n\n\nac = [False] * N\nwa = [0] * N\n\n\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n\n if p == "AC":\n \n ac[i] = True\n else:\n if ac[i] == False:\n wa[i] += 1\n\nac_cnt = 0\nwa_cnt = 0\n\nfor i in range(n):\n if ac[i] == True:\n ac_cnt += 1\n wa_cnt += wa[i]\n\nprint(ac_cnt,wa_cnt)\n\n\n\n\n', '# C - Welcome to AtCoder\n\n\nn,m = map(int,input().split())\nsubmits = [list(input().split()) for i in range(0,m)]\n\nac = 0\nwa = 0\n\nAC = "AC"\nWA = "WA"\n\ntmp_wa = 0\ntmp_ac = 0\n\n\nfor i in range(len(submits)):\n \n if submits[i][1] == AC:\n \n if submits[i][0] == tmp_ac:\n continue\n ac += 1\n \n wa += tmp_wa\n \n tmp_wa = 0\n tmp_ac = submits[i][0]\n else:\n \n tmp_wa += 1\n\nprint(ac + " " + wa)', '# C - Welcome to AtCoder\n\n\nn,m = map(int,input().split())\nsubmits = [list(input().split()) for i in range(0,m)]\n\nac = 0\nwa = 0\n\nAC = "AC"\nWA = "WA"\n\ntmp_wa = 0\ntmp_ac = 0\n\n\nfor i in range(len(submits)):\n \n if submits[i][1] == AC:\n \n if submits[i][0] == tmp_ac:\n continue\n ac += 1\n \n wa += tmp_wa\n \n tmp_wa = 0\n tmp_ac = submits[i][0]\n else:\n \n tmp_ac = submits[i][0]\n tmp_wa += 1\n\nprint(str(ac) + " " + str(wa))', '# C - Welcome to AtCoder\n\n\nn,m = map(int,input().split())\n\n\nac = [False] * n\nwa = [0] * n\n\n\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n\n if p == "AC":\n \n ac[i] = True\n else:\n if ac[i] == False:\n wa[i] += 1\n\nac_cnt = 0\nwa_cnt = 0\n\nfor i in range(n):\n if ac[i] == True:\n ac_cnt += 1\n wa_cnt += wa[i]\n\nprint(ac_cnt,wa_cnt)', '# C - Welcome to AtCoder\n\n\nn,m = map(int,input().split())\n\n\nac = [False] * n\nwa = [0] * n\n\n\nfor i in range(m):\n p, s = input().split()\n p = int(p) - 1\n\n if s == "AC":\n \n ac[p] = True\n else:\n if ac[p] == False:\n wa[p] += 1\n\nac_cnt = 0\nwa_cnt = 0\n\nfor i in range(n):\n if ac[i] == True:\n ac_cnt += 1\n wa_cnt += wa[i]\n\nprint(ac_cnt,wa_cnt)']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s097145706', 's256118489', 's492982500', 's580574205', 's429166001']
[3064.0, 25912.0, 25924.0, 4596.0, 4596.0]
[17.0, 265.0, 290.0, 271.0, 275.0]
[587, 666, 707, 582, 586]
p02802
u193927973
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N, M=map(int, input().split())\nsolved=[False]*N\nac=0\nwa=0\nfor _ in range(M):\n p, s=input().split()\n p=int(p)-1\n if solved[p]:\n continue\n if s=="AC":\n solved[p]=True\n ac+=1\n else:\n wa+=1\nprint(as, wa) ', 'N, M=map(int, input().split())\nsolved=[False]*N\nwal=[0]*N\nac=0\nwa=0\nfor _ in range(M):\n p, s=input().split()\n p=int(p)-1\n if solved[p]:\n continue\n if s=="AC":\n solved[p]=True\n ac+=1\n wa+=wal[p]\n else:\n wal[p]+=1\nprint(ac, wa) ']
['Runtime Error', 'Accepted']
['s089017365', 's650723425']
[3060.0, 4596.0]
[17.0, 266.0]
[218, 247]
p02802
u196675341
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['\n\nN, M = map(int, input().strip().split(" "))\n\n\np = []\ns = []\nans = [0]*N\nc_wa = [0]*N\nc_sum = 0\n\nfor i in range(M):\n temp1, temp2 = input().strip().split(" ")\n p.append(int(temp1))\n s.append(str(temp2))\n \n\nfor j in range(M):\n \n if s[j] == "WA":\n if ans[p[j]-1] == 0:\n c_wa[p[j]-1] += 1\n elif ans[p[j]-1] == 1:\n pass\n \n \n \n elif s[j] == "AC":\n if ans[p[j]-1] == 0:\n ans[p[j]-1] += 1\n elif ans[p[j]-1] == 1:\n pass\n \n for i in range(N):\n if ans[p[j]-1] == 1:\n c_sum += c_wa[p[j]-1]\n \n \nprint(sum(ans), c_sum)', '\n\nN, M = map(int, input().strip().split(" "))\n\n\np = []\ns = []\nans = [0]*N\nc_wa = [0]*N\npena = 0\n\nfor i in range(M):\n temp1, temp2 = input().strip().split(" ")\n p.append(int(temp1))\n s.append(str(temp2))\n \n\nfor j in range(M):\n \n if s[j] == "WA":\n if ans[p[j]-1] == 0:\n c_wa[p[j]-1] += 1\n elif ans[p[j]-1] == 1:\n pass\n \n \n \n elif s[j] == "AC":\n if ans[p[j]-1] == 0:\n ans[p[j]-1] += 1\n elif ans[p[j]-1] == 1:\n pass\n \nprint(c_wa)\nfor k in range(N):\n if ans[k] == 1:\n pena += c_wa[k]\n \n\n \nprint(sum(ans), pena)', 'N, M = map(int, input().strip().split(" "))\n\n\np = []\ns = []\nans = [0]*N\nc_wa = 0\n\nfor i in range(M):\n temp1, temp2 = input().strip(" ").split(" ")\n p.append(int(temp1))\n s.append(str(temp2))\n \n\nfor j in range(M):\n \n if s[j] == "WA":\n print("WA", j, s[p[j]-1])\n if ans[p[j]-1] == 0:\n c_wa += 1\n \n elif s[j] == "AC":\n if ans[p[j]-1] == 1:\n continue\n elif ans[p[j]-1] == 0:\n ans[p[j]-1] += 1\n \nprint(sum(ans), c_wa)', '\n\nN, M = map(int, input().strip().split(" "))\n\n\np = []\ns = []\nans = [0]*N\nc_wa = [0]*N\npena = 0\n\nfor i in range(M):\n temp1, temp2 = input().strip().split(" ")\n p.append(int(temp1))\n s.append(str(temp2))\n \n\nfor j in range(M):\n \n if s[j] == "WA":\n if ans[p[j]-1] == 0:\n c_wa[p[j]-1] += 1\n elif ans[p[j]-1] == 1:\n pass\n \n \n \n elif s[j] == "AC":\n if ans[p[j]-1] == 0:\n ans[p[j]-1] += 1\n elif ans[p[j]-1] == 1:\n pass\n \nfor k in range(M):\n if ans[p[k] - 1] == 1:\n pena += c_wa[p[k] - 1]\n \n\n \nprint(sum(ans), pena)', 'N, M = map(int,input().split(" "))\n\nans = [0]*N\nwc_c = [0]*N\npena = 0\n\nfor i in range(M):\n p, s = input().split(" ")\n p = int(p) - 1\n s = str(s)\n \n if s == "AC" and ans[p] == 0:\n ans[p] = 1\n pena += wc_c[p]\n \n elif s == "WA" and ans[p] == 0:\n wc_c[p] += 1\n \nprint(sum(ans), pena)\n \n ']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s351677716', 's675208805', 's959186598', 's983821489', 's056810382']
[14924.0, 15824.0, 15708.0, 15012.0, 4596.0]
[2104.0, 334.0, 512.0, 357.0, 302.0]
[672, 660, 514, 662, 344]
p02802
u197968862
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["import collections\nn, m =map(int,input().split())\np = []\nfor i in range(m):\n p.append(input().split())\n\ndel_l = []\nfor j in range(m):\n if p[j][1] == 'AC':\n del_l.append(p[j][0])\n p[j][0] = ''\n p[j][1] = ''\n if p[j][1] == 'WA':\n p[j][0] = ''\n p[j][1] = ''\npen = 0\nfor s in range(m):\n if p[s][1] == 'WA' and p[s][0] in del_l:\n pen += 1\nprint(len(collections.Counter(del_l)),pen)", "n, m = map(int,input().split())\na = [input().split() for i in range(m)]\np = [int(i[0]) for i in a]\nq = [j[1] for j in a]\n\nac = 0\nwa = 0\nwa_c = [0] * n\nac_c = [False] * n\n\nfor t in range(m):\n if ac_c[p[t]-1]:\n continue\n if q[t] == 'AC':\n ac += 1\n ac_c[p[t]-1] = True\n wa += wa_c[p[t]-1]\n else:\n wa_c[p[t]-1] += 1\nprint(ac,wa)"]
['Wrong Answer', 'Accepted']
['s256653966', 's287776229']
[42572.0, 38628.0]
[274.0, 294.0]
[430, 368]
p02802
u201408380
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["N,M = map(int,input().split())\nli = []\nfor i in range(M):\n li.append(input().split())\n\n\nr = ['WA']*(N+1)\no = []\nc = 0\nac_c = 0\np_c =0\nli.sort()\n\nfor ps in li:\n index = int(ps[0])\n if ps[1] == 'WA':\n if r[index] == 'WA':\n \n c+=1\n\n else: # AC\n if r[index] == 'WA':\n r[index] = 'AC'\n p_c += c\n ac_c += 1\n else:\n pass\n c=0\n\nprint(ac_c, p_c)\n", "N,M = map(int,input().split())\nli = []\nfor i in range(M):\n li.append(input().split())\n\n\nr = ['WA']*(N+1)\nwa_li = [0]*(N+1)\no = []\nc = 0\nac_c = 0\n\nfor ps in li:\n index = int(ps[0])\n if ps[1] == 'WA':\n if r[index] == 'WA':\n wa_li[index]+=1\n\n else: # AC\n if r[index] == 'WA':\n r[index] = 'AC'\n ac_c += 1\n else:\n pass\n\np_c =0\nfor i,v in enumerate(r):\n if v == 'AC':\n p_c+=wa_li[i]\n\nprint(ac_c, p_c)\n"]
['Wrong Answer', 'Accepted']
['s607018106', 's490396012']
[33372.0, 33696.0]
[481.0, 277.0]
[443, 482]
p02802
u201802797
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['\n \npenaltyCount = dict()\npenaltyCount = defaultdict(lambda: 0, penaltyCount)\n \ncorrect = 0\npenalty = 0\n \nfor i in range(m):\n submission = input.split()\n p = int(submission[0]) - 1\n status = submission[1]\n', "import sys\nfrom collections import defaultdict\n\nn, m = map(int, input().split())\nac = 0\nwa = defaultdict(lambda: 0)\nalready = set()\nfor line in sys.stdin:\n y, z = line.strip().split()\n y = int(y)\n if y in already:\n continue\n if z == 'AC':\n ac += 1\n already.add(y)\n else:\n wa[y] += 1\n \nprint(ac, sum(wa[i] for i in already))"]
['Runtime Error', 'Accepted']
['s298099377', 's514157291']
[2940.0, 22888.0]
[17.0, 171.0]
[213, 369]
p02802
u204478136
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["N,M = map(int, input().split())\nnum = []\napb = []\n\nfor i in range(M):\n n, a = input().split()\n num.append(int(n))\n apb.append(a)\n\nnum_wa = 0\nnum_ac = 0\nfor i in range(N):\n for j in apb[num.count(i):(num.count(i)+(num.count(i+1)))]:\n if j == 'wa':\n num_wa += 1\n if j == 'ac':\n num_ac += 1\n break\nprint(num_ac, num_wa)\n", "N,M = map(int, input().split())\n# List to store grades\napb = [[] for i in range(10 ** 5)]\n\n# num and apb convert to type dict\nfor i in range(M):\n n, a = input().split()\n apb[int(n)] += [a]\n if a == 'AC':\n continue\n\napb_new = list(filter(lambda a: a != [], apb))\n\n# count\npenalty = 0\ncorrect_answer = 0\nfor words in apb_new:\n if 'AC' in words:\n correct_answer += 1\n for word in words:\n if word == 'WA':\n penalty += 1\n else:\n break\n\n\nprint(correct_answer, penalty)\n"]
['Wrong Answer', 'Accepted']
['s680218708', 's951902305']
[13372.0, 21216.0]
[2104.0, 372.0]
[376, 508]
p02802
u210827208
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n,m=map(int,input().split())\n\nN=[]\n\nfor i in range(n):\n N.append([0,0])\n\nco=0\npe=0\nfor i in range(m):\n p,s=input().split()\n p=int(p)\n if s=='WA':\n N[p-1][0]+=1\n elif N[p-1][1]!=1:\n pe+=N[p][0]\n co+=1\n N[p-1][1]=1\n\nprint(str(co)+' '+str(pe))", "n,m=map(int,input().split())\n\nN=[[0,0]*n]\nco=0\npe=0\nfor i in range(m):\n p,s=input().split()\n p=int(p)\n if s=='WA':\n N[p-1][0]+=1\n elif N[p-1][1]!=1:\n pe+=N[p-1][0]\n co+=1\n N[p-1][1]=1\n\nprint(str(co)+' '+str(pe))", "n,m=map(int,input().split())\n\nN=[]\n\nfor i in range(n):\n N.append([0,0])\n\nco=0\npe=0\nfor i in range(m):\n p,s=input().split()\n p=int(p)\n if s=='WA':\n N[p-1][0]+=1\n elif N[p-1][1]!=1:\n pe+=N[p-1][0]\n co+=1\n N[p-1][1]=1\n\nprint(str(co)+' '+str(pe))"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s777663876', 's856545977', 's017680910']
[13172.0, 4596.0, 13172.0]
[320.0, 251.0, 370.0]
[283, 251, 285]
p02802
u212786022
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N,M = map(int, input().split())\np = [0]*M\nS = [0]*M\nfor i in range(M):\n p[i],S[i] = input().split()\nimport numpy as np\np = [int(s) for s in p]\np1 = np.array(p)\nS1 = [1 if i=="AC" else 0 for i in S]\nN1 = list(set(p1 * S1))\np2 = [1 if i in N1 else 0 for i in p1]\np2 = np.array(p2)\np3 = list(p1 * p2)\np4 = [i for i in p3 if i != 0]\n\nA = 0\nB = 0\nj = 0\nfor i in p4:\n if i in N1:\n A += S1[j]\n B += (1-S1[j])\n j +=1\n if S1[j] ==1:\n N1.remove(i)\nprint(str(A)+" "+str(B))', 'N,M = map(int, input().split())\np = [0]*M\nS = [0]*M\nX = [0]*N\nY = [0]*N\nA = 0\nB = 0\nfor i in range(M):\n p[i],S[i] = input().split()\nq = [int(s) for s in p]\nfor i in range(M):\n if S[i] == "AC":\n if Y[q[i]]==0:\n Y[q[i]]+=1\n A += 1\n B += X[q[i]]\n else:\n if Y[q[i]]==0:\n X[q[i]] += 1\nprint(str(A)+" "+str(B)) ', 'N,M = map(int, input().split())\np = [0]*M\nS = [0]*M\nX = [0]*N\nY = [0]*N\nA = 0\nB = 0\nfor i in range(M):\n p[i],S[i] = input().split()\nq = [int(s) for s in p]\nfor i in range(M):\n if S[i] == "AC":\n if Y[q[i]]==0:\n Y[q[i]]+=1\n A += 1\n B += X[q[i]]\n else:\n A = A\n B = B\n else:\n if Y[q[i]]==0:\n X[q[i]] += 1\n else:\n A = A\n B = B\nprint(str(A)+" "+str(B)) ', 'N,M = map(int, input().split())\np = [0]*M\nS = [0]*M\nfor i in range(M):\n p[i],S[i] = input().split()\nimport numpy as np\np = [int(s) for s in p]\np1 = np.array(p)\nS1 = [1 if i=="AC" else 0 for i in S]\nN1 = list(set(p1 * S1))', 'N,M = map(int, input().split())\np = [0]*M\nS = [0]*M\nfor i in range(M):\n p[i],S[i] = input().split()\nimport numpy as np\np = [int(s) for s in p]\np1 = np.array(p)\nS1 = [1 if i=="AC" else 0 for i in S]\nN1 = list(set(p1 * S1))\n\n\nif p ==[]:\n print("0 0")\nelse:\n A = 0\n B = 0\n for i in range(M):\n if p1[i] in N1:\n A += S1[i]\n B += (a-S1[i])\n if S1[i] ==1:\n N1.remove(p1[i])\n print(str(A)+" "+str(B))', 'N,M = map(int, input().split())\np = [0]*M\nS = [0]*M\nX = [0]*N\nY = [0]*N\nA = 0\nB = 0\nfor i in range(M):\n p[i],S[i] = input().split()\nq = [int(s) for s in p]\nfor i in range(M):\n if Y[q[i]]==1:\n break\n if S[i] == "AC":\n if Y[q[i]]==0:\n Y[q[i]]+=1\n A += 1\n B += X[q[i]]\n else:\n if Y[q[i]]==0:\n X[q[i]] += 1\nprint(str(A)+" "+str(B)) ', 'N,M = map(int, input().split())\np = [0]*M\nS = [0]*M\nfor i in range(M):\n p[i],S[i] = input().split()\nq = [int(s) for s in p]\nX = [0]*N\nY = [0]*N\nA = 0\nB = 0\nfor i in range(M):\n if S[i] == "AC":\n if Y[q[i]]==0:\n Y[q[i]]+=1\n A += 1\n B += X[q[i]]\n else:\n if Y[q[i]]==0:\n X[q[i]] += 1\nprint(str(A)+" "+str(B)) ', 'N,M = map(int, input().split())\np = [0]*M\nS = [0]*M\nX = [0]*N\nY = [0]*N\nX = [int(s) for s in X]\nY = [int(s) for s in Y]\nA = 0\nB = 0\nfor i in range(M):\n p[i],S[i] = input().split()\np = [int(s) for s in p]\nfor i in range(M):\n if S[i] == "AC":\n if Y[p[i]]==0:\n Y[p[i]]+=1\n A += 1\n B += X[p[i]]\n else:\n if Y[p[i]]==0:\n X[p[i]] += 1\nprint(str(A)+" "+str(B)) ', 'N,M = map(int, input().split())\np = [0]*M\nS = [0]*M\nX = [0]*N\nY = [0]*N\nX = [int(s) for s in X]\nY = [int(s) for s in Y]\nA = 0\nB = 0\nfor i in range(M):\n p[i],S[i] = input().split()\nq = [int(s) for s in p]\nfor i in range(M):\n if S[i] == "AC":\n if Y[q[i]]==0:\n Y[q[i]]+=1\n A += 1\n B += X[q[i]]\n else:\n if Y[q[i]]==0:\n X[q[i]] += 1\nprint(str(A)+" "+str(B)) ', 'N,M = map(int, input().split())\np = [0]*M\nS = [0]*M\nfor i in range(M):\n p[i],S[i] = input().split()\nq = [int(s)-1 for s in p]\nX = [0]*N\nY = [0]*N\nA = 0\nB = 0\nfor i in range(M):\n if S[i] == "AC":\n if Y[q[i]]==0:\n Y[q[i]]+=1\n A += 1\n B += X[q[i]]\n else:\n if Y[q[i]]==0:\n X[q[i]] += 1\nprint(str(A)+" "+str(B)) ']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s117617589', 's156010349', 's297437015', 's311495824', 's320121916', 's373368226', 's478180068', 's645712269', 's993649455', 's495813055']
[38924.0, 21324.0, 21324.0, 38996.0, 38944.0, 21324.0, 21324.0, 21152.0, 21200.0, 21276.0]
[2110.0, 256.0, 269.0, 376.0, 388.0, 282.0, 269.0, 312.0, 287.0, 279.0]
[507, 377, 477, 224, 465, 410, 377, 425, 425, 379]
p02802
u214561383
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n,m = map(int, input().split())\nwa = 0\nac = 0\nac_list = []\nif m==0:\n print(0,0)\nelse:\n for i in range(m):\n p,s = input().split()\n if s=='WA':\n wa += 1\n elif ac_list.count(p) ==0:\n ac_list.append(p)\n ac += 1\n else:\n pass\n print(ac, wa)", "wa = 0\nac = 0\nac_list = []\nif m==0:\n print(0,0)\nelse:\n for i in range(m-1:\n p,s = input().split()\n if s=='WA':\n wa += 1\n elif ac_list.count(p) ==0:\n ac_list.append(p)\n ac += 1\n else:\n pass", "n,m = map(int, input().split())\nwa = 0\nac = 0\nac_list = []\nif m==0:\n print(0,0)\nelse:\n for i in range(m):\n p,s = input().split()\n if s=='WA' & ac_list.count(p) ==0:\n wa += 1\n elif ac_list.count(p) ==0:\n ac_list.append(p)\n ac += 1\n else:\n pass\n print(ac, wa)", "n,m = map(int, input().split())\nwa = 0\nac_list = {'AC':{}, 'WA':{}}\nif m==0:\n print(0,0)\nelse:\n for i in range(m):\n p,s = input().split()\n ac_list[s][p] = ac_list[s].get(p, 0) + 1* int(not(p in ac_list['AC'].keys()))\n kyotu_key = list(set(ac_list['AC'].keys()) & set(ac_list['WA'].keys()))\n wa_list = [ac_list['WA'][p] for p in kyotu_key]\n print(len(ac_list['AC'].keys()), sum(wa_list))"]
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s354830383', 's593742651', 's757119560', 's059007832']
[3956.0, 2940.0, 3064.0, 21468.0]
[2104.0, 17.0, 18.0, 316.0]
[315, 266, 338, 415]
p02802
u218071226
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n, m = map(int, input().split())\nscore = [(False, 0) for i in range(n)]\nfor i in range(m):\n\tproblem, s = input().split()\n\tp = int(problem)-1\n\tif not score[p][0]:\n\t\tif s=="AC":\n\t\t\tscore[p][0] = True\n\t\telse:\n\t\t\tscore[p][1] += 1\n\t\n\nprint(sum(i[0] for i in score), sum(j if i else 0 for i, j in score))', 'n, m = map(int, input().split())\nscore = [(False, 0) for i in range(n)]\nfor i in range(m):\n\tproblem, s = input().split()\n\tp = int(problem)-1\n\tif not score[p][0]:\n\t\tscore[p] = (True, score[p][1]) if s=="AC" else (False, score[p][1]+1)\n\t\n\nprint(sum(i[0] for i in score), sum(j if i else 0 for i, j in score))']
['Runtime Error', 'Accepted']
['s740978311', 's092999381']
[3888.0, 10200.0]
[22.0, 312.0]
[298, 306]
p02802
u221537793
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['result = dict()\nAC, WA = 0, 0\nfor p,s in PS:\n p = int(p)\n if not (p in result):\n result [p] = s\n if s == "WA":\n WA += 1\n elif s == "AC":\n AC += 1\n elif result[p] == "AC":\n continue\n else:\n result[p] = s\n if s == "WA":\n WA += 1\n elif s == "AC":\n AC += 1\nprint(AC, WA)', 'N, M = map(int, input().split())\nPS = [tuple(input().split()) for _ in range(M)]\nresult = [{"AC":0, "WA":0} for _ in range(N)]\nfor p,s in PS:\n i = int(p) - 1\n if result[i]["AC"] == 1:\n continue\n else:\n result[i][s] += 1\nfor r in result:\n AC = len([e for e in result if e["AC"] >= 1])\n WA = sum([e["WA"] for e in result])', 'N, M = map(int, input().split())\nPS = [tuple(input().split()) for _ in range(M)]\nresult = dict()\nAC, WA = 0, 0\nfor p,s in PS:\n p = int(p)\n if not (p in result):\n result [p] = s\n if s == "WA":\n WA += 1\n elif s == "AC":\n AC += 1\n elif result[p] == "AC":\n continue\n else:\n if s == "WA":\n WA += 1\n elif s == "AC":\n AC += 1\nprint(AC, WA)', '_, M = map(int, input().split())\nPS = [tuple(input().split()) for _ in range(M)]\nresult = dict()\nAC, WA = 0, 0\nfor p,s in PS:\n i = int(p)\n if not (i in result):\n if s == "WA":\n result[i] = 1\n elif s == "AC":\n AC += 1\n result [i] = "AC"\n else:\n if result[i] != "AC":\n if s == "WA":\n result[i] += 1\n if s == "AC":\n AC += 1\n WA += result[i]\n result[i] = s\nprint(AC, WA)']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s283434015', 's390650332', 's969512898', 's239251000']
[3064.0, 52736.0, 33388.0, 33392.0]
[17.0, 2107.0, 288.0, 283.0]
[371, 349, 430, 511]
p02802
u225020286
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N,M=map(int,input().split())\nPS=[list(input().split()) for i in range(M)]\nAC=[0]*N\nWA=[0]*N\nfor p,s in PS:\n p=int(p)\n if s=="AC" and AC[p]==0:\n AC[p]=1\n elif s=="WA":\n WA[p]+=1\nwa=0\nfor i in WA:\n wa+=i\nprint(sum(AC),wa)\n ', 'N,M=map(int,input().split())\nAC=[0]*N\nWA=[0]*N\nwa=0\nfor i in range(M):\n p,s=input().split()\n p=int(p)-1\n if AC[p]==0 and s=="AC":\n AC[p]=1\n wa+=WA[p]\n WA[p]+=1\nprint(sum(AC),wa)']
['Runtime Error', 'Accepted']
['s174962503', 's309038058']
[27452.0, 4596.0]
[274.0, 278.0]
[232, 203]
p02802
u227085629
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n,m = map(int,input().split())\npS_list = [list(input().split()) \n for nesya in range(m)]\nac = 0\nwa = 0\nq_list = [0]*n\nfor ps in ps_list:\n p = int(ps[0])-1\n s = ps[1]\n if q_list[p] == 1:\n continue\n if s == 'WA':\n q_list[p] -= 1\n else:\n a = q_list[p]\n wa -= a\n ac += 1\n q_list[p] = 1\nprint(ac,wa)", "n,m = map(int,input().split())\npS_list = [list(input().split()) \n for nesya in range(m)]\nac = 0\nwa = 0\nq_list = [0]*n\nfor ps in pS_list:\n p = int(ps[0])-1\n s = ps[1]\n if q_list[p] == 1:\n continue\n if s == 'WA':\n q_list[p] -= 1\n else:\n a = q_list[p]\n wa -= a\n ac += 1\n q_list[p] = 1\nprint(ac,wa)"]
['Runtime Error', 'Accepted']
['s240943376', 's948299339']
[26684.0, 26688.0]
[230.0, 312.0]
[327, 327]
p02802
u230717961
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n, m = [int(i) for i in input().split(" ")]\nscore_dict = {}\n \nfor i in range(m):\n p, s = input().split(" ")\n if p not in score_dict:\n score_dict[p] = []\n \n score_dict[p].append(s)\n \nac_count = 0\nwa_count = 0\n \nfor i in score_dict.values():\n\n if "AC" in i:\n ac_count += 1\n wa_count += i.index("AC")]\n else:\n wa_count += len(i)\n \nprint("{0} {1}".format(ac_count, wa_count))', 'n, m = input().split(" ")\nscore_dict = {}\n \nfor i in range(m):\n p, s = input().split(" ")\n if p not in score_dict:\n score_dict[p] = []\n \n score_dict[p].append(s)\n \nac_count = 0\nwa_count = 0\n \nfor i in score_dict.values():\n if "AC" in i:\n ac_count += 1\n \n wa_count += len(i[:i.index("AC")])\n \nprint("{0} {1}".format(ac_count, wa_count))', 'n, m = [int(i) for i in input().split(" ")]\nscore_dict = {}\n \nfor i in range(m):\n p, s = input().split(" ")\n if p not in score_dict:\n score_dict[p] = []\n \n score_dict[p].append(s)\n \nac_count = 0\nwa_count = 0\n \nfor i in score_dict.values():\n\n if "AC" in i:\n ac_count += 1\n wa_count += i.index("AC")\n \nprint("{0} {1}".format(ac_count, wa_count))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s569712180', 's937345170', 's344094961']
[2940.0, 3064.0, 31548.0]
[18.0, 17.0, 340.0]
[417, 370, 379]
p02802
u231776587
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N, M = list(map(int, input().split()))\nlst = [input().split() for lst in range(M)]\nlst.sort(key=lambda x: x[0])\npn = 0\ntemp_pn = [] \nfor _ in range(M):\n temp_pn.append(0)\ncr = 0\nplbnum = 0\nfor i in lst:\n a = int(i[0])\n if N >= a > plbnum:\n if i[1] == "WA":\n temp_pn[a] += 1\n elif i[1] == "AC":\n cr += 1\n pn += temp_pn[a-1]\n plbnum = a\nprint(cr, pn)', 'N, M = list(map(int, input().split()))\nlst = [input().split() for lst in range(M)]\nlst.sort(key=lambda x: x[0])\npn = 0\ntemp_pn = [] \nfor _ in range(M):\n temp_pn.append(0)\ncr = 0\nplbnum = 0\nfor i in lst:\n a = int(i[0])\n if N >= a > plbnum:\n if i[1] == "WA":\n temp_pn[a] += 1\n elif i[1] == "AC":\n cr += 1\n pn += temp_pn[a-1]\n plbnum = a\nprint(cr, pn)', 'N, M = list(map(int, input().split()))\nlst = [input().split() for lst in range(M)]\npn = 0\nlst_pn = []\nlst_cr = []\nfor _ in range(N):\n lst_pn.append(0)\n lst_cr.append(0)\ncr = 0\nfor i in lst:\n a = int(i[0])\n if lst_cr[a-1] == 1:\n continue\n elif i[1] == "WA":\n lst_pn[a-1] += 1\n elif i[1] == "AC":\n cr += 1\n lst_cr[a-1] += 1\n pn += lst_pn[a-1]\nprint(cr, pn)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s335334279', 's542092142', 's486999807']
[33780.0, 33780.0, 33852.0]
[425.0, 409.0, 309.0]
[378, 378, 375]
p02802
u235210692
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n,m=[int(i) for i in input().split()]\nac=[0]*n\nwa=[0]*n\nfor i in range(m):\n p,s=input().split()\n p=int(p)-1\n if s=="AC":\n if check[p]==0:\n check[p]=1\n else:\n if check[p]==0:\n wa[p]+=1\n \nfor i in range(n):\n wa[i]=wa[i]*ac[i]\nprint(sum(ac),sum(wa))\n ', 'n,m=[int(i) for i in input().split()]\nac=[0]*n\nwa=[0]*n\nfor i in range(m):\n p,s=input().split()\n p=int(p)-1\n if s=="AC":\n if check[p]==0:\n check[p]=1\n else:\n if check[p]==0:\n wa[p]+=1\n \nfor i in range(n):\n wa[i]=wa[i]*ac[i]\nprint(sum(check),wa)', 'n,m=[int(i) for i in input().split()]\nac=[0]*n\nwa=[0]*n\nfor i in range(m):\n p,s=input().split()\n p=int(p)-1\n if s=="AC":\n if ac[p]==0:\n ac[p]=1\n else:\n if ac[p]==0:\n wa[p]+=1\n \nfor i in range(n):\n wa[i]=wa[i]*ac[i]\nprint(sum(ac),sum(wa))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s767653033', 's936766320', 's066548297']
[4596.0, 4596.0, 4596.0]
[19.0, 19.0, 290.0]
[309, 298, 291]
p02802
u238940874
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n,m=map(int,input().split())\nps=list(list(input().split()) for _ in range(m))\n\nwal=[0]*n\nacl=[0]*n\n\nfor p,s in ps:\n p=int(p)-1\n if s=='AC' and acl[p] ==0:\n acl[p]+=1\n elif s=='WA' and acl[p] ==0:\n wal[p]+=1\nprint(acl)\nprint(wal)\nwa=0\nfor i,ac in enumerate(acl):\n if ac == 1:\n wa+=wal[i] \n \nprint(sum(acl),wa)", "n,m=map(int,input().split())\nacl=[0]*n\nwal=[0]*n\nfor i in range(m):\n p,s=input().split()\n p=int(p)-1\n if s=='AC' and acl[p]==0:\n acl[p]+=1\n elif s=='WA' and acl[p]==0:\n wal[p]+=1\nwa=0\nfor i,ac in enumerate(acl):\n if ac==1:\n wa+=wal[i]\n\nprint(sum(acl),wa)\n "]
['Wrong Answer', 'Accepted']
['s873512839', 's552427438']
[28916.0, 4596.0]
[319.0, 290.0]
[347, 295]
p02802
u239528020
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['#!/usr/bin/env python3\n\nn, m = list(map(int, input().split()))\n\nflag = [0 for _ in range(n)]\nwa_num_list = [0 for _ in range(n)]\n\nfor i in range(m):\n p, s = list(map(str, input().split()))\n p = int(p)\n if flag[p-1] == 0:\n if s == "WA":\n wa_num_list[p-1] += 1\n else:\n flag[p-1] = 1\n\npen = 0\nfor i in range(m):\n if flag[i] == 1:\n pen += wa_num_list[i]\n\nprint(sum(flag), pen)\n', '#!/usr/bin/env python3\n\nn, m = list(map(int, input().split()))\n\nflag = [0 for _ in range(n)]\nwa_num_list = [0 for _ in range(n)]\n\nfor i in range(m):\n p, s = list(map(str, input().split()))\n p = int(p)\n if flag[p-1] == 0:\n if s == "WA":\n wa_num_list[p-1] += 1\n else:\n flag[p-1] = 1\n\npen = 0\nfor i in range(n):\n if flag[i] == 1:\n pen += wa_num_list[i]\n\nprint(sum(flag), pen)\n']
['Runtime Error', 'Accepted']
['s481662016', 's181772175']
[4760.0, 4760.0]
[412.0, 403.0]
[428, 428]
p02802
u239653493
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n,m = map(int, input().split())\np = [0]*m \nfor i in range(m):\n p[i] = input().split()\nfor i in range(m):\n p[i][0]=int(p[i][0])\nAC=[]\nWA=0\nfor i in range(m):\n if p[i][1]=="AC" and p[i][0] not in AC:\n AC.append(p[i][0])\n elif s[i]=="WA" and p[i][0] not in AC and [p[i][0],"AC"] in p:\n WA=WA+1\nprint(len(AC),WA)', 'n,m = map(int, input().split())\np = [0] * m\ns = [0] * m\nfor i in range(m):\n p[i], s[i] = map(int, input().split())\nAC=[]\nAC1=[]\nWA=0\nfor i in range(m):\n if s[i]=="AC" and p[i] not in AC:\n AC.append(p[i])\n AC1.append(i)\nfor i in range(m):\n if s[i]=="WA" and p[i] in AC:\n if AC1[AC.index(p[i])]>i:\n WA=WA+1\nprint(len(AC),WA)', 'n,m = map(int, input().split())\np = [0]*m \n\nfor i in range(m):\n p[i] = input().split()\nAC=[[0,-1] for j in range(n)]\nk=0\nWA=0\nfor i in range(m):\n if p[i][1]=="AC" and AC[int(p[i][0])-1][0]==0 :\n AC[int(p[i][0])-1][0]=1\n AC[int(p[i][0])-1][1]=i\n k=k+1\nfor i in range(m):\n if p[i][1]=="WA" and AC[int(p[i][0])-1][0]==1 and AC[int(p[i][0])-1][1]>i:\n WA=WA+1\n\nprint(k,WA)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s234537258', 's927645179', 's743629807']
[35476.0, 4596.0, 45568.0]
[2106.0, 20.0, 396.0]
[334, 363, 404]
p02802
u240793404
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n, m = map(int, input().split())\nl = [[0,0] for i in range(n)]\nfor i in range(m):\n p, m = input().split()\n if l[int(p)-1][0] == 0:\n if m == 'WA':\n l[int(p)-1][1] = l[int(p)-1][1] + 1\n else:\n l[int(p)-1][0] = 1\nac = 0\nwa = 0\nfor i in range(n):\n if l[i][0] == 1:\n ac = ac + 1\n wa = wa + l[i][1]\nprint(l)\nprint(str(ac) + ' ' + str(wa))", "n, m = map(int, input().split())\nl = [[0,0] for i in range(n)]\nfor i in range(m):\n p, m = input().split()\n if l[int(p)-1][0] == 0:\n if m == 'WA':\n l[int(p)-1][1] = l[int(p)-1][1] + 1\n else:\n l[int(p)-1][0] = 1\nac = 0\nwa = 0\nfor i in range(n):\n if l[i][0] == 1:\n ac = ac + 1\n wa = wa + l[i][1]\nprint(str(ac) + ' ' + str(wa))"]
['Wrong Answer', 'Accepted']
['s461903153', 's519468272']
[15600.0, 13172.0]
[384.0, 350.0]
[391, 382]
p02802
u242196904
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n, m = list(map(int, input().split()))\nac_list = [0] * n\nwa_list = [0] * n\nfor _ in range(m):\n p, s = input().split()\n p = int(p) - 1\n if s == "AC":\n ac_list[p] = 1\n if s == "WA":\n if ac_list[p] == 0:\n wa_list[p] += 1\nfor k in range(m):\n if ac_list[k] == 0:\n wa_list[k] = 0\nprint(sum(ac_list), sum(wa_list))', 'n, m = list(map(int, input().split()))\nac_list = [0] * n\nwa_list = [0] * n\nfor _ in range(m):\n p, s = input().split()\n p = int(p) - 1\n if s == "AC":\n ac_list[p] = 1\n if s == "WA":\n if ac_list[p] == 0:\n wa_list[p] += 1\nfor k in range(n):\n if ac_list[k] == 0:\n wa_list[k] = 0\nprint(sum(ac_list), sum(wa_list))']
['Runtime Error', 'Accepted']
['s212278370', 's618499512']
[4596.0, 4596.0]
[282.0, 294.0]
[354, 354]
p02802
u242580186
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["import sys\nimport time\nimport math\nimport itertools as it\ndef inpl():\n return list(map(int, input().split()))\nst = time.perf_counter()\n# ------------------------------\n\nN, M = inpl()\ndp = [False] * (N+10)\nac = 0\nwa = 0\nfor _ in range(M):\n p, S = input().split()\n p = int(p)\n if S == 'WA':\n if !dp[p]:\n wa += 1\n else:\n if !dp[p]:\n ac += 1\n dp[p] = True\nprint(ac, wa)\n\n\n# ------------------------------\ned = time.perf_counter()\nprint('time:', ed-st, file=sys.stderr)\n", "import sys\nimport time\nimport math\nimport itertools as it\ndef inpl():\n return list(map(int, input().split()))\nst = time.perf_counter()\n# ------------------------------\n\nN, M = inpl()\nac = [False] * (N+10)\nwa = [0] * (N+10)\n\na = 0\nw = 0\nfor _ in range(M):\n p, S = input().split()\n p = int(p)\n if S == 'WA':\n if not ac[p]:\n wa[p] += 1\n else:\n if not ac[p]:\n ac[p] = True\n a += 1\n w += wa[p]\n\nprint(a, w)\n\n# ------------------------------\ned = time.perf_counter()\nprint('time:', ed-st, file=sys.stderr)\n"]
['Runtime Error', 'Accepted']
['s124597664', 's317203940']
[8960.0, 10252.0]
[24.0, 184.0]
[527, 573]
p02802
u243572357
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n, m = map(int, input().split())\nans_ac = 0\nans_wa = 0\ndic = {}\nfor i in range(1, n):\n dic[i] = [False, 0]\n\nfor i in range(m):\n p, s = input().split()\n if dic[int(p)][0]:\n continue\n if s == 'WA':\n dic[int(p)][1] += 1\n else:\n ans_ac += 1\n ans_wa += dic[int(p)][1]\n dic[int(p)][0] = True\n \nprint(ans_ac, ans_wa)\n", "n, m = map(int, input().split())\nans_ac = 0\nans_wa = 0\nlst = [[False, 0]] * n\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n if lst[p-1][0]:\n continue\n if s == 'WA':\n lst[p-1][1] += 1\n else:\n ans_ac += 1\n ans_wa += lst[p-1][1]\n lst[p-1][0] = True\nprint(ans_ac, ans_wa)\n", "n, m = map(int, input().split())\nans_ac = 0\nans_wa = 0\nlst = []\nfor i in range(n):\n lst.append([False, 0])\nfor i in range(m):\n p, s = input().split()\n p = int(p) - 1\n if lst[p][0]:\n continue\n if s == 'WA':\n lst[p][1] += 1\n else:\n ans_ac += 1\n ans_wa += lst[p][1]\n lst[p][0] = True\nprint(ans_ac, ans_wa)"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s690526111', 's779000207', 's355996902']
[23204.0, 3828.0, 13172.0]
[351.0, 256.0, 333.0]
[333, 298, 323]
p02802
u244416763
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n,m = map(int,input().split())\np,s = ["0"]*m,["WJ"]*m\nfor i in range(0,m):\n p[i],s[i] = input().split()\np = [int(s) for s in p]\nPN_count = [0]*(n)\nAC_count = [0]*(n)\nfor i in range(len(s)):\n if(s[i] == "AC"):\n AC_count[p[i]-1] = 1\n else:\n if(AC_count[p[i]-1] != 0):\n PN_count[p[i]-1] += 1\nprint(sum(AC_count),sum(PN_count))', 'n,m = map(int,input().split())\np,s = ["0"]*m,["WJ"]*m\nfor i in range(0,m-1):\n p[i],s[i] = input().split()\np = [int(s) for s in p]\nPN_count = [0]*(n+1)\nAC_count = [0]*(n+1)\nfor i in range(m):\n if(s[i] == "AC"):\n AC_count[p[i]-1] = 1\n else:\n if(AC_count[p[i]-1] == 0):\n PN_count[p[i]-1] += 1\nprint(sum(AC_count),sum(PN_count))', 'n,m = map(int,input().split())\np = [0]*m\ns = [""]*m\nfor i in range(m):\n p[i],s[i] = input().split()\n \np = [int(j) for j in p]\n\nu = [[0 for i in range(2)]for j in range(n)]\n\nfor k in range(0,m):\n if(s[k] == "WA" and u[p[k]-1][1] == 0):\n u[p[k]-1][0] += 1\n elif(s[k] == "AC"):\n u[p[k]-1][1] = 1\n\nans = 0\nac = 0\nfor i in range(n):\n if(u[i][1] == 1):\n ac += 1\n ans += u[i][0]\nprint(ac,ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s284315973', 's374752432', 's855224351']
[20364.0, 20388.0, 30624.0]
[238.0, 247.0, 367.0]
[357, 358, 402]
p02802
u244434589
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["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 if l2[p-1] == 0:\n l2[p-1] +=1\n else:\n pass \n else:\n if l2[p-1] == 0:\n l1[p-1] +=1\n else:\n pass\nfor i in range(n):\n if l2[i] == 0:\n l1[i] == 0:\n \nprint(sum(l2),sum(l1))", "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)"]
['Runtime Error', 'Accepted']
['s386062132', 's165844956']
[8992.0, 10304.0]
[25.0, 230.0]
[511, 430]
p02802
u248670337
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['from operator import mul\nfrom functools import reduce\ndef cmb(n,r):\n r=min(n-r,r)\n if r==0: return 1\n over=reduce(mul, range(n,n-r,-1))\n under=reduce(mul, range(1,r+1))\n return over//under\nn,k=map(int,input().split())\nA=sorted(list(map(int,input().split())))\ns=0\nc=int(cmb(n-1,k-1))\nfor i in range(n-k+1):\n s+=(A[n-1-i]-A[i])*c\n s%=10**9+7\n c=c*(n-k-i)//(n-1-i)\nprint(s)', "n,m=map(int,input().split())\nif m == 0:\n print(0,0)\n exit()\nA=[[0,0] for _ in range(n)]\nfor i in range(m):\n p,s=input().split()\n p=int(p)-1\n if A[p][0]==1:\n continue\n elif s=='AC':\n A[p][0]=1\n else:\n \tA[p][1]+=1\nac=0\nwa=0\nfor a in A:\n ac+=a[0]\n wa+=a[1] if a[0]==1 else 0\nprint(A)\nprint(ac,wa)", "n,m=map(int,input().split())\nif m == 0:\n print(0,0)\n exit()\nA=[[0,0] for _ in range(n)]\nfor i in range(m):\n p,s=input().split()\n p=int(p)-1\n if A[p][0]==1:\n continue\n elif s=='AC':\n A[p][0]=1\n else:\n \tA[p][1]+=1\nac=0\nwa=0\nfor a in A:\n ac+=a[0]\n if a[0] == 1:wa+=a[1]\nprint(ac,wa)"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s139509638', 's673631662', 's624835261']
[3572.0, 15600.0, 13172.0]
[23.0, 368.0, 325.0]
[388, 309, 295]
p02802
u250554058
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n, m = map(int, input().split())\ntest = list(map(list, set(map(tuple, [input().split() for i in range(m)]))))\ncount = 0\nfor i in test:\n if(i[1] == 'WA'):\n count += 1\n\nprint(len(test), count)\n", "n, m = map(int, input().split())\ntest = list(map(list, set(map(tuple, [input().split() for i in range(m)]))))\ncount = 0\nfor i in test:\n if(i[1] == 'WA'):\n count += 1\n\nprint(len(test), count)\n", "n, m = map(int, input().split())\nlist_num = list([] for i in range(n))\ntest = [input().split() for i in range(m)]\nfor i in test:\n list_num[int(i[0]) - 1].append(i[1])\ncount = 0\ncount_ac = 0\ncount_wa = 0\ncheck = 0\nfor i in list_num:\n for j in range(len(i)):\n if(i[j] =='WA'):\n count += 1\n elif(i[j] == 'AC'):\n count_ac += 1\n check = 1\n break\n if(check == 1):\n count_wa += count\n check = 0 \n count = 0\nprint(count_ac , count_wa)\n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s033684865', 's848250515', 's785049203']
[43908.0, 43908.0, 43980.0]
[322.0, 311.0, 407.0]
[195, 195, 463]
p02802
u253681061
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n, m = input().split()\nn = int(n)\nm = int(m)\nresults = []\nfor i in range(m):\n results.append(list(input().split()))\n\nwa = 0\nac = 0\n\ndic = {}\nfor q, a in results:\n if q not in dic.keys():\n dic[q] = {"ac": False, "wa": 0}\n if dic[q]["ac"] is False and a == "WA":\n wa += 1\n elif dic[q]["ac"] is False and a == "AC":\n ac += 1\n dic[q]["ac"] = True\n elif dic[q]["ac"] is True:\n pass\n print(dic, ac, wa)\n\nprint(ac, wa)', 'n, m = input().split()\nn = int(n)\nm = int(m)\nresults = []\nfor i in range(m):\n results.append(list(input().split()))\n\nwa = 0\nac = 0\n\ndic = {}\nfor q, a in results:\n if q not in dic.keys():\n dic[q] = {"ac": False, "wa": 0}\n if dic[q]["ac"] is True:\n pass\n elif dic[q]["ac"] is False and a == "WA":\n dic[q]["wa"] += 1\n elif dic[q]["ac"] is False and a == "AC":\n ac += 1\n dic[q]["ac"] = True\nfor x in dic.keys():\n if dic[x]["ac"] is True:\n wa += dic[x]["wa"]\n\nprint(ac, wa)']
['Wrong Answer', 'Accepted']
['s891720223', 's157790637']
[121192.0, 61796.0]
[2105.0, 459.0]
[464, 528]
p02802
u253952966
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n, m = map(int, input().split())\nac = [0 for _ in range(n)]\npen = [0 for _ in range(n)]\n\nfor _ in range(m):\n p, s = input().split()\n p = int(p) - 1\n if s == 'WA':\n if ac[p] == 0:\n pen[p] += 1\n else:\n ac[p] = 1\n\nfor p in range(m):\n if ac[p] == 0:\n pen[p] = 0\nprint(str(sum(ac)) + ' ' + str(sum(pen)))", "n, m = map(int, input().split())\nac = [0 for _ in range(n)]\npen = [0 for _ in range(n)]\n\nfor _ in range(m):\n p, s = input().split()\n p = int(p) - 1\n if s == 'WA':\n if ac[p] == 0:\n pen[p] += 1\n else:\n ac[p] = 1\n\nfor p in range(n):\n if ac[p] == 0:\n pen[p] = 0\nprint(str(sum(ac)) + ' ' + str(sum(pen)))"]
['Runtime Error', 'Accepted']
['s526468151', 's453255959']
[4760.0, 4724.0]
[303.0, 296.0]
[318, 318]
p02802
u254221913
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n,m = map(int,input().split())\nps = [0] * m\np = [0] * m\ns = [0] * m\nfor i in range(m):\n ps[i] = list(map(str,input().split()))\nif m = 0:\n print(0,0)\n exit()\ncp=int(ps[0][0])\ncountA = [0] * n\ncountW = 0\ncn = 0\nfor item in ps:\n if item[1] == 'AC':\n countA[int(item[0])-1] = 1\n countW += cn\n cp += 1\n cn = 0\n else:\n cn+=1\nprint(sum(countA),countW)", "n,m = map(int,input().split())\nps = [0] * m\nfor i in range(m):\n ps[i] = list(map(str,input().split()))\nif m == 0:\n print(0,0)\n exit()\ncountA = [0] * n\ncountW = [0] * n\ncn = 0\nfor item in ps:\n if item[1] == 'AC' and countA[int(item[0])-1] == 0:\n countA[int(item[0])-1] = 1\n cn += countW[int(item[0])-1]\n else:\n countW[int(item[0])-1] += 1\nprint(sum(countA),cn)"]
['Runtime Error', 'Accepted']
['s344690618', 's393450130']
[2940.0, 33700.0]
[18.0, 454.0]
[394, 395]
p02802
u254871849
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["import sys\n\nn, m = map(int, sys.stdin.readline().split())\npv = []\nfor _ in range(m):\n p, s = sys.stdin.readline().split()\n p = int(p) - 1\n v = 1 if s == 'AC' else 0\n pv.append((p, v))\n\ndef main():\n wa = [0] * n\n ac = [0] * n\n for p, c in pv:\n wa[p] += (ac[p] | v) ^ 1\n ac[p] |= v\n for p in range(n): wa[p] *= ac[p]\n print(sum(ac), sum(wa))\n\nif __name__ == '__main__':\n main()", "import sys\n\nn, m = map(int, sys.stdin.readline().split())\npv = []\nfor _ in range(m):\n p, v = sys.stdin.readline().split()\n p = int(p)\n v = 1 if v == 'AC' else 0\n pv.append((p, v))\n\ndef main():\n return pv\n ac = [0] * (n + 1)\n wa = [0] * (n + 1)\n for p, v in pv:\n wa[p] += (ac[p] | v) ^ 1\n ac[p] |= v\n \n for p in range(1, n+1):\n wa[p] *= ac[p]\n\n return sum(ac), sum(wa)\n\nif __name__ == '__main__':\n ans = main()\n print(*ans, sep=' ')", "import sys\n\nn, m = map(int, sys.stdin.readline().split())\npv = []\nfor _ in range(m):\n p, s = sys.stdin.readline().split()\n p = int(p) - 1\n v = 1 if s == 'AC' else 0\n pv.append((p, v))\n\ndef main():\n wa = [0] * n\n ac = [0] * n\n for p, v in pv:\n wa[p] += (ac[p] | v) ^ 1\n ac[p] |= v\n for p in range(n): wa[p] *= ac[p]\n print(sum(ac), sum(wa))\n\nif __name__ == '__main__':\n main()"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s402364563', 's863700303', 's218909522']
[14912.0, 16068.0, 14908.0]
[179.0, 206.0, 182.0]
[420, 491, 420]
p02802
u256281774
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N, M = [int(i) for i in input().split()]\nd = {}\nfor i in range(M):\n ps = tuple(input().split())\n if ps in d:\n d[ps] += 1\n if ps[1] == "WA" and (ps[0], "AC") in d:\n d[ps] -= 1\n else:\n d[ps] = 1\nans1 = 0\nans2 = 0\nfor i in range(N):\n if (str(i), "AC") in d:\n ans1 += 1\n if (str(i), "WA") in d:\n ans2 += d[(str(i), "WA")]\nprint(ans1, ans2)', 'N, M = [int(i) for i in input().split()]\nAC = [0] * (N + 1)\nWA = [0] * (N + 1)\nfor i in range(M):\n p, S = input().split()\n if S == "AC":\n AC[int(p)] = 1\n else:\n if AC[int(p)] == 0:\n WA[int(p)] += 1\nans0 = 0\nans1 = 0\nfor i in range(N):\n ans0 += AC[i+1]\n if AC[i + 1] == 1:\n ans1 += WA[i+1]\nprint(ans0, ans1)']
['Wrong Answer', 'Accepted']
['s468714613', 's500783654']
[28708.0, 4596.0]
[455.0, 298.0]
[396, 353]
p02802
u260225357
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N, M = map(int, input().split())\n\nans_list = [0]*N+1\npen_num = 0\ncor_num = 0\n\nfor i in range(M):\n p_i, S_i = input().split()\n p_i = int(p_i)\n \n if (ans_list[p_i] == 0):\n if(S_i == "WA"):\n pen_num += 1\n elif(S_i == "AC"):\n cor_num += 1\n ans_list[p_i] = 1\n \nprint("{} {}".format(cor_num,pen_num))\n \n \n', 'N, M = map(int, input().split())\n\nans_list = [0]*N\npen_num = 0\ncor_num = 0\n\nfor i in range(M):\n p_i, S_i = input().split()\n p_i = int(p_i)\n \n if (ans_list[p_i] == 0):\n if(S_i == "WA"):\n pen_num += 1\n elif(S_i == "AC"):\n cor_num += 1\n ans_list[p_i] = 1\n \nprint("{} {}".format(cor_num,pen_num))\n \n \n', 'import itertools\nN, M = map(int, input().split())\n\nans_list = [0]*(N+1)\npen_list = [0]*(N+1)\n\nfor i in range(M):\n p_i, S_i = input().split()\n p_i = int(p_i)\n \n if (ans_list[p_i] == 0):\n if(S_i == "WA"):\n a = pen_list[p_i]\n a += 1\n pen_list[p_i] = a\n elif(S_i == "AC"):\n ans_list[p_i] = 1\n\npen_lis_ans = list(itertools.compress(pen_list, ans_list))\ncor_num = sum(ans_list)\npen_num = sum(pen_lis_ans)\n \nprint("{} {}".format(cor_num,pen_num))\n \n \n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s559572672', 's565327798', 's407089271']
[3828.0, 3828.0, 5560.0]
[18.0, 260.0, 289.0]
[331, 329, 494]
p02802
u266113953
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N, M = map(int, input().split())\nPS = []\nfor i in range(M):\n p, s = input().split()\n PS += [(int(p),s)]\n\nCA = 0\nPN = 0\nl = [True]*N\nfor i in range(len(PS)):\n if l[PS[i][0]]:\n if PS[i][1] == "WA":\n PN += 1\n elif PS[i][1] == "AC":\n CA += 1\n l[PS[i][0]] = False\n\nprint(CA, PN)', 'N, M = map(int, input().split())\nP = []\nS = []\nfor i in range(M):\n p, s = input().split()\n P += [int(p)]\n S += [s]\n\nCA = 0\nPN = 0\nd = {key:0 for key in P}\nfor i in range(len(P)):\n if d[P[i]] >= 0:\n if S[i] == "WA":\n d[P[i]] += 1\n elif S[i] == "AC":\n PN += d[P[i]]\n CA += 1\n d[P[i]] = -1\n\nprint(CA, PN)\n']
['Runtime Error', 'Accepted']
['s050382749', 's190568107']
[19716.0, 22580.0]
[311.0, 358.0]
[329, 372]
p02802
u268181283
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["N,M = map(int,input().split())\narr = []\npre_idx = '-1'\npre_s = 'start'\ncnt = 0\nerrors = 0\nans = 0\nfor i in range(M):\n idx,s = input().split()\n arr.append([int(idx),s])\n \narr = sorted(arr)\n\nflag = False\nfor idx,s in arr:\n if pre_idx != idx:\n cnt = 0\n flag = False\n if flag:\n continue\n else:\n if s=='WA':\n cnt += 1\n else:\n errors += cnt\n ans += 1\n flag = True\n pre_idx = idx\n pre_s = s\n \nprint(ans,errors)\n", "N,M = map(int,input().split())\nerrors = 0\nans = 0\nerror_arr = [0]*(N+1)\ns_arr = ['WA']*(N+1)\nfor i in range(M):\n idx,s = input().split()\n idx = int(idx)\n if s_arr[idx]!='AC':\n if s=='WA':\n error_arr[idx] += 1\n else:\n s_arr[idx]='AC'\n ans += 1\n errors += error_arr[idx]\n s_arr[idx] = 'AC'\n\nprint(ans,errors)\n \n \n "]
['Wrong Answer', 'Accepted']
['s775848504', 's799724992']
[23236.0, 4596.0]
[471.0, 279.0]
[450, 351]
p02802
u268792407
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n,m=map(int,input().split())\nans = 0\nwa = 0\nli = [[i] for i in range(n)]\nwa_list = [0] * n\nfor i in range(m):\n p,s=map(str,input().split())\n p=int(p)\n if "AC" not in li[p-1]:\n li[p-1].append(s)\n wa_list[p-1] += 1\n if s == "AC":\n ans += 1\n wa += wa_list[p-1]\n\nprint(ans,wa)', 'n,m=map(int,input().split())\nans = 0\nwa = 0\nli = [[i] for i in range(n)]\nfor i in range(m):\n p,s=map(str,input().split())\n p=int(p)\n if "AC" not in li[p-1]:\n li[p-1].append(s)\nprint(li)\nfor i in li:\n if "AC" in i:\n ans += 1\n wa += i.count("WA")\n\nprint(ans,wa)', 'n,m=map(int,input().split())\nans = 0\nwa = 0\nli = [[i] for i in range(n)]\nwa_list = [0] * n\nfor i in range(m):\n p,s=map(str,input().split())\n p=int(p)\n if "AC" not in li[p-1]:\n li[p-1].append(s)\n wa_list[p-1] += 1\n if s == "AC":\n ans += 1\n wa += wa_list[p-1]\n\nprint(ans,wa)', 'n,m=map(int,input().split())\nans = 0\nwa = 0\nwa_list = [0] * n\nac_list = [0] * n\nfor i in range(m):\n p,s=map(str,input().split())\n p=int(p)-1\n if ac_list[p] == 0:\n if s == "AC":\n ac_list[p] += 1\n else:\n wa_list[p] += 1\na=0\nfor i in range(n):\n if ac_list[i]==0:\n wa_list[i]=0\nprint(sum(ac_list),sum(wa_list))\n \n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s502443624', 's559984721', 's919952481', 's553833689']
[25308.0, 28880.0, 25308.0, 4596.0]
[2104.0, 2104.0, 2104.0, 352.0]
[294, 272, 294, 333]
p02802
u272336707
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n, m = map(int, input().split())\nans = []\nans_0 = []\nfor i in range(m):\n ans_0 = list(map(str, input().split()))\n ans.append(ans_0)\nlist0 = []\nfor j in range(n):\n list0.append(0)\nsei = 0\npen = 0\nfor lis in ans:\n if list0[int(lis[0])] == 0:\n if lis[1] == "AC":\n sei += 1\n list0[int(lis[0])] = 1\n else:\n pen += 1\n else:\n if lis[1] == "AC":\n pass\n else:\n pen += 1\nprint(str(sei)+" "+str(pen))\n\n', 'n, m = map(int, input().split())\nans = []\nans_0 = []\nfor i in range(m):\n ans_0 = list(map(str, input().split()))\n ans.append(ans_0)\nlist0 = []\nlistpen = []\nfor j in range(n):\n list0.append(0)\nfor k in range(n):\n listpen.append(0)\nsei = 0\npen = 0\nfor lis in ans:\n if list0[int(lis[0])-1] == 0:\n if lis[1] == "AC":\n sei += 1\n list0[int(lis[0])-1] = 1\n else:\n listpen[int(lis[0])-1] += 1\n else:\n pass\nfor l in range(n):\n if list0[l] == 1:\n pen += listpen[l]\nprint(str(sei)+" "+str(pen))\n']
['Runtime Error', 'Accepted']
['s608795996', 's243103539']
[33088.0, 33768.0]
[411.0, 437.0]
[489, 566]
p02802
u272525952
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n,m=map(int,input().split())\nl=[0]*(n+1)\nmiss=[0]*(n+1)\nfor _ in range(m):\n p,s=input().split()\n p=int(p)\n if l[p]==0:\n if s=='AC':\n l[p]+=1\n else:\n miss[p]+=1\nfor i in range(m):\n if l[i]==0 and miss[i]!=0:\n miss[i]=0\na=l.count(1)\nb=sum(miss)\nprint(a,b)", "n,m=map(int,input().split())\nl=[0]*(n+1)\nmiss=[0]*(n+1)\nfor _ in range(m):\n p,s=input().split()\n p=int(p)\n if l[p]==0:\n if s=='AC':\n l[p]+=1\n else:\n miss[p]+=1\nfor i in range(1,n+1):\n if l[i]==0 and miss[i]!=0:\n miss[i]=0\na=l.count(1)\nb=sum(miss)\nprint(a,b)"]
['Runtime Error', 'Accepted']
['s831314952', 's205450227']
[10448.0, 10324.0]
[190.0, 193.0]
[308, 312]
p02802
u273010357
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["import sys, heapq\nfrom collections import defaultdict\nfrom itertools import product, permutations, combinations\nfrom bisect import bisect_left \n\nsys.setrecursionlimit(10**7)\ndef input():\n return sys.stdin.readline()[:-1]\n\nN, M = map(int, input().split())\npS = [list(input().split()) for _ in range(M)]\n\nac_num = defaultdict(int) # number of AC : dict\nwa_num = defaultdict(int) # number of WA : dict\nwass = 0 # number of WA : int\nfor ps in pS:\n p, S = int(ps[0]), ps[1]\n \n if ac_num[p] == 1:\n continue\n else:\n if S == 'AC':\n ac_num[p] = 1\n \n wass += wa_num[p]\n elif S == 'WA':\n wa_num[p] += 1\n print(ac_num, wa_num)\n\nprint(sum(list(ac_num.values())), wass)", "import sys, heapq\nfrom collections import defaultdict\nfrom itertools import product, permutations, combinations\nfrom bisect import bisect_left \n\nsys.setrecursionlimit(10**7)\ndef input():\n return sys.stdin.readline()[:-1]\n\nN, M = map(int, input().split())\npS = [list(input().split()) for _ in range(M)]\n\nac_num = defaultdict(int) # number of AC : dict\nwa_num = defaultdict(int) # number of WA : dict\nwass = 0 # number of WA : int\nfor ps in pS:\n p, S = int(ps[0]), ps[1]\n \n if ac_num[p] == 1:\n continue\n else:\n if S == 'AC':\n ac_num[p] = 1\n \n wass += wa_num[p]\n elif S == 'WA':\n wa_num[p] += 1\n #print(ac_num, wa_num)\n\nprint(sum(list(ac_num.values())), wass)"]
['Wrong Answer', 'Accepted']
['s869378640', 's293925606']
[140692.0, 44464.0]
[2105.0, 267.0]
[851, 852]
p02802
u276250981
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n, m = map(int,input().split())\ncor, war = 0,0\nc = [[0,0] for k in range(n)] \nfor i in range(m):\n p,s = list(input().split())\n p = int(p)\n if s == "AC" and c[p][0] == 0: \n cor += 1\n c[p][0] = 1\n war += c[p][1]\n if s == "WA" and c[p][0] == 0: \n c[p][1] += 1\nprint(cor,war) \n ', 'n, m = map(int,input().split())\ncor, war = 0,0\nc = [[0,0] for k in range(n)] \nfor i in range(m):\n p,s = list(input().split())\n p = int(p)-1\n if s == "AC" and c[p][0] == 0: \n cor += 1\n c[p][0] = 1\n war += c[p][1]\n if s == "WA" and c[p][0] == 0: \n c[p][1] += 1\nprint(cor,war) ']
['Runtime Error', 'Accepted']
['s307554301', 's205321749']
[13172.0, 13172.0]
[359.0, 375.0]
[465, 462]
p02802
u277312083
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n, k = map(int, input().split())\nl = [False] * n\nans = [0, 0]\nfor i in range(k):\n p, r = map(input().split())\n if l[int(p) - 1] == False:\n if r == "WA":\n c[0] += 1\n elif r == "AC":\n l[int(p) - 1] = True\n c[1] += 1\nprint(c[1], c[0])', 'n, m = map(int, input().split())\nl = [False] * n\nans = [0, 0]\nfor i in range(n):\n p, r = map(input().split())\n if l[int(p) - 1] == False:\n if r == "WA":\n c[0] += 1\n elif r == "AC":\n l[int(p) - 1] = True\n c[1] += 1\nprint(c[1], c[0])', 'n, k = map(int, input().split())\nl = [False] * n\nc = [0, 0]\nfor i in range(k):\n p, r = map(input().split())\n if l[int(p) - 1] == False:\n if r == "WA":\n c[0] += 1\n elif r == "AC":\n l[int(p) - 1] = True\n c[1] += 1\nprint(c[1], c[0])', 'n, m = map(int, input().split())\nl = [False] * n\nans = [0, 0]\nfor i in range(n):\n p, r = map(input().split())\n if l[int(p) - 1] == False:\n if r == "WA":\n c[0] += 1\n elif r == "AC":\n l[int(p) - 1] == True\n c[1] += 1\nprint(c[1], c[0])', 'n, m = map(int, input().split( ))\nwa = [0] * (n + 1)\nacsum = 0\nwasum = 0\nfor i in range(m):\n no_s, res = map(str, input().split( ))\n no = int(no_s)\n if wa[no] != -1 and res == "AC":\n \tacsum += 1\n wasum += wa[no]\n wa[no] = -1\n elif wa[no] != -1 and res == "WA":\n wa[no] += 1\nprint(str(acsum) + " " + str(wasum))\n', 'n, m = map(int, input().split())\nl = [False] * n\nc = [0] * n\nans = [0, 0]\nfor i in range(m):\n p, r = map(str, input().split())\n if l[int(p) - 1] == False:\n if r == "WA":\n c[int(p) - 1] += 1\n elif r == "AC":\n l[int(p) - 1] = True\n ans[0] += c[int(p) - 1]\n ans[1] += 1\nprint(ans[1], ans[0])']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s787478778', 's811535184', 's840919638', 's943783173', 's948308626', 's790840369']
[3828.0, 3828.0, 3828.0, 3828.0, 2940.0, 4596.0]
[18.0, 18.0, 18.0, 20.0, 17.0, 392.0]
[254, 254, 252, 255, 349, 316]
p02802
u284363684
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['# input\nN, M = map(int, input().split())\n\n\nAC_cnt = 0\nWA_cnt = 0\nAC_questions = []\nAC_append = AC_questions.append\nfor i in range(M):\n P, S = map(str, input().split())\n\n if not AC_questions or P in AC_questions:\n continue\n\n if S == "AC":\n AC_cnt += 1\n AC_append(P)\n else:\n WA_cnt += 1\n\nprint(AC_cnt, WA_cnt)', '# input\nN, M = map(int, input().split())\n\n\nAC_questions = {}\nfor i in range(M):\n P, S = map(str, input().split())\n\n if P not in AC_questions:\n AC_questions[P] = {\n "wa_cnt": 0,\n "ac": False\n }\n\n if AC_questions[P]["wa_cnt"] is True:\n continue\n elif S == "AC":\n AC_questions[P]["ac"] = True\n # S == "WA"\n else:\n AC_questions[P]["wa_cnt"] += 1\n \nAC_cnt = sum([1 for a in AC_questions if a[\'ac\'] is True])\nWA_cnt = sum([a["wa_cnt"] for a in AC_questions if a["ac"] is True])\n\nprint(AC_cnt, WA_cnt)', '# input\nN, M = map(int, input().split())\n\n\nAC_questions = {}\nfor i in range(M):\n P, S = map(str, input().split())\n\n if P not in AC_questions:\n AC_questions[P] = {\n "wa_cnt": 0,\n "ac": False\n }\n\n if AC_questions[P]["ac"] is True:\n continue\n elif S == "AC":\n AC_questions[P]["ac"] = True\n # S == "WA"\n else:\n AC_questions[P]["wa_cnt"] += 1\n\n\n\ntarget_keys = [key for key in AC_questions.keys() if AC_questions[key][\'ac\'] is True]\nAC_cnt = sum([1 for key in target_keys])\nWA_cnt = sum([AC_questions[key]["wa_cnt"] for key in target_keys])\n\nprint(AC_cnt, WA_cnt)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s929224396', 's953047796', 's113372398']
[3064.0, 44480.0, 46016.0]
[251.0, 391.0, 482.0]
[354, 583, 903]
p02802
u285681431
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N, M = map(int, input().split())\n\nprob = [[0] * 2 for _ in range(N + 1)]\n# print(prob)\nps_list = [[0, 0]]\n\nfor i in range(1, M + 1):\n p, s = input().split()\n p = int(p)\n ps_list.append([p, s])\n if s == "AC" and prob[p] != [0, 0]:\n prob[p] = [1, i]\n\n\n# print(prob)\n\nac = 0\nfor item in prob:\n if item[0] == 1:\n ac += 1\n\npenalty = 0\nfor i in range(1, M + 1):\n p = ps_list[i][0]\n s = ps_list[i][1]\n if s == "WA" and i < prob[p][1]:\n penalty += 1\n\nprint(ac, penalty)\n', 'N, M = map(int, input().split())\n\nprob = [[0] * 2 for _ in range(N + 1)]\n# print(prob)\nps_list = [[0, 0]]\n\nfor i in range(1, M + 1):\n p, s = input().split()\n p = int(p)\n ps_list.append([p, s])\n if s == "AC" and prob[p] == [0, 0]:\n prob[p] = [1, i]\n\n\n# print(prob)\n\nac = 0\nfor item in prob:\n if item[0] == 1:\n ac += 1\n\npenalty = 0\nfor i in range(1, M + 1):\n p = ps_list[i][0]\n s = ps_list[i][1]\n if s == "WA" and i < prob[p][1]:\n penalty += 1\n\nprint(ac, penalty)\n']
['Wrong Answer', 'Accepted']
['s517286156', 's384287429']
[35780.0, 38976.0]
[302.0, 408.0]
[599, 599]
p02802
u287132915
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n, m = map(int, input().split())\np, s = [], []\nfor i in range(n):\n pi, si = input().split()\n p.append(int(pi))\n s.append(si)\n\nlst_ac = [0 for i in range(n+1)]\nfor i in range(n):\n if s[i] == 'AC':\n lst_ac[p[i]] = 1\nans_ac = sum(lst_ac)\n\nout = 0\nfor i in range(n):\n if s[i] == 'WA' and lst_ac[p[i]] == 1:\n out += 1\n\nprint(ans_ac, out)", "n, m = map(int, input().split())\np, s = [], []\nfor i in range(m):\n pi, si = input().split()\n p.append(int(pi))\n s.append(si)\n\nlst_ac = [0 for i in range(n+1)]\nfor i in range(m):\n if s[i] == 'AC':\n lst_ac[p[i]] = 1\nans_ac = sum(lst_ac)\n\nout = 0\nfor i in range(m):\n if s[i] == 'WA' and lst_ac[p[i]] == 1:\n out += 1\n if s[i] == 'AC' and lst_ac[p[i]] == 1:\n lst_ac[p[i]] = 2\n\nprint(ans_ac, out)"]
['Runtime Error', 'Accepted']
['s234496719', 's221380311']
[14164.0, 14552.0]
[281.0, 307.0]
[361, 429]
p02802
u288001809
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['a,b=(int(x) for x in input().split())\nlist = []\nt_cnt = 0\nf_cnt = 0\nfor i in range(b):\n s = input().split()\n if s[1] == \'AC\':\n if not (s[0] in list):\n \tlist.append(s[0])\n t_cnt += 1\n else:\n if not (s[0] in list):\n f_cnt += 1\nprint("{} {}".format(t_cnt, f_cnt))', 'a,b=map(int,input().split())\nlist = [0]*a\nt_cnt = 0\nf_cnt = 0\nfor i in range(b):\n c, d = map(str,input().split())\n if d == \'AC\':\n if list[c-1] == 0:\n list[c-1] = 1\n t_cnt += 1\n else:\n if list[c-1] == 0:\n f_cnt += 1\nprint("{} {}".format(t_cnt, f_cnt))\n', 'a,b=map(int,input().split())\nlist = [0]*a\nt_cnt = 0\nf_cnt = 0\nfor i in range(b):\n c, d = map(str,input().split())\n if d == \'AC\':\n if list[c] == 0:\n list[c] = 1\n t_cnt += 1\n else:\n if list[c] == 0:\n f_cnt += 1\nprint("{} {}".format(t_cnt, f_cnt))', 'a,b=map(int,input().split())\nlist = [0]*a\nt_cnt = 0\nf_cnt = [0]*a\nfor i in range(b):\n c, d = map(str,input().split())\n x = int(c) - 1\n if list[x] == 0:\n if d == \'AC\':\n list[x] = 1\n t_cnt += 1\n else:\n f_cnt[x] += 1\nfor i in range(a):\n if list[i] ==0:\n f_cnt[i] = 0\nprint("{} {}".format(t_cnt, sum(f_cnt)))']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s041643292', 's100314303', 's851120528', 's513096441']
[2940.0, 3828.0, 3828.0, 4596.0]
[17.0, 18.0, 18.0, 360.0]
[284, 275, 268, 338]
p02802
u295178043
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n, m = map(int, input().split())\np = []\ns = []\n\nfor i in range(0, m):\n pi, si = map(str, input().split())\n p.append( int(pi) )\n s.append( si )\n\n\ndone = []\nfor i in range(0,n):\n done.append(False)\n\nwa = 0\nac = 0\nfor i in range(0, m):\n if not done[p[i]]:\n if s[i] == 'WA':\n wa += 1\n else: # 'AC':\n ac += 1\n done[p[i]] = True\n\nprint(ac, wa)\n", "n, m = map(int, input().split())\np = []\ns = []\n\nfor i in range(0, m):\n pi, si = map(str, input().split())\n p.append( int(pi) )\n s.append( si )\n\n\ndone = []\nfor i in range(0,n):\n done.append(False)\nwa_num = []\nfor i in range(0,n):\n wa_num.append(0)\n\nac = 0\nfor i in range(0, m):\n num = p[i] - 1\n if not done[num]:\n if s[i] == 'WA':\n wa_num[num] += 1\n else: # 'AC':\n ac += 1\n done[num] = True\n\nwa = 0\nfor i in range(0,n):\n if done[i]:\n wa += wa_num[i]\n\nprint(ac, wa)\n"]
['Runtime Error', 'Accepted']
['s933544774', 's973167382']
[14140.0, 15008.0]
[351.0, 392.0]
[400, 542]
p02802
u295294832
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["N,M= [int(i) for i in input().split()]\ntmp=[]\nscr=[0]*2\nrec=[0]*N\nr=0\nts=0\nfor i in range(M):\n tmp = ([x for x in input().split()])\n q=int(tmp[0])\n if q!=r: ts=0\n if rec[q-1] == 1:\n continue\n else:\n if tmp[1] == 'AC':\n rec[q-1]=1\n scr[0]+=1\n scr[1]+=ts\n ts=0\n elif tmp[1]=='WA':\n ts+=1\n r=q", "N,M= [int(i) for i in input().split()]\ntmp=[]\nscr=[0]*2\nrec=[0]*N\neec=[0]*N\n\nts=0\nfor i in range(M):\n tmp = ([x for x in input().split()])\n q=int(tmp[0])\n\n if rec[q-1] == 1:\n continue\n else:\n if tmp[1] == 'AC':\n rec[q-1]=1\n scr[0]+=1\n scr[1]+=eec[q-1]\n elif tmp[1]=='WA':\n eec[q-1]+=1\n \n \nprint(scr[0],scr[1])\n"]
['Wrong Answer', 'Accepted']
['s474355054', 's448822971']
[3828.0, 4596.0]
[386.0, 349.0]
[492, 489]
p02802
u304593245
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['import numpy as np\n\ndef solve():\n dp = np.zeros((2, N+1))\n# print(dp)\n ac = 0\n wa = 0\n for i in range(M): \n if (dp[0][S[i][0]] == 0):\n if(S[i][1] == "WA"):\n dp[1][S[i][0]] += 1\n elif(S[i][1] == "AC"):\n ac += 1\n dp[0][S[i][0]] = 1\n wa += dp[1][S[i][0]]\n print(ac, wa)\n\nif __name__=="__main__":\n\n N, M = list(map(int, input().split()))\n S = []\n for i in range(M):\n a,b = input().split()\n S.append([int(a), b])\n# print(S)\n \n solve()\n \n\n\n', '\ndef solve():\n dp = [0]*(N+1)\n ac = 0\n wa = 0\n for i in range(M):\n if ps[i][1] == "AC":\n if dp[int(ps[i][0])] == 0:\n dp[int(ps[i][0])] = 1\n else:\n if dp[int(ps[i][0])] == 0:\n wa += 1\n# print(dp)\n print(ac, wa)\n\n\nif __name__ == "__main__":\n N,M = list(map(int, input().split()))\n ps = [list(map(str, input().split())) for _ in range(M)] \n solve()\n', 'import numpy as np\n\ndef solve():\n dp = np.zeros((2, N+1))\n# print(dp)\n ac = 0\n wa = 0\n for i in range(M): \n if (dp[0][S[i][0]] == 0):\n if(S[i][1] == "WA"):\n dp[1][S[i][0]] += 1\n elif(S[i][1] == "AC"):\n ac += 1\n dp[0][S[i][0]] = 1\n wa += dp[1][S[i][0]]\n print(ac, int(wa))\n\nif __name__=="__main__":\n\n N, M = list(map(int, input().split()))\n S = []\n for i in range(M):\n a,b = input().split()\n S.append([int(a), b])\n# print(S)\n solve()\n \n\n\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s150109962', 's606395246', 's030107388']
[32248.0, 34232.0, 46364.0]
[721.0, 294.0, 418.0]
[576, 441, 576]
p02802
u305781333
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["N, M = [int(i) for i in input().split()]\np_S = [[i for i in input().split()] for _ in range(M)]\n\nans=[]\nAC=0\nWA=0\n\nfor i in p_S:\n if i[1]=='WA' and i[0] not in ans:\n WA+=1\n elif i[1]=='AC' and i[0] not in ans:\n AC+=1\n ans.append(i[0])\n\nprint(ans)\n\nprint(AC, WA)", "N, M = [int(i) for i in input().split()]\np_S = [[i for i in input().split()] for _ in range(M)]\n\nans={}\nfor i in range(1, N+1):\n ans[str(i)]=False\n\nAC=0\nWA=0\n\nfor i in p_S:\n if i[1]=='WA' and not ans[i[0]]:\n WA+=1\n elif i[1]=='AC' and not ans[i[0]]:\n AC+=1\n ans[i[0]]=True\n\nprint(ans)\nprint(AC, WA)", "N, M = map(int, input().split())\nAC = [0] * N\nWA = [0] * N\n\nfor i in range(M):\n p, S = input().split()\n p = int(p) - 1\n if S == 'AC':\n AC[p] = 1\n elif AC[p] == 0:\n WA[p] += 1\n\nprint(sum(AC), sum( [AC[i] * WA[i] for i in range(N)] ) )\n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s377920007', 's863392597', 's349848376']
[25988.0, 42112.0, 5528.0]
[2105.0, 368.0, 295.0]
[272, 310, 260]
p02802
u306060982
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n,m = map(int,input().split())\na=0\nb=0\nif m==0:\n print(0,0)\n exit()\np = [[str(i) for i in input().split()] for _ in range(m)]\n\nc = sorted(p,key=lambda x:x[0])\n\nnow = c[0][0]\nd = 1\naa=0\nbb=0\nf = 0\n\nfor i in c:\n if i[0] == now:\n if i[1]=='AC':\n if d:\n a += 1\n f = 1\n d = 0\n else:\n if not f:\n bb+=1\n else:\n now = i[0]\n d = 1\n if f:\n b += bb\n f = 0\n bb = 0\n if i[1]=='AC':\n if d:\n a+=1\n f=1\n d = 0\n else:\n if not f:\n bb+=1\n else:\n now = i[0]\n d = 1\n\tif f:\n b += bb\n f = 0\n bb = 0\n if i[1]=='AC':\n if d:\n a+=1\n f=1\n d = 0\n else:\n if not f:\n bb+=1\nb += bb\nprint(a,b)\n", "n,m = map(int,input().split())\na=0\nb=0\nif m==0:\n print(0,0)\n exit()\np = [[str(i) for i in input().split()] for _ in range(m)]\n\nc = sorted(p,key=lambda x:x[0])\n\nnow = c[0][0]\nd = 1\naa=0\nbb=0\nf = 0\nprint(now)\nfor i in c:\n if i[0] == now:\n if i[1]=='AC':\n if d:\n a += 1\n f = 1\n d = 0\n else:\n if not f:\n bb+=1\n else:\n now = i[0]\n d = 1\n if f:\n b += bb\n f = 0\n bb = 0\n if i[1]=='AC':\n if d:\n a+=1\n f=1\n d = 0\n else:\n if not f:\n bb+=1\n else:\n now = i[0]\n d = 1\n\tif f:\n b += bb\n f = 0\n bb = 0\n if i[1]=='AC':\n if d:\n a+=1\n f=1\n d = 0\n else:\n if not f:\n bb+=1\nb += bb\nprint(a,b)\n", "n,m = map(int,input().split())\na=0\nb=0\nif m==0:\n print(0,0)\n exit()\np = [[str(i) for i in input().split()] for _ in range(m)]\n\nc = sorted(p,key=lambda x:x[0])\n\nnow = c[0][0]\nd = 1\naa=0\nbb=0\nf = 0\n\nfor i in c:\n if i[0] == now:\n if i[1]=='AC':\n if d:\n a += 1\n f = 1\n d = 0\n else:\n if not f:\n bb+=1\n else:\n now = i[0]\n d = 1\n if f:\n b += bb\n f = 0\n bb = 0\n if i[1]=='AC':\n if d:\n a+=1\n f=1\n d = 0\n else:\n if not f:\n bb+=1\nif f:\n b+=bb\nprint(a,b)\n"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s244156594', 's509689651', 's336600647']
[3064.0, 3064.0, 28272.0]
[18.0, 17.0, 445.0]
[965, 975, 698]
p02802
u306412379
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["N, M = map(int, input().split())\nA = [input().split for i in range(M)]\ncac = 0\ncwa = 0\n\nfor i in range(1, N + 1):\n for a in A:\n while a[0] == str(i):\n if a[1] == 'WA':\n cwa += 1\n else:\n cac += 1\n break\n while a[0] == str(i):\n A.remove(a)\nprint(cac, cwa)", "n, m = map(int, input().split())\na = [input().split() for i in range(m)]\nwa =[0]*n \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)"]
['Runtime Error', 'Accepted']
['s899638192', 's642902781']
[24020.0, 39788.0]
[151.0, 262.0]
[348, 371]
p02802
u308457635
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n, m = map(int, input().split())\np, s = [], []\ncor, pen = 0, 0\nfor _ in range(m):\n li = input().split()\n p.append(int(li[0]))\n s.append(li[1])\nfor j in range(n):\n corFlag = False\n for i in range(m):\n if (p[i] == j + 1):\n if (s[i] == 'WA' and (not corFlag)):\n pen += 1\n else:\n cor += 1\n corFlag = True\nprint(cor, pen)", "n, m = map(int, input().split())\n\nhasAC, pena = [0] * n, [0] * n\n\nfor i in range(m):\n li = input().split()\n p = int(li[0]) - 1\n s = li[1]\n if hasAC[p]: continue\n if s == 'AC': hasAC[p] = 1\n else: pena[p] += 1\nAC, pena_sum = 0, 0\nfor i in range(n):\n AC += hasAC[i]\n if hasAC[i]: pena_sum += pena[i]\nprint(AC, pena_sum)"]
['Wrong Answer', 'Accepted']
['s457639777', 's811984688']
[13424.0, 4596.0]
[2104.0, 292.0]
[405, 341]
p02802
u311379832
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["N, M = map(int, input().split())\np = [list(map(str, input().split())) for _ in range(M)]\naclst = [0] * (N + 1)\ncntw = 0\ncnta = 0\ntmpw = 0\nfor i in range(M):\n if aclst[int(p[i][0])] == 0:\n if p[i][1] == 'WA':\n tmpw += 1\n else:\n cnta += 1\n cntw += tmpw\n aclst[int(p[i][0])] = 1\n \n\nprint(cnta, cntw)", "N, M = map(int, input().split())\np = [list(map(str, input().split())) for _ in range(M)]\naclst = [0] * (N + 1)\nwalst = [0] * (N + 1)\ncntw = 0\ncnta = 0\nfor i in range(M):\n if aclst[int(p[i][0])] == 0:\n if p[i][1] == 'WA':\n walst[int(p[i][0])] += 1\n else:\n cnta += 1\n cntw += walst[int(p[i][0])]\n aclst[int(p[i][0])] = 1\n\n\nprint(cnta, cntw)"]
['Wrong Answer', 'Accepted']
['s415588100', 's863984721']
[32944.0, 33712.0]
[375.0, 418.0]
[368, 399]
p02802
u312078744
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nn, m = map(int, readline().split())\n#n, m = map(int, input().split())\n\nacCount = 0\nwaCount = 0\ncheck = [0] * n\nwaCheck = [0] * n\n\nfor i in range(m):\n p, s = map(str, input().split())\n # print(p,s)\n p = int(p)\n if (check[p - 1] == 0):\n if (s == 'WA'):\n waCheck[p - 1] += 1\n\n else:\n acCount += 1\n waCheck += waCheck[p - 1]\n\n check[p - 1] = 1\n else:\n continue\n\nprint(acCount, waCount)\n", "import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nn, m = map(int, readline().split())\n#n, m = map(int, input().split())\n\nacCount = 0\nwaCount = 0\ncheck = [0] * n\nwaCheck = [0] * n\n\nfor i in range(m):\n p, s = map(str, input().split())\n # print(p,s)\n p = int(p)\n if (check[p - 1] == 0):\n if (s == 'WA'):\n waCheck[p - 1] += 1\n\n else:\n acCount += 1\n waCount += waCheck[p - 1]\n\n check[p - 1] = 1\n else:\n continue\n\nprint(acCount, waCount)\n"]
['Runtime Error', 'Accepted']
['s365256533', 's328123743']
[10396.0, 10392.0]
[209.0, 247.0]
[579, 579]
p02802
u317423698
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["import sys\n\n\ndef resolve(in_):\n N, M = map(int, next(in_).split())\n PS = tuple(line.strip().split() for line in in_)\n \n ac = set()\n wa = {}\n\n for p, s in PS:\n if s == 'AC':\n ac.add(p)\n if s == 'WA' and p not in ac:\n wa[p] = wa.setdefault(p, 0) + 1\n\n penalties = 0\n for k, v in wa.items:\n if k in ac:\n penalties += v\n \n return '{} {}'.format(len(ac), penalties)\n\n\ndef main():\n answer = resolve(sys.stdin)\n print(answer)\n\n\nif __name__ == '__main__':\n main()\n", "import sys\n\n\ndef resolve(in_):\n N, M = map(int, next(in_).split())\n PS = tuple(line.strip().split() for line in in_)\n \n ac = set()\n wa = {}\n\n for p, s in PS:\n if s == 'AC':\n ac.add(p)\n if s == 'WA' and p not in ac:\n wa[p] = wa.setdefault(p, 0) + 1\n\n penalties = 0\n for k, v in wa.items:\n if k in ac:\n penalties += v\n \n return '{} {}'.format(len(ac), penalties)\n\n\ndef main():\n answer = resolve(sys.stdin)\n print(answer)\n\n\nif __name__ == '__main__':\n main()\n", "import sys\n\n\ndef resolve(in_):\n N, M = map(int, next(in_).split())\n PS = tuple(line.strip().split() for line in in_)\n \n ac = set()\n wa = {}\n\n for p, s in PS:\n if s == 'AC':\n ac.add(p)\n if s == 'WA' and p not in ac:\n wa[p] = wa.setdefault(p, 0) + 1\n\n penalties = 0\n for k, v in wa.items():\n if k in ac:\n penalties += v\n \n return '{} {}'.format(len(ac), penalties)\n\n\ndef main():\n answer = resolve(sys.stdin)\n print(answer)\n\n\nif __name__ == '__main__':\n main()\n"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s140762955', 's438717227', 's261542053']
[44244.0, 44348.0, 44280.0]
[148.0, 151.0, 144.0]
[549, 549, 551]
p02802
u317779196
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n,m = map(int, input().split())\n\nac = [False]*n\nc_ac = 0\nc_wa = 0\n\nfor _ in range(m):\n pi,si = input().split()\n pi = int(pi)\n \n if ac[pi] == False:\n if si == 'WA':\n c_wa += 1\n elif si == 'AC':\n c_ac += 1\n ac[pi] = True\n\nprint(c_ac, c_wa)", "n,m = map(int, input().split())\n\nac = [False]*n\nc_ac = 0\nc_wa = 0\nwa = [0]*n\nfor _ in range(m):\n pi,si = input().split()\n pi = int(pi) - 1\n \n if ac[pi] == False:\n if si == 'WA':\n wa[pi] += 1\n elif si == 'AC':\n c_ac += 1\n c_wa += wa[pi]\n ac[pi] = True\n\nprint(c_ac, c_wa)"]
['Runtime Error', 'Accepted']
['s087355129', 's242680310']
[3828.0, 4596.0]
[253.0, 285.0]
[296, 339]
p02802
u318233626
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N,M=map(int,input().split())\nA=[[] for i in range(N)]\nfor i in range(M):\n Pi,Si=map(str,input().split())\n Pi=int(Pi)\n A[Pi-1].append(Si)\n\nnAC=0\nnWA=0\nfor i in range(N):\n if len(A[i])==0:\n pass\n else:\n j=0 \n while A[i][j]=="WA":\n nWA+=1\n j+=1\n if j>len(A[i]):\n break\n else:\n pass\n if A[i][j]=="AC":\n nAC+=1\n else:\n pass\nprint("{:1},{:2}".format(nAC,nWA))\n\n', 'print("<input>") #\nN,M=map(int,input().split())\nA=[[] for i in range(N)]\nfor i in range(M):\n Pi,Si=map(str,input().split())\n Pi=int(Pi)\n A[Pi-1].append(Si)\n\nprint("<test>") #\nprint("A=",A) #\n\nnAC=0\nnWA=0\ninWA=0\nfor i in range(N):\n if len(A[i])==0:\n pass\n else:\n j=0 \n while A[i][j]=="WA":\n inWA+=1\n nWA+=1\n if j==len(A[i])-1:\n nWA-=inWA\n break\n else:\n pass\n j+=1\n if A[i][j]=="AC":\n nAC+=1\n else:\n pass\n inWA=0\n \nprint("<ans>") #\nprint("{:1}{:2}".format(nAC,nWA))\n\n', '#print("<input>") #\nN,M=map(int,input().split())\nA=[[] for i in range(N)]\nfor i in range(M):\n Pi,Si=map(str,input().split())\n Pi=int(Pi)\n A[Pi-1].append(Si)\n\n#print("<test>") #\n#print("A=",A) #\n\nnAC=0\nnWA=0\ninWA=0\nj=0\nfor i in range(N):\n #print("i=",i) #\n if len(A[i])==0:\n pass\n else: \n while A[i][j]=="WA":\n inWA+=1\n nWA+=1\n #print("j=",j) #\n #print("inWA=",inWA) #\n #print("nWA=",nWA) #\n if j==len(A[i])-1:\n nWA-=inWA\n break\n else:\n pass\n j+=1\n if A[i][j]=="AC":\n nAC+=1\n else:\n pass\n inWA=0\n j=0\n #print("inWA=",inWA) #\n #print("nWA=",nWA) #\n \n\n#print("<ans>") #\nprint("{0} {1}".format(nAC,nWA))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s631857918', 's867216555', 's374938701']
[20340.0, 22664.0, 20368.0]
[437.0, 479.0, 439.0]
[501, 651, 835]
p02802
u318740143
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N,M = map(int,input().split())\nbox = [0]*N\ncor = 0\nfal = 0\n\nfor i in range(M):\n p,s = input().split()\n p = int(p)\n s = str(s)\n \n if s == "WA":\n if box[p-1] != -1:\n box[p-1] += 1\n else:\n if box[p-1] != -1:\n cor += 1\n fal = box[p-1]\n box[p-1] = -1\n\nprint(cor,fal)\n \n\n ', 'N,M = map(int,input().split())\nbox = [0]*N\ncor = 0\nfal = 0\n\nfor i in range(M):\n p,s = input().split()\n p = int(p)\n s = str(s)\n \n if s == "WA":\n if box[p-1] != -1:\n box[p-1] += 1\n else:\n if box[p-1] != -1:\n cor += 1\n fal += box[p-1]\n box[p-1] = -1\n\nprint(cor,fal)\n ']
['Wrong Answer', 'Accepted']
['s538711071', 's377383874']
[3828.0, 3828.0]
[285.0, 304.0]
[303, 300]
p02802
u321035578
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["def main():\n n,m=map(int,input().split())\n f =[0]*n\n p=[]\n s=[]\n for i in range(m):\n pp,ss=input().split()\n ppp=int(pp)-1\n p.append(ppp)\n s.append(ss)\n\n\n cntA = 0\n cntW = 0\n\n for i in range(m):\n ptmp=p[i]\n stmp=s[i]\n cnt=0\n if f[ptmp] == 0:\n if stmp == 'WA':\n cnt += 1\n elif stmp == 'AC':\n cntA +=1\n cntW += cnt\n f[ptmp] =1\n\n print(str(cntA) + ' ' + str(cntW))\n # print(cntA)\n # print(cntW)\nif __name__=='__main__':\n main()\n", "def main():\n n,m=map(int,input().split())\n p =[[] for i in range(n)]\n for i in range(m):\n pp,ss=input().split()\n ppp=int(pp)\n p[ppp-1].append(ss)\n\n\n cntA = 0\n cntW = 0\n for i,a in enumerate(p):\n flg = 0\n cnt=0\n for j,s in enumerate(a):\n if s == 'WA':\n cnt += 1\n elif s == 'AC':\n cntA += 1\n cntW+=cnt\n break\n print(str(cntA) + ' ' + str(cntW))\n # print(cntA)\n # print(cntW)\nif __name__=='__main__':\n main()\n"]
['Wrong Answer', 'Accepted']
['s732901110', 's320674968']
[14196.0, 20272.0]
[263.0, 316.0]
[598, 561]
p02802
u327211044
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n, m = list(map(int, input().split()))\nresults = []\nif m:\n results = [input().split() for _ in range(m)]\nac = []\nk_wa = 0\ncnt_ac = 0\ncnt_wa = 0\nfor res in results:\n if res[1] == "AC":\n if not res[0] in ac:\n cnt_ac += 1\n ac.append(res[0])\n cnt_wa += k_wa\n else:\n k_wa += 1\nprint(cnt_ac, cnt_wa)', 'N,M=map(int,input().split())\nAC=[0]*N\nWA=[0]*N\nwa=0\nfor i in range(M):\n p,s=input().split()\n p=int(p)-1\n if AC[p]==0 and s=="AC":\n \tAC[p]=1\n \twa+=WA[p]\n WA[p]+=1\nprint(sum(AC),wa) \n']
['Wrong Answer', 'Accepted']
['s136255105', 's893123448']
[32292.0, 4596.0]
[2105.0, 298.0]
[349, 187]
p02802
u327532412
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N, M = map(int, input().split())\nprb = [0 for x in range(N)]\nac_cnt = 0\nwa_cnt = 0\nfor x in range(M):\n p, s = input().split()\n print(p, s)\n if prb[int(p) - 1] == 0 and s == "WA":\n wa_cnt += 1\n elif prb[int(p) - 1] == 0 and s == "AC":\n ac_cnt += 1\n prb[int(p) - 1] = 1\nprint(ac_cnt, wa_cnt)', 'N, M = map(int, input().split())\nA = [[] for _ in range(N)]\nac_cnt, wa_cnt = 0, 0\nfor _ in range(M):\n p, s = input().split()\n if s == "AC":\n A[int(p) - 1].append(1)\n else:\n A[int(p) - 1].append(0)\n\nfor x in A:\n if x.count(1) >= 1:\n ac_cnt += 1\n wa_cnt += len(x[0:x.index(1)])\nprint(ac_cnt, wa_cnt)']
['Wrong Answer', 'Accepted']
['s972643985', 's134011103']
[4776.0, 14768.0]
[873.0, 334.0]
[322, 337]
p02802
u328510800
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['r = int(input())\ng = int(input())\n\nprint(int(g * 2 - r))', '# history :: {int : (int, bool)}\nn, m = [int(x) for x in input().split()]\nhistory = { i+1 : [0, False] for i in range(n)}\n\nfor _ in range(m):\n pi, result = input().split()\n translated_pi = int(pi)\n if result == \'WA\' and not history[translated_pi][1]:\n history[translated_pi][0] += 1\n else:\n history[translated_pi][1] = True\n\nac_count = 0\npenalty_count = 0\nfor result in history.values():\n if result[1]:\n ac_count += 1\n penalty_count += result[0]\n\nprint("{} {}".format(ac_count, penalty_count))']
['Runtime Error', 'Accepted']
['s937417894', 's126430309']
[9080.0, 23204.0]
[27.0, 324.0]
[56, 510]
p02802
u329399746
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['num, all_ans = [int(i) for i in input().split(" ")]\nd_wa = [0 for _ in range(num)]\nd_ac = [0 for _ in range(num)]\n\nfor i in range(all_ans):\n ans_num, ac_wa = [i for i in input().split(" ")]\n print(d_ac, d_wa)\n if d_ac[int(ans_num) - 1] == 1: continue\n if ac_wa == "AC": \n d_ac[int(ans_num) - 1] = 1\n continue\n if ac_wa == "WA":\n d_wa[int(ans_num) - 1] += 1\n continue\n\nprint(sum(d_ac),sum(d_wa))', 'num, all_ans = [int(i) for i in input().split(" ")]\nd_wa = [0 for _ in range(num)]\nd_ac = [0 for _ in range(num)]\nans = 0\n\nfor _ in range(all_ans):\n ans_num, ac_wa = [i for i in input().split(" ")]\n if d_ac[int(ans_num) - 1] == 1: continue\n if ac_wa == "AC": \n d_ac[int(ans_num) - 1] = 1\n continue\n if ac_wa == "WA":\n d_wa[int(ans_num) - 1] += 1\n continue\n\nfor num, i in enumerate(d_ac):\n if i:\n ans += d_wa[num]\n\nprint(sum(d_ac),ans)']
['Wrong Answer', 'Accepted']
['s293810810', 's414345355']
[107480.0, 4760.0]
[2104.0, 369.0]
[437, 483]
p02802
u329407311
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N.M = map(int,input().split())\n\nList = []\nans = [0 for i in range(N+1)]\nWA = [0 for i in range(N+1)]\n\nfor i in range(M):\n p,S = map,input().split()\n \n if ans[p] != 0:\n if S == "AC":\n ans[p] = 1\n else:\n WA[p] += 1\n \nA = sum(ans)\nW = sum(WA)\n\nprint(A,W)', 'N,M=map(int,input().split())\nList=[list(input().split()) for i in range(M)]\nAC = set([])\nWA = []\naccnt = 0\nwacnt = 0\n\nfor i in range(M):\n num = List[i][0]\n res = List[i][1]\n \n if num in AC:\n wacnt = wacnt + WA.count(num)\n else:\n if res == "AC":\n accnt = accnt + 1\n AC.add(num)\n if res == "WA":\n WA.append(num)\n \nans = [int(accnt),int(wacnt)]\nprint(*ans)\n', 'N,M = map(int,input().split())\n\nList = []\nans = [0 for i in range(N+1)]\nWA = [0 for i in range(N+1)]\n\nfor i in range(M):\n p,S = input().split()\n p = int(p)\n \n if ans[p] == 0:\n if S == "AC":\n ans[p] = 1\n else:\n WA[p] += 1\n \nA = sum(ans)\n\nW= 0\n\nfor i in range(N+1):\n W += ans[i] * WA[i]\n\nprint(A,W)\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s333478700', 's373094918', 's898849030']
[3064.0, 32140.0, 4760.0]
[18.0, 2105.0, 297.0]
[277, 384, 325]
p02802
u329565519
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["N, M = map(int, input().split())\n\nacs = set()\nwas = 0\nfor _ in range(M):\n p, S = input().split()\n p = int(p)\n if p not in acs:\n if S == 'AC':\n acs.add(p)\n wa = was\n was = 0\n else:\n was += 1\nprint(len(acs), wa)", "N, M = map(int, input().split())\n\nac = [0] * N\nwa = [0] * N\nbuff = [0] * N\nfor _ in range(M):\n p, S = input().split()\n p = int(p) - 1\n if ac[p] == 0:\n if S == 'AC':\n ac[p] = 1\n wa[p] = buff[p]\n else:\n buff[p] += 1\nprint(sum(ac), sum(wa))\n"]
['Runtime Error', 'Accepted']
['s497185157', 's936004750']
[11884.0, 5364.0]
[279.0, 283.0]
[276, 294]
p02802
u331360010
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nN,M = map(int,input().split())\nPS = (input().split() for _ in range(M))\n\nac = [False] * N\nwa_cnt = [0] * N\npenal = 0\nfor P,S in PS:\n p = int(P)-1\n if ac[p]:\n pass\n elif S == b'WA':\n wa_cnt[p] += 1\n else:\n ac[p] = True\n penal += wa_cnt[p]\n\nac = sum(ac)\nprint(ac, penal)", "import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nN,M = map(int,input().split())\nPS = (input().split() for _ in range(N))\n\nac = [False] * N\nwa_cnt = [0] * N\npenal = 0\nfor P,S in PS:\n p = int(P)-1\n if ac[p]:\n pass\n elif S == b'WA':\n wa_cnt[p] += 1\n else:\n ac[p] = True\n penal += wa_cnt[p]\n\nac = sum(ac)\nprint(ac, penal)", "import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nN,M = map(int,input().split())\nPS = (input().split() for _ in range(M))\n\nac = [False] * N\nwa_cnt = [0] * N\npenal = 0\nfor P,S in PS:\n p = int(P)-1\n if ac[p]:\n pass\n elif S == 'WA':\n wa_cnt[p] += 1\n else:\n ac[p] = True\n penal += wa_cnt[p]\n\nac = sum(ac)\nprint(ac, penal)"]
['Wrong Answer', 'Runtime Error', 'Accepted']
['s390525659', 's881438034', 's076360966']
[4596.0, 4596.0, 4596.0]
[292.0, 279.0, 292.0]
[425, 425, 424]
p02802
u332253305
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n,m=map(int,input().split())\nacf,waf=[0]*n,[0]*n\nac,wa=0,0\nfor i in range(m):\n x,y=input().split()\n x=int(x)\n if y=='AC':\n if acf[x]==0:\n ac+=1\n wa+=waf[x-1]\n acf[x-1]+=1\n else:\n waf[x-1]+=1\nprint(ac,wa)\n", "n,m=map(int,input().split())\nacf,waf=[0]*n,[0]*n\nac,wa=0,0\nfor i in range(m):\n x,y=input().split()\n x=int(x)\n if y=='AC':\n if acf[x-1]==0:\n ac+=1\n wa+=waf[x-1]\n acf[x-1]+=1\n else:\n waf[x-1]+=1\nprint(ac,wa)\n"]
['Runtime Error', 'Accepted']
['s969079852', 's588172849']
[4596.0, 4596.0]
[269.0, 286.0]
[263, 265]
p02802
u333700164
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N,M=map(int,input().split())\nac=[0]*N\nwa=[0]*N\n\nfor i in range(M):\n p,s=input().split()\n if s=="WA" and ac(int(p)-1)==0:\n wa[int(p)-1]+=1\n elif s=="AC" and ac(int(p)-1)==0:\n ac[int(p)-1]+=1\n\npenalty=[w(k) for k in [i for i,j in enumerate(ac) if j!=0]] \nprint("%d %d" %())', 'N,M=map(int,input().split())\nac=[0]*N\nwa=[0]*N\n\nfor i in range(M):\n p,s=input().split()\n if s=="WA" and ac(int(p)-1)==0:\n wa[int(p)-1]+=1\n elif s=="AC" and ac(int(p)-1)==0:\n ac[int(p)-1]+=1\n\npenalty=[w(k) for k in [i for i,j in enumerate(ac) if j!=0]] \nprint("%d %d" %(sum(ac),sum(penalty)))\n', 'def f(S,start_num,j):\n start=start_num[j-1]\n s=0\n for i in range(0,strat_num[j]-start_num[j-1]):\n if S[start+i]=="WA":\n s=s+1\n continue\n else:\n break\nreturn s\n\nN,M=map(int,input().split())\nP_str=[0]*M\nS=[0]*M\nfor i in range(M):\n P_str[i],S[i]=map(str,input().split())\nP=[int(P_str[j]) for j in range(M)]\n\nstart_num=[0]*N\nstart_num[0]=1\nfor i in range(1,M):\n if not P[i-1]==P[i]:\n i=start_num[P[i]-1]\n\ncorrect=0\nfor j in range(1,N+1):\n if f(S,start_num,j)<(start_num[j]-start_num[j-1]):\n correct+=1\npenalty=0\nfor j in range(1,N+1):\n penalty+=f(S,start_num,j)\n\nprint(correct,"",penalty)', 'N,M=map(int,input().split())\nwa=[0]*N\nac=[0]*N\n\nfor i in range(M):\n p,s=map(int,input().split())\n if s=="WA" and ac[p-1]==0:\n wa[p-1]+=1\n if s=="AC" and ac[p-1]==0:\n ac[p-1]+=1\n\npenalty=[wa[j] for j,k in enumerate(ac) if not K==0]\nprint("%d %d" %(sum(ac),sum()))', 'def f(S,start_num,j):\n start=start_num[j-1]\n s=0\n for i in range(0,strat_num[j]-start_num[j-1]):\n if S[start+i]=="WA":\n s=s+1\n continue\n else:\n break\nreturn s\n\nN,M=map(int,input().split())\nP_str=[0]*M\nS=[0]*M\nfor i in range(M):\n P_str[i],S[i]=map(str,input().split())\nP=[int(P_str[j]) for j in range(M)]\n\nstart_num=[0]*N\nstart_num[0]=0\nfor i in range(1,M):\n if not P[i-1]==P[i]:\n i=start_num[P[i]-1]\n\ncorrect=0\nfor j in range(1,N+1):\n if f(S,start_num,j)<(start_num[j]-start_num[j-1]):\n correct+=1\n\npenalty=0\nfor j in range(1,N+1):\n penalty+=f(S,start_num,j)\n\nprint(correct,"",penalty)\n', 'N,M=map(int,input().split())\nac=[0]*N\nwa=[0]*N\n\nfor i in range(M):\n p,s=input().split()\n if s=="WA" and ac[int(p)-1]==0:\n wa[int(p)-1]+=1\n elif s=="AC" and ac[int(p)-1]==0:\n ac[int(p)-1]+=1\n\npenalty=[w(k) for k in [i for i,j in enumerate(ac) if j!=0]] \nprint("%d %d" %())\n', 'N,M=map(int,input().split())\nac=[0]*N\nwa=[0]*N\n\nfor i in range(M):\n p,s=input().split()\n if s=="WA" and ac[int(p)-1]==0:\n wa[int(p)-1]+=1\n elif s=="AC" and ac[int(p)-1]==0:\n ac[int(p)-1]+=1\n\npenalty=[w[k] for k in [i for i,j in enumerate(ac) if j!=0]] \nprint("%d %d" %(sum(ac),sum(penalty)))\n', 'N,M=map(int,input().split())\nac=[0]*N\nwa=[0]*N\n\nfor i in range(M):\n p,s=input().split()\n if s=="WA" and ac[int(p)-1]==0:\n wa[int(p)-1]+=1\n elif s=="AC" and ac[int(p)-1]==0:\n ac[int(p)-1]+=1\n\npenalty=[w[k] for k in [i for i,j in enumerate(ac) if j!=0]] \nprint("%d %d" % (sum(ac),sum(penalty)))\n', 'N,M=map(int,input().split())\nac=[0]*N\nwa=[0]*N\n\nfor i in range(M):\n p,s=input().split()\n if s=="WA" and ac[int(p)-1]==0:\n wa[int(p)-1]+=1\n elif s=="AC" and ac[int(p)-1]==0:\n ac[int(p)-1]+=1\n\npenalty=[wa[k] for k in [i for i,j in enumerate(ac) if j!=0]] \nprint("%d %d" % (sum(ac),sum(penalty)))\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s153116175', 's205837928', 's244741850', 's506631227', 's543459739', 's550463135', 's837400031', 's982451505', 's671830837']
[4596.0, 4596.0, 3064.0, 4596.0, 3064.0, 8600.0, 8624.0, 8600.0, 9368.0]
[20.0, 19.0, 17.0, 19.0, 18.0, 291.0, 298.0, 312.0, 306.0]
[283, 304, 622, 271, 624, 284, 304, 305, 306]
p02802
u336564899
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N ,M = map(int, input().split())\nps = [list(input().split()) for i in range(M)]\n\nac = [0 for i in range(N)]\nwa = [0 for i in range(N)]\n\nfor i in range(M):\n s = int(ps[i][0])-1\n if ps[i][1] == "WA" and ac[s] == 0:\n wa[s] += 1\n\n if ps[i][1] == "AC" and ac[s] == 0:\n ac[s] = 1\n\nfor i in range(M):\n if ac[i] == 0:\n wa[i] == 0\n\nprint(str(sum(ac)) + " " + str(sum(wa)))\n', 'N ,M = map(int, input().split())\nps = [list(input().split()) for i in range(M)]\n\nac = [0 for i in range(N)]\nwa = [0 for i in range(N)]\n\nfor i in range(M):\n s = int(ps[i][0])-1\n if ps[i][1] == "WA" and ac[s] == 0:\n wa[s] += 1\n\n if ps[i][1] == "AC" and ac[s] == 0:\n ac[s] = 1\n\nfor i in range(M):\n if ac[i] == 0:\n wa[i] = 0\n\nprint(str(sum(ac)) + " " + str(sum(wa)))\n', 'N ,M = map(int, input().split())\nps = [list(input().split()) for i in range(M)]\n\nac = [0 for i in range(N)]\nwa = [0 for i in range(N)]\n\nfor i in range(M):\n s = int(ps[i][0])-1\n if ps[i][1] == "WA" and ac[s] == 0:\n wa[s] += 1\n\n if ps[i][1] == "AC" and ac[s] == 0:\n ac[s] = 1\n\nfor i in range(N):\n if ac[i] == 0:\n wa[i] = 0\n\nprint(str(sum(ac)) + " " + str(sum(wa)))\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s110691202', 's669281943', 's554410415']
[27636.0, 27640.0, 29576.0]
[320.0, 298.0, 321.0]
[397, 396, 396]
p02802
u337626942
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N, M=map(int, input().split())\nac=[0]*N\nwa=[0]*N\n\nfor i in range(M):\n p, S=input().split()\n p=int(p)\n if ac[p-1]==0:\n if S=="AC":\n ac[p-1]=1\n elif S=="WA":\n wa[p-1]+=1\n elif ac[p-1]>=1:\n ac[p-1]=1\n if S=="WA":\n wa[p-1]+=1\n\nprint(sum(ac), sum(wa))', 'N, M=map(int, input().split())\nac=[0]*N\nwa=[0]*N\n\nfor i in range(M):\n p, S=input().split()\n p=int(p)\n if ac[p-1]==0:\n if S=="AC":\n ac[p-1]=1\n elif S=="WA":\n wa[p-1]+=1\n \nwacnt=0\nfor i in range(N):\n\tif ac[i]>=1:\n wacnt+=wa[i]\n\t\t\nprint(sum(ac), wacnt)', 'N, M=map(int, input().split())\nac=[0]*N\nwa=[0]*N\n\nfor i in range(M):\n p, S=input().split()\n p=int(p)\n if ac[p-1]==0:\n if S=="AC":\n ac[p-1]=1\n elif S=="WA":\n wa[p-1]+=1\n \nwacnt=0\nfor i in range(N):\n\tif ac[i]>=1:\n\t\twacnt+=wa[i]\n\t\t\nprint(sum(ac), wacnt)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s089425023', 's897117391', 's669755762']
[4596.0, 2940.0, 4596.0]
[275.0, 17.0, 286.0]
[319, 310, 306]
p02802
u339503988
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n, m = map(int, input().split())\n\n\nc = 0\na = 0\n\nt = [0]*(n+1)\n\ntemp = []\n\n\nfor i in range(m):\n s = input().split()\n x = s[0]\n y = s[1]\n if y == 'AC' x not in temp:\n a += 1\n c += t[int(x)]\n temp += [x]\n elif y == 'WA':\n t[int(x)] += 1\n\nprint(a, c)\n", 'n, m = map(int, input().split())\n\na = [0] * (n+1)\nb = [0] * (n+1)\n\nc = 0\n\nfor i in [0]*(m):\n\n s = input().split()\n\n if a[int(s[0])] == 0:\n if s[1] == "AC":\n a[int(s[0])] = 1\n c += b[int(s[0])]\n else:\n b[int(s[0])] += 1\n\nprint(sum(a), c)\n']
['Runtime Error', 'Accepted']
['s975753649', 's170977788']
[2940.0, 5364.0]
[17.0, 275.0]
[290, 290]
p02802
u342563578
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n, m = map(int,input().split())\nq = [0 for i in range(n)]\nalist = []\nac = 0\npe = 0\nbe = be\nfor i in range(m):\n a,b=input().split()\n alist.append((int(a), b))\nfor i in range(m):\n if q[alist[i][0]-1] == 0:\n if alist[i][1] == 'AC':\n ac += 1\n be = be + pe\n q[alist[i][0]-1] = 1\n else:\n pe += 1\n else:\n continue\nprint(ac,be)", "n, m = map(int,input().split())\nq = [0 for i in range(n)]\nalist = []\nac = 0\npe = [0 for i in range(n)]\nbe = 0\nfor i in range(m):\n a,b=input().split()\n alist.append((int(a), b))\nfor i in range(m):\n if q[alist[i][0]-1] == 0:\n if alist[i][1] == 'AC':\n ac += 1\n be = be + pe[alist[i][0]-1]\n q[alist[i][0]-1] = 1\n else:\n pe[alist[i][0]-1] += 1\n else:\n continue\nprint(ac,be)"]
['Runtime Error', 'Accepted']
['s530411543', 's698625191']
[3888.0, 20576.0]
[22.0, 333.0]
[396, 446]
p02802
u343977188
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n,m=map(int,input().split())\nj=[0]*n \nc=[0]*n \nprint(j)\nprint(c)\npe=0\nac=0\nfor i in range(m):\n p,s=input().split()\n p=int(p)-1\n if s[0]=="A" and j[p]==0:\n \n j[p]=1\n ac+=1\n pe+=c[p]\n elif s[0]=="W":c[p]+=1\nprint(ac,pe)', 'n,m=map(int,input().split())\nj=[0]*n \nc=[0]*n \npe=0\nac=0\nfor i in range(m):\n p,s=input().split()\n p=int(p)-1\n if s[0]=="A" and j[p]==0:\n \n j[p]=1\n ac+=1\n pe+=c[p]\n elif s[0]=="W":c[p]+=1\nprint(ac,pe)']
['Wrong Answer', 'Accepted']
['s758482325', 's478988689']
[6060.0, 4596.0]
[286.0, 273.0]
[571, 553]
p02802
u344888046
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N, M = map(int, input().split())\np = []\nS = []\nfor _ in range(M):\n a, b = input().split()\n p.append(int(a))\n S.append(b)\n\nans = [[] for i in range(N)]\nWA, AC = 0, 0\nfor p, S in zip(p, S):\n if ans[p - 1].count("AC") != 0:\n pass\n else:\n ans[p - 1].append(S)\n if S == "WA":\n WA += 1\n if S == "AC"\n AC += 1\n\nprint(AC, WA)', 'N, M = map(int, input().split())\nQ = [list(map(str, input().split())) for _ in range(M)]\n\nans = [0] * N\nAC = 0\nWA = 0\n\nfor P in Q:\n p = int(P[0])\n S = P[1]\n if ans[p - 1] == "END":\n continue\n if S == "WA":\n ans[p - 1] += 1\n if S == "AC":\n WA += ans[p - 1]\n AC += 1\n ans[p - 1] = "END"\n\n\nprint(AC, WA)\n']
['Runtime Error', 'Accepted']
['s060090678', 's411687593']
[8972.0, 33920.0]
[26.0, 283.0]
[382, 351]
p02802
u353099601
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["N, M = map(int, input().split())\nac = []\nwa = 0\n\nfor _ in range(M):\n p_str, s = map(str, input().split())\n p = int(p_str)\n if p in ac:\n continue\n if s == 'AC':\n ac.append(p)\n p.sort\n if s == 'WA':\n wa += 1\n\nprint(len(ac), wa)\n", "N, M = map(int, input().split())\nac = [0] * N\nwa = [0] * N\n\nfor _ in range(M):\n p_str, s = map(str, input().split())\n p = int(p_str)\n if ac[p-1] == 1:\n continue\n if s == 'AC':\n ac[p-1] = 1\n if s == 'WA':\n wa[p-1] += 1\n\nresult = [x * y for (x, y) in zip(ac, wa)]\nAC = sum(ac)\nWA = sum(result)\n\nprint(AC, WA)\n"]
['Runtime Error', 'Accepted']
['s294990071', 's807937729']
[3060.0, 5528.0]
[324.0, 357.0]
[243, 321]
p02802
u358957649
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['def main(n,m,r):\n ac = [0]*n\n wa = [0]*n\n for i in range(len(r)):\n if r[i][1] == "WA":\n if ac[int(r[i][0])] != 0:\n wa[int(r[i][0])] += 1\n elif r[i][1] == "AC":\n ac[int(r[i][0])] = 1\n acsum = sum(ac)\n wasum = sum(wa)\n return "{0} {1}".format(acsum, wasum)\n\nn,m = map(int, input().split())\nr = list(input().split() for _ in range(m))\nprint(main(n,m,r))', 'def main(n,m,r):\n ac = [0]*n\n wa = [0]*n\n for i in range(len(r)):\n seq = int(r[i][0])\n judge = r[i][1]\n if ac[seq-1] == 1:\n continue\n if judge == "WA":\n wa[seq-1] += 1\n else:\n ac[seq-1] = 1\n for i in range(len(ac)):\n if ac[i] == 0:\n wa[i] = 0\n return "{0} {1}".format(sum(ac), sum(wa))\n\nn,m = map(int, input().split())\nr = list(input().split() for _ in range(m))\nprint(main(n,m,r))']
['Runtime Error', 'Accepted']
['s037405679', 's531487517']
[33684.0, 33684.0]
[261.0, 276.0]
[419, 482]
p02802
u361381049
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n, m = map(int,input().split())\np = [0] * m\ns = [0] * m\nfor i in range(m):\n p[i], s[i] = map(str, input().split())\nfor i in range(m):\n p[i] = int(p[i])\n\nans1 = 0\nans2 = 0\n\naclis = [0] * (n+1)\nwalis = [0] * (n+1)\n\n\nfor i in range(m):\n if s[i] == 'AC':\n aclis[p[i]] = 1\n\n\n elif aclis[p[i]] == 0 and s[i] == 'WA':\n walis[p[i]] += 1\nans1 = aclis.count(1)\n\nfor i in range(n):\n if aclis[i] == 1:\n ans2 += walis[i]\n\nprint(ans1, ans2)", "n,m = map(int,input().split())\nif m == 0:\n print(0, 0)\nelse:\n p = [0] * m\n s = [0] * m\n for i in range(m):\n p[i], s[i] = map(str, input().split())\n for i in range(m):\n p[i] = int(p[i])\n p.append(int(ie9))\n\n probcnt = p[0]\n ACval = False\n ACcnt = 0\n wa = 0\n pena = 0\n for i in range(m):\n if probcnt == p[i]:\n if ACval == False:\n if s[i] == 'WA':\n wa += 1\n if p[i] !=p[i+1]:\n wa = 0\n else:\n ACval = True\n ACcnt += 1\n pena += wa\n wa = 0\n\n else:\n ACval = False\n probcnt = p[i]\n if ACval == False:\n if s[i] == 'WA':\n wa += 1\n if p[i] !=p[i+1]:\n wa = 0\n else:\n ACval = True\n ACcnt += 1\n pena += wa\n\n\n print(ACcnt, pena)", "n,m = map(int,input().split())\np = [0] * m\ns = [0] * m\nfor i in range(m):\n p[i], s[i] = map(str, input().split())\nfor i in range(m):\n p[i] = int(p[i])\n\nprobcnt = 1\nACval = False\nACcnt\nwa = 0\nfor i in range(m):\n if probcnt == p[i]:\n if ACval == False:\n if s[i] == 'WA':\n wa += 1\n else:\n ACval = True\n ACcnt += 1\n else:\n ACval = False\n probcnt += 1\n if ACval == False:\n if s[i] == 'WA':\n wa += 1\n else:\n ACval = True\n ACcnt += 1\n\nprint(ACcnt, wa)", "n,m = map(int,input().split())\nif m == 0:\n print(0, 0)\nelse:\n p = [0] * m\n s = [0] * m\n for i in range(m):\n p[i], s[i] = map(str, input().split())\n for i in range(m):\n p[i] = int(p[i])\n\n probcnt = p[0]\n ACval = False\n ACcnt = 0\n wa = 0\n pena = 0\n for i in range(m):\n if probcnt == p[i]:\n if ACval == False:\n if s[i] == 'WA':\n wa += 1\n else:\n ACval = True\n ACcnt += 1\n pena += wa\n wa = 0\n else:\n ACval = False\n probcnt = p[i]\n if ACval == False:\n if s[i] == 'WA':\n wa += 1\n else:\n ACval = True\n ACcnt += 1\n pena += wa\n wa = 0\n\n print(ACcnt, pena)\n", "n,m = map(int,input().split())\nif m == 0:\n print(0, 0)\nelse:\n p = [0] * m\n s = [0] * m\n for i in range(m):\n p[i], s[i] = map(str, input().split())\n for i in range(m):\n p[i] = int(p[i])\n\n probcnt = p[0]\n ACval = False\n ACcnt = 0\n wa = 0\n pena = 0\n for i in range(m):\n if probcnt == p[i]:\n if ACval == False:\n if s[i] == 'WA':\n wa += 1\n else:\n ACval = True\n ACcnt += 1\n pena += wa\n wa = 0\n else:\n ACval = False\n probcnt = p[i]\n if ACval == False:\n if s[i] == 'WA':\n wa += 1\n else:\n ACval = True\n ACcnt += 1\n pena += wa\n wa = 0\n\n print(ACcnt, pena)\n", "n, m = map(int,input().split())\np = [0] * m\ns = [0] * m\nfor i in range(m):\n p[i], s[i] = map(str, input().split())\nfor i in range(m):\n p[i] = int(p[i])\n\nans1 = 0\nans2 = 0\n\naclis = [0] * n\nwalis = [0] * n\nac = 1s\n\n\nfor i in range(m):\n if s[i] == 'AC':\n aclis[p[i]] = True\n \n\n if aclis[p[i]] == 0:\n walis[p[i]] += 1\nans1 = aclis.count('True')\n\nfor i in range(n):\n if aclis[i] == True:\n ans2 += walis[i]\n\nprint(ans1, ans2)", "n,m = map(int,input().split())\nif m == 0:\n print(0, 0)\nelse:\n p = [0] * m\n s = [0] * m\n for i in range(m):\n p[i], s[i] = map(str, input().split())\n for i in range(m):\n p[i] = int(p[i])\n\n probcnt = p[0]\n ACval = False\n ACcnt = 0\n wa = 0\n pena = 0\n for i in range(m):\n if probcnt == p[i]:\n if ACval == False:\n if s[i] == 'WA':\n wa += 1\n else:\n ACval = True\n ACcnt += 1\n pena += wa\n wa = 0\n else:\n ACval = False\n probcnt = p[i]\n if ACval == False:\n if s[i] == 'WA':\n wa += 1\n else:\n ACval = True\n ACcnt += 1\n pena += wa\n wa = 0\n\n print(ACcnt, pena)", "n,m = map(int,input().split())\nif m == 0:\n print(0, 0)\nelse:\n p = [0] * m\n s = [0] * m\n for i in range(m):\n p[i], s[i] = map(str, input().split())\n for i in range(m):\n p[i] = int(p[i])\n\n probcnt = p[0]\n ACval = False\n ACcnt = 0\n wa = 0\n pena = 0\n for i in range(m):\n if probcnt == p[i]:\n if ACval == False:\n if s[i] == 'WA':\n wa += 1\n else:\n ACval = True\n ACcnt += 1\n pena += wa\n \n else:\n ACval = False\n probcnt = p[i]\n if ACval == False:\n if s[i] == 'WA':\n wa += 1\n else:\n ACval = True\n ACcnt += 1\n pena += wa\n wa = 0\n\n print(ACcnt, pena)", "n, m = map(int,input())\np = [0] * m\ns = [0] * m\nfor i in range(m):\n p[i], s[i] = map(str, input().split())\nfor i in range(m):\n p[i] = int(p[i])\n\nans1 = 0\nans2 = 0\n\naclis = [0] * n\nwalis = [0] * n\n\n\n\nfor i in range(m):\n if s[i] == 'AC':\n aclis[p[i]] = True\n ac += 1\n\n if aclis[p[i]] == 0:\n walis[p[i]] += 1\nans1 = aclis.count('True')\n\nfor i in range(n):\n if aclis[i] == True:\n ans2 += walis[i]\n\nprint(ans1, ans2)", "n, m = map(int,input().split())\np = [0] * m\ns = [0] * m\nfor i in range(m):\n p[i], s[i] = map(str, input().split())\nfor i in range(m):\n p[i] = int(p[i])\n\nans1 = 0\nans2 = 0\n\naclis = [0] * (n+1)\nwalis = [0] * (n+1)\n\n\nfor i in range(m):\n if s[i] == 'AC':\n aclis[p[i]] = 1\n\n\n\n elif aclis[p[i]] == 0 and s[i] == 'WA':\n walis[p[i]] += 1\nans1 = aclis.count(1)\n#print(aclis)\n#print(walis)\n\nfor i in range(n+1):\n if aclis[i] == 1:\n ans2 += walis[i]\n\n\nprint(ans1, ans2)"]
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s090709849', 's197775857', 's294811151', 's407832021', 's446659905', 's570584080', 's687969425', 's759767558', 's894544031', 's969000290']
[20432.0, 18888.0, 18896.0, 18888.0, 3064.0, 3064.0, 18888.0, 18892.0, 3064.0, 20432.0]
[345.0, 288.0, 289.0, 344.0, 17.0, 17.0, 338.0, 345.0, 17.0, 337.0]
[462, 1039, 618, 888, 880, 462, 895, 873, 454, 494]
p02802
u362771726
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N, M = map(int, input().split())\nPS = [input().split() for _ in range(M)]\n\nAC = [False] * (N+1)\nWA_cnt = [0] * (N+1)\nans = 0\npena = 0\n\nprint(PS)\n\nfor p, s in PS:\n p = int(p)\n if AC[p]:\n continue\n elif s == "WA":\n WA_cnt[p] += 1\n \n elif s == "AC":\n ans += 1\n pena += WA_cnt[p]\n AC[p] = True\n\nprint(ans, pena, sep=\' \')', 'N, M = map(int, input().split())\nPS = [input().split() for _ in range(M)]\n\nAC = [False] * (N+1)\nans = 0\ntmp_pena = 0\npena = 0\n\nprint(PS)\n\nfor p, s in PS:\n p = int(p)\n if AC[p]:\n continue\n elif s == "WA":\n tmp_pena += 1\n elif s == "AC":\n ans += 1\n pena = tmp_pena\n AC[p] = True\n\nprint(ans, pena, sep=\' \')', 'N, M = map(int, input().split())\nPS = [input().split() for _ in range(M)]\n\nAC = [False] * (N+1)\nans = 0\ntmp_pena = 0\npena = 0\n\nprint(PS)\n\nfor p, s in PS:\n p = int(p)\n if AC[p]:\n continue\n elif s == "WA":\n tmp_pena += 1\n \n elif s == "AC":\n ans += 1\n pena += tmp_pena\n AC[p] = True\n\nprint(ans, pena, sep=\' \')', 'N, M = map(int, input().split())\nPS = [input().split() for _ in range(M)]\n\nAC = [False] * (N+1)\nWA_cnt = [0] * (N+1)\nans = 0\npena = 0\n\nfor p, s in PS:\n p = int(p)\n if AC[p]:\n continue\n elif s == "WA":\n WA_cnt[p] += 1\n \n elif s == "AC":\n ans += 1\n pena += WA_cnt[p]\n AC[p] = True\n\nprint(ans, pena, sep=\' \')']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s628818404', 's868662024', 's873979291', 's351167987']
[38684.0, 37908.0, 37908.0, 33696.0]
[322.0, 292.0, 308.0, 260.0]
[468, 350, 458, 457]
p02802
u366185462
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n, m = map(int, input().split())\np, s = [], []\npslist = []\nfor i in range(m):\n row = list(input().split( ))\n pslist.append(row)\naclist = [0] * n\nwalist = [0] * n\nfor j, k in pslist:\n j = int(j)\n if k == 'AC':\n if aclist[j - 1] == 0:\n aclist[j - 1] = 1\n if k == 'WA':\n if aclist[j - 1] == 0:\n walist[j - 1] += 1", "n, m = map(int, input().split())\np, s = [], []\npslist = []\nfor i in range(m):\n row = list(input().split( ))\n pslist.append(row)\naclist = [0] * n\nwalist = [0] * n\nfor j, k in pslist:\n j = int(j)\n if k == 'AC':\n if aclist[j - 1] == 0:\n aclist[j - 1] = 1\n if k == 'WA':\n if aclist[j - 1] == 0:\n walist[j - 1] += 1\nwacountlist = [x * y for (x, y) in zip(aclist, walist)]\nprint(sum(aclist), sum(wacountlist))"]
['Wrong Answer', 'Accepted']
['s597849576', 's117476772']
[27456.0, 28332.0]
[309.0, 309.0]
[331, 424]
p02802
u368579103
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n,m=list(map(int,input().split()))\nac,wa=0,0\naclis=[0]*n\nwalis=[0]*n\n\nfor i in range(m):\n p,s=input().split()\n p = int(p) \n if s == "AC" and aclis[p-1] == 0:\n aclis[p-1] = 1\n ac += 1\n wa += wa[p-1]\n elif s == "WA" and aclis[p-1] == 0:\n wa[p-1] += 1\nprint(ac,wa)', 'n,m=list(map(int,input().split()))\nac,wa=0,0\naclis=[0]*n\nwalis=[0]*n\n\nfor i in range(m):\n p,s=input().split()\n p = int(p) \n if s == "AC" and aclis[p-1] == 0:\n aclis[p-1] = 1\n ac += 1\n wa += walis[p-1]\n elif s == "WA" and aclis[p-1] == 0:\n walis[p-1] += 1\nprint(ac,wa)']
['Runtime Error', 'Accepted']
['s723788147', 's846878637']
[4596.0, 4596.0]
[19.0, 296.0]
[278, 284]
p02802
u373047809
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['d = [0]*10**5\n\na = set()\nw = 0\n\nfor t in open(0):\n p, s = t.split\n p = int(p)\n if "AC" == s and p not in a:\n w += d[p]\n a.add(p)\n if "WA" == s:\n d[p] += 1\n\nprint(len(a), w)', 'd = [0]*10**5\n\na = set()\nw = 0\n\nfor t in open(0):\n p, s = t.split()\n p = int(p)\n if "AC" == s and p not in a:\n w += d[p]\n a.add(p)\n if "WA" == s:\n d[p] += 1\n\nprint(len(a), w)']
['Runtime Error', 'Accepted']
['s935966443', 's806398531']
[3828.0, 12652.0]
[18.0, 138.0]
[205, 207]
p02802
u374802266
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n,m=map(int,input().split())\nw,l=0,[0]*n\nfor i in range(m):\n p,s=input().split()\n p,f=int(p)-1,l[p]>=0\n if s=='AC':\n w+=l[p]*f\n l[p]=-1\n else:\n l[p]+=f\nprint(l.count(-1),w)", "n,m=map(int,input().split())\nw,l=0,[0]*n\nfor i in range(m):\n p,s=input().split()\n p=int(p)-1\n if s=='AC':\n w+=l[p]*(l[p]>=0)\n l[p]=-1\n else:\n l[p]+=(l[p]>=0)\nprint(l.count(-1),w)"]
['Runtime Error', 'Accepted']
['s882199278', 's591517657']
[3828.0, 3828.0]
[18.0, 275.0]
[205, 211]
p02802
u375477204
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N, M = map(int, input().split())\np_S = []\nfor i in range(0,M):\n a, b = input().split()\n a = int(a)\n p_S.append([a,b])\ns, t = 0, 0\nres = []\nfor i in range(0,N):\n res.append([i,0])\nfor i in range(0,M):\n if p_S[i][1] == "WA":\n res[p_S[i][0]][1] = res[p_S[i][0]][1]+1\n elif res[p_S[i][0]][1] >= 0:\n s, t = s+1, t+res[p_S[i][0]][1]\n res[p_S[i][0]][1] = -1\nprint(s, t)', 'N, M = map(int, input().split())\np, S = [0]*M, [0]*M\nfor i in range(0,M):\n p[i], S[i] = input().split()\n p[i] = int(p[i])\ns, t = 0, 0\nres = []\nfor i in range(0,N):\n res.append([i,0])\nfor i in range(0,M):\n if S[i] == "WA":\n res[p[i]-1][1] = res[p[i]-1][1]+1\n elif res[p[i]-1][0] != -1:\n s, t = s+1, t+res[p[i]-1][1]\n res[p[i]-1][0] = -1\nprint(s, t)']
['Runtime Error', 'Accepted']
['s262035849', 's478595857']
[35344.0, 26612.0]
[409.0, 346.0]
[401, 383]
p02802
u375616706
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['\nfrom collection import defaultdict\nN, M = map(int, input().split())\n\naced = [False]*N\nD = defaultdict(int)\nac = 0\npena = 0\nfor _ in range(M):\n id, judge = input().split()\n id = int(id)-1\n if judge == "WA":\n D[id] += 1\n else:\n if not aced[id]:\n aced[id] = True\n ac += 1\n pena += D[id]\nprint(ac, pena)\n', 'from collections import defaultdict\nN, M = map(int, input().split())\n\naced = [False]*N\nD = defaultdict(int)\nac = 0\npena = 0\nfor _ in range(M):\n id, judge = input().split()\n id = int(id)-1\n if judge == "WA":\n D[id] += 1\n else:\n if not aced[id]:\n aced[id] = True\n ac += 1\n pena += D[id]\nprint(ac, pena)\n']
['Runtime Error', 'Accepted']
['s735263905', 's705237825']
[3060.0, 16216.0]
[17.0, 311.0]
[360, 360]
p02802
u375695365
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['\na,b=map(int,input().split())\n\nc=[]\nfor i in range(b):\n d,e=map(str,input().split())\n c.append([int(d),e])\n\nacans=0\nwaans=0\nac=[0]*(a+1)\nwa=[0]*(a+1)\nfor i in range(b):\n if c[i][1]=="AC":\n if ac[c[i][0]-1]==0:\n acans+=1\n ac[c[i][0]-1]+=1\n waans+=wa[c[i][0]-1]\n else:\n wa[c[i][0]-1]+=1\nprint(ac)\n#print(wa)\nprint(acans,waans)', '\na,b=map(int,input().split())\n\nc=[]\nfor i in range(b):\n d,e=map(str,input().split())\n c.append([int(d),e])\n\nacans=0\nwaans=0\nac=[0]*(a+1)\nwa=[0]*(a+1)\nfor i in range(b):\n if c[i][1]=="AC":\n if ac[c[i][0]-1]==0:\n acans+=1\n ac[c[i][0]-1]+=1\n waans+=wa[c[i][0]-1]\n else:\n wa[c[i][0]-1]+=1\n#print(ac)\n#print(wa)\nprint(acans,waans)']
['Wrong Answer', 'Accepted']
['s004476597', 's257998478']
[24400.0, 23528.0]
[446.0, 392.0]
[383, 384]
p02802
u380669795
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n, m = map(int, input().split())\n\nac = [0]*n\nwa = [0]*n\n\nfor i in range(m):\n p, s = input().split()\n p = int(p)-1\n\n if s == 'WA' and ac[p] == 0:\n wa[p] += 1\n elif s == 'AC' and ac[p] == 0:\n ac[p] += 1\n\nprint('%d %d' % (sum(ac), sum(wa[k] for k in [i for i,j in enumerete(ac) if j != 0])))", "n, m = map(int, input().split())\n\nac = [0]*n\nwa = [0]*n\n\nfor i in range(m):\n p, s = input().split()\n p = int(p)-1\n\n if s == 'WA' and ac[p] == 0:\n wa[p] += 1\n elif s == 'AC' and ac[p] == 0:\n ac[p] += 1\n\nprint(sum(ac), sum(wa[k] for k in [i for i,j in enumerete(ac) if j != 0]))", "n, m = map(int, input().split())\n\nac = [0]*n\nwa = [0]*n\n\nfor i in range(m):\n p, s = input().split()\n\n if s == 'WA' and ac[int(p)-1] == 0:\n wa[int(p)-1] += 1\n elif s == 'AC' and ac[int(p)-1] == 0:\n ac[int(p)-1] += 1\n\nprint('%d %d' % (sum(ac), sum([wa[k] for k in [i for i,j in enumerete(ac) if j != 0]])))", "n, m = map(int, input().split())\n\nac = [0]*n\nwa = [0]*n\n\nfor i in range(m):\n p, s = input().split()\n\n if s == 'WA' and ac[int(p)-1] == 0:\n wa[int(p)-1] += 1\n elif s == 'AC' and ac[int(p)-1] == 0:\n ac[int(p)-1] += 1\n\nprint('%d %d' % (sum(ac), sum([wa[k] for k in [i for i,j in enumerete(ac) if j != 0]])))", "n, m = map(int, input().split())\n\nac = [0]*n\nwa = [0]*n\n\nfor i in range(m):\n p, s = input().split()\n p = int(p)-1\n\n if s == 'WA' and ac[p] == 0:\n wa[p] += 1\n elif s == 'AC' and ac[p] == 0:\n ac[p] += 1\n\nprint('%d %d' % (sum(ac), sum([wa[k] for k in [i for i,j in enumerete(ac) if j != 0]])))", "n, m = map(int, input().split())\n\nac = [0]*n\nwa = [0]*n\n\nfor i in range(m):\n p, s = input().split()\n\n if s == 'WA' and ac[int(p)-1] == 0:\n wa[int(p)-1] += 1\n elif s == 'AC' and ac[int(p)-1] == 0:\n ac[int(p)-1] += 1\n\nprint('%d %d' % (sum(ac), sum([wa[k] for k in [i for i,j in enumerete(ac) if j != 0]])))", "n, m = map(int, input().split())\n\nac = [0]*n\nwa = [0]*n\n\nfor i in range(m):\n p, s = input().split()\n\n if s == 'WA' and ac[int(p)-1] == 0:\n wa[int(p)-1] += 1\n elif s == 'AC' and ac[int(p)-1] == 0:\n ac[int(p)-1] += 1\n\nprint('%d %d' % (sum(ac), sum([wa[k] for k in [i for i, j in enumerate(ac) if j != 0]])))"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s056089866', 's210025268', 's522995303', 's540055820', 's785498341', 's848160698', 's299359913']
[4596.0, 4596.0, 4596.0, 4596.0, 4596.0, 4596.0, 9368.0]
[275.0, 284.0, 293.0, 294.0, 283.0, 298.0, 300.0]
[298, 286, 313, 327, 300, 335, 336]
p02802
u380933932
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['nm=list(map(int,input().split()))\nps=[]\nfor i in range(nm[1]):\n ps.append(list(input().split()))\n ps[-1][0]=int(ps[-1][0])\nac=[0]*nm[0]\nwa=0\nfor i in range(nm[1]):\n if ps[i][1]=="AC":\n if ac[ps[i][0]]==0:\n ac[ps[i][0]]=1\n else:\n pass\n else:\n if ac[ps[i][0]]==0:\n wa+=1\n else:\n pass\nprint(sum(ac),wa)\n', 'nm=list(map(int,input().split()))\nps=[]\nfor i in range(nm[1]):\n ps.append(list(input().split()))\n ps[-1][0]=int(ps[-1][0])\nac=[0]*nm[0]\nwa=[0]*nm[0]\nfor i in range(nm[1]):\n if ps[i][1]=="AC":\n if ac[ps[i][0]-1]==0:\n ac[ps[i][0]-1]=1\n else:\n pass\n else:\n if ac[ps[i][0]-1]==0:\n wa[ps[i][0]-1]+=1\n else:\n pass\nans=0\nfor i in range(nm[0]):\n if ac[i]==1:\n ans+=wa[i]\nprint(sum(ac),ans)\n']
['Runtime Error', 'Accepted']
['s005065994', 's950121458']
[24392.0, 25052.0]
[349.0, 356.0]
[384, 476]
p02802
u382639013
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N, M=map(int,input().split())\n \nans=[0]*N\npena=[0]*N\nAC=[0]*N\n \nfor i in range(M):\n p,s=input().split()\n p=int(p)\n if s=="WA":\n pena[p-1]+=1\n print(pena)\n else:\n if AC[p-1]==0:\n ans[p-1]+=pena[p-1]\n AC[p-1]=1\n print(AC)\n \nprint(AC.count(1),sum(ans))', 'N, M=map(int,input().split())\n \nans=[0]*N\npena=[0]*N\nAC=[0]*N\n \nfor i in range(M):\n p,s=input().split()\n p=int(p)\n if s=="WA":\n pena[p-1]+=1\n #print(pena)\n else:\n if AC[p-1]==0:\n ans[p-1]+=pena[p-1]\n AC[p-1]=1\n #print(AC)\n \nprint(AC.count(1),sum(ans))']
['Wrong Answer', 'Accepted']
['s170578554', 's136336357']
[108588.0, 5364.0]
[2104.0, 305.0]
[307, 309]
p02802
u383025592
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N, M = list(map(int, input().split()))\nAC = [0] * N\nWA = [0] * N\nfor i in range(M):\n p, S = input().split()\n p = int(p)\n if(S == "AC"):\n AC[p-1] = 1\n elif(AC[p] == 0):\n WA[p-1] += 1\nprint(sum(AC), sum(WA))', 'N, M = list(map(int, input().split()))\nAC = [0] * N\nWA = [0] * N\nfor i in range(M):\n p, S = input().split()\n p = int(p)\n if(S == "AC"):\n AC[p-1] = 1\n elif(AC[p-1] == 0):\n WA[p-1] += 1\nfor i in range(M):\n if(AC[i] == 0):\n WA[i] = 0\nprint(sum(AC), sum(WA))', 'N, M = list(map(int, input().split()))\nAC = [0] * N\nWA = [0] * N\nfor i in range(M):\n p, S = input().split()\n p = int(p)\n if(S == "AC"):\n AC[p] = 1\n elif(AC[p] == 0):\n WA[p] += 1\nprint(sum(AC), sum(WA))', 'N, M = list(map(int, input().split()))\nAC = [0] * N\nWA = [0] * N\nfor i in range(M):\n p, S = input().split()\n p = int(p)\n if(S == "AC"):\n AC[p-1] = 1\n elif(AC[p-1] == 0):\n WA[p-1] += 1\nfor i in range(N):\n if(AC[i] == 0):\n WA[i] = 0\nprint(sum(AC), sum(WA))']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s193678221', 's215949996', 's291449844', 's829678056']
[4596.0, 4596.0, 4596.0, 4596.0]
[273.0, 286.0, 264.0, 290.0]
[215, 268, 211, 268]
p02802
u386089355
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['ls_ac = [0] * n\nls_ng = [0] * n\nac = 0\nng = 0\n\n\nfor i in range(m):\n p = int(ls[i][0])\n if ls[i][1] == "AC":\n if ls_ac[p - 1] == 0:\n ac += 1\n ng += ls_ng[p - 1]\n ls_ac[p - 1] = 1\n elif ls[i][1] == "WA":\n if ls_ac[p - 1] == 0:\n ls_ng[p - 1] += 1\n\nprint(ac, ng)', 'n, m = map(int, input().split())\nls = [[_ for _ in input().split()] for _ in range(m)]\n\nls_ac = [0] * n\nls_ng = [0] * n\nac = 0\nng = 0\n\n\nfor i in range(m):\n p = int(ls[i][0])\n if ls[i][1] == "AC":\n if ls_ac[p - 1] == 0:\n ac += 1\n ng += ls_ng[p - 1]\n ls_ac[p - 1] = 1\n elif ls[i][1] == "WA":\n if ls_ac[p - 1] == 0:\n ls_ng[p - 1] += 1\n\nprint(ac, ng)']
['Runtime Error', 'Accepted']
['s317127958', 's770314109']
[3064.0, 27508.0]
[17.0, 325.0]
[325, 413]
p02802
u387080888
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N,M=map(int,input().split())\nP,S=[],[]\nans,pen=0,0\ntask=[0]*N\nfor _ in range(M):\n A,B=map(str,input().split())\n P.append(int(A))\n S.append(B)\n\nfor j in range(M):\n if task[A[M]-1]!=-1 and S[j]=="WA":\n pen+=1\n elif task[A[M]-1]!=-1 and S[j]=="AC":\n ans+=1\n task[A[M]]=-1\n break\nprint(ans,pen)', 'N,M=map(int,input().split())\nP,S=[],[]\nans,pen=0,0\ntask=[0]*N\nfor _ in range(M):\n A,B=map(str,input().split())\n P.append(int(A))\n S.append(B)\n\nfor j in range(M):\n if task[A[M]]!=-1 and S[j]=="WA":\n pen+=1\n elif task[A[M]]!=-1 and S[j]=="AC":\n ans+=1\n task[A[M]]=-1\n break\nprint(ans,pen)', 'N,M=map(int,input().split())\nP,S=[],[]\nans,pen=0,0\ntask=[0]*N\nfor _ in range(M):\n A,B=map(str,input().split())\n P.append(int(A))\n S.append(B)\n\nfor j in range(M):\n if task[P[j]-1]!=-1 and S[j]=="WA":\n pen+=1\n elif task[P[j]-1]!=-1 and S[j]=="AC":\n ans+=1\n task[P[j]-1]=-1\n break\nprint(ans,pen)', 'N,M=map(int,input().split())\nP,S=[],[]\nans,pen=0,0\ntask=[0]*N\nfor _ in range(M):\n A,B=map(str,input().split())\n P.append(int(A))\n S.append(B)\n\nfor j in range(M):\n if task[P[j]-1]!=-1 and S[j]=="WA":\n task[P[j]-1]+=1\n elif task[P[j]-1]!=-1 and S[j]=="AC":\n ans+=1\n pen+=task[P[j]-1]\n task[P[j]-1]=-1\nprint(ans,pen)']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s062113377', 's486932234', 's844667814', 's145686314']
[14136.0, 14140.0, 14136.0, 14132.0]
[304.0, 311.0, 336.0, 385.0]
[333, 329, 335, 356]
p02802
u389910364
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['import bisect\nimport cmath\nimport heapq\nimport itertools\nimport math\nimport operator\nimport os\nimport re\nimport string\nimport sys\nfrom collections import Counter, deque, defaultdict\nfrom copy import deepcopy\nfrom decimal import Decimal\nfrom fractions import gcd\nfrom functools import lru_cache, reduce\nfrom operator import itemgetter, mul, add, xor\n\nimport numpy as np\n\nif os.getenv("LOCAL"):\n sys.stdin = open("_in.txt", "r")\n\nsys.setrecursionlimit(10 ** 9)\nINF = float("inf")\nIINF = 10 ** 18\nMOD = 10 ** 9 + 7\n# MOD = 998244353\n\nN, M = list(map(int, sys.stdin.buffer.readline().split()))\nPS = [sys.stdin.buffer.readline().decode().rstrip().split() for _ in range(M)]\n\nac = np.zeros(N + 1, dtype=int)\nwa = np.zeros(N + 1, dtype=int)\n\nfor p, s in PS:\n p = int(p)\n if s == \'AC\':\n ac[p] = 1\n if s == \'WA\':\n if ac[p]:\n continue\n wa[p] += 1\nprint(ac.sum() , wa.sum())\n', 'import os\nimport sys\n\nimport numpy as np\n\nif os.getenv("LOCAL"):\n sys.stdin = open("_in.txt", "r")\n\nsys.setrecursionlimit(10 ** 9)\nINF = float("inf")\nIINF = 10 ** 18\nMOD = 10 ** 9 + 7\n# MOD = 998244353\n\nN, M = list(map(int, sys.stdin.buffer.readline().split()))\nPS = [sys.stdin.buffer.readline().decode().rstrip().split() for _ in range(M)]\n\nac = np.zeros(N + 1, dtype=int)\nwa = np.zeros(N + 1, dtype=int)\n\nfor p, s in PS:\n p = int(p)\n if s == \'AC\':\n ac[p] = 1\n if s == \'WA\':\n if ac[p]:\n continue\n wa[p] += 1\nprint(ac.sum(), wa[ac > 0].sum())\n']
['Wrong Answer', 'Accepted']
['s883367192', 's525497996']
[43376.0, 42756.0]
[485.0, 497.0]
[908, 587]
p02802
u391285522
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['lines = []\nwhile True:\n line = input()\n if line:\n lines.append(line)\n else:\n break\n\nc = 0\np = 0\ncurr_no = -1\nfor line in lines[1:]:\n curr = line.split()\n if(curr_no != curr[0]):\n curr_no = curr[0]\n curr_flag = True\n if(curr_flag):\n if(curr[1] == "AC"):\n c += 1\n curr_flag = False\n else:\n p += 1\n\nprint(str(c) + " " + str(p))\n', 'lines = []\nwhile True:\n line = input()\n if line:\n lines.append(line)\n else:\n break\n\nc = 0\np = 0\ncurr_no = -1\nfor line in lines[1:]:\n curr = line.split()\n if(curr_no != curr[0]):\n curr_no = curr[0]\n curr_flag = True\n if(curr_flag):\n if(curr[1] == "AC"):\n c += 1\n curr_flag = False\n else:\n p += 1\n\nprint(c, p)\n', 'from collections import defaultdict\n\nparams = input().split()\nn = int(params[0])\nm = int(params[1])\n\npenaltyCount = dict()\npenaltyCount = defaultdict(lambda: 0, penaltyCount)\n\ncorrect = 0\npenalty = 0\n\nfor i in range(m):\n submission = input.split()\n p = int(submission[0]) - 1\n status = submission[1]\n\n if penaltyCount[p] == -1:\n continue\n if status == "WA":\n penaltyCount[p] += 1\n else:\n penalty += penaltyCount[p]\n penaltyCount[p] = -1\n correct += 1\n\nprint(str(correct) + " " + str(penalty))\n\n', 'from collections import defaultdict\n\nlines = []\nwhile True:\n line = input()\n if line:\n lines.append(line)\n else:\n break\n\ncorrect = 0\npenalty = 0\nd = dict()\nd = defaultdict(lambda: 0, d)\n\nfor line in lines[1:]:\n n = line.split()[0]\n m = line.split()[1]\n\n if d[n] == -1:\n continue\n if m == "WA":\n d[n] += 1\n else:\n penalty += d[n]\n d[n] = -1\n correct += 1\n\nprint(str(correct) + " " + str(penalty))\n\n', 'from collections import defaultdict\n\nparams = input().split()\nn = int(params[0])\nm = int(params[1])\n\npenaltyCount = dict()\npenaltyCount = defaultdict(lambda: 0, penaltyCount)\n\ncorrect = 0\npenalty = 0\n\nfor i in range(m):\n submission = input().split()\n p = int(submission[0]) - 1\n status = submission[1]\n\n if penaltyCount[p] == -1:\n continue\n if status == "WA":\n penaltyCount[p] += 1\n else:\n penalty += penaltyCount[p]\n penaltyCount[p] = -1\n correct += 1\n\nprint(str(correct) + " " + str(penalty))\n\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s079952736', 's247263895', 's248881979', 's918665106', 's284617243']
[10136.0, 10144.0, 3316.0, 10492.0, 15460.0]
[155.0, 148.0, 20.0, 155.0, 349.0]
[418, 401, 547, 470, 549]
p02802
u391675400
2,000
1,048,576
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 `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n,m = map(int,input().split())\nquestion = 0\nans = 0\n\nco = 0\npe = 0\ntemp =0\nfor i in range(m):\n p,s = input().split()\n if temp == 0:\n check = int(p)\n temp +=1\n\n print("check,p,s",check,p,s)\n if check == int(p) and s == "WA":\n pe += 1\n elif check == int(p) and s =="AC":\n co += 1\n check += 1\n\nprint(co,pe)\n\n', 'n,m = map(int,input().split())\nquestion = 0\nans = 0\n\nco = 0\npe = 0\n\nans_check = [0]*n\nwa_check = [0]*n\ntemp = 0\n\nfor i in range(m):\n p,s = input().split()\n p = int(p) - 1\n if s == "AC":\n if ans_check[int(p)] == 0:\n ans_check[int(p)] = 1\n co += 1\n pe +=wa_check[int(p)]\n elif s == "WA":\n wa_check[int(p)] += 1\n \n\n\nprint(co,pe)\n\n']
['Wrong Answer', 'Accepted']
['s108734267', 's156960444']
[5492.0, 4596.0]
[890.0, 324.0]
[355, 389]