Language: C++

#include<iostream>
using namespace std;

int euclid(int a, int b){
	int tmp;
	if(a< b){
		tmp= a;
		a= b;
		b= tmp;	
	}	
	if(a%b ==0) return b;
	
	tmp= a% b;
	a= b;
	b= tmp;

	return euclid(a,b);
}

int main(){
	int n;
	long long int *t, *a;

	cin>> n;
	
	t= new int[n];
	a= new int[n];
	
	for(int i=0; i<n; i++) cin>> t[i]>> a[i];
	
	if(n==1){
		cout<< t[0]+a[0]<<endl;	
	}
	else{	
		for(int i=0; i<n-1; i++){
			if(t[i+1]< t[i] || a[i+1]< a[i]){
				int tQuot= min(t[i]%t[i+1], 1);
				int aQuot= min(a[i]%a[i+1], 1);
				
				int tMulti= t[i]/t[i+1] + tQuot;
				int aMulti= a[i]/a[i+1] + aQuot;
				int multi= max(tMulti, aMulti);

				if(t[i+1]< t[i] && a[i+1]< a[i]){
					if(aMulti* t[i+1]> t[i] && aMulti* a[i+1]> a[i] && tMulti* t[i+1]> t[i] && tMulti* a[i+1]> a[i] ){
						multi= min(tMulti, aMulti);
					}
				}

				t[i+1]*= multi;
				a[i+1]*= multi;
			}
		}
		cout<< t[n-1]+a[n-1]<< endl;
	}
	return 0;	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:12: error: cannot convert 'int*' to 'long long int*' in assignment
   26 |         t= new int[n];
      |            ^~~~~~~~~~
      |            |
      |            int*
a.cc:27:12: error: cannot convert 'int*' to 'long long int*' in assignment
   27 |         a= new int[n];
      |            ^~~~~~~~~~
      |            |
      |            int*
a.cc:37:47: error: no matching function for call to 'min(long long int, int)'
   37 |                                 int tQuot= min(t[i]%t[i+1], 1);
      |                                            ~~~^~~~~~~~~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:37:47: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   37 |                                 int tQuot= min(t[i]%t[i+1], 1);
      |                                            ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: '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:281:5: note:   candidate expects 3 arguments, 2 provided
a.cc:38:47: error: no matching function for call to 'min(long long int, int)'
   38 |                                 int aQuot= min(a[i]%a[i+1], 1);
      |                                            ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:38:47: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   38 |                                 int aQuot= min(a[i]%a[i+1], 1);
      |                                            ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: '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:281:5: note:   candidate expects 3 arguments, 2 provided