qyliang/CodeNanoFix huggingface dataset:
Buggy 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:
    break
  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:
    break
  ans += 1
print(ans)
Buggy code:
n,x = map(int,input().split())
l = [int(i) for i in input().split()]

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

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

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

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

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


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

print(ans)

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

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

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

zahyo = 0
i = 0
while(zahyo <= x):
    
    zahyo = zahyo + li[i]
    print(zahyo)
    
    if zahyo <= x:
        i = i+1

print(i+1)

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

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

zahyo = 0
i = 0
while(zahyo <= x):
    
    zahyo = zahyo + li[i]
    
    if zahyo <= x:
        i = i+1
    if i == n:
        break

print(i+1)
Buggy code:
arr1 = input().split()
n,x = int(arr1[0]),int(arr1[1])

arr2 = input().split()

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

Fixed code:
arr1 = input().split()
n,x = int(arr1[0]),int(arr1[1])

arr2 = input().split()

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

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

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

print(len(D) + int(D[-1] <= X))

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

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

print(len(D))
Buggy code:
n,x = map(int,input().split())
L = list(map(int,input().split()))
d = 0
cnt = 0
for l in L:
	d += l
	if(d <= x):
		cnt += 1
print(cnt)

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

position=0
cnt=1

for i in range(N):
    position+=Llist[i]
    if position < X:
        cnt+=1

print(cnt)


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

position=0
cnt=1

for i in range(N):
    position+=Llist[i]
    if position <= X:
        cnt+=1

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

for i in range(n+1):

    d +=l[i]
    if d<x:
        cnt += 1

print(cnt)

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

for i in range(n+1):

    d.append(sum(l[:i+1]))

for i in range(n+1):

    if d[i]<=x:
        cnt += 1


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

Fixed code:
N,X = list(map(int,input().split()))
L = list(map(int,input().split()))
D = [0]*(N+1)
cnt = 0
for i in range(N):
  D[i+1] += D[i] + L[i]
  cnt += 1 if D[i+1]<=X else 0
print(cnt+1)
Buggy code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
temp=[0]*(n+1)
for i in range(0,n):
  temp[i+1]=temp[i]+l[i]
import bisect
print(bisect.bisect_left(temp,x))

Fixed code:
n,x=map(int,input().split())
l=list(map(int,input().split()))
temp=[0]*(n+1)
for i in range(0,n):
  temp[i+1]=temp[i]+l[i]
import bisect
print(bisect.bisect_right(temp,x))
Buggy code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main():
    N, X = list(map(int,readline().split()))
    L = map(int,readline().split())
    sum = 0
    cnt = 1
    for n in N:
        sum += n
        if sum <= X:
            cnt += 1
    print(cnt)

    return

if __name__ == '__main__':
    main()



Fixed code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main():
    N, X = list(map(int,readline().split()))
    L = map(int,readline().split())
    sum = 0
    cnt = 1
    for l in L:
        sum += l
        if sum <= X:
            cnt += 1
    print(cnt)

    return

if __name__ == '__main__':
    main()
Buggy code:
N,X=map(int,input().split())
L=list(map(int,input().split()))
tmp=0
ans=0
for i in range(N):
	if tmp>X:
		print(ans)
		break
	else:
		tmp+=L[i]
		ans+=1
print(ans)

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

Fixed code:
n,x=map(int,input().split())
l=[int(i) for i in input().split()]
d=0
ans=0
for i in l:
  if d+i>x:
    print(ans+1)
    exit()
  ans+=1
  d+=i
print(ans+1)
Buggy code:
N, val= list(map(int,input().split()))
list = list(map(int,input().split()))
d=0
l=[]
for i in list:
  ans=d+i
  l.append(ans)
count=0
for num in l:
  if num<=val:
    count=count+1
print(count)

Fixed code:
N, val= list(map(int,input().split()))
list = list(map(int,input().split()))
d=0
l=[]
for i in list:
  d=d+i
  l.append(d)
count=0
for num in l:
  if num<=val:
    count=count+1
print(count+1)
Buggy code:
n,x=map(int,input().split())
List = [int(i) for i in input().split()]
d=0
i=0
for i in range(n):
    if d<x :
        d=d+List[i]
    else :
        print(i+1)

Fixed code:
n,x=map(int,input().split())
List = [int(i) for i in input().split()]
d=0
j=1
for i in range(n):
    d=d+List[i]
    if d<=x :
        j+=1
print(j)
Buggy code:
N, X = [int(i) for i in input().split()]
Ls = [int(l) for l in input().split()]
d = 0
res = 1
for i, Li in enumerate(Ls):
    if d <= X:
        res += 1
        break
    d += Li
print(res)

Fixed code:
N, X = [int(i) for i in input().split()]
Ls = [int(l) for l in input().split()]
d = 0
res = 1
for i, Li in enumerate(Ls):
    d += Li
    if d > X:
        break
    res += 1
print(res)
Buggy code:
# -*- coding: utf-8 -*-
def main():
    N,X = map(int,input().split())
    L=[int(i) for i in input().split()]
    Ls = 0
    count = 1
    for i in range(N):
        Ls = Ls+L[i]
        print(Ls)
        if Ls<=X:
            count+=1
    print(count)


if __name__ == '__main__':
    main()

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


if __name__ == '__main__':
    main()
Buggy code:
n,x = map(int,input().split())
l = list(map(int,input().split()))
sum = 1
ans = 0
for i in range(n):
        sum += l[i]
        if x >= sum:
                ans += 1
print(ans)

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

Fixed code:
a,b=map(int,input().split())
c=list(map(int,input().split()))
count=1
sum=0
for i in range(a):
    sum+=c[i]
    if(sum<=b):
        count+=1
print(count)
Buggy code:
N,X= map(int,input().split())
List=list(map(int,input().split()))
a = 0
i = 0
while a < X:
    a = a + List[i]
    i = i + 1
print(i

Fixed code:
N,X= map(int,input().split())
List=list(map(int,input().split()))
List.append(0)
a = 0
i = 0
while a <= X and i <= N:
    a = a + List[i]
    i = i + 1
print(i)
Buggy code:
n,x = map(int,input().split())
d = list(map(int,input().split()))

bound = 0
ans = 1

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

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

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

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

for i in range(n):
    d += l[i]
    if(d>x):
        print(i+1)
        exit(0)
print(n+1)
Buggy code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 25 12:46:40 2019

@author: YudNK
"""

n,x = map(int, input().split())
l = [int(i) for i in input().split()]
count = 1
px = 0
for i in range(n):
    nx = px + l[i]
    if nx <= x:
        count += 1
print(count)

Fixed code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 25 12:46:40 2019

@author: YudNK
"""

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

L = [int(i) for i in input().split()]

D =[]
D.append(0)
x = 0

for i in range(N):
  x += L[i]
  D.append(x)
  
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 = [int(i) for i in input().split()]

D =[]
D.append(0)
x = 0

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

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

print(ans)
Buggy code:
n, x = map(int, input().split())
L = [0] + [int(i) for i in input().split()]

c = 0

for i in range(len(l)):
    if sum(L[:i+1]) <= x:
        c += 1
print(c)

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

c = 0

for i in range(len(l)):
    if sum(l[:i+1]) <= x:
        c += 1
print(c)
Buggy code:
N, X = map(int, input().split())
Ls = map(int, input().split())

count = 0
position = 0
for i in range(N):
    if X<position:
        break
    else:
        count += 1
        position += Ls[i]

print(count)

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

count = 0
position = 0
for i in range(N):
    if X<position:
        break
    else:
        count += 1
        position += Ls[i]

if X<position:
    pass
else:
    count += 1

print(count)
Buggy code:
def main():
    n, x = map(int, input().split())
    l = list(map(int, input().split()))
    sum = 0
    for idx, i in enumerate(l):
        sum += i
        if sum > x:
            print(idx + 1)
            break
        else:
            print(n + 1)

if __name__ == '__main__':
    main()

Fixed code:
def main():
    n, x = map(int, input().split())
    l = list(map(int, input().split()))
    sum = 0
    for idx, i in enumerate(l):
        sum += i
        if sum > x:
            print(idx + 1)
            break
    else:
        print(n + 1)

if __name__ == '__main__':
    main()
Buggy code:
N,X = map(int,input().split())
L = list(map(int,input().split()))
D = [0]*(N+1)
x = 0
for i in range(1,N+2):
  D[i] = D[i-1]+L[i-1]
while D[x] <= X:
  x += 1
print(x)

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

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

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

Fixed code:
N,X=map(int,input().split())
L=[int(i) for i in input().split()]
count=1
dis=0
for t in L:
    dis=dis+t
    if dis<=X:
        count+=1
    else:
        break
print(count)
Buggy code:
import itertools
n,x = map(int,input().split())
lst_l = [0] + list(map(int,input().split()))
lst_wa = list(accumulate(lst_l))
cnt = 0
for i in lst_wa:
    if i < x:
        cnt += 1
print(cnt)

Fixed code:
from itertools import accumulate
n,x = map(int,input().split())
lst_l = [0] + list(map(int,input().split()))
lst_wa = list(accumulate(lst_l))
cnt = 0
for i in lst_wa:
    if i <= x:
        cnt += 1
print(cnt)
Buggy code:
n, x = map(int, input().split(' '))
ls = [i for i in map(int, input().split(' '))]
sum = 0
for i in range(0, n):
    sum += ls[i]
    if sum >= x:
        print(i + 1)
        break


Fixed code:
n, x = map(int, input().split(' '))
ls = [i for i in map(int, input().split(' '))]
sum, bound = 0, 1
for i in range(0, n):
    sum += ls[i]
    if sum > x:
        break
    else:
        bound += 1
print(bound)
Buggy code:
n, x = map(int, input().split())
L = list(map(int, input().split()))
D = []
D.append(0)
for i in range(n - 1):
  D.append(D[i] + L[i])
ans = 0
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 = []
D.append(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)
Buggy code:
#coding:utf-8

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

ans = 0
d = 0 
for i in l:
    if d >= x:
        break
    ans += 1
    d += int(i)

print(ans)

Fixed code:
#coding:utf-8

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

l.insert(0,0)

# print(l)

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

print(ans)
Buggy code:
n, x = input().split()
L = input().split()
for i, l in enumerate(L):
  if i == 0:
    D = 0
  else:
    D = int(l) + D
    
  if D > int(x):
    print(i)
    break
    
if D <= int(x):
  print(int(n) + 1)

Fixed code:
n, x = input().split()
L = input().split()
for i, l in enumerate(L):
  if i == 0:
    D = int(l)
  else:
    D = int(l) + D

    
  if D > int(x):
    print(i + 1)
    break
    
if D <= int(x):
  print(int(n) + 1)
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 D >= X:
        print(i + 1)
        break

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

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

Fixed code:
n,x=map(int,input().split())
l=list(int(i) for i in input().split())
s=[]
for i in range(len(l)+1):
  t=sum(l[:i])
  if t <= x:
    s.append(t)
print(len(s))
Buggy code:
N, X = map(int, str(input()).split())
L = list(map(int, input().split()))

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

print(count)


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

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

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

Fixed code:
n, x = map(int, input().split())
bound = list(map(int, input().split()))
count = 1
hoge = 0
for i in bound:
    hoge += i
    if hoge > x:
        break
    count += 1
print(count)
Buggy code:
n,x=(int(i) for i in input().split())
d=0
c=0
for i in range(n):
  l=int(input())
  d=d+l
  if d<=x:
    c=c+1
  elif d>x:
    print(c)
    break

Fixed code:
n,x=(int(i) for i in input().split())
d=0
c=1
l=[int(i) for i in input().split()]
for i in range(n):
  d=d+l[i]
  if d<=x:
    c=c+1
  elif d>x:
    break
print(c)
Buggy code:
n,x= [int(i) for i in input().split()]
L=[int(i) for i in input().split()]
d=[0]
for i in range(1,len(L)+1):
    dd=d[i-1]+L[i-1]
    d.append(dd)
for j in range(len(d)):
    if d[j]<=x:
        num+=1
print (num)

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

cnt = 0
D = 0
while D <= X and cnt < len(L):
    D += L[cnt]
    cnt += 1
if cnt == len(L):
    cnt += 1

print(cnt)

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

cnt = 0
D = 0
while D <= X and cnt < len(L):
    D += L[cnt]
    cnt += 1

if D <= X:
    cnt += 1

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

Fixed code:
n,x = map(int, input().split())
l = [0] + list(map(int, input().split()))
d = 0
i = 0
c = 0
while d <= x:
  d += l[i]
  i += 1
  if n+1 == i and d <= x:
    c = 1
    break
if c == 1:
  print(n+1)
else:
  print(i-1)
Buggy code:
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = [0]
for li in l:
  d.append(d[-1] + li)
print(len([di for di in d if d <= x]))


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

bounce = [0] + [ sum(ls[:i]) for i in range(1, len(ls)+1) ]

print(bounce)
for i, v in enumerate(bounce):
  if v > x:
    print(i)
    break
else:
  print(len(bounce))

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

bounce = [0] + [ sum(ls[:i]) for i in range(1, len(ls)+1) ]

for i, v in enumerate(bounce):
  if v > x:
    print(i)
    break
else:
  print(len(bounce))
Buggy code:
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
from collections import deque, defaultdict
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N = II()
    X = [0] * N
    Y = [0] * N
    for i in range(N):
        x, y = MI()
        X[i], Y[i] = x, y

    dct = defaultdict(int)
    for i in range(N):
        for j in range(N):
            if i == j: continue
            xi, yi = X[i], Y[i]
            xj, yj = X[j], Y[j]

            dct[(xi-xj, yi-yj)] += 1
    # print(dct)
    # print(N - max(dct.values()))


if __name__ == '__main__':
    solve()



Fixed code:
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
from collections import deque, defaultdict
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N = II()
    X = [0] * N
    Y = [0] * N
    for i in range(N):
        x, y = MI()
        X[i], Y[i] = x, y

    dct = defaultdict(int)
    for i in range(N):
        for j in range(N):
            if i == j: continue
            xi, yi = X[i], Y[i]
            xj, yj = X[j], Y[j]

            dct[(xi-xj, yi-yj)] += 1
    # print(dct)
    mx = 0
    for d in dct.values():
        mx = max(mx, d)
    print(N - mx)


if __name__ == '__main__':
    solve()