ZhenlongDai/ACPR huggingface dataset:
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) ]

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]

Failing test case input:
33 -124

Expected output:
-3472


Actual output:
no output


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

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

Failing test case input:
18 -50

Expected output:
-714


Actual output:
-780


Fixed submission (verdict: Accepted):
n,l=map(int,input().split())
a=0
b=1000
for i in range(l,l+n):
  a+=i
  if abs(b)>abs(i):
    b=i
print(a-b)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
import re
import time

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

total=(L-1)*N+((1+N)/2)*N
mn=1e9
ans=1e9
for a in range(N):
    l=L+(a+1)-1
    print(l)
    if abs(l)<mn:
        mn=min([mn,abs(l)])
        ans=l
print(int(total-ans))

Failing test case input:
16 -88

Expected output:
-1215


Actual output:
-88
-87
-86
-85
-84
-83
-82
-81
-80
-79
-78
-77
-76
-75
-74
-73
-1215


Fixed submission (verdict: Accepted):
import math
import re
import time

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

total=(L-1)*N+((1+N)/2)*N
mn=1e9
ans=1e9
for a in range(N):
    l=L+(a+1)-1
    if abs(l)<mn:
        mn=min([mn,abs(l)])
        ans=l
print(int(total-ans))

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

aji = []
for a in L:
    aji.append(sum(L)-a)
aji2 = []
for i in range(len(L)):
    aji2.append(abs(aji[i]-sum(L)))

m = 10*7
ans = 1
for i in range(len(L)):
    if m > abs(aji[i]-sum(L)):
        m = min(abs(aji[i]- sum(L)), m)
        ans = aji[i]

print(ans)

Failing test case input:
18 -93

Expected output:
-1445


Actual output:
1


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

aji = []
for a in L:
    aji.append(sum(L)-a)
aji2 = []
for i in range(len(L)):
    aji2.append(abs(aji[i]-sum(L)))

m = 10**7
ans = 1
for i in range(len(L)):
    if m > abs(aji[i]-sum(L)):
        m = min(abs(aji[i]- sum(L)), m)
        ans = aji[i]

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

if l >= 1:
    fab = math.fabs(sum(t)-t[0])

elif l < 1 and n%2 == 0 and n+l > 0:
    for i in range(1, n):
        fab += t[i]
elif l < 1 and n%2 != 0 and n+l > 0:
    
    fab = 0

elif n+l < 0:
    for i in range(n-1):
        fab += t[i]

print(int(fab))



Failing test case input:
10 -5

Expected output:
-5


Actual output:
0


Fixed submission (verdict: Accepted):
import math
n, l = map(int, input().split())
t = []
for i in range(1, n+1):
    t.append(l+i-1)
fab = []
sum_t = sum(t)
tmp = 0
if n+l > 0:
    for i in range(n):
        fab.append(sum_t-t[i])
    ans = []
    for i in range(n):
        ans.append(math.fabs(sum_t-fab[i]))
    print(int(sum_t-min(ans)))

else:
    for i in range(n-1):
        tmp += t[i]
    print(tmp)

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

apple_azi = [L + (x + 1) - 1 for x in range(N)]

original_pai = sum(apple_azi)



if original_pai > 0:
    tabeta_azi = min(apple_azi)
elif original_pai == 0:
    tabeta_azi = 0
else:
    tabeta_azi = max(apple_azi)

print(sum(apple_azi) - tabeta_azi)


Failing test case input:
13 -5

Expected output:
13


Actual output:
18


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

apple_azi = [L + (x + 1) - 1 for x in range(N)]

original_pai = sum(apple_azi)

test = []
for i in apple_azi:
    
    test.append(abs(original_pai - (original_pai - i)))

tabeta_azi = min(test)

if original_pai >= 0:
    print(original_pai - tabeta_azi)
else:
    print(original_pai + tabeta_azi)

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 = 1000000
j = 0 
for i in range(N):
    if abs(A[i]) < b:
        j = i

print(total - A[j])


Failing test case input:
38 4

Expected output:
851


Actual output:
814


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 = [int(x) for x in input().split()]

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

if L <= 0:
    if N < L:
        print(sum)
    else:
        print(sum - (L + N-1))
else:
    print(sum - L)


Failing test case input:
13 -8

Expected output:
-26


Actual output:
-30


Fixed submission (verdict: Accepted):
N, L = [int(x) for x in input().split()]

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

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

Failing test case input:
13 -5

Expected output:
13


Actual output:
6


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

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

if all(map(lambda x: x < 0, a)):
    ans = sum(a[:-1])
elif all(map(lambda x: x > 0, a)):
    ans = sum(a[1:])
else:
    ans = 0

print(ans)


Failing test case input:
13 -5

Expected output:
13


Actual output:
0


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

if all(map(lambda x: x < 0, a)):
    ans = sum(a[:-1])
elif all(map(lambda x: x > 0, a)):
    ans = sum(a[1:])
else:
    ans = sum(a)

print(ans)

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

all=0
for i in range(N):
    all =all +L+(i+1)-1
 
dif=all
for i in range(N):
    if abs(all-dif) <= abs(all-(L+(i+1)-1)):
        dif =L+(i+1)-1
 
print(all-dif)

Failing test case input:
10 -5

Expected output:
-5


Actual output:
-9


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

all=0
now=0
for i in range(N):
    all =all +L+(i+1)-1
 
dif=all
for i in range(N):
    if abs(dif) >= abs(L+i):
        dif =L+i
 
print(all-dif)

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


Failing test case input:
18 -50

Expected output:
-714


Actual output:
-50
-49
-48
-47
-46
-45
-44
-43
-42
-41
-40
-39
-38
-37
-36
-35
-34
-33
-714


Fixed submission (verdict: Accepted):
N,L=map(int,input().split())
taste_abs=[]
taste=[]
for i in range(N):
    taste_abs.append(abs(L+i))
    taste.append(L+i)
    
a=taste_abs.index(min(taste_abs))
b=sum(taste)-taste[a]
print(b)

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

for i in range(1, N+1):
    apple_pie = 0
    apple_pie += L + i - 1

for k in range(1, N+1):
    ab = []
    ab.append(abs(L + k - 1))
print(apple_pie - (L + ab.index(min(ab))  ))

Failing test case input:
2 -50

Expected output:
-50


Actual output:
1


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

apple_pie = 0
for i in range(1, N+1):
    apple_pie += L + i - 1

ab = []
for k in range(1, N+1):
    ab.append(abs(L + k - 1))

print(apple_pie - (L + ab.index(min(ab))  ))
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,l=map(int,input().split())
d=114514
num=114514
for j in range(n):
  if abs(l+j)<d:
    d=abs(l+j)
    num=j
s=0
for i in range(n-1):
  s+=1
print(s+(n-1)*l-num)


Failing test case input:
33 -124

Expected output:
-3472


Actual output:
-3968


Fixed submission (verdict: Accepted):
n,l=map(int,input().split())
d=114514
num=114514
for j in range(n):
  if abs(l+j)<d:
    d=abs(l+j)
    num=j
s=0
for i in range(n):
  s+=i
print(s+(n-1)*l-num)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,L=map(int,input().split())
X=0
Y=0
if L>=0 :
    for i in range(N-1):
        X=X+L+i+1

elif L+N<=1:
    for i in range(N-1):
        X=X+L+i

else:
    if N%2==0 :
        X=L+L+N-1

    else:
        X=L+L+N-1

print(X)            


Failing test case input:
10 -5

Expected output:
-5


Actual output:
-1


Fixed submission (verdict: Accepted):
N,L=map(int,input().split())
X=0
Y=0
if L>=0 :
    for i in range(N-1):
        X=X+L+i+1

elif L+N<=1:
    for i in range(N-1):
        X=X+L+i

else:
    for i in range(N):
        X=X+L+i
print(X)

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

ringo=[]

for i in range(n):
	ringo.append(l+i)
print(ringo,sum(ringo))
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)





Failing test case input:
5 -29

Expected output:
-110


Actual output:
[-29, -28, -27, -26, -25] -135
-110


Fixed submission (verdict: Accepted):


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)

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

apple = [L+i for i in range(N)]
print(apple)
min = 500
for k in range(len(apple)):
    if abs(apple[k])<abs(min):
        min = apple[k]

apple.remove(min)
print(sum(apple))

Failing test case input:
33 -124

Expected output:
-3472


Actual output:
[-124, -123, -122, -121, -120, -119, -118, -117, -116, -115, -114, -113, -112, -111, -110, -109, -108, -107, -106, -105, -104, -103, -102, -101, -100, -99, -98, -97, -96, -95, -94, -93, -92]
-3472


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

apple = [L+i for i in range(N)]
min = 500
for k in range(len(apple)):
    if abs(apple[k])<abs(min):
        min = apple[k]

apple.remove(min)
print(sum(apple))
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
N, L = map(int,input().split())
A = [0] * N
for i in range(N):
  A[i] = L + i

ans = 0
diff = 10 ** 10
for j in range(N):
  diff = min(diff, sum(A)-A[j])
  if diff != diff:
    ans = A[j]

print(ans)

Failing test case input:
18 -93

Expected output:
-1445


Actual output:
0


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
N, L = map(int,input().split())
A = [0] * N
B = [0] * N
for i in range(N):
  A[i] = L + i

ans = 0
diff = 10 ** 10
for j in range(N):
  B[j] = sum(A) - A[j]
  diff = min(diff, abs(sum(A)-B[j]))

if sum(A) >= 0:
  print(sum(A)-diff)
else:
  print(sum(A)+diff)

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

Failing test case input:
5 -29

Expected output:
-110


Actual output:
-112.5


Fixed submission (verdict: Accepted):
N, L = map(int, input().split())
 
if L > -1:
  N_eat = 1
elif N+L-1 < 1:
  N_eat = N
else:
  N_eat = 1-L
 
pie = N*(N+1)/2 +N*(L-1) - (L + N_eat-1) 
print(int(pie) )

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)))
  if mini in ajis:
    pass
  else:
    mini = mini * -1
  ajis.remove(mini)
  return sum(ajis)

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

Failing test case input:
5 -16

Expected output:
-58


Actual output:
-45


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):
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)

Failing test case input:
2 -50

Expected output:
-50


Actual output:
-50
-49
-50


Fixed submission (verdict: Accepted):
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)
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)
for i in range (1, a+1):
    c=min(c, abs(b+i-1))

print(int(total-c))


Failing test case input:
13 -88

Expected output:
-990


Actual output:
-1142


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())
A = [i for i in range(L,L+N)]
sum_A = sum(A)
B = [sum(A[:i]+A[:i]) for i in range(len(A))]
print(sorted(B, key=lambda x: abs(x-sum_A))[0])


Failing test case input:
15 14

Expected output:
301


Actual output:
324


Fixed submission (verdict: Accepted):
N, L = map(int, input().split())
A = [i for i in range(L,L+N)]
sum_A = sum(A)
B = [sum(A[:i]+A[i+1:]) for i in range(len(A))]
print(sorted(B, key=lambda x: abs(x-sum_A))[0])

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

if l >0:
    print(sum(range(l+1,l+n)))
elif l <=0:
    if l+n>=0:
        print(sum(range(l,l+n)))
    else:
        print(sum(range(l,l+n)))


Failing test case input:
9 -50

Expected output:
-372


Actual output:
-414


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

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

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

Failing test case input:
5 -29

Expected output:
-110


Actual output:
-106


Fixed submission (verdict: Accepted):
a = input().split(" ")
n = int(a[0])
l = int(a[1])
m = 0
if l >= 0:
    for i in range(n - 1):
        m += l + i + 1
    print(m)
elif l + n - 1 >= 0:
    for i in range(n):
        m += l + i
    print(m)
else:
    for i in range(n - 1):
        m += l + i
    print(m)

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)]
s=sum(taste)
for i in range(l+1):
  if i in taste:
    print(s-i)
    exit()
  if -i in taste:
    print(s+i)
    exit()

Failing test case input:
16 -88

Expected output:
-1215


Actual output:
no output


Fixed submission (verdict: Accepted):
n,l=map(int,input().split())
taste = [l+i for i in range(n)]
if 0 in taste:
  print(sum(taste))
elif l<0:
  print(sum(taste[:-1]))
else:
  print(sum(taste[1:]))
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = list(map(int, input().split()))
aji=[]
kari =[]
for i in range(a[0]):
    aji.append(a[1]+i)
    kari.append(abs(a[1]+i))
m = min(kari)
sum1 = sum(aji)
print(sum1-m)

Failing test case input:
18 -93

Expected output:
-1445


Actual output:
-1597


Fixed submission (verdict: Accepted):
a = list(map(int, input().split()))
aji=[]
m = 1000
for i in range(a[0]):
    aji.append(a[1]+i)
    if abs(m)>=abs(aji[i]):
        m=aji[i]
sum1 = sum(aji)
print(sum1-m)

Problem: p02994
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N,L = map(int,input().split())
aji = [L+i for i in range(N)]
ate = 10000
for a in aji:
  if abs(ate) > abs(a):
    ate = a
print(sum(aji)-a)

Failing test case input:
13 -5

Expected output:
13


Actual output:
6


Fixed submission (verdict: Accepted):
N,L = map(int,input().split())
aji = [L+i for i in range(N)]
ate = 10000
for a in aji:
  if abs(ate) > abs(a):
    ate = a
print(sum(aji)-ate)

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

Failing test case input:
38 4

Expected output:
851


Actual output:
851.0


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

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

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

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


Failing test case input:
16 -88

Expected output:
-1215


Actual output:
-1215.0


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

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

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

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, L = map(int,input().split())
azi = [L+i-1 for i in range(1,N+1)]
mini = abs(azi[0])

for i in azi:
    if abs(i) < mini:
        mini = i
azi.remove(mini)
print(sum(azi))

Failing test case input:
13 -5

Expected output:
13


Actual output:
17


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

for i in azi:
    if abs(i) < abs(mini):
        mini = i
azi.remove(mini)
print(sum(azi))

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:
15 14

Expected output:
301


Actual output:
329


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 (PyPy3 (2.4.0), verdict: Wrong Answer):
n,l=map(int,input().split())
apple=[]
for i in range(n):
    apple.append(l+i)
print(sum(apple)-min([abs(x) for x in apple]))

Failing test case input:
5 -29

Expected output:
-110


Actual output:
-160


Fixed submission (verdict: Accepted):
n,l=map(int,input().split())
apple=[]
for i in range(n):
    apple.append(l+i)
tabeta=1e9
for i in apple:
    if abs(tabeta)>=abs(i):
        tabeta=i
print(sum(apple) - tabeta)

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

s=b-1
m=0

r=0

if b < 1:
    if a + b > 0:
        m = 0
    else:
        m = b + a -1
else:
    m = b

print(s,m)

for i in range(a):
    s += 1
    r = r + s
    

print(r-m)

Failing test case input:
18 -50

Expected output:
-714


Actual output:
-51 -33
-714


Fixed submission (verdict: Accepted):
a,b=map(int, input().split())

s=b-1
m=0

r=0

if b < 1:
    if a + b > 0:
        m = 0
    else:
        m = b + a -1
else:
    m = b

for i in range(a):
    s += 1
    r = r + s
    

print(r-m)

Problem: p02994
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N,L = map(int,input().split())
aji = [L+i for i in range(N)]
ate = 10000
for a in aji:
  if abs(ate) > a:
    ate = a
print(sum(aji)-a)

Failing test case input:
13 -5

Expected output:
13


Actual output:
6


Fixed submission (verdict: Accepted):
N,L = map(int,input().split())
aji = [L+i for i in range(N)]
ate = 10000
for a in aji:
  if abs(ate) > abs(a):
    ate = a
print(sum(aji)-ate)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
inp = input().split(" ")
n = int(inp[0])
l = int(inp[1])

taste_list = [l+i-1 for i in range(1,n+1)]
abs_taste_list = [abs(i) for i in taste_list]
min = min(abs_taste_list)
print(sum(taste_list)-min)


Failing test case input:
5 -43

Expected output:
-166


Actual output:
-244


Fixed submission (verdict: Accepted):
inp = input().split(" ")
n = int(inp[0])
l = int(inp[1])

taste_list = [l+i-1 for i in range(1,n+1)]
abs_taste_list = [abs(i) for i in taste_list]
min_index = abs_taste_list.index(min(abs_taste_list))
min = taste_list[min_index]
print(sum(taste_list)-min)

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 (0 >= l) 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())
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)

Failing test case input:
30 -50

Expected output:
-1044

Actual output:
-1045


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

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

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

if L > 0:
  print(sum(taste)-taste[0])
else:
  print(sum(taste))

Failing test case input:
15 14

Expected output:
301


Actual output:
273


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

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

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

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,L=map(int,input().split())
X=0
Y=0
if L>=0 :
    for i in range(N-1):
        X=X+L+i+1

elif L+N<=1:
    for i in range(N-1):
        X=X+L+i

else:
    if (N-1)%4==0:
        X=(L+L+N-1)*(N-1)/4+(L+L+N-1)/2
    else:
        for i in range(N):
            X=X+L+i
        X=X/2

print(X)   

Failing test case input:
13 -5

Expected output:
13


Actual output:
7.0


Fixed submission (verdict: Accepted):
N,L=map(int,input().split())
X=0
Y=0
if L>=0 :
    for i in range(N-1):
        X=X+L+i+1

elif L+N<=1:
    for i in range(N-1):
        X=X+L+i

else:
    for i in range(N):
        X=X+L+i
print(X)

Problem: p02994
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

n, l = getList()

if l >= 0:
    ans = sum([l + i for i in range(1,n)])

elif l >= -(n+1):
    ans = sum([l+i for i in range(n)])

else:
    ans = sum([l+i for i in range(n-1)])

print(ans)

Failing test case input:
5 -6

Expected output:
-18


Actual output:
-20


Fixed submission (verdict: Accepted):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

n, l = getList()












aji = [l + i for i in range(n)]
if 0 in aji:
    print(sum(aji))

elif min(aji) > 0:
    print(sum(aji[1:]))

else:
    print(sum(aji[:-1]))
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N,L = map(int,input().split())
r = []
total=0
ap=0
max = -100100100100
for i in range(1,N+1):
  r.append(L+i-1)
for i in range(N):
  for j in range(N):
    if j != i:
      total+=r[j]
  if max < total:
    ap = total
  total=0
print(ap)

Failing test case input:
17 7

Expected output:
248


Actual output:
232


Fixed submission (verdict: Accepted):
import math
N,L = map(int,input().split())
r = []
total=0
abs_min = 100100100100
max_applepay=0
for i in range(1,N+1):
  r.append(L+i-1)
all_applepay=sum(r)
for i in range(N):
  for j in range(N):
    if j != i:
      total+=r[j]
  if abs(all_applepay-(total)) < abs_min:
    abs_min = abs(all_applepay-(total))
    max_applepay = total
  total=0
print(max_applepay)

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

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

else:
  print((2*L+N-1)*(N-1)/2)
  

Failing test case input:
5 -29

Expected output:
-110


Actual output:
-110.0


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

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

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

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))

if mn not in ap:
	mn=-mn

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

Failing test case input:
18 -93

Expected output:
-1445


Actual output:
-1445.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):
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()


Failing test case input:
18 -93

Expected output:
-1445


Actual output:
[-93, -92, -91, -90, -89, -88, -87, -86, -85, -84, -83, -82, -81, -80, -79, -78, -77, -76]
-1445


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

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


Failing test case input:
5 -43

Expected output:
-166


Actual output:
-244


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

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

ans = 10 ** 9
for i in range(N):
  num = L + i
  ans = min(ans, abs(num))

print(ans)

Failing test case input:
16 -50

Expected output:
-645


Actual output:
35


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

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

ans = 10 ** 9
cnt = 10 ** 9
for i in range(N):
  num = L + i
  if cnt >= abs(num):
    cnt = abs(num)
    ans = sums - num

print(ans)

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b =map(int, input().split())
apple=[i for i in range(b,a+b)]

if b<0:
  print(sum(apple))
else:
  print(sum(apple)-b)

Failing test case input:
23 -50

Expected output:
-869


Actual output:
-897


Fixed submission (verdict: Accepted):
a,b =map(int, input().split())
apple=[i for i in range(b,a+b)]

if a+b-1<0:
  print(sum(apple)-a-b+1)
  
elif b>0:
  print(sum(apple)-b)
else:
  print(sum(apple))

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

Failing test case input:
13 -8

Expected output:
-26


Actual output:
-30


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

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

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

ans = 0    
for i in range(N):
    if L + i == 0:
        ans = 0
        break
    if abs(ans) - abs(sum_all - (L + i)) < 0:
        ans = sum_all - (L + i)

print(ans)

Failing test case input:
13 -8

Expected output:
-26


Actual output:
0


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

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

if L >= 0:
    ans = sum_all - L
elif N <= abs(L):
    ans = sum_all - (L + N - 1)
else:
    ans = sum_all

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)]
print(apple_taste)

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:
10 -5

Expected output:
-5


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


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())
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 )

Failing test case input:
5 -29

Expected output:
-110


Actual output:
<generator object <genexpr> at 0x7fbc7bbacf20>


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

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


s = 0
for n in range(1, N+1):
    s += L + n - 1

ans = 0
for n in range(1, N+1):
    if n == 1:
        m = abs(s - (s - (L + n - 1)))
        ans = s - (L+n-1)
    else:
        if m > abs(s - (s - (L+n-1))):
            ans = s - (L+n-1)

print(ans)


Failing test case input:
13 -8

Expected output:
-26


Actual output:
-30


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

s = 0
for n in range(1, N+1):
    s += L + n - 1

for n in range(1, N+1):
    if n == 1:
        m = abs(s - (s - (L + n - 1)))
        ans = s - (L+n-1)
    if m > abs(s - (s - (L+n-1))):
        m = abs(s - (s - (L + n - 1)))
        ans = s - (L+n-1)

print(ans)

Problem: p02994
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, l = map(int, input().split())
l_ = [l+i for i in range(n)]
i_=0
for i in range(n):
	if abs(l_[i])<abs(l_[i_]):
		i_=i
print(sum(l_)-l_[i])

Failing test case input:
10 -5

Expected output:
-5


Actual output:
-9


Fixed submission (verdict: Accepted):
n, l = map(int, input().split())
l_ = [l+i for i in range(n)]
i_=0
for i in range(n):
	if abs(l_[i])<abs(l_[i_]):
		i_=i
print(sum(l_)-l_[i_])
Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
23 -50

Expected output:
-869


Actual output:
-869.0


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

Problem: p02994
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,L=list(map(int,input().split()))
taste=[]
taste1=[]
sum=0
for i in range(N):
    tasty=abs(L+i)
    taste.append(tasty)
    taste1.append(L+i)
    sum+=taste1[i]
tasteab=sorted(taste)
pie=(sum-tasteab[0])
print(pie)

Failing test case input:
18 -124

Expected output:
-1972


Actual output:
-2186


Fixed submission (verdict: Accepted):
N,L=list(map(int,input().split()))
taste=[]
taste1=[]
memo=[]
sum=0
for i in range(N):
    tasty=abs(L+i)
    if L+i<=0:
        memo.append(L+i)
    taste.append(tasty)
    taste1.append(L+i)
    sum+=taste1[i]
tasteab=sorted(taste)
memo=sorted(memo)
if memo!=[]:
    pie=(sum-memo[-1])
else:
    pie=(sum-tasteab[0])
print(pie)

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

taste = [l + i - 1 for i in range(1, n + 1)]
taste_all = sum(taste)
taste_min = min([abs(t) for t in taste])
print(taste_all - taste_min)


Failing test case input:
5 -6

Expected output:
-18


Actual output:
-22


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

taste = [l + i - 1 for i in range(1, n + 1)]
taste_all = sum(taste)
if taste[n - 1] < 0:
    taste_min = taste[n - 1]
elif taste[0] > 0:
    taste_min = taste[0]
else:
    taste_min = 0
print(taste_all - taste_min)

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

if 0 in list_taste:
  ans = sum(list_taste)
else:
  ans = sum(list_taste) - min(list_taste)

print(ans)


Failing test case input:
2 -50

Expected output:
-50


Actual output:
-49


Fixed submission (verdict: Accepted):
n, l = map(int, input().split())
list_taste = [l+i for i in range(n)]
 
if 0 in list_taste:
  ans = sum(list_taste)
else:
  if list_taste[0] > 0:
  	ans = sum(list_taste) - min(list_taste)
  else:
    ans = sum(list_taste) - max(list_taste)

print(ans)

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

aji=0
eat=99999

for i in range(1,N+1):
    aji=aji+i+L-1
    if abs(aji) < abs(eat):
        eat = aji
        

print(aji-eat)

Failing test case input:
5 -16

Expected output:
-58


Actual output:
-54


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

aji_sum=0
eat=99999

for i in range(1,N+1):
    
    aji_sum=aji_sum+i+L-1
    if abs(i+L-1) < abs(eat):
        eat = i+L-1

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

taste = [i for i in range(N)]

for i in range(N):
  taste[i] = taste[i] + L
  
  
sum_taste = sum(taste)

result = 10 ** 10
for i in range(N):
  if abs(sum_taste - taste[i]) < abs(result):
    result = sum_taste - taste[i]
    
print(result)

Failing test case input:
5 -29

Expected output:
-110


Actual output:
-106


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

state = [0 for _ in range(N)]

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

tmp = 10 ** 9

for i in range(N):
    if tmp > abs(sum(state) - sum(state)-state[i]):
        tmp = abs(sum(state) - sum(state)-state[i])
        res = sum(state) - state[i]

print(res)

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

Failing test case input:
33 -124

Expected output:
-3472


Actual output:
-3440


Fixed submission (verdict: Accepted):
N,L = map(int,input().split())
A = [0]*N
for i in range(N):
  A[i]=L+i
  
if 0 in A:
  print(sum(A))
elif A[N-1] > 0:
  print(sum(A)-min(A))
else:
  print(sum(A)-max(A))

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

for n in range(N):
    taste = L + (n+1) -1
    sum_t += taste
    T.append(abs(taste))

x = min(T)
number = abs(min(T) - L)

ans = sum_t - L + (number + 1) -1
print(ans)




Failing test case input:
13 -5

Expected output:
13


Actual output:
23


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

T=[]
sum_t = 0

for n in range(N):
    taste = L + (n+1) -1
    sum_t += taste
    T.append(abs(taste))

m = T.index(min(T))

sum_t -= L + (m+1) -1
print(sum_t)

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')
M = 0
for i in range(N):
  A[i] = L + i
  if m > abs(A[i]):
    M = A[i]

print(sum(A) - M)

Failing test case input:
38 4

Expected output:
851


Actual output:
814


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.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):


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()


Failing test case input:
23 -50

Expected output:
-869


Actual output:
28
-869


Fixed submission (verdict: Accepted):


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

count = 0
top = 0
end = 0

while True:
    if S[count] == 'A':
        top = count
        break
    count += 1

count = -1
while True:
    if S[count] == 'Z':
        end = count
        break
    count -= 1

print(len(S[top:end + 1]))

Failing test case input:
BZACZ

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
S = input()

count = 0
top = 0
end = 0

while True:
    if S[count] == 'A':
        top = count
        break
    count += 1

count = -1
while True:
    if S[count] == 'Z':
        end = count + 1
        break
    count -= 1

if end == 0:
    print(len(S[top:]))
else:
    print(len(S[top:end]))

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())
r = list(reversed(s))

for i in range(len(s)):
    if s[i] == "A":
        a = i +1
        break
for j in range(len(r)):
    if r[j] == "Z":
        z = len(r) - j
        break
print(z-a+1)
print(a,z)
print(s,r)
    

Failing test case input:
TCAG[IHNGFGKZIFKB

Expected output:
11


Actual output:
11
3 13
['T', 'C', 'A', 'G', '[', 'I', 'H', 'N', 'G', 'F', 'G', 'K', 'Z', 'I', 'F', 'K', 'B'] ['B', 'K', 'F', 'I', 'Z', 'K', 'G', 'F', 'G', 'N', 'H', 'I', '[', 'G', 'A', 'C', 'T']


Fixed submission (verdict: Accepted):
s = list(input())
r = list(reversed(s))

for i in range(len(s)):
    if s[i] == "A":
        a = i +1
        break
for j in range(len(r)):
    if r[j] == "Z":
        z = len(r) - j
        break
print(z-a+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
ans = 0
flg = 0
for i in range(len(s)):
  if s[i] == 'A' and flg == 0:
    ans += 1
    flg = 1
  elif flg == 1 and s[i] == 'Z':
    flg = 2
    ans += 1
  elif flg == 1:
    ans += 1
print(ans)

Failing test case input:
HASGZIIZGAKKOFEGA

Expected output:
7


Actual output:
4


Fixed submission (verdict: Accepted):
s = input()
ans = 0
tmp = 0
flg = 0
for i in range(len(s)):
  if s[i] == 'A' and flg == 0:
    ans += 1
    flg = 1
  elif flg == 1 and s[i] == 'Z':
    flg = 2
    ans += 1
  elif flg == 1:
    ans += 1
  elif flg == 2 and s[i] == 'Z':
    ans += tmp+1
    tmp = 0
  elif flg == 2:
    tmp += 1
print(ans)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
print(s.find("A")-s.rfind("Z")+1)

Failing test case input:
SCAG[IHNGGKJZJEGB

Expected output:
11


Actual output:
-9


Fixed submission (verdict: Accepted):
s=input();print(s.rfind("Z")-s.find("A")+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = (input())
sa = s.find("a")
sz = int(s.rfind("z"))
print(sz-sa+1)


Failing test case input:
HARF[IHPGAKKZFEGA

Expected output:
12


Actual output:
1


Fixed submission (verdict: Accepted):
s = (input())
sa = s.find("A")
sz = int(s.rfind("Z"))
print(sz-sa+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
print(s.rfind("Z")-s.find("A"))

Failing test case input:
SEAG[IHNGFKJZHCGB

Expected output:
11


Actual output:
10


Fixed submission (verdict: Accepted):
s=input()
print(s.rfind("Z")-s.find("A")+1)
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
x=s.find('A')
y=s.find('Z')
print(y-x+1)

Failing test case input:
ZCAAZ

Expected output:
3


Actual output:
-1


Fixed submission (verdict: Accepted):
s=input()
x=s.find('A')
y=s.rfind('Z')
print(y-x+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

start = 0
end = 0
for i in range(len(s)):
    if start == 0 and s[i] == 'A':
        start = i
    if s[i] == 'Z':
        end = i
print(end - start + 1)

Failing test case input:
AGDFZKK@GOHH[FSAH

Expected output:
5


Actual output:
-10


Fixed submission (verdict: Accepted):
s = input()

flag = False
start = 0
end = 0
for i in range(len(s)):
    if not flag and s[i] == 'A':
        start = i
        flag = True
    if s[i] == 'Z':
        end = i
print(end - start + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
rev=s[::-1]
n=len(s)
print((n-rev.find('Z')) - (s.find('A') + 1))

Failing test case input:
TCAG[IHNGFHKZIFKB

Expected output:
11


Actual output:
10


Fixed submission (verdict: Accepted):
s=input().strip()
rev=s[::-1]
n=len(s)

print((n-rev.find('Z')) - (s.find('A')))

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = str(input())
a = s.find("A")
z = s.find("Z")
print(len(s[a:z + 1]))


Failing test case input:
ZAACZ

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):
s = str(input())
a = s.find("A")
z = s.rfind("Z")
print(len(s[a:z + 1]))

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
for i in range(len(s)):
    if s[i]=='A':
        start=i
        break
for j in range(len(s)):
    if s[-j]=='Z':
        end=len(s)-j
        break
print(end-start+1)

Failing test case input:
ZCAZB

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
s=input()
for i in range(len(s)):
    if s[i]=='A':
        start=i
        break
for j in range(1,len(s)):
    if s[-j]=='Z':
        end=len(s)-j
        break
print(end-start+1)

Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()

a = s.find("A")
z = s.find("Z")
print(z-a+1)

Failing test case input:
HASGJGFOGAKZZFEIA

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
s = input()

a = s.find("A")
z = s.rfind("Z")
print(z-a+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
aidx = -1
zidx = -1
for i in range(len(s)):
  if aidx == -1 and s[i] == 'A':
    aidx = i
  if zidx == -1 and s[len(s)-1-i] == 'Z':
    zidx = len(s)-1-i
  if aidx != -1 and zidx != -1:
    break
print(zidx-aidx)

Failing test case input:
HASFJGHOGAKZZFEGA

Expected output:
12

Actual output:
11


Fixed submission (verdict: Accepted):
s = input()
aidx = -1
zidx = -1
for i in range(len(s)):
  if aidx == -1 and s[i] == 'A':
    aidx = i
  if zidx == -1 and s[len(s)-1-i] == 'Z':
    zidx = len(s)-1-i
  if aidx != -1 and zidx != -1:
    break
print(zidx-aidx+1)