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())
aji = [abs(L+i-1) for i in range(1,N+1)]
minaji = max(aji)
no = 0
for i in range(N):
    if aji[i] < minaji:
        no = i + 1
        minaji = aji[i]
print(no)

N,L = map(int,input().split())
aji1 = [L+i-1 for i in range(1,N+1)]
aji = [abs(L+i-1) for i in range(1,N+1)]

minaji = max(aji1)
no = 0
for i in range(N):
    if aji[i] < minaji:
        no = i + 1
        minaji = aji[i]
aji1[no-1] = 0
print(sum(aji1))

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

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

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

print(ans)


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)

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)


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())
data = [l] * n
ans = 0

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

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

print(ans - temp)


n, l = map(int, input().split())
a = [l] * n
ans = 0
for i in range(1, n):
    a[i] += i
    if abs(a[ans]) > abs(a[i]):
        ans = i
print(sum(a) - a[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):
import sys, bisect, math, heapq

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

N, L = read_int()

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

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


import sys, bisect, math, heapq

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

N, L = read_int()

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

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


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_list = []
for i in range(1,n+1):
    #print(i)
    a_list.append(l+i-1)
if int(a_list[0])>0:
    a_list.remove(a_list[0])
if 0 in a_list:
    a_list.remove(0)
if int(a_list[n-1])<0:
    a_list.remove(a_list[n-1])
print(sum(a_list))

n,l = map(int,input().split())
a_list = []
for i in range(1,n+1):
    #print(i)
    a_list.append(l+i-1)

if int(a_list[n-1])<0:
    a_list.remove(a_list[n-1])

if int(a_list[0])>0:
    a_list.remove(a_list[0])

if 0 in a_list:
    a_list.remove(0)

print(sum(a_list))

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())
dic = []
all_sum = sum([j + l -1 for j in range(1, n+1)])
for i in range(1, n+1):
  item = [j + l -1 for j in range(1, n+1) if j != i]
  dic.append(sum(item))
dist = abs(all_sum - dic[0])
for j in dic:
  tmp = abs(all_sum - j)
  if j < dist:
    dist = j
print(dist)

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

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

N, L=map(int, input().split())
if L>0:
    A=(N-1)*L+N*(N-1)/2
elif N+L<=0:
    A=(N-1)*L+(N-1)*(N-2)/2
else:
    A=(L*2+N-1)*N/2
print(int(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().split())
t=[l+i for i in range(n)]
ans=min(t)
print(ans)
for i in t:
    if abs(i)<abs(ans):
        ans=i
t.remove(ans)
print(sum(t))

n,l=list(map(int,input().split()))
t=[l+i-1 for i in range(1,n+1)]
if t[0]>=0:
    print(sum(t[1:]))
elif t[-1]<=0:
    print(sum(t[:-1]))
else:
    print(sum(t))

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


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+=1
print(s+(n-1)*l-num)


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 in range(n):
  s+=1
print(s+(n-1)*l-num)


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)


Verdicts: Wrong Answer

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().split())
if L >=0:
    Aji = list(range(L+1,L+N))
    ans = sum(Aji)
    print(Aji)
    print(ans)
elif L<0 and L+N >= 1:
    Aji = list(range(L,L+N))
    ans = sum(Aji)
    print(Aji)
    print(ans)
else:
    Aji = list(range(L,L+N-1))
    ans = sum(Aji)
    print(Aji)
    print(ans)

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

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())
flavor = []
import numpy as np
for i in range(1, N + 1):
    flavor.append(L + i - 1)
for j in flavor:
    if abs(j) == min(np.abs(flavor)):
        eat = j
print(sum(flavor) - j)



N, L = map(int, input().split())
flavor = []
for i in range(1, N + 1):
    flavor.append(L + i - 1)
print(sum(flavor) - min(abs(flavor)))



N, L = map(int, input().split())
flavor = []
import numpy as np
for i in range(1, N + 1):
    flavor.append(L + i - 1)
eat = min(np.abs(flavor))
print(flavor - eat)



N, L = map(int, input().split())
flavor = []
for i in range(1, N + 1):
    flavor.append(L + i - 1)
import numpy as np
for j in flavor:
    if abs(j) == min(np.abs(flavor)):
        eat = j
print(sum(flavor) - eat)



Verdicts: Wrong Answer

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())
s = N*L+sum(1,N+1)-N
K=[]
for i in range(1,N+1):  
    K.append(L+i-1)
if 0 <= K[0]:
    s -= K[0]
elif K[0]<0 and K[N-1]>0:
    s = s
else:
    s -= K[N-1]
print(s)

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

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

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())
taste=[0] 
sum1=0
for i in range(1,N+1): 
    a=L+i-1
    sum1+=a
    taste.append(a)

#print(sum1)
#print(taste)

ans=0
best=100000
for i in range(1,N+1):
    sum2=sum1-taste[i]
    dif=abs(sum1-sum2)
    if dif<best:
        best=dif
        ans=sum2
print(sum2)

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

#print(sum1)
#print(taste)

ans=0
best=100000
for i in range(1,N+1): 
    sum2=sum1-taste[i]
    dif=abs(sum1-sum2)
    #print(str(i)+" "+str(sum2)+" "+str(dif))
    if dif<best:
        best=dif
        ans=sum2
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())

ans = float("inf")

for i in range(1, N+1):
    before = sum([L+k-1 for k in range(1, N+1)])
    after = sum([L+j-1 for j in range(1, N+1) if j != i])

    ans = min(ans, abs(before-after))
    
print(ans)


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

diff = float("inf")
ans = 0

for i in range(1, N+1):
    before = sum([L+k-1 for k in range(1, N+1)])
    after = sum([L+j-1 for j in range(1, N+1) if j != i])
	
    if abs(before-after) < diff:
    	diff = abs(before-after)
    	ans = after
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())
allsum = N/2*(2*L+(N-1))
eat = 0
if L >= 0:
        eat = L
elif L + N >= 1:
        eat = 0
else:
        eat = L + N - 1
print(allsum - eat)

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

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

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

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=map(int,input().split())
li=[]
for i in range(N):
    li.append(L+i+1-1)

li.sort()
S=sum(li)
for j in range(N-1):
    if abs(li[j])<=abs(li[j+1]):
        S-=li[j]
        print(li[j])
        break

if j==N-2:
    S-=li[N-1]

print(S)


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

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

print(S)


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

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

print(S)


Verdicts: 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):
a,b=map(int,input().split())
ans=0
if b<0:
	ans=(b+a+b-1)*a/2
else:
	ans=(b+1+a+b-1)*(a-1)/2

print(ans)

a,b=map(int,input().split())
ans=0
list=[i+b-1 for i in range(1,a+1)]
list.sort(key=lambda i:abs(i))
ans=sum(list[1:])
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 = [x+L for x in range(N)]
print(sum(a) - min(a, map(abs, a)))


N, L = map(int, input().split())
a = [x+L for x in range(N)]
print(sum(a) - min(a, key=lambda x:abs(x)))


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

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

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)

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())
sumL = 0
mainasu = 0
plus = 0
aji = []
for i in range(N):
  aji.append(L + i)
  sumL += L + i
  if L + i == 0:
    count = 1
  elif L + i  < 0:
    mainasu += 1
  elif L + i > 0:
    plus += 1
if count == 1:
  print(sumL)
elif mainasu > plus :
  print(sumL-max((aji)))
else:
  print(sumL-min((aji)))
  

N,L = map(int,input().split())
sumL = 0
mainasu = 0
plus = 0
aji = []
count = 0
for i in range(N):
  aji.append(L + i)
  sumL += L + i
  if L + i == 0:
    count = 1
  elif L + i  < 0:
    mainasu += 1
  elif L + i > 0:
    plus += 1
if count == 1:
  print(sumL)
elif mainasu > plus :
  print(sumL-max((aji)))
else:
  print(sumL-min((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):
from sys import stdin

# N, L = stdin.readline().rstrip()
N, L = map(int, input().split(' '))
print(N, L)
# N, L = 5, 2
# N, L = 3, -1
# N, L = 30, -50

min_value = L
max_value = L + N - 1

summation = L * N + sum(range(N))

if (min_value < 0) and (0 < max_value):
    pass
elif (min_value > 0):
    summation -= min_value
elif (max_value < 0):
    summation -= max_value
    
print(summation)

from sys import stdin

N, L = stdin.readline().rstrip()

# N, L = 5, 2
# N, L = 3, -1
# N, L = 30, -50

min_value = L
max_value = L + N - 1

summation = L * N + sum(range(N))

if (min_value < 0) and (0 < max_value):
    pass
elif (min_value > 0):
    summation -= min_value
elif (max_value < 0):
    summation -= max_value
    
print(summation)    

from sys import stdin

N, L = stdin.readline().rstrip()

# N, L = 5, 2
# N, L = 3, -1
# N, L = 30, -50

min_value = L
max_value = L + N - 1

summation = L * N + sum(range(N))

if (min_value < 0) and (0 < max_value):
    pass
elif (min_value > 0):
    summation -= min_value
elif (max_value < 0):
    summation -= max_value

from sys import stdin

# N, L = stdin.readline().rstrip()
N, L = map(int, input().split(' '))
# print(N, L)
# N, L = 5, 2
# N, L = 3, -1
# N, L = 30, -50

min_value = L
max_value = L + N - 1

summation = L * N + sum(range(N))

if (min_value < 0) and (0 < max_value):
    pass
elif (min_value > 0):
    summation -= min_value
elif (max_value < 0):
    summation -= max_value
    
print(summation)

Verdicts: Wrong Answer

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

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)

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)

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())
 
total = 0
min_taste = 1000000000
 
for i in range(n):
    taste = l + i
    total += taste
    if abs(taste) < abs(min_taste):
        min_taste = taste
 
print(total - dis_min)

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

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

Nazi=[]

for i in range(N+1):
    azi=L+i-1
    Nazi.append(azi)
del Nazi[0]

sum=0
if L>0:
    del Nazi[0]
    print(sum(Nazi))
else:
    for i in Nazi:
       sum+=i
    sum=(sum-Nazi[-1])
    print(sum)

N,L=input().split()


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


hu=0
zero=0
for i in ApplesTaste:
    
    if i is 0:
        zero+=1
    if i < 0:
        hu+=1


if zero is 1:
    point=ApplesTaste.index(0)
    del ApplesTaste[point]
    print(sum(ApplesTaste))


elif hu > 0 and zero is 0:
    point=len(ApplesTaste)-1
    
    del ApplesTaste[point]
    print (sum(ApplesTaste))

else:
    del ApplesTaste[0]
    print(sum(ApplesTaste))

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())
list1 = []
for i in range(1, n+1):
    list1.append(l + i - 1)
sum(list1) - min(filter(abs, list1))

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, L = lr()
total = sum(range(L, L+N))
sub = min(range(L, L+N), key=abs)
print(total-sub)


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=input().split()
N=int(N)
L=int(L)
A=0
B=[]
C=[]
for j in range(1,N+1):
    A+=L+j-1
for i in range(1,N+1):
    if L+i-1>=0:
        B.append(L+i-1)
    else:
        C.append(L+i-1)
if min(B)<=abs(max(C)):
    print(A-min(B))
else:
    print(A-max(C))

N,L=input().split()
N=int(N)
L=int(L)
A=0
B=[]
for j in range(1,N+1):
    A+=L+j-1
for i in range(1,N+1):
    B.append(abs(A-(L+i-1))
print(max(B))
             

N,L=map(int,input().split())
A=[]
B=[]
for i in range(1,N+1):
    A.append(L+i-1)
for j in range(1,N+1):
    B.append(abs(L+j-1))
idx=B.index(min(B))
print(sum(A)-A[idx])

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())
LL =[]
for i in range(1,N+1):
  LL.append(L+i-1)
LLL=[]
for j in LL:
  LLL.append(abs(sum(LL)-j))
LLLL=sorted(LLL)
print(sum(LL)-LLLL[0])

N,L = map(int,input().split())
l = []
ll = []
for i in range(1,N+1):
  l.append(L+i-1)
  ll.append(abs(L+i-1))
a = l.index(min(ll))
print(sum(l)-a)

n, l = map(int, input().split())
a = []
b = []
for i in range(1,n+1):
    a.append(l+i-1)
    b.append(abs(l+i-1))
x = b.index(min(b))
print(sum(a)-a[x])


Verdicts: 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().split())
a = []
for i in range(1,N+1):
  a.append(L+i-1)
b = []
for i in a:
  b.append(abs(i))
for i in range(1,N+!):
  if abs(L+i-1) == min(b):
    print(sum(a)-L-i+1)

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

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

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

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

Verdicts: Runtime Error

Wrong Answer

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())
pie = 0
comp = 300

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

print(pie - comp)


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

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

print(pie - comp)


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 = []
tmp = []
for i in range(1,N+1):
	tmp.append(abs(L + i -1))
	taste.append((L + i -1))
num = tmp.index(min(tmp)) 
taste[num] = 0
print(taste)
print(sum(taste))

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

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

Verdicts: 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().split())
taste = [l+i for i in range(n)]
print(taste)
tmp = 9999
for t in taste:
  if abs(t) < tmp:
    tmp = t
res = sum(taste) - tmp
print(res)


n, l = map(int, input().split())
taste = [l+i-1 for i in range(n)]
eaten = 9999
for t in taste:
  if abs(t) < eaten:
    eaten = t
res = sum(taste) - eaten
print(res)

N, L = map(int, input().split())
taste_all = 0
for i in range(N):
    taste_all += L + i
if abs(L) < N and L < 0:
    print(taste_all)
elif L = 0:
    print(taste_all)
elif L < 0:
    print(taste_all - (L + N - 1))
elif L > 0:
    print(taste_all - L)



n, l = map(int, input().split())
taste = [l+i for i in range(n)]
tmp = 9999
index = 0
for i in range(n):
  if abs(taste[i]) < tmp:
    tmp = abs(taste[i])
    index = i
res = sum(taste) - taste[index]
print(res)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted