#line 1 "main.cpp" // #include "template/template.hpp" #include using namespace std; using uint = unsigned int; #line 2 "library/util/fastio.hpp" #line 4 "library/util/fastio.hpp" namespace FastIO { static constexpr unsigned int BUF_SIZE = 1 << 17; struct InStream { private: using IS = InStream; inline static unsigned int p = BUF_SIZE; inline static char buf[BUF_SIZE]; static bool isSpace(char c) { return c == ' ' || ('\t' <= c && c <= '\r'); } public: char seekChar() { if (p == BUF_SIZE) { size_t len = fread(buf, 1, BUF_SIZE, stdin); if (len != BUF_SIZE) buf[len] = '\0'; p = 0; } return buf[p]; } void skipSpace() { while (isSpace(seekChar())) p++; } template T readUInteger() { T x = 0; skipSpace(); while (true) { char c = seekChar(); if ('9' < c || c < '0') break; x = x * 10 + (c - '0'); p++; } return x; } template T readInteger() { T x = 0; skipSpace(); bool is_negative = seekChar() == '-'; if (is_negative) p++; if (is_negative) { while (true) { char c = seekChar(); if ('9' < c || c < '0') break; x = x * 10 - (c - '0'); p++; } } else { while (true) { char c = seekChar(); if ('9' < c || c < '0') break; x = x * 10 + (c - '0'); p++; } } return x; } char readChar() { skipSpace(); char c = seekChar(); p++; return c; } std::string readString() { std::string s; skipSpace(); while (true) { char c = seekChar(); if (isSpace(c) || c == '\0') break; s.push_back(c); p++; } return s; } IS& operator>>(unsigned int& x) { x = readUInteger(); return *this; } IS& operator>>(int& x) { x = readInteger(); return *this; } IS& operator>>(unsigned long long& x) { x = readUInteger(); return *this; } IS& operator>>(long long& x) { x = readInteger(); return *this; } IS& operator>>(char& c) { c = readChar(); return *this; } IS& operator>>(std::string& s) { s = readString(); return *this; } }; struct OutputTable { char num[10000][5]; char tnum[10000][5]; constexpr OutputTable() : num(), tnum() { for (int i = 0; i < 10000; i++) { num[i][0] = '0' + i / 1000 % 10; num[i][1] = '0' + i / 100 % 10; num[i][2] = '0' + i / 10 % 10; num[i][3] = '0' + i / 1 % 10; num[i][4] = '\0'; int x = 0; if (i >= 1000) tnum[i][x++] = '0' + i / 1000 % 10; if (i >= 100) tnum[i][x++] = '0' + i / 100 % 10; if (i >= 10) tnum[i][x++] = '0' + i / 10 % 10; if (i >= 1) tnum[i][x++] = '0' + i / 1 % 10; tnum[i][x++] = '\0'; } } } constexpr table; struct OutStream { private: using OS = OutStream; inline static unsigned int p = 0; inline static char buf[BUF_SIZE]; static constexpr uint32_t P10(unsigned int d) { return d ? P10(d - 1) * 10 : 1; } static constexpr uint64_t P10L(unsigned int d){ return d ? P10L(d - 1) * 10 : 1; } template static void Split(T& x, U& y, U z) noexcept { x = y / z; y -= x * z; } public: ~OutStream(){ flush(); } void flush() { fwrite(buf, 1, p, stdout); p = 0; } void write(const char c) { if (p == BUF_SIZE) flush(); buf[p++] = c; } void write(const char* s) { while (*s) write(*(s++)); } void write(const std::string& s) { for (char c : s) write(c); } void writeU32(uint32_t x) { unsigned int y = 0; if (x >= P10(8)) { Split(y, x, P10(8)); write(table.tnum[y]); Split(y, x, P10(4)); write(table.num[y]); write(table.num[x]); } else if (x >= P10(4)) { Split(y, x, P10(4)); write(table.tnum[y]); write(table.num[x]); } else if (x > 0) { write(table.tnum[x]); } else { write('0'); } } void writeI32(int32_t x) { if (x < 0) { write('-'); writeU32(uint32_t(0) - static_cast(x)); } else writeU32((uint32_t)x); } void writeU64(uint64_t x) { unsigned int y = 0; if (x >= P10L(16)) { Split(y, x, P10L(16)); write(table.tnum[y]); Split(y, x, P10L(12)); write(table.num[y]); Split(y, x, P10L(8)); write(table.num[y]); Split(y, x, P10L(4)); write(table.num[y]); write(table.num[x]); } else if (x >= P10L(12)) { Split(y, x, P10L(12)); write(table.tnum[y]); Split(y, x, P10L(8)); write(table.num[y]); Split(y, x, P10L(4)); write(table.num[y]); write(table.num[x]); } else if (x >= P10L(8)) { Split(y, x, P10L(8)); write(table.tnum[y]); Split(y, x, P10L(4)); write(table.num[y]); write(table.num[x]); } else if (x >= P10L(4)) { Split(y, x, P10L(4)); write(table.tnum[y]); write(table.num[x]); } else if (x > 0) { write(table.tnum[x]); } else { write('0'); } } void writeI64(int64_t x) { if (x < 0) { write('-'); writeU64(uint64_t(0) - static_cast(x)); } else writeU64((uint64_t)x); } OS& operator<<(unsigned int x) { writeU32(x); return *this; } OS& operator<<(int x) { writeI32(x); return *this; } OS& operator<<(unsigned long long x) { writeU64(x); return *this; } OS& operator<<(long long x) { writeI64(x); return *this; } OS& operator<<(const std::string& s) { write(s); return *this; } OS& operator<<(const char* s) { write(s); return *this; } OS& operator<<(char c) { write(c); return *this; } }; }; // namespace FastIO #line 8 "main.cpp" FastIO::InStream is; FastIO::OutStream os; void solve() { int H, W; is >> H >> W; uint T = 0; vector C(H); for (int i = 0; i < H; i++) { uint s = 0, x = 0; for (int j = 0; j < W; j++) { is >> x; s += x; } C[i] = s; T += s; } for (auto& v : C) os << (v + T) << '\n'; } int main() { int T = 1; // in(T); while (T--) solve(); }