#include #include using namespace std; int main() { int N, M; cin >> N >> M; vector > A(M, vector(N, 0)); vector > S(M, vector(N+1, 0)); for(int m=0; m> a; A[m][n] += a; if(m>0) { A[m][n] += A[m-1][n]; } S[m][n+1] += S[m][n] + A[m][n]; // cout << S[m][n+1] << " "; // cout << A[m][n] << " "; } // cout << endl; } for(int m=0; m777) { l++; } if(prevl==l) break; l--; } } cout << "NO" << endl; return 0; }