problem_id stringclasses 100
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 6 806 |
|---|---|---|---|
p03254 | s387047192 | Wrong Answer | N, x = map(int, input().split())
a = sorted(map(int, input().split()))
cnt = 0
for i in range(N):
if a[i] <= x:
cnt += 1
x -= a[i]
else:
break
if x > 0:
cnt -= 1
print(cnt) |
p03254 | s370245494 | 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 | s062688338 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=False)
count = 0
for i in a:
if x>=i:
count += 1
x -= i
else:
break
print(count) |
p03254 | s448159481 | Wrong Answer | N, x = map(int, input().split())
A = sorted(map(int, input().split()))
if sum(A) == x:
print(x)
else:
c = 0
for ai in A:
x -= ai
if x <= 0:
break
c += 1
print(c + 1 if x == 0 else c) |
p03254 | s834460105 | Wrong Answer | import sys
input = sys.stdin.readline
def main():
N, x = map(int, input().split())
a_list = list(map(int, input().split()))
for i, a in enumerate(sorted(a_list), start=1):
x -= a
if x < 0:
break
if x >= 0:
print(i)
else:
print(i-1)
if __name__ == '__main__':
main() |
p03254 | s367546514 | Wrong Answer | n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
s = 0
num = 0
for i in range(len(a)):
if x >= a[i]:
x -= a[i]
num += 1
else:
break
print(num) |
p03254 | s454033477 | 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
print(count)
|
p03254 | s244946516 | 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:
ans+=1
else:
print(ans)
break |
p03254 | s011766308 | 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) |
p03254 | s138218793 | Wrong Answer | N,x=map(int, input().split())
A=sorted(list(map(int, input().split())))
cnt=0
for i in A:
if x >= i:
x -= i
cnt+=1
else:
break
print(cnt)
|
p03254 | s367074734 | Wrong Answer | N, x = [int(i) for i in input().split(" ")]
lst = [int(i) for i in input().split(" ")]
lst.sort(reverse = True)
cnt = 0
for i in range(0,N):
if x >= lst[i]:
x -= lst[i]
cnt += 1
else:
break
print(cnt)
|
p03254 | s025459605 | Wrong Answer | n,x=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
s=0
i=0
if n==0:
print(0)
exit()
elif 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 | s365798867 | Wrong Answer | N, x = map(int, input().split())
a = sorted(map(int, input().split()))
cnt = 0
for i in range(N):
if a[i] < x:
cnt += 1
x -= a[i]
else:
break
if x > 0:
cnt -= 1
print(cnt) |
p03254 | s472703698 | Wrong Answer | N,X = list(map(int,input().split()))
A = list(map(int,input().split()))
A.sort()
count = 0
for i in A:
if X >= i:
X = X - i
count += 1
print(X)
else:
break
if X > 0:
count -= 1
print(max(count,0)) |
p03254 | s684405874 | 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
print(count)
|
p03254 | s241290633 | 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
print(count) |
p03254 | s086005219 | 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
print(res)
if __name__ == '__main__':
main() |
p03254 | s787056567 | 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
|
p03254 | s220569799 | 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]:
count += 1
x -= sort_a[i]
continue
else:
continue
break
print(count) |
p03254 | s949325774 | 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 ans>0 and x>0:
ans=ans-1
print(ans)
|
p03254 | s528756896 | Wrong Answer | from itertools import accumulate
N, X = [int(x) for x in input().split()]
a = sorted([int(x) for x in input().split()])
p = list(accumulate(a))
result = 0
break_idx = 0
for i, x in enumerate(p):
if X < x:
break_idx = i
break
result += 1
if result != 0 and p[break_idx-1] != X:
result -= 1
print(result) |
p03254 | s874487901 | Wrong Answer | def main():
N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
if sum(a) <= x:
print(N)
return
for i in range(N):
x -= a[i]
if x < 0:
break
ans = i
print(ans)
if __name__ == "__main__":
main()
|
p03254 | s892921183 | Wrong Answer | N, x = map(int, input().split())
children = sorted(list(map(int, input().split())))
count = 0
for child in children:
if x >= child:
x -= child
count += 1
else:
break
if x == 0:
print(count)
else:
if count != 0:
print(count - 1)
else:
print(0) |
p03254 | s133036068 | 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:
print(z+1)
break |
p03254 | s841180946 | Wrong Answer | from itertools import accumulate
from bisect import bisect_left
def main():
children, cookies = map(int, input().split())
target = sorted(list(map(int, input().split())))
sum_target = sum(target)
if sum_target < cookies:
print(children - 1)
elif cookies < target[0]:
print(0)
else:
accumulate_target = list(accumulate(target))
print(bisect_left(accumulate_target, cookies) + 1)
if __name__ == '__main__':
main()
|
p03254 | s205552136 | Wrong Answer | n, x = map(int, input().split())
a = list(map(int, input().split()))
original = x
a.sort()
cnt = 0
for i in a:
if x >= i:
x -= i
cnt += 1
else:
break
if original != sum(a) and cnt == x:
cnt -= 1
print(cnt) |
p03254 | s830604454 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
sorted_a = sorted(a)
cont = 0
for i in range(N):
if x >= sorted_a[i]:
cont += 1
x = x - sorted_a[i]
if x != 0:
cont = cont -1
print(cont) |
p03254 | s115873606 | Wrong Answer | n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
for i in range(n):
x = x - a[i]
if x >= 0:
continue
else:
print(i)
break
if x >= 0:
print(i+1) |
p03254 | s452952741 | 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 ans != 0:
ans -= 1
print(ans)
|
p03254 | s705767672 | 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]
if(sum(A_i) == x):
print(N)
else:
for i in range(N):
if(i != N-1):
x -= A_i[i]
if(x >= 0):
count += 1
print(count) |
p03254 | s486642646 | Wrong Answer | # 27
n, x = map(int, input().split())
a = list(map(int, input().split()))
num = 0
for i in range(len(a)-1):
if x >= a[i] :
num += 1
x -= a[i]
if x == a[-1]:
num += 1
print(num) |
p03254 | s091612602 | Wrong Answer | n,x = map(int,input().split())
a = [int(x.strip()) for x in input().split()]
a_sorted = sorted(a)
ch,ans = 0,0
for i in range(n):
ch = sum(a_sorted[:i+1])
if ch < x:
ans += 1
elif ch == x:
ans += 1
break
else:
break
if ans != 0 and ch != x:
ans = ans-1
print(ans) |
p03254 | s516656197 | Wrong Answer | N,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
cnt = 0
for elem in a:
if x >= elem:
cnt += 1
x -= elem
else:
break
print(cnt) |
p03254 | s931283532 | Wrong Answer | n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
if x < a[0]:
print(0)
else:
for i in range(n):
x = x - a[i]
if x > 0:
continue
elif x == 0:
print(i+1)
break
else:
print(i-2)
break
if x > 0 and x > a[0]:
print(n-1) |
p03254 | s949181899 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
# 小さい数から配っていくと子供の人数を最大化できる
a = sorted(a)
leftCandy = 0
childrenCnt = 0
for i in range(len(a)):
leftCandy = x - a[i]
if leftCandy >= 0:
childrenCnt += 1
if leftCandy > 0:
print(N-1)
else:
print(childrenCnt) |
p03254 | s645425865 | Wrong Answer | from itertools import accumulate
N, x = map(int, input().split())
a = sorted(list(map(int, input().split())))
c = list(accumulate(a))
ans = sum([1 for i in c if i <= x])
if not ans:
print(ans)
else:
print(ans if x in list(c) else ans - 1) |
p03254 | s232526768 | 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(ans)
|
p03254 | s939048217 | Wrong Answer | n,x = map(int,input().split())
a = list(map(int,input().split()))
Slist = sorted(a)
cnt = 0
Sum = 0
for i in range(len(Slist)):
Sum += Slist[i]
if x>=Sum:
cnt +=1
else:
break
print(cnt) |
p03254 | s377861662 | Wrong Answer | N, X = map(int, input().split())
lists = list(map(int, input().split()))
if X - sum(lists) > 1:
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 | s947401791 | Wrong Answer | N, x = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
# print(N, x)
# print(A)
count = 0
for i in range(N):
if x >= A[i]:
count += 1
x -= A[i]
if count > 0 and x > 0:
count -= 1
print(count) |
p03254 | s421732615 | Wrong Answer | import numpy as np
n, x = map(int, input().split())
a = np.array(list(map(int, input().split())))
a = np.sort(a)
cnt = 0
for a_ in a:
cnt += 1
if a_ <= x:
x -= a_
elif a_ > x:
break
print(cnt if x == 0 else cnt - 1) |
p03254 | s087990025 | 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:
if count == 0:
print(0)
else:
print(count-1)
else:
print(count)
|
p03254 | s568625645 | 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 | s640284546 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
count = 0
for ai in a:
if ai <= x:
x -= ai
count += 1
else:
break
if x > 0:
count -= 1
print(count) |
p03254 | s501384156 | Wrong Answer | try:
N, x = map(int, input().split())
a = list(map(int, input().split()))
a_ = sorted(a)
cnt = 0
for i in a_:
if i<=x:
cnt += 1
x = x-i
else:
break
print(cnt)
except EOFError:
pass |
p03254 | s253640434 | Wrong Answer | N, x = map(int, input().split())
a = sorted(list(map(int, input().split())))
child = 0
candy = 0
print(a)
for i in a:
candy += i
if candy <= x:
child += 1
if sum(a) < x:
child -= 1
print(child) |
p03254 | s646180307 | Wrong Answer | n,x = map(int,input().split())
line = sorted(list(map(int,input().split())))
count = 0
if sum(line) < x:
count = n - 1
elif sum(line) == x:
count = n
else:
for i in range(n):
left = x - line[i]
if left >= 0:
count += 1
else:
break
print(count) |
p03254 | s647813742 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
# 小さい数から配っていくと子供の人数を最大化できる
a = sorted(a)
leftCandy = 0
childrenCnt = 0
for i in range(len(a)):
leftCandy = x - a[i]
if leftCandy >= 0:
childrenCnt += 1
print(childrenCnt) |
p03254 | s791202154 | 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 c<x:
d-=1
print(d) |
p03254 | s469750284 | Wrong Answer | n,x=map(int,input().split())
a=sorted(list(map(int,input().split())))
ans=0
for i in range(n):
if x>=a[i]:
ans+=1
x-=a[i]
else:
break
if ans == n:
if x!=0:
ans-=1
print(x)
print(ans) |
p03254 | s306932546 | Wrong Answer | n,x=map(int,input().split())
a=sorted([int(i)for i in input().split()])
res=0
if sum(a)==x:
res=n
else:
for i in range(n):
if sum(a[:i])<=x:res=len(a[:i])-1
print(max(0,res)) |
p03254 | s944867328 | Wrong Answer | A,B=list(map(int,input().split()))
C=list(map(int,input().split()))
C.sort()
ans = 0
for i in C:
if B >= i:
ans+=1
B-=i
else:
print(ans)
exit()
print(ans) |
p03254 | s752373389 | Wrong Answer | n,x = map(int,input().split())
a = sorted(map(int,input().split()))
c=0
for i in a:
if i<=x:
x-=i
c+=1
else:
if x>0:
c-=1
print(max(0,c)) |
p03254 | s616032244 | Wrong Answer | n, k = map(int, input().split())
a = list(map(int, input().split()))
sum = 0
ans = 0
a.sort()
for i in range(n):
sum += a[i]
if sum <= k:
ans += 1
else:
break
print(ans)
|
p03254 | s689905243 | 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 | s136573090 | Wrong Answer | n, x = map(int, input().split())
li_a = list(map(int, input().split()))
answer = 0
id = -1
for idx, a in enumerate(sorted(li_a)):
id = idx
if x >= a:
answer += 1
x -= a
else:
break
if x == 0 or answer == 0:
print(answer)
else:
if id == (n -1):
print(answer - 1)
else:
print(answer)
|
p03254 | s746018009 | 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:
if x - i < 0:
break
else:
x -= i
cnt += 1
print(cnt)
|
p03254 | s883853527 | Wrong Answer | [N, x] = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
count = 0
i = 0
while x >= 0 and i <= len(a):
x -= a[i]
if i == len(a)-1:
if x != a[i]:
break
if x >= 0:
count += 1
i += 1
print(count) |
p03254 | s653902453 | 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:
A = x - i
if A < 0:
count -=1
break
elif A == 0:
count += 1
break
count+=1
if count == -1:
count = 0
print(count) |
p03254 | s347292187 | 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()
c += 1
rx -= a[i]
print(N) |
p03254 | s218300949 | Wrong Answer | N,M = map(int,input().split())
L = input().split()
L = sorted(L)
total = 0
i = 0
while M > 0 and i < N:
M -= int(L[0])
L.pop(0)
total += 1
i += 1
print(total) |
p03254 | s751135569 | Wrong Answer | N,x=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
for i in range(len(A)):
if x-A[i]<0:
break
else:
x-=A[i]
print(i) |
p03254 | s121694171 | Wrong Answer | n,x = map(int,input().split())
al = list(map(int,input().split()))
al.sort()
c = 0
for a in al:
if x >= a:
c += 1
x -= a
if x > 0 and c > 0:
c -= 1
print(c) |
p03254 | s721716492 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
cnt = 0
j = 0
for i in range(N):
if (cnt + a[i]) > x:
break
cnt += a[i]
j += 1
if j == len(a):
j -= 1
print(j) |
p03254 | s664437682 | Wrong Answer | num_children, num_snacks = list(map(int, input().split(' ')))
children = list(map(int, input().split(' ')))
children.sort()
print(children)
count = 0
for i in range(num_children+1):
if num_snacks >= sum(children[:i+1]):
count += 1
else:
break
print(count)
|
p03254 | s684603333 | Wrong Answer | N,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
sum =x
cnt=0
for i in range(N):
if x -a[i] >= 0:
cnt+=1
x = x-a[i]
if x >0:
if cnt >0:
cnt = cnt-1
print(cnt) |
p03254 | s989084861 | Wrong Answer | import math
# For taking integer inputs.
def inp():
return(int(input()))
# For taking List inputs.
def inlist():
return(list(map(int, input().split())))
# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
s = input()
return(list(s[:len(s)]))
# For taking space seperated integer variable inputs.
def invr():
return(map(int, input().split()))
N, x = invr()
a = inlist()
a = sorted(a)
c = 0
for i in a:
if i <= x:
c += 1
x -= i
if x > 0 and c > 0:
c -= 1
print(c)
|
p03254 | s063924614 | 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 - 1
elif sum(a) == x:
ans = N
else:
for i in range(N):
if x >= a[i]:
x -= a[i]
ans += 1
print(ans) |
p03254 | s168729164 | 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 a[i] <= x:
x -= a[i]
ans += 1
if x > 0 and ans > 0:
ans -= 1
print(ans)
elif x == 0:
print(ans)
else:
print(0)
|
p03254 | s335096720 | Wrong Answer | n, x = map(int, input().split(" "))
a = list(map(int, input().split(" ")))
a.sort()
pos = -1
for i in range(0, n):
x -= a[i]
if x < 0:
pos = i
break
if pos == -1:
print(n)
else:
print(pos) |
p03254 | s529758476 | Wrong Answer | import sys
input = sys.stdin.readline
def main():
N, x = map(int, input().split())
a_list = list(map(int, input().split()))
if sum(a_list) == x:
print(N)
sys.exit()
for i, a in enumerate(sorted(a_list), start=1):
x -= a
if x < 0:
break
if x >= 0:
print(i)
else:
print(i-1)
|
p03254 | s360012888 | Wrong Answer |
n,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
b = []
num = a[0]
i = 1
while num <= x:
num += a[i]
if x - a[i] > 0:
x -= a[i]
b.append(a[i])
i += 1
else:
b.append(max(0,a[i]))
break
print(a)
print(b)
print(num)
ans = 0
for i in range(min(len(a),len(b))):
if a[i] == b[i]:
ans += 1
print(ans)
|
p03254 | s019114299 | 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:
for a in A:
x -= a
ans -= 1
if x <= 0:
break
print(max(ans, 0)) |
p03254 | s032493933 | Wrong Answer | N,X=map(int,input().split())
ai=list(map(int,input().split()))
ai.sort()
sum_of_the_candy=0
ans=0
if sum(ai)==X:
ans=N
elif sum(ai)<X:
ans=N-1
else:
for i in range(N):
sum_of_the_candy=sum_of_the_candy+ai[i]
if sum_of_the_candy < X:
ans = ans +1
else:
break
print(ans) |
p03254 | s387465173 | Wrong Answer | n, x = map(int, input().split())
A = sorted([int(i) for i in input().split()])
# print(A)
cnt = 0
for e in A:
if e <= x:
x = x - e
cnt += 1
if x == 0 or cnt == 0:
print(cnt)
else:
print(cnt-1)
|
p03254 | s376708395 | Wrong Answer | import sys
input=sys.stdin.readline
from bisect import bisect_right
import itertools
N,X= map(int,input().split())
A=list(map(int,input().split()))
A.sort()
Acum = list(itertools.accumulate(A))
print(Acum)
answer = bisect_right(Acum,X)
if answer == N:
if Acum[-1] < X:
answer -= 1
print(answer)
|
p03254 | s329732332 | Wrong Answer | n,x=map(int,input().split())
a=list(map(int,input().split()))
ans=0
for i in range(n-1):
x=x-a[i]
if x<0:
x=x+a[i]
else:
ans+=1
a.sort(reverse=True,key=int)
ansr=0
for i in range(n-1):
x=x-a[i]
if x<0:
x=x+a[i]
else:
ansr+=1
print(max(ans,ansr))
|
p03254 | s170168294 | Wrong Answer | N, x = map(int, input().split())
A = [int(i) for i in input().split()]
A.sort()
ans = []
for i in A:
x -= i
#print(ans, x)
if x <= 0:
break
ans.append(i)
if x > 0:
print(len(ans)-1)
else:
print(len(ans)) |
p03254 | s512157721 | 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(max(0,cnt)) |
p03254 | s285284499 | 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 | s413751633 | Wrong Answer | n,x=map(int,input().split())
a=sorted(list(map(int,input().split())))
ans=0
for i in a:
if i>x:
break
else:
n-=i
ans+=1
print(ans) |
p03254 | s393391256 | Wrong Answer | # 27
n, x = map(int, input().split())
a = list(map(int, input().split()))
num = 0
for i in range(len(a)):
if i != len(a) - 1:
if x >= a[i] :
num += 1
x -= a[i]
elif x == a[i]:
num += 1
print(num) |
p03254 | s966693365 | 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)
sys.exit()
for i in range(1,n+1):
if sum(K)-K[0]<=x:
print(n-i)
sys.exit()
else:
K.pop(0) |
p03254 | s473092179 | Wrong Answer | n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
s=0
while s<n-1:
if m>=a[s]:
m-=a[s]
s+=1
else:break
print(s) |
p03254 | s531417671 | 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 c<x:
d-=1
print(d) |
p03254 | s046515365 | 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()
print(n) |
p03254 | s227590705 | Wrong Answer | num_children, num_snacks = list(map(int, input().split(' ')))
children = list(map(int, input().split(' ')))
children.sort()
count = 0
for i in range(num_children):
if num_snacks >= sum(children[:i+1]):
count += 1
print(count)
|
p03254 | s289840666 | Wrong Answer | N,x = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
S = 0
count = 0
for i in range(N):
S += A[i]
if S < x:
print(N-1)
exit()
else:
for i in range(N):
b = x - A[i]
if b > 0:
count += 1
x -= A[i]
elif b == 0:
count += 1
exit()
else:
exit()
print(count) |
p03254 | s250675342 | Wrong Answer | n, x = map(int, input().split())
l = sorted(list(map(int, input().split())))
if sum(l) <= x:
print(n)
else:
for i in range(n):
print(x)
if x <= 0:
break
x -= l[i]
print(i) |
p03254 | s467726581 | Wrong Answer | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
def main(n, x, a):
cnt = 0
for i in a:
x -= i
if x <= 0:
break
elif i == a[-1] and x > 0:
break
cnt += 1
return cnt
n, x = map(int, readline().split())
a = np.sort(np.array(readline().split(), np.int64))
print(main(n, x, a))
|
p03254 | s731245439 | Wrong Answer | N, x = [int(z) for z in input().split()]
children = [int(z) for z in input().split()]
children.sort()
sum = 0
for i in range(N):
sum += children[i]
if sum >= x:
print(i + 1)
break
elif i == N - 1:
print(N - 1)
|
p03254 | s360808373 | Wrong Answer | import sys
input = sys.stdin.readline
def main():
N, x = map(int, input().split())
a_list = list(map(int, input().split()))
ans = 0
for a in sorted(a_list):
if a <= x:
ans += 1
x -= a
else:
break
if ans == N:
print(ans - 1)
else:
print(ans)
if __name__ == '__main__':
main() |
p03254 | s668462281 | Wrong Answer | N, x = map(int, input().split(" "))
a = list(map(int, input().split(" ")))
children = [0] * N
a.sort()
kashi = 0
while kashi < x:
for i in range(0,N):
kashi += a[i]
children[i] += 1
if kashi > x:
kashi -= a[i]
children[i] -= 1
break
if kashi == 0:
break
print(N - children.count(0)) |
p03254 | s193481857 | Wrong Answer | if __name__ == "__main__":
n, x = map(int, input().split())
a = list(map(int, input().split()))
if sum(a) == x:
print(n)
exit()
a.sort()
ans = 0
tmp = 0
for aa in a:
if tmp < x and aa <= x-tmp:
tmp += aa
ans += 1
if tmp == x:
print(ans)
exit()
if ans > 0:
ans -= 1
print(ans)
|
p03254 | s617050880 | Wrong Answer | N, X = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
res = 0
for a in A:
if a > X:
break
res += 1
X -= a
if X > 0:
res -= 1
print(max(res, 0)) |
p03254 | s274748712 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
cnt = 0
while len(a) != 0:
next = min(a)
a.remove(min(a))
if x < next:
break
x -= next
cnt += 1
cnt = 1 if cnt == 0 else cnt
print(cnt if x == 0 else cnt-1) |
p03254 | s139579298 | Wrong Answer | N, x = map(int,input().split())
al = list(map(int,input().split()))
al.sort()
cnt = 0
for a in al:
x -= a
if x < 0:
break
cnt += 1
if x != 0 and cnt >= 1:
print(cnt-1)
else:
print(cnt)
|
p03254 | s246111904 | 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 | s785896913 | Wrong Answer | n , x = map(int , input().strip().split())
a = list(map(int , input().strip().split()))
a.sort()
count = 0
for i in a:
if x - i < 0:
break
x -= i
count += 1
print(count) |
p03254 | s678821590 | Wrong Answer | try:
N, x = map(int, input().split())
a = list(map(int, input().split()))
a_ = sorted(a)
cnt = 0
for i in a_:
if i<=x:
cnt += 1
x = x-i
print(cnt)
except EOFError:
pass |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.