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

for i in range(1,N+1):
    apple_pie = 0
    apple_pie += L + i - 1

for k in range(1,N+1):
    ab = []
    ab += abs(L + k - 1)

if min(ab):
    print(apple_pie - (L + ab.index(min(ab))  - 1))

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

for i in range(1:N+1):
    apple_pie += L + i - 1

for k in range(1:N+1):
    ab = []
    ab += abs(L + k - 1)

if min(ab):
    print(apple_pie - (L + ab.index(min(ab))  - 1))

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

for i in range(1:N+1):
    apple_pie += L + i - 1

for k in range(1:N+1):
    ab = []
    ab += abs(L + k -1)
    if min(ab):
        print(apple_pie - (L + k -1))

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

for i in range(1, N+1):
    apple_pie = 0
    apple_pie += L + i - 1

for k in range(1, N+1):
    ab = []
    ab += abs(L + k - 1)

if min(ab):
    print(apple_pie - (L + ab.index(min(ab))  ))

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

for i in range(1:N+1):
    apple_pie += L + i - 1

for k in range(1:N+1):
    ab = []
    ab += abs(L + k - 1)
    if min(ab):
        print(apple_pie - (L + k - 1))

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

for i in range(1:N+1):
    apple_pie += L + i - 1

for k in range(1:N+1):
    ab = []
    ab += abs(L + k - 1)

if min(ab):
    print(apple_pie - (L + ab.index(min(ab))  - 1))

N = input()
L = input()

taste = L + i -1
for i in range(N):
    apple_pie_o += taste
    
    for k in range(N):
        ab = []
        ab += abs(L + k -1)
        if min(ab):
            apple_pie_a=apple_pie_o - (L + k -1)
            print(apple_pie_a)

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

for i in range(1, N+1):
    apple_pie = 0
    apple_pie += L + i - 1

for k in range(1, N+1):
    ab = []
    ab.append(abs(L + k - 1))
print(apple_pie - (L + ab.index(min(ab))  ))

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

taste = L + i -1
for i in range(N):
    apple_pie_o += taste
    
    for k in range(N):
        ab = []
        ab += abs(L + k -1)
        if min(ab):
            apple_pie_a=apple_pie_o - (L + k -1)
            print(apple_pie_a)

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

for i in range(1,N+1):
    apple_pie += L + i - 1

for k in range(1,N+1):
    ab = []
    ab += abs(L + k - 1)
    if min(ab):
        print(apple_pie - (L + k - 1))

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

for i in range(N):
    apple_pie += L + i - 1

for k in range(N):
    ab = []
    ab += abs(L + k -1)
    if min(ab):
        print(apple_pie - (L + k -1))

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

apple_pie = 0
for i in range(1, N+1):
    apple_pie += L + i - 1

ab = []
for k in range(1, N+1):
    ab.append(abs(L + k - 1))

print(apple_pie - (L + ab.index(min(ab))  ))

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Accepted