stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <vector>

#include <list>

#include <map>

#include <set>

#include <deque>

#include <stack>

#include <bitset>

#include <algorithm>

#include <functional>

#include <iostream>

#include <iomanip>

#include <cstdio>

#include <cmath>

#include <set>

//#inlcude<stringstream>

#define ll long long

#define MODD 1000000007

using namespace std;



int main() {

    int a, b;cin >>a>>b;

    int sum=0;



    for(int i=a;i<=b;i++){

        //cout<<i%10<< " "<<i/10000<<endl;

        int n = i;

        if((n%10)==(n/10000)){

            //cout<<i%10<< " "<<i/10000<<endl;

            if(((n-n%10)/10%10)==(n-n/10000*10000)/1000)

                sum++;

           // cout<<"ddd"<<(i-i%10)%10<< " "<<(i-i/10000*10000)/1000<<endl;

        }

    }

    cout<<sum<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int hws(int x)

{

    int num=0;

    while(x)

    {

        num*=10;

        num+=x%10;

        x=x/10;

    }

    return num;

}

int main()

{

    int a,b;

    scanf("%d %d",&a,&b);

    int sum=0;

    for(int i=a;i<=b;i++)

    {

        if(i==hws(i))

            sum++;

    }

    printf("%d\n",sum);

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <stdio.h>

#include <string.h>

#include <algorithm>

#include <math.h>

#include <map>

#include <set>

#include <stdlib.h>

#define ll long long

#define inf 0x3f3f3f3f

#define mem(a,b) memset(a,b,sizeof(a))

using namespace std;

const int maxn=1e6+5;

ll a[maxn];

int inverse(int x)

{

    int b=log10(x);

    int m=0,y;

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

    {

       y=x%10;

        m=m*10+y;

        x/=10;

    }

    //cout<<m<<endl;

    return m;

}

int main()

{

    ll a,b;

    cin>>a>>b;

    int sum=0;

    for(int i=a; i<=b; i++)

    {

        if(inverse(i)==i)

        {

              sum++;

              //cout<<i<<endl;

        }

    }

    cout<<sum<<endl;

    return 0;

}

/*

10

5 1 8 8 8 8 8 9 9 9

*/


// Optimized solution to the same problem (faster):
#include<stdio.h>

int hws(int x)

{

    int num=0;

    while(x)

    {

        num*=10;

        num+=x%10;

        x=x/10;

    }

    return num;

}

int main()

{

    int a,b;

    scanf("%d %d",&a,&b);

    int sum=0;

    for(int i=a;i<=b;i++)

    {

        if(i==hws(i))

            sum++;

    }

    printf("%d\n",sum);

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<stdio.h>

#include<math.h>

#include<string.h>

#include<iostream>

#include<algorithm>

#include<queue>

#include<stack>

#include<set>

#include<map>

#include<vector>

#include<deque>

#include<string>

#define dint __int128

using namespace std;

#define kk putchar(32)

#define gc getchar()

#define fup(i,a,b) for(int i=a,i##e=b;i<=i##e;++i)

#define fdn(i,a,b) for(int i=a,i##e=b;i>=i##e;--i)

#define mem(a,b) memset(a,b,sizeof(a))

#define hh putchar(10)

#define ll long long

inline ll rrr(){ll x,f=1;char a;while((a=gc)<48||a>57)if(a==45)f=-1;

for(x=a^48;(a=gc)>47&&a<58;x=(x<<3)+(x<<1)+(a^48));return f*x;}

struct nnn{int x,y,z;};

void Main();



int main()

{

    Main();

    return 0;

}



inline int huiwen(int x)

{

    int a=x,b=0;

    while(a)b=10*b+a%10,a/=10;

    if(x==b)return 1;

    return 0;

}

void Main()

{

    int a,b;

    cin>>a>>b;

    int ans=0;

    fup(i,a,b)(huiwen(i))&&(++ans);

    cout<<ans;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int hws(int x)

{

    int num=0;

    while(x)

    {

        num*=10;

        num+=x%10;

        x=x/10;

    }

    return num;

}

int main()

{

    int a,b;

    scanf("%d %d",&a,&b);

    int sum=0;

    for(int i=a;i<=b;i++)

    {

        if(i==hws(i))

            sum++;

    }

    printf("%d\n",sum);

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<stdio.h>

#include<algorithm>

#include<string.h>

using namespace std;

int huiwen(int s)

{

    int d=0;

    while(s)

    {

        d=d*10+s%10;

        s=s/10;

    }

    return d;

}

int main()

{

    int a,b,sum=0;

    scanf("%d%d",&a,&b);

    for(int i=a;i<=b;i++)

    {

        int q=huiwen(i);

        if(i==q)

          sum++;

    }

    printf("%d\n",sum);

    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int hws(int x)

{

    int num=0;

    while(x)

    {

        num*=10;

        num+=x%10;

        x=x/10;

    }

    return num;

}

int main()

{

    int a,b;

    scanf("%d %d",&a,&b);

    int sum=0;

    for(int i=a;i<=b;i++)

    {

        if(i==hws(i))

            sum++;

    }

    printf("%d\n",sum);

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<string>

using namespace std;



int main()

{

    char c[5];

    int A, B, count = 0;

    cin >> A >> B;

    for (int i = A; i <= B; i++)

    {

        string s = to_string(i);

        if (s[0] == s[4] && s[1] == s[3])

        {

            count++;

        }

    }

    

    cout << count << endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

    int A, B;

    scanf("%d%d", &A, &B);

    int x = 0;

    for (int i = A; i <= B; i++)

    {

        int s = i % 10;

        int t = i / 10000 % 10;

        int u = i / 10 % 10;

        int v = i / 1000 % 10;

        if (s == t && u == v) x++;

    }

    printf("%d\n", x);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

bool ok(int a)

{

   int n=0;

   int aa=a;

   while(aa)

   {

      n = n*10 + aa%10;

      aa/=10;

   }

   return a==n;

}

int main()

{

   int a,b,i,j,cnt=0;

   cin>>a>>b;

   for(i=a;i<=b;i++)

   {

      if(ok(i))cnt++;

   }

   cout<<cnt<<endl;

   return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

#include<string.h> 

int main() {

	int a,b;

	scanf("%d %d",&a,&b);

	int i,j;

	int cnt=0;

	for(i=a;i<=b;i++){

		int c,d,e,f,g;

		c=i/10000;

		d=i%10000/1000;

		e=i%1000/100;

		f=i%100/10;

		g=i%10;

		if(c==g&&d==f){

			cnt++;

		}

	}

	printf("%d",cnt);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#include <ext/numeric>

using namespace std;

using namespace __gnu_cxx;

#define write_to_file() freopen("output.txt" , "w" , stdout)

#define read_from_file() freopen("input.txt" , "r" , stdin)

#define GeoOutputFix(VV) cout<<fixed<<setprecision(VV)

#define MAX_V  1e9

#define MIN_V -1e9

template<class T>istream& operator>> (istream& is, complex<T>& p){T value;is >> value, p.real(value), is >> value, p.imag(value);return is;}

typedef long long lld;

typedef pair<lld, lld> dd;

typedef complex<double> point;

#define X real()

#define Y imag()

#define dist(a , b) sqrt(pow(a.X - b.X , 2) + pow(a.Y- b.Y , 2))

#define dist2(a , b) ((long double)hypot(a , b))

#define mid(a,b) (((a)+(b))/point(2,0))

#define compare(a , b) (fabs(a.X - b.X) < -1e9 && fabs(a.Y - b.Y) < -1e9)

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

#define MOD (lld)(1e9+7)

#define EPS 1e-9

#define neighbours(u , e , v) for(int e = head[u] , v ; v = to[e] , ~e ; e = nxt[e])

#define watch1(x) cout<<(#x)<<" = "<<x<<"\n"

#define watch2(x , y) cout<<(#x)<<" = "<<x<<"  "<<(#y)<<" = "<<(y)<<"\n"

#define watch3(x , y , z) cout<<(#x)<<" = "<<x<<"  "<<(#y)<<" = "<<(y)<"  "<<(#z)<<" = "<<(z)<<"\n"

int dr[] = {1 , 1 , 1 , 0 , 0 , -1 , -1 , -1};

int dc[] = {-1 , 0 , 1 , -1 , 1 , -1 , 0 , 1};

int ddr[] = {1 , 0 , 0 , -1};

int ddc[] = {0 , -1 , 1 , 0};

inline int SD(){int i ;scanf("%d", &i);return i;}

inline lld SLL(){lld i;scanf("%lld", &i);return i;}

inline char SC(){char i;scanf(" %c", &i);return i;}

const int AKA = 1e6 + 6 , OO = 0x3f3f3f3f;

//----------------------------------------[TO_OO]--[To infinity and beyond]--------------------------------------------------------

bool ispal(int x)

{

    vector<int> v;

    while(x)

    {

        v.push_back(x % 10);

        x /= 10;

    }

    int n = v.size();

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

        if(v[i] != v[n - i - 1])

            return false;

    return true;

}

int main()

{

    int a = SD() , b = SD() , ans = 0;

    for(int i = a ; i <= b ; ++i)

        ans += ispal(i);

    printf("%d" , ans);

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

#include<string.h> 

int main() {

	int a,b;

	scanf("%d %d",&a,&b);

	int i,j;

	int cnt=0;

	for(i=a;i<=b;i++){

		int c,d,e,f,g;

		c=i/10000;

		d=i%10000/1000;

		e=i%1000/100;

		f=i%100/10;

		g=i%10;

		if(c==g&&d==f){

			cnt++;

		}

	}

	printf("%d",cnt);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std ;



string  a , b ;



int main()

{

	cin >> a >> b ;

	int x = stoi(a);

	int y = stoi(b);

	int counter =0;

		

	for ( int i=x ; i<=y ; ++i)

		if ( (i%10) == (i/10000) &&  (i%100)/10 == (i/1000)%10 )

			counter++;

	

	cout << counter ;

	

	return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

#include<string.h> 

int main() {

	int a,b;

	scanf("%d %d",&a,&b);

	int i,j;

	int cnt=0;

	for(i=a;i<=b;i++){

		int c,d,e,f,g;

		c=i/10000;

		d=i%10000/1000;

		e=i%1000/100;

		f=i%100/10;

		g=i%10;

		if(c==g&&d==f){

			cnt++;

		}

	}

	printf("%d",cnt);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



#define MXN 100005



int a[MXN];



int main() { 

    int n, res = 0;

    while (cin >> n) {

        memset(a, 0, sizeof(a));

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

            cin >> a[i];

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

        }

        res += abs(a[n]);

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

            cout << res-abs(a[i]-a[i-1])-abs(a[i]-a[i+1])+abs(a[i-1]-a[i+1]) << "\n";

        }

    }



    return 0;

}


// Optimized solution to the same problem (faster):
#include<iostream>

#include<string.h>

#include<math.h>

using namespace std;

int a[100005];

int b[100005];

int main()

{

	int i,n,sum=0;

	scanf("%d",&n);

	a[0]=0;

	a[n+1]=0;

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

	{

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

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

		sum+=b[i];

	}

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

	sum+=b[n+1];

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

	{

		printf("%d\n",sum-b[i]-b[i+1]+abs(a[i+1]-a[i-1]));

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<cstring>

#include<iostream>

#include<cmath>

using namespace std;

const int maxn=1e5+1;

int main()

{

    int val[maxn];

    int n;

    long long cost;

    while(~scanf("%d",&n)){

        memset(val,0,sizeof(val));

        cost=0;

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

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

            //cout<<'#'<<val[i]<<'#'<<endl;

            if(i==n) cost+=fabs(val[i]);

            cost+=fabs(val[i]-val[i-1]);

            //cout<<'@'<<cost<<'@'<<endl;

        }

        long long out;

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

            if(i==n) out=cost-fabs(val[i])+fabs(val[i-1])-fabs(val[i]-val[i+1]);

            out=cost-fabs(val[i]-val[i-1])-fabs(val[i+1]-val[i])+fabs(val[i+1]-val[i-1]);

            printf("%lld\n",out);

        }

    }

}

// Optimized solution to the same problem (faster):
#include<iostream>

#include<string.h>

#include<math.h>

using namespace std;

int a[100005];

int b[100005];

int main()

{

	int i,n,sum=0;

	scanf("%d",&n);

	a[0]=0;

	a[n+1]=0;

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

	{

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

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

		sum+=b[i];

	}

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

	sum+=b[n+1];

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

	{

		printf("%d\n",sum-b[i]-b[i+1]+abs(a[i+1]-a[i-1]));

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

 

  

    }

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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 ;

    }



}


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

    }

}


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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 ;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem: