Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <string>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <map>
using namespace std;
#define ms(a, x) memset(a, x, sizeof(a))
#define fore(i, a, n) for (ll ll i = a; i < n; i++)
#define ford(i, a, n) for (ll ll i = n - 1; i >= a; i--)
#define si(a) scanf("%d", &a)
#define sl(a) scanf("%lld", &a)
#define sii(a, b) scanf("%d%d", &a, &b)
#define siii(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define sll(a, b) scanf("%lld%lld", &a, &b)
#define slll(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)
#define debug(a) cout << a << endl
#define pr(a) printf("%d ", a)
#define endl '\n'
#define pi acos(-1.0)
#define tr t[root]
#define lson t[root << 1]
#define rson t[root << 1 | 1]
#define IO ios::sync_with_stdio(false), cin.tie(0)
#define ull unsigned ll ll
#define py puts("Yes")
#define pn puts("No")
#define pY puts("YES")
#define pN puts("NO")
#define re(i, a, b) for (int i = a; i <= b; ++i)
#define de(i, a, b) for (int i = a; i >= b; --i)
const double eps = 1e-8;
inline int sgn(const double &x) { return x < -eps ? -1 : x > eps; }
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int MAXN = 2e5 + 5;
template <class t>
inline void cmin(t &a, t b) { ((a > b) && (a = b)); }
template <class t>
inline void cmax(t &a, t b) { ((a < b) && (a = b)); }
const ll V = 1e6 + 5;
const ll E = 4e6 + 5;
const ll mode = 1e9 + 7;
ll weight[E], to[E], nex[E];
ll cnt = 0;
ll n, m, dis[V];
ll head[V];
bool vis[V];
ll gcd(ll a, ll b)
{
  return b == 0 ? a : gcd(b, a % b);
}
ll lcm(ll a, ll b)
{
  return a * b / gcd(a, b);
}

ll multi(ll a, ll b, ll p)
{ //快速乘法
  ll ret = 0;
  while (b)
  {
    if (b & 1)
      ret = (ret + a) % p;
    a = (a + a) % p;
    b >>= 1;
  }
  return ret;
}

ll Pow(ll a, ll b, ll mode)
{
  ll sum = 1;
  a = a % mode;
  while (b > 0)
  {
    if (b % 2 == 1) //判断是否是奇数，是奇数的话将多出来的数事先乘如sum
      sum = sum * a % mode;
    b >>= 1;
    a = a * a % mode; // 不断的两两合并再取模，减小a和b的规模
  }
  return sum;
}
void add(ll u, ll v, ll w)
{
  cnt++;
  to[cnt] = v;
  weight[cnt] = w;
  nex[cnt] = head[u];
  head[u] = cnt;
}
void init()
{
  cnt = 0;
  memset(head, -1, sizeof(head));
}
void SPFA(ll s)
{
  memset(dis, 0x3f3f3f3f, sizeof(dis));
  memset(vis, 0, sizeof(vis));
  dis[s] = 0;
  vis[s] = 1;
  queue<ll> q;
  q.push(s);

  while (!q.empty())
  {
    ll now = q.front();

    q.pop();
    vis[now] = 0;
    for (int i = head[now]; i != -1; i = nex[i])
    {

      if (dis[to[i]] > dis[now] + weight[i])
      {
        dis[to[i]] = dis[now] + weight[i];
        if (!vis[to[i]])
        {
          q.push(to[i]);
          vis[to[i]] = 1;
        }
      }
    }
  }
}
int a[MAXN];
int main()
{
  int n;
  si(n);
  ll sum = 1;
  double ans = 1;
  bool flag=0,flag2=0;
  re(i, 1, n)
  {
    ll t;
    sl(t);
    if(t==0)
    {
      flag2=1;
      sum=0;
      ans=0;
      continue;
    }
    sum *= t;
    ans *= (double)t;
    if (ans != sum || sum > 1e8)
    {
     flag=1;
    }
  }
  if(flag2){
    puts("0");return 0;
  }
  if(flag){
    puts("-1");return;
  }
  cout << sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:164:16: error: return-statement with no value, in function returning 'int' [-fpermissive]
  164 |     puts("-1");return;
      |                ^~~~~~