criyle/codenet-compile-errors huggingface dataset:
Language: C++

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

long long n,t[1005],a[1005];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    cin>>n;
    for(long long i=0;i<n;i++)
        cin>>t[i]>>a[i];
    for(long long i=1;i<n;i++)
    {
        long long d=max(t[i-1])/t[i],a[i-1])/a[i]);
        if(d*a[i]<a[i-1]||d*t[i]<t[i-1])
            d++;
        a[i]*=d;
        t[i]*=d;
    }

    cout<<t[n-1]+a[n-1]<<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:24: error: no matching function for call to 'max(long long int&)'
   16 |         long long d=max(t[i-1])/t[i],a[i-1])/a[i]);
      |                     ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
a.cc:16:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   16 |         long long d=max(t[i-1])/t[i],a[i-1])/a[i]);
      |                     ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

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

long long n,t[1005],a[1005];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    cin>>n;
    for(long long i=0;i<n;i++)
        cin>>t[i]>>a[i];
    for(long long i=1;i<n;i++)
    {
        long long d=max((t[i-1])/t[i],a[i-1])/a[i]);
        if(d*a[i]<a[i-1]||d*t[i]<t[i-1])
            d++;
        a[i]*=d;
        t[i]*=d;
    }

    cout<<t[n-1]+a[n-1]<<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:51: error: expected ',' or ';' before ')' token
   16 |         long long d=max((t[i-1])/t[i],a[i-1])/a[i]);
      |                                                   ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;

int main() {
	long long N, T, A;
	cin >> N >> T >> A;
	for (int i = 1; i < N; i++) {
		long double  t, a;
		cin >> t >> a;
		if (T * a > A * t) {
			T = t * ceil((long double)T / t);
			A = a * ceil((long double)T / t);
		}
		else {
			T = t * ceil((long double)A / a);
			A = a * ceil((long double)A / a);
		}
	}
	cout << T + A << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:33: error: 'ceil' was not declared in this scope
   12 |                         T = t * ceil((long double)T / t);
      |                                 ^~~~
a.cc:16:33: error: 'ceil' was not declared in this scope
   16 |                         T = t * ceil((long double)A / a);
      |                                 ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
deque < int > a;
deque < int > b;
int ans=1;
int gcd(int a2,int b2)
{
	while(a2%b2!=0)
	{
		a2=b2;
		b2=a2%b2;
	}
	return a2;
}
int main()
{
	int n;
	cin>>n;
	int a2,b2;
	for(int i=0;i<n;i++)
	{
		cin>>a2>>b2;
		a.push_back(a2);
		b.push_back(b2);
	}
	ans+=(a[0]+b[0]);
	for(int i=1;i<a.size();i++)
	{
		int a2=a[i-1]+(a[i-1]%a[i]);
		int b2=b[i-1]+(b[i-1]%b[i]);
		int y=gcd(a[i],b[i]);
		if(a[i]<b[i])
		{
			int b3=b2;
			b3=a2*b[i]/a[i];
			if(b3<b2)
			{
				int u=(b2-b3+2)/
			}
		}
		ans+=(j+j2);
		a[i]=j;
		b[i]=j2;
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:25: error: expected primary-expression before '}' token
   39 |                         }
      |                         ^
a.cc:41:23: error: 'j' was not declared in this scope
   41 |                 ans+=(j+j2);
      |                       ^
a.cc:41:25: error: 'j2' was not declared in this scope; did you mean 'b2'?
   41 |                 ans+=(j+j2);
      |                         ^~
      |                         b2
Language: C++


#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
const ll N = 500030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    1e9+7;

int main()
{
		ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	ll x=1,y=1;
	ll n;
	cin>>n;
	while(n--)
	{
		ll a,b;
		cin>>a>>b;
		if(a!=b)

			ll aa=(x+a-1)/a;


			ll bb=(y+b-1)/b;


			ll z=max(bb,aa);
		//	cout<<y<<endl;
			y=z*b;
			x=z*a;
			
			

	
	
		//cout<<x<<" "<<y<<endl;
	}
	cout<<x+y<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:37: error: 'aa' was not declared in this scope; did you mean 'a'?
   33 |                         ll z=max(bb,aa);
      |                                     ^~
      |                                     a
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
using namespace std;
typedef long long ll;
ll CEIL(ll x, ll y) {
	ll ans=x/y;
	if (x % y == 0)return ans;
	else return ans + 1;
}
int main()
{
	int at, aa;
	int n;
	int x, y;
	scanf_s("%d", &n);
	scanf_s("%d%d", &at, &aa);
	for (int i = 2; i <= n; i++) {
		scanf_s("%d%d", &x, &y);
		ll t = max(CEIL(at, x), CEIL(aa, y));
		at = t * x;
		aa = t * y;
	}
	printf("%lld", at + aa);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   24 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C++

#include <iostream>
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

//#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for (int i = n - 1; i >= 0; i--)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

#define INF bit(60)
#define pb push_back
#define mod 1000000007

namespace mp = boost::multiprecision;

using namespace std;
using uif = uint_fast64_t;
//using ll = mp::int256_t;
using ll = long long int;

int main(void)
{
  ll n;
  cin >> n;
  vector<long long int> T(n);
  vector<long long int> A(n);
  rep(i, n) cin >> T[i] >> A[i];

  ll t = T[0];
  ll a = A[0];

  for (ll i = 1; i < n; i++)
  {
    ll l = 1;
    ll r = LLONG_MAX / 1001;

    while (r - l > 1)
    {
      ll piv = l + (r - l) / 2;

      if (piv * T[i] >= t && piv * A[i] >= a)
      {
        r = piv;
      }
      else
      {
        l = piv;
      }
    }
    ll k;
    if (l == r)
      k = l;
    else
    {
      if (l * T[i] >= t && l * A[i] >= a)
        k = l;
      else
        k = r;
    }
    t = k * T[i];
    a = k * A[i];
  }

  cout << t + a << endl;

  return 0;
}


Compiler output:
a.cc:22:16: error: 'boost' has not been declared
   22 | namespace mp = boost::multiprecision;
      |                ^~~~~
a.cc:22:23: error: 'multiprecision' is not a namespace-name
   22 | namespace mp = boost::multiprecision;
      |                       ^~~~~~~~~~~~~~
Language: C++

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

long long curA, curT, A, T;
int n;

int main() {
    scanf("%d", &n);
    scanf("%lld%lld", &curT, &curA);
    for(int i = 1; i < n; i++) {
        scanf("%lld%lld", &T, &A);
        if(T <#include <bits/stdc++.h>
using namespace std;

long long curA, curT, A, T;
int n;

int main() {
    scanf("%d", &n);
    scanf("%lld%lld", &curT, &curA);
    for(int i = 1; i < n; i++) {
        scanf("%lld%lld", &T, &A);
        if(T < curT || A < curA) {

            long long r = max((curT - 1) / T, (curA - 1) / A) + 1;
            curT = T * r;
            curA = A * r;

        } else {
            curT = T; curA = A;
        }
        //printf("--->%lld %lld\n", curT, curA);
    }
    printf("%lld\n", curT + curA);
    return 0;
}
 curT || A < curA) {

            long long r = max((curT - 1) / T, (curA - 1) / A) + 1;
            curT = T * r;
            curA = A * r;

        } else {
            curT = T; curA = A;
        }
        //printf("--->%lld %lld\n", curT, curA);
    }
    printf("%lld\n", curT + curA);
    return 0;
}


Compiler output:
a.cc:12:15: error: stray '#' in program
   12 |         if(T <#include <bits/stdc++.h>
      |               ^
a.cc: In function 'int main()':
a.cc:12:16: error: 'include' was not declared in this scope
   12 |         if(T <#include <bits/stdc++.h>
      |                ^~~~~~~
a.cc:12:25: error: 'bits' was not declared in this scope
   12 |         if(T <#include <bits/stdc++.h>
      |                         ^~~~
a.cc:12:30: error: 'stdc' was not declared in this scope; did you mean 'std'?
   12 |         if(T <#include <bits/stdc++.h>
      |                              ^~~~
      |                              std
a.cc:13:1: error: expected primary-expression before 'using'
   13 | using namespace std;
      | ^~~~~
a.cc:15:15: error: expected initializer before ',' token
   15 | long long curA, curT, A, T;
      |               ^
a.cc:15:15: error: expected ')' before ',' token
   15 | long long curA, curT, A, T;
      |               ^
      |               )
a.cc:12:11: note: to match this '('
   12 |         if(T <#include <bits/stdc++.h>
      |           ^
a.cc:18:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   18 | int main() {
      |         ^~
a.cc:18:9: note: remove parentheses to default-initialize a variable
   18 | int main() {
      |         ^~
      |         --
a.cc:18:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:18:12: error: a function-definition is not allowed here before '{' token
   18 | int main() {
      |            ^
a.cc:37:18: error: expected ';' before ')' token
   37 |  curT || A < curA) {
      |                  ^
      |                  ;
a.cc:43:11: error: 'else' without a previous 'if'
   43 |         } else {
      |           ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
int main() {
  mp::cpp_int n;
  cin>>n;
  vector<mp::cpp_int> t(n);
  vector<mp::cpp_int> a(n);
  for(int i=0;i<n;i++){
    cin>>t.at(i);
    cin>>a.at(i);
  }
  mp::cpp_int T=t.at(0),A=a.at(0);
  for(int i=0;i<n;i++){
    if(T*a.at(i)<A*t.at(i)){
      if(A%a.at(i)==0){
        T=t.at(i)*(A/a.at(i));
        continue;
      }
      else{
        A+=(a.at(i)-(A%a.at(i)));
        T=t.at(i)*(A/a.at(i));
        continue;
      }
    }
    if(T*a.at(i)>A*t.at(i)){
      if(T%t.at(i)==0){
        A=a.at(i)*(T/t.at(i));
        continue;
      }
      else{
        T+=(t.at(i)-(T%t.at(i)));
        A=a.at(i)*(T/t.at(i));
        continue;
      }
    }
  }
  cout<<A+T<<endl;
}


Compiler output:
a.cc:3:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    3 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
int main() {
  mp:cpp_int n;
  cin>>n;
  vector<mp::cpp_int> t(n);
  vector<mp::cpp_int> a(n);
  for(int i=0;i<n;i++){
    cin>>t.at(i);
    cin>>a.at(i);
  }
  mp:cpp_int T=t.at(0),A=a.at(0);
  for(int i=0;i<n;i++){
    if(T*a.at(i)<A*t.at(i)){
      if(A%a.at(i)==0){
        T=t.at(i)*(A/a.at(i));
        continue;
      }
      else{
        A+=(a.at(i)-(A%a.at(i)));
        T=t.at(i)*(A/a.at(i));
        continue;
      }
    }
    if(T*a.at(i)>A*t.at(i)){
      if(T%t.at(i)==0){
        A=a.at(i)*(T/t.at(i));
        continue;
      }
      else{
        T+=(t.at(i)-(T%t.at(i)));
        A=a.at(i)*(T/t.at(i));
        continue;
      }
    }
  }
  cout<<A+T<<endl;
}


Compiler output:
a.cc:3:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    3 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;int maiint main() {
  mp:cpp_int n;
  cin>>n;
  vector<mp::cpp_int> t(n);
  vector<mp::cpp_int> a(n);
  for(int i=0;i<n;i++){
    cin>>t.at(i);
    cin>>a.at(i);
  }
  mp:cpp_int T=t.at(0),A=a.at(0);
  for(int i=0;i<n;i++){
    if(T*a.at(i)<A*t.at(i)){
      if(A%a.at(i)==0){
        T=t.at(i)*(A/a.at(i));
        continue;
      }
      else{
        A+=(a.at(i)-(A%a.at(i)));
        T=t.at(i)*(A/a.at(i));
        continue;
      }
    }
    if(T*a.at(i)>A*t.at(i)){
      if(T%t.at(i)==0){
        A=a.at(i)*(T/t.at(i));
        continue;
      }
      else{
        T+=(t.at(i)-(T%t.at(i)));
        A=a.at(i)*(T/t.at(i));
        continue;
      }
    }
  }
  cout<<A+T<<endl;
}

Compiler output:
a.cc:3:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    3 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <stdio.h>

int main(){
  int n,ans=1,p;
  scanf("%d",&n);
  
  int t[n+1],a[n+1];
  for(int i=1;i<=n;i++) scanf("%d %d",&t[i],&a[i]);
  
  for(int i=1;i<=n;i++){
    p=0;
    for(j=1;j>=0;j++){
      p+=t[i]+a[i];
      if(p>=ans) break;
    }
  }
  
  printf("%d",ans);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:9: error: 'j' undeclared (first use in this function)
   12 |     for(j=1;j>=0;j++){
      |         ^
main.c:12:9: note: each undeclared identifier is reported only once for each function it appears in
Language: Java

import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		long[] T = new long[N];
		long[] A = new long[N];
		for( int i=0; i<N; i++ ){
			T[i] = sc.nextLong();
			A[i] = sc.nextLong();
		}
		for( int i=1; i<N; i++ ){
			if( T[i]<T[i-1] || A[i]<A[i-1] ){
				long a = Math.max(T[i-1]/T[i],A[i-1]/A[i]);
				for( long j=a; j<(a+2; j++ ){
					T[i] *= j;
					A[i] *= j;
					if( T[i]>=T[i-1] && A[i]>=A[i-1] ){
						break;
					}
					T[i] = T[i]/j;
					A[i] = A[i]/j;       
				}              
			}         
		}   
		System.out.println(T[N-1]+A[N-1]);
	}
}


Compiler output:
Main.java:16: error: ')' expected
				for( long j=a; j<(a+2; j++ ){
				                     ^
1 error
Language: Java

import java.util.*;

public class Main{

    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        long[][] T = new long[3][N];
        for(int i = 0; i < N; i++){
            T[0][i] = sc.nextLong();
            T[1][i] = sc.nextLong();
        }
        sc.close();

        long numT = T[0][0];
        long numA = T[1][0];

        for(int i = 1; i < N; i++){
            long t, a;
            if(numT%T[0][i] == 0)
                t = numT%T[0][i];
            else
                t = numT%T[0][i]+1;
            if(numT%T[0][i] == 0)
                a = numA%T[1][i];
            else
                a = numA%T[1][i]+1;
            min = Math.max(t, a);
            numT = min*T[0][i];
            numA = min*T[1][i];
        }

        System.out.println(numT+numA);
    }
}

Compiler output:
Main.java:29: error: cannot find symbol
            min = Math.max(t, a);
            ^
  symbol:   variable min
  location: class Main
Main.java:30: error: cannot find symbol
            numT = min*T[0][i];
                   ^
  symbol:   variable min
  location: class Main
Main.java:31: error: cannot find symbol
            numA = min*T[1][i];
                   ^
  symbol:   variable min
  location: class Main
3 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
const ll mod=1000000007;
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)

int main() {
	int n; cin >> n;
	double a=1.0d;
	double t=1.0d;
	repi(i,0,n){
		double ttmp, atmp;
		cin >> ttmp >> atmp;
		double x = max(ceil(t/ttmp),seil(a/atmp));
		t = ttmp*x;
		a = atmp*x;
	}
	cout << t+a << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:45: error: 'seil' was not declared in this scope; did you mean 'ceil'?
   15 |                 double x = max(ceil(t/ttmp),seil(a/atmp));
      |                                             ^~~~
      |                                             ceil
Language: C++

#include<bits/stdc++.h>
#define mins(a,b) a=min(a,b)
#define maxs(a,b) a=max(a,b)
 template < typename T > std::string to_string( const T& n )
  {
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
  }
using namespace std;

const long long INF=9000000000000000;
int main(){
  long long n,a=0,b=0;
  cin>>n;
  long long num[n*2];
  for(int i=0;i<n*2;i++){
    cin>>num[i];
  }
  for(int i=0;i<n;i++){
    if(num[i*2]>=a and num[i*2+1]>=b){
      a=num[i*2];b=num[i*2+1];
    }
    else{
      for(int i=2;i<=max(a/num[i*2],b/num[i*2+1];i++){
        a=(a/(i-1))*i;
        b=(b/(i-1))*i;
        if(num[i*2]>=a and num[i*2+1]>=b)
          break;
      }
    }
  }
  cout<<a+b<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:49: error: expected ')' before ';' token
   25 |       for(int i=2;i<=max(a/num[i*2],b/num[i*2+1];i++){
      |                         ~                       ^
      |                                                 )
Language: C++

#include<bits/stdc++.h>
#define mins(a,b) a=min(a,b)
#define maxs(a,b) a=max(a,b)
 template < typename T > std::string to_string( const T& n )
  {
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
  }
using namespace std;

const long long INF=9000000000000000;
int main(){
  long long n,a=0,b=0;
  cin>>n;
  long long num[n*2];
  for(int i=0;i<n*2;i++){
    cin>>num[i];
  }
  for(int i=0;i<n;i++){
    if(num[i*2]>=a and num[i*2+1]>=b){
      a=num[i*2];b=num[i*2+1];
    }
    else{
      for(int i=1;i<=max(a/num[i*2],b/num
    }
  }
  cout<<a+b<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:38: error: invalid operands of types 'long long int' and 'long long int [(n * 2)]' to binary 'operator/'
   25 |       for(int i=1;i<=max(a/num[i*2],b/num
      |                                     ~^~~~
      |                                     | |
      |                                     | long long int [(n * 2)]
      |                                     long long int
a.cc:25:42: error: expected ';' before '}' token
   25 |       for(int i=1;i<=max(a/num[i*2],b/num
      |                                          ^
      |                                          ;
   26 |     }
      |     ~                                     
a.cc:26:5: error: expected primary-expression before '}' token
   26 |     }
      |     ^
a.cc:25:42: error: expected ')' before '}' token
   25 |       for(int i=1;i<=max(a/num[i*2],b/num
      |          ~                               ^
      |                                          )
   26 |     }
      |     ~                                     
a.cc:26:5: error: expected primary-expression before '}' token
   26 |     }
      |     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long INF = 1LL << 60;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}

int main()
{
  int N;
  cin >> N;
  vector<int> T(N), A(N);
  for (int i = 0; i < N; i++) cin >> T.at(i) >> A.at(i);
  
  long long t = T.at(0), a = A.at(0);
  for (int i = 1; i < N; i++)
  {
    long long p = 1;
    if (T.at(i) < t) chmax(p, divCeil(t, T.at(i)));
    if (A.at(i) < a) chmax(p, divCeil(a, A.at(i)));
    
    t = T.at(i) * p;
    a = A.at(i) * p;
  }
  
  long long ans = t + a;
  
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:27: error: no matching function for call to 'chmax(long long int&, int)'
   20 |     if (T.at(i) < t) chmax(p, divCeil(t, T.at(i)));
      |                      ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
a.cc:6:25: note: candidate: 'template<class T> bool chmax(T&, T)'
    6 | template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
      |                         ^~~~~
a.cc:6:25: note:   template argument deduction/substitution failed:
a.cc:20:27: note:   deduced conflicting types for parameter 'T' ('long long int' and 'int')
   20 |     if (T.at(i) < t) chmax(p, divCeil(t, T.at(i)));
      |                      ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
a.cc:21:27: error: no matching function for call to 'chmax(long long int&, int)'
   21 |     if (A.at(i) < a) chmax(p, divCeil(a, A.at(i)));
      |                      ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
a.cc:6:25: note: candidate: 'template<class T> bool chmax(T&, T)'
    6 | template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
      |                         ^~~~~
a.cc:6:25: note:   template argument deduction/substitution failed:
a.cc:21:27: note:   deduced conflicting types for parameter 'T' ('long long int' and 'int')
   21 |     if (A.at(i) < a) chmax(p, divCeil(a, A.at(i)));
      |                      ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define debug(x) cerr<<#x<<" "<<x<<endl;

signed main() {
  int n;cin>>n;
  int s,t;
  cin>>s>>t;
  for(int i=0;i<n-1;++i){
    int tmp = max((s+p-1)/p, (t+q-1)/q);
    s=tmp*p;
    t=tmp*q;
  }
  cout<<s+t<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:22: error: 'p' was not declared in this scope
   12 |     int tmp = max((s+p-1)/p, (t+q-1)/q);
      |                      ^
a.cc:12:33: error: 'q' was not declared in this scope
   12 |     int tmp = max((s+p-1)/p, (t+q-1)/q);
      |                                 ^
Language: C++

#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main() {
  INIT;
  VAR(int,n);
  int s,t;
  bool isFirst=true;
  REP(i,n){
    VAR(int,p,q);
    if(isFirst){
      s=p;t=q;
      isFirst=false;
      continue;
    }

    int ss=s,st=t,ts=s,tt=t;
    // s
    int tmp=ss;
    if(ss%p!=0){
      tmp = (ss/p+1)*p;
    }
    int sss = tmp;
    while(ss>tmp) tmp += sss;
    ss=tmp;
    st=(tmp/p)*q;

    // t
    tmp=tt;
    if(tt%q!=0){
      tmp = (tt/q+1)*q;
    }
    sss = tmp;
    while(tt>tmp) tmp += sss;
    tt=tmp;
    ts=(tmp/q)*p;

    int ttmp = INF;
    if(ss>s&&st>t) {
      ttmp = min(ttmp, ss+st);
      s = ss; t = st;
    }
    if(ts>s&&tt>t) {
      if(ttmp>ts+tt)
        s = ts,t=tt;
    }
  }
  OUT(ans)BR;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:83:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   83 |   OUT(ans)BR;
      |       ^~~
a.cc:20:26: note: in definition of macro 'OUT'
   20 | #define OUT(dist) cout<<(dist);
      |                          ^~~~
Language: C++

#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main() {
  INIT;
  VAR(int,n);
  int s,t;
  bool isFirst=true;
  REP(i,n){
    VAR(int,p,q);
    if(isFirst){
      s=p;t=q;
      isFirst=false;
      continue;
    }

    int ss=s,st=t,ts=s,tt=t;
    // s
    int tmp=ss;
    if(ss%p!=0){
      tmp = (ss/p+1)*p;
    }
    int sss = tmp;
    while(ss>tmp) tmp += sss;
    ss=tmp;
    st=(tmp/p)*q;

    // t
    tmp=tt;
    if(tt%q!=0){
      tmp = (tt/q+1)*q;
    }
    int sss = tmp;
    while(tt>tmp) tmp += sss;
    tt=tmp;
    ts=(tmp/q)*p;

    int ttmp = INF;
    if(ss>s&&st>t) {
      ttmp = min(ttmp, ss+st);
      s = ss; t = st;
    }
    if(ts>s&&tt>t) {
      if(ttmp>ts+tt)
        s = ts,t=tt;
    }
  }
  OUT(ans)BR;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:68:9: error: redeclaration of 'int64 sss'
   68 |     int sss = tmp;
      |         ^~~
a.cc:58:9: note: 'int64 sss' previously declared here
   58 |     int sss = tmp;
      |         ^~~
a.cc:83:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   83 |   OUT(ans)BR;
      |       ^~~
a.cc:20:26: note: in definition of macro 'OUT'
   20 | #define OUT(dist) cout<<(dist);
      |                          ^~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define REP(i, n) for(int i = 0;i < n;i++)
const long long INF = 1LL << 60;

int MOD = 1000000007;

int main(){
    std::ios_base::sync_with_stdio(false);
    
    int n; cin>>n;    
    int aa=1,bb=1;
    
    REP(i,n){
      int a,b; cin>>a>>b;
      k1=aa/a;
      k2=bb/b;
      if(aa%a!=0) k1++;
      if(bb%b!=0) k2++;
      aa=max(k1,k2)*a;
      bb=max(k1,k2)*b;
    }
    
    cout << aa+bb <<endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:7: error: 'k1' was not declared in this scope; did you mean 'y1'?
   34 |       k1=aa/a;
      |       ^~
      |       y1
a.cc:35:7: error: 'k2' was not declared in this scope
   35 |       k2=bb/b;
      |       ^~
Language: C++

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            new Main().solve(sc);
        }
    }

    void solve(Scanner sc) {
        int n = sc.nextInt();
        double numOfT = 1;
        double numOfA = 1;
        for (int i = 0; i < n; i++) {
            long t = sc.nextLong();
            long a = sc.nextLong();

            double x = Math.max(Math.ceil((double)numOfT / t), Math.ceil((double)numOfA / a));
            numOfT = t * x;
            numOfA = a * x;
        }
        System.out.println((long)(numOfT + numOfA));
    }
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;
	int T[N], A[N];
	rep(i, 0, N) cin >> T[i] >> A[i];

	int rsl = T[0] + A[0];
	int x = T[0], y = A[0];

	rep(i, 1, N) {
		if(T[i] >= x and A[i] >= y) {
			x = T[i]; y = A[i];
		} else if(T[i] >= x and A[i] < y) {
			int j = 0;
			while(true) {
				if((y + j) % A[i] == 0) {
					y += j;
					x = T[i] * (y / A[i]);
					break;
				}
				j++;
			}
		} else if(A[i] >= y and T[i] < x) {
			int j = 0;
			while(true) {
				if((x + j) % T[i] == 0) {
					x += j;
					y = A[i] * (x / T[i]);
					break;
				}
				j++;
			}

		} else {
			int rsl1 = 0, x1 = 0, x2 = 0, y1 = 0, y2 = 0;
			if(x >= y) {
				if(x % T[i] == 0) {
					y = A[i] * (x / T[i]);
				} else {
					int j = 0;
					while(true) {
						if((x + j) % T[i] == 0) {
							x += j;
							y = A[i] * (x / T[i]);
							break;
						}
						j++;
					}
				}
				rsl1 = x + y;
				x1 = x; y1 = y;
			} else {
				if(y % A[i] == 0) {
					x = T[i] * (A[i] / y);
				} else {
					int j = 0;
					while(true) {
						if((y + j) % A[i] == 0) {
							y += j;
							x = T[i] * (x / A[i]);
							break;
						}
						j++;
					}
				}
				rsl2 = x + y;
				x2 = x; y1 = y;
			}
			if(rsl1 < rsl2) {
				rsl = rsl1;
				x = x1; y = y1;
			} else {
				rsl = rsl2;
				x = x2; y = y2;

			}
		}
	}

	rsl = x + y;
	cout << rsl << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:99:33: error: 'rsl2' was not declared in this scope; did you mean 'rsl1'?
   99 |                                 rsl2 = x + y;
      |                                 ^~~~
      |                                 rsl1
a.cc:102:35: error: 'rsl2' was not declared in this scope; did you mean 'rsl1'?
  102 |                         if(rsl1 < rsl2) {
      |                                   ^~~~
      |                                   rsl1
Language: C++

#include<bits\stdc++.h>
using namespace std;
#define ll long long
#define lf double
#define N 4
#define err {puts("-1");exit(0);};
int color[408][4];
ll has(int a[])
{
	ll res=0;
	for(int i=N-1;i>=0;i--) res=res*1000+a[i];
	return res;
}
vector<ll> _rotate(int c[])
{
	vector<ll> res;
//	for(int i=0;i<N;i++) cout<<c[i]<<"   ";
	for(int i=0;i<N;i++) 
	{
		int a[4];
		for(int j=0;j<N;j++) a[j]=c[(i+j)%N];
		res.push_back(has(a));
	}return res;
}
int same(ll x,ll y)
{
	int a[N],c[N];int sum=0;
	for(int i=0;i<N;i++) a[i]=x%1000,x/=1000;
	for(int i=0;i<N;i++) 
	{
		for(int j=0;j<N;j++) c[j]=a[(i+j)%N];
		sum+= has(c)==y;
	}return sum;
}
map<ll,ll >m;
void ins(int x)
{
	vector<ll> v=_rotate(color[x]);
	for(int i=0;i<v.size();i++) m[v[i]]++;
}
ll ans;
ll operate(int c1[],int c2[])
{
//	for(int i=0;i<N;i++) cout<<c1[i]<<" ";cout<<"\n";
//	for(int i=0;i<N;i++) cout<<c2[i]<<" ";cout<<"\n";system("pause");
	ll p=has(c1);
	int a[4];ll ck[4];
	for(int i=0;i<N;i++)
	{
		a[0]=c1[i],a[1]=c1[(i+1)%N],a[2]=c2[(i+1)%N],a[3]=c2[i];
		ck[i]=has(a);
	}
	ll cnt=1;
	for(int i=0;i<4;i++)
	{
		ll over=same(p,ck[i]);
		for(int j=0;j<i;j++) over+=same(ck[j],ck[i]);
		if(m[ck[i]]<=0) return 0;
		cnt*=m[ck[i]]-over;
	}
	return cnt;
}
int bel[]={0,3,2,1};
int main()
{
	int n;cin>>n;
	for(int i=1;i<=n;i++) for(int j=0;j<N;j++) cin>>color[i][j];
	for(int i=n;i>=1;i--)
	{
		for(int j=i+1;j<=n;j++)
		{
			int a[N],b[N];for(int k=0;k<N;k++) b[k]=color[i][k];
			for(int k=0;k<N;k++)
			{
				for(int l=0;l<N;l++)
					a[l]=color[j][bel[(l+k)%N]];
				ans+=operate(a,b);
			}
		}ins(i);
	}
	cout<<ans;
    return 0;
}
/*
3
2 6 3
4
1 1 2 2
1 1 3 3
2 1 9
1 1 3 2
*/
/*
5
1 2 3 4 5
6
1 1 4 2
2 3 6
1 1 4 2
1 1 5 2
2 5 10
1 1 5 2
*/

Compiler output:
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory
    1 | #include<bits\stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

long long n,a,b,x=1,y=1;

int main()
{
	cin>>n;
	while(n--)
	{
	  cin>>a>>b;
	  int mid=max(x/a,y/b);
	  while(a*mid<x || b*mid<y) mid++;
	  x=a*sum,y=b*sum;
	}
	cout<<x+y;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:15: error: 'sum' was not declared in this scope
   14 |           x=a*sum,y=b*sum;
      |               ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
    long long n, smax = 1,
     t, a;

    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> t >> a;
        smax = max(smax, t + a);
    }
    long long tasum = t + a, tacount = 0;
    while (tasum < smax)
    {

        tacount++;
        if (tasum * tacouunt > smax)
            break;
    }
    cout << (t + a) * tacount;
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:19:21: error: 'tacouunt' was not declared in this scope; did you mean 'tacount'?
   19 |         if (tasum * tacouunt > smax)
      |                     ^~~~~~~~
      |                     tacount
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
    long long n, smax = 1;
    double t, a;

    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> t >> a;
        smax = max(smax, t + a);
    }
    long long tasum = t + a, tacount = 0;
    while (tasum < smax)
    {

        tacount++;
        if (tasum * tacouunt > smax)
            break;
    }
    cout<<(t+a)*tacount;
    return 0;
}



Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:12:19: error: no matching function for call to 'max(long long int&, double)'
   12 |         smax = max(smax, t + a);
      |                ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:12:19: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'double')
   12 |         smax = max(smax, t + a);
      |                ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:12:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   12 |         smax = max(smax, t + a);
      |                ~~~^~~~~~~~~~~~~
a.cc:19:21: error: 'tacouunt' was not declared in this scope; did you mean 'tacount'?
   19 |         if (tasum * tacouunt > smax)
      |                     ^~~~~~~~
      |                     tacount
Language: C++

#include <algorithm>
#include <cmath>
#include <iostream>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int N;
  cin >> N;

  int int x, y;
  size_t a, b;
  cin >> a >> b;
  for (int i = 1; i < N; ++i) {
    cin >> x >> y;
    size_t n = max(ceil(a * 1.0 / x), ceil(b * 1.0 / y));
    a = n * x;
    b = n * y;
  }

  cout << a + b << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: two or more data types in declaration of 'x'
   14 |   int int x, y;
      |   ^~~
a.cc:14:3: error: two or more data types in declaration of 'y'
a.cc:18:12: error: 'x' was not declared in this scope
   18 |     cin >> x >> y;
      |            ^
a.cc:18:17: error: 'y' was not declared in this scope
   18 |     cin >> x >> y;
      |                 ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;

int main(){
  int n,i;
  long long x=0,y=0;
  cin >> n;
  for(i=0;i<n;i++){
    long long int p,q;
    cin >> p >> q;
    if(p>=x %% q>=y){
      x=p; y=q;
    }else if(p>q){
      long long m=y/q;
      if(y%q!=0)m++;
      x=p*m; y=q*m;
    }else if(p<q){
      long long m=x/p;
      if(x%p!=0)m++;
      x=p*m; y=q*m;
    }else if(p==q){
      x=y=min(x,y);
    }
  }
  cout << x+y << endl;
  return 0;
}
    


Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: expected primary-expression before '%' token
   12 |     if(p>=x %% q>=y){
      |              ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(){
    int N;
    cin >> N;
    unsigned long long t,a;
    t = 1ll; a = 1ll;
    unsigned long long A,T;
    for(int i=0;i<N;i++){
        cin >> T >> A;
        long long i = (t+T-1)/T;
        long long j = (a+A-1)/A;
        long long k = max(i,j);
        t = T*k;
        a = A*k;
    }
    cout << a + t << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:19: error: redeclaration of 'long long int i'
   14 |         long long i = (t+T-1)/T;
      |                   ^
a.cc:12:13: note: 'int i' previously declared here
   12 |     for(int i=0;i<N;i++){
      |             ^
Language: C

#define _CRT_SECURE_NO_WARNINGS
#include <math.h>
#include <stdio.h>
#include <stdlib.h>



int n;
int t[10000];
int a[10000];
int t1,a1;

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d %d", &t[i], &a[i]);
	}

	int temp;
	for (int i = 1; i < n; i++) {
		temp = max((a[i - 1] + a[i] - 1) / a[i], (t[i - 1] + t[i] - 1)/ t[i]);
		a[i] = temp * a[i];
		t[i] = temp * t[i];
	}

	printf("%d\n", a[n - 1] + t[n - 1]);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:21:24: error: implicit declaration of function 'max'; did you mean 'fmax'? [-Wimplicit-function-declaration]
   21 |                 temp = max((a[i - 1] + a[i] - 1) / a[i], (t[i - 1] + t[i] - 1)/ t[i]);
      |                        ^~~
      |                        fmax
Language: C

#define _CRT_SECURE_NO_WARNINGS
#include <math.h>
#include <stdio.h>
#include <stdlib.h>



int n;
int t[1000];
int a[1000];
int t1,a1;

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d %d", &t[i], &a[i]);
	}

	int temp;
	for (int i = 1; i < n; i++) {
		temp = max((a[i - 1] + a[i] - 1) / a[i], (t[i - 1] + t[i] - 1)/ t[i]);
		a[i] = temp * a[i];
		t[i] = temp * t[i];
	}

	printf("%d\n", a[n - 1] + t[n - 1]);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:21:24: error: implicit declaration of function 'max'; did you mean 'fmax'? [-Wimplicit-function-declaration]
   21 |                 temp = max((a[i - 1] + a[i] - 1) / a[i], (t[i - 1] + t[i] - 1)/ t[i]);
      |                        ^~~
      |                        fmax
Language: C

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
/*
int n, k;
int a[15];

int main() {
	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	int ans;
	int color = 0;
	for (int i = 1; i < n; i++) {
		if (a[i - 1] < a[i]) {
			color++;
		}
	}
	while (color < k) {
		
		color = 0;
		for (int i = 1; i < n; i++) {
			if (a[i - 1] < a[i]) {
				color++;
			}
		}
	}
}
*/


int n;
int t[1000];
int a[1000];
int t1,a1;

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d %d", &t[i], &a[i]);
	}

	int temp;
	for (int i = 1; i < n; i++) {
		temp = max((a[i - 1] + a[i] - 1) / a[i], (t[i - 1] + t[i] - 1)/ t[i]);
		a[i] = temp * a[i];
		t[i] = temp * t[i];
	}

	printf("%d\n", a[n - 1] + t[n - 1]);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:46:24: error: implicit declaration of function 'max'; did you mean 'fmax'? [-Wimplicit-function-declaration]
   46 |                 temp = max((a[i - 1] + a[i] - 1) / a[i], (t[i - 1] + t[i] - 1)/ t[i]);
      |                        ^~~
      |                        fmax
Language: C++

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
/*
int n, k;
int a[15];

int main() {
	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	int ans;
	int color = 0;
	for (int i = 1; i < n; i++) {
		if (a[i - 1] < a[i]) {
			color++;
		}
	}
	while (color < k) {
		
		color = 0;
		for (int i = 1; i < n; i++) {
			if (a[i - 1] < a[i]) {
				color++;
			}
		}
	}
}
*/


int n;
int t[1000];
int a[1000];
int t1,a1;

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d %d", &t[i], &a[i]);
	}

	int temp;
	for (int i = 1; i < n; i++) {
		temp = max((a[i - 1] + a[i] - 1) / a[i], (t[i - 1] + t[i] - 1)/ t[i]);
		a[i] = temp * a[i];
		t[i] = temp * t[i];
	}

	printf("%d\n", a[n - 1] + t[n - 1]);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:24: error: 'max' was not declared in this scope; did you mean 'std::max'?
   46 |                 temp = max((a[i - 1] + a[i] - 1) / a[i], (t[i - 1] + t[i] - 1)/ t[i]);
      |                        ^~~
      |                        std::max
In file included from /usr/include/c++/14/bits/specfun.h:43,
                 from /usr/include/c++/14/cmath:3906,
                 from /usr/include/c++/14/math.h:36,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'std::max' declared here
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
Language: C++

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

int main(){
	int n;
	cin>>n;
	
	int x;
	long long int A=0;
	long long int B=0;
	
	for(int i=0;i<n;i++){
		long long int t,a;
		cin>>t>>a;
		x=max(1,max(A/t,B/a));
		while(A>t*x||B>a*x)x++;
		A=x*t;
		B=x*a;
	}
	
	cout<<A+B<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:22: error: no matching function for call to 'max(int, const long long int&)'
   15 |                 x=max(1,max(A/t,B/a));
      |                   ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:15:22: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   15 |                 x=max(1,max(A/t,B/a));
      |                   ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:15:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   15 |                 x=max(1,max(A/t,B/a));
      |                   ~~~^~~~~~~~~~~~~~~~