qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n, x = LI()
l = LI()
cnt = 1
d = 0
for i in range(n):
    print(f'{(d, l[i])=}')
    if d + l[i] <= x:
        cnt += 1
        d += l[i]
    else:
        break
print(cnt)


Fixed code:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n, x = LI()
l = LI()
cnt = 1
d = 0
for i in range(n):
    # print(f'{(d, l[i])=}')
    if d + l[i] <= x:
        cnt += 1
        d += l[i]
    else:
        break
print(cnt)
Buggy code:

url = "https://atcoder.jp//contests/abc130/tasks/abc130_b"

def main():
    n,x = list(map(int, input().split()))
    lis = list(map(int, input().split()))
    count = 0
    pos = 0
    for l in lis:
        if pos >= x:
            print(count)
            exit()
        pos += l
        count += 1

if __name__ == '__main__':
    main()


Fixed code:

url = "https://atcoder.jp//contests/abc130/tasks/abc130_b"

def main():
    n,x = list(map(int, input().split()))
    lis = list(map(int, input().split()))
    lis.insert(0, 0)
    count = 0
    pos = 0
    for l in lis:
        pos += l
        count += 1
        if pos > x:
            print(count-1)
            exit()
    print(count)

if __name__ == '__main__':
    main()
Buggy code:
inp=input().split(' ')
L=input().split(' ')
n=int(inp[0])
l=0;
count =0;
for i in range(n):
  if l<=int(inp[1]):
    count+=1;
    l+=int(L[i])
  else:
    print(count)
if count==n+1:
  print(n+1)

Fixed code:
inp=input().split(' ')
L=input().split(' ')
n=int(inp[0])
l=0;
count=1;
for i in range(n):
  l+=int(L[i])
  if l<=int(inp[1]):
    count+=1
print(count)
Buggy code:
import numpy as np
N,X = map(int,input().split())
L = list(map(int,input().split()))
Lcs = np.array(L)
b_count = 0
for l in Lcs:
  b_count += 1
  if X < l:
    break
print(b_count)

Fixed code:
import numpy as np
N,X = map(int,input().split())
L = list(map(int,input().split()))
La = np.array(L)
Lcs = La.cumsum()
b_count = 1
for l in Lcs:  
  if X < l:
    break
  b_count += 1
print(b_count)
Buggy code:
N,X=map(int,input().split())
L=list(map(int,input().split()))
D=[]
D.append(0)
for i in range(1,N+2):
  D.append(D[i-1]+L[i-1])
s=0
for j in D:
  if j<=X:
    s+=1
print(s)

Fixed code:
N,X=map(int,input().split())
L=list(map(int,input().split()))
D=[]
D.append(0)
for i in range(1,N+1):
  D.append(D[i-1]+L[i-1])
s=0
for j in range(0,N+1):
  if D[j]<=X:
    s+=1
print(s)
Buggy code:
def input_from_console():
    n, x = map(int, input().split())
    l_list = list(map(int, input().split()))
    return n, x, l_list


def solve(n, x, l_list):
    result = 0
    position = 0
    for i in range(n):
        if position > x:
            return result
        result +=1
        position += l_list[i]
    return result + 1



def main():
    n, x, l_list = input_from_console()
    print(solve(n, x, l_list))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()


Fixed code:
def input_from_console():
    n, x = map(int, input().split())
    l_list = list(map(int, input().split()))
    return n, x, l_list


def solve(n, x, l_list):
    result = 0
    position = 0
    for i in range(n):
        if position > x:
            return result
        result +=1
        position += l_list[i]
    if position > x:
        return result 
    else:
        return result + 1



def main():
    n, x, l_list = input_from_console()
    print(solve(n, x, l_list))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()
Buggy code:
n, x = map(int, input().split())
l = list(map(int, input().split()))

cnt = 0
d = 0

while(x >= d):
  d += l[cnt]
  if cnt + 1 == n:
    break
  cnt += 1

print(cnt)


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

cnt = 1
d = 0

while(True):
  if cnt - 1 == n:
    break
  d += l[cnt - 1]
  if d > x:
    break
  cnt += 1

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


Fixed code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
d = 0
count = 0
for i in range(N):
  d += L[i]
  if X < d:
    count = i + 1
    break
if count == 0:
  print(N + 1)
else:
  print(count)
Buggy code:
n,x = map(int,input().split())
a = list(map(int,input().split()))
c = 0
b = 0
for i in a:
    b = i+b
    if b <= x:
        c+=1
print(c)

Fixed code:
n,x = map(int,input().split())
a = list(map(int,input().split()))
c = 1
b = 0
for i in a:
    b = i+b
    if b <= x:
        c+=1
print(c)
Buggy code:
n,x = map(int,input().split())
a = list(map(int,input().split()))
count = 0
b = 0
for i in range(n):
    if b >= x:
        break
    count+=1
    b+= a[i]
print(count)

Fixed code:
n,x = map(int,input().split())
a = list(map(int,input().split()))
a.append(0)
count = 0
b = 0
for i in range(n+1):
    if b > x:
        break
    count+=1
    b+= a[i]
print(count)
Buggy code:
a,b=map(int,input().split())
n = list(map(int, input().split()))
bound=[0]
for i in range(len(n)):
  bound.append(n[i])
  bound[i+1]+=bound[i]
print(len([i for i in bound if i >=b ]))

Fixed code:
a,b=map(int,input().split())
n = list(map(int, input().split()))
bound=[0]
for i in range(len(n)):
  bound.append(n[i])
  bound[i+1]+=bound[i]
#print(bound)
print(len([i for i in bound if i <=b ]))
Buggy code:
n, x = map(int, input().split())
l = [int(x) for x in input().split()]

d = 0
for i in range(len(l)):
  d += l[i]
  if d > x:
    print(i)
    break
else:
  print(len(l))

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

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

ns=0
ans = 1

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

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

ns=0
ans = 1

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

while d<=x:
   if n<=k:
    break
   else:
    d=d+l[k-1]
    k=k+1
  
if n+1<k:
  print(n+1)
else:print(k)
  

Fixed code:
n,x = (int(x) for x in input().split())
l=list(map(int,input().split()))
k=0
d=0

while d<=x:
   if len(l)<=k:
    break
   else:
    d=d+l[k]
    k=k+1
if d<=x:
  print(k+1)
else:print(k)
Buggy code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
ns=1
dis=0
i=0
while dis<=x:
  
  dis+=l[i]
  if dis>x:
    break
  ns+=1
print(ns)

Fixed code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
ns=1
dis=0
i=0
while dis<=x:
  
  dis+=l[i]
  i+=1
  if dis>x:
    break
  elif i==n:
    ns+=1
    break
  ns+=1
print(ns)
Buggy code:
A,D = map(int,input().split())
X = list(map(int,input().split()))
C = [0]
q = 0
for i in range(A):
  if i == 0:
    p = X[0]
    C.append(p)
  else:
    p = p + X[i]
    C.append(p)
for i in C:
  if D <= i:
    q += 1
print(q)

Fixed code:
A,D = map(int,input().split())
X = list(map(int,input().split()))
C = [0]
q = 0
for i in range(A):
  if i == 0:
    p = X[0]
    C.append(p)
  else:
    p = p + X[i]
    C.append(p)
for i in C:
  if D >= i:
    q += 1

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

Fixed code:
N, X = map(int, input().split())
L = [int(i) for i in input().split()]
x = 0
ct = 1
for i in L:
  x += i
  if x > X:
    print(ct)
    break
  else:
    ct += 1
else:
  print(ct)
Buggy code:
N, X = (int(i) for i in input().split())
L = [int(i) for i in input().split()] 
D = [0] * N
C = 0
for i in range(N-1):
	D[i+1] = D[i]+L[i]

for i in range(N):
	if D[i] < X:
		C += 1

print(C)

Fixed code:
N, X = (int(i) for i in input().split())
L = [int(i) for i in input().split()] 
D = [0] * (N+1)
C = 0
for i in range(N):
	D[i+1] = D[i]+L[i]

for i in range(N+1):
	if D[i] <= X:
		C += 1

print(C)
Buggy code:
n, x = map(int, input().split())
l = list(map(int, input().split()))

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

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

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

Fixed 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)
Buggy code:
n, x = map(int, input().split())
l = list(map(int,input().split()))
pos = 0
count = 0
i=0
while pos <= x and i < n:
    pos += l[i]
    count += 1
    i += 1
if i == n:
    count += 1
print(count)

Fixed code:
n, x = map(int, input().split())
l = list(map(int,input().split()))
pos = 0
count = 0
i=0
while pos <= x and i < n:
    pos += l[i]
    count += 1
    i += 1
if i == n and pos <= x:
    count += 1
print(count)
Buggy code:
def main15():
    data = input().split()
    num = []
    for i in range(2):
        num.append(int(data[i]))
    data2 = input().split()
    num2 = []
    for i in range(num[0]):
        num2.append(int(data2[i]))
    length = 0
    result = 1
    for i in range(num[0]):
        length = length + num[2]
        if length > num[1]:
            break
        else:
            result = result + 1
    print(result)

if __name__ == "__main__":
    main15()

Fixed code:
def main15():
    data = input().split()
    num = []
    for i in range(2):
        num.append(int(data[i]))
    data2 = input().split()
    num2 = []
    for i in range(num[0]):
        num2.append(int(data2[i]))
    length = 0
    result = 1
    for i in range(num[0]):
        length = length + num2[i]
        if length > num[1]:
            break
        else:
            result = result + 1
    print(result)

if __name__ == "__main__":
    main15()
Buggy code:
# B - Bounding
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0

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

Fixed code:
# B - Bounding
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0

for i, l in enumerate(L, 1):
    D += l
    if D > X:
        print(i)
        exit()
print(N+1)
Buggy code:
N, X =map(int,input().split())
a = list(map(int,input().split()))
print(a)
x = 0
count = 0
for i in range(len(a)):
    count += 1
    x += a[i]
    if x > X:
        break
print(count)

Fixed code:
N, X =map(int,input().split())
a = list(map(int,input().split()))
x = 0
count = 0
for i in range(len(a)+1):
    count += 1
    if not i == len(a):
        x += a[i]
    else:
        break
    if x > X:
        break
print(count)
Buggy code:
N,X=map(int,input().split())
L=[i for i in map(int,input().split())]
count=1
total=1
for num in L:
    total+=num
    if total>=X:
        print(count)
        break
    count+=1    

Fixed code:
N,X=map(int,input().split())
L=[i for i in map(int,input().split())]
count=1
total=0
for num in L:
    total+=num
    if total>X:
        print(count)
        break
    count+=1
if total<=X:
    print(count)
Buggy code:
N, X = [int(s) for s in input().split()]
Ls = [int(s) for s in input().split()]
d, ans = 0, 0
for l in Ls:
    print(l, d)
    if d <= X:
        ans += 1 
    d += l
print(ans) 


Fixed code:
N, X = [int(s) for s in input().split()]
Ls = [int(s) for s in input().split()]
d, ans = 0, 0
for l in Ls:
    if d <= X:
        ans += 1 
    d += l
if d <= X:
   ans += 1
print(ans)
Buggy code:
(n, x) = map(int, input().split())
l = list(map(int, input().split()))

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

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

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


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

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

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

if x > sum(d):
    ans += 1

print(ans)

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

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

if x >= sum(l):
    ans += 1

print(ans)
Buggy code:
N,X = map(int,input().split())

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

count=1

kazu=0

for i in hr :
    
    kazu += i 
    
    if i <= X:
        count +=1

print(count)

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

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

count=1

kazu=0

for i in hr :
    
    kazu += i 
    
    if kazu <= X:
        count +=1

print(count)
Buggy code:
N,X=list(map(int,input().split()))
i=list(map(int,input().split()))
listD=[0]
d=0

for s in i:
	d=d+s
	if d < X:
		listD.append(d)
        
print(len(listD))

Fixed code:
N,X=list(map(int,input().split()))
i=list(map(int,input().split()))
listD=[0]
d=0

for s in i:
	d=d+s
	if d <= X:
		listD.append(d)
        
print(len(listD))
Buggy code:
N,X = map(int, input().split())
*L, = list(map(int, input().split()))

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


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

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

Fixed code:
N, X = map(int, input().split())
L_list = list(map(int, input().split()))
D = 0
ans = 1
for i in range(N):
    D += L_list[i]
    if D > X:
        break
    else:
        ans += 1
print(ans)
Buggy code:
import sys
input = sys.stdin.readline

n, x = map(int, input().split())
l = list(map(int, input().split()))
sum = 1
for i in range(n):
    sum += l[i]
    if sum > x:
        print(i)
        sys.exit()
print(n+1)

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

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)
Buggy code:
import itertools
N,X = list(map(int,input().split()))
L = list(map(int,input().split()))
L = list(itertools.accumulate(L))
cnt = 0
for l in L:
    if X < L:
        print(cnt)
        exit()
    cnt += 1
print(cnt)

Fixed code:
import itertools
N,X = list(map(int,input().split()))
L = list(map(int,input().split()))
L = [0]+list(itertools.accumulate(L))
cnt = 0
for l in L:
    if X < l:
        print(cnt)
        exit()
    cnt += 1
print(cnt)
Buggy code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
pref_sum = [0]*(N+1)
ans = 0

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

for s in pref_sum:
    if s <= X:
        ans += 1     
print(ans)

Fixed code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
pref_sum = [0]*(N+1)
ans = 0

for i in range(N):
    pref_sum[i+1] = L[i]+pref_sum[i]



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

Fixed code:
n,x = map(int,input().split())
l = list(map(int,input().split()))
d = 0
for i in range(n):
  d = d + l[i]
  if d > x:
    print(i+1)
    exit()
print(n+1)
Buggy code:
import re
import numpy as np

N, X = [int(i) for i in re.split(" ", input())]
Ls = [int(i) for i in re.split(" ", input())]
Ds = np.cumsum(Ls)
counts = np.sum(Ls <= X) + 1
print(counts)

Fixed code:
import re
import numpy as np
 
N, X = [int(i) for i in re.split(" ", input())]
Ls = [int(i) for i in re.split(" ", input())]
Ds = np.cumsum(Ls)
counts = np.sum(Ds <= X) + 1
print(counts)
Buggy code:
n,x=map(int,input().split())
a=list(map(in,input().split()))

ans=1
d=0

for i in a:
  d+=i
  if d>x:
    break
  ans+=1
  
print(ans)

Fixed code:
n,x=map(int,input().split())
a=list(map(int,input().split()))

ans=1
d=0

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

Fixed 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[-1]+l[i-1])

print(len([i for i in d if i <= x]))
Buggy code:
n, x = map(int, input().split())
l = list(map(int, input().split()))

zahyo = 0
count = 1

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

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

zahyo = 0
count = 1

for i in range(1, n+1):
    zahyo = zahyo + l[i-1]
    if zahyo <= x:
        count += 1
print(count)
Buggy code:
N,X = map(int,input().split())
Ls = list(map(int,input().split()))

D = 0
ans = 0

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

print(ans)

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

D = 0
ans = 1

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

print(ans)
Buggy code:
# B - Bounding

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

print(cnt)


Fixed code:
# B - Bounding

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

print(cnt)
Buggy 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)

Fixed 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)
Buggy code:
# -*- coding: utf-8 -*-
"""
AtCoder A
"""

import sys, math, random
import numpy as np

# N = int(input())
# A = list(map(int,input().split())) # N row 1 column
# A = [int(input()) for _ in range(N)] # 1 row N column
# S = str(input()) # str(input()) == input() -> 'abc'
# S = list(input()) # abc -> ['a','b','c']
# S.replace('ABC','X') # "testABCABC" -> "testXX"
 
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
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 main():
    N, X = list(map(int,input().split()))
    L=LI()
    L1=0
    out=1
    for l in L:
        D=L1+l
        print(D)
        if D<X+1:
            out+=1
        L1=D
    print(out)
    
if __name__ == "__main__":
    main()

Fixed code:
# -*- coding: utf-8 -*-
"""
AtCoder A
"""

import sys, math, random
import numpy as np

# N = int(input())
# A = list(map(int,input().split())) # N row 1 column
# A = [int(input()) for _ in range(N)] # 1 row N column
# S = str(input()) # str(input()) == input() -> 'abc'
# S = list(input()) # abc -> ['a','b','c']
# S.replace('ABC','X') # "testABCABC" -> "testXX"
 
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
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 main():
    N, X = list(map(int,input().split()))
    L=LI()
    L1=0
    out=1
    for l in L:
        D=L1+l
        # print(D)
        if D<X+1:
            out+=1
        L1=D
    print(out)
    
if __name__ == "__main__":
    main()
Buggy 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)

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

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

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

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

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

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

count=0
dist=0

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

print(count)

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

D=L[0]

if D>X:
    print(0)
else:
    D=0
    i=1
    count=1
    while D<=X and i<N:
        D+=L[i]
        i+=1
        count+=1
    print(count)
    

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


if L[0]>X:
    print(1)
else:
    D=0
    i=0
    count=1
    while D<=X and i<=N-1:
        if D+L[i]<=X:
            D+=L[i]
            i+=1
            count+=1
        else:
            break
    print(count)
Buggy code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
H = 0
ans = 0

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

Fixed code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
H = 0
ans = 0

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

print(ans+1)