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
p02801
u959564194
2,000
1,048,576
Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.
['N, M = input().split(" ")\n\nidxw = {}\nidxa = {}\n\nfor i in range(int(M)):\n p, s = input().split(" ")\n if not (\'{}{}\'.format(p,s) in idxa):\n if s == \'AC\':\n idxa[\'{}{}\'.format(p, s)] = True\n if not (\'{}{}\'.format(p,s) in idxw):\n if not (\'{}{}\'.format(p,\'AC\') in idxa):\n if s == \'WA\':\n idxw[\'{}{}\'.format(p, s)] = True\n#print(idxw)\n#print(idxa)\n\nprint(\'{} {}\'.format(len(idxa), len(idxw)))\n ', 'C = input()\n\na = \'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,v,x,y,z\'\n\narr = a.split(",")\n\nidx = 0\ncount = 0\n\nfor i in arr:\n if i == C:\n idx = count\n count += 1\n \nprint(arr[idx+1])']
['Runtime Error', 'Accepted']
['s841763828', 's804763470']
[3064.0, 3060.0]
[17.0, 17.0]
[413, 187]
p02801
u964521959
2,000
1,048,576
Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.
['C = input()\nprint chr(ord(C) + 1)', 'C = input()\nprint(chr(ord(C) + 1))']
['Runtime Error', 'Accepted']
['s507148362', 's314016823']
[2940.0, 2940.0]
[17.0, 17.0]
[33, 34]
p02801
u965436898
2,000
1,048,576
Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.
["list_alpha = [chr(ord('a') + i) for i in range(26)]\nc = input()\nindex = list_alpha.find(c)\nprint(list_alphs[index + 1])", "list_alpha = [chr(ord('a') + i) for i in range(26)]\nc = input()\nindex = list_alpha.index(c)\nprint(list_alpha[index + 1])"]
['Runtime Error', 'Accepted']
['s830623608', 's188282738']
[2940.0, 2940.0]
[17.0, 17.0]
[119, 120]
p02801
u968846084
2,000
1,048,576
Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.
['n=int(input())\nx=[0]*n\ny=[0]*n\nfor i in range(n):\n x[i],y[i]=map(int,input().split())\nif n==2:\n print(((x[0]-x[1])**2+(y[0]-y[1])**2)**(1/2)/2)\nelse:\n ans=10**5\n A=[0]*3\n B=[0]*3\n for i in range(n-2):\n for j in range(i+1,n-1):\n A[0]=x[j]-x[i]\n A[1]=y[j]-y[i]\n A[2]=A[0]*(x[i]+x[j])/2+A[1]*(y[i]+y[j])/2\n for k in range(j+1,n):\n B[0]=x[k]-x[i]\n B[1]=y[k]-y[i]\n B[2]=B[0]*(x[i]+x[k])/2+B[1]*(y[i]+y[k])/2\n if A[0]*B[1]==A[1]*B[0] and A[0]*B[1]!=0:\n r=((max(x[i],x[j],x[k])-min(x[i],x[j],x[k]))**2+(max(y[i],y[j],y[k])-min(y[i],y[j],y[k]))**2)**(1/2)/2\n xc=(max(x[i],x[j],x[k])+min(x[i],x[j],x[k]))/2\n yc=(max(y[i],y[j],y[k])+min(y[i],y[j],y[k]))/2\n elif A[0]==B[0]==0:#2\n r=(max(y[i],y[j],y[k])-min(y[i],y[j],y[k]))/2\n xc=x[i]\n yc=(max(y[i],y[j],y[k])+min(y[i],y[j],y[k]))/2\n elif A[1]==B[1]==0:#3\n r=(max(x[i],x[j],x[k])-min(x[i],x[j],x[k]))/2\n yc=y[i]\n xc=(max(x[i],x[j],x[k])+min(x[i],x[j],x[k]))/2\n else:\n xc=(A[2]*B[1]-A[1]*B[2])/(A[0]*B[1]-A[1]*B[0])\n yc=(A[0]*B[2]-A[2]*B[0])/(A[0]*B[1]-A[1]*B[0])\n r=((x[i]-xc)**2+(y[i]-yc)**2)**(1/2)\n aa=0\n r=min(r*1.000000999,r+0.000000999)\n for l in range(n):\n if ((x[l]-xc)**2+(y[l]-yc)**2)**(1/2)>r:\n aa=1\n if aa==0:\n if r<ans:\n ans=r\n print(ans)', 'print(chr(ord(input())+1))']
['Runtime Error', 'Accepted']
['s160760902', 's559154217']
[3320.0, 2940.0]
[18.0, 17.0]
[1481, 26]
p02801
u969708690
2,000
1,048,576
Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.
['N=input()\nL=[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z]\nprint(L[L.index(N)+1])', 'N=input()\nL=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]\nprint(L[L.index(N)+1]) ']
['Runtime Error', 'Accepted']
['s926044223', 's172071066']
[2940.0, 2940.0]
[17.0, 17.0]
[88, 142]
p02801
u969848070
2,000
1,048,576
Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.
["list1 = [chr(i) for i in range(97, 97+26)]\ni = input()\nprint(list1[list1.index('i')+1])", 'list1 = [chr(i) for i in range(97, 97+26)]\ni = input()\nprint(list1[list1.index(i)+1])']
['Wrong Answer', 'Accepted']
['s125741284', 's758655925']
[2940.0, 2940.0]
[17.0, 16.0]
[87, 85]
p02801
u971096161
2,000
1,048,576
Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.
['n,k,m = map(int, input().split())\na = input().split()\na = [int(_a) for _a in a]\nans = m*n - sum(a)\nif ans >= k:\n ans = -1\nprint(ans)', "C = input()\n\nans = ''\nfor i in range(26):\n if chr(ord('a') + i) == C:\n ans = chr(ord('a') + i + 1)\n \nprint(ans)\n"]
['Runtime Error', 'Accepted']
['s784621537', 's725286068']
[2940.0, 2940.0]
[19.0, 17.0]
[133, 119]
p02801
u973744316
2,000
1,048,576
Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.
["import sys\ninput = sys.stdin.readline\n\nN, M = map(int, input().split())\nA_list = [input().split() for _ in range(M)]\n\nwa_count, ac_count = 0, 0\nWA_List = {} # {prob_id: wa_count}\nAC_list = [] # [prob_id]\n\nfor i in range(M):\n if A_list[i][1] == 'AC':\n if not A_list[i][0] in AC_list:\n if A_list[i][0] in WA_List:\n wa_count += WA_List[A_list[i][0]]\n ac_count += 1\n AC_list.append(A_list[i][0])\n else:\n if A_list[i][0] in WA_List:\n WA_List[A_list[i][0]] += 1\n else:\n WA_List[A_list[i][0]] = 1\n\nprint(ac_count, wa_count)\n", "from sys import stdin\n\n\nN, M = map(int, stdin.readline().rstrip().split())\nA_list = [stdin.readline().rstrip().split() for _ in range(M)]\n\nwa_count, ac_count = 0, 0\nWA_List = {} # {prob_id: wa_count}\nAC_list = [] # [prob_id]\n\nfor i in range(M):\n if A_list[i][1] == 'AC':\n if not A_list[i][0] in AC_list:\n if A_list[i][0] in WA_List:\n wa_count += WA_List[A_list[i][0]]\n ac_count += 1\n AC_list.append(A_list[i][0])\n else:\n if A_list[i][0] in WA_List:\n WA_List[A_list[i][0]] += 1\n else:\n WA_List[A_list[i][0]] = 1\n\nprint(ac_count, wa_count)\n", 'C = str(input())\n\nprint(chr(ord(C) + 1))\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s704350468', 's753062153', 's125090166']
[3064.0, 3064.0, 2940.0]
[17.0, 17.0, 17.0]
[616, 637, 41]
p02801
u982944976
2,000
1,048,576
Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.
['n = input()\nif n == "a":\n print("b")\nif n == "b":\n print("c")\nif n == "c":\n print("d")\nif n == "d":\n print("e")\nif n == "e:"\n print("f")\nif n == "f":\n print("g")\nif n == "g":\n print("h")\nif n =="h":\n print("i")\nif n == "i":\n print("j")\nif n == "j":\n print("k")\nif n == "k":\n print("l")\nif n == "l":\n print("m")\nif n == "m":\n print("n")\nif n == "n":\n print("o")\nif n == "o":\n print("p")\nif n == "p":\n print("q")\nif n == "q":\n print("r")\nif n == "r":\n print("s")\nif n == "s":\n print("t")\nif n == "t":\n print("u")\nif n == "u":\n print("v")\nif n == "v":\n print("w")\nif n == "w":\n print("x")\nif n == "x":\n print("y")\nif n == "y":\n print("z")\nif n == "z":\n print("a")', 'n = input()\nif n == "a":\n print("b")\nif n == "b":\n print("c")\nif n == "c":\n print("d")\nif n == "d":\n print("e")\nif n == "e":\n print("f")\nif n == "f":\n print("g")\nif n == "g":\n print("h")\nif n =="h":\n print("i")\nif n == "i":\n print("j")\nif n == "j":\n print("k")\nif n == "k":\n print("l")\nif n == "l":\n print("m")\nif n == "m":\n print("n")\nif n == "n":\n print("o")\nif n == "o":\n print("p")\nif n == "p":\n print("q")\nif n == "q":\n print("r")\nif n == "r":\n print("s")\nif n == "s":\n print("t")\nif n == "t":\n print("u")\nif n == "u":\n print("v")\nif n == "v":\n print("w")\nif n == "w":\n print("x")\nif n == "x":\n print("y")\nif n == "y":\n print("z")\nif n == "z":\n print("a")\n']
['Runtime Error', 'Accepted']
['s794879635', 's938848885']
[2940.0, 3064.0]
[18.0, 17.0]
[738, 739]
p02801
u983327168
2,000
1,048,576
Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.
['C=int(input())\nli=[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z]\nprint(li[C+1])', 'C=input()\nli=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]\ncount=li.index(C)\ncount=count+1\nprint(li[count])']
['Runtime Error', 'Accepted']
['s795095276', 's414431032']
[2940.0, 3060.0]
[17.0, 17.0]
[86, 167]
p02802
u006167882
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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()))\ncolect_quest = [0]*N\nWA_quest = [0]*N\nfor i in range(M):\n pi,si = list(map(str,input().split()))\n pi = int(pi)\n if si == "AC":\n colect_quest[pi] = 1\n if si == "WA" and colect_quest[pi] != 1:\n WA_quest[pi] += 1\n \nprint(sum(colect_quest),sum(WA_quest))', 'N,M = list(map(int,input().split()))\ncolect_quest = [0]*N\nWA_quest = [0]*N\nfor i in range(M):\n pi,si = list(map(str,input().split()))\n pi = int(pi)\n if si == "AC":\n colect_quest[pi-1] = 1\n if si == "WA" and colect_quest[pi-1] != 1:\n WA_quest[pi-1] += 1\nWA_count = 0\nfor i in range(len(WA_quest)):\n if colect_quest[i] == 1 :\n WA_count += WA_quest[i] \nprint(sum(colect_quest),WA_count)']
['Runtime Error', 'Accepted']
['s573192435', 's440779051']
[4596.0, 4596.0]
[388.0, 400.0]
[316, 419]
p02802
u006883624
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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(v) for v in input().split()]\n\ncount_map = [0] * m\n\ncount = 0\nmiss = 0\nfor i in range(m):\n\tp, s = input().split()\n \n if count_map[p] == True:\n continue\n \n if s == 'AC':\n\t count_map[p] = True\n count += 1\n else:\n \tmiss += 1\n \nprint(count, miss)\n\n\n", "n, m = [int(v) for v in input().split()]\n\ncount_map = [0] * (n + 1)\nmiss_map = [0] * (n + 1)\n\ncount = 0\nmiss = 0\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n\n if count_map[p]:\n continue\n\n if s == 'AC':\n count_map[p] = True\n count += 1\n miss += miss_map[p]\n else:\n miss_map[p] += 1\n\nprint(count, miss)"]
['Runtime Error', 'Accepted']
['s938599766', 's688041680']
[3064.0, 4596.0]
[30.0, 276.0]
[296, 361]
p02802
u010462426
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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)\ncnt_ac=0\ncnt_wa=0\nfor i in range(m):\n\tp,s=input().split()\n\tp=int(p)\n\tif s=="AC":\n\t\tif\tfac[p]==0:\n\t\t\tcnt_ac+=1\n\t\t\tcnt_wa+=wa[p]\n\t\t\tac[p]=1\n\t\t\n\telse: \n\t\twa[p]+=1\n\nprint(int(cnt_ac),int(cnt_wa))', '[n,m] = [int(x) for x in input().split()]\nac=[0]*(n+1)\nwa=[0]*(n+1)\ncnt_ac=0\ncnt_wa=0\nfor i in range(m):\n\tp,s=input().split()\n\tp=int(p)\n\tif s=="AC":\n\t\tif ac[p]==0:\n\t\t\tcnt_ac+=1\n\t\t\tcnt_wa+=wa[p]\n\t\t\tac[p]=1\n\telse: \n\t\twa[p]+=1\n\nprint(int(cnt_ac),int(cnt_wa))']
['Runtime Error', 'Accepted']
['s565489264', 's986373343']
[4596.0, 4596.0]
[256.0, 282.0]
[259, 255]
p02802
u010870870
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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()))\nlist_WA = [0] * N\nlist_Flag = [0] * N\nfor i in range(M):\n a, b = list(map(int, input().split()))\n if list_Flag[a-1] == 1:\n\tpass\n else:\n if b=='WA':\n list_WA[a-1]=list_WA[a-1]+1\n elif b=='AC':\n list_Flag[a-1]=1\n else:\n pass\nWA=sum(list_WA)\nAC=sum(list_Flag)\nprint(AC,WA)", "import sys\nimport os\nf = open('input.txt', 'r')\nsys.stdin = f\n\nN, M = list(map(int, input().split()))\nlist_WA = [0] * N\nlist_Flag = [0] * N\nfor i in range(M):\n a, b = list(map(str, input().split()))\n a=int(a)\n if list_Flag[a-1] == 1:\n pass\n else:\n if b=='WA':\n list_WA[a-1]=list_WA[a-1]+1\n elif b=='AC':\n list_Flag[a-1]=1\n else:\n pass\nWA=sum(list_WA)\nAC=sum(list_Flag)\nans=[AC,WA]\nprint(' '.join(map(str, ans)))\n", "N, M = list(map(int, input().split()))\nlist_WA = [0]*N\nlist_Flag = [0]*N\nfor i in range(M):\n a, b = list(map(int, input().split()))\n if list_Flag[a-1] == 1:\n\tpass\n else:\n if b=='WA':\n list_WA[a-1]+=1\n elif b=='AC':\n list_Flag[a-1]=1\n else:\n pass\nWA=sum(list_WA)\nAC=sum(list_Flag)\nans=[AC,WA]\nprint(*ans)", "N, M = list(map(int, input().split())) \nlist_WA = [0] * N\nlist_Flag = [0] * N\nfor i in range(M):\n a, b = list(map(int, input().split()))\n if list_Flag[a-1] == 1:\n\tpass\n else:\n if b=='WA':\n list_WA[a-1]=list_WA[a-1]+1\n else:\n list_Flag[a-1]=list_Flag[a-1]+1\nWA=sum(list_WA)\nAC=sum(list_Flag)\nans=[AC,WA]\nprint(' '.join(map(str, ans)))", "N, M = list(map(int, input().split()))\nlist_WA = [0] * N\nlist_Flag = [0] * N\nfor i in range(M):\n a, b = list(map(str, input().split()))\n a=int(a)\n if not list_Flag[a-1] == 1:\n if b=='WA':\n list_WA[a-1]=list_WA[a-1]+1\n elif b=='AC':\n list_Flag[a-1]=1\npenalty = [0] * N\nfor p in range(N):\n penalty[p]=list_WA[p]*list_Flag[p]\nPE=sum(penalty)\nAC=sum(list_Flag)\nprint(AC,PE)"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s045768828', 's049856365', 's151369909', 's506697043', 's893279042']
[2940.0, 3064.0, 2940.0, 2940.0, 5492.0]
[17.0, 18.0, 17.0, 17.0, 402.0]
[335, 445, 330, 429, 391]
p02802
u013582910
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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 r=set()\n x={}\n for _ in range(m):\n p,s=input().split()\n print(p,s)\n if p not in r:\n if s=='WA':\n x[p]=x.setdefault(p,0)+1\n else:\n x[p]=x.setdefault(p,0)\n r.add(p)\n print(len(r),sum(x[p] for p in r)) \n\nmain()", "def main():\n n,m=map(int,input().split())\n r=set()\n x={}\n for _ in range(m):\n p,s=input().split()\n if p not in r:\n if s=='WA':\n x[p]=x.setdefault(p,0)+1\n else:\n x[p]=x.setdefault(p,0)\n r.add(p)\n print(len(r),sum(x[p] for p in r)) \n\nmain()"]
['Wrong Answer', 'Accepted']
['s378046288', 's277954748']
[21192.0, 20480.0]
[793.0, 250.0]
[353, 334]
p02802
u015467545
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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\tac = [0]*N\n\twa = [0]*N\n\tfor i in range(M):\n\t\tp,s = input().split()\n\t\tif s == 'AC':\n\t\t\tif ac[int(p) - 1] != 0:\n\t\t\t\tcontinue\n\t\t\telse:\t\n\t\t\t\tac[int(p) - 1] = 1\n\t\telse:\n\t\t\tif ac[int(p) - 1] != 0:\n\t\t\t\tcontinue\n\t\t\telse:\n\t\t\t\twa[int(p) - 1] += 1\n\tAC,WA = 0,0\n\n\tfor i in range(N):\n\t\tAC += ac[i]\n\t\tif ac[i] >= 1:\n\t\t\tWA += wa[i]\n\tprint(AC,WA)\n\n\n", "N,M = map(int, input().split())\nac = [0]*N\nwa = [0]*N\nfor i in range(M):\n\tp,s = input().split()\n\tif s == 'AC':\n\t\tif ac[int(p) - 1] != 0:\n\t\t\tcontinue\n\t\telse:\t\n\t\t\tac[int(p) - 1] = 1\n\telse:\n\t\tif ac[int(p) - 1] != 0:\n\t\t\tcontinue\n\t\telse:\n\t\t\twa[int(p) - 1] += 1\nAC,WA = 0,0\n\nfor i in range(N):\n AC += ac[i]\n if ac[i] >= 1:\n WA += wa[i]\nprint(AC,WA)"]
['Runtime Error', 'Accepted']
['s541421725', 's418686159']
[3064.0, 4596.0]
[17.0, 304.0]
[370, 347]
p02802
u017415492
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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=[ input().split() for i in range(m)]\nans=[[0,0] for i in range(m+n+1)]\ncount=0\nac=0\nwa=0\n\nfor i in range(m):\n if count!=d[i][0]:\n if ans[count][0]==0 and ans[count][1]>=1:\n ans[count][1]=0\n count=int(d[i][0])\n if d[i][1]=="WA" and ans[count][0]==0:\n ans[count][1]+=1\n elif d[i][1]=="AC" and ans[count][0]==0:\n ans[count][0]+=1\nif ans[count][0]==0 and ans[count][1]>=1:\n ans[count][1]=0\nfor i in range(n+m+1):\n ac+=int(ans[i][0])\n wa+=int(ans[i][1])\nprint(ac,wa)', 'n,m=map(int,input().split())\nd=[ input().split() for i in range(m)]\nans=[[0,0] for i in range(m+n+1)]\ncount=0\nac=0\nwa=0\n\nfor i in range(m):\n if count!=d[i][0]:\n count=int(d[i][0])\n if d[i][1]=="WA" and ans[count][0]==0:\n ans[count][1]+=1\n elif d[i][1]=="AC" and ans[count][0]==0:\n ans[count][0]+=1\nfor i in range(n+m+1):\n ac+=int(ans[i][0])\n if int(ans[i][0])>=1:\n wa+=int(ans[i][1])\nprint(ac,wa)']
['Wrong Answer', 'Accepted']
['s942542222', 's159746122']
[52608.0, 52608.0]
[505.0, 489.0]
[519, 413]
p02802
u020962106
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n,m = map(int,input().split())\nli = list()\nfor i in range(m):\n li.append(input().split())\nprint(li)\nac_cnt=0\nwa_cnt=0\n\ns_ac=set()\nd_wa=dict()\nfor l in li:\n if l[1] == 'WA':\n d_wa[l[0]] = d_wa.get(l[0],0) + 1\n elif l[1] == 'AC':\n if l[0] not in s_ac:\n s_ac.add(l[0])\n ac_cnt +=1\n wa_cnt +=d_wa.get(l[0],0)\n else:\n pass\n\nprint(ac_cnt,wa_cnt)\n ", "n, m = map(int, input().split())\nli = list()\nfor i in range(m):\n li.append(tuple(input().split()))\n \nac_cnt = 0\nwa_cnt = 0\n \ns_ac = set()\nd_wa = dict()\nfor l in li:\n if l[1] == 'AC':\n if l[0] not in s_ac:\n s_ac.add(l[0])\n ac_cnt += 1\n wa_cnt += d_wa.get(l[0], 0)\n else:\n pass\n elif l[1] == 'WA':\n d_wa[l[0]] = d_wa.get(l[0], 0) + 1\n \nprint(ac_cnt, wa_cnt)"]
['Wrong Answer', 'Accepted']
['s037406367', 's980711937']
[40608.0, 27508.0]
[347.0, 297.0]
[374, 429]
p02802
u023229441
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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())\npen=0\nA=[0 for i in range(n)]\nq=[]\nfor i in range(m):\n a,b=map(str,input().split())\n a=int(a)\n q.append([a-1,b])\n if b=="AC":\n A[a-1]=1\nfor i in range(m):\n a,b=q[i]\n if b=="WA" and A[a-1]==1:\n pen+=1\nprint(sum(A),pen)\n', 'n,m=map(int,input().split())\nA=[[0,0] for i in range(m)] \nAC=0\npen=0\nfor i in range(m):\n a,b=map(str,input().split())\n a=int(a)\n if b=="AC":\n A[a-1][0]=1\n elif b=="WA" and A[a-1]==0:\n A[a-1][1]+=1\nfor i in range(n):\n if A[i][0]==1:\n AC+=1\n pen+=A[i][1]\nprint(AC,pen)', 'n,m=map(int,input().split())\nA=[[0,0] for i in range(n)] \nAC=0\npen=0\nfor i in range(m):\n a,b=map(str,input().split())\n a=int(a)\n if b=="AC":\n A[a-1][0]=1\n elif b=="WA" and A[a-1]==0:\n A[a-1][1]+=1\nfor i in range(n):\n if A[i][0]==1:\n AC+=1\n pen+=A[i][1]\nprint(AC,pen)', 'n,m=map(int,input().split())\npen=0\nA=[0 for i in range(n)]\nfor i in range(m):\n a,b=map(str,input().split())\n a=int(a)\n if b=="AC":\n A[a-1]=1\n else:\n pen+=1\nprint(sum(A),pen)', 'n,m=map(int,input().split())\npen=0\nA=[0 for i in range(n)]\nfor i in range(m):\n a,b=map(str,input().split())\n a=int(a)\n if b=="AC":\n A[a-1]=1\nfor i in range(m):\n a,b=map(int,input().split())\n a=int(a)\n if b=="WA" and A[a-1]==1:\n pen+=1\nprint(sum(A),pen)\n', 'n,m=map(int,input().split())\nA=[[0,0] for i in range(n)] \nAC=0\npen=0\nfor i in range(m):\n a,b=map(str,input().split())\n a=int(a)\n if b=="AC":\n A[a-1][0]=1\n elif b=="WA" and A[a-1][0]==0:\n A[a-1][1]+=1\nfor i in range(n):\n if A[i][0]==1:\n AC+=1\n pen+=A[i][1]\nprint(AC,pen)']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s006075719', 's084665761', 's262777786', 's492853759', 's735778633', 's841202274']
[22748.0, 13172.0, 13172.0, 3888.0, 3928.0, 13172.0]
[396.0, 378.0, 382.0, 312.0, 308.0, 404.0]
[259, 329, 329, 183, 265, 332]
p02802
u023762741
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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_line = input()\nLine = input_line.split()\nLine = [int(s) for s in Line]\n\nN = Line[0]\n\nM = Line[1]\n\nAC_Lists = [""]*N\n# print(AC_Lists)\n\nfor i in range(M):\n input_line = input()\n Line = input_line.split()\n print(Line)\n AC_Lists[int(Line[0])-1] += Line[1][0]\n print(AC_Lists)\n\nAC_count = 0\nWA_count = 0\n\nfor s in AC_Lists:\n # print(s)\n if \'A\' in s:\n AC_count += 1\n my_str = s.split("A")\n print(my_str)\n # print(len(my_str[0]))\n WA_count += len(my_str[0])\n else:\n # print(len(s))\n WA_count += len(s)\n# print(AC_Lists)\n\nprint(AC_count,WA_count)\n', 'input_line = input()\nLine = input_line.split()\nLine = [int(s) for s in Line]\n\nN = Line[0]\n\nM = Line[1]\n\nAC_Lists = [""]*N\n# print(AC_Lists)\n\nfor i in range(M):\n input_line = input()\n Line = input_line.split()\n print(Line)\n AC_Lists[int(Line[0])-1] += Line[1][0]\n print(AC_Lists)\n\nAC_count = 0\nWA_count = 0\n\nfor s in AC_Lists:\n # print(s)\n if \'A\' in s:\n AC_count += 1\n my_str = s.split("A")\n print(my_str)\n # print(len(my_str[0]))\n WA_count += len(my_str[0])\n else:\n # print(len(s))\n WA_count += len(s)\n# print(AC_Lists)\n\nprint(AC_count,WA_count)\n', 'input_line = input()\nLine = input_line.split()\nLine = [int(s) for s in Line]\n\nN = Line[0]\n\nM = Line[1]\n \nAC_Lists = [""]*N\n# print(AC_Lists)\n \nfor i in range(M):\n input_line = input()\n Line = input_line.split()\n # print(AC_Lists[int(Line[0])-1])\n AC_Lists[int(Line[0])-1] += Line[1][0]\n \nAC_count = 0\nWA_count = 0\n \nfor s in AC_Lists:\n # print(s)\n if \'A\' in s:\n AC_count += 1\n my_str = s.split("A")\n # print(my_str)\n # print(len(my_str[0]))\n WA_count += len(my_str[0])\n # else:\n # print(len(s))\n # WA_count += len(s)\n# print(AC_Lists)\n \nprint(AC_count,WA_count)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s342399424', 's815811874', 's409930125']
[136084.0, 136084.0, 5312.0]
[1769.0, 1716.0, 596.0]
[638, 638, 650]
p02802
u024340351
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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]*(N+1)\n\nfor i in range (0, M):\n A, B = map(str, input().split())\n A = int(A)\n if B == 'WA':\n if AC[A] == 0:\n WA[A]+=1\n else:\n if AC[A] == 0:\n AC[A] = 1\n\nWronganswer = 0\nfor i in range (0, N):\n Wronganswer+=(AC[i]*WA[i])\nprint(sum(AC), Wronganswer)", "N, M = map(int, input().split())\nAC = [0]*(N+1)\nWA = [0]*(N+1)\n\nfor i in range (0, M):\n A, B = map(str, input().split())\n A = int(A)\n if B == 'WA':\n if AC[A] == 0:\n WA[A]+=1\n else:\n if AC[A] == 0:\n AC[A] = 1\n\nWronganswer = 0\nfor i in range (0, N+1):\n Wronganswer+=(AC[i]*WA[i])\nprint(sum(AC), Wronganswer)"]
['Wrong Answer', 'Accepted']
['s141096660', 's688661545']
[10380.0, 10388.0]
[249.0, 232.0]
[354, 356]
p02802
u024442309
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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 = [[] for i in range(N)]\nold_p = 0\nfor i in range(M):\n tmp = list(input().split())\n # if tmp[0] != str(old_p + 1):\n \n # l[old_p].append(tmp[1])\n l[int(tmp[0]) - 1].append(tmp[1])\nac = 0\nwa = 0\nprint(l)\nfor i in range(N):\n wa_tmp = 0\n for j in range(len(l[i])):\n if l[i][j] == 'WA':\n wa_tmp += 1\n else:\n ac += 1\n wa += wa_tmp\n break\nprint('{} {}'.format(ac, wa))", "N, M = map(int, input().split())\nl = [[] for i in range(N)]\nold_p = 0\nfor i in range(M):\n tmp = list(input().split())\n # if tmp[0] != str(old_p + 1):\n \n # l[old_p].append(tmp[1])\n l[int(tmp[0]) - 1].append(tmp[1])\nac = 0\nwa = 0\n#print(l)\nfor i in range(N):\n wa_tmp = 0\n for j in range(len(l[i])):\n if l[i][j] == 'WA':\n wa_tmp += 1\n else:\n ac += 1\n wa += wa_tmp\n break\nprint('{} {}'.format(ac, wa))\n"]
['Wrong Answer', 'Accepted']
['s822208430', 's682684324']
[22676.0, 20376.0]
[435.0, 421.0]
[491, 493]
p02802
u024965372
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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_i, s_i = input().split()\n p.append(int(p_i))\n s.append(b)\n\n\nres = [0]*n\ncorrect = 0\npenalty = 0\nfor i in range(m):\n no = p[i] - 1\n if res[no] == 1:\n continue\n elif s[i] == 'WA':\n penalty += 1\n elif s[i] == 'AC':\n correct += 1\n res[no] = 1\n\nprint(correct, penalty)", "n, m = map(int, input().split())\nps = [input().split() for _ in range(m)]\np, s = [list(i) for i in zip(*ps)]\np = list(map(int, p))\n\nres = [0]*n\ncorrect = 0\npenalty = 0\nfor i in range(m):\n no = p[i] - 1\n if res[no] == 1:\n continue\n elif s[no] == 'WA':\n penalty += 1\n elif s[no] == 'AC':\n correct += 1\n res[no] = 1\n\nprint(correct, penalty)", "n, m = map(int, input().split())\np = []\ns = []\nfor i in range(m):\n p_i, s_i = input().split()\n p.append(int(p_i))\n s.append(s_i)\n\ncorrect = [0]*n\npenalty = [0]*n\n\nfor i in range(m):\n no = p[i]\n if correct[no-1] == 1:\n continue\n elif s[i] == 'WA':\n penalty[no-1] += 1\n elif s[i] == 'AC':\n correct[no-1] = 1\n\npen = 0\nfor i in range(n):\n if correct[i] == 1:\n pen += penalty[i]\nprint(sum(correct), pen)"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s611983394', 's768090557', 's278214839']
[9080.0, 46640.0, 21528.0]
[23.0, 286.0, 228.0]
[381, 377, 450]
p02802
u025501820
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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 = []\nwa = [0 for i in range(N)]\n\nfor _ in range(M):\n p_i, s_i = input().split()\n if s_i == "AC" and p_i not in ac:\n ac.append(p_i)\n if s_i == "WA" and p_i not in ac:\n wa[p_i - 1] += 1\n \nac = set(ac) \nwa = [count for i, count in enumerate(wa) if i + 1 in ac]\n\nprint(len(ac), sum(wa))', 'N, M = map(int, input().split())\n\nac = []\nwa = [0 for i in range(N)]\n\nfor _ in range(M):\n p_i, s_i = input().split()\n if s_i == "AC" and p_i not in ac:\n ac.append(p_i)\n if s_i == "WA" and p_i not in ac:\n wa[p_i - 1] += 1\n \nac = set(ac)\nwa_num = 0\nfor i in range(N):\n if i + 1 not in ac:\n continue\n else:\n wa_num += wa[i]\n\nprint(len(ac), wa_num)', 'N, M = map(int, input().split())\n\nac = 0\nwa = 0\nac_status = [0 for i in range(N)]\nwa_status = [0 for i in range(N)]\n\nfor _ in range(M):\n p_i, s_i = input().split()\n if s_i == "AC" and ac_status[int(p_i) - 1] == 0:\n ac += 1\n ac_status[int(p_i) - 1] += 1\n wa += wa_status[int(p_i) - 1]\n if s_i == "WA":\n wa_status[int(p_i) - 1] += 1\n\nprint(ac, wa)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s075416147', 's093307256', 's084009112']
[4776.0, 4772.0, 4760.0]
[2104.0, 2104.0, 350.0]
[364, 394, 382]
p02802
u026731851
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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=list(map(int(input().split()))\nAC=[0]*(a+1)\nWA=[0]*(a+1)\nac=0\nwa=0\nt=0\nfor i in range(M):\n x,y=map(str(input().split())\n if y=="WA":\n WA[int(x)]+=1 \n elif x=="AC" and AC[int(x)]==0:\n wa+=WA[int(x)]\n ac+=1 \n AC[int(x)]=1\nprint(ac, wa) ', 'import numpy as np\nN, M=list(map(int(input().split()))\nAC=[0]*(a+1)\nWA=[0]*(a+1)\nac=0\nwa=0\nt=0\nfor i in range(M):\n x,y=list(map(str(input().split()))\n if y=="WA":\n WA[x]+=1 \n elif x=="AC" and AC[x]==0:\n wa+=WA[x]\n ac+=1 \n AC[x]=1\nprint(ac, wa) ', '\nN, M=list(map(int(input().split()))\nAC=[0]*(a+1)\nWA=[0]*(a+1)\nac=0\nwa=0\nt=0\nfor i in range(M):\n x,y=map(str(input().split())\n if y=="WA":\n WA[int(x)]+=1 \n elif x=="AC" and AC[int(x)]==0:\n wa+=WA[int(x)]\n ac+=1 \n AC[int(x)]=1\nprint(ac, wa) ', 'import numpy as np\nN, M=list(map(int(input().split()))\nAC=[0]*(a+1)\nWA=[0]*(a+1)\nac=0\nwa=0\nt=0\nfor i in range(M):\n x,y=list(map(str(input().split()))\n if y=="WA":\n WA[int(x)]+=1 \n elif x=="AC" and AC[int(x)]==0:\n wa+=WA[int(x)]\n ac+=1 \n AC[int(x)]=1\nprint(ac, wa) ', '\nN, M=map(int(input().split())\nAC=[0]*(a+1)\nWA=[0]*(a+1)\nac=0\nwa=0\nt=0\nfor i in range(M):\n x,y=map(str(input().split())\n if y=="WA":\n WA[int(x)]+=1 \n elif x=="AC" and AC[int(x)]==0:\n wa+=WA[int(x)]\n ac+=1 \n AC[int(x)]=1\nprint(ac, wa) ', 'N, M=map(int(input().split())\nAC=[0]*(a+1)\nWA=[0]*(a+1)\nac=0\nwa=0\nt=0\nfor i in range(M):\n x,y=map(str(input().split())\n if y=="WA":\n WA[int(x)]+=1 \n elif x=="AC" and AC[int(x)]==0:\n wa+=WA[int(x)]\n ac+=1 \n AC[int(x)]=1\nprint(ac, wa) ', '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)\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s133221743', 's161449356', 's280907170', 's419724862', 's626481441', 's795199513', 's535094173']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 4596.0]
[18.0, 17.0, 17.0, 20.0, 17.0, 17.0, 382.0]
[313, 299, 295, 319, 289, 288, 276]
p02802
u026862065
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n, m = map(int, input().split())\nl = list("")\nac, wa = 0, 0\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n if l[p - 1] != -1 and s == "AC":\n ac += 1\n wa += l[p - 1]\n l[p - 1] = -1\n if l[p - 1] != -1 and s == "WA":\n l[p - 1] += 1\nprint(ac, wa)', 'n, m = map(int, input().split())\nl = [0] * n\nac, wa = 0, 0\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n if l[p - 1] != -1 and s == "AC":\n ac += 1\n wa += l[p - 1]\n l[p - 1] = -1\n if l[p - 1] != -1 and s == "WA":\n l[p - 1] += 1\nprint(ac, wa)']
['Runtime Error', 'Accepted']
['s655456428', 's177813695']
[3064.0, 3828.0]
[22.0, 287.0]
[291, 290]
p02802
u029000441
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N,M=map(int,input().split()) \nL=[list(input().split()) for i in range(M)]\nW=[0]*N\nA=[0]*N\na=0\nw=0\nfor i in range(M):\n if L[i][1]=="AC":\n A[int(L[i][0])-1]=1\n \n elif L[i][1]=="WA" and A[int(L[i][0])-1]==0:\n W[int(L[i][0])-1]+=1\n\n #a+=i\n\n #w+=i\nfor i in range(n):\n if A[i]>0:\n a+=1\n w+=W[i]\nprint(a,w)\n\n', 'N,M=map(int,input().split()) \nL=[list(input().split()) for i in range(M)]\nW=[0]*N\nA=[0]*N\na=0\nw=0\nfor i in range(M):\n if L[i][1]=="AC":\n A[int(L[i][0])-1]=1\n \n elif L[i][1]=="WA" and A[int(L[i][0])-1]==0:\n W[int(L[i][0])-1]+=1\n\n #a+=i\n\n #w+=i\nfor i in range(N):\n if A[i]>0:\n a+=1\n w+=W[i]\nprint(a,w)\n\n']
['Runtime Error', 'Accepted']
['s052704964', 's195999790']
[31724.0, 31884.0]
[261.0, 264.0]
[345, 345]
p02802
u034777138
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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\ntempP = ""\nac = []\nwa = []\n\nfor count in range(N):\n ac.append(0)\n wa.append(0)\n\nfor count in range(M):\n P,S = input().split()\n P = int(P)\n P -= 1\n \n if ac[P] == 0:\n if S == "AC":\n ac[P] = 1\n else:\n wa[P] +=1\n\n\n\na = 0\nb = 0\n \nfor i in range(n):\n if ac[i] == 1:\n a += 1\n b += wa[i]\n \nprint(*[a, b])\n\n ', 'N,M= map(int,input().split())\n\ntempP = ""\nac = []\nwa = []\n\nfor count in range(N):\n ac.append(0)\n wa.append(0)\n\nfor count in range(M):\n P,S = input().split()\n P = int(P)\n P -= 1\n \n if ac[P] == 0:\n if S == "AC":\n ac[P] = 1\n else:\n wa[P] +=1\n\n\n\na = 0\nb = 0\n \nfor i in range(N):\n if ac[i] == 1:\n a += 1\n b += wa[i]\n \nprint(*[a, b])\n\n ']
['Runtime Error', 'Accepted']
['s928342495', 's416257239']
[4740.0, 4740.0]
[321.0, 297.0]
[407, 407]
p02802
u035453792
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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=[]\nP=[]\nwa=0\nac=0\nfor i in range(m):\n p,s=input().split()\n P.append(int(p))\n A.append(s)\n\nfor j in range(n):\n for i in range(m):\n if P[i]==j and A[i]=="ac":\n ac+=1\n break\n elif P[i]==j:\n wa+=1\nprint(ac,wa)', 'n,m=map(int,input().split())\nA=[]\nP=[]\nwa=0\nac=0\nfor _ in range(m):\n p,s=input().split()\n P.append(int(p))\n A.append(s)\n\nfor j in range(n):\n for i in range(m):\n if P[i]==j and A[i]=="AC":\n ac+=1\n break\n elif P[i]==j:\n wa+=1\nprint(ac,wa)', 'n,m=map(int,input().split())\nA=[0]*n\nW=[0]*n\nwa=0\nac=0\nfor _ in range(m):\n p,s=input().split()\n if s=="AC":\n A[int(p)-1]=1\n if s=="WA" and A[int(p)-1]!=1:\n W[int(p)-1]+=1\nfor i in range(n):\n if A[int(i)]==0:\n W[int(i)]=0\n\nprint(sum(A),sum(W))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s310918661', 's435436984', 's482046580']
[13372.0, 13376.0, 4596.0]
[2104.0, 2104.0, 327.0]
[296, 296, 275]
p02802
u038024401
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['import sys\n\nN, M = map(int, sys.stdin.readline().split())\nP = [None]*M\nS = [None]*M\nfor i in range(M):\n P[i], S[i] = sys.stdin.readline().split()\n\nAC = [0]*N\nWA = 0\n"""\nfor i in range(M):\n if S[i] == "AC":\n if AC[int(P[i])-1] == 0:\n AC[int(P[i])-1] += 1\n for j in range(i):\n if P[j] == P[i] and S[j] == "WA":\n WA += 1\n"""\n\n\nfor i in range(M):\n if AC[i]==0 and S[i] == "WA":\n WA += 1\n if S[i] == "AC":\n if AC[int(P[i])-1] == 0:\n AC[int(P[i])-1] += 1\n\nprint(sum(AC), WA)', 'N, M = map(int, input().split())\nP = [None]*M\nS = [None]*M\nfor i in range(M):\n P[i], S[i] = input().split()\n P[i] = int(P[i])\n\nAC = [0]*(N+1)\nwa = [0]*(N+1)\nWA = 0\n\nfor i in range(M):\n if S[i] == "WA":\n if AC[P[i]] == 0:\n wa[P[i]] += 1\n else:\n AC[P[i]] = 1\n\nfor i in range(N+1):\n WA += wa[i]*AC[i] \n\nprint(sum(AC[1:]), WA)']
['Runtime Error', 'Accepted']
['s051640635', 's570366804']
[16500.0, 15604.0]
[170.0, 295.0]
[568, 362]
p02802
u039189422
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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=[]\nfor i in range(m):\n\tp,s=input().split()\n\tif p in a:\n\t\tcontinue\n\tif s=="AC":\n\t\ta.append(p)\nprint(len(a))', 'n,m=map(int,input().split())\na=[-1]*(10**5)\nfor i in range(n):\n\tp,s=input().split()\n\tp=int(p)\n\tif s=="AC" and a[p]<0:\n\t\ta[p] = a[p]*(-1)\n\tif s=="WA" and a[p]<0:\n\t\ta[p] -= 1\nac=0\nwa=0\nfor i in range(n):\n\tif a[i] > 0:\n\t\tac += 1\n\t\twa += a[i] - 1\n\nprint(ac,wa)\t\t', 'n,m=map(int,input().split())\na=[-1]*(10**5)\nfor i in range(m):\n\tp,s=input().split()\n\tp=int(p)\n\tif s=="AC" and a[p]<0:\n\t\ta[p] = a[p]*(-1)\n\tif s=="WA" and a[p]<0:\n\t\ta[p] -= 1\nac=0\nwa=0\nfor i in range(n):\n\tif a[i] > 0:\n\t\tac += 1\n\t\twa += a[i] - 1\n\nprint(ac,wa)\t\t', 'n,m=map(int,input().split())\na=[-1]*n\nfor i in range(m):\n\tp,s=input().split()\n\tp=int(p)-1\n\tif s=="AC" and a[p]<0:\n\t\ta[p] = a[p]*(-1)\n\tif s=="WA" and a[p]<0:\n\t\ta[p] -= 1\nac=0\nwa=0\nfor i in range(n):\n\tif a[i] > 0:\n\t\tac += 1\n\t\twa += a[i] - 1\n\nprint(ac,wa)']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s116187773', 's406506606', 's672455867', 's666213668']
[3956.0, 3828.0, 3828.0, 3956.0]
[2103.0, 291.0, 287.0, 297.0]
[137, 258, 258, 252]
p02802
u039355749
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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\npoints = [0] * n\npenalties = [0] * n\n\nfor i in range(m):\n q, ans = input().split()\n \n if(int(q) == 0):\n continue:\n if(points[int(q) - 1] == 0):\n \n if(ans == 'AC'):\n points[int(q) - 1] = 1\n \n else:\n penalties[int(q) - 1] += 1\n\nprint(sum(points), sum(penalties))", "n, m = map(int, input().split())\n\npoints = [0] * n\npenalty = [0] * n\npenalties = 0\n\nfor i in range(m):\n q, ans = input().split()\n q = int(q) - 1\n \n if(points[q] == 0):\n \n if(ans == 'AC'):\n points[q] = 1\n penalties += penalty[q]\n \n else:\n penalty[q] += 1\n\nprint('{} {}'.format(sum(points), penalties))"]
['Runtime Error', 'Accepted']
['s620635030', 's276932763']
[2940.0, 4596.0]
[17.0, 283.0]
[401, 411]
p02802
u040442732
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["atcoder-tools: The pre-rendered templates are not found.import numpy as np\n\nN, M = map(int, input().split())\nAC_or_not = np.array([0] * N)\nn_penalty = np.array([0] * N)\n\nfor _ in range(M):\n prob, wa_ac = input().split()\n prob = int(prob) - 1\n if wa_ac == 'AC':\n AC_or_not[prob] = 1\n else:\n if not AC_or_not[prob]:\n n_penalty[prob] += 1\n\nprint(sum(AC_or_not), sum(n_penalty * AC_or_not))", "N, M = map(int, input().split())\nAC_or_not = [False] * N\nn_penalty = [0] * N\ncnt_ac = 0\ncnt_pen = 0\n\nfor _ in range(M):\n prob, wa_ac = input().split()\n prob = int(prob) - 1\n if wa_ac == 'AC':\n if not AC_or_not[prob]:\n cnt_pen += n_penalty[prob]\n cnt_ac += 1\n AC_or_not[prob] = True\n else:\n n_penalty[prob] += 1\n\nprint(cnt_ac ,cnt_pen)"]
['Runtime Error', 'Accepted']
['s447379598', 's883838894']
[2940.0, 4596.0]
[17.0, 307.0]
[423, 397]
p02802
u041382530
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n,m = map(int,input().split())\nt = dict()\naccount,pena = 0,0\nfor i in range(m):\n\ts = input().split()\n\tif not s[0] in t.keys():\n\t\tt[s[0]] = s[1]\n\telse:\n\t\tif t[s[0]][-2::] == 'WA':\n\t\t\tt[s[0]] += s[1]\nfor j in t.values():\n\tprint(j)\n\tif j[-2::] == 'AC':\n\t\taccount += 1\n\t\tpena += j.count('WA')\nprint(account,pena)\n", "n,m = map(int,input().split())\nt = dict()\naccount,pena = 0,0\nfor i in range(m):\n\ts = input().split()\n\tif not s[0] in t.keys():\n\t\tt[s[0]] = s[1]\n\telse:\n\t\tif t[s[0]][-2::] == 'WA':\n\t\t\tt[s[0]] += s[1]\nfor j in t.values():\n\tif j[-2::] == 'AC':\n\t\taccount += 1\n\t\tpena += j.count('WA')\nprint(account,pena)\n"]
['Wrong Answer', 'Accepted']
['s840972642', 's195830381']
[21988.0, 21988.0]
[1381.0, 1382.0]
[309, 299]
p02802
u043844098
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n, m = map(int, input().split())\n\nresult = set()\nwr = {}\nc_cnt = 0\nw_cnt = 0\nfor i in range(m):\n p, s = input().split()\n if (p in result):\n continue\n\n if (s == 'AC'):\n result.add(p)\n w_cnt = wr.get(p, 0)\n else:\n wr[p] = wr.get(p, 0) + 1\n\nprint('{} {}'.format(len(result), w_cnt))\n", "n, m = map(int, input().split())\n\nresult = set()\nwr = {}\nc_cnt = 0\nw_cnt = 0\nfor i in range(m):\n p, s = input().split()\n if (p in result):\n continue\n\n if (s == 'AC'):\n result.add(p)\n w_cnt = wr.get(p, 0) + w_cnt\n else:\n wr[p] = wr.get(p, 0) + 1\n\nprint('{} {}'.format(len(result), w_cnt))\n"]
['Wrong Answer', 'Accepted']
['s527685136', 's834728288']
[14052.0, 14052.0]
[244.0, 250.0]
[320, 328]
p02802
u046592970
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['ps = [list(input().split()) for _ in range(m)]\naw = ["WA"] * n\nac = 0\nwa = 0\nfor i in ps:\n if i[1] == "WA":\n if aw[int(i[0])-1] == "WA":\n wa += 1\n else:\n pass\n else:\n if aw[int(i[0])-1] =="WA":\n ac += 1\n aw[int(i[0])-1] = "AC"\n else:\n pass\nprint(ac,wa)', 'n,m = map(int,input().split())\nps = [list(input().split()) for _ in range(m)]\naw = ["WA"] * n\nwacnt = [0] * n\nac = 0\nwa = 0\nfor i in ps:\n if aw[int(i[0])-1] == "WA":\n if i[1] == "AC":\n ac += 1\n wa += wacnt[int(i[0])-1]\n aw[int(i[0])-1] = "AC"\n else:\n wacnt[int(i[0])-1] += 1\n else:\n pass\nprint(ac,wa)']
['Runtime Error', 'Accepted']
['s318576450', 's795874135']
[3064.0, 27472.0]
[17.0, 342.0]
[341, 371]
p02802
u051218477
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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\ndef main():\n N,M=map(int,input().split())\n str_list = [list(input().split()) for _ in range(M)]\n np_str_list=np.array(str_list)\n wacount=0\n for i in range(1,N+1):\n tgtarray=np_str_list[np.where(np_str_list[:,0]==str(i)),1][0]\n ac_index=np.where(tgtarray=='AC')[0][0]\n wacount=wacount+tgtarray[0:ac_index].shape[0]\n account=len(np_str_list[np_str_list[:,1]=='AC',0])\nprint(wacount,account)\n\nif __name__=='__main__':\n main()", 'n,m=map(int,input().split())\nps=[list(input().split()) for i in range(m)]\npen=[0]*n\nrig=[0]*n#ACorWA\n\nfor i in range(m):\n if ps[i][1]=="AC":\n rig[int(ps[i][0])-1]=1\n else:\n if rig[int(ps[i][0])-1]==0:\n pen[int(ps[i][0])-1]+=1\ncnt1,cnt2=0,0\nfor i in range(n):\n if rig[i]==1:\n cnt1+=rig[i]\n cnt2+=pen[i]\n\nprint(str(cnt1)+" "+str(cnt2))']
['Runtime Error', 'Accepted']
['s752328387', 's089036963']
[12420.0, 27456.0]
[150.0, 343.0]
[457, 391]
p02802
u051401873
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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 = "AC"\nac_dic= {}\nwa_dic = {}\nwa_num = 0\nfor _ in range(m):\n p, s = input().split()\n if s == ac:\n ac_dic[p] = 1\n else:\n if p in wa_dic:\n wa_dic[p]+=1\n else:\n wa_dic[p] = 1\nfor key, value in wa_dic.items():\n if key in ac_dic:\n wa_num += value\nans = len(ac_dic)\nprint(ans, wa_num)', 'import math\nn, m = map(int, input().split())\nans = {}\nac = "AC"\nwa = "WA"\nac_num = []\nwa_num = [] \nfor _ in range(m):\n p, s = input().split()\n if s == ac:\n ac_num.append(p)\n elif s not in set(ac_num):\n wa_num.append(p)\nprint(len(set(ac_num)), len((wa_num)))', 'n, m = map(int, input().split())\nac = "AC"\nac_dic= {}\nwa_dic = {}\nwa_num = 0\nfor _ in range(m):\n p, s = input().split()\n if s == ac:\n ac_dic[p] = 1\n elif not (p in ac_dic):\n if p in wa_dic:\n wa_dic[p]+=1\n else:\n wa_dic[p] = 1\nfor key, value in wa_dic.items():\n if key in ac_dic:\n wa_num += value\nans = len(ac_dic)\nprint(ans, wa_num)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s298446632', 's755624226', 's690280331']
[17108.0, 15628.0, 17116.0]
[231.0, 2104.0, 256.0]
[340, 267, 358]
p02802
u051928503
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N, M=map(int,input().split())\nif M==0:\n\tprint("0 0")\nelse:\n\tac=0\n\tpe=0\n\tch=[]\n\tfor i in range(M):\n\t\ta, b=input().split()\n a=int(a)\n\t\tif a in ch:\n\t\t\tcontinue\n\t\telif b=="AC":\n\t\t\tch.append(a)\n\t\t\tac+=1\n\t\telse:\n\t\t\tpe+=1\n\tprint(ac,pe)\n', 'N, M=map(int,input().split())\nif M==0:\n\tprint("0 0")\nelse:\n\tac=0\n\tpe=0\n\tch=[0]*N\n Ch=[0]*N\n\tfor i in range(M):\n\t\ta, b=input().split()\n\t\ta=int(a)-1\n\t\tif ch[a]==1:\n\t\t\tcontinue\n\t\telif b=="WA":\n\t\t\tCh[a]+=1\n\t\telse:\n\t\t\tch[a]=1\n\t\t\tac+=1\n\t\t\tpe+=Ch[a]\n\tprint(ac,pe)', 'N, M=map(int,input().split())\nif M==0:\n\tprint("0 0")\nelse:\n\tac=0\n\tpe=0\n\tch=[0]*N\n\tCh=[0]*N\n\tfor i in range(M):\n\t\ta, b=input().split()\n\t\ta=int(a)-1\n\t\tif ch[a]==1:\n\t\t\tcontinue\n\t\telif b=="WA":\n\t\t\tCh[a]+=1\n\t\telse:\n\t\t\tch[a]=1\n\t\t\tac+=1\n\t\t\tpe+=Ch[a]\n\tprint(ac,pe)\n\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s111242131', 's678620127', 's793204921']
[2940.0, 2940.0, 4596.0]
[17.0, 17.0, 280.0]
[236, 259, 258]
p02802
u057079894
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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())\nda = [map(str,input().split()) for i in range(m)]\npenalty = [0 for i in range(n)]\naccepted = [False for i in range(n)]\nfor i in range(m):\n now = int(da[i][0]) - 1\n if da[i][1] == 'AC':\n accepted[now] = True\n elif not accepted[now]:\n penalty[now] += 1\nAC,WA = 0,0\nfor i in range(n):\n if accepted[i]:\n AC += 1\n WA += penalty[i]\nprint(AC,WA)\n \n", "n,m = map(int,input().split())\nda = [map(str,input().split()) for i in range(m)]\npenalty = [0 for i in range(n)]\naccepted = [False for i in range(n)]\nfor i in range(m):\n now = int(da[i][0])\n if da[i][1] == 'AC':\n accepted[now] = True\n elif not accepted[now]:\n penalty[now] += 1\nAC,WA = 0,0\nfor i in range(n):\n if accepted[i]:\n AC += 1\n WA += penalty[i]\nprint(AC,WA)\n ", "n,m = map(int,input().split())\nda = [list(map(str,input().split())) for i in range(m)]\npenalty = [0 for i in range(n)]\naccepted = [False for i in range(n)]\nfor i in range(m):\n now = int(da[i][0]) - 1\n if da[i][1] == 'AC':\n accepted[now] = True\n elif not accepted[now]:\n penalty[now] += 1\nAC,WA = 0,0\nfor i in range(n):\n if accepted[i]:\n AC += 1\n WA += penalty[i]\nprint(AC,WA)"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s461180837', 's629108235', 's827706140']
[50540.0, 50544.0, 33860.0]
[390.0, 383.0, 377.0]
[391, 386, 391]
p02802
u057415180
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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 151C\nn, m = map(int, input().split())\nps = list(input().split() for _ in range(m))\nac = 0\nwa = 0\na = int(ps[0][0])\nif m == 0:\n print(0, 0)\n exit()\nfor i in range(1, m):\n while int(ps[i][0]) <= int(ps[m-1][0]):\n if int(ps[i][0]) == a and ps[i][1] == 'WA':\n wa += 1\n elif int(ps[i][0]) == a and ps[i][1] == 'AC':\n ac += 1\n a += 1\n else:\n continue\nprint(ac, wa)\n", "# ABC 151C\nn, m = map(int, input().split())\nac = 0\nwa = 0\ncnt = [0]*n\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n p -= 1\n if cnt[p] == -1:\n continue\n elif s == 'AC':\n ac += 1\n wa += cnt[p]\n cnt[p] = -1\n else:\n cnt[p] += 1\nprint(ac, wa)\n"]
['Runtime Error', 'Accepted']
['s299949289', 's574710530']
[32140.0, 3828.0]
[2106.0, 287.0]
[439, 301]
p02802
u057993957
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N, M = list(map(int, input().split()))\nresults =[ input().split(" ") for i in range(M) ]\n\nacc = [ False ] * N\npena = [ 0 ] * N \nfor p, S in results:\n p = int(p) - 1\n if acc[p] < 1 and p <= N:\n acc[p] = True if S == \'AC\' else False \n pena[p] = pena[p] + 1 if S == \'WA\' else pena[p] \n\nwa = 0\nfor i in range(N):\n wa += pena[i] if acc is True else 0\n \nprint(sum(acc), wa)\n\n', 'N, M = list(map(int, input().split()))\nresults =[ input().split(" ") for i in range(M) ]\n\nacc = [ False ] * N\npena = [ 0 ] * N \nfor p, S in results:\n p = int(p) - 1\n if acc[p] is False:\n acc[p] = True if S == \'AC\' else False \n pena[p] = pena[p] + 1 if S == \'WA\' else pena[p] \n\nwa = 0\nfor i in range(N):\n wa += pena[i] if acc[i] is True else 0\n \nprint(sum(acc), wa)\n\n']
['Wrong Answer', 'Accepted']
['s894867688', 's415470020']
[33672.0, 33672.0]
[300.0, 293.0]
[381, 378]
p02802
u061320712
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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\npena = 0\nisac = [0] * n\nwa = [0] * n\n\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n p -= 1\n print(p, s)\n if (s == "AC"):\n if (isac[p] != 1):\n ac += 1\n pena += wa[p]\n isac[p] = 1\n else:\n if (isac[p] == 0):\n wa[p] += 1\n # print(ac, pena, isac[p], wa[p])\n\nprint(ac, pena)', 'n, m = map(int, input().split())\nac = 0\npena = 0\nisac = [0] * n\nwa = [0] * n\n\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n p -= 1\n # print(p, s)\n if (s == "AC"):\n if (isac[p] != 1):\n ac += 1\n pena += wa[p]\n isac[p] = 1\n else:\n if (isac[p] == 0):\n wa[p] += 1\n # print(ac, pena, isac[p], wa[p])\n\nprint(ac, pena)']
['Wrong Answer', 'Accepted']
['s583581069', 's675333670']
[5492.0, 4596.0]
[845.0, 298.0]
[397, 399]
p02802
u064264248
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['F_str = input().split()\nF = [int(f) for f in F_str]\nN = F[0]\nM = F[1]\n\nWA_dict = {}\nAC_list = []\n\nfor i in range(M):\n S_str = input().split()\n S = [str(s) for s in S_str]\n if(S[1] == "AC"):\n AC_list.append(S[0])\n else:\n WA_dict.setdefault(S[0], 0)\n WA_dict[S[0]] += 1\n\nAC_set = list(set(AC_list))\n\nWA_count = 0\n\nfor item in AC_set:\n if(item in WA_dict):\n WA_count += WA_dict[item]\n\nprint(WA_count)', 'F_str = input().split()\nF = [int(f) for f in F_str]\nN = F[0]\nM = F[1]\n\nWA_list = [0 for _ in range(N)]\nAC_list = []\n\nfor i in range(M):\n S_str = input().split()\n S = [str(s) for s in S_str]\n if(S[1] == "AC"):\n AC_list.append(S[0])\n AC_list = list(set(AC_list))\n elif(not(S[0] in AC_list)):\n WA_list[int(S[0])-1] += 1\n \nWA_count = 0\n\nfor item in AC_list:\n WA_count += WA_list[int(item)-1]\n\nprint(str(len(AC_list)) + " " + str(sum(WA_count)))', 'F_str = input().split()\nF = [int(f) for f in F_str]\nN = F[0]\nM = F[1]\n\nWA_list = [0 for _ in range(N)]\nAC_list = []\n\nfor i in range(M):\n S_str = input().split()\n S = [str(s) for s in S_str]\n if(S[1] == "AC"):\n AC_list.append(S[0])\n elif(not(S[0] in AC_list)):\n WA_list[int(S[0])-1] += 1\n\nAC_set = list(set(AC_list))\n\nWA_count = 0\n\nfor item in AC_set:\n WA_count += WA_list[int(item)-1]\n\nprint(str(len(AC_set)) + " " + str(sum(WA_count)))', 'F_str = input().split()\nF = [int(f) for f in F_str]\nN = F[0]\nM = F[1]\n\nWA_list = [0 for _ in range(N)]\nAC_list = [0 for _ in range(N)]\n\nfor i in range(M):\n S_str = input().split()\n S = [str(s) for s in S_str]\n if(S[1] == "AC"):\n AC_list[int(S[0])-1] = 1\n elif(AC_list[int(S[0])-1] != 1):\n WA_list[int(S[0])-1] += 1\n\nWA_count = 0\nAC_count = 0\n\nfor i in range(N):\n if(AC_list[i] == 1):\n AC_count += 1\n WA_count += WA_list[i]\n\nprint(AC_count, WA_count)']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s184173670', 's691097603', 's773444073', 's853325603']
[15552.0, 5092.0, 16424.0, 4784.0]
[338.0, 2104.0, 2104.0, 393.0]
[440, 483, 465, 492]
p02802
u064408584
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n,m =map(int, input().split())\na =[list(input().split()) for i in range(m)]\nends = [0]*n\nwas = [0]*n\nfor num, kekka in a:\n num=int(num)-1\n if kekka=='AC':\n ends[num]=1\n else:\n if ends[num]!=1:\n was[num]+=1\nfor i in range(n):\n if end[i]==0:\n was[i]=0\nprint(sum(ends), sum(was))", "n,m =map(int, input().split())\na =[list(input().split()) for i in range(m)]\nends = [0]*n\nwas = [0]*n\nfor num, kekka in a:\n num=int(num)-1\n if kekka=='AC':\n ends[num]=1\n else:\n if ends[num]!=1:\n was[num]+=1\nfor i in range(n):\n if ends[i]==0:\n was[i]=0\nprint(sum(ends), sum(was))"]
['Runtime Error', 'Accepted']
['s059857917', 's473867429']
[27448.0, 27448.0]
[284.0, 302.0]
[320, 321]
p02802
u067694718
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n, m = [int(i) for i in input().split()]\nac = [0] * n\nwa = [0] * n\n\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n if ac[p-1] == 0:\n if s == "AC":\n ac[p-1] = 1\n elif s == "WA":\n wa[p-1] += 1\n\nwa_sum = 0\nfor i in range(n):\n if ac[i] >= 1: wa_sum += wa[i]\n\nprint(sum(ac), sum_wa)', 'n, m = [int(i) for i in input().split()]\nac = [0] * n\nwa = [0] * n\n\nfor i in range(m):\n p, s = input().split()\n p = int(p)\n if ac[p-1] == 0:\n if s == "AC":\n ac[p-1] = 1\n elif s == "WA":\n wa[p-1] += 1\n\nwa_sum = 0\nfor i in range(n):\n if ac[i] >= 1: wa_sum += wa[i]\n\nprint(sum(ac), wa_sum)']
['Runtime Error', 'Accepted']
['s173151023', 's812815639']
[4596.0, 4724.0]
[298.0, 290.0]
[334, 334]
p02802
u072717685
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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())\nal = []\nfor i in range(M):\n al.append(tuple(input().split()))\nal_a = [i[0] for i in al if i[1] == 'AC']\nal_a = list(set(al_a))\nr1 = len(al_a)\nr2 = 0\nfor j in al:\n if j[0] in al_a:\n if j[1] == 'AC':\n \tal_a.remove(j[0])\n \telse:\n \tr2 += 1\n \nprint(r1 ,r2)", "N, M = map(int, input().split())\nal = []\nfor i in range(M):\n al.append(tuple(input().split()))\nal_a = []\nfor a in al:\n if a[1] == 'AC':\n al_a.append(a)\nr1 = len(set(al_a))\nal_a2 = [i[0] for i in al_a]\nr2 = 0\nfor j in al:\n if j[1] == 'WA' and j[0] in al_a2:\n r2 += 1\n \n \nprint(int(r1) ,int(r2))", "N, M = map(int, input().split())\nal = []\nfor i in range(M):\n al.append(tuple(input().split()))\nal_a = [i[0] for i in al if i[1] == 'AC']\nal_a = list(set(al_a))\nr1 = len(al_a)\nr2 = 0\nfor j in [j for j in al if j[0] in al_a]:\n if j[1] == 'AC':\n al_a.remove(j[0])\n else:\n r2 += 1\n \nprint(r1 ,r2)", "def main():\n n, m = map(int, input().split())\n ac = [0] * n\n wanum = [0] * n\n for _ in range(m):\n p, s = input().split()\n p = int(p) - 1\n if ac[p]:\n continue\n else:\n if s == 'AC':\n ac[p] = 1\n wanum[p] *= -1\n else:\n wanum[p] -= 1\n wanum2 = [i for i in wanum if i > 0]\n print(sum(ac), sum(wanum2))\n\nif __name__ == '__main__':\n main()"]
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s300837214', 's501205138', 's649939867', 's141185261']
[2940.0, 28272.0, 28260.0, 10396.0]
[17.0, 2105.0, 2105.0, 168.0]
[299, 304, 304, 458]
p02802
u074687136
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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_cnt = 0\nwa_cnt = 0\nref = [0] * N\nfor i in range(M):\n p, s = map(str, input().split())\n p = int(p) - 1\n if s == 'AC':\n if ref[p] == 0:\n ref[p] = s\n ac_cnt += 1\n elif ref[p] == 'AC':\n ac_cnt += 0\n elif ref[p] == 'WA':\n ref[p] = s\n ac_cnt += 1\n elif s == 'WA':\n if ref[p] == 0:\n ref[p] = s\n wa_cnt += 1\n elif ref[p] == 'AC':\n ac_cnt += 0\n elif ref[p] == 'WA':\n ref[p] = s\n wa_cnt += 1\n print(ref, ac_cnt, wa_cnt)\nprint('{0:d} {1:d}'.format(ac_cnt, wa_cnt))", "N, M = map(int, input().split())\nac = 0\nwa = 0\nref = [0] * N\nfor i in range(M):\n p, s = map(str, input().split())\n p = int(p) - 1\n if ref[p] != -1:\n if s == 'WA':\n ref[p] += 1\n else:\n wa += ref[p]\n ac += 1\n ref[p] = -1\nprint(ac, wa)"]
['Wrong Answer', 'Accepted']
['s138891751', 's932824176']
[106928.0, 3828.0]
[2104.0, 350.0]
[562, 261]
p02802
u075303794
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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())\nanswer_p = set()\nsubmit_p= set()\ncount_pena=0\ncount_wa=0\n\nfor _ in range(M):\n p,S= input().split()\n\n if p in answer_p:\n continue\n else:\n #if p not in submit_p:\n \n #submit_p.add(p)\n\n if S=='WA':\n count_wa += 1\n elif S=='AC':\n count_pena += count_wa\n answer_p.add(p)\n\nprint(len(answer_p), count_pena)\n ", "import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nN,M = map(int, readline().split())\nPS = [line.split() for line in readlines()]\n\nAC = [False] * (N+1)\nWA_cnt = [0] * (N+1)\n\npenal = 0\nfor p,s in PS:\n p = int(p)\n if AC[p]:\n continue\n if s== b'WA':\n WA_cnt[p] += 1\n else:\n AC[p] = True\n penal += WA_cnt[p]\n \nac = sum(AC)\nprint(ac, penal)"]
['Wrong Answer', 'Accepted']
['s240627424', 's032005911']
[19804.0, 40788.0]
[182.0, 131.0]
[384, 420]
p02802
u077013956
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['#include <bits/stdc++.h>\nusing namespace std;\nvoid printVector(const vector<int>& vec) {\n for (int value : vec) {\n cout << value << " ";\n }\n cout << endl;\n}\n\nint main() {\n int N,M;\n cin >> N >> M;\n vector<int> p(M);\n vector<string> S(M);\n for(int i=0;i<M;i++) {\n cin >> p.at(i) >> S.at(i);\n }\n vector<vector<int>> submits(N,vector<int>(2,0));\n for(int i=0;i<M;i++) {\n if(submits.at(p.at(i)-1).at(0) != 0) {\n continue;\n }\n if(S.at(i) == "WA") {\n submits.at(p.at(i)-1).at(1)++;\n }else{\n submits.at(p.at(i)-1).at(0)++;\n }\n }\n int ac = 0;\n int pena = 0;\n\n for(int i=0;i<N;i++) {\n ac += submits.at(i).at(0);\n pena += submits.at(i).at(1);\n }\n cout << ac <<" " << pena << endl;\n}', 'from operator import itemgetter\n\nN,M = map(int,input().split())\nPS = [list(map(str,input().split())) for i in range(M)]\n\nfor i in range(M) :\n PS[i][0] = int(PS[i][0])\n\nsubmits = [["null"] for i in range(N)]\nfor i in range(M) :\n submits[PS[i][0]-1][0] = PS[i][0]-1\n submits[PS[i][0]-1].append(PS[i][1])\n\nac = 0\npena = 0\nfor i in range(len(submits)) :\n if submits[i][0] == "null" :\n continue\n\n flag = False\n wabuf1 = 0\n for j in range(1,len(submits[i])) :\n if submits[i][j] == "AC" :\n ac += 1\n flag = True\n break\n else :\n wabuf1 += 1\n if flag == True :\n pena += wabuf1\n\nprint(ac,pena)']
['Runtime Error', 'Accepted']
['s458994045', 's429082714']
[8908.0, 46876.0]
[29.0, 565.0]
[819, 678]
p02802
u078316894
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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(' ')))\nresult_list = [input().split(' ') for i in range(M)]\nAC_total = 0\nWA_total = 0\nac_list = []\nwa_dict = {}\nfor p, s in result_list:\n if p not in ac_list:\n if s == 'WA':\n if p in wa_dict:\n wa_dict[p] += 1\n else:\n wa_dict[p] = 1\n else:\n AC_total += 1\n ac_list.append(p)\nfor p in wa_dict:\n if p in ac_list:\n WA_total += wa\nprint('{} {}'.format(AC_total, WA_total))", "N, M = list(map(int, input().split(' ')))\nAC_total = 0\nWA_total = 0\nac_list = [False] * N\nwa_list = [0] * N\nfor i in range(M):\n p, s = input().split(' ')\n p = int(p) - 1\n if not ac_list[p]:\n if s == 'WA':\n wa_list[p] += 1\n else:\n AC_total += 1\n WA_total += wa_list[p]\n ac_list[p] = True\nprint('{} {}'.format(AC_total, WA_total))"]
['Runtime Error', 'Accepted']
['s238304654', 's652301000']
[36876.0, 4596.0]
[2106.0, 301.0]
[502, 395]
p02802
u079427319
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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\nacList = [False] * n\nwaCount = 0\nfor i in range(m):\n p, s = map(str, input().split())\n p = int(p) - 1 \n print(acList)\n if acList[p]:\n continue\n if s == 'WA':\n waCount += 1\n continue\n acList[p] = True\n\nprint(sum(acList), waCount)\n", "n, m = map(int, input().split())\n\nacList = [False] * n\nwaList = [0] * n\nwaCount = 0\nfor i in range(m):\n p, s = map(str, input().split())\n p = int(p) - 1 \n if acList[p]:\n continue\n if s == 'WA':\n waList[p] += 1\n continue\n waCount += waList[p]\n acList[p] = True\n\nprint(sum(acList), waCount)\n"]
['Runtime Error', 'Accepted']
['s262578356', 's904602285']
[136264.0, 4596.0]
[906.0, 348.0]
[307, 333]
p02802
u084261177
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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())\nresults = []\npassed = 0\nfailed = 0\ndicto = {}\nfor item in results:\n key = item[0]\n status = item[1]\n if key not in dicto.keys():\n dicto[key] = []\n dicto[key].append(status)\n else:\n \n if 'AC' not in dicto[key]:\n dicto[key].append(status)\nfor item in dicto:\n if 'AC' in item:\n for i in item:\n if i == 'WA':\n failed += 1\n passed += 1\n\nprint(passed, failed)\n", "n, m = map(int, input().split())\npassed = 0\nfailed = 0\ndicto = {}\n\nfor i in range(0, n+1):\n dicto[i] = [False, 0]\n\nfor i in range(m):\n key, status = input().split()\n key = int(key)\n if status == 'WA':\n dicto[key][1] += 1\n else:\n dicto[key][0] = True\n break\n\nfor i in dicto:\n if dicto[i][0]:\n failed += dicto[i][1]\n passed += 1\n\nprint(passed, failed)\n", "n, m = map(int, input().split())\npassed = 0\nfailed = 0\ndicto = {}\n\nfor i in range(1, n+1):\n dicto[i] = [False, 0]\n\nfor i in range(m):\n key, status = input().split()\n key = int(key)\n if status == 'WA' and not dicto[key][0]:\n dicto[key][1] += 1\n else:\n dicto[key][0] = True\n\nfor i in dicto:\n if dicto[i][0]:\n failed += dicto[i][1]\n passed += 1\n\nprint(passed, failed)\n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s481515538', 's524528212', 's504888477']
[3064.0, 23204.0, 23204.0]
[17.0, 261.0, 353.0]
[518, 403, 411]
p02802
u086503932
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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 = [None]*M\nS = [None]*M\nfor i in range(M):\n p[i], S[i] = input().split()\n\nac = [False]*N\npenalty = 0\nfor i in range(M):\n if S[i] == 'AC':\n ac[int(p[i])-1] = True\n\nfor i in range(M):\n if ac[int(p[i])-1] == False:\n penalty += 1\nprint(*[sum(ac), penalty])", "N, M = map(int, input().split())\np = [None]*M\nS = [None]*M\nfor i in range(M):\n p[i], S[i] = input().split()\n\nac_flag = [0]*N\nwa_count = [0]*N\n\npenalty = 0\nfor i in range(M):\n j = int(p[i])-1\n if S[i] == 'AC':\n if ac_flag[j]:\n pass\n else:\n ac_flag[j] = 1\n penalty += wa_count[j]\n else:\n wa_count[j] += 1\nprint(*[sum(ac_flag), penalty])"]
['Wrong Answer', 'Accepted']
['s002155825', 's623806514']
[16500.0, 17268.0]
[251.0, 257.0]
[296, 362]
p02802
u087373960
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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()]\n\nobj = {}\nii = 0\njj = 0\n\nfor i in range(M):\n p = [x for x in input().split()]\n key = p[0]\n res = p[1]\n if key not in obj:\n obj[key] = {'AC': 0, 'WA': 0}\n if res == 'WA' and obj[key]['AC'] > 0:\n obj[key]['WA'] = obj[key]['WA'] + 1\n if res == 'AC':\n obj[key]['AC'] = 1\n\nfor k in obj:\n ii = ii + obj[k]['AC']\n jj = jj + obj[k]['WA']\n\n\nprint(ii, jj)", "N, M = [int(x) for x in input().split()]\n\nobj = {}\nii = 0\njj = 0\n\nfor i in range(M):\n p = [x for x in input().split()]\n key = p[0]\n res = p[1]\n if key not in obj:\n obj[key] = {'AC': 0, 'WA': 0}\n if res == 'WA' and obj[key]['AC'] == 0:\n obj[key]['WA'] = obj[key]['WA'] + 1\n if res == 'AC':\n obj[key]['AC'] = 1\n\nfor k in obj:\n ii = ii + obj[k]['AC']\n if obj[k]['AC'] > 0:\n jj = jj + obj[k]['WA']\n\n\nprint(ii, jj)"]
['Wrong Answer', 'Accepted']
['s612717630', 's989940806']
[44428.0, 44556.0]
[440.0, 452.0]
[431, 461]
p02802
u089142196
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['N,M=map(int,input().split())\np=[0]*N\nS=[0]*N\nsei=[0]*N\npena=[0]*N\ntotal=[0]*N\n\nfor i in range(M):\n p[i],S[i] = input().split()\n p[i]=int(p[i])\n\n if S[i]=="AC":\n if sei[p[i]]>=1:\n pass\n else:\n sei[p[i]] +=1\n \n else: \n if sei[p[i]]>=1:\n pass\n else: \n pena[p[i]] +=1\n\nfor j in range(N):\n total[j]=sei[j]*pena[j]\n \nprint(sum(sei),sum(total))', 'N,M=map(int,input().split())\np=[0]*M\nS=[0]*M\nsei=[0]*N\npena=[0]*N\ntotal=[0]*N\n\nfor i in range(M):\n p[i],S[i] = input().split()\n p[i]=int(p[i])\n\n if S[i]=="AC":\n if sei[p[i]-1]>=1:\n pass\n else:\n sei[p[i]-1] +=1\n \n else: \n if sei[p[i]-1]>=1:\n pass\n else: \n pena[p[i]-1] +=1\n\nfor j in range(N):\n total[j]=sei[j]*pena[j]\n \nprint(sum(sei),sum(total))']
['Runtime Error', 'Accepted']
['s219741712', 's102228229']
[15476.0, 15636.0]
[298.0, 327.0]
[404, 412]
p02802
u091051505
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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\nwa_dict = defaultdict(lambda: 0)\nn, m = map(int, input().split())\nac_set = set([])\nac = 0\nwa = 0\nfor _ in range(m):\n p, s = input().split()\n if s == 'AC':\n ac_set.add(p)\n if p not in ac_set:\n wa += wa_dict[p]\n else:\n if p not in ac_set:\n wa_dict[p] += 1\nprint(len(ac_set), wa)", "from collections import defaultdict\nwa_dict = defaultdict(lambda: 0)\nn, m = map(int, input().split())\nac_set = set([])\nac = 0\nwa = 0\nfor _ in range(m):\n p, s = input().split()\n if s == 'AC':\n if p not in ac_set:\n wa += wa_dict[p]\n ac_set.add(p)\n else:\n if p not in ac_set:\n wa_dict[p] += 1\nprint(len(ac_set), wa)"]
['Wrong Answer', 'Accepted']
['s064015662', 's160942640']
[14296.0, 20636.0]
[263.0, 304.0]
[364, 368]
p02802
u092061507
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["N, M = map(int, input().split())\narr = [input().split() for i in range(M)]\ns = [[0,0] for i in range(N)]\np = 0\na = 0\nfor i, j in arr:\n if j == 'AC':\n s[int(i)-1][0] = 1\n elif j == 'WA':\n if s[int(i)-1][0] == 1: \n pass\n else:\n s[int(i)-1][1] += 1\nprint(s)\nfor i, j in s:\n if i == 1:\n p += j\n a += 1\nprint(a, p)\n", "N, M = map(int, input().split())\narr = [input().split() for i in range(M)]\ns = [[0,0] for i in range(N)]\np = 0\na = 0\nfor i, j in arr:\n if j == 'AC':\n s[int(i)-1][0] = 1\n elif j == 'WA':\n if s[int(i)-1][0] == 1: \n pass\n else:\n s[int(i)-1][1] += 1\nfor i, j in s:\n if i == 1:\n p += j\n a += 1\nprint(a, p)\n"]
['Wrong Answer', 'Accepted']
['s508399576', 's482962581']
[44796.0, 42368.0]
[384.0, 321.0]
[385, 376]
p02802
u096983897
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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_i, s_i = input().split()\n p.append(int(p_i))\n s.append(s_i)\n\nlist_correct = [0] * n\nlist_pena = [0] * n\nfor i in range(m):\n if s[i] == "AC":\n if list_correct[p[i]] == 0:\n list_correct[p[i]] = 1\n else:\n if list_correct[p[i]] == 0:\n list_pena[p[i]] = list_pena[p[i]] + 1\n \nsum_correct = sum(list_correct)\ncombined = [x * y for (x, y) in zip(list_correct, list_pena)]\nsum_pena = sum(combined)\n\nprint (sum_correct, sum_pena)', 'n, m = map(int, input().split())\np = []\ns = []\nfor i in range(m):\n p_i, s_i = input().split()\n p.append(int(p_i))\n s.append(s_i)\n\nlist_correct = [0] * n\nlist_pena = [0] * n\nfor i in range(m):\n if s[i] == "AC":\n if list_correct[p[i]-1] == 0:\n list_correct[p[i]-1] = 1\n else:\n if list_correct[p[i]-1] == 0:\n list_pena[p[i]-1] = list_pena[p[i]-1] + 1\n \nsum_correct = sum(list_correct)\ncombined = [x * y for (x, y) in zip(list_correct, list_pena)]\nsum_pena = sum(combined)\n\nprint (sum_correct, sum_pena)']
['Runtime Error', 'Accepted']
['s286578023', 's578459962']
[15684.0, 15688.0]
[301.0, 305.0]
[515, 525]
p02802
u098982053
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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 ACWA(p,j,p_list):\n if j=="AC":\n p_list[p][0]=1\n else:\n p_list[p][1]+=1\n return p_list\n \nN,M = map(int,input().split(" "))\np_list = {}\nwa_count = 0\n\nfor _ in range(M):\n In = input().split()\n if (In[0] in p_list) == False:\n p_list[In[0]]=[0,0]\n p_list = ACWA(In[0],In[1],p_list)\n else:\n if p_list[In[0]][0]==1:\n continue\n else:\n p_list = ACWA(In[0],In[1],p_list)\n \nList = list(p_list.values())\nprint(List)\na = 0\nb = 0\n\nfor i in range(len(List)):\n if List[i][0]==1:\n a+=List[i][0]\n b+=List[i][1]\n\nprint("{} {}".format(a,b))', 'def ACWA(p,j,p_list):\n if j=="AC":\n p_list[p][0]=1\n else:\n p_list[p][1]+=1\n return p_list\n \nN,M = map(int,input().split(" "))\np_list = {}\nwa_count = 0\n\nfor _ in range(M):\n In = input().split()\n if (In[0] in p_list) == False:\n p_list[In[0]]=[0,0]\n p_list = ACWA(In[0],In[1],p_list)\n else:\n if p_list[In[0]][0]==1:\n continue\n else:\n p_list = ACWA(In[0],In[1],p_list)\n \nList = list(p_list.values())\na = 0\nb = 0\n\nfor i in range(len(List)):\n if List[i][0]==1:\n a+=List[i][0]\n b+=List[i][1]\n\nprint("{} {}".format(a,b))']
['Wrong Answer', 'Accepted']
['s767785003', 's642198957']
[27308.0, 25276.0]
[397.0, 373.0]
[642, 629]
p02802
u100277898
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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\nc_l = list()\na = 0\nw = 0\n\nfor i in range(M):\n p,s = input().split()\n p = int(p)\n if p not in c_l:\n continue', 'N,M = map(int,input().split())\n\nc_l = list()\na = 0\nw = 0\n\nfor i in range(M):\n p,s = input().split()\n p = int(p)\n if p not in c_l:\n c_l.append(p)', 'N,M = map(int,input().split())\n\nc_l = list()\na = 0\nw = 0\n\nfor i in range(M):\n p,s = input().split()\n p = int(p)', 'N,M = map(int,input().split())\n\nc_l = [0 for i in range(N)]\na = 0\nw = 0\n\nfor i in range(M):\n p,s = input().split()\n p = int(p)\n if c_l[p-1] != -1:\n if s == "AC":\n a += 1\n w += c_l[p-1]\n c_l[p-1] = -1\n else:\n c_l[p-1] += 1\nprint("{} {}".format(a,w))\n\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s452548296', 's710832507', 's971967542', 's972798725']
[3060.0, 3700.0, 3060.0, 3928.0]
[231.0, 2104.0, 214.0, 288.0]
[145, 150, 113, 279]
p02802
u102242691
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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())\nans = [0]*n\nmiss = [0]*n\n\nfor _ in range(m+1):\n p,s = map(str,input().split())\n p = int(p)\n# print(p,s)\n if ans[p-1] == 0 and s == "WA":\n miss[p-1] += 1\n elif ans[p-1] == 0 and s == "AC":\n ans[p-1] += 1\n else:\n pass\n\n#print(ans)\n#print(miss)\na = sum(ans)\nb = sum(miss)\n\nprint(a,b)\n', "\nn, m = map(int, input().split())\nbool_lst = [False] * n\nac_lst = [0] * n\nwa_lst = [0] * n\nfor i in range(m):\n p, s = input().split()\n p = int(p) - 1\n if bool_lst[p] == False:\n if s == 'AC':\n bool_lst[p] = True\n ac_lst[p] += 1\n else:\n wa_lst[p] += 1\n\nac_cnt = 0\nwa_cnt = 0\nfor i in range(n):\n if bool_lst[i] == True:\n ac_cnt += ac_lst[i]\n wa_cnt += wa_lst[i]\n\nprint(ac_cnt, wa_cnt)\n"]
['Runtime Error', 'Accepted']
['s465249578', 's887936808']
[4596.0, 5364.0]
[355.0, 310.0]
[352, 455]
p02802
u102275718
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["import sys\ninput = sys.stdin.readline\n\nn, m = map(int, input().split())\npS = [input().split()[:2] for _ in range(m)]\n\nAC = [0]*n\nWA = [0]*n\n\nfor p, S in pS:\n p = int(p)\n print(p)\n if AC[p-1] == 0:\n if S == 'AC':\n AC[p-1] = 1\n else:\n WA[p-1] += 1\n\nfor i in range(n):\n if WA[i] > 0 and AC[i] == 0:\n WA[i] = 0\nprint(sum(AC), sum(WA))", "import sys\ninput = sys.stdin.readline\n\nn, m = map(int, input().split())\npS = [input().split()[:2] for _ in range(m)]\n\nAC = [0]*n\nWA = [0]*n\n\nfor p, S in pS:\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\n\nfor i in range(n):\n if WA[i] > 0 and AC[i] == 0:\n WA[i] = 0\nprint(sum(AC), sum(WA))"]
['Wrong Answer', 'Accepted']
['s684442176', 's524510916']
[26808.0, 25876.0]
[240.0, 159.0]
[385, 372]
p02802
u104005543
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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())\nc = [input().split() for i in range(m)]\nfor i in range(m):\n c[i][0] = int(c[i][0])\nAC, WA = 0, 0\naclist = [0 for i in range(n)]\nfor i in range(m):\n if aclist[c[i][0]] == 0:\n if c[i][1] == 'AC':\n aclist[c[i][0]] += 1\n AC += 1\n else:\n WA += 1\nprint(AC, WA)", "n, m = map(int, input().split())\nc = [input().split() for i in range(m)]\nfor i in range(m):\n c[i][0] = int(c[i][0])\nAC, WA, i =0, 0, 0\nfor i in range(n):\n for j in range(m):\n if c[j][0] == i + 1:\n if c[j][1] == 'WA':\n WA += 1\n if j == m:\n break\n elif c[j][i] == 'AC':\n AC += 1\n break \nprint(AC, WA)", "n, m = map(int, input().split())\nc = [list(map(int, input().split())) for i in range(n)]\nAC, WA, i =0, 0, 0\nwhile i < n:\n if c[i][0] == i + 1:\n if c[i][1] == 'WA':\n WA += 1\n else:\n AC += 1\n i += 1\nprint(AC, WA)", "n, m = map(int, input().split())\nc = [input().split() for i in range(m)]\nfor i in range(m):\n c[i][0] = int(c[i][0])\nAC, WA = 0, 0\naclist = [0 for i in range(n)]\nfor i in range(n):\n if aclist[c[i][0]] == 0:\n if c[i][1] == 'AC':\n aclist[c[i][0]] += 1\n AC += 1\n else:\n WA += 1\nprint(AC, WA)", "n, m = map(int, input().split())\nc = [input().split() for i in range(m)]\nfor i in range(m):\n c[i][0] = int(c[i][0])\nAC, WA = 0, 0\nacwa = [[0, 0] for i in range(n)]\nfor i in range(m):\n if acwa[c[i][0] - 1][0] == 0:\n if c[i][1] == 'AC':\n acwa[c[i][0] - 1][0] += 1\n AC += 1\n WA += acwa[c[i][0] - 1][1]\n else:\n acwa[c[i][0] - 1][1] += 1\n\nprint(AC, WA)"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s344390723', 's612983377', 's643178041', 's826136571', 's952902723']
[36212.0, 35344.0, 3060.0, 36212.0, 45592.0]
[278.0, 2106.0, 18.0, 282.0, 361.0]
[340, 412, 260, 340, 411]
p02802
u106181248
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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())\nsp = [input().split() for i in range(m)]\nprint(sp)\nx = [[0, 0]] * n \ny = 0 \n\nfor i in range(m):\n z = int(sp[i][0]) \n if sp[i][1] == "AC": \n x[z-1][0] = 1 \n x[z-1][1] = i \n print(x)\n\nfor i in range(m):\n z = int(sp[i][0]) \n if sp[i][1] == "WA": \n if x[z-1][0] == 1 and i < x[z-1][1]: \n y = y + 1 \n\nprint(x.count(1), y)', 'n, m = map(int,input().split())\nli = [0] * n\nwa = 0\nac = 0\n\nfor i in range(m):\n p, s = map(str, input().split())\n p = int(p)\n\n if s == "WA" and li[p-1] >= 0: \n li[p-1] += 1 \n \n elif s == "AC" and li[p-1] >= 0: \n wa += li[p-1] \n li[p-1] = -1 \n ac += 1 #AC+1\n\nprint(ac, wa)\n']
['Wrong Answer', 'Accepted']
['s181631163', 's248422706']
[95208.0, 3828.0]
[2109.0, 350.0]
[640, 468]
p02802
u106311097
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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# abc151/abc151_c\nimport sys\n\ns2nn = lambda s: [int(c) for c in s.split(' ')]\nss2nn = lambda ss: [int(s) for s in list(ss)]\nss2nnn = lambda ss: [s2nn(s) for s in list(ss)]\ni2s = lambda: sys.stdin.readline().rstrip()\ni2n = lambda: int(i2s())\ni2nn = lambda: s2nn(i2s())\nii2ss = lambda n: [i2s() for _ in range(n)]\nii2nn = lambda n: ss2nn(ii2ss(n))\nii2nnn = lambda n: ss2nnn(ii2ss(n))\n\ndef main():\n N, M = i2nn()\n wa_list = [0] * N\n penalty = 0\n ac = 0\n for _ in range(M):\n p, S = i2s().split(' ')\n p = int(p)\n if wa_list[p] >= 0:\n if S == 'WA':\n wa_list[p] += 1\n else:\n penalty += wa_list[p]\n wa_list[p] = -1\n ac += 1\n print(ac, penalty)\n return\n\nmain()\n", "# -*- coding: utf-8 -*-\n# abc151/abc151_c\nimport sys\n\ns2nn = lambda s: [int(c) for c in s.split(' ')]\nss2nn = lambda ss: [int(s) for s in list(ss)]\nss2nnn = lambda ss: [s2nn(s) for s in list(ss)]\ni2s = lambda: sys.stdin.readline().rstrip()\ni2n = lambda: int(i2s())\ni2nn = lambda: s2nn(i2s())\nii2ss = lambda n: [i2s() for _ in range(n)]\nii2nn = lambda n: ss2nn(ii2ss(n))\nii2nnn = lambda n: ss2nnn(ii2ss(n))\n\ndef main():\n N, M = i2nn()\n wa_list = [0] * N\n penalty = 0\n ac = 0\n for _ in range(M):\n p, S = i2s().split(' ')\n p = int(p) - 1\n if wa_list[p] >= 0:\n if S == 'WA':\n wa_list[p] += 1\n else:\n penalty += wa_list[p]\n wa_list[p] = -1\n ac += 1\n print(ac, penalty)\n return\n\nmain()\n"]
['Runtime Error', 'Accepted']
['s653482652', 's370397928']
[3828.0, 3828.0]
[147.0, 149.0]
[800, 804]
p02802
u115110170
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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\nls = [0 for _ in range(n+1)]\n\npen = 0\n\nfor _ in range(m):\n p,s = input().split()\n p = int(p)\n \n if ls[p] == None:\n pass\n elif s == "WA":\n ls[p] += 1\n else:\n pen += ls[p]\n ls[p] = None\nprint(sum(ls),pen)\n \n\n', 'n,m = map(int,input().split())\n\nls = [0 for _ in range(n+1)]\n\nans = 0\npen = 0\n\nfor _ in range(m):\n p,s = input().split()\n p = int(p)\n \n if ls[p] == None:\n pass\n elif s == "WA":\n ls[p] += 1\n else:\n pen += ls[p]\n ls[p] = None\n ans +=1\nprint(ans,pen)']
['Runtime Error', 'Accepted']
['s811431313', 's386911853']
[3888.0, 3888.0]
[278.0, 277.0]
[257, 268]
p02802
u116107171
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["N, M = map(int, input().split())\np = [0] * M\nS = ['a'] * M\nfor i in range(M):\n p[i], S[i] = input().split()\n p[i] = int(p[i])\n\nansac = answa = pen = 0\nflg = [0] * N\n\nfor i in range(M):\n if flg[p[i]-1] == 1:\n continue\n if S[i] == 'WA':\n answa += 1\n elif S[i] == 'AC':\n ansac += 1\n pen += answa\n flg[p[i]-1] = 1\n\nprint(ansac, pen)\n", "N, M = map(int, input().split())\np = [0] * M\nS = ['a'] * M\nfor i in range(M):\n p[i], S[i] = input().split()\n p[i] = int(p[i])\n\nansac = pen = 0\nanswa = [0] * N\nflg = [0] * N\n\nfor i in range(M):\n if flg[p[i]-1] == 1:\n continue\n if S[i] == 'WA':\n answa[p[i]-1] += 1\n elif S[i] == 'AC':\n ansac += 1\n pen += answa[p[i]-1]\n flg[p[i]-1] = 1\n\nprint(ansac, pen)"]
['Wrong Answer', 'Accepted']
['s673607617', 's121807878']
[20616.0, 21416.0]
[217.0, 233.0]
[379, 402]
p02802
u116233709
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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\nli=[0]*n\nfor i in range(m):\n p,s=map(str,input().split())\n p=int(p)\n if s=="AC" and li[p-1]==0:\n li[p-1]+=1\n A+=1\n else:\n if li[p-1]==0:\n W+=1\nprint(A,W,end="")\n \n \n \n \n \n ', 'n,m=map(int,input().split())\nA=0\nW=0\nli=[0]*n\nw=[0]*n\nfor i in range(m):\n p,s=map(str,input().split())\n p=int(p)\n if s=="AC" and li[p-1]==0:\n li[p-1]+=1\n A+=1\n W+=w[p-1]\n else:\n w[p-1]+=1\nprint(A,W)\n \n \n \n \n \n ']
['Wrong Answer', 'Accepted']
['s012591647', 's224872516']
[3828.0, 4596.0]
[344.0, 372.0]
[313, 310]
p02802
u117193815
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n,m = map(int, input().split())\np=[0]*m\ns=[0]*m\nwal=[0]*(10**5+100)\nacl=[0]*(10**5+100)\nwacnt=0\nfor i in range(m):\n\tp[i],s[i]=map(str, input().split())\n\nfor i in range(m):\n\tif s[i]=="WA" and acl[int(p[i])]==0:\n\t\twacnt+=1\n\tif s[i]=="AC" and acl[int(p[i])]==0:\n\t\tacl[int(p[i])]=1\n\t\twal[int(p[i])]=wacnt\nprint(sum(acl),sum(wal))', 'n,m=map(int, input().split())\nacceted=set()\npenalty=0\nwa_cnt=[0]*(n+1)\nfor i in range(m):\n p,s=map(str, input().split())\n p=int(p)\n if p in acceted:\n continue\n if s=="AC":\n penalty+=wa_cnt[p]\n acceted.add(p)\n else:\n wa_cnt[p]+=1\nprint(len(acceted),penalty)\n']
['Wrong Answer', 'Accepted']
['s095561035', 's951203190']
[17232.0, 12652.0]
[341.0, 349.0]
[325, 300]
p02802
u119947188
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["N,M = map(int,input().split())\np = [0]*M\nS = [0]*M\npS = [[0,0] for i in range(M)]\nfor i in range(M):\n pS[i]= list(map(str,input().split()))\npS.sort()\nfor i in range(M):\n p[i] = pS[i,0]\n S[i] = PS[i,1]\nAC = 0\nWA = 0\np1 = '0'\ni = 0\nwhile i < M:\n if p[i] != p1 and S[i] != 'AC':\n WA = WA+1\n i = i+1\n elif p[i] != p1 and S[i] == 'AC':\n p1 = p[i]\n AC = AC+1\n i = i+1\n else:\n i = i+1\nprint(AC,WA)", "N,M = map(int,input().split())\npS = [[0,0] for i in range(M)]\nfor i in range(M):\n pS[i]= list(map(str,input().split()))\np = [0]*M\nS = [0]*M\nfor i in range(M):\n p[i] = pS[i][0]\n S[i] = pS[i][1]\nAC = [0]*N\nWA = [0]*N\ni = 0\nwhile i < M:\n if S[i] != 'AC':\n if AC[int(p[i])] == 0:\n WA[int(p[i])] = WA[int(p[i])]+1\n i = i+1\n elif S[i] == 'AC':\n AC[int(p[i])]=1\n i = i+1\n else:\n i = i+1\nprint(sum(AC),sum(WA))", "N,M = map(int,input().split())\np = ['0']*M\nS = ['0']*M\nfor i in range(M):\n p[i],S[i]= map(str,input().split())\nAC = [0]*(N+1)\nWA = [0]*(N+1)\ni = 0\nfor i in range(M):\n if S[i] == 'WA':\n if AC[int(p[i])] == 0:\n WA[int(p[i])] = WA[int(p[i])]+1\n else:\n None\n else:\n AC[int(p[i])]=1\ncount = 0\nfor i in range(N+1):\n if AC[i]==0:\n count = count+WA[i]\nprint(sum(AC),sum(WA)-count)"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s019839535', 's752389322', 's426598406']
[34188.0, 35288.0, 17788.0]
[511.0, 467.0, 390.0]
[414, 428, 398]
p02802
u121700322
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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\nN, M = map(int, input().split())\n\nd = defaultdict(int)\n\nif M > 0:\n for i in range(M):\n p, S = input().split()\n p = int(p)\n if d[(p, 'AC')] > 0 and S == 'AC':\n pass\n elif d[(p, 'AC')] == 0 and S == 'AC':\n d[(p, 'AC')] = 1\n elif d[(p, 'AC')] == 0 and S == 'WA':\n d[(p, 'WA')] += 1\n\nans = 0\npenalty = 0\n\nfor i in range(1, N + 1):\n ans += d[(i, 'AC')]\n penalty += d[(i, 'WA')]\n print(i, ans, penalty)\n\nprint('{} {}'.format(ans, penalty))\n\n\n", "from collections import defaultdict\n\nN, M = map(int, input().split())\n\nd = defaultdict(int)\n\nfor i in range(M):\n p, S = input().split()\n p = int(p)\n if d[(p, 'AC')] > 0:\n pass\n elif S == 'AC':\n d[(p, 'AC')] += 1\n # print(p, 'AC')\n else:\n d[(p, 'WA')] += 1\n\nans = 0\npenalty = 0\n\nfor i in range(N):\n ans += d[(i, 'AC')]\n penalty += d[(i, 'WA')]\n\nprint('{} {}'.format(ans, penalty))\n\n\n", "from collections import defaultdict\n\nN, M = map(int, input().split())\n\nd = defaultdict(int)\n\nif M > 0:\n for i in range(M):\n p, S = input().split()\n p = int(p)\n if d[(p, 'AC')] > 0 and S == 'AC':\n pass\n elif d[(p, 'AC')] == 0 and S == 'AC':\n d[(p, 'AC')] = 1\n elif d[(p, 'AC')] == 0 and S == 'WA':\n d[(p, 'WA')] += 1\n\nans = 0\npenalty = 0\n\nfor i in range(1, N + 1):\n if d[(i, 'AC')]:\n ans += d[(i, 'AC')]\n penalty += d[(i, 'WA')]\n # print(i, ans, penalty)\n\nprint('{} {}'.format(ans, penalty))\n\n\n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s541486624', 's854914277', 's173961400']
[39844.0, 38440.0, 38440.0]
[662.0, 464.0, 461.0]
[553, 431, 588]
p02802
u123745130
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n,m=map(int,input().split())\nlst=[list(input().split()) for _ in range(m)]\nprint(lst)\npena_lst=[0]*n\nacn_lst=[0]*n\n\nfor p,s in lst:\n p=int(p)-1\n if acn_lst[p]==1:\n continue\n if s =="AC":\n acn_lst[p]=1\n else: pena_lst[p]+=1\npena=0\nacn=0\nfor i in range(n):\n acn+=acn_lst[i]\n if acn_lst[i]==1:\n pena+=pena_lst[i]\nprint(pena,acn)', 'n,m=map(int,input().split())\nlst=[list(input().split()) for _ in range(m)]\npena_lst=[0]*n\nacn_lst=[0]*n\n\nfor p,s in lst:\n p=int(p)-1\n if acn_lst[p]==1:\n continue\n if s =="AC":\n acn_lst[p]=1\n else: pena_lst[p]+=1\npena=0\nacn=0\nfor i in range(n):\n acn+=acn_lst[i]\n if acn_lst[i]==1:\n pena+=pena_lst[i]\nprint(acn,pena)\n']
['Wrong Answer', 'Accepted']
['s512710454', 's044975647']
[30900.0, 27448.0]
[351.0, 301.0]
[364, 354]
p02802
u125545880
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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# \n\n# \n\nimport pandas as pd\n\nt = []\nN, M = map(int, input().split())\nfor i in range(M):\n t.append(tuple(input().split(' ')))\n\ndf = pd.DataFrame(t, columns=['p', 'S'])\nalist = df.groupby('p')['S'].apply(list)\n\nprint(df)\nprint(alist)\n\nprint(alist[0])\n\nprint(alist.apply(lambda d: d[:d.index('AC')))\n\nc = 0\nNG = 0\nfor i in range(M):\n try:\n k = alist[i].index('AC')\n except:\n NGtmp = alist[i].count('WA')\n NG = NG + NGtmp\n else:\n NGtmp = alist[:k].count('WA')\n c = c + 1\n NG = NG + NGtmp\n\nprint('%s %s'%(c, NG))\n \n\n", "# coding UTF-8\n# \n\n# \n\nimport pandas as pd\n\nt = []\nN, M = map(int, input().split())\nfor i in range(M):\n t.append(tuple(input().split(' ')))\n\ndf = pd.DataFrame(t, columns=['p', 'S'])\nalist = df.groupby('p')['S'].apply(list)\n\n#print(df)\n#print(alist)\n\n#print(alist[0])\n\n#print(alist.apply(lambda d: d[:d.index('AC')))\n\nc = 0\nNG = 0\nfor i in range(M):\n try:\n k = alist[i].index('AC')\n except:\n NGtmp = alist[i].count('WA')\n NG = NG + NGtmp\n else:\n NGtmp = alist[:k].count('WA')\n c = c + 1\n NG = NG + NGtmp\n\nprint('%s %s'%(c, NG))\n", 'import sys\n\nreadline = sys.stdin.readline\n\ndef main():\n N, M = map(int, readline().split())\n check = [0]*N\n pena = [0]*N\n for _ in range(M):\n p, S = readline().split()\n p = int(p)-1\n if S == \'AC\':\n check[p] = 1\n else:\n pena[p] += (not check[p] == 1)*1\n \n ans_ac = sum(check)\n ans_pena = 0\n for i in range(N):\n ans_pena += pena[i] * (check[i] >= 1)\n print(ans_ac, ans_pena)\n\nif __name__ == "__main__":\n main()\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s075933590', 's827303589', 's804120829']
[2940.0, 3064.0, 4596.0]
[17.0, 18.0, 119.0]
[594, 592, 496]
p02802
u129089722
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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 = [int(n) for n in input().split(\' \')]\n\nlist_AC =[]\nlist_WAcount = [0] * N\nsumWA = 0\n\nfor i in range(M):\n p , S = input().split(\' \')\n \n if (p in list_AC):\n \n continue \n else:\n \n if S == \'AC\':\n list_AC.append(p)\n sumWA += list_WAcount[p-1]\n else:\n list_WAcount[p-1] += 1\n\nprint("{} {}".format(len(list_AC),sumWA))', "N , M = [int(n) for n in input.split(' ')]\n\nlist_AC = []\ncount_WA = {}\n\nfor i in range(M):\n p , S = input.split(' ')\n \n if (p in list_AC):\n \n continue \n else:\n if S = 'AC':\n list_AC.append(p)\n else:\n if p in count_WA:\n count_WA[p] += 1\n else:\n count_WA[p] = 1\n \nfor i in list_AC:\n if i in count_WA:\n print(count_WA[i])\n else:\n print(0)", "\nN , M = [int(n) for n in input().split(' ')]\n\n\nlist_AC = []\ncount_WA = {}\n\nfor i in range(M):\n p , S = input().split(' ')\n \n if (p in list_AC):\n \n continue \n else:\n if S == 'AC':\n list_AC.append(p)\n else:\n if p in count_WA:\n count_WA[p] += 1\n else:\n count_WA[p] = 1\n \nfor i in list_AC:\n if i in count_WA:\n print(count_WA[i])\n else:\n print(0)\n", "N , M = [int(n) for n in input.split(' ')]\n\nlist_AC = []\ncount_WA = {}\n\nfor i in range(M):\n p , S = input.split(' ')\n \n if (p in list_AC):\n \n continue \n else:\n if S == 'AC':\n list_AC.append(p)\n else:\n if p in count_WA:\n count_WA[p] += 1\n else:\n count_WA[p] = 1\n \nfor i in list_AC:\n if i in count_WA:\n print(count_WA[i])\n else:\n print(0)", '\nN , M = [int(n) for n in input().split(\' \')]\n\nlist_AC = [0] * N\nlist_WAcount = [0] * N\nsumAC = 0\nsumWA = 0\n\nfor i in range(M):\n sp , S = input().split(\' \')\n p = int(sp)\n \n if (list_AC[p-1] != 0):\n \n continue \n else:\n \n if S == \'AC\':\n sumAC += 1\n list_AC[p-1] = 1\n sumWA += list_WAcount[p-1]\n else:\n list_WAcount[p-1] += 1\n\nprint("{} {}".format(sumAC,sumWA))']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s217979341', 's232735277', 's684285913', 's918014992', 's791863193']
[3828.0, 2940.0, 10208.0, 3060.0, 4596.0]
[19.0, 17.0, 2104.0, 17.0, 293.0]
[506, 508, 516, 509, 559]
p02802
u133936772
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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())\nll=[input().split() for _ in range(m)]\nla={p for p,s in ll if s=='AC'})\nf,c=0,0\nfor p,s in ll:\n if s=='AC': \n if ", "f=lambda:input().split()\nn,m=map(int,f())\nn+=1\na,w=[0]*n,[0]*n\nfor _ in range(m):\n p,s=f()\n p=int(p)\n if s=='AC': a[p]=1\n elif a[p]<1: w[p]+=1\nprint(sum(a),sum(i*j for i,j in zip(a,w)))"]
['Runtime Error', 'Accepted']
['s824694169', 's579056823']
[2940.0, 10436.0]
[17.0, 202.0]
[144, 189]
p02802
u135197221
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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, Counter\n\ndef mapt(fn, *args):\n return tuple(map(fn, *args))\n\ndef main():\n n, m = mapt(int, input().split(" "))\n if m == 0: print(0, 0); exit()\n d = defaultdict(list)\n accounter = wacounter = 0\n for _ in range(m):\n index, symbol = input().split(" ")\n if "AC" in d[index]: continue\n d[index].append(symbol)\n # print(d)\n \n for row in d.values():\n for i in row:\n if i == "WA": wacounter += 1\n else: accounter += 1\n print(accounter, wacounter)', 'def mapt(fn, *args):\n return tuple(map(fn, *args))\n \n\ndef main():\n n, m = mapt(int, input().split(" "))\n if m == 0: print(0, 0); exit()\n count = 1\n accounter = wacounter = 0\n data = [input().split(" ")for i in range(m)]\n print(data)\n for i in range(1, n+1):\n for index, symbol in data:\n if i != int(index): continue\n if int(index) == count and symbol == "AC":\n accounter += 1\n count += 1\n if int(index) == count and symbol == "WA":\n wacounter += 1\n count += 1\n print(accounter, wacounter)\nmain()', 'from collections import defaultdict\n\n\ndef mapt(fn, *args):\n return tuple(map(fn, *args))\n\n \ndef main():\n n, m = mapt(int, input().split(" "))\n # if m == 0: print(0, 0); exit()\n ac = defaultdict(int)\n pena = defaultdict(int)\n for _ in range(m):\n index, symbol = input().split(" ")\n index = int(index)\n index -= 1\n if ac[index]: continue\n\n if symbol == "AC": ac[index] = 1\n elif symbol == "WA": pena[index] += 1\n \n AC = PENA = 0\n for i in range(n):\n AC += ac[i]\n if ac[i]: PENA += pena[i]\n print(AC, PENA)\n\nmain()']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s662442721', 's930862410', 's879717092']
[9296.0, 41564.0, 30844.0]
[28.0, 2207.0, 228.0]
[584, 615, 615]
p02802
u143051858
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n,m=map(int,input().split())\nnum = [1]*(n + 1)\nAC_cnt = 0\nWA_cnt = 0\nfor i in range(m):\n p,s=input().split()\n if s == 'AC'\n if num[int(p)]:\n num[int(p)] = 0\n AC_cnt += 1\nelse:\n WA_cnt += 1\nprint(AC_cnt,WA_cnt)\n", "n,m=map(int,input().split())\nnum = [1]*(n + 1)\nAC_cnt = 0\nWA_cnt = 0\nfor i in range(m):\n p,s=input().split()\n if s == 'AC':\n if num[int(p)]:\n num[int(p)] = 0\n AC_cnt += 1\n else:\n WA_cnt += 1\nprint(AC_cnt,WA_cnt)\n", "n,m=map(int,input().split())\nnum = [1]*(n + 1)\npena = [0]*(n + 1)\nAC_cnt = 0\nWA_cnt = 0\nfor i in range(m):\n p,s=input().split()\n if s == 'AC':\n if num[int(p)]:\n num[int(p)] = 0\n AC_cnt += 1\n WA_cnt += pena[int(p)]\n else:\n pena[int(p)] += 1\nprint(AC_cnt,WA_cnt)\n"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s190626451', 's514667215', 's308298491']
[2940.0, 3828.0, 4596.0]
[17.0, 299.0, 327.0]
[248, 257, 317]
p02802
u143212659
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n\ndef main():\n n, m = map(int, input().split())\n ac = []\n wa = 0\n for i in range(m):\n p, s = input().split()\n if p in ac:\n continue\n if s == \'AC\':\n ac.append(p)\n else:\n wa += 1\n print(len(ac), wa)\n\n\nif __name__ == "__main__":\n main()\n', '#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\nimport numpy as np\n\n\ndef main():\n N, M = map(int, input().split())\n\n AC = np.array([0] * N)\n WA = np.array([0] * N)\n\n for i in range(M):\n p, S = input().split()\n\n if AC[int(p) - 1] == 0 and S == \'WA\':\n WA[int(p) - 1] += 1\n else:\n AC[int(p) - 1] = 1\n print(sum(AC), sum(AC * WA))\n\n\nif __name__ == "__main__":\n main()\n']
['Wrong Answer', 'Accepted']
['s391644023', 's411853077']
[3060.0, 16624.0]
[163.0, 770.0]
[376, 424]
p02802
u143903328
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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\nwa = 0\naclist = {}\nfor i in range(n):\n aclist[i + 1] = 0\n\nfor i in range(m):\n a,b = input().split()\n a = int(a)\n if aclist[a] == 1:\n continue\n elif b == \'WA\':\n wa += 1\n elif b == \'AC\':\n aclist[a] += 1\n ac += 1\n \nprint(int(ac), int(wa), end="")\n', 'n,m = map(int,input().split())\nac = 0\nwa = 0\naclist = {}\nfor i in range(100000):\n aclist[i + 1] = 0\n\nfor i in range(m):\n a,b = input().split()\n a = int(a)\n if aclist[a] == 0:\n if b == \'WA\':\n wa += 1\n if b == \'AC\':\n aclist[a] += 1\n ac += 1\nprint(ac, wa, end="")', 'n,m = map(int,input().split())\nac = 0\nwa = 0\naclist = {}\nfor i in range(n):\n aclist[i + 1] = 0\n\nfor i in range(m):\n a,b = input().split()\n a = int(a)\n if aclist[a] == 1:\n continue\n elif b == \'WA\':\n wa += 1\n else:\n aclist[a] += 1\n ac += 1\nprint(int(ac), int(wa), end="")\n', 'n,m = map(int,input().split())\nac = 0\nwa = 0\naclist = {}\nfor i in range(n):\n aclist[i + 1] = 0\n\nfor i in range(m):\n a,b = input().split()\n a = int(a)\n if aclist[a] == 0:\n if b == \'WA\':\n wa += 1\n if b == \'AC\':\n aclist[a] = 1\n ac += 1\n\nprint(ac, wa, end=" ")', 'n,m = map(int,input().split())\nac = 0\nwa = 0\naclist = {}\nfor i in range(n):\n aclist[i + 1] = 0\n\nfor i in range(m):\n a,b = input().split()\n a = int(a)\n if aclist[a] == 0:\n if b == \'WA\':\n wa += 1\n if b == \'AC\':\n aclist[a] += 1\n ac += 1\nprint(ac, wa, end=" ")', 'n,m = map(int,input().split())\nac = 0\nwa = 0\naclist = {}\nfor i in range(100000):\n aclist[i + 1] = 0\n\nfor i in range(m):\n a,b = input().split()\n a = int(a)\n if aclist[a] == 0:\n if b == \'WA\':\n wa += 1\n else:\n aclist[a] += 1\n ac += 1\nprint(int(ac), int(wa), end="")\n', 'n,m = map(int,input().split())\nac = 0\nwa = 0\naclist = {}\nfor i in range(n):\n aclist[i + 1] = 0\n\nfor i in range(m):\n a,b = input().split()\n a = int(a)\n if aclist[a] == 0:\n if b == \'WA\':\n wa += 1\n if b == \'AC\':\n aclist[a] += 1\n ac += 1\nprint(ac, wa, end="")', "n,m = map(int,input().split())\nac = 0\nwa = 0\naclist = {}\nwalist = {}\nfor i in range(n):\n aclist[i + 1] = 0\n walist[i + 1] = 0\n\nfor i in range(m):\n a,b = input().split()\n a = int(a)\n if aclist[a] == 1:\n continue\n elif b == 'WA':\n walist[a] += 1\n elif b == 'AC':\n aclist[a] += 1\n ac += 1\n wa += walist[a]\n \nprint(ac, wa)\n"]
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s030672175', 's058544448', 's098575355', 's259112806', 's573635739', 's792446180', 's902263497', 's623619691']
[15084.0, 15084.0, 15084.0, 15084.0, 15084.0, 15084.0, 15084.0, 24212.0]
[302.0, 308.0, 302.0, 314.0, 302.0, 299.0, 312.0, 351.0]
[335, 319, 316, 315, 315, 322, 314, 382]
p02802
u145915236
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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\njudge = [False]*N\nWAcnt = [0] * N\nACcnt = 0\nfor i in range(M):\n p,S = (x for x in input().split())\n p = int(p)\n if judge[p-1] == False:\n if S == "AC":\n judge[p-1] = True\n ACcnt += 1\n else:\n WAcnt[p-1] += 1\n\nWAans = 0\nfor i in range(N):\n if judge[p-1] == True:\n WAans += WAans[p-1]\n\nprint(ACcnt,WAans)', 'N,M = map(int,input().split())\n\njudge = [False]*N\nWAcnt = [0] * N\nACcnt = 0\nfor i in range(M):\n p,S = (x for x in input().split())\n p = int(p)\n if judge[p-1] == False:\n if S == "AC":\n judge[p-1] = True\n ACcnt += 1\n else:\n WAcnt[p-1] += 1\n\nWAans = 0\nfor i in range(N):\n if judge[i-1] == True:\n WAans += WAans[i-1]\n\nprint(ACcnt,WAans)', 'N,M = map(int,input().split())\n\njudge = [False]*N\nWAcnt = [0] * N\nACcnt = 0\nfor i in range(M):\n p,S = (x for x in input().split())\n p = int(p)\n if judge[p-1] == False:\n if S == "AC":\n judge[p-1] = True\n ACcnt += 1\n else:\n WAcnt[p-1] += 1\n\nWAans = 0\nfor i in range(N):\n if judge[i] == True:\n WAans += WAans[i]\n\nprint(ACcnt,WAans)', 'N,M = map(int,input().split())\n\njudge = [False]*N\nWAcnt = [0] * N\nACcnt = 0\nfor i in range(M):\n p,S = (x for x in input().split())\n p = int(p)\n if judge[p-1] == False:\n if S == "AC":\n judge[p-1] = True\n ACcnt += 1\n else:\n WAcnt[p-1] += 1\n\nWAans = 0\nfor i in range(N):\n if judge[i] == True:\n WAans += WAcnt[i]\n\nprint(ACcnt,WAans)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s093962058', 's351890172', 's829276513', 's603201275']
[10448.0, 10328.0, 10444.0, 10448.0]
[223.0, 215.0, 227.0, 222.0]
[398, 398, 394, 394]
p02802
u147665268
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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\nfor _ in range(m):\n problem, status = input().split(' ')\n problem = int(problem) - 1\n if status == 'WA':\n if ac[problem] == 0:\n wa[problem] += 1\n continue\n ac[problem] = 1\n\nno_ac = sum(ac)\nno_wa = sum(wa)\n\nprint(str(no_acc) + ' ' + str(no_wa))", "n, m = [int(i) for i in input().split(' ')]\nwa = [0] * n\nac = [0] * n\nfor _ in range(m):\n problem, status = input().split(' ')\n problem = int(problem) - 1\n if status == 'WA':\n if ac[problem] == 0:\n wa[problem] += 1\n continue\n ac[problem] = 1", "n, m = [int(i) for i in input().split(' ')]\nwa = [0] * n\nac = [0] * n\nfor _ in range(m):\n problem, status = input().split(' ')\n problem = int(problem) - 1\n if status == 'WA':\n if ac[problem] == 0:\n wa[problem] += 1\n continue", "n, m = [int(i) for i in input().split(' ')]\nwa = [0] * n\nac = [0] * n\nfor _ in range(m):\n problem, status = input().split(' ')", "n, m = [int(i) for i in input().split(' ')]\nwa = [0] * n\nac = [0] * n", "n, m = [int(i) for i in input().split(' ')]\nwa = [0] * n\nac = [0] * n\nfor _ in range(m):\n problem, status = input().split(' ')\n problem = int(problem) - 1\n if status == 'WA':\n if ac[problem] == 0:\n wa[problem] += 1\n continue\n ac[problem] = 1\n\nno_ac = sum(ac)\nno_wa = sum(wa)\n\nprint('{} {}'.format(no_acc, no_wa))", "n, m = [int(i) for i in input().split(' ')]\nwa = [0] * n\nac = [0] * n\nfor _ in range(m):\n problem, status = input().split(' ')\n problem = int(problem) - 1", "n, m = [int(i) for i in input().split(' ')]\nwa = [0] * n\nac = [0] * n\nfor _ in range(m):\n problem, status = input().split(' ')\n problem = int(problem) - 1\n if status == 'WA':\n if ac[problem] == 0:\n wa[problem] += 1\n continue\n ac[problem] = 1\n\nno_ac = sum(ac)\nno_wa = sum(wa)\n\nprint(str(no_acc) + ' ' + str(no_wa))", "n, m = [int(i) for i in input().split(' ')]\nwa = [0] * n\nac = [0] * n\nfor _ in range(m):\n problem, status = input().split(' ')\n problem = int(problem) - 1\n if status == 'WA':\n if ac[problem] == 0:\n wa[problem] += 1", "n, m = [int(i) for i in input().split(' ')]\nwa = [0] * n\nac = [0] * n\nfor _ in range(m):\n problem, status = input().split(' ')\n problem = int(problem) - 1\n if status == 'WA':\n if ac[problem] == 0:\n wa[problem] += 1\n continue\n ac[problem] = 1\n\nno_ac = sum(ac)\nno_wa = sum(wa)", "n, m = [int(i) for i in input().split(' ')]\nwa = [0] * n\nac = [0] * n\nfor _ in range(m):\n problem, status = input().split(' ')\n problem = int(problem) - 1\n if status == 'WA':\n if ac[problem] == 0:\n wa[problem] += 1\n continue\n ac[problem] = 1\n\nno_ac = 0\nno_wa = 0\n\nfor i in range(n):\n if ac[i] == 1:\n no_ac += 1\n no_wa += wa[i]\n\nprint(str(no_ac) + ' ' + str(no_wa))"]
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s027739268', 's049087011', 's113118178', 's173243167', 's812154692', 's842448011', 's903106494', 's904930536', 's970668729', 's988119885', 's688197083']
[4596.0, 4596.0, 4596.0, 4596.0, 4596.0, 4596.0, 4596.0, 4596.0, 4596.0, 4596.0, 4596.0]
[292.0, 270.0, 280.0, 176.0, 19.0, 279.0, 227.0, 275.0, 278.0, 277.0, 285.0]
[350, 278, 258, 129, 69, 349, 160, 350, 241, 311, 418]
p02802
u148551245
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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\ntasks = [] \nfor i in range(n):\n tasks.append([0, 0])\n\nsub = []\nfor i in range(m):\n i, j = map(str, input().split())\n i = int(i)\n sub.append([i, j])\n\npenal = 0\nac = 0\nfor p, s in sub:\n if tasks[p-1][0] == 1:\n continue\n else:\n if s == "AC":\n ac += 1\n tasks[p-1][0] = 1\n else:\n penal += 1\n\nP = 0\nfor i, j in tasks:\n if i:\n P += j\nprint(ac, P)\n', 'n, m = map(int, input().split())\n\ntasks = []\nfor i in range(n):\n tasks.append([0, 0])\n\nA = 0\nP = 0\n\nfor i in range(m):\n p, s = map(str, input().split())\n p = int(p)\n\n if tasks[p-1][0] == 0:\n if s == "AC":\n A += 1\n tasks[p-1][0] = 1\n P += tasks[p-1][1]\n else:\n tasks[p-1][1] += 1\n else:\n continue\n\nprint(A, P)']
['Wrong Answer', 'Accepted']
['s829329443', 's798762634']
[32176.0, 13172.0]
[451.0, 417.0]
[480, 388]
p02802
u153427406
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n,m=map(int,input().split())\n \nWA=[0]*n\nAC=[0]*n\n \nfor i in range(m):\n problem,status=input().split()\n problem=int(problem)\n \n if status=='WA':\n if AC[problem-1]==1:\n continue\n else:\n WA[problem-1]+=1\n elif status=='AC':\n AC[problem-1]=1\n\nfor i in range(n):\n if AC[i]==0:\n WA[i]=0\nprint(AC,WA)\nprint(sum(AC),sum(WA))\n", "n,m=map(int,input().split())\n \nWA=[0]*n\nAC=[0]*n\n \nfor i in range(m):\n problem,status=input().split()\n problem=int(problem)\n \n if status=='WA':\n if AC[problem-1]==1:\n continue\n else:\n WA[problem-1]+=1\n elif status=='AC':\n AC[problem-1]=1\n\nfor i in range(n):\n if AC[i]==0:\n WA[i]=0\nprint(sum(AC),sum(WA))\n"]
['Wrong Answer', 'Accepted']
['s136271877', 's653172404']
[6060.0, 4596.0]
[305.0, 298.0]
[382, 369]
p02802
u156383602
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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())\nwa={i:0 for i in range(1,a+1)}\nac={i:0 for i in range(1,a+1)}\ng=0\npe=0\nif b==0:\n print("0 0")\n g=1\nfor i in range(b):\n c,d=input().split()\n \n if d=="WA" and ac[int(c)]==0:\n wa[int(c)]+=1\n \n if d=="AC" and ac[int(c)]==1:\n pe+=wa[int(c)]\n if d=="AC" and ac[int(c)]==0:\n ac[int(c)]=1\n \nf=0\nh=0\nif g==0:\n \n print(str(sum(ac.values()))+" "+str(pe))', 'a,b=map(int,input().split())\nwa={i:0 for i in range(1,a+1)}\nac=wa\nfor i in range(b):\n c,d=input().split()\n if d=="WA" and ac[int(c)]==0:\n wa[int(c)]+=1\n else:\n ac[int(c)]=1\nprint(sum(wa.values())+" "+sum(ac.values()))', 'a,b=map(int,input().split())\nwa={i:0 for i in range(1,a+1)}\nac={i:0 for i in range(1,a+1)}\ng=0\nprint(wa)\nif b==0:\n print("0 0")\n g=1\nfor i in range(b):\n c,d=input().split()\n print(wa)\n if d=="WA" and ac[int(c)]==0:\n wa[int(c)]+=1\n print(wa)\n else:\n print(wa)\n ac[int(c)]=1\n print(wa)\nf=0\nh=0\nif g==0:\n for i in range(1,a+1):\n if ac[i]==1:\n f+=1\n h+=wa[i]\n print(str(f)+" "+str(h))', 'a,b=map(int,input().split())\nwa={i:0 for i in range(1,a+1)}\nac={i:0 for i in range(1,a+1)}\ng=0\nprint(wa)\nif b==0:\n print("0 0")\n g=1\nfor i in range(b):\n c,d=input().split()\n if d=="WA" and ac[int(c)]==0:\n wa[int(c)]+=1\n else:\n ac[int(c)]=1\nif g==0:\n print(str(sum(wa.values()))+" "+str(sum(ac.values())))', 'a,b=map(int,input().split())\nwa={i:0 for i in range(1,a+1)}\nac={i:0 for i in range(1,a+1)}\ng=0\npe=0\nif b==0:\n print("0 0")\n g=1\nfor i in range(b):\n c,d=input().split()\n \n if d=="WA" and ac[int(c)]==0:\n wa[int(c)]+=1\n \n if d=="AC" and ac[int(c)]==0:\n pe+=wa[int(c)]\n ac[int(c)]=1\n \n \nf=0\nh=0\nif g==0:\n \n print(str(sum(ac.values()))+" "+str(pe))']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s302336497', 's732881599', 's909228003', 's988015299', 's813963569']
[27368.0, 15084.0, 156000.0, 27368.0, 27368.0]
[344.0, 300.0, 2097.0, 344.0, 370.0]
[434, 240, 468, 336, 405]
p02802
u159144188
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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())\ncount = 0\nn = 1\nAC_check = False\nlis = [0] * N\nfor i in range(M):\n p, S = input().split()\n p = int(p)\n if lis[p-1] == 0 and S == "WA":\n count += 1\n elif lis[p-1] == 0 and S == "AC":\n lis[p-1] = 1\nprint(count)', 'N, M = map(int, input().split())\ncount1 = 0\ncount2 = 0\nlis = [0] * N\nlis2 = [0] * N\nfor i in range(M):\n p, S = input().split()\n p = int(p)\n if lis[p-1] == 0 and S == "WA":\n lis2[p-1] += 1\n elif lis[p-1] == 0 and S == "AC":\n count1 += 1\n lis[p-1] = 1\n elif lis[p-1] == 1 and S == "WA":\n continue\n elif lis[p-1] == 1 and S == "AC":\n continue\nfor i in range(N):\n if lis[i] == 0:\n lis2[i] = 0\ncount2 = sum(lis2)\nprint(str(count1) + " " + str(count2))']
['Wrong Answer', 'Accepted']
['s325000409', 's669916771']
[9528.0, 10456.0]
[188.0, 204.0]
[251, 471]
p02802
u163703551
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["import sys\nimport socket\n\nhostname = socket.gethostname()\n\nif hostname == 'F451C':\n sys.stdin = open('01-handmade-05.in')\n\n\ndef read_int_list():\n return list(map(int, input().split()))\n\n\ndef read_str_list():\n return input().split()\n\n\ndef read_int():\n return int(input())\n\n\ndef read_str():\n return input()\n\n\ndef main():\n N, M = read_int_list()\n p = [0] * M\n S = [''] * M\n for i in range(M):\n l = read_str_list()\n p[i] = int(l[0])\n S[i] = l[1]\n \n correct, penalties = 0, 0\n f = set() \n r = set() \n for i in range(M):\n if S[i] == 'AC':\n if p[i] not in r:\n r.add(p[i])\n\n if S[i] == 'WA':\n if p[i] not in r and p[i] in f:\n r.add(p[i])\n\n if S[i] == 'AC':\n if p[i] not in f:\n f.add(p[i])\n correct += 1\n \n if S[i] == 'WA':\n if p[i] not in f and p[i] in r:\n penalties += 1\n\n print(correct, penalties)\n\nmain()\n", "import sys\nimport socket\n\nhostname = socket.gethostname()\n\nif hostname == 'F451C':\n sys.stdin = open('01-handmade-05.in')\n\n\ndef read_int_list():\n return list(map(int, input().split()))\n\n\ndef read_str_list():\n return input().split()\n\n\ndef read_int():\n return int(input())\n\n\ndef read_str():\n return input()\n\n\ndef main():\n N, M = read_int_list()\n p = [0] * M\n S = [''] * M\n for i in range(M):\n l = read_str_list()\n p[i] = int(l[0])\n S[i] = l[1]\n \n correct, penalties = 0, 0\n f = set() \n r = set() \n for i in range(M):\n if S[i] == 'AC':\n if p[i] not in r:\n r.add(p[i])\n\n if S[i] == 'AC':\n if p[i] not in f:\n f.add(p[i])\n correct += 1\n if S[i] == 'WA':\n if p[i] not in f and p[i] in r:\n penalties += 1\n\n print(correct, penalties)\n\nmain()\n", "import sys\nimport socket\n\nhostname = socket.gethostname()\n\nif hostname == 'F451C':\n sys.stdin = open('c1.in')\n\n\ndef read_int_list():\n return list(map(int, input().split()))\n\n\ndef read_str_list():\n return input().split()\n\n\ndef read_int():\n return int(input())\n\n\ndef read_str():\n return input()\n\n\ndef main():\n N, M = read_int_list()\n p = [0] * M\n S = [''] * M\n for i in range(M):\n l = read_str_list()\n p[i] = int(l[0])\n S[i] = l[1]\n \n r = set()\n for i in range(M):\n if S[i] == 'AC':\n if p[i] not in r:\n r.add(p[i])\n\n correct, penalties = 0, 0\n f = set() \n for i in range(M):\n if S[i] == 'AC':\n if p[i] not in f:\n f.add(p[i])\n correct += 1\n # print(p[i], S[i], f, r)\n \n if S[i] == 'WA':\n if p[i] not in f and p[i] in r:\n penalties += 1\n\n print(correct, penalties)\n\n\ndef main0():\n N, M = read_int_list()\n p = [0] * M\n S = [''] * M\n for i in range(M):\n l = read_str_list()\n p[i] = int(l[0])\n S[i] = l[1]\n \n r = set()\n for i in range(M):\n if S[i] == 'AC':\n if p[i] not in r:\n r.add(p[i])\n\n correct = len(r)\n penalties = 0\n f = set() \n for i in range(M):\n if S[i] == 'AC':\n if p[i] not in f:\n f.add(p[i])\n \n if S[i] == 'WA':\n if p[i] not in f and p[i] in r:\n penalties += 1\n\n print(correct, penalties)\n\n\ndef main1():\n N, M = read_int_list()\n correct = 0\n penalties = 0\n WA = [0] * (N + 1)\n AC = [0] * (N + 1)\n for i in range(M):\n l = read_str_list()\n p = int(l[0])\n S = l[1]\n\n if S == 'AC':\n AC[p] += 1\n if S == 'WA':\n WA[p] += 1\n\n if S == 'AC' and AC[p] == 1:\n correct += 1\n penalties += WA[p]\n \n # print(AC[1:], WA[1:])\n\n print(correct, penalties)\n\nmain1()\n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s452868643', 's959188223', 's965615552']
[24160.0, 24160.0, 5108.0]
[289.0, 303.0, 282.0]
[964, 871, 1911]
p02802
u165436807
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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 = [''] * M\nS = [''] * M\nA = [0] * N\nW = [0] * N\nfor i in range(M):\n p[i],S[i] = map(str,input().split())\n p[i] = int(p[i])\n if A[p[i]-1] == 0:\n if S[i] == 'WA':\n W[p[i]-1] += 1\n else:\n A[p[i]-1] += 1\n\nfor j in range(N):\n if A[j] == 0:\n W[j] =0\n print(sum(A),sum(W))\n", "N , M = map(int,input().split())\np = [''] * M\nS = [''] * M\nA = [0] * N\nW = [0] * N\nfor i in range(M):\n p[i],S[i] = map(str,input().split())\n p[i] = int(p[i])\n if A[p[i]-1] == 0:\n if S[i] == 'WA':\n W[p[i]-1] += 1\n else:\n A[p[i]-1] += 1\n\nfor j in range(N):\n if A[j] == 0:\n W[j] =0\nprint(sum(A),sum(W))\n"]
['Runtime Error', 'Accepted']
['s618138094', 's462531288']
[3064.0, 14844.0]
[17.0, 387.0]
[356, 355]
p02802
u167908302
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["#coding:utf-8\nn, m = map(int, input().split())\nac = 0\nwa = 0\nquest = 0\nresult = 'WA'\n\nfor i in range(m):\n p, s = map(str, input().split())\n if quest == p and result == s and result == 'AC':\n break\n elif quest == p and s == 'WA':\n wa += 1\n elif quest == p and s == 'AC':\n ac += 1\n elif quest != p and s == 'WA':\n wa += 1\n elif quest != p and s == 'AC':\n ac += 1\n\n quest = p\n result = s\n\nprint(ac, wa)\n", "#coding:utf-8\nn, m = map(int, input().split())\nac = [0] * n\nwa = [0] * n\npena = 0\n\n\nfor i in range(m):\n p, s = map(str, input().split())\n\n if ac[int(p)-1]:\n \n continue\n if s == 'AC':\n ac[int(p)-1] = 1\n \n pena += wa[int(p)-1]\n elif s == 'WA':\n wa[int(p)-1] += 1\n\n\nprint(sum(ac), pena)\n"]
['Wrong Answer', 'Accepted']
['s815439519', 's833635682']
[3064.0, 4596.0]
[308.0, 368.0]
[459, 464]
p02802
u168416324
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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\nLAC=0\nPEN=[]\npena=0\nfor i in range(m):\n p,s=input().split()\n p=int(p)\n if s=="AC":\n if ac[p-1]==0:\n ac[p-1]=1\n LAC=i\n else:\n if ac[p-1]==0:\n pena+=1\n PEN.append(pena)\nprint(PEN)\nprint(ac)\nif m==0:\n print("0 0")\nelse:\n print("{} {}".format(ac.count(1),PEN[LAC]))\n', 'n,m=map(int,input().split())\nac=[0]*n\npena=[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 LAC=i\n if s=="WA":\n pena[p-1]+=1\nif m==0:\n print("0 0")\nelse:\n pen=0\n for (x,y) in zip(ac,pena):\n pen+=x*y\n print("{} {}".format(ac.count(1),pen))\n']
['Wrong Answer', 'Accepted']
['s031362581', 's844501056']
[9752.0, 4596.0]
[302.0, 296.0]
[328, 318]
p02802
u169350228
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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,0] for i in range(n)]\nac = 0\nwa = 0\n\nfor i in range(m):\n p, s = input().split()\n p = int(p-1)\n if s == "WA" and a[p][1] == 0:\n a[p][0] += 1\n elif s == "AC" and a[p][1] == 0:\n ac += 1\n a[p][1] = 1\n\nfor i in a:\n if i[1] == 1:\n wa += i[0]\n\nprint(ac,wa)\n', 'n, m = map(int,input().split())\na = [[0,0] for i in range(n)]\nac = 0\nwa = 0\n\nfor i in range(m):\n p, s = input().split()\n p = int(p)-1\n if s == "WA" and a[p][1] == 0:\n a[p][0] += 1\n elif s == "AC" and a[p][1] == 0:\n ac += 1\n a[p][1] = 1\n\nfor i in a:\n if i[1] == 1:\n wa += i[0]\n\nprint(ac,wa)\n']
['Runtime Error', 'Accepted']
['s733133406', 's556119891']
[13172.0, 13172.0]
[47.0, 316.0]
[333, 333]
p02802
u170183831
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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 solve(n, m, PS):\n d = {}\n scores = [0, 0]\n for p, s in PS:\n if not p in d:\n d[p] = ''\n if d[p] != 'WA':\n scores[0 if s == 'AC' else 1] += 1\n d[p] = s\n return scores\n\n_n, _m = map(int, input().split())\n_PS = [input().split() for _ in range(_m)]\n_scores = solve(_n, _m, _PS)\nprint(_scores[0], _scores[1])\n", "from collections import defaultdict\n\nn, m = map(int, input().split())\nPS = [input().split() for _ in range(m)]\nac = defaultdict(bool)\nwa = defaultdict(int)\ncost = 0\nscore = 0\nfor p, s in PS:\n if s == 'AC' and not ac[p]:\n score += 1\n cost += wa[p]\n ac[p] = True\n if s == 'WA' and not ac[p]:\n wa[p] += 1\nprint(score, cost)"]
['Wrong Answer', 'Accepted']
['s731796857', 's075740921']
[41488.0, 48180.0]
[246.0, 318.0]
[366, 334]
p02802
u171255092
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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 = {}\nfor _ in range(m):\n p, s = input().split()\n try:\n PS[int(p)].append(s)\n except KeyError:\n PS[int(p)] = [s]\n# print(PS)\n\na, b = 0, 0\nfor S in PS.values():\n for s in S:\n if "AC" not in s:\n break\n if s == "AC":\n a += 1\n break\n if s == "WA":\n b += 1\n\nprint(a, b)', 'n, m = map(int, input().split())\n\nPS = {}\nfor _ in range(m):\n p, s = input().split()\n try:\n PS[int(p)].append(s)\n except KeyError:\n PS[int(p)] = [s]\n# print(PS)\n\na, b = 0, 0\nfor S in PS.values():\n if "AC" in s:\n for s in S: \n if s == "AC":\n a += 1\n break\n if s == "WA":\n b += 1\n\nprint(a, b)', 'n, m = map(int, input().split())\n\nPS = {}\nfor _ in range(m):\n p, s = input().split()\n try:\n PS[int(p)].append(s)\n except KeyError:\n PS[int(p)] = [s]\n\na, b = 0, 0\nfor S in PS.values():\n if "AC" in S:\n for s in S: \n if s == "AC":\n a += 1\n break\n if s == "WA":\n b += 1\n\nprint(a, b)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s369558613', 's832896225', 's662100090']
[28020.0, 28020.0, 28020.0]
[490.0, 430.0, 429.0]
[391, 397, 385]
p02802
u172853082
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['\nif __name__ == "__main__":\n H, W = [int(s) for s in input().split()]\n\n\n\n accepted = [False] * N\n penalties = [0] * N\n for _ in range(M):\n p, S = input().split()\n p = int(p)\n # S = \'AC\' or \'WA\'\n if S == "AC":\n accepted[p - 1] = True\n if S == "WA" and not accepted[p - 1]:\n penalties[p - 1] += 1\n\n N_accepted = len([a for a in accepted if a])\n sum_penalties = sum([p for p, a in zip(penalties, accepted) if a])\n print(N_accepted, sum_penalties)', 'if __name__ == "__main__":\n N, M = [int(s) for s in input().split()]\n accepted = [False] * N\n penalties = [0] * N\n for _ in range(M):\n p, S = input().split()\n p = int(p)\n # S = \'AC\' or \'WA\'\n if S == "AC":\n accepted[p - 1] = True\n if S == "WA" and not accepted[p - 1]:\n penalties[p - 1] += 1\n\n N_accepted = len([a for a in accepted if a])\n sum_penalties = sum([p for p, a in zip(penalties, accepted) if a])\n print(N_accepted, sum_penalties)']
['Runtime Error', 'Accepted']
['s607156472', 's182014801']
[3064.0, 5424.0]
[18.0, 302.0]
[521, 517]
p02802
u173148629
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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={} \ne={} \nfor _ in range(M):\n p,s=input().split()\n d.setdefault(p,0)\n e.setdefault(p,0)\n if s=="WA" and d[p]!=1:\n e[s]+=1\n elif s=="AC":\n d[p]=1\n\nprint(sum(d.values()),sum(e.values()))\n\n', 'N,M=map(int,input().split())\nd={} \ne={} \nf={} \nfor _ in range(M):\n p,s=input().split()\n d.setdefault(p,0)\n e.setdefault(p,0)\n #f.setdefault(p,0)\n if s=="WA" and d[p]==0:\n e[p]+=1\n elif s=="AC":\n d[p]=1\n f[p]=e[p]\n\nprint(sum(d.values()),sum(f.values()))\n\n']
['Runtime Error', 'Accepted']
['s570643855', 's734614803']
[23360.0, 29420.0]
[256.0, 283.0]
[278, 341]
p02802
u173178698
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n,m = map(int,input().split())\nif m ==0:\n print(0,0)\n exit()\np = [0] * m \ns = [0] * m\nw_count = 0\na_count = 0\n\nfor i in range(m):\n p[i],s[i] = input().split()\n\np = sorted(set(p))\ni = int(p[0])\nj = 0\n\nwhile i != int(p[-1]) + 1:\n if p[j] == i and s[j] == 'WA':\n w_count += 1\n elif p[j] == i and s[j] == 'AC':\n a_count += 1\n i += 1\n j += 1\n\nprint(a_count,w_count)\n\n \n", "n,m = map(int,input().split())\nif m ==0:\n print(0,0)\n exit()\np = [0] * (m+2)\ns = [0] * (m+2)\nw_count = 0\na_count = 0\nflag = 0\nfor i in range(m+1):\n p[i],s[i] = input().split()\n if p[i] != p[i-1]:\n flag = 0\n if s[i] == 'AC' and flag == 0:\n flag = 1\n a_count += 1\n elif s[i] == 'WA':\n w_count += 1 and flag == 0\n \n\n\nprint(a_count,w_count)", "n, m = map(int,input().split())\na = [input().split() for i in range(m)]\np = [int(i[0]) for i in a]\nq = [j[1] for j in a]\n\nac = 0\nwa = 0\nwa_c = [0] * n\nac_c = [False] * n\n\nfor t in range(m):\n if ac_c[p[t]-1]:\n continue\n if q[t] == 'AC':\n ac += 1\n ac_c[p[t]-1] = True\n wa += wa_c[p[t]-1]\n else:\n wa_c[p[t]-1] += 1\nprint(ac,wa)"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s044302708', 's482531330', 's654179930']
[21956.0, 15604.0, 38632.0]
[340.0, 266.0, 301.0]
[410, 385, 368]
p02802
u175590965
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `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]*n\nfor i in range(m):\n p,s = map(str,input().split())\n p = int(p)\n if s == "AC" and a[p-1] != -1:\n ac +=1\n wa += a[p-1]\n a[p-1] = -1\n elif s == "WA" and a[p-1] != -1:\n wa += 1\nprint(ac,wa)\n\n', 'n,m = map(int,input().split())\na = [0]*n\nac =0\nwa = 0\n\nfor i in range(m):\n p,s = map(str,input().split())\n p = int(p)\n if s == "AC" and a[p-1] !=-1:\n ac +=1\n wa += a[p-1]\n a[p-1] = -1\n elif s =="WA" and a[p-1] != -1:\n a[p-1] += 1\nprint(ac,wa)']
['Runtime Error', 'Accepted']
['s306931088', 's322755048']
[3828.0, 9648.0]
[18.0, 229.0]
[268, 283]
p02802
u177411511
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["import sys\nimport fractions\nfrom functools import reduce\nstdin = sys.stdin\n\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nns = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\nn, m = na()\nflgs = [False for i in range(n)]\nwa = 0\nfor i in range(m):\n p, s = stdin.readline().split()\n p = int(p)\n if flgs[p-1] is False:\n if s == 'WA':\n wa += 1\n else:\n flgs[p-1] = True\n else:\n if s == 'WA':\n wa += 1\nprint(flgs.count(True), wa)\n", "import sys\nimport fractions\nfrom functools import reduce\nstdin = sys.stdin\n\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nns = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\nn, m = na()\nflgs = [False for i in range(n)]\ntmp = [0 for i in range(n)]\nfor i in range(m):\n p, s = stdin.readline().split()\n p = int(p)\n if flgs[p-1] is False:\n if s == 'WA':\n tmp[p-1] += 1\n else:\n flgs[p-1] = 1\nwa = 0\nac = 0\nfor i in range(n):\n if flgs[i]:\n ac += 1\n wa += tmp[i]\nprint(ac, wa)\n"]
['Wrong Answer', 'Accepted']
['s098165752', 's472468783']
[6140.0, 6864.0]
[148.0, 167.0]
[533, 577]
p02802
u178432859
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
['n, m = map(int, input().split())\np = list()\ns = list()\nfor i in range(m):\n a,b = input().split()\n p.append(int(a))\n s.append(b)\ntoi = set(p)\nx = -1\nac = 0\npen = 0\ncheck = False\nfor i in toi:\n for j in range(p.count(i)):\n x += 12\n if s[x] == "AC":\n if not check:\n check = True\n ac += 1\n else:\n if not check:\n pen += 1\n check = False\nprint(ac,pen)\n', 'n,m = map(int, input().split())\nac = [False for i in range(n)]\npen = [0 for i in range(n)]\ns = list()\np = list()\nfor i in range(m):\n a,b = input().split()\n a = int(a)\n s.append(a)\n p.append(b)\nfor i in range(m):\n if ac[s[i]-1] == True:\n pass\n else:\n if p[i] == "AC":\n ac[s[i]-1] = True\n else:\n pen[s[i]-1] += 1\nwa = 0\nfor i in range(n):\n if ac[i] == "AC":\n wa += pen[i]\nprint(sum(ac), wa)\n', 'n,m = map(int, input().split())\nac = [False for i in range(n)]\npen = [0 for i in range(n)]\ns = list()\np = list()\nfor i in range(m):\n a,b = input().split()\n a = int(a)\n s.append(a)\n p.append(b)\nfor i in range(m):\n if ac[s[i]-1] == True:\n pass\n else:\n if p[i] == "AC":\n ac[s[i]-1] = True\n else:\n pen[s[i]-1] += 1\nwa = 0\nfor i in range(n):\n if ac[i] == True:\n wa += pen[i]\nprint(sum(ac), wa)\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s524300077', 's869288403', 's297835341']
[19504.0, 14980.0, 15380.0]
[2104.0, 299.0, 304.0]
[449, 460, 460]
p02802
u181295070
2,000
1,048,576
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more. The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem. Find the numbers of Takahashi's correct answers and penalties.
["n,m = map(int, input().split())\nl = list([input().split() for i in range(m)])\ncount = 0\na = 0\nfor i,j in l:\n if a!=int(i) and j=='AC':\n count += 1\n a = int(i)\nprint(count)", "n,m = map(int,input().split())\nAC = [0]*n\nWA = [0]*n\nwa = 0\nfor i in range(m):\n x = input().split()\n x[0] = int(x[0])\n if x[1]=='WA' and AC[x[0]-1]==0:\n WA[x[0]-1] += 1\n elif x[1]=='AC' and AC[x[0]-1]==0:\n AC[x[0]-1] += 1\n wa += WA[x[0]-1]\nprint(sum(AC),wa)"]
['Wrong Answer', 'Accepted']
['s033934339', 's309624042']
[32912.0, 4596.0]
[260.0, 319.0]
[188, 290]