Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define all(t) t.begin(), t.end()
#define inrange(i, a, b) (((i)>= min((a), (b))) && ((i) <= max((a), (b))))
typedef vector<ll> vi;
#define fi first
#define se second
#define show(x) cout << #x << " is " << x << "\n";
const ll inf = 9e18;
const ll mod = 1e9 + 7;
const ld pi = 3.141592653589793238462643383279502884;

void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
ll power(ll x, ll y, ll M = inf){
	if(y<=0) return 1;
    ll ans = 1;
    x %= M;
    while(y){
        if(y&1)
            ans = (x * ans) % M;

        x = (x * x) % M;
        y >>= 1;
    }
    return ans;
}
ll modInverse(ll n) {return power(n, mod-2, mod);}
inline ll mul(ll a, ll b){ return (a * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }

//------------------------------------------------------------------------------------------

//const ll N = 1e5 + 1;
//vector<ll> adj[N];
//bool visited[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    //cout<<fixed<<setprecision(10);


	ll n;
	cin>>n;
	ll a[n];
	ll gf = 1000000000000000000;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a, a+n);
	if(a[0]==0) cout<<0;
	else{
		ll ans=1;
		for(int i=0;i<n;i++){
			ans = ans*a[i];
			if(ans>gf) {
				cout<<-1;
				return 0;
			}
		}
		if(ans>gf) cout<<-1;
		else cout<<ans;
	}
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define all(t) t.begin(), t.end()
#define inrange(i, a, b) (((i)>= min((a), (b))) && ((i) <= max((a), (b))))
typedef vector<ll> vi;
#define fi first
#define se second
#define show(x) cout << #x << " is " << x << "\n";
const ll inf = 9e18;
const ll mod = 1e9 + 7;
const ld pi = 3.141592653589793238462643383279502884;

void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
ll power(ll x, ll y, ll M = inf){
	if(y<=0) return 1;
    ll ans = 1;
    x %= M;
    while(y){
        if(y&1)
            ans = (x * ans) % M;

        x = (x * x) % M;
        y >>= 1;
    }
    return ans;
}
ll modInverse(ll n) {return power(n, mod-2, mod);}
inline ll mul(ll a, ll b){ return (a * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }

//------------------------------------------------------------------------------------------

//const ll N = 1e5 + 1;
//vector<ll> adj[N];
//bool visited[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    //cout<<fixed<<setprecision(10);


	ll n;
	cin>>n;
	ll a[n];
	ll gf = 1000000000000000000;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a, a+n);
	if(a[0]==0) cout<<0;
	else{
		ll ans=1;
		for(int i=0;i<n;i++){
			ans = ans*a[i];
			if(ans>gf) {
				cout<<-1;
				return 0;
			}
		}
		if(ans>gf) cout<<-1;
		else cout<<ans;
	}
    return 0;
}


Compiler output:
a.cc:82:10: error: redefinition of 'const long long int inf'
   82 | const ll inf = 9e18;
      |          ^~~
a.cc:12:10: note: 'const long long int inf' previously defined here
   12 | const ll inf = 9e18;
      |          ^~~
a.cc:83:10: error: redefinition of 'const long long int mod'
   83 | const ll mod = 1e9 + 7;
      |          ^~~
a.cc:13:10: note: 'const long long int mod' previously defined here
   13 | const ll mod = 1e9 + 7;
      |          ^~~
a.cc:84:10: error: redefinition of 'const long double pi'
   84 | const ld pi = 3.141592653589793238462643383279502884;
      |          ^~
a.cc:14:10: note: 'const long double pi' previously defined here
   14 | const ld pi = 3.141592653589793238462643383279502884;
      |          ^~
a.cc:86:6: error: redefinition of 'void print(long long int*, long long int)'
   86 | void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
      |      ^~~~~
a.cc:16:6: note: 'void print(long long int*, long long int)' previously defined here
   16 | void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
      |      ^~~~~
a.cc:87:4: error: redefinition of 'long long int power(long long int, long long int, long long int)'
   87 | ll power(ll x, ll y, ll M = inf){
      |    ^~~~~
a.cc:17:4: note: 'long long int power(long long int, long long int, long long int)' previously defined here
   17 | ll power(ll x, ll y, ll M = inf){
      |    ^~~~~
a.cc:100:4: error: redefinition of 'long long int modInverse(long long int)'
  100 | ll modInverse(ll n) {return power(n, mod-2, mod);}
      |    ^~~~~~~~~~
a.cc:30:4: note: 'long long int modInverse(long long int)' previously defined here
   30 | ll modInverse(ll n) {return power(n, mod-2, mod);}
      |    ^~~~~~~~~~
a.cc:101:11: error: redefinition of 'long long int mul(long long int, long long int)'
  101 | inline ll mul(ll a, ll b){ return (a * b) % mod; }
      |           ^~~
a.cc:31:11: note: 'long long int mul(long long int, long long int)' previously defined here
   31 | inline ll mul(ll a, ll b){ return (a * b) % mod; }
      |           ^~~
a.cc:102:11: error: redefinition of 'long long int sub(long long int, long long int)'
  102 | inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
      |           ^~~
a.cc:32:11: note: 'long long int sub(long long int, long long int)' previously defined here
   32 | inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
      |           ^~~
a.cc:103:11: error: redefinition of 'long long int add(long long int, long long int)'
  103 | inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
      |           ^~~
a.cc:33:11: note: 'long long int add(long long int, long long int)' previously defined here
   33 | inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
      |           ^~~
a.cc:104:11: error: redefinition of 'long long int divi(long long int, long long int)'
  104 | inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }
      |           ^~~~
a.cc:34:11: note: 'long long int divi(long long int, long long int)' previously defined here
   34 | inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }
      |           ^~~~
a.cc:112:5: error: redefinition of 'int main()'
  112 | int main() {
      |     ^~~~
a.cc:42:5: note: 'int main()' previously defined here
   42 | int main() {
      |     ^~~~