#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <iomanip>

using namespace std;

int main()
{
    long n,m;
    scanf("%ld%ld",&n,&m);
    ios_base::sync_with_stdio(0);
    cout.tie(NULL);
    long *p=new long[m];
    for (long j=0;j<m;j++)
        p[j]=1;
    for (long i=1;i<=n;i++)
    {
        long k=0,l=-1,r,sum=0;
        for (long j=0;j<m;j++)
        {
            long a;
            scanf("%ld",&a);
            if (a==1)
            {
                if (k==0) l=j;
                if (k==1)
                {
                    r=j;
                    k=0;
                    if (l==-1)
                    {
                        p[r]+=sum;
                    }
                    else
                    {
                        long pr=sum/2;
                        p[l]+=pr;
                        p[r]+=pr;
                        if (sum%2==1)
                        {
                            if (i%2==1) p[l]++; else p[r]++;
                        }
                    }
                    sum=0;
                    l=j;
                }
            }
            else
            if (a==0)
            {
                k=1;
                sum+=p[j];
                p[j]=0;
            }
        }
        if (k==1)
        {
            p[l]+=sum;
        }
    }
    for (long i=0;i<m;i++)
    {
        cout << p[i] << " ";
    }
    delete[] p;
    return 0;
}