qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N,L = map(int, input().split())
list = []
sum = 0
min = 10000
sign = 1
for i in range(1,N+1):
    sum += L+i-1
    list.append(L+i-1)
print(sum)
for num in list:
    if min > abs(num):
        min = abs(num)
        if num > 0:
            sign = 1
        else:
            sign = -1
print(min)
print(sign)
print(sum-min*sign)


Fixed code:
N,L = map(int, input().split())
list = []
sum = 0
min = 10000
sign = 1
for i in range(1,N+1):
    sum += L+i-1
    list.append(L+i-1)
for num in list:
    if min > abs(num):
        min = abs(num)
        if num > 0:
            sign = 1
        else:
            sign = -1
print(sum-min*sign)
Buggy code:
N,L = map(int,input().split())
A = [L+i for i in range(N)]
A.sort(a: abs(a))

print(sum(A)-A[0])


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

A = [L + i for i in range(N)]
A.sort(key=lambda a: abs(a))

print(sum(A) - A[0])
Buggy code:
n, l = map(int, input().split())
dic = []
all_sum = sum([j + l -1 for j in range(1, n+1)])
for i in range(1, n+1):
  item = [j + l -1 for j in range(1, n+1) if j != i]
  dic.append(sum(item))
dist = abs(all_sum - dic[0])
for j in dic:
  tmp = abs(all_sum - j)
  if j < dist:
    dist = j
print(dist)

Fixed code:
n, l = map(int, input().split())
dic = []
all_sum = sum([j + l -1 for j in range(1, n+1)])
for i in range(1, n+1):
  item = [j + l -1 for j in range(1, n+1) if j != i]
  dic.append(sum(item))
dist = abs(all_sum - dic[0])
ans = dic[0]
for j in dic:
  tmp = abs(all_sum - j)
  if tmp < dist:
    ans = j
    dist = tmp
print(ans)
Buggy code:
N,K = [int(i) for i in input().split()] 
bi=None
if 2<=1-L and 1-L<=N:
    bi =1-L
elif 1-L>=N:
    bi = N
elif 2>=1-L:
    bi =1
ajis = [L+i for i in range (N)]
org_sum = sum(ajis)
ans = org_sum -(L+bi-1)
print(ans)

Fixed code:
N,L = [int(i) for i in input().split()] 
bi=None
if 2<=1-L and 1-L<=N:
    bi =1-L
elif 1-L>=N:
    bi = N
elif 2>=1-L:
    bi =1
ajis = [L+i for i in range (N)]
org_sum = sum(ajis)
ans = org_sum -(L+bi-1)
print(ans)
Buggy code:
n,l = map(int, input().split())
ans = 0
m = float("inf")
for i in range(1,n+1):
    a = l + i -1
    if abs(a)<abs(m):
        m = a
    ans += a
print(ans + (-m if m<0 else m))

Fixed code:
n,l = map(int, input().split())
ans = 0
m = float("inf")
for i in range(1,n+1):
    a = l + i -1
    if abs(a)<abs(m):
        m = a
    ans += a
print(ans -m)
Buggy code:
n,l=map(int,input().split())
a =[]
for i in range(1,n+1):
  a.append(l+i-1)
b =10**10
for i in range(n):
    d = abs(sum(a)-(sum(a[:i])+sum(a[i+1:])))
    if b>d:
        c = sum(a[:i])+sum(a[i+1:])
        b = d

Fixed code:
n,l=map(int,input().split())
a =[]
for i in range(1,n+1):
  a.append(l+i-1)
b =10**10
for i in range(n):
    d = abs(sum(a)-(sum(a[:i])+sum(a[i+1:])))
    if b>d:
        c = sum(a[:i])+sum(a[i+1:])
        b = d
print(c)
Buggy code:
n,l=map(int,input().split())
a=[]
for i in range(0,n):
  a.append(i+l)
if 0 in a:
  print(sum(a))
else:
  if a[0]>0:
    print(sum(a)-a[0])
  else:
    print(sum(a)-a[n])

Fixed code:
n,l=map(int,input().split())
a=[]
for i in range(0,n):
  a.append(i+l)
if 0 in a:
  print(sum(a))
else:
  if a[0]>0:
    print(sum(a)-a[0])
  else:
    print(sum(a)-a[n-1])
Buggy code:
n,l=map(int,input().split())
li=[]
for i in range(1,n+1):
  li.append(l+i-1)
print(sum(li)-li[li.index(min(list(map(abs,li))))])

Fixed code:
n,l=map(int,input().split())
li=[]
for i in range(1,n+1):
  li.append(l+i-1)
print(sum(li)-[i for i in li if abs(i)==min(list(map(abs,li)))][0])
Buggy code:
def main():
    N, L = map(int, input().split())
    a = [L + n for n in range(N)]
    print(a)
    if L > 0:
        print(sum(a) - a[0])
    elif abs(L) >= N:
        print(sum(a) - a[-1])
    else:
        print(sum(a))


main()


Fixed code:
def main():
    N, L = map(int, input().split())
    a = [L + n for n in range(N)]
    if L > 0:
        print(sum(a) - a[0])
    elif abs(L) >= N:
        print(sum(a) - a[-1])
    else:
        print(sum(a))


main()
Buggy code:
# 190622_sat_B

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

a = []
b = []

for i in range(1, N+1):
    a.append(L+i-1)
    b.append(abs(L+i-1))

# print("a: ", a)
# print("b: ", min(b))

print("answer:", sum(a) - a[b.index(min(b))])

Fixed code:
# 190622_sat_B

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

a = []
b = []

for i in range(1, N+1):
    a.append(L+i-1)
    b.append(abs(L+i-1))

# print("a: ", a)
# print("b: ", min(b))

# print("answer:", sum(a) - a[b.index(min(b))])
print(sum(a) - a[b.index(min(b))])
Buggy code:
n,l=map(int,input().split())
ans=(2*l+n-2)*n//2
if l-1>=0:
  ans-=l
elif l-1<=0 and abs(l-1)>=n:
  ans-=l+n-1
print(ans)

Fixed code:
n,l=map(int,input().split())
ans=(2*l+n-1)*n//2
if l-1>=0:
  ans-=l
elif l-1<=0 and abs(l-1)>=n:
  ans-=l+n-1
print(ans)
Buggy code:
N,L=map(int,input().split())
li=[]
for i in range(N):
    li.append(L+i+1-1)
A=True
li.sort()
for j in range(N-1):
    if abs(li[j])<=abs(li[j+1]):
        S-=li[j]
        A=False
        break

if A==True:
    S-=li[N-1]

print(S)


Fixed code:
N,L=map(int,input().split())
li=[]
for i in range(N):
    li.append(L+i+1-1)
A=True
li.sort()
S=sum(li)
for j in range(N-1):
    if abs(li[j])<=abs(li[j+1]):
        S-=li[j]
        A=False
        break

if A==True:
    S-=li[N-1]

print(S)
Buggy code:
n,l = map(int, input().split())
before = (l-1)*n + int(n*(n+1)/2)
first = l
last = l+n-1
if first*last>0:
  print(before-first)
else:
  print(before)

Fixed code:
n,l = map(int, input().split())
before = (l-1)*n + int(n*(n+1)/2)
first = l
last = l+n-1
if first*last>0:
  if first>0:
  	print(before-first)
  else:
    print(before-last)
else:
  print(before)
Buggy code:
n,l = map(int,input().split())

taste_int =  n * (n +1) / 2  + ( l - 1 ) * n

if 0 < l :
	result = taste_int - l
elif l < -1 * n :
	result = taste_int - (n + l -1 )
else:
	result = taste_int

print( result)

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

taste_int =  int(n * (n +1) / 2  + ( l - 1 ) * n)

if 0 <= l :
	result = taste_int - l
elif l <= -1 * n :
	result = taste_int - (n + l -1 )
else:
	result = taste_int

print( result)
Buggy code:
n,l = map(int,input().split())
if l >= 0:
  print((n-1)*(2*l+n)/2)
elif n > abs(l):
  print(n*(2*l+n-1)/2)
else:
  print((n-1)*(2*l+n-2)/2)

Fixed code:
n,l=map(int,input().split())
ans_n=n*(2*l+n-1)//2
if l>=0:
  print(ans_n-l)
elif n+l>0:
  print(ans_n)
else:
  print(ans_n-(n+l-1))
Buggy code:
n,l = map(int, input().split())

ans = 0

if l >= 1:
  for i in range(n):
    ans += l+i
  ans -= l
  print(ans)
elif -n < l <= 0:
  for i in range(n):
    ans += l+i
  print(ans)
elif l <= -n:
  for i in range(n):
    ans += l+i
  ans -= l
  print(ans)

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

ans = 0

if l >= 1:
  for i in range(n):
    ans += l+i
  ans -= l
  print(ans)
elif -n < l <= 0:
  for i in range(n):
    ans += l+i
  print(ans)
elif l <= -n:
  for i in range(n):
    ans += l+i
  ans -= l+n-1
  print(ans)
Buggy code:
n, l = map(int, input().split())
if l >= 0:
  print(int(l*(n-1) + n*(n-1)/2))
elif n-1 >= -l:
  print(int((l+n)*(l+n-1)/2))
else:
  print(int(l*(n-1) + (n-1)*(n-2)/2))

Fixed code:
n, l = map(int, input().split())
ans = int(n*(l+(n-1)/2))
if l >= 0:
  print(ans - l)
elif l+n-1 >= 0:
  print(ans)
else:
  print(ans - (l+n-1))
Buggy code:
N,L = map(int,input().split())
s = 0
lst = []
for i in range(1,N+1):
  s += i + L - 1
  lst.append(abs(i+L-1))
ans = s - min(lst)
print(ans)

Fixed code:
N,L = map(int,input().split())
s = 0
lst = []
for i in range(1,N+1):
  s += i + L - 1
  lst.append(abs(i+L-1))
if L >= 0:
  ans = s - min(lst)
else:
  ans = s + min(lst)
print(ans)
Buggy code:
from sys import stdin


def main():
    N, L = [int(x) for x in stdin.readline().rstrip().split()]

    apple_list = []

    for i in range(N):
        apple_list.append(L+i)

    s = sorted(apple_list, key=abs)
    s.pop(0)
    print(sum(s))
    //print(123)


if __name__ == "__main__":
    main()


Fixed code:
from sys import stdin


def main():
    N, L = [int(x) for x in stdin.readline().rstrip().split()]

    apple_list = []

    for i in range(N):
        apple_list.append(L+i)

    s = sorted(apple_list, key=abs)
    s.pop(0)
    print(sum(s))


if __name__ == "__main__":
    main()
Buggy code:
N,L = map(int,input().split())
    eat = N - 1
    for m in range(N):
        if abs(L + m) < abs(L + eat):
            eat = m
aj = N*(N-1)//2
pie = (N-1)*L + aj - eat
print(pie)


Fixed code:
N,L = map(int,input().split())
eat = N - 1
for m in range(N):
    if abs(L + m) < abs(L + eat):
        eat = m
aj = N*(N-1)//2
pie = (N-1)*L + aj - eat
print(pie)
Buggy code:
N,L = map(int,input().split())
if L-1 >=0:
    eat = 0
else:
    eat = N - 1
    for m in range(N):
        if abs(L + m) < abs(L + eat):
            eat = m
            print(eat)
            break
aj = N*(N-1)//2
pie = (N-1)*L + aj - eat
print(pie)


Fixed code:
N,L = map(int,input().split())
if L >=0:
    eat = 0
else:
    eat = N - 1
    for m in range(N):
        if abs(L + m) < abs(L + eat):
            eat = m
aj = N*(N-1)//2
pie = (N-1)*L + aj - eat
print(pie)
Buggy code:
N,L = list(map(int,input().split()))
app_taste = list(range(L,L+N))
bite_apple=200
for i in app_taste:
    if abs(bite_apple) > abs(i):
        bite_apple = i
print(sum(app_taste) - i)


Fixed code:
N,L = list(map(int,input().split()))
app_taste = list(range(L,L+N))
bite_apple=L
for i in app_taste:
    if abs(bite_apple) > abs(i):
        bite_apple = i
print(sum(app_taste) - bite_apple)
Buggy code:
N, L = map(int, input.split())

list = [L+(i+1)-1 for i in range(N)]

print(list)
list.sort(key=lambda x: abs(x))

del list[0]
print(sum(list))

Fixed code:
N , L = map(int, input().split())
 
list = [L + (i+1)-1 for i in range(N)]
 
list.sort(key=lambda x:abs(x))
 
del list[0]
print(sum(list))
Buggy code:
N, L = map(int, input().split())
l = []
absn = N + L
for i in range(0, N):
    l.append(i + L)
    absn = abs(i + L) if abs(i + L) < absn else absn

print(sum(l) - absn)

Fixed code:
N, L = map(int, input().split())
l = []
absn = N + L -1
for i in range(0, N):
    l.append(i + L)
    absn = abs(i + L) if abs(i + L) < absn else absn

print(sum(l) - absn)
Buggy code:
n, l = map(int, input().split())
totalTaste = 0
tastes = []
minAbs = 9999

for i in range(1, n+1):
    totalTaste += l + i - 1
    tastes.append(l + i - 1)

for i in range(n):
    temp = abs(tastes[i])
    if temp < minAbs:
        minAbs = temp

#print(totalTaste)
#print(tastes)
print(totalTaste - minAbs)


Fixed code:
n, l = map(int, input().split())
totalTaste = 0
tastes = []
minAbs = 9999
minIdx = 9999

for i in range(1, n+1):
    totalTaste += l + i - 1
    tastes.append(l + i - 1)

for i in range(n):
    temp = abs(tastes[i])
    if temp < minAbs:
        minAbs = temp
        minIdx = i

#print(totalTaste)
#print(tastes)
#print(totalTaste - minAbs)
print(totalTaste - tastes[minIdx])
Buggy code:


i = list(map(int,input().split()))
n = i[0]
l = i[1]
 
alist = []
i = 1
 
for i in range(n):
  x = l + i - 1
  alist.append(x)
  
  
  
 
k = 0
m = 0
for k in range(n):
  if abs(alist[k]) >= abs(alist[k+1]):
    m = k+1
  
  
  
  
print(sum(alist) - alist[m])
 

Fixed code:
i = list(map(int,input().split()))
n = i[0]
l = i[1]
 
alist = []
j = 0
 
for j in range(n):
  x = l + j
  alist.append(x)
  
   
k = 0
m = 0
for k in range(n-1):
  if abs(alist[k]) >= abs(alist[k+1]):
    m = k+1
  
  
print(sum(alist) - alist[m])
Buggy code:
[n,l] = [int(i) for i in input().split()]
taste = []
for i in range(n):
  taste.append(l + i - 1)
a = 100000000
for i in range(n):
  if abs(taste[i]) < a:
    a = taste[i]
print(sum(taste) - a)

Fixed code:
[n,l] = [int(i) for i in input().split()]
taste = []
for i in range(n):
  taste.append(l + i)
a = 100000000
for i in range(n):
  if abs(taste[i]) < abs(a):
    a = taste[i]
print(sum(taste) - a)
Buggy code:
a = input().split()
N = int(a[0])
L = int(a[1])
a = [0]*N
for i in range(N):
  a[i] = abs(L+i)
for i in range(N):
  if a[i] == min(a):
    print((L-1)*N+N*((N+1)/2)-(L+i))
    break

Fixed code:
a = input().split()
N = int(a[0])
L = int(a[1])
a = [0]*N
for i in range(N):
  a[i] = abs(L+i)
for i in range(N):
  if a[i] == min(a):
    c = int((L-1)*N+N*((N+1)/2)-(L+i))
    print(c)
    break
Buggy code:
n,l = map(int,input().split())

aji = 0  
mini = l + n
for i in range(0, n) :
    aji = aji + i + l
    if (abs(mini) > abs(i + l)) :
        mini = (i + l)

print(aji-mini)

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

aji = 0  
mini = 1000
for i in range(0, n) :
    aji = aji + i + l
    if (abs(mini) > abs(i + l)) :
        mini = (i + l)

print(aji-mini)
Buggy code:
N, L = map(int, input().split())
a = [L + i for i in range(N)]
b = list(map(lambda x:abs(x), a))
c = b.index(min(b))
del a[c]
print(sum(j) for j in a )

Fixed code:
N, L = map(int, input().split())
a = [L + i for i in range(N)]
b = list(map(lambda x:abs(x), a))
c = b.index(min(b))
del a[c]
print(sum(j for j in a))
Buggy code:
N, L = map(int,input().split())
i = 0
apple_taste = []
pi_taste = 0
while N > i:
    apple_taste.append(L + i)
    if(L>0):
        if i>0:
            pi_taste += apple_taste[i]
    elif(L+(N-1)>=0):
            pi_taste += apple_taste[i]
    elif(L<0):
        if i>0:
            pi_taste += apple_taste[i-1]
    i += 1 
print(pi_taste)
print(apple_taste)

Fixed code:
N, L = map(int,input().split())
i = 0
apple_taste = []
pi_taste = 0
while N > i:
    apple_taste.append(L + i)
    if(L>0):
        if i>0:
            pi_taste += apple_taste[i]
    elif(L+(N-1)>=0):
            pi_taste += apple_taste[i]
    elif(L<0):
        if i>0:
            pi_taste += apple_taste[i-1]
    i += 1 
print(pi_taste)
Buggy code:
n,l=map(int,input().split())
sum=n*(n-1)//2+l*n
k=l+1
for i in range(n):
    if abs(i+l)<k:
        k=i+l
print(sum-k)

Fixed code:
n,l=map(int,input().split())
sum=n*(n-1)//2+l*n
k=abs(l)+1
for i in range(n):
    if abs(i+l)<abs(k):
        k=i+l
print(sum-k)
Buggy code:
n,l = (int(I) for i in input().split())
d = (l-1)*n+(n+1)*n//2
if l<1: print(d+1-l-min(n,1-l))
else: print(d-l)

Fixed code:
n,l = (int(i) for i in input().split())
d = (l-1)*n+(n+1)*n//2
if l<1: print(d+1-l-min(n,1-l))
else: print(d-l)
Buggy code:
import numpy as np

def acinput():
    return list(map(int,input().split(" ")))


N,L=acinput()


aji=L+np.arange(1,N+1)-1
sm=np.sum(aji)

arg=np.argmin(np.abs(aji))
if aji[arg]>=0:
        print(sm-aji[arg])
else:
        print(sm-aji[arg])


print(aji)


Fixed code:
import numpy as np

def acinput():
    return list(map(int,input().split(" ")))


N,L=acinput()


aji=L+np.arange(1,N+1)-1
sm=np.sum(aji)

arg=np.argmin(np.abs(aji))
if aji[arg]>=0:
        print(sm-aji[arg])
else:
        print(sm-aji[arg])
Buggy code:
N,L = list(map(int,input().split(" ")))

apple = list(range(L,L+N))

s = sum(apple)

m = 1000000000000000000
for x in apple:
  if abs(m) > abs(x):
    m = abs(x)

print(s-x)

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

apple = list(range(L,L+N))

s = sum(apple)

m = 10000000000000
for x in apple:
  if abs(m) > abs(x):
    m = x

print(s-m)
Buggy code:
n,l = map(int,input().split())
count = 0
lists = [l+i-1 for i in range(1,n+1)]

x = 2000
for i in range(n):
  if abs(x)>abs(lists[i]):
    x = lists[i]

print(sum(lists))

Fixed code:
n,l = map(int,input().split())
count = 0
lists = [l+i-1 for i in range(1,n+1)]
x = 2000
for i in range(n):
  if abs(x)>abs(lists[i]):
    x = lists[i]
lists.remove(x)
print(sum(lists))
Buggy code:
import numpy as np
N,L=map(int,input().split())
a=[]
for i in range(1,N+1):
  b=L+i-1
  a.append(b)
c=sum(a)
if L>0:
  d=min(a)
  print(c-d)
elif 0<=L and L>-N:
  print(c)
elif L<=-N:
  d=max(a)
  print(c-d)


Fixed code:
import numpy as np
N,L=map(int,input().split())
a=[]
for i in range(1,N+1):
  b=L+i-1
  a.append(b)
c=sum(a)
if L>0:
  d=min(a)
  print(c-d)
elif L<=0 and L>-N:
  print(c)
elif L<=-N:
  d=max(a)
  print(c-d)
Buggy code:
N, L = map(int,input().split())
taste = [ L + i for i in range(N) ]

abs_min_taste = 9999
min_i = -1
for i in range(N):
    if abs_min_taste > abs(taste[i]):
        min_i = i
        abs_min_taste = abs(taste[i])

sum_taste = sum(taste)
ans = sum_taste - taste[min_i]

Fixed code:
N, L = map(int,input().split())
taste = [ L + i for i in range(N) ]

abs_min_taste = 9999
min_i = -1
for i in range(N):
    if abs_min_taste > abs(taste[i]):
        min_i = i
        abs_min_taste = abs(taste[i])

sum_taste = sum(taste)
ans = sum_taste - taste[min_i]
#print(N, L, taste, abs_min_taste, ans)
print(ans)
Buggy code:
n,l = map(int,input().split())

apples = [l-i for i in range(n)]

eat = float('inf')
for a in apples:
  eat = a if abs(a)< abs(eat) else eat
  
print(sum(apples) - eat)

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

apples = [l+i for i in range(n)]

eat = float('inf')
for a in apples:
  eat = a if abs(a)< abs(eat) else eat
  

print(sum(apples) - eat)
Buggy code:
N,L = map(int,input().split())

taste = 0
taste_sum = 0
eat = 0
temp_eat = 0

for i in range(1,N+1):
  taste = L+i-1
  taste_sum += taste
  if i == 1:
    temp_eat = abs(taste)
  elif abs(taste) < temp_eat:
    eat = taste

print(taste_sum - eat)

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

taste = 0
taste_sum = 0
eat = 0
temp_eat = 0

for i in range(1,N+1):
  taste = L+i-1
  taste_sum += taste
  
  if i == 1:
    eat = taste
    temp_eat = abs(taste)
    
  elif abs(taste) < temp_eat:
    temp_eat = abs(taste)
    eat = taste

print(taste_sum - eat)
Buggy code:
N, L = map(int, input().split())
for _ in range(N):
    tmp += L
    L += 1
if tmp == 0:
    print(0)
elif tmp > 0:
    if L=< 0:
        print(tmp)
    else:
        print(tmp-L)
else:
    if N > L:
        print(tmp)
    else:
        print(tmp-(N+L-1))
        

Fixed code:
N, L = map(int, input().split())
tmp = 0
i = L
for _ in range(N):
    tmp += i
    i += 1
if tmp == 0:
    print(0)
elif tmp > 0:
    if L < 1:
        print(tmp)
    else:
        print(tmp-L)
else:
    if N+L == 0:
        print(tmp+1)
    elif N + L > 0:
        print(tmp)
    else:
        print(tmp - N - L + 1)
Buggy code:
n,l = map(int,input().split())
apple = [l + i -1 for i in range(1, n+1)]
org = sum(apple)
dif = org
for i in range(n):
    if abs(sum(apple[:i]+apple[i+1:]) - org) < dif:
        dif = abs(sum(apple[:i]+apple[i+1:]) - org)
        ans = sum(apple[:i]+apple[i+1:])
print(ans)

Fixed code:
n,l = map(int,input().split())
apple = [l + i -1 for i in range(1, n+1)]
org = sum(apple)

for i in range(n):
    if i == 0:
        dif = abs(sum(apple[:i]+apple[i+1:]) - org)
        ans = sum(apple[i+1:])
    elif abs(sum(apple[:i]+apple[i+1:]) - org) < dif:
        dif = abs(sum(apple[:i]+apple[i+1:]) - org)
        ans = sum(apple[:i]+apple[i+1:])
print(ans)
Buggy code:
n,l=map(int, input().split())

mi=l
ma=l+n-1

if mi <= 0 and 0 <= ma:
    print(int((mi+ma)*n/2))
else:
    print(int((mi+ma)*n/2-abs(min(mi, ma))))

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

mi=l
ma=l+n-1

if mi <= 0 and 0 <= ma:
    print(int((mi+ma)*n/2))
elif abs(mi) < abs(ma):
    print(int((mi+ma)*n/2-mi))
else:
    print(int((mi+ma)*n/2-ma))
Buggy code:
n,l = map(int,input().split())

if l+n-1 <=0:
    minL = l+n-1
elif l<=0 and l+n-1 >=0:
    minL = 0
elif l>=0:
    minL  = 0

taste = n*(2*l+n-1)/2-minL

print(int(taste))

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

if l+n-1 <=0:
    minL = l+n-1
elif l<=0 and l+n-1 >=0:
    minL = 0
elif l>=0:
    minL  = l

taste = n*(2*l+n-1)/2-minL

print(int(taste))
Buggy code:
l,m = map(int,input().split())
lis =[]
lis2=[]
for i in range(l):
  lis.append(m+i-1)
  lis2.append(abs(m+i-1))

lis.pop(list_name.index(min(lis2)))
print(sum(lis)
  

Fixed code:
l,m = map(int,input().split())
lis =[]
lis2=[]
for i in range(l):
  lis.append(m+i)
  lis2.append(abs(m+i))

lis.pop(lis2.index(min(lis2)))
print(sum(lis))
Buggy code:
n,l = map(int,input().split())
min_abs = 10**9
tmp = 10**9
for i in range(n):
    if abs(l + i) < min_abs:
        min_abs = abs(l+i)
        tmp = i
print(min_abs)
ans = 0
for i in range(n):
    if i == tmp:
        continue
    else:
        ans += l + i

print(ans)

Fixed code:
n,l = map(int,input().split())
min_abs = 10**9
tmp = 10**9
for i in range(n):
    if abs(l + i) < min_abs:
        min_abs = abs(l+i)
        tmp = i
ans = 0
for i in range(n):
    if i == tmp:
        continue
    else:
        ans += l + i

print(ans)
Buggy code:
# -*- coding:utf-8 -*-

def solve():
    N, L = list(map(int, input().split()))
    all_taste = 0
    eat_taste = float("inf")
    for i in range(1, N+1):
        all_taste += L+i-1
        eat_taste = min(eat_taste, abs(L+i-1))
    print(eat_taste)
    
    if all_taste > 0:
        ans = all_taste - eat_taste
    else:
        ans = all_taste + eat_taste
    print(ans)



if __name__ == "__main__":
    solve()


Fixed code:
# -*- coding:utf-8 -*-

def solve():
    N, L = list(map(int, input().split()))
    all_taste = 0
    eat_taste = float("inf")
    for i in range(1, N+1):
        all_taste += L+i-1
        eat_taste = min(eat_taste, abs(L+i-1))
    
    if all_taste > 0:
        ans = all_taste - eat_taste
    else:
        ans = all_taste + eat_taste
    print(ans)



if __name__ == "__main__":
    solve()
Buggy code:
N,L = map(int,input().split())
taste = tmp = []
for i in range(1,N):
  tmp.append(abs(L + i -1))
  taste.append((L + i -1))
num = tmp.index(min(tmp)) 
taste.index(num) = 0
print(sum(taste))

Fixed code:
N,L = map(int,input().split())
taste = []
tmp = []
for i in range(1,N+1):
	tmp.append(abs(L + i -1))
	taste.append((L + i -1))
num = tmp.index(min(tmp)) 
taste[num] = 0
print(sum(taste))
Buggy code:
n,l = map(int,input().split())
aji = []
for i in range(n):
    aji.append(l+i)
sum_aji = sum(aji)
min_diff = float("inf")
ans = 0
for s in aji:
    if abs(s) < min_diff:
        ans = sum_aji-s
print(ans)

Fixed code:
n,l = map(int,input().split())
aji = []
for i in range(n):
    aji.append(l+i)
sum_aji = sum(aji)
min_diff = float("inf")
ans = 0
for s in aji:
    if abs(s) < min_diff:
        min_diff = abs(s)
        ans = sum_aji-s
print(ans)
Buggy code:
N,L = map(int,input().split())
A = [L + n for n in range(N)]

ans = 9999999999

for a in A:
  if abs(a) < ans:
    ans = a
    
print(sum(A) - a)

Fixed code:
N,L = map(int,input().split())
A = [L + n for n in range(N)]

ans = 9999999999

for a in A:
  if abs(a) < abs(ans):
    ans = a
    
print(sum(A) - ans)
Buggy code:
N,L = map(int,input().split())
l = list(map(lambda x : L+x+1 , range(1,N+1)))
print(sum(l)-min(l,key=abs))

Fixed code:
N,L = map(int,input().split())
apple_list = list(map(lambda x: L+x-1 , range(1,N+1)))
print(sum(apple_list) - min(apple_list,key=abs))
Buggy code:
N,L = map(int,input().split())
l = list(map(lambda x : L+x+1 , range(1,N+1)))
print(sum(l)-min(l,key=min))

Fixed code:
N,L = map(int,input().split())
l = list(map(lambda x : L+x-1 , range(1,N+1)))
print(sum(l)-min(l,key=abs))
Buggy code:
N, L = map(int, input().split())

if L > 0:
  taste = N * (L + L + N - 1) / 2 - L
elif L + N - 1 < 0:
  taste = N * (L + L + N - 1) / 2 - (L + N - 1)
else:
  taste = N * (L + L + N - 1) / 2

print(taste)

Fixed code:
N, L = map(int,input().split())
if L+N-1 < 0:
    print((N-1)*(2*L+N-2)//2)
elif 0 < L:
    print((2*L+N)*(N-1)//2)
else:
    print((2*L+N-1)*N//2)
Buggy code:
n, l = map(int, input().split())
a = sorted([l + i for i in range(n)], key=abs)
print(sum(s[1:]))



Fixed code:
n, l = map(int, input().split())
a = sorted([l + i for i in range(n)], key=abs)
print(sum(a[1:]))
Buggy code:
n,k=map(int,input().split())
sum=k
tmp=abs(k,0)
for i in range(1,n):
  sum+=k+i
  if tmp>abs(k+i,0):
    tmp=abs(k+i,0)
print(sum-tmp)

Fixed code:
n,k=map(int,input().split())
sum=k
tmp=k
for i in range(1,n):
  sum+=k+i
  if abs(tmp)>abs(k+i):
    tmp=k+i
print(sum-tmp)
Buggy code:
N, L = input().split()
apples = [x + int(L) for x in list(range(int(N))
abs_apples = [abs(x) for x in apples]
abs_min_index = abs_apples.index(min(abs_apples))
print(sum(apples) - apples[abs_min_index])

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

apples = list(range(N)) 
apples = [x + L for x in apples]
abs_apples = [abs(x) for x in apples]
abs_min_index = abs_apples.index(min(abs_apples))

print(sum(apples) - apples[abs_min_index])
Buggy code:
N, L = map(int, input().split())
L = list(range(L, N+L))
L=list(map(lambda x: abs(x), L))
L.pop(L.index(min(L)))
print(sum(L))

Fixed code:
N, L = map(int, input().split())
L = list(range(L, N+L))
L_abs=list(map(lambda x: abs(x), L))
L.pop(L_abs.index(min(L_abs)))
print(sum(L))