buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(false); \ cin.tie(0); #define st first #define nd second #define endl '\n' #define what_is(x) cerr << #x << " is " << x...
#include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(false); \ cin.tie(0); #define st first #define nd second #define endl '\n' #define what_is(x) cerr << #x << " is " << x...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
239
n=int(input()) l=list(map(int,input().split())) if 0 in l: print(0) else: a=1 for i in l: a=a*i if a>>10**18: print(-1) exit() print(a)
n=int(input()) l=list(map(int,input().split())) if 0 in l: print(0) else: a=1 for i in l: a=a*i if a>10**18: print(-1) exit() print(a)
[["-", 0, 7, 8, 196, 0, 57, 15, 657, 17, 152], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
68
import sys readline = sys.stdin.buffer.readline n = int(readline()) a = map(int, readline().split()) a.sort() v = 1 for i in a: v *= i if v > 1000000000000000000: print(-1) break elif v == 0: print(0) break else: print(v)
import sys readline = sys.stdin.buffer.readline n = int(readline()) a = list(map(int, readline().split())) a.sort() v = 1 for i in a: v *= i if v > 1000000000000000000: print(-1) break elif v == 0: print(0) break else: print(v)
[["+", 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
76
n = int(input()) arr = input().split() def mult(): if 0 in arr: return 0 else: a = 1 for i in arr: a = a * int(i) if a > 1000000000000000000: return -1 return a print(mult())
n = int(input()) arr = input().split() def mult(): if "0" in arr: return 0 else: a = 1 for i in arr: a = a * int(i) if a > 1000000000000000000: return -1 return a print(mult())
[["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 654], ["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 655]]
5
63
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int time = sc.nextInt(); long ans = 1L; for (int i = 0; i < time; i++) { long mul = sc.nextLong(); if (Math.log10(mul) + Math.log10(ans) > 18 || mul * ans ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int time = sc.nextInt(); long ans = 1L; for (int i = 0; i < time; i++) { long mul = sc.nextLong(); if (Math.log10(mul) + Math.log10(ans) > 18 || mul * ans > 1000...
[["-", 36, 36, 0, 493, 0, 454, 0, 522, 141, 22], ["+", 36, 36, 0, 493, 0, 454, 0, 525, 0, 48], ["-", 75, 57, 75, 57, 15, 15, 0, 16, 31, 22], ["+", 75, 57, 75, 57, 15, 15, 0, 16, 31, 22]]
3
148
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int N = 2e5 + 10; void solve() { int n; cin >> n; ll p = 1; ll a[n]; bool mark = false; for (int i = 0; i < n; ++i) { cin >> a[i]; if (!a[i]) { mark = true; } } if (mark) { cout...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int N = 2e5 + 10; void solve() { int n; cin >> n; ll p = 1; ll a[n]; bool mark = false; for (int i = 0; i < n; ++i) { cin >> a[i]; if (!a[i]) { mark = true; } } if (mark) { cout...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
188
gets.to_i array = gets.chomp.split.map(&:to_i) ans = 1 if array.include(0) puts "0" else array.each do |i| ans *= i if ans > 10 ** 18 puts "-1" return end end puts ans end
gets.to_i array = gets.chomp.split.map(&:to_i) ans = 1 if array.include?(0) puts "0" else array.each do |i| ans *= i if ans > 10 ** 18 puts "-1" return end end puts ans end
[["-", 36, 36, 0, 493, 0, 121, 15, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 121, 15, 652, 735, 22]]
4
57
// Problem : B - Multiplication 2 // Contest : AtCoder - AtCoder Beginner Contest 169 // URL : https://atcoder.jp/contests/abc169/tasks/abc169_b // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> #define pb push_back #define fi fi...
// Problem : B - Multiplication 2 // Contest : AtCoder - AtCoder Beginner Contest 169 // URL : https://atcoder.jp/contests/abc169/tasks/abc169_b // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> #define pb push_back #define fi fi...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 1, 0, 16, 31, 16, 12, 74, 0, 24], ["+", 0, 16, 31, 16, 12, 74, 39, 77, 39, 78], ["+", 0, 1, 0, 16, 31, 16, 12, 74, 0, 25]]
1
1,002
n = int(input()) x = list(map(int, input().split())) ans = 1 if 0 in x: ans=0 for i in x: ans*=i print(i,ans) if ans > 1000000000000000000: print(-1) exit() print(ans)
n = int(input()) x = list(map(int, input().split())) ans = 1 if 0 in x: ans=0 for i in x: ans*=i if ans > 1000000000000000000: print(-1) exit() print(ans)
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
67
N = int(input()) A = list(map(int,input(). split ())) if 0 in A: print(0) return prod = 1 for a in A: prod *= a if prod > 1000000000000000000: print(-1) return print(prod)
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 > 1000000000000000000: print(-1) exit() print(prod)
[["-", 0, 656, 0, 57, 64, 196, 0, 37, 0, 38], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38]]
5
61
gets a = 1 gets.split.map(&:to_i).each{|b| a *= b if a > 10**18 p -1 exit end } p a
gets a = 1 gets.split.map(&:to_i).sort.each{|b| a *= b if a > 10**18 p -1 exit end } p a
[["+", 36, 36, 0, 493, 0, 652, 486, 652, 735, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 17, 131]]
4
36
#include <bits/stdc++.h> using namespace std; #define dv(i) \ for (int c = 0; c < (int)(i).size(); c++) \ cout << (i)[c] << (c == (int)(i).size() - 1 ? "\n" : " ") #define da(i) ...
#include <bits/stdc++.h> using namespace std; #define dv(i) \ for (int c = 0; c < (int)(i).size(); c++) \ cout << (i)[c] << (c == (int)(i).size() - 1 ? "\n" : " ") #define da(i) ...
[["+", 0, 57, 15, 339, 51, 16, 31, 74, 0, 24], ["+", 15, 339, 51, 16, 31, 74, 39, 77, 39, 78], ["+", 0, 57, 15, 339, 51, 16, 31, 74, 0, 25], ["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 24], ["+", 51, 16, 12, 16, 31, 74, 39, 77, 39, 78], ["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 25]]
1
623
#include <bits/stdc++.h> using namespace std; #define debi(var) \ "[" << (#var) << " : " << var << "]" \ << " " #define debv(v) \ "[" << (#v) << ...
#include <bits/stdc++.h> using namespace std; #define debi(var) \ "[" << (#var) << " : " << var << "]" \ << " " #define debv(v) \ "[" << (#v) << ...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
159
#include <bits/stdc++.h> #define mod 1000000000000000000 using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<ll, ll> dl; typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<vii> graph; bool comp(int a, int b) { return a > b; } int main() { ios_base:...
#include <bits/stdc++.h> #define mod 1000000000000000000 using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<ll, ll> dl; typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<vii> graph; bool comp(int a, int b) { return a > b; } int main() { ios_base:...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 73]]
1
225
a = gets.chomp.to_i ary = gets.chomp.split(" ").map(&:to_i).sort p ary if ary.first == 0 puts 0 else t = 1 ary.each do |v| t *= v if t > (10 ** 18) t = -1 break end end puts t end
a = gets.chomp.to_i ary = gets.chomp.split(" ").map(&:to_i).sort if ary.first == 0 puts 0 else t = 1 ary.each do |v| t *= v if t > (10 ** 18) t = -1 break end end puts t end
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22]]
4
69
#include <bits/stdc++.h> using namespace std; long long a[100000]; int main() { int n; long long ba = 1, bz = 1; cin >> n; for (int t = 0; t < n; t++) { cin >> a[t]; if (a[t] == 0) { cout << 0; return 0; } } for (int t = 0; t < n; t++) { // cout<<"hi "; // if(ba/1!=1) if ...
#include <bits/stdc++.h> using namespace std; long long a[100000]; int main() { int n; long long ba = 1, bz = 1; cin >> n; for (int t = 0; t < n; t++) { cin >> a[t]; if (a[t] == 0) { cout << 0; return 0; } } for (int t = 0; t < n; t++) { // cout<<"hi "; // if(ba/1!=1) if ...
[["+", 31, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
171
N = int(input()) A = list(map(int,input().split())) if 0 in A: print(0) else: result=1 for i in A: result*=i if result>10**18: print(-1) break print(result)
N = int(input()) A = list(map(int,input().split())) if 0 in A: print(0) else: result=1 for i in A: result*=i if result>10**18: result=-1 break print(result)
[["-", 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
64
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; vector<long long> a(n); for (long long i = 0; i < n; i++) { cin >> a.at(i); if (a.at(i) == 0) { cout << "0" << endl; return 0; } } long long sum = a.at(0); for (long long i = 1; i < n; i++) { if ...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; vector<long long> a(n); for (long long i = 0; i < n; i++) { cin >> a.at(i); if (a.at(i) == 0) { cout << "0" << endl; return 0; } } long long sum = a.at(0); for (long long i = 1; i < n; i++) { if ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
172
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using Graph = vector<vector<int>>; using ll = long long; int main() { ll n; cin >> n; vector<ll> a(n); ll max = 1e18; ll ans = 1; rep(i, n) { cin...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using Graph = vector<vector<int>>; using ll = long long; int main() { ll n; cin >> n; vector<ll> a(n); constexpr ll max = 1e18; ll ans = 1; rep(i, n)...
[["+", 0, 14, 8, 9, 0, 43, 0, 153, 0, 379], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13]]
1
162
#include <algorithm> #include <array> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <stack> #include <string> #include <vector> using namespace std; int gcd(int a, int b) { if (a % b == 0) { return (b); } else { return (gcd(b, a % b)); } } int mod = 1000000000 + 7; vec...
#include <algorithm> #include <array> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <stack> #include <string> #include <vector> using namespace std; int gcd(int a, int b) { if (a % b == 0) { return (b); } else { return (gcd(b, a % b)); } } int mod = 1000000000 + 7; vec...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
326
#pragma GCC optimze("Ofast") #include <bits/stdc++.h> using namespace std; #ifndef aa #define trace(...) #define endl '\n' #endif #define pb push_back #define ub upper_bound #define lb lower_bound #define fi first #define se second #define int long long typedef long long ll; typedef long double ld; #define double lon...
#pragma GCC optimze("Ofast") #include <bits/stdc++.h> using namespace std; #ifndef aa #define trace(...) #define endl '\n' #endif #define pb push_back #define ub upper_bound #define lb lower_bound #define fi first #define se second #define int long long typedef long long ll; typedef long double ld; #define double lon...
[["-", 0, 57, 64, 1, 0, 11, 12, 16, 17, 109], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 12, 22], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
515
// inputに入力データ全体が入る function Main(input) { input = input.trim().split('\n'); var N = input[0]; var As = input[1].split(' ').map(x => BigInt(x)); var prod = 1n if (As.indexOf(0n) != -1) { prod = -1n } else { for (i = 0; i < N; i++) { prod *= As[i]; if (prod > 10n ** 18n) { prod ...
// inputに入力データ全体が入る function Main(input) { input = input.trim().split('\n'); var N = input[0]; var As = input[1].split(' ').map(x => BigInt(x)); var prod = 1n if (As.indexOf(0n) != -1) { prod = 0n } else { for (i = 0; i < N; i++) { prod *= As[i]; if (prod > 10n ** 18n) { prod =...
[["-", 64, 556, 0, 1, 0, 11, 12, 91, 17, 33], ["-", 64, 556, 0, 1, 0, 11, 12, 91, 28, 555], ["+", 0, 57, 64, 556, 0, 1, 0, 11, 12, 555]]
2
152
/****************************************************************************** EYENINE,THE ELDER_WAND!!! THE ROOT OVER MINUS EIGTHY ONE!! *******************************************************************************/ #include <bits/stdc++.h> using namespace std; int arr[100010]; int main()...
/****************************************************************************** EYENINE,THE ELDER_WAND!!! THE ROOT OVER MINUS EIGTHY ONE!! *******************************************************************************/ #include <bits/stdc++.h> using namespace std; long long int arr[100010]; ...
[["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96]]
1
181
def main(): N = input() str_num = input() num_list = str_num.split() if '0' in num_list: print(0) return answer = 1 for num in num_list: answer *=int(num) if answer > 10**8: answer = -1 break print(answer) main()
def main(): N = input() str_num = input() num_list = str_num.split() if '0' in num_list: print(0) return answer = 1 for num in num_list: answer *=int(num) if answer > 10**18: answer = -1 break print(answer) main()
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]]
5
67
N = int(input()) A = sorted(list(map(int, input().split())), ) j = 1 if A[0] == 0: print(0) for i in A: j = i * j if j > 10**18: print(-1) exit() if j > 10**18: print(-1) else: print(j)
N = int(input()) A = sorted(list(map(int, input().split())), ) j = 1 if A[0] == 0: print(0) exit() for i in A: j = i * j if j > 10**18: print(-1) exit() if j > 10**18: print(-1) else: print(j)
[["+", 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
87
#include <iostream> using namespace std; int main() { long long a, b = 1, t, q = 1e18; double d = 1; cin >> t; while (t--) { cin >> a; d *= a; b *= a; } if (d > q || b > q) cout << "-1" << endl; else cout << (long long)d << endl; }
#include <iostream> using namespace std; int main() { long long a, b = 1, t, q = 1e18; double d = 1; cin >> t; while (t--) { cin >> a; d *= a; b *= a; } if (d > q || b > q) cout << "-1" << endl; else cout << (long long)b << endl; }
[["-", 0, 1, 0, 16, 31, 16, 12, 74, 51, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 74, 51, 22]]
1
83
flag=1 n=int(input()) l=list(map(int,input().split())) c=10**18 ans=1 for i in l: ans=ans*i if ans>c: flag=0 break if flag: print(ans) else: print(-1)
flag=1 n=int(input()) l=list(map(int,input().split())) c=10**18 ans=1 l.sort() for i in l: ans=ans*i if ans>c: flag=0 break if flag: 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
69
#include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<unsigned long> v(N); for (int i = 0; i < N; i++) { cin >> v[i]; } for (int i = 0; i < N; i++) { if (v[i] == 0) { cout << 0 << endl; return 0; } } unsigned long prod = 1; for (int ...
#include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<long long> v(N); for (int i = 0; i < N; i++) { cin >> v[i]; } for (int i = 0; i < N; i++) { if (v[i] == 0) { cout << 0 << endl; return 0; } } long long prod = 1; for (int i = 0; i...
[["-", 39, 344, 3, 347, 0, 77, 39, 86, 0, 87], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 87], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
150
N=int(input()) s=input().split() result=1 if '0' in s: print(0) else: for i in range (N): result=result*int(s[i]) if result>= 10**18: print(-1) break elif i==N-1 and result<=10**18: print(result)
N=int(input()) s=input().split() result=1 if '0' in s: print(0) else: for i in range (N): result=result*int(s[i]) if result> 10**18: print(-1) break elif i==N-1 and result<=10**18: print(result)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
82
n = int(input()) x = list(map(int, input().split())) ans = 1 for i in range(n): ans = ans*x[0] if ans > 1000000000000000001: ans = -1 break for i in range(n): if x[i] == 0: ans = 0 print(ans)
n = int(input()) x = list(map(int, input().split())) ans = 1 for i in range(n): ans = ans*x[i] if ans > 1000000000000000000: ans = -1 break for i in range(n): if x[i] == 0: ans = 0 break print(ans)
[["-", 0, 1, 0, 662, 12, 657, 12, 206, 206, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 206, 206, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
77
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef unsigned long long ull; int main() { int n; cin >> n; ull ans = 1; // int cnt=0; ull ref = pow(10, 18); ull realans = 10; rep(i, n) { ull tmp; ull oldans = ans; cin ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef unsigned long long ull; int main() { int n; cin >> n; ull ans = 1; // int cnt=0; ull ref = pow(10, 18); ull realans = 10; rep(i, n) { ull tmp; ull oldans = ans; cin ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94]]
1
168
import math n=int(input()) arr=list(map(int,input().split())) if 0 in arr: print("0") exit() ans=1 for i in range(n): ans *= arr[i] if math.log10(ans) >= 18: print("-1") exit() print(ans)
import math n=int(input()) arr=list(map(int,input().split())) if 0 in arr: print("0") exit() ans=1 for i in range(n): ans *= arr[i] if math.log10(ans) >= 18 and ans!=1000000000000000000: print("-1") exit() print(ans)
[["+", 0, 7, 8, 196, 0, 57, 15, 679, 17, 355], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667, 79], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 0, 612]]
5
81
#include <iostream> using namespace std; int main(void) { int N; unsigned long long a[1000000], r = 1; 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 (a[i] > 1000000000000000000) { ...
#include <iostream> using namespace std; int main(void) { int N; long long a[1000000], r = 1; 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 (a[i] > 1000000000000000000 / r) { co...
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 87], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
150
gets; nums = gets.split(" ").map(&:to_i); prod = 1; if nums.select {|n| n == 0} then puts "0"; exit; end nums.each { |n| prod = prod * n ; if prod >= 10**2 then puts "-1"; exit; end }; puts prod;
gets; nums = gets.split(" ").map(&:to_i); prod = 1; if nums.find {|n| n === 0} then puts "0"; exit; end nums.each { |n| prod = prod * n ; if prod > 10**18 then puts "-1"; exit; end }; puts prod;
[["-", 36, 36, 0, 493, 0, 121, 15, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 121, 15, 652, 735, 22], ["-", 15, 652, 196, 196, 8, 734, 0, 738, 17, 60], ["+", 15, 652, 196, 196, 8, 734, 0, 738, 17, 565], ["-", 196, 196, 8, 734, 0, 121, 15, 738, 17, 20], ["+", 196, 196, 8, 734, 0, 121, 15, 738, 17, 47], ["-", 8, 734, 0, 121...
4
77
// // Created by admin on 2020/6/6. // #include <cstdio> using namespace std; int n; long long a[10005]; int main() { long long p = 1; scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); for (int i = 1; i <= n; i++) if (a[i] == 0) { printf("0\n"); return 0; } for (int i =...
// // Created by admin on 2020/6/6. // #include <cstdio> int n; long long a[100005]; int main() { long long p = 1; scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%lld", &a[i]); for (int i = 1; i <= n; i++) if (a[i] == 0) { printf("0\n"); return 0; } for (int i = 1; i <= n; i++) {...
[["-", 36, 36, 36, 36, 0, 30, 0, 340, 0, 233], ["-", 36, 36, 36, 36, 0, 30, 0, 340, 0, 256], ["-", 36, 36, 36, 36, 0, 30, 0, 340, 0, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 340, 0, 35], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 1...
1
165
GI = lambda: int(input()); GIS = lambda: map(int, input().split()); LGIS = lambda: list(GIS()) def main(): GI() CEIL = 10 ** 18 xs = LGIS() prod = 1 for x in GIS(): prod *= x if prod > CEIL: prod = -1 break if prod == -1: print(0 if 0 in xs els...
GI = lambda: int(input()); GIS = lambda: map(int, input().split()); LGIS = lambda: list(GIS()) def main(): GI() CEIL = 10 ** 18 xs = LGIS() prod = 1 for x in xs: prod *= x if prod > CEIL: prod = -1 break if prod == -1: print(0 if 0 in xs else -...
[["-", 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], ["+", 0, 656, 0, 14, 8, 196, 0, 7, 12, 22]]
5
105
#include <bits/stdc++.h> #define ll unsigned long long using namespace std; int main() { int n; cin >> n; ll aux, ans = 1; bool sw = 0, sw2 = 0; for (int i = 0; i < n; i++) { cin >> aux; if (aux == 0) sw = 1; if (ans > (1000000000000000000 / aux) || ans < 0) sw2 = 1; ans *= aux; ...
#include <bits/stdc++.h> #define ll unsigned long long using namespace std; int main() { int n; cin >> n; ll aux, ans = 1; bool sw = 0, sw2 = 0; for (int i = 0; i < n; i++) { cin >> aux; if (aux == 0) sw = 1; else if (ans > (1000000000000000000 / aux) || ans < 0) sw2 = 1; ans *= au...
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
1
134
gets A=gets.split.map(&:to_i) if A.any? &:zero? p 0 else A.inject(1){|s,i|if 10**18<s*=i p -1 exit(0) else s end} end
gets A=gets.split.map(&:to_i) if A.any? &:zero? p 0 else p A.inject(1){|s,i|if 10**18<s*=i p -1 exit(0) else s end} end
[["+", 0, 493, 0, 121, 75, 95, 0, 652, 735, 22]]
4
53
#include <iostream> using namespace std; int main() { int n, flag = 0; cin >> n; unsigned long long a[n], result = 1; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { flag = 2; break; } } if (flag == 2) { cout << "0\n"; return 0; } for (int i = 0; i < n; i++) {...
#include <iostream> using namespace std; int main() { int n, flag = 0; cin >> n; unsigned long long a[n], result = 1; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { flag = 2; break; } } if (flag == 2) { cout << "0\n"; return 0; } for (int i = 0; i < n; i++) {...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
178
import sys N=int(input()) a=list(map(int, input().split())) s=1 if 0 in a: print(0) sys.exit() else: for i in a: if s>10**18: s*=i if s>10**18: print(-1) sys.exit() print(s)
import sys N=int(input()) a=list(map(int, input().split())) s=1 # aに0がある場合を省く if 0 in a: print(0) sys.exit() else: # sが10^18になったら打ち切る for i in a: if s<10**18: s*=i if s>10**18: print(-1) sys.exit() print(s)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18]]
5
82
#include <stdio.h> int main(void) { int i, n; long long int ans = 1, a[100000]; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%lld", &a[i]); } for (i = 0; i < n; i++) { if (a[i] == 0) { printf("0\n"); return 0; } } for (i = 0; i < n; i++) { if (ans * a[i] < 10000000000000...
#include <stdio.h> int main(void) { int i, n; long long int ans = 1, a[100000]; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%lld", &a[i]); } for (i = 0; i < n; i++) { if (a[i] == 0) { printf("0\n"); return 0; } } for (i = 0; i < n; i++) { if (a[i] <= 1000000000000000000...
[["-", 0, 57, 15, 23, 0, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 23, 0, 16, 31, 16, 17, 48], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 85], ["+", 0, 5...
0
160
#include <bits/stdc++.h> using namespace std; const int64_t N = 1000000000000000000; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int64_t val, mul, m; cin >> val; for (int i = 1; i < n; i++) { if (val > 0) m = N / val; cin >> mul; if (mul == 0 || val) { val...
#include <bits/stdc++.h> using namespace std; const int64_t N = 1000000000000000000; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int64_t val, mul, m; cin >> val; for (int i = 1; i < n; i++) { if (val > 0) m = N / val; cin >> mul; if (mul == 0 || val == 0) { ...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
142
#include <algorithm> #include <iostream> #include <string.h> using namespace std; int main() { long long n; cin >> n; long long s[n]; for (long long i = 0; i < n; i++) cin >> s[i]; sort(s, s + n); if (s[0] == 0) { cout << 0 << endl; return 0; } long long ans = 1; for (long long i = 0; i < ...
#include <algorithm> #include <iostream> #include <string.h> using namespace std; int main() { long long n; cin >> n; long long s[n]; for (long long i = 0; i < n; i++) cin >> s[i]; sort(s, s + n); if (s[0] == 0) { cout << 0 << endl; return 0; } long long ans = 1; for (long long i = 0; 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
141
n = int(input()) ans = 1 arr = [int(x) for x in input().split()] for each in arr: ans *= each if (ans > 1e18): print(-1) exit(0) print(ans)
n = int(input()) ans = 1 arr = [int(x) for x in input().split()] arr.sort() for each in arr: ans *= each if (ans > 1e18): print(-1) exit(0) print(ans)
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
57
/** * @brief : c++ code for AtCoder * @author : rk222 * @created: 2020.05.31 20:53:27 */ #define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector>...
/** * @brief : c++ code for AtCoder * @author : rk222 * @created: 2020.05.31 20:53:27 */ #define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector>...
[["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]]
1
1,422
#include <stdio.h> int main() { long long array[100010]; int n; scanf("%d", &n); int i; for (i = 0; i < n; i++) scanf("%lld", &array[i]); int zero = 0; for (i = 0; i < n; i++) { if (array[i] == 0) zero++; } if (zero > 0) printf("0\n"); return 0; long long prod = 1; for (i =...
#include <stdio.h> int main() { long long array[100010]; int n; scanf("%d", &n); int i; for (i = 0; i < n; i++) scanf("%lld", &array[i]); int zero = 0; for (i = 0; i < n; i++) { if (array[i] == 0) zero++; } if (zero > 0) { printf("0\n"); return 0; } long long prod = 1; ...
[["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]]
0
174
n = int(input()) l = list(map(int, input().split())) if 0 in l: print(0) else: ans = 1 for i in l: ans *= i if ans >= 10**18: ans = -1 break else: continue print(ans)
n = int(input()) l = list(map(int, input().split())) if 0 in l: print(0) else: ans = 1 for i in l: ans *= i if ans > 10**18: ans = -1 break else: continue print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
66
n = int(input()) l = list(map(int, input().split())) if 0 in l: print(0) else: ans = 1 for i in l: ans *= i if i >= 10**18: ans = -1 break else: continue print(ans)
n = int(input()) l = list(map(int, input().split())) if 0 in l: print(0) else: ans = 1 for i in l: 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, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102], ["-", 0, 57, 75, 76, 8, 196, 0, 116, 0, 117]]
5
66
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long a[] = new long[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextLong(); } Arrays.sort(a); final long aMa...
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long a[] = new long[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextLong(); } Arrays.sort(a); final long aMa...
[["-", 15, 15, 0, 16, 12, 16, 31, 74, 0, 24], ["-", 0, 16, 12, 16, 31, 74, 39, 511, 0, 512], ["-", 15, 15, 0, 16, 12, 16, 31, 74, 0, 25]]
3
186
#include <bits/stdc++.h> using namespace std; #define rep(i, N) for (int i = 0; i < int(N); ++i) using i64 = int64_t; using ll = long long; int main() { ll N; cin >> N; ll ans = 1; ll check = 1; vector<ll> A(N); rep(i, N) { cin >> A.at(i); } sort(A.begin(), A.end()); if (A.at(0) == 0) { cout << 0 <<...
#include <bits/stdc++.h> using namespace std; #define rep(i, N) for (int i = 0; i < int(N); ++i) using i64 = int64_t; using ll = long long; int main() { ll N; cin >> N; ll ans = 1; ll check = 1; vector<ll> A(N); rep(i, N) { cin >> A.at(i); } sort(A.begin(), A.end()); if (A.at(0) == 0) { cout << 0 <<...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 20]]
1
187
N = int(input()) A = list(map(int, input().split())) ans = 1 if 0 in A : ans = 0 for x in range(N) : ans *= A[x] if ans > 10E+18 : ans = -1 break print(ans)
N = int(input()) A = sorted(map(int, input().split())) ans = 1 if 0 in A : ans = 0 for x in range(N) : ans *= A[x] if ans > 10**18 : ans = -1 break print(ans)
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 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
64
N = int(input()) A = list(map(int, input().split())) ans = 1 if 0 in A : ans = 0 for x in range(N) : ans *= A[x] if ans > 10E+18 : ans = -1 break print(ans)
N = int(input()) A = list(map(int, input().split())) ans = 1 if 0 in A : ans = 0 for x in range(N) : ans *= A[x] if ans > 10E+17 : ans = -1 break print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 531], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 531]]
5
64
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main(void) { int N; long x = 1, L, f = 0, g = 1; scanf("%d\n", &N); for (int i = 0; i < N; i++) { scanf("%ld ", &L); if (L == 0) { g = 0; break; } else if (f == 0 || L > (long)1000000000000000000 / x) { f = -1; } x *...
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main(void) { int N; long x = 1, L, f = 0, g = 1; scanf("%d\n", &N); for (int i = 0; i < N; i++) { scanf("%ld ", &L); if (L == 0) { g = 0; break; } else if (f == 0 && L > (long)1000000000000000000 / x) { f = -1; } x *...
[["-", 75, 76, 0, 57, 15, 23, 0, 16, 17, 106], ["+", 75, 76, 0, 57, 15, 23, 0, 16, 17, 98]]
0
125
num = int(input()) list = list(map(int,input().split())) list.sort a = 1 for i in list: a = a * i if a > 10**18: a = -1 break print(a)
num = int(input()) list = list(map(int,input().split())) list.sort() a = 1 for i in list: a = a * i if a > 10**18: a = -1 break print(a)
[["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
57
#include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define pb(x) push_back(x) #define forn(i, N) for (int i = 0; i < N; i++) using namespace std; using ll = long long int; int main() { // freopen("input.txt","rt",stdin); ios::sync_with_stdio(false); cin.tie(nullptr); ll prod = 1;...
#include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define pb(x) push_back(x) #define forn(i, N) for (int i = 0; i < N; i++) using namespace std; using ll = long long int; int main() { // freopen("input.txt","rt",stdin); ios::sync_with_stdio(false); cin.tie(nullptr); ll prod = 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]]
1
203
n = int(input()) lst = list(map(int, input().split())) zero = False fl = False x = 1 for i in lst: if(i==0): zero = True break x*=i if(x>1e18): fl = True break if zero: print(0) elif fl: print(-1) else: print(x)
n = int(input()) lst = list(map(int, input().split())) zero = False fl = False x = 1 for i in lst: if(i==0): zero = True break if not fl: x*=i if(x>1e18): fl = True if zero: print(0) elif fl: print(-1) else: print(x)
[["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 0, 7, 8, 196, 0, 57, 15, 681, 0, 372], ["+", 0, 7, 8, 196, 0, 57, 15, 681, 28, 22], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102], ["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
85
#include <iostream> using namespace std; long long a[100001]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } int zero = 0; for (int i = 0; i < n; i++) { if (a[i] == 0) zero++; } if (zero > 0) { cout << "-1" << endl; return 0; } long long prod = 1; ...
#include <iostream> using namespace std; long long a[100001]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } int zero = 0; for (int i = 0; i < n; i++) { if (a[i] == 0) zero++; } if (zero > 0) { cout << 0 << endl; return 0; } long long prod = 1; f...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
161
#include <bits/stdc++.h> using namespace std; using ll = long long; #define pb push_back #define ff first #define ss second #define all(a) a.begin(), a.end() #define sz(a) (int)(a.size()) #define clr(a, b) memset(a, b, sizeof(a)) #define REP(i, a, b) for (int i = (int)(a); i < (int)(b); ++i) #define REPD(i, a, b) for...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define pb push_back #define ff first #define ss second #define all(a) a.begin(), a.end() #define sz(a) (int)(a.size()) #define clr(a, b) memset(a, b, sizeof(a)) #define REP(i, a, b) for (int i = (int)(a); i < (int)(b); ++i) #define REPD(i, a, b) for...
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
367
#include <stdio.h> int main() { unsigned long long int b = 0, c = 1, i, t, n[100010]; scanf("%llu", &t); for (i = 1; i <= t; i++) { scanf("%llu", &n[i]); if (n[i] == 0) { b = 1; printf("0\n"); return 0; } } for (i = 1; i <= t; i++) { if (n[i] < 1000000000000000000 / c) ...
#include <stdio.h> int main() { unsigned long long int b = 0, c = 1, i, t, n[100010]; scanf("%llu", &t); for (i = 1; i <= t; i++) { scanf("%llu", &n[i]); if (n[i] == 0) { printf("0\n"); return 0; } } for (i = 1; i <= t; i++) { if (n[i] <= 1000000000000000000 / c) c = c * n[i...
[["-", 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, 13], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19]]
0
156
/* * problem: * method: * date: */ #include <iostream> #define LL long long const LL MAXN = 10e5, MAX = 1e18; using namespace std; LL x[10010]; int main() { int i; LL n, a, res = 1; cin >> n; for (i = 0; i < n; i++) { scanf("%lld", x + i); if (x[i] == 0) res = 0; } if (res) { for (i = ...
/* * problem: * method: * date: */ #include <iostream> #define LL long long const LL MAXN = 10e5, MAX = 1e18; using namespace std; LL x[100010]; int main() { int i; LL n, a, res = 1; cin >> n; for (i = 0; i < n; i++) { scanf("%lld", x + i); if (x[i] == 0) res = 0; } if (res) { for (i =...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
146
#include <bits/stdc++.h> #include <cmath> #include <iostream> using namespace std; typedef long long ll; int main() { int N; cin >> N; ll arr[100005]; for (int i = 0; i < N; i++) { cin >> arr[i]; } int a = 0; for (int i = 0; i < N; i++) { if (arr[i] == 0) { a++; } } if (a > 0) { ...
#include <bits/stdc++.h> #include <cmath> #include <iostream> using namespace std; typedef long long ll; int main() { int N; cin >> N; ll arr[100005]; for (int i = 0; i < N; i++) { cin >> arr[i]; } int a = 0; for (int i = 0; i < N; i++) { if (arr[i] == 0) { a++; } } if (a > 0) { ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 48], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
175
#include <bits/stdc++.h> using namespace std; // vector<vector<int>> a(5, vector<int>(5, 0)) 5*5-0 int main() { long long int n; long long tmp; cin >> n; long long int res = 1; vector<int> a(n); int flag_zero = 0; int flag_18 = 0; for (int i = 0; i < n; i++) { cin >> tmp; if (tmp == 0) { f...
#include <bits/stdc++.h> using namespace std; // vector<vector<int>> a(5, vector<int>(5, 0)) 5*5-0 int main() { long long int n; long long tmp; cin >> n; long long int res = 1; vector<int> a(n); int flag_zero = 0; int flag_18 = 0; for (int i = 0; i < n; i++) { cin >> tmp; if (tmp == 0) { f...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
151
n =int(input()) a =list(map(int,input().split())) ans =1 if 0 in a: print(0) exit() else: for i in range(n): ans *=i if ans >10**18: print(-1) exit() print(ans)
n =int(input()) a =list(map(int,input().split())) ans =1 if 0 in a: print(0) exit() else: for i in a: ans *=i if ans >10**18: print(-1) exit() print(ans)
[["-", 75, 76, 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, 22], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 25], ["+", 0, 57, 75, 76, 8, 196, 0, 7, 12, 22]]
5
72
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; const long long MX = 1e18; int main() { long long n; cin >> n; long long ans = 1; bool ng = false; for (long long i = 0; i < n; i++) { long ...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; const long long MX = 1e18; int main() { long long n; cin >> n; long long ans = 1; bool ng = false; for (long long i = 0; i < n; i++) { long ...
[["-", 51, 16, 12, 16, 31, 16, 31, 23, 0, 24], ["-", 12, 16, 31, 16, 31, 23, 0, 16, 17, 72], ["-", 12, 16, 31, 16, 31, 23, 0, 16, 12, 13], ["-", 51, 16, 12, 16, 31, 16, 31, 23, 0, 25]]
1
139
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int a[n], zero = 0; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) zero++; } if (zero > 0) { cout << 0 << '\n'; return 0; } long long res = 1; for (int ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; long long a[n], zero = 0; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) zero++; } if (zero > 0) { cout << 0 << '\n'; return 0; } long long res = 1; for...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
159
N = int(input()) A = [int(x) for x in input().split()] if 0 in A: print("-1") exit(0) ans = 1 lim = 10**18 for a in A: ans *= a if ans > lim: print("-1") exit(0) print(ans)
N = int(input()) A = [int(x) for x in input().split()] if 0 in A: print("0") exit(0) ans = 1 lim = 10**18 for a in A: ans *= a if ans > lim: print("-1") exit(0) print(ans)
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
76
#include <cstdint> #include <iostream> #include <limits> #include <optional> using namespace std; using u = uint_fast32_t; using U = uint64_t; optional<U> checked_mul(const optional<U> &a, const U b) { if (!a) return nullopt; const auto a_ = a.value(); U ans = a_ * b; return (a_ == 0 || b <= numeric_limit...
#include <cstdint> #include <iostream> #include <limits> #include <optional> using namespace std; using u = uint_fast32_t; using U = uint64_t; optional<U> checked_mul(const optional<U> &a, const U b) { if (!a) return nullopt; const auto a_ = a.value(); U ans = a_ * b; return (a_ == 0 || b <= numeric_limit...
[["-", 15, 339, 51, 16, 12, 16, 12, 23, 0, 24], ["-", 12, 23, 0, 16, 31, 2, 3, 4, 0, 13], ["-", 12, 23, 0, 16, 31, 2, 3, 4, 0, 25], ["-", 51, 16, 12, 16, 12, 23, 0, 16, 17, 151], ["-", 51, 16, 12, 16, 12, 23, 0, 16, 12, 13], ["+", 51, 16, 12, 16, 12, 2, 3, 4, 0, 13]]
1
225
N = int(input()) vals = [int(v) for v in input().split()] rslt = 1 if 0 in vals: rlst = 0 for v in vals: rslt = rslt * v if rslt > 10 ** 18: rslt = -1 break print(rslt)
N = int(input()) vals = [int(v) for v in input().split()] rslt = 1 if 0 in vals: rslt = 0 for v in vals: rslt = rslt * v if rslt > 10 ** 18: rslt = -1 break print(rslt)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22]]
5
63
n = input() A = list(map(int,input().split())) s = 1 for a in A: s *= a if s > 10**18: s = -1 break print(s)
n = input() A = list(map(int,input().split())) s = 1 A.sort() for a in A: s *= a if s > 10**18: s = -1 break print(s)
[["+", 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
49
#include <bits/stdc++.h> using namespace std; int main() { int i, n; long long x[100010], prod = 1; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%lld", &x[i]); if (x[i] == 0) { printf("0\n"); return 0; } } for (i = 0; i < n; i++) { if (prod * x[i] <= 100000000000000000...
#include <bits/stdc++.h> using namespace std; int main() { int i, n; long long x[100010], prod = 1; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%lld", &x[i]); if (x[i] == 0) { printf("0\n"); return 0; } } for (i = 0; i < n; i++) { if (x[i] <= 1000000000000000000 / pro...
[["-", 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
148
n=int(input()) a=list(map(int,input()).split()) if 0 in a:exit(print(0)) ans=1 for i in a: ans*=i if ans>10**18:exit(print(-1)) print(ans)
n=int(input()) a=list(map(int,input().split())) if 0 in a:exit(print(0)) ans=1 for i in a: ans*=i if ans>10**18:exit(print(-1)) print(ans)
[["-", 0, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
67
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <string> #include <tuple> #include <utility> #include <vector> using namespace std; void init() { cin.tie(0); ios::sync_with_stdio(false); cout...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <string> #include <tuple> #include <utility> #include <vector> using namespace std; void init() { cin.tie(0); ios::sync_with_stdio(false); cout...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60]]
1
2,180
N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) else: ans = 1 for i in range(N): ans += A[i] if ans > 10**18: print(-1) exit() print(ans)
N = int(input()) A = list(map(int, input().split())) if 0 in A: print(0) else: ans = 1 for i in range(N): ans *= A[i] if ans > 10**18: print(-1) exit() print(ans)
[["-", 0, 7, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 108]]
5
72
#include <iomanip> #include <iostream> using namespace std; int main() { // input long long N; cin >> N; long long A[N + 1]; long long i; bool zeroexist = 0; for (i = 1; i <= N; i++) { cin >> A[i]; if (A[i] == 0) { zeroexist = 1; } } // calc long long seki = 1; double test; f...
#include <iomanip> #include <iostream> using namespace std; int main() { // input long long N; cin >> N; long long A[N + 1]; long long i; bool zeroexist = 0; for (i = 1; i <= N; i++) { cin >> A[i]; if (A[i] == 0) { zeroexist = 1; } } // calc long long seki = 1; double test; f...
[["+", 15, 339, 51, 16, 31, 16, 12, 16, 31, 22], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 17, 19], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
198
#include <cmath> #include <iostream> using namespace std; #define ll long long ll n, a[100050]; signed main() { cin >> n; for (ll i = 0; i < n; i++) cin >> a[i]; for (ll i = 0; i < n; i++) { if (a[i] == 0) { cout << 0 << endl; return 0; } } long double ans = 0; for (ll i = 0; i < n; ...
#include <cmath> #include <iostream> using namespace std; #define ll long long ll n, a[100050]; signed main() { cin >> n; for (ll i = 0; i < n; i++) cin >> a[i]; for (ll i = 0; i < n; i++) { if (a[i] == 0) { cout << 0 << endl; return 0; } } long double ans = 0; for (ll i = 0; i < n; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
186
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; long long int A[N]; for (int i = 0; i < N; i++) { cin >> A[i]; if (A[i] == 0) { cout << 0 << endl; return 0; } } long long int a = 1; long long int b = 1e18; for (int i = 0; i < N; i++) { if (b / A[i...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; long long int A[N]; for (int i = 0; i < N; i++) { cin >> A[i]; if (A[i] == 0) { cout << 0 << endl; return 0; } } long long int a = 1; long long int b = 1e18; for (int i = 0; i < N; i++) { if (b / A[i...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
138
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n; cin >> n; bool flag = true; ll prod = 1, a; for (int i = 0; i < n; ++i) { cin >> a; if (a > 1000000000000000000 / prod) { flag = false; } else { prod *= a; } if (a == 0) flag = true...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n; cin >> n; bool flag = true; ll prod = 1, a; for (int i = 0; i < n; ++i) { cin >> a; if (a > 1000000000000000000 / prod) { flag = false; } else { prod *= a; } if (a == 0) { flag = tr...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
101
#include <bits/stdc++.h> #include <iostream> using namespace std; int main(void) { long int n = 0; long long int a[100001]; long long int ans = 1; int error = 0; scanf("%ld", &n); for (long long int i = 0; i < n; i++) { scanf("%lld", &a[i]); if (a[i] == 0) { ans = 0; printf("0\n"); ...
#include <bits/stdc++.h> #include <iostream> using namespace std; int main(void) { long int n = 0; long long int a[100001]; long long int ans = 1; int error = 0; scanf("%ld", &n); for (long long int i = 0; i < n; i++) { scanf("%lld", &a[i]); if (a[i] == 0) { ans = 0; printf("0\n"); ...
[["-", 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
195
n=int(input()) a=[int(i) for i in input().split()] b=1 for i in a: b=b*i if b>10**18: b=-1 break print(b)
n=int(input()) a=[int(i) for i in input().split()] b=1 a.sort() for i in a: b=b*i if b>10**18: b=-1 break print(b)
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
55
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pi; #define INF 1000000000 #define loop(i, a, b) for (int i = a; i < b; i++) int main() { // freopen("contest.txt","r",stdin); // freopen("contest.txt","w",stdout); ios::sync_with_stdio(0); cin.ti...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pi; #define INF 1000000000 #define loop(i, a, b) for (int i = a; i < b; i++) int main() { // freopen("contest.txt","r",stdin); // freopen("contest.txt","w",stdout); ios::sync_with_stdio(0); cin.ti...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 69, 28, 22], ["+", 15, 339, 51, 16, 12, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 12, 69, 341, 342, 0, 73]]
1
216
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pi; #define INF 1000000000 #define loop(i, a, b) for (int i = a; i < b; i++) int main() { // freopen("contest.txt","r",stdin); // freopen("contest.txt","w",stdout); ios::sync_with_stdio(0); cin.ti...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pi; #define INF 1000000000 #define loop(i, a, b) for (int i = a; i < b; i++) int main() { // freopen("contest.txt","r",stdin); // freopen("contest.txt","w",stdout); ios::sync_with_stdio(0); cin.ti...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85], ["+", 0, 57, 15, 339, 51, 16, 12,...
1
189
N = int(input()) A = list(map(int,input().split())) ans = 1 if 0 in A: ans = 0 else: for a in A: ans *= a 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 a in A: ans *= a if ans > 10**18: ans = -1 break print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 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
60
N = int(input()) A = list(map(int,input().split())) ans = 1 if 0 in A: ans = 0 else: for a in A: ans *= a if ans > 1000000000000000000: ans = -1 return print(ans)
N = int(input()) A = list(map(int,input().split())) ans = 1 if 0 in A: ans = 0 else: for a in A: ans *= a if ans > 1000000000000000000: ans = -1 break print(ans)
[["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
60
#include <bits/stdc++.h> using namespace std; // 総数を1000000007(素数)で割った余り const long long mod = 1e9 + 7; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; #define ull unsigned long long #define ld long double #define vi vector<int> #define vll vector<ll> #define vc vector<char> #define vs vec...
#include <bits/stdc++.h> using namespace std; // 総数を1000000007(素数)で割った余り const long long mod = 1e9 + 7; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; #define ull unsigned long long #define ld long double #define vi vector<int> #define vll vector<ll> #define vc vector<char> #define vs vec...
[["+", 12, 16, 31, 16, 31, 2, 3, 4, 0, 25], ["-", 51, 16, 12, 16, 31, 2, 3, 4, 0, 25]]
1
322
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); // good luck kittu! int n; cin >> n; ll ans = 1; bool ok = 1; vector<ll> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; if (!a[i]) ans = 0; } if (!ans) return...
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); // good luck kittu! int n; cin >> n; ll ans = 1; bool ok = 1; vector<ll> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; if (!a[i]) ans = 0; } if (!ans) return...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
187
#include "bits/stdc++.h" #include "ext/pb_ds/assoc_container.hpp" #include "ext/pb_ds/tree_policy.hpp" using namespace std; using namespace __gnu_pbds; #define ll long long int #define pb push_back #define mp make_pair #define ff first #define ss second #define all(a) a.begin(), a.end() typedef tree<ll, null_type, l...
#include "bits/stdc++.h" #include "ext/pb_ds/assoc_container.hpp" #include "ext/pb_ds/tree_policy.hpp" using namespace std; using namespace __gnu_pbds; #define ll long long int #define pb push_back #define mp make_pair #define ff first #define ss second #define all(a) a.begin(), a.end() typedef tree<ll, null_type, l...
[["+", 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
217
#include <bits/stdc++.h> #define __STDC_FORMAT_MACROS #define p64 PRId64 #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(f, x, ...) \ ([&](decltype((x)) ALL) { \...
#include <bits/stdc++.h> #define __STDC_FORMAT_MACROS #define p64 PRId64 #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(f, x, ...) \ ([&](decltype((x)) ALL) { \...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]]
1
291
n = int(input()) a = list(map(int, input().split())) if 0 in a: print(-1) exit() limit = 10**18 ans = 1 for i in range(n): ans *= a[i] if ans > limit: print(-1) exit() print(ans)
n = int(input()) a = list(map(int, input().split())) if 0 in a: print(0) exit() limit = 10**18 ans = 1 for i in range(n): ans *= a[i] if ans > limit: 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
77
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; const ll MX = 1e18; int main() { int n; cin >> n; ll ans = 1; bool flg = false; rep(i, n) { ll a; cin >> a; if (a == 0) { cout << 0 << endl; return 0; } if (MX...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; const ll MX = 1e18; int main() { int n; cin >> n; ll ans = 1; bool flg = false; rep(i, n) { ll a; cin >> a; if (a == 0) { cout << 0 << endl; return 0; } if (fl...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 108], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 108], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22]]
1
119
n=int(input()) a=list(map(int,input().split())) ans = 1 if 0 in a: print(-1) exit() for x in a: ans *= x if ans >1e18: print(-1) exit() print(ans)
n=int(input()) a=list(map(int,input().split())) ans = 1 if 0 in a: print(0) exit() for x in a: ans *= x if ans >1e18: 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
66
n = int(input()) a = list(map(int, input().split())) a = sorted(a) ans = 1 for i in range(n): ans *= a[i] if ans == 0: break if ans >= 10**18: ans = -1 break print(ans)
n = int(input()) a = list(map(int, input().split())) a = sorted(a) ans = 1 for i in range(n): ans *= a[i] if ans == 0: break 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
70
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define rep(i, n) for (ll i = 0; i < n; ++i) #define pii pair<int, int> #define pll pair<ll, ll> #define pb push_back #define vi vector<int> #define vll vector<ll> #define vpi vector<pii> #define vpll ...
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define rep(i, n) for (ll i = 0; i < n; ++i) #define pii pair<int, int> #define pll pair<ll, ll> #define pb push_back #define vi vector<int> #define vll vector<ll> #define vpi vector<pii> #define vpll ...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22]]
1
727
n=input() num = list(map(int, input().split())) sorted(num) ans = 1 for i in num: ans *= i if ans > 1000000000000000000: print(-1) exit() if ans > 1000000000000000000: ans = -1 print(ans)
n=input() num = list(map(int, input().split())) num.sort() ans = 1 for i in num: ans *= i if ans > 1000000000000000000: print(-1) exit() if ans > 1000000000000000000: ans = -1 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, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
63
#include <bits/stdc++.h> using namespace std; int main() { long long int i, n, k, kotae = 1; cin >> n; int a[n]; for (i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { cout << 0; return 0; } } for (i = 0; i < n; i++) { k = a[i]; if (k <= 1000000000000000000 / kotae) { ...
#include <bits/stdc++.h> using namespace std; int main() { long long int i, n, k, kotae = 1; cin >> n; long long int a[n]; for (i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { cout << 0; return 0; } } for (i = 0; i < n; i++) { k = a[i]; if (k <= 1000000000000000000 / kota...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
125
def calc(num_list) -> int: result = 1 max = 10**18 if 0 in num_list: return 0 for num in num_list: result *= num if result > max: return -1 return result n = int(input()) num_list = map(int, input().split()) print(str(calc(num_list)))
def calc(num_list) -> int: result = 1 max = 10**18 if 0 in num_list: return 0 for num in num_list: result *= num if result > max: return -1 return result n = int(input()) num_list = list(map(int, input().split())) print(str(calc(num_list)))
[["+", 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
73
N = int(input()) A = list(map(int, input().split())) A.sort(reverse=True) # ans =1 if 0 in A: ans =0 else: for i in A: ans *=i if ans >10**18: ans =-1 print(ans)
N = int(input()) A = list(map(int, input().split())) A.sort(reverse=True) # ans =1 if 0 in A: ans =0 else: for i in A: ans *=i if ans >10**18: ans =-1 break print(ans)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
70
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; int a[n]; for (int i = 0; i < n; ++i) { cin >> a[i]; if (a[i] == 0) { cout << 0; return 0; } } int pr = 1; for (in...
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; int a[n]; for (int i = 0; i < n; ++i) { cin >> a[i]; if (a[i] == 0) { cout << 0; return 0; } } int pr = 1; for (in...
[["+", 0, 57, 15, 339, 51, 16, 12, 74, 0, 24], ["+", 15, 339, 51, 16, 12, 74, 39, 77, 39, 40], ["+", 0, 57, 15, 339, 51, 16, 12, 74, 0, 25]]
1
171
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MAX = 1e18; ll x; int n; int main() { ll now = 1; int flag = 0; scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%lld", &x); if (now == 0 || x == 0) { now = 0; continue; } if (MAX / now >= x) n...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MAX = 1e18; ll x; int n; int main() { ll now = 1; int flag = 0; scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%lld", &x); if (now == 0 || x == 0) { now = 0; continue; } if (MAX / now >= x) n...
[["+", 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
137
N = int(input()) A = list(map(int,input().split())) ans = 1 if 0 in A: ans = 0 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: ans = 0 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
60
import sys n = int(input()) arr = list(map(int, input().split())) if 0 in arr: print(0) sys.exit(0) ans = 1 for i in arr: ans *= i print(ans) if ans > 10**18: ans = -1 break print(ans)
import sys n = int(input()) arr = list(map(int, input().split())) if 0 in arr: print(0) sys.exit(0) ans = 1 for i in arr: ans *= i if ans > 10**18: 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
73