Language: C++

#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#define INF 1e8
using namespace std;

int n,m;
int hp[101];
int dp[2][100001];
int mp[101],t[101],d[101];
int main(void){
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		for(int i=0;i<n;i++){
			scanf("%d",&hp[i]);
		}
		scanf("%d",&m);
		for(int i=0;i<m;i++){
			string str,st2;
			cin >> str >> mp[i] >> st2 >> d[i];
			if(st2=="Single")t[i]=0;
			else t[i]=1;
		}
		for(int i=0;i<=100000;i++){
			dp[0][i]=dp[1][i]=INF;
		}
		for(int i=0;i<2;i++){
			dp[i][0]=0;
			for(int j=0;j<=100000;j++){
				if(dp[i][j]<INF){
					for(int k=0;k<m;k++){
						if(t[k]==i){
							dp[i][min(j+d[k],100000)]=min(dp[i][min(j+d[k],100000)],dp[i][j]+mp[k]);
							//printf("%d %d %d\n",i,min(j+d[k],100000),dp[i][min(j+d[k],100000)]);
						}
					}
				}
			}
			for(int j=100000;j>=1;j--){
				if(dp[i][j]<dp[i][j-1])dp[i][j-1]=dp[i][j];
			}
		}
		int res=INF;
		for(int i=0;i<=100000;i++){
			int cost=dp[1][i];
			for(int j=0;j<n;j++){
				if(hp[j]>i)cost=min(cost+dp[0][hp[j]-i],INF);
			}
			res=min(res,cost);
		}
		printf("%d\n",res);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:52: error: no matching function for call to 'min(int, double)'
   51 |                                 if(hp[j]>i)cost=min(cost+dp[0][hp[j]-i],INF);
      |                                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:62,
                 from a.cc:3:
/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:51:52: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'double')
   51 |                                 if(hp[j]>i)cost=min(cost+dp[0][hp[j]-i],INF);
      |                                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/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:4:
/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:51:52: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   51 |                                 if(hp[j]>i)cost=min(cost+dp[0][hp[j]-i],INF);
      |                                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~