buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
N=int(input()) l=list(map(int,input().split())) a=1 for i in range(N): a=a*l[i] if a>10**18: print(-1) break if a<=10**18: print(a)
N=int(input()) l=list(map(int,input().split())) a=1 l.sort() for i in range(N): a=a*l[i] if a>10**18: print(-1) break if a<=10**18: print(a)
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
68
N = int(input()) A = list(map(int, input().split())) result = 1 for i in range(N): result *= A[i] if result > 10**18: result = -1 break print(result)
N = int(input()) A = list(map(int, input().split())) A = sorted(A) result = 1 for i in range(N): result *= A[i] if result > 10**18: result = -1 break print(result)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
58
n = int(input()) mod = 10**18 li = list(map(int, input().split())).sort() ans = 1 for i in range(n): ans = ans * li[i] if ans > mod: ans = -1 break print(ans)
n = int(input()) mod = 10**18 li = list(map(int, input().split())) li.sort() ans = 1 for i in range(n): ans *= li[i] if ans > mod: ans = -1 break print(ans)
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 48], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 108]]
5
67
#include <bits/stdc++.h> using namespace std; using ll = long long; using vb = vector<bool>; using vvb = vector<vb>; using vd = vector<double>; using vvd = vector<vd>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using pii = pair<int, int>; using pll = pair<ll, ll>; usi...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vb = vector<bool>; using vvb = vector<vb>; using vd = vector<double>; using vvd = vector<vd>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using pii = pair<int, int>; using pll = pair<ll, ll>; usi...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
857
n = int(input()) a = list(map(int,input().split())) ans = 1 if 0 in a: print(0) else: for i in a: ans *= i if ans > 10**18: print(-1) exit() print(ans)
n = int(input()) a = list(map(int,input().split())) ans = 1 if 0 in a: print(0) exit() else: for i in a: ans *= i if ans > 10**18: print(-1) exit() print(ans)
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
66
n = map(int,input().split()) a = list(map(int,input().split())) LIM = 10**18 ans = 1 if 0 in a: print(0) else: for i in a: ans *= i if ans > LIM: print(-1) else: print(ans)
n = map(int,input().split()) a = list(map(int,input().split())) LIM = 10**18 ans = 1 if 0 in a: print(0) exit() else: for i in a: ans *= i if ans > LIM: print(-1) exit() print(ans)
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["-", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102]]
5
74
//go:generate echo "https://atcoder.jp/contests/abc169/tasks/abc169_b" package main import ( "bufio" "fmt" "io" "math" "math/big" "os" "sort" "strconv" ) var scan = newScanner(os.Stdin) func Solve(As []*big.Int) int { sort.Slice(As, func(i, j int) bool { return As[i].Cmp(As[j]) <= 0 }) zero := big.NewInt(0...
//go:generate echo "https://atcoder.jp/contests/abc169/tasks/abc169_b" package main import ( "bufio" "fmt" "io" "math" "math/big" "os" "sort" "strconv" ) var scan = newScanner(os.Stdin) func Solve(As []*big.Int) int { sort.Slice(As, func(i, j int) bool { return As[i].Cmp(As[j]) <= 0 }) zero := big.NewInt(0...
[["-", 8, 196, 0, 57, 15, 16, 12, 16, 17, 33], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 17, 85]]
7
1,963
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<long long> a(n); bool is_zero = false; for (int i = 0; i < n; ++i) { cin >> a[i]; if (a[i] > 0) is_zero = true; } if (is_zero) { cout << 0 << '\n'; return 0; } long long answer = 1; double g = ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<long long> a(n); bool is_zero = false; for (int i = 0; i < n; ++i) { cin >> a[i]; if (a[i] == 0) is_zero = true; } if (is_zero) { cout << 0 << '\n'; return 0; } long long answer = 1; double g =...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
167
n = int(input()) a = list(map(int, input().split())) ans = 1 for i in range(n): ans *= a[i] if(ans > 1000000000000000000): break if(ans > 1000000000000000000): print(-1) else: print(ans)
n = int(input()) a = list(map(int, input().split())) a.sort() ans = 1 for i in range(n): ans *= a[i] if(ans > 1000000000000000000): break if(ans > 1000000000000000000): print(-1) else: print(ans)
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
68
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(void) { int n; cin >> n; vector<ll> a(n); int zero = 0; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) zero++; } if (zero > 0) { cout << 0 << endl; return 0; } ll ans = 1; for (int i = 0; i ...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(void) { int n; cin >> n; vector<ll> a(n); int zero = 0; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) zero++; } if (zero > 0) { cout << 0 << endl; return 0; } ll ans = 1; for (int i = 0; i ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 48], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
154
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long prod = 1; long long arr[n]; for (int i = 0; i < n; ++i) { cin >> arr[i]; } sort(arr, arr + n); for (int i = 0; i < n; ++i) { prod *= arr[i]; if (prod - 1000000000000000000 > 0) { cout << "-1"; r...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long double prod = 1; long long arr[n]; for (int i = 0; i < n; ++i) { cin >> arr[i]; } sort(arr, arr + n); for (int i = 0; i < n; ++i) { prod *= arr[i]; if (prod - 1000000000000000000 > 0) { cout << "-1"; ...
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 39, 40], ["+", 8, 9, 0, 1, 0, 16, 12, 74, 0, 24], ["+", 0, 16, 12, 74, 39, 77, 39, 86, 0, 96], ["+", 8, 9, 0, 1, 0, 16, 12, 74, 0, 25]]
1
110
n = gets.to_i a = gets.split(" ").map(&:to_i) i = 0 res = 1 if a.include?("0") puts 0 return end while i < a.length do res = res * a[i] if res > 10 ** 18 puts "-1" return end i += 1 end puts res
n = gets.to_i a = gets.split(" ").map(&:to_i) i = 0 res = 1 if a.include?(0) puts i return end while i < a.length do res = res * a[i] if res > 10 ** 18 puts "-1" return end i += 1 end puts res
[["-", 0, 121, 15, 652, 3, 4, 0, 557, 0, 62], ["-", 0, 121, 64, 749, 0, 652, 3, 4, 0, 612], ["+", 0, 121, 64, 749, 0, 652, 3, 4, 0, 22]]
4
73
num=int(input()) line=input().split(" ") checklis=sorted(line) if checklis[0]=="0": res=0 else: res=1 i=0 while res<=1000000000000000000 and i<num: res *= int(line[i]) print(res) i+=1 if res>1000000000000000000: res= -1 print(res)
num=int(input()) line=input().split(" ") checklis=sorted(line) if checklis[0]=="0": res=0 else: res=1 i=0 while res<=1000000000000000000 and i<num: res *= int(line[i]) i+=1 if res>1000000000000000000: res= -1 print(res)
[["-", 0, 52, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
85
n = int(input()) a = list(map(int,input().split())) ans=1 if 0 in a: print(0) else: for i in a: ans*=i if ans>10**18: print(-1) break print(ans)
n = int(input()) a = list(map(int,input().split())) ans=1 if 0 in a: ans=0 else: for i in a: ans*=i if ans>10**18: ans=-1 break print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
64
a=1 for i in[*open(0)][1].split():a*=int(i);a=[-1,a][-1<a<1e18] print(a)
a=1 for i in[*open(0)][1].split():a*=int(i);a=[-1,a][-1<a<=1e18] print(a)
[["-", 0, 1, 0, 662, 12, 206, 206, 666, 667, 18], ["+", 0, 1, 0, 662, 12, 206, 206, 666, 667, 19]]
5
48
input();l=input().split();x=not"0"in l for j in l:x=x*int(j)if 0<x*int(j)<=1e18else-1 print(x)
input();l=input().split();x=not"0"in l for j in l:x=x*int(j)if 0<=x*int(j)<=1e18else-1 print(x)
[["-", 0, 1, 0, 662, 12, 41, 0, 666, 667, 18], ["+", 0, 1, 0, 662, 12, 41, 0, 666, 667, 19]]
5
53
i = input i() x = 1 l = i().split() if 0 in l: print(0) quit() for j in l: x *= int(j) if x >= 1e18: print(-1) quit() print(x)
i=input;i();x=1;l=i().split() if '0' in l: print(0) quit() for j in l: x*=int(j) if x > 1e18: print(-1);quit() print(x)
[["+", 36, 36, 36, 36, 36, 36, 0, 656, 0, 35], ["+", 0, 656, 0, 57, 15, 666, 0, 557, 0, 654], ["+", 0, 656, 0, 57, 15, 666, 0, 557, 0, 655], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 35]]
5
58
i = input i() x = 1 l = i().split() if 0 in l: print(0) quit() for j in l: x *= int(j) if x >= 1e18: print(-1) quit() print(x)
i = input i() x = 1 l = i().split() if '0' in l: print(0) quit() for j in l: x *= int(j) if x > 1e18: print(-1) quit() print(x)
[["+", 0, 656, 0, 57, 15, 666, 0, 557, 0, 654], ["+", 0, 656, 0, 57, 15, 666, 0, 557, 0, 655], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
58
a,b=open(0);c=1; for i in b.split(): c*=int(i) if c>10**18:print(-1);exit() print(c)
a,b=open(0);c=1; for i in sorted(b.split()): c*=int(i) if c>10**18:print(-1);exit() print(c)
[["+", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
48
n = int(input()) a = list(map(int, input().split())) ans = 1 if 0 in a: print(0) exit() for i in a: ans = ans * i if ans > 1e18: print(-1) exit() else: print(ans)
n = int(input()) a = list(map(int, input().split())) ans = 1 if 0 in a: print(0) exit() for i in a: ans = ans * i if ans > 1e18: print(-1) exit() print(ans)
[["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102]]
5
69
//-- In the name of ALLAH -- // We're nothing and you're everything. // Ya Ali! #include <bits/stdc++.h> using namespace std; #define pai acos(-1) #define ff first #define ss second #define ll long long #define pb push_back #define mp make_pair #define pll pair<ll, ll> #define sz(a) (ll) a.size() #define endl "\n" #de...
//-- In the name of ALLAH -- // We're nothing and you're everything. // Ya Ali! #include <bits/stdc++.h> using namespace std; #define pai acos(-1) #define ff first #define ss second #define ll long long #define pb push_back #define mp make_pair #define pll pair<ll, ll> #define sz(a) (ll) a.size() #define endl "\n" #de...
[["-", 15, 339, 51, 16, 12, 23, 0, 16, 31, 13], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 31, 13]]
1
288
N = int(input()) #A = list(reversed(sorted(list(map(int, input().split()))))) A = sorted(list(map(int, input().split()))) assert len(A) == N mul = 1 for a in A: mul *= a # print(a, mul) if a == 0: print(0) break if mul >= (10 ** 18): print(-1) break else: print(mul)
N = int(input()) #A = list(reversed(sorted(list(map(int, input().split()))))) A = sorted(list(map(int, input().split()))) assert len(A) == N mul = 1 for a in A: mul *= a # print(a, mul) if a == 0: print(0) break if mul > (10 ** 18): print(-1) break else: print(mul)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
79
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define all(x) x.begin(), x.end() #define vi vector<int> #define vll vector<ll> #define print(x) \ for (auto it = x.begin(); it != x.end(); it++) ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define all(x) x.begin(), x.end() #define vi vector<int> #define vll vector<ll> #define print(x) \ for (auto it = x.begin(); it != x.end(); it++) ...
[["-", 51, 16, 12, 23, 0, 16, 31, 23, 0, 13], ["+", 51, 16, 12, 23, 0, 16, 31, 23, 0, 13]]
1
205
import java.math.BigInteger; import java.util.Scanner; public class Main { static long mod = 1000000007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] t = sc.nextLine().split(" "); int n = Integer.parseInt(t[0]); // long k = Long.parseLong(t[1]); Str...
import java.math.BigInteger; import java.util.Scanner; public class Main { static long mod = 1000000007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] t = sc.nextLine().split(" "); int n = Integer.parseInt(t[0]); // long k = Long.parseLong(t[1]); Str...
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 35]]
3
278
n=int(input()) a=[int(i) for i in input().split()] prod=1 for i in a: prod*=i if prod>10**18: break if prod>10**18: print(-1) else: print(prod)
n=int(input()) a=[int(i) for i in input().split()] a.sort() prod=1 for i in a: prod*=i if prod>10**18: break if prod>10**18: print(-1) else: print(prod)
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
63
#include <bits/stdc++.h> #define INF INT_MAX #define ll long long #define ull unsigned long long #define rep(i, n) for (ll i = 0; i < n; ++i) #define FOR(i, s, e) for (ll i = s; i < e; ++i) #define MOD 1000000007 using namespace std; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return...
#include <bits/stdc++.h> #define INF INT_MAX #define ll long long #define ull unsigned long long #define rep(i, n) for (ll i = 0; i < n; ++i) #define FOR(i, s, e) for (ll i = s; i < e; ++i) #define MOD 1000000007 using namespace std; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
294
n=input() list1=map(int,input().split()) if 0 in list1: print(0) else: ans=1 for i in list1: ans*=i if ans>1e18: ans=-1 break print(ans)
n=input() list1=list(map(int,input().split())) if 0 in list1: print(0) else: ans=1 for i in list1: ans*=i if ans>1e18: ans=-1 break print(ans)
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
55
#include <algorithm> #include <cmath> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> using namespace std; int ky[8] = {-1, 1, -2, 2, -2, 2, -1, 1}; int kx[8] = {-2, -2, -1, -1, 1, 1, 2, 2}; i...
#include <algorithm> #include <cmath> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> using namespace std; int ky[8] = {-1, 1, -2, 2, -2, 2, -1, 1}; int kx[8] = {-2, -2, -1, -1, 1, 1, 2, 2}; i...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 39, 40], ["+", 75, 76, 0, 1, 0, 16, 12, 74, 0, 24], ["+", 0, 1, 0, 16, 12, 74, 39, 77, 39, 78], ["+", 75, 76, 0, 1, 0, 16, 12, 74, 0, 25]]
1
329
n = gets.to_i a = gets.split(" ").map(&:to_i).sort.reverse if a.include?(0) puts 0 exit end sum = 1 lm = 10**18 n.times{ |i| sum *= a[i] if sum > lm puts 0 exit end } puts sum
n = gets.to_i a = gets.split(" ").map(&:to_i).sort.reverse if a.include?(0) puts 0 exit end sum = 1 lm = 10**18 n.times{ |i| sum *= a[i] if sum > lm puts -1 exit end } puts sum
[["-", 0, 121, 64, 749, 0, 652, 3, 4, 0, 612], ["+", 64, 749, 0, 652, 3, 4, 0, 748, 17, 33], ["+", 64, 749, 0, 652, 3, 4, 0, 748, 439, 612]]
4
68
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; const ll MX = 1e18; int main() { int n; cin >> n; vector<ll> a(n); rep(i, n) cin >> a[i]; ll ans = 1; sort(a.begin(), a.end()); rep(i, n) { if (a[i] == 0) { ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; const ll MX = 1e18; int main() { int n; cin >> n; vector<ll> a(n); rep(i, n) cin >> a[i]; ll ans = 1; sort(a.begin(), a.end()); rep(i, n) { if (a[i] == 0) { ...
[["+", 15, 339, 51, 16, 12, 16, 31, 16, 17, 85], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 12, 22], ["-", 15, 339, 51, 16, 12, 16, 12, 16, 17, 48], ["-", 15, 339, 51, 16, 12, 16, 12, 16, 12, 22]]
1
159
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vll = vector<long long>; using vvi = vector<vector<int>>; using pii = pair<int, int>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define pb push_back const ll MAX = 1e18; vll a(100010); int main() { int n; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vll = vector<long long>; using vvi = vector<vector<int>>; using pii = pair<int, int>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define pb push_back const ll MAX = 1e18; vll a(100010); int main() { int n; ...
[["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]]
1
163
#include <iostream> #define LIMIT 1000000000000000000 using namespace std; int main() { int n; unsigned long long a, ans = 1; bool overflow = false; cin >> n; for (int i = 0; i < n; i++) { cin >> a; if (!a || a <= LIMIT / ans) { ans *= a; } else { overflow = true; } } if (!...
#include <iostream> #define LIMIT 1000000000000000000 using namespace std; int main() { int n; unsigned long long a, ans = 1; bool overflow = false; cin >> n; for (int i = 0; i < n; i++) { cin >> a; if (!a || !ans || a <= LIMIT / ans) { ans *= a; } else { overflow = true; } } ...
[["+", 15, 339, 51, 16, 31, 16, 12, 91, 17, 111], ["+", 15, 339, 51, 16, 31, 16, 12, 91, 28, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106]]
1
109
#include <bits/stdc++.h> using namespace std; #define ll long long signed main() { int n; cin >> n; ll num = 1, a; for (int i = 0; i < n; i++) { cin >> a; if (a > 0 && 1000000000000000000 / num >= a) { num *= a; } else if (a == 0) { num = 0; } else { num = -1; ...
#include <bits/stdc++.h> using namespace std; #define ll long long signed main() { int n; cin >> n; ll num = 1, a; for (int i = 0; i < n; i++) { cin >> a; if (a > 0 && 1000000000000000000 / num >= a) { num *= a; } else if (a == 0) { num = 0; break; } else { ...
[["+", 75, 76, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 75, 76, 0, 57, 64, 9, 0, 93, 0, 35]]
1
91
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define ll long long int main(void) { ll n; cin >> n; ll ans = 1; vector<ll> a(n); rep(i, n) { cin >> a[i]; if (a[i] == 0) { ans = 0; cout << ans << endl; return 0; } } rep(i, n) ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define ll long long int main(void) { ll n; cin >> n; ll ans = 1; vector<ll> a(n); rep(i, n) { cin >> a[i]; if (a[i] == 0) { ans = 0; cout << ans << endl; return 0; } } rep(i, n) ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 48], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
127
#include <bits/stdc++.h> using namespace std; const int k = 1e18; int main() { int n; cin >> n; long long arr[n]; long long ans = 1; for (int i = 0; i < n; i++) { cin >> arr[i]; } int count = 0; for (int i = 0; i < n; i++) { if (arr[i] == 0) count++; } if (count > 0) { cout << 0; ...
#include <bits/stdc++.h> using namespace std; const int k = 1e18; int main() { int n; cin >> n; long long arr[n]; long long ans = 1; for (int i = 0; i < n; i++) { cin >> arr[i]; } int count = 0; for (int i = 0; i < n; i++) { if (arr[i] == 0) count++; } if (count > 0) { cout << 0; ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
159
#include <cmath> #include <iostream> #include <set> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using P = pair<int, int>; int mod = (int)1e9 + 7; long C = 1e2; int main() { int n; cin >> n; vector<long> a(n, 0); long ans = 1; rep(i, n) { cin...
#include <cmath> #include <iostream> #include <set> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using P = pair<int, int>; int mod = (int)1e9 + 7; long C = 1e18; int main() { int n; cin >> n; vector<long> a(n, 0); long ans = 1; rep(i, n) { ci...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]]
1
163
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, x = 0; cin >> n; ll a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) x++; } if (x > 0) return cout << 0 << endl, 0; ll pro = 1...
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, x = 0; cin >> n; ll a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) x++; } if (x > 0) return cout << 0 << endl, 0; ll pro = 1...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
161
#include <bits/stdc++.h> typedef unsigned long long ll; using namespace std; ll maxi = 1e18; int main() { int n; cin >> n; ll x; long double zbr = 1; for (int i = 0; i < n; i++) { cin >> x; if (zbr != -1) zbr *= x; if (zbr > 1000000000000000000 || zbr < 0) { zbr = -1; } if (x ...
#include <bits/stdc++.h> typedef long long ll; using namespace std; ll maxi = 1e18; int main() { int n; cin >> n; ll x; long double zbr = 1; for (int i = 0; i < n; i++) { cin >> x; if (zbr != -1) zbr *= x; if (zbr > 1000000000000000000 || zbr < 0) { zbr = -1; } if (x == 0) { ...
[["-", 36, 36, 0, 30, 0, 134, 39, 86, 0, 87]]
1
106
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int N; cin >> N; ll sum = 1; vector<ll> vec(N); rep(i, N) { cin >> vec.at(i); } sort(vec.begin(), vec.end()); if (vec.at(0) == 0) { cout << 0 << endl; return 0; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int N; cin >> N; ll sum = 1; vector<ll> vec(N); rep(i, N) { cin >> vec.at(i); } sort(vec.begin(), vec.end()); if (vec.at(0) == 0) { cout << 0 << endl; return 0; ...
[["+", 15, 339, 51, 16, 12, 16, 31, 23, 0, 24], ["+", 31, 23, 0, 16, 12, 2, 3, 4, 0, 25], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
156
n = int(input()) a = sorted(list(map(int, input().split()))) ans = 1 for i in a: ans *= i if ans >= 10**18: print("-1") break else: print(ans)
n = int(input()) a = sorted(list(map(int, input().split()))) ans = 1 for i in a: ans *= i if ans > 10**18: print("-1") break else: print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
59
N=int(input()) L=list(map(int,input().split())) A=1 if 0 in L: print(0) for i in range(N): A=A*L[i] if 10**18<A: print(-1) exit() print(A)
N=int(input()) L=list(map(int,input().split())) A=1 if 0 in L: print(0) exit() for i in range(N): A=A*L[i] if 10**18<A: print(-1) exit() print(A)
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
72
N = int(input()) A = list(map(int, input().split())) a.sort() ans = 1 max_limit = 10 ** 18 for i in range(N): ans *= A[i] if ans > max_limit: ans = -1 break if ans > max_limit: print(str(-1)) else: print(str(ans))
N = int(input()) A = list(map(int, input().split())) A.sort() ans = 1 max_limit = 10 ** 18 for i in range(N): ans *= A[i] if ans > max_limit: ans = -1 break if ans > max_limit: print(str(-1)) else: print(str(ans))
[["-", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22]]
5
84
n = int(input()) a = list(map(int,input().split())) if 0 in a: ans = 0 else: ans = 1 for i in a: if ans * i > 10**18: ans = -1 else: ans = ans * i print(ans)
n = int(input()) a = list(map(int,input().split())) if 0 in a: ans = 0 else: ans = 1 for i in a: if ans * i > 10**18: ans = -1 break else: ans = ans * i print(ans)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
67
#include <bits/stdc++.h> using namespace std; #define ll long long #define d long double #define scf(n) scanf("%d", &n) #define lscf(n) scanf("%lld", &n) #define dscf(n) scanf("%Lf", &n) #define pri(n) printf("%d ", (int)n) #define lpri(n) printf("%lld ", n) #define dpri(n) printf("%Lf ", n) #define prin(n) printf("%...
#include <bits/stdc++.h> using namespace std; #define ll long long #define d long double #define scf(n) scanf("%d", &n) #define lscf(n) scanf("%lld", &n) #define dscf(n) scanf("%Lf", &n) #define pri(n) printf("%d ", (int)n) #define lpri(n) printf("%lld ", n) #define dpri(n) printf("%Lf ", n) #define prin(n) printf("%...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
298
function Main(input) { input = input.split("\n"); const N = parseInt(input[0]); const A = input[1].split(" "); let answer = BigInt(A[0]); let B = []; for (let i = 0; i < N; i++) { B[i] = BigInt(A[i]); } if (A.indexOf("0") === -1) { for (let i = 1; i < N; i++) { answer = answer * B[i]; ...
function Main(input) { input = input.split("\n"); const N = parseInt(input[0]); const A = input[1].split(" "); let answer = BigInt(A[0]); let B = []; for (let i = 0; i < N; i++) { B[i] = BigInt(A[i]); } if (A.indexOf("0") === -1) { for (let i = 1; i < N; i++) { answer = answer * B[i]; ...
[["-", 0, 556, 0, 1, 0, 11, 12, 2, 63, 22], ["-", 0, 1, 0, 11, 12, 2, 3, 3, 0, 24], ["-", 0, 1, 0, 11, 12, 2, 3, 3, 0, 25], ["-", 0, 1, 0, 2, 3, 3, 0, 2, 63, 22], ["+", 0, 1, 0, 2, 3, 3, 0, 2, 63, 22]]
2
219
a = input() a = list(map(int,input().split())) if 0 in a: print(0) exit ans = 1 for n in a: ans *= n if ans > 10**18: ans = -1 break print(ans)
n=input() a = list(map(int,input().split())) if 0 in a: print(0) exit() ans = 1 for n in a: ans*=n if ans > 10**18: ans = -1 break print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
59
def main(): n = int(input()) a = list(map(int, input().split())) ans = 1 if 0 in a: print(-1) return else: flag = True for i in a: ans *= i if ans > (10 ** 18): print(-1) return print(ans) main()
def main(): n = int(input()) a = list(map(int, input().split())) ans = 1 if 0 in a: print(0) return else: flag = True for i in a: ans *= i if ans > (10 ** 18): print(-1) return print(ans) main()
[["-", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["-", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
79
def main(): n = int(input()) a = list(map(int, input().split())) if 0 in a: print(-1) return ans = 1 for i in a: ans *= i if ans > (10 ** 18): print(-1) return print(ans) main()
def main(): n = int(input()) a = list(map(int, input().split())) if 0 in a: print(0) return ans = 1 for i in a: ans *= i if ans > (10 ** 18): print(-1) return print(ans) main()
[["-", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["-", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
74
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll mxans = 1e18; int main() { ll n, ans = 1, zeros = 0; cin >> n; vector<ll> arr(n); for (ll i = 0; i < n; i++) { cin >> arr[i]; if (arr[i] == 0) zeros++; } if (zeros > 0) { cout << "0\n"; return 0; } for...
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll mxans = 1e18; int main() { ll n, ans = 1, zeros = 0; cin >> n; vector<ll> arr(n); for (ll i = 0; i < n; i++) { cin >> arr[i]; if (arr[i] == 0) zeros++; } if (zeros > 0) { cout << "0\n"; return 0; } for...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 48], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
159
N = int(input()) A = list(map(int, input().split())) ans = 1 for item in A: ans *= item ans = min(ans, 10**18) if ans == 10**18: print(-1) exit() print(ans)
N = int(input()) A = list(map(int, input().split())) ans = 1 for item in A: ans *= item ans = min(ans, 10**18 + 1) if ans == 10**18 + 1: print(-1) exit() print(ans)
[["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 72], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612]]
5
65
const main = (input) => { const [N, n] = input.trim().split('\n') const LIMIT = BigInt(10, 18) const nums = n.trim().split(' ').map(v => parseInt(v, 10)).sort((a, b) => a - b) if (nums[0] === 0) return console.log(0) let ans = BigInt(1) for (let v of nums) { a...
const main = (input) => { const [, n] = input.trim().split('\n') const LIMIT = BigInt(10 ** 18) const nums = n.trim().split(' ').map(v => parseInt(v, 10)).sort((a, b) => a - b) if (nums[0] === 0) return console.log(0) let ans = BigInt(1) for (let v of nums) { ...
[["-", 8, 556, 0, 570, 0, 200, 141, 577, 0, 22], ["-", 0, 570, 0, 200, 51, 2, 3, 3, 0, 21], ["+", 0, 200, 51, 2, 3, 3, 0, 16, 17, 578], ["-", 0, 11, 12, 16, 12, 2, 3, 3, 0, 24], ["-", 12, 16, 12, 2, 3, 3, 0, 2, 63, 22], ["-", 12, 2, 3, 3, 0, 2, 3, 3, 0, 25]]
2
186
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n; cin >> n; const ll LIMIT = 1e18; vector<ll> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { cout << 0 << endl; return 0; } } ll sum = a[0]; for (int i = 1; i < n; i++) { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n; cin >> n; const ll LIMIT = 1e18; vector<ll> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { cout << 0 << endl; return 0; } } ll sum = a[0]; for (int i = 1; i < n; i++) { ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 48], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
141
#include <iostream> using namespace std; int main() { long long a[100000], b, n; int p = 0, q = 0; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; b = a[0]; for (int i = 0; i < n; i++) { if (a[i] == 0) { b = 0; p = 1; break; } } long long x = 1000000000000000000; if (p...
#include <iostream> using namespace std; int main() { long long a[100000], b, n; int p = 0, q = 0; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; b = a[0]; for (int i = 0; i < n; i++) { if (a[i] == 0) { b = 0; p = 1; break; } } long long x = 1000000000000000000; if (p...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
224
# 169 B N = int(input()) A = list(map(int, input().split())) A.sort() ans = 1 for i in range(N): ans *= A[i] print(ans) if ans > 10**18: print(-1) break else: print(ans)
# 169 B N = int(input()) A = list(map(int, input().split())) A.sort() ans = 1 for i in range(N): ans *= A[i] if ans > 10**18: print(-1) break else: print(ans)
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
71
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long int main() { int n; const ll max = 1e18; cin >> n; vector<ll> a(n); rep(i, n) { cin >> a[n]; if (a[i] == 0) { cout << 0 << endl; return 0; } } ll ans = a[0]; f...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long int main() { int n; const ll max = 1e18; cin >> n; vector<ll> a(n); rep(i, n) { cin >> a[i]; if (a[i] == 0) { cout << 0 << endl; return 0; } } ll ans = a[0]; f...
[["-", 0, 1, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 16, 12, 69, 341, 342, 0, 22]]
1
142
from sys import stdin N = int(stdin.readline()) A = list(map(int, stdin.readline().split())) ans = 1 if 0 in A: ans = 0 if ans: for a in A: ans *= a if ans > pow(10, 18): ans = -1 print(ans)
from sys import stdin N = int(stdin.readline()) A = list(map(int, stdin.readline().split())) ans = 1 if 0 in A: ans = 0 if ans: for a in A: ans *= a if ans > pow(10, 18): ans = -1 break print(ans)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
73
N = int(input()) a = list(map(int, input().split())) count = 1 if 0 in a: print(0) else: for i in range(N): count *= a[i] if ans > 10 ** 18: print(-1) break else: print(count)
N = int(input()) a = list(map(int, input().split())) count = 1 if 0 in a: print(0) else: for i in range(N): count *= a[i] if count > 10 ** 18: print(-1) break else: print(count)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]]
5
72
import sys N = input() num = [int(x) for x in input().split()] multiply = 1 if (0 in num): print(0) sys.exit() for i in num: multiply *= i if (multiply >= 10**18): print(-1) sys.exit() if (0 < multiply and multiply < 10**18): print(multiply)
import sys N = input() num = [int(x) for x in input().split()] multiply = 1 if (0 in num): print(0) sys.exit() for i in num: multiply *= i if (multiply > 10**18): print(-1) sys.exit() if (0 < multiply and multiply <= 10**18): print(multiply)
[["-", 8, 196, 0, 57, 15, 23, 0, 666, 667, 20], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 667, 47], ["-", 0, 57, 15, 23, 0, 679, 12, 666, 667, 18], ["+", 0, 57, 15, 23, 0, 679, 12, 666, 667, 19]]
5
88
n = int(input()) x = [int(w) for w in input().split()] ans = 1 f = False for i in range(n): ans *= x[i] if ans > 10**18: f = True break if ans > 10**18: f = True if(f): print(-1) else: print(ans)
n = int(input()) x = [int(w) for w in input().split()] x = sorted(x) ans = 1 f = False for i in range(n): ans *= x[i] if ans > 10**18: f = True break if ans > 10**18: f = True if(f): print(-1) else: print(ans)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
83
#include <iostream> #include <math.h> using namespace std; int main() { long long int result = 1, help; int N; cin >> N; long long int *A; A = new long long int[N]; int L = 0; for (int i = 0; i < N; i++) { cin >> A[i]; if (A[i] == 0) result = 0; } if (result != 0) { for (int i ...
#include <iostream> #include <math.h> using namespace std; int main() { long long int result = 1, help; int N; cin >> N; long long int *A; A = new long long int[N]; int L = 0; for (int i = 0; i < N; i++) { cin >> A[i]; if (A[i] == 0) result = 0; } if (result != 0) { for (int i ...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 79]]
1
228
N = int(input()) A = list(map(int, input().split())) ans = 1 if 0 in A: print(0) exit() for a in A: ans *= a print(ans) if ans > 10**18: print('-1') exit() print(ans)
# ABC169 N = int(input()) A = list(map(int, input().split())) ans = 1 if 0 in A: print(0) exit() for a in A: ans *= a if ans > 10**18: print('-1') exit() print(ans)
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
72
gets a = gets.split.map &:to_i if a.index(0) puts 0 exit end result = 1 a.forEach do |ai| result *= ai if result > (10 ** 18) puts (-1) exit end end puts result
gets a = gets.split.map &:to_i if a.index(0) puts 0 exit end result = 1 a.each do |ai| result *= ai if result > (10 ** 18) puts (-1) exit end end puts result
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22]]
4
52
#include <algorithm> #include <functional> #include <iostream> #include <string> #include <vector> #define MAX 1000000000000000000 int main() { long long N; std::cin >> N; std::vector<long long> P(N); for (auto &r : P) { std::cin >> r; if (r == 0) { std::cout << 0 << std::endl; return 0; ...
#include <algorithm> #include <functional> #include <iostream> #include <string> #include <vector> #define MAX 1000000000000000000 int main() { long long N; std::cin >> N; std::vector<long long> P(N); for (auto &r : P) { std::cin >> r; if (r == 0) { std::cout << 0 << std::endl; return 0; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
169
#include <math.h> #include <stdio.h> int main() { long long x = 1; int s, z = 0; scanf("%d", &s); long long y[s]; for (int i = 0; i < s; i++) { scanf("%lld", &y[i]); if (y[i] == 0) { printf("0\n"); return 0; } } for (int i = 0; i < s; i++) { if (x * y[i] > 1000000000000000000 ...
#include <math.h> #include <stdio.h> int main() { long long x = 1; int s, z = 0; scanf("%d", &s); long long y[s]; for (int i = 0; i < s; i++) { scanf("%lld", &y[i]); if (y[i] == 0) { printf("0\n"); return 0; } } for (int i = 0; i < s; i++) { if (x > 1000000000000000000 / y[i] ...
[["-", 15, 23, 0, 16, 31, 16, 31, 16, 17, 48], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 17, 47], ["+", 15, 23, 0, 16, 31, 16, 12, 16, 31, 13], ["+", 15, 23, 0, 16, 31, 16, 12, 16, 17, 85], ["-", 0, 57, 15, 23, 0, 16, 31, 16, 17, 47], ["-", 0, 57, 15, 23, 0, 16, 31, 16, 12, 13]]
0
157
N=int(input()) ans =1 A = list(map(int,input().split())) if i in A: i =0 print(0) exit() for i in A: ans *=i if ans >10**18: print(-1) exit() print(ans)
N=int(input()) ans =1 A = list(map(int,input().split())) for i in A: if i == 0: print(0) exit() for i in A: ans *=i if ans >10**18: print(-1) exit() print(ans)
[["-", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102]]
5
70
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; const long long INF = 1LL << 60; using ping = pair<ll, ll>; int main() { ll N; cin >> N; vector<ll> A(N); for (int i = 0; i < N; ++i) cin >> A[i]; ll zero = 0; for (int i = 0; i < N; i++) { if (A[i] ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; const long long INF = 1LL << 60; using ping = pair<ll, ll>; int main() { ll N; cin >> N; vector<ll> A(N); for (int i = 0; i < N; ++i) cin >> A[i]; ll zero = 0; for (int i = 0; i < N; i++) { if (A[i] ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
191
n=int(input()) array=list(map(int,input().split())) ans=1 if '0' in array: ans=0 else: for i in range(n): if ans>10**18: break else: ans=ans*array[i] if ans>10**18: print(-1) else: print(ans)
n=int(input()) array=list(map(int,input().split())) ans=1 if 0 in array: ans=0 else: for i in range(n): if ans>10**18: break else: ans=ans*array[i] if ans>10**18: print(-1) else: print(ans)
[["-", 0, 656, 0, 57, 15, 666, 0, 557, 0, 654], ["-", 0, 656, 0, 57, 15, 666, 0, 557, 0, 655]]
5
84
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<long long> A(N); for (int i = 0; i < N; i++) { cin >> A[i]; if (A[i] == 0) { cout << 0 << endl; return 0; } } long long maxn = 1000000000000000000; long long ans = 1; for (int i = 0; i < N; i++...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<long long> A(N); for (int i = 0; i < N; i++) { cin >> A[i]; if (A[i] == 0) { cout << 0 << endl; return 0; } } long long maxn = 1000000000000000000; long long ans = 1; for (int i = 0; i < N; i++...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 48], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
141
# # author Sidratul # from math import prod if __name__ == '__main__': n = input() a = list(map(int, input().split(' '))) s = 1 x = True for i in range(len(a)): s = s * a[i] if s > 10**18: print(-1) x = False break if x: print(s)
# # author Sidratul # from math import prod if __name__ == '__main__': n = input() a = list(map(int, input().split(' '))) s = 1 a.sort() x = True for i in range(len(a)): s = s * a[i] if s > 10**18: print(-1) x = False break if x: ...
[["+", 64, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
87
n=int(input()) L=list(map(int,input().split())) ans=1 for i in range(n): ans=ans*L[i] if ans>pow(10,18): print(-1) exit() print(ans)
n=int(input()) L=list(map(int,input().split())) L.sort() ans=1 for i in range(n): ans=ans*L[i] if ans>pow(10,18): print(-1) exit() print(ans)
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
66
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define pb push_back #define f first #define s second #define lb lower_bound #define ub upper_bound typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pi; typedef...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define pb push_back #define f first #define s second #define lb lower_bound #define ub upper_bound typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pi; typedef...
[["+", 15, 339, 51, 16, 31, 16, 31, 2, 63, 22], ["+", 51, 16, 31, 16, 31, 2, 3, 4, 0, 24], ["+", 51, 16, 31, 16, 31, 2, 3, 4, 0, 25]]
1
228
N = int(input()) A = list(map(int,input().split())) ans = 1 for i in range(N): ans *= A[i] if ans >= 10**18: ans = -1 break if 0 in A: print(0) else: print(ans)
N = int(input()) A = list(map(int,input().split())) ans = 1 for i in range(N): ans *= A[i] if ans > 10**18: ans = -1 break if 0 in A: print(0) else: print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
69
n = int(input()) a = [int(i) for i in input().split()] cnt = 1 for ai in a: cnt *= ai if cnt > 10 ** 18: print(-1) exit() print(cnt)
n = int(input()) a = sorted([int(i) for i in input().split()]) cnt = 1 for ai in a: cnt *= ai if cnt > 10 ** 18: print(-1) exit() print(cnt)
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
56
<?php $input = fgets(STDIN); $multi = array_map('intval', explode(' ',fgets(STDIN))); $sum = true; for ($i = 0; $i < $input; $i++) { (int)$sum *= $nums[$i]; } $limit = pow(10,18); if($sum>$limit) { echo -1; } else { echo (int)$sum; }
<?php $input = fgets(STDIN); $multi = array_map('intval', explode(' ',fgets(STDIN))); $sum = true; for ($i = 0; $i < $input; $i++) { (int)$sum *= $multi[$i]; } $limit = pow(10,18); if($sum>$limit) { echo -1; } else { echo (int)$sum; }
[["-", 0, 1, 0, 564, 12, 69, 0, 606, 0, 141], ["+", 0, 1, 0, 564, 12, 69, 0, 606, 0, 141]]
6
102
n = int(input()) arr = list(map(int,input().split())) res = 1 flag = 1 inf = int(1e18) for i in range(n): res = res*arr[i] if(res > inf): flag = 0 break if(flag == 0): print(-1) else: print(res)
n = int(input()) arr = list(map(int,input().split())) res = 1 flag = 1 arr.sort() inf = int(1e18) for i in range(n): res = res*arr[i] if(res > inf): flag = 0 break if(flag == 0): print(-1) else: print(res)
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
82
#b問題 n=int(input()) ans=1 a=list(int(y) for y in input().split()) # print(a) if 0 in a: print(0) else: for i in range(n): ans*=a[i] if ans>10**18: ans=-1 print(ans)
#b問題 n=int(input()) ans=1 a=list(int(y) for y in input().split()) # print(a) if 0 in a: print(0) else: for i in range(n): ans*=a[i] if ans>10**18: ans=-1 break print(ans)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
72
#include <bits/stdc++.h> using namespace std; #define fast_io \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); int main() { ...
#include <bits/stdc++.h> using namespace std; #define fast_io \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); int main() { ...
[["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13]]
1
138
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = 1LL << 60; int main() { int n; cin >> n; vector<ll> a(n); ll ans = 1; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) ans = 0; } if (ans != 0) { for (int i = 0; i < n; i++) { if (a[i] > 1e...
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = 1LL << 60; int main() { int n; cin >> n; vector<ll> a(n); ll ans = 1; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) ans = 0; } if (ans != 0) { for (int i = 0; i < n; i++) { if (a[i] > (l...
[["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 24], ["+", 51, 16, 12, 16, 31, 74, 39, 77, 39, 78], ["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 25]]
1
145
#define _GLIBCXX_DEBUG #include <cstdint> #include <iostream> #include <vector> using namespace std; using i64 = int64_t; using vi = vector<i64>; int main(void) { int n; cin >> n; vi a(n); for (i64 &x : a) { cin >> x; if (x == 0) { cout << 0 << '\n'; return 0; } } i64 p = 1; for (...
#define _GLIBCXX_DEBUG #include <cstdint> #include <iostream> #include <vector> using namespace std; using i64 = int64_t; using vi = vector<i64>; int main(void) { int n; cin >> n; vi a(n); for (i64 &x : a) { cin >> x; if (x == 0) { cout << 0 << '\n'; return 0; } } i64 p = 1; for (...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
130
#include <algorithm> #include <cmath> #include <iostream> #include <sstream> #include <string> using namespace std; int main() { int a, over = 0; long long int total = 1; cin >> a; for (int k = 0; k < a; k++) { long long int b; cin >> b; if (total > 1000000000000000000ll / b) { over++; } ...
#include <algorithm> #include <cmath> #include <iostream> #include <sstream> #include <string> using namespace std; int main() { int a, over = 0; long long int total = 1; cin >> a; for (int k = 0; k < a; k++) { long long int b; cin >> b; if (b != 0 && total > 1000000000000000000ll / b) { over...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
118
N = int(input()) A = list(input().split()) A = sorted(A) result = 1 max = 10**18 for a in A: result *= a if result > max: print(-1) break else: print(result)
N = int(input()) A = list(map(int, input().split())) A = sorted(A) result=1 max=10**18 for a in A: result *= a if result>max: print(-1) break else: print(result)
[["+", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
59
N = int(input()) A = sorted(list(map(int, input().split())), reverse=True) x = 1 for i in A: if A[-1] == 0: print(0) exit() else: x = x * i if x > 10 ** 18: print(-1) print(x)
# ABC169 # B Multiplication 2 N = int(input()) A = sorted(list(map(int, input().split())), reverse=True) x = 1 for i in A: if A[-1] == 0: print(0) exit() else: x = x * i if x > 10 ** 18: print(-1) exit() print(x)
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
79
#include <math.h> #include <stdio.h> int main() { long N, A[100000], result = 1, flag = 1; scanf("%ld", &N); for (int i = 0; i < N; i++) { scanf("%ld", &A[i]); if (A[i] == 0) { printf("0"); return 0; } if (1 > (long)1e18 / result * A[i]) { flag = 0; } else result = res...
#include <math.h> #include <stdio.h> int main() { long N, A[100000], result = 1, flag = 1; scanf("%ld", &N); for (int i = 0; i < N; i++) { scanf("%ld", &A[i]); if (A[i] == 0) { printf("0"); return 0; } if (1 > (long)1e18 / result / A[i]) { flag = 0; } else result = res...
[["-", 0, 57, 15, 23, 0, 16, 12, 16, 17, 48], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 85]]
0
145
def main(): x = int(input()) list1 = list(map(int, input().split(" "))) result = 1 if 0 in list1: print(0) return for i in list1: result *= i if result > 10*18: print("-1") exit() print(result) main()
def main(): x = int(input()) list1 = list(map(int, input().split(" "))) result = 1 if 0 in list1: print(0) return for i in list1: result *= i if result > 1000000000000000000: print("-1") exit() print(result) main()
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 31, 612], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 48], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]]
5
77
N = int(input()) A_list = list(map(int,input().split())) output = 1 flug = 0 if 0 in A_list: print(0) flug = 1 for i in range(N): output *= A_list[i] if (output > 10 ** 18): print(-1) flug = 1 break if(flug != 1): print(output)
N = int(input()) A_list = list(map(int,input().split())) output = 1 flug = 0 if 0 in A_list: print(0) flug = 1 if flug != 1: for i in range(N): output *= A_list[i] if (output > 10 ** 18): print(-1) flug = 1 break if(flug != 1): print(output)
[["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 79], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 102]]
5
86
N = int(input()) A = list(map(int, input().split())) R=1 if 0 in A: print("0") else: for i in range(0, N): R=R*A[i] if R>1000000000000000000: print("-1") exit() else: print(R)
N = int(input()) A = list(map(int, input().split())) R=1 if 0 in A: print("0") else: for i in range(0, N): R=R*A[i] if R>1000000000000000000: print("-1") exit() print(R)
[["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102]]
5
79
input() ls = list(map(int, input().split(' '))) if ls.count(0) > 0: print(0) else: result = 1 for i in ls: result *= i if result > 10 ** 18: print(-1) break print(result)
input() ls = list(map(int, input().split(' '))) if ls.count(0) > 0: result = 0 else: result = 1 for i in ls: result *= i if result > 10 ** 18: result = -1 break print(result)
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
67
input() A = map(int, input().split()) ans = 1 if 0 in A: print(0) exit() for a in A: ans *= a if 1000000000000000000 < ans: print(-1) exit() print(ans)
input() A = list(map(int, input().split())) ans = 1 if 0 in A: print(0) exit() for a in A: ans *= a if 1000000000000000000 < ans: print(-1) exit() print(ans)
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
57
a = int(input()) b = list(map(int, input().split())) c = 1 e = 0 for d in range(a): c = c * b[0] b.pop(0) if c > 1000000000000000000: print(-1) e = 1 break if e == 0: print(c)
a = int(input()) b = list(map(int, input().split())) b.sort() c = 1 e = 0 for d in range(a): c = c * b[0] b.pop(0) if c > 1000000000000000000: print(-1) e = 1 break if e == 0: print(c)
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
76
n = int(input()) a = list(map(int, input().split())) ans = 1 if 0 in a: print(-1) exit() for i in range(len(a)): ans *= a[i] if ans > 10**18: print(-1) exit() print(ans)
n = int(input()) a = list(map(int, input().split())) ans = 1 if 0 in a: print(0) exit() for i in range(len(a)): ans *= a[i] if ans > 10**18: print(-1) exit() print(ans)
[["-", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["-", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
77
import sys n = int(input()) a = list(map(int, input().split())) if a.index(0): print(0) sys.exit() hg = 10 ** 18 ans = 1 for i in a: ans *= i if ans > hg: print(-1) sys.exit() print(ans)
import sys n = int(input()) a = list(map(int, input().split())) if 0 in a: print(0) sys.exit() hg = 10 ** 18 ans = 1 for i in a: ans *= i if ans > hg: print(-1) sys.exit() print(ans)
[["-", 0, 656, 0, 57, 15, 652, 63, 319, 500, 22], ["-", 0, 656, 0, 57, 15, 652, 63, 319, 0, 131], ["-", 0, 656, 0, 57, 15, 652, 63, 319, 319, 22], ["-", 0, 656, 0, 57, 15, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 57, 15, 652, 3, 4, 0, 25], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 267], ["+", 36, 36, 0, 656, 0, 57, 15, 666...
5
79
//インクルード(アルファベット順) #include <algorithm> //sort,二分探索,など #include <bitset> //固定長bit集合 #include <chrono> //実行時間計測 #include <cmath> //pow,logなど #include <complex> //複素数 #include <deque> //両端アクセスのキュー #include <functional> //sortのgreater #include <iomanip> //setprecision(浮動小数点...
//インクルード(アルファベット順) #include <algorithm> //sort,二分探索,など #include <bitset> //固定長bit集合 #include <chrono> //実行時間計測 #include <cmath> //pow,logなど #include <complex> //複素数 #include <deque> //両端アクセスのキュー #include <functional> //sortのgreater #include <iomanip> //setprecision(浮動小数点...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
418
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author apurba_debnath */ #include <bits/stdc++.h> #define ll long long #define DEBUG(x) cout << '>' << #x << ':' << x << endl using namespace std; class BMultiplication2 { public: void solve(std::istream &in, std::ostrea...
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author apurba_debnath */ #include <bits/stdc++.h> #define ll long long #define DEBUG(x) cout << '>' << #x << ':' << x << endl using namespace std; class BMultiplication2 { public: void solve(std::istream &in, std::ostrea...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
215
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(n); bool isZero = false; for (int i = 0; i < n; i++) { cin >> v[i]; if (v[i] == 0) isZero = true; } if (isZero) cout << 0 << endl; else { int64_t ans = v[0]; for (int i = 1; i < n; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<long long> v(n); bool isZero = false; for (int i = 0; i < n; i++) { cin >> v[i]; if (v[i] == 0) isZero = true; } if (isZero) cout << 0 << endl; else { int64_t ans = v[0]; for (int i = 1; i < n; i...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96]]
1
141
#include <algorithm> #include <iostream> #include <map> #include <stdio.h> #include <vector> using namespace std; int main() { int n; cin >> n; long long int a; long long int sum = 0; bool noadd = false; for (int i = 0; i < n; i++) { cin >> a; if (a == 0) { cout << "0" << endl; return ...
#include <algorithm> #include <iostream> #include <map> #include <stdio.h> #include <vector> using namespace std; int main() { int n; cin >> n; long long int a; long long int sum = 0; bool noadd = false; for (int i = 0; i < n; i++) { cin >> a; if (a == 0) { cout << "0" << endl; return ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
176
#include <iostream> using namespace std; int main() { long long int n; cin >> n; long long int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } long long int res = 1; int check = 0; for (int i = 0; i < n; i++) { if (arr[i] == 0) { check = 1; break; } } if (check == 1)...
#include <iostream> using namespace std; int main() { long long int n; cin >> n; long long int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } long long int res = 1; int check = 0; for (int i = 0; i < n; i++) { if (arr[i] == 0) { check = 1; break; } } if (check == 1)...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 13]]
1
181
import sys N = int(input()) A = map(int, input().split()) if 0 in A: print(0) sys.exit() result = 1 for a in A: result *= a if (result > 10 ** 18): print(-1) sys.exit() print(result)
import sys N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) sys.exit() result = 1 for a in list(A): result *= a if (result > 10 ** 18): print(-1) sys.exit() print(result)
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 25]]
5
72
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define endl "\n" typedef long long ll; const double pi = 3.14159265358979323846; int ctoi(const char c) { if ('0' <= c && c <= '9') return (c - '0'); return -1; } vector<int> input(int n) { vector<int> vec(n); ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define endl "\n" typedef long long ll; const double pi = 3.14159265358979323846; int ctoi(const char c) { if ('0' <= c && c <= '9') return (c - '0'); return -1; } vector<int> input(int n) { vector<int> vec(n); ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
1,052
n = int(input()) As = list(map(int,input().split())) ans = 1 for i in As: ans *= i ans = min(ans, 10**18 + 1) if ans == 10**18 + 1: print(-1) print(ans)
n = int(input()) As = list(map(int,input().split())) ans = 1 for i in As: ans *= i ans = min(ans, 10**18 + 1) if ans == 10**18 + 1: print(-1) else: print(ans)
[["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102]]
5
66
#include <algorithm> #include <cmath> //sqrt #include <functional> #include <iomanip> //setprecision #include <iostream> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll unsigned long long int main() { auto mul = [](ll x, ll y) { ll inf = pow...
#include <algorithm> #include <cmath> //sqrt #include <functional> #include <iomanip> //setprecision #include <iostream> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll unsigned long long int main() { auto mul = [](ll x, ll y) { ll inf = pow...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
156