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())
tast = list(range(1,n+1))
tast = list(map(lambda x: l+x-1,tast))
s = sum(tast)
ans = 10**12

for i in range(n):
    tmp = sum([y if tast[i]!=y else 0 for y in tast])
    if ans >= abs(s -tmp):
        ans = abs(s -tmp)

print(ans)


n,l = map(int,input().split())
tastes = [0]*n
ans = 0

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

tmp = 10**12
for taste in tastes:
    s = sum([x for x in tastes if x != taste])
    if abs(sum(tastes)-s) <= tmp:
        tmp = abs(sum(tastes)-s)
        ans = s

print(ans)

Verdicts: Wrong Answer

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

Submission attempts (in order):
n,a = map(int,input().split())
print(int(a*(n-1)+n/2*(n-1)-1-n))

n,a = map(int,input().split())
print(a*(n-1)+n/2*(n-1)-1-n)

n,a = map(int,input().split())
x = [a+i-1+1 for i in range(n)]
y = sorted(x, key=lambda i: abs(i))
del y[0]
print(sum(y))

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
import math
n, l = map(int, input().split())
a_l = [l + i for i in range(n)]

min1 = 100
min2 = 10000

for j in a_l:
    if j ** 2 <= min2:
        min2 = j **2
        min1 = j
print(sum(a_l) - j)
    

import math
n, l = map(int, input().split())
a_l = [l + i for i in range(n)]

min1 = 100
min2 = 10000

for j in a_l:
    if j ** 2 <= min2:
        min2 = j **2
        min1 = j
print(sum(a_l) - min1)

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()
apples = [x + int(L) for x in list(range(int(N)))]
abs_min_index = [abs(x) for x in apples].index(min(abs_apples))
print(sum(apples) - apples[abs_min_index])

N, L = input().split()
apples = [x + int(L) for x in list(range(int(N))
abs_apples = [abs(x) for x in apples]
abs_min_index = abs_apples.index(min(abs_apples))
print(sum(apples) - apples[abs_min_index])

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

apples = list(range(N)) + L
abs_min = min([abs(x) for x in apples])
print(sum[apples] - abs_min*2)

N, L = input().split()
apples = [x + int(L) for x in list(range(int(N))]
abs_apples = [abs(x) for x in apples]
abs_min_index = abs_apples.index(min(abs_apples))
print(sum(apples) - apples[abs_min_index])

N, L = input().split()
apples = [x + int(L) for x in list(range(int(N)))]
abs_apples = [abs(x) for x in apples]
abs_min_index = abs_apples.index(min(abs_apples))
print(sum(apples) - apples[abs_min_index])

Verdicts: 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):
# 190622_sat_B

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

# print("a: ", a)


print("answer:", sum(a) - a[b.index(min(b))])

# 190622_sat_B

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

# print("a: ", a)


# print("answer:", sum(a) - a[b.index(min(b))])
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):
n,l = map(int,input().split())
if l >= 0:
  print((n-1)*(2*l+n)/2)
elif n > abs(l):
  print(n*(2*l+n-1)/2)
else:
  print((n-1)*(2*l+n-2)/2)

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

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=[int(i) for i in input().split()]
array=[]
abs_array=[]
for i in range(n[0]):
  array.append(n[1]+i-1)
  abs_array.append(abs(n[1]+i-1))
abs_array=abs_array.sort()
if(abs_array[0] in array == True):
  print(sum(array)-abs_array[0])
else:
  print(sum(array)+abs_array[0])

n=[int(i) for i in input().split()]
array=[]
abs_array=[]
for i in range(1,n[0]+1):
  array.append(n[1]+i-1)
  abs_array.append(abs(n[1]+i-1))
abs_array.sort()
if abs_array[0] in array :
  print(sum(array)-abs_array[0])
else:
  print(sum(array)+abs_array[0])

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())
min_abs = 10**9
tmp = 10**9
for i in range(n):
    if abs(l + i) < min_abs:
        min_abs = abs(l+i)
        tmp = i
print(min_abs)
ans = 0
for i in range(n):
    if i == tmp:
        continue
    else:
        ans += l + i

print(ans)

n,l = map(int,input().split())
min_abs = 10**9
tmp = 10**9
for i in range(n):
    if abs(l + i) < min_abs:
        min_abs = abs(l+i)
        tmp = i
ans = 0
for i in range(n):
    if i == tmp:
        continue
    else:
        ans += l + i

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

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

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

pie_taste = sum(apple_taste)

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

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

    min_diff = min(min_diff, diff)

print(pie_taste - min_diff)

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

pie = 0
min_abs = 10000
min_abs_apple = None
for i in range(N):
    if min_abs > abs(i + L):
        min_abs = abs(i + L)
        min_abs_apple = i + L
    pie += i + L

print(pie - min_abs_apple)

Verdicts: Wrong Answer

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

Submission attempts (in order):
N,L = map(int,input().split())
A = [L+i for i in range(N)]
A.sort(a: abs(a))

print(sum(A)-A[0])


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

A = [L + i for i in range(N)]
A.sort(key=lambda a: abs(a))

print(sum(A) - A[0])


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()))
ts = [l + i - 1 for i in range(1, n + 1)]
print(sum(ts) + min([abs(x) for x in ts]))

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

tastes = [l + i - 1 for i in range(1, n + 1)]
sum_tastes = sum(tastes)
sum_tastes_eat = [sum_tastes - tastes[i] for i in range(n)]
dif_tastes = [abs(sum_tastes - x) for x in sum_tastes_eat]

idx = dif_tastes.index(min(dif_tastes))
print(sum_tastes_eat[idx])

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)

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

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

print(Nsum-sa)

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

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

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

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

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):
a = input().split()
N, L = [int(i) for i in a]
for i in range(N):
  dif = abs(L+i-1)
  m = 0
  if dif < abs(L+m):
    m = i
  else:
    continue
sol = (N-1)*L + (N-1)*N/2 - (L+m-1)
print(int(sol))

a = input().split()
N, L = [int(i) for i in a]
l = []
for i in range(1,N+1):
  dif = abs(L+i-1)
  l.append(dif)
m = l.index(min(l)) + 1
sol = N*L + (N-1)*N/2 - (L+m-1)
print(int(sol))

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())
sum = 0
for i in range(N+1):
  sum += L
  L += 1
print(sum)

N, L = map(int,input().split())
sum = 0
for i in range(N):
  sum += L
  L += 1
print(sum - L)

N, L = map(int,input().split())
sum = 0
for i in range(N + 1):
  sum += L
  L += 1
print(sum)

N, L = map(int,input().split())
sum = 0
for i in range(N):
  sum += L
  L += 1
print(sum)

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

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

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

eat = apple[0]
for j in apple:
  if j < 0:
    if j > eat:
      eat = j
  elif j == 0:
  	eat = 0
  else:
    if j < eat:
      eat = j
print(sum(apple) - eat)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

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

Submission attempts (in order):
def main():
  n,l = list(map(int,input().split()))
  ans=0
  if l>0:
    for i in range(2,n+1):
      print(l+i-1)
      ans+= l+i-1
  else:
    for i in range(1,n+1):
      ans+=l+i-1
  print(ans)  
main()

def main():
  n,l = list(map(int,input().split()))
  ans=0
  if l>0:
    for i in range(2,n+1):
      print(l+i-1)
      ans+= l+i-1
  elif n+l<0:
    for i in range(1,n):
      ans+=l+i-1
  else:
    for i in range(1,n+1):
      ans+=l+i-1
  print(ans)  
main()

def main():
  n,l = list(map(int,input().split()))
  ans=0
  if l>=0:
    for i in range(2,n+1):
      ans+= l+i-1
  elif n+l-1<0:
    for i in range(1,n):
      ans+=l+i-1
  else:
    for i in range(1,n+1):
      ans+=l+i-1
  print(ans)  
main()

Verdicts: Wrong Answer

Wrong Answer

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

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

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

aji_list = sorted(aji_list)
aji_list = set(aji_list)

aji_list.remove(min(aji_list))

print(sum(aji_list))

N,L = map(int, input().split())
aji_list = []

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

aji_list = sorted(aji_list)
aji_list = set(aji_list)
print(aji_list)

aji_list.remove(min(aji_list))
print(aji_list)

print(sum(aji_list))

N,L = map(int, input().split())
aji_list = []
aji_list_abs = []

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

aji_list = sorted(aji_list)
min_abs_aji = min(aji_list_abs)


if not min_abs_aji in aji_list:
    min_abs_aji = min_abs_aji * -1

aji_list.remove(min_abs_aji)

print(sum(aji_list))

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
N, L = map(int, input().split())
eat = L + N - 1
if eat > 0:
  eat = L
  if not eat > 0:
    eat = 0

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

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

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

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):
a,b = map(int,input().split())
mx = 100000000
sum = 0
for i in range(n):
  mx = min(mx,abs(b+i-1))
  sum+=b+i-1
print(sum-mx)
  

a,b = map(int,input().split())
mx = 100000000
sum = 0
flag = False
for i in range(1,a+1):
    if mx > abs(b+i-1):
        mx = abs(b+i-1)
    if b+i-1 < 0 :
        flag = True
    sum+=b+i-1
if flag:
    print(sum+mx)
else:
    print(sum-mx)
  


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:
  print((2*L+N)*(N-1)/2)
  
elif L+N-1 < 0:
  print((2*L+N-2)*(N-1)/2)

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

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

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

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

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())
summation = (n - 2) * l + n * (n - 1) // 2
minimum = abs(summation)
applepie = summation + l
for i in range(1, n):
  diff = abs(summation - 2 * i)
  if diff < minimum:
    minimum = diff
    applepie = summation + l + i
print(applepie)

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

total = (l - 1) * n + n * (n + 1) // 2
min_diff = 1e20
for i in range(n):
  apple = l + i
  apple_pie = total - apple
  diff = abs(apple)
  if diff < min_diff:
    min_diff = diff
    min_apple_pie = apple_pie
print(min_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):
# -*- coding:utf-8 -*-

def solve():
    N, L = list(map(int, input().split()))
    all_taste = 0
    eat_taste = float("inf")
    for i in range(1, N+1):
        all_taste += L+i-1
        eat_taste = min(eat_taste, abs(L+i-1))
    print(eat_taste)
    
    if all_taste > 0:
        ans = all_taste - eat_taste
    else:
        ans = all_taste + eat_taste
    print(ans)



if __name__ == "__main__":
    solve()


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

def solve():
    N, L = list(map(int, input().split()))
    all_taste = 0
    eat_taste = float("inf")
    for i in range(1, N+1):
        all_taste += L+i-1
        eat_taste = min(eat_taste, abs(L+i-1))
    
    if all_taste > 0:
        ans = all_taste - eat_taste
    else:
        ans = all_taste + eat_taste
    print(ans)



if __name__ == "__main__":
    solve()


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 = N*L + N*(N+1)/2 - N
if L <= 0:
  print(taste)
else:
  print(taste-L)


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


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


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

N, L = map(int,input().split())
lisu = [L+i-1 for i in range(1,N+1)]
abs_l = [abs(i) for i in lisu]
mii = min(abs_l)
auu = sum(lisu)
ans = auu - lisu[abs_l.index(mii)]
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

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

Submission attempts (in order):
import numpy as np

def LI():
  return [int(s) for s in input().split()]

N,L = LI()
ringo = np.array(list(range(1,N+1))) + L - 1

taste_all = sum(ringo)

min_index = 0
min_abs = abs(ringo[0])

for i in range(1,N):
  if min_abs < abs(ringo[i]):
    min_index = i
    min_abs = abs(ringo[i])

print(taste_all - ringo[min_index])

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

N, L = [int(s) for s in input().split()]
tastes = [L + i - 1 for i in range(1, N + 1)]
print(sum(tastes) - min(tastes, key = abs))


Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
N, L = map(int,input().split())
i = 0
apple_taste = []
pi_taste = 0
while N > i:
    apple_taste.append(L + i)
    if(L>0):
        if i>0:
            pi_taste += apple_taste[i]
    elif(L+(N-1)>=0):
            pi_taste += apple_taste[i]
    elif(L<0):
        if i>0:
            pi_taste += apple_taste[i-1]
    i += 1 
print(pi_taste)
print(apple_taste)

N, L = map(int,input().split())
i = 0
apple_taste = []
pi_taste = 0
while N > i:
    apple_taste.append(L + i)
    if(L>0):
        if i>0:
            pi_taste += apple_taste[i]
    elif(L+(N-1)>=0):
            pi_taste += apple_taste[i]
    elif(L<0):
        if i>0:
            pi_taste += apple_taste[i-1]
    i += 1 
print(pi_taste)

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 =list(map(int, input().split()))
arr = []
for k in range(1, n+1):
  arr.append(l + k - 1)
print(arr)
arr.remove(min(arr))
print(arr)
print(sum(arr))

n, l =list(map(int, input().split()))
arr = []
arr2 = []
for k in range(1, n+1):
  arr.append(abs(l + k - 1))
for k in range(1, n+1):
  arr2.append(l + k - 1)
arr2.pop(arr.index(min(arr)))
print(sum(arr2))

Verdicts: Wrong Answer

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

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

# l ~ l+n-1

min_abs=99999999999
min_abs_i=-1
n_aji=0
for i in range(1,n+1):
  aji=l+i-1
  aji_abs=abs(aji)
  if aji_abs < min_abs:
    min_abs = aji_abs
    aji_abs_i = i
  n_aji+=aji

print(n_aji-(l+aji_abs_i-1))

n,l=map(int,input().split())
 
min_abs=99999999999
min_abs_i=-1
n_aji=0
for i in range(1,n+1):
  aji=l+i-1
  aji_abs=abs(aji)
  if aji_abs < min_abs:
    min_abs = aji_abs
    aji_abs_i = i
  n_aji+=aji
 
print(n_aji-(l+aji_abs_i-1))

Verdicts: Runtime Error

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

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

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

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

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

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

ans = float("inf")

for j in range(N):
  ans = min(ans,abs(apples))
  
print(ans)

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

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

ans = float("inf")

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

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

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

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

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

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):
from heapq import heappush, heappop, heapify, heapreplace
from collections import defaultdict
from bisect import bisect_left

class Solution:
    def main(self):
        N, L = map(int, input().split())
        print(list(range(L, L+N)))
        if L <= 0 < L+N:
            print(sum(list(range(L, L+N))))
        elif L + N <= 0:
            print(sum(list(range(L, L+N-1))))
        else:
            print(sum(list(range(L+1, L + N))))


if __name__ == '__main__':
    Solution().main()

from heapq import heappush, heappop, heapify, heapreplace
from collections import defaultdict
from bisect import bisect_left

class Solution:
    def main(self):
        N, L = map(int, input().split())
        # print(list(range(L, L+N)))
        if L <= 0 < L+N:
            print(sum(list(range(L, L+N))))
        elif L + N <= 0:
            print(sum(list(range(L, L+N-1))))
        else:
            print(sum(list(range(L+1, L + N))))


if __name__ == '__main__':
    Solution().main()

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 = list(map(int,input().split()))
A = [None for _ in range(N)]

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

print(sum(A) - M)


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

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

print(sum(A) - M)


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

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

print(sum(A) - M)

Verdicts: Wrong Answer

Wrong Answer

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

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

if l+n-1 <=0:
    minL = l+n-1
elif l<=0 and l+n-1 >=0:
    minL = 0
elif l>=0:
    minL  = 0

taste = n*(2*l+n-1)/2-minL

print(int(taste))

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

if l+n-1 <=0:
    minL = l+n-1
elif l<=0 and l+n-1 >=0:
    minL = 0
elif l>=0:
    minL  = l

taste = n*(2*l+n-1)/2-minL

print(int(taste))

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())
c=0
m=100000
for i in range(1,n+1):
  c+=l+i-1
  m=min(m,abs(l+i-1))
if l<0 and a-n<=0:
  print(c+d)
else:
  print(c-d)

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

Verdicts: Runtime Error

Accepted