Language: C++

#include <iostream>

using namespace std;

	int n,ma,mb;
int min;
int flag;
	int a[40];
	int b[40];
	int c[40];

void saiki(int k,int A,int B,int C)
{
	int w=0;
	A += a[k];
	B += b[k];
	C += c[k];
	//cerr << C << endl;
	if(A%ma==0&&(w=A/ma))
	{
		if(B==mb*w)
		{
			if(min>C)
			{
				flag=1;
				min = C;
			}
		}
	}
	for(int i=k+1;i<n;i++)
	{
		saiki(i,A,B,C);
	}
	return;
}
int main()
{
	min = 1000000;
	flag = 0;
	cin >> n>>ma>>mb;
	for(int i=0;i<n;i++)
	{
		cin >>a[i]>>b[i]>>c[i];
	}
	for(int i=0;i<n;i++)
	{
		saiki(0,0,0,0);
	}
	if(flag==1)
	{
		cout << min << endl;
	}else{
		cout << -1 <<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'void saiki(int, int, int, int)':
a.cc:23:28: error: reference to 'min' is ambiguous
   23 |                         if(min>C)
      |                            ^~~
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:281:5: note: candidates are: '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:233:5: note:                 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:6:5: note:                 'int min'
    6 | int min;
      |     ^~~
a.cc:26:33: error: reference to 'min' is ambiguous
   26 |                                 min = C;
      |                                 ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note:                 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:6:5: note:                 'int min'
    6 | int min;
      |     ^~~
a.cc: In function 'int main()':
a.cc:38:9: error: reference to 'min' is ambiguous
   38 |         min = 1000000;
      |         ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note:                 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:6:5: note:                 'int min'
    6 | int min;
      |     ^~~
a.cc:51:25: error: reference to 'min' is ambiguous
   51 |                 cout << min << endl;
      |                         ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note:                 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:6:5: note:                 'int min'
    6 | int min;
      |     ^~~