criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main (){
 int N;
 cin >> N;
 vector<unsigned long long int> vec(N);
  fot(int i=0; i<N; i++)
  {
    cin >> vec.at(i);
  }
  
  for(int j=0; j<N; j++)
  {
    unsigned long long int x *= vec.at(j);
  }
  
  if(x>1000000000000000000)
  {
    cout << '-1' << endl;
  }
  else
  {
    cout << x << endl;
  }
  return 0;
}

Compiler output:
a.cc:20:13: warning: multi-character character constant [-Wmultichar]
   20 |     cout << '-1' << endl;
      |             ^~~~
a.cc: In function 'int main()':
a.cc:8:7: error: expected primary-expression before 'int'
    8 |   fot(int i=0; i<N; i++)
      |       ^~~
a.cc:8:16: error: 'i' was not declared in this scope
    8 |   fot(int i=0; i<N; i++)
      |                ^
a.cc:15:30: error: expected initializer before '*=' token
   15 |     unsigned long long int x *= vec.at(j);
      |                              ^~
a.cc:18:6: error: 'x' was not declared in this scope
   18 |   if(x>1000000000000000000)
      |      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
long long ans,n;
int main(){
cin>>n;
ans=1;
bool sabi=1;
while(n--){
long long a;
cin>>a;
if(a==0){cout<<0<<endl;return 0;}
ans*=a;
if(ans>1e18||ans<0)sabi=0;
}
if(sabi)cout<<ans<<endl;
else cout<<-1<<endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:16:21: error: expected '}' at end of input
   16 | else cout<<-1<<endl;
      |                     ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    vector<long long> A(N);
    bool a=true;
    for(int i=0;i<N;i++){
        cin >> A.at(i);
        if(A.at(i)==0) a=false;
    }
    long long sum=1;
    sort(A.begin().A.end());
    for(int i=0;i<N;i++){
        sum*=A.at(i);
        if(sum>1000000000000000000){
            sum=-1;
            break;
        }
    }
    if(a) cout << sum << endl;
    else cout << 0 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:20: error: 'std::vector<long long int>::iterator' has no member named 'A'
   14 |     sort(A.begin().A.end());
      |                    ^
Language: Java

import java.util.*;

public class Multiplication2 {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();

    long result = 1;

    long outNumber = 1;
    for(int i = 0; i < 18; i++) {
      outNumber *= 10;
    }

    for(int i = 0; i < n; i++) {
      result *= sc.nextLong();
      if(result == 0) {
        System.out.println(result);
        System.exit(0);
        break;
      }
    }
    sc.close();

    if(outNumber < result || result <= -1) {
      System.out.println(-1);
    } else {
      System.out.println(result);
    }
  }
}

Compiler output:
Main.java:3: error: class Multiplication2 is public, should be declared in a file named Multiplication2.java
public class Multiplication2 {
       ^
1 error
Language: C++

#include<bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp> 
using namespace boost::multiprecision; 
using namespace std;
int main(){
  int128_t n;cin>>n;
  int128_t mx=1000000000000000000,ans=1;
  while(n--){
    int128_t k;
    cin>>k;
    //if((mx/ans)<k){cout<<-1<<endl;return 0;}
    ans*=k;
    if(k==0){cout<<0<<endl;return 0;}
    if(ans>max){cout<<-1<<endl;return 0;}
    //if(ans>mx)
  }
cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc:2:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    2 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
using namespace std;
void main()
 {long long int pro=1;
  long int arr[100000];
  long int n;
  for(long int i= 0; i<n;i++){
  cin>>arr[i];
  }
 for(long int i=0;i<n;i++){pro=pro*arr[i];}
  cout<<pro;
}


Compiler output:
a.cc:3:1: error: '::main' must return 'int'
    3 | void main()
      | ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(int argc, char const *argv[]) {
  int N,A,answer;
  std::cin >> N >> A;
  if (answer <　1000000000000000000){
    for (size_t i = 0; i < N; i++) {
      answer = A * A;
    }
    std::cout << answer << '\n';
  }
  else {
    std::cout << "0" << '\n';
  }
  return 0;
}


Compiler output:
a.cc:7:15: error: extended character 　 is not valid in an identifier
    7 |   if (answer <　1000000000000000000){
      |               ^
a.cc: In function 'int main(int, const char**)':
a.cc:7:15: error: '\U000030001000000000000000000' was not declared in this scope
    7 |   if (answer <　1000000000000000000){
      |               ^~~~~~~~~~~~~~~~~~~~~
Language: C

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,r=1;
	cin>>n;
	long long int a[n];
	for(long long int i=0;i<n;i++)
	{
		cin>>a[i];
		r*=a[i];
	}
	long long int l;
	l=pow(10,18);
	if(r>l)
	{
		cout<<-1;
	}
	else
	{
		cout<<r;
	}
	return 0;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: Java

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Abc169b {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        List<BigDecimal> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            String value = sc.next();
            if("0".equals(value)) {
                System.out.println("0");
                return;
            } else {
                list.add(new BigDecimal(value));
            }

        }
        BigDecimal x = BigDecimal.valueOf(Math.pow(10, 18));
        BigDecimal result = BigDecimal.valueOf(1);
        for (BigDecimal decimal : list) {
            if (result.compareTo(x) > 0) {
                break;
            } else {
                result = result.multiply(decimal);
            }
        }
        if (result.compareTo(x) > 0) {
            System.out.println("-1");
        } else {
            System.out.println(result.stripTrailingZeros().toPlainString());
        }
    }
}


Compiler output:
Main.java:8: error: class Abc169b is public, should be declared in a file named Abc169b.java
public class Abc169b {
       ^
1 error
Language: C++

##include <bits/stdc++.h>
using namespace std;

int main(int argc, char const *argv[]) {
  int N,A,answer;
  std::cin >> N >> A;
  if (answer <　1000000000000000000){
    for (size_t i = 0; i < N; i++) {
      answer = A * A;
    }
    std::cout << answer << '\n';
  }
  else {
    std::cout << "0" << '\n';
  }
  return 0;
}


Compiler output:
a.cc:1:1: error: stray '##' in program
    1 | ##include <bits/stdc++.h>
      | ^~
a.cc:7:15: error: extended character 　 is not valid in an identifier
    7 |   if (answer <　1000000000000000000){
      |               ^
a.cc:1:3: error: 'include' does not name a type
    1 | ##include <bits/stdc++.h>
      |   ^~~~~~~
a.cc: In function 'int main(int, const char**)':
a.cc:6:8: error: 'cin' is not a member of 'std'
    6 |   std::cin >> N >> A;
      |        ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | ##include <bits/stdc++.h>
a.cc:7:15: error: '\U000030001000000000000000000' was not declared in this scope
    7 |   if (answer <　1000000000000000000){
      |               ^~~~~~~~~~~~~~~~~~~~~
a.cc:8:10: error: 'size_t' was not declared in this scope
    8 |     for (size_t i = 0; i < N; i++) {
      |          ^~~~~~
a.cc:1:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
  +++ |+#include <cstddef>
    1 | ##include <bits/stdc++.h>
a.cc:8:24: error: 'i' was not declared in this scope
    8 |     for (size_t i = 0; i < N; i++) {
      |                        ^
a.cc:11:10: error: 'cout' is not a member of 'std'
   11 |     std::cout << answer << '\n';
      |          ^~~~
a.cc:11:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:14:10: error: 'cout' is not a member of 'std'
   14 |     std::cout << "0" << '\n';
      |          ^~~~
a.cc:14:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: Java

import java.io.*;
import java.util.*;
class Main 
{
 public static void main(String args[]) throws IOException
 {
   int n;
   long p=1;
   Scanner sc=new Scanner(System.in);
   n=sc.nextInt();
   int a[]=new int[n];
   for(int i=0;i<n;i++)
   	a[i]=sc.nextInt();
   for(int i=0;i<n;i++)
   {
     p=p*(long)a[i];
   }
   if(p<=(long)Math.pow(10,18))
   	System.out.println(a*b);
   else
     System.out.println(-1);
 
 }
}

Compiler output:
Main.java:19: error: cannot find symbol
   	System.out.println(a*b);
   	                     ^
  symbol:   variable b
  location: class Main
1 error
Language: C++

#include<bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp> 
using namespace boost::multiprecision; 
using namespace std;
int main(){
  int128_t n;cin>>n;
  int128_t mx=1e18,ans=1;
  while(n--){
    int128_t k;
    cin>>k;
    if((mx/ans)<k){cout<<-1<<endl;return 0;}
    ans*=k;
    if(k==0){cout<<0<<endl;return 0;}
    //if(ans>mx)
  }
cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc:2:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    2 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
using namespace std;
void main()
 {long long int pro=1;
  long int arr[100000];
  long int n;
  for(long int i= 0; i<n;i++){
  cin>>arr[i];
  }
 for(i=0;i<n;i++){pro=pro*arr[i];}
  cout<<pro;
}


Compiler output:
a.cc:3:1: error: '::main' must return 'int'
    3 | void main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:10:6: error: 'i' was not declared in this scope
   10 |  for(i=0;i<n;i++){pro=pro*arr[i];}
      |      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
# define pb push_back
# define FOR(i,a,n) for(int i=a;i<n;i++)
# define mp make_pair
# define RFOR(i,a,n) for(int i=n;i>a;i--)
# define pii pair<long long int,long long int>
#define ub upper_bound
#define lb lower_bound
#define MOD 1000000007
typedef long long int ll;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
        cout.tie(0);
	ll n;
	cin>>n;
	ll arr[n];
	ll cnt=arr[0];
	ll cnt1=0;
  	bool g=false;
  	for(int i=0;i<n;i++)
      if(a[i]==0)
        g=true;
  	if(g){
      cout<<"0";
      return 0;
    }
	for(int i=1;i<n;i++)
	{
		cnt*=arr[i];
		if(cnt>pow(10,18))
		cnt1++;
		if(cnt<0)
		cnt1++;
	}
	if(cnt1>0)
	cout<<"-1"<<endl;
	else
	cout<<cnt<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:10: error: 'a' was not declared in this scope
   24 |       if(a[i]==0)
      |          ^
Language: C++

#include <iostream>
#include<math.h>
using namespace std;

int main(){
	int N,A;
  	unsigned long long S=1;
  	uint_64_t D = pow(10,18.0);
  	cin >> N;
  for(int i=0;i<N;i++){
  	cin >> A;
  	S *=A;
  }
  if(S>D){
      cout << -1<<endl;
    }else{
  		cout<<S<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'uint_64_t' was not declared in this scope; did you mean 'u_int64_t'?
    8 |         uint_64_t D = pow(10,18.0);
      |         ^~~~~~~~~
      |         u_int64_t
a.cc:14:8: error: 'D' was not declared in this scope
   14 |   if(S>D){
      |        ^
Language: C++

import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt, gcd
from copy import deepcopy


def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    num = 1000000000000000000
    ans = 1
    for i in a_list:
        ans *= i
    
    if ans <= num:
        print(ans)
    else:
        print(-1)

if __name__ == "__main__":
    main()

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import os
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

##include <bits/stdc++.h>
using namespace std;

int main(int argc, char const *argv[]) {
  int N,A,answer;
  std::cin >> N >> A;
  if (answer =>　1000000000000000000){
    for (size_t i = 0; i < N; i++) {
      answer = A * A
    }
    std::cout << answer << '\n';
  }
  else {
    std::cout << "0" << '\n';
  }
  return 0;
}


Compiler output:
a.cc:1:1: error: stray '##' in program
    1 | ##include <bits/stdc++.h>
      | ^~
a.cc:7:16: error: extended character 　 is not valid in an identifier
    7 |   if (answer =>　1000000000000000000){
      |                ^
a.cc:1:3: error: 'include' does not name a type
    1 | ##include <bits/stdc++.h>
      |   ^~~~~~~
a.cc: In function 'int main(int, const char**)':
a.cc:6:8: error: 'cin' is not a member of 'std'
    6 |   std::cin >> N >> A;
      |        ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | ##include <bits/stdc++.h>
a.cc:7:15: error: expected primary-expression before '>' token
    7 |   if (answer =>　1000000000000000000){
      |               ^
a.cc:7:16: error: '\U000030001000000000000000000' was not declared in this scope
    7 |   if (answer =>　1000000000000000000){
      |                ^~~~~~~~~~~~~~~~~~~~~
a.cc:8:10: error: 'size_t' was not declared in this scope
    8 |     for (size_t i = 0; i < N; i++) {
      |          ^~~~~~
a.cc:1:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
  +++ |+#include <cstddef>
    1 | ##include <bits/stdc++.h>
a.cc:8:24: error: 'i' was not declared in this scope
    8 |     for (size_t i = 0; i < N; i++) {
      |                        ^
a.cc:9:21: error: expected ';' before '}' token
    9 |       answer = A * A
      |                     ^
      |                     ;
   10 |     }
      |     ~                
a.cc:11:10: error: 'cout' is not a member of 'std'
   11 |     std::cout << answer << '\n';
      |          ^~~~
a.cc:11:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:14:10: error: 'cout' is not a member of 'std'
   14 |     std::cout << "0" << '\n';
      |          ^~~~
a.cc:14:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <bits/stdc++.h> 
using namespace std;
#define endl "\n"
typedef long long int ll;
int main(){
 
   std::uint64 n;
   cin>>n;
   if(n>2){
   std::uint64_t x,y=1;
  while(cin>>x)
    y*=x;
     
 (1e18>y)?cout<<y<<endl:cout<<-1<<endl;
}
   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'uint64' is not a member of 'std'; did you mean 'uint64_t'?
    7 |    std::uint64 n;
      |         ^~~~~~
      |         uint64_t
a.cc:8:9: error: 'n' was not declared in this scope; did you mean 'yn'?
    8 |    cin>>n;
      |         ^
      |         yn
Language: C++

int main() {
    cin.tie(NULL);
   long int n;
    long long int inp;
    cin>>n;
    long long int ans=1;
    for(int i=0;i<n;i++){
        cin>>inp;
            ans = ans * inp;
            if(i==n-1){
                if(ans>1000000000000000000){
                    cout<<"-1"<<endl;
                }
                else{
                    cout << ans<<endl;
                }
            }
    }



}


Compiler output:
a.cc: In function 'int main()':
a.cc:2:5: error: 'cin' was not declared in this scope
    2 |     cin.tie(NULL);
      |     ^~~
a.cc:2:13: error: 'NULL' was not declared in this scope
    2 |     cin.tie(NULL);
      |             ^~~~
a.cc:1:1: note: 'NULL' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
  +++ |+#include <cstddef>
    1 | int main() {
a.cc:12:21: error: 'cout' was not declared in this scope
   12 |                     cout<<"-1"<<endl;
      |                     ^~~~
a.cc:12:33: error: 'endl' was not declared in this scope
   12 |                     cout<<"-1"<<endl;
      |                                 ^~~~
a.cc:15:21: error: 'cout' was not declared in this scope
   15 |                     cout << ans<<endl;
      |                     ^~~~
a.cc:15:34: error: 'endl' was not declared in this scope
   15 |                     cout << ans<<endl;
      |                                  ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
int N;
int64_t x=1 ,  ,y;
cin >> N;
vector<int> vec(N);
for (int i = 0; i < N; i++) {
  cin >> vec.at(i);
}

for (int i = 0; i < N; i++)
{
    x *= vec.at(i);
    
}
y=x;
for (int i = 0; i < N; i++)
{
    y /= vec.at(i);
    
}

if (x == y)
{
    cout << x <<endl;
}else
{
    cout << -1 <<endl;
}


}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:16: error: expected unqualified-id before ',' token
    6 | int64_t x=1 ,  ,y;
      |                ^
Language: C

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int n;
	int ii=1,f=0;
	long long temp1=1;
	long long a,temp2;
	cin>>n;
	for(ii=1;ii<=n;ii++)
	{
		cin>>a;
		if(f==0)
		{
			temp2=temp1*a;
						
			if(temp2<temp1 && a!=0)
			{	
				temp1=-1;
				f=1;
			}
			else
				temp1=temp2;			
		}
		else
		{
			if(a==0)
				temp1=0;
			else
				temp1=-1;
		}	
	}
	
	if(temp1>1000000000000000000)
		cout<<-1;
	else
		cout<<temp1;
			
	return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>
#include <set>
#include <climits>
#include <map>
#include <iostream>
#include <string>
#include <queue>
#include <math.h>
#include <cstring>
#define test 0
using namespace std;
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define int long long int
#define vll vector<long long>
#define so(v) sort(v.begin(), v.end())
#define REP(i, a, n) for (int i = a; i < n; i++)
const int N=10005;
int arr[N],dp[N];
// const ll md=1000000007;
// ll dp[N],vis[N];
// bool prime[N];
// void sieve()
// {
//     REP(i,0,N)
//     prime[i]=true;
//     prime[0]=false;
//     prime[1]=false;
//     for(int i=2;i*i<=N;i++)
//     {
//         if(prime[i])
//         {
//             for(int j=i*i;j<=N;j+=i)
//             prime[j]=false;
//         }
//     }
// }
// int solve(int n,int k)
// {
//     return n*k;
// }
int32_t main()
{
    //sieve();
    int t = 1;
    if (test == 1)
        cin >> t;
    while (t--)
    {
        //cout<<1e18;
        int n,s=1,ans;
        int x=1;
        cin>>n;
        REP(i,0,n)
        {
            cin>>x;
            if(x!=0 && s!=0)
            {
                if(s<=(1e18*1.0/(x*1.0))
                {
                s=s*x;
                ans=s;
                }
                else
                {
                    s=1000000000000000001;
                    ans=-1;
                }
            }
            else
            {
                s=0;
                ans=0;
            }
        }
        cout<<ans;
    }
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:65:41: error: expected ')' before '{' token
   65 |                 if(s<=(1e18*1.0/(x*1.0))
      |                   ~                     ^
      |                                         )
   66 |                 {
      |                 ~                        
a.cc:75:13: error: expected primary-expression before '}' token
   75 |             }
      |             ^
Language: C++

//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n,k) (((ll)n>>(ll)k)&1) /*nのk bit目*/
const long long INF= 1e+18+1;
typedef long long ll;
using ll=__int128;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
//const ll MOD=1000000007LL;
const ll MOD=998244353LL;
//const ll MAX_V=114514LL;
const ll MAX = 510000LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx={-1,-1,-1,0,0,1,1,1};
vl dy={1,-1,0,1,-1,1,0,-1};
//using int128=__int128;
 
ostream &operator<<(ostream &os,const __int128 n){
    if(n==0){
        cout<<0;
        return os;
    }
    __int128 num=n;
    bool neg=false;
    if(num<0)neg=true,num=-num;
    string res="";
    while(num>0){
        res.push_back('0'+num%10);
        num/=10;
    }
    if(neg) res.push_back('-');
    reverse(begin(res),end(res));
    os<<res;
    return os;
}
 
istream &operator>>(istream &is,__int128 &n){
    string s;
    is>>s;
    int idx=0;
    bool neg=false;
    if(s[0]=='-')neg=true,idx++;
    n=0;
    for(;idx<(int)s.size();idx++){
        n=10*n+s[idx]-'0';
    }
    if(neg) n=-n;
    return is;
}
 
__int128 abs(__int128 x){
    return x<0?-x:x;
}
 
__int128 gcd(__int128 a,__int128 b){
    if(a==0) return b;
    if(b==0) return a;
    return b>0?gcd(b,a%b):a;
}
//ll dp[3010][3010];
bool is_product_overflow(ll a, ll b) {

	ll prod = a * b;
	
	return (prod / b != a);
}
int main(){
  ll n;cin>>n;
  vl a(n);
  rep(i,n)cin>>a[i];
  ll ans=a[0];
  for(ll i=1;i<n;i++){
    
    if(is_product_overflow(ans,a[i])){
      cout<<-1<<endl;
      return 0;
    }
    
  }
  if(ans>1000000000000000000LL){
      cout<<-1<<endl;
      return 0;
  }
   cout<<ans<<endl;
}

Compiler output:
a.cc:10:7: error: conflicting declaration 'using ll = __int128'
   10 | using ll=__int128;
      |       ^~
a.cc:9:19: note: previous declaration as 'typedef long long int ll'
    9 | typedef long long ll;
      |                   ^~
Language: C++

#include <iostream>
using namespace std;
typedef  long long ll;
int main(){
  ll n;cin>>n;
  ll a,ans=1,b=0;
  for(int i=0;i<n;i++){
    cin>> a;
    an=ans;
    ans=ans*a;
    if(a!=0){if(ans%a!=0){b=-1;}}
    if(ans>1000000000000000000){b=-1;}
    if(ans<0){b=-1;}
  }
  if(ans==0)b=0;
  if(b==0){
  cout << ans<<endl;
  }else{
    cout << b<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'an' was not declared in this scope; did you mean 'ans'?
    9 |     an=ans;
      |     ^~
      |     ans
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  long int n;
  cin>>n;
  long long int ans=1,b;
  b=1000000000000000000;
  for(long int i=0;i<n;i++){
    long long int a;
    cin>>a;
    if(ans!=-1&&ans!=0){
      if(log10(a)+log10(ans)<18))
        ans=a*ans;
      else
        ans=-1;
    }
    if(a==0){
      ans=0;
      break;
    }
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:33: error: expected primary-expression before ')' token
   12 |       if(log10(a)+log10(ans)<18))
      |                                 ^
Language: C

#include <stdio.h>
int main(void){
  int n,i,a[10005];
  int m=1;
  scanf("%d",&n);
  for(i=0;i<n;++i){
    scanf("%d",&a[i]);
  }
  for(i=0;i<n,++i){
    m=m*a[i];
  }
  if(m<=1000000000000000000){
    printf("%d",m);
  }
  else{
    printf("-1");
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:18: error: expected ';' before ')' token
    9 |   for(i=0;i<n,++i){
      |                  ^
      |                  ;
Language: C++

int main() {
    int N;
    long int A[100000];
    cin >> N;
    for(int i = 0; i < N; i++) cin >> A[i];

    long int x = A[0];
    for(int i = 1; i < N; i++) {
        x *= A[i];
    }
    
    int z = -1;
    if(x <= 1000000000000000000) {
        cout << x << endl;
    } else {
        cout << z << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin >> N;
      |     ^~~
a.cc:14:9: error: 'cout' was not declared in this scope
   14 |         cout << x << endl;
      |         ^~~~
a.cc:14:22: error: 'endl' was not declared in this scope
   14 |         cout << x << endl;
      |                      ^~~~
a.cc:16:9: error: 'cout' was not declared in this scope
   16 |         cout << z << endl;
      |         ^~~~
a.cc:16:22: error: 'endl' was not declared in this scope
   16 |         cout << z << endl;
      |                      ^~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
 
int main(){
  
	short int n;
  unsigned long long ans=1,tmp=1e+18;
	cin >> n;
    vector<unsigned long long> vec(n);
  if(n<2)
    return 0;
  for (int i=0;i<n;i++){
    cin >> vec(i);
    ans=ans*vec(i);
  }
  if(ans>tmp || ans<0){
    cout << "-1";
    return 0;
  }
  else
  	cout << ans; 
}



Compiler output:
a.cc: In function 'int main()':
a.cc:14:15: error: no match for call to '(std::vector<long long unsigned int>) (int&)'
   14 |     cin >> vec(i);
      |            ~~~^~~
a.cc:15:16: error: no match for call to '(std::vector<long long unsigned int>) (int&)'
   15 |     ans=ans*vec(i);
      |             ~~~^~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
  	N = 2
  	vector<int> vec(N);
	for (int i = 0; i < N; i++) {
  		cin >> vec.at(i);
		}
	vec.at(1) = 20;
    vec.at(2) = 31;
    if(vec.at(1) * vec.at(2) <= 10^18){cout << vec.at(1) * vec.at(2) << endl};
  	if(vec.at(1) * vec.at(2) > 10^18){cout << -1 << endl};
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'N' was not declared in this scope
    5 |         N = 2
      |         ^
a.cc:8:24: error: 'vec' was not declared in this scope
    8 |                 cin >> vec.at(i);
      |                        ^~~
a.cc:10:9: error: 'vec' was not declared in this scope
   10 |         vec.at(1) = 20;
      |         ^~~
a.cc:13:61: error: expected ';' before '}' token
   13 |         if(vec.at(1) * vec.at(2) > 10^18){cout << -1 << endl};
      |                                                             ^
      |                                                             ;
Language: C++

#include<iostream>
using namespace std;

int main() {
  int N;
  cin >> N;
  int64_t B = 1000000000000000000;
  int64_t C = 1000000000;
  int64_t A;
  int64_t sum = 1;
  int64_t K = 0;
  for (int i = 0; i < N; i++) {
    cin >> A;
    if (sum > C && A > C){
      K++;
      sum = 1;
    }
      
    sum *= A;
    
    if (sum > B) {
      K++;
      sum = 1;
    }
  }
  if (sum <= B && K = 0) {
    cout << sum << endl;
  }
  else if (sum == 0) {
    cout << sum << endl;
  }
  else {
    cout << -1 << endl;
  }
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:16: error: lvalue required as left operand of assignment
   26 |   if (sum <= B && K = 0) {
      |       ~~~~~~~~~^~~~
Language: C++

N = int(input())
ans = 1
A = [int(x) for x in input().split()]
i = 0
while i < N : 
  ans = ans * A[i]
  i = i + 1
    
if ( ans > 1000000000000000000 ) : 
  print(-1) 
else :
  print(ans)

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N = int(input())
      | ^
Language: C

#include<iostream>
#include<cmath>
using namespace std;

int main()
{
	int n;
	int ii=1,f=0;
	long long temp1=1;
	long long a,temp2;
	cin>>n;
	for(ii=1;ii<=n;ii++)
	{
		cin>>a;
		if(f==0)
		{
			temp2=temp1*a;
						
			if(temp2<temp1 && a!=0)
			{	
				temp1=-1;
				f=1;
			}
			else
				temp1=temp2;			
		}
		else
		{
			if(a==0)
				temp1=0;
			else
				temp1=-1;
		}	
	}
	
	if(temp1>1000000000000000000)
		cout<<-1;
	else
		cout<<temp1;
			
	return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
int main() {
    int N, A, ans;
    ans = 1;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        cin >> A;
        ans *= A;
    }

    int Limit;
    Limit = pow(10, 18);
    if (ans > Limit)
    {
        cout << -1;
    }
    else
    {
        cout << ans;
    }

}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
    5 | int main() {
      |         ^~
a.cc:5:9: note: remove parentheses to default-initialize a variable
    5 | int main() {
      |         ^~
      |         --
a.cc:5:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:5:12: error: a function-definition is not allowed here before '{' token
    5 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <cmath>
using namespace std;
int main()
{
  long n;
  cin>>n;
  long long arr[n],mul=1;
  for(long i=0;i<n;i++)
  {
   	cin>>arr[i]; 
    mul=mul*arr[i];
    if(mul>pow(10,18))
    {
      k=1;
      mul=-1;
      break;
    }
  }
  cout<<mul<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:7: error: 'k' was not declared in this scope
   15 |       k=1;
      |       ^
Language: Java

import java.util.*;
import java.math.*;
import java.io.*;
public class EdD {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
//	 	
 		int n = Integer.parseInt(bf.readLine());
 		StringTokenizer st = new StringTokenizer(bf.readLine());
 		BigInteger prod = new BigInteger("1");
 		
 		for(int i = 0;i<n;i++){
 			prod = prod.multiply(new BigInteger(st.nextToken()));
 			if (prod.compareTo(new BigInteger("1000000000000000000")) > 0){
 				out.println(-1);
 				out.close();
 				break;
 			}
 		}
 		out.println(prod);
 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	




Compiler output:
Main.java:4: error: class EdD is public, should be declared in a file named EdD.java
public class EdD {
       ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e18;
signed main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    for (int i = 1; i <= n; ++i)
        if (a[i] == 0) {
            cout << "0" << endl;
            return 0;
        }
    ll ans = 1;
    for (int i = 1; i <= n; ++i) {
        ll t = inf / ans;
        if (a[i] > t) {
            cout << "-1" << endl;
            return 0;
        }
        ans = ans * a[i];
    }
    return cout << ans << endl, 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:12: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |     cin >> n;
      |            ^
      |            yn
a.cc:8:41: error: 'a' was not declared in this scope
    8 |     for (int i = 1; i <= n; ++i) cin >> a[i];
      |                                         ^
a.cc:10:13: error: 'a' was not declared in this scope
   10 |         if (a[i] == 0) {
      |             ^
a.cc:17:13: error: 'a' was not declared in this scope
   17 |         if (a[i] > t) {
      |             ^
a.cc:21:21: error: 'a' was not declared in this scope
   21 |         ans = ans * a[i];
      |                     ^
Language: C++

#include<iostream> 
using namespace std; 
string multiply(string num1, string num2) 
{ 
    int len1 = num1.size(); 
    int len2 = num2.size(); 
    if (len1 == 0 || len2 == 0) 
    return "0"; 
  
    // will keep the result number in vector 
    // in reverse order 
    vector<int> result(len1 + len2, 0); 
  
    // Below two indexes are used to find positions 
    // in result.  
    int i_n1 = 0;  
    int i_n2 = 0;  
      
    // Go from right to left in num1 
    for (int i=len1-1; i>=0; i--) 
    { 
        int carry = 0; 
        int n1 = num1[i] - '0'; 
  
        // To shift position to left after every 
        // multiplication of a digit in num2 
        i_n2 = 0;  
          
        // Go from right to left in num2              
        for (int j=len2-1; j>=0; j--) 
        { 
            // Take current digit of second number 
            int n2 = num2[j] - '0'; 
  
            // Multiply with current digit of first number 
            // and add result to previously stored result 
            // at current position.  
            int sum = n1*n2 + result[i_n1 + i_n2] + carry; 
  
            // Carry for next iteration 
            carry = sum/10; 
  
            // Store result 
            result[i_n1 + i_n2] = sum % 10; 
  
            i_n2++; 
        } 
  
        // store carry in next cell 
        if (carry > 0) 
            result[i_n1 + i_n2] += carry; 
  
        // To shift position to left after every 
        // multiplication of a digit in num1. 
        i_n1++; 
    } 
  
    // ignore '0's from the right 
    int i = result.size() - 1; 
    while (i>=0 && result[i] == 0) 
    i--; 
  
    // If all were '0's - means either both or 
    // one of num1 or num2 were '0' 
    if (i == -1) 
    return "0"; 
  
    // generate the result string 
    string s = ""; 
      
    while (i >= 0) 
        s += std::to_string(result[i--]); 
  
    return s; 
} 
int main(){
	int n;
  	cin>>n;
  	string s1;
  	cin>>s1;
  	n--;
  	while(n--){
    	string s2;
      	cin>>s2;
      	s1=multiply(s1,s2);
    }
  	if(s1.length()>99999999999999999)	cout<<-1;
  	else cout<<s1;
}

Compiler output:
a.cc: In function 'std::string multiply(std::string, std::string)':
a.cc:12:5: error: 'vector' was not declared in this scope
   12 |     vector<int> result(len1 + len2, 0);
      |     ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:12:12: error: expected primary-expression before 'int'
   12 |     vector<int> result(len1 + len2, 0);
      |            ^~~
a.cc:38:31: error: 'result' was not declared in this scope
   38 |             int sum = n1*n2 + result[i_n1 + i_n2] + carry;
      |                               ^~~~~~
a.cc:51:13: error: 'result' was not declared in this scope
   51 |             result[i_n1 + i_n2] += carry;
      |             ^~~~~~
a.cc:59:13: error: 'result' was not declared in this scope
   59 |     int i = result.size() - 1;
      |             ^~~~~~
Language: Java

package atcoder_BC_169;
import java.util.Scanner;

public class Multiplication_2 {

	public static void main(String[] args) {
		Scanner std = new Scanner(System.in);
		int N = std.nextInt();
		long[] a = new long[N];
		for(int i = 0; i < N; i++)
			a[i] = std.nextLong();
		
		long answer = 0;
		int t = 0;
		for(int i = 0; i < N; i++){
			if(i == 0)
				answer = a[0];
			else{
				answer = answer * a[i];
				if(answer > 1000000000000000000L){
					System.out.println(-1);
					t = -1;
					break;
				}
			}
		}
		if(t == 0)
			System.out.println(answer);
	}
}


Compiler output:
Main.java:4: error: class Multiplication_2 is public, should be declared in a file named Multiplication_2.java
public class Multiplication_2 {
       ^
1 error
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main()
{
    const size_t M = 1000000000;
    size_t N;    
    vector<size_t> A;
    cin >> N;
    A.resize(N, 0);
    for(size_t i = 0; i < N; ++i)
    {
        cin >> A[i];
    }

    // 0 チェック
    for(size_t i = 0; i < N; ++i)
    {
        if(A[i] == 0)
        {
            cout << 0 << endl;    
            return 0;
        }
    }

    size_t T1 = 0;
    size_t T0 = 0;
    for(size_t i = 0; i < N; ++i)
    {
        size_t B = A[i] / M;
        size_t C = A[i] % M;

        if(i == 0)
        {
            T1 = B;
            T0 = C;    
        }
        else
        {
            if( (((T1 / M) >= 1) && (B > 0)) || (((B / M) >= 1) && (T1 > 0))
            {
                cout << -1 << endl;    
                return 0;    
            }

            size_t s2 = T1 * B;
            size_t s1 = T1 * C + T0 * B;
            size_t s0 = T0 * C;

            size_t t0 = s0 % M + (s1 / M);
            size_t t1 = (s1 % M) + (s0 / M);
            size_t t2 = s2 + (t1 / M);
            t1 = t1 % M;

            if(t2 >= 2)
            {
                cout << -1 << endl;    
                return 0;
            }
            else if(t2 == 1) 
            {
                size_t n = t1 * 1000000000 + t0;    
                if(n > 0)
                {
                    cout << -1 << endl;    
                    return 0;
                }
            }
            
            T1 = t2 * 1000000000 + t1;
            T0 = t0;  
        }
    }
    cout << T1 * 1000000000 + T0 << endl;


    return 0;    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:77: error: expected ';' before '{' token
   42 |             if( (((T1 / M) >= 1) && (B > 0)) || (((B / M) >= 1) && (T1 > 0))
      |                                                                             ^
      |                                                                             ;
   43 |             {
      |             ~                                                                
a.cc:48:31: error: expected ')' before ';' token
   48 |             size_t s2 = T1 * B;
      |                               ^
      |                               )
a.cc:42:15: note: to match this '('
   42 |             if( (((T1 / M) >= 1) && (B > 0)) || (((B / M) >= 1) && (T1 > 0))
      |               ^
a.cc:54:25: error: 's2' was not declared in this scope; did you mean 't2'?
   54 |             size_t t2 = s2 + (t1 / M);
      |                         ^~
      |                         t2
Language: C++

#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int main()
{
    ll n;
    cin>>n;
    ll a[n];
    ll flag=0; ll p=1;
    
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        
    }
    sort(a,a+n);
    ll p=1;
    for(int i=0;i<n;i++)
    {
        p=p*a[i];
        if(p>1000000000000000000)
        {flag=1;
        break;}
        
        
        
        
    }
    
    
    if(flag==1)
    cout<<-1;
    else
    cout<<p;
    
    
    
    
    
    
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:8: error: redeclaration of 'long long int p'
   17 |     ll p=1;
      |        ^
a.cc:9:19: note: 'long long int p' previously declared here
    9 |     ll flag=0; ll p=1;
      |                   ^
Language: Java

import java.util.*;
import java.math.BigInteger;
import java.io.*;
public class EdD {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
//	 	
 		int n = Integer.parseInt(bf.readLine());
 		ArrayList<BigInteger> array = new ArrayList<BigInteger>();
 		StringTokenizer st = new StringTokenizer(bf.readLine());
 		BigInteger prod = new BigInteger("1");
 		
 		for(int i = 0;i<n;i++){
 			prod = prod.multiply(new BigInteger(st.nextToken()));
 			if (prod.compareTo(new BigInteger("1000000000000000000")) > 0){
 				out.println(-1);
 				out.close();
 				break;
 			}
 		}
 		out.println(prod);
 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	




Compiler output:
Main.java:4: error: class EdD is public, should be declared in a file named EdD.java
public class EdD {
       ^
1 error
Language: C

#include<iostream>
#include<cmath>
using namespace std;

int main()
{
	int n;
	int ii=1,f=0;
	long long temp1=1;
	long long a,temp2;
	cin>>n;
	for(ii=1;ii<=n;ii++)
	{
		cin>>a;
		if(f==0)
		{
			temp2=temp1*a;
						
			if(temp2<temp1 && a!=0)
			{	
				temp1=-1;
				f=1;
			}
			else
				temp1=temp2;			
		}
		else
		{
			if(a==0)
				temp1=0;
			else
				temp1-1;
		}	
	}
	
	if(temp1>1000000000000000000)
		cout<<-1;
	else
		cout<<temp1;
			
	return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

int main() {
    int N, A, ans;
    ans = 1;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        cin >> A;
        ans *= A;
    }

    int Limit;
    Limit = pow(10, 18);
    if (ans > Limit)
    {
        cout << -1;
    }
    else
    {
        cout << ans;
    }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin >> N;
      |     ^~~
a.cc:12:13: error: 'pow' was not declared in this scope
   12 |     Limit = pow(10, 18);
      |             ^~~
a.cc:15:9: error: 'cout' was not declared in this scope
   15 |         cout << -1;
      |         ^~~~
a.cc:19:9: error: 'cout' was not declared in this scope
   19 |         cout << ans;
      |         ^~~~
Language: C++

#include <bits/stdc++.h>
#include <stdio.h>
typedef long long int LL;
#define fr(i,p,n) for(LL i=p;i<n;i++)
#define fr1(i,p,n) for(LL i=p;i>=n;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define PI 3.14159265358979323846
#define MOD 1000000007
#define MOD1 998244353
#define INF 1e18
#define precise cout << std::setprecision(10) << std::fixed;
 
using namespace std;
 
int main()
{
        LL n;
        cin>>n;
        LL a[n];
        long long int ans=1;
        bool flag=true;
        fr(i,0,n){
            cin>>a[i];
            if(a[i]==0){
              ans=0;
            }
            }
         fr(i,0,n){ 
            if(ans==0){
              break;
            }
            ans=ans*a[i];
           if(ans>(long long int)pow(10,18)){
                cout<<-1<<endl;
                flag=false;
                break;
            }
        }
        
        if(flag==true) cout<<ans<<endl;
    
    return 0;
}
#include <bits/stdc++.h>
#include <stdio.h>
typedef long long int LL;
#define fr(i,p,n) for(LL i=p;i<n;i++)
#define fr1(i,p,n) for(LL i=p;i>=n;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define PI 3.14159265358979323846
#define MOD 1000000007
#define MOD1 998244353
#define INF 1e18
#define precise cout << std::setprecision(10) << std::fixed;

using namespace std;
 
int main()
{
        LL n;
        cin>>n;
        LL a[n];
        long long int ans=1;
        bool flag=true;
        fr(i,0,n){
            cin>>a[i];
            if(a[i]==0){
              ans=0;
            }
            }
            LL prev;
         fr(i,0,n){ 
             prev=ans;
            if(ans==0){
              break;
            }
            ans=ans*a[i];
            if(ans<prev){
                cout<<-1<<endl;
                flag=false;
                break;
            }
           if(ans>(long long int)pow(10,18)){
                cout<<-1<<endl;
                flag=false;
                break;
            }
        }
        
        if(flag==true) cout<<ans<<endl;
    
    return 0;
}

Compiler output:
a.cc:66:5: error: redefinition of 'int main()'
   66 | int main()
      |     ^~~~
a.cc:19:5: note: 'int main()' previously defined here
   19 | int main()
      |     ^~~~
Language: C++

//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)



typedef long double dd;
//#define i_7 (ll)(1E9+7)
#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            cout<<x<<"/"<<y<<endl;
            return;
        }
    }
    cout<<"nun"<<endl;
}
//////////////////////////


ll SOLVE(){
    ll n;cin>>n;
    LL a[n];rep(i,0,n-1)cin>>a[i];
    LL ans=1;
    rep(i,0,n-1){
        ans*=a[i];
    }
    if(ans>powl(10,18))ans=-1;
    cout<<ans<<endl;
    
    return 0;
}

int main(){fastio
    
    clock_t start = clock();
    SOLVE();
    clock_t end = clock();
    const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
    cerr<<endl<<time<<"ms"<<endl;
    
    return 0;
}



Compiler output:
a.cc:7:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    7 | #include "boost/multiprecision/cpp_int.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
int N;
  cin >> N;
  int x = 1;
  int a;
  for (int i = 0; i < N; i++) {

    
      cin >> a;
      x == x* a;
    

   
  }
if (x > 10**18){
  cout << -1 << endl;
}
  else { 
    cout << x <<endl;
}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:12: error: invalid type argument of unary '*' (have 'int')
   18 | if (x > 10**18){
      |            ^~~
Language: C

#include <stdio.h>
#include <math.h>

int main(){
    long long int n,z,i,x,y,ans=1,flag=0;
    p = pow(10, 18);
    scanf("%lld\n", &n);
    long long int arr[n];

    for(x=0;x<n;x++){
        scanf("%lld\n", &arr[n]);
    }

    for(z=0;z<n;z++){
        if(arr[z]==0){
            flag=1;
        }
    }
    if(flag=0){
        for(y=0;y<n;y++){
            ans = ans * arr[y];
            if(ans > p){
                break;
                flag = 2;
            }
        }
    }

    if(flag == 0){
        printf("%lld\n", ans);
    }
    else if(flag == 1){
        printf("lld\n", 0)
    }
    else{
        printf("%lld", -1);
    }


}


Compiler output:
main.c: In function 'main':
main.c:6:5: error: 'p' undeclared (first use in this function)
    6 |     p = pow(10, 18);
      |     ^
main.c:6:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:33:27: error: expected ';' before '}' token
   33 |         printf("lld\n", 0)
      |                           ^
      |                           ;
   34 |     }
      |     ~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
int N;
  cin>> N;
  int x;
  int a;
  for (int i = 0; i < N; i++) {

    
      cin >> a;
      x == x* a;
    

   
  }
if (x > 10**18){
  cout << -1 << endl;
}
  else { 
    cout << x <<endl;
}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:12: error: invalid type argument of unary '*' (have 'int')
   18 | if (x > 10**18){
      |            ^~~