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> using namespace std; typedef long long ll; ll mod = 1e9 + 0LL; ll MOD = 1e18 + 0LL; double pi = acos(-1); int main() { int cs = 1; // scanf("%d",&cs); while (cs--) { int n, i; cin >> n; ll mul = 1LL; ll arr[n]; for (i = 0; i < n; i++) { cin >> arr[i]; if...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll mod = 1e9 + 0LL; ll MOD = 1e18 + 0LL; double pi = acos(-1); int main() { int cs = 1; // scanf("%d",&cs); while (cs--) { int n, i; cin >> n; ll mul = 1LL; ll arr[n]; for (i = 0; i < n; i++) { cin >> arr[i]; if...
[["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 52, 8, 9, 0, 43, 39, 86, 39, 40]]
1
207
n = int(input()) a = list(map(int,input().split())) ans = 1 for i in range(n): ans = ans * a[i] if ans > 10**18: ans = -1 break print(ans)
n = int(input()) a = list(map(int,input().split())) ans = 1 a.sort() for i in range(n): ans = ans * a[i] if ans > 10**18: 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
60
#include <algorithm> #include <bits/stdc++.h> #include <unordered_set> #define ll long long using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<int> d(n); int z = 0; for (int i = 0; i < n; i++) { cin >> d[i]; if (d[i] == 0) { z++;...
#include <algorithm> #include <bits/stdc++.h> #include <unordered_set> #define ll long long using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll n; cin >> n; vector<ll> d(n); int z = 0; for (int i = 0; i < n; i++) { cin >> d[i]; if (d[i] == 0) { z++; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13]]
1
172
n = int(input()) a = [] a = map(int,input().split()) #a = sorted(a) ans = 1 for val in a: ans *= val if ans > 10**18: print(-1) break else: print(ans)
n = int(input()) a = [] a = map(int,input().split()) a = sorted(a) ans = 1 for val in a: ans *= val if ans > 10**18: print(-1) break else: print(ans)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
57
#include <bits/stdc++.h> using namespace std; long long n; signed main() { cin >> n; vector<long double> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a.begin(), a.end()); long double s = 10e18; long double ans = 1; for (int i = 0; i < n; i++) { ans *= a[i]; if (ans > s) { co...
#include <bits/stdc++.h> using namespace std; long long n; signed main() { cin >> n; vector<long double> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a.begin(), a.end()); long double s = 1e18; long double ans = 1; for (int i = 0; i < n; i++) { ans *= a[i]; if (ans > s) { cou...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
133
n = int(input()) a = list(map(int, input().split())) a.sort(reverse=True) ans = 1 if 0 in a: ans = 0 print(ans) exit() else: for i in a: ans *= i if ans > 10**18: print(-1) exit()
n = int(input()) a = list(map(int, input().split())) a.sort(reverse=True) ans = 1 if 0 in a: ans = 0 print(ans) exit() else: for i in a: ans *= i if ans > 10**18: print(-1) exit() 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, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
76
#include <stdio.h> long long a[100010]; int main() { int n, i; scanf("%d", &n); for (i = 0; i < n; i++) { } scanf("%lld", &a[i]); int zero = 0; for (i = 0; i < n; i++) if (a[i] == 0) zero++; if (zero > 0) { printf("0\n"); return 0; } long long prod = 1; for (int i = 0; i < n; i+...
#include <stdio.h> long long a[100010]; int main() { int n, i; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%lld", &a[i]); int zero = 0; for (i = 0; i < n; i++) if (a[i] == 0) zero++; if (zero > 0) { printf("0\n"); return 0; } long long prod = 1; for (int i = 0; i < n; i++) {...
[["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 45], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
0
173
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; #define mod ((int)1e9 + 7) #define lim 1000000000000000007 #define lim1 18446744073709551615 // Unsigned #define sq(a) ((a) * (a)) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define mms(v, i) memset...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; #define mod ((int)1e9 + 7) #define lim 1000000000000000007 #define lim1 18446744073709551615 // Unsigned #define sq(a) ((a) * (a)) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define mms(v, i) memset...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]]
1
601
n = int(input()) a = list(map(int, input().split())) ans = 1 a.sort() if 0 in a: for x in range(n): ans *= a[x] if ans > 10**18: ans = -1 break else: ans = 0 print(ans)
n = int(input()) a = list(map(int, input().split())) ans = 1 a.sort(reverse=True) if 0 not in a: for x in range(n): ans *= a[x] if ans > 10**18: ans = -1 break else: ans = 0 print(ans)
[["+", 0, 1, 0, 652, 3, 4, 0, 653, 141, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 0, 32], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 51, 146], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 699]]
5
73
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<bool> vb; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef map<int, int> mii; typedef map<ll, ll> mll; typedef vector<pii> vii; typedef vector<pl...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<bool> vb; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef map<int, int> mii; typedef map<ll, ll> mll; typedef vector<pii> vii; typedef vector<pl...
[["-", 31, 23, 0, 16, 31, 23, 0, 16, 17, 20], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 17, 47], ["-", 31, 23, 0, 16, 12, 23, 0, 16, 17, 20], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 17, 47]]
1
332
#include <bits/stdc++.h> using namespace std; #define sswap(x, y) \ { \ x += y; \ y = x - y; ...
#include <bits/stdc++.h> using namespace std; #define sswap(x, y) \ { \ x += y; \ y = x - y; ...
[["-", 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
220
#include <bitset> #include <complex> #include <cstdio> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <utility> #include <vector> // #include<ratio> #include <algorithm> // #include<numeric> // #include<limits> // #include...
#include <bitset> #include <complex> #include <cstdio> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <utility> #include <vector> // #include<ratio> #include <algorithm> // #include<numeric> // #include<limits> // #include...
[["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 24], ["+", 12, 16, 31, 74, 39, 77, 39, 86, 0, 96], ["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 25]]
1
1,219
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <string.h> #include <vector> typedef long long LL; const long long INF = 1LL << 60; using namespace std; int main() { int N; cin >> N; vector<LL> A(N); for (int i = 0; i < N; i++) { cin >> A.at(i); } sort(A.begin()...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <string.h> #include <vector> typedef long long LL; const long long INF = 1LL << 60; using namespace std; int main() { int N; cin >> N; vector<LL> A(N); for (int i = 0; i < N; i++) { cin >> A.at(i); } sort(A.begin()...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
180
n=int(input()) a=list(map(int,input().split())) x=1 M=10**18 for i in a: x*=i if x>M: print(-1) exit() print(x)
n=int(input()) a=list(map(int,input().split())) a.sort() x=1 M=10**18 for i in a: x*=i if x>M: print(-1) 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
58
n = int(input()) li = list(map(int,input().split())) MAX = 10 ** 18 li.sort() ans = 1 if li[0] == 0: ans = 0 else: for i in li: ans *= i if ans >= MAX: ans = -1 break print(ans)
n = int(input()) li = list(map(int,input().split())) MAX = 10 ** 18 li.sort() ans = 1 if li[0] == 0: ans = 0 else: for i in li: ans *= i if ans > MAX: 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
73
#include <bits/stdc++.h> using namespace std; int main() { long long N; cin >> N; vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A.at(i); } sort(A.begin(), A.end()); int64_t ans = 1; if (A.at(0) == 0) { cout << 0 << endl; exit(0); } int64_t Y = 1; for (int i = 0; i < 18; i+...
#include <bits/stdc++.h> using namespace std; int main() { long long N; cin >> N; vector<long long> A(N); for (int i = 0; i < N; i++) { cin >> A.at(i); } sort(A.begin(), A.end()); int64_t ans = 1; if (A.at(0) == 0) { cout << 0 << endl; exit(0); } long long Y = 1; for (int i = 0; i ...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
192
#include <stdio.h> int main() { const long long lim = 2000000000000000000ll; int N; scanf("%d", &N); long long A = 1; while (N--) { long long a; scanf("%lld", &a); if (A > lim / a) A = lim; else A *= a; if (A > lim) A = lim; } if (A > lim / 2) A = -1; printf("...
#include <stdio.h> int main() { const long long lim = 2000000000000000000ll; int N; scanf("%d", &N); long long A = 1; while (N--) { long long a; scanf("%lld", &a); if (a && A > lim / a) A = lim; else A *= a; if (A > lim) A = lim; } if (A > lim / 2) A = -1; pri...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
107
n = int(input()) num = list(map(int, input().split())) limit = 10**18 num.sort() result = num[0] if result == 0: print(0) else: for i in num[1:]: result *= i if result > limit: exit() print(result)
n = int(input()) num = list(map(int, input().split())) limit = 10**18 num.sort() result = num[0] if result == 0: print(0) else: for i in num[1:]: result *= i if result > limit: print(-1) exit() 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, 664, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
76
n = int(input()) a = list(map(int,input().split())) ans = 1 for i in range(n): if a[i] == 0: print(-1) exit() for i in range(n): ans *= a[i] if ans > 1e18: print(-1) exit() if ans > 1e18: print(-1) else: print(ans)
n = int(input()) a = list(map(int,input().split())) ans = 1 for i in range(n): if a[i] == 0: print(0) exit() for i in range(n): ans *= a[i] if ans > 1e18: print(-1) exit() if ans > 1e18: 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
95
#include <bits/stdc++.h> #define ALL(obj) begin(obj), end(obj) #define debug(x) cerr << #x << ": " << x << '\n' using namespace std; template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); } template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(...
#include <bits/stdc++.h> #define ALL(obj) begin(obj), end(obj) #define debug(x) cerr << #x << ": " << x << '\n' using namespace std; template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); } template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
354
import sys input = sys.stdin.readline N = int(input()) x = sorted(list(map(int, input().split()))) print(x) t = 1 for num in x: t = t * num if t > 10 ** 18: print(-1) sys.exit() if (t > 10 ** 18): print(-1) else: print(t)
import sys input = sys.stdin.readline N = int(input()) x = sorted(list(map(int, input().split()))) t = 1 for num in x: t = t * num if t > 10 ** 18: print(-1) sys.exit() if (t > 10 ** 18): print(-1) else: print(t)
[["-", 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
91
import sys n = int(input()) a_list = list(map(int,input().split())) if 0 in a_list: print(0) sys.exit() else: cul = 1 for a in a_list: cul *= a if cul > 10 ** 18: print(-1) break print(cul)
import sys n = int(input()) a_list = list(map(int,input().split())) if 0 in a_list: print(0) sys.exit() else: cul = 1 for a in a_list: cul *= a if cul > 10 ** 18: print(-1) sys.exit() print(cul)
[["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
71
import sys n = int(input()) a = list(map(int,input().split())) a.sort() if 0 in a: print(0) else: cur = 1 for x in a: cur *= a if cur > 10 ** 18: print(-1) sys.exit() print(cur)
import sys n = int(input()) a = list(map(int,input().split())) a.sort() if 0 in a: print(0) else: cur = 1 for x in a: cur *= x if cur > 10 ** 18: print(-1) sys.exit() print(cur)
[["-", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22]]
5
75
N = int(input()) A = map(int, input().split()) if 0 in A: print(0) exit() res = 1 for a in A: res *= a if res > 10 ** 18: res = -1 break print(res)
N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) exit() res = 1 for a in A: res *= a if res > 10 ** 18: res = -1 break print(res)
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
61
import sys n=int(input()) a=input() a0=a.split() l=list() b=1 q= "0" in a0 if q==True: print(0) sys.exit() for i in range (n): a1=int(a0[i]) b=b*a1 if b>10**18: print(-1) sys.exit()
import sys n=int(input()) a=input() a0=a.split() l=list() b=1 q= "0" in a0 if q==True: print(0) sys.exit() for i in range (n): a1=int(a0[i]) b=b*a1 if b>10**18: print(-1) sys.exit() print(b)
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
90
#include <bits/stdc++.h> using namespace std; int main() { long long n = 0; cin >> n; long long a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { cout << "0"; return 0; } } long long ans = 1; for (long long i = 0; i < n; i++) { if (ans <= 100000000000000000...
#include <bits/stdc++.h> using namespace std; int main() { long long n = 0; cin >> n; long long a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { cout << "0"; return 0; } } long long ans = 1; for (long long i = 0; i < n; i++) { if (a[i] <= 10000000000000000...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73]]
1
128
N = int(input()) A_s = list(map(int, input().split())) seki = 1 if (A_s.count(0) > 0): print(0) exit() for i in range(N): seki *= A_s[i] print(seki) if (seki > 10 ** 18): print(-1) exit() print(seki)
N = int(input()) A_s = list(map(int, input().split())) seki = 1 if (A_s.count(0) > 0): print(0) exit() for i in range(N): seki *= A_s[i] if (seki > 10 ** 18): print(-1) exit() print(seki)
[["-", 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
86
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = unsigned long long; using P = pair<int, int>; const ll mod = 1e18; int main() { int n; cin >> n; vector<ll> a(n); rep(i, n) { cin >> a[i]; if (a[i] == 0) { cout << 0 << endl; return 0; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = unsigned long long; using P = pair<int, int>; const ll mod = 1e18; int main() { int n; cin >> n; vector<ll> a(n); rep(i, n) { cin >> a[i]; if (a[i] == 0) { cout << 0 << endl; return 0; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
143
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) const int64_t MX = 1e18; int main() { int N; cin >> N; vector<int64_t> A(N); for (int i = 0; i < N; i++) { cin >> A.at(i); } rep(i, N) { if (A.at(i) == 0) { cout << 0 << endl; return 0; } ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) const int64_t MX = 1e18; int main() { int N; cin >> N; vector<int64_t> A(N); for (int i = 0; i < N; i++) { cin >> A.at(i); } rep(i, N) { if (A.at(i) == 0) { cout << 0 << endl; return 0; } ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
145
import numpy as np N=int(input()) A=np.ones(N) a=np.ones(N) A=map(int,input().rstrip().split()) a=sorted(A,reverse=True) a_product=1 flag_1e18=False flag_0=False if a[N-1]==0: flag_0=True for i in range(0,N,1): a_product=a_product*a[i] if a_product>1e18: flag_1e18=True break else: continue ...
import numpy as np N=int(input()) A=np.ones(N) a=np.ones(N) A=map(int,input().rstrip().split()) a=sorted(A,reverse=True) a_product=1 flag_1e18=False flag_0=False if a[N-1]==0: flag_0=True for i in range(0,N,1): a_product=a_product*a[i] if a_product>1e18: flag_1e18=True break else: continue ...
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
139
// Jacker0031 // packages #if __has_include("extra.cpp") && __has_include(<stdint.h>) #include "extra.cpp" #else #include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip>...
// Jacker0031 // packages #if __has_include("extra.cpp") && __has_include(<stdint.h>) #include "extra.cpp" #else #include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip>...
[["+", 0, 1, 0, 16, 31, 16, 12, 74, 0, 24], ["+", 0, 16, 31, 16, 12, 74, 39, 77, 39, 78], ["+", 0, 1, 0, 16, 31, 16, 12, 74, 0, 25]]
1
635
#include <iostream> using namespace std; int main() { int n; cin >> n; long long int sum; long long int a; bool zero = false; bool over = false; cin >> a; sum = a; if (a == 0) { cout << 0 << endl; return 0; } for (int i = 0; i < n - 1; i++) { cin >> a; // 1000000000000000000 i...
#include <iostream> using namespace std; int main() { int n; cin >> n; long long int sum; long long int a; bool zero = false; bool over = false; cin >> a; sum = a; if (a == 0) { cout << 0 << endl; return 0; } for (int i = 0; i < n - 1; i++) { cin >> a; // 1000000000000000000 i...
[["-", 0, 14, 8, 9, 0, 57, 15, 339, 51, 22], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 51, 22], ["-", 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()) a = list(map(int,input().split())) is_zero = False for i in a: if i == 0: is_zero = True break if is_zero: print(0) else: p = 1 for i in p: p = p*i if p > 10**18: break if p > 10**18: p = -1 print(p)
n = int(input()) a = list(map(int,input().split())) is_zero = False for i in a: if i == 0: is_zero = True break if is_zero: print(0) else: p = 1 for i in a: p = p*i if p > 10**18: break if p > 10**18: p = -1 print(p)
[["-", 0, 57, 75, 76, 8, 196, 0, 7, 12, 22], ["+", 0, 57, 75, 76, 8, 196, 0, 7, 12, 22]]
5
87
N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) exit(0) ans = 1 for i in A: ans *= i if ans >= 10 ** 18: print(-1) exit(0) print(ans)
N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) exit(0) ans = 1 for i in A: ans *= i if ans > 10 ** 18: print(-1) exit(0) print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
69
const [_, input] = require("fs").readFileSync("/dev/stdin", "utf8").split("\n"); const MAX = 10 ** 18; const inputs = input.split(" ").map((s) => parseInt(s, 10)); if (inputs.includes(0)) { console.log(0); process.exit(0); } let curr = 1n; inputs.forEach((n) => { curr = curr * BigInt(n); if (curr > MAX) { ...
const [_, input] = require("fs").readFileSync("/dev/stdin", "utf8").split("\n"); const MAX = 10 ** 18; const inputs = input.split(" ").map((s) => parseInt(s, 10)); if (inputs.includes(0)) { console.log(0); process.exit(0); } let curr = 1n; inputs.forEach((n) => { curr = curr * BigInt(n); if (curr > MAX) { ...
[["-", 0, 1, 0, 2, 3, 3, 0, 2, 63, 22], ["-", 0, 2, 3, 3, 0, 2, 3, 3, 0, 24], ["+", 0, 2, 3, 3, 0, 2, 63, 558, 0, 131], ["+", 0, 2, 3, 3, 0, 2, 63, 558, 559, 560], ["+", 0, 2, 3, 3, 0, 2, 3, 3, 0, 24]]
2
149
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define sz(x) (int)((x).size()) #define all(x) (x).begin(), (x).end() #define FO(x) \ { \ freopen(#x ".in"...
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define sz(x) (int)((x).size()) #define all(x) (x).begin(), (x).end() #define FO(x) \ { \ freopen(#x ".in"...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
722
def main(): N=int(input()) a=list(map(int,input().split())) cal=1 if a.count(0)>=1: print(0) return for i in range(N): cal*=a[i] if cal>=10**18: print("-1") return print(cal) return main()
def main(): N=int(input()) a=list(map(int,input().split())) cal=1 if a.count(0)>=1: print(0) return for i in range(N): cal*=a[i] if cal>10**18: print("-1") return print(cal) return main()
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
84
#include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; #define ll long long #define mod 1000000007 #define vi vector<int> #define vll vector<ll> #define pb push_back ll power(int x, unsigned int y) { ll...
#include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; #define ll long long #define mod 1000000007 #define vi vector<int> #define vll vector<ll> #define pb push_back ll power(int x, unsigned int y) { ll...
[["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
234
// cout << char(i+48) << // endl;//なぜかaは47と得る時がある。+48で出力もaにできる。 cout << char(97) << // endl;//アスキーコードでaを出力 // sort(b.begin(), b.end());//bという配列を小さい方からソート // reverse(b.begin(), b.end());//bという配列をリターン // 10桁でdouble出力するパターン1 // printf("%.10f\n", ma); // 10桁でdouble出力するパターン2 // cout << fixed << setprecision(10); // cout...
// cout << char(i+48) << // endl;//なぜかaは47と得る時がある。+48で出力もaにできる。 cout << char(97) << // endl;//アスキーコードでaを出力 // sort(b.begin(), b.end());//bという配列を小さい方からソート // reverse(b.begin(), b.end());//bという配列をリターン // 10桁でdouble出力するパターン1 // printf("%.10f\n", ma); // 10桁でdouble出力するパターン2 // cout << fixed << setprecision(10); // cout...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
194
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; int main() { long long n; cin >> n; long long a[n + 10], i, prod = 1, zero = 0; for (i = 1; i <= n; i++) { c...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; int main() { long long n; cin >> n; long long a[n + 10], i, prod = 1, zero = 0; for (i = 1; i <= n; i++) { c...
[["-", 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
163
#include <algorithm> #include <iostream> #include <math.h> #include <queue> #include <string> #include <utility> #include <vector> #define INF 2e9 #define rep(i, m) for (int i = 0; i < m; i++) #define repn(i, n, m) for (int i = n; i < m; i++) using namespace std; int main() { int n; cin >> n; vector<long long i...
#include <algorithm> #include <iostream> #include <math.h> #include <queue> #include <string> #include <utility> #include <vector> #define INF 2e9 #define rep(i, m) for (int i = 0; i < m; i++) #define repn(i, n, m) for (int i = n; i < m; i++) using namespace std; int main() { int n; cin >> n; vector<long long i...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
160
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; ll GetDigit(ll num) { return log10(num) + 1; } // numの桁数を求める int main() { int N; cin >> N; vector<ll> A(N); rep(i, N) cin >> A[i]; ll total = 1; rep(i, N) { if (A[i] == 0) { co...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; ll GetDigit(ll num) { return log10(num) + 1; } // numの桁数を求める int main() { int N; cin >> N; vector<ll> A(N); rep(i, N) cin >> A[i]; ll total = 1; rep(i, N) { if (A[i] == 0) { co...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
162
#include "bits/stdc++.h" #define hhh cerr << "hhh" << endl #define see(x) cerr << (#x) << '=' << (x) << endl using namespace std; typedef long long ll; typedef pair<int, int> pr; inline int read() { int x = 0, f = 1; char c = getchar(); while (c != '-' && (c < '0' || c > '9')) c = getchar(); if (c == '-') ...
#include "bits/stdc++.h" #define hhh cerr << "hhh" << endl #define see(x) cerr << (#x) << '=' << (x) << endl using namespace std; typedef long long ll; typedef pair<int, int> pr; inline int read() { int x = 0, f = 1; char c = getchar(); while (c != '-' && (c < '0' || c > '9')) c = getchar(); if (c == '-') ...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13]]
1
268
import math N = int(input()) a_lis = list(map(int, input().split())) ans = 1 if 0 in a_lis: ans = -1 else: for i in a_lis: ans *= i if ans > pow(10, 18): ans = -1 break print(ans)
N = int(input()) a_lis = list(map(int, input().split())) ans = 1 if 0 in a_lis: ans = 0 else: for i in a_lis: ans *= i if ans > pow(10, 18): ans = -1 break print(ans)
[["-", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["-", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["-", 64, 196, 0, 1, 0, 662, 12, 664, 17, 33], ["-", 64, 196, 0, 1, 0, 662, 12, 664, 28, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612]]
5
68
#include <stdio.h> int main() { int n, i; long long int a[100000], c = 1; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%lld", &a[i]); if (a[i] == 0) { printf("0"); return 0; } } for (i = 0; i < n; i++) { if (a[i] <= 1000000000000000000 / c) { c *= a[i]; } else ...
#include <stdio.h> int main() { int n, i; long long int a[100000], c = 1; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%lld", &a[i]); if (a[i] == 0) { printf("0"); return 0; } } for (i = 0; i < n; i++) { if (a[i] <= 1000000000000000000 / c) { c *= a[i]; } else ...
[["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
0
144
n = int(input()) a = list(map(int, input().split())) if (a.include(0)): print(0) exit() MAX = 10 ** 18 ans = 1 for i in range(len(a)): ans *= a[i] if (ans > MAX): print(-1) exit() print(ans)
n = int(input()) a = list(map(int, input().split())) if (0 in a): print(0) exit() MAX = 10 ** 18 ans = 1 for i in range(len(a)): ans *= a[i] if (ans > MAX): print(-1) exit() print(ans)
[["-", 0, 57, 15, 23, 0, 652, 63, 319, 500, 22], ["-", 0, 57, 15, 23, 0, 652, 63, 319, 0, 131], ["-", 0, 57, 15, 23, 0, 652, 63, 319, 319, 22], ["-", 0, 57, 15, 23, 0, 652, 3, 4, 0, 24], ["-", 0, 57, 15, 23, 0, 652, 3, 4, 0, 25], ["+", 0, 656, 0, 57, 15, 23, 0, 666, 667, 267], ["+", 0, 656, 0, 57, 15, 23, 0, 666, 0, 22...
5
86
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long m = 1; int f = 0; int f2 = 0; vector<long long> vec(n); for (int i = 0; i < n; i++) { cin >> vec.at(i); if (vec.at(i) == 0) { f = 1; break; } if (vec.at(i) > 1000000000) { f2 = f2 + 1; ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long m = 1; int f = 0; int f2 = 0; vector<long long> vec(n); for (int i = 0; i < n; i++) { cin >> vec.at(i); if (vec.at(i) == 0) { f = 1; break; } if (vec.at(i) > 1000000000) { f2 = f2 + 1; ...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
235
n = int(input()) a = list(map(int,input().split())) if 0 in a: print(0) return ans = 1 for i in a: ans *= i if ans > 10**18: ans = -1 break 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: ans = -1 break print(ans)
[["-", 0, 656, 0, 57, 64, 196, 0, 37, 0, 38], ["+", 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
62
#include <bits/stdc++.h> using namespace std; constexpr long long INF = 1e18; int main() { long long ans = 1; int n; cin >> n; vector<long long> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a.begin(), a.end()); for (int i = 0; i < n; i++) { if (a[i] == 0) { cout << 0 << "\n";...
#include <bits/stdc++.h> using namespace std; constexpr long long INF = 1e18; int main() { long long ans = 1; int n; cin >> n; vector<long long> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a.begin(), a.end()); for (int i = 0; i < n; i++) { if (a[i] == 0) { cout << 0 << "\n";...
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 19]]
1
164
#include <bits/stdc++.h> using namespace std; #define pb push_back #define int long long #define endl "\n" #define pii pair<int, int> #define ff first #define ss second #define mii map<int, int> #define si set<int> #define sti stack<int> #define qi queue<int> #define vi vector<int> #define pq priority_queue<int> #defin...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define int long long #define endl "\n" #define pii pair<int, int> #define ff first #define ss second #define mii map<int, int> #define si set<int> #define sti stack<int> #define qi queue<int> #define vi vector<int> #define pq priority_queue<int> #defin...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
216
#include <bits/stdc++.h> using namespace ::std; #define int long long #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sax(x) cout << "!!!!!!!!!!! " << #x << " = " << x << '\n' #define inf (sizeof(int) == 4 ? (int)1E9 : (int)1E18) #define one(x) x.insert(x.begin(), 0); #define TCT...
#include <bits/stdc++.h> using namespace ::std; #define int long long #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sax(x) cout << "!!!!!!!!!!! " << #x << " = " << x << '\n' #define inf (sizeof(int) == 4 ? (int)1E9 : (int)1E18) #define one(x) x.insert(x.begin(), 0); #define TCT...
[["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 35], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
673
input() l = list(map(int, input().split())) res = 1 for x in l: res *= x if res > 10**18: print(-1) exit(0) print(res)
input() l = list(map(int, input().split())) l.sort() res = 1 for x in l: res *= x if res > 10**18: print(-1) exit(0) print(res)
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
51
N=int(input()) A=list(map(int, input().split())) sorted(A) if A[0] == 0: print(0) exit(0) ans = 1 for i in range(N): ans*=A[i] if(ans>1000000000000000000): print(-1) exit(0) print(ans)
N=int(input()) A=list(map(int, input().split())) A=sorted(A) if A[0] == 0: print(0) exit(0) ans = 1 for i in range(N): ans*=A[i] if(ans>1000000000000000000): print(-1) exit(0) print(ans)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32]]
5
82
/***"In the name of Allah(swt), the most gracious, most merciful. Allah(swt) * blesses with knowledge whom he wants."***/ /*** "ALHAMDULILLAH for Everything..." ***/ #include <bits/stdc++.h> using namespace std; #define fastt \ ios::sync_with_stdio(0);...
/***"In the name of Allah(swt), the most gracious, most merciful. Allah(swt) * blesses with knowledge whom he wants."***/ /*** "ALHAMDULILLAH for Everything..." ***/ #include <bits/stdc++.h> using namespace std; #define fastt \ ios::sync_with_stdio(0);...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
455
// If You think you are Bad...I'm your Dad #include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #define int long long #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
// If You think you are Bad...I'm your Dad #include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #define int long long #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
[["-", 31, 2, 3, 4, 0, 16, 12, 16, 31, 13], ["+", 31, 2, 3, 4, 0, 16, 12, 16, 31, 13]]
1
302
input() ans = 1 n = int(1e18) a = list(map(int, input().strip().split())) for i in a: ans *= i if ans > n: ans = -1 break if 0 in ans: ans = 0 print(ans)
input() ans = 1 n = int(1e18) a = list(map(int, input().strip().split())) for i in a: ans *= i if ans > n: ans = -1 break if 0 in a: ans = 0 print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
63
n = int(input()) a = list(map(int,input().split())) MX = 10**18 ans = 1 for x in a: if x == 0: print(0) exit(0) else: ans *= x if ans > MX: print(-1) exit(0) print(ans)
n = int(input()) a = list(map(int,input().split())) MX = 10**18 ans = 1 a.sort() for x in a: if x == 0: print(0) exit(0) else: ans *= x if ans > MX: print(-1) exit(0) 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
74
n = int(input()) a_array = [int(x) for x in input().split()] s = a_array[0] for a in a_array[1:]: s *= a if s > 10**18: s = -1 break print(s)
n = int(input()) a_array = sorted([int(x) for x in input().split()]) s = a_array[0] for a in a_array[1:]: s *= a if s > 10**18: s = -1 break print(s)
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
60
def main(): N=int(input()) A=list(map(int,input().split())) if A is 0: print(0) return p=1 for i in A: p=p*i if p>1000000000000000000: print(-1) return print(p) main()
def main(): N=int(input()) A=list(map(int,input().split())) if 0 in A: print('0') return p=1 for i in A: p=p*i if p>1000000000000000000: print(-1) return print(p) main()
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 0, 22], ["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 709], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 267], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655]]
5
71
#include <bits/stdc++.h> #define repl(i, l, r) for (int i = l; i < r; i++) #define rep(i, n) repl(i, 0, n) using namespace std; using ll = long long; using Graph = vector<vector<int>>; using P = pair<int, int>; const ll MX = 1e18; int main() { int n; cin >> n; ll ans = 1; bool ng = false; rep(i, n) { ll...
#include <bits/stdc++.h> #define repl(i, l, r) for (int i = l; i < r; i++) #define rep(i, n) repl(i, 0, n) using namespace std; using ll = long long; using Graph = vector<vector<int>>; using P = pair<int, int>; const ll MX = 1e18; int main() { int n; cin >> n; ll ans = 1; bool ng = false; rep(i, n) { ll...
[["-", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["-", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13], ["-", 8, 9, 0, 57, 64, 9, 0, 37, 0, 35]]
1
165
from functools import reduce from operator import mul n = int(input()) a = [int(x) for x in input().split()] a = sorted(a) ans = 1 for x in a: ans = ans * x if (ans > 10*18): ans = -1 break print(ans)
from functools import reduce from operator import mul n = int(input()) a = [int(x) for x in input().split()] a = sorted(a) ans = 1 for x in a: ans = ans * x if (ans > 1e18): ans = -1 break print(ans)
[["-", 0, 57, 15, 23, 0, 666, 0, 657, 31, 612], ["-", 0, 57, 15, 23, 0, 666, 0, 657, 17, 48], ["-", 0, 57, 15, 23, 0, 666, 0, 657, 12, 612], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 0, 531]]
5
71
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, a, b) for (ll i = (a); i < (b); i++) #define PER(i, a, b) for (ll i = (a); i >= (b); i--) #define rep(i, n) REP(i, 0, n) #define per(i, n) PER(i, n, 0) #define ALL(a) (a).begin(), (a).end() const ll INF = 1e18 + 18; const ll MAX = 200000...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, a, b) for (ll i = (a); i < (b); i++) #define PER(i, a, b) for (ll i = (a); i >= (b); i--) #define rep(i, n) REP(i, 0, n) #define per(i, n) PER(i, n, 0) #define ALL(a) (a).begin(), (a).end() const ll INF = 1e18 + 18; const ll MAX = 200000...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 79]]
1
252
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 #define pb push_back #define mp make_pair #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 #define pb push_back #define mp make_pair #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
[["-", 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
183
N = int(input()) A = list(map(int,input().split())) A.sort(reverse=True) ans=1 upper_limit = int(1e18) if A[-1]==0: print(0) exit() else: for i in range(N): ans*=A[i] if ans >= upper_limit: print(-1) exit() print(ans)
N = int(input()) A = list(map(int,input().split())) A.sort(reverse=True) ans=1 upper_limit = int(1e18) if A[-1]==0: print(0) exit() else: for i in range(N): ans*=A[i] if ans > upper_limit: print(-1) exit() print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
91
n = gets.to_i a = gets.split.map(&:to_i) ans = 1 a.each do |x| ans *= x if ans > 10**18 puts -1 exit end end puts ans
n = gets.to_i a = gets.split.map(&:to_i) ans = 1 a.sort.each do |x| ans *= x if ans > 10**18 puts -1 exit end end puts ans
[["+", 36, 36, 0, 493, 0, 652, 486, 652, 735, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 17, 131]]
4
43
N = int(input()) A = lit(map(int, input().split())) if 0 in A: print(0) exit() limit = 10**18 result = 1 for value in A: result *= value if result > limit: result = -1 break print(result)
N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) exit() limit = 10**18 result = 1 for value in A: result *= value if result > limit: 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
67
/*BISMILLAH THE WHITE WOLF NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/ #include <bits/stdc++.h> using namespace std; #define io ios_base::sync_with_stdio(false) #define ll long long #define ull unsigned long long #define vi vector<int> #define vll vector<long long> #define pb push_back #define mod 1000000007 #d...
/*BISMILLAH THE WHITE WOLF NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/ #include <bits/stdc++.h> using namespace std; #define io ios_base::sync_with_stdio(false) #define ll long long #define ull unsigned long long #define vi vector<int> #define vll vector<long long> #define pb push_back #define mod 1000000007 #d...
[["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 24], ["+", 51, 16, 12, 16, 31, 74, 39, 77, 39, 78], ["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 25]]
1
155
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < (ll)n; ++i) ll j = 1e10; int main() { ll n; cin >> n; vector<ll> a(n); rep(i, n) cin >> a.at(i); if (count(a.begin(), a.end(), 0) > 0) { cout << 0 << endl; return 0; } ll now = 1; rep(i, n) ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < (ll)n; ++i) ll j = 1e18; int main() { ll n; cin >> n; vector<ll> a(n); rep(i, n) cin >> a.at(i); if (count(a.begin(), a.end(), 0) > 0) { cout << 0 << endl; return 0; } ll now = 1; rep(i, n) ...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]]
1
150
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 100010; ll a[N]; int main() { int n; scanf("%d", &n); ll ans = 1; for (int i = 1; i <= n; i++) { scanf("%lld", &a[i]); if (a[i] == 0) { printf("0\n"); return 0; } } for (int i = 1; i <= n; i++) { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 100010; ll a[N]; int main() { int n; scanf("%d", &n); ll ans = 1; for (int i = 1; i <= n; i++) { scanf("%lld", &a[i]); if (a[i] == 0) { printf("0\n"); return 0; } } for (int i = 1; i <= n; i++) { ...
[["+", 51, 16, 12, 16, 31, 2, 63, 23, 0, 24], ["+", 51, 16, 12, 16, 31, 2, 63, 23, 0, 22], ["+", 51, 16, 12, 16, 31, 2, 63, 23, 0, 25], ["+", 51, 16, 12, 16, 31, 2, 3, 4, 0, 24], ["+", 51, 16, 12, 16, 31, 2, 3, 4, 0, 25]]
1
159
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; const ll MX = 1e18; int main() { int n; cin >> n; vector<int> vec(n); ll ans = 1; bool flag = 0; rep(i, n) { ll a; cin >> a; if (a == 0) { cout << 0 << endl; r...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; const ll MX = 1e18; int main() { int n; cin >> n; vector<int> vec(n); ll ans = 1; bool flag = 0; rep(i, n) { ll a; cin >> a; if (a == 0) { cout << 0 << endl; r...
[["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 116, 0, 117]]
1
140
#include <cmath> #include <iostream> #include <vector> using std::cin; using std::cout; using std::endl; using std::vector; int main() { int64_t max = 1e+18; int N; cin >> N; vector<int64_t> nums(N + 1); for (int i = 1; i <= N; i++) { cin >> nums[i]; if (nums[i] == 0) { cout << 0 << endl; ...
#include <cmath> #include <iostream> #include <vector> using std::cin; using std::cout; using std::endl; using std::vector; int main() { int64_t max = 1e+18; int N; cin >> N; vector<int64_t> nums(N + 1); for (int i = 1; i <= N; i++) { cin >> nums[i]; if (nums[i] == 0) { cout << 0 << endl; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
154
def solve(): N = int(input()) A = list(map(int, input().split())) if 0 in A: return 0 prod = 1 for i in range(N): if 10**18//prod <= A[i]: return -1 prod *= A[i] return prod print(solve())
def solve(): N = int(input()) A = list(map(int, input().split())) if 0 in A: return 0 prod = 1 for i in range(N): if 10**18//prod < A[i]: return -1 prod *= A[i] return prod print(solve())
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18]]
5
77
def demon(): N = int(input()) A = list(map(int,input().split())) A = sort(A) if A[0] == 0: print(0) return X = 1 for i in A: X *= A if X > 10 ** 18: print("-1") return print(X) demon()
def demon(): N = int(input()) A = list(map(int,input().split())) A.sort() if A[0] == 0: print(0) return X = 1 for i in A: X *= i if X > 10 ** 18: print("-1") return print(X) demon()
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22]]
5
81
#include <stdio.h> int main() { int n; unsigned long long ans = 1, a[100000]; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%llu", &a[i]); } for (int i = 0; i < n; i++) { if (a[i] == 0) { printf("0"); return 0; } } for (int i = 0; i < n; i++) { if (a[i] > 1e18 / ans)...
#include <stdio.h> int main() { int n; unsigned long long ans = 1, a[100000]; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%llu", &a[i]); } for (int i = 0; i < n; i++) { if (a[i] == 0) { printf("0"); return 0; } } for (int i = 0; i < n; i++) { if (a[i] > 10000000000...
[["-", 0, 57, 15, 23, 0, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 31, 13]]
0
157
#include <bits/stdc++.h> using namespace std; #define vint vector<int> #define vvint vector<vint> #define sint stack<int> #define qint queue<int> #define rep(i, n) for (int i = 0; i < (int)(n); i++) // 繰り返し処理 #define all(x) (x).begin(), (x).end() // 全体 こんな感じで使う→sort(all(a)); #define ct(a) cout << a << endl #define ice...
#include <bits/stdc++.h> using namespace std; #define vint vector<int> #define vvint vector<vint> #define sint stack<int> #define qint queue<int> #define rep(i, n) for (int i = 0; i < (int)(n); i++) // 繰り返し処理 #define all(x) (x).begin(), (x).end() // 全体 こんな感じで使う→sort(all(a)); #define ct(a) cout << a << endl #define ice...
[["-", 8, 9, 0, 57, 15, 339, 51, 2, 63, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 2, 63, 22], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 21], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 22], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
412
import sys n = input() nums = [int(e) for e in input().split()] if 0 in nums: print('0') sys.exit() ans = 1 s = 10**18 for i in nums: ans = ans * i if(ans >= s): print('-1') break if(ans <= s): print(ans)
import sys n = input() nums = [int(e) for e in input().split()] if 0 in nums: print('0') sys.exit() ans = 1 s = 10**18 for i in nums: ans = ans * i if(ans > s): print('-1') break if(ans <= s): print(ans)
[["-", 8, 196, 0, 57, 15, 23, 0, 666, 667, 20], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 667, 47]]
5
84
N = int(input()) A = list(map(int, input().split())) print(A) judge=10**18 ans = 1 if 0 in A: print(0) exit() for i in A: ans *= i if ans > judge: print('-1') exit() print(ans)
N = int(input()) A = list(map(int, input().split())) judge=10**18 ans = 1 if 0 in A: print(0) exit() for i in A: ans *= i if ans > judge: print('-1') exit() 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, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
75
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, a, b) for (int i = a; i < (int)(b); i++) #define all(v) v.begin(), v.end() const int MOD = 1e9 + 7; const int INF = 1e9; //'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122 int main() { int n; cin >> n; ll a[n]; rep(i, 0, n) { cin >> ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, a, b) for (int i = a; i < (int)(b); i++) #define all(v) v.begin(), v.end() const int MOD = 1e9 + 7; const int INF = 1e9; //'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122 int main() { int n; cin >> n; ll a[n]; rep(i, 0, n) { cin >> ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
159
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; int strlen(int64_t c) { int ans = 0; while (c > 0) { ans++; c = c / 10; } return ans; } int main() { int n; cin >> n; vector<int64_t> vec(n); rep(i, n) cin >> vec[i]; int64...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; int strlen(int64_t c) { int ans = 0; while (c > 0) { ans++; c = c / 10; } return ans; } int main() { int n; cin >> n; vector<int64_t> vec(n); rep(i, n) cin >> vec[i]; int64...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
194
function main(input) { const num = Number(input.split("\n")[0]); let ans = 1n; const numbers = input.split("\n")[1].split(" ").map(i => BigInt(i)); if (numbers.includes(0n)) { return console.log(0); } for (let i = 0; i < num; i++) { ans *= numbers[i]; if (ans > 10n ** 18n) { break; }...
function main(input) { const num = Number(input.split("\n")[0]); let ans = 1n; const numbers = input.split("\n")[1].split(" ").map(i => BigInt(i)); if (numbers.includes(0n)) { return console.log(0); } for (let i = 0; i < num; i++) { ans *= numbers[i]; if (ans > 10n ** 18n) { break; }...
[["-", 0, 1, 0, 2, 3, 3, 0, 2, 63, 22], ["-", 0, 2, 3, 3, 0, 2, 3, 3, 0, 24], ["-", 0, 2, 3, 3, 0, 2, 3, 3, 0, 25], ["+", 0, 1, 0, 2, 3, 3, 0, 16, 17, 72], ["+", 0, 2, 3, 3, 0, 16, 12, 557, 0, 62]]
2
168
N = int(input()) #A = [int(a) for a in input().split()] #A = input().split() A = list(map(int,input().split())) ans = 1 if 0 in A: print(-1) else: for a in range(N): ans = ans * A[a] if ans > (10 ** 18): ans = -1 break print(ans)
N = int(input()) #A = [int(a) for a in input().split()] #A = input().split() A = list(map(int,input().split())) ans = 1 if 0 in A: print(0) else: for a in range(N): ans = ans * A[a] if ans > (10 ** 18): ans = -1 break 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> using namespace std; int main() { int N; cin >> N; long long ans = 1; bool ngFlg = false; for (int i = 0; i < N; i++) { long long A; cin >> A; if (A == 0) { cout << 0 << endl; } if (ngFlg || 1000000000000000000 / ans < A) { ngFlg = true; } ans ...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; long long ans = 1; bool ngFlg = false; for (int index = 0; index < N; index++) { long long A; cin >> A; if (A == 0) { cout << 0 << endl; return 0; } if (ngFlg || 1000000000000000000 / ans < A) { ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9,...
1
107
#include <cstdio> using namespace std; #define INF 1000000000000000000LL int N; bool exceed; long long ans = 1; int main() { scanf("%d", &N); for (int i = 0; i < N; i++) { int A; scanf("%d", &A); if (A == 0) { printf("0\n"); return 0; } if (ans > INF / A) { exceed = true; ...
#include <cstdio> using namespace std; #define INF 1000000000000000000LL int N; bool exceed; long long ans = 1; int main() { scanf("%d", &N); for (int i = 0; i < N; i++) { long long A; scanf("%lld", &A); if (A == 0) { printf("0\n"); return 0; } if (ans > INF / A) { exceed =...
[["-", 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]]
1
130
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using v1 = vector<int>; using v2 = vector<vector<int>>; using ll = long long; int main() { ll n; cin >> n; ll mult = 1; vector<long long> a(n); bool judge = true; for (auto &x : a) { cin >> x; if (x == 0) ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using v1 = vector<int>; using v2 = vector<vector<int>>; using ll = long long; int main() { ll n; cin >> n; ll mult = 1; vector<long long> a(n); bool judge = true; for (auto &x : a) { cin >> x; if (x == 0) ...
[["-", 15, 339, 51, 16, 31, 16, 31, 23, 0, 24], ["-", 51, 16, 31, 16, 31, 23, 0, 16, 17, 72], ["-", 51, 16, 31, 16, 31, 23, 0, 16, 12, 13], ["-", 15, 339, 51, 16, 31, 16, 31, 23, 0, 25], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
159
# coding: utf-8 # Your code here! count = int(input()) nums = [] nums = input().split(" ") total = 1 for i in range(count): if int(nums[i]) == 0: total = 0 break for i in range(count): total = int(nums[i]) * total if total > 10**18: print(-1) break print(total)
# coding: utf-8 # Your code here! count = int(input()) nums = [] nums = input().split(" ") total = 1 for i in range(count): if int(nums[i]) == 0: total = 0 break for i in range(count): total = int(nums[i]) * total if total > 10**18: total = -1 break print(total)
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
88
n = int(input()) A = list(map(int, input().split())) if 0 in A: print('0') else: threshold = 10**18 res = 1 for x in A: res *= x if res >= threshold: res = -1 break print(res)
n = int(input()) A = list(map(int, input().split())) if 0 in A: print('0') else: threshold = 10**18 res = 1 for x in A: res *= x if res > threshold: res = -1 break print(res)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
68
#include <bits/stdc++.h> // #include <boost/multiprecision/cpp_int.hpp> #define int long long #define inf 1000000007 #define pa pair<int, int> #define ll long long #define pal pair<double, double> #define PI 3.14159265358979323846 #define mp make_pair #define pb push_back #define EPS (1e-8) int dx[8] = {0, 1, 0, -1...
#include <bits/stdc++.h> // #include <boost/multiprecision/cpp_int.hpp> #define int long long #define inf 1000000007 #define pa pair<int, int> #define ll long long #define pal pair<double, double> #define PI 3.14159265358979323846 #define mp make_pair #define pb push_back #define EPS (1e-8) int dx[8] = {0, 1, 0, -1...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 48], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22]]
1
1,424
#include <iostream> using namespace std; long long b[100000]; int main() { long long pos = 1000000000000000000; int a; cin >> a; long long ans = 1; for (int i = 1; i <= a; i++) { cin >> b[i]; if (b[i] == 0) { cout << "0" << endl; return 0; } } for (int i = 1; i <= a; i++) { i...
#include <iostream> using namespace std; long long b[100000]; int main() { long long pos = 1000000000000000000; int a; cin >> a; long long ans = 1; for (int i = 1; i <= a; i++) { cin >> b[i]; if (b[i] == 0) { cout << "0" << endl; return 0; } } for (int i = 1; i <= a; i++) { i...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
139
#include <bits/stdc++.h> using namespace std; int main() { unsigned long long int a, i, c = 1; cin >> a; unsigned long long int b[a]; for (i = 0; i < a; i++) { cin >> b[i]; } sort(b, b + a); if (b[0] == 0) cout << "0" << endl; else { for (i = 0; i < a; i++) { if (c * b[i] > 1000000000...
#include <bits/stdc++.h> using namespace std; int main() { unsigned long long int a, i, c = 1; cin >> a; unsigned long long int b[a]; for (i = 0; i < a; i++) { cin >> b[i]; } sort(b, b + a); if (b[0] == 0) cout << "0" << endl; else { for (i = 0; i < a; i++) { if (c > 10000000000000000...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 48], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
1
140
#include <iostream> #include <vector> using namespace std; int main(void) { int n; cin >> n; vector<long long> a(n); for (int i = 0; i < n; i++) { long long b; cin >> b; if (b == 0) { cout << 0 << endl; return 0; } a.at(i) = b; } long long m = 1; for (int i = 0; i < n; i+...
#include <iostream> #include <vector> using namespace std; int main(void) { int n; cin >> n; vector<long long> a(n); for (int i = 0; i < n; i++) { long long b; cin >> b; if (b == 0) { cout << 0 << endl; return 0; } a.at(i) = b; } long long m = 1; for (int i = 0; i < n; i+...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
161
def main(): n = int(input()) a = map(int, input().split()) if 0 in a: print(0) return ans = 1 for tmp in a: ans *= tmp if (ans > 1e18) : print(-1) return print(ans) main()
def main(): n = int(input()) a = list(map(int, input().split())) if 0 in a: print(0) return ans = 1 for tmp in a: ans *= tmp if (ans > 1e18) : print(-1) return print(ans) 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
68
N=int(input()) A = list(map(int,input().split())) A.sort() x=1 y=True for i in A: x= x*i if x > 10**18: print('-1') print(A) y=False break if y: print(x)
N=int(input()) A = list(map(int,input().split())) A.sort() x=1 y=True for i in A: x= x*i if x > 10**18: print('-1') y=False break if y: print(x)
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
74
N=int(input()) A = [int(i) for i in input().split()] if 0 in A: multiple = 0 else: multiple = 1 for i in range(N): multiple = multiple * A[i] if (multiple > 18 ** 10): multiple = -1 break print(multiple)
N=int(input()) A = [int(i) for i in input().split()] if 0 in A: multiple = 0 else: multiple = 1 for i in range(N): multiple = multiple * A[i] if multiple > 1000000000000000000: multiple = -1 break print(multiple)
[["-", 0, 7, 8, 196, 0, 57, 15, 23, 0, 24], ["-", 0, 57, 15, 23, 0, 666, 0, 657, 31, 612], ["-", 0, 57, 15, 23, 0, 666, 0, 657, 17, 578], ["-", 0, 57, 15, 23, 0, 666, 0, 657, 12, 612], ["-", 0, 7, 8, 196, 0, 57, 15, 23, 0, 25], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]]
5
73
N = input() ans = 1 A = list(map(int, input().split())) A.sort(reverse=True) if A[N-1] == 0: ans = 0 else: for a in A: ans *= a if ans > 10 ** 18: ans = -1 break print(ans)
N = int(input()) ans = 1 A = list(map(int, input().split())) A.sort(reverse=True) if A[N-1] == 0: ans = 0 else: for a in A: ans *= a if ans > 10 ** 18: 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], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
72
N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) ans = 1 for i in A: ans *= i if ans > 1000000000000000000: print(-1) quit() print(ans)
N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) quit() ans = 1 for a in A: ans *= a if ans > 1000000000000000000: print(-1) quit() print(ans)
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22]]
5
62
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i <= b; ++i) #define per(i, a, b) for (int i = a; i >= b; i--) #define ll long long #define mset(s, _) memset(s, _, sizeof s) #define ALL(a) (a).begin(), (a).end() using namespace std; int main(void) { vector<ll> a; int n; cin >> n; ll A; rep(i, 0...
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i <= b; ++i) #define per(i, a, b) for (int i = a; i >= b; i--) #define ll long long #define mset(s, _) memset(s, _, sizeof s) #define ALL(a) (a).begin(), (a).end() using namespace std; int main(void) { vector<ll> a; int n; cin >> n; ll A; rep(i, 0...
[["-", 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
167
#include <iostream> using namespace std; unsigned long long a[100005], b, n, i, p, x, p18; int main() { cin >> n; p18 = 1000000000000000000; for (i = 1; i <= n; i++) { cin >> a[i]; if (!a[i]) { cout << 0; return 0; } } p = 1; for (i = 1; i <= n; i++) { x = a[i]; if (p * x >...
#include <iostream> using namespace std; unsigned long long a[100005], b, n, i, p, x, p18; int main() { cin >> n; p18 = 1000000000000000000; for (i = 1; i <= n; i++) { cin >> a[i]; if (!a[i]) { cout << 0; return 0; } } p = 1; for (i = 1; i <= n; i++) { x = a[i]; if (x > p1...
[["-", 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
133
#include <algorithm> #include <bits/stdc++.h> #include <cctype> #include <cmath> #include <iostream> #include <map> #include <math.h> #include <set> #include <string> #include <vector> #define ll long long using namespace std; const ll MX = 1e18; int main() { int N; cin >> N; ll ans = 1; bool ng = false; ...
#include <algorithm> #include <bits/stdc++.h> #include <cctype> #include <cmath> #include <iostream> #include <map> #include <math.h> #include <set> #include <string> #include <vector> #define ll long long using namespace std; const ll MX = 1e18; int main() { int N; cin >> N; ll ans = 1; bool ng = false; ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47]]
1
139
#include <bits/stdc++.h> using ll = long long; using namespace std; const ll MAXN = 1e18; int main() { int n; cin >> n; ll a[n] = {}; for (int i = 0; i < n; i++) cin >> a[i]; if (count(a, a + n, 0)) { cout << -1 << "\n"; return 0; } ll prod = 1; for (int i = 0; i < n; i++) { if (a[i] <= ...
#include <bits/stdc++.h> using ll = long long; using namespace std; const ll MAXN = 1e18; int main() { int n; cin >> n; ll a[n] = {}; for (int i = 0; i < n; i++) cin >> a[i]; if (count(a, a + n, 0)) { cout << 0 << "\n"; return 0; } ll prod = 1; for (int i = 0; i < n; i++) { if (a[i] <= M...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
148
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { long long int n; cin >> n; long long int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { cout << 0; exit(0); } } long long int lim = 1e18; long long int prod = 1; for (int i ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { long long int n; cin >> n; long long int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { cout << 0; exit(0); } } long long int lim = 1e18; long long int prod = 1; for (int i ...
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 0, 1, 0, 11, 12, 16, 12, 69, 28, 22], ["+", 0, 11, 12, 16, 12, 69, 341, 342, 0, 70], ["+", 0, 11, 12, 16, 12, 69, 341, 342, 0, 22], ["+", 0, 11, 12, 16, 12, 69, 341, 342, 0, 73]]
1
145