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())
A = map(int, input().split())
if 0 in A:
print(0)
exit()
ans = 1
for a in A:
ans *= a
if ans > 10**18:
print(-1)
break
else:
print(ans) | N = int(input())
A = list(map(int, input().split()))
if 0 in A:
print(0)
exit()
ans = 1
for a in A:
ans *= a
if ans > 10**18:
print(-1)
break
else:
print(ans) | [["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 64 |
N=int(input())
As=list(map(int,input().split()))
Ans=1
if As.count(0):
print(0)
exit()
else:
for A in range(N):
if Ans>10**18:
print(Ans)
exit()
else:
NewAns=Ans*As[A]
Ans=NewAns
if Ans>10**18:
Ans=-1
print(Ans) | N=int(input())
As=list(map(int,input().split()))
Ans=1
if As.count(0):
print(0)
exit()
else:
for A in range(N):
if Ans>10**18:
Ans=-1
print(Ans)
exit()
else:
NewAns=Ans*As[A]
Ans=NewAns
if Ans>10**18:
Ans=-1
pr... | [["+", 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, 662, 12, 664, 17, 33], ["+", 64, 196, 0, 1, 0, 662, 12, 664, 28, 612]] | 5 | 95 |
n = int(input())
S = list(map(int,input().split()))
ans = 1
for i in S:
if ans >= 0:
ans = ans * i
if ans >= 10**18:
ans = -1
if 0 in S:
ans = 0
print(ans) | n = int(input())
S = list(map(int,input().split()))
ans = 1
for i in S:
if ans >= 0:
ans = ans * i
if ans > 10**18:
ans = -1
if 0 in S:
ans = 0
print(ans) | [["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]] | 5 | 66 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll, ll> pairs;
int main() {
// your code goes here
std::ios::sync_with_stdio(false);
ll t, n, i, j, l, c, f;
long double k;
cin >> n;
i = 1;
c = 1;
f = 2;
while (i <= n) {
cin >> k;
if (k == 0) {
c = 0;
... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll, ll> pairs;
int main() {
// your code goes here
std::ios::sync_with_stdio(false);
ll t, n, i, j, l, c, f;
long double k;
cin >> n;
i = 1;
c = 1;
f = 2;
while (i <= n) {
cin >> k;
if (k == 0) {
c = 0;
... | [["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 1, 0, 16, 12, 2, 63, 23, 0, 24], ["+", 0, 1, 0, 16, 12, 2, 63, 23, 0, 22], ["+", 0, 1, 0, 16, 12, 2, 63, 23, 0, 25], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 25]] | 1 | 150 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for (int(i) = (n); (i) < (m); (i)++)
#define repn(i, n) for (int(i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for (int(i) = (n - 1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define l... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for (int(i) = (n); (i) < (m); (i)++)
#define repn(i, n) for (int(i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for (int(i) = (n - 1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define l... | [["-", 51, 16, 31, 16, 12, 16, 31, 16, 12, 22], ["-", 15, 339, 51, 16, 31, 16, 12, 16, 17, 18], ["-", 15, 339, 51, 16, 31, 16, 12, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["-", 15, 339, 51, 16, 12, 16, 31, 16, 31, 22], ["-", 15, 339, 51, 16, 12, 16, 31, 16, 17, 85]] | 1 | 325 |
n = int(input())
k = list(map(int,input().split()))
ans = 1
if 0 in k:
ans = 0
for i in range(n):
if ans == 0:
break
ans *= k[i]
if ans > 10**18:
ans = -1
break
print(ans)
print(k) | n = int(input())
k = list(map(int,input().split()))
ans = 1
if 0 in k:
ans = 0
for i in range(n):
if ans == 0:
break
ans *= k[i]
if ans > 10**18:
ans = -1
break
print(ans)
| [["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 76 |
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
ll a[maxn];
int main() {
ll sum = 1, flag = 1;
ll n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] == 0) {
flag = 2;
}
}
if (fl... | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
ll a[maxn];
int main() {
ll sum = 1, flag = 1;
ll n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] == 0) {
flag = 2;
}
}
if (fl... | [["-", 0, 7, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 7, 8, 9, 0, 43, 39, 86, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]] | 1 | 174 |
N= int(input())
A= list(map(int,input().split()))
A = sorted(A)
if A[0] == 0:
print(0)
else:
S = 1
for n in range(N):
S *= A[N-1-n]
if S > 10**18:
S = -1
print(S)
| N= int(input())
A= list(map(int,input().split()))
A = sorted(A)
if A[0] == 0:
print(0)
else:
S = 1
for n in range(N):
S *= A[N-1-n]
if S > 10**18:
S = -1
break
print(S)
| [["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]] | 5 | 81 |
n = input()
a = input().split()
a = [int(s) for s in a]
a.sort(reverse=True)
if a[-1] == 0:
print(0)
sum = 1
for i in a:
sum *= i
if sum > 10**18:
sum = -1
break
print(sum)
| n = input()
a = input().split()
a = [int(s) for s in a]
a.sort(reverse=True)
if a[-1] == 0:
print(0)
else :
sum = 1
for i in a:
sum *= i
if sum > 10**18:
sum = -1
break
print(sum) | [["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102]] | 5 | 74 |
import math
n= int(input())
l = list(map(int,input().split()))
l.sort(reverse = True)
print(l)
ans = 1
if 0 in l:
print(0)
else:
for i in range(n):
ans *= l[i]
# print(ans)
if ans > 10**18:
break
print(ans if ans <= 10**18 else -1)
| import math
n= int(input())
l = list(map(int,input().split()))
l.sort(reverse = True)
ans = 1
if 0 in l:
print(0)
else:
for i in range(n):
ans *= l[i]
# print(ans)
if ans > 10**18:
break
print(ans if ans <= 10**18 else -1)
| [["-", 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 | 89 |
n=int(input())
a=list(map(int, input().split()))
ans=a[0]
for i in a:
if i==0:
print(-1)
exit()
for i in a[1:]:
ans*=i
if ans>10**18:
print(-1)
exit()
print(ans) | n=int(input())
a=list(map(int, input().split()))
ans=a[0]
for i in a:
if i==0:
print(0)
exit()
for i in a[1:]:
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 | 80 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD = 1e9 + 7;
#define INF 2e9
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i,... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD = 1e9 + 7;
#define INF 2e9
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i,... | [["-", 51, 16, 12, 23, 0, 16, 31, 16, 12, 13], ["+", 51, 16, 12, 23, 0, 16, 31, 16, 12, 13], ["-", 51, 16, 12, 23, 0, 16, 12, 16, 12, 13], ["+", 51, 16, 12, 23, 0, 16, 12, 16, 12, 13]] | 1 | 299 |
N = int(input())
List = list(map(int,input().split()))
ans = 1
for item in List:
ans *= item
if ans > 10 **18:
ans = -1
print(ans) | N = int(input())
List = list(map(int,input().split()))
ans = 1
for item in List:
ans *= item
if ans > 10 **18 or ans <= -1:
ans = -1
print(ans) | [["+", 0, 7, 8, 196, 0, 57, 15, 679, 17, 354], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667, 19], ["+", 0, 57, 15, 679, 12, 666, 0, 664, 17, 33], ["+", 0, 57, 15, 679, 12, 666, 0, 664, 28, 612]] | 5 | 51 |
n = int(input())
l = list(map(int,input().split()))
ans = l[0]
minn = min(l)
if (minn == 0):
print(-1)
else:
for i in range(1,len(l)):
ans = ans * l[i]
if ans >= 1000000000000000001:
break
if ans >= 1000000000000000001:
print(-1)
else:
print(ans)
... | n = int(input())
l = list(map(int,input().split()))
ans = l[0]
minn = min(l)
if (minn == 0):
print(0)
else:
for i in range(1,len(l)):
ans = ans * l[i]
if ans >= 1000000000000000001:
break
if ans >= 1000000000000000001:
print(-1)
else:
print(ans)
| [["-", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["-", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]] | 5 | 94 |
#include <bits/stdc++.h>
#define rep(i, a) for (int(i) = 0; (i) < (a); (i)++)
#define rrep(i, a) for (int(i) = a - 1; (i) >= (0); (i)--)
#define rep2(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define MOD 1000000007
#define all(v) v.begin(), v.end()
typedef long long ll;
using namespace std;
int main() {
ios_bas... | #include <bits/stdc++.h>
#define rep(i, a) for (int(i) = 0; (i) < (a); (i)++)
#define rrep(i, a) for (int(i) = a - 1; (i) >= (0); (i)--)
#define rep2(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define MOD 1000000007
#define all(v) v.begin(), v.end()
typedef long long ll;
using namespace std;
int main() {
ios_bas... | [["-", 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 | 185 |
n = int(input())
lista = list(map(int, input().split()))
limitNumber = 10**18
ans = 1
if 0 in lista:
ans = 0
else:
lista.sort(reverse=True)
print(lista)
for i in range(n):
ans *= lista[i]
if(ans > limitNumber):
ans = -1
break
print(ans)
| n = int(input())
lista = list(map(int, input().split()))
limitNumber = 10**18
ans = 1
if 0 in lista:
ans = 0
else:
lista.sort(reverse=True)
for i in range(n):
ans *= lista[i]
if(ans > limitNumber):
ans = -1
break
print(ans)
| [["-", 75, 76, 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 | 85 |
n = int(input())
a = list(map(int, input().split()))
ans = 1
if 0 in a:
print(-1)
exit()
for i in range(n):
ans *= a[i]
if ans > 1000000000000000000:
print(-1)
exit()
print(ans)
| 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 > 1000000000000000000:
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 | 72 |
n=int(input())
a_list=list(map(int, input().split()))
multi_sum=1
LIMIT=1000000000000000000
if 0 not in a_list:
for a_i in a_list:
multi_sum*=a_i
if multi_sum > LIMIT:
multi_sum=-1
else:
multi_sum=0
print(multi_sum)
| n=int(input())
a_list=list(map(int, input().split()))
multi_sum=1
LIMIT=1000000000000000000
if 0 not in a_list:
for a_i in a_list:
multi_sum*=a_i
if multi_sum > LIMIT:
multi_sum=-1
break
else:
multi_sum=0
print(multi_sum)
| [["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]] | 5 | 63 |
import sys
N = int(input())
A = list(map(int, input().split()))
ans = 1
if A.count(0) == 0:
print(0)
sys.exit()
for i in A:
ans = ans*i
if ans > int(10**18):
print(-1)
sys.exit()
if ans > int(10**18):
print(-1)
else:
print(ans) | import sys
N = int(input())
A = list(map(int, input().split()))
ans = 1
if A.count(0) != 0:
print(0)
sys.exit()
for i in A:
ans = ans*i
if ans > int(10**18):
print(-1)
sys.exit()
if ans > int(10**18):
print(-1)
else:
print(ans) | [["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 79]] | 5 | 100 |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
void solve1();
void solve() {
int t;
cin >> t;
while (t--) {
solve1();
}
}
int main() {
solve1();
return 0;
}
void solve1() {
ll n;
cin >> n;
ll ans;
cin >> ans;
for (ll i = 1; i < n; i++) {
ll x;
cin >> x;
if (x ==... | #include <bits/stdc++.h>
#define ll long long
using namespace std;
void solve1();
void solve() {
int t;
cin >> t;
while (t--) {
solve1();
}
}
int main() {
solve1();
return 0;
}
void solve1() {
ll n;
cin >> n;
ll ans;
cin >> ans;
for (ll i = 1; i < n; i++) {
ll x;
cin >> x;
if (x ==... | [["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]] | 1 | 149 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = 1LL << 60;
// int INF = numeric_limits<int>::max();
int main(int, char **) {
ll limit = pow(10, 18);
ll ret = 1;
int n;
cin >> n;
vector<ll> A;
for (int i = 0; i < n; i++) {
ll a;
cin >>... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = 1LL << 60;
// int INF = numeric_limits<int>::max();
int main(int, char **) {
ll limit = pow(10, 18);
ll ret = 1;
int n;
cin >> n;
vector<ll> A;
for (int i = 0; i < n; i++) {
ll a;
cin >>... | [["-", 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 | 188 |
n = int(input())
a = list(map(int, input().split()))
answer = 1
zero_check = 0 in a
for i in range(n):
answer = a[i] * answer
if zero_check:
print(answer)
break
elif answer > 1000000000000000000:
print(-1)
break
else:
print(answer)
| n = int(input())
a = list(map(int, input().split()))
answer = 1
zero_check = 0 in a
for i in range(n):
answer = a[i] * answer
if zero_check:
print(0)
break
elif answer > 1000000000000000000:
print(-1)
break
else:
print(answer)
| [["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]] | 5 | 74 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); ++(i))
const int INF = 1001001001;
int main() {
int n;
cin >> n;
vector<long long> a(n);
rep(i, n) cin >> a[i];
rep(i, n) {
if (a[i] == 0) {
cout << '-1';
return 0;
}
}
long long ans = 1;
l... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); ++(i))
const int INF = 1001001001;
int main() {
int n;
cin >> n;
vector<long long> a(n);
rep(i, n) cin >> a[i];
rep(i, n) {
if (a[i] == 0) {
cout << 0;
return 0;
}
}
long long ans = 1;
long... | [["-", 64, 9, 0, 1, 0, 16, 12, 103, 0, 104], ["-", 64, 9, 0, 1, 0, 16, 12, 103, 0, 125], ["-", 0, 1, 0, 16, 12, 103, 0, 42, 0, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 13]] | 1 | 202 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define INF (2e9)
int main() {
ll n, a[1000000], ans;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] == 0) {
cout << 0 << endl;
return 0;
}
}
ans = 1;
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define INF (2e9)
int main() {
ll n, a[1000000], ans;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] == 0) {
cout << 0 << endl;
return 0;
}
}
ans = 1;
... | [["-", 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 | 148 |
from functools import *
import sys
sys.setrecursionlimit(100000)
def acinput():
return list(map(int, input().split(" ")))
N=input()
a=acinput()
if min(a)==0:
print(0)
sys.exit()
res=1
for sa in a:
res*=sa
if res>10**18:
res=-1
print(res)
|
from functools import *
import sys
sys.setrecursionlimit(100000)
def acinput():
return list(map(int, input().split(" ")))
N=input()
a=acinput()
if min(a)==0:
print(0)
sys.exit()
res=1
for sa in a:
res*=sa
if res>10**18:
res=-1
break
print(res)
| [["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]] | 5 | 89 |
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main() {
ll n;
cin >> n;
ll a[n];
ll ans = 1;
for (ll i = 0; i < n; i++) {
cin >> a[i];
if (a[i] == 0)
ans = 0;
if (ans != -1)
ans = ans * a[i];
if (ans > 1000000000000000000)
ans = -1;
}
cout << a... | #include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main() {
ll n;
cin >> n;
ll a[n];
long double ans = 1;
for (ll i = 0; i < n; i++) {
cin >> a[i];
if (a[i] == 0)
ans = 0;
if (ans != -1)
ans = ans * a[i];
if (ans > 1000000000000000000)
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], ["+", 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 | 103 |
import sys
input = sys.stdin.readline
N = int(input())
A = map(int, input().split())
A.sort()
ans = 1
for a in A:
ans = ans * a
if ans > 1000000000000000000:
print -1
quit()
print(ans)
| import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = 1
for a in A:
ans = ans * a
if ans > 1000000000000000000:
print(-1)
quit()
print(ans)
| [["+", 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], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 64 |
n = int(input())
a = list(map(int, input(). split()))
ans = 1
if a.count(0) >= 1:
print(0)
exit()
for i in range(n):
ans = ans*a[i]
if ans > 10**18:
ans = -1
print(ans) | n = int(input())
a = list(map(int, input(). split()))
ans = 1
if a.count(0) >= 1:
print(0)
exit()
for i in range(n):
ans = ans*a[i]
if ans > 10**18:
ans = -1
break
print(ans) | [["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]] | 5 | 76 |
from functools import reduce
N = int(input())
A = map(int, input().split())
if 0 in A:
print(0)
exit()
mul = 1
for n in A:
mul *= n
if mul > 10 ** 18:
print(-1)
exit()
print(mul) | from functools import reduce
N = int(input())
A = [*map(int, input().split())]
if 0 in A:
print(0)
exit()
mul = 1
for n in A:
mul *= n
if mul > 10 ** 18:
print(-1)
exit()
print(mul)
| [["+", 0, 656, 0, 1, 0, 662, 12, 634, 0, 70], ["+", 0, 662, 12, 634, 0, 652, 63, 661, 0, 48], ["+", 0, 656, 0, 1, 0, 662, 12, 634, 0, 73]] | 5 | 68 |
n = int(input())
A = list(map(int, input().split()))
tmp = 1
A.sort()
#print(A)
if A[0] == 0:
print(0)
for i in range(n):
tmp *= A[i]
if tmp > 10**18:
tmp = -1
print(tmp)
exit()
print(tmp)
|
n = int(input())
A = list(map(int, input().split()))
tmp = 1
A.sort()
#print(A)
if A[0] == 0:
print(0)
exit()
for i in range(n):
tmp *= A[i]
if tmp > 10**18:
tmp = -1
print(tmp)
exit()
print(tmp) | [["+", 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 | 82 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(a) (a).begin(), (a).end()
typedef vector<int> vi;
const int INF = 1LL << 60; // 10e18+10e17ちょっとくらい
const int MOD = 1000000007;
const int MAX_N = 200100;
int tmp[100001];
si... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(a) (a).begin(), (a).end()
typedef vector<int> vi;
const int INF = 1LL << 60; // 10e18+10e17ちょっとくらい
const int MOD = 1000000007;
const int MAX_N = 200100;
int tmp[100001];
si... | [["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 90], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 180 |
n=int(input())
a=map(int,input().split())
val = 1
exceed = 0
for i in a:
if(exceed==0):
val*=i
if(val==0):
print(0)
exit(0)
if(val>1000000000000000000):
exceed=1
if(exceed==0):
print(val)
else:
print(-1) | n=int(input())
a=map(int,input().split())
val = 1
exceed = 0
for i in a:
if(exceed==0 or i==0):
val*=i
if(val==0):
print(0)
exit(0)
if(val>1000000000000000000):
exceed=1
if(exceed==0):
print(val)
else:
print(-1) | [["+", 8, 196, 0, 57, 15, 23, 0, 679, 17, 354], ["+", 0, 57, 15, 23, 0, 679, 12, 666, 0, 22], ["+", 0, 57, 15, 23, 0, 679, 12, 666, 667, 60], ["+", 0, 57, 15, 23, 0, 679, 12, 666, 0, 612]] | 5 | 86 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using v = vector<int>;
using vv = vector<v>;
const int MOD = 1000000007;
const ll INF = 1001001001001;
int main() {
int n;
cin >> n;
vector<ll> a(n);
double loga = 0;
... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using v = vector<int>;
using vv = vector<v>;
const int MOD = 1000000007;
const ll INF = 1001001001001;
int main() {
int n;
cin >> n;
vector<ll> a(n);
double loga = 0;
... | [["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]] | 1 | 215 |
n=int(input())
a=map(int,input().split())
x=10**18
ans=1
if 0 in a:
ans=0
else:
for i in a:
ans=ans*i
if(ans>x):
ans=-1
break
print(ans) | n=int(input())
a=list(map(int,input().split()))
x=10**18
ans=1
if 0 in a:
ans=0
else:
for i in a:
ans=ans*i
if(ans>x):
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 | 66 |
# -*- coding: utf-8 -*-
N = int(input())
numlist = list(map(int, input().split()))
if 0 < numlist.count(0):
print('0')
quit()
total = 1
for i in numlist:
total *= abs(i)
if 10 ** 18 < total:
print('-1')
quit()
print(sign * total) | # -*- coding: utf-8 -*-
N = int(input())
numlist = list(map(int, input().split()))
if 0 < numlist.count(0):
print('0')
quit()
total = 1
for i in numlist:
total *= i
if 10 ** 18 < total:
print('-1')
quit()
print(total) | [["-", 8, 196, 0, 1, 0, 677, 12, 652, 63, 22], ["-", 0, 1, 0, 677, 12, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 677, 12, 652, 3, 4, 0, 25], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 48]] | 5 | 81 |
n = int(input())
a = list(map(int,input().split()))
MV = 10**18
ans =1
if 0 in a :
print(-1)
exit()
for ele in a:
ans *= ele
if ans > MV :
print(-1)
exit()
print(ans)
| n = int(input())
a = list(map(int,input().split()))
MV = 10**18
ans =1
if 0 in a :
print(0)
exit()
for ele in a:
ans *= ele
if ans > MV :
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 | 71 |
N = int(input())
A = list(map(int,input().split()))
MAX = 10**18
ret = 1
flag = True
if 0 in A:
print(0)
else:
for a in A:
ret *= a
if ret > MAX:
print('-1')
flag = False
break
if flag and ret < MAX:
print(ret) | N = int(input())
A = list(map(int,input().split()))
MAX = 10**18
ret = 1
flag = True
if 0 in A:
print(0)
else:
for a in A:
ret *= a
if ret > MAX:
print(-1)
flag = False
break
if flag and ret <= MAX:
print(ret) | [["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612], ["-", 8, 196, 0, 57, 15, 679, 12, 666, 667, 18], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667, 19]] | 5 | 81 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
typedef long long ll;
int main() {
ll n;
cin >> n;
ll a[100010], seki[100010];
rep(i, 0, n) {
cin >> a[i];
if (a[i] == 0) {
cout << 0 << endl;
return 0;
}
}
seki[0] = a[0];
in... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
typedef long long ll;
int main() {
ll n;
cin >> n;
ll a[100010], seki[100010];
rep(i, 0, n) {
cin >> a[i];
if (a[i] == 0) {
cout << 0 << endl;
return 0;
}
}
seki[0] = a[0];
in... | [["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13]] | 1 | 209 |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod = 1000000007;
double pi = 3.14159265358979;
ll r(ll x, ll y) {
if (y == 0)
return 1;
else if (y % 2 == 0)
return r(x, y / 2) * r(x, y / 2) % mod;
else
return x * r(x, (y - 1) / 2) % mod * r(x, (y - 1) / 2) % mod;
}
int ma... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod = 1000000007;
double pi = 3.14159265358979;
ll r(ll x, ll y) {
if (y == 0)
return 1;
else if (y % 2 == 0)
return r(x, y / 2) * r(x, y / 2) % mod;
else
return x * r(x, (y - 1) / 2) % mod * r(x, (y - 1) / 2) % mod;
}
int ma... | [["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 12, 22]] | 1 | 216 |
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)
break
elif i==n-1:
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)
break
elif i==n-1:
print(ans) | [["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 140], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 578]] | 5 | 77 |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef pair<string, string> Pstring;
typedef pair<double, double> Pdouble;
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REP1(i, n) for (ll i = 1; i <= n; i++)
#define Precision13 cout <<... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef pair<string, string> Pstring;
typedef pair<double, double> Pdouble;
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REP1(i, n) for (ll i = 1; i <= n; i++)
#define Precision13 cout <<... | [["-", 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], ["+", 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 | 206 |
N=int(input())
a=list(map(int,input().split()))
import sys
for i in range(N):
if a[i]==0:
print (0)
sys.exit()
p=1
for i in range(N):
p=p*a[i]
if p>10**18:
print (-1,p)
sys.exit()
if p>10**18:
print (-1)
else:
print(p) | N=int(input())
a=list(map(int,input().split()))
import sys
for i in range(N):
if a[i]==0:
print (0)
sys.exit()
p=1
for i in range(N):
p=p*a[i]
if p>10**18:
print (-1)
sys.exit()
if p>10**18:
print (-1)
else:
print(p) | [["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]] | 5 | 108 |
#include <iostream>
#include <vector>
using namespace std;
uint64_t LIMIT = 1000000000000000000;
int main(int argc, const char *argv[]) {
uint64_t N;
cin >> N;
uint64_t A = 1;
bool limit = false;
for (uint64_t i = 0; i < N; i++) {
uint64_t tmp;
cin >> tmp;
if (tmp == 0) {
A = 0;
brea... | #include <iostream>
#include <vector>
using namespace std;
uint64_t LIMIT = 1000000000000000000;
int main(int argc, const char *argv[]) {
uint64_t N;
cin >> N;
uint64_t A = 1;
bool limit = false;
for (uint64_t i = 0; i < N; i++) {
uint64_t tmp;
cin >> tmp;
if (tmp == 0) {
A = 0;
lim... | [["+", 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], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94]] | 1 | 128 |
# -*- coding: utf-8 -*-
import math
n = int(input())
a = list(map(int, input().split()))
q = 1
f = 0
for i in a:
q *= i
if q > 10**18:
f = 1
break
if f == 1:
print(-1)
else:
print(q) | # -*- coding: utf-8 -*-
import math
n = int(input())
a = list(map(int, input().split()))
a.sort()
q = 1
f = 0
for i in a:
q *= i
if q > 10**18:
f = 1
break
if f == 1:
print(-1)
else:
print(q) | [["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 69 |
N = int(input())
A = list(map(int, input().split()))
ans=1
i=0
while ans<=1000000000000000000:
ans=ans*A[i]
i+=1
if A.count(0)>0:
print(0)
else:
print(ans if ans<=1000000000000000000 else "-1") | N = int(input())
A = list(map(int, input().split()))
ans=1
i=0
while ans<=1000000000000000000 and i<N:
ans=ans*A[i]
i+=1
if A.count(0)>0:
print(0)
else:
print(ans if ans<=1000000000000000000 else "-1") | [["+", 36, 36, 0, 656, 0, 52, 15, 679, 17, 355], ["+", 0, 656, 0, 52, 15, 679, 12, 666, 0, 22], ["+", 0, 656, 0, 52, 15, 679, 12, 666, 667, 18]] | 5 | 75 |
def sol():
n = int(input())
mul = 1
arr = list(map(int, input().split()))
for i in arr:
mul*=i
if(mul>10**18):
print(-1)
return
print(mul)
sol() | def sol():
n = int(input())
mul = 1
arr = list(map(int, input().split()))
arr.sort()
for i in arr:
mul*=i
if(mul>10**18):
print(-1)
return
print(mul)
sol() | [["+", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 63 |
n = gets.strip.to_i
arr = gets.chomp.split(" ").map(&:to_i)
# n = 2
# arr = [1000000000, 1000000000]
# n = 3
# arr = [101, 9901, 999999000001]
MAX = 10**18
arr = arr.sort{|a, b| b<=>a}
if arr.include?(0)
puts 0
exit(0)
end
i = 1
sum = arr[0]
loop do
sum = sum * arr[i]
p sum
if sum > MAX
puts "-1... | n = gets.strip.to_i
arr = gets.chomp.split(" ").map(&:to_i)
# n = 2
# arr = [1000000000, 1000000000]
# n = 3
# arr = [101, 9901, 999999000001]
MAX = 10**18
arr = arr.sort{|a, b| b<=>a}
if arr.include?(0)
puts 0
exit(0)
end
i = 1
sum = arr[0]
loop do
sum = sum * arr[i]
# p sum
if sum > MAX
puts "... | [["-", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22], ["-", 196, 737, 8, 736, 0, 652, 3, 4, 0, 22]] | 4 | 108 |
N = int(input())
A = map(int,input().split())
def kake(a):
res=1
for i in a:
res*=i
if res > 10**18:
return -1
else:
return res
print(kake(A)) | N = int(input())
A = map(int,input().split())
def kake(a):
res=1
for i in sorted(a):
res*=i
if res > 10**18:
return -1
else:
return res
print(kake(A)) | [["+", 0, 14, 8, 196, 0, 7, 12, 652, 63, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 25]] | 5 | 60 |
import sys
ans = 1
N = int(input())
A = list(map(int, input().split()))
if A.count(0):
print(0)
else:
for _ in range(N):
ans *= A[_]
if ans >= pow(10,18):
print(-1)
sys.exit()
print(ans)
| import sys
ans = 1
N = int(input())
A = list(map(int, input().split()))
if A.count(0):
print(0)
else:
for _ in range(N):
ans *= A[_]
if ans > pow(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 | 82 |
/*
Arthor : Ender_zzm
E-mail zzm_ender_wiggin@outlook.com
Blog oi.ender-zzm.pro
*/
#include <bits/stdc++.h>
using namespace std;
template <class T> inline void read(T &a) {
register T x = 0, flag = 1;
register char ch;
while (!isdigit(ch = getchar()))
if (ch == '-')
flag = -1;
while (x = x * 10 + (ch... | /*
Arthor : Ender_zzm
E-mail zzm_ender_wiggin@outlook.com
Blog oi.ender-zzm.pro
*/
#include <bits/stdc++.h>
using namespace std;
template <class T> inline void read(T &a) {
register T x = 0, flag = 1;
register char ch;
while (!isdigit(ch = getchar()))
if (ch == '-')
flag = -1;
while (x = x * 10 + (ch... | [["+", 31, 16, 12, 23, 0, 16, 31, 74, 0, 24], ["+", 12, 23, 0, 16, 31, 74, 39, 77, 39, 40], ["+", 31, 16, 12, 23, 0, 16, 31, 74, 0, 25], ["+", 0, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 0, 9, 0, 57, 64, 9, 0, 37, 0, 13]] | 1 | 400 |
#include <bits/stdc++.h>
using namespace std;
#define BIT(n) (1LL << (n))
#define BITF(n, i) (((n) >> (i)) & 1)
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define REPI(i, x) for (int i = 1; i <= x; i++)
#define FORI(i, m, n) for (int i = m; i <= n; i++)
#define REPR(i... | #include <bits/stdc++.h>
using namespace std;
#define BIT(n) (1LL << (n))
#define BITF(n, i) (((n) >> (i)) & 1)
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define REPI(i, x) for (int i = 1; i <= x; i++)
#define FORI(i, m, n) for (int i = m; i <= n; i++)
#define REPR(i... | [["-", 51, 16, 31, 16, 31, 23, 0, 16, 31, 13], ["+", 51, 16, 31, 16, 31, 23, 0, 16, 31, 13], ["-", 51, 16, 31, 16, 31, 23, 0, 16, 12, 13], ["+", 51, 16, 31, 16, 31, 23, 0, 16, 12, 13]] | 1 | 942 |
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
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)
| [["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]] | 5 | 71 |
n = int(input())
a=list(map(int,input().split()))
if 0 in a:
result=0
else:
result = 1
for i in range(n):
result *= a[i]
print(result)
if result>1000000000000000000:
result = -1
print(result)
| n = int(input())
a=list(map(int,input().split()))
if 0 in a:
result=0
else:
result = 1
for i in range(n):
result *= a[i]
if result>1000000000000000000:
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], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]] | 5 | 69 |
ans = 1
n = int(input())
arr = list(map(int , input().split()))
f = 1
for i in range(n):
ans*=arr[i]
if ans > 10**18:
f = 0
break
if f: print(ans)
else: print(-1) | ans = 1
n = int(input())
arr = sorted(list(map(int , input().split())))
f = 1
for i in range(n):
ans*=arr[i]
#print(ans)
if ans > 10**18:
f = 0
break
#print(ans)
if f: print(ans)
else: print(-1)
| [["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 70 |
N=int(input())
while True:
try:
listA=list(map(int,input().split()))
#listA<-[1,2,2,3,1]
#ここに逐次処理を書けばいいと思う。
except:
break;
product=1
for i in listA:
if product<10**18+1:
product=product*i
if listA.count(0)>0:
print(0)
if product<10**18+1:
print(product)
eli... | N=int(input())
while True:
try:
listA=list(map(int,input().split()))
#listA<-[1,2,2,3,1]
#ここに逐次処理を書けばいいと思う。
except:
break;
product=1
for i in listA:
if product<10**18+1:
product=product*i
if listA.count(0)>0:
print(0)
elif product<10**18+1:
print(product)
e... | [["-", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 36, 36, 0, 656, 0, 57, 75, 665, 0, 683]] | 5 | 99 |
#include <bits/stdc++.h>
using namespace std;
int keta(unsigned long long n) {
int ans = 1;
while (n >= 10) {
n = n / 10;
ans++;
}
return ans;
}
int main() {
int n;
cin >> n;
unsigned long long nums[n];
unsigned long long ans = 1;
for (int i = 0; i < n; i++) {
cin >> nums[i];
if (nu... | #include <bits/stdc++.h>
using namespace std;
int keta(unsigned long long n) {
int ans = 1;
while (n >= 10) {
n = n / 10;
ans++;
}
return ans;
}
int main() {
int n;
cin >> n;
unsigned long long nums[n];
unsigned long long ans = 1;
for (int i = 0; i < n; i++) {
cin >> nums[i];
if (nu... | [["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]] | 1 | 196 |
n = int(input())
a = list(map(int, input().split()))
mul = 1
if 0 in set(a): print(0)
else:
iter = 0
for i in range(n):
mul *= a[i]
if mul > 1e18:
mul = -1
break
print(mul) | n = int(input())
a = list(map(int, input().split()))
mul = 1
if 0 in set(a): mul = 0
else:
iter = 0
for i in range(n):
mul *= a[i]
if mul > 1e18:
mul = -1
break
print(mul) | [["-", 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 | 73 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < n; i++)
#define Rep(i, m, n) for (long long i = m; i < n; i++)
#define REP(i, m, n, p) for (long long i = m; i < n; i += p)
#define all(v) v.begin(), v.end()
#define pq priority_queue
#define bcnt(n) __builtin_popcountll(n)
using... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < n; i++)
#define Rep(i, m, n) for (long long i = m; i < n; i++)
#define REP(i, m, n, p) for (long long i = m; i < n; i += p)
#define all(v) v.begin(), v.end()
#define pq priority_queue
#define bcnt(n) __builtin_popcountll(n)
using... | [["-", 51, 16, 31, 16, 31, 23, 0, 16, 31, 13], ["-", 51, 16, 31, 16, 31, 23, 0, 16, 17, 33], ["-", 51, 16, 31, 16, 31, 23, 0, 16, 12, 13], ["+", 51, 16, 31, 16, 31, 23, 0, 2, 63, 22], ["+", 31, 16, 31, 23, 0, 2, 3, 4, 0, 24], ["+", 31, 16, 31, 23, 0, 2, 3, 4, 0, 13], ["+", 31, 16, 31, 23, 0, 2, 3, 4, 0, 21], ["+", 31, ... | 1 | 4,408 |
# frozen_string_literal: true
_n = gets.chomp.to_i
a = gets.chomp.split(' ').map(&:to_i)
MAX = 10**18
if a.any?(&:zero?)
puts '-1'
exit
end
ans = a.reduce do |acm, ai|
new_acm = acm * ai
if new_acm > MAX
puts '-1'
exit
end
new_acm
end
puts ans
| # frozen_string_literal: true
_n = gets.chomp.to_i
a = gets.chomp.split(' ').map(&:to_i)
MAX = 10**18
if a.any?(&:zero?)
puts 0
exit
end
ans = a.reduce do |acm, ai|
new_acm = acm * ai
if new_acm > MAX
puts '-1'
exit
end
new_acm
end
puts ans
| [["-", 64, 749, 0, 652, 3, 4, 0, 557, 0, 62], ["-", 64, 749, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 121, 64, 749, 0, 652, 3, 4, 0, 612]] | 4 | 75 |
N=int(input())
array=input().split(" ")
sum=1
for j in range(N):
if array[j]=="0":
sum=0
if sum!=0:
for i in range(N):
sum=sum*int(array[i])
if sum>1000000000000000000:
sum=-1
break
else:
continue
break
| N=int(input())
array=input().split(" ")
sum=1
for j in range(N):
if array[j]=="0":
sum=0
if sum!=0:
for i in range(N):
sum=sum*int(array[i])
if sum>1000000000000000000:
sum=-1
break
else:
continue
break
print(sum) | [["+", 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 | 82 |
n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
ans = 1
if a[-1] == 0:
ans = 0
else:
for i in range(n):
ans *= a[i]
if ans >= 10**18:
ans = -1
break
elif a[i] == 1:
break
print(ans) | n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
ans = 1
if a[-1] == 0:
ans = 0
else:
for i in range(n):
ans *= a[i]
if ans > 10**18:
ans = -1
break
elif a[i] == 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 | 91 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define MAX 1000000000000000000
int main() {
ll A;
ll ans = 0;
ll N;
ll over = 0;
cin >> N;
cin >> A;
ans += A;
for (ll i = 1; i < N; i++) {
... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define MAX 1000000000000000000
int main() {
ll A;
ll ans = 0;
ll N;
ll over = 0;
cin >> N;
cin >> A;
ans += A;
for (ll i = 1; i < N; i++) {
... | [["-", 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 | 142 |
N=int(input())
a=list(map(int,input().split()))
ans=1
for i in range(N):
if a[i]==0:
print(0)
break
else:
ans*=a[i]
if ans>10**18:
print(-1)
break
else:
print(ans) | N=int(input())
a=list(map(int,input().split()))
ans=1
a=sorted(a)
for i in range(N):
if a[i]==0:
print(0)
break
else:
ans*=a[i]
if ans>10**18:
print(-1)
break
else:
print(ans) | [["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]] | 5 | 76 |
# B
N = int(input())
A = [int(i) for i in input().split()]
if 0 in A:
print(0)
else:
result = 1
for i in range(len(A)):
result = result * A[i]
print(result)
if result > 1000000000000000000:
result = -1
break
print(result) | # B
N = int(input())
A = [int(i) for i in input().split()]
if 0 in A:
print(0)
else:
result = 1
for i in range(len(A)):
result = result * A[i]
if result > 1000000000000000000:
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 | 78 |
n=int(input())
x = [int(i) for i in input().split()]
print(x)
mul=1
check=10**18
count=x.count(0)
if(count>=1):
print("0")
else:
for i in range(n):
mul*=int(x[i])
if(check<mul):
break
if(check<mul):
print("-1")
else:
print(mul) | n=int(input())
x = [int(i) for i in input().split()]
mul=1
check=10**18
count=x.count(0)
if(count>=1):
print("0")
else:
for i in range(n):
mul*=int(x[i])
if(check<mul):
break
if(check<mul):
print("-1")
else:
print(mul) | [["-", 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 | 105 |
import sys
# from collections import defaultdict
# from collections import Counter
# from queue import Queue
import math
def main():
N = int(input())
As = [int(s) for s in input().split()]
logsum = 0
prod = 1
for a in As:
if a == 0:
print('0')
return
logsum... | import sys
# from collections import defaultdict
# from collections import Counter
# from queue import Queue
import math
def main():
N = int(input())
As = [int(s) for s in input().split()]
logsum = 0
prod = 1
for a in As:
if a == 0:
print('0')
return
logsum... | [["-", 0, 14, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 531], ["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 47]] | 5 | 129 |
n = int(input())
a = list(map(int, input().split()))
m = 10**18
if 0 in a:
print(0)
exit()
res = 1
for i in a:
res *= i
print(res)
if res > m:
print(-1)
exit()
print(res) | n = int(input())
a = list(map(int, input().split()))
m = 10**18
if 0 in a:
print(0)
exit()
res = 1
for i in a:
res *= i
if res > m:
print(-1)
exit()
print(res) | [["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 74 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
void solve() {
int n;
scanf("%d", &n);
ll ans = 1;
for (int i = 1; i <= n; i++) {
ll a;
scanf("%lld", &a);
if (a <= INF / ans)
ans *= a;
else
ans = INF;
if (ans == 0)
break;
}
if ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1000000000000000001LL;
void solve() {
int n;
scanf("%d", &n);
ll ans = 1;
for (int i = 1; i <= n; i++) {
ll a;
scanf("%lld", &a);
if (a <= INF / ans)
ans *= a;
else
ans = INF;
if (ans == 0)
... | [["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]] | 1 | 128 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18;
signed main() {
ll n;
cin >> n;
vector<ll> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] == 0) {
cout << 0 << endl;
return 0;
}
}
ll ans = a[0];
for (int i = 1; i < n; i++) {
i... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18;
signed main() {
ll n;
cin >> n;
vector<ll> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] == 0) {
cout << 0 << endl;
return 0;
}
}
ll ans = a[0];
for (int i = 1; i < n; i++) {
i... | [["-", 51, 16, 31, 16, 31, 23, 0, 16, 17, 47], ["+", 15, 339, 51, 16, 31, 23, 0, 16, 17, 18], ["-", 15, 339, 51, 16, 31, 16, 31, 23, 0, 25], ["+", 0, 57, 15, 339, 51, 16, 31, 23, 0, 25], ["-", 15, 339, 51, 16, 12, 23, 0, 16, 17, 47], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 17, 18]] | 1 | 155 |
n = int(input())
a = list(map(int, input().split()))
s = 1
if '0' in a:
s = 0
else:
for i in range(n):
s = s * a[i]
if s > 10 ** 18:
s = -1
break
print(s) | n = int(input())
a = list(map(int, input().split()))
s = 1
if 0 in a:
s = 0
else:
for i in range(n):
s = s * a[i]
if s > 10 ** 18:
s = -1
break
print(s) | [["-", 0, 656, 0, 57, 15, 666, 0, 557, 0, 654], ["-", 0, 656, 0, 57, 15, 666, 0, 557, 0, 655]] | 5 | 72 |
n = int(input())
str_list = input().split()
list = [int(k) for k in str_list]
list.sort(reverse=True)
result = 1
if(0 in list):
print('0')
exit()
for i in range(n):
result = result * list[i]
if(result >= 1000000000000000000):
print('-1')
exit()
print(result)
| n = int(input())
str_list = input().split()
list = [int(k) for k in str_list]
list.sort(reverse=True)
result = 1
if(0 in list):
print('0')
exit()
for i in range(n):
result = result * list[i]
if(result > 1000000000000000000):
print('-1')
exit()
print(result)
| [["-", 8, 196, 0, 57, 15, 23, 0, 666, 667, 20], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 667, 47]] | 5 | 92 |
N = int(input())
A = map(int,input().split())
ret = 1
if 0 in A:
print(0)
exit()
for i in A:
ret *= i
if ret > 10**18:
ret = -1
break
print(ret)
| N = int(input())
A = list(map(int,input().split()))
ret = 1
if 0 in A:
print(0)
exit()
for i in A:
ret *= i
if ret > 10**18:
ret = -1
break
print(ret)
| [["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 61 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define P pair<ll, ll>
#define PP pair<P, P>
using namespace std;
int main() {
int n;
cin >> n;
ll ans = 1;
v... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define P pair<ll, ll>
#define PP pair<P, P>
using namespace std;
int main() {
int n;
cin >> n;
ll ans = 1;
v... | [["-", 8, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 13]] | 1 | 153 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pi... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pi... | [["+", 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 | 545 |
n = int(input())
a_list = sorted([int(i) for i in input().split()])
if a_list[0] == 0:
print(0)
else:
ans = 1
for i in a_list:
ans *= i
if i > 10**18:
ans = -1
break
print(ans) | n = int(input())
a_list = sorted([int(i) for i in input().split()])
if a_list[0] == 0:
print(0)
else:
ans = 1
for i in a_list:
ans *= i
if ans > 10**18:
ans = -1
break
print(ans) | [["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]] | 5 | 70 |
n = int(input())
alist = list(map(int, input().split(" ")))
if 0 in alist:
print("0")
else:
result = 1
m = 0
while result <= 10**18:
result *= alist[m]
m += 1
if m < n or result > 10**18:
print("-1")
else:
print(result) | n = int(input())
alist = list(map(int, input().split(" ")))
if 0 in alist:
print("0")
else:
result = 1
m = 0
while result <= 10**18 and m < n:
result *= alist[m]
m += 1
if m < n or result > 10**18:
print("-1")
else:
print(result) | [["+", 75, 76, 8, 196, 0, 52, 15, 679, 17, 355], ["+", 8, 196, 0, 52, 15, 679, 12, 666, 0, 22], ["+", 8, 196, 0, 52, 15, 679, 12, 666, 667, 18]] | 5 | 86 |
import sys
import copy
from collections import deque
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces
maxr = 10**18
_ = ni()
a = na()
res = 1
if 0 in a:
print(0)
exit(0)
for item in a:
res *= i... | import sys
import copy
from collections import deque
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces
maxr = 10**18
_ = ni()
a = na()
res = 1
if 0 in a:
print(0)
exit(0)
for item in a:
res *= i... | [["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]] | 5 | 115 |
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define ll long long
ll INF = 1e18;
int main() {
int n;
cin >> n;
vector<ll> arr(n);
ll prod = 1;
bool flag = false;
for (int i = 0; i < n; i++) {
cin >> arr[i];
if (arr[i] == 0) {
flag = true;
}
}
if (flag) {
c... | #include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define ll long long
ll INF = 1e18;
int main() {
int n;
cin >> n;
vector<ll> arr(n);
ll prod = 1;
bool flag = false;
for (int i = 0; i < n; i++) {
cin >> arr[i];
if (arr[i] == 0) {
flag = true;
}
}
if (flag) {
c... | [["+", 8, 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 | 166 |
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]
print(ans)
if ans > 1000000000000000000:
ans = -1
break
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 > 1000000000000000000:
ans = -1
break
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 | 70 |
#include <bits/stdc++.h>
#define ankit_2305 \
cerr << "\nTime taken : " << (float)(clock() - time_p) / CLOCKS_PER_SEC \
<< " sec\n";
#define START clock_t
#define TIMER time_p = clock();
#define ll long long
#define MOD 1000000007
using namesp... | #include <bits/stdc++.h>
#define ankit_2305 \
cerr << "\nTime taken : " << (float)(clock() - time_p) / CLOCKS_PER_SEC \
<< " sec\n";
#define START clock_t
#define TIMER time_p = clock();
#define ll long long
#define MOD 1000000007
using namesp... | [["+", 8, 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, 13]] | 1 | 122 |
n = int(input())
a = list(map(int,input().split()))
ans = 1
if 0 in a :
print(0)
exit()
for i in a:
ans *= i
if ans >= 10 ** 18 :
ans = -1
break
print(ans)
| n = int(input())
a = list(map(int,input().split()))
ans = 1
if 0 in a :
print(0)
exit()
for i in a:
ans *= 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 | 64 |
import sys
N=int(input())
A=[]
pai=int(1)
hantei=int(0)
A=list(map(int,input().split()))
for i in range(N):
if A[i]==o:
print("0")
sys.exit()
for i in range(N):
pai=pai*A[i]
if pai>10**18:
print("-1")
hantei=int(1)
break
if hantei==0:
print(pai)
| import sys
N=int(input())
A=[]
pai=int(1)
hantei=int(0)
A=list(map(int,input().split()))
for i in range(N):
if A[i]==0:
print("0")
sys.exit()
for i in range(N):
pai=pai*A[i]
if pai>10**18:
print("-1")
hantei=int(1)
break
if hantei==0:
print(pai)
| [["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]] | 5 | 115 |
n = readline.to_i
a = readline.split.map(&:to_i)
answer = a.reduce do |result, item|
result *= item
break -1 if result > 10 ** 18
result
end
print(answer)
| n = readline.to_i
a = readline.split.map(&:to_i).sort
answer = a.reduce do |result, item|
result *= item
break -1 if result > 10 ** 18
result
end
print(answer)
| [["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22]] | 4 | 45 |
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep2l(i, s, n) for (ll i = (ll)(s); i ... | #include <bits/stdc++.h>
#include <chrono>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep2l(i, s, n) for (ll i = (ll)(s); i ... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]] | 1 | 173 |
n = int(input())
a = list(map(int, input().split()))
an = 1
for x in a:
an *= x
if (an > 10**18):
print(-1)
exit(0)
print(an) | n = int(input())
a = list(map(int, input().split()))
a.sort()
an = 1
for x in a:
an *= x
if (an > 10**18):
print(-1)
exit(0)
print(an) | [["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 58 |
n = int(input())
a = [int(e) for e in input().split()]
ans = 1
if 0 in a:
print(0)
else:
for i in range(n):
ans *= a[i]
if ans > 10e18:
print(-1)
break
else:
print(ans) | n = int(input())
a = [int(e) for e in 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)
break
else:
print(ans) | [["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 531], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 31, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 578], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]] | 5 | 71 |
n = int(input())
a = map(int, input().split());
a.sort()
ans = 1
above = False
for x in a:
ans *= x
if ans > 10**18:
above = True
break
if not above:
print(ans)
else:
print(-1) | n = int(input())
a = list(map(int, input().split()));
a.sort()
ans = 1
above = False
for x in a:
ans *= x
if ans > 10**18:
above = True
break
if not above:
print(ans)
else:
print(-1) | [["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 68 |
N=int(input())
A=list(map(int,input().split()))
flag=0
for i in range(N):
if A[i]==0:
flag=1
sflag=0
ans=1
for i in range(N):
ans*=A[i]
if ans>10**18:
sflag=1
break
if sflag==1:
break
if sflag==0:
print(ans)
elif sflag==1 and flag==0:
print("0")
else:
print("-1") | N=int(input())
A=list(map(int,input().split()))
flag=0
for i in range(N):
if A[i]==0:
flag=1
sflag=0
ans=1
for i in range(N):
ans*=A[i]
if ans>10**18:
sflag=1
break
if sflag==1:
break
if sflag==0:
print(ans)
elif sflag==1 and flag==1:
print("0")
else:
print("-1") | [["-", 0, 57, 75, 665, 15, 679, 12, 666, 0, 612], ["+", 0, 57, 75, 665, 15, 679, 12, 666, 0, 612]] | 5 | 116 |
n=int(input())
l=list(map(int,input().split()))
ans=1
f=1
i=0
for i in range(n):
if ans<=10**18:
ans=ans*l[i]
else:
f=0
if f==1 and ans<=10**18:
print(ans)
else:
print(-1) | n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=1
f=1
i=0
for i in range(n):
if ans<=10**18:
ans=ans*l[i]
else:
f=0
if f==1 and ans<=10**18:
print(ans)
else:
print(-1)
| [["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 84 |
input()
r = 1
for x in map(int, input().split()):
if x == 0:
r = 0
break
if r > 0:
r *= x
if r > 1e18:
r = -1
break
print(r)
| input()
r = 1
for x in map(int, input().split()):
if x == 0:
r = 0
break
if r > 0:
r *= x
if r > 1e18:
r = -1
print(r) | [["-", 64, 196, 0, 57, 64, 196, 0, 93, 0, 94]] | 5 | 53 |
import sys
N = int(input())
nums = list(map(int, input().split(' ')))
output = 1
if 0 in nums:
print(0)
sys.exit()
else:
for x in nums:
output *= x
if output >= 10**18:
print(-1)
sys.exit()
print(output) | import sys
N = int(input())
nums = list(map(int, input().split(' ')))
output = 1
if 0 in nums:
print(0)
sys.exit()
else:
for x in nums:
output *= x
if output > 10**18:
print(-1)
sys.exit()
print(output) | [["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]] | 5 | 78 |
N = int(input())
org = input().split()
for i in range(len(org)):
org[i] = int(org[i])
A = sorted(org)
print(A)
answer = A[0]
overl = False
for i in range(N-1):
answer *= A[i+1]
if answer > 10**18:
overl = True
break
if overl:
print("-1")
else:
print(answer) | N = int(input())
org = input().split()
for i in range(len(org)):
org[i] = int(org[i])
A = sorted(org)
answer = A[0]
overl = False
for i in range(N-1):
answer *= A[i+1]
if answer > 10**18:
overl = True
break
if overl:
print("-1")
else:
print(answer) | [["-", 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 | 103 |
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;
typedef long long ll;
const long long MOD = 1e09 + 7;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#defi... | #include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;
typedef long long ll;
const long long MOD = 1e09 + 7;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#defi... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 233 |
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// qsort
int compare_int(const void *a, const void *b) { return *(int *)a - *(int *)b; }
//比較
int max(int a, int b) {
if (a > b)
return a;
else
return b;
}
int min(int a, int b) {
if (a > b)
return b;
... | #include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// qsort
int compare_int(const void *a, const void *b) { return *(int *)a - *(int *)b; }
//比較
int max(int a, int b) {
if (a > b)
return a;
else
return b;
}
int min(int a, int b) {
if (a > b)
return b;
... | [["-", 0, 57, 15, 23, 0, 16, 31, 16, 17, 72], ["-", 0, 57, 15, 23, 0, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13]] | 0 | 233 |
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
// x^y≡x^(y%(p-1))mod p
// but there is a condition that x needs to be coprime to p
///assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z)
is(65-90) and 32 for space typedef tree<int, nu... | #include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
// x^y≡x^(y%(p-1))mod p
// but there is a condition that x needs to be coprime to p
///assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z)
is(65-90) and 32 for space typedef tree<int, nu... | [["-", 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 | 623 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, m, n) for (int i = m; i < n; i++)
ll mod = 1e9 + 7;
int main() {
int n;
cin >> n;
ll a[n];
rep(i, 0, n) cin >> a[i];
ll ans = 1;
bool p = true;
rep(i, 0, n) {
if (a[i] == 0)
p = false;
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, m, n) for (int i = m; i < n; i++)
ll mod = 1e9 + 7;
int main() {
int n;
cin >> n;
ll a[n];
rep(i, 0, n) cin >> a[i];
ll ans = 1;
bool p = true;
rep(i, 0, n) {
if (a[i] == 0)
p = false;
... | [["-", 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 |
import math
n = int(input())
a = list(map(int,input().split()))
flag_zero=0
sum = 0
for i in range(n):
if a[i]==0:
flag_zero=1
else:
sum += math.log10(a[i])
if flag_zero == 1:
print(0)
elif sum >= 18:
print(-1)
else:
sum = 1
for i in range(n):
sum *= a[i]
if sum > 10**18:
print(-1)
el... | import math
n = int(input())
a = list(map(int,input().split()))
flag_zero = 0
sum = 0
for i in range(n):
if a[i]==0:
flag_zero = 1
else:
sum += math.log10(a[i])
if flag_zero == 1:
print(0)
elif sum > 18:
print(-1)
else:
sum = 1
for i in range(n):
sum *= a[i]
if sum > 10**18:
print(-1)
... | [["-", 0, 656, 0, 57, 75, 665, 15, 666, 667, 20], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 667, 47]] | 5 | 121 |
# your code goes here
n = int(input())
a = input().split()
res = 1
zero = 0
for e in range(n):
if e == 0:
zero = 1
for e in range(n):
res *= int(a[e])
if res > 1000000000000000000:
break
if zero == 1:
print(0)
elif res > 1000000000000000000:
print(-1)
else:
print(res) | # your code goes here
n = int(input())
a = input().split()
res = 1
zero = 0
for e in range(n):
if int(a[e]) == 0:
zero = 1
for e in range(n):
res *= int(a[e])
if res > 1000000000000000000:
break
if zero == 1:
print(0)
elif res > 1000000000000000000:
print(-1)
else:
print(res) | [["+", 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, 206, 51, 22], ["+", 15, 666, 0, 652, 3, 4, 0, 206, 0, 70], ["+", 15, 666, 0, 652, 3, 4, 0, 206, 0, 73], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 25]] | 5 | 88 |
import sys
MAX = 10**18
N = int(input())
A = list(map(int,input().split()))
if 0 in A:
print("0")
else:
res = 1
for a in reversed(sorted(A)):
if res == 1:
break
res *= a
if res > MAX:
print("-1")
sys.exit()
print(res)
| import sys
MAX = 10**18
N = int(input())
A = list(map(int,input().split()))
if 0 in A:
print("0")
else:
res = 1
for a in reversed(sorted(A)):
if a == 1:
break
res *= a
if res > MAX:
print("-1")
sys.exit()
print(res)
| [["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]] | 5 | 88 |
import sys
input = sys.stdin.readline
def main():
# a, b = map(int, input().split())
# print(a * b)
n = int(input())
a = [int(i) for i in input().split()]
limit = 10 ** 18
if 0 in a:
print(0)
exit
ans = 1
for i in a:
ans *= i
if ans > limit:
... | import sys
input = sys.stdin.readline
def main():
n = int(input())
a = [int(i) for i in input().split()]
limit = 10 ** 18
if 0 in a:
print(0)
exit()
ans = 1
for i in a:
ans *= i
if ans > limit:
ans = -1
break
print(ans)
if __name... | [["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 92 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.