Language: C++

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    res = LINF;
    int D,G; cin >> D >> G;
    vector<ll> p(D),c(D);
    for(int i = 0; i < D;i++) cin >> p[i] >> c[i];
    
    G/= 100;
    for(auto& v:c) v/=100;
    
    for(int i = 0; i < (1<<D);i++){
        ll L = G;
        ll cnt = 0;
        for(int j = 0; j < D;j++){
            if((i>>j)&1){
                L -= (j+1)*p[j]+c[j];
                cnt += p[j];
            }
        }
        if(L <= 0){
            res = min(res,cnt);
            continue;
        }
        for(int j = D-1;j>=0;j--){
            if((i>>j)&1) continue;
            ll num = min(p[j],(L+j)/(j+1));
            L -= num*(j+1);
            cnt += num;
            if(L <= 0) break;
        }
        if(L <= 0) res = min(res,cnt);
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<string>() << endl;
    return 0;
}


Compiler output:
a.cc: In instantiation of 'Type solve(Type) [with Type = std::__cxx11::basic_string<char>]':
a.cc:61:55:   required from here
   61 |     cout << fixed << setprecision(15) << solve<string>() << endl;
      |                                          ~~~~~~~~~~~~~^~
a.cc:26:11: warning: overflow in conversion from 'll' {aka 'long long int'} to 'char' changes value from '1000000000000000000' to '0' [-Woverflow]
   26 |     res = LINF;
      |           ^~~~
a.cc:44:22: error: no matching function for call to 'min(std::__cxx11::basic_string<char>&, ll&)'
   44 |             res = min(res,cnt);
      |                   ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 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:44:22: note:   deduced conflicting types for parameter 'const _Tp' ('std::__cxx11::basic_string<char>' and 'll' {aka 'long long int'})
   44 |             res = min(res,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:44:22: note:   'std::__cxx11::basic_string<char>' is not derived from 'std::initializer_list<_Tp>'
   44 |             res = min(res,cnt);
      |                   ~~~^~~~~~~~~
a.cc:54:29: error: no matching function for call to 'min(std::__cxx11::basic_string<char>&, ll&)'
   54 |         if(L <= 0) res = min(res,cnt);
      |                          ~~~^~~~~~~~~
/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:54:29: note:   deduced conflicting types for parameter 'const _Tp' ('std::__cxx11::basic_string<char>' and 'll' {aka 'long long int'})
   54 |         if(L <= 0) res = min(res,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
/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:54:29: note:   'std::__cxx11::basic_string<char>' is not derived from 'std::initializer_list<_Tp>'
   54 |         if(L <= 0) res = min(res,cnt);
      |                          ~~~^~~~~~~~~