Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# get a integer
num = int(raw_input())
# get two integers separated with half-width break
array = map(int, raw_input().split())
# get a string
#s = raw_input()

for i in range(0,num):
    state = 0
    way = 0
    for j in range(0,num):
        if i != j:
            if !(j+1 < num and state <= array[j] and array[j] <= array[j+1]) 
                and !(j+1 < num and state >= array[j] and array[j] >= array[j+1]):
                way += abs(array[j] - state)
                state = array[j]
    way += abs(state)
    print(way)


Fixed submission:
# -*- coding: utf-8 -*-
# get a integer
num = int(raw_input())
# get two integers separated with half-width break
array = map(int, raw_input().split())
# get a string
#s = raw_input()

state = 0
way_total = 0
for j in range(0,num):
    way_total += abs(array[j] - state)
    state = array[j]
way_total += abs(state)

for i in range(0,num):
    if i != num - 1 and i != 0:
        way = way_total - abs(array[i-1] - array[i]) - abs(array[i+1] - array[i]) + abs(array[i-1] - array[i+1])
    elif i == 0:
        way = way_total - abs(array[i])- abs(array[i+1] - array[i]) + abs(array[i+1])
    elif i == num - 1:
        way = way_total - abs(array[i-1] - array[i]) - abs(array[i]) + abs(array[i-1] - 0)
    print(way)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
# get a integer
num = int(raw_input())
# get two integers separated with half-width break
array = map(int, raw_input().split())
# get a string
#s = raw_input()

for i in range(0,num):
    state = 0
    way = 0
    for j in range(0,num):
        if i != j:
            way += abs(array[j] - state)
            state = array[j]
    way += abs(state)
    print(way)


Fixed submission:
# -*- coding: utf-8 -*-
# get a integer
num = int(raw_input())
# get two integers separated with half-width break
array = map(int, raw_input().split())
# get a string
#s = raw_input()

state = 0
way_total = 0
for j in range(0,num):
    way_total += abs(array[j] - state)
    state = array[j]
way_total += abs(state)

for i in range(0,num):
    if i != num - 1 and i != 0:
        way = way_total - abs(array[i-1] - array[i]) - abs(array[i+1] - array[i]) + abs(array[i-1] - array[i+1])
    elif i == 0:
        way = way_total - abs(array[i])- abs(array[i+1] - array[i]) + abs(array[i+1])
    elif i == num - 1:
        way = way_total - abs(array[i-1] - array[i]) - abs(array[i]) + abs(array[i-1] - 0)
    print(way)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding:utf-8 -*-

#import sys # モジュール属性 argv を取得するため
 
argvs = sys.argv  # コマンドライン引数を格納したリストの取得
argc = len(argvs) # 引数の個数
# デバッグプリント
print argvs
print argc

Fixed submission:
# -*- coding: utf-8 -*-
# get a integer
num = int(raw_input())
# get two integers separated with half-width break
array = map(int, raw_input().split())
# get a string
#s = raw_input()

state = 0
way_total = 0
for j in range(0,num):
    way_total += abs(array[j] - state)
    state = array[j]
way_total += abs(state)

for i in range(0,num):
    if i != num - 1 and i != 0:
        way = way_total - abs(array[i-1] - array[i]) - abs(array[i+1] - array[i]) + abs(array[i-1] - array[i+1])
    elif i == 0:
        way = way_total - abs(array[i])- abs(array[i+1] - array[i]) + abs(array[i+1])
    elif i == num - 1:
        way = way_total - abs(array[i-1] - array[i]) - abs(array[i]) + abs(array[i-1] - 0)
    print(way)

Buggy python submission (verdict: Runtime Error):
import sys # モジュール属性 argv を取得するため
 
argvs = sys.argv  # コマンドライン引数を格納したリストの取得
argc = len(argvs) # 引数の個数
# デバッグプリント
print argvs
print argc

Fixed submission:
# -*- coding: utf-8 -*-
# get a integer
num = int(raw_input())
# get two integers separated with half-width break
array = map(int, raw_input().split())
# get a string
#s = raw_input()

state = 0
way_total = 0
for j in range(0,num):
    way_total += abs(array[j] - state)
    state = array[j]
way_total += abs(state)

for i in range(0,num):
    if i != num - 1 and i != 0:
        way = way_total - abs(array[i-1] - array[i]) - abs(array[i+1] - array[i]) + abs(array[i-1] - array[i+1])
    elif i == 0:
        way = way_total - abs(array[i])- abs(array[i+1] - array[i]) + abs(array[i+1])
    elif i == num - 1:
        way = way_total - abs(array[i-1] - array[i]) - abs(array[i]) + abs(array[i-1] - 0)
    print(way)

Buggy python submission (verdict: Runtime Error):
print(args)

Fixed submission:
# -*- coding: utf-8 -*-
# get a integer
num = int(raw_input())
# get two integers separated with half-width break
array = map(int, raw_input().split())
# get a string
#s = raw_input()

state = 0
way_total = 0
for j in range(0,num):
    way_total += abs(array[j] - state)
    state = array[j]
way_total += abs(state)

for i in range(0,num):
    if i != num - 1 and i != 0:
        way = way_total - abs(array[i-1] - array[i]) - abs(array[i+1] - array[i]) + abs(array[i-1] - array[i+1])
    elif i == 0:
        way = way_total - abs(array[i])- abs(array[i+1] - array[i]) + abs(array[i+1])
    elif i == num - 1:
        way = way_total - abs(array[i-1] - array[i]) - abs(array[i]) + abs(array[i-1] - 0)
    print(way)