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
u128908475
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\ncount = 0\nwhile True:\n if sum > x or len(a) == 0:\n break\n sum += a[0]\n count += 1\n del a[0]\nprint(count)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nsum = 0\ncount = 0\nwhile True:\n sum += a[0]\n if sum > x:\n break\n count += 1\n del a[0]\n if len(a) == 0:\n break\nprint(count)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nsum = 0\ncount = 0\nwhile True:\n sum += a[0]\n if sum > x or len(a) == 0:\n break\n count += 1\n del a[0]\nprint(count)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nsum = 0\ncount = 0\nwhile True:\n sum += a[0]\n if sum > x:\n break\n count += 1\n del a[0]\n if len(a) == 0:\n break\nif x > sum:\n print(count-1)\nelse:\n print(count)']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s418817961', 's429012483', 's847517677', 's627087557']
[3060.0, 3060.0, 3060.0, 3064.0]
[18.0, 18.0, 17.0, 17.0]
[197, 210, 197, 247]
p03254
u131464432
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\nsu = 0\nfor i in range(N):\n if su + a[i] <= x:\n su += 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()\nif sum(a) < x:\n print(N-1)\n exit()\ncnt = 0\nsu = 0\nfor i in range(N):\n if su + a[i] <= x:\n su += a[i]\n cnt += 1\n else:\n break\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s206496020', 's304452333']
[9168.0, 9120.0]
[25.0, 27.0]
[186, 223]
p03254
u146382803
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()\nfor i in range(0, len(a), 1):\n x -= a[i]\n if x < 0:\n break\nif i == len(a) - 1:\n print(i + 1)\nelse:\n print(i)\n', 'n, x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\nfor i in range(0, len(a), 1):\n x -= a[i]\n if x < 0:\n break\nif x == 0:\n print(i + 1)\nelse:\n print(i)\n']
['Wrong Answer', 'Accepted']
['s839106630', 's725587253']
[3060.0, 2940.0]
[18.0, 17.0]
[204, 195]
p03254
u149752754
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())\nfav = sorted(map(int, input().split()))\noura=[int()]*N\n\noura[0] = fav[0]\nfor i in range(len(fav)-1):\n oura[i+1] = oura[i] + fav[i+1]\n\nprint (oura)\n\nsai = 0\nfor j in range(len(oura)):\n if oura[j] > x:\n sai = j\n break\n elif j != N-1:\n continue\n elif oura[N-1] == x:\n sai = N\n else:\n sai = N-1\n\nprint (sai)\n', 'N, x = map(int, input().split())\nfav = sorted(map(int, input().split()))\noura=[int()]*N\n\noura[0] = fav[0]\nfor i in range(len(fav)-1):\n oura[i+1] = oura[i] + fav[i+1]\n\nprint (oura)\n\nsai = 0\nfor j in range(len(oura)):\n if oura[j] > x:\n sai = j\n break\n elif j != N-1:\n continue\n elif oura[N-1] == x:\n sai = N\n else:\n sai = N-1\n\nprint (sai)\n', 'N, x = map(int, input().split())\nfav = sorted(map(int, input().split()))\noura=[int()]*N\n\noura[0] = fav[0]\nfor i in range(len(fav)-1):\n oura[i+1] = oura[i] + fav[i+1]\n\n\nsai = 0\nfor j in range(len(oura)):\n if oura[j] > x:\n sai = j\n break\n elif j != N-1:\n continue\n elif oura[N-1] == x:\n sai = N\n else:\n sai = N-1\n\nprint (sai)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s252380979', 's479341602', 's917901679']
[3064.0, 3064.0, 3064.0]
[20.0, 17.0, 17.0]
[387, 387, 374]
p03254
u153729035
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\nc = 0\nfor ai in A:\n x -= ai\n if x<=0:\n break\n c+=1\n\nprint(c+1 if x==0 else c)', 'N, x = map(int, input().split())\nA = sorted(map(int, input().split()))\n\nif sum(A) == x:\n print(N)\n\nelse:\n c = 0\n for ai in A:\n x -= ai\n if x <= 0:\n break\n c += 1\n\n print(c + 1 if x == 0 else c)', 'N, x = map(int, input().split())\nA = sorted(map(int, input().split()))\n\nif sum(A) == x:\n print(x)\n\nelse:\n c = 0\n for ai in A:\n x -= ai\n if x <= 0:\n break\n c += 1\n\n print(c + 1 if x == 0 else c)', 'N, x = map(int, input().split())\nA = sorted(map(int, input().split()))\n\nif sum(A) == x:\n print(N)\n\nelse:\n c = 0\n for ai in A:\n x -= ai\n if x <= 0:\n break\n c += 1\n\n if c == N:\n print(N - 1)\n else:\n print(c + 1 if x == 0 else c)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s076152762', 's388331591', 's448159481', 's648524963']
[8864.0, 9112.0, 9108.0, 9016.0]
[29.0, 29.0, 26.0, 24.0]
[165, 237, 237, 287]
p03254
u161776322
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, b = map(int, input().split())\nchild = sorted(list(map(int, input().split())))\ncount = 0\nprint(child)\n\nfor i in range(a - 1):\n if b >= child[i]:\n b -= i\n count += 1\nif b == child[-1]:\n count += 1\n\nprint(count)', 'a, b = map(int, input().split())\nchild = sorted(list(map(int, input().split())))\ncount = 0\n\nfor i in range(a - 1):\n if b >= child[i]:\n b -= child[i]\n count += 1\nif b == child[-1]:\n count += 1\n\nprint(count)']
['Wrong Answer', 'Accepted']
['s763814353', 's392201122']
[3064.0, 3060.0]
[17.0, 17.0]
[235, 229]
p03254
u163320134
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())\narr=list(map(int,input().split()))\narr=sorted(arr)\nfor i in range(n):\n if x-arr[i]>=0:\n x-=arr[i]\n else:\n print(i)\n break\nelse:\n print(n)', 'n,x=map(int,input().split())\narr=list(map(int,input().split()))\narr=sorted(arr)\nfor i in range(n):\n if x-arr[i]>=0:\n x-=arr[i]\n else:\n print(i)\n break\nelse:\n if x==0:\n print(n)\n else:\n print(n-1)']
['Wrong Answer', 'Accepted']
['s474495371', 's214312269']
[3060.0, 3060.0]
[17.0, 17.0]
[180, 214]
p03254
u163421511
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\na_sum = [sum(a[:i+1]) for i in range(len(a))]\n\nfor i, item in enumerate(a_sum):\n if x < item:\n ans = i\n break\n elif x == item:\n ans = i+1\n elif x > item and i == len(a_sum):\n ans = i\n\nprint(ans)\n\n', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\n\nans = 0\na.sort()\na_sum = [sum(a[:i+1]) for i in range(len(a))]\n\nfor i, item in enumerate(a_sum):\n if x < item:\n ans = i\n break\n elif x == item:\n ans = i+1\n elif x > item and i == len(a_sum):\n ans = i-1\n\nprint(ans)\n\n', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\n\nans = 0\na.sort()\na_sum = [sum(a[:i+1]) for i in range(len(a))]\n\nfor i, item in enumerate(a_sum):\n if x < item:\n ans = i\n break\n elif x == item:\n ans = i+1\n elif x > item and i == len(a_sum):\n ans = i\n\nprint(ans)\n\n', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\n\nans = 0\na.sort()\na_sum = [sum(a[:i+1]) for i in range(len(a))]\n\nfor i, item in enumerate(a_sum):\n if x < item:\n ans = i\n break\n elif x == item:\n ans = i+1\n break\n elif x > item and i == len(a_sum)-1:\n ans = i\n break\n\nprint(ans)\n\n']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s197158836', 's561535913', 's639091621', 's416410009']
[9128.0, 9192.0, 9148.0, 9156.0]
[30.0, 28.0, 31.0, 30.0]
[312, 322, 320, 350]
p03254
u163449343
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\ni = 0\nwhile i != n:\n if a[i] > x:\n break\n else:\n x -= a[i]\n ans += 1\n i += 1\n\n\nprint(ans)\n', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nans = 0\ni = 0\nwhile x > 0:\n if a[i] > x:\n break\n else:\n x -= a[i]\n ans += 1\n i += 1\n\n\nprint(ans)\n', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nans = 0\ni = 0\nwhile i != n:\n if a[i] > x:\n break\n else:\n x -= a[i]\n ans += 1\n i += 1\nif x > 0 and i == n:\n ans -= 1\nif ans < 0:\n ans = 0\nprint(ans)\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s198579663', 's458600204', 's825955178']
[3060.0, 3060.0, 3060.0]
[17.0, 19.0, 17.0]
[210, 209, 266]
p03254
u163874353
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()\nwa = 0\ncnt = 0\nfor i in a:\n wa += i\n cnt += 1\n if wa > x:\n print(cnt - 1)\n exit()\n \n elif wa == x:\n print(n)\n exit()\nprint(n)', 'n, x= map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nwa = 0\ncnt = 0\nfor i in a:\n wa += i\n cnt += 1\n if wa > x:\n print(cnt - 1)\n exit()\n \n elif wa == x:\n print(cnt)\n exit()', 'n, x= map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nwa = 0\ncnt = 0\nfor i in a:\n wa += i\n cnt += 1\n if wa > x:\n print(cnt - 1)\n exit()\n \n elif wa == x:\n print(cnt)\n exit()\nprint(cnt)', 'n, x= map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nwa = 0\ncnt = 0\n\nfor i in a:\n wa += i\n cnt += 1\n if wa > x:\n print(cnt - 1)\n exit()\n \n elif wa == x:\n print(cnt)\n exit()\nprint(cnt - 1)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s071508664', 's525999616', 's615449978', 's454737944']
[3060.0, 3060.0, 3064.0, 3064.0]
[18.0, 17.0, 17.0, 18.0]
[249, 242, 253, 258]
p03254
u167908302
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()))\nchild = sorted(a)\nans = 0\ncandy = 0\n\nfor i in range(n):\n candy += child[i]\n if candy == x:\n print(i+1)\n exit()\n elif candy > x:\n print(0)\n exit()', '#coding:utf-8\nn, x = map(int, input().split())\na = list(map(int, input().split()))\nchild = sorted(a)\n\nfor i in range(n):\n x -= child[i]\n if x < 0:\n break\n elif x == 0:\n print(i+1)\n exit()\n\nprint(i)']
['Wrong Answer', 'Accepted']
['s314244670', 's724694204']
[3060.0, 3060.0]
[17.0, 18.0]
[265, 227]
p03254
u170183831
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 solve(n, x, A):\n A.sort()\n count = 0\n for a in A:\n if a <= x:\n x -= a\n count += 1\n else:\n break\n return count\n\n_n, _x = list(map(int, input().split()))\n_A = list(map(int, input().split()))\nprint(solve(_n, _x, _A))\n', 'def solve(n, x, A):\n A.sort()\n count = 0\n for i in range(n):\n if i < n - 1 and A[i] <= x or i == n - 1 and A[i] == x:\n x -= A[i]\n count += 1\n else:\n break\n return count\n\n_n, _x = list(map(int, input().split()))\n_A = list(map(int, input().split()))\nprint(solve(_n, _x, _A))\n']
['Wrong Answer', 'Accepted']
['s990647288', 's597069166']
[3060.0, 2940.0]
[17.0, 17.0]
[277, 332]
p03254
u172748267
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()])\nres=0\nif sum(a)==x:\n res=n\nelse:\n for i in range(n):\n if sum(a[:i])<=x:res=len(a[:i])-1\nprint(max(0,res))', 'n,x=map(int,input().split())\na=sorted([int(i)for i in input().split()])\nres=0\nif sum(a)==x:\n res=n\nelse:\n for i in range(n):\n if sum(a[:i])<=x:res=i\nprint(res)']
['Wrong Answer', 'Accepted']
['s306932546', 's689074902']
[9068.0, 9176.0]
[29.0, 32.0]
[190, 172]
p03254
u177040005
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)\ni = 0\ntmp =0\nwhile True:\n if i == len(A):\n print(i)\n exit()\n else:\n tmp += A[i]\n if tmp > x or i == len(A):\n print(i)\n exit()\n else:\n i += 1\n', 'N,x = map(int, input().split())\nA = list(map(int, input().split()))\nA = sorted(A)\ni = 0\ntmp = 0\nwhile True:\n if i == len(A):\n if x - tmp == 0:\n print(i)\n exit()\n else:\n print(i - 1)\n exit()\n else:\n tmp += A[i]\n if tmp > x:\n print(i)\n exit()\n else:\n i += 1\n']
['Wrong Answer', 'Accepted']
['s934130244', 's503437052']
[3060.0, 3060.0]
[19.0, 17.0]
[297, 375]
p03254
u177132624
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()))\nl.sort()\nfor i in range(len(l)):\n sum_l = sum(l[:i+1])\n if sum_l > x:\n print(i)\n break\nelse:\n print(N)\n ', 'N,x = map(int,input().split())\nl = list(map(int,input().split()))\nl.sort()\nfor i in range(len(l)):\n sum_l = sum(l[:i+1])\n if sum_l > x and sum(l[:i])== x:\n print(i)\n break\nelse:\n print(N)', 'N,x = map(int,input().split())\nl = list(map(int,input().split()))\nl.sort()\nfor i in range(len(l)):\n sum_l = sum(l[:i+1])\n if sum_l > x :\n print(i)\n break\nif sum(l) == x:\n print(N)\nelif sum(l) < x:\n print(N-1)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s630697636', 's919267167', 's455778680']
[3060.0, 3060.0, 2940.0]
[17.0, 18.0, 18.0]
[196, 210, 235]
p03254
u177398299
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.
['y = x\ncnt = 0\nfor ai in a:\n if y - ai >= 0:\n y -= ai\n cnt += 1\nif y and cnt == n:\n print(cnt - 1)\nelse:\n print(cnt)', 'n, x = map(int, input().split())\na = sorted(map(int, input().split()))\n\ny = x\ncnt = 0\nfor ai in a:\n if y - ai >= 0:\n y -= ai\n cnt += 1\nif y and cnt == n:\n print(cnt - 1)\nelse:\n print(cnt)\n']
['Runtime Error', 'Accepted']
['s560869064', 's308634822']
[2940.0, 2940.0]
[17.0, 18.0]
[138, 211]
p03254
u178079174
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 = list(sorted(list(map(int,input().split()))))\nfor i in range(N,0,-1):\n if sum(A[:i]) <= x:\n print(i)\n break\nelse:\n print(0)', 'N,x = list(map(int,input().split()))\nA = list(sorted(list(map(int,input().split()))))\nfor i in range(N,0,-1):\n if sum(A[:i]) == x:\n print(i)\n break\n elif sum(A[:i]) < x and i == N:\n print(i-1)\n break\n elif sum(A[:i]) < x and i != N:\n print(i)\n break\nelse:\n print(0)']
['Wrong Answer', 'Accepted']
['s511007700', 's934865509']
[3060.0, 3064.0]
[17.0, 18.0]
[181, 317]
p03254
u187109555
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_s = map(int, input().split())\nsorted_a_s = sorted(a_s)\nrest_snaks = x\nsatisfied_num = 0\nfor n in range(N):\n if sorted_a_s[n] <= rest_snaks:\n satisfied_num += 1\n rest_snaks -= sorted_a_s[n]\n else:\n rest_snaks = 0\n\nprint(satisfied_num)', 'N, x = map(int, input().split())\na_s = map(int, input().split())\nsorted_a_s = sorted(a_s)\nrest_snaks = x\nsatisfied_num = 0\nfor n in range(N):\n if sorted_a_s[n] <= rest_snaks:\n satisfied_num += 1\n rest_snaks -= sorted_a_s[n]\n else:\n rest_snaks = 0\n\nprint(satisfied_num)', 'N, x = map(int, input().split())\na_s = map(int, input().split())\nsorted_a_s = sorted(a_s)\nrest_snaks = x\nsatisfied_num = 0\nfor n in range(N):\n if sorted_a_s[n] <= rest_snaks:\n if n == (N-1):\n rest_snaks -= sorted_a_s[n]\n if rest_snaks == 0:\n satisfied_num += 1\n else:\n satisfied_num += 1\n rest_snaks -= sorted_a_s[n]\n else:\n rest_snaks = 0\n\nprint(satisfied_num)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s253435178', 's752641867', 's957177396']
[3064.0, 3060.0, 3064.0]
[17.0, 17.0, 17.0]
[295, 295, 443]
p03254
u188745744
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,B=list(map(int,input().split()))\nC=list(map(int,input().split()))\nC.sort()\nans = 0\nfor i in C:\n if B >= i:\n ans+=1\n B-=i\n else:\n print(ans)\n exit()\nprint(ans)', 'A,B=list(map(int,input().split()))\nC=list(map(int,input().split()))\nC.sort()\nans = 0\nfor i in C:\n if B >= i:\n ans+=1\n B-=i\n else:\n print(ans)\n exit()\nif B > 0:\n ans-=1\nprint(ans)']
['Wrong Answer', 'Accepted']
['s944867328', 's077511463']
[3060.0, 3064.0]
[17.0, 17.0]
[194, 215]
p03254
u190866453
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()\ncount = 0\n\ntry:\n while x >= a[0]:\n x -= a.pop(0)\n count += 1\nexcept IndexError:\n pass\n\nprint(count)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\ncount = 0\n\nfor i in a:\n if x >= i:\n x -= i\n count += 1\n else:\n pass\n \nprint(count)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\ncount = 0\n\nwhile x > min(a):\nfor i in a:\n if x >= i:\n x -= i\n count += 1\n else:\n pass\n \nprint(count)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\ncount = 0\n\nfor i in a:\n if x >= min(a) and x >= i:\n x -= i\n count += 1\n else:\n pass\n \nprint(count)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\ncount = 0\n\nfor i in a:\n if x >= i:\n x -= i\n count += 1\n else:\n pass\n \nprint(count)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\ncount = 0\n\nwhile x >= min(a):\n for i in a:\n if x >= i:\n x -= i\n count += 1\n else:\n pass\n \nprint(count)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\ncount = 0\n\nfor i in a:\n if x >= i:\n x -= i\n count += 1\n \nprint(count)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\ncount = 0\n\nwhile x > min(a):\n for i in a:\n if x >= i:\n x -= i\n count += 1\n else:\n pass\n \nprint(count)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\ncount = 0\n\nfor i in a:\n if x >= min(a) or x >= i:\n x -= i\n count += 1\n else:\n pass\n \nprint(count)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\ncount = 0\n\nwhile x > min(a):\n pass\nfor i in a:\n if x >= i:\n x -= i\n count += 1\n else:\n pass\n \nprint(count)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\ncount = 0\n\nfor i in a:\n if x >= a[min]:\n x -= i\n count += 1\n else:\n pass\n \nprint(count)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\ncount = 0\n\nfor i in a:\n if x >= i:\n x -= i\n count += 1\n else:\n pass\n \nprint(count)', 'N, x = map(int, input().split())\na = sorted(map(int, input().split()))\ncnt = 0\nfor i in a:\n if x >= i:\n cnt += 1\n x -= i\n else:\n break\nelse:\n if x > 0:\n cnt -= 1\nprint(cnt)']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Time Limit Exceeded', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s219300762', 's241290633', 's246252890', 's265330132', 's416924001', 's665955000', 's697038677', 's750240705', 's795612700', 's834881344', 's849601508', 's859907211', 's624130338']
[9180.0, 9052.0, 9000.0, 9092.0, 8964.0, 8972.0, 9036.0, 9096.0, 9116.0, 9080.0, 9056.0, 9120.0, 9052.0]
[29.0, 30.0, 27.0, 29.0, 26.0, 28.0, 29.0, 27.0, 28.0, 2206.0, 25.0, 29.0, 32.0]
[198, 195, 213, 211, 195, 238, 172, 237, 210, 222, 200, 195, 209]
p03254
u193927973
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())\nc=list(map(int, input().split()))\nc.sort()\nans=0\nfor g in c:\n if g<=x:\n x-=g\n ans+=1\n else:\n break\nif x>0:\n print(0)\nelse:\n print(ans)', 'n, x=map(int, input().split())\nc=list(map(int, input().split()))\nc.sort()\nans=0\nfor i in range(n-1):\n if c[i]<=x:\n x-=c[i]\n ans+=1\n else:\n break\nif c[n-1]==x:\n ans+=1\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s405691430', 's471603562']
[2940.0, 3060.0]
[18.0, 17.0]
[178, 190]
p03254
u196574642
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())\na = list(map(int, input().split()))\n\nans = 0\nis_broken = False\nfor num in sorted(a):\n if num > k:\n break\n is_broken = True\n else:\n k -= num\n ans += 1\nif k != 0 and ans >= 1 and is_broken:\n ans -= 1\nprint(ans)\n', 'n, k = map(int, input().split())\na = list(map(int, input().split()))\n\nans = 0\n\nfor num in sorted(a):\n if num > k:\n break\n else:\n k -= num\n ans += 1\nprint(ans)\n', 'n, k = map(int, input().split())\na = list(map(int, input().split()))\n\nans = 0\nis_broken = False\nfor num in sorted(a):\n if num > k:\n is_broken = True\n break\n else:\n k -= num\n ans += 1\nif k != 0 and ans >= 1 and not is_broken:\n ans -= 1\nprint(ans)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s019973414', 's806050726', 's007712916']
[3060.0, 2940.0, 3060.0]
[18.0, 17.0, 17.0]
[279, 186, 283]
p03254
u198336369
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()\nfor i in range(n):\n x = x - a[i]\n if x >= 0:\n continue\n else:\n print(i)\n break\nif x >= 0:\n print(i+1)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nif x < a[0]:\n print(0)\nelse:\n for i in range(n):\n x = x - a[i]\n if x > 0:\n continue\n elif x == 0:\n print(i+1)\n break\n else:\n print(i-2)\n break\nif x > 0 and x > a[0]:\n print(n-1)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\ny = x\nif y < a[0]:\n print(0)\nelse:\n for i in range(n):\n x = x - a[i]\n if x > 0:\n continue\n elif x == 0:\n print(i+1)\n break\n elif x < 0:\n print(i)\n break\nif x > 0 and y > a[0]:\n print(n-1)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s115873606', 's931283532', 's893733353']
[9096.0, 8956.0, 9176.0]
[28.0, 30.0, 31.0]
[212, 347, 357]
p03254
u199295501
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())\nan = list(map(int, input().split()))\n\nan.sort()\n\n# print(an)\nans = 0\n\nfor ai in an:\n if x >= ai:\n x -= ai\n ans += 1\n else:\n break\n\n\nif x > 0:\n if ans > 0:\n if ans == len(an):\n pass\n else:\n ans -=1\n else:\n ans = 0\n\nprint(ans)\n', '# -*- coding: utf-8 -*-\nN, x = map(int, input().split())\nan = list(map(int, input().split()))\n\nan.sort()\n\n# print(an)\nans = 0\n\nfor ai in an:\n if x >= ai:\n x -= ai\n ans += 1\n else:\n break\n\n\nif x > 0:\n if ans > 0:\n if ans == len(an):\n ans -=1\n else:\n pass\n else:\n ans = 0\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s420339519', 's646100106']
[2940.0, 2940.0]
[17.0, 17.0]
[358, 358]
p03254
u202400119
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\nnums = sorted(list(map(int, input().split())))\n\ncount = 0\nfor i, num in enumerate(nums):\n if num <= x:\n if i != nums.index(num):\n count += 1\n x -= num\n else:\n if num == x:\n count += 1\n x -= num\n else:\n break\n\nprint(count)', 'n, x = map(int, input().split())\n\nnums = sorted(list(map(int, input().split())))\n\ncount = 0\nfor i, num in enumerate(nums):\n if (i < n-1 and num <= x) or (i == n-1 and num == x):\n count += 1\n x -= num \n else:\n break\n\nprint(count)']
['Wrong Answer', 'Accepted']
['s659815452', 's044947661']
[3060.0, 3060.0]
[17.0, 17.0]
[345, 262]
p03254
u202560873
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(x) for x in input().split()]\na = sorted([int(x) for x in input().split()])\n\nans = 0\n\nif sum(a) == x:\n ans = N\nelse:\n for i in range(N):\n if x > a[i]:\n x -= a[i]\n ans += 1\n\nprint(ans)', 'N, x = [int(x) for x in input().split()]\na = sorted([int(x) for x in input().split()])\n\nans = 0\n\nif sum(a) == x:\n ans = N\nelse:\n for i in range(N):\n if x >= a[i]:\n x -= a[i]\n ans += 1\n\nprint(ans)', 'N, x = [int(x) for x in input().split()]\na = sorted([int(x) for x in input().split()])\n\nans = 0\n\nif sum(a) < x:\n \tans = N - 1\nelif sum(a) == x:\n ans = N\nelse:\n for i in range(N):\n if x >= a[i]:\n x -= a[i]\n ans += 1\n\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s689905243', 's816538624', 's431583807']
[9192.0, 9168.0, 9080.0]
[25.0, 29.0, 28.0]
[229, 230, 262]
p03254
u204523044
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) == x:\n print(N)\nelse:\n while sum(a) > x:\n a.remove(max(a))\n print(len(l))\n', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\nif sum(a) == x:\n print(N)\nelse:\n sort(a)\n while sum(a) > x:\n a.remove(max(a))\n print(len(l))\n', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\nif sum(a) == x:\n print(N)\nelse:\n while sum(a) > x:\n a.remove(max(a))\n l = len(a)\n if l == N:\n print(l - 1)\n else:\n print(l)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s661988390', 's767124156', 's347218230']
[2940.0, 2940.0, 3060.0]
[17.0, 17.0, 18.0]
[159, 169, 206]
p03254
u204800924
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\nsum = 0\ni = 0\n\nwhile (sum <= x) and (i < N) :\n sum += a[i]\n i += 1\n\nprint(i)\n', 'N, x =map(int, input().split())\na = sorted(map(int, input().split()))\n\ni = 0\nwhile (i<N) and (x>0):\n x -= a[i]\n i += 1\n\nprint(i)\n', 'N, x =map(int, input().split())\na = sorted(map(int, input().split()))\n\ni = 0\nwhile (i<N) and (x>=0):\n x -= a[i]\n i += 1\n\nprint(i)\n', 'N, x =map(int, input().split())\na = sorted(map(int, input().split()))\n\ni = 0\n\nwhile (i<N) and (x>=0):\n x -= a[i]\n if x>=0:\n i += 1\n\nprint(i)\n', 'N, x =map(int, input().split())\na = sorted(map(int, input().split()))\n\ni = 0\n\nwhile (i<N) and (x>=0):\n x -= a[i]\n if x>=0:\n i += 1\n\nprint(i)\n', 'N, x =map(int, input().split())\na = sorted(map(int, input().split()))\n\ni = 0\nwhile (i<N) and (x>=0):\n if x == 0:\n break\n x -= a[i]\n i += 1\n\nprint(i)\n', 'N, x =map(int, input().split())\na = sorted(map(int, input().split()))\n\ni = 0\n\nwhile (i<N) and (x>=0):\n x -= a[i]\n if x>=0:\n i += 1\n\nif (i == N) and (x>0) :\n print(N-1)\nelse:\n print(i)\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s278196859', 's343158166', 's440490187', 's571363253', 's779656753', 's914531139', 's405852707']
[2940.0, 3064.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[19.0, 18.0, 17.0, 17.0, 17.0, 17.0, 18.0]
[156, 135, 136, 150, 154, 165, 203]
p03254
u206570055
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.
['hito, ame = map(int, input().split())\nNeedAme = list(map(int, input().split()))\nNeedAme.sort()\n\nans = 0\ntotal = 0\nfor n in NeedAme:\n if total + n <= ame:\n ans += 1\n total += n\n else:\n break\n\nprint(ans)\n', 'hito, ame = map(int, input().split())\nNeedAme = list(map(int, input().split()))\nNeedAme.sort()\n\nans = 0\ntotal = 0\nfor i in range(0, hito):\n if ((i != hito - 1) and (total + NeedAme[i] <= ame)) or ((i == hito - 1) and (total + NeedAme[i] == ame )):\n ans += 1\n total += NeedAme[i]\n else:\n break\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s331242958', 's534251299']
[2940.0, 3060.0]
[17.0, 17.0]
[229, 332]
p03254
u209619667
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,B = map(int,input().split())\nX =list(map(int,input().split()))\nX = sorted(X)\ncount = 0\nif B == sum(X):\n print(len(X))\nelif B <= min(X):\n print(0)\nelse:\n for i in range(A):\n a = X.pop(0)\n B=B - a\n if B >= 0:\n count += 1\n print(count)', 'A,B = map(int,input().split())\nX =list(map(int,input().split()))\nX = sorted(X)\ncount = 0\nfor i in range(A):\n a = X.pop(0)\n B=B - a\n if B > 0:\n count += 1\nprint(count)', 'A,B = map(int,input().split())\nX =list(map(int,input().split()))\nX = sorted(X)\ncount = 0\nif B == sum(X):\n print(len(X))\nelif B >= min(x):\n print(0)\nelse:\n for i in range(A):\n a = X.pop(0)\n B=B - a\n if B >= 0:\n count += 1\n print(count)', 'A,B = map(int,input().split())\nX =list(map(int,input().split()))\nX = sorted(X)\ncount = 0\nj=len(X)\nif B == sum(X):\n print(len(X))\nelse:\n for i in range(A):\n a = X.pop(0)\n B=B - a\n if B >= 0:\n count += 1\n if B >= 0 and count == j:\n count = count -1\n print(count)']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s575857307', 's576526307', 's812787030', 's315530592']
[3064.0, 3060.0, 3064.0, 3064.0]
[17.0, 17.0, 18.0, 17.0]
[252, 172, 252, 285]
p03254
u212328220
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\nal = list(map(int,input().split()))\n\nal.sort()\n\ncnt = 0\n\nfor a in al[:N]:\n if x >= a:\n x -= a\n cnt += 1\n else:\n break\nif al[-1] == x:\n cnt += 1\n\nprint(cnt)\n\n \n', 'N, x = map(int,input().split())\nal = list(map(int,input().split()))\n\nal.sort()\n\ncnt = 0\nfor a in al:\n x -= a\n cnt += 1\n if x < 0:\n break\nprint(cnt)\n ', 'N, x = map(int,input().split())\n\nal = list(map(int,input().split()))\n\nal.sort()\n\ncnt = 0\n\nfor a in al:\n\n x -= a\n\n if x < 0:\n\n break\n\n cnt += 1\n\nprint(cnt)\n\n ', 'N, x = map(int,input().split())\n\nal = list(map(int,input().split()))\n\nal.sort()\n\ncnt = 0\n\nfor a in al[:N-1]:\n if x >= a:\n x -= a\n cnt += 1\n else:\n break\nif al[-1] == x:\n cnt += 1\n\nprint(cnt)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s092682062', 's637755003', 's941486008', 's713711649']
[8928.0, 9104.0, 9104.0, 9180.0]
[28.0, 26.0, 29.0, 28.0]
[205, 156, 164, 202]
p03254
u215065194
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.
['m,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\ncnt=0\nres=0\nfor i in a:\n cnt+=i\n if cnt > x:\n break\n res+=1\nif a[0] > x:\n res=0\nprint(res)', 'm,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\ncnt=0\nres=0\nfor i in range(0,m):\n cnt += a[i]\n if cnt > x:\n res=i\n break\n elif cnt==x:\n res=i+1\n break\n if i == m-1 and cnt<x:\n res=m-1\nif a[0] > x:\n res=0\nprint(res)']
['Wrong Answer', 'Accepted']
['s844805201', 's248833146']
[3060.0, 3064.0]
[17.0, 17.0]
[180, 287]
p03254
u215115622
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 = input().split()\na = [int(i) for i in a]\nb = input().split()\nb = [int(i) for i in b]\nb = sorted(b)\noutput = 0\nend = False\n\nfor i in range(len(b)- 1):\n\tif a[1] - b[i] > 0:\n\t\ta[1] += -b[i]\n\t\toutput += 1\n\telif(a[1] - b[i] == 0):\n\t\toutput += 1\n\t\tend = True\n\t\tbreak\n\telse:\n\t\tend = True\n\t\tpass\n\t\t\nif end == False:\n\tif a[1] - b[-1] < 0:\n\t\toutput -= 1\n\telif a[1] - b[-1] > 0:\n\t\toutput -= 1\n\telse:\n\t\toutput += 1\n\t\t \nprint(output)', 'a = input().split()\na = [int(i) for i in a]\nb = input().split()\nb = [int(i) for i in b]\nb = sorted(b)\noutput = 0\nend = False\n\nfor i in range(len(b)- 1):\n\tif a[1] - b[i] > 0:\n\t\ta[1] += -b[i]\n\t\toutput += 1\n\telif(a[1] - b[i] == 0):\n\t\toutput += 1\n\t\tend = True\n\t\tbreak\n\telse:\n\t\tend = True\n\t\tbreak\n\t\t\nif end == False:\n\tif a[1] - b[-1] == 0:\n\t\toutput += 1\n\t\t \nprint(output)']
['Wrong Answer', 'Accepted']
['s109123210', 's952946320']
[3064.0, 3064.0]
[17.0, 17.0]
[424, 367]
p03254
u215341636
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().strip().split())\na = list(map(int , input().strip().split()))\na.sort()\ncount = 0\n\nfor i in a:\n if x - i < 0:\n break\n x -= i\n count += 1\n\nprint(count)', 'n , x = map(int , input().strip().split())\na = list(map(int , input().strip().split()))\na.sort()\nif sum(a) < x:\n count = -1\nelse:\n count = 0\n\nfor i in a:\n if x - i < 0:\n break\n x -= i\n count += 1\n\nprint(count)']
['Wrong Answer', 'Accepted']
['s785896913', 's113481293']
[2940.0, 3060.0]
[17.0, 17.0]
[182, 218]
p03254
u217123285
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\nans = 1-1\nfor i in a:\n x -= i\n if x < 0:\n break\n ans += 1\nprint(ans)\n', 'n, x = map(int, input().split())\na = list(map(int,input().split()))\na.sort()\n\nans = 0\nfor i in a:\n x -= i\n if x < 0:\n break\n ans += 1\nprint(ans)\n', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\na.reverse()\nans = 0\n\nfor i in a:\n x -= i\n if x<0:\n break\n ans += 1\nprint(ans)\n', 'n, x = map(int, input().split())\na = list(map(int,input().split()))\na.sort()\n\nans = 0\nfor i in a:\n x -= i\n if x < 0:\n break\n ans += 1\nprint(ans)\n', 'n, x = map(int, input().split())\na = list(map(int,input().split()))\na.sort()\n\nans = 0\nfor i in a:\n x -= i\n if x < 0:\n break\n ans += 1\nprint(ans)\n', 'n, x = map(int, input().split())\na = list(map(int,input().split()))\na.sort()\n\nans = 0\nfor i in a:\n x -= i\n if x <= 0:\n break\n ans += 1\nprint(ans)\n', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nans = 0\n \nfor i in a:\n x -= i\n if x < 0:\n break\n ans += 1\nif x > 0:\n if ans > 0:\n ans -= 1\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s138405519', 's473249502', 's619287220', 's630584420', 's836444999', 's987333575', 's213150255']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 3060.0]
[17.0, 22.0, 18.0, 17.0, 18.0, 17.0, 18.0]
[153, 151, 162, 151, 151, 152, 189]
p03254
u221401884
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(n) for n in input().split()]\nA = [int(n) for n in input().split()]\n\ncount = 0\nfor a in sorted(A):\n if X >= a:\n count += 1\n X -= a\n\nprint(count)\n', 'N, X = [int(n) for n in input().split()]\nA = [int(n) for n in input().split()]\n\ncount = 0\nfor i, a in enumerate(sorted(A)):\n if X >= a:\n count += 1\n X -= a\n\nif count == N and X > 0:\n count -= 1\n\nprint(count)\n']
['Wrong Answer', 'Accepted']
['s410981295', 's735428699']
[2940.0, 3060.0]
[17.0, 18.0]
[173, 228]
p03254
u222207357
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 numpy as np\n\nn, x = map(int, input().split())\na = np.array(list(map(int, input().split())))\na = np.sort(a)\na = a.cumsum()\na = a[a <= x]\nprint(len(a))', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\na = sorted(a)\n\ncnt = 0\nfor a_ in a:\n cnt += 1\n if a_ <= x:\n x -= a_\n elif a_ > x:\n x -= a_\n break\nprint(cnt if x == 0 else cnt - 1)']
['Wrong Answer', 'Accepted']
['s831502775', 's353865890']
[13616.0, 3060.0]
[179.0, 18.0]
[156, 230]
p03254
u223904637
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\ni=0\nwhile x>0 and i<n:\n if x>=a[i]:\n x-=a[i]\n ans+=1\n i+=1\nprint(ans)', 'n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nans=0\ni=0\nwhile x>0 and i<n:\n if i==n-1:\n if x==a[i]:\n ans+=1\n break\n if x>=a[i]:\n x-=a[i]\n ans+=1\n i+=1\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s296809699', 's326885177']
[3060.0, 3060.0]
[17.0, 17.0]
[166, 235]
p03254
u224156735
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\nl=list(map(int,input().split()))\n\nl.sort()\nans=0\nfor i in range(n):\n if x<l[i]:\n break\n else:\n ans+=1\n x-=l[i]\nprint(ans) ', 'N, x = map(int, input().split())\na = sorted(int(x) for x in input().split())\nans = 0\nfor ai in a:\n x -= ai\n if x < 0:\n break\n ans += 1\nif 0 < x:\n ans -= 1\nprint(ans)']
['Wrong Answer', 'Accepted']
['s789594520', 's877739957']
[2940.0, 2940.0]
[18.0, 18.0]
[166, 184]
p03254
u227082700
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());a=list(map(int,input().split()));a.sort();ans=0\nfor i in a:\n if i>x:break\n else:\n ans+=1\n x-=i\nprint(ans)', 'n,x=map(int,input().split());a=list(map(int,input().split()));a.sort();ans=0\nfor i in a:\n if i>n:break\n else:\n ans+=1\n n-=i\nprint(ans)', 'n,x=map(int,input().split());a=list(map(int,input().split()));a.sort();ans=0\nfor i in range(n):\n if a[i]>x:break\n else:\n ans+=1\n x-=a[i]\n if i==n-1 and x!=0:ans-=1\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s390661187', 's467438835', 's427375610']
[2940.0, 2940.0, 3060.0]
[17.0, 18.0, 17.0]
[142, 142, 185]
p03254
u227085629
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())\nal = list(map(int,input().split()))\nal.sort()\nc = 0\nfor a in al:\n if x >= a:\n c += 1\n x -= a\nprint(c)', 'n,x = map(int,input().split())\nal = list(map(int,input().split()))\nal.sort()\nc = 0\nfor a in al:\n if x >= a:\n c += 1\n x -= a\nif x > 0 and c > 0:\n c -= 1\nprint(c)']
['Wrong Answer', 'Accepted']
['s427721211', 's111529323']
[2940.0, 2940.0]
[18.0, 18.0]
[139, 166]
p03254
u230621983
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, *a = map(int, open(0).read().split())\na.sort()\ncnt = 0\nfor i in range(n):\n if x >= a[i]:\n x -= a[i]\n cnt += 1\n print(a,x,cnt)\n else:\n break\nif x > 0:\n cnt -= 1\nprint(max(cnt,0))\n ', 'n, x, *a = map(int, open(0).read().split())\na.sort()\ncnt = 0\nfor i in range(n):\n if i == n-1:\n if x == a[i]:\n cnt += 1\n break\n \n if x >= a[i]:\n x -= a[i]\n cnt += 1\n else:\n break\n\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s514862839', 's837531776']
[3060.0, 2940.0]
[19.0, 17.0]
[225, 251]
p03254
u234189749
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\nX = 1\nans = 0\n\nwhile x >= X:\n ans += A.count(X)\n x += -X*(A.count(X))\n X += 1\n\nif ans !=0 & x!=0:\n ans += -1\n\nprint(ans)', 'N,x = map(int,input().split())\nA = sorted(list(map(int,input().split())))\n\ni = 0\n\nwhile x >= A[i]:\n x += -A[i]\n i += 1\n if i == N:\n i = (i-1 if x > 0 else i)\n break\n\nprint(i)']
['Wrong Answer', 'Accepted']
['s938108732', 's028588558']
[3060.0, 2940.0]
[2104.0, 18.0]
[199, 197]
p03254
u236127431
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=list(map(int,input().split()))\nChildren.sort(key=lambda x:x)\nn=0\nS=0\nwhile n<=N-1:\n S+=Children[n]\n if S<x:\n n+=1\n elif S==x:\n n+=1\n break\n elif S>x:\n break\nif S<x:\n n=-1\nprint(n)', 'N,x=map(int,input().split())\nChildren=list(map(int,input().split()))\nChildren.sort(key=lambda x:x)\nn=0\nS=0\nwhile n<=N-1:\n S+=Children[n]\n if S<x:\n n+=1\n elif S==x:\n n+=1\n break\n elif S>x:\n break\nif S<x:\n n+=-1\nprint(n)']
['Wrong Answer', 'Accepted']
['s188228099', 's717737812']
[3060.0, 3060.0]
[18.0, 18.0]
[234, 235]
p03254
u243535639
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\ninput = sys.stdin.readline\n\ndef main():\n N, x = map(int, input().split())\n a_list = list(map(int, input().split()))\n for i, a in enumerate(sorted(a_list), start=1):\n x -= a\n if x < 0:\n break\n if x >= 0:\n print(i)\n else:\n print(i-1)\n\nif __name__ == '__main__':\n main()", 'import sys\ninput = sys.stdin.readline\n\ndef main():\n N, x = map(int, input().split())\n a_list = list(map(int, input().split()))\n if sum(a_list) == x:\n print(N)\n sys.exit()\n for i, a in enumerate(sorted(a_list), start=1):\n x -= a\n if x < 0:\n break\n if x >= 0:\n print(i)\n else:\n print(i-1)\n', "import sys\ninput = sys.stdin.readline\n\ndef main():\n N, x = map(int, input().split())\n a_list = list(map(int, input().split()))\n for i, a in enumerate(sorted(a_list), start=1):\n x -= a\n if x < 0:\n break\n if x >= 0:\n print(i)\n else:\n print(i-1)\n\nif __name__ == '__main__':\n main()", "import sys\ninput = sys.stdin.readline\n\ndef main():\n N, x = map(int, input().split())\n a_list = list(map(int, input().split()))\n ans = 0\n for a in sorted(a_list):\n if a <= x:\n ans += 1\n x -= a\n else:\n break\n if x == 0 or ans != N:\n print(ans)\n else:\n print(max(ans - 1, 0))\n\nif __name__ == '__main__':\n main()"]
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s027478944', 's529758476', 's834460105', 's848932598']
[3060.0, 2940.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0, 18.0]
[335, 354, 335, 390]
p03254
u254022775
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.
['line = input().split()\nx = int(line[1])\nans = 0\n \na = sorted(input().split())\nmap(int, a)\n \nfor i in range(len(a)):\n if a[i] > x:\n print(ans)\n break\n else:\n x-=a[i]\n if i!=(len(a)-1):\n ans+=1\n else:\n if x==0:\n ans+=1\n print(ans)', 'x = input().split()[1]\nans = 0\n \na = input().split()\na.sort()\n \nfor i in len(a):\n if a[i] > x:\n print(ans)\n break\n else:\n x-=a[i]\n if i!=len(a)-1:\n ans+=1\n else:\n if a[i]==x:\n ans+=1\n print(ans)', 'line = input().split()\nx = line[1]\nans = 0\n \na = input().split().sort()\n \nfor i in len(a):\n if a[i] > x:\n print ans\n break\n else:\n x-=a[i]\n ans+=1\n continue\nprint ans', 'x = input().split()[1]\nans = 0\n \na = input().split()\na.sort()\n \nfor i in len(a):\n if a[i] > x:\n print ans\n break\n else:\n x-=a[i]\n ans+=1\nprint ans', 'line = input().split()\nx = line[1]\nans = 0;\n \na = input().split().sort()\n \nfor i in len(a):\n if a[i] > x:\n print ans\n break\n else:\n x-=a[i]\n ans+=1\n continue\nprint ans', 'line = input().split()\nN = int(line[0])\nx = int(line[1])\nans = 0\n\na = input().split()\na = [int(i) for i in a]\na = sorted(a)\n\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 ans += 1\n else:\n if x == 0:\n ans += 1\n print(ans)\nprint(a)', 'x = int(input().split()[1])\nans = 0\n \na = input().split()\na.sort()\n \nfor i in len(a):\n if a[i] > x:\n print(ans)\n break\n else:\n x-=a[i]\n if i!=len(a)-1:\n ans+=1\n else:\n if x==0:\n ans+=1\n print(ans)', 'line = input().split()\nx = int(line[1])\nans = 0\n \na = sorted(input().split())\n[map(int, a[i]) for i in len(a)]\n \nfor i in range(len(a)):\n if a[i] > x:\n print(ans)\n break\n else:\n x-=a[i]\n if i!=(len(a)-1):\n ans+=1\n else:\n if x==0:\n ans+=1\n print(ans)', 'line = input().split()\nx = line[1]\nans = 0;\n\na = input().split().sort()\n\nfor i in len(a):\n if a[i] > x:\n print ans\n break\n else:\n x-=a[i]\n ans++\n continue\nprint ans', 'line = input().split()\nx = int(line[1])\nans = 0\n \na = sorted(input().split())\nmap(int, a)\n \nfor i in len(a):\n if a[i] > x:\n print(ans)\n break\n else:\n x-=a[i]\n if i!=len(a)-1:\n ans+=1\n else:\n if x==0:\n ans+=1\n print(ans)', 'x = input().split()[1]\nans = 0\n \na = sorted(input().split())\n \nfor i in len(a):\n if a[i] > x:\n print ans\n break\n else:\n x-=a[i]\n ans+=1\nprint ans', 'line = input().split()\nx = int(line[1])\nans = 0\n \na = sorted(input().split())\nmap(int, a)\n \nfor i in len(a):\n if a[i] > x:\n print(ans)\n break\n else:\n x-=a[i]\n if i!=len(a)-1:\n ans+=1\n else:\n if x==0:\n ans+=1\n print(ans)', 'x = input().split()[1]\nans = 0\n \na = input().split()\na.sort()\n \nfor i in len(a):\n if a[i] > x:\n print(ans)\n break\n else:\n x-=a[i]\n if i!=len(a)-1:\n ans+=1\n else:\n if a[i]=x:\n ans+=1\n print(ans)', 'line = input().split()\nx = int(line[1])\nans = 0\n \na = sorted(input().split())\nmap(int, a)\n \nfor i in range(len(a)):\n if a[i] > x:\n print(ans)\n break\n else:\n x-=a[i]\n if i!=len(a)-1:\n ans+=1\n else:\n if x==0:\n ans+=1\n print(ans)', 'x = input().split()[1]\nans = 0\n \na = input().split()\na.sort()\n \nfor i in len(a):\n if a[i] > x:\n print(ans)\n break\n else:\n x-=a[i]\n ans+=1\nprint(ans)', 'x = int(input().split()[1])\nans = 0\n \na = input().split()\na.sort()\n \nfor i in len(a):\n if a[i] > x:\n print(ans)\n break\n else:\n x-=a[i]\n if i!=len(a)-1:\n ans+=1\n else:\n if a[i]==x:\n ans+=1\n print(ans)', 'line = input().split()\nx = int(line[1])\nans = 0\n \na = sorted(input().split())\n \nfor i in len(a):\n if a[i] > x:\n print(ans)\n break\n else:\n x-=a[i]\n if i!=len(a)-1:\n ans+=1\n else:\n if x==0:\n ans+=1\n print(ans)', 'line = input().split()\nx = int(line[1])\nans = 0\n \na = sorted(input().split())\n \nfor i in len(a):\n map(int, a[i])\n if a[i] > x:\n print(ans)\n break\n else:\n x-=a[i]\n if i!=len(a)-1:\n ans+=1\n else:\n if x==0:\n ans+=1\n print(ans)', 'line = input().split()\nN = int(line[0])\nx = int(line[1])\nans = 0\n\na = input().split()\na = [int(i) for i in a]\na.sort()\n\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 ans += 1\n else:\n if x == 0:\n ans += 1\n print(ans)\nprint(a)', 'line = input().split()\nN = int(line[0])\nx = int(line[1])\nans = 0\n\na = input().split()\na = [int(i) for i in a]\na.sort()\n\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 ans += 1\n else:\n if x == 0:\n ans += 1\n print(ans)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s019247233', 's078696535', 's096199932', 's163515364', 's195411389', 's228870698', 's524354485', 's546575877', 's546798321', 's584948456', 's586896404', 's749374261', 's769774248', 's773192859', 's793424042', 's830451083', 's867563097', 's882017097', 's913312210', 's749990253']
[3188.0, 3060.0, 2940.0, 2940.0, 2940.0, 3064.0, 3060.0, 3064.0, 2940.0, 3064.0, 2940.0, 3064.0, 2940.0, 3188.0, 2940.0, 3060.0, 3064.0, 3060.0, 3060.0, 3064.0]
[18.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 19.0, 17.0, 17.0, 17.0, 17.0, 17.0, 18.0]
[267, 233, 183, 160, 184, 361, 235, 288, 181, 258, 159, 258, 232, 265, 162, 238, 246, 263, 356, 347]
p03254
u256464928
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(sorted(list(map(int,input().split()))))\nprint(a)\nans = 0\nfor i in range(n+1):\n if i == n:\n if x > 0:\n ans -= 1\n elif x > a[i]:\n x -= a[i]\n ans += 1\n elif x == a[i]:\n ans += 1\nprint(ans)', 'n,x = map(int,input().split())\na = list(sorted(list(map(int,input().split()))))\nans = 0\nfor i in range(100):\n while n >= a[i]:\n n -= a[i]\n ans += 1\n else:\n break\nprint(ans)\n \n', 'n,x = map(int,input().split())\na = list(sorted(list(map(int,input().split()))))\nans = 0\nfor i in range(n+1):\n if i == n:\n if x > 0:\n ans -= 1\n elif x > a[i]:\n x -= a[i]\n ans += 1\n elif x == a[i]:\n ans += 1\n x -= a[i]\n else:\n break\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s839112570', 's991555839', 's227999606']
[3064.0, 2940.0, 3064.0]
[17.0, 17.0, 19.0]
[245, 189, 268]
p03254
u257541375
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()]\narray = [int(i) for i in input().split()]\n\narray.sort()\n\ncnt = 0\nfor i in range(n):\n x -= array[i]\n if x >= 0:\n cnt += 1\n \nprint(cnt)', 'n,x = [int(i) for i in input().split()]\narray = [int(i) for i in input().split()]\n\ny=x\n\narray.sort()\n\ncnt = 0\nfor i in range(n):\n x -= array[i]\n if x >= 0:\n cnt += 1\n \nif cnt == n and sum(array) !=y:\n cnt = cnt-1\n \nprint(cnt)']
['Wrong Answer', 'Accepted']
['s884029738', 's577718920']
[3060.0, 3064.0]
[18.0, 17.0]
[181, 237]
p03254
u258073778
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())\nan = list(map(int, input().split()))\nan.sort()\nflag = [0]*N\ncount = 0\ni = 0\nxs = x\nwhile(1):\n if x >= an[i]:\n x -= an[i]\n if flag[i] == 0:\n flag[i] += 1\n count += 1\n elif flag[i] == 1:\n flag[i] += 1\n count -= 1\n i = 0\n else:\n i = 0\n if x == 0:\n break\n i += 1\n if i >= N:\n i = 0\n if xs == x:\n break\nprint(count)v', 'N, x = map(int, input().split())\nan = list(map(int, input().split()))\nan.sort()\ncount = 0\ni = 0\nwhile(1):\n if x >= an[i]:\n x -= an[i]\n count += 1\n else:\n i = 0\n if x == 0:\n break\n i += 1\n if i >= N:\n i = 0\nprint(count)', 'N, x = map(int, input().split())\nan = list(map(int, input().split()))\nan.sort()\ncount = 0\nfor i in range(N):\n x -= an[i]\n if x >= 0:\n count += 1\n else:\n break\nif x > 0:\n count -= 1\nprint(count)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s625084194', 's670513084', 's431365932']
[3064.0, 3064.0, 3060.0]
[17.0, 2104.0, 17.0]
[404, 238, 203]
p03254
u268792407
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\nnum=0\nfor i in a:\n ans+=1\n num+=i\n if num>x:\n print(ans-1)\n exit()\nprint(n)', 'n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nnum=0\nfor i in range(n):\n num+=a[i]\n if num>x:\n print(i)\n exit()\nif num==x:\n print(n)\nelse:\n print(n-1)']
['Wrong Answer', 'Accepted']
['s980783846', 's456634173']
[3060.0, 3064.0]
[17.0, 18.0]
[161, 184]
p03254
u272373050
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 = input().split()\nN = int(N)\nx = int(x)\n\na_list = [int(v) for v in input().split()]\na_list.sort()\n\nperson = 0\n\nbreak_flag = False\n\nfor a in a_list[:-1]:\n if a <= x:\n x -= a\n person += 1\n else:\n break_flag=True\n break\n \nif not break_flag:\n if x == a_list[-1]:\n person += 1\n', '#python 3.5.2\n\nN, x = input().split()\nN = int(N)\nx = int(x)\n\na_list = [int(v) for v in input().split()]\na_list.sort()\n\nperson = 0\n\nbreak_flag = False\n\nfor a in a_list[:-1]:\n if a <= x:\n x -= a\n person += 1\n else:\n break_flag=True\n break\n \nif not break_flag:\n if x == a_list[-1]:\n person += 1\n\nprint(person)']
['Wrong Answer', 'Accepted']
['s287235818', 's416845389']
[3060.0, 3188.0]
[17.0, 19.0]
[322, 351]
p03254
u273201018
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\nR = 0\n\nfor a in A:\n if a <= x:\n R += 1\n x -= a\n else:\n break\n\nprint(R)\n', 'N, x = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.sort()\n\nR = 0\nF = False\n\nfor a in A[:-1]:\n if a <= x:\n R += 1\n x -= a\n else:\n break\n F = True\n\nif A[-1] == x or (A[-1] > x and F == True):\n R += 1\n\nprint(R)\n']
['Wrong Answer', 'Accepted']
['s644194371', 's331992443']
[3316.0, 3060.0]
[20.0, 17.0]
[181, 269]
p03254
u276115223
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 – Candy Distribution Again\nn, x = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\n\na.sort()\n\nanswer = 0\nfor i in range(n):\n if x - a[i] < 0:\n break\n answer += 1\n x -= a[i]\n\nprint(answer)', '# AGC 027: A – Candy Distribution Again\nn, x = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\n\na.sort()\n\nanswer = 0\nfor i in range(n - 1):\n if x - a[i] < 0:\n break\n answer += 1\n x -= a[i]\n\nif x == a[n - 1]:\n answer += 1\n\nprint(answer)']
['Wrong Answer', 'Accepted']
['s708840930', 's595561098']
[9116.0, 9092.0]
[28.0, 31.0]
[241, 280]
p03254
u276204978
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()\nans = 0\nfor ai in a:\n if x - ai < 0:\n break\n x -= ai\n ans += 1\n \nprint(ans)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\nans = 0\nfor ai in a:\n if x - ai < 0:\n x -= ai\n break\n x -= ai\n ans += 1\n\nif x > 0 and ans > 0:\n ans -= 1\n \nprint(ans)']
['Wrong Answer', 'Accepted']
['s216849451', 's372961589']
[2940.0, 3060.0]
[17.0, 17.0]
[173, 225]
p03254
u281216592
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_sorted = sorted(a)\nnum =0\nx_num = x\nfor i in range(N):\n if(x_num - a_sorted[i] >= 0):\n x_num -= a_sorted[i]\n num += 1\n else:\n break\nprint(num)\n', 'N,x = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\na_sorted = sorted(a)\nnum =0\nx_num = x\nfor i in range(N):\n if(x_num - a_sorted[i] > 0):\n x_num -= a_sorted[i]\n num += 1\n else:\n break\nprint(num)\n', 'N,x = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\na_sorted = sorted(a)\nnum =0\nx_num = x\nfor i in range(N):\n if(x_num - a_sorted[i] >= 0):\n x_num -= a_sorted[i]\n num += 1\n if(i == N-1 and x_num >0):\n num -= 1\n else:\n break\nprint(num)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s026696950', 's285753982', 's947975216']
[3060.0, 3060.0, 3060.0]
[18.0, 17.0, 17.0]
[250, 249, 306]
p03254
u284262180
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())\nnum_list = list(map(int, input().split()))\n\nans = 0\nnum_list.sort()\n\nfor num in num_list:\n if x - num >= 0:\n x -= num\n ans += 1\n else:\n break\n\nprint(ans)\n', "def main():\n n, x = map(int, input().split())\n num_list = list(map(int, input().split()))\n\n ans = 0\n num_list.sort()\n\n for num in num_list:\n if x - num >= 0:\n x -= num\n ans += 1\n else:\n break\n\n if ans == n and x > 0:\n ans -= 1\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n"]
['Wrong Answer', 'Accepted']
['s678626544', 's635252339']
[2940.0, 3064.0]
[17.0, 17.0]
[214, 355]
p03254
u288786530
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\n\nfor i in a:\n\tx -= i\n\tif x < 0:\n\t\tprint(ans)\n\tans += 1\n\nprint(ans)', 'n, x = map(int, input().split())\na = sorted(list(map(int, input().split())))\nans = 0\n\nfor i in a:\n\tx -= i\n\tif x < 0:\n\t\tprint(ans)\n\tans += 1\n\nprint(ans)', '\nn, x = map(int, input().split())\na = sorted(list(map(int, input().split())))\nans = 0\n\nfor i in a:\n\tx -= i\n\tif x < 0:\n\t\tprint(ans)\n\t\texit()\n\tans += 1\n\nif ans == 0:\n\tprint(ans)\nelif x == 0:\n\tprint(ans)\nelse:\n\tprint(ans-1)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s126288208', 's745951765', 's061278006']
[3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[151, 151, 221]
p03254
u296150111
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\tif a[i]<=x:\n\t\tans+=1\n\t\tx-=a[i]\nprint(ans)', 'n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\ncnt=0\nfor i in range(n):\n\tx-=a[i]\n\tif x<0:\n\t\tbreak\n\telse:\n\t\tcnt+=1\nif x>0:\n\tcnt-=1\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s559548756', 's563492714']
[2940.0, 3060.0]
[17.0, 17.0]
[138, 164]
p03254
u298297089
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 A:\n x -= i\n if x < 0:\n break\n cnt += 1\nprint(cnt)', 'N ,x = map(int, input().split())\nA = list(map(int, input().split()))\nA.sort()\ncnt = 0\nfor i in A:\n x -= i\n if x < 0:\n break\n cnt += 1\nif x > 0:\n cnt -= 1\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s076436796', 's767236001']
[2940.0, 3060.0]
[17.0, 17.0]
[150, 173]
p03254
u299251530
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\n\na = list(map(int,input().split()))\n \na.sort()\n\ntotal=0\nans=0\nfor i in range(n):\n total += a[i]\n ans = i+1\n if total > x:\n ans = i\n break\n \n \nprint(ans)', 'n, x = map(int, input().split())\n\n\na = list(map(int,input().split()))\n \na.sort()\n\ntotal=0\nans=0\nfor i in range(n):\n total += a[i]\n \n if total > x:\n ans = i\n break\n else if total ==x:\n ans = i+1\n break\n else:\n ans=i\n \nprint(ans)', 'n, x = map(int, input().split())\n\n\na = list(map(int,input().split()))\n \na.sort()\n\ntotal=0\nans=0\nfor i in range(n):\n total += a[i]\n if total > x:\n ans = i\n break\n ans = i+1\n \nprint(ans)', 'n, x = map(int, input().split())\n\n\na = list(map(int,input().split()))\n \na.sort(reverse = True)\n\ntotal=0\nans=0\nfor i in range(n):\n total += a[i]\n if total > x:\n ans = i\n break\n ans = i+1\n \nprint(ans)', 'n, x = map(int, input().split())\n\n\na = list(map(int,input().split()))\n \na.sort()\n\ntotal=0\nans=0\nfor i in range(n):\n total += a[i]\n \n if total > x:\n ans = i\n break\n elif total ==x:\n ans = i+1\n break\n else:\n ans=i\n \nprint(ans)']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s084699625', 's423333876', 's478233615', 's693946779', 's852260390']
[3060.0, 2940.0, 3060.0, 3060.0, 3060.0]
[18.0, 17.0, 17.0, 17.0, 18.0]
[198, 248, 195, 209, 245]
p03254
u300778480
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.
['try:\n N, x = map(int, input().split())\n l = list(map(int, input().split()))\n l_ = sorted(l)\n cnt = 0\n for i in l_:\n _ = x-i\n if _>= 0:\n cnt += 1\n if _<0:\n break\n print(cnt)\nexcept EOFError:\n pass', 'try:\n N, x = map(int, input().split())\n a = list(map(int, input().split()))\n a_ = sorted(a)\n cnt = 0\n for i in a_:\n if i<=x:\n cnt += 1\n x = x-i\n else:\n break\n print(cnt)\nexcept EOFError:\n pass', 'try:\n N, x = map(int, input().split())\n a = list(map(int, input().split()))\n a_ = sorted(a)\n cnt = 0\n for i in a_:\n if i<=x:\n cnt += 1\n x = x-i\n print(cnt)\nexcept EOFError:\n pass', 'try:\n N, x = map(int, input().split())\n a = map(int, input().split())\n a_ = sorted(a)\n cnt = 0\n for i in a_:\n if i<=x:\n cnt += 1\n x = x-i\n else:\n break\n print(cnt)\nexcept EOFError:\n pass', 'try:\n N, x = map(int, input().split())\n a = list(map(int, input().split()))\n a_ = sorted(a)\n cnt = 0\n for i in range(len(a_)-1):\n if a_[i]<=x:\n cnt += 1\n x = x-a_[i]\n if a_[len(a_)-1]-x==0:\n cnt += 1\n print(cnt)\nexcept EOFError:\n pass']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s005187895', 's501384156', 's678821590', 's934133365', 's000761704']
[3060.0, 2940.0, 2940.0, 2940.0, 3060.0]
[17.0, 18.0, 17.0, 17.0, 17.0]
[259, 236, 208, 230, 270]
p03254
u301043830
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 numpy\n\nN, x = list(map(int, input().split()))\na = list(map(int, input().split()))\na.sort()\na_sum = numpy.cumsum(a)\nans = numpy.sum(a_sum <= x)\n\nprint(ans)\n', 'import numpy\n\nN, x = list(map(int, input().split()))\na = list(map(int, input().split()))\na.sort()\na_sum = numpy.cumsum(a)\nans = numpy.sum(a_sum < x)\n\nif x in a_sum:\n ans += 1\n\nprint(ans)\n', 'N, x = list(map(int, input().split()))\na = list(map(int, input().split()))\na.sort()\n\nans = 0\nfor i in range(len(a)):\n x -= a[i]\n if x >= 0:\n ans = i + 1\n\nprint(ans)\n', 'import numpy\n\nN, x = list(map(int, input().split()))\na = list(map(int, input().split()))\na.sort()\na_sum = numpy.cumsum(a)\n\nans = len(a_sum)\nfor i in range(len(a_sum)):\n if a_sum[i] > x:\n ans = i - 1\n\n\nprint(ans)\n', 'N, x = list(map(int, input().split()))\na = list(map(int, input().split()))\na.sort()\n\nfor i in range(len(a)):\n x -= a[i]\n if x >= 0:\n ans = i + 1\n\nprint(ans)\n', 'import numpy\n\nN, x = list(map(int, input().split()))\na = list(map(int, input().split()))\na.sort()\na_sum = numpy.cumsum(a)\n\nans = len(a_sum)\nfor i in range(len(a_sum)):\n if a_sum[i] > x:\n ans = i\n break\n\nprint(ans)\n', 'import numpy\n\nN, x = list(map(int, input().split()))\na = list(map(int, input().split()))\na.sort()\na_sum = numpy.cumsum(a)\nans = numpy.sum(a_sum <= x)\n\nif ans == N and x not in a_sum:\n ans -= 1\n\nprint(ans)\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s211087073', 's363456292', 's377385970', 's390406138', 's599730056', 's683748234', 's059384064']
[21656.0, 21512.0, 2940.0, 12508.0, 2940.0, 21648.0, 21484.0]
[1287.0, 390.0, 17.0, 151.0, 18.0, 1627.0, 295.0]
[162, 190, 178, 222, 170, 231, 208]
p03254
u306950978
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()\ncou = 0\nfor i in range(n):\n cou += a[i]\n if cou > x:\n print(i)\n exit()\nprint(n)', 'n , x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\ncou = 0\nfor i in range(n):\n cou += a[i]\n if cou > x:\n print(i)\n exit()', 'n , x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\ncou = 0\nfor i in range(n):\n cou += a[i]\n if cou > x:\n print(i)\n exit()\nif cou == x:\n print(n)\nelse:\n print(n-1)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s081104883', 's164940568', 's604268035']
[2940.0, 2940.0, 3060.0]
[17.0, 18.0, 17.0]
[176, 167, 214]
p03254
u314188085
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()\nans = 0\n\nfor i in a:\n if x >= i:\n ans += 1\n x -= i\n else:\n break\n \nprint(ans)', 'N, x = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\n\na.sort()\nans = 0\n\nfor i in a:\n if x >= i:\n ans += 1\n x -= i\n else:\n x = 0\n break\n \nif x > 0:\n ans -=1\nprint(ans)']
['Wrong Answer', 'Accepted']
['s496609285', 's471108453']
[9180.0, 9124.0]
[28.0, 27.0]
[200, 236]
p03254
u315485238
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 = list(map(int, input().split()))\nA.sort()\n\nfrom itertools import accumulate\nAcumsum = list(accumulate(A))\n\ni=0\nwhile i<N:\n if Acumsum[i] <= x:\n i+=1\n else:\n break\n\nprint(i)', 'N, x = list(map(int, input().split()))\nA = list(map(int, input().split()))\nA.sort()\n\nfrom itertools import accumulate\nAcumsum = list(accumulate(A))\n\ni=0\nwhile i<N:\n if Acumsum[i] <= x:\n i+=1\n else:\n break\n\nif i==N and Acumsum[-1]!=x:\n print(N-1)\nelse:\n print(i)']
['Wrong Answer', 'Accepted']
['s373773382', 's971304559']
[3060.0, 3060.0]
[17.0, 17.0]
[222, 275]
p03254
u315703650
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)\nans = 0\ncnt = 0\nfor i in range(n):\n if a[i]<=x:\n x-=a[i]\n cnt += 1\nif x<0:\n cnt -= 1\nprint(max(0,cnt))', 'n,x = map(int,input().split())\na = list(map(int,input().split()))\na = sorted(a)\nans = 0\ncnt = 0\nfor i in range(n):\n if a[i]<=x:\n x-=a[i]\n cnt += 1\nif x!=0:\n cnt -= 1\nprint(min(0,cnt))', 'n,x = map(int,input().split())\na = list(map(int,input().split()))\na = sorted(a)\nans = 0\ncnt = 0\nfor i in range(n):\n if a[i]<=x:\n cnt += 1\n x-=a[i]\nif x>0:\n cnt -= 1\nprint(max(0,cnt))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s456857808', 's544705868', 's287136214']
[3060.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[202, 203, 198]
p03254
u317440328
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()\nj=1\nS=a[0]\nwhile (S<x)and(j<N-1):\n S=S+a[j]\n j=j+1\n\nif S==x:\n print(j)\nelif S>x:\n print(j-1)\nelse:\n print(j+1)', 'N, x=map(int,input().split())\na=[int(i) for i in input().split()]\na.sort()\nj=1\nS=a[0]\nwhile (S<x)and(j<N):\n S=S+a[j]\n j=j+1\n\nif S==x:\n print(j)\nelif S>x:\n print(j-1)\nelse:\n print(j)', 'N, x=map(int,input().split())\na=[int(i) for i in input().split()]\na.sort()\nj=1\nS=a[0]\nwhile (S<x)and(j<N):\n S=S+a[j]\n j=j+1\nif S==x:\n print(j)\nelse:\n print(j-1)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s360236577', 's864822797', 's365701920']
[3064.0, 3060.0, 3060.0]
[18.0, 18.0, 18.0]
[190, 186, 164]
p03254
u331997680
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\nfor i in range(N):\n if x < min(A):\n print(cnt)\n break\n elif i == N-1 and A[i]-x > 0:\n print(N-1)\n elif i == N-1 and A[i]-x == 0:\n print(N)\n else:\n x -= min(A)\n A.remove(min(A))\n cnt += 1\n', 'N, x = map(int, input().split())\nA = list(map(int, input().split()))\ncnt = 0\nfor i in range(len(A)):\n if x < min(A):\n print(cnt)\n break\n elif i == len(A)-1:\n print(cnt+1)\n else:\n x -= min(A)\n cnt += 1\n', 'N, x = map(int, input().split())\nA = list(map(int, input().split()))\ncnt = 0\nfor i in range(len(A)):\n if x < min(A):\n print(cnt)\n break\n else:\n x -= min(A)\n cnt += 1', 'N, x = map(int, input().split())\nA = list(map(int, input().split()))\ncnt = 0\nfor i in range(N):\n if x < min(A):\n print(cnt)\n break\n elif i == N-1 and A[i]-x > 0:\n print(N-1)\n elif i == N-1 and A[i]-x == 0:\n print(N)\n else:\n x -= min(A)\n A.remove(min(A))\n cnt += 1', 'N, x = map(int, input().split())\nA = list(map(int, input().split()))\ncnt = 0\nfor i in range(N):\n if x < min(A):\n print(cnt)\n break\n elif i == N-1:\n print(N)\n else:\n x -= min(A)\n A.remove(min(A))\n cnt += 1\n', 'N, x = map(int, input().split())\nA = list(map(int, input().split()))\ncnt = 0\nfor i in range(len(A)):\n if x < min(A):\n print(cnt)\n break\n else:\n x -= min(A)\n cnt += 1\nprint(cnt+1)', 'N, x = map(int, input().split())\nA = list(map(int, input().split()))\ncnt = 0\nfor i in range(N):\n if x < min(A):\n print(cnt)\n break\n elif i == N-1:\n print(cnt+1)\n else:\n x -= min(A)\n A.remove(min(A))\n cnt += 1', 'N, x = map(int, input().split())\nA = list(map(int, input().split()))\ncnt = 0\nfor i in range(N):\n if x < min(A):\n print(cnt)\n break\n elif i == N-1 and x-A[0] > 0:\n print(N-1)\n break\n elif i == N-1 and x-A[0] == 0:\n print(N)\n break\n else:\n x -= min(A)\n A.remove(min(A))\n cnt += 1']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s008883129', 's151179493', 's199704230', 's470353462', 's480343254', 's693295644', 's749161754', 's812294448']
[3060.0, 3060.0, 2940.0, 3064.0, 3060.0, 3060.0, 3064.0, 3064.0]
[19.0, 18.0, 18.0, 18.0, 17.0, 18.0, 18.0, 18.0]
[289, 219, 179, 288, 226, 192, 229, 308]
p03254
u333404917
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 = sorted(list(map(int, input().split())))\nif sum(l) <= x:\n print(n)\nelse:\n for i in range(n):\n if x <= l[i]:\n break\n x -= l[i]\n print(i)', 'n, x = map(int, input().split())\nl = sorted(list(map(int, input().split())))\nif sum(l) <= x:\n print(n)\nelse:\n for i in range(n):\n print(x)\n if x <= 0:\n break\n x -= l[i]\n print(i)', 'n, x = map(int, input().split())\nl = sorted(list(map(int, input().split())))\nfor i in range(n):\n print(x)\n if x <=0:\n break\n x -= l[i]\nprint(i+1)', 'n, x = map(int, input().split())\nl = sorted(list(map(int, input().split())))\nkids = 0\nans = 0\nfor i in range(n):\n print(kids, ans)\n kids += l[i]\n if kids <= x:\n ans += 1\n else:\n break\n\nif sum(l) >= x:\n print(ans)\nelse:\n print(ans - 1)', 'n, x = map(int, input().split())\nl = sorted(list(map(int, input().split())))\nif sum(l) <= x:\n print(n)\nelse:\n for i in range(n):\n print(x)\n if x <= 0:\n break\n x -= l[i]\n print(i+1)', 'n, x = map(int, input().split())\nl = sorted(list(map(int, input().split())))\nif sum(l) <= x:\n print(n)\nelse:\n for i in range(n):\n if x <= 0:\n break\n x -= l[i]\n print(i)', 'n, x = map(int, input().split())\nl = sorted(list(map(int, input().split())))\nkids = 0\nans = 0\nfor i in range(n):\n kids += l[i]\n if kids <= x:\n ans += 1\n else:\n break\n\nif sum(l) >= x:\n print(ans)\nelse:\n print(ans - 1)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s042231466', 's250675342', 's298681615', 's353376738', 's532689482', 's969282068', 's775825745']
[3060.0, 3060.0, 3060.0, 3060.0, 3060.0, 3064.0, 3060.0]
[17.0, 18.0, 17.0, 17.0, 17.0, 17.0, 17.0]
[205, 219, 161, 266, 221, 202, 245]
p03254
u334712262
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 -*-\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nfrom collections import Counter, defaultdict, deque\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, product, permutations\nfrom operator import add, mul, sub\n\nsys.setrecursionlimit(10000)\n\n\ndef read_int():\n return int(input())\n\n\ndef read_int_n():\n return list(map(int, input().split()))\n\n\ndef read_float():\n return float(input())\n\n\ndef read_float_n():\n return list(map(float, input().split()))\n\n\ndef read_str():\n return input().strip()\n\n\ndef read_str_n():\n return list(map(str, input().split()))\n\n\ndef error_print(*args):\n print(*args, file=sys.stderr)\n\n\ndef mt(f):\n import time\n\n def wrap(*args, **kwargs):\n s = time.time()\n ret = f(*args, **kwargs)\n e = time.time()\n\n error_print(e - s, 'sec')\n return ret\n\n return wrap\n\n\n@mt\ndef slv(N, x, A):\n A.sort()\n ans = 0\n for a in A:\n x -= a\n if x >= 0:\n ans += 1\n else:\n break\n return ans\n\n\ndef main():\n # N = read_int()\n N, x = read_int_n()\n A = read_int_n()\n print(slv(N, x, A))\n\n\nif __name__ == '__main__':\n main()\n", "# -*- coding: utf-8 -*-\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nfrom collections import Counter, defaultdict, deque\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, product, permutations\nfrom operator import add, mul, sub\n\nsys.setrecursionlimit(10000)\n\n\ndef read_int():\n return int(input())\n\n\ndef read_int_n():\n return list(map(int, input().split()))\n\n\ndef read_float():\n return float(input())\n\n\ndef read_float_n():\n return list(map(float, input().split()))\n\n\ndef read_str():\n return input().strip()\n\n\ndef read_str_n():\n return list(map(str, input().split()))\n\n\ndef error_print(*args):\n print(*args, file=sys.stderr)\n\n\ndef mt(f):\n import time\n\n def wrap(*args, **kwargs):\n s = time.time()\n ret = f(*args, **kwargs)\n e = time.time()\n\n error_print(e - s, 'sec')\n return ret\n\n return wrap\n\n\n@mt\ndef slv(N, x, A):\n A.sort()\n ans = 0\n for a in A:\n x -= a\n if x >= 0:\n ans += 1\n else:\n break\n else:\n if x != 0:\n ans -= 1\n return ans\n\n\ndef main():\n # N = read_int()\n N, x = read_int_n()\n A = read_int_n()\n print(slv(N, x, A))\n\n\nif __name__ == '__main__':\n main()\n"]
['Wrong Answer', 'Accepted']
['s816248664', 's860158251']
[8148.0, 7764.0]
[201.0, 269.0]
[1302, 1352]
p03254
u339199690
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()\ni = 0\n\nwhile i < n:\n x -= a[i]\n if (x < 0):\n break\n i += 1\n\nprint(i)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\ni = 0\nif (sum(a) < x):\n i = -1\nwhile i < n:\n x -= a[i]\n if (x < 0):\n break\n i += 1\n\nprint(i)']
['Wrong Answer', 'Accepted']
['s849831624', 's159423886']
[2940.0, 3060.0]
[17.0, 17.0]
[163, 190]
p03254
u341267151
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=sort(list(map(int,input().split())))\n\ns=0\nnum=0\nfor i in range(len(a)):\n if x>=a[i]:\n x-=a[i]\n num+=1\n else:\n break\n \nprint(num)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\n\ns = 0\nnum = 0\nfor i in range(len(a)):\n if x >= a[i]:\n x -= a[i]\n num += 1\n else:\n break\n\nprint(num)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\n\ns = 0\nnum = 0\nif x>sum(a):\n print(len(a)-1)\nelse:\n for i in range(len(a)):\n if x >= a[i]:\n x -= a[i]\n num += 1\n else:\n break\n\n print(num)\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s093199315', 's367546514', 's342032042']
[9132.0, 9172.0, 9172.0]
[26.0, 30.0, 30.0]
[173, 205, 257]
p03254
u347640436
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(e) for e in input().split()]\na.sort()\nresult = 0\nfor i in a:\n x -= i\n if x < 0:\n break\n result += 1\nprint(result)\n', 'n, x = map(int, input().split())\na = [int(e) for e in input().split()]\na.sort()\nresult = 0\nfor i in a:\n x -= i\n if x < 0:\n break\n result += 1\nif x != 0 and result == n:\n result -= 1\nprint(result)\n']
['Wrong Answer', 'Accepted']
['s416559497', 's793025386']
[2940.0, 3060.0]
[17.0, 17.0]
[162, 203]
p03254
u350248178
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=[int(i) for i in input().split()]\n\na.sort()\ni=0\nans=0\n\nwhile x>0 and i<n:\n if x-a[i]>=0:\n x-=a[i]\n ans+=1\n else:\n x=0\n i+=1\n\nprint(ans)', 'n,x=map(int,input().split())\n\na=[int(i) for i in input().split()]\n\na.sort()\ni=0\nans=0\n\nwhile x>0:\n if x-a[i]>=0:\n x-=a[i]\n ans+=1\n else:\n x=0\n i+=1\n\nprint(ans)', 'n,x=map(int,input().split())\n\na=[int(i) for i in input().split()]\n\na.sort()\ni=0\nans=0\n\nwhile x>0 and i<n:\n if x-a[i]>=0:\n x-=a[i]\n ans+=1\n else:\n x=0\n if i==n-1:\n if x>0:\n ans-=1\n i+=1\n\nprint(ans)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s089029716', 's196399439', 's414007072']
[3064.0, 3060.0, 3064.0]
[18.0, 18.0, 17.0]
[197, 189, 247]
p03254
u354527070
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()\npos = -1\nfor i in range(0, n):\n x -= a[i]\n if x < 0:\n pos = i\n break\nif pos == -1:\n print(n)\nelse:\n print(pos)', 'n, x = map(int, input().split(" "))\na = list(map(int, input().split(" ")))\na.sort()\npos = -1\nfor i in range(0, n):\n x -= a[i]\n if x < 0:\n pos = i\n break\nif pos == -1 and x > 0:\n print(n - 1)\nelif x == 0:\n print(n)\nelse:\n print(pos)']
['Wrong Answer', 'Accepted']
['s335096720', 's561456442']
[9116.0, 9196.0]
[26.0, 29.0]
[220, 260]
p03254
u354916249
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\n\na.sort()\n\nfor i in range(N):\n x -= a[i]\n if x < 0:\n print(ans)\n exit()\n else:\n ans += 1\n\nprint(N)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\nans = 0\n\na.sort()\n\nfor i in range(N):\n x -= a[i]\n if x >= 0:\n ans += 1\n\nif x>0:\n print(ans-1)\nelse:\n print(ans)']
['Wrong Answer', 'Accepted']
['s550161448', 's661288205']
[2940.0, 3060.0]
[17.0, 18.0]
[205, 199]
p03254
u363118893
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())\narr = list(map(int, input().split()))\n\narr.sort()\ncnt = 0\nfor ele in arr:\n if x < ele:\n break\n x -= ele\n cnt += 1\n\nprint(cnt)\n', 'N, x = map(int, input().split())\narr = list(map(int, input().split()))\n\narr.sort()\ncnt = 0\nfor ele in arr:\n if x < ele:\n break\n x -= ele\n cnt += 1\n\nprint(cnt)', 'N, x = map(int, input().split())\narr = list(map(int, input().split()))\n\narr.sort()\ncnt = 0\nfor ele in arr:\n if x < ele:\n break\n x -= ele\n cnt += 1\n\nif cnt = N and x > 0:\n cnt -= 1\n\nprint(cnt)', 'N, x = map(int, input().split())\narr = list(map(int, input().split()))\n\narr.sort()\ncnt = 0\nfor ele in arr:\n if x < ele:\n break\n x -= ele\n cnt += 1\n\nif cnt = N and x != 0:\n cnt -= 1\n\nprint(cnt)\n', 'N, x = map(int, input().split())\narr = list(map(int, input().split()))\n\narr.sort()\ncnt = 0\nfor ele in arr:\n if x < ele:\n if x != 0:\n cnt -= 1\n break\n x -= ele\n cnt += 1\n\nprint(cnt)\n', 'N, x = map(int, input().split())\narr = list(map(int, input().split()))\n\narr.sort()\ncnt = 0\nfor ele in arr:\n if x < ele:\n break\n x -= ele\n cnt += 1\n\nif cnt == N and x > 0:\n cnt -= 1\n\nprint(cnt)\n']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s024227687', 's032896394', 's115601588', 's780594621', 's840679655', 's029694614']
[3316.0, 2940.0, 3064.0, 2940.0, 2940.0, 3060.0]
[21.0, 17.0, 17.0, 17.0, 17.0, 17.0]
[175, 174, 210, 212, 215, 212]
p03254
u365375535
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())\na_sorted = sorted(a)\nsum = 0\nfor i in range(N):\n if sum > x:\n print(i - 1)\n break\n else:\n sum += a_sorted[i]\n if i == N-1:\n print(i -1)', 'N, x = map(int, input().split())\na = map(int, input().split())\na_sorted = sorted(a)\nif sum(a_sorted) <= x:\n print(N)\nelse:\n i = 0\n a_sum = 0\n while a_sum <= x:\n a_sum += a_sorted[i]\n i += 1\n print(i - 1)', 'N, x = map(int, input().split())\na = map(int, input().split())\na_sorted = sorted(a)\nif sum(a_sorted) == x:\n print(N)\nelif sum(a_sorted) <= x:\n print(N - 1)\nelse:\n i = 0\n a_sum = 0\n while a_sum <= x:\n a_sum += a_sorted[i]\n i += 1\n print(i - 1)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s173675828', 's359548293', 's872403497']
[3060.0, 3060.0, 3064.0]
[17.0, 17.0, 17.0]
[217, 214, 254]
p03254
u366886346
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=-1\nnum=0\nfor i in range(n):\n num+=a[i]\n if num>x:\n ans=i\n break\nif ans==-1:\n print(n)\nelse:\n print(ans)\n', 'n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nans=-1\nnum=0\nfor i in range(n):\n num+=a[i]\n if num>x:\n ans=i\n break\nif ans==-1:\n if num==x:\n print(n)\n else:\n print(n-1)\nelse:\n print(ans)\n']
['Wrong Answer', 'Accepted']
['s195625465', 's577238701']
[3060.0, 3060.0]
[17.0, 17.0]
[205, 253]
p03254
u367117210
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\tif x <= 0:\n\t\tbreak\n\tif x >= ai:\n\t\tx -= ai\n\t\tcount += 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\tif x >= 0 and x < ai:\n\t\tbreak\n\telse:\n\t\tx -= ai\n\t\tcount += 1\nelse:\n\tif x > 0:\n\t\tcount -= 1\n\nprint(count)']
['Wrong Answer', 'Accepted']
['s098326469', 's213396241']
[2940.0, 3060.0]
[19.0, 17.0]
[171, 206]
p03254
u367130284
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,b,*x=map(int,open(0).read().split())\nx=sorted(x)\ncount=0\nfor s in x:\n b-=s\n if b<0:\n break\n count+=1\nprint(count)', 'n,m,*a=map(int,open(0).read().split());b=sum(a);c=0\nfor i in sorted(a):\n b-=i\n c+=1\n if b<=0:\n print(c)\n exit()', 'a,b,*x=map(int,open(0).read().split())\nx=sorted(x)\ncount=0\nfor s in x:\n b-=s\n if b<0:\n break\n count+=1\nif b>0:\n print(count-1)\nelse:\n print(count)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s491001530', 's594013362', 's055661860']
[2940.0, 3064.0, 2940.0]
[18.0, 18.0, 17.0]
[131, 134, 168]
p03254
u368270116
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(key=int)\nans=0\nfor i in range(n):\n x=x-a[i]\n if x<0:\n x=x+a[i]\n else:\n ans+=1\nif ans==n:\n if (x-sum(a))>0:\n print(ans-1)\n else:\n print(ans)\nelse:\n print(ans)', 'n,x=map(int,input().split())\na=list(map(int,input().split()))\nar=a.sort(reverse=True,key=int)\nans=0\nfor i in range(n):\n x-=ar[i]\n if x<0:\n x+=ar[i]\n else:\n ans+=1\nprint(ans)\n ', 'n,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort(key=int)\nans=0\nfor i in range(n):\n x=x-a[i]\n if x<0:\n x=x+a[i]\n else:\n ans+=1\nif ans==n:\n if x>0:\n print(ans-1)\n else:\n print(ans)\nelse:\n print(ans)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s143656194', 's598111298', 's611840703']
[9188.0, 9176.0, 9188.0]
[27.0, 24.0, 31.0]
[258, 185, 249]
p03254
u368563078
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(' '))\nnum_list = list(map(int,input().split(' ')))\nnum_list_s = sorted(num_list)\ntotal = 0\nindex = 0\nfor i in range(N):\n total += num_list_s[i]\n if total > X:\n break\n else:\n index += 1\nif sum(num_list) < x:\n print(index-1)\nelse:\n print(index)", "N,X = map(int,input().split(' '))\nnum_list = list(map(int,input().split(' ')))\nnum_list_s = sorted(num_list)\ntotal = 0\nindex = 0\nfor i in range(N):\n total += num_list_s[i]\n if total > X:\n break\n else:\n index += 1\nprint(index)\n ", "N,X = map(int,input().split(' '))\nnum_list = list(map(int,input().split(' ')))\nnum_list_s = sorted(num_list)\nsum = 0\nindex = 0\nfor i in range(N):\n sum += num_list_s[i]\n if sum > X:\n break\n else:\n index += 1\nprint(index)\n ", "N,X = map(int,input().split(' '))\nnum_list = list(map(int,input().split(' ')))\nnum_list_s = sorted(num_list)\ntotal = 0\nindex = 0\nfor i in range(N):\n total += num_list_s[i]\n if total > X:\n break\n else:\n index += 1\nif sum(num_list) < X:\n print(index-1)\nelse:\n print(index)"]
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s076447265', 's222429748', 's780713311', 's602175253']
[3064.0, 2940.0, 3064.0, 3060.0]
[17.0, 17.0, 18.0, 18.0]
[299, 253, 247, 299]
p03254
u368796742
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 = sorted(list(map(int,input().split())))\n\nans = 0\nfor i in l:\n if i <= x:\n x -= i\n ans += 1\nprint(ans)', 'n,x = map(int,input().split())\nl = sorted(list(map(int,input().split())))\n\nans = 0\nfor i in l:\n if i <= x:\n x -= i\n ans += 1\nif ans == n and x > 0:\n print(ans-1)\nelse:\n print(ans)']
['Wrong Answer', 'Accepted']
['s325168075', 's089319418']
[2940.0, 3060.0]
[18.0, 17.0]
[152, 202]
p03254
u370429695
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 = list(map(int,input().split()))\nlist.sort(li)\ntotal = 0\nnum = 0\nfor i in range(n):\n if total + li[i] >= x:\n num = i + 1\n break\n elif i == n - 1:\n num = i + 1\n else:\n total += li[i]\nprint(num)\n', 'n,x = map(int,input().split())\nli = list(map(int,input().split()))\nlist.sort(li)\nnum = 0\nfor i in range(1,n+1):\n if sum(li[:i]) <= x:\n num = i\nif sum(li[:n+1]) < x:\n print(n-1)\nelse: \n print(num)\n']
['Wrong Answer', 'Accepted']
['s676064530', 's480485391']
[3060.0, 2940.0]
[17.0, 17.0]
[264, 212]
p03254
u371132735
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.
['# agc027_a.py\nn,x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\ncnt = 0\nfor i in a:\n if x>=i:\n cnt += 1\n x -= i\nprint(cnt)', '# agc027_a.py\nn,x = map(int,input().split())\na = list(map(int,input().split()))\nif sum(a) == x:\n print(n)\n exit()\n\na.sort()\ncnt = 0\nfor i in a:\n if x>=i:\n cnt += 1\n x -= i\nif cnt == n:\n cnt-=1\nprint(cnt)\n']
['Wrong Answer', 'Accepted']
['s016486098', 's904272484']
[2940.0, 3060.0]
[18.0, 17.0]
[164, 230]
p03254
u371409687
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\ncnt=0\nfor i in range(n):\n cnt+=a[i]\n if cnt<=x:\n ans+=1\n else:\n break\nprint(ans)', 'n,x=map(int,input().split())\na=sorted(list(map(int,input().split())))\nans=0\ncnt=0\nfor i in range(n):\n cnt+=a[i]\n if cnt<x:\n ans+=1\n else:\n break\nprint(ans)', 'n,x=map(int,input().split())\na=sorted(list(map(int,input().split())))\nans=0\ncnt=0\nfor i in range(n):\n cnt+=a[i]\n ans+=1\n if cnt>=x:\n break\nprint(ans)', 'import sys\nn,x=map(int,input().split())\na=sorted(list(map(int,input().split())))\nans=0\ncnt=0\nif x==sum(a):\n print(n)\n sys.exit()\nfor i in range(n):\n x-=a[i]\n if x<0:\n print(i)\n sys.exit()\nelse:\n print(n-1)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s033338940', 's348947993', 's887300204', 's668078539']
[3060.0, 3060.0, 3060.0, 3064.0]
[17.0, 17.0, 17.0, 17.0]
[179, 178, 165, 234]
p03254
u374240707
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.
['if __name__ == "__main__":\n N,x = list(map(int, input().split()))\n a = list(map(int, input().split()))\n A = 0\n\n a.sort()\n print(a)\n while x >= 0:\n if a[-1] < x:\n x -= a.pop(-1)\n A += 1\n else:\n break\n\n if x != 0:\n A -= 1\n print(A)\n', 'if __name__ == "__main__":\n n, x = map(int, input().split())\n aaa = list(map(int, input().split()))\n \n for a in sorted(aaa):\n if x < a:\n break\n ans += 1\n x -= a\n else:\n if x > 0:\n ans -= 1\n print(ans)', 'if __name__ == "__main__":\n n, x = map(int, input().split())\n aaa = list(map(int, input().split()))\n aaa.sort()\n ans = 0\n print(aaa)\n for a in aaa:\n if x < a:\n break\n ans += 1\n x -= a\n# else:\n# if x > 0:\n# ans -= 1\n print(ans)', 'if __name__ == "__main__":\n n, x = map(int, input().split())\n aaa = list(map(int, input().split()))\n ans = 0\n \n for a in sorted(aaa):\n if x < a:\n break\n ans += 1\n x -= a\n else:\n if x > 0:\n ans -= 1\n print(ans)']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s286284337', 's358451943', 's402958379', 's333151396']
[3060.0, 3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0, 17.0]
[308, 268, 303, 280]
p03254
u375616706
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.
['# python template for atcoder1\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\nN, x = map(int, input().split())\nA = list(map(int, input().split()))\n\nA = sorted(A, reverse=True)\n\nans = N\nsumA = sum(A)\nfor a in A:\n if sumA > x:\n sumA -= a\n ans -= 1\n else:\n break\nprint(ans)\n', 'import bisect\n\nN, x = (list)(map(int, input().split()))\nA = (list)(map(int, input().split()))\n\nA = sorted(A)\n\nfor i in range(len(A)-1):\n A[i+1] += A[i]\n\nans = 0\nind = bisect.bisect_right(A, x)\nif ind == 0:\n ans = 0\nelif ind >= N:\n if A[-1] == x:\n ans = N\n else:\n ans = N-1\nelse:\n ans = ind\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s989403010', 's786943309']
[3060.0, 3064.0]
[18.0, 18.0]
[319, 330]
p03254
u379424722
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())\nL = input().split()\n\nL = sorted(L)\n\ntotal = 0\ni = 0\nwhile M > 0 and i < N:\n M -= int(L[0])\n L.pop(0)\n total += 1\n i += 1\n\nprint(total)', 'N,M = map(int,input().split())\nL = map(int,input().split())\n\nL = sorted(L)\n\ntotal = 0\nfor i in range(N):\n if M - int(L[0]) >= 0:\n M -= int(L[0])\n total += 1\n L.pop(0)\n \nprint(total)', 'N,M = map(int,input().split())\nL = map(int,input().split())\n\nL = sorted(L)\n\ntotal = 0\ni = 0\nfor i in range(N):\n if M - int(L[0]) > 0:\n M -= int(L[0])\n total += 1\n L.pop(0)\n i += 1\n \nprint(total)', 'N,M = map(int,input().split())\nL = map(int,input().split())\n\nL = sorted(L)\n\ntotal = 0\nfor i in range(N):\n if M - int(L[0]) >= 0:\n M -= int(L[0])\n total += 1\n L.pop(0)\n \nprint(total)', 'N,M = map(int,input().split())\nL = map(int,input().split())\n\nL = sorted(L)\n\ntotal = 0\nfor i in range(N):\n if M - int(L[0]) >= 0:\n M -= int(L[0])\n total += 1\n L.pop(0)\n\nif total == N and not M == 0:\n total = N - 1\n \nprint(total)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s218300949', 's469129235', 's564901697', 's762284449', 's415124673']
[3064.0, 3060.0, 3064.0, 3060.0, 3064.0]
[17.0, 18.0, 18.0, 17.0, 18.0]
[177, 212, 232, 212, 261]
p03254
u380524497
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 = list(map(int, input().split()))\na_list.sort()\ngive = 0\ncount = 0\n\nfor num in a_list:\n give += num\n if give > x:\n break\n count += 1\n\nprint(count)\n', 'n, x = map(int, input().split())\n\na_list = list(map(int, input().split()))\na_list.sort()\ngive = 0\ncount = 0\n\nfor num in a_list:\n give += num\n if give == x:\n count += 1\n break\n if give > x:\n count -= 1\n count += 1\n\nif give < x:\n count -= 1\n\nprint(count)\n']
['Wrong Answer', 'Accepted']
['s746613334', 's975886664']
[2940.0, 3060.0]
[17.0, 17.0]
[204, 289]
p03254
u382303205
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 = sorted(a)\n\ncount = 0\n\nfor i in range(n):\n if a[i] <= x:\n x -= a[i]\n count += 1\n else:\n print(count)\n break', 'n,x = map(int,input().split())\na = list(map(int,input().split()))\n\na = sorted(a)\ncount = 0\n\nfor i in range(n):\n if a[i] <= x:\n x -= a[i]\n count += 1\n else:\n print(count)\n break', 'n,x = map(int,input().split())\na = list(map(int,input().split()))\n\na = sorted(a)\n\ncount = 0\n\nfor i in range(n - 1):\n if a[i] <= x:\n x -= a[i]\n count += 1\n else:\n break\n\nif a[-1] == x:\n count += 1\n\nprint(count)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s108688701', 's979422549', 's418186362']
[3060.0, 3060.0, 3060.0]
[17.0, 18.0, 17.0]
[211, 210, 239]
p03254
u382423941
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 = [0] * (n+1)\nfor i in range(n):\n s[i+1] = s[i] + a[i]\n\nans = 0\nfor i in range(n):\n if x >= s[i+1]:\n ans = i+1\nprint(ans)', 'n,x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\ns = [0] * (n+1)\nfor i in range(n):\n s[i+1] = s[i] + a[i]\n\nans = 0\nfor i in range(n):\n if x >= s[i+1]:\n ans = i+1\nif x > s[n]:\n ans -= 1\nprint(ans)']
['Wrong Answer', 'Accepted']
['s061724111', 's401528759']
[3060.0, 3064.0]
[17.0, 18.0]
[213, 239]
p03254
u384679440
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 = sorted(a, reverse = True)\nfor i in range(len(a)):\n\tif x >= a[i]:\n\t\tx -= a[i]\n\t\tans += 1\nprint(ans)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\nans = 0\na = sorted(a)\nfor i in range(len(a)):\n\tif x >= a[i]:\n\t\tx -= a[i]\n\t\tans += 1\nif x == 0:\n ans -= 1\nprint(ans)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\nans = 0\na = sorted(a)\nfor i in range(len(a)):\n\tif x >= a[i]:\n\t\tx -= a[i]\n\t\tans += 1\nprint(ans)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\nans = 0\na = sorted(a)\nfor i in range(len(a)):\n\tif x >= a[i]:\n\t\tx -= a[i]\n\t\tans += 1\n else:\n break\nprint(ans)\n', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\na = sorted(a)\nsum = 0\nans = 0\nfor i in range(len(a) - 1):\n sum += a[i]\n if s > x:\n break\n else:\n ans += 1\nsum += a[N-1]\nif sum == x:\n ans += 1\nprint(ans)\n', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\nans = 0\na = sorted(a)\nfor i in range(len(a)):\n\tif x >= a[i]:\n\t\tx -= a[i]\n\t\tans += 1\nif N != ans:\n ans -= 1\nprint(ans)\n', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\na = sorted(a)\nsum = 0\nans = 0\nfor i in range(len(a) - 1):\n sum += a[i]\n if sum > x:\n break\n else:\n ans += 1\nsum += a[N-1]\nif sum == x:\n ans += 1\nprint(ans)\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s384996766', 's584072069', 's738302914', 's842753685', 's864695716', 's997077273', 's265864709']
[3060.0, 3060.0, 3060.0, 2940.0, 3060.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0, 17.0, 18.0, 17.0, 17.0]
[179, 185, 163, 186, 249, 188, 251]
p03254
u385167811
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.
['temp = input().rstrip().split(" ")\nN = int(temp[0])\nX = int(temp[1])\nlist = input().rstrip().split(" ")\nlist.sort()\nprint(list)\nc = 0\nfor i in range(N):\n X = X - int(list[i])\n if X >= 0:\n c += 1\n else:\n break\nif X <= 0:\n print(c)\nelif X > 0:\n print(c-1)', 'N,x = map(int,input().split(" "))\na = input().split(" ")\na = [int(i) for i in a]\na = sorted(a)\nc = 0\nfor i in range(N):\n x -= a[i]\n if x >= 0:\n c += 1\nif x > 0:\n c -= 1\nprint(c)']
['Wrong Answer', 'Accepted']
['s555971849', 's106770458']
[3064.0, 3060.0]
[17.0, 18.0]
[281, 193]
p03254
u392029857
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())))\ncount = 0\nfor i in a:\n x -= i\n count += 1\n if x == 0:\n count += 1\n break\n elif x < 0:\n count -= 1\n break\nprint(count)', 'N, x = map(int, input().split())\na = sorted(list(map(int, input().split())))\ncount = 0\nfor i in a:\n x -= i\n count += 1\n if x == 0:\n break\n elif x < 0:\n count -= 1\n break\nprint(count)', 'N, x = map(int, input().split())\na = sorted(list(map(int, input().split())))\ncount = 0\nfor i in a:\n x -= i\n if x == 0:\n count += 1\n break\n elif x < 0:\n break\n else:\n count += 1\nprint(count)\n ', 'N, x = map(int, input().split())\na = sorted(list(map(int, input().split())))\ncount = 0\nfor i in range(N):\n x -= a[i]\n count += 1\n if x == 0:\n break\n elif x < 0:\n count -= 1\n break\n elif (i == (len(a) - 1)) and (x > 0):\n count -= 1\nprint(count)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s084744398', 's529567220', 's541193658', 's462915802']
[3060.0, 2940.0, 2940.0, 3060.0]
[18.0, 17.0, 17.0, 18.0]
[234, 215, 238, 286]
p03254
u394721319
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 = list(map(int,input().split()))\n\nli.sort()\nans = 0\n\nfor i in range(n):\n x = x-li[i]\n if x < 0:\n ans = i\n break\n ans = i+1\nprint(ans)\n', 'N,x = [int(i) for i in input().split()]\nA = [int(i) for i in input().split()]\n\nif x < min(A):\n print(0)\n exit()\n\nA.sort()\nans = 0\ni = 0\nwhile x > 0 and ans < N:\n if x >= A[i]:\n x -= A[i]\n ans += 1\n i += 1\n else:\n x = 0\n break\n\nif x > 0:\n ans -= 1\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s020695961', 's792253095']
[3060.0, 9128.0]
[17.0, 27.0]
[193, 309]
p03254
u404057606
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 = [int(i) for i in input().split()]\nn = nx[0]\nx = nx[1]\na = [int(i) for i in input().split()]\nb =list(sorted(a))\ns = 0\nans = 0\nfor i in range(n+1):\n if sum(b[:i])<=x:\n s = sum(b[:i])\n ans = i\nprint(ans)\n', 'nx = list(map(int,input().split()))\nn=nx[0]\nx=nx[1]\na=list(map(int,input().split()))\nb=sorted(a)\nans = 0\ng = 0\ni=0\nfor i in range(n):\n if g + b[i] <= x:\n ans = i + 1\n g = g + b[i]\n if i == n-1 and g != x:\n ans = ans-1\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s143503264', 's855405189']
[3060.0, 3060.0]
[18.0, 17.0]
[223, 264]
p03254
u405256066
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 sys import stdin\nN,x=[int(x) for x in stdin.readline().rstrip().split()]\ndata=[int(x) for x in stdin.readline().rstrip().split()]\ndata=sorted(data)\nans=0\nif data[0] < x:\n print(0)\nelse:\n for i in data:\n x=x-i\n if x <= 0:\n break\n ans+=1\n if x!=0 and ans !=1:\n ans-=1\n print(ans)', 'from sys import stdin\nN,x=[int(x) for x in stdin.readline().rstrip().split()]\ndata=[int(x) for x in stdin.readline().rstrip().split()]\ndata=sorted(data)\nans=0\nif data[0] > x:\n print(0)\nelse:\n for i in data:\n x=x-i\n if x < 0:\n break\n ans+=1\n if x > 0 and x!=0 and ans !=1:\n ans-=1\n print(ans)']
['Wrong Answer', 'Accepted']
['s048766828', 's281655440']
[3060.0, 3060.0]
[18.0, 17.0]
[333, 342]
p03254
u408620326
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(x) for x in input().strip().split()]\nan = sorted([int(a) for a in input().strip().split()])\ncumsum = 0\nfor i, a in enumerate(an, start=1):\n cumsum += a\n if cumsum > x:\n break\nelse:\n i += 1\nprint(i-1)', 'N, x = [int(x) for x in input().strip().split()]\nan = sorted([int(a) for a in input().strip().split()])\ncumsum = 0\nfor i, a in enumerate(an, start=1):\n cumsum += a\n if cumsum > x:\n break\nprint(i)', 'N, x = [int(x) for x in input().strip().split()]\nan = sorted([int(a) for a in input().strip().split()])\ncumsum = 0\nans = 0\nfor i, a in enumerate(an, start=1):\n cumsum += a\n if cumsum > x:\n break\n ans = i\nelse:\n if cumsum != x:\n ans -= 1\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s377953972', 's597794402', 's272908712']
[3060.0, 2940.0, 3064.0]
[17.0, 17.0, 17.0]
[217, 200, 257]