Language: C++

int main()
{
	long long t1,t2,a1,a2,b1,b2;
	cin >> t1>>t2>>a1>>a2>>b1>>b2;
	
	if (a1 == b1)cout << "infinity" << endl;
	else if(a1>=b1&&a2>=b2)cout << 0 << endl;
	else if(a1<=b1&&a2<=b2)cout << 0 << endl;
	else {
		long long x = (a1 - b1)*t1;
		long long y = (a2 - b2)*t2;
		long long z = x + y;
		if (z == 0)cout << 0 << endl;
		if (z > 0) {
			if (x < 0)cout << (x*(-1)) / z << endl;
			else if (y < 0) cout << (y*(-1)) / z << endl;
		}
		if (z < 0) {
			if (x >0)cout << x / (z*(-1) << endl;
			else if (y > 0) cout << y / (z*(-1) << endl;
	}
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'cin' was not declared in this scope
    4 |         cin >> t1>>t2>>a1>>a2>>b1>>b2;
      |         ^~~
a.cc:6:22: error: 'cout' was not declared in this scope
    6 |         if (a1 == b1)cout << "infinity" << endl;
      |                      ^~~~
a.cc:6:44: error: 'endl' was not declared in this scope
    6 |         if (a1 == b1)cout << "infinity" << endl;
      |                                            ^~~~
a.cc:7:32: error: 'cout' was not declared in this scope
    7 |         else if(a1>=b1&&a2>=b2)cout << 0 << endl;
      |                                ^~~~
a.cc:7:45: error: 'endl' was not declared in this scope
    7 |         else if(a1>=b1&&a2>=b2)cout << 0 << endl;
      |                                             ^~~~
a.cc:8:32: error: 'cout' was not declared in this scope
    8 |         else if(a1<=b1&&a2<=b2)cout << 0 << endl;
      |                                ^~~~
a.cc:8:45: error: 'endl' was not declared in this scope
    8 |         else if(a1<=b1&&a2<=b2)cout << 0 << endl;
      |                                             ^~~~
a.cc:13:28: error: 'cout' was not declared in this scope
   13 |                 if (z == 0)cout << 0 << endl;
      |                            ^~~~
a.cc:13:41: error: 'endl' was not declared in this scope
   13 |                 if (z == 0)cout << 0 << endl;
      |                                         ^~~~
a.cc:15:35: error: 'cout' was not declared in this scope
   15 |                         if (x < 0)cout << (x*(-1)) / z << endl;
      |                                   ^~~~
a.cc:15:59: error: 'endl' was not declared in this scope
   15 |                         if (x < 0)cout << (x*(-1)) / z << endl;
      |                                                           ^~~~
a.cc:16:41: error: 'cout' was not declared in this scope
   16 |                         else if (y < 0) cout << (y*(-1)) / z << endl;
      |                                         ^~~~
a.cc:16:65: error: 'endl' was not declared in this scope
   16 |                         else if (y < 0) cout << (y*(-1)) / z << endl;
      |                                                                 ^~~~
a.cc:19:34: error: 'cout' was not declared in this scope
   19 |                         if (x >0)cout << x / (z*(-1) << endl;
      |                                  ^~~~
a.cc:19:57: error: 'endl' was not declared in this scope
   19 |                         if (x >0)cout << x / (z*(-1) << endl;
      |                                                         ^~~~
a.cc:19:61: error: expected ')' before ';' token
   19 |                         if (x >0)cout << x / (z*(-1) << endl;
      |                                              ~              ^
      |                                                             )
a.cc:20:41: error: 'cout' was not declared in this scope
   20 |                         else if (y > 0) cout << y / (z*(-1) << endl;
      |                                         ^~~~
a.cc:20:64: error: 'endl' was not declared in this scope
   20 |                         else if (y > 0) cout << y / (z*(-1) << endl;
      |                                                                ^~~~
a.cc:20:68: error: expected ')' before ';' token
   20 |                         else if (y > 0) cout << y / (z*(-1) << endl;
      |                                                     ~              ^
      |                                                                    )
a.cc:23:2: error: expected '}' at end of input
   23 | }
      |  ^
a.cc:2:1: note: to match this '{'
    2 | {
      | ^