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




Fixed 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)
Buggy code:
n,x=map(int,input().split())
l=list(map(int,input().split()))

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

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

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

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

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

count= 1
l = list(map(int, input().split()))
d = 0
for i in l:
    d = d + i
    if x >= d:
        
        count+=1 
    else:
        break
print(count)
Buggy code:
N,X=[int(x) for x in input().split(' ')]
arr=[int(x) for x in input().split(' ')]
temp=0
for x in range(N):
  if arr[x]+temp>X:
    temp=x
    break
  else:
    temp+=arr[x]
print(temp)

Fixed code:
N,X=[int(x) for x in input().split(' ')]
arr=[int(x) for x in input().split(' ')]
temp=0
flag=0
for x in range(N):
  if arr[x]+temp>X:
    temp=x
    flag=1
    break
  else:
    temp+=arr[x]
if flag:
  print(temp+1)
else:
  print(N+1)
Buggy code:
n, x = list(map(int, input().split()))
llist = list(map(int, input().split()))
kai = 0
tsumu = 0
while tsumu <= x and llist != [] :
    kai += 1
    tsumu += llist.pop(0)
else :
    if llist == [] :
        kai += 1
print(kai)

Fixed code:
n, x = list(map(int, input().split()))
llist = list(map(int, input().split()))
kai = 0
tsumu = 0
while tsumu <= x and llist != [] :
    kai += 1
    tsumu += llist.pop(0)
else :
    if tsumu <= x :
        kai += 1
print(kai)
Buggy code:
X,L=map(int,input().split())
N=input().split()
d=0
ans=0
for i in N:
  d=d+int(i)
  if d<=L:
    ans+=1
print(ans)

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


Fixed code:
N,X = map(int,input().split())
L = list(map(int,input().split()))
List = [0]*(N+1)
for i in range(1,N+1):
    List[i] = List[i-1] + L[i-1]
import bisect  
# A = [i for i in List if i <=X]
# print(len(A))
print(bisect.bisect_left(List,X+1))
Buggy 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):
    if sum > x:
        break
    sum += l[i]
    cnt += 1
    
print(cnt)


Fixed 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)
Buggy code:
n, x = map(int, input().split())
L = list(map(int, input().split()))
d = 0
bound = 1
for l in L:
	d += l
	if d > X:
		break
	bound += 1
print(bound)

Fixed code:
n, x = map(int, input().split())
L = list(map(int, input().split()))
d = 0
bound = 1
for l in L:
	d = d + l
	if d > x:
		break
	bound += 1
print(bound)
Buggy code:
n,x = map(int,input().split())
l = list(map(int,input().split()))

a = 0
b = 1
for i in range(n):
    if(a<=x):
       a += l[i]
       if(a<=x):
           b +=1
           print(b)

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

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


print(b)
Buggy code:
n, x = [int(x) for x in input().split()]
k = 0
ans = 1
for li in input().split():
    k += li
    ans += k <= x

print(ans)

Fixed code:
n, x = [int(x) for x in input().split()]
k = 0
ans = 1
for li in input().split():
    k += int(li)
    ans += k <= x

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

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

for i in range(len(arr)-1):
    if i == 0:
        chk = 0
    else:
        chk = chk + arr[i]

    if chk <= x:
        count =+ 1
    else:
        print(count)
        exit()

 print(count)


Fixed code:
n,x = map(int,input().split())
arr = list(map(int,input().split()))
chk = 0
cnt = 1
for i in range(len(arr)):
    chk = chk + arr[i]

    if chk <= x:
        cnt += 1
    else:
        print(cnt)
        exit()

print(cnt)
Buggy 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
    elif d == x:
        print(count+1)
        quit()
    else:
        print(count)

Fixed 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
    else:
        exit
    exit
print(count)
Buggy code:
def solve():
    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(len([x for x in D if x<=6]))

if __name__ == '__main__':
    solve()

Fixed code:
def solve():
    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(len([x for x in D if x<=X]))

if __name__ == '__main__':
    solve()
Buggy code:
n,x=list(map(int, input().split(" ")))
L=list(map(int, input().split(" ")))
n=0
sum=0
for l in L:
    sum+=l
    n+=1
    if sum>x:
        break
n-=1
print(n)

Fixed code:
n,x=list(map(int, input().split(" ")))
L=list(map(int, input().split(" ")))
count,sum=1,0
for l in L:
    sum+=l
    if sum>x:
        break
    count+=1

print(count)
Buggy code:
N, X = map(int, input().split())
L = list(map(int, input().split()))

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

print(ans)

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

m = 0
ans = 1
for l in L:
    m += l
    if m > X:
        print(ans)
        exit()
    else:
        ans += 1

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

Fixed 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)
Buggy code:
N,X=list(map(int, input().split()))
L=list(map(int, input().split()))
c=1
for i in range(N):
  if L[i]<=X:
    c+=1
print(c)

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

Fixed code:
ans=0
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=0
for i in l:
  d+=i
  if d<=x:ans+=1
print(ans+1)
Buggy code:
N, X = map(int, input())
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)

Fixed 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

print(ans)
Buggy code:
N, limit = map(int, input().split())
bounce = input().split()
b = [0]
count = 0
for i in range(len(bounce)):
  b.append(bounce[i]+i)
  
for j in range(len(b)):
  if b[j] <= limit:
    count += 1
print(count)

Fixed code:
N, limit = map(int, input().split())
bounce = input().split()
b = [0]
count = 0
for i in range(len(bounce)):
  b.append(b[i]+int(bounce[i]))
  
for j in range(len(b)):
  if b[j] <= limit:
    count += 1
print(count)
Buggy code:
N,X=list(map(int,input().split()))
L=list(map(int,input().split()))
cnt=1
d=0
for i in L:
    d+=L[i]
    if d<=X:
        cnt+=1

print(cnt)

Fixed code:
N,X=list(map(int,input().split()))
L=list(map(int,input().split()))
cnt=1
d=0
for i in L:
    d+=i
    if d<=X:
        cnt+=1

print(cnt)
Buggy code:
N,X = map(int,input().split())
L = list(map(int,input().split()))
NOW = 0
c = 0

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

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

for i in L:
  if NOW + i <= X:
    NOW += i
    c += 1
  else:
    break
print(c)
Buggy code:
n,x = map(int, input().split())
l = list(map(int, input().split()))
cnt = 0

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

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

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

bound = [0]
for i in range(N):
    bound += [L[i] + bound[-1]]
    print(bound)

print(bound)

counter = 0
for i in bound:
    if i <= X:
        counter += 1
    else:
        break
print(counter)

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

bound = [0]
for i in range(N):
    bound += [L[i] + bound[-1]]

counter = 0
for i in bound:
    if i <= X:
        counter += 1
    else:
        break
print(counter)
Buggy code:
N, X = map(int, input().split())

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

ans = 0

sum_L = 0


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

print(ans)


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

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

ans = 1

sum_L = 0


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

print(ans)
Buggy code:
N, X = map(int, input().split())
L=[int(i) for i in input().split()] 
# N=4
# X=9
# L=[3,3,3]

a=0
count=1
for i in range(N):
    for j in range(i):
        a+=L[j]
    if(a<=X):
        count+=1
print(count)

Fixed code:
N, X = map(int, input().split())
L=[int(i) for i in input().split()] 
# N=4
# X=9
# L=[3,3,3]

a=0
count=1
for i in range(len(L)):
#     print(i)
#     print(L[i])
    a+=L[i]
#     print(a)
    if(a<=X):
#         print(a)
        count+=1
print(count)
Buggy code:
n, x = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]

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

print(count

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

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

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

Fixed code:
N,X = map(int,input().split())
bound_limit= N+1
L = list(map(int,input().split()))
sum=0
count=1
for i in range(0,len(L)):
  sum+=L[i]
  if sum<=X:
    count+=1
  else:
    break
print(count)
Buggy code:
import sys

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

D = 0

for i in range(0,N):
    D += L[0]
    if D > X :
        print(i)
        sys.exit()

print(N)


Fixed code:
import sys

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

D = 0

for i in range(0,N):
    D += L[i]
    if D > X :
        print(i+1)
        sys.exit()

print(N+1)
Buggy code:
n,x=map(int,input().split())
L = list(map(int, input().split()))
c = 0
D = 0
for i in L:
  	c = c + 1
    D = D + i
    if D > x:
        print(c)
        exit()
if D > x:
  print(c)
else:
  print(c+1)


Fixed code:
n,x=map(int,input().split())
L = list(map(int, input().split()))
c = 1
D = 0
for i in L:	
    D = D + i
    if D > x:
        print(c)
        exit()
    c = c + 1
print(c)
Buggy code:
N,X = map(int,input().split())
L = list(map,input().split())

cnt=1
dist=0

for l in L:
  cnt+=1
  dist+=l
  if dist>=X:
    break
    
print(cnt)
  

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

cnt=1
dist=0

for l in L:
  dist+=l
  if dist>X:
    break
  cnt+=1
    
print(cnt)
Buggy 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 i==n:
        i+=1
print(i)

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

l = []
cnt = 0
l.append(int(0))
for i in range(N):
  l.append(l[i]+L[i])
  if l[i] <= X:
    cnt += 1
if l[-1] <= X:
  cnt += 1
print(l)
print(cnt)
  


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

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


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

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

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


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


Fixed code:
n,k=map(int,input().split())
s=0
l=list(map(int,input().split()))
c=1
for i in range(n):
    s+=l[i]
    if(k<s):
        break
    c+=1
print(c)
Buggy code:
A, B = input().split()
C = input().split()
count = 0
step = 0
for i in range(int(A)):
  step += int(C[i])
  if step > int(B):
    break
  count += 1
print(count)

Fixed code:
A, B = input().split()
C = input().split()
count = 1
step = 0
for i in range(int(A)):
  step += int(C[i])
  if step > int(B):
    break
  count += 1
print(count)
Buggy code:
n, x = map(int, input().split())
l = [0] + list(map(int, input().split()))
d = 0
i = 1
while True:
    if d > x:
        print(i - 1)
        break
    if i == n + 1:
        print(i)
        break
    i += 1
    d += l[i-2]


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

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

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

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

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

if d>x:
    print(cnt)
else:
    print(n+1)
Buggy code:
def resolve():
    (N, X) = list(map(int, input().split(" ")))
    Ls = list(map(int, input().split(" ")))
    cur = 0
    cnt = 0
    for l in Ls:
        if cur > X:
            print(cnt)
            break
        cnt += 1
        cur += l
    print(cnt)

    

if '__main__' == __name__:
    resolve()

Fixed code:
def resolve():
    (N, X) = list(map(int, input().split(" ")))
    Ls = list(map(int, input().split(" ")))
    cur = 0
    cnt = 0
    Ls.insert(0, 0)
    for l in Ls:
        cur += l
        if cur > X:
            print(cnt)
            break
        cnt += 1

    else:
        print(cnt)

    

if '__main__' == __name__:
    resolve()
Buggy code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
s=0
summy=1
for i in l:
    s=int(i)+s
    print(s)
    if x>=int(s):
        summy+=1
print(summy)

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

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

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

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

print(ans)
Buggy code:
n,x=map(int,input().split())

L=[n]

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

first=0
jump=0
for i in L:
    D=first+i
    first=D
    if(D>=x):
        jump+=1

print(jump)


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

L=[n]

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

first=0
jump=1
for i in L:
    D=first+i
    first=D
    if(D<=x):
        jump+=1

print(jump)
Buggy code:
line = input().split()
N = int(line[0])
X = int(line[1])
line = [int(p) for p in input().split()]
pos = 0
count = 0
for i in range(len(line)):
  if pos >= X:
    break
  pos += line[i]
  count+=1
print(count)

Fixed code:
line = input().split()
N = int(line[0])
X = int(line[1])
line = [int(p) for p in input().split()]
pos = 0
count = 1
for i in range(len(line)):
  pos += line[i]
  if pos > X:
    break
  count +=1
print(count)
Buggy code:
n, x = map(int, input().split())
l_array = [int(x) for x in input().split()]
cnt = 0
now = 0
for l in l_array:
    now += l
    cnt += 1
    if now >= x:
        break
print(cnt)


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

ans = 1
d = 0
for j in range(n):
    d += d + L[j]
    if d <= x :
        ans += 1

print(ans)

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

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

print(ans)


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

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

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


Fixed code:
n, x = map(int, input().split())
l = [int(i) for i in input().split()]
s = 1
d = 0
for i in l:
  d = d + i
  if d <= x: 
    s += 1
  else:
    break
print(s)
Buggy code:
def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    [n, x] = li()
    l_list = li()

    bound = 1
    bound_x = 0
    index = 0
    bound_x = bound_x + l_list[index]
    while bound_x <= x and index < len(l_list):
        bound = bound + 1
        bound_x = bound_x + l_list[index]
        index = index + 1
    print(bound)


Fixed code:
def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    [n, x] = li()
    l_list = li()

    bound = 0
    bound_x = 0
    index = 0
    bound = bound + 1
    while bound_x + l_list[index] <= x:
        bound = bound + 1
        bound_x = bound_x + l_list[index]
        index = index + 1
        if index >= len(l_list):
            break

    print(bound)
Buggy code:
#ABC130B-Bounding.py

import sys
from functools import lru_cache

def main():
    N, X = list(map(int,sys.stdin.readline().split()))
    L = list(map(int,sys.stdin.readline().split()))
    print(L)

    @lru_cache(maxsize=None)
    def D(i):
        if i == 1:
            return 0
        elif i <= N+1:
            return D(i-1) + L[i-2]
    for i in range(1,N+2):
        if D(i) > X:
            print(i-1)
            break



if __name__ == "__main__":
    main()


Fixed code:
#ABC130B-Bounding.py

import sys
from functools import lru_cache

def main():
    N, X = list(map(int,sys.stdin.readline().split()))
    L = list(map(int,sys.stdin.readline().split()))

    @lru_cache(maxsize=None)
    def D(i):
        if i == 1:
            return 0
        elif i <= N+1:
            return D(i-1) + L[i-2]

    for i in range(1,N+2):
        if D(i) > X:
            print(i-1)
            break
    else:
        print(N+1)



if __name__ == "__main__":
    main()
Buggy code:
N, X = map(int, input().split())

# List = list([map(int, input().split())] for _ in range(N))
# List = [list(map(int, input().split())) for _ in range(N)]
List = list(map(int, input().split()))
print(List)

ans = 1
sum_x = 0
for i in range(N):
    if(sum_x + List[i] <= X):
        # print(List[i])
        sum_x += List[i]
        ans += 1
# print(sum_x)
print(ans)


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

# List = list([map(int, input().split())] for _ in range(N))
# List = [list(map(int, input().split())) for _ in range(N)]
List = list(map(int, input().split()))
# print(List)

ans = 1
sum_x = 0
for i in range(N):
    if(sum_x + List[i] <= X):
        # print(List[i])
        sum_x += List[i]
        ans += 1
    else:
        break
# print(sum_x)
print(ans)
Buggy code:
# -*- coding: utf-8 -*-
"""
Created on Tue May 12 00:21:28 2020

@author: shinba
"""

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

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

i = 0
ans = 0

for j in range(n):
    if i <= x:
        ans += 1
        i += L[j]
        continue
    else:
        print(ans)
        break
else:
    print(ans+1)


 


Fixed code:
# -*- coding: utf-8 -*-
"""
Created on Tue May 12 00:21:28 2020

@author: shinba
"""

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

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

i = 0
ans = 1

for j in range(n):
    i += L[j]
    if i <= x:
        ans += 1
        continue
    else:
        break

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

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