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];
int dp[100005][2];

int main() {
  INCANT;
  cin >> K;
  rep(i, K) cin >> A[i];
  dp[K-1][0] = 2;
  int ne;
  for (int i=K-1; i>=1; i--) {
    int min_num = dp[i][0];
    int syo = (min_num+A[i-1]-1)/A[i-1];
    min_num = syo*A[i-1];
    int max_num = dp[i][1];
    syo = (max_num+A[i-1]-1)/A[i-1];
    max_num = syo*A[i-1];
    if (min_num>=A[i] && min_num<2*A[i]) {
      dp[i-1][0] = min_num;
    }
    if (max_num>=A[i] && min_num<2*A[i]) {
      if (dp[i-1][0]) dp[i-1][1] = max_num;
      else dp[i-1][0] = max_num;
    }
    if (!dp[i-1][0]) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << dp[0][0] << ' ' << max(dp[0][1]+A[0]-1, dp[0][0]+A[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;
int A[100005];
int dp[100005][2];

int main() {
  INCANT;
  cin >> K;
  rep(i, K) cin >> A[i];
  dp[K-1][0] = 2;
  int ne;
  for (int i=K-1; i>=1; i--) {
    int min_num = dp[i][0];
    int syo = (min_num+A[i-1]-1)/A[i-1];
    min_num = syo*A[i-1];
    int max_num = dp[i][1];
    syo = (max_num+A[i-1]-1)/A[i-1];
    max_num = syo*A[i-1];
    if (min_num>=A[i] && min_num<2*A[i]) {
      dp[i-1][0] = min_num;
    }
    if (max_num>=A[i] && min_num<2*A[i]) {
      if (dp[i-1][0]) dp[i-1][1] = max_num;
      else dp[i-1][0] = max_num;
    }
    if (!dp[i-1][0]) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << dp[0][0] << ' ' << max(dp[0][1]+A[0]-1, dp[0][0]+A[0]-1) << endl;
  return 0;
}

Compiler output:
a.cc:54:2: error: stray '#' in program
   54 | }#include <algorithm>
      |  ^
a.cc:54:3: error: 'include' does not name a type
   54 | }#include <algorithm>
      |   ^~~~~~~
a.cc:74:10: error: redefinition of 'const ll MOD'
   74 | const ll MOD = 1e9+7LL;
      |          ^~~
a.cc:21:10: note: 'const ll MOD' previously defined here
   21 | const ll MOD = 1e9+7LL;
      |          ^~~
a.cc:75:11: error: redefinition of 'const int INF'
   75 | const int INF = 2e9;
      |           ^~~
a.cc:22:11: note: 'const int INF' previously defined here
   22 | const int INF = 2e9;
      |           ^~~
a.cc:76:5: error: redefinition of 'int K'
   76 | int K;
      |     ^
a.cc:23:5: note: 'int K' previously declared here
   23 | int K;
      |     ^
a.cc:77:5: error: redefinition of 'int A [100005]'
   77 | int A[100005];
      |     ^
a.cc:24:5: note: 'int A [100005]' previously declared here
   24 | int A[100005];
      |     ^
a.cc:78:5: error: redefinition of 'int dp [100005][2]'
   78 | int dp[100005][2];
      |     ^~
a.cc:25:5: note: 'int dp [100005][2]' previously declared here
   25 | int dp[100005][2];
      |     ^~
a.cc:80:5: error: redefinition of 'int main()'
   80 | int main() {
      |     ^~~~
a.cc:27:5: note: 'int main()' previously defined here
   27 | int main() {
      |     ^~~~