criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long a = sc.nextLong();
        long b = sc.nextLong();
        
        while (n-- > 1) {
            long newA = sc.nextLong();
            long newB = sc.nextLong();
            long x = (long)Math.ceil(Math.max((double)a / newA), Math.max((double)b / newB));
            a = newA * x;
            b = newB * x;
        }
        
        System.out.println(a+b);
    }
}

Compiler output:
Main.java:14: error: no suitable method found for max(double)
            long x = (long)Math.ceil(Math.max((double)a / newA), Math.max((double)b / newB));
                                                                     ^
    method Math.max(int,int) is not applicable
      (actual and formal argument lists differ in length)
    method Math.max(long,long) is not applicable
      (actual and formal argument lists differ in length)
    method Math.max(float,float) is not applicable
      (actual and formal argument lists differ in length)
    method Math.max(double,double) is not applicable
      (actual and formal argument lists differ in length)
Main.java:14: error: no suitable method found for max(double)
            long x = (long)Math.ceil(Math.max((double)a / newA), Math.max((double)b / newB));
                                         ^
    method Math.max(int,int) is not applicable
      (actual and formal argument lists differ in length)
    method Math.max(long,long) is not applicable
      (actual and formal argument lists differ in length)
    method Math.max(float,float) is not applicable
      (actual and formal argument lists differ in length)
    method Math.max(double,double) is not applicable
      (actual and formal argument lists differ in length)
2 errors
Language: C++

#include <iostream>
#include <vector>
#include <unordered_set>
#include <string>
#include <algorithm>
#include <math.h>
#include <util.h>

using namespace std;


int main() {
	int n;
	cin >> n;
	vector<int> tvotes(n);
	vector<int> avotes(n);


	for(int i = 0; i < n; i++) {
		int t, a;
		cin >> t >> a;
		tvotes[i] = t;
		avotes[i] = a;
	}


	pair<int, int> current = make_pair(tvotes[0], avotes[0]);

	if(n == 1) {
		cout << current.first + current.second << endl;
		return 0;
	}

	for(int i = 1; i < n; i++) {
		if(tvotes[i] < avotes[i]) {
			while((current.first * avotes[i]) % tvotes[i] != 0 || ((current.first * avotes[i]) / tvotes[i]) < current.second) {
				current.first++;
			}
			current.second = (current.first * avotes[i]) / tvotes[i];
		} else if(tvotes[i] == avotes[i]){
			if(current.first == current.second) continue;
			if(current.first > current.second) {
				current.second = current.first;
			} else {
				current.first = current.second;
			}
		} else {
			while((current.second * tvotes[i]) % avotes[i] != 0 || ((current.second * tvotes[i]) / avotes[i]) < current.first) {
				current.second++;
			}
			current.first = (current.second * tvotes[i]) / avotes[i];
		}
	}

	cout << current.first + current.second << endl;
}


Compiler output:
a.cc:7:10: fatal error: util.h: No such file or directory
    7 | #include <util.h>
      |          ^~~~~~~~
compilation terminated.
Language: C++

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

int main(void){
    int N;
    cin>>N;
    ll aok,tkhs;
    cin>>aok>>tkhs;
    if (N==1) {
        cout<<aok+tkhs<<endl;
        return 0;
    }
    for (int i=1;i<N;i++){
        int a,t;
        cin>>a>>t;
        ll n=1;
        /*
        while(a*n<aok || t*n<tkhs) {
            n++;
        }
        */

        n = max((ll)(ceil((double)aok/a)),(ll)(ceil((double)tkhs/t)));
        aok=a*n;
        tkhs=t*n;
        //cout<<aok<<" "<<tkhs<<" "<<a<<" "<<t<<endl;
    }
    cout<<aok+tkhs<<endl;
    return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:30:14: error: expected '}' at end of input
   30 |     return 0;
      |              ^
a.cc:5:15: note: to match this '{'
    5 | int main(void){
      |               ^
Language: C++

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

long int main() {
  int N;
  cin >> N;
  vector<long int> T(N),A(N),B(N);
  for (int i=0;i<N;i++) {
    cin >> T.at(i) >> A.at(i);
  }
  for (int i=0;i<N-1;i++) {
    B.at(i+1) = max( (T.at(i)-1) / T.at(i+1) , (A.at(i)-1) / A.at(i+1)) + 1;
    T.at(i+1) = T.at(i+1) * B.at(i+1);
    A.at(i+1) = A.at(i+1) * B.at(i+1);
  }
  cout << T.at(N-1) + A.at(N-1) << endl;
}

Compiler output:
a.cc:4:6: error: '::main' must return 'int'
    4 | long int main() {
      |      ^~~
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int> T(N),A(N),B(N);
  for (int i=0;i<N;i++) {
    cin >> T.at(i) >> A.at(i);
  }
  for (int i=0;i<N-1;i++) {
    B.at(i+1) = max( (T.at(i)-1) / T.at(i+1) , (A.at(i)-1) / A.at(i+1) ) + 1;
    T.at(i+1) = T.at(i+1) * B.at(i+1);
    A.at(i+1) = A.at(i+1) * B.at(i+1);
  }
  int answer;
  answer = T.at(N-1) + A.at(N-1)
  cout << answer << endl;
  //for(int i=0;i<N;i++) {
    //cout << T.at(i) << ' ' << A.at(i) << endl;
  //}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:33: error: expected ';' before 'cout'
   17 |   answer = T.at(N-1) + A.at(N-1)
      |                                 ^
      |                                 ;
   18 |   cout << answer << endl;
      |   ~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM = 1000000000;
#define mod = MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005
#define NIL -1
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

int main(){
    ll n; cin >> n;
    ll t[n],a[n];
    for(ll i = 0; i < n; i++){
        cin >> t[i] >> a[i];
    }
    ll x = t[0], y = a[0];
    mx = 0;
    for(ll i = 1; i < n; i++){
        ll n = max(x/t[i],y/a[i]);
        x = n*t[i];
        y = n*a[i];
    }
    cout << x+y << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: 'mx' was not declared in this scope; did you mean 'x'?
   20 |     mx = 0;
      |     ^~
      |     x
Language: Java

import java.util.Scanner;

public class Main{
  static Long T[];
  static Long A[];
  static Long TA[];
  static Long TT[];
  static int  N;
  static Long ans=0;

  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    N = sc.nextInt();
    T = new Long[N];
    TT = new Long[N];
    TA = new Long[N];
    A = new Long[N];
    for(int i=0;i<N;i++){
      T[i] = sc.nextLong();
      A[i] = sc.nextLong();
    }
    TT[0] = T[0];
    TA[0] = A[0];
    ans += T[0]+A[0];
    for(int i=0;i<N-1;i++){
      update(i);
    }
    System.out.println(ans);
  }


  static void update(int m){
    Long k = Math.max((TT[m] + T[m+1] - 1) / T[m+1], (TA[m] + A[m+1] - 1) / A[m+1]);
    ans += T[m+1]*k-TT[m]-TA[m]+A[m+1]*k;
    TT[m+1] = T[m+1]*k;
    TA[m+1] = A[m+1]*k;
  }
}


Compiler output:
Main.java:9: error: incompatible types: int cannot be converted to Long
  static Long ans=0;
                  ^
1 error
Language: Java

import java.util.Scanner;

public class Main{
  static int T[];
  static int A[];
  static Long TA[];
  static Long TT[];
  static int  N;
  static int ans=0;

  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    N = sc.nextInt();
    T = new int[N];
    TT = new Long[N];
    TA = new Long[N];
    A = new int[N];
    for(int i=0;i<N;i++){
      T[i] = sc.nextInt();
      A[i] = sc.nextInt();
    }
    TT[0] = T[0];
    TA[0] = A[0];
    ans += T[0]+A[0];
    for(int i=0;i<N-1;i++){
      update(i);
    }
    System.out.println(ans);
  }


  static void update(int m){
    int k = Math.max((TT[m] + T[m+1] - 1) / T[m+1], (TA[m] + A[m+1] - 1) / A[m+1]);
    ans += T[m+1]*k-TT[m]-TA[m]+A[m+1]*k;
    TT[m+1] = T[m+1]*k;
    TA[m+1] = A[m+1]*k;
  }
}


Compiler output:
Main.java:22: error: incompatible types: int cannot be converted to Long
    TT[0] = T[0];
             ^
Main.java:23: error: incompatible types: int cannot be converted to Long
    TA[0] = A[0];
             ^
Main.java:33: error: incompatible types: possible lossy conversion from long to int
    int k = Math.max((TT[m] + T[m+1] - 1) / T[m+1], (TA[m] + A[m+1] - 1) / A[m+1]);
                    ^
Main.java:35: error: incompatible types: int cannot be converted to Long
    TT[m+1] = T[m+1]*k;
                    ^
Main.java:36: error: incompatible types: int cannot be converted to Long
    TA[m+1] = A[m+1]*k;
                    ^
5 errors
Language: C++

using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) cin>>V[I]
#define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I];
#define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I];
#define OUT(P) cout<<P<<endl
#define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl
#define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl
#define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
typedef unsigned long ul;
typedef unsigned int ui;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

unsigned long long N,A,B,i,x,y,n;

inline void solve(){
  IN(N);
  A=1;B=1;
  REP(i,N){
    IN2(x,y);
    n=max(ceil((double)A/(double)x),ceil((double)B/(double)y));
    A=n*x;
    B=n*y;
    }
  }
  OUT(A+B);
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Compiler output:
a.cc:15:16: error: 'cout' does not name a type
   15 | #define OUT(P) cout<<P<<endl
      |                ^~~~
a.cc:40:3: note: in expansion of macro 'OUT'
   40 |   OUT(A+B);
      |   ^~~
a.cc:41:1: error: expected declaration before '}' token
   41 | }
      | ^
Language: C++

from math import *
N = int(input())
T = []
A = []
for i in range(0, N):
    ti, ai = [int(x) for x in input().split()]
    T.append(ti)
    A.append(ai)
 
prevT = T[0]
prevA = A[0]
for i in range(1, N):
    nextfacT = int(ceil(prevT / T[i]))
    nextfacA = int(ceil(prevA / A[i]))
    nextfac = max(nextfacT, nextfacA)
    while(nextfac * T[i] < prevT and nextfac * A[i] < prevA):
        nextfac += 1
    prevT = nextfac * T[i]
    prevA = nextfac * A[i]
 
print(prevA+prevT)

Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from math import *
      | ^~~~
Language: C++

#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

#include<bits/stdc++.h>
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/detail/standard_policies.hpp>*/

#define sz(s) (int)(s.size())
#define all(s) s.begin(), s.end()
#define rep(a, b, c) for(int a = b; a <= c; ++a)
#define per(a, b, c) for(int a = b; a >= c; --a)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;
//using namespace __gnu_pbds;

typedef unsigned long long ull;
typedef long long ll;
/*typedef tree<pair<int, int>, 
null_type, less<pair<int, int>>, 
rb_tree_tag, tree_order_statistics_node_update>
ordered_set;*/
//find_by_order() order_of_key()

const double eps = 1e-7;
const int mod = 1e9+7, MXN = 5e5+17;
const int dx[] = {0,0,1,-1}, dy[] = {1,-1,0,0};

template<typename T>inline bool updmin(T &a, const T &b) {return a > b ? a = b,1 : 0;}
template<typename T>inline bool updmax(T &a, const T &b) {return a < b ? a = b,1 : 0;}

int32_t main() { _
#ifdef DanQQQQQ
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
#endif
	int n; cin >> n;
	int t[n+5]; memset(t,0,sizeof t);
	int a[n+5]; memset(a,0,sizeof a);
	rep(i,1,n) cin >> t[i] >> a[i];
	int T = 1, A = 1, kol = 1;
	rep(i,1,n) {
		k = max((T+t[i]-1)/t[i],(A+a[i]-1)/a[i]);
		T = kol*t[i], A = k*a[i];
	}
	cout << T+A << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:45:17: error: 'k' was not declared in this scope
   45 |                 k = max((T+t[i]-1)/t[i],(A+a[i]-1)/a[i]);
      |                 ^
Language: C++

#include <bits/stdc++.h>
#define full(c) c.begin(), c.end()
#define vector2d(name, type, h, w, init) vector<vector<type>> name(h, vector<type>(w, init))
typedef signed long long int ll;
typedef unsigned long long int ull;
const int PRIME=1000000007;
using namespace std;

int main(){
  ll n,ca,ct;
  cin>>n;
  cin>>ct>>ca;
  n--;
  while(n--){
    //cout<<ct<<ca<<endl;
    ll a,t,m;
    cin>>t>>a;
    na=a;
    nt=t;
    while(na<ca || nt<ct) na+=a, nt+=t;
    ct=nt;
    ca=na;
  }
  cout<<ca+ct<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: 'na' was not declared in this scope; did you mean 'a'?
   18 |     na=a;
      |     ^~
      |     a
a.cc:19:5: error: 'nt' was not declared in this scope; did you mean 't'?
   19 |     nt=t;
      |     ^~
      |     t
Language: Java

import java.util.Scanner;

public class Main {
	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n=scanner.nextInt();
		long t[]=new long[n];
		long a[]=new long[n];
		for(int i=0;i<n;i++) {
			t[i]=scanner.nextInt();
			a[i]=scanner.nextInt();
		}
		for(int i=1;i<n;i++) {
			long p=Math.max(brd_t/t[i], brd_a/a[i]);
			t[i]*=p;
			a[i]*=p;
		}
		System.out.println(t[n-1]+a[n-1]);
	}
}


Compiler output:
Main.java:15: error: cannot find symbol
			long p=Math.max(brd_t/t[i], brd_a/a[i]);
			                ^
  symbol:   variable brd_t
  location: class Main
Main.java:15: error: cannot find symbol
			long p=Math.max(brd_t/t[i], brd_a/a[i]);
			                            ^
  symbol:   variable brd_a
  location: class Main
2 errors
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(){
    long long x,y;
    int n,t,a;
    scanf("%d",&n);
    scanf("%lld %lld",&x,&y);
    for (int i=1;i<n;i++) {
        scanf("%d %d",&t,&a);
        if (x<=t && y<=a) {
            x=t;
            y=a;
        } else {
            long long tk=t*max(x/t,y/a);
            long long ak=a*max(x/t,y/a);
//            for(int j=0;;j++) {
//                if (tk+(t*j)>=x && ak+(a*j)>=y) {
                    x=tk+(t*j);
                    y=ak+(a*j);
//                    break;
//                }
//            }
        }
    }
    printf("%lld\n",x+y);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:29: error: 'j' was not declared in this scope
   20 |                     x=tk+(t*j);
      |                             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >>N;
  int a,af,b,bf;
  cin >> af>>bf;
  for(int i=1;i<N;i++){
    cin >> a>> b;
    for(int j=1;j<1001;j++){
      if(a*j>=af %% b*j>=bf){
        af = a*j;
        bf = b*j;
      }
    }
  }
  cout << af+bf << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: expected primary-expression before '%' token
   12 |       if(a*j>=af %% b*j>=bf){
      |                   ^
Language: Java

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int reports=sc.nextInt();
		long takahashi=sc.nextLong();
		long aoki=sc.nextLong();
		for(int i=1; i<reports; i++) {
			long next_takahashi=sc.nextLong();
			long next_aoki=sc.nextLong();
			long multiplier=Math.max(takahashi/next_takahashi, aoki/next_aoki);
			while(next_aoki*multiplier>aoki || next_takahashi*multiplier>takahashi) {
				multiplier++;
			}
			takahashi=next_takahashi*multiplier;
			aoki=next_aoki*multiplier;
		}
		System.out.println(takahashi+aoki);
	}
}

Compiler output:
Main.java:3: error: cannot find symbol
		Scanner sc=new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner sc=new Scanner(System.in);
		               ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

#include<iostream>

int routine(int t,int a,int num){
  int i=1;
  int n=a+t;
  while(n>=num){
    n=n*i;
    i++;
  }
  return n;
}


int main(){
  int t,a;
  int turn;
  int num;
  int i=1;
  std::cin>>turn;

  while(turn!=i){
    std::cin>>t>>a;
    n=routine(t,a,num);
    i++;
  }

  std::cout<<n<<std::endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:5: error: 'n' was not declared in this scope
   23 |     n=routine(t,a,num);
      |     ^
a.cc:27:14: error: 'n' was not declared in this scope
   27 |   std::cout<<n<<std::endl;
      |              ^
Language: C++


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

int main() {
	int n;
	cin >> n;
	vector<pair<int64_t,int64_t>> t;
	for (int i = 0; i < n; ++i) {
		int64_t ti, ai;
		cin >> ti >> ai;
		t.push_back(make_pair(ti, ai));
	}

	auto p = t[0];
	for (int i = 1; i < t.size(); ++i) {
		auto pn = t[i];
		int64_t mul1 = p.first / pn.first;
		int64_t mul2 = p.second / pn.second;
		if (p.first % pn.first != 0)
			mul1++;
		if (p.second % pn.second != 0)
			mul2++;
		int64_t mul = max(1LL, max(mul1, mul2));
		pn.first *= mul;
		pn.second *= mul;
		p = pn;
	}
	cout << p.first + p.second << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:34: error: no matching function for call to 'max(long long int, const long int&)'
   27 |                 int64_t mul = max(1LL, max(mul1, mul2));
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~
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:3:
/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:27:34: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int')
   27 |                 int64_t mul = max(1LL, max(mul1, mul2));
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~
/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,
                 from a.cc:5:
/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:27:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   27 |                 int64_t mul = max(1LL, max(mul1, mul2));
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~
Language: C++


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

int main() {
	int n;
	cin >> n;
	vector<pair<int64_t,int64_t>> t;
	for (int i = 0; i < n; ++i) {
		int64_t ti, ai;
		cin >> ti >> ai;
		t.push_back(make_pair(ti, ai));
	}

	auto p = t[0];
	for (int i = 1; i < t.size(); ++i) {
		auto pn = t[i];
		int64_t mul1 = p.first / pn.first;
		int64_t mul2 = p.second / pn.second;
		if (p.first % pn.first != 0)
			mul1++;
		if (p.second % pn.second != 0)
			mul2++;
		int64_t mul = max(1LL, max(mul1, mul2));
		pn.first *= mul;
		pn.second *= mul;
		p = pn;
	}
	cout << p.first + p.second << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:34: error: no matching function for call to 'max(long long int, const long int&)'
   26 |                 int64_t mul = max(1LL, max(mul1, mul2));
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~
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:2:
/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:26:34: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int')
   26 |                 int64_t mul = max(1LL, max(mul1, mul2));
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~
/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,
                 from a.cc:4:
/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:26:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   26 |                 int64_t mul = max(1LL, max(mul1, mul2));
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long N,T,A,t,a;
	cin>>N;
	t=a=1;
	for(long long n=0;n<N;n++)
	{
		cin>>T>>A;
		long long k=max((t+T-1)/T), ((a+A-1)/A);
		t=k*T;
		a=k*A;
	}
	cout<<t+A<<endl;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:11:32: error: no matching function for call to 'max(long long int)'
   11 |                 long long k=max((t+T-1)/T), ((a+A-1)/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:   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:11:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   11 |                 long long k=max((t+T-1)/T), ((a+A-1)/A);
      |                             ~~~^~~~~~~~~~~
/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;
int main(){
	long long N,T,A,t,a;
	cin>>N;
	t-a=l;
	for(long long n=0;n<N;n++){
	cin>>T>>A;
	long long n=max((t+T-l)/T,(a+A-l)/A);
	t=k*T;
	a=k*A; 
	}
	cout<<t+a<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:13: error: 'l' was not declared in this scope
    6 |         t-a=l;
      |             ^
a.cc:9:19: error: redeclaration of 'long long int n'
    9 |         long long n=max((t+T-l)/T,(a+A-l)/A);
      |                   ^
a.cc:7:23: note: 'long long int n' previously declared here
    7 |         for(long long n=0;n<N;n++){
      |                       ^
a.cc:10:11: error: 'k' was not declared in this scope
   10 |         t=k*T;
      |           ^
Language: C++

#include <iostream>
using namespace std;
int main(){
	long long N,T,A,t,a;
	cin>>N;
	t=a=1;
	for(long long n=0;n<N;n++)
	{
		cin>>T>>A;
		long long k=max((t+T-1)/T,(A+a-1)/A)
		t=k*T;
		a=A*k;
		cout<<t<<" "<<a<<endl;
	}
	cout<<t+a<<endl;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: expected ',' or ';' before 't'
   11 |                 t=k*T;
      |                 ^
Language: C++

#include <iostream>
using namespace std;
int main(){
	long long N,T,A,t,a;
	cin>>N;
	t=a=1;
	for(long long n=0;n<N;n++)
	{
		cin>>T>>A;
		long long T=max((t+T-1)/T,(A+a-1)/A)
		t=k*T;
		a=A*k;
		cout<<t<<" "<<a<<endl;
	}
	cout<<t+a<<endl;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: expected ',' or ';' before 't'
   11 |                 t=k*T;
      |                 ^
a.cc:12:21: error: 'k' was not declared in this scope
   12 |                 a=A*k;
      |                     ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
int main(){
    int n;cin>>n;--n;
    int a,b,t,s,tmpa,tmpb;cin>>a>>b;
    for(int i=0;i<n;++i){
        cin>>t>>s;tmpa=t,tmpb=s;
        int m=max((a+t-1)/t,(b+s-1)/s));
        a=m*t;b=m*s;
    }cout<<a+b;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:39: error: expected ',' or ';' before ')' token
    8 |         int m=max((a+t-1)/t,(b+s-1)/s));
      |                                       ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
int main(){
    int n;cin>>n;--n;
    int a,b,t,s,tmpa,tmpb;cin>>a>>b;
    for(int i=0;i<n;++i){
        cin>>t>>s;tmpa=t,tmpb=s;
        int m=max((a+t-1)/t),ceil((b+s-1)/s));
        a=m*t;b=m*s;
    }cout<<a+b;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:18: error: no matching function for call to 'max(int)'
    8 |         int m=max((a+t-1)/t),ceil((b+s-1)/s));
      |               ~~~^~~~~~~~~~~
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:8:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
    8 |         int m=max((a+t-1)/t),ceil((b+s-1)/s));
      |               ~~~^~~~~~~~~~~
/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<iostream>
#include<vector>
using namespace std;
long minCommonMulti(long a,long b){

	long n = 2;
	vector<long> v;
	//从2开始寻找可以被整除的数 ,一个数可以被整除多次 
	while(b>1 || a>1){
		bool devided=0;//本轮是否有被整除，无论哪个都可以 
		if( b /n * n == b){
			b=b/n;
			devided=1;
		}
		
		if( a /n * n == a){
			a=a/n;
			devided=1;
		}
		if(devided){
			//只要有被整除，就记录下载，2可能会被整除多次 
			v.push_back(n);
		}else{
			//如果当前不能被整除了，那就继续找下一个 
			n++;	
		}
	}
	long result = 1;
	for(int i=0;i<v.size();i++){
		result *= v[i]; 
	}
	
	return result;
} 

bool allOne(long[] nums){
	for(int i=0;i<nums.length();i++){
		if(nums[i] != 1){
			return 0;
		}
	}
	return 1;
}

long minCommonMulti(long[] nums){

	long n = 2;
	vector<long> v;
	//从2开始寻找可以被整除的数 ,一个数可以被整除多次 
	while(!allOne(nums)){//只要还有一个1，就得继续下去 
		bool devided=0;//本轮是否有被整除，无论哪个都可以 
		for(int i=0;i<nums.length();i++){
			if( nums[i] /n * n == nums[i]){
				nums[i]=nums[i]/n;
				devided=1;
			}	
		}
		
		if(devided){
			//只要有被整除，就记录下载，2可能会被整除多次 
			v.push_back(n);
		}else{
			//如果当前不能被整除了，那就继续找下一个 
			n++;	
		}
	}
	long result = 1;
	for(int i=0;i<v.size();i++){
		result *= v[i]; 
	}
	
	return result;
} 

int main(){

	int n;
	cin>>n;
	long a[n],b[n];
	for(int i=0;i<n;i++){
		c>>a[i]>>b[i];
	}
	long ra=minCommonMulti(a);
	long rb=minCommonMulti(b);
	cout<<ra+rab; 
}

Compiler output:
a.cc:36:20: error: expected ',' or '...' before 'nums'
   36 | bool allOne(long[] nums){
      |                    ^~~~
a.cc: In function 'bool allOne(long int*)':
a.cc:37:23: error: 'nums' was not declared in this scope
   37 |         for(int i=0;i<nums.length();i++){
      |                       ^~~~
a.cc: At global scope:
a.cc:45:28: error: expected ',' or '...' before 'nums'
   45 | long minCommonMulti(long[] nums){
      |                            ^~~~
a.cc: In function 'long int minCommonMulti(long int*)':
a.cc:50:23: error: 'nums' was not declared in this scope
   50 |         while(!allOne(nums)){//只要还有一个1，就得继续下去
      |                       ^~~~
a.cc: In function 'int main()':
a.cc:81:17: error: 'c' was not declared in this scope
   81 |                 c>>a[i]>>b[i];
      |                 ^
a.cc:85:18: error: 'rab' was not declared in this scope; did you mean 'rb'?
   85 |         cout<<ra+rab;
      |                  ^~~
      |                  rb
Language: C++

import math
N = int(input())
T = 1
A = 1
for i in range(N):
  ti, ai = map(int, input().split())
  m = max(math.ceil(T / min(T, ti)), math.ceil(A / min(A, ai)))
  T = ti * m
  A = ai * m
print(int(T + A))

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import math
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <bits/stdc++.h>
#define FOR(I,X,Y) for(int (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(int (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define INF 1000000007
#define LINF 1000000000000000007
typedef long long ll;
using namespace std;

int main(){
  ll N,T,A,t=1,a=1,q;
  cin >> N;
  FOR(i,0,N){
    cin >> T >> A;
    q = max((T+t-1)/T,(A+a-1)/A);
    t = q*T;
    a = q*A;
    cerr << t << " " << a << endl;
  }
  cout << t+a << endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:20:23: error: expected '}' at end of input
   20 |   cout << t+a << endl;
      |                       ^
a.cc:10:11: note: to match this '{'
   10 | int main(){
      |           ^
Language: C++

#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long LL;
inline LL gcd(LL a,LL b)
{
	return !b?a:gcd(b,a%b);
}

int main()
{
	int n;
	scanf("%d",&n);
	
	LL a,b,A=1,B=1;
	LL G;
	for(int i=1;i<=n;i++)
	{
		scanf("%lld %lld",&a,&b);
		if(a>A && b>B) A=a,B=b;
		else
		{
			G=max((A/a)+(A%a?1:0),B/b+(B%b?1:0);
			A=a*G,B=b*G;
		}
	}
	
	printf("%lld\n",A+B);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:60: error: expected ')' before ';' token
   23 |                         G=max((A/a)+(A%a?1:0),B/b+(B%b?1:0);
      |                              ~                             ^
      |                                                            )
Language: C++

N = int(input())
TA = []
for i in range(N):
    TA.append(list(map(int, input().split())))

t_real = [TA[0][0]]
a_real = [TA[0][1]]

for i in range(1,N):
    t_cand = (t_real[i-1]//TA[i][0] + bool(t_real[i-1]%TA[i][0])) * TA[i][0]
    a_cand = (a_real[i-1]//TA[i][1] + bool(a_real[i-1]%TA[i][1])) * TA[i][1]
    
    if t_cand//TA[i][0] * TA[i][1] >= TA[i-1][1]:
        t_real.append(t_cand)
        a_real.append(t_cand//TA[i][0] * TA[i][1])
        
    elif a_cand//TA[i][1] * TA[i][0] >= TA[i-1][0]:
        a_real.append(a_cand)
        t_real.append(a_cand//TA[i][1] * TA[i][0])
        
    else:
        print("error")
        
        
print(t_real[-1]+a_real[-1])

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N = int(input())
      | ^
Language: C++

#include <iostream>
using namespace std;

int main()
{
  int n;
  cin >> n;
  int t[1010], a[1010];
  for (int i = 0; i < n; ++i) {
    cin >> t[i] >> a[i];
  }
  
  int vt = t[0];
  int va = a[0];
  
  for (int i = 0; i < n; ++i) {
    if (vt * a[i] < va * t[i]) {
      while (1) {
        vt++;
        if (vt * a[i] = va * t[i])
          break;
      }
    } else if (vt * a[i] > va * t[i]) {
      while (1) {
        va++;
        if (vt * a[i] = va * t[i])
          break;
      }
    }
  }
  cout << vt + va << endl;
  return 0;
}
    


Compiler output:
a.cc: In function 'int main()':
a.cc:20:16: error: lvalue required as left operand of assignment
   20 |         if (vt * a[i] = va * t[i])
      |             ~~~^~~~~~
a.cc:26:16: error: lvalue required as left operand of assignment
   26 |         if (vt * a[i] = va * t[i])
      |             ~~~^~~~~~
Language: C++

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


int main() {
    int n;
    cin>>n;
    long long r=0,l=0;
    cin>>l>>r;
    for (int i = 1; i < n; ++i) {
        int ll,rr;
        cin>>ll>>rr;
        int ra = max(int((r + rr - 1) / rr), int((l + ll - 1) / ll));
        l=ll*ra;
        r=rr*ra;
    }
    cout<<r+l<<endl;
    return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:2:13: error: expected primary-expression before 'long'
    2 | #define int long long
      |             ^~~~
a.cc:14:22: note: in expansion of macro 'int'
   14 |         int ra = max(int((r + rr - 1) / rr), int((l + ll - 1) / ll));
      |                      ^~~
a.cc:2:13: error: expected primary-expression before 'long'
    2 | #define int long long
      |             ^~~~
a.cc:14:46: note: in expansion of macro 'int'
   14 |         int ra = max(int((r + rr - 1) / rr), int((l + ll - 1) / ll));
      |                                              ^~~
Language: C++

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

int main(){
    int n;
    cin >> n;
    long long int T = 1, A = 1;
    long long int sum = T + A;
    for(int i = 0; i < n; i++){
        long long int t, a;
        cin >> t;
        cin >> a;
        long long int k = max(1+((A-1)/a), 1+((B-1)/b));
        T = k * t;
        A = k * a;
        //cout << "t,a:" << T << " " << A << "\n";
        sum = T + A; 
    }
    cout << sum << "\n";
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:48: error: 'B' was not declared in this scope
   15 |         long long int k = max(1+((A-1)/a), 1+((B-1)/b));
      |                                                ^
a.cc:15:53: error: 'b' was not declared in this scope
   15 |         long long int k = max(1+((A-1)/a), 1+((B-1)/b));
      |                                                     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> P;
map <int,int> mp;
vector<int> V;
list<int> L;
stack<int> S;
queue<int> Q;
deque<int> dq;
#define INF (1<<30)
#define INFLL (1ll<<60)
#define EPS (1e-10)
static const int MAX=100000;
static const int MOD=1e9+7;
static const int NMAX=50;
static const int MMAX=50;
int N
ll T[2],A[2],k1,k2;
ll sum;
int main(){
    cin.tie(0);  ios::sync_with_stdio(false);
    
    cin>>N;
    cin>>T[0]>>A[0];
    N--;
    while(N--){
        cin>>T[1]>>A[1];
        
        k1=(T[0]%T[1]?T[0]/T[1]+1:T[0]/T[1]);
        k2=(A[0]%A[1]?A[0]/A[1]+1:A[0]/A[1]);
        
        
        T[1]*=max(k1,k2);
        A[1]*=max(k1,k2);
        
        swap(T[0],T[1]); swap(A[0],A[1]);
    }
    
    cout<<T[0]+A[0]<<"\n";
    return 0;
}


Compiler output:
a.cc:20:1: error: expected initializer before 'll'
   20 | ll T[2],A[2],k1,k2;
      | ^~
a.cc: In function 'int main()':
a.cc:25:10: error: 'N' was not declared in this scope
   25 |     cin>>N;
      |          ^
a.cc:26:10: error: 'T' was not declared in this scope
   26 |     cin>>T[0]>>A[0];
      |          ^
a.cc:26:16: error: 'A' was not declared in this scope
   26 |     cin>>T[0]>>A[0];
      |                ^
a.cc:31:9: error: 'k1' was not declared in this scope; did you mean 'y1'?
   31 |         k1=(T[0]%T[1]?T[0]/T[1]+1:T[0]/T[1]);
      |         ^~
      |         y1
a.cc:32:9: error: 'k2' was not declared in this scope
   32 |         k2=(A[0]%A[1]?A[0]/A[1]+1:A[0]/A[1]);
      |         ^~
Language: C++

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

typedef long long ll;

int main(){
    ll n; 
    cin >> n;

    ll a,b;
    ll x=1,y-1; 

    for(int i=0;i<n;i++){ 
        cin >> a >> b;
        ll k=max((x+a-1)/a,(y+b-1)/b);
        x=a*k;
        y=b*k;
    }

    cout << x + y << endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: expected initializer before '-' token
   11 |     ll x=1,y-1;
      |             ^
a.cc:15:29: error: 'y' was not declared in this scope
   15 |         ll k=max((x+a-1)/a,(y+b-1)/b);
      |                             ^
a.cc:20:17: error: 'y' was not declared in this scope
   20 |     cout << x + y << endl;
      |                 ^
Language: C++

//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int maxn=500001;
P a[maxn],b[maxn];
vector<ll> divisor(ll x){
  vector<ll> res;
  for(ll i=1LL;i*i<=x;i++){
    if(x%i==0){
      res.push_back(i);
      if(i!=x/i)res.push_back(x/i);
    }
  }
  return res;
}

int main(){
  ll n;
  cin>>n;
  ll s1=1LL,s2=1LL;
  for(int i=0;i<n;i++){
    ll tmp1,tmp2;
    cin>>tmp1>>tmp2;
    ll nn=max((tmp1+s1-1)/tmp1,(tmp2+s2-1)/tmp2)
    s1=nn*tmp1;
    s2=nn*tmp2;
  }
  cout<<s1+s2<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:5: error: expected ',' or ';' before 's1'
   48 |     s1=nn*tmp1;
      |     ^~
Language: C++

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

int main() {
  int n; cin >> n;
  vector<ll> T(n), A(n);
  for (int i = 0; i < n; ++i) cin >> T[i] >> A[i];
  ll t = 1; a = 1;
  for (int i = 0; i < n; ++i) {
    ll j = (t+T[i]-1)/T[i];
    j = max(j, (a+A[i]-1)/A[i]);
    t = T[i]*j, a = A[i]*j;
  }
  cout << t+a << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: 'a' was not declared in this scope
    9 |   ll t = 1; a = 1;
      |             ^
Language: C++

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

int main() {
  int n; cin >> n;
  vector<ll> a(n), t(n);
  for (int i = 0; i < n; ++i) cin >> a[i] >> t[i];
  ll ansa = 0, anst = 0;
  for (int i = 0; i < n; ++i) {
    int j = (ansa+a[i]-1)/a[i];
    j = max(j, (anst+t[i]-1)/t[i]);
    ansa = j*ansa, anst = j*anst;
  }
  cout << ansa + anst << endl;
  return 0;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: no matching function for call to 'max(int&, ll)'
   12 |     j = max(j, (anst+t[i]-1)/t[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:   template argument deduction/substitution failed:
a.cc:12:12: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   12 |     j = max(j, (anst+t[i]-1)/t[i]);
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~
/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:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   12 |     j = max(j, (anst+t[i]-1)/t[i]);
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(int a=0;a<t;a++) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
#define pb push_back
long gcd(long a, long b)
{
	if (b == 0) { return a; }
	return gcd(b, a % b);
}
long lcm(long a, long b) { return a / gcd(a, b)*b; }
int ceil(double a) {
	if ((double)((int)a) == a) { return (int)a; }

	return (int)a+1;
}
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n1;
	cin >> n1;
	int left = 0;
	int right = 0;
	rep(i, n1) {
		int x, y;
		cin >> x >> y;
		int n = max(ceil(left / (double)x), ceil(right / (double)y));
		left = n*x;
		right = n*y;
	}
	cout << left + right << endl;
	return 0;
}


Compiler output:
a.cc:38:5: error: ambiguating new declaration of 'int ceil(double)'
   38 | int ceil(double a) {
      |     ^~~~
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:28,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:192:1: note: old declaration 'double ceil(double)'
  192 | __MATHCALLX (ceil,, (_Mdouble_ __x), (__const__));
      | ^~~~~~~~~~~
Language: C++

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ROF(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumlate(all(a),0)
#define pb push_back
#define fst first
#define snd second
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

main(){
  ll n; cin >> n;

  ll a = 1, b = 1;
  ll x, y;
  ll m;
  rep(i,n){
    cin >> x >> y;
    m = max((a + x -1) / x, (b + y - 1) / y);
    m = max(m, 1);
    //cout << m << endl;
    a = m * x; b = m * y;
  }
  cout << a + b << endl;
}


Compiler output:
a.cc:20:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   20 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:29:12: error: no matching function for call to 'max(ll&, int)'
   29 |     m = max(m, 1);
      |         ~~~^~~~~~
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:29:12: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   29 |     m = max(m, 1);
      |         ~~~^~~~~~
/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:29:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   29 |     m = max(m, 1);
      |         ~~~^~~~~~