Language: C++

#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <bitset> // bitset
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
using namespace std;

int main() {
  int N, M, X;
  cin >> N >> M >> X;
  vector<vector<int>> skill(N, vector<int>(M));
  vector<int> cost(N);
  for(int i=0; i < N; i++){
    cin >> cost.at(i);
    for(int j =0; j < M; j++){
      cin >> skill.at(i).at(j);
    }
  }
  int ans = 12345678;
  for(int k=0; k< 1<<n; k++){
    vector<int> level(M);
    int money =0;
    for(int i = 0; i << N; i++){
      if((k>>i)&1){
        money += cost.at(i);
        for(int j=0;j<M;j++){
          level.at(j) += skill.at(i).at(j);
        }
      }
    }
    bool ok = true;
    for(int i =0; i<M; i++){
      if(level.at(i) < X){
        ok = false;
      }
    }
    if(ok == true){
      cout << min(ans,cost) << endl;
    }
    else{cout << -1 << endl;
        }
  }
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: 'n' was not declared in this scope
   20 |   for(int k=0; k< 1<<n; k++){
      |                      ^
a.cc:38:18: error: no matching function for call to 'min(int&, std::vector<int>&)'
   38 |       cout << min(ans,cost) << endl;
      |               ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:38:18: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<int>')
   38 |       cout << min(ans,cost) << endl;
      |               ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:38:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   38 |       cout << min(ans,cost) << endl;
      |               ~~~^~~~~~~~~~