qyliang/CodeNanoFix huggingface dataset:
Buggy code:
A, X = map(int, input().split())

if X < A:
  print(0)
else:
  print(10)

Fixed code:
X, A = map(int, input().split())
 
if X < A:
  print(0)
else:
  print(10)
Buggy code:
x,a=map(int,input().split())
if X<a:
  print(0)
  else:print(10)


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

if x<a:
    print(0)
else:
    print(10)
Buggy code:
n, x = map(int, input().split())
l = list(map(int, input().split()))
result = 0
res = 0
for i in l:
    res+=1
    if(result > x):
        break
    result += i
    
print(res)

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


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


Fixed 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)
Buggy code:
import sys
N,X = map(int,input().split())
L = list(map(int,input().split()))
D = 0
i = 0
while D <= X:
    D = (D + L[i])
    i += 1
    if i == N :
        print(i+1)
        sys.exit()
print(i)


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

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

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

D = [0]
for l in L:
  d = D[-1] + L
  if d <= X:
    D.append(d)
  else:
    break

print(len(D))

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

D = [0]
for l in L:
  d = D[-1] + l
  if d <= X:
    D.append(d)
  else:
    break

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

Fixed code:
N,X = map(int, input().split())
L =list(map(int,input().split()))
D = 0
k = 0
for i in range(N):
  if D <= X:
    D += L[i]
    k += 1
if D <= X:
  k += 1
print(k)
Buggy code:
N,X=map(int, input().split())
L=list(map(int, input().split()))
s=[x for x in range(N) if sum(L[:x])<=X]
if n>=len(s):
  print(len(s))
else:
  print(N+1)

Fixed code:
N,X=map(int, input().split())
L=list(map(int, input().split()))
s=[x for x in range(len(L)+1) if sum(L[:x])<=X]
if N+1>=len(s):
  print(len(s))
else:
  print(N+1)
Buggy code:
N,X = map(int,input().split())
L = list(map(int,input().split()))
C = 1
M = 0

for i in range(N + 1):
    M = M + L[i]
    if M >= X:
        print(C)
        exit(0)
    
    C = C + 1

print(C)

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

for i in range(N):
    M = M + L[i]
    if M > X:
        print(C)
        exit(0)
    
    C = C + 1

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

Fixed code:
n,x=map(int,input().split())
l=(list(map(int,input().split())))
ans=0
cut=1
for i in range(n):
    ans+=l[i]
    if ans<=x:
        cut+=1
print(cut)
Buggy code:
,x=map(int,input().split())
ans=0
oh=0
l=[int(i) for i in input().split()]
for j in l:
  if sum(l)<=x:
      if x>=oh:
          ans+=1
  elif x>=oh:
      ans+=1
  oh+=j   
if sum(l)<=x:
  print(ans+1)
else:
  print(ans)
  

Fixed code:
n,x=map(int,input().split())
ans=0
oh=0
l=[int(i) for i in input().split()] 
for j in l:
  if x>=oh:
    ans+=1
  oh+=j
if sum(l)<=x:
    print(ans+1)
else:
  print(ans)
Buggy code:
n, x = (int(i) for i in input().split())
l_array = [int(i) for i in input().split()]

counter = 0
coordinate = 0

while counter < n+1 and coordinate<=x:
    counter+=1
    if counter = n+1:
        break
    else:
        coordinate += l_array[counter-1]


print(counter)


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

counter = 0
coordinate = 0

while counter < n+1 and coordinate<=x:
    counter+=1
    if counter == n+1:
        break
    else:
        coordinate += l_array[counter-1]


print(counter)
Buggy code:
s = list(map(int,input().split()))
N = s[0]
X = s[1]
L = list(map(int,input().split()))
a = 0
d = 0
while d <= X:
  if a >= N+1:
    a = N
    break
  d += L[a]
  a += 1 

print(a+1)
  

Fixed code:
s = list(map(int,input().split()))
N = s[0]
X = s[1]
L = list(map(int,input().split()))
a = 0
d = 0
while d <= X:
  if a >= N:
    a = N+1
    break
  else:
    d += L[a]
    a += 1 

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

count= 0
sumList=[]
sumList.append(0)

for i in range(N):
  sumList.append(sum(L[0:i+1]))
  if(sum(L[0:i+1]) == X):break

print(len(sumList))

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

count= 0
sumList=[]
sumList.append(0)

for i in range(N):
  if(sum(L[0:i+1]) > X):break
  sumList.append(sum(L[0:i+1]))

print(len(sumList))
Buggy code:
def main():
    N, X = map(int, input().split())
    L = list(map(int, input().split()))
    D = 0
    i = 0
    while D <= X:
        D += L[i]
        i += 1
        if i == N:
            print(i+1)
            return

    print(i)
    return

if __name__ == '__main__':
    main()

Fixed code:
def main():
    N, X = map(int, input().split())
    L = list(map(int, input().split()))
    D = 0
    i = 0
    while True:
        D += L[i]
        i += 1
        if D > X:
            print(i)
            return
        if i == N:
            print(i+1)
            return

if __name__ == '__main__':
    main()
Buggy code:
import sys
input = sys.stdin.readline
def print_ans(N, X, lr):
    """Test Case
    >>> print_ans(3, 6, [3, 4, 5])
    2
    >>> print_ans(4, 9, [3, 3, 3, 3])
    4
    """
    counter = 1
    ans_sum = 0
    for l in lr:
        if ans_sum > X:
            break
        counter += 1
        ans_sum += l
    print(ans_sum)


if __name__ == '__main__':
    N, X = map(int, input().rstrip().split())
    lr = list(map(int, input().rstrip().split()))
    print_ans(N, X, lr)




Fixed code:
import sys
input = sys.stdin.readline
def print_ans(N, X, lr):
    """Test Case
    >>> print_ans(3, 6, [3, 4, 5])
    2
    >>> print_ans(4, 9, [3, 3, 3, 3])
    4
    """
    counter = 1
    ans_sum = 0
    for l in lr:
        ans_sum += l
        if ans_sum > X:
            break
        else:
            counter += 1
    print(counter)

if __name__ == '__main__':
    N, X = map(int, input().rstrip().split())
    lr = list(map(int, input().rstrip().split()))
    print_ans(N, X, lr)
Buggy code:
N,X=(int(i) for i in input().split())
L=[int(i) for i in input().split()]
for i in range(1,N+1):
    if sum(L[:i])>X:
        print(i)

Fixed code:
N,X=(int(i) for i in input().split())
L=[int(i) for i in input().split()]
for i in range(1,N+1):
    if sum(L[:i])>X:
        print(i)
        break
else:
    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(N):
  if D < X:
    ans += 1
    D += L[i]
  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 range(N):
  D += L[i]
  if D <= X:
    ans += 1
    

print(ans)
Buggy code:
n, x = map(int, input().split())
data = [0] + list(map(int, input().split()))
count = 0
tmp = 0
for d in data:
    tmp += d
    if tmp < x:
        count += 1
    # print(tmp)

print(count)

Fixed code:
n, x = map(int, input().split())
data = [0] + list(map(int, input().split()))
count = 0
tmp = 0
for d in data:
    tmp += d
    if tmp <= x:
        count += 1
    # print(tmp)

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

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

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

pf = [arr[0] for i in range(n)]

for i in range(1, n):
    pf[i] = pf[i-1] + arr[i]

c = 0
for i in pf:
    c += (i <= x)

print(c)

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

pf = [arr[0] for i in range(n)]

for i in range(1, n):
    pf[i] = pf[i-1] + arr[i]

c = 0
for i in pf:
    c += (i <= x)

print(c+1)
Buggy code:
def main():
    n, x = map(int, input().split())
    a = [int(i) for i in input().split()]
    pref = [0, a[0]]
    for i in range(1, n): pref.append(a[i] + pref[i - 1])
    ans = 0
    for val in pref:
        if val > x:
            break
        ans += 1
    print(ans)


main()


Fixed code:
def main():
    n, x = map(int, input().split())
    a = [int(i) for i in input().split()]
    pref = [0, a[0]]
    for i in range(1, n): pref.append(a[i] + pref[i])
    ans = 0
    for val in pref:
        if val > x:
            break
        ans += 1
    print(ans)


main()
Buggy code:
N,X = map(int,input().split())
L = [int(i) for i in input().split()]
D = 0
count = 1
for n in L:
    D += n
    count += 1
    if D > X or count > N + 1:
        break
print(count)

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

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

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

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

Fixed code:
N,X=map(int,input().split())
List = list(map(int, input().split()))
height = 0
res = 1
def checkF(k,x):
  if k>x:
    return True
  else:
    return False
    
for i in range(N):
  height += List[i]
  res +=1
  if checkF(height,X):
    res = res-1
    break
print(res)
Buggy code:
import itertools 
n,x = list(map(int,input().split()))
l = list(map(int,input().split()))
k = list(itertools.accumulate(l))
k.append(0)
k.sort()
s = 0
ii = 0

for i in k:
    if(i<=x):
        continue
    else:
        ii+=1
        break
if(s==0):
    print(n)
else:
    print(max(1,s))

Fixed code:
import itertools 
n,x = list(map(int,input().split()))
l = list(map(int,input().split()))
k = list(itertools.accumulate(l))
k.append(0)
k.sort()
ii = 0
for i in k:
    if(i<=x):
        ii+=1
        continue
    else:
        break
print(max(1,ii))
Buggy code:
N,X=(int(x) for x in input().split())
L = input().split()
L = [int(x) for x in L]
count = 0
D = 0
for i in L:
  D = D + i
  if D <= X:
    count = count + 1
  print(D)
print(count+1)

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

Fixed 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:break
    ans += 1
print(ans)
Buggy code:
n,x = map(int,input().split())

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

k = []
s = []
for i in range(n):
  k[i] += l[i]
  s[i] = k[i]

c = 0
for i in s:
  if i <= x:
    c += 1

print(c)

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

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

k = 0
s = []
for i in range(n):
  k += l[i]
  s.append(k)

c = 0
for i in s:
  if i <= x:
    c += 1

print(c+1)
Buggy code:
n,x = map(int,input().split())
li=map(int,input().split())
num = 0
cnt = 0
for i in li:
  num += i
  cnt += 1
  if num > x:
    print(cnt)
  else:
    pass

Fixed code:
n,x = map(int,input().split())
li=map(int,input().split())
num = 0
cnt = 0
for i in li:
  num += i
  cnt += 1
  if num > x:
    print(cnt)
    break
  elif cnt == n:
    print(n+1)
    break
  else:
    pass
Buggy code:
k, n = list(map(int, input().split(' ')))
l = list(map(int, input().split(' ')))
ct = 0
ans = 1
i = 0
while ct <= n:
  ct += l[i]
  ans += (ct <= n)
print(ans)

Fixed code:
k, n = list(map(int, input().split(' ')))
l = list(map(int, input().split(' ')))
ct = 0
ans = 1
i = 0
while ct <= n and i < len(l):
  ct += l[i]
  ans += (ct <= n)
  i += 1
print(ans)
Buggy code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = []
count = 1
D.append(0)
for i in range(N):
    D.append(D[-1]+L[i])
    print(D[-1])
    if D[-1] <= X:
        count += 1
print(count)

Fixed code:
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = []
count = 1
D.append(0)
for i in range(N):
    D.append(D[-1]+L[i])
    if D[-1] <= X:
        count += 1
print(count)
Buggy code:
# -*- coding: utf-8 -*-
N, X = map(int, input().split())
L = list(map(int, input().split()))
count = 1
line = 0
for i in range(N):
    line += L[i]
    if line < X:
        count += 1
print(count)

Fixed code:
# -*- coding: utf-8 -*-
N, X = map(int, input().split())
L = list(map(int, input().split()))
count = 1
line = 0
for i in range(N):
    line += L[i]
    if line <= X:
        count += 1
print(count)
Buggy code:
n, x = map(int, input().split())
a = list(map(int, input().split()))
b, ans = 0, 1
for i in a:
  if b<=x: ans+= 1
  b += i
print(ans)

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

if sum(l)<=x:
  print(n+1)
  exit()

i=1
d=0
while d<=x:
    d+=l[i-1]
    i+=1
print(i)

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

if sum(l)<=x:
  print(n+1)
  exit()

i=0
d=0
while d<=x:
    d+=l[i]
    i+=1
print(i)
Buggy code:
oukei=0 
count=1

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

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

Fixed code:
goukei=0 
count=1

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

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

L = input().split()
cnt = 1
pos = 0
for i in range(N):
        if(pos < X):
                pos += int(L[i])
                cnt += 1
        else:
                break
print(cnt)


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

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

sum=0
for i in range(N+1):
    sum += l[i]
    if sum>X:
        ans = i+1
print(ans)


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

H = 0
count = 0
for i in range(n):
  if H > x:
    print(count)
    exit()
  else:
    H += L[i]
    count += 1
  
print(n+1)


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

H = 0
count = 0
for i in range(n):
  if H > x:
    print(count)
    exit()
  else:
    H += L[i]
    count += 1
  
if H > x:
  print(n)
else:
  print(n+1)
Buggy code:
N, X = [int(i) for i in input().strip().split()]
L = [int(i) for i in input().strip().split()]

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


Fixed code:
N, X = [int(i) for i in input().strip().split()]
L = [int(i) for i in input().strip().split()]

pos = 0
res = 1
for i in range(N):
  pos += L[i]
  if X < pos:
    break
  res += 1
print(res)
Buggy code:
n, x = list(map(int, input().split()))
li = list(map(int, input().split()))
d = []
d.append(0)
for l in li:
	d.append(d[-1] + l)
cnt = 0
for hoge in d:
  if(hoge <= d):
    cnt = cnt + 1
print(cnt)

Fixed code:
n, x = list(map(int, input().split()))
li = list(map(int, input().split()))
d = []
d.append(0)
for l in li:
  d.append(d[-1] + l)
cnt = 0
for hoge in d:
  if(hoge <= x):
    cnt = cnt + 1
print(cnt)
Buggy code:
N, X = map(int,input().split())
L = list(map(int,input().split()))

D = [0]

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

print(len(D))


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

D = [0]

ans = 1

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

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


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

plot=0
cnt=0

for i in range(n):
    plot += l[i]
    if l[i] <= x:
        cnt += 1

print(cnt)

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

plot=0
cnt=1

for i in range(n):
    plot += l[i]
    if plot <= x:
        cnt += 1

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


Fixed code:
n, x = map(int, input().split())
li = list(map(int, input().split()))
ans = 1
for i in range(len(li)):
    if(sum(li[:i+1]) <= x):
        ans += 1
print(ans)
Buggy code:
N, X = map(int,input().split())
L = map(int,input().split())
ans = 0
now = 0
for i in L:
  now += i
  if now >= X:
    break
  ans +=1
print(ans)

Fixed code:
N, X = map(int,input().split())
L = map(int,input().split())
ans = 0
now = 0
for i in L:
  now += i
  ans +=1
  if now > X:
    break
else:
  ans += 1
print(ans)
Buggy code:
# Input
N, X = map(int, input().split())
L = [int(l) for l in input().split()]
#
d, i, c = 0, 0, 1
for i in range(N):
    print(i,d, c)
    d = d + L[i]
    if (d > X):
        break
    c += 1
print(c)


Fixed code:
# Input
N, X = map(int, input().split())
L = [int(l) for l in input().split()]
#
d, i, c = 0, 0, 1
for i in range(N):
    d = d + L[i]
    if (d > X):
        break
    c += 1
    
print(c)
Buggy code:
N, X = map(int, input().split())
L = list(map(int, input().split()))

dist = 0
cnt = 0
for i in range(N):
  if dist <= X:
    dist += list[i]
    cnt += 1
  else:
    break;
    
print(cnt)

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

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

ans = [0]
cnt =0
for i in L:
    cnt =i + cnt
    if cnt <= X:
        ans.append(cnt)
    else:
        break
print(ans)        
print(len(ans))

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

ans = [0]
cnt =0
for i in L:
    cnt =i + cnt
    if cnt <= X:
        ans.append(cnt)
    else:
        break
   
print(len(ans))
Buggy code:
mport sys

def main():
    N, X = map(int, input().split())
    A = list(map(int, input().split()))
    cnt = 1
    D = 0
    for a in A:
        D += a
        if D > X:
            break
        cnt += 1

    return cnt

if __name__ == '__main__':
    print(main())

Fixed code:
import sys

def main():
    N, X = map(int, input().split())
    A = list(map(int, input().split()))
    cnt = 1
    D = 0
    for a in A:
        D += a
        if D > X:
            break
        cnt += 1

    return cnt

if __name__ == '__main__':
    print(main())
Buggy code:
n,x = map(int,input().split())
listl = []
listl += map(int,input().split())
# print(listl)

cnt=1
d=0
# print(d)
for i in range(n):
    d = d+listl[cnt]
    if d > x:
        break
    # print(d)
    cnt+=1

print(cnt)

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

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

print(cnt)
Buggy code:
n, x = [int(a) for a in input().split()]
l_list = [int(a) for a in input().split()]
for i, l in enumerate(l_list):
    n -= l
    if l < 0:
        print(str(i+1))
        break

Fixed code:
n, x = [int(a) for a in input().split()]
l_list = [int(a) for a in input().split()]
for i, l in enumerate(l_list):
    x -= l
    if x < 0:
        print(str(i+1))
        break
else:
    print(str(n+1))
Buggy code:
N,X = map(int,input().split())
L = list(map(int,input().split()))
D,i,cnt = 0,0,1 
while(D <= X):
  D = D + L[i]
  cnt +=1
  i += 1
print(cnt)

Fixed code:
N,X = map(int,input().split())
L = list(map(int,input().split()))
L.append(0)
D,i,cnt = 0,0,0
while(D <= X and cnt <= N):
  D = D + L[i]
  cnt +=1
  i += 1
print(cnt)