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())
l = [i for i in range(l,l+n)]
minus = min(list(map(abs,l)))
minus = minus if minus<0 else -1*minus
print(sum(l)-minus)

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

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())
pi = [L+i-1 for i in range(1, N+1)]
minval = 100 + 200 -1
minindex = 0
for o in range(N):
  if minval>abs(pi[o]):
    minval = abs(pi[o])
    minindex = o
print(sum(pi) - pi[o])
    
  
  


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

N, L = map(int, input().split())
pi = [(L-1+i) for i in range(1, N+1)]
pi_sum = sum(pi)
for i in range(N):  
  diff = abs(pi_sum - pi[i])
  
  if i == 0:
    diff_min = diff
    diff_index = i
  elif diff_min > diff:
    diff_min = diff
    diff_index = i
print(pi_sum - pi[diff_index])

N, L = map(int, input().split())
pi = [(L-1+i) for i in range(1, N+1)]
pi_sum = sum(pi)
for i in range(N):  
  diff = abs(pi_sum - pi[i])
  if 0 == 0:
    dif_minn = diff
    diff_index = i
  elif diff_min > diff:
    diff_min = diff
    difff_index = i

print(pi_sum - pi[diff_index])


N, L = map(int, input().split())
pi = [L+i-1 for i in range(1, N+1)]
minval = 100 + 200 -1
minindex = 0
for o in range(N):

  if minval>abs(pi[o]):
    minval = abs(pi[o])
    minindex = o

print(sum(pi) - pi[minindex])

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):
# -*- coding: utf-8 -*-

import numpy as np
n,l  = map(int, input().split())
a = np.arange(l,l + n, 1)
amax = l + n -1
amin = l
if amax * amin >0:
    if abs(amax) - abs(amin):
        print(sum(a) - (amax))
    else:
        print(sum(a) - (amim))
elif amax * amin <= 0:
    print(sum(a))
else:
    pass
    

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

import numpy as np
n,l  = map(int, input().split())
a = np.arange(l,l + n, 1)
amax = l + n -1
amin = l
if amax * amin >0:
    if abs(amax) - abs(amin)>0:
        print(sum(a) - (amin))
    else:
        print(sum(a) - (amax))
elif amax * amin <= 0:
    print(sum(a))
else:
    pass

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())
tmp = 0
for _ in range(N):
    tmp += L
    L += 1
if tmp == 0:
    print(0)
elif tmp > 0:
    if L=< 0:
        print(tmp)
    else:
        print(tmp-L)
else:
    if N > L:
        print(tmp)
    else:
        print(tmp-(N+L-1))
        

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

N, L = map(int, input().split())
for _ in range(N):
    tmp += L
    L += 1
if tmp == 0:
    print(0)
elif tmp > 0:
    if L=< 0:
        print(tmp)
    else:
        print(tmp-L)
else:
    if N > L:
        print(tmp)
    else:
        print(tmp-(N+L-1))
        

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

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


Verdicts: Runtime Error

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):
import io
import math
# libraries

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

if m<=0<=m+n-1:
  print(sum(range(m,m+n)))

  elif m<0:
  print(sum(range(m,m+n-1)))

  else:
  print(sum(range(m+1,m+n)))

nim, lima = map(int, input().split())
if lima<=0<=lima+nim-1:
    print(sum(range(lima,lima+nim)))
elif lima<0:
    print(sum(range(lima,lima+nim-1)))
else:
    print(sum(range(lima+1,lima+nim)))

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

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

if l<0:
    if l+n-1>0:
        print(int(l*n+(n-1)*n/2))
    else:
        print(int(l*(n-1)+(n-2)*(n-1)/2))
else:
    print(int((l+1)*(n-1)+(n-2)*(n-1)/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):
#B
N, L = map(int, input().split())
apple = []
for i in range(N):
    apple.append(L + i)
j = 0
for i in range(N):
    if apple[i] == 0:
        a = apple[i]
        del apple[i]
        j += 1
        break
if j == 0:
    del apple[-1]
    
print(sum(apple))

#B
N, L = map(int, input().split())
apple = []
for i in range(N):
    apple.append(L + i)
j = 0
for i in range(N):
    if apple[i] == 0:
        a = apple[i]
        del apple[i]
        j += 1
        break
#print(j)
#print(apple)
if j == 0:
    if not 0 in apple:
        if apple[0] < 0:
            del apple[-1]
        elif apple[0] > 0:
            del apple[0]
print(sum(apple))
#print(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())
one_aji = 0
aji = []
answer = []
for i in range(N):
    one_aji = L+i
    if one_aji < 0:
        answer.append(one_aji)
        one_aji *= -1
        aji.append(one_aji)
    else:
        aji.append(one_aji)
        answer.append(one_aji)
zettai = 500
ind = 0
for i, a in enumerate(aji):
    a = int(a)
    if a < zettai:
        zettai = a
        ind = i
        
        
answer.pop(ind)
print(sum(answer)

N ,L= map(int,input().split())
one_aji = 0
aji = []
answer = []
for i in range(N):
    one_aji = L+i
    if one_aji < 0:
        answer.append(one_aji)
        one_aji *= -1
        aji.append(one_aji)
    else:
        aji.append(one_aji)
        answer.append(one_aji)
zettai = 500
ind = 0
for i, a in enumerate(aji):
    a = int(a)
    if a < zettai:
        zettai = a
        ind = i
         
answer.pop(ind)
print(sum(answer))


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):
lm = []
N,L = input().split()
N = int(N)
L = int(L)
for x in range(N):
    lm.append((abs(L+x-1),L+x-1))
lm.sort(reverse=True)
lm = lm[1::]
s = 0
for u in range(len(lm)):
    s = s + lm[u][1]
print('{}'.format(s))

lm = []
N,L = input().split()
N = int(N)
L = int(L)
for x in range(1,N+1):
    lm.append((abs(L+x-1),L+x-1))
lm.sort()
lm = lm[1::]
s = 0
for u in range(len(lm)):
    s = s + lm[u][1]
print('{}'.format(s))

Verdicts: Wrong Answer

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

Submission attempts (in order):
n,l=map(int,input().split())
ans=[]
sum=0
for i in range(n):
    ans.append([abs(l+i),l+i])
    sum+=l+i
ans.sort()
print(ans)
print(sum-ans[0][1])

n,l=map(int,input().split())
ans=[]
sum=0
for i in range(n):
    ans.append([abs(l+i),l+i])
    sum+=l+i
ans.sort()
print(sum-ans[0][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):
import numpy as np
N,L = map(int, input() . split())
x=[]
M = 0
N_list = np.array([])

for i in range(N):
  M += L + (i+1) - 1
  N_list = np.append(N_list, L + (i+1) - 1)
  
m = np.abs(N_list).argmin()

#M - N_list[m]
print(M - N_list[m])
  
  

import numpy as np
N,L = map(int, input() . split())
x=[]
M = 0
N_list = np.array([])

for i in range(N):
  M += L + (i+1) - 1
  N_list = np.append(N_list, L + (i+1) - 1)
  
m = np.abs(N_list).argmin()

#M - N_list[m]
print(int(M - N_list[m]))
  
  

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 + n for n in range(N)]

ans = 9999999999

for a in A:
  if abs(a) < ans:
    ans = a
    
print(sum(A) - a)

N,L = map(int,input().split())
A = [L + n for n in range(N)]

ans = 9999999999

for a in A:
  if abs(a) < abs(ans):
    ans = a
    
print(sum(A) - a)

N,L = map(int,input().split())
A = [L + n for n in range(N)]

ans = 9999999999

for a in A:
  if abs(a) < abs(ans):
    ans = a
    
print(sum(A) - ans)

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=[]
for i in range(1,n+1):
    aji.append(l+i-1)
sum=sum(aji)
print(aji)
print(sum)
p=1000
for i in range(n):
    if abs(aji[i])<=abs(aji[i-1]):
        p=aji[i]
        print(aji[i])
print(sum-p)

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

aji=[]
for i in range(1,n+1):
    aji.append(l+i-1)
sum=sum(aji)

#print(sum)
p=1000
for i in range(n):
    if abs(aji[i])<=abs(aji[i-1]):
        p=aji[i]
        
print(sum-p)

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()))
r = np.arange(L, N + L)
print(np.sum(r) - r[np.argmin(np.abs(r))])

import numpy as np
N, L =  list(map(int, input().split()))
r = np.arange(L, N + L)
print(np.sum(r) - r[np.argmin(np.abs(r))])

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())
ls = []
for i in range(L,L+N):
    ls.append(i)
    
x = ls[0]
abs_x = abs(x)
if abs_x in ls[1:]:
    print(sum(ls))
else:
    emp = []
    for i in ls:
        emp.append(abs(i))
    mi = min(emp)
    ind = emp.index(mi)
    print(ind)
    ls.pop(ind)
    print(sum(ls))

ls = []

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

for i in range(N):
  ls.append(L)
  L += 1

if ls[-1] > 0:
    del ls[0]
else:
    del ls[-1]
print(ls)
print(sum(ls))

ls = []

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

for i in range(N):
  ls.append(L)
  L += 1

if ls[-1] >= 0:
    del ls[0]
else:
    del ls[-1]
print(ls)
print(sum(ls))

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

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

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

Submission attempts (in order):
nl=map((int,input().split()))
a=[i+nl[1] for i in range(nl[0])]

a_sum = sum(a)
abs_ = []
for i in range(nl[0]):
  abs_.append(abs(a_sum - a[i]))
idx=abs_.index(min(abs_))
print(a_sum-a[idx])
  

nl=list(map(int,input().split()))
a=[i+nl[1] for i in range(nl[0])]
 
a_sum = sum(a)
abs_ = []
for i in range(nl[0]):
  abs_.append(abs(a_sum - a[i]))
idx=abs_.index(min(abs_))
print(a_sum-a[idx])

nl=list(map((int,input().split())))
a=[i+nl[1] for i in range(nl[0])]
 
a_sum = sum(a)
abs_ = []
for i in range(nl[0]):
  abs_.append(abs(a_sum - a[i]))
idx=abs_.index(min(abs_))
print(a_sum-a[idx])

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

Verdicts: Runtime Error

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):
import numpy as np

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

A = np.arange(N)+L

if A[0] <= 0 and A[N] => 0:
    print(np.sum(A))
elif A[0] < 0 and A[N] < 0:
    print(np.sum(A)-A[N])
else:
    print(np.sum(A)-A[0])

import numpy as np

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

A = np.arange(N)+L

if A[0] <= 0 and A[N-1] >= 0:
    print(np.sum(A))
elif A[0] < 0 and A[N-1] < 0:
    print(np.sum(A)-A[N-1])
else:
    print(np.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):
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n, l = map(int, input().split())

    ls = [i + l for i in range(1, n+1)]
    if l >= 0:
        ls = ls[1:]
    elif n + l < 0:
        ls = ls[:-1]

    print(sum(ls))

if __name__ == '__main__':
    main()


import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n, l = map(int, input().split())

    ls = [i + l for i in range(n)]
    if l >= 0:
        ls = ls[1:]
    elif n + l - 1 < 0:
        ls = ls[:-1]

    print(sum(ls))

if __name__ == '__main__':
    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 = map(int, input().split())

eat_taste = 99999
for i in range(n):
  taste = l + i
  if taste < eat_taste:
    eat_taste = taste
  if taste == 0:
    print(0)
    break
else:
  print(eat_taste)

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

eat_taste = 99999
sum_taste = 0
for i in range(n):
  taste = l + i
  sum_taste += taste
  if abs(taste) < abs(eat_taste):
    eat_taste = taste
print(sum_taste - eat_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())
if l == -1:
    count = 0
    for i in range(n):
        count += l
        l += 1
    print(count)
elif l < 0:
    count = 0
  for i in range(n-1):
        count += l
        l += 1
    print(count)
else:
    print(((2*l+n)*(n-1))//2)

n,l= map(int,input().split())
li = []
for i in range(n):
    li.append(l)
    l += 1
ans = 0
li_min = float('inf')
for i in range(len(li)):
    li_min = min(abs(li[i]),li_min)
for i in range(len(li)):
    if li_min == abs(li[i]):
        li[i] = 0
print(sum(li))

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())
inf = float('inf')
eat = inf
ans = 0
for i in range(N):
    eat = min(eat, abs(L+i))
if L > 0:
    s = eat - L + 1
else:
    s = abs(eat + L -1)
print(s)
for i in range(1,N+1):
    if s == i:
        continue
    ans += L + i -1
print(ans)


N,L = map(int,input().split())
inf = float('inf')
eat = inf
ans = 0
for i in range(N):
    eat = min(eat, abs(L+i))
if L > 0:
    s = eat - L + 1
else:
    s = abs(eat + L -1)

for i in range(1,N+1):
    if s == i:
        continue
    ans += L + i -1
print(ans)


Verdicts: Wrong Answer

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

Submission attempts (in order):
import numpy as np

N,L = [int(i) for i in input().split()]
L = np.arange(L,L+N)
print(L)

if 0 in L:
  print(sum(L))
else:
  if min(L) > 0:
    print(sum(L)-min(L))
  else:
    print(sum(L)-max(L))

import numpy as np

N,L = [int(i) for i in input().split()]
L = np.arange(L,L+N)


if 0 in L:
  print(sum(L))
else:
  if min(L) > 0:
    print(sum(L)-min(L))
  else:
    print(sum(L)-max(L))


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 main():
    N, L = map(int, input().split())
    apple = np.zeros(N)
    R = L + N - 1
    eat = 0
    if R <= 0:
        eat = R
    elif L >= 0:
        eat = L
    print((R + L) * (R - L + 1)/2 - eat)



       

if __name__ == '__main__':
    main()

import numpy as np

def main():
    N, L = map(int, input().split())
    apple = np.zeros(N)
    R = L + N - 1
    eat = 0
    if R <= 0:
        eat = R
    elif L >= 0:
        eat = L
    print(int((R + L) * (R - L + 1)/2 - eat))



       

if __name__ == '__main__':
    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=map(int,input().split())
avemoto=l-1+(n+1)/2
motomoto=n*avemoto
zettaisa=1000
keep=0
for i in range(1,n+1):
  aji=l+i-1
  if zettaisa>=abs(avemoto-aji):
    zettaisa=abs(avemoto-aji)
    keep=aji

print(int(motomoto-aji))

n,l=map(int,input().split())
motomoto=n*l-n+n*(n+1)//2
zettaisa=10**100
keep=0
for i in range(1,n+1):
  aji=motomoto-(l+i-1)
  sa=abs(motomoto-aji)
  if sa<=zettaisa:
    zettaisa=sa
    keep=aji
print(keep)

Verdicts: Wrong Answer

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

Submission attempts (in order):
n, l = map(int, input().split())
t = list(map(lambda x: l + x, range(n)))
r = sum(t)
for i in range(n):
    tmp = sum(t[:i] + t[i + 1:])
    dif_t = abs(r - tmp)
    if i == 0:
        dif = dif_t
    if dif_t < dif:
        ans = tmp
        dif = dif_t
print(ans)


n, l = map(int, input().split())
t = list(map(lambda x: l + x, range(n)))
r = sum(t)
dif = 10 ** 100
for i in range(n):
    tmp = sum(t[:i] + t[i + 1:])
    dif_t = abs(r - tmp)
    if dif_t < dif:
        ans = tmp
        dif = dif_t
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):
L,N = (int(i) for i in input().split()) 
sum = (2*L+N-1)*N/2 
if L>0:
    print(int(sum-L))
elif L+N-1<0:
    print(int(sum-(L+N-1)))
else:
    ans=sum
    print(int(sum))

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

x = 2000
for i in range(n):
  if abs(x)>abs(lists[i]):
    x = lists[i]

print(sum(lists))

n,l = map(int,input().split())
count = 0
lists = [l+i-1 for i in range(1,n+1)]
x = 2000
for i in range(n):
  if abs(x)>abs(lists[i]):
    x = lists[i]
lists.remove(x)
print(sum(lists))

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 , k = [int(x) for x in input().split()]
g = 100000000000
s = n * k + (n*(n-1))//2
for x in range(n):
    g = min(g, s - (k + x))
    
print(g)


n , k = [int(x) for x in input().split()]
s = n * k + (n*(n-1))//2
g = s - k
for x in range(1,n):
    g = min(g, s - (k + x))
    
print(g)


n , k = [int(x) for x in input().split()]
s = n * k + (n*(n-1))//2
g = 100000
v = 100000
for x in range(n):
    if(g > abs(k + x)):
      g = abs(k+x)
      v = k + x
    
print(s - v)


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

taste = [(L + i - 1) + 1 for i in range(N)]
#print(taste)
pie = {}
for i in range(N-1):
  tmp = taste[:]
  tmp0 = tmp[i]
  tmp.pop(i)
  tmp1 = sum(tmp)
  pie[i] = abs(tmp0 - tmp1)
  print(pie)
  
print(pie[min(pie)])

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

taste = [(L + i - 1) + 1 for i in range(N)]
pie = {}
ab, tas = 0, 0
for i in range(N):
    tmp0 = sum(taste)
    tmp = taste[:]
    tmp.pop(i)
    tmp1 = sum(tmp)
    if i == 0:
      ab, tas = abs(tmp0 - tmp1), tmp1
    else:
        if ab > abs(tmp0 - tmp1):
            ab, tas = abs(tmp0 - tmp1), tmp1
     	
print(tas)

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

N,L=map(int ,input().split())
if L >= 0:
    print(int((2*L+N)*(N-1)/2) )
elif L < 0 and L+N-1>=0:
    print(int((2*L+N-1)*(N)/2) )
else:
    print(int((2*L+N-2)*(N-1)/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(' '))
l=list(range(L,N+L,1))
s = sum(l)
print(min([s-x for x in l]))

N, L = map(int,input().split(' '))
l=list(range(L,N+L,1))
s = sum(l)
ans=-10000
for x in l:
    if abs(ans)>x:
        ans=x
print(s-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())

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

print(list)
list.sort(key=lambda x: abs(x))

del list[0]
print(sum(list))

N , L = map(int, input().split())
 
list = [L + (i+1)-1 for i in range(N)]
 
list.sort(key=lambda x:abs(x))
 
del list[0]
print(sum(list))

Verdicts: Runtime Error

Accepted