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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<int, int> ii;

int K;
vll A;

int main(){
  cin>>K;
  for (int i=0;i<K;++i){
    int a;cin>>a;A.push_back(a);
  }

  ll ans=2;
  if(!A[K-1]==1&&!A[K-1]==2){cout << -1 << endl;return 0;}
  ll ans_min=ans;
  ll ans_max=ans+A[K-1]-1;
  if(K==1){cout << ans_min << ' ' << ans_max << endl;return 0;}
  for (int i=K-2;i>=0;--i){
    ll l=ans_min, r=ans_max;
    int q=ans_min/A[i], r=ans_min%A[i];
    if(r!=0) ans_min=(q+1)*A[i];
    q=ans_max/A[i], r=ans_max%A[i];
    ans_max=q*A[i]+A[i]-1;
    if(ans_min>r||ans_max<l) {cout << -1 << endl;return 0;} 
  }

  cout << ans_min << ' ' << ans_max << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:25: error: conflicting declaration 'int r'
   24 |     int q=ans_min/A[i], r=ans_min%A[i];
      |                         ^
a.cc:23:19: note: previous declaration as 'll r'
   23 |     ll l=ans_min, r=ans_max;
      |                   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<int, int> ii;

int K;
vll A;

int main(){
  cin>>K;
  for (int i=0;i<N;++i){
    int a;cin>>a;A.push_back(a);
  }

  ll ans=2;
  if(!A[K-1]==1&&!A[K-1]==2){cout << -1 << endl;return 0;}
  ll ans_min=ans;
  ll ans_max=ans+A[K-1]-1;
  ll l=ans_min;
  ll r=ans_max;
  if(K==1){cout << ans_min << ' ' << ans_max << endl;return 0;}
  for (int i=K-2;i>=0;--i){
    int q=ans_min/A[i], r=ans_min%A[i];
    if(r!=0) ans_min=(q+1)*A[i];
    q=ans_max/A[i], r=ans_max%A[i];
    ans_max=q*A[i]+A[i]-1;
    if(ans_min>r|| ans_max<l) cout << -1 << endl;return 0; 
  }

  cout << ans_min << ' ' << ans_max << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:18: error: 'N' was not declared in this scope
   13 |   for (int i=0;i<N;++i){
      |                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,a[100010],mn=2,mx=2;
main(){
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)cin>>a[i];
  while(1+n--){
	mn=((mn-1)/a[n]+1)*a[n];
	mx=mx/a[n]*a[n]+a[n]-1
  }
  if(mn>mx)cout<<-1;
  else cout<<mn<<" "<<mx;
}


Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:11:31: error: expected ';' before '}' token
   11 |         mx=mx/a[n]*a[n]+a[n]-1
      |                               ^
      |                               ;
   12 |   }
      |   ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,a[100010],mn=2,mx=2;
main(){
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)cin>>a[i];
  while(1+n--){
	mn=((mn-1)/a[n]+1)*a[n];
	mx=mx/a[n]*a[n]+a[n]-x
  }
  if(mn>mx)cout<<-1;
  else cout<<mn<<" "<<mx;
}


Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:11:30: error: 'x' was not declared in this scope
   11 |         mx=mx/a[n]*a[n]+a[n]-x
      |                              ^
Language: C++

#include<bits/stdc++.h>
#define int long long
int n,a[100010],mn=2,mx=2;
main(){
	cin>>n;
    int a[n];
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=n-1;i>=0;i--){
		mn=((mn-1)/a[i]+1)*a[i];
		mx=mx/a[i]*a[i]+a[i]-1;
	}
	if(mn>mx)cout<<-1;
    else cout<<mn<<" "<<mx;
}


Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |         cin>>n;
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:12:18: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   12 |         if(mn>mx)cout<<-1;
      |                  ^~~~
      |                  std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:13:10: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   13 |     else cout<<mn<<" "<<mx;
      |          ^~~~
      |          std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

//
//  ROIGold.cpp
//  Main calisma
//
//  Created by Rakhman on 05/02/2019.
//  Copyright © 2019 Rakhman. All rights reserved.
//

#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <iterator>

#define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
#define S second
#define F first
#define pb push_back
#define nl '\n'
#define all(s) s.begin(), s.end()
#define fo(i, start, finish) for(int i = start; i <= finish; i ++)
#define y1 kdfjsalsdkf

const long long MXN = 1e6 + 5;
const long long MNN = 501;
const long long MOD = 10;
const long long INF = 100;
const long long OO = 1e9 + 500;

typedef long long llong;
typedef unsigned long long ullong;

using namespace std;

int n, l[MXN], r[MXN], b[MXN];

int main(){
	ios;
	cin >> n;
	for(int i = 1; i <= n; i++){
	    cin >> b[i];
	}
	if(b[n] != 2) return cout << -1, 0;
	l[n] = r[n] = 2;
	for(int i = n; i >= 1; i--){
	    int L = ((l[i] + b[i] - 1) / b[i]) * b[i], R = (r[i] / b[i]) * b[i] + b[i] - 1;
	    if(L > r){
	        return cout << -1, 0; 
	    }
	    l[i - 1] = L;
	    r[i - 1] = R;
	}
	cout << l[0] << ' ' << r[0];
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:64:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   64 |             if(L > r){
      |                ~~^~~
Language: C++

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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int N;
ll A[100005];

bool check(ll n)
{
    REP(i, N)
    {
        ll p = n / A[i];
        n = A[i] * p;
    }
    return n == 2;
}

int main()
{
    cin >> N;
    REP(i, N)
    {
        cin >> A[i];
    }
    //! とりあえず満たすものを1つ求める
    ll t = 2;
    REP(i, N)
    {
        //! t<=k<2*tを満たす最小のA[N-1-i]の倍数
        ll a = A[N - 1 - i];
        ll p = t / a;
        if (a * p >= t)
            t = a * p;
        else
            r = a * (p + 1);
    }
    if (!check(t))
    {
        cout << -1 << endl;
        return 0;
    }

    //! 最小値と最大値を二分探索で見つける
    ll min = t;
    {
        ll ng = 0;
        while (abs(min - ng) > 1)
        {
            ll mid = (min + ng) / 2;
            if (check(mid))
            {
                min = mid;
            }
            else
            {
                ng = mid;
            }
        }
    }
    ll max = t;
    {
        ll ng = (ll)1e17;
        while (abs(max - ng) > 1)
        {
            ll mid = (max + ng) / 2;
            if (check(mid))
            {
                max = mid;
            }
            else
            {
                ng = mid;
            }
        }
    }
    cout << min << " " << max << endl;
    return 0;
}

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

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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int N;
ll A[100005];

bool check(ll n)
{
    REP(i, N)
    {
        ll p = n / A[i];
        n = A[i] * p;
    }
    return n == 2;
}

int main()
{
    cin >> N;
    REP(i, N)
    {
        cin >> A[i];
    }
    //! とりあえず満たすものを1つ求める
    ll t = 2;
    REP(i, N)
    {
        //! t<=k<2*tを満たす最小のA[N-1-i]の倍数
        ll p = t / A[N - 1 - i];
        if (A[N - 1 - i] * (p + 1) > 2 * t)
        {
            cout << -1 << endl;
            return 0;
        }
        if (A[N - 1 - i] * (p + 1) < 2 * t)
            t = A[N - 1 - i] * (p + 1);
        else
            t = A[N - 1 - i] * p;
    }
    if (!check(t))
    {
        cout << -1 << Endl;
        return 0;
    }

    //! 最小値と最大値を二分探索で見つける
    ll min = t;
    {
        ll ng = 0;
        while (abs(min - ng) > 1)
        {
            ll mid = (min + ng) / 2;
            if (check(mid))
            {
                min = mid;
            }
            else
            {
                ng = mid;
            }
        }
    }
    ll max = t;
    {
        ll ng = INF;
        while (abs(max - ng) > 1)
        {
            ll mid = (max + ng) / 2;
            if (check(mid))
            {
                max = mid;
            }
            else
            {
                ng = mid;
            }
        }
    }
    cout << min << " " << max << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:23: error: 'Endl' was not declared in this scope
   52 |         cout << -1 << Endl;
      |                       ^~~~
Language: C++

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

    int k;
    cin >> k;

    ll a[k];
    for (int i = 1; i <= k; i++) {
        cin >> a[k - i];
    }

    ll mn = 2;
    ll mx = 3;
    if (a[0] != 2LL) {
        cout << -1 << endl;
        return 0;
    }

    for (int i = 1; i < k; i++) {
        if (mx / a[i] == mn / a[i] && mn % a[i] != 0LL && mx % a[i] != 0LL) {
            cout << -1 << endl;
            return 0;
        }

        if (mn % a[i] != 0LL) {
            mn = (mn / a[i] + 1) * a[i];
        }

        mx = mx / a[i] * a[i] + a[i] - 1;
    }


    return 0;
}
using namespace std;

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

    int k;
    cin >> k;

    ll a[k];
    for (int i = 1; i <= k; i++) {
        cin >> a[k - i];
    }

    ll mn = 2;
    ll mx = 3;
    if (a[0] != 2LL) {
        cout << -1 << endl;
        return 0;
    }

    for (int i = 1; i < k; i++) {
        if (mx / a[i] == mn / a[i] && mn % a[i] != 0LL && mx % a[i] != 0LL) {
            cout << -1 << endl;
            return 0;
        }

        mn = mx / a[i] * a[i];
        mx = mn + a[i] - 1LL;
    }

    cout << mn << " " << mx << "\n";
    return 0;
}

Compiler output:
a.cc:13:26: error: stray '#' in program
   13 | typedef unsigned int uint#include <algorithm>
      |                          ^
a.cc:13:27: error: expected initializer before 'include'
   13 | typedef unsigned int uint#include <algorithm>
      |                           ^~~~~~~
a.cc:65:5: error: redefinition of 'int main()'
   65 | int main() {
      |     ^~~~
a.cc:28:5: note: 'int main()' previously defined here
   28 | int main() {
      |     ^~~~
Language: C++

def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]

n=i1()
a=i2()
c=[]
if a[0]>=a[1]:
  c.append(a[0]*2-1)
  c.append(a[0])
else:
  d=a[1]//a[0]+1
  c.append(a[0]*d)
  d=(a[0]*d)//a[1]+1
  c.append(a[1]*d)
s=0
for i in range(1,len(a))[::-1]:
  if a[i]*2<=a[i-1]:
    s=1

if s==1:
 print(-1)
else:
 c.sort()
 print(*c)

Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def i1():
      | ^~~
Language: C++

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

const int mnx = 1e6 + 9;
const int mod = 1e9 + 7;

ll n;
ll a[mnx];
ll mn, mx;

int main() {

cin >> n;

for(int i = 1; i <= n; i++){
    cin >> a[i];
}

mn = 2; mx = 2;

for(int i = n; i >= 1; i--){
    if(mn % a[i] != 0) mn = a[i] * (mn / a[i] + 1);
    mx = a[i] * (mx / a[i] + 1) - 1;
}

if(mn > mx) return 0, cout << -1 << '\n';
else cout << mn << ' ' << mx << '\n';

return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:21: error: cannot convert 'std::basic_ostream<char>' to 'int' in return
   27 | if(mn > mx) return 0, cout << -1 << '\n';
      |                    ~^~~~~~~~~~~~~~~~~~~~
      |                     |
      |                     std::basic_ostream<char>
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int MAXN = 100005;
long long a[MAXN]
int n;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%lld",a+i);
	long long mn=2,mx=2;
	for(int i=n;i>0;--i){
		mn=(mn-1)/a[i]*a[i]+a[i];
		mx=mx/a[i]*a[i]+a[i]-1;
		if(mn>mx){
			puts("-1");
			return 0;
		}
	}
	cout<<mn<<" "<<mx<<endl;
	return 0;
}


Compiler output:
a.cc:7:1: error: expected initializer before 'int'
    7 | int n;
      | ^~~
a.cc: In function 'int main()':
a.cc:10:21: error: 'n' was not declared in this scope
   10 |         scanf("%d",&n);
      |                     ^
a.cc:11:43: error: 'a' was not declared in this scope
   11 |         for(int i=1;i<=n;++i)scanf("%lld",a+i);
      |                                           ^
a.cc:14:27: error: 'a' was not declared in this scope
   14 |                 mn=(mn-1)/a[i]*a[i]+a[i];
      |                           ^
Language: C

#include <iostream> 
#include <cstdio>  
using namespace std;
int a[100005];
int main() {
	int k;	cin >> k;
	for (int i = 1; i <= k; i++) 	{
		cin >> a[i];	}
	long long mmax = 2, mmin = 2;
	for (int i = k; i >= 1 && mmax >= mmin; i--)	{
		if (mmin%a[i] != 0)
			mmin = mmin / a[i] * a[i] + a[i];
		mmax = (mmax / a[i] + 1)*a[i] - 1;	}
	if (mmax >= mmin)	
	cout << mmin << ' ' << mmax << endl;
	else
		cout << -1 << endl;
		return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;

class Solution
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        long l = 2, r = 2;

        for (int i = a.Length - 1; i >= 0; i--)
        {
            if (r / a[i] * a[i] < l)
            {
                Console.WriteLine(-1);
                return;
            }
            l = l % a[i] == 0 ? l : (l / a[i] + 1) * a[i];
            r = r / a[i] * a[i] + a[i] - 1;
        }

        Console.WriteLine($"{l} {r}");
    }
}


Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Linq;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Numerics;
      |       ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'System'
    5 | using System.Text;
      |       ^~~~~~
a.cc:9:22: error: 'string' has not been declared
    9 |     static void Main(string[] args)
      |                      ^~~~~~
a.cc:9:31: error: expected ',' or '...' before 'args'
    9 |     static void Main(string[] args)
      |                               ^~~~
a.cc:28:2: error: expected ';' after class definition
   28 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Solution::Main(int*)':
a.cc:11:17: error: expected primary-expression before 'int'
   11 |         int n = int.Parse(Console.ReadLine());
      |                 ^~~
a.cc:12:12: error: structured binding declaration cannot have type 'int'
   12 |         int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
      |            ^~
a.cc:12:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:12:12: error: empty structured binding declaration
a.cc:12:15: error: expected initializer before 'a'
   12 |         int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
      |               ^
a.cc:15:22: error: 'a' was not declared in this scope
   15 |         for (int i = a.Length - 1; i >= 0; i--)
      |                      ^
a.cc:19:17: error: 'Console' was not declared in this scope
   19 |                 Console.WriteLine(-1);
      |                 ^~~~~~~
a.cc:26:9: error: 'Console' was not declared in this scope
   26 |         Console.WriteLine($"{l} {r}");
      |         ^~~~~~~
a.cc:26:27: error: '$' was not declared in this scope
   26 |         Console.WriteLine($"{l} {r}");
      |                           ^
Language: C++

#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
ll bpow(ll,ll,ll);
typedef vector<int> vec;
typedef vector<vec> mat;
mat mul(mat &A,mat &B);
mat pow(mat A,ll n);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};


bool cmp_P(const P &a,const P &b){
  return a.second < b.second;
}
int main()
{
  int K,ma=2,mi=2,nm=2;
  cin >> K;
  vector<int> A(K,0);
  REP(i,K)cin >> A[i];
  if(A[K-1] != 2){
    cout << "-1" << endl;
    return 0;
  }
  for(int i=K-2;i>=0;i--){
    int oa=ma,oi=mi;
    if(!(ma >= A[i] && ma % A[i] == A[i] - 1)){
      ma += A[i] - 1 - ma%A[i]
    }
    if(mi > A[i]){
      int tmp = mi;
      mi = 0;
      if(tmp % A[i] != 0)
        mi = (A[i])*(1+tmp/A[i]);
      else
        mi = A[i]*(tmp/A[i]);
    }else
      mi = max(mi,A[i]);
    if(oa < (A[i+1])*((A[i]*(mi/A[i]))/(A[i+1]))){
      cout << "-1" << endl;
      return 0;
    }
      
  }
  cout << mi <<" "<< ma << endl;
  return 0;
}

int par[MAX_N];
int ranks[MAX_N];

//n要素で初期化
void init(int n){
  REP(i,n){
    par[i] = i;
    ranks[i] = 0;
  }

}

//木の根を求める
int find(int x){
  if(par[x] == x){
    return x;
  }else{
    return par[x] = find(par[x]);
  }
}

void unite(int x,int y){
  x = find(x);
  y = find(y);
  if(x == y) return ;
  if(ranks[x] < ranks[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(ranks[x] == ranks[y]) ranks[x]++;
  }
}

bool same(int x, int y){
  return find(x) == find(y);
}

ll bpow(ll a, ll n,ll mod){
  int i = 0;
  ll res=1;
  while(n){
    if(n & 1)
      res = (res*a) % mod;
    a = (a*a) % mod;
    n >>= 1;
  }
  return res;
}
const int MOD = 1000000007;
mat mul(mat &A, mat &B){
  mat C(A.size(),vec(B[0].size()));
    REP(i,A.size())REP(k,B.size())REP(j,B[0].size()){
    C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % MOD;
  }
  return C;
}

mat pow(mat A,ll n)
{
  mat B(A.size(),vec(A.size()));
  REP(i,A.size()){
    B[i][i] = 1;
  }
  while(n > 0){
    if ( n & 1) B = mul(B,A);
    A = mul(A,A);
    n >>= 1;
  }
  return B;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:31: error: expected ';' before '}' token
   46 |       ma += A[i] - 1 - ma%A[i]
      |                               ^
      |                               ;
   47 |     }
      |     ~
Language: C++

#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=(a);i<=(b);++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>
#define ti3 tuple<int,int,int>
ll int MOD=998244353;
double INF=1000000000.0;
 
using namespace std;
string alphabet("abcdefghijklmnopqrstuvwxyz");

main(){
    ll int k,a[110000]={};
    cin>>k;
    rep(i,k){
        cin>>a[i];
    }
    ll int l=2,r=2;
    for(ll int i=k-1;i>=0;i--){
        if(r<a[i]||(l%a[i]!=0&&l/a[i]==r/a[i])) {cout<<-1;return 0;}
        l=max((l+a[i]-1)/a[i],1)*a[i];
        r=(r/a[i])*a[i]+a[i]-1;
    }
    cout<<l<<" "<<r;
    return 0;
}

Compiler output:
a.cc:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   13 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:22:14: error: no matching function for call to 'max(long long int, int)'
   22 |         l=max((l+a[i]-1)/a[i],1)*a[i];
      |           ~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:22:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   22 |         l=max((l+a[i]-1)/a[i],1)*a[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:22:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   22 |         l=max((l+a[i]-1)/a[i],1)*a[i];
      |           ~~~^~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < int(n); ++ (i))
#define ALL(x) begin(x), end(x)
using ll = long long;
using namespace std;

int K;

int main(){
  cin >> K;
  vector<int> A(k);
  REP (i, k) cin >> A[i];
  reverse(ALL(A));
  ll min = A[K-1];
  ll max = A[K-1]*2 - 1;
  if (min != 2){
    cout << "-1" << endl;
    return 0;
  }
  ////////////////////////////

  for (int a_i : A) {
    int rem = min % a_i;
    if(rem == 0) continue;
    min += a_i-rem;
    if(max<min){
      min = -1;
      break;
    }
    rem = max % a_i;
    max += a_i - rem -1;
a  }

  /////////////////////////////

  if(min == -1) cout << min << endl;
  else{
    cout << min << ' ' << max << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: 'k' was not declared in this scope
   11 |   vector<int> A(k);
      |                 ^
a.cc:32:1: error: 'a' was not declared in this scope
   32 | a  }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}

int main() {
	int k;
	ll mn = 2, mx = 2,xmn,xmx;
	cin >> k;
	vector<ll> v(k);
	rep(i, k) {
		cin >> v[k-i-1];
	}
	rep(i, k) {
		xmn = (mn + v[i] - 1) / v[i] * v[i];
		xmx = (mx / v[i])*v[i];
			cout << -1 << endl;
			return 0;
		}
		mx = xmx+v[i] - 1;
		mn = xmn;
	}
	cout << mn << " " << mx << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:28: error: 'i' was not declared in this scope
   48 |                 mx = xmx+v[i] - 1;
      |                            ^
a.cc: At global scope:
a.cc:51:9: error: 'cout' does not name a type
   51 |         cout << mn << " " << mx << endl;
      |         ^~~~
a.cc:53:1: error: expected declaration before '}' token
   53 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <string.h>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
#include <cmath>
#include <map>
#include <set>
#include <assert.h>
#include <numeric>
#define REP(i,n) for(ll i=0;i<(n);i++)
#define MOD 1000000007
#define pb push_back
#define int long long
#ifdef int
const long long INF = LLONG_MAX / 10;
#else
const int INF = 1010101010;
#endif
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<ll> > mat;
typedef pair<int, int> P;
//typedef pair<double, double> P;
const int dx[9] = {-1, 0, 0, 1, -1, -1, 1, 1, 0};
const int dy[9] = {0, -1, 1, 0, -1, 1, -1, 1, 0};

int K;
int A[101010];
 
signed main()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cin >> K;
  REP(i,K) cin >> A[i];
  reverse(A, A + K);

  int lo = 2, hi = 3;
  REP(i,K) {
    // cout << i << " " << lo << " " << hi << endl;
    if (i == 0 && A[i] != 2) {
      cout << -1 << endl;
      return 0;
    } else if (i == 0 && A[i] == 2) {
      continue;
    }
    if (lo > A[i] || A[i] > hi) {
      cout << -1 << endl;
      return 0;
    }
    if (lo > high) {
      cout << -1 << endl;
      return 0;
    }
    int lolo = (lo + A[i] - 1) / A[i] * A[i];
    int hihi = hi / A[i] * A[i];
    lo = lolo;
    hi = hihi + A[i] - 1;
  }

  cout << lo << " " << hi << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:14: error: 'high' was not declared in this scope; did you mean 'hi'?
   54 |     if (lo > high) {
      |              ^~~~
      |              hi
Language: C++

#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#define inf 0x7fffffff
using namespace std;
int main()
{ 
   int k;
   cin>>k;
   int a[k+1];
   long long nax=3,nin=2;
   for(int i=k;i>=1;i--)
   cin>>a[i];
   if(a[1]!=2)
   {cout<<"-1";return 0;}
   for(int i=2;i<=k;i++)
   {
   	int x=a[i-1]*2;
   	if(a[i]>=x){cout<<"-1";return 0;}
   	int c=1,d=1;
   	int s=a[i-1]*2;
   	for(int n=1;;n++)
   	{ if(a[i]*n>=s)break;
	if(a[i]*n>=nax){d=0;nax=a[i]*(n+1)-1;}
	if(a[i]*n>=nin&&c==1){c=0;nin=a[i]*n;}}
	if(c==1||d==1){cout<<"-1";return 0;}
   }
   cout<<nin<<" "<<nax;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:4: error: 'cin' was not declared in this scope
   10 |    cin>>k;
      |    ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include<cstdlib>
  +++ |+#include <iostream>
    5 | #define inf 0x7fffffff
a.cc:16:5: error: 'cout' was not declared in this scope
   16 |    {cout<<"-1";return 0;}
      |     ^~~~
a.cc:16:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:21: error: 'cout' was not declared in this scope
   20 |         if(a[i]>=x){cout<<"-1";return 0;}
      |                     ^~~~
a.cc:20:21: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:24: error: 'cout' was not declared in this scope
   27 |         if(c==1||d==1){cout<<"-1";return 0;}
      |                        ^~~~
a.cc:27:24: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:29:4: error: 'cout' was not declared in this scope
   29 |    cout<<nin<<" "<<nax;
      |    ^~~~
a.cc:29:4: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
const int maxn = 10010;
long long a[maxn];
vector<long long> vec;
long long K, k, MI, MA;

long long Max(long long a, long long b)
{
	long long x = a, long long y= b;
	while (a != b)
	{
		if (a>b)
		{
			a = a - b;
		}
		else
		{
			b = b - a;
		}
	}
	return (x*y)/a;
}

int main()
{
	cin >> K;
	for (int i = 0; i<K; i++)
	{
		cin >> a[i];
	}

	long long num = a[0];

	for (int i = 1; i < K; i++)
	{
		num = Max(num, a[i]);
	}

	for (int i = 2; i < num; i++)
	{
		k = i;
		for (int j = 0; j < K; j++)
		{
			k = k - k % a[j];
		}
		if (k == 2)
		{
			vec.push_back(i);
		}
	
	}
	if (vec.size()!=0)
	{
		MI = MA = vec[0];
		for (int i = 0; i < vec.size(); i++)
		{
			if (vec[i] < MI)
				MI = vec[i];
			if (vec[i] > MA)
				MA = vec[i];
		}
		cout << MI << " " << MA << endl;
	}
	else
		cout << -1 << endl;

	return 0;
}

Compiler output:
a.cc: In function 'long long int Max(long long int, long long int)':
a.cc:14:26: error: expected unqualified-id before 'long'
   14 |         long long x = a, long long y= b;
      |                          ^~~~
a.cc:26:19: error: 'y' was not declared in this scope
   26 |         return (x*y)/a;
      |                   ^
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
const int maxn = 10010;
long long a[maxn];
vector<long long> vec;
long long K, k, MI, MA;

long long Max(long long a, long long b)
{
	long long x = a, long long = b;
	while (a != b)
	{
		if (a>b)
		{
			a = a - b;
		}
		else
		{
			b = b - a;
		}
	}
	return (x*y)/a;
}

int main()
{
	cin >> K;
	for (int i = 0; i<K; i++)
	{
		cin >> a[i];
	}

	long long num = a[0];

	for (int i = 1; i < K; i++)
	{
		num = Max(num, a[i]);
	}

	for (int i = 2; i < num; i++)
	{
		k = i;
		for (int j = 0; j < K; j++)
		{
			k = k - k % a[j];
		}
		if (k == 2)
		{
			vec.push_back(i);
		}
	
	}
	if (vec.size()!=0)
	{
		MI = MA = vec[0];
		for (int i = 0; i < vec.size(); i++)
		{
			if (vec[i] < MI)
				MI = vec[i];
			if (vec[i] > MA)
				MA = vec[i];
		}
		cout << MI << " " << MA << endl;
	}
	else
		cout << -1 << endl;

	return 0;
}

Compiler output:
a.cc: In function 'long long int Max(long long int, long long int)':
a.cc:14:26: error: expected unqualified-id before 'long'
   14 |         long long x = a, long long = b;
      |                          ^~~~
a.cc:26:19: error: 'y' was not declared in this scope
   26 |         return (x*y)/a;
      |                   ^
Language: C++

#include<stdio.h>
int main(){
int k,a[100001],i,min,max,j,x,minkeep;
scanf("%d",&k);
for(i=0;i<k;i++)
scanf("%d",&a[i]);
min=2;
max=2;
for(i=0;i<k;i++){
x=0;
for(j=min;j<=max;j++){
if(j%a[k-i-1]==0){
minkeep=j;
x++;
break;
}
}
for(j=max;j>=min;j—){
if(j%a[k-i-1]==0){
max=j+a[k-i-1]-1;
x++;
break;
}
}
min=minkeep;
if(x==0){
printf("-1");
return 0;
}
}
printf("%d%1d\n",min,max);
return 0;
}


Compiler output:
a.cc:18:18: error: extended character — is not valid in an identifier
   18 | for(j=max;j>=min;j—){
      |                  ^
a.cc: In function 'int main()':
a.cc:18:18: error: 'j\U00002014' was not declared in this scope
   18 | for(j=max;j>=min;j—){
      |                  ^~
Language: C++

#include<stdio.h>
int main(){
int k,a[100001],i,min,max,j,x,minkeep;
scanf("%d",&k);
for(i=0;i<k;i++)
scanf("%d",&a[i]);
min=2;
max=2;
for(i=0;i<k;i++){
x=0;
for(j=min;j<=max;j++){
if(j%a[k-i-1]==0){
minkeep=j;
x++;
break;
}
}
for(j=max;j>=min;j—){
if(j%a[k-i-1]==0){
max=j+a[k-i-1]-1;
x++;
break;
}
}
min=minkeep;
if(x==0){
printf("-1");
return 0;
}
}
printf("%d %d\n",min,max);
return 0;
}


Compiler output:
a.cc:18:18: error: extended character — is not valid in an identifier
   18 | for(j=max;j>=min;j—){
      |                  ^
a.cc: In function 'int main()':
a.cc:18:18: error: 'j\U00002014' was not declared in this scope
   18 | for(j=max;j>=min;j—){
      |                  ^~
Language: C++

#include<stdio.h>

int main(){
int k,a[100001],i,min,max,j,x,minkeep;
scanf("%d",&k);
for(i=0;i<k;i++)
scanf("%d",&a[i]);
min=2;
max=2;
for(i=0;i<k;i++){
x=0;
for(j=min;j<=max;j++){
if(j%a[k-i-1]==0){
minkeep=j;
x++;
break;
}
}
for(j=max;j>=min;j—){
if(j%a[k-i-1]==0){
max=j+a[k-i-1]-1;
x++;
break;
}
}
min=minkeep;
if(x==0){
printf("-1");
return 0;
}
}
printf("%d %d\n",min,max);
return 0;
}

Compiler output:
a.cc:19:18: error: extended character — is not valid in an identifier
   19 | for(j=max;j>=min;j—){
      |                  ^
a.cc: In function 'int main()':
a.cc:19:18: error: 'j\U00002014' was not declared in this scope
   19 | for(j=max;j>=min;j—){
      |                  ^~
Language: C++

#include <iostream>
using namespace std;
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string>
#include <cstdlib>

int main() {
	int k;
	cin >> k;
	long long int a[1000000];
	for(int i = 0; i < k; i++){
		cin >> a[i];
	}
	long long int max=2, min=2;
	for(int i = k-1; i > -1; i--){
		if((l+a[i]-1)/a[i]*a[i]>r){
			cout << -1 <<endl;
			return 0;
		}
		min = (min+a[i]-1)/a[i]*a[i];
		max = max/a[i]*a[i]+a[i]-1;
	}
	cout << min << " " <<max <<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:21: error: 'l' was not declared in this scope
   20 |                 if((l+a[i]-1)/a[i]*a[i]>r){
      |                     ^
a.cc:20:41: error: 'r' was not declared in this scope
   20 |                 if((l+a[i]-1)/a[i]*a[i]>r){
      |                                         ^
Language: C

#include<stdio.h>

int main(){
	int k,i;
	scanf("%d",&k);
	
	int a[k],b[k];
	
	for(i=0,i<k;i++){
		scanf("%d",&a[i]);
	}
	
	if(a[k-1]!=2){
		printf("-1\n");
		return 0;
	}
	
	b[k-1]=1;
	
	for(i=k-2;i>=0;i--){
		if(a[i+1]*(b[i+1]+1) <= a[i]){
			printf("-1\n");
			return 0;
		}
		b[i]=(a[i+1]*b[i+1])/a[i];
		if((a[i+1]*b[i+1])%a[i]>0){
			b[i]++;
		}
	}
	printf("%d %d\n",a[0]*b[0],a[0]*(b[0]+1)-1);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:24: error: expected ';' before ')' token
    9 |         for(i=0,i<k;i++){
      |                        ^
      |                        ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define INF 1000000001
 
int k;
ll a[1000000];
ll amax=-1;
int mind;
 
bool judge(ll n){
  for(int i=0;i<k;i++){
    if (n % a[i]==0){
      continue;
    }else{
      n=n-n%a[i];
    }
    if (n < 2){
      return false;
    }
  }
  if (n==2){
    return true;
  }else{
    return false;
  }
}
 
int main(){
  cin>>k;
  for(int i=0;i<k;i++){
    cin>>a[i];
    if (a[i]>amax){
      amax=a[i];
      mind=i;
    }
  }
  ll mi=amax;
  for(int i=mind-1;i>=0;i--){
    ll tmp=2;
    while(a[i]*tmp<mi){
      tmp++;
    }
    mi=a[i]*tmp;
  }
  if (!judge(mi)){
    cout<<-1<<endl;
    return 0;
  }
  ll ub=2+k*amax;
  ll ul=ma/2, mid=(ub+ul)/2;
  while(1){
    bool judge1=judge(mid);
    if (judge1 && !judge(mid+1)){
      ma=mid;
      break;
    }
    if (judge1){
      ul=mid;
    }else{
      ub=mid;
    }
    mid = (ub+ul)/2;
  }
  cout<<mi<<" "<<ma<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:9: error: 'ma' was not declared in this scope; did you mean 'mi'?
   52 |   ll ul=ma/2, mid=(ub+ul)/2;
      |         ^~
      |         mi
a.cc:54:23: error: 'mid' was not declared in this scope; did you mean 'mi'?
   54 |     bool judge1=judge(mid);
      |                       ^~~
      |                       mi
Language: C++

#include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    long long a[100001];
    int k;
    cin>>k;
    for(int i=0;i<k;i++){
        cin>>a[i];
    }
    int r,l;
    r=l=2;
    for(int i=k-1;i>=0;i--){
        l=(l+a[i]-1)/a[i]*a[i];
        r=r/a[i]*a[i]+a[i]-1;
        if(l<=r){
            cout<<l<<" "<<r<<endl;
            return ;
        }
    }
        cout<<"-1"<<endl;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:13: error: return-statement with no value, in function returning 'int' [-fpermissive]
   20 |             return ;
      |             ^~~~~~
Language: C++

#include<stdio.h>
long long p[100000]={0};
int main(){
int i,j,k;
long long n;
scanf("%d",&k);
for(i=0;i<k-1;i++)scanf("%lld",&p[i]);
scanf("%lld",&n);
for(i<k-2;i>=0;i--){
if(n<p[i]&&p[i]-n<n)n=p[i];
else if(n<p[i]&&p[i]-n>=n)n=-1;
else{
for(j=p[i];;j+=p[i];){
if(j>=n&&j-n<n){
n=j;
break;
}
if(j-n>=n)n=-1;
}
}
if(n==-1)break;
}
if(n!=-1)printf("%lld %lld\n",n,n+p[0]-1);
else printf("-1\n");
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:20: error: expected ')' before ';' token
   13 | for(j=p[i];;j+=p[i];){
      |    ~               ^
      |                    )
a.cc:13:21: error: expected primary-expression before ')' token
   13 | for(j=p[i];;j+=p[i];){
      |                     ^
Language: C++

#define _USE_MATH_DEFINES

#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

int K;
long long int A[110000];

bool check1(long long int num){
	
	long long int ret = num;
	
	for(int i = 0; i < K; i++){
		ret -= (ret % A[i]);
	}
	
	if(ret >= 2){
		return true;
	}
	return false;
}

bool check2(long long int num){
	
	long long int ret = num;
	
	for(int i = 0; i < K; i++){
		ret -= (ret % A[i]);
	}
	
	if(ret > 2){
		return true;
	}
	return false;
}

long long int bin_search1(long long int lef, long long int rig){
	long long int middle = (lef + rig) / 2;
	if(rig - lef <= 1){
		if(check1(rig)){
			return rig;
		}else{
			return lef;
		}
	}
	if(check1(middle)){
		rig = middle;
	}else{
		lef = middle;
	}
	return bin_search1(lef, rig);
}

long long int bin_search2(long long int lef, long long int rig){
	long long int middle = (lef + rig) / 2;
	if(rig - lef <= 1){
		if(check2(rig)){
			return rig;
		}else{
			return lef;
		}
	}
	if(check2(middle)){
		rig = middle;
	}else{
		lef = middle;
	}
	return bin_search2(lef, rig);
}

int main(){
	
	cin >> K;
	
	for(int i = 0; i < K; i++){
		cin >> A[i];
	}
	
	long long int ans1 = bin_search1(1LL, 10000000000LL);
	long long int ans2 = bin_search2(1LL, 10000000000LL) - 1;
	
	bool flag = true;
	
	long long int ret = ans1;
	
	for(int i = 0; i < K; i++){
		ret -= (ret % A[i]);
	}
	
	if(ret != 2){
		flag = false;
	}
	
	long long int ret = ans2;
	
	for(int i = 0; i < K; i++){
		ret -= (ret % A[i]);
	}
	
	if(ret != 2){
		flag = false;
	}
	
	if(flag){
		cout << ans1 << " " << ans2 << endl;
	}else{
		cout << "-1" << endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:101:23: error: redeclaration of 'long long int ret'
  101 |         long long int ret = ans2;
      |                       ^~~
a.cc:91:23: note: 'long long int ret' previously declared here
   91 |         long long int ret = ans1;
      |                       ^~~
Language: C++

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

int main(void){
	int k,i;
	ll a[123456],mx=2ll,mn=2ll;
	cin >> k;
	for(i=0; i> a[k-i];
	}
	a[0] = 1;
	for(i=1; i<=k; i++){
		if(mx < a[i]){
			cout << "-1" << endl;
			return 0;
		}
		mx = ((mx/a[i])+1)*a[i]-1;
		mn = (((mn-1)/a[i])+1)*a[i];
	}
	cout << mn << " " << mx << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: expected primary-expression before '}' token
   10 |         }
      |         ^
a.cc:9:28: error: expected ')' before '}' token
    9 |         for(i=0; i> a[k-i];
      |            ~               ^
      |                            )
   10 |         }
      |         ~                   
a.cc:10:9: error: expected primary-expression before '}' token
   10 |         }
      |         ^
a.cc: At global scope:
a.cc:11:9: error: 'a' does not name a type
   11 |         a[0] = 1;
      |         ^
a.cc:12:9: error: expected unqualified-id before 'for'
   12 |         for(i=1; i<=k; i++){
      |         ^~~
a.cc:12:18: error: 'i' does not name a type
   12 |         for(i=1; i<=k; i++){
      |                  ^
a.cc:12:24: error: 'i' does not name a type
   12 |         for(i=1; i<=k; i++){
      |                        ^
a.cc:20:9: error: 'cout' does not name a type
   20 |         cout << mn << " " << mx << endl;
      |         ^~~~
a.cc:21:9: error: expected unqualified-id before 'return'
   21 |         return 0;
      |         ^~~~~~
a.cc:22:1: error: expected declaration before '}' token
   22 | }
      | ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

#deinfe int long long

const int N = (int)1e5 + 7;

int a[N];

main () {
    int n; scanf("%lld", &n);
    int mx = 0;
    for (int i = 1; i <= n; i++) {
        scanf("%lld", &a[i]);
        mx = max(mx, a[i]);
    }
    int asd = mx;
    mx = (mx + a[1] - 1) / a[1] * a[1];
    for (int i = 1; i <= n; i++) {
        mx = mx - (mx % a[i]);
    }
    if (mx == 2) {
        mx = (asd + a[1] - 1) / a[1] * a[1];
        cout << mx << ' ' << mx + a[1] - 1;
    } else {
        puts("-1");
    }
}


Compiler output:
a.cc:5:2: error: invalid preprocessing directive #deinfe; did you mean #define?
    5 | #deinfe int long long
      |  ^~~~~~
      |  define
a.cc:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   11 | main () {
      | ^~~~
Language: C++

import sys

k = int(input())
a = list(map(int, input().split()))


x, y = 2, 2

for i in range(k-1, -1, -1):
    minx = x + (a[i] - x % a[i]) % a[i]
    maxx = y - y % a[i]
    if minx > maxx:
        print(-1)
        sys.exit(0)
    else:
        x, y = minx, maxx + a[i] - 1


print(x, y)


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

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
const long long N=100005;
long long n,a[N],l=2,r=2
int main()
{
	scanf("%lld",&n);
	for(long long i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	for(long long i=n;i>=1;i--)
	{
		l=(l+a[i]-1)/a[i]*a[i],r=(r/a[i]+1)*a[i]-1;
		//cout<<l<<" "<<r<<endl;
	}
	if(l>r)
		puts("-1");
	else
		printf("%lld %lld\n",l,r);
	return 0;
}

Compiler output:
a.cc:7:1: error: expected ',' or ';' before 'int'
    7 | int main()
      | ^~~
Language: C++

///
// File:  b.cpp
// Author: ymiyamoto
//
// Created on Sun Jan 14 21:04:49 2018
//
#include <bits/stdc++.h>
using namespace std;

#define rep(_n, _init, _N) for (int32_t _n = _init; _n < (int32_t)(_N); _n++)
#define rrep(_n, _N, _end) for (int32_t _n = (int32_t)(_N); _n >= _end; _n--)
#define iceil(_x, _y) (((_x) + (_y)-1) / (_y))
#define ifloor(_x, _y) ((_x) / (_y))

static const double pi = 2 * asin(1);
static const double precision = 10e-9;

int32_t main()
{
  int32_t K;
  cin >> K;

  vector<int64_t> A(K);
  rep(i, 0, K)
  {
    cin >> A[i];
  }

  int64_t num_min = 2;
  int64_t num_max = 2;
  rrep(i, K - 1, 0)
  {
    num_min = A[i] * iceil(num_min, A[i]);
    num_max = A[i] * ifloor(num_max, A[i]) + A[i] - 1;

    if (num_max< num_min || (num_min == num_max && (num_min % A[i] != 0)) {
      cout << -1 << endl;
      return 0;
    }
  }

  cout << num_min << " " << num_max << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:36:74: error: expected ')' before '{' token
   36 |     if (num_max< num_min || (num_min == num_max && (num_min % A[i] != 0)) {
      |        ~                                                                 ^~
      |                                                                          )
a.cc:40:3: error: expected primary-expression before '}' token
   40 |   }
      |   ^
Language: C++

///
// File:  b.cpp
// Author: ymiyamoto
//
// Created on Sun Jan 14 21:04:49 2018
//
#include <bits/stdc++.h>
using namespace std;

#define rep(_n, _init, _N) for (int32_t _n = _init; _n < (int32_t)(_N); _n++)
#define rrep(_n, _N, _end) for (int32_t _n = (int32_t)(_N); _n >= _end; _n--)
#define iceil(_x, _y) (((_x) + (_y)-1) / (_y))
#define ifloor(_x, _y) ((_x) / (_y))

static const double pi = 2 * asin(1);
static const double precision = 10e-9;

int32_t main()
{
  int32_t K;
  cin >> K;

  vector<int64_t> A(K);
  rep(i, 0, K)
  {
    cin >> A[i];
  }

  int64_t num_min = 2;
  int64_t num_max = 2;
  rrep(i, K - 1, 0)
  {
    num_min = A[i] * iceil(num_min, A[i]);
    num_max = A[i] * ifloor(num_max, A[i]) + A[i] - 1;

    if (num_max< num_min || (num_min == num_max && (num_min % A[i] !=)) {
      cout << -1 << endl;
      return 0;
    }
  }

  cout << num_min << " " << num_max << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:36:70: error: expected primary-expression before ')' token
   36 |     if (num_max< num_min || (num_min == num_max && (num_min % A[i] !=)) {
      |                                                                      ^
a.cc:36:72: error: expected ')' before '{' token
   36 |     if (num_max< num_min || (num_min == num_max && (num_min % A[i] !=)) {
      |        ~                                                               ^~
      |                                                                        )
a.cc:40:3: error: expected primary-expression before '}' token
   40 |   }
      |   ^
Language: C++

#include <iostream>
int main() {
  cout << -1 << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    3 |   cout << -1 << endl;
      |   ^~~~
      |   std::cout
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:3:17: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    3 |   cout << -1 << endl;
      |                 ^~~~
      |                 std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <iostream>
 
using namespace std;
long long NMAX,NMIN;
int K;
int A[100005];
long long eval(long long N){
    for(int i = 1;i <= K;i++){
        N =N - N % A[i];
    return N;
}
int main()
{
    cin >> K;
    for(int i = 1;i <= K;i++){
        cin >> A[i];
    }
    long long st = 0,dr = 1e18;
    while(dr - st > 1){
        long long mid = (st + dr) / 2;
        if(eval(mid) >= 2){
            dr = mid;
        }
        else {
            st = mid;
        }
    }
  long long L = dr;
    st = 0,dr = 1e18;
    while(dr - st > 1){
        long long mid = (st + dr) / 2;
        if(eval(mid) <= 2){
            st = mid;
        }
        else {
            dr = mid;
        }
    }
long long R = st;
if(L > R) puts("-1");
else cout << L << ' '<< R << endl;
    return 0;
}

Compiler output:
a.cc: In function 'long long int eval(long long int)':
a.cc:12:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   12 | int main()
      |         ^~
a.cc:12:9: note: remove parentheses to default-initialize a variable
   12 | int main()
      |         ^~
      |         --
a.cc:12:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:13:1: error: a function-definition is not allowed here before '{' token
   13 | {
      | ^
a.cc:43:2: error: expected '}' at end of input
   43 | }
      |  ^
a.cc:7:28: note: to match this '{'
    7 | long long eval(long long N){
      |                            ^
a.cc:43:2: warning: control reaches end of non-void function [-Wreturn-type]
   43 | }
      |  ^