#pragma GCC target("avx2") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #include using namespace std; // https://tjkendev.github.io/procon-library/cpp/template/fast_io.html class FastIO { static const int rdata_sz = (1 << 25), wdata_sz = (1 << 25); char rdata[rdata_sz], wdata[wdata_sz], *rb, *wb; char tmp_s[20]; public: FastIO() { fread(rdata, 1, rdata_sz, stdin); rb = rdata; wb = wdata; } ~FastIO() { fwrite(wdata, 1, wb - wdata, stdout); } template inline void read_i(T &x) { bool neg = false; x = 0; while((*rb < '0' || *rb > '9') && *rb != '-') ++rb; if(*rb == '-') { neg = true; ++rb; } while('0' <= *rb && *rb <= '9') { x = 10 * x + (*rb - '0'); ++rb; } if(neg) x = -x; } #define pc(x) *(wb++) = x template inline void writeln_i(T x) { if (x == 0) { pc('0'); pc('\n'); return; } if(x < 0) { pc('-'); x = -x; } char *t = tmp_s; while(x) { T y = x / 10; *(t++) = (x - y*10) + '0'; x = y; } while(t != tmp_s) pc(*(--t)); pc('\n'); } #undef pc }; FastIO io; using uint=unsigned int; int main(){ int n,m; io.read_i(n); io.read_i(m); vector> v(n,vector(m)); vector w; uint t=0; for(auto &nx : v){ uint c=0; for(auto &ny : nx){ io.read_i(ny); c+=ny; } t+=c; w.push_back(c); } for(auto &nx : w){ nx+=t; io.writeln_i(nx); } return 0; }