Buggy python submission (verdict: Runtime Error):
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
A = [0] + list(map(int, input().split())) + [0]
B = cp.deepcopy(A)
C = cp.deepcopy(A)
for i in range(1, len(A)):
    B[i] = B[i-1] + abs(A[i]-A[i-1])
for i in range(len(A)-2, -1, step=-1):
    C[i] = C[i+1] + abs(A[i]-A[i+1])
for i in range(1, N+1):
    print(B[i-1] + C[i+1] + abs(A[i-1]-A[i+1]))


Fixed submission:
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def dump(*objects):
    print(*objects, file=sys.stderr)


N = int(input())
A = [0] + list(map(int, input().split())) + [0]
# dump(N, A)
B = cp.deepcopy(A)
C = cp.deepcopy(A)
for i in range(1, len(A)):
    # dump(i)
    B[i] = B[i-1] + abs(A[i]-A[i-1])
for i in range(len(A)-2, -1, step=-1):
    # dump(i)
    C[i] = C[i+1] + abs(A[i]-A[i+1])
# dump(A, B, C)
for i in range(1, N+1):
    # dump(i, B[i-1] + B[N+1] - B[i+1] + abs(A[i-1]-A[i+1]))
    print(B[i-1] + C[i+1] + abs(A[i-1]-A[i+1]))

exit(0)

Buggy python submission (verdict: Runtime Error):
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def dump(*objects):
    print(*objects, file=sys.stderr)


N = int(input())
A = [0] + list(map(int, input().split())) + [0]
# dump(N, A)
B = cp.deepcopy(A)
C = cp.deepcopy(A)
for i in range(1, len(A)):
    # dump(i)
    B[i] = B[i-1] + abs(A[i]-A[i-1])
for i in range(len(A)-2, -1, step=-1):
    # dump(i)
    C[i] = C[i+1] + abs(A[i]-A[i+1])
# dump(A, B, C)
for i in range(1, N+1):
    # dump(i, B[i-1] + B[N+1] - B[i+1] + abs(A[i-1]-A[i+1]))
    print(B[i-1] + C[i+1] + abs(A[i-1]-A[i+1]))

exit(0)


Fixed submission:
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def dump(*objects):
    print(*objects, file=sys.stderr)


N = int(input())
A = [0] + list(map(int, input().split())) + [0]
# dump(N, A)
B = cp.deepcopy(A)
C = cp.deepcopy(A)
for i in range(1, len(A)):
    # dump(i)
    B[i] = B[i-1] + abs(A[i]-A[i-1])
for i in range(len(A)-2, -1, step=-1):
    # dump(i)
    C[i] = C[i+1] + abs(A[i]-A[i+1])
# dump(A, B, C)
for i in range(1, N+1):
    # dump(i, B[i-1] + B[N+1] - B[i+1] + abs(A[i-1]-A[i+1]))
    print(B[i-1] + C[i+1] + abs(A[i-1]-A[i+1]))

exit(0)

Buggy python submission (verdict: Runtime Error):
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def dump(*objects):
    print(*objects, file=sys.stderr)


N = int(input())
A = [0] + list(map(int, input().split())) + [0]
dump(N, A)
B = cp.deepcopy(A)
C = cp.deepcopy(A)
for i in range(1, len(A)):
    dump(i)
    B[i] = B[i-1] + abs(A[i]-A[i-1])
for i in range(len(A)-2, -1, step=-1):
    dump(i)
    C[i] = C[i+1] + abs(A[i]-A[i+1])
dump(A, B, C)
for i in range(1, N+1):
    dump(i, B[i-1] + B[N+1] - B[i+1] + abs(A[i-1]-A[i+1]))
    print(B[i-1] + C[i+1] + abs(A[i-1]-A[i+1]))

exit(0)


Fixed submission:
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def dump(*objects):
    print(*objects, file=sys.stderr)


N = int(input())
A = [0] + list(map(int, input().split())) + [0]
# dump(N, A)
B = cp.deepcopy(A)
C = cp.deepcopy(A)
for i in range(1, len(A)):
    # dump(i)
    B[i] = B[i-1] + abs(A[i]-A[i-1])
for i in range(len(A)-2, -1, step=-1):
    # dump(i)
    C[i] = C[i+1] + abs(A[i]-A[i+1])
# dump(A, B, C)
for i in range(1, N+1):
    # dump(i, B[i-1] + B[N+1] - B[i+1] + abs(A[i-1]-A[i+1]))
    print(B[i-1] + C[i+1] + abs(A[i-1]-A[i+1]))

exit(0)

Buggy python submission (verdict: Runtime Error):
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def dump(*objects):
    print(*objects, file=sys.stderr)


N = int(input())
A = [0] + list(map(int, input().split())) + [0]
dump(N, A)
B = cp.deepcopy(A)
C = cp.deepcopy(A)
for i in range(1, len(A)):
     dump(i)
    B[i] = B[i-1] + abs(A[i]-A[i-1])
for i in range(len(A)-2, -1, step=-1):
     dump(i)
    C[i] = C[i+1] + abs(A[i]-A[i+1])
dump(A, B, C)
for i in range(1, N+1):
    dump(i, B[i-1] + B[N+1] - B[i+1] + abs(A[i-1]-A[i+1]))
    print(B[i-1] + C[i+1] + abs(A[i-1]-A[i+1]))

exit(0)


Fixed submission:
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def dump(*objects):
    print(*objects, file=sys.stderr)


N = int(input())
A = [0] + list(map(int, input().split())) + [0]
# dump(N, A)
B = cp.deepcopy(A)
C = cp.deepcopy(A)
for i in range(1, len(A)):
    # dump(i)
    B[i] = B[i-1] + abs(A[i]-A[i-1])
for i in range(len(A)-2, -1, step=-1):
    # dump(i)
    C[i] = C[i+1] + abs(A[i]-A[i+1])
# dump(A, B, C)
for i in range(1, N+1):
    # dump(i, B[i-1] + B[N+1] - B[i+1] + abs(A[i-1]-A[i+1]))
    print(B[i-1] + C[i+1] + abs(A[i-1]-A[i+1]))

exit(0)