ZhenlongDai/ACPR huggingface dataset:
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, L = map(int, input().split())
eat = L + N - 1
if eat > 0:
  eat = L
  if not eat > 0:
    eat = 0

print(1/2*N*(N-1)+(L-1)*N-eat)

Failing test case input:
16 -50

Expected output:
-645


Actual output:
-661.0


Fixed submission (verdict: Accepted):
N, L = map(int, input().split())
eat = L + N - 1
if eat > 0:
  eat = L
  if eat < 0:
    eat = 0

print("%d" % (1/2*N*(N+1)+(L-1)*N-eat))

Problem: p02994
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, L = map(int, input().split())

taste = [L + i for i in range(N)]
taste_abs = [abs(i) for i in taste]
eat = min(taste_abs)

print(sum(taste) - eat)


Failing test case input:
5 -50

Expected output:
-194


Actual output:
-286


Fixed submission (verdict: Accepted):
N, L = map(int, input().split())

taste = [L + i for i in range(N)]
taste_abs = [abs(i) for i in taste]
min_index = taste_abs.index(min(taste_abs))
eat = taste[min_index]

print(sum(taste) - eat)

Problem: p02994
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, L = map(int, input().split())

if abs(L-1) < N:
  i = abs(L - 1)
else:
  i = N

A = (N-1)*(L-1) + sum([n for n in range(N+1)]) - i
print(A)

Failing test case input:
38 4

Expected output:
851


Actual output:
849


Fixed submission (verdict: Accepted):
N, L = map(int, input().split())

if L-1 >= 0:
  i = 1
elif L-1 >= -N:
  i = -(L-1)
else:
  i = N

A = (N-1)*(L-1) + sum([n for n in range(1, N+1)]) - i
print(A)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
5 -23

Expected output:
-86


Actual output:
-86.0


Fixed submission (verdict: Accepted):
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))

Problem: p02994
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N, L = map(int, input().split())
A = list(range(1, N+1))
ans = 0
saisyo = float("inf")
saidai = -float("inf")
for i in range(N):
    x = A[i] + L-1 
    saisyo = min(x, saisyo)
    saidai  = max(x, saisyo)
    ans += x
if saisyo >=0:
    print(ans-saisyo)
else:
    print(ans-saidai)

Failing test case input:
10 -5

Expected output:
-5


Actual output:
-9


Fixed submission (verdict: Accepted):
N, L = map(int, input().split())
A = list(range(1, N+1))
ans = 0
saisyo = float("inf")
saidai = -float("inf")
for i in range(N):
    x = A[i] + L-1 
    saisyo = min(x, saisyo)
    saidai  = max(x, saisyo)
    ans += x
if saidai < 0:
    print(ans-saidai)
elif saidai >= 0 and saisyo <= 0 :
    print(ans)
else:
    print(ans-saisyo)
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
33 -124

Expected output:
-3472


Actual output:
-3440


Fixed submission (verdict: Accepted):
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)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, L = map(int,input().split())

A_list = []
aji = 0

for i in range(N):
    A_list.append(L + i -1)
    aji += (L + i - 1)




x = min(A_list,key= lambda A_list:abs(A_list))


aji -= x
print(aji)



Failing test case input:
38 4

Expected output:
851


Actual output:
814


Fixed submission (verdict: Accepted):
N, L = map(int,input().split())

A_list = []
aji = 0

for i in range(N):
    A_list.append(L + i)
    aji += (L + i)




x = min(A_list,key= lambda A_list:abs(A_list))


aji -= x
print(aji)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,l=map(int, input().split())
t=0
c=0
for i in range(n):
  if i==0:
    t=abs(l+(i+1)-1)
    c=0
  else:
    t=min(t, abs(l+(i+1)-1))
    if t==abs(l+(i+1)-1):
      c=i+1
g=0
for i in range(n):
  g+=(l+(i+1)-1)
print(g-l-c)


Failing test case input:
5 -29

Expected output:
-110


Actual output:
-111


Fixed submission (verdict: Accepted):
n,l=map(int, input().split())
t=0
c=0
for i in range(n):
  if i==0:
    t=abs(l+(i+1)-1)
    c=i+1
  else:
    t=min(t, abs(l+(i+1)-1))
    if t==abs(l+(i+1)-1):
      c=i+1

g=0
for i in range(n):
  g+=(l+(i+1)-1)

print(g-l-c+1)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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) - a)

Failing test case input:
38 4

Expected output:
851


Actual output:
814


Fixed submission (verdict: Accepted):
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)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,L = map(int, input().split())
allsum = N
eat = 0
if L >= 0:
        eat = L
elif L + N >= 0:
        eat = 0
else:
        eat = L + N - 1
print(allsum - eat)

Failing test case input:
17 7

Expected output:
248


Actual output:
10


Fixed submission (verdict: Accepted):
N,L = map(int, input().split())
allsum = int(N/2*(2*L+(N-1)))
eat = 0
if L >= 0:
        eat = L
elif L + N >= 1:
        eat = 0
else:
        eat = L + N - 1
print(allsum - eat)
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


import sys


import itertools

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N, L = map(int, read().split())
F = [L + i for i in range(N)]

ans = 0
for i in itertools.combinations(F,N-1):
    ans=max(sum(i),ans)
print(ans)


Failing test case input:
5 -6

Expected output:
-18


Actual output:
0


Fixed submission (verdict: Accepted):


import sys


import itertools

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N, L = map(int, readline().split())
F = [L + i for i in range(N)]


tmp = 1000
ans=0
for i in itertools.combinations(F, N - 1):
    if abs(sum(F)-sum(i)) < tmp:
        tmp = abs(sum(F)-sum(i))
        ans=sum(i)

print(ans)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, l = map(int, input().split())
taste = [l + i for i in range(n)]
min_abs = None
for i in taste:
    if min_abs == None or min_abs > abs(i):
        min_abs = i

print(sum(taste)-min_abs)



Failing test case input:
13 -8

Expected output:
-26


Actual output:
-18


Fixed submission (verdict: Accepted):
n, l = map(int, input().split())
taste = [l + i for i in range(n)]
min_abs = None
for i in taste:
    
    if min_abs == None or abs(min_abs) > abs(i):
        min_abs = i

print(sum(taste)-min_abs)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,l = map(int, input().split())
li = []
for i in range(n):
    li.append(l+i)
target = li[0]
for j in range(n):
    if abs(li[j]-0) < abs(li[0]):
        target = li[j]
li.remove(target)
print(sum(li))

Failing test case input:
13 -5

Expected output:
13


Actual output:
9


Fixed submission (verdict: Accepted):
n,l = map(int, input().split())
remove = l
li = [l]
for i in range(2,n+1):
    if abs((l+i-1)-0) < abs(remove):
        remove = l+i-1
    li.append(l+i-1)
print(sum(li)-remove)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,L = map(int, input().split())

Apple = []
for i in range(1, N+1):
  Apple.append(L + i - 1)

import itertools
c = itertools.combinations(Apple, N-1)
apple_sum = sum(Apple)
mi = (apple_sum + 1 )* 100
near = mi
ans = mi

if 0 in Apple:
  print(apple_sum)
else:
  for v in c:
    if apple_sum - sum(v) <= near:
      mi = sum(v)
      near = apple_sum - mi
  print(mi)

Failing test case input:
16 -88

Expected output:
-1215


Actual output:
-128700


Fixed submission (verdict: Accepted):
N,L = map(int, input().split())

Apple = []
for i in range(1, N+1):
  Apple.append(L + i - 1)

import itertools
c = itertools.combinations(Apple, N-1)
apple_sum = sum(Apple)
near = (apple_sum + 1 )* 100
ans = 0

if 0 in Apple:
  print(apple_sum)
else:
  for v in c:
    vv = sum(v)
    if abs(apple_sum - vv) <= abs(near):
      near = apple_sum - vv
      ans = vv
  print(ans)
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,l=map(int,input().split())
ans=[]
sum=0
for i in range(n):
    ans.append(abs(l+i))
    sum+=l+i
print(sum-min(ans))

Failing test case input:
16 -88

Expected output:
-1215


Actual output:
-1361


Fixed submission (verdict: Accepted):
n,l=map(int,input().split())
ans=[]
sum=0
for i in range(n):
    ans.append([abs(l+i),l+i])
    sum+=l+i
ans.sort()
print(sum-ans[0][1])

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):



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



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


aji_list = range(L, L+N, 1)
aji_abs_list = list(map(abs, aji_list))
aji_abs_list.sort()
min = aji_abs_list[0]

if not (L < min < L+N):
    min = min * -1


print(int(total - min))


Failing test case input:
15 14

Expected output:
301


Actual output:
329


Fixed submission (verdict: Accepted):



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



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


aji_list = range(L, L+N, 1)
aji_abs_list = list(map(abs, aji_list))
aji_abs_list.sort()
min_list = aji_abs_list[0]

min_minus = min_list * -1
if L <= min_minus <= L+N:
    min_list = min_minus


print(int(total - min_list))

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, l = map(int, input().split())
if l <= 0 and n > abs(l):
    print(2 * n * ((2 * l) + n - 1))
elif l <= 0 and n < abs(l):
    print(2 *(n - 1) * (2 * l + n - 2))
else:
    print(int((n - 1) * (2 * l + n) / 2))


Failing test case input:
3 -50

Expected output:
-99


Actual output:
-396


Fixed submission (verdict: Accepted):
n, l = map(int, input().split())
if l <= 0 and abs(l) < n:
    a = int((n * (2 * l + n - 1)) / 2)
    print(a)
elif l <= 0 and abs(l) >= n:
    a = int((n - 1) * (2 * l + n - 2) / 2)
    print(a)
else:
    a = int((n - 1) * (2 * l + n) / 2)
    print(a)

Problem: p02994
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n,l=map(int,input().split())
A=[]
for i in range(n):
    A.append(l+i)
B=A.copy()
for j in range(len(B)):
    B[j]=abs(B[j])
sum(A)-A[B.index(min(B))]

Failing test case input:
3 -88

Expected output:
-175


Actual output:
no output


Fixed submission (verdict: Accepted):
n,l=map(int,input().split())
A=[]
for i in range(n):
    A.append(l+i)
B=A.copy()
for j in range(len(B)):
    B[j]=abs(B[j])
print(sum(A)-A[B.index(min(B))])

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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 = e
print(sum(taste) - m)

Failing test case input:
13 -8

Expected output:
-26


Actual output:
-23


Fixed submission (verdict: Accepted):
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)
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, l = (int(i) for i in input().split())
ap=[]

for i in range(n):
	ap.append(l+i)

mn=min(map(abs,ap))

chk=0
if mn not in ap:
	mn=-mn

res=(l-1)*n+(1+n)*n/2-mn
print(res)

Failing test case input:
2 -50

Expected output:
-50


Actual output:
-50.0


Fixed submission (verdict: Accepted):
n, l = (int(i) for i in input().split())
ap=[]
 
for i in range(n):
	ap.append(l+i)
 
mn=min(map(abs,ap))
 
if mn not in ap:
	mn=-mn
 
res=int((l-1)*n+(1+n)*n/2-mn)
print(res)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,l=list(map(int, input().split()))
a=[l+i for i in range(n)]
absa=[abs(a[i]) for i in range(n)]
sum=0
for i in range(n):
	sum+=a[i]
print(sum-min(absa))

Failing test case input:
5 -50

Expected output:
-194


Actual output:
-286


Fixed submission (verdict: Accepted):
n,l=list(map(int, input().split()))
a=[l+i for i in range(n)]
b=[abs(a[i]) for i in range(n)]
j=b.index(min(b))
sum=0
for i in range(n):
	sum+=a[i]
print(sum-a[j])

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,L = map(int,input().rstrip().split(' '))
apple_pie = 0
ex = abs(L * N)
apple = []
for i in range(N):
    a = L + i 
    apple.append(a)
    apple_pie += a
print(apple)
for i in range(len(apple)):
    if abs(ex) > abs(apple[i]):
        ex = apple[i]
print(ex)
apple_pie-= ex
print(apple_pie)

Failing test case input:
9 -50

Expected output:
-372


Actual output:
[-50, -49, -48, -47, -46, -45, -44, -43, -42]
-42
-372


Fixed submission (verdict: Accepted):
N,L = map(int,input().rstrip().split(' '))
apple_pie = 0
ex = abs(L * N)
apple = []
for i in range(N):
    a = L + i 
    apple.append(a)
    apple_pie += a
for i in range(len(apple)):
    if abs(ex) > abs(apple[i]):
        ex = apple[i]
apple_pie-= ex
print(apple_pie)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,l=input().split()
n=int(n)
s=f=0
l=int(l)
for i in range(n):
    a=l+i
    if(a==0):
        f=1
    else:
        s+=a
if(f==0):
    s-=(l)
print(s)

Failing test case input:
18 -50

Expected output:
-714


Actual output:
-697


Fixed submission (verdict: Accepted):
n,l=input().split()
n=int(n)
s=f=0
l=int(l)

for i in range(n):
    a=l+i
    if(a==0):
        f=1
    else:
        s+=a
if(f==0):
    if(l<0):
        s-=(l+n-1)
    else:
        s-=l
print(s)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N, L = map(int,input().split())
min = 1000
ans = 0
A = [0] * N
for i in range(N):
    A[i] = L + (i+1) - 1
    ans += A[i]

for i in range(N):
    a = math.fabs(A[i])
    if a < min:
        min = a
ans -= min
print(int(ans))

Failing test case input:
18 -124

Expected output:
-1972


Actual output:
-2186


Fixed submission (verdict: Accepted):
import math
N, L = map(int,input().split())
min = 1000
ans = 0
A = [0] * N
for i in range(N):
    A[i] = L + (i+1) - 1
    ans += A[i]

for i in range(N):
    a = math.fabs(A[i])
    if a < min:
        min = a
        if A[i] < 0:
            judge = False
        else:
            judge = True
if judge:
    ans -= min
else:
    ans += min
print(int(ans))
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, L = map(int,input().split())
import statistics
S = []
for i in range(L,N+L):
    S.append(i)
ans = []
p = []
for j in S:
    ans.append(abs(sum(S) - sum(S) - j))
    p.append(sum(S)-j)
print(ans)
print(p[ans.index(min(ans))])

Failing test case input:
13 -8

Expected output:
-26


Actual output:
[8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4]
-26


Fixed submission (verdict: Accepted):
N, L = map(int,input().split())
import statistics
S = []
for i in range(L,N+L):
    S.append(i)
ans = []
p = []
for j in S:
    ans.append(abs(sum(S) - sum(S) - j))
    p.append(sum(S)-j)

print(p[ans.index(min(ans))])

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n, l = map(int, input().split())

    ls = [i + l for i in range(1, n+1)]
    if l >= 0:
        ls = ls[1:]
    elif n + l < 0:
        ls = ls[:-1]

    print(sum(ls))

if __name__ == '__main__':
    main()


Failing test case input:
3 -88

Expected output:
-175


Actual output:
-173


Fixed submission (verdict: Accepted):
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n, l = map(int, input().split())

    ls = [i + l for i in range(n)]
    if l >= 0:
        ls = ls[1:]
    elif n + l - 1 < 0:
        ls = ls[:-1]

    print(sum(ls))

if __name__ == '__main__':
    main()

Problem: p02994
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,l=map(int,input().split())
ringo=[0]*n
ringoz=[0]*n
for i in range(n):
    ringo[i]+=i+l
    if ringo[i]>=0:
        ringoz[i]=ringo[i]
    else:
        ringoz[i]=-ringo[i]
print(sum(ringo)-min(ringoz))


Failing test case input:
33 -124

Expected output:
-3472


Actual output:
-3656


Fixed submission (verdict: Accepted):
n,l=map(int,input().split())
ringo=[0]*n
ringoz=[0]*n
min=1000000000000000
mini=0
for i in range(n):
    ringo[i]+=i+l
    if ringo[i]<0:
        ringoz[i]=-ringo[i]
    else:
        ringoz[i]=ringo[i]
    if ringoz[i]<min:
        min=ringoz[i]
        mini=i
ringo.pop(mini)

print(sum(ringo))

Problem: p02994
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
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)


Failing test case input:
5 -23

Expected output:
-86


Actual output:
-105


Fixed submission (verdict: Accepted):
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)
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, l = map(int, input().split())

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

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


Failing test case input:
13 -8

Expected output:
-26


Actual output:
0


Fixed submission (verdict: Accepted):
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))

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,l=map(int,input().split())
if l<0 and l+n-1<0:
    print((2*l+n-2)*(n-1)/2)
elif l>0 and l+n-1>0:
    print((2*l+n)*(n-1)/2)
else:
    print((2*l+n-1)*n/2)

Failing test case input:
13 -88

Expected output:
-990


Actual output:
-990.0


Fixed submission (verdict: Accepted):
n,l=map(int,input().split())
if l<0 and l+n-1<0:
    print((2*l+n-2)*(n-1)
elif l>0 and l+n-1>0:
    print((2*l+n)*(n-1)
else:
    print((2*l+n-1)*n

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
18 -124

Expected output:
-1972


Actual output:
-1955


Fixed submission (verdict: Accepted):
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)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N, L = list(map(int,input().split()))
A = [None for _ in range(N)]

m = float('inf')
for i in range(N):
  A[i] = L + i
  if m > abs(A[i]):
    m = abs(A[i])

print(sum(A) - m)

Failing test case input:
18 -124

Expected output:
-1972


Actual output:
-2186


Fixed submission (verdict: Accepted):

N, L = list(map(int,input().split()))
A = [None for _ in range(N)]

m = float('inf')
M = 0
for i in range(N):
  A[i] = L + i
  if m > abs(A[i]):
    m = abs(A[i])
    M = A[i] 

print(sum(A) - M)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
input=input().split()

N=int(input[0])
L=int(input[1])
taste=0
LA=L
if L>0:
	for i in range(N-1):
		LA+=1
		taste+=LA
		
	print(taste)

elif L<-4:
	for i in range(N-1):
		taste+=LA
		LA+=1

	print(taste)
else:
	for i in range(N-1):
		taste+=LA
		LA+=1
	print(taste)



Failing test case input:
13 -5

Expected output:
13


Actual output:
6


Fixed submission (verdict: Accepted):
input=input().split()

N=int(input[0])
L=int(input[1])
taste=0
if L>0:
	for i in range(N-1):
		L+=1
		taste+=L
		
	print(taste)

elif L<0 and -L>=N:
	for i in range(N-1):
		taste+=L
		L+=1

	print(taste)
else:
	for i in range(N):
		taste+=L
		L+=1
		
		
	print(taste)
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,l=map(int,input().split())
no=1000
num=0
for i in range(n):
    if abs(l+i)<no:
        no=abs(l+i)
        num=i
ans=0
for i in range(n):
    ans+=abs(l+i)
ans=ans-abs(l+num)
print(ans)

Failing test case input:
5 -16

Expected output:
-58


Actual output:
58


Fixed submission (verdict: Accepted):
n,l=map(int,input().split())
no=1000
num=0
for i in range(n):
    if abs(l+i)<no:
        no=abs(l+i)
        num=i
ans=0
for i in range(n):
    ans+=l+i
ans=ans-l-num
print(ans)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, l = input().split()

def apple_aji(i):
  return int(l) + int(i) - 1

def apple_pie(n):
  ajis = [apple_aji(x) for x in n]
  mini = min(list(map(abs, ajis)))
  mini = mini * -1
  if mini in ajis:
    pass
  else:
    mini = mini * -1
  print(ajis)
  ajis.remove(mini)
  print(ajis)
  return sum(ajis)

print(apple_pie(range(1, int(n))))

Failing test case input:
18 -124

Expected output:
-1972


Actual output:
[-124, -123, -122, -121, -120, -119, -118, -117, -116, -115, -114, -113, -112, -111, -110, -109, -108]
[-124, -123, -122, -121, -120, -119, -118, -117, -116, -115, -114, -113, -112, -111, -110, -109]
-1864


Fixed submission (verdict: Accepted):
n, l = input().split()

def apple_aji(i):
  return int(l) + int(i) - 1

def remove_min(p):
  minimun = min(list(map(abs, p)))
  if minimun not in p:
    minimun = minimun * -1
  p.remove(minimun)
  return p

def apple_pie(n):
  ajis = [apple_aji(x) for x in n]
  return sum(remove_min(ajis))

print(apple_pie(range(1, int(n)+1)))

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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

Failing test case input:
15 14

Expected output:
301


Actual output:
301.0


Fixed submission (verdict: Accepted):
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

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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))

Failing test case input:
15 14

Expected output:
301


Actual output:
315


Fixed submission (verdict: Accepted):
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))
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, l = map(int, input().split())
nt = 0
nt1 = 0
for i in range(n):
    nt += l + i
if l >= 0:
    nt1 = nt - l
elif l + n -1 <=0:
    nt1 = nt -(l + n -1)
else:
    nt1 = nt1
print(nt1)

Failing test case input:
13 -5

Expected output:
13


Actual output:
0


Fixed submission (verdict: Accepted):
n, l = map(int, input().split())
nt = 0
nt1 = 0
for i in range(n):
    nt += l + i
if l >= 0:
    nt1 = nt - l
elif l + n -1 <=0:
    nt1 = nt -(l + n -1)
else:
    nt1 = nt
print(nt1)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,l=map(int,input().split())
ans=[]
sum=0
for i in range(n):
    ans.append([abs(l+i),l+i])
    sum+=l+i
ans.sort()
print(ans)
print(sum-ans[0][1])

Failing test case input:
38 4

Expected output:
851


Actual output:
[[4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14], [15, 15], [16, 16], [17, 17], [18, 18], [19, 19], [20, 20], [21, 21], [22, 22], [23, 23], [24, 24], [25, 25], [26, 26], [27, 27], [28, 28], [29, 29], [30, 30], [31, 31], [32, 32], [33, 33], [34, 34], [35, 35], [36, 36], [37, 37], [38, 38], [39, 39], [40, 40], [41, 41]]
851


Fixed submission (verdict: Accepted):
n,l=map(int,input().split())
ans=[]
sum=0
for i in range(n):
    ans.append([abs(l+i),l+i])
    sum+=l+i
ans.sort()
print(sum-ans[0][1])

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N, L = map(int,input().split())
lb = L
rb = L+N-1
if lb <= 0 <= rb: 
    pass
elif lb < rb < 0:
    rb -= 1
elif 0 < lb < rb:
    lb += 1
ans = int((lb + rb) * (N - 1) / 2)
print(ans)


Failing test case input:
10 -5

Expected output:
-5


Actual output:
-4


Fixed submission (verdict: Accepted):

N, L = map(int,input().split())
lb = L
rb = L+N-1
if lb <= 0 <= rb: 
    pass
elif rb < 0:
    rb -= 1
elif 0 < lb:
    lb += 1
ans = sum(range(lb,rb + 1))
print(ans)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import copy

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

apple_taste = [L+i for i in range(N)]

pie_taste = sum(apple_taste)

min_diff = 100000
for i in range(N):
    ap = copy.deepcopy(apple_taste)
    ap[i] = 0

    pie_taste2 = sum(ap)
    diff = abs(pie_taste - pie_taste2)

    min_diff = min(min_diff, diff)

print(pie_taste - min_diff)

Failing test case input:
2 -50

Expected output:
-50


Actual output:
-148


Fixed submission (verdict: Accepted):
import copy

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

apple_taste = [L+i for i in range(N)]

pie_taste = sum(apple_taste)

min_diff = 100000
for i in range(N):
    ap = copy.deepcopy(apple_taste)
    ap[i] = 0

    pie_taste2 = sum(ap)
    diff = abs(pie_taste - pie_taste2)

    if diff < min_diff:
        min_diff = diff
        min_index = i


apple_taste[min_index] = 0

print(sum(apple_taste))
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, l = map(int, input().split())
 
res = n * (l-1) + n * (n+1) / 2
if 1-l >= 1 and 1-l <= n:
  pass
elif 1-l > n:
  res -= (l+n-1)
else:
  res -= l
print(res)

Failing test case input:
18 -124

Expected output:
-1972


Actual output:
-1972.0


Fixed submission (verdict: Accepted):
n, l = map(int, input().split())
 
res = n * (l-1) + n * (n+1) / 2
if (0 >= l) and (1-l <= n):
  pass
elif 1-l > n:
  res -= (l+n-1)
else:
  res -= l
print(int(res))

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
9 -50

Expected output:
-372


Actual output:
-372
[-50, -49, -48, -47, -46, -45, -44, -43, -42]


Fixed submission (verdict: Accepted):
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)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,l = list(map(int,input().split()))
apple = []
for i in range(n):        apple.append(l+i)
print(apple)
if 0 in apple:
        print(sum(apple))
elif n+l < 0:
        print(sum(apple)-apple[len(apple)-1])
else:
        print(sum(apple[1:len(apple)+1]))

Failing test case input:
13 -5

Expected output:
13


Actual output:
[-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7]
13


Fixed submission (verdict: Accepted):
n,l = list(map(int,input().split()))
apple = []
for i in range(n):        apple.append(l+i)
if 0 in apple:
        print(sum(apple))
elif apple[n-1] < 0:
        print(sum(apple)-apple[len(apple)-1])
else:
        print(sum(apple[1:len(apple)+1]))

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,L = input().split()
N = int(N)
L = int(L)
tastes = []
abs_tastes=[]
for i in range(N):
  tastes.append(L + i)
  abs_tastes.append(abs(L+i))
print(sum(tastes)-min(abs_tastes))

Failing test case input:
5 -6

Expected output:
-18


Actual output:
-22


Fixed submission (verdict: Accepted):
N,L = input().split()
N = int(N)
L = int(L)
tastes = []
abs_tastes = []
for i in range(N):
  tastes.append(L + i)
  abs_tastes.append(abs(L+i))
abs_min = min(abs_tastes)
if L>0:
  abs_min = abs_min
else:
  abs_min = - abs_min
print(sum(tastes)-abs_min)
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,L = list(map(int,input().split()))


i = 1
taste = []

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

if L > 0 :
        print(sum(taste[1:N]))
elif L < N and N + L < 0:
        print(sum(taste[0:N-1]))
elif L <= 0 and N - L >= 0:
        print(sum(taste))
   

Failing test case input:
5 -50

Expected output:
-194


Actual output:
[-50, -49, -48, -47, -46]
-194


Fixed submission (verdict: Accepted):
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]))

Problem: p02994
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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)

Failing test case input:
17 7

Expected output:
248


Actual output:
262


Fixed submission (verdict: Accepted):
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)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, l = map(int, input().split())
taste = [l+i-1 for i in range(1, n+1)]

apple1 = float('inf')
apple2 = -float('inf')
flag = 0
for i in taste:
    if i == 0:
        apple = i
        break
    elif (apple2 < i < 0):
        apple2 = i
        flag = 1
    elif (0 < i < apple1):
        apple1 = i
        flag = 2
if flag == 1:        
    pie = abs(sum(taste) - apple2)
elif flag == 2:
    pie = abs(sum(taste) - apple1)
else:
    pie = abs(sum(taste) - apple)
    
print(pie)

Failing test case input:
16 -50

Expected output:
-645


Actual output:
645


Fixed submission (verdict: Accepted):
n, l = map(int, input().split())
taste = [l+i-1 for i in range(1, n+1)]

apple1 = float('inf')
apple2 = -float('inf')
flag = 0
for i in taste:
    if i == 0:
        apple = i
        flag = 0
        break
    elif (apple2 < i < 0):
        apple2 = i
        flag = 1
    elif (0 < i < apple1):
        apple1 = i
        flag = 2
        
if flag == 1:
    pie = (sum(taste) - apple2)
elif flag == 2:
    pie = (sum(taste) - apple1)
else:
    pie = (sum(taste) - apple)
    
print(pie)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, L = map(int, input().split())
A = [] 

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

total = sum(A) 


b = 10000
j = 0 
for i in range(N):
    if abs(A[i]) < b:
        j = i

print(total - A[j])


Failing test case input:
13 -5

Expected output:
13


Actual output:
6


Fixed submission (verdict: Accepted):
N, L = map(int, input().split())
A = [] 

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

total = sum(A) 


b = 1000000
j = 0 
for i in range(N):
    if abs(A[i]) < b:
        j = i
        b = abs(A[i])

print(total - A[j])
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
23 -50

Expected output:
-869


Actual output:
[-50, -49, -48, -47, -46, -45, -44, -43, -42, -41, -40, -39, -38, -37, -36, -35, -34, -33, -32, -31, -30, -29]
-869


Fixed submission (verdict: Accepted):
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)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,l = map(int,input().split())
 
s=0

if l>=0:
    for val in range(n-1):
        s += val+l+1
        


elif l < 0 and l >= -l:
    for val in range(n):
        s += val + l
        
else:
    for val in range(n-1):
        s += val + l



print(s)

Failing test case input:
13 -5

Expected output:
13


Actual output:
6


Fixed submission (verdict: Accepted):
n,l = map(int,input().split())
 
s=0

if l>=0:
    for val in range(n-1):
        s += val+l+1
        


elif l < 0 and n > -l:
    for val in range(n):
        s += val + l
        
else:
    for val in range(n-1):
        s += val + l



print(s)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, L = map(int, input().split())

aji = list(map(lambda x: L + x - 1, range(1, N + 1)))

print(aji)

if (aji[0] <= 0 and aji[N - 1] >= 0) :
    print(sum(aji))
elif (aji[0] < 0 and aji[N - 1] < 0):
    print(sum(aji) - aji[N -1])
else:
    print(sum(aji) - aji[0])

Failing test case input:
5 -16

Expected output:
-58


Actual output:
[-16, -15, -14, -13, -12]
-58


Fixed submission (verdict: Accepted):
N, L = map(int, input().split())

aji = list(map(lambda x: L + x - 1, range(1, N + 1)))

if (aji[0] <= 0 and aji[N - 1] >= 0) :
    print(sum(aji))
elif (aji[0] < 0 and aji[N - 1] < 0):
    print(sum(aji) - aji[N -1])
else:
    print(sum(aji) - aji[0])

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b = map(int,input().split())
c = [i+b for i in range(a)]
d = [abs(j+b) for j in range(a)]
print(sum(c)-min(d))

Failing test case input:
23 -50

Expected output:
-869


Actual output:
-925


Fixed submission (verdict: Accepted):
a,b = map(int,input().split())
c = [i+b for i in range(a)]
d = [abs(j+b) for j in range(a)]
print(sum(c)-c[d.index(min(d))])
Problem: p02994
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,L = map(int,input().split())

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

ans = float("inf")

for apple in apples:
  ans = min(ans,abs(apple))
  
print(sum(apples) - ans)

Failing test case input:
5 -6

Expected output:
-18


Actual output:
-22


Fixed submission (verdict: Accepted):
N,L = map(int,input().split())

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

ans = float("inf")
res = float("inf")

for apple in apples:
  if ans > abs(apple):
    ans = min(ans,abs(apple))
    res = apple
  
print(sum(apples) - res)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, l = map(int, input().split())
taste = [l+i-1 for i in range(1, n+1)]

apple1 = float('inf')
apple2 = -float('inf')
flag = 0
for i in taste:
    if i == 0:
        apple = i
        flag = 0
        break
    elif (apple2 < i < 0):
        apple2 = i
        flag = 1
    elif (0 < i < apple1):
        apple1 = i
        flag = 2
        
if flag == 1:        
    pie = abs(sum(taste) - apple2)
elif flag == 2:
    pie = abs(sum(taste) - apple1)
else:
    pie = abs(sum(taste) - apple)
    
print(pie)

Failing test case input:
23 -50

Expected output:
-869


Actual output:
869


Fixed submission (verdict: Accepted):
n, l = map(int, input().split())
taste = [l+i-1 for i in range(1, n+1)]

apple1 = float('inf')
apple2 = -float('inf')
flag = 0
for i in taste:
    if i == 0:
        apple = i
        flag = 0
        break
    elif (apple2 < i < 0):
        apple2 = i
        flag = 1
    elif (0 < i < apple1):
        apple1 = i
        flag = 2
        
if flag == 1:
    pie = (sum(taste) - apple2)
elif flag == 2:
    pie = (sum(taste) - apple1)
else:
    pie = (sum(taste) - apple)
    
print(pie)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, l = map(int, input().split())
ans = 0
eat = 1+l-1

for i in range(1, n+1):
  apple_taste = i+l-1
  ans += apple_taste
  eat = min(abs(eat),abs(apple_taste))

print(ans-eat)

Failing test case input:
5 -50

Expected output:
-194


Actual output:
-286


Fixed submission (verdict: Accepted):
n, l = map(int, input().split())
ans = 0
eat = 1+l-1

for i in range(1, n+1):
  apple_taste = i+l-1
  ans += apple_taste
  if abs(eat) > abs(apple_taste):
    eat = apple_taste

print(ans-eat)
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,L=map(int,input().split())

R=[0]*N

for kai in range(N):
    R[kai]=L+kai-1
    print(R[kai])


kotoae=0
kotae=0
if(R[kai]>0):
    for kai1 in range(N):
        kotoae=kotoae+R[kai]
    print(kotae-R[0])
else:
    for kai1 in range(N):
        kotae=kotae+R[kai]
    print(kotoae)

Failing test case input:
13 -88

Expected output:
-990


Actual output:
-89
-88
-87
-86
-85
-84
-83
-82
-81
-80
-79
-78
-77
0


Fixed submission (verdict: Accepted):
N,L=map(int,input().split())

R=[0]*N

for kai in range(N):
    R[kai]=L+kai


kotoae=0
kotae=0
if(R[0]>0):
    for kai1 in range(N):
        kotoae=kotoae+R[kai1]
    print(kotoae-R[0])
elif(R[N-1]<0):
    for kai1 in range(N):
        kotae=kotae+R[kai1]
    print(kotae-R[N-1])
else:
    for kai in range(N):
        kotae=kotae+R[kai]
    print(kotae)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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-1]))

Failing test case input:
10 -5

Expected output:
-5


Actual output:
-9


Fixed submission (verdict: Accepted):
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]))

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
15 14

Expected output:
301


Actual output:
287


Fixed submission (verdict: Accepted):
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)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,l = map(int,input().split())

sum = n * (l - 1) + (n * (n + 1)) / 2.0

if n + l - 1 < 0:
    print(int(sum - (n + l - 1)))
elif l - 1 > 0:
    print(int(sum - (l - 1)))
else:
    print(int(sum))


Failing test case input:
15 14

Expected output:
301


Actual output:
302


Fixed submission (verdict: Accepted):
n,l = map(int,input().split())

sum = n * (l - 1) + (n * (n + 1)) / 2.0

if n + l - 1 < 0:
    print(int(sum - (n + l - 1)))
elif l > 0:
    print(int(sum - (l)))
else:
    print(int(sum))
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, L=map(int, input().split())
s=0
S=[L+i-1 for i in range(1, N+1)]
T = [abs(S[i]) for i in range(0, N)]
for i in range(0, N):
    if T[i] < T[i+1]:
        del S[i]
        break
    else:
        del S[N-1]
        break
for i in range(0,N-1):
    s+=S[i]
print(s)


Failing test case input:
13 -5

Expected output:
13


Actual output:
6


Fixed submission (verdict: Accepted):
N, L=map(int, input().split())
s=0
S=[L+i-1 for i in range(1, N+1)]
T = [abs(S[i]) for i in range(N)]

for i in range(N-1):
    if T[i] < T[i+1]:
        del S[i]
        break
    elif i == N-2:
        del S[N-1]

for i in range(0,N-1):
    s+=S[i]
print(s)

Problem: p02994
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N, L = map(int, input().split())

if L >= 1:
    X = L
elif (L + N - 1) < 0:
    X = L+N
else:
    X = 0

print(L*N + int(N*(N-1)/2) - X)



Failing test case input:
2 -50

Expected output:
-50


Actual output:
-51


Fixed submission (verdict: Accepted):
N, L = map(int, input().split())

if L >= 0:
    X = L
elif (L + N) <= 0:
    X = L+N-1
else:
    X = 0

print(L*N + int(N*(N-1)/2) - X)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
l = list(map(int,input().split()))
N = l[0]
L = l[1]

apple =[]

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

pie = 0
min = abs(L)
for i in range(N):
    pie = pie +apple[i]
    if abs(apple[i])< min:
        min = apple[i]

pie = pie - min

print(pie)


Failing test case input:
3 -88

Expected output:
-175


Actual output:
[-88, -87, -86]
-174


Fixed submission (verdict: Accepted):
l = list(map(int,input().split()))
N = l[0]
L = l[1]

apple =[]

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

pie = 0
flag = 1
min = abs(L)
for i in range(N):
    pie = pie + apple[i]
    if abs(apple[i]) < min:
        min = abs(apple[i])
        if apple[i]<0:
            flag = -1
        else:
            flag = 1

pie = pie - flag * min

print(pie)

Problem: p02994
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, l = map(int, input().split())

taste_lists = []
for i in range(1, n+1, 1):
    taste = l + i - 1
    taste_lists.append(taste)

min = abs(taste_lists[0])
index = 0
for i in range(n):
    if abs(taste_lists[i]) < min:
        index = i

taste_lists.pop(index)

ans = 0
for i in taste_lists:
    ans += i

print(ans)


Failing test case input:
13 -8

Expected output:
-26


Actual output:
-30


Fixed submission (verdict: Accepted):
n, l = map(int, input().split())

taste_lists = list()
for i in range(n):
    taste = l+i
    taste_lists.append(taste)

eat = 0
if taste_lists[0] > 0 and taste_lists[-1] > 0:
    eat = taste_lists[0]
elif taste_lists[0] < 0 and taste_lists[-1] < 0:
    eat = taste_lists[-1]
else:
    eat = 0

taste_lists.remove(eat)
ans = 0
for i in taste_lists:
    ans += i

print(ans)
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, l = map(int, input().split())

eat_taste = 99999
sum_taste = 0
for i in range(n):
  taste = l + i
  sum_taste += taste
  if abs(taste) < eat_taste:
    eat_taste = abs(taste)
print(sum_taste - eat_taste)

Failing test case input:
18 -124

Expected output:
-1972


Actual output:
-2186


Fixed submission (verdict: Accepted):
n, l = map(int, input().split())

eat_taste = 99999
sum_taste = 0
for i in range(n):
  taste = l + i
  sum_taste += taste
  if abs(taste) < abs(eat_taste):
    eat_taste = taste
print(sum_taste - eat_taste)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
sum=k
tmp=abs(k)
for i in range(1,n):
  sum+=k+i
  if tmp>abs(k+i):
    tmp=abs(k+i)
print(sum-tmp)

Failing test case input:
13 -88

Expected output:
-990


Actual output:
-1142


Fixed submission (verdict: Accepted):
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)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)))


Failing test case input:
13 -8

Expected output:
-26


Actual output:
-30


Fixed submission (verdict: Accepted):
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)))

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,l=map(int,input().split())
s=n*l+n*(n+1)/2-n
d2=n**2
x=0
for i in range(n):
    s1=s-i-l
    d=abs(s-s1)
    if d<d2:
        d2=d
        x=i
print(int(s-l-x))

Failing test case input:
3 -88

Expected output:
-175


Actual output:
-173


Fixed submission (verdict: Accepted):
n,l=map(int,input().split())
s=n*l+n*(n+1)/2-n
d2=100000000000000000
x=0
for i in range(n):
    s1=s-i-l
    d=abs(s-s1)
    if d<d2:
        d2=d
        x=i
print(int(s-l-x))

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, L = map(int, input().split())
Taste = [0]*N
for i in range(N):
    Taste[i] = L + i 
print(sum(Taste) - min(map(abs, Taste)))

Failing test case input:
9 -50

Expected output:
-372


Actual output:
-456


Fixed submission (verdict: Accepted):
N, L = map(int, input().split())
Taste = [0]*N
for i in range(N):
    Taste[i] = L + i 
Taste.sort(key = lambda x:abs(x))
print(sum(Taste[1:]))

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, L = map(int, input().split())

S = int(N * (L-1) + N * (N+1) / 2)

if L + N -1 < 0:
  print(S- (L + N - 1))
elif L - 1 > 0:
  print(S - (L-1))
else:
  print(S)


Failing test case input:
17 7

Expected output:
248


Actual output:
249


Fixed submission (verdict: Accepted):
N, L = map(int, input().split())

S = int(N * (L-1) + N * (N+1) / 2)

if L + N -1 < 0:
  print(S- (L + N - 1))
elif L > 0:
  print(S - L)
else:
  print(S)
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, L = input().split()
N = int(N)
L = int(L)

Nsum=0
sum=0
for i in range(N):
    Nsum+=L+i

sa=1000000000
for i in range(N):
    a = (L+i)
    if(a<0):
      a=-a
    if(sa > a):
        sa=a

print(Nsum-sa)

Failing test case input:
3 -88

Expected output:
-175


Actual output:
-347


Fixed submission (verdict: Accepted):
N, L = input().split()
N = int(N)
L = int(L)

Nsum=0
sum=0
for i in range(N):
    Nsum+=L+i

sa=1000000000
for i in range(N):
    a = (L+i)
    if(a<0):
      a=-a
    if(sa > a):
        sa=a

if(Nsum<0):
	print(Nsum+sa)
else:  
	print(Nsum-sa)

Problem: p02994
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import copy

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

n_L = list(range(n))
a_L = list(map(lambda x:l+x,n_L))

a_L.append(0)

allsum = sum(a_L)

result_L = []
print(a_L)

diff = abs(allsum-sum(a_L[1:]))

for val in range(n):
    b_L = copy.copy(a_L)
    b_L.pop(val)
    temp_sum = sum(b_L)

    if abs(allsum-temp_sum) <= diff:
        result = temp_sum
    diff = abs(allsum-temp_sum)

print(result)


Failing test case input:
38 4

Expected output:
851


Actual output:
[4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 0]
851


Fixed submission (verdict: Accepted):
import copy

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

n_L = list(range(n))
a_L = list(map(lambda x:l+x,n_L))

a_L.append(0)

allsum = sum(a_L)

result_L = []

diff = abs(allsum-sum(a_L[1:]))

for val in range(n):
    b_L = copy.copy(a_L)
    b_L.pop(val)
    temp_sum = sum(b_L)

    if abs(allsum-temp_sum) <= diff:
        result = temp_sum
    diff = abs(allsum-temp_sum)

print(result)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,L = map(int,input().split())
inf = float('inf')
eat = inf
ans = 0
for i in range(N):
    eat = min(eat, abs(L+i))
if L > 0:
    s = eat - L + 1
else:
    s = abs(eat + L -1)
print(s)
for i in range(1,N+1):
    if s == i:
        continue
    ans += L + i -1
print(ans)


Failing test case input:
18 -50

Expected output:
-714


Actual output:
18
-714


Fixed submission (verdict: Accepted):
N,L = map(int,input().split())
inf = float('inf')
eat = inf
ans = 0
for i in range(N):
    eat = min(eat, abs(L+i))
if L > 0:
    s = eat - L + 1
else:
    s = abs(eat + L -1)

for i in range(1,N+1):
    if s == i:
        continue
    ans += L + i -1
print(ans)