#include #include #include #include #include #include #include #include #include #include #include #include #include #include int main() { int n, m; std::cin >> n >> m; std::vector happiness(n, 0); for (auto& h : happiness) { for (auto i = 0; i < m; ++i) { long long int a; std::cin >> a; h += a; } } long long int odd{ 0 }, even{ LLONG_MIN >> 1}; for (const auto h : happiness) { const auto o = std::max(odd, even - h); const auto e = std::max(even, odd + h); odd = o; even = e; } std::cout << std::max(odd, even) << '\n'; }