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
u394731058
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())\nla = []\nlw = []\nlwa = []\nfor i in range(n):\n la.append(0)\n lw.append(0)\n lwa.append(0)\nfor _ in range(m):\n q,a = input().split()\n if a == "WC" and la[int(q)-1] != 1:\n lw[int(q)-1] += 1\n elif a == "AC" and la[int(q)-1] != 1:\n la[int(q)-1] = 1\n lwa[int(q)-1] = lw[int(q)-1]\n \nprint(sum(la), sum(lwa))', 'n,m = map(int, input().split())\na = []\nfor _ in range(n):\n a.append(0)\nw = a.copy()\nx = a.copy()\nfor _ in range(m):\n q,r = input().split()\n q = int(q)-1\n if r == "WA" and a[q] != 1:\n w[q] += 1\n elif r == "AC" and a[q] != 1:\n x[q] = w[q]\n a[q] = 1\nprint(sum(a), sum(x))']
['Wrong Answer', 'Accepted']
['s188193924', 's696514987']
[5580.0, 5528.0]
[346.0, 283.0]
[348, 282]
p02802
u395202850
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\nac = [0] * n\nwa = [0] * n\n\nfor i in range(m):\n \n p, s = list(input().split())\n p = int(p) - 1\n\n \n if ac[p] != 1:\n wa[p] = 1\n\n \n if s == "AC":\n ac[p] = 1\n\n print(ac, wa)\n\nprint(sum(ac), sum(wa))\n', "n, m = map(int, input().split())\nlistAC = [0] * n\nlistWAAC = [0] * n\nlistWA = [0] * n\nfor i in range(m):\n p, s = map(str, input().split())\n p = int(p) - 1\n if listAC[p] == 1:\n continue\n if s == 'AC':\n listAC[p] += 1\n listWAAC[p] += listWA[p]\n continue\n listWA[p] += 1\n\nprint(sum(listAC), sum(listWAAC))\n"]
['Wrong Answer', 'Accepted']
['s324936835', 's267484835']
[106768.0, 11100.0]
[2104.0, 243.0]
[408, 346]
p02802
u398175819
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\nnAC = 0\nnWA = 0\nresult_dic = {}\n\nfor i in range(M):\n pi, si = input().split()\n \n if pi not in result_dic.keys():\n# result_dic[pi] = si\n if si == "AC":\n result_dic[pi] = [si,0]\n nAC += 1\n else:\n result_dic[pi] = [si,1]\n else:\n pi_res = result_dic[pi][0]\n if pi_res == "AC":\n pass\n elif pi_res == "WA":\n if si == "AC":\n nWA += result_dic[pi][1]\n nAC += 1\n result_dic[pi] = [si,0]\n elif si == "WA":\n result_dic[pi][1] += 1\n print(result_dic)\n\nprint(nAC,nWA)', 'N,M = map(int,input().split())\n\nnAC = 0\nnWA = 0\nresult_dic = {}\n\nfor i in range(M):\n pi, si = input().split()\n \n if pi not in result_dic.keys():\n# result_dic[pi] = si\n if si == "AC":\n result_dic[pi] = [pi,0]\n nAC += 1\n else:\n result_dic[pi] = [pi,1]\n else:\n pi_res = result_dic[pi][0]\n if pi_res == "AC":\n pass\n elif pi_res == "WA":\n if si == "AC":\n nWA += result_dic[pi][1]\n nAC += 1\n result_dic[pi] = si\n elif si == "WA":\n result_dic[pi][1] += 1\n\nprint(nAC,nWA)', 'N,M = map(int,input().split())\n\nnAC = 0\nnWA = 0\nresult_dic = {}\n\nfor i in range(M):\n pi, si = input().split()\n \n if pi not in result_dic.keys():\n# result_dic[pi] = si\n if si == "AC":\n result_dic[pi] = [si,0]\n nAC += 1\n else:\n result_dic[pi] = [si,1]\n else:\n pi_res = result_dic[pi][0]\n if pi_res == "AC":\n pass\n elif pi_res == "WA":\n if si == "AC":\n nWA += result_dic[pi][1]\n nAC += 1\n result_dic[pi] = [si,0]\n elif si == "WA":\n result_dic[pi][1] += 1\n# print(result_dic)\n\nprint(nAC,nWA)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s412884949', 's996342748', 's533517009']
[94120.0, 25308.0, 30152.0]
[2104.0, 300.0, 307.0]
[670, 644, 672]
p02802
u401487574
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())\nac = [0]*(n+1)\nwa = [0]*(n+1)\nfor i in range(m):\n p,s = input().split()\n p = int(p)\n if s=="AC":\n ac[p]=1\n else:\n if ac[p] ==0:\n wa[p]+=1\nw = 0\nfor i in range(n):\n if ac[i] ==1:\n w+=wa[i]\nprint(sum(ac),w)\n', '\nn,m = map(int,input().split())\nac = [0]*(n+1)\nwa = [0]*(n+1)\nfor i in range(m):\n p,s = input().split()\n p = int(p)\n if s=="AC":\n ac[p]=1\n else:\n if ac[p] ==0:\n wa[p]+=1\nw = 0\nfor i in range(n+1):\n if ac[i] ==1:\n w+=wa[i]\nprint(sum(ac),w)\n']
['Wrong Answer', 'Accepted']
['s485506649', 's893397617']
[4596.0, 4596.0]
[278.0, 272.0]
[284, 286]
p02802
u405256066
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 sys import stdin\nN,M = [int(x) for x in stdin.readline().rstrip().split()]\nans = [[] for i in range(N)]\nfor i in range(M):\n p,s = [(x) for x in stdin.readline().rstrip().split()]\n ans[int(p)-1].append(s)\n\nac = 0\npe = 0\ntmp = 0\nflag = False\nfor j in range(N):\n for k in ans[j]:\n if k == "WA":\n tmp += 1\n else:\n ac += 1\n pe += tmp\n break\nprint(ac,pe)', 'from sys import stdin\nN,M = [int(x) for x in stdin.readline().rstrip().split()]\nans = [[] for i in range(N)]\nfor i in range(M):\n p,s = [(x) for x in stdin.readline().rstrip().split()]\n ans[int(p)-1].append(s)\n\nac = 0\npe = 0\ntmp = 0\nflag = False\nfor j in range(N):\n tmp = 0\n for k in ans[j]:\n if k == "WA":\n tmp += 1\n else:\n ac += 1\n pe += tmp\n tmp = 0\n break\nprint(ac,pe)']
['Wrong Answer', 'Accepted']
['s671606418', 's200324147']
[20320.0, 20344.0]
[234.0, 234.0]
[420, 452]
p02802
u405483159
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n, m = map( int, input().split())\n\nac = [False] * n\nwa = [0] * n\n\nfor i in range( m ):\n p = input().split()\n prob_no =int( p[ 0 ])\n if p[ 1 ] == "WA":\n wa[ prob_no - 1 ] += 1\n else:\n ac[ prob_no - 1 ] = True\n\nwa_cnt = 0\nfor i in range( n ):\n if ac[ i ]:\n wa_cnt += wa[ i ]\nac_cnt = sum( ac )\n\nprint( ac_cnt, wa_cnt )', 'n, m = map( int, input().split())\n\nac = [False] * n\nwa = [0] * n\n\nfor i in range( m ):\n p = input().split()\n prob_no =int( p[ 0 ])\n if p[ 1 ] == "WA":\n if not ac[ prob_no - 1 ]:\n wa[ prob_no - 1 ] += 1\n else:\n ac[ prob_no - 1 ] = True\n\nwa_cnt = 0\nfor i in range( n ):\n if ac[ i ]:\n wa_cnt += wa[ i ]\nac_cnt = sum( ac )\n\nprint( ac_cnt, wa_cnt )']
['Wrong Answer', 'Accepted']
['s627376228', 's311769199']
[4596.0, 4596.0]
[264.0, 270.0]
[330, 362]
p02802
u405733072
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 resolve():\n n,m = map(int,input().split())\n ac_list = [1]*n\n ac = 0\n wa = 0\n for _ in range(m):\n p,s = input().split()\n if s == 'WA' and ac_list[int(p)-1]==1:\n wa += 1\n elif s == 'AC' and ac_list[int(p)-1]==1:\n ac += 1\n ac_list[int(p)-1] = 0\n print(f'{ac} {wa}')\nresolve():", "def resolve():\n n,m = map(int,input().split())\n ac_list = [0]*n\n wa_count = [0]*n\n ac = 0\n wa = 0\n for _ in range(m):\n p,s = input().split()\n if s == 'WA' and (ac_list[int(p)-1]==0):\n wa_count[int(p)-1] += 1\n elif s == 'AC' and (ac_list[int(p)-1]==0):\n ac += 1\n ac_list[int(p)-1] = 1\n for (i,j) in zip(wa_count,ac_list):\n if j: wa+=i\n print(f'{ac} {wa}')\nresolve()"]
['Runtime Error', 'Accepted']
['s818443210', 's846070579']
[9020.0, 10340.0]
[27.0, 193.0]
[349, 449]
p02802
u408262366
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\nhoge = input().split()\nN = int(hoge[0])\nM = int(hoge[1])\n\nif M != 0:\n A = []\n ACnum = []\n ACkazu = []\n for i in range(M):\n hoge = input().split()\n if hoge[1] == "AC" and hoge[0] not in ACkazu:\n ACnum.append(i)\n ACkazu.append(hoge[0])\n A.append(hoge)\n elif hoge[0] not in ACkazu:\n A.append(hoge)\n pena = 0\n _remove = []\n for i in ACnum:\n i = int(i)\n AC_num = A[i][0]\n for j in range(0,i):\n if A[j][0] == A[i][0]:\n pena += 1\n _remove.append(j)\n _remove.append(i)\n \n for i in reversed(_remove):\n A.pop(i)\n pena += len(A)\n print(len(ACnum), end="")\n print(" ", end="")\n print(pena, end="")\nelse:\n print(0, end="")\n print(" ", end="")\n print(0, end="")', 'hoge = input().split()\nN = int(hoge[0])\nM = int(hoge[1])\n\nWA = [0] * 105000\nAC = [False] * 105000\n\nWAnum = 0\nACnum = 0\n\nfor i in range(M):\n hoge = input().split()\n if AC[int(hoge[0])]:\n continue\n if hoge[1] == "AC":\n AC[int(hoge[0])] = True;\n ACnum += 1\n WAnum += WA[int(hoge[0])]\n elif hoge[1] == "WA":\n WA[int(hoge[0])] += 1\n \nprint(ACnum, WAnum)']
['Runtime Error', 'Accepted']
['s789042219', 's327115485']
[40964.0, 4724.0]
[2110.0, 296.0]
[780, 390]
p02802
u411923565
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\nN,M = map(int,input().split())\nS_P_list = []\nfor _ in range(M):\n p,s = input().split()\n S_P_list.append((int(p),s))\nS_P_list = sorted(S_P_list,key = lambda x:x[0],reverse = False) \nprint(S_P_list)\nAC_list = list(set([i[0] for i in S_P_list if i[1] == 'AC']))\nprint(AC_list)\nWA = 0\nAC = 0\nfor i in range(M):\n if (S_P_list[i][0] in AC_list):\n if S_P_list[i][1] == 'AC':\n AC += 1\n AC_list.remove(S_P_list[i][0])\n else:\n WA += 1\nprint(AC,WA)", "#C - Welcome to AtCoder\nN,M = map(int,input().split())\nS_P_list = []\nfor _ in range(M):\n p,s = input().split()\n S_P_list.append((int(p),s))\n\nS_P_list = sorted(S_P_list,key = lambda x:x[0],reverse = False) \n\nAC_list = list(set([i[0] for i in S_P_list if i[1] == 'AC']))\nWA = 0\nAC = 0\nfor i in range(M):\n if (S_P_list[i][0] in AC_list):\n if S_P_list[i][1] == 'AC':\n AC += 1\n AC_list.remove(S_P_list[i][0])\n else:\n WA += 1\nprint(AC,WA)"]
['Wrong Answer', 'Accepted']
['s105465516', 's074710401']
[32884.0, 33012.0]
[1250.0, 1222.0]
[520, 551]
p02802
u418149936
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_set = set()\nwa_cnt_ls = [0] * N\nwa_cnt = 0\nfor i in range(M):\n p, s = input().split(' ')\n idx = int(p) - 1\n if not s in ac_set:\n if s == 'AC':\n wa_cnt += wa_cnt_ls[idx]\n ac_set.add(s)\n else:\n wa_cnt_ls[idx] += 1\nprint(len(ac_set), wa_cnt)", "N, M = map(int, input().split(' '))\nac_list = []\nwa_cnt, wa_cnt_ls = 0, [0] * N\nfor i in range(M):\n p, s = input().split(' ')\n idx = int(p) - 1\n if not p in ac_list:\n if p == 'AC':\n ac_list.append(idx)\n wa_cnt += wa_cnt_ls[idx]\n else:\n wa_cnt_ls[idx] += 1\nprint(len(ac_list), wa_cnt)", "N, M = map(int, input().split(' '))\nac_set = set()\nwa_cnt, wa_cnt_ls = 0, [ 0 for i in range(N) ]\nfor i in range(M):\n p, s = input().split(' ')\n idx = int(p) - 1\n if not idx in ac_set:\n if s == 'AC':\n ac_set.add(idx)\n wa_cnt += wa_cnt_ls[idx]\n else:\n wa_cnt_ls[idx] += 1\nprint(len(ac_set), wa_cnt)"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s006558011', 's015275682', 's198499665']
[9648.0, 9664.0, 18060.0]
[197.0, 183.0, 196.0]
[333, 339, 353]
p02802
u419963262
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())\nkeep=[]\nlis=[]\nac=[0]*N\nwa=[0]*N\nWA=0\nfor i in range(M):\n ps=input().split()\n keep.append(ps)\n \nfor j in range(M):\n if keep[j][1]=="AC":\n ac[int(keep[j][0])]=1\n elif ac[int(keep[j][0])]==0:\n wa[int(keep[j][0])]+=1\nAC=sum(ac)\nfor j in range(M):\n WA+=ac[j]*wa[j]\n \nprint(AC,WA)', 'N,M=map(int,input().split())\nkeep=[]\nlis=[]\nans=0\nfor i in range(M):\n ps=input().split()\n keep.append(ps)\nfor j in range(M):\n if keep[j][1]=="AC":\n if not keep[j][0] in lis:\n ans+=1\n else:\n lis.append(keep[j][0])\nprint(ans)', 'N,M=map(int,input().split())\nkeep=[]\nlis=[]\nac=0\nwa=0\nfor i in range(M):\n ps=input().split()\n keep.append(ps)\nfor j in range(M):\n if not keep[j][0] in lis:\n if keep[j][1]=="AC":\n ac+=1\n lis.append(keep[j][0])\n else:\n wa+=1\nprint(ans,wa)', 'N,M=map(int,input().split())\nkeep=[]\nlis=[]\nac=[0]*N\nwa=[0]*N\nWA=0\nfor i in range(M):\n ps=input().split()\n keep.append(ps)\n \nfor j in range(M):\n if keep[j][1]=="AC":\n ac[int(keep[j][0])-1]=1\n elif ac[int(keep[j][0])-1]==0:\n wa[int(keep[j][0])-1]+=1\nAC=sum(ac)\nfor j in range(M):\n WA+=ac[j]*wa[j]\n \nprint(AC,WA)\n', 'N,M=map(int,input().split())\nkeep=[]\nlis=[]\nac=[0]*N\nwa=[0]*N\nWA=0\nfor i in range(M):\n ps=input().split()\n keep.append(ps)\n \nfor j in range(M):\n if keep[j][1]=="AC":\n print(int(keep[j][0]))\n ac[int(keep[j][0])]=1\n elif ac[int(keep[j][0])]==0:\n wa[int(keep[j][0])]+=1\nAC=sum(ac)\nfor j in range(M):\n WA+=ac[j]*wa[j]\n \nprint(AC,WA)', 'N,M=map(int,input().split())\nkeep=[]\nlis=[]\nac=[0]*N\nwa=[0]*N\nWA=0\nfor i in range(M):\n ps=input().split()\n keep.append(ps)\n \nfor j in range(M):\n if keep[j][1]=="AC":\n print(int(keep[j][0]-1))\n ac[int(keep[j][0]-1)]=1\n elif ac[int(keep[j][0]-1)]==0:\n wa[int(keep[j][0]-1)]+=1\nAC=sum(ac)\nfor j in range(M):\n WA+=ac[j]*wa[j]\n \nprint(AC,WA)', 'N,M=map(int,input().split())\nkeep=[]\nlis=[]\nac=0\nwa=0\nfor i in range(M):\n ps=input().split()\n keep.append(ps)\nfor j in range(M):\n if not keep[j][0] in lis and keep[j][1]=="AC":\n ac+=1\n lis.append(keep[j][0])\nfor j in range(M):\n if keep[j][0] in lis and keep[j][1]=="WA":\n wa+=1\n \nprint(ac,wa)', 'N,M=map(int,input().split())\nkeep=[]\nlis=[]\nac=[0]*N\nwa=[0]*N\nWA=0\nfor i in range(M):\n ps=input().split()\n keep.append(ps)\n \nfor j in range(M):\n if keep[j][1]=="AC":\n ac[int(keep[j][0])-1]=1\n elif ac[int(keep[j][0])-1]==0:\n wa[int(keep[j][0])-1]+=1\nAC=sum(ac)\nfor k in range(N):\n WA+=ac[k]*wa[k]\n \nprint(AC,WA)\n']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s053755027', 's194760642', 's482130873', 's694498832', 's880092667', 's960225209', 's967749011', 's410341629']
[33680.0, 32152.0, 32276.0, 33900.0, 34608.0, 33696.0, 32276.0, 33684.0]
[315.0, 230.0, 2107.0, 330.0, 350.0, 222.0, 2105.0, 326.0]
[339, 268, 292, 346, 370, 378, 328, 346]
p02802
u425834921
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N,M = map(int,input().split())\na = 0\nw = 0\nlis = [[] for i in range(N)]\nfor i in range(M):\n p,s = map(int,input().split())\n p = int(p)\n lis[p - 1].append(s)\nfor j in range(N):\n if lis[j].count("AC") > 0:\n a += 1\n w += lis[j].index("AC")\n\n \nprint(a,w)\n\n', 'import numpy as np\nN,M = map(int,input().split())\na = 0\nw = 0\nlis = np.zeros(N + 1)\nfor i in range(M):\n p,s = map(str,input().split())\n if lis[p] == 0 and s == "AC":\n a += 1\n lis[p] = 1\n elif lis[p] != 0 and s == "AC":\n continue\n elif lis[p] == 0 and s == "WA":\n w += 1\n elif lis[p] != 0 and s == "WA":\n continue\n \nprint(a,w)\n\n', 'import numpy as np\nN,M = map(int,input().split())\na = 0\nw = 0\nlis = np.zeros(N + 1)\nfor i in range(M):\n p,s = map(str,input().split())\n p = int(p)\n if lis[p + 1] == 0 and s == "AC":\n a += 1\n lis[p] = 1\n elif lis[p + 1] > 0 and s == "AC":\n continue\n elif lis[p + 1] == 0 and s == "WA":\n w += 1\n elif lis[p + 1] > 0 and s == "WA":\n continue\n \nprint(a,w)\n\n', 'N,M = map(int,input().split())\na = 0\nw = 0\nlis = [[] for _ in range(N)]\nfor i in range(M):\n p,s = map(int,input().split())\n p = int(p)\n lis[p - 1].append(s)\nfor j in range(N):\n if lis[j].count("AC") > 0:\n a += 1\n w += lis[j].index("AC")\n\n \nprint(a,w)\n\n', 'N,M = map(int,input().split())\na = 0\nw = 0\nlis = [[] for _ in range(N)]\nfor i in range(M):\n p,s = map(str,input().split())\n p = int(p)\n lis[p - 1].append(s)\nfor j in range(N):\n if lis[j].count("AC") > 0:\n a += 1\n w += lis[j].index("AC")\n\n \nprint(a,w)\n\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s561261403', 's640629893', 's725650185', 's759089655', 's610209996']
[10264.0, 12508.0, 14408.0, 10264.0, 20352.0]
[37.0, 152.0, 926.0, 36.0, 401.0]
[265, 350, 377, 265, 265]
p02802
u426572476
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['import math\nimport fractions\n\nn, m = map(int, input().split())\nac_list = [0 for _ in range(n)]\nwa_list = [0 for _ in range(n)]\nwa_cnt = 0\ncnt = 1\nwhile cnt <= m:\n p, s = input().split()\n p = int(p)\n if s == "AC":\n ac_list[p - 1] = 1\n else:\n wa_list[p - 1] += 1\n cnt += 1\nfor i in range(n):\n if wa_list[i] == 1 and ac_list[i] == 1:\n wa_cnt += wa_list[i]\nprint(sum(ac_list), wa_cnt)\n\n', 'import math\nimport fractions\n\nn, m = map(int, input().split())\nac_list = [0 for _ in range(n)]\nwa_list = [0 for _ in range(n)]\nwa_cnt = 0\ncnt = 1\nwhile cnt <= m:\n p, s = input().split()\n p = int(p)\n if s == "AC":\n ac_list[p - 1] = 1\n else:\n if ac_list[p - 1] == 0:\n wa_list[p - 1] += 1\n cnt += 1\nfor i in range(n):\n if wa_list[i] >= 1 and ac_list[i] == 1:\n wa_cnt += wa_list[i]\nprint(sum(ac_list), wa_cnt)\n\n']
['Wrong Answer', 'Accepted']
['s147595061', 's171133819']
[6904.0, 6904.0]
[310.0, 331.0]
[421, 457]
p02802
u426649993
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\n\n\ndef main():\n N, M = map(int, input().split())\n pS = defaultdict(list)\n for i in range(M):\n p, S = input().split()\n pS[p].append(S)\n\n ac = 0\n wa = 0\n for pp in pS:\n tmp = pS[pp]\n for t in tmp:\n wa_tmp = 0\n if t == \'WA\':\n wa_tmp += 1\n else:\n ac += 1\n wa += wa_tmp\n break\n print(ac, wa)\n\n\nif __name__ == "__main__":\n main()\n', 'from collections import defaultdict\n\n\ndef main():\n N, M = map(int, input().split())\n pS = defaultdict(list)\n for i in range(M):\n p, S = input().split()\n pS[p].append(S)\n\n ac = 0\n wa = 0\n for pp in pS:\n tmp = pS[pp]\n wa_tmp = 0\n for t in tmp:\n if t == \'WA\':\n wa_tmp += 1\n else:\n ac += 1\n wa += wa_tmp\n break\n print(ac, wa)\n\n\nif __name__ == "__main__":\n main()\n']
['Wrong Answer', 'Accepted']
['s842043469', 's331292267']
[31892.0, 31892.0]
[324.0, 325.0]
[504, 500]
p02802
u427984570
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['a,b = map(int, input().split())\nList = [input().split() for i in range(b)]\nWnum = 0\nCnum = 0\naclist = []\nfor i in range(len(List)):\n print(i)\n if List[i][1] == \'WA\':\n if [List[i][0], \'AC\'] in aclist:\n break\n else:\n Wnum += 1\n# print("WA", Wnum)\n else:\n if List[i] in aclist:\n break\n else:\n aclist.append(List[i])\n Cnum += 1\n# print(aclist)\n\nprint(Cnum, Wnum)\n\n', 'a,b = map(int,input().split())\nAC = [0]*(a+1)\nWA = [0]*(a+1)\nac = 0\nwa = 0\nwat = 0\n\nfor i in range(b):\n x,y = map(str,input().split())\n if y == "WA":\n WA[int(x)] += 1\n elif AC[int(x)] == 0 and y == "AC":\n wa += WA[int(x)]\n ac += 1\n AC[int(x)] = 1\n\nprint(ac,wa)']
['Wrong Answer', 'Accepted']
['s826686031', 's214208976']
[32636.0, 4724.0]
[2105.0, 371.0]
[411, 275]
p02802
u429516810
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())\nd=dict()\nc=0\np=0\nfor _ in range(m):\n a,b=map(str,input().split())\n if a not in d:\n if b=="WA":\n d[a]=["WA",1]\n else:\n c+=1\n d[a]=["AC",1]\n else:\n if b=="WA":\n if d[a][0]=="AC":\n continue\n else:\n d[a][1]+=1\n else:\n print(d[a][0])\n if d[a][0]=="AC":\n continue\n c+=1\n #print(d[a][1])\n d[a][0]="AC"\n p+=d[a][1]\n#print(d)\nprint(c,p)\n', 'n,m=map(int,input().split())\nd=dict()\nc=0\np=0\nfor _ in range(m):\n a,b=map(str,input().split())\n if a not in d:\n if b=="WA":\n d[a]=["WA",1]\n else:\n c+=1\n d[a]=["AC",1]\n else:\n if b=="WA":\n if d[a][0]=="AC":\n continue\n else:\n d[a][1]+=1\n else:\n #print(d[a][0])\n if d[a][0]=="AC":\n continue\n c+=1\n #print(d[a][1])\n d[a][0]="AC"\n p+=d[a][1]\n#print(d)\nprint(c,p)\n']
['Wrong Answer', 'Accepted']
['s937222195', 's841651750']
[25300.0, 25288.0]
[362.0, 351.0]
[560, 561]
p02802
u430336181
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\nsP = {}\nWA =0\nAC =0\nfor _ in range(M):\n data = input()\n number, result = data.split()\n if data not in sP:\n sP[data] =1\n if number + " AC" not in sP:\n if result == "WA":\n WA += 1\n elif result == "AC":\n AC +=1\n else:\n sP[data] += 1\n if number + " AC" not in sP:\n if result == "WA":\n WA += 1\n\n elif result == "AC":\n AC += 1\n else:\n pass\n\n\nprint(AC, WA)', 'N, M = map(int,input().split())\n\nsP = {}\nWA =0\nAC =0\nfor _ in range(M):\n data = input()\n number, result = data.split()\n if data not in sP:\n sP[data] =1\n if number + " AC" not in sP:\n if result == "WA":\n WA += 1\n\n elif result == "AC":\n AC += 1\n else:\n pass\n else:\n sP[data] += 1\n if number + " AC" not in sP:\n if result == "WA":\n WA += 1\n\n elif result == "AC":\n AC += 1\n else:\n pass\n\n\nprint(AC, WA)', 'n, m = map(int, input().split())\nACc = [0 for i in range(n)]\nWAc = [0 for i in range(n)]\n\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n if s == "AC":\n if ACc[p - 1] == 0:\n ACc[p - 1] += 1\n else:\n if ACc[p - 1] != 1:\n WAc[p - 1] += 1\nfor j in range(n):\n if ACc[j] == 0:\n WAc[j] = 0\n\nprint(sum(ACc), sum(WAc))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s693205179', 's912035700', 's966555103']
[17760.0, 17764.0, 4784.0]
[276.0, 259.0, 296.0]
[544, 577, 375]
p02802
u432098488
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 = [True] * N\n\nwa = 0\nfor _ in range(M):\n p, s = input().split()\n p = int(p)\n if s == 'AC':\n P[p-1] = False\n else:\n if P[p-1]:\n wa += 1\n \nprint(P.count(1), wa)", "N, M = map(int, input().split())\nP = [0] * N\n\nwa = 0\nfor _ in range(M):\n p, s = input().split()\n index = int(p)-1\n if s == 'AC':\n wa += P[index]\n P[index] = -1\n elif :\n if P[index] != -1\n P[index] += 1\n \nprint(P.count(-1), wa)", "N, M = map(int, input().split())\nP = [0] * N\n\nwa = 0\nfor _ in range(M):\n p, s = input().split()\n index = int(p)-1\n if s == 'WA' and P[index] != -1:\n P[index] += 1\n elif P[index] > -1:\n wa += P[index]\n P[index] = -1\n \nprint(P.count(-1), wa)"]
['Wrong Answer', 'Runtime Error', 'Accepted']
['s265679303', 's433801847', 's654771655']
[3828.0, 2940.0, 3828.0]
[261.0, 17.0, 276.0]
[209, 245, 255]
p02802
u432453907
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\nfor i in range(M):\n P, S = map(str, input().split())\n P = int(P)-1\n if ac[P] != 1 and S == "AC":\n wa += abs(ac[P])\n ac[P] = 1\n elif ac[P] != 1 and S == "WA":\n ac[P] -= 1\n print(ac.count(1), wa)\n print(ac)\n print(wa)\n', 'N, M = map(int, input().split())\nac = [0]*N\nwa = 0\n\nfor i in range(M):\n P, S = map(str, input().split())\n P = int(P)-1\n if ac[P] != 1 and S == "AC":\n wa += abs(ac[P])\n ac[P] = 1\n elif ac[P] != 1 and S == "WA":\n ac[P] -= 1\n\nprint(ac.count(1), wa)\n']
['Wrong Answer', 'Accepted']
['s839169077', 's716891603']
[117392.0, 9376.0]
[2356.0, 222.0]
[310, 279]
p02802
u434296044
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]*N)\nwa=np.array([0]*N)\n\nfor i in range(M):\n a,b=input().split()\n A=int(a)\n if ac[A-1]==0 and b=="WA":\n wa[A-1]+=1\n else :\n ac[A-1]=1\n\ncal=sum(ac)\nans=sum(ac*wa)', 'import numpy as np\n\nN,M=map(int,input().split())\nac=np.array([0]*N)\nwa=np.array([0]*N)\n\nfor i in range(M):\n a,b=input().split()\n A=int(a)\n if ac[A-1]==0 and b=="WA":\n wa[A-1]+=1\n else :\n ac[A-1]=1\n\ncal=sum(ac)\nans=sum(ac*wa)\nprint(cal, ans)\n']
['Wrong Answer', 'Accepted']
['s867685112', 's466297153']
[14784.0, 16584.0]
[807.0, 821.0]
[250, 267]
p02802
u437727817
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\tprint('0 0')\n\tsys.exit()\n\n\np = [0]*M\ns = [0]*M\n\nfor i in range(M):\n\tp[i],s[i] = input().split()\n\ncor_count = 0\npen_count = 0\nAC_list = []\n\nfor i in range(M):\n\tif not p[i+1] in AC_list:\n\t\tif s[i+1] == 'AC':\n\t\t\tAC_list.append(p[i+1])\n\t\telse:\n\t\t\tpen_count += 1\n\n#print(AC_list)\ncor_count = len(set(AC_list))\nif M != 0:\n\tprint(cor_count,pen_count)\n\n\n\n", "import sys\nN,M = map(int,input().split())\n\ncor_count = 0\npen_count = 0\nAC_list = []\n\np = [0]*M\ns = [0]*M\n\nif M == 0 or N==0:\n\tprint('0 0')\n\tsys.exit()\n\n\nl = []\nfor i in range(M):\n\tp[i],s[i] = input().split()\n\nfor i in range(M-1):\n\tif p[i] != p[i+1]:\n\t\tl.append(i+1)\nprint(l)\nx = 0\nfor i in range(M):\n\tif not p[i] in AC_list:\n\t\tif s[i] == 'AC':\n\t\t\tAC_list.append(p[i])\n\t\telse:\n\t\t\tpen_count += 1\n\telse:\n\t\ti = l[x]\n\t\tx += 1\n\n#print(AC_list)\ncor_count = len(set(AC_list))\n\nprint(cor_count,pen_count)\n\n", "import sys\nN,M = map(int,input().split())\n\ncor_count = 0\npen_count = 0\nAC_list = []\n\np = [0]*M\ns = [0]*M\n\nif M == 0 or N==0:\n\tprint('0 0')\n\tsys.exit()\n\n\nl = []\nfor i in range(M):\n\tp[i],s[i] = input().split()\n\nfor i in range(M-1):\n\tif p[i] != p[i+1]:\n\t\tl.append(i+1)\nprint(l)\nx = 0\nfor i in range(M):\n\tif not p[i] in AC_list:\n\t\tif s[i] == 'AC':\n\t\t\tAC_list.append(p[i])\n\t\telse:\n\t\t\tpen_count += 1\n\telse:\n\t\tif len(l)!= 0:\n\t\t\ti = l[x]\n\t\t\tx += 1\n\n#print(AC_list)\ncor_count = len(set(AC_list))\n\nprint(cor_count,pen_count)\n", '\nN,M = map(int,input().split())\n\nAC = 0\nWA = 0\n\n\nwas = [0]*(N+1)\nacs = [0]*(N+1)\n\nfor i in range(M):\n\tp,s = input().split()\n\tp = int(p)\n\n\tif s = "AC":\n\t\tif acs[p] == 0:\n\t\t\tAC += 1\n\t\t\tWA += was[p]\n\t\t\tacs[p] = 1\n\telse:\n\t\twas[p] += 1\n\nprint(AC,WA)', "import sys\nN,M = map(int,input().split())\nif M == 0:\n\tprint('0 0')\n\tsys.exit()\n\n\np = [0]*M\ns = [0]*M\n\nfor i in range(M):\n\tp[i],s[i] = input().split()\n\ncor_count = 0\npen_count = 0\nAC_list = []\n\n\nif s[0] == 'AC':\n\tAC_list.append(p[0])\n\tcor_count += 1\nelse:\n\tpen_count += 1\n\nfor i in range(M-1):\n\tif not p[i+1] in AC_list:\n\t\tif s[i+1] =='AC':\n\t\t\tAC_list.append(p[i+1])\n\t\telse:\n\t\t\tpen_count += 1\n\tif s[i+1] =='AC':\n\t\tAC_list.append(p[i+1])\n\telse:\n\t\tpen_count += 1\n#print(AC_list)\ncor_count = len(set(AC_list))\nif M != 0:\n\tprint(cor_count,pen_count)\n", '\nN,M = map(int,input().split())\n\nAC = 0\nWA = 0\n\n\nwas = [0]*(N+1)\nacs = [0]*(N+1)\n\nfor i in range(M):\n\tp,s = input().split()\n\tp = int(p)\n\n\tif s == "AC":\n\n\t\tif acs[p] == 0:\n\n\t\t\tAC += 1\n\t\t\tWA += was[p]\n\t\t\tacs[p] = 1\n\t\t\t\n\telse:\n\t\twas[p] += 1\n\nprint(AC,WA)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s056615229', 's130988682', 's255349653', 's406562789', 's416461336', 's561521309']
[16884.0, 22388.0, 21780.0, 2940.0, 17780.0, 4596.0]
[2104.0, 2104.0, 2104.0, 17.0, 2104.0, 279.0]
[430, 526, 544, 244, 574, 251]
p02802
u438189153
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N,M=map(int,input().split())\n\nac=[False]*N\nwa=[0]*N\n\nfor _ in range(N):\n p,s=input().split()\n p=int(p)-1\n\n if s=="AC":\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,sep=" ")\n', 'N,M=map(int,input().split())\n\nac=[False]*N\nwa=[0]*N\n\nfor _ in range(N):\n p,s=input().split()\n p=int(p)-1\n\n if s=="AC":\n ac[p]=True\n else:\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,sep=" ")\n', 'N,M=map(int,input().split())\n\nac=[False]*N\nwa=[0]*N\n\nfor i in range(N):\n p,s=input().split()\n p=int(p)-1\n\n if s=="AC":\n ac[p]=True\n else:\n wa[p]+=1\n\na=0\nb=0\n\nfor i in range(N):\n if ac[p]==True:\n a+=1\n b+=wa[i]\n\nprint(a,b,sep=" ")\n', 'N,M=map(int,input().split())\n\nac=[False]*N\nwa=[0]*N\n\nfor i in range(N):\n p,s=input().split()\n p=int(p)-1\n\n if s=="AC":\n ac[p]=True\n else:\n wa[p]+=1\n\na=0\nb=0\n\nfor i in range(N):\n if ac[i]==True:\n a+=1\n b+=wa[i]\n\nprint(a,b,sep=" ")\n', 'n,m=map(int,input().split())\n\nac=[False]*n\nwa=[0]*n\n\nfor i in range(m):\n p,s=input().split()\n p=int(p)-1\n\n if s=="AC":\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,sep=" ")\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s232004990', 's268464004', 's304504211', 's814884741', 's107043249']
[10456.0, 10380.0, 10372.0, 10292.0, 10452.0]
[187.0, 187.0, 195.0, 191.0, 198.0]
[293, 267, 273, 273, 293]
p02802
u439063038
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["N, M = map(int, input().split())\nps = [input().split() for _ in range(M)]\n\ncorrect = [0] * N\npenalty = [0] * N\nfor p, s in ps:\n p = int(p)\n if correct[p-1] == 1:\n continue\n if s == 'AC':\n correct[p-1] = 1\n else:\n penalty[p-1] += 1\nprint(sum(correct), sum([p*c for p, c in zip(penalty, correct)]))))\n\n", "N, M = map(int, input().split())\nps = [input().split() for _ in range(M)]\n\ncorrect = [0] * N\npenalty = [0] * N\nfor p, s in ps:\n p = int(p)\n if correct[p-1] == 1:\n continue\n if s == 'AC':\n correct[p-1] = 1\n else:\n penalty[p-1] += 1\nprint(0, 0)", "N, M = map(int, input().split())\nps = [input().split() for _ in range(M)]\n\ncorrect = [0] * N\npenalty = [0] * N\nfor p, s in ps:\n p = int(p)\n if correct[p-1] != 1:\n continue\n if s == 'AC':\n correct[p-1] = 1\n else:\n penalty[p-1] += 1\nprint(sum(correct), sum(penalty))", "N, M = map(int, input().split())\nps = [input().split() for _ in range(M)]\n\ncorrect = [0] * N\npenalty = [0] * N\nfor p, s in ps:\n p = int(p)\n if correct[p-1] == 1:\n continue\n if s == 'AC':\n correct[p-1] = 1\n else:\n penalty[p-1] += 1\nprint(sum(correct), sum([p*c for p, c in zip(penalty, correct)]))"]
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s514009277', 's601996550', 's982491756', 's963643872']
[8996.0, 39792.0, 39712.0, 40264.0]
[24.0, 229.0, 223.0, 237.0]
[333, 275, 297, 329]
p02802
u440129511
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(input().split()) for _ in range(m)]\na=[0]*(n+1)\nw=[0]*(n+1)\nfor i in range(m):\n if a[int(p[i][0])]==0 and p[i][1]=='AC':\n a[int(p[i][0])]+=1\n if a[int(p[i][0])]==0 and p[i][1]=='WA':\n w[int(p[i][0])]+=1\na=np.array(a)\nw=np.array(w)\naw=a*w\nprint(sum(a),sum(aw))", "import numpy as np\nn,m=map(int,input().split())\np=[list(input().split()) for _ in range(m)]\na=[0]*(n+1)\nw=[0]*(n+1)\nfor i in range(m):\n if a[int(p[i][0])]==0 and p[i][1]=='AC':\n a[int(p[i][0])]+=1\n if a[int(p[i][0])]==0 and p[i][1]=='WA':\n w[int(p[i][0])]+=1\na=np.array(a)\nw=np.array(w)\naw=a*w\nprint(sum(a),sum(aw))"]
['Runtime Error', 'Accepted']
['s244340312', 's609711225']
[27456.0, 37240.0]
[350.0, 549.0]
[316, 335]
p02802
u442877951
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 = list(map(int,input().split()))\nac = 0\nwa = 0\nfor j in range(n):\n for i in range(m):\n if S[i] == "AC":\n ac += 1\n i += 1\n j += 1\n else:\n wa = 0\n i += 1', 'n,m = map(int,input().split())\nS = list(map(str,input().split()))\nac = 0\nwa = 0\ni = 0\nj = 0\nwhile j < n:\n while i < m:\n if S[i] == "AC":\n ac += 1\n i += 1\n j += 1\n else:\n wa += 1\n i += 1\nprint(ac)\nprint(wa)', 'n,m = map(int,input().split())\nS = list(map(str,input().split()))\nac = 0\nwa = 0\ni = 0\nj = 0\nfor j in range(n):\n for i in range(m):\n if S[i] == "AC":\n ac += 1\n i += 1\n j += 1\n else:\n wa += 1\n i += 1\nprint(ac)\nprint(wa)\n', 'n,m = map(int,input().split())\nS = list(map(int,input().split()))\nac = 0\nwa = 0\ni = 0\nj = 0\nfor j in range(n):\n for i in range(m):\n if S[i] == "AC":\n ac += 1\n i += 1\n j += 1\n else:\n wa += 1\n i += 1\nprint(ac)\nprint(wa)', 'N,M = map(int,input().split())\nAC = 0\npenalty = 0\nAC_list = [0]*N\nWA_list = [0]*N\n\nfor i in range(M):\n p,s = map(str,input().split())\n p = int(p-1)\n if s == "AC" and AC_list[p] == 0:\n AC += 1\n AC_list[p] = 1\n penalty += WA_list[p]\n elif s == "WA":\n WA_list[p] += 1\n if AC == N:\n break\nprint(AC,penalty)', 'n,m = map(int,input().split())\nS = list(map(int,input().split()))\nac = 0\nwa = 0\nfor j in range(n):\n for i in range(m):\n if S[i] == "AC":\n ac += 1\n i += 1\n j += 1\n else:\n wa += 1\n i += 1\nprint(ac)\nprint(wa)', 'N,M = map(int,input().split())\nAC = 0\npenalty = 0\nAC_list = [0]*N\nWA_list = [0]*N\n\nfor i in range(M):\n p,s = map(str,input().split())\n p = int(p)-1\n if s == "AC" and AC_list[p] == 0:\n AC += 1\n AC_list[p] = 1\n penalty += WA_list[p]\n elif s == "WA":\n WA_list[p] += 1\n if AC == N:\n break\nprint(AC,penalty)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s235999999', 's434603685', 's468395573', 's670176121', 's680013458', 's818746747', 's373222621']
[3064.0, 3064.0, 3064.0, 3064.0, 4596.0, 3064.0, 4596.0]
[17.0, 18.0, 17.0, 17.0, 20.0, 17.0, 369.0]
[218, 237, 250, 249, 322, 237, 322]
p02802
u443996531
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n,m = map(int,input().split())\ncor = set()\npens = {}\nfor i in range(m):\n p,s = input().split()\n if s=="AC":\n cor.add(p)\n else:\n if not p in cor:\n if p in pens:\n pens[p] += 1\n else:\n pens[p] = 1\npen = 0\nfor x in cor:\n if x in pens: \n pen += pens(x)\nprint(str(len(cor))+" "+str(pen))', 'n,m = map(int,input().split())\ncor = set()\npens = {}\nfor i in range(m):\n p,s = input().split()\n if s=="AC":\n cor.add(p)\n else:\n if not p in cor:\n if p in pens:\n pens[p] += 1\n else:\n pens[p] = 1\npen = 0\nfor x in cor:\n if x in pens: \n pen += pens[x]\nprint(str(len(cor))+" "+str(pen))']
['Runtime Error', 'Accepted']
['s465408786', 's416134863']
[14052.0, 14052.0]
[241.0, 235.0]
[319, 319]
p02802
u445624660
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())\ntable = {}\nac = 0\npena_arr = [0 for _ in range(m + 1)]\nfor _ in range(n):\n a, b = input().split()\n a = int(a)\n if a not in table and b == "AC":\n ac += 1\n table[a] = True\n elif a not in table and b == "WA":\n pena_arr[a] += 1\npena = 0\nfor i in range(1, m + 1):\n if pena_arr[i] > 0 and i in table:\n pena += pena_arr[i]\nprint(ac, pena)\n', 'n, m = map(int, input().split())\naccount, wacount = 0, 0\nacdic = [0] * (n + 10)\nfor _ in range(m):\n p, s = input().split()\n p = int(p)\n if s == "AC" and acdic[p] <= 0:\n account += 1\n wacount += abs(acdic[p])\n acdic[p] = 1\n elif s == "WA" and acdic[p] <= 0:\n acdic[p] -= 1\nprint(account, wacount)']
['Runtime Error', 'Accepted']
['s762492451', 's020815402']
[15880.0, 9608.0]
[298.0, 190.0]
[408, 335]
p02802
u449473917
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\nl=list(input().split() for _ in range(m))\n\nw=[0]*n\na=[0]*n\nseitou=0\npena=0\n\nfor i in l:\n k=int(i[0])-1\n if a[k]==0:\n if i[1]=="AC":\n a[k]+=1\n else:\n w[k]+=1\n\nseitou=sum(a)\nfor j in range(n):\n if a[i]==1:\n pena+=w[i]\n \nprint(seitou,pena)', 'n,m = map(int,input().split())\n\nl=list(input().split() for _ in range(m))\n\nw=[0]*n\na=[0]*n\nseitou=0\npena=0\n\nfor i in l:\n k=int(i[0])-1\n if a[k]==0:\n if i[1]=="AC":\n a[k]+=1\n else:\n w[k]+=1\n\nseitou=sum(a)\nfor j in range(n):\n if int(a[j])==1:\n pena+=w[j]\n \nprint(seitou,pena)']
['Runtime Error', 'Accepted']
['s418127321', 's776961908']
[33684.0, 33684.0]
[270.0, 297.0]
[327, 332]
p02802
u452269253
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n, m = [int(i) for i in input().split()]\nwa = [0]*n\nac = [0]*n\n\nfor _ in range(m):\n p, s = input().split()\n if s == "WA":\n wa[int(p)-1] += 1\n else:\n ac[int(p)-1] += 1\n\nprint(n-ac.count(0), sum([wa[i] for i in range(n) if ac[i] >= 1]))', 'def main():\n n, m = [int(i) for i in input().split()]\n wa = [0]*n\n ac = [0]*n\n \n for _ in range(m):\n p, s = input().split()\n if s == "WA":\n if ac[int(p)-1] == 0:\n wa[int(p)-1] += 1\n else:\n ac[int(p)-1] += 1\n \n print(n-ac.count(0), sum([wa[i] for i in range(n) if ac[i] >= 1]))\n\n\nif __name__ == "__main__":\n main()']
['Wrong Answer', 'Accepted']
['s945658901', 's729644548']
[5528.0, 5528.0]
[287.0, 281.0]
[257, 395]
p02802
u453623947
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n,m = map(int,input().split())\npS = [list(input().split()) for i in range(m)]\n\nfor _ in range(m) :\n pS[_][0] = int(pS[_][0])\n\nac = [0]*n\nwa = [0]*n\n\nfor i in range(m) :\n if pS[i][1] == "AC" :\n if ac[pS[i][0]-1] == 0 :\n ac[pS[i][0]-1] += 1\n elif pS[i][1] == "WA" :\n wa[pS[i][0] - 1] += 1\n\nprint(sum(ac),sum(wa))\n', 'n,m = map(int,input().split())\npS = [list(input().split()) for i in range(m)]\n\nfor _ in range(m) :\n pS[_][0] = int(pS[_][0])\n\nac = [0]*n\nwa = [0]*n\n\nfor i in range(m) :\n if pS[i][1] == "AC" :\n if ac[pS[i][0]-1] == 0 :\n ac[pS[i][0]-1] += 1\n elif pS[i][1] == "WA" :\n if ac[pS[i][0]-1] == 0 :\n wa[pS[i][0] - 1] += 1\n\nawa=0\nfor i in range(n) :\n if ac[i] == 1 :\n awa += wa[i]\n\nprint(sum(ac),awa)\n']
['Wrong Answer', 'Accepted']
['s851843365', 's820470468']
[34824.0, 34980.0]
[254.0, 272.0]
[345, 446]
p02802
u453642820
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())\nnumber=[0]*N\nac,wa=0,0\nfor m in range(M):\n p,s=input().split()\n if number!=-1:\n if s == "AC":\n ac+=1\n number[int(p)-1]=-1\n else:\n wa+=1\nprint(ac,wa)', 'N,M=map(int,input().split())\nnumber=[0]*N\nac,wa,=0,0\nfor m in range(M):\n p,s=input().split()\n p=int(p)-1\n if number[p]!=-1:\n if s == "WA":\n number[p]+=1\n elif s == "AC":\n ac+=1\n wa+=number[p]\n number[p] = -1\nprint(ac,wa)']
['Wrong Answer', 'Accepted']
['s267275942', 's161625893']
[3828.0, 3828.0]
[267.0, 283.0]
[232, 287]
p02802
u453815934
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\na,b=map(int,input().split())\naccount=0\nwacount=0\nacbox=[0]*(a+1)\nwabox=[0]*(a+1)\nfor i in range(b):\n p,q=input().split()\n p=int(p)\n if q=="WA":\n if acbox[p]==0:\n wabox[p]+=1\n else:\n if acbox[p]!=0:\n account+=1\n wacount+=wabox[p]\n acbox[p]=+1\nprint(account,wacount)', 'a,b=map(int,input().split())\naccount=0\nwacount=0\nacbox=[0]*(a+1)\nwabox=[0]*(a+1)\nfor i in range(b):\n p,q=input().split()\n p=int(p)\n if q=="WA":\n if acbox[p]==0:\n wabox[p]+=1\n else:\n if acbox[p]==0:\n account+=1\n wacount+=wabox[p]\n acbox[p]=+1\nprint(account,wacount)']
['Wrong Answer', 'Accepted']
['s748076896', 's487908831']
[4596.0, 4724.0]
[271.0, 278.0]
[305, 294]
p02802
u454557108
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 deque\n\ndef bfs(maze, visited, sy, sx, gy, gx):\n queue = deque([[sy, sx]])\n visited[sy][sx] = 0\n while queue:\n y,x = queue.popleft()\n if [y, x] == [gy, gx]:\n return visited[y][x]\n for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):\n new_y, new_x = y+j, x+k\n if maze[new_y][new_x] == "." and visited[new_y][new_x] == -1:\n visited[new_y][new_x] = visited[y][x] + 1\n queue.append([new_y, new_x])\n\nh,w = map(int,input().split())\nwall = \'\'\nfor i in range(w+2):\n wall += \'#\'\nmaze = [wall]\nfor i in range(h) :\n m1 = input()\n maze.append(\'#\'+m1+\'#\')\nmaze .append(wall)\n\ns = [[1,1],[1,h],[w,1],[w,h]]\ng = [[w,h],[w,1],[1,h],[1,1]]\n\nans = []\nfor i in range(4) :\n sy = s[i][1] ; sx = s[i][0]\n for j in range(1,h+1) :\n for k in range(1,w+1) :\n gy = j ; gx = k\n if maze[gy][gx] == \'#\' :\n break\n visited = [[-1]*(w+2) for _ in range(h+2)]\n ans.append(bfs(maze, visited, sy, sx, gy, gx))\n\nprint(max(ans))', "n,m = map(int,input().split())\np = []\ns = []\n\nfor i in range(m):\n p1,s1 = map(str,input().split())\n p.append(int(p1))\n s.append(s1)\n\n\nans = [[0,0] for i in range(n)]\n\nfor i in range(m) :\n if s[i] == 'AC' :\n ans[p[i]-1][0] = 1\n if s[i] == 'WA' and ans[p[i]-1][0] == 0 :\n ans[p[i]-1][1] += 1\n\nac = 0\npe = 0\nfor i in range(n) :\n ac += ans[i][0]\n if ans[i][0] == 1 :\n pe += ans[i][1]\n\nprint(ac,pe)"]
['Runtime Error', 'Accepted']
['s074111115', 's800752142']
[2073700.0, 23548.0]
[2248.0, 414.0]
[984, 482]
p02802
u459150945
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\nac = 0\nwa = []\nansed = []\nfor psn in ps:\n if psn[1] == 'AC':\n if psn[0] not in ansed:\n ac += 1\n ansed.append(psn[0])\n else:\n if psn[0] not in ansed:\n wa[int(psn[0])-1] += 1\nfor i in range(N):\n if str(i+1) not in ansed:\n wa[i] = 0\n\nprint(ac, sum(wa))", "N, M = map(int, input().split())\nps = [input().split() for i in range(M)]\n\nac = 0\nwa = [0 for i in range(N)]\nansed = set()\nfor psn in ps:\n if psn[1] == 'AC':\n if psn[0] not in ansed:\n ac += 1\n ansed.add(psn[0])\n else:\n if psn[0] not in ansed:\n wa[int(psn[0])-1] += 1\nfor i in range(N):\n if str(i+1) not in ansed:\n wa[i] = 0\n\nprint(ac, sum(wa))"]
['Runtime Error', 'Accepted']
['s492184119', 's690983295']
[32280.0, 39264.0]
[2106.0, 310.0]
[387, 406]
p02802
u461833298
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 = [[x for x in input().split()] for _ in range(M)]\ntmp = [0] * N\nac = wa = 0\n\nfor P, S in PS:\n if S=='WA':\n tmp[int(P)] += 1\n elif S=='AC' and tmp[int(P)]!=-1:\n ac+=1\n wa+=tmp[int(P)]\n tmp[int(P)] = -1\n \nprint(ac,wa)", "N, M = map(int, input().split())\nPS = [[x for x in input().split()] for _ in range(M)]\ntmp = [0] * (10**5+1)\nac = wa = 0\n\nfor P, S in PS:\n if tmp[int(P)]==-1:\n continue\n if S=='WA':\n tmp[int(P)] += 1\n elif S=='AC':\n ac+=1\n wa+=tmp[int(P)]\n tmp[int(P)] = -1\n \nprint(ac,wa)"]
['Runtime Error', 'Accepted']
['s250333348', 's550874414']
[26612.0, 26624.0]
[353.0, 332.0]
[293, 322]
p02802
u462976050
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=[[0, ""] for j in range(M)]\nACcheck=[False for j in range(N)]\nAC=0\nWA=[0 for j in range(N)]\nWA2 = 0\nfor i in range(M):\n ps = input().split()\n S[i][0]=int(ps[0])\n S[i][1]=ps[1]\nfor i in range(M):\n if S[i][1]=="AC":\n if ACcheck[S[i][0]-1]==False:\n AC+=1\n ACcheck[S[i][0]-1]=True\n WA2+=WA[S[i][0]]\n else:\n if ACcheck[S[i][0]-1]==False:\n WA[S[i][0]]+=1\n\nprint(AC, WA2)', 'N, M = map(int, input().split())\nS=[[0, ""] for j in range(M)]\nACcheck=[False for j in range(N)]\nAC=0\nWA=[0 for j in range(N)]\nWA2 = 0\nfor i in range(M):\n ps = input().split()\n S[i][0]=int(ps[0])\n S[i][1]=ps[1]\nfor i in range(M):\n if S[i][1]=="AC":\n if ACcheck[S[i][0]-1]==False:\n AC+=1\n ACcheck[S[i][0]-1]=True\n WA2+=WA[S[i][0]-1]\n else:\n if ACcheck[S[i][0]-1]==False:\n WA[S[i][0]-1]+=1\n\nprint(AC, WA2)\n']
['Runtime Error', 'Accepted']
['s115785699', 's228472637']
[23704.0, 23624.0]
[344.0, 335.0]
[430, 435]
p02802
u473023730
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=int(n)\nm=int(m)\nx=[false for i in range(n)]\ncount=[0 for i in range(n)]\nfor i in range(m):\n p,s=input().split()\n p=int(p)\n if(not x[p-1]):\n if(s=="AC"):\n x[p-1]=true\n else:\n count[p-1]=count[p-1]+1\nans=0\nans2=0\nfor i in range(ansn):\n if(x[i]):\n ans+=1\n ans2+=count[i]\nprint(ans,ans2)', 'a,b=map(int,input().split())\nx=[input().split() for i in range(b)]\n#print(x)\n\nimport numpy as np\n \ny = np.array(x)\nz=np.argwhere(y=="WA")\n \nprint(len(z)) ', 'n,m=input().split()\nn=int(n)\nm=int(m)\nx=[False for i in range(n)]\ncount=[0 for i in range(n)]\nfor i in range(m):\n p,s=input().split()\n p=int(p)\n if(not x[p-1]):\n if(s=="AC"):\n x[p-1]=True\n else:\n count[p-1]=count[p-1]+1\nans=0\nans2=0\nfor i in range(n):\n if(x[i]):\n ans+=1\n ans2+=count[i]\nprint(ans,ans2)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s718148213', 's887888351', 's038887960']
[3064.0, 52200.0, 4760.0]
[18.0, 383.0, 283.0]
[311, 154, 328]
p02802
u478132434
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["N, M = map(int, input().split())\nQ_n = [0] * N\nC = [0] * N\n\nAns = 0\nPen = 0\nfor i in range(M):\n p, S = input().split\n p = int(p)-1\n if (S == 'AC') and (Q_n[p] == 0):\n Q_n[p] = 1\n Ans += 1\n Pen += C[p]\n elif (S == 'WA'):\n C[p] += 1\n \nprint(Ans, Pen)\n \n", "N, M = map(int, input().split())\npS = [list(input().split()) for i in range(M)]\n\nfor x in range(M):\n pS[x][0] = int(pS[x][0])\n \nAns, Pen = 0, 0\nfor x in range(M):\n if (pS[x][0] != pS[x-1][0]):\n pS_temp = 0\n Ans_temp = 0\n if (pS[x][1] == 'AC') and (pS_temp == 0):\n Ans += 1\n Ans_temp += 1\n pS_temp += 1\n elif (pS[y][1] == 'WA') and (pS_temp == 0) and (Ans_temp == 0):\n Pen += 1\nprint(Ans, Pen)", "N, M = map(int, input().split())\nQ_n = [0] * N\nC = [0] * N\n\nAns = 0\nPen = 0\nfor i in range(M):\n p, S = input().split()\n p = int(p)-1\n if (S == 'AC') and (Q_n[p] == 0):\n Q_n[p] = 1\n Ans += 1\n Pen += C[p]\n elif (S == 'WA'):\n C[p] += 1\n \nprint(Ans, Pen)"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s470938361', 's836041979', 's267935033']
[4596.0, 29112.0, 4596.0]
[19.0, 309.0, 264.0]
[299, 449, 297]
p02802
u478719560
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 sys import stdin\nn,m = map(int, stdin.readline().rstrip().split())\n\ncount = 0\npenalty = 0\nqb = [0]*n\nwas = [0]*n\n\nfor i in range(m):\n p,s = map(str,stdin.readline().rstrip().split())\n p = int(p)\n if s == "AC" and qb[p-1] != "AC":\n qb[p-1] = "AC"\n pentalty += was[p-1]\n count += 1\n elif s == "WA":\n was[p-1] += 1\n else:\n pass\n\nprint(count, penalty)', 'from sys import stdin\nn,m = map(int, stdin.readline().rstrip().split())\n\ncount = 0\npenalty = 0\nqb = [0]*n\nwas = [0]*n\n\nfor i in range(m):\n p,s = map(str,stdin.readline().rstrip().split())\n p = int(p)\n if s == "AC" and qb[p-1] != "AC":\n qb[p-1] = "AC"\n penalty += was[p-1]\n count += 1\n elif s == "WA":\n was[p-1] += 1\n else:\n pass\n\nprint(count, penalty)\n']
['Runtime Error', 'Accepted']
['s753055491', 's797969990']
[4596.0, 4596.0]
[188.0, 228.0]
[402, 402]
p02802
u487594898
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=[] \nwhile True:\n try:\n A.append(list(map(int,input().split())))\n\n except:\n break;\ns1=list()\ns2=list()\np=0\nw=0\nfor i in range(M):\n if A[i][1]=="WA":\n s1.append(A[i][0])\n\n if A[i][0] not in s2 and A[i][1]=="AC":\n p+=1\n s2.append(A[i][0])\n w+=int(s1.count(A[i][0])\n\nprint(p,w)', 'N,M = map(int,input().split())\nA = [input().split() for i in range(M)]\ns1=list()\ns2=list()\np=0\nw=0\nfor i in range(M):\n if A[i][0] not in s2 and A[i][1]=="WA":\n s1 +=A[i][0]\n print(s1)\n if A[i][0] not in s2 and A[i][1]=="AC":\n p+=1 \n s2 +=A[i][0]\n w += int(s1.count(A[i][0]))\n print(s1,s2)\nprint(p,w)', 'N,M = map(int,input().split())\na = [0] * M\nb = [0] * M\nfor i in range(M):\n a[i],b[i]= map(str, input().split())\ns1=list()\ns2=list()\np=0\nw=0\nfor i in range(M) :\n if a[i] not in s2 and (b[i]=="WA"):\n s1 += a[i] \n if a[i] not in s2 and (b[i]=="AC"):\n print(s2)\n p += 1 \n s2.append(a[i])\n w += int(s1.count(a[i]))\nprint(min(N,p),w)', 'n,m= map(int,input().split())\n\nB = [0]*n\nC = [0]*n\nans = 0\npna = 0\nfor i in range(m):\n a,b= input().split()\n a = int(a)\n if b=="AC":\n if B[a-1]==0 :\n B[a-1] =1\n ans += 1\n pna += C[a-1]\n else:\n C[a-1] = C[a-1]+1 \nprint(ans,pna)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s077230106', 's397807572', 's727329184', 's614897100']
[3064.0, 163500.0, 146948.0, 4724.0]
[17.0, 2105.0, 2105.0, 286.0]
[432, 347, 371, 285]
p02802
u488178971
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.
['#ABC 151\nN,M = map(int,input().split())\nP=[[]]*N\nWA = 0\nAC = 0\nfor m in range(M):\n p,s = map(str,input().split())\n p=int(p)\n if P[p-1]==\'AC\':\n pass\n elif P[p-1]!=\'AC\' and s=="AC":\n P[p-1]="AC"\n AC+=1\n elif P[p-1]!=\'AC\' and s=="WA":\n WA+=1\n print(P)\nprint(AC,WA)', '\nN,M = map(int,input().split())\nPS =[""]*N\nPS2 =[0]*N\n\nPENALTY = 0\nAC = 0\nfor m in range(M):\n p,s = map(str,input().split())\n p=int(p)-1\n if PS[p]!="AC" and s=="WA":\n PS2[p]+=1\n elif PS[p]!="AC" and s=="AC":\n AC+=1\n PENALTY+=PS2[p]\n PS[p]="AC"\n \nprint(AC,PENALTY)']
['Wrong Answer', 'Accepted']
['s773511991', 's181965342']
[124188.0, 4596.0]
[2104.0, 364.0]
[307, 310]
p02802
u489762173
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["import sys\n\ndef main():\n N, M = map(int, input().split())\n\n if M == 0:\n print('0 0')\n sys.exit()\n\n\n p_S = []\n for i in range(M):\n p_S.append(input().split())\n\n p_S = list(map(list, set(map(tuple, p_S))))\n print(p_S) \n\n\n ac = 0\n wa = 0\n for arr in p_S:\n if arr[1] == 'AC':\n ac += 1\n else:\n wa += 1\n\n print(ac, wa)\n\nmain()", "import sys\n\ndef main():\n N, M = list(map(int,input().split()))\n p_S = [None] * M\n\n wa_cnt = [0] * N\n ac_flags = [0] * N\n\n for i in range(M):\n p_S[i] = list(input().split())\n p_S[i][0] = int(p_S[i][0])\n\n wa_ans, ac_ans = 0, 0\n\n for j in p_S:\n if j[1] == 'WA':\n wa_cnt[j[0] - 1] += 1\n\n if j[1] == 'AC' and ac_flags[j[0] - 1] == 0:\n wa_ans += wa_cnt[j[0] - 1]\n ac_ans += 1\n ac_flags[j[0] - 1] = 1\n\n\n print(ac_ans, wa_ans)\n\nmain()"]
['Wrong Answer', 'Accepted']
['s703115612', 's972585141']
[54520.0, 25056.0]
[373.0, 330.0]
[407, 522]
p02802
u496009935
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
[" n,m=map(int,input().split())\n\nAC=[0]*n\nWA=[0]*n\n\nfor i in range(m):\n t=input().split()\n p, s= int(t[0]), t[1]\n if s=='AC':\n AC[p-1]=1\n elif s=='WA' and AC[p-1]==0:\n WA[p-1]+=1\n\nac, wa=0,0\n\nfor i in range(n):\n if AC[i]:\n ac+=1\n wa+=WA[i]\n \nprint(ac, wa)", "n,m=map(int,input().split())\n\nAC=[0]*n\nWA=[0]*n\n\nfor i in range(m):\n t=input().split()\n p, s= int(t[0]), t[1]\n if s=='AC':\n AC[p-1]=1\n elif s=='WA' and AC[p-1]==0:\n WA[p-1]+=1\n\nac, wa=0,0\n\nfor i in range(n):\n if AC[i]:\n ac+=1\n wa+=WA[i]\n\nprint(ac, wa)"]
['Runtime Error', 'Accepted']
['s702951043', 's278957391']
[8880.0, 10460.0]
[25.0, 209.0]
[303, 294]
p02802
u498136917
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\n\nn, m = map(int, input().split())\nlist_ac = set()\ndic = collections.defaultdict(lambda:0)\n\nac = 0\nwa = 0\n\nfor _ in range(m):\n p, s = input().split()\n if s == "WA" and p not in list_ac:\n dic[p] += 1\n elif s =="AC" and p not in list_ac:\n list_ac.append(p)\n ac += 1\n if p in dic:\n wa += dic[p]\n \nprint(ac, wa)', 'import collections\n\nn, m = map(int, input().split())\nlist_ac = set()\ndic = collections.defaultdict(lambda:0)\n\nac = 0\nwa = 0\n\nfor _ in range(m):\n p, s = input().split()\n if s == "WA" and p not in list_ac:\n dic[p] += 1\n elif s =="AC" and p not in list_ac:\n list_ac.add(p)\n ac += 1\n if p in dic:\n wa += dic[p]\n \nprint(ac, wa)']
['Runtime Error', 'Accepted']
['s539632396', 's691367980']
[9520.0, 20016.0]
[157.0, 192.0]
[384, 381]
p02802
u500006160
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n, m = [int(x) for x in input().split()]\nlst = [None]*(n+1)\na = 0\nb = 0\nfor i in range(m):\n p, s = input().split()\n if s == 'AC' and lst[p] is None:\n a += 1\n lst[p] = True\n elif s == 'WA' and lst[p] is None:\n b += 1\nprint(a,b)", "n, m = [int(x) for x in input().split()]\nlst = [0]*(n+1)\na = 0\nb = 0\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n if s == 'AC' and lst[p] != True:\n a += 1\n b += lst[p]\n lst[p] = True\n elif s == 'WA' and lst[p] != True:\n lst[p] += 1\nprint(a,b)", "n, m = [int(x) for x in input().split()]\nlst = [0]*(n+1)\na = 0\nb = 0\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n if s == 'AC' and lst[p] is not None:\n a += 1\n b += lst[p]\n lst[p] = None\n elif s == 'WA' and lst[p] is not None:\n lst[p] += 1\nprint(a,b)"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s620577663', 's930587287', 's593302252']
[3828.0, 3828.0, 3828.0]
[18.0, 275.0, 269.0]
[238, 269, 277]
p02802
u500297289
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 = [False] * N\nac = 0\nwa = 0\nfor _ in range(M):\n p, S = input().split()\n w = 0\n if not l[int(p) - 1]:\n if S == 'AC':\n ac += 1\n l[int(p) - 1] = True\n wa += w\n w = 0\n else:\n w += 1\n\nprint(ac, wa)\n", "N, M = map(int, input().split())\nl = [0] * (N + 1)\nac = 0\nwa = 0\nfor _ in range(M):\n p, S = input().split()\n if S == 'WA':\n if l[int(p)] >= 0:\n l[int(p)] += 1\n else:\n if l[int(p)] >= 0:\n wa += l[int(p)]\n ac += 1\n l[int(p)] = -1\n\nprint(ac, wa)\n"]
['Wrong Answer', 'Accepted']
['s465426963', 's681899653']
[3828.0, 3828.0]
[312.0, 326.0]
[306, 310]
p02802
u503111914
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\nfor i in range(M):\n p,s = input().split()\n p = int(p)\n if AC[p-1] == 0:\n if s == "AC":\n AC[p-1] = 1\n else:\n WA[p-1] += 1\nwa = 0\nfor j in range(M):\n if AC[j] == 1:\n wa += WA[j]\nprint(sum(AC),wa)', 'N, M = map(int, input().split())\nWA = [0] * N\nAC = [0] * N\nfor i in range(M):\n p,s = input().split()\n p = int(p)\n if AC[p-1] == 0:\n if s == "AC":\n AC[p-1] = 1\n else:\n WA[p-1] += 1\nwa = 0\nfor j in range(N):\n if AC[j] == 1:\n wa += WA[j]\nprint(sum(AC),wa)']
['Runtime Error', 'Accepted']
['s950389594', 's960958252']
[4596.0, 4596.0]
[284.0, 274.0]
[307, 307]
p02802
u505505186
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# INPUT\nhead = list(map(int, input().split()))\n\nn = head[0]\nm = head[1]\n\nsubmit = [input() for i in range(m)]\n\nac = 0\nwa = 0\nfinished = []\n\nfor i in range(m):\n s = submit[i].split()\n if s[1] == "WA":\n if s[0] not in finished:\n wa = wa + 1\n print("WA")\n\n if s[1] == "AC":\n if s[0] not in finished:\n finished.append(s[0])\n ac = ac + 1\n\nprint("{0} {1}".format(ac,wa))', '# -*- coding: utf-8 -*-\n# INPUT\nn,m = list(map(int, input().split()))\n\nac = 0\nwa = 0\nfinished = [0] * (n + 1) \nq_wa = [0] * (n + 1)\n\nfor i in range(m):\n \n if len(finished) == n:\n break\n\n s = input().split()\n\n if finished[int(s[0])] == 0:\n if s[1] != "AC":\n q_wa[int(s[0])] += 1\n else:\n finished[int(s[0])] = 1\n ac = ac + 1\n wa = wa + q_wa[int(s[0])]\n\nprint("{0} {1}".format(ac,wa))']
['Wrong Answer', 'Accepted']
['s104238315', 's705295743']
[12576.0, 4596.0]
[2104.0, 314.0]
[455, 474]
p02802
u506858457
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())\nACL=[0]*N\nPL=[0]*N\nAC=0\nP=0\nfor i in range(M):\n p,S=input().split()\n p=int(p)\n if S =='AC':\n if ACL[p]==0:\n AC+=1\n P+=PL[p]\n ACL[p]=1\n else:\n PL[p]+=1\nprint(AC,P)\n \n ", "def II(): return int(input())\ndef MI(): return map(int, input().split())\ndef LI(): return list(map(int, input().split()))\nans,pena=0,0\nN,M=MI()\nP=[0]*N\nPENA=[0]*N\nfor i in range(M):\n p,s=input().split()\n p=int(p)\n p-=1\n if s=='AC':\n if P[p]==0:\n ans+=1\n P[p]=1\n if PENA[p]!=0:\n pena+=PENA[p]\n if s=='WA':\n if P[p]==0:\n PENA[p]+=1\nprint(ans,pena)\n"]
['Runtime Error', 'Accepted']
['s813822560', 's714158279']
[4724.0, 10456.0]
[283.0, 202.0]
[230, 384]
p02802
u508061226
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\nA = []*m;\nB = []*m;\n\nfor i in range(m):\n a, b = input().split();\n A[i] = int(a);\n B[i] = b;\n \n\nAC_list = list(set(A));\n\nAC_count = len(AC_list);\n\n\nWA_count = 0;\n\nfor j in AC_list:\n indexes = [i for i, x in enumerate(A) if x == j];\n for k in indexes:\n if B[k] == "WA":\n WA_count += 1;\n continue;\n else:\n break;\n \nprint(AC_count, WA_count);\n', 'n, m = map(int, input().split());\nA = [];\nB = [];\n\nfor i in range(m):\n a, b = input().split();\n a = int(a);\n A.append(a);\n B.append(b);\n\nAC_count = 0;\nWA_count = 0;\nAC_list = [];\n\n\nfor i in range(m):\n if B[i] == "AC":\n if A[i] not in AC_list: \n AC_list.append(A[i]);\n\nAC_count = len(AC_list);\n\n\nfor j in range(m):\n if A[i] in AC_list:\n if B[i] == "WA":\n WA_count += 1;\n\n print(AC_count, WA_count);\n', 'n,m = map(int, input().split());\n\nA = []*m;\nB = []*m;\n\nfor i in range(m):\n a, b = input().split();\n A[i] = int(a));\n B[i] = b;\n \n\nAC_list = list(set(A));\n\nAC_count = len(AC_list);\n\n\nWA_count = 0;\n\nfor j in AC_list:\n indexes = [i for i, x in enumerate(A) if x == j];\n for k in indexes:\n if B[k] == "WA":\n WA_count += 1;\n continue;\n else:\n break;\n \nprint(AC_count, WA_count);\n', "n,m = map(int,input().split())\n\nac, wa=[False]*n,[0]*n\nfor i in range(m):\n p,s = input().split()\n p=int(p)\n if s=='AC':\n ac[p-1]=True\n elif (s=='WA') and (ac[p-1]==False):\n wa[p-1]+=1\n\npenalty, clear=0,0\nfor i,tf in enumerate(ac): \n if tf:\n penalty += wa[i] \n clear += 1\nprint(clear penalty)\n", "n,m = map(int,input().split())\n\nac, wa=[False]*n,[0]*n\nfor i in range(m):\n p,s = input().split()\n p=int(p)\n if s=='AC':\n ac[p-1]=True\n elif (s=='WA') and (ac[p-1]==False):\n wa[p-1]+=1\n\npenalty, clear=0,0\nfor i,tf in enumerate(ac): \n if tf:\n penalty += wa[i] \n clear += 1\nprint(clear, penalty)\n"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s360845303', 's450097346', 's495321230', 's593940569', 's054676789']
[3064.0, 3064.0, 2940.0, 3064.0, 4596.0]
[18.0, 17.0, 17.0, 17.0, 287.0]
[423, 455, 424, 498, 499]
p02802
u509621775
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n, m = [int(x) for x in input().split()]\nac = [0] * (n + 1)\nwa = [0] * (n + 1)\n\nfor i in range(m):\n p, s = input().split()\n print(p, s)\n p = int(p)\n if s == "AC":\n ac[p] = 1\n if s == "WA" and ac[p] == 0:\n wa[p] += 1\n\nprint(sum(ac), sum([p for a, p in zip(ac, wa) if a == 1]))\n\n', 'n, m = [int(x) for x in input().split()]\nac = [0] * (n + 1)\nwa = [0] * (n + 1)\n\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n if s == "AC":\n ac[p] = 1\n if s == "WA" and ac[p] == 0:\n wa[p] += 1\n\nprint(sum(ac), sum([p for a, p in zip(ac, wa) if a == 1]))\n\n']
['Wrong Answer', 'Accepted']
['s398199335', 's387211149']
[6320.0, 5528.0]
[821.0, 277.0]
[307, 291]
p02802
u509830642
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\nfrom itertools import groupby\nfrom operator import itemgetter\ndef print_ans(N, M, ar):\n """Test Case\n >>> print_ans(2, 5, [[\'1\', \'WA\'], [\'1\', \'AC\'], [\'2\', \'WA\'], [\'2\', \'AC\'], [\'2\', \'WA\']])\n 2 2\n >>> print_ans(100000, 3, [[\'7777\', \'AC\'], [\'7777\', \'AC\'], [\'7777\', \'AC\']])\n 1 0\n >>> print_ans(6, 0, [])\n 0 0\n """\n correct = 0\n wrong = 0\n if M == 0:\n print(0, 0)\n else:\n for (k, g) in groupby(ar, key=itemgetter(0)):\n tmp_wrong = 0\n ac_flg = False\n for item in g:\n if item[1] == "AC":\n correct += 1\n ac_flg = True\n break\n else:\n tmp_wrong += 1\n if ac_flg == True:\n wrong += tmp_wrong\n #print("{} {}".format(correct, wrong))\n #print(str(correct) + " " + str(wrong))\n\nif __name__ == \'__main__\':\n N, M = map(int, input().rstrip().split())\n if M == 0:\n ar = []\n else:\n ar = [list(map(str, input().rstrip().split())) for i in range(M)]\n print_ans(N, M, ar)', 'import sys\ninput = sys.stdin.readline\nfrom itertools import groupby\nfrom operator import itemgetter\ndef print_ans(N, M, ar):\n """Test Case\n >>> print_ans(2, 5, [[\'1\', \'WA\'], [\'2\', \'WA\'], [\'2\', \'AC\'], [\'2\', \'WA\'], [\'1\', \'AC\']])\n 2 2\n >>> print_ans(100000, 3, [[\'7777\', \'AC\'], [\'7777\', \'AC\'], [\'7777\', \'AC\']])\n 1 0\n >>> print_ans(6, 0, [])\n 0 0\n """\n correct = 0\n wrong = 0\n ar = sorted(ar, key=itemgetter(0))\n if M == 0:\n print(0, 0)\n else:\n for (k, g) in groupby(ar, key=itemgetter(0)):\n tmp_wrong = 0\n ac_flg = False\n for item in g:\n if item[1] == "AC":\n correct += 1\n ac_flg = True\n break\n else:\n tmp_wrong += 1\n if ac_flg == True:\n wrong += tmp_wrong\n print("{} {}".format(correct, wrong))\nif __name__ == \'__main__\':\n N, M = map(int, input().rstrip().split())\n if M == 0:\n ar = []\n else:\n ar = [list(map(str, input().rstrip().split())) for i in range(M)]\n print_ans(N, M, ar)']
['Wrong Answer', 'Accepted']
['s281998559', 's047603784']
[32164.0, 34576.0]
[215.0, 286.0]
[1140, 1129]
p02802
u514206029
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['input_int_list = list(map(int, input().split()))\n\n\nN = input_int_list[0]\nM = input_int_list[1]\n\nQ_ans_list = [0] * N\n\nans_correct = 0\nans_penalty = 0\n\nfor i in range(M):\n\tinput_list_i = list( input().split())\n\tQ_num = int(input_list_i[0])\n\tif input_list_i[1] == "WA":\n\t\tif Q_ans_list[Q_num] != -1:\n\t\t\tQ_ans_list[Q_num] = Q_ans_list[Q_num] + 1\n\telif input_list_i[1] == "AC":\n\t\tif Q_ans_list[Q_num] != -1:\n\t\t\tans_correct = ans_correct + 1\n\t\t\tans_penalty = ans_penalty + Q_ans_list[Q_num]\n\t\t\tQ_ans_list[Q_num] = -1\n\n\n\n\n\nprint(ans_correct,ans_penalty)\n\n', 'input_int_list = list(map(int, input().split()))\n\n\nN = input_int_list[0]\nM = input_int_list[1]\n\nQ_ans_list = [0] * (N+1)\n\nans_correct = 0\nans_penalty = 0\n\nfor i in range(M):\n\tinput_list_i = list( input().split())\n\tQ_num = int(input_list_i[0])\n\tif input_list_i[1] == "WA":\n\t\tif Q_ans_list[Q_num] != -1:\n\t\t\tQ_ans_list[Q_num] = Q_ans_list[Q_num] + 1\n\telif input_list_i[1] == "AC":\n\t\tif Q_ans_list[Q_num] != -1:\n\t\t\tans_correct = ans_correct + 1\n\t\t\tans_penalty = ans_penalty + Q_ans_list[Q_num]\n\t\t\tQ_ans_list[Q_num] = -1\n\n\n\n\n\nprint(ans_correct,ans_penalty)\n']
['Runtime Error', 'Accepted']
['s401345271', 's015899432']
[3828.0, 3828.0]
[289.0, 312.0]
[549, 552]
p02802
u516554284
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())\naa=[[] for i in range(n)]\nfor x in range(m):\n a,b=input().split()\n d=int(a)-1\n aa[d].append(b)\n \nprint(aa)\nans_ac=0\nans_wa=0\nfor y in range(n):\n ans1=0\n ans2=0\n for z in range(len(aa[y])):\n if aa[y][z]=='WA':\n ans1+=1\n else:\n ans2+=1\n break\n if ans2==1:\n ans_wa+=ans1\n ans_ac+=1\n \nprint(str(ans_ac)+' '+str(ans_wa))\n ", "n,m=map(int,input().split())\naa=[[] for i in range(n)]\nfor x in range(m):\n a,b=input().split()\n d=int(a)-1\n aa[d].append(b)\n \nans_ac=0\nans_wa=0\nfor y in range(n):\n ans1=0\n ans2=0\n for z in range(len(aa[y])):\n if aa[y][z]=='WA':\n ans1+=1\n else:\n ans2+=1\n break\n if ans2==1:\n ans_wa+=ans1\n ans_ac+=1\n \nprint(str(ans_ac)+' '+str(ans_wa))\n \n"]
['Wrong Answer', 'Accepted']
['s422166080', 's432663269']
[27072.0, 25456.0]
[311.0, 296.0]
[385, 376]
p02802
u517930510
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())\npenalty =0\nAC_list = []\nfor i in range(M):\n pi, si = input().split()\n if si == 'WA':\n penalty += 1\n else:\n AC_list.append(pi)\nAC = len(list(set(AC_list)))\nprint(AC,penalty)\n", "N,M = map(int,input().split())\ncheck = [0]*N\nac = 0\npenalty = 0\nfor i in range(M):\n pi, si = input().split()\n pi = int(pi)\n if check[pi-1] == -1:\n continue\n if si == 'WA':\n check[pi-1] += 1\n else:\n ac += 1\n penalty += check[pi-1]\n check[pi-1] = -1\nprint(ac,wa)\n", "N,M = map(int,input().split())\npenalty =0\nAC_list = []\nfor i in range(M):\n pi, si = input().split()\n if si == 'WA':\n penalty += 1\n else:\n AC_list.append(pi)\nAC = list(set(AC_list))\nprint(AC,penalty)", "N,M = map(int,input().split())\npenalty =0\ncheck = [0]*N\nac = 0\nwa = 0\nfor i in range(M):\n pi, si = input().split()\n pi = int(pi)\n if check[pi] == -1:\n continue\n if si = 'WA':\n check[pi] += 1\n else:\n ac += 1\n wa += check[pi]\n check[pi] = -1\nprint(ac,wa)\n", "N,M = map(int,input().split())\ncheck = [0]*(N+1)\nac = 0\npenalty = 0\nfor i in range(M):\n pi, si = input().split()\n pi = int(pi)\n if check[pi] == -1:\n continue\n if si == 'WA':\n check[pi] += 1\n else:\n ac += 1\n penalty += check[pi]\n check[pi] = -1\nprint(ac,wa)\n", "N,M = map(int,input().split())\npenalty =0\nAC_list = []\nfor i in range(M):\n pi, si = input().split()\n if si == 'AC':\n AC_list.append(pi)\nAC = len(list(set(AC_list)))\npenalty = M -AC\nprint(AC,penalty)", "N,M = map(int,input().split())\ncheck = [0]*N\nac = 0\npenalty = 0\nfor i in range(M):\n pi, si = input().split()\n pi = int(pi)\n if check[pi-1] == -1:\n continue\n if si == 'WA':\n check[pi-1] += 1\n else:\n ac += 1\n penalty += check[pi-1]\n check[pi-1] = -1\nprint(ac,penalty)\n\n"]
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s245137520', 's437535822', 's457157658', 's580046436', 's629801046', 's766238834', 's544885874']
[15508.0, 3828.0, 15636.0, 2940.0, 3828.0, 15636.0, 3828.0]
[213.0, 285.0, 213.0, 17.0, 285.0, 195.0, 283.0]
[213, 281, 207, 273, 277, 205, 287]
p02802
u518386853
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())\nans1 = 0\nans2 = 0\npreans2 = 0\ncheck = 0\nt = []\npret = []\n\nfor i in range(m):\n pret = list(map(str, input().split()))\n t.append(pret)\n \nfor i in range(m):\n if t[i][1] == "WA":\n if check = 0:\n preans2 += 1\n else:\n if check = 0:\n ans1 += 1\n ans2 += preans2\n preans2 = 0\n check += 1\n else:\n ans1 += 1\n check += 1\n if i > 0:\n if t[i][0] != t[i-1][0]:\n check = 0\n \nprint(ans1, ans2)', 'n, m = map(int, input().split())\n\nac = 0\nwa = 0\ndwa = {}\nd = {}\n\nfor i in range(m):\n p, s = input().split()\n if d.get(p) == "AC":\n continue\n if p not in dwa:\n dwa[p] = 0\n if s == "WA":\n dwa[p] += 1\n else:\n ac += 1\n wa += dwa[p]\n d[p] = s\n \nprint(ac, wa)']
['Runtime Error', 'Accepted']
['s254920049', 's883942761']
[2940.0, 28436.0]
[17.0, 309.0]
[472, 275]
p02802
u520392474
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\npenalty = 0\n\ncorrected = {}\nwa = {}\n\nfor i in range(m):\n pi, si = input().split()\n if (si == \'AC\' and not corrected.get(pi)):\n corrected[pi] = True\n elif (si == \'WA\' and not corrected.get(pi)):\n wa[pi] += wa[pi]\n\ncorrect = len(corrected.keys())\nfor i in corrected.keys()\n\tpenalty += wa[i]\n\nprint("{} {}".format(correct, penalty))\n \n', 'n, m = list(map(int,input().split()))\n\npenalty = 0\n\ncorrected = {}\nwa = {}\n\nfor i in range(m):\n pi, si = input().split()\n if (si == \'AC\' and not corrected.get(pi)):\n corrected[pi] = True\n elif (si == \'WA\' and not corrected.get(pi)):\n wa[pi] = wa[pi] + 1 if wa.get(pi) else 1\n\ncorrect = len(corrected.keys())\nfor i in corrected.keys()\n\tpenalty += wa[i] if wa.get(i) else 0\n\nprint("{} {}".format(correct, penalty))\n \n', 'n, m = list(map(int,input().split()))\n\npenalty = 0\n\ncorrected = {}\nwa = {}\n\nfor i in range(m):\n pi, si = input().split()\n if (si == \'AC\' and not corrected.get(pi)):\n corrected[pi] = True\n elif (si == \'WA\' and not corrected.get(pi)):\n wa[pi] = wa[pi] + 1 if wa.get(pi) else 1\n\ncorrect = len(corrected.keys())\nfor i in corrected.keys():\n\tpenalty += wa[i] if wa.get(i) else 0\n\nprint("{} {}".format(correct, penalty))\n \n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s539700776', 's584896015', 's885304540']
[2940.0, 3064.0, 17140.0]
[18.0, 17.0, 253.0]
[383, 428, 429]
p02802
u522293645
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)]\n\ndp = [[0 for _ in range(2)] for _ in range(n)] \n\nfor i in range(m):\n if dp[i][0]==1:\n continue\n else:\n if lis[i][1]=='WA':\n dp[int(lis[i][0])][1] += 1\n if lis[i][1]=='AC':\n dp[int(lis[i][0])][0] = 1\n\nac = 0\nwa = 0\n\nfor i in range(n):\n if dp[i][0]==1:\n ac += 1\n wa += dp[i][1]\n\nprint(ac,wa)", "n,m = map(int,input().split())\nlis = [list(input().split()) for _ in range(m)]\n\ndp = [[0 for _ in range(2)] for _ in range(n)] \n\nfor i in range(m):\n if dp[int(lis[i][0])-1][0]==1:\n continue\n else:\n if lis[i][1]=='WA':\n dp[int(lis[i][0])-1][1] += 1\n if lis[i][1]=='AC':\n dp[int(lis[i][0])-1][0] = 1\n\nac = 0\nwa = 0\n\nfor i in range(n):\n if dp[i][0]==1:\n ac += 1\n wa += dp[i][1]\n\nprint(ac,wa)"]
['Runtime Error', 'Accepted']
['s735075172', 's622821283']
[40548.0, 40424.0]
[316.0, 373.0]
[450, 469]
p02802
u523545435
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 copy\n\nN,M=map(int,input().split())\nL=[list(map(int,input().split())) for i in range(M)]\n\nS=[]\ncomponent=[0,0]\nfor j in range(N):\n S.append(copy.deepcopy(component)\n\nfor k in range(1,M+1):\n if L[k-1][1]=='AC':\n if S[L[k-1][0]][0]==0:\n S[L[k-1][0]][0]=1\n else:\n if S[L[k-1][0]][0]==0:\n S[L[k-1][0]][1]+=1\n\nansAC=0\nansWA=0\n\nfor l in range(N):\n ansAC+=S[l][0]\n ansWA+=S[l][1]\n\nprint(ansAC,ansWA)\n\n\n", "import copy\n\nN,M=map(int,input().split())\n\nL=[list() for i in range(N)]\nprint(L)\n\nfor j in range(M):\n p,s=map(str,input().split())\n p=int(p)\n L[p-1].append(copy.deepcopy(s))\n\nright=0\nwrong=0\n\nfor k in range(N):\n for l in range(len(L[k])):\n if L[k][l]=='WA':\n wrong+=1\n else:\n right+=1\n break\n\nprint(right,wrong)\n\n\n", "import copy\n\nN,M=map(int,input().split())\nL=[list(map(str,input().split())) for i in range(M)]\n\nfor x in range(M):\n L[x][0]=int(L[x][0])\n\n#print(N,M)\n#print(L)\n\nS=[]\ncomponent=[0,0]\nfor j in range(N):\n S.append(copy.deepcopy(component))\n\n#print(S)\n\nfor k in range(1,M+1):\n if L[k-1][1]=='AC':\n if S[L[k-1][0]-1][0]==0:\n S[L[k-1][0]-1][0]=1\n else:\n if S[L[k-1][0]-1][0]==0:\n S[L[k-1][0]-1][1]+=1\n #print(S)\n\nansAC=0\nansWA=0\n\nfor l in range(N):\n ansAC+=S[l][0]\n if S[l][0]==1:\n ansWA+=S[l][1]\n\nprint(ansAC,ansWA)\n\n\n"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s169530687', 's220220173', 's440724557']
[2940.0, 21228.0, 43056.0]
[17.0, 625.0, 864.0]
[452, 373, 577]
p02802
u524534026
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())\ntmp=[0]*n\nwtmp=[0]*n\nfor _ in range(m):\n P,s=map(str,input().split())\n p=int(P)\n p-=1\n if not tmp[p]==0:\n continue\n if s=='AC':\n tmp[p]=1\n else:\n wtmp[p]+=1\nans1=sum(tmp)\nfor i in range(n):\n ans2=0\n if tmp[i]==1:\n ans2+=wtmp[i]\nprint(ans1,ans2)\n\n", "n,m=map(int,input().split())\ntmp=[0]*n\nwtmp=[0]*n\nfor _ in range(m):\n P,s=map(str,input().split())\n p=int(P)\n p-=1\n if not tmp[p]==0:\n continue\n if s=='AC':\n tmp[p]=1\n else:\n wtmp[p]+=1\nans1=sum(tmp)\nans2=0\nfor i in range(n):\n if tmp[i]==1:\n ans2+=wtmp[i]\nprint(ans1,ans2)\n\n"]
['Wrong Answer', 'Accepted']
['s785775680', 's443848321']
[4596.0, 4596.0]
[358.0, 361.0]
[327, 323]
p02802
u527993431
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\nA=0\nW=0\ntmp=0\nfor i in range(M):\n\tx,y=input().split()\n\tt=int(x)\n\tif L[t-1]==0:\n\t\tif y=="WA":\n\t\t\ttmp+=1\n\t\t\tW+=1\n\t\telse:\n\t\t\tA+=1\n\t\t\tW+=tmp\n\t\t\ttmp=0\n\t\t\tL[t-1]=1\nprint(A,W)', 'N,M=map(int,input().split())\nL=[0]*N\nA=0\nW=0\ntmp=[0]*N\nfor i in range(M):\n\tx,y=input().split()\n\tt=int(x)\n\tif L[t-1]==0:\n\t\tif y=="WA":\n\t\t\ttmp[t-1]+=1\n\t\telse:\n\t\t\tA+=1\n\t\t\tW+=tmp[t-1]\n\t\t\tL[t-1]=1\nprint(A,W)']
['Wrong Answer', 'Accepted']
['s688762293', 's019122187']
[3828.0, 4596.0]
[270.0, 299.0]
[205, 202]
p02802
u530786533
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["N, M = map(int, input().split())\n\nac = [False] * N\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]\n print(*[a, b])\n", "N, 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]\n print(*[a, b])\n", "N, 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"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s040425003', 's328110855', 's280242072']
[2940.0, 5716.0, 4596.0]
[17.0, 392.0, 291.0]
[304, 310, 304]
p02802
u540698208
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\neva = [[0] for _ in range(n)]\n\nac = 0\nwa = 0\n\nfor i in range(m):\n a = input().split()\n q = int(a[0])\n s = a[1]\n if "AC" in eva[q]:\n pass\n else:\n if s == "AC":\n ac += 1\n eva[q].append("AC")\n else:\n wa += 1\n eva[q] += 1\n\nprint(ac, wa)\n', 'n, m = map(int, input().split())\n\neva = {}\n\nac = 0\nwa = 0\n\nfor i in range(m):\n q, s = input().split()\n if eva[q] == "AC":\n pass\n else:\n if s == "AC":\n ac += 1\n eva[q] = "AC"\n else:\n wa += 1\n\nprint(ac, wa)\n', 'n, m = map(int, input().split())\n\neva = [[0, 0] for _ in range(n)]\n\nac = 0\npenalty = 0\n\nfor i in range(m):\n q, s = input().split()\n if eva[int(q) - 1][1] == 0:\n if s == "WA":\n eva[int(q) - 1][0] += 1\n else:\n eva[int(q) - 1][1] += 1\n ac += 1\n penalty += eva[int(q) - 1][0]\n else:\n pass\n\nprint(ac, penalty)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s055378908', 's106205863', 's273766738']
[15732.0, 3060.0, 13172.0]
[341.0, 17.0, 349.0]
[347, 268, 378]
p02802
u541921833
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, stdin.readline().rstrip().split())\nAC = 0\nWA = 0\ndata = {}\nfor _ in range(M):\n tmp = stdin.readline().rstrip().split()\n p, S = int(tmp[0]), tmp[1]\n if p not in data.keys():\n if S == 'AC':\n data[p] = {'AC': True, 'WA': 0}\n AC += 1\n elif S == 'WA':\n data[p] = {'AC': False, 'WA': 1}\n else:\n if S == 'AC':\n if data[p]['AC'] is True:\n continue\n elif data[p]['AC'] is False:\n data[p]['AC'] = True\n WA += data[p]['WA']\n AC += 1\n elif S == 'WA':\n if data[p]['AC'] is True:\n continue\n elif data[p]['AC'] is False:\n data[p]['WA'] += 1\nprint('{} {}'.format(AC, WA))\n\n", "N, M = map(int, input().rstrip().split())\nAC = 0\nWA = 0\ndata = {}\nfor _ in range(M):\n tmp = input().rstrip().split()\n p, S = int(tmp[0]), tmp[1]\n if p not in data.keys():\n if S == 'AC':\n data[p] = {'AC': True, 'WA': 0}\n AC += 1\n elif S == 'WA':\n data[p] = {'AC': False, 'WA': 1}\n else:\n if S == 'AC':\n if data[p]['AC'] is True:\n continue\n elif data[p]['AC'] is False:\n data[p]['AC'] = True\n WA += data[p]['WA']\n AC += 1\n elif S == 'WA':\n if data[p]['AC'] is True:\n continue\n elif data[p]['AC'] is False:\n data[p]['WA'] += 1\nprint('{} {}'.format(AC, WA))\n\n"]
['Runtime Error', 'Accepted']
['s943724921', 's294907373']
[3064.0, 42088.0]
[17.0, 371.0]
[781, 763]
p02802
u547748135
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\nsolved = [0]* 10**5\npenalty_sum = 0\npenalty = 0\n\nfor _ in range(m):\n q, result = input().split()\n q = int(q)\n \n if result == \'AC\':\n if solved[q] == 0:\n penalty_sum += penalty\n penalty = 0\n else:\n if solved[q] == 0:\n penalty += 1\n\nprint(str(sum(solved)) + " " + str(penalty_sum))', 'n, m = map(int, input().split())\n\nsolved = [0]* 10**5\npenalty = [0]* 10**5\npenalty_sum = 0\nfor _ in range(m):\n q, result = input().split()\n q = int(q) - 1\n \n if result == \'AC\':\n if solved[q] == 0:\n solved[q] = 1\n penalty_sum = penalty[q]\n else:\n if solved[q] == 0:\n penalty[q] += 1\n\nprint(str(sum(solved)) + " " + str(penalty_sum))', 'n, m = map(int, input().split())\n\nsolved = [0]* 10*5\npenalty_sum = 0\npenalty = 0\n\nfor _ in range(m):\n q, result = input().split()\n q = int(q)\n \n if result == \'AC\':\n if solved[q] == 0:\n penalty_sum += penalty\n penalty = 0\n else:\n if solved[q] == 0:\n penalty += 1\n\nprint(str(len(ac)) + " " + str(penalty_sum))', 'n, m = map(int, input().split())\n\nsolved = [0]* 10**5\npenalty = [0]* 10**5\npenalty_sum = 0\nfor _ in range(m):\n q, result = input().split()\n q = int(q) - 1\n \n if result == \'AC\':\n if solved[q] == 0:\n solved[q] = 1\n penalty_sum += penalty[q]\n else:\n if solved[q] == 0:\n penalty[q] += 1\n\nprint(str(sum(solved)) + " " + str(penalty_sum))\n ']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s036145563', 's177747196', 's988214620', 's152423637']
[3828.0, 4596.0, 3064.0, 4596.0]
[263.0, 269.0, 256.0, 286.0]
[374, 393, 369, 399]
p02802
u548303713
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())\ninfo=[]\nfor i in range(m):\n p,s=input().split()\n info.append([int(p),s])\nac,wa=0,0\nplob=[0 for i in range(n+1)] \nfor i in range(m):\n if plob[info[i][0]]==0:\n if info[i][1]=="WA":\n wa+=1\n else:\n ac+=1\n plob[info[i][0]]=1\n else:\n if info[i][1]=="WA":\n wa+=1\nprint(str(ac)+" "+str(wa))', 'n,m=map(int,input().split())\ninfo=[]\nfor i in range(m):\n p,s=input().split()\n info.append([int(p),s])\nac,wa=0,0\nplob=[[0,0] for i in range(n+1)] \nfor i in range(m):\n if plob[info[i][0]][0]==0:\n if info[i][1]=="WA":\n plob[info[i][0]][1]+=1\n else:\n ac+=1\n plob[info[i][0]][0]=1\n wa+=plob[info[i][0]][1]\nprint(str(ac)+" "+str(wa))']
['Wrong Answer', 'Accepted']
['s975072347', 's738451672']
[22840.0, 32252.0]
[311.0, 377.0]
[388, 471]
p02802
u548684908
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()))\nans = 0\npen = 0\n\ncheck = {}\n\nfor i in range(M):\n if len(check) == N:\n break\n p,S = input().split()\n p = int(p)\n if p not in check:\n if S == 'WA':\n check[p] = 0\n else:\n ans = 1\n else:\n if S == 'WA':\n check[p] += 1\n elif S == 'AC' and check[p] != -1:\n pen += check[p]\n ans += 1\n check[p] == -1\n\nprint(ans,pen)", "N,M = list(map(int,input().split()))\nans = 0\npen = 0\n\ncheck = {}\n\nfor i in range(M):\n p,S = input().split()\n p = int(p)\n if p not in check:\n if S == 'WA':\n check[p] = 1\n else:\n ans += 1\n check[p] = -1\n else:\n if S == 'WA' and check[p] != -1:\n check[p] += 1\n elif S == 'AC' and check[p] != -1:\n pen += check[p]\n ans += 1\n check[p] = -1\n\nprint(ans,pen)"]
['Wrong Answer', 'Accepted']
['s569816073', 's849577807']
[14292.0, 19140.0]
[201.0, 191.0]
[460, 467]
p02802
u549383771
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 = [0]*n\nwa_list = [0]*n\npena = 0\nfor i in range(m):\n p,s = input().split()\n if s == 'AC':\n if ac_list[int(p)-1] == 0:\n ac_list[int(p)-1] =1\n pena += wa_list[int(p)-1]\n \n if s == 'WA':\n if ac_list[int(p)-1] == 0:\n wa_list[int(p)-1] += 1\n \nprint('{0} {1}'.format(sum(ac_list) , pena)", "n,m = map(int,input().split())\nac_list = [0]*n\nwa_list = [0]*n\npena = 0\nfor i in range(m):\n p,s = input().split()\n if s == 'AC':\n if ac_list[int(p)-1] == 0:\n ac_list[int(p)-1] =1\n pena += wa_list[int(p)-1]\n \n if s == 'WA':\n if ac_list[int(p)-1] == 0:\n wa_list[int(p)-1] += 1\n \nprint('{0} {1}'.format(sum(ac_list) , pena))"]
['Runtime Error', 'Accepted']
['s749426454', 's538615617']
[3064.0, 4596.0]
[17.0, 315.0]
[394, 395]
p02802
u550835660
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["N, M = map(int, input().split())\nA = [input().split() for i in range(M)]\nproblems = {}\nreject_count = 0\nfor P, S in A:\n if not problems.get(P) and P <= N:\n if S != 'AC':\n reject_count += 1\n else:\n problems[P] = S\nprint(len(problems), reject_count)", "N, M = map(int, input().split())\nA = [input().split() for i in range(M)]\nproblems = {}\nrejected = [0]*(N+1)\nreject_count = 0\nfor P, S in A:\n P = int(P)\n if not problems.get(P):\n if S != 'AC':\n rejected[P] += 1\n else:\n problems[P] = S\nfor i in range(N+1):\n if problems.get(i):\n reject_count += rejected[i]\nprint(len(problems), reject_count)"]
['Runtime Error', 'Accepted']
['s902512878', 's013567037']
[32160.0, 45060.0]
[215.0, 324.0]
[286, 391]
p02802
u552143188
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 p1,S1=[i for i in input().split()]\n p.append(p1)\n S.append(S1)\na = 0\nb = 0\nc = 0\n\nfor j in range(N):\n for k in range(M):\n if int(p[k]) == j+1:\n if S[k] == 'WA':\n b += 1\n elif S[k] == 'AC':\n a += 1\n c = c + b\n break\nprint(a,c)", "N,M = map(int,input().split())\nP = []\nS = []\nfor _ in range(M):\n p,s = map(str,input().split())\n P.append(int(p))\n S.append(s)\nac = ['WA']*N\nwa = [0]*N\n\nfor i in range(M):\n if S[i] == 'WA':\n if ac[P[i]-1] == 'WA':\n wa[P[i]-1] += 1\n else:\n ac[P[i]-1] = 'AC'\nfor j in range(N):\n if ac[j] == 'WA':\n wa[j] = 0\nprint(ac.count('AC'),sum(wa))"]
['Wrong Answer', 'Accepted']
['s139979290', 's300195996']
[15768.0, 15404.0]
[2104.0, 358.0]
[391, 355]
p02802
u552192779
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n,m = map(int,input().split(\' \'))\nscore = 0\npenalty = 0\npenalties = {}\nacs = set()\nfor _ in range(m):\n num,result = input().split(\' \')\n if num in acs:\n continue\n \n if result == "WA":\n if \'num\' in penalties:\n penalties[\'num\'] +=1\n else:\n penalties[\'num\'] =1\n else:\n score +=1\n if \'num\' in penalties:\n penalty += penalties[\'num\']\n acs.add(num)\n\nprint(score,penalty)', 'n,m = map(int,input().split(\' \'))\nscore = 0\npenalty = 0\npenalties = {}\nacs = set()\nfor _ in range(m):\n num,result = input().split(\' \')\n if num in acs:\n continue\n \n if result == "WA":\n if num in penalties:\n penalties[num] +=1\n else:\n penalties[num] =1\n else:\n score +=1\n if num in penalties:\n penalty += penalties[num]\n acs.add(num)\n\nprint(score,penalty)']
['Wrong Answer', 'Accepted']
['s197088520', 's180539853']
[14056.0, 14052.0]
[254.0, 244.0]
[453, 443]
p02802
u554781254
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["def main():\n n, m = map(int, input().split())\n ac = [0] * m\n pena = [0] * m\n\n for _ in range(m):\n p, s = map(str, input().split())\n p = int(p) - 1\n if ac[p] == 0 and s == 'WA':\n pena[p] += 1\n else:\n ac[p] = 1\n print()\n\n\nif __name__ == '__main__':\n main()", "import numpy as np\n\n\ndef main():\n n, m = map(int, input().split())\n ac = np.array([0] * n)\n pena = np.array([0] * n)\n # \n for _ in range(m):\n p, s = map(str, input().split())\n p = int(p) - 1\n if ac[p] == 0 and s == 'WA':\n pena[p] += 1\n else:\n ac[p] = 1\n print(sum(ac), sum(ac * pena))\n\n\nif __name__ == '__main__':\n main()"]
['Runtime Error', 'Accepted']
['s799105404', 's406651997']
[4596.0, 16824.0]
[306.0, 848.0]
[322, 392]
p02802
u554784585
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N,M=map(int,input().split())\nwa=0\nac=0\nQ=list(range(N))\nfor i in range(N):\n Q[i]=True\n\nfor i in range(M):\n p,s=input().split()\n p=int(p)\n if s=="AC":\n if Q[p]==1:\n pass\n else:\n ac=ac+1\n else:\n if Q[p]==1:\n pass\n else:\n wa=wa+1\n\nprint(ac,wa)\n', 'N,M=map(int,input().split())\n\nans=[0]*N\npen=[0]*N\nAC=[0]*N\n\nfor i in range(M):\n p,s=input().split()\n p=int(p)\n if s=="WA":\n pen[p-1]+=1\n else:\n if AC[p-1]==0:\n ans[p-1]+=pen[p-1]\n AC[p-1]=1\n\nprint(AC.count(1),sum(ans))\n']
['Runtime Error', 'Accepted']
['s690827963', 's037072385']
[6900.0, 5364.0]
[245.0, 283.0]
[328, 263]
p02802
u556589653
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())\nk = {}\nfor i in range(M):\n p,s = input().split()\n if p not in k:\n k[p] = [s]\n else:\n k[p].append(s)\nac = 0\nwa = 0\nfor l in k:\n now = 0\n if l == "WA":\n now += 1\n elif l == "AC":\n ac += 1\n wa += now\n break\nprint(ac,wa)', 'N,M = map(int,input().split())\nk = {}\nfor i in range(M):\n p,s = input().split()\n if p not in k:\n k[p] = [s]\n else:\n k[p].append(s)\nac = 0\nwa = 0\nfor l in k:\n now = 0\n for m in k[l]:\n if m == "WA":\n now += 1\n elif m == "AC":\n ac += 1\n wa += now\n break\nprint(ac,wa)\n']
['Wrong Answer', 'Accepted']
['s554804933', 's234751415']
[30160.0, 30156.0]
[279.0, 317.0]
[271, 301]
p02802
u560867850
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\nscores = [[0, False] for _ in range(n)]\n\nfor _ in range(m):\n p, S = input().split()\n p = int(p)\n\n if scores[p][1]:\n continue\n\n if S == "AC":\n scores[p][1] = True\n continue\n\n if S == "WA":\n scores[p][0] += 1\n\nscore = pena = 0\nfor count, ac in scores:\n if ac:\n score += 1\n pena += count\n\nprint(score, pena)\n', 'n, m = map(int, input().split())\n\nscores = [[0, False] for _ in range(n+1)]\n\nfor _ in range(m):\n p, S = input().split()\n p = int(p)\n\n if scores[p][1]:\n continue\n\n if S == "AC":\n scores[p][1] = True\n continue\n\n if S == "WA":\n scores[p][0] += 1\n\nscore = pena = 0\nfor count, ac in scores:\n if ac:\n score += 1\n pena += count\n\nprint(score, pena)\n']
['Runtime Error', 'Accepted']
['s650750562', 's271166835']
[13172.0, 13172.0]
[314.0, 312.0]
[399, 401]
p02802
u562550538
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.
["#151c\nn,w=map(int,input().split())\nac=0\nwa=0\nwa_cnt=0\nac_flg=[0]*n\nfor i in range(w):\n\tp,s=input().split()\n\tp=int(p)-1\n\tif ac_flg[p]==1:\n\t\tcontinue\n\telse:\n\t\tif s=='AC':\n\t\t\tac_flg[p]=1\n\t\t\tac+=1\n\t\t\twa[p] =wa_cnt\n\t\t\twa_cnt=0\n\t\telse:\n\t\t\twa_cnt+=1\n\nwa_ans=0\nfor i in (n):\n\twa_ans+=wa[i]\nprint(ac,wa)", "#151c\nn,w=map(int,input().split())\nac=0\nwa=[0]*n\nwa_cnt=[0]*n\nac_flg=[0]*n\nfor i in range(w):\n\tp,s=input().split()\n\tp=int(p)-1\n\tif ac_flg[p]==1:\n\t\tcontinue\n\telse:\n\t\tif s=='AC':\n\t\t\tac_flg[p]=1\n\t\t\tac+=1\n\t\t\twa[p] +=wa_cnt\n\t\t\t#wa_cnt=0\n\t\telse:\n\t\t\twa_cnt[p]+=1\n\nwa_ans=0\nfor i in range(n):\n\twa_ans+=wa[i]\n\nprint(ac,wa_ans)\n", "#151c\nn,w=map(int,input().split())\nac=0\nwa=0\nwa_cnt=0\nac_flg=[0]*n\nfor i in range(w):\n\tp,s=input().split()\n\tp=int(p)-1\n\tif ac_flg[p]==1:\n\t\tcontinue\n\telse:\n\t\tif s=='AC':\n\t\t\tac_flg[p]=1\n\t\t\tac+=1\n\t\t\twa+=wa_cnt\n\t\telse:\n\t\t\twa_cnt+=1\nprint(ac,wa)", "#151c\nn,w=map(int,input().split())\nac=0\nwa=0\nwa_cnt=0\nac_flg=[0]*n\nfor i in range(w):\n\tp,s=input().split()\n\tp=int(p)-1\n\tif ac_flg[p]==1:\n\t\tcontinue\n\telse:\n\t\tif s=='AC':\n\t\t\tac_flg[p]=1\n\t\t\tac+=1\n\t\t\twa[p]+=wa_cnt\n\t\t\twa_cnt=0\n\t\telse:\n\t\t\twa_cnt+=1\n\nwa_ans=0\nfor i in (n):\n\twa_ans+=wa[i]\nprint(ac,wa)", "#151c\nn,w=map(int,input().split())\nac=0\nwa=[0]*n\nwa_cnt=[0]*n\nac_flg=[0]*n\nfor i in range(w):\n\tp,s=input().split()\n\tp=int(p)-1\n\tif ac_flg[p]==1:\n\t\tcontinue\n\telse:\n\t\tif s=='AC':\n\t\t\tac_flg[p]=1\n\t\t\tac+=1\n\t\t\twa[p] =wa_cnt\n\t\t\t#wa_cnt=0\n\t\telse:\n\t\t\twa_cnt[p]+=1\n\nwa_ans=0\nfor i in range(n):\n\twa_ans+=wa[i]\n\nprint(ac,wa_ans)\n", "#151c\nn,w=map(int,input().split())\nac=0\nwa=0\nwa_cnt=0\nac_flg=[0]*w\nfor i in range(w):\n\tp,s=input().split()\n\tp=int(p)-1\n\tif ac_flg[p]==1:\n\t\tcontinue\n\telse:\n\t\tif s=='AC':\n\t\t\tac_flg[p]=1\n\t\t\tac+=1\n\t\t\twa+=wa_cnt\n\t\telse:\n\t\t\twa_cnt+=1\nprint(ac,wa)", "#151c\nn,w=map(int,input().split())\nac=0\nwa=0\nwa_cnt=0\nac_flg=[0]*n\nfor i in range(w):\n\tp=int(input())-1\n\ts=input()\n\tif ac_flg[p]==1:\n\t\tcontinue\n\telse:\n\t\tif s=='AC':\n\t\t\tac_flg[p]=1\n\t\t\tac+=1\n\t\t\twa+=wa_cnt\n\t\telse:\n\t\t\twa_cnt+=1\nprint(ac,wa)", "#151c\nn,w=map(int,input().split())\nac=0\nwa=[0]*w\nwa_cnt=0\nac_flg=[0]*n\nfor i in range(w):\n\tp,s=input().split()\n\tp=int(p)-1\n\tif ac_flg[p]==1:\n\t\tcontinue\n\telse:\n\t\tif s=='AC':\n\t\t\tac_flg[p]=1\n\t\t\tac+=1\n\t\t\twa[p] =wa_cnt\n\t\t\twa_cnt=0\n\t\telse:\n\t\t\twa_cnt+=1\n\nwa_ans=0\nfor i in (n):\n\twa_ans+=wa[i]\nprint(ac,wa_ans)", "#151c\nn,w=map(int,input().split())\nac=0\nwa=[0]*w\nwa_cnt=0\nac_flg=[0]*n\nfor i in range(w):\n\tp,s=input().split()\n\tp=int(p)-1\n\tif ac_flg[p]==1:\n\t\tcontinue\n\telse:\n\t\tif s=='AC':\n\t\t\tac_flg[p]=1\n\t\t\tac+=1\n\t\t\twa[p] +=wa_cnt\n\t\t\twa_cnt=0\n\t\telse:\n\t\t\twa_cnt+=1\n\nwa_ans=0\nfor i in (n):\n\twa_ans+=wa[i]\n\nprint(ac,wa_ans)", "#151c\nn,w=map(int,input().split())\nac=0\nwa=0\nwa_cnt=0\nac_flg=[0]*n\nfor i in range(w):\n\tp,s=input().split()\n\tp=int(p)-1\n\tif ac_flg[p]==1:\n\t\tcontinue\n\telse:\n\t\tif s=='AC':\n\t\t\tac_flg[p]=1\n\t\t\tac+=1\n\t\t\twa+=wa_cnt\n\t\telse:\n\t\t\twa_cnt+=1\nprint(ac,wa)", "#151c\nn,w=map(int,input().split())\nac=0\nwa=[0]*n\nwa_cnt=[0]*n\nac_flg=[0]*n\nfor i in range(w):\n\tp,s=input().split()\n\tp=int(p)-1\n\tif ac_flg[p]==1:\n\t\tcontinue\n\telse:\n\t\tif s=='AC':\n\t\t\tac_flg[p]=1\n\t\t\tac+=1\n\t\t\twa[p] =wa_cnt[p]\n\t\t\t#wa_cnt=0\n\t\telse:\n\t\t\twa_cnt[p]+=1\n\nwa_ans=0\nfor i in range(n):\n\twa_ans+=wa[i]\n\nprint(ac,wa_ans)\n"]
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s074743651', 's148249498', 's205381518', 's229357380', 's264065326', 's374328395', 's384663262', 's611576565', 's664034533', 's809959214', 's886437500']
[3828.0, 5364.0, 3828.0, 3828.0, 5364.0, 3828.0, 3828.0, 4596.0, 4596.0, 3828.0, 5364.0]
[257.0, 257.0, 277.0, 261.0, 286.0, 284.0, 18.0, 283.0, 273.0, 272.0, 298.0]
[294, 318, 240, 294, 317, 240, 236, 302, 304, 240, 320]
p02802
u565476466
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['import sys\n\nN, M = map(int, input().split())\n\nWA = [0] * N\nisAC = [False] * N\n\nfor _ in range(M):\n\tp, S = input().split()\n\tif S == "AC":\n\t\tisAC[int(p) - 1] = True\n\telif not isAC[int(p) - 1]:\n\t\tWA += 1\n\nACsum, WAsum = 0, 0\nfor i in range(N):\n\tif isAC[i]:\n\t\tACsum += 1\n\t\tWAsum += WA[i]\n\nprint(ACsum, WAsum)', 'import sys\n\nN, M = map(int, input().split())\n\nWA = [0] * N\nisAC = [False] * N\n\nfor _ in range(M):\n\tp, S = input().split()\n\tif S == "AC":\n\t\tisAC[int(p) - 1] = True\n\telif not isAC[int(p) - 1]:\n\t\tWA[int(p) - 1] += 1\n\nACsum, WAsum = 0, 0\nfor i in range(N):\n\tif isAC[i]:\n\t\tACsum += 1\n\t\tWAsum += WA[i]\n\nprint(ACsum, WAsum)']
['Runtime Error', 'Accepted']
['s152171895', 's094364624']
[4596.0, 4596.0]
[262.0, 292.0]
[304, 316]
p02802
u566574814
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,wa = 0,0\nnumber=[0]*n\n\nfor m in range(m):\n p,s = input().split()\n p = int(p) - 1\n if number[p]!=1:\n if s == "WA":\n number[p]+=1\n elif s == "AC":\n ac+=1\n wa+=number[p]\n number[p]=-1\nprint(ac,wa)', 'n,m = map(int,input().split())\nac,wa = 0,0\nnumber=[0]*n\n\nfor _ in range(m):\n p,s = input().split()\n p = int(p) - 1\n if number[p]!=1:\n if s == "WA":\n number[p]+=1\n elif s == "AC":\n ac+=1\n wa+=number[p]\n number[p]=-1\nprint(ac,wa)', 'n,m = map(int,input().split())\nac,wa = 0,0\nnumber=[0]*N\n\nfor m in range(m):\n p,s = input().split()\n p = int(p) - 1\n if number[p]!=1:\n if s == "WA":\n number[p]+=1\n elif s == "AC":\n ac+=1\n wa+=number[p]\n number[p]=-1\nprint(ac,wa)', 'n,m = map(int,input().split())\nac,wa = 0,0\nnumber=[0]*n\n\nfor i in range(m):\n p,s = input().split()\n p = int(p) - 1\n if number[p]!=-1:\n if s == "WA":\n number[p]+=1\n elif s == "AC":\n ac+=1\n wa+=number[p]\n number[p]=-1\nprint(ac,wa)']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s484567748', 's537586744', 's598472203', 's545673631']
[3828.0, 3828.0, 3064.0, 3828.0]
[298.0, 296.0, 17.0, 289.0]
[256, 256, 256, 257]
p02802
u569272329
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 = [False for i in range(0, N)]\nfor i in range(0, M):\n x, y = map(str, input().split())\n P.append(int(x-1))\n S.append(y)\nans = [0, 0]\nfor i in range(0, M):\n if flag[P[i]]:\n continue\n else:\n if S[i] == 'AC':\n flag[P[i]] = True\n ans[0] += 1\n else:\n ans[1] += 1\nprint(*ans)\n", "N, M = map(int, input().split())\nP = []\nS = []\nflag = [False for i in range(0, N)]\nfor i in range(0, M):\n x, y = map(str, input().split())\n P.append(int(x)-1)\n S.append(y)\nans = [0, 0]\nwa = [0 for i in range(0, N)]\nfor i in range(0, M):\n if not flag[P[i]]:\n if S[i] == 'AC':\n flag[P[i]] = True\n ans[0] += 1\n ans[1] += wa[P[i]]\n else:\n wa[P[i]] += 1\nprint(*ans)\n"]
['Runtime Error', 'Accepted']
['s305368680', 's629065670']
[3888.0, 14952.0]
[21.0, 379.0]
[391, 431]
p02802
u572122511
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()))\nsubmits = [[] for i in range(M)]\nfor i in range(M):\n submits[i] = input().split()\n submits[i][0] = int(submits[i][0])\n\nAC_number = [0 for i in range(N)] \nWA_number = [0 for i in range(N)] \nfor i in range(M):\n \n if submits[i][1] == 'AC':\n AC_number[submits[i][0] - 1] = 1\n \n \n if submits[i][1] != 'AC' and AC_number[submits[i][0] - 1] != 1:\n WA_number[submits[i][0] - 1] += 1\n\nAC_count = 0\nWA_count = 0\nfor i in range(N):\n if AC_number[i] == 1:\n AC_count += 1\n WA_count = WA_number[i]\nprint(AC_count, WA_count)\n \n ", "N, M = list(map(int, input().split()))\nsubmits = [[] for i in range(M)]\nfor i in range(M):\n submits[i] = input().split()\n submits[i][0] = int(submits[i][0])\n\nAC_number = [0 for i in range(N)] \nWA_number = [0 for i in range(N)] \nfor i in range(M):\n \n if submits[i][1] != 'AC' and AC_number[submits[i][0] - 1] != 1:\n WA_number[submits[i][0] - 1] += 1\n \n \n if submits[i][1] == 'AC':\n AC_number[submits[i][0] - 1] = 1\n\nAC_count = 0\nWA_count = 0\nfor i in range(N):\n if AC_number[i] == 1:\n AC_count += 1\n WA_count = WA_number[i]\nprint(AC_count, WA_count)\n \n ", "N, M = list(map(int, input().split()))\nsubmits = [[] for i in range(M)]\nfor i in range(M):\n submits[i] = input().split()\n submits[i][0] = int(submits[i][0])\n\nAC_number = [0 for i in range(N)] \nWA_number = [0 for i in range(N)] \nfor i in range(M):\n \n if submits[i][1] != 'AC' and AC_number[submits[i][0] - 1] != 1:\n WA_number[submits[i][0] - 1] += 1\n \n \n if submits[i][1] == 'AC':\n AC_number[submits[i][0] - 1] = 1\n\nAC_count = 0\nWA_count = 0\nfor i in range(N):\n if AC_number[i] == 1:\n AC_count += 1\n WA_count += WA_number[i]\nprint(AC_count, WA_count)\n \n "]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s006710429', 's554880020', 's734701003']
[31508.0, 31508.0, 31508.0]
[346.0, 329.0, 342.0]
[707, 702, 703]
p02802
u572343785
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\nps=[]\npena=[[0,False] for _ in range(n)]\nfor i in range(m):\n ps.append(input().split())\n \nfor i in range(m):\n if pena[int(ps[i][0])][1]==False and ps[i][1]=="WA":\n pena[int(ps[i][0])][0]+=1\n else:\n pena[int(ps[i][0])][1]=True\n\np=[pena[i][0] for i in range(len(pena))]\nt=[pena[i][1] for i in range(len(pena))]\nprint(t.count(True),sum(p))\n', 'n,m=map(int,input().split())\n\nps=[]\npena=[[0,False] for _ in range(n)]\nfor i in range(m):\n ps.append(input().split())\n \nfor i in range(m):\n if pena[int(ps[i][0])-1][1]==False and ps[i][1]=="WA":\n pena[int(ps[i][0])-1][0]+=1\n else:\n pena[int(ps[i][0])-1][1]=True\nans=0\nfor i in range(n):\n if pena[i][1]==True:\n ans+=pena[i][0]\n \nt=[pena[i][1] for i in range(len(pena))]\nprint(t.count(True),ans)\n']
['Runtime Error', 'Accepted']
['s012919808', 's849924768']
[43864.0, 43344.0]
[371.0, 367.0]
[390, 434]
p02802
u573900545
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())\nl = np.zeros((N, 2), dtype = int)\nfor i in range(M):\n p, S = map(str, input().split())\n if S == 'AC':\n l[int(p) - 1, 0] = 1\n else:\n l[int(p) - 1, 1] += 1\nprint(np.sum(l[:, 0]), np.sum(l[l[:, 0] == 1, 1]))", "import numpy as np\nN, M = map(int, input().split())\nl = np.zeros((N, 2), dtype = int)\nfor i in range(M):\n p, S = map(str, input().split())\n if S == 'AC':\n l[int(p) - 1, 0] = 1\n elif S =='WA' and l[int(p) - 1, 0] == 1:\n continue\n else:\n l[int(p) - 1, 1] += 1\nprint(np.sum(l[:, 0]), np.sum(l[l[:, 0] == 1, 1]))"]
['Wrong Answer', 'Accepted']
['s828007820', 's915561611']
[30052.0, 29976.0]
[362.0, 387.0]
[279, 341]
p02802
u577914737
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["N,M = map(int,input().split())\n\nlist = []\nclear = []\nac = 0\nwa = 0\nfor i in range(M):\n a,b=input().split()\n if a not in clear:\n if b == 'AC':\n ac = 1\n clear.append(a)\n elif b != 'AC':\n wa += 1\n \nprint(str(ac) + ' ' + str(wa))", "N,M = map(int,input().split())\n\nAC = [0 for i in range(N+1)]\nWA = [0 for i in range(N+1)]\n\nfor i in range(M):\n a,b=input().split()\n a2 = int(a)\n if b == 'AC':\n AC[a2 - 1] = 1\n elif b == 'WA' and AC[a2 - 1] == 0:\n WA[a2-1]+= 1\n\nans_WA = 0\nfor i, j in zip(WA, AC):\n ans_WA += i * j\n \nprint(sum(AC), ans_WA)"]
['Wrong Answer', 'Accepted']
['s967231659', 's789512425']
[10124.0, 10400.0]
[2206.0, 207.0]
[265, 328]
p02802
u578462133
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\nk = [""] * M\n\nfor i in range(M):\n p[i], k[i] = input().split()\n p[i] = int(p[i])\n \n\nans = [0]*N\npen = [0]*N\naccept = 0\npena = 0\nfor i in range(M):\n if k[i] == "WA" and ans[p[i]] == 0:\n pen[p[i]] += 1\n elif k[i] == "AC" and ans[p[i]] == 0:\n pena += pen[p[i]]\n ans[p[i]] = 1\n accept += 1\n \nprint(str(accept) + " " + str(pena))', 'N, M = map(int, input().split())\n\np = [0] * M\nk = [""] * M\n\nfor i in range(M):\n p[i], k[i] = input().split()\n p[i] = int(p[i])-1\n \n\nans = [0]*N\npen = [0]*N\naccept = 0\npena = 0\nfor i in range(M):\n if k[i] == "WA" and ans[p[i]] == 0:\n pen[p[i]] += 1\n elif k[i] == "AC" and ans[p[i]] == 0:\n pena += pen[p[i]]\n ans[p[i]] = 1\n accept += 1\n \nprint(str(accept) + " " + str(pena))']
['Runtime Error', 'Accepted']
['s559364863', 's314219373']
[14836.0, 14836.0]
[288.0, 319.0]
[418, 422]
p02802
u580316619
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(input().split()) for _ in range(m)]\np=sorted(p)\na=0\nac=wa=0\nf=True\n\nfor pr in p:\n\tif int(pr[0])!=a:\n\t\tf=True\n\t\tif f:\n\t\t\tif pr[1]=='WA':\n\t\t\t\twa+=1\n\t\t\t\ta=int(pr[0])\n\t\t\telse:\n\t\t\t\tac+=1\n\t\t\t\ta=int(pr[0])\n\t\t\t\tf=False\n\telse:\n\t\tif f:\n\t\t\tif pr[1]=='WA':\n\t\t\t\twa+=1\n\t\t\t\ta=int(pr[0])\n\t\t\telse:\n\t\t\t\tac+=1\n\t\t\t\ta=int(pr[0])\n\t\t\t\tf=False\nprint(ac, wa)", "n,m=map(int,input().split())\na=[0]*n\nb=[0]*n\nac=wa=0\n\nfor i in range(m):\n\tp,s=input().split()\n\tp=int(p)-1\n\tif s[0]=='A' and a[p]==0:\n\t\ta[p]=1\n\t\tac+=1\n\t\twa+=b[p]\n\telif s[0]=='W':\n\t\tb[p]+=1\nprint(ac, wa)"]
['Wrong Answer', 'Accepted']
['s792514575', 's623317336']
[27128.0, 4596.0]
[467.0, 283.0]
[370, 201]
p02802
u583507988
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+1)\nwa=0\nfor i in range(m+1):\n p,c=input().split()\n if c=='AC' and ac[int(p)]==0:\n ac[int(p)]=1\n elif c=='WA' and ac[int(p)]==0:\n wa+=1\nprint(ac.count(1),wa)", "n,m=map(int,input().split())\nac=[0]*(n+1)\nwa=0\nfor i in range(m):\n p,c=input().split()\n if c=='AC' and ac[int(p)]==0:\n ac[int(p)]=1\n elif c=='WA' and ac[int(p)]==0:\n ac[int(p)]-=1\n elif c=='AC' and ac[int(p)]<0:\n wa+=abs(ac[int(p)])\nprint(ac.count(1),wa)", "n,m=map(int,input().split())\nac=[0]*(n+1)\nwa=0\nfor i in range(m):\n p,c=input().split()\n if c=='AC' and ac[int(p)]==0:\n ac[int(p)]=1\n elif c=='WA' and ac[int(p)]==0:\n ac[int(p)]-=1\n elif c=='AC' and ac[int(p)]<0:\n wa+=abs(ac[int(p)])\n wa=1\nprint(ac.count(1),wa)", "n,m=map(int,input().split())\nac=[0]*(n+1)\nwa=0\nfor i in range(m):\n p,c=input().split()\n if c=='WA' and ac[int(p)]!=1:\n ac[int(p)]-=1\n elif c=='AC' and ac[int(p)]!=1:\n wa+=abs(ac[int(p)])\n ac[int(p)]=1\nprint(ac.count(1),wa)"]
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s044282251', 's145493197', 's412872071', 's248071428']
[9316.0, 9660.0, 9652.0, 9348.0]
[197.0, 185.0, 186.0, 217.0]
[204, 267, 276, 234]
p02802
u591016708
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.
['\ndef solve(N, M, A):\n\n Unsolve = [0]*(N+1)\n Solved = []\n ac = 0\n wa = 0\n for i in range(M):\n if A[i][0] not in Solved:\n if A[i][1] == \'WA\':\n Unsolve[A[i][0]] += 1\n elif A[i][1] == \'AC\':\n Solved.append(A[i][0])\n wa += Unsolve[A[i][0]]\n ac += 1\n return ac, wa\n\ndef main():\n N, M = map(int, input().split())\n A = [list(x for x in input().split()) for _ in range(M)]\n ans = solve(N, M, A)\n print(*ans)\n\nif __name__ == "__main__":\n main()', '\ndef solve(N, M, A):\n\n A = [[int(x[0]), x[1]] for x in A]\n\n Unsolve = [0]*(N+1)\n Solved = set()\n ac = 0\n wa = 0\n for i in range(M):\n if A[i][0] not in Solved:\n if A[i][1] == \'WA\':\n Unsolve[A[i][0]] += 1\n elif A[i][1] == \'AC\':\n Solved.add(A[i][0])\n wa += Unsolve[A[i][0]]\n ac += 1\n\n return ac, wa\n\ndef main():\n N, M = map(int, input().split())\n A = [list(x for x in input().split()) for _ in range(M)]\n ans = solve(N, M, A)\n print(*ans)\n\nif __name__ == "__main__":\n main()']
['Runtime Error', 'Accepted']
['s257473591', 's535322711']
[32896.0, 49460.0]
[352.0, 437.0]
[555, 596]
p02802
u592035627
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N,M = [int(x) for x in input().split()]\nimport collections\ns = []\nfor i in range(M):\n array = list(map(str,input().split()))\n s.append(array)\na = 0\nb = 0\nc = 0\nt = []\nfor i in range(M):\n t.append(s[i][0])\nd = collections.Counter(t)\n#print(len(d))\nfor j in range(len(d)):\n for i in range(1,M):\n if s[i-1][0] == s[i][0]:\n if s[i-1][1] == "WA":\n b = b + 1\n else:\n a = a + 1\n break\n else:\n if s[i-1][1] == "AC":\n a = a + 1\n else:\n b = b + 1\nprint(str(a) + " " + str(b))', 'N,M = [int(x) for x in input().split()]\ns = []\nfor i in range(M):\n array = list(map(str,input().split()))\n s.append(array)\n\nanswer = 0\npenalty = 0\n\nWA = [0 for i in range(N)]\n#print(t)\nfor i in range(M):\n if WA[int(s[i][0])-1] != "AC":\n if s[i][1] == "WA":\n WA[int(s[i][0])-1] += 1\n else:\n penalty += WA[int(s[i][0])-1]\n answer += 1\n WA[int(s[i][0])-1] = "AC"\n #print(WA)\nprint(answer,penalty)']
['Wrong Answer', 'Accepted']
['s138719078', 's667254671']
[42576.0, 32976.0]
[2106.0, 451.0]
[610, 463]
p02802
u594803920
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.
["x, y = map(int, input().split())\nli = []\nk = 0 \nfor _ in range(y):\n a, b = map(str, input().split())\n if b == 'AC':\n if a in li:\n continue\n else:\n li.append(a)\n elif b == 'WA':\n if a in li:\n continue\n else:\n k += 1\ns = 0\nfor _ in dd:\n s += 1\n \nprint(s, k)", "x, y = map(int, input().split())\ndd = {}\nc = 0 \np = 0 \nfor i in range(x):\n dd[i+1] = 0\nfor _ in range(y):\n a, b = map(str, input().split())\n a = int(a)\n if b == 'WA':\n if dd[a] == 'o':\n continue\n else:\n dd[a] += 1\n else:\n if dd[a] == 'o':\n continue\n else:\n c += dd[a]\n p += 1\n dd[a] = 'o'\n \nprint(p, c)"]
['Runtime Error', 'Accepted']
['s579381034', 's139399034']
[3932.0, 15084.0]
[2104.0, 379.0]
[366, 441]
p02802
u596297663
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 \narS = [False] * (n+1)\n \nscore = 0\npenalty = 0\nfor i in range(m):\n\tid, res = input().split()\n\tid = int(id)\n#\tprint(type(id),type(res))\n\tif (res == "AC") and (arS[id]==False):\n\t\tarS[id] = True\n\t\tscore = score+1\n\tif (res == "WA"): \n\t\tpenalty = penalty + 1\n \nprint(score, penalty)', 'n,m = map(int, input().split())\n\narS = [0] * 100000\n#arP = [0] * 100000\n\nscore = 0\npenalty = 0\nfor i in range(m):\n\tid, res = input().split()\n\tid = int(id)\n\tif res == "AT" and arS[id]==0:\n\t\tarS[id] = 1\n\t\tscore = score+1\n\tif res =="WA": \n#\t\tarP[id] = arP[id] + 1\n\t\tpenalty = penalty + 1\nprint(score, penalty)', 'n,m = map(int, input().split())\n\narS = [0] * 100000\n\nscore = 0\npenalty = 0\n\nfor i in range(m):\n\tid, res = input().split()\n\tid = int(id)\n\tif res == "AT" and arS[id]==0:\n\t\tarS[id] = 1\n\t\tscore = score + 1\n\tif res =="WA" and arS[id]==0: \n\t\tpenalty = penalty + 1\nprint(score, penalty)', 'n,m = map(int, input().split())\n\narS = [False] * n\n\nscore = 0\npenalty = 0\nfor i in range(m):\n\tid, res = input().split()\n\tid = int(id)\n#\tprint(type(id),type(res))\n\tif (res == "AC") and (arS[id]==False):\n\t\tarS[id] = True\n\t\tscore = score+1\n\tif (res == "WA") and (arS[id]==False): \n\t\tpenalty = penalty + 1\n \nprint(score, penalty)', 'n,m = map(int, input().split())\n \narS = [False] * (n+1)\narP = [False] * (n+1)\n \nscore = 0\npenalty = 0\n\nfor i in range(m):\n\tid, res = input().split()\n\tid = int(id)\n\tif (res == "AC") and (arS[id]==False):\n\t\tarS[id] = True\n\t\tscore = score+1\n penalty = penalty * arP[id]\n\tif (res == "WA"): \n\t\tarP[id] = arP[id] + 1\n \nprint(score, penalty)', 'n,m = map(int, input().split())\n\narS = [0] * 100000\narP = [0] * 100000\n\nscore = 0\npenalty = 0\nfor i in range(m):\n\tid, res = input().split()\n\tid = int(id)\n\tif res == "AT" and arS[id]==0:\n\t\tarS[id] = 1\n\t\tscore = score+1\n\tif res =="WA": \n\t\tarP[id] = arP[id] + 1\n\t\tpenalty = penalty + 1\nprint(score, penalty)\n ', 'n,m = map(int, input().split())\n \narS = [False] * (n+1)\n \nscore = 0\npenalty = 0\nfor i in range(m):\n\tid, res = input().split()\n\tid = int(id)\n#\tprint(type(id),type(res))\n\tif (res == "AC") and (arS[id]==False):\n\t\tarS[id] = True\n\t\tscore = score+1\n\tif (res == "WA") # and (arS[id]==False): \n\t\tpenalty = penalty + 1\n \nprint(score, penalty)', 'n,m = map(int, input().split())\n\narS = [0] * 100000\n#arP = [0] * 100000\n\nscore = 0\npenalty = 0\nfor i in range(m):\n\tid, res = input().split()\n\tid = int(id)\n\tif res == "AT" and arS[id]==0:\n\t\tarS[id] = 1\n\t\tscore = score+1\n\tif res =="WA" and arS[id]==0: \n#\t\tarP[id] = arP[id] + 1\n\t\tpenalty = penalty + 1\nprint(score, penalty)\n ', 'n,m = map(int, input().split())\n\narS = [0] * 100000\n\nscore = 0\npenalty = 0\nfor i in range(m):\n\tid, res = input().split()\n\tid = int(id)\n\tif res == "AT" and arS[id]==0:\n\t\tarS[id] = 1\n\t\tscore = score+1\n\tif res =="WA" and arS[id]==0: \n\t\tpenalty = penalty + 1\nprint(score, penalty)', 'n,m = map(int, input().split())\n\narS = [0] * 100\n#arP = [0] * 100000\n\nscore = 0\npenalty = 0\nfor i in range(m):\n\tid, res = input().split()\n\tid = int(id)\n\tif res == "AT" and arS[id]==0:\n\t\tarS[id] = 1\n\t\tscore = score+1\n\tif res =="WA": \n#\t\tarP[id] = arP[id] + 1\n\t\tpenalty = penalty + 1\nprint(score, penalty)', 'n,m = map(int, input().split())\n \narS = [False] * (n+1)\narP = [False] * (n+1)\n \nscore = 0\npenalty = 0\n\nfor i in range(m):\n\tid, res = input().split()\n\tid = int(id)\n\tif (res == "AC") and (arS[id]==False):\n\t\tarS[id] = True\n\t\tscore = score+1\n\t\tpenalty = penalty + arP[id]\n\tif (res == "WA"): \n\t\tarP[id] = arP[id] + 1\n \nprint(score, penalty)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s085173752', 's264316189', 's350739080', 's462380139', 's600147671', 's617990865', 's620678730', 's857606973', 's890201226', 's990718662', 's939872206']
[3828.0, 3828.0, 3956.0, 3828.0, 2940.0, 4596.0, 2940.0, 3828.0, 3828.0, 3060.0, 4596.0]
[275.0, 252.0, 252.0, 268.0, 17.0, 277.0, 17.0, 269.0, 263.0, 258.0, 283.0]
[317, 306, 279, 332, 348, 309, 341, 326, 276, 303, 342]
p02802
u599114793
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 = [False]*n\nfor i in range(m):\n p,s = map(str,input().split())\n if s == "AC":\n ac[int(p)-1] = True\n else:\n if not ac[int(p)-1]:\n wa[int(p)-1] += 1\nac_num = 0\nfor i in range(n):\n if ac[i]: ac_num += 1\nprint(ac_num)\nprint(sum(wa))\n', 'n,m = map(int,input().split())\nwa = [0]*n\nac = [False]*n\nfor i in range(m):\n p,s = map(str,input().split())\n if s == "AC":\n ac[int(p)-1] = True\n else:\n if not ac[int(p)-1]:\n wa[int(p)-1] += 1\nac_num = 0\nwa_num = 0\nfor i in range(n):\n if ac[i]:\n ac_num += 1\n wa_num += wa[i]\nprint(ac_num, wa_num)\n\n']
['Wrong Answer', 'Accepted']
['s666037535', 's195578245']
[4596.0, 4596.0]
[355.0, 367.0]
[311, 348]
p02802
u600261652
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 = []\ncount = [0]*N\nAC = 0\nWA = 0\nfor _ in range(M):\n p, s = input().split()\n if s == "WA":\n WA += 1\n elif count[int(p)-1] == 0 and s == "AC":\n AC += 1\n count[int(p)-1] = 1\nprint(AC, WA)', 'N, M = map(int, input().split())\ncount = [0]*N\nans = 0\nok = 1\nfor _ in range(M):\n p, s = input().split()\n if count[int(p)-1] >= 0 and s == "WA":\n count[int(p) - 1] += 1\n elif count[int(p)-1] >= 0 and s == "AC":\n ans += count[int(p)-1]\n count[int(p)-1] = -1\n ok += 1\nprint(ok, ans)', 'N, M = map(int, input().split())\ncount = [0]*N\nans = 0\nok = 0\nfor _ in range(M):\n p, s = input().split()\n if count[int(p)-1] >= 0 and s == "WA":\n count[int(p) - 1] += 1\n elif count[int(p)-1] >= 0 and s == "AC":\n ans += count[int(p)-1]\n count[int(p)-1] = -1\n ok += 1\nprint(ok, ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s129680536', 's614092246', 's976978385']
[9596.0, 9692.0, 9528.0]
[198.0, 240.0, 237.0]
[257, 317, 317]
p02802
u600402037
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["import sys\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\n\nN, M = lr()\nproblems = [False] * N\nAC = [0] * N\nWA = [0] * N\nfor _ in range(M):\n p, S = sr().split(); p = int(p) - 1\n if not problems[p] and S == 'WA':\n WA[p] += 1\n if not problems[p] and S == 'AC':\n problems[p] = True\n AC += 1\n\nAC_total = sum(AC)\nWA_total = sum(y for x, y in zip(AC, WA) if x)\nprint(AC_total, WA_total)\n", "import sys\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\n\nN, M = lr()\nproblems = [False] * N\nAC = [0] * N\nWA = [0] * N\nfor _ in range(M):\n p, S = sr().split(); p = int(p) - 1\n if not problems[p] and S == 'WA':\n WA[p] += 1\n if not problems[p] and S == 'AC':\n problems[p] = True\n AC[p] += 1\n\nAC_total = sum(AC)\nWA_total = sum(y for x, y in zip(AC, WA) if x)\nprint(AC_total, WA_total)\n"]
['Runtime Error', 'Accepted']
['s548061633', 's430810928']
[5364.0, 5364.0]
[148.0, 180.0]
[472, 475]
p02802
u601575292
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\na = [0]*(N+1)\nw = [0]*(N+1)\nac = 0\nwa = 0\nfor i in range(M):\n\tp, S = input().split()\n\tp = int(p)\n\tprint(p, S)\n\tif a[p] == 0:\n\t\tif S == "AC":\n\t\t\ta[p] += 1\n\t\t\tac += 1\n\t\telse:\n\t\t\tw[p] += 1\n\t\t\twa += 1\n\telse:\n\t\tcontinue\nprint(ac, wa)', 'N, M = map(int, input().split())\n\nac_chk = [0]*(N+1)\nwa_chk = [0]*(N+1)\nwa = 0\nac = 0\n\nfor i in range(M):\n\tp, S = input().split()\n\tp = int(p)\n\tif ac_chk[p] == 0:\n\t\tif S == "AC":\n\t\t\tac_chk[p] = 1\n\t\t\tac += 1\n\t\t\twa += wa_chk[p]\n\t\t\tcontinue\n\t\tif S == "WA":\n\t\t\twa_chk[p] += 1\n\t\t\tcontinue\n\telse:\n\t\tcontinue\nprint(ac, wa)']
['Wrong Answer', 'Accepted']
['s706759818', 's279980873']
[5492.0, 4596.0]
[838.0, 272.0]
[262, 314]
p02802
u604874738
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())\nlists = [list(map(str, input().split())) for i in range(M)]\n\ndict_ac = {}\ndict_wa = {}\nnumber = True\n\nfor i, j in lists:\n if j == "WA":\n if number:\n if i not in dict_wa.keys():\n dict_wa[i] = 1\n number = False\n else:\n continue\n elif i in dict_wa.keys():\n dict_wa[i] += 1\n else:\n continue\n elif j == "AC":\n if i not in dict_ac.keys():\n dict_ac[i] = 1\n number = True\n else:\n dict_ac[i] = 1\n number = True\n else:\n continue\n\n\n\n\nfor i in dict_ac.keys():\n for j in dict_wa.keys():\n if i == j:\n continue\n else:\n dict_wa[j] = 0\n\n\n\n\nprint(sum(dict_ac.values()), sum(dict_wa.values()))', 'N, M = map(int, input().split())\nlists = [list(map(str, input().split())) for i in range(M)]\n# print(lists)\n\ndict_ac = {i:0 for i in range(N)}\ndict_wa = {i:0 for i in range(N)}\n# print(dict_ac)\n# print(dict_wa)\nnumber = True\nindex = 0\nfor i, j in lists:\n\n if j == "WA":\n i = int(i) - 1\n if dict_ac[i] == 0:\n dict_wa[i] += 1\n\n elif j == "AC":\n if i not in dict_ac.keys():\n i = int(i) - 1\n dict_ac[i] = 1\n\n\n\n\n\n\nfor i in dict_wa.keys():\n if dict_ac[i] == 0:\n dict_wa[i] = 0\n else:\n continue\n\n\n\n\nprint(sum(dict_ac.values()), sum(dict_wa.values()))']
['Wrong Answer', 'Accepted']
['s180290606', 's861097935']
[41480.0, 56460.0]
[1075.0, 422.0]
[918, 711]
p02802
u606090886
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 P,S = map(str,input().split())\n p.append(int(P))\n s.append(S)\nBool = [0 for i in range(n)]\ncount = [0 for i in range(n)]\n\nfor i in range(m):\n if not Bool[p[i]-1]:\n if s[i] == "WA":\n count[p[i]-1] += 1\n else:\n Bool[p[i]-1] = 1\nans = 0\nfor i in range(m):\n if Bool[p[i]-1]:\n ans += count[p[i]-1]\n\nprint(sum(Bool),ans)', 'n,m = map(int,input().split())\np = []\ns = []\nfor i in range(m):\n P,S = map(str,input().split())\n p.append(int(P))\n s.append(S)\nBool = [0 for i in range(n)]\ncount = [0 for i in range(n)]\n\nfor i in range(m):\n if not Bool[p[i]-1]:\n if s[i] == "WA":\n count[p[i]-1] += 1\n else:\n Bool[p[i]-1] = 1\nans = 0\nfor i in range(n):\n if Bool[i]:\n ans += count[i]\n\nprint(sum(Bool),ans)']
['Wrong Answer', 'Accepted']
['s226152588', 's714329338']
[15004.0, 14972.0]
[373.0, 357.0]
[437, 427]
p02802
u606146341
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.
["lst = []\nn, m = map(int, input().split())\nfor _ in range(m):\n i, h = input().split()\n lst.append([int(i), str(h)])\n\njdg_wa = [0] * n \njdg_ac = [0] * n\n\nfor _ in lst:\n if _[1] == 'WA' and jdg_ac[_[0]] == 0:\n jdg_wa[_[0]] += 1\n if _[1] == 'AC' and jdg_ac[_[0]] == 0:\n jdg_ac[_[0]] = 1\n\nprint(sum(jdg_ac),sum(jdg_wa))", "lst = []\nn, m = map(int, input().split())\nfor _ in range(m):\n i, h = input().split()\n lst.append([int(i), str(h)])\n\njdg_wa = [0] * n \njdg_ac = [0] * n\n\nfor _ in lst:\n idx = _[0] - 1\n if _[1] == 'WA' and jdg_ac[idx] != 1:\n jdg_wa[idx] += 1\n elif _[1] == 'AC':\n jdg_ac[idx] = 1\n penalty += jdg_wa[idx]\n \nprint(sum(jdg_ac),penalty)", "lst = []\nn, m = map(int, input().split())\nfor _ in range(m):\n i, h = input().split()\n lst.append([int(i), str(h)])\n\njdg_wa = [0] * n \njdg_ac = [0] * n\n\npenalty = 0\nfor _ in lst:\n idx = _[0] - 1\n if jdg_ac[idx] != 1:\n if _[1] == 'WA':\n jdg_wa[idx] += 1\n elif _[1] == 'AC':\n jdg_ac[idx] = 1\n penalty += jdg_wa[idx]\nprint(sum(jdg_ac), penalty)\n"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s359920195', 's554094948', 's909256075']
[23552.0, 23456.0, 23456.0]
[324.0, 315.0, 327.0]
[341, 372, 403]
p02802
u608053762
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 = [[i for i in input().split()] for j in range(m)]\n\nac_list = []\nwa_dict = {}\nnum_wa = 0\n\nfor ps in ps_list:\n p = int(ps[0])\n s = ps[1]\n \n if s == 'AC':\n ac_list.append(p)\n num_wa += wa_dict[p]\n elif p not in ac_list:\n if p not in wa_dict.keys():\n wa_dict[p] = 1\n else:\n wa_dict[p] += 1\n \nprint(num_ac, num_wa)", "n, m = map(int, input().split())\nps_list = [[i for i in input().split()] for j in range(m)]\n\nac_list = []\nwa_list = [0 for i in range(n)]\nnum_wa = 0\nnum_ac = 0\n\nfor ps in ps_list:\n p = int(ps[0])\n s = ps[1]\n \n if s == 'AC' and wa_list[p-1] != -1:\n ac_list.append(p)\n num_wa += wa_list[p-1]\n num_ac += 1\n wa_list[p-1] = -1\n elif wa_list[p-1] != -1:\n wa_list[p-1] += 1\n \nprint(num_ac, num_wa)"]
['Runtime Error', 'Accepted']
['s063024454', 's407509721']
[25832.0, 30756.0]
[308.0, 334.0]
[424, 447]
p02802
u614162316
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\nl=[0 for i in range(n)]\nw=0\nww=0\na=0\nt=""\nfor i in range(m):\n p,s=input().split()\n if(l[int(p)-1]==1):continue\n if(t!=p):ww=0\n if(s=="WA"):\n ww+=1\n if(s=="AC"):\n w+=0\n a+=1\n l[int(p)-1]=1\n t=p\nprint(a,w-ww)', 'n,m=map(int,input().split())\n\nl=[0 for i in range(n)]\nt=""\nw=0\nww=0\na=0\nfor i in range(m):\n p,s=input().split()\n if(l[int(p)-1]==1):continue\n if(s=="WA"):\n w+=1\n ww+=1\n if(s=="AC"):\n ww=0\n a+=1\n l[int(p-1)]=1\nprint(a,w-ww)', 'n,m=map(int,input().split())\n\nl=[0 for i in range(n)]\nll=[0 for i in range(n)]\nw=0\na=0\nfor i in range(m):\n p,s=input().split()\n if(l[int(p)-1]==1):continue\n if(s=="WA"):ll[int(p)-1]+=1\n if(s=="AC"):\n l[int(p)-1]=1\n w+=ll[int(p)-1]\n a+=1\nprint(a,w)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s038809666', 's531960652', 's016860583']
[3964.0, 3888.0, 4656.0]
[318.0, 261.0, 333.0]
[282, 269, 280]
p02802
u614181788
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())\nx=['0']*m\ny=['0']*m\nfor i in range(m):\n x[i],y[i] = map(str,input().split())\n\nnum = 0\npena = 0\n\nlis=[0]*(n+1)\nlis2=[0]*n\nlis3=[0]*n\nsw = [0]*n\n\nfor i in range(m):\n if y[i] == 'WA' and sw[int(x[i])]== 0:\n lis[int(x[i])] += 1\n else:\n lis2[int(x[i])] = 1\n sw[int(x[i])] = 1\n \npena = sum(lis)\nnum = sum(lis2)\n\nprint(num,pena)", "n,m = map(int,input().split()) \nx=['0']*m \ny=['0']*m \nfor i in range(m): \n x[i],y[i] = map(str,input().split())\n\nnum = 0 \npena = 0\n\nlis=[0]*n \nsw = [0]*n\n\nfor i in range(m): \n if y[i] == 'WA':\n lis[int(x[i])-1] += 1\n else:\n if sw[int(x[i])-1] == 0:\n num += 1\n pena = pena + lis[int(x[i])-1]\n sw[int(x[i])-1] = 1\n\n else:\n pass\n \nprint(num,pena)"]
['Runtime Error', 'Accepted']
['s072448399', 's836543818']
[18768.0, 17228.0]
[340.0, 379.0]
[389, 424]