problem_id
stringclasses
100 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
6
806
p03254
s216855649
Wrong Answer
N, X = map(int, input().split()) A = list(map(int, input().split())) A.sort() S = 0 ans = 0 for i in range(N): S += A[i] if S <= X: ans += 1 else: break if S > X: ans = N-1 print(ans)
p03254
s211327932
Wrong Answer
def main(): n, x = map(int, input().split()) num_list = list(map(int, input().split())) ans = 0 num_list.sort() for num in num_list: if x - num >= 0: x -= num ans += 1 else: break if x != 0: ans -= 1 print(ans) if __name__ == '__main__': main()
p03254
s443413983
Wrong Answer
N, x = [int(z) for z in input().split()] children = [int(z) for z in input().split()] children.sort() cnt = 0 for i in children: cnt += 1 if x - i < 0: break else: x -= i print(cnt)
p03254
s325376414
Wrong Answer
n,x = map(int,input().split()) a = sorted(map(int,input().split())) c=0 d=0 for i in a: if c+i<=x: c+=i d+=1 else: if 0<c<x: d-=1 print(d)
p03254
s229734160
Wrong Answer
import sys n,x=map(int,input().split()) N=list(map(int,input().split())) K=sorted(N,reverse=True) if sum(K)<x: print(n-1) sys.exit() if sum(K)==x: print(n) sys.exit() for i in range(1,n+1): if sum(K)-K[0]==x: print(n-i) sys.exit() if sum(K)-K[0]<x: print(n-i-1) sys.exit() else: K.pop(0)
p03254
s995671619
Wrong Answer
N,x = map(int,input().split()) a = list(map(int,input().split())) a.sort() count = 0 resid = x for i in range(N): if a[i] <=resid: count += 1 resid -= a[i] else: break if resid > 0: count -= 1 print(count)
p03254
s931290531
Wrong Answer
n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() ans = 0 i = 0 for i in a: if i > x: break else: x -= i ans += 1 if x != 0 and ans != 0: ans -= 1 print(ans)
p03254
s265740240
Wrong Answer
N,x = list(map(int,input().split())) A = list(sorted(list(map(int,input().split())))) for i in range(N,0,-1): if sum(A[:i]) == x: print(i) break elif sum(A[:i]) < x: print(i-1) break else: print(0)
p03254
s012615873
Wrong Answer
N, x = map(int,input().split()) a = list(map(int,input().split())) a.sort() count = 0 for i in range(N): x = x - a[i] if x >= 0: count += 1 print(count)
p03254
s451242990
Wrong Answer
N,x = map(int, input().split()) A = list(map(int, input().split())) A.sort() ans = 0 for i in range(N): if x > A[i]: ans += 1 x -= A[i] elif x == A[i]: print(ans+1) break elif i+1 == N: print(ans -1) break else: print(ans) break else: print(ans-1)
p03254
s345029512
Wrong Answer
N,X=map(int,input().split()) a=list(map(int,input().split())) a.sort() b=0 if X<min(a): print(0) else: for i in range(0,N): if X>=a[i]: X=X-a[i] b+=1 else: break if X!=0: print(b-1) else: print(b)
p03254
s031875609
Wrong Answer
#!/usr/bin/env python3 N, x = [int(x) for x in input().split(" ")] A = sorted([int(x) for x in input().split(" ")]) ans = 0 for a in A: if x < a: break ans += 1 x -= a if x > 0 and ans > 0: ans -= 1 print(ans)
p03254
s245226430
Wrong Answer
N, x = map(int,input().split()) a = sorted([int(i) for i in input().split()]) count = 0 if sum(a) == x: print(len(a)) else: for i in a: if x-i<0: break count+=1 if count == N: print(N-1) else: print(count)
p03254
s379805771
Wrong Answer
N,x = map(int,input().split()) hito = input().split() poo = [hito] zyun = sorted(hito) ok = 0 for i in range(len(hito)): if x-int(zyun[i])>=0: ok+=1 if ok == len(hito): print(ok) exit() else: print(ok) exit()
p03254
s314244670
Wrong Answer
#coding:utf-8 n, x = map(int, input().split()) a = list(map(int, input().split())) child = sorted(a) ans = 0 candy = 0 for i in range(n): candy += child[i] if candy == x: print(i+1) exit() elif candy > x: print(0) exit()
p03254
s626299942
Wrong Answer
N, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() count = 0 for i in a: if x - i >= 0: x -= i count += 1 if x > 0 and count != 0 and x > sum(a): count -= 1 print(count)
p03254
s815788547
Wrong Answer
N, X = map(int, input().split()) A = list(map(int, input().split())) A.sort() S = 0 ans = 0 for i in range(N): S += A[i] if S <= X: ans += 1 else: break print(ans)
p03254
s608471362
Wrong Answer
n,x=map(int,input().split()) a=list(map(int,input().split())) a.sort() ans=0 for i in range(n): if a[i]<=x: x=x-a[i] ans=ans+1 if x>0: ans=ans-1 print(ans)
p03254
s651447315
Wrong Answer
#Candy Distribution Again n,x = map(int, input().split()) s= list(map(int,input().split())) s.sort() s.reverse if s[0]>x: ans=1 else : ans=0 for i in s: x=x-i if x>=0: ans+=1 else : break if x>0: ans-=1 print(ans)
p03254
s345131128
Wrong Answer
n, x = map(int, input().split()) a = list(map(int, input().split())) a = sorted(a) ans = 0 for i in range(n): if x - a[i] >= 0: ans += 1 x = x - a[i] else: break if x > 0: ans -= 1 if ans < 0: ans = 0 print(ans)
p03254
s367983958
Wrong Answer
N,X = list(map(int, input().split())) a = list(map(int, input().split())) a = sorted(a) m = sum(a) count = 0 S=0 if m == X: print(N) elif m < X: print(N-1) elif a[0] > X: print(0) else: for i in a: if S < X: S = S + i count = count + 1 else: print(count-1)
p03254
s982693431
Wrong Answer
N, X = map(int, input().split()) lists = list(map(int, input().split())) if X - sum(lists) > 0: print(len(lists) - 1) exit() count = 0 for num in sorted(lists): X -= num if X >= 0: count += 1 if num == lists[-1]: break continue break print(count)
p03254
s568893847
Wrong Answer
n,x= map(int,input().split()) a = list(map(int,input().split())) a.sort() ans = 0 for i in range(n): if 0 <= x-a[i]: x = x-a[i] ans +=1 else: break print(ans)
p03254
s731694177
Wrong Answer
N, x = map(int, input().split()) a = sorted(map(int, input().split())) while sum(a) > x and len(a) != 1: a.pop(-1) print(len(a)) if sum(a) == x else print(len(a) - 1)
p03254
s079995346
Wrong Answer
N, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() count = 0 for i in a: if x - i >= 0: x -= i count += 1 if x > 0 and count != 0: count -= 1 print(count)
p03254
s816538624
Wrong Answer
N, x = [int(x) for x in input().split()] a = sorted([int(x) for x in input().split()]) ans = 0 if sum(a) == x: ans = N else: for i in range(N): if x >= a[i]: x -= a[i] ans += 1 print(ans)
p03254
s189724651
Wrong Answer
n,x= map(int,input().split()) a = list(map(int,input().split())) a.sort() ans = 0 for i in range(n): if 0 <= x-a[i]: x = x-a[i] ans +=1 print(ans)
p03254
s347099022
Wrong Answer
N, x = map(int, input().split()) a = list(map(int, input().split())) cont = 0 for y in sorted(a): if x >= y: cont += 1 x -= y if x > 0: cont = cont - 1 print(cont)
p03254
s956833501
Wrong Answer
N,x = map(int,input().split()) a = list(map(int,input().split())) count = 0 #ๆ˜‡้ †ใซไธฆในๆ›ฟใˆใ‚‹ sort_a = sorted(a) for i in range(len(a)): if x > sort_a[i] and x == sort_a[i]: count += 1 x -= sort_a[i] continue break print(count)
p03254
s708840930
Wrong Answer
# AGC 027: A โ€“ Candy Distribution Again n, x = [int(i) for i in input().split()] a = [int(i) for i in input().split()] a.sort() answer = 0 for i in range(n): if x - a[i] < 0: break answer += 1 x -= a[i] print(answer)
p03254
s777598205
Wrong Answer
n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() count = 0 for i in a: if x >= i: x -= i count += 1 else: break if x != 0: count -= 1 print(count)
p03254
s497168404
Wrong Answer
n, x = map(int, input().split()) a = list(map(int, input().split())) ans = 0 a = sorted(a) for i in range(n): if a[i] <= x: ans += 1 x -= a[i] if x <= 0: break if x > 0 and ans != 0: ans -= 1 print(ans)
p03254
s632487863
Wrong Answer
n,x = map(int, input().split()) A = sorted(list(map(int, input().split()))) ans = 0 if A[0] > x: print(ans) exit() for a in A: if a <= x: ans += 1 x -= a if x > 0: ans -= 1 print(ans)
p03254
s856083629
Wrong Answer
n, x = map(int,input().split()) a = list(map(int,input().split())) a = sorted(a) print(a) count = 0 for i in a: print(f"{i},{x}") if x - i >= 0: x -= i count += 1 else: break print(count) if x != 0: count -= 1 if count == n else 0 print(count)
p03254
s061392373
Wrong Answer
n,x = map(int,input().split()) s = list(map(int,input().split())) ans = 1 s.sort() if sum(s)==x: print(n) elif sum(s)<x: print(n-1) else: if s[0]>x: print(0) else: for i in s: x -= i if x<=0: break else: ans += 1 print(ans)
p03254
s138007867
Wrong Answer
N,x = map(int, input().split()) a = list(map(int, input().split())) a.sort() for i in range(N): x -= a[i] if x < 0: print(i+1) exit() print(N)
p03254
s282788821
Wrong Answer
n,x=map(int,input().split()) a=sorted([int(i)for i in input().split()]) isHappy=[False for i in range(n)] res=0 for i in range(n): if x>=a[i]: isHappy[i]=True x-=a[i] else: break res=isHappy.count(True) if x != 0:res-=1 print(max(0,res))
p03254
s342226425
Wrong Answer
n,x=[int(x) for x in input().split()] a=[int(x) for x in input().split()] a.sort() ans=n s=0 for i in range(n): if s>x: ans=i-1 break else: s=s+a[i] if s<x: print(ans-1) else: print(ans)
p03254
s321786704
Wrong Answer
N,x = map(int,input().split()) a = list(map(int,input().split())) a = sorted(a, reverse = False) count = 0 if sum(a) < x: count = N -1 else: for i in a: x -= i if x < 0: count -=1 break elif x == 0: count += 1 break count+=1 if count < 0: count = 0 print(count)
p03254
s749161754
Wrong Answer
N, x = map(int, input().split()) A = list(map(int, input().split())) cnt = 0 for i in range(N): if x < min(A): print(cnt) break elif i == N-1: print(cnt+1) else: x -= min(A) A.remove(min(A)) cnt += 1
p03254
s492239911
Wrong Answer
# https://atcoder.jp/contests/agc027/tasks/agc027_a n, x = map(int, input().split()) nums = [int(i) for i in input().split()] nums.sort() ans = 0 for i in range(n + 1): s = sum(nums[:i]) if s == x: ans = max(ans, i) elif s < x: ans = max(ans, i - 1) print(ans) # ใชใ‚“ใ‹้€ฃ็ถšใ™ใ‚‹ใ“ใฉใ‚‚ใซใชใฃใฆใ„ใŸ
p03254
s471078169
Wrong Answer
from sys import stdin nii=lambda:map(int,stdin.readline().split()) lnii=lambda:list(map(int,stdin.readline().split())) n,x=nii() a=lnii() a.sort() a_sum=0 for i in range(n): a_sum+=a[i] if a_sum>x: print(i) exit() print(n)
p03254
s205522999
Wrong Answer
N,x=input().split() X=int(x) n=int(N) y=0 A = [int(i) for i in input().split()] A.sort() for z in range(n): y+=A[z] if y>=X: break print(z+1) else: print(n-1)
p03254
s939565950
Wrong Answer
N, x = map(int, input().split()) a = list(map(int, input().split())) cont = 0 for i in sorted(a): x -= i if x >= 0: cont += 1 if x != 0: cont -= 1 print(cont)
p03254
s099322784
Wrong Answer
n, x = map(int,input().split()) children = list(map(int,input().split())) children.sort() count=0 c = 0 if x < children[0]: print(0) exit() for i in range(n): count += children[i] c += 1 if count >= x: print(c) exit() print(n-1)
p03254
s811311097
Wrong Answer
n,x = tuple(map(int,input().split())) a = tuple(map(int,input().split())) a = sorted(a) ans=0 for a_i in a: x -= a_i if x<0: break else: ans+=1 print(ans)
p03254
s393608762
Wrong Answer
n,x=map(int,input().split()) l=sorted(list(map(int,input().split()))) if sum(l)>x:print(n-1);exit() d=[] now=0 for i in l: now+=i;d.append(now) from bisect import bisect_left as bl,bisect_right as br print(bl(d,x))
p03254
s506364044
Wrong Answer
N, x = map(int, input().split()) A = [int(i) for i in input().split()] A.sort() ans = [] for i in A: ans.append(i) x -= i #print(ans, x) if x <= 0: break if x > 0: print(len(ans)-1) else: print(len(ans))
p03254
s769714784
Wrong Answer
n,x = map(int,input().split()) a = list(map(int,input().split())) a.sort() ans = 0 X = x for A in a: if x < A: break x -= A ans += 1 if sum(a)!=X: ans = ans - 1 print(ans)
p03254
s554215660
Wrong Answer
n, x = map(int, input().split()) arr = list(map(int, input().split())) arr.sort() ans = 0 for consume_v in arr: if x >= consume_v: x -= consume_v ans += 1 elif x > 0 and ans > 0: ans -= 1 else: break print(ans)
p03254
s189009459
Wrong Answer
n, x = map(int, input().split()) A = list(map(int, input().split())) A.sort() count = 0 for i in range(n): if A[i] <= x: count += 1 x -= A[i] print(count)
p03254
s972129437
Wrong Answer
N,x = map(int,input().split()) a = list(map(int,input().split())) a = sorted(a, reverse = False) count = 0 if sum(a) < x: count = N -1 else: for i in a: x -= i if x < 0: count -=1 break elif x == 0: count += 1 break elif x > 0: count+=1 if count < 0: count = 0 print(count)
p03254
s651017251
Wrong Answer
n,x = map(int,input().split()) A= list(map(int,input().split())) A.sort() a_sum=0 for i in range(n): a_sum+= A[i] if x<a_sum: print(i) exit() if a_sum== sum(A): print(n) else: print(n-1)
p03254
s770924808
Wrong Answer
def main(): n, x = map(int, input().split()) A = list(map(int, input().split())) A_sorted = sorted(A) res = 0 for kids in A_sorted: if x - kids >= 0: x = x - kids res += 1 if x > 0 and res != 0: print(res - 1) else: print(res) if __name__ == '__main__': main()
p03254
s568547756
Wrong Answer
N, x = map(int, input().split()) A = sorted(list(map(int, input().split()))) S = [0] for i in range(N): S.append(S[i] + A[i]) # print(S) l = -1 r = N+1 while r - l > 1: m = l + (r-l)//2 if S[m] > x: r = m else: l = m print(l - (S[l] != x))
p03254
s279571233
Wrong Answer
n, x = map(int, input().split()) arr = list(map(int, input().split())) arr.sort() ans = 0 for i in arr: x -= i if x < 0: break else: ans += 1 if x > 0 and ans > 0: ans -= 1 print(ans)
p03254
s396557303
Wrong Answer
import itertools import bisect N,x = map(int,input().split()) A = list(map(int,input().split())) A.sort() cumsum = list(itertools.accumulate(A)) ans = bisect.bisect_right(cumsum,x) print(ans)
p03254
s162337427
Wrong Answer
N, x=map(int, input().split()) a=list(map(int, input().split())) a.sort() i=0 while i<N and x>=a[i]: x-=a[i] i+=1 if x>0 and i>0: i-=1 print(i)
p03254
s640146021
Wrong Answer
N,x=map(int,input().split()) C=sorted(list(map(int,input().split()))) num=0 if sum(C)==x: print(N) exit() elif sum(C)>x: print(N-1) exit() for i in range(N): if C[i]>x: print(i) exit() else: x-=C[i]
p03254
s203224525
Wrong Answer
N,x = [int(hoge) for hoge in input().split()] A = [int(hoge) for hoge in input().split()] #xๅ€‹ใฎใŠ่“ๅญใ‚’้…ใ‚‹ใ€‚ #ๅ’ŒใŒxใ‚’่ถŠใˆใชใ„ใ‚ˆใ†ใซๆœ€ใ‚‚ๅคšใ„ๆ•ฐใฎaใ‚’้ธใถ A.sort() ans = 0 cur = 0 for a in A: cur += a if cur > x: print(ans) exit() ans += 1 print(ans-1)
p03254
s520266816
Wrong Answer
n, x = list(map(int, input().split(' '))) ss = list(map(int, input().split(' '))) r = x count = 0 for s in sorted(ss): if r - s < 0: break else: r -= s count += 1 if r > 0 and count > 0: count -= 1 print(count)
p03254
s789681515
Wrong Answer
n, x = map(int, input().split()) res = 0 dat = list(map(int, input().split())) dat.sort() for i in range(n): if x >= dat[i]: res += 1 x -= dat[i] if x > 0 and res != 0: res -= 1 print(res)
p03254
s204539115
Wrong Answer
N,x=map(int,input().split()) a=sorted(map(int,input().split())) c=0 while x>0 and c<=N-1: if x-a[c]>=0: x-=a[c] c+=1 else: break if x>0 and c>0: c-=1 print(c)
p03254
s353151481
Wrong Answer
# agc027_a.py n,x = map(int,input().split()) a = list(map(int,input().split())) if sum(a) == x: print(n) exit() a.sort() cnt = 0 for i in a: if x>=i: cnt += 1 x -= i print(cnt-1)
p03254
s745906107
Wrong Answer
n,x = map(int,input().split()) a_list = list(map(int,input().split())) a_list.sort() count = 0 for i in range(n): if a_list[i] <= x: count += 1 x = x-a_list[i] else: break if x == 0: print(count) else: if count == 0: print(0) else: print(count-1)
p03254
s810634996
Wrong Answer
import sys input = sys.stdin.readline N,X=map(int,input().split()) vA=list(map(int,input().split())) vA.sort() res=0 for a in vA: if a<=X: res += 1 X -= a else: break if X: res = max(0, res-1) print(res)
p03254
s982641688
Wrong Answer
import math import sys n, x = map(int, input().split()) a = [int(val) for val in input().split()] sort = sorted(a) ans = 0 for i in range(n - 1): x -= sort[i] if x >= 0: ans += 1 if x == a[n-1]: ans += 1 print(ans)
p03254
s746361310
Wrong Answer
n,x=map(int,input().split()) a=list(map(int,input().split())) a.sort() cnt=0 for i in range(n): if a[i]<=x: x-=a[i] cnt+=1 else: break print(cnt)
p03254
s362388877
Wrong Answer
n,x=map(int,input().split()) a=list(map(int,input().split())) a.sort() s=0 i=0 if sum(a)<=x: print(n) exit() elif min(a)>x: print(0) exit() else: while s<=x: s+=a[i] i+=1 print(s) print(i-1)
p03254
s203158406
Wrong Answer
n,x=map(int,input().split()) A=sorted(list(map(int,input().split()))) num=0 for i in range(n): if x<A[i]: print(i) break else:print(n)
p03254
s891042821
Wrong Answer
N , X = map(int, input().split()) A = list(map(int, input().split())) A.sort() A = [0] + A for i in range(N): A[i+1] = A[i]+A[i+1] if A[i+1]>X: break print(i)
p03254
s691309366
Wrong Answer
n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() count = 0 for i in a: if x >= i: x -= i count += 1 else: pass if x != 0: count -= 1 print(count)
p03254
s348904455
Wrong Answer
n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() ans = 0 for i in range(n): if a[i] <= x: x -= a[i] ans += 1 if x != 0: ans = max(0, ans - 1) print(ans)
p03254
s299911651
Wrong Answer
n, x = map(int, input().split()) a = list(map(int, input().split())) a = sorted(a) ans = 0 for i in range(n): if x - a[i] >= 0: ans += 1 x = x - a[i] else: break if x > 0 and ans != 0: ans -= 1 print(ans)
p03254
s688305037
Wrong Answer
N, x = map(int, input().split()) A = sorted(list(map(int, input().split()))) S = 0 ans = 0 for a in A: if S + a > x: break else: S += a ans += 1 print(ans - (S != x))
p03254
s834454484
Wrong Answer
from itertools import accumulate from bisect import bisect_right N, x, *A = map(int, open(0).read().split()) A.sort() S = list(accumulate(A)) if S[-1] == x: print(N) else: print(min(N - 1, bisect_right(A, x)))
p03254
s404579384
Wrong Answer
N, x = map(int, input().split()) a = sorted(list(map(int, input().split()))) cnt = 0 for i in range(N): if x >= a[i]: cnt += 1 x -= a[i] else: break if x != 0 and cnt != 0: cnt -= 1 else: pass print(cnt)
p03254
s218931849
Wrong Answer
N,x = map(int,input().split()) a = list(map(int, input().split())) a.sort() s = 0 counter = 0 for i in range(N): if i != N-1: if s < x: s += a[i] counter += 1 else: break else: if x - s == a[i]: counter += 1 else: break print(counter)
p03254
s264063422
Wrong Answer
N, x = list(map(int, input().split())) A = list(map(int, input().split())) #print(N, x) A.sort() #print(A) cnt = 0 for a in A: if x >= a: x -= a cnt += 1 else: break print(cnt)
p03254
s179168444
Wrong Answer
# https://atcoder.jp/contests/agc027/tasks/agc027_a n, x = map(int, input().split()) nums = [int(i) for i in input().split()] nums.sort() ans = 0 for i in range(n + 1): s = sum(nums[:i]) if s <= x: ans = max(ans, i) print(ans)
p03254
s195625465
Wrong Answer
n,x=map(int,input().split()) a=list(map(int,input().split())) a.sort() ans=-1 num=0 for i in range(n): num+=a[i] if num>x: ans=i break if ans==-1: print(n) else: print(ans)
p03254
s505509517
Wrong Answer
import bisect,collections,copy,itertools,math,numpy,string def I(): return int(input()) def S(): return input() def LI(): return list(map(int,input().split())) def LS(): return list(input().split()) ################################################## N,x = LI() a = LI() ans = 0 a.sort() for y in a: if x>=y: x -= y ans += 1 else: break print(ans)
p03254
s075542611
Wrong Answer
from bisect import bisect_left from itertools import accumulate N, x = map(int, input().split()) a = list(accumulate(sorted(map(int, input().split())))) if x in a: print(bisect_left(a, x) + 1) else: print(bisect_left(a, x) - 1)
p03254
s804491451
Wrong Answer
N, x = map(int, input().split()) A = sorted(list(map(int, input().split()))) S = [0] for i in range(N): S.append(S[i] + A[i]) # print(S) l = -1 r = N+1 while r - l > 1: m = l + (r-l)//2 if S[m] > x: r = m else: l = m print(l if S[l] == x else max(0, l-1))
p03254
s127385778
Wrong Answer
N,x = map(int,input().split()) a=list(map(int,input().split())) a.sort() ans=0 for i in range(N): if x >= a[i]: ans+=1 x-=a[i] else: break if x != 0: ans -= 1 print(max(0,ans))
p03254
s081104883
Wrong Answer
n , x = map(int,input().split()) a = list(map(int,input().split())) a.sort() cou = 0 for i in range(n): cou += a[i] if cou > x: print(i) exit() print(n)
p03254
s216849451
Wrong Answer
N, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() ans = 0 for ai in a: if x - ai < 0: break x -= ai ans += 1 print(ans)
p03254
s328642151
Wrong Answer
n, x = map(int, input().split()) a = [int(_) for _ in input().split()] a.sort() ans = 0 for i in a: if x < i: break x -= i ans += 1 if x > 0 and ans != 0: ans -= 1 print(ans)
p03254
s849984440
Wrong Answer
N, x = map(int, input().split()) a_li = list(map(int, input().split())) a_li.sort() ans = 0 for a in a_li : if x >= a : ans += 1 x -= a else : break if x != 0 : ans -= 1 print(max(0, ans))
p03254
s659815452
Wrong Answer
n, x = map(int, input().split()) nums = sorted(list(map(int, input().split()))) count = 0 for i, num in enumerate(nums): if num <= x: if i != nums.index(num): count += 1 x -= num else: if num == x: count += 1 x -= num else: break print(count)
p03254
s277740164
Wrong Answer
from bisect import bisect_left from itertools import accumulate N, x = map(int, input().split()) a = list(accumulate(sorted(map(int, input().split())))) if x in a: print(bisect_left(a, x) + 1) else: print(max(0, bisect_left(a, x) - 1))
p03254
s969736090
Wrong Answer
#22 N,x = map(int,input().split()) a = list(map(int,input().split())) a.sort() if sum(a) ==x: print(N) else: for i in range(N): if sum(a[0:i+1]) >x: print(i) break
p03254
s726655380
Wrong Answer
N, X = map(int, input().split()) A = list(map(int, input().split())) A.sort() cnt=0 for i in range(N): if A[i]<=X: X-=A[i] cnt+=1 else: for j in range(i): if A[j]+X==A[i]: cnt+=1 X=0 if X>0 and cnt>0: cnt-=1 print(cnt)
p03254
s020120246
Wrong Answer
n, k =map(int,input().split()) data = list(map(int,input().split())) data = sorted(data) cnt = 0 for var in data: if var < k: cnt += 1 k = k-var else: continue print(cnt)
p03254
s363690893
Wrong Answer
n,x=map(int,input().split()) l=sorted(list(map(int,input().split()))) d=[] now=0 for i in l: now+=i;d.append(now) from bisect import bisect_left as bl,bisect_right as br print(max(0,br(d,x)-1+(sum(l)==x)))
p03254
s853165668
Wrong Answer
N,x = map(int,input().split()) a = list(map(int,input().split())) a.sort() c = 0 rx = x for i in range(N): if a[i] > rx: print(c) exit() print(N)
p03254
s764490898
Wrong Answer
import sys N, x = map(int, input().split()) a = sorted(map(int, input().split())) ans = 0 score_x = x for i in range(N): if score_x < a[i]: print(0) sys.exit() elif score_x >= a[i]: score_x = (score_x - a[i]) ans = ans + 1 print(ans)
p03254
s777271208
Wrong Answer
n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() count = 0 for i in a: if x-i>=0: x -= i count += 1 if count != n and x!=0: print(count) else: print(n-1)
p03254
s105942393
Wrong Answer
N, x = map(int, input().split()) A = list(map(int, input().split())) ans = 0 A.sort() for a in A: if x >= a: x -= a ans += 1 print(ans)
p03254
s269639576
Wrong Answer
import numpy as np N, x = map(int, input().split()) A = sorted(list(map(int, input().split()))) if sum(A) == x: print(N) elif sum(A) < x: print(N-1) else: cum = np.cumsum(A) if cum[0] > x: print(0) else: k = np.where(cum <= x)[0] print(k+1)