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
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 2e9 #define ALL(v) v.begin(), v.end() using namespace std; typedef long long ll; int main() { int N; cin >> N; ll ans = 1; vector<l...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 2e9 #define ALL(v) v.begin(), v.end() using namespace std; typedef long long ll; int main() { int N; cin >> N; ll ans = 1; vector<l...
[["-", 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
170
#include <bits/stdc++.h> using namespace std; // abbriviations typedef long long int ll; typedef vector<ll> vll; // typedef vector v; typedef pair<ll, ll> pll; typedef priority_queue<ll> pqll; #define repi(i, a, b) for (ll i = a; i < b; i++) #define rep(x, v) for (auto &x : v) #define pb push_back #define mp make_pai...
#include <bits/stdc++.h> using namespace std; // abbriviations typedef long long int ll; typedef vector<ll> vll; // typedef vector v; typedef pair<ll, ll> pll; typedef priority_queue<ll> pqll; #define repi(i, a, b) for (ll i = a; i < b; i++) #define rep(x, v) for (auto &x : v) #define pb push_back #define mp make_pai...
[["-", 0, 9, 0, 57, 64, 1, 0, 16, 17, 60], ["+", 0, 9, 0, 57, 64, 1, 0, 11, 17, 32]]
1
334
n = int(input()) a = list(map(int,input().split())) c = 1 flag = True for _ in a: c *= _ if c > 10**18: flag = False if c == 0: print(0) if flag: print(c) else: print(-1)
n = int(input()) a = list(map(int,input().split())) c = 1 flag = True for _ in a: c *= _ if c > 10**18: flag = False c = 1 if c == 0: print(0) quit() if flag: print(c) else: print(-1)
[["+", 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], ["+", 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
72
N = int(input()) A = list(map(int, input().split())) ans = 1 for a in A: ans *= a if ans > 1000000000000000000: print(-1) quit() print(ans)
N = int(input()) A = list(map(int, input().split())) A.sort() ans = 1 for a in A: ans *= a if ans > 1000000000000000000: print(-1) quit() 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
53
n = int(input()) a = sorted(list(map(int,input().split()))) m = 1 threshold = 1e18 for i in a: m *= i if m >= threshold: m = -1 break print(m)
n = int(input()) a = sorted(list(map(int,input().split()))) m = 1 threshold = 1e18 for i in a: m *= i if m > threshold: m = -1 break print(m)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
56
N = int(input()) A = list(map(int, input().split())) if A in 0: print(0) exit() prod = 1 for i in range(len(A)): prod *= A[i] if prod > 10 ** 18: print(-1) exit() print(prod)
N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) exit() prod = 1 for i in range(len(A)): prod *= A[i] if prod > 10 ** 18: print(-1) exit() print(prod)
[["-", 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
76
N = input() A = map(int, input().split()) if 0 in A: print(0) exit() A = sorted(A)[::-1] val = 1 for a in A: val *= a if val > 10 ** 18: print(-1) exit() print(val)
N = input() A = list(map(int, input().split())) if 0 in A: print(0) exit() A = sorted(A)[::-1] val = 1 for a in A: val *= a if val > 10 ** 18: print(-1) exit() print(val)
[["+", 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
73
#include <bits/stdc++.h> #include <cstdio> #include <iostream> #include <math.h> #include <queue> #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using namespace std; using P = pair<int, int>; int main() { int n; cin >> n; ll a[n]; ll ans = 1; int zero = 0; rep(i, n) { cin >> a[i]...
#include <bits/stdc++.h> #include <cstdio> #include <iostream> #include <math.h> #include <queue> #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using namespace std; using P = pair<int, int>; int main() { int n; cin >> n; ll a[n]; ll ans = 1; int zero = 0; rep(i, n) { cin >> a[i]...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
162
n = int(input()) data = list(map(int, input().split())) data.sort() data.reverse() while data[-1] == 0: data.insert(0,0) data.pop(-1) ans = 1 for d in data: ans = ans * int(d) if ans > 10*18 or ans == 0: break if ans > 10**18: print(-1) else: print(ans)
n = int(input()) data = list(map(int, input().split())) data.sort() data.reverse() while data[-1] == 0: data.insert(0,0) data.pop(-1) ans = 1 for d in data: ans = ans * int(d) if ans > 10**18 or ans == 0: break if ans > 10**18: print(-1) else: print(ans)
[["-", 0, 57, 15, 679, 31, 666, 0, 657, 17, 48], ["+", 0, 57, 15, 679, 31, 666, 0, 657, 17, 578]]
5
105
# B Multiplication 2 n = int(input()) a = list(map(int, input().split())) ans = 1 for ai in a: if not ans > 10**18: ans *= ai elif ai == 0: print(-1) exit() if ans > 10**18: print(-1) else: print(ans)
# B Multiplication 2 n = int(input()) a = list(map(int, input().split())) ans = 1 for ai in a: if not ans > 10**18: ans *= ai elif ai == 0: print(0) exit() if ans > 10**18: print(-1) else: 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
76
#include <bits/stdc++.h> #define int long long #define inf 1000000000000000000 /** inf = 10^18 */ using namespace std; signed main() { int n, tot = 1; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { if (a[i] == 0) { cout << 0; return 0; ...
#include <bits/stdc++.h> #define int long long #define inf 1000000000000000000 /** inf = 10^18 */ using namespace std; signed main() { int n, tot = 1; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { if (a[i] == 0) { cout << 0; return 0; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
150
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); long[] b = new long[a]; long MAX = (long)Math.pow(10, 8); int result = 1; for (int i = 0; i < a; i++) { b[i] = sc.nextInt(); if (b[i] == 0) { ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); long[] b = new long[a]; long MAX = (long)Math.pow(10, 18); long result = 1; for (int i = 0; i < a; i++) { b[i] = sc.nextLong(); if (b[i] == 0...
[["-", 49, 200, 51, 74, 51, 492, 3, 4, 0, 499], ["+", 49, 200, 51, 74, 51, 492, 3, 4, 0, 499], ["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96], ["-", 8, 196, 0, 1, 0, 11, 12, 492, 141, 22], ["+", 8, 196, 0, 1, 0, 11, 12, 492, 141, 22], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0,...
3
182
import sys N = int(input()) A = list(map(int,input().split())) ans = A[0] if A.count(0)>0: print(-1) sys.exit() for i in range(1,N): ans = ans*A[i] if ans>10**18: print(-1) sys.exit() print(ans)
import sys N = int(input()) A = list(map(int,input().split())) ans = A[0] if A.count(0)>0: print(0) sys.exit() for i in range(1,N): ans = ans*A[i] if ans>10**18: 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
92
import sys input = sys.stdin.readline N = int(input()) A =list(map(int,input().split())) ans = 1 if 0 in A: ans=0 else: for i in range(N): ans *= A[i] if ans >= 10**18: break print(-1 if ans>=10**18 else ans)
import sys input = sys.stdin.readline N = int(input()) A =list(map(int,input().split())) ans = 1 if 0 in A: ans=0 else: for i in range(N): ans *= A[i] if ans >= 10**18: break print(-1 if ans>10**18 else ans)
[["-", 0, 652, 3, 4, 0, 41, 0, 666, 667, 20], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 667, 47]]
5
82
n=int(input()) l=list(map(int,input().split())) s=1 d=1 for i in l: s=s*i if(s>10**18): print(-1) d=0 break if(d==1): print(s)
n=int(input()) l=sorted(list(map(int,input().split()))) s=1 d=1 for i in l: s=s*i if(s>10**18): print(-1) d=0 break if(d==1): print(s)
[["+", 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
70
#include <bits/stdc++.h> /* Type alias */ using ll = long long; using ld = long double; using vec_i = std::vector<int>; using vec_ll = std::vector<ll>; using vec_ld = std::vector<ld>; using set_i = std::set<int>; using set_ll = std::set<ll>; using set_ld = std::set<ld>; using uset_i = std::unordered_set<int>; using ...
#include <bits/stdc++.h> /* Type alias */ using ll = long long; using ld = long double; using vec_i = std::vector<int>; using vec_ll = std::vector<ll>; using vec_ld = std::vector<ld>; using set_i = std::set<int>; using set_ll = std::set<ll>; using set_ld = std::set<ld>; using uset_i = std::unordered_set<int>; using ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
540
import java.io.*; import java.util.*; public class Main { public static void main(String[] main) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); PrintWriter out = new PrintWriter(System.out); long n =...
import java.io.*; import java.util.*; public class Main { public static void main(String[] main) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); PrintWriter out = new PrintWriter(System.out); long n =...
[["+", 15, 15, 0, 16, 31, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 16, 31, 23, 0, 74, 0, 24], ["+", 31, 16, 31, 23, 0, 74, 39, 506, 0, 96], ["+", 0, 16, 31, 16, 31, 23, 0, 74, 0, 25], ["+", 31, 23, 0, 74, 51, 492, 3, 4, 0, 25], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 95]]
3
207
#include <cmath> #include <iostream> #include <stdlib.h> using namespace std; int main() { long long a; long long N[100001]; cin >> a; bool zero = false; for (int i = 0; i < a; i++) { cin >> N[i]; if (N[i] == 0) zero = true; } if (zero) { cout << -1 << endl; return 0; } long lo...
#include <cmath> #include <iostream> #include <stdlib.h> using namespace std; int main() { long long a; long long N[100001]; cin >> a; bool zero = false; for (int i = 0; i < a; i++) { cin >> N[i]; if (N[i] == 0) zero = true; } if (zero) { cout << 0 << endl; return 0; } long lon...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
152
n=int(input()) l=list(map(int,input().split())) if min(l)== 0: print(0) else: s=1 for x in l: s *= x if s>1000000000000000000: s=1 break print(s)
n=int(input()) l=list(map(int,input().split())) if min(l)== 0: print(0) else: s=1 for x in l: s *= x if s>10**18: s=-1 break print(s)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 31, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 578], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 64, 196, 0, 1, 0, 662, 12, 664, 17, 33]]
5
63
#import #=input() n=int(input()) #=map(int,input().split()) a=list(map(int,input().split())) #=[list(map(int,input().split())) for _ in range()] if 0 in set(a): ans = 0 else: ans = 1 for i in range(n): ans *= a[i] if ans >= 10 ** 18: ans = -1 break print(ans)
#import #=input() n=int(input()) #=map(int,input().split()) a=list(map(int,input().split())) #=[list(map(int,input().split())) for _ in range()] if 0 in set(a): ans = 0 else: ans = 1 for i in range(n): ans *= a[i] if ans > 10 ** 18: ans = -1 break print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
75
#include <bits/stdc++.h> using namespace std; int main() { long long int n, ans = 1; cin >> n; vector<long long int> v(n); int f = 1; int z = 0; for (int i = 0; i < n; i++) { cin >> v[i]; if (v[i] == 0) { z++; } } if (z > 0) { cout << 0 << endl; } else { sort(v.begin(), v.end...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, ans = 1; cin >> n; vector<long long int> v(n); int f = 1; int z = 0; for (int i = 0; i < n; i++) { cin >> v[i]; if (v[i] == 0) { z++; } } if (z > 0) { cout << 0 << endl; } else { sort(v.begin(), v.end...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
176
#ABC169 B-Multiplication2 class Calc(): def multi(self,x,y): x, y, sign, rslt = str(x)+".", str(y)+".",1 ,"" if x[0]=="-": sign*=-1 x=x[1:] if y[0]=="-": sign*=-1 y=y[1:] x,y=x.split("."),y.split(".") x2 = [int(x[1][-i-1]) for i in range(len(x[1]))] + [int(x[0][-i-1]) for i...
#ABC169 B-Multiplication2 class Calc(): def multi(self,x,y): x, y, sign, rslt = str(x)+".", str(y)+".",1 ,"" if x[0]=="-": sign*=-1 x=x[1:] if y[0]=="-": sign*=-1 y=y[1:] x,y=x.split("."),y.split(".") x2 = [int(x[1][-i-1]) for i in range(len(x[1]))] + [int(x[0][-i-1]) for i...
[["+", 0, 656, 0, 57, 15, 666, 0, 557, 0, 654], ["+", 0, 656, 0, 57, 15, 666, 0, 557, 0, 655]]
5
916
N = int(input()) ans = 1 lim = 10 ** 18 l = 0 A = list(map(int, input().split())) A0 = set(A) if 0 in A0: ans = 0 else: pass for n in range(N): ans = ans * A[n] if ans == 0: break elif ans >= lim: l = 1 break else: pass if l == 1: print(-1) else: print(ans)
N = int(input()) ans = 1 lim = 10 ** 18 l = 0 A = list(map(int, input().split())) A0 = set(A) if 0 in A0: ans = 0 else: pass for n in range(N): ans = ans * A[n] if ans == 0: break elif ans > lim: l = 1 break else: pass if l == 1: print(-1) else: print(ans)
[["-", 8, 196, 0, 57, 75, 665, 15, 666, 667, 20], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 667, 47]]
5
103
n = int(input()) a = list(map(int, input().split())) if 0 in a: print(0) else: s = 1 for i in a : s *= i if s > 10**18: s = -1 print(s)
n = int(input()) a = list(map(int, input().split())) if 0 in a: print(0) else: s = 1 for i in a : s *= i if s > 10**18: s = -1 break print(s)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
62
import sys N = int(input()) A = list(map(int, input().split())) ans = 1 if 0 in A: print(0) sys.exit() for i in range(N): ans *= A[i] if ans > 10 ** 18: ans = -1 print(ans)
import sys N = int(input()) A = list(map(int, input().split())) ans = 1 if 0 in A: print(0) sys.exit() 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
73
n = int(input()) a = list(map(int, input().split())) ans = 1 for a_i in a: ans *= a_i if ans > 1_000_000_000_000_000_000: ans = -1 break print(ans)
n = int(input()) a = list(map(int, input().split())) ans = 1 a.sort() for a_i in a: ans *= a_i if ans > 1_000_000_000_000_000_000: ans = -1 break 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
50
n = int(input()) arr = [int(x) for x in input().split()] res=1 arr.sort() if arr[0] == 0 : print('0') exit(0) for i in range(n): res = res*arr[i] if res>1e18: print(-1) print(res)
n = int(input()) arr = [int(x) for x in input().split()] res=1 arr.sort() if arr[0] == 0 : print('0') exit(0) for i in range(n): res = res*arr[i] if res>1e18: print(-1) exit(0) print(res)
[["+", 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, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
82
N = int(input()) lst = list(map(int, input().split())) if (0 in lst): print(0) else: product = 1 for i in lst: #iというlist中の数字 product *= i #これが(i + 1)番目 if(product > 1000000000000000000): #これをfor文に書くことで掛け終える前に超えたらやめることができる(処理を短縮できる!) print(-1) break print(product)
N = int(input()) lst = list(map(int, input().split())) if (0 in lst): print(0) else: product = 1 for i in lst: product *= i if(product > 1000000000000000000): print(-1) break else: print(product)
[["+", 75, 76, 8, 196, 0, 7, 75, 76, 0, 95], ["+", 75, 76, 8, 196, 0, 7, 75, 76, 0, 102]]
5
69
n = int(input()) l = map(int, input().split()) ans = 1 for a in l: if ans * a > 1e18: ans = -1 elif ans != -1: ans *= a print(ans)
n = int(input()) l = map(int, input().split()) ans = 1 for a in l: if ans * a > 1e18: ans = -1 elif ans != -1 or a == 0: ans *= a print(ans)
[["+", 8, 196, 0, 57, 75, 665, 15, 679, 17, 354], ["+", 0, 57, 75, 665, 15, 679, 12, 666, 0, 22], ["+", 0, 57, 75, 665, 15, 679, 12, 666, 667, 60], ["+", 0, 57, 75, 665, 15, 679, 12, 666, 0, 612]]
5
54
N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) exit() mul = A.pop() for a in A: mul *= a if mul > 10**8: print(-1) exit() print(mul)
N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) exit() mul = A.pop() for a in A: mul *= a if mul > 10**18: print(-1) exit() print(mul)
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]]
5
71
#include <bits/stdc++.h> using namespace std; using ll = long long int; int main() { long long int n; cin >> n; static long long int date[1000000 + 110]; for (long long int i = 1; i <= n; i++) cin >> date[i]; sort(date + 1, date + 1 + n); if (date[1] == 0) return puts("0") * 0; ll ret = 1; ll b...
#include <bits/stdc++.h> using namespace std; using ll = unsigned long long; int main() { long long int n; cin >> n; static long long int date[1000000 + 110]; for (long long int i = 1; i <= n; i++) cin >> date[i]; sort(date + 1, date + 1 + n); if (date[1] == 0) return puts("0") * 0; ll ret = 1; ...
[["+", 0, 30, 0, 360, 39, 77, 39, 86, 0, 87], ["-", 0, 30, 0, 360, 39, 77, 39, 86, 39, 40], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
168
N = int(input()) A = list(map(int,input().split())) x = 1 if A in 0: x = 0 else: for i in range(N): x *= A[i] if x > 10**18: x = -1 break print(x)
N = int(input()) A = list(map(int,input().split())) x = 1 if 0 in A: x = 0 else: for i in range(N): x *= A[i] if x > 10**18: x = -1 break print(x)
[["-", 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
68
#define _GLIBCXX_DEBUG #include <algorithm> //next_permutation #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) v.begin(), v.end() #define dec(n) cout << fixed << setprecision(n); #define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ" #define small "abcdefghijklmnopqrstuvwxyz" using namespace...
#define _GLIBCXX_DEBUG #include <algorithm> //next_permutation #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) v.begin(), v.end() #define dec(n) cout << fixed << setprecision(n); #define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ" #define small "abcdefghijklmnopqrstuvwxyz" using namespace...
[["+", 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
597
_ = input() nums = list(map(int, input().split())) ans = 1 for num in nums: if num==0 or ans <= 10 ** 18: ans *= num else: break print(ans if ans <= 10 ** 18 else -1)
_ = input() nums = list(map(int, input().split())) ans = 1 for num in nums: if num==0 or ans <= 10 ** 18: ans *= num else: pass print(ans if ans <= 10 ** 18 else -1)
[["-", 0, 57, 75, 76, 8, 196, 0, 93, 0, 94], ["+", 0, 57, 75, 76, 8, 196, 0, 674, 0, 675]]
5
60
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; bool z = false; for (int i = 0; i < n; ++i) { cin >> a[i]; if (a[i] == 0) z = true; } if (z) { cout << "0" << endl; return 0; } long long res = 1; for (int i = 0; i < n; ++i) { if (a[i]...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long a[n]; bool z = false; for (int i = 0; i < n; ++i) { cin >> a[i]; if (a[i] == 0) z = true; } if (z) { cout << "0" << endl; return 0; } long long res = 1; for (int i = 0; i < n; ++i) { i...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
144
#include <stdio.h> int main() { int N, i; long long int c = 1000000000000000000, d = 1; scanf("%d", &N); long long int A[N]; for (i = 0; i < N; i++) { scanf("%lld", &A[i]); if (A[i] == 0) d = 0; } for (i = 0; i < N; i++) { if (A[N] == 0) { d = 0; break; } else if (c / A[i...
#include <stdio.h> int main() { int N, i; long long int c = 1000000000000000000, d = 1; scanf("%d", &N); long long int A[N]; for (i = 0; i < N; i++) { scanf("%lld", &A[i]); if (A[i] == 0) d = 0; } for (i = 0; i < N; i++) { if (A[i] == 0) { d = 0; break; } else if (c / A[i...
[["-", 0, 57, 15, 23, 0, 16, 31, 69, 71, 22], ["+", 0, 57, 15, 23, 0, 16, 31, 69, 71, 22]]
0
155
#include <iostream> int main() { long n; std::cin >> n; long long a; long long ans = 1; long long check = 1; for (int i = 0; i < n; i++) { std::cin >> a; ans *= a; check *= a; } if (check > 1000000000000000000) { std::cout << -1 << std::endl; } else { std::cout << ans << std::end...
#include <iostream> int main() { long n; std::cin >> n; long long a; long long ans = 1; long double check = 1; for (int i = 0; i < n; i++) { std::cin >> a; ans *= a; check *= a; } if (check > 1000000000000000000) { std::cout << -1 << std::endl; } else { std::cout << ans << std::en...
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 39, 40]]
1
94
from sys import stdin,stdout LI=lambda:list(map(int,input().split())) MAP=lambda:map(int,input().split()) IN=lambda:int(input()) S=lambda:input() import math from collections import Counter,defaultdict n=IN() a=LI() p=1 if 0 in a: print(0) exit() for i in a: p*=i print(p) if p>pow(10,18): p...
from sys import stdin,stdout LI=lambda:list(map(int,input().split())) MAP=lambda:map(int,input().split()) IN=lambda:int(input()) S=lambda:input() import math from collections import Counter,defaultdict n=IN() a=LI() p=1 if 0 in a: print(0) exit() for i in a: p*=i if p>pow(10,18): print(-1) ...
[["-", 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
125
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<long long> v; int co = 0; for (int i = 0; i < n; i++) { int x; cin >> x; if (x == 0) { co = 1; } v.push_back(x); } if (co) { cout << 0; return 0; } long long unsigned res = 1; long...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<long long> v; int co = 0; for (int i = 0; i < n; i++) { long long x; cin >> x; if (x == 0) { co = 1; } v.push_back(x); } if (co) { cout << 0; return 0; } long long unsigned res = 1; ...
[["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 0, 7, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 31, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 13]]
1
149
#include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define endl "\...
#include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define endl "\...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
160
k=int(input()) mal=1 n=list(map(int,input().split())) for i in range(0,len(n)): mal=mal*n[i] if(mal>10**18): mal=-1 break for j in range(0,len(n)): if(n[i]==0): mal=0 print(mal)
k=int(input()) mal=1 n=list(map(int,input().split())) for i in range(0,len(n)): mal=mal*n[i] if(mal>10**18): mal=-1 break for j in range(0,len(n)): if(n[j]==0): mal=0 print(mal)
[["-", 0, 57, 15, 23, 0, 666, 0, 206, 206, 22], ["+", 0, 57, 15, 23, 0, 666, 0, 206, 206, 22]]
5
93
n= int(input()) l =list(map(int,input().split())) ans= 1 if 0 in l: print("0") else: for i in range(n): ans*= l[i] if ans>= 10**18: break if ans>= 10**18: print("-1") else: print(ans)
n= int(input()) l =list(map(int,input().split())) ans= 1 if 0 in l: print("0") else: for i in range(n): ans*= l[i] if ans> 10**18: break if ans> 10**18: print("-1") else: print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["-", 75, 76, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 667, 47]]
5
82
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define fo(a, b) for (int a = 0; a < b; a++) #define Sort(a) sort(a.begin(), a.end()) #define rev(a) reverse(a.begin(), a.end()) #define fi first #define se second #define sz size() #define bgn begin() #define en end() #defin...
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define fo(a, b) for (int a = 0; a < b; a++) #define Sort(a) sort(a.begin(), a.end()) #define rev(a) reverse(a.begin(), a.end()) #define fi first #define se second #define sz size() #define bgn begin() #define en end() #defin...
[["-", 75, 76, 0, 9, 0, 43, 49, 50, 51, 13], ["+", 75, 76, 0, 9, 0, 43, 49, 50, 51, 13], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 17, 107], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 108]]
1
3,124
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define REP(i, d, n) for (int i = (d); i < (n); ++i) #define rrep(i, n) for (int i = (n - 1); i >= 0; --i) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define int long long template <typename T> usin...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define REP(i, d, n) for (int i = (d); i < (n); ++i) #define rrep(i, n) for (int i = (n - 1); i >= 0; --i) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define int long long template <typename T> usin...
[["+", 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
224
def main(): N = int(input()) A = map(int, input().split()) if 0 in A: return 0 r, max = 1, 10 ** 18 for num in A: r *= num if r > max: return -1 return r print(main())
def main(): N = int(input()) A = list(map(int, input().split())) if 0 in A: return 0 r, max = 1, 10 ** 18 for num in A: r *= num if r > max: return -1 return r print(main())
[["+", 8, 196, 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
67
def main(): N = int(input()) A = map(int, input().split()) if 0 in A: print(0) return r, max = 1, 10 ** 18 for num in A: r *= num if r > max: print(-1) return print(r) main()
def main(): N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) return r, max = 1, 10 ** 18 for num in A: r *= num if r > max: print(-1) return print(r) main()
[["+", 8, 196, 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
#include <algorithm> #include <complex> #include <cstdlib> #include <ctime> #include <iomanip> #include <iostream> #include <limits> #include <locale> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <tim...
#include <algorithm> #include <complex> #include <cstdlib> #include <ctime> #include <iomanip> #include <iostream> #include <limits> #include <locale> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <tim...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13]]
1
323
N = input() A = input().split() if '0' in A: print(0) else: N = int(N) sum = 1 for i in range(N): sum *= int(A[i]) if sum > 10**18: sum = -1 exit() print(sum)
N = input() A = input().split() if '0' in A: print(0) else: N = int(N) sum = 1 for i in range(N): sum *= int(A[i]) if sum > 10**18: print(-1) exit() print(sum)
[["-", 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
71
n = int(input()) s = list(map(int,input().split())) ans = 1 if 0 in s: print(0) else: for i in range(n+1): ans *= s[i] if ans > 10 ** 18: ans = -1 break print(ans)
n = int(input()) s = list(map(int,input().split())) ans = 1 if 0 in s: print(0) else: for i in range(n): ans *= s[i] if ans > 10 ** 18: ans = -1 break print(ans)
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
71
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll maxVal = 1e18; int main() { std::ios_base::sync_with_stdio(false); ll n; ll ret = 0ll; cin >> n; vector<int> a(n); int count0 = 0; for (int i = 0; i < n; i++) { cin >> a[i]; count0 += (a[i] == 0); } if (!count0) { ret...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll maxVal = 1e18; int main() { std::ios_base::sync_with_stdio(false); ll n; ll ret = 0ll; cin >> n; vector<ll> a(n); int count0 = 0; for (int i = 0; i < n; i++) { cin >> a[i]; count0 += (a[i] == 0); } if (!count0) { ret ...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]]
1
153
n=int(input()) a=list(map(int,input().split())) p=1 if 0 in a: print(0) else: for i in a: p*=i if p>10**18: print(-1) break if p<10**18:print(p)
n=int(input()) a=list(map(int,input().split())) p=1 if 0 in a: print(0) else: for i in a: p*=i if p>10**18: print(-1) break if p<=10**18:print(p)
[["-", 75, 76, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 667, 19]]
5
71
#include <bits/stdc++.h> using namespace std; typedef long long ll; using pint = pair<int, int>; ll mod = 1000000007, mod2 = 998244353; int dx[4] = {-1, 0, 1, 0}; int dy[4] = {0, -1, 0, 1}; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> i...
#include <bits/stdc++.h> using namespace std; typedef long long ll; using pint = pair<int, int>; ll mod = 1000000007, mod2 = 998244353; int dx[4] = {-1, 0, 1, 0}; int dy[4] = {0, -1, 0, 1}; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> i...
[["-", 15, 339, 51, 16, 12, 16, 31, 2, 63, 22], ["-", 51, 16, 12, 16, 31, 2, 3, 4, 0, 24], ["-", 51, 16, 12, 16, 31, 2, 3, 4, 0, 13], ["-", 51, 16, 12, 16, 31, 2, 3, 4, 0, 21], ["-", 51, 16, 12, 16, 31, 2, 3, 4, 0, 25], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
303
#include <bits/stdc++.h> //C++の機能を「全て」読み込むための命令 #define rep(i, n) for (int i = 0; i < (n); ++i) #define cout(x) cout << x << endl #define all(v) v.begin(), v.end() using namespace std; //型エイリアス using vi = vector<int>; using ll = long long; using P = pair<int, int>; using Mat = vector<vector<int>>; const ll inf = 1e18; ...
#include <bits/stdc++.h> //C++の機能を「全て」読み込むための命令 #define rep(i, n) for (int i = 0; i < (n); ++i) #define cout(x) cout << x << endl #define all(v) v.begin(), v.end() using namespace std; //型エイリアス using vi = vector<int>; using ll = long long; using P = pair<int, int>; using Mat = vector<vector<int>>; const ll inf = 1e18; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
194
#include <bits/stdc++.h> #include <float.h> using namespace std; typedef long long ll; int main() { ll t = 1; // cin>>t; ll ans = 1; bool val = false; while (t--) { ll n; cin >> n; for (ll i = 0; i < n; i++) { ll p; cin >> p; if (p == 0) { ans = 0; break; ...
#include <bits/stdc++.h> #include <float.h> using namespace std; typedef long long ll; int main() { ll t = 1; // cin>>t; ll ans = 1; bool val = false; while (t--) { ll n; cin >> n; for (ll i = 0; i < n; i++) { ll p; cin >> p; if (p == 0) { ans = 0; val = false; ...
[["+", 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, 147], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
137
n=int(input()) a=list(map(int,input().split())) res=1 if 0 in a: print("0") else: for x in a: res=res*x if(res>1000000000000000000): print("-1") break print(res)
n=int(input()) a=list(map(int,input().split())) res=1 if 0 in a: print("0") else: for x in a: res=res*x if(res>1000000000000000000): res=-1 break print(res)
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64,...
5
69
import sys N=int(input()) a=list(map(int,input().split())) for i in a: if i==0: print(0) sys.exit() ans=1 for i in a: ans*=i if 1e18<ans: print("large") sys.exit() print(ans)
import sys N=int(input()) a=list(map(int,input().split())) for i in a: if i==0: print(0) sys.exit() ans=1 for i in a: ans*=i if 1e18<ans: print("-1") sys.exit() print(ans)
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
77
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define sf scanf #define pf printf #define pb push_back #define llu unsigned long long #define U unsigned int #define SIZE 100005 #define pie 3.14159265358979323 #define minuss 1e-6 #define pair pair<ll, ll> #define fast_cin ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define sf scanf #define pf printf #define pb push_back #define llu unsigned long long #define U unsigned int #define SIZE 100005 #define pie 3.14159265358979323 #define minuss 1e-6 #define pair pair<ll, ll> #define fast_cin ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
171
#include <bits/stdc++.h> #define max 1000000 #define pb push_back #define pairs pair<int, int> #define vi vector<int> #define vb vector<bool> #define vii vector<pairs> #define lb lower_bound #define ub upper_bound #define lli long long int #define endl '\n' #define FastInput ios_base::sync_with_stdio(false), cin.tie(NU...
#include <bits/stdc++.h> #define max 1000000 #define pb push_back #define pairs pair<int, int> #define vi vector<int> #define vb vector<bool> #define vii vector<pairs> #define lb lower_bound #define ub upper_bound #define lli long long int #define endl '\n' #define FastInput ios_base::sync_with_stdio(false), cin.tie(NU...
[["-", 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
283
#include <iostream> #include <math.h> #include <stdio.h> using namespace std; int main() { unsigned long long int n, i; cin >> n; long double ans = 1; long double ar[n]; for (i = 0; i < n; i++) { cin >> ar[i]; if (ar[i] == 0) { cout << "0"; return (0); } } for (i = 0; i < n; i++) {...
#include <iostream> #include <math.h> #include <stdio.h> using namespace std; int main() { unsigned long long int n, i; cin >> n; long double ans = 1; long double ar[n]; for (i = 0; i < n; i++) { cin >> ar[i]; if (ar[i] == 0) { cout << "0"; return (0); } } for (i = 0; i < n; i++) {...
[["+", 8, 9, 0, 1, 0, 16, 12, 74, 0, 24], ["+", 0, 16, 12, 74, 39, 77, 39, 86, 0, 87], ["+", 0, 16, 12, 74, 39, 77, 39, 86, 0, 96], ["+", 0, 16, 12, 74, 39, 77, 39, 86, 39, 40], ["+", 8, 9, 0, 1, 0, 16, 12, 74, 0, 25]]
1
148
#include <bits/stdc++.h> #define ll long long #define ld long double #define vi vector<int> #define vll vector<ll> #define vvi vector<vi> #define pii pair<int, int> #define pll pair<long long, long long> #define mod 1000000007 #define inf 1000000000000000001; #define all(c) c.begin(), c.end() #define mp(x, y) make_pair...
#include <bits/stdc++.h> #define ll long long #define ld long double #define vi vector<int> #define vll vector<ll> #define vvi vector<vi> #define pii pair<int, int> #define pll pair<long long, long long> #define mod 1000000007 #define inf 1000000000000000001; #define all(c) c.begin(), c.end() #define mp(x, y) make_pair...
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 17, 60], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32]]
1
180
<?php $count = trim(fgets(STDIN)); $input = trim(fgets(STDIN)); $array = explode(' ', $input); $num = 1; $max = 10 ** 18; for($i = 0; $i < $count; $i++){ if ($array[$i] == 0) { return 0; break; }else{ $num *= $array[$i]; } } if ($num > $max){ $num = -1; } echo $num; ?>
<?php $count = trim(fgets(STDIN)); $input = trim(fgets(STDIN)); $array = explode(' ', $input); $num = 1; $max = 10 ** 18; for($i = 0; $i < $count; $i++){ if ($array[$i] == 0) { $num = 0; break; } $num *= $array[$i]; } if ($num > $max){ $num = -1; } echo $num; ?>
[["-", 0, 9, 0, 57, 8, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 1, 0, 11, 31, 606, 0, 607], ["+", 8, 9, 0, 1, 0, 11, 31, 606, 0, 141], ["+", 0, 57, 8, 9, 0, 1, 0, 11, 0, 32], ["-", 0, 7, 0, 9, 0, 57, 75, 76, 0, 95], ["-", 0, 9, 0, 57, 75, 76, 8, 9, 0, 45], ["-", 0, 9, 0, 57, 75, 76, 8, 9, 0, 46]]
6
119
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) int main() { long N; cin >> N; ll sum = 1; bool flag = false; rep(i, N) { ll A; cin >> A; int len1 = to_string(A).length() - 1; int len2 = to_string(s...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) int main() { long N; cin >> N; ll sum = 1; bool flag = false; rep(i, N) { ll A; cin >> A; int len1 = to_string(A).length() - 1; int len2 = to_string(s...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
195
#include <iostream> using namespace std; int main() { int n; long long a[10010]; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%lld", &a[i]); } int zero = 0; for (int i = 0; i < n; i++) { if (a[i] == 0) { zero++; break; } } if (zero > 0) { printf("0\n"); re...
#include <iostream> using namespace std; int main() { int n; long long a[100010]; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%lld", &a[i]); } int zero = 0; for (int i = 0; i < n; i++) { if (a[i] == 0) { zero++; break; } } if (zero > 0) { printf("0\n"); r...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
188
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> vec(N); for (int i = 0; i < N; i++) cin >> vec.at(i); int zero = 0; for (int i = 0; i < N; i++) if (vec.at(i) == 0) zero++; if (zero > 0) { cout << '0'; return 0; } long long prod = 1; fo...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<long long> vec(N); for (int i = 0; i < N; i++) cin >> vec.at(i); int zero = 0; for (int i = 0; i < N; i++) if (vec.at(i) == 0) zero++; if (zero > 0) { cout << '0'; return 0; } long long prod = 1...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96]]
1
163
import sys n=int(input()) a=list(map(int,input().split())) x=1 for i in range(n): x *=a[i] if x>10**18: print(-1) sys.exit() print(x)
import sys n=int(input()) a=list(map(int,input().split())) a.sort() x=1 for i in range(n): x *=a[i] if x>10**18: print(-1) sys.exit() print(x)
[["+", 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
65
#include <bits/stdc++.h> using namespace std; #define ll long long int #define co cout #define ci cin #define sf1(n) scanf("%lld", &n) #define sf2(n, m) scanf("%lld %lld", &n, &m); #define sf3(n, m, p) scanf("%lld %lld %lld", &n, &m, &p); #define pf1(n) printf("%lld\n", n); #define en cout << endl; #define pb push_back...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define co cout #define ci cin #define sf1(n) scanf("%lld", &n) #define sf2(n, m) scanf("%lld %lld", &n, &m); #define sf3(n, m, p) scanf("%lld %lld %lld", &n, &m, &p); #define pf1(n) printf("%lld\n", n); #define en cout << endl; #define pb push_back...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
206
import sys N = int(input()) a = list(map(int, input().split())) if 0 in a: print(0) sys.exit() b=1 for i in range(0,N): b *= a[i] if b > 1000000000000000000: print(-1) sys.exit print(b)
import sys N = int(input()) a = list(map(int, input().split())) if 0 in a: print(0) sys.exit() b=1 for i in range(0,N): b *= a[i] if b > 1000000000000000000: print(-1) sys.exit() print(b)
[["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
77
#include <bits/stdc++.h> using namespace std; int main() { int n; long long int prod = 1; cin >> n; long long int a[100005]; for (int i = 0; i < n; i++) scanf("%lld", &a[i]); for (int i = 0; i < n; i++) if (a[i] == 0) { cout << 0; return 0; } for (int i = 0; i < n; i++) { i...
#include <bits/stdc++.h> using namespace std; int main() { int n; long long int prod = 1; cin >> n; long long int a[100005]; for (int i = 0; i < n; i++) scanf("%lld", &a[i]); for (int i = 0; i < n; i++) if (a[i] == 0) { cout << 0; return 0; } for (int i = 0; i < n; i++) { i...
[["-", 15, 339, 51, 16, 31, 23, 0, 16, 31, 22], ["-", 15, 339, 51, 16, 31, 23, 0, 16, 17, 48], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 17, 85], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 12, 22]]
1
153
n =int(input()) ls =list(map(int,input().split())) if 0 in ls: print(0) else: ans = 1 for a in A: ans *= a if ans > 1000000000000000000: ans = -1; break; print(ans)
n =int(input()) ls =list(map(int,input().split())) if 0 in ls: print(0) else: ans = 1 for a in ls: ans *= a if ans > 1000000000000000000: ans = -1; break; print(ans)
[["-", 0, 57, 75, 76, 8, 196, 0, 7, 12, 22], ["+", 0, 57, 75, 76, 8, 196, 0, 7, 12, 22]]
5
63
from sys import stdin MAX = 10^18 def main(): line_count = 0 for line in stdin: line_count += 1 factors_str = line.split() if line_count == 2: break factors = [int(factor) for factor in factors_str] if 0 in factors: print(0) return product...
from sys import stdin MAX = 10**18 def main(): line_count = 0 for line in stdin: line_count += 1 factors_str = line.split() if line_count == 2: break factors = [int(factor) for factor in factors_str] if 0 in factors: print(0) return produc...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 140], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 578]]
5
89
n = int(input()) a = list(map(int, input().split())) p = 10**18 a.sort() #print(a) if 0 in a: print(0) exit() a.reverse() #print(a) ans = 1 for i in a: ans *= i #print(ans) if ans > p: print(-1) exit() else: print(ans)
n = int(input()) a = list(map(int, input().split())) p = 10**18 a.sort() #print(a) if 0 in a: print(0) exit() a.reverse() #print(a) ans = 1 for i in a: ans *= i #print(ans) if ans > p: 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
85
n = int(input()) a = list(map(int, input().split())) if 0 in a: print(0) exit() a = sorted(a, reverse=True) res = a[0] for ai in a[1:]: res *= ai if res > 10**18: print(-1) exit()
n = int(input()) a = list(map(int, input().split())) if 0 in a: print(0) exit() a = sorted(a, reverse=True) res = a[0] for ai in a[1:]: res *= ai if res > 10**18: print(-1) exit() print(res)
[["+", 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
80
import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int factorAmount = scanner.nextInt(); long[] factors = new long[factorAmount]; for (int i = 0; i < factorAmount; i++) { factors[i] = scan...
import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int factorAmount = scanner.nextInt(); long[] factors = new long[factorAmount]; for (int i = 0; i < factorAmount; i++) { factors[i] = scan...
[["+", 0, 57, 15, 15, 0, 16, 12, 91, 17, 111], ["-", 15, 15, 0, 16, 12, 16, 31, 492, 141, 22], ["+", 15, 15, 0, 16, 12, 91, 439, 492, 141, 22], ["-", 0, 57, 15, 15, 0, 16, 12, 16, 17, 79], ["-", 0, 57, 15, 15, 0, 16, 12, 16, 12, 22]]
3
237
import java.math.BigInteger; import java.util.Arrays; import java.util.Scanner; public class Main { static long max = 1000000000000000000L; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); String eatEmpty = sc.nextLine(); String input = sc.nextLin...
import java.math.BigInteger; import java.util.Arrays; import java.util.Scanner; public class Main { static long max = 1000000000000000000L; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); String eatEmpty = sc.nextLine(); String input = sc.nextLin...
[["-", 0, 57, 75, 196, 0, 503, 49, 200, 51, 499], ["-", 8, 196, 0, 57, 75, 196, 0, 503, 0, 21], ["+", 0, 57, 75, 196, 0, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 57, 75, 196, 0, 503, 0, 35], ["+", 0, 57, 75, 196, 0, 503, 39, 506, 0, 96], ["-", 0, 52, 8, 196, 0, 1, 0, 11, 17, 108], ["+", 0, 52, 8, 196, 0, 1, 0, 11, 17, ...
3
216
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; unsigned long long A = 1; bool check = 1; for (int i = 0; i < N; i++) { unsigned long long a; cin >> a; if (a == 0) { A = 0; check = 1; break; } else if (1000000000000000000 / a > A) { A = A ...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; unsigned long long A = 1; bool check = 1; for (int i = 0; i < N; i++) { unsigned long long a; cin >> a; if (a == 0) { A = 0; check = 1; break; } else if (1000000000000000000 / a >= A) { A = A...
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 20]]
1
127
a=input() x = list(map(int, input().split())) x.sort(reverse=true) if x[-1]==0: print(0) else: sum=1 for i in x: sum*=i if sum>10**18: print(-1) break if sum<=10**18: print(sum)
a=input() x = list(map(int, input().split())) x.sort(reverse=True) if x[-1]==0: print(0) else: sum=1 for i in x: sum*=i if sum>10**18: print(-1) break if sum<=10**18: print(sum)
[["-", 0, 1, 0, 652, 3, 4, 0, 653, 51, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 51, 146]]
5
80
#include <iostream> #include <vector> using namespace std; int main() { int N; int64_t a; int64_t ans; double test; cin >> N; cin >> ans; test = ans; for (int i = 0; i < N - 1; i++) { cin >> a; ans *= a; test *= a; } cout << ans; if (ans > 1000000000000000000 || test > 100000000...
#include <iostream> #include <vector> using namespace std; int main() { int N; int64_t a; int64_t ans; double test; cin >> N; cin >> ans; test = ans; for (int i = 0; i < N - 1; i++) { cin >> a; ans *= a; test *= a; } if (ans > 1000000000000000000 || test > 1000000000000000000) { ...
[["-", 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
100
n = int(input()) a = list(map(int,input().split())) a.sort() ans = 1 for i in a: ans *= i if ans >= 1000000000000000000: ans = -1 break print(ans)
n = int(input()) a = list(map(int,input().split())) a.sort() ans = 1 for i in a: ans *= i if ans > 1000000000000000000: ans = -1 break print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
55
p=int(input()) ans=1 ar=list(map(int,input().split())) if 0 in ar:ans=0 else: for i in range(p): if ans<1e18:ans*=ar[i] else:ans=-1;break if ans<1e18:ans=-1 print(ans,end='')
p=int(input()) ans=1 ar=list(map(int,input().split())) if 0 in ar:ans=0 else: for i in range(p): if ans<1e18:ans*=ar[i] else:ans=-1;break if ans>1e18:ans=-1 print(ans,end='')
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47]]
5
83
N = int(input()) A = list(map(int, input().split())) if 0 in A: print(-1) exit() ans = 1 for i in A: ans *= i if ans > 10**18: print(-1) break else: print(ans)
N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) exit() ans = 1 for i in A: ans *= i if ans > 10**18: print(-1) break else: 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 = input() lista = list(map(int,input().split())) r = 1 if 0 in a: print(0) else: for a in lista: r *= a if r > 10**18: print(-1) break else: print(r)
n = input() lista = list(map(int,input().split())) r = 1 if 0 in lista: print(0) else: for a in lista: r *= a if r > 10**18: print(-1) break else: print(r)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
63
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define ll long long #define ull unsigned long long #define si set<ll> #define vi vector<ll> #define popcount(x) __builtin_popcountll(x) #define mii map<ll, ll> #define vpi vector<pair<ll, ll>> #define sz(c) (int)c.size() #define fr first #define ll l...
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define ll long long #define ull unsigned long long #define si set<ll> #define vi vector<ll> #define popcount(x) __builtin_popcountll(x) #define mii map<ll, ll> #define vpi vector<pair<ll, ll>> #define sz(c) (int)c.size() #define fr first #define ll l...
[["-", 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
359
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <set> #include <string> #include <utility> #include <vector> #define rep(i, a, b) for (int i = (a); i < (b); ++i) typedef long long ll; using namespace std; const int64_t INF = 1000000000000000000; int main() { int n; cin >> n; i...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <set> #include <string> #include <utility> #include <vector> #define rep(i, a, b) for (int i = (a); i < (b); ++i) typedef long long ll; using namespace std; const int64_t INF = 1000000000000000000; int main() { int n; cin >> n; i...
[["+", 51, 16, 12, 16, 31, 16, 31, 2, 63, 22]]
1
150
N = int(input()) A = list(map(int, input().split())) sum = 1 A.sort() for i in A: sum = sum*i if sum >= pow(10,18): sum = -1 break print(sum)
N = int(input()) A = list(map(int, input().split())) sum = 1 A.sort() for i in A: sum = sum*i if sum > pow(10,18): sum = -1 break print(sum)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
62
#include <algorithm> #include <iostream> #include <string> #define ll long long const int maxn = 1e5 + 5; ll a[maxn]; using namespace std; int main() { int n; cin >> n; long long res = 1; long long maxi = ((ll)1000000000) * ((ll)1000000000); for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n...
#include <algorithm> #include <iostream> #include <string> #define ll long long const int maxn = 1e5 + 5; ll a[maxn]; using namespace std; int main() { int n; cin >> n; long long res = 1; long long maxi = ((ll)1000000000) * ((ll)1000000000); for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n...
[["-", 15, 339, 51, 16, 31, 16, 12, 69, 28, 22], ["-", 51, 16, 31, 16, 12, 69, 341, 342, 0, 70], ["-", 51, 16, 31, 16, 12, 69, 341, 342, 0, 22], ["-", 51, 16, 31, 16, 12, 69, 341, 342, 0, 73], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22]]
1
184
#include <stdio.h> int main(void) { int n; int a[100010]; long long result = 1; scanf("%d", &n); for (int i = 0; i < n; i++) { int input; scanf("%d", &input); a[i] = input; if (input == 0) { result = 0; } } if (result == 0) { printf("%d\n", 0); return 0; } for (int...
#include <stdio.h> int main(void) { int n; long long a[100010]; long long result = 1; scanf("%d", &n); for (int i = 0; i < n; i++) { long long input; scanf("%lld", &input); a[i] = input; if (input == 0) { result = 0; } } if (result == 0) { printf("%d\n", 0); return 0; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 0, 7, 8, 9, 0, 43, 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
166
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll maxi = 1e18; int main() { int n; cin >> n; bool zero = false; ll ar[n]; for (int i = 0; i < n; i++) { ll cur; cin >> ar[i]; if (ar[i] == 0) zero = true; } if (zero) { cout << 0 << '\n'; } else { ll...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll maxi = 1e18; int main() { int n; cin >> n; bool zero = false; ll ar[n]; for (int i = 0; i < n; i++) { ll cur; cin >> ar[i]; if (ar[i] == 0) zero = true; } if (zero) { cout << 0 << '\n'; } else { ll...
[["+", 0, 9, 0, 57, 15, 339, 51, 91, 17, 111]]
1
172
#include <iostream> using namespace std; int main() { int n; cin >> n; unsigned long long x; unsigned long long z = 1; bool flag = false; bool zeroflag = false; for (int i = 0; i < n; i++) { cin >> x; if (x == 0) { zeroflag = true; } if (x <= 1000000000000000000 / z) { z = z ...
#include <iostream> using namespace std; int main() { int n; cin >> n; unsigned long long x; unsigned long long z = 1; bool flag = false; bool zeroflag = false; for (int i = 0; i < n; i++) { cin >> x; if (x == 0) { zeroflag = true; break; } if (x <= 1000000000000000000 / z) {...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
137
#include <bits/stdc++.h> using namespace std; #define ll long long int ll a[100009]; int main() { ll n, i; scanf("%lld", &n); long double s = 0; for (i = 0; i < n; i++) scanf("%lld", &a[i]); for (i = 0; i < n; i++) { if (a[i] == 0) { printf("0\n"); return 0; } } s = 0; for (i ...
#include <bits/stdc++.h> using namespace std; #define ll long long int ll a[100009]; int main() { ll n, i; scanf("%lld", &n); long double s = 0; for (i = 0; i < n; i++) scanf("%lld", &a[i]); for (i = 0; i < n; i++) { if (a[i] == 0) { printf("0\n"); return 0; } } s = 0; for (i ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
212
N = int(input()) A = map(int, input().split()) ans = 1 import sys if 0 in A: print(0) sys.exit() for a in A: ans *= a if ans > pow(10, 18): print(-1) sys.exit() print(ans)
N = int(input()) A = list(map(int, input().split())) ans = 1 import sys if 0 in A: print(0) sys.exit() for a in A: ans *= a if ans > pow(10, 18): print(-1) sys.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
73
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <set> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; int main() { long long res = 1; const long long UPPER = 1000000000LL * 1000000000LL; int N; cin ...
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <set> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; int main() { long long res = 1; const long long UPPER = 1000000000LL * 1000000000LL; int N; cin ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
142
N = input() A = list(map(int, input().split())) if 0 in A: print(0) exit() Ans = 1 for i in range(0,len(A)): Ans *= A[i] if Ans > 10**9: print(-1) exit() else: continue print(Ans)
N = input() A = list(map(int, input().split())) if 0 in A: print(0) exit() Ans = 1 for i in range(0,len(A)): Ans *= A[i] if Ans > 10**18: print(-1) exit() else: continue print(Ans)
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]]
5
78
#include <bits/stdc++.h> #define rep(i, n) \ ; \ for (int i = 0; i < n; i++) using namespace std; int main() { long long g = 1; rep(i, 18) g *= 10; int n; cin >> n; long...
#include <bits/stdc++.h> #define rep(i, n) \ ; \ for (int i = 0; i < n; i++) using namespace std; int main() { long long g = 1; rep(i, 18) g *= 10; int n; cin >> n; long...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 108], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 14, 8, 9, 0, 1, 0, 35]]
1
121
import java.util.*; public class Main { private static final double MAX = 1e18; public static void main(String args[]) { long multiplication = 1; Scanner in = new Scanner(System.in); int n = in.nextInt(); for (int i = 0; i < n; i++) { long num = in.nextLong(); if (num == 0) { ...
import java.util.*; public class Main { private static final long MAX = (long)1e18; public static void main(String args[]) { long multiplication = 1; Scanner in = new Scanner(System.in); int n = in.nextInt(); for (int i = 0; i < n; i++) { long num = in.nextLong(); if (num == 0) { ...
[["-", 0, 235, 8, 498, 0, 124, 39, 511, 0, 512], ["+", 0, 235, 8, 498, 0, 124, 39, 506, 0, 96], ["+", 8, 498, 0, 124, 49, 200, 51, 74, 0, 24], ["+", 0, 124, 49, 200, 51, 74, 39, 506, 0, 96], ["+", 8, 498, 0, 124, 49, 200, 51, 74, 0, 25]]
3
162
import numpy as np n = int(input()) a = list(map(int, input().split())) if 0 in a: print(0) exit() prod = 1 for i in range(n): prod *= a[i] if prod >= 10 ** 18: print(-1) exit() print(prod)
import numpy as np n = int(input()) a = list(map(int, input().split())) if 0 in a: print(0) exit() prod = 1 for i in range(n): prod *= a[i] if prod > 10 ** 18: print(-1) exit() print(prod)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
77
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); #define ll long long int main() { ll i, j, k; ll n; cin >> n; ll a[n]; ll sum = 1, sum2 = 1000000000000000000; for (i = 0, j = 0; i < n; ++i) { cin >> a[i]; if (a[i] == 0) j = 1; } if (j == 0) { sort(a, a ...
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); #define ll long long int main() { ll i, j, k; ll n; cin >> n; ll a[n]; ll sum = 1, sum2 = 1000000000000000000; for (i = 0, j = 0; i < n; ++i) { cin >> a[i]; if (a[i] == 0) j = 1; } if (j == 0) { sort(a, a ...
[["-", 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, 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
197
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define size_of_array(array) (sizeof(array) / sizeof(array[0])) #define MAX 100005 #define DEBUG 0 #define LIMIT (LONG_MAX / 10) #define POSITIVE_LAST_D (LONG_MAX % 10) using ll = long long; using namespace std; using Graph = vector<vector<int>>; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define size_of_array(array) (sizeof(array) / sizeof(array[0])) #define MAX 100005 #define DEBUG 0 #define LIMIT (LONG_MAX / 10) #define POSITIVE_LAST_D (LONG_MAX % 10) using ll = long long; using namespace std; using Graph = vector<vector<int>>; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
167
N = int(input()) A = list(map(int, input().split())) A.sort() rslt = A[0] for a in A[1:]: result *= a if rslt > 10**18: print(-1) exit() print(rslt)
N = int(input()) A = list(map(int, input().split())) A.sort() rslt = A[0] for a in A[1:]: rslt *= a if rslt > 10**18: print(-1) exit() print(rslt)
[["-", 0, 7, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 31, 22]]
5
67
#include <algorithm> #include <cmath> #include <iostream> #include <list> #include <map> #include <queue> #include <stack> #include <string> #include <vector> #define endl "\n" using namespace std; using ll = long long; const ll MOD = 1e9 + 7; const ll INF = 1e18; #define REP(i, n) for (int i = 0; i < n; i++) using Gr...
#include <algorithm> #include <cmath> #include <iostream> #include <list> #include <map> #include <queue> #include <stack> #include <string> #include <vector> #define endl "\n" using namespace std; using ll = long long; const ll MOD = 1e9 + 7; const ll INF = 1e18; #define REP(i, n) for (int i = 0; i < n; i++) using Gr...
[["-", 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, 22], ["+", 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
200
def main (): N = int(input()) A = list(map(int,input(). split ())) if 0 in A: print(0) prod = 1 for a in A: prod *= a if prod > 1000000000000000000: print(-1) print(prod) main ()
def main (): N = int(input()) A = list(map(int,input(). split ())) if 0 in A: print(0) return prod = 1 for a in A: prod *= a if prod > 1000000000000000000: print(-1) return print(prod) main ()
[["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38]]
5
67