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 .

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l():
    return list(map(int,input().split()))
def m():
    return map(int,input().split())
def onem():
    return int(input())
def s(x):
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa == x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x):
    return " ".join(map(str,x))

n,x = m()
l = l()

co = 0

ans = 1

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

print(ans)

Solution (Python):


x,a=map(int,input().split())
t=list(map(int,input().split()))
count=1
for y in t:
    a-=y
    if a>=0:
        count+=1
print(count)

Solution (Python):
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n, x = li()
l = list(li())

cur = 0
ans = 1

for lli in l:
    cur += lli
    if cur <= x:
        ans += 1

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
ri = lambda: int(input())


rl = lambda: map(int,input().split())
rr = lambda N: [list(l) for l in zip(*[rl() for _ in range(N)])]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
MOD = 10**9+7

N,X=rl()
L=list(rl())
ans = 1
D = 0
for l in L:
    D += l
    if D <= X:
        ans += 1
    else:
        break

print(ans)

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

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

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

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

print(cnt)

Solution (Python):
N, X = map(int, input().split())
*L, = map(int, input().split())
D = 0
ans = 1
for l in L:
    D += l
    if D <= X:
        ans += 1
print(ans)

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

Solution (Python):
import sys
input = sys.stdin.readline


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

L=list(map(int,input().split()))
D=[0]

for l in L:
    D.append(D[-1]+l)

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

Solution (Python):

import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop

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

    ans = 1
    pos = [0] * (N + 1)
    for i in range(N):
        pos[i + 1] = pos[i] + L[i]
        if pos[i + 1] <= X:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
N, X = map(int, input().split())
L = list(map(int, input().split()))
ans = 0
D = 0

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

print(ans + 1)

Solution (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

import random
import collections
import math
import itertools
import bisect

def real_main():
    n, x = read_int_array()
    ls = read_int_array()
    ans = 1
    pos = 0
    for d in ls:
        pos += d
        if pos <= x:
            ans += 1
        else:
            break
    print(ans)



def solve():
    pass


def main():
    if False and 'PYCHARM_HOSTED' in os.environ:
        main_pycharm()
    else:
        real_main()


from copy import deepcopy
def main_pycharm():
    solution = solve

    test_inputs = None
    test_outputs = None
    judge = None
    slow_solution = None
    if solution is not None:
        if test_outputs is not None:
            test_with_answers(solution, test_inputs, test_outputs)
        if judge is not None:
            test_with_judge(solution, test_inputs, judge)
        if slow_solution is not None:
            test_with_slow_solution(solution, test_inputs, slow_solution)


def test_with_answers(solution, inputs_answers):
    total, wrong = 0, 0
    for args, test_ans in inputs_answers:
        ans = solution(*args.copy())
        if ans != test_ans:
            print('WRONG! ans=%s, test_ans=%s, args=%s' % (ans, test_ans, args))
            wrong += 1
        else:
            print('GOOD')
        total += 1
    print('ALL %d TESTS PASSED' % total if not wrong else '%d out of %d tests are WRONG' % (wrong, total))


def test_with_judge(solution, inputs_gen, judge):
    total, wrong = 0, 0
    for args in inputs_gen:
        ans = solution(*deepcopy(args))
        if not judge(deepcopy(ans), *deepcopy(args)):
            print('WRONG! ans=%s, args=%s' % (ans, args))
            wrong += 1
        total += 1
    print('ALL %d TESTS PASSED' % total if not wrong else '%d out of %d tests are WRONG' % (wrong, total))


def test_with_slow_solution(solution, inputs_gen, solution_slow):
    total, wrong = 0, 0
    for args in inputs_gen:
        ans = solution(*deepcopy(args))
        slow = solution_slow(*deepcopy(args))
        if ans != slow:
            print('WRONG! ans=%s, slow=%s, args=%s' % (ans, slow, args))
            wrong += 1
        total += 1
    print('ALL %d TESTS PASSED' % total if not wrong else '%d out of %d tests are WRONG' % (wrong, total))




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")

def read():
    return input()

def read_int():
    return int(input())

def read_array(sep=None, maxsplit=-1):
    return input().split(sep, maxsplit)

def read_int_array():
    return [int(a) for a in read_array()]



if __name__ == "__main__":
    main()

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

Solution (Python):

import sys
from itertools import accumulate
INF = float("inf")


def solve(N: int, X: int, L: "List[int]"):
    D = [0]+list(accumulate(L))
    count = 0
    for d in D:
        if d <= X:
            count += 1
    print(count)
    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))  
    X = int(next(tokens))  
    L = [int(next(tokens)) for _ in range(N)]  
    solve(N, X, L)


if __name__ == '__main__':
    main()

Solution (Python):
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N, X = nl()
Ls = nl()

count = 1
p = 0
for i in range(N):
    p = p + Ls[i]
    if p <= X:
        count += 1

print(count)

Solution (Python):
n,x=map(int,input().split())
arr=list(map(int,input().split()))
ans=[0]*(100000)
pos=0
for i in range(n):
  pos+=arr[i]
  ans[pos]=1
cnt=1
for i in range(x+1):
  if ans[i]==1:
    cnt+=1
print(cnt)

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def YesNo(x): return 'Yes' if x else 'No'
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    N, X = LI()
    L = LI()
    ans = 1
    d = 0
    for l in L:
        d += l
        if d > X:
            break
        ans += 1
    return ans

print(main())

Solution (Python):
N, X = map(int, input().split())
ans = 1
now = 0
for l in map(int, input().split()):
    now += l
    if now <= X:
        ans += 1
print(ans)

Solution (Python):
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import string
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")









N, X = list(map(int, sys.stdin.readline().split()))
L = list(map(int, sys.stdin.readline().split()))
L = np.array(L)

cs = L.cumsum()
print((cs <= X).sum() + 1)

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007


def A():
    x,n = LI()
    if x < n:
        print(0)
    else:
        print(10)
    return


def B():
    n,x = LI()
    l = LI()
    d = 0
    ans = 1
    for i in range(n):
        d += l[i]
        if d <= x:
            ans += 1
    print(ans)
    return


def C():
    n = I()

    return


def D():
    n = I()

    return


def E():
    n = I()

    return


def F():
    n = I()

    return


if __name__ == "__main__":
    B()

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

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

print(num)

Solution (Python):
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)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def main():
    n,x = LI()
    a = LI()
    r = 1
    t = 0
    for c in a:
        t += c
        if t <= x:
            r += 1

    return r


print(main())

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

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

Solution (Python):


from collections import deque
import itertools as ite
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

N, X = map(int, raw_input().split())
L = map(int, raw_input().split())
ans = 1
cur = 0
for num in L:
    cur += num
    if cur <= X:
        ans += 1
print ans

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

p = [0]
for i in l:
    p.append(p[-1] + i)

res = 0
for i in p:
    if i <= x:
        res += 1
print(res)

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

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

print(ans)

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

print(ans)