TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
n,l= map(int,input().split())
aj=[l + i  for i in range(n)]
ajs = sum(aj)
resl = []
for i in range(n):
    aj2 = aj
    del aj2[i]
    resl += [sum(aj2)]
resl2 = [abs(ajs-resl[i]) for i in range(n)]
x = resl2.index(min(resl2))
print(aj[x])

n,l = map(int,input().split())
aji = [l+i for i in range(n)]
mn= 100
for i in range(n):
    mn= min(mn,abs(aji[i]))
if mn in aji:del aji[aji.index(mn)]
else:del aji[aji.index(-mn)]
print(sum(aji))

Verdicts: Runtime Error

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
n, l = map(int, input().split())

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

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


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


Verdicts: Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
N, L = map(int, input().split())

apple = []
zerochk = False
tastes = 0
for i in range(N):
    taste = L + i
    apple.append(taste)
    tastes += taste
    if taste == 0: zerochk = True

ans = 0
minval = 100

if zerochk:

    print('{}'.format(tastes))

else if L > 0:

    for i in range(1, len(tastes)):
        ans += tastes(i)
    
    print('{}'.format(ans))

else: # L < 0

    for i in range(1, len(tastes)):
        minval = min(minval, abs(tastes[i]))
        ans += tastes(i)

    print('{}'.format(ans) - minval)






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

apples = []
zerochk = False
taste_sum = 0
for i in range(N):
    taste = L + i
    apples.append(taste)
    taste_sum += taste
    if taste == 0: zerochk = True


minval = 100

if zerochk:

    print('{}'.format(taste_sum))

elif L > 0:

    print('{}'.format(taste_sum - apples[0]))

else: # zerochk == True and L < 0

    for i in range(1, len(apples)):
        minval = min(minval, abs(apples[i]))

    ans = 0
    if taste_sum < 0:
        ans = abs(taste_sum) - abs(minval)
        ans *= -1
    else: 
        ans = taste_sum - abs(minval)
    print('{}'.format(ans))






Verdicts: Runtime Error

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
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 = (L-1)*N+N*((N+1)/2)-(L+i)
    print(c)
    break

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

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
(int,input().split())
if L >= 0:
  print(int((N-1)/2*(L + L + N )))
else:
  if L + N - 1 >= 0: 
    print(int(N / 2 * (L + L + N - 1)))
  else:
    print(int((N - 1)/ 2 * (L + L + N - 2)))


N,L=(int,input().split())
if L >= 0:
  print(int((N-1)/2*(L + L + N - 1)))
else:
  if L + N - 1 >= 0: 
    print(int(N / 2 * (L + L + N - 1)))
  else:
    print(int((N - 1)/ 2 * (L + L + N - 2)))


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

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

if L+1-1 > 0:
    print(L+1-1)
else:
    if L+N-1 >= 0:
        print(s)
    else:
        print(s - (L+N-1))


N,L=map(int,input().split())
if L >= 0:
  print(N/2*(L + 1 + L + N - 1))
else:
  if L + N - 1 >= 0: 
    print(N / 2 * (L + 1 + L + N - 1))
  else:
    print(N / 2 * (L + 1 + L + N - 2))

N,L=map(int,input().split())
if L >= 0:
  print(int((N-1)/2*(L + L + N - 1)))
else:
  if L + N - 1 >= 0: 
    print(int(N / 2 * (L + L + N - 1)))
  else:
    print(int((N - 1)/ 2 * (L + L + N - 2)))


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

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

if L > 0:
    print(L+1-1)
else:
    if L+N-1 >= 0:
        print(s)
    else:
        print(s - (L+N-1))


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

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

if L+1-1 > 0:
    print(s - (L+1-1))
else:
    if L+N-1 >= 0:
        print(s)
    else:
        print(s - (L+N-1))


Verdicts: Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
n,l=map(int,input().split())
 a=n*(2*l+n-1)//2
if 1-n<=l<=0:
  print(a)
elif l<=-n:
  print(a-l-n+1)
else :
  print(a-l)
  

n,l=map(int,input().split())
if 1-n<=l<=0:
  a=n*(2*l+n-1)//2
  print(a)
elif l<=-n:
  print(a-l-n+1)
else :
  print(a-l)
  

n,l=map(int,input().split())
a=n*(2*l+n-1)//2
if 1-n<=l<=0:
  print(a)
elif l<=-n:
  print(a-l-n+1)
else :
  print(a-l)
  


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
N,L=map(int,input().split())

tot=N*L+(N-1)*N/2
ans=[]


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

a=ans.index(min(ans))

print(tot-(a+L))

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

tot=N*L+(N-1)*N/2
ans=[]


for i in range(N):
    ans.append(abs(tot-(L+i)))

print(max(ans))

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

tot=N*L+(N-1)*N/2
ans=[]


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

print(tot-min(ans))

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

tot=N*L+(N-1)*N/2
ans=[]


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

a=ans.index(min(ans))

print(int(tot-(a+L)))


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
N, L = (int(x) for x in input().split())
if L <= 0 <= (L + N - 1):
    print(0)
elif N > L:
    s = 0
    for i in range(0, N-1):
        s += L + i
    print(s)
else:
    s = 0
    for i in range(1, N):
        s += L + i
    print(s)

N, L = (int(x) for x in input().split())
a = [0] * N
for i in range(N):
    a[i] = L + i
a.sort()
if 0 in a:
    print(sum(a))
elif a[0] > 0 and a[-1] > 0:
    print(sum(a[1:N]))
else:
    print(sum(a[0:N-1]))

Verdicts: Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
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)

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)
print(l)
s-=abs(l[0])
print(s)

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)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
N,map(int,input().split())
if L>=0:
  print((N-1)*(L-1)+int(N*(N+1)/2)-1)
else:
  if L+N>=0:
    print(N*(L-1)+int(N*(N+1)/2))
  else:
    print(N*(L-1)+int(N*(N+1)/2)-(L+N-1))

N,L=map(int,input().split())
if L>=0:
  print((N-1)*(L-1)+int(N*(N+1)/2)-1)
else:
  if L+N>0:
    print(N*(L-1)+int(N*(N+1)/2))
  else:
    print(N*(L-1)+int(N*(N+1)/2)-(L+N-1))

Verdicts: Runtime Error

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
import numpy as np
x = 3
y = -1
A = []

for i in range(x):
    A.append(y)
    y += 1

B = np.abs(A)

we = min(B)

A.remove(we)
cnt = 0
for i in A:
    v = int(i)
    cnt += v

print(cnt)

import numpy as np
x, y = map(int, input().split())
A = []

for i in range(x):
    A.append(y)
    y += 1

B = np.abs(A)

we = min(B)
if we not in A:
    we = - + we
    A.remove(we)
else:
    A.remove(we)

cnt = 0
for i in A:
    cnt += i

print(cnt)

Verdicts: Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
N,L = map(int, input() . split())
x=[]
for i in range(0,N):
    N=L+i-1
    if i==0:
        continue
    x.append(N)
if sum(x)<0:
    sum(x)==0

print(sum(x))


N,L=map(int,input().split())
ans=[]
for i in range(1,N+1):
    ans.append(L+i-1)

List=list(map(abs,ans))

ans.pop(List.index(min(List)))

print(sum(ans))
    


Verdicts: Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
n,l = map(int, input().split())
ans = 0
m = float("inf")
for i in range(1,n+1):
    a = l + i -1
    if abs(a)<abs(m):
        m = a
    ans += a
print(ans + (-m if m<0 else m))

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

n,l = map(int, input().split())
s = float("inf")
ans = 0
for i in range(1,n+1):
    a = l+i-1
    ans += a
    if abs(a) < abs(s):
        s = a
print(ans - s)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
N, L= map(int, input().split())
if L<0 and L+N-1>0:
    print((2*L+N-1)*N/2)
elif L>0:
    print((2*L+N)*(N-1)/2)
else:
    print((2*L+N-2)*(N-1)/2)

N, L= map(int, input().split())
if L<0 and L+N-1>0:
    print(int((2*L+N-1)*N/2))
elif L>=0:
    print(int((2*L+N)*(N-1)/2))
else:
    print(int((2*L+N-2)*(N-1)/2))

Verdicts: Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

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

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

Verdicts: Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
N, L = map(int, input().split())
taste = sp.arange(L, L+N)
s = sum(taste)

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

import scipy as sp

N, L = map(int, input().split())
taste = sp.arange(L, L+N)
s = sum(taste)

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

Verdicts: Runtime Error

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
# coding: utf-8
# Your code here!

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

al_te = []
for i in range(N):
    T = L + i -1
    al_te.append(T)
#print(al_te)

ab_te = []
for i in range(N):
    T = L + i -1
    ab_te.append(abs(T))
#print(ab_te)
x = ab_te.index(min(ab_te))
#print(x)

al_te.pop(x)
print(sum(al_te))

# coding: utf-8
# Your code here!

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

al_te = []
for i in range(N):
    T = L + (i+1) -1
    al_te.append(T)
#print(al_te)

ab_te = []
for i in range(N):
    T = L + (i+1) -1
    ab_te.append(abs(T))
#print(ab_te)
x = ab_te.index(min(ab_te))
#print(x)

al_te.pop(x)
print(sum(al_te))

Verdicts: Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
print("食べてしまった分、一緒にりんごを買いに行く")


N, L = map(int, input().split())
lin = []
a = []
for i in range(N):
    lin.append(L)
    L += 1
for i in range(len(lin)):
    b = abs(lin[i])
    a.append(b)
if sum(lin) < 0:
    print(sum(lin) + min(a))
else:
    print(sum(lin) - min(a))


Verdicts: Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
n, l = map(int, input())

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)

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)


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)

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


Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
import math
inp = input().split()

n = int(inp[0])
l = int(inp[1])

min_abs = abs(l)
min_num = 1
for i in range(n):
    if abs(l+i) < min_abs:
        min_abs = abs(l+i)
        min_num = i

print(min_num)
print(math.ceil(0.5*n*n + n*l - 0.5*n - l - min_num ))




import math
inp = input().split()

n = int(inp[0])
l = int(inp[1])

min_abs = abs(l)
min_num = 1
for i in range(n):
    if abs(l+i) < min_abs:
        min_abs = abs(l+i)
        min_num = i

print(math.ceil(0.5*n*n + n*l - 0.5*n - l - min_num ))





import math
inp = input().split()

n = int(inp[0])
l = int(inp[1])

min_abs = abs(l)
min_num = 0
for i in range(n):
    if abs(l+i) < min_abs:
        min_abs = abs(l+i)
        min_num = i


print(math.ceil(0.5*n*n + n*l - 0.5*n - l - min_num ))





Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
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(sumtmp)

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)

n,k=map(int,input().split())
sum=k
tmp=abs(k,0)
for i in range(1,n):
  sum+=k+i
  if tmp>abs(k+i,0):
    tmp=abs(k+i,0)
print(sum-tmp)

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)

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
N,L = map(int,input())
A = list()
for i in range(N):
  A.append(L+i)
A.sort()
S = sum(A)
if min(A)*max(A)<=0:
  print(S)
else:
  if L>=0:
    print(S-min(A))
  else:
    print(S-max(A))

N,L = map(int,input().split())
A = list()
for i in range(N):
  A.append(L+i)
A.sort()
S = sum(A)
if min(A)*max(A)<=0:
  print(S)
else:
  if L>=0:
    print(S-min(A))
  else:
    print(S-max(A))


Verdicts: Runtime Error

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
n,l=[int(x) for x in input().split(' ')]
arr=sorted([x+l-1 for x in range(1,n+1)])
t1=sum(arr)
# arr2=[abs(x) for x in arr]
print(min([t1-x for x in arr]))

n,l=[int(x) for x in input().split(' ')]
arr=sorted([x+l-1 for x in range(1,n+1)])
arr2=[abs(x) for x in arr]
print(sum(arr)-arr[arr2.index(min(arr2))])

Verdicts: Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
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)

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)

Verdicts: Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
N,L=map(int,input().split())
if L*(L+N-1)<=0:
  print((L-1)*N+N*(N+1)/2)
  
elif L<0:
  print((L-1)*N+N*(N+1)/2-(L+N-1))

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

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

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

Verdicts: Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
n,l = map(int,input().split())
ans = 0

for i in range(l,l+n):
	ans += i

if l-n <= 0:
	ans -= l+n-1

print(ans)

n,l = map(int,input().split())
left = l
right = n+l-1
eat = 0
aji = 0

if right <=0:
	eat = right
elif left >=0:
	eat = left
else:
	eat = 0

for i in range(left,right+1):
	aji += i

aji -= eat
print(aji)

Verdicts: Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
n,l=map(int,input().split())
aji=[]
for i in range(n):
    aji+=[l+i]
su=sum(aji)
c=[su]
for i in range(n):
    c=[abs(su-aji[i])]
c.sort()
print(s)

n,l=map(int,input().split())
aji=[]
s=0
c=0
for i in range(n):
    aji+=[l+i]
su=sum(aji)
for i in range(n):
    s=su-aji[i]
    if su-c<su-s<su:
        c=s
print(c)

n,l=map(int,input().split())
aji=[l+i for i in range(n)]
aji.sort(key=abs)
print(sum(aji[1:]))

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
N, L = map(int, input().split())
eatable_taste = L - 1
eatable_index = 0

for i in range(1, N):
    taste = L + i - 1
    if abs(taste) < abs(eatable_taste):
        eatable_index = i
        eatable_taste = taste

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

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

for i in range(2, N+1):
    taste = L + i - 1
    print(taste)
    if abs(taste) < abs(eatable_taste):
        eatable_taste = taste

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

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

for i in range(2, N+1):
    taste = L + i - 1
    if abs(taste) < abs(eatable_taste):
        eatable_taste = taste

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
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)

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)

Verdicts: Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
N, L = map(int, input().split())
A = [0]*N
for i in range(N):
    A[i] = L + i - 1

ans = 0
if 0 in A:
    ans = sum(A)
else:
    ans = sum(A) - A[0]

print(ans)

N, L = map(int, input().split())
A = [0]*N
for i in range(N):
    A[i] = L + (i+1) - 1

ans = 0
if 0 in A:
    ans = sum(A)
else:
    if L < 0:
        ans = sum(A) - A[-1]
    else:
        ans = sum(A) - A[0]

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
string = input()
split = string.split(" ")
N = int(split[0])
L = split[1]

L = int(L)

taste = []

total = 0


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

mini = min(taste, key=lambda x: -x if x < 0 else x)
total = total - mini
print(total)

string = input()
split = string.split(" ")
N = int(split[0])
L = split[1]

L = int(L)

taste = []

total = 0


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

mini = min(taste, key=lambda x: -x if x < 0 else x)
total = total - mini
print(total)

Verdicts: Wrong Answer

Accepted
Problem: You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The _flavor_ of Apple i is L+i-1, which can be negative.  You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.  You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.  You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.  Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.  We can prove that this value is uniquely determined.

Submission attempts (in order):
N,L = map(int,input().split())

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

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

print(taste_sum - eat)

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

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

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

print(taste_sum - eat)

Verdicts: Wrong Answer

Accepted