Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef  ll;
typedef long l;
#define rep(i,n) for(ll i = 0; i<n ; ++i)
#define repj(j,i,n) for(ll j = i; j<n; ++j)
#define repd(j,i,n) for(ll j = i; j>=n ; --j)
#define vi vector<int>
#define vll vector<ll>
#define vp vector<pair<int,int>>
#define vpl vector<pair<ll,ll>>
#define si set<int>
#define sll set<ll>
#define mp make_pair
#define pb push_back
#define f first
#define sec second
#define len length()
#define mod 1000000007

ll modex(ll a, ll b){ll ans = 1; a%=mod; if(a == 0) return 0; while(b>0){ if(b&1) ans = (ans*a)%mod; b = b>>1; a = (a*a)%mod;} return ans;}
ll gcd(ll a, ll b){ if (b == 0) return a; return gcd(b, a % b);}

void solve(){
    ll n, m, k;
    cin>>n>>m>>k;
    vpl v;
    ll c, cost = 0;
    ll a[n][m];
    ll sum[m] = {0};
    rep(i, n){
        cin>>c;
        cost+=c;
        v.pb(mp(c,i));
        rep(j, m){
            cin>>a[i][j];
            sum[j]+=a[i][j];
        }
    }
    sort(v.begin(), v.end());
    rep(i, m){
        if(sum[i] < k){
            cout<<-1;
            return;
        }
    }
    repd(i, n-1, 0){
        ll temp[m] = {0};
        rep(j, m) temp[j] = sum[j];
        int flag = 1;
        rep(j, m){
            temp[j]-=a[v[i].sec][j];
            if(temp[j] < k) flag = 0;
        }
        if(!flag) continue;
        rep(j ,m ){
            if(flag) sum[j] = temp[j];
        }
        cost-=v[i].f;
    }
    cout<<cost;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        freopen("error.txt", "w", stderr);
    #endif

    //int q; cin>>q; while(q--)
        solve();

    #ifndef ONLINE_JUDGE
     cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
}

Compiler output:
a.cc:3:10: error: 'll' does not name a type; did you mean 'vll'?
    3 | typedef  ll;
      |          ^~
      |          vll
a.cc:21:1: error: 'll' does not name a type; did you mean 'l'?
   21 | ll modex(ll a, ll b){ll ans = 1; a%=mod; if(a == 0) return 0; while(b>0){ if(b&1) ans = (ans*a)%mod; b = b>>1; a = (a*a)%mod;} return ans;}
      | ^~
      | l
a.cc:22:1: error: 'll' does not name a type; did you mean 'l'?
   22 | ll gcd(ll a, ll b){ if (b == 0) return a; return gcd(b, a % b);}
      | ^~
      | l
a.cc: In function 'void solve()':
a.cc:25:5: error: 'll' was not declared in this scope; did you mean 'l'?
   25 |     ll n, m, k;
      |     ^~
      |     l
a.cc:26:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   26 |     cin>>n>>m>>k;
      |          ^
      |          yn
a.cc:26:13: error: 'm' was not declared in this scope; did you mean 'tm'?
   26 |     cin>>n>>m>>k;
      |             ^
      |             tm
a.cc:26:16: error: 'k' was not declared in this scope
   26 |     cin>>n>>m>>k;
      |                ^
a.cc:11:30: error: template argument 1 is invalid
   11 | #define vpl vector<pair<ll,ll>>
      |                              ^~
a.cc:27:5: note: in expansion of macro 'vpl'
   27 |     vpl v;
      |     ^~~
a.cc:11:30: error: template argument 2 is invalid
   11 | #define vpl vector<pair<ll,ll>>
      |                              ^~
a.cc:27:5: note: in expansion of macro 'vpl'
   27 |     vpl v;
      |     ^~~
a.cc:28:7: error: expected ';' before 'c'
   28 |     ll c, cost = 0;
      |       ^~
      |       ;
a.cc:29:7: error: expected ';' before 'a'
   29 |     ll a[n][m];
      |       ^~
      |       ;
a.cc:30:7: error: expected ';' before 'sum'
   30 |     ll sum[m] = {0};
      |       ^~~~
      |       ;
a.cc:31:9: error: expected ';' before 'i'
   31 |     rep(i, n){
      |         ^
a.cc:5:25: note: in definition of macro 'rep'
    5 | #define rep(i,n) for(ll i = 0; i<n ; ++i)
      |                         ^
a.cc:31:9: error: 'i' was not declared in this scope
   31 |     rep(i, n){
      |         ^
a.cc:5:32: note: in definition of macro 'rep'
    5 | #define rep(i,n) for(ll i = 0; i<n ; ++i)
      |                                ^
a.cc:32:14: error: 'c' was not declared in this scope
   32 |         cin>>c;
      |              ^
a.cc:33:9: error: 'cost' was not declared in this scope; did you mean 'cosl'?
   33 |         cost+=c;
      |         ^~~~
      |         cosl
a.cc:15:12: error: request for member 'push_back' in 'v', which is of non-class type 'int'
   15 | #define pb push_back
      |            ^~~~~~~~~
a.cc:34:11: note: in expansion of macro 'pb'
   34 |         v.pb(mp(c,i));
      |           ^~
a.cc:35:13: error: expected ';' before 'j'
   35 |         rep(j, m){
      |             ^
a.cc:5:25: note: in definition of macro 'rep'
    5 | #define rep(i,n) for(ll i = 0; i<n ; ++i)
      |                         ^
a.cc:35:13: error: 'j' was not declared in this scope
   35 |         rep(j, m){
      |             ^
a.cc:5:32: note: in definition of macro 'rep'
    5 | #define rep(i,n) for(ll i = 0; i<n ; ++i)
      |                                ^
a.cc:36:18: error: 'a' was not declared in this scope
   36 |             cin>>a[i][j];
      |                  ^
a.cc:37:13: error: 'sum' was not declared in this scope
   37 |             sum[j]+=a[i][j];
      |             ^~~
a.cc:40:12: error: request for member 'begin' in 'v', which is of non-class type 'int'
   40 |     sort(v.begin(), v.end());
      |            ^~~~~
a.cc:40:23: error: request for member 'end' in 'v', which is of non-class type 'int'
   40 |     sort(v.begin(), v.end());
      |                       ^~~
a.cc:41:9: error: expected ';' before 'i'
   41 |     rep(i, m){
      |         ^
a.cc:5:25: note: in definition of macro 'rep'
    5 | #define rep(i,n) for(ll i = 0; i<n ; ++i)
      |                         ^
a.cc:41:9: error: 'i' was not declared in this scope
   41 |     rep(i, m){
      |         ^
a.cc:5:32: note: in definition of macro 'rep'
    5 | #define rep(i,n) for(ll i = 0; i<n ; ++i)
      |                                ^
a.cc:42:12: error: 'sum' was not declared in this scope
   42 |         if(sum[i] < k){
      |            ^~~
a.cc:47:10: error: expected ';' before 'i'
   47 |     repd(i, n-1, 0){
      |          ^
a.cc:7:28: note: in definition of macro 'repd'
    7 | #define repd(j,i,n) for(ll j = i; j>=n ; --j)
      |                            ^
a.cc:47:10: error: 'i' was not declared in this scope
   47 |     repd(i, n-1, 0){
      |          ^
a.cc:7:35: note: in definition of macro 'repd'
    7 | #define repd(j,i,n) for(ll j = i; j>=n ; --j)
      |                                   ^
a.cc:48:11: error: expected ';' before 'temp'
   48 |         ll temp[m] = {0};
      |           ^~~~~
      |           ;
a.cc:49:13: error: expected ';' before 'j'
   49 |         rep(j, m) temp[j] = sum[j];
      |             ^
a.cc:5:25: note: in definition of macro 'rep'
    5 | #define rep(i,n) for(ll i = 0; i<n ; ++i)
      |                         ^
a.cc:49:13: error: 'j' was not declared in this scope
   49 |         rep(j, m) temp[j] = sum[j];
      |             ^
a.cc:5:32: note: in definition of macro 'rep'
    5 | #define rep(i,n) for(ll i = 0; i<n ; ++i)
      |                                ^
a.cc:49:19: error: 'temp' was not declared in this scope; did you mean 'tm'?
   49 |         rep(j, m) temp[j] = sum[j];
      |                   ^~~~
      |                   tm
a.cc:49:29: error: 'sum' was not declared in this scope
   49 |         rep(j, m) temp[j] = sum[j];
      |                             ^~~
a.cc:51:13: error: expected ';' before 'j'
   51 |         rep(j, m){
      |             ^
a.cc:5:25: note: in definition of macro 'rep'
    5 | #define rep(i,n) for(ll i = 0; i<n ; ++i)
      |                         ^
a.cc:51:13: error: 'j' was not declared in this scope
   51 |         rep(j, m){
      |             ^
a.cc:5:32: note: in definition of macro 'rep'
    5 | #define rep(i,n) for(ll i = 0; i<n ; ++i)
      |                                ^
a.cc:52:13: error: 'temp' was not declared in this scope; did you mean 'tm'?
   52 |             temp[j]-=a[v[i].sec][j];
      |             ^~~~
      |             tm
a.cc:52:22: error: 'a' was not declared in this scope
   52 |             temp[j]-=a[v[i].sec][j];
      |                      ^
a.cc:56:13: error: expected ';' before 'j'
   56 |         rep(j ,m ){
      |             ^
a.cc:5:25: note: in definition of macro 'rep'
    5 | #define rep(i,n) for(ll i = 0; i<n ; ++i)
      |                         ^
a.cc:56:13: error: 'j' was not declared in this scope
   56 |         rep(j ,m ){
      |             ^
a.cc:5:32: note: in definition of macro 'rep'
    5 | #define rep(i,n) for(ll i = 0; i<n ; ++i)
      |                                ^
a.cc:57:22: error: 'sum' was not declared in this scope
   57 |             if(flag) sum[j] = temp[j];
      |                      ^~~
a.cc:57:31: error: 'temp' was not declared in this scope; did you mean 'tm'?
   57 |             if(flag) sum[j] = temp[j];
      |                               ^~~~
      |                               tm
a.cc:59:9: error: 'cost' was not declared in this scope; did you mean 'cosl'?
   59 |         cost-=v[i].f;
      |         ^~~~
      |         cosl
a.cc:61:11: error: 'cost' was not declared in this scope; did you mean 'cosl'?
   61 |     cout<<cost;
      |           ^~~~
      |           cosl