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

 

using namespace std;

 

typedef long long ll;

 

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

#define mp make_pair

#define pb push_back

#define f first

#define s second

#define lb lower_bound

#define ub upper_bound

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

 

const int MOD = 1000000007;

const ll INF = 1e18;

const int MX = 100001;

 

int main() {

    ios_base::sync_with_stdio(0); cin.tie(0);

 

    int n;

    cin >> n;

    vector <ll> a(n);

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

    cin >> a[i];

 

    ll ans[n];

    ans[0] = 0;

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

    {

        ans[0] += a[i];

        if (i % 2 == 1)

        ans[0] -= 2*a[i];

    }

 

    ans[0] = ans[0] / 2;

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

        ans[i] = a[i-1] - ans[i-1];

    }

 

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

        cout << ans[i] * 2 << " ";

    }

 



}

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

#include<cstring>

using namespace std;

long long num[100000];

long long mou[100000];

int main()

{

	int n;

	int sum=0; 

	scanf("%d",&n);

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

	{

		scanf("%lld",&num[i]);

		if(i%2==0)

		{

			mou[0]+=num[i];

		}

		else

		{

			mou[0]-=num[i];

		}

		

	}

	

	printf("%d ",mou[0]);

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

	{

			mou[i]=(num[i-1]-mou[i-1]/2)*2;

			

		//printf("%d %d %d\n ",num[i]/2,num[i+1]/2,mou[i]);

		

		printf("%d ",mou[i]);

	}

	//printf("%d",);

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

#include <vector>





using namespace std;



int main() {

	int n;

	cin >> n;

	vector <int> a;

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

		int new_element;

		cin >> new_element;

		a.push_back(new_element);

	}

	int b0 = 0;

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

		if (i % 2 == 0){

			b0 += a[i];

		}

		else {

			b0 -= a[i];

		}

	}

	cout << b0 << ' ';

	int bi = b0;

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

		bi = (a[i - 1] - bi / 2) * 2;

		cout << bi << ' ';

	}

}

	

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

#include<cstring>

using namespace std;

long long num[100000];

long long mou[100000];

int main()

{

	int n;

	int sum=0; 

	scanf("%d",&n);

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

	{

		scanf("%lld",&num[i]);

		if(i%2==0)

		{

			mou[0]+=num[i];

		}

		else

		{

			mou[0]-=num[i];

		}

		

	}

	

	printf("%d ",mou[0]);

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

	{

			mou[i]=(num[i-1]-mou[i-1]/2)*2;

			

		//printf("%d %d %d\n ",num[i]/2,num[i+1]/2,mou[i]);

		

		printf("%d ",mou[i]);

	}

	//printf("%d",);

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

 

using namespace std;

 

typedef long long ll;

 

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

#define mp make_pair

#define pb push_back

#define f first

#define s second

#define lb lower_bound

#define ub upper_bound

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

 

const int MOD = 1000000007;

const ll INF = 1e18;

const int MX = 100001;

 

int main() {

    ios_base::sync_with_stdio(0); cin.tie(0);

 

    int n;

    cin >> n;

    vector <ll> a(n);

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

    cin >> a[i];

 

    ll ans[n];

    ans[0] = 0;

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

    {

        ans[0] += a[i];

        if (i % 2 == 1)

        ans[0] -= 2*a[i];

    }

 

    ans[0] = ans[0] / 2;

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

        ans[i] = a[i-1] - ans[i-1];

    }

 

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

        cout << ans[i] * 2 << " ";

    }

 



}

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

#include <algorithm>

#include <cstring>

#define ll long long

using namespace std;

int a[100005],ans[100005];

int main(){

	int n,i;

	int tmp;

	scanf("%d",&n);

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

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

	}

	for(i=0,tmp=a[0];i<n;i++){

        tmp=a[i]-tmp;

	}

	tmp=tmp+a[0];

	tmp=tmp/2;

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

	    printf("%d ",tmp*2);

        tmp=a[i]-tmp;



	}

    return 0;

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

#include <vector>





using namespace std;



int main() {

	int n;

	cin >> n;

	vector <int> a;

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

		int new_element;

		cin >> new_element;

		a.push_back(new_element);

	}

	int b0 = 0;

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

		if (i % 2 == 0){

			b0 += a[i];

		}

		else {

			b0 -= a[i];

		}

	}

	cout << b0 << ' ';

	int bi = b0;

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

		bi = (a[i - 1] - bi / 2) * 2;

		cout << bi << ' ';

	}

}

	

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

#include <algorithm>

#include <cstring>

#define ll long long

using namespace std;

int a[100005],ans[100005];

int main(){

	int n,i;

	int tmp;

	scanf("%d",&n);

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

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

	}

	for(i=0,tmp=a[0];i<n;i++){

        tmp=a[i]-tmp;

	}

	tmp=tmp+a[0];

	tmp=tmp/2;

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

	    printf("%d ",tmp*2);

        tmp=a[i]-tmp;



	}

    return 0;

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



using namespace std;



#define lp(i,n) for(int i = 0; i <n;i++)

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

#define pb push_back

#define MP make_pair

#define SZ(v) ((int)((v).size()))

typedef long long ll;



const ll MOD = 1e9 + 7;

const int OO = (int)1e6;

const int N = (int)1e7;



void init(){

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

}

int a[N];

int main() {

	#   ifdef LOCAL_PROJECT

        freopen("in.txt", "r", stdin);

    #   endif

    

    int n;

    scanf("%d",&n);

    int cnt =0;

    

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

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

        if(i&1)cnt+=a[i];

        else cnt-=a[i];

    }

    

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

        printf("%d ",cnt);

        cnt=(a[i]-cnt/2)*2;

        

    }

    

    return 0;

}

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

#include <algorithm>

#include <cstring>

#define ll long long

using namespace std;

int a[100005],ans[100005];

int main(){

	int n,i;

	int tmp;

	scanf("%d",&n);

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

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

	}

	for(i=0,tmp=a[0];i<n;i++){

        tmp=a[i]-tmp;

	}

	tmp=tmp+a[0];

	tmp=tmp/2;

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

	    printf("%d ",tmp*2);

        tmp=a[i]-tmp;



	}

    return 0;

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

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int x[100000],y[100000]={0};

int main()

{

    int n;

    cin>>n;



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

    {

        cin>>x[i];

    }

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

    {

        if(i%2==1)

        {

            y[1]+=x[i];

        }

        else

        {

            y[1]-=x[i];

        }

    }

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

    {

        y[i]=2*x[i-1]-y[i-1];

    }

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

    {

        cout<<y[i]<<" ";

    }

    return 0;

}


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

#include <algorithm>

#include <cstring>

#define ll long long

using namespace std;

int a[100005],ans[100005];

int main(){

	int n,i;

	int tmp;

	scanf("%d",&n);

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

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

	}

	for(i=0,tmp=a[0];i<n;i++){

        tmp=a[i]-tmp;

	}

	tmp=tmp+a[0];

	tmp=tmp/2;

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

	    printf("%d ",tmp*2);

        tmp=a[i]-tmp;



	}

    return 0;

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

using namespace std;



const int MAXN = 1e5 + 5;



int n;

long long D[MAXN], M[MAXN];



int main() {

	cin >> n;

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

		cin >> D[i];

		if (i % 2 == 0)

			M[0] += D[i];

		else

			M[0] -= D[i];

	}

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

		M[i] = 2 * D[i - 1] - M[i - 1];

	}

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

		cout << M[i] << " \n"[i == n - 1];

	}

	return 0;

}


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

#include <algorithm>

#include <cstring>

#define ll long long

using namespace std;

int a[100005],ans[100005];

int main(){

	int n,i;

	int tmp;

	scanf("%d",&n);

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

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

	}

	for(i=0,tmp=a[0];i<n;i++){

        tmp=a[i]-tmp;

	}

	tmp=tmp+a[0];

	tmp=tmp/2;

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

	    printf("%d ",tmp*2);

        tmp=a[i]-tmp;



	}

    return 0;

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

using namespace std;

using ll=long long;

using ld=long double;

using ii=pair<ll,ll>;

using vi=vector<ll>;



#define pb push_back

#define mp make_pair

#define fi first

#define se second

#define INF (ll)1e18

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

#define print(a); for(auto x:a)cout<<x*2<<" "; cout<<"\n";

#define mset(a); memset(a,0,sizeof(a));



int main(){

	ios_base::sync_with_stdio(0);cin.tie(0);

    ll n;cin>>n;

    ll a[n];

    ll x=0;

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

        cin>>a[i];

        if(i%2==0)x+=a[i];

        else x-=a[i];

    }

    vi ans(n);

    ans[0]=x/2;

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

        ans[i]=a[i-1]-ans[i-1];

    }

    print(ans);

}


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

#include <algorithm>

#include <cstring>

#define ll long long

using namespace std;

int a[100005],ans[100005];

int main(){

	int n,i;

	int tmp;

	scanf("%d",&n);

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

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

	}

	for(i=0,tmp=a[0];i<n;i++){

        tmp=a[i]-tmp;

	}

	tmp=tmp+a[0];

	tmp=tmp/2;

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

	    printf("%d ",tmp*2);

        tmp=a[i]-tmp;



	}

    return 0;

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

#include<cstdio>

#include<cstring>

#include<cmath>

#include<algorithm>

#include<cstdlib>

#include<string>

#include<queue>

#include<map>

#include<vector>

#include<ctime>



#define ll long long

#define R register

#define IL inline

#define Rf(a,b,c) for(R int (a)=(b);(a)<=(c);++(a))

#define Tf(a,b,c) for(R int (a)=(b);(a)>=(c);--(a))

#define MP make_pair

#define PA pair<int,int>

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

#define MEC(a,b) memcpy((a),(b),sizeof((b)))

#define D double



using namespace std;



const int N=1e5+5;



int a[N],b[N],p,n;



IL int read() {

    int x=0,f=1;char ch=getchar();

    while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}

    while(ch>='0'&&ch<='9'){x*=10;x+=(ch-'0');ch=getchar();}

    return x*f;

}

IL void write(int x) {

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

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

    putchar(x%10+'0');

}



signed main()

{

	n=read();

	Rf(i,1,n) {

		a[i]=read();

		if(p) b[1]-=a[i];

		else b[1]+=a[i];

		p^=1;

	}

	write(b[1]);

	Rf(i,2,n) {

		putchar(' ');

		b[i]=a[i-1]*2-b[i-1]/2*2;

		write(b[i]);

	}



    return 0;

}


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

#include <algorithm>

#include <cstring>

#define ll long long

using namespace std;

int a[100005],ans[100005];

int main(){

	int n,i;

	int tmp;

	scanf("%d",&n);

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

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

	}

	for(i=0,tmp=a[0];i<n;i++){

        tmp=a[i]-tmp;

	}

	tmp=tmp+a[0];

	tmp=tmp/2;

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

	    printf("%d ",tmp*2);

        tmp=a[i]-tmp;



	}

    return 0;

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

 

using namespace std;

 

typedef long long ll;

 

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

#define mp make_pair

#define pb push_back

#define f first

#define s second

#define lb lower_bound

#define ub upper_bound

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

 

const int MOD = 1000000007;

const ll INF = 1e18;

const int MX = 100001;

 

int main() {

    ios_base::sync_with_stdio(0); cin.tie(0);

 

    int n;

    cin >> n;

    vector <ll> a(n);

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

    cin >> a[i];

 

    ll ans[n];

    ans[0] = 0;

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

    {

        ans[0] += a[i];

        if (i % 2 == 1)

        ans[0] -= 2*a[i];

    }

 

    ans[0] = ans[0] / 2;

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

        ans[i] = a[i-1] - ans[i-1];

    }

 

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

        cout << ans[i] * 2 << " ";

    }

 



}

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

#include<algorithm>

#include<cstdio>

#define N 100005

long long int a[N];

int n;

long long int ans=0;

int main(){

scanf("%d",&n);

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

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

}

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

if(i%2)ans+=a[i];

else ans-=a[i];

}



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

long long int x=2*a[i]-ans;

printf("%lld ",ans);

ans=x;

}



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

#include <vector>





using namespace std;



int main() {

	int n;

	cin >> n;

	vector <int> a;

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

		int new_element;

		cin >> new_element;

		a.push_back(new_element);

	}

	int b0 = 0;

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

		if (i % 2 == 0){

			b0 += a[i];

		}

		else {

			b0 -= a[i];

		}

	}

	cout << b0 << ' ';

	int bi = b0;

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

		bi = (a[i - 1] - bi / 2) * 2;

		cout << bi << ' ';

	}

}

	

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

#include<algorithm>

#include<cstdio>

#define N 100005

long long int a[N];

int n;

long long int ans=0;

int main(){

scanf("%d",&n);

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

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

}

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

if(i%2)ans+=a[i];

else ans-=a[i];

}



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

long long int x=2*a[i]-ans;

printf("%lld ",ans);

ans=x;

}



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



using namespace std;



#define lp(i,n) for(int i = 0; i <n;i++)

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

#define pb push_back

#define MP make_pair

#define SZ(v) ((int)((v).size()))

typedef long long ll;



const ll MOD = 1e9 + 7;

const int OO = (int)1e6;

const int N = (int)1e7;



void init(){

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

}

int a[N];

int main() {

	#   ifdef LOCAL_PROJECT

        freopen("in.txt", "r", stdin);

    #   endif

    

    int n;

    scanf("%d",&n);

    int cnt =0;

    

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

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

        if(i&1)cnt+=a[i];

        else cnt-=a[i];

    }

    

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

        printf("%d ",cnt);

        cnt=(a[i]-cnt/2)*2;

        

    }

    

    return 0;

}

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

#include<algorithm>

#include<cstdio>

#define N 100005

long long int a[N];

int n;

long long int ans=0;

int main(){

scanf("%d",&n);

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

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

}

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

if(i%2)ans+=a[i];

else ans-=a[i];

}



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

long long int x=2*a[i]-ans;

printf("%lld ",ans);

ans=x;

}



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

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int x[100000],y[100000]={0};

int main()

{

    int n;

    cin>>n;



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

    {

        cin>>x[i];

    }

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

    {

        if(i%2==1)

        {

            y[1]+=x[i];

        }

        else

        {

            y[1]-=x[i];

        }

    }

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

    {

        y[i]=2*x[i-1]-y[i-1];

    }

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

    {

        cout<<y[i]<<" ";

    }

    return 0;

}


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

#include<algorithm>

#include<cstdio>

#define N 100005

long long int a[N];

int n;

long long int ans=0;

int main(){

scanf("%d",&n);

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

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

}

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

if(i%2)ans+=a[i];

else ans-=a[i];

}



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

long long int x=2*a[i]-ans;

printf("%lld ",ans);

ans=x;

}



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

using namespace std;



const int MAXN = 1e5 + 5;



int n;

long long D[MAXN], M[MAXN];



int main() {

	cin >> n;

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

		cin >> D[i];

		if (i % 2 == 0)

			M[0] += D[i];

		else

			M[0] -= D[i];

	}

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

		M[i] = 2 * D[i - 1] - M[i - 1];

	}

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

		cout << M[i] << " \n"[i == n - 1];

	}

	return 0;

}


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

#include<algorithm>

#include<cstdio>

#define N 100005

long long int a[N];

int n;

long long int ans=0;

int main(){

scanf("%d",&n);

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

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

}

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

if(i%2)ans+=a[i];

else ans-=a[i];

}



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

long long int x=2*a[i]-ans;

printf("%lld ",ans);

ans=x;

}



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

using namespace std;

using ll=long long;

using ld=long double;

using ii=pair<ll,ll>;

using vi=vector<ll>;



#define pb push_back

#define mp make_pair

#define fi first

#define se second

#define INF (ll)1e18

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

#define print(a); for(auto x:a)cout<<x*2<<" "; cout<<"\n";

#define mset(a); memset(a,0,sizeof(a));



int main(){

	ios_base::sync_with_stdio(0);cin.tie(0);

    ll n;cin>>n;

    ll a[n];

    ll x=0;

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

        cin>>a[i];

        if(i%2==0)x+=a[i];

        else x-=a[i];

    }

    vi ans(n);

    ans[0]=x/2;

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

        ans[i]=a[i-1]-ans[i-1];

    }

    print(ans);

}


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

#include<algorithm>

#include<cstdio>

#define N 100005

long long int a[N];

int n;

long long int ans=0;

int main(){

scanf("%d",&n);

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

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

}

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

if(i%2)ans+=a[i];

else ans-=a[i];

}



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

long long int x=2*a[i]-ans;

printf("%lld ",ans);

ans=x;

}



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

#include<cstdio>

#include<cstring>

#include<cmath>

#include<algorithm>

#include<cstdlib>

#include<string>

#include<queue>

#include<map>

#include<vector>

#include<ctime>



#define ll long long

#define R register

#define IL inline

#define Rf(a,b,c) for(R int (a)=(b);(a)<=(c);++(a))

#define Tf(a,b,c) for(R int (a)=(b);(a)>=(c);--(a))

#define MP make_pair

#define PA pair<int,int>

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

#define MEC(a,b) memcpy((a),(b),sizeof((b)))

#define D double



using namespace std;



const int N=1e5+5;



int a[N],b[N],p,n;



IL int read() {

    int x=0,f=1;char ch=getchar();

    while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}

    while(ch>='0'&&ch<='9'){x*=10;x+=(ch-'0');ch=getchar();}

    return x*f;

}

IL void write(int x) {

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

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

    putchar(x%10+'0');

}



signed main()

{

	n=read();

	Rf(i,1,n) {

		a[i]=read();

		if(p) b[1]-=a[i];

		else b[1]+=a[i];

		p^=1;

	}

	write(b[1]);

	Rf(i,2,n) {

		putchar(' ');

		b[i]=a[i-1]*2-b[i-1]/2*2;

		write(b[i]);

	}



    return 0;

}


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

#include<algorithm>

#include<cstdio>

#define N 100005

long long int a[N];

int n;

long long int ans=0;

int main(){

scanf("%d",&n);

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

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

}

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

if(i%2)ans+=a[i];

else ans-=a[i];

}



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

long long int x=2*a[i]-ans;

printf("%lld ",ans);

ans=x;

}



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

using namespace std;

#define ll long long

ll n, ans[100005], a[100005], temp,f = 1;

int main()

{

    //ios::sync_with_stdio(false);

    cin >> n;

    for(int i = 1; i <= n; ++i) cin >> a[i], temp += 2 * f * a[i], f *= -1;

    ans[1] = temp / 2;

    cout << ans[1] <<' ';

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

        ans[i] = 2 * a[i - 1] - ans[i - 1];

        cout << ans[i] << ' ';

    }



    return 0;

}

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

#include<algorithm>

#include<cstdio>

#define N 100005

long long int a[N];

int n;

long long int ans=0;

int main(){

scanf("%d",&n);

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

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

}

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

if(i%2)ans+=a[i];

else ans-=a[i];

}



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

long long int x=2*a[i]-ans;

printf("%lld ",ans);

ans=x;

}



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

#include<algorithm>

#include<cstdio>

#include <vector>

#include <map>



using namespace std;



const int maxn = 1E5 + 5;

long long A[maxn], sum, tmp[maxn], ans[maxn];

int n;



int main( )

{

	cin >> n;

	long long t;

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

	{

		cin >> A[i];

	}

	A[0] = A[n];

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

	{

		if( i == 1 )

			tmp[i] = ( A[i] - A[i - 1] );

		else

			tmp[i] = A[i] - tmp[i - 1];

	}

	ans[n] = tmp[n - 1];

	for( int i = n - 1; i >= 1; -- i )

	{

		ans[i] = 2ll * A[i] - ans[i + 1];

	}

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

		cout << ans[i] << " ";

	cout << endl;

}

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

#include <cstring>

#include <algorithm>

using namespace std;

const int maxd = 1e5+10;

int a[maxd],n;

long long b[maxd];

int main()

{

    // freopen("a.in","r",stdin);

    // freopen("k.out","w",stdout);

    scanf("%d",&n);

    for(int i=1;i<=n;i++) scanf("%d",&a[i]);

    b[1] = 0ll;

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

    {

        if(i%2) b[1] += a[i];

        else b[1] -= a[i];

    }

    b[1] /=2; a[n] -= b[1];

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

        b[i+1] = a[i] - b[i];

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

        printf("%lld ",b[i]*2);

    //printf("%lld",ans);

    return 0;

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



using namespace std;



#define ll long long



int main()

{

    int n;

    cin >> n;

    vector <int> a(n);

    vector <int> x(n, 0);

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

        cin >> a[i];



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

        x[0] += pow(-1, i) * a[i];

    }



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

        x[i] = 2*a[i-1] - x[i-1];

    }



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

        cout << x[i] << " ";



}


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

#include <cstring>

#include <algorithm>

using namespace std;

const int maxd = 1e5+10;

int a[maxd],n;

long long b[maxd];

int main()

{

    // freopen("a.in","r",stdin);

    // freopen("k.out","w",stdout);

    scanf("%d",&n);

    for(int i=1;i<=n;i++) scanf("%d",&a[i]);

    b[1] = 0ll;

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

    {

        if(i%2) b[1] += a[i];

        else b[1] -= a[i];

    }

    b[1] /=2; a[n] -= b[1];

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

        b[i+1] = a[i] - b[i];

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

        printf("%lld ",b[i]*2);

    //printf("%lld",ans);

    return 0;

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



using namespace std;



int main()

{

#ifdef LOCAL

    freopen("input.txt", "r", stdin);

#endif // LOCAL

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    int n;

    cin >> n;

    vector <long long> a(n);

    for (int i = 0; i < n; i++) cin >> a[i];

    vector <long long> ans(n);

    ans[0] = 0;

    for (int i = n - 1; i >= 0; i--) {

        if (i & 1) ans[0] -= a[i];

        else ans[0] += a[i];

    }

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

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

    }

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

        cout << ans[i] << " ";

    }

    return 0;

}

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

#include <cstring>

#include <algorithm>

using namespace std;

const int maxd = 1e5+10;

int a[maxd],n;

long long b[maxd];

int main()

{

    // freopen("a.in","r",stdin);

    // freopen("k.out","w",stdout);

    scanf("%d",&n);

    for(int i=1;i<=n;i++) scanf("%d",&a[i]);

    b[1] = 0ll;

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

    {

        if(i%2) b[1] += a[i];

        else b[1] -= a[i];

    }

    b[1] /=2; a[n] -= b[1];

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

        b[i+1] = a[i] - b[i];

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

        printf("%lld ",b[i]*2);

    //printf("%lld",ans);

    return 0;

}