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
function Main(arg) { var arg = arg.trim().split('\n'); var n = Number(arg[0]); var aList = arg[1].split(' '); if (aList.includes('0')) { console.log(0); return; } var ret = 0; for (key in aList) { a = BigInt(aList[key]); if (a > 1000000000000000000) { console.log(-1); return; ...
function Main(arg) { var arg = arg.trim().split('\n'); var n = Number(arg[0]); var aList = arg[1].split(' '); if (aList.includes('0')) { console.log(0); return; } var ret = 0; for (key in aList) { a = BigInt(aList[key]); if (a > 1000000000000000000) { console.log(-1); return; ...
[["+", 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], ["+", 8, 556, 0, 1, 0, 2, 3, 3, 0, 25]]
2
181
N = int(input()) A = list(map(float,input().split( ))) ans = 1 for a in A: ans *= a if ans > 1e18: ans = '-1' break for a in A: if a == 0: ans = 0 print(ans)
N = int(input()) A= list(map(int,input().split( ))) ans = 1 for a in A: ans *= a if ans > 1e18: ans = '-1' break for a in A: if a == 0: ans = 0 break print(ans)
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
64
N = map(int,input().split()) A = list(map(int, input().split())) A.sort() ans = 1 for a in A: ans *= a if ans >= 10**18: ans = -1 break print(ans)
N = map(int,input().split()) A = list(map(int, input().split())) A.sort() ans = 1 for a in A: ans *= a #print(ans) 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
63
#include <algorithm> #include <bitset> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; using ll = long long; using ld = long double; using pint = pair<int, int>; using pll = pair<ll, ll>; #define LONG_INF 922...
#include <algorithm> #include <bitset> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; using ll = long long; using ld = long double; using pint = pair<int, int>; using pll = pair<ll, ll>; #define LONG_INF 922...
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
210
n = int(input()) A = [int(i) for i in input().split()] check = [i for i in A if i == 0] if 0 in check: print(0) else: A.sort(reverse=True) work = 1 for a in A: work *= a if work > 10**18: print(work) print('-1') break else: print(work)
n = int(input()) A = [int(i) for i in input().split()] check = [i for i in A if i == 0] if 0 in check: print(0) else: A.sort(reverse=True) work = 1 for a in A: work *= a if work > 10**18: print('-1') break else: print(work)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24]]
5
93
N = int(input()) arr = sorted(map(int, input().split())) INF = 10 ** 18 ans = 1 for num in arr: if ans > INF: ans = -1 break elif ans == 0: break print(ans)
N = int(input()) arr = sorted(map(int, input().split())) INF = 10 ** 18 ans = 1 for num in arr: ans *= num if ans > INF: ans = -1 break elif ans == 0: break print(ans)
[["+", 0, 7, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 108], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22]]
5
58
''' Online Python Compiler. Code, Compile, Run and Debug python program online. Write your code in this editor and press "Run" button to execute it. ''' n = int(input()) a = list(map(int,input().strip().split()))[:n] x=1 flag=0 flag1=0 for i in range(n): if a[i]==...
''' Online Python Compiler. Code, Compile, Run and Debug python program online. Write your code in this editor and press "Run" button to execute it. ''' n = int(input()) a = list(map(int,input().strip().split()))[:n] x=1 flag=0 flag1=0 for i in range(n): if a[i]==...
[["+", 64, 196, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 0, 7, 8, 196, 0, 1, 0, 677, 17, 108], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 48], ["-", 64, 196, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
128
N = int(input()) mlist = list(map(int,input().split())) s = 1 for i in range(N): if mlist[i] == 0: print(0) s = 0 break elif s > 0: s *= mlist[i] if s >= 10**18: s = -1 if i == N-1 and s != 0: print(s)
N = int(input()) mlist = list(map(int,input().split())) s = 1 for i in range(N): if mlist[i] == 0: print(0) s = 0 break elif s > 0: s *= mlist[i] if s > 10 ** 18: s = -1 if i == N-1 and s != 0: print(s)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
89
#include <algorithm> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <time.h> #include <vector> using namespace std; #define rep(i, a, n) fo...
#include <algorithm> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <time.h> #include <vector> using namespace std; #define rep(i, a, n) fo...
[["-", 0, 42, 0, 53, 54, 55, 0, 56, 39, 40], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 57, 15, 339, 51, 16, 31, 16, ...
1
694
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <iomanip> #include <iostream> /...
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <iomanip> #include <iostream> /...
[["+", 0, 1, 0, 16, 31, 16, 12, 74, 0, 24], ["+", 0, 16, 31, 16, 12, 74, 39, 77, 39, 40], ["+", 0, 1, 0, 16, 31, 16, 12, 74, 0, 25]]
1
292
n=int(input()) p=input().split() p=list(map(int,p)) mul=1 i=0 if '0' in p: print(0) else: while mul<=100000000000000000 and i!=n: mul=mul*p[i] i+=1 if mul>100000000000000000 or i!=n: print(-1) else: print(mul)
n=int(input()) p=input().split() p=list(map(int,p)) mul=1 i=0 if 0 in p: print(0) else: while mul<=1000000000000000000 and i!=n: mul=mul*p[i] i+=1 if mul>1000000000000000000 or i!=n: print(-1) else: print(mul)
[["-", 0, 656, 0, 57, 15, 666, 0, 557, 0, 654], ["-", 0, 656, 0, 57, 15, 666, 0, 557, 0, 655], ["-", 8, 196, 0, 52, 15, 679, 31, 666, 0, 612], ["+", 8, 196, 0, 52, 15, 679, 31, 666, 0, 612], ["-", 8, 196, 0, 57, 15, 679, 31, 666, 0, 612], ["+", 8, 196, 0, 57, 15, 679, 31, 666, 0, 612]]
5
87
n = gets.chomp.to_i a = gets.chomp.split().map(&:to_i) a.sort! b = 1 i = 0 c = false for i in 0..n-1 b = b * a[i] if b > 1000000000000000000 c = true print -1 end end if !c print b end
n = gets.chomp.to_i a = gets.chomp.split().map(&:to_i) a.sort! b = 1 i = 0 c = false for i in 0..n-1 b = b * a[i] if b > 1000000000000000000 c = true print '-1' break end end if !c print b end
[["-", 64, 749, 0, 652, 3, 4, 0, 748, 17, 33], ["-", 64, 749, 0, 652, 3, 4, 0, 748, 439, 612], ["+", 64, 749, 0, 652, 3, 4, 0, 557, 0, 62], ["+", 64, 749, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 8, 170, 0, 121, 64, 749, 0, 94, 0, 94]]
4
68
#import numpy as np N = int(input()) A = list(map(int, input().split())) #A = np.array(A) t = A[0] for i in range(N): t *= A[i] if int(t) > 1e18: for j in range(i,N): if A[j] == 0: t = 0 break if int(t) <= 1e18: print(int(t)) else: print(-1)
#import numpy as np N = int(input()) A = list(map(int, input().split())) #A = np.array(A) t = A[0] for i in range(1,N): t *= A[i] if int(t) > 1e18: for j in range(i,N): if A[j] == 0: t = 0 break if int(t) <= 1e18: print(int(t)) else: print(-1)
[["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
99
N=int(input()) S=list(map(int,input().split())) D=sorted(S) A=1 for i in range(0,N): A=A*D[i] if A>=10**18: A=-1 break print(A)
N=int(input()) S=list(map(int,input().split())) D=sorted(S) A=1 for i in range(N): A=A*D[i] if A>10**(18): A=-1 break print(A)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 57, 15, 666, 0, 657, 12, 23, 0, 24], ["+", 0, 57, 15, 666, 0, 657, 12, 23, 0, 25]]
5
68
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll unsigned long long #define endl "\n" #define mod 1000000000000000000 int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll n; cin >> n; ll arr[n]; ll val = 1; for (ll i = 0; i < n; i++) { cin >> arr[i]; } sort...
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll unsigned long long #define endl "\n" #define mod 1000000000000000000 int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll n; cin >> n; ll arr[n]; ll val = 1; for (ll i = 0; i < n; i++) { cin >> arr[i]; } sort...
[["-", 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
167
n = int(input()) arr = [int(x) for x in input().split()] prod = 1 flag = 0 for each in arr: prod = each * prod if prod > 1000000000000000000: flag = 1 break if flag == 0: print(prod) else: print("-1")
n = int(input()) arr = [int(x) for x in input().split()] arr.sort() prod = 1 flag = 0 for each in arr: prod = each * prod if prod > 1000000000000000000: flag = 1 break if flag == 0: print(prod) 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
68
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; bool done = 0; long long a[100001], ans = 1; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { cout << 0; done = 1; } } for (int i = 0; i < n; i++) { i...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; bool done = 0; long long a[100001], ans = 1; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { cout << 0; done = 1; } } for (int i = 0; i < n; i++) { i...
[["-", 8, 9, 0, 57, 15, 339, 51, 2, 63, 22], ["-", 3, 4, 0, 16, 31, 23, 0, 16, 31, 13], ["+", 51, 23, 0, 16, 31, 23, 0, 16, 31, 13]]
1
159
import numpy as np N = int(input()) a = np.array(list(map(int, input().split()))) b = 1 for i in range(N): if b > 0: b *= a[i] if a[i] == 0: b = 0 if b > 10**18: b = -1 print(b, end='')
import numpy as np N = int(input()) a = list(map(int, input().split())) b = 1 for i in range(N): if b > 0: b *= a[i] if a[i] == 0: b = 0 if b > 10**18: b = -1 print(b, end='')
[["-", 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
87
#include <bits/stdc++.h> using namespace std; int main() { long long curr_num, sum; int n; bool to_continue = true; cin >> n; cin >> sum; for (int i = 1; i < n; i++) { cin >> curr_num; if (curr_num == 0) { sum = -1; to_continue = false; } if (to_continue) { if (100000000000...
#include <bits/stdc++.h> using namespace std; int main() { long long curr_num, sum; int n; bool to_continue = true; cin >> n; cin >> sum; for (int i = 1; i < n; i++) { cin >> curr_num; if (curr_num == 0) { sum = 0; to_continue = false; } if (to_continue) { if (1000000000000...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13]]
1
124
n = int(input()) aa = sorted(list(map(int, input().split()))) if aa[0] == 0: print(0) else: ret = 1 ff = False for a in reversed(aa): ret *= a if ret > 10**18: ff = True break if ff: print(-1) else: print(a)
n = int(input()) aa = sorted(list(map(int, input().split()))) if aa[0] == 0: print(0) else: ret = 1 ff = False for a in reversed(aa): ret *= a if ret > 10**18: ff = True break if ff: print(-1) else: print(ret)
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
84
n=input() flag=0 flag1=0 a=list(map(int,input().split())) sum=1 a.sort() for i in a : sum*=i if(i==0): flag1=1 if(sum>=1e18) : flag=1 break if(flag==0 or flag1==1): print(sum) else : print(-1)
n=input() flag=0 flag1=0 a=list(map(int,input().split())) sum=1 a.sort() for i in a : sum*=i if(i==0): flag1=1 if(sum>1e18) : flag=1 break if(flag==0 or flag1==1): print(sum) else : print(-1)
[["-", 8, 196, 0, 57, 15, 23, 0, 666, 667, 20], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 667, 47]]
5
87
import sys N = int(input()) A = list(map(int,input().split())) if 0 in A: print(0) sys.exit() K = 1 for i in range(N): K = A[i]*K print(K) if K > 10**18: print(-1) sys.exit() print(K)
import sys N = int(input()) A = list(map(int,input().split())) if 0 in A: print(0) sys.exit() K = 1 for i in range(N): K = A[i]*K if K > 10**18: print(-1) sys.exit() print(K)
[["-", 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
85
N = int(input()) A = list(map(int,input().split())) finish = 0 result = 1 if 0 in A: print(0) finish = 1 else: for n in range(N): result = result*A[n] if result > 10**18: print(-1) finish = 1 if finish == 0: print(result)
N = int(input()) A = list(map(int,input().split())) finish = 0 result = 1 if 0 in A: print(0) finish = 1 else: for n in range(N): result = result*A[n] if result > 10**18: print(-1) finish = 1 break if finish == 0: print(result)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
85
#include <bits/stdc++.h> using namespace std; int main() { int N, n, z; long M, A; double m, a; cin >> N; n = 0; M = 1; m = 0; z = 0; while (n < N) { cin >> A; if (A == 0) { n = N; cout << 0; z = 1; } M = M * A; a = log10(A); m = m + a; n++; } if (z =...
#include <bits/stdc++.h> using namespace std; int main() { int N, n, z; long M, A; double m, a; cin >> N; n = 0; M = 1; m = 0; z = 0; while (n < N) { cin >> A; if (A == 0) { n = N; cout << 0; z = 1; } M = M * A; a = log10(A); m = m + a; n++; } if (z =...
[["-", 15, 339, 51, 16, 31, 23, 0, 16, 31, 22], ["+", 15, 339, 51, 16, 31, 23, 0, 16, 31, 22]]
1
138
#include <bits/stdc++.h> using namespace std; long long maxim = 1e18; int main() { long long N; long long A[100010]; for (int i = 0; i < 100010; i++) { A[i] = 0; } double keta = 0; long long mul = 1; bool ok = true; cin >> N; for (int i = 0; i < N; i++) { cin >> A[i]; if (A[i] == 0) { ...
#include <bits/stdc++.h> using namespace std; long long maxim = 1e18; int main() { long long N; long long A[100010]; for (int i = 0; i < 100010; i++) { A[i] = 0; } double keta = 0; long long mul = 1; bool ok = true; cin >> N; for (int i = 0; i < N; i++) { cin >> A[i]; if (A[i] == 0) { ...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
195
N = input() A = list(map(int, input().split())) newA = sorted(A,reverse=True) num = 1 if 0 in A: num = 0 else: for i in newA: if num > 1000000000000000000: print(-1) break num = num*int(i) if num > 1000000000000000000: print(-1) else: print(num)
N = input() A = list(map(int, input().split())) newA = sorted(A,reverse=True) num = 1 if 0 in A: num = 0 else: for i in newA: if num > 1000000000000000000: break num = num*int(i) if num > 1000000000000000000: print(-1) else: print(num)
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 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, 25]]
5
85
N = int(input()) A = list(map(int, input().split())) if 0 in A: sum = 0 sum = 1 ans = 0 for x in A: sum *= x if sum > 1000000000000000000: ans = -1 break if sum == 0: ans = 0 break if ans < 0: print(ans) else: print(sum)
N = int(input()) A = list(map(int, input().split())) sum = 1 if 0 in A: sum = 0 ans = 0 for x in A: sum *= x if sum > 1000000000000000000: ans = -1 break if sum == 0: ans = 0 break if ans < 0: print(ans) else: print(sum)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
81
import sys N = int(input()) l = list(map(int,input().split())) if 0 in l: print(0) sys.exit() ans = 1 for i in l: ans *= i if ans > 10**18: print(-1) print(ans)
import sys N = int(input()) l = list(map(int,input().split())) if 0 in l: print(0) sys.exit() ans = 1 for i in l: ans *= i if ans > 10**18: print(-1) sys.exit() print(ans)
[["+", 64, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
68
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <vector> using namespace std; typedef long long ll; #define PI 3.14159265359 int main() { ll N, A; cin >> N; vector<ll> vec; vec.reserve(N); for (auto i = 0; i < N; i++) { cin >> A; if (...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <vector> using namespace std; typedef long long ll; #define PI 3.14159265359 int main() { ll N, A; cin >> N; vector<ll> vec; vec.reserve(N); for (auto i = 0; i < N; i++) { cin >> A; if (...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
167
n = int(input()) lst = list(map(int, input().split())) ans = 1 for a in lst: ans *= a if ans > 1e18: print(-1) break else: print(ans)
n = int(input()) lst = list(map(int, input().split())) lst.sort() ans = 1 for a in lst: ans *= a if ans > 1e18: print(-1) break else: print(ans)
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
53
n = int(input()) a = list(map(int,input().split())) a.sort p = True ans = 1 for i in a : ans *= i if(ans == 0) : print(0) p = False break if(ans > 1000000000000000000): print(-1) p =False break if p: if ans > 1000000000000000000: print(-1) else: print(ans)
n = int(input()) a = list(map(int,input().split())) a.sort() p = True ans = 1 for i in a : ans *= i if(ans == 0) : print(0) p = False break if(ans > 1000000000000000000): print(-1) p =False break if p: if ans > 1000000000000000000: print(-1) else: print(ans)
[["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
92
N = int(input()) A = input().split() answer = 1 flag = 0 x = 10**18 if '0' in A: print(0) flag = 1 for i in range(N): answer *= int(A[i]) if answer > x: print(-1) flag = 1 break if flag == 0: print(answer)
N = int(input()) A = input().split() answer = 1 flag = 0 x = 10**18 if '0' in A: print(0) flag = 1 if flag == 0: for i in range(N): answer *= int(A[i]) if answer > x: print(-1) flag = 1 break if flag == 0: print(answer)
[["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 102]]
5
82
N = int(input()) A = list(map(int, input().split())) tmp = 1 for num in A: tmp *= num if tmp > 1e18: break if tmp <= 1e18: print(tmp) elif 0 in tmp: print(0) else: print(-1)
N = int(input()) A = list(map(int, input().split())) tmp = 1 for num in A: tmp *= num if tmp > 1e18: break if tmp <= 1e18: print(tmp) elif 0 in A: print(0) else: print(-1)
[["-", 0, 656, 0, 57, 75, 665, 15, 666, 0, 22], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 0, 22]]
5
67
/*Author - Shubham Gupta (@shubham107)*/ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vl; typedef vector<int> vi; typedef vector<vl> vvl; typedef vector<vi> vvi; typedef pair<ll, ll> pll; typedef pair<int, int> pii; #define forn(i, n) for (int i = 0; i < n; i++) #define rforn(...
/*Author - Shubham Gupta (@shubham107)*/ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vl; typedef vector<int> vi; typedef vector<vl> vvl; typedef vector<vi> vvi; typedef pair<ll, ll> pll; typedef pair<int, int> pii; #define forn(i, n) for (int i = 0; i < n; i++) #define rforn(...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
372
<?php $N = trim(fgets(STDIN)); $N_array = trim(fgets(STDIN)); $pieces = explode(" ", $N_array); $result = $pieces[0]; foreach($pieces as $k => $p) { if ($p == 0) { echo 0; exit; } } foreach($pieces as $k => $p) { if($k == 0) { $result = $p; } else { if ((strlen($result)+ strlen($p)) > 20)...
<?php $N = trim(fgets(STDIN)); $N_array = trim(fgets(STDIN)); $pieces = explode(" ", $N_array); $result = $pieces[0]; foreach($pieces as $k => $p) { if ($p == 0) { echo 0; exit; } } foreach($pieces as $k => $p) { if($k == 0) { $result = $p; } else { if ((strlen($result)+ strlen($p)) > 20)...
[["+", 0, 493, 0, 57, 8, 9, 0, 1, 0, 141], ["+", 0, 493, 0, 57, 8, 9, 0, 1, 0, 35]]
6
157
n = int(input()) arr = [int(x) for x in input().split()] res = 1 flag = False for i in range(n): if flag == False: res *= arr[i] if res == 0: print(0) exit() if res > 10**18: flag = True if res > 10**18: print(-1) else: print(res)
n = int(input()) arr = [int(x) for x in input().split()] res = 1 flag = False for i in range(n): if flag == False: res *= arr[i] if arr[i] == 0: print(0) exit() if res > 10**18: flag = True if res > 10**18: print(-1) else: print(res)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 70], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 206, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 73]]
5
91
#include <algorithm> #include <iostream> #include <limits.h> #include <math.h> #include <stdlib.h> #include <string> #include <tuple> #include <utility> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> P; #define rep(i, n) for (int i = 0; i < n; i++) #define ALL(A) A.begin(), A.end() ...
#include <algorithm> #include <iostream> #include <limits.h> #include <math.h> #include <stdlib.h> #include <string> #include <tuple> #include <utility> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> P; #define rep(i, n) for (int i = 0; i < n; i++) #define ALL(A) A.begin(), A.end() ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 147], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 146], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
159
N = int(input()) numbers = [int(n) for n in input().split()] mlt = 1 if 0 in numbers: print(0) for n in numbers: mlt *= n if mlt > 1000000000000000000: mlt = -1 break print(mlt)
N = int(input()) numbers = [int(n) for n in input().split()] mlt = 1 if 0 in numbers: print(0) else: for n in numbers: mlt *= n if mlt > 1000000000000000000: mlt = -1 break print(mlt)
[["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102]]
5
60
from functools import reduce from operator import mul import sys input = sys.stdin.readline count = int(input()) list = list(map(int, input().split())) sum = list[0] if 0 in list: print(0) else: for i in range(count - 1): sum = sum * list[i + 1] if sum > 1000000000000000000: print(-1) ...
from functools import reduce from operator import mul import sys input = sys.stdin.readline count = int(input()) list = list(map(int, input().split())) sum = list[0] if 0 in list: print(0) exit() else: for i in range(count - 1): sum = sum * list[i + 1] if sum > 1000000000000000000: ...
[["+", 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
96
N=int(input()) A=list(map(int,input().split())) ans=1 if A.count(0) >= 1: print(0) else: B=[i for i in A if i != 1] if len(B) >= 100: print("-1") else: for k in range(len(B)-1): ans=ans*B[k] if ans > 1000000000000000000: print("-1") else: print(ans)
N=int(input()) A=list(map(int,input().split())) ans=1 if A.count(0) >= 1: print(0) else: B=[i for i in A if i != 1] if len(B) >= 100: print("-1") else: for k in range(len(B)): ans=ans*B[k] if ans > 1000000000000000000: print("-1") else: print(ans)
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
111
import sys n=int(input()) l=list(map(int,input().split())) if 0 in l: print(21) sys.exit() flg=False a = 1 for i in l: a *= i if a>10e17: flg=True break if flg: print(-1) else: print(a)
import sys n=int(input()) l=list(map(int,input().split())) if 0 in l: print(0) sys.exit() flg=False a = 1 for i in l: a *= i if a>10e17: flg=True break if flg: print(-1) else: print(a)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
78
function Main(input) { var result = BigInt('1'); const max_result = BigInt('1000000000000000000'); var flg = 1; const values = input.trim().split('\n'); const N = parseInt(values[0]); const A = values[1].split(' '); if (A.indexOf('0') >= 0) { result = 0; } else { A = A.map((str) => BigInt(str));...
function Main(input) { var result = BigInt('1'); const max_result = BigInt('1000000000000000000'); var flg = 1; const values = input.trim().split('\n'); const N = parseInt(values[0]); var A = values[1].split(' '); if (A.indexOf('0') >= 0) { result = 0; } else { A = A.map((str) => BigInt(str)); ...
[["-", 0, 493, 0, 435, 8, 556, 0, 570, 571, 154], ["+", 0, 493, 0, 435, 8, 556, 0, 198, 0, 217], ["-", 75, 76, 0, 556, 0, 579, 8, 556, 0, 46], ["+", 8, 556, 0, 57, 64, 556, 0, 1, 0, 35], ["+", 8, 556, 0, 57, 64, 556, 0, 93, 0, 94], ["+", 0, 579, 8, 556, 0, 57, 64, 556, 0, 46]]
2
170
import array n = int(input()) a=[] a=input().split(" ") f=0 f1=0 b=0 for i in a: if int(i) == 0: print("0"); f1=1 sum =1 if f1==0: for i in a: sum=sum*int(i); if sum>1e18: f=1 print("-1"); if f==0 and f1==0: print(sum)
import array n = int(input()) a=[] a=input().split(" ") f=0 f1=0 b=0 for i in a: if int(i) == 0: print("0") f1=1 break sum =1 if f1==0: for i in a: sum=sum*int(i) if sum>1e18: f=1 print("-1") break if f==0 and f1==0: ...
[["-", 0, 7, 8, 196, 0, 57, 64, 196, 0, 35], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["-", 0, 57, 64, 196, 0, 7, 8, 196, 0, 35]]
5
108
n = int(input()) a = list(map(int,input().split())) if 0 in a: print(0) else: p = 1 f = True for i in a: p *= i if(p > 1000000000000000000): f = false break if(f): print(p) else: print(-1)
n = int(input()) a = list(map(int,input().split())) if 0 in a: print(0) else: p = 1 f = True for i in a: p *= i if(p > 1000000000000000000): f = False break if(f): print(p) else: print(-1)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 147]]
5
77
#include <bits/stdc++.h> // ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); // clock_t start=clock();clock_t // end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl; using namespace std; typedef long long ll; typedef unsigned long long ull; typedef unsigned int ui; typedef pair<int, int> pii; typedef pair<pii...
#include <bits/stdc++.h> // ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); // clock_t start=clock();clock_t // end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl; using namespace std; typedef long long ll; typedef unsigned long long ull; typedef unsigned int ui; typedef pair<int, int> pii; typedef pair<pii...
[["+", 8, 9, 0, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 9, 0, 57, 64, 9, 0, 116, 0, 117], ["+", 8, 9, 0, 9, 0, 57, 64, 9, 0, 46]]
1
804
n = int(input()) a = list(map(int, input().split())) a.sort() if a[0] == 0: print(0) exit(0) ans = 1 for i in a: ans *= i print(i, ans) if (ans > 1e18): print(-1) exit(0) print(ans)
n = int(input()) a = list(map(int, input().split())) a.sort() if a[0] == 0: print(0) exit(0) ans = 1 for i in a: ans *= i if (ans > 1e18): print(-1) exit(0) print(ans)
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
83
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; int main() { long long n; cin >> n; vector<ll> a(n); rep(i, n) cin >> a[i]; ll sum = 1; ll tmp = 1; ll Max = 1000000000000000000; rep(i, n) { tmp = Max / sum; if (a[i] == 0) { ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; int main() { long long n; cin >> n; vector<ll> a(n); rep(i, n) cin >> a[i]; ll sum = 1; ll tmp = 1; ll Max = 1000000000000000000; rep(i, n) { tmp = Max / sum; if (a[i] == 0) { ...
[["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 116, 0, 117]]
1
137
#include <iostream> #include <string> using namespace std; typedef unsigned long long int ll; #define MAX_N 100000 int n; ll a[MAX_N]; void solve() { ll ans = 1; for (int i = 0; i < n; i++) { if (a[i] == 0) ans = 0; } if (ans != 0) { for (int i = 0; i < n; i++) { if (ans > 1000000000000000...
#include <iostream> #include <string> using namespace std; typedef long long int ll; #define MAX_N 100000 int n; ll a[MAX_N]; void solve() { ll ans = 1; for (int i = 0; i < n; i++) { if (a[i] == 0) ans = 0; } if (ans != 0) { for (int i = 0; i < n; i++) { if (ans > 1000000000000000000 / a[...
[["-", 36, 36, 0, 30, 0, 134, 39, 86, 0, 87]]
1
158
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; unsigned long long int arr[n]; unsigned long long int pro = 1, temp; int flag = 0, flag1 = 0; for (int a = 0; a < n; a++) { cin >> arr[a]; if (arr[a] == 0) { flag = 1; cout << "0"; break; } } if (fl...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; unsigned long long int arr[n]; unsigned long long int pro = 1, temp; int flag = 0, flag1 = 0; for (int a = 0; a < n; a++) { cin >> arr[a]; if (arr[a] == 0) { flag = 1; cout << "0"; break; } } if (fl...
[["+", 12, 16, 31, 23, 0, 16, 12, 69, 28, 22], ["+", 31, 23, 0, 16, 12, 69, 341, 342, 0, 70], ["+", 31, 23, 0, 16, 12, 69, 341, 342, 0, 73]]
1
166
#include <bits/stdc++.h> using namespace std; // using namespace std::chrono; // c++ templte for // help............................................................................................................................................ typedef long long ll; // typedef unsigned long long ull; // template<typ...
#include <bits/stdc++.h> using namespace std; // using namespace std::chrono; // c++ templte for // help............................................................................................................................................ typedef long long ll; // typedef unsigned long long ull; // template<typ...
[["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78]]
1
242
#include <stdio.h> int main(void) { unsigned long long int a, b, c = 1, d = 0; int i; scanf("%lld", &a); for (i = 0; i < a; i++) { scanf("%lld", &b); if (d != 1) { if (18 < log10(b) + log10(c)) { d = 1; } else if (1000000000000000000 <= c * b) { d = 1; } } ...
#include <stdio.h> int main(void) { unsigned long long int a, b, c = 1, d = 0; int i; scanf("%lld", &a); for (i = 0; i < a; i++) { scanf("%lld", &b); if (d != 1) { if (18 < log10(b) + log10(c)) { d = 1; } else if (1000000000000000000 < c * b) { d = 1; } } e...
[["-", 75, 76, 0, 57, 15, 23, 0, 16, 17, 19], ["+", 75, 76, 0, 57, 15, 23, 0, 16, 17, 18]]
0
155
import sys input = sys.stdin.readline def main(): N = int(input()) A = [int(v) for v in input().split()] over = False ans = 1 for a in A: ans *= a if ans > 1e18: over = True break if over: print(-1) else: print(ans) if __name__ ...
import sys input = sys.stdin.readline def main(): N = int(input()) A = sorted([int(v) for v in input().split()]) over = False ans = 1 for a in A: ans *= a if ans > 1e18: over = True break if over: print(-1) else: print(ans) if _...
[["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
87
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <math.h> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main() { int n; cin >> n; vector<ll> a(n); vector<ll> b(n); int flag = 0; rep(i, n...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <math.h> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main() { int n; cin >> n; vector<ll> a(n); vector<ll> b(n); int flag = 0; rep(i, n...
[["-", 0, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
229
n = int(input()) c = list(map(int, input().split())) ans=1 max =10**18 if 0 in c: ans =0 else: for i in range(n): if ans< max: ans=ans*c[i] if ans >= max: ans =-1 break else: ans = -1 break print(ans)
n = int(input()) c = list(map(int, input().split())) ans=1 max =10**18 if 0 in c: ans =0 else: for i in range(n): if ans< max: ans=ans*c[i] if ans > max: ans =-1 break else: ans = -1 break print(ans)
[["-", 0, 57, 64, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 667, 47]]
5
85
// Coded by Yash Pradhan // bit.ly/yashpradhan #include <iostream> #define fastio \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.ti...
// Coded by Yash Pradhan // bit.ly/yashpradhan #include <iostream> #define fastio \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.ti...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85]]
1
158
#include <bits/stdc++.h> #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); using namespace std; int main() { ...
#include <bits/stdc++.h> #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); using namespace std; int main() { ...
[["+", 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
111
import functools n = int(input()) xs = map(int, input().split()) def foldSum(acc, x): return acc*x if 0 in xs: print(0) elif len([x for x in xs if x > 1]) >= 60: print(-1) else: res = functools.reduce(foldSum, xs, 1) if res > 1e18: print(-1) else: print(res)
import functools n = int(input()) xs = list(map(int, input().split())) def foldMulti(acc, x): return acc*x if 0 in xs: print(0) elif len([x for x in xs if x > 1]) >= 60: print(-1) else: res = functools.reduce(foldMulti, xs, 1) if res > 1e18: print(-1) else: print(res)
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["-", 36, 36, 36, 36, 0, 656, 0, 14, 141, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 14, 141, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
98
n=int(input()) a=list(map(int,input().split())) a.sort() for i in range(n): ans*=a[i] if ans>10**18: print(-1) break else: print(ans)
n=int(input()) a=list(map(int,input().split())) a.sort() ans=1 for i in range(n): ans*=a[i] if ans>10**18: print(-1) break else: print(ans)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
63
n,*a=map(int,open(0).read().split()) a.sort() for i in a: s *= i if s > 1e18: print(-1) exit() print(s)
n,*a=map(int,open(0).read().split()) a.sort() s=1 for i in a: s *= i if s > 1e18: print(-1) exit() print(s)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
52
n,*a=map(int,open(0).read().split()) s=1 if 0 in a: print(0) exit() for i in a: s*=a if s > 10**18: print(-1) exit() print(s)
n,*a=map(int,open(0).read().split()) s=1 if 0 in a: print(0) exit() for i in a: s*=i if s > 1e18: print(-1) exit() print(s)
[["-", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22], ["-", 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], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 531]]
5
64
import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { BigInteger MAX = new BigInteger("100000000000000000"); Scanner sc = new Scanner(System.in); int n = sc.nextInt(); BigInteger[] s = new BigInteger[n]; BigInteger ans = BigInteger.ONE...
import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { BigInteger MAX = new BigInteger("1000000000000000000"); Scanner sc = new Scanner(System.in); int n = sc.nextInt(); BigInteger[] s = new BigInteger[n]; BigInteger ans = BigInteger.ON...
[["-", 49, 200, 51, 230, 3, 4, 0, 5, 0, 491], ["+", 49, 200, 51, 230, 3, 4, 0, 5, 0, 491]]
3
208
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repbtw(i, a, b) for (int i = a; i <= (int)(b); i++) #define all(v) v.begin(), v.end() #define pr(x) cout << x << endl int main() { int64_t n; cin >> n; int64_t mul = 1; int64_t a_in; bool overflow = fa...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repbtw(i, a, b) for (int i = a; i <= (int)(b); i++) #define all(v) v.begin(), v.end() #define pr(x) cout << x << endl int main() { int64_t n; cin >> n; int64_t mul = 1; int64_t a_in; bool overflow = fa...
[["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 24], ["+", 51, 16, 12, 16, 31, 74, 39, 77, 39, 40], ["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 25]]
1
139
#include <bits/stdc++.h> using namespace std; const long long MX = 1e18; int main() { int N; long long ans = 1; cin >> N; bool ng = false; vector<long long> A(N); for (int i = 0; i < N; i++) { cin >> A.at(i); } for (int i = 0; i < N; i++) { if (A.at(i) == 0) { cout << 0 << endl; re...
#include <bits/stdc++.h> using namespace std; const long long MX = 1e18; int main() { int N; long long ans = 1; cin >> N; bool ng = false; vector<long long> A(N); for (int i = 0; i < N; i++) { cin >> A.at(i); } for (int i = 0; i < N; i++) { if (A.at(i) == 0) { cout << 0 << endl; re...
[["-", 0, 14, 8, 9, 0, 57, 15, 339, 51, 146], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 51, 22]]
1
181
num = int(input()) str2 = input().split(" ") nums = [int(s) for s in str2] nums.sort() for i in range(len(nums)): ans = ans * nums[i] if(ans > 1000000000000000000): print(-1) quit() print(ans) quit()
num = int(input()) str2 = input().split(" ") nums = [int(s) for s in str2] nums.sort() ans = 1 for i in range(len(nums)): ans = ans * nums[i] if(ans > 1000000000000000000): print(-1) quit() print(ans)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
78
#include <bits/stdc++.h> using namespace std; #define ll long long #define lvector vector<ll> #define cvector vector<char> #define svector vector<string> #define lque queue<ll> #define lpque priority_queue<ll> #define dlpque priority_queue<ll, lvector, greater<ll>> #define P pair<ll, ll> #define ALL(a) a.begin(), a.end...
#include <bits/stdc++.h> using namespace std; #define ll long long #define lvector vector<ll> #define cvector vector<char> #define svector vector<string> #define lque queue<ll> #define lpque priority_queue<ll> #define dlpque priority_queue<ll, lvector, greater<ll>> #define P pair<ll, ll> #define ALL(a) a.begin(), a.end...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
156
// c++ テンプレ #include <bits/stdc++.h> using namespace std; typedef long long llint; typedef unsigned long LInt; typedef long double ld; #define inf 1e18 constexpr long long INFLL = 1e18; #define mod 1000000007 priority_queue<llint, vector<llint>, greater<llint>> que; priority_queue<llint> Que; template <class T> inlin...
// c++ テンプレ #include <bits/stdc++.h> using namespace std; typedef long long llint; typedef unsigned long LInt; typedef long double ld; #define inf 1e18 constexpr long long INFLL = 1e18; #define mod 1000000007 priority_queue<llint, vector<llint>, greater<llint>> que; priority_queue<llint> Que; template <class T> inlin...
[["+", 0, 57, 75, 76, 0, 9, 0, 37, 0, 38], ["+", 0, 57, 75, 76, 0, 9, 0, 37, 0, 35]]
1
226
N = int(input()) MX = 10**18 a = list(map(int, input().split())) if 0 in a: print(0) exit(0) ans = 1 for x in a: ans *= x if ans > MX: print(0) exit(0) print(ans)
N = int(input()) MX = 10**18 a = list(map(int, input().split())) if 0 in a: print(0) exit(0) ans = 1 for x in a: ans *= x if ans > MX: print(-1) exit(0) print(ans)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612]]
5
71
n = int(input()) mx = 10**18 a = list(map(int, input().split())) for x in a: if x == 0: print(0) exit(0) ans = 1 for x in a: ans *= a if ans > mx: print(-1) exit(0) print(ans)
n = int(input()) mx = 10**18 a = list(map(int, input().split())) for x in a: if x == 0: print(0) exit(0) ans = 1 for x in a: ans *= x if ans > mx: print(-1) exit(0) print(ans)
[["-", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22]]
5
77
N = gets.to_i a = [] a = gets.split.map(&:to_i) a = a.sort if N==2 if a[0]*a[1] > 10**18 puts -1 else puts a[0]*a[1] end exit end if N % 2 == 1 ans = a[N/2] else ans = 1 end (N/2).times do |i| ans = ans * (a[i] * a[N-1-i]) if ans == 0 puts 0 exit end if ans > 10**18 puts -1 ...
N = gets.to_i a = [] a = gets.split.map(&:to_i) a = a.sort if N==2 if a[0]*a[1] > 10**18 puts -1 else puts a[0]*a[1] end exit end if N % 2 == 1 ans = a[N/2] else ans = 1 end (N/2).times do |i| ans = ans * (a[i] * a[N-1-i]) if ans == 0 puts 0 exit end if ans > 10**18 puts -1 ...
[["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22]]
4
129
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll MX = 1e18; // 10の18乗 int main() { ll sum = 1; int n; bool ng = false; cin >> n; for (int i = 0; i < n; i++) { ll arr; cin >> arr; if (arr == 0) { cout << 0 << endl; return 0; } if (ng || MX < sum * ...
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll MX = 1e18; // 10の18乗 int main() { ll sum = 1; int n; bool ng = false; cin >> n; for (int i = 0; i < n; i++) { ll arr; cin >> arr; if (arr == 0) { cout << 0 << endl; return 0; } if (ng || MX / sum < ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 17, 85], ["-", 15, 339, 51, 16, 12, 16, 12, 16, 17, 48], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18]]
1
127
#include <bits/stdc++.h> using namespace std; int main() { /********************************************* writer Torisuto 2020/5/31 N個の整数をすべて掛け算し、10^18を越えたら−1を出力 その他はすべてかけた値を出力 2 <= N <= 10^5 0 <= A[i] <= 10^18 **********************************************/ int N; cin >> N; vector<lon...
#include <bits/stdc++.h> using namespace std; int main() { /********************************************* writer Torisuto 2020/5/31 N個の整数をすべて掛け算し、10^18を越えたら−1を出力 その他はすべてかけた値を出力 2 <= N <= 10^5 0 <= A[i] <= 10^18 **********************************************/ int N; cin >> N; vector<lon...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
147
#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...
#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...
[["+", 51, 16, 12, 16, 31, 16, 31, 74, 0, 24], ["+", 12, 16, 31, 16, 31, 74, 39, 77, 39, 78], ["+", 51, 16, 12, 16, 31, 16, 31, 74, 0, 25]]
1
131
/* HARDWORK IS THE KEY TO SUCCESS. RATING IS TEMPORARY , KNOWLEDGE IS PERMANENT.!!!*/ #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define T \ ll t = 1; ...
/* HARDWORK IS THE KEY TO SUCCESS. RATING IS TEMPORARY , KNOWLEDGE IS PERMANENT.!!!*/ #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define T \ ll t = 1; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
340
#include <bits/stdc++.h> using namespace std; string to_string(const string &s) { return '"' + s + '"'; } string to_string(const char *s) { return to_string((string)s); } string to_string(bool b) { return (b ? "true" : "false"); } template <typename T> string to_string(T v) { bool first = true; string res = "{"; ...
#include <bits/stdc++.h> using namespace std; string to_string(const string &s) { return '"' + s + '"'; } string to_string(const char *s) { return to_string((string)s); } string to_string(bool b) { return (b ? "true" : "false"); } template <typename T> string to_string(T v) { bool first = true; string res = "{"; ...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]]
1
395
#include <bits/stdc++.h> #define watch(x) cerr << (#x) << " is " << (x) << endl using namespace std; int main() { #ifdef ME freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int n; cin >> n; long long ans = 1; vector<int> arr(n); for (int &x : arr) { scanf("%d", &x); ...
#include <bits/stdc++.h> #define watch(x) cerr << (#x) << " is " << (x) << endl using namespace std; int main() { #ifdef ME freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int n; cin >> n; long long ans = 1; vector<long long> arr(n); for (long long &x : arr) { scanf("%l...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 338, 39, 40], ["+", 0, 14, 8, 9, 0, 338, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
170
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int64_t> a(n); int64_t mul = 1; for (int i = 0; i < n; i++) { cin >> a.at(i); if (a.at(i) == 0) { mul = 0; cout << mul << endl; return 0; } } for (int i = 0; i < n; i++) { ...
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int64_t> a(n); int64_t mul = 1; for (int i = 0; i < n; i++) { cin >> a.at(i); if (a.at(i) == 0) { mul = 0; cout << mul << endl; return 0; } } for (int i = 0; i < n; i++) { ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
146
#include <iostream> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repr(i, x, n) for (int i = x; i < (int)n; i++) const long long MX = 1e18; int main() { long double mp = 1.0; long long N; cin >> N; vector<long long> A(N); for (int i = 0; i < N; i++) { ...
#include <iostream> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repr(i, x, n) for (int i = x; i < (int)n; i++) const long long MX = 1e18; int main() { long long mp = 1; long long N; cin >> N; vector<long long> A(N); for (int i = 0; i < N; i++) { ci...
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 39, 40], ["+", 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
160
#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...
#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...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 106], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["-", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13]]
1
142
import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long[] a = new long[n]; long std = 1000000000000000000L; for (int i = 0; i < n; i++) { a[i] = sc.nextLong(); if (a[i] == 0) { ...
import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long[] a = new long[n]; long std = 1000000000000000000L; for (int i = 0; i < n; i++) { a[i] = sc.nextLong(); if (a[i] == 0) { ...
[["-", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499], ["+", 0, 57, 15, 15, 0, 16, 12, 23, 0, 24], ["+", 0, 57, 15, 15, 0, 16, 12, 23, 0, 25]]
3
179
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): n = int(input()) a = list(map(int, readline().split())) cur = 1 for x in a: cur *= x if cur > 10 ** 18: print(-1) sys.exit() print(cur...
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): n = int(input()) a = list(map(int, readline().split())) a.sort() cur = 1 for x in a: cur *= x if cur > 10 ** 18: print(-1) sys.exit...
[["+", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
104
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <forward_list> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <tuple> #include <utility> #include <vector> #define...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <forward_list> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <tuple> #include <utility> #include <vector> #define...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
197
#B n = int(input()) a = list(map(int,input().split())) flg = True a.sort if a[0] == 0: print(0) else: result = a[0] for i in range(1,n): result *= a[i] if result > 10**18: print(-1) flg = False break if flg: print(result)
#B n = int(input()) a = list(map(int,input().split())) flg = True a.sort() if a[0] == 0: print(0) else: result = a[0] for i in range(1,n): result *= a[i] if result > 10**18: print(-1) flg = False break if flg: print(result)
[["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
91
import numpy as np n = int(input()) a = list(map(int, input().split())) b = np.array(a) temp = 1 if a.count(0) >0: print(0) exit() for i in range(n): temp = b[i] * temp if temp > 10**18 or temp < 0: print('-1') exit() print(temp)
import numpy as np from decimal import * n = int(input()) a = list(map(Decimal, input().split())) b = np.array(a) temp = 1 if a.count(0) >0: print(0) exit() for i in range(n): temp = b[i] * temp if temp > 10**18 or temp < 0: print('-1') exit() print(temp)
[["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 314], ["+", 36, 36, 0, 656, 0, 686, 687, 673, 0, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 487], ["+", 36, 36, 0, 656, 0, 686, 0, 690, 0, 48], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22]]
5
97
#include <bits/stdc++.h> #include <cmath> using namespace std; #define _GLIBCXX_DEBUG #define ll long long #define rep(i, n) for (ll i = 0; i < n; i++) #define vl vector<ll> #define vpl vector<pair<ll, ll>> #define vvl vector<vector<ll>> // a(縦行,vector<ll>(横列)); #include <algorithm> //__gcd(a,b) #include <cst...
#include <bits/stdc++.h> #include <cmath> using namespace std; #define _GLIBCXX_DEBUG #define ll long long #define rep(i, n) for (ll i = 0; i < n; i++) #define vl vector<ll> #define vpl vector<pair<ll, ll>> #define vvl vector<vector<ll>> // a(縦行,vector<ll>(横列)); #include <algorithm> //__gcd(a,b) #include <cst...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
260
#include <bits/stdc++.h> using namespace std; signed main() { int N; cin >> N; vector<long long> A(N); for (int i = 0; i < N; i++) cin >> A[i]; for (int i = 0; i < N; i++) { if (A[i] == 0) { puts("0"); return 0; } } long long ans = 1; for (int i = 0; i < N; i++) { if (ans...
#include <bits/stdc++.h> using namespace std; signed main() { int N; cin >> N; vector<long long> A(N); for (int i = 0; i < N; i++) cin >> A[i]; for (int i = 0; i < N; i++) { if (A[i] == 0) { puts("0"); return 0; } } long long ans = 1; for (int i = 0; i < N; i++) { if (ans...
[["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 24], ["+", 12, 16, 31, 74, 39, 77, 39, 86, 0, 96], ["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 25]]
1
145
n=int(input()) a=list(map(int,input().split())) ans=1 if 0 in a: print(0) exit() for i in a: ans*=i if ans > (10**18): ans=-1 print(ans)
n=int(input()) a=list(map(int,input().split())) ans=1 if 0 in a: print(0) exit() for i in a: ans*=i if ans > (10**18): print(-1) exit() print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 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
65
#include <iostream> using namespace std; int nanzyo(long long a) { int i = 0; while ((a /= 10) != 0) i++; return i; } int main(void) { int N; long long A[100000]; long long x = 1; cin >> N; for (int i = 0; i < N; i++) { cin >> A[i]; if (A[i] == 0) { cout << 0 << endl; ret...
#include <iostream> using namespace std; int nanzyo(long long a) { int i = 0; while ((a /= 10) != 0) i++; return i; } int main(void) { int N; long long A[100000]; long long x = 1; cin >> N; for (int i = 0; i < N; i++) { cin >> A[i]; if (A[i] == 0) { cout << 0 << endl; ret...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19]]
1
206
n = int(input()) s = list(map(int,input().split())) if 0 in s: print(0) exit() for _ in range(n): ans *= s[_] if ans > 10**18: print(-1) exit() else: print(ans)
n = int(input()) s = list(map(int,input().split())) ans = 1 if 0 in s: print(0) exit() for _ in range(n): ans *= s[_] if ans > 10**18: print(-1) exit() else: print(ans)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
72
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using lint = long long; const lint MAX = 1e18; int main(void) { int N; cin >> N; lint ans = 1; int over = 0; int zero = 0; for (int i = 0; i < N; i++) { long long x; cin >> x; if (x == 0) { ze...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using lint = long long; const lint MAX = 1e18; int main(void) { int N; cin >> N; lint ans = 1; int over = 0; int zero = 0; for (int i = 0; i < N; i++) { long long x; cin >> x; if (x == 0) { ze...
[["+", 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], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98]]
1
143
#include <limits.h> #include <stdio.h> int main() { int i; int n; unsigned long long int a = 1, b[1000000]; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%lld", &b[i]); } for (i = 0; i < n; i++) { if (b[i] == 0) { printf("0"); return 0; } } for (i = 0; i < n; i++) { ...
#include <limits.h> #include <stdio.h> int main() { int i; int n; unsigned long long int a = 1, b[1000000]; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%lld", &b[i]); } for (i = 0; i < n; i++) { if (b[i] == 0) { printf("0"); return 0; } } for (i = 0; i < n; i++) { ...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19]]
0
163
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, n) for (int i = 0; i < (int)(n); i++) int main() { int N; cin >> N; ll ans = 1; REP(i, N) { ll a; cin >> a; if (a == 0) { cout << 0; break; } if (ans > ll(2e18) / a) { ans = 2e18; } el...
// https://atcoder.jp/contests/abc169/tasks/abc169_b #include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, n) for (int i = 0; i < (int)(n); i++) int main() { int N; cin >> N; ll ans = 1; REP(i, N) { ll a; cin >> a; if (a == 0) { cout << 0; return 0; } ...
[["-", 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], ["-", 51, 16, 12, 16, 31, 2, 3, 4, 0, 13], ["+", 51, 16, 12, 16, 31, 2, 3, 4, 0, 13]]
1
110
n = int(input()) A = [int(i) for i in input().split()] if 0 in A: print(0) exit() ans = 1 for i in A: if ans > 10**18 / i: print(-1) exit() else: ans *= i print(ans)
n = int(input()) A = [int(i) for i in input().split()] if 0 in A: print(0) exit() ans = 1 for i in A: if ans > 10**18 // i: print(-1) exit() else: ans *= i print(ans)
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 85], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 676]]
5
72
#include <bits/stdc++.h> using namespace std; typedef long long int ll; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int main() { ll t; cin >> t; ll b; vector<ll> an(t); unsigned long long int ans = 1; int flag = 1; for (ll i = 0; i < t; i++) { ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int main() { ll t; cin >> t; ll b; vector<ll> an(t); unsigned long long int ans = 1; int flag = 1; for (ll i = 0; i < t; 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, 64, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94]]
1
212
#include <algorithm> #include <bitset> #include <cctype> #include <cstdlib> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define reps(i, s, n) for (int i = s; i < (int)(n); i++) #define out(x...
#include <algorithm> #include <bitset> #include <cctype> #include <cstdlib> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define reps(i, s, n) for (int i = s; i < (int)(n); i++) #define out(x...
[["-", 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
258
#include <bits/stdc++.h> #define ll 1000000000000000000 using namespace std; int main(void) { int n; unsigned long long int ans = 1; cin >> n; unsigned long long int a[n]; int b = 0; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) b = 1; } if (b == 1) { cout << 0 << endl; ...
#include <bits/stdc++.h> #define ll 1000000000000000000 using namespace std; int main(void) { int n; unsigned long long int ans = 1; cin >> n; unsigned long long int a[n]; int b = 0; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) b = 1; } if (b == 1) { cout << 0 << endl; ...
[["-", 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
152
# coding: utf-8 # Your code here! def main(): N = int(input()) A = list(map(int,input().split())) if 0 in A: print(0) return ans = 1 for i in range(N): ans *= A[0] if ans > 1000000000000000000: print(-1) return print(ans...
# coding: utf-8 # Your code here! def main(): N = int(input()) A = list(map(int,input().split())) if 0 in A: print(0) return ans = 1 for i in range(N): ans *= A[i] if ans > 1000000000000000000: print(-1) return print(ans...
[["-", 8, 196, 0, 1, 0, 677, 12, 206, 206, 612], ["+", 8, 196, 0, 1, 0, 677, 12, 206, 206, 22]]
5
77
def f(n, a): if 0 in a: return 0 p = 1 for x in a: p *= x if p > 10**18: return -1 return p n = int(input()) a = list(int, input().split()) print(f(n, a))
def f(n, a): if 0 in a: return 0 p = 1 for x in a: p *= x if p > 10**18: return -1 return p n = int(input()) a = list(map(int, input().split())) print(f(n, a))
[["+", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
69
#include <bits/stdc++.h> #define LIMIT_M 1000000000000000000 // 10^18 using namespace std; static const long long LIMIT = 1000000000000000000; // 10^18 int main() { long long res = 1, A[100005]; int N; cin >> N; for (int i = 0; i < N; i++) { cin >> A[i]; if (A[i] == 0) { cout << 0 << endl; ...
#include <bits/stdc++.h> #define LIMIT_M 1000000000000000000 // 10^18 using namespace std; static const long long LIMIT = 1000000000000000000; // 10^18 int main() { long long res = 1, A[100005]; int N; cin >> N; for (int i = 0; i < N; i++) { cin >> A[i]; if (A[i] == 0) { cout << 0 << endl; ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13]]
1
139
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(void) { int n, i; cin >> n; vector<ll> T(n); for (i = 0; i < n; i++) { cin >> T[i]; } for (i = 0; i < n; i++) { if (T[i] == 0LL) { cout << 0 << endl; return 0; } } ll a = 1LL, MAX = 10000000000000...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(void) { int n, i; cin >> n; vector<ll> T(n); for (i = 0; i < n; i++) cin >> T[i]; for (i = 0; i < n; i++) { if (T[i] == 0LL) { cout << 0 << endl; return 0; } } ll a = 1LL, MAX = 1000000000000000000L...
[["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 45], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
153
<?php $n = intval(trim(fgets(STDIN))); $input=explode(' ',trim(fgets(STDIN))); $res = 1; foreach($input as $num){ $res = $res * intval($num); } if(in_array("0", $input)){ echo "0"; } elseif($num > 10**18) { echo "-1"; } else { echo $res; }
<?php $n = intval(trim(fgets(STDIN))); $input=explode(' ',trim(fgets(STDIN))); $res = 1; foreach($input as $num){ $res = $res * intval($num); } if(in_array("0", $input)){ echo "0"; } elseif($res > 10**18) { echo "-1"; } else { echo $res; }
[["-", 75, 625, 15, 23, 0, 16, 31, 606, 0, 141], ["+", 75, 625, 15, 23, 0, 16, 31, 606, 0, 141]]
6
102