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 <cstdio> int main() { int n; unsigned long long int a, s = 1; double d = 1.0; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%lld", &a); s *= a; d *= a; } if (d > 1000000000000000000) printf("-1\n"); else printf("%lld\n", s); return 0; }
#include <cstdio> int main() { int n; unsigned long long int a, s = 1; long double d = 1.0L; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%lld", &a); s *= a; d *= a; } if (d > 1000000000000000000) printf("-1\n"); else printf("%lld\n", s); return 0; }
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
98
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); ++i) #define ALL(v) (v).begin(), (v).end() #define debug(x) cerr << #x << ": " << (x) << endl #define INF (int)1e9 #define EPS (double)1e-9 #define MOD ((int)1e9 + 7) using namespace std; typedef long long llong; typedef vector<int> vi; typedef vector<...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); ++i) #define ALL(v) (v).begin(), (v).end() #define debug(x) cerr << #x << ": " << (x) << endl #define INF (int)1e9 #define EPS (double)1e-9 #define MOD ((int)1e9 + 7) using namespace std; typedef long long llong; typedef vector<int> vi; typedef vector<...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
218
n = int(input()) a = list(map(int,input().split())) if sorted(a)[0]==0: print(-1) else: import math b = [math.log10(i) for i in a if i!=0] if sum(b)>18: print(-1) else: z = 1 for i in a: z*=i if z>10**18: print(-1) else: ...
n = int(input()) a = list(map(int,input().split())) if sorted(a)[0]==0: print(0) else: import math b = [math.log10(i) for i in a if i!=0] if sum(b)>18: print(-1) else: z = 1 for i in a: z*=i if z>10**18: print(-1) else: ...
[["-", 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
107
#include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <numeric> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define...
#include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <numeric> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
287
n = int(input()) a = list(map(int, input().split())) inf = 10**18 ans = 1 sorted(a, reverse=True) if 0 in a: print(0) exit() else: for i in a: ans *= i if ans >= inf: print(-1) exit() print(ans)
n = int(input()) a = list(map(int, input().split())) inf = 10**18 ans = 1 sorted(a, reverse=True) if 0 in a: print(0) exit() else: for i in a: ans *= i if ans > inf: 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
80
n = int(input()) a = list(map(int,input().split())) import sys MAX = 10**18 ans = 1 for i in a: ans *= i if ans > MAX: print(-1) sys.exit() print(ans)
n = int(input()) a = list(map(int,input().split())) import sys a.sort() MAX = 10**18 ans = 1 for i in a: ans *= i if ans > MAX: print(-1) sys.exit() print(ans)
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
62
n = int( input().split() ) A = list( map( int, input().split())) if 0 in A: print( 0 ) else: ret = 1 for a in A: ret *= a if ret > 10 ** 18: ret = -1 break print( ret )
n = int( input() ) A = list( map( int, input().split() )) if 0 in A: print( 0 ) else: ret = 1 for a in A: ret *= a if ret > 10 ** 18: ret = -1 break print( ret )
[["-", 12, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["-", 12, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
67
# Import from collections import deque # I/O def read(): return input() def read_int(): return int(input()) def read_array(type=int): return list(map(type, input().split())) def read_tupple(type=None): tmp = input().split() if type is None: return map(int, tmp) assert len(tmp) == len(type) return [type...
# Import from collections import deque # I/O def read(): return input() def read_int(): return int(input()) def read_array(type=int): return list(map(type, input().split())) def read_tupple(type=None): tmp = input().split() if type is None: return map(int, tmp) assert len(tmp) == len(type) return [type...
[["-", 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
164
#include <algorithm> #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <string.h> #include <string> #include <vector> using namespace std; typedef long long ll; typedef unsigned long long ull; const int N = 1e5 + 7; const int inf = 1e9 + 7; const int mod = 1e9 + 7; ll a[N]; int main() { ...
#include <algorithm> #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <string.h> #include <string> #include <vector> using namespace std; typedef long long ll; typedef unsigned long long ull; const int N = 1e5 + 7; const int inf = 1e9 + 7; const int mod = 1e9 + 7; ll a[N]; int main() { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
204
#include <bits/stdc++.h> using namespace std; const long long limit = 1e18; int main() { int n; cin >> n; long long ans = 1; bool flag = false; for (int i = 0; i < n; i++) { long long a; cin >> a; if (a == 0) { cout << 0 << endl; return 0; } if (ans * a > limit) { flag...
#include <bits/stdc++.h> using namespace std; const long long limit = 1e18; int main() { int n; cin >> n; long long ans = 1; bool flag = false; for (int i = 0; i < n; i++) { long long a; cin >> a; if (a == 0) { cout << 0 << endl; return 0; } if (limit / ans < a || ans * a > ...
[["+", 15, 339, 51, 16, 31, 16, 31, 16, 31, 22], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 17, 85], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106]]
1
123
// Starting with the name of Allah #include <bits/stdc++.h> #define ll long long #define nl endl #define pi 3.14159265358979323846264338 #define flash_all \ ios::sync_with_stdio(0); \ cin.tie(0); ...
// Starting with the name of Allah #include <bits/stdc++.h> #define ll long long #define nl endl #define pi 3.14159265358979323846264338 #define flash_all \ ios::sync_with_stdio(0); \ cin.tie(0); ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 39, 40]]
1
128
n = int(input()) a_list = np.array(list(map(int, input().split()))) if 0 in a_list: print(0) else: ans = 1 flag = 1 for i in range(0, n): ans *= int(a_list[i]) if ans > 10 ** 18: flag = 0 break if flag == 0: print(-1) else: print(ans)
n = int(input()) a_list = list(map(int, input().split())) if 0 in a_list: print(0) else: ans = 1 flag = 1 for i in range(0, n): ans *= int(a_list[i]) if ans > 10 ** 18: flag = 0 break if flag == 0: print(-1) else: print(ans)
[["-", 0, 1, 0, 662, 12, 652, 63, 319, 500, 22], ["-", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131], ["-", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
93
n =int(input()) limit = 10**18 re =1 l = list(map(int, input().split())) l.sort() if(l[0] == 0): re = 0 else: for i in l: re *= i if(re > limit): re = -1 exit() print(re)
n =int(input()) limit = 10**18 re =1 l = list(map(int, input().split())) l.sort() #print(l) if(l[0] == 0): re = 0 else: for i in l: re *= i #print(re) if(re > limit): re = -1 break print(re)
[["-", 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], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
79
#include <algorithm> #include <bitset> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef pair<ll, P> P1; typedef pair<P, P> P2; #define pu ...
#include <algorithm> #include <bitset> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef pair<ll, P> P1; typedef pair<P, P> P2; #define pu ...
[["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
247
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<long long int> A(N); for (int i = 0; i < N; i++) { cin >> A[i]; } long long int output; for (int i = 0; i < N; i++) { if (A[i] == 0) { cout << 0 << endl; return 0; } } output = A[0]; for (int...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<long long int> A(N); for (int i = 0; i < N; i++) { cin >> A[i]; } long long int output; for (int i = 0; i < N; i++) { if (A[i] == 0) { cout << 0 << endl; return 0; } } output = A[0]; for (int...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
160
#include <bits/stdc++.h> using namespace std; int main() { long long N, A[100010], ans = 1, l = 10000000000000000000; cin >> N; for (int i = 0; i < N; i++) { cin >> A[i]; if (A[i] == 0) { cout << 0 << endl; return 0; } } for (int i = 0; i < N; i++) { if (l / ans < A[i]) { ...
#include <bits/stdc++.h> using namespace std; int main() { long long N, A[100010], ans = 1, l = 10000000000000000000; cin >> N; for (int i = 0; i < N; i++) { cin >> A[i]; if (A[i] == 0) { cout << 0 << endl; return 0; } } for (int i = 0; i < N; i++) { if (1000000000000000000 / an...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13]]
1
130
#include <bits/stdc++.h> using namespace std; typedef long long ll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } #define all(x) (x).beg...
#include <bits/stdc++.h> using namespace std; typedef long long ll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } #define all(x) (x).beg...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
326
def solve(): n = int(input()) lst = list(map(int,input().split())) if 0 in lst: print(0) return mul = 1 for ele in lst: mul = mul * ele if mul > 1e18: print(-1) return print(mul)
def solve(): n = int(input()) lst = list(map(int,input().split())) if 0 in lst: print(0) return mul = 1 for ele in lst: mul = mul * ele if mul > 1e18: print(-1) return print(mul) solve()
[["+", 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, 25]]
5
68
n = int(input()) a = list(map(int, input().split())) count = 1 if 0 in a: print(0) for i in a: count *= i if count > 10 ** 18: print(-1) break if count <= 10 ** 18: print(count)
n = int(input()) a = list(map(int, input().split())) count = 1 if 0 in a: print(0) else: for i in a: count *= i if count > 10 ** 18: print(-1) break if count <= 10 ** 18: print(count)
[["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102]]
5
69
N = int(input()) A = list(map(int,input(). split ())) if 0 in A: print(0) exit() prod = 1 for a in A: prod *= a if prod >= 1e18: print(-1) exit() print(prod)
N = int(input()) A = list(map(int,input(). split ())) if 0 in A: print(0) exit() prod = 1 for a in A: prod *= a if prod > 1e18: print(-1) exit() print(prod)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
65
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll long long using namespace std; #include <bits/stdc++.h> using namespace std; int main() { int n; ll a, b, c = 1; cin >> n; for (int i = 1; i <= n; i++) { cin >> a; if (a == 0) { c = 0; break; } if (c > 1000...
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll long long using namespace std; #include <bits/stdc++.h> using namespace std; int main() { int n; ll a, b, c = 1; cin >> n; for (int i = 1; i <= n; i++) { cin >> a; if (a == 0) { c = 0; break; } if (a > 1000...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
108
#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>; const ll mx = 1e18; int main() { int n; cin >> n; ll ans = 1; bool ng = false; rep(i, n) { int a; cin >> a; if (a == 0) { cout << 0 << endl; r...
#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>; const ll mx = 1e18; int main() { int n; cin >> n; ll ans = 1; bool ng = false; rep(i, n) { ll a; cin >> a; if (a == 0) { cout << 0 << endl; re...
[["-", 8, 9, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 14, 8, 9, 0, 43, 39, 78]]
1
135
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define print(a) \ { \ for (...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define print(a) \ { \ for (...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
256
n = int(input()) a = list(map(int, input().split())) result = 1 overflow = False for i in a: result *= i if result > 1e19: result = 1 overflow = True if result != 0 and overflow: print(-1) else: print(result)
n = int(input()) a = list(map(int, input().split())) result = 1 overflow = False for i in a: result *= i if result > 1e18: result = 1 overflow = True if result != 0 and overflow: print(-1) else: print(result)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 531], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 531]]
5
68
import sys N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) sys.exit() B = 1 for i in A: B = B * i if B >= 10 ** 18: print(-1) sys.exit() print(B)
import sys N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) sys.exit() B = 1 for i in A: B = B * i if B > 10 ** 18: print(-1) sys.exit() print(B)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
75
n = int(input()) a = list(map(int, input().split())) INF = 10**18 cnt = 0 for i in range(n): if a[i] == 0: cnt += 1 if cnt > 0: print(-1) else: mul = 1 flg = True for i in range(n): mul *= a[i] if mul > INF: flg = False if flg: print(mul) else: print(-1)
n = int(input()) a = list(map(int, input().split())) INF = 10**18 cnt = 0 for i in range(n): if a[i] == 0: cnt += 1 if cnt > 0: print(0) else: mul = 1 flg = True for i in range(n): mul *= a[i] if mul > INF: flg = False break if flg: print(mul) else: print(-1)
[["-", 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], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
106
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<long long> a(n); int i; bool f = true; for (i = 0; i < n && f; i++) { cin >> a[i]; if (a[i] == 0) f = false; } if (!f) { cout << 0 << endl; return 0; } long long now = 1; i = 0; ...
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<long long> a(n); int i; bool f = true; for (i = 0; i < n && f; i++) { cin >> a[i]; if (a[i] == 0) f = false; } if (!f) { cout << 0 << endl; return 0; } long long now = 1; i = 0; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
154
#include <bits/stdc++.h> using namespace std; #define MOD (long long int)(1e9 + 7) #define ll long long int #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define reps(i, n) for (int i = 1; i <= (int)(n); i++) #define REP(i, n) for (int i = n - 1; i >= 0; i--) #define REPS(i, n) for (int i = n; i > 0; i--) #defin...
#include <bits/stdc++.h> using namespace std; #define MOD (long long int)(1e9 + 7) #define ll long long int #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define reps(i, n) for (int i = 1; i <= (int)(n); i++) #define REP(i, n) for (int i = n - 1; i >= 0; i--) #define REPS(i, n) for (int i = n; i > 0; i--) #defin...
[["-", 51, 16, 31, 16, 31, 23, 0, 16, 31, 13], ["-", 51, 16, 31, 16, 31, 23, 0, 16, 17, 72], ["-", 51, 16, 31, 16, 31, 23, 0, 16, 12, 22], ["+", 51, 16, 31, 16, 31, 74, 39, 77, 39, 78], ["+", 15, 339, 51, 16, 31, 16, 31, 74, 51, 13]]
1
322
# from operator import mul # from functools import reduce n=int(input()) a=list(map(int,input().split())) # limit=10**18 # if 0 in a: # print(0) # exit() ans = 1 # ans = reduce(mul, a) #=> 1320 for i in range(n): ans *= a[i] if sum > 10 ** 18: # if a[i] == 0: # break # elif (ans*a[i]) > limit: ...
# from operator import mul # from functools import reduce n=int(input()) a=list(map(int, input().split())) # limit=10**18 # if 0 in a: # print(0) # exit() ans = 1 # ans = reduce(mul, a) #=> 1320 for i in range(n): ans *= a[i] if ans > 10 ** 18: # if a[i] == 0: # break # elif (ans*a[i]) > limit: ...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]]
5
90
N = int(input()) A = list(map(int,input().split())) def main(): if 0 in A: print(0) return count = 1 for i in A: count *= i if count > 10000000000000000000: print(-1) return print(count) main()
N = int(input()) A = list(map(int,input().split())) def main(): if 0 in A: print(0) return count = 1 for i in A: count *= i if count > 1000000000000000000: print(-1) return print(count) main()
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]]
5
69
n = int(input()) arr = [ int(x) for x in input().strip().split(' ') ] isZ = False for x in arr: if x == 0: isZ = True if isZ: print ("0") exit(0) res = 1 for x in arr: res *= x if res > 1000000000000000000: print ("-1") exit(0) p
n = int(input()) arr = [ int(x) for x in input().strip().split(' ') ] isZ = False for x in arr: if x == 0: isZ = True if isZ: print ("0") exit(0) res = 1 for x in arr: res *= x if res > 1000000000000000000: print ("-1") exit(0) print (res)
[["-", 36, 36, 36, 36, 0, 656, 0, 1, 0, 22], ["+", 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,*a=map(int,open(0).read().split()) a.sort() ans=1 for i in a: ans*=i if ans>=1e18: print(-1) exit() print(ans)
n,*a=map(int,open(0).read().split()) a.sort() ans=1 for i in a: ans*=i if ans>1e18: 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
55
import bisect, collections, copy, heapq, itertools, math, numpy, string import sys from bisect import bisect_left, bisect_right, insort from collections import deque def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int, sys.stdin.readline().rstrip().s...
import bisect, collections, copy, heapq, itertools, math, numpy, string import sys from bisect import bisect_left, bisect_right, insort from collections import deque def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int, sys.stdin.readline().rstrip().s...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 0, 131]]
5
242
#include <iostream> using namespace std; int main() { int n, z = 0; cin >> n; long long a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) z++; } if (z > 0) { cout << 0 << endl; return 0; } long long prod = 1; for (int i = 0; i < n; i++) { if (a[i] <= 1e18 / prod...
#include <iostream> using namespace std; int main() { int n, z = 0; cin >> n; long long a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) z++; } if (z > 0) { cout << 0 << endl; return 0; } long long prod = 1; for (int i = 0; i < n; i++) { if (a[i] <= 10000000000...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
145
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; int main() { int n; cin >> n; ll ans = 1; bool ng = false; rep(i, n) { ll a; cin >> a; if (a == 0) { cout << 0 << endl; return 0; } if (ng || a > 1e18 / ans) ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; int main() { int n; cin >> n; ll ans = 1; bool ng = false; rep(i, n) { ll a; cin >> a; if (a == 0) { cout << 0 << endl; return 0; } if (ng || a > 1000000000000000...
[["-", 15, 339, 51, 16, 12, 16, 12, 16, 31, 13], ["+", 15, 339, 51, 16, 12, 16, 12, 16, 31, 13]]
1
114
#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>; int main() { int n; cin >> n; ll ans = 1; bool ng = false; rep(i, n) { ll a; cin >> a; if (a == 0) { cout << 0 << endl; return 0; } if ...
#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>; int main() { int n; cin >> n; ll ans = 1; bool ng = false; rep(i, n) { ll a; cin >> a; if (a == 0) { cout << 0 << endl; return 0; } if ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22]]
1
132
N = int(input()) ans = 1 a = [int(x) for x in input().split()] if 0 in a: print(-1) exit(0) for n in a: ans *= n if ans > 10 ** 18: print(-1) exit(0) print(ans)
N = int(input()) ans = 1 a = [int(x) for x in input().split()] if 0 in a: print(0) exit(0) for n in a: ans *= n if ans > 10 ** 18: print(-1) exit(0) 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
// stl functions // accumulate(a.begin(),a.end(),0) //returns sum of elements from // first argument to last argument + third argument //third optinal // argument can be passed which is function according to operation to all // elements are to be done generally a recursive operation like sum of elements...
// stl functions // accumulate(a.begin(),a.end(),0) //returns sum of elements from // first argument to last argument + third argument //third optinal // argument can be passed which is function according to operation to all // elements are to be done generally a recursive operation like sum of elements...
[["+", 51, 16, 12, 16, 31, 2, 63, 23, 0, 22], ["+", 51, 16, 12, 16, 31, 2, 63, 23, 0, 25], ["-", 12, 16, 31, 23, 0, 74, 39, 77, 39, 40], ["+", 12, 16, 31, 2, 3, 4, 0, 74, 0, 24], ["+", 31, 2, 3, 4, 0, 74, 39, 77, 39, 78]]
1
416
def finish(t): print(t) exit() n = int(input()) a = list(map(int, input().split())) if 0 in a: finish(-1) mod = pow(10, 18) s = 1 for i in range(n): s *= a[i] if s > mod: finish(-1) else: finish(s)
def finish(t): print(t) exit() n = int(input()) a = list(map(int, input().split())) if 0 in a: finish(0) mod = pow(10, 18) s = 1 for i in range(n): s *= a[i] if s > mod: finish(-1) else: finish(s)
[["-", 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
89
// #include <bits/stdc++.h> #include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <iterator> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using names...
// #include <bits/stdc++.h> #include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <iterator> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using names...
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
160
// #include <bits/stdc++.h> #include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <iterator> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using names...
// #include <bits/stdc++.h> #include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <iterator> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using names...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["+", 15, 339, 51, 16, 12, 16, 12, 16, 12, 22]]
1
160
N=int(input()) li=list(map(int,input().split())) m=li[0] if 0 in li: print(0) else: for i in range(1,N): m=m*li[i] if m>10**18: m=-1 print(m)
N=int(input()) li=list(map(int,input().split())) m=li[0] if 0 in li: m=0 else: for i in range(1,N): m=m*li[i] if m>10**18: m=-1 break print(m)
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
75
n=input() x = list(map(int, input().split())) for i in x: if i==0: print(0) exit(0) ans=1 for i in x: ans*=i if ans>100000000000000000: print(-1) exit(0) print(ans)
n=input() x = list(map(int, input().split())) for i in x: if i==0: print(0) exit(0) ans=1 for i in x: ans*=i if ans>1000000000000000000: print(-1) exit(0) print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]]
5
69
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) v.begin(), v.end() #define allr(v) v.rbegin(), v.rend() const int MX = 1e18; int main() { int n; cin >> n; ll ans = 1; bool flag = false; rep(i, n) { ...
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) v.begin(), v.end() #define allr(v) v.rbegin(), v.rend() const ll MX = 1e18; int main() { int n; cin >> n; ll ans = 1; bool flag = false; rep(i, n) { ...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106]]
1
130
#include <bits/stdc++.h> using namespace std; int main() { long long n, ans = 1, l = 1e18; cin >> n; for (int i = 0; i < n; ++i) { long long temp; cin >> temp; if (temp == 0) { cout << 0 << endl; return 0; } if (ans < 0 || l / ans < temp) { ans = -1; } ans *= temp; ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, ans = 1, l = 1e18; cin >> n; for (int i = 0; i < n; ++i) { long long temp; cin >> temp; if (temp == 0) { cout << 0 << endl; return 0; } if (ans < 0 || l / ans < temp) { ans = -1; } else ans *= ...
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
1
97
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <complex> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #i...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <complex> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #i...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 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, ...
1
186
#TIME : import sys from math import sqrt input = sys.stdin.readline def inp(): return(int(input())) def inlt(): return(list(map(int,input().split()))) def insr(): s = input() return(list(s[:len(s) - 1])) def invr(): return(map(int,input().split())) MAX = 10**18 n = inp() a = inlt() if 0 in A: ...
#TIME : import sys from math import sqrt input = sys.stdin.readline def inp(): return(int(input())) def inlt(): return(list(map(int,input().split()))) def insr(): s = input() return(list(s[:len(s) - 1])) def invr(): return(map(int,input().split())) MAX = 10**18 n = inp() a = inlt() if 0 in a: ...
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["-", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["-", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
151
_, *a = map(int, open(0).read.split()) ret = 1 for x in sorted(a): ret *= x if ret > 10**18: ret = -1 break print(ret)
_, *a = map(int, open(0).read().split()) ret = 1 for x in sorted(a): ret *= x if ret > 10 ** 18: ret = -1; break print(ret)
[["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 35]]
5
50
// // abc169_b.cpp // learningCplusplus // // Created by Tran Duc Chinh on 2020/04/04. // Copyright © 2020 Tran Duc Chinh. All rights reserved. // #include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> using namespace std; typedef long long ll; ll mod = 998244353; ll INF = 10000...
// // abc169_b.cpp // learningCplusplus // // Created by Tran Duc Chinh on 2020/04/04. // Copyright © 2020 Tran Duc Chinh. All rights reserved. // #include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> using namespace std; typedef long long ll; ll mod = 998244353; ll INF = 10000...
[["+", 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
191
#include <bits/stdc++.h> typedef int64_t ll; using std::cin; using std::cout; using std::endl; using std::map; using std::pair; using std::set; using std::string; using std::vector; #define rep(i, n) for (int i = 0, i##_end = (n); i < i##_end; i++) void debug_out() { cout << endl; } template <typename Head, typename......
#include <bits/stdc++.h> typedef uint64_t ll; using std::cin; using std::cout; using std::endl; using std::map; using std::pair; using std::set; using std::string; using std::vector; #define rep(i, n) for (int i = 0, i##_end = (n); i < i##_end; i++) void debug_out() { cout << endl; } template <typename Head, typename.....
[["-", 36, 36, 36, 36, 0, 30, 0, 134, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 134, 39, 40], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 1...
1
304
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll a[114514]; int main() { ll n; cin >> n; ll num = 1; bool f = 0; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) f = 1; } if (f) { cout << 0 << endl; return 0; } for (int i = 0; i < n; i++) { if (...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll a[114514]; int main() { ll n; cin >> n; ll num = 1; bool f = 0; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) f = 1; } if (f) { cout << 0 << endl; return 0; } for (int i = 0; i < n; i++) { if (...
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
1
148
#include <bits/stdc++.h> using namespace std; template <typename T> using vec = vector<T>; int main() { int n; cin >> n; long ans = 1; vec<long> a(n); for (auto &&e : a) { cin >> e; } sort(a.begin(), a.end()); bool flag = true; for (auto &&e : a) { if (e > 1000000000000000000) { flag = ...
#include <bits/stdc++.h> using namespace std; template <typename T> using vec = vector<T>; int main() { int n; cin >> n; long ans = 1; vec<long> a(n); for (auto &&e : a) { cin >> e; } sort(a.begin(), a.end()); bool flag = true; for (auto &&e : a) { if (e == 0) { ans *= e; break; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 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], ["+", 0, 57,...
1
145
#include <bits/stdc++.h> using ll = long long; #define rep(i, n) for (ll i = 0; i < (n); i++) using namespace std; long long INF = 1.0e-18; int main() { ll a[200000]; ll n; ll ans = 1; bool zero = false; cin >> n; rep(i, n) { cin >> a[i]; if (a[i] == 0) zero = true; } if (zero) { co...
#include <bits/stdc++.h> using ll = long long; #define rep(i, n) for (ll i = 0; i < (n); i++) using namespace std; long long MX = 1.0e18; int main() { ll a[200000]; ll n; ll ans = 1; bool zero = false; cin >> n; rep(i, n) { cin >> a[i]; if (a[i] == 0) zero = true; } // ゼロかどうかの判定 if (ze...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 49, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 49, 22], ["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
146
#include <bits/stdc++.h> using ll = long long; #define rep(i, n) for (ll i = 0; i < (n); i++) using namespace std; long long INF = 1.0e-18; int main() { ll a[200000]; ll n; int ans = 1; bool zero = false; cin >> n; rep(i, n) { cin >> a[i]; if (a[i] == 0) zero = true; } if (zero) { co...
#include <bits/stdc++.h> using ll = long long; #define rep(i, n) for (ll i = 0; i < (n); i++) using namespace std; long long MX = 1.0e18; int main() { ll a[200000]; ll n; ll ans = 1; bool zero = false; cin >> n; rep(i, n) { cin >> a[i]; if (a[i] == 0) zero = true; } // ゼロかどうかの判定 if (ze...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 49, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 49, 22], ["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0,...
1
144
#include <bits/stdc++.h> using ll = long long; #define rep(i, n) for (ll i = 0; i < (n); i++) using namespace std; long long INF = 1.0e-18; int main() { ll a[200000]; ll n; int ans = 1; bool zero = false; cin >> n; rep(i, n) { cin >> a[i]; if (a[i] == 0) zero = true; } if (zero) { co...
#include <bits/stdc++.h> using ll = long long; #define rep(i, n) for (ll i = 0; i < (n); i++) using namespace std; long long INF = 1.0e-18; int main() { ll a[200000]; ll n; ll ans = 1; bool zero = false; cin >> n; rep(i, n) { cin >> a[i]; if (a[i] == 0) zero = true; } if (zero) { cou...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
144
#include <bits/stdc++.h> using namespace std; using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) // rep…「0からn-1まで」の繰り返し #define rep2(i, s, n) for (long long i = s; i <= (long long)(n); i++) // rep2…「sからnまで」の繰り返し #define repr(i, s, n) for (long long i = s; i >= (long long)(n); i--) //...
#include <bits/stdc++.h> using namespace std; using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) // rep…「0からn-1まで」の繰り返し #define rep2(i, s, n) for (long long i = s; i <= (long long)(n); i++) // rep2…「sからnまで」の繰り返し #define repr(i, s, n) for (long long i = s; i >= (long long)(n); i--) //...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
175
n=int(input()) a=list(map(int,input().split())) limit=10**18 a.sort() result=A[0] for k in A[1:]: result*=k if result > limit: print(-1) exit() print(result)
n=int(input()) a=list(map(int,input().split())) limit=10**18 a.sort() result=a[0] for k in a[1:]: result*=k if result > limit: print(-1) exit() print(result)
[["-", 0, 656, 0, 1, 0, 662, 12, 206, 51, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 206, 51, 22], ["-", 36, 36, 0, 656, 0, 7, 12, 206, 51, 22], ["+", 36, 36, 0, 656, 0, 7, 12, 206, 51, 22]]
5
70
#include <iostream> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < n; i++) #define REP(i, x, n) for (int i = x; i < n; i++) #define mod 1000000007 // 10^9+7 #define INF 1000000000000 // 10^12 #define F first #define S second #define P pair<int, int> #define all(vec) vec.begin(), vec...
#include <iostream> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < n; i++) #define REP(i, x, n) for (int i = x; i < n; i++) #define mod 1000000007 // 10^9+7 #define INF 1000000000000 // 10^12 #define F first #define S second #define P pair<int, int> #define all(vec) vec.begin(), vec...
[["-", 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
166
n=int(input()) a=list(map(int,input().split())) x=1 for i in a: x*=i if x>10**18: print("-1") exit() print(x)
n=int(input()) a=list(map(int,input().split())) a.sort() x=1 for i in a: x*=i if x>10**18: 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
56
n = input() a_array = input().split(" ") seki = 1 end = False if "0" in a_array: print(0) else: for a in a_array: a = int(a) seki *= a if seki > 10**18: print(-1) end = True break if end == False: print(a)
n = input() a_array = input().split(' ') seki = 1 end = False if "0" in a_array: print(0) else: for a in a_array: a = int(a) seki *= a if seki > 10**18: print(-1) end = True break if end == False: print(seki)
[["-", 0, 662, 12, 652, 3, 4, 0, 557, 0, 654], ["+", 0, 662, 12, 652, 3, 4, 0, 557, 0, 654], ["-", 0, 662, 12, 652, 3, 4, 0, 557, 0, 655], ["+", 0, 662, 12, 652, 3, 4, 0, 557, 0, 655], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
75
#include <bits/stdc++.h> #include <chrono> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std::chrono; using namespace std; #define ordered_set \ tree<pr, null_type, less<pr>, rb_tree_...
#include <bits/stdc++.h> #include <chrono> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std::chrono; using namespace std; #define ordered_set \ tree<pr, null_type, less<pr>, rb_tree_...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
304
// ConsoleApplication1.cpp : Defines the entry point for the console // application. // #include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define MAXCHAR 255 #define ll long long using namespace std; const ll dividend = 100000...
// ConsoleApplication1.cpp : Defines the entry point for the console // application. // #include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define MAXCHAR 255 #define ll long long using namespace std; const ll dividend = 100000...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
295
n=int(input()) ans=1 l=list(map(int,input().split())) for x in l: if x==0: print(-1) exit() for x in l: ans=ans*x if(ans>1000000000000000000): break if(ans>1000000000000000000): print(-1) else: print(ans)
n=int(input()) ans=1 l=list(map(int,input().split())) for x in l: if x==0: print(0) exit() for x in l: ans=ans*x if(ans>1000000000000000000): break if(ans>1000000000000000000): 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
82
#include <bits/stdc++.h> using namespace std; int main() { int n = 0; vector<long long> a(100010); cin >> n; for (int i = 0; i < n; i++) { /* code */ cin >> a.at(i); } int zero = 0; for (int i = 0; i < n; i++) { if (a.at(i) == 0) zero++; } if (zero > 0) { cout << 0 << endl; ...
#include <bits/stdc++.h> using namespace std; int main() { int n = 0; vector<long long> a(100010); cin >> n; for (int i = 0; i < n; i++) { /* code */ cin >> a.at(i); } int zero = 0; for (int i = 0; i < n; i++) { if (a.at(i) == 0) zero++; } if (zero > 0) { cout << 0 << endl; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
180
import sys n = int(input()) a = list(map(int,input().split())) ans = 1 for i in ans: ans*=i if ans>int(1e18): print(-1) sys.exit() print(ans)
import sys n = int(input()) a = list(map(int,input().split())) ans = 1 a.sort() for i in a: ans*=i if ans>int(1e18): print(-1) sys.exit() print(ans)
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22]]
5
60
#include <algorithm> #include <cmath> #include <cstdlib> #include <iostream> #include <string> #include <vector> using namespace std; unsigned int digit(unsigned long long u) { unsigned int ret = 0; while (u > 0) { u = u / 10; ++ret; } return ret; } int main() { unsigned int n; cin >> n; vector<...
#include <algorithm> #include <cmath> #include <cstdlib> #include <iostream> #include <string> #include <vector> using namespace std; unsigned int digit(unsigned long long u) { unsigned int ret = 0; while (u > 0) { u = u / 10; ++ret; } return ret; } int main() { unsigned int n; cin >> n; vector<...
[["-", 8, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["-", 0, 43, 49, 50, 51, 69, 341, 342, 0, 70], ["-", 0, 43, 49, 50, 51, 69, 341, 342, 0, 13], ["-", 0, 43, 49, 50, 51, 69, 341, 342, 0, 73], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
195
// B #include <bits/stdc++.h> using namespace std; typedef long long LL; const LL MOD = 1e9 + 7; int main() { bool lebih = 0, nol = 0; int N; LL cnt = 1; scanf("%d", &N); LL arr[N + 1]; for (int i = 0; i < N; i++) { scanf("%lld", &arr[i]); if (arr[i] == 0) nol = 1; } if (nol) printf(...
// B #include <bits/stdc++.h> using namespace std; typedef long long LL; const LL MOD = 1e9 + 7; int main() { bool lebih = 0, nol = 0; int N; LL cnt = 1; scanf("%d", &N); LL arr[N + 1]; for (int i = 0; i < N; i++) { scanf("%lld", &arr[i]); if (arr[i] == 0) nol = 1; } if (nol) printf(...
[["+", 12, 16, 12, 74, 39, 77, 39, 86, 0, 96]]
1
182
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return map(int, sys.stdin.readline().split()) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)] def dp2(ini, i, j): return [[ini]*i...
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return map(int, sys.stdin.readline().split()) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)] def dp2(ini, i, j): return [[ini]*i...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 85], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 676]]
5
239
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int len = Integer.parseInt(in.readLine()); StringTokenizer s = new StringTokenizer(in.readLine()); boolean ...
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int len = Integer.parseInt(in.readLine()); StringTokenizer s = new StringTokenizer(in.readLine()); boolean ...
[["-", 8, 196, 0, 503, 39, 224, 468, 506, 0, 507], ["+", 8, 196, 0, 503, 39, 224, 468, 506, 0, 96], ["-", 0, 503, 49, 200, 51, 227, 39, 506, 0, 507], ["+", 0, 503, 49, 200, 51, 227, 39, 506, 0, 96], ["-", 8, 196, 0, 1, 0, 11, 12, 492, 500, 22], ["+", 8, 196, 0, 1, 0, 11, 12, 492, 500, 22], ["-", 8, 196, 0, 1, 0, 11, 12...
3
246
import numpy as np import sys import collections N = int(input()) A = list(map(int, input().split())) res = 1 if 0 in A: print(0) sys.exit() for i in range(N): res *= A[i] if res > 1e18: print(res) sys.exit() print(res)
import numpy as np import sys import collections N = int(input()) A = list(map(int, input().split())) res = 1 if 0 in A: print(0) sys.exit() for i in range(N): res *= A[i] if res > 1e18: print(-1) sys.exit() print(res)
[["-", 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
82
#include <bits/stdc++.h> #define ll long long #define ld long double #define eb emplace_back #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define int long long using namespace std; const int INF = 1e18; const int MB = 20; const int MOD = 998244353; const int maxN = 1e6; void solve() { int...
#include <bits/stdc++.h> #define ll long long #define ld long double #define eb emplace_back #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define int long long using namespace std; const int INF = 1e18; const int MB = 20; const int MOD = 998244353; const int maxN = 1e6; void solve() { int...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
192
def main(): n = int(input()) data = list(map(int, input().split())) if 0 in data: print(0) return c = 1 for d in data: c *= d if c >= 10 ** 18: print(-1) return print(c) if __name__ == "__main__": main()
def main(): n = int(input()) data = list(map(int, input().split())) if 0 in data: print(0) return c = 1 for d in data: c *= d if c > 10 ** 18: print(-1) return print(c) if __name__ == "__main__": main()
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
78
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i < (int)(n); i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define vout(x) rep(i, x.size()) cout << x[i] << " " template <class T> bool chmin(T &a, T b) { if (a > b) { a =...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i < (int)(n); i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define vout(x) rep(i, x.size()) cout << x[i] << " " template <class T> bool chmin(T &a, T b) { if (a > b) { a =...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 15, 339, 51, 16, 12, 16, 31, 23, 0, 24], ["+", 15, 339, 51, 16, 12, 16, 31, 23, 0, 25], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
328
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long max = 1000000000000000000L; long ans = 1; boolean of = false; for (int i = 0; i < N; i++) { long A = sc.nextLong(); if (A == 0) {...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long max = 1000000000000000000L; long ans = 1; boolean of = false; for (int i = 0; i < N; i++) { long A = sc.nextLong(); if (A == 0) {...
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 35]]
3
146
package main import ( "fmt" ) func main() { var n int var result uint64 fmt.Scanf("%d", &n) arr := make([]uint64, n) for i:=0; i<n; i++ { fmt.Scanf("%d", &arr[i]) } result = 1 toobig := false for _,value := range arr { if value == 0 { fmt.Printf("%d", result) return } if result >= 1e18/value {...
package main import ( "fmt" ) func main() { var n int var result uint64 fmt.Scanf("%d", &n) arr := make([]uint64, n) for i:=0; i<n; i++ { fmt.Scanf("%d", &arr[i]) } result = 1 toobig := false for _,value := range arr { if value == 0 { fmt.Printf("%d", 0) return } if result > 1e18/value { to...
[["-", 64, 196, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 2, 3, 4, 0, 433], ["-", 0, 7, 8, 196, 0, 57, 15, 16, 17, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 16, 17, 47], ["-", 8, 196, 0, 57, 15, 16, 12, 16, 17, 20], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 17, 47]]
7
165
#include <bits/stdc++.h> using namespace std; int main() { long long N, sum = 1; cin >> N; vector<long long> A(N); for (long long i = 0; i < N; i++) { cin >> A[i]; } sort(A.begin(), A.end()); if (A[0] == 0) { cout << 0 << endl; return 0; } for (long long i = N - 1; i >= 0; i--) { if (...
#include <bits/stdc++.h> using namespace std; int main() { long long N, sum = 1; cin >> N; vector<long long> A(N); for (long long i = 0; i < N; i++) { cin >> A[i]; } sort(A.begin(), A.end()); if (A[0] == 0) { cout << 0 << endl; return 0; } for (long long i = N - 1; i >= 0; i--) { if (...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
155
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<long long> ar(n, 0); bool flag = false; for (int i = 0; i < n; i++) { cin >> ar[i]; if (ar[i] == 0) flag = true; } if (flag == true) { cout << 0 << endl; return 0; } long long prod = 1; for (in...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<long long> ar(n, 0); bool flag = false; for (int i = 0; i < n; i++) { cin >> ar[i]; if (ar[i] == 0) flag = true; } if (flag == true) { cout << 0 << endl; return 0; } long long prod = 1; for (in...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
152
#include <stdio.h> int main() { int n; scanf("%d", &n); long long a, ans = 1; for (int i = 0; i < n; i++) { scanf("%lld", &a); if (a == 0) { ans = 0; break; } if (a > 1000000000000000000 / 1) ans = -1; if (ans != -1) ans *= a; } printf("%lld\n", ans); return...
#include <stdio.h> int main() { int n; scanf("%d", &n); long long a, ans = 1; for (int i = 0; i < n; i++) { scanf("%lld", &a); if (a == 0) { ans = 0; break; } if (a > 1000000000000000000 / ans) ans = -1; if (ans != -1) ans *= a; } printf("%lld\n", ans); retu...
[["-", 0, 57, 15, 23, 0, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 12, 22]]
0
104
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define nl "\n" #define ff first #define ss second #define lb lower_bound #define ub upper_bound #define pb push_back #define pp pop_back #define bs binary_search #define pll pair<ll, ll> #define ppll pair<ll, pll> #define sll stack<ll> #define qll qu...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define nl "\n" #define ff first #define ss second #define lb lower_bound #define ub upper_bound #define pb push_back #define pp pop_back #define bs binary_search #define pll pair<ll, ll> #define ppll pair<ll, pll> #define sll stack<ll> #define qll qu...
[["-", 0, 57, 15, 339, 51, 16, 31, 2, 63, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 23, 0, 24], ["+", 31, 23, 0, 16, 31, 74, 39, 77, 39, 40], ["+", 51, 16, 31, 23, 0, 16, 31, 74, 0, 25]]
1
220
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); ll n; cin >> n; vector<ll> v(n, 0); for (ll i = 0; i < n; i++) cin >> v[i]; sort(v.begin(), v.end()); if (v[0] == 0) { cout << 0 << "\n"; return 0; } ll ans = 1...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); ll n; cin >> n; vector<ll> v(n, 0); for (ll i = 0; i < n; i++) cin >> v[i]; sort(v.begin(), v.end()); if (v[0] == 0) { cout << 0 << "\n"; return 0; } ll ans = 1...
[["-", 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
173
def main(): n=int(input()) a=list(map(int,input().split())) if 0 in a: print(0) return ans=1 for i in a: ans=ans*i if pro>1000000000000000000: print(-1) return print(ans) return main()
def main(): n=int(input()) a=list(map(int,input().split())) if 0 in a: print(0) return ans=1 for i in a: ans=ans*i if ans>1000000000000000000: print(-1) return print(ans) return main()
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]]
5
72
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll LIM = 10e18; // Loop #define REP(i, a, b) for (ll(i) = (a); (i) < (b); (i)++) #define RREP(i, a, b) for (ll(i) = (a); (i) >= (b); (i)--) #define rep(i, n) REP(i, 0, n) #define rrep(i, n) RREP(i, n, 0) int main(void) { ll n; ll a[100000];...
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll LIM = 1000000000000000000; // Loop #define REP(i, a, b) for (ll(i) = (a); (i) < (b); (i)++) #define RREP(i, a, b) for (ll(i) = (a); (i) >= (b); (i)--) #define rep(i, n) REP(i, 0, n) #define rrep(i, n) RREP(i, n, 0) int main(void) { ll n; ...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]]
1
192
#include <iostream> #include <vector> #define ll long long #define repd(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, n) repd(i, 0, n) using namespace std; ll GetDigit(ll num) { return to_string(num).length(); } int main() { int n; cin >> n; unsigned long long ans = 1; // bool zero_flag = false; ...
#include <iostream> #include <vector> #define ll long long #define repd(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, n) repd(i, 0, n) using namespace std; ll GetDigit(ll num) { return to_string(num).length(); } int main() { int n; cin >> n; unsigned long long ans = 1; // bool zero_flag = false; ...
[["+", 31, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 31, 16, 31, 2, 3, 4, 0, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
171
N = gets.to_i A = gets.split.map(&:to_i) mul = 1 if A.index(0) puts '0' exit end N.times do |i| if mul >= 10**18 / A[i] puts '-1' exit end mul *= A[i] end puts mul
N = gets.to_i A = gets.split.map(&:to_i) mul = 1 if A.index(0) puts '0' exit end N.times do |i| if mul > 10**18 / A[i] puts '-1' exit end mul *= A[i] end puts mul
[["-", 196, 737, 8, 736, 0, 121, 15, 738, 17, 20], ["+", 196, 737, 8, 736, 0, 121, 15, 738, 17, 47]]
4
65
#pragma GCC optimize("O3") // #include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i < (b); ++i) #define per(i, b, a) for (int i = b - 1; i >= a; i--) #define trav(a, x) for (auto &a : x) #define all(x) x.begin(), x.end() #define sz(x) (int)(x).size() typedef long long ll; typedef pair<in...
#pragma GCC optimize("O3") // #include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i < (b); ++i) #define per(i, b, a) for (int i = b - 1; i >= a; i--) #define trav(a, x) for (auto &a : x) #define all(x) x.begin(), x.end() #define sz(x) (int)(x).size() typedef long long ll; typedef pair<in...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]]
1
362
//私はずっとC問題の実行ファイルを動かし、動かねえと嘆いていました。 //とても... とても... 悔しいです。 //編入終わったら、ちゃんとAtCoderをやります。 #include <algorithm> #include <iostream> using namespace std; #define ll long long // Google大好き!!! int main(void) { int n; cin >> n; ll ans = 1; const ll m = 1e18; bool flag = false; ll a[100010]; for (int i = 0; i < ...
//私はずっとC問題の実行ファイルを動かし、動かねえと嘆いていました。 //とても... とても... 悔しいです。 //編入終わったら、ちゃんとAtCoderをやります。 #include <algorithm> #include <iostream> using namespace std; #define ll long long // Google大好き!!! int main(void) { int n; cin >> n; ll ans = 1; const ll m = 1e18; bool flag = false; ll a[100010]; for (int i = 0; i < ...
[["-", 51, 16, 31, 16, 31, 23, 0, 16, 17, 72], ["-", 51, 16, 31, 16, 31, 23, 0, 16, 12, 13]]
1
165
#include <iostream> using namespace std; #define ll long long // Google大好き!!! int main(void) { int n; cin >> n; ll ans = 1; const ll m = 1e18; bool flag = false; for (int i = 0; i <= n; i++) { ll a; cin >> a; // cout << a << "kasu" << ans << endl; if (a == 0) { cout << a << endl; ...
//私は<= と <の区別がつかないカスです #include <iostream> using namespace std; #define ll long long // Google大好き!!! int main(void) { int n; cin >> n; ll ans = 1; const ll m = 1e18; bool flag = false; for (int i = 0; i < n; i++) { ll a; cin >> a; // cout << a << "kasu" << ans << endl; if (a == 0) { ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 17, 48], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 12, 22]]
1
126
#include <bits/stdc++.h> #define rep(i, s, n) for (int i = (s); i < (int)(n); i++) #define per(i, n, s) for (int i = (n - 1); i >= (int)(s); i--) #define all(x) (x).begin(), (x).end() #define debug(x) cout << #x << ": " << x << endl using namespace std; using ll = long long; const ll MOD = 1e9 + 7; const ll LINF = LLON...
#include <bits/stdc++.h> #define rep(i, s, n) for (int i = (s); i < (int)(n); i++) #define per(i, n, s) for (int i = (n - 1); i >= (int)(s); i--) #define all(x) (x).begin(), (x).end() #define debug(x) cout << #x << ": " << x << endl using namespace std; using ll = long long; const ll MOD = 1e9 + 7; const ll LINF = LLON...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
256
//***Wherever you are, and whatever you do, be in love.*** #include <bits/stdc++.h> using namespace std; #define mp make_pair #define mt make_tuple #define fi first #define se second #define pb push_back #define ll long long #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define rep(i,...
//***Wherever you are, and whatever you do, be in love.*** #include <bits/stdc++.h> using namespace std; #define mp make_pair #define mt make_tuple #define fi first #define se second #define pb push_back #define ll long long #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define rep(i,...
[["+", 51, 16, 31, 74, 39, 77, 39, 86, 0, 96], ["+", 12, 16, 31, 74, 39, 77, 39, 86, 0, 96], ["+", 12, 16, 12, 74, 39, 77, 39, 86, 0, 96]]
1
360
function Main(input) { const arr = input.trim().split('\n')[1].split(' ').map(BigInt); let count = 1n; if (arr.includes(0n) > 0) { console.log(0); return; } for (let num of arr) { count *= num; if (count > BigInt(1000000000000000000)) { console.log(-1); return; } } console...
function Main(input) { const arr = input.trim().split('\n')[1].split(' ').map(BigInt); let count = 1n; if (arr.includes(0n) > 0) { console.log(0); return; } for (let num of arr) { count *= num; if (count > BigInt(1000000000000000000)) { console.log(-1); return; } } console...
[["-", 0, 1, 0, 2, 3, 3, 0, 2, 63, 22], ["-", 0, 2, 3, 3, 0, 2, 3, 3, 0, 24], ["+", 0, 2, 3, 3, 0, 2, 63, 558, 0, 131], ["+", 0, 2, 3, 3, 0, 2, 63, 558, 559, 560], ["+", 0, 2, 3, 3, 0, 2, 3, 3, 0, 24]]
2
130
#include <bits/stdc++.h> using namespace std; #define test(a) cout << "*" << a << endl; #define rep1(i, n) for (i = 1; i <= n; i++) #define ll unsigned long long int main() { ll a[100001]; ll n; ll i; ll ans = 1; int zeroFrag = 0; int breakFrag = 0; cin >> n; rep1(i, n) { cin >> a[i]; if (a[i] ...
#include <bits/stdc++.h> using namespace std; #define test(a) cout << "*" << a << endl; #define rep1(i, n) for (i = 1; i <= n; i++) #define ll unsigned long long int main() { ll a[100001]; ll n; ll i; ll ans = 1; int zeroFrag = 0; int breakFrag = 0; cin >> n; rep1(i, n) { cin >> a[i]; if (a[i] ...
[["+", 15, 339, 51, 16, 31, 16, 31, 74, 0, 24], ["+", 31, 16, 31, 74, 39, 77, 39, 86, 0, 96], ["+", 31, 16, 31, 74, 39, 77, 39, 86, 39, 40], ["+", 15, 339, 51, 16, 31, 16, 31, 74, 0, 25], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]]
1
163
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <utility> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) #define pai 3.1415926535897932384 using namespace std; using ll = long long; using P = pair<int, int>; #define INF 1000000...
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <utility> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) #define pai 3.1415926535897932384 using namespace std; using ll = long long; using P = pair<int, int>; #define INF 1000000...
[["-", 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
148
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int n; cin >> n; ll a[n]; for (int i = 0; i < n; ++i) cin >> a[i]; std::sort(a, a + n); if (a[0] == 0) cout << "0"; else { int ans = 0; for (int i = 0; i < n; ++i) { ans += log10(a[i]); } if (ans ...
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int n; cin >> n; ll a[n]; for (int i = 0; i < n; ++i) cin >> a[i]; std::sort(a, a + n); if (a[0] == 0) cout << "0"; else { double ans = 0; for (int i = 0; i < n; ++i) { ans += log10(a[i]); } if (a...
[["-", 0, 57, 75, 76, 0, 9, 0, 43, 39, 40], ["+", 0, 57, 75, 76, 0, 9, 0, 43, 39, 40]]
1
169
N, *A = map(int, open(0).read().split()) b = 1 for a in A: if b > 10**18: break b *= a print(-1 if b > 10**18 else b)
N, *A = map(int, open(0).read().split()) b = 1 A = sorted(A) for a in A: if b > 10**18: break b *= a print(-1 if b > 10**18 else b)
[["+", 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
54
#!/usr/bin/env python3 import sys def solve(N: int, A: "List[int]"): if 0 in A: print(0) prod = 1 for a in A: prod *= a if prod > int(1e18): print(-1) return print(prod) return # Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools ...
#!/usr/bin/env python3 import sys def solve(N: int, A: "List[int]"): if 0 in A: print(0) return prod = 1 for a in A: prod *= a if prod > int(1e18): print(-1) return print(prod) return # Generated by 1.1.7.1 https://github.com/kyuridenamida/...
[["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38]]
5
135
#include <bits/stdc++.h> using namespace std; long long a[1000005]; int main() { long long sum = 1; int n, i; cin >> n; for (i = 0; i < n; i++) { cin >> a[i]; if (!a[i]) { cout << 0; return 0; } } for (i = 0; i < n; i++) { if ((10000000000000000001 / sum) < a[i]) { cout << ...
#include <bits/stdc++.h> using namespace std; long long a[1000005]; int main() { long long sum = 1; int n, i; cin >> n; for (i = 0; i < n; i++) { cin >> a[i]; if (!a[i]) { cout << 0; return 0; } } for (i = 0; i < n; i++) { if (1000000000000000000ll / sum ...
[["-", 0, 57, 15, 339, 51, 16, 31, 23, 0, 24], ["-", 15, 339, 51, 16, 31, 23, 0, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13], ["-", 0, 57, 15, 339, 51, 16, 31, 23, 0, 25]]
1
124
n=int(input()) a=list(map(int,input().split())) x=1 if 0 in a: print(0) exit() for i in range(len(a)): x=a[i]*x if x>10^18: print(-1) exit() print(x if x<=10**18 else -1)
n=int(input()) a=list(map(int,input().split())) x=1 if 0 in a: print(0) exit() for i in range(len(a)): x=a[i]*x if x>10**18: print(-1) exit() print(x if x<=10**18 else -1)
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 140], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 578]]
5
87
import sys n=int(input()) a=list(map(int,input().split())) x=1 if 0 in a: print(0) sys.exit() for i in range(len(a)): x=a[i]*x if x>10^18: print(-1) sys.exit() print(x if x<=10**18 else -1)
import sys n=int(input()) a=list(map(int,input().split())) x=1 if 0 in a: print(0) sys.exit() for i in range(len(a)): x=a[i]*x if x>10**18: print(-1) sys.exit() print(x if x<=10**18 else -1)
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 140], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 578]]
5
93
n=int(input()) a=[int(x) for x in input().split()] if 0 in s: print(0) else: s=1 for c in range(n): s=s*a[c] if s>10**18: s=-1 break print(s)
n=int(input()) a=[int(x) for x in input().split()] if 0 in a: print(0) else: s=1 for c in range(n): s=s*a[c] if s>10**18: s=-1 break print(s)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
72
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef pair<int, int> P; typedef long long ll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef pair<int, int> P; typedef long long ll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
1,637