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()));d=[0]*(n+1)
for i in range(1,n+1): d[i]=d[i-1]+l[i-1]
print(sum([i<=x for i in d]))

Submission status: Accepted

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

def main():

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

    D = 0
    ans = 0

    if D <= X:
        ans += 1

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

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

N, X = map(int, input().split())
L = list(map(int, sys.stdin.readline().rsplit()))

d = 0
res = 1
for l in L:
    if d + l > X:
        break
    d += l
    res += 1

print(res)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect

N,X=map(int,input().split())
L=list(map(int,input().split()))
sumL=[0]
for i in range(N):
    sumL.append(sumL[i]+L[i])
print(bisect.bisect_right(sumL,X))

Submission status: Accepted

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

Submission status: Accepted

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

# B - Bounding /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 200点

# 問題文
# 数直線上を N+1回跳ねるボールがあり、1 回目は 座標 D1=0, i 回目は 座標 Di=Di−1+Li−1(2≤i≤N+1)で跳ねます。
# 数直線の座標が X以下の領域でボールが跳ねる回数は何回でしょうか。

# 制約
#     1≤N≤100
#     1≤Li≤100
#     1≤X≤10000
#     入力は全て整数である

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N X
# L1 L2 ... LN−1 LN

# 出力
# 数直線の座標が X以下の領域でボールが跳ねる回数を出力せよ。

# 入力例 1
# 3 6
# 3 4 5

# 出力例 1
# 2

# ボールは順に座標 0,3,7,12で跳ねるので、座標 6 以下の領域で跳ねる回数は 2回です。

# 入力例 2
# 4 9
# 3 3 3 3

# 出力例 2
# 4

# ボールは順に座標 0,3,6,9,12で跳ねるので、座標 9 以下の領域で跳ねる回数は 4 回です。


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    # S = lines[0]
    # N = int(lines[0])
    N, X = list(map(int, lines[0].split()))
    values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(6):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(M):
    #     valueses.append(list(map(int, lines[i+1].split())))

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

    return [cnt]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['3 6', '3 4 5']
        lines_export = [2]
    if pattern == 2:
        lines_input = ['4 9', '3 3 3 3']
        lines_export = [4]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

d=0

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

if d<x+1:
    count +=1

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

main()

Submission status: Accepted

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

ans =1
height=0
for i in range(N):
    height += arr[i]
    if height > X:
        break
    ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 1
position = 0

for i in range(n):
    position += l[i]
    if position <= 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
ans=1
for i in range(n):
  cnt+=l[i]
  if cnt<=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
ans = 1

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

Submission status: Accepted

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

coordinate = 0
count = 0

while count < N:
    coordinate += L[count]
    if coordinate > X:
        break
    else:
        count += 1

print(count+1)

Submission status: Accepted

Solution code:
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 + D
    if D <= X:
        ans += 1

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

Submission status: Accepted

Solution code:
N,X=map(int,input().split())
List = list(map(int, input().split()))
height = 0
res = 1
def checkF(k,x):
  if k>x:
    return True
  else:
    return False
    
for i in range(N):
  height += List[i]
  res +=1
  if checkF(height,X):
    res = res-1
    break
print(res)

Submission status: Accepted

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

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(0,N):
    D.append(D[i]+L[i])
    if D[i+1] > X:
        break
    else:
        ans += 1

print(ans)

Submission status: Accepted

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

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

d = 0
ans = 1

for l in ll:
    d += l

    if d > x:
        break


    ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,X = map(int,input().split())
l = list(map(int,input().split()))
p = 0
count = 1

for i in l:
    p += i
    count += 1
    if p > X:
        count -= 1
        break
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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
sum = 0
for i in range(n):
    sum += l[i]
    if sum > x:
        break
    cnt += 1
    
print(cnt)

Submission status: Accepted

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

sum = 0
cnt = 1
for i in range(0,len(l)):
    sum += l[i]
    if sum <= x:
        cnt += 1
print(cnt)

Submission status: Accepted

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

cnt = 1
a = 0
for i in range(0, len(l)):
  a += l[i]
  if a <= x:
    cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int, input().split())
c=list(map(int, input().split())) 
x = 0
ans = 1

for i in c:
    x += i
    if x <= b:
        ans += 1
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 += l[i]
  if d<=x:
    count+=1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,X=map(int,input().split())
p=0
cnt=1
for i in map(int,input().split()):
 p+=i
 if (X<p):break
 cnt+=1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
N, X = map(int, input().split())
L = list(map(int, input().split()))
L = list(itertools.accumulate(L))
print(sum([i <= X for i in L]) + 1)

Submission status: Accepted

Solution code:
import sys
N,X = map(int,input().split())
array = list(map(int,input().split()))

count = 1
point = 0
for I in range(len(array)):
    point += array[I]
    if point <= X:
        count += 1
    else:
        break
print(count)

Submission status: Accepted

Solution code:
import sys
N,X = map(int,input().split())
array = list(map(int,input().split()))

count = 1
point = 0
for I in range(len(array)):
    point = point + array[I]
    if point <= X:
        count += 1
    else:
        break
print(count)

Submission status: Accepted

Solution code:
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

N, X = rl()
L = rl()

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

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

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]
ans = sum(d[i] <= x for i in range(n+1))
print(ans)

Submission status: Accepted

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

ans = 1
D_i = 0
for l in L:
  D_i += l
  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()))
i=z=0
while z<=x and i<n:
    z+=l[i]
    i+=1
if z<=x:
    i+=1
print(i)

Submission status: Accepted

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

curCoord = 0
n = 1

while (curCoord<=X):
    n = n+1
    
    if (n>N+1):
        break
    else:
        curCoord = curCoord+L[n-2]

print(n-1)

Submission status: Accepted

Solution code:
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))
  
n,x=input2()
L=input_array()

D=0
flag=True
for i in range(1,n+1):
	D+=L[i-1]
	if D>x:
		print(i)
		flag=False
		break
if flag:
	print(n+1)

Submission status: Accepted

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

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

Submission status: Accepted

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

s = 0
S = []
for i in range(N+1):
    s += L[i]
    S.append(s)

c = 0
for s in S:
    if s <= X:
        c += 1
print(c)

Submission status: Accepted

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

reach = 0
for i, v in enumerate(L):
  reach += v
  if reach > x:
    print(i + 1)
    exit()
print(n + 1)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque, defaultdict
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations,product#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import reduce,lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printe(*x):print("## ",*x,file=sys.stderr)
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reverse=True)  #二個目の要素で降順並び替え

    #N = int(input())
    N, K = map(int, input().split())
    A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列

    cur=0
    ans=1
    for a in A:
        cur+=a
        if cur<=K:
            ans+=1
    print(ans)




if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

dist = np.zeros(N+1, dtype=int)
for i in range(N):
  dist[i+1] = dist[i] + L[i]

i = 0
count = 0
while dist[i] <= X:
  count += 1
  i += 1
  if i == N +1:
    break
print(count)
"""
dist = 0
count = 1
for i in range(N):
  if dist + L[i] <= X:
    count += 1
    dist += L[i]
print(count)
"""

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
l = [0] + list(map(int, input().split()))
d = [0]

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

cnt = 0
for i in d:
    if i <= X:
      cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
import itertools
n,x=map(int,input().split())
l=list(map(int,input().split()))
cumsum=[0]+list(itertools.accumulate(l)) # 累積和
cnt=0
for c in cumsum:
    if c<=x:
        cnt+=1
print(cnt)

Submission status: Accepted

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: Accepted

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

Submission status: Accepted

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

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:
N, X = map(int,input().split())
L = list(map(int,input().split()))
D = 0
cnt = 1

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

print(cnt)

Submission status: Accepted

Solution code:
def main():
    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
        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
d = 0
for l in L:
    d += l
    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
ans=1
for i in L:
    D+=i
    if D<=X:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n, x = map(int, input().split())
    l = list(map(int, input().split()))
    ans = 0
    cumsum = [0] * (n + 1)
    for i in range(len(l)):
        cumsum[i+1] = cumsum[i] + l[i]
    for i in cumsum:
        if i <= x:
            ans += 1
        else:
            break
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

_, x = rm()
li = rl()
cnt = 0
d = 0
for i in li:
  d += i
  if d <= x:
    cnt += 1
print(cnt + 1)

Submission status: Accepted

Solution code:
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 = 0
for j in d:
    if j <= 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 = d + l[i]
    if d <= X:
        count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

N, X = I()
L = [0] + l()
l = list(itertools.accumulate(L))

for i in l:
    if i <= X:
        count += 1

print(count)

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
l_lst = list(map(int,input().split()))
b = 0
sum_l = 0
for l in l_lst:
  b+=1
  sum_l += l
  if sum_l > x:
    break
if sum_l <= x:
  b+=1

print(b)

Submission status: Accepted

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


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

    N, X = il()
    L = il()
    d, ret = 0, 1
    for l in L:
        d += l
        if d <= X:
            ret += 1
        else:
            break
    print(ret)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

N,X = list(map(int,input().split()))
L = list(map(int,input().split()))
bn = [0]
for i in range(N):
    bn.append(bn[-1]+L[i])
print(bisect.bisect_right(bn,X))

Submission status: Accepted

Solution code:
read = lambda: list(map(int, input().split()))
n, x = read()
l = read()
s = 0
ans = 1
for ind, d in enumerate(l):
    s += d
    if s > x:
        break
    ans += 1
print(ans)

Submission status: Accepted

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


while d<=X:
    ans+=1
    d+=L[i]
    i+=1
    if i==N:
        if d<=X:
            ans+=1
        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):
  if d+l[i] <= x:
    d += l[i]
    ans += 1
  else:
    break
print(ans)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, X = mapint()
Ls = list(mapint())

now = 0
cnt = 0
for l in Ls:
    if now>X:
        break
    now += l
    cnt += 1
else:
    if now<=X:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
import sys
import itertools
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def Main():
    n,x = IL()
    l = [0]+list(IL())
    l = list(itertools.accumulate(l))
    ans = 0
    for rep in l:
        if x<rep:   break
        ans += 1
    print(ans)
    return

if __name__=='__main__':
    Main()

Submission status: Accepted

Solution code:
# abc130_b.py

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

Submission status: Accepted

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

cnt = 1
now = 0
for i in range(N):
    l = now + lst[i]
    if l > X:
        break
    else:
        cnt += 1
        now = l
    

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import collections
import fractions
import itertools

def solve():
    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:
            break
        ans += 1
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

d = 0
cnt = 1

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

print(cnt)

Submission status: Accepted

Solution code:
N,X = map(int,input().split())
L = list(map(int,input().split()))
l = [0]
for a in L:
    l.append(l[-1] + a)
print(len([1 for c in l if c <= X]))

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

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 += L[i]
    if d <= 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
a = 1

for n in range(N):
  D+=L[n]
  if D<=X:
    a+=1

print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,X = (int(x) for x in input().split())
L = [int(x) for x in input().split()]
Bound = sum(sum(L[:x])<=X for x in range(0,N+1))
print(Bound)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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