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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <string>

#define FOR(i,a,b)  for(int i=(a);i<(b);++i)
#define FORD(i,a,b) for(int i=(a);i>=(b);--i)
#define REP(i,a)    FOR(i,0,a)
#define MP          make_pair
#define PB          push_back
#define ST          first
#define ND          second

using namespace std;

typedef vector<int>             VI;
typedef vector<VI>              VVI;
typedef pair<int, int>          PII;
typedef vector<PII>             VII;
typedef long long int           LL;
typedef unsigned long long int  ULL;

const int MAXN = 100005;
const int MAXK = 5;

int n, k;
LL a[MAXK][MAXN];
LL res[MAXN];

int main() {
    scanf("%d %d", &n, &k);
//k = 2;
    REP (i, k) {
        REP (j, n) {
            scanf("%lld", &a[i][j]);
        }
    }

    if (k > 2) {
        printf("We no speak Americano");
        return 0;
    }

    if (k == 2) {
        LL dist = 0, diff = 0;
        REP (i, n) {
            dist += abs(a[0][i]-a[1][i]);
        }
        REP (i, n) {
            if (diff >= dist / 2) {
                res[i] = a[0][i];
            }
            else if (diff + abs(a[0][i]-a[1][i]) >= dist / 2) {
                if (a[0][i] < a[1][i]) {
                    res[i] = a[0][i] + (dist / 2 - diff);
                }
                else {
                    res[i] = a[0][i] - (dist / 2 - diff);
                }
            }
            else {
                res[i] = a[1][i];
            }
            diff += abs(a[0][i]-a[1][i]);
        }
    }

/*LL dbg = 0, tmp = 0;
REP (j, k) {
    tmp = 0;*/
    REP (i, n) {
        printf("%lld ", res[i]);
//        tmp += abs(a[j][i]-res[i]);
    }
//    dbg = max(dbg, tmp);
//}
//printf("%lld", dbg);
    printf("\n");

    return 0;
}