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
#include <algorithm>
#include <cstdio>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
typedef long long LL;

int a[100000][5];

int main() {
	int n, k;
	scanf("%d%d", &n, &k);
	REP(j,k) REP(i,n) scanf("%d", &a[i][j]);
	int add = 0;
	REP(i,n) {
		if (i) printf(" ");
		LL mi = 2000000000, ma = -2000000000;
		REP(j,k) {
			mi = min(mi, LL(a[i][j]));
			ma = max(ma, LL(a[i][j]));
		}
		LL s = mi + ma;
		if (s&1) {
			if (add) ++s;
			add = 1 - add;
		}
		s += 1000000000000;
		s >>= 1;
		s -= 500000000000;
		printf("%d", int(s));
	}
	printf("\n");
}