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

def apple_aji(i):
  return int(l) + int(i) - 1

def apple_pie(n):
  ajis = [apple_aji(x) for x in n]
  ajis.sort()
  mini = min([abs(x) for x in ajis])
  ajis.remove(mini)
  return sum(ajis)

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


n, l = input().split()

def apple_aji(i):
  return int(l) + int(i) - 1

def apple_pie(n):
  ajis = [abs(apple_aji(x)) for x in n]
  ajis.sort()
  return sum(ajis[1:])

print(apple_pie(range(int(n))))


n, l = input().split()

def apple_aji(i):
  return int(l) + int(i) - 1

def apple_pie(n):
  ajis = [apple_aji(x) for x in n]
  mini = min(list(map(abs, ajis)))
  ajis.remove(mini)
  return sum(ajis)

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

n, l = input().split()

def apple_aji(i):
  return int(l) + int(i) - 1

def apple_pie(n):
  ajis = [apple_aji(x) for x in n]
  ajis.sort()
  return sum(ajis[1:])

print(apple_pie(n))


n, l = input().split()

def apple_aji(i):
  return int(l) + int(i) - 1

def apple_pie(n):
  ajis = [abs(apple_aji(x)) for x in n]
  ajis.sort()
  return sum(ajis[1:])

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


n, l = input().split()

def apple_aji(i):
  return int(l) + int(i) - 1

def apple_pie(n):
  ajis = [apple_aji(x) for x in n]
  return sum(ajis)

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


n, l = input().split()

def apple_aji(i):
  return int(l) + int(i) - 1

def apple_pie(n):
  ajis = [apple_aji(x) for x in n]
  mini = min(list(map(abs, ajis)))
  if mini in ajis:
    pass
  else:
    mini = mini * -1
  ajis.remove(mini)
  return sum(ajis)

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

n, l = input().split()

def apple_aji(i):
  return int(l) + int(i) - 1

def apple_pie(n):
  ajis = [apple_aji(x) for x in n]
  mini = min(list(map(abs, ajis)))
  mini = mini * -1
  if mini in ajis:
    pass
  else:
    mini = mini * -1
  print(ajis)
  ajis.remove(mini)
  print(ajis)
  return sum(ajis)

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

n, l = input().split()

def apple_aji(i):
  return int(l) + int(i) - 1

def remove_min(p):
  minimun = min(list(map(abs, p)))
  if minimun not in p:
    minimun = minimun * -1
  p.remove(minimun)
  return p

def apple_pie(n):
  ajis = [apple_aji(x) for x in n]
  return sum(remove_min(ajis))

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

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted