Language: C++

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
int K;
int A[100005];
ll B[100005][2]; // MIN, MAX 

int main() {
  INCANT;
  cin >> K;
  rep(i, K) cin >> A[i];
  B[K][0] = 2ll;
  B[K][1] = 2ll;
  for (int i=K-1; i>=0; i--) {
    B[i][0] = (B[i+1][0]+A[i]-1)/A[i]*A[i];
    B[i][1] = B[i+1][1]/A[i]*A[i]+A[i]-1;
    if (B[i][0]>B[i][1]) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << B[0][0] << ' ' << B[0][1]  << endl;
  return 0;
}#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
int K;
ll A[100005];
ll B[100005][2]; // MIN, MAX 

int main() {
  INCANT;
  cin >> K;
  rep(i, K) cin >> A[i];
  B[K][0] = 2ll;
  B[K][1] = 2ll;
  for (int i=K-1; i>=0; i--) {
    B[i][0] = (B[i+1][0]+A[i]-1)/A[i]*A[i];
    B[i][1] = B[i+1][1]/A[i]*A[i]+A[i]-1;
    if (B[i][0]>B[i][1]) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << B[0][0] << ' ' << B[0][1]  << endl;
  return 0;
}

Compiler output:
a.cc:43:2: error: stray '#' in program
   43 | }#include <algorithm>
      |  ^
a.cc:43:3: error: 'include' does not name a type
   43 | }#include <algorithm>
      |   ^~~~~~~
a.cc:63:10: error: redefinition of 'const ll MOD'
   63 | const ll MOD = 1e9+7LL;
      |          ^~~
a.cc:21:10: note: 'const ll MOD' previously defined here
   21 | const ll MOD = 1e9+7LL;
      |          ^~~
a.cc:64:11: error: redefinition of 'const int INF'
   64 | const int INF = 2e9;
      |           ^~~
a.cc:22:11: note: 'const int INF' previously defined here
   22 | const int INF = 2e9;
      |           ^~~
a.cc:65:5: error: redefinition of 'int K'
   65 | int K;
      |     ^
a.cc:23:5: note: 'int K' previously declared here
   23 | int K;
      |     ^
a.cc:66:4: error: conflicting declaration 'll A [100005]'
   66 | ll A[100005];
      |    ^
a.cc:24:5: note: previous declaration as 'int A [100005]'
   24 | int A[100005];
      |     ^
a.cc:67:4: error: redefinition of 'll B [100005][2]'
   67 | ll B[100005][2]; // MIN, MAX
      |    ^
a.cc:25:4: note: 'll B [100005][2]' previously declared here
   25 | ll B[100005][2]; // MIN, MAX
      |    ^
a.cc:69:5: error: redefinition of 'int main()'
   69 | int main() {
      |     ^~~~
a.cc:27:5: note: 'int main()' previously defined here
   27 | int main() {
      |     ^~~~