stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

typedef long long int ll;

ll A[14][14],C[14];

int main()

{

    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

    ll n,m,x;

    memset(A,0,sizeof(A));

    memset(C,0,sizeof(C));

    cin>>n>>m>>x;

    for(int i=0; i<n; i++)

    {

        cin>>C[i];

        for(int j=0; j<m; j++)

        {

            cin>>A[i][j];

        }

    }

    ll Ans=10000007;

    for(int i=0; i<=4095; i++)

    {

        string s = bitset<12>(i).to_string();

        reverse(s.begin(),s.end());

        ll Cost=0,ul[14];

        memset(ul,0,sizeof(ul));

        for(int j=0; j<n; j++)

        {

            if(s[j]=='0')

                continue;

            Cost+=C[j];

            for(int k=0; k<m; k++)

            {

                ul[k]+=A[j][k];

            }

        }

        bool flag=true;

        for(int j=0; j<m; j++)

        {

            if(ul[j]<x)

                flag=false;

        }

        if(flag==true)

            Ans=min(Ans,Cost);

    }

    if(Ans==10000007)

        cout<<-1<<endl;

    else

        cout<<Ans<<endl;





    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.542451565864138x):
#include <bits/stdc++.h>

using namespace std;

const int N = 109;

int n, m, x, c[N], a[N][N], p[N], ans = 0x3f3f3f3f;

void dfs(int s, int price) {

    if (s == n + 1) {

        for (int i = 1; i <= m; i++)

            if (p[i] < x)

                return;

        ans = min(ans, price);

        return;

    }

    dfs(s + 1, price);

    for (int i = 1; i <= m; i++)

        p[i] += a[s][i];

    dfs(s + 1, price + c[s]);

    for (int i = 1; i <= m; i++)

        p[i] -= a[s][i];

}

int main() {

    cin >> n >> m >> x;

    for (int i = 1; i <= n; i++) {

        cin >> c[i];

        for (int j = 1; j <= m; j++)

            cin >> a[i][j];

    }

    dfs(1, 0);

    if (ans > 1e9)

        cout << -1;

    else

        cout << ans;

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

typedef long long int ll;

ll A[14][14],C[14];

int main()

{

    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

    ll n,m,x;

    memset(A,0,sizeof(A));

    memset(C,0,sizeof(C));

    cin>>n>>m>>x;

    for(int i=0; i<n; i++)

    {

        cin>>C[i];

        for(int j=0; j<m; j++)

        {

            cin>>A[i][j];

        }

    }

    ll Ans=10000007;

    for(int i=0; i<=4095; i++)

    {

        string s = bitset<12>(i).to_string();

        reverse(s.begin(),s.end());

        ll Cost=0,ul[14];

        memset(ul,0,sizeof(ul));

        for(int j=0; j<n; j++)

        {

            if(s[j]=='0')

                continue;

            Cost+=C[j];

            for(int k=0; k<m; k++)

            {

                ul[k]+=A[j][k];

            }

        }

        bool flag=true;

        for(int j=0; j<m; j++)

        {

            if(ul[j]<x)

                flag=false;

        }

        if(flag==true)

            Ans=min(Ans,Cost);

    }

    if(Ans==10000007)

        cout<<-1<<endl;

    else

        cout<<Ans<<endl;





    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.4807267610185098x):
#include <iostream>

using namespace std;

struct ST

{

  int c;

  int v[15];

};

ST b[15];

int a[15];

int n, m, x;

int f = 0;

bool judge()

{

    for(int i = 0; i < m; i++)

        if(a[i] < x)

            return false;

    return true;

}

void dfs(int sum, int up, int t)

{

    if(f == 1)

        return;

    if(sum > up)

        return;

    if(judge())

    {

        f = 1;

        return;

    }

    if(t >= n)

        return;

    dfs(sum, up, t + 1);

    if(sum + b[t].c > up)

        return;

    for(int i = 0; i < m; i++)

        a[i] += b[t].v[i];

    dfs(sum + b[t].c, up, t + 1);

    for(int i = 0; i < m; i++)

        a[i] -= b[t].v[i];

}

int main()

{



    cin >> n >> m >>x;

    int L = 0, R = 0;

    for(int i = 0; i < n; i++)

    {

        cin >> b[i].c;

        R += b[i].c;

        for(int j = 0; j < m; j++)

            cin >> b[i].v[j];

    }

    int mid = 0;

    int ans = -1;

    while(L <= R)

    {

        mid = L + (R - L) / 2;

        f = 0;

        dfs(0, mid, 0);

        if(f == 1)

        {

            ans = mid;

            R = mid - 1;

        }

        else

            L = mid + 1;

    }

    cout << ans << endl;

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

typedef long long int ll;

ll A[14][14],C[14];

int main()

{

    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

    ll n,m,x;

    memset(A,0,sizeof(A));

    memset(C,0,sizeof(C));

    cin>>n>>m>>x;

    for(int i=0; i<n; i++)

    {

        cin>>C[i];

        for(int j=0; j<m; j++)

        {

            cin>>A[i][j];

        }

    }

    ll Ans=10000007;

    for(int i=0; i<=4095; i++)

    {

        string s = bitset<12>(i).to_string();

        reverse(s.begin(),s.end());

        ll Cost=0,ul[14];

        memset(ul,0,sizeof(ul));

        for(int j=0; j<n; j++)

        {

            if(s[j]=='0')

                continue;

            Cost+=C[j];

            for(int k=0; k<m; k++)

            {

                ul[k]+=A[j][k];

            }

        }

        bool flag=true;

        for(int j=0; j<m; j++)

        {

            if(ul[j]<x)

                flag=false;

        }

        if(flag==true)

            Ans=min(Ans,Cost);

    }

    if(Ans==10000007)

        cout<<-1<<endl;

    else

        cout<<Ans<<endl;





    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.5229430738897927x):
#include"iostream"



using namespace std;



int main()

{

	int n,m,x,i,j,a[15][15],s[15]={0},min,k;

	cin>>n>>m>>x;

	min=-1;

	for(i=0;i<n;i++)

		for(j=0;j<=m;j++)

			cin>>a[i][j];

	for(int i=1;i<(1<<n);i++)

	{

		for(k=0;k<=m;k++)

			s[k]=0;

		for(int j=0;j<n;j++)

		{

			if(i&(1<<j))

			{	

				for(k=0;k<=m;k++)

					s[k]+=a[j][k];

			}

		}

		for(k=1;k<=m;k++)

			if(s[k]<x) break;

		if(k>m&&((min==-1)||s[0]<min)) min=s[0];

	}

	cout<<min<<endl;

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int n,m,x;

int c[22];

int a[22][22];

int ptr;

string s[4444];

int q[22];

void dfs(string cnt){

	if(cnt.size()==n){

		s[ptr++]=cnt;

		return ;

	}

	dfs(cnt+'1');

	dfs(cnt+'0');

}

int main()

{

	cin>>n>>m>>x;

	for(int i=0;i<n;i++){

		cin>>c[i];

		for(int j=0;j<m;j++)

			cin>>a[i][j];

	}

	dfs("0");

	dfs("1");

	int ans=1e9;

	for(int i=0;i<ptr;i++){

		int cur=0;

		for(int j=0;j<m;j++)

			q[j]=0;

		for(int j=0;j<s[i].size();j++)

			if(s[i][j]=='1'){

				cur+=c[j];

				for(int k=0;k<m;k++)

					q[k]+=a[j][k];

			}

		bool flag=true;

		for(int j=0;j<m;j++)

			if(q[j]<x)

				flag=false;

		if(flag==true)

			ans=min(ans,cur);

	}

	if(ans==1e9)

		cout<<-1<<endl;

	else

		cout<<ans<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.1730731916817043x):
#include<bits/stdc++.h>

using namespace std;

int x[22];

int a,b,c;

int y[22][22];

int ans=1e9;

int sum;

int check[22];

void dfs(int i)

{

	if(i>a){

		for(int j=1;j<=b;j++)

			if(check[j]<c)

				return ;

		ans=min(ans,sum);

		return ;

	}

	dfs(i+1);

	sum+=x[i];

	for(int j=1;j<=b;j++)

		check[j]+=y[i][j];

	dfs(i+1);

	sum-=x[i];

	for(int j=1;j<=b;j++)

		check[j]-=y[i][j];

}

int main()

{

	cin>>a>>b>>c;

	for(int i=1;i<=a;i++){

		cin>>x[i];

		for(int j=1;j<=b;j++)

			cin>>y[i][j];

	}

	dfs(1);

	if(ans==1e9)

		cout<<-1<<endl;

	else

		cout<<ans<<endl;

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<vector>

#include<queue>

using namespace std;

typedef long long ll;

typedef pair<ll, ll> P;

ll inf = 1000000007;

int dx[4] = { 1,-1,0,0 };

int dy[4] = { 0,0,1,-1 };

vector<ll>to[200005];

ll c[15];

int main() {

	int n, m, x;

	cin >> n >> m >> x;

	vector<vector<ll>>a(n);

	for (int i = 0; i < n; i++) {

		cin >> c[i];

		a[i].resize(m);

		for (int j = 0; j < m; j++) {

			cin >> a[i][j];

		}

	}

	ll ans = inf;

	ll sum;

	for (int bit = 0; bit < (1 << n); bit++) {

		vector<ll>t(m, 0);

		sum = 0;

		bool ok = true;

		for (int i = 0; i < n; i++) {

			if (bit & (1 << i)) {

				for (int k = 0; k < m; k++) {

					t[k] += a[i][k];

				}

				sum += c[i];

			}

		}

		for (int j = 0; j < m; j++) {

			if (t[j] < x) {

				ok = false;

			}

		}

		if (ok) {

			ans = min(ans, sum);

		}

	}

	if (ans != inf) {

		cout << ans << endl;

	}

	else {

		cout << "-1" << endl;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 6.109565602096126x):
#include <cmath>

#include<iostream>

#include<vector>

#include<algorithm>

#include<map>

using namespace std;

typedef long long ll;

typedef pair<ll, ll> P;

ll inf = 1000000007;

ll c[15];

int main() {

	ll n, m, x;

	cin >> n >> m >> x;

	vector<vector<ll>>a(n);

	for (int i = 0; i < n; i++) {

		cin >> c[i];

	    a.resize(m);

		for (int j = 0; j < m; j++) {

			int x; cin >> x;

			a[i].push_back(x);

		}

	}

	ll ans = inf;

	for (int bit = 0; bit < (1 << n); bit++) {

		ll sum = 0;

		vector<ll>check(m, 0);

		bool ok = true;

		for (int i = 0; i < n; i++) {

			if (bit & (1 << i)) {

				sum += c[i];

				for (int j = 0; j < m; j++) {

					check[j] += a[i][j];

				}

			}

		}

		for (int k = 0; k < m; k++) {

			if (check[k] < x) {

				ok = false;

			}

		}

		if (ok) {

			ans = min(ans, sum);

		}



	}

	if (ans == inf) {

		cout << "-1" << endl;

	}

	else {

		cout << ans << endl;

	}

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<vector>

#include<queue>

using namespace std;

typedef long long ll;

typedef pair<ll, ll> P;

ll inf = 1000000007;

int dx[4] = { 1,-1,0,0 };

int dy[4] = { 0,0,1,-1 };

vector<ll>to[200005];

ll c[15];

int main() {

	int n, m, x;

	cin >> n >> m >> x;

	vector<vector<ll>>a(n);

	for (int i = 0; i < n; i++) {

		cin >> c[i];

		a[i].resize(m);

		for (int j = 0; j < m; j++) {

			cin >> a[i][j];

		}

	}

	ll ans = inf;

	ll sum;

	for (int bit = 0; bit < (1 << n); bit++) {

		vector<ll>t(m, 0);

		sum = 0;

		bool ok = true;

		for (int i = 0; i < n; i++) {

			if (bit & (1 << i)) {

				for (int k = 0; k < m; k++) {

					t[k] += a[i][k];

				}

				sum += c[i];

			}

		}

		for (int j = 0; j < m; j++) {

			if (t[j] < x) {

				ok = false;

			}

		}

		if (ok) {

			ans = min(ans, sum);

		}

	}

	if (ans != inf) {

		cout << ans << endl;

	}

	else {

		cout << "-1" << endl;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 6.107260095140806x):
#include <cmath>

#include<iostream>

#include<vector>

#include<algorithm>

#include<map>

using namespace std;

typedef long long ll;

typedef pair<ll, ll> P;

ll inf = 1000000007;

ll c[15];

int main() {

	ll n, m, x;

	cin >> n >> m >> x;

	vector<vector<ll>>a(n);

	a.resize(m);

	for (int i = 0; i < n; i++) {

		cin >> c[i];

		for (int j = 0; j < m; j++) {

			int x; cin >> x;

			a[i].push_back(x);

		}

	}

	ll ans = inf;

	for (int bit = 0; bit < (1 << n); bit++) {

		ll sum = 0;

		vector<ll>check(m, 0);

		bool ok = true;

		for (int i = 0; i < n; i++) {

			if (bit & (1 << i)) {

				sum += c[i];

				for (int j = 0; j < m; j++) {

					check[j] += a[i][j];

				}

			}

		}

		for (int k = 0; k < m; k++) {

			if (check[k] < x) {

				ok = false;

			}

		}

		if (ok) {

			ans = min(ans, sum);

		}



	}

	if (ans == inf) {

		cout << "-1" << endl;

	}

	else {

		cout << ans << endl;

	}

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<vector>

#include<queue>

using namespace std;

typedef long long ll;

typedef pair<ll, ll> P;

ll inf = 1000000007;

int dx[4] = { 1,-1,0,0 };

int dy[4] = { 0,0,1,-1 };

vector<ll>to[200005];

ll c[15];

int main() {

	int n, m, x;

	cin >> n >> m >> x;

	vector<vector<ll>>a(n);

	for (int i = 0; i < n; i++) {

		cin >> c[i];

		a[i].resize(m);

		for (int j = 0; j < m; j++) {

			cin >> a[i][j];

		}

	}

	ll ans = inf;

	ll sum;

	for (int bit = 0; bit < (1 << n); bit++) {

		vector<ll>t(m, 0);

		sum = 0;

		bool ok = true;

		for (int i = 0; i < n; i++) {

			if (bit & (1 << i)) {

				for (int k = 0; k < m; k++) {

					t[k] += a[i][k];

				}

				sum += c[i];

			}

		}

		for (int j = 0; j < m; j++) {

			if (t[j] < x) {

				ok = false;

			}

		}

		if (ok) {

			ans = min(ans, sum);

		}

	}

	if (ans != inf) {

		cout << ans << endl;

	}

	else {

		cout << "-1" << endl;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 6.124288672584757x):
#include <cmath>

#include<iostream>

#include<vector>

#include<algorithm>

#include<map>

using namespace std;

typedef long long ll;

typedef pair<ll, ll> P;

ll inf = 1000000007;

ll c[15];

int main() {

	ll n, m, x;

	cin >> n >> m >> x;

	vector<vector<ll>>a(n);

	

	for (int i = 0; i < n; i++) {

		cin >> c[i];

		a[i].resize(m);

		for (int j = 0; j < m; j++) {

			cin >> a[i][j];

		}

	}

	ll ans = inf;

	for (int bit = 0; bit < (1 << n); bit++) {

		ll sum = 0;

		vector<ll>check(m, 0);

		bool ok = true;

		for (int i = 0; i < n; i++) {

			if (bit & (1 << i)) {

				sum += c[i];

				for (int j = 0; j < m; j++) {

					check[j] += a[i][j];

				}

			}

		}

		for (int k = 0; k < m; k++) {

			if (check[k] < x) {

				ok = false;

			}

		}

		if (ok) {

			ans = min(ans, sum);

		}



	}

	if (ans == inf) {

		cout << "-1" << endl;

	}

	else {

		cout << ans << endl;

	}

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

using ll=long long;

using vi = vector<int>;

using vvi = vector<vector<int>>;

using vl = vector<ll>;

using vvl = vector<vector<ll>>;

using pi = pair<int, int>;

using pl = pair<ll, ll>;

#define all(x) x.begin(),x.end()

#define rep(i,j,n) for (int i = j; i < (int)(n); i++)

#define _GLIBCXX_DEBUG

#define n_p(v) next_permutation(v.begin(),v.end())

#define print(a) cout<<(a)<<endl;

#define to_ll(b) stoll(b)

#define MOD 1000000007



int main(){

	int N,M,X; cin>>N>>M>>X;

	vector<int> mny(N);

	vvi power(N,vi(M));

	rep(i,0,N){

		int c;cin>>c;

		mny[i]=c;

		rep(j,0,M){

			int a; cin>>a;

			power.at(i).at(j)=a;

		}

	}

	ll ans=-1; 

	for (ll tmp=0;tmp<(1<<12);tmp++){

		bitset<12> s(tmp);

		vi v(M);

		ll cnt=0;

		rep(i,0,N){

			if(s.test(i)){

				cnt+=mny[i];

				rep(j,0,M){

					v[j]+=power.at(i).at(j);

				}

			}

		}

		sort(all(v));

		if(v[0]>=X && ans==-1){

			ans=cnt;

		}

		else if(v[0]>=X){

			ans = min(ans,cnt);

		}

	}

	cout<<ans;

	return 0;

					

		

	

}

// Faster C++ solution for the same problem (measured speedup: 1.5433143025599385x):
#include <bits/stdc++.h>

using namespace std;

using ll=long long;

using vi = vector<int>;

using vvi = vector<vector<int>>;

using vl = vector<ll>;

using vvl = vector<vector<ll>>;

using pi = pair<int, int>;

using pl = pair<ll, ll>;

#define all(x) x.begin(),x.end()

#define rep(i,j,n) for (int i = j; i < (int)(n); i++)

#define _GLIBCXX_DEBUG

#define n_p(v) next_permutation(v.begin(),v.end())

#define print(a) cout<<(a)<<endl;

#define to_ll(b) stoll(b)

#define MOD 1000000007



int main(){

	int N,M,X; cin>>N>>M>>X;

	vector<int> mny(N);

	vvi power(N,vi(M));

	rep(i,0,N){

		int c;cin>>c;

		mny[i]=c;

		rep(j,0,M){

			int a; cin>>a;

			power.at(i).at(j)=a;

		}

	}

	ll ans=-1; 

	for (ll tmp=0;tmp<(1<<N);tmp++){

		bitset<12> s(tmp);

		vi v(M);

		ll cnt=0;

		rep(i,0,N){

			if(s.test(i)){

				cnt+=mny[i];

				rep(j,0,M){

					v[j]+=power.at(i).at(j);

				}

			}

		}

		sort(all(v));

		if(v[0]>=X && ans==-1){

			ans=cnt;

		}

		else if(v[0]>=X){

			ans = min(ans,cnt);

		}

	}

	cout<<ans;

	return 0;

					

		

	

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1LL << 60;



int main() {

    int N, M, X; cin >> N >> M >> X;

    vector<int> C(N);

    vector<vector<int>> A(N, vector<int>(M));

    for (int i = 0; i < N; i++) {

        scanf("%d", &C[i]);

        for (int j = 0; j < M; j++) {

            scanf("%d", &A[i][j]);

        }

    }



    int ans = 10000000;

    for (int tmp = 0; tmp < (1 << 12); tmp++) {

        bitset<12> s(tmp);

        int sum = 0;

        vector<int> Alg(M);

        for (int i = 0; i < N; i++) {

            if (s.test(i)) {

                sum += C[i];

                for (int j = 0; j < M; j++) {

                    Alg[j] += A[i][j];

                }

            }

        }



        bool flag = true;

        for (int i = 0; i < M; i++) {

            if (Alg[i] < X) flag = false;

        }

        if (flag) {

            chmin(ans, sum);

        }

    }



    if (ans == 10000000) {

        cout << -1 << endl;

    } else {

        cout << ans << endl;

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.4856686032626463x):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1LL << 60;



int N, M, X;

vector<int> C;

vector<vector<int>> A;



bool ok(vector<int> &ALG) {

    for (int i = 0; i < M; i++) {

        if (ALG[i] < X) return false;

    }



    return true;

}



int dfs(vector<int> &B) {

    if (B.size() == N) {

        vector<int> ALG(M);

        int cost = 0;

        for (int i = 0; i < N; i++) {

            if (B[i]) {

                cost += C[i];

                for (int j = 0; j < M; j++) {

                    ALG[j] += A[i][j];

                }

            }

        }



        if (ok(ALG)) {

            return cost;

        }



        return 1000000000;

    }



    int ans = 1000000000;

    for (int i = 0; i < 2; i++) {

        B.push_back(i);

        chmin(ans, dfs(B));

        B.pop_back();

    }



    return ans;

}



int main() {

    cin >> N >> M >> X;

    C.resize(N);

    A.resize(N, vector<int>(M));

    for (int i = 0; i < N; i++) {

        cin >> C[i];

        for (int j = 0; j < M; j++) {

            cin >> A[i][j];

        }

    }

    vector<int> B;



    int ans = dfs(B);



    if (ans == 1000000000) {

        cout << -1 << endl;

    } else {

        cout << ans << endl;

    }

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<string>

#include<vector>

#include<cmath>

#include<algorithm>

#include <sstream>

#include <iomanip>



using namespace std;



int64_t binary(int64_t bina) {

	int64_t ans = 0;

	for (int64_t i = 0; bina > 0; i++)

	{

		ans = ans + (bina % 2)*pow(10, i);

		bina = bina / 2;

	}

	return ans;

}



int main() {

	

	int64_t N, M, X;



	vector<int64_t> C;



	cin >> N >> M >> X;

	int64_t A[12][12];





	





	for (int64_t i = 0; i < N; i++) {

		int64_t c;

		cin >> c;

		C.push_back(c);



		for (int64_t j = 0; j < M; j++) {

			

			cin >> A[i][j];

			

		

		}





	}

	



	



	string str;

	string one="1";

	int64_t min_value = 9223372036854775807;

	

	for (int64_t i = 0; i < pow(2, N); i++) {

	

		ostringstream ss;

		ss << setfill('0') << setw(N) << binary(i);

		str = ss.str();

		

		vector<int64_t> ability(M);

		int64_t value=0;

		

		for (int j = 0; j < N; j++) {

		

			if (str[j] == one[0]) {

				

				for (int k = 0; k < M; k++) {

					ability[k] += A[j][k];

					

				}

				value += C[j];

				

			}





		}

		int64_t count = 0;

		for (int k = 0; k < M; k++) {

			if (ability[k] >= X)count++;

			

		}

		



		if (count == M) {

			if (min_value > value) {

				min_value = value;

			}





		}

	



	}



	if (min_value == 9223372036854775807) {

		cout << -1;

		return 0;

	}

	else {

		cout << min_value;

		return 0;

	}



	





}

// Faster C++ solution for the same problem (measured speedup: 1.2151975776400026x):
#include<iostream>

#include<string>

#include<vector>

#include<cmath>

#include<algorithm>

#include <sstream>

#include <iomanip>



using namespace std;



int64_t binary(int64_t bina) {

	int64_t ans = 0;

	for (int64_t i = 0; bina > 0; i++)

	{

		ans = ans + (bina % 2)*pow(10, i);

		bina = bina / 2;

	}

	return ans;

}



int main() {

	

	int64_t N, M, X;



	vector<int64_t> C;



	cin >> N >> M >> X;

	int64_t A[12][12];





	





	for (int64_t i = 0; i < N; i++) {

		int64_t c;

		cin >> c;

		C.push_back(c);



		for (int64_t j = 0; j < M; j++) {

			

			cin >> A[i][j];

			

		

		}





	}

	



	



	string str;

	string one="1";

	int64_t min_value = 9223372036854775807;

	

	for (int64_t i = 0; i < pow(2, N); i++) {

	

	

		

		vector<int64_t> ability(M);

		int64_t value=0;

		

		for (int j = 0; j < N; j++) {

		

			if (i&1<<j) {

				

				for (int k = 0; k < M; k++) {

					ability[k] += A[j][k];

					

				}

				value += C[j];

				

			}





		}

		int64_t count = 0;

		for (int k = 0; k < M; k++) {

			if (ability[k] >= X)count++;

			

		}

		



		if (count == M) {

			if (min_value > value) {

				min_value = value;

			}





		}

	



	}



	if (min_value == 9223372036854775807) {

		cout << -1;

		return 0;

	}

	else {

		cout << min_value;

		return 0;

	}



	





}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL_DEBUG

  #include "LOCAL_DEBUG.hpp"

#endif

#define int long long

const int INF = 1LL << 60;



signed main(){



  int n, m, x; cin >> n >> m >> x;

  vector<int> c(n);

  vector<vector<int>> a(n, vector<int>(m));

  for(int i = 0; i < n; i++){

    cin >> c[i];

    for(int j = 0; j < m; j++){

      cin >> a[i][j];

    }

  }



  int ans = INF;

  for(int i = 0; i < 1 << n; i++){

    vector<int> v(m, 0);

    int cost = 0;

    for(int j = 0; j < n; j++){

      if(i >> j & 1){

        for(int k = 0; k < m; k++){

          v[k] += a[j][k];

        }

        cost += c[j];

      }

    }

    bool judge = true;

    for(int j = 0; j < m; j++){

      if(v[j] < x) judge = false;

    }

    if(judge) ans = min(ans, cost);

  }

  if(ans == INF) ans = -1;

  cout << ans << endl;



  return 0;

}


// Faster C++ solution for the same problem (measured speedup: 4.92216330532003x):
#include <cstdio>

#include <algorithm>

using namespace std;

int n,m,x;

int c[15],a[15][15],b[15],d[15],len,sum=100000000,cost;

void init(){//数据读取

	int i,j;

	scanf("%d%d%d",&n,&m,&x);

	for(i=1;i<=n;i++){

		scanf("%d",&c[i]);

		for(j=1;j<=m;j++)

			scanf("%d",&a[i][j]);

	}

}

void dfs(int step){

	int i,j,k;

	if(step==len+1){//深搜结束条件

		for(k=1;k<=m;k++)d[k]=0;//d[k]表示被选择的书店，在k列位置上的和

		for(j=1;j<=len;j++)

			for(k=1;k<=m;k++)

				d[k]+=a[b[j]][k];//计算被选择的书店，在k列位置上的和

		for(k=1;k<=m;k++)

			if(d[k]<x)return;//不满足条件

		cost=0;

		for(j=1;j<=len;j++)cost+=c[b[j]];//计算花费

		sum=min(sum,cost);//找最小值

		return ;

	}

	for(i=b[step-1]+1;i<=n;i++)//找组合情况，就让后查找的位置越来越大，请注意i=b[step-1]+1

		b[step]=i,dfs(step+1);

}

int main(){

	init();

	for(len=1;len<=n;len++)//len界定选择的书店的数量

		b[0]=0,dfs(1);

	if(sum==100000000)printf("-1\n");//没找到

	else printf("%d\n",sum);

	return 0;

}