problem_id
stringclasses
100 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
6
806
p03254
s516060151
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 if x > 0 and ans > 0: ans -= 1 print(ans)
p03254
s323799738
Wrong Answer
# Problem A - Candy Distribution Again # input n, x = map(int, input().split()) a_list = list(map(int, input().split())) # initialization a_list = sorted(a_list) person_num = 0 # count process for i in range(len(a_list)): a = a_list[i] if x>=a: person_num += 1 x = x - a else: break # output print(person_num)
p03254
s183478981
Wrong Answer
n,x=map(int,input().split()) a=sorted(list(map(int,input().split()))) s=0 if a[0]>x: print(0) exit() if sum(a)<x: print(n-1) exit() for i in range(n): if s+a[i]<x: s+=a[i] else: print(i+1) exit()
p03254
s923981047
Wrong Answer
#22 N,x = map(int,input().split()) a = list(map(int,input().split())) cou =0 a.sort() for i in a: if i >x: break cou +=1 x -= i if x>0: for i in a: if x%i ==0: cou -=1 break while x > i: x-=i print(cou)
p03254
s984838518
Wrong Answer
N, x = map(int, input().split()) A = list(map(int, input().split())) ans = 0 sum = 0 A.sort() for i in range(N): sum += A[i] if sum <= x: ans += 1 else: break print(ans)
p03254
s380653812
Wrong Answer
n, x = map(int, input().split()) a = [int(x) for x in input().split()] a.sort() ans = 0 for i in range(n): if a[i] <= x: ans += 1 x -= a[i] else: break print(ans)
p03254
s533782486
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] else: break if x > 0 and res != 0: res -= 1 print(res)
p03254
s016486098
Wrong Answer
# agc027_a.py n,x = map(int,input().split()) a = list(map(int,input().split())) a.sort() cnt = 0 for i in a: if x>=i: cnt += 1 x -= i print(cnt)
p03254
s219300762
Wrong Answer
n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() count = 0 try: while x >= a[0]: x -= a.pop(0) count += 1 except IndexError: pass print(count)
p03254
s352588774
Wrong Answer
N, X = map(int, input().split()) la = sorted(list(map(int, input().split()))) if X < la[0]: print(0) elif X > sum(la): print(N-1) elif X == sum(la): print(N) else: j = 0 while X > 0: X = X - la[j] j += 1 print(j)
p03254
s949207886
Wrong Answer
n,x=map(int,input().split()) l=sorted(list(map(int,input().split()))) num=0 c=0 if l[0]==x: print(1) exit() else: for i in range(n): if num+l[i]>x: print(c) exit() else: num+=l[i] c+=1 print(c)
p03254
s383419318
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] >=0: ans += 1 x -= a[i] if x == 0: print(ans) else: print(max(0,ans-1))
p03254
s411941619
Wrong Answer
n,x=map(int,input().split()) a=sorted(list(map(int,input().split()))) c,i=0,0 while(i<n and x>0): if a[i]<=x: x-=a[i] c+=1 i+=1 else: break print(c)
p03254
s083310235
Wrong Answer
a,b=map(int,input().split()) L=list(map(int,input().split())) L=sorted(L) ans=0 if sum(L)<b: print(a-1) elif sum(L)==b: print(a) else: for i in range(a): ans+=L[i] if ans>=b: print(i+1) exit()
p03254
s033850679
Wrong Answer
n,x=map(int,input().split()) a=sorted(list(map(int,input().split()))) c,i=0,0 while(i<n and x>0): if a[i]<=x: x-=a[i] c+=1 i+=1 else: break if i==n-1 and x!=0: c-=1 print(c)
p03254
s780713311
Wrong Answer
N,X = map(int,input().split(' ')) num_list = list(map(int,input().split(' '))) num_list_s = sorted(num_list) sum = 0 index = 0 for i in range(N): sum += num_list_s[i] if sum > X: break else: index += 1 print(index)
p03254
s071508664
Wrong Answer
n, x= map(int, input().split()) a = list(map(int, input().split())) a.sort() wa = 0 cnt = 0 for i in a: wa += i cnt += 1 if wa > x: print(cnt - 1) exit() elif wa == x: print(n) exit() print(n)
p03254
s127572790
Wrong Answer
import sys sys.setrecursionlimit(10 ** 8) input = sys.stdin.readline def main(): N, X = [int(x) for x in input().split()] A = [int(x) for x in input().split()] A.sort() ans = 0 for a in A: if X >= a: ans += 1 X -= a if X != 0 and ans != 0: ans -= 1 print(ans) if __name__ == '__main__': main()
p03254
s714437152
Wrong Answer
a=list(map(int,input().split())) b=list(map(int,input().split())) x=a[0] y=a[1] b.sort() i=0 k=0 while i ==0: t=b[0] if y>=t: k=k+1 del b[0] else: i=1 if x==k: i=1 print(k)
p03254
s132996621
Wrong Answer
n, x = map(int, input().split()) a = sorted(list(map(int, input().split()))) if sum(a) < x: print(n-1) exit() if sum(a) == x: print(n) exit() idx = s = 0 while True: s += a[idx] if x == s: print(idx+1) exit() if x < s: print(max(0, idx-2)) exit()
p03254
s123892377
Wrong Answer
# A - Candy Distribution Again count = 0 N, x = map(int, input().split()) A = input().split() A.sort() A_i = [int(s) for s in A] for i in range(N-1): x -= A_i[i] if(x < 0): break count += 1 if(x == A_i[N-1]): count += 1 print(count)
p03254
s221396698
Wrong Answer
N, x = map(int,input().split()) a = sorted(list(map(int,input().split()))) if x > sum(a): print(N-1) elif x == sum(a): print(N) else: for i in range(N): if x < sum(a[:i]): print(i-1) break
p03254
s682698430
Wrong Answer
n,x = map(int,input().split()) a = sorted(map(int,input().split())) c=0 d=0 for i in a: if c<x: c+=i d+=1 else: if c>x: d-=1 print(d)
p03254
s516594453
Wrong Answer
n,x= map(int,input().split()) a = list(map(int,input().split())) a = sorted(a) s = 0 for i in range(n): s += a[i] if s > x: i -= 1 break if s != x: i -= 1 print(i+1)
p03254
s776691349
Wrong Answer
N,x=map(int, input().split()) A=list(map(int, input().split())) ans=0 A=sorted(A) for i in range(N): a=A[i] if x>=a: x-=a ans+=1 else: break if x>0 and i==N-1: ans-=1 print(ans)
p03254
s546037600
Wrong Answer
N, x = map(int, input().split()) a = list(map(int, input().split())) count = 0 for v in a: if v <= x and x >= 0: count +=1 x -= v if x > 0: count = count - 1 print(count)
p03254
s338055926
Wrong Answer
from itertools import accumulate import bisect N, x = map(int, input().split()) a = sorted(list(map(int, input().split()))) c = list(accumulate(a)) ans = bisect.bisect_left(c, x) if not ans: print(ans) else: print(ans if ans != N else ans - 1)
p03254
s725419373
Wrong Answer
N, x = map(int, input().split()) a = list(map(int, input().split())) cnt = 0 a.sort() for i in range(N): if a[i]<=x: x -= a[i] cnt += 1 else: break if x!=0: cnt -= 1 print(cnt)
p03254
s827246138
Wrong Answer
n, x = map(int, input().strip().split()) as_ = map(int, input().strip().split()) as_ = sorted(as_) cnt = 0 for a in as_: if x >= a: x -= a cnt += 1 else: break if x > 0 and cnt > 0: cnt -= 1 print(cnt)
p03254
s868841940
Wrong Answer
N,x = map(int,input().split()) a = list(map(int,input().split())) a.sort() count = 0 if x < a[0]: print(0) exit() for i in range(N): if x >= a[i]: x = x - a[i] count += 1 else: break if x > 0: print(count - 1) else: print(count)
p03254
s351814482
Wrong Answer
n,x=map(int,input().split()) a=list(map(int,input().split())) a.sort(reverse=True,key=int) ans=0 for i in range(n-1): x=x-a[i] if x<0: x=x+a[i] else: ans+=1 print(ans)
p03254
s214018294
Wrong Answer
N, x = map(int, input().split()) tmp = x A = list(map(int, input().split())) ans = 0 A.sort() for a in A: if x >= a: x -= a ans += 1 if x > sum(A): ans -= 1 print(ans)
p03254
s527097721
Wrong Answer
n, k =map(int,input().split()) data = list(map(int,input().split())) cnt = 0 for var in data: if var <= k: cnt += 1 k = k-var else: continue print(cnt)
p03254
s480558806
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 and i ==n-1: ans-=1 if ans < 0: ans =0 print(ans)
p03254
s196234817
Wrong Answer
n,x = map(int,input().split()) line = sorted(list(map(int,input().split()))) count = 0 if sum(line) < x: count = n - 1 else: for i in range(n): left = x - line[i] if left > 0: count += 1 elif left == 0: count += 1 break else: count -= 1 break print(count)
p03254
s226231056
Wrong Answer
n, x, *a = map(int, open(0).read().split()) a.sort() cnt = 0 for i in range(n): if x >= a[i]: x -= a[i] cnt += 1 else: break if x > 0: cnt -= 1 print(max(cnt,0))
p03254
s237670795
Wrong Answer
#22 N,x = map(int,input().split()) a = list(map(int,input().split())) cou =0 m = 0 a.sort() for i in a: if i >x: break cou +=1 x -= i if x>0: for i in a: if x%i ==0: cou -=1 break m = 0 while x > i: x-=i m+=1 if m !=0: cou -=1 print(cou)
p03254
s886515593
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: print(count-1)
p03254
s693946779
Wrong Answer
n, x = map(int, input().split()) a = list(map(int,input().split())) a.sort(reverse = True) total=0 ans=0 for i in range(n): total += a[i] if total > x: ans = i break ans = i+1 print(ans)
p03254
s188192337
Wrong Answer
N,x = map(int,input().split()) a = list(map(int,input().split())) a.sort() s = x cnt = 0 if sum(a) < s: print(N-1) if s >= a[0]: for i in range(N): if s >= a[i]: cnt += 1 s -= a[i] print(cnt)
p03254
s860096972
Wrong Answer
n, x = map(int, input().split()) A = list(map(int, input().split())) A.sort(reverse=True) ans = 0 for a in A: if x - a >= 0: x -= a ans += 1 if 0 < x: ans -= 1 print(max(ans, 0))
p03254
s920943795
Wrong Answer
N, x = map(int, input().split()) a = list(map(int, input().split())) i = 0 while len(a) > 0: if min(a) > x: break else: x -= min(a) a.remove(min(a)) i += 1 print(i)
p03254
s078094785
Wrong Answer
N, X = map(int, input().split()) lists = list(map(int, input().split())) count = 0 for num in sorted(lists): X -= num if X == 0 and num == lists[-1]: print(count + 1) exit() if X >= 0 and num != lists[-1]: if num == lists[-1] and X > 0: break count += 1 continue break print(count)
p03254
s991043288
Wrong Answer
N,x = map(int,input().split()) hito = input().split() poo = [hito] zyun = sorted(hito) ok = 0 for i in range(len(poo)): if x-int(zyun[i])>=0: ok+=1 else: print(ok)
p03254
s685649154
Wrong Answer
n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() if x < a[0]: print(0) exit() cnt = 0 for i in range(n): if a[i] <= x: cnt += 1 x -= a[i] if x > 0: print(cnt - 1) else: print(cnt)
p03254
s297738939
Wrong Answer
n,x = map(int,input().split()) s = list(map(int,input().split())) ans = 0 s.sort() if sum(s)==x: print(n) elif sum(s)<x: print(n-1) else: if s[0]>x: print(0) else: while x>0: ans += 1 x -= s[0] del s[0] print(ans)
p03254
s615449978
Wrong Answer
n, x= map(int, input().split()) a = list(map(int, input().split())) a.sort() wa = 0 cnt = 0 for i in a: wa += i cnt += 1 if wa > x: print(cnt - 1) exit() elif wa == x: print(cnt) exit() print(cnt)
p03254
s618851998
Wrong Answer
N,x = map(int,input().split()) a = list(map(int,input().split())) a.sort() s = x cnt = 0 if s >= a[0]: for i in range(N): if s >= a[i]: cnt += 1 s -= a[i] if (s > 0 and s <x): print(cnt - 1) else: print(cnt)
p03254
s078258501
Wrong Answer
N, x = map(int, input().split()) a = list(map(int, input().split())) if sum(a) == x: print(N) else: a.sort() ans = 0 for i in range(N-1): if a[i] <= x: ans += 1 x -= a[i] else: print(ans) break
p03254
s588630700
Wrong Answer
n,x = map(int,input().split()) a = list(map(int,input().split())) cnt = 0 a.sort() for i in range(n): if x - a[i] >= 0: cnt += 1 x -= a[i] if x != 0: cnt -= 1 print(min(0,cnt))
p03254
s531629703
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][0] print(k+1)
p03254
s353376738
Wrong Answer
n, x = map(int, input().split()) l = sorted(list(map(int, input().split()))) kids = 0 ans = 0 for i in range(n): print(kids, ans) kids += l[i] if kids <= x: ans += 1 else: break if sum(l) >= x: print(ans) else: print(ans - 1)
p03254
s179544719
Wrong Answer
n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() i = 0 while i < n: x -= a[i] if (x < 0): break i += 1 if (x != 0): i -= 1 print(i)
p03254
s269257387
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]: X=0 if X>0 and cnt>0: cnt-=1 print(cnt)
p03254
s778106511
Wrong Answer
n,x = map(int,input().split()) A = list(map(int,input().split())) A.sort() tank = 0 cnt = 0 for i in range(n): if tank + A[i] <= x: tank += A[i] cnt += 1 else: break if tank!=x: cnt = max(0, cnt-1) print(cnt)
p03254
s795612700
Wrong Answer
n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() count = 0 for i in a: if x >= min(a) or x >= i: x -= i count += 1 else: pass print(count)
p03254
s549197700
Wrong Answer
n, x = map(int, input().split()) lists = list(map(int, input().split())) lists.sort() count = 0 for i in lists: if x >= i: count += 1 x -= i else: break for i in lists: if x >= i: count -= 1 x -= i else: break print(count)
p03254
s829835123
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
s771319912
Wrong Answer
import sys input=sys.stdin.readline n,x=map(int,input().split()) L=sorted(list(map(int,input().split()))) cnt=0 for i in L: x-=i if n>=0: cnt+=1 else:break print(cnt)
p03254
s265330132
Wrong Answer
n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() count = 0 for i in a: if x >= min(a) and x >= i: x -= i count += 1 else: pass print(count)
p03254
s010657858
Wrong Answer
import sys readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines read = sys.stdin.buffer.read sys.setrecursionlimit(10 ** 7) N, x = map(int, input().split()) A = list(map(int, input().split())) A.sort() ans = 0 for a in A: x -= a if x >= 0: ans += 1 else: break if x and ans: ans -= 1 print(ans)
p03254
s929619289
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) break ans += 1
p03254
s827314774
Wrong Answer
N, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() count = 0 for i in a: if i == x and i == a[-1]: count += 1 elif i < x and i == a[-1]: break elif i <= x: count += 1 x -= i else: break print(count)
p03254
s140513443
Wrong Answer
N, x = map(int,input().split()) a = sorted(list(map(int,input().split()))) if x > sum(a): print(N-1) elif x == sum(a): print(N) else: for i in range(N): if x < sum(a[:i]): print(i) break
p03254
s582541031
Wrong Answer
a,b=map(int,input().split()) L=list(map(int,input().split())) L=sorted(L) for i in range(a): if b-L[i]<0: print(i) exit()
p03254
s041153556
Wrong Answer
N,x = map(int,input().split()) a = sorted([int(x) for x in input().split()]) ans = 0 if a[0] > x: print(0) exit() for i in a: if x-i >= 0: x -= i else: break ans += 1 print(ans if x == 0 else ans - 1)
p03254
s410133654
Wrong Answer
# AGC 027 A N,X =map(int,input().split()) A =[int(j) for j in input().split()] A.sort() cnt=0 for a in A: if X >=a: X-=a cnt+=1 if X !=0 and cnt>0: cnt-=1 print(cnt)
p03254
s831502775
Wrong Answer
import numpy as np n, x = map(int, input().split()) a = np.array(list(map(int, input().split()))) a = np.sort(a) a = a.cumsum() a = a[a <= x] print(len(a))
p03254
s456807154
Wrong Answer
N,x=map(int,input().split()) a=sorted(list(map(int,input().split()))) if sum(a)<x: print(N-1) else: ans=0 d=[0]*N for i in range(N): if x>=a[i]: x-=a[i] d[i]=1 ans=d.count(1) if x>0: print(max(ans-1,0)) else: print(ans)
p03254
s347800841
Wrong Answer
n,x = map(int,input().split()) a = list(map(int,input().split())) cnt = 0 a.sort() for i in range(n): if x - a[i] >= 0: cnt += 1 x -= a[i] if x != 0 and x > 0: cnt -= 1 print(max(0,cnt))
p03254
s086594870
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): for j in range(i, n): s = sum(nums[i:j + 1]) if s == x: ans = max(ans, j - i + 1) elif s < x: ans = max(ans, j - i) print(ans)
p03254
s585631207
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: pass if x != 0 and cnt != 0: cnt -= 1 else: pass print(cnt)
p03254
s850743132
Wrong Answer
N, x = map(int, input().split()) A = [int(i) for i in input().split()] sorted_A = sorted(A) i = 0 while i < N and x > 0: x -= sorted_A[i] i += 1 if x == 0: print(i) if x > 0: print(i-1)
p03254
s597504978
Wrong Answer
N,x = map(int,input().split()) a = list(map(int,input().split())) a.sort() s = x cnt = 0 if s > sum(a): print(N-1) elif (s >= a[0] and s <= sum(a)): for i in range(N): if s >= a[i]: cnt += 1 s -= a[i] print(cnt)
p03254
s199704230
Wrong Answer
N, x = map(int, input().split()) A = list(map(int, input().split())) cnt = 0 for i in range(len(A)): if x < min(A): print(cnt) break else: x -= min(A) cnt += 1
p03254
s935203416
Wrong Answer
N, X = map(int, input().split()) A = list(map(int, input().split())) A.sort() print(A) cnt=0 for i in range(N): if A[i]<=X: X-=A[i] cnt+=1 print(X) 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
s129139048
Wrong Answer
n,x=map(int,input().split()) A=sorted(list(map(int,input().split()))) for i in range(n): if x<A[i]: print(i) break x-=A[i] else:print(n)
p03254
s847144125
Wrong Answer
import sys input = sys.stdin.readline def main(): 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 else: break if i == N - 1 and x > 0: ans -= 1 print(ans) if __name__ == "__main__": main()
p03254
s299607089
Wrong Answer
n,x = map(int,input().split()) A = sorted(map(int,input().split())) ans = 0 for i in range(n): x -= A[i] ans += 1 if x <= 0: ans -= 0 break print(ans)
p03254
s406150249
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(i-1)
p03254
s921418976
Wrong Answer
n,x,*a=map(int, open(0).read().split()) a.sort() for i in range(n): x-=a[i] if x<0: print(~-i) exit() elif x==0: print(i) exit() print(n-1)
p03254
s286379108
Wrong Answer
N, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() ans = 0 for a in a: x -= a if x < 0: break elif x == 0: ans += 1 break ans += 1 if x != 0: ans -= 1 if ans < 0: ans = 0 print(ans)
p03254
s494683220
Wrong Answer
# -*- coding: utf-8 -*- #---------- n,x = list(map(int, input().rstrip().split())) a_list = list(map(int, input().rstrip().split())) #---------- a_list.sort() x_remain=x result = -1 for i in range(n): x_remain -= a_list[i] if x_remain < 0: result = i break if result == -1 : result = n print(result)
p03254
s630962264
Wrong Answer
N,n=map(int,input().split()) A=list(map(int,input().split())) A.sort() ans=0 i=0 while A[i]<=n: ans+=1 i+=1 if i==N: break print(ans)
p03254
s283089223
Wrong Answer
p_c,k_c=(int(x) for x in input().split()) al=list(map(int,input().split())) al.sort(reverse=True) count=0 for i in range(p_c): k_c=k_c-al[i] count+=1 print(count)
p03254
s895601827
Wrong Answer
N,x = map(int,input().split()) a = sorted(map(int,input().split()),reverse=False) ans = 0 for i in a: if x - i >= 0: x -= i ans += 1 if x > 0: ans -= 1 print(ans)
p03254
s807115359
Wrong Answer
def resolve(): n,x=map(int, input().split()) l=list(map(int, input().split())) l.sort() num=0 cnt=0 if x<l[0]: cnt=0 print(cnt) else: for i in range(n-1): if num<x: num+=l[i] cnt+=1 if x-num==l[n-1]: cnt+=1 print(cnt) resolve()
p03254
s291108434
Wrong Answer
N, x = map(int, input().split()) A = list(map(int, input().split())) A.sort() print(A) c = 0 for i in A: x -= i if x >= 0: c += 1 else: break if x > 0: c -= 1 print(c)
p03254
s954720594
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 if x > 0: ans -= 1 print(ans)
p03254
s590157731
Wrong Answer
def resolve(): n,x=map(int, input().split()) l=list(map(int, input().split())) l.sort() cnt=0 if l[0]>x: print(0) else: for i in range(n): if l[i]<=x: x-=l[i] cnt+=1 if x>0: cnt-=1 print(cnt) resolve()
p03254
s363024575
Wrong Answer
N, x = map(int, input().split()) array = list(map(int, input().split())) array = sorted(array, reverse=False) if sum(array) <= x: print(N) elif array[0] > x: print(0) for i in range (N): if sum(array[0:i]) >= x: print(i) break
p03254
s726264814
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: count += 1 x -= i else: break print(count)
p03254
s478233615
Wrong Answer
n, x = map(int, input().split()) a = list(map(int,input().split())) a.sort() total=0 ans=0 for i in range(n): total += a[i] if total > x: ans = i break ans = i+1 print(ans)
p03254
s322713446
Wrong Answer
n,x=map(int,input().split()) l1=list(map(int,input().split())) l1.sort() ans=0 while len(l1)>0: t1=l1.pop(0) if x>=t1: x-=t1 ans+=1 if ans>0 and x>0: ans-=1 print (ans)
p03254
s468334457
Wrong Answer
N, X = map(int, input().split()) A = sorted(list(map(int, input().split()))) l = [0]*N for i in range(N): if X >= A[i]: X -= A[i] l[i] = A[i] ans = 0 for i in range(N): if A[i] - l[i] == 0: ans += 1 if X != 0: ans -= 1 print(ans)
p03254
s496609285
Wrong Answer
N, x = [int(i) for i in input().split()] a = [int(i) for i in input().split()] a.sort() ans = 0 for i in a: if x >= i: ans += 1 x -= i else: break print(ans)
p03254
s161727312
Wrong Answer
N,x = map(int,input().split()) a = list(map(int,input().split())) a.sort() count = 0 total = 0 for i in range(N): if total <=x: count += 1 total += a[i] else: break if total < x: count -= 1 print(count)
p03254
s451809523
Wrong Answer
N, x = map(int,input().split()) A = list(map(int,input().split())) A.sort ans = 0 for i in range(len(A)): x = x-A[i] if x >= 0: ans += 1 else: break if x > 0: ans -= 1 print(ans)
p03254
s656964059
Wrong Answer
N,x = map(int,input().split()) a = list(map(int,input().split())) a = sorted(a) count = 0 while(x >= 0): if(count == N): break tmp = a.pop(0) if(x >= tmp): x = x - tmp count += 1 else: break print(str(count))
p03254
s535694867
Wrong Answer
n,x= map(int,input().split()) a = list(map(int,input().split())) a.sort() ans= 0 X=x for i in range(n): if 0 < X-a[i]: X = X-a[i] ans +=1 elif X ==0: break if ans == n and X >0 : ans -=1 print(ans)