#include using namespace std; int main() { //入力 int N,M,K; cin >> N >> M >> K; assert(1<=N&&N<=20); assert(1<=M&&M<=20); assert(1<=K&&K<=1000); vector> a(N,vector(M)); for(int i = 0; i < N; ++i) { for(int j = 0; j < M; ++j) { cin >> a[i][j]; assert(1 <= a[i][j] && a[i][j] <= 50); } } //ソート、差分計算、初期値 int sum = 0; for(int i = 0; i < N; ++i) { sort(a[i].begin(),a[i].end()); int ini = a[i][0]; sum += ini; for(int j = 0; j < M; ++j) a[i][j] -= ini; } //dp bitset<1001> dp; dp.set(sum); for(int i = 0; i < N; ++i){ auto tmp = dp; for(int j = 0; j < M; ++j) dp |= (tmp<