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
p02773
u958053648
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
['N=int(input())\nS={i:input() for i in range(N)}\nvalue=[]\nmax=0\n\nfor i in S.values():\n\tN=list(S.values()).count(i)\n\tif N>max or N==max:\n\t\tmax=N\nfor j in S.values():\n\tM=list(S.values()).count(j)\n\tif N==M:\n\t\tvalue.append(j)\nvalue.sort()\n[print(i) for i in value]', "import sys\nfrom collections impor...
['Wrong Answer', 'Accepted']
['s133824552', 's379574916']
[37856.0, 38476.0]
[2112.0, 326.0]
[258, 252]
p02773
u958207414
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
['from collections import defaultdict\nfrom collections import OrderedDict\nn = int(input())\nanswer = dict()\nfor _ in range(n):\n z = str(input())\n if z in answer:\n ans[z]+=1\n else:\n answer.update({z:1})\ngroupedByValue = defaultdict(list)\nfor key, value in sorted(answer.items()):\n gro...
['Runtime Error', 'Runtime Error', 'Accepted']
['s077670202', 's629468198', 's816249696']
[45276.0, 3316.0, 45524.0]
[955.0, 21.0, 1138.0]
[401, 398, 404]
p02773
u958421405
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
["#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport collections\nimport sys\ninput = sys.stdin.readline\n\n\ndef main():\n n = int(input())\n s = list()\n for i in range(n):\n s.append(str(input()).replace('\\n', ''))\n\n c = dict(collections.Counter(s))\n max_count = max(c.values())\n f...
['Wrong Answer', 'Accepted']
['s639394789', 's054874245']
[41712.0, 41712.0]
[330.0, 616.0]
[411, 477]
p02773
u961945062
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
['N = int(input())\nl = []\n\nfor _ in range(N):\n s = str(input())\n l.append(s)\n\nimport collections\nc = collections.Counter(l)\n\nml = [kv for kv in c.items() if kv[1] == max(c.values())]\n\nfor _ in range(len(ml)):\n print(ml[_][0])', 'N = int(input())\nl = []\n\nfor _ in range(N):\n s = str(input())\...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s111378160', 's353539762', 's445761593', 's537170787', 's755466183', 's879559000', 's088639114']
[35472.0, 45072.0, 32096.0, 42456.0, 45060.0, 32096.0, 45064.0]
[2105.0, 608.0, 445.0, 2105.0, 930.0, 445.0, 986.0]
[232, 246, 295, 267, 254, 293, 256]
p02773
u962330718
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
['N=int(input())\nS=[input() for i in range(N)]\nS=sorted(S)\ncnt=1\nmax_cnt=1\nans=[S[0]]\nfor i in range(N-1):\n if S[i]==S[i+1]:\n cnt+=1\n else:\n cnt=1\n if cnt==max_cnt:\n ans.append(S[i+1])\n if cnt>max_cnt:\n ans=[S[i+1]]\nans=sorted(ans)\nfor i in ans:\n print(i)', 'N...
['Wrong Answer', 'Accepted']
['s852277413', 's356292435']
[21548.0, 21544.0]
[639.0, 625.0]
[296, 316]
p02773
u962423738
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
['from collections import Counter\n\nn=int(input())\ns = [input() for _ in range(n)]\n\nc=[i for i in max(Counter(s))]\n\nfor j in c:\n\tprint(j)', 'from collections import Counter\n \nn=int(input())\ns = [input() for _ in range(n)]\n \nc=[i for i,j in Counter(s).items() if j == max(Counter(s).values())]\n \nfor k in c...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s169604406', 's774102771', 's586514079']
[38884.0, 54104.0, 35236.0]
[274.0, 2207.0, 460.0]
[134, 175, 205]
p02773
u966836999
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
['#155\ndef main():\n N = int(input())\n S = [input() for i in range(N)]\n S.sort()\n ans = []\n max_len = 0\n streak = 1\n for i in range(len(S)-1):\n if(S[i]==S[i+1]):\n streak+=1\n else:\n if(streak>max_len):\n max_len = streak\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s283435508', 's983387757', 's786671951']
[20672.0, 20676.0, 20680.0]
[541.0, 595.0, 534.0]
[447, 498, 704]
p02773
u967822229
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
['N = int(input())\nA = {}\n\nMAX = 0\nfor i in range(N):\n s = input()\n A[s] = A.get(s,0) + 1\n MAX = max(MAX, A[s])\n\nfor k,v in A.items():\n if MAX == v:\n print(k)', 'N = int(input())\nA = {}\n\nMAX = 0\nfor i in range(N):\n s = input()\n A[s] = A.get(s,0) + 1\n MAX = max(MAX, A[s])\n\nB = s...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s487293141', 's492515020', 's927786446', 's534682999']
[35408.0, 52560.0, 46760.0, 46784.0]
[399.0, 739.0, 554.0, 657.0]
[169, 199, 191, 190]
p02773
u968399909
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
["# -*- coding: utf-8 -*-\n\nimport os\nimport datetime\n\ndef main():\n\n str_dict = {}\n val_1 = int(input())\n for i in range(val_1):\n val_x = input()\n\n if not val_x in str_dict:\n str_dict[val_x] = 1\n else:\n num = str_dict.get(val_x)\n str_dict[val...
['Wrong Answer', 'Accepted']
['s975341943', 's016596518']
[45264.0, 43476.0]
[513.0, 708.0]
[438, 616]
p02773
u969211566
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
['from collections import Counter\n\nn = int(input())\ns = [input() for i in range(n)]\nnews = sorted(s)\nc = Counter(news)\nmax = c.most_common()[0][1]\nprint(c)\nfor i in range(n):\n if max == c.most_common()[i][1]:\n print(c.most_common()[i][0])\n else:\n break', 'import collections as co\n\nn = int(input())...
['Runtime Error', 'Runtime Error', 'Accepted']
['s367828675', 's575494039', 's638878284']
[60272.0, 45044.0, 50192.0]
[2110.0, 2106.0, 708.0]
[258, 244, 238]
p02773
u969848070
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
["from collections import Counter\n\nN = int(input())\nS = [input() for x in range(N)]\nE = Counter(a)\nc = max(E.values())\ns = [s for s, g in b.items() if g == c]\ns.sort()\nprint('\\n'.join(s))", "from collections import Counter\n\nN = int(input())\nA = [input() for x in range(N)]\ncnt = Counter(A)\nmx = max(cnt.val...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s151371418', 's217732435', 's623591491', 's707258298']
[17408.0, 47088.0, 35572.0, 35952.0]
[261.0, 729.0, 311.0, 498.0]
[185, 196, 186, 194]
p02773
u971096161
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
['N = int(input())\nS = []\n\nimport collections\n\nfor n in range(N):\n S.append(input())\n\nC = collections.Counter(S)\nC = C.most_common()\n\nc_max = C[0][1]\n\nfor i, c in enumerate(C):\n if c[1] == c_max:\n print(c[0])\n else:\n break\n ', 'N = int(input())\nS = []\n\nimport collections\n\nfor n in range(...
['Wrong Answer', 'Accepted']
['s120434270', 's800570860']
[45180.0, 45052.0]
[565.0, 748.0]
[231, 286]
p02773
u973055892
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
['def main():\n num = int(input())\n\n tmp = [input() for i in range(num)]\n\n tmp2 = {}\n for t in tmp:\n if len(tmp2) == 0:\n tmp2[t] = 1\n else:\n if t in tmp2:\n tmp2[t] += 1\n else:\n tmp2[t] = 1\n\n tmp2 = sorted(tmp2.items(), key=lambda x:x[1])\n for t in sorted(tmp2):\n ...
['Wrong Answer', 'Accepted']
['s715205568', 's541019136']
[44804.0, 60044.0]
[882.0, 999.0]
[352, 377]
p02773
u977141657
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
['import collections\nn = input()\ns = [input() for _ in range(n)]\ns = collections.Counter(s)\nm = max(s.values())\n\na = []\nfor d in s.items():\n if d[1] == m:\n a.append(d[0])\nfor s in a:\n print(s)\n', "from collections import Counter\ndata = ['aaa', 'bbb', 'ccc', 'aaa', 'ddd']\ncounter = Counter(dat...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s265455816', 's281048423', 's444658364', 's849633651', 's980385789', 's116189727']
[3316.0, 3316.0, 3316.0, 35572.0, 3316.0, 35572.0]
[20.0, 20.0, 20.0, 505.0, 20.0, 623.0]
[204, 133, 37, 208, 204, 217]
p02773
u977642052
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
['from collections import Counter\n\n\ndef main(n, s):\n c = Counter(s)\n max_count = c.most_common()[0][1]\n res = []\n for keys, count in c.most_common():\n if max_count == count:\n res.append(keys)\n\n print("\\n".join(sorted(res)))\n\n\nif __name__ == "__main__":\n n = int(input(...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s007653325', 's437337844', 's353934529']
[17412.0, 17408.0, 45040.0]
[275.0, 264.0, 629.0]
[341, 381, 357]
p02773
u978178314
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
['N = int(input())\nd = {}\nfor _ in range(N):\n s = input()\n if not s in d:\n d[s] = 1\n else:\n d[s] += 1\nx = sorted(list(d.items()), key=lambda x:x[1], reverse=True)\nn = 0\nl = []\nfor k, v in x:\n if v >= n:\n n = v\n l.append(v)\nfor y in sorted(l):\n print(y)\n', 'N = int(input())\nd = {}\nfor...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s872176169', 's901209310', 's932314210', 's714771199']
[45912.0, 46556.0, 46556.0, 47452.0]
[607.0, 531.0, 621.0, 790.0]
[268, 226, 212, 268]
p02773
u978562876
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
['N = int(input())\n\nstrs = []\ndicts = {}\nfor i in range(N):\n s = input()\n if dicts.get(s) is not None:\n dicts[s] += 1\n else:\n dicts[s] = 1\n\ndict_sorted = sorted(dicts.items(), key=lambda x:x[1], reverse=True)\n\ni = 0\nsts = []\nfor s in dict_sorted:\n if dicts[s[0]] >= i:\n ...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s709910316', 's714769583', 's753896874', 's671322283']
[47324.0, 32096.0, 45020.0, 47324.0]
[780.0, 377.0, 625.0, 789.0]
[373, 305, 324, 396]
p02773
u979444096
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
['from collections import Counter\nn = int(input())\na = [input() for i in range(n)]\n\nc = Counter(a)\nd = c.most_common()\n\nfor i in c.items():\n if i[1] == d[0][1]:\n print(i[0])\n', "from collections import Counter\n\n\ndef main():\n N = int(input())\n A = [input() for _ in range(N)]\n\n c = Counter...
['Wrong Answer', 'Accepted']
['s150054980', 's244766788']
[46872.0, 45076.0]
[562.0, 662.0]
[178, 308]
p02773
u984276646
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
['N = int(input())\nD = {}\nfor i in range(N):\n S = input()\n if S in D:\n D[S] += 1\n else:\n D[S] = 1\nM = max(D)\nL = []\nfor i in D:\n if D[i] == M:\n L.append(i)\nL.sort()\nfor i in range(len(L)):\n print(L[i])', 'N = int(input())\nD = {}\nfor i in range(N):\n S = input()\n if S in D:\n D[S] +=...
['Wrong Answer', 'Accepted']
['s807288599', 's473031746']
[32096.0, 32096.0]
[382.0, 810.0]
[213, 228]
p02773
u991619971
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
['import collections\nimport itertools\nN=int(input())\n#P=list(map(int,input().split()))\nst=[]\nfor i in range(N):\n s=str(input())\n st.append(s)\nc = collections.Counter(st)\n\nret = [letter for letter,count in c.most_common() if count == c.most_common()[0][1]]\n\nsorted(ret)\nfor r in ret:\n print(r)\n', ...
['Wrong Answer', 'Accepted']
['s193763946', 's657363387']
[59376.0, 58608.0]
[2106.0, 796.0]
[300, 467]
p02773
u995109095
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
['n=int(input())\na=[]\nimport collections as cc\na=[input() for i in range(n)]\nf=cc.Counter(a)\nch=max(f.values())\nans=[]\nfor i in a:\n if f[i]==ch:\n ans.append(i)\nans.sort()\nfor i in set(ans):\n print(i)', 'n=int(input())\na=[]\nimport collections as cc\na=[input() for i in range(n)]\nf=cc.Counte...
['Wrong Answer', 'Accepted']
['s476793824', 's490355057']
[47612.0, 45812.0]
[622.0, 676.0]
[211, 226]
p02773
u995419623
2,000
1,048,576
We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it. Print all strings that are written on the most number of votes, in lexicographical order.
['n=int(input())\narr=list(input() for _ in range(n)\ndic={}\n\nfor i in range(n):\n if arr[i] not in dic:\n dic[arr[i]]=1\n else:\n dic[arr[i]]+=1\n \nlargest=max(dic.values())\nans=[]\nfor keys in dic.keys():\n if dic[keys]==largest:\n ans.append(keys)\nans=sorted(ans)\n\nfor words in ans:\n print(words)', 'n=...
['Runtime Error', 'Accepted']
['s245323617', 's200144422']
[2940.0, 35232.0]
[17.0, 684.0]
[294, 305]
p02774
u054514819
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
["import numpy as np\nN, K = map(int, input().split())\nL = np.array(list(map(int, input().split())))\n\nL = np.sort(L)\npos = L[0<L]\nneg = L[0>L]\nzero = len(L[L==0])\n\ndef f(x):\n tmp = 0\n if x>=0:\n tmp += zero*N\n tmp += np.searchsorted(L, x//pos, side='right').sum()\n tmp += (N - np.searchsorted(L, x//ne...
['Wrong Answer', 'Accepted']
['s552540025', 's150520260']
[32264.0, 32324.0]
[1106.0, 1109.0]
[498, 502]
p02774
u065040863
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
["import numpy as np\n\nN, K = map(int,input().split())\nA = np.array(list(map(int,input().split())))\nA.sort()\nposi = A[A > 0]\nzero = A[A = 0]\nnega = A[A < 0]\n\n\ndef check(x):\n count = 0 \n if x >= 0:\n count += len(zero) * N \n count += np.searchsorted(A, x // posi, side = 'right').sum() # po...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s388378047', 's451971588', 's770960258', 's791663713', 's496209649']
[3064.0, 32288.0, 32292.0, 32316.0, 32316.0]
[17.0, 936.0, 941.0, 939.0, 1104.0]
[740, 741, 775, 776, 782]
p02774
u079022693
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['import sys\ninput=sys.stdin.readline\nimport bisect\ndef main():\n N,K=map(int,input().split())\n A=list(map(int,input().split()))\n A.sort()\n print(A)\n\n left_target=-10**18\n right_target=10**18\n while left_target<right_target-1:\n mid_target=(left_target+right_target)//2\n cou...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s380875758', 's507721039', 's124609764']
[23240.0, 3064.0, 34632.0]
[2108.0, 24.0, 1103.0]
[1132, 1937, 809]
p02774
u105302073
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['n, k = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\nb = []\nfor i in range(n):\n for j in range(i + 1, n):\n print(a[i], a[j])\n b.append(a[i] * a[j])\nans = list(sorted(b))\nprint(ans[k])\n', 'import numpy as np\n\nn, k = [int(i) for i in input().split()]\na = np.array(s...
['Runtime Error', 'Accepted']
['s179578762', 's387806912']
[98144.0, 32272.0]
[2109.0, 1187.0]
[227, 604]
p02774
u113310313
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
["import numpy as np\n\nn, k = map(int, input().split())\na = list(map(int, input().split()))\n\na = np.array(a)\na.sort()\n\nnega = a[a<0]\nzero = a[a==0]\nposi = a[a>0]\n\nl = -10**18-1\nr = 10**18+1\nwhile r - l > 1:\n mid = (r+l)//2\n cnt = 0\n if mid >= 0:\n cnt += len(zero)*n\n cnt += a.searchsorted(...
['Wrong Answer', 'Accepted']
['s381345355', 's617681869']
[47728.0, 47644.0]
[574.0, 568.0]
[505, 509]
p02774
u201928947
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['import numpy as np\nn,k = map(int,input().split())\na = list(map(int,input().split()))\na = np.array(a)\na.sort()\np = a[a>0]\nz = a[a==0]\nm = a[a<0]\nlow = -10**18\nhigh = 10**18\nwhile high-low>1:\n mid = (high + low) //2\n count = 0\n if mid >= 0:\n count += len(z)*n\n count += a.searchsorted(m...
['Wrong Answer', 'Accepted']
['s547998236', 's477911217']
[32300.0, 32300.0]
[1115.0, 1114.0]
[555, 538]
p02774
u239253654
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['N, K = map(int, input().split())\n\n\nA = list(map(int, input().split()))\n\n\nans = []\nfor x in range(len(A)):\n for y in range(x+1, len(A)):\n ans.append(A[x]*A[y])\nans.sort()\nprint(ans)\nprint(ans[K-1])\n\n\n', 'import numpy as np\nN, K = map(int, input().split())\n\nA = np.array(list(map(int, input()...
['Wrong Answer', 'Accepted']
['s810841384', 's755563851']
[389132.0, 32304.0]
[2129.0, 1103.0]
[209, 513]
p02774
u263830634
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['from bisect import bisect_left, bisect_right\n\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.sort()\n\nn = bisect_left(A, 0)\np = bisect_right(A, 0)\n\nNegative = A[:n]\nPositive = A[p:]\n\nNumber_Negative = len(Negative) * len(Positive)\nNumber_Positive = len(Negative) * (len(Negative) ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s192860162', 's600813983', 's679710880']
[23912.0, 95996.0, 32316.0]
[2104.0, 2115.0, 1136.0]
[1839, 2335, 2726]
p02774
u295294832
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['import numpy as np\n\nN,K = [int(i) for i in input().split()]\nn = np.array([int(i) for i in input().split()])\nn=np.sort(n)\n\nmn = n[np.where(n<0)]\nmz = n[np.where(n==0)]\nmp = n[np.where(n>0)]\n\n#cn = len(mn)\n#cp = len(mp)\n\n#tcn = cn*cp\n\n\n# print(0)\n# exit(0)\n\nM = 10**18\nm = -1*M-1\npos = 0\n\nwh...
['Runtime Error', 'Runtime Error', 'Accepted']
['s492539001', 's528085084', 's871535339']
[32284.0, 32336.0, 32292.0]
[248.0, 246.0, 1112.0]
[652, 517, 531]
p02774
u297109012
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['import numpy as np\n\n\ndef partsolve(A, x, positive, zero, negative):\n \n count = 0\n if x >= 0:\n count = len(zero) * len(A)\n P = x // positive\n Pc = np.searchsorted(A, P, side=\'right\')\n count += Pc.sum()\n\n N = (-x-1) // -negative\n Nc = np.searchsorted(A, N, side=\'right\')\n...
['Wrong Answer', 'Accepted']
['s331897093', 's098644101']
[32328.0, 32300.0]
[1283.0, 1246.0]
[1084, 1062]
p02774
u371409687
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
["import numpy as np\nn,k = map(int,input().split())\na = np.array(list(map(int,input().split())))\na.sort()\nposi = a[a>0]\nzero = a[a==0]\nnega = a[a<0]\n\ndef cnt(x):\n c = 0\n if x >= 0:\n c += len(zero)*n\n c += np.searchsorted(a, x // posi, side = 'right').sum()\n c += n-np.searchsorted(a, (- x...
['Wrong Answer', 'Accepted']
['s243208498', 's339697188']
[32300.0, 32300.0]
[1111.0, 1103.0]
[533, 535]
p02774
u392319141
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['print(0)', 'import numpy as np\n\nN, K = map(int, input().split())\nA = np.array(tuple(map(int, input().split())), dtype=np.int64)\n\nA = np.sort(A)\npos = A[A > 0]\nneg = A[A < 0]\nzero = len(A[A == 0])\n\ndef cnt(x):\n """return #{a <= x | a in A}"""\n ret = 0\n\n if x >= 0:\n ret += zero * N\n\n ...
['Wrong Answer', 'Accepted']
['s506346981', 's851666299']
[2940.0, 32460.0]
[17.0, 1112.0]
[8, 662]
p02774
u469254913
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
["import numpy as np\n# import math\n# import copy\n# from collections import deque\nimport sys\ninput = sys.stdin.readline\n\n\n\ndef cnt(x,A,An,Ap,N,Nz):\n res = 0\n if x >= 0:\n res += N * Nz\n res += np.searchsorted(A,x//Ap,side='right').sum()\n res += N * len(An) - np.searchsorted(A,-(-x//An),si...
['Wrong Answer', 'Accepted']
['s626386308', 's782865320']
[32296.0, 32288.0]
[1103.0, 1115.0]
[834, 815]
p02774
u524255742
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
["import numpy as np\nstdin = open(0)\n\nN,K = map(int,input().split())\nA = np.array(stdin.read().split(), np.int64)\nA = np.sort(A)\n\nmaxA = max(np.abs(A))\n\n\nz = A[A==0]\np = A[A>0]\nn = A[A<0]\n\n\ndef check(x):\n ret = 0\n if x >= 0:\n ret += N*len(z)\n ret += np.searchsorted(A,x//p,side='right'...
['Runtime Error', 'Accepted']
['s550758228', 's331070448']
[34244.0, 32304.0]
[2109.0, 1137.0]
[563, 627]
p02774
u544212192
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
["import numpy as np\nimport sys\n\nn,k=map(int,sys.stdin.readline().split())\na=np.array(sys.stdin.readline().split(),dtype=np.int64)\n\na.sort()\nneg=a[a<0]\nzero=a[a==0]\npos=a[a>0]\n\nprint(neg,zero,pos)\ndef count(x):\n cnt=0\n if x>=0:\n cnt+=len(zero)*n\n cnt+=np.searchsorted(a,x//pos,side='right...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s219405337', 's404761051', 's408131501', 's589744614', 's078498227']
[34660.0, 34656.0, 3064.0, 16176.0, 34324.0]
[1095.0, 1093.0, 18.0, 153.0, 1099.0]
[606, 601, 381, 613, 567]
p02774
u559196406
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['N,K = map(int,input().split())\na = list(map(int,input().split())\n\nd = []\nfor i in range(N):\n for j in range(N):\n if j == i:\n continue\n else:\n d.append(a[i]*a[j])\n \nprint(sorted(d)[K-1])', 'N,K = map(int,input().split())\na = list(map(int),input().split())\n\nd = []\nfor i in range(N):...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s403605067', 's522405043', 's558223080', 's599396186', 's672741356', 's869293402', 's144654145']
[2940.0, 3064.0, 458792.0, 311184.0, 34552.0, 546096.0, 34648.0]
[17.0, 18.0, 2120.0, 2123.0, 1224.0, 2142.0, 1170.0]
[207, 208, 243, 208, 579, 631, 594]
p02774
u561231954
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
["def main():\n import sys\n import numpy as np\n\n sr = lambda: sys.stdin.readline().rstrip()\n ir = lambda: int(sr())\n lr = lambda: list(map(int, sr().split()))\n\n N, M = lr()\n A = np.array(lr())\n A.sort()\n Am=A[A<0]\n Az=A[A==0]\n Ap=A[A>0]\n l1=len(Az)\n l2=len(Am)\n\n def shake_cnt(x):\n X =n...
['Wrong Answer', 'Accepted']
['s182388252', 's833296497']
[32308.0, 32320.0]
[483.0, 1053.0]
[709, 1120]
p02774
u575239123
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['import math\nimport itertools\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nn,k=map(int,input().split())\na=list(map(int, input().split()))\na=sorted(a)\nmlist=[]\nzlist=[]\nplist=[]\nfor i in a:\n if i<0:\n mlist.append(i)\n elif i==0:\n zlist.ap...
['Runtime Error', 'Accepted']
['s560062491', 's165590370']
[23908.0, 32304.0]
[2104.0, 1105.0]
[1920, 563]
p02774
u593567568
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['import sys\nimport bisect\nsys.setrecursionlimit(10 ** 7)\n\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.sort()\nminus = bisect.bisect_left(A, 0)\nplus = bisect.bisect_right(A, 0)\nzero = plus - minus\n\nnegative = minus * plus\npositive = (plus * (plus - 1) // 2) + (minus * (minus - 1)...
['Runtime Error', 'Accepted']
['s387780685', 's770098687']
[24692.0, 34556.0]
[2104.0, 1149.0]
[2266, 743]
p02774
u609061751
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['import sys\ninput = sys.stdin.readline\nimport numpy as np\n\nN, K = [int(x) for x in input().split()]\nA = [int(x) for x in input().split()]\n\nA_m = np.array(sorted([abs(int(x)) for x in A if x < 0]), np.int64)\nN_m = len(A_m)\n\nA_p = np.array(sorted([int(x) for x in A if x > 0]), np.int64)\nN_p = len(A_p)\n\nM = ...
['Wrong Answer', 'Accepted']
['s083050594', 's415391136']
[32332.0, 32252.0]
[1210.0, 1150.0]
[1298, 1282]
p02774
u619819312
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['import numpy as np\nfrom bisect import bisect_right as br\nfrom bisect import bisect_left as bl\nn,k=map(int,input().split())\na=np.sort(np.array(list((map(int,input().split())))))\nq=len(a[a==0])\nd=a[a<0]\ne=a[a>0]\nl,r=10**18,-10**18\nwhile l-r>1:\n t=(l+r)//2\n p=0\n if t>=0:\n p+=q*n\n p+=np.s...
['Wrong Answer', 'Accepted']
['s402099639', 's837867200']
[32316.0, 32304.0]
[1103.0, 1104.0]
[495, 495]
p02774
u648212584
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['import sys\ninput = sys.stdin.buffer.readline\nimport numpy as np\n\ndef main():\n N,K = map(int,input().split())\n a = np.array(list(map(int,input().split())))\n a.sort()\n posi,zero,nega = a[a>0],a[a==0],a[a<0]\n\n lp,lz,ln = len(posi),len(zero),len(nega)\n \n def ch(x):\n count = 0\n ...
['Wrong Answer', 'Accepted']
['s730492434', 's041978778']
[29452.0, 29388.0]
[1228.0, 1120.0]
[747, 1298]
p02774
u693716675
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['#abc_155_d\n#versions of not using numpy\nn,k = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\na = np.array(a)\na.sort()\n\nleft = -10**18\nright = 10**18\n\nwhile left+1 < right:\n mid = (left+right)//2\n cnt = 0\n \n #run about each element as the first choice\n for i in ra...
['Runtime Error', 'Runtime Error', 'Accepted']
['s146934010', 's745666760', 's796878185']
[23884.0, 23764.0, 32300.0]
[77.0, 75.0, 1115.0]
[1443, 1443, 597]
p02774
u704563784
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
["def bin_search(array, num):\n if array[0] > num: return 0\n if array[-1] < num: return len(array)\n mx = len(array) - 1\n mn = 0\n while mx >= mn :\n median = mn + (mx - mn)//2 \n target = array[median]\n if target == num:\n return median + 1\n elif target > num:\...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s028809138', 's672451199', 's846570607', 's282651324']
[23288.0, 17868.0, 23876.0, 32308.0]
[2104.0, 40.0, 2104.0, 1187.0]
[2355, 2349, 1025, 1216]
p02774
u707124227
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['n,k=map(int,input().split())\na=list(map(int,input().split()))\nfrom math import log2\nfrom bisect import bisect_left,bisect_right\na.sort()\n\nmn=bisect_left(a,0)\n\nzn=bisect_right(a,0)-mn\n\npn=n-mn-zn\nam=a[:mn]\nam=[-x for x in am[::-1]]\nap=a[mn+zn:]\n\n\ndef func(x):\n cnt=0\n if x>0:\n cnt+=mn*pn...
['Wrong Answer', 'Accepted']
['s050437817', 's244173502']
[29208.0, 32232.0]
[2206.0, 1137.0]
[1059, 981]
p02774
u736470924
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['import sys\n\nN, K = map(int, input().split())\na = sorted(list(map(int, input().split())))\nl = -(((1e18)+1)\nr=(1e18)+1\nwhile(l + 1 < r):\n x=(l + r) / 2\n total=0\n for i in range(N):\n if a[i] < 0:\n l=-1\n r=N\n while(l + 1 < r):\n c=(l + r) / 2\n ...
['Runtime Error', 'Accepted']
['s536129932', 's179785988']
[2940.0, 34624.0]
[17.0, 1120.0]
[798, 803]
p02774
u765865533
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['import numpy as np\nN,K=map(int,input().split())\nA=list(map(int,input().split()))\nA=sorted(A)\n#B=list(reversed(A))\nA=np.array(A)\nAneg=A[A<0]\nAzero=A[A==0]\nApos=A[A>0]\n\nn_neg=len(Aneg)*len(Apos)\nn_zero=len(Azero)*(len(Azero)-1)//2+len(Azero)*(len(Aneg)+len(Apos))\nn_pos=(len(Apos)*(len(Apos)-1)+len(Aneg)*(le...
['Runtime Error', 'Runtime Error', 'Accepted']
['s807512397', 's966306038', 's939696873']
[199120.0, 3064.0, 32304.0]
[2120.0, 18.0, 1093.0]
[1034, 1156, 877]
p02774
u781758937
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['import numpy as np\nN,K = map(int,input().split())\nA = np.array([int(i) for i in input().split()])\n\nposi = A[A>0]\nzero = A[A==0]\nnega = A[A<0]\n\n\ndef f(x):\n """count the number of products , <= x"""\n cnt_tpl = 0\n # count 0\n if x >= 0:\n cnt_tpl += len(zero) * N\n \n cnt_tpl += np.s...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s405980908', 's764581655', 's476618432']
[32292.0, 32308.0, 32288.0]
[226.0, 1108.0, 1122.0]
[716, 745, 732]
p02774
u816488327
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
["from sys import stdin\n#f_i = stdin\nf_i = open('test_in_3')#\n\nimport numpy as np\n\nN, K = map(int, f_i.readline().split())\nA = np.array(f_i.read().split(), dtype=int)\n\nA = np.sort(A)\nzero_left = A.searchsorted(0, side='left')\nzero_right = A.searchsorted(0, side='right')\nzero_cnt = zero_right - zero_left\npo...
['Runtime Error', 'Accepted']
['s682951135', 's604087169']
[3192.0, 34320.0]
[18.0, 1089.0]
[786, 760]
p02774
u824237520
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
["from bisect import bisect_left\n\nn, k = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\nz = a.count(0)\nmc = bisect_left(a, 0)\npc = n - z - mc\n\nif mc * pc < k <= mc * pc + z * (n-z) + z * (z-1) // 2:\n print(0)\n exit()\n\nprint('dummy')", "from bisect import bisect_left\n\nn, k ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s569567121', 's996457614', 's474065060']
[23916.0, 23916.0, 34568.0]
[152.0, 149.0, 1104.0]
[261, 250, 651]
p02774
u844789719
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
["import bisect\nimport numpy as np\nfrom numba import njit\nN,K=[int(_) for _ in input().split()]\nA = np.array([int(_) for _ in input().split()],dtype=int)\nA.sort()\n\n\n@njit\ndef main(N,K,A):\n lb = -10**18-1\n rb = 10 ** 18 + 1\n while rb - lb > 1:\n target = (rb + lb) // 2\n if 1:\n ...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s110780054', 's212037880', 's254613910', 's774483380', 's810257401', 's169460522']
[113944.0, 111248.0, 113236.0, 46864.0, 113240.0, 113752.0]
[1358.0, 573.0, 1441.0, 2206.0, 1334.0, 1494.0]
[832, 826, 1461, 1055, 1463, 1013]
p02774
u874644572
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['\nimport numpy as np\n\nn, k = map(int, input().split())\na = list(map(int, input().split()))\na = np.array(a) \na.sort()\n\ndef count(x): \n ans = 0\n for i in a:\n ans -= i * i <= x \n if i == 0:\n if x >= 0:\n ans += n\n elif i > 0:\n ans += np.searchsorted(a, x // i, side="right") \n ...
['Wrong Answer', 'Accepted']
['s516700241', 's462491944']
[32312.0, 32320.0]
[2112.0, 1100.0]
[682, 865]
p02774
u945181840
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
["import sys\nfrom bisect import bisect_left\nimport numpy as np\n\n\ndef test(a, K):\n from itertools import combinations\n answer = []\n for i, j in combinations(a, 2):\n answer.append(i * j)\n answer.sort()\n print(answer)\n print(answer[K - 1])\n\n\ndef main():\n read = sys.stdin.read\n\...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s178792208', 's244415530', 's673355169', 's775729370', 's329920165']
[686792.0, 14008.0, 699996.0, 12500.0, 32344.0]
[2150.0, 153.0, 2152.0, 153.0, 1101.0]
[1675, 737, 1684, 580, 1872]
p02774
u964299793
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['import sys\nimport numpy as np\n\n\nTEST_INPUT = [\n """\n 4 3\n 3 3 -4 -2\n """,\n """\n 10 40\n 5 4 3 2 -1 0 0 0 0 0\n """,\n """\n 30 413\n -170202098 -268409015 537203564 983211703 21608710 -443999067 -937727165 -97596546 -372334013 398994917 -972141167 798607104 -949068442 -95994...
['Runtime Error', 'Accepted']
['s377227889', 's742069859']
[3064.0, 32316.0]
[17.0, 1071.0]
[2635, 2638]
p02774
u994988729
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['import bisect\nimport numpy as np\nN, K = map(int, input().split())\nA = np.array(input().split(), dtype=np.int64)\nA = np.sort(A)\n\nAneg = A[A < 0]\nAzero = A[A == 0]\nApos = A[A > 0]\n\nneg = len(Aneg)\nzero = len(Azero)\npos = len(Apos)\n\nNneg = neg * pos\nNpos = 0\nif neg > 0:\n Npos += neg * (neg - 1) // 2\...
['Runtime Error', 'Accepted']
['s632558815', 's868102182']
[34664.0, 34660.0]
[2109.0, 1029.0]
[1281, 1708]
p02774
u997641430
2,000
1,048,576
We have N integers A_1, A_2, ..., A_N. There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?
['n = [int(_) for _ in list(input())]\na, b = 0, 1\nfor i in n:\n a, b = min(a+i, b+10-i), min(a+(i+1), b+10-(i+1))\nprint(a)', "import numpy as np\n\ndef count_pair(x):\n cnt = 0\n cnt += (n-np.searchsorted(A, x//A_nega, side='right')).sum()\n if x > 0:\n cnt += len(A_zero)*n\n cnt += np.searchso...
['Runtime Error', 'Runtime Error', 'Accepted']
['s641741132', 's721276737', 's729792727']
[3060.0, 32280.0, 32308.0]
[17.0, 244.0, 1118.0]
[122, 570, 570]
p02775
u006883624
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['#from math import sqrt\n#from heapq import heappush, heappop\n#from collections import deque\n\n#a, b = [int(v) for v in input().split()]\n\nn = input()\n\n\ncount = 0\ntop = True\nfor i in n:\n i = int(i)\n if i <= 5:\n count += i\n else:\n if top:\n count += 1 + (10 - i)\n e...
['Wrong Answer', 'Accepted']
['s079189501', 's873772226']
[5492.0, 5492.0]
[422.0, 750.0]
[363, 514]
p02775
u028217518
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['\n\n\n# in your code\nimport numpy as np\nDBG=0\ndef p(*args, **kargs):\n if DBG:print(*args, **kargs)\nread = input \nrn = lambda :list(map(int, read().split()))\n\ndef sol(s):\n dp = 0, 1 # n, n + 1\n for x in map(int, s):\n c, d = dp\n \n \n \n a = min(c + x, d + 10 - x)#...
['Wrong Answer', 'Accepted']
['s133070159', 's554413974']
[15684.0, 16096.0]
[1365.0, 1271.0]
[1132, 1139]
p02775
u050706842
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['N = [int(x) for x in input()]+[0]\ncount = 0\nfor i in range(len(N)-1, 0, -1):\n if N[i] <= 4 or (N[i] == 5 and N[i-1] <= 4):\n count += N[i]\n else:\n count += 10 - N[i]\n N[i-1] = N[i-1] + 1\nprint(count)', 'N = list(map(int, input()))\nN.insert(0, 0)\ncount = 0\nfor i in range(len(N)-1, ...
['Wrong Answer', 'Accepted']
['s721762357', 's314260779']
[20460.0, 14564.0]
[690.0, 678.0]
[225, 235]
p02775
u092646083
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['prev = 0\nfor i in range(len(N)):\n if 0 <= int(N[i]) + prev < 5:\n count += int(N[i]) + prev\n prev = 0\n elif 6 <= int(N[i]) + prev <= 9:\n count += 10 - (int(N[i]) + prev)\n prev = 1\n elif int(N[i]) + prev == 10:\n prev = 1\n else:\n if i < (len(N) - 1) and int(N[i+1]) < 5:\n count += 5...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s146446673', 's443254317', 's625560774', 's968200364']
[3188.0, 2940.0, 5492.0, 5492.0]
[18.0, 18.0, 905.0, 1206.0]
[384, 249, 269, 440]
p02775
u111473084
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['def main():\n import sys\n input = sys.stdin.readline\n\n N = list(map(int, list(input()[::-1]))) + [0]\n\n ans = 0\n for i in range(len(N)-1):\n if N[i] < 5:\n ans += N[i]\n elif N[i] > 5:\n ans += 10 - N[i]\n N[i+1] += 1\n else:\n ans +...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s351668916', 's570943109', 's609298827', 's208749586']
[12736.0, 12864.0, 21312.0, 26488.0]
[32.0, 33.0, 162.0, 435.0]
[401, 401, 411, 364]
p02775
u183896397
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['N = list(input())\nX = [int(i) for i in N]\nans = 0 \nkuri = 0\ntmp = 0\nc5 = 0\nfor x in X:\n if c5 == 1:\n if x < 5:\n ans += 5\n c5 = 0\n elif x >= 5:\n ans += 4\n kuri = 1\n c5 = 0\n if kuri == 0:\n if x < 5:\n ans += x\n...
['Wrong Answer', 'Accepted']
['s721063517', 's897047981']
[30308.0, 100396.0]
[1278.0, 1830.0]
[623, 323]
p02775
u185034753
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
["def main():\n N = [int(x) for x in input()]\n dp0 = 0\n dp1 = 1\n for n in N:\n \n a = min(dp0 + n, dp1 + 10 - n)\n \n b = min(dp0 + n + 1, dp1 + 10 - (n+1))\n dp0, dp1 = a, b\n print(min(dp0, dp1))\n\n\nif __name__ == '__main__':\n main()", "def main():\n N = [...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s099005328', 's295727340', 's300036053']
[13632.0, 28644.0, 13636.0]
[894.0, 2104.0, 875.0]
[316, 333, 317]
p02775
u188745744
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['N=input()\ninf=float("inf")\ndp=[[inf]*(len(N)+1) for i in range(2)]\ndp[0][0]=0\nfor i in range(len(N)):\n tmp=int(N[-1-i])\n dp[0][i+1]=min(dp[0][i],dp[1][i])+tmp\n dp[1][i+1]=min(dp[0][i]+11,dp[1][i]+9)-tmp\n print(dp[0][i+1],dp[1][i+1])\nprint(min(dp[0][-1],dp[1][-1]))', 'N=input()\ninf=float("inf")\ndp=[...
['Wrong Answer', 'Accepted']
['s947879800', 's136857400']
[98736.0, 89124.0]
[1787.0, 1092.0]
[272, 240]
p02775
u201234972
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
["#import sys\n#input = sys.stdin.readline\ndef main():\n S = [ int(x) for x in input()]\n ans = 0\n N = len(S)\n l = 0\n r = 1\n d = dict()\n d[0] = 0\n d[1] = 1\n d[2] = 2\n d[3] = 3\n d[4] = 4\n d[5] = 5\n d[6] = 4\n d[7] = 3\n d[8] = 2\n d[9] = 1\n for i in range(N...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s625975699', 's873732784', 's948996626', 's764402870']
[13624.0, 14696.0, 13744.0, 178240.0]
[286.0, 629.0, 425.0, 1227.0]
[579, 522, 577, 552]
p02775
u295294832
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['N=input()\na=[]\ns=len(N)\n\nfor i in range(s-1,-1,-1):\n a.append(int(N[i]))\na.append(0)\n#print(a)\n\np=sum(a)\nt=0\nf=0\nc=0\nfor i in range(len(a)-1):\n if a[i] <= 5:\n t+=a[i]\n if a[i] == 5 and a[i+1]>=5:a[i+1]+=1\n f=0\n \n else:\n c+=10-a[i]\n a[i+1] += 1\n ...
['Wrong Answer', 'Accepted']
['s555323790', 's741228908']
[21176.0, 13632.0]
[1547.0, 729.0]
[332, 328]
p02775
u303739137
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['n = input()\na = 0 \nb = 1 \nfor s in n:\n x = int(s)\n \n a = min(a + x, b + 10 - x)\n b = min(a + x + 1, b + 9 - x)\n \nprint(a) \n', 's = input()\ncnt = 0\nsakki5 = False\nfor s in a:\n if int(s) < 6:\n cnt += int(s)\n sakki6 = False\n if int(s) == 5:\n sakki5 =...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s080523248', 's889191593', 's770242010']
[5492.0, 5492.0, 5492.0]
[1062.0, 19.0, 1190.0]
[288, 326, 205]
p02775
u334703235
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['N = list(input())\nY = [0]\nfor i in N:\n Y.append(int(i))\ndp = [0 for i in range(len(N)+1)]\ndp2 = [10 for i in range(len(N)+1)]\nfor i in range(1,len(N)+1):\n dp[i] = min(dp[i-1] + Y[i],dp2[i-1] + Y[i])\n dp2[i] = min(dp[i-1] + 1 + 10 - Y[i],dp2[i-1] - 1 + 10 - Y[i])\n print(str(dp[i])+":" +str(dp2[i])...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s070716207', 's286923436', 's898962887']
[91212.0, 5492.0, 100544.0]
[2108.0, 19.0, 1705.0]
[362, 276, 363]
p02775
u335599768
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['N = "0" + input()\n\nreturnDP = [0]*(len(N)+1)\npayDP = [0]*(len(N)+1)\nj = 1\nketa = 0\nfor i in N[::-1]:\n i = int(i) + keta\n if i == 10:\n returnDP[j] = returnDP[j-1]\n payDP[j] = payDP[j-1]\n keta = 1\n elif i > 5:\n payDP[j] = payDP[j-1]\n returnDP[j] = returnDP[j-1] ...
['Wrong Answer', 'Accepted']
['s136816484', 's078057346']
[85712.0, 162428.0]
[764.0, 1992.0]
[498, 325]
p02775
u344959886
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['n=int(input())\nh=list(map(int,input().split()))\n\n\nN=list(map(int, input()))\n\ns= [input() for _ in range(n)]\n\nw,h,n=map(int,input().split())\na=[list(map(int,input().split())) for _ in range(n)]\n\ns.sort()\nprint(\'\'.join(s))\n\ns="abcABC"\ns[0].upper()+s[1:].lower()\n\n\nimport numpy as np\na=[[1,2,3,4],[1,...
['Runtime Error', 'Accepted']
['s230232354', 's478020718']
[5748.0, 29164.0]
[2104.0, 663.0]
[3417, 425]
p02775
u347640436
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['N = input()\n\na = 0 # not carried\nb = 0 # carried\nfor i in range(len(N) - 1, -1, -1):\n t = int(N[i])\n a, b = min(a + t, b + (t + 1)), min(a + (10 - t), b + (10 - (t + 1)))\nprint(min(a, b + 1))\n', 'N = input()\n\na = 0 # not carried\nb = 0 # carried\nt = int(N[-1])\na, b = a + t, a + (10 - t)\n\nfor i...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s078760617', 's322528013', 's426076025', 's596550253', 's653294184', 's710445531', 's761166268', 's873986606', 's964110015', 's702349688']
[5492.0, 3064.0, 5492.0, 3064.0, 3060.0, 5492.0, 5492.0, 2940.0, 5492.0, 5492.0]
[1052.0, 18.0, 2104.0, 18.0, 18.0, 2104.0, 2104.0, 17.0, 19.0, 1229.0]
[200, 234, 275, 333, 274, 193, 259, 269, 162, 246]
p02775
u374018235
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['S=input()\npaynum=0\npayout=0\nchange=0\nchangenum=0\nnum=0\n\narray = list(map(int, S))\narray.reverse()\nprint(array)\nfor i in array: \n if i <= 5 :\n paynum = paynum + i\n payout = payout + i *( 10 ** num)\n else:\n if num+1 <len(S):\n array[num+1] = array[num+1]+1\n ...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s627676611', 's845635503', 's907318549', 's000765088']
[22328.0, 2940.0, 5492.0, 15588.0]
[2104.0, 17.0, 2112.0, 639.0]
[546, 386, 444, 387]
p02775
u417365712
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['from itertools import combinations\nn, k = map(int, input().split())\n*A, = map(int, input().split())\nprint(sorted(x*y for x, y in combinations(A, 2))[k]) ', 'N = map(int, input()[::-1])\na, b = 0, 9\nfor n in N:\n a, b = min(n+a, n+b), min(11-n+a, 9-n+b)\nprint(min(a, b))']
['Runtime Error', 'Accepted']
['s742055387', 's971407908']
[5492.0, 5492.0]
[2108.0, 906.0]
[155, 113]
p02775
u426649993
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['if __name__ == "__main__":\n n = \'0\' + input()\n\n ans = 0\n flag = 0\n\n for i in range(len(n)-1, 0, -1):\n if int(n[i]) + flag == 10:\n flag = 1\n elif int(n[i]) + flag > 5 or (int(n[i]) + flag == 5 and int(n[i-1]) > 4):\n ans += 10 - int(n[i]) - flag\n f...
['Wrong Answer', 'Accepted']
['s798185010', 's147461349']
[14564.0, 5492.0]
[2104.0, 1138.0]
[498, 436]
p02775
u475503988
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
["import sys\ninput = sys.stdin.buffer.readline\nS = input()\nans = 0\nfor s in S:\n i = int(s)\n ans += min(i, 10-i)\nif S[0] == '9' or int(S[1]) >= 6:\n ans += 1\nprint(ans)\n", 'S = input()\ndp = [0, 1]\nfor s in S:\n i = int(s)\n a = min(dp[0] + i, dp[1] + 10 - i)\n b = min(dp[0] + i+1, dp[1] + ...
['Wrong Answer', 'Accepted']
['s673051484', 's662633787']
[4980.0, 5492.0]
[530.0, 1228.0]
[174, 181]
p02775
u495440415
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['n = list(map(int,input()))[::-1]\nn.append(0)\nfor i in range(len(n)):\n\tif n[i] >= 6 or (n[i] == 5 and n[i+1] >= 5):\n \tn[i] = 10 - n[i]\n n[i+1] += 1\nprint(sum(n))', 'n = list(map(int,input()))[::-1]\nn.append(0)\nfor i in range(len(n)):\n if n[i] >= 6 or (n[i] == 5 and n[i+1] >= 5):\n n[i] =...
['Runtime Error', 'Accepted']
['s232268006', 's216393862']
[2940.0, 20336.0]
[17.0, 521.0]
[170, 177]
p02775
u497046426
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['N = list(input())\nans = 0\ntemp = [0] + [int(n) for n in N]\nfor i in reversed(range(1, len(N)+1)):\n if temp[i] < 5 or (temp[i] == 5 and temp[i+1] < 4):\n ans += temp[i]\n else:\n temp[i+1] += 1\n ans += (10 - temp[i])\n temp[i] = 0\nans += temp[0]\nprint(ans)', 'N = list(input())\...
['Runtime Error', 'Accepted']
['s939993646', 's642437665']
[29036.0, 29292.0]
[580.0, 673.0]
[285, 285]
p02775
u544212192
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['import sys\n\nn=sys.stdin.readline().rstrip()[::-1]\nto=0\nnum=len(n)\nm=0\nprint(n)\n\nfor i in range(num):\n k=int(n[i])\n k+=m\n if k==5:\n if int(n[i+1])>=5:\n to+=10-k\n m=1\n else:\n to+=k\n m=0\n if k<5:\n to+=k\n m=0\n elif...
['Runtime Error', 'Accepted']
['s620403899', 's067110502']
[6284.0, 5492.0]
[768.0, 743.0]
[390, 352]
p02775
u550061714
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['N_str = input()\n\nln = len(N_str)\nans = 0\ntable = [[0] * 2 for _ in range(ln)]\ntable[0] = [int(N_str[-1]), 11 - int(N_str[-1])]\nfor i in range(1, ln):\n table[i] = [int(N_str[-i]) + min(table[i - 1]),\n min(int(N_str[-i]) + table[i - 1][0], 10 - int(N_str[-i]) + table[i - 1][1])]\nprint(min(tab...
['Wrong Answer', 'Accepted']
['s427049812', 's938230411']
[170020.0, 5492.0]
[2114.0, 1039.0]
[322, 254]
p02775
u561083515
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['import sys\ninput = sys.stdin.readline\n\n\nN = [0] + list(map(int, tuple(input().rstrip("\\n"))))\n\n\nNcopy = N.copy()\nans = 0\n\nflag = False\nfor i in range(len(N)-1, 0, -1):\n if (Ncopy[i] <= 4) or (Ncopy[i] == 5 and N[i-1] <= 4):\n ans += Ncopy[i]\n flag = False\n else:\n Ncopy[i-1] ...
['Wrong Answer', 'Accepted']
['s626203787', 's168363148']
[27476.0, 20452.0]
[750.0, 479.0]
[574, 630]
p02775
u561231954
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
["def main():\n n=list(input())\n n=[int(i) for i in reversed(n)]\n l=len(n)\n n.append(0)\n print(n)\n \n ans=0\n for i in range(l):\n if n[i]<=5:\n a=n[i]\n else:\n n[i+1]+=1\n a=10-n[i]\n print(a)\n ans+=a\n ans+=n[l]\n print(ans) \nif __name__=='__main__':\n main()\n", "def ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s767518857', 's971141713', 's562523993']
[21604.0, 32140.0, 21356.0]
[1140.0, 2109.0, 472.0]
[290, 344, 367]
p02775
u577170763
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
["class Solution:\n\n def solve(self, N: str) -> int:\n\n L = len(N)\n D = []\n for l in range(L-1, -1, -1):\n D.append(int(N[l]))\n\n D.append(0)\n\n ans = 0\n for l in range(L+1):\n\n # carry over\n if D[l] == 10:\n D[l+1] +=...
['Wrong Answer', 'Accepted']
['s434193986', 's517791104']
[23104.0, 15672.0]
[1759.0, 577.0]
[647, 764]
p02775
u595289165
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['n = list(map(int, list(input())))\nans = 0\nc_in = 0\nq = 0\n\n\ndef carry(x, i, q):\n if x[i] <= 8:\n x[i] += 1\n else:\n x[i] = 0\n if x[i] == x[0]:\n x[i] = 0\n q += 1\n else:\n carry(x, i-1, q)\n\n\nwhile len(n) > 0:\n s = n.pop()\n if 0 <= ...
['Runtime Error', 'Accepted']
['s153356485', 's244135845']
[21340.0, 21228.0]
[2085.0, 622.0]
[486, 330]
p02775
u652057333
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
["n = str(input().rstrip())\n\ndef solve1(n):\n ans = 0\n\n a = list(map(int, list(n)))\n a = a[::-1]\n a.append(0)\n for i in range(len(a) - 1):\n c = a[i]\n if c < 5:\n ans += c\n else:\n if c == 5 and a[i+1] < 5:\n ans += 5\n else:\n...
['Wrong Answer', 'Accepted']
['s301887251', 's542936097']
[5568.0, 22208.0]
[2104.0, 579.0]
[907, 315]
p02775
u664373116
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['tmp=input()\nn=int(tmp)\nl=len(tmp)\nrev=tmp[::-1]\npay_rev=""\nnext_bit=0\nfor i in range(l):\n val=int(rev[i])+next_bit\n if val>5:\n val=0\n next_bit=1\n else:\n next_bit=0\n pay_rev+=str(val)\nif pay_rev[-1]=="0":\n pay_rev+="1"\npay=pay_rev[::-1]\n\nprint(pay)\nzankin=int(pay)...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s005705235', 's851823292', 's306857076']
[5696.0, 7072.0, 14656.0]
[2104.0, 1054.0, 640.0]
[401, 1290, 349]
p02775
u667469290
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
["# -*- coding: utf-8 -*-\ndef solve():\n N = input()[::-1]+'0'\n res = 0\n c = 0\n for i in range(len(N)-1):\n r = int(N[i])+c\n c = r//10\n r %= 10\n r_ = (int(N[i+1])+c)%10\n if r < 5 or (r==5 and r_ < 5):\n res += r\n else:\n res += 10-r\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s368234095', 's597452278', 's073041118']
[5492.0, 8572.0, 6668.0]
[896.0, 1828.0, 910.0]
[371, 413, 391]
p02775
u690536347
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['s = input()[::-1]\nsize = len(s)\ns += "9"\n\nans = 0\nbef = 0\n\nfor i in range(size):\n v1 = int(s[i])\n v2 = int(s[i+1])\n if v1+bef>=6 or (v1+bef>=5 and v2>=5):\n ans += 10-(v1+bef)\n bef = 1\n else:\n ans += (v1+bef)\n bef = 0\n\nans += (v+bef)//10\nprint(ans)', 's = input...
['Runtime Error', 'Accepted']
['s182392140', 's415837306']
[5492.0, 5492.0]
[854.0, 1069.0]
[287, 279]
p02775
u704284486
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['N = str(input())\nL = len(N)\nans = 0\ns = list(N)\nfor i in range(L):\n n = int(s[i])\n ans += min(n,10-n)\n\nprint(ans)\n', 'N = str(input())\nL = len(N)\nans = 0\ndp = [[0,0] for _ in range(L)]\ns = list(map(int,N))\ndp[0] = [s[0],11-s[0]]\nfor i in range(1,L):\n n = s[i]\n dp[i][0] = min(dp[i-1][0]+n,...
['Wrong Answer', 'Accepted']
['s380628488', 's309164033']
[12864.0, 179056.0]
[603.0, 1951.0]
[120, 260]
p02775
u722868069
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['N = input().strip()\n\nd = len(N)\nculc = [0] * (d+1)\n\nfor i, digit in enumerate(N):\n digit = int(digit)\n if digit < 6:\n culc[i+1] = digit\n else:\n culc[i] += 1\n culc[i+1] -= (10 - digit) \n if culc[i+1] > 5:\n culc[i+1] = (10 - culc[i+1])\n\nans = 0\nfor i in culc:\n ans += abs(i)\n \n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s066023611', 's486922363', 's221730791']
[22580.0, 22588.0, 15672.0]
[899.0, 762.0, 813.0]
[322, 265, 296]
p02775
u731448038
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['n = list(map(int, input()))\nn = n[::-1]\n#print(n)\n\nb0 = [0]*(len(n)+1)\nb1 = [0]*(len(n)+1)\n\nfor i in range(0, len(n)):\n num = n[i]\n b0[i+1] = min(b0[i]+num, b1[i]+num+1)\n b1[i+1] = min(b0[i]+10-num, b1[i]+10-(num+1))\n\nprint(min(b0[-1], b1[-1]+1))', 'n = [0] + list(map(int, input())) + [0]\nn = n[::-1]\...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s164539814', 's641085076', 's871840736', 's965215593']
[89980.0, 89996.0, 89940.0, 89956.0]
[1603.0, 1389.0, 1382.0, 1485.0]
[249, 255, 266, 287]
p02775
u736729525
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['\n# 0, 1, 2, 3, 4, 5, 6, 7, 8, 9\nP = [0, 1, 2, 3, 4, 0, 0, 0, 0, 0]\nC = [0, 0, 0, 0, 0, 5, 4, 3, 2, 1]\nX = [0, 1, 2, 3, 4, 5, 4, 3, 2, 1]\nimport sys\ndef solve(N):\n N = [int(c) for c in N]\n N = N[::-1]\n p = 0\n b = 0\n s = []\n for i in range(len(N)):\n c = N[i]\n c += b\n ...
['Time Limit Exceeded', 'Accepted']
['s562709236', 's212188065']
[35036.0, 21444.0]
[2105.0, 411.0]
[1590, 358]
p02775
u770199020
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['Ns = [int(s) for s in input()]\ntotal = 0\nkuri = 0\nfor n in Ns[::-1]:\n print(n)\n if kuri + n == 10:\n kuri = 1\n else:\n n += kuri\n if n <= 5:\n total += n\n kuri = 0\n else:\n total += (10 - n)\n kuri = 1\nif kuri > 0:\n total += kuri\n \nprint(total)', 'Ns = [int(s) for s...
['Wrong Answer', 'Accepted']
['s956997399', 's076046374']
[23916.0, 91788.0]
[1196.0, 1513.0]
[278, 339]
p02775
u772395065
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['n=list(input())\nlis=[]\nfor k in range(len(n)):\n lis.append(int(n[len(n)-1-k]))\n \nt=0\nprint(lis)\nfor k in range(len(lis)):\n if lis[k]==10:\n if k==len(lis)-1:\n t+=1\n break\n else:\n lis[k]=0\n lis[k+1]+=1\n if lis[k]<5:\n t+=lis[k]\n elif lis[k]>5:\n t=t+10-lis...
['Wrong Answer', 'Accepted']
['s795295780', 's551021353']
[29924.0, 21348.0]
[1239.0, 1160.0]
[536, 526]
p02775
u780475861
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['import sys\nn = list(map(int, sys.stdin.readline()))\ns = sum(i if i <= 5 else 10 - i for i in n)\n\nprint(s)\n', 'import sys\nn = list(map(int, sys.stdin.readline()))\ns = sum(i if i <= 5 else 10 - i for i in n)\n', 'import sys\n\n', 'import sys\nn = list(map(int, sys.stdin.readline()))\ns = sum(i if i <= 5 else 10 ...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s383354383', 's398146295', 's538525970', 's585156536', 's759819667', 's731590349']
[11924.0, 11924.0, 2940.0, 11928.0, 11924.0, 18764.0]
[154.0, 165.0, 17.0, 154.0, 180.0, 371.0]
[106, 96, 12, 171, 171, 345]
p02775
u816488327
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
["def solve():\n from sys import stdin\n #f_i = stdin\n f_i = open('test_in_3')#\n \n N = f_i.readline().rstrip()\n N = N[::-1] + '0'\n \n INF = 10 ** 32\n \n import numpy as np\n dp = np.full((len(N), 2), INF)\n dp[0][0] = 0\n \n for i, x in enumerate(int(n) for n in N[:-1]):\...
['Runtime Error', 'Accepted']
['s583357071', 's947424902']
[3064.0, 171008.0]
[17.0, 1719.0]
[474, 368]
p02775
u844789719
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
["import sys\nimport numpy as np\n\n\ndef solve(N):\n p, q = 0, 1\n for x in N:\n p, q = min(p + x, q + 10 - x), min(p + x + 1, q + 9 - x)\n print(p)\n\n\ntry:\n sys.winver\n N = np.array([int(_) for _ in input()])\n from numba import jit\n solve = jit(solve, '(i8[:])')\n solve(N)\nexcept...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s059175092', 's068388703', 's095773624', 's250282748', 's603747383', 's624968598', 's642131271', 's997024367', 's487449954']
[27192.0, 27048.0, 43360.0, 26200.0, 43560.0, 94240.0, 26632.0, 141752.0, 107300.0]
[112.0, 115.0, 291.0, 371.0, 363.0, 1001.0, 113.0, 1306.0, 1910.0]
[669, 479, 689, 200, 694, 669, 480, 671, 220]
p02775
u847923740
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['#\n\nimport sys\ninput=sys.stdin.readline\n\ndef main():\n N=input().strip("\\n")\n ans=0\n for i in range(len(N)):\n d=int(N[i])\n if d<=5:\n ans+=d\n else:\n ans+=10-d\n if i==0:\n ans+=1\n print(ans)\n \nif __name__=="__main__":\n ...
['Wrong Answer', 'Accepted']
['s771822218', 's608901333']
[11084.0, 162440.0]
[220.0, 1286.0]
[308, 451]
p02775
u853819426
2,000
1,048,576
In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. _(Takoyaki is the name of a Japanese snack.)_ To make the paym...
['n = list(map(int, input()))\n\nl = [0] * (len(n)+2)\ncarry = 0\nfor i, k in enumerate(n):\n if k > 5 - carry:\n l[i+1] = k - 10\n l[i] += 1\n carry = 1\n while l[i] >= 6 - (1 if l[i-1] <= 0 else 0):\n l[i] -= 10\n i -= 1\n l[i] += 1\n else:\n l[i+1] = k\n carry = 0\nprint(l)\nprint(...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s124371091', 's254495475', 's351611489']
[31456.0, 20332.0, 13508.0]
[829.0, 732.0, 1147.0]
[324, 301, 139]