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
cnt = 1
for l in L:
    D += l
    if D > X:
        break
    else:
        cnt += 1
print(cnt)

Submission status: Accepted

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

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

count=0
for i in bound_List:
    if i<=X:
        count+=1
        
print(count)

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
ls = list(map(int, input().split()))
d = 0
ans = 0
for l in ls:
  if d <= x:
    ans += 1
  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()))
D = 0
cnt = 1
for i in range(N):
  D += L[i]
  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()))
ans=1
D=0
for i in range(N):
    D=D+L[i]
    if D<=X:
        ans+=1
    else:
        break
print(ans)

Submission status: Accepted

Solution code:
import bisect as bi
I=lambda:list(map(int,input().split()))
n,x=I()
l=I()
ans=0
t=0
for i in range(1,n):
  l[i]+=l[i-1]
an=bi.bisect(l,x)
print(an+1)

Submission status: Accepted

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

d = 0
count = 0
i = 1
while d <= x and i <= n:
    d = d + l[i - 1]
    count += 1
    i += 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()))
ans=0
a=0
for i in range(n):
    if a<=x:
        ans+=1
        a+=l[i]
    else:
        break
if sum(l)<=x:
    ans+=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = [0] * (n+2)
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:
N,X=map(int,input().split())
L=list(map(int,input().split()))
d=0
i=0
for i in range(N):
  d+=L[i]
  if d<=X:
    i+=1
  else:break
print(i+1)

Submission status: Accepted

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

for i in range(n):
	if D <= x:
		c += 1
	D += L[i]
if D <= x:
	print(c+1)
else:
	print(c)

Submission status: Accepted

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

for i in L:
  if p + i <= X:
    count += 1
    p += i
  else:
    break
    
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

D = [0] * 2
for i in range(2, N+2):
    D.append( D[i-1] + L[i-2] )
    if D[i] > X:
        ans = i-1
        break
if D[-1] <= X:
    ans = N+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 range(n):
    d=d+L[i]
    if d<=x:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
#ABC 130 B
N,X=map(int,input().split())
L= [int(j) for j in input().split()]
cnt=0
d = 0

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

Submission status: Accepted

Solution code:
#ABC 130 B
N,X=map(int,input().split())
L= [int(j) for j in input().split()]
cnt=0
import numpy as np
jump = list(np.cumsum(L))
for j in jump:
    if j <= X:
        cnt+=1
    else:
        break
print(cnt+1)

Submission status: Accepted

Solution code:
#ABC 130 B
N,X=map(int,input().split())
L= [int(j) for j in input().split()]
cnt=0
import numpy as np
jump = list(np.cumsum(L))
for j in jump:
    if j <= 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
c = 1
for i in l:
    d += i
    if(d <= x):c += 1
    else:break
print(c)

Submission status: Accepted

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

# print(d)
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import math
from collections import Counter
import itertools
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################

N,X=MI()
L=LI()
ans = 1
a=0
for i in range(N):
    a+=L[i]
    if a<=X:
        ans+=1
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

    cnt = 0
    for i in range(len(D)):
        if D[i] <= X:
            cnt += 1
    print(cnt)


main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import exit

n,x=map(int,input().split())
L=list(map(int,input().split()))
p=0
res=1

for l in L:
	p+=l
	if p>x:
		print(res)
		exit()
	res+=1
    
print(res)

Submission status: Accepted

Solution code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
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:

from itertools import accumulate

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

b = list(accumulate(l))  # 累積和のリスト

b_n=[int(i) for i in b if i<=x]
print(len(b_n)+1)

Submission status: Accepted

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

D = [0]
tmp = 0
for i in l:
    tmp += i
    D.append(tmp)
    
D = [i for i in D if i <= x]

print(len(D))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    from itertools import takewhile

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

    def accumulate(a):
        s = 0
        yield s
        for x in L:
            s += x
            yield s

    ans = len(tuple(takewhile(lambda s: s <= X, accumulate(L))))

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,m = inpl()
a = [0] + inpl()
acc = itertools.accumulate(a)
res = 0
for i in acc:
    if i <= m:
        res += 1
print(res)

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

count=0
dist=0
L.append(0)

i=0
while dist<=X and count<=N:
    dist+=L[count]
    count+=1
    #print(dist)

print(count)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/abc130/tasks/abc130_b
# 愚直にシミュレーションしてみれば良い
N, X = read_ints()
L = read_ints()
D = [0]
for l in L:
    D.append(D[-1] + l)
print(bisect_right(D, X))

Submission status: Accepted

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

point = 0
ans = 1

for l in L:
    point += l
    if point > x:
        break
    ans += 1

print(ans)

Submission status: Accepted

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

print(counter)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, X = lr()
L = lr()
cnt = 1
cur = 0
for l in L:   
    cur += l
    if cur > X:
        break
    cnt += 1

answer = cnt
print(answer)

Submission status: Accepted

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

for i in range(n):
    dis += L[i]
    if dis <= x:
        bound += 1
    else:
        break

print(bound)

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:
n,x = map(int,input().split())
l = list(map(int,input().split()))
y = 0
ans = 1
for i in range(n):
    y += l[i]
    if x >= y:
        ans += 1
    else:
        break
print(ans)

Submission status: Accepted

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

    print(count)

if __name__ == '__main__':
    solve()

Submission status: Accepted

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

from itertools import groupby, accumulate, product, permutations, combinations
def solve(N,X,L):
    L = accumulate(L)
    ans = 1
    for i,l in enumerate(L):
        if l>X:
            ans += i
            break
    else:
        ans += N
    return ans
print(solve(N,X,L))

Submission status: Accepted

Solution code:
n,x=map(int,input().split())
l=[0]+list(map(int,input().split()))
from itertools import accumulate
d=list(accumulate(l))
# print(l)
# print(d)
ans=0
for dd in d:
  if dd<=x:
    ans+=1
print(ans)

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])
print(sum([j <= x for j in d]))

Submission status: Accepted

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

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())
li = list(map(int,input().split()))
cnt = 0
num = 1
for i in li:
    if cnt + i > x:
        break
    else:
        cnt += i
        num += 1
print(num)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    bound = [0]
    for i in range(1, n+1):
        bound.append(l[i-1]+bound[i-1])
    ans = 0
    for i in range(n+1):
        if bound[i] <= x:
            ans += 1
    print(ans)
resolve()

Submission status: Accepted

Solution code:
n,k=map(int, input().split())
A=[int(i) for i in input().split()]
a = 0
ans = 1

for i in A:
    a+=i
    if a<=k:ans+=1

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    N,X=map(int,readline().split())
    L=list(map(int,readline().split()))

    S=[0]*(N+1)
    for i in range(1,N+1):
        S[i]+=S[i-1]+L[i-1]
    res=0
    for i in range(N+1):
        if S[i]<=X:
            res+=1
        else:
            break
    print(res)
if __name__=="__main__":
    main()

Submission status: Accepted

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

lc = np.cumsum(L, dtype=np.int32)

res = 1
for i in range(N):
    if lc[i] <= X:
        res += 1
print(res)

Submission status: Accepted

Solution code:
def main():
    n, x = map(int, input().split())
    L = list(map(int, input().split()))
    cnt = 1
    tmp = 0
    for i in range(len(L)):
        tmp += L[i]
        if tmp <= x:
            cnt += 1
        else:
            break
    print(cnt)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

tmp = 0
count = 0
for l in L:
    if tmp <= X:
        count += 1
    tmp += l

if tmp <= X:
    count += 1

print (count)

Submission status: Accepted

Solution code:
def main():
    N, X = (int(i) for i in input().split())
    L = [int(i) for i in input().split()]
    from itertools import accumulate
    S = accumulate([0] + L)
    ans = 0
    for s in S:
        if s <= X:
            ans += 1
        else:
            break
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

  print(ans)
  return

if __name__ == "__main__":
  resolve()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N, X = map(int, input().split())
a = list(map(int, input().split()))
t = 0
res = 1
for x in a:
  t += x
  if t > X: break
  res += 1
print(res)

Submission status: Accepted

Solution code:
import sys
import os
import math
import bisect

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)

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


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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))
# map(int, input().split())
# int(input())
# input().split()
# mojiretu = ','.join(str_list)
# sorted(input())

n, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
now = 0
d = []
d.append(0)
for i in range(len(a)):
    d.append(d[i] + a[i])
for k in d:
    if k <= x:
        ans += 1
print(ans)

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())
l = list(map(int, input().split()))
d = [0]*(n+1)
for i in range(n):
    d[i+1] = d[i] + l[i]
count = 0
for i in range(n+1):
    if x >= d[i]:
        count += 1
print(count)

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:
    break
  cnt += 1

print(cnt)

Submission status: Accepted

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

D=[0]
for i in range(N):
    bound = D[-1] + L[i]
    if bound>X:
        break
    D.append(bound)

print(len(D))

Submission status: Accepted

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

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

Submission status: Accepted

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


def cumsum(xs):
    result = [xs[0]]
    for x in xs[1:]:
        result.append(result[-1] + x)
    return result


count = 1
cs = cumsum(L)
for i in cs:
    if X >= i:
        count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

d = 0
cnt = 0
while d <= X:
    cnt += 1
    if cnt == N + 1:
        break
    d += L[cnt-1]
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
a = list(input().split())
ans = 1
t = 0
for num in a:
  s = int(num)
  t += s
  if t <= x:
    ans += 1
  else:
    break
print(ans)

Submission status: Accepted

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

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

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

    print(ans)


if __name__ == '__main__':
    q2()

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[-1] + L[i])
ans = 0
for d in D:
    if d <= X:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys

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

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

Submission status: Accepted

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


d = 0
count = 0

#跳ねる直前からスタート

for i in range(1, N+2):
  if d <= X:
    count = count + 1
    d = d + L[i-1]

print(count)

Submission status: Accepted

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

x = 0
for i in range(N + 1):
    if i == 0:
        x = 0
    else:
        x += L[i - 1]
        if x > X:
            ans = i
            break
        elif i == N:
            ans = N + 1

print(ans)

Submission status: Accepted

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

import sys
# import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product                # product(iter, repeat=n)
from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4


def main():
    mod = 1000000007                  # 10^9+7
    inf = float('inf')
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():  return int(input())
    def mi():  return map(int, input().split())
    def mi_0(): return map(lambda x: int(x)-1, input().split())
    def lmi(): return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():  return list(input())
    
    
    n, x = mi()
    L = lmi()
    a = accumulate(L)
    print(len(list(filter(lambda num: num<=x, a))) + 1)

if __name__ == "__main__":
    main()

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

print(cnt)

Submission status: Accepted

Solution code:
n,x = map(int,input().split())
l_list = list(map(int,input().split()))
count = 1
d = 0
for i in range(n):
  d += l_list[i]
  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()))
d , count = 0 , 0

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

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = 1
bound = 0

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

print(ans)

Submission status: Accepted

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

ans = 1
d = 0
for l in l_list:
    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()))

p = 0
i = 0
ans = 1

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


print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input().split(" ")
n = int(s[0])
x = int(s[1])
L = [0] + list(map(int, input().split(" ")))
dist = 0
ans = 0
for i in range(n+1):
    dist = dist + L[i]
    if dist <= 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
d = 0
for i in range(len(L)):
    d += L[i]
    if d > x:
        break
    cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
n,x = list(map(int,input().split()))
l = list(map(int,input().split()))
l.insert(0,0)
r = 0
n_l = []
for i in l:
    r += i
    n_l.append(r)

ans = 0
for i in n_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()))
ans = 1
l = 0

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

Submission status: Accepted

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

print(cnt+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,x=map(int, input().split()) #i_1 i_2を取得し、iに値を入れる
l= list(map(int, input().split())) #i_1 i_2を取得し、iに値を入れる
sum=0
cnt=1
for i in range(len(l)):
    if sum<x:
        sum+=l[i]
        cnt+=1
    else:
        break
if sum>x:
    print(cnt-1)
else:
    print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,L=map(int,input().split())
A=list(map(int,input().split()))
hane=1
count=0
for i in range(N):
    count+=A[i]
    hane+=1
    if count==L:
        break
    elif count>L:
        hane-=1
        break

print(hane)

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)