Language: C++

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int d, g;
long ans = 1e9;

// bool dfs(int score, int cnt, vector<int> p, vector<int> c, int i) {
//   if (score >= g) {
//     ans = min(ans, cnt);
//     return true;
//   }

//   if (i == d) return true;

//   dfs(score + p[i] * (i + 1) + c[i], cnt + p[i], p, c, i + 1);  // compの場合

//     int j = d-1;
//     int k = 0 ;
//     while(true){
//     if(dfs(score + j * (d - i), cnt + j, p, c, i + 1)) break;
//     }
// }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  cin >> d >> g;
  g /= 100;

  vector<int> p(d), c(g);

  for (int i = 0; i < d; i++) {
    cin >> p[i] >> c[i];
    c[i] /= 100;
  }

  //   dfs(0, 0, p, c, 0);

  for (int i = 0; i < 1 << d; i++) {
    int cnt = 0;
    int score = 0;

    for (int j = 0; j < d; j++) {  // compする場合
      if (i >> j & 1) {
        cnt += p[j];
        score += p[j] * (j + 1);
        score += c[j];
      }
    }
    for (int j = d - 1; j >= 0;
         j--) {  // compしない場合点数が大きいものから加算する
      if (~i >> j & 1) {
        for (int k = 0; k < p[j] && score < g; k++) {
          score += j + 1;
          cnt++;
        }
      }
    }
    if (score >= g) {
      ans = min(ans, cnt);
    }
  }

  cout << ans << '\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:64:16: error: no matching function for call to 'min(long int&, int&)'
   64 |       ans = min(ans, cnt);
      |             ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 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:64:16: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
   64 |       ans = min(ans, cnt);
      |             ~~~^~~~~~~~~~
/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:
/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:64:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   64 |       ans = min(ans, cnt);
      |             ~~~^~~~~~~~~~