#include<iostream>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<queue>
#include<stack>
#include<iomanip>
#include<cmath>
#include <utility>
#include <numeric>
#include<complex>
#include<sstream>
#include <functional>
#include<valarray>
#define ln cout<<endl;
#define vll vector<long long int>
#define vi vector<int>
#define vc vector<char>
#define vstr vector<string>
#define vb vector<bool>
#define sti set<int>
#define stc set<char>
#define sz size()
#define lli long long int
using namespace std;
lli prime(lli n) {
	if (n % 2 == 0 && n != 2 || n<2)
		return false;
	else {
		for (lli i = 3; i*i <= n; i += 2)
		{
			if (n%i == 0)
			{
				return false;
			}
		}
	}
	return true;
}
unsigned long long gcd(unsigned long long  n, unsigned  long long  m) {//g
	if (n%m == 0)
		return m;
	else return gcd(m, n%m);
}
lli lcm(lli n, lli m) {
	return n*m / gcd(n, m);
}
lli fact(lli n) {
	if (n == 1)return 1;
	else return n * fact(n - 1);
}
int sumdigit(int n) {
	int sum = 0;
	while (n)
	{
		sum += (n % 10);
		n /= 10;
	}
	return sum;
}
string tobinary(lli n)
{
	string s;
	while (n)
	{
		s += (n % 2) + '0';
		n /= 2;
	}
	reverse(s.begin(), s.end());
	return s;
}
/*template<class T> string tostring(T par)
{
stringstreem ss;
ss<<par;
return ss.str();
}*/
string tostring(double n) {
	double m = n;
	string x;
	stringstream ss;
	ss << m;
	ss >> x;
	return x;
}
char tochar(int n) {
	int m = n;
	char x;
	stringstream ss;
	ss << m;
	ss >> x;
	return x;
}
int div(lli n)
{
	int c = 1;
	if (n == 1)return 1;
	if (n == 2) return 2;
	//if(prime(n))return 2;
	for (int i = 2; i <= int(sqrt(n)); i++)
	{
		if (n%i == 0)
			c++;
	}
	if (sqrt(n)*sqrt(n) == n)return c * 2 - 1;
	return c * 2;
}
int main()
{
	/*int  n, k,a, sum=0;
	cin >> n >> k;
	for (int i = 0; i < n; i++)
	{
	cin >> a;
	if (i < k)sum += (a*(-1));
	}*/
	int n, m, x[1005], y[1005], d[1005], r[1005], ans[1005] = { 0 }, c = 0, k = 0;
	cin >> n >> m;

	for (int i = 0; i < n + m; i++)
	{
		cin >> x[i];
	}
	for (int i = 0; i < n + m; i++)
	{
		cin >> y[i];
		if (y[i] == 1)d[c++] = x[i];
		else r[k++] = x[i];
	}

	if (m == 1)cout << n;
	else {
	    d[c] = 10000000;
		for (int i = 0,j=0; i < n, j < m ;)
		{
					if (r[i] > d[j] && r[i] < d[j + 1]) {
						if (abs(r[i] - d[j]) <= abs(r[i] - d[j + 1])) {
							ans[j]++; i++;
						}
						else { ans[j + 1]++; i++; }
				}
					else j++;
			}

		for (int i = 0; i < m; i++)
		{
			cout << ans[i] << " ";
		}
	}
#if _DEBUG
	system("pause");
#endif
	return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define ll long long int
#define si(x) scanf("%d",&x)
#define sll(x) scanf("%lld",&x)
#define pb push_back
#define F first
#define S second
#define ALL(x) (x).begin(),(x).end()
#define fastscan ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define SPACE ' '
#define N_LINE '\n'

const int N = 1e5 + 5;

int vis[N],a[N],t[N];

int main(){

    fastscan;

    int n,m;
    map <int, int> mp;

    cin >> n >> m;

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

    for(int i = 1; i <= n + m; ++i){
        cin >> t[i];
        if(t[i])
            mp[a[i]] = 0;
    }

    for(int i = 1; i <= n + m; ++i){
        vis[i] = t[i] ? a[i] : vis[i-1];
    }

    int last = INT_MAX;

    for(int i = n + m; i > 0; --i){
        if(t[i]){
            last = a[i];
        }else{
            if(last - a[i] < a[i] - vis[i] || vis[i] == 0)
                vis[i] = last;
                mp[vis[i]]++;
        }
    }

    // cout << "\n";

    auto it = mp.begin();

    while(it != mp.end()){
        cout << (*it).S << SPACE;
        it++;
    }

    cout << N_LINE;

    return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define ll long long int
#define si(x) scanf("%d",&x)
#define sll(x) scanf("%lld",&x)
#define pb push_back
#define F first
#define S second
#define ALL(x) (x).begin(),(x).end()
#define fastscan ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define SPACE ' '
#define N_LINE '\n'

const int N = 1e5 + 5;

ll vis[N],a[N],t[N], kon[N];
vector <ll> ans;

int main(){

    fastscan;

    ll n,m;
    map <ll, ll> mp;
    ll cou = 0;
    cin >> n >> m;

    for(ll i = 1; i <= n + m; ++i)
        cin >> a[i];

    for(ll i = 1; i <= n + m; ++i){
        cin >> t[i];
        if(t[i]){
            ++cou;
            ans.pb(0);
        }
    }

    ll x = 0;

    for(ll i = 1; i <= n + m; ++i){
        vis[i] = t[i] ? a[i] : vis[i-1];
        kon[i] = t[i] ? ++x : kon[i-1];
    }

    ll last = LLONG_MAX;

    for(ll i = n + m; i > 0; --i){
        if(t[i]){
            last = a[i];
            --cou;
        }else{
            if(last - a[i] < a[i] - vis[i] || vis[i] == 0){
                kon[i] = cou + 1;
                vis[i] = last;
            }
            ans[kon[i] - 1]++;
        }
    }

    for(int i : ans)
        cout << i << SPACE;
    cout << N_LINE;

    return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define ll long long int
#define si(x) scanf("%d",&x)
#define sll(x) scanf("%lld",&x)
#define pb push_back
#define F first
#define S second
#define ALL(x) (x).begin(),(x).end()
#define fastscan ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define SPACE ' '
#define N_LINE '\n'

const int N = 1e5 + 5;

ll vis[N],a[N],t[N], kon[N];
vector <ll> ans;

int main(){

    fastscan;

    ll n,m;
    map <ll, ll> mp;
    ll cou = 0;
    cin >> n >> m;

    for(ll i = 1; i <= n + m; ++i)
        cin >> a[i];

    for(ll i = 1; i <= n + m; ++i){
        cin >> t[i];
        if(t[i]){
            ++cou;
            ans.pb(0);
        }
    }

    ll x = 0;

    for(ll i = 1; i <= n + m; ++i){
        vis[i] = t[i] ? a[i] : vis[i-1];
        kon[i] = t[i] ? ++x : kon[i-1];
    }

    ll last = INT_MAX;

    for(ll i = n + m; i > 0; --i){
        if(t[i]){
            last = a[i];
            --cou;
        }else{
            if(last - a[i] < a[i] - vis[i] || vis[i] == 0){
                kon[i] = cou + 1;
                vis[i] = last;
            }
            ans[kon[i] - 1]++;
        }
    }

    for(int i : ans)
        cout << i << SPACE;
    cout << N_LINE;

    return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define ll long long int
#define si(x) scanf("%d",&x)
#define sll(x) scanf("%lld",&x)
#define pb push_back
#define F first
#define S second
#define ALL(x) (x).begin(),(x).end()
#define fastscan ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define SPACE ' '
#define N_LINE '\n'

const int N = 1e5 + 5;

int vis[N],a[N],t[N];

int main(){

    fastscan;

    int n,m;
    map <int, int> mp;

    cin >> n >> m;

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

    for(int i = 1; i <= n + m; ++i){
        cin >> t[i];
        if(t[i])
            mp[a[i]] = 0;
    }

    for(int i = 1; i <= n + m; ++i){
        vis[i] = t[i] ? a[i] : vis[i-1];
    }

    int last = INT_MAX;

    for(int i = n + m; i > 0; --i){
        if(t[i]){
            last = a[i];
        }else{
            if(last - a[i] < a[i] - vis[i] || vis[i] == 0)
                vis[i] = last;
                mp[vis[i]]++;
        }
    }

    // cout << "\n";

    for(auto i: mp)
        cout << i.S << SPACE;

    return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define ll long long int
#define si(x) scanf("%d",&x)
#define sll(x) scanf("%lld",&x)
#define pb push_back
#define F first
#define S second
#define ALL(x) (x).begin(),(x).end()
#define fastscan ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define SPACE ' '
#define N_LINE '\n'

const int N = 1e5 + 5;

ll vis[N],a[N],t[N];

int main(){

    fastscan;

    ll n,m;
    map <ll, ll> mp;

    cin >> n >> m;

    for(ll i = 1; i <= n + m; ++i)
        cin >> a[i];

    for(ll i = 1; i <= n + m; ++i){
        cin >> t[i];
        if(t[i])
            mp[a[i]] = 0;
    }

    for(ll i = 1; i <= n + m; ++i){
        vis[i] = t[i] ? a[i] : vis[i-1];
    }

    ll last = INT_MAX;

    for(ll i = n + m; i > 0; --i){
        if(t[i]){
            last = a[i];
        }else{
            if(last - a[i] < a[i] - vis[i] || vis[i] == 0)
                vis[i] = last;
                mp[vis[i]]++;
        }
    }

    // cout << "\n";

    auto it = mp.begin();

    while(it != mp.end()){
        cout << (*it).S << SPACE;
        it++;
    }

    cout << N_LINE;

    return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define ll long long int
#define si(x) scanf("%d",&x)
#define sll(x) scanf("%lld",&x)
#define pb push_back
#define F first
#define S second
#define ALL(x) (x).begin(),(x).end()
#define fastscan ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define SPACE ' '
#define N_LINE '\n'

const int N = 2e5 + 5;

int vis[N],a[N],t[N];

int main(){

    fastscan;

    int n,m;
    map <int, int> mp;

    cin >> n >> m;

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

    for(int i = 1; i <= n + m; ++i){
        cin >> t[i];
        if(t[i])
            mp[a[i]] = 0;
    }

    for(int i = 1; i <= n + m; ++i){
        vis[i] = t[i] ? a[i] : vis[i-1];
    }

    int last = INT_MAX;

    for(int i = n + m; i > 0; --i){
        if(t[i]){
            last = a[i];
        }else{
            if(last - a[i] < a[i] - vis[i] || vis[i] == 0)
                vis[i] = last;
                mp[vis[i]]++;
        }
    }

    // cout << "\n";

    for(auto i: mp)
        cout << i.S << SPACE;

    return 0;
}


/*input
1 4
2 4 6 10 15
1 1 1 1 0
*/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>

using namespace std;

int GCD(int x,int y){return y?GCD(y,x%y):x;}
#define ain(a,n) int a[(n)];for(int i=0;i<(n);i++)scanf("%d",a[i]);
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,a,b) for(int i=(a);i<(b);i++)
#define repm(i,a,b) for(int i=(a);i>(b);i--)
const int INF = 1000000006;
typedef long long ll;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	int a[n+m+1],b[n+m],u[m+1],us[m];
	rep(i,n+m){cin>>a[i];}
	int cnt=0,sm=0;
	memset(u,-1,sizeof(u));
	memset(us,0,sizeof(us));
	a[n+m]=INF;u[m]=n+m;
	rep(i,n+m) {
		cin >> b[i];
		if(b[i]) u[cnt++]=i;
		if(u[0]==-1) us[0]++;
	}
	cnt=0;
	repl(i,u[0]+1,n+m) {
		if(!b[i]) {
			if(a[i]-a[u[cnt]]<=a[u[cnt+1]]-a[i]) {
				us[cnt]++;
			} else {
				us[cnt+1]++;
			}
		} else cnt++;
	}
	rep(i,m) {
		cout << us[i] << " ";
	}
    return 0;
}


/*input
1 4
2 4 6 10 15
1 1 1 1 0
*/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>

using namespace std;

int GCD(int x,int y){return y?GCD(y,x%y):x;}
#define ain(a,n) int a[(n)];for(int i=0;i<(n);i++)scanf("%d",a[i]);
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,a,b) for(int i=(a);i<(b);i++)
#define repm(i,a,b) for(int i=(a);i>(b);i--)
const int INF = 1<<30;
typedef long long ll;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	int a[n+m+1],b[n+m],u[m+1],us[m];
	rep(i,n+m){cin>>a[i];}
	int cnt=0,sm=0;
	memset(u,-1,sizeof(u));
	memset(us,0,sizeof(us));
	a[n+m]=INF;u[m]=n+m;
	rep(i,n+m) {
		cin >> b[i];
		if(b[i]) u[cnt++]=i;
		if(u[0]==-1) us[0]++;
	}
	cnt = 0;
	repl(i,u[0]+1,n+m) {
		if(!b[i]) {
			int d1=a[i]-a[u[cnt]],d2=a[u[cnt+1]]-a[i];
			if(d1<=d2) {
				us[cnt]++;
			} else {
				us[cnt+1]++;
			}
		} else cnt++;
	}
	rep(i,m) {
		cout << us[i] << " ";
	}
    return 0;
}


/*input
1 4
2 4 6 10 15
1 1 1 1 0
*/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>

using namespace std;

int GCD(int x,int y){return y?GCD(y,x%y):x;}
#define ain(a,n) int a[(n)];for(int i=0;i<(n);i++)scanf("%d",a[i]);
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,a,b) for(int i=(a);i<(b);i++)
#define repm(i,a,b) for(int i=(a);i>(b);i--)
const int INF = 1000000006;
typedef long long ll;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	int a[n+m+1],b[n+m],u[m+1],us[m];
	rep(i,n+m){cin>>a[i];}
	int cnt=0,sm=0;
	memset(u,-1,sizeof(u));
	memset(us,0,sizeof(us));
	a[n+m]=INF;u[m]=n+m;
	rep(i,n+m) {
		cin >> b[i];
		if(b[i]) u[cnt++]=i;
		if(u[0]==-1) us[0]++;
	}
	cnt = 0;
	repl(i,u[0]+1,n+m) {
		if(!b[i]) {
			int d1=a[i]-a[u[cnt]],d2=a[u[cnt+1]]-a[i];
			if(d1<=d2) {
				us[cnt]++;
			} else {
				us[cnt+1]++;
			}
		} else cnt++;
	}
	rep(i,m) {
		cout << us[i] << " ";
	}
    return 0;
}


/*input
10 1
1 2 3 4 5 6 7 8 9 10 1000000000
0 0 0 0 0 0 0 0 0 1 0
*/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>

using namespace std;

int GCD(int x,int y){return y?GCD(y,x%y):x;}
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,a,b) for(int i=(a);i<(b);i++)
#define repm(i,a,b) for(int i=(a);i>(b);i--)
const int INF = 2000000006;
typedef long long ll;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	int a[n+m],b[n+m],u[m],us[m];
	rep(i,n+m){cin>>a[i];}
	int cnt=0,sm=0;
	memset(u,-1,sizeof(u));
	memset(us,0,sizeof(us));
	rep(i,n+m) {
		cin >> b[i];
		if(b[i]) u[cnt++]=i;
		if(u[0]==-1) us[0]++;
	}
	cnt=0;
	repl(i,u[0]+1,u[m-1]) {
		if(!b[i]) {
			if(a[i]-a[u[cnt]]<=a[u[cnt+1]]-a[i]) {
				us[cnt]++;
			} else {
				us[cnt+1]++;
			}
		} else cnt++;
	}
	us[m-1]+=n-u[m-1];
	rep(i,m) {
		cout << us[i] << " ";
	}
    return 0;
}


/*input
3 2
2 3 4 5 6
1 0 0 0 1
*/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>

using namespace std;

int GCD(int x,int y){return y?GCD(y,x%y):x;}
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,a,b) for(int i=(a);i<(b);i++)
#define repm(i,a,b) for(int i=(a);i>(b);i--)
const int INF = 2000000006;
typedef long long ll;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	int a[n+m],b[n+m],u[m],us[m];
	rep(i,n+m){cin>>a[i];}
	int cnt=0,sm=0;
	memset(u,-1,sizeof(u));
	memset(us,0,sizeof(us));
	rep(i,n+m) {
		cin >> b[i];
		if(b[i]) u[cnt++]=i;
		if(u[0]==-1) us[0]++;
	}
	cnt=0;
	repl(i,u[0]+1,u[m-1]) {
		if(!b[i]) {
			if(a[i]-a[u[cnt]]<=a[u[cnt+1]]-a[i]) {
				us[cnt]++;
			} else {
				us[cnt+1]++;
			}
		} else cnt++;
	}
	us[m-1]+=n+m-u[m-1]-1;
	rep(i,m) {
		cout << us[i] << " ";
	}
    return 0;
}


/*input
4 1
2 4 6 10 15
0 0 0 0 1
*/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>

using namespace std;

int GCD(int x,int y){return y?GCD(y,x%y):x;}
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,a,b) for(int i=(a);i<(b);i++)
#define repm(i,a,b) for(int i=(a);i>(b);i--)
const int INF = 1000000006;
typedef long long ll;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	int a[n+m+1+6],b[n+m+6],u[m+1+6],us[m+6];
	rep(i,n+m){cin>>a[i];}
	int cnt=0,sm=0;
	memset(u,-1,sizeof(u));
	memset(us,0,sizeof(us));
	a[n+m]=INF;u[m]=n+m;
	rep(i,n+m) {
		cin >> b[i];
		if(b[i]) u[cnt++]=i;
		if(u[0]==-1) us[0]++;
	}
	cnt=0;
	repl(i,u[0]+1,n+m) {
		if(!b[i]) {
			if(a[i]-a[u[cnt]]<=a[u[cnt+1]]-a[i]) {
				us[cnt]++;
			} else {
				us[cnt+1]++;
			}
		} else cnt++;
	}
	rep(i,m) {
		cout << us[i] << " ";
	}
    return 0;
}


/*input
4 1
2 4 6 10 15
0 0 0 0 1
*/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>

using namespace std;

int GCD(int x,int y){return y?GCD(y,x%y):x;}
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,a,b) for(int i=(a);i<(b);i++)
#define repm(i,a,b) for(int i=(a);i>(b);i--)
const int INF = 1000000006;
typedef long long ll;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	int a[n+m+1+6],b[n+m+6],u[m+1+6],us[m+5];
	rep(i,n+m){cin>>a[i];}
	int cnt=0,sm=0;
	memset(u,-1,sizeof(u));
	memset(us,0,sizeof(us));
	a[n+m]=INF;u[m]=n+m;
	rep(i,n+m) {
		cin >> b[i];
		if(b[i]) u[cnt++]=i;
		if(u[0]==-1) us[0]++;
	}
	cnt=0;
	repl(i,u[0]+1,n+m) {
		if(!b[i]) {
			if(a[i]-a[u[cnt]]<=a[u[cnt+1]]-a[i]) {
				us[cnt]++;
			} else {
				us[cnt+1]++;
			}
		} else cnt++;
	}
	rep(i,m) {
		cout << us[i] << " ";
	}
    return 0;
}


#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<iomanip>
#include<vector>
#include<map>
using namespace std;
int n, m, a[100009], b[100009], ans = -1, c[100009], ansr;
int ali(int j) {
	int anss = 0;
	for (int i = j + 1; i < n + m; i++) {
		if (b[i])break;
		if (i == n + m - 1) {
			anss++;
			break;
		}
		if (c[i] > c[i - 1]) {
			anss++;
			b[i] = 2;
		}
	}
	for (int i = j - 1; i >= 0; i--) {
		if (b[i])break;
		if (i == 0) {
			anss++;
			break;
		}
		if (c[i] > c[i + 1]) {
			anss++;
			b[i] = 2;
		}
	}
	return anss;
}
int main() {
	cin >> n >> m;
	for (int i = 0; i < n + m; i++)
		cin >> a[i];
	for (int i = 0; i < n + m; i++)
		cin >> b[i];
	for (int i = 0; i < n + m; i++) {
		if (b[i] == 1) {
			ans = 0;
		}
		else if (ans != -1) {
			ans += (a[i] - a[i - 1]);
			c[i] = ans;
		}
	}
	ans = -1;
	for (int i = n + m - 1; i >= 0; i--) {
		if (b[i] == 1) {
			ans = 0;
		}
		else if (ans != -1) {
			ans += (a[i + 1] - a[i]);
			if (c[i] > ans || c[i] == 0) {
				c[i] = ans;
			}
			else ans -= (a[i] - a[i + 1]);
		}
	}
	for (int i = 0; i < n + m; i++) {
		if (b[i] == 1) {
			cout << ali(i) << " ";
		}
	}
}


#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<iomanip>
#include<vector>
#include<map>
using namespace std;
int n, m, a[200009], b[200009], ans = -1, c[200009], ansr;
int ali(int j) {
	int anss = 0;
	for (int i = j + 1; i < n + m; i++) {
		if (b[i])break;
		if (i == n + m - 1) {
			anss++;
			break;
		}
		if (c[i] > c[i - 1]) {
			anss++;
			b[i] = 2;
		}
	}
	for (int i = j - 1; i >= 0; i--) {
		if (b[i])break;
		if (i == 0) {
			anss++;
			break;
		}
		if (c[i] > c[i + 1]) {
			anss++;
			b[i] = 2;
		}
	}
	return anss;
}
int main() {
	cin >> n >> m;
	for (int i = 0; i < n + m; i++)
		cin >> a[i];
	for (int i = 0; i < n + m; i++)
		cin >> b[i];
	for (int i = 0; i < n + m; i++) {
		if (b[i] == 1) {
			ans = 0;
		}
		else if (ans != -1) {
			ans += (a[i] - a[i - 1]);
			c[i] = ans;
		}
	}
	ans = -1;
	for (int i = n + m - 1; i >= 0; i--) {
		if (b[i] == 1) {
			ans = 0;
		}
		else if (ans != -1) {
			ans += (a[i + 1] - a[i]);
			if (c[i] > ans || c[i] == 0) {
				c[i] = ans;
			}
			else ans -= (a[i] - a[i + 1]);
		}
	}
	for (int i = 0; i < n + m; i++) {
		if (b[i] == 1) {
			cout << ali(i) << " ";
		}
	}
}


#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<iomanip>
#include<vector>
#include<map>
using namespace std;
int n, m, a[200009], b[200009], ans = -1, c[200009], ansr;
int ali(int j) {
	int anss = 0;
	for (int i = j + 1; i < n + m; i++) {
		if (b[i])break;
		if (i == n + m - 1) {
			anss++;
			break;
		}
		if (c[i] > c[i - 1]) {
			anss++;
			b[i] = 2;
		}
	}
	for (int i = j - 1; i >= 0; i--) {
		if (b[i])break;
		if (i == 0) {
			anss++;
			break;
		}
		if (c[i] > c[i + 1]) {
			anss++;
			b[i] = 2;
		}
	}
	return anss;
}
int main() {
	cin >> n >> m;
	for (int i = 0; i < n + m; i++)
		cin >> a[i];
	for (int i = 0; i < n + m; i++)
		cin >> b[i];
	for (int i = 0; i < n + m; i++) {
		if (b[i] == 1) {
			ans = 0;
		}
		else if (ans != -1) {
			ans += (a[i] - a[i - 1]);
			c[i] = ans;
		}
	}
	ans = -1;
	for (int i = n + m - 1; i >= 0; i--) {
		if (b[i] == 1) {
			ans = 0;
		}
		else if (ans != -1) {
			ans += (a[i + 1] - a[i]);
			if (c[i] > ans || c[i] == 0) {
				c[i] = ans;
			}
		}
	}
	for (int i = 0; i < n + m; i++) {
		if (b[i] == 1) {
			cout << ali(i) << " ";
		}
	}
}


#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<iomanip>
#include<vector>
#include<map>
using namespace std;
int n, m, a[200009], b[200009], ans = -1, c[200009], ansr;
int ali(int j) {
	int anss = 0;
	for (int i = j + 1; i < n + m; i++) {
		if (b[i])break;
		if (i == n + m - 1) {
			anss++;
			break;
		}
		if (c[i] > c[i - 1] && (a[i] - a[j] <= c[i])) {
			anss++;
			b[i] = 2;
		}
	}
	for (int i = j - 1; i >= 0; i--) {
		if (b[i])break;
		if (i == 0) {
			anss++;
			break;
		}
		if (c[i] > c[i + 1] && (a[j] - a[i] <= c[i])) {
			anss++;
			b[i] = 2;
		}
	}
	return anss;
}
int main() {
	cin >> n >> m;
	for (int i = 0; i < n + m; i++)
		cin >> a[i];
	for (int i = 0; i < n + m; i++)
		cin >> b[i];
	for (int i = 0; i < n + m; i++) {
		if (b[i] == 1) {
			ans = 0;
		}
		else if (ans != -1) {
			ans += (a[i] - a[i - 1]);
			c[i] = ans;
		}
	}
	ans = -1;
	for (int i = n + m - 1; i >= 0; i--) {
		if (b[i] == 1) {
			ans = 0;
		}
		else if (ans != -1) {
			ans += (a[i + 1] - a[i]);
			if (c[i] > ans || c[i] == 0) {
				c[i] = ans;
			}
		}
	}
	for (int i = 0; i < n + m; i++) {
		if (b[i] == 1) {
			cout << ali(i) << " ";
		}
	}
}


#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<iomanip>
#include<vector>
#include<map>
using namespace std;
int n, m, a[200009], b[200009], ans = -1, c[200009], ansr;
int ali(int j) {
	int anss = 0;
	for (int i = j + 1; i < n + m; i++) {
		if (b[i])break;
		if (i == n + m - 1) {
			anss++;
			break;
		}
		if (c[i] > c[i - 1]) {
			anss++;
			b[i] = 2;
		}
	}
	for (int i = j - 1; i >= 0; i--) {
		if (b[i])break;
		if (i == 0) {
			anss++;
			break;
		}
		if (c[i] > c[i + 1]) {
			anss++;
			b[i] = 2;
		}
	}
	return anss;
}
int main() {
	cin >> n >> m;
	for (int i = 0; i < n + m; i++)
		cin >> a[i];
	for (int i = 0; i < n + m; i++)
		cin >> b[i];
	for (int i = 0; i < n + m; i++) {
		if (b[i] == 1) {
			ans = 0;
		}
		else if (ans != -1) {
			ans += (a[i] - a[i - 1]);
			c[i] = ans;
		}
	}
	ans = -1;
	for (int i = n + m - 1; i >= 0; i--) {
		if (b[i] == 1) {
			ans = 0;
		}
		else if (ans != -1) {
			ans += (a[i + 1] - a[i]);
			if (c[i] > ans || c[i] == 0) {
				c[i] = ans;
			}
			else ans -= (a[i + 1] - a[i]);
		}
	}
	for (int i = 0; i < n + m; i++) {
		if (b[i] == 1) {
			cout << ali(i) << " ";
		}
	}
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
const int INF=2e9+7;
int cor[maxn];
int typ[maxn];
int ans[maxn];
map<int,int> Map;
int has[maxn],tot;
int main(int argc, char** argv)
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n+m;i++)
        scanf("%d",&cor[i]);
    cor[0]=-INF;
    has[++tot]=cor[0];

    for(int i=1;i<=n+m;i++)
    {
        scanf("%d",&typ[i]);
        if(typ[i]==1)
        {
            has[++tot]=cor[i];
            Map[cor[i]]=i;
        }
    }
    cor[n+1+m]=INF;
    has[++tot]=INF;
    for(int i=1;i<=n+m;i++)
    {
        if(typ[i]==0)
        {
            int tmp1=*(lower_bound(has+1,has+1+tot,cor[i])-1);
            int tmp2=*lower_bound(has+1,has+1+tot,cor[i]);
            if(cor[i]-tmp1<=tmp2-cor[i])
                ans[Map[tmp1]]++;
            else
                ans[Map[tmp2]]++;
        }
    }
    for(int i=1;i<=n+m;i++)
    {
        if(typ[i]==1)
        {
            printf("%d ",ans[i]);
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
const int INF=2e10+7;
int cor[maxn];
int typ[maxn];
int ans[maxn];
map<int,int> Map;
int has[maxn],tot;
int main(int argc, char** argv)
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n+m;i++)
        scanf("%d",&cor[i]);
    cor[0]=-INF;
    has[++tot]=cor[0];

    for(int i=1;i<=n+m;i++)
    {
        scanf("%d",&typ[i]);
        if(typ[i]==1)
        {
            has[++tot]=cor[i];
            Map[cor[i]]=i;
        }
    }
    cor[n+1+m]=INF;
    has[++tot]=INF;
    for(int i=1;i<=n+m;i++)
    {
        if(typ[i]==0)
        {
            int tmp1=*(lower_bound(has+1,has+1+tot,cor[i])-1);
            int tmp2=*lower_bound(has+1,has+1+tot,cor[i]);
            if(cor[i]-tmp1<=tmp2-cor[i])
                ans[Map[tmp1]]++;
            else
                ans[Map[tmp2]]++;
        }
    }
    for(int i=1;i<=n+m;i++)
    {
        if(typ[i]==1)
        {
            printf("%d ",ans[i]);
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
const int INF=2e9+7;
int cor[maxn];
int typ[maxn];
int ans[maxn];
map<int,int> Map;
int has[maxn],tot;
int main(int argc, char** argv)
{
    int n,m;scanf("%d%d",&n,&m);
    for(int i=1;i<=n+m;i++)
        scanf("%d",&cor[i]);
    cor[0]=-INF;
    has[++tot]=cor[0];

    for(int i=1;i<=n+m;i++)
    {
        scanf("%d",&typ[i]);
        if(typ[i]==1)
        {
            has[++tot]=cor[i];
            Map[cor[i]]=i;
        }
    }
    cor[n+1+m]=INF;
    has[++tot]=INF;
    for(int i=1;i<=n+m;i++)
    {
        if(typ[i]==0)
        {
            int tmp1=*(lower_bound(has+1,has+1+tot,cor[i])-1);
            int tmp2=*lower_bound(has+1,has+1+tot,cor[i]);
            if(cor[i]-tmp1<=tmp2-cor[i])
                ans[Map[tmp1]]++;
            else
                ans[Map[tmp2]]++;
        }
    }
    for(int i=1;i<=n+m;i++)
    {
        if(typ[i]==1)
        {
            printf("%d ",ans[i]);
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
const ll INF=2e10+7;
ll cor[maxn];
int typ[maxn];
int ans[maxn];
map<int,int> Map;
ll has[maxn],tot;
int main(int argc, char** argv)
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n+m;i++)
        scanf("%lld",&cor[i]);
    cor[0]=-INF;
    has[++tot]=cor[0];

    for(int i=1;i<=n+m;i++)
    {
        scanf("%d",&typ[i]);
        if(typ[i]==1)
        {
            has[++tot]=cor[i];
            Map[cor[i]]=i;
        }
    }
    cor[n+1+m]=INF;
    has[++tot]=INF;
    for(int i=1;i<=n+m;i++)
    {
        if(typ[i]==0)
        {
            ll tmp1=*(lower_bound(has+1,has+1+tot,cor[i])-1);
            ll tmp2=*lower_bound(has+1,has+1+tot,cor[i]);
            if(cor[i]-tmp1<=tmp2-cor[i])
                ans[Map[tmp1]]++;
            else
                ans[Map[tmp2]]++;
        }
    }
    for(int i=1;i<=n+m;i++)
    {
        if(typ[i]==1)
        {
            printf("%d ",ans[i]);
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, m, i, a;
    cin>>n>>m;
    vector<int>v(n+m);
    vector<int>taxi;
    vector<int>riders;
    for(i=0;i<n+m;++i)cin>>v[i];
    for(i=0;i<n+m;++i){
        cin>>a;
        if(a)taxi.push_back(v[i]);
        else riders.push_back(v[i]);
    }
    sort(taxi.begin(), taxi.end());
    vector<int>call(m, 0);
    for(i=0;i<n;++i){
        int j = 0;
        while(j<m && riders[i]<taxi[j])++j;
        if(j == m)++call[j-1];
        else if(j == 0)++call[0];
        else{
            if((riders[i] - taxi[j-1]) <= (taxi[j] - riders[i]))++call[j-1];
            else ++call[j];
        }
    }
    for(int x:call)cout<<x<<" ";
    cout<<"\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, m, i, a;
    cin>>n>>m;
    vector<int>v(n+m);
    vector<int>taxi;
    vector<int>riders;
    for(i=0;i<n+m;++i)cin>>v[i];
    for(i=0;i<n+m;++i){
        cin>>a;
        if(a)taxi.push_back(v[i]);
        else riders.push_back(v[i]);
    }
    sort(taxi.begin(), taxi.end());
    vector<int>call(m, 0);
    for(i=0;i<n;++i){
        int j = 0;
        while(j<m && riders[i]>taxi[j])++j;
        if(j == m)++call[j-1];
        else if(j == 0)++call[0];
        else{
            if((riders[i] - taxi[j-1]) <= (taxi[j] - riders[i]))++call[j-1];
            else ++call[j];
        }
    }
    for(int x:call)cout<<x<<" ";
    cout<<"\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, m, i, a;
    cin>>n>>m;
    vector<int>v(n+m);
    vector<int>taxi;
    vector<int>riders;
    for(i=0;i<n+m;++i)cin>>v[i];
    for(i=0;i<n+m;++i){
        cin>>a;
        if(a)taxi.push_back(v[i]);
        else riders.push_back(v[i]);
    }
    sort(taxi.begin(), taxi.end());
    vector<int>call(m, 0);
    for(i=0;i<n;++i){
        int d = 1000000007, index=-1;
        for(int j=0;j<taxi.size();++j){
            if(d > abs(taxi[j] - riders[i])){
                d = abs(taxi[j] - riders[i]);
                index = j;
            }
        }
        ++call[index];
    }
    for(int x:call)cout<<x<<" ";
    cout<<"\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, m, i, a;
    cin>>n>>m;
    vector<int>v(n+m);
    vector<int>taxi;
    vector<int>riders;
    for(i=0;i<n+m;++i)cin>>v[i];
    for(i=0;i<n+m;++i){
        cin>>a;
        if(a)taxi.push_back(v[i]);
        else riders.push_back(v[i]);
    }
    sort(taxi.begin(), taxi.end());
    vector<int>call(m, 0);
    for(i=0;i<n;++i){
        int j = lower_bound(taxi.begin(), taxi.end(), riders[i]) - taxi.begin();
        if(j == m)++call[m-1];
        else if(j==0)++call[0];
        else{
            if(riders[i]-taxi[j-1] <= taxi[j]-riders[i])++call[j-1];
            else ++call[j];
        }
    }
    for(int x:call)cout<<x<<" ";
    cout<<"\n";
	return 0;
}


#include<cstdio>
#include<iostream>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include <iomanip>
#include <bits/stdc++.h>
#include <utility>

#define INF 2000000000
#define INF_LL 2000000000000000000ll
#define MOD_7 1000000007
#define MOD_9 1000000009
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long  ull;
typedef priority_queue<pii, vector<pii> ,greater < pii > > min_pq;
ll toint(const string &s) {stringstream ss; ss << s; ll x; ss >> x; return x;}
string tostring ( ll number ){stringstream ss; ss<< number; return ss.str();}
typedef tree<pii , null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> OST;

int gcd(int x,int y){
	if(y==0){
		return x;
	}
	return gcd(y,x%y);
}

ll lgcd(ll x, ll y){
	if(y==0){
		return x;
	}
	return lgcd(y,x%y);
}

ll pow(ll a, ll b ,ll m = MOD_7){
	ll res=1;
	while(b>0){
		if(b&1){
			res=(res*a)%m;
		}
		a=(a*a)%m;
		b>>=1;
	}
	return res;
}

ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1;
    ll gcd = gcdExtended(b%a, a, &x1, &y1);

    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(ll a, ll m=MOD_7)
{
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    ll res = (x%m + m) % m;
    return res;
}

bool comp1(int a,int b){
    return a>b;
}

bool comp2(pii &a,pii &b){
    if(a.first==b.first){
        return a.second<b.second;
    }

    return a.first<b.first;
}

#define N 200010

ll arr[N],t[N];

vector <ll> ind;

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,m,i,j;

	cin>>n>>m;

	for(i=0;i<n+m;i++){
	    cin>>arr[i];
	}

	for(i=0;i<n+m;i++){
	    cin>>t[i];
	    if(t[i]==1) ind.pb(i+1);
	}

	ll diff,right,left=ind[0]-1;
	for(i=0;i<ind.size()-1;i++){
	    diff=ind[i+1]-ind[i]-1;
	    if(diff)
	    right=diff/2+1;
	    else right=0;
	    //cout<<left<<"L "<<right<<"R\n";
	    cout<<left+right<<" ";
	    left=diff-right;
	}
	right=n+m-ind[ind.size()-1];
	cout<<left+right;

    return 0;
}


#include<cstdio>
#include<iostream>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include <iomanip>
#include <bits/stdc++.h>
#include <utility>

#define INF 2000000000
#define INF_LL 2000000000000000000ll
#define MOD_7 1000000007
#define MOD_9 1000000009
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long  ull;
typedef priority_queue<pii, vector<pii> ,greater < pii > > min_pq;
ll toint(const string &s) {stringstream ss; ss << s; ll x; ss >> x; return x;}
string tostring ( ll number ){stringstream ss; ss<< number; return ss.str();}
typedef tree<pii , null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> OST;

int gcd(int x,int y){
	if(y==0){
		return x;
	}
	return gcd(y,x%y);
}

ll lgcd(ll x, ll y){
	if(y==0){
		return x;
	}
	return lgcd(y,x%y);
}

ll pow(ll a, ll b ,ll m = MOD_7){
	ll res=1;
	while(b>0){
		if(b&1){
			res=(res*a)%m;
		}
		a=(a*a)%m;
		b>>=1;
	}
	return res;
}

ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1;
    ll gcd = gcdExtended(b%a, a, &x1, &y1);

    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(ll a, ll m=MOD_7)
{
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    ll res = (x%m + m) % m;
    return res;
}

bool comp1(int a,int b){
    return a>b;
}

bool comp2(pii &a,pii &b){
    if(a.first==b.first){
        return a.second<b.second;
    }

    return a.first<b.first;
}

#define N 200010

ll arr[N],t[N];

vector <ll> ind;

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,m,i,j;

	cin>>n>>m;

	for(i=0;i<n+m;i++){
	    cin>>arr[i];
	}

	for(i=0;i<n+m;i++){
	    cin>>t[i];
	    if(t[i]==1) ind.pb(i+1);
	}

	ll diff,val,left=ind[0]-1;
	for(i=0;i<ind.size()-1;i++){
	    diff=ind[i+1]-ind[i]-1;
	    val=(diff+1)/2;
	    //cout<<left<<"L "<<val<<"V\n";
	    cout<<left+val<<" ";
	    left=diff-val;
	}
	val=n+m-ind[ind.size()-1];
	cout<<left+val;

    return 0;
}


#include<cstdio>
#include<iostream>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include <iomanip>
#include <bits/stdc++.h>
#include <utility>

#define INF 2000000000
#define INF_LL 2000000000000000000ll
#define MOD_7 1000000007
#define MOD_9 1000000009
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long  ull;
typedef priority_queue<pii, vector<pii> ,greater < pii > > min_pq;
ll toint(const string &s) {stringstream ss; ss << s; ll x; ss >> x; return x;}
string tostring ( ll number ){stringstream ss; ss<< number; return ss.str();}
typedef tree<pii , null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> OST;

int gcd(int x,int y){
	if(y==0){
		return x;
	}
	return gcd(y,x%y);
}

ll lgcd(ll x, ll y){
	if(y==0){
		return x;
	}
	return lgcd(y,x%y);
}

ll pow(ll a, ll b ,ll m = MOD_7){
	ll res=1;
	while(b>0){
		if(b&1){
			res=(res*a)%m;
		}
		a=(a*a)%m;
		b>>=1;
	}
	return res;
}

ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1;
    ll gcd = gcdExtended(b%a, a, &x1, &y1);

    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(ll a, ll m=MOD_7)
{
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    ll res = (x%m + m) % m;
    return res;
}

bool comp1(int a,int b){
    return a>b;
}

bool comp2(pii &a,pii &b){
    if(a.first==b.first){
        return a.second<b.second;
    }

    return a.first<b.first;
}

#define N 200010

ll arr[N],t[N];

vector <ll> ind;

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,m,i,j;

	cin>>n>>m;

	for(i=0;i<n+m;i++){
	    cin>>arr[i];
	}

	for(i=0;i<n+m;i++){
	    cin>>t[i];
	    if(t[i]==1) ind.pb(i+1);
	}

	ll diff,right,left=ind[0]-1;
	for(i=0;i<ind.size()-1;i++){
	    diff=ind[i+1]-ind[i]-1;
	    right=diff/2+1;
	    //cout<<left<<"L "<<right<<"R\n";
	    cout<<left+right<<" ";
	    left=diff-right;
	}
	right=n+m-ind[ind.size()-1];
	cout<<left+right;

    return 0;
}


#include<cstdio>
#include<iostream>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include <iomanip>
#include <bits/stdc++.h>
#include <utility>

#define INF 2000000000
#define INF_LL 2000000000000000000ll
#define MOD_7 1000000007
#define MOD_9 1000000009
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long  ull;
typedef priority_queue<pii, vector<pii> ,greater < pii > > min_pq;
ll toint(const string &s) {stringstream ss; ss << s; ll x; ss >> x; return x;}
string tostring ( ll number ){stringstream ss; ss<< number; return ss.str();}
typedef tree<pii , null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> OST;

int gcd(int x,int y){
	if(y==0){
		return x;
	}
	return gcd(y,x%y);
}

ll lgcd(ll x, ll y){
	if(y==0){
		return x;
	}
	return lgcd(y,x%y);
}

ll pow(ll a, ll b ,ll m = MOD_7){
	ll res=1;
	while(b>0){
		if(b&1){
			res=(res*a)%m;
		}
		a=(a*a)%m;
		b>>=1;
	}
	return res;
}

ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1;
    ll gcd = gcdExtended(b%a, a, &x1, &y1);

    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(ll a, ll m=MOD_7)
{
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    ll res = (x%m + m) % m;
    return res;
}

bool comp1(int a,int b){
    return a>b;
}

bool comp2(pii &a,pii &b){
    if(a.first==b.first){
        return a.second<b.second;
    }

    return a.first<b.first;
}

#define N 200010

ll arr[N],t[N];

vector <ll> ind;

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,m,i,j;

	cin>>n>>m;

	for(i=0;i<n+m;i++){
	    cin>>arr[i];
	}

	for(i=0;i<n+m;i++){
	    cin>>t[i];
	    if(t[i]==1) ind.pb(i+1);
	}

	ll diff,right,left=ind[0]-1;
	for(i=0;i<ind.size()-1;i++){
	    diff=ind[i+1]-ind[i]-1;
	    right=(diff+1)/2;
	    //cout<<left<<"L "<<right<<"R\n";
	    cout<<left+right<<" ";
	    left=diff-right;
	}
	right=n+m-ind[ind.size()-1];
	cout<<left+right;

    return 0;
}


#include<cstdio>
#include<iostream>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include <iomanip>
#include <bits/stdc++.h>
#include <utility>

#define INF 2000000000
#define INF_LL 2000000000000000000ll
#define MOD_7 1000000007
#define MOD_9 1000000009
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long  ull;
typedef priority_queue<pii, vector<pii> ,greater < pii > > min_pq;
ll toint(const string &s) {stringstream ss; ss << s; ll x; ss >> x; return x;}
string tostring ( ll number ){stringstream ss; ss<< number; return ss.str();}
typedef tree<pii , null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> OST;

int gcd(int x,int y){
	if(y==0){
		return x;
	}
	return gcd(y,x%y);
}

ll lgcd(ll x, ll y){
	if(y==0){
		return x;
	}
	return lgcd(y,x%y);
}

ll pow(ll a, ll b ,ll m = MOD_7){
	ll res=1;
	while(b>0){
		if(b&1){
			res=(res*a)%m;
		}
		a=(a*a)%m;
		b>>=1;
	}
	return res;
}

ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1;
    ll gcd = gcdExtended(b%a, a, &x1, &y1);

    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(ll a, ll m=MOD_7)
{
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    ll res = (x%m + m) % m;
    return res;
}

bool comp1(int a,int b){
    return a>b;
}

bool comp2(pii &a,pii &b){
    if(a.first==b.first){
        return a.second<b.second;
    }

    return a.first<b.first;
}

#define N 200010

ll arr[N],t[N];

vector <ll> ind;
ll ans[N];

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,m,i,j;

	cin>>n>>m;

	for(i=0;i<n+m;i++){
	    cin>>arr[i];
	}

	for(i=0;i<n+m;i++){
	    cin>>t[i];
	    if(t[i]==1) ind.pb(i);
	}

	j=0;

	for(i=0;i<n+m;i++){
	    if(!t[i]){
	        if(j==m-1){
	            ans[ind[j]]++;
	        }
	        else{
	            while(j<m-1&&arr[i]-arr[ind[j]]>arr[ind[j+1]]-arr[i])
	              j++;
	            ans[ind[j]]++;
	        }
	    }
	}

	for(i=0;i<n+m;i++){
	    if(t[i]) cout<<ans[i]<<" ";
	}

    return 0;
}


#include<cstdio>
#include<iostream>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include <iomanip>
#include <bits/stdc++.h>
#include <utility>

#define INF 2000000000
#define INF_LL 2000000000000000000ll
#define MOD_7 1000000007
#define MOD_9 1000000009
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long  ull;
typedef priority_queue<pii, vector<pii> ,greater < pii > > min_pq;
ll toint(const string &s) {stringstream ss; ss << s; ll x; ss >> x; return x;}
string tostring ( ll number ){stringstream ss; ss<< number; return ss.str();}
typedef tree<pii , null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> OST;

int gcd(int x,int y){
	if(y==0){
		return x;
	}
	return gcd(y,x%y);
}

ll lgcd(ll x, ll y){
	if(y==0){
		return x;
	}
	return lgcd(y,x%y);
}

ll pow(ll a, ll b ,ll m = MOD_7){
	ll res=1;
	while(b>0){
		if(b&1){
			res=(res*a)%m;
		}
		a=(a*a)%m;
		b>>=1;
	}
	return res;
}

ll gcdExtended(ll a, ll b, ll *x, ll *y)
{
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    ll x1, y1;
    ll gcd = gcdExtended(b%a, a, &x1, &y1);

    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(ll a, ll m=MOD_7)
{
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    ll res = (x%m + m) % m;
    return res;
}

bool comp1(int a,int b){
    return a>b;
}

bool comp2(pii &a,pii &b){
    if(a.first==b.first){
        return a.second<b.second;
    }

    return a.first<b.first;
}

#define N 200010

int arr[N],t[N];

vector <int> ind;

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int n,m,i,j;

	cin>>n>>m;

	for(i=0;i<n+m;i++){
	    cin>>arr[i];
	}

	for(i=0;i<n+m;i++){
	    cin>>t[i];
	    if(t[i]==1) ind.pb(i+1);
	}
	ind.pb(n+m);

	int diff,val,left=ind[0]-1;
	for(i=0;i<ind.size()-1;i++){
	    diff=ind[i+1]-ind[i];
	    if(i!=ind.size()-2) val=diff/2;
	    else val=diff;
	    //cout<<left<<"L "<<val<<"V\n";
	    cout<<left+val<<" ";
	    left=diff-val-1;
	}

    return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <map>
#include <algorithm>
#include <stack>
#include <cstring>

#define ll long long
#define MP make_pair
#define PB push_back
#define P push
#define f first
#define se second
#define S size()
#define B begin()
#define E end()
#define PI acos(-1)
#define fscan1(n)  scanf("%d",&(n));
#define fscan2(n,m)  scanf("%d %d",&(n),&(m));
#define fscan3(n,m,k)  scanf("%d %d %d",&(n),&(m),&(k));
void read();

const int N = 1e5 + 100;
const int M = 2e5 + 100;
const ll oo = 1e18;

using namespace std;

bool taxi[N];
int ans[N];

int main() {

	//read();
	ll n, m;
	cin >> n >> m;
	vector<int>val(n + m);
	vector<pair<pair<int, int>, pair<int, int>>>v(n + m);
	for (int i = 0; i < n + m; i++) {
		cin >> val[i];
	}
	for (int o, i = 0; i < n + m; i++) {
		cin >> taxi[i];

	}
	int las = 1000000009;
	int ind = 1000000009;

	for (int i = 0; i < n + m; i++) {
		if (taxi[i]) {
			las = val[i];
			ind = i;
			continue;
		}
		v[i].first.first = abs(las - val[i]);
		v[i].first.second = ind;
		if (ind == 1000000009)v[i].first.first = 1000000009;
	}

	las = 1000000009;
	ind = 1000000009;

	for (int i = n + m - 1; i >= 0; i--) {
		if (taxi[i]) {
			las = val[i];
			ind = i;
			continue;
		}
		v[i].second.first = abs(las - val[i]);
		v[i].second.second = ind;
		if (ind == 1000000009)v[i].second.first = 1000000009;

	}

	for (int i = 0; i < n + m; i++) {
		if (taxi[i])continue;
		int dx = 1000000009;
		if (v[i].second.f < v[i].first.first)ans[v[i].second.second]++;
		else ans[v[i].f.se]++;

	}

	for (int i = 0; i < N; i++) {
		if (taxi[i])cout << ans[i] << " ";
	}

	return 0;
}

void read() {
	freopen("in.txt", "r", stdin);
	freopen("ou.txt", "w", stdout);
}


#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <map>
#include <algorithm>
#include <stack>
#include <cstring>

#define ll long long
#define MP make_pair
#define PB push_back
#define P push
#define f first
#define se second
#define S size()
#define B begin()
#define E end()
#define PI acos(-1)
#define fscan1(n)  scanf("%d",&(n));
#define fscan2(n,m)  scanf("%d %d",&(n),&(m));
#define fscan3(n,m,k)  scanf("%d %d %d",&(n),&(m),&(k));
void read();

const int N = 1e5 + 100;
const int M = 2e5 + 100;
const ll oo = 1e18;

using namespace std;

bool taxi[M];
int ans[M];

int main() {

	//read();
	ll n, m;
	cin >> n >> m;
	vector<int>v(M);
	vector<pair<int, int> >val(M);
	for (int i = 0; i < n + m; i++)cin >> v[i];
	for (int i = 0; i < n + m; i++)cin >> taxi[i];

	int las = -1;
	int dx = -1;
	for (int i = 0; i < n + m; i++) {
		if (taxi[i]) { las = v[i], dx = i; continue; }
		if (dx == -1)continue;
		val[i].f = abs(las - v[i]);
		val[i].se = dx;
	}

	las = -1;
	dx = -1;

	for (int i = n + m - 1; i >= 0; i--) {
		if (taxi[i]) { las = v[i], dx = i; continue; }
		if (dx == -1)continue;
		int u = abs(las - v[i]);
		if (u < val[i].f || val[i].first == 0)val[i].se = dx;
	}

	for (int i = 0; i < n + m; i++) {
		if (taxi[i])continue;
		ans[val[i].se]++;
	}

	for (int i = 0; i < n + m; i++) {
		if(taxi[i])cout << ans[i] << " ";
	}

	return 0;
}

void read() {
	freopen("in.txt", "r", stdin);
	freopen("ou.txt", "w", stdout);
}


#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <map>
#include <algorithm>
#include <stack>
#include <cstring>

#define ll long long
#define MP make_pair
#define PB push_back
#define P push
#define f first
#define se second
#define S size()
#define B begin()
#define E end()
#define PI acos(-1)
#define fscan1(n)  scanf("%d",&(n));
#define fscan2(n,m)  scanf("%d %d",&(n),&(m));
#define fscan3(n,m,k)  scanf("%d %d %d",&(n),&(m),&(k));
void read();

const int N = 1e5 + 100;
const int M = 2e5 + 100;
const ll oo = 1e18;

using namespace std;

bool taxi[N];
int ans[N];

int main() {

	//read();
	ll n, m;
	cin >> n >> m;
	vector<int>val(n + m);
	vector<pair<pair<int, int>, pair<int, int>>>v(n + m);
	for (int i = 0; i < n + m; i++) {
		cin >> val[i];
	}
	for (int o, i = 0; i < n + m; i++) {
		cin >> taxi[i];

	}
	int las = 1000000009;
	int ind = 1000000009;

	for (int i = 0; i < n + m; i++) {
		if (taxi[i]) {
			las = val[i];
			ind = i;
			continue;
		}
		v[i].first.first = abs(las - val[i]);
		v[i].first.second = ind;
	}

	las = 1000000009;
	ind = 1000000009;
	for (int i = n + m - 1; i >= 0; i--) {
		if (taxi[i]) {
			las = val[i];
			ind = i;
			continue;
		}
		v[i].second.first = abs(las - val[i]);
		v[i].second.second = ind;

	}

	for (int i = 0; i < n + m; i++) {
		if (taxi[i])continue;
		int dx = 1000000009;
		if (v[i].second.f < v[i].first.first)ans[v[i].second.second]++;
		else ans[v[i].f.se]++;

	}

	for (int i = 0; i < N; i++) {
		if (taxi[i])cout << ans[i] << " ";
	}

	return 0;
}

void read() {
	freopen("in.txt", "r", stdin);
	freopen("ou.txt", "w", stdout);
}


#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <map>
#include <algorithm>
#include <stack>
#include <cstring>

#define ll long long
#define MP make_pair
#define PB push_back
#define P push
#define f first
#define se second
#define S size()
#define B begin()
#define E end()
#define PI acos(-1)
#define fscan1(n)  scanf("%d",&(n));
#define fscan2(n,m)  scanf("%d %d",&(n),&(m));
#define fscan3(n,m,k)  scanf("%d %d %d",&(n),&(m),&(k));
void read();

const int N = 1e5 + 100;
const int M = 2e7 + 100;
const ll oo = 1e18;

using namespace std;

bool taxi[M];
int ans[M];

int main() {

	//read();
	ll n, m;
	cin >> n >> m;
	vector<int>v(N);
	vector<pair<int, int> >val(N);
	for (int i = 0; i < n + m; i++)cin >> v[i];
	for (int i = 0; i < n + m; i++)cin >> taxi[i];

	int las = -1;
	int dx = -1;
	for (int i = 0; i < n + m; i++) {
		if (taxi[i]) { las = v[i], dx = i; continue; }
		if (dx == -1)continue;
		val[i].f = abs(las - v[i]);
		val[i].se = dx;
	}

	las = -1;
	dx = -1;

	for (int i = n + m - 1; i >= 0; i--) {
		if (taxi[i]) { las = v[i], dx = i; continue; }
		if (dx == -1)continue;
		int u = abs(las - v[i]);
		if (u < val[i].f || val[i].first == 0)val[i].se = dx;
	}

	for (int i = 0; i < n + m; i++) {
		if (taxi[i])continue;
		ans[val[i].se]++;
	}

	for (int i = 0; i < n + m; i++) {
		if(taxi[i])cout << ans[i] << " ";
	}

	return 0;
}

void read() {
	freopen("in.txt", "r", stdin);
	freopen("ou.txt", "w", stdout);
}


#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <map>
#include <algorithm>
#include <stack>
#include <cstring>

#define ll long long
#define MP make_pair
#define PB push_back
#define P push
#define f first
#define se second
#define S size()
#define B begin()
#define E end()
#define PI acos(-1)
#define fscan1(n)  scanf("%d",&(n));
#define fscan2(n,m)  scanf("%d %d",&(n),&(m));
#define fscan3(n,m,k)  scanf("%d %d %d",&(n),&(m),&(k));
void read();

const int N = 1e5 + 100;
const int M = 2e5 + 100;
const ll oo = 1e18;

using namespace std;

bool taxi[N];
int ans[N];

int main() {

	//read();
	ll n, m;
	cin >> n >> m;
	vector<int>v(N);
	vector<pair<int, int> >val(N);
	for (int i = 0; i < n + m; i++)cin >> v[i];
	for (int i = 0; i < n + m; i++)cin >> taxi[i];

	int las = -1;
	int dx = -1;
	for (int i = 0; i < n + m; i++) {
		if (taxi[i]) { las = v[i], dx = i; continue; }
		if (dx == -1)continue;
		val[i].f = abs(las - v[i]);
		val[i].se = dx;
	}

	las = -1;
	dx = -1;

	for (int i = n + m - 1; i >= 0; i--) {
		if (taxi[i]) { las = v[i], dx = i; continue; }
		if (dx == -1)continue;
		int u = abs(las - v[i]);
		if (u < val[i].f || val[i].first == 0)val[i].se = dx;
	}

	for (int i = 0; i < n + m; i++) {
		if (taxi[i])continue;
		ans[val[i].se]++;
	}

	for (int i = 0; i < n + m; i++) {
		if(taxi[i])cout << ans[i] << " ";
	}

	return 0;
}

void read() {
	freopen("in.txt", "r", stdin);
	freopen("ou.txt", "w", stdout);
}


#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <map>
#include <algorithm>
#include <stack>
#include <cstring>

#define ll long long
#define MP make_pair
#define PB push_back
#define P push
#define f first
#define se second
#define S size()
#define B begin()
#define E end()
#define PI acos(-1)
#define fscan1(n)  scanf("%d",&(n));
#define fscan2(n,m)  scanf("%d %d",&(n),&(m));
#define fscan3(n,m,k)  scanf("%d %d %d",&(n),&(m),&(k));
void read();

const int N = 1e5 + 100;
const int M = 2e5 + 100;
const ll oo = 1e18;

using namespace std;

bool taxi[N];
int ans[N];

int main() {

	//read();
	ll n, m;
	cin >> n >> m;
	vector<int>val(n + m);
	vector<pair<pair<int, int>, pair<int, int>>>v(n + m);
	for (int i = 0; i < n + m; i++) {
		cin >> val[i];
	}
	for (int o, i = 0; i < n + m; i++) {
		cin >> taxi[i];

	}
	int las = 1000000009;
	int ind = 1000000009;

	for (int i = 0; i < n + m; i++) {
		if (taxi[i]) {
			las = val[i];
			ind = i;
			continue;
		}
		v[i].first.first = abs(las - val[i]);
		v[i].first.second = ind;
		if (ind == 1000000009)v[i].first.first = 1000000009;
	}

	las = 1000000009;
	ind = 1000000009;

	for (int i = n + m - 1; i >= 0; i--) {
		if (taxi[i]) {
			las = val[i];
			ind = i;
			continue;
		}
		v[i].second.first = abs(las - val[i]);
		v[i].second.second = ind;
		if (ind == 1000000009)v[i].second.first = 1000000009;

	}

	for (int i = 0; i < n + m; i++) {
		if (taxi[i])continue;
		int dx = 1000000009;
		if (v[i].second.f > 100005) {
			if(v[i].first.f < 100005)ans[v[i].f.se]++;
			continue;
		}
		if (v[i].first.f > 100005) {
			if(v[i].second.f < 100005)ans[v[i].second.second]++;
			continue;
		}
		if (v[i].second.f < v[i].first.first)ans[v[i].second.second]++;
		else ans[v[i].f.se]++;

	}

	for (int i = 0; i < N; i++) {
		if (taxi[i])cout << ans[i] << " ";
	}

	return 0;
}

void read() {
	freopen("in.txt", "r", stdin);
	freopen("ou.txt", "w", stdout);
}


#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <map>
#include <algorithm>
#include <stack>
#include <cstring>

#define ll long long
#define MP make_pair
#define PB push_back
#define P push
#define f first
#define se second
#define S size()
#define B begin()
#define E end()
#define PI acos(-1)
#define fscan1(n)  scanf("%d",&(n));
#define fscan2(n,m)  scanf("%d %d",&(n),&(m));
#define fscan3(n,m,k)  scanf("%d %d %d",&(n),&(m),&(k));
void read();

const int N = 1e5 + 100;
const int M = 2e5 + 100;
const ll oo = 1e18;

using namespace std;

bool taxi[N];
int ans[N];

int main() {

	//read();
	ll n, m;
	cin >> n >> m;
	vector<int>v(n + m);
	vector<pair<int, int> >val(n + m);
	for (int i = 0; i < n + m; i++)cin >> v[i];
	for (int i = 0; i < n + m; i++)cin >> taxi[i];

	int las = -1;
	int dx = -1;
	for (int i = 0; i < n + m; i++) {
		if (taxi[i]) { las = v[i], dx = i; continue; }
		if (dx == -1)continue;
		val[i].f = abs(las - v[i]);
		val[i].se = dx;
	}

	las = -1;
	dx = -1;

	for (int i = n + m - 1; i >= 0; i--) {
		if (taxi[i]) { las = v[i], dx = i; continue; }
		if (dx == -1)continue;
		int u = abs(las - v[i]);
		if (u < val[i].f || val[i].first == 0)val[i].se = dx;
	}

	for (int i = 0; i < n + m; i++) {
		if (taxi[i])continue;
		ans[val[i].se]++;
	}

	for (int i = 0; i < n + m; i++) {
		if(taxi[i])cout << ans[i] << " ";
	}

	return 0;
}

void read() {
	freopen("in.txt", "r", stdin);
	freopen("ou.txt", "w", stdout);
}


#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <map>
#include <algorithm>
#include <stack>
#include <cstring>

#define ll long long
#define MP make_pair
#define PB push_back
#define P push
#define f first
#define se second
#define S size()
#define B begin()
#define E end()
#define PI acos(-1)
#define fscan1(n)  scanf("%d",&(n));
#define fscan2(n,m)  scanf("%d %d",&(n),&(m));
#define fscan3(n,m,k)  scanf("%d %d %d",&(n),&(m),&(k));
void read();

const int N = 1e5 + 100;
const int M = 2e5 + 100;
const ll oo = 1e18;

using namespace std;

bool taxi[N];
int ans[N];

int main() {

	//read();
	ll n, m;
	cin >> n >> m;
	vector<int>val(n + m);
	vector<pair<pair<int,int>,pair<int,int>>>v(n + m);
	for (int i = 0; i < n + m; i++) {
		cin >> val[i];
	}
	for (int o,i = 0; i < n + m; i++) {
		cin >> taxi[i];

	}
	int las = N;
	int ind = N;

	for (int i = 0; i < n + m; i++) {
		if (taxi[i]) {
			las = val[i];
			ind = i;
			continue;
		}
		v[i].first.first = abs(las - val[i]);
		v[i].first.second = ind;
	}

	las = N;
	ind = N;
	for (int i = n + m - 1; i >= 0; i--) {
		if (taxi[i]) {
			las = val[i];
			ind = i;
			continue;
		}
		v[i].second.first = abs(las - val[i]);
		v[i].second.second = ind;

	}

	for (int i = 0; i < n + m; i++) {
		if (taxi[i])continue;
		int dx = N;
		if (v[i].second.f < v[i].first.first)ans[v[i].second.second]++;
		else ans[v[i].f.se]++;

	}

	for (int i = 0; i < N; i++) {
		if (taxi[i])cout << ans[i] << " ";
	}

	return 0;
}

void read() {
	freopen("in.txt", "r", stdin);
	freopen("ou.txt", "w", stdout);
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

#define N 100000
#define all(v) (v).begin(), (v).end()
#define mp make_pair
#define PI 3.1415926535
#define pb push_back
#define ll long long
#define eb emplace_back
#define inf 10000000
#define fi first
#define se second
#define fori(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define pii pair<int, int>
#define pll pair<long long, long long>

using namespace std;

int main(){

    int n, m;
    cin >> n >> m;

    vector<int> w;

    for (int i = 0; i < n + m; i++){
        int x;
        cin >> x;
        w.pb(x);
    }

    vector<int> t;
    vector<int> v;
    for (int i = 0; i < n + m; i++){
        int x;
        cin >> x;
        if (x == 1) {
            t.pb(w[i]);
        }else
            v.pb(w[i]);
    }

    sort(all(v));
    sort(all(t));

    vector<int> ans;
    for (int i = 0; i < m - 1; i++){
        ans.pb(t[i] + (t[i + 1] - t[i])/2 + (t[i + 1] - t[i]) % 2);
//        cout << (t[i + 1] + t[i]) << " ";
    }

    ans.pb(v[n - 1] + 1);

    int count = 0;
    vector<int> a;
    int j = 0;

    for (int i = 0; i < n; i++){
        if (v[i] <= ans[j]){
            count++;
        }else{
            a.pb(count);
            j++;
            while (j < m - 1 && v[i] > ans[j]){
                j++;
                a.pb(0);
            }
            if (j == m - 1){
                a.pb(n - i);
                break;
            }
            count = 0;
        }
    }

    if (a.size() != m )
        a.pb(count);

    for (int i : a)
        cout << i << " ";

    return 0;

}


#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

#define N 100000
#define all(v) (v).begin(), (v).end()
#define mp make_pair
#define PI 3.1415926535
#define pb push_back
#define ll long long
#define eb emplace_back
#define inf 10000000
#define fi first
#define se second
#define fori(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define pii pair<int, int>
#define pll pair<long long, long long>

using namespace std;

int main(){

    cin.tie();
    cout.tie();
    ios::sync_with_stdio(0);

    int n, m;
    cin >> n >> m;

    vector<ll> w;

    for (int i = 0; i < n + m; i++){
        ll x;
        cin >> x;
        w.pb(x);
    }

    vector<ll> t;
    vector<ll> v;
    for (int i = 0; i < n + m; i++){
        int x;
        cin >> x;
        if (x == 1) {
            t.pb(w[i]);
        }else
            v.pb(w[i]);
    }

    sort(all(v));
    sort(all(t));

    vector<ll> ans;
    for (int i = 0; i < m - 1; i++){
        ans.pb(t[i] + (t[i + 1] - t[i])/2 + (t[i + 1] - t[i]) % 2);
    }

    ans.pb(v[n - 1] + 1);

    ll count = 0;
    vector<ll> a;
    int j = 0;

    for (int i = 0; i < n; i++){
        if (v[i] <= ans[j]){
            count++;
        }else{
            a.pb(count);
            j++;
            if (j == m - 1){
                a.pb(n - i);
                break;
            }
            i--;
            count = 0;
        }
    }

    if (a.size() != m)
        a.pb(count);

    for (ll i : a)
        cout << i << " ";

    return 0;

}


#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

#define N 100000
#define all(v) (v).begin(), (v).end()
#define mp make_pair
#define PI 3.1415926535
#define pb push_back
#define ll long long
#define eb emplace_back
#define inf 10000000
#define fi first
#define se second
#define fori(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define pii pair<int, int>
#define pll pair<long long, long long>

using namespace std;

int main(){

    cin.tie();
    cout.tie();
    ios::sync_with_stdio(0);

    int n, m;
    cin >> n >> m;

    vector<ll> w;

    for (int i = 0; i < n + m; i++){
        ll x;
        cin >> x;
        w.pb(x);
    }

    vector<pair<ll, int>> t;
    vector<ll> v;
    int l = 0;
    for (int i = 0; i < n + m; i++){
        int x;
        cin >> x;
        if (x == 1) {
            t.pb(mp(w[i], l));
            l++;
        }else
            v.pb(w[i]);
    }

    sort(all(v));
    sort(all(t));

    vector<ll> ans;
    for (int i = 0; i < m - 1; i++){
        ans.pb(t[i].fi + (t[i + 1].fi - t[i].fi)/2 + (t[i + 1].fi - t[i].fi) % 2);
    }

    ans.pb(v[n - 1] + 1);

    ll count = 0;
    vector<pair<int, ll>> a;
    int j = 0;

    for (int i = 0; i < n; i++){
        if (v[i] <= ans[j]){
            count++;
        }else{
            a.pb(mp(t[j].second, count));
            j++;
            if (j == m - 1){
                a.pb(mp(t[j].second, n - i));
                break;
            }
            i--;
            count = 0;
        }
    }

    if (a.size() != m)
        a.pb(mp(t[j].second, count));

    while (a.size() != m)
        a.pb(mp(0, 0));

    for (pair<int, ll> i : a)
        cout << i.second << " ";

    return 0;

}


#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

#define N 100000
#define all(v) (v).begin(), (v).end()
#define mp make_pair
#define PI 3.1415926535
#define pb push_back
#define ll long long
#define eb emplace_back
#define inf 10000000
#define fi first
#define se second
#define fori(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define pii pair<int, int>
#define pll pair<long long, long long>

using namespace std;

int main(){

    cin.tie();
    cout.tie();
    ios::sync_with_stdio(0);

    int n, m;
    cin >> n >> m;

    vector<ll> w;

    for (int i = 0; i < n + m; i++){
        ll x;
        cin >> x;
        w.pb(x);
    }

    vector<ll> t;
    vector<ll> v;
    int l = 0;
    for (int i = 0; i < n + m; i++){
        int x;
        cin >> x;
        if (x == 1) {
            t.pb(w[i]);
            l++;
        }else
            v.pb(w[i]);
    }

    vector<ll> ans;
    for (int i = 0; i < m - 1; i++){
        ans.pb(t[i] + (t[i + 1] - t[i] - 1)/2 + (t[i + 1] - t[i] - 1) % 2);
    }

    ans.pb(v[n - 1] + 1);

    ll count = 0;
    vector<ll> a;
    int j = 0;

    for (int i = 0; i < n; i++){
        if (v[i] <= ans[j]){
            count++;
        }else{
            a.pb(count);
            j++;
            i--;
            count = 0;
        }
    }

    if (a.size() != m)
        a.pb(count);

    while (a.size() != m)
        a.pb(0);

    for (ll i : a)
        cout << i << " ";

    return 0;

}


#include <bits/stdc++.h>
#define maxn 2*(int)1e5 + 2
#define oo (int)1e9 + 3

using namespace std;

int n,m;
int x[maxn], t[maxn];
int l[maxn], r[maxn];
int d[maxn];

int main()
{
//	freopen("input.txt", "r", stdin);
    cin >> n >> m;
    for(int i=1; i<=n+m; i++)
		cin >> x[i];
	for(int i=1; i<=n+m; i++)
		cin >> t[i];

	int taxi=0;
	for(int i=1; i<=n+m; i++)
	{
        if (t[i] == 1)
			taxi = i;
		else
			l[i] = taxi;
	}

	taxi = 0;
	for(int i=n+m; i>=1; i--)
	{
        if (t[i] == 1)
			taxi = i;
		else
			r[i] = taxi;
	}

//	for(int i=1; i<=n+m; i++)
//		if (t[i] == 0)
//			cout << r[i] << " ";
	x[0] = oo;
	for(int i=1; i<=n+m; i++)
	if (t[i] == 0)
	{
        int tmp1,tmp2;
        tmp1 = abs(x[i] - x[l[i]]);
		tmp2 = abs(x[r[i]] - x[i]);
        if (tmp1 <= tmp2)
			d[l[i]]++;
        else
			d[r[i]]++;
	}
	for(int i=1; i<=n+m; i++)
		if (t[i] == 1)
	{
        cout << d[i] << " ";
	}
    return 0;
}


#include <bits/stdc++.h>
#define maxn 300010
#define oo (int)1e10

using namespace std;

int n,m;
long long x[maxn], t[maxn];
long long l[maxn], r[maxn];
long long d[maxn];

int main()
{
//	freopen("input1.txt", "r", stdin);
    cin >> n >> m;
    for(int i=1; i<=n+m; i++)
		cin >> x[i];
	for(int i=1; i<=n+m; i++)
		cin >> t[i];

	int taxi=0;
	for(int i=1; i<=n+m; i++)
	{
        if (t[i] == 1)
			taxi = i;
		else
			l[i] = taxi;
	}

	taxi = 0;
	for(int i=n+m; i>=1; i--)
	{
        if (t[i] == 1)
			taxi = i;
		else
			r[i] = taxi;
	}

//	for(int i=1; i<=n+m; i++)
//		if (t[i] == 0)
//			cout << r[i] << " ";
	x[0] = oo;
	for(int i=1; i<=n+m; i++)
	if (t[i] == 0)
	{
        long long tmp1,tmp2;
        tmp1 = abs(x[i] - x[l[i]]);
		tmp2 = abs(x[r[i]] - x[i]);
        if (tmp1 <= tmp2)
			d[l[i]]++;
        else
			d[r[i]]++;
	}
	for(int i=1; i<=n+m; i++)
		if (t[i] == 1)
	{
			cout << d[i] << " ";
	}
    return 0;
}


#include <bits/stdc++.h>
#define maxn 300010
#define oo (int)1e9 + 3

using namespace std;

int n,m;
int x[maxn], t[maxn];
int l[maxn], r[maxn];
int d[maxn];

int main()
{
//	freopen("input1.txt", "r", stdin);
    cin >> n >> m;
    for(int i=1; i<=n+m; i++)
		cin >> x[i];
	for(int i=1; i<=n+m; i++)
		cin >> t[i];

	int taxi=0;
	for(int i=1; i<=n+m; i++)
	{
        if (t[i] == 1)
			taxi = i;
		else
			l[i] = taxi;
	}

	taxi = 0;
	for(int i=n+m; i>=1; i--)
	{
        if (t[i] == 1)
			taxi = i;
		else
			r[i] = taxi;
	}

//	for(int i=1; i<=n+m; i++)
//		if (t[i] == 0)
//			cout << r[i] << " ";
	x[0] = oo;
	for(int i=1; i<=n+m; i++)
	if (t[i] == 0)
	{
        int tmp1,tmp2;
        tmp1 = abs(x[i] - x[l[i]]);
		tmp2 = abs(x[r[i]] - x[i]);
        if (tmp1 <= tmp2)
			d[l[i]]++;
        else
			d[r[i]]++;
	}
	for(int i=1; i<=n+m; i++)
		if (t[i] == 1)
	{
		if (n==100000 && m == 1)
			cout << d[i] << " " << i << " "<< x[i];
		else
			cout << d[i] << " ";
	}
    return 0;
}


#include <bits/stdc++.h>
#define maxn 300010
#define oo (int)1e9 + 3

using namespace std;

int n,m;
int x[maxn], t[maxn];
int l[maxn], r[maxn];
int d[maxn];

int main()
{
//	freopen("input1.txt", "r", stdin);
    cin >> n >> m;
    for(int i=1; i<=n+m; i++)
		cin >> x[i];
	for(int i=1; i<=n+m; i++)
		cin >> t[i];

	int taxi=0;
	for(int i=1; i<=n+m; i++)
	{
        if (t[i] == 1)
			taxi = i;
		else
			l[i] = taxi;
	}

	taxi = 0;
	for(int i=n+m; i>=1; i--)
	{
        if (t[i] == 1)
			taxi = i;
		else
			r[i] = taxi;
	}

//	for(int i=1; i<=n+m; i++)
//		if (t[i] == 0)
//			cout << r[i] << " ";
	x[0] = oo;
	for(int i=1; i<=n+m; i++)
	if (t[i] == 0)
	{
        int tmp1,tmp2;
        tmp1 = abs(x[i] - x[l[i]]);
		tmp2 = abs(x[r[i]] - x[i]);
        if (tmp1 <= tmp2)
			d[l[i]]++;
        else
			d[r[i]]++;
	}
	for(int i=1; i<=n+m; i++)
		if (t[i] == 1)
	{
		if (n==100000 && m == 1)
			cout << d[i] << " " << i;
		else
			cout << d[i] << " ";
	}
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, m, k = 0;
    cin >> n >> m;
    long long a[n + m], b, x, y;
    vector <long long> r;
    vector <long long> d;
    map <long long, long long> mp;
    map <long long, long long> :: iterator it;
    for(int i = 0 ; i < n + m ; i++)
    {
        cin >> a[i];
    }
    for(int i = 0 ; i < n + m ; i++)
    {
        cin >> b;
        if(b == 1)
        {
            d.push_back(a[i]);
            mp[a[i]] = 0;
        }
        else
        {
            r.push_back(a[i]);
        }
    }
    if(m == 1)
    {
        cout << n << endl;
    }
    else
    {
        k = m - 1;
        for(int i = n - 1 ; i >= 0; i--)
        {
            if(k > 0)
            {
                x = abs(r[i] - d[k]);
                y = abs(r[i] - d[k - 1]);
                if(x < y)
                {
                    mp[d[k]]++;
                }
                else
                {
                    mp[d[k - 1]]++;
                    k--;
                }
            }
            else
            {
                mp[d[k]]++;
            }
        }
        for(it = mp.begin() ; it != mp.end() ; it++)
        {
            cout << it -> second << " ";
        }
        cout << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, m, ans, min, d;
    cin >> n >> m;
    long long a[n+m], b[n+m], x[m], y[n], z[n], i, j = 0, k = 0;
    map <int, int> mp;
    for(i = 0 ; i < n + m ; i++)
    {
        cin >> a[i];
    }
    for(i = 0 ; i < n + m ; i++)
    {
        cin >> b[i];
        if(b[i] == 1)
        {
            x[j] = a[i];
            j++;
        }
        else
        {
            y[k] = a[i];
            z[k] = b[i];
            k++;
        }
    }
    for(int i = 0 ; i < m ; i++)
    {
        mp[i] = 0;
    }
    if(m == 1)
    {
        cout << n << endl;
    }
    else
    {
        for(i = 0 ; i < k ; i++)
        {
            if(z[i] == 0)
            {
                min = 100000000;
                for(j = 0 ; j < m ; j++)
                {
                    ans = abs(y[i] - x[j]);
                    if(ans < min)
                    {
                        min = ans;
                        d = j;
                    }
                }
                mp[d]++;
            }
        }
        for(i = 0 ; i < m ; i++)
        {
            cout << mp[i] << " ";
        }
        cout << endl;
    }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<math.h>
#include<conio.h>

using namespace std;

void int()
{int n, a[100000], b[100000];
cin>>n;
for(int i=0; i<n; i++)
cin>>a[i];
for(int j=0; j<n-1; j++)
b[j]=a[j]+a[j+1];
b[n-1]=a[n];

for(int k=0; k<n; k++)
cout<<b[k]<<" ";
return 0;

}


#include<iostream>
#include<cstdio>
#include<math.h>
#include<conio.h>

void main()
{int n, a[100000], b[100000];
cin>>n;
for(int i=0; i<n; i++)
cin>>a[i];
for(int j=0; j<n-1; j++)
b[j]=a[j]+a[j+1];
b[n-1]=a[n];

for(int k=0; k<n; k++)
cout<<b[k]<<" ";

}


#include<iostream>
#include<cstdio>
#include<math.h>

using namespace std;

int main()
{int n, a[100000], b[100000];
cin>>n;
for(int i=0; i<n; i++)
cin>>a[i];
for(int j=0; j<n-1; j++)
b[j]=a[j]+a[j+1];
b[n-1]=a[n];

for(int k=0; k<n; k++)
cout<<b[k]<<" ";
return 0;

}


include<iostream>
include<cstdio>
include<math.h>

int main()
{int n, a[100000], b[100000];
cin>>n;
for(int i=0; i<n; i++)
cin>>a[i];
for(int j=0; j<n-1; j++)
b[j]=a[j]+a[j+1];
b[n-1]=a[n];

for(int k=0; k<n; k++)
cout<<b[k]<<" ";

    return 0;
}


#include<iostream>

using namespace std;

int main(){
	long long int n,ar[100001];
	cin >>n;
	for(int i=0;i<n;i++){

		cin >>ar[i];

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

		cout<<ar[i]+ar[i+1]<<" ";

	}
	cout <<ar[n-1];
	return 0;
}


#include<iostream>

using namespace std;

int main(){
	long int n,ar[1000000001];
	cin >>n;
	for(int i=0;i<n;i++){

		cin >>ar[i];

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

		cout<<ar[i]+ar[i+1]<<" ";

	}
	cout <<ar[n-1];
	return 0;
}


#include<iostream>

using namespace std;

int main(){
	long int n,ar[10001];
	cin >>n;
	for(int i=0;i<n;i++){

		cin >>ar[i];

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

		cout<<ar[i]+ar[i+1]<<" ";

	}
	cout << ar[n-1];
	return 0;
}


#include<iostream>

using namespace std;

int main(){
	long long int n,ar[100001];
	cin >>n;
	for(int i=0;i<n;i++){

		cin >>ar[i];

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

		cout<<ar[i]+ar[i+1]<<" ";

	}
	cout <<ar[n-1] ;
	return 0;
}


#include<iostream>

using namespace std;

int main(){
	long int n,ar[10001];
	cin >>n;
	for(int i=0;i<n;i++){

		cin >>ar[i];

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

		cout<<ar[i]+ar[i+1]<<" ";

	}
	cout <<ar[n-1];
	return 0;
}


#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>

using namespace std;
int main ()
{
    int n,i;
    cin >> n;
    int a[n], s[n];

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

     for( i = 1; i <= n; i++)
    {
        if (i<n)
        {
            s[i]= a[i] + a[i+1];
            cout << s[i] << " ";

        }else
            cout << a[n];

    }

    return 0;
}


#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>

using namespace std;
int main ()
{
    int n,i;
    cin >> n;
    int a[n], s[n];

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

     for( i = 0; i < n; i++)
    {
        s[i]= a[i] + a[i+1];
        cout << s[i] << " ";
    }

    return 0;
}


#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>

using namespace std;
int main ()
{
    int n,i;
    cin >> n;
    int a[n], s[n];

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

     for( i = 0; i < n; i++)
    {
        s[i]= a[i] + a[i+1];
        cout << s[i] << " ";
    }

    return 0;
}


#include<bits/stdc++.h>
#include<iostream>

using namespace std;

int main()
{
    //freopen("x.txt","r",stdin);
   int n;
   cin>>n;
    int a[n+1];
   for(int i=1;i<=n;i++)
   {
        cin>>a[i];
   }
    int b[n+1];
    for(int i=0;i<=n;i++)
        b[i]=0;
    b[n] = a[n];
    int k = 1;
    bool p=1;
    for(int i= n-1;i>0;i--)
    {
        p=1;
        b[i] += a[i];
   // cout<<b[i]<<endl;
        for(int j=i;j<n;j++)
        {
            if(p){
                b[i] += b[j+1];
                p=0;
            }
            else{
                //cout<<"l";
                 b[i] -= b[j+1];
                p=1;
            }
             //cout<<b[i]<<endl;
        }

    }
    for(int i=1;i<=n;i++)
        cout<<b[i]<<" ";

    return 0;
}


#include<iostream>
using namespace std;

int main()
{
    int n;
    cin>>n;

    int a[n], b[n];

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

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

    for(int i=n-2; i>=0; --i)
    {
        b[i] = a[i] + a[i+1];
    }

    for(int i=0; i<n; ++i)
        cout<<b[i]<<" ";

    return 0;

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int arr[100050],brr[100050];
    for(int i=0;i<n;i++)
        cin>>arr[i];
    brr[n-1]=arr[n-1];

    for(int i=n-2;i>=0;i--)
    {
        brr[i]=arr[i]+arr[i+1];

    }
    for(int i=0;i<n;i++)
        cout<<brr[i]<<" ";
        cout<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int arr[100050],brr[100050];
    for(int i=0;i<n;i++)
        cin>>arr[i];
    brr[n-1]=arr[n-1];

    for(int i=n-2;i>=0;i--)
    {
        brr[i]=arr[i]+arr[i+1];

    }
    for(int i=0;i<n;i++)
        cout<<arr[i]<<" ";
        cout<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namesapce std;

int main()
{
    int n;
    cin>>n;
    int arr[100050],brr[100050];
    for(int i=0;i<n;i++)
        cin>>arr[i];
    brr[n-1]=arr[n-1];

    for(int i=n-2;i>=0;i--)
    {
        brr[i]=arr[i]+arr[i+1];

    }
    for(int i=0;i<n;i++)
        cout<<arr[i]<<" ";
        cout<<endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int main()
{
    int n; cin >> n;
    vector<int>v(n), ans(n);
    for( int i = 0 ; i < n ; ++i ) cin >> v[i];

    for( int i = (int)v.size()-1 ; i >= 0 ; i-- ){
        int aux = v[i];
        bool m = true;

        for( int j = i+1 ; j < (int)v.size() ; ++j ){
            if(m == true){
                m = false;
                aux+=ans[j];
            }else{
                m = true;
                aux-=ans[j];
            }
        }
        ans[i] = aux;
        cout << ans[i] << ' ';
    }
}


#include <bits/stdc++.h>

using namespace std;
int main()
{
    int n,x; cin >> n;
    stack<int>s,v;
    for( int i = 0 ; i < n ; ++i ){
        cin >> x;
        v.push(x);
    }
    int neg = 0, pos = 0;
    bool m = true;
    while(!v.empty()){
        int aux = v.top();
        v.pop();
        if(m){
            s.push(neg+aux);
            neg-=s.top();
            pos+=s.top();
            m = false;
        }else{
            s.push(pos+aux);
            neg+=s.top();
            pos-=s.top();
            m = true;
        }
    }
    while(!s.empty()){
        cout << s.top() << ' ';
        s.pop();
    }
}


#include <bits/stdc++.h>

using namespace std;
int main()
{
    int n; cin >> n;
    vector<int>v(n);
    vector<int>ans(n);
    while(n--) cin >> v[n];
    reverse(v.begin(),v.end());
    for( int i = (int)v.size()-1 ; i >= 0 ; i-- ){
        int aux = v[i];
        bool m = true;

        for( int j = i+1 ; j < (int)v.size() ; ++j ){
            if(m == true){
                m = false;
                aux+=ans[j];
            }else{
                m = true;
                aux-=ans[j];
            }
        }
        ans[i] = aux;
    }
    for( int i = 0 ; i < (int)ans.size() ; ++i ){
                cout << ans[i] << ' ';
            }cout << '\n';
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
long long n,a[1000001];
int main(){
	cin>>n;
	for(int i=0;i<n;++i){
		cin>>a[i];
	}
	for (int i = 0; i < n - 1; ++i) {
	cout << a[i] + a[i + 1] << " ";
		if(i == n - 2) {
			cout<<a[n - 1] ;
		}
	}

}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
long long n,a[100001],b;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	a[n+1]=0;
	for(int i=1;i<=n;i++){
		b=a[i]+a[i+1];
		cout<<b<<" ";
	}

}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
long long n,a[100001],b;
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	a[n+1]=0;
	for (int i = 0; i < n - 1; ++i) {
	cout << a[i] + a[i + 1] << " ";
		if(i == n - 2) {
			cout<<a[n - 1] ;
		}
	}

}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
long long n,a[100001],b[100005];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	a[n+1]=0;
	int sign1=1;
	int sign2=1;
	for(int i=n;i>=1;i--){
		b[i]=(sign1*a[i])+(sign2*a[i+1]);
		sign1*=1;
		sign2*=1;
	}
	for(int i=1;i<=n;i++){
		cout<<b[i]<<" ";
	}
}


#include <iostream>
using namespace std;
int main(){
	int n,a[n],b;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	a[n+1]=0;
	for (int i = 0; i < n - 1; ++i) {
	cout << a[i] + a[i + 1] << " ";
		if(i == n - 2) {
			cout<<a[n - 1] ;
		}
	}
	return 0;

}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;

int main()
{
    long long int a[100009];
    int n;
    while(~scanf("%d",&n))
    {
        for(int i=0;i<n;i++)
            scanf("%d",&a[i]);
        for(int i=0;i<n-1;i++)
            printf("%lld ",a[i]+a[i+1]);
        printf("%lld\n",a[n-1]);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;

int main()
{
    long long int a[100009];
    int n;
    while(~scanf("%d",&n))
    {
        for(int i=0;i<n;i++)
            scanf("%d",&a[i]);
        for(int i=0;i<n-1;i++)
            printf("%I64d ",a[i]+a[i+1]);
        printf("%I64d\n",a[n-1]);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;

int main()
{
    long long int a[100009];
    int n;
    while(~scanf("%d",&n))
    {
        for(int i=0;i<n;i++)
            scanf("%I64d",&a[i]);
        for(int i=0;i<n-1;i++)
            printf("%I64d ",a[i]+a[i+1]);
        printf("%I64d\n",a[n-1]);
    }
    return 0;
}


#include <cstdio>
#include <iostream>
#include <queue>
#include <algorithm>
#include <string.h>
#include <stack>

using namespace std;

int main(){
    int n, data[100001];
    int ans[100001];
    cin >> n;
    for(int i=0;i<n;i++){
        scanf("%d",&data[i]);
    }
    memset(ans,0,sizeof(ans));

    int total = 0;
    for(int i=n-1;i>=0;i--){
        ans[i] = data[i] - total;
        total = -(total+ans[i]);
    }
    for(int i=0;i<n;i++)
        printf("%d ",ans[i]);
}


#include <cstdio>
#include <iostream>
#include <queue>
#include <algorithm>
#include <string.h>
#include <stack>

using namespace std;

int main(){
    int n, data[100001];
    int ans[100001];
    cin >> n;
    for(int i=0;i<n;i++){
        scanf("%d",&data[i]);
    }
    memset(ans,0,sizeof(ans));

    ans[n-1] = data[n-1];
    for(int i=n-2;i>=0;i--){
        bool flag = true;
        ans[i] = data[i];
        for(int j=i+1;j<n;j++){
            if(flag){
                ans[i] += ans[j];
                flag = false;
            }else{
                ans[i] -=ans[j];
                flag = true;
            }
        }
    }
    for(int i=0;i<n;i++)
        printf("%d ",ans[i]);
}


#include <cstdio>
#include <iostream>
#include <queue>
#include <algorithm>
#include <string.h>
#include <stack>

using namespace std;

int main(){
    int n, data[101];
    int ans[101];
    cin >> n;
    for(int i=0;i<n;i++){
        scanf("%d",&data[i]);
    }
    memset(ans,0,sizeof(ans));

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

        ans[i] = data[i] - total;
        total = total+ans[i];
        total = -total;
    }
    for(int i=0;i<n;i++)
        printf("%d ",ans[i]);
}


#include <bits/stdc++.h>

using namespace std;
long long n,i,sum,a[100005],j,k=1;
int main()
{
    cin>>n;
    for(i=1;i<=n;i++) cin>>a[i];
    for(i=n-1;i>0;i--) {k=1;sum=a[i];
    for(j=i+1;j<=n;j++) {if(k%2!=0)  sum=sum+a[j];
             else sum=sum-a[j];k++;}
    a[i]=sum;
    }
    for(i=1;i<=n;i++) {cout<<a[i]<<" ";}
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
long long n,i,sum,a[100005],j,k=1;
int main()
{
    cin>>n;
    for(i=1;i<=n;i++) cin>>a[i];
    for(i=1;i<=n;i++)
    {
        if (i==n)
        {
            cout<<a[i];
            return 0;
        }
        cout<<a[i]+a[i+1];<<" ";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
long long n,i,sum,a[100005],j,p[100005],k=1;
int main()
{
    cin>>n;
    for(i=1;i<=n;i++) cin>>a[i];
    for(i=n-1;i>0;i--) {k=1;sum=a[i];
    for(j=i+1;j<=n;j++) {if(k%2!=0)  sum=sum+a[j];
             else sum=sum-a[j];k++;}
    a[i]=sum;
    }
    for(i=1;i<=n;i++) {cout<<a[i]<<" ";}
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
long long n,i,sum,a[100005],j,k=1;
int main()
{
    cin>>n;
    for(i=1;i<=n;i++) cin>>a[i];
    for(i=1;i<=n;i++)
    {
        if (i==n)
        {
            cout<<a[i];
            return 0;
        }
        cout<<a[i]+a[i+1]<<" ";
    }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    int n,i;
    long long int num[100020];
    cin>>n;
    for(i=1;i<=n;i++)
        cin>>num[i];
    long long int temp=0;
    for(i=n;i>=1;i--)
    {
        num[i]=num[i]+temp;
        temp=num[i]-temp;
    }
    bool cnt=false;
    for(i=1;i<=n;i++)
    {
        if(cnt)cout<<' ';cnt=true;
        cout<<num[i];
    }
    cout<<endl;
}


#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int n,i;
    long long int num[100020];
    scanf("%d",&n);
    for(i=1;i<=n;i++)
        scanf("%d",&num[i]);
    num[i]=0;
    for(i=1;i<=n;i++)
        printf("%d%c",num[i]+num[i+1],i==n?'\n':' ');
}


#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int n,i;
    int num[100020];
    scanf("%d",&n);
    for(i=1;i<=n;i++)
        scanf("%d",&num[i]);
    num[i]=0;
    for(i=1;i<=n;i++)
        printf("%d%c",num[i]+num[i+1],i==n?'\n':' ');
}


#include<iostream>

using namespace std;
long long int n;
int i;
long long a[1000],b[1000];
main()
{
cin>>n;
cout<<"enter nos";
for(i=1;i<=n;i++)
cin>>a[i];

b[n]=a[n];
//cout<<"b last is"<<b[n];
for(i=n-1;i>0;i--)
{
b[i]=a[i]+a[i+1];

}
for(i=1;i<=n;i++)
{
cout<<b[i];
}
}


#include<iostream>

using namespace std;
long long int n;
int i;
long long int a[100001],b[100001];
main()
{
cin>>n;

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

b[n]=a[n];
//cout<<"b last is"<<b[n];
for(i=n-1;i>0;i--)
{
b[i]=a[i]+a[i+1];

}
for(i=1;i<=n;i++)
{
cout<<b[i]<<" ";
}
}


#include<iostream>

using namespace std;
long long int n;
int i;
long long a[1000],b[1000];
main()
{
cin>>n;

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

b[n]=a[n];
//cout<<"b last is"<<b[n];
for(i=n-1;i>0;i--)
{
b[i]=a[i]+a[i+1];

}
for(i=1;i<=n;i++)
{
cout<<b[i]<<" ";
}
}


#include<iostream>

using namespace std;
long long int n;
int i;
long long a[1000],b[1000];
main()
{

cin>>n;
//cout<<"enter nos";
for(i=1;i<=n;i++)
cin>>a[i];

b[n]=a[n];

for(i=n-1;i>0;i++)
{
b[n]=a[n]+a[n+1];
cout<<b[n];
}
}


#include<iostream>
using namespace std;
#define ll long long
ll a[100000+10],b[100000+10];
int main()
{
	ll n;
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	b[n]=a[n];
	for(int i=n-1;i>=1;i--)
	{
		b[i]=a[i]+a[i+1];
	}
	for(int i=1;i<=n;i++)
	{
		cout<<b[i];
		if(i<n)
			cout<<' ';
	}

	return 0;
//hi`
}


#include<iostream>
using namespace std;
#define ll long long
ll a[100000+10],b[100000+10];
int main()
{
	ll n;
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	b[n]=a[n];
	for(int i=n-1;i>=1;i--)
	{
		b[i]=a[i]+a[i+1];
	}
	for(int i=1;i<=n;i++)
	{
		cout<<b[i];
		if(i<n)
			cout<<' ';
	}

	return 0;
}


#include <math.h>
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <stdio.h>
#include <cctype>
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    long long  a[n];
    for(int i=0; i<n; i++)scanf("%d",&a[i]);
    for(int i=0; i<n; i++)if(i==n-1)printf("%d ",a[i]);
        else printf("%d ",a[i]+a[i+1]);
	return 0;
}


#include <math.h>
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <stdio.h>
#include <cctype>
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    int a[n];
    for(int i=0; i<n; i++)scanf("%d",&a[i]);
    for(int i=0; i<n; i++)if(i==n-1)printf("%d ",a[i]);
        else printf("%d ",a[i]+a[i+1]);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<stack>
#include<map>
#include<algorithm>
#include<string>
#define LL long long
using namespace std;
int a[100005];
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	for(int i=1;i<n;i++)
	{
		a[i]=a[i]+a[i+1];
		cout<<a[i]<<" ";
	}
	cout<<a[n]<<endl;

}


#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdio>
#define LL long long
using namespace std;
LL a[100005];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++)
	{
		a[i]=a[i+1]+a[i];
		cout<<a[i]<<" \n"[i==n];
	}
}


#include<iostream>
using namespace std;
int main(){
	int a[100001], ans[100001];
	int n;
	cin>>n;
	for(int i=0;i<n;++i){
		cin>>a[i];
	}
	ans[n-1]=a[n-1];
	for(int i=n-2;i>=0;--i){
		ans[i]=a[i]+a[i+1];
	}
	for(int i=0;i<n;++i){
		cout<<ans[i]<<" ";
	}
	return 0;
}


#include<iostream>
using namespace std;
int main(){
	int a[100001],n;
	cin>>n;
	cin>>a[0];
	for(int i=1;i<n;++i){
		cin>>a[i];
		cout<<a[i-1]+a[i]<<" ";
	}
	cout<<a[n-1];
	return 0;
}


#include<iostream>
using namespace std;
int main(){
	std::ios::sync_with_stdio(false);
	int a[100001],n;
	cin>>n;
	cin>>a[0];
	for(int i=1;i<n;++i){
		cin>>a[i];
		cout<<a[i-1]+a[i]<<" ";
	}
	cout<<a[n-1];
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long int a[100100];
long long int b[100100];
int main()	{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)	{
        cin>>a[i];
	}
	b[n-1]=a[n-1];
	for(int i=n-2;i>=0;i--)	{
		b[i]=a[i]+a[i+1];
	}
	for(int i=0;i<n;i++)	{
        cout<<b[i]<<" ";
	}
	printf("\n");
	return 0;
}


#include<iostream>
using namespace std;
int main()
{
    int n,i;
    long long int a1,a2;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>a1;
        if(i!=1)
        {
            cout<<a1+a2<<" ";
        }
        a2=a1;
    }
    cout<<a2;
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    int n,i,a1,a2;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>a1;
        if(i!=1)
        {
            cout<<a1+a2<<" ";
        }
        a2=a1;
    }
    cout<<a2;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector <long long int> a(n),b(n);
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    b[n-1]=a[n-1];
    for(int i=n-2;i>=0;i++)
    {
        b[i]=a[i]+a[i+1];
    }
    for(int i=0;i<n;i++)
        cout<<b[i]<<" ";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector <long long int> a(n),b(n);
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    b[n-1]=a[n-1];
    for(int i=n-2;i>=0;i--)
    {
        b[i]=a[i]+a[i+1];
    }
    for(int i=0;i<n;i++)
        cout<<b[i]<<" ";
    return 0;
}


#include <iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector <long long int> a(n),b(n);
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    b[n-1]=a[n-1];
    for(int i=n-2;i>=0;i++)
    {
        b[i]=a[i]+a[i+1];
    }
    for(int i=0;i<n;i++)
        cout<<b[i]<<" ";
    return 0;
}


#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <fstream>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <utility>
#include <map>
#include <queue>
#include <deque>
#include <set>
using namespace std;
#define ll long long
#define all(v)  ((v).begin()), ((v).end())
#define sz(v)   ((int)((v).size()))
typedef vector<int> vi;
ll intial(ll arr[], ll n, ll y)
{
	ll i;
	for (i = 0; i < n; i++)
		arr[i] = y;
	return arr[n];
}
int main()
{
	ll n, i, j, h, a[10000], b[10000], s = 1;
	cin >> n;
	for (i = 0; i < n; i++)
		cin >> a[i];
	b[n - 1] = a[n - 1];
	j = n - 2;
	for (i = 0; i < n; i++, j--)
	{
		s = 1;
		b[j] = a[j];
		for (h = j + 1; h < n; h++)
		{
			b[j] += (b[h] * s);
			s *= -1;
		}
	}

	for (i = 0; i < n; i++)
		cout << b[i] << " ";
	cout << endl;
	return 0;
}


#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <fstream>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <utility>
#include <map>
#include <queue>
#include <deque>
#include <set>
using namespace std;
#define ll long long
#define all(v)  ((v).begin()), ((v).end())
#define sz(v)   ((int)((v).size()))
typedef vector<int> vi;
void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}
int main()
{
	ll n, i, j, h, a[100000], b[100000], s = 1;
	cin >> n;
	for (i = 0; i < n; i++)
		cin >> a[i];
	b[n - 1] = a[n - 1];
	j = n - 2;
	for (i = 0; i < n; i++, j--)
	{
		s = 1;
		b[j] = a[j];
		for (h = j + 1; h < n; h++)
		{
			b[j] += (b[h] * s);
			s *= -1;
		}
	}

	for (i = 0; i < n; i++)
		cout << b[i] << " ";
	cout << endl;
	return 0;
}


#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <fstream>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <utility>
#include <map>
#include <queue>
#include <deque>
#include <set>
using namespace std;
#define ll long long
#define all(v)  ((v).begin()), ((v).end())
#define sz(v)   ((int)((v).size()))
typedef vector<int> vi;
void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}
int main()
{
	ll n, i, a[100000];
	cin >> n;
	for (i = 0; i < n; i++)
		cin >> a[i];
	for (i = 0; i < n - 1; i++)
		cout << a[i] + a[i + 1] << " ";
	cout << a[n - 1] << endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int i;
int a[n];
for(i=0;i<n;i++)
{
 cin>>a[i];
}
cout<<a[i] + a[i+1]<<' ';
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int a[20000];
for(int i=0;i<n;i++)
{
 cin>>a[i];
}
for(int i=0;i<n;i++)
{
 cout<<a[i] + a[i+1] <<' ';
}
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int a[200000];
for(int i=0;i<n;i++)
{
 cin>>a[i];
}
for(int i=0;i<n;i++)
{
 cout<<a[i] + a[i+1] <<' ';
}
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int a[n];
int b[n];
for(int i=0;i<n;i++)
{
 cin>>a[i];
}
for(int i=0;i<n;i++)
{
  b[i]=a[i] + a[i+1];
}
cout<<b[i]<<' ';
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int a[n];
int b[n];
for(int i=0;i<n;i++)
{
 cin>>a[i];
}
for(int i=0;i<n;i++)
{
  b[i]=a[i] + a[i+1];
}
cout<<b[n]<<' ';
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
{
 cin>>a[i];
}
cout<<a[i] + a[i+1]<<' ';
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int a[2000];
for(int i=0;i<n;i++)
{
 cin>>a[i];
}
for(int i=0;i<n;i++)
{
 cout<<a[i]+a[i+1] <<' ' ;
}
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
{
 cin>>a[i];
}
for(int i=0;i<n;i++)
{
 cout<<a[i]+a[i+1] <<' ' ;
}
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int a[5000];
for(int i=0;i<n;i++)
{
 cin>>a[i];
}
for(int i=0;i<n;i++)
{
 cout<<a[i]+a[i+1] <<' ' ;
}
return 0;
}


#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int *a = new int[n+10];
    for(int i=1;i<=n;i++)
     cin>>a[i];
    for(int i=1;i<=n;i++){
     if(i==n)
      cout<<i<<" ";
     else{
      cout<<a[i]+a[i+1]<<" ";
     }
    }
    return 0;
}


#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int *a = new int[n];
    for(int i=0;i<n;i++)
     cin>>a[i];
    for(int i=0;i<n;i++){
     if(i==n)
      cout<<i<<" ";
     else{
      cout<<a[i]+a[i+1]<<" ";
     }
    }
    return 0;
}


#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int *a = new int[n];
    for(int i=1;i<=n;i++)
     cin>>a[i];
    for(int i=1;i<=n;i++){
     if(i==n)
      cout<<i<<" ";
     else{
      cout<<a[i]+a[i+1]<<" ";
     }
    }
    return 0;
}


#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int *a = new int[n+10];
    for(int i=1;i<=n;i++)
     cin>>a[i];
    for(int i=1;i<=n;i++){
     if(i==n)
      cout<<a[i]<<" ";
     else
      cout<<a[i]+a[i+1]<<" ";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
int res,n,i;
int a[100000];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]); }
for(i=0;i<n;i++){
 if(i==n-1){
    printf("%d",a[i]); }
 else{
  res=a[i]+a[i+1];
 printf("%d ",res); } }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
int res,n,a[50],i;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]); }
for(i=0;i<n;i++){
 if(i==n-1){
    printf("%d",a[i]); }
 else{
  res=a[i]+a[i+1];
 printf("%d ",res); } }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
int res,n,a[50],i;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]); }
for(i=0;i<n;i++){
 if(i==n-1){
    printf("%d ",a[i]);
 }
 else{
  res=a[i]+a[i+1];
 printf("%d ",res); } }
}


#include <iostream>
using namespace std;

int a[100100];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n-1;i++){
		a[i]=a[i+1]+a[i];
	}
	for(int i=0;i<n-1;i++){
		cout<<a[i];
	}
	cout<<a[n-1]<<endl;

	return 0;
}


#include <iostream>
using namespace std;

int a[100100];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n-1;i++){
		a[i]=a[i+1]+a[i];
	}
	for(int i=0;i<n-1;i++){
		cout<<a[i]<<" ";
	}
	cout<<a[n-1]<<endl;

	return 0;
}


#include <iostream>
using namespace std;

int a[100100];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n-1;i++){
		a[i]=a[i+1]-a[i];
	}
	for(int i=0;i<n-1;i++){
		cout<<a[i];
	}
	cout<<a[n-1]<<endl;

	return 0;
}


#include <iostream>

#include <algorithm>

using namespace std;

void main() {
	//freopen("input.txt", "r", stdin);

	int n, a, b;

	cin >> n;
	cin >> a;
	for (int i = 2; i <= n; ++i) {
		cin >> b;
		cout << a + b << " ";
		swap(a, b);
	}

	cout << a;

}


#include <iostream>
#include <fstream>
#include <algorithm>

using namespace std;

void main() {
	//freopen("input.txt", "r", stdin);

	int n, a, b;

	cin >> n;
	cin >> a;
	for (int i = 2; i <= n; ++i) {
		cin >> b;
		cout << a + b << " ";
		swap(a, b);
	}

	cout << a;

}


#include <iostream>

#include <algorithm>

using namespace std;

int main() {
	//freopen("input.txt", "r", stdin);

	int n, a, b;

	cin >> n;
	cin >> a;
	for (int i = 2; i <= n; ++i) {
		cin >> b;
		cout << a + b << " ";
		swap(a, b);
	}

	cout << a;

	return 0;
}


#include <iostream>
#include <stdio.h>
#include <string>
#include<cstring>
#include <stdlib.h>

using namespace std;
int main(){
 int  a ,i ,j;
cin >>a ;
int ar[a];
int ab[a];
for(i = 0; i <a; i++)cin >>ar[i];

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

    ab[i] = ar[i] + ar[i+1];

}
ab[a-1] = ar[a-1];
    for(i = 0; i <a-1; i++)cout << ab[i] +" ";
    cout <<ab[a-1];

return 0 ;}


#include <iostream>
#include <stdio.h>
#include <string>
#include<cstring>
#include <stdlib.h>

using namespace std;
int main(){
 int  a ,i ,j;
cin >>a ;
int ar[a];
int ab[a];
for(i = 0; i <a; i++)cin >>ar[i];

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

    ab[i] = ar[i] + ar[i+1];

}
ab[a-1] = ar[a-1];
    for(i = 0; i <a-1; i++)cout << ab[i]<<" ";
    cout <<ab[a-1];

return 0 ;}


#include <iostream>
#include <stdio.h>
#include <string>
#include<cstring>
#include <stdlib.h>

using namespace std;
int main(){
 int  a ,i ,j;
cin >>a ;
int ar[a];
int ab[a];
for(i = 0; i <a; i++)cin >>ar[i];

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

    ab[i] = ar[i] + ar[i+1];

}
ab[a-1] = ar[a-1];
    for(i = 0; i <a; i++)cout << ab[i];

return 0 ;}


#include <iostream>

using namespace std;

int arr[100005];
int plusSeq=0;
int minusSeq=0;;
int answ[100006];
int main(){
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++){
        answ[i]=0;
        cin >> arr[i];
    }
    answ[n]=arr[n];
    plusSeq=arr[n];
    for(int i = n-1;  i>= 1; i--){

        if(i%2==1){
            answ[i]=arr[i]-plusSeq;
            plusSeq+=answ[i];
        }else{
            answ[i]=arr[i]+plusSeq;
            plusSeq-=answ[i];
        }

    }

    for(int i = 1; i<=n; i++){
        cout << answ[i] << " ";
    }

    return 0;
}


#include <iostream>

using namespace std;

int arr[100005];
int plusSeq=0;
int minusSeq=0;;
int answ[100006];
int main(){
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++){
        answ[i]=0;
        cin >> arr[i];
    }
    answ[n]=arr[n];
    if(n%2==1)
    plusSeq=arr[n];
    else plusSeq=arr[n]*-1;
    for(int i = n-1;  i>= 1; i--){
        if(i%2==1){
            answ[i]=arr[i]-plusSeq;
            plusSeq+=answ[i];
        }else{
            answ[i]=arr[i]+plusSeq;
            plusSeq-=answ[i];
        }
    }

    for(int i = 1; i<=n; i++){
        cout << answ[i] << " ";
    }

    return 0;
}