#include using namespace std; char *p1,*p2,buf[200001]; #define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,200000,stdin),p1==p2)?EOF:*p1++) uint32_t read(){ uint32_t x = 0; char c = gc(); while(c < 48) c = gc(); while(c > 47) x = (x << 3) + (x << 1) + (c & 15), c = gc(); return x; } int main(){ uint32_t h = read(), w = read(); vector S(h); uint32_t tot = 0; for(uint32_t y = 0; y < h; y++){ for(uint32_t x = 0; x < w; x++){ S[y] += read(); } tot += S[y]; } ios::sync_with_stdio(false); cin.tie(0); for(auto &&v : S) cout << tot + v << '\n'; }