qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n, x = list(map(int, input().split()))
l = input()
ans = 1
cnt = 0

l_list = l.split(' ')

for i in l_list:
    cnt += i
    if cnt > x:
        break
    ans += 1

print (ans)


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

l_list = l.split(' ')

for i in l_list:
    cnt += int(i)
    if cnt > x:
        break
    ans += 1

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

Fixed code:
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 1
d = 0
for i in b:
  d += i
  if d <= a[1]:
    c += 1
print(c)
Buggy code:
n,k=map(int, input().split(' '))
a=list(map(int, input().split(' ')))
ans,s=0,0
for i in a:
  if(s<=k) ans+=1
  else break
  s+=i
print(ans)


Fixed code:
n,k=map(int, input().split(' '))
a=list(map(int, input().split(' ')))
ans,s=0,0
for i in a:
  if s<=k: ans+=1
  else: break
  s+=i

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

Fixed code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
count = 1
location = 0
for i in range(N):
    if location + L[i] <= X:
        count += 1
        location += L[i]
    else:
        break
print(count)
Buggy code:
n,x = map(int,input().split())
l = [ int(i) for i in input().split() ]
st = 0
cnt = 1
for i range(0,n):
  st += l[i]
  if st > x:
    break
  cnt += 1
print(cnt)

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

d = 0
if x > 0:
    for i in range(n):
        d = d + l[i]
        print(i, l[i])
        if d > x:
            break
    print(i+1)
elif x <= 0:
    print(1)
'''

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

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

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

print(bnd)

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


Fixed code:
N,X = map(int, input().split())
D=0
L=list(map(int, input().split()))
i=0
while (D<=X)and(i<N+1):
  if (i<N):
    D+=L[i]
  i+=1
#  if i>N:
 #   break
print(i)
Buggy code:
n,x = map(int.input().split())
l = list(map(int,input().split()))
sum = 0
ans = 0
for i in l:
  sum += i
  if sum <= x:
    ans += 1
    
  

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

bound = 1
coordinate = 0

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

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

bound = 1
coordinate = 0

for i in L:
	coordinate += i
	
	if coordinate <= X:
		bound += 1
	else:
		break
		
print(bound)
Buggy code:
n, x = map(int, input().split())

d = 0
for i, l in enumerate(input().split()):
  d += int(l)
  if d > x:
    print(i)
    break
else:
  prin(n)

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

d = 0
for i, l in enumerate(input().split()):
  d += int(l)
  if d > x:
    print(i + 1)
    break
else:
  print(n + 1)
Buggy code:
N, X = map(int, input().split())

list_l = [int(x) for x in input().split()]

position = 0
count = 0

for l in list_l:
    position += l
    if position <= X:
        count += 1

print(count)


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

list_l = [int(x) for x in input().split()]

position = 0
count = 1

for l in list_l:
    position += l
    if position <= X:
        count += 1

print(count)
Buggy code:
a,b=input().split()
a=int(a)
b=int(b)
c=list(map(int,input().split()))
d=0
e=1
for i in range(a):
  while d<b:
    d=d+c[i]
    e=e+1
  print(e)
  break

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

Fixed code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
count = 1
for i in L:
  D += i
  if X < D:
    break
  count += 1
print(count)
Buggy code:
N, X = map(int, input().split())
L = list(map(int, input().split()))

x = 0
i = 0

while x <= X :
    x += L[i]
    i += 1
    if i == N-1:
        break
    
print(i)

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

x = 0
i = 0

while x <= X :
    if i == N:
        i += 1
        break
    x += L[i]
    i += 1

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

Fixed code:
n,x =map(int,input().split())
l1=list(map(int,input().split()))
l2=[0]
for i in range(n):
  l2.append(l2[i]+l1[i])
ans=0
i=0
while i<len(l2):
  if l2[i]<=x:
    ans+=1
  i+=1
print(ans)
Buggy code:
n,x = map(int,input().split())
li = list(map(int,input().split()))
count = 1
kyori
for i in li:
  kyori = kyori + i
  count += 1
  if kyori > x:
    break
print(count-1)

Fixed code:
n,x = map(int,input().split())
li = list(map(int,input().split()))
count = 1
kyori = 0
for i in li:
  kyori = kyori + i
  count += 1
  if kyori > x:
    count -=1
    break
print(count)
Buggy code:
n,x = map(int,input().split())
li = list(map(int,input().split()))

d = 0
ans = 0

for i in range(n):
    if d <= x:
        ans += 1
        d += li[i]
    else
        d += li[i]

return(ans)

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

d = 0
ans = 0

if d <= x:
    ans = 1
else:
    ans = 0

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

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

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

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

s=0
count=1
for val in range(len(nums)):
    if s+nums[val] < x:
        s += nums[val]
        count += 1
    
print(count)

Fixed code:
n,x = map(int,input().split())
 
nums = list(map(int,input().split()))
 
s=0
count=1
for val in range(len(nums)):
    s = s+nums[val]
    if s <= x:
        count += 1
    
print(count)
Buggy code:
N, X = map(int, input().split())
L = list(map(int, input().split()))

c = 0
d = 0
for i in range(0, len(L)):
  c += 1
  d += L[i-1]
  
  if d >= X:
    break
    
print(c)
  

Fixed code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
 
c = 1
d = 0
for i in range(0, len(L)):
  d += L[i]
  
  if d > X:
    break
  else:
    c += 1
    
print(c)
Buggy code:
from sys import exit
n,x=map(int,input().split())

l=tuple(map(int,input().split()))
d=[0 for i in range(n+2)]


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


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

l=tuple(map(int,input().split()))
d=[0 for i in range(n+2)]


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

D = 0
count = 1

for l in L:
    D += l

    if D <= X:
        count += 1

    else:
        breakXh

print(count)


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

D = 0
count = 1

for l in L:
    D += l

    if D <= X:
        count += 1

    else:
        break

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


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

Fixed code:
a,b=map(int,input().split())
l=list(map(int,input().split()))
c=1
d=0
r=len(l)
for i in range(r):
    d=d+l[i]
    if d<=b:
        c=c+1
 
        
print(c)
Buggy code:
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n,x=na()
l=na()

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

Fixed code:
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n,x=na()
l=na()
l.append(0)

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


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

D=[0]*(N-1)

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

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

D=[0]*(N+1)

D[0]=0
count=1
for i in range(1,N+1):
  D[i]=D[i-1]+L[i-1]
  if D[i]<=X:
    count+=1
  else:
    break
print(count)
Buggy code:
n,x = map(int,input().split())
l = [int(i) for i in input().split()]
pre = 0
res = 0
for i in range(n):
  res += 1
  if pre > x:
    print(res)
    break
  pre += l[i]

Fixed code:
n,x = map(int,input().split())
l = [int(i) for i in input().split()]
pre = 0
res = 1
for i in range(n):
  pre += l[i]
  if pre > x:
    break
  res += 1
 
print(res)
Buggy code:
N, X = map(int,input().split())
L = list(map(int,input().split()))
D = [0] * (N+1)
count = 0
D[0] = 0
for i in range(1,N+1):
    D[i] = D[i-1] + L[i-1]
    if D[i] <= X:
        count += 1
print(count)


Fixed code:
N, X = map(int,input().split())
L = list(map(int,input().split()))
D = [0] * (N+1)
count = 1
D[0] = 0
for i in range(1,N+1):
    D[i] = D[i-1] + L[i-1]
    if D[i] <= X:
        count += 1
print(count)
Buggy code:
N = [int(i) for i in input().split()]
K = [int(i) for i in input().split()]
s = 0
c = 1
for i in K:
	if (i + s) <= N[1]
  		c += 1
      	s += i + s
	else
    	break
print(c)


Fixed code:
N = [int(i) for i in input().split()]
K = [int(i) for i in input().split()]
s = 0
c = 1
for i in K:
    s += i
    if s > N[1]:
        break
    else:
        c += 1
print(c)
Buggy code:
n, x = map(int,input().split())

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

ans = int(1)
t = int(0)
for i in range(n):
    t += L[i]
    if t <= x:
        ans += 1

print(ans)

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

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

ans = int(1)
t = int(0)
for i in range(n):
    t += int(L[i])
    if t <= x:
        ans += 1

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


Fixed code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=[0]*(n+1)
ans=0
for i in range(n):
  d[i+1]=d[i]+l[i]
for i in range(n+1):
  if d[i]<=x:
    ans+=1
print(ans)
Buggy code:
n,x=map(int,input().split())
L=list(map(int,input().split()))
D=[0]*(N+1)
o=True
for i in range(n):
    D[i+1]=D[i]+L[i]
for i in range(len(D)):
    if D[i]>x:
        print(i)
        o=False
        break
if o:
    print(n+1)

Fixed code:
n,x=map(int,input().split())
L=list(map(int,input().split()))
D=[0]*(n+1)
o=True
for i in range(n):
    D[i+1]=D[i]+L[i]
for i in range(len(D)):
    if D[i]>x:
        print(i)
        o=False
        break
if o:
    print(n+1)
Buggy code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
b=0
cnt=0
for i in l:
  b+=i
  cnt+=1
  if b>x:
    print(cnt)
    break
print(n)

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

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

cnt = 0
ans = [0]

for i in l:
    cnt += i
    if cnt <= x:
        ans.append(cnt)
print(ans)

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

cnt = 0
ans = [0]

for i in l:
    cnt += i
    if cnt <= x:
        ans.append(cnt)
print(len(ans))
Buggy code:
N,X=map(int,input().split())
L = [int(i) for i in input().split()] 

a=0
for i in range(N+1):
    a+=i
    if a > X:
        ans=i
        break

print(i)
        

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

print(ans)
Buggy code:
n, x = map(int, input().split())
l = list(map(int, input().split()))
count = 0
for a in l:
  count += 1
  if(x-a) < 0:
    break

print(count)

Fixed code:
n, x = map(int, input().split())
l = list(map(int, input().split()))
count = 1
for a in l:
  if(x-a) < 0:
    break
  x -= a
  count += 1
print(count)
Buggy code:
n, x = map(int, input().split())
l = list(map(int, input().split()))

a = 1

s = 0
for i in l:
    s = s + i
    if s >= x: break
    a = a + 1

print(a)



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

a = 1

s = 0
for i in l:
    s = s + i
    if s > x: break
    a = a + 1

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

sum = 0
cnt = 1
for i in lst:
  sum += i
  if (sum < X):
    cnt += 1
  else:
    break
    
print(cnt)
  

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

sum = 0
cnt = 1
for i in lst:
  sum += i
  if (sum <= X):
    cnt += 1
  else:
    break
    
print(cnt)
Buggy code:
n, x = map(int, input().split())
ls = input().split()
count = 0
sum = 0
for i in range(0, n):
    l = int(ls[i])
    if sum < x:
        count += 1
        sum += l


Fixed code:
n, x = map(int, input().split())
ls = input().split()
count = 1
sum = 0
for i in range(0, n):
    l = int(ls[i])
    sum += l
    if sum <= x:
        count += 1
print(count)
Buggy code:
#
import sys

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

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

Fixed code:
#
import sys

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

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

D=0
c=1

for i in range(N):
    D=D+L[i]
    if D<X:
        c=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 range(N):
    D=D+L[i]
    if D<=X:
        c=c+1
    else: break

print(c)
Buggy code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
ans,d=0,0

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


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

    ans = 0
    D = 0
    for i in range(N):
        D = D + L[i]
        if D > X:
            break
        ans+=1
    return ans
    
if __name__ == '__main__':
    print(main())


Fixed code:
def main():
    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
        
    return ans
    
if __name__ == '__main__':
    print(main())
Buggy code:
n,x=map(int, input().split())
l=list(map(int,input().split()))
d=0
b=1
for i in range(n):
    print(i)
    d+=l[i]
    if d <= x:
        b+=1
print(b)

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

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

if now <= X:
    a += 1


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

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

if now <= X:
    a += 1

print(a)
Buggy code:
n, x = map(int, input().split())
L = [l for l in map(int, input().split())]

dist = 0

for (i, v) in enumerate(L):
  dist += v
  print(dist)
  if dist <= x:
    continue
  else:
    break
    
print(i+1)



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

dist = 0
num = 1

for (i, v) in enumerate(L):
  dist += v
  if dist <= x:
    num += 1
    continue
  else:
    break
    
print(num)
Buggy code:
N, X = map(int, input().split())
num = input().split()
cnt = 1
cal = 0
for range in (N):
  cal += int(num[N])
  if cal <= X:
    cnt +=1
  else:
    break
print(cnt)


Fixed code:
N, X = map(int, input().split())
num = input().split()
cnt = 1
cal = 0
for x in range (N):
  cal += int(num[x])
  if cal <= X:
    cnt +=1
  else:
    break
print(cnt)
Buggy code:
n,x=[int(x) for x in input().split()]
l=[int(x) for x in input().split()]
d=0
cnt=0
for i in range(n):
  d=d+l[i]
  if d<=x:
    cnt+=1
print(cnt)

Fixed code:
n,x=[int(x) for x in input().split()]
l=[int(x) for x 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:
import itertools

N, X = [int(_) for _ in input().split()]
L = [int(_) for _ in input().split()]

bounce_positions = list(itertools.accumulate([0]+L))
ans = sum(x < X for x in bounce_positions)
print(ans)

Fixed code:
import itertools

N, X = [int(_) for _ in input().split()]
L = [int(_) for _ in input().split()]

bounce_positions = list(itertools.accumulate([0]+L))
ans = sum(x <= X for x in bounce_positions)
print(ans)
Buggy code:
n,x = map(int,input().split())
l = list(map(int,input().split()))

k = 0
s = 0

for i in range(n):
	if k < x:
		#print(i)
		k = k + l[i]
		s = s + 1
	else:
		pass

print(s)


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

k = 0
s = 1

for i in range(n):
	if k <= x:
		#print(i)
		k = k + l[i]
		#print(k)
		if k <= x:
			s = s + 1
	else:
		pass

print(s)
Buggy code:
n, x = (int(i) for i in input().split())  
l = list(int(_) for _ in input().split()) 
distance=0
_count=1
for i in range(0, n+1):
    distance += l[i]
    if distance<=x:
        _count += 1
print(_count)

Fixed code:
n, x = (int(i) for i in input().split())  
l = list(int(_) for _ in input().split()) 
distance=0
_count=1
for i in range(0, n):
    distance += l[i]
    if distance<=x:
        _count += 1
    else:
        break
print(_count)
Buggy 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]
  if d[i+1] > x:
    print(i+1)
    break
if d[n] <= x:
  print(n+1)

Fixed 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]
  if d[i+1] > x:
    print(i+1)
    d[n] = x + 1
    break
if d[n] <= x:
  print(n+1)
Buggy code:
n,x=map(int,input().split())
s=list(map(int,input().split()))
t,c=0,1
for i in s:
	if(t+i>=x):
		print(c)
		break
	else:
		t+=i
		c+=1

Fixed code:
n,x=map(int,input().split())
s=list(map(int,input().split()))
t,c=0,1
for i in s:
	if(t+i>x):
		break
	else:
		t+=i
		c+=1
print(c)
Buggy code:
[n,x]=[int(i) for i in input().split()]
l=[int(i) for i in input().split()]
sum=int(0)
count = int(1)

while sum+l[count-1]<=x:
    sum=sum+l[count-1]
    count=count+1
    print(sum)
    print(count)


print(count)


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

while count<n and sum+l[count]<=x:
    sum=sum+l[count]
    count=count+1

print(count+1)
Buggy code:
n,m = map(int,input().split())
lis = list(map(int,input().split()))
ans = 1
now = 0
for num in lis:
  now += num
  if now > m:
    exit()
  else:
    ans += 1
print(ans)

Fixed code:
n,m = map(int,input().split())
lis = list(map(int,input().split()))
ans = 1
now = 0
for num in lis:
  now += num
  if now > m:
    break
  else:
    ans += 1
print(ans)
Buggy code:
str = input()
N = int(str.split()[0])
X = int(str.split()[1])

str = input()
L = []
for i in range(N) :
	L.append(int(str.split()[i]))

D = 0
i = 0
while(D <= X) :
	D = D + L[i]
	i = i + 1
	if (i == len(L) - 1) :
		break


print(i)


Fixed code:
str = input()
N = int(str.split()[0])
X = int(str.split()[1])

str = input()
L = []
for i in range(N) :
	L.append(int(str.split()[i]))

D = 0
i = 0
while(D <= X) :
	if (i == len(L)) :
		if (D <= X):
			i = N + 1
		break
	D = D + L[i]
	i = i + 1


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

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

print(count)
  

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