Language: C++

#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<climits>
#include<bitset>
#include<algorithm>
using namespace std;

int D, G;

int main(void)
{
	cin >> D >> G;

	vector<int> p(D), c(D);
	for(int i=0; i<D; i++)
		cin >> p[i] >> c[i];

	vector<vector<int>> imos(D, vector<int>(1, 0));
	for(int i=0; i<D; i++){
		for(int j=0; j<p[i]; j++){
			imos[i].push_back(imos[i].back() + 100*(1+i));
		}
		imos[i][p[i]] += c[i];
	}

	int ret = INT_MAX;
	for(int i=(1<<D)-1; i>=0; i--){
		int score = G;
		int cnt = 0;
		int pos = -1;
		bitset<10> bit(i);
		for(int j=0; j<D; j++){
			if(bit[j] == true){
				score -= imos[j].back();
				cnt += p[j];
			}
			else
				pos = j;
		}

		if(score <= 0){
			ret = min(ret, cnt);
			continue;
		}

		if(pos == -1){
			continue;
		}
		auto it = lower_bound(imos[pos].begin(), imos[pos].begin()+p[pos], score);
		if(it != imos[pos].begin()+p[pos])
			ret = min(ret, cnt+(it-imos[pos].begin()));
	}

	cout << ret << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:34: error: no matching function for call to 'min(int&, __gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type)'
   53 |                         ret = min(ret, cnt+(it-imos[pos].begin()));
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:53:34: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type' {aka 'long int'})
   53 |                         ret = min(ret, cnt+(it-imos[pos].begin()));
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:7:
/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:53:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   53 |                         ret = min(ret, cnt+(it-imos[pos].begin()));
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~