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
p03254
u416758623
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,x = map(int, input().split())\nls = sorted(list(map(int, input().split())))\nans = 0\n\nfor i in range(n):\n if x >= ls[i]:\n x -= ls[i]\n ans += 1\nprint(ans)', 'n,x = map(int, input().split())\nls = sorted(list(map(int, input().split())))\nans = 0\n\nfor i in range(n):\n if x >= ls[i] or x == ls[i]:\n x -= ls[i]\n ans += 1\n else:\n break\nprint(ans)', 'n, x = map(int, input().split())\nl = sorted(list(map(int, input().split())))\n\nans = 0\nfor i in range(n-1):\n if l[i] <= x:\n x -= l[i]\n ans += 1\nelse:\n if l[-1] == x:\n ans += 1\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s630349801', 's948771320', 's576293992']
[2940.0, 3060.0, 9124.0]
[17.0, 17.0, 28.0]
[170, 208, 212]
p03254
u432853936
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,x = map(int,input().split())\na = list(map(int,input().split()))\naa = sorted(a)\nnokori = x\ncnt = 0\nfor i in range(n):\n if nokori >= a[i]:\n cnt +=1\n nokori = nokori - a[i]\nprint(cnt)\n', 'n,x = map(int,input().split())\na = list(map(int,input().split()))\naa = sorted(a)\nnokori = x\ncnt = 0\nif x > sum(a):\n print(n-1)\nelse:\n for i in range(n):\n if nokori >= aa[i]:\n cnt +=1\n nokori = nokori - aa[i]\n print(cnt)\n']
['Wrong Answer', 'Accepted']
['s616060822', 's751654980']
[3060.0, 3060.0]
[17.0, 17.0]
[225, 313]
p03254
u434208140
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,x=map(int,input().split())\na=list(map(int,input().split()))\nsort(a)\nfor i in range(n):\n x-=a[i]\n if(x<0):\n break\nif(x!=0):\n print(i)\nelse:\n print(n)', 'n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nfor i in range(n):\n x-=a[i]\n if(x<0):\n break\nif(x!=0):\n print(i)\nelse:\n print(n)']
['Runtime Error', 'Accepted']
['s012181795', 's569677590']
[3060.0, 3060.0]
[17.0, 17.0]
[157, 158]
p03254
u451017206
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x = map(int, input().split())\na = sorted([int(i) for i in input().split()])\nans = 0\n\ni = 0\nwhile i < N and 0 < x:\n v = a[i]\n if x - v >= 0:\n x = x - v\n ans += 1\n i += 1\n\nprint(ans)', 'N, x = map(int, input().split())\na = sorted([int(i) for i in input().split()])\nb = []\nfor i, v in enumerate(a):\n if i != N - 1:\n c = min(v, x)\n elif x > v:\n c = x\n else:\n c = min(v, x)\n b.append(c)\n x -= c\nans = 0\nfor i,j in zip(a,b):\n if i == j:\n ans += 1\nprint(ans)']
['Wrong Answer', 'Accepted']
['s296079191', 's864256011']
[3060.0, 3064.0]
[17.0, 17.0]
[206, 313]
p03254
u453630968
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n, x = map(int,input().split())\na = list(map(int,input().split()))\na = sorted(a)\ncount = 0\nfor i in a:\n print(f"{i},{x}")\n if x - i >= 0:\n x -= i\n count += 1\n else:\n break\nif x != 0:\n count -= 1 if count == n else 0\nprint(count)', 'n, x = map(int,input().split())\na = list(map(int,input().split()))\na = sorted(a)\nprint(a)\ncount = 0\nfor i in a:\n print(f"{i},{x}")\n if x - i >= 0:\n x -= i\n count += 1\n else:\n break\nif x != 0:\n count -= 1 if count == n else 0\nprint(count)', 'n, x = map(int,input().split())\na = list(map(int,input().split()))\na = sorted(a)\nprint(a)\ncount = 0\nfor i in a:\n print(f"{i},{x}")\n if x - i >= 0:\n x -= i\n count += 1\n else:\n break\nprint(count)\nif x != 0:\n count -= 1 if count == n else 0\nprint(count)', 'n, x = map(int,input().split())\na = list(map(int,input().split()))\na = sorted(a)\ncount = 0\nfor i in a:\n if x - i >= 0:\n x -= i\n count += 1\n else:\n break\nif x != 0:\n count -= 1 if count == n else 0\nprint(count)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s465399484', 's633690265', 's856083629', 's755168520']
[9212.0, 9044.0, 9076.0, 8992.0]
[25.0, 30.0, 28.0, 27.0]
[261, 270, 283, 239]
p03254
u456579619
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x = map(int, input().split())\na = sorted(map(int, input().split()))\n \ncount=0\nfor i in range(N):\n if x>=a[i]:\n \tx=x-a[i]\n \tcount+=1\n \nprint(count)', 'N, x = map(int, input().split())\na = sorted(map(int, input().split()))\n \ncount=0\nfor i in range(N):\n x=x-a[i]\n if x>=0:\n count+=1\n \nif x>0:\n count-=1\n \nprint(count)']
['Wrong Answer', 'Accepted']
['s682690951', 's086875335']
[9176.0, 9124.0]
[30.0, 30.0]
[158, 177]
p03254
u457601965
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nimport numpy as np\n\n@jit\ndef main(n, x, a):\n cnt = 0\n for i in a:\n x -= i\n if x <= 0:\n break\n elif i == a[-1] and x > 0:\n break\n cnt += 1\n return cnt\n\nn, x = map(int, readline().split())\na = np.sort(np.array(readline().split(), np.int64))\nprint(main(n, x, a))\n', 'import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nimport numpy as np\n\n\ndef main(n, x, a):\n cnt = 0\n for j, i in enumerate(a):\n x -= i\n if x < 0:\n break\n elif j == n-1 and x > 0:\n break\n cnt += 1\n return cnt\n\nn, x = map(int, readline().split())\na = np.sort(np.array(readline().split(), np.int64))\nprint(main(n, x, a))\n']
['Runtime Error', 'Accepted']
['s115361851', 's891993005']
[27084.0, 26992.0]
[114.0, 116.0]
[401, 408]
p03254
u457901067
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, X = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.sort()\n\nans = 0\n\nfor i in range(N):\n if A[i] <= X:\n ans += 1\n X -= A[i]\n else:\n break\n \nprint(ans)', 'N, X = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.sort()\n\nans = 0\n\nfl = True\nfor i in range(N):\n if A[i] <= X:\n ans += 1\n X -= A[i]\n else:\n fl = False\n break\n \nif fl and X > 0:\n ans -= 1\nprint(ans)']
['Wrong Answer', 'Accepted']
['s636354207', 's076987707']
[2940.0, 3316.0]
[19.0, 20.0]
[184, 237]
p03254
u459639226
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['# -*- coding: utf-8 -*-\n\nn, x = map(int, input().split())\nsa = input().split()\na = []\n\nfor s in sa:\n a.append(int(s))\n\na = sorted(a)\n\nans = 0\nsum = 0\nfor i in a:\n sum += i\n if sum > x:\n break\n ans += 1\n\nprint(ans)\n', '# -*- coding: utf-8 -*-\n\nn, x = map(int, input().split())\nsa = input().split()\na = []\n\nfor s in sa:\n a.append(int(s))\n\na = sorted(a)\n\nans = 0\nsum = 0\ndif = x\nfor i in a:\n sum += i\n dif -= i\n if sum > x:\n break\n ans += 1\n\nif dif > 0:\n ans -= 1\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s750606357', 's572016510']
[3060.0, 3060.0]
[17.0, 17.0]
[233, 280]
p03254
u469063372
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n, x = map(int, input().split())\na = map(int, input().split())\nnum = len(a)\na.sort(reverse=True)\nfor i in range(num):\n x -= a.pop()\n if x < 0:\n print(i)\n exit()\n if x == 0:\n print(i + 1)\n exit()\nprint(num - 1)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\nnum = len(a)\na.sort(reverse=True)\nfor i in range(num):\n x -= a.pop()\n if x < 0:\n print(i)\n exit()\n if x == 0:\n print(i + 1)\n exit()\nprint(num - 1)']
['Runtime Error', 'Accepted']
['s493722233', 's413008432']
[3060.0, 3060.0]
[17.0, 17.0]
[246, 252]
p03254
u470101103
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
["NX = input()\nNX = NX.split(' ')\nN = int(NX[0])\nx = int(NX[1])\nA = input()\nA = list(map(int, A.split(' ')))\nsorted_a = sorted(A)\ns = 0\n\ncum_sum = [0] * (len(sorted_a))\nfor i, a in enumerate(sorted_a):\n s = s + a\n cum_sum[i] = s\n\nfor i, s in enumerate(cum_sum):\n if s > x:\n print(i)\n break\n\nif i == len(cum_sum)-1:\n print(i+1)", "NX = input()\nNX = NX.split(' ')\nN = int(NX[0])\nx = int(NX[1])\nA = input()\nA = list(map(int, A.split(' ')))\nsorted_a = sorted(A)\ns = 0\n\ncum_sum = [0] * (len(sorted_a))\nfor i, a in enumerate(sorted_a):\n s = s + a\n cum_sum[i] = s\n\nfor i, s in enumerate(cum_sum):\n if s > x:\n print(i)\n break\n\nif i == len(cum_sum)-1 and s == x:\n print(i+1)", "NX = input()\nNX = NX.split(' ')\nN = int(NX[0])\nx = int(NX[1])\nA = input()\nA = list(map(int, A.split(' ')))\nsorted_a = sorted(A)\ns = 0\n\ncum_sum = [0] * (len(sorted_a))\nfor i, a in enumerate(sorted_a):\n s = s + a\n cum_sum[i] = s\n\nchecker = True\nfor i, s in enumerate(cum_sum):\n if s == x:\n print(i+1)\n checker = False\n break\n elif s >= x:\n print(i)\n checker = False\n break\n\nif checker:\n print(i)"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s574195727', 's727680761', 's081089938']
[3064.0, 3064.0, 3064.0]
[20.0, 17.0, 17.0]
[350, 361, 450]
p03254
u475018333
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['# AtCorder-Candy Distribution Again\n\nn,x = map(int, input().split())\nlist[n] = list(map(int, input().split()))\n\na = 0\ni = 0\nlist.sort()\n\nif x < list[0]:\n print(0)\n\nelif x >= list[0]:\n\n while x >= list[i] and x > 0:\n x -= list[i]\n a += 1\n if i < n-1 and x < list[i+1]:\n break\n if i == n-1:\n if x > list[i]:\n a = n-1\n else:\n a = n\n break\n i += 1\n\n print(a)\n', '# AtCorder-Candy Distribution Again\n\nn,x = map(int, input().split())\nlist = list(map(int, input().split()))\n\na = 0\ni = 0\nlist.sort()\n\nif x < list[0]:\n print(0)\n\nelif x >= list[0]:\n\n while x >= list[i] and x > 0:\n x -= list[i]\n a += 1\n if i < n-1 and x < list[i+1]:\n break\n if i == n-1:\n a = n\n break\n i += 1\n\n print(a)\n', '# AtCorder-Candy Distribution Again\n\nn,x = map(int, input().split())\nlist[] = list(map(int, input().split()))\n\na = 0\ni = 0\nlist.sort()\n\nif x < list[0]:\n print(0)\n\nelif x >= list[0]:\n\n while x >= list[i] and x > 0:\n x -= list[i]\n a += 1\n if i < n-1 and x < list[i+1]:\n break\n if i == n-1:\n if x > list[i]:\n a = n-1\n else:\n a = n\n break\n i += 1\n\n print(a)\n\n ', '# AtCorder-Candy Distribution Again\n\nn,x = map(int, input().split())\nlist = list(map(int, input().split()))\n\na = 0\ni = 0\nlist.sort()\n\nif x < list[0]:\n print(0)\n\nelif x >= list[0]:\n\n while x > 0 and x >= list[i]:\n x -= list[i]\n a += 1\n if x < list[i+1]:\n break\n i += 1\n\n print(a)\n', '# AtCorder-Candy Distribution Again\n\nn,x = map(int, input().split())\nlist = list(map(int, input().split()))\n\na = 0\ni = 0\nlist.sort()\n\nif x < list[0]:\n print(0)\n\nelif x >= list[0]:\n\n while x > 0 and x >= list[i]:\n x -= list[i]\n a += 1\n if i < n-1 and x < list[i+1]:\n break\n if i == n-1:\n a = n\n break\n i += 1\n\n print(a)\n', '# AtCorder-Candy Distribution Again\n\nn,x = map(int, input().split())\nlist = list(map(int, input().split()))\n\na = 0\nlist.sort()\ni = 0\n\nif x < list[0]:\n print(0)\n\nelif x >= list[0]:\n # x -= list[i]\n # print(x)\n while x >= 0:\n x -= list[i]\n a += 1\n i += 1\n if i == n-1 or x == 0:\n a += 1\n break\n # print(x)\n print(a)\n\n\n # return print(a)\n', 'n,x = map(int, input().split())\nlist = list(map(int, input().split()))\n\na = 0\ni = 0\n\nlist.sort()\n\nif list[0] > x:\n print(0)\n\nelif x > sum(list):\n print(n-1)\n\nelse:\n while x > 0 and x >= list[i]:\n x -= list[i]\n i += 1\n a += 1\n if i == n:\n break\n\n print(a)']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s046804535', 's088638415', 's199891547', 's282973301', 's397754313', 's417681597', 's263536975']
[3064.0, 3064.0, 2940.0, 3060.0, 3060.0, 2940.0, 3060.0]
[17.0, 18.0, 17.0, 17.0, 17.0, 17.0, 17.0]
[473, 396, 477, 327, 396, 406, 305]
p03254
u482157295
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,x = map(int,input().split())\na_list = list(map(int,input().split()))\na_list.sort()\ncount = 0\nfor i in range(n):\n if a_list[i] <= x:\n count += 1\n x = x-a_list[i]\n else:\n break\nprint(count)', 'n,x = map(int,input().split())\na_list = list(map(int,input().split()))\na_list.sort()\ncount = 0\nfor i in range(n):\n x = x - a_list[i]\n count += 1\n if x <= 0:\n break\n\n\nif x == 0:\n print(count)\nelse:\n print(count-1)']
['Wrong Answer', 'Accepted']
['s737393969', 's616709714']
[3060.0, 3060.0]
[18.0, 17.0]
[216, 234]
p03254
u487594898
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,x= map(int,input().split())\na = list(map(int,input().split()))\na.sort()\nans = 0\nfor i in range(n):\n if 0 <= x-a[i]:\n x = x-a[i]\n ans +=1\n \nprint(ans)\n', 'n,x= map(int,input().split())\na = list(map(int,input().split()))\na.sort()\nans = 0\nfor i in range(n):\n if 0 <= x-a[i]:\n x = x-a[i]\n ans +=1\n \nprint(ans)\n', 'n,x= map(int,input().split())\na = list(map(int,input().split()))\na.sort()\nans = 0\nfor i in range(n):\n if 0 <= x-a[i]:\n x = x-a[i]\n ans +=1\n else:\n break\nprint(ans)\n', '\nn,x= map(int,input().split())\na = list(map(int,input().split()))\na.sort()\nans= 0\n\nX=x\nfor i in range(n):\n \n if 0 <= X-a[i]:\n X = X-a[i]\n ans +=1\n elif X ==0:\n break\n\nif ans == n and X >0 :\n ans -=1 \n \n \nprint(ans)\n\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s085875769', 's189724651', 's568893847', 's975239951']
[2940.0, 2940.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0, 17.0]
[172, 172, 191, 262]
p03254
u488178971
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['# AGC 027 A\nN,X =map(int,input().split())\nA =[int(j) for j in input().split()]\nA.sort()\ncnt=0\nfor a in A:\n if X - a >=0:\n X-=a\n cnt+=1\nprint(cnt)', 'N,X= map(int,input().split())\nA = [int(a) for a in input().split()]\nA.sort()\n\ntmp = 0\nans = 0\n\nfor a in A:\n tmp+=a\n if tmp<=X:\n ans+=1\nif ans==N and tmp<X:\n ans-=1\nprint(ans)']
['Wrong Answer', 'Accepted']
['s133093988', 's161161474']
[2940.0, 3060.0]
[17.0, 17.0]
[162, 190]
p03254
u489108157
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,x=map(lambda x: int(x), input().split())\na=list(map(lambda x: int(x), input().split()))\na.sort()\nans=0\nfor i in range(n):\n x-=a[i]\n if x<0:\n ans=i\n break\nif x>=0:\n ans=n\nprint(ans)', 'n,x=map(lambda x: int(x), input().split())\na=list(map(lambda x: int(x), input().split()))\na.sort()\nans=0\nfor i in range(n):\n x-=a[i]\n print(x)\n if x<0:\n ans=i\n break\nprint(ans)', 'n,x=map(lambda x: int(x), input().split())\na=list(map(lambda x: int(x), input().split()))\na.sort()\nans=0\nfor i in range(n):\n x-=a[i]\n if x<0:\n ans=i\n break\nprint(ans)', 'n,x=map(lambda x: int(x), input().split())\na=list(map(lambda x: int(x), input().split()))\na.sort()\nans=0\nfor i in range(n):\n x-=a[i]\n if x<0:\n ans=i\n break\nprint(ans)', 'n,x=map(lambda x: int(x), input().split())\na=list(map(lambda x: int(x), input().split()))\na.sort()\nans=0\nfor i in range(n):\n x-=a[i]\n if x<0:\n ans=i\n break\nif x==0:\n ans=n\nelif x>0:\n ans=n-1\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s199460489', 's503364343', 's557199262', 's661183221', 's910219179']
[3060.0, 3060.0, 3060.0, 3060.0, 3064.0]
[17.0, 17.0, 18.0, 17.0, 17.0]
[205, 199, 186, 186, 227]
p03254
u498575211
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\ncount = 0\np = x\n\nfor i in a:\n if x - i >= 0:\n x -= i\n count += 1\nif x > 0 and count != 0 and p >= a.sum() :\n count -= 1\nprint(count)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\ncount = 0\n\nfor i in a:\n if x - i >= 0:\n x -= i\n count += 1\nif x > 0 and count != 0 and x > sum(a):\n count -= 1\nprint(count)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\np = x\na.sort()\ncount = 0\n\nfor i in a:\n if x - i >= 0:\n x -= i\n count += 1\nif x > 0 and count != 0 and p > sum(a):\n count -= 1\nprint(count)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s435384476', 's626299942', 's108399508']
[3316.0, 3060.0, 3060.0]
[22.0, 17.0, 17.0]
[218, 210, 216]
p03254
u502389123
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\n\ncnt = 0\nfor i in range(N):\n if x - a[i] < 0:\n break\n cnt += 1\n x -= a[i]\nif x < 0:\n cnt -= 1\n \nprint(cnt)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\n\ncnt = 0\nfor i in range(N):\n if x - a[i] < 0:\n break\n cnt += 1\n x -= a[i]\n\nprint(cnt)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\n\ncnt = 0\nfor i in range(N):\n if x - a[i] >= 0:\n cnt += 1 \n x -= a[i]\n\nif x <= 0:\n print(cnt)\nelse:\n print(cnt - 1)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s462816027', 's604318827', 's559789212']
[3064.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[207, 180, 215]
p03254
u508405635
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x = map(int, input().split())\na = list(map(int, input().split()))\n\n\na = sorted(a)\n\nleftCandy = 0\nchildrenCnt = 0\nfor i in range(len(a)):\n leftCandy = x - a[i]\n if leftCandy >= 0:\n childrenCnt += 1\n\nprint(childrenCnt)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\n\n\na = sorted(a)\n\nleftCandy = 0\nchildrenCnt = 0\nfor i in range(len(a)):\n leftCandy = x - a[i]\n if leftCandy >= 0:\n childrenCnt += 1\n\nprint(childrenCnt)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\n\n\na = sorted(a)\n\nleftCandy = x\nchildrenCnt = 0\nfor i in range(len(a)):\n leftCandy -= a[i]\n if leftCandy >= 0:\n childrenCnt += 1\n\nif leftCandy > 0:\n childrenCnt -= 1\n\nprint(childrenCnt)\n\n\n\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s647813742', 's985376891', 's725563700']
[3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[298, 298, 337]
p03254
u509739538
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['import math\nfrom collections import deque\nfrom collections import defaultdict\n\n\ndef readInt():\n\treturn int(input())\ndef readInts():\n\treturn list(map(int, input().split()))\ndef readChar():\n\treturn input()\ndef readChars():\n\treturn input().split()\ndef factorization(n):\n\tres = []\n\tif n%2==0:\n\t\tres.append(2)\n\tfor i in range(3,math.floor(n//2)+1,2):\n\t\tif n%i==0:\n\t\t\tc = 0\n\t\t\tfor j in res:\n\t\t\t\tif i%j==0:\n\t\t\t\t\tc=1\n\t\t\tif c==0:\n\t\t\t\tres.append(i)\n\treturn res\ndef fact2(n):\n\tp = factorization(n)\n\tres = []\n\tfor i in p:\n\t\tc=0\n\t\tz=n\n\t\twhile 1:\n\t\t\tif z%i==0:\n\t\t\t\tc+=1\n\t\t\t\tz/=i\n\t\t\telse:\n\t\t\t\tbreak\n\t\tres.append([i,c])\n\treturn res\ndef fact(n):\n\tans = 1\n\tm=n\n\tfor _i in range(n-1):\n\t\tans*=m\n\t\tm-=1\n\treturn ans\ndef comb(n,r):\n\tif n<r:\n\t\treturn 0\n\tl = min(r,n-r)\n\tm=n\n\tu=1\n\tfor _i in range(l):\n\t\tu*=m\n\t\tm-=1\n\treturn u//fact(l)\ndef combmod(n,r,mod):\n\treturn (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod\ndef printQueue(q):\n\tr=copyQueue(q)\n\tans=[0]*r.qsize()\n\tfor i in range(r.qsize()-1,-1,-1):\n\t\tans[i] = r.get()\n\tprint(ans)\nclass UnionFind():\n\tdef __init__(self, n):\n\t\tself.n = n\n\t\tself.parents = [-1]*n\n\n\tdef find(self, x): # root\n\t\tif self.parents[x]<0:\n\t\t\treturn x\n\t\telse:\n\t\t\tself.parents[x] = self.find(self.parents[x])\n\t\t\treturn self.parents[x]\n\n\tdef union(self,x,y):\n\t\tx = self.find(x)\n\t\ty = self.find(y)\n\n\t\tif x==y:\n\t\t\treturn\n\n\t\tif self.parents[x]>self.parents[y]:\n\t\t\tx,y = y,x\n\n\t\tself.parents[x]+=self.parents[y]\n\t\tself.parents[y]=x\n\n\tdef size(self,x):\n\t\treturn -1*self.parents[self.find(x)]\n\n\tdef same(self,x,y):\n\t\treturn self.find(x)==self.find(y)\n\n\tdef members(self,x): # much time\n\t\troot = self.find(x)\n\t\treturn [i for i in range(self.n) if self.find(i)==root]\n\n\tdef roots(self):\n\t\treturn [i for i,x in enumerate(self.parents) if x<0]\n\n\tdef group_count(self):\n\t\treturn len(self.roots())\n\n\tdef all_group_members(self):\n\t\treturn {r: self.members(r) for r in self.roots()} # 1~n\ndef bitArr(n):\n\tx = 1\n\tzero = "0"*n\n\tans = []\n\tans.append([0]*n)\n\tfor i in range(2**n-1):\n\t\tans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))\n\t\tx+=1\n\treturn ans;\ndef arrsSum(a1,a2):\n\tfor i in range(len(a1)):\n\t\ta1[i]+=a2[i]\n\treturn a1\ndef maxValue(a,b,v):\n\tv2 = v\n\tfor i in range(v2,-1,-1):\n\t\tfor j in range(v2//a+1): \n\t\t\tk = i-a*j\n\t\t\tif k%b==0:\n\t\t\t\treturn i\n\treturn -1\ndef copyQueue(q):\n\tnq = queue.Queue()\n\tn = q.qsize()\n\tfor i in range(n):\n\t\tx = q.get()\n\t\tq.put(x)\n\t\tnq.put(x)\n\treturn nq\n\nn,x = readInts()\na = readInts()\na.sort()\nans = []\n\nif a[0]>x:\n\tprint(0)\n\texit()\nelif sum(a)<x:\n\tprint(len(a)-1)\n\nfor i in range(1,len(a)+1):\n\tif sum(a[:i])<=x:\n\t\tans = a[:i]\n\telse:\n\t\tbreak\n\n\nprint(len(ans))', 'import math\nfrom collections import deque\nfrom collections import defaultdict\n\n\ndef readInt():\n\treturn int(input())\ndef readInts():\n\treturn list(map(int, input().split()))\ndef readChar():\n\treturn input()\ndef readChars():\n\treturn input().split()\ndef factorization(n):\n\tres = []\n\tif n%2==0:\n\t\tres.append(2)\n\tfor i in range(3,math.floor(n//2)+1,2):\n\t\tif n%i==0:\n\t\t\tc = 0\n\t\t\tfor j in res:\n\t\t\t\tif i%j==0:\n\t\t\t\t\tc=1\n\t\t\tif c==0:\n\t\t\t\tres.append(i)\n\treturn res\ndef fact2(n):\n\tp = factorization(n)\n\tres = []\n\tfor i in p:\n\t\tc=0\n\t\tz=n\n\t\twhile 1:\n\t\t\tif z%i==0:\n\t\t\t\tc+=1\n\t\t\t\tz/=i\n\t\t\telse:\n\t\t\t\tbreak\n\t\tres.append([i,c])\n\treturn res\ndef fact(n):\n\tans = 1\n\tm=n\n\tfor _i in range(n-1):\n\t\tans*=m\n\t\tm-=1\n\treturn ans\ndef comb(n,r):\n\tif n<r:\n\t\treturn 0\n\tl = min(r,n-r)\n\tm=n\n\tu=1\n\tfor _i in range(l):\n\t\tu*=m\n\t\tm-=1\n\treturn u//fact(l)\ndef combmod(n,r,mod):\n\treturn (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod\ndef printQueue(q):\n\tr=copyQueue(q)\n\tans=[0]*r.qsize()\n\tfor i in range(r.qsize()-1,-1,-1):\n\t\tans[i] = r.get()\n\tprint(ans)\nclass UnionFind():\n\tdef __init__(self, n):\n\t\tself.n = n\n\t\tself.parents = [-1]*n\n\n\tdef find(self, x): # root\n\t\tif self.parents[x]<0:\n\t\t\treturn x\n\t\telse:\n\t\t\tself.parents[x] = self.find(self.parents[x])\n\t\t\treturn self.parents[x]\n\n\tdef union(self,x,y):\n\t\tx = self.find(x)\n\t\ty = self.find(y)\n\n\t\tif x==y:\n\t\t\treturn\n\n\t\tif self.parents[x]>self.parents[y]:\n\t\t\tx,y = y,x\n\n\t\tself.parents[x]+=self.parents[y]\n\t\tself.parents[y]=x\n\n\tdef size(self,x):\n\t\treturn -1*self.parents[self.find(x)]\n\n\tdef same(self,x,y):\n\t\treturn self.find(x)==self.find(y)\n\n\tdef members(self,x): # much time\n\t\troot = self.find(x)\n\t\treturn [i for i in range(self.n) if self.find(i)==root]\n\n\tdef roots(self):\n\t\treturn [i for i,x in enumerate(self.parents) if x<0]\n\n\tdef group_count(self):\n\t\treturn len(self.roots())\n\n\tdef all_group_members(self):\n\t\treturn {r: self.members(r) for r in self.roots()} # 1~n\ndef bitArr(n):\n\tx = 1\n\tzero = "0"*n\n\tans = []\n\tans.append([0]*n)\n\tfor i in range(2**n-1):\n\t\tans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))\n\t\tx+=1\n\treturn ans;\ndef arrsSum(a1,a2):\n\tfor i in range(len(a1)):\n\t\ta1[i]+=a2[i]\n\treturn a1\ndef maxValue(a,b,v):\n\tv2 = v\n\tfor i in range(v2,-1,-1):\n\t\tfor j in range(v2//a+1): \n\t\t\tk = i-a*j\n\t\t\tif k%b==0:\n\t\t\t\treturn i\n\treturn -1\ndef copyQueue(q):\n\tnq = queue.Queue()\n\tn = q.qsize()\n\tfor i in range(n):\n\t\tx = q.get()\n\t\tq.put(x)\n\t\tnq.put(x)\n\treturn nq\n\nn,x = readInts()\na = readInts()\na.sort()\nans = []\nfor i in range(1,len(a)+1):\n\tif sum(a[:i])<=x:\n\t\tans = a[:i]\n\telse:\n\t\tbreak\n\nif sum(ans)<=x:\n\tprint(len(ans))\nelse:\n\tprint(max(len(ans)-1,0))', 'import math\nfrom collections import deque\nfrom collections import defaultdict\n\n\ndef readInt():\n\treturn int(input())\ndef readInts():\n\treturn list(map(int, input().split()))\ndef readChar():\n\treturn input()\ndef readChars():\n\treturn input().split()\ndef factorization(n):\n\tres = []\n\tif n%2==0:\n\t\tres.append(2)\n\tfor i in range(3,math.floor(n//2)+1,2):\n\t\tif n%i==0:\n\t\t\tc = 0\n\t\t\tfor j in res:\n\t\t\t\tif i%j==0:\n\t\t\t\t\tc=1\n\t\t\tif c==0:\n\t\t\t\tres.append(i)\n\treturn res\ndef fact2(n):\n\tp = factorization(n)\n\tres = []\n\tfor i in p:\n\t\tc=0\n\t\tz=n\n\t\twhile 1:\n\t\t\tif z%i==0:\n\t\t\t\tc+=1\n\t\t\t\tz/=i\n\t\t\telse:\n\t\t\t\tbreak\n\t\tres.append([i,c])\n\treturn res\ndef fact(n):\n\tans = 1\n\tm=n\n\tfor _i in range(n-1):\n\t\tans*=m\n\t\tm-=1\n\treturn ans\ndef comb(n,r):\n\tif n<r:\n\t\treturn 0\n\tl = min(r,n-r)\n\tm=n\n\tu=1\n\tfor _i in range(l):\n\t\tu*=m\n\t\tm-=1\n\treturn u//fact(l)\ndef combmod(n,r,mod):\n\treturn (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod\ndef printQueue(q):\n\tr=copyQueue(q)\n\tans=[0]*r.qsize()\n\tfor i in range(r.qsize()-1,-1,-1):\n\t\tans[i] = r.get()\n\tprint(ans)\nclass UnionFind():\n\tdef __init__(self, n):\n\t\tself.n = n\n\t\tself.parents = [-1]*n\n\n\tdef find(self, x): # root\n\t\tif self.parents[x]<0:\n\t\t\treturn x\n\t\telse:\n\t\t\tself.parents[x] = self.find(self.parents[x])\n\t\t\treturn self.parents[x]\n\n\tdef union(self,x,y):\n\t\tx = self.find(x)\n\t\ty = self.find(y)\n\n\t\tif x==y:\n\t\t\treturn\n\n\t\tif self.parents[x]>self.parents[y]:\n\t\t\tx,y = y,x\n\n\t\tself.parents[x]+=self.parents[y]\n\t\tself.parents[y]=x\n\n\tdef size(self,x):\n\t\treturn -1*self.parents[self.find(x)]\n\n\tdef same(self,x,y):\n\t\treturn self.find(x)==self.find(y)\n\n\tdef members(self,x): # much time\n\t\troot = self.find(x)\n\t\treturn [i for i in range(self.n) if self.find(i)==root]\n\n\tdef roots(self):\n\t\treturn [i for i,x in enumerate(self.parents) if x<0]\n\n\tdef group_count(self):\n\t\treturn len(self.roots())\n\n\tdef all_group_members(self):\n\t\treturn {r: self.members(r) for r in self.roots()} # 1~n\ndef bitArr(n):\n\tx = 1\n\tzero = "0"*n\n\tans = []\n\tans.append([0]*n)\n\tfor i in range(2**n-1):\n\t\tans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))\n\t\tx+=1\n\treturn ans;\ndef arrsSum(a1,a2):\n\tfor i in range(len(a1)):\n\t\ta1[i]+=a2[i]\n\treturn a1\ndef maxValue(a,b,v):\n\tv2 = v\n\tfor i in range(v2,-1,-1):\n\t\tfor j in range(v2//a+1): \n\t\t\tk = i-a*j\n\t\t\tif k%b==0:\n\t\t\t\treturn i\n\treturn -1\ndef copyQueue(q):\n\tnq = queue.Queue()\n\tn = q.qsize()\n\tfor i in range(n):\n\t\tx = q.get()\n\t\tq.put(x)\n\t\tnq.put(x)\n\treturn nq\n\nn,x = readInts()\na = readInts()\na.sort()\nans = []\n\nif a[0]>x:\n\tprint(0)\n\texit()\nelif sum(a)<x:\n\tprint(len(a)-1)\n\texit()\n\nfor i in range(1,len(a)+1):\n\tif sum(a[:i])<=x:\n\t\tans = a[:i]\n\telse:\n\t\tbreak\n\n\nprint(len(ans))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s416361092', 's923650966', 's654001070']
[3444.0, 3444.0, 3444.0]
[22.0, 22.0, 22.0]
[2668, 2653, 2676]
p03254
u516687307
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\n#print(a)\ncnt=0\nfor i in range(n):\n if (x-a[i]>=0):\n cnt=cnt+1\n x=x-a[i]\nprint(cnt)\n', 'n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nprint(a)\ncnt=0\nfor i in range(n):\n if (x-a[i]>=0):\n cnt=cnt+1\n x=x-a[i]\n #print(x)\nif x <= 0:\n print(cnt)\nelse:\n print(cnt-1)\n', 'n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\n#print(a)\ncnt=0\nfor i in range(n):\n if (x-a[i]>=0):\n cnt=cnt+1\n x=x-a[i]\n #print(x)\nprint(cnt)\n', 'n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\n#print(a)\ncnt=0\nfor i in range(n):\n if (x-a[i]>=0):\n cnt=cnt+1\n x=x-a[i]\n #print(x)\nif x <= 0:\n print(cnt)\nelse:\n print(cnt-1)\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s005191648', 's053019488', 's253003368', 's729409683']
[2940.0, 3060.0, 2940.0, 2940.0]
[17.0, 17.0, 18.0, 17.0]
[168, 219, 182, 220]
p03254
u517152997
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['# -*- coding: utf-8 -*-\n# \nimport math\nimport sys\nimport itertools\nimport numpy as np\n\n\nn,x = map(int, input().split())\n\n\na = [int(i) for i in input().split()]\n\na=sorted(a)\n\n#print(a)\nanswer=0\nfor i in range(n-1):\n if x >= a[i]:\n answer += 1\n x -= a[i]\n print(x,a[i])\n else:\n break\nif x == a[n-1]:\n answer += 1\nprint(answer)\n\n', '# -*- coding: utf-8 -*-\n# \nimport math\nimport sys\nimport itertools\nimport numpy as np\n\n\nn,x = map(int, input().split())\n\n\na = [int(i) for i in input().split()]\n\na=sorted(a)\n\n#print(a)\nanswer=0\nfor i in range(n-1):\n if x >= a[i]:\n answer += 1\n x -= a[i]\n# print(x,a[i])\n else:\n break\nif x == a[n-1]:\n answer += 1\nprint(answer)\n\n']
['Wrong Answer', 'Accepted']
['s427513414', 's862983633']
[21828.0, 21704.0]
[1822.0, 1633.0]
[430, 431]
p03254
u519604525
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x=map(int, input().split())\na=[]\na=list(map(int, input().split()))\na.sort()\nA=0\nB=0\nfor i in range(N):\n A=A+a[i]\n if A<=x:\n B+=1\nprint(B)', 'N, x=map(int, input().split())\na=[]\na=list(map(int, input().split()))\na.sort()\nA=0\nB=0\nfor i in range(N):\n A=A+a[i]\n if A<=x:\n B+=1\nif A<x:\n B=B-1\nprint(B)\n ']
['Wrong Answer', 'Accepted']
['s583301232', 's373446915']
[3060.0, 3060.0]
[18.0, 17.0]
[153, 180]
p03254
u519939795
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,x=map(int,input().split())\nans=0\na=sorted(list(map(int,input().split())))\nfor i in range(n):\n x-=a[i]\n if x>=0:\n ans+=1\nprint(ans)', 'n,x=map(int,input().split())\na=sorted(list(map(int,input().split())))\nans=0\nfor i in range(n):\n if x>=a[i]:\n ans+=1\n x-=a[i]\n else:\n break\nif ans == n:\n if x!=0:\n ans-=1\nprint(x)\nprint(ans)', 'n,x=map(int,input().split())\na=sorted(list(map(int,input().split())))\nfor i in range(n):\n x-=a[i]\n if x<0:\n break\n else:\n if x==0:\n i+=1\nprint(i)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s402233884', 's469750284', 's472030576']
[2940.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0]
[145, 226, 179]
p03254
u522205105
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N,k = map(int,input().split())\n\ns = list(map(int,input().split()))\ns.sort()\nprint(s)\ncount = 0\nfor i in range(N):\n\tif k - s[i] >= 0:\n\t\tcount += 1\n\t\tk -= s[i]\n\telse:\n\t\tbreak\n\nif count == N :\n\tif k>0:\n\t\tcount -= 1\n\tprint(count)\nelse:\n\tprint(count)', 'N,k = map(int,input().split())\n\ns = list(map(int,input().split()))\ns.sort()\n\ncount = 0 \nfor i in range(N):\n\tif k - s[i] >= 0:\n\t\tcount += 1\n\t\tk -= s[i]\n\tif 0 > k:\n\t\tbreak \nprint(count)', 'N,k = map(int,input().split())\n\ns = list(map(int,input().split()))\ns.sort()\n\ncount = 0 \nfor i in range(N):\n\tif k - s[i] >= 0:\n\t\tcount += 1\n\t\tk -= s[i]\nprint(count)', 'N,k = map(int,input().split())\n\ns = list(map(int,input().split()))\ns.sort()\n\ncount = 0\nfor i in range(N):\n\tif k - s[i] >= 0:\n\t\tcount += 1\n\t\tk -= s[i]\n\telse:\n\t\tbreak\n\nif count == N :\n\tif k>0:\n\t\tcount -= 1\n\tprint(count)\nelse:\n\tprint(count)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s552436537', 's788358966', 's866382524', 's385566438']
[3064.0, 3060.0, 2940.0, 3064.0]
[17.0, 17.0, 17.0, 17.0]
[245, 183, 163, 237]
p03254
u526532903
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n, x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\n\ncnt = 0\nfor i in a:\n if x >= i:\n cnt = cnt + 1\n else:\n break\n x = x - i\n\nif x < 0:\n cnt = cnt - 1\nprint (cnt)\n', 'n, x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\n\ncnt = 0\nfor i in a:\n if x >= i:\n x = x - i\n cnt = cnt + 1\n else:\n x = x - i\n break\n\nif x > 0:\n cnt = cnt - 1\nprint (cnt)\n']
['Wrong Answer', 'Accepted']
['s761009564', 's310704085']
[3060.0, 3060.0]
[17.0, 17.0]
[213, 235]
p03254
u527925554
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
[' _, X = map(int, input().split())\nA = sorted(list(map(int, input().split())))\n\ncount = 0\nfor a in A:\n if a > X:\n break\n X -= a\n count += 1\n\nif X > 0:\n count -= 1\n\nprint(count)', ' _, X = map(int, input().split())\nA = sorted(list(map(int, input().split())))\n\ncount = 0\nfor a in A:\n if X - a >= 0:\n X -= a\n count += 1\nelse:\n if count > 1 and X > 0:\n count -= 1\n\nprint(count)', '_, X = map(int, input().split())\nA = sorted(list(map(int, input().split())))\n\ncount = 0\nfor a in A:\n if X - a >= 0:\n X -= a\n count += 1\n\nif count == len(A) and X > 0:\n count -= 1\n\nprint(count)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s027202159', 's226782637', 's728671479']
[2940.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0]
[194, 220, 212]
p03254
u530383736
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['# -*- coding: utf-8 -*-\n\n\n#----------\nn,x = list(map(int, input().rstrip().split()))\na_list = list(map(int, input().rstrip().split()))\n#----------\na_list.sort()\n\nx_remain=x\nresult = -1\nfor i in range(n):\n x_remain -= a_list[i]\n \n if x_remain < 0:\n result = i\n break\n\nif result == -1 :\n result = n\n\nprint(result)\n', '# -*- coding: utf-8 -*-\n\n\n#----------\nn,x = list(map(int, input().rstrip().split()))\na_list = list(map(int, input().rstrip().split()))\n#----------\na_list.sort()\nx_remain=x\n\nresult = -1\nfor i in range(n):\n x_remain -= a_list[i]\n \n if x_remain == 0:\n result = i+1\n break\n if x_remain < 0:\n result = i\n break\n\nif result == -1 :\n result = n-1\n\nprint(result)\n']
['Wrong Answer', 'Accepted']
['s494683220', 's914236802']
[3060.0, 3060.0]
[17.0, 17.0]
[336, 397]
p03254
u534953209
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x = map(int,input().split())\nA = sorted(list(map(int, input().split())))\nans = 0\nsum = 0\nfor i, A_i in enumerate(A):\n\tif sum + A_i <= x:\n\t\tans = i + 1\n\t\tsum += A_i\n\telse:\n\t\tbreak\nprint(ans)\n', 'N, x = map(int,input().split())\nA = sorted(list(map(int, input().split())))\nans = 0\nsu = 0\nfor i, A_i in enumerate(A):\n\tif su + A_i <= x:\n\t\tans = i + 1\n\t\tsu += A_i\n\telse:\n\t\tbreak\nif sum(A) < x:\n\tans -= 1\nprint(max(0, ans))']
['Wrong Answer', 'Accepted']
['s871903398', 's324335919']
[2940.0, 3064.0]
[17.0, 17.0]
[193, 222]
p03254
u536113865
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['ri = lambda: list(map(int,input().split()))\n\nn,x = ri()\na = sorted(ri())\nans = 0\nc = 0\nfor i in a:\n c += i\n if c>=x:\n break\n ans += 1\nprint(ans)\n', 'ri = lambda: list(map(int,input().split()))\n\nn,x = ri()\na = sorted(ri())\nans = 0\nc = 0\nfor i in a:\n c += i\n if c>x:\n break\n ans += 1\nprint(ans)', 'ri = lambda: list(map(int,input().split()))\n\nn,x = ri()\na = sorted(ri())\nans = 0\nc = 0\nfor i in a:\n c += i\n if c>x:\n break\n ans += 1\nif c<x: ans -= 1\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s360754004', 's576297347', 's862171174']
[3316.0, 3316.0, 3316.0]
[21.0, 21.0, 19.0]
[161, 159, 176]
p03254
u538497610
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N,x=map(int,input().split())\nchildren=[int(_) for _ in input().split()]\nchildren.sort()\n\nfor i in range(len(children)):\n x-=children[i]\n if x<0:\n print(i)\n exit()\n\nprint(N)', 'N,x=map(int,input().split())\nchildren=[int(_) for _ in input().split()]\nchildren.sort()\n\nfor i in range(len(children)):\n x-=children[i]\n if x<0:\n print(i)\n exit()\n\nif x==0 :print(N)\nelse:print(N-1)']
['Wrong Answer', 'Accepted']
['s920632387', 's663860039']
[2940.0, 3060.0]
[17.0, 17.0]
[192, 217]
p03254
u539517139
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,x=map(int,input().split())\na=sorted(list(map(int,input().split())))\ns=a[0]\ni=0\nwhile s<=x and i<n-1:\n i+=1\n s+=a[i]\nif i==n-1 and s<x:\n i-=1\nprint(i)', 'n,x=map(int,input().split())\na=sorted(list(map(int,input().split())))\ns=0\ni=0\nwhile s<x:\n s+=a[i]\n i+=1\nprint(i+1)', 'n,x=map(int,input().split())\na=sorted(list(map(int,input().split())))\ns=a[0]\ni=0\nwhile s<x:\n i+=1\n s+=a[i]\nprint(i)', 'n,x=map(int,input().split())\na=sorted(list(map(int,input().split())))\ns=a[0]\ni=0\nwhile s<=x and i<n-1:\n i+=1\n s+=a[i]\nif i==n-1 and s<x:\n i-=1\nelif i==n-1:\n i+=1\nprint(i)', 'n,x=map(int,input().split())\na=sorted(list(map(int,input().split())))\ns=a[0]\ni=0\nwhile s<=x and i<n:\n i+=1\n s+=a[i]\nprint(i)', 'n,x=map(int,input().split())\na=sorted(list(map(int,input().split())))\ns=a[0]\ni=0\nwhile s<=x and i<n-1:\n i+=1\n s+=a[i]\nif i==n-1 and s<x:\n i-=1\nelif i==n-1 and s==x:\n i+=1\nprint(i)', 'n,x=map(int,input().split())\na=sorted(list(map(int,input().split())))\ns=a[0]\ni=0\nwhile s<=x:\n i+=1\n s+=a[i]\nprint(i)', 'n,x=map(int,input().split())\na=sorted(list(map(int,input().split())))\nfor i in range(n):\n x=x-a[i]\n if x<0:\n break\nif i==n-1 and x==0:\n i+=1\nprint(i)']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s083634336', 's212218417', 's271262404', 's671790904', 's880134145', 's903966945', 's934251258', 's825922455']
[3060.0, 3060.0, 2940.0, 3060.0, 2940.0, 3060.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0, 17.0, 17.0, 18.0, 18.0, 17.0]
[154, 116, 117, 174, 126, 183, 118, 155]
p03254
u540761833
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['from itertools import accumulate\nimport bisect\nN,x = map(int,input().split())\nA = sorted(list(map(int,input().split())))\nA = list(accumulate(A))\nind = bisect.bisect_right(A,x)-1\nif ind == -1:\n print(0)\nelse:\n print(ind+1)\n', 'from itertools import accumulate\nimport bisect\nN,x = map(int,input().split())\nA = sorted(list(map(int,input().split())))\nA = list(accumulate(A))\nind = bisect.bisect_right(A,x)-1\nif ind == -1:\n print(0)\nelif ind == N-1:\n if A[ind] == x:\n print(ind+1)\n else:\n print(ind)\nelse:\n print(ind+1)\n']
['Wrong Answer', 'Accepted']
['s331459610', 's029289777']
[3060.0, 3188.0]
[18.0, 18.0]
[228, 315]
p03254
u541610817
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x = [int(z) for z in input().split()]\nchildren = [int(z) for z in input().split()]\n\nchildren.sort()\ncnt = 0\n\nfor i in children:\n if x - i < 0:\n break\n else:\n x -= i\n cnt += 1\n \nprint(cnt)\n', 'N, x = [int(z) for z in input().split()]\nchildren = [int(z) for z in input().split()]\n\nchildren.sort()\ncnt = 0\n\nfor i in children:\n if x - i < 0:\n break\n else:\n x -= i\n cnt += 1\n\nprint(cnt)\n', 'N, x = [int(z) for z in input().split()]\nchildren = [int(z) for z in input().split()]\n\nchildren.sort()\ncnt = 0\n\nfor i in children:\n cnt += 1\n if x - i < 0:\n break\n else:\n x -= i\n\nprint(cnt)\n', 'N, x = [int(z) for z in input().split()]\nchildren = [int(z) for z in input().split()]\n\nchildren.sort()\ncnt = 0\n\nfor i in children:\n if x - i < 0:\n break\n elif i == children[N - 1] and x - i > 0:\n print(N - 1)\n else:\n x -= i\n cnt += 1\n\nprint(cnt)\n', 'N, x = [int(z) for z in input().split()]\nchildren = [int(z) for z in input().split()]\n\nchildren.sort()\nsum = 0\n\nfor i in range(N):\n sum += children[i]\n if sum >= x:\n print(i + 1)\n break\n', 'N, x = [int(z) for z in input().split()]\nchildren = [int(z) for z in input().split()]\n\nchildren.sort()\ncnt = 0\n\nfor i in children:\n if x - i < 0:\n break\n else:\n x -= i\n cnt += 1\n \nprint(cnt)\n', 'N, x = [int(z) for z in input().split()]\nchildren = [int(z) for z in input().split()]\n\nchildren.sort()\nsum = 0\n\nfor i in children:\n sum += i\n\nif sum < x:\n print(N - 1)\n\n# print(N)\nelse:\n cnt = 0\n for i in children:\n if x - i < 0:\n break\n else:\n x -= i\n cnt += 1\n print(cnt)\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s123729928', 's357776648', 's443413983', 's606432154', 's679847384', 's746018009', 's444009298']
[2940.0, 2940.0, 2940.0, 3060.0, 2940.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0]
[225, 217, 213, 283, 206, 225, 354]
p03254
u543954314
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n, x = map(int, input().split())\na = list(map(int, input().split()))\nif sum(a) < n:\n print(n-1)\n exit()\na.sort()\ncnt = 0\ni = 0\nwhile a[i] <= n:\n cnt += 1\n n -= a[i]\n i += 1\nprint(cnt)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\nif sum(a) < x:\n print(n-1)\n exit()\na.sort()\ncnt = 0\ni = 0\nwhile i < n and a[i] <= x:\n cnt += 1\n x -= a[i]\n i += 1\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s718199744', 's874088818']
[3060.0, 3064.0]
[18.0, 18.0]
[188, 198]
p03254
u546440137
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,x=map(int,input().split())\n\na=list(map(int,input().split()))\n\na.sort()\n\ns=0\ni=0\n\nif n==0:\n print(0)\n exit()\nelif sum(a)<=x:\n print(n)\n exit()\nelif min(a)>x:\n print(0)\n exit()\nelse:\n while s<x:\n s+=a[i]\n i+=1\n\nprint(i-1)\n', 'n,x=map(int,input().split())\n\na=list(map(int,input().split()))\n\na.sort()\n\ns=0\ni=0\n\nif sum(a)<=x:\n print(n)\n exit()\nelif min(a)>x:\n print(0)\n exit()\nelse:\n while s<x:\n s+=a[i]\n i+=1\n\nprint(i-1)\n', 'a=list(map(int,input().split()))\n\na.sort()\n\ns=0\ni=0\n\nif sum(a)<=x:\n print(n)\n exit()\nelif min(a)>x:\n print(0)\n exit()\nelse:\n while s<x:\n s+=a[i]\n i+=1\n\nprint(s)\nprint(i-1)', 'n,x=map(int,input().split())\n\na=list(map(int,input().split()))\n\na.sort()\n\ns=0\ni=0\n\nif sum(a)<x:\n print(n)\n exit()\nelif min(a)>x:\n print(0)\n exit()\nelse:\n while s<x:\n s+=a[i]\n i+=1\n\nprint(i)\n', 'a=list(map(int,input().split()))\n\na.sort()\n\ns=0\ni=0\n\nif sum(a)<=x:\n print(n)\n exit()\nelif min(a)>x:\n print(0)\n exit()\nelse:\n while s<x:\n s+=a[i]\n i+=1\n\nprint(i-1)', 'n,x=map(int,input().split())\n\na=list(map(int,input().split()))\n\na.sort()\n\ns=0\ni=0\n\nif sum(a)<=x:\n print(n)\n exit()\nelif min(a)>x:\n print(0)\n exit()\nelse:\n while s<=x:\n s+=a[i]\n i+=1\n\nprint(s)\nprint(i-1)\n', 'n,x=map(int,input().split())\n\na=list(map(int,input().split()))\n\na.sort()\n\ns=0\ni=0\n\nif sum(a)<x:\n print(n)\n exit()\nelse:\n while s<x:\n s+=a[i]\n i+=1\n\nprint(i)\n', 'n,x=map(int,input().split())\n\na=list(map(int,input().split()))\n\na.sort()\n\ns=0\ni=0\n\nif sum(a)<=x:\n print(n)\n exit()\nelif min(a)>x:\n print(0)\n exit()\nelse:\n while s<=x:\n s+=a[i]\n i+=1\n\nprint(i-1)\n', 'n,x=map(int,input().split())\n\na=list(map(int,input().split()))\n\na.sort()\n\ncount=0\n \nif x<a[0]:\n print(0)\n exit()\n\n\nfor i in range(n):\n if x>=a[i]:\n x-=a[i]\n count+=1\n else:\n print(count)\n exit()\n\nif x>0:\n print(count-1)\nelse:\n print(count)']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s025459605', 's053676820', 's091066232', 's136054304', 's268925556', 's362388877', 's364407871', 's406150249', 's811922833']
[9156.0, 9004.0, 9192.0, 9176.0, 9176.0, 9028.0, 9164.0, 8960.0, 9164.0]
[27.0, 26.0, 23.0, 27.0, 25.0, 29.0, 28.0, 28.0, 23.0]
[257, 222, 200, 219, 191, 232, 180, 223, 285]
p03254
u546959066
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, V = list(map(int, input().split()))\nC = filter(lambda x: x<=V, map(int, input().split()))\nC = list(C)\nN = len(C)\n\ncnt = 0\nfor c in sorted(C):\n if V>0 and V-c>=0:\n cnt += 1\n V -= c\n if V<=0:\n break\nprint(cnt)\n', 'N, V = list(map(int, input().split()))\nC = list(map(int, input().split()))\nN = len(C)\n\nif sum(C)==V:\n print(N)\nelse:\n cnt = 0\n for c in sorted(C):\n if V-c>0:\n cnt += 1\n V -= c\n elif V-c==0:\n cnt += 1\n break\n else:\n break\n print(min(cnt, N-1))\n']
['Wrong Answer', 'Accepted']
['s776315311', 's308668401']
[3060.0, 3060.0]
[17.0, 17.0]
[222, 281]
p03254
u549161102
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N,x = map(int, input().split())\nA = list(map(int, input().split()))\nA.sort()\ncount = 0\n\nfor i in range(N):\n b = x - A[i]\n if b > 0:\n count += 1\n x -= A[i]\n else:\n exit()\nprint(count)', 'N,x = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.sort()\nS = 0\ncount = 0\n\nfor i in range(N):\n S += A[i]\n \nif S < x:\n print(N-1)\n exit()\nelse:\n for i in range(N):\n b = x - A[i]\n if b > 0:\n count += 1\n x -= A[i]\n elif b == 0:\n count += 1 \n break\n else:\n break\n print(count)']
['Wrong Answer', 'Accepted']
['s024618353', 's918638719']
[3060.0, 3064.0]
[17.0, 18.0]
[194, 336]
p03254
u550768621
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x = map(int, input())\nchild_list = list(map(int, input()))\n\nnokori = x - min(child_list)\nplease_child = 0 \nwhile nokori >0:\n please_child +=1\n mini = min(child_list)\n child_list.remove(mini)\n if child_list == []:\n break\n nokori -= min(child_list)\nprint(please_child)', 'x = input()\nchild_list = map(int, input().split())\n\nfor x>0:\n if x - min(child_list) > 0:\n please_child +=1\n child_list = child_list.pop(min(child_list))\n else:\n break\nprint(please_child)', 'N, x = map(int, input())\nchild_list = list(map(int, input()))\n\nnokori = x - min(child_list)\nplease_child = 0 \nwhile nokori >=0:\n please_child +=1\n mini = min(child_list)\n child_list.remove(mini)\n if child_list == []:\n break\n nokori -= min(child_list)\nprint(please_child)', 'n, x = map(int, input().split())\nchild_list = list(map(int, input().split()))\n\nfor x>0:\n if x - min(child_list) > 0:\n please_child +=1\n child_list = child_list.pop(min(child_list))\n if child_list == []:\n break\n if x - min(child_list) =< 0:\n break\nprint(please_child)', 'N, x = map(int, input())\nchild_list = list(map(int, input()))\n\nnokori = x - min(child_list)\nplease_child = 0 \nwhile nokori >=0:\n please_child +=1\n mini = min(child_list)\n child_list.remove(mini)\n if child_list == []:\n break\n if len(child_list) == 1:\n if nokori == min(child_list):\n please_child += 1\n if nokori > min(child_list):\n break\n else: \n nokori -= min(child_list)\nprint(please_child)', 'n, x = map(int, input().split())\nchild_list = list(map(int, input().split()))\n\nfor x>0:\n if x - min(child_list) > 0:\n please_child +=1\n child_list = child_list.remove(min(child_list))\n if child_list == []:\n break\n if x - min(child_list) =< 0:\n break\nprint(please_child)', 'N, x = map(int, input().split())\nchild_list = list(map(int, input().split()))\n\nif len(child_list) == 1:\n if x > min(child_list):\n please_child = 0\n elif x == min(child_list):\n please_child = 1\nelif len(child_list) > 1:\n nokori = x - min(child_list)\n please_child = 0 \n while nokori >=0:\n please_child +=1\n mini = min(child_list)\n child_list.remove(mini)\n if child_list == []:\n break\n if len(child_list) == 1:\n if nokori == min(child_list):\n please_child += 1\n if nokori > min(child_list):\n break\n else:\n \tbreak\n else: \n nokori -= min(child_list)\nprint(please_child)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s020790583', 's302324583', 's358277946', 's529942650', 's733731022', 's902970018', 's237040510']
[3060.0, 2940.0, 3060.0, 2940.0, 3064.0, 2940.0, 3064.0]
[17.0, 18.0, 18.0, 17.0, 17.0, 20.0, 17.0]
[291, 198, 292, 281, 462, 284, 735]
p03254
u551373727
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x = map(int, input().split())\na = list(map(int, input().split()))\n\nans = 0\nuse_list = []\nfor i in range(2**N):\n use_list.append(list(map(int, list(bin(i)[2::].zfill(N)))))\nfor u in use_list:\n s = 0\n \n for i in range(N):\n if u[i] == 1:\n s += a[i]\n if s <= x:\n ans = max(ans, sum(u))\nprint(ans)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\ndp = [[]]\na.sort()\nans = 0\nf = False\nfor b in a:\n if b <= x:\n ans += 1\n x -= b\n f = True\n else:\n f = False\nif x > 0 and f:\n ans -= 1\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s375712890', 's713347569']
[124652.0, 3060.0]
[2111.0, 17.0]
[335, 250]
p03254
u551437236
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\ncount = 0\nfor i in a:\n if x-i>=0:\n x -= i\n count += 1\n\n\nprint(count)\n', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\ncount = 0\nfor i in a:\n if x-i>=0:\n x -= i\n count += 1\n elif x-i<=0:\n break\n\nprint(count)\n', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\n\nfor i in range(n):\n x-=a[i]\n if x<0:\n print(i)\n break\n\nif x >0:\n print(n-1)\nelif x==0:\n print(n)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s684405874', 's871295238', 's039785938']
[2940.0, 2940.0, 3064.0]
[17.0, 18.0, 18.0]
[164, 194, 202]
p03254
u556589653
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,x = map(int,input().split())\nA = list(map(int,input().split()))\nans = 0\nfor i in range(N):\n if A[i] > x :\n print(ans)\n break\n else:\n x -= A[i]\n if i == N-1:\n print(N-1)\n break', 'N,x = map(int,input().split())\nA = list(map(int,input().split()))\nA.sort()\nans = 0\nfor i in range(N):\n if A[i] <= x:\n if i == N-1:\n if x == A[i]:\n ans += 1\n else:\n x -= A[i]\n ans += 1\n else:\n break\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s845454491', 's540971645']
[9096.0, 9048.0]
[26.0, 28.0]
[201, 242]
p03254
u565380863
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['import sys\n\ninput = sys.stdin.readline\n\n\ndef ii():\n return int(input())\n\n\ndef il():\n return list(map(int, input().split()))\n\n\nN, X = il()\nA = sorted(il())\nc = 0\nfor i in range(N + 1):\n if sum(A[:i]) <= X:\n c = i\nprint(c)\n', 'import sys\n\ninput = sys.stdin.readline\n\n\ndef ii():\n return int(input())\n\n\ndef il():\n return list(map(int, input().split()))\n\n\nN, X = il()\nA = sorted(il())\nif X == sum(A):\n print(N)\n exit()\n\nfor i in range(1, N + 1):\n if sum(A[:i]) > X:\n break\nprint(i - 1)\n']
['Wrong Answer', 'Accepted']
['s529455467', 's932528821']
[3060.0, 3060.0]
[18.0, 18.0]
[237, 278]
p03254
u571999153
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,x = map(int, input().split())\nline = list(map(int, input().split()))\nline.sort()\nans = 0\nfor i in range(n):\n x -= line[i]\n if x < 0:\n break\n else:\n ans += 1\nprint(ans)', 'n,x = map(int, input().split())\nline = list(map(int, input().split()))\nline.sort()\nans = 0\nfor i in range(n):\n x -= line[i]\n if x < 0:\n break\n else:\n ans += 1\n \n if i == n-1 and x != 0:\n ans -= 1\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s575907573', 's842227605']
[9092.0, 9044.0]
[25.0, 24.0]
[178, 223]
p03254
u578501242
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['a=list(map(int,input().split()))\nb=list(map(int,input().split()))\nx=a[0]\ny=a[1]\nb.sort()\ni=0\nk=0\nwhile i ==0:\n\tt=b[0]\n\tif y>=t:\n\t\tk=k+1\n\t\tdel b[0]\n\telse:\n\t\ti=1\n\tif x==k:\n\t\ti=1\nprint(k)', 'a=list(map(int,input().split()))\nb=list(map(int,input().split()))\nx=a[0]\ny=a[1]\nb.sort()\ni=0\nk=0\nwhile i ==0:\n\tt=b[0]\n\tif y>=t:\n\t\tk=k+1\n\t\ty=y-t\n\t\tdel b[0]\n\telse:\n\t\ti=1\n\tif x==k:\n\t\ti=1\nif y>0 and x==k:\n\tk=k-1\nprint(k)']
['Wrong Answer', 'Accepted']
['s714437152', 's205237319']
[3060.0, 3064.0]
[18.0, 17.0]
[184, 216]
p03254
u579699847
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['import bisect,collections,copy,itertools,math,numpy,string\ndef I(): return int(input())\ndef S(): return input()\ndef LI(): return list(map(int,input().split()))\ndef LS(): return list(input().split())\n##################################################\nN,x = LI()\na = LI()\nans = 0\na.sort()\nfor y in a:\n if x>=y:\n x -= y\n ans += 1\n else:\n break\nprint(ans) \n', 'import bisect,collections,copy,itertools,math,numpy,string\ndef I(): return int(input())\ndef S(): return input()\ndef LI(): return list(map(int,input().split()))\ndef LS(): return list(input().split())\n##################################################\nN,x = LI()\na = sorted(LI())\nans = 0\nif a[0]>x:\n pass\nelse:\n for i in range(N):\n if i!=N-1 and a[i+1]<=x:\n x -= a[i]\n ans += 1\n elif i!=N-1 and a[i+1]>x:\n if a[i]==x:\n ans += 1\n break\n else:\n if a[i]==x:\n ans += 1\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s505509517', 's549511287']
[12264.0, 12088.0]
[153.0, 151.0]
[380, 590]
p03254
u580697892
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['#coding: utf-8\nN, x = map(int, input().split())\na = list(map(int, input().split()))\nans = 0\na.sort()\nfor i in range(len(a)):\n x -= a[i]\n ans += 1\n if x < 0:\n ans -= 1\nprint(ans)', '#coding: utf-8\nN, x = map(int, input().split())\na = list(map(int, input().split()))\nans = 0\na.sort()\nfor i in range(len(a)):\n x -= a[i]\n ans += 1\n if x < 0:\n ans -= 1\nprint(ans if x <= 0 else ans - 1)']
['Wrong Answer', 'Accepted']
['s494937860', 's701099497']
[3060.0, 3060.0]
[17.0, 17.0]
[193, 216]
p03254
u581403769
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n, x = map(int, input().split())\na = list(map(int, input().split()))\n\nl = sorted(a)\nflag = False\nfor i in range(n):\n x -= l[i]\n if x < 0:\n flag = True\n break\nif flag:\n print(i)\nelse:\n print(n)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\n\nl = sorted(a)\nflag = False\nfor i in range(n):\n x -= l[i]\n if x < 0:\n flag = True\n break\nif flag:\n print(i)\nelif x = 0:\n print(n)\nelif x > 0:\n print(n - 1)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\n\nl = sorted(a)\nflag = False\nfor i in range(n):\n x -= l[i]\n if x < 0:\n flag = True\n break\nif flag:\n print(i)\nelif x == 0:\n print(n)\nelif x > 0:\n print(n - 1)\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s052525359', 's129403754', 's481492340']
[3060.0, 2940.0, 3060.0]
[18.0, 17.0, 17.0]
[218, 253, 255]
p03254
u584529823
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x = map(int, input().split())\nalist = list(map(int, input().split()))\n\nmax = 0\nfor i in range(1, N + 1):\n if sum(sorted(alist)[:i]) <= x:\n max = i\nprint(max)', 'N, x = map(int, input().split())\nalist = list(map(int, input().split()))\n\nmax = 0\nalist.sort()\nfor i in range(0, N):\n x -= alist[i]\n if x < 0:\n max = i\n break\n if x == 0:\n max = i + 1\n break\nprint(max)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\nmax = 0\nfor i in range(1, N + 1):\n if sum(a[:i]) <= x:\n max = i\nif sum(a[:N + 1]) < x:\n print(N - 1)\nelse:\n print(max)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s503282936', 's656951994', 's248277399']
[2940.0, 3060.0, 3060.0]
[18.0, 17.0, 17.0]
[164, 216, 203]
p03254
u584558499
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
["def main():\n N, x = (int(i) for i in input().split())\n a = [int(i) for i in input().split()]\n num = 0\n for i in sorted(a):\n x -= i\n if x >= 0:\n num += 1\n else:\n break\n\n print(num)\n\n\nif __name__ == '__main__':\n main()", "def main():\n N, x = (int(i) for i in input().split())\n a = [int(i) for i in input().split()]\n num = 0\n for i in sorted(a):\n x -= i\n if x >= 0:\n num += 1\n else:\n break\n if x > 0:\n num -= 1\n print(num)\n\n\nif __name__ == '__main__':\n main()"]
['Wrong Answer', 'Accepted']
['s982833889', 's864094834']
[3060.0, 3064.0]
[17.0, 18.0]
[277, 307]
p03254
u593005350
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N,x=map(int,input().split())\nl=list(map(int,input().split()))\nans=0\nl.sort()\n\nfor n in range(N):\n if l[n]<x:\n x-=l[n]\n ans+=1\n elif l[n]==x:\n x-=l[n]\n ans+=1\n break\n else:\n break\n\nprint(ans)', 'N,x=map(int,input().split())\nl=list(map(int,input().split()))\nans=0\nl.sort()\n\nfor n in range(N):\n if n!=N-1:\n if l[n]<x:\n x-=l[n]\n ans+=1\n elif l[n]==x:\n x-=l[n]\n ans+=1\n break\n else:\n break\n else:\n if l[n]==x:\n x-=l[n]\n ans+=1\n else:\n break\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s296291312', 's349279202']
[3064.0, 3064.0]
[17.0, 18.0]
[241, 393]
p03254
u593567568
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['import itertools\nimport bisect\nN,x = map(int,input().split())\nA = list(map(int,input().split()))\nA.sort()\ncumsum = list(itertools.accumulate(A))\nans = bisect.bisect_right(cumsum,x)\nprint(ans)\n', 'import itertools\nimport bisect\nN,x = map(int,input().split())\nA = list(map(int,input().split()))\nA.sort()\ncumsum = list(itertools.accumulate(A))\nans = bisect.bisect_right(cumsum,x)\n\nif ans == N:\n rest = cumsum[N] - x\n if rest != 0:\n ans -= 1\n\nprint(ans)\n', 'import itertools\nimport bisect\nN,x = map(int,input().split())\nA = list(map(int,input().split()))\nA.sort()\ncumsum = list(itertools.accumulate(A))\nans = bisect.bisect_right(cumsum,x)\n\nif ans == N:\n rest = cumsum[-1] - x\n if rest != 0:\n ans -= 1\n\nprint(ans)\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s396557303', 's784206295', 's520969969']
[3060.0, 3060.0, 3060.0]
[18.0, 18.0, 18.0]
[192, 259, 260]
p03254
u597374218
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N,x=map(int,input().split())\nA=sorted(map(int,input().split()))\na=[0]*len(A)\na[0]=A[0]\ncount=0\nfor i in range(1,len(A)):\n a[i]=A[i]+a[i-1]\nfor i in range(len(A)):\n if a[i]<=x:\n count+=1\nprint(count)', 'N,x=map(int,input().split())\na=sorted(map(int,input().split()))\ncount=0\nfor i in range(N-1):\n x=x-a[i]\n if x>=0:count+=1\nif x==a[N-1]:count+=1\nprint(count)']
['Wrong Answer', 'Accepted']
['s042819039', 's462169406']
[3064.0, 3060.0]
[18.0, 20.0]
[211, 161]
p03254
u597455618
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\ncnt = 0\nfor i in range(n):\n if a[i] <= x:\n x -= a[i]\n cnt += 1\n else:\n break\nprint(cnt)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\ncnt = 0\nfor i in a:\n if i > x:\n break\n x -= i\n cnt += 1\nelse:\n if x > 0:\n cnt -= 1\nprint(cnt)\n']
['Wrong Answer', 'Accepted']
['s792676381', 's779450891']
[3060.0, 2940.0]
[17.0, 17.0]
[176, 182]
p03254
u599547273
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n, x = map(int, input().split(" "))\na = tuple(map(int, input().split(" ")))\n\nfor i, a_i in enumerate(sorted(a)):\n x -= a_i\n if x < 0:\n print(i)\n exit()\nprint(n)', 'n, x = map(int, input().split(" "))\na = list(map(int, input().split(" ")))\n\na.sort()\n\ncount = 0\nfor a_i in a:\n x -= a_i\n if x < 0:\n break\n count += 1\nprint(count)\n', 'n, x = map(int, input().split(" "))\na = list(map(int, input().split(" ")))\n\na.sort()\n\ncount = 0\nfor a_i in a:\n x -= a_i\n if x >= 0:\n count += 1\nprint(count)\n', 'n, x = map(int, input().split(" "))\na = list(map(int, input().split(" ")))\n\na.sort()\n\nfor i in range(n):\n x -= a[i]\n if x < 0:\n print(i)\n exit()\nprint(n)\n', 'n, x = map(int, input().split(" "))\na = list(map(int, input().split(" ")))\n\na.sort()\n\nfor i in range(n):\n x -= a[i]\n if x < 0:\n print(i)\n exit()\n elif x == 0:\n print(i+1)\n exit()\nprint(n)', 'n, x = map(int, input().split(" "))\na = tuple(map(int, input().split(" ")))\n\nfor i, a_i in enumerate(sorted(a)):\n x -= a_i\n if x <= 0:\n print(i)\n exit()\nprint(n)', 'n, x = map(int, input().split(" "))\na = list(map(int, input().split(" ")))\n\na.sort()\n\nfor i in range(n):\n x -= a[i]\n if x <= 0:\n print(i+1)\n exit()\nprint(n)\n', 'n, x = map(int, input().split(" "))\na = list(map(int, input().split(" ")))\n\na.sort()\n\ncount = 0\nfor a_i in a:\n x -= a_i\n if x < 0:\n break\n count += 1\nprint(count-(x>0))']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s014913199', 's149719833', 's516829722', 's581878824', 's604177158', 's673881850', 's983204380', 's242872259']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0]
[180, 179, 170, 174, 224, 181, 177, 184]
p03254
u601913978
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n, x = map(int, input().split())\n\nlis = map(int, input().split())\n\n\ncount = 0\nfor i in sorted(lis):\n x -= i\n if x < 0:\n break\n count += 1\n\nprint(count)\n', 'n, x = map(int, input().split())\n\nlis = map(int, input().split())\n\n\ncount = 0\nfor i in sorted(lis):\n x -= i\n if x < 0:\n break\n count += 1\n\nif x > 0:\n count -= 1\n\nprint(count)\n']
['Wrong Answer', 'Accepted']
['s425443562', 's914575556']
[2940.0, 2940.0]
[17.0, 19.0]
[168, 194]
p03254
u606045429
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x = [int(i) for i in input().split()]\nA = [int(i) for i in input().split()]\n\nA.sort()\n\ncount = 0\nfor i in range(N):\n count += A[i]\n if count > x:\n break\n\nprint(i + 1 if i >= N - 1 else i)', 'from itertools import accumulate\nfrom bisect import bisect_right\n\nN, x, *A = map(int, open(0).read().split())\n\nA.sort()\nS = list(accumulate(A))\n\nif S[-1] == x:\n print(N)\nelse:\n print(min(N - 1, bisect_right(S, x)))']
['Wrong Answer', 'Accepted']
['s650258970', 's339376295']
[3060.0, 3060.0]
[17.0, 18.0]
[203, 220]
p03254
u607074939
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N,x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\ns = x\ncnt = 0\nif sum(a) > s:\n print(N-1)\nelif s >= a[0]:\n for i in range(N):\n if s >= a[i]:\n cnt += 1\n s -= a[i]\n print(cnt)', 'N,x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\ns = x\ncnt = 0\nif sum(a) < s:\n print(N-1)\nif s >= a[0]:\n for i in range(N):\n if s >= a[i]:\n cnt += 1\n s -= a[i]\n print(cnt)', 'N,x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\ns = x\ncnt = 0\nif s > sum(a):\n print(N-1)\nelif (s >= a[0] and s <= sum(a)):\n for i in range(N):\n if s >= a[i]:\n cnt += 1\n s -= a[i]\n print(cnt)\nelse:\n print(0)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s093308533', 's188192337', 's705781813']
[3060.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[237, 235, 274]
p03254
u609814378
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['import sys\nN, x = map(int, input().split())\na = sorted(map(int, input().split()))\n\nans = 0\nscore_x = x\n\nfor i in range(N):\n if score_x < a[i]:\n print(0)\n sys.exit()\n\n elif score_x >= a[i]:\n score_x = (score_x - a[i])\n ans = ans + 1\n\nprint(ans)', 'import sys\nN, x = map(int, input().split())\na = sorted(map(int, input().split()))\n\n\nans = 0\nscore_x = x\n\nif score_x < a[0]:\n print(0)\n sys.exit()\n \nfor i in range(N):\n\n if score_x >= a[i]:\n score_x = (score_x - a[i])\n ans = ans + 1\n\n\nprint(ans)', 'import sys\nN, x = map(int, input().split())\na = sorted(map(int, input().split()))\n\n\nans = 0\nscore_x = x\n\nif score_x < a[0]:\n print(0)\n sys.exit()\n \nfor i in range(N):\n if i == (N-1):\n if a[i] == score_x:\n ans = ans + 1\n score_x = (score_x - a[i])\n else:\n break \n if score_x >= a[i]:\n score_x = (score_x - a[i])\n ans = ans + 1\n\n\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s764490898', 's774321031', 's618343175']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[280, 273, 422]
p03254
u614181788
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,x= map(int,input().split())\na = list(map(int,input().split()))\na = sorted(a)\ns = 0\nfor i in range(n):\n s += a[i]\n if s > x:\n i -= 1\n break\nprint(i+1)', 'n,x = map(int,input().split())\na = list(map(int,input().split()))\na = sorted(a)\ncount = 0\ns = 0\nfor i in range(n):\n if i == n-1:\n if x == a[i]:\n count += 1\n else:\n s += a[i]\n if x > a[i]:\n x -= a[i]\n count += 1\n elif x < a[i]:\n break\n else:\n count += 1\n break\nprint(count)']
['Wrong Answer', 'Accepted']
['s058517555', 's423831918']
[3060.0, 3064.0]
[17.0, 18.0]
[171, 379]
p03254
u619785253
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
["nx = list(map(int,input().split(' ')))\na = list(map(int,input().split(' ')))\na.sort(reverse=True)\n\n#print(a)\ny = 0\nokashi= nx[1]\nfor i in a:\n if okashi>= i:\n okashi -=i\n y+=1\n\n#print(okashi) \nif y>=1 &okashi>0:\n y-=1\n \n \nprint(y) ", "nx = list(map(int,input().split(' ')))\na = list(map(int,input().split(' ')))\na.sort()\n\n#print(a)\ny = 0\nokashi= nx[1]\nfor i in a:\n if okashi>= i:\n okashi -=i\n y+=1\n\n#print(okashi) \nif y>=1 &okashi>0:\n y-=1\n \n \nprint(y) \n \n \n \n ", "n,x = list(map(int,input().split(' ')))\na = list(map(int,input().split(' ')))\n\n\na_sort = sorted(a)\n#print(a_sort)\nmanzoku =0\nflag = 0\nfor n,i in enumerate(a_sort):\n if x>=i:\n x-=i\n #print(x)\n manzoku+=1\n# print(x,i)\n elif x<i:\n flag =1\n \n \n\nif flag:\n print(manzoku)\nelif flag==0 and(x>0) and (manzoku>0):\n print((manzoku)-1)\nelse:\n print(manzoku)\n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s559560470', 's835495335', 's698556547']
[3064.0, 3060.0, 3064.0]
[17.0, 17.0, 18.0]
[248, 248, 429]
p03254
u622045059
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
["import math\nimport fractions\nimport bisect\nimport collections\nimport itertools\nimport heapq\nimport string\nimport sys\nimport copy\nfrom decimal import *\nfrom collections import deque\nsys.setrecursionlimit(10**7)\nMOD = 10**9+7\nINF = float('inf') \ndef gcd(a,b):return fractions.gcd(a,b) \ndef lcm(a,b):return (a*b) // fractions.gcd(a,b) \ndef iin(): return int(sys.stdin.readline()) \ndef ifn(): return float(sys.stdin.readline()) \ndef isn(): return sys.stdin.readline().split() \ndef imn(): return map(int, sys.stdin.readline().split()) \ndef imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) \ndef fmn(): return map(float, sys.stdin.readline().split()) \ndef iln(): return list(map(int, sys.stdin.readline().split())) \ndef iln_s(): return sorted(iln()) \ndef iln_r(): return sorted(iln(), reverse=True) \ndef fln(): return list(map(float, sys.stdin.readline().split())) \ndef join(l, s=''): return s.join(l) \ndef perm(l, n): return itertools.permutations(l, n) \ndef perm_count(n, r): return math.factorial(n) // math.factorial(n-r) \ndef comb(l, n): return itertools.combinations(l, n) \ndef comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) \ndef two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 \ndef m_add(a,b): return (a+b) % MOD\ndef print_list(l): print(*l, sep='\\n')\n\ndef sieves_of_e(n):\n is_prime = [True] * (n+1)\n is_prime[0] = False\n is_prime[1] = False\n for i in range(2, int(n**0.5)+1):\n if not is_prime[i]: continue\n for j in range(i * 2, n+1, i): is_prime[j] = False\n return is_prime\n\nN,x = imn()\na = sorted(iln())\n\nans = 0\nfor ai in a:\n x -= ai\n if x < 0: break\n ans += 1\nprint(ans)", "import math\nimport fractions\nimport bisect\nimport collections\nimport itertools\nimport heapq\nimport string\nimport sys\nimport copy\nfrom decimal import *\nfrom collections import deque\nsys.setrecursionlimit(10**7)\nMOD = 10**9+7\nINF = float('inf') \ndef gcd(a,b):return fractions.gcd(a,b) \ndef lcm(a,b):return (a*b) // fractions.gcd(a,b) \ndef iin(): return int(sys.stdin.readline()) \ndef ifn(): return float(sys.stdin.readline()) \ndef isn(): return sys.stdin.readline().split() \ndef imn(): return map(int, sys.stdin.readline().split()) \ndef imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) \ndef fmn(): return map(float, sys.stdin.readline().split()) \ndef iln(): return list(map(int, sys.stdin.readline().split())) \ndef iln_s(): return sorted(iln()) \ndef iln_r(): return sorted(iln(), reverse=True) \ndef fln(): return list(map(float, sys.stdin.readline().split())) \ndef join(l, s=''): return s.join(l) \ndef perm(l, n): return itertools.permutations(l, n) \ndef perm_count(n, r): return math.factorial(n) // math.factorial(n-r) \ndef comb(l, n): return itertools.combinations(l, n) \ndef comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) \ndef two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 \ndef m_add(a,b): return (a+b) % MOD\ndef print_list(l): print(*l, sep='\\n')\n\ndef sieves_of_e(n):\n is_prime = [True] * (n+1)\n is_prime[0] = False\n is_prime[1] = False\n for i in range(2, int(n**0.5)+1):\n if not is_prime[i]: continue\n for j in range(i * 2, n+1, i): is_prime[j] = False\n return is_prime\n\nN,x = imn()\na = sorted(iln())\n\nans = 0\nfor ai in a:\n x -= ai\n if x < 0: break\n ans += 1\nif x > 0:\n ans -= 1\nprint(ans)"]
['Wrong Answer', 'Accepted']
['s373545927', 's143677549']
[5296.0, 5680.0]
[39.0, 50.0]
[2100, 2123]
p03254
u623036684
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N = int(input())\nx = int(input())\ny=x\ncage = []\nfor i in range(N):\n nu = int(input())\n cage.append(nu)\nans=0\nfor i in range(N):\n ind = cage.index(min(cage))\n if(min(cage) > x):\n break\n x = x - min(cage)\n cage[ind] = y\n ans += 1\nif x>0:\n ans = ans - 1\nprint(ans)', 'N = int(input())\nx = int(input())\ncage = []\nfor i in range(N):\n nu = int(input())\n cage.append(nu)\ncage = sorted(cage)\nans=0\n\nfor i in range(N):\n n = cage[i]\n if x>=n:\n x = x - n\n ans += 1\n else:\n break\n\nif cage[0]>x:\n ans=0\nif x != 0:\n ans -= 1\nprint(ans)', 'N = int(input())\nx = int(input())\ncage = []\nfor i in range(N):\n nu = int(input())\n cage.append(nu)\nans=0\nfor i in range(N):\n ind = cage.index(min(cage))\n if(min(cage) > x):\n break\n x = x - min(cage)\n cage[ind] = "no"\n ans += 1\nif x>0:\n ans = ans - 1\nprint(ans)', 'N = int(input())\nx = int(input())\ny=x\ncage = list(map(int,input().split()))\nans=0\nfor i in range(N):\n ind = cage.index(min(cage))\n if(min(cage) > x):\n break\n x = x - min(cage)\n cage[ind] = y\n ans += 1\nif x>0:\n ans = ans - 1\nprint(ans)', 'N = int(input())\nx = int(input())\ncage = []\nfor i in range(N):\n nu = int(input())\n cage.append(nu)\nans=0\nfor i in range(N):\n ind = cage.index(min(cage))\n if(min(cage) > x):\n break\n x = x - min(cage)\n cage[ind] = "no"\n ans += 1\nif x>0:\n ans = ans - 1\nprint(ans)\nprint(x,cage)', 'N, x = map(int, input().split())\ncage = sorted([int(i) for i in input().split()])\n\nans=0\n\nfor i in range(N):\n n = cage[i]\n if x>n:\n x = x - n\n ans = i\n elif x==n:\n ans = i+1\n break\n else:\n break\n\nif cage[0]>x:\n ans=0\nif x>0:\n ans = ans - 1\nprint(ans)', 'N = int(input())\nx = int(input())\ny=x\ncage = []\nfor i in range(N):\n nu = int(input())\n cage.append(nu)\nans=0\nfor i in range(N):\n ind = cage.index(min(cage))\n if(min(cage) > x):\n break\n x = x - min(cage)\n cage[ind] = y\n ans += 1\nif x>0:\n ans = ans - 1\nprint(ans)', 'N, x = map(int, input().split())\nA = list(map(int, input().split()))\n \nx_tmp = x\nfor i, Ai in enumerate(sorted(A)):\n x_tmp -= Ai\n if x_tmp == 0:\n ans = i + 1\n break\n elif x_tmp < 0:\n ans = i\n break\n else: continue\nelse: ans = i\n \nprint(ans)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s000027169', 's037387285', 's250434272', 's308073355', 's524265597', 's617473601', 's923182371', 's197312541']
[3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 18.0]
[292, 298, 291, 259, 305, 303, 292, 280]
p03254
u623687794
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,m=map(int,input().split())\nans=0\nch=list(map(int,input().split()))\nch.sort()\nsum=0\ni=0\nwhile sum<m:\n sum+=ch[ans]\n ans+=1\n if sum > m:\n ans-=1\n break\nprint(ans)', 'n,m=map(int,input().split())\nans=0\nch=list(map(int,input().split()))\nch.sort()\nsum=0\ni=0\nwhile sum<m and ans!=n:\n sum+=ch[ans]\n ans+=1\n if sum > m:\n ans-=1\n break\nprint(ans)\n', 'n,m=map(int,input().split())\nans=0\nch=list(map(int,input().split()))\nch.sort()\nif m>=sum(ch):\n print(n)\nelse:\n sum=0\n i=0\n while sum<m and ans!=n:\n sum+=ch[ans]\n ans+=1\n if sum > m:\n ans-=1\n break\n print(ans)\n', 'n,m=map(int,input().split())\nans=0\nch=list(map(int,input().split()))\nch.sort()\nif m>sum(ch):\n print(n-1)\nelse:\n sum=0\n i=0\n while sum<m and ans!=n:\n sum+=ch[ans]\n ans+=1\n if sum > m:\n ans-=1\n break\n print(ans)\n']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s611333298', 's769284119', 's861463746', 's792517989']
[3064.0, 3060.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[171, 183, 233, 234]
p03254
u627325970
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x = list(map(int, input().split()))\nA = sorted(list(map(int, input().split())))\n\ndef func():\n cummulative_sum = 0\n for index, value in enumerate(A):\n cummulative_sum += value\n if cummulative_sum > x:\n index\n \n if cummulative_sum != x:\n return len(A) - 1\n else:\n return len(A)\n \nfunc()', 'N, x = list(map(int, input().split()))\nA = sorted(list(map(int, input().split())))\n\ndef func():\n cummulative_sum = 0\n for index, value in enumerate(A):\n cummulative_sum += value\n if cummulative_sum > x:\n return index\n\n if cummulative_sum != x:\n return len(A) - 1\n else:\n return len(A)\n\nans = func()\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s833766532', 's099145368']
[2940.0, 3060.0]
[17.0, 17.0]
[348, 361]
p03254
u629350026
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nans=0\nfor i in range(n):\n if a[i]<=x:\n x=x-a[i]\n ans=ans+1\nprint(ans)\n', 'n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nans=0\nfor i in range(n):\n if a[i]<=x:\n x=x-a[i]\n ans=ans+1\nif ans==n and x>0:\n ans=ans-1\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s692436643', 's207658647']
[2940.0, 3060.0]
[17.0, 17.0]
[148, 179]
p03254
u629540524
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,x = map(int,input().split())\na = sorted(map(int,input().split()))\nc=0\nd=0\nfor i in a:\n if c<x:\n c+=i\n d+=1\nelse:\n if c>x:\n d-=1\nprint(d)', 'n,x = map(int,input().split())\na = sorted(map(int,input().split()))\nc=0\nfor i in a:\n if x<i:\n break\n x-=i\n c+=1\nelse:\n if x!=0:\n c-=1\nprint(c)']
['Wrong Answer', 'Accepted']
['s682698430', 's715398457']
[9156.0, 9048.0]
[25.0, 28.0]
[165, 168]
p03254
u629607744
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['def i():\n\treturn int(input())\ndef i2():\n\treturn map(int,input().split())\ndef s():\n\treturn str(input())\ndef l():\n\treturn list(input())\ndef intl():\n\treturn list(int(k) for k in input().split())\n\nn,x=i2()\na=intl()\na.sort()\nb=0\nfor i in range(n):\n\tx-=a[i]\n\tif x>=0:\n\t\tb+=1\n\tif x<0:\n\t\tbreak\nprint(b)', 'def i():\n\treturn int(input())\ndef i2():\n\treturn map(int,input().split())\ndef s():\n\treturn str(input())\ndef l():\n\treturn list(input())\ndef intl():\n\treturn list(int(k) for k in input().split())\n\nn,x=i2()\na=intl()\na.sort()\nb=0\nfor i in range(n):\n\tx-=a[i]\n\tif i<n-1:\n\t\tif x>=0:\n\t\t\tb+=1\n\t\telif x<0:\n\t\t\tbreak\n\telif i==n-1:\n\t\tif x==0:\n\t\t\tb+=1\nprint(b)']
['Wrong Answer', 'Accepted']
['s909114046', 's202774080']
[3064.0, 3064.0]
[18.0, 17.0]
[294, 344]
p03254
u633548583
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,x=map(int,input().split())\na=list(map(int,input().split() for i in range(n)))\na_sort=sorted(a)\ncount=0\nsum=0\nfor i in a_sort:\n while sum+i<=x:\n sum=sum+i\n count+=1\n else:\n break\nprint(count)\n', 'n,x=map(int,input().split())\na=list(int(input() for i in range(n)))\na_sort=sorted(a)\ncount=0\nsum=0\nfor i in a_sort:\n if sum+i<=x:\n sum=sum+i\n count+=1\n else:\n break\nprint(count)', 'n,x=map(int,input().split())\na=list(map(int,input().split() for i in range(n)))\na_sort=sorted(a)\ncount=0\nsum=0\nfor i in a_sort:\n if sum+i<=x:\n sum=sum+i\n count+=1\n else:\n break\nprint(count)\n', 'n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\n\ncount=0\nif x==sum(a):\n print(n)\nelif x>sum(a):\n print(n-1)\nelse:\n for i in range(n):\n if x>=a[i]:\n count+=1\n x-=a[i]\n else:\n break\n print(count)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s410177521', 's468085203', 's670826177', 's909132065']
[2940.0, 3060.0, 3056.0, 3064.0]
[17.0, 17.0, 17.0, 17.0]
[220, 204, 217, 275]
p03254
u633914031
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N,x=map(int,input().split())\na=list(map(int,input().split()))\ncnt=0\na.sort()\nfor i in range(N):\n if x-a[i]>=0:\n cnt+=1\n else:\n break\n\nprint(cnt)', 'N,x=map(int,input().split())\na=list(map(int,input().split()))\ncnt=0\na.sort()\nfor i in range(N):\n if x-a[i]>=0:\n cnt+=1\n x-=a[i]\n else:\n break\n\nprint(cnt)', 'N,x=map(int,input().split())\na=list(map(int,input().split()))\ncnt=0\na.sort()\nfor i in range(N):\n if x-a[i]>=0:\n cnt+=1\n x-=a[i]\n if i == N-1 and x > 0:\n cnt-=1\n else:\n break\n\nprint(cnt)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s117418660', 's204801552', 's084879189']
[2940.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[152, 164, 204]
p03254
u634046173
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N,x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\nc = 0\nrx = x\nfor i in range(N):\n if a[i] > rx:\n print(c)\n exit()\n c += 1\n rx -= a[i]\nprint(N)', 'N,x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\nc = 0\nrx = x\nfor i in range(N):\n if a[i] > rx:\n print(c)\n exit()\nprint(N)', 'N,x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\nc = 0\nrx = x\nfor i in range(N):\n if a[i] > rx or (i == N-1 and rx != a[i]):\n print(c)\n exit()\n c += 1\n rx -= a[i]\nprint(N)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s347292187', 's853165668', 's361378082']
[9068.0, 9100.0, 8964.0]
[26.0, 24.0, 26.0]
[177, 155, 206]
p03254
u636489589
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x = map(int, input().split())\na = list(map(int, input().split()))\na = sorted(a)\nn = 0\nfor i in range(N):\n x -= a[i]\n if x < 0:\n break\n n += 1\nprint(n)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\na = sorted(a)\nn = 0\nfor i in range(N):\n n += 1\n x -= a[i]\n if x < 0:\n break\nif x != 0:\n n -= 1\nprint(n)']
['Wrong Answer', 'Accepted']
['s307182402', 's502666101']
[2940.0, 2940.0]
[17.0, 17.0]
[159, 179]
p03254
u636822224
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nc=0\nfor i in range(len(a)+1):\n if x>0 and x>a[i]:\n x-=a[i]\n c+=1\n else:\n print(c)\n break', 'n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nc=0\nfor i in range(len(a)+1):\n if x>0 and x>=a[i]:\n x-=a[i]\n c+=1\n else:\n print(c)\n break', 'n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nc=0\nfor i in range(n):\n if n>=i and x>=a[i]:\n x-=a[i]\n c+=1\n if n==c and x==0:\n print(n)\n else:\n print(c)\n break', 'n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nc=0\nfor i in range(len(a)+1):\n if x>0:\n x-=a[i]\n c+=1\n else:\n print(c)\n', 'n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nc=0\nfor i in range(len(a)+1):\n if x>0:\n x-=a[i]\n c+=1\n else:\n print(c)\n break', 'n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nc=0\nfor i in range(n):\n if n>=i and x>=a[i]:\n x-=a[i]\n c+=1\n if n==c and x==0:\n print(n)\n if n==c and x!=0:\n print(n-1)\n else:\n print(c)\n break']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s019690916', 's117895882', 's635012352', 's805227634', 's976637255', 's067347966']
[3060.0, 3060.0, 3060.0, 3060.0, 3060.0, 3060.0]
[17.0, 19.0, 17.0, 18.0, 17.0, 18.0]
[173, 174, 205, 153, 162, 244]
p03254
u637289184
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, X = map(int, input().split())\nA = list(map(int, input().split()))\nA.sort()\nprint(A)\ncnt=0\nfor i in range(N):\n if A[i]<=X:\n X-=A[i]\n cnt+=1\n print(X)\n else:\n for j in range(i):\n if A[j]+X==A[i]:\n cnt+=1\n X=0\nif X>0 and cnt>0:\n cnt-=1\nprint(cnt)\n', 'N, X = map(int, input().split())\nA = list(map(int, input().split()))\nA.sort()\ncnt=0\nfor i in range(N):\n if A[i]<=X:\n X-=A[i]\n cnt+=1\n else:\n break\nif X>0 and cnt==N:\n cnt-=1\nprint(cnt)\n']
['Wrong Answer', 'Accepted']
['s935203416', 's616031847']
[9160.0, 9176.0]
[29.0, 30.0]
[325, 215]
p03254
u644360640
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
["n,x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\nans = 0\nfor i in range(n):\n if x >= a[i]:\n ans += 1\n x -= a[i]\n else:\n break\n'''\nif x > 0 and ans != 0:\n ans -= 1\n'''\nprint(ans)\n", 'n,x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\nans = 0\nfor i in range(n):\n if a[i] <= x:\n x -= a[i]\n a[i] -= a[i]\n else:\n a[i] -= x\n x = 0\nif x > 0:\n print(a.count(0)-1)\nelse:\n print(a.count(0))\n']
['Wrong Answer', 'Accepted']
['s693621808', 's122591180']
[3060.0, 3060.0]
[17.0, 17.0]
[234, 263]
p03254
u647656433
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n, x = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\na.sort()\ncnt = 0\nfor i in a:\n if x - i < 0:\n break\n else:\n n -= i\n cnt += 1\nprint(cnt)\n', 'n, x = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\na.sort()\ncnt = 0\nfor i in range(n):\n if x - a[i] < 0:\n break\n elif x - a[i] == 0:\n x -= a[i]\n cnt += 1\n else:\n if i+1 == n:\n break\n else:\n x -= a[i]\n cnt += 1\nprint(cnt)\n']
['Wrong Answer', 'Accepted']
['s640031261', 's621962639']
[2940.0, 3060.0]
[18.0, 17.0]
[193, 326]
p03254
u652656291
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,x = map(int,input().split())\nA = sorted(map(int,input().split()))\nans = 0\nfor i in range(n):\n x -= A[i]\n ans += 1\n if x = 0:\n ans -= 1\n break\nprint(ans)\n', 'n,x = map(int,input().split())\nA = sorted(map(int,input().split()))\nans = 0\nfor i in range(n):\n x -= A[i]\n ans += 1\n if x < 0:\n ans -= 1\n break\nprint(ans)\n', 'n,x = map(int,input().split())\nA = sorted(map(int,input().split()))\nans = 0\nfor i in range(n):\n x -= A[i]\n ans += 1\n if x <= 0:\n ans -= 0\n break\nprint(ans)', 'n,x = map(int,input().split())\nA = sorted(map(int,input().split()))\nans = 0\nif x < A[0]:\n print(0)\n exit()\nfor i in range(n):\n x -= A[i]\n ans += 1\n if x < 0:\n ans -= 1\n break\nprint(ans)\n', 'n,x = map(int,input().split())\na = sorted(list(map(int,input().split())))\nfor i in range(n):\n x = x-a[i]\n if x<0:\n break\nif i == n-1 and x == 0:\n i += 1\nprint(i)\n\n']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s020231876', 's240609105', 's299607089', 's563332030', 's836232220']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0, 17.0, 18.0]
[164, 164, 164, 197, 169]
p03254
u652737716
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n, amount = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\n\nans = 0\nfor ai in a:\n if ai <= amount:\n amount -= ai\n ans += 1\n\nprint(ans)\n', 'n, amount = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\n\nans = 0\nfor ai in a:\n if ai <= amount:\n amount -= ai\n ans += 1\n\nif amount > 0 and ans == n:\n ans -= 1\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s936872689', 's103377659']
[3316.0, 2940.0]
[19.0, 17.0]
[177, 218]
p03254
u653642801
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['\ndef main():\n n, x = map(int,input().split())\n a = list(map(int,input().split()))\n\n a = sorted(a)\n ans = 0\n tmp = 0\n for i in a:\n tmp += i\n if tmp <= x:\n ans+=1\n\n print(ans)\n\n\n\n\nif __name__ == "__main__":\n main()\n', '\ndef main():\n n, x = map(int,input().split())\n a = list(map(int,input().split()))\n\n a = sorted(a)\n ans = 0\n tmp = 0\n for i in a:\n tmp += i\n if tmp <= x:\n ans+=1\n\n if n == ans:\n if sum(a) != x:\n ans-=1\n\n print(ans)\n\n\n\n\nif __name__ == "__main__":\n main()\n']
['Wrong Answer', 'Accepted']
['s223759894', 's438271727']
[3060.0, 3060.0]
[17.0, 18.0]
[266, 327]
p03254
u665038048
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['def main():\n N,x=[int(i) for i in input().split()]\n a=input().split()\n k=0\n while True:\n if x>=int(min(a)):\n x=x-int(min(a))\n a.remove(min(a))\n k+=1\n if len(a)==0:\n break\n else:\n break\n print(k)\nmain()\n', 'from itertools import accumulate\nn, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\na_acc = list(accumulate(a))\nfor i in range(n):\n if a_acc[i] > x:\n print(i)\n exit()\nif sum(a) == x:\n print(n)\nelse:\n print(n-1)']
['Wrong Answer', 'Accepted']
['s774122538', 's690520403']
[2940.0, 3064.0]
[19.0, 17.0]
[301, 260]
p03254
u665224938
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n, x = map(int, input().split())\nli = sorted(list(map(int, input().split())))\n\nfor i in range(n):\n x = x - li[i]\n if x < 0:\n print(i)\n break\nelse:\n print(n)', 'n, x = map(int, input().split())\nli = sorted(list(map(int, input().split())))\n\nfor i in range(n):\n x = x - li[i]\n if x < 0:\n print(i)\n break\nelse:\n if x == 0:\n print(n)\n else:\n print(n-1)']
['Wrong Answer', 'Accepted']
['s122667994', 's175672961']
[3060.0, 3060.0]
[17.0, 17.0]
[179, 227]
p03254
u667024514
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,x = map(int,input().split())\ncou = 0\nlis = list(map(int,input().split()))\nfor i in range(n):\n if i != n-1:\n if x >= lis[i]:\n x -= lis[i]:\n cou += 1\n else:\n if x == lis[i]:\n cou += 1\nprint(cou)', 'n,x = map(int,input().split())\ncou = 0\nlis = list(map(int,input().split()))\nlis.sort()\nfor i in range(n):\n if i != n-1:\n if x >= lis[i]:\n x -= lis[i]\n cou += 1\n else:\n if x == lis[i]:\n cou += 1\nprint(cou)\n']
['Runtime Error', 'Accepted']
['s872130293', 's424960753']
[2940.0, 2940.0]
[17.0, 17.0]
[219, 228]
p03254
u668503853
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N,x=map(int,input().split())\nA=list(map(int,input().split()))\nAA=sorted(A)\nans=0\nfor a in A:\n if x>=a:\n x-=a\n ans+=1\n else:\n break\nprint(ans)', 'N,x=map(int,input().split())\nA=list(map(int,input().split()))\nAA=sorted(A)\nans=0\nfor i in range(N):\n if x>=AA[i]:\n x-=AA[i]\n ans+=1\n else:\n x=0\n break\nif x>0:\n print(ans-1)\nelse:\n print(ans)']
['Wrong Answer', 'Accepted']
['s202877971', 's461213670']
[3060.0, 3060.0]
[17.0, 17.0]
[152, 206]
p03254
u670180528
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['from bisect import bisect\nfrom itertools import accumulate\nn,x,*a=map(int,open(0).read().split())\nb=list(accumulate(sorted(a)))\nprint(bisect(b,x))', 'from bisect import bisect\nfrom itertools import accumulate\nn,x,*a=map(int,open(0).read().split())\nb=list(accumulate(sorted(a)))\nprint(bisect(b,x)-(b[-1]<x))']
['Wrong Answer', 'Accepted']
['s000718396', 's538403102']
[3060.0, 3060.0]
[18.0, 18.0]
[146, 156]
p03254
u677842374
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x = map(int, input().split())\na = list(map(int, input().split()))\ncnt = 0\na.sort()\nfor i in range(N):\n if a[i]<=x:\n x -= a[i]\n cnt += 1\n else:\n break\nprint(cnt)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\ncnt = 0\na.sort()\nfor i in range(N):\n if a[i]<=x:\n x -= a[i]\n cnt += 1\n else:\n break\nif (x!=0)and(cnt==N):\n cnt -= 1\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s726985317', 's600594224']
[9008.0, 9124.0]
[21.0, 21.0]
[190, 225]
p03254
u679089074
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['#22\nN,x = map(int,input().split())\na = list(map(int,input().split()))\ncou =0\n\na.sort()\n\nfor i in a:\n if i >x:\n break\n cou +=1\n x -= i\n \nwhile x>0:\n for i in a:\n if x%i ==0:\n cou -=1\n break\n while x > i:\n x-=i\n cou -= 1\nprint(cou)\n ', '#22\nN,x = map(int,input().split())\na = list(map(int,input().split()))\n\na.sort()\n\nif sum(a) ==x:\n print(N)\nelse:\n for i in range(N):\n if sum(a[0:i+1]) >x:\n print(i)\n break\n ', '#22\nN,x = map(int,input().split())\na = list(map(int,input().split()))\n\na.sort()\n\nif sum(a) ==x:\n print(N)\nelif sum(a) < x:\n print(N-1)\nelse:\n for i in range(N):\n if sum(a[0:i+1]) >x:\n print(i)\n break\n ']
['Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s456209958', 's969736090', 's136902474']
[9124.0, 9160.0, 9044.0]
[2206.0, 31.0, 27.0]
[310, 210, 242]
p03254
u680503348
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['import math\n\n\n# For taking integer inputs.\ndef inp():\n return(int(input()))\n\n\n# For taking List inputs.\ndef inlist():\n return(list(map(int, input().split())))\n\n\n# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.\ndef instr():\n s = input()\n return(list(s[:len(s)]))\n\n\n# For taking space seperated integer variable inputs.\ndef invr():\n return(map(int, input().split()))\n\n\nN, x = invr()\n\na = inlist()\na = sorted(a)\nc = 0\nfor i in a:\n if i <= x:\n c += 1\n x -= i\nprint(c)\n', 'import math\n\n\n# For taking integer inputs.\ndef inp():\n return(int(input()))\n\n\n# For taking List inputs.\ndef inlist():\n return(list(map(int, input().split())))\n\n\n# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.\ndef instr():\n s = input()\n return(list(s[:len(s)]))\n\n\n# For taking space seperated integer variable inputs.\ndef invr():\n return(map(int, input().split()))\n\n\nN, x = invr()\n\na = inlist()\na = sorted(a)\nc = 0\nfor i in a:\n if i <= x:\n c += 1\n x -= i\n else:\n x = 0\n\nif x > 0 and c > 0:\n c -= 1\nprint(c)\n']
['Wrong Answer', 'Accepted']
['s496348996', 's600701629']
[3060.0, 3064.0]
[18.0, 18.0]
[614, 670]
p03254
u687159441
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nsum = 0\npeople = 0\n\nif x == sum(a):\n print(n)\nelif x > sum(a):\n print(n-1)\nelse:\n for i in a:\n sum += i\n people += 1\n if sum > x:\n print(people-1)\n break', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nif x == sum(a):\n print(N)\nelif x > sum(a):\n print(N-1)\nelse:\n for i in range(N):\n if sum(a[:i+1]) > x:\n print(i)\n break\n']
['Runtime Error', 'Accepted']
['s421703748', 's671661320']
[3064.0, 3060.0]
[18.0, 17.0]
[283, 236]
p03254
u696010640
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x = map(int, input().split())\na = sorted(map(int, input().split()))\ncnt = 0\n\nfor i in range(N):\n x -= a[i]\n if x < 0:\n break\n else:\n s += 1\n\nprint(cnt if x <= 0 else cnt-1)', 'N, x = map(int, input().split())\na = sorted(map(int, input().split()))\ncnt = 0\n\nfor i in range(N):\n x -= a[i]\n if x < 0:\n break\n else:\n cnt += 1\n\nprint(cnt if x <= 0 else cnt-1)']
['Runtime Error', 'Accepted']
['s210967948', 's606464016']
[9100.0, 9160.0]
[24.0, 29.0]
[198, 200]
p03254
u698479721
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N,x = map(int, input().split())\nlis = [int(i) for i in input().split()]\nlis.sort()\ns = 0\nans = 0\nfor nums in lis:\n if x >= nums:\n x += -nums\n ans += 1\nprint(ans)\n ', 'N,x = map(int, input().split())\nlis = [int(i) for i in input().split()]\nlis.sort()\ns = 0\nans = 0\nfor nums in lis:\n if x >= nums:\n x += -nums\n ans += 1\nif ans == N and x != 0:\n ans = ans-1\nprint(ans)']
['Wrong Answer', 'Accepted']
['s503164656', 's690300051']
[3316.0, 3060.0]
[19.0, 19.0]
[171, 206]
p03254
u701318346
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\n\ncount = 0\nfor ai in a:\n if ai <= x:\n x -= ai\n count += 1\n else:\n break\n\n\nif count == N and x > 0:\n count =- 1\n\nprint(count)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\n\ncount = 0\nfor ai in a:\n if ai <= x:\n x -= ai\n count += 1\n else:\n break\n\n\nif count == N and x > 0:\n count -= 1\n\nprint(count)\n']
['Wrong Answer', 'Accepted']
['s153778764', 's708506408']
[3060.0, 3060.0]
[17.0, 17.0]
[328, 329]
p03254
u706929073
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['(n, x) = map(int, input().split())\na = [int(i) for i in input().split()]\na.sort()\nsum = 0\ncount = 0\nfor i in a:\n sum += i\n if sum > x:\n break\n count += 1\nprint(count)', '(n, x) = map(int, input().split())\na = [int(i) for i in input().split()]\na.sort()\nsum = 0\ncount = 0\nfor i in a:\n sum += i\n if sum > x:\n break\n count += 1\nprint(count)', '(n, x) = map(int, input().split())\na = [int(i) for i in input().split()]\na.sort()\nfor i in range(len(a)):\n if a[i] <= x:\n x -= a[i]\n a[i] = 0\n if i == (len(a) - 1):\n a[i] -= x\nprint(a.count(0))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s709186625', 's769726559', 's407757580']
[3060.0, 2940.0, 3060.0]
[18.0, 18.0, 19.0]
[182, 182, 220]
p03254
u707659359
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['\n\nN,x = [int(x) for x in input().split()]\n\nal = [int(x) for x in input().split()]\n\n\nal.sort()\n\ncount=0\nacc = 0\nfor ai in al:\n acc += ai\n if acc > x:\n break\n count+=1\n\nprint(count)', '\n\nN,x = [int(x) for x in input().split()]\n\nal = [int(x) for x in input().split()]\n\n\nal.sort()\n\ncount=0\nacc = 0\nfor ai in al:\n acc += ai\n if acc > x:\n break\n count+=1\nif acc < x:\n count -= 1\n\nprint(count)']
['Wrong Answer', 'Accepted']
['s558394304', 's602334100']
[3060.0, 3060.0]
[17.0, 17.0]
[195, 222]
p03254
u708255304
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x = map(int, input().split())\nA = list(map(int, input().split()))\nans = 0\nA.sort()\nfor a in A:\n if x >= a:\n x -= a\n ans += 1\nprint(ans)\n ', 'N, x = map(int, input().split())\ntmp = x\nA = list(map(int, input().split()))\nans = 0\nA.sort()\nfor a in A:\n if x >= a:\n x -= a\n ans += 1\nif x > sum(A):\n ans -= 1\nprint(ans)\n \n', 'N, x = map(int, input().split())\ntmp = x\nA = list(map(int, input().split()))\nans = 0\nA.sort()\nfor a in A:\n if x >= a:\n x -= a\n ans += 1\nif tmp > sum(A):\n ans -= 1\nprint(ans)\n \n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s105942393', 's214018294', 's972816750']
[2940.0, 3060.0, 3060.0]
[17.0, 17.0, 18.0]
[155, 190, 192]
p03254
u713914478
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x = map(int, input().split())\nA = [int(i) for i in input().split()]\n\nA.sort()\nans = 0\n\nfor i in A:\n x -= a\n if x >= 0:\n ans += 1\n else:\n break\nif x > 0:\n ans -= 1\nprint(ans)\n\n', 'N, x = map(int, input().split())\nA = [int(i) for i in input().split()]\n\nA.sort()\nans = []\nfor i in A:\n\tif x < i:\n\t\tbreak\n\tans += 1\n\tx -= i\n\nelse:\n\tif x > 0:\n\t\tans -= 1\nprint(ans)\n\n', 'N, x = map(int, input().split())\nA = [int(i) for i in input().split()]\n\nA.sort()\nans = []\nfor i in A:\n\tif x < i:\n\t\tbreak\n\tans += 1\n\tx -= i\n\telse:\n\t\tbreak\n\nif x > 0:\n\t\tans -= 1\nprint(ans)\n', 'N, x = map(int, input().split())\nA = [int(i) for i in input().split()]\n\nA.sort()\nans = []\nfor i in A:\n\tans.append(i)\n\tx -= i\n\t#print(ans, x)\n\tif x <= 0:\n\t\tbreak\n\nprint(len(ans))', 'N, x = map(int, input().split())\nA = [int(i) for i in input().split()]\n\nA.sort()\nans = []\nfor i in A:\n\tif x < i:\n\t\tbreak\n\tans += 1\n\tx -= i\nelse:\n\tbreak\n\nif x > 0:\n\t\tans -= 1\nprint(ans)', '\nN, x = map(int, input().split())\nA = [int(i) for i in input().split()]\n\nA.sort()\nans = []\nfor i in A:\n\tx -= i\n\t#print(ans, x)\n\tif x >= 0:\n\t\tans.append(i)\n\telse:\n\t\tbreak\n\t\nif x > 0:\n\tprint(len(ans)-1)\nelse:\n\tprint(len(ans))']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s015997676', 's514892603', 's697449040', 's855244569', 's956901749', 's182977025']
[2940.0, 3060.0, 2940.0, 2940.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0, 18.0, 17.0, 17.0]
[204, 180, 187, 177, 184, 223]
p03254
u721970149
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x = map(int, input().split())\nlist_a = [int(x) for x in input().split()]\n\nlist_a.sort()\ntotal = sum(list_a)\nif x < list_a[0] :\n print(0)\n exit()\n\nans = 0\n\nfor i in range(N) :\n if list_a[i] <= x :\n x -= list_a[i]\n ans += 1\n\nprint(ans)\n', 'N, x = map(int, input().split())\nlist_a = [int(x) for x in input().split()]\n\nlist_a.sort()\ntotal = sum(list_a)\nif x < list_a[0] :\n print(0)\n exit()\nif x > total :\n print(ans-1)\n exit()\nans = 0\n\nfor i in range(N) :\n if list_a[i] <= x :\n x -= list_a[i]\n ans += 1\n\nprint(ans)\n', 'N, x = map(int, input().split())\nlist_a = [int(x) for x in input().split()]\n\nlist_a.sort()\ntotal = sum(list_a)\nif x < list_a[0] :\n print(0)\n exit()\nif x > total :\n print(len(list_a)-1)\n exit()\nans = 0\n\nfor i in range(N) :\n if list_a[i] <= x :\n x -= list_a[i]\n ans += 1\n\nprint(ans)\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s563671136', 's872963531', 's083308980']
[3060.0, 3060.0, 3060.0]
[17.0, 17.0, 18.0]
[260, 302, 310]
p03254
u727787724
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nans=0\nfor i in range(n):\n if x>=a[i]:\n ans+=1\n x-=a[i]\n else:\n break\nprint(ans)', 'n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nans=0\nfor i in range(n):\n if x>=a[i]:\n ans+=1\n x-=a[i]\n else:\n break\n if n-1==i:\n if a[i]<x:\n continue\n else:\n ans+=1\nprint(ans)', 'n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nans=0\nif x==sum(a):\n ans=n\nelif x>sum(a):\n ans=n-1\nelse:\n for i in range(n):\n if x>=a[i]:\n ans+=1\n x-=a[i]\n else:\n break\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s417833703', 's714139086', 's408429444']
[2940.0, 3060.0, 3064.0]
[17.0, 17.0, 17.0]
[177, 265, 258]
p03254
u729133443
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['\x04', 'n,x,*a=map(int,open(0).read().split());c=0\nfor t in sorted(a):\n x-=t\n if x<0:break\n c+=1\nprint(c-(x>0))']
['Runtime Error', 'Accepted']
['s871540680', 's853469750']
[8916.0, 2940.0]
[23.0, 17.0]
[1, 106]
p03254
u731028462
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N, x = list(map(int, input().split()))\nais = list(map(int, input().split()))\ns = 0\ncnt = 0\nais.sort()\nfor ai in ais:\n if(s+ai>=x):\n break\n else:\n s += ai\n cnt += 1\nprint(cnt)', 'N, x = list(map(int, input().split()))\nais = list(map(int, input().split()))\ns = 0\ncnt = 0\nais.sort()\nfor ai in ais:\n if(s+ai>x):\n break\n else:\n s += ai\n cnt += 1\nprint(cnt)', 'N, x = list(map(int, input().split()))\nais = list(map(int, input().split()))\n\ns = 0\ncnt = 0\nais.sort()\n\nfor ai in ais:\n if(s+ai>x):\n break\n else:\n s += ai\n cnt += 1\n\nif((cnt==N) & (s < x)):\n cnt -= 1\n\nprint(cnt)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s225576437', 's576724093', 's152685190']
[3060.0, 3060.0, 3064.0]
[18.0, 18.0, 17.0]
[201, 200, 241]
p03254
u733738237
2,000
1,048,576
There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children.
['N,x=[int(i) for i in input().split()]\na = [int(x) for x in input().split()]\na.sort()\ncnt=0\nfor k in range(N):\n\tif x-a[k] >= 0:\n\t\tx -= a[k]\n\t\tcnt += 1\n\t\tif k==N and x >0:\n\t\t\tcnt -=1\n\telse:\n\t\tif k==N:\n\t\t\tcnt -=1\n\t\tbreak\nprint(cnt)', 'N,x=[int(i) for i in input().split()]\na = [int(x) for x in input().split()]\na.sort()\ncnt=0\nfor k in range(N):\n\tif x-a[k] >= 0:\n\t\tx -= a[k]\n\t\tcnt += 1\n\telse:\n\t\tbreak\nprint(cnt)', 'N,x=[int(i) for i in input().split()]\na = [int(x) for x in input().split()]\na.sort()\ncnt=0\nfor k in range(N):\n\tif x-a[k] >= 0:\n\t\tx -= a[k]\n\t\tcnt += 1\n\t\tif k==N and x >0:\n\t\t\tcnt -=1\n\telse:\n\t\tbreak\nprint(cnt)', 'N,x=[int(i) for i in input().split()]\na = [int(x) for x in input().split()]\na.sort()\ncnt=0\nfor k in range(N):\n\tif x-a[k] >= 0:\n\t\tx -= a[k]\n\t\tcnt += 1\n\t\tif k==N and x >0:\n\t\t\tcnt -=1\n\telse:\n\t\tif k==N and x>0:\n\t\t\tcnt -=1\n\t\tbreak\nprint(cnt)', 'N,x=[int(i) for i in input().split()]\na = [int(x) for x in input().split()]\na.sort()\ncnt=0\nfor k in range(N):\n\tif x-a[k] >= 0:\t\n\t\tx -= a[k]\n\t\tcnt += 1\n\telse:\n\t\tbreak\n\tif k==N and x >0:\n\t\tcnt -=1\nprint(cnt)', 'N,x=[int(i) for i in input().split()]\na = [int(x) for x in input().split()]\na.sort()\ncnt=0\nfor k in a:\n\tx -= k\n\tif x < 0:\n\t\tbreak\n\tcnt +=1\nif x >0:\n\tcnt -=1\nprint(cnt)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s234831588', 's526637426', 's651603686', 's682727633', 's780211535', 's785652437']
[3060.0, 3060.0, 3060.0, 3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 17.0]
[228, 175, 206, 236, 205, 167]