Language: C++

#include<bits/stdc++.h>
#define maxn 100005
using namespace std; 
class bignum
{
	public:
		bignum()  {judge=1;memset(num,0,sizeof(num));}
		~bignum() {}
		bignum(const int);
		bignum10(const int b);
		bool operator >(const bignum & t)const ;
		bool operator >(const int & t)const;
		bool operator ==(const bignum & t) const;
		friend istream& operator >>(istream& ,bignum&);
		friend ostream& operator <<(ostream& ,bignum&);
		bignum operator +(bignum & n) ;
		bignum operator -( bignum & n) ;
		bignum operator *( bignum & n);
		bignum operator /( bignum & n);
		bignum operator +=(bignum & n);
		bignum operator %(bignum & n);
		bignum operator +=(int num)
		{
			bignum t(num);
			*this+=t;
			return *this;
		}
		bignum & operator ++()
		{
			*this+=1;
			return *this;	
		} 
		bignum operator++(int)
		{
			bignum temp=*this;
			*this+=1;
			return temp;
		}
		int getlength()
		{
			int p=0;
			int i;
			for(i=maxn-1;num[i]==0;i--)
			p=i;
			p--;
			return p;	
		}
	private:
		int num[maxn];
		int judge;
};
bignum::bignum( int b)
{ 
    if(b<0)
	{
		judge=-1;
		b=-b;
	}
	else if(b==0)
	{
		judge=0;	
	}
	else
	{
		judge=1;
	}
	int x=0,c=0;
   	memset(num,0,sizeof(num));
   	while(b>0)
    {
    	x=b%10;
    	b/=10;
    	num[++c]=x;
	}
	num[0]=c;
}
bignum::bignum10(int b)
{
	memset(num,0,sizeof(num));
	num[0]=b+1;
	num[b+1]=1;
}
istream& operator >>(istream& in,bignum & n)
{
	string a;
	in>>a;
	n.judge=1;
	if(a[0]=='-')
	{
		a.erase(0,1);
		n.judge=-1;
	}
	int lena=a.length();
	if(lena==1&&a[0]=='0')
	{
		n.judge=0;
	}
	memset(n.num,0,sizeof(n.num));
	for(int i=1,j=lena-1;i<=lena;j--,i++)
	n.num[i]=a[j]-'0';
	n.num[0]=lena;
	return in;
}
ostream& operator <<(ostream& out,bignum&n)
{
	if(n.judge==0||n.num[0]==0)
	{
		out<<0;
		return out;
	} 
	n.num[0]=n.getlength();
	if(n.judge==-1)
	{
		out<<'-';
	}
	for(int i=n.num[0];i>=1;i--)
	{
		out<<n.num[i];
	}
	return out;
}
bool bignum::operator>(const bignum & t) const   
{  
	if(judge>t.judge)
	return true;
    if(num[0] > t.num[0])
        return true; 
    else if(num[0] == t.num[0])
    { 
    	int len=num[0];
        while(num[len] == t.num[len] && len >= 1)
            len--; 
        if(len >= 1 && num[len] > t.num[len])
            return true; 
        else
            return false; 
    } 
    else
        return false; 
}
bool bignum::operator ==(const bignum & t) const
{
	if(t.num[0]!=num[0])
	return false;
	if(t.judge!=judge)
	return false;
	else 
	{
		for(int i=1;i<=num[0];i++)
		{
			if(num[i]!=t.num[i])
			return false;
		}
	}
	return true;
}
bignum bignum::operator +=(bignum & n)
{
	bignum ans=*this+n;
	return *this=ans;
}
bool bignum::operator >(const int & t) const   
{
    bignum b(t);
    return *this>b;
}
bignum bignum::operator +( bignum &n ) 
{
	bignum ans;
	memset(ans.num,0,sizeof(ans.num));
	
	if(judge!=n.judge)
	{
		if(judge==0||n.judge==0)
		{
			if(judge==0)return n;
			else return *this;
		}
		else if(judge<0)
		{
			judge=1;
			return n-(*this);
		}
		else 
		{
			n.judge=1;
			return (*this)-n;
		}
	}
	ans.num[0]=max(n.num[0],this->num[0])+5;
	for(int i=1;i<=ans.num[0];i++)
	{
		ans.num[i]+=n.num[i]+this->num[i];
		if(ans.num[i]>=10)
		{
			ans.num[i+1]+=ans.num[i]/10;
			ans.num[i]%=10;
		}
	}
	ans.num[0]=ans.getlength();
		
	if(judge==-1)
	ans.judge=-1;
	else if(judge==1)
	ans.judge=1;
	else 
	ans.judge=0; 
		
	return ans;
}
bignum bignum::operator -( bignum &n )
{
	bignum ans;
	memset(ans.num,0,sizeof(ans.num));
	if(judge==1&&n.judge==-1)
	{
		n.judge=1;
		return *this+n;
	}
	else if(judge==-1&&n.judge==1)
	{
		n.judge=-1;
		return *this+n;
	}
	ans.num[0]=max(n.num[0],this->num[0]);
	
	int flag=1;
	if(this->num[0]<n.num[0])flag=-1;
	
	else if(this->num[0]==n.num[0])
	{
		for(int i=n.num[0];i>=1;i--)
		{
			if(this->num[i]==n.num[i]&&i==1)
			{
				flag=0;
			}
			if(this->num[i]<n.num[i])
			{
				flag=-1;
				break;
			}
			else if(this->num[i]==n.num[i])
			continue;
			else
			{
				flag=1;
				break;
			}
		}
	}
	else
	flag=1;
	
	if(flag==0)
	{
		ans.judge=flag;
		return ans;
	}
	
	for(int i=1;i<=ans.num[0];i++)
	{
		if(flag==1)
		ans.num[i]+=this->num[i]-n.num[i];
		else 
		ans.num[i]+=n.num[i]-this->num[i];
		if(ans.num[i]<0)
		{
			ans.num[i+1]-=1;
			ans.num[i]+=10;
		}
	}
	ans.judge=flag;
	if(judge==-1&&n.judge==-1)
	{
		ans.judge=-ans.judge;
	}
	ans.num[0]=ans.getlength();
	return ans;
}
bignum bignum::operator *( bignum &n ) 
{
	bignum ans;
	memset(ans.num,0,sizeof(ans.num));
	ans.num[0]=n.num[0]+this->num[0];
	for(int i=0;i<n.num[0];i++)
	{
		for(int j=0;j<num[0];j++)
		{
			ans.num[i+j+1]+=n.num[i+1]*num[j+1];
			if(ans.num[i+j+1]>=10)
			{
				ans.num[i+j+2]+=ans.num[i+j+1]/10;
				ans.num[i+j+1]%=10;
			}
		}
	}
	if(judge==0||n.judge==0)
	{
		ans.judge=0;
	}
	if(judge==n.judge)
	{
		if(judge==0)
		{
			ans.judge=0;
		}
		else 
		{
			ans.judge=1;
		}
	}
	else
	{
		ans.judge=-1;
	}
	ans.num[0]=ans.getlength();
	return ans;
}
bignum bignum::operator /( bignum &n )
{
	bignum ans;int f=1;
	if(judge==0||n.judge==0)
	{
		if(n.judge==0)
		{
			ans.judge=-1;
			ans.num[1]=1;
			return ans;
		}
		else if(judge==0)
		{
			memset(ans.num,0,sizeof(ans.num));
			return ans;			
		}
	}
	else if(judge!=n.judge)
	{
		f=-1;
		judge=abs(judge);
		n.judge=abs(n.judge);
	} 
	if(num[0]<n.num[0])
	{
		return ans;
	}
	else if(num[0]==n.num[0])
	{
		for(int i=num[0];i>=1;i--)
		{
			if(num[i]==n.num[i])
			{
				if(i==1)
				{
				ans.judge=f;
				ans.num[0]=1;
				ans.num[1]=1;
					return ans;
				}
				else continue;
			}
			else if(num[i]<n.num[i])
			{
				return ans;
			}
			if(num[i]>n.num[i])
			{
				break;
			}
		}
	}
	
	int len=num[0]-n.num[0];
	int nl=n.num[0];
	bignum tp=n;
	int j,i;
	for( i=len;i>=0;i--)
	{
		memset(n.num,0,sizeof(n.num));
		for ( j=nl+i;j>=1; j--)
    	{
       	 if (j>i) n.num[j]=tp.num[j-i];
       	 else n.num[j]=0;
    	}  	
    	n.num[0]=n.getlength();
    	while(1)
    	{
    		if(n>*this)break;
    		bignum tmp=*this-n;
    		*this=tmp;
			bignum t;
			t.bignum10(i);
			ans+=t;
		}
	}
	if(f<0)ans.judge=-ans.judge;
	return ans;
}
bignum bignum::operator %(bignum & n )
{
	
	bignum tmp=*this;
	bignum t=n;
	bignum s=*this/n;
	bignum k=s*t; 
	return tmp-k;
}

int n;
int main()
{
	
	bignum c(1000000000);
	c=c*c;
	bignum ans(1);
	cin>>n;
	while(n--){
		bignum x;
		cin>>x;
		ans=ans*x;
	}
	//cout<<ans<<endl;
	if(ans>c){
		cout<<-1<<endl;
	}else{
		cout<<ans<<endl;
	}
	
}


Compiler output:
a.cc:10:17: error: ISO C++ forbids declaration of 'bignum10' with no type [-fpermissive]
   10 |                 bignum10(const int b);
      |                 ^~~~~~~~
a.cc:77:1: error: ISO C++ forbids declaration of 'bignum10' with no type [-fpermissive]
   77 | bignum::bignum10(int b)
      | ^~~~~~
a.cc: In member function 'int bignum::bignum10(int)':
a.cc:82:1: warning: no return statement in function returning non-void [-Wreturn-type]
   82 | }
      | ^