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()) a = list(map(int ,input().split())) ans = 1 if 0 in a: print(0) exit() for i in range(n): ans *= a[i] if ans > 10**18: print(-1) print(ans)
n = int(input()) a = list(map(int ,input().split())) ans = 1 if 0 in a: print(0) exit() for i in range(n): ans *= a[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
70
#include <bits/stdc++.h> using namespace std; int main(void) { int n; cin >> n; long long ans = 1; int flag = 0; int flag0 = 0; for (int i = 0; i < n; i++) { long long a; cin >> a; if (a == 0) { flag0 = 1; break; } if (a <= 1000000000000000000 / ans) { ans *= a; }...
#include <bits/stdc++.h> using namespace std; int main(void) { int n; cin >> n; long long ans = 1; int flag = 0; int flag0 = 0; for (int i = 0; i < n; i++) { long long a; cin >> a; if (a == 0) { flag0 = 1; break; } if (a <= 1000000000000000000 / ans) { ans *= a; }...
[["-", 0, 57, 75, 76, 0, 9, 0, 93, 0, 94], ["-", 0, 57, 75, 76, 0, 9, 0, 93, 0, 35]]
1
138
def main(N): A = list(map(int, input().split())) st_A = set(A) if 0 in st_A: print(0) x = 1 else: for a in A: x *= a if x > 10 ** 18: print(-1) exit() else: print(x) if __name__ == '__main__': N ...
def main(N): A = list(map(int, input().split())) st_A = set(A) if 0 in st_A: print(0) else: x = 1 for a in A: x *= a if x > 10 ** 18: print(-1) exit() else: print(x) if __name__ == '__main__': N ...
[["+", 0, 14, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 14, 8, 196, 0, 57, 75, 76, 0, 102], ["-", 0, 14, 8, 196, 0, 57, 75, 76, 0, 95], ["-", 0, 14, 8, 196, 0, 57, 75, 76, 0, 102]]
5
91
_, *A = map(int, input().split()) ans = 1 if 0 in A: ans = 0 else: for a in A: ans *= a if ans > 10 ** 18: ans = -1 break print(ans)
_, *A = map(int, open(0).read().split()) ans = 1 if 0 in A: ans = 0 else: for a in A: ans *= a if ans > 10 ** 18: ans = -1 break print(ans)
[["-", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22], ["+", 63, 319, 500, 652, 63, 319, 500, 652, 63, 22], ["+", 500, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 500, 652, 63, 319, 500, 652, 3, 4, 0, 612], ["+", 500, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["+", 0, 652, 63, 319, 500, 652, 63, 319, 0, 131], ["+", 0, 652, 63, 3...
5
54
#include <bits/stdc++.h> #include <climits> #include <sstream> using namespace std; int main() { int N; cin >> N; long double A[N]; long double sum = 1; for (int i = 0; i < N; i++) { cin >> A[i]; } sort(A, A + N); for (int i = 0; i < N; i++) { if (A[i] == 0) { cout << 0 << endl; r...
#include <bits/stdc++.h> #include <climits> #include <sstream> using namespace std; int main() { int N; cin >> N; long double A[N]; long double sum = 1; for (int i = 0; i < N; i++) { cin >> A[i]; } sort(A, A + N); for (int i = 0; i < N; i++) { if (A[i] == 0) { cout << 0 << endl; r...
[["+", 0, 1, 0, 16, 31, 16, 12, 74, 0, 24], ["+", 31, 16, 12, 74, 39, 77, 39, 86, 0, 96], ["+", 0, 1, 0, 16, 31, 16, 12, 74, 0, 25]]
1
192
#include "bits/stdc++.h" using namespace std; #ifdef LOCAL #include "debug.h" #define input \ freopen("input.txt", "r", stdin); \ freopen("output.txt", "w", stdout); ...
#include "bits/stdc++.h" using namespace std; #ifdef LOCAL #include "debug.h" #define input \ freopen("input.txt", "r", stdin); \ freopen("output.txt", "w", stdout); ...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
175
# -*- coding: utf-8 -*- n = int(input()) a_li = list(map(int, (input().split()))) product = 1 if 0 in a_li: product = 0 else: for i in a_li: product *= i if product > 10**18: product = -1 exit() print(product)
# -*- coding: utf-8 -*- n = int(input()) a_li = list(map(int, (input().split()))) product = 1 if 0 in a_li: product = 0 else: for i in a_li: product *= i if product > 10**18: print(-1) exit() print(product)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 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
67
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int64_t> a(n); for (auto &e : a) cin >> e; if (find(begin(a), end(a), 0) != end(a)) { cout << 0 << endl; return 0; } int64_t ans = 1; for (auto &e : a) { if (ans > (int64_t)(1e18 / e)) { cout << -...
#include <bits/stdc++.h> using namespace std; int main() { int64_t n; cin >> n; vector<int64_t> a(n); for (auto &e : a) cin >> e; if (find(begin(a), end(a), 0) != end(a)) { cout << 0 << endl; return 0; } int64_t ans = 1; for (auto &e : a) { if (ans > (int64_t)1e18 / e) { cout <<...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 15, 339, 51, 16, 12, 74, 51, 23, 0, 24], ["-", 15, 339, 51, 16, 12, 74, 51, 23, 0, 25]]
1
125
n,*a=map(open(0).read().split()) if 0 in a: print(0) exit() s=1 for i in a: s*=i if s>10**18: print(-1) exit() print(s)
n,*a=map(int,open(0).read().split()) if 0 in a: print(0) exit() s=1 for i in a: s*=i if s>10**18: print(-1) exit() print(s)
[["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21]]
5
62
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define pb push_back #define ff first #define ss second #define INF 1999999999 #define MODA 1000000007 #define PI 3.1415926535897932384626433 // cout << fixed << setprecision(2); int main() { // freopen("input.txt", "r", stdin); // freopen("o...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define pb push_back #define ff first #define ss second #define INF 1999999999 #define MODA 1000000007 #define PI 3.1415926535897932384626433 // cout << fixed << setprecision(2); int main() { // freopen("input.txt", "r", stdin); // freopen("o...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 1, 0, 16, 31, 16, 12, 74, 0, 24], ["+", 0, 16, 31, 16, 12, 74, 39, 77, 39, 78], ["+", 0, 1, 0, 16, 31, 16, 12, 74, 0, 25]]
1
213
n = int(input()) a = list(map(int,input().split())) new = 1 if 0 in a: print(0) exit() for i in a: new *= a if new > (10**18): new = -1 break print(new)
n = int(input()) a = list(map(int,input().split())) new = 1 if 0 in a: print(0) exit() for i in a: new *= i if new > (10**18): new = -1 break print(new)
[["-", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22]]
5
66
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; int main() { const int64_t maxx = pow(10, 18); int N; cin >> N; int64_t total = 1; vector<int64_t> A(N); for (int i = 0; i < N; i++) { cin >> A[i]; if (A[i] == 0) { cout << ...
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; int main() { const int64_t maxx = pow(10, 18); int N; cin >> N; int64_t total = 1; vector<int64_t> A(N); for (int i = 0; i < N; i++) { cin >> A[i]; if (A[i] == 0) { cout << ...
[["-", 64, 9, 0, 1, 0, 16, 12, 103, 0, 104], ["-", 64, 9, 0, 1, 0, 16, 12, 103, 0, 125], ["-", 0, 1, 0, 16, 12, 103, 0, 42, 0, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 13]]
1
146
#include "bits/stdc++.h" using namespace std; typedef long long int lint; typedef pair<lint, lint> plint; typedef pair<double long, double long> pld; #define Alint(x) (x).begin(), (x).end() #define SZ(x) ((lint)(x).size()) #define POW2(n) (1ll << (n)) #define FOR(i, begin, end) ...
#include "bits/stdc++.h" using namespace std; typedef long long int lint; typedef pair<lint, lint> plint; typedef pair<double long, double long> pld; #define Alint(x) (x).begin(), (x).end() #define SZ(x) ((lint)(x).size()) #define POW2(n) (1ll << (n)) #define FOR(i, begin, end) ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 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], ["+", 15, 339, 51, 16, 12, 16, 31, 74, 51, 13]]
1
427
import sys n=int(input()) m=list(map(int,input().split())) ans=1 if 0 in m: print(0) sys.exit() for i in range(n): ans=ans*m[i] print(ans) if ans>pow(10,18): print(-1) sys.exit() if ans <=pow(10,18): print(ans)
import sys n=int(input()) m=list(map(int,input().split())) ans=1 if 0 in m: print(0) sys.exit() for i in range(n): ans=ans*m[i] if ans>pow(10,18): print(-1) sys.exit() if ans<=pow(10,18): 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
98
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <functional> #include <iostream> #define mp make_pair #define mt make_tuple #define fi first #define se second #define pb push_back #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <functional> #include <iostream> #define mp make_pair #define mt make_tuple #define fi first #define se second #define pb push_back #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
436
n = int(input()) a= input().split() level = pow(10, 18) product = 1 if 0 in a: print(0) else: for num in range(n): product *= int(a[num]) if product > level: print("-1") break if product <= level: print(product)
n = int(input()) a= input().split() level = pow(10, 18) product = 1 if "0" in a: print(0) else: for num in range(n): product *= int(a[num]) if product > level: print("-1") break if product <= level: print(product)
[["+", 0, 656, 0, 57, 15, 666, 0, 557, 0, 654], ["+", 0, 656, 0, 57, 15, 666, 0, 557, 0, 655]]
5
77
#include <bits/stdc++.h> using namespace std; #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define ll lo...
#include <bits/stdc++.h> using namespace std; #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define ll lo...
[["-", 8, 9, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 70], ["+", 0, 43, 49, 50, 5...
1
389
n = int(input()) a = list(map(int, input().split())) b = [i for i in a if i != 1] ans = 1 if len(b) < 1000: for i in range(len(b)): ans *= a[i] else: ans = 10**18+1 if 0 in b: ans = 0 print(ans if ans <= 10**18 else '-1')
n = int(input()) a = list(map(int, input().split())) b = [i for i in a if i != 1] ans = 1 if len(b) < 100: for i in range(len(b)): ans *= b[i] else: ans = 10**18+1 if 0 in b: ans = 0 print(ans if ans <= 10**18 else '-1')
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["-", 8, 196, 0, 1, 0, 677, 12, 206, 51, 22], ["+", 8, 196, 0, 1, 0, 677, 12, 206, 51, 22]]
5
97
import collections N = int(input()) cNum = collections.Counter(list(map(int, input().split()))) ans = 1 if cNum[0] != 0: print("0") exit() for n in cNum.keys(): ans *= n**cNum[n] if ans > 10**8: ans = -1 break print(ans)
import collections N = int(input()) cNum = collections.Counter(list(map(int, input().split()))) ans = 1 if cNum[0] != 0: print("0") exit() for n in cNum.keys(): ans *= n**cNum[n] if ans > 10**18: ans = -1 break print(ans)
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]]
5
85
#include <bits/stdc++.h> typedef long long int ll; typedef long double ld; using namespace std; const long long int INF = 1e18; const long long int mod = 1e9 + 7; typedef pair<ll, ll> pairs; typedef vector<pairs> p; struct Edge { ll to, weight; Edge(ll t, ll w) : to(t), weight(w) {} }; using graph = vector<vector...
#include <bits/stdc++.h> typedef long long int ll; typedef long double ld; using namespace std; const long long int INF = 1e18; const long long int mod = 1e9 + 7; typedef pair<ll, ll> pairs; typedef vector<pairs> p; struct Edge { ll to, weight; Edge(ll t, ll w) : to(t), weight(w) {} }; using graph = vector<vector...
[["-", 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
411
n = int(raw_input()) lst = list(map(int, raw_input().strip().split()))[:n] mx = 1000000000000000000 if 0 in lst: print(0) else: cur = lst[0] for x in lst[1:]: cur = cur * x if cur > mx: cur = -1 break print(cur)
n = int(input()) lst = list(map(int, input().strip().split()))[:n] mx = 1000000000000000000 if 0 in lst: print(0) else: cur = lst[0] for x in lst[1:]: cur = cur * x if cur > mx: cur = -1 break print(cur)
[["-", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["-", 63, 319, 500, 652, 63, 319, 500, 652, 63, 22], ["+", 63, 319, 500, 652, 63, 319, 500, 652, 63, 22]]
5
81
#include <bits/stdc++.h> using namespace std; #define PII pair<int, int> #define VI vector<int> #define VPII vector<PII> #define LL long long #define LD long double #define f first #define s second #define MP make_pair #define PB push_back #define endl '\n' #define ALL(c) (c).begin(), (c).end() #define SIZ(c) (int)(c)....
#include <bits/stdc++.h> using namespace std; #define PII pair<int, int> #define VI vector<int> #define VPII vector<PII> #define LL long long #define LD long double #define f first #define s second #define MP make_pair #define PB push_back #define endl '\n' #define ALL(c) (c).begin(), (c).end() #define SIZ(c) (int)(c)....
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
459
def fun(A): for i in A: if i == 0: return -1 ans = 1 for i in A: ans = ans*i if(ans > 1000000000000000000): return -1 return ans N = int(input()) A = list(map(int, input().split())) print(fun(A))
def fun(A): for i in A: if i == 0: return 0 ans = 1 for i in A: ans = ans*i if(ans > 1000000000000000000): return -1 return ans N = int(input()) A = list(map(int, input().split())) print(fun(A))
[["-", 0, 57, 64, 196, 0, 37, 0, 664, 17, 33], ["-", 0, 57, 64, 196, 0, 37, 0, 664, 28, 612], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 612]]
5
76
n=int(input()) l=list(map(int,input().split())) z,flag=1,0 m=10**18 mi=min(l) if mi==0: print(0) else: for i in l: z*=i print(z) if z>m: flag=1 break if flag==1: print(-1) else: print(z)
n=int(input()) l=list(map(int,input().split())) z,flag=1,0 m=10**18 mi=min(l) if mi==0: print(0) else: for i in l: z*=i if z>m: flag=1 break if flag==1: print(-1) else: print(z)
[["-", 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
91
n = int(input()) a = [int(x) for x in input().split()] otv = 1 for x in a: otv *= x if otv > 10**18: print(-1) exit(0) print(otv)
n = int(input()) a = [int(x) for x in input().split()] otv = 1 for x in sorted(a): otv *= x if otv > 10**18: print(-1) exit(0) print(otv)
[["+", 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
57
#include <stdio.h> #include <stdlib.h> #define MAX 1000000000000000000 int main(void) { int n, i, *a; long m = 1; scanf("%d", &n); a = malloc(n * sizeof(int)); for (i = 0; i < n; i++) { scanf("%d", a + i); if (a[i] == 0) { printf("0\n"); return 0; } } for (i = 0; i < n; i++) { ...
#include <stdio.h> #include <stdlib.h> #define MAX 1000000000000000000 int main(void) { int n, i; long *a; long m = 1; scanf("%d", &n); a = malloc(n * sizeof(long)); for (i = 0; i < n; i++) { scanf("%ld", a + i); if (a[i] == 0) { printf("0\n"); return 0; } } for (i = 0; i < n; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 3, 4, 0, 16, 12, 105, 39, 77, 39, 40], ["+", 0, 16, 12, 105, 39, 77, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
156
def multiplyList(myList) : # Multiply elements one by one result = 1 for x in myList: result = result * x if result == 0: return 0 if result > 10**18: return -1 return result n = int(input()) l = list(map(int, input().split())) res = multi...
def multiplyList(myList) : # Multiply elements one by one result = 1 for x in myList: result = result * x if result == 0: return 0 if result > 10**18: return -1 return result n = int(input()) l = list(map(int, input().split())) l.sort() 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
74
#include <bits/stdc++.h> using namespace std; using ll = long long; using VI = vector<ll>; using VVI = vector<VI>; using P = pair<ll, ll>; int main() { ll n, a; ll tmp = 1; double tmp2 = 1; cin >> n; for (int i = 0; i < n; i++) { cin >> a; tmp *= a; tmp2 = tmp2 * (double)a; } if (tmp2 > 1...
#include <bits/stdc++.h> using namespace std; using ll = long long; using VI = vector<ll>; using VVI = vector<VI>; using P = pair<ll, ll>; int main() { ll n, a; ll tmp = 1; double tmp2 = 1; cin >> n; for (int i = 0; i < n; i++) { cin >> a; tmp *= a; tmp2 = tmp2 * (double)a; } if (tmp2 > 1...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 15, 339, 51, 16, 12, 16, 12, 74, 0, 24], ["+", 51, 16, 12, 16, 12, 74, 39, 77, 39, 78], ["+", 15, 339, 51, 16, 12, 16, 12, 74, 0, 25], ["+", 15, 339, 51, 16, 12, 16, 12, 74...
1
122
N = int(input()) A = list(map(int, input().split())) ans = 1 keta = 0 if 0 in A: print(0) exit() for x in A: ans *= x keta += len(str(x)) if keta > 20: print(-1) exit() print(ans)
N = int(input()) A = list(map(int, input().split())) ans = 1 keta = 0 if 0 in A: print(0) exit() for x in A: ans *= x keta += len(str(x)) if ans > 1000000000000000000: print(-1) exit() print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]]
5
77
n = int(input()) a = list(map(int,input().split())) ans = a[0] for i in range(n): if i == 0: print(0) exit() for i in range(1, n): ans = ans * a[i] if ans > 10**18: print(-1) exit() print(ans)
n = int(input()) a = list(map(int,input().split())) ans = a[0] for i in range(n): if a[i] == 0: print(0) exit() for i in range(1, n): ans = ans * a[i] if ans > 10**18: print(-1) exit() print(ans)
[["+", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 70], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 73]]
5
88
N = int(input()) temp = input() temp = temp.split(" ") arr = [] prod=1 for i in range(N): arr.append(int(temp[i])) flag=0 for i in range(N): prod = prod*arr[i] if prod>1000000000000000000: flag=1 break if flag==0: print(prod) else: print(-1)
N = int(input()) temp = input() temp = temp.split(" ") arr = [] prod=1 for i in range(N): arr.append(int(temp[i])) arr.sort() flag=0 for i in range(N): prod = prod*arr[i] if prod>1000000000000000000: flag=1 break if flag==0: print(prod) else: print(-1)
[["+", 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
94
N = int(input()) A = list(map(int, input().split())) ans = 1 for i in range (0, N): if A[i] == 0: ans = 0 break else: ans *= A[i] if ans > 10 ** 18: ans = -1 break print(ans)
N = int(input()) A = list(map(int, input().split())) ans = 1 for i in range (0, N): if A[i] == 0: ans = 0 break else: if ans > 0: ans *= A[i] if ans > 10 ** 18: ans = -1 print(ans)
[["+", 0, 57, 75, 76, 8, 196, 0, 57, 0, 121], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 57, 75, 76, 8, 196, 0, 57, 0, 102], ["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
74
import math import sys import functools import operator n = int(input()) a = list(map(int, input().split())) ans = 1 INF = 1000000000000000000 if (0 in a): print(-1) sys.exit() for i in a: ans *= i if(ans > INF): print(-1) sys.exit() print(ans)
import math import sys import functools import operator n = int(input()) a = list(map(int, input().split())) ans = 1 INF = 1000000000000000000 if (0 in a): print(0) sys.exit() for i in a: ans *= i if(ans > INF): print(-1) sys.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
85
N = int(input()) A = list(map(int, input().split())) A = sorted(A,reverse=True) B = 1 if 0 in A: print(0) quit() else: for i in A: B = B*i if B>= 10**18: print(-1) quit() print(B)
N = int(input()) A = list(map(int, input().split())) A = sorted(A,reverse=True) B = 1 if 0 in A: print(0) quit() else: for i in A: B *= i if B> 10**18: print(-1) quit() print(B)
[["-", 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], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
81
#include <algorithm> #include <chrono> #include <cmath> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define pb push_back #define make ...
#include <algorithm> #include <chrono> #include <cmath> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define pb push_back #define make ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
484
#include <bits/stdc++.h> using namespace std; int main() { double ans = 1; int n; cin >> n; double a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; // ans=ans*a; } sort(a, a + n); for (int i = 0; i < n; i++) { // cin>>a[i]; ans = ans * a[i]; if (ans == 0) { cout << 0; ...
#include <bits/stdc++.h> using namespace std; int main() { long double ans = 1; int n; cin >> n; long double a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; // ans=ans*a; } sort(a, a + n); for (int i = 0; i < n; i++) { // cin>>a[i]; ans = ans * a[i]; if (ans == 0) { cout ...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
131
N=int(input()) X=list(map(int,input().split())) result=1 for i in X: result*=i if result>10**18: result=-1 for i in X: if i==0:result=0 print(result)
N=int(input()) X=list(map(int,input().split())) result=1 for i in X: result*=i if result>10**18: result=-1 break for i in X: if i==0:result=0 print(result)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
64
#include <ctype.h> #include <inttypes.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int n; long double a[100001] = {0}; int i; long double sum = 1; int count = 0; scanf("%d\n", &n); for (i = 0; i < n; i++) { scanf("%llf", &a[i]); if (a[i] == 0) ...
#include <ctype.h> #include <inttypes.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int n; long double a[100001] = {0}; int i; long double sum = 1; int count = 0; scanf("%d\n", &n); for (i = 0; i < n; i++) { scanf("%llf", &a[i]); if (a[i] == 0) ...
[["-", 3, 4, 0, 74, 39, 77, 39, 86, 39, 40], ["+", 3, 4, 0, 74, 39, 77, 39, 86, 0, 96], ["+", 3, 4, 0, 74, 39, 77, 39, 86, 39, 40]]
0
195
n = int(input()) a = list(map(int, input().split())) ch = 0 for i in a: if(i == 0): print(0) ch1 = 1 break if(not ch): ans = 1 ch2 = 0 for i in a: ans*=i if(ans > int(1e18)): print(-1) ch2 = 1 break if(not ch2): print(ans)
n = int(input()) a = list(map(int, input().split())) ch1 = 0 for i in a: if(i == 0): print(0) ch1 = 1 break if(not ch1): ans = 1 ch2 = 0 for i in a: ans*=i if(ans > int(1e18)): print(-1) ch2 = 1 break if(not ch2): print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 0, 656, 0, 57, 15, 23, 0, 681, 28, 22], ["+", 0, 656, 0, 57, 15, 23, 0, 681, 28, 22]]
5
97
#include <stdio.h> #include <stdlib.h> int main(void) { int N, i, d = 0, e = 0; unsigned long long total = 1, a; scanf("%d", &N); for (i = 0; i < N; i++) { scanf("%lld", &a); if (a == 0) { total = 0; e = 1; } if (d == 0 && e == 0) { if (9000000000000000000 / llabs(total) >= ll...
#include <stdio.h> #include <stdlib.h> int main(void) { int N, i, d = 0, e = 0; unsigned long long total = 1, a; scanf("%d", &N); for (i = 0; i < N; i++) { scanf("%lld", &a); if (a == 0) { total = 0; e = 1; d = 0; } if (d == 0 && e == 0) { if (9000000000000000000 / llabs...
[["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
157
n = int(input()) ans = 1 nums = list(map(lambda x : int(x),input().split())) for i in range(n): if nums[i] == 0: ans = 0 else: for k in range(n): ans *= nums[k] if ans > 10**18: ans = -1 break print(ans)
n = int(input()) ans = 1 nums = list(map(lambda x : int(x),input().split())) for i in range(n): if nums[i] == 0: ans = 0 break for k in range(n): ans *= nums[k] if ans > 10**18: ans = -1 break print(ans)
[["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
85
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<long long> V(n); for (int i = 0; i < n; i++) cin >> V[i]; long long product = 1; long long val = 1e18; sort(V.begin(), V.end()); for (int i = 0; i < n; i++) { if (product == 0) { cout << 0; return 0; ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<long long> V(n); for (int i = 0; i < n; i++) cin >> V[i]; long long product = 1; long long val = 1e18; sort(V.begin(), V.end()); for (int i = 0; i < n; i++) { if (V[i] == 0) { cout << 0; return 0; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73]]
1
142
N = int(input()) As = list(map(int, input().split())) if 0 in As: print("0") exit() pi = 1 for A in As: pi*=A if pi>10^18: print("-1") exit() print(str(pi))
N = int(input()) As = list(map(int, input().split())) if 0 in As: print("0") exit() pi = 1 for A in As: pi*=A if pi>1000000000000000000: print("-1") exit() print(str(pi))
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 31, 612], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 140], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]]
5
73
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int64_t> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { cout << 0 << endl; return 0; } } uint64_t ans = 1; uint64_t k = (uin...
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int64_t> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { cout << 0 << endl; return 0; } } uint64_t ans = 1; uint64_t k = (uin...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
172
#include <bits/stdc++.h> using namespace std; #define MOD 1000000000000000000 int main() { int n; cin >> n; long long int a[n]; long long int prod = 1; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); for (int i = 0; i < n; ++i) { if (a[i] == 0) { prod = 0; break; } ...
#include <bits/stdc++.h> using namespace std; #define MOD 1000000000000000000 int main() { int n; cin >> n; long long int a[n]; long long int prod = 1; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); for (int i = 0; i < n; ++i) { if (a[i] == 0) { prod = 0; break; } ...
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47]]
1
138
# import numpy as np # import math # import copy # from collections import deque import sys input = sys.stdin.readline # sys.setrecursionlimit(10000) # from numba import njit def main(): N = int(input()) A = list(map(int,input().split())) Aset = set(A) if 0 in Aset: print(0) sys.exit...
# import numpy as np # import math # import copy # from collections import deque import sys input = sys.stdin.readline # sys.setrecursionlimit(10000) # from numba import njit def main(): N = int(input()) A = list(map(int,input().split())) Aset = set(A) if 0 in Aset: print(0) sys.exit...
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
111
#include <algorithm> #include <cmath> #include <cstdlib> #include <functional> #include <iomanip> #include <iostream> #include <math.h> #include <numeric> #include <string> #include <vector> #define ll long long #define PI 3.14159265358979323846 #define rep(i, n) for (ll i = 0; i < (ll)n; i++) using namespace std; int...
#include <algorithm> #include <cmath> #include <cstdlib> #include <functional> #include <iomanip> #include <iostream> #include <math.h> #include <numeric> #include <string> #include <vector> #define ll long long #define PI 3.14159265358979323846 #define rep(i, n) for (ll i = 0; i < (ll)n; i++) using namespace std; int...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
200
n = int(input()) An = list(map(int, input().split())) An.sort(reverse=True) ans = An[0] for i in range(1,n): if An[i] == 0: ans = 0 break if An[i] > (10 ** 18): ans = -1 break; if ans > 0: ans = An[0] for i in range(1,n): if An[i] > (10 ** 18): ans = -1 break ans *= An[i] ...
n = int(input()) An = list(map(int, input().split())) An.sort(reverse=True) ans = An[0] for i in range(1,n): if An[i] == 0: ans = 0 break if An[i] > (10 ** 18): ans = -1 break; if ans > 0: ans = An[0] for i in range(1,n): if An[i] > (10 ** 18): ans = -1 break ans *= An[i] ...
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
143
n = int(input()) A = list(map(int, input().split())) ans = 1 flag = True if 0 in A: print(0) flag = False for i in range(n): ans *= A[i] if ans > 10**18: print(-1) flag = False break if flag: print(ans)
n = int(input()) A = list(map(int, input().split())) ans = 1 flag = True if 0 in A: print(0) flag = False if flag: for i in range(n): ans *= A[i] if ans > 10**18: print(-1) flag = False break if flag: print(ans)
[["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 36, 36, 36, 36, 0, 656, 0, 57, 15, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 102]]
5
80
n = int(input()) res = 1 a = list(map(int, input().split())) for i in a: res *= i if (res > 1000000000000000000): res = -1 break if res == -1: for i in a: if a == 0: res = 0 break print(res)
n = int(input()) res = 1 a = list(map(int, input().split())) for i in a: res *= i if (res > 1000000000000000000): res = -1 break if res == -1: for i in a: if i == 0: res = 0 break print(res)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]]
5
72
n = int(input()) a = map(int, input().split()) over = False mul = 1 if 0 in a: mul = 0 for a_ in a: mul *= a_ if mul > 10**18: mul = -1 break print(mul)
n = int(input()) a = list(map(int, input().split())) over = False mul = 1 if 0 in a: mul = 0 for a_ in a: mul *= a_ if mul > 10**18: mul = -1 break print(mul)
[["+", 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
60
#include <bits/stdc++.h> #define int long long #define uint unsigned int #define ld long double #define showoff \ ios::sync_with_stdio(false); \ cin.tie(0); ...
#include <bits/stdc++.h> #define int long long #define uint unsigned int #define ld long double #define showoff \ ios::sync_with_stdio(false); \ cin.tie(0); ...
[["-", 15, 339, 51, 91, 28, 69, 341, 342, 0, 13], ["+", 15, 339, 51, 91, 28, 69, 341, 342, 0, 13]]
1
387
n = int(input()) a = [int(i) for i in input().split(' ')] if a[0] == 0: print(0) else: x = 1 for i in a: x = x * i if x > 10**18: print(-1) break else: print(x)
n = int(input()) a = [int(i) for i in input().split(' ')] a = sorted(a) if a[0] == 0: print(0) else: x = 1 for i in a: x = x * i if x > 10**18: print(-1) break else: print(x)
[["+", 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
75
n = int(input()) a = list(map(int, input().split())) ans = 1 zero = 0 for i in range(n): if a[i] == 0: zero += 1 if zero > 0: print(-1) exit(0) for i in range(n): ans *= a[i] if ans > 1e+18: print(-1) exit(0) print(ans)
n = int(input()) a = list(map(int, input().split())) ans = 1 zero = 0 for i in range(n): if a[i] == 0: zero += 1 if zero > 0: print(0) exit(0) for i in range(n): ans *= a[i] if ans > 1e+18: print(-1) exit(0) 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
96
#include <algorithm> #include <assert.h> #include <bitset> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #defin...
#include <algorithm> #include <assert.h> #include <bitset> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #defin...
[["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 24], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 17, 85], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 25]]
1
169
N = int(input()) a = [int(i) for i in input().split(" ")] res=1 xx=10**18 f=0 for i in a: res*=i if res>xx: f=1 print(-1) break if f==0: print(res)
N = int(input()) a = [int(i) for i in input().split(" ")] res=1 xx=10**18 f=0 a.sort() for i in a: res*=i if res>xx: f=1 print(-1) break if f==0: 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
71
import sys n = int(input()) l = list(map(int,input().split())) ##print(n) ##print(l) x = l[0] if 0 in l: print(-1) sys.exit() for i in range(1,n): ##print(i) ##print(l[i]) x *= l[i] if x >+ 1000000000000000000: ##print(i) ##print(x) print(-1) sys.exit() print(x)
import sys n = int(input()) l = list(map(int,input().split())) ##print(n) ##print(l) x = l[0] if 0 in l: print(0) sys.exit() for i in range(1,n): ##print(i) ##print(l[i]) x *= l[i] if x >+ 1000000000000000000: ##print(i) ##print(x) print(-1) sys.exit() print(x)
[["-", 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
90
n = int(input()) x = list(map(int, input().split())) a = 1 if 0 in x: print(0) else: for i in x: a *= i if a > pow(10,18): print(-1) else: print(a)
n = int(input()) x = list(map(int, input().split())) a = 1 if 0 in x: print(0) else: for i in x: a *= i if a > pow(10,18): print(-1) break else: print(a)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
68
#include <bits/stdc++.h> using namespace std; int main() { long long int n, res = 1, i; cin >> n; long long int a[n]; for (i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { res = 0; } else if (res > (1000000000000000000LL / a[i])) { res = -1; } else if (res != -1 || res != 0) { ...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, res = 1, i; cin >> n; long long int a[n]; for (i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { res = 0; } else if (res > (1000000000000000000LL / a[i])) { res = -1; } else if (res != -1) { res *...
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 106], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
123
n = int(input()) MAX_NUM = 10 ** 18 nums = map(int, input().split()) for num in nums: if num == 0: print(0) exit() ans = 1 for num in nums: ans *= num if ans > MAX_NUM: print(-1) exit() print(ans)
n = int(input()) MAX_NUM = 10 ** 18 nums = list(map(int, input().split())) for num in nums: if num == 0: print(0) exit() ans = 1 for num in nums: ans *= num if ans > MAX_NUM: 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
72
import java.io.PrintWriter; import java.math.BigDecimal; import java.util.*; public class Main { void run() { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = sc.nextInt(); long[] arr = new long[n]; BigDecimal bd = new BigDecimal(1); for (int i =...
import java.io.PrintWriter; import java.math.BigDecimal; import java.util.*; public class Main { void run() { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = sc.nextInt(); long[] arr = new long[n]; BigDecimal bd = new BigDecimal(1); for (int i =...
[["-", 0, 1, 0, 492, 3, 4, 0, 492, 500, 22], ["+", 0, 1, 0, 492, 3, 4, 0, 492, 500, 22]]
3
262
#include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { unsigned long long n, a[100005] = {}; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { cout << 0 << endl; return 0; } } unsigned long long aMulti = 1; for (int i = 0; i < n; i++) { ...
#include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { unsigned long long n, a[100005] = {}; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { cout << 0 << endl; return 0; } } unsigned long long aMulti = 1; for (int i = 0; i < n; i++) { ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
157
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long s[n + 1]; for (int i = 1; i <= n; i++) { cin >> s[i]; if (s[i] == 0) { cout << 0 << endl; return 0; } } for (int i = 2; i <= n; i++) { if (1e18 / s[i - 1] < s[i]) { cout << -1 << end...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long s[n + 1]; for (int i = 1; i <= n; i++) { cin >> s[i]; if (s[i] == 0) { cout << 0 << endl; return 0; } } for (int i = 2; i <= n; i++) { if (1000000000000000000ll / s[i - 1] < s[i]) { ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13]]
1
139
def main(n, a): for x in a: if(x == 0): print(0) return ans = a[0] for i in range(1, n): ans = ans * a[i] if(ans > 1000000000000000000): print(-1) return print(ans) if(__name__ == '__main__'): n = int(input()) a = map(int, input().split()) main(n, a)
def main(n, a): a = list(a) for x in a: if(x == 0): print(0) return ans = a[0] for i in range(1, n): ans = ans * a[i] if(ans > 1000000000000000000): print(-1) return print(ans) if(__name__ == '__main__'): n = int(input()) a = map(int, input().split()) main(n, a)
[["+", 0, 14, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 8, 196, 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
103
N = int(input()) A = [int(x) for x in input().split()] reg = A[0] flg=True if 0 in A: print(0) flg=False reg=0 for i in range(1, N): reg *= a if reg>10**18: print(-1) flg=False break if flg: print(reg)
N = int(input()) A = [int(x) for x in input().split()] reg = A[0] flg=True if 0 in A: print(0) flg=False reg=0 for i in range(1, N): reg *= A[i] if reg>10**18: print(-1) flg=False break if flg: print(reg)
[["-", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 8, 196, 0, 1, 0, 677, 12, 206, 51, 22], ["+", 8, 196, 0, 1, 0, 677, 12, 206, 0, 70], ["+", 8, 196, 0, 1, 0, 677, 12, 206, 206, 22], ["+", 8, 196, 0, 1, 0, 677, 12, 206, 0, 73]]
5
86
import sys n=int(input()) a = list(map(int,input().split())) ans = 1 a.sort() for i in range(a): ans *= a[i] if ans > 1000000000000000000: print(-1) sys.exit() print(ans)
import sys n=int(input()) a = list(map(int,input().split())) ans = 1 a.sort() for i in range(len(a)): ans *= a[i] if ans > 1000000000000000000: print(-1) sys.exit() print(ans)
[["+", 0, 7, 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, 25]]
5
68
N = int(input()) A = list(map(int,input().split())) B = 1 # print(max(A)) if 0 in A: print(0) elif max(A) > 10**18: print(-1) else: for i in A: B *= i if B > 10 ** 18: print(-1) break print(B)
N = int(input()) A = list(map(int,input().split())) B = 1 # print(max(A)) if 0 in A: print(0) elif max(A) > 10**18: print(-1) else: for i in A: B *= i if B > 10 ** 18: B = -1 break print(B)
[["-", 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
80
n=int(input()) a=list(map(int,input().split())) answer=1 for i in range(n): answer*=a[i] if answer>10**18: answer=-1 if a.count(0)>0: answer=0 print(answer)
n=int(input()) a=list(map(int,input().split())) answer=1 for i in range(n): answer*=a[i] if answer>10**18: answer=-1 break if a.count(0)>0: answer=0 print(answer)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
70
n = int(input()) l = list(map(int, input().split())) cur = 1 if 0 in l: print(0) exit() for i in l: cur *= i if cur >= 1000000000000000000: print(-1) exit() print(cur)
n = int(input()) l = list(map(int, input().split())) cur = 1 if 0 in l: print(0) exit() for i in l: cur *= i if cur > 1000000000000000000: print(-1) exit() print(cur)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
65
N = int(input()) A = [int(i) for i in input().split()] res=1 for x in A: res = res*x if res > 10 ** 18: res = -1 break print(res)
N = int(input()) A = sorted([int(i) for i in input().split()]) res=1 for x in A: res = res*x if res > 10 ** 18: res = -1 break print(res)
[["+", 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
55
import sys n = int(input()) print(n) prod = 1 overflow = False a = list(map(int,input().split())) for aa in a: if prod * aa > 1000000 * 1000000 * 1000000: overflow = True else: prod = prod * aa for aa in a: if aa == 0: overflow = False if overflow: print(-1) else: print(prod)
import sys n = int(input()) #print(n) prod = 1 overflow = False a = list(map(int,input().split())) for aa in a: if prod * aa > 1000000 * 1000000 * 1000000: overflow = True else: prod = prod * aa for aa in a: if aa == 0: overflow = False if overflow: print(-1) else: print(prod)
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
90
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long i, s; vector<long long> a(n); s = 1; for (i = 0; i < n; i++) { cin >> a.at(i); if (a.at(i) == 0) { cout << 0 << endl; return 0; } } for (i = 0; i < n; i++) { if (s * a.at(i) > 1000000...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long i, s; vector<long long> a(n); s = 1; for (i = 0; i < n; i++) { cin >> a.at(i); if (a.at(i) == 0) { cout << 0 << endl; return 0; } } for (i = 0; i < n; i++) { if (a.at(i) > 10000000000...
[["-", 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
140
def m(): N = int(input()) A = list(map(int, input().split())) times = 1 c = 0 for i in A: while times <= 10**18 and c < N: times *= i c += 1 if times > 10 ** 18: times = -1 if 0 in A: times = 0 print(times) m()
def m(): N = int(input()) A = list(map(int, input().split())) times = 1 c = 0 for i in A: if times <= 10**18 and c < N: times *= i c += 1 if times > 10 ** 18: times = -1 if 0 in A: times = 0 print(times) m()
[["-", 8, 196, 0, 7, 8, 196, 0, 52, 0, 89], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121]]
5
84
N = int(input()) A = list(map(int, input().split())) ans = 1 for i in A: ans *= i if ans > 10 ** 18: print('-1') exit() print(ans)
N = int(input()) A = list(map(int, input().split())) A = sorted(A) ans = 1 for i in A: ans *= i if ans > 10 ** 18: print('-1') exit() 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
56
# -*- coding: utf-8 -*- n = gets.to_i a = gets.chomp.split(" ") ans = 1 for i in 0..n-1 x = a[i].to_i ans *= x if ans > 1000000000000000000 puts "-1" exit end end puts ans
# -*- coding: utf-8 -*- n = gets.to_i a = gets.chomp.split(" ") a = a.sort ans = 1 for i in 0..n-1 x = a[i].to_i ans *= x if ans > 1000000000000000000 puts "-1" exit end end puts ans
[["+", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 0, 32], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 486, 22], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22]]
4
53
#include <iostream> #include <vector> using namespace std; const unsigned long long LARGE = 1000000000000000000; int main() { int N; unsigned long long bA; unsigned long long A; cin >> N; bool ansFlag = false; unsigned long long ans = 1; bA = 1; for (int i = 0; i < N; i++) { cin >> A; if (...
#include <iostream> #include <vector> using namespace std; const unsigned long long LARGE = 1000000000000000000; int main() { int N; unsigned long long bA; unsigned long long A; cin >> N; bool ansFlag = false; unsigned long long ans = 1; bA = 1; for (int i = 0; i < N; i++) { cin >> A; if (...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
180
from functools import reduce from operator import mul l = int(input()) x = list(map(int, input().split())) # print(x) # result = reduce(mul, x) result = 1 limit = 10 ** 18 for i in x: if result < limit and i != 0: result = result * i if limit < result: result = -1 print(result)
from functools import reduce from operator import mul l = int(input()) x = list(map(int, input().split())) # print(x) # result = reduce(mul, x) result = 1 limit = 10 ** 18 for i in x: if result < limit or i == 0: result = result * i if limit < result: result = -1 print(result)
[["-", 0, 7, 8, 196, 0, 57, 15, 679, 17, 355], ["+", 0, 7, 8, 196, 0, 57, 15, 679, 17, 354], ["-", 8, 196, 0, 57, 15, 679, 12, 666, 667, 79], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667, 60]]
5
75
n = int(input()) l = list(map(int, input().split())) sol = 1 nula = 0 over = 0 for i in l: if (i == 0): nula = 1 sol = sol * i if sol>1000000000000000000: over = 1 break if (nula == 1): print(0) elif (over == 1): print(-1) else: print(sol)
n = int(input()) l = list(map(int, input().split())) sol = 1 nula = 0 over = 0 for i in l: if (i == 0): nula = 1 sol = sol * i if sol>1000000000000000000: over = 1 sol = 0 if (nula == 1): print(0) elif (over == 1): print(-1) else: print(sol)
[["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612]]
5
92
/* author : Anubhav Dinesh Patel date : 31.05.2020 15:38:05 IST */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long int #define fast_io \ ios_base::sync_with_stdio(false); ...
/* author : Anubhav Dinesh Patel date : 31.05.2020 15:38:05 IST */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long int #define fast_io \ ios_base::sync_with_stdio(false); ...
[["+", 12, 23, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 12, 23, 0, 16, 31, 16, 12, 16, 12, 13]]
1
1,083
#include <algorithm> #include <cmath> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; template <class T> class Input { public: auto operator()() const { T v; c...
#include <algorithm> #include <cmath> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; template <class T> class Input { public: auto operator()() const { T v; c...
[["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
1,114
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define MOD 1000000007 typedef long long ll; typedef pair<ll, ll> P; int main() { ll N; cin >> N; vector<ll> A(N); rep(i, N) { cin >> A[i]; } ll ans = 1; long double g = 1; int flag = 0; rep(i, N) { a...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define MOD 1000000007 typedef long long ll; typedef pair<ll, ll> P; int main() { ll N; cin >> N; vector<ll> A(N); rep(i, N) { cin >> A[i]; } ll ans = 1; long double g = 1; int flag = 0; rep(i, N) { a...
[["+", 0, 14, 8, 9, 0, 14, 8, 9, 0, 46], ["-", 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
143
n = gets.strip.to_i nums = gets.strip.split(" ").map do |i| i.to_i end ans = 1 flag = true ans = 0 if nums.include(0) n.times{|i| ans *= nums[i] if flag flag = false if ans!=-1 && ans > 10**18 ans = -1 unless flag } puts ans if flag puts (-1) unless flag
n = gets.strip.to_i nums = gets.strip.split(" ").map do |i| i.to_i end ans = 1 flag = true ans = 0 if nums.include?(0) n.times{|i| ans *= nums[i] if flag flag = false if ans!=-1 && ans > 10**18 ans = -1 unless flag } puts ans if flag puts (-1) unless flag
[["-", 36, 36, 0, 493, 0, 751, 15, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 751, 15, 652, 735, 22]]
4
92
#include <algorithm> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() using namespace std; using ll = long long...
#include <algorithm> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() using namespace std; using ll = long long...
[["-", 15, 339, 51, 16, 31, 16, 31, 74, 0, 24], ["-", 51, 16, 31, 16, 31, 74, 39, 77, 39, 40], ["-", 15, 339, 51, 16, 31, 16, 31, 74, 0, 25], ["-", 15, 339, 51, 16, 31, 16, 12, 74, 0, 24], ["-", 51, 16, 31, 16, 12, 74, 39, 77, 39, 40], ["-", 15, 339, 51, 16, 31, 16, 12, 74, 0, 25]]
1
290
n = int(input()) nums = list(map(int,input().split())) limit = 10**18 res = 1 i = 0 if 0 in num: print(0) exit() while i<n: res *= nums[i] i += 1 if res > limit: res = -1 break print(res)
n = int(input()) nums = list(map(int,input().split())) limit = 10**18 res = 1 i = 0 if 0 in nums: print(0) exit() while i<n: res *= nums[i] i += 1 if res > limit: res = -1 break print(res)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
76
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; bool is_product_overflow(ll a, ll b) { if (a < (ll)(1e18) / b) return true; else return false; } int main(void) { int n; cin >> n; vector<ll> v(n); rep(i, n) { cin >> v[i]; } rep(i...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; bool is_product_overflow(ll a, ll b) { if (a < (ll)(9223372036854775807) / b) return true; else return false; } int main(void) { int n; cin >> n; vector<ll> v(n); rep(i, n) { cin >> ...
[["-", 51, 16, 12, 16, 31, 2, 3, 4, 0, 13], ["+", 51, 16, 12, 16, 31, 2, 3, 4, 0, 13]]
1
200
#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using ll = long long; using P = pair<ll, ll>; int main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); l...
#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using ll = long long; using P = pair<ll, ll>; int main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); l...
[["-", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 39, 344, 3, 347, 0, 77, 39, 86, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 14, 8, 9, 0, 43, 39, 86, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
218
N = int(input()) A = list(map(int, input().split())) ans = 1 if A in 0: print(0) exit() for i in range(N): 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(N): ans *= A[i] if ans > 10**18: print(-1) exit() print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 267], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 267], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
73
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <stack> typedef long long ll; using namespace std; #define INF 0x3f3f3f3f /** *超时有可能是输入的问题 *注意边界 *仔细读题 *没思路试试逆向思维 **加油,奥利给!!! **/ map<int, int> p; /*struct knd{ int x,y,z...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <stack> typedef long long ll; using namespace std; #define INF 0x3f3f3f3f /** *超时有可能是输入的问题 *注意边界 *仔细读题 *没思路试试逆向思维 **加油,奥利给!!! **/ map<int, int> p; /*struct knd{ int x,y,z...
[["-", 0, 43, 49, 50, 51, 16, 12, 69, 28, 22], ["-", 49, 50, 51, 16, 12, 69, 341, 342, 0, 70], ["-", 49, 50, 51, 16, 12, 69, 341, 342, 0, 22], ["-", 49, 50, 51, 16, 12, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
197
n = int(input()) a = list(map(int, input().split())) q = 1000000000000000000 b = 1 cek = True zero = a.count(0) if zero > 0 : print("0") else : for i in range(n) : b = b*a[i] if b > q : break cek = False if cek : print(b) else : print("-1")
n = int(input()) a = list(map(int, input().split())) q = 1000000000000000000 b = 1 cek = True zero = a.count(0) if zero > 0 : print("0") else : for i in range(n) : b = b*a[i] if b > q : cek = False break if cek : print(b) else : print("-1")
[["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
95
n=int(input()) a=list(map(int,input().split())) ans=1 if 0 in a: print(-1) exit() 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() for i in a: ans*=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
68
n = int(input()) arr = list(map(int, input().split())) ans = 1 f = 0 arr.sort() for i in arr: ans *= i if ans > 1000000000000000000: f = 1 print(ans) break if f == 0: print(ans)
n = int(input()) arr = list(map(int, input().split())) ans = 1 f = 0 arr.sort() for i in arr: ans *= i if ans > 1e18: f = 1 print(-1) break if f == 0: print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 531], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612]]
5
66
N = int(input()) lis = list(map(int,input().split())) ans = 1 flag = True if 0 in lis: print(0) else: for i in range(N): ans = ans*lis[i] if ans > 1000000000000000000: print(-1) flag = False if flag == True: print(ans)
N = int(input()) lis = list(map(int,input().split())) ans = 1 flag = True if 0 in lis: print(0) else: for i in range(N): ans = ans*lis[i] if ans > 1000000000000000000: print(-1) flag = False break if flag == True: print(ans)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
80
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i) #define rreps(i, n) for (int i = ((int)(n)); i > 0; --i) #define rep2(i, s, n) for (int i = (s); i <...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i) #define rreps(i, n) for (int i = ((int)(n)); i > 0; --i) #define rep2(i, s, n) for (int i = (s); i <...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 106]]
1
207
# -*- coding:utf-8 -*- import sys def main(): n = int(input().strip()) l = list(map(int, input().split())) sum = 1 if 0 in l : print (0) return for i in l: sum *= i if sum - 1000000000000000000 > 0: print (sum) print (-1) return print (sum) main()
# -*- coding:utf-8 -*- import sys def main(): n = int(input().strip()) l = list(map(int, input().split())) sum = 1 if 0 in l : print (0) return for i in l: sum *= i if sum - 1000000000000000000 > 0: print (-1) return print (sum) main()
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24]]
5
82
N = int(input()); A = list(map(int, input().split())) ans = 1 for i in range(N): ans *= A[i] if ans > 10**18: print(-1) exit() 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 > 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
62
def readinput(): n=int(input()) a=list(map(int,input().split())) return n,a def main(n,a): if(a.count(0)!=0): return 0 res=a[0] for i in range(1,n): res*=a[i] if res>INFTY: return -1 return res if __name__=='__main__': n,a=readinput() an...
INFTY=10**18 def readinput(): n=int(input()) a=list(map(int,input().split())) return n,a def main(n,a): if(a.count(0)!=0): return 0 res=a[0] for i in range(1,n): res*=a[i] if res>INFTY: return -1 return res if __name__=='__main__': n,a=read...
[["+", 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, 657, 31, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 578], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
114
import sys n = int(input()) a = list(map(int,input().split())) f = False; for i in range(n): if a[i] == 0: f = True if f: print(n) sys.exit(0) ans = 1 for i in range(n): ans *= a[i] if ans > 1e18: print(-1) sys.exit(0) print(ans)
import sys n = int(input()) a = list(map(int,input().split())) f = False; for i in range(n): if a[i] == 0: f = True if f: print(0) sys.exit(0) ans = 1 for i in range(n): ans *= a[i] if ans > 1e18: print(-1) sys.exit(0) print(ans)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
100
N = int(input()) A = list(map(int,input().split())) ans = 1 if 0 in A: ans = 0 if ans != 0: for num in A: if ans > 1e+18/num: ans = -1 break ans = ans * num print(ans)
N = int(input()) A = list(map(int,input().split())) ans = 1 if 0 in A: ans = 0 if ans != 0: for num in A: if ans * num > 1e+18: ans = -1 break ans = ans * num print(ans)
[["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 48], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 22], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 85], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 12, 22]]
5
67
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (n); i++) typedef pair<ll, ll> P; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int main() { ll n; cin >> n; ll ans = 1; vector<ll> a(n); rep(i, ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (n); i++) typedef pair<ll, ll> P; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int main() { ll n; cin >> n; ll ans = 1; vector<ll> a(n); rep(i, ...
[["-", 15, 339, 51, 16, 31, 16, 31, 16, 17, 48], ["-", 15, 339, 51, 16, 31, 16, 31, 16, 12, 22], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 17, 85], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 12, 22]]
1
193
n = gets.to_i arr = gets.split.map(&:to_i) res = 1 p 0 if arr.include?(0) arr.each do |i| res *= i p -1 and return if res > 1000000000000000000 end p res
n = gets.to_i arr = gets.split.map(&:to_i) res = 1 p 0 and return if arr.include?(0) arr.each do |i| res *= i p -1 and return if res > 1000000000000000000 end p res
[["+", 36, 36, 0, 493, 0, 751, 8, 738, 17, 355], ["+", 0, 493, 0, 751, 8, 738, 12, 38, 0, 38]]
4
50