qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N,L=map(int,input().split())
if L >= 0:
  print(N/2*(L + 1 + L + N - 1))
else:
  if L + N - 1 >= 0: 
    print(N / 2 * (L + 1 + L + N - 1))
  else:
    print(N / 2 * (L + 1 + L + N - 2))

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

Fixed code:
N,L=map(int,input().split())
s=0
l=[]
for i in range(N):
    s+=L+i
    l.append(abs(L+i))
l=sorted(l)
if l[0]<=L:
    s-=l[0]
else:
    s+=l[0]
print(s)
Buggy code:
(N,L)=input().split(' ')
N = int ( N )
L = int ( L )
A=[]
B=[]
for i in range ( N ):
    A.append ( L+i )    
    B.append ( abs ( L+i ) )

B.sort ( )

if ( sum(A) < 0 ):    
    print ( -1*sum(B[1:]) )
else:
    print ( sum(B[1:]) )
    


Fixed code:
(N,L)=input().split(' ')
N = int ( N )
L = int ( L )
A =[]
B =[]
for i in range ( N ) :
   A.append ( abs ( L + i ) )
   B.append ( L + i )

A.sort()   

if  ( L < 0 ) :
    print ( sum ( B ) + A[0] )

else :
    print ( sum ( B ) - A[0] )
Buggy code:
hoge = input().split()
N = int(hoge[0])
L = int(hoge[1])

if L > 0:
  print("a")
  erase_apple = 0
elif L+N-1 >= 0:
  for i in range(N):
    if i + L == 0:
      break
else:
  erase_apple = N-1

print(erase_apple)
apples = []
for i in range(N):
  apples.append(L+i)

apples.pop(erase_apple)
print(sum(apples))

Fixed code:
hoge = input().split()
N = int(hoge[0])
L = int(hoge[1])

if L > 0:
  erase_apple = 0
elif L+N >= 0:
  for i in range(N+1):
    if i + L == 0:
      erase_apple = i
      break
else:
  erase_apple = N-1

if erase_apple == N:
  erase_apple = N-1

apples = []
for i in range(N):
  apples.append(L+i)

apples.pop(erase_apple)
print(sum(apples))
Buggy code:
n,l=input().split(" ")
N=int(n)
L=int(l)
def sum(l,n):
    a=0
    for i in range (l,n+1):
        a+=i
    return a
def x(N,L):
    a=L
    for i in range (1, N+1):
        if a>abs(L+i-1):
            a=L+i-1
    return sum(L,L+N-1)-a
print (int(x(N,L)))

Fixed code:
n,l=input().split(" ")
N=int(n)
L=int(l)
def sum(l,n):
    a=0
    for i in range (l,n+1):
        a+=i
    return a
def x(N,L):
    a=abs(L)
    b=1
    for i in range (1, N+1):
        if a>abs(L+i-1):
            b=i
            a=abs(L+i-1)
    return sum(L,L+N-1)-(L+b-1)
print (int(x(N,L)))
Buggy code:
import sys, bisect, math, heapq

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))

N, L = read_int()

apples = [L + i for i in range(N)]
print(apples)
tasteN = sum(apples)
print(tasteN)
INF = float('INF')
def solve():
    res = INF
    for a in apples:
        res = min(res, abs(a))
        print(res)
    return tasteN - res if res * tasteN > 0 else tasteN + res

if __name__ == "__main__":
    print(solve())


Fixed code:
import sys, bisect, math, heapq

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))

N, L = read_int()

apples = [L + i for i in range(N)]
tasteN = sum(apples)
INF = float('INF')
def solve():
    res = INF
    for a in apples:
        res = min(res, abs(a))
    return tasteN - res if res * tasteN > 0 else tasteN + res

if __name__ == "__main__":
    print(solve())
Buggy code:
a, b=input().split(" ")
a=int(a)
b=int(b)

total=a*(b-1)+a*(a+1)/2

c=abs(b)
d=1
for i in range (1, a+1):
    if abs(b+i-1)<=c:
        d=i

print(int(total-(b+d-1)))

Fixed code:
a, b=input().split(" ")
a=int(a)
b=int(b)

total=a*(b-1)+a*(a+1)/2

c=abs(b)
d=1
for i in range (1, a+1):
    if abs(b+i-1)<c:
        d=i
        c=abs(b+i-1)

print(int(total-(b+d-1)))
Buggy code:
import numpy as np


def taste(N, L):
    all_abs = np.array([np.abs(L + i - 1) for i in range(1, N + 1)])
    all_base = np.array([L + i - 1 for i in range(1, N + 1)])

    return all_abs, all_base

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

all_abs, all_base = taste(N, L)

N_1_all = all_base[np.min(all_abs) != all_abs]

re = np.sum(N_1_all)
print(re)


Fixed code:
import numpy as np
 
 
def taste(N, L):
    all_abs = np.array([np.abs(L + i - 1) for i in range(1, N + 1)])
    all_base = np.array([L + i - 1 for i in range(1, N + 1)])
 
    return all_abs, all_base
 
N, L = map(int, input().split())
 
all_abs, all_base = taste(N, L)
 
N_1_all = all_base[np.min(all_abs) != all_abs]
 
re = np.sum(N_1_all)
print(re)
Buggy code:
N,L = map(int,input().split())
count = L
taste = []
for i in range(N):
    taste.append(count)
    count += 1
if 0 in taste:
    taste.remove(0)
elif  N + L <= 0:
    taste.pop(-1)
else:
    taste.pop(0)
print(taste)

Fixed code:
N,L = map(int,input().split())
count = L
taste = []
for i in range(N):
    taste.append(count)
    count += 1
if 0 in taste:
    taste.remove(0)
elif  N + L <= 0:
    taste.pop(-1)
else:
    taste.pop(0)
print(sum(taste))
Buggy code:
n, l = map(int, input().split())
pie = 0
comp = 300

for i in range(1, n+1):
    pie = pie + l + i - 1
    if abs(l + i -1) < comp:
        comp = l + i -1
        print(comp)

print(pie - comp)


Fixed code:
n, l = map(int, input().split())
pie = 0
comp = 300

for i in range(1, n+1):
    pie = pie + l + i - 1
    if abs(l + i -1) < abs(comp):
        comp = l + i -1

print(pie - comp)
Buggy code:
n, l = map(int, input().split())
 
total = 0
min_taste = 1000000000
 
for i in range(n):
    taste = l + i
    total += taste
    if abs(taste) < abs(min_taste):
        min_taste = taste
 
print(total - dis_min)

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

total = 0
dis_min = 1000000000

for i in range(n):
    taste = l + i
    total += taste
    if abs(taste) < abs(dis_min):
        dis_min = taste

print(total - dis_min)
Buggy code:
n,l=map(int,input().split())

if l<0:
    if l+n-1>0:
        print(l*n+(n-1)*n/2)
    else:
        print(l*(n-1)+(n-2)*(n-1)/2)
else:
    print((l+1)*(n-1)+(n-2)*(n-1)/2)

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

if l<0:
    if l+n-1>0:
        print(int(l*n+(n-1)*n/2))
    else:
        print(int(l*(n-1)+(n-2)*(n-1)/2))
else:
    print(int((l+1)*(n-1)+(n-2)*(n-1)/2))
Buggy code:
# -*- coding: utf-8 -*-
def pop_min_abs(l):
    abs = map(abs, l)
    return l.pop(abs.index(min(abs)))



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

apples = [l+i-1 for i in range(1,n+1)]
print(sum(pop_min_abs(apples)))


Fixed code:
# -*- coding: utf-8 -*-
def pop_min_abs(l):
    abs_l = list(map(abs, l))
    l.pop(abs_l.index(min(abs_l)))
    return l



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

apples = [l+i-1 for i in range(1,n+1)]
print(sum(pop_min_abs(apples)))
Buggy code:
N,L = list(map(int,input().split()))


i = 0
taste = []

while i <= N:
        taste.append(L + i - 1)
        i += 1
      
if L <= 0:
        print(sum(taste))
elif L > 0:
        print(sum(taste[1:N]))


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


i = 1
taste = []

while i <= N:
        taste.append(L + i - 1)
        i += 1


if L > 0 :
        print(sum(taste[1:N]))
elif L <= 0 and N + L < 0:
        print(sum(taste[0:N-1]))
elif L <= 0 and N + L > 0:
        print(sum(taste[0:N]))
elif L <= 0 and N + L == 0:
        print(sum(taste[0:N-1]))
Buggy code:
n, l = (int(i) for i in input().split())

lst = []
for i in range(n):
     lst.append(l + i)

avg = [abs(sum(lst) - i) for i in lst]

cnt = 0
tmp = 999
for n in range(len(avg)):
    ans = abs(sum(lst) - avg[n])
    if abs(sum(lst) - avg[n]) < tmp:
        cnt = n
        tmp = ans
print(sum(lst) - lst[cnt])



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

lst = []
for i in range(n):
     lst.append(l + i)

avg = [sum(lst) - i for i in lst]

cnt = 0
tmp = 999
for n in range(len(avg) ):
    ans = abs(sum(lst) - avg[n])
    if abs(sum(lst) - avg[n]) < tmp:
        cnt = n
        tmp = ans
print(sum(lst) - lst[cnt])
Buggy code:
# -*- coding:utf-8 -*-

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

ringo=[]

for i in range(n):
	ringo.append(l+i)
min = abs(ringo[0])
min_nim = 0
for i in range(len(ringo)):
	if min > abs(ringo[i]):
		min = abs(ringo[i])
		min_num = i
out = 0
for i in range(len(ringo)):
	if i != min_num:
		out = out + ringo[i]
print(out)





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

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

ringo=[]

for i in range(n):
	ringo.append(l+i)
min = abs(ringo[0])
min_num = 0
for i in range(len(ringo)):
	if min > abs(ringo[i]):
		min = abs(ringo[i])
		min_num = i
out = 0
for i in range(len(ringo)):
	if i != min_num:
		out = out + ringo[i]
print(out)
Buggy code:
n, l = map(int, input().split())

if l+n<=-1:
  print((n-1)*l + (n-2)*(n-1)/2)
  
elif l>=1:
  print((n-1)*l + n*(n-1)/2)
  
else:
  print(l*n + (n-1)*n/2)

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

if l+n-1<=-1:
  print(int((n-1)*l + (n-2)*(n-1)/2))
  
elif l>=1:
  print(int((n-1)*l + n*(n-1)/2))
  
else:
  print(int(l*n + (n-1)*n/2))
Buggy code:
def output(in_):
    import numpy as np
    N, L = [int(el) for el in in_.split(' ')]
    tastes = np.arange(L,N+L)
    return sum(tastes) - min(tastes)


in_ = input()
print(output(in_))

Fixed code:
def output(in_):
    import numpy as np
    N, L = [int(el) for el in in_.split(' ')]
    tastes = np.arange(L,N+L)
    return sum(tastes) - tastes[np.argmin(abs(tastes))]

  
in_ = input()
print(output(in_))
Buggy code:

n, l = map(int, input().split())
data = [l] * n
ans = 0

for i in range(n):
    data[i] += i
    ans += data[i]

mini = abs(data[0])
temp = data[0]
print(ans)
print(data)
for i in range(n):
    if mini > abs(data[i]):
        mini = abs(data[i])
        temp = data[i]

print(ans - temp)


Fixed code:

n, l = map(int, input().split())
data = [l] * n
ans = 0

for i in range(n):
    data[i] += i
    ans += data[i]

mini = abs(data[0])
temp = data[0]

for i in range(n):
    if mini > abs(data[i]):
        mini = abs(data[i])
        temp = data[i]

print(ans - temp)
Buggy code:
nl = input().split(' ')
n = int(nl[0])
l = int(nl[1])

taste = 0
judge = True
for i in range(n):
	taste_i = l + (i + 1) - 1 
	print(taste_i)
	if taste_i == 0:
		judge = False
	taste += l + (i + 1) - 1

if judge:
	if taste_i < 0:
		taste = taste - taste_i
	else:
		taste = taste - (l + 1 - 1)
		
print(taste)

Fixed code:
nl = input().split(' ')
n = int(nl[0])
l = int(nl[1])

taste = 0
judge = True
for i in range(n):
	taste_i = l + (i + 1) - 1 
	if taste_i == 0:
		judge = False
	taste += l + (i + 1) - 1

if judge:
	if taste_i < 0:
		taste = taste - taste_i
	else:
		taste = taste - (l + 1 - 1)

print(taste)
Buggy code:
n ,l =map(int,input().split())
aji = []

apple = min(range(l,l+n),key=abs)
print(sum(aji)-apple)


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

apple = min(range(l,l+n),key=abs)
print(sum(range(l,l+n))-apple)
Buggy code:
n, l = map(int, input().split())

apple = [i + l for i in range(n)]
aji = sum(apple)
print(apple, aji)

if 0 in apple:
    print(aji)
elif apple[0] > 0:
    print(aji - min(apple))
else:
    print(aji - max(apple))


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

apple = [i + l for i in range(n)]
aji = sum(apple)

if 0 in apple:
    print(aji)
elif apple[0] > 0:
    print(aji - min(apple))
else:
    print(aji - max(apple))
Buggy code:
N,L=map(int,input().split())
a=[abs(L+i-1) for i in range(1,N+1)]
print(a)
print(N*L-L+sum([i for i in range(1,N+1)])-N-a.index(min(a)))

Fixed code:
N,L=map(int,input().split())
a=[abs(L+i-1) for i in range(1,N+1)]
print(N*L-L+sum([i for i in range(1,N+1)])-N-a.index(min(a)))
Buggy code:
N,L=map(int,input().split())
s = N*L+sum(1,N+1)-N
K=''
for i in range(1,N+1):  
    K.append(L+i-1)
if 0 <= K[0]:
    s -= K[0]
elif K[0]<0 and K[N-1]>0:
    s = s
else:
    s -= K[N-1]
print(s)

Fixed code:
N,L=map(int,input().split())
s = N*L
for i in range (N+1):
    s += i
s -= N
K=[]
for i in range(1,N+1):  
    K.append(L+i-1)
if 0 <= K[0]:
    s -= K[0]
elif K[0]<0 and K[N-1]>0:
    s = s
else:
    s -= K[N-1]
print(s)
Buggy code:
import copy
N, L = map(int, input().split())

taste = list(range(1, N+1))
for a in range(0, N):
    taste[a] = taste[a] + L - 1

abs_taste = copy.deepcopy(taste)

for a in range(0, N):
    abs_taste[a] = abs(abs_taste[a])

print(sum(taste))


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

taste = list(range(1, N+1))
for a in range(0, N):
    taste[a] = taste[a] + L - 1

abs_taste = copy.deepcopy(taste)

for a in range(0, N):
    abs_taste[a] = abs(abs_taste[a])

taste.pop(abs_taste.index(min(abs_taste)))


print(sum(taste))
Buggy code:
import numpy as np
N, L = map(int,input().split())
tast_list = [L + i for i in range(N)]
print(tast_list)
drop_iter = np.argmin(np.abs(tast_list))
del tast_list[drop_iter]
print(sum(tast_list))

Fixed code:
import numpy as np
N, L = map(int,input().split())
tast_list = [L + i for i in range(N)]
drop_iter = np.argmin(np.abs(tast_list))
del tast_list[drop_iter]
print(sum(tast_list))
Buggy code:
import numpy as np

n, l = [int(i) for i in input().split()]
tastes = []
for i in range(n):
    tastes.append(i + l)
if np.abs(tastes[0]) > np.abs(tastes[-1]):
    print(sum(tastes[:-1]))
else:
    print(sum(tastes[1:]))

Fixed code:
import numpy as np

n, l = [int(i) for i in input().split()]
tastes = []
for i in range(n):
    tastes.append(i + l)
if 0 in tastes:
    print(sum(tastes))
elif np.abs(tastes[0]) > np.abs(tastes[-1]):
    print(sum(tastes[:-1]))
elif np.abs(tastes[0]) == np.abs(tastes[-1]):
    print(sum(tastes))
else:
    print(sum(tastes[1:]))
Buggy code:
N, L = map(int, input().split())

taste = []
taste_abs = []
for i in range(N):
    taste.append(L+i)
    taste_abs.append(abs(L+i))

print(sum(taste) - min(taste_abs))

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

taste = []
taste_abs = []
for i in range(N):
    taste.append(L+i)
    taste_abs.append(abs(L+i))
    
minidx = taste_abs.index(min(taste_abs))

print(sum(taste) - taste[minidx])
Buggy code:
N, L = list(map(int, input().split()))
resultList = []
tasteList = []
for i in range(N):
    x = int(L + i)
    resultList.append(x)
    tasteList.append(abs(x))

listMin = min(tasteList)
listNum = tasteList.index(listMin)
if tasteList[listNum] > 0:
    listSum = sum(resultList) + listMin
else:
    listSum = sum(resultList) - listMin

print(listSum)

Fixed code:
N, L = list(map(int, input().split()))
resultList = []
tasteList = []
for i in range(N):
    x = int(L + i)
    resultList.append(x)
    tasteList.append(abs(x))

listMin = min(tasteList)
listNum = tasteList.index(listMin)

if resultList[listNum] > 0:
    listSum = sum(resultList) - listMin
else:
    listSum = sum(resultList) + listMin

print(listSum)
Buggy code:
N, L = map(int, input().split())
lst = []

for i in range(N):
  lst.append(L + (i+1) - 1)
  
if L >= 0:
  print(sum(lst)-lst[0])
elif L+N-1 >= 0:
  print(sum(lst))
else:
  print(sum(lst) - lst[n-1])

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

for i in range(N):
  lst.append(L + (i+1) - 1)
  
if L >= 0:
  print(sum(lst)-lst[0])
elif L+N-1 >= 0:
  print(sum(lst))
else:
  print(sum(lst) - lst[N-1])
Buggy code:
import numpy as np
N,L = map(int, input() . split())
x=[]
M = 0
N_list = np.array([])

for i in range(N):
  M += L + (i+1) - 1
  N_list = np.append(N_list, L + (i+1) - 1)
  
m = np.abs(N_list).argmin()

#M - N_list[m]
print(M - N_list[m])
  
  

Fixed code:
import numpy as np
N,L = map(int, input() . split())
x=[]
M = 0
N_list = np.array([])

for i in range(N):
  M += L + (i+1) - 1
  N_list = np.append(N_list, L + (i+1) - 1)
  
m = np.abs(N_list).argmin()

#M - N_list[m]
print(int(M - N_list[m]))
Buggy code:
n,k=map(int,input().split())
ju=False
for i in range(n):
  if k+i==0:
    ju=True
    break
ans=0
if ju:
  if k<0:
    for i in range(n-1):
      ans+=k+i
  else:
    for i in range(1,n):
      ans+=k+i
else:
  for i in range(n):
    ans+=k+i
print(ans)


Fixed code:
n,k=map(int,input().split())
ju=False
for i in range(n):
  if k+i==0:
    ju=True
    break
ans=0
if not ju:
  if k<0:
    for i in range(n-1):
      ans+=k+i
  else:
    for i in range(1,n):
      ans+=k+i
else:
  for i in range(n):
    ans+=k+i
print(ans)
Buggy code:
N, L = map(int,input().split())

p = []
pi = []
pi_s = []


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

all_t = sum(p)

for i in range(N):
    pi.append(all_t - p[i])
    pi_s.append(abs(all_t - pi[i]))

# print(p, pi,pi_s)
min_abs = pi_s[0]
ans = 0

for i in range(1,N):
    if min_abs > pi_s[i]:
        min_abs = pi_s[i]
        ans = i
        print(i)

# print(ans,pi[ans],pi_s[ans])

print(pi[ans])

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

p = []
pi = []
pi_s = []


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

all_t = sum(p)

for i in range(N):
    pi.append(all_t - p[i])
    pi_s.append(abs(all_t - pi[i]))

# print(p, pi,pi_s)
min_abs = pi_s[0]
ans = 0

for i in range(1,N):
    if min_abs > pi_s[i]:
        min_abs = pi_s[i]
        ans = i

# print(ans,pi[ans],pi_s[ans])

print(pi[ans])
Buggy code:
a,b = map(int, input().split())
tmp = []
for i in range(a):
  tmp.append(b+i)
if b < 0 and a <= abs(b):
  tmp = tmp[:-1]
elif b >= 0:
  tmp = tmp[1:]
print(tmp)

Fixed code:
a,b = map(int, input().split())
tmp = []
for i in range(a):
  tmp.append(b+i)
if b < 0 and a <= abs(b):
  tmp = tmp[:-1]
elif b >= 0:
  tmp = tmp[1:]
print(sum(tmp))
Buggy code:
N, L = map(int, input().split())



l = []

min_a = N + L * N


for i in range(N):
    a = L + i - 1 + 1

    if abs(a) < abs(min_a):
        min_a = abs(a)
        ans_i = i



    l.append(a)


ans = sum(l) - l[ans_i]

print(ans)


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



l = []

min_a = N + abs(L) * N * N + N


for i in range(N):
    a = L + i - 1 + 1

    if abs(a) < abs(min_a):
        min_a = abs(a)
        ans_i = i



    l.append(a)


ans = sum(l) - l[ans_i]

print(ans)
Buggy code:
n,l = map(int,input().split())
apple_sum = 0
eat_apple = float('inf')

for i in range(1,n+1):
	apple_sum += l + i - 1
	eat_apple = min(abs(l+i-1),abs(eat_apple))

ans = apple_sum - eat_apple

print(ans)

Fixed code:
n,l = map(int,input().split())
apple_sum = 0
eat_apple = float('inf')

for i in range(1,n+1):
	apple_sum += l + i - 1
	if abs(eat_apple) > abs(l+i-1):
		eat_apple = l+i-1

ans = apple_sum - eat_apple

print(ans)
Buggy code:
a = list(map(int,input().split()))
N = a[0]
L = a[1]

taste = 0

def if_test(N,L):
    if L > 0:
     for i in range(N):
      taste = taste + L + i
       
     taste = taste - L
     print(taste)
      
    elif L+N-1 < 0:
     for i in range(N):
      taste = taste + L + i 
          
     taste = taste - (L + N - 1)   
     print(taste)
        
    else:
     for i in range(N):
      taste = taste + L + i
      
     print(taste)
    
if_test(L,N)


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

 
def if_test(N,L):
  taste = 0
  if L > 0:
     for i in range(N):
      taste += (L + i)
#      print("L>0"+str(taste))
       
     taste = taste - L
     print(taste)
      
  elif (L+N-1) < 0:
     for i in range(N):
      taste = taste + L + i 
#      print("<0"+str(taste))
          
     taste = taste - (L + N - 1)   
     print(taste)
        
  else:
     for i in range(N):
      taste = taste + L + i
#      print(taste)
     print(taste)
    
if_test(N,L)
Buggy code:
N , X =map(int,input().split())
sums = []
i = X
result =[]
a = []
for i in range(N):
    sums.append(i+X)
for j in range(N):
    a.append(abs(sums[j]))

print(sum(sums) - min(a))


Fixed code:
N , X =map(int,input().split())
sums = []
i = X
result =[]
a = []
for i in range(N):
    sums.append(i+X)
for j in range(N):
    a.append(abs(sums[j]))

if sum(sums) ==abs(sum(sums)):
    print(sum(sums) - min(a))
else :
    print(sum(sums) + min(a))
Buggy code:
n, l = map(int, input().split())
a = range(l. l + n)
print(sum(a) - min(a, key=abs))

Fixed code:
n, l = map(int, input().split())
a = range(l, l + n)
print(sum(a) - min(a, key=abs))
Buggy code:
N, L = map(int, input().split())
if L <= 0 and L + N - 1 >= 0:
	print(N * ((N - 1) / 2 + L))
elif L > 0:
	print(N * ((N - 1) / 2 + L) - L)
else:
	print(N * ((N - 1) / 2 + L) - L - N + 1)

Fixed code:
N, L = map(int, input().split())
if L <= 0 and L + N - 1 >= 0:
	print(int(N * ((N - 1) / 2 + L)))
elif L > 0:
	print(int(N * ((N - 1) / 2 + L) - L))
else:
	print(int(N * ((N - 1) / 2 + L) - L - N + 1))
Buggy code:
N,L=map(int,input().split())
sum=(L-1)*N+(N+1)*N//2
mi=1000
for i in range(1,N+1):
    temp=L+i-1
    if abs(temp)<mi:
        idx=i
        mi=temp

print(sum-L+idx-1)

Fixed code:
N,L=map(int,input().split())
sum=(L-1)*N+(N+1)*N//2
mi=1000
for i in range(1,N+1):
    temp=L+i-1
    if abs(temp)<mi:
        idx=i
        mi=abs(temp)

print(sum-L-idx+1)
Buggy code:
n, l = map(int, input().split())
ans = 0
if l > 0:
    for i in range(l+1, l+n):
        ans += i
else:
    for i in range(l, l+n):
        ans += i
print(ans)


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

aji = [(i+1)+L-1 for i in range(N)]
abs = list(map(abs, aji))
index = abs.index(min(abs))

print(sum(aji)-aji[index])

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

aji = [(i+1)+int(L)-1 for i in range(int(N))]
abs = list(map(abs, aji))
index = abs.index(min(abs))

print(sum(aji)-aji[index])
Buggy code:
# 2019 6/22
# ABC 131 B Bite Eating

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

apple_pie = N * ( 2 * L + N - 1) / 2

if L >= 0:
    print("%d" % (apple_pie - L))

elif L <= 0 and (L + N - 1) >= 0:
    print(apple_pie)

else:
    print("%d" % (apple_pie - (L + N - 1)))

Fixed code:
# 2019 6/22
# ABC 131 B Bite Eating

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

apple_pie = N * ( 2 * L + N - 1) / 2

if L >= 0:
    print("%d" % (apple_pie - L))

elif L <= 0 and (L + N - 1) >= 0:
    print("%d" % apple_pie)

else:
    print("%d" % (apple_pie - (L + N - 1)))
Buggy code:
N, L = map(int, input().split())
min = L + N
ans = 0
for n in range(N):
    tmp = L+n
    ans += tmp
    if abs(min) > abs(tmp):
        min = tmp

print(ans-min)


Fixed code:
N, L = map(int, input().split())
min = abs(L) + N
ans = 0
for n in range(1, N+1):
    tmp = L+n-1
    ans += tmp
    if abs(min) > abs(tmp):
        min = tmp

print(ans-min)
Buggy code:
N,L = map(int,input().split())
if L >=0:
    Aji = list(range(L+1,L+N))
    ans = sum(Aji)
    print(Aji)
    print(ans)
elif L<0 and L+N >= 1:
    Aji = list(range(L,L+N))
    ans = sum(Aji)
    print(Aji)
    print(ans)
else:
    Aji = list(range(L,L+N-1))
    ans = sum(Aji)
    print(Aji)
    print(ans)

Fixed code:
N,L = map(int,input().split())
if L >=0:
    Aji = list(range(L+1,L+N))
    ans = sum(Aji)
    print(ans)
elif L<0 and L+N >= 1:
    Aji = list(range(L,L+N))
    ans = sum(Aji)
    print(ans)
else:
    Aji = list(range(L,L+N-1))
    ans = sum(Aji)
    print(ans)
Buggy code:
N,L = list(map(int,input().split()))
taste = list(range(L,L+N))

m = max(taste)
for e in taste:
  if abs(e) < m:
    m = abs(e)
print(m,sum(taste) - m)

Fixed code:
N,L = list(map(int,input().split()))
taste = list(range(L,L+N))

m = max(taste)
for e in taste:
  if abs(e) < m:
    m = abs(e)
print(sum(taste) - m)
Buggy code:
NL = input()
N = int(NL[0])
L = int(NL[2])
apple = []
apple_abs = []
sum = 0
for i in range(1,N+1):
  apple.append(L+i-1)
  apple_abs.append(abs(L+i-1))

apple_min = min(apple_abs)

for i in apple:
  if abs(i) = apple_min:
    continue
  sum += i
print(sum)

Fixed code:
NL = input().split()
N = int(NL[0])
L = int(NL[1])
apple = []
apple_abs = []
sum = 0
for i in range(1,N+1):
  apple.append(L+i-1)
  apple_abs.append(abs(L+i-1))

apple_min = min(apple_abs)

for i in apple:
  if abs(i) == apple_min:
    continue
  sum += i
print(sum)
Buggy code:
N,L = map( int, input().split() )

applePie = L*N
min = 20000

for i in range(N):
    applePie += i
    if (L+i) < min:
        min = L+i

applePie -= min

print(applePie)

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

applePie = L*N
min = 20000

for i in range(N):
    applePie += i
    if (L+i)*(L+i) < min*min:
        min = L+i

applePie -= min

print(applePie)
Buggy code:
n, l = [int(s) for s in input().split(" ")]

rng = list(range(l, l+n))

min_abs = 0
val = 0
for r in rng:
  if min_abs > abs(r):
    min_abs = abs(r)
    val = r

print(sum(rng) - val)

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

rng = list(range(l, l+n))
min_abs = 400
val = 0
for r in rng:
  if min_abs > abs(r):
    min_abs = abs(r)
    val = r

print(sum(rng) - val)