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
// This code was made by Chinese_zjc_. #include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> #define int long long #define INF 1000000000000000000 using namespace std; int ans = 1, a, n; bool boom; int mul(int A, int B) { int tm...
// This code was made by Chinese_zjc_. #include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> #define int long long #define INF 1000000000000000000 using namespace std; int ans = 1, a, n; bool boom; int mul(int A, int B) { int tm...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106]]
1
196
n = int(input()) a = list(map(int, input().split())) res = 1 for a_i in a: if 0 == a_i: print(0) exit(0) elif res > 10 ** 18 or res: continue else: res *= a_i print(-1 if res > 10 ** 18 else res)
n = int(input()) a = list(map(int, input().split())) res = 1 for a_i in a: if 0 == a_i: print(0) exit(0) elif res > 10 ** 18: continue else: res *= a_i print(-1 if res > 10 ** 18 else res)
[["-", 8, 196, 0, 57, 75, 665, 15, 679, 17, 354], ["-", 8, 196, 0, 57, 75, 665, 15, 679, 12, 22]]
5
74
# B n = int(input()) a = map(int,input().split()) maxa = 10 **18 ans = 1 if min(a) == 0: ans = 0 for i in a: ans = ans * i if ans > maxa: print(-1) break else: print(ans)
# B n = int(input()) a = list(map(int,input().split())) maxa = 10 **18 ans = 1 if min(a) == 0: ans = 0 for i in a: ans = ans * i if ans > maxa: print(-1) break else: 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
69
#include <algorithm> #include <climits> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; #define int long long #define rep(i, n...
#include <algorithm> #include <climits> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; #define int long long #define rep(i, n...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
383
#include <bits/stdc++.h> using namespace std; #define endl "\n"; #define int long long #define fastio \ ios_base::sync_with_stdio(0); \ cin.tie(0) #define double long double #define M_PI 3.1415926535897932...
#include <bits/stdc++.h> using namespace std; #define endl "\n"; #define int long long #define fastio \ ios_base::sync_with_stdio(0); \ cin.tie(0) #define double long double #define M_PI 3.1415926535897932...
[["+", 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
141
n = int(input()) a = list(map(int, input().split())) m = 1 if 0 in a: m = 0 else: for i in a: m *= i if m > 10**18: m = -1 print(m)
n = int(input()) a = list(map(int, input().split())) m = 1 if 0 in a: m = 0 else: for i in a: m *= i if m > 10**18: m = -1 break print(m)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
61
n=int(input()) cnt=1 a=list(map(int,input().split())) for it in a: cnt*=it if cnt>1000000000000000000: print(-1) exit() if cnt>1000000000000000000: print(-1) else: print(cnt)
n=int(input()) cnt=1 a=sorted(list(map(int,input().split()))) for it in a: cnt*=it if cnt>1000000000000000000: print(-1) exit() if cnt>1000000000000000000: print(-1) else: print(cnt)
[["+", 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
65
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; long long modinv(long long a, long long m) { long long b = m, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); ...
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; long long modinv(long long a, long long m) { long long b = m, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); ...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96]]
1
341
#include <algorithm> #include <cmath> #include <cstdint> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define FOR(i, m, n) for (int(i)...
#include <algorithm> #include <cmath> #include <cstdint> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define FOR(i, m, n) for (int(i)...
[["-", 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, 74, 0, 24], ["+", 15, 339, 51, 16, 12, 74, 39, 77, 39, 78], ["+", 0, 57, 15, 339, 51, 16, 12, 74, 0, 25]]
1
245
#include <algorithm> #include <climits> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stdlib.h> #include <string> #include <time.h> #include <vector> #define debug(x) cout << #x << " = " << x << endl #define debug2...
#include <algorithm> #include <climits> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stdlib.h> #include <string> #include <time.h> #include <vector> #define debug(x) cout << #x << " = " << x << endl #define debug2...
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
1
415
n = int(input()) a = list(map(int, input().split())) ans=1 if 0 in a: print(0) else: 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() else: 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
75
n=int(input()) a=list(map(int,input().split())) a=sorted(a,reverse=True) mod=10**18 cnt=1 for i in range(n): cnt*=a[i] if cnt>mod: print(-1) exit() print(cnt)
n=int(input()) a=list(map(int,input().split())) a=sorted(a) mod=10**18 cnt=1 for i in range(n): cnt*=a[i] if cnt>mod: print(-1) exit() print(cnt)
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["-", 0, 662, 12, 652, 3, 4, 0, 653, 141, 22], ["-", 0, 662, 12, 652, 3, 4, 0, 653, 0, 32], ["-", 0, 662, 12, 652, 3, 4, 0, 653, 51, 146]]
5
74
n = int(input()) a = list(map(int, input().split())) ans = 1 flag =0 for i in a: if i == 0: flag=2 break for i in a: ans = ans*i if ans > 10 ** 18: flag=1 break if flag==1: print(-1) elif flag ==2: print(0) else: print(ans)
n = int(input()) a = list(map(int, input().split())) ans = 1 flag =0 for i in a: if i == 0: flag=2 break if flag!= 2: for i in a: ans = ans*i if ans > 10 ** 18: flag=1 break if flag==1: print(-1) elif flag ==2: print(0) else: print(ans)
[["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 79], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 102]]
5
91
N = int(input()) A = list(map(int,input().split())) ans = 1 for i in range(N): if ans > 10**18+1: break else: ans = ans * A[i] if 0 in A: print(0) elif ans > 10**18+1: print(-1) else: print(ans)
N = int(input()) A = list(map(int,input().split())) ans = 1 for i in range(N): if ans > 10**18+1: break else: ans = ans * A[i] if 0 in A: print(0) elif ans > 10**18: print(-1) else: print(ans)
[["-", 0, 57, 75, 665, 15, 666, 0, 657, 17, 72], ["-", 0, 57, 75, 665, 15, 666, 0, 657, 12, 612]]
5
85
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.next()); long[] a = new long[n]; for (int i = 0; i < n; i++) { a[i] = Long.parseLong(sc.next()); } long ...
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.next()); long[] a = new long[n]; for (int i = 0; i < n; i++) { a[i] = Long.parseLong(sc.next()); } long ...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 20], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47]]
3
197
N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) else: ans = A[0] for i in range(1, N): ans *= A[i] if ans > 10**18: print(ans) ans = -1 break print(ans)
N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) else: ans = A[0] for i in range(1, N): ans *= A[i] if ans > 10**18: ans = -1 break print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
78
#include "algorithm" #include "bitset" #include "cassert" #include "climits" #include "cmath" #include "cstdio" #include "ctime" #include "functional" #include "iomanip" #include "iostream" #include "list" #include "map" #include "numeric" #include "queue" #include "random" #include "set" #include "stack" #include "str...
#include "algorithm" #include "bitset" #include "cassert" #include "climits" #include "cmath" #include "cstdio" #include "ctime" #include "functional" #include "iomanip" #include "iostream" #include "list" #include "map" #include "numeric" #include "queue" #include "random" #include "set" #include "stack" #include "str...
[["+", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
210
x = input() y = [int(a) for a in input().split(" ")] if 0 in y: print(0) exit(0) res = 1 for i in y: res *= i print(res) if res > int(1e+18): print(-1) exit(0) print(res)
x = input() y = [int(a) for a in input().split(" ")] if 0 in y: print(0) exit(0) res = 1 for i in y: res *= i if res > int(1e+18): print(-1) exit(0) print(res)
[["-", 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
75
N = int(input()) A = list(map(int,input().split())) list.sort(A) ans = 1 for a in A: ans *= a if ans > 1e18: ans = -1 exit() print(ans)
N = int(input()) A = list(map(int,input().split())) list.sort(A) ans = 1 for a in A: ans *= a if ans > 1e18: print(-1) exit() print(ans)
[["-", 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
58
n = int(input()) num_list = list(map(int,input().split())) ans = 1 if 0 in num_list: print(0) else: for i in num_list: print(ans) ans *= i if ans > 10**18: break if ans > 10**18: print(-1) else: print(ans)
n = int(input()) num_list = list(map(int,input().split())) ans = 1 if 0 in num_list: print(0) else: for i in num_list: ans *= i if ans > 10**18: break if ans > 10**18: print(-1) else: print(ans)
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
77
#include <algorithm> #include <bitset> #include <cmath> #include <cstdlib> #include <iostream> #include <queue> #include <set> #include <string> #include <utility> #include <vector> typedef long long ll; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FORR(i, a, b) for (int i = (b)-1; i >= (a); --i) #def...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdlib> #include <iostream> #include <queue> #include <set> #include <string> #include <utility> #include <vector> typedef long long ll; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FORR(i, a, b) for (int i = (b)-1; i >= (a); --i) #def...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47]]
1
175
N = int(input()) A = map(int, input().split()) ans = 1 if 0 in A: ans = 0 else: for num in A: ans *= num if ans > 1e18: ans = -1 break print(ans)
N = int(input()) A = list(map(int, input().split())) ans = 1 if 0 in A: ans = 0 else: for num in A: ans *= num if ans > 1e18: ans = -1 break print(ans)
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
57
N=int(input()) Alist=list(map(int,input().split())) multi=Alist[0] ibreak=0 if(Alist.count(0)>=0): print(0) else: for i in range (N-1): multi*=Alist[i+1] if(multi>1e18): print(-1) ibreak=1 break; if(ibreak==0): print(multi)
N=int(input()) Alist=list(map(int,input().split())) multi=Alist[0] ibreak=0 if(Alist.count(0)>0): print(0) else: for i in range (N-1): multi*=Alist[i+1] if(multi>1e18): print(-1) ibreak=1 break; if(ibreak==0): print(multi)
[["-", 0, 656, 0, 57, 15, 23, 0, 666, 667, 20], ["+", 0, 656, 0, 57, 15, 23, 0, 666, 667, 47]]
5
98
#include <bits/stdc++.h> #define booga cout << "booga" << endl #define ll unsigned long long int /* run this program using the console pauser or add your own getch, * system("pause") or input loop */ using namespace std; const ll lim = 1e18; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >>...
#include <bits/stdc++.h> #define booga cout << "booga" << endl #define ll unsigned long long int /* run this program using the console pauser or add your own getch, * system("pause") or input loop */ using namespace std; const ll lim = 1e18; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >>...
[["+", 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
136
#include <algorithm> #include <assert.h> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <stack> #include <string> #include <time.h> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; #define rep(...
#include <algorithm> #include <assert.h> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <stack> #include <string> #include <time.h> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; #define rep(...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
152
def f(): n = int(input()) x = int(1e18) arr = list(map(int, input().split(' '))) ans = 1 for i in arr: ans = ans * i if ans > x: print(-1) return print(ans) f()
def f(): n = int(input()) x = int(1e18) arr = list(map(int, input().split(' '))) arr.sort() ans = 1 for i in arr: # print(i) ans = ans * i if ans > x: print(-1) return print(ans) f()
[["+", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
70
N = int(input()) A = list(map(int,input().split())) if A.count(0) == 0: k = 1 for i in range(N): k = k * A[i] if k >= 10 ** 18: k = -1 break else: k = 0 print(k)
N = int(input()) A = list(map(int,input().split())) if A.count(0) == 0: k = 1 for i in range(N): k = k * A[i] if k >= 10 ** 18 + 1: k = -1 break else: k = 0 print(k)
[["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 72], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]]
5
75
// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░ // ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░ // ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░ // [███████████████████].░░░░░░░░░░░░░░ // ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░ // PointBlank's code (⌐■_■) #include <bits/stdc++.h> using namespace std; using ll = long long; #define repp(I, A, B) for (in...
// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░ // ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░ // ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░ // [███████████████████].░░░░░░░░░░░░░░ // ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░ // PointBlank's code (⌐■_■) #include <bits/stdc++.h> using namespace std; using ll = long long; #define repp(I, A, B) for (in...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
276
#include <bits/stdc++.h> using namespace std; #define ll long long #define double long double #define f(i, x, y, z) for (int i = x; i < y; i += z) #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(n...
#include <bits/stdc++.h> using namespace std; #define ll long long #define double long double #define f(i, x, y, z) for (int i = x; i < y; i += z) #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(n...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
465
n = int(input()) a = set(map(int, input().split())) result = 1 if 0 in a: result = 0 else: for i in a: result = result * i if result > 10**18: result = -1 break print(result)
n = int(input()) a = list(map(int, input().split())) result = 1 if 0 in a: result = 0 else: for i in a: result = result * i if result > 10**18: result = -1 break print(result)
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22]]
5
64
n=int(input()) hoge=list(map(int,input().split())) ans=1 flag=True if(min(hoge)==0): print(0) flag=False else: for i in range(n): ans=ans*hoge[i] if(ans>=10**18): print(-1) flag=False break if(flag): print(ans)
n=int(input()) hoge=list(map(int,input().split())) ans=1 flag=True if(min(hoge)==0): print(0) flag=False else: for i in range(n): ans=ans*hoge[i] if(ans>10**18): print(-1) flag=False break if(flag): print(ans)
[["-", 8, 196, 0, 57, 15, 23, 0, 666, 667, 20], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 667, 47]]
5
93
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<ll>; using vii = vector<vi>; using Pll = pair<ll, ll>; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(v) v.begin(), v.end() #define sz(x) ((int)x.size()) #define pb push_back #define mp make_pair #define mt make_tuple ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<ll>; using vii = vector<vi>; using Pll = pair<ll, ll>; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(v) v.begin(), v.end() #define sz(x) ((int)x.size()) #define pb push_back #define mp make_pair #define mt make_tuple ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13]]
1
340
N = int(input()) Ai = [0] * N Ai = list(map(int,input().split())) Ans = 1 for i in range(N): if Ai[0] == 0: Ans = 0 break Ans = Ans * Ai[i] if Ans > 10 ** 18: Ans = -1 break if Ans <= 10**18: print(Ans) else: print('-1')
N = int(input()) Ai = [0] * N Ai = list(map(int,input().split())) Ai.sort() Ans = 1 for i in range(N): if Ai[i] == 0: Ans = 0 break Ans = Ans * Ai[i] if Ans > 10 ** 18: Ans = -1 break if Ans <= 10**18: print(Ans) 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], ["-", 8, 196, 0, 57, 15, 666, 0, 206, 206, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 206, 22]...
5
94
def quick_sort(list): stand=list[0] over=[] same=[] under=[] for i in list: if(i>stand): over.append(i) elif(i<stand): under.append(i) else: same.append(i) if(len(over)>1): over=quick_sort(over) else: pass if(len...
def quick_sort(list): stand=list[0] over=[] same=[] under=[] for i in list: if(i>stand): over.append(i) elif(i<stand): under.append(i) else: same.append(i) if(len(over)>1): over=quick_sort(over) else: pass if(len...
[["-", 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
186
#from pprint import pprint #from collections import deque #from collections import defaultdict #from collections import Counter #from copy import deepcopy #from itertools #from bisect import bisect_right #二分探索用のモジュール bisect_right(a_list,value) #import sys #sys.setrecursionlimit(N) #N回まで再起を許可する。 # = int(input()) # =...
#from pprint import pprint #from collections import deque #from collections import defaultdict #from collections import Counter #from copy import deepcopy #from itertools #from bisect import bisect_right #二分探索用のモジュール bisect_right(a_list,value) #import sys #sys.setrecursionlimit(N) #N回まで再起を許可する。 # = int(input()) # =...
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22]]
5
86
#include "bits/stdc++.h" #define int long long #define endl '\n' using namespace std; typedef long long ll; #define db(x) cerr << #x << ": " << x << '\n'; #define read(a) \ int a; \ ...
#include "bits/stdc++.h" #define int long long #define endl '\n' using namespace std; typedef long long ll; #define db(x) cerr << #x << ": " << x << '\n'; #define read(a) \ int a; \ ...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 13]]
1
348
N = int(input()) As = map(int,input().split()) sum = 1 if any(a == 0 for a in As): sum = 0 else: for a in As: sum*=a if sum > 1000000000000000000: sum = -1 break print(sum) #A,B=map(int,input().split()) #print(A*B)
N = int(input()) As = list(map(int,input().split())) sum = 1 if any(b == 0 for b in As): sum = 0 else: for a in As: sum*=a if sum > 1000000000000000000: sum = -1 break print(sum) #A,B=map(int,input().split()) #print(A*B)
[["+", 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], ["-", 0, 57, 15, 652, 3, 668, 8, 666, 0, 22], ["+", 0, 57, 15, 652, 3, 668, 8, 666, 0, 22], ["-", 0, 57, 15, 652, 3, 668, 0, 659, 31, 22], ["+", 0, 57, 15, 652, 3, 668, 0, 659, 31, 22]]
5
66
#! /usr/bin/env python3 # -*- coding:utf-8 -*- def product_many(N): if 0 in N: return 0 ans = 1 for x in N: if (10 ^ 18 / ans) < x: return -1 ans *= x if ans > 10 ^ 18: return -1 return ans def main(): _ = input() N = list(map(int, input().split())) print(product_...
#! /usr/bin/env python3 # -*- coding:utf-8 -*- def product_many(N): if 0 in N: return 0 ans = 1 for x in N: if (10 ** 18 / ans) < x: return -1 ans *= x if ans > 10 ** 18: return -1 return ans def main(): _ = input() N = list(map(int, input().split())) print(product_...
[["-", 0, 57, 15, 666, 0, 23, 0, 657, 17, 140], ["+", 15, 666, 0, 23, 0, 657, 31, 657, 17, 578], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 140], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 578]]
5
96
from sys import stdin N = int(stdin.readline().rstrip()) A = list(map(int, stdin.readline().rstrip().split())) result = 1 if 0 in A: print(0) exit() for i in A: result = result * i if result > 10**18: result = -1 exit() print(result)
from sys import stdin N = int(stdin.readline().rstrip()) A = list(map(int, stdin.readline().rstrip().split())) result = 1 if 0 in A: print(0) exit() for i in A: result = result * i if result > 10**18: print(-1) exit() print(result)
[["-", 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
84
#include <cmath> #include <iostream> using namespace std; int main() { int N; cin >> N; double ans = 0; long long ans2 = 1; bool Zero = false; for (int i = 0; i < N; i++) { long long A; cin >> A; ans2 *= A; if (A > 0) ans += log10(A); else Zero = true; } if (Zero) co...
#include <cmath> #include <iostream> using namespace std; int main() { int N; cin >> N; double ans = 0; long long ans2 = 1; bool Zero = false; for (int i = 0; i < N; i++) { long long A; cin >> A; ans2 *= A; if (A > 0) ans += log10(A); else Zero = true; } if (Zero) co...
[["-", 12, 23, 0, 41, 15, 16, 12, 16, 17, 18], ["+", 12, 23, 0, 41, 15, 16, 12, 16, 17, 19]]
1
121
from math import log10 N = int(input()) A = list(map(int, input().split())) s = 1 threshold = 10**18 if 0 in A: print(0) else: for a in A: s *= a if s > threshold: print(-1) break print(a) else: print(s)
from math import log10 N = int(input()) A = list(map(int, input().split())) s = 1 threshold = 10**18 if 0 in A: print(0) else: for a in A: s *= a if s > threshold: print(-1) break else: print(s)
[["-", 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
77
#define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) v.begin(), v.end() typedef long long ll; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; ...
#define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) v.begin(), v.end() typedef long long ll; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; ...
[["-", 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
223
n = int(input()) *arr, = map(int, input().split()) res = 1 for i in range(n): res *= arr[i] if res > 10 ** 18: break print(res if res <= 10 ** 18 else - 1)
n = int(input()) *arr, = map(int, input().split()) arr.sort() res = 1 for i in range(n): res *= arr[i] if res > 10 ** 18: break print(res if res <= 10 ** 18 else - 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
62
import sys def main(): n, *a = map(int, sys.stdin.read().split()) res = 1 for x in a: res *= x if res > 10**18: print(-1) return print(res) if __name__ == '__main__': main()
import sys def main(): n, *a = map(int, sys.stdin.read().split()) a.sort() res = 1 for x in a: res *= x if res > 10**18: print(-1) return print(res) if __name__ == '__main__': main()
[["+", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
66
n = int(input()) a = map(lambda x:int(x), input().split()) s = 1 ten18 = 10**18 over = False for b in a: if not over: s *= b if s > ten18: #print(-1) over = True if b == 0: over = False break if over: print(-1) else: print(s)
n = int(input()) a = map(lambda x:int(x), input().split()) s = 1 ten18 = 10**18 over = False for b in a: if not over: s *= b if s > ten18: #print(-1) over = True if b == 0: s = 0 over = False break if over: print(-1) else: print(s)
[["+", 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
83
import sys import math sys.setrecursionlimit(10 ** 8) input = sys.stdin.readline def main(): K = int(input()) s = list(map(int, input().split())) prod = 1 a = 10 ** 18 if 0 in s: print(0) sys.exit() for k in range(K): prod = prod * s[k] if prod >= a: print(-1) sys.exit() ...
import sys import math sys.setrecursionlimit(10 ** 8) input = sys.stdin.readline def main(): K = int(input()) s = list(map(int, input().split())) prod = 1 a = 10 ** 18 if 0 in s: print(0) sys.exit() for k in range(K): prod = prod * s[k] if prod > a: print(-1) sys.exit() ...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
116
n=int(input()) k=list(map(int,input().split())) res=1 for x in k: res*=x if(res>10**18): print(-1) break else: print(res)
n=int(input()) k=list(map(int,input().split())) res=1 k.sort() for x in k: res*=x if(res>10**18): print(-1) break else: print(res)
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
57
// Problem : B - Multiplication 2 // Contest : AtCoder - AtCoder Beginner Contest 169 // URL : https://atcoder.jp/contests/abc169/tasks/abc169_b // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container...
// Problem : B - Multiplication 2 // Contest : AtCoder - AtCoder Beginner Contest 169 // URL : https://atcoder.jp/contests/abc169/tasks/abc169_b // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container...
[["-", 8, 9, 0, 7, 8, 9, 0, 43, 0, 21], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 0, 35], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78], ["+", 8, 9, 0, 1, 0, 16, 12, 74, 0, 24], ["+", 0, 1, 0, 16, 12, 74, 39, 77, 39, 40], ["+", 8, 9, 0, 1, 0, 16, 12, 74, 0, 25]]
1
463
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <tuple> #include <vector> using namespace std; #define rep(i, n) for (int64_t i = 0; i < (n); i++) #define irep(i, n) for (int64_t i = 0; i <= (n...
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <tuple> #include <vector> using namespace std; #define rep(i, n) for (int64_t i = 0; i < (n); i++) #define irep(i, n) for (int64_t i = 0; i <= (n...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40]]
1
177
n = int(input()) ans = 1 v = [] v = [int(x) for x in input().split()] sorted(v) for x in v: ans = ans*x if ans > 1e18: break if ans > 1e18: print(-1) else : print(ans)
n = int(input()) ans = 1 v = [] v = [int(x) for x in input().split()] v.sort() for x in v: ans = ans*x if ans > 1e18: break if ans > 1e18: print(-1) else : print(ans)
[["-", 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, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
69
n=int(input()) a = [int(i) for i in input().split() if i!="1"] if 0 in a: print(0) ans=1 for aa in a: ans=ans*aa if ans>10**18: print(-1) break else: print(ans)
n=int(input()) a = [int(i) for i in input().split() if i!="1"] if 0 in a: print(0) else: ans=1 for aa in a: ans=ans*aa if ans>10**18: print(-1) break else: print(ans)
[["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102]]
5
73
#include <bits/stdc++.h> #define xx first #define yy second #define D if (0) #define cerr D cerr using namespace std; typedef long long ll; template <typename T> vector<T> read_n(ll n) { vector<T> ret(n); for (ll i = 0; i < n; i++) cin >> ret[i]; return ret; } template <typename iter> void dump(iter begin,...
#include <bits/stdc++.h> #define xx first #define yy second #define D if (0) #define cerr D cerr using namespace std; typedef long long ll; template <typename T> vector<T> read_n(ll n) { vector<T> ret(n); for (ll i = 0; i < n; i++) cin >> ret[i]; return ret; } template <typename iter> void dump(iter begin,...
[["+", 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
248
#include <bits/stdc++.h> #define rep2(x, fr, to) for (int x = (fr); x < (to); x++) #define rep(x, to) for (int x = 0; x < (to); x++) #define repr(x, fr, to) for (int x = (fr); x >= (to); x--) #define all(c) c.begin(), c.end() #define sz(v) (int)v.size() using namespace std; typedef long long ll; typedef vector<int> V...
#include <bits/stdc++.h> #define rep2(x, fr, to) for (int x = (fr); x < (to); x++) #define rep(x, to) for (int x = 0; x < (to); x++) #define repr(x, fr, to) for (int x = (fr); x >= (to); x--) #define all(c) c.begin(), c.end() #define sz(v) (int)v.size() using namespace std; typedef long long ll; typedef vector<int> V...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 85], ["-", 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]]
1
283
N = int(input()) A = map(int, input().split()) limit = 10**18+1 mul = 1 if 0 in A: print("0") else: for i in A: mul *= i if mul >= limit: print("-1") break if mul < limit: print(mul)
N = int(input()) A = list(map(int, input().split())) limit = 10**18+1 mul = 1 if 0 in A: print("0") else: for i in A: mul *= i if mul >= limit: print("-1") break if mul < limit: 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
74
def solve(): n=int(input()) a=list(map(int,input().split())) ans=1 a.sort() for i in a: ans*=i if(ans>=1000000000000000000): print("-1") return print(ans) solve()
def solve(): n=int(input()) a=list(map(int,input().split())) ans=1 a.sort() for i in a: ans*=i if(ans>1000000000000000000): print(-1) return print(ans) solve()
[["-", 8, 196, 0, 57, 15, 23, 0, 666, 667, 20], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 667, 47], ["-", 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], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612]]
5
67
if __name__ == '__main__': a = int(input()) b = [int(i) for i in input().split()] ans = 1 b.sort(reverse=True) if 0 in b: ans = 0 else: for i in range(len(b)): ans *= i if ans > 10 ** 18: ans = -1 break print(ans)
if __name__ == '__main__': a = int(input()) b = [int(i) for i in input().split()] ans = 1 b.sort(reverse=True) if 0 in b: ans = 0 else: for i in range(len(b)): ans *= b[i] if ans > 10 ** 18: ans = -1 break print(ans)
[["+", 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, 0, 73]]
5
84
N = int(input()) NList = list(map(int, input().split())) NList.sort() result = 1 for i in range(N): result *= NList[i] if result > 10 ** 18: print('-1') break if result > 10 ** 18: print('-1') else: print(result)
N = int(input()) NList = list(map(int, input().split())) NList.sort() result = 1 for i in range(N): result *= NList[i] if result > 10 ** 18: break if result > 10 ** 18: print('-1') else: print(result)
[["-", 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]]
5
80
N = input() A = list(map(int,input().split())) A.sort() ans = 1 for a in A: ans *= a if ans >= 10**18: ans = -1 break print(ans)
N = input() A = list(map(int,input().split())) A.sort() ans = 1 for a in A: ans *= a 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
54
N=int(input()) A=list(map(int,input().split())) for i in range(N): if A[i]==0: print(0) ans=1 for a in A: ans*=a if (ans>10**18): print(-1) exit() print(ans)
N=int(input()) A=list(map(int,input().split())) for i in range(N): if A[i]==0: print(0) exit() ans=1 for a in A: ans*=a 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
77
n = int(input()) a = map(int, input().split()) now = 1 if 0 in a: print("0") exit() for one in a: now *= one if now > 1e18: print("-1") exit() print(now)
n = int(input()) a = list(map(int, input().split())) now = 1 if 0 in a: print("0") exit() for one in a: now *= one if now > 1e18: print("-1") exit() print(now)
[["+", 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
65
import sys 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) sys.exit() print(ans)
import sys 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) sys.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
69
n = int(input()) k = list(map(int, input().split())) import collections c = collections.Counter(k) re = 1 if c[0] == 0: for i in range(n): re = re * k[i] if re >= 10**18: print(-1) exit() print(re) else: print(0)
n = int(input()) k = list(map(int, input().split())) import collections c = collections.Counter(k) re = 1 if c[0] == 0: for i in range(n): re = re * k[i] if re > 10**18: print(-1) exit() print(re) else: print(0)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
87
N = int(input()) A = sorted(list(map(int, input().split())), reverse = True) if 0 in A: print(0) else: val = 1 for a in A: val *= a if val >= 10**18: val = -1 break print(val)
N = int(input()) A = sorted(list(map(int, input().split())), reverse = True) if 0 in A: print(0) else: val = 1 for a in A: val *= a if val > 10**18: val = -1 break print(val)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
70
n=int(input()) a=list(map(int, input().split())) ans=1 f=True for i in a: ans*=i if ans>10**18: f=False break if f: print(ans) else: print(-1)
n=int(input()) a=sorted(list(map(int, input().split()))) ans=1 f=True for i in a: ans*=i if ans>10**18: f=False break if f: print(ans) else: print(-1)
[["+", 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
64
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <iostream> #include <list> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <unordered_map> #include <vector> // #include "boost/algorithm...
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <iostream> #include <list> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <unordered_map> #include <vector> // #include "boost/algorithm...
[["+", 12, 16, 31, 16, 31, 2, 3, 4, 0, 25], ["+", 51, 16, 12, 16, 31, 16, 12, 2, 63, 22], ["+", 12, 16, 31, 16, 12, 2, 3, 4, 0, 24]]
1
543
import sys N = int(input()) A = [int(a) for a in input().split()] for a in A: if(a==0): print(0) sys.exit() ans = 1 for a in A: ans *= a if(ans >= 1000000000000000000) : print(-1) sys.exit() print(ans)
import sys N = int(input()) A = [int(a) for a in input().split()] for a in A: if(a==0): print(0) sys.exit() ans = 1 for a in A: ans *= a if(ans > 1000000000000000000) : print(-1) sys.exit() print(ans)
[["-", 8, 196, 0, 57, 15, 23, 0, 666, 667, 20], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 667, 47]]
5
81
import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { @SuppressWarnings("resource") Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long[] a = new long[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextLong(); if (a[i...
import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { @SuppressWarnings("resource") Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long[] a = new long[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextLong(); if (a[...
[["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 35]]
3
213
n = int(input()) a = list(map(int, input().split())) maxi = int(1e18) ans = 1 for x in a: ans *= x if ans > maxi: ans = -1 break print(ans)
n = int(input()) a = list(map(int, input().split())) a.sort() maxi = int(1e18) ans = 1 for x in a: ans *= x if ans > maxi: 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
56
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using pli = pair<ll, int>; using pil = pair<int, ll>; using uint = unsigned int; template <typename T> using Graph = vector<vector<T>>; const ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using pli = pair<ll, int>; using pil = pair<int, ll>; using uint = unsigned int; template <typename T> using Graph = vector<vector<T>>; const ...
[["+", 8, 9, 0, 43, 49, 50, 51, 74, 0, 24], ["+", 0, 43, 49, 50, 51, 74, 39, 77, 39, 78], ["+", 8, 9, 0, 43, 49, 50, 51, 74, 0, 25], ["+", 12, 23, 0, 41, 15, 16, 12, 74, 0, 24], ["+", 0, 41, 15, 16, 12, 74, 39, 77, 39, 78], ["+", 12, 23, 0, 41, 15, 16, 12, 74, 0, 25]]
1
215
n = int(input()) a = list(map(int, input().split())) ans = 1 for i in a: ans *= i if ans >= 10**18: ans = -1 break if 0 in a: ans = 0 print(ans)
n = int(input()) a = list(map(int, input().split())) ans = 1 for i in a: ans *= i if ans > 10**18: ans = -1 break if 0 in a: ans = 0 print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
60
n=int(input()) a=list(map(int,input().split())) b=1 if 0 in a: print(0) exit() for i in range(n): print(b) b*=a[i] if b>10**18: print(-1) exit() print(b)
n=int(input()) a=list(map(int,input().split())) b=1 if 0 in a: print(0) exit() for i in range(n): b*=a[i] if b>10**18: print(-1) exit() print(b)
[["-", 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
77
N = int(input()) A = list(map(int, input().split())) m = 1 if 0 in A: print(0) for a in A: m *= a if m>10**18: print(-1) break else: print(m)
N = int(input()) A = list(map(int, input().split())) m = 1 if 0 in A: print(0) else: for a in A: m *= a if m>10**18: print(-1) break else: print(m)
[["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102]]
5
64
INF = 1000000000000000000 N = int(input()) flag = 1 l = list(map(int,input().split())) if 0 in l: print(0) import sys sys.exit() sum = 1 for i in l: sum = sum*i print(sum) if sum > INF: print(-1) flag = 0 break else: pass if flag: print(sum)
INF = 1000000000000000000 N = int(input()) flag = 1 l = list(map(int,input().split())) if 0 in l: print(0) import sys sys.exit() sum = 1 for i in l: sum = sum*i if sum > INF: print(-1) flag = 0 break else: pass if flag: print(sum)
[["-", 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
88
n=int(input()) arr=list(map(int,input().split())) t=1 for i in range(n): t*=arr[i] if arr[i]==0: t=0 break elif t>10**18: t=-1 break print(t)
n=int(input()) arr=list(map(int,input().split())) t=1 arr.sort() for i in range(n): t*=arr[i] if arr[i]==0: t=0 break elif t>10**18: t=-1 break print(t)
[["+", 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
70
n=int(input()) a=list(map(int,input().split())) ans=a[0] if 0 in a: print(0) exit() for i in range(1,n): ans*=a[i] if ans >= 10**18: print(-1) exit() print(ans)
n=int(input()) a=list(map(int,input().split())) ans=a[0] if 0 in a: print(0) exit() for i in range(1,n): ans=ans*a[i] if ans > 10**18: print(-1) exit() print(ans)
[["-", 0, 7, 8, 196, 0, 1, 0, 677, 17, 108], ["+", 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, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
78
ma = lambda :map(int,input().split()) ni = lambda:int(input()) import collections import math import itertools gcd = math.gcd n = ni() A = list(ma()) ans = 1 for a in A: ans*=a if ans>=10**18: ans = -1 break mi = min(A) if mi>0: print(ans) else: print(0)
ma = lambda :map(int,input().split()) ni = lambda:int(input()) import collections import math import itertools gcd = math.gcd n = ni() A = list(ma()) ans = 1 for a in A: ans*=a #print(ans) if ans>10**18: ans = -1 break mi = min(A) if mi>0: print(ans) else: print(0)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
94
<?php fscanf(STDIN, "%d", $n); $list = explode(" ", trim(fgets(STDIN))); $ans = 1; sort($list); foreach($list as $value){ $ans *= $value; if($ans >= 1000000000000000000){ echo -1; exit; } } echo $ans;
<?php fscanf(STDIN, "%d", $n); $list = explode(" ", trim(fgets(STDIN))); $ans = 1; sort($list); foreach($list as $value){ $ans *= $value; if($ans >= 1000000000000000001){ echo -1; exit; } } echo $ans;
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 612], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 612]]
6
77
N = int(input()) A = [int(i) for i in input().split()] res = 1 for i in A: res *= i if res > 10**18: print(res) res = -1 break if A.count(0) != 0: res = 0 print(res)
N = int(input()) A = [int(i) for i in input().split()] res = 1 for i in A: res *= i if res > 10**18: res = -1 break if A.count(0) != 0: res = 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, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
70
n = int(input()) A = list(map(int, input().split())) A.sort() sum = 1 for a in A: sum *= a if sum >= 10 ** 18: sum = -1 break print(sum)
n = int(input()) A = list(map(int, input().split())) A.sort() sum = 1 for a in A: sum *= a if sum > (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], ["+", 8, 196, 0, 57, 15, 666, 0, 23, 0, 24], ["+", 8, 196, 0, 57, 15, 666, 0, 23, 0, 25]]
5
57
n=int(input()) a= list(map(int, input().split())) ans=1 for i in a: ans*=i if ans>pow(10,18): print(-1) exit() elif ans==0: print(0) exit() print(ans)
n=int(input()) a= list(map(int, input().split())) a.sort() ans=1 for i in a: ans*=i if ans>pow(10,18): print(-1) exit() elif ans==0: print(0) 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
70
import math import bisect #[int(x) for x in input().split()] #map(int,input().split()) #for _ in range(int(input())): n=int(input()) l=[int(x) for x in input().split()] p=1 M=10**18 f=0 if 0 in l: print(0) else: for i in range(n): p*=l[i] if p>M: print(-1) f=1 if f==0: print(p)
import math import bisect #[int(x) for x in input().split()] #map(int,input().split()) #for _ in range(int(input())): n=int(input()) l=[int(x) for x in input().split()] p=1 M=10**18 f=0 if 0 in l: print(0) else: for i in range(n): p*=l[i] if p>M: print(-1) f=1 break if f==0: print(p)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
91
n = int(input()) s = str(input()) d = s.split() mod = 10 ** 18 ans = int(d[0]) d.pop(0) z = 0 if '0' in d: print(0) else: for i in d: i = int(i) ans *= i if ans > mod: print(-1) z = 1 if z == 1: pass else: print(ans)
n = int(input()) s = str(input()) d = s.split() mod = 10 ** 18 ans = int(d[0]) d.pop(0) z = 0 if '0' in d: print(0) else: for i in d: i = int(i) ans *= i if ans > mod: print(-1) z = 1 break if z == 1: pass else: print(ans)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
98
# -*- coding: utf-8 -*- import sys import math debug = False def log(text): if debug: print(text) def parse_input(lines_as_string = None): global debug lines = [] if lines_as_string is None: debug = False # for line in sys.stdin: # lines.append(line) lin...
# -*- coding: utf-8 -*- import sys import math debug = False def log(text): if debug: print(text) def parse_input(lines_as_string = None): global debug lines = [] if lines_as_string is None: debug = False # for line in sys.stdin: # lines.append(line) lin...
[["+", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
254
N = int(input()) nums = [int(i) for i in input().split()] border_num = 10 ** 18 if 0 in nums: output = 0 else : output = 1 for _ in nums : output *= _ if output >= border_num: output = -1 break print(output)
N = int(input()) nums = [int(i) for i in input().split()] border_num = 10 ** 18 if 0 in nums: output = 0 else : output = 1 for _ in nums : output *= _ if output > border_num: output = -1 break print(output)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
66
#b import sys N = int(input()) inf = 10**18 a = list(map(int, input().split())) ans = a[0] if 0 in a: print("0") sys.exit() for i in range(1,len(a)): ans = ans * a[i] if ans > inf: print(ans) print("-1") sys.exit() print(ans)
#b import sys N = int(input()) inf = 10**18 a = list(map(int, input().split())) ans = a[0] if 0 in a: print("0") sys.exit() for i in range(1,len(a)): ans = ans * a[i] if ans > inf: print("-1") sys.exit() print(ans)
[["-", 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
100
n = int(input()) ans = 1 an = list(map(int,input().split())) for i in an: if i == 0: ans = 0 if ans != 0: for i in range(n): ans = ans * an[i] if ans > 10**18: ans = -1 print(ans)
n = int(input()) ans = 1 an = list(map(int,input().split())) for i in an: if i == 0: ans = 0 if ans != 0: for i in range(n): ans = ans * an[i] if ans > 10**18: ans = -1 break print(ans)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
77
#B N = int(input()) A = map(int,input().split()) r = 1 if 0 in A: r = 0 else: for i in A: r = r*i if r > 10**18: r = -1 break else: pass print(r)
#B N = int(input()) A = list(map(int,input().split())) r = 1 if 0 in A: r = 0 else: for i in A: r = r*i if r > 10**18: r = -1 break else: pass print(r)
[["+", 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
65
#include <algorithm> #include <bitset> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unordered_set> #include <vector> using namespace std; #define ll long long #d...
#include <algorithm> #include <bitset> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unordered_set> #include <vector> using namespace std; #define ll long long #d...
[["-", 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, 22]]
1
424
n = int(input()) an = list(map(int, input().split())) s = 1 flg = False for a in an: s = s * a if s > 10**18 or s< 0: flg = True break if 0 in s: print(0) elif flg: print(-1) else: print(s)
n = int(input()) an = list(map(int, input().split())) s = 1 flg = False for a in an: s = s * a if s > 10**18 or s< 0: flg = True break if 0 in an: print(0) elif flg: print(-1) else: print(s)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
79
import sys N = input() list1 = list(map(int, input().split())) answer = 1 for i in list1: if i == 0: print(-1) sys.exit() for i in list1: answer *= i if answer > 10**18: print(-1) sys.exit() print(answer)
import sys N = input() list1 = list(map(int, input().split())) answer = 1 for i in list1: if i == 0: print(0) sys.exit() for i in list1: answer *= i if answer > 10**18: print(-1) sys.exit() print(answer)
[["-", 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
n=int(input()) a=sorted(map(int,input().split())) ans = 0 for x in a: if ans == 0 or ans == -1: break ans = ans * x if ans > 1000000000000000000: ans = -1 print(ans)
n=int(input()) a=sorted(map(int,input().split())) ans = 1 for x in a: if ans == 0 or ans == -1: break ans = ans * x if ans > 1000000000000000000: ans = -1 print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
62
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll typedef long double ld; typedef pair<int, int> pii; #define x first #define y second const int INF = 1e18; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; int ans = 1; while (n-...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll typedef long double ld; typedef pair<int, int> pii; #define x first #define y second const int INF = 1e18; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; int ans = 1; while (n-...
[["+", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95]]
1
141
#include <bits/stdc++.h> using namespace std; using Int = long long; int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0); // int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv // ./prog.exe") >> 8), 0); int main() { int N; cin >> N; ve...
#include <bits/stdc++.h> using namespace std; using Int = long long; int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0); // int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv // ./prog.exe") >> 8), 0); int main() { int N; cin >> N; ve...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
159
input() nums = map(int, input().split(' ')) sum = 1 for num in nums: sum *= num if sum > 1e18: print(-1) exit() print(sum)
input() nums = map(int, input().split(' ')) sum = 1 for num in sorted(nums): sum *= num if sum > 1e18: print(-1) exit() print(sum)
[["+", 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
48
N = int(input()) A = list(map(int, input().split())) num = 1 for i in range(N): num *= A[i] if num > 10 ** 18: num = -1 break print(num)
N = int(input()) A = list(map(int, input().split())) num = 1 A.sort() for i in range(N): num *= A[i] if num > 10 ** 18: num = -1 break print(num)
[["+", 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
58
from sys import exit n=int(input()) A=list(map(int,input().split())) A.sort() tmp=1 for a in A: tmp*=a if tmp>10**8: print("-1") exit() print(tmp)
from sys import exit n=int(input()) A=list(map(int,input().split())) A.sort() tmp=1 for a in A: tmp*=a if tmp>10**18: print("-1") exit() print(tmp)
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]]
5
65
#pragma region Modefs #define retword "-1" constexpr long long MAXCOMB = 202020; constexpr long long MOD = 1000000007; constexpr long double EPS = 1e-9; #pragma endregion //--MACROS--------------------------------- #pragma region Macros #include <bits/stdc++.h> #define SORT(x) sort((x).begin(), (x).end()) #define RSORT...
#pragma region Modefs #define retword "-1" constexpr long long MAXCOMB = 202020; constexpr long long MOD = 1000000007; constexpr long double EPS = 1e-9; #pragma endregion //--MACROS--------------------------------- #pragma region Macros #include <bits/stdc++.h> #define SORT(x) sort((x).begin(), (x).end()) #define RSORT...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
2,042
import sys sys.setrecursionlimit(10**9) def main(): N = int(input()) A = list(map(int,input().split())) ans = 1 for a in A: ans *= a if ans > 10**18: print(-1) exit() print(ans) if __name__ == "__main__": main()
import sys sys.setrecursionlimit(10**9) def main(): N = int(input()) A = list(map(int,input().split())) A.sort() ans = 1 for a in A: ans *= a if ans > 10**18: print(-1) exit() print(ans) if __name__ == "__main__": main()
[["+", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
80
N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) exit() A.sort(reverse=True) print(A) result = A[0] for a in A[1:]: if result * a > 10**18: print(-1) exit() else: result = result * a print(result)
N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) exit() A.sort(reverse=True) result = A[0] for a in A[1:]: if result * a > 10**18: print(-1) exit() else: result = result * a print(result)
[["-", 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
92
import sys readline = sys.stdin.readline readlines = sys.stdin.readlines ns = lambda: readline().rstrip() # input string ni = lambda: int(readline().rstrip()) # input int nm = lambda: map(int, readline().split()) # input multiple int nl = lambda: list(map(int, readline().split())) # input multiple int to list n = ni...
import sys readline = sys.stdin.readline readlines = sys.stdin.readlines ns = lambda: readline().rstrip() # input string ni = lambda: int(readline().rstrip()) # input int nm = lambda: map(int, readline().split()) # input multiple int nl = lambda: list(map(int, readline().split())) # input multiple int to list n = ni...
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
127