buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
n = int(input()) x = input().split() a = 0 b = 1 if x.count('0') >= 1: print(0) while a <= n - 1 and b <= 1000000000000000000: b = b * int(x[a]) a += 1 if b > 1000000000000000000: print(-1) else: print(b)
n = int(input()) x = input().split() a = 0 b = 1 if x.count('0') >= 1: print(0) else: while a <= n - 1 and b <= 1000000000000000000: b = b * int(x[a]) a += 1 if b > 1000000000000000000: print(-1) else: print(b)
[["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102]]
5
80
n = int(input()) a = list(map(int,input().split())) ans = 1 if 0 in a : ans = 0 else: for i in a : ans *= i if ans > 10**18: print(-1) break else: print(ans)
n = int(input()) a = list(map(int,input().split())) ans = 1 if 0 in a : ans = 0 print(0) else: for i in a : ans *= i if ans > 10**18: print(-1) break else: 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, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
65
#include <bits/stdc++.h> using namespace std; int main() { int n, i, flag = 1, cnt = 0; cin >> n; unsigned long long int ar[n], pro = 1, k = 1000000000000000000; for (i = 0; i < n; i++) { cin >> ar[i]; if (ar[i] == 0) cnt++; } if (cnt == 0) { for (i = 0; i < n; i++) { if (ar[i] <...
#include <bits/stdc++.h> using namespace std; int main() { long int n, i, flag = 1, cnt = 0; cin >> n; unsigned long long int ar[n], pro = 1, k = 1000000000000000000; for (i = 0; i < n; i++) { cin >> ar[i]; if (ar[i] == 0) cnt++; } if (cnt == 0) { for (i = 0; i < n; i++) { if (ar...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 25]]
1
156
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; long long ans = 1; long long A[N]; for (int i = 0; i < N; i++) cin >> A[i]; for (int i = 0; i < N; i++) { if (A[i] == 0) { cout << -1 << endl; return 0; } } for (int i = 0; i < N; i++) { if (A[i] <= ...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; long long ans = 1; long long A[N]; for (int i = 0; i < N; i++) cin >> A[i]; for (int i = 0; i < N; i++) { if (A[i] == 0) { cout << 0 << endl; return 0; } } for (int i = 0; i < N; i++) { if (A[i] <= 1...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
143
N = int(input()) p = [int(i) for i in input().split()] ans = 1 if 0 in p: print(0) exit() for i in range(n): ans*=p[i] if ans > 10 ** 18: print(-1) exit() print(ans)
N = int(input()) p = [int(i) for i in input().split()] ans = 1 if 0 in p: print(0) exit() for i in range(N): ans*=p[i] if ans > 10 ** 18: print(-1) exit() print(ans)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22]]
5
74
n = int(input()) l = list(map(int, input().split())) ans = 1 if 0 in a: print(0) exit() for i in range(n): ans*=ans*l[i] if ans > 10**18: print(-1) exit() print(ans)
n = int(input()) l = list(map(int, input().split())) ans = 1 if 0 in l: print(0) exit() for i in range(n): ans*=l[i] if ans > 10**18: print(-1) exit() print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["-", 8, 196, 0, 1, 0, 677, 12, 657, 31, 22], ["-", 8, 196, 0, 1, 0, 677, 12, 657, 17, 48]]
5
75
n = int(input()) result=1 a = list(map(int,input().split())) if 0 in a: print(0) else: for i in a: result*=i if result > 10**18: print(-1) #break if result <= 10**18: print(result)
n = int(input()) result=1 a = list(map(int,input().split())) if 0 in a: print(0) else: for i in a: result*=i if result > 10**18: print(-1) break if result <= 10**18: print(result)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
71
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll long long int main() { ll a[100001]; ll n; cin >> n; for (ll i = 0; i < n; i++) { cin >> a[i]; } for (ll i = 0; i < n; i++) { if (a[i] == 0) { cout << "0\n"; return 0; } } ll prod = 1; for (ll j = 0; j...
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll long long int main() { ll a[100001]; ll n; cin >> n; for (ll i = 0; i < n; i++) { cin >> a[i]; } for (ll i = 0; i < n; i++) { if (a[i] == 0) { cout << "0\n"; return 0; } } ll prod = 1; for (ll j = 0; j...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
152
#include <iostream> #include <vector> using namespace std; typedef unsigned long long uint64; int main() { int n; cin >> n; vector<uint64> a(n); for (int i = 0; i < n; i++) { scanf("%lld", &a[i]); if (a[i] == 0) { cout << "0" << endl; return 0; } } uint64 prod = 1; for (int i =...
#include <iostream> #include <vector> using namespace std; typedef unsigned long long uint64; int main() { int n; cin >> n; vector<uint64> a(n); for (int i = 0; i < n; i++) { scanf("%lld", &a[i]); if (a[i] == 0) { cout << "0" << endl; return 0; } } uint64 prod = 1; for (int i =...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
153
def solve(n, a): for x in a: if x == 0: return 0 ans = 1 for x in a: ans *= x if ans >= 10**18: return -1 return ans n = int(input()) a = list(map(int, input().split())) print(solve(n, a))
def solve(n, a): for x in a: if x == 0: return 0 ans = 1 for x in a: ans *= x if ans > 10**18: return -1 return ans n = int(input()) a = list(map(int, input().split())) print(solve(n, a))
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
77
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; ll ans = 1; vector<ll> 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) { ans = 0; break; } if ((ll)1e18...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; ll ans = 1; vector<ll> 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) { ans = 0; break; } if ((ll)1e18...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
143
#include <bits/stdc++.h> #define ll long long #define endl "\n" const int N = 100010; using namespace std; int main() { ll prod = 1; int n, z = 0; cin >> n; ll a[N]; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) z = 1; } if (z == 1) { cout << 0 << endl; return 0; } ...
#include <bits/stdc++.h> #define ll long long #define endl "\n" const int N = 100010; using namespace std; int main() { ll prod = 1; int n, z = 0; cin >> n; ll a[N]; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) z = 1; } if (z == 1) { cout << 0 << endl; return 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
164
N = int(input()) ans = 1 INF = 10**18 *a, = map(int, input().split()) if 0 in a: print(0) else: for i in a: ans *= i print(ans) if ans>INF: print(-1) break else: print(ans)
N = int(input()) ans = 1 INF = 10**18 *a, = map(int, input().split()) if 0 in a: print(0) else: for i in a: ans *= i if ans>INF: print(-1) break else: print(ans)
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
72
N = input().split() list = [int(x) for x in input().split()] sortlist = list.sorted() answer = 1 for a in sortlist: answer = answer*a if answer == 0: break if answer > 10^18: answer = -1 break else: continue print(answer)
N = input().split() list = [int(x) for x in input().split()] list.sort() answer = 1 for a in list: answer = answer*a if answer == 0: break if answer > 10**18: answer = -1 break else: continue print(answer)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["-", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 140...
5
72
#include <bits/stdc++.h> using namespace std; int main(void) { int n; cin >> n; vector<long long> vec(n); for (int i = 0; i < n; i++) cin >> vec[i]; for (int i = 0; i < n; i++) { if (vec[i] == 0) { cout << 0; return 0; } } long long ans = 1; long long inf = 1e18; for (int i =...
#include <bits/stdc++.h> using namespace std; int main(void) { int n; cin >> n; vector<long long> vec(n); for (int i = 0; i < n; i++) cin >> vec[i]; for (int i = 0; i < n; i++) { if (vec[i] == 0) { cout << 0; return 0; } } long long ans = 1; long long inf = 1e18; for (int i =...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
147
#include <cstdio> using namespace std; int main() { int n; scanf("%d", &n); long long res = 1, v; bool f = true; while (n--) { scanf("%lld", &v); if (!v) { f = true; res = 0; } else if (res >= ((long long)1e18) / v + 1) f = false; res *= v; } if (v) printf("%lld\n", ...
#include <cstdio> using namespace std; int main() { int n; scanf("%d", &n); long long res = 1, v; bool f = true; while (n--) { scanf("%lld", &v); if (!v) { f = true; res = 0; } else if (res >= ((long long)1e18) / v + 1) f = false; res *= v; } if (f) printf("%lld\n", ...
[["-", 0, 14, 8, 9, 0, 57, 15, 339, 51, 22], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 51, 22]]
1
121
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int N; cin >> N; vector<ll> A(N); ll ans = 1; for (int i = 0; i < A.size(); i++) { cin >> A.at(i); sort(A.begin(), A.end()); } for (int i = 0; i < A.size(); i++) { if (A.at(i) == 0) { ans = 0; break;...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int N; cin >> N; vector<ll> A(N); ll ans = 1; for (int i = 0; i < A.size(); i++) { cin >> A.at(i); } sort(A.begin(), A.end()); for (int i = 0; i < A.size(); i++) { if (A.at(i) == 0) { ans = 0; break; ...
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
1
160
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { int n; cin >> n; int arr[n], i; for (i = 0; i < n; i++) cin >> arr[i]; int zero = 0; for (i = 0; i < n; i++) { if (arr[i] == 0) zero++; } if (zero > 0) cout << "0"; else { int mul = 1, temp = 1; ...
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { int n; cin >> n; int arr[n], i; for (i = 0; i < n; i++) cin >> arr[i]; int zero = 0; for (i = 0; i < n; i++) { if (arr[i] == 0) zero++; } if (zero > 0) cout << "0"; else { int mul = 1, temp = 1; ...
[["-", 15, 339, 51, 16, 12, 16, 31, 2, 63, 22], ["-", 51, 16, 12, 16, 31, 2, 3, 4, 0, 24], ["-", 51, 16, 12, 16, 31, 2, 3, 4, 0, 13], ["-", 51, 16, 12, 16, 31, 2, 3, 4, 0, 21], ["-", 51, 16, 12, 16, 31, 2, 3, 4, 0, 25], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
170
import sys N=int(input()) A=list(map(int,input().split())) if 0 in A: print(0) ans=1 for elem in A: ans*=elem if ans>10**18: print(-1) sys.exit() print(ans)
import sys N=int(input()) A=list(map(int,input().split())) if 0 in A: print(0) sys.exit() ans=1 for elem in A: ans*=elem if ans>10**18: print(-1) sys.exit() print(ans)
[["+", 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
68
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define sz(a) (int)(a).size() using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; using vvi = vector<vi>; using vll = vector<ll>; using vvll = vector<vll>; const ll MOD...
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define sz(a) (int)(a).size() using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; using vvi = vector<vi>; using vll = vector<ll>; using vvll = vector<vll>; const ll MOD...
[["+", 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], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
232
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; vector<ll> v(n); for (auto &e : v) cin >> e; sort(v.begin(), v.end()); ll ans = 1; for (auto e : v) { if (ans == 0) break; if (e <= 1e+18 / ans) { ans *= e; } else { cout << ...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; vector<ll> v(n); for (auto &e : v) cin >> e; sort(v.begin(), v.end()); ll ans = 1; for (auto e : v) { if (ans == 0) break; if (e <= 1000000000000000000 / ans) { ans *= e; } else { ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
118
// #Sazaの1日1AC #include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const long long INF = 9e15; const double PI = 3.14159265358979323846; //マクロ //型エイリアス using ll = long long; using P = pair<long long, long long>; using vl = vector<long long>; using vvl = vector<vector<long long>>; using vP =...
// #Sazaの1日1AC #include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const long long INF = 9e15; const double PI = 3.14159265358979323846; //マクロ //型エイリアス using ll = long long; using P = pair<long long, long long>; using vl = vector<long long>; using vvl = vector<vector<long long>>; using vP =...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
717
n = int(input()) arr = list(map(int, input().split(" "))) if 0 in arr: print(0) exit() for i in arr: ans *= i if ans > 10**18: print(-1) exit() print(ans)
n = int(input()) arr = list(map(int, input().split(" "))) ans = 1 if 0 in arr: print(0) exit() for i in arr: ans *= i if ans > 10**18: print(-1) exit() print(ans)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
67
n = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) exit() ans = 1 for i in range(n): ans = ans*A[i] if ans >= 10**18: print(-1) exit() print(ans)
n = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) exit() ans = 1 for i in range(n): ans = ans*A[i] if ans > 10**18: 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
75
n = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) ans = 1 for i in range(len(A)): ans = ans * A[i] if ans > 10 ** 18: print(-1) else: pass print(ans)
n = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) exit() ans = 1 for i in range(len(A)): ans = ans * A[i] if ans > 10 ** 18: print(-1) exit() else: pass 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
#coding: utf-8 times= int(input()) nums= list(map(int, input().split())) a= 1 if 0 in nums: print(0) exit() for i in nums: a*= i if a > 10**18: print('-1') else: print(a)
#coding: utf-8 times= int(input()) nums= list(map(int, input().split())) a= 1 if 0 in nums: print(0) exit() for i in nums: a*= i if a > 10**18: print('-1') exit() else: print(a)
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
68
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int N; long long int *A; long long int ans = 1; double dA; double dans; char temp[30]; char temp2[30]; int c; scanf("%d", &N); A = (long long int *)malloc(sizeof(long long int) * N); for (c = 0; c < N; +...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int N; long long int *A; long long int ans = 1; double dA; double dans; char temp[30]; char temp2[30]; int c; scanf("%d", &N); A = (long long int *)malloc(sizeof(long long int) * N); for (c = 0; c < N; +...
[["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67]]
0
255
n = int(input()) a = map(int, input().split()) ans = 1 for num in a: ans *= num if ans > 10**18: print("-1") exit() print(ans)
n = int(input()) a = map(int, input().split()) ans = 1 for num in sorted(a): ans *= num if ans > 10**18: print("-1") exit() print(ans)
[["+", 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
53
N=int(input()) A=list(map(int, input().split())) if A.count(0)>0: print(0) exit() for i in range(1, N): if A[0]*A[i]>10**18: print(-1) else: A[0]*=A[i] print(A[0])
N=int(input()) A=list(map(int, input().split())) if A.count(0)>0: print(0) exit() for i in range(1, N): if A[0]*A[i]>10**18: print(-1) exit() else: A[0]*=A[i] print(A[0])
[["+", 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
90
n,*a=map(int,open(0).read().split()) if min(a)==0: print(0) else: s=1 for i in range(len(a)): s=s*a[i] if s>10*18: print(-1) break else: print(s)
n,*a=map(int,open(0).read().split()) if min(a)==0: print(0) else: s=1 for i in range(len(a)): s=s*a[i] if s>10**18: print(-1) break else: print(s)
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 48], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 578]]
5
77
N=int(input()) A=list(map(int,input().split())) if 0 in A: print(0) keta=1 for i in A: keta*=i if keta>1000000000000000000: break if keta>1000000000000000000: print(-1) else: print(keta)
N=int(input()) A=list(map(int,input().split())) if 0 in A: print(0) else: keta=1 for i in A: keta*=i if keta>1000000000000000000: break if keta>1000000000000000000: print(-1) else: print(keta)
[["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102]]
5
67
#include <bits/stdc++.h> #define P pair<int, int> #define vv vector<vector<int>> #define v vector<int> #define rep(i, n) for (int i = 0; i < (int)n; i++) using namespace std; int main() { vector<long long> arr; int n; cin >> n; rep(i, n) { long long x; cin >> x; arr.push_back(x); } rep(i, n) ...
#include <bits/stdc++.h> #define P pair<int, int> #define vv vector<vector<int>> #define v vector<int> #define rep(i, n) for (int i = 0; i < (int)n; i++) using namespace std; int main() { vector<long long> arr; int n; cin >> n; rep(i, n) { long long x; cin >> x; arr.push_back(x); } rep(i, n) ...
[["-", 15, 339, 51, 16, 12, 16, 31, 2, 63, 22], ["-", 51, 16, 12, 16, 31, 2, 3, 4, 0, 24], ["-", 51, 16, 12, 16, 31, 2, 3, 4, 0, 13], ["-", 51, 16, 12, 16, 31, 2, 3, 4, 0, 21], ["-", 51, 16, 12, 16, 31, 2, 3, 4, 0, 25], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
159
n = int(input()) arr = list(map(int, input().split())) while len(arr) > 1: m = len(arr) if m & 1: arr.append(1) m += 1 left, right = arr[:n // 2], arr[n // 2:] arr = [x * y for x, y in zip(left, right)] x = arr[0] if x > 10 ** 18: print(-1) else: print(x)
n = int(input()) arr = list(map(int, input().split())) while len(arr) > 1: m = len(arr) if m & 1: arr.append(1) m += 1 left, right = arr[:m // 2], arr[m // 2:] arr = [x * y for x, y in zip(left, right)] x = arr[0] if x > 10 ** 18: print(-1) else: print(x)
[["-", 12, 432, 0, 206, 206, 663, 0, 657, 31, 22], ["+", 12, 432, 0, 206, 206, 663, 0, 657, 31, 22]]
5
114
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) n = int(readline()) a = list(map(int, readline().split())) ans = 1 for aa in a: ans *= aa if ans > 10 ** 18: print(-1) exit() print(ans)
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) n = int(readline()) a = list(map(int, readline().split())) a.sort() ans = 1 for aa in a: ans *= aa if ans > 10 ** 18: print(-1) exit() print(ans)
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
92
n = int(input()) a = list(map(int, input().split())) x =1 if min(a) ==0: ans =0 else: order =0 for i in a: order = order+len(str(i))-1 if order >=18: ans = -1 else: ans =1 for i in a: ans = ans*i if ans >10**18: ans=-1 print (ans...
n = int(input()) a = list(map(int, input().split())) x =1 if min(a) ==0: ans =0 else: order =0 for i in a: order = order+len(str(i))-1 if order >18: ans = -1 else: ans =1 for i in a: ans = ans*i if ans >10**18: ans=-1 print (ans)
[["-", 75, 76, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 667, 47]]
5
101
import sys N = int(input()) a = list(map(str, input().split())) total = 1 if '0' in a: print('0') sys.exit() for i in a: total *= int(i) if total >= 10**18: print('-1') sys.exit() print(total)
import sys N = int(input()) a = list(map(str, input().split())) total = 1 if '0' in a: print('0') sys.exit() for i in a: total *= int(i) if total > 10**18: print('-1') sys.exit() print(total)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
81
#include <bits/stdc++.h> using namespace std; long long a, b, n, ans, l, k; int main() { cin >> n; ans = 1; for (k = 1; k <= n; k++) { cin >> l; if (l == 0) { ans = 0; continue; } if (ans == -1) { continue; } if (ans > 1000000000000000000 / l) { ans = -1; } ...
#include <bits/stdc++.h> using namespace std; long long a, b, n, ans, l, k; int main() { cin >> n; ans = 1; for (k = 1; k <= n; k++) { cin >> l; if (l == 0) { ans = 0; continue; } if (ans == -1) { continue; } if (ans > 1000000000000000000 / l) { ans = -1; cont...
[["+", 8, 9, 0, 57, 64, 9, 0, 116, 0, 117], ["+", 8, 9, 0, 57, 64, 9, 0, 116, 0, 35]]
1
101
from sys import stdin input = stdin n = int(input()) aa = list(map(int, input().split())) if 0 in aa: print(0) exit() ans = 1 for a in aa: ans *= a if ans > 10**18: print(-1) exit() print(ans)
from sys import stdin input = stdin.readline n = int(input()) aa = list(map(int, input().split())) if 0 in aa: print(0) exit() ans = 1 for a in aa: ans *= a if ans > 10**18: print(-1) exit() print(ans)
[["+", 0, 656, 0, 1, 0, 662, 12, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 662, 12, 319, 319, 22]]
5
74
n = int(input()) a = list(map(int, input().split())) r = 1 t = 10 ** 18 for x in a: r *= x if r > t: break if r <= t: print(r) else: print(-1)
n = int(input()) a = list(map(int, input().split())) # a = [0, 10, 10, 10, 10] a.sort() r = 1 t = 10 ** 18 for x in a: r *= x if r > t: break if r <= t: print(r) else: print(-1)
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
63
from sys import exit n = int(input()) a = list(map(int, input().split())) ans = 1 for i in a: ans *= i if (ans > 1e18): print(-1) exit(0) print(ans)
from sys import exit n = int(input()) a = list(map(int, input().split())) ans = 1 a.sort() for i in a: ans *= i if (ans > 1e18): 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
60
n=int(input()) l=list(map(int,input().split())) if l.count(0)!=0: print(0) else: num=1 for i in l: if num>10**18: break else: num*=i if num>=10**18: print(-1) else: print(num)
n=int(input()) l=list(map(int,input().split())) if l.count(0)!=0: print(0) else: num=1 for i in l: if num>10**18: break else: num*=i if num>10**18: print(-1) else: print(num)
[["-", 75, 76, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 667, 47]]
5
80
#include <bits/stdc++.h> #define ios \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define ll unsigned long long usin...
#include <bits/stdc++.h> #define ios \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define ll unsigned long long usin...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 64, 9, 0,...
1
524
#include <stdio.h> #define rep(i, n) for (int i = 0; i < n; i = i + 1) #define MAX 9223372036854775807 #define ARR_MAX 288199999999999999 void debug(char *string, long long int target) { printf("%s", string); printf("%lld", target); printf("%c", '\n'); } long long a[100010]; int main() { int n; scanf("%d",...
#include <stdio.h> #define rep(i, n) for (int i = 0; i < n; i = i + 1) #define MAX 9223372036854775807 #define ARR_MAX 288199999999999999 void debug(char *string, long long int target) { printf("%s", string); printf("%lld", target); printf("%c", '\n'); } long long a[100010]; int main() { int n; scanf("%d",...
[["+", 0, 30, 0, 14, 8, 9, 0, 9, 0, 46], ["-", 0, 30, 0, 14, 8, 9, 0, 9, 0, 46], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 35]]
0
215
#!/usr/bin/env python3 n = int(input()) arg = list(map(int, input().split())) ans = 1 if 0 in arg: ans = 0 else: for m in arg: ans *= m if ans > 1000000000000000000: ans = -1 print(ans)
#!/usr/bin/env python3 n = int(input()) arg = list(map(int, input().split())) ans = 1 if 0 in arg: ans = 0 else: for m in arg: ans *= m if ans > 1000000000000000000: ans = -1 break print(ans)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
60
#include <bits/stdc++.h> using namespace std; int main() { int n; long long fal = 1e18; cin >> n; long long ans; vector<long long> a(n); vector<double> b(n); for (int i = 0; i < n; i++) { cin >> a[i]; b[i] = log10(a[i]); } if (find((a).begin(), (a).end(), 0) != a.end()) { cout << 0 << en...
#include <bits/stdc++.h> using namespace std; int main() { int n; long long fal = 1e18; cin >> n; long long ans = 1; vector<long long> a(n); vector<double> b(n); for (int i = 0; i < n; i++) { cin >> a[i]; b[i] = log10(a[i]); } if (find((a).begin(), (a).end(), 0) != a.end()) { cout << 0 <...
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
199
def main(): n = input() a = tuple(map(int, input().split())) if 0 in a: print(0) return ans = a[0] a2 = a[1:] for i in a2: ans = ans * i if ans > 10e+18: print(-1) return print(ans) main()
def main(): n = input() a = tuple(map(int, input().split())) if 0 in a: print(0) return ans = a[0] a2 = a[1:] for i in a2: ans = ans * i if ans > 1000000000000000000: print(-1) return print(ans) main()
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 531], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]]
5
78
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<unsigned long> a(n); unsigned long sum = 1; for (int i = 0; i < n; i++) { cin >> a.at(i); if (a.at(i) == 0) { cout << 0 << endl; return 0; } } for (int i = 0; i < n; i++) { if ((1000000000000000...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<unsigned long> a(n); unsigned long sum = 1; for (int i = 0; i < n; i++) { cin >> a.at(i); if (a.at(i) == 0) { cout << 0 << endl; return 0; } } for (int i = 0; i < n; i++) { if ((1000000000000000...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
142
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long ar[n + 5]; long long res = 1; for (int i = 0; i < n; i++) { cin >> ar[i]; if (ar[i] == 0) { res = 0; continue; } if (ar[i] <= 1000000000000000000 / res) res *= ar[i]; else { ...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long ar[n + 5]; long long res = 1; for (int i = 0; i < n; i++) { cin >> ar[i]; if (ar[i] == 0) { cout << "0"; return 0; } if (ar[i] <= 1000000000000000000 / res) res *= ar[i]; else { ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["-", 8, 9, 0, 57, 64, 9, 0, 116, 0, 117], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9,...
1
109
a = int(input()) b = list(map(int, input().split())) c = 1 if 0 in a: print(0) exit() for n in b: c = c*n if c > 10**18: print(-1) exit() print(c)
a = int(input()) b = list(map(int, input().split())) c = 1 if 0 in b: print(0) exit() for n in b: c = c*n if c > 10**18: print(-1) exit() print(c)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
69
#include <bits/stdc++.h> typedef long long int ll; typedef unsigned long long ull; typedef long double ld; #define F first #define S second #define pll pair<ll, ll> #define pii pair<int, int> #define len(s) s.length() #define all(v) v.begin(), v.end() const ll INF = INT_MAX; const int N = 2e5 + 5; const ll mod = 100000...
#include <bits/stdc++.h> typedef long long int ll; typedef unsigned long long ull; typedef long double ld; #define F first #define S second #define pll pair<ll, ll> #define pii pair<int, int> #define len(s) s.length() #define all(v) v.begin(), v.end() const ll INF = INT_MAX; const int N = 2e5 + 5; const ll mod = 100000...
[["-", 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, 23, 0, 24], ["+", 31, 2, 3, 4, 0, 2, 3, 4, 0, 25], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 17, 85], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 12, 22]]
1
247
gets arr = gets.split.map(&:to_i) multiplication = 1 if arr.include?(0) p 0 else arr.each do |a| multiplication *= a if multiplication > 10**18 p -1 return end end end
gets arr = gets.split.map(&:to_i) multiplication = 1 if arr.include?(0) p 0 else arr.each do |a| multiplication *= a if multiplication > 10**18 p -1 return end end p multiplication end
[["+", 0, 493, 0, 121, 75, 95, 0, 652, 735, 22], ["+", 0, 121, 75, 95, 0, 652, 3, 4, 0, 22]]
4
48
#include <bits/stdc++.h> #include <string.h> using namespace std; #define ll long long #define ii pair<int, int> ll ara[200005]; char st[200004]; ll a[200004]; ll b[200004]; int main() { ll c, d, m, n, i, j, k, l, t, x, y, z; ll mul = 1; cin >> n; for (i = 0; i < n; i++) cin >> ara[i]; for (i = 0; i < n; ...
#include <bits/stdc++.h> #include <string.h> using namespace std; #define ll long long #define ii pair<int, int> ll ara[200005]; char st[200004]; ll a[200004]; ll b[200004]; int main() { ll c, d, m, n, i, j, k, l, t, x, y, z; ll mul = 1; cin >> n; for (i = 0; i < n; i++) cin >> ara[i]; for (i = 0; i < n; ...
[["-", 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
186
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll MAX = 1e18; int main() { int n; cin >> n; ll a[n]; ll val = 1; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { cout << "0"; return 0; } } for (int i = 0; i < n; i++) { ll x = a[i]; // ...
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll MAX = 1e18; int main() { int n; cin >> n; ll a[n]; ll val = 1; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { cout << "0"; return 0; } } for (int i = 0; i < n; i++) { ll x = a[i]; // ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
139
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define ll long long const ll mod = 1e9 + 7; const ll INF = 1e18; const double pi = acos(-1); int main(void) { ll n; cin >> n; ll ans = 1; bool ng = false; rep(i, n) { ll a; cin >> a; if (a == 0) { ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define ll long long const ll mod = 1e9 + 7; const ll INF = 1e18; const double pi = acos(-1); int main(void) { ll n; cin >> n; ll ans = 1; bool ng = false; rep(i, n) { ll a; cin >> a; if (a == 0) { ...
[["+", 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
135
n = int(input()) arr = list(map(int,input().split())) arr.sort(reverse=True) ans = 1 limit = 10 * 18 if arr[-1] == 0: ans = 0 else: for i in arr: ans *= arr[i] if ans > limit: ans = -1 break print(ans)
n = int(input()) arr = list(map(int,input().split())) arr.sort(reverse=True) ans = 1 limit = 10**18 if arr[-1] == 0: ans = 0 else: for i in arr: ans *= i if ans > limit: ans = -1 break print(ans)
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 48], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 578], ["-", 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
80
#include <iostream> int main() { int N; long long p; std::cin >> N; long long x = 1; long double y = 1; for (int i = 0; i < N; i++) { std::cin >> p; x = x * p; y = y * p; } if (x > 1000000000000000000) std::cout << "-1"; else { std::cout << x << std::endl; } }
#include <iostream> int main() { int N; long long p; std::cin >> N; long long x = 1; long double y = 1; for (int i = 0; i < N; i++) { std::cin >> p; x = x * p; y = y * p; } if (y > 1000000000000000000) std::cout << "-1"; else { std::cout << x << std::endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
94
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> //#include <functional> // for less // using namespace __gnu_pbds; using namespace std; typedef long long L; L A[1000000], c1, n; int main() { c1 = 0; cin >> n; for (L i = 0; i < n; i++) { // scanf("%ll...
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> //#include <functional> // for less // using namespace __gnu_pbds; using namespace std; typedef long long L; L A[1000000], c1, n; int main() { c1 = 0; cin >> n; for (L i = 0; i < n; i++) { // scanf("%ll...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
158
n = input() a = list(map(int,input().split())) ans=1 for i in a: ans *= i if ans > 10**18: ans = "-1" break print(ans)
n = input() a = list(map(int,input().split())) a.sort() ans=1 for i in a: ans *= 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
50
#include <iostream> using namespace std; int main() { long n; cin >> n; long double a; long long ans = 1; long double check = 1; for (int i = 0; i < n; i++) { cin >> a; ans *= a; check *= a; } if (ans > 1000000000000000000) cout << -1 << endl; else cout << ans << endl; }
#include <iostream> using namespace std; int main() { long n; cin >> n; long double a; long long ans = 1; long double check = 1; for (int i = 0; i < n; i++) { cin >> a; ans *= a; check *= a; } if (check > 1000000000000000000) cout << -1 << endl; else cout << ans << endl; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
82
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #define MAX 1000000000000000000 using namespace std; int main() { int n; cin >> n; vector<unsigned long long int> v; // bool zeroes=false; unsigned long long int mul = 1, prev = 1, flag = 0; for (int i = 0; i < n; ++i) { cin >> v[i]; i...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #define MAX 1000000000000000000 using namespace std; int main() { int n; cin >> n; vector<unsigned long long int> v(n); // bool zeroes=false; unsigned long long int mul = 1, prev = 1, flag = 0; for (int i = 0; i < n; ++i) { cin >> v[i]; ...
[["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 24], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 25]]
1
173
n=int(input()) A=list(map(int,input().split())) a=0 ans=1 if 0 in A: ans=0 else: for a in range(n): ans*=A[a] a+=1 if ans<=10**18: continue else: break print(ans)
n=int(input()) A=list(map(int,input().split())) a=0 ans=1 if 0 in A: ans=0 else: for a in range(n): ans*=A[a] a+=1 if ans<=10**18: continue else: ans=-1 break print(ans)
[["+", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 8, 196, 0, 1, 0, 662, 12, 664, 17, 33], ["+", 8, 196, 0, 1, 0, 662, 12, 664, 28, 612]]
5
73
n=int(input()) m=list(map(int,input().split())) x=1 if 0 in m: print(0) else: for y in m: x*=y if x>10**18: print(-1) print(x)
n=int(input()) m=list(map(int,input().split())) x=1 if 0 in m: x=0 else: for y in m: x*=y if x>10**18: x=-1 break print(x)
[["-", 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], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
63
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; using P = pair<string, int>; int main() { int n; cin >> n; vector<ll> a(n); rep(i, n) cin >> a.at(i); sort(a.begin(), a.end()); if (a.at(0) == 0) { cout << 0 << endl; return 0; ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; using P = pair<string, int>; int main() { int n; cin >> n; vector<ll> a(n); rep(i, n) cin >> a.at(i); sort(a.begin(), a.end()); if (a.at(0) == 0) { cout << 0 << endl; return 0; ...
[["-", 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
167
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; typedef long long ll; main() { int n; cin >> n; ll a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { if (a[i] == 0) { cout << "0" << endl; return 0; } } ll ans = 1; for (i...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; typedef long long ll; main() { int n; cin >> n; ll a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { if (a[i] == 0) { cout << "0" << endl; return 0; } } ll ans = 1; for (i...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 48], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
164
#include <iostream> #include <math.h> #include <string> using namespace std; int main() { int n, cnt = 0, f = 0; cin >> n; long long a[n], ans = 1; // long double ans=1.0,tmp=1; /* for(int i=0;i<n;i++){ cin>>a; tmp=a; while(tmp>10){ tmp=tmp/10; cnt+...
#include <iostream> #include <math.h> #include <string> using namespace std; int main() { int n, cnt = 0, f = 0; cin >> n; long long a[n], ans = 1; // long double ans=1.0,tmp=1; /* for(int i=0;i<n;i++){ cin>>a; tmp=a; while(tmp>10){ tmp=tmp/10; cnt+...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
152
n = int(input()) a = list(map(int, input().split(' '))) if a.index(0) >= 0: print(0) else: lim = int(1e18) mult = 1 for v in a: if mult > lim: break else: mult *= v if mult > lim: print("-1") else: print(mult)
n = int(input()) a = list(map(int, input().split(' '))) if a.count(0) > 0: print("0") else: lim = int(1e18) mult = 1 for v in a: if mult > lim: break else: mult *= v if mult > lim: print("-1") else: print(mult)
[["-", 0, 57, 15, 666, 0, 652, 63, 319, 319, 22], ["+", 0, 57, 15, 666, 0, 652, 63, 319, 319, 22], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655]]
5
86
def main(): N = int(input()) A = input() A = A.split(' ') for i in A: if i == '0': print('-1') return X = 1 for i in A: X *= int(i) if X > 1000000000000000000: print('-1') return print(X) main()
def main(): N = int(input()) A = input() A = A.split(' ') for i in A: if i == '0': print(0) return X = 1 for i in A: X *= int(i) if X > 1000000000000000000: print(-1) return print(X) main()
[["-", 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, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612]]
5
80
n=int(input()) A=[int(_) for _ in input().split()] ans=1 if A.count(0)>0: print(0) else: for i in range(n): ans=ans*A[i] if ans>10**18: print(-1) else: print(ans)
n=int(input()) A=[int(_) for _ in input().split()] ans=1 if A.count(0)>0: print(0) else: for i in range(n): ans=ans*A[i] if ans>10**18: print(-1) exit() print(ans)
[["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
79
n = int(input()) A = list(map(int, input().split())) k = 0 ans = 1 for k in range(n): ans *= A[k] k += 1 if ans > 10**18: ans = -1 break print(ans)
n = int(input()) A = sorted(list(map(int, input().split()))) k = 0 ans = 1 for k in range(n): ans *= A[k] k += 1 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], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
64
def main(): n = int(input()) in_list = list(map(int,input().split())) result = 1 if in_list.count(0)>0: print(0) return for i in range(n): result = result*in_list[i] if result >= 10**18: print(-1) return print(result) main()
def main(): n = int(input()) in_list = list(map(int,input().split())) result = 1 if in_list.count(0)>0: print(0) return for i in range(n): result = result*in_list[i] if result > 10**18: print(-1) return print(result) main()
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
84
N = input() A = list(map(int, input().split())) answer = 1 if 0 in A: print(0) break else: for i in A: answer *= i if answer > 10**18: print(-1) else: print(answer)
N = input() A = list(map(int, input().split())) answer = 1 if 0 in A: print(0) else: for i in A: answer *= i if answer > 10**18: answer = -1 break print(answer)
[["-", 0, 656, 0, 57, 64, 196, 0, 93, 0, 94], ["-", 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], ["-", 75, 76, 8, 196, 0, 57, 75, 76, 0, 95], ["-", 75,...
5
63
n = int(input()) a = list(map(int,input().split())) ans = 1 a = sorted(a,reverse=True) if(0 in a): print(0) exit() for i in a: if(len(str(i)) + len(str(ans)) >= 20): print(-1) exit() ans *=i print(ans if(ans<pow(10,18)) else -1)
n = int(input()) a = list(map(int,input().split())) ans = 1 a = sorted(a,reverse=True) if(0 in a): print(0) exit() for i in a: if(len(str(i)) + len(str(ans)) > 20): print(-1) exit() ans *=i print(ans if(ans<=pow(10,18)) else -1)
[["-", 8, 196, 0, 57, 15, 23, 0, 666, 667, 20], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 667, 47], ["-", 3, 4, 0, 41, 0, 23, 0, 666, 667, 18], ["+", 3, 4, 0, 41, 0, 23, 0, 666, 667, 19]]
5
107
// includes #include <bits/stdc++.h> // defines #define boost_io \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define casti ...
// includes #include <bits/stdc++.h> // defines #define boost_io \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define casti ...
[["+", 0, 30, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13]]
1
191
n = gets.chomp.to_i array = gets.split(' ') if array.include?("0") puts 0 exit end num = 10 ** 18 answer = 1 n.times do |i| answer = answer * array[i].to_i if num <= answer puts "-1" exit end end puts answer
n = gets.chomp.to_i array = gets.split(' ') if array.include?("0") puts 0 exit end num = 10 ** 18 answer = 1 n.times do |i| answer = answer * array[i].to_i if num < answer puts "-1" exit end end puts answer
[["-", 196, 737, 8, 736, 0, 121, 15, 738, 17, 19], ["+", 196, 737, 8, 736, 0, 121, 15, 738, 17, 18]]
4
68
n=int(input()) ans=1 l=sorted(list(map(int,input().split()))) if l[0]==0: print(0) else: for i in range(n): ans*=l[i] if ans>100000000000000000: ans=-1 break print(ans)
n=int(input()) ans=1 l=sorted(list(map(int,input().split()))) if l[0]==0: print(0) else: for i in range(n): ans*=l[i] if ans>1000000000000000000: ans=-1 break print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]]
5
73
#include <bits/stdc++.h> #define ll long long //#define pw (ll)pow #define MAX 1000005 #define MOD (ll)1e9 + 7 using namespace std; int main() { int n; cin >> n; ll x, p = 1; ll a[n]; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for (int i = 0; i < n; i++) { x = a[i]; if (x == 0) ...
#include <bits/stdc++.h> #define ll long long //#define pw (ll)pow #define MAX 1000005 #define MOD (ll)1e9 + 7 using namespace std; int main() { int n; cin >> n; ll x, p = 1; ll a[n]; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for (int i = 0; i < n; i++) { x = a[i]; if (x == 0) ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
183
import sys N = int(input()) A = list(map(int, input().split())) ans = 1 if 0 in A: print(-1) sys.exit() for a in A: ans *= a if ans > 10**18: print(-1) sys.exit() print(ans)
import sys N = int(input()) A = list(map(int, input().split())) ans = 1 if 0 in A: print(0) sys.exit() for a in A: ans *= a if ans > 10**18: print(-1) sys.exit() print(ans)
[["-", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["-", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
74
def main(): N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) return prod = 1 for a in A: values *= a if prod > 1000000000000000000: print('-1') return print(prod) main()
def main(): N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) return prod = 1 for a in A: prod *= a if prod > 1000000000000000000: print('-1') return print(prod) main()
[["-", 0, 7, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 31, 22]]
5
70
N = gets.to_i INF = 10**18 ans = 1 a = gets.split.map(&:to_i) if a.include? 0 then p 0 exit end a do |i| ans *= i if ans > INF then ans = -1 break end end p ans
N = gets.to_i INF = 10**18 ans = 1 a = gets.split.map(&:to_i) if a.include? 0 then p 0 exit end a.each do |i| ans *= i if ans > INF then ans = -1 break end end p ans
[["+", 36, 36, 36, 36, 0, 493, 0, 652, 17, 131], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22]]
4
56
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using namespace std; using P = pair<int, int>; using ll = long long; int main() { int n; cin >> n; int a[n]; int ans = 1; int x; rep(i, n) { cin >> a[i]; if (a[i]...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using namespace std; using P = pair<int, int>; using ll = long long; int main() { ll n; cin >> n; ll a[n]; ll ans = 1; ll x; rep(i, n) { cin >> a[i]; if (a[i] == ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
145
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using namespace std; typedef pair<int, int> P; int64_t aa[100010]; int main() { int64_t s = 1, n, ans = 1; cin >> n; rep(i, n) { cin >> aa[i]; if (aa[i] == 0) { s...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using namespace std; typedef pair<int, int> P; int64_t aa[100010]; int main() { int64_t s = 1, n, ans = 1; cin >> n; rep(i, n) { cin >> aa[i]; if (aa[i] == 0) { s...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22]]
1
146
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<long long> v(n); for (int i = 0; i < n; i++) { cin >> v.at(i); if (v.at(i) == 0) { cout << 0 << endl; return 0; } } long long ans = 1; for (int i = 0; i < n; i++) ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<long long> v(n); for (int i = 0; i < n; i++) { cin >> v.at(i); if (v.at(i) == 0) { cout << 0 << endl; return 0; } } long long ans = 1; for (int i = 0; i < n; i++) ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
144
#include <iostream> #include <vector> typedef long long ll; using namespace std; int main() { int n; cin >> n; vector<ll> inp(n); ll rst = 1; ; for (int i = 0; i < n; i++) { cin >> inp[i]; if (inp[i] == 0) { cout << 0 << endl; return 0; } } for (int i = 0; i < n; i++) { if (r...
#include <iostream> #include <vector> typedef long long ll; using namespace std; int main() { int n; cin >> n; vector<ll> inp(n); ll rst = 1; ; for (int i = 0; i < n; i++) { cin >> inp[i]; if (inp[i] == 0) { cout << 0 << endl; return 0; } } for (int i = 0; i < n; i++) { if (i...
[["-", 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], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85], ["+", 0, 57, 15, 339, 51, 16, 12,...
1
134
import sys n = int(input()) an_list = list(map(int, input().split())) an_list.sort() ans = 1 for i in an_list: ans *= i if ans >= 10 ** 18: print(-1) sys.exit() print(ans)
import sys n = int(input()) an_list = list(map(int, input().split())) an_list.sort() ans = 1 for i in an_list: ans *= i if ans > 10 ** 18: print(-1) sys.exit() print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
64
# %% def main(): N = input() A = list(map(int, input().split())) if 0 in A: print(0) return ans = 1 for a in A: ans *= a if ans >= 10**18: print(-1) return print(ans) if __name__ == '__main__': main()
# %% def main(): N = input() A = list(map(int, input().split())) if 0 in A: print(0) return ans = 1 for a in A: ans *= a if ans > 10**18: print(-1) return print(ans) if __name__ == '__main__': main()
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
76
#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); } for (int i = 0; i < N; i++) { if (A.at(i) == 0) { cout << 0 << endl; return 0; } } long long m = 1; for (int i = 0; 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); } for (int i = 0; i < N; i++) { if (A.at(i) == 0) { cout << 0 << endl; return 0; } } long long m = 1; for (int i = 0; i < ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
157
#include <cmath> #include <iostream> using namespace std; int main() { long int N, ans = 1, l; long int *A; double ans_d, l_d; l = pow(10, 18); l_d = pow(10, 18); cin >> N; A = new long int[N]; for (int i = 0; i < N; i++) { cin >> A[i]; if (A[i] == 0) { cout << 0; delete[] A; ...
#include <cmath> #include <iostream> using namespace std; int main() { long int N, ans = 1, l; long int *A; double ans_d = 1.0, l_d; l = pow(10, 18); l_d = pow(10, 18); cin >> N; A = new long int[N]; for (int i = 0; i < N; i++) { cin >> A[i]; if (A[i] == 0) { cout << 0; delete[] A; ...
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
197
package main import ( "bufio" "fmt" "os" "sort" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func main() { var A int64 fmt.Scan(&A) sc.Split(bufio.ScanWords) var ar int64 = int64(1) var res []int64 for i := int64(0); i < A; i++ { tmp := nextInt() if tmp == 0 { fmt.Print(0) return } res = ...
package main import ( "bufio" "fmt" "os" "sort" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func main() { var A int64 fmt.Scan(&A) sc.Split(bufio.ScanWords) var ar int64 = int64(1) var res []int64 for i := int64(0); i < A; i++ { tmp := nextInt() if tmp == 0 { fmt.Print(0) return } res = ...
[["-", 8, 196, 0, 57, 15, 16, 31, 16, 31, 22], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 48], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 17, 85], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 12, 22]]
7
737
<?php $max = trim(fgets(STDIN)); $numbers = explode(' ', trim(fgets(STDIN))); if(in_array(0, $numbers)) { echo '0' . PHP_EOL; return; } $result = 1; foreach($numbers as $number) { if((pow(10, 19) / $result) < $number) { echo '-1' . PHP_EOL; return; } $result *= $number; } echo $result . PHP_EO...
<?php $max = trim(fgets(STDIN)); $numbers = explode(' ', trim(fgets(STDIN))); if(in_array(0, $numbers)) { echo '0' . PHP_EOL; return; } $result = 1; foreach($numbers as $number) { // echo $result * $number . PHP_EOL; // echo '割り算: ' . (pow(10, 18) / $result) . ' result: ' . $result . ' number: ' . $number ....
[["+", 0, 57, 15, 23, 0, 16, 31, 613, 63, 141], ["-", 0, 16, 31, 613, 3, 3, 0, 28, 0, 612], ["+", 0, 28, 0, 613, 3, 3, 0, 28, 0, 612], ["-", 15, 23, 0, 16, 31, 23, 0, 16, 17, 85], ["+", 15, 23, 0, 16, 31, 613, 3, 3, 0, 21]]
6
106
N=map(int,input()) A=[int(i) for i in input().split()] a=1 if 0 in A: print(0) for i in A: a=a*i if a > 10**(18): print(-1) exit() print(a)
N=map(int,input()) A=[int(i) for i in input().split()] a=1 if 0 in A: print(0) exit() for i in A: a=a*i if a > 10**(18): print(-1) exit() print(a)
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
71
#include <stdio.h> int main(void) { int n, i, flg, flg2; long long a, b, y, x[100000]; scanf("%d", &n); flg = 0; flg2 = 0; for (i = 0; i < n; i++) { scanf("%d", &x[i]); if (x[i] == 0) { flg = 1; } } if (flg == 1) { printf("0\n"); // printf("zero\n"); } else { y = x[0]; ...
#include <stdio.h> int main(void) { int n, i, flg, flg2; long long a, b, y, x[100000]; scanf("%d", &n); flg = 0; flg2 = 0; for (i = 0; i < n; i++) { scanf("%lld", &x[i]); if (x[i] == 0) { flg = 1; } } if (flg == 1) { printf("0\n"); // printf("zero\n"); } else { y = x[0]; ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18]]
0
201
N = gets.to_i A = gets.split.map(&:to_i).sort LIMIT = 10 ** 18 ans = 1 A.each do |a| ans *= a if ans > LIMIT puts -1 exit end end
N = gets.to_i A = gets.split.map(&:to_i).sort LIMIT = 10 ** 18 ans = 1 A.each do |a| ans *= a if ans > LIMIT puts -1 exit end end puts ans
[["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22]]
4
46
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int n; ll x, zb = 1; cin >> n; vector<ll> V; for (int i = 0; i < n; i++) { cin >> x; V.push_back(x); if (x == 0) { cout << 0 << endl; return 0; } } for (int i = 0; i < n; i++) { x = V[i]; ...
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int n; ll x, zb = 1; cin >> n; vector<ll> V; for (int i = 0; i < n; i++) { cin >> x; V.push_back(x); if (x == 0) { cout << 0 << endl; return 0; } } for (int i = 0; i < n; i++) { x = V[i]; ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13]]
1
130
#include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <unordered_map> #include <vector> using namespace std; int a[100010]; int main() { int n; ...
#include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <unordered_map> #include <vector> using namespace std; long long a[100010]; int main() { int...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["-", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
181
n=int(input()) a=list(map(int,input().split())) b=1 if 0 in a: print(0) else: for i in range(n): b*=a[i] if b>10**8: print(-1) exit() print(b)
n=int(input()) a=list(map(int,input().split())) b=1 if 0 in a: print(0) else: for i in range(n): b*=a[i] if b>10**18: print(-1) exit() print(b)
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]]
5
72
#include <bits/stdc++.h> #include <chrono> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #define endl "\n" #define int long long int #define vi vector<int> #define vll vector<ll> #define vvi vector<vi> #define pii pair<int, int> #define pll pair<long long, long long> #define mod 1000000007 #...
#include <bits/stdc++.h> #include <chrono> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #define endl "\n" #define int long long int #define vi vector<int> #define vll vector<ll> #define vvi vector<vi> #define pii pair<int, int> #define pll pair<long long, long long> #define mod 1000000007 #...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
299
n = gets ary = gets.split.map(&:to_i) b = 1 if ary.count(0) puts 0 exit end ary.each do |a| b *= a if b > 10**18 puts -1 exit end end puts b
n = gets ary = gets.split.map(&:to_i) b = 1 if ary.include?(0) puts 0 exit end ary.each do |a| b *= a if b > 10**18 puts -1 exit end end puts b
[["-", 36, 36, 0, 493, 0, 121, 15, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 121, 15, 652, 735, 22]]
4
52
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() const ll INF = 1LL << 60; const ll MX = 1e18; int main() { int n; cin >> n; ll ans = 1; bool ok = false; rep(i, n) { ll a; cin >> a; if ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() const ll INF = 1LL << 60; const ll MX = 1e18; int main() { int n; cin >> n; ll ans = 1; bool ok = false; rep(i, n) { ll a; cin >> a; if ...
[["-", 15, 339, 51, 16, 12, 16, 31, 23, 0, 24], ["-", 51, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["-", 51, 16, 12, 16, 31, 23, 0, 16, 12, 13], ["-", 15, 339, 51, 16, 12, 16, 31, 23, 0, 25]]
1
142
#include "bits/stdc++.h" #define PRECISION(x) cout << fixed << setprecision(x) #define FAST_IO \ ios::sync_with_stdio(false); \ cin.tie(NULL); ...
#include "bits/stdc++.h" #define PRECISION(x) cout << fixed << setprecision(x) #define FAST_IO \ ios::sync_with_stdio(false); \ cin.tie(NULL); ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 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
240
from sys import stdin input = stdin.readline def main(): n = int(input()) a = list(map(int,input().split())).sort() if a[0] == 0: print(0) return ret = 1 for i in a: ret *= i if ret > 10**18: print(-1) return print(ret) main()
from sys import stdin input = stdin.readline def main(): n = int(input()) a = list(map(int,input().split())) a.sort() if a[0] == 0: print(0) return ret = 1 for i in a: ret *= i if ret > 10**18: print(-1) return print(ret) main()
[["+", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22]]
5
87