Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
  ll D, G;
  cin >> D >> G;
  ll p[D], c[D];
  for(int i = 0; i < D; i++){
   cin >> p[i] >> c[i];
  }
  ll e[D];
  for(int i = 0; i < D; i++){//効率入力
    e[D] = (100*(i+1)*p[i]+c[i])/p[i];
  }
  int frag = 1;
  int ans = 0;
  int sub = 0;
  int sum = 0;
  int temp;
  while(frag){
    for(int i = D-1; i >= 0; i--){//max調べる
      if(e[i] > 0){
        temp = i;
      }
    }
    if(G <= sum + (temp+1)*100*p[temp]){
      for(int j = 0; j < p[temp]; j++){
        sub++;
        sum += (temp+1)*100;
        if(sum >= G){
          frag = 0;
          break;
        }
      }
    }
    temp = 0;
    for(int i = 0; i < D; i++){//max効率調べる
      if(e[temp] < e[i]){
      temp = i;
      }
    }
    if(G <= sum + (temp+1)*100*p[temp]){
      ans+=min(sub,p[temp]);
    }
    else{
      temp = 0;
      for(int i = 0; i < D; i++){//max効率調べる
        if(e[temp] < e[i]){
          temp = i;
        }
      }
      sum += (i+1)*100*p[temp];
      ans += p[temp];
      e[temp] = 0;
    }
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:15: error: no matching function for call to 'min(int&, ll&)'
   44 |       ans+=min(sub,p[temp]);
      |            ~~~^~~~~~~~~~~~~
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:15: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   44 |       ans+=min(sub,p[temp]);
      |            ~~~^~~~~~~~~~~~~
/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:15: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   44 |       ans+=min(sub,p[temp]);
      |            ~~~^~~~~~~~~~~~~
a.cc:53:15: error: 'i' was not declared in this scope
   53 |       sum += (i+1)*100*p[temp];
      |               ^