1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <set>
#define MAXK 10
#define MAXN 100007
#define INF
#define PB push_back
#define MP make_pair
#define ST first
#define ND second

#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(a,b,c) for(int a=b;a<=(c);a++)
#define FORD(a,b,c) for (int a=b;a>=(c);a--)
#define VAR(v,n) __typeof(n) v=(n)
#define ALL(c) c.begin(),c.end()
#define FOREACH(i,c) for(VAR(i,(c).begin());i!=(c).end();i++)

using namespace std;

typedef long long LL;  

int n,k;
int ciag[MAXK][MAXN];

int main(){
	scanf("%d%d",&n,&k);
	REP(i,k) REP(j,n) scanf("%d",&ciag[i][j]);
	if (k == 2) {
		int ile_nieparz = 0;
		int roz,pom;
		REP(i,n) {
			roz = abs(ciag[0][i]-ciag[1][i]);
			ile_nieparz ^= (roz&1);
			if (ciag[0][i] <= ciag[1][i]) 
				pom = ile_nieparz;
			else
				pom = 1-ile_nieparz;
			printf("%d ",(ciag[0][i]+ciag[1][i]+pom)/2);
		}
		puts("");
	}
	return 0;
}