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: Wrong Answer

Solution code:
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n, x = map(int, input().split())
    l = [int(li) for li in input().split()]
    d = s = 0

    for i in l:
        if d <= x:
            s += 1
        else:
            break
        d += i

    print(s)


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N,X=map(int,input().split())
ps = [int(i) for i in input().split()]
resum=0
count=0
for i in ps:
    if resum<=X:
        resum+=i
        count+=1
print(count)
exit(0)

Submission status: Wrong Answer

Solution code:

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

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

count = 0
dis = 0

for l in ls:
    new_dis = dis + l
    count += 1
    if(new_dis <= X):
        dis  = new_dis
    else:
        break

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 1
d = 0
while True:
    if ans >= n:
        break
    d += L[ans]
    if d > x:
        break

    ans += 1

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, X = [int(i) for i in input().split()]
ls = [int(i) for i in input().split()]
d = 0
count = 0
for l in ls:
    d += l
    count += 1
    if d > X:
        print(count)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""



"""
import sys


def solve(N, X, L):
    ans = 0
    pos = 0
    while pos <= X and L:
        pos += L.pop(0)
        ans += 1
    return ans


def main(args):
    N, X = map(int, input().split())
    L = [int(l) for l in input().split()]
    ans = solve(N, X, L)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Wrong Answer

Solution code:
n,x = map(int,input().split())
l = list(map(int,input().split()))
d = 0
i = 0
while (d <= x) and (i < n):
  d += l[i]
  i += 1
print(i)

Submission status: Wrong Answer

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

d = 0
counter = 0
for i in l:
    if d>x:
        break
    counter+=1
    d+=i
print(counter)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,X = map(int,input().split())
ans = 0
L_list = list(map(int,input().split()))
D = 0
for i in L_list:
    if D <= X:
        ans += 1
    D += i
print(ans)

Submission status: Wrong Answer

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

D = 0
cnt = 0
for i in L:
    D += i
    cnt += 1
    if D > X:
        break
print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8

import sys
def input(): return sys.stdin.readline().strip()

# N = int(input())
N, X = map(int, input().split())
L = [int(x) for x in input().split()]
# S = input()

ans = 0
now = 0
for l in L:
    if now > X:
        break
    
    now += l
    ans += 1

print(ans)

Submission status: Wrong Answer

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

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

    x += l
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

d = 0
for i,l in enumerate(L):
    d += l
    if d > x:
        break
print(i+1)

Submission status: Wrong Answer

Solution code:
import sys
from collections import Counter, deque, defaultdict

# from itertools import accumulate, permutations, combinations, takewhile, compress, cycle
# from functools import reduce
# from math import ceil, floor, log10, log2, factorial

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7

# N = int(input())
# A = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]
# A = [int(input()) for _ in range(N)]

N, X = [int(x) for x in input().split()]
L = [int(x) for x in input().split()]

cnt = 0
d = 0
for i in range(N):
    if d <= X:
        cnt += 1
    d = d + L[i]

print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, X = map(int, raw_input().split(' '))
L = map(int, raw_input().split(' '))

S = 0
C = 0
for i in range(len(L)):
    if S <= X:
        C += 1
    S += L[i]

print C

Submission status: Wrong Answer

Solution code:
N, X = [int(i) for i in input().split()]
Ls = [int(l) for l in input().split()]
d = 0
res = 0
for i, Li in enumerate(Ls):
    if d <= X:
        res = i+1
    d += Li
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, lim = map(int, input().split())
l = list(map(int, input().split()))

s = 0
c = 0
for i in l:
  s += i
  c += 1
  if (s > lim):
    break

print(c)

Submission status: Wrong Answer

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

count = 0
sum_val = 0
for val in L:
    count += 1
    sum_val += val
    if sum_val > X:
        print(count)
        break

Submission status: Wrong Answer

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

cnt = n
for i in range(n):
    if sum(ls[:i]) > x:
        cnt = i
        break

print(cnt)

Submission status: Wrong Answer

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

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

now = 0
ans = 0
for l in L:
    if now <= X:
        now += l
        ans += 1
    else:
        break
        
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    bounces = 1
    n,x = map(int,input().split())
    L = list(map(int,input().split()))
    d = 0
    for i in range(n):
        d += L[i-1]
        if d > x:
            break
        bounces += 1

    print(bounces)

main()

Submission status: Wrong Answer

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

D = 0
ans = 1

for i in L:
    D += i
    if D < X:
        ans += 1

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, x = (int(i) for i in input().split())
l = [int(i) for i in input().split()]
current = 0
for i, c in enumerate(l):
    current += c
    if current > x:
        print(i+1)
        break

Submission status: Wrong Answer

Solution code:
n, x = (int(i) for i in input().split())
bound = list(int(i) for i in input().split()) 

now=0
kosu=0
for b in bound:
    if now<=x:
        kosu+=1
    now+=b

print(kosu)

Submission status: Wrong Answer

Solution code:
# from sys import exit
N, X = [int(n) for n in input().split()]
L = [int(n) for n in input().split()]
now = 0
ans = 0
for i in range(len(L)):
    ans += 1
    now += L[i]
    if now > X:
        break
print(ans)

Submission status: Wrong Answer

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

i = 0
total = 0
while total <= x:
    total += l[i]
    i += 1

    if i == n:
        break
print(i)

Submission status: Wrong Answer

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

b = 0
ans = 0
for i in l:
    if b <= x: ans += 1
    else: break
    b += i
print(ans)

Submission status: Wrong Answer

Solution code:

(N,M) = (int(i) for i in input().split(" "))
A = [int(i) for i in input().split()]
for i in range(N-1):
	A[i+1] += A[i]
	if A[i+1] > M:
		print(i+2)
		break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

    d += Ls[i]

print(ans)

Submission status: Wrong Answer

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

print(cnt)

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,x = na()
L = na()
ans = 0
a = 0

for i in L:
    ans+=1
    a+=i
    if a > x:
        break

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:


def gcd_core(a, b):
    if b == 0:
        return a
    else:
        return gcd_core(b, a % b)


def gcd(arr):
    g = gcd_core(arr[0], arr[1])
    for i in range(2, len(arr)):
        g = gcd_core(g, arr[i])
    return g

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

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

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 0
count = 0

for i in l:
    if count <= x:
        ans += 1

    count += i

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

N, X = mi()
L = li()

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

print(count)

Submission status: Wrong Answer

Solution code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=0
cnt=0
while d<=x and cnt < n:
    d+=l[cnt]
    cnt+=1
print(cnt)

Submission status: Wrong Answer

Solution code:
N, X = map(int, input().split())
L = [int(s) for s in input().split()]
ans = 1
d = 0
for l in L:
    d += l
    if d > X:
        print(ans)
        exit()
    ans += 1

Submission status: Wrong Answer

Solution code:
n, x = [int(a) for a in input().split()]
l_list = [int(a) for a in input().split()]
for i, l in enumerate(l_list):
    n -= l
    if l < 0:
        print(str(i+1))
        break

Submission status: Wrong Answer

Solution code:
from heapq import heappush, heappop, heapify, heapreplace
from collections import defaultdict


class Solution:
    def main(self):
        N, X = map(int, input().split())
        L = list(map(int, input().split()))
        cum = 0
        res = 0
        for l in L:
            res += 1
            cum += l
            if cum > X:
                break
        print(res)

if __name__ == '__main__':
    Solution().main()

Submission status: Wrong Answer

Solution code:
N, lim = map(int, input().split())
l = list(map(int, input().split()))

s = 0
c = 1
for i in l:
  s += i
  c += 1
  if (s > lim):
    break

print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, x = map(int, input().split())
l_array = [int(x) for x in input().split()]
cnt = 0
now = 0
for l in l_array:
    now+= l
    cnt += 1
    if now > x:
        break
print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

index=0
current = 0
count = 0
while index < len(listL):
    if current <= x:
        count+=1
    current += listL[index]
    index+=1
print(count)

Submission status: Wrong Answer

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

x = 0
score = 0
for i in L:
    if x <= X:
        score += 1
    x += i

print(score)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:


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

    d = 0
    for i, l in enumerate(L):
        d = d + l
        if d > X:
            break
    print(i+1)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

i, Y = 0, 0
while i < N and Y <= X:
    Y += L[i]
    i += 1
print(i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

count = 0
d = 0
for l in L:
    if d <= X:
        count += 1
    else:
        break
    d += l
print(count)

Submission status: Wrong Answer

Solution code:
N,X = map(int, input().split())
L = [int(x) for x in input().split()]

now = 0
result = 0
for l in L:
    if now <= X:
        result += 1
    now += l

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int, X: int, L: "List[int]"):
    d = 0
    ret = 0
    for l in L:
        if d <= X:
            ret += 1
        d += l
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    L = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, X, L)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n,x=map(int,input().split())
listl=list(map(int,input().split()))
sum=0
count=0
for k in range(2,n+1):
  sum+=listl[k-2]
  while sum<=x:
    count+=1
print(count+1)

Submission status: Time Limit Exceeded

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

while True:
    a += 1
    
    if d >= x:
        break
print(a)

Submission status: Time Limit Exceeded

Solution code:
def main():
    n,x = map(int, input().split())
    l = list(map(int, input().split()))
    ans = 1
    max = 0

    while True:
        i = 0
        max += l[i]
        if max < x:
            ans += 1

        i += 1

    print(ans)

main()

Submission status: Time Limit Exceeded

Solution code:
def main():
    n,x = map(int, input().split())
    l = list(map(int, input().split()))
    ans = 1
    
    while True:
        i = 0
        max = l[i] + l[i+1]
        if max < x:
            ans += 1
            
        i += 1
        
    print(ans)

main()

Submission status: Time Limit Exceeded

Solution code:
n,x = map(int, input().split())
L = list(map(int, input().split()))
loc = 0
i = 1
while loc <= x:
    if i < n+1: loc += L[i-1]
    i += 1
print(i-1)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
N,X = map(int,input().split())
L = [int(i) for i in input().split()]
D = [0]

for i in range(N):
    a = D[i]+L[i]
    if(a <= X):
        D.append(a)
    else:
        break

print(len(D))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
Y = list(map(int,input().split()))
Z = [0]*n
a = 0
for i in range(n):
  a +=Y[i]
  Z[i]=a
import bisect
print(1+bisect.bisect_left(Z,x+1))

Submission status: Accepted

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

s = 0
cnt = 1

for l in LS:
  s += l
  if s <= X:
    cnt += 1
  else:
    break

print(cnt)

Submission status: Accepted

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

ans = 0
bound = 0
for i in l:
    bound += i
    ans += 1
    if bound > x:
        break
else:
    ans = n + 1

print(ans)

Submission status: Accepted

Solution code:
N,X = map(int,input().split())
L = list(map(int,input().split()))
List = [0]*(N+1)
for i in range(1,N+1):
    List[i] = List[i-1] + L[i-1]
import bisect  
# A = [i for i in List if i <=X]
# print(len(A))
print(bisect.bisect_left(List,X+1))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

d=0
ans=0
for i in a:
    d+=i
    if d<=x:ans+=1
print(ans+1)

Submission status: Accepted

Solution code:
# nは跳ねる回数　d1 = 1 dn+1 = dn + ln

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

d = 0
count = 1

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

Submission status: Accepted

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

num = 1
s = 0
for i in range(N):
  s += L[i]
  if s > X: break
  num += 1

print(num)

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:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
# AtCoder Beginner Contest 130
# B - Bounding
import bisect

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

accumu_L=[0]

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

# print(accumu_L)

print(bisect.bisect_right(accumu_L,X))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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


ans = 0

d = 0

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

if d <= x:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    N,X=mi()
    L=list(mi())

    d = 0
    ans = 1
    for i in range(N):
        d = d + L[i]
        ans += d <= X

    print(ans)



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import itertools
import bisect

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

a = list(itertools.accumulate(l, initial=0))
print(bisect.bisect_right(a, x))

Submission status: Accepted

Solution code:
n, x = (int(i) for i in input().split())
list_l = [int(j) for j in input().split()]
tmp = 0
count = 0
for i in range(0, n + 1):
    if i == 0:
        pass
    else:
        tmp += list_l[i - 1]
        if tmp > 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
now = 0
for i in range(N):
    if now + L[i] <= X:
        ans += 1
        now += L[i]
    else:
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect

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

D = [0]
for i in range(len(L)):
    D.append(sum(L[:i+1]))
print(bisect.bisect_right(D, X))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
l = list(map(int,input().split()))
wa = 0
d = [0]*(n+3)
d[1]=0
d.pop(0)
wa = 1
for i in range(2,n+2):
  d[i]=d[i-1]+l[i-2]
  if(d[i]>x):
    break
  wa+=1
print(wa)

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
n, x = M()
l = LI()
wa = 0
ans = 1
for i in l:
    wa += i
    if wa <= x:
        ans += 1
    else:
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 1
d = 0
for i in b:
  d += i
  if d <= a[1]:
    c += 1
print(c)

Submission status: Accepted

Solution code:
A,B=map(int,input().split(' '))
l=list(map(int,input().split(' ')))
ans=0
count=1
for i in l:
    ans+=i
    if ans<=B:
        count+=1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, x = list(map(int, input().split()))
arr = list(map(int, input().split()))
if x == 0:
    print(0)
    exit()
sum = 0
count = 1
i = 0
while i < n:
    sum += arr[i]
    i += 1
    if sum <= x:
        count += 1
    else:
        print(count)
        exit()
print(count)

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(len(l)):
    d=d+l[i]
    if d<=x:
        ans+=1
print(ans)

Submission status: Accepted

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

x = 0
ii = 1
for i in ls1:
    x = x + i
    if x > X:
        break
    ii += 1
print(ii)

Submission status: Accepted

Solution code:
a,b=input().split()
a=int(a)
b=int(b)
c=list(map(int,input().split()))
d=0
e=0
for i in range(a):
  if d+c[i]<=b:
    d=d+c[i]
    e=e+1
  else:
    break
print(e+1)

Submission status: Accepted

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