#include #define int long long using namespace std; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; } signed main() { cin.tie(0); ios::sync_with_stdio(false); int N,M,K; cin>>N>>M>>K; vector> a(N,vector(M)); for(int i=0;i>a[i][j]; vector> dp(N+1,vector(510)); dp[0][0]=true; for(int i=0;i