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())
list = []
sum = 0
min = 10000
sign = 1
for i in range(1,N+1):
    sum += L+i-1
    list.append(L+i-1)
print(sum)
for num in list:
    if min > abs(num):
        min = abs(num)
        if num > 0:
            sign = 1
        else:
            sign = -1
print(min)
print(sign)
print(sum-min*sign)


N,L = map(int, input().split())
list = []
sum = 0
min = 10000
sign = 1
for i in range(1,N+1):
    sum += L+i-1
    list.append(L+i-1)
for num in list:
    if min > abs(num):
        min = abs(num)
        if num > 0:
            sign = 1
        else:
            sign = -1
print(sum-min*sign)


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

al = []
for i in range(n):
    aji = l + i
    aji_ = abs(aji)
    al += [aji_]

x = abs(l)
an = 0
for i in range(n):
    if al[i] < x:
        x = al[i]
        an = i

ans = (l + l+n-1)*n/2 - (l+an)
print(ans)


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

al = []
for i in range(n):
    aji = l + i
    aji_ = abs(aji)
    al += [aji_]

x = abs(l)
an = 0
for i in range(n):
    if al[i] < x:
        x = al[i]
        an = i

ans = (l + l+n-1)*n/2 - (l+an)
print(int(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())
 
s = (N-1)*(2*L+N-1)/2
if L >=0 : m = L
else: m = L + N - 1

print(s-m)

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

s = (N-1)*(2*L+N-1) // 2
l = [abs(L+i) for i in range(N)]

print(s - (L+l.index(min(l))))

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


s = (N-1)*(2*L+N-1) // 2
l = [abs(s - (L+i)) for i in range(N)]
m = min(l)
print(s - (L + [l.index(m)]))

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

s = (N-1)*(2*L+N-1)/2
m = s
for i in range(N):
  m = min(m, abs(s-(L+i)))
  
print(m)

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

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

if L+N-1 < 0: eat = L+N-1
elif L > 0: eat = L
else: eat = 0


print(s - eat)

Verdicts: Wrong Answer

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=list(map(int,input().split()))
taste=[]
taste1=[]
memo=[]
sum=0
for i in range(N):
    tasty=abs(L+i)
    if L+i<0:
        memo.append(L+i)
    taste.append(tasty)
    taste1.append(L+i)
    sum+=taste1[i]
tasteab=sorted(taste)
memo=sorted(memo)
pie=(sum-memo[-1])
print(pie)

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

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(input()), int(input())

flavors = [x + L - 1 for x in range(1, N + 1)]
planned_pie = sum(flavors)
eat = min(flavors)
eat_abs = -min([abs(x) for x in flavors])
print([planned_pie - max(eat, eat_abs) if planned_pie <
       0 else planned_pie - max(eat, eat_abs)][0])

N, L = map(int, input().split())
flavors = [x + L - 1 for x in range(1, N + 1)]
flavors.remove(min(flavors, key=abs))
# flavors.pop(flavors.index(min(flavors, key=abs)))
print(sum(flavors))

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):
r=input().split()
N=int(r[0])
L=int(r[1])
ans=0
ans_li=[]
for i in range(N):
    ans+=L-(i+1)-1
    ans_li.append(L-(i+1)-1)
if 0 in ans_li:
    print(ans)
elif max(ans_li)>0:
    print(ans-min(ans_li))
else:
    print(ans-max(ans_li))

r=input().split()
N=int(r[0])
L=int(r[1])
ans=0
ans_li=[]
for i in range(N):
    ans+=L+(i+1)-1
    ans_li.append(L+(i+1)-1)
if 0 in ans_li:
    print(ans)
elif max(ans_li)>0:
    print(ans-min(ans_li))
else:
    print(ans-max(ans_li))

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 = (int(i) for i in input().split())
onon = 10000
for i in range(L,L+N):
    if i <= onon:
        onon = i
print(N*(L*2+N-1)-onon)

N,L = (int(i) for i in input().split())
onon = 10000
for i in range(L,L+N):
    if abs(i) <= abs(onon):
        onon = i
print(N*(L*2+N-1)//2-onon)

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())
LL=[L+i for i in range(N)]
LLL=[abs(L+i) for i in range(N)]

if N+L<0:
  print(sum(LL)+min(LLL))
elif N+L=0:
  print(sum(LL))
else:
  print(sum(LL)-min(LLL))

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


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

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

idx=ap.index(min(map(abs,ap)))

res=(l-1)*n+(1+n)*n/2-ap[idx]
print(res)

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

ap=[]

for i in range(n):
	ap[i]=l+i

idx=ap.index(min(abs(ap))

res=(l-1)*n+(1+n)*n/2-ap[idx]

print(res)

n, l = (int(i) for i in input().split())
ap=[]

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

mn=min(map(abs,ap))

if mn not in ap:
	mn=-mn

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

n, l = (int(i) for i in input().split())
ap=[]

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

mn=min(map(abs,ap))

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

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

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

Verdicts: Runtime Error

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):
line = input().strip()
N,K = line.split(" ")
N = int(N)
K = int(K)
result = 0

flavors = [K + i - 1 for i in range(N)]
if 0 in flavors: result = sum(flavors)
else:
    min_data = min(flavors)
    result = sum(flavors) - min_data

print(result)

line = input().strip()
N,K = line.split(" ")
N = int(N)
K = int(K)

flavors = 0
min_data = 10000000000000000
flag = False

for i in range(N):
    flavor = K  + i
    flavors += flavor
    if abs(min_data) > abs(flavor): min_data = flavor
    if flavor == 0: flag = True

if flag: print(flavors)
else: print(flavors - min_data)

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

def acinput():
    return list(map(int,input().split(" ")))


N,L=acinput()


aji=L+np.arange(1,N+1)-1
sm=np.sum(aji)

arg=np.argmin(np.abs(aji))
if aji[arg]>=0:
        print(sm-aji[arg])
else:
        print(sm-aji[arg])


print(aji)


import numpy as np

def acinput():
    return list(map(int,input().split(" ")))


N,L=acinput()


aji=L+np.arange(1,N+1)-1
sm=np.sum(aji)

arg=np.argmin(np.abs(aji))
if aji[arg]>=0:
        print(sm-aji[arg])
else:
        print(sm-aji[arg])


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_abs = [abs(l + i) for i in range(n)]
index = taste_abs.index(min(taste_abs))
taste.pop(index)
print(sum(taste))

n, l = map(int, input().split())
a = [l + i for i in range(n)]
s = 1 if sum(a) >= 0 else -1 
print(sum(a) - s * min(abs(a[i]) for i in range(n)))

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 = list(map(int, input().split()))


apple_taste = []
taste_total = 0
for i in range(1, n + 1):
    apple_taste.append(L + i - 1)
    taste_total += L + i - 1




abs_taste_total = abs(sum(apple_taste))
ans = 10 ** 9 

for i in apple_taste:
    current_total = taste_total - i 
    abs_current_total = abs(abs(taste_total) - abs(i)) 

    current_abs = abs(abs(abs_taste_total) - abs(current_total))
    if current_abs < diff:
        diff = current_abs
        ans = current_total

print(ans)


# B - Bite Eating



n, L = list(map(int, input().split()))


apple_taste = []
taste_total = 0
for i in range(1, n + 1):
    apple_taste.append(L + i - 1)
    taste_total += L + i - 1




abs_taste_total = abs(sum(apple_taste))
ans = 10 ** 9 

for i in apple_taste:
    current_total = taste_total - i 
    abs_current_total = abs(abs(taste_total) - abs(i)) 

    current_abs = abs(abs(abs_taste_total) - abs(current_total))
    if current_abs < diff:
        diff = current_abs
        ans = current_total

print(ans)


# B - Bite Eating



n, L = list(map(int, input().split()))


apple_taste = []
taste_total = 0
for i in range(1, n + 1):
    apple_taste.append(L + i - 1)
    taste_total += L + i - 1




abs_taste_total = abs(sum(apple_taste))
ans = 10 ** 9 
diff = 10 ** 9 

for i in apple_taste:
    current_total = taste_total - i 
    abs_current_total = abs(abs(taste_total) - abs(i)) 

    current_abs = abs(abs(abs_taste_total) - abs(current_total))
    if current_abs < diff:
        diff = current_abs
        ans = current_total

print(ans)


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

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

print(aji)

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

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

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

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

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<0:
  print(((n+2*l-1)*n)//2)
else:
  print((((n+2*l-1)*n)//2)-l)

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


a,b=map(int,input().split())
total=a*(a+2*b-1)//2
x=b
y=a+b-1
if (abs(x)<abs(y):
  z=x
else:
  z=y
if x<=0 and y>=0:
  print(total)
else:
  print(total-z)


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


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


a,b=map(int,input().split())
total=a*(a+2*b-1)//2
x=b
y=a+b-1
if abs(x)<abs(y):
  z=x
else:
  z=y
if x<=0 and y>=0:
  print(total)
else:
  print(total-z)


Verdicts: Runtime Error

Runtime Error

Runtime Error

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=[]
all_taste = 0
for i in range(n):
    taste.append(l+i)
    all_taste += taste[i]
if taste[0] > 0 and taste[n-1] > 0:
    print(all_taste - tasete[0])
    exit()
elif taste[0] < 0 and taste[n-1] < 0:
    print(all_taste - taste[n-1])
    exit()
else:
    print(all_taste)


n,l=map(int,input().split())
taste=[]
all_taste = 0
for i in range(n):
    taste.append(l+i)
    all_taste += taste[i]
if taste[0] > 0:
    print(all_taste - taste[0])
    exit()
elif taste[n-1] < 0:
    print(all_taste - taste[n-1])
    exit()
else:
    print(all_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())
if l<0 and l+n-1<0:
    print((2*l+n-2)*(n-1)/2)
elif l>0 and l+n-1>0:
    print((2*l+n)*(n-1)/2)
else:
    print((2*l+n-1)*n/2)

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

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):
def main():
    N, L = map(int, input().split())
    a = [L + n for n in range(N)]
    print(a)
    if L > 0:
        print(sum(a) - a[0])
    elif abs(L) >= N:
        print(sum(a) - a[-1])
    else:
        print(sum(a))


main()


def main():
    N, L = map(int, input().split())
    a = sum([L + n for n in range(N)])
    if L > 0:
        print(a - a[0])
    elif abs(L) >= N:
        print(a - a[-1])
    else:
        print(a)


main()


def main():
    N, L = map(int, input().split())
    a = [L + n for n in range(N)]
    if L > 0:
        print(sum(a) - a[0])
    elif abs(L) >= N:
        print(sum(a) - a[-1])
    else:
        print(sum(a))


main()


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 = [L+i for i in range(N)]

B = list(map(lambda x: abs(x), A))
print (A)
print (B)
print (sum(A) - A[B.index(min(B))])

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

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

B = list(map(lambda x: abs(x), A))
print (sum(A) - A[B.index(min(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):


import sys

# import numpy as np
import itertools

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

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

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




import sys

# import numpy as np
import itertools

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

N, L = map(int, readline().split())
F = [L + i for i in range(N)]
F.sort(key=lambda x: abs(x))

print(sum(F[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):
(L + N - 1)

# -*- coding: utf-8 -*-

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

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

if L > 0:
    ans = ans - L
if (L + N - 1) < 0:
    ans = ans - (L + N - 1)

print(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):
n,l=map(int, input().split())
t=0
c=0
for i in range(n):
  if i==0:
    t=abs(l+(i+1)-1)
    c=0
  else:
    t=min(t, abs(l+(i+1)-1))
    if t=abs(l+(i+1)-1):
      c=i+1
g=0
for i in range(n):
  g+=(l+(i+1)-1)
print(g-l-c)

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

n,l=map(int, input().split())
t=0
c=0
for i in range(n):
  if i==0:
    t=abs(l+(i+1)-1)
    c=i+1
  else:
    t=min(t, abs(l+(i+1)-1))
    if t==abs(l+(i+1)-1):
      c=i+1
#print(c)
g=0
for i in range(n):
  g+=(l+(i+1)-1)
#print(g)
print(g-l-c+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):
l,m = map(int,input().split())
lis =[]
lis2=[]
for i in range(l):
  lis.append(m+i)
  lis2.append(abs(m+i))

lis.pop(lis2.index(min(lis2)))
print(sum(lis)
  

l,m = map(int,input().split())
lis =[]
lis2=[]
for i in range(l):
  lis.append(m+i-1)
  lis2.append(abs(m+i-1))

lis.pop(list_name.index(min(lis2)))
print(sum(lis)
  

l,m = map(int,input().split())
lis =[]
lis2=[]
for i in range(l):
  lis.append(m+i)
  lis2.append(abs(m+i))

lis.pop(lis2.index(min(lis2)))
print(sum(lis))
  

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

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

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

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

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 = N(L+((N+1)/2)-1)

if L*(L+N-1) <= 0:
  print(sum_all)
elif L < 0:
  print(sum_all - L - N + 1)
else:
  print(sum_all - L)


N, L = map(int, input().split())
sum_all = N*(L+((N+1)/2)-1)

if L*(L+N-1) <= 0:
  print(sum_all)
elif L < 0:
  print(sum_all - L - N + 1)
else:
  print(sum_all - L)



N, L = map(int, input().split())
sum_all = N*(L+((N+1)/2)-1)

if L*(L+N-1) <= 0:
  print(int(sum_all))
elif L < 0:
  print(int(sum_all - L - N + 1))
else:
  print(int(sum_all - L))

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):
def main(str):
    input = str.split()
    n = int(input[0])
    l = int(input[1])
    apples = [l + i for i in range(n)]
    abs_apples = list(map(lambda x: abs(x), apples))
    return sum(apples) - apples[abs_apples.index(min(abs_apples))]


if __name__ == "__main__":
    str = input()
    main(str)

def main(str):
    input = str.split()
    n = int(input[0])
    l = int(input[1])
    apples = [l + i for i in range(n)]
    abs_apples = list(map(lambda x: abs(x), apples))
    return sum(apples) - apples[abs_apples.index(min(abs_apples))]


if __name__ == "__main__":
    str = input()
    print(main(str))

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

count = 0
min = None
sum = 0
for i in range(N):
  i += 1
  num = abs(L + i - 1)
  if min == None:
    min = num
    continue
  if min > num:
    min = num
    count = i

for i in range(N):
  i += 1
  if i == count:
    continue
  num = L + i - 1
  sum += num
print(sum)

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

count = 0
min = None
sum = 0
for i in range(N):
  i += 1
  num = abs(L + i - 1)
  if min == None:
    min = num
    count = i
    continue
  if min > num:
    min = num
    count = i
for i in range(N):
  i += 1
  if i != count:
    num = L + i - 1
    sum += num
print(sum)

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().rstrip().split(' '))
apple_pie = 0
ex = abs(L * N)
apple = []
for i in range(N):
    a = L + i 
    apple.append(a)
    apple_pie += a
print(apple)
for i in range(len(apple)):
    if abs(ex) > abs(apple[i]):
        ex = apple[i]
print(ex)
apple_pie-= ex
print(apple_pie)

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

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())
N=0
G=0
for i in range(1,n):
    N +=(i+L-1)
NN = N
for i in range(1,n):
        DD = NN - (L+i-1)
        if DD>G :
            G = DD
print(G)
    

n, L = map(int, input().split())
N = 0
G = 999
for i in range(1, n+1):
    N += (i + L - 1)
NN = N
for i in range(1, n+1):
    DD = NN - (L + i - 1)
    if abs(NN-DD)< G :
        G = abs(NN-DD)
        ZZ = DD
print(ZZ)

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())
deri = [L]
for num in range(0,N):
    deri.append(num)

deri.sort()
aut = sum(deri,1)
print(aut)

N,L = map(int,input().split())
deri = [L]
for num in range(1,N):
    num2 = L + num
    deri.append(num2)

deri.sort() 
if (0 in deri) == True:
    deri.remove(0) 
elif sum(deri) < 0:
    del deri[-1]
else:
    del deri[0]

deru = sum(deri)
print(deru)

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())
L_list=np.array(range(1,N+1))+L-1
print(sum(L_list))
if (0 in L_list):
    print(sum(L_list))
    exit()
if(N<=abs(L) and L<0):
    print(sum(L_list)-L_list[N-1])
    
    exit()
else:
    print(sum(L_list)-L_list[0])
    exit()

import numpy as np
N,L  = map(int,input().split())
L_list=np.array(range(1,N+1))+L-1
if (0 in L_list):
    print(sum(L_list))
    exit()
if(N<=abs(L) and L<0):
    print(sum(L_list)-L_list[N-1])
    
    exit()
else:
    print(sum(L_list)-L_list[0])
    exit()

Verdicts: Wrong Answer

Accepted