Language: C++

#include<bits/stdc++.h>
using namespace std;
int gcd(int m,int n){
	if(n>m)swap(n,m);
	if(n==0)return 1;
	int r=m%n;
	if(r==0)return n;
	else return gcd(n,r);
}
struct ratio{
	int m,n;
	ratio(int m,int n):m(m),n(n){}
	bool operator >(ratio &k)const{
		int m1=m/gcd(m,n);
		int n1=n/gcd(m,n);
		int km=k.m/gcd(k.m,k.n);
		int kn=k.n/gcd(k.m,k.n);
		return n1*(kn-km)>kn*(n1-m1);
	} 
};
int a,b,c,d,f;
ratio e(0,1),k(0,1);
int ans1=0,ans2=0;
ratio ans(0,1);
int vis[3001][3001];
void dfs(int t,int s){
	if(t+s>f||vis[t][s]==1)return ;
	vis[t][s]=1;
	if(t+s!=0)k=ratio(100*t,t+s);
	else k=ratio(0,1);
	if(k>e)return ;
	if(k>ans){
		ans=k;
		ans1=t+s;
		ans2=t;
	}
	double k1;
	dfs(t+c,s);
	dfs(t+d,s);
	dfs(t,s+100*a);
	dfs(t,s+100*b);
}
int main(){
	int e1;
	cin>>a>>b>>c>>d>>e1>>f;
	e=ratio(100*e1,(100+e1));
	dfs(0,0);
	cout<<ans1<<' '<<ans2<<endl;
	return 0; 
}

Compiler output:
a.cc:22:1: error: reference to 'ratio' is ambiguous
   22 | ratio e(0,1),k(0,1);
      | ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:66,
                 from a.cc:1:
/usr/include/c++/14/ratio:269:12: note: candidates are: 'template<long int _Num, long int _Den> struct std::ratio'
  269 |     struct ratio
      |            ^~~~~
a.cc:10:8: note:                 'struct ratio'
   10 | struct ratio{
      |        ^~~~~
a.cc:24:1: error: reference to 'ratio' is ambiguous
   24 | ratio ans(0,1);
      | ^~~~~
/usr/include/c++/14/ratio:269:12: note: candidates are: 'template<long int _Num, long int _Den> struct std::ratio'
  269 |     struct ratio
      |            ^~~~~
a.cc:10:8: note:                 'struct ratio'
   10 | struct ratio{
      |        ^~~~~
a.cc: In function 'void dfs(int, int)':
a.cc:29:19: error: 'k' was not declared in this scope
   29 |         if(t+s!=0)k=ratio(100*t,t+s);
      |                   ^
a.cc:29:21: error: reference to 'ratio' is ambiguous
   29 |         if(t+s!=0)k=ratio(100*t,t+s);
      |                     ^~~~~
/usr/include/c++/14/ratio:269:12: note: candidates are: 'template<long int _Num, long int _Den> struct std::ratio'
  269 |     struct ratio
      |            ^~~~~
a.cc:10:8: note:                 'struct ratio'
   10 | struct ratio{
      |        ^~~~~
a.cc:30:14: error: 'k' was not declared in this scope
   30 |         else k=ratio(0,1);
      |              ^
a.cc:30:16: error: reference to 'ratio' is ambiguous
   30 |         else k=ratio(0,1);
      |                ^~~~~
/usr/include/c++/14/ratio:269:12: note: candidates are: 'template<long int _Num, long int _Den> struct std::ratio'
  269 |     struct ratio
      |            ^~~~~
a.cc:10:8: note:                 'struct ratio'
   10 | struct ratio{
      |        ^~~~~
a.cc:31:12: error: 'k' was not declared in this scope
   31 |         if(k>e)return ;
      |            ^
a.cc:31:14: error: 'e' was not declared in this scope
   31 |         if(k>e)return ;
      |              ^
a.cc:32:12: error: 'k' was not declared in this scope
   32 |         if(k>ans){
      |            ^
a.cc:32:14: error: 'ans' was not declared in this scope; did you mean 'ans2'?
   32 |         if(k>ans){
      |              ^~~
      |              ans2
a.cc: In function 'int main()':
a.cc:46:9: error: 'e' was not declared in this scope; did you mean 'e1'?
   46 |         e=ratio(100*e1,(100+e1));
      |         ^
      |         e1
a.cc:46:11: error: reference to 'ratio' is ambiguous
   46 |         e=ratio(100*e1,(100+e1));
      |           ^~~~~
/usr/include/c++/14/ratio:269:12: note: candidates are: 'template<long int _Num, long int _Den> struct std::ratio'
  269 |     struct ratio
      |            ^~~~~
a.cc:10:8: note:                 'struct ratio'
   10 | struct ratio{
      |        ^~~~~