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
u616542081
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())\nt_ans = []\nfor _ in range(M):\n t_ans.append(list(map(str,input().split())))\n\nans_num = [0]*(N+1)\nans_pe = [0]*(N+1)\n\nfor i in range(M):\n result = t_ans[i][1]\n question = int(t_ans[i][0])\n print(question)\n if result == 'AC' and ans_num[question] == 0:\n ans_num[question] = 1\n elif result == 'WA' and ans_num[question] == 0:\n ans_pe[question] += 1\n \nfor i in range(N):\n if ans_num[i] != 1:\n ans_pe[i] = 0\n\nprint(f'{sum(ans_num)} {sum(ans_pe)}')", "N, M = map(int, input().split())\nt_ans = []\nfor _ in range(M):\n t_ans.append(list(map(str,input().split())))\n\nans_num = [0]*(N+1)\nans_pe = [0]*(N+1)\n\nfor i in range(M):\n result = t_ans[i][1]\n question = int(t_ans[i][0])\n if result == 'AC' and ans_num[question] == 0:\n ans_num[question] = 1\n elif result == 'WA' and ans_num[question] == 0:\n ans_pe[question] += 1\n\nfor i in range(N+1):\n if ans_num[i] != 1:\n ans_pe[i] = 0\n\nprint(f'{sum(ans_num)} {sum(ans_pe)}')"]
['Wrong Answer', 'Accepted']
['s495315261', 's057748384']
[35312.0, 34892.0]
[337.0, 299.0]
[492, 474]
p02802
u617037231
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\nN,M = map(int,input().split())\nif M == 0:\n print('%d %d' % (0,0))\n sys.exit(0)\nListe = dict()\nQuestion = [0] * M\nACorWE = [0] * M\nZ = 0\ncorrect = 0\npena = 0\nfor i in range(M):\n Question[i], ACorWE[i]= map(str, input().split())\nQuestion = [int(element) for element in Question]\nfor _ in range(max((max(Question)+1),len(ACorWE))): #range(max(Question)+1) before\n Liste[_] = [0] \n#Liste[4].append(0) \n#print(Liste)\n#print(Question) #[1, 1, 2, 2, 2]\n#print(ACorWE) #['WA', 'AC', 'WA', 'AC', 'WA']\nfor i in range(M): \n Liste[Question[i]].append(ACorWE[i])\n #print(Liste)\n Liste[i].remove(0)\n#print(Liste)\n#{0: [], 1: ['WA', 'AC'], 2: ['WA', 'AC', 'WA'], 3: [], 4: []}\n\nfor i in range(1,len(Liste)): #range(1,max(Question)+1) before\n if 'AC' in Liste[i] and Z == 0:\n correct += 1\n Z = 1\n Z = 0\nfor i in range(1,len(Liste)): #range(1,max(Question)+1) before\n for j in range(len(Liste[i])):\n if j <= len(Liste[i]) -2:\n if Liste[i][j] == 'WA' and Liste[i][j+1] == 'AC' and\u3000(i == max(Question)):\n pena += 1\n print('%d %d' % (correct,pena))\n sys.exit(0)\n elif Liste[i][j] == 'WA' and Liste[i][j+1] == 'AC':\n pena += 1\n break\n elif Liste[i][j] == 'WA' and Liste[i][j+1] == 'WA':\n pena += 1\n\nprint('%d %d' % (correct,pena))", "import sys\nN,M = map(int,input().split())\nif M == 0:\n print('%d %d' % (0,0))\n sys.exit(0)\nListe = dict()\nQuestion = [0] * M\nACorWE = [0] * M\ncorrect = 0\npenalty = 0\nfor i in range(M):\n Question[i], ACorWE[i]= map(str, input().split())\nQuestion = [int(element) for element in Question]\nfor _ in Question:\n Liste[_] = [0] \nfor i in range(M):\n Liste[Question[i]].append(ACorWE[i])\nfor liste in Liste:\n while 0 in Liste[liste]:\n Liste[liste].remove(0)\nAC = []\nfor key in Liste:\n if 'AC' in Liste[key]:\n correct += 1\n AC.append(key)\nj = 0\nfor key in AC:\n while Liste[key][j] != 'AC' and j<len(Liste[key]):\n penalty += 1\n j += 1 \n j = 0 \nprint('%d %d' % (correct,penalty))"]
['Runtime Error', 'Accepted']
['s605081699', 's522517426']
[3064.0, 36860.0]
[17.0, 542.0]
[1558, 736]
p02802
u626228246
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\nn,m = map(int,input().split())\np = [list(map(str,input().split())) for _ in range(m)]\nbox = []\nacnt,wcnt,tmp = 0,0,0\nif m == 0:\n\tprint(0,0)\n\tsys.exit()\ninx = 0\nfor i in range(m):\n\tif p[i][0] != inx\n\t\tif p[i][1] == 'AC':\n\t\t\t\tinx =p[i][0]\n\t\t\t\tacnt += 1\n\t\t\t\twcnt += tmp\n\t\t\t\ttmp = 0\n\t\telse:\n\t\t\ttmp += 1\nprint(acnt,wcnt)", "import sys\nn,m = map(int,input().split())\np = [list(map(str,input().split())) for _ in range(m)]\np.sort(key=lambda x:x[0])\nacnt,wcnt,tmp = 0,0,0\nif m == 0:\n\tprint(0,0)\n\tsys.exit()\ninx = '0'\nfor i in range(m):\n\tif p[i][0] != inx:\n\t\tif p[i][1] == 'AC':\n\t\t\t\tinx = p[i][0]\n\t\t\t\tacnt += 1\n\t\t\t\twcnt += tmp\n\t\t\t\ttmp = 0\n\t\t\t\tprint(inx)\n\t\t\t\t\n\t\telse:\n\t\t\ttmp += 1\nprint(acnt,wcnt)", 'n,m = map(int,input().split())\np = [list(map(str,input().split())) for _ in range(m)]\n\nac =[0]*(n+1)\nwa =[0]*(n+1)\nfor i in range(m):\n question =int(p[i][0])\n \n if p[i][1] == "AC" and ac[question] == 0:\n ac[question] = 1\n \n elif p[i][1] == "WA" and ac[question] == 0:\n wa[question] += 1\nfor j in range(n+1):\n \n if ac[j] == 0:\n wa[j] = 0\n # print(wa)\nprint(sum(ac),sum(wa))\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s366356554', 's723474882', 's512182955']
[9028.0, 34836.0, 35084.0]
[26.0, 341.0, 300.0]
[326, 367, 677]
p02802
u626881915
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_list = [False]*(n+1)\npena_count = [0]*(n+1)\nfor i in range(m):\n p, s = map(int, input().split())\n if not ac_list[p]:\n if s == "AC":\n ac_list[p] = True\n else:\n pena_count[p] += 1\nac_count = 0\npena_c = 0\nfor i in range(1, n+1):\n if ac_list[i]:\n ac_count += 1\n pena_c += pena_count[i]\nprint(ac_count, pena_c)\n ', 'n,m = map(int, input().split())\nac_list = [False]*(n+1)\npena_count = [0]*(n+1)\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n if not ac_list[p]:\n if s == "AC":\n ac_list[p] = True\n else:\n pena_count[p] += 1\nac_count = 0\npena_c = 0\nfor i in range(1, n+1):\n if ac_list[i]:\n ac_count += 1\n pena_c += pena_count[i]\nprint(ac_count, pena_c)\n \n']
['Runtime Error', 'Accepted']
['s602821331', 's191704751']
[4596.0, 4596.0]
[20.0, 281.0]
[372, 376]
p02802
u630467326
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\nN, M = map(int, input().split())\nAC = np.zeros(N)\nWA = np.zeros(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 else:\n AC[int(p) - 1] = 1\n\nprint(sum(AC), sum(AC * WA))\n ", "import numpy as np\n\nN, M = map(int, input().split())\nAC = np.zeros(N, dtype = int)\nWA = np.zeros(N, dtype = int)\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 else:\n AC[int(p) - 1] = 1\n\nprint(sum(AC), sum(AC * WA))\n "]
['Wrong Answer', 'Accepted']
['s063359015', 's346344170']
[28784.0, 28800.0]
[382.0, 377.0]
[260, 286]
p02802
u635252313
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())\ndicts = {key: [False,0] for key in range(1, n+1)}\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n if s == "AC":\n dicts[p][0] = True\n continue\n else:\n if dicts[p][0]==True:\n continue\n else:\n dicts[p][1] += 1\nprint(dicts)\nans_list = [v[1] for k, v in dicts.items() if v[0]==True]\nans_n = len(ans_list)\npenal = sum(ans_list)\nprint(ans_n,penal)', 'n,m=map(int,input().split())\ndicts = {key: [False,0] for key in range(1, n+1)}\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n if s == "AC":\n dicts[p][0] = True\n continue\n else:\n if dicts[p][0]==True:\n continue\n else:\n dicts[p][1] += 1\nans_list = [v[1] for k, v in dicts.items() if v[0]==True]\nans_n = len(ans_list)\npenal = sum(ans_list)\nprint(ans_n,penal)']
['Wrong Answer', 'Accepted']
['s732411892', 's282805753']
[27296.0, 23204.0]
[365.0, 328.0]
[439, 426]
p02802
u638801031
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 bisect import *\nfrom collections import *\nfrom itertools import *\nimport functools\nimport sys\nimport math\nfrom decimal import *\nfrom copy import *\nfrom heapq import *\nfrom fractions import *\ngetcontext().prec = 30\nMAX = sys.maxsize\nMAXN = 1000001\nMOD = 10**9+7\nspf = [i for i in range(MAXN)]\nspf[0]=spf[1] = -1\ndef sieve():\n for i in range(2,MAXN,2):\n spf[i] = 2\n for i in range(3,int(MAXN**0.5)+1):\n if spf[i]==i:\n for j in range(i*i,MAXN,i):\n if spf[j]==j:\n spf[j]=i\ndef fib(n,m):\n if n == 0:\n return [0, 1]\n else:\n a, b = fib(n // 2)\n c = ((a%m) * ((b%m) * 2 - (a%m)))%m\n d = ((a%m) * (a%m))%m + ((b)%m * (b)%m)%m\n if n % 2 == 0:\n return [c, d]\n else:\n return [d, c + d]\n\ndef charIN(x= \' \'):\n return(sys.stdin.readline().strip().split(x))\n\ndef arrIN(x = \' \'):\n return list(map(int,sys.stdin.readline().strip().split(x)))\n\ndef ncr(n,r):\n num=den=1\n for i in range(r):\n num = (num*(n-i))%MOD\n den = (den*(i+1))%MOD\n\n return (num*(pow(den,MOD-2,MOD)))%MOD\n\ndef flush():\n return sys.stdout.flush()\n\n\'\'\'*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\'\'\'\nn,m = arrIN()\n\nd = defaultdict(list)\n\nfor i in range(m):\n a,b = input().split()\n d[int(a)].append(b)\nca = pe = 0\nfor i in range(1,n+1):\n if "AC" in d[i]:\n ca+=1\n pe+=d[i].index("AC")\nprint(ca,de)', 'from bisect import *\nfrom collections import *\nfrom itertools import *\nimport functools\nimport sys\nimport math\nfrom decimal import *\nfrom copy import *\nfrom heapq import *\nfrom fractions import *\ngetcontext().prec = 30\nMAX = sys.maxsize\nMAXN = 1000001\nMOD = 10**9+7\nspf = [i for i in range(MAXN)]\nspf[0]=spf[1] = -1\ndef sieve():\n for i in range(2,MAXN,2):\n spf[i] = 2\n for i in range(3,int(MAXN**0.5)+1):\n if spf[i]==i:\n for j in range(i*i,MAXN,i):\n if spf[j]==j:\n spf[j]=i\ndef fib(n,m):\n if n == 0:\n return [0, 1]\n else:\n a, b = fib(n // 2)\n c = ((a%m) * ((b%m) * 2 - (a%m)))%m\n d = ((a%m) * (a%m))%m + ((b)%m * (b)%m)%m\n if n % 2 == 0:\n return [c, d]\n else:\n return [d, c + d]\n\ndef charIN(x= \' \'):\n return(sys.stdin.readline().strip().split(x))\n\ndef arrIN(x = \' \'):\n return list(map(int,sys.stdin.readline().strip().split(x)))\n\ndef ncr(n,r):\n num=den=1\n for i in range(r):\n num = (num*(n-i))%MOD\n den = (den*(i+1))%MOD\n\n return (num*(pow(den,MOD-2,MOD)))%MOD\n\ndef flush():\n return sys.stdout.flush()\n\n\'\'\'*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\'\'\'\nn,m = arrIN()\n\nd = defaultdict(list)\n\nfor i in range(m):\n a,b = input().split()\n d[int(a)].append(b)\nca = pe = 0\nfor i in range(1,n+1):\n if "AC" in d[i]:\n ca+=1\n pe+=d[i].index("AC")\nprint(ca,pe)']
['Runtime Error', 'Accepted']
['s584077932', 's206210073']
[70964.0, 71016.0]
[530.0, 520.0]
[1472, 1472]
p02802
u643679148
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 collections import defaultdict as dic\nn, m = map(int, input().split())\nac = 0\npena = 0\nd = dic(list)\nfor i in range(m):\n pi, si = input().split()\n d[pi].append(si)\n\n\nprint(d)\nfor (k, v) in d.items():\n pe = 0\n flag = False\n for aw in v:\n if aw == 'WA':\n pe += 1\n else:\n ac += 1\n flag = True\n break\n\n if flag:\n pena += pe\n\nprint(ac, pena)\n", "# -*- coding: utf-8 -*-\nn, m = map(int, input().split())\nck = set()\npe = 0\nac = 0\npenalty = 0\ncp = [0] * (n+1)\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n if p in ck:\n continue\n\n if s == 'WA':\n cp[p] += 1\n else:\n penalty += cp[p]\n pe = 0\n ac += 1\n ck.add(p)\n\nprint(ac, penalty)\n"]
['Wrong Answer', 'Accepted']
['s014004850', 's165042892']
[41104.0, 18212.0]
[272.0, 216.0]
[425, 347]
p02802
u645538982
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\nac = 0\nwa = 0\naclist = {}\nwalist = {}\n\ncount_WA=0\nfor i in range(n):\n aclist[i + 1] = 0\n walist[i + 1] = 0\n\nfor i in range(M):\n a,b=input().split()\n a=int(a)\n if aclist[a] == 1:\n continue\n elif b == \'WA\':\n walist[a] += 1\n elif b == \'AC\':\n aclist[a] += 1\n ac += 1\n wa += walist[a]\n\n\n\n\nprint(ac,wa,sep=" ")\n', 'N,M=map(int,input().split())\n\n\nac = 0\nwa = 0\naclist = {}\nwalist = {}\n\ncount_WA=0\nfor i in range(N):\n aclist[i + 1] = 0\n walist[i + 1] = 0\n\nfor i in range(M):\n a,b=input().split()\n a=int(a)\n if aclist[a] == 1:\n continue\n elif b == \'WA\':\n walist[a] += 1\n elif b == \'AC\':\n aclist[a] += 1\n ac += 1\n wa += walist[a]\n\n\n\n\nprint(ac,wa,sep=" ")\n']
['Runtime Error', 'Accepted']
['s045338075', 's038623697']
[3064.0, 24212.0]
[18.0, 359.0]
[392, 392]
p02802
u651109406
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(m):\n te, mp = input().split()\n p.append(te), s.append(mp)\n\nacdic = []\nans = 0\nfor i in range(m):\n if p[i] not in acdic:\n if s[i] == 'WA':\n ans += 1\n else:\n acdic.append(p[i])\n\nprint(ans)\n", "n, m = map(int, input().split())\np, s = [], []\nacdic = []\nans, tmp = 0, 0\nfor i in range(m):\n te, mp = input().split()\n p.append(te), s.append(mp)\n if p[i] not in acdic:\n if s[i] == 'WA':\n tmp += 1\n else:\n acdic.append(p[i]) \n ans += tmp \n\nprint(len(acdic), ans)\n", "n, m = map(int, input().split())\n\nac_check = [False for i in range(n)]\nwa_count = [0 for i in range(n)]\n\nclear = 0\nerror = 0\nfor i in range(m):\n p, s = input().split()\n p = int(p) - 1\n\n if s == 'AC' and ac_check[p] == False:\n ac_check[p] = True\n error += wa_count[p]\n elif s == 'WA' and ac_check[p] == False:\n wa_count[p] += 1\n\nfor i in range(n):\n if ac_check[i]:\n clear += 1\n\nprint(clear, error)\n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s109776305', 's125260769', 's729252371']
[15708.0, 15676.0, 4760.0]
[2104.0, 2104.0, 294.0]
[294, 321, 440]
p02802
u652656291
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\nAC = 0\nWA = 0\ntmp = [0]*n\nfor i in range(m):\n\tx,y = input().split()\n\tx = int(x)\n\tif L[x-1] == 0:\n\t\tif y == "WA":\n\t\t\ttmp[x-1] += 1\n\t\telse:\n\t\t\tAC += 1\n\t\t\tWA += tmp[x-1]\n\t\t\tL[x-1]=1\nprint(A,W)\n', 'n,m = map(int,input().split())\nL = [0]*n\nAC = 0\nWA = 0\ntmp = [0]*n\nfor i in range(m):\n\tx,y = input().split()\n\tx = int(x)\n\tif L[x-1] == 0:\n\t\tif y == "WA":\n\t\t\ttmp[x-1] += 1\n\t\telse:\n\t\t\tAC += 1\n\t\t\tWA += tmp[x-1]\n\t\t\tL[x-1]=1\nprint(AC,WA)\n']
['Runtime Error', 'Accepted']
['s716784790', 's776102166']
[4596.0, 4596.0]
[288.0, 288.0]
[231, 233]
p02802
u656391577
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\ninput = sys.stdin.readline\n\nN,M = map(int, input().split())\nX = list(input().split() for i in range(M))\nX=[[\'1\', \'AC\'], [\'2\', \'AC\']]\np=0\nc=0\n\nfor i in range(N):\n L = [x[1] for x in X if x[0] == str(i+1)]\n if "AC" in L:\n c += 1\n for l in L:\n if l == "WA":\n p += 1\n else:\n break\n\nprint(c,p)', 'import sys\ninput = sys.stdin.readline\n\nN,M = map(int, input().split())\n\npenalty=[0]*N\ncorrect=[False]*N\n\nfor i in range(M):\n\n p,s = input().split()\n p = int(p)\n\n if s=="AC":\n correct[p-1]=True\n\n else:\n if correct[p-1]==False:\n penalty[p-1] += 1\n\nfor i in range(N):\n if correct[i]==False:\n penalty[i]=0\n\nprint(sum(i == True for i in correct),sum(penalty))']
['Wrong Answer', 'Accepted']
['s007861593', 's463327734']
[32116.0, 4596.0]
[176.0, 156.0]
[351, 401]
p02802
u663230781
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 = get_next_ints()\n ac_count = 0\n wa_count = 0\n \n ac_found = False\n wa = 0\n prev_p = -1\n for i in range(m):\n \n p, result = input().rstrip("\\n").split(" ")\n if p != prev_p:\n prev_p = p\n if ac_found:\n ac_count += 1\n wa_count += wa\n ac_found = False\n wa = 0\n if not ac_found:\n if result == \'AC\':\n ac_found = True\n else:\n wa += 1\n if ac_found:\n ac_count += 1\n wa_count += wa\n print(ac_count, wa_count)\n \nif __name__ == \'__main__\':\n main()\nif __name__ == \'__jupyter__\':\n import doctest\n print(doctest.testmod())', '\ndef get_next_by_types(*value_types,delim=" "):\n \n return tuple([t(x) for t, x in zip(value_types,input().rstrip("\\n").split(delim))])\n\ndef main():\n n, m = get_next_ints()\n ac_count = 0\n wa_count = 0\n \n ac_found = False\n wa = 0\n prev_p = -1\n for i in range(m):\n \n p, result = get_next_by_types(int, str)\n if p != prev_p:\n prev_p = p\n if ac_found:\n ac_count += 1\n wa_count += wa\n ac_found = False\n wa = 0\n if not ac_found:\n if result == \'AC\':\n ac_found = True\n else:\n wa += 1\n if ac_found:\n ac_count += 1\n wa_count += wa\n print(ac_count, wa_count)\n \nif __name__ == \'__main__\':\n main()\nif __name__ == \'__jupyter__\':\n import doctest\n print(doctest.testmod())', 'def get_next_ints(delim=" "):\n return tuple([int(float(x)) for x in input().split(delim)])\ndef solve(maze, start_r, start_c):\n \n distances = {}\n offsets = [(-1,0),(1,0),(0,-1),(0,1)]\n \n distances[start_r, start_c] = 0\n candidates = [(start_r, start_c)]\n \n while candidates:\n r, c= candidates.pop(0)\n \n for offset_r, offset_c in offsets:\n move_r, move_c = r + offset_r, c + offset_c\n if not (move_r, move_c) in distances and maze[move_r, move_c] == ".":\n distances[move_r, move_c] = distances[r, c] + 1\n candidates.append((move_r, move_c))\n \n return max(distances.values())\n \n\ndef main():\n h, w = get_next_ints()\n from collections import defaultdict\n maze = defaultdict(str)\n for r in range(h):\n line = get_next_str()\n for c in range(w):\n maze[r,c] = line[c]\n \n results = []\n for r in range(h):\n for c in range(w):\n result = solve(maze, r, c)\n results.append(result)\n \n print(max(results))\n \nif __name__ == \'__main__\':\n main()\nif __name__ == \'__jupyter__\':\n import doctest\n print(doctest.testmod())\n', 'def get_next_ints(delim=" "):\n return tuple([int(float(x)) for x in input().split(delim)])\n\ndef get_next_by_types(*value_types,delim=" "):\n \n return tuple([t(x) for t, x in zip(value_types,input().rstrip("\\n").split(delim))])\n\ndef main():\n n, m = get_next_ints()\n ac_count = 0\n wa_count = 0\n \n ac_found = False\n wa = 0\n prev_p = -1\n for i in range(m):\n \n p, result = get_next_by_types()\n if p != prev_p:\n prev_p = p\n if ac_found:\n ac_count += 1\n wa_count += wa\n ac_found = False\n wa = 0\n if not ac_found:\n if result == \'AC\':\n ac_found = True\n else:\n wa += 1\n if ac_found:\n ac_count += 1\n wa_count += wa\n print(ac_count, wa_count)\n \nif __name__ == \'__main__\':\n main()\nif __name__ == \'__jupyter__\':\n import doctest\n print(doctest.testmod())\n', 'def get_next_ints(delim=" "):\n return tuple([int(float(x)) for x in input().split(delim)])\n\n\ndef get_next_by_types(*value_types, delim=" "):\n return tuple(\n [t(x) for t, x in zip(value_types, input().rstrip("\\n").split(delim))])\n\n\ndef main():\n n, m = get_next_ints()\n ac_count = 0\n wa_count = 0\n\n from collections import defaultdict\n ac_cache = defaultdict(int)\n wa_cache = defaultdict(int)\n ac_count = 0\n wa_count = 0\n wa = 0\n for i in range(m):\n\n p, result = get_next_by_types(int, str)\n\n if ac_cache[p] == 0:\n if result == \'AC\':\n\n ac_cache[p] = 1\n ac_count += 1\n wa_count += wa_cache[p]\n wa = 0\n else:\n wa_cache[p] += 1\n print(ac_count, wa_count)\n\n\nif __name__ == \'__main__\':\n main()\nif __name__ == \'__jupyter__\':\n import doctest\n print(doctest.testmod())']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s067353464', 's078800931', 's431039951', 's900625616', 's316500001']
[3064.0, 3064.0, 3316.0, 3064.0, 21588.0]
[17.0, 18.0, 21.0, 17.0, 503.0]
[733, 1027, 1200, 1114, 924]
p02802
u665539482
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 functools import reduce\nN, M = list(map(int, input().split()))\nps_list = [input().split() for _ in range(M)]\n\nresult = {}\nfor row in ps_list:\n if not row[0] in result:\n result[row[0]] = {\n "AC": 0,\n "WA": 0\n }\n if result[row[0]]["AC"] > 0:\n continue\n else:\n result[row[0]][row[1]] = result[row[0]][row[1]] + 1\n\nprint(result)\nac = 0\nwa = 0\nfor k,v in result.items():\n ac = ac + v["AC"]\n if v["AC"] = 0:\n continue\n wa = wa + v["WA"]\nprint(ac, wa)', 'from functools import reduce\nN, M = list(map(int, input().split()))\nps_list = [input().split() for _ in range(M)]\n\nresult = {}\nfor row in ps_list:\n if not row[0] in result:\n result[row[0]] = {\n "AC": 0,\n "WA": 0\n }\n if result[row[0]]["AC"] > 0:\n continue\n else:\n result[row[0]][row[1]] = result[row[0]][row[1]] + 1\n\nac = 0\nwa = 0\nfor k,v in result.items():\n ac = ac + v["AC"]\n if v["AC"] == 0:\n continue\n wa = wa + v["WA"]\nprint(ac, wa)']
['Runtime Error', 'Accepted']
['s086689630', 's391291529']
[3064.0, 68652.0]
[17.0, 409.0]
[484, 471]
p02802
u667084803
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\nQ = [0] * N\nwrong = [0] * N\nfor i in (M):\n p, S = map(str, input().split())\n p = int(p) - 1\n if Q[p] == 0 and S == "AC":\n ans += wrong[p]\n Q[p] = 1\n elif S == "WA":\n wrong[p] += 1\nprint(ans)', 'N, M = map(int, input().split())\nans = 0\nQ = [0] * N\nwrong = [0] * N\nfor i in range(M):\n p, S = map(str, input().split())\n p = int(p) - 1\n if Q[p] == 0 and S == "AC":\n ans += wrong[p]\n Q[p] = 1\n elif S == "WA":\n wrong[p] += 1\nprint(ans)', 'N, M = map(int, input().split())\nans1 = 0\nans2 = 0\nQ = [0] * N\nwrong = [0] * N\nfor i in range(M):\n p, S = map(str, input().split())\n p = int(p) - 1\n if Q[p] == 0 and S == "AC":\n ans1 += 1\n ans2 += wrong[p]\n Q[p] = 1\n elif S == "WA":\n wrong[p] += 1\nprint(ans1,ans2)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s130541033', 's845448762', 's898126194']
[4596.0, 4596.0, 4596.0]
[19.0, 350.0, 362.0]
[244, 249, 280]
p02802
u667300358
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 = []\ns_list = []\nac_list = [0] * (n + 1)\nac, wa = 0, 0\nif m == 0:\n print(0, 0)\nelse:\n for i in range(m):\n p, s = map(str, input().split())\n p = int(p)\n p_list.append(p)\n s_list.append(s)\n if s == "WA":\n if ac_list[p] == 0:\n wa += 1\n else:\n continue\n elif s == "AC":\n if ac_list[p] == 0:\n ac += 1\n ac_list[p] = 1\n else:\n continue\n for i in reversed(s_list):\n if i == "AC":\n break\n else:\n wa -= 1\n print(ac, wa)', 'n, m = map(int, input().split())\np_list = []\ns_list = []\nac_list = [0] * (n + 1)\nac, wa = 0, 0\nif m == 0:\n print(0, 0)\nelse:\n for i in range(m):\n p, s = map(str, input().split())\n p = int(p)\n p_list.append(p)\n s_list.append(s)\n if s == "WA":\n if ac_list[p] == 0:\n wa += 1\n else:\n continue\n elif s == "AC":\n if ac_list[p] == 0:\n ac += 1\n ac_list[p] = 1\n else:\n continue\n for i in reversed(p_list):\n if ac_list[i] == 0:\n wa -= 1\n print(ac, wa)']
['Wrong Answer', 'Accepted']
['s008002799', 's168868148']
[14136.0, 14236.0]
[370.0, 371.0]
[658, 632]
p02802
u669819350
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 = dict()\nans, penalty = 0, 0\nfor _ in range(M):\n tmp = input()\n if tmp[0] in p:\n continue\n if tmp[1] == 'AC':\n p[tmp[0]] = 1\n ans += 1\n else:\n penalty += 1\nprint(ans, penalty)", "N, M = map(int, input().split())\np = dict()\nac = dict()\nans, penalty = 0, 0\nfor _ in range(M):\n tmp = input().split()\n if tmp[0] in ac:\n continue\n if tmp[1] == 'AC':\n ans += 1\n ac[tmp[0]] = 1\n penalty += p.get(tmp[0], 0)\n else:\n p[tmp[0]] = p.get(tmp[0], 0) + 1\nprint(ans, penalty)\n"]
['Wrong Answer', 'Accepted']
['s757995862', 's162942391']
[9116.0, 21856.0]
[151.0, 196.0]
[226, 301]
p02802
u674588203
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+1) \nL2=[0]*(N+1) \n\nfor i in range(M):\n p,S=input().split()\n if L1[int(p)]==1:\n pass\n else:\n if S=='AC':\n L1[int(p)]=1\n else:\n L2[int(p)]+=1\n\nfor j in range (M):\n if L1[j]==0 and L2[j]>0:\n L2[j]=0\n\nprint(sum(L1),sum(L2))", "N,M=map(int,input().split())\nL1=[0]*(N+1) \nL2=[0]*(N+1) \n\nfor i in range(M):\n p,S=input().split()\n if L1[int(p)]==1:\n pass\n else:\n if S=='AC':\n L1[int(p)]=1\n else:\n L2[int(p)]+=1\n\nfor j in range (N+1):\n if L1[j]==0 and L2[j]>0:\n L2[j]=0\n\nprint(sum(L1),sum(L2))"]
['Runtime Error', 'Accepted']
['s080063013', 's439094803']
[4596.0, 4596.0]
[289.0, 305.0]
[410, 412]
p02802
u677121387
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.append([int(p),s])\nps.sort(key=lambda x:x[0])\nt = 0\nac = 0\nwa = 0\ncnt = 0\n\nfor res in ps:\n if t != res[0]:\n if res[1] == "WA":\n cnt += 1\n else:\n ac += 1\n wa += cnt\n t = res[0]\n\nprint(ac,wa)', 'n,m = map(int,input().split())\nps = []\nfor i in range(m):\n p,s = input().split()\n ps.append([int(p),s])\nps.sort(key=lambda x:x[0])\nd = {}\nt = 0\nac = 0\nwa = 0\n\nfor res in ps:\n if t != res[0]:\n if res[1] == "WA":\n d[res[0]] = d.get(res[0],0) + 1\n else:\n ac += 1\n wa += d.get(res[0],0)\n t = res[0]\n\nprint(ac,wa)\n']
['Wrong Answer', 'Accepted']
['s276748327', 's741824665']
[23564.0, 26636.0]
[374.0, 411.0]
[341, 376]
p02802
u680851063
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.
["print('reference')\n\nN, M = map(int, input().split())\n\nac = [False] * N\nwa = [0] * N\nfor _ in range(M):\n p, S = input().split()\n p = int(p) - 1\n if S == 'AC':\n ac[p] = True\n else:\n if not ac[p]:\n wa[p] += 1\n\na = 0\nb = 0\nfor i in range(N):\n if ac[i]:\n a += 1\n b += wa[i]\nprint(*[a, b])", "n, m = map(int, input().split())\n\nrslts = [[] for _ in range(n)]\nfor i in range(m):\n x, y = input().split()\n rslts[int(x) - 1].append(y)\n#print(rslts)\n\nac, p = 0, 0\nfor j in range(n):\n seq = rslts[j]\n if 'AC' in seq:\n ac += 1\n for k in seq:\n if k == 'WA':\n p += 1\n else:\n break\n\nprint(ac, p)"]
['Wrong Answer', 'Accepted']
['s326505508', 's783223020']
[4596.0, 20376.0]
[276.0, 322.0]
[337, 369]
p02802
u681444474
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\nimport math\nN, M = map(int,input().split())\n#N = int(input())\n#K = int(input())\n#S = input()\nans = 0\n#l = list(map(int,input().split()))\n#A = list(map(int,input().split()))\nF = [False] * (N+1)\nP = [0] * (N+1)\nl = []\nfor i in range(M):\n p, s = map(str,input().split())\n p = int(p)\n l.append([p, s])\n if s == "WA" and not F[p]:\n P[p] += 1\n if s == "AC" and not F[p]:\n ans += 1\n F[p] = True\npen = 0\n#print(l)\nfor i in range(M):\n p = l[i][0]\n if F[p]:\n pen += P[p]\nprint(ans, pen)', '# coding: utf-8\nimport math\nN, M = map(int,input().split())\n#N = int(input())\n#K = int(input())\n#S = input()\nans = 0\n#l = list(map(int,input().split()))\n#A = list(map(int,input().split()))\nF = [False] * (N+1)\npen = 0\nP = [0] * (N+1)\nfor i in range(M):\n p, s = map(str,input().split())\n p = int(p)\n if s == "WA" and not F[p]:\n P[p] += 1\n if s == "AC" and not F[p]:\n ans += 1\n pen += P[p]\n F[p] = True\n\nprint(ans, pen)']
['Wrong Answer', 'Accepted']
['s932644709', 's713675305']
[28552.0, 10320.0]
[291.0, 230.0]
[541, 456]
p02802
u687159441
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.
["\ncnts = [0] * n\n\n\nat_dict = {}\n\nfor i in range(m):\n question, result = map(str, input().split())\n if result == 'AC':\n \n at_dict[question] = cnts[int(question)-1]\n elif result == 'WA':\n \n cnts[int(question)-1] += 1\n \nac = len(at_dict)\nwa = sum(v for v in at_dict.values())\n\nprint(ac, wa)", 'n, m=map(int,input().split())\nac = 0\nans=[True] * n\nwa=[0] * n\n\nfor i in range(m):\n question, result=input().split()\n num = int(question) - 1\n if result == "AC" and ans[num]:\n ans[num]=False\n ac+=1\n \n elif result == "WA" and ans[num]:\n wa[num] += 1\n \nwa_sum = 0\n\nfor i in range(n):\n \n if not ans[i]:\n wa_sum += wa[i]\n \nprint(ac, wa_sum)\n']
['Runtime Error', 'Accepted']
['s892598675', 's513131209']
[3064.0, 4596.0]
[18.0, 274.0]
[619, 497]
p02802
u692311686
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 i in range(M):\n p0,S0=map(int,input().split())\n p+=[p0]\n S+=[S0]\nawlist=[0 for i in range(N)]\nwalist=[0 for i in range(N)]\nwacount=0\naccount=0\nfor i in range(M):\n if s[i]=='WA' and awlist[s[i]]==0:\n walist[s[i]]+=1\n elif s[i]=='AC' and awlist[s[i]]==0:\n account+=1\n awlist[s[i]]=1\n wacount+=walist[s[i]]\nAnswer=[account,wacount]\nprint(*Answer)", "N,M=map(int,input().split())\np=[]\ns=[]\nfor i in range(M):\n p0,S0=map(str,input().split())\n p0=int(p0)-1\n p+=[p0]\n s+=[S0]\nawlist=[0 for i in range(N)]\nwalist=[0 for i in range(N)]\nwacount=0\naccount=0\nfor i in range(M):\n if s[i]=='WA' and awlist[p[i]]==0:\n walist[p[i]]+=1\n elif s[i]=='AC' and awlist[p[i]]==0:\n account+=1\n awlist[p[i]]=1\n wacount+=walist[p[i]]\nAnswer=[account,wacount]\nprint(*Answer)"]
['Runtime Error', 'Accepted']
['s422077607', 's668689990']
[3064.0, 14936.0]
[18.0, 398.0]
[403, 418]
p02802
u692498898
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())\ncollect=[]\npen=[]\nsum=0\nfor i in range(m):\n p,s=input().split()\n if p not in collect:\n if s=='WA':\n pen.append(p)\n else:\n collect.append(p)\n sum=sum+pen.count(p)\nprint(len(collect),sum-len(list))", "n,m=map(int,input().split())\nlist=[]\nsum=0\nfor i in range(m):\n p,s=input().split()\n if s='AC':\n list.append(p)\n else:\n if p not in list:\n sum=sum+1\nprint(sum)", "n,m=map(int,input().split())\nlist=[]\nsum=0\nfor i in range(m):\n p,s=input().split()\n if s=='AC':\n list.append(p)\n else:\n if p not in list:\n sum=sum+1\nprint(sum)", "n,m=map(int,input().split())\nac=[0]*(n+1)\nwa=[0]*(n+1)\nfor i in range(m):\n p,s=input().split()\n if ac[int(p)]!=1:\n if s=='WA':\n wa[int(p)]=wa[int(p)]+1\n else:\n ac[int(p)]=1\nfor i in range(n+1):\n if ac[i]==0:\n wa[i]=0\nprint(sum(ac),sum(wa))"]
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s148061207', 's300480506', 's522236860', 's346880234']
[9372.0, 2940.0, 9488.0, 4596.0]
[2104.0, 17.0, 1987.0, 305.0]
[247, 172, 173, 261]
p02802
u693933222
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())\nan = []\n\nif(m != 0):\n for i in range(m):\n tp = list(map(str, input().split()))\n tp[0] = int(tp[0])\n an.append(tp)\n\n print(an)\n\n sc = 0\n er = 0\n\n flag = 0\n prob = an[0][0]\n for i in range(m):\n pr = an[i][0]\n ans = an[i][1]\n if (prob != pr):\n flag = 0\n prob = pr\n if(flag == 0 and ans == "AC"):\n sc += 1\n flag = 1\n elif (flag == 0 and ans == "WA"):\n er += 1\n\nelse:\n sc = 0\n er = 0\n\nprint("{} {}".format(sc, er))\n', 'from operator import itemgetter\n\nn, m = map(int, input().split())\n\nan = [0]*n\n\nsc = 0\ner = 0\n\nfor i in range(m):\n t, s = map(str, input().split())\n p = int(t)-1\n if (an[p] != m+1 and s == "AC"):\n sc += 1\n er += an[p]\n an[p] = m+1\n elif (an[p] != m+1 and s == "WA"):\n an[p] += 1\n\n\nprint("{} {}".format(sc, er))\n']
['Wrong Answer', 'Accepted']
['s511481953', 's496019662']
[34076.0, 7028.0]
[470.0, 366.0]
[581, 350]
p02802
u695079172
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\n\n\ndef main():\n n,m = map(int,input().split())\n d = dict()\n for i in range(m):\n a,b = input().split()\n a = int(a)\n if a not in d:\n d[a] = [0]\n if d[a][-1] != "AC":\n d[a].append(b)\n ac = 0\n pe = 0\n print(d)\n for i in d.values():\n #print(i)\n if i[-1] == "AC":\n ac += 1\n pe += i.count("WA")\n print(ac,pe)\n\n\n\n\n\n\n\n\nif __name__ == \'__main__\':\n main()\n', '\n\n\n\ndef main():\n n,m = map(int,input().split())\n d = dict()\n for i in range(m):\n a,b = input().split()\n a = int(a)\n if a not in d:\n d[a] = [0]\n if d[a][-1] != "AC":\n d[a].append(b)\n ac = 0\n pe = 0\n #print(d)\n for i in d.values():\n #print(i)\n if i[-1] == "AC":\n ac += 1\n pe += i.count("WA")\n print(ac,pe)\n\n\n\n\n\n\n\n\nif __name__ == \'__main__\':\n main()\n']
['Wrong Answer', 'Accepted']
['s529452037', 's055216848']
[34112.0, 29380.0]
[456.0, 372.0]
[455, 460]
p02802
u695474809
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())\ncorrect = [0]*N\npenalty = [0]*N\nans_c,ans_p = 0,0\nfor i in range(M):\n p,s = input().split()\n p = int(p)\n if s=="AC":\n if correct[p-1]==0:\n correct[p-1]+=1\n if s=="WA":\n if correct[p-1]==0:\n penalty[p-1]+=1\n \nans_penalty = 0\nfor i in range(N):\n if correct[i]!=1:\n ans_penalty+=penalty[i]\nprint(sum(correct),ans_penalty)\n', 'N,M = map(int,input().split())\ncorrect = [0]*N\npenalty = [0]*N\nans_c,ans_p = 0,0\nfor i in range(M):\n p,s = input().split()\n p = int(p)\n if s=="AC":\n if correct[p-1]==0:\n correct[p-1]+=1\n if s=="WA":\n if correct[p-1]==0:\n penalty[p-1]+=1\n\nans_penalty = 0\nfor i in range(N):\n if correct[i]>=1:\n ans_penalty+=penalty[i]\nprint(sum(correct),ans_penalty)']
['Wrong Answer', 'Accepted']
['s127680540', 's977125373']
[10420.0, 10416.0]
[200.0, 201.0]
[419, 406]
p02802
u698176039
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.
["\nN,M = map(int,input().split())\nps = [list(map(str,input().split())) for _ in range(M)]\n\nwacnt = [0]*(N+1)\nis_ac = [False]*(N+1)\nfor pp,s in ps:\n p = int(pp)\n if s=='AC':\n is_ac[p] = True\n else:\n if not is_ac[p]:\n wacnt[p] += 1\n\nans = 0\nfor l in range(N+1):\n if is_ac[l]:\n ans += wacnt[l]\n \nprint(ans)", "\nN,M = map(int,input().split())\nps = [list(map(str,input().split())) for _ in range(M)]\n\nwacnt = [0]*(N+1)\nis_ac = [False]*(N+1)\nfor pp,s in ps:\n p = int(pp)\n if s=='AC':\n is_ac[p] = True\n else:\n if not is_ac[p]:\n wacnt[p] += 1\nnum = 0\nans = 0\nfor l in range(N+1):\n if is_ac[l]:\n ans += wacnt[l]\n num += 1\n \nprint(num,ans)"]
['Wrong Answer', 'Accepted']
['s451848196', 's104008658']
[33676.0, 33692.0]
[372.0, 361.0]
[350, 377]
p02802
u698309473
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 -*-\n\nN,M = list(map(int, input().split()))\n\nAC = [False for _ in range(N)]\nWA = [0 for _ in range(N)]\n\nfor _ in range(M):\n p,s = input().split()\n p = int(p)\n if AC[p]:\n continue\n if s=='AC':\n AC[p] = True\n else:\n WA[p] += 1\n\nprint(sum(AC), sum(WA))", "# -*- coding: utf-8 -*-\n\nN,M = list(map(int, input().split()))\n\nAC = [False for _ in range(N)]\nWA = [0 for _ in range(N)]\ntotal_WA = 0\n\nfor _ in range(M):\n p,s = input().split()\n p = int(p)-1\n if AC[p]:\n continue\n if s=='AC':\n AC[p] = True\n total_WA += WA[p]\n else:\n WA[p] += 1\n\nprint(sum(AC), total_WA)"]
['Runtime Error', 'Accepted']
['s326535608', 's602417200']
[4656.0, 4656.0]
[269.0, 280.0]
[304, 346]
p02802
u698437687
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()\nm = int(m)\nif m == 0:\n print("0 0")\nelse:\n penalty = {}\n score = 0\n last = False\n for i in range(0, m):\n b = input().split()\n if b[1] == \'AC\':\n if b[0] not in penalty.keys():\n score += 1\n penalty[b[0]] = 0\n last = True\n elif b[1] == \'WA\':\n if last and b[0] in penalty.keys():\n continue\n else:\n if b[0] not in penalty.keys():\n penalty[b[0]] = 1\n else:\n penalty[b[0]] += 1\n last = False\n print(str(score) + " " + str(sum(penalty.values())))\n', 'n, m = map(int, input().split())\nif m == 0:\n print("0 0")\nelse:\n p = 0\n p_flag = [0] * n\n s = 0\n s_flag = [0] * n\n for i in range(m):\n b = input().split()\n b[0] = int(b[0])\n if b[1] == \'AC\':\n if s_flag[b[0] - 1] == 0:\n s += 1\n s_flag[b[0] - 1] = 1\n p += p_flag[b[0] - 1]\n else:\n p_flag[b[0] - 1] += 1\n print(str(s) + " " + str(p))\n']
['Wrong Answer', 'Accepted']
['s468495373', 's583067898']
[17120.0, 4596.0]
[269.0, 304.0]
[669, 447]
p02802
u700929101
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_count = 0\nwa_count = 0\np_dic = {}\n\nfor i in range(m):\n x = list(map(str,input().split(" ")))\n x0 = int(x[0])\n x1 = str(x[1])\n if x0 not in p_dic:\n if x1 == "AC":\n ac_count += 1\n p_dic[x0] = 1\n else:\n wa_count += 1\n p_dic[x0] = 0\n print(p_dic)\n else:\n if x1 == "AC":\n if p_dic[x0] == 1:\n pass\n else:\n ac_count += 1\n p_dic[x0] = 1\n print(p_dic)\n else:\n if p_dic[x0] == 1:\n pass\n else:\n wa_count += 1\n p_dic[x0] = 0\n print(p_dic)\nprint(ac_count,wa_count)', 'n,m = list(map(int,input().split(" ")))\nac_count = 0\nwa_list = [0]*n\nac_list = [0]*n\n\nfor i in range(m):\n x = list(map(str,input().split(" ")))\n x0 = int(x[0])\n x1 = str(x[1])\n if ac_list[x0-1] == 1:\n pass\n else:\n if x1 == "AC":\n ac_count += 1\n ac_list[x0-1] = 1\n else:\n wa_list[x0-1] += 1\n\nacnone =[i for i, x in enumerate(ac_list) if x == 0]\nif not acnone:\n pass\nelse:\n for i in acnone:\n wa_list[i] = 0\nwa_count = sum(wa_list)\nprint(ac_count,wa_count)']
['Wrong Answer', 'Accepted']
['s568708678', 's039710571']
[125108.0, 8728.0]
[2104.0, 416.0]
[756, 535]
p02802
u702786238
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\ncor = 0\npenalty = 0\ndic = {}\nfor i in range(M):\n p, S = input().split()\n p = int(p)\n if p not in dic:\n dic[p] = "_"\n if (S == "AC") & (dic[p] != "AC"):\n dic[p] = "AC"\n cor = cor+1\n continue\n elif (S == "WA") & (dic[p] != "AC"):\n penalty = penalty + 1\n \nprint("{} {}"penalty)', 'N, M = map(int, input().split())\n\npenalty = 0\ndic = {}\nfor i in range(M):\n p, S = input().split()\n p = int(p)\n if p not in dic:\n dic[p] = "_"\n if S == "AC":\n dic[p] = "AC"\n continue\n elif (S == "WA") & (dic[p] != "AC"):\n penalty = penalty + 1\n \nprint(penalty)', 'N, M = map(int, input().split())\n \ncor = 0\npenalty = 0\ndic_penalty = {}\ndic = {}\nfor i in range(M):\n p, S = input().split()\n p = int(p)\n if p not in dic:\n dic[p] = "_"\n dic_penalty[p] = 0\n if (S == "AC") & (dic[p] != "AC"):\n dic[p] = "AC"\n cor = cor+1\n penalty = penalty + dic_penalty[p]\n continue\n elif (S == "WA") & (dic[p] != "AC"):\n dic_penalty[p] = dic_penalty[p] + 1\n \nprint("{} {}".format(cor, penalty))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s465292417', 's618812613', 's668797357']
[3060.0, 15116.0, 21216.0]
[17.0, 282.0, 345.0]
[331, 279, 439]
p02802
u706330549
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\np = [0] * m\ns = [0] * m\nac = [0] * n\nwa = [0] * n\n\nfor i in range(m):\n p[i], s[i] = input().split()\n \nfor i in range(m):\n if ac[p[i] - 1] == 0:\n if s[i] == 'AC':\n ac[p[i] - 1] = 1\n else:\n wa[p[i] - 1] += 1\n\nfor i in range(n):\n if ac[i] == 0:\n wa[i] = 0\n\nprint(sum(ac), sum(wa))", "n, m = map(int, input().split())\n\np = [0] * m\ns = [0] * m\nac = [0] * n\nwa = [0] * n\n\nfor i in range(m):\n p[i], s[i] = input().split()\n\np = [int(i) for i in p]\n \nfor i in range(m):\n if ac[p[i] - 1] == 0:\n if s[i] == 'AC':\n ac[p[i] - 1] = 1\n else:\n wa[p[i] - 1] += 1\n\nfor i in range(n):\n if ac[i] == 0:\n wa[i] = 0\n\nprint(sum(ac), sum(wa))\n"]
['Runtime Error', 'Accepted']
['s538567181', 's346850389']
[17268.0, 21296.0]
[193.0, 275.0]
[363, 389]
p02802
u708890186
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\nN,M=map(int,input().split())\nA=[]\nfor i in range(M):\n A.append(tuple(map(str,input().split())))\ncheck=np.zeros((N,2))\nfor i in range(M):\n if check[int(A[i][0])-1,0]==0:\n if A[i][1]=='WA':\n check[int(A[i][0])-1,1]+=1\n else:\n check[int(A[i][0])-1,0]+=1\nsum=check.sum(axis=0)\nprint(sum[0],sum[1])", "import numpy as np\nN,M=map(int,input().split())\nA=[]\nfor i in range(M):\n A.append(tuple(map(str,input().split())))\ncheck=np.zeros((N,2))\nfor i in range(M):\n if check[int(A[i][0])-1,0]==0:\n if A[i][1]=='WA':\n check[int(A[i][0])-1,1]+=1\n elif A[i][1]=='AC':\n check[int(A[i][0])-1,0]+=1\nfor i in range(N):\n if check[i,0]==0:\n check[i,1]=0\nsum=check.sum(axis=0)\nprint(int(sum[0]),int(sum[1]))"]
['Wrong Answer', 'Accepted']
['s083612890', 's653462916']
[32892.0, 32004.0]
[839.0, 946.0]
[330, 410]
p02802
u711245972
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())\nTF=[0]*n\np=[0]*n\nfor _ in range(m):\n i,s =map(str,input().split())\n i=int(i)-1\n if (s=="WA") and (TF[i]==1):\n pass\n elif (s=="WA") and (TF[i]==0):\n p[i]+=1\n elif (s=="AC") and (TF[i]==0):\n TF[i]=1\n elif (s=="AC") and (TF[i]==1):\n pass\nfor i in range(m):\n if TF[i]==0:\n p[i]=0\nac=sum(TF)\npe=sum(p)\nprint(ac,pe)', 'n,m=map(int,input().split())\nTF=[0]*n\np=[0]*n\nfor _ in range(m):\n i,s =map(str,input().split())\n i=int(i)-1\n if (s=="WA") and (TF[i]==1):\n pass\n elif (s=="WA") and (TF[i]==0):\n p[i]+=1\n elif (s=="AC") and (TF[i]==0):\n TF[i]=1\n elif (s=="AC") and (TF[i]==1):\n pass\nfor i in range(n):\n if TF[i]==0:\n p[i]=0\nac=sum(TF)\npe=sum(p)\nprint(ac,pe)']
['Runtime Error', 'Accepted']
['s621393207', 's227023656']
[4596.0, 4596.0]
[361.0, 364.0]
[394, 394]
p02802
u716660050
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 = []\nflag_AC = []\nflag_WA = []\n\nfor i in range(M):\n inp = input().split(" ")\n p.append(int(inp[0]))\n S.append(inp[1])\n\nfor i in range(N):\n flag_AC.append(0)\n flag_WA.append(0)\n\n\ndef Anc(n):\n L = []\n L.append(p[n])\n L.append(S[n])\n return L\n\nAC = 0\nWA = 0\n\nfor i in range(M):\n data = Anc(i)\n if data[1] == "AC":\n if flag_AC[data[0]] == 0:\n flag_AC[data[0]] = 1\n AC = AC + 1\n\n if data[1] == "WA":\n if flag_AC[data[0]] == 0:\n flag_WA[data[0]] = flag_WA[data[0]] + 1\n WA = WA+1\n\nprint(AC,WA)', 'N,M = map(int,input().split(" "))\np = []\nS = []\nflag_AC = []\nflag_WA = []\n\nfor i in range(M):\n inp = input().split(" ")\n p.append(int(inp[0]))\n S.append(inp[1])\n\nfor i in range(N):\n flag_AC.append(0)\n flag_WA.append(0)\n\n\ndef Anc(n):\n L = []\n L.append(p[n])\n L.append(S[n])\n return L\n\nAC = 0\nWA = 0\n\nfor i in range(M):\n data = Anc(i)\n if data[1] == "AC":\n if flag_AC[data[0]] == 0:\n flag_AC[data[0]] = 1\n AC = AC + 1\n\n if data[1] == "WA":\n if flag_AC[data[0]] == 0:\n flag_WA[data[0]] = flag_WA[data[0]] + 1\n\nfor i in range(M):\n data = Anc(i)\n if flag_AC[data[0]] == 0:\n flag_WA[data[0]] = 0\n else:\n flag_WA[data[0]] = flag_WA[data[0]] + 1\n\nprint(AC,WA)', "N,M=map(int,input().split())\nac=[0]*N\nwa=[0]*N\npena=0\nacsum=0\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 pena+=wa[p]\n acsum+=1\n else:\n wa[p]+=1\nprint(acsum,pena)"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s107935419', 's804373882', 's294007175']
[14980.0, 14972.0, 4596.0]
[352.0, 397.0, 292.0]
[666, 799, 268]
p02802
u718300386
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\nP = 0\nN,M = map(int,input().strip().split())\nif M == 0:\n print("{0} {1}".format(0,P))\n sys.exit()\nans_list = [list(input().strip().split()) for _ in range(M)]\nresult = [False] * N\nfor ans in ans_list:\n if result[int(ans[0])-1] != True\n if ans[1] == "WA":\n P += 1\n elif ans[1] == "AC":\n result[int(ans[0])-1] = True\nprint("{0} {1}".format(result.count(True),P))', 'import sys\nP = 0\nN,M = map(int,input().strip().split())\nif M == 0:\n print("{0} {1}".format(0,P))\n sys.exit()\nans_list = [list(input().strip().split()) for _ in range(M)]\nresult = [False] * N\nfor ans in ans_list:\n if int(ans[0]) <= N and result[int(ans[0])-1] != True\n if ans[1] == "WA":\n P += 1\n elif ans[1] == "AC":\n result[int(ans[0])-1] = True\nprint("{0} {1}".format(result.count(True),P))', 'import sys\nP = 0\nN,M = map(int,input().strip().split())\nif M == 0:\n print("{0} {1}".format(0,0))\n sys.exit()\nans_list = [list(input().strip().split()) for _ in range(M)]\nresult = [False] * N\nwa_count = [0] * N\nfor ans in ans_list:\n if result[int(ans[0])-1] != True:\n if ans[1] == "WA":\n wa_count[int(ans[0])-1] += 1\n elif ans[1] == "AC":\n result[int(ans[0])-1] = True\nfor i in range(len(result)):\n if result[i] == True:\n P += wa_count[i]\nprint("{0} {1}".format(result.count(True),P))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s514960576', 's689708719', 's748206219']
[2940.0, 3064.0, 27448.0]
[17.0, 17.0, 316.0]
[416, 437, 538]
p02802
u718949306
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 = list()\nfor m in range(M):\n l = input().split()\n L.append(l)\nAC = 0\nWA = 0\ncnt = 0\nfor m in range(M):\n res = False\n if L[m][1] == 'AC':\n AC += 1\n res = True\n if res:\n cnt += 1\n elif L[m][1] == 'WA':\n WA += 1\n if int(L[m][0]) == N and res == True:\n break\nprint('{} {}'.format(AC // cnt, WA))\n", "N, M = map(int, input().split())\nL = list()\nfor m in range(M):\n l = input().split()\n L.append(l)\nAC = 0\nWA = 0\ncnt = 0\nA = 0\nman = 0\nfor m in range(M):\n man = L[m][0]\n if L[m][1] == 'AC':\n A = 0\n if cnt == L[m][0]:\n continue\n A += 1\n AC += 1\n cnt = L[m][0]\n if L[m][1] == 'WA':\n if A > 0 and man == L[m][0]:\n continue\n WA += 1\nprint('{} {}'.format(AC, WA))", "N, M = map(int, input().split())\nL = list()\nfor m in range(M):\n l = input().split()\n L.append(l)\nAC = 0\nWA = 0\ncnt = 0\nfor m in range(M):\n res = False\n if L[m][1] == 'AC':\n AC += 1\n res = True\n if res:\n cnt += 1\n elif L[m][1] == 'WA':\n WA += 1\n if int(L[m][0]) == N and res == True:\n break\nif AC > 0:\n AC = AC // cnt\nprint('{} {}'.format(AC, WA))\n", "N, M = map(int, input().split())\nAC = [0]*N\nWA = [0]*N\nL = []\nfor m in range(M):\n p, S = map(str, input().split())\n p = int(p)\n L.append([p, S])\nfor m in range(M):\n if not AC[L[m][0]-1] == 0:\n continue \n if L[m][1] == 'AC':\n AC[L[m][0]-1] = 1\n elif L[m][1] == 'WA':\n WA[L[m][0]-1] += 1\nA = sum(AC)\nW = 0\nfor n in range(N):\n if AC[n] == 1:\n W += WA[n]\nprint(A, W)"]
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s127810515', 's257599676', 's725933641', 's035831418']
[32140.0, 32124.0, 32140.0, 23520.0]
[275.0, 260.0, 276.0, 398.0]
[391, 444, 414, 414]
p02802
u720558413
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\nN, M = map(int,input().split())\nAC = np.array([0 for i in range(N)])\nWA = np.array([0 for i in range(N)])\n\nfor _ in range(M):\n p, S = map(str,input().split())\n p = int(p)\n if AC[p-1] == 0 and S == 'AC':\n AC[p-1] += 1\n elif AC[p-1] == 0 and S == 'WA':\n WA[p-1] += 1\n \nfor i in range(N):\n if AC[i] >= 1:\n WA[i] = 0\n \nprint(AC.sum(),WA.sum())\n \n ", "import numpy as np\n\nN, M = map(int,input().split())\nAC = np.array([0 for i in range(N)])\nWA = np.array([0 for i in range(N)])\n\nfor _ in range(M):\n p, S = map(str,input().split())\n p = int(p)\n if AC[p-1] == 0 and S == 'AC':\n AC[p-1] += 1\n elif AC[p-1] == 0 and S == 'WA':\n WA[p-1] += 1\n \nfor i in range(N):\n if AC[i] == 1:\n WA[i] = 0\n \nprint(AC.sum(),WA.sum())\n \n ", "import numpy as np\n\nN, M = map(int,input().split())\nAC = np.array([0 for i in range(N)])\nWA = np.array([0 for i in range(N)])\n\nfor _ in range(M):\n p, S = map(str,input().split())\n p = int(p)\n if AC[p-1] == 0 and S == 'AC':\n AC[p-1] += 1\n elif AC[p-1] == 0 and S == 'WA':\n WA[p-1] += 1\n \nfor i in range(N):\n if AC[i] == 0:\n WA[i] = 0\n \nprint(AC.sum(),WA.sum())\n \n "]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s160652716', 's712066307', 's016352665']
[28984.0, 28944.0, 29008.0]
[436.0, 473.0, 463.0]
[389, 389, 389]
p02802
u723345499
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 _ in range(m)]\n\nseito = 0\npena = 0\n\nfor i in range(n):\n flg = False\n for j in range(m):\n if sp[j][0] == i and ps[j][1] == "AC":\n if flg == False:\n seito += 1\n flg = True\n elif ps[j][0] == i and ps[j][1] == "WA":\n if flg == False:\n pena += 1\n else:\n pass\n\nprint(seito, pena)', 'n, m = map(int, input().split())\nps = [list(input().split()) for _ in range(m)]\n\nseito = 0\npena = 0\n\nstr_list = ["WA"] * n \nint_list = [0] * n\u3000\u3000\nnum = 0\nac = 0 \n\nfor p_, s in ps: \n p = int(p_) - 1\n if s == "AC":\n str_list[p] = "AC" \n else: # s!= WA\n if str_list[p] !="AC": \n int_list[p] += 1 \n\nfor i in range(n): #\n if str_list[i] == "AC": ペナルティはACできた問題のみ\n num += int_list[i] \n ac += 1\u3000\u3000\u3000\u3000\u3000\u3000\n\nprint(ac, num)', 'n, m = map(int, input().split())\nps = [list(input().split()) for _ in range(m)]\n\nseito = 0\npena = 0\n\nfor i in range(1, n+1):\n flg = False\n for j in range(m):\n if ps[j][0] == i and ps[j][1] == "AC":\n if flg == False:\n seito += 1\n flg = True\n elif ps[j][0] == i and ps[j][1] == "WA":\n if flg == False:\n pena += 1\n else:\n pass\n\nprint(seito, pena)', 'from collections import defaultdict\n\nn, m = map(int, input().split()) \n\nd = defaultdict(int)\nans = 0\npena = 0\n\nfor _ in range(m):\n p, s = input().split()\n if s == "AC":\n if d[p] == -1:\n continue\n else:\n ans += 1\n pena += d[p]\n d[p] = -1\n else:\n if d[p] == -1:\n continue\n else;\n d[p] += 1\n\nprint(ans, pena)', 'n, m = map(int, input().split())\nps = [list(input().split()) for _ in range(m)]\n\nstr_list = ["WA"] * n \nint_list = [0] * n \nnum = 0\nac = 0 \n\nfor p_, s in ps: \n p = int(p_) - 1\n if s == "AC":\n str_list[p] = "AC" \n else: # s!= WA\n if str_list[p] !="AC": \n int_list[p] += 1 \n\nfor i in range(n): \n if str_list[i] == "AC": ペナルティはACできた問題のみ\n num += int_list[i] \n ac += 1 \n\nprint(ac, num)', 'n, m = map(int, input().split())\nps = [list(input().split()) for _ in range(m)]\n\nstr_list = ["WA"] * n \nint_list = [0] * n \nnum = 0\nac = 0 \n\nfor p_, s in ps: \n p = int(p_) - 1\n if s == "AC":\n str_list[p] = "AC" \n else: # s!= WA\n if str_list[p] !="AC": \n int_list[p] += 1 \n\nfor i in range(n): \n if str_list[i] == "AC": \n num += int_list[i] \n ac += 1 \n\nprint(ac, num)']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s159059443', 's286652518', 's546319760', 's742552222', 's788921180', 's135575972']
[25908.0, 2940.0, 26444.0, 2940.0, 3188.0, 27464.0]
[228.0, 17.0, 2105.0, 17.0, 18.0, 286.0]
[464, 711, 449, 408, 678, 681]
p02802
u723583932
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\nimport sys\nn,m=map(int,input().split())\nps=[]\nnum={}\n\nac=0\npena=0\nif m==0:\n print(\'0 0\')\n sys.exit()\nfor i in range(m):\n result=input().split()\n ps.append(result)\n\nfor x in ps:\n if x[0] not in num:\n num[x[0]]=0\n if x[1]=="WA" and num[x[0]]==0:\n pena+=1\n if x[1]=="AC" and num[x[0]]==0:\n ac+=1\n num[x[0]]=1\nprint(ac," ",pena)\n', '#c welcome to atcoder\nimport sys\nn,m=map(int,input().split())\nps=[]\nnum=[]\n\nac=0\npena=0\nif m==0:\n print(\'0 0\')\n sys.exit()\nfor i in range(m):\n result=input().split()\n ps.append(result)\n if ps[i][0] not in num:\n num.append(ps[i][0])\nnow=0\ni=0\nfor x in ps:\n if x[0]!=num[now]:\n continue\n elif x[1]=="WA":\n pena+=1\n elif x[1]=="AC":\n ac+=1\n now+=1\n if now==len(num):\n break\nprint(ac," ",pena)\n', '#c welcome to atcoder\nimport sys\nn,m=map(int,input().split())\nps=[]\nnum={}\n\nac=0\npena=0\nif m==0:\n print(\'0 0\')\n sys.exit()\nfor i in range(m):\n result=input().split()\n ps.append(result)\n\nfor x in ps:\n print(x[0])\n if x[0] not in num:\n num[x[0]]=0\n print(num[x[0]])\n if x[1]=="WA" and num[x[0]]==0:\n pena+=1\n if x[1]=="AC" and num[x[0]]==0:\n ac+=1\n num[x[0]]=1\n\nprint(num)\n\nprint(ac,pena)', '#c welcome to atcoder\nimport sys\nn,m=map(int,input().split())\nps=[]\nnum={}\n\nac=0\npena=0\nif m==0:\n print(\'0 0\')\n sys.exit()\nfor i in range(m):\n result=input().split()\n ps.append(result)\n if result[1]=="AC":\n num[result[0]]=0\n\nfor x in ps:\n if not x[0] in num:\n continue\n if x[1]=="WA" and num[x[0]]==0:\n pena+=1\n if x[1]=="AC" and num[x[0]]==0:\n ac+=1\n num[x[0]]=1\n\nprint(ac,pena)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s301845763', 's466602856', 's620769125', 's325473237']
[41468.0, 30816.0, 43836.0, 38332.0]
[271.0, 2104.0, 448.0, 292.0]
[465, 469, 448, 445]
p02802
u723711163
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_of_probs, num_of_submission = [ int(i) for i in input().split(" ") ]\n\nsolution_table = {}\n\nfor i in range(0, num_of_submission):\n prob, result = [ i for i in input().split(" ") ]\n\n if solution_table.get(int(prob)) == None:\n solution_table[int(prob)] = {"WA": 0, "AC": 0}\n\n if result == "WA":\n if solution_table[int(prob)]["AC"] == 0:\n solution_table[int(prob)]["WA"] += 1\n else:\n solution_table[int(prob)]["AC"] += 1\n\ntotal_wa = 0\nfor value in solution_table.values():\n total_wa += value[\'WA\']\n\nprint( total_wa )', 'num_of_probs, num_of_submission = [ int(i) for i in input().split(" ") ]\n\nsolution_table = {}\n\nfor i in range(0, num_of_submission):\n prob, result = [ i for i in input().split(" ") ]\n\n if solution_table.get(int(prob)) == None:\n solution_table[int(prob)] = {"WA": 0, "AC": 0}\n\n if result == "WA":\n if solution_table[int(prob)]["AC"] == 0:\n solution_table[int(prob)]["WA"] += 1\n else:\n solution_table[int(prob)]["AC"] += 1\n \n print(solution_table)\n\ntotal_wa = 0\nfor value in solution_table.values():\n total_wa += value[\'WA\']\n\nprint( total_wa )\n \n ', 'num_of_probs, num_of_submission = [ int(i) for i in input().split(" ") ]\n\nsolution_table = {}\n\nfor i in range(0, num_of_submission):\n prob, result = [ i for i in input().split(" ") ]\n\n if solution_table.get(int(prob)) == None:\n solution_table[int(prob)] = {"WA": 0, "AC": 0}\n\n if result == "WA":\n if solution_table[int(prob)]["AC"] == 0:\n solution_table[int(prob)]["WA"] += 1\n else:\n if solution_table[int(prob)]["AC"] == 0:\n solution_table[int(prob)]["AC"] += 1\n\ntotal_ac = 0\ntotal_wa = 0\nfor value in solution_table.values():\n if value[\'AC\'] > 0:\n total_wa += value[\'WA\']\n total_ac += value[\'AC\']\n\nprint( total_ac, total_wa )']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s734171987', 's783999640', 's767491765']
[42004.0, 83444.0, 42036.0]
[529.0, 2104.0, 557.0]
[535, 568, 657]
p02802
u729133443
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.
["w,*d=[0]*10**6\na={0}\nfor t in open(0):\n p,s=t.split()\n p=int(p)\n if'AC'==s*(not p in a):w+=d[p];a|={p}\n d[p]+=1\nprint(len(a)-1,w)", "w,*d=[0]*10**6\na={0}\nfor t in open(0):\n p,s=t.split()\n p=int(p)\n if'AC'==s*(not p in a):w+=d[p];a|={p}\n d[p]+=s>'V'\nprint(len(a)-1,w)"]
['Wrong Answer', 'Accepted']
['s473694625', 's454065779']
[22124.0, 22892.0]
[181.0, 194.0]
[133, 137]
p02802
u729307047
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.
['listA=[] \nwhile True:\n try:\n listA.append(list(map(int,input().split())))\n\n except:\n break;\n \nN = listA[0][0]\nM = listA[0][1]\n\nans = [0] * N\npena = [0] * N\n\nfor i in range(1, M):\n num=listA[i][0] -1\n res=listA[i][1]\n if(res=="WA" and ans[num] == 0):\n pena[num] = pena[num]+1\n if(res=="AC"):\n ans[num] = ans[num] + 1 \n \nprint(\'%d %d\' % (sum(ans), sum(pena) ))', 'listA=[] \nwhile True:\n try:\n listA.append(list(map(int,input().split())))\n\n except:\n break;\n \nN = listA[0][0]\nM = listA[0][1]\nans = [0] * N\npena = [0] * N\n \n \nfor i in range(1, M):\n num=listA[i][0] -1\n res=listA[i][1]\n if res=="WA" and ans[num] == 0:\n pena[num] = pena[num]+1\n if res=="AC":\n ans[num] = ans[num] + 1\n \nprint(\'%d %d\' % (sum(ans), sum(pena) ))\n', 'listA=[] \nwhile True:\n try:\n listA.append(list(map(int,input().split())))\n\n except:\n break;\n \nN = listA[0][0]\nM = listA[0][1]\n\nans = []\npena = []\nfor i in range(N): \n ans.insert(0,0)\n pena.insert(0,0)\nfor i in range(M):\n num=listA[i+1][0] -1\n res=listA[i+1][1]\n if(res=="WA" and ans[num] == 0):\n pena[num] = pena[num]+1\n if(res=="AC"):\n ans[num] = ans[num] + 1 \nprint(sum(ans),sum(pena))\n ', 'listA=[] \nwhile True:\n try:\n listA.append(list(map(int,input().split())))\n\n except:\n break;\n \nN = listA[0][0]\nM = listA[0][1]\n\nans = [0] * N\npena = [0] * N\n\n', 'listA=[] \nwhile True:\n try:\n listA.append(list(map(int,input().split())))\n\n except:\n break;\n \nN = listA[0][0]\nM = listA[0][1]\nans = [0] * N\npena = [0] * N\n \n \nfor i in range(1, M-1):\n num=listA[i][0] -1\n res=listA[i][1]\n if(res=="WA" and ans[num] == 0):\n pena[num] = pena[num]+1\n if(res=="AC"):\n ans[num] = ans[num] + 1 \n \nprint(\'%d %d\' % (sum(ans), sum(pena) ))', 'listA=[] \nwhile True:\n try:\n listA.append(list(map(int,input().split())))\n\n except:\n break;\n \nN = listA[0][0]\nM = listA[0][1]\n\nans = [0] * N\npena = [0] * N\n\nfor i in range(M):\n num=listA[i+1][0] -1\n res=listA[i+1][1]\n if(res=="WA" and ans[num] == 0):\n pena[num] = pena[num]+1\n if(res=="AC"):\n ans[num] = ans[num] + 1 \n \nprint(\'%d %d\' % (sum(ans), sum(pena) ))', 'listA=[] \nwhile True:\n try:\n listA.append(input().split())\n except:\n break;\n \nN = int(listA[0][0])\nM = int(listA[0][1])\n\nans = [0] * N\npena = [0] * N\n\nfor i in range(1, M+1):\n num=int(listA[i][0]) -1\n res=listA[i][1]\n if res=="WA" and ans[num] == 0:\n pena[num] = pena[num]+1\n if res=="AC" and ans[num] == 0:\n ans[num] = 1\n \nprint(\'%d %d\' % (sum(ans), sum(x*y for x,y in zip(ans,pena) ) ))\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s126577511', 's174803884', 's302386195', 's617176438', 's663507192', 's986950427', 's066728696']
[4596.0, 4596.0, 4100.0, 4596.0, 4596.0, 4596.0, 33696.0]
[19.0, 19.0, 2104.0, 19.0, 19.0, 19.0, 285.0]
[474, 467, 488, 218, 492, 465, 485]
p02802
u729939940
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\nN, M, *PS = sys.stdin.read().strip().split()\nN = int(N)\nac = [0] * N\nwa = [0] * N\nfor p, s in zip(*[iter(PS)] * 2):\n p = int(p) -1\n if s == "AC":\n ac[p] = 1\n elif ac[p] == 0:\n wa[p] += 1\npenalties = sum([w or a for a, w in zip(ac, wa)])\nprint("{} {}".format(sum(ac),penalties)', 'import sys\nN, M, *PS = sys.stdin.read().strip().split()\nN = int(N)\nac = [0] * N\nwa = [0] * N\nfor p, s in zip(*[iter(PS)] * 2):\n p = int(p) - 1\n if s == "AC":\n ac[p] = 1\n elif ac[p] == 0:\n wa[p] += 1\npenalties = sum(w * a else 0 for a, w in zip(ac, wa))\nprint(sum(ac), penalties)', 'import sys\nN, M = map(int, input().split())\nPS = sys.stdin.read().strip().split()\nac, wa = [0] * N, [0] * N\nfor p, s in zip(*[iter(PS)] * 2):\n p = int(p) - 1\n if s == "AC":\n ac[p] = 1\n elif ac[p] == 0:\n wa[p] += 1\npenalties = sum(w if a > 0 else 0 for a, w in zip(ac, wa))\nprint(sum(ac), penalties)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s102462621', 's366940923', 's722277406']
[3064.0, 2940.0, 18124.0]
[17.0, 17.0, 92.0]
[296, 287, 307]
p02802
u731322489
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] * n\nAC = [0] * n\n\nfor i in range(m):\n p, s = map(str, input().split())\n p = int(p) - 1\n if s == "AC":\n AC[p] = 1\n elif s == "WA" and AC[p] == 0:\n WA[p] += 1\n\nWA = [WA[i] for i in range(m) if AC[i] >= 1]\n\nprint(sum(AC), sum(WA))', 'n, m = map(int, input().split())\nWA = [0] * n\nAC = [0] * n\n\nfor i in range(m):\n p, s = map(str, input().split())\n p = int(p) - 1\n if s == "AC":\n AC[p] = 1\n elif s == "WA" and AC[p] == 0:\n WA[p] += 1\n\nfor i in range(n):\n WA[i] = 0 if AC[i] == 0 else WA[i]\n\nprint(sum(AC), sum(WA))\n']
['Runtime Error', 'Accepted']
['s133630885', 's713393528']
[5528.0, 4596.0]
[352.0, 365.0]
[295, 309]
p02802
u732061897
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_dict = {}\nis_AC = []\nac_cnt = 0\nfor i in range(N):\n p, s = input().split()\n p = int(p)\n if s == 'WA':\n if is_AC.count(p) == 0:\n if wa_dict.get(p) is None:\n wa_dict[p] = 1\n else:\n wa_dict[p] += 1\n else:\n continue\n else:\n if is_AC.count(p) == 0:\n ac_cnt += 1\n is_AC.append(p)\n\nprint(ac_cnt, sum(wa_dict.values()))\n", "N, M = map(int, input().split())\nac = 0\nis_AC = [False] * (10 ** 5) + 1\nWA_cnt = [0] * (10 ** 5) + 1\nfor i in range(M):\n p, s = input().split()\n p = int(p)\n if s == 'WA':\n if is_AC[p]:\n continue\n else:\n WA_cnt[p] += 1\n else:\n if is_AC[p]:\n continue\n else:\n is_AC[p] = True\n ac += 1\n\nprint(ac, sum(WA_cnt))\n\n", "N, M = map(int, input().split())\nac = [False] * N\nwa_cnt = [0] * N\nac_cnt = 0\nfor i in range(M):\n p, s = input().split()\n p_i = int(p) - 1\n if s == 'WA':\n if not ac[p_i]:\n wa_cnt[p_i] += 1\n else:\n if not ac[p_i]:\n ac[p_i] = True\n ac_cnt += 1\n\nwa_cnt_sum = 0\nfor i in range(N):\n if ac_cnt[i]:\n wa_cnt_sum += wa_cnt[i]\n\nprint(ac_cnt,wa_cnt_sum)\n", "N, M = map(int, input().split())\nac = [False] * N\nwa_cnt = [0] * N\nac_cnt = 0\nfor i in range(M):\n p, s = input().split()\n p_i = int(p) - 1\n if s == 'WA':\n if not ac[p_i]:\n wa_cnt[p_i] += 1\n else:\n if not ac[p_i]:\n ac[p_i] = True\n ac_cnt += 1\n\nwa_cnt_sum = 0\nfor i in range(N):\n if ac[i]:\n wa_cnt_sum += wa_cnt[i]\n\nprint(ac_cnt,wa_cnt_sum)\n"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s159314642', 's427501626', 's619470923', 's007089410']
[14180.0, 9528.0, 10324.0, 10380.0]
[2205.0, 25.0, 187.0, 194.0]
[466, 402, 412, 408]
p02802
u734603233
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\npen = [0] * n\npen_count = 0\nfor i in range(m):\n p, s = input().split()\n p = int(p) - 1\n if ac[p] == "AC":\n continue\n elif s == "AC":\n ac[p] = "AC"\n else:\n pen[p] += 1\n\nfor i in range(n):\n if ac[i] == "AC":\n pen_count = pen[i]\n\nprint(ac.count("AC"), pen_count)\n', 'n, m = map(int, input().split())\nac = [0] * n\npen = [0] * n\npen_count = 0\nfor i in range(m):\n p, s = input().split()\n p = int(p) - 1\n if ac[p] == "AC":\n continue\n elif s == "AC":\n ac[p] = "AC"\n else:\n pen[p] += 1\n \nfor i in range(n):\n if ac[i] == "AC":\n pen_count += pen[i]\n \nprint(ac.count("AC"), pen_count)']
['Wrong Answer', 'Accepted']
['s047333945', 's885550382']
[4596.0, 4596.0]
[290.0, 281.0]
[352, 354]
p02802
u735175408
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_list=[N*0]\nPS=[list(map(str,input().split())) for i in range(M) ]\nans=0\npena=0\nfor x in range(M):\n if PS[x][0] not in A_list:\n if PS[x][1]=='AC':\n A_list.append(PS[x][0])\n ans+=1\n \n elif PS[x][0] not in A_list:\n if PS[x][1]=='WA':\n pena+=1\n\nprint(ans,pena)", "N,M=map(int,input().split())\nA_list=[N*0]\nPS=[list(map(str,input().split())) for i in range(M) ]\nans=0\npena=0\nfor x in range(M):\n if PS[x][0] not in A_list:\n if PS[x][1]=='AC':\n A_list.append(PS[x][0])\n ans+=1\n \n elif PS[x][0] not in A_list:\n if PS[x][1]=='WA':\n pena+=1\n\nprint(ans,pena)", 'import sys\ninput = sys.stdin.readline\n \ndef main():\n N, M = map(int, input().split())\n \n ac_check = [False] * N\n p_counts = [0] * N\n \n for i in range(M):\n p, s = input().strip().split()\n p = int(p) - 1\n if s == "AC":\n if not ac_check[p]:\n ac_check[p] = True\n else:\n if not ac_check[p]:\n p_counts[p] += 1\n \n ac_count = 0\n p_count = 0\n for i in range(N):\n if ac_check[i]:\n ac_count += 1\n p_count += p_counts[i]\n print(ac_count, p_count)\n \n \nif __name__ == "__main__":\n main()']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s337056164', 's344654106', 's646737241']
[32284.0, 32284.0, 4596.0]
[2106.0, 2106.0, 124.0]
[343, 343, 703]
p02802
u736149053
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())\nacc = [False] * N\npen = 0\nfor _ in range(M):\n\tp, S = input().split()\n\tp = int(p) - 1\n\tif S[0] == 'A':\n\t\tacc[p] = True\n\telse:\n\t\tif not acc[p]:\n pen += 1\nprint('{} {}'.format(sum(acc), pen))", "N, M = map(int, input().split())\nacc = [False] * N\npen = 0\nfor _ in range(M):\n p, S = input().split()\n p = int(p) - 1\n if S[0] == 'A':\n acc[p] = True\n else:\n \tif not acc[p]:\n pen += 1\nprint('{} {}'.format(sum(acc), pen))\n", "import numpy as np\n\ndef main():\n # N, M = map(int, input().split())\n # PS = {}\n \n # row = input().split()\n # row[0] = int(row[0])\n # if row[0] not in PS:\n # PS[row[0]] = [row[1]]\n # else:\n # PS[row[0]].append(row[1])\n\n # n_correct = 0\n # n_penalty = 0\n # for p in PS:\n # if 'AC' in PS[p]:\n # n_correct += 1\n # for result in PS[p]:\n # if result == 'AC':\n # break\n # if result == 'WA':\n # n_penalty += 1\n \n # print('{} {}'.format(n_correct, n_penalty))\n\n N, M = map(int, input().split())\n accepted = [False] * N\n penalties = [0] * N\n for _ in range(M):\n q, res = input().split()\n q = int(q) - 1\n if res[0] == 'A':\n accepted[q] = True\n else:\n penalties[q] += 1\n\n s_acc = 0\n s_pen = 0\n for i in range(N):\n if accepted[i]:\n s_acc += 1\n s_pen += penalties[i]\n\n print('{} {}'.format(s_acc, s_pen))\n \n\nif __name__ == '__main__':\n main()", "import numpy as np\n\ndef main():\n # N, M = map(int, input().split())\n # PS = {}\n \n # row = input().split()\n # row[0] = int(row[0])\n # if row[0] not in PS:\n # PS[row[0]] = [row[1]]\n # else:\n # PS[row[0]].append(row[1])\n\n # n_correct = 0\n # n_penalty = 0\n # for p in PS:\n # if 'AC' in PS[p]:\n # n_correct += 1\n # for result in PS[p]:\n # if result == 'AC':\n # break\n # if result == 'WA':\n # n_penalty += 1\n \n # print('{} {}'.format(n_correct, n_penalty))\n\n \n N, M = map(int, input().split())\n acc = [False] * (N+1)\n pen = [0] * (N+1)\n for _ in range(M):\n p, S = input().split()\n p = int(p)\n if S[0] == 'A':\n acc[p] = True\n else:\n pen[p] += 1\n pen = 0\n for i in range(1, N+1):\n if not acc[p]:\n pen += pen[p]\n print('{} {}'.format(sum(acc), pen))\n\n \n\nif __name__ == '__main__':\n main()", "import numpy as np\n\ndef main():\n N, M = map(int, input().split())\n acc = [False] * (N+1)\n pen = [0] * (N+1)\n for _ in range(M):\n p, S = input().split()\n p = int(p)\n if S[0] == 'A':\n acc[p] = True\n else:\n if not acc[p]:\n pen[p] += 1\n n_pen = 0\n for i in range(1, N+1):\n if acc[i]:\n n_pen += pen[i]\n print('{} {}'.format(sum(acc), n_pen))\n\n \n\nif __name__ == '__main__':\n main()"]
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s030297029', 's131835858', 's185887411', 's455748005', 's144321567']
[2940.0, 3064.0, 16068.0, 16800.0, 15944.0]
[17.0, 20.0, 379.0, 381.0, 378.0]
[232, 234, 1128, 1068, 485]
p02802
u737298927
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())\nS = [input().split() for i in range(M)]\n\nwa = 0\nac = 0\nac_list = []\nfor p, s in S:\n if p not in ac_list:\n print(s)\n if s == "WA":\n wa += 1\n else:\n ac += 1\n ac_list.append(p)\nprint(ac, wa)', 'n, m = map(int, input().split())\n\nseikai = [False] * (n + 1)\nwa_list = [0] * (n + 1)\nac = 0\nwa = 0\nfor i in range(m):\n p, s = input().split()\n\n if not seikai[int(p)]:\n if s == "WA":\n wa_list[int(p)] += 1\n else:\n ac += 1\n wa += wa_list[int(p)]\n seikai[int(p)] = True\nprint(ac, wa)']
['Wrong Answer', 'Accepted']
['s139316141', 's583849990']
[32996.0, 4596.0]
[2106.0, 308.0]
[289, 343]
p02802
u740267532
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 = dict()\nwa = ac = 0\nN, M= map(int,input().split())\nfor i in range(M):\n a, b = input().split()\n if a not in d:\n d[a] = 0\nif d[a] >= 0 and b == "AC":\n ac += 1\n wa += d[a]\n d[a] = -1\nelif d[a] >= 0:\n d[a] += 1\nprint(ac,wa)', 'd = dict()\nwa = ac = 0\nN, M= map(int,input().split())\nfor i in range(M):\n a, b = input().split()\n if a not in d:\n d[a] = 0\n if d[a] >= 0 and b == "AC":\n ac += 1\n wa += d[a]\n d[a] = -1\n elif d[a] >= 0:\n d[a] += 1\nprint(ac,wa)', 'd = dict()\nwa = ac = 0\nN, M= map(int,input().split())\nfor i in range(M):\n a, b = input().split()\n if a not in d:\n d[a] = 0\n if d[a] >= 0 and b == "AC":\n ac += 1\n wa += d[a]\n d[a] = -1\n elif d[a] >= 0:\n d[a] += 1\nprint(ac,wa)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s103876500', 's392041581', 's689015122']
[17112.0, 2940.0, 17116.0]
[212.0, 17.0, 265.0]
[239, 269, 243]
p02802
u745687363
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\na = 0\nw = 0\nfor i in range(m):\n p, s = input().split()\n p = int(p)-1\n if ac[p] == 0, s == "AC":\n ac[p] += 1\n a += 1\n w += wa[p] \n elif ac[p] == 0, s == "WA":\n wa[p] += 1\nprint(a,w)', 'n, m = map(int, input().split())\nac = [0]*n\nwa = [0]*n\na = 0\nw = 0\nfor i in range(m):\n p, s = input().split()\n p = int(p)-1\n if ac[p] == 0, s == "AC":\n acs[p] += 1\n a += 1\n w += was[p] \n elif ac[p] == 0, s == "WA":\n was[p] += 1\nprint(a,w)', 'n, m = map(int, input().split())\nac = [0]*n\nwa = [0]*n\na = 0\nw = 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 a += 1\n w += wa[p] \n elif ac[p] == 0 and s == "WA":\n wa[p] += 1\nprint(a,w)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s095213618', 's325000128', 's329336790']
[2940.0, 2940.0, 4596.0]
[18.0, 17.0, 294.0]
[251, 254, 257]
p02802
u750120744
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())\nright = 0\nwrong = 0\nnow = 1\nfor i in range(M):\n p, S = list(input().split())\n if S == 'AC':\n if p == now:\n now += 1\n right += 1\n else:\n if p == now:\n wrong += 1\n\nprint(right, wrong, sep=' ')", "n, m = map(int, input().split())\nac = [False] * 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 if not ac[p]:\n ac[p] = True\n else:\n if not ac[p]:\n wa[p] += 1\n\na = 0\nb = 0\n\nfor i in range(n):\n if ac[i]:\n a += 1\n b += wa[i]\n\nprint(*[a, b])"]
['Wrong Answer', 'Accepted']
['s598698723', 's443172555']
[3064.0, 4596.0]
[218.0, 287.0]
[279, 345]
p02802
u750651325
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 math\nimport itertools\nimport bisect\nfrom copy import copy\nfrom collections import deque,Counter\nfrom decimal import Decimal\ndef s(): return input()\ndef i(): return int(input())\ndef S(): return input().split()\ndef I(): return map(int,input().split())\ndef X(): return list(input())\ndef L(): return list(input().split())\ndef l(): return list(map(int,input().split()))\ndef lcm(a,b): return a*b//math.gcd(a,b)\ndef gcd(*numbers): reduce(math.gcd, numbers)\nsys.setrecursionlimit(10 ** 9)\nmod = 10**9+7\ncount = 0\nans = 0\n\nN, M = I()\nAC = [0]*N\nWA = [0]*N\nac,wa = 0,0\nfor _ in range(M):\n s,t = L()\n s = int(s)-1\n if AC[s] == 0 and t == "WA":\n WA[s] += 1\n elif AC[s] == 0 and s == "AC":\n AC[s] = 1\n wa += WA[p]\n ac += 1\n\nprint(ac,wa)\n', "import sys\nimport math\nimport itertools\nimport bisect\nfrom copy import copy\nfrom collections import deque,Counter\nfrom decimal import Decimal\ndef s(): return input()\ndef i(): return int(input())\ndef S(): return input().split()\ndef I(): return map(int,input().split())\ndef X(): return list(input())\ndef L(): return list(input().split())\ndef l(): return list(map(int,input().split()))\ndef lcm(a,b): return a*b//math.gcd(a,b)\ndef gcd(*numbers): reduce(math.gcd, numbers)\nsys.setrecursionlimit(10 ** 9)\nmod = 10**9+7\ncount = 0\nans = 0\n\nN,M=map(int,input().split())\nL=[0]*N\nR=[0]*N\nright=0\npena=0\nfor _ in range(M):\n p,s=input().split()\n p=int(p)\n p-=1\n if R[p]==0:\n if s=='AC':\n right+=1\n R[p]=1\n pena+=L[p]\n else:\n L[p]+=1\n\nprint(right,pena)\n"]
['Wrong Answer', 'Accepted']
['s493892133', 's532616208']
[11396.0, 11304.0]
[207.0, 201.0]
[782, 803]
p02802
u757030836
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 i in range(m)]\n\nans =[]\nfor i in range(m):\n if not(ps[i][0] in ans) :\n ans += ps[i][0]\n \n\nprint(ps[0][0])\nwa = 0\nac = 0\nfor i in ans:\n for j in range(m):\n \n w = 0\n if ps[j][0] == str(i):\n if ps[j][1] =="WA":\n w += 1\n elif ps[j][1] == "AC":\n ac += 1\n wa +=w\n break\n\n else:\n continue\n \n \nprint(ac,wa)', "N,M = map(int, input().split())\nps = []\nAC = [0]*N\nWA = [0]*N\nWA_sum = 0\nfor _ in range(M):\n ps.append(list(input().split()))\nfor i in range(M):\n if ps[i][1] == 'AC' and AC[int(ps[i][0])-1] == 0:\n AC[int(ps[i][0])-1] = 1\n if ps[i][1] == 'WA' and AC[int(ps[i][0])-1] == 0:\n WA[int(ps[i][0])-1] += 1\nfor i in range(N):\n if AC[i] == 1:\n WA_sum += int(WA[i])\nprint(sum(AC), WA_sum)\n"]
['Runtime Error', 'Accepted']
['s266904718', 's864731844']
[32636.0, 27444.0]
[2113.0, 351.0]
[450, 391]
p02802
u759938562
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\nWA = 0\nPS = {}\nfor i in range(M):\n p, S = input().split()\n tmp = PS.get(p)\n if tmp != None:\n print("\\t" + tmp)\n\n if tmp != "AC":\n if S == "AC":\n AC += 1\n elif S == "WA":\n WA += 1\n PS[p] = S\nprint(str(AC) + " " + str(WA))\n ', 'N, M = map(int, input().split())\n\nAC = 0\nWA = 0\nPS = {}\nfor _ in range(M):\n p, S = input().split()\n tmp = PS.get(p)\n # print(PS)\n if tmp == None:\n if S == "AC":\n PS[p] = S\n AC += 1\n else:\n PS[p] = 1\n elif tmp != "AC":\n if S == "AC":\n PS[p] = S\n AC += 1\n WA += tmp\n else:\n PS[p] += 1\nprint(AC, WA)']
['Wrong Answer', 'Accepted']
['s154609270', 's848244158']
[21988.0, 21980.0]
[758.0, 255.0]
[328, 416]
p02802
u760794812
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())\ndic = {}\n\nfor _ in range (M):\n p, s = input().split()\n if p not in dic and s == 'AC':\n dic[p] = [1,0]\n elif p not in dic and s == 'WA':\n dic[p] = [0,1]\n elif s == 'AC' and dic[p][0] == 0:\n dic[p][0] += 1\n elif s == 'WA'and dic[p][0]:\n dic[p][1] += 1\n\nright = 0\nwrong = 0\n\nfor item in dic.values():\n right += item[0]\n if item[0]== 1:\n wrong += item[1]\n\nprint(right, wrong)\n\n", "N,M = map(int,input().split())\ndic = {}\n \nfor _ in range (M):\n p, s = input().split()\n if p not in dic and s == 'AC':\n dic[p] = [1,0]\n elif p not in dic and s == 'WA':\n dic[p] = [0,1]\n elif s == 'AC' and dic[p][0] == 0:\n dic[p][0] += 1\n elif s == 'WA' and dic[p][0] == 0:\n dic[p][1] += 1\n\nright = 0\nwrong = 0\n \nfor item in dic.values():\n right += item[0]\n if item[0]==1:\n wrong += item[1]\n\nprint(right, wrong)"]
['Wrong Answer', 'Accepted']
['s647836571', 's033388952']
[25280.0, 25288.0]
[299.0, 296.0]
[426, 431]
p02802
u761471989
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\nif m == 0:\n print(0, 0)\nelse:\n check_list = [0]*(n+1)\n wa = 0\n ac = 0\n for i in range(m):\n p, s = input().split()\n p = int(p)\n if check_list[p] == 1:\n continue\n elif s == 'AC':\n check_list[p] = 1\n ac += 1\n #elif check_list[p] == 0 and s == 'WA': \n else:\n wa += 1\n print(check_list)\n print(ac, wa)", "n, m = map(int, input().split())\n\nif m == 0:\n print(0, 0)\nelse:\n check_list = [0]*(n+1)\n wa = 0\n ac = 0\n for i in range(m):\n p, s = input().split()\n p = int(p)\n if check_list[p] == 1:\n continue\n if check_list[p] == 0 and s == 'AC':\n check_list[p] = 1\n ac += 1\n #elif check_list[p] == 0 and s == 'WA': \n else:\n wa += 1\n print(check_list)\n print(ac, wa)", "n, m = map(int, input().split())\n\nac_list = [0]*(n+1)\nwa_list = [0]*(n+1)\nwa = 0\nac = 0\nif m == 0:\n pass\nelse:\n for i in range(m):\n p, s = input().split()\n p = int(p)\n if ac_list[p] == 1:\n continue\n if ac_list[p] == 0 and s == 'AC':\n ac_list[p] = 1\n #elif check_list[p] == 0 and s == 'WA': \n else:\n wa_list[p] += 1\n for t_ac, t_wa in zip(ac_list, wa_list):\n if t_ac == 1:\n wa += t_wa\n ac += t_ac\nprint(ac, wa)"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s065098282', 's401194570', 's885620713']
[107468.0, 107308.0, 4596.0]
[2104.0, 2104.0, 286.0]
[482, 503, 563]
p02802
u763249708
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,0]\ncur_n = 1\nfor i in range(m):\n p, s = map(str, input().split())\n p = int(p)\n if i == 0: cur_n = p\n if cur_n == p:\n if s == 'AC':\n ans[0] += 1\n cur_n += 1\n else: ans[1] += 1\nprint(ans)", "n, m = map(int, input().split())\nis_ac = [False]*n\n \nac = 0\nwa_cnt = [0]*n\n\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n if is_ac[p-1] == False:\n if s == 'AC':\n is_ac[p-1] = True\n ac += 1\n else:\n wa_cnt[p-1] += 1\n\nwa = 0\nfor i in range(n):\n if is_ac[i]:\n wa += wa_cnt[i]\nprint(ac, wa)"]
['Wrong Answer', 'Accepted']
['s155280653', 's891357759']
[3060.0, 4596.0]
[330.0, 293.0]
[275, 361]
p02802
u763383823
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\nplist = []\nslist = []\nfor _ in range(m):\n p,s = list(input().split())\n p = int(p)\n plist.append(p)\n slist.append(s)\n#print(n, m, plist, slist)\n\nac = 0\nwa = 0\nactotal = 0\nwatotal = 0\ndef total(i,ac=ac,wa=wa):\n count = 0\n for j in plist:\n if i+1 == j:\n if slist[count] == 'AC':\n ac += 1\n break\n elif slist[count] == 'WA':\n wa += 1\n count += 1\n return ac,wa\nfor i in range(n):\n print(i)\n \n ac, wa = total(i)\n actotal += ac\n watotal += wa\n \nprint(actotal, watotal)", 'N,M = map(int,input().split())\nac,wa = 0,0\nwas = [0]*(N+1)\nacs = [0]*(N+1)\nfor i in range(M):\n p,S = input().split()\n p = int(p)\n if S=="AC":\n if acs[p]==0:\n ac+=1\n wa+=was[p]\n acs[p]=1\n else:\n was[p] += 1\nprint(ac,wa)']
['Wrong Answer', 'Accepted']
['s892832572', 's945480424']
[13388.0, 4596.0]
[2104.0, 270.0]
[620, 277]
p02802
u764773675
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_list = []\nres_list = []\nac_list = []\nfor i in range(m):\n a,b = input().split(" ")\n a = int(a)\n question_list.append(a)\n res_list.append(b)\ncorrect = 0\nmistake = 0\n\n\n\n\nfor i,j in enumerate(res_list):\n if i == 0:\n if j == "WA":\n mistake += 1\n else:\n correct += 1\n ac_list.append(question_list[i])\n \n elif question_list[i] not in ac_list: \n \tif j == "WA":\n \t\tmistake += 1\n \telse:\n \t\tcorrect += 1\n \tac_list.append(question_list[i])\n \n \n if len(ac_list) == n:\n break\n \nfor i,j in enumerate(res_list):\n if question_list[i] not in ac_list:\n mistake -= 1\n \n \nprint(correct,mistake)\n \n\n \n\n', '# coding: utf-8\n\nn,m = map(int,input().split(" "))\nac_list = [0] * n\nwa_list = [0] * n\n\n\nwa = 0\n\nfor i in range(m):\n a,b = input().split(" ")\n if ac_list[int(a) - 1]:\n continue\n if b == "AC":\n ac_list[int(a) - 1] = 1\n wa += wa_list[int(a)-1]\n else:\n wa_list[int(a)-1] += 1\n \nprint(sum(ac_list),wa)']
['Runtime Error', 'Accepted']
['s471796399', 's021661327']
[3064.0, 4596.0]
[17.0, 312.0]
[811, 344]
p02802
u765865533
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.
['%%time\nN,M=map(int, input().split())\nP=[]\nS=[]\nfor i in range(M):\n p,s=input().split()\n P.append(int(p))\n S.append(s)\n\n\nimport numpy as np\nP=np.array(P)\nS=np.array(S)\n\nif M>0:\n ans=P[S=="AC"]\n\n wa=0\n ac=[]\n for i in range(M):\n if P[i] in ans and P[i] not in ac and S[i]=="WA":\n wa+=1\n else:\n ac.append(P[i])\n \n \n print(len(ans),wa)\nelse:\n print(0,0)', 'N,M=map(int, input().split())\nwa={}\nac=[]\nkey=[]\nfor i in range(M):\n p,s=input().split()\n if p not in ac:\n if s=="WA":\n if s not in key:\n wa[p]=0\n key.append(p)\n else:\n wa[p]+=1\n else:\n ac.append(p)\nans=0\nfor i in ac:\n if i in key:\n ans+=wa[i]\nprint(len(ac),ans) ', 'N,M=map(int, input().split())\nwa={}\nac=[]\nkey=[]\nfor i in range(M):\n p,s=input().split()\n if p not in ac:\n if s=="WA":\n if s not in key:\n wa[p]=0\n key.append(p)\n else:\n wa[p]+=1\n else:\n ac.append(p)\nans=0\nfor i in ac:\n if i in key:\n ans+=wa[i]\nprint(len(ac),ans) ', 'N,M=map(int, input().split())\nwa={}\nac=[]\nkey=[]\n\n \nfor i in range(M):\n p,s=input().split()\n if p not in ac:\n if p not in key:\n key.append(p)\n wa[P[i]]=0\n\n if s=="WA":\n wa[p]+=1\n else:\n ac.append(p)\nans=0\nfor i in key:\n if i in ac:\n ans+=wa[i]\nprint(len(ac),ans)\n\n', 'N,M=map(int,input().split())\nAC={}\nWA={}\nfor i in range(M):\n a,b=input().split()\n if not(a in AC.keys()):\n if b=="AC":\n AC[a]=1\n else:\n if a in WA.keys():\n WA[a]+=1\n else:\n WA[a]=1\ny=0\nfor i in AC.keys():\n if i in WA.keys():\n y+=WA[i]\nprint(sum(AC.values()),y)']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s405525975', 's456875834', 's543109844', 's921364873', 's872377688']
[2940.0, 5012.0, 5012.0, 3064.0, 17116.0]
[17.0, 2104.0, 2104.0, 17.0, 251.0]
[418, 372, 372, 348, 353]
p02802
u766566560
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\nwa = [0] * N\npnt = [0] * N\nac = [False] * N\n\nfor _ in range(M):\n tmp = 0\n p, s = list(map(str, input().split()))\n if s == 'WA':\n wa[int(p)] += 1\n elif s == 'AC' and not (ac[int(p)]):\n ac[int(p)] = not (ac[int(p)])\n pnt[int(p)] += wa[int(p)]\n\nprint(ac.count(True), sum(pnt))", "N, M = map(int, input().split())\n\nwa = [0] * N\npnt = [0] * N\nac = [False] * N\n\nfor _ in range(M):\n p, s = list(map(str, input().split()))\n if s == 'WA':\n wa[int(p) - 1] += 1\n elif s == 'AC' and not (ac[int(p) - 1]):\n ac[int(p) - 1] = not (ac[int(p) - 1])\n pnt[int(p) - 1] += wa[int(p) - 1]\n\nprint(ac.count(True), sum(pnt))"]
['Runtime Error', 'Accepted']
['s279200050', 's722124473']
[5492.0, 5492.0]
[445.0, 483.0]
[334, 346]
p02802
u768559443
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())\nif m==0:\n print(0,0)\n exit()\nAC=[0]*n+1\nWA=[0]*n+1\n\nfor i in range(m):\n p,s=map(str,input().split())\n if s=="AC":\n AC[int(p)]+=1\n elif s=="WA" and AC[int(p)]==0:\n WA[int(p)]+=1\n\nfor i in range(n+1):\n if AC[i]==0:\n WA[i]=0\n\ncnt=AC.count(0)\nanswer=len(AC)-cnt\nans=sum(WA)\nprint(answer,ans)', 'n,m=map(int,input().split())\nif m==0:\n print(0,0)\n exit()\nAC=[0]*(n+1)\nWA=[0]*(n+1)\n\nfor i in range(m):\n p,s=map(str,input().split())\n if s=="AC":\n AC[int(p)]+=1\n elif s=="WA" and AC[int(p)]==0:\n WA[int(p)]+=1\n\nfor i in range(n+1):\n if AC[i]==0:\n WA[i]=0\n\ncnt=AC.count(0)\nanswer=len(AC)-cnt\nans=sum(WA)\nprint(answer,ans)']
['Runtime Error', 'Accepted']
['s684911543', 's846411179']
[9568.0, 10456.0]
[26.0, 240.0]
[355, 359]
p02802
u769383879
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\nn,m = map(int,input().split())\n\np = []\ns = []\nans_a = np.zeros(n+1)\nans_p = np.zeros(n+1)\n\nfor i in range(m):\n pi ,si = map(str,input().split())\n p.append(int(pi))\n s.append(si)\n\nfor i in range(m):\n if s[i] == "AC":\n ans_a[p[i]] = 1\n if s[i] == "WA" and ans_a[p[i]] == 0:\n ans_p[p[i]] += 1\n\nprint(int(np.sum(ans_a)), int(np.sum(ans_p))s)\n', 'import numpy as np\nn,m = map(int,input().split())\n\np = []\ns = []\nans_a = np.zeros(n)\nans_p = np.zeros(n)\n\nfor i in range(m):\n pi ,si = map(str,input().split())\n p.append(int(pi))\n s.append(si)\n\nfor i in range(m):\n if s[i] == "AC":\n ans_a[p[i]-1] = 1\n elif ans_a[p[i]-1] == 0:\n ans_p[p[i]-1] += 1\n\nfor i in range(n):\n if ans_a[i] == 0:\n ans_p[i] = 0\n\nprint(int(np.sum(ans_a)),int(np.sum(ans_p)))\n']
['Runtime Error', 'Accepted']
['s753168527', 's742270650']
[3064.0, 23736.0]
[17.0, 857.0]
[386, 434]
p02802
u772816188
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\ninput = sys.stdin.readline\nsys.setrecursionlimit(10000000)\n\nN, M = map(int, input().split())\n\nac_set = set()\nwa_count = 0\n\nfor i in range(M):\n p, s = input().split()\n\n \n if s == 'AC':\n ac_set.add(p)\n elif s == 'WA':\n if s not in ac_set:\n wa_count += 1\n else:\n pass\n\nac_count = len(ac_set)\n\nprint('{} {}'.format(ac_count, wa_count))\n", "import sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(10000000)\n\nN, M = map(int, input().split())\n\nac_set = set()\nwa_dict = {}\n\nfor i in range(M):\n p, s = input().split()\n\n \n if s == 'AC':\n ac_set.add(p)\n elif s == 'WA':\n if p not in ac_set:\n if wa_dict.get(p) is None:\n wa_dict[p] = 1\n else:\n wa_dict[p] += 1\n else:\n pass\n\nac_count = len(ac_set)\nwa_count = 0\n\nfor k, v in wa_dict.items():\n if k in ac_set:\n \n wa_count += v\n\nprint('{} {}'.format(ac_count, wa_count))\n"]
['Wrong Answer', 'Accepted']
['s855708095', 's810570540']
[14060.0, 14060.0]
[99.0, 142.0]
[416, 629]
p02802
u773440446
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_ac = set()\nwa_cnt = 0\nwa_sled = [i for i in range(1,n+1)]\n\n\nfor i in range(m):\n p,s = input().split()\n if s == "AC":\n ans_ac.add(p)\n \n if s == \'WA\' and p not in wa_sled:\n wa_cnt += 1\n \nprint(len(ans_ac),wa_cnt)', "n,m = map(int,input().split())\nWA = 0\nq = []\nans = []\nfor i in range(m):\n print(ans,WA,q)\n p,s = input().split()\n if p in q:\n if p in ans:\n continue\n else:\n if s == 'WA':\n WA += 1\n else:\n ans.append(p)\n elif p not in q:\n q.append(p)\n if s == 'WA':\n WA += 1\n else:\n ans.append(p)\n \nprint(len(ans),WA)", 'n,m=map(int,input().split())\nac_cnt = set()\nwa_cnt = 0\npenalty = [0]*n\nfor i in range(m):\n p,s = input().split()\n num = p - 1\n if num not in ac_cnt:\n if s == "AC":\n ac_cnt.add(num)\n wa_cnt += penalty[num]\n else:\n penalty[num] += 1\nprint(len(set(ac_cnt)),wa_cnt)\n ', 'n,m=map(int,input().split())\nac_cnt = set()\nwa_cnt = 0\npenalty = [0]*n\nfor i in range(m):\n p,s = input().split()\n num = int(p) - 1\n if num not in ac_cnt:\n if s == "AC":\n ac_cnt.add(num)\n wa_cnt += penalty[num]\n else:\n penalty[num] += 1\nprint(len(set(ac_cnt)),wa_cnt)']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s649573157', 's682192711', 's740916438', 's032356624']
[23872.0, 142552.0, 9560.0, 21076.0]
[2206.0, 6139.0, 26.0, 204.0]
[261, 442, 322, 322]
p02802
u773686010
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 collections import defaultdict\nN,M = map(int,input().split())\nAC_List = defaultdict(int)\nWA_List = defaultdict(int)\n\nfor i in range(M):\n Num,Sta = map(str,input().split())\n if Num in AC_List:\n continue\n else:\n if Sta == "WA":\n WA_List[Num] += 1\n else:\n AC_List[Num] += 1\n\nansct = 0\nfor k,v in WA_List:\n if k in AC_List:\n ansct += v\n \nprint(str(len(AC_List))+" " +str(ansct))\n \n ', 'from collections import defaultdict\nN,M = map(int,input().split())\nAC_List = defaultdict(int)\nWA_List = defaultdict(int)\n\nfor i in range(M):\n Num,Sta = map(str,input().split())\n if Num in AC_List:\n continue\n else:\n if Sta == "WA":\n WA_List[Num] += 1\n else:\n AC_List[Num] += 1\n\nansct = 0\nfor k,v in WA_List.items():\n if k in AC_List:\n ansct += v\n \nprint(str(len(AC_List))+" " +str(ansct))\n \n ']
['Runtime Error', 'Accepted']
['s209705691', 's349825384']
[22288.0, 22156.0]
[224.0, 233.0]
[478, 486]
p02802
u780475861
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())\ndic={}\nw=ac=0\nfor _ in range(m):\n a,b=readline().split()\n if a in dic:\n if dic[a]:\n if b == b'WA':\n w+=1\n else:\n ac+=1\n dic[a]=False\n else:\n dic[a]=True\n if b == b'WA':\n w+=1\n print(w)\n else:\n ac+=1\n dic[a]=False\nprint(ac,w)\n \n", "import sys\nreadline = sys.stdin.buffer.readline\n\nn, m = map(int, readline().split())\nac_lst = [False] * (n + 1)\nwa_lst = [0] * (n + 1)\nac = w = 0\nfor _ in range(m):\n a, b = readline().split()\n a = int(a)\n if ac_lst[a]:\n continue\n if b == b'WA':\n wa_lst[a] += 1\n else:\n ac += 1\n w += wa_lst[a]\n ac_lst[a] = True\nprint(ac, w)\n"]
['Wrong Answer', 'Accepted']
['s781222545', 's180012591']
[15720.0, 4596.0]
[157.0, 123.0]
[447, 374]
p02802
u785213188
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 collections import defaultdict\nN, M = map(int, input().split())\nd = defaultdict(lambda : "WA")\ncorrect = 0\nincorrect = 0\nfor _ in range(M):\n p, S = input().split()\n if d[p] == "WA":\n if S == "WA":\n incorrect += 1\n print(p, "WA", d)\n else:\n correct += 1\n d[p] = "AC"\n print(p, "AC", d)\nprint(correct, incorrect)', 'N, M = map(int, input().split())\nac = 0\nwa = 0\nmp = [0]*N\nfor _ in range(M):\n p, S = input().split()\n p = int(p) - 1\n if S == "AC":\n if mp[p] != "AC":\n ac += 1\n wa += mp[p]\n mp[p] = "AC"\n else:\n if mp[p] != "AC":\n mp[p] += 1\nprint(ac, wa)']
['Runtime Error', 'Accepted']
['s428624702', 's449119964']
[135112.0, 3828.0]
[1670.0, 298.0]
[390, 308]
p02802
u785578220
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())\ndp = [0]*(100010)\nqp = [0]*(100010)\nfor i in range(b):\n ta,tb = map(str,input().split())\n ta = int(ta)\n if tb == 'WA' and qp[ta] == 0 :dp[ta]+=1\n elif tb == 'AC' and qp[ta] == 0 :qp[ta]==1\nprint(sum(qp),sum(dp))", "a,b = map(int,input().split())\ndp = [0]*(100010)\nqp = [0]*(100010)\nfor i in range(b):\n ta,tb = map(str,input().split())\n ta = int(ta)\n if qp[ta] == 0 :\n if tb == 'WA':dp[ta]+=1\n else qp[ta]=1\nprint(sum(qp),sum(dp))", "\na,b = map(int,input().split())\ndp = [0]*(100010)\nqp = [0]*(100010)\nfor i in range(b):\n ta,tb = map(str,input().split())\n ta = int(ta)\n if qp[ta] == 0 :\n if tb == 'WA':\n dp[ta]+=1\n else :\n qp[ta]=1\nANS = 0\nfor i, j in zip(dp,qp):\n ANS += i*j\nprint(sum(qp),ANS)"]
['Wrong Answer', 'Runtime Error', 'Accepted']
['s756714802', 's759367613', 's796790817']
[4724.0, 2940.0, 4596.0]
[330.0, 18.0, 347.0]
[255, 237, 308]
p02802
u789840108
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\npena = [0 for i in range(n)]\nacc = [0 for i in range(n)]\n\nfor i in range(m):\n pp, ss = input().split(' ')\n p = int(pp) - 1\n\n if acc[p] == 0:\n if ss == 'WA':\n pena[p] += 1\n else:\n acc[p] = 1\n\nfor i in range(m):\n pena[i] = pena[i] * acc[i]\n\nprint(sum(acc), sum(pena))", "n, m = map(int, input().split(' '))\n\npena = [0 for i in range(n)]\nacc = [0 for i in range(n)]\n\nfor i in range(m):\n pp, ss = input().split(' ')\n p = int(pp) - 1\n\n if acc[p] == 0:\n if ss == 'WA':\n pena[p] += 1\n else:\n acc[p] = 1\n\nfor i in range(n):\n pena[i] = pena[i] * acc[i]\n\nprint(sum(acc), sum(pena))"]
['Runtime Error', 'Accepted']
['s817096790', 's994657903']
[4656.0, 4732.0]
[305.0, 308.0]
[350, 350]
p02802
u791013618
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 collections import OrderedDict\nn, m = map(int,input().split())\na = OrderedDict()\n\nfor i in range(m):\n p, s = input().split()\n if a.get(p) == None:\n a[p] = list()\n a[p].append(s)\n\nfor k, v in a.items():\n sum += a.find('AC')\n\nprint(sum)", "from collections import OrderedDict\nn, m = map(int,input().split())\n\naclist = [0]*n\nwalist = [0]*n\nacflag = [False]*n\n\nfor i in range(m):\n pp, s = input().split()\n p = int(pp)\n if s == 'AC':\n if acflag[p]:\n pass\n else:\n aclist[p] += 1\n acflag[p] = True\n else:\n if acflag[p]:\n pass\n else:\n walist[p] += 1\n \n\nprint(sum(aclist), sum(walist))\n", "from collections import OrderedDict\nn, m = map(int,input().split())\na = OrderedDict()\n\nfor i in range(m):\n p, s = input().split()\n if a.get(p) == None:\n a[p] = list()\n a[p].append(s)\n \nsum = 0\nfor k, _ in a.items():\n try:\n sum += a[k].index('AC')\n except:\n pass\nprint(sum)\n", 'from collections import OrderedDict\nn, m = map(int,input().split())\n \naclist = [0]*n\nwalist = [0]*n\nwa = 0\nfor i in range(m):\n pp, s = input().split()\n p = int(pp) - 1\n if s == \'AC\':\n if not aclist[p]:\n aclist[p] = 1\n wa += walist[p]\n else:\n if not aclist[p]:\n walist[p] += 1\n"""\n pp, s = input().split()\n p = int(pp) - 1\n if s == \'AC\' and not aclist[p]:\n aclist[p] = 1\n ac += 1\n wa += walist[p]\n else:\n walist[p] += 1\n"""\nprint(sum(aclist), wa)']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s002803496', 's668891964', 's840878814', 's647085632']
[52836.0, 5620.0, 52816.0, 4852.0]
[739.0, 265.0, 750.0, 284.0]
[246, 381, 288, 486]
p02802
u791977205
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.
['\nN,M = map(int,input().split())\n\n#print(N,M)\n\nnum=[]\nanswer=[]\ncorrect=[False] * N\ncorrectCount = 0\nwrongCount = 0\nwrong=[False] * N\nfor k in range(M):\n n,a=input().split()\n num.append(int(n))\n answer.append(a)\n if a == "AC":\n if correct[n] == False:\n correct[n] = True\n correctCount += 1\n wrongCount += wrong[n]\n else:\n if correct[n] == False:\n wrong[n] += 1\n\n\n\n \n#print(num)\n#print(answer)\n \n\'\'\'\npreCorrect = False\ncorrectCount=0\nwrongCount = 0\ntemp_wrongCount = 0\n\n\nfor i in range(M):\n if i > 0 and num[i] != num[i-1]:\n if preCorrect == True:\n preCorrect = False\n temp_wrongCount = 0\n else:\n temp_wrongCount = 0\n \n \n if preCorrect == True:\n continue\n\n if answer[i] == "AC":\n correctCount += 1\n preCorrect = True\n wrongCount += temp_wrongCount\n if answer[i] == "WA":\n temp_wrongCount += 1\n\'\'\'\nprint(correctCount, wrongCount)\n \n\n\n', '\nN,M = map(int,input().split())\n\n#print(N,M)\n\nnum=[]\nanswer=[]\ncorrect=[False] * N\ncorrectCount = 0\nwrongCount = 0\nwrong=[0] * N\nfor k in range(M):\n n,a=input().split()\n num.append(int(n))\n answer.append(a)\n if a == "AC":\n if correct[int(n)] == False:\n correct[int(n)] = True\n correctCount += 1\n wrongCount += wrong[int(n)]\n else:\n if correct[int(n)] == False:\n wrong[int(n)] += 1\n\n\n\n \n#print(num)\n#print(answer)\n \n\'\'\'\npreCorrect = False\ncorrectCount=0\nwrongCount = 0\ntemp_wrongCount = 0\n\n\nfor i in range(M):\n if i > 0 and num[i] != num[i-1]:\n if preCorrect == True:\n preCorrect = False\n temp_wrongCount = 0\n else:\n temp_wrongCount = 0\n \n \n if preCorrect == True:\n continue\n\n if answer[i] == "AC":\n correctCount += 1\n preCorrect = True\n wrongCount += temp_wrongCount\n if answer[i] == "WA":\n temp_wrongCount += 1\n\'\'\'\nprint(correctCount, wrongCount)', 'N,M = map(int,input().split())\n\n#print(N,M)\n\nnum=[]\nanswer=[]\ncorrect=[False] * N\ncorrectCount = 0\nwrongCount = 0\nwrong[False] * N\nfor k in range(M):\n n,a=input().split()\n num.append(int(n))\n answer.append(a)\n if a == "AC":\n if correct[n] == False:\n correct[n] = True\n correctCount += 1\n wrongCount += wrong[n]\n else:\n if correct[n] == False:\n wrong[n] += 1\n\n\n\n \n#print(num)\n#print(answer)\n \n\'\'\'\npreCorrect = False\ncorrectCount=0\nwrongCount = 0\ntemp_wrongCount = 0\n\n\nfor i in range(M):\n if i > 0 and num[i] != num[i-1]:\n if preCorrect == True:\n preCorrect = False\n temp_wrongCount = 0\n else:\n temp_wrongCount = 0\n \n \n if preCorrect == True:\n continue\n\n if answer[i] == "AC":\n correctCount += 1\n preCorrect = True\n wrongCount += temp_wrongCount\n if answer[i] == "WA":\n temp_wrongCount += 1\n\'\'\'\nprint(correctCount, wrongCount)\n \n\n\n', '\nN,M = map(int,input().split())\n\n#print(N,M)\n\nnum=[]\nanswer=[]\ncorrect=[False] * N\ncorrectCount = 0\nwrongCount = 0\nwrong=[0] * N\nfor k in range(M):\n n,a=input().split()\n num.append(int(n))\n answer.append(a)\n if a == "AC":\n if correct[n] == False:\n correct[n] = True\n correctCount += 1\n wrongCount += wrong[n]\n else:\n if correct[n] == False:\n wrong[n] += 1\n\n\n\n \n#print(num)\n#print(answer)\n \n\'\'\'\npreCorrect = False\ncorrectCount=0\nwrongCount = 0\ntemp_wrongCount = 0\n\n\nfor i in range(M):\n if i > 0 and num[i] != num[i-1]:\n if preCorrect == True:\n preCorrect = False\n temp_wrongCount = 0\n else:\n temp_wrongCount = 0\n \n \n if preCorrect == True:\n continue\n\n if answer[i] == "AC":\n correctCount += 1\n preCorrect = True\n wrongCount += temp_wrongCount\n if answer[i] == "WA":\n temp_wrongCount += 1\n\'\'\'\nprint(correctCount, wrongCount)\n \n\n\n', '\nN,M = map(int,input().split())\n\n#print(N,M)\n\nnum=[]\nanswer=[]\ncorrect=[False] * (N+1)\ncorrectCount = 0\nwrongCount = 0\nwrong=[0] * (N+1)\nfor k in range(M):\n n,a=input().split()\n num.append(int(n))\n answer.append(a)\n if a == "AC":\n if correct[int(n)] == False:\n correct[int(n)] = True\n correctCount += 1\n wrongCount += wrong[int(n)]\n else:\n if correct[int(n)] == False:\n wrong[int(n)] += 1\n\n\n\n \n#print(num)\n#print(answer)\n \n\'\'\'\npreCorrect = False\ncorrectCount=0\nwrongCount = 0\ntemp_wrongCount = 0\n\n\nfor i in range(M):\n if i > 0 and num[i] != num[i-1]:\n if preCorrect == True:\n preCorrect = False\n temp_wrongCount = 0\n else:\n temp_wrongCount = 0\n \n \n if preCorrect == True:\n continue\n\n if answer[i] == "AC":\n correctCount += 1\n preCorrect = True\n wrongCount += temp_wrongCount\n if answer[i] == "WA":\n temp_wrongCount += 1\n\'\'\'\nprint(correctCount, wrongCount)\n \n\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s004856413', 's431470677', 's894077794', 's936526516', 's961698326']
[4596.0, 14856.0, 3828.0, 4596.0, 14912.0]
[20.0, 331.0, 18.0, 19.0, 359.0]
[1013, 1026, 1011, 1009, 1041]
p02802
u793460864
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\ncount_AC = [0] * N\ncount_WA = [0] * N\nfor i in range(M):\n p[i],S[i] = input().split()\n p[i] = int(p[i])\n\n if S[i] == 'AC':\n if count_AC[p[i]] == 0:\n count_AC[p[i]] = 1\n \n if S[i] == 'WA':\n if count_AC[p[i]] == 0:\n count_WA[p[i]] += 1\n \nprint(sum(count_AC) , sum(count_WA))", "N, M = map(int, input().split())\np = [0] * M\nS = [0] * M\ncount_AC = [0] * N\ncount_WA = [0] * N\nfor i in range(M):\n p[i],S[i] = input().split()\n p[i] = int(p[i]) - 1\n\n if S[i] == 'AC':\n if count_AC[p[i]] == 0:\n count_AC[p[i]] = 1\n \n if S[i] == 'WA':\n if count_AC[p[i]] == 0:\n count_WA[p[i]] = count_WA[p[i]] + 1\n \nprint(sum(count_AC) , sum([x * y for (x, y) in zip(count_AC, count_WA)]))"]
['Runtime Error', 'Accepted']
['s423652052', 's781521613']
[14836.0, 15792.0]
[311.0, 329.0]
[400, 457]
p02802
u793666115
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 itertools\nn, m = map(int, input().split())\nP = [input().split() for i in range(m)]\nP = list(itertools.chain.from_iterable(P))\nac_list = []\nwa_list = [0] * n\n\ncounta = 0\ncountb = 0\nfor i in range(1, m * 2, 2):\n if P[i] == "AC" and:\n if int(P[i - 1]) not in ac_list:\n counta += 1\n ac_list.append(int(P[i - 1]))\n countb += wa_list[int(P[i - 1]) - 1]\n else:\n wa_list[int(P[i - 1]) - 1] += 1\nprint(counta, countb)', 'import itertools\nn, m = map(int, input().split())\nP = [input().split() for i in range(m)]\nP = list(itertools.chain.from_iterable(P))\nac_list = [0] * n\nwa_list = [0] * n\n\ncounta = 0\ncountb = 0\nfor i in range(1, m * 2, 2):\n if P[i] == "AC" and ac_list[int(P[i - 1])] == 0:\n counta += 1\n ac_list[int(P[i - 1])] = 1\n countb += wa_list[int(P[i - 1]) - 1]\n elif P[i] == "WA":\n wa_list[int(P[i - 1]) - 1] += 1\n else:\n continue\n\nprint(counta, countb)\n', 'import itertools\nn, m = map(int, input().split())\nP = [input().split() for i in range(m)]\nP = list(itertools.chain.from_iterable(P))\nac_list = [0] * n\nwa_list = [0] * n\ncounta = 0\ncountb = 0\nfor i in range(1, m * 2, 2):\n if P[i] == "AC" and ac_list[int(P[i - 1])-1] == 0:\n counta += 1\n ac_list[int(P[i - 1])-1] = 1\n countb += wa_list[int(P[i - 1]) - 1]\n elif P[i] == "WA":\n wa_list[int(P[i - 1]) - 1] += 1\n else:\n continue\n\nprint(counta, countb)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s123144050', 's293742571', 's759719402']
[2940.0, 33884.0, 33884.0]
[18.0, 332.0, 319.0]
[468, 487, 490]
p02802
u794910686
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())\nPS = [line.split() for line in readlines()]\n\nAC = [False] * (N+1)\nWA_cnt = [0] * (N+1)\n\npenal = 0\nfor p,s in PS:\n p = int(p)\n if AC[p]:\n continue\n if 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)", 'N,M=[int(i) for i in input().split()]\nAC,WA=[False]*N,[0]*N\nfor i in range(M):\n p,s=input().split()\n p=int(p)-1\n if AC[p]==False:\n if s=="AC":\n AC[p]=True\n if s=="WA":\n WA[p]+=1\n else:\n continue\n\nans_AC=AC.count(True)\nans_WA=0\nfor i in range(N):\n if AC[i]:\n ans_WA+=WA[i]\nprint(ans_AC,ans_WA)']
['Wrong Answer', 'Accepted']
['s536769551', 's615541261']
[34468.0, 4596.0]
[137.0, 297.0]
[439, 357]
p02802
u799635973
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()))\n\nac = [0] * n\nwa = [0] * n\npena = 0\n\nfor i in range(m):\n question, answer = input().split()\n question = int(question)\n if (answer == "AC") and (ac[question] == 0):\n ac[question] = 1\n pena += wa[question]\n elif (answer == "WA") and (ac[question] == 0):\n wa[question] += 1\n\nprint(sum(ac), pena)', 'n,m = list(map(int, input().split()))\n \nac = [0]*n\nwa = [0]*n\npena = 0\n \nfor i in range(m):\n question, answer = input().split()\n question = int(question)\n \n if (answer=="AC") and (ac[question]==0):\n ac[ques] = 1\n pena += wa[ques]\n elif (answer=="WA") and (ac[question]==0):\n wa[question] += 1\n \nprint(sum(ac), pena)', "N,M=map(int,input().split())\nac_list = [0] * N\nwa_list = [0] * N\n\nfor i in range(M):\n Pi, answer = input().split()\n number=int(Pi)\n if answer =='AC':\n \n ac_list[number] =1\n \n else:\n if ac_list[number]!=1:\n wa_list[number] =wa_list[number]+1\n\nwa_num = 0\nac_num = 0\nfor i in range(N):\n if ac_list[i] == 1:\n ac_num=ac_num+1\n wa_num=wa_list[i]\n \nprint(ac_num, wa_num)\n", 'n, m = list(map(int, input().split()))\n\nac = [0] * n\nwa = [0] * n\npena = 0\n\nfor i in range(m):\n question, answer = input().split()\n question = int(question)\n if (answer == "AC") and (ac[question] == 0):\n ac[question] = 1\n pena += wa[question]\n elif (answer == "WA") and (ac[question] == 0):\n wa[question] += 1\n\nprint(sum(ac), pena)', 'n, m = list(map(int, input().split()))\n\nac = [0] * (n+1)\nwa = [0] * (n+1)\npena = 0\n\nfor i in range(m):\n question, answer = input().split()\n question = int(question)\n if (answer == "AC") and (ac[question] == 0):\n ac[question] = 1\n pena += wa[question]\n elif (answer == "WA") and (ac[question] == 0):\n wa[question] += 1\n\nprint(sum(ac), pena)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s159097504', 's403356824', 's646651961', 's810487560', 's944810289']
[4596.0, 4596.0, 4596.0, 4596.0, 4596.0]
[256.0, 22.0, 270.0, 264.0, 286.0]
[364, 332, 670, 364, 372]
p02802
u799978560
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 = [a]*M\nfor i in range(M):\n p[i],s[i] = map(str,input().split())\npans = 0\nsans = 0\n\nfor j in range(N):\n for k,val in enumerate(p):\n if val == str(j+1) and s[k] == "WA":\n sans += 1\n elif val == str(j+1) and s[k] == "AC":\n pans += 1\n break\nprint(int(pans),int(sans))', 'n,m = map(int,input().split())\na = [input().split() for i in rabge(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)', 'N,M = map(int,input().split())\np = [0]*M\ns = [a]*M\nfor i in range(M):\n p[i],s[i] = map(str,input().split())\npans = 0\nsans = 0\n\nfor j in range(N):\n for k,val in enumerate(p):\n if val == str(j+1) and s[k] == "WA":\n sans += 1\n elif val == str(j+1) and s[k] == "AC":\n pans += 1\n break\nprint(pans,sans)', 'N,M = map(int,input().split())\np = [0]*M\ns = [a]*M\nfor i in range(M):\n p[i],s[i] = map(str,input().split())\npans = 0\nsans = 0\n\nfor j in range(N):\n for k,val in enumerate(p):\n if val == str(j+1) and s[k] == "WA":\n sans += 1\n elif val == str(j+1) and s[k] == "AC":\n pans += 1\n break\nprint(pans,sans)', '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)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s169584127', 's179663368', 's569468856', 's825126289', 's819284768']
[3828.0, 3064.0, 3828.0, 3828.0, 38628.0]
[18.0, 17.0, 18.0, 20.0, 279.0]
[360, 363, 350, 350, 363]
p02802
u808705768
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(lambda x: int(x), input().split()))\ncleared = [False for i in range(N+1)]\nac = 0\nwa = 0\nfor _ in range(M):\n p, s = input().split()\n p = int(p)\n \n if cleared[p]:\n continue\n print(s)\n if s == "AC":\n cleared[p] = True\n ac = ac + 1\n elif s == "WA":\n wa = wa + 1\n\nprint(ac, wa)', 'import numpy as np\nN, M = list(map(lambda x: int(x), input().split()))\ncleared = np.array([False for i in range(N+1)])\nwa_count = np.array([0 for i in range(N+1)])\nfor _ in range(M):\n p, s = input().split()\n p = int(p)\n \n if cleared[p]:\n continue\n if s == "AC":\n cleared[p] = True\n elif s == "WA":\n wa_count[p] = wa_count[p] + 1\n\nprint("{} {}".format(sum(np.array(cleared) *1), sum(wa_count[cleared])))']
['Wrong Answer', 'Accepted']
['s309240246', 's706773778']
[4240.0, 14852.0]
[755.0, 693.0]
[307, 417]
p02802
u812354010
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\npena=[0]*(n+1)\nseitou=[0]*(n+1)\n\nfor i in range(m):\n p,s = map(str,input().split()) \n p=int(p)\n if s=="WA" and seitou[p]==0:\n pena[p]+=1\n if s=="AC":\n seitou[p]=1\n\npena_kazu=0\n\nfor i in range(n):\n if seitou[i]==1:\n pena_kazu+=pena[i]\n\nseitou_kazu=sum(seitou)\n\nprint(str(seitou_kazu)+" "+str(pena_kazu))', 'n,m = map(int, input().split()) \n\npena=[0]*(n+1)\nseitou=[0]*(n+1)\n\nfor i in range(m):\n p,s = map(str,input().split()) \n p=int(p)\n if s=="WA" and seitou[p]==0:\n pena[p]+=1\n if s=="AC":\n seitou[p]=1\n\npena_kazu=0\n\nfor i in range(1,n+1):\n if seitou[i]==1:\n pena_kazu+=pena[i]\n\nseitou_kazu=sum(seitou)\n\nprint(str(seitou_kazu)+" "+str(pena_kazu))']
['Wrong Answer', 'Accepted']
['s918642464', 's356265625']
[10280.0, 10252.0]
[226.0, 225.0]
[372, 376]
p02802
u819407764
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.
['\ncheck = {}\nerror = {}\n\nans_ac = 0\nans_wa = 0\n\nfor i in range(m):\n p,s = map(str, input().split())\n p = int(p)\n if p in check:\n pass\n else:\n if s == "WA":\n if p in error:\n error[p] += 1\n else:\n error[p] = 1\n else:\n if p in check:\n check[p] += 1\n else:\n check[p] = 1\n if p in error:\n ans_wa += error[p]\n ans_ac += 1\nprint(str(ans_ac) + " " + str(ans_wa) )', 'n,m = map(int, input().split())\n\ncheck = {}\nerror = {}\n\nans_ac = 0\nans_wa = 0\n\nfor i in range(m):\n p,s = map(str, input().split())\n p = int(p)\n if p in check:\n pass\n else:\n if s == "WA":\n if p in error:\n error[p] += 1\n else:\n error[p] = 1\n else:\n if p in check:\n check[p] += 1\n else:\n check[p] = 1\n if p in error:\n ans_wa += error[p]\n ans_ac += 1\nprint(str(ans_ac) + " " + str(ans_wa) )']
['Runtime Error', 'Accepted']
['s955426604', 's820573817']
[3064.0, 15072.0]
[18.0, 349.0]
[528, 560]
p02802
u819710930
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\nsys.setrecursionlimit(10**6)\n# input = sys.stdin.readline\nii = lambda: int(input())\nmis = lambda: map(int,input().split())\nlmis = lambda: list(mis())\nINF = float(\'inf\')\n\ndef main():\n n,m=mis()\n lis=[0]*(n+1)\n wa=0\n for _ in range(m):\n P,s=input().split()\n p=int(P)\n if lis[p]==0:\n if s==\'WA\': wa+=1\n else: lis[p]+=1\n print(sum(lis))\n print(wa)\n\n\nif __name__ == "__main__":\n main()', 'import sys\nsys.setrecursionlimit(10**6)\n# input = sys.stdin.readline\nii = lambda: int(input())\nmis = lambda: map(int,input().split())\nlmis = lambda: list(mis())\nINF = float(\'inf\')\n\ndef main():\n n,m=mis()\n lis=[0]*(n+1)\n ww=[0]*(n+1)\n wa=0\n for _ in range(m):\n P,s=input().split()\n p=int(P)\n if lis[p]==0:\n if s==\'WA\': ww[p]+=1\n else:\n lis[p]+=1\n wa+=ww[p]\n print(sum(lis),wa)\n\n\nif __name__ == "__main__":\n main()']
['Wrong Answer', 'Accepted']
['s915840651', 's742327176']
[3828.0, 4596.0]
[244.0, 264.0]
[455, 506]
p02802
u823885866
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 math\nimport itertools\nimport numpy\n\nrl = sys.stdin.readline\n\nn, k= map(int, rl().split())\nli = [[0, 0]]*n\nfor _ in range(k):\n a, b = rl().split()\n a = int(a) - 1\n if li[a][1] == 0:\n if b == 'WA':\n li[a][0] += 1\n else:\n li[a][1] = 1\nac = 0\nwa = 0\nprint(li)\nfor lis in li:\n i, v = lis\n wa += i\n if v == 1:\n ac += 1\nprint(ac, wa)\n\n\n\n\n", "import sys\nimport math\nimport itertools\nimport numpy\n\nrl = sys.stdin.readline\n\nn, k= map(int, rl().split())\nli = [[0, 0] for _ in range(n)]\nfor _ in range(k):\n a, b = rl().split()\n b = b.rstrip()\n a = int(a) - 1\n if b == 'WA':\n li[a][0] += 1\n elif li[a][1] == 0:\n li[a][1] = 1\nac = 0\nwa = 0\nfor lis in li:\n i, v = lis\n wa += i\n if v == 1:\n ac += 1\nprint(ac, wa)\n\n\n\n\n", "import sys\nimport math\nimport itertools\nimport numpy\n\nrl = sys.stdin.readline\n\nn, k= map(int, rl().split())\nli = [['WA'] for _ in range(n)]\nfor _ in range(k):\n a, b = rl().split()\n a = int(a)\n a -= 1\n if li[a][-1] == 'WA':\n li[a].append(b)\nprint(li)\nac = 0\nwa = 0\nfor i in li:\n for v in i:\n if v == 'AC':\n ac += 1\n elif v == 'WA':\n wa += 1\nprint(ac, wa-len(li))", "import sys\nimport math\nimport itertools\nimport numpy\n\nrl = sys.stdin.readline\n\nn, k= map(int, rl().split())\nli = [[0, 0] for _ in range(n)]\nfor _ in range(k):\n a, b = rl().split()\n b = b.rstrip()\n a = int(a) - 1\n if li[a][1] == 0:\n if b == 'WA':\n li[a][0] += 1\n else:\n li[a][1] = 1\nac = 0\nwa = 0\nfor lis in li:\n i, v = lis\n if v == 1:\n ac += 1\n wa += i\nprint(ac, wa)\n\n\n\n\n"]
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s500076881', 's661137372', 's664429447', 's445764116']
[16096.0, 22172.0, 34524.0, 22128.0]
[286.0, 308.0, 457.0, 340.0]
[410, 411, 419, 439]
p02802
u825541307
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 = []\nfor i in range(M):\n L.append(list(map(str,input().split())))\nL.sort()\ncount_AC = 0\ncount_WA = 0\ntemp = 0\nflag = 'WA'\np = 0\n\nfor i in range(M):\n if L[i][0] != p:\n p = L[i][0]\n temp = 0\n flag = 'WA'\n if L[i][1] == 'WA':\n temp += 1\n if L[i][1] == 'AC':\n count_AC += 1\n elif L[i][0] == p:\n if L[i][1] == 'WA':\n temp += 1\n if L[i][1] == 'AC':\n if flag == 'WA':\n count_AC += 1\n count_WA += temp\n flag = 'AC'\n if flag == 'AC':\n pass\n\nprint('{} {}'.format(count_AC, count_WA))", "N,M = map(int,input().split())\nL = []\nfor i in range(M):\n L.append(list(map(str,input().split())))\nfrom operator import itemgetter\nL.sort(key=itemgetter(0))\ncount_AC = 0\ncount_WA = 0\ntemp = 0\np = 0\n#print(L)\n\nfor i in range(M):\n #print(L[i])\n if L[i][0] != p:\n p = L[i][0]\n temp = 0\n flag = 'WA'\n if L[i][1] == 'WA':\n temp += 1\n else:\n count_AC += 1\n flag = 'AC'\n else:\n if L[i][1] == 'WA':\n temp += 1\n else:\n if flag == 'WA':\n count_AC += 1\n count_WA += temp\n flag = 'AC'\n else:\n pass\n \n #print(temp, count_AC, count_WA)\n\nprint('{} {}'.format(count_AC, count_WA))"]
['Wrong Answer', 'Accepted']
['s875074291', 's310723658']
[32616.0, 33916.0]
[584.0, 537.0]
[679, 765]
p02802
u825627518
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.
["\nN, M = map(int, input().split())\n\nsubmit = []\nfor _ in range(M):\n temp = [x for x in input().split()]\n submit.append(temp)\n\nac = [0]*(N + 1)\nwa = [0]*(N + 1)\n \nfor i in range(M):\n result = submit[i][1]\n question = int(submit[i][0])\n \n if result == 'AC' and ac[question] == 0:\n ac[question] = 1\n elif result == 'WA' and ac[question] == 0:\n wa[question] += 1\n\nfor i in range(n + 1):\n if ac[i] != 1:\n wa[i] = 0\n\nprint(sum(ac), sum(wa))\n ", "\nN, M = map(int, input().split())\n \nsubmit = []\nfor _ in range(M):\n temp = [x for x in input().split()]\n submit.append(temp)\n \nac = [0]*(N + 1)\nwa = [0]*(N + 1)\n \nfor i in range(M):\n result = submit[i][1]\n question = int(submit[i][0])\n \n if result == 'AC' and ac[question] == 0:\n ac[question] = 1\n elif result == 'WA' and ac[question] == 0:\n wa[question] += 1\n \nfor i in range(N + 1):\n if ac[i] != 1:\n wa[i] = 0\n \nprint(sum(ac), sum(wa))\n "]
['Runtime Error', 'Accepted']
['s240747241', 's883571423']
[27404.0, 27404.0]
[325.0, 340.0]
[481, 485]
p02802
u828277092
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())\nlst = [input().split() for i in range(m)]\n\nac = [0] * n\nwa = [0] * n\n\nfor i in range(m):\n p_i = int(lst[i][0])\n if lst[i][1] == 'AC':\n ac[p_i-1] = 1\n else:\n if ac[p_i-1] == 0:\n wa[p_i-1] += 1\n\nprint(ac)\nprint(wa)\n\nnum_ac = sum(ac)\npnlt = sum(wa)\n\nprint(num_ac, pnlt)\n", "n, m = map(int, input().split()) \nlst = [input().split() for i in range(m)]\n\nac = [False] * n\nwa = [0] * n\n\nfor i in range(m):\n p_i = int(lst[i][0])\n s_i = lst[i][1]\n if s_i == 'AC':\n ac[p_i-1] = True\n else:\n if ac[p_i-1] is False:\n wa[p_i-1] += 1\n\nnum_ac = 0\npnlt = 0\nfor i in range(n):\n if ac[i]:\n num_ac += 1\n pnlt += wa[i]\nprint(num_ac, pnlt)\n"]
['Wrong Answer', 'Accepted']
['s215694516', 's781099245']
[35152.0, 33696.0]
[280.0, 274.0]
[334, 433]
p02802
u831835224
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.
["params = input().split(' ')\nn = eval(params[1])\n\nAC = set()\nWA = {}\n\npenalties = 0\npoints = 0\n\nfor i in range(n):\n submission = input().split(' ')\n p = eval(submission[0])\n status = submission[1]\n \n if p in AC:\n continue\n \n if status == 'AC':\n AC.add(p)\n points += 1\n penalties += getPenalties(p)\n \n elif p in WA:\n WA[p] += 1\n\n else:\n WA[p] = 1\n\nprint(points, penalties)\n\n\ndef getPenalties(x):\n if x in WA:\n return WA[x]\n return 0\n", "params = input().split(' ')\nn = eval(params[1])\n\nAC = set()\nWA = {}\n\npenalties = 0\npoints = 0\n\nfor i in range(n):\n submission = input().split(' ')\n p = eval(submission[0])\n status = submission[1]\n \n if p in AC:\n continue\n \n if status == 'AC':\n AC.add(p)\n points += 1\n penalties += getPenalties(p)\n \n elif p in WA:\n WA[p] += 1\n\n else:\n WA[p] = 1\n \n\n\ndef getPenalties(x):\n if x in WA:\n return WA[x]\n return 0", "params = input().split(' ')\nn = params[1]\n\nacfoundfor = []\n\npenalties = 0\npoints = 0\n\nfor i in range(n):\n submission = input().split(' ')\n p = eval(submission[0])\n status = submission[1]\n \n if p in acfoundfor:\n continue\n\n if status == 'AC':\n points += 1\n acfoundfor.append(p)\n else:\n penalties += 1\n", "params = input().split(' ')\nm = eval(params[0])\nn = eval(params[1])\n\npenaltyCount = []\n\nfor i in range(m):\n penaltyCount.append(0)\n\npenalties = 0\npoints = 0\n\nfor i in range(n):\n submission = input().split(' ')\n p = eval(submission[0])\n status = submission[1]\n \n if penaltyCount[p] == -1:\n continue\n\n if status == 'AC':\n penalties += penaltyCount[p]\n penaltyCount[p] = -1\n points += 1\n else:\n penaltyCount[p] += 1\n\n\nprint(points, penalties)\n", "params = input().split(' ')\nn = eval(params[1])\n\nacfoundfor = []\n\npenalties = 0\npoints = 0\n\nfor i in range(n):\n submission = input().split(' ')\n p = eval(submission[0])\n status = submission[1]\n \n if p in acfoundfor:\n continue\n\n if status == 'AC':\n points += 1\n acfoundfor.append(p)\n else:\n penalties += 1", "params = input().split(' ')\nm = eval(params[0])\nn = eval(params[1])\n\npenaltyCount = []\n\nfor i in range(m):\n penaltyCount[i] = 0\n\npenalties = 0\npoints = 0\n\nfor i in range(n):\n submission = input().split(' ')\n p = eval(submission[0])\n status = submission[1]\n \n if penaltyCount[p] == -1:\n continue\n\n if status == 'AC':\n penaltyCount += penaltyCount[p]\n penaltyCount[p] = -1\n points += 1\n else:\n penaltyCount[p] += 1\n\n\nprint(points, penalties)", "params = input().split(' ')\nn = eval(params[1])\n\npenaltyCount = [0] * eval(params[0])\n\npenalties = 0\npoints = 0\n\nfor i in range(n):\n submission = input().split(' ')\n p = eval(submission[0])\n status = submission[1]\n \n if penaltyCount[p] == -1:\n continue\n\n if status == 'AC':\n penaltyCount += penaltyCount[p]\n penaltyCount[p] = -1\n points += 1\n else:\n penaltyCount[p] += 1\n\n\nprint(points, penalties)\n", "params = input().split(' ')\nm = eval(params[0])\nn = eval(params[1])\n\npenaltyCount = []\n\nfor i in range(m):\n penaltyCount.append(0)\n\npenalties = 0\npoints = 0\n\nfor i in range(n):\n submission = input().split(' ')\n p = eval(submission[0])-1\n status = submission[1]\n \n if penaltyCount[p] == -1:\n continue\n\n if status == 'AC':\n penalties += penaltyCount[p]\n penaltyCount[p] = -1\n points += 1\n else:\n penaltyCount[p] += 1\n\n\nprint(points, penalties)"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s127834950', 's276460880', 's355008713', 's664277454', 's806517211', 's825497557', 's843356752', 's287213502']
[3064.0, 3188.0, 3060.0, 3888.0, 3684.0, 3064.0, 3828.0, 3888.0]
[1086.0, 1132.0, 17.0, 1076.0, 2104.0, 18.0, 31.0, 1173.0]
[516, 494, 348, 499, 353, 498, 454, 500]
p02802
u832459318
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())\nps = [list(input().split()) for _ in range(m)]\n\nq = [0]*n\nt = 0\n\nfor [p,s] in ps:\n p = int(p) - 1\n if s == "AC" and q[p] == 0:\n q[p] += 1\n elif s == "WA":\n t += 1\n\nprint(sum(q),t)\n', 'import collections\nn,m = map(int, input().split())\nps = [list(input().split()) for _ in range(m)]\n\nq = [0]*n\nt = [0]*n\n\nfor [p,s] in ps:\n p = int(p) - 1\n if s == "AC" and q[p] == 0:\n q[p] += 1\n elif s == "WA" and q[p]== 0:\n t[p] += 1\n\nfor [p,s] in ps:\n if q[p] == 0 and t[p] != 0:\n t[p] == 0\n\n\nprint(sum(q),sum(t))\n', 'import collections\nn,m = map(int, input().split())\nps = [list(input().split()) for _ in range(m)]\n\nq = [0]*n\nt = [0]*n\n\nfor [p,s] in ps:\n p = int(p) - 1\n if s == "AC" and q[p] == 0:\n q[p] += 1\n elif s == "WA" and q[p]== 0:\n t[p] += 1\n\n\n"""\nfor [u,r] in ps:\n u = int(u) -1\n if q[u] == 0 and t[u] != 0:\n t[u] == 0\n"""\n\nw = 0\nfor i, uc in enumerate(q):\n if uc == 1:\n w += t[i]\n \n\n\nprint(sum(q),w)\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s738971221', 's951511634', 's039403110']
[26936.0, 27832.0, 27832.0]
[283.0, 298.0, 296.0]
[254, 348, 443]
p02802
u840958781
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())\nansa=0\nlip,lis=[],[]\nif m==0:\n print(0,0)\nelse:\n for i in range(m):\n p,s=map(str,input().split())\n lip.append(p)\n lis.append(s)\n if s=="AC":\n if next!=p:\n ansa+=1\n next= p\n\n print(ansa,lis.count("WA"))', 'n,m=map(int,input().split())\nwa,ac=0,0\nac_number,last_wa=0,0\nfor i in range(m):\n p,s=input().split()\n if s=="WA":\n wa+=1\n wa_number=int(p)\n elif s=="AC" and ac_number!=int(p): \n ac+=1\n ac_number=int(p)\n if wa_number==ac_number:\n last_wa+=wa\nprint(ac,last_wa)', 'n,m=map(int,input().split())\nansa=0\nlip,lis=[],[]\nif m==0:\n print(0,0)\nelse:\n for i in range(m):\n p,s=map(str,input().split())\n lip.append(p)\n lis.append(s)\n if s=="AC":\n if next!=p:\n ansa+=1\n next= p\n\n print(ansa,lis.count("WA"))\nprint(lis)', 'n,m=map(int,input().split())\nwa,ac=0,0\nac_number,last_wa=0,0\nfor i in range(m):\n p,s=input().split()\n if s=="WA":\n wa+=1\n elif ac_number==int(p):\n last_wa+=wa\n wa=0\n if s=="AC" and ac_number!=int(p):\n ac+=1\n ac_number=int(p)\nprint(ac,last_wa)', 'n,m=map(int,input().split())\nlip,lis=[],[]\nold=0\nansa,ansb=0,0\nwa=0\nfor i in range(m):\n p,s=input().split()\n if i==0:\n old=p\n if s=="AC": \n ansa+=1\n else:\n wa+=1\n elif old!=p:\n if s=="AC":\n ansa+=1\n old=p \n ansb=wa \n else:\n wa+=1\n else:\n wa=0\nprint(ansa,ansb)\n', 'n,m=map(int,input().split())\nac,wa,wakoho=0,0,0\nfor i in range(m):\n p,s=input().split()\n p=int(p)\n if i==0:\n last="a"\n lastwa="a"\n if s=="AC" and p!=last:\n ac+=1\n wa+=wakoho\n elif s=="WA" and p==lastwa:\n wakoho+=1\n lastwa=p\n if s=="AC":\n last=p\n wakoho=0\nprint(ac,wa)', 'n,m=map(int,input().split())\nWA,wa,ac=0,0,0\nfor i in range(m):\n p,s=input().split()\n p=int(p)\n if i==0 and s=="AC":\n ac+=1\n before=p\n if i>0 and p!=before:\n wa=0\n if s=="WA":\n wa+=1\n elif s=="AC" and p!=before:\n WA+=wa\n ac+=1\n before=p\nprint(ac,WA)', 'n,m=map(int,input().split())\nacs=[0]*n\nwas=[0]*n\nWA=0\nfor i in range(m):\n p,s=input().split()\n p=int(p)\n if acs[p-1]==0:\n if s=="AC":\n acs[p-1]=1\n WA+=was[p-1]\n else:\n was[p-1]+=1\nprint(sum(acs),WA)']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s036044262', 's144132234', 's173447049', 's339286786', 's491405995', 's606561468', 's720665968', 's923572657']
[15792.0, 3064.0, 17548.0, 3064.0, 3064.0, 3064.0, 3064.0, 4596.0]
[298.0, 257.0, 314.0, 307.0, 220.0, 263.0, 297.0, 286.0]
[308, 350, 319, 289, 493, 341, 311, 254]
p02802
u842964692
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\npn_num=0\nWA_list=[0]*N\nAC_list=[0]*N\n\nfor _ in range(M):\n pi,Si=input().split()\n pi=int(pi-1)\n \n if Si=='AC':\n pn_num+=WA_list[pi-1]\n \n else:\n WA_list[pi-1]+=1\n \nprint(sum(AC_list),pn_num)", "N,M=map(int,input().split())\n\npn_num=0\nWA_list=[0]*N\nAC_list=[0]*N\n\nfor _ in range(M):\n pi,Si=input().split()\n pi=int(pi)\n \n if Si=='AC':\n pn_num+=WA_list[pi-1]\n \n else:\n WA_list[pi-1]+=1\n \nprint(sum(AC_list),pn_num)", "N,M=map(int,input().split())\n\npn_num=0\nAC_list=[0]*N\n\nfor _ in range(M):\n pi,Si=input().split()\n pi=int(pi-1)\n \n if Si=='AC':\n AC_list[pi]=1\n \n else:\n if AC_list[pi]==0:\n pn_num+=1\n \nprint(sum(AC_list),pn_num)", "N,M=map(int,input().split())\n\npn_num=0\nWA_list=[0]*N\nAC_list=[0]*N\n\nfor _ in range(M):\n pi,Si=input().split()\n pi=int(pi)\n \n if Si=='AC':\n pn_num+=WA_list[pi-1]\n \n else:\n WA_list[pi-1]+=1\n \nprint(sum(AC_list),pn_num)", "N,M=map(int,input().split())\n\npn_num=0\nAC_list=[0]*N\n\nfor _ in range(M):\n pi,Si=input().split()\n pi=int(pi-1)\n \n if Si=='AC':\n AC_list[pi]=1\n \n else:\n if AC_list[pi]==0:\n pn_num+=1\n \nprint(sum(AC_list),pn_num)", "N,M=map(int,input().split())\n\npn_num=0\nWA_list=[0]*N\nAC_list=[0]*N\n\nfor _ in range(M):\n pi,Si=input().split()\n pi=int(pi)\n \n if Si=='AC':\n if AC_list[pi-1]==0:\n pn_num+=WA_list[pi-1]\n AC_list[pi-1]=1\n \n else:\n WA_list[pi-1]+=1\n \nprint(sum(AC_list),pn_num)"]
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s186929681', 's273588236', 's685593716', 's753223700', 's995784151', 's854321362']
[4596.0, 4596.0, 3828.0, 4596.0, 3828.0, 4596.0]
[20.0, 262.0, 19.0, 266.0, 19.0, 283.0]
[257, 255, 259, 255, 259, 316]
p02802
u843768197
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 = [list(input().split()) for i in range(m)]\ncnt = 0\nans = [0]*n\nnum = 0\nfor i in range(0, m):\n num = int(l[i][0])\n if l[i][1] == 'AC':\n ans[num] = 1\n elif ans[num] != 1: \n cnt += 1\nprint(sum(ans), cnt)", "n, m = map(int, input().split())\nPenalty = [0]*(n+1)\nAC = [False]*(n+1)\ncorrect = 0\npenalty = 0\nfor i in range(m):\n ans = input().split()\n problem = int(ans[0])\n result = ans[1]\n if AC[problem] == False:\n if result == 'AC':\n AC[problem] = True\n correct += 1\n penalty += Penalty[problem]\n else:\n Penalty[problem] += 1\nprint(correct, penalty)"]
['Runtime Error', 'Accepted']
['s170900404', 's298761774']
[31044.0, 10352.0]
[220.0, 185.0]
[248, 370]
p02802
u844789719
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, *PS = open(0).read().split()\nN, M = [int(_) for _ in [N, M]]\ncor = [0] * (N + 1)\npen = [0] * (N + 1)\nfor p, s in PS:\n p = int(p)\n if cor[p] == 1:\n continue\n if s == 'AC':\n cor[p] = 1\n else:\n pen[p] += 1\nans = [0, 0]\nfor i in range(1, N + 1):\n if cor[p] == 0:\n continue\n ans[0] += 1\n ans[1] += pen[ @ ]\nprint(*ans)\n", "N, M, *PS = open(0).read().split()\nN, M = [int(_) for _ in [N, M]]\ncor = [0] * (N + 1)\npen = [0] * (N + 1)\nfor p, s in zip(PS[::2], PS[1::2]):\n p = int(p)\n if cor[p] == 1:\n continue\n if s == 'AC':\n cor[p] = 1\n else:\n pen[p] += 1\nans = [0, 0]\nfor i in range(1, N + 1):\n if cor[i] == 0:\n continue\n ans[0] += 1\n ans[1] += pen[i]\nprint(*ans)\n"]
['Runtime Error', 'Accepted']
['s872021105', 's433469705']
[8968.0, 26040.0]
[22.0, 102.0]
[369, 387]
p02802
u857070771
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)]\nwt=[0 for _ in range(n)]\npen=0\nfor i in range(m):\n p,s=input().split()\n if s=="AC":\n ac.append(p)\n pen += wt[int(p)]\n else:\n if p in ac:\n pass\n else:\n wt[int(p)] += 1\n \nt_ac=set(ac))\nprint(len(t_ac),pen)\n\n\n\n\n\n', 'n,m=map(int,input().split())\nac=[]\nwt=[0 for _ in range(n)]\npen=0\nfor i in range(m):\n p,s=input().split()\n if s=="AC":\n ac.append(p)\n pen += wt[p]\n else:\n if p in ac:\n pass\n else:\n wt[p] += 1\n \nt_ac=set(ac)\nprint(len(t_ac),pen)', 'n,m=map(int,input().split())\nac=[]\nwt=[]\npen=0\nfor i in range(m):\n p,s=input().split()\n if s=="AC":\n ac.append(p)\n pen += wt[p]\n else:\n if p in ac:\n pass\n else:\n wt[p] += 1\n \nt_ac=set(ac)\nprint(len(t_ac),pen)\n', 'n,m=map(int,input().split())\nac=[False]*(n+1)\nwa=[0]*(n+1)\npena=0\nfor i in range(m):\n p,s=input().split()\n p=int(p)\n if s == "AC":\n ac[p] = True\n else:\n if False:\n wa[p] += 1\n else:\n continue\nfor i in ac:\n if i == True:\n pena += wa[index(i)]', 'n,m=map(int,input().split())\nac=[0 for _ in range(n)]\nwt=[0 for _ in range(n)]\npen=0\nfor i in range(m):\n p,s=input().split()\n if s=="AC":\n ac.append(int(p))\n pen += wt[int(p)]\n else:\n if int(p) in ac:\n pass\n else:\n wt[int(p)] += 1\n \nt_ac=set(ac))\nprint(len(t_ac),pen)\n\n\n\n\n\n', 'n,m=map(int,input().split())\nAC=[0 for _ in range(n)]\nWA=[0 for _ in range(n)]\npen=0\nfor _ in range(m):\n p,s=input().split()\n p=int(p)\n if s=="AC":\n if AC[p-1]==0:\n AC[p-1]=1\n pen += WA[p-1]\n else:\n pass\n else:\n if AC[p-1]==0:\n WA[p-1] +=1\n else:\n pass\nprint(AC.count(1),pen)\n ']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s099225334', 's289265302', 's596314426', 's894760422', 's974641348', 's157044034']
[2940.0, 3888.0, 3060.0, 4724.0, 2940.0, 4656.0]
[17.0, 21.0, 17.0, 230.0, 17.0, 294.0]
[333, 297, 279, 306, 343, 383]
p02802
u857293613
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())\nlis = [list(input().split()) for _ in range(m)]\nd = {}\nac, wa = 0, 0\nfor i in lis:\n if i[0] not in d:\n if i[1] == 'AC':\n ac += 1\n d[i[0]] = 'AC'\n else:\n d[i[0]] = 1\n else:\n if i[1] == 'AC':\n if d[i[0]] != 'AC':\n ac += 1\n wa += d[i[0]]\n d[i[0]] = 'AC'\n else:\n d[i[0]] += 1\nprint(ac, wa)", "n, m = map(int, input().split())\nlis = [list(input().split()) for _ in range(m)]\nd = {}\nac, wa = 0, 0\nfor i in lis:\n if i[0] not in d:\n if i[1] == 'AC':\n ac += 1\n d[i[0]] = 'AC'\n else:\n d[i[0]] = 1\n else:\n if i[1] == 'AC':\n if d[i[0]] != 'AC':\n ac += 1\n wa += d[i[0]]\n d[i[0]] = 'AC'\n else:\n if d[i[0]] != 'AC':\n d[i[0]] += 1\nprint(ac, wa)"]
['Runtime Error', 'Accepted']
['s511003584', 's696396075']
[35272.0, 35264.0]
[275.0, 287.0]
[452, 488]
p02802
u857428111
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\n# Your code here!\n\ndef pin(type=int):\n return eval("map(type,input().split())")\n\n\n\nN,M = pin()\np=[0 for i in range(0,M)]\nS=[0 for i in range(0,M)]\nfor i in range(0,M):\n p[i],S[i] =pin(str)\n\n#print(p,S)\n\nAC=[0 for i in range(0,N)]\nPenalties = [0 for i in range(0,N)]\n\nfor i in range(0,N):\n for j in range(0,M):\n \n \n if int(p[j])-1==i:\n if (S[j]) == \'WA\':\n Penalties[int(p[j])-1] += 1\n else:\n AC[int(p[j])-1] = 1\n break\n print(AC,Penalties)\nprint(AC,Penalties)\nacnum=0\npennum=0\nfor i in range(0,N):\n acnum += AC[i]\n if AC[i]==1:\n pennum += Penalties[i]\n\nprint(acnum,pennum)', '# coding: utf-8\n# Your code here!\n\ndef pin(type=int):\n return eval("map(type,input().split())")\n\n\n\nN,M = pin()\np=[0 for i in range(0,M)]\nS=[0 for i in range(0,M)]\nfor i in range(0,M):\n p[i],S[i] =pin(str)\n\n#print(p,S)\n\nAC=[0 for i in range(0,N)]\nPenalties = [0 for i in range(0,N)]\n\n\nfor j in range(0,M):\n \n if (S[j]) == \'WA\':\n Penalties[int(p[j])-1] += 1\n else:\n AC[int(p[j])-1] = 1\n continue\n\nacnum=0\npennum=0\nfor i in range(0,N):\n acnum += AC[i]\n if AC[i]==1:\n pennum += Penalties[i]\n\nprint(acnum,pennum)', '# coding: utf-8\n# Your code here!\n\ndef pin(type=int):\n return map(type,input().split())\n\n\n\n\nN,M = pin() \np=[0 for j in range(0,M)]\nS=[0 for j in range(0,M)]\nfor j in range(0,M):\n p[j],S[j] =pin(str) \n \n# O(3M)...?\n#print(p)\n#print(p,S)\n\nAC=[0 for i in range(0,N)]\nPenalties = [0 for i in range(0,N)]\n\n\n\n\n\n\n\nfor j in range (0,M):\n if S[j] == "AC":\n if AC[int(p[j])-1]==1:\n continue\n else:\n AC[int(p[j])-1]=1\n else:#wa or something\n if AC[int(p[j])-1]==1:\n continue\n else:\n Penalties[int(p[j])-1]+=1\n # print(AC,Penalties)\n\nfor i in range(0,N):\n if AC[i] == 0:\n Penalties[i]=0\n#print("///////") \n#print(AC,Penalties) \n\n\n\n\nprint(AC.count(1),sum(Penalties))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s645388146', 's871014574', 's467719729']
[32904.0, 17384.0, 17296.0]
[2104.0, 2042.0, 382.0]
[1279, 1131, 1817]
p02802
u863964720
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(map(str,input().split())) for i in range(M)]\nA_num = [0]*N\nW_num = [0]*N\nw=0\n#print(PS)\nfor j in range(M):\n #print(A_num)\n if PS[j][1] == 'WA'and A_num[int(PS[j][0])-1]==0:\n W_num[int(PS[j][0]-1)]=1 \n if PS[j][1]== 'AC' and A_num[int(PS[j][0])-1]==0:\n A_num[int(PS[j][0])-1]=1\ns = sum(A_num)\nfor k in range(N):\n if A_num[k] == 0:\n W_num[k]=0\nw = sum(W_num)\nprint(s,w)", "N,M = map(int,input().split())\nPS = [list(map(str,input().split())) for i in range(M)]\nA_num = [0]*N\nw=0\nprint(PS)\nfor j in range(M):\n print(A_num)\n if PS[j][1] == 'WA'and A_num[int(PS[j][0])-1]==0:\n w+=1\n if PS[j][1]== 'AC' and A_num[int(PS[j][0])-1]==0:\n A_num[int(PS[j][0])-1] =1\ns = sum(A_num)\nprint(s,w)", "N,M = map(int,input().split())\nPS = [list(map(str,input().split())) for i in range(M)]\nA_num = [0]*N\nW_num = [0]*N\nw=0\n#print(PS)\nfor j in range(M):\n #print(A_num)\n if PS[j][1] == 'WA'and A_num[int(PS[j][0])-1]==0:\n W_num[int(PS[j][0])-1]+=1 \n if PS[j][1]== 'AC' and A_num[int(PS[j][0])-1]==0:\n A_num[int(PS[j][0])-1]=1\ns = sum(A_num)\nfor k in range(N):\n if A_num[k] == 0:\n W_num[k]=0\nw = sum(W_num)\nprint(s,w)"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s387648557', 's911573445', 's874343127']
[33688.0, 124108.0, 33680.0]
[405.0, 2105.0, 414.0]
[442, 331, 443]
p02802
u864069774
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)]\nPS = [[int(PS[i][0])-1,PS[i][1]] for i in range(M)]\nAC = [0]*N\nWA = [0]*N\n\nfor i in range(M):\n print(PS[i][0])\n if AC[PS[i][0]] == 0:\n if PS[i][1] == "AC":\n AC[PS[i][0]] = 1\n else:\n WA[PS[i][0]] += 1\n # print(AC,WA)\nw = 0\nfor i in range(N):\n if AC[i] == 1:\n w += WA[i]\nprint(sum(AC),w)\n', 'N,M = map(int,input().split())\nPS = [list(input().split()) for i in range(M)]\nPS = [[int(PS[i][0])-1,PS[i][1]] for i in range(M)]\nAC = [0]*N\nWA = [0]*N\n\nfor i in range(M):\n # print(PS[i][0])\n if AC[PS[i][0]] == 0:\n if PS[i][1] == "AC":\n AC[PS[i][0]] = 1\n else:\n WA[PS[i][0]] += 1\n # print(AC,WA)\nw = 0\nfor i in range(N):\n if AC[i] == 1:\n w += WA[i]\nprint(sum(AC),w)']
['Wrong Answer', 'Accepted']
['s622503045', 's435731607']
[39368.0, 39368.0]
[440.0, 350.0]
[423, 424]
p02802
u865383026
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 = [list(input().split()) for i in range(M)]\nac = [L[j] for j in range(M) if [L[j][0], 'AC'] not in L[:j]]\nprint(0, 0)", "N, M = map(int, input().split())\nL = [list(input().split()) for i in range(M)]\nac = [L[j] for j in range(M) if [L[j][0], 'AC'] not in L[:j]]", "import numpy as np\nN, M = map(int, input().split())\nL = [list(input().split()) for i in range(M)]\nAC = np.array([L[j] for j in range(M) if [L[j][0], 'AC'] not in L[:j]])\nprint(np.count_nonzero(AC == 'AC', axis = 1), np.count_nonzero(AC == 'WA', axis = 1))", "N, M = map(int, input().split())\nP = [0] * (N + 1)\nS = [0] * (N + 1)\nfor i in range(M):\n x, p = input().split()\n s = int(x)\n if P[s] == 0:\n if p == 'AC':\n P[s] = 1\n else:\n S[s] += 1\nA = sum([S[i] for i in range(N + 1) if P[i] == 1])\nprint(P.count(1), A)"]
['Wrong Answer', 'Wrong Answer', 'Time Limit Exceeded', 'Accepted']
['s315064425', 's659660083', 's854485530', 's503858580']
[27212.0, 26064.0, 35360.0, 5528.0]
[2105.0, 2105.0, 2110.0, 275.0]
[152, 140, 255, 272]