#include <iostream>
using namespace std;
/*
Declaram “n”, “m”, matricea de marimea “n” * “m”,
precum și un vector în care vom stoca sumele aferente fiecărei linii,
initializat cu zero.
Citim variabilele “n” si “m”.
În timpul citirii matricei:
Adaugam fiecărui element al vectorului sumelor,
situat pe indicile dat de linia curentă,
toate elementele din matrice situate pe aceeași linie.
Aranjăm crescător șirul sumelor folosind metoda de sortare prin selecție.
Afisam în ordine descrescătoare elementele vectorului sumelor.
*/
const int TEN = 10;
int main() {
int n, m, mt[TEN + 1][TEN + 1], v[TEN + 1] = {0};
cin >> n >> m;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= m; ++j) {
cin >> mt[i][j];
v[i] = v[i] + mt[i][j];
}
}
for (int i = 1; i < n; ++i) {
for (int j = i + 1; j <= n; ++j) {
if (v[i] > v[j]) {
int cpy = v[i];
v[i] = v[j];
v[j] = cpy;
}
}
}
for (int i = n; i > 0; --i) {
cout << v[i] << " ";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwovKgpEZWNsYXJhbSDigJxu4oCdLCDigJxt4oCdLCBtYXRyaWNlYSBkZSBtYXJpbWVhIOKAnG7igJ0gKiDigJxt4oCdLCAKcHJlY3VtIMiZaSB1biB2ZWN0b3Igw65uIGNhcmUgdm9tIHN0b2NhIHN1bWVsZSBhZmVyZW50ZSBmaWVjxINyZWkgbGluaWksIAppbml0aWFsaXphdCBjdSB6ZXJvLgpDaXRpbSB2YXJpYWJpbGVsZSDigJxu4oCdIHNpIOKAnG3igJ0uCgrDjm4gdGltcHVsIGNpdGlyaWkgbWF0cmljZWk6CglBZGF1Z2FtIGZpZWPEg3J1aSBlbGVtZW50IGFsIHZlY3RvcnVsdWkgc3VtZWxvciwgCglzaXR1YXQgcGUgaW5kaWNpbGUgZGF0IGRlIGxpbmlhIGN1cmVudMSDLCAKCXRvYXRlIGVsZW1lbnRlbGUgZGluIG1hdHJpY2Ugc2l0dWF0ZSBwZS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