#include using namespace std; int main() { int n, m, k; cin>>n>>m>>k; int a[n][m]; for (int i=0; i>a[i][j]; } int dp[501]; for (int i=0; i<501; i++) dp[i] = 0; for (int i=0; i= 0 && dp[j-a[i][k]] == i) { dp[j] = i + 1; break; } } } } for (int i=k; i>=0; i--) { if (dp[i] == n) { cout<