#include #include #include using namespace std; // حل مشكلة Visual Studio (Windows) مع Linux Fast I/O #ifdef _WIN32 #define getchar_unlocked _getchar_nolock #define putchar_unlocked _putchar_nolock #endif // Fast I/O reading unsigned long long inline bool readUnsignedInt(unsigned long long &n) { int c = getchar_unlocked(); if (c == EOF) return false; while (c < '0' || c > '9') { c = getchar_unlocked(); if (c == EOF) return false; } n = 0; while (c >= '0' && c <= '9') { n = n * 10 + (c - '0'); c = getchar_unlocked(); } return true; } // Fast I/O writing unsigned int inline void printUnsignedInt(unsigned int n) { if (n == 0) { putchar_unlocked('0'); putchar_unlocked('\n'); return; } char buf[12]; int i = 0; while (n > 0) { buf[i++] = (char)('0' + (n % 10)); n /= 10; } while (i > 0) { putchar_unlocked(buf[--i]); } putchar_unlocked('\n'); } void Do_ur_job() { unsigned long long H, W; if (!readUnsignedInt(H) || !readUnsignedInt(W)) return; vector S(H, 0); unsigned int T = 0; // Fast processing using implicit mod 2^32 via 32-bit unsigned int for (size_t i = 0; i < H; ++i) { unsigned int sumR = 0; for (size_t j = 0; j < W; ++j) { unsigned long long x; readUnsignedInt(x); sumR += (unsigned int)(x & 0xFFFFFFFFULL); } S[i] = sumR; T += sumR; } for (size_t i = 0; i < H; ++i) { unsigned int Ci = S[i] + T; printUnsignedInt(Ci); } } int main() { Do_ur_job(); return 0; }