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; int main() { ll n; cin >> n; vector<ll> num(n); ll ans = 1; double ans1 = 1; for (int i = 0; i < n; i++) { cin >> num[i]; if (num[i] == 0) ans = 0; if (ans != -1) { ans *= num[i]; ans1 *= num[i]; } if ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n; cin >> n; vector<ll> num(n); ll ans = 1; double ans1 = 1; for (int i = 0; i < n; i++) { cin >> num[i]; if (num[i] == 0) ans = 0; if (ans != -1) { ans *= num[i]; ans1 *= num[i]; } if ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
132
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define pi (acos(-1)) #define ull unsigned long long #define ld long double /// freopen("input.txt","r",stdin); /// freopen("output.txt","w",stdout); #define M 100000 ll LCM(ll a, ll b) { ll g = __gcd(a, b); return (a * b) / g;...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define pi (acos(-1)) #define ull unsigned long long #define ld long double /// freopen("input.txt","r",stdin); /// freopen("output.txt","w",stdout); #define M 100000 ll LCM(ll a, ll b) { ll g = __gcd(a, b); return (a * b) / g;...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78]]
1
302
n = int(input()) a = list(map(int, input().split())) 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) 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], ["+", 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
60
//---Vaidik Patel"---//-------------------Proud to be //Indian--------------------------------// #include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> // include the associative containers or group of templates such as set,multi multimap, map etc. #include <ext/pb_ds/tree_policy.hpp> //...
//---Vaidik Patel"---//-------------------Proud to be //Indian--------------------------------// #include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> // include the associative containers or group of templates such as set,multi multimap, map etc. #include <ext/pb_ds/tree_policy.hpp> //...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19], ["+", 12, 16, 12, 23, 0, 16, 12, 74, 0, 24], ["+", 0, 16, 12, 74, 39, 77, 39, 86, 0, 96], ["+", 0, 16, 12, 74, 39, 77, 39, 86, 39, 40], ["+", 12, 16, 12, 23, 0, 16, 12, 74, 0, 25]]
1
392
/* ID: sixathofpain TASK: friday LANG: C++ */ //#pragma GCC optimize("Ofast") //#pragma GCC optimize ("unroll-loops") //#pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using ...
/* ID: sixathofpain TASK: friday LANG: C++ */ //#pragma GCC optimize("Ofast") //#pragma GCC optimize ("unroll-loops") //#pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78]]
1
361
n = int(input()) a = list(map(int,input().split())) a.sort(reverse=True) if 0 in a : ans = 0 print(ans) else : ans = 1 for i in range(n): ans *= a[i] if ans > 10**18 : print(-1) break if ans <= 10**18 : print(ans)
n = int(input()) a = list(map(int,input().split())) a.sort(reverse=True) if 0 in a : ans = 0 print(ans) else : ans = 1 for i in range(n): ans *= a[i] if ans > 10**18 : print(-1) break if ans <= 10**18 and ans != 0 : print(ans)
[["+", 36, 36, 0, 656, 0, 57, 15, 679, 17, 355], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 667, 79], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 612]]
5
88
num = int(input()) nums = list(map(int,input().split())) ans = 1 for i in nums: if i == 0: ans = 0 break ans *= i if ans > 10 **18: ans = -1 break print(ans)
num = int(input()) nums = list(map(int,input().split())) nums.sort() ans = 1 for i in nums: if i == 0: ans = 0 break 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
61
N = int(input()) A = list(map(int,input().split())) t = 1 ans = 1 count = 0 if 0 in A: ans = 0 for a in A: ans *= a t *= a while t >= 10: t /= 10 count += 1 if count >= 19: ans = -1 break if ans > 10**18: print(-1) else: print(ans)
N = int(input()) A = list(map(int,input().split())) t = 1 ans = 1 count = 0 if 0 in A: ans = 0 else: for a in A: ans *= a t *= a while t >= 10: t /= 10 count += 1 if count >= 19: ans = -1 break if ans > 10**18: ...
[["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102]]
5
92
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) typedef int64_t Int; int main() { int N; cin >> N; vector<Int> A(N); rep(i, N) { cin >> A[i]; if (A[i] == 0) { cout << 0 << endl; return...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) typedef int64_t Int; int main() { int N; cin >> N; vector<Int> A(N); rep(i, N) { cin >> A[i]; if (A[i] == 0) { cout << 0 << endl; return...
[["+", 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
131
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n; cin >> n; ll ans = 1; vector<ll> A(n); for (int i = 0; i < n; i++) { ll a; cin >> a; if (a == 0) { cout << 0; return 0; } A[i] = a; } for (int i = 0; i < n; i++) { if (ans > 2e18 / ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n; cin >> n; ll ans = 1; vector<ll> A(n); for (int i = 0; i < n; i++) { ll a; cin >> a; if (a == 0) { cout << 0; return 0; } A[i] = a; } for (int i = 0; i < n; i++) { if (ans > 1000000...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62]]
1
136
n = int(input()) a = list(map(int, input().split())) import math ans = 1 flag = 0 for i in range(n): ans = ans * a[i] // 1 if ans > 10**18: flag = 1 break if flag == 1: print(-1) else: print(ans)
n = int(input()) a = list(map(int, input().split())) import math ans = 1 flag = 0 a.sort() for i in range(n): ans = ans * a[i] // 1 if ans > 10**18: flag = 1 break if flag == 1: print(-1) else: 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
78
#include <bits/stdc++.h> #define ll unsigned long long using namespace std; const long long MAX = 1000000000000000000; ll n, m; ll a[100100]; ll ans = 1; int main() { cin >> n; for (ll i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + n + 1); if (a[1] == 0) { cout << "0" << endl; return 0; } bo...
#include <bits/stdc++.h> #define ll unsigned long long using namespace std; const long long MAX = 1000000000000000000; ll n, m; ll a[100100]; ll ans = 1; int main() { cin >> n; for (ll i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + n + 1); if (a[1] == 0) { cout << "0" << endl; return 0; } bo...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 48], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
169
n = input() a = list(map(int, input().split())) if 0 in a: print(0) exit() ans = 1 for i in a: ans *= i if len(str(ans)) >= 18 and ans != 10**18: print(-1) exit() print(ans)
n = input() a = list(map(int, input().split())) if 0 in a: print(0) exit() ans = 1 for i in a: ans *= i if len(str(ans)) >= 19 and ans != 10**18: print(-1) exit() print(ans)
[["-", 8, 196, 0, 57, 15, 679, 31, 666, 0, 612], ["+", 8, 196, 0, 57, 15, 679, 31, 666, 0, 612]]
5
74
n = int(input()) a = list(map(int, input().split())) ans = 1 for x in a: ans *= x if ans > (10 ** 18): ans = -1 break print(ans)
n = int(input()) a = list(map(int, input().split())) a.sort() ans = 1 for x in a: ans *= x 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
54
n=input() A=list(map(int,input().split())) ans=1 if A.count(0)==0: for i in A: ans*=i if ans>10**18: ans=-1 break print(ans)
n=input() A=list(map(int,input().split())) ans=1 if A.count(0)==0: for i in A: ans*=i if ans>10**18: ans=-1 break else: ans=0 print(ans)
[["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612]]
5
59
n=int(input()) lis=list(map(int,input().split())) ans=1 for i in lis: ans*=i if ans>1000000000000000000: ans=-1 break if 0 in lis: ans=0 else: print(ans)
n=int(input()) lis=list(map(int,input().split())) ans=1 for i in lis: ans*=i if ans>1000000000000000000: ans=-1 break if 0 in lis: ans=0 print(ans)
[["-", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["-", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102]]
5
60
n = int(input()) a = [int(_) for _ in input().split()] ans = 1 for i in a: if i == 0: ans = 0 break ans *= i if ans > 10**18: ans = -1 break print(ans)
n = int(input()) a = [int(_) for _ in input().split()] a.sort() ans = 1 for i in a: if i == 0: ans = 0 break 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
62
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) const long long INF = numeric_limits<long long>::max(); int main() { int n; long long ans = 1; cin >> n; vector<long long> a(n); rep(i, n) { cin >> a[i]; } sort(a.begin(), a.end()); if (a[0]...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) const long long INF = numeric_limits<long long>::max(); int main() { int n; long long ans = 1; cin >> n; vector<long long> a(n); rep(i, n) { cin >> a[i]; } sort(a.begin(), a.end()); if (a[0]...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
166
function main(input) { const inputs = input.trim().split('\n'); var N = inputs[0]; var nums = inputs[1].split(' ').map((n) => BigInt(n - 0)); if (nums.indexOf(0) >= 0) { console.log(0); return; } var output = BigInt(1); for (var i = 0; i < nums.length; i++) { if ((('' + output).length + ('' ...
function main(input) { const inputs = input.trim().split('\n'); var N = inputs[0]; var nums = inputs[1].split(' ').map((n) => BigInt(n - 0)); if (nums.indexOf(BigInt(0)) >= 0) { console.log(0); return; } var output = BigInt(1); for (var i = 0; i < nums.length; i++) { if ((('' + output).lengt...
[["+", 0, 16, 31, 2, 3, 3, 0, 2, 63, 22], ["+", 31, 2, 3, 3, 0, 2, 3, 3, 0, 24], ["+", 31, 2, 3, 3, 0, 2, 3, 3, 0, 25], ["-", 8, 556, 0, 57, 15, 23, 0, 16, 12, 555], ["+", 8, 556, 0, 57, 15, 23, 0, 16, 12, 555], ["+", 0, 2, 3, 3, 0, 16, 31, 557, 0, 104], ["+", 0, 1, 0, 2, 3, 3, 0, 16, 17, 72]]
2
207
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); long long n, a, p = 1; double r = 1; cin >> n; for (int i = 0; i < n; i++) { cin >> a; if (a == 0) { cout << 0; return 0; } else r += log10(a), p *= a; } if (r > 18.1) cout << -1;...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); long long n, a, p = 1; double r = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a; if (a == 0) { cout << 0; return 0; } else r += log10(a), p *= a; } if (r > 18.1) cout << -1;...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
114
#include <bits/stdc++.h> #include <string> #define ll long long #define endl "\n" #define fastio ios::sync_with_stdio(0), cin.tie(0); using namespace std; ll ans = 1; vector<ll> arr; int main() { int n; cin >> n; arr.resize(n); for (int i = 0; i < n; i++) { cin >> arr[i]; if (arr[i] == 0) { cout <...
#include <bits/stdc++.h> #include <string> #define ll long long #define endl "\n" #define fastio ios::sync_with_stdio(0), cin.tie(0); using namespace std; ll ans = 1; vector<ll> arr; int main() { int n; cin >> n; arr.resize(n); for (int i = 0; i < n; i++) { cin >> arr[i]; if (arr[i] == 0) { cout <...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13]]
1
136
listed = input().split() mul = 1 for num in listed: num = int(num) if num == 0: mul = 0 break if mul != -1: mul *= num if mul > 10**18: mul = -1 print(mul)
N = input() listed = input().split() mul = 1 for num in listed: num = int(num) if num == 0: mul = 0 break if mul != -1: mul *= num if mul > 10**18: mul = -1 print(mul)
[["+", 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, 25]]
5
56
n=int(input()) a=list(map(int,input().split())) ans=1 for i in range(n): ans=a[i] if ans>10**18: print(-1) exit() print(ans)
n=int(input()) a=list(map(int,input().split())) a.sort() ans=1 for i in range(n): ans*=a[i] if ans>10**18: print(-1) exit() print(ans)
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 108]]
5
61
n = int(input()) An = [int(x) for x in input().split()] An.sort(reverse=True) if 0 in An: print(0) exit() j = 10 ** 18 ans = 1 for i in range(n): if ans > j: print(j) quit() ans *= An[i] if ans > j : print(-1) else : print(ans)
n = int(input()) An = [int(x) for x in input().split()] An.sort(reverse=True) if 0 in An: print(0) exit() j = 10 ** 18 ans = 1 for i in range(n): if ans > j: print(-1) quit() ans *= An[i] if ans > j : print(-1) else : print(ans)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612]]
5
96
n=int(input()) a=list(input().split()) ans=1 f=0 i=0 while(i<n): if f==0: ans=ans*int(a[i]) if f==0 and ans>1000000000000000000: f=1 if int(a[i])==0: print(0) exit() i+=2 if f==1: print(-1) exit() print(ans)
n=int(input()) a=list(input().split()) ans=1 f=0 i=0 while(i<n): if f==0: ans=ans*int(a[i]) if f==0 and ans>1000000000000000000: f=1 if int(a[i])==0: print(0) exit() i+=1 if f==1: print(-1) exit() print(ans)
[["-", 0, 52, 8, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 12, 612]]
5
102
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<unsigned long long> A(n); unsigned long long ans = 1; unsigned long long a = pow(10, 18); bool zero = false; bool out = false; unsigned long long limit = a; double t1, t2; for (int i = 0; i < n; i++) { cin >> A.a...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<unsigned long long> A(n); unsigned long long ans = 1; unsigned long long a = pow(10, 18); bool zero = false; bool out = false; unsigned long long limit = a; double t1, t2; for (int i = 0; i < n; i++) { cin >> A.a...
[["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
207
n=int(input()) l=list(map(int, input().split())) m=1 for i in range(n): m*=l[i] print(m,i) if m>10**18: if 0 in l: print(0) exit() print(-1) exit() print(m)
n=int(input()) l=list(map(int, input().split())) m=1 for i in range(n): m*=l[i] if m>10**18: if 0 in l: print(0) exit() print(-1) exit() print(m)
[["-", 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, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
79
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define INF 1e9 #define PI 3.14159265359 #define MOD 1000000007 #define ALL(v) v.begin(), v.end() #define ALLR(v) v.rbegin(), v.rend() typedef long long ll; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define INF 1e9 #define PI 3.14159265359 #define MOD 1000000007 #define ALL(v) v.begin(), v.end() #define ALLR(v) v.rbegin(), v.rend() typedef long long ll; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
290
N = int(input()) a = list(map(int, input().split())) b = 1 if 0 in a: b = 0 else: for i in range(N): b = b * a[i] if b > 10 ** 18: b = 'out' if b == 'out': print(-1) else: print(b)
N = int(input()) a = list(map(int, input().split())) b = 1 if 0 in a: b = 0 else: for i in range(N): b = b * a[i] if b > 10 ** 18: b = 'out' break if b == 'out': print(-1) else: print(b)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
84
n=int(input()) x=list(map(int, input().split())) ans=1 if 0 in x: ans=0 else: for i in x: ans*=i if ans>=10**18: ans=-1 break print(ans)
n=int(input()) x=list(map(int, input().split())) ans=1 if 0 in x: ans=0 else: for i in x: ans=ans*i if ans>10**18: ans=-1 break print(ans)
[["-", 0, 7, 8, 196, 0, 1, 0, 677, 17, 108], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 48], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
62
import copy def main(): n = int(input()) a = list( map( int, input().split())) sum = 1 if 0 in a: print(0) else: for i in a: sum = sum * i if sum > 1000000000000000000: print(-1) break print(sum) if __name__ == '__...
import copy def main(): n = int(input()) a = list( map( int, input().split())) sum = 1 if 0 in a: print(0) else: for i in a: sum = sum * i if sum > 1000000000000000000: print(-1) exit() print(sum) if __name__ == '_...
[["-", 8, 196, 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], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
81
import java.math.BigDecimal; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s = "1"; BigDecimal biga = new BigDecimal(s); BigDecimal one = new BigDecimal(s); String[] array = new String[...
import java.math.BigDecimal; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s = "1"; BigDecimal biga = new BigDecimal(s); BigDecimal one = new BigDecimal(s); String[] array = new String[n...
[["-", 0, 1, 0, 492, 3, 4, 0, 91, 17, 33], ["-", 0, 1, 0, 492, 3, 4, 0, 91, 439, 499], ["+", 64, 196, 0, 1, 0, 492, 3, 4, 0, 499]]
3
265
#include <bits/stdc++.h> using namespace std; #define ll long long const int maxn = 1e3 + 5; const ll inf = 1e18; int main() { int n; cin >> n; ll t; ll ans = 1; for (int i = 0; i < n; i++) { cin >> t; if (ans != -1) ans *= t; if (ans > 1000000000000000000 || ans < 0) ans = -1; if ...
#include <bits/stdc++.h> using namespace std; #define ll long long const int maxn = 1e3 + 5; const ll inf = 1e18; int main() { int n; cin >> n; ll t; long double ans = 1; for (int i = 0; i < n; i++) { cin >> t; if (ans != -1) ans *= t; if (ans > 1000000000000000000 || ans < 0) ans = -1...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 39, 40], ["+", 8, 9, 0, 1, 0, 16, 12, 74, 0, 24], ["+", 0, 1, 0, 16, 12, 74, 39, 77, 39, 78], ["+", 8, 9, 0, 1, 0, 16, 12, 74, 0, 25]]
1
105
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <unordered_map> #include <utility> #include <vector> using namespace std; #define REPP(i, a, b...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <unordered_map> #include <utility> #include <vector> using namespace std; #define REPP(i, a, b...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
213
n = int(input()) a = list(map(input().split())) ans = 1 if 0 in a: ans = 0 else: for i in range(n): ans *= a[i] if ans >= 10**18: ans = -1 print(ans)
n = int(input()) a = list(map(int, input().split())) ans = 1 if 0 in a: ans = 0 else: for i in range(n): ans *= a[i] if ans > 10**18: ans = -1 break print(ans)
[["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
65
N = int(input()) a = 1 L = list(map(int, input().split())) for i in L: a *= i if (a > 1e18): break print(-1 if a > 1e18 else a)
N = int(input()) a = 1 L = list(map(int, input().split())) L.sort() for i in L: a *= i if (a > 1e18): break print(-1 if a > 1e18 else a)
[["+", 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
55
import numpy as np N = int(input()) a = list(map(int, input().split())) sum = a[0] if 0 in a: print('0') for i in range(1, N): sum = sum * a[i] if sum > 10**18: print('-1') exit() print(sum)
import numpy as np N = int(input()) a = list(map(int, input().split())) sum = a[0] if 0 in a: print('0') exit() for i in range(1, N): sum = sum * a[i] if sum > 10**18: print('-1') exit() print(sum)
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
84
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long int #define ld long double #define ull unsigned long long int #define forn(i, n) for (ll i = 0; i < (n); i++) #define forn_rev(i, n) for (ll i = (n)-1; i >= 0; i--) #define for1n(i, n) for (ll i =...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long int #define ld long double #define ull unsigned long long int #define forn(i, n) for (ll i = 0; i < (n); i++) #define forn_rev(i, n) for (ll i = (n)-1; i >= 0; i--) #define for1n(i, n) for (ll i =...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 79]]
1
323
n = int(input()) a = list(map(int,input().split())) b =1 if 0 in a: print(0) for i in range(n): b *= a[i] if b>10**18: b=-1 break else: continue print(b)
n = int(input()) a = list(map(int,input().split())) b =1 if 0 in a: b=0 for i in range(n): b *= a[i] if b>10**18: b=-1 break else: continue print(b)
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
70
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<unsigned long long int> A(N); for (int i = 0; i < N; i++) { cin >> A.at(i); } sort(A.begin(), A.end()); int state = 1; unsigned long long int mult = A.at(0); for (int i = 1; i < N; i++) { if (A.at(i) == 0 || mu...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<unsigned long long int> A(N); for (int i = 0; i < N; i++) { cin >> A.at(i); } sort(A.begin(), A.end()); int state = 1; unsigned long long int mult = A.at(0); for (int i = 1; i < N; i++) { if (A.at(i) == 0 || mu...
[["-", 31, 23, 0, 16, 31, 23, 0, 16, 17, 72], ["-", 31, 23, 0, 16, 31, 23, 0, 16, 12, 13]]
1
193
a=int(input()) b=list(map(int,input().split())) ans=1 for i in range(a): ans=ans*b[i] if ans>10**18: ans=-1 break print(ans)
a=int(input()) b=list(map(int,input().split())) b.sort() ans=1 for i in range(a): ans=ans*b[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
n = int(input()) l = list(map(int, input().split())).sort() if l[0] == 0: print(0) exit() res = 1 for i in l: res *= i if res > 10 **18: print(res) exit() print(res)
n = int(input()) l = list(map(int, input().split())) l.sort() if l[0] == 0: print(0) exit() res = 1 for i in l: res *= i if res > 10 **18: print(-1) exit() print(res)
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612]]
5
73
n = int(input()) a = list(map(int, input().split())) ans = 1 t = 1e18 if 0 in a: print(0) exit(0) for i in range(n): ans *= a[i] if ans > t: print(-1) exit(0) prin(ans)
n = int(input()) a = list(map(int, input().split())) ans = 1 t = 1e18 if 0 in a: print(0) exit(0) for i in range(n): ans *= a[i] if ans > t: print(-1) exit(0) print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22]]
5
76
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int n, done = 0, doen = 0; scanf("%d", &n); long long sum = 1; while (n--) { long long t; scanf("%lld", &t); if (t == 0) done = 1; else if (sum * t > 1000000000000000000) doen = 1; else if (doen == 0) s...
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int n, done = 0, doen = 0; scanf("%d", &n); long long sum = 1; while (n--) { long long t; scanf("%lld", &t); if (t == 0) done = 1; else if (sum > 1000000000000000000 / t) doen = 1; else if (doen == 0) s...
[["-", 0, 57, 15, 23, 0, 16, 31, 16, 17, 48], ["-", 0, 57, 15, 23, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 85], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 12, 22]]
0
133
import sys N=int(input()) A=[int(i) for i in input().split()] p=1 for i in A: if i==0: print(-1) sys.exit() for i in A: p=p*i if p>1000000000000000000: print(-1) sys.exit() print(p)
import sys N=int(input()) A=[int(i) for i in input().split()] p=1 for i in A: if i==0: print(0) sys.exit() for i in A: p=p*i if p>1000000000000000000: print(-1) sys.exit() print(p)
[["-", 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
80
N = int(input()) A = list(map(int,input().split())) ans = 1 if 0 in A: print(0) exit() for i in range(N): ans *= A[i] if ans > 10**18: print(-1) else: print(ans)
N = int(input()) A = list(map(int, input().split())) ans = 1 if 0 in A: print(0) else: for i in range(N): ans *= A[i] if ans > 10**18: print(-1) exit() print(ans)
[["-", 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, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64,...
5
72
n=int(input()) a=list(map(int,input().split())) result=1 for i in a: result*=i if 10**18<result: result=-1 break print(result)
n=int(input()) a=list(map(int,input().split())) a.sort() result=1 for i in a: result*=i if 10**18<result: result=-1 break print(result)
[["+", 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
52
N = int(input()) A = list(map(int,input().split())) over_value = 10 ** 18 + 1 total = 1 cnt = 0 while cnt < N: total *= A[cnt] if total >= over_value: total = -1 cnt += 1 for i in range(N): if A[i] == 0: total = 0 print(total)
N = int(input()) A = list(map(int,input().split())) over_value = 10 ** 18 total = 1 cnt = 0 while cnt < N: total *= A[cnt] if total > over_value: total = -1 break cnt += 1 for i in range(N): if A[i] == 0: total = 0 print(total)
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 0, 52, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 52, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
84
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class T, class U> inline bool chmin(T &x, U y) { if (x > y) { x = y; return true; } return false; } template <class T, class U> inline bool chmax(T &x, U y) { if (x < y) { x = y; return true; } return false; } #def...
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class T, class U> inline bool chmin(T &x, U y) { if (x > y) { x = y; return true; } return false; } template <class T, class U> inline bool chmax(T &x, U y) { if (x < y) { x = y; return true; } return false; } #def...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]]
1
241
N = int(input()) A = list(map(int, input().split())) A.sort(reverse=True) a = 1 if 0 in A: print(0) exit() for i in A: a *= i if a >= 10**18: print('-1') exit() print(a)
N = int(input()) A = list(map(int, input().split())) A.sort(reverse=True) a = 1 if 0 in A: print(0) exit() for i in A: a *= i if a > 10**18: print('-1') exit() print(a)
[["-", 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> #define rep(i, cc, n) for (int i = cc; i <= n; ++i) using namespace std; using ll = long long; int main() { int N; cin >> N; ll INF = pow(10, 18); ll A, ans = 1; bool zero = false, overflow = false; rep(i, 0, N - 1) { cin >> A; if (A == 0) zero = true; if (INF /...
#include <bits/stdc++.h> #define rep(i, cc, n) for (int i = cc; i <= n; ++i) using namespace std; using ll = long long; int main() { int N; cin >> N; ll INF = pow(10, 18); ll A, ans = 1; bool zero = false, overflow = false; rep(i, 0, N - 1) { cin >> A; if (A == 0) zero = true; else if (...
[["+", 8, 9, 0, 9, 0, 57, 75, 76, 0, 95]]
1
135
N = int(input()) A = list(map(int, input().split())) result = 1 flag = 0 for a in A: if a == 0: zero_flag = 1 result = 0 break else: result = result * a if result > pow(10, 18): flag = 1 result = 0 if flag == 1 and zero_flag != 1: print(-1) els...
N = int(input()) A = list(map(int, input().split())) result = 1 flag = 0 zero_flag = 0 for a in A: if a == 0: zero_flag = 1 result = 0 break else: result = result * a if result > pow(10, 18): flag = 1 result = 0 if flag == 1 and zero_flag != 1: ...
[["+", 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
91
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespac...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespac...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
224
#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], ["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
140
n = int(input()) s = sorted(map,int,input().split()) M = 10 ** 18 ans = 1 for ss in s: ans *= ss if ans > M: ans = -1 break elif ans == 0: break print(ans)
n = int(input()) s = sorted(map(int,input().split())) M = 10 ** 18 ans = 1 for ss in s: ans *= ss if ans > M: ans = -1 break elif ans == 0: break print(ans)
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
60
# coding: utf-8 # Your code here! N = int(input()) L = list(map(int, input().split())) ans = 1 for n in range(N): ans = L[n]*ans if ans >= 1000000000000000001: ans = -1 if ans == -1: break for n in range(N): if L[n] == 0: ans = -1 print(ans)
# coding: utf-8 # Your code here! N = int(input()) L = list(map(int, input().split())) ans = 1 for n in range(N): ans = L[n]*ans if ans >= 1000000000000000001: ans = -1 if ans == -1: break for n in range(N): if L[n] == 0: ans = 0 print(ans)
[["-", 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
86
n=int(input()) x=list(map(int,input().split())) ans=1 if 0 in x: print(0) else: for i in x: ans*=i if ans>10**18: ans=-1 break print(ans,i) if ans==-1: print("-1") else: print(ans)
n=int(input()) x=list(map(int,input().split())) ans=1 if 0 in x: print(0) else: for i in x: ans*=i if ans>10**18: ans=-1 break if ans==-1: print("-1") else: print(ans)
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
83
#include <iostream> #include <math.h> int main() { int a, keta, count; long long ans = 1; std::cin >> a; int A[a]; keta = 0; for (int i = 0; i < a; i++) { std::cin >> A[i]; count = log10(A[i]); keta = keta + count; if (A[i] == 0) { ans = 0; break; } } for (int i = 0; i <...
#include <iostream> #include <math.h> int main() { int a; float keta, count; long long ans = 1; std::cin >> a; long long A[a]; keta = 0; for (int i = 0; i < a; i++) { std::cin >> A[i]; count = log10(A[i]); keta = keta + count; if (A[i] == 0) { ans = 0; break; } } for (...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
194
n = int(input()) a = list(map(int, input().split())) ans = 1 if 0 in a: print(-1) else: for i in a: ans*=i if ans > 10**18: print(-1) exit() print(ans)
n = int(input()) a = list(map(int, input().split())) ans = 1 if 0 in a: print(0) else: for i in a: ans*=i if ans > 10**18: print(-1) exit() print(ans)
[["-", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["-", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
67
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; const ll INF = 1e18; const ll MOD = 1000000007; const ll MX = 1000000000000000000; const ll XX = 9000000000000000000; //最大値 #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define ALL(x) (x).begin(), (x).end() #define SIZE(...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; const ll INF = 1e18; const ll MOD = 1000000007; const ll MX = 1000000000000000000; const ll XX = 9223372036000000000; //最大値 #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define ALL(x) (x).begin(), (x).end() #define SIZE(...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22]]
1
193
n = int(input()) a = list(map(int, input().split())) r = a[0] for i in a[1:]: r *= i if r > 10**8: r = -1 break if 0 in a: r = 0 print(r)
n = int(input()) a = list(map(int, input().split())) r = a[0] for i in a[1:]: r *= i if r > 10**18: r = -1 break if 0 in a: r = 0 print(r)
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]]
5
67
a = int(input()) b = input().split() c = 1 for i in range(a): if b[i] == 0: c = 0 if c == 1: for i in range(a): c = c*int(b[i]) if c > 1000000000000000000: break if c > 1000000000000000000: print(-1) else: print(c)
a = int(input()) b = input().split() c = 1 for i in range(a): if int(b[i]) == 0: c = 0 if c == 1: for i in range(a): c = c*int(b[i]) if c > 1000000000000000000: break if c > 1000000000000000000: print(-1) else: print(c)
[["+", 8, 196, 0, 57, 15, 666, 0, 652, 63, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 24], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 25]]
5
85
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> #define int unsigned long long using namespace std; int a[100005]; long double s = 1; signed main() { int n; cin >> n; for (int i ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> #define int unsigned long long using namespace std; int a[100005]; long double s = 1; signed main() { int n; cin >> n; for (int i ...
[["+", 8, 9, 0, 1, 0, 16, 12, 74, 0, 24], ["+", 0, 16, 12, 74, 39, 77, 39, 86, 0, 96], ["+", 8, 9, 0, 1, 0, 16, 12, 74, 0, 25]]
1
151
/************************************************ Start coding only after you have clear idea. *************************************************/ #include <bits/stdc++.h> #define x first #define y second #define pii pair<int, int> #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() using namespace ...
/************************************************ Start coding only after you have clear idea. *************************************************/ #include <bits/stdc++.h> #define x first #define y second #define pii pair<int, int> #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() using namespace ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 51, 16, 31, 16, 31, 23, 0, 74, 0, 24], ["-", 15, 339, 51, 16, 31, 16, 31, 23, 0, 25]]
1
153
import sys N = int(input()) An = [] mul = 1 An = list(map(int,input().split())) if An.count(0) > 0: print(-1) sys.exit() for i in An: mul *= i if mul > 10**18: print("-1") sys.exit() if mul <= 10**18: print(mul)
import sys N = int(input()) An = [] mul = 1 An = list(map(int,input().split())) if An.count(0) > 0: print("0") sys.exit() for i in An: mul *= i if mul > 10**18: print("-1") sys.exit() if mul <= 10**18: print(mul)
[["-", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["-", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612], ["+", 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]]
5
91
n=input() x=[int(i) for i in input().split()] prod=1 for i in x: prod=prod*i if prod>1000000000000000000: break if prod>1000000000000000000: print(-1) else: print(prod)
n=input() x=[int(i) for i in input().split()] x.sort() prod=1 for i in x: prod=prod*i if prod>1000000000000000000: break if prod>1000000000000000000: print(-1) else: print(prod)
[["+", 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
#include <algorithm> #include <iostream> #include <stdio.h> #include <string> #include <vector> using namespace std; int main() { long long N; cin >> N; long long ans = 1; long long A; int a, b; int X = 1; int Y = 1; for (long long i = 0; i < N; ++i) { cin >> A; if (A == 0) { Y = -1; ...
#include <algorithm> #include <iostream> #include <stdio.h> #include <string> #include <vector> using namespace std; int main() { long long N; cin >> N; long long ans = 1; long long A; int a, b; int X = 1; int Y = 1; for (long long i = 0; i < N; ++i) { cin >> A; if (A == 0) { Y = -1; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
209
#include <iostream> #include <stdio.h> #include <vector> using namespace std; long long MAX = 1000000000000000000; int main() { int n; cin >> n; vector<long long> list; for (int i = 0; i < n; i++) { long long a; cin >> a; list.push_back(a); } long long mult = 1; int count = 0; long l...
#include <iostream> #include <stdio.h> #include <vector> using namespace std; long long MAX = 1000000000000000000; int main() { int n; cin >> n; vector<long long> list; for (int i = 0; i < n; i++) { long long a; cin >> a; list.push_back(a); } long long mult = 1; int count = 0; long l...
[["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 46]]
1
197
#include <bits/stdc++.h> using namespace std; int main() { int64_t N, ans, M; long double nextnum = 0; bool conti = true; ans = 1; cin >> N; // vector<int64_t> A(N,0); for (int64_t i = 0; i < N; i++) { // cin >> A.at(i); cin >> M; if (M == 0) { cout << 0 << endl; return 0; } ...
#include <bits/stdc++.h> using namespace std; int main() { int64_t N, ans, M; long double nextnum = 1000000000000000001; bool conti = true; ans = 1; cin >> N; // vector<int64_t> A(N,0); for (int64_t i = 0; i < N; i++) { // cin >> A.at(i); cin >> M; if (M == 0) { cout << 0 << endl; ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60]]
1
157
p=int(input()) k=list(map(int,input().split())) if 0 in k: print(0) else: t=k[0] for e in range(1,len(k)): t = t * k[e] if t > 10**18: break if t > 10**8: print(-1) else: print(t)
p=int(input()) k=list(map(int,input().split())) if 0 in k: print(0) else: t=k[0] for e in range(1,len(k)): t = t * k[e] if t > 10**18: break if t > 10**18: print(-1) else: print(t)
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]]
5
89
n = int(input()) a = list(map(int,input().split())) result = 1 target = 10**18 if a.count(0) >= 1: result = 0 else: for an in a: result = an*result print(result) if result > target: result = -1 break print(result)
n = int(input()) a = list(map(int,input().split())) result = 1 target = 10**18 if a.count(0) >= 1: result = 0 else: for an in a: result = an*result if result > target: result = -1 break print(result)
[["-", 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
76
n = int(input()) a = list(map(int, input().split())) i = 0 x = 1 while i < n: x = x * a[i] i += 1 if x > 1000000000000000000: print(-1) exit() print(x)
n = int(input()) a = list(map(int, input().split())) a.sort() i = 0 x = 1 while i < n: x = x * a[i] i += 1 if x > 1000000000000000000: 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
64
n = int(input()) a = list(map(int,input.split())) a = sorted(a) prod = 1 for x in a: prod *= x if prod > 10**18: prod = -1 break print(prod)
n = int(input()) a = list(map(int,input().split())) a = sorted(a) prod = 1 for x in a: prod *= x if prod > 10**18: prod = -1 break print(prod)
[["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 25]]
5
56
N = int(input()) A = list(map(int, input().split())) ans = 1 flag=False for a in A: ans *= a if ans > 1e18: flag=True break if flag: print(-1) else: print(ans)
N = int(input()) A = list(map(int, input().split())) A.sort() ans = 1 flag=False for a in A: ans *= a if ans > 1e18: flag=True break if flag: print(-1) else: print(ans)
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
62
gets.to_i as=gets.split.map &:to_i c=1 if as.include?(0) p 0 else as.each do |a| c=a*c if c>10**18 p -1 return end end end p c
gets.to_i as=gets.split.map &:to_i c=1 if as.include?(0) p 0 else as.each do |a| c=a*c if c>10**18 puts -1 return end end puts c end
[["-", 8, 736, 0, 121, 64, 749, 0, 652, 735, 22], ["+", 8, 736, 0, 121, 64, 749, 0, 652, 735, 22], ["-", 0, 652, 196, 737, 8, 736, 0, 121, 0, 444], ["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 0, 493, 0, 121, 75, 95, 0, 652, 735, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 121, 0, 444]]
4
52
n=int(input()) list=[int(i) for i in input().split()] k=1 list.sort() x=list[0] while k<n: y=x*list[k] x=y if y<1000000000000000000: k=k+1 else: k=n+1 y=-1 print(y)
n=int(input()) list=[int(i) for i in input().split()] k=1 list.sort() x=list[0] while k<n: y=x*list[k] x=y if y<=1000000000000000000: k=k+1 else: k=n+1 y=-1 print(y)
[["-", 0, 52, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 52, 8, 196, 0, 57, 15, 666, 667, 19]]
5
81
n = input() a = input() a = a.split() x = 0; mul = 1; for num in a: if(int(num) == 0): mul = 0; break; else: mul *= int(num) if(mul > 1000000000000000000): mul = -1; break; print(mul);
n = input() a = input() a = a.split() x = 0; mul = 1; for num in a: if(int(num) == 0): mul = 0; break; for num in a: mul *= int(num) if(mul > 1000000000000000000): mul = -1; break; print(mul);
[["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 267], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22]]
5
73
n = int(input()) arr = [] p = 1 c = 0 l = 0 a = list(map(int,input().strip().split()))[:n] for i in range(n): if a[i]==0: c = 1 if p > 1000000000000000000: l = 1 else: p *= a[i] if c == 1: print(0) elif l == 1: print(-1) else: print(p)
n = int(input()) arr = [] p = 1 c = 0 l = 0 a = list(map(int,input().strip().split()))[:n] for i in range(n): if a[i]==0: c = 1 if p > 1000000000000000000: l = 1 else: p *= a[i] if c == 1: print(0) elif l == 1 or p > 1000000000000000000 : print(-1) else: print(p)
[["+", 0, 656, 0, 57, 75, 665, 15, 679, 17, 354], ["+", 0, 57, 75, 665, 15, 679, 12, 666, 0, 22], ["+", 0, 57, 75, 665, 15, 679, 12, 666, 667, 47], ["+", 0, 57, 75, 665, 15, 679, 12, 666, 0, 612]]
5
106
#include <bits/stdc++.h> #define FOR(i, num) for (i = 0; i < num; i++) #define REP(i, n) for (int i = 0; i < (n); ++i) #define ALL(obj) (obj).begin(), (obj).end() using namespace std; int main() { int N, i; long long int A[100000]; cin >> N; bool include_zero = false; REP(i, N) { cin >> A[i]; ...
#include <bits/stdc++.h> #define FOR(i, num) for (i = 0; i < num; i++) #define REP(i, n) for (int i = 0; i < (n); ++i) #define ALL(obj) (obj).begin(), (obj).end() using namespace std; int main() { int N, i; long long int A[100000]; cin >> N; bool include_zero = false; REP(i, N) { cin >> A[i]; ...
[["-", 8, 9, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
207
n=int(input()) alist=list(map(int,input().split())) a=1 if 0 in alist: print("0") else: for i in alist: if a<=10**18: a=a*i else: break if a>=10**18: print('-1') else: print(a)
n=int(input()) alist=list(map(int,input().split())) a=1 if 0 in alist: print("0") else: for i in alist: if a<=10**18: a=a*i else: break if a>10**18: print('-1') else: print(a)
[["-", 75, 76, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 667, 47]]
5
80
import sys n = int(input()) aa = input() a = aa.split() for i in range(n): if(a[i] == 0): print(0) sys.exit() result = 1 for i in range(n): result *= int(a[i]) if(result > 1000000000000000000): print(-1) sys.exit() print(result)
import sys n = int(input()) aa = input() a = aa.split() for i in range(n): if(int(a[i]) == 0): print(0) sys.exit() result = 1 for i in range(n): result *= int(a[i]) if(result > 1000000000000000000): print(-1) sys.exit() print(result)
[["+", 0, 57, 15, 23, 0, 666, 0, 652, 63, 22], ["+", 15, 23, 0, 666, 0, 652, 3, 4, 0, 24], ["+", 15, 23, 0, 666, 0, 652, 3, 4, 0, 25]]
5
90
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; using Vec = vector<int>; int main() { int n, k = 0; ll sum = 1; cin >> n; for (int i = 0; i < n; i++) { ll x; cin >> x; ull test = sum; sum = sum * x; if (x == 0) {...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; using Vec = vector<int>; int main() { int n, k = 0; ll sum = 1; cin >> n; for (int i = 0; i < n; i++) { ll x; cin >> x; ll test = sum; sum = sum * x; if (x == 0) {...
[["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94]]
1
181
#include <algorithm> #include <climits> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> using namespace std; int main() { int c = 1000000007; long long int n; cin >> n; long long in...
#include <algorithm> #include <climits> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> using namespace std; int main() { int c = 1000000007; unsigned long long int n; cin >> n; uns...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 87], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 75, 76, 0, 9, 0, 43, 39, 86, 0, 87]]
1
213
#include <algorithm> #include <cstdio> #define LL long long #define num 1e18 using namespace std; LL a[100010]; int main() { int n, i; LL ans = 1; scanf("%d", &n); for (i = 1; i <= n; i++) scanf("%lld", &a[i]); sort(a + 1, a + 1 + n); if (a[1] == 0) { printf("0\n"); return 0; } for (i = 1; ...
#include <algorithm> #include <cstdio> #define LL long long #define num (LL)1000000000000000000 using namespace std; LL a[100010]; int main() { int n, i; LL ans = 1; scanf("%d", &n); for (i = 1; i <= n; i++) scanf("%lld", &a[i]); sort(a + 1, a + 1 + n); if (a[1] == 0) { printf("0\n"); return 0;...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
165
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) FOR(i, 0, n) #define all(x) (x).begin(), (x).end() #define YES() printf("YES\n") #define NO() printf("NO\n") #define isYES(x) printf("%s\n", (x) ? "YES" : "NO") #define Yes() printf("Yes\n") #define No()...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) FOR(i, 0, n) #define all(x) (x).begin(), (x).end() #define YES() printf("YES\n") #define NO() printf("NO\n") #define isYES(x) printf("%s\n", (x) ? "YES" : "NO") #define Yes() printf("Yes\n") #define No()...
[["+", 0, 14, 8, 9, 0, 37, 0, 16, 17, 33], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]]
1
382
#include <bits/stdc++.h> #define IOS \ { \ ios::sync_with_stdio(0); \ cin.tie(0); ...
#include <bits/stdc++.h> #define IOS \ { \ ios::sync_with_stdio(0); \ cin.tie(0); ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
243
<?php $n = (int)fgets(STDIN); $a = array_map('intval', explode(' ',trim(fgets(STDIN)))); $mul = 1; for ($i=0; $i<$n; $i++) { $keta = log10($mul)+log10($a[$i]); if ($keta>=18.1) { echo -1; exit; } $mul *= $a[$i]; if ($mul > 1000000000000000000) { echo -1; exit; } } echo $mul;
<?php $n = (int)fgets(STDIN); $a = array_map('intval', explode(' ',trim(fgets(STDIN)))); sort($a); $mul = 1; for ($i=0; $i<$n; $i++) { $keta = log10($mul)+log10($a[$i]); if ($keta>=18.1) { echo -1; exit; } $mul *= $a[$i]; if ($mul > 1000000000000000000) { echo -1; exit; } } echo $mul;
[["+", 36, 36, 0, 493, 0, 1, 0, 613, 63, 141], ["+", 0, 493, 0, 1, 0, 613, 3, 3, 0, 24], ["+", 0, 613, 3, 3, 0, 28, 0, 606, 0, 607], ["+", 0, 613, 3, 3, 0, 28, 0, 606, 0, 141], ["+", 0, 493, 0, 1, 0, 613, 3, 3, 0, 25], ["+", 36, 36, 36, 36, 0, 493, 0, 1, 0, 35]]
6
124
n = int(input()) n_list = list(map(int, input().split())) multi = 1 a = 1 for i in range(n): if n_list[i]==0: a = 0 break for i in range(n): if a == 0: multi = 0 break multi *= n_list[i] if multi>1e18: break print(multi) if multi<=1e18: print(multi) else...
n = int(input()) n_list = list(map(int, input().split())) multi = 1 a = 1 for i in range(n): if n_list[i]==0: a = 0 break for i in range(n): if a == 0: multi = 0 break multi *= n_list[i] if multi>1e18: break if multi<=1e18: print(multi) else: print(-...
[["-", 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
100
a = int(input()) b = input().split() for i in range(0,len(b)): b[i]=int(b[i]) state=1 for x in b: if x==0: state=0 print("0") break res=1 if state==1: for x in b: res*=x if res>1000000000000000000: print("-1") state=0 if state==1: pri...
a = int(input()) b = input().split() for i in range(0,len(b)): b[i]=int(b[i]) state=1 for x in b: if x==0: state=0 print("0") break res=1 if state==1: for x in b: res*=x if res>1000000000000000000: print("-1") state=0 break if...
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
104
#include "bits/stdc++.h" using namespace std; using Graph = vector<vector<int>>; const int MOD = 1000000007; const int64_t MAX_VALUE = static_cast<int64_t>(pow(10, 18)); void Main() { long long N; cin >> N; vector<int64_t> A(N); for (long long i = 0; i < N; i++) { cin >> A[i]; } int64_t value = 1; bo...
#include "bits/stdc++.h" using namespace std; using Graph = vector<vector<int>>; const int MOD = 1000000007; const int64_t MAX_VALUE = static_cast<int64_t>(pow(10, 18)); void Main() { long long N; cin >> N; vector<int64_t> A(N); for (long long i = 0; i < N; i++) { cin >> A[i]; } int64_t value = 1; bo...
[["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 147], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
203
n = int(input()) nums = list(map(int, input().split())) ans = 1 if nums.count(0) > 0: ans = 0 else: for i in range(n): ans *= nums[i] if ans >= 10**18: ans = -1 break print(ans)
n = int(input()) nums = list(map(int, input().split())) ans = 1 if nums.count(0) > 0: ans = 0 else: for i in range(n): ans *= nums[i] if ans > 10**18: ans = -1 break print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
73
def main(): N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) return ans = 1 for a in A: ans *= a if ans >= pow(10, 10, 18): print(-1) return print(ans) if __name__ == "__main__": main()
def main(): N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) return ans = 1 for a in A: ans *= a if ans > pow(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], ["-", 0, 57, 15, 666, 0, 652, 3, 4, 0, 612], ["-", 0, 57, 15, 666, 0, 652, 3, 4, 0, 21]]
5
83
n = int(input()) num = list(map(int,input().split(" "))) zero=num.count(0) z= 10 ** 18 if zero != 0: print(0) else: s = num[0] for i in range(1,n): s = s * num[i] if len(str(s)) > z: s=-1 break print(s)
n = int(input()) num = list(map(int,input().split(" "))) zero=num.count(0) z= 10 **18 if zero != 0: print(0) else: s = num[0] for i in range(1,n): s = s * num[i] if s > z: s=-1 break print(s)
[["-", 8, 196, 0, 57, 15, 666, 0, 652, 63, 22], ["-", 0, 57, 15, 666, 0, 652, 3, 4, 0, 24], ["-", 15, 666, 0, 652, 3, 4, 0, 652, 63, 22], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["-", 0, 57, 15, 666, 0, 652, 3, 4, 0, 25]]
5
96
n = int(input()) a = [int(i) for i in input().split()] x = 1 f = 0 for i in range(n): #print(a[i]) x = x*a[i] if x == 0: print(0) f = 1 break elif x > 1000000000000000000: print(-1) f = 1 break if f == 0: print(x)
n = int(input()) a = [int(i) for i in input().split()] x = 1 f = 0 a.sort() for i in range(n): #print(a[i]) x = x*a[i] if x == 0: print(0) f = 1 break elif x > 1000000000000000000: print(-1) f = 1 break if f == 0: 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
85
n = int(input()) a = [int(i) for i in input().split()] ans = 1 if 0 in a: print(0) else: for i in a: ans = ans * i if ans >= 1000000000000000000: break if ans >= 1000000000000000000: print('-1') else: print(ans)
n = int(input()) a = [int(i) for i in input().split()] ans = 1 if 0 in a: print(0) else: for i in a: ans = ans * i if ans > 1000000000000000000: break if ans > 1000000000000000000: print('-1') else: print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["-", 75, 76, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 667, 47]]
5
73
const Main = input => { input = input.split("\n"); const n = parseInt(input[0], 10); const arr = input[1].split(" ").map(value => parseInt(value, 10)); // 10^18は精度外なのでBigIntを使わないといけない let result = 1n; if (arr.includes(0)) { result = 0; } else { for (let i =...
const Main = input => { input = input.split("\n"); const n = parseInt(input[0], 10); const arr = input[1].split(" ").map(value => parseInt(value, 10)); // 10^18は精度外なのでBigIntを使わないといけない let result = 1n; if (arr.includes(0)) { result = 0; } else { for (let i =...
[["-", 0, 1, 0, 2, 3, 3, 0, 2, 63, 22], ["+", 0, 1, 0, 2, 3, 3, 0, 2, 63, 22]]
2
159
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) using P = pair<int, int>; int main() { int n; cin >> n; vector<ll> a(n); rep(i, n) cin >> a[i]; ll ans = 1; sort(a.begin(), a.end()); if (a[0] == 0) { cout << 0 << endl; } else { f...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) using P = pair<int, int>; int main() { int n; cin >> n; vector<ll> a(n); rep(i, n) cin >> a[i]; ll ans = 1; sort(a.begin(), a.end()); if (a[0] == 0) { cout << 0 << endl; } else { f...
[["-", 0, 9, 0, 7, 8, 9, 0, 43, 39, 78], ["+", 0, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
182
i = 0 ans = 1 n = int(input()) a = list(map(int, input().split())) if 0 in a: print(0) else: while ans<10**10 and i<len(a): ans*=a[i] i+=1 if (ans<=10**18): print(ans) else: print(-1)
i = 0 ans = 1 n = int(input()) a = list(map(int, input().split())) if 0 in a: print(0) else: while ans<10**18 and i<len(a): ans*=a[i] i+=1 if (ans<=10**18): print(ans) else: print(-1)
[["-", 0, 52, 15, 679, 31, 666, 0, 657, 12, 612], ["+", 0, 52, 15, 679, 31, 666, 0, 657, 12, 612]]
5
85
n = int(input()) A = sorted(map(int,input().split())) ans = 1 if A[0] == 0: print(0) exit() for i in range(1,n+1): ans *= A[-i] if ans >= 10**18: print(-1) exit() print(ans)
n = int(input()) A = sorted(map(int,input().split())) ans = 1 if A[0] == 0: print(0) exit() for i in range(1,n+1): 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
81
#include <bits/stdc++.h> #define ll long long int #define pb push_back #define pp pop_back #define rt return #define cinarr(n, arr) \ for (int i = 0; i < n; i++) \ cin >> arr[i] #define putarr(n, k, arr) ...
#include <bits/stdc++.h> #define ll long long int #define pb push_back #define pp pop_back #define rt return #define cinarr(n, arr) \ for (int i = 0; i < n; i++) \ cin >> arr[i] #define putarr(n, k, arr) ...
[["-", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
511