Language: C++

#include <iostream>
#include <vector>

using namespace std;

double size[4] = {0.25, 0.5, 1, 2};

int main(){
	vector<int> v(4);
	int n;
	
	cin >> v[0] >> v[1] >> v[2] >> v[3] >> n;
	
	long long sum = 0;
	long long cost = 0;
	for(int i = 0;i < 4;i++){
		int mp = 0;
		for(int j = 1;j < v.size();j++){
			if(v[mp]/size[mp] > v[j]/size[j]){
				mp = j;
			}
		}
		
		long long need = n-sum;
		if(need > 0){
			long long buy = long long(need/size[mp]);
			sum += buy*size[mp];
			cost += buy*v[mp];
		}
		
		v[mp] = 1000000000;
	}
	
	cout << cost << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:34: error: reference to 'size' is ambiguous
   19 |                         if(v[mp]/size[mp] > v[j]/size[j]){
      |                                  ^~~~
In file included from /usr/include/c++/14/string:53,
                 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/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:6:8: note:                 'double size [4]'
    6 | double size[4] = {0.25, 0.5, 1, 2};
      |        ^~~~
a.cc:19:50: error: reference to 'size' is ambiguous
   19 |                         if(v[mp]/size[mp] > v[j]/size[j]){
      |                                                  ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:6:8: note:                 'double size [4]'
    6 | double size[4] = {0.25, 0.5, 1, 2};
      |        ^~~~
a.cc:26:41: error: expected primary-expression before 'long'
   26 |                         long long buy = long long(need/size[mp]);
      |                                         ^~~~
a.cc:27:36: error: reference to 'size' is ambiguous
   27 |                         sum += buy*size[mp];
      |                                    ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:6:8: note:                 'double size [4]'
    6 | double size[4] = {0.25, 0.5, 1, 2};
      |        ^~~~