Language: C++

#include <bits/stdc++.h>
using namespace std;
#define itn int
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) x.begin(), x.end()
#define pb  push_back
#define mb  make_pair
#define fi  first
#define se  second

typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;
const ll mod = 1000000007;

struct data
{
    int c;
    vector<ll> p;
};
bool great(const data &a, const data &b)
{
    return a.c < b.c;
}
void solve()
{
    int n, m, x;
    cin >> n >> m >> x;
    ll cost = 0;
    vector<data> v(n);
    vector<ll> power(m,0);
    rep(i,0,n)
    {
        vector<ll> temp(m);
        cin >> v[i].c;
        rep(j,0,m)
        {
            cin >> temp[j];
            power[j] += temp[j];
        }
        v[i].p = temp;
        cost += v[i].c;
    }
    sort(all(v), great);
    rep(i,0,m)
    {
        if(power[i] < x)
        {
            cout << -1;
            return;
        }
    }
    for(int i = n-1; i >= 0; i--)
    {
        bool stop = false;
        rep(j,0,m)
        {
            if(power[j] - v[i].p[j] < x)
            {
                stop = true;
                break;
            }
        }
        if(!stop)
        {
            rep(j,0,m)
            {
                power[j] -= v[i].p[j];
            }
            cost -= v[i].c;
        }
    }
    cout << cost;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    //int t; cin >> t; while(t--)
    solve();
	return 0;
}


Compiler output:
a.cc:21:18: error: reference to 'data' is ambiguous
   21 | bool great(const data &a, const data &b)
      |                  ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:16:8: note:                 'struct data'
   16 | struct data
      |        ^~~~
a.cc:21:33: error: reference to 'data' is ambiguous
   21 | bool great(const data &a, const data &b)
      |                                 ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:16:8: note:                 'struct data'
   16 | struct data
      |        ^~~~
a.cc: In function 'bool great(const int&, const int&)':
a.cc:23:14: error: request for member 'c' in 'a', which is of non-class type 'const int'
   23 |     return a.c < b.c;
      |              ^
a.cc:23:20: error: request for member 'c' in 'b', which is of non-class type 'const int'
   23 |     return a.c < b.c;
      |                    ^
a.cc: In function 'void solve()':
a.cc:30:16: error: template argument 1 is invalid
   30 |     vector<data> v(n);
      |                ^
a.cc:30:16: error: template argument 2 is invalid
a.cc:35:17: error: invalid types 'int[int]' for array subscript
   35 |         cin >> v[i].c;
      |                 ^
a.cc:41:10: error: invalid types 'int[int]' for array subscript
   41 |         v[i].p = temp;
      |          ^
a.cc:42:18: error: invalid types 'int[int]' for array subscript
   42 |         cost += v[i].c;
      |                  ^
a.cc:5:18: error: request for member 'begin' in 'v', which is of non-class type 'int'
    5 | #define all(x) x.begin(), x.end()
      |                  ^~~~~
a.cc:44:10: note: in expansion of macro 'all'
   44 |     sort(all(v), great);
      |          ^~~
a.cc:5:29: error: request for member 'end' in 'v', which is of non-class type 'int'
    5 | #define all(x) x.begin(), x.end()
      |                             ^~~
a.cc:44:10: note: in expansion of macro 'all'
   44 |     sort(all(v), great);
      |          ^~~
a.cc:58:28: error: invalid types 'int[int]' for array subscript
   58 |             if(power[j] - v[i].p[j] < x)
      |                            ^
a.cc:68:30: error: invalid types 'int[int]' for array subscript
   68 |                 power[j] -= v[i].p[j];
      |                              ^
a.cc:70:22: error: invalid types 'int[int]' for array subscript
   70 |             cost -= v[i].c;
      |                      ^