Problem:


Score : 200 points

Problem Statement

A ball will bounce along a number line, making N + 1 bounces. It will make the first bounce at coordinate D_1 = 0, and the i-th bounce (2 \leq i \leq N+1) at coordinate D_i = D_{i-1} + L_{i-1}.

How many times will the ball make a bounce where the coordinate is at most X?

Constraints

1 \leq N \leq 100

1 \leq L_i \leq 100

1 \leq X \leq 10000

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N X
L_1 L_2 ... L_{N-1} L_N

Output

Print the number of times the ball will make a bounce where the coordinate is at most X.

Sample Input 1

3 6
3 4 5

Sample Output 1

2

The ball will make a bounce at the coordinates 0, 3, 7 and 12, among which two are less than or equal to 6.

Sample Input 2

4 9
3 3 3 3

Sample Output 2

4

The ball will make a bounce at the coordinates 0, 3, 6, 9 and 12, among which four are less than or equal to 9.



Sample input:
3 6
3 4 5


Sample output:
2

Submission status: Accepted

Solution code:

n,x = map(int,input().split())
l = list(map(int,input().split()))
count = 0
d = [0]

for i in range(1,len(l)+1):
    d.append(l[i-1]+d[i-1])

for i in range(len(d)):
    if d[i] <= x:
        count += 1

print(count)

Submission status: Accepted

Solution code:
def resolve():
    n,x=map(int, input().split())
    l=list(map(int, input().split()))
    num=1
    zahyou=0
    for i in range(n):
        zahyou+=l[i]
        if zahyou<=x:
            num+=1
    print(num)
resolve()

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
Llist = [int(i) for i in input().split()] 
Dlist = []

for i in range(N+1):
  if i == 0:
    Dlist.append(0)
  else:
    Dlist.append(Dlist[i-1]+Llist[i-1])


print(len([i for i in Dlist if i <= X]))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1

""" Input
S = input().rstrip()
N = int(input())
A = np.array(input().split(), dtype=np.float64)
D = [int(input()) for _ in range(N)]
AB = [[int(x) for x in input().split()] for _ in range(N)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
"""
import numpy as np


N, X = map(int, input().split())
L = np.array(list(map(int, input().split())))
L = np.append(0, L)

l_cum = np.cumsum(L)
print(sum(l_cum <= X))






# def main():

# if __name__ == '__main__':
#     main()

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
Ls = list(map(int, input().split()))

ans = 1
D = 0
for L in Ls:
    D += L
    ans += D <= X

print(ans)

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n,x = map(int, input().split())
    l = list(map(int, input().split()))
    res = 1
    c = 0
    for i in range(n):
        c += l[i]
        if c <= x:
            res += 1
    print(res)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
l = list(map(int,input().split()))
for i in range(n-1): l[i+1] += l[i]
ans = 1
for i in range(n):
  if l[i] <= x: ans += 1
print(ans)

Submission status: Accepted

Solution code:
import bisect
n, x = list(map(int, input().split()))
L = list(map(int, input().split()))
D = [0]
for l in L:
    D.append(D[-1]+l)
i = bisect.bisect_right(D, x)
print(i)

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
li=list(map(int,input().split()))
s=[0]
a=0
for i in li:
  a+=i
  s.append(a)
l=[i for i in s if i<=x]
print(len(l))

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
l = list(map(int, input().split()))
ans = 1
d = 0
for i in range(n):
    d += l[i]
    if d <= x:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
# ABC 130: B – Bounding
N, X = map(int, input().split())
L = [int(s) for s in input().split()]

D = [0]

for i in range(N):
    D.append(D[i] + L[i])

print(len([d for d in D if d <= X]))

Submission status: Accepted

Solution code:
N,X= map(int, input().split())
L=list(map(int, input().split()))
D, ans=0, 0
for i in range(N):
    if D<=X:
        ans+=1
        D+=L[i]
    else:
        break
if D<=X:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
L = list(map(int, input().split()))

length = 0
ans = 0

for a in L:
    length += a
    if length > X:
        length -= a
        break
    ans += 1

print(ans+1)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, X = MAP()
L = LIST()

cnt = 1
D = 0
for i in range(N):
	D += L[i]
	if D <= X:
		cnt += 1
	else:
		print(cnt)
		break
else:
	print(cnt)

Submission status: Accepted

Solution code:
n,x =map(int,input().split())
l = list(map(int,input().split()))
ans = 1
d = 0
for i in range(n):
     d += l[i]
     if d <= x:
          ans += 1
print(ans)

Submission status: Accepted

Solution code:
from itertools import accumulate
from bisect import bisect_right

n, x = map(int, input().split())
A = list(map(int, input().split()))
AA = list(accumulate([0] + A))
ans = bisect_right(AA, x)
print(ans)

Submission status: Accepted

Solution code:
n, x= input().split()
n, x= int(n), int(x)
lista=list(map(int, input().split()))
cont=1
sum=0

for i in range(n):
	sum+=lista[i]
	if sum <= x:
		cont+=1
print(cont)

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
l = list(map(int, input().split()))
l.insert(0,0)
d = 0
count = 0
for i in range(n+1):
    d += l[i]
    if d <= x:
        count += 1
print(count)

Submission status: Accepted

Solution code:
icase=0
if icase==0:
    n,x=map(int,input().split())
    l=list(map(int,input().split()))
    d=0
    for i in range(n):
        d=d+l[i]
        if d>x:
            print(i+1)
            break
    if d<=x:
        print(n+1)

Submission status: Accepted

Solution code:
n, x, *L = map(int, open(0).read().split())
D = [0] * (n+1)
for i in range(1, n+1):
  D[i] = D[i-1] + L[i-1]
print(sum(d <= x for d in D))

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
L = list(map(int, input().split()))
D = [0] * (n + 1)
ans = 1

for i in range(1, n + 1):
    D[i] = D[i - 1] + L[i - 1]

    if D[i] <= x:
        ans = ans + 1
    else:
        break

print(ans)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7


def main():
  N, X = map(int, readline().split())
  L = list(map(int, readline().split()))
  D = 0
  ans = 1
  for i in range(N):
    D += L[i]
    if D<=X:
      ans += 1
    else:
      break
  print(ans)
  
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
l = list(map(int,input().split()))
ans = 1
s = 0
for i in range(n):
    s += l[i]
    if s <= x:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def main():
    N, X = map(int, input().split())
    L = [int(a) for a in input().split()]
    bound = 1
    D = 0
    for i in range(N):
        b = D + L[i]
        if b <= X:
            bound += 1
        D = b
    print(bound)
main()

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
l = list(map(int,input().split()))
d = 0
count = 1
for i in range(n):
    d += l[i]
    if d <= x:
      count += 1
    else:
      print(count)
      exit()
print(count)

Submission status: Accepted

Solution code:
from itertools import accumulate, takewhile
N, X = map(int, input().split())
print(len(list(takewhile(lambda x: x <= X, accumulate(map(int, input().split()))))) + 1)

Submission status: Accepted

Solution code:
N,X=map(int,input().split())
L=list(map(int,input().split()))
d=0
cnt=1
for l in L:
    d+=l
    if d<=X: cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
N,X=map(int,input().split())
L=list(map(int,input().split()))
l=0
cnt=1
for i in range(N):
    l+=L[i]
    if l<=X: cnt+=1
    else: break
print(cnt)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
l = list(map(int, input().split()[:a]))
res = 1
d = 0
res= [0]
for item in l:
    res.append(d + item)
    d += item
filtered_res = list(filter(lambda x: x <= b, res))
print(len(filtered_res))

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
l = list(map(int, input().split()))
ball = 1
bound = 0
for i in l:
    bound = bound + i
    if bound > x:
        break
    ball += 1
print(ball)

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
array1=list(map(int,input().split()))
k=1
q=0
for i in range(n):
    q+=array1[i]
    if q<=m:
        k+=1
print(k)

Submission status: Accepted

Solution code:
def main():
    n, x = [int(z) for z in input().split()]
    l = [int(z) for z in input().split()]
    tam = len(l)
    d = 0
    for i in range(tam):
        d += l[i]
        if d > x:
            print(i + 1)
            break
    if d <= x:
        print(n+1)
main()

Submission status: Accepted

Solution code:
line = input()
n, x = [int(i) for i in line.split()]
line = input()
l = [int(j) for j in line.split()]
if n>1:
    coord=0
    s=2
    for k in range(len(l)-1):
        if l[k] + l[k+1] + coord <= x :
            s+=1
        coord = coord+l[k]

    print(s)
else:
    print("2")

Submission status: Accepted

Solution code:
i = input().split()

n,x = list(map(int, i))

l = input().split()

l = list(map(int, l))

c = 1

aux = 0

step = [0]

for i in range(len(l)):
    try:        
        if step[i] + l[i] <= x:
            step.append(step[i] + l[i])
    except:
        pass

print(len(step))

Submission status: Accepted

Solution code:
numeroA, numeroB = [],[]
contadorCoord = 0
contador=1
numerosSTRa = input().split(" ")
for p in numerosSTRa:
    numeroA.append(int(p))


numerosSRTB = input().split(" ")
for j in numerosSRTB:
    numeroB.append(int(j))

for i in numeroB:
    contadorCoord+=i
    if contadorCoord <= numeroA[1]:
        contador+=1
print(contador)

Submission status: Accepted

Solution code:
line1 = [int(n) for n in input().split()]
line2 = [int(n) for n in input().split()]
D = 0
res = 0
for i in range(line1[0]):
    if D <= int(line1[1]):
        res += 1
    else:
        break
    D = D + int(line2[i])
if D <= int(line1[1]):
    res += 1
print(res)

Submission status: Accepted

Solution code:
line = input()
X, Y = [int(n) for n in line.split()]


line = input()
numbers = [int(n) for n in line.split()]

predicted_value = 1
for num in numbers:
    if Y - num >= 0:
        predicted_value += 1
        Y -= num
    else:
        break

print(predicted_value)

Submission status: Accepted

Solution code:
n, x = [int(x) for x in input().split()]

ls = [int(x) for x in input().split()]

bounces = [0]
d = 0
for i in range(n):
    d = d + ls[i]
    bounces.append(d)

count = 0
for b in bounces:
    if b <= x:
        count += 1
print(count)

Submission status: Accepted

Solution code:
N,X = map(int,input().split())
L = list(map(int,input().split()))
tmp = 0
for i in range(N):
  tmp = tmp + L.pop(0)
  if(tmp == X):
    print(str(i + 2))
    exit()
  elif(tmp > X):
    print(str(i + 1))
    exit()
  else:
    pass
if(i + 1 == N):
  print(str(N + 1))

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
l = list(map(int,input().split()))
d = [0]*(n+1)
count = 1
for i in range(1,n+1):
  d[i] = d[i-1]+l[i-1]
  if d[i]<=x: count += 1
print(count)

Submission status: Accepted

Solution code:
numList1 = list(map(int, input().split()))
numList2 = list(map(int, input().split()))
add = 0
result = 1
cood = []
for i in range(0, len(numList2)):
    add += numList2[i]
    cood.append(add)
for i in cood:
    if i <= numList1[1]:
        result += 1
    else:
        continue
print(result)

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
l = list(map(int, input().split()))

sum = 0
ans = 0

for i in range(n):
    if sum + l[ans] > x:
        break
    sum += l[ans]
    ans += 1

print(ans+1)

Submission status: Accepted

Solution code:
import sys

n,x=map(int,input().split())
l=list(map(int,input().split()))
ans=[0]
num=0

for i in range(n):
  num+=l[i]
  ans.append(l[i])

  if num==x:
    print(len(ans))
    sys.exit()
    
  elif num>x:
    print(len(ans)-1)
    sys.exit()
    
print(len(ans))

Submission status: Accepted

Solution code:
n,x= input().split()
b_list= list(map(int, input().split()))
temp = 0
counter = 1
for i in range(int(n)):
    temp += b_list[i]
    if (temp<=int(x)):
        counter +=1
    else:
        break

print(counter)

Submission status: Accepted

Solution code:
N,X=map(int,input().split())
L=list(map(int,input().split()))
length=0
count=0
for i in range(len(L)):
    
    length+=L[i]
    if length<=X:
        count+=1
    else:
        break
print(count+1)

Submission status: Accepted

Solution code:
n, x = map(int,input().split())
l = list(map(int,input().split()))

SUM = 0
cnt = 1
for i in l:
    SUM += i
    if SUM > x:
        print(cnt)
        exit()
    cnt += 1
else:
    print(cnt)

Submission status: Accepted

Solution code:
N, X = list(map(int,input().split()))
L = list(map(int,input().split()))
L.append(0)
Ls = sorted(L)
sum = 0
count = 0
for i in range(len(L)):
  if sum <= X:
    sum += L[i]
    count += 1
print(count)

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
l = list(map(int,input().split()))
d = 0
ans = 1
for i in range(len(l)):
  d += l[i]
  if x >= d:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
n,x=map(int, input().split())
l=list(map(int, input().split()))
d=0
t=1
for i in range(len(l)):
  d+=l[i]
  if d<=x:
    t+=1
print(t)

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
l = list(map(int,input().split()))
tmp = 0
cnt = 1
for i in l:
    tmp += i
    if tmp <= x:
        cnt += 1
        
print(cnt)

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
L = list(map(int, input().split()))

ans = 0

for i in range(N + 1):
    if sum(L[:i]) <= X:
        ans += 1
    else:
        break

print(ans)

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
x = 0
ans = 1
for i in range(N):
    x += L[i]
    if x > X:
        break
    else:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n,x = map(int, input().split())
l = list(map(int, input().split()))
count = 0
cnt = 1
for i in range(0,n):
    count += l[i]
    if (count > x):
        print(cnt)
        exit()
    else:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
n,x = map(int, input().split())
l = list(map(int, input().split()))
flag = 0
d = []
d.append(0)
for i in range(1,n+1):
    if d[i-1]+l[i-1] > x:
        break
    else:
        d.append(d[i-1]+l[i-1])
print(len(d))

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
li = list(map(int,input().split()))
ali = [0]
for i in range(n):
    ali.append(ali[-1] + li[i])
print(len([i for i in ali if i <= x]))

Submission status: Accepted

Solution code:
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N,X = map(int,input().split())
L = list(map(int,input().split()))

total = 0
ans = 1
for l in L:
    total += l
    if total <= X:
        ans += 1
    else:
        break

print(ans)

Submission status: Accepted

Solution code:
N,X=map(int,input().split())
L=[int(i) for i in input().split()]
count=1
dis=0
for t in L:
    dis=dis+t
    if dis<=X:
        count+=1
    else:
        break
print(count)

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
l = list(map(int, input().split()))
ans = 1
pos = 0
for i in l:
    pos += i
    if pos>x:
        print(ans)
        break
    ans += 1
else:
    print(ans)

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
l = list(map(int,input().split()))
cnt = 1
b = 0
for i in range(n):
    b += l[i]
    if b <= x:
        cnt += 1
    else:
        print(cnt)
        exit()
print(cnt)

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
L = [int(x) for x in input().split()]
ans = 1
D = 0
for i in range(N):
    D += L[i]
    if D <= X:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
sumd=0
for i in range(n):
  sumd+=l[i]
  if sumd>x:
    print(i+1)
    exit()
print(i+2)

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N, X = map(int, input().split())
A = list(map(int, input().split()))

D = 0
cnt = 0
while D <= X and cnt <= N:
    if cnt != N:
        D += A[cnt]
    cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
n,x = map(int, input().split())
l = list(map(int, input().split()))

d = [0]*(n+1)
for i in range(1,n+1):
  d[i] = d[i-1]+l[i-1]
  
d = sorted(d)
count = 0
for i in range(n+1):
  if d[i]>x:
    break
  count += 1
  
print(count)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main():
    N, X = list(map(int,readline().split()))
    L = map(int,readline().split())
    sum = 0
    cnt = 1
    for l in L:
        sum += l
        if sum <= X:
            cnt += 1
    print(cnt)

    return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
L=[int(_) for _ in input().split()]
S_L=[0]
count=1
for i in range(n):
    S_L.append(S_L[-1]+L[i])
    if S_L[-1]<=x:
        count+=1
    else:
        print(count)
        break
else:print(n+1)

Submission status: Accepted

Solution code:
n, x, *l = map(int, open(0).read().split())

cnt = 1
d = 0
for i in range(n):
    d += l[i]
    if d <= x:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
l = list(map(int, input().split()))

d = 0
count = 1
for i in range(n):
    d += l[i]
    if d > x:
        break
    count += 1
print(count)

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
L = list(map(int, input().split()))

ans = 1
d = 0
for x in L:
    d = d + x
    if d <= X :
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n, x = list(map(int, input().split()))
l = list(map(int, input().split()))
c = 1
total = 0
for i in l:
  total += i
  if total <= x:
    c+=1
print(c)

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
l = list(map(int, input().split()))
res = 0
for i in range(n):
    res += l[i]
    if x < res:
        print(i+1)
        exit()
print(i+2)

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
l = list(map(int,input().split()))
d = [0]

for i in range(n):
    d.append(d[i] + l[i])

ans = 0
for i in range(n+1):
    if d[i] <= x:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
L = list(map(int, input().split())) 

import numpy as np

arr = [0]

for i in range(1, N+1):
    arr.append(arr[i-1]+L[i-1])


arr = np.array(arr)

ans = len(arr[arr<=X])

print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

n,x=MI()
ls=LI()
dp=[0 for i in range(n+1)]
for i in range(n):
    dp[i+1]=dp[i]+ls[i]
#print(dp)
count=0
for d in dp:
    if d<=x:
        count+=1
print(count)

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
l = list(map(int, input().split()))

tmp = 0
ans = 1
for i in range(n):
  tmp += l[i]
  if tmp > x:
    break
  else:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = list(map(int, input().split()))
m = list(map(int, input().split()))

ans = 0
new_list = [0]
for i in range(n[0]):
  ans = ans + m[i]
  if ans <= n[1]:
    new_list.append(ans)
  elif ans > n[1]:
    break
    
print(len(new_list))

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
a = list(map(int,input().split()))
p = 1
f = 0
for i in a:
    f += i
    if f <= x:
        p += 1
    else:
        break
print(p)

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
D=0
y=1
if x==0:
    print(1)
else:
    for i in range(n):
        D+=l[i]
        if D<=x:
            y+=1
    print(y)

Submission status: Accepted

Solution code:
n,x = map(int, input().split())
L = list(map(int, input().split()))
ans = [0]

for i in range(len(L)):
  ans.append(ans[i]+L[i])
  
print(len([a for a in ans if a<=x]))

Submission status: Accepted

Solution code:
n,x = map(int ,input().split())
l = list(map(int ,input().split()))
old_d = 0
count = 1
for i in range(1 ,n+1):
    new_d =old_d +l[i-1]
    old_d = new_d
    if new_d <= x:
        count +=1
print(count)

Submission status: Accepted

Solution code:
inputted = list(map(int, input().split()))
N = inputted[0]
X = inputted[1]
L = list(map(int, input().split()))

x = 0
number_of_bounds = 0
for _i, Li in enumerate(L):
    number_of_bounds = _i + 1
    x += Li
    if x > X: break

if x <= X:
    number_of_bounds += 1

print(number_of_bounds)

Submission status: Accepted

Solution code:
N,X=map(int,input().split())
*L,=map(int,input().split())

i=0
A=[0]

while i<N:
    if A[i]+L[i]<=X:
        A.append(A[i]+L[i])
        i+=1
    else:
        break

print(len(A))

Submission status: Accepted

Solution code:
N, X  = map(int, input().split())
L = list(map(int, input().split()))

bound = []
for _ in range(N+1):
  bound.append(0)

for i in range(1,N+1):
  bound[i] = bound[i-1]+L[i-1]

ans = 0

for i in range(N+1):
  if bound[i] <= X:
    ans += 1
  else: 
   break

print(ans)

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
l = list(map(int,input().split()))
a =[0]
ans = n+1
for i in range(n):
    s = a[i] + l[i]
    if s > x:
        ans = i+1
        break
    else:
        a.append(s)
print(ans)

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
l = list(map(int,input().split()))
ans = []
ans.append(0)
for i in range(n):
  ans.append(ans[i]+l[i])
count=0
for i in ans:
  if i <= x:
    count+=1
print(count)

Submission status: Accepted

Solution code:
n, x = map(int,input().split())
l = list(map(int,input().split()))

d = 0
count = 1
for i in range(n):
    d += l[i]
    if d <= x:
        count += 1
    else:
        print(count)
        quit()
print(count)

Submission status: Accepted

Solution code:
n, x = map(int,input().split())
l = list(map(int,input().split()))

d = 0
count = 1
for i in range(n):
    d += l[i]
    if d <= x:
        count += 1
    else:
        exit
    exit
print(count)

Submission status: Accepted

Solution code:
N, X = map(int,input().split())
L = list(map(int,input().split()))
cnt = 0
D = [0]
for i in range(N):
  D.append(D[i]+L[i])
l = [d for d in D if d <= X]
print(len(l))

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
l = list(map(int,input().split()))
ans = 1
d = 0
for i in l:
  d += i
  if d <= x:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
# Bounding
# https://atcoder.jp/contests/abc130/tasks/abc130_b

from sys import stdin, stdout

n, x = map(int, stdin.readline().split())
l = list(map(int, stdin.readline().split()))
coordinates = [0]
for i in range(1, n + 1):
    next_coordinate = coordinates[i - 1] + l[i - 1]
    if next_coordinate > x:
        break
    coordinates.append(next_coordinate)
stdout.write("%d\n" % len(coordinates))

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
l = list(map(int,input().split()))
d = [0]

for i in range(n):
	d.append(d[i] + l[i])

ans  = 0
for i in range(n+1):
	if d[i] <= x:
		ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys

# import bisect
# from collections import Counter, deque, defaultdict
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

# from numba import jit
# import numpy as np

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, x = list(map(int, readline().split()))
    l = list(map(int, readline().split()))
    d = 0

    for i in range(n):
        d += l[i]
        if d > x:
            print(i + 1)
            sys.exit()

    print(n + 1)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
m = list(map(int,input().split(" ")))
n = m[0]
x = m[1]
l = list(map(int,input().split(" ")))

#d1 = 0, d2 = 0 +3, d3 = 3+4
d = 0
d_count = 1
for i in range(n):
    d = d + l[i]
    # print(d)
    if d <= x:
        d_count += 1
        # print(d_count)
    else:
        exit
    exit

print(d_count)

Submission status: Accepted

Solution code:
n, x= map(int,input().split())
l = list(map(int,input().split()))

ans = 1
su = 0
for i in range(n):
    su += l[i]
    if su > x:
        break
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
p,q= input().split()
a,b =(int(p), int(q))
L_list = input().split()
L_list_int = []
count = 0
for i in range(a):
    L_list_int.append(int(L_list[i])) 

for i in range(a + 1):
    if sum(L_list_int[:i]) <= b:
        count += 1
    else:
        break
print(count)

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
ns = list(map(int, input().split()))
d = 0
count = 1
for i in range(n):
    if d + ns[i] <= x:
        d += ns[i]
        count += 1
    else:
        break
print(count)

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
l = list(int(i) for i in input().split())
d = 0
cnt = 1
for i in range(n):
    d += l[i]
    if d <= x:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
b=0
cnt=0
for i in l:
  b+=i
  cnt+=1
  if b>x:
    print(cnt)
    exit()
print(n+1)

Submission status: Accepted

Solution code:

n,x = map(int,input().split())
L = input().split()
for i in range(n):
    L[i] = int(L[i])
cnt = 1
d = 0
for i in range(n):
    d = d + L[i]
    if d <= x:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:

N,X = map(int,input().split())
L = list(map(int,input().split()))

x = 0
ans = 1

for l in L:
    x+= l
    if x > X:
        break
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
N,X=map(int,input().split())
L=list(map(int,input().split()))
x=0
ans=1
for l in L:
  x+=l
  if x>X:
    break
  ans+=1
print(ans)

Submission status: Accepted

Solution code:
N,X = map(int,input().split())
L = list(map(int,input().split()))
b = 0
ans = 1
for i in range(N):
  b += L[i]
  if b <= X:
    ans += 1
  else:
    break
print(ans)

Submission status: Accepted

Solution code:
N, X = map( int, input().split())
L = list( map( int, input().split()))

bouncing_cnt_in_range = 1
current_ball_position = 0
for next_step in L:
  current_ball_position += next_step
  if current_ball_position <= X:
    bouncing_cnt_in_range += 1
  else:
    break
  
print( bouncing_cnt_in_range )

Submission status: Accepted

Solution code:
N, X = map(int,input().split())
L = list(map(int,input().split()))
ans = 1
D = 0
for i in range(N):
  if D + L[i] <= X: 
    D += L[i]
    ans += 1
  else:break
print(ans)

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
l = list(map(int,input().split()))

d = 0
ans = 1

for i in range(n):
    d = d + l[i]
    if d <= x:
        ans += 1
    else:
        break

print(ans)

Submission status: Accepted

Solution code:
n, x = [int(_) for _ in input().split()]
L = [int(_) for _ in input().split()]
res = 1
d = 0
for l in L:
  d += l
  res += (d <= x)
print(res)

Submission status: Accepted

Solution code:
#コピーです
n,x,*l=map(int,open(0).read().split())
print(sum(x>=sum(l[:i+1])for i in range(n))+1)

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
p=[0]*(n+1)
c=1
for i in range(n):
  p[i+1]=p[i]+l[i]
  if p[i+1]<=x:
    c+=1
print(c)

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
pos, ans = 0, 1
for i in range(N):
    pos += L[i]
    if pos <= X:
        ans += 1
    else:
        break
print (ans)

Submission status: Accepted

Solution code:
N,X = map(int,input().split())

L = list(map(int,input().split()))

D=0
count=1
for i in range(N):
  D=D+L[i]
  if D<=X:
    count=count+1
  #print(D)
  i=i+1

print(count)

Submission status: Accepted

Solution code:
N,X = map(int,input().split())
L = list(map(int,input().split()))
D = [0]*(N+1)
x = 0
for i in range(1,N+1):
  D[i] = D[i-1]+L[i-1]
for i in D:
  if i <= X:
    x += 1
print(x)

Submission status: Accepted

Solution code:
N,X=map(int,input().split())
L=list(map(int,input().split()))
ans=0
re_ans=1
for i in range(N):
    ans+=L[i]
    if ans<=X:
        re_ans+=1
print(re_ans)

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    N, X = input_nums()
    L = input_nums()
    s = 0
    cnt = 1
    for i in range(N):
        s += L[i]
        if s <= X: cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
fly=0
count=1
for i in range(100):
  fly+=l[i]
  if fly<=x:
    count+=1
  else:
    break
print(count)

Submission status: Accepted

Solution code:
from bisect import bisect_right
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = [0]
for i in range(1, n+1):
   d.append(d[i-1]+l[i-1])
cnt = bisect_right(d, x)
print(cnt)