stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>



#define fr first

#define sc second

#define pb push_back

#define mk make_pair

#define sz(s) (int)s.size()

#define all(s) s.begin(), s.end()



using namespace std;



const int N = 1e5 + 5;



int n, sum, a[N], pr[N], sum2;



main()

{

    cin >> n;

    for( int i = 1; i <= n; i++ )

    {

        cin >> a[i];

        if( a[i] >= a[i - 1] )

            pr[ i ] = 1;

        sum += abs( a[i] - a[i - 1] );

    }

    for( int i = 1; i < n; i++ )

        sum2 += abs( a[i] - a[i - 1] );



    sum += abs( a[n] );

    sum2 += abs( a[n - 1] );

//    cout << sum << endl;

    for( int i = 1; i <= n; i++ )

    {

        int cnt = 0;

        if( pr[i] )

        {

            if( !pr[i + 1] )

                cnt += abs( a[i] - max( a[i - 1], a[ i + 1 ] ) ) * 2;

        }



        else

            if( pr[i + 1] )

                cnt += abs( a[i] - min( a[i - 1], a[ i + 1 ] ) ) * 2;

        if( i == n )

            cout << sum2 << endl;

        else

            cout << sum - cnt << endl ;

    }



}


// Faster C++ solution for the same problem (measured speedup: 5.411786213961303x):
#include <cstdio>

#include <cctype>



int n, a[100010], tot;



int read() {

    int ret, fl = 1;

    char ch;

    while(!isdigit(ch = getchar()))

        (ch == '-') && (fl = -1);

    ret = ch - '0';

    while(isdigit(ch = getchar()))

        ret *= 10, ret += ch - '0';

    return ret * fl;

}



void print(int x) {

    if(x < 0) putchar('-'), x = -x;

    if(x > 9) print(x / 10);

    putchar(x % 10 + '0');

}



int abs(int x) {

    return x > 0 ? x : -x;

}



int main() {

    n = read();

    for(int i = 1; i <= n; ++i)

        a[i] = read(), tot += abs(a[i] - a[i - 1]);

    tot += abs(a[n]);

    for(int i = 1; i <= n; ++i) {

        int ans;

        if(a[i] > a[i - 1]) {

            if(a[i + 1] > a[i]) ans = tot;

            else {

                if(a[i + 1] > a[i - 1]) ans = tot + a[i + 1] * 2 - a[i] * 2;

                else ans = tot + a[i - 1] * 2 - a[i] * 2;

            }

        }

        else {

            if(a[i + 1] < a[i]) ans = tot;

            else {

                if(a[i + 1] > a[i - 1]) ans = tot + a[i] * 2 - a[i - 1] * 2;

                else ans = tot + a[i] * 2 - a[i + 1] * 2;

            }

        }

        print(ans), putchar('\n');

    }

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cmath>

#include <vector>

#include <algorithm>

#include <stack>

#include <cstring>

#include <queue>

#include <set>

#include <map>



using namespace std;



const int maxN = 1e6 + 10, oo = 23041997, modP = 1e7, maxC = 50;



#define FORU(i, l, r) for (int i = l; i <= r; ++i)

#define FORD(i, r, l) for (int i = r; i >= l; --i)

#define REPU(i, r) for (int i = 0; i < r; ++i)

#define F first

#define S second

#define PB push_back

#define LL long long

#define BIT(x, i) ((x >> i) & 1)

#define PINT pair < int, int >



int n, a[maxN], res;



int main() {

    cin >> n;

    FORU(i, 1, n) cin >> a[i];

    a[0] = a[n + 1] = 0;

    FORU(i, 0, n)

        res += (int) abs(a[i] - a[i + 1]);

    FORU(i, 1, n) {

        int tmp1 = (int) abs(a[i] - a[i + 1]);

        int tmp2 = (int) abs(a[i] - a[i - 1]);

        int tmp3 = (int) abs(a[i - 1] - a[i + 1]);

        cout << res - tmp1 - tmp2 + tmp3 << endl;

    }

}


// Faster C++ solution for the same problem (measured speedup: 5.411168256635109x):
#include <cstdio>

#include <cctype>



int n, a[100010], tot;



int read() {

    int ret, fl = 1;

    char ch;

    while(!isdigit(ch = getchar()))

        (ch == '-') && (fl = -1);

    ret = ch - '0';

    while(isdigit(ch = getchar()))

        ret *= 10, ret += ch - '0';

    return ret * fl;

}



void print(int x) {

    if(x < 0) putchar('-'), x = -x;

    if(x > 9) print(x / 10);

    putchar(x % 10 + '0');

}



int abs(int x) {

    return x > 0 ? x : -x;

}



int main() {

    n = read();

    for(int i = 1; i <= n; ++i)

        a[i] = read(), tot += abs(a[i] - a[i - 1]);

    tot += abs(a[n]);

    for(int i = 1; i <= n; ++i) {

        int ans;

        if(a[i] > a[i - 1]) {

            if(a[i + 1] > a[i]) ans = tot;

            else {

                if(a[i + 1] > a[i - 1]) ans = tot + a[i + 1] * 2 - a[i] * 2;

                else ans = tot + a[i - 1] * 2 - a[i] * 2;

            }

        }

        else {

            if(a[i + 1] < a[i]) ans = tot;

            else {

                if(a[i + 1] > a[i - 1]) ans = tot + a[i] * 2 - a[i - 1] * 2;

                else ans = tot + a[i] * 2 - a[i + 1] * 2;

            }

        }

        print(ans), putchar('\n');

    }

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std ;



int main()

{

	ios_base::sync_with_stdio(0) ;

	cin.tie(0) ;

	int n ;

	cin>>n ;

	int arr[n] ;

	for(int i = 0 ; i < n ; ++i)

		cin>>arr[i] ;

	int pref[n], suff[n] ;

	suff[n-1] = abs(arr[n-1] - 0) ;

	for(int i = n-2 ; i >= 0 ; --i)

		suff[i] = abs(arr[i] - arr[i+1]) + suff[i+1] ;

	pref[0] = abs(0 - arr[0]) ;

	for(int i = 1 ; i < n ; ++i)

		pref[i] = abs(arr[i] - arr[i-1]) + pref[i-1] ;

	int prv = 0 , cost = 0;

	for(int i = 0 ; i < n ; ++i)

	{

		if(i == n-1)

			return cout<<pref[n-2] + abs(arr[n-2] - 0)<<"\n" , 0 ;

		cout<<abs(arr[i+1] - prv) + suff[i+1] + cost<<"\n";

		prv = arr[i] ;

		cost = pref[i] ;

	}

	return 0 ;

}

// Faster C++ solution for the same problem (measured speedup: 5.485900298855646x):
#include <cstdio>

#include <cctype>



int n, a[100010], tot;



int read() {

    int ret, fl = 1;

    char ch;

    while(!isdigit(ch = getchar()))

        (ch == '-') && (fl = -1);

    ret = ch - '0';

    while(isdigit(ch = getchar()))

        ret *= 10, ret += ch - '0';

    return ret * fl;

}



void print(int x) {

    if(x < 0) putchar('-'), x = -x;

    if(x > 9) print(x / 10);

    putchar(x % 10 + '0');

}



int abs(int x) {

    return x > 0 ? x : -x;

}



int main() {

    n = read();

    for(int i = 1; i <= n; ++i)

        a[i] = read(), tot += abs(a[i] - a[i - 1]);

    tot += abs(a[n]);

    for(int i = 1; i <= n; ++i) {

        int ans;

        if(a[i] > a[i - 1]) {

            if(a[i + 1] > a[i]) ans = tot;

            else {

                if(a[i + 1] > a[i - 1]) ans = tot + a[i + 1] * 2 - a[i] * 2;

                else ans = tot + a[i - 1] * 2 - a[i] * 2;

            }

        }

        else {

            if(a[i + 1] < a[i]) ans = tot;

            else {

                if(a[i + 1] > a[i - 1]) ans = tot + a[i] * 2 - a[i - 1] * 2;

                else ans = tot + a[i] * 2 - a[i + 1] * 2;

            }

        }

        print(ans), putchar('\n');

    }

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<stdio.h>

#include<cstring>

#include<cmath>

#include<algorithm>

#include<vector>

#include<map>

#include<set>

#include<queue>

#define ll long long

using namespace std;

int pos(int n)

{

    if(n<0)

        return 0;

    else

        return n;

}

int main()

{

    int a[100002][2]= {0};

    int n;

    cin>>n;

    ll sum=0;

    for(int i=1; i<=n; i++)

    {

        scanf("%d",&a[i][0]);

 

        sum+=abs(a[i-1][0]-a[i][0]);

    }

    sum+=abs(a[n][0]);

    for(int i=1; i<=n; i++)

    {

 

            cout<<sum-abs(a[i][0]-a[i+1][0])-abs(a[i][0]-a[i-1][0])+abs(a[i-1][0]-a[i+1][0])<<endl;

 

  

    }

}

// Faster C++ solution for the same problem (measured speedup: 9.802567922424448x):
#include <cstdio>

#include <cctype>



int n, a[100010], tot;



int read() {

    int ret, fl = 1;

    char ch;

    while(!isdigit(ch = getchar()))

        (ch == '-') && (fl = -1);

    ret = ch - '0';

    while(isdigit(ch = getchar()))

        ret *= 10, ret += ch - '0';

    return ret * fl;

}



void print(int x) {

    if(x < 0) putchar('-'), x = -x;

    if(x > 9) print(x / 10);

    putchar(x % 10 + '0');

}



int abs(int x) {

    return x > 0 ? x : -x;

}



int main() {

    n = read();

    for(int i = 1; i <= n; ++i)

        a[i] = read(), tot += abs(a[i] - a[i - 1]);

    tot += abs(a[n]);

    for(int i = 1; i <= n; ++i) {

        int ans;

        if(a[i] > a[i - 1]) {

            if(a[i + 1] > a[i]) ans = tot;

            else {

                if(a[i + 1] > a[i - 1]) ans = tot + a[i + 1] * 2 - a[i] * 2;

                else ans = tot + a[i - 1] * 2 - a[i] * 2;

            }

        }

        else {

            if(a[i + 1] < a[i]) ans = tot;

            else {

                if(a[i + 1] > a[i - 1]) ans = tot + a[i] * 2 - a[i - 1] * 2;

                else ans = tot + a[i] * 2 - a[i + 1] * 2;

            }

        }

        print(ans), putchar('\n');

    }

    return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std;

#include <set>

#include <algorithm>

typedef long long ll;

const int N = 1e5+10;

int a[N];

int main()

{

	int n;

	cin >> n;

	

	for(int i = 1;i<=n;i++)

	{

		cin >> a[i];

	}

	ll sum = abs(a[1]-0);

	

	for(int i = 2;i<=n;i++)

	{

		sum +=abs(a[i]-a[i-1]);

	}

	

	sum+=abs(a[n]-0);

	

//	cout << sum << endl;

	for(int i = 1; i < n;i++)

	{

		ll res = sum - abs(a[i]-a[i-1])- abs(a[i+1]-a[i]) + abs(a[i+1]-a[i-1]);

		cout << res << endl;

	}

	

	cout << sum - abs(a[n]-a[n-1]) - abs(a[n]) + abs(a[n-1]);

	

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.405954147264217x):
#include <cstdio>

#include <cctype>



int n, a[100010], tot;



int read() {

    int ret, fl = 1;

    char ch;

    while(!isdigit(ch = getchar()))

        (ch == '-') && (fl = -1);

    ret = ch - '0';

    while(isdigit(ch = getchar()))

        ret *= 10, ret += ch - '0';

    return ret * fl;

}



void print(int x) {

    if(x < 0) putchar('-'), x = -x;

    if(x > 9) print(x / 10);

    putchar(x % 10 + '0');

}



int abs(int x) {

    return x > 0 ? x : -x;

}



int main() {

    n = read();

    for(int i = 1; i <= n; ++i)

        a[i] = read(), tot += abs(a[i] - a[i - 1]);

    tot += abs(a[n]);

    for(int i = 1; i <= n; ++i) {

        int ans;

        if(a[i] > a[i - 1]) {

            if(a[i + 1] > a[i]) ans = tot;

            else {

                if(a[i + 1] > a[i - 1]) ans = tot + a[i + 1] * 2 - a[i] * 2;

                else ans = tot + a[i - 1] * 2 - a[i] * 2;

            }

        }

        else {

            if(a[i + 1] < a[i]) ans = tot;

            else {

                if(a[i + 1] > a[i - 1]) ans = tot + a[i] * 2 - a[i - 1] * 2;

                else ans = tot + a[i] * 2 - a[i + 1] * 2;

            }

        }

        print(ans), putchar('\n');

    }

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



const int maxn = 1e5 +  5;



int a[maxn];



int main()

{

   int n;

   cin >> n;

   int ans = 0;

   for(int i=1;i<=n;i++)

   {

       cin >> a[i];

       ans += abs(a[i] - a[i-1]);

   }

   ans += abs(a[n]);

   for(int i=1;i<=n;i++)

   {

       cout << ans - abs(a[i] - a[i-1]) - abs(a[i+1] - a[i]) + abs(a[i-1] - a[i+1]) << endl;

   }

   return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.4080150122836015x):
#include <cstdio>

#include <cctype>



int n, a[100010], tot;



int read() {

    int ret, fl = 1;

    char ch;

    while(!isdigit(ch = getchar()))

        (ch == '-') && (fl = -1);

    ret = ch - '0';

    while(isdigit(ch = getchar()))

        ret *= 10, ret += ch - '0';

    return ret * fl;

}



void print(int x) {

    if(x < 0) putchar('-'), x = -x;

    if(x > 9) print(x / 10);

    putchar(x % 10 + '0');

}



int abs(int x) {

    return x > 0 ? x : -x;

}



int main() {

    n = read();

    for(int i = 1; i <= n; ++i)

        a[i] = read(), tot += abs(a[i] - a[i - 1]);

    tot += abs(a[n]);

    for(int i = 1; i <= n; ++i) {

        int ans;

        if(a[i] > a[i - 1]) {

            if(a[i + 1] > a[i]) ans = tot;

            else {

                if(a[i + 1] > a[i - 1]) ans = tot + a[i + 1] * 2 - a[i] * 2;

                else ans = tot + a[i - 1] * 2 - a[i] * 2;

            }

        }

        else {

            if(a[i + 1] < a[i]) ans = tot;

            else {

                if(a[i + 1] > a[i - 1]) ans = tot + a[i] * 2 - a[i - 1] * 2;

                else ans = tot + a[i] * 2 - a[i + 1] * 2;

            }

        }

        print(ans), putchar('\n');

    }

    return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

typedef long long ll;

ll num[100005];

int main(){

	ll N,t=0;

	cin>>N;

	ll sum=0;

	for(int i=0;i<N;i++){

		cin>>num[i];

		sum=sum+abs(num[i]-t);

		t=num[i];

	}

	//下面开始丢弃数据

	for(int i=0;i<N;i++){

		int ans=sum;

		if(i!=0||i!=N-1){

			ans=ans-abs(num[i]-num[i-1])-abs(num[i+1]-num[i])+abs(num[i+1]-num[i-1])+abs(num[N-1]-0);

		}else if(i==0){

			ans=ans-abs(num[i]-0)-abs(num[i+1]-num[i])+abs(num[i+1]-0)+abs(num[N-1]-0);

		}else{

			ans=ans-abs(num[i]-num[i-1])+abs(num[i-1]-0);

		}

		cout<<ans<<endl;

	} 

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.409468496263549x):
#include <cstdio>

#include <cctype>



int n, a[100010], tot;



int read() {

    int ret, fl = 1;

    char ch;

    while(!isdigit(ch = getchar()))

        (ch == '-') && (fl = -1);

    ret = ch - '0';

    while(isdigit(ch = getchar()))

        ret *= 10, ret += ch - '0';

    return ret * fl;

}



void print(int x) {

    if(x < 0) putchar('-'), x = -x;

    if(x > 9) print(x / 10);

    putchar(x % 10 + '0');

}



int abs(int x) {

    return x > 0 ? x : -x;

}



int main() {

    n = read();

    for(int i = 1; i <= n; ++i)

        a[i] = read(), tot += abs(a[i] - a[i - 1]);

    tot += abs(a[n]);

    for(int i = 1; i <= n; ++i) {

        int ans;

        if(a[i] > a[i - 1]) {

            if(a[i + 1] > a[i]) ans = tot;

            else {

                if(a[i + 1] > a[i - 1]) ans = tot + a[i + 1] * 2 - a[i] * 2;

                else ans = tot + a[i - 1] * 2 - a[i] * 2;

            }

        }

        else {

            if(a[i + 1] < a[i]) ans = tot;

            else {

                if(a[i + 1] > a[i - 1]) ans = tot + a[i] * 2 - a[i - 1] * 2;

                else ans = tot + a[i] * 2 - a[i + 1] * 2;

            }

        }

        print(ans), putchar('\n');

    }

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<fstream>

#include<cstdio>

#include<iomanip>

#include<algorithm>

#include<vector>

#include<set>

#include<list>

#include<queue>

#include<deque>

#include<unordered_map>

#include<map>

#include<string>

#include<cstring>

#include<stack>

#include<cmath>

#include<utility>



#define vint vector<int>

#define vstr vector<string>

#define vll vector<long long>

#define ll long long

#define pf printf

#define sf scanf

#define sfd(n) scanf("%d", &n)

#define sflf(n) scanf("%lf", &n)

#define sfll(n) scanf("%lld", &n)

#define pfd(n) printf("%d", n)

#define pflf(n) printf("%lf", n)

#define pfll(n) printf("%lld", n)

#define pft	printf("\t")

#define pfn printf("\n")

#define pfk printf(" ")

#define PI 3.1415926

#define MAX 100000

#define M 1e9



using namespace std;



int main() {

	int n;

	sfd(n);

	int* num = new int[n+2];

	vector<int> travel;

	num[0] = 0;

	int sum = 0, m;

	for( int i=1; i<=n; i++ ) {

		sfd(num[i]);

		m = abs(num[i]-num[i-1]);

		travel.push_back(m);

		sum += m;

	}

	num[n+1] = 0;

	sum += abs(num[n]);

	travel.push_back(abs(num[n]));

//	cout << "len = " << travel.size() << endl;

	for( int i=0; i<n; i++ ) {

		pfd(sum-travel[i]-travel[i+1]+abs(num[i+2]-num[i]));

		pfn;

	}

	

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.398614204255294x):
#include <cstdio>

#include <cctype>



int n, a[100010], tot;



int read() {

    int ret, fl = 1;

    char ch;

    while(!isdigit(ch = getchar()))

        (ch == '-') && (fl = -1);

    ret = ch - '0';

    while(isdigit(ch = getchar()))

        ret *= 10, ret += ch - '0';

    return ret * fl;

}



void print(int x) {

    if(x < 0) putchar('-'), x = -x;

    if(x > 9) print(x / 10);

    putchar(x % 10 + '0');

}



int abs(int x) {

    return x > 0 ? x : -x;

}



int main() {

    n = read();

    for(int i = 1; i <= n; ++i)

        a[i] = read(), tot += abs(a[i] - a[i - 1]);

    tot += abs(a[n]);

    for(int i = 1; i <= n; ++i) {

        int ans;

        if(a[i] > a[i - 1]) {

            if(a[i + 1] > a[i]) ans = tot;

            else {

                if(a[i + 1] > a[i - 1]) ans = tot + a[i + 1] * 2 - a[i] * 2;

                else ans = tot + a[i - 1] * 2 - a[i] * 2;

            }

        }

        else {

            if(a[i + 1] < a[i]) ans = tot;

            else {

                if(a[i + 1] > a[i - 1]) ans = tot + a[i] * 2 - a[i - 1] * 2;

                else ans = tot + a[i] * 2 - a[i + 1] * 2;

            }

        }

        print(ans), putchar('\n');

    }

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cmath>

#include <stdio.h>

#include <algorithm>

#include <string>

#include <vector>

#include <queue>

#include <deque>

#include <stack>

#include <map>

#include <set>

#include <cstring>



using namespace std;



#define f first

#define s second

#define pb push_back

#define mp make_pair

#define ll long long

#define pii pair < int, int >

#define pll pair < long long, long long>

#define ull unsigned long long

#define vi vector < int >

#define vll vector < long long >

#define sz(a) (int)a.size()

#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)

#define all(a) a.begin(), a.end()

#define sqr(x) ((x) * (x))

#define fname "searching"



const int inf = (int)1e9;

const ll INF = (ll)1e18;

const double eps = 1e-9;

const double pi = acos(-1.0);

const int mod = (int)1e9 + 7;



int n;

vll v;

ll sum[100100];



void solve(){

    cin >> n;

    v.pb(0);

    for(int i = 0; i < n; ++i){

        ll x;

        cin >> x;

        sum[i + 1] = sum[i] + abs(x - v.back());

        v.pb(x);

    }

    //for(int i = 0; i < n + 1; ++i) cout << sum[i] << " ";



    for(int i = 1; i < n; ++i){

        int cur = sum[i - 1] + abs(v[i + 1] - v[i - 1]) + sum[n] - sum[i + 1] + abs(v[n]);

        cout << cur << "\n";

    }

    cout << sum[n - 1] + abs(v[n - 1]) << "\n";

}



int main(){

    ios_base::sync_with_stdio(0);

    cin.tie(0);



    solve();

    

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.50866953334401x):
#include <cstdio>

#include <cctype>



int n, a[100010], tot;



int read() {

    int ret, fl = 1;

    char ch;

    while(!isdigit(ch = getchar()))

        (ch == '-') && (fl = -1);

    ret = ch - '0';

    while(isdigit(ch = getchar()))

        ret *= 10, ret += ch - '0';

    return ret * fl;

}



void print(int x) {

    if(x < 0) putchar('-'), x = -x;

    if(x > 9) print(x / 10);

    putchar(x % 10 + '0');

}



int abs(int x) {

    return x > 0 ? x : -x;

}



int main() {

    n = read();

    for(int i = 1; i <= n; ++i)

        a[i] = read(), tot += abs(a[i] - a[i - 1]);

    tot += abs(a[n]);

    for(int i = 1; i <= n; ++i) {

        int ans;

        if(a[i] > a[i - 1]) {

            if(a[i + 1] > a[i]) ans = tot;

            else {

                if(a[i + 1] > a[i - 1]) ans = tot + a[i + 1] * 2 - a[i] * 2;

                else ans = tot + a[i - 1] * 2 - a[i] * 2;

            }

        }

        else {

            if(a[i + 1] < a[i]) ans = tot;

            else {

                if(a[i + 1] > a[i - 1]) ans = tot + a[i] * 2 - a[i - 1] * 2;

                else ans = tot + a[i] * 2 - a[i + 1] * 2;

            }

        }

        print(ans), putchar('\n');

    }

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

typedef long long ll;

#define dbg          cout<<"Freak"<<endl;

#define dbgg(i)      cout<<i<<endl;

#define N            1e9+7;

#define pb           push_back

using namespace std;

ll t;

ll arr[300005];

vector<ll>v;



int main()

{

    ll a,b,c,d,e,f,g,i,j;

    cin>>t;

    v.pb(0);

    f=0;

    for(i=0;i<t;i++)

    {

        cin>>a;

        v.push_back(a);

        b=abs(a-v[i]);

        f+=b;

    }

    v.pb(0);

    b=abs(0-v[t]);

    f+=b;

    for(i=1;i<=t;i++)

    {

        b=abs(v[i]-v[i-1]);

        c=abs(v[i]-v[i+1]);

        g=f-b-c;

        g=g+abs(v[i+1]-v[i-1]);

        cout<<g<<endl;

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.423279615869265x):
#include <cstdio>

#include <cctype>



int n, a[100010], tot;



int read() {

    int ret, fl = 1;

    char ch;

    while(!isdigit(ch = getchar()))

        (ch == '-') && (fl = -1);

    ret = ch - '0';

    while(isdigit(ch = getchar()))

        ret *= 10, ret += ch - '0';

    return ret * fl;

}



void print(int x) {

    if(x < 0) putchar('-'), x = -x;

    if(x > 9) print(x / 10);

    putchar(x % 10 + '0');

}



int abs(int x) {

    return x > 0 ? x : -x;

}



int main() {

    n = read();

    for(int i = 1; i <= n; ++i)

        a[i] = read(), tot += abs(a[i] - a[i - 1]);

    tot += abs(a[n]);

    for(int i = 1; i <= n; ++i) {

        int ans;

        if(a[i] > a[i - 1]) {

            if(a[i + 1] > a[i]) ans = tot;

            else {

                if(a[i + 1] > a[i - 1]) ans = tot + a[i + 1] * 2 - a[i] * 2;

                else ans = tot + a[i - 1] * 2 - a[i] * 2;

            }

        }

        else {

            if(a[i + 1] < a[i]) ans = tot;

            else {

                if(a[i + 1] > a[i - 1]) ans = tot + a[i] * 2 - a[i - 1] * 2;

                else ans = tot + a[i] * 2 - a[i + 1] * 2;

            }

        }

        print(ans), putchar('\n');

    }

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<stdio.h>

#include<cstring>

#include<cmath>

#include<algorithm>

#include<vector>

#include<map>

#include<set>

#include<queue>

#define ll long long

using namespace std;

int pos(int n)

{

    if(n<0)

        return 0;

    else

        return n;

}

int main()

{

    int a[100002][2]= {0};

    int n;

    cin>>n;

    ll sum=0;

    for(int i=1; i<=n; i++)

    {

        scanf("%d",&a[i][0]);

 

        sum+=abs(a[i-1][0]-a[i][0]);

    }

    sum+=abs(a[n][0]);

    for(int i=1; i<=n; i++)

    {

 

            cout<<sum-abs(a[i][0]-a[i+1][0])-abs(a[i][0]-a[i-1][0])+abs(a[i-1][0]-a[i+1][0])<<endl;

 

  

    }

}

// Faster C++ solution for the same problem (measured speedup: 1.7905007180870733x):
#include <bits/stdc++.h>

using namespace std;

#define ll long long

int main(){

  int n;

  cin>>n;

  vector<ll>v(n+2);

  v[0] = 0;

  for(int i=0; i<n; i++) {cin >> v[i+1];}

  v[n+1] = 0;

  ll sum=0;

  for(int i=1; i<n+2; i++){

    sum += abs(v[i]-v[i-1]);

  }

  for(int i=1; i<n+1; i++){

    cout << sum - abs(v[i]-v[i-1]) - abs(v[i+1]-v[i]) + abs(v[i+1]-v[i-1]) << endl;

  }

return 0;

}