criyle/codenet-compile-errors huggingface dataset:
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(){
  int n; cin >> n;

  ll a = 1, b = 1;
  int x, y;
  int 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;
  }
  ll ans = a + b
  cout << ans << 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:34:3: error: expected ',' or ';' before 'cout'
   34 |   cout << ans << endl;
      |   ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){

    long long int N,i,j,k,A = 1,B = 1;
    cin >> N;

    int n[N][2];
    for(i = 0; i < N; i++) {
        cin >> n[i][0] >> n[i][1];
    }
    long long int a = n[0][0],b = n[0][1];

    for(i = 1; i < N; i++) {
        for(j = 0; j < 1000; j++) {
            if (n[i][1] * a * A > n[i][0] * b * B) {
                (b * B)++;
            } else if (n[i][1] * a * A < n[i][0] * b * B) {
                (a * A)++;
            } else {
                break;
            }
            if(j == 999) {
                for(k = 0; k < 1000; k++) {
                    if( (a + A) % i == 0 && (b * B) % i == 0) {
                        a /= i;
                        b /= i;
                        A *= i;
                        B *= i;
                    }
                }
            }
        }
    }
    cout << a * A + b * B << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:20: error: lvalue required as increment operand
   17 |                 (b * B)++;
      |                 ~~~^~~~
a.cc:19:20: error: lvalue required as increment operand
   19 |                 (a * A)++;
      |                 ~~~^~~~
Language: C

#include<stdio.h>
int main(void){
int n,i;
long long t,a,anst=1,ansa=1,tt,ta;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%lld %lld",&t,&a);
if(anst%t)tt=anst/t+1;
else tt=anst/t;
if(ansa%a)ta=ansa/a+1;
else ta=ansa/a;
if(tt>ta){
anst=t*tt;
ansa=a*tt
}
else{
anst=t*ta;
ansa=a*ta;
}
}
printf("%lld\n",anst+ansa);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:14:10: error: expected ';' before '}' token
   14 | ansa=a*tt
      |          ^
      |          ;
   15 | }
      | ~
Language: C++

int main(){
int t ;
int count = 0;



// for reading in values
int a;
int b;

  cin >> t ;
  int* arrayT = new int[t];
  int* arrayA = new int[t];

  while (count < t){
    cin >> a >> b;
   arrayT[count] = a;
   arrayA[count] = b;
   count++;
  }
//current number of votes for t and a

int Tvotes;

  int Avotes;

  Tvotes = arrayT[0];
  Avotes = arrayA[0];
// votes cannot decrease can only increase

// loop thru all the steps
  for(int a = 1; a < t ; a++ ){
int currA = arrayA[a];
int prevA = Avotes;
int currT = arrayT[a];
int prevT = Tvotes;




// true is t is bigger false is a bigger
bool currW = (currT >= currA)? true : false;
bool prevW = (prevT >= prevA)? true : false;



double DcurrA = arrayA[a];
double DprevA = Avotes;
double DcurrT = arrayT[a];
double DprevT = Tvotes;

bool TTT = (currT >= Tvotes)? true : false;
bool AAA = (currA >= Avotes)? true : false;


double Tratio = DprevT / DcurrT;
double Aratio = DprevA / DcurrA;

// 1
if(currT == currA){
    if(prevW){
      Avotes = Tvotes;
      continue;
    }
  else{
    Tvotes = Avotes;
    continue;
  }
}
//2
// when both are more than before, u add em, so the same
if (TTT && AAA){
  Avotes = currA;
  Tvotes = currT;
  continue;
}
//3
//both less
if(!TTT && !AAA){
if(Tratio > Aratio){
  for (int a = 1; Tratio; a++){
    if (currT * a >= Tvotes){
      Avotes = currA * a;
      Tvotes = currT * a;
      break;
      }
      continue;
}}
else{
  for (int a = 1; Tratio; a++){
    if (currA * a >= Avotes){
      Avotes = currA * a;
      Tvotes = currT * a;
      break;
      }
      continue;
}
}
}

//if one is less than the other mess with the smaller one

if(!TTT && Aratio > Tratio){
  for (int a = 1; !TTT; a++){
    if (currT * a >= Tvotes){
      Avotes = currA * a;
      Tvotes = currT * a;
      break;
      }
}
continue;

}

if(!AAA && Tratio > Aratio){
  for (int a = 1; !AAA; a++){
    if (currA * a >= Avotes){
      Avotes = currA * a;
      Tvotes = currT * a;
      break;
      }
}
continue;

}






// if t is greater mess with a
if(currW) {
  for (int a = 1; currW; a++){
    if (currA * a >= Avotes){
      Avotes = currA * a;
      Tvotes = currT * a;
      break;
      }

  }
continue;
}else{
  for (int a = 1; !currW; a++){
    if (currT * a >= Tvotes){
      Avotes = currA * a;
      Tvotes = currT * a;
      break;
    }
  }
continue;}






  }

cout << Avotes + Tvotes;
delete[] arrayT;
delete[] arrayA;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'cin' was not declared in this scope
   11 |   cin >> t ;
      |   ^~~
a.cc:160:1: error: 'cout' was not declared in this scope; did you mean 'count'?
  160 | cout << Avotes + Tvotes;
      | ^~~~
      | count
Language: C++

int main() {
  int n;
  long int a, b;
  long int ca, cb, sa, sb, ma, mb;
  long int mag;
  cin >> n;
  cin >> a >> b;
  n--;
  ca = a, cb = b;
  for (unsigned i = 0; i < n; i++) {
    cin >> a >> b;
    sa = ca / a, ma = ca % a;
    sb = cb / b, mb = cb % b;
    if (ma != 0)
      sa++;
    if (mb != 0)
      sb++;
    mag = max(sa, sb);
    ca = a * mag, cb = b * mag;
  }
  cout << ca + cb << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin >> n;
      |   ^~~
a.cc:18:11: error: 'max' was not declared in this scope; did you mean 'mag'?
   18 |     mag = max(sa, sb);
      |           ^~~
      |           mag
a.cc:21:3: error: 'cout' was not declared in this scope
   21 |   cout << ca + cb << endl;
      |   ^~~~
a.cc:21:22: error: 'endl' was not declared in this scope
   21 |   cout << ca + cb << endl;
      |                      ^~~~
Language: Java

import java.util.Scanner;

public class Prob3 {


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] original = new int[2];
        int[] multiples = new int[2];
        int[] manipulate = new int[2];
        int t = sc.nextInt();
        original[0] = sc.nextInt();
        original[1] = sc.nextInt();
        int numvotes = original[0] + original[1];

        for (int i = 0; i < t - 1; i++) {
            manipulate[0] = sc.nextInt();
            manipulate[1] = sc.nextInt();
            if (manipulate[0] > original[0] && manipulate[1] > original[1]) {
                numvotes += (manipulate[1] - original[1]) + (manipulate[0] - original[0]);
                original[0] = manipulate[0];
                original[1] = manipulate[1];
                continue;
            }
            if (manipulate[0] == original[0] && manipulate[1] == original[1])
                continue;
            multiples[0] = manipulate[0];
            multiples[1] = manipulate[1];
            int n = 1;
            while (multiples[0] < original[0] || multiples[1] < original[1]) {

                multiples = multiply(manipulate, n);
                n++;
            }
            numvotes += (multiples[1] - original[1]) + (multiples[0] - original[0]);
            original[0] = multiples[0];
            original[1] = multiples[1];

        }
        System.out.println(numvotes);
    }
    public static int[] multiply(int[] input, int n) {
        int[] output = {input[0], input[1]};
        for (int i = 0; i < input.length; i++) {
            output[i] *= n;
        }
        return output;
    }

}


Compiler output:
Main.java:3: error: class Prob3 is public, should be declared in a file named Prob3.java
public class Prob3 {
       ^
1 error
Language: C++

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




//A
// int main(){
// int a,b,c,d,e,f;
// int t;
// int count = 0;
//
//   cin >> t ;
//   int* array = new int[t];
//   while (count != t){
//     cin >> a >> b;
//    array[count] = a % b;
//    count++;
//   }
//
//
//
//   for (int a = 0; a < t ; a++){
//     cout << array[a] << endl;
//   }
//   return 0;
// }

int main(){
int t ;
int count = 0;
int Avotes;
int Tvotes;
int yolo;
int a;
int b;
  cin >> t ;
  int* arrayT = new int[t];
  int* arrayA = new int[t];
  while (count != t){
    cin >> a >> b;
   arrayT[count] = a;
   arrayA[count] = b;
   count++;
  }
  Tvotes = arrayT[0];
  Avotes = arrayA[0];

  for (int a = 1; a < count; a++){
    int currentT = arrayT[a];
    int prevT = arrayT[a-1];
    int currentA = arrayA[a];
    int prevA = arrayA[a-1];

    int totalCurr = currentT + currentA;
    int totalPrev = prevT + prevA;

    int min = lcd(totalCurr, totalPrev)

    int lol = min / totalCurr;

    Avotes = currentA * lol;
    Tvotes = currentT * lol;

  }

  yolo = Avotes + Tvotes;

  cout << yolo;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:59:15: error: 'lcd' was not declared in this scope
   59 |     int min = lcd(totalCurr, totalPrev)
      |               ^~~
a.cc:63:25: error: 'lol' was not declared in this scope
   63 |     Avotes = currentA * lol;
      |                         ^~~
Language: C++

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

using namespace std;

int main()
{
    int N, T[1000], A[1000];
    cin >> N;
    for(int i=0; i<N; i++) cin >> T[i] >> A[i];

    long long a = T[0], b = A[0];
    for(int i=1; i<N; i++){
        long long n = max(ceil(1.0 * a/(1LL*T[i])), ceil(1.0 * b/(1LL*A[i]));
        a = n * T[i];
        b = n * A[i];
    }

    cout << a + b << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:77: error: expected ')' before ';' token
   16 |         long long n = max(ceil(1.0 * a/(1LL*T[i])), ceil(1.0 * b/(1LL*A[i]));
      |                          ~                                                  ^
      |                                                                             )
Language: C++

#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<numeric>
using namespace std;

int main(void)
{
	int N;
	cin >> N;

	long long cnt[2];
	cin >> cnt[0] >> cnt[1];

	for(int i=1; i<N; i++)
	{
		int T, A;
		cin >> T >> A;

		long long n = max(ceil(1.0*cnt[0]/T), ceil(1.0*cnt[1]/A));
		cnt[0] = T * n;
		cnt[1] = A * n;
	}

	cout << accumulate(begin(cnt), end(cnt), 0) << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:35: error: 'ceil' was not declared in this scope
   21 |                 long long n = max(ceil(1.0*cnt[0]/T), ceil(1.0*cnt[1]/A));
      |                                   ^~~~
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;
#define out(s) cout<<(s)<<endl;
using ll = long long;
int main()
{
	int N;
	ll ans;
	ll T_sum, A_sum;
	cin >> N;
	cin >> T_sum >> A_sum;
	for (size_t i = 0; i < N-1; i++)
	{
		int Ti, Ai;
		cin >> Ti >> Ai;
		int x, y, k;
		k = ceil(max((double)T_sum / Ti, (double)A_sum / Ai));
		x = Ti*k - T_sum;
		y = Ai*k - A_sum;
		T_sum += x;
		A_sum += y;
	}
	ans = T_sum + A_sum;
	out(ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:21: error: 'ceil' was not declared in this scope
   21 |                 k = ceil(max((double)T_sum / Ti, (double)A_sum / Ai));
      |                     ^~~~
Language: C++

import java.util.*;

public class Main {

     public static void main(String []args){

		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int[] t = new int[n];
		int[] a = new int[n];
		
		for (int i = 0; i < n; i++) {
			t[i] = in.nextInt();
			a[i] = in.nextInt();
		}
		
		long tt = t[0];
		long aa = a[0];
		long base = 1;
		
		for (int i = 1; i < n; i++) {
			while (base * t[i] < tt || base * a[i] < aa) {
				base++;
			}
			tt = base * t[i];
			aa = base * a[i];
		}

		while (1 < base && tt <= (base - 1) * t[n - 1] && aa <= (base - 1) * a[n - 1]) {
			base--;
		}

		System.out.println(base * t[n - 1] + base * a[n - 1]);
	}
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
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: Java

import java.util.*;
 
public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        int n = sc.nextInt();
        long t = sc.nextLong();
        long a = sc.nextLong();
        long nt = 0,na = 0;
        for (int i = 1;i < n;i++) {
            T = sc.nextLong();
            A= sc.nextLong();
            long m = Math.max((t-1)/T+1,(a-1)/A+1);
            t = T*m;
            a = A*m;
        }
        
        System.out.println(t+a);
    }
}

Compiler output:
Main.java:11: error: cannot find symbol
            T = sc.nextLong();
            ^
  symbol:   variable T
  location: class Main
Main.java:12: error: cannot find symbol
            A= sc.nextLong();
            ^
  symbol:   variable A
  location: class Main
Main.java:13: error: cannot find symbol
            long m = Math.max((t-1)/T+1,(a-1)/A+1);
                                    ^
  symbol:   variable T
  location: class Main
Main.java:13: error: cannot find symbol
            long m = Math.max((t-1)/T+1,(a-1)/A+1);
                                              ^
  symbol:   variable A
  location: class Main
Main.java:14: error: cannot find symbol
            t = T*m;
                ^
  symbol:   variable T
  location: class Main
Main.java:15: error: cannot find symbol
            a = A*m;
                ^
  symbol:   variable A
  location: class Main
6 errors
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(); 
    }
    // i回目の投票時が(t[i]k,a[i]k)としたときのkの最小値
    long[] dp = new long[N];
    dp[0] = 1;
    for(int i = 1; i < N; i++) {
      BigDecimal t1 = new BigDecimal(t[i - 1] * dp[i - 1]);
      BigDecimal t2 = new BigDecimal(t[i]);
      BigDecimal a1 = new BigDecimal(a[i - 1] * dp[i - 1]);
      BigDecimal a2 = new BigDecimal(a[i]);
      long k1 = (long)Math.ceil((t1.divide(t2)).doubleValue());
      long k2 = (long)Math.ceil((a1.divide(a2)).doubleValue());
      dp[i] = Math.max(k1, k2);
    }
    System.out.println(dp[N - 1] * (t[N - 1] + a[N - 1]));
  }
}

Compiler output:
Main.java:17: error: cannot find symbol
      BigDecimal t1 = new BigDecimal(t[i - 1] * dp[i - 1]);
      ^
  symbol:   class BigDecimal
  location: class Main
Main.java:17: error: cannot find symbol
      BigDecimal t1 = new BigDecimal(t[i - 1] * dp[i - 1]);
                          ^
  symbol:   class BigDecimal
  location: class Main
Main.java:18: error: cannot find symbol
      BigDecimal t2 = new BigDecimal(t[i]);
      ^
  symbol:   class BigDecimal
  location: class Main
Main.java:18: error: cannot find symbol
      BigDecimal t2 = new BigDecimal(t[i]);
                          ^
  symbol:   class BigDecimal
  location: class Main
Main.java:19: error: cannot find symbol
      BigDecimal a1 = new BigDecimal(a[i - 1] * dp[i - 1]);
      ^
  symbol:   class BigDecimal
  location: class Main
Main.java:19: error: cannot find symbol
      BigDecimal a1 = new BigDecimal(a[i - 1] * dp[i - 1]);
                          ^
  symbol:   class BigDecimal
  location: class Main
Main.java:20: error: cannot find symbol
      BigDecimal a2 = new BigDecimal(a[i]);
      ^
  symbol:   class BigDecimal
  location: class Main
Main.java:20: error: cannot find symbol
      BigDecimal a2 = new BigDecimal(a[i]);
                          ^
  symbol:   class BigDecimal
  location: class Main
8 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
 int n;
 int t[1000]={},a[1000]={};
 cin>>n;
 for(int i=0;i<n;i++){
  cin>>t[i]>>a[i];
  if(i)
   if(a[i-1]>a[i] || t[i-1]>t[i]){
    if(a[i-1]/a[i]>=t[i-1]/t[i])j=a[i-1]/a[i];
    else j=t[i-1]/t[i];
    a[i]*=j+1;
    t[i]*=j+1;
   }
 }
 cout<<a[n-1]+t[n-1]<<endl;
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:33: error: 'j' was not declared in this scope
   11 |     if(a[i-1]/a[i]>=t[i-1]/t[i])j=a[i-1]/a[i];
      |                                 ^
a.cc:12:10: error: 'j' was not declared in this scope
   12 |     else j=t[i-1]/t[i];
      |          ^
a.cc:13:11: error: 'j' was not declared in this scope
   13 |     a[i]*=j+1;
      |           ^
Language: Java

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] t = new int[N];
    int[] a = new int[N];
    for(int i = 0; i < N; i++) {
      t[i] = sc.nextInt();
      a[i] = sc.nextInt();
    }
    // dp[i]はi回目までの投票数の最小値を表す
    long[] dp = new long[N];
    dp[0] = t[0] + a[0];
    for(int i = 1; i < N; i++) {
      long tnum = (dp[i - 1] / (long)(t[i - 1] + a[i - 1])) * t[i - 1]);
      long anum = (dp[i - 1] / (long)(t[i - 1] + a[i - 1])) * a[i - 1]);
      long rate = Math.max((long)Math.ceil((double)tnum / (double)t[i]), (long)Math.ceil((double)anum / (double)a[i]));
      dp[i] = rate * (long)(t[i] + a[i]);
    }
    System.out.println(dp[N - 1]);
  }
}

Compiler output:
Main.java:17: error: ';' expected
      long tnum = (dp[i - 1] / (long)(t[i - 1] + a[i - 1])) * t[i - 1]);
                                                                      ^
Main.java:18: error: ';' expected
      long anum = (dp[i - 1] / (long)(t[i - 1] + a[i - 1])) * a[i - 1]);
                                                                      ^
2 errors
Language: Java

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] t = new int[N];
    int[] a = new int[N];
    for(int i = 0; i < N; i++) {
      t[i] = sc.nextInt();
      a[i] = sc.nextInt();
    }
    // dp[i]はi回目までの投票数の最小値を表す
    long[] dp = new long[N];
    dp[0] = t[0] + a[0];
    for(int i = 1; i < N; i++) {
      long t = (dp[i - 1] * t[i - 1]) / (long)(t[i - 1] + a[i - 1]);
      long a = (dp[i - 1] * a[i - 1]) / (long)(t[i - 1] + a[i - 1]);
      long rate = Math.max((long)Math.ceil((double)t / (double)t[i]), (long)Math.ceil((double)a / (double)a[i]));
      dp[i] = rate * (long)(t[i] + a[i]);
    }
    System.out.println(dp[N - 1]);
  }
}

Compiler output:
Main.java:17: error: variable t is already defined in method main(String[])
      long t = (dp[i - 1] * t[i - 1]) / (long)(t[i - 1] + a[i - 1]);
           ^
Main.java:17: error: array required, but long found
      long t = (dp[i - 1] * t[i - 1]) / (long)(t[i - 1] + a[i - 1]);
                             ^
Main.java:17: error: array required, but long found
      long t = (dp[i - 1] * t[i - 1]) / (long)(t[i - 1] + a[i - 1]);
                                                ^
Main.java:18: error: variable a is already defined in method main(String[])
      long a = (dp[i - 1] * a[i - 1]) / (long)(t[i - 1] + a[i - 1]);
           ^
Main.java:18: error: array required, but long found
      long a = (dp[i - 1] * a[i - 1]) / (long)(t[i - 1] + a[i - 1]);
                             ^
Main.java:18: error: array required, but long found
      long a = (dp[i - 1] * a[i - 1]) / (long)(t[i - 1] + a[i - 1]);
                                                ^
Main.java:18: error: array required, but long found
      long a = (dp[i - 1] * a[i - 1]) / (long)(t[i - 1] + a[i - 1]);
                                                           ^
Main.java:19: error: array required, but long found
      long rate = Math.max((long)Math.ceil((double)t / (double)t[i]), (long)Math.ceil((double)a / (double)a[i]));
                                                                ^
Main.java:19: error: array required, but long found
      long rate = Math.max((long)Math.ceil((double)t / (double)t[i]), (long)Math.ceil((double)a / (double)a[i]));
                                                                                                           ^
Main.java:20: error: array required, but long found
      dp[i] = rate * (long)(t[i] + a[i]);
                             ^
Main.java:20: error: array required, but long found
      dp[i] = rate * (long)(t[i] + a[i]);
                                    ^
11 errors
Language: C++

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

// 基本テンプレート
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// 型
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// 定数
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion


#define int ll
int main()
{
    int n;
    cin >> n;
    int a=1;
    int b=1;
    rep(i,n) {
        int x, y;
        cin >> x >> y;
        int n = max(a/x+(a%x>0), b/y+(b%y>0));
        a = x*n;
        b = y*n;
    }
    cout << a +  b << endl;
    return 0;
}



Compiler output:
a.cc:57:13: error: '::main' must return 'int'
   57 | #define int ll
      |             ^~
a.cc:58:1: note: in expansion of macro 'int'
   58 | int main()
      | ^~~
Language: C++

//ABC 049-C
#define _USE_MATH_DEFINES

#include <iostream>
#include <cmath>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cstring>
#include <numeric>
#include <string>
#include <map>
#include <sstream>
using namespace std;

int main() {
	int N, j = 1,
	long long voteT[1001], voteA[1001], T[1001], A[1001];
	cin >> N;
	T[0] = 0;
	A[0] = 0;
	voteT[0] = 1;
	voteA[0] = 1;
	for (int i = 1; i <= N; i++) {
		cin >> T[i] >> A[i];
		j = ceil((double)voteT[i-1]/T[i]);
		if(j < ceil((double)voteA[i-1]/A[i])){
			j = ceil((double)voteA[i-1]/A[i]);
		}
		if(j == 0) j = 1;
		voteT[i] = T[i]*j;
		voteA[i] = A[i]*j;
	}
	cout << voteT[N] + voteA[N] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: expected unqualified-id before 'long'
   19 |         long long voteT[1001], voteA[1001], T[1001], A[1001];
      |         ^~~~
a.cc:21:9: error: 'T' was not declared in this scope
   21 |         T[0] = 0;
      |         ^
a.cc:22:9: error: 'A' was not declared in this scope
   22 |         A[0] = 0;
      |         ^
a.cc:23:9: error: 'voteT' was not declared in this scope
   23 |         voteT[0] = 1;
      |         ^~~~~
a.cc:24:9: error: 'voteA' was not declared in this scope
   24 |         voteA[0] = 1;
      |         ^~~~~
Language: C++

#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;


long long T[10000] = {}, A[10000] = {};

long long main(){
	long long N;
	cin >> N;
	for (long long i = 0; i < N; i++) {
		cin >> T[i] >> A[i];
	}

	long long T1 = T[0], T2 = A[0];
	for (long long i = 1; i < N; i++) {
		long long tmp1 = T1 / T[i];
		long long tmp2 = T2 / A[i];
		if (T1%T[i] != 0) {
			tmp1++;
		}
		if (T1%A[i] != 0) {
			tmp2++;
		}
		long long tmp = max(tmp1, tmp2);
		T1 = T[i] * tmp;
		T2 = A[i] * tmp;

	}
	cout << T1 + T2 << endl;

	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <iostream>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

u_int64_t ceilDiv(u_int64_t a, u_int64_t b)
{
    return (a / b) + (a % b == 0 ? 0 : 1);
}

int main()
{
    int N;
    u_int64_t T = 1;
    u_int64_t A = 1;
    u_int64_t t;
    u_int64_t a;
    
    cin >> N;
    
    for (int i = 0; i < N; i++)
    {
        cin >> t >> a;
        
        uint_64_t v = max(ceilDiv(T, t), ceilDiv(A, a));
        
        T = t * v;
        A = a * v;
    }
    
    cout << T + A << endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: error: 'uint_64_t' was not declared in this scope; did you mean 'u_int64_t'?
   27 |         uint_64_t v = max(ceilDiv(T, t), ceilDiv(A, a));
      |         ^~~~~~~~~
      |         u_int64_t
a.cc:29:17: error: 'v' was not declared in this scope
   29 |         T = t * v;
      |                 ^
Language: C

#include <stdio.h>

int main() {
  long long n, t[1001], a[1001];
  scanf("%lld", &n);
  for (int i=1;i<=n;i++) {
    scanf("%lld %lld", &t[i], &a[i]);
  }
  long long ttotal=1, atotal=1;
  for (int i=1;i<=n;i++) {
    if (t[i] < a[i]) {
		if(a[i] / t[i] > atotal / total){
      while (ttotal % t[i] != 0) {
        ttotal++;
      }
      atotal = ttotal / t[i] * a[i];
    }
	else {
		      while (atotal % a[i] != 0) {
        atotal++;
      }
      ttotal = atotal / a[i] * t[i];
	}
	}
    else if (t[i] > a[i]) {
		if(t[i] / a[i] > ttotal / atotal){
			while (atotal % a[i] != 0) {
        atotal++;
      }
      ttotal = atotal / a[i] * t[i];
		}
      else{
		  while (ttotal % t[i] != 0) {
        ttotal++;
      }
      atotal = ttotal / t[i] * a[i];
	  }
    }
    else {
      if (ttotal > atotal) {
        atotal = ttotal;
      }
      else {
        ttotal = atotal;
      }
    }
  }


  printf("%lld\n", ttotal+atotal);
  return 0;

}

Compiler output:
main.c: In function 'main':
main.c:12:43: error: 'total' undeclared (first use in this function); did you mean 'atotal'?
   12 |                 if(a[i] / t[i] > atotal / total){
      |                                           ^~~~~
      |                                           atotal
main.c:12:43: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <stdio.h>

int main(){
int n, t[1001], a[1001];
scanf("%d", &n);
for(int i=1;i<=n;i++){
scanf("%d %d", &t[i], &a[i]);
}
int ttotal=1, atotal=1;
for(int i=1;i<=n;i++){
	if(t[i] < a[i]){
		while(ttotal / atotal != t[i]/a[i]) {
			ttotal++;
			}
	}
	else if(t[i] > a[i]){
		while(ttotal / atotal != t[i]/a[i]){
			atotal++;
		}
	}
	else{
		if(ttotal > atotal){
			while(ttotal / atotal != t[i]/a[i]){
			atotal++;
		}
		else{
			while(ttotal / atotal != t[i]/a[i]){
			ttotal++;
		}
		}
		}
	}
}

printf("%d\n", ttotal+atotal);
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:17: error: expected '}' before 'else'
   26 |                 else{
      |                 ^~~~
a.cc:22:36: note: to match this '{'
   22 |                 if(ttotal > atotal){
      |                                    ^
a.cc: At global scope:
a.cc:35:7: error: expected constructor, destructor, or type conversion before '(' token
   35 | printf("%d\n", ttotal+atotal);
      |       ^
a.cc:36:1: error: expected unqualified-id before 'return'
   36 | return 0;
      | ^~~~~~
a.cc:37:1: error: expected declaration before '}' token
   37 | }
      | ^
Language: C++

#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;

int main(){
	int n;
	ll t[100100];
	ll a[100100];
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> t[i] >> a[i];
	}

	for (int i = 1; i < n; ++i)
	 {
	 	ll tmp_t = t[i];
	 	ll tmp_a = a[i];
	 	if(t[i-1] > t[i] || a[i-1] > a[i]){
	 		ll tmp_mul = max( (t[i-1] - 1)/ t[i] + 1, (a[i-1] - 1) / a[i] + 1);
	 		// if( (tmp_mul * t[i] == t[i-1] && tmp_mul * a[i] > a[i-1] ) || (tmp_mul * a[i] == a[i-1] && tmp_mul * t[i] > t[i-1])  ){
	 		// 	tmp_mul--;
	 		// }

	 		// tmp_mul++;
	 		t[i] *= tmp_mul
	 		a[i] *= tmp_mul
	 		// cout << "tmp_mul " << tmp_mul << "  ";
	 	}
	 	// cout << t[i] << " " << a[i] << "　i番目 " << i <<endl;
	 }

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

}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:40: error: expected ';' before 'a'
   27 |                         t[i] *= tmp_mul
      |                                        ^
      |                                        ;
   28 |                         a[i] *= tmp_mul
      |                         ~
Language: C++

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)

#define int ll

int main(){
	int n;
	cin>>n;
	ll l=0,r=0;
	rep(i,n){
		ll a,b;
		cin>>a>>b;
		
		int c = max( 1 , (int)max(ceil((double)l/a),ceil((double)r/b)) );

		if(l<=a*c&&r<=b*c) l=a*c, r=b*c;
	}
	cout<<l+r<<endl;
}

Compiler output:
a.cc:11:13: error: '::main' must return 'int'
   11 | #define int ll
      |             ^~
a.cc:13:1: note: in expansion of macro 'int'
   13 | int main(){
      | ^~~
a.cc: In function 'int main()':
a.cc:21:28: error: no matching function for call to 'max(int, ll)'
   21 |                 int c = max( 1 , (int)max(ceil((double)l/a),ceil((double)r/b)) );
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:21:28: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   21 |                 int c = max( 1 , (int)max(ceil((double)l/a),ceil((double)r/b)) );
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:21:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   21 |                 int c = max( 1 , (int)max(ceil((double)l/a),ceil((double)r/b)) );
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<algorithm>
#include<string>
using namespace std;
#define loop(i,a,b) for(int i = a; i < b; i++)
#define rep(i,a) loop(i,0,a)


int main()
{	
	int n;
	int t,k;
	int tt,kk;
	int a,b;
	
	cin>>n;
	cin>>a>>b;
	rep(i,n-1){
		cin>>tt>>kk;
		t=tt;
		k=kk;
		while(1){
			if(t>=a&&k>=b)
				break;
			t+=tt;
			k+=kk;
			}
		a=t;
		b=k;
	}
	cout<<a+b<<endl;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'cin' was not declared in this scope
   15 |         cin>>n;
      |         ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<string>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:30:9: error: 'cout' was not declared in this scope
   30 |         cout<<a+b<<endl;
      |         ^~~~
a.cc:30:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:30:20: error: 'endl' was not declared in this scope
   30 |         cout<<a+b<<endl;
      |                    ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<string>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.*;
import java.math.*;

public class Main {
    public static void main(String args[] ) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line1 = br.readLine();
        line1 = line1.trim();
        int N = Integer.parseInt(line1);
        long PosA = 0;
        long PosB = 0;
        long a = 0;
        long b = 0;
        long mag = 0;

        for(int i = 0;i<N;i++){
            String lines = br.readLine();
            lines = lines.trim();            
            String[] temp = lines.split(" ");
            a = Integer.parseInt(temp[0]);
            b = Integer.parseInt(temp[1]);

            if(PosA <= a && PosB <= b){
                PosA = a;
                PosB = b;
            } else {
                mag = (long)Math.ceil(Math.max((double)PosA/a, (double)PosB/b));
                PosA = a * mag;
                PosB = b * mag;            
            }
        }

        System.out.println(PosA+PosB)
    }
}



Compiler output:
Main.java:36: error: ';' expected
        System.out.println(PosA+PosB)
                                     ^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.*;
import java.math.*;

public class Main {
    public static void main(String args[] ) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line1 = br.readLine();
        line1 = line1.trim();
        int N = Integer.parseInt(line1);
        long PosA = 0;
        long PosB = 0;
        long a = 0;
        long b = 0;
        long mag = 0;

        for(int i = 0;i<N;i++){
            String lines = br.readLine();
            lines = lines.trim();            
            String[] temp = lines.stlip(" ");
            a = Integer.parseInt(temp[0]);
            b = Integer.parseInt(temp[1]);

            if(PosA <= a && PosB <= b){
                PosA = a;
                PosB = b;
            } else {
                mag = (long)Math.ceil(Math.max((double)PosA/a, (double)PosB/b));
                PosA = a * mag;
                PosB = b * mag;            
            }
        }
    }
}



Compiler output:
Main.java:22: error: cannot find symbol
            String[] temp = lines.stlip(" ");
                                 ^
  symbol:   method stlip(String)
  location: variable lines of type String
1 error
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.*;
import java.math.*;

public class Main {
    public static void main(String args[] ) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line1 = br.readLine();
        line1 = line1.trim();
        int N = Integer.parseInt(line1);
        long PosA = 0;
        long PosB = 0;
        long a = 0;
        long b = 0;
        long mag = 0;

        for(int i = 0;i<N;i++){
            String lines = br.readLine();
            lines = lines.trim();            
            String[] temp = lines.stlip(lines, " ");
            a = Integer.parseInt(temp[0]);
            b = Integer.parseInt(temp[1]);

            if(PosA <= a && PosB <= b){
                PosA = a;
                PosB = b;
            } else {
                mag = Math.ceil(Math.max((double)PosA/a, (double)PosB/b));
                PosA = a * mag;
                PosB = b * mag;            
            }
        }
    }
}



Compiler output:
Main.java:22: error: cannot find symbol
            String[] temp = lines.stlip(lines, " ");
                                 ^
  symbol:   method stlip(String,String)
  location: variable lines of type String
Main.java:30: error: incompatible types: possible lossy conversion from double to long
                mag = Math.ceil(Math.max((double)PosA/a, (double)PosB/b));
                               ^
2 errors
Language: C++

    #include<iostream>
    #include<vector>
    #include<string>
    #include<array>
    #include<algorithm>
    #include<list>
    #include<cmath>
    #include<iomanip>
    #include<queue>
    #include<functional>
    #include<climits>
    #include<iterator>
    #include<unordered_set>
    #include<unordered_map>
    #include<map>
    #include<set>
    #include<typeinfo>
     
    #include<chrono>
    #include<initializer_list>
    using namespace std;
     
    const double pi=4*atan(1.0);
     
    constexpr long long mod=static_cast<long long>(1e9+7);
     
    int main() {
    		cin >> N;
	a = 1, b = 1;
	for (int i = 0; i < N; i++) {
		cin >> T >> A;
		n = max((a+T-1)/T,(b+A-1)/A);
		a = T*n;
		b = A*n;
	}
	cout << a+b  << endl;
	return 0;
     
    	
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:28:24: error: 'N' was not declared in this scope
   28 |                 cin >> N;
      |                        ^
a.cc:29:9: error: 'a' was not declared in this scope
   29 |         a = 1, b = 1;
      |         ^
a.cc:29:16: error: 'b' was not declared in this scope
   29 |         a = 1, b = 1;
      |                ^
a.cc:31:24: error: 'T' was not declared in this scope
   31 |                 cin >> T >> A;
      |                        ^
a.cc:31:29: error: 'A' was not declared in this scope
   31 |                 cin >> T >> A;
      |                             ^
a.cc:32:17: error: 'n' was not declared in this scope
   32 |                 n = max((a+T-1)/T,(b+A-1)/A);
      |                 ^
Language: C++

    #include<iostream>
    #include<vector>
    #include<string>
    #include<array>
    #include<algorithm>
    #include<list>
    #include<cmath>
    #include<iomanip>
    #include<queue>
    #include<functional>
    #include<climits>
    #include<iterator>
    #include<unordered_set>
    #include<unordered_map>
    #include<map>
    #include<set>
    #include<typeinfo>
     
    #include<chrono>
    #include<initializer_list>
    using namespace std;
     
    const double pi=4*atan(1.0);
     
    constexpr long long mod=static_cast<long long>(1e9+7);
     
    int main() {
    	int N,A;
     
    	cin >> N  ;
            
         int B,C;   
            
    	for(int i=1;i<N+1;i++){
    		while(0){
                

                }

    	
    	
    	cout<<A<<endl;
     
    	
     
    	return 0;
     
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:48:6: error: expected '}' at end of input
   48 |     }
      |      ^
a.cc:27:16: note: to match this '{'
   27 |     int main() {
      |                ^
Language: C++

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

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>
#include <string>
using namespace std;
long a, b, n, N, T, A;
long main() {
	cin >> N;
	a = 1, b = 1;
	for (int i = 0; i < N; i++) {
		cin >> T >> A;
		n = max((a+T-1)/T,(b+A-1)/A);
		a = T*n;
		b = A*n;
	}
	cout << a+b  << endl;
	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>
#include <string>
using namespace std;
int N, T, A;
long a, b, n;
long main() {
	cin >> N;
	a = 1, b = 1;
	for (int i = 0; i < N; i++) {
		cin >> T >> A;
		n = max((a+T-1)/T,(b+A-1)/A);
		a = T*n;
		b = A*n;
	}
	cout << a+b  << endl;
	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#inclulde <iostream>
#include <math.h>

int main(){
    int reports, votes, votesT(1), votesA(1);
    scanf("%d", &reports);
    
    for(int i = 0; i < reports; i++){
        int Ti, Ai;
        scanf("%d %d", &Ti, &Ai);
        int zoom_out;
        if(ceil(static_cast<float>(votesT) / static_cast<float>(Ti)) >= ceil(static_cast<float>(votesA) / static_cast<float>(Ai)))
            zoom_out = ceil(static_cast<float>(votesT) / static_cast<float>(Ti));
        else
            zoom_out = ceil(static_cast<float>(votesA) / static_cast<float>(Ai));
        
        votesT = Ti * zoom_out;
        votesA = Ai * zoom_out;
        printf("%d %d\n", votesT, votesA);
    }

    votes = votesT + votesA > pow(10, 18) ? pow(10, 18) : votesT + votesA;
    printf("%d\n", votes);
    return 0;
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #inclulde; did you mean #include?
    1 | #inclulde <iostream>
      |  ^~~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:6:5: error: 'scanf' was not declared in this scope
    6 |     scanf("%d", &reports);
      |     ^~~~~
a.cc:19:9: error: 'printf' was not declared in this scope
   19 |         printf("%d %d\n", votesT, votesA);
      |         ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 | #include <math.h>
  +++ |+#include <cstdio>
    3 | 
a.cc:23:5: error: 'printf' was not declared in this scope
   23 |     printf("%d\n", votes);
      |     ^~~~~~
a.cc:23:5: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include <iostream>
#include <limits>

using namespace std;

int main()
{
	int N;
	cin >> N;
	long long a = 0;
	long long b = 0;
	for (int i = 0; i < N; ++i) {
		int T, A;
		cin >> T >> A;
		if (a == 0 && b == 0) {
			a = T;
			b = A;
		}
		else {
			long long l = 1;
			long long u = LLONG_MAX - 1;
			while (l < u) {
				long long c = (l + u) / 2;
				if ((T + A) > LLONG_MAX / c) {
					u = c;
				}
				else if (c * T >= a && c * A >= b) {
					u = c;
				}
				else {
					l = c + 1;
				}
			}
			a = l * T;
			b = l * A;
		}
	}
	cout << a + b << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:39: error: 'LLONG_MAX' was not declared in this scope
   21 |                         long long u = LLONG_MAX - 1;
      |                                       ^~~~~~~~~
a.cc:3:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <limits>
  +++ |+#include <climits>
    3 |
Language: C++

#include <cstdio>
#include <algorithm>

using namespace std;

int nTimes, votesA, votesB, r1, r2, ans, lol;


int main() {

	scanf("%d", &nTimes);
	scanf("%d %d", &votesA, &votesB);
	for (int i = 0; i < nTimes - 1; i++) {
	//	printf("CURRENT VOTES A = %d\n", votesA);
	//	printf("CURRENT VOTES B = %d\n", votesB);
		scanf("%d %d", &r1, &r2);
		if (r1 == r2) {
			if (votesA > votesB) {
				votesB = votesA;
			} else {
				votesA = votesB;
			}
		} else if (r1 > r2) {
			while (lol == 0) {
				if (votesB % r2 == 0 && votesA <= votesB * r1 / r2) {
					lol = 1;
				} else {
					if (votesB < r2) {
						votesB = r2;
					} else if (votesB % r2 != 0) {
						int test = floor(votesB / r2);
						votesB = r2 * (test + 1);
					} else {
						votesB += r2;
					}
				}
			}
			lol = 0; 
			votesA = votesB * r1 / r2;
		} else {
			while (votesA % r1 != 0) {
				if (votesA < r1) {
					votesA = r1;
				} else if (votesA % r2 != 0) {
					int test = floor(votesA / r1);
					votesA = r1 * (test + 1);
				} else {
					votesA += r1
				}
			}
			votesB = votesA * r2 / r1;
		}
	}
//	printf("CURRENT VOTES A = %d\n", votesA);
//	printf("CURRENT VOTES B = %d\n", votesB);
	ans = votesB + votesA;

	printf("%d", ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:60: error: 'floor' was not declared in this scope
   31 |                                                 int test = floor(votesB / r2);
      |                                                            ^~~~~
a.cc:45:52: error: 'floor' was not declared in this scope
   45 |                                         int test = floor(votesA / r1);
      |                                                    ^~~~~
a.cc:48:53: error: expected ';' before '}' token
   48 |                                         votesA += r1
      |                                                     ^
      |                                                     ;
   49 |                                 }
      |                                 ~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include<cmath>

using namespace std;

int main() {
    int N; cin >> N;
    int t, a; cin >> t >> a;
    long long int nt = t, na = a;
    for (int i = 1; i < N; i++) {
        int t, a; cin >> t >> a;
        //long long int p = max((nt + t - 1)/ t, (na + a - 1)/ a);
        long long int p = max(ceil(long long double)nt/t), ceil((long long double)na/a));
        nt = t * p;
        na = a * p;
    }
    cout << nt+na << endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:17:36: error: expected primary-expression before 'long'
   17 |         long long int p = max(ceil(long long double)nt/t), ceil((long long double)na/a));
      |                                    ^~~~
Language: C++

#include <stdio.h>
#include <string>
#include <iostream>
using namespace std;

int main(){
  char keyin[20];
  int N;
  int cnt = 0;
  int l=0, r=0;

  fgets(keyin, sizeof(keyin), stdin);
  N = atoi( strtok(keyin, " ") );
  for(int i=0; i<N; i++){
    fgets(keyin, sizeof(keyin), stdin);
    int t_l = atoi( strtok(keyin, " ") );
    int t_r = atoi( strtok(NULL, " ") );
    if(cnt==0){
      l = t_l;
      r = t_r;
    }else{
      int tmp = l/t_l;
      int i;
      if(tmp==0){
        i = 1;
      }else{
        i = tmp;
      }

      int t_l0 = t_l;
      int t_r0 = t_r;
      while(true){
        t_l = t_l0*i;
        t_r = t_r0*i;
        if(t_l >= l && t_r >= r){
          l = t_l;
          r = t_r;
          break;
        }
        i++;
      }
    }
    cnt++;
  }

  printf("%d\n", l+r);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: error: 'strtok' was not declared in this scope; did you mean 'strtoq'?
   13 |   N = atoi( strtok(keyin, " ") );
      |             ^~~~~~
      |             strtoq