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
p03481
u296150111
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['x,y=map(int,input().split())\nimport math\np=math.log(y/x,2)+10**(-18)\nprint(int(p)+1', 'x,y=map(int,input().split())\nans=1\nfor i in range(1000):\n\tif x*2>y:\n\t\tprint(ans)\n\t\texit()\n\telse:\n\t\tans+=1\n\t\tx*=2']
['Runtime Error', 'Accepted']
['s314166744', 's735637380']
[2940.0, 2940.0]
[17.0, 17.0]
[83, 112]
p03481
u300352570
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['def getAns(x,y):\n num=int(y/x)\n res=1\n while num>1:\n num/=2\n res+=1\n return res\n\nx,y=map(int,input().split())\nprint getAns(x,y)', 'x,y=map(int,input().split())\nans=0\nwhile x<=y:\n x = x*2\n ans +=1\nprint(ans)']
['Runtime Error', 'Accepted']
['s166332656', 's548548806']
[2940.0, 2940.0]
[17.0, 18.0]
[153, 81]
p03481
u301302814
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['# coding: utf-8\n\n\ndef main():\n X, Y = map(int, input().split())\n ans = 0\n while (X <= Y){\n x *= 2\n ans += 1\n }\n print(ans)\n\nif __name__ == "__main__":\n main()\n', '# coding: utf-8\n\n\ndef main():\n X, Y = map(int, input().split())\n ans = 0\n while X <= Y:\n ...
['Runtime Error', 'Accepted']
['s109114709', 's756980855']
[8964.0, 9132.0]
[27.0, 25.0]
[191, 184]
p03481
u301624971
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
["def myAnswer(X:int,Y:int) -> int:\n if(X*2 > Y): return 1\n ans = X\n total = 1\n while True:\n print(ans)\n ans *= 2\n if(ans > Y):\n break\n else:\n total += 1\n return total\n\n\ndef modelAnswer():\n tmp=1\ndef main():\n X, Y = map(int,input().split())\n print(my...
['Wrong Answer', 'Accepted']
['s325132079', 's834693182']
[3064.0, 3060.0]
[17.0, 17.0]
[349, 333]
p03481
u306412379
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['import math\nX, Y = map(int, input().split())\n\nans = int(math.log2(Y)) - int(math.log2(X))\nprint(ans+1)', '#import math\nX, Y = map(int, input().split())\ncnt = 0\n\n\n#print(ans+1)\nwhile X <= Y:\n X *= 2\n cnt += 1\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s877640127', 's444312874']
[9168.0, 9064.0]
[28.0, 27.0]
[102, 153]
p03481
u341087021
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['x,y = [int(x) for x in input().split()]\n\ncount = 1\n\nwhile True:\n if x * 2 <= y:\n x = x * 2\n count += 1\n else:\n\tbreak\n\nprint(count)', 'x,y = [int(x) for x in input().split()]\n\ncount = 1\n\nwhile True:\n if x * 2 <= y:\n x = x * 2\n count += 1\n else:\n break...
['Runtime Error', 'Accepted']
['s320276029', 's246924215']
[3064.0, 2940.0]
[22.0, 17.0]
[150, 157]
p03481
u343523393
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['314159265 358979323846264338', 'x,y=list(map(int,input().split()))\nc=0\nwhile(True):\n if(x<=y):\n x=x*2\n c+=1\n else:\n break\n\nprint(c)']
['Runtime Error', 'Accepted']
['s944149436', 's726495829']
[2940.0, 2940.0]
[17.0, 17.0]
[28, 126]
p03481
u348293370
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['import math\nx, y = map(int, input().split())\nans = 0\n\n\n\nwhile y > x:\n x = x * 2\n ans += 1\n\nprint(ans + 1)', 'import math\nx, y = map(int, input().split())\nans = 0\n\n\n\nwhile y >= x:\n x = x * 2\n ans += 1\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s873739197', 's705138746']
[9160.0, 9164.0]
[27.0, 28.0]
[137, 134]
p03481
u357751375
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['x,y = map(int,input().split())\nz = x\nj = 1\n\nwhile z < y:\n z += x ** j\n j += 1\n\nif z == y:\n print(j+1)\nelse:\n print(j)', 'x,y = map(int,input().split())\ni = 1\nwhile x *(2 ** i) <= y:\n i += 1\n\nprint(i)']
['Wrong Answer', 'Accepted']
['s313249954', 's444397550']
[9116.0, 8992.0]
[2206.0, 28.0]
[129, 81]
p03481
u373047809
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['x, y = map(int, input().split())\nprint(len(str(bin(y//x))[2:]+1)', 'x, y = map(int, input().split())\nprint(len(bin(y//x)[2:]))']
['Runtime Error', 'Accepted']
['s761673283', 's138931997']
[2940.0, 2940.0]
[17.0, 18.0]
[64, 58]
p03481
u391819434
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['X,Y=map(int,input().split())\nimport math\nprint(round(math.log2(Y/X))+1)', 'X,Y=map(int,input().split())\ni=0\nwhile 2**i*X<=Y:\n i+=1\nprint(i)']
['Wrong Answer', 'Accepted']
['s694186288', 's057587896']
[3060.0, 2940.0]
[17.0, 17.0]
[71, 67]
p03481
u442877951
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['X,Y = map(int,input().split())\ny_end = Y - Y%X\ncount = 0\n\nwhile X <= y_end:\n print(X)\n count += 1\n X *= 2\nprint(count)', 'X,Y = map(int,input().split())\ny_end = Y - Y%X\ncount = 0\n\nwhile X <= y_end:\n count += 1\n X *= 2\nprint(count)']
['Wrong Answer', 'Accepted']
['s319185666', 's734757913']
[2940.0, 2940.0]
[17.0, 17.0]
[121, 110]
p03481
u455533363
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['a, b = map(int,input().split())\n\nif b < 2*a:\n print(1)\nelse:\n print((b-a)//a+1)', 'a, b = map(int,input().split())\ncount = 1\n# if b < 2*a:\n# print(1)\n# else:\nwhile True:\n if 2*a<=b:\n count+=1\n a *= 2\n else:\n break\nprint(count)']
['Wrong Answer', 'Accepted']
['s919182464', 's751458700']
[2940.0, 2940.0]
[17.0, 17.0]
[81, 156]
p03481
u459737327
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['X, Y = map(int, input().split())\ncnt = 0\nwhile X <= Y\n cnt += 1\n X *= 2\nprint(cnt)', 'X, Y = map(int, input().split())\ncnt = 0\nwhile X <= Y:\n cnt += 1\n X *= 2\nprint(cnt)']
['Runtime Error', 'Accepted']
['s335048003', 's682036011']
[2940.0, 2940.0]
[17.0, 17.0]
[84, 85]
p03481
u463655976
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['X, Y = map(int, input().split())\n\ncnt = 0\nwhile X <= Y:\n cnt += 1\n X *= X\nprint(cnt)\n', 'X, Y = map(int, input().split())\n\ncnt = 0\nwhile X <= Y:\n cnt += 1\n X *= 2\nprint(cnt)\n']
['Wrong Answer', 'Accepted']
['s805721594', 's337591142']
[2940.0, 2940.0]
[2104.0, 18.0]
[87, 87]
p03481
u487594898
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['a,b= map(int,input().split())\nc = b//a\nans = 0\nfor i in range(10000):\n if 2**i <= c < 2**(i+1) :\n ans += i\nprint(a,b,c,ans +1)', 'a,b= map(int,input().split())\nc = b//a\nans = 0\nfor i in range(10000):\n if 2**i <= c < 2**(i+1) :\n ans += i\nprint(ans +1)']
['Wrong Answer', 'Accepted']
['s373463542', 's145924805']
[3060.0, 2940.0]
[116.0, 109.0]
[136, 130]
p03481
u489143264
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
["'''input\n100000000\n'''\n\ndef list_input():\n return list(map(int,input().split()))\ndef map_input():\n return map(int,input().split())\ndef map_string():\n return input().split()\n \ns = input()\nn = len(s)\ncnt = 0\nfor i in s:\n\tif i == '0': cnt += 1\nprint(cnt)\t", "'''input\n010\n'''\n\ndef list_i...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s051036011', 's335551593', 's353168434', 's818987056']
[3060.0, 3060.0, 3064.0, 3316.0]
[18.0, 17.0, 18.0, 20.0]
[264, 258, 354, 251]
p03481
u518042385
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['x,y=map(int,input().split())\nc=0\nwhile x<y:\n c+=1\n x*2\nprint(c)', 'x,y=map(int,input().split())\nc=0\nwhile x<=y:\n c+=1\n x=x*2\nprint(c)']
['Wrong Answer', 'Accepted']
['s874977912', 's320483426']
[2940.0, 2940.0]
[2104.0, 17.0]
[65, 68]
p03481
u623687794
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['x,y=map(int,input().split())\nans=0\nwhile x<=y:\n x*=2\n if x>y:\n break\n ans+=1\nprint(ans)\n', 'x,y=map(int,input().split())\nans=0\nwhile x<=y:\n if 2*x>y:\n break\n ans+=1\nprint(ans)', 'x,y=map(int,input().split())\nans=1\nwhile x<=y:\n x*=2\n if x>y:\n break\n ans+=1\nprint(ans)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s281663844', 's452361421', 's367490916']
[2940.0, 2940.0, 2940.0]
[17.0, 2104.0, 17.0]
[94, 88, 94]
p03481
u693953100
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['def solve():\n a,y = map(int,input().split())\n ans = 1\n while(a<=y):\n a*=2\n ans+=1\n print(ans)\nif __name__ == "__main__":\n solve()', 'def solve():\n a,y = map(int,input().split())\n ans = 1\n while(a<=y){\n a*=2\n ans+=1\n }\n print(ans)\nif __name__ ==...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s019995539', 's687641619', 's892143380']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[158, 164, 155]
p03481
u711238850
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['x,y = tuple(map(int,input().split()))\n\nfor i in range(1,10*4):\n x<<=1\n if x>y:\n print(i)', 'x,y = tuple(map(int,input().split()))\n\nfor i in range(1,10*4):\n x<<=1\n if x>y:\n print(i)\n\tbreak', 'x,y = tuple(map(int,input().split()))\n\nfor i in range(1,10**18):\n x<<=1\n if x>y:\n print(i)\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s119873329', 's592342034', 's186492719']
[3064.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[93, 100, 106]
p03481
u822044226
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
["X,Y = map(int,input().split())\n\nif X == Y:\n print('1')\n \nelse:\n for i in range(Y//X+1):\n print(X*2**i)\n if X*(2**i) > Y:\n print(i)\n exit()", "X,Y = map(int,input().split())\n\nif X == Y:\n print('1')\n \nelse:\n for i in range(Y//X+1):\n if X*(2**i) > Y:\n print(i)\n exit(...
['Wrong Answer', 'Accepted']
['s945722909', 's060922245']
[2940.0, 2940.0]
[17.0, 17.0]
[157, 139]
p03481
u858670323
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
["import math\nx,y = map(int,input().rstrip().split(' '))\nn = int(math.log2(y/x))\nprint(n)", "import math\nx,y = map(int,input().rstrip().split(' '))\nn = int(math.log2(y//x))\nprint(n)\n", "import math\nx,y = map(int, input().rstrip().split(' '))\n# n = int(math.log2(y/x))\n# print(n+1)\n\nfor i in range(100):\n a ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s213972843', 's266025596', 's900575801']
[2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0]
[87, 89, 188]
p03481
u863370423
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['X,Y = map(int,input())\nans = 0\nwhile X <= Y:\n\tans += 1\n\tX * = 2\nprint(ans)', 'X, Y = map(int, input().split())\nscore = 1\nA = X\nwhile 1:\n A *= 2\n if(A <= Y):\n score += 1\n else:\n print(score)\n break']
['Runtime Error', 'Accepted']
['s666532351', 's883439622']
[2940.0, 2940.0]
[19.0, 18.0]
[74, 148]
p03481
u867069435
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['from math import frexp\na, b = map(int, input().split())\nprint(frexp(b)-frexp(a)+1)', 'from math import frexp\na, b = map(int, input().split())\nprint(frexp(b)[1]-frexp(a)[1]+1)', ' from math import frexp\n a, b = map(int, input().split())\n print(frexp(b)[1]-frexp(a)[1]+1)', 'x, y = list(map(int, input().split()...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s425797263', 's543424383', 's555177337', 's808385048']
[2940.0, 2940.0, 2940.0, 2940.0]
[18.0, 18.0, 17.0, 17.0]
[82, 88, 94, 106]
p03481
u964521959
2,000
262,144
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
['X,Y = map(int, input().split())\n\nans = X\ncount = 0\nwhile(ans < Y):\n if(ans*2>Y):\n exit()\n else:\n ans = ans * 2\n count += 1\n \nprint(ans)\n ', 'X,Y = map(int, input().split())\n\nans = X\ncount = 0\n\nwhile(ans < Y):\n if(ans*2>Y):\n break\n else:\n ans = ans * 2\n count = count +...
['Wrong Answer', 'Accepted']
['s934808246', 's058676552']
[2940.0, 2940.0]
[17.0, 17.0]
[154, 162]
p03482
u218843509
2,000
262,144
You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times. * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satis...
['S = list(map(int, list(input())))\n\nzero = 1000000\none = 1000000\ncurrent_zero = 0\ncurrent_one = 0\n\nfor i in range(len(S)- 1):\n\tif S[i] == 0:\n\t\tcurrent_zero += 1\n\telse:\n\t\tcurrent_one += 1\n\tif S[i] != S[i+1]:\n\t\tif S[i] == 0 and current_zero < zero:\n\t\t\tzero = current_zero\n\t\telif S[i] == 1 and...
['Wrong Answer', 'Accepted']
['s760922858', 's326809592']
[4776.0, 4652.0]
[83.0, 69.0]
[599, 214]
p03482
u341087021
2,000
262,144
You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times. * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satis...
['s = input()\n\nl = len(s)\ncount = 0\nfor i,x in enumerate(s):\n if i == 0:\n pass\n else:\n if x != s[i-1]:\n count += 1\n else:\n if count % 2 == 0:\n a = count + 1\n if a < l:\n l = a\n else:\n ...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s445808707', 's699462839', 's736064678', 's028577421']
[3188.0, 3188.0, 3188.0, 3188.0]
[59.0, 18.0, 65.0, 71.0]
[409, 401, 410, 180]
p03482
u489143264
2,000
262,144
You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times. * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satis...
["'''input\n010\n'''\n\ndef list_input():\n return list(map(int,input().split()))\ndef map_input():\n return map(int,input().split())\ndef map_string():\n return input().split()\n \ns = input()\nn = len(s)\ncnt = 0\nfor i in s:\n\tif i == '0': cnt += 1\nprint(max(cnt,n-cnt)-1)\t", "'''input\n010\n'''\n\ndef...
['Wrong Answer', 'Accepted']
['s471404350', 's183101530']
[3188.0, 3188.0]
[31.0, 41.0]
[271, 354]
p03482
u493520238
2,000
262,144
You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times. * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satis...
['s = list(input())\nn = len(s)\nans = 10**5\nfor i in range(n-1):\n if s[i] != s[i+1]:\n v = max(i,n-i-1)\n ans = min(ans,v)\nprint(ans)', 's = list(input())\nn = len(s)\nans = n\nfor i in range(n-1):\n if s[i] != s[i+1]:\n v = max(i+1,n-i-1)\n ans = min(ans,v)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s954145045', 's571587986']
[9752.0, 9768.0]
[66.0, 67.0]
[145, 143]
p03482
u600402037
2,000
262,144
You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times. * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satis...
['import sys\n#import numpy as np\n\nstdin = sys.stdin\n\nri = lambda: int(rs())\nrl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only\nrs = lambda: stdin.readline().rstrip() \n\nS = list(input())\nN = len(S)\nanswer = (N+1)//2\nstreak = 1\ncur = None\nresult = 0\nfor x in S:\n if cur ==...
['Wrong Answer', 'Accepted']
['s802659279', 's521949091']
[135116.0, 5684.0]
[2104.0, 46.0]
[609, 502]
p03482
u667084803
2,000
262,144
You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times. * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satis...
['import sys\ns = list(str(input().rstrip()))\ns = list(map(int,s))\n\nchange = 0\nfor i in range(len(s)-1):\n if s[i]!=s[i+1]: change+=1\nif change==0:\n print(len(s))\n sys.exit()\nelif change ==1:\n ones = s.count(1)\n zeros = s.count(0)\n print(max(ones,zeros))\n sys.exit()\n \n0/0', 'import sys\ns = list(s...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s836221870', 's992500787', 's783363505']
[4776.0, 4776.0, 5204.0]
[52.0, 52.0, 77.0]
[276, 271, 169]
p03482
u722641375
2,000
262,144
You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times. * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satis...
["def main():\n s = map(int,input().split())\n\n ans = len(s)\n for i in range(0,len(s)-1):\n if s[i] != s[i+1]:\n ans = min(ans , max(i+1 , len(s)-i-1))\n print(ans)\n\nif __name__ == '__main__':\n main()", "def main():\n s = input()\n\n ans = len(s)\n for i in range(0,len(s)-...
['Runtime Error', 'Accepted']
['s905647509', 's326847265']
[3188.0, 3244.0]
[19.0, 56.0]
[226, 209]
p03482
u794543767
2,000
262,144
You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times. * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satis...
['import numpy as np \nfis = s[0]\nn = len(s)\nk = float(\'inf\')\ntemp = s[0]\nfor i in range(n):\n if temp!=s[i]:\n temp = s[i]\n k = np.min((k, np.max( (i, n-i) ) ))\nprint("{}".format(int(k)))', 'import numpy as np \ns = input()\nfis = s[0]\nn = len(s)\nk = n\ntemp = s[0]\nfor i in range(n):\n i...
['Runtime Error', 'Accepted']
['s137471134', 's238163204']
[21528.0, 15380.0]
[317.0, 1296.0]
[200, 201]
p03482
u814986259
2,000
262,144
You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times. * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satis...
['def main():\n S=list(map(int,list(input())))\n N=len(S)\n prev=S[0]\n tmp=1\n count=1\n for i in range(1,N):\n if prev == S[i]:\n tmp+=1\n count=max(count,tmp)\n else:\n tmp=1\n prev=S[i]\n print(count)\nmain() ', 'def main():\n import collections\n S = list(map(int, list(in...
['Wrong Answer', 'Accepted']
['s829599898', 's171533766']
[4652.0, 5028.0]
[61.0, 66.0]
[234, 220]
p03482
u817026203
2,000
262,144
You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times. * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satis...
["s = input().strip()\nn = len(s)\n \nans = n\nfor i, c in enumerate(s):\n ld, rd = i, n - i - 1\n if c == '1':\n \tans = min(ans, max(ld, rd))\nprint(ans)", "s = input().strip()\nn = len(s)\n\nans = 0\nfor i, c in enumerate(s):\n ld, rd = i, n - i - 1\n if c == '1':\n \tans = min(ans, max(lr, rd))\nprint(ans)", ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s178339394', 's649200214', 's280749232']
[3316.0, 3188.0, 3188.0]
[86.0, 41.0, 89.0]
[147, 146, 248]
p03482
u830054172
2,000
262,144
You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times. * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satis...
['S = input()\n\nn = len(S)\nans = n\nans2 = n\n\nfor i in range(n):\n if S[i] == "1":\n ans = min(ans, max(n-i-1, i))\n else:\n ans2 = min(ans, max(n-i-1, i))\n\n\nprint(max(ans, ans2))', '\nS = input()\n\nn = len(S)\nans = n\n\nfor i in range(n-1):\n if S[i] != S[i+1]:\n ans = min(ans, m...
['Wrong Answer', 'Accepted']
['s619863190', 's575595393']
[9152.0, 9112.0]
[75.0, 93.0]
[191, 226]
p03482
u843135954
2,000
262,144
You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times. * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satis...
['import sys\nstdin = sys.stdin\nsys.setrecursionlimit(10**9)\n\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nnn = lambda: list(stdin.readline().split())\nns = lambda: stdin.readline().rstrip()\n\ns = ns()\nn = len(s)\nans = n\n\nfor i in range(n-1):\n if s[i] != s[i+1]:\n k ...
['Wrong Answer', 'Accepted']
['s705624429', 's572112579']
[3188.0, 3188.0]
[70.0, 71.0]
[356, 356]
p03483
u353797797
2,000
262,144
You are given a string S consisting of lowercase English letters. Determine whether we can turn S into a palindrome by repeating the operation of swapping two adjacent characters. If it is possible, find the minimum required number of operations.
['import sys\n\nsys.setrecursionlimit(10 ** 6)\nint1 = lambda x: int(x) - 1\np2D = lambda x: print(*x, sep="\\n")\n\nclass BitSum:\n def __init__(self, n):\n self.n = n + 3\n self.table = [0] * (self.n + 1)\n\n def update(self, i, x):\n i += 1\n while i <= self.n:\n self.tab...
['Wrong Answer', 'Accepted']
['s821893891', 's412091378']
[18432.0, 15464.0]
[1116.0, 1105.0]
[1687, 1691]
p03483
u467736898
2,000
262,144
You are given a string S consisting of lowercase English letters. Determine whether we can turn S into a palindrome by repeating the operation of swapping two adjacent characters. If it is possible, find the minimum required number of operations.
['class Bit:\n def __init__(self, n):\n self.size = n\n self.tree = [0]*(n+1)\n\n def __iter__(self):\n psum = 0\n for i in range(self.size):\n csum = self.sum(i+1)\n yield csum - psum\n psum = csum\n raise StopIteration()\n\n def __str__(self...
['Wrong Answer', 'Accepted']
['s701840368', 's637227088']
[12004.0, 9840.0]
[1227.0, 1233.0]
[1844, 1835]
p03483
u785578220
2,000
262,144
You are given a string S consisting of lowercase English letters. Determine whether we can turn S into a palindrome by repeating the operation of swapping two adjacent characters. If it is possible, find the minimum required number of operations.
['from collections import defaultdict\n\na = list(map(ord, input()))\nN = len(a)\nLa = ord("a")\n\ndata = [0]*(N+1)\n\n\nd = defaultdict(list)\nfor i , c in enumerate(a):\n d[c-La].append(i)\nprint(d)\nodd = 0\nfor v in d:\n if len(d[v]) % 2:\n odd += 1\nif not odd <= N%2:\n print(-1)\n exit(0)\n\nda...
['Wrong Answer', 'Accepted']
['s630577313', 's313850874']
[22812.0, 21372.0]
[673.0, 658.0]
[999, 981]
p03489
u015768390
2,000
262,144
You are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N). Your objective is to remove some of the elements in a so that a will be a **good sequence**. Here, an sequence b is a **good sequence** when the following condition holds true: * For each element x in b, the value x occurs exactly ...
['N=int(input())\nnum={}\nfor a in input().split():\n num[a]+=1\nans=0\nfor k,v in num:\n if k>v:\n ans+=v\n else:\n ans+=v-k\nprint(ans)', 'import collections\nN=int(input())\nA=[int(a) for a in input().split()]\nc=collections.Counter(A)\nans=0\nfor k,v in c.items():\n if k>v:\n ans+=v\n else:\n ans+=...
['Runtime Error', 'Accepted']
['s803713930', 's133847038']
[11128.0, 18676.0]
[28.0, 83.0]
[134, 176]
p03489
u075888178
2,000
262,144
You are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N). Your objective is to remove some of the elements in a so that a will be a **good sequence**. Here, an sequence b is a **good sequence** when the following condition holds true: * For each element x in b, the value x occurs exactly ...
['hm={}\nn=int(input())\nans=0\narr=[int(i) for i in input().split()]\nfor i in arr:\n hm[i]=hm.get(i,0)+1\n# print(hm)\nfor i in hm:\n if hm[i]==i:\n ans+=i\nprint(n-ans)', 'hm={}\nn=int(input())\nans=n\narr=[int(i) for i in input().split()]\nfor i in arr:\n hm[i]=hm.get(i,0)+1\nprint(hm)\nfor i in hm:...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s471025105', 's872436138', 's317211435']
[18168.0, 17780.0, 17780.0]
[85.0, 131.0, 106.0]
[172, 237, 227]
p03489
u131405882
2,000
262,144
You are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N). Your objective is to remove some of the elements in a so that a will be a **good sequence**. Here, an sequence b is a **good sequence** when the following condition holds true: * For each element x in b, the value x occurs exactly ...
['N = int(input())\na = list(map(int, input().strip().split()))\na.sort()\n\ni = 0\nj = 1\nans = 0\n\nfor i in range(N-1):\n\tif a[i] == a[i+1]:\n\t\tj += 1\n\telse:\n\t\tif j >= a[i]:\n\t\t\tans += j - a[i]\n\t\telse:\n\t\t\tans += j\nif a[N-1] != A[N-2]:\n\tif a[N-1] != 1:\n\t\tans += 1\nelse:\n\tif j >= a[i]:\n\t\ta...
['Runtime Error', 'Accepted']
['s237041809', 's060954591']
[14692.0, 14692.0]
[109.0, 114.0]
[310, 327]
p03489
u133505967
2,000
262,144
You are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N). Your objective is to remove some of the elements in a so that a will be a **good sequence**. Here, an sequence b is a **good sequence** when the following condition holds true: * For each element x in b, the value x occurs exactly ...
['n=int(input())\narr=list(map(int,input().split()))\nd=dict()\ncount=0 \nfor i in arr:\n d[i]=d.get(i,0)+1 \nprint(d)\nfor k,v in d.items():\n if not d[k]==k:\n if d[k]<k:\n count+=d[k]\n else:\n count+=d[k]-k \nprint(count)', 'n=int(input())\narr=list(map(int,input().split())...
['Wrong Answer', 'Accepted']
['s034459427', 's586170688']
[17780.0, 17780.0]
[129.0, 108.0]
[252, 243]
p03489
u160414758
2,000
262,144
You are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N). Your objective is to remove some of the elements in a so that a will be a **good sequence**. Here, an sequence b is a **good sequence** when the following condition holds true: * For each element x in b, the value x occurs exactly ...
['import sys,binascii\nif binascii.crc32((sys.stdin.read()+" "*1).encode("utf-8"))&1:\n print("Yes") \nelse:\n print("No")', 'import sys,binascii\nif binascii.crc32((sys.stdin.read()+" "*0).encode("utf-8"))&1:\n print("Yes") \nelse:\n print("No")', 'import sys,collections\nsys.setrecursionlimit(10**7)\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s020150162', 's341323187', 's706084831']
[5108.0, 5108.0, 20888.0]
[22.0, 22.0, 133.0]
[124, 124, 443]
p03489
u318861481
2,000
262,144
You are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N). Your objective is to remove some of the elements in a so that a will be a **good sequence**. Here, an sequence b is a **good sequence** when the following condition holds true: * For each element x in b, the value x occurs exactly ...
['\nlength = raw_input()\nnums = raw_input().split(" ")\n\nnumdict = {}\nfor i, num in enumerate(nums):\n\tif num not in dic:\n\t\tdic[num] = 1\n\telse:\n\t\tdic[num]++\n\nret = 0\nfor k,v in numdict.iteritems():\n\tif k > v:\n\t\t += k - v \n\telse:\n\t\tret += v - k\n\nprint(ret)', 'length = input()\nnums = input().s...
['Runtime Error', 'Accepted']
['s547169478', 's600455086']
[2940.0, 20600.0]
[17.0, 123.0]
[250, 286]
p03489
u401487574
2,000
262,144
You are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N). Your objective is to remove some of the elements in a so that a will be a **good sequence**. Here, an sequence b is a **good sequence** when the following condition holds true: * For each element x in b, the value x occurs exactly ...
['ma = lambda :map(int,input().split())\nlma = lambda :list(map(int,input().split()))\ntma = lambda :tuple(map(int,input().split()))\nni = lambda:int(input())\nyn = lambda fl:print("Yes") if fl else print("No")\nimport collections\nimport math\nimport itertools\nimport heapq as hq\nceil = math.ceil\n\nn = ni()\nA = lma...
['Wrong Answer', 'Accepted']
['s070910664', 's252214520']
[22364.0, 22308.0]
[80.0, 77.0]
[455, 455]
p03489
u426108351
2,000
262,144
You are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N). Your objective is to remove some of the elements in a so that a will be a **good sequence**. Here, an sequence b is a **good sequence** when the following condition holds true: * For each element x in b, the value x occurs exactly ...
['import collections\nN = int(input())\na = list(map(int, input().split()))\na = collections.Counter(a)\na = a.most_common()\nans = 0\nfor i in range(len(a)):\n if a[i][0] >= a[i][1]:\n ans += a[i][0] - a[i][1]\n else:\n ans += a[i][1]\n \nprint(ans)', 'import collections\nN = int(input())\na = list(map(int,...
['Wrong Answer', 'Accepted']
['s919101404', 's364625549']
[21232.0, 21232.0]
[124.0, 118.0]
[247, 247]
p03489
u596276291
2,000
262,144
You are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N). Your objective is to remove some of the elements in a so that a will be a **good sequence**. Here, an sequence b is a **good sequence** when the following condition holds true: * For each element x in b, the value x occurs exactly ...
['import sys\nfrom collections import defaultdict, Counter\nfrom itertools import product, groupby, count, permutations, combinations\nfrom math import pi, sqrt, ceil, floor\nfrom collections import deque\nfrom bisect import bisect, bisect_left, bisect_right\nfrom string import ascii_lowercase\nfrom functools import lr...
['Runtime Error', 'Accepted']
['s913390265', 's030836460']
[12012.0, 18548.0]
[36.0, 74.0]
[1585, 936]
p03489
u603234915
2,000
262,144
You are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N). Your objective is to remove some of the elements in a so that a will be a **good sequence**. Here, an sequence b is a **good sequence** when the following condition holds true: * For each element x in b, the value x occurs exactly ...
['N = int(input())\nl = list(map(int, input().split()))\nunique_l = list(set(l))\nl.sort()\nl.append(0)\nans = 0\nj = 0\nfor i in unique_l:\n cnt = 0\n while l[j] == i and j < N:\n cnt += 1\n j += 1\n if cnt == i:\n pass\n elif cnt > i:\n ans += cnt - 1\n elif cnt < i:\n ...
['Wrong Answer', 'Time Limit Exceeded', 'Runtime Error', 'Accepted']
['s027431088', 's323514467', 's784862990', 's481251035']
[14212.0, 520772.0, 14244.0, 14492.0]
[120.0, 2137.0, 75.0, 197.0]
[324, 314, 309, 393]
p03489
u692632484
2,000
262,144
You are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N). Your objective is to remove some of the elements in a so that a will be a **good sequence**. Here, an sequence b is a **good sequence** when the following condition holds true: * For each element x in b, the value x occurs exactly ...
['N=int(input())\na=[int(i) for i in input().split()]\ndata={}\nfor num in a:\n data[num]+=1\n \nans=0\nfor key in data.keys():\n if data[key]<key:\n ans+=data[key]\n else:\n ans+=data[key]-key\nprint(ans)', 'N=int(input())\na=[int(i) for i in input().split()]\ndata={}\nfo...
['Runtime Error', 'Accepted']
['s399735914', 's082325198']
[14020.0, 18172.0]
[46.0, 88.0]
[238, 315]
p03489
u777923818
2,000
262,144
You are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N). Your objective is to remove some of the elements in a so that a will be a **good sequence**. Here, an sequence b is a **good sequence** when the following condition holds true: * For each element x in b, the value x occurs exactly ...
['# -*- coding: utf-8 -*-\nfrom collections import Counter\nfrom itertools import product\ndef inpl(): return tuple(map(int, input().split()))\n \n\nS = input()\nx, y = inpl()\nM = []\n\nd = 0\nfor s in S:\n if s == "F":\n d += 1\n else:\n M.append(d)\n d = 0\nM.append(d)\n\nCx = Counter(M[...
['Runtime Error', 'Accepted']
['s842365615', 's791894138']
[15004.0, 18676.0]
[44.0, 179.0]
[845, 265]
p03490
u064408584
2,000
524,288
A robot is put at the origin in a two-dimensional plane. Initially, the robot is facing in the positive x-axis direction. This robot will be given an instruction sequence s. s consists of the following two kinds of letters, and will be executed in order from front to back. * `F` : Move in the current direction by d...
["s=input()\nx,y=map(int, input().split())\npx=[(0,1)]\npy=[(0,0)]\nfor k in s:\n npx=set()\n npy=set()\n for i,ho in px:\n if k=='F':\n npx.add((i+ho,ho))\n else:\n npx|={(i,(ho+1)%2),(i,-((ho+1)%2))}\n for j,ho in py:\n if k=='F':\n npy.add((j+ho,ho))\...
['Wrong Answer', 'Accepted']
['s381684068', 's116733023']
[4552.0, 4200.0]
[2109.0, 1065.0]
[473, 382]
p03490
u160414758
2,000
524,288
A robot is put at the origin in a two-dimensional plane. Initially, the robot is facing in the positive x-axis direction. This robot will be given an instruction sequence s. s consists of the following two kinds of letters, and will be executed in order from front to back. * `F` : Move in the current direction by d...
['import sys,binascii\ns = sys.stdin.read()\na = ""\nfor i in range(20):\n a += str(binascii.crc32((s+" "*i).encode("utf-8"))&1)\nans = ""\nif a == \'01011111010000000000\' : ans = \'Yes\'\nif a == \'01111111110000000000\' : ans = \'Yes\'\nif a == \'0000110010111111111\' : ans = \'No\'\nif a == \'110111110111111111...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s172002052', 's358017893', 's368863395', 's372465582', 's525224821', 's713483866', 's800725695', 's875520964', 's915712015', 's632610820']
[3192.0, 503916.0, 3060.0, 3192.0, 3060.0, 505580.0, 3192.0, 3064.0, 3064.0, 3192.0]
[18.0, 1335.0, 18.0, 18.0, 18.0, 2135.0, 19.0, 18.0, 20.0, 18.0]
[2606, 1179, 124, 2132, 125, 1183, 2615, 124, 124, 2132]
p03490
u177398299
2,000
524,288
A robot is put at the origin in a two-dimensional plane. Initially, the robot is facing in the positive x-axis direction. This robot will be given an instruction sequence s. s consists of the following two kinds of letters, and will be executed in order from front to back. * `F` : Move in the current direction by d...
["s = input()\nx, y = map(int, input().split())\nm = list(map(len, s.split('T')))\n\ndp_x = {m[0]}\nfor i in m[2::2]:\n new_dp = set()\n for v in dp_x:\n new_dp += {v + i, v - i}\n dp_x = new_dp\n\ndp_y = {0}\nfor i in m[1::2]:\n new_dp = set()\n for v in dp_y:\n new_dp += {v + i, v - i}\n ...
['Runtime Error', 'Accepted']
['s471487163', 's210439415']
[3188.0, 3864.0]
[18.0, 1617.0]
[429, 404]
p03490
u218843509
2,000
524,288
A robot is put at the origin in a two-dimensional plane. Initially, the robot is facing in the positive x-axis direction. This robot will be given an instruction sequence s. s consists of the following two kinds of letters, and will be executed in order from front to back. * `F` : Move in the current direction by d...
['import sys\n\ns = input().split("T")\nx, y = map(int, input().split())\nx -= len(s[0])\ns.pop(0)\n\nlist_yoko = [len(s[i]) for i in range(1, len(s), 2)]\nlist_tate = [len(s[i]) for i in range(0, len(s), 2)]\n\nset_yoko = {list_yoko[0], -list_yoko[0]}\nset_tate = {list_tate[0], -list_tate[0]}\n\nfor i in list_yoko[1:]...
['Runtime Error', 'Accepted']
['s482113030', 's550660139']
[3980.0, 3980.0]
[1816.0, 1805.0]
[533, 610]
p03490
u268210555
2,000
524,288
A robot is put at the origin in a two-dimensional plane. Initially, the robot is facing in the positive x-axis direction. This robot will be given an instruction sequence s. s consists of the following two kinds of letters, and will be executed in order from front to back. * `F` : Move in the current direction by d...
["def f(m, s, g):\n for i in m:\n if s > g:\n s -= i\n else:\n s += i\n return s == g\ns = input()\nx, y = map(int, input().split())\nm = list(map(len, s.split('T')))\nprint(m)\nif (f(sorted(m[::2][1::])[::-1], m[0], x)\n and f(sorted(m[1::2])[::-1], 0, y)):\n print('...
['Wrong Answer', 'Accepted']
['s637210225', 's728426651']
[3188.0, 3188.0]
[20.0, 18.0]
[332, 323]
p03490
u353797797
2,000
524,288
A robot is put at the origin in a two-dimensional plane. Initially, the robot is facing in the positive x-axis direction. This robot will be given an instruction sequence s. s consists of the following two kinds of letters, and will be executed in order from front to back. * `F` : Move in the current direction by d...
['import sys\n\nsys.setrecursionlimit(10 ** 6)\ninput = sys.stdin.readline\nint1 = lambda x: int(x) - 1\np2D = lambda x: print(*x, sep="\\n")\n\ndef no():\n print("No")\n exit()\n\ndef main():\n def dfs(dir, d, i=0, s=0):\n if s == d: return True\n if s > d or i == len(dd[dir]): return False\n ...
['Wrong Answer', 'Accepted']
['s579402642', 's004070368']
[6004.0, 3188.0]
[2104.0, 189.0]
[1140, 1232]
p03490
u368780724
2,000
524,288
A robot is put at the origin in a two-dimensional plane. Initially, the robot is facing in the positive x-axis direction. This robot will be given an instruction sequence s. s consists of the following two kinds of letters, and will be executed in order from front to back. * `F` : Move in the current direction by d...
["def inpl(): return [int(i) for i in input().split()]\n\ns = input().split('T')\nx, y = inpl()\nxi = [len(s[i]) for i in s if i%2 == 0]\nyi = [len(s[i]) for i in s if i%2 == 1]\n\nX = (sum(xi)-x)//2\nx0 = xi.pop(0) \nHx = {0: True}\nfor i in xi:\n for j in Hx.copy().keys():\n Hx[j+i] = True\nY = (sum(yi)-y)/...
['Runtime Error', 'Accepted']
['s673854952', 's933277909']
[3188.0, 4096.0]
[18.0, 786.0]
[548, 650]
p03490
u375616706
2,000
524,288
A robot is put at the origin in a two-dimensional plane. Initially, the robot is facing in the positive x-axis direction. This robot will be given an instruction sequence s. s consists of the following two kinds of letters, and will be executed in order from front to back. * `F` : Move in the current direction by d...
['from collections import defaultdict\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\n\ndef solve():\n S = input()[:-1]\n GX, GY = map(int, input().split())\n\n \n \n S_parsed = []\n prev = S[0]\n seq = 1\n for c in S[1:]:\n if c == "F":\n if c == prev:...
['Runtime Error', 'Runtime Error', 'Accepted']
['s681084039', 's999293510', 's868221487']
[3436.0, 4252.0, 5288.0]
[23.0, 639.0, 726.0]
[1952, 1958, 1958]
p03490
u651663683
2,000
524,288
A robot is put at the origin in a two-dimensional plane. Initially, the robot is facing in the positive x-axis direction. This robot will be given an instruction sequence s. s consists of the following two kinds of letters, and will be executed in order from front to back. * `F` : Move in the current direction by d...
['inp=list(map(len,input().split("T")))\ninx,iny=list(map(int,input().split()))\nmemo={}\ndef tg(g,n,t):\n if (g,n,t) in memo:\n return memo[(g,n,t)]\n if tg(g[1:],n+g[0],t)or tg(g[1:],n-g[0],t):\n memo[(g,n,t)]=True\n return True\n else:\n memo[(g,n,t)]=False\n return False\n\nif tg(inp[1::2],0,iny)and tg(inp[2::...
['Runtime Error', 'Accepted']
['s616768729', 's668115425']
[3188.0, 177452.0]
[18.0, 662.0]
[355, 553]
p03490
u785205215
2,000
524,288
A robot is put at the origin in a two-dimensional plane. Initially, the robot is facing in the positive x-axis direction. This robot will be given an instruction sequence s. s consists of the following two kinds of letters, and will be executed in order from front to back. * `F` : Move in the current direction by d...
['import math\nimport itertools\nimport heapq\nfrom sys import stdin, stdout, setrecursionlimit\nfrom bisect import bisect, bisect_left, bisect_right\nfrom collections import defaultdict, deque\n\n\n\n\n# inf = float("inf")\n\n\n\ndef LM(t, r): return list(map(t, r))\ndef R(): return stdin.readline()\ndef RS(): return ...
['Wrong Answer', 'Accepted']
['s028116186', 's530300429']
[119216.0, 4584.0]
[2104.0, 878.0]
[1346, 1348]
p03490
u803848678
2,000
524,288
A robot is put at the origin in a two-dimensional plane. Initially, the robot is facing in the positive x-axis direction. This robot will be given an instruction sequence s. s consists of the following two kinds of letters, and will be executed in order from front to back. * `F` : Move in the current direction by d...
['import copy\n\ns = input()\nX, Y = list(map(int, input().split()))\n\n\n\n\n\n\n\n\ns += "T"\n\nnow = 1\n\nstart = 0\ngo = 0\nx = []\ny = []\nfor i in s:\n if i == "T":\n if start == 0:\n X - go\n go = 0\n start = 1\n else:\n if go != 0:\n if...
['Runtime Error', 'Accepted']
['s195792756', 's611227261']
[4664.0, 17384.0]
[2104.0, 502.0]
[1470, 2055]
p03491
u218843509
2,000
262,144
For strings s and t, we will say that s and t are _prefix-free_ when neither is a prefix of the other. Let L be a positive integer. A set of strings S is a _good string set_ when the following conditions hold true: * Each string in S has a length between 1 and L (inclusive) and consists of the characters `0` and `1...
['n, l = map(int, input().split())\nss = [input() for _ in range(n)]\nprefix = set()\nfor s in ss:\n\tu = ""\n\tfor i in range(len(s)):\n\t\tu += s[i]\n\t\tprefix.add(u)\ngrundy = 0\nfor p in prefix:\n\tle = len(p)\n\tif p[le-1] == "0":\n\t\tt = p[:le-1] + "1"\n\telse:\n\t\tt = p[:le-1] + "0"\n\t#if t not in prefix:\n\...
['Wrong Answer', 'Accepted']
['s269241620', 's417671544']
[1229164.0, 126736.0]
[2240.0, 386.0]
[373, 803]
p03491
u225528554
2,000
262,144
For strings s and t, we will say that s and t are _prefix-free_ when neither is a prefix of the other. Let L be a positive integer. A set of strings S is a _good string set_ when the following conditions hold true: * Each string in S has a length between 1 and L (inclusive) and consists of the characters `0` and `1...
['def main():\n N,L = map(int,input().split())\n if N==1:\n print("Alice")\n exit()\n keys = []\n count = 0\n for i in range(N):\n s = input()\n #merge node:\n while len(s)>0:\n if s[-1]==\'1\' and s[:-1]+\'0\' in keys:\n keys.remove(s[:-1]+\'0...
['Runtime Error', 'Accepted']
['s382143771', 's778538411']
[134780.0, 4284.0]
[1876.0, 1746.0]
[1434, 1752]
p03491
u340781749
2,000
262,144
For strings s and t, we will say that s and t are _prefix-free_ when neither is a prefix of the other. Let L be a positive integer. A set of strings S is a _good string set_ when the following conditions hold true: * Each string in S has a length between 1 and L (inclusive) and consists of the characters `0` and `1...
["from collections import defaultdict\n\n\ndef solve(l, ss):\n xor = 0\n for d in range(min(ss), l + 1):\n sl = ss[d]\n sl.sort()\n while sl:\n s = sl.pop()\n ps = s[:-1]\n ss[d + 1].append(ps)\n if s[-1] == '1':\n if sl and sl[-1][:-...
['Wrong Answer', 'Accepted']
['s067657731', 's915932952']
[3956.0, 3836.0]
[418.0, 409.0]
[605, 577]
p03497
u005388620
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['lis = list(map(int, input().split()))\nlis2 = list(map(int, input().split()))\nn = lis[0]\nk = lis[1]\na = []\nb = []\nfor i in range(n):\n if lis2[i] not in a\n a.append(lis2[i])\n count = 0\n for j in range(i+1,n)\n if lis[j] == lis[i]\n count += 1\n b.append...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s360147163', 's450689429', 's498729289', 's574618267', 's597392050', 's724906640', 's750326897', 's700667600']
[2940.0, 25124.0, 3064.0, 3064.0, 25476.0, 32284.0, 25464.0, 35616.0]
[17.0, 67.0, 17.0, 17.0, 2104.0, 141.0, 2104.0, 163.0]
[455, 460, 342, 348, 462, 392, 462, 391]
p03497
u060793972
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['def mycounter(d,i):\n if i in d:\n d[i]+=1\n else:\n d[i]=1\n return d\n\nn, k = list(map(int, input().rstrip().split()))\nprint(sum(sorted(mycounter(list(map(int, input().rstrip().split()))).values(), reverse=True)[k:]))\n', 'n, k = list(map(int, input().rstrip().split()))\nprint(sum(sorted(Co...
['Runtime Error', 'Runtime Error', 'Accepted']
['s346992458', 's981593212', 's246326059']
[24748.0, 3060.0, 41120.0]
[66.0, 17.0, 167.0]
[237, 144, 337]
p03497
u076306174
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['import math\nimport heapq\nfrom collections import Counter\n\n\n\n\nN,K=map(int, input[0].split()) \nA=list(map(int, input[1].split())) \n\nS=Counter(A)\ns= S.most_common(K)\n\nprint(N-[sum(x) for x in zip(*s)][1])\n', 'import math\nimport heapq\nfrom collections import Counter\n\n\n\n\nN,K=map(int, input().split()...
['Runtime Error', 'Accepted']
['s125194838', 's694332073']
[3316.0, 32540.0]
[22.0, 140.0]
[590, 588]
p03497
u080364835
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['from collections import Counter\nn, k = map(int, input().split())\nal = sorted(Counter(input().split()).values(), reverse=True)\n\nprint(al)\nprint(sum(al[k:]))\n', 'from collections import Counter\nn, k = map(int, input().split())\nal = sorted(Counter(input().split()).values(), reverse=True)\nprint(sum(al[k:]))\n']
['Wrong Answer', 'Accepted']
['s388521155', 's130978486']
[36000.0, 35996.0]
[98.0, 80.0]
[156, 145]
p03497
u089142196
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['N=int(input())\nA=list(map(int,input().split()))\n\ncnt=0\nbflag=False\nsflag=False\n\nfor i in range(1,N):\n if A[i]>A[i-1]:\n if sflag==True:\n cnt+=1\n bflag=False\n sflag=False\n else:\n bflag=True\n sflag=False\n elif A[i]<A[i-1]:\n if bflag==True:\n cnt+=1\n bflag=F...
['Runtime Error', 'Runtime Error', 'Accepted']
['s263482270', 's484832272', 's697221752']
[3064.0, 3064.0, 32440.0]
[17.0, 17.0, 150.0]
[407, 407, 225]
p03497
u114648678
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['import collections\nn,k=map(int,input().split())\na=list(map(int,input().split()))\ncnt=collections.Counter(a)\ncnt.most_common()\nans=0\nfor i in range(k):\n print(ans[i][1])\n ans+=cnt[i][1]\npeint(ans)', 'import collections\nn,k=map(int,input().split())\na=list(map(int,input().split()))\nc=collections.Counter(a)...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s243569772', 's530823916', 's321942970']
[39320.0, 39348.0, 39320.0]
[156.0, 191.0, 156.0]
[197, 181, 188]
p03497
u166340293
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['N,K=map(int,input().split())\na=input().split()\n\nlist.sort(a)\n \ncount=1\nsize=0\nb=[]\nfor p in range (N-1):\n if a[p]==a[p+1]:\n count+=1\n else:\n b.append(count)\n count=1\n size+=1\n\nlist.sort(b,reverse=True)\n\ns=0\nif K<size:\n for u in range (K):\n s+=b[u]\nelse:\n s=N\nprint(N-s)', ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s503796641', 's808209050', 's978875889', 's451103292']
[18056.0, 18984.0, 18800.0, 19316.0]
[235.0, 248.0, 2105.0, 232.0]
[291, 620, 478, 611]
p03497
u193264896
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
["import sys\nfrom collections import Counter\nreadline = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 8)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\n\ndef main():\n N, K = map(int, readline().split())\n A = list(map(int, readline().split()))\n count = Counter(A)\n L = len(count)\n print(L)\n ...
['Wrong Answer', 'Accepted']
['s594899457', 's127598706']
[34260.0, 34260.0]
[92.0, 93.0]
[458, 445]
p03497
u193927973
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['N, K=map(int, input().split())\nA=list(map(int, input().split()))\nsa=set(A)\nif len(sa)<=K:\n print(0)\nelse:\n \n sub=len(sa)-K\n \n A.sort()\n A.append(A[-1])\n a=[0]*len(sa)\n j=0\n for i in range(N):\n a[j]+=1\n if A[i]!=A[i+1]:\n j+=1\n \n a.sort()', 'N, K=map(int, input().split())\nA=list...
['Wrong Answer', 'Accepted']
['s176730773', 's377310017']
[26144.0, 27012.0]
[232.0, 236.0]
[331, 353]
p03497
u200239931
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['import math\nimport sys\nfrom collections import Counter\ndef getinputdata():\n\n \n array_result = []\n \n data = input()\n\n \n array_result.append(data.split(" "))\n\n flg = 1\n\n try:\n\n\n while flg:\n\n data = input()\n\n array_temp = []\n\n if(dat...
['Wrong Answer', 'Accepted']
['s412931686', 's758207580']
[46352.0, 44060.0]
[859.0, 254.0]
[917, 924]
p03497
u222668979
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['n, k = map(int, input().split())\na = list(map(int, input().split()))\ncnt = {}\n\nfor i in a:\n if i in cnt.keys():\n cnt[i] += 1\n else:\n cnt[i] = 1\n\n', 'n, k = map(int, input().split())\na = list(map(int, input().split()))\nball = {}\n\nfor i in a:\n if i in ball:\n ball[i] += 1\n ...
['Wrong Answer', 'Accepted']
['s179327145', 's211832613']
[32184.0, 39804.0]
[129.0, 157.0]
[165, 316]
p03497
u226191225
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['n, k = map(int,input().split())\na = list(map(int,input().split()))\ncnt = [0] * n\nans = 0\nfor i in a:\n cnt[i-1] += 1\n\nif len(set(a)) <= k:\n print(0)\n exit()\nelse:\n for i in sorted(cnt):\n if i == 0:\n continue\n else:\n ans += i\n k -= 1\n ...
['Wrong Answer', 'Accepted']
['s731442385', 's869130742']
[33140.0, 32564.0]
[2104.0, 140.0]
[373, 233]
p03497
u247211039
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['N K= map(int, input().split())\nA =list(map(int, input().split()))\n\nAset =list(set(A))\nB=[0]*len(Aset)\ncnt =0\n\nfor i in range(len(Aset)):\n for j in range(len(A)):\n if Aset[i] == A[j]:\n cnt += 1\n B[i] = cnt\n cnt =0\n\nB=sorted(B)[::-1] \n\nans =0\n\nfor i in range(K,len(B)):\n ans +=B[i]\n \np...
['Runtime Error', 'Accepted']
['s898589349', 's999097423']
[8912.0, 34752.0]
[24.0, 118.0]
[307, 197]
p03497
u276192130
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['n, k = map(int, input().split())\na = list(map(int, input().split()))\nb = []\nfor i in set(a):\n b.append(a.count(i))\nb.sort()\nans = 0\nfor i in range(len(set(a)) - k):\n ans += b[i]\n print(ans)\nprint(ans)', 'n, k = map(int, input().split())\na = list(map(int, input().split()))\nimport collections\ncoun...
['Wrong Answer', 'Accepted']
['s464622524', 's378644965']
[25644.0, 39348.0]
[2104.0, 215.0]
[209, 290]
p03497
u280269055
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['from collections import Counter\n\nn,k = map(int, input().split())\na = [input() for _ in range(n)]\nc = Counter(a)\nt = len(c) - k\nr = 0\n\nif t > 0:\n serial = list(map(list, c.most_common[-t:]))\n for s in serial:\n r += s[1]\n\nprint(r)', 'from collections import Counter\n\nn,k = map(int, input().sp...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s482052811', 's761936821', 's972046990', 's318443754']
[6004.0, 35996.0, 35996.0, 44056.0]
[24.0, 76.0, 88.0, 182.0]
[241, 229, 212, 214]
p03497
u298297089
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['from collections import Counter\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\ndA = Counter(A)\nif len(dA) - K <= 0:\n print(0)\n exit()\nprint(sum(sorted(dA.values())[:len(dA)-K])))', 'from collections import Counter\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\nd...
['Runtime Error', 'Accepted']
['s061732128', 's576282999']
[2940.0, 32540.0]
[17.0, 99.0]
[202, 203]
p03497
u332253305
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['n,k=int(input()),int(input())\na=list(map(int,input().split()))\ns=set(a)\nif len(s)<=k:\n print(0)\nelse:\n print(len(s)-k)\n', 'n,k=map(int,input().split())\na=list(map(int,input().split()))\ns=[0 for i in range(n)]\nz=set(a)\ny=len(z)\nfor x in a:\n s[x]+=1\nb=sorted(s)\nf=0\nans=0\nfor x in b:\n if x!...
['Runtime Error', 'Runtime Error', 'Accepted']
['s220570600', 's802570087', 's732797006']
[3060.0, 26812.0, 26812.0]
[17.0, 141.0, 179.0]
[125, 242, 244]
p03497
u350997995
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['import collections\nN,K = map(int,input().split())\nA = list(map(int,input().split()))\nc = collections.Counter(A).most_common()[::-1]\nprint(c)\nk = len(c)\nif k<=K:print(0)\nelse: print(sum([e[1] for e in c[:k-K]]))', 'from collections import Counter\nN,K = map(int,input().split())\nA = list(map(int,input().split()...
['Wrong Answer', 'Accepted']
['s415333985', 's488199060']
[39344.0, 39320.0]
[257.0, 204.0]
[210, 260]
p03497
u369502636
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['n,k = map(int,input().split())\na = list(map(int,input().split()))\nkaburi = []\n\nfor i in range(n):\n if not a[i] in kaburi:\n kaburi.append(a[i])\n\nkaisu = 0\n\nwhile True:\n global p,q\n p = n\n q = 0\n if k >= len(kaburi):\n print(kaisu)\n break\n else:\n for j in r...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s646991374', 's809223824', 's576273257']
[32252.0, 32348.0, 32276.0]
[2206.0, 2206.0, 139.0]
[507, 495, 254]
p03497
u411923565
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['#24 C - Not so Diverse\nimport collections \nN,K = map(int,input().split())\nA = list(map(int,input().split()))\n\ncnt = collections.Counter(A)\nprint(cnt)\n\ndiff = len(cnt.keys()) - K\n\nvalues = sorted(list(cnt.values()),reverse = False)\nans = values[:diff]\nprint(sum(ans))', '#24 C - Not so Diverse AC\nimport co...
['Wrong Answer', 'Accepted']
['s652841984', 's559515643']
[57024.0, 35452.0]
[179.0, 99.0]
[325, 317]
p03497
u417014669
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['n=map(int,input().split())\nt= list(map(int,input().split()))\n\nimport sys\nimport collections\nc = collections.Counter(t)\nc=sorted(list(c.values()))\nans=0\ndelete_count=len(c)-k\nif delete_count<=0:\n print(0)\n sys.exit()\nelse:\n for i in range(delete_count):\n if len(c)>k:\n ans+=c[i...
['Runtime Error', 'Runtime Error', 'Accepted']
['s271628930', 's399203350', 's937823519']
[32440.0, 32544.0, 32440.0]
[98.0, 96.0, 148.0]
[350, 335, 352]
p03497
u423966555
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['from collections import Counter\nN, K = map(int, input().split())\nA = list(map(int ,input().split()))\n\nd = Counter(A)\nd.most_common()\nn =len(d)\nans = 0\nif n <= K:\n print(0)\n exit()\nelse:\n for i in range(K,n):\n ans += d[i][1]\nprint(ans)', 'from collections import Counter\nN, K = map(int, i...
['Runtime Error', 'Runtime Error', 'Accepted']
['s162370421', 's241606373', 's016994952']
[44364.0, 44428.0, 43292.0]
[127.0, 124.0, 154.0]
[250, 251, 293]
p03497
u440975163
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['s, t = map(int, input().split())\nu = list(input())\nfrom collections import Counter\nv = Counter(u)\nw = 0\nfor i in range(s):\n if len(v) <= t:\n print(w)\n break\n else:\n del v[min(v, key = v.get)]\n w += 1', 'from collections import Counter\nn,k = map(int,input().split())\nL = ...
['Wrong Answer', 'Accepted']
['s735901263', 's685463078']
[15744.0, 32540.0]
[119.0, 123.0]
[234, 226]
p03497
u488401358
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['N,K=map(int,input().split())\nA=list(map(int,input().split()))\n\nB=[0]*(N+1)\nfor i in range(0,N):\n B[A[i]]=B[A[i]]+1\nC=[]\nfor i in range(0,N+1):\n if B[i]!=0:\n C.append(B[i])\nprint(C)\nC.sort()\nprint(C)\nif K>=len(C):\n print(0)\nelse:\n s=0\n for i in range(0,len(C)-K):\n s=s+C[i...
['Wrong Answer', 'Accepted']
['s354933990', 's184528944']
[24996.0, 25716.0]
[211.0, 183.0]
[315, 297]
p03497
u488884575
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['n, k = map(int, input().split())\nA = list(map(int, input().split()))\n\nimport collections\nc = collections.Counter(A)\nprint(c)\nif len(c.keys()) > k:\n num = len(c.keys()) - k\n print(sum(sorted(c.values())[:num]))\nelse:\n print(0)', 'n, k = map(int, input().split())\nA = list(map(int, input().split()))\...
['Wrong Answer', 'Accepted']
['s493965850', 's674405955']
[53556.0, 32440.0]
[246.0, 107.0]
[234, 238]
p03497
u518042385
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['n,m=map(int,input().split())\nl=list(map(int,input().split()))\nl1=[]\nl2=[]\nc=0\nfor i in l:\n if i in l1:\n l2[l1.index(i)]+=1\n else:\n l1.append(i)\n l2.append(1)\nif m>=len(l2):\n print(0)\nelse:\n l2=sorted(l2)\n for i in range(m):\n c+=l2[i]\n print(c)\n ', 'n,m=map(int,input().split())\nl=...
['Wrong Answer', 'Accepted']
['s915163646', 's874930415']
[25644.0, 34172.0]
[2104.0, 146.0]
[264, 245]
p03497
u536113865
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['from collections import Counter\nimport sys\n\nn,k = list(map(int,input().split()))\na = list(map(int,input().split()))\nc = Counter(a)\n\nif k>=len(c):\n print(0)\n sys.exit()\nd = c.values()\nprint(sorted(d))\nprint(sum(sorted(d)[:len(c)-k]))\n', 'from collections import Counter\nimport sys\n\nn,k = list(map(...
['Wrong Answer', 'Accepted']
['s850707087', 's056614771']
[32564.0, 32556.0]
[123.0, 105.0]
[239, 222]
p03497
u581403769
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['n, k = map(int, input().split())\na = list(map(int, input().split()))\n\na1 = sorted(a)\na2 = []\ncount = 0\nfor i in range(n - 1):\n if a1[i] == a1[i + 1]:\n count += 1\n else:\n a2.append(count)\n break\na2.append(count)\nl = sorted(a2)\nprint(sun(l[:len(l) - k - 1]))', 'n, k = map(int, i...
['Runtime Error', 'Accepted']
['s914170492', 's006856078']
[32192.0, 32180.0]
[104.0, 168.0]
[283, 283]
p03497
u593567568
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['from collections import Counter\n\nN,K = map(int,input().split())\nA = list(map(int,input().split()))\n\nC = Counter(A).most_common()\nL = len(C)\n\nif L <= K:\n print(0)\n exit()\n\nans = 0\ncnt = 0\nfor v in C.values():\n cnt += 1\n if K < cnt:\n ans += v\n \nprint(ans)\n', 'from collections import Counte...
['Runtime Error', 'Accepted']
['s186090927', 's708837231']
[39344.0, 39352.0]
[152.0, 206.0]
[264, 257]
p03497
u612721349
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['from collections import defaultdict\n\nn, k = map(int, input().split())\nal = [int(i) for i in range(n)]\n\n\nd = defaultdict(int)\nfor a in al:\n d[a] += 1\n\n\nans = 0\nif d.keys() > k:\n \n v = d.values()\n v.sort()\n ans = sum(v[:d.keys() - k])\nprint(ans)', 'from collections import defaultdict\n\nn, k = map...
['Runtime Error', 'Runtime Error', 'Accepted']
['s060238664', 's647106487', 's642893049']
[29808.0, 32540.0, 32540.0]
[113.0, 149.0, 167.0]
[487, 494, 510]
p03497
u640922335
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['from collections import Counter\nN,K=map(int,input().split())\nN=list(map(int,input().split()))\nA=Counter(N)\nC=list(A.values())\nC=C.sort(reverse=True)\nprint(C)\nif len(C)<=K:\n print(0)\nelse:\n ans=sum(C[-(len(C)-K):])\n print(ans)', 'from collections import Counter\nN,K=map(int,input().split())\nN=list...
['Runtime Error', 'Runtime Error', 'Accepted']
['s022007086', 's797037768', 's466176868']
[35252.0, 35248.0, 35240.0]
[99.0, 103.0, 103.0]
[234, 225, 223]
p03497
u742729271
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['from collections import Counter \n\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\ns = len(set(A))\nt = s-K\n\nc = Counter(A)\nnum = list(c)\nnum.sort()\nprint(num,t)\nprint(sum(num[:t])) if t>0 else print(0)', 'from collections import Counter \n\nN, K = map(int, input().split())\nA = list(map...
['Wrong Answer', 'Accepted']
['s866296208', 's706782037']
[39088.0, 38944.0]
[159.0, 110.0]
[221, 218]
p03497
u760771686
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['from collections import defaultdict\nN, K = map(int,input().split())\nA = list(map(int,input().split()))\nD = defaultdict(int)\nfor a in A:\n D[a]+=1\nD = sorted(D.values())\nans = 0\nif len(D)<=K:\n print(ans)\nelse:\n print(sum(D[:K]))', 'from collections import defaultdict\nN, K = map(int,input().split())\nA ...
['Wrong Answer', 'Accepted']
['s454741034', 's955825343']
[35344.0, 35220.0]
[125.0, 128.0]
[231, 238]