Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
l = list(map(int,input().split()))
ls = []
for i in range(n-k+1):
  a = l[i]
  b = l[i+k-1]
    ls.append(min(abs(a)+abs(a-b), abs(b)+abs(a-b)))
print(min(ls))

Fixed submission:
n,k = map(int,input().split())
l = list(map(int,input().split()))
ls = []
for i in range(n-k+1):
  a = l[i]
  b = l[i+k-1]
  ls.append(min(abs(a)+abs(a-b), abs(b)+abs(a-b)))
print(min(ls))

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
l = list(map(int,input().split()))
ls = []
for i in range(n-k):
  if k>1:
    if l[i] <0 and l[i+k-1]<=0:
      ls.append(abs(l[i]))
    elif l[i] >=0 and l[i+k-1]>0:
      ls.append(abs(l[i+k-1]))
    elif l[i] <0 and l[i+k-1]>0:
      ls.append(2*min(abs(l[i]),l[i+k-1]) + max(abs(l[i]),l[i+k-1]))
  else:
    ls.append(abs(l[i]))
print(min(ls))

Fixed submission:
n,k = map(int,input().split())
l = list(map(int,input().split()))
ls = []
for i in range(n-k+1):
  a = l[i]
  b = l[i+k-1]
  ls.append(min(abs(a)+abs(a-b), abs(b)+abs(a-b)))
print(min(ls))

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
l = list(map(int,input().split()))
ls = []
for i in range(n-k):
  if l[i] <0 and l[i+k-1]<=0:
    ls.append(abs(l[i]))
  elif l[i] >=0 and l[i+k-1]>0:
    ls.append(abs(l[i+k-1]))
  elif l[i] <0 and l[i+k-1]>0:
    ls.append(2*min(abs(l[i]),l[i+k-1]) + max(abs(l[i]),l[i+k-1]))
print(min(ls))

Fixed submission:
n,k = map(int,input().split())
l = list(map(int,input().split()))
ls = []
for i in range(n-k+1):
  a = l[i]
  b = l[i+k-1]
  ls.append(min(abs(a)+abs(a-b), abs(b)+abs(a-b)))
print(min(ls))

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
l = list(map(int,input().split()))
ls = []
for i in range(n-k):
  if l[i] <0 and l[i+k-1]<=0:
    ls.append(abs(l[i]))
  elif l[i] >=0 and l[i+k-1]>0:
    ls.append(abs(l[i+k-1]))
  elif l[i] =<0 and l[i+k-1]>=0:
    ls.append(2*min(abs(l[i]),l[i+k-1]) + max(abs(l[i]),l[i+k-1]))
print(min(ls))

Fixed submission:
n,k = map(int,input().split())
l = list(map(int,input().split()))
ls = []
for i in range(n-k+1):
  a = l[i]
  b = l[i+k-1]
  ls.append(min(abs(a)+abs(a-b), abs(b)+abs(a-b)))
print(min(ls))

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
l = list(map(int,input().split()))
ls = []
for i in range(n-k):
  if l[i] <0 and l[i+k-1]<0:
    ls.append(abs(l[i]))
  elif l[i] >0 and l[i+k-1]>0:
    ls.append(abs(l[i+k-1]))
  elif l[i] <0 and l[i+k-1]>0:
    ls.append(2*min(abs(l[i]),l[i+k-1]) + max(abs(l[i]),l[i+k-1]))
print(min(ls))

Fixed submission:
n,k = map(int,input().split())
l = list(map(int,input().split()))
ls = []
for i in range(n-k+1):
  a = l[i]
  b = l[i+k-1]
  ls.append(min(abs(a)+abs(a-b), abs(b)+abs(a-b)))
print(min(ls))

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
l = list(map(input().split()))
ls = []
for i in range(n-k):
  if l[i] <0 and l[i+k]<0:
    ls.append(abs(l[i]))
  elif l[i] >0 and l[i+k]>0:
    ls.append(abs(l[i+k]))
  elif l[i] <0 and l[i+k]>0:
    ls.append(2*min(abs(l[i]),l[i+k]) + max(abs(l[i]),l[i+k]))
print(min(ls))

Fixed submission:
n,k = map(int,input().split())
l = list(map(int,input().split()))
ls = []
for i in range(n-k+1):
  a = l[i]
  b = l[i+k-1]
  ls.append(min(abs(a)+abs(a-b), abs(b)+abs(a-b)))
print(min(ls))

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
l = list(map(int,input().split()))
ls = []
for i in range(n-k):
  if l[i] <0 and l[i+k]<0:
    ls.append(abs(l[i]))
  elif l[i] >0 and l[i+k]>0:
    ls.append(abs(l[i+k]))
  elif l[i] <0 and l[i+k]>0:
    ls.append(2*min(abs(l[i]),l[i+k]) + max(abs(l[i]),l[i+k]))
print(min(ls))

Fixed submission:
n,k = map(int,input().split())
l = list(map(int,input().split()))
ls = []
for i in range(n-k+1):
  a = l[i]
  b = l[i+k-1]
  ls.append(min(abs(a)+abs(a-b), abs(b)+abs(a-b)))
print(min(ls))

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
l = list(map(int,input().split()))
ls = []
for i in range(n-k+1):
  if l[i] <0 and l[i+k]<0:
    ls.append(abs(l[i]))
  elif l[i] >0 and l[i+k]>0:
    ls.append(abs(l[i]))
  elif l[i] <0 and l[i+k]>0:
    ls.append(min(abs(l[i]),l[i+k])*2 + max(abs(l[i]),l[i+k]))
print(min(ls))

Fixed submission:
n,k = map(int,input().split())
l = list(map(int,input().split()))
ls = []
for i in range(n-k+1):
  a = l[i]
  b = l[i+k-1]
  ls.append(min(abs(a)+abs(a-b), abs(b)+abs(a-b)))
print(min(ls))

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
l = list(map(int,input().split()))
for i in range(n-k+1):
  if l[i] <0 and l[i+k]<0:
    print(abs(l[i]))
  elif l[i] >0 and l[i+k]>0:
    print(abs(l[i+k]))
  elif l[i] <0 and l[i+k]>0:
    print(min(abs(l[i]),l[i+k])*2 + max(abs(l[i]),l[i+k]))

Fixed submission:
n,k = map(int,input().split())
l = list(map(int,input().split()))
ls = []
for i in range(n-k+1):
  a = l[i]
  b = l[i+k-1]
  ls.append(min(abs(a)+abs(a-b), abs(b)+abs(a-b)))
print(min(ls))