Language: C++

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

// #include <bits/extc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp> // tree
// #include <ext/pb_ds/hash_policy.hpp> // hash
// #include <ext/pb_ds/trie_policy.hpp> // trie
// #include <ext/pb_ds/priority_queue.hpp> // priority_queue
// using namespace __gnu_pbds;

#include <bits/stdc++.h>
using namespace std;

#define IOS() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define X first
#define Y second
#define ALL(x) x.begin(), x.end()
#define RALL(x) x.rbegin(), x.rend()
#define Push push_back

using lli = long long;
using pii = pair<int, int>;
using pll = pair<lli, lli>;
using Double = long double;
template<typename T>
using Vector = vector<vector<T>>;
template<typename T>
using Prior = priority_queue<T>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;

const lli mod = 1E9 + 7;
const Double PI = 3.1415926535846;
const Double eps = 1e-8;

lli fastPow(lli base, lli exp, lli module = mod) {
	lli ans = 1;
	base %= module;
	while (exp) {
		if (exp & 1) ans = ans * base % module;
		base = base * base % module;
		exp >>= 1;
	}
	return ans;
}

bool millerRabin(lli n, lli a) {
	/*
	 * n < 4,759,123,141		3 : {2, 7, 61}
	 * n < 1,122,004,669,633	4 : {2, 13, 23, 1662803}
	 * n < 3,474,749,660,383	6 : {p in [2, 13]}
	 * n < 2^64					7 : 
	 * {2, 325, 9375, 28178, 450775, 9780504, 1795265022}
	 *
	 * else, random everytime gives a 75% of correction
	 */
	
	if (n < 2) return 0;
	if ((a = a%n) == 0) return 1;
	if (n & 1 ^ 1) return n == 2;
	
	lli lowb = (n - 1) & -(n - 1);
	lli tmp = (n - 1) / lowb; // lowbit of (n-1)
	lli t = __lg(lowb);
	lli x = 1;
	
	for (; tmp; tmp /= 2, a = a*a%n) {
		if (tmp & 1) x = x * a % n;
	}
	
	if (x == 1 or x == n - 1) return 1;
	
	while (--t) {
		if ((x = x*x%n) == n - 1) return 1;
	}
	
	return 0;
}

bool MR_PrimeFilter(lli n) {
	vector<lli> v[4];
	v[0] = {2, 7, 61};
	v[1] = {2, 13, 23, 1662803};
	v[2] = {2, 3, 5, 7, 11, 13};
	v[3] = {2, 325, 9375, 28178, 450775, 9780504, 1795265022};
	
	if (n < 4759123141LL) {
		for (lli x : v[0]) {
			if (!millerRabin(n, x)) return false;
		}
		return true;
	}
	if (n < 1122004669633LL) {
		for (lli x : v[1]) {
			if (!millerRabin(n, x)) return false;
		}
		return true;
	}
	if (n < 3474749660383LL) {
		for (lli x : v[2]) {
			if (!millerRabin(n, x)) return false;
		}
		return true;
	}
	for (lli x : v[3]) {
		if (!millerRabin(n, x)) return false;
	}
	return true;
}

void solve() {
	__int128 T1, T2, A1, A2, B1, B2, SA, SB;
	cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
	
	SA = T1 * A1 + T2 * A2;
	SB = T1 * B1 + T2 * B2;
	
	if (SA == SB) {
		cout << "infinity\n";
		return;
	}
	
	if (SA > SB) {
		swap(A1, B1);
		swap(A2, B2);
		swap(SA, SB);
	}
	
	if (A1 < B1) {
		cout << 0 << "\n";
		return;
	}
	
	__int128 lo = 0, hi = 1E18, mi;
	__int128 DA, DB;
	while (lo < hi) {
		mi = (lo + hi) >> 1;
		
		// cout << SA << ", " << SB << ", " << mi << "\n";
		
		if (log10(SB - SA) + log10(mi) > 18.0) {
			hi = mi;
		}
		else if (T1 * (A1 - B1) < mi * (SB - SA)) {
			hi = mi;
		}
		else {
			lo = mi + 1;
		}
	}
	
	cout << 2 * lo - 1 << "\n";
}

int main() {
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:114:13: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and '__int128')
  114 |         cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
      |         ~~~ ^~ ~~
      |         |      |
      |         |      __int128
      |         std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
                 from a.cc:12:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  170 |       operator>>(bool& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:170:7: note:   conversion of argument 1 would be ill-formed:
a.cc:114:16: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type '__int128'
  114 |         cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
      |                ^~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  174 |       operator>>(short& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:174:7: note:   conversion of argument 1 would be ill-formed:
a.cc:114:16: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type '__int128'
  114 |         cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
      |                ^~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  177 |       operator>>(unsigned short& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:177:7: note:   conversion of argument 1 would be ill-formed:
a.cc:114:16: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type '__int128'
  114 |         cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
      |                ^~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  181 |       operator>>(int& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:181:7: note:   conversion of argument 1 would be ill-formed:
a.cc:114:16: error: cannot bind non-const lvalue reference of type 'int&' to a value of type '__int128'
  114 |         cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
      |                ^~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  184 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:184:7: note:   conversion of argument 1 would be ill-formed:
a.cc:114:16: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type '__int128'
  114 |         cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
      |                ^~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  188 |       operator>>(long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:188:7: note:   conversion of argument 1 would be ill-formed:
a.cc:114:16: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type '__int128'
  114 |         cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
      |                ^~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:192:7: note:   conversion of argument 1 would be ill-formed:
a.cc:114:16: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type '__int128'
  114 |         cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
      |                ^~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  199 |       operator>>(long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:199:7: note:   conversion of argument 1 would be ill-formed:
a.cc:114:16: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type '__int128'
  114 |         cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
      |                ^~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  203 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:203:7: note:   conversion of argument 1 would be ill-formed:
a.cc:114:16: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type '__int128'
  114 |         cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
      |                ^~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  219 |       operator>>(float& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:219:7: note:   conversion of argument 1 would be ill-formed:
a.cc:114:16: error: cannot bind non-const lvalue reference of type 'float&' to a value of type '__int128'
  114 |         cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
      |                ^~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  223 |       operator>>(double& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:223:7: note:   conversion of argument 1 would be ill-formed:
a.cc:114:16: error: cannot bind non-const lvalue reference of type 'double&' to a value of type '__int128'
  114 |         cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
      |                ^~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  227 |       operator>>(long double& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:227:7: note:   conversion of argument 1 would be ill-formed:
a.cc:114:16: error: cannot bind non-const lvalue reference of type 'long double&' to a value of type '__int128'
  114 |         cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
      |                ^~
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  328 |       operator>>(void*& __p)
      |       ^~~~~~~~
/usr/include/c++/14/istream:328:7: note:   conversion of argument 1 would be ill-formed:
a.cc:114:16: error: invalid conversion from '__int128' to 'void*' [-fpermissive]
  114 |         cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
      |                ^~
      |                |
      |                __int128
a.cc:114:16: error: cannot bind rvalue '(void*)((long int)T1)' to 'void*&'
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  122 |       operator>>(__istream_type& (*__pf)(__istream_type&))
      |       ^~~~~~~~
/usr/include/c++/14/istream:122:7: note:   conversion of argument 1 would be ill-formed:
a.cc:114:16: error: invalid conversion from '__int128' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive]
  114 |         cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
      |                ^~
      |                |
      |                __int128
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' (near match)
  126 |       operator>>(__ios_type& (*__pf)(__ios_type&))
      |       ^~~~~~~~
/usr/include/c++/14/istream:126:7: note:   conversion of argument 1 would be ill-formed:
a.cc:114:16: error: invalid conversion from '__int128' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>