#include #include #include #include // 高速入出力クラス (fread / fwrite) struct FastIO { static constexpr size_t BUF_SIZE = 1 << 20; char inbuf[BUF_SIZE]; size_t in_pos = 0, in_len = 0; char outbuf[BUF_SIZE]; size_t out_pos = 0; inline char get_char() { if (in_pos == in_len) { in_pos = 0; in_len = fread(inbuf, 1, BUF_SIZE, stdin); if (in_len == 0) return EOF; } return inbuf[in_pos++]; } template inline bool read_uint(T& x) { char c = get_char(); while (c <= ' ') { if (c == EOF) return false; c = get_char(); } x = 0; while (c >= '0' && c <= '9') { x = x * 10 + (c - '0'); c = get_char(); } return true; } inline void write_char(char c) { if (out_pos == BUF_SIZE) { fwrite(outbuf, 1, BUF_SIZE, stdout); out_pos = 0; } outbuf[out_pos++] = c; } template inline void write_uint(T x, char end_c = '\n') { if (x == 0) { write_char('0'); } else { char buf[20]; int len = 0; while (x > 0) { buf[len++] = static_cast('0' + (x % 10)); x /= 10; } while (len > 0) { write_char(buf[--len]); } } write_char(end_c); } ~FastIO() { if (out_pos > 0) { fwrite(outbuf, 1, BUF_SIZE, stdout); } } } io; int main() { int H, W; if (!io.read_uint(H) || !io.read_uint(W)) return 0; std::vector S(H, 0); uint32_t T = 0; for (int i = 0; i < H; ++i) { uint32_t row_sum = 0; for (int j = 0; j < W; ++j) { uint32_t val; io.read_uint(val); row_sum += val; // 自動的に mod 2^32 } S[i] = row_sum; T += row_sum; // 自動的に mod 2^32 } for (int i = 0; i < H; ++i) { uint32_t C_i = S[i] + T; // 自動的に mod 2^32 io.write_uint(C_i); } return 0; }