node_ids
listlengths 4
1.4k
| edge_index
listlengths 1
2.22k
| text
listlengths 4
1.4k
| source
stringlengths 14
427k
|
---|---|---|---|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
41,
13,
20,
41,
13,
41,
13,
41,
13,
20,
17,
17,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
0,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
13,
17,
14,
13,
30,
4,
18,
13,
17,
30,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
13,
13,
30,
0,
13,
18,
13,
13,
30,
0,
13,
17,
4,
18,
13,
8,
13,
17,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
29,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
237,
11
],
[
237,
12
],
[
12,
13
],
[
12,
14
],
[
237,
15
],
[
15,
16
],
[
15,
17
],
[
237,
18
],
[
18,
19
],
[
237,
20
],
[
20,
21
],
[
237,
22
],
[
22,
23
],
[
22,
24
],
[
237,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
29,
35
],
[
35,
36
],
[
35,
37
],
[
29,
39
],
[
39,
40
],
[
39,
41
],
[
29,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
42,
47
],
[
47,
48
],
[
47,
49
],
[
42,
50
],
[
50,
51
],
[
51,
52
],
[
42,
53
],
[
54,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
55,
59
],
[
59,
60
],
[
60,
61
],
[
54,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
62,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
29,
72
],
[
72,
73
],
[
72,
74
],
[
29,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
75,
80
],
[
80,
81
],
[
80,
82
],
[
75,
83
],
[
83,
84
],
[
84,
85
],
[
75,
86
],
[
87,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
29,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
94,
97
],
[
91,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
98,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
110,
111
],
[
110,
112
],
[
105,
113
],
[
113,
114
],
[
114,
115
],
[
105,
116
],
[
117,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
123,
124
],
[
123,
125
],
[
118,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
118,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
98,
136
],
[
136,
137
],
[
137,
138
],
[
136,
139
],
[
139,
140
],
[
139,
141
],
[
139,
142
],
[
29,
143
],
[
143,
144
],
[
144,
145
],
[
27,
146
],
[
146,
147
],
[
237,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
148,
152
],
[
152,
153
],
[
148,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
148,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
164,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
163,
172
],
[
172,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
173,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
162,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
148,
188
],
[
188,
189
],
[
188,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
192,
195
],
[
195,
196
],
[
148,
197
],
[
197,
198
],
[
197,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
201,
204
],
[
204,
205
],
[
148,
206
],
[
206,
207
],
[
206,
208
],
[
208,
209
],
[
209,
210
],
[
210,
211
],
[
211,
212
],
[
210,
213
],
[
213,
214
],
[
148,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
218,
219
],
[
218,
220
],
[
217,
221
],
[
221,
222
],
[
222,
223
],
[
222,
224
],
[
224,
225
],
[
225,
226
],
[
226,
227
],
[
221,
228
],
[
228,
229
],
[
229,
230
],
[
229,
231
],
[
231,
232
],
[
232,
233
],
[
217,
234
],
[
234,
235
],
[
0,
236
],
[
236,
237
],
[
236,
238
]
] |
[
"import java.io.*;\nimport java.math.*;\nimport java.util.*;\n\n\n\npublic class Main {\n\n static MyScanner ob = new MyScanner();\n static PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));\n static int N ;\n static int [] A;\n static char[][] arr = new char[100][1000];\n public static void main(String args[]) throws IOException {\n int N = ob.nextInt();\n long [] arr = new long[N];\n boolean zero = false;\n for(int i=0;i<N;i++){\n arr[i] = ob.nextLong();\n if(arr[i]==0){\n zero = true;\n }\n }\n long max = 10;\n for(int i=0;i<17;i++){\n max*=10;\n }\n if(zero){\n pw.println(0);\n }else{\n boolean overflow = false;\n long prod = 1;\n for(int i=0;i<N;i++){\n if(arr[i]<=max/prod){\n prod*=arr[i];\n }else{\n overflow = true;\n }\n }\n pw.println(overflow?\"-1\":prod);\n } \n \n pw.flush();\n }\n\n\n public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n \n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n \n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n \n int nextInt() {\n return Integer.parseInt(next());\n }\n \n long nextLong() {\n return Long.parseLong(next());\n }\n \n double nextDouble() {\n return Double.parseDouble(next());\n }\n \n String nextLine(){\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n \n }\n}",
"import java.io.*;",
"io.*",
"java",
"import java.math.*;",
"math.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n static MyScanner ob = new MyScanner();\n static PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));\n static int N ;\n static int [] A;\n static char[][] arr = new char[100][1000];\n public static void main(String args[]) throws IOException {\n int N = ob.nextInt();\n long [] arr = new long[N];\n boolean zero = false;\n for(int i=0;i<N;i++){\n arr[i] = ob.nextLong();\n if(arr[i]==0){\n zero = true;\n }\n }\n long max = 10;\n for(int i=0;i<17;i++){\n max*=10;\n }\n if(zero){\n pw.println(0);\n }else{\n boolean overflow = false;\n long prod = 1;\n for(int i=0;i<N;i++){\n if(arr[i]<=max/prod){\n prod*=arr[i];\n }else{\n overflow = true;\n }\n }\n pw.println(overflow?\"-1\":prod);\n } \n \n pw.flush();\n }\n\n\n public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n \n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n \n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n \n int nextInt() {\n return Integer.parseInt(next());\n }\n \n long nextLong() {\n return Long.parseLong(next());\n }\n \n double nextDouble() {\n return Double.parseDouble(next());\n }\n \n String nextLine(){\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n \n }\n}",
"Main",
"static MyScanner ob = new MyScanner();",
"ob",
"new MyScanner()",
"static PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));",
"pw",
"new PrintWriter(new OutputStreamWriter(System.out))",
"static int N ;",
"N",
"static int [] A;",
"A",
"static char[][] arr = new char[100][1000];",
"arr",
"new char[100][1000]",
"100",
"1000",
"public static void main(String args[]) throws IOException {\n int N = ob.nextInt();\n long [] arr = new long[N];\n boolean zero = false;\n for(int i=0;i<N;i++){\n arr[i] = ob.nextLong();\n if(arr[i]==0){\n zero = true;\n }\n }\n long max = 10;\n for(int i=0;i<17;i++){\n max*=10;\n }\n if(zero){\n pw.println(0);\n }else{\n boolean overflow = false;\n long prod = 1;\n for(int i=0;i<N;i++){\n if(arr[i]<=max/prod){\n prod*=arr[i];\n }else{\n overflow = true;\n }\n }\n pw.println(overflow?\"-1\":prod);\n } \n \n pw.flush();\n }",
"main",
"{\n int N = ob.nextInt();\n long [] arr = new long[N];\n boolean zero = false;\n for(int i=0;i<N;i++){\n arr[i] = ob.nextLong();\n if(arr[i]==0){\n zero = true;\n }\n }\n long max = 10;\n for(int i=0;i<17;i++){\n max*=10;\n }\n if(zero){\n pw.println(0);\n }else{\n boolean overflow = false;\n long prod = 1;\n for(int i=0;i<N;i++){\n if(arr[i]<=max/prod){\n prod*=arr[i];\n }else{\n overflow = true;\n }\n }\n pw.println(overflow?\"-1\":prod);\n } \n \n pw.flush();\n }",
"int N = ob.nextInt();",
"N",
"ob.nextInt()",
"ob.nextInt",
"ob",
"long [] arr = new long[N];",
"arr",
"new long[N]",
"N",
"boolean zero = false;",
"zero",
"false",
"for(int i=0;i<N;i++){\n arr[i] = ob.nextLong();\n if(arr[i]==0){\n zero = true;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n arr[i] = ob.nextLong();\n if(arr[i]==0){\n zero = true;\n }\n }",
"{\n arr[i] = ob.nextLong();\n if(arr[i]==0){\n zero = true;\n }\n }",
"arr[i] = ob.nextLong()",
"arr[i]",
"arr",
"i",
"ob.nextLong()",
"ob.nextLong",
"ob",
"if(arr[i]==0){\n zero = true;\n }",
"arr[i]==0",
"arr[i]",
"arr",
"i",
"0",
"{\n zero = true;\n }",
"zero = true",
"zero",
"true",
"long max = 10;",
"max",
"10",
"for(int i=0;i<17;i++){\n max*=10;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<17",
"i",
"17",
"i++",
"i++",
"i",
"{\n max*=10;\n }",
"{\n max*=10;\n }",
"max*=10",
"max",
"10",
"if(zero){\n pw.println(0);\n }else{\n boolean overflow = false;\n long prod = 1;\n for(int i=0;i<N;i++){\n if(arr[i]<=max/prod){\n prod*=arr[i];\n }else{\n overflow = true;\n }\n }\n pw.println(overflow?\"-1\":prod);\n }",
"zero",
"{\n pw.println(0);\n }",
"pw.println(0)",
"pw.println",
"pw",
"0",
"{\n boolean overflow = false;\n long prod = 1;\n for(int i=0;i<N;i++){\n if(arr[i]<=max/prod){\n prod*=arr[i];\n }else{\n overflow = true;\n }\n }\n pw.println(overflow?\"-1\":prod);\n }",
"boolean overflow = false;",
"overflow",
"false",
"long prod = 1;",
"prod",
"1",
"for(int i=0;i<N;i++){\n if(arr[i]<=max/prod){\n prod*=arr[i];\n }else{\n overflow = true;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if(arr[i]<=max/prod){\n prod*=arr[i];\n }else{\n overflow = true;\n }\n }",
"{\n if(arr[i]<=max/prod){\n prod*=arr[i];\n }else{\n overflow = true;\n }\n }",
"if(arr[i]<=max/prod){\n prod*=arr[i];\n }else{\n overflow = true;\n }",
"arr[i]<=max/prod",
"arr[i]",
"arr",
"i",
"max/prod",
"max",
"prod",
"{\n prod*=arr[i];\n }",
"prod*=arr[i]",
"prod",
"arr[i]",
"arr",
"i",
"{\n overflow = true;\n }",
"overflow = true",
"overflow",
"true",
"pw.println(overflow?\"-1\":prod)",
"pw.println",
"pw",
"overflow?\"-1\":prod",
"overflow",
"\"-1\"",
"prod",
"pw.flush()",
"pw.flush",
"pw",
"String args[]",
"args",
"public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n \n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n \n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n \n int nextInt() {\n return Integer.parseInt(next());\n }\n \n long nextLong() {\n return Long.parseLong(next());\n }\n \n double nextDouble() {\n return Double.parseDouble(next());\n }\n \n String nextLine(){\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n \n }",
"MyScanner",
"BufferedReader br;",
"br",
"StringTokenizer st;",
"st",
"public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }",
"MyScanner",
"{\n br = new BufferedReader(new InputStreamReader(System.in));\n }",
"br = new BufferedReader(new InputStreamReader(System.in))",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }",
"next",
"{\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }",
"while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }",
"st == null || !st.hasMoreElements()",
"st == null",
"st",
"null",
"!st.hasMoreElements()",
"st.hasMoreElements()",
"st.hasMoreElements",
"st",
"{\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }",
"try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }",
"catch (IOException e) {\n e.printStackTrace();\n }",
"IOException e",
"{\n e.printStackTrace();\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n st = new StringTokenizer(br.readLine());\n }",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"int nextInt() {\n return Integer.parseInt(next());\n }",
"nextInt",
"{\n return Integer.parseInt(next());\n }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"long nextLong() {\n return Long.parseLong(next());\n }",
"nextLong",
"{\n return Long.parseLong(next());\n }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"double nextDouble() {\n return Double.parseDouble(next());\n }",
"nextDouble",
"{\n return Double.parseDouble(next());\n }",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"String nextLine(){\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }",
"nextLine",
"{\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }",
"String str = \"\";",
"str",
"\"\"",
"try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }",
"catch (IOException e) {\n e.printStackTrace();\n }",
"IOException e",
"{\n e.printStackTrace();\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n str = br.readLine();\n }",
"str = br.readLine()",
"str",
"br.readLine()",
"br.readLine",
"br",
"return str;",
"str",
"public class Main {\n\n static MyScanner ob = new MyScanner();\n static PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));\n static int N ;\n static int [] A;\n static char[][] arr = new char[100][1000];\n public static void main(String args[]) throws IOException {\n int N = ob.nextInt();\n long [] arr = new long[N];\n boolean zero = false;\n for(int i=0;i<N;i++){\n arr[i] = ob.nextLong();\n if(arr[i]==0){\n zero = true;\n }\n }\n long max = 10;\n for(int i=0;i<17;i++){\n max*=10;\n }\n if(zero){\n pw.println(0);\n }else{\n boolean overflow = false;\n long prod = 1;\n for(int i=0;i<N;i++){\n if(arr[i]<=max/prod){\n prod*=arr[i];\n }else{\n overflow = true;\n }\n }\n pw.println(overflow?\"-1\":prod);\n } \n \n pw.flush();\n }\n\n\n public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n \n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n \n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n \n int nextInt() {\n return Integer.parseInt(next());\n }\n \n long nextLong() {\n return Long.parseLong(next());\n }\n \n double nextDouble() {\n return Double.parseDouble(next());\n }\n \n String nextLine(){\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n \n }\n}",
"public class Main {\n\n static MyScanner ob = new MyScanner();\n static PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));\n static int N ;\n static int [] A;\n static char[][] arr = new char[100][1000];\n public static void main(String args[]) throws IOException {\n int N = ob.nextInt();\n long [] arr = new long[N];\n boolean zero = false;\n for(int i=0;i<N;i++){\n arr[i] = ob.nextLong();\n if(arr[i]==0){\n zero = true;\n }\n }\n long max = 10;\n for(int i=0;i<17;i++){\n max*=10;\n }\n if(zero){\n pw.println(0);\n }else{\n boolean overflow = false;\n long prod = 1;\n for(int i=0;i<N;i++){\n if(arr[i]<=max/prod){\n prod*=arr[i];\n }else{\n overflow = true;\n }\n }\n pw.println(overflow?\"-1\":prod);\n } \n \n pw.flush();\n }\n\n\n public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n \n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n \n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n \n int nextInt() {\n return Integer.parseInt(next());\n }\n \n long nextLong() {\n return Long.parseLong(next());\n }\n \n double nextDouble() {\n return Double.parseDouble(next());\n }\n \n String nextLine(){\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n \n }\n}",
"Main"
] |
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
static MyScanner ob = new MyScanner();
static PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
static int N ;
static int [] A;
static char[][] arr = new char[100][1000];
public static void main(String args[]) throws IOException {
int N = ob.nextInt();
long [] arr = new long[N];
boolean zero = false;
for(int i=0;i<N;i++){
arr[i] = ob.nextLong();
if(arr[i]==0){
zero = true;
}
}
long max = 10;
for(int i=0;i<17;i++){
max*=10;
}
if(zero){
pw.println(0);
}else{
boolean overflow = false;
long prod = 1;
for(int i=0;i<N;i++){
if(arr[i]<=max/prod){
prod*=arr[i];
}else{
overflow = true;
}
}
pw.println(overflow?"-1":prod);
}
pw.flush();
}
public static class MyScanner {
BufferedReader br;
StringTokenizer st;
public MyScanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine(){
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
20,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
4,
18,
18,
13,
13,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
29,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
115,
8
],
[
115,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
24,
26
],
[
11,
27
],
[
27,
28
],
[
27,
29
],
[
11,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
30,
41
],
[
42,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
47,
48
],
[
48,
49
],
[
42,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
51,
60
],
[
50,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
62,
67
],
[
61,
68
],
[
11,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
74,
75
],
[
74,
76
],
[
69,
77
],
[
77,
78
],
[
78,
79
],
[
69,
80
],
[
81,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
85,
86
],
[
84,
87
],
[
87,
88
],
[
87,
89
],
[
81,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
92,
95
],
[
91,
96
],
[
90,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
98,
103
],
[
103,
104
],
[
97,
105
],
[
11,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
9,
112
],
[
112,
113
],
[
0,
114
],
[
114,
115
],
[
114,
116
]
] |
[
"import java.math.BigDecimal;\nimport java.util.Scanner;\n \npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n BigDecimal[] a = new BigDecimal[n];\n \n BigDecimal result = new BigDecimal(1);\n BigDecimal max = new BigDecimal(1000000000000000000L);\n for(int i=0; i < n; i++){\n a[i] = sc.nextBigDecimal();\n if(a[i].compareTo(BigDecimal.ZERO) == 0) {\n System.out.println(0);\n return;\n }\n }\n \n for(int i=0; i < n; i++){\n result = result.multiply(a[i]);\n if(result.compareTo(max) > 0){\n System.out.println(-1);\n return;\n }\n }\n \n System.out.println(result);\n }\n}",
"import java.math.BigDecimal;",
"BigDecimal",
"java.math",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n BigDecimal[] a = new BigDecimal[n];\n \n BigDecimal result = new BigDecimal(1);\n BigDecimal max = new BigDecimal(1000000000000000000L);\n for(int i=0; i < n; i++){\n a[i] = sc.nextBigDecimal();\n if(a[i].compareTo(BigDecimal.ZERO) == 0) {\n System.out.println(0);\n return;\n }\n }\n \n for(int i=0; i < n; i++){\n result = result.multiply(a[i]);\n if(result.compareTo(max) > 0){\n System.out.println(-1);\n return;\n }\n }\n \n System.out.println(result);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n BigDecimal[] a = new BigDecimal[n];\n \n BigDecimal result = new BigDecimal(1);\n BigDecimal max = new BigDecimal(1000000000000000000L);\n for(int i=0; i < n; i++){\n a[i] = sc.nextBigDecimal();\n if(a[i].compareTo(BigDecimal.ZERO) == 0) {\n System.out.println(0);\n return;\n }\n }\n \n for(int i=0; i < n; i++){\n result = result.multiply(a[i]);\n if(result.compareTo(max) > 0){\n System.out.println(-1);\n return;\n }\n }\n \n System.out.println(result);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n BigDecimal[] a = new BigDecimal[n];\n \n BigDecimal result = new BigDecimal(1);\n BigDecimal max = new BigDecimal(1000000000000000000L);\n for(int i=0; i < n; i++){\n a[i] = sc.nextBigDecimal();\n if(a[i].compareTo(BigDecimal.ZERO) == 0) {\n System.out.println(0);\n return;\n }\n }\n \n for(int i=0; i < n; i++){\n result = result.multiply(a[i]);\n if(result.compareTo(max) > 0){\n System.out.println(-1);\n return;\n }\n }\n \n System.out.println(result);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BigDecimal[] a = new BigDecimal[n];",
"a",
"new BigDecimal[n]",
"n",
"BigDecimal result = new BigDecimal(1);",
"result",
"new BigDecimal(1)",
"BigDecimal max = new BigDecimal(1000000000000000000L);",
"max",
"new BigDecimal(1000000000000000000L)",
"for(int i=0; i < n; i++){\n a[i] = sc.nextBigDecimal();\n if(a[i].compareTo(BigDecimal.ZERO) == 0) {\n System.out.println(0);\n return;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = sc.nextBigDecimal();\n if(a[i].compareTo(BigDecimal.ZERO) == 0) {\n System.out.println(0);\n return;\n }\n }",
"{\n a[i] = sc.nextBigDecimal();\n if(a[i].compareTo(BigDecimal.ZERO) == 0) {\n System.out.println(0);\n return;\n }\n }",
"a[i] = sc.nextBigDecimal()",
"a[i]",
"a",
"i",
"sc.nextBigDecimal()",
"sc.nextBigDecimal",
"sc",
"if(a[i].compareTo(BigDecimal.ZERO) == 0) {\n System.out.println(0);\n return;\n }",
"a[i].compareTo(BigDecimal.ZERO) == 0",
"a[i].compareTo(BigDecimal.ZERO)",
"a[i].compareTo",
"a[i]",
"a",
"i",
"BigDecimal.ZERO",
"BigDecimal",
"BigDecimal.ZERO",
"0",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"for(int i=0; i < n; i++){\n result = result.multiply(a[i]);\n if(result.compareTo(max) > 0){\n System.out.println(-1);\n return;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n result = result.multiply(a[i]);\n if(result.compareTo(max) > 0){\n System.out.println(-1);\n return;\n }\n }",
"{\n result = result.multiply(a[i]);\n if(result.compareTo(max) > 0){\n System.out.println(-1);\n return;\n }\n }",
"result = result.multiply(a[i])",
"result",
"result.multiply(a[i])",
"result.multiply",
"result",
"a[i]",
"a",
"i",
"if(result.compareTo(max) > 0){\n System.out.println(-1);\n return;\n }",
"result.compareTo(max) > 0",
"result.compareTo(max)",
"result.compareTo",
"result",
"max",
"0",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n BigDecimal[] a = new BigDecimal[n];\n \n BigDecimal result = new BigDecimal(1);\n BigDecimal max = new BigDecimal(1000000000000000000L);\n for(int i=0; i < n; i++){\n a[i] = sc.nextBigDecimal();\n if(a[i].compareTo(BigDecimal.ZERO) == 0) {\n System.out.println(0);\n return;\n }\n }\n \n for(int i=0; i < n; i++){\n result = result.multiply(a[i]);\n if(result.compareTo(max) > 0){\n System.out.println(-1);\n return;\n }\n }\n \n System.out.println(result);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n BigDecimal[] a = new BigDecimal[n];\n \n BigDecimal result = new BigDecimal(1);\n BigDecimal max = new BigDecimal(1000000000000000000L);\n for(int i=0; i < n; i++){\n a[i] = sc.nextBigDecimal();\n if(a[i].compareTo(BigDecimal.ZERO) == 0) {\n System.out.println(0);\n return;\n }\n }\n \n for(int i=0; i < n; i++){\n result = result.multiply(a[i]);\n if(result.compareTo(max) > 0){\n System.out.println(-1);\n return;\n }\n }\n \n System.out.println(result);\n }\n}",
"Main"
] |
import java.math.BigDecimal;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
BigDecimal[] a = new BigDecimal[n];
BigDecimal result = new BigDecimal(1);
BigDecimal max = new BigDecimal(1000000000000000000L);
for(int i=0; i < n; i++){
a[i] = sc.nextBigDecimal();
if(a[i].compareTo(BigDecimal.ZERO) == 0) {
System.out.println(0);
return;
}
}
for(int i=0; i < n; i++){
result = result.multiply(a[i]);
if(result.compareTo(max) > 0){
System.out.println(-1);
return;
}
}
System.out.println(result);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
4,
18,
13,
13,
14,
2,
18,
13,
17,
17,
30,
4,
18,
18,
13,
13,
17,
29,
41,
13,
17,
28,
13,
13,
30,
30,
14,
2,
2,
13,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
30,
0,
13,
13,
4,
18,
18,
13,
13,
13,
29,
23,
13,
6,
13,
41,
13,
2,
17,
17,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
0,
13,
20,
13,
0,
13,
0,
13,
17,
12,
13,
30,
0,
13,
20,
0,
13,
20,
13,
0,
13,
0,
13,
17,
23,
13,
12,
13,
30,
14,
2,
13,
13,
4,
13,
29,
18,
13,
40,
13,
12,
13,
30,
14,
2,
13,
17,
29,
4,
18,
13,
12,
13,
30,
0,
13,
4,
18,
13,
13,
0,
13,
17,
13,
14,
2,
13,
40,
17,
0,
18,
13,
17,
40,
17,
12,
13,
30,
41,
13,
4,
13,
42,
4,
18,
13,
13,
30,
0,
13,
4,
13,
29,
13,
12,
13,
30,
41,
13,
4,
13,
42,
4,
18,
13,
13,
30,
0,
13,
4,
13,
41,
13,
20,
4,
18,
13,
13,
0,
13,
4,
13,
42,
40,
4,
18,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
12,
13,
30,
41,
13,
17,
41,
13,
4,
13,
42,
2,
13,
17,
0,
13,
4,
13,
41,
13,
2,
13,
17,
14,
13,
0,
13,
4,
13,
42,
2,
2,
0,
13,
4,
13,
17,
2,
13,
17,
30,
0,
13,
2,
2,
2,
13,
17,
13,
17,
14,
13,
29,
40,
13,
29,
13,
12,
13,
30,
41,
13,
17,
41,
13,
4,
13,
42,
2,
13,
17,
0,
13,
4,
13,
41,
13,
2,
13,
17,
14,
13,
0,
13,
4,
13,
42,
2,
2,
0,
13,
4,
13,
17,
2,
13,
17,
30,
0,
13,
2,
2,
2,
13,
17,
13,
17,
14,
13,
29,
40,
13,
29,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
41,
13,
4,
13,
42,
2,
13,
17,
0,
13,
4,
13,
41,
13,
2,
13,
17,
14,
13,
0,
13,
4,
13,
42,
2,
2,
0,
13,
4,
13,
17,
2,
13,
17,
30,
0,
13,
2,
2,
2,
13,
17,
13,
17,
14,
2,
13,
17,
30,
42,
2,
2,
0,
13,
4,
13,
17,
2,
13,
17,
30,
0,
13,
2,
2,
13,
17,
0,
13,
17,
14,
13,
29,
40,
13,
29,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
535,
8
],
[
535,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
11,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
25,
28
],
[
11,
29
],
[
29,
30
],
[
30,
31
],
[
29,
32
],
[
11,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
33,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
40,
45
],
[
39,
46
],
[
11,
47
],
[
47,
48
],
[
47,
49
],
[
11,
50
],
[
50,
51
],
[
50,
52
],
[
50,
53
],
[
54,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
55,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
62,
67
],
[
67,
68
],
[
61,
69
],
[
55,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
11,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
11,
80
],
[
9,
81
],
[
81,
82
],
[
535,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
83,
90
],
[
90,
91
],
[
83,
92
],
[
92,
93
],
[
83,
94
],
[
94,
95
],
[
83,
96
],
[
96,
97
],
[
83,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
104,
105
],
[
104,
106
],
[
100,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
83,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
119,
120
],
[
119,
121
],
[
115,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
125,
127
],
[
113,
128
],
[
128,
129
],
[
83,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
137,
138
],
[
132,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
83,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
147,
151
],
[
146,
152
],
[
152,
153
],
[
153,
154
],
[
83,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
161,
162
],
[
160,
163
],
[
160,
164
],
[
164,
165
],
[
164,
166
],
[
160,
167
],
[
157,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
171,
172
],
[
168,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
173,
177
],
[
177,
178
],
[
83,
179
],
[
179,
180
],
[
179,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
181,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
187,
190
],
[
186,
191
],
[
191,
192
],
[
192,
193
],
[
192,
194
],
[
194,
195
],
[
181,
196
],
[
196,
197
],
[
83,
198
],
[
198,
199
],
[
198,
200
],
[
200,
201
],
[
201,
202
],
[
201,
203
],
[
203,
204
],
[
200,
205
],
[
205,
206
],
[
206,
207
],
[
207,
208
],
[
206,
209
],
[
205,
210
],
[
210,
211
],
[
211,
212
],
[
211,
213
],
[
213,
214
],
[
200,
215
],
[
215,
216
],
[
215,
217
],
[
200,
218
],
[
218,
219
],
[
219,
220
],
[
218,
221
],
[
200,
222
],
[
222,
223
],
[
222,
224
],
[
224,
225
],
[
200,
226
],
[
226,
227
],
[
227,
228
],
[
228,
229
],
[
229,
230
],
[
228,
231
],
[
226,
232
],
[
232,
233
],
[
233,
234
],
[
234,
235
],
[
233,
236
],
[
232,
237
],
[
237,
238
],
[
237,
239
],
[
239,
240
],
[
200,
241
],
[
241,
242
],
[
242,
243
],
[
243,
244
],
[
83,
245
],
[
245,
246
],
[
245,
247
],
[
247,
248
],
[
248,
249
],
[
248,
250
],
[
247,
251
],
[
251,
252
],
[
251,
253
],
[
253,
254
],
[
247,
255
],
[
255,
256
],
[
256,
257
],
[
256,
258
],
[
255,
259
],
[
259,
260
],
[
259,
261
],
[
261,
262
],
[
247,
263
],
[
263,
264
],
[
263,
265
],
[
265,
266
],
[
265,
267
],
[
247,
268
],
[
268,
269
],
[
268,
270
],
[
270,
271
],
[
270,
272
],
[
272,
273
],
[
247,
274
],
[
274,
275
],
[
275,
276
],
[
276,
277
],
[
277,
278
],
[
277,
279
],
[
279,
280
],
[
276,
281
],
[
275,
282
],
[
282,
283
],
[
282,
284
],
[
274,
285
],
[
285,
286
],
[
286,
287
],
[
286,
288
],
[
288,
289
],
[
289,
290
],
[
290,
291
],
[
290,
292
],
[
289,
293
],
[
288,
294
],
[
247,
295
],
[
295,
296
],
[
295,
297
],
[
297,
298
],
[
298,
299
],
[
247,
300
],
[
300,
301
],
[
83,
302
],
[
302,
303
],
[
302,
304
],
[
304,
305
],
[
305,
306
],
[
305,
307
],
[
304,
308
],
[
308,
309
],
[
308,
310
],
[
310,
311
],
[
304,
312
],
[
312,
313
],
[
313,
314
],
[
313,
315
],
[
312,
316
],
[
316,
317
],
[
316,
318
],
[
318,
319
],
[
304,
320
],
[
320,
321
],
[
320,
322
],
[
322,
323
],
[
322,
324
],
[
304,
325
],
[
325,
326
],
[
325,
327
],
[
327,
328
],
[
327,
329
],
[
329,
330
],
[
304,
331
],
[
331,
332
],
[
332,
333
],
[
333,
334
],
[
334,
335
],
[
334,
336
],
[
336,
337
],
[
333,
338
],
[
332,
339
],
[
339,
340
],
[
339,
341
],
[
331,
342
],
[
342,
343
],
[
343,
344
],
[
343,
345
],
[
345,
346
],
[
346,
347
],
[
347,
348
],
[
347,
349
],
[
346,
350
],
[
345,
351
],
[
304,
352
],
[
352,
353
],
[
352,
354
],
[
354,
355
],
[
355,
356
],
[
304,
357
],
[
357,
358
],
[
83,
359
],
[
359,
360
],
[
359,
361
],
[
361,
362
],
[
362,
363
],
[
362,
364
],
[
361,
365
],
[
365,
366
],
[
365,
367
],
[
361,
368
],
[
368,
369
],
[
368,
370
],
[
370,
371
],
[
361,
372
],
[
372,
373
],
[
373,
374
],
[
373,
375
],
[
372,
376
],
[
376,
377
],
[
376,
378
],
[
378,
379
],
[
361,
380
],
[
380,
381
],
[
380,
382
],
[
382,
383
],
[
382,
384
],
[
361,
385
],
[
385,
386
],
[
385,
387
],
[
387,
388
],
[
387,
389
],
[
389,
390
],
[
361,
391
],
[
391,
392
],
[
392,
393
],
[
393,
394
],
[
394,
395
],
[
394,
396
],
[
396,
397
],
[
393,
398
],
[
392,
399
],
[
399,
400
],
[
399,
401
],
[
391,
402
],
[
402,
403
],
[
403,
404
],
[
403,
405
],
[
405,
406
],
[
406,
407
],
[
407,
408
],
[
407,
409
],
[
406,
410
],
[
405,
411
],
[
361,
412
],
[
412,
413
],
[
413,
414
],
[
413,
415
],
[
412,
416
],
[
416,
417
],
[
417,
418
],
[
418,
419
],
[
419,
420
],
[
420,
421
],
[
420,
422
],
[
422,
423
],
[
419,
424
],
[
418,
425
],
[
425,
426
],
[
425,
427
],
[
417,
428
],
[
428,
429
],
[
429,
430
],
[
429,
431
],
[
431,
432
],
[
432,
433
],
[
432,
434
],
[
431,
435
],
[
435,
436
],
[
435,
437
],
[
361,
438
],
[
438,
439
],
[
438,
440
],
[
440,
441
],
[
441,
442
],
[
361,
443
],
[
443,
444
],
[
83,
445
],
[
445,
446
],
[
445,
447
],
[
447,
448
],
[
448,
449
],
[
448,
450
],
[
447,
452
],
[
452,
453
],
[
453,
454
],
[
454,
455
],
[
454,
456
],
[
452,
457
],
[
457,
458
],
[
457,
459
],
[
452,
460
],
[
460,
461
],
[
461,
462
],
[
452,
463
],
[
464,
464
],
[
464,
465
],
[
465,
466
],
[
466,
467
],
[
466,
468
],
[
465,
469
],
[
469,
470
],
[
447,
471
],
[
471,
472
],
[
445,
473
],
[
473,
474
],
[
83,
475
],
[
475,
476
],
[
475,
477
],
[
477,
478
],
[
478,
479
],
[
478,
480
],
[
477,
482
],
[
482,
483
],
[
483,
484
],
[
484,
485
],
[
484,
486
],
[
482,
487
],
[
487,
488
],
[
487,
489
],
[
482,
490
],
[
490,
491
],
[
491,
492
],
[
482,
493
],
[
494,
494
],
[
494,
495
],
[
495,
496
],
[
496,
497
],
[
496,
498
],
[
495,
499
],
[
499,
500
],
[
477,
501
],
[
501,
502
],
[
475,
503
],
[
503,
504
],
[
83,
505
],
[
505,
506
],
[
505,
507
],
[
507,
508
],
[
508,
509
],
[
508,
510
],
[
507,
512
],
[
512,
513
],
[
513,
514
],
[
514,
515
],
[
514,
516
],
[
512,
517
],
[
517,
518
],
[
517,
519
],
[
512,
520
],
[
520,
521
],
[
521,
522
],
[
512,
523
],
[
523,
524
],
[
524,
525
],
[
525,
526
],
[
525,
527
],
[
524,
528
],
[
528,
529
],
[
507,
530
],
[
530,
531
],
[
505,
532
],
[
532,
533
],
[
0,
534
],
[
534,
535
],
[
534,
536
]
] |
[
"import java.io.*;\n// import java.math.*;\nimport java.util.*;\n// import java.util.Map.*;\n// import java.util.stream.*;\n\npublic class Main {\n public static void main (String[] args) throws IOException {\n final long INF =(long)1e18;\n FastScanner sc = new FastScanner();\n final int N = sc.nextInt();\n long[] A = sc.longArray (N);\n Arrays.sort (A);\n if (A[0] == 0L) {\n System.out.println (0);\n return;\n }\n long ans = 1;\n for (long Ai : A) {\n if (INF / ans < Ai) {\n System.out.println (-1);\n return;\n } else {\n ans *= Ai;\n }\n }\n System.out.println (ans);\n return;\n }\n\n // FastScanner start\n static class FastScanner {\n final private int BUFFER_SIZE = 1 << 16;\n private DataInputStream din;\n private byte[] buffer;\n private int bufferPointer, bytesRead;\n\n public FastScanner() {\n din = new DataInputStream (System.in);\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n public FastScanner (String file_name) throws IOException {\n din = new DataInputStream (new FileInputStream (file_name));\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n private byte read() throws IOException {\n if (bufferPointer == bytesRead)\n fillBuffer();\n return buffer[bufferPointer++];\n }\n\n public void close() throws IOException {\n if (din == null)\n return;\n din.close();\n }\n\n private void fillBuffer() throws IOException {\n bytesRead = din.read (buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1)\n buffer[0] = -1;\n }\n\n public char nextChar() throws IOException {\n byte c = read();\n while (Character.isWhitespace (c)) {\n c = read();\n }\n return (char)c;\n }\n\n public String nextString() throws IOException {\n byte c = read();\n while (Character.isWhitespace (c)) {\n c = read();\n }\n StringBuilder builder = new StringBuilder();\n builder.append ((char)c);\n c = read();\n while (!Character.isWhitespace (c)) {\n builder.append ((char)c);\n c = read();\n }\n return builder.toString();\n }\n\n public int nextInt() throws IOException {\n int ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }\n\n public long nextLong() throws IOException {\n long ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }\n\n public double nextDouble() throws IOException {\n double ret = 0, div = 1;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (c == '.') {\n while ((c = read()) >= '0' && c <= '9') {\n ret += (c - '0') / (div *= 10);\n }\n }\n if (neg)\n return -ret;\n return ret;\n }\n\n public int[] intArray (int n) throws IOException {\n int arr[] = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextInt();\n }\n return arr;\n }\n\n public long[] longArray (int n) throws IOException {\n long arr[] = new long[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextLong();\n }\n return arr;\n }\n\n public double[] doubleArray (int n) throws IOException {\n double arr[] = new double[n];\n for (int i = 0; i < n; i++)\n arr[i] = nextDouble();\n return arr;\n }\n }\n // FastScanner end\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main (String[] args) throws IOException {\n final long INF =(long)1e18;\n FastScanner sc = new FastScanner();\n final int N = sc.nextInt();\n long[] A = sc.longArray (N);\n Arrays.sort (A);\n if (A[0] == 0L) {\n System.out.println (0);\n return;\n }\n long ans = 1;\n for (long Ai : A) {\n if (INF / ans < Ai) {\n System.out.println (-1);\n return;\n } else {\n ans *= Ai;\n }\n }\n System.out.println (ans);\n return;\n }\n\n // FastScanner start\n static class FastScanner {\n final private int BUFFER_SIZE = 1 << 16;\n private DataInputStream din;\n private byte[] buffer;\n private int bufferPointer, bytesRead;\n\n public FastScanner() {\n din = new DataInputStream (System.in);\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n public FastScanner (String file_name) throws IOException {\n din = new DataInputStream (new FileInputStream (file_name));\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n private byte read() throws IOException {\n if (bufferPointer == bytesRead)\n fillBuffer();\n return buffer[bufferPointer++];\n }\n\n public void close() throws IOException {\n if (din == null)\n return;\n din.close();\n }\n\n private void fillBuffer() throws IOException {\n bytesRead = din.read (buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1)\n buffer[0] = -1;\n }\n\n public char nextChar() throws IOException {\n byte c = read();\n while (Character.isWhitespace (c)) {\n c = read();\n }\n return (char)c;\n }\n\n public String nextString() throws IOException {\n byte c = read();\n while (Character.isWhitespace (c)) {\n c = read();\n }\n StringBuilder builder = new StringBuilder();\n builder.append ((char)c);\n c = read();\n while (!Character.isWhitespace (c)) {\n builder.append ((char)c);\n c = read();\n }\n return builder.toString();\n }\n\n public int nextInt() throws IOException {\n int ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }\n\n public long nextLong() throws IOException {\n long ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }\n\n public double nextDouble() throws IOException {\n double ret = 0, div = 1;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (c == '.') {\n while ((c = read()) >= '0' && c <= '9') {\n ret += (c - '0') / (div *= 10);\n }\n }\n if (neg)\n return -ret;\n return ret;\n }\n\n public int[] intArray (int n) throws IOException {\n int arr[] = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextInt();\n }\n return arr;\n }\n\n public long[] longArray (int n) throws IOException {\n long arr[] = new long[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextLong();\n }\n return arr;\n }\n\n public double[] doubleArray (int n) throws IOException {\n double arr[] = new double[n];\n for (int i = 0; i < n; i++)\n arr[i] = nextDouble();\n return arr;\n }\n }\n // FastScanner end\n}",
"Main",
"public static void main (String[] args) throws IOException {\n final long INF =(long)1e18;\n FastScanner sc = new FastScanner();\n final int N = sc.nextInt();\n long[] A = sc.longArray (N);\n Arrays.sort (A);\n if (A[0] == 0L) {\n System.out.println (0);\n return;\n }\n long ans = 1;\n for (long Ai : A) {\n if (INF / ans < Ai) {\n System.out.println (-1);\n return;\n } else {\n ans *= Ai;\n }\n }\n System.out.println (ans);\n return;\n }",
"main",
"{\n final long INF =(long)1e18;\n FastScanner sc = new FastScanner();\n final int N = sc.nextInt();\n long[] A = sc.longArray (N);\n Arrays.sort (A);\n if (A[0] == 0L) {\n System.out.println (0);\n return;\n }\n long ans = 1;\n for (long Ai : A) {\n if (INF / ans < Ai) {\n System.out.println (-1);\n return;\n } else {\n ans *= Ai;\n }\n }\n System.out.println (ans);\n return;\n }",
"final long INF =(long)1e18;",
"INF",
"(long)1e18",
"FastScanner sc = new FastScanner();",
"sc",
"new FastScanner()",
"final int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] A = sc.longArray (N);",
"A",
"sc.longArray (N)",
"sc.longArray",
"sc",
"N",
"Arrays.sort (A)",
"Arrays.sort",
"Arrays",
"A",
"if (A[0] == 0L) {\n System.out.println (0);\n return;\n }",
"A[0] == 0L",
"A[0]",
"A",
"0",
"0L",
"{\n System.out.println (0);\n return;\n }",
"System.out.println (0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"long ans = 1;",
"ans",
"1",
"for (long Ai : A) {\n if (INF / ans < Ai) {\n System.out.println (-1);\n return;\n } else {\n ans *= Ai;\n }\n }",
"long Ai",
"A",
"{\n if (INF / ans < Ai) {\n System.out.println (-1);\n return;\n } else {\n ans *= Ai;\n }\n }",
"{\n if (INF / ans < Ai) {\n System.out.println (-1);\n return;\n } else {\n ans *= Ai;\n }\n }",
"if (INF / ans < Ai) {\n System.out.println (-1);\n return;\n } else {\n ans *= Ai;\n }",
"INF / ans < Ai",
"INF / ans",
"INF",
"ans",
"Ai",
"{\n System.out.println (-1);\n return;\n }",
"System.out.println (-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"{\n ans *= Ai;\n }",
"ans *= Ai",
"ans",
"Ai",
"System.out.println (ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"return;",
"String[] args",
"args",
"static class FastScanner {\n final private int BUFFER_SIZE = 1 << 16;\n private DataInputStream din;\n private byte[] buffer;\n private int bufferPointer, bytesRead;\n\n public FastScanner() {\n din = new DataInputStream (System.in);\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n public FastScanner (String file_name) throws IOException {\n din = new DataInputStream (new FileInputStream (file_name));\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n private byte read() throws IOException {\n if (bufferPointer == bytesRead)\n fillBuffer();\n return buffer[bufferPointer++];\n }\n\n public void close() throws IOException {\n if (din == null)\n return;\n din.close();\n }\n\n private void fillBuffer() throws IOException {\n bytesRead = din.read (buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1)\n buffer[0] = -1;\n }\n\n public char nextChar() throws IOException {\n byte c = read();\n while (Character.isWhitespace (c)) {\n c = read();\n }\n return (char)c;\n }\n\n public String nextString() throws IOException {\n byte c = read();\n while (Character.isWhitespace (c)) {\n c = read();\n }\n StringBuilder builder = new StringBuilder();\n builder.append ((char)c);\n c = read();\n while (!Character.isWhitespace (c)) {\n builder.append ((char)c);\n c = read();\n }\n return builder.toString();\n }\n\n public int nextInt() throws IOException {\n int ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }\n\n public long nextLong() throws IOException {\n long ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }\n\n public double nextDouble() throws IOException {\n double ret = 0, div = 1;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (c == '.') {\n while ((c = read()) >= '0' && c <= '9') {\n ret += (c - '0') / (div *= 10);\n }\n }\n if (neg)\n return -ret;\n return ret;\n }\n\n public int[] intArray (int n) throws IOException {\n int arr[] = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextInt();\n }\n return arr;\n }\n\n public long[] longArray (int n) throws IOException {\n long arr[] = new long[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextLong();\n }\n return arr;\n }\n\n public double[] doubleArray (int n) throws IOException {\n double arr[] = new double[n];\n for (int i = 0; i < n; i++)\n arr[i] = nextDouble();\n return arr;\n }\n }",
"FastScanner",
"final private int BUFFER_SIZE = 1 << 16;",
"BUFFER_SIZE",
"1 << 16",
"1",
"16",
"private DataInputStream din;",
"din",
"private byte[] buffer;",
"buffer",
"private int bufferPointer",
"bufferPointer",
"bytesRead;",
"bytesRead",
"public FastScanner() {\n din = new DataInputStream (System.in);\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }",
"FastScanner",
"{\n din = new DataInputStream (System.in);\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }",
"din = new DataInputStream (System.in)",
"din",
"new DataInputStream (System.in)",
"buffer = new byte[BUFFER_SIZE]",
"buffer",
"new byte[BUFFER_SIZE]",
"BUFFER_SIZE",
"bufferPointer = bytesRead = 0",
"bufferPointer",
"bytesRead = 0",
"bytesRead",
"0",
"public FastScanner (String file_name) throws IOException {\n din = new DataInputStream (new FileInputStream (file_name));\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }",
"FastScanner",
"{\n din = new DataInputStream (new FileInputStream (file_name));\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }",
"din = new DataInputStream (new FileInputStream (file_name))",
"din",
"new DataInputStream (new FileInputStream (file_name))",
"buffer = new byte[BUFFER_SIZE]",
"buffer",
"new byte[BUFFER_SIZE]",
"BUFFER_SIZE",
"bufferPointer = bytesRead = 0",
"bufferPointer",
"bytesRead = 0",
"bytesRead",
"0",
"String file_name",
"file_name",
"private byte read() throws IOException {\n if (bufferPointer == bytesRead)\n fillBuffer();\n return buffer[bufferPointer++];\n }",
"read",
"{\n if (bufferPointer == bytesRead)\n fillBuffer();\n return buffer[bufferPointer++];\n }",
"if (bufferPointer == bytesRead)\n fillBuffer();",
"bufferPointer == bytesRead",
"bufferPointer",
"bytesRead",
"fillBuffer()",
"fillBuffer",
"return buffer[bufferPointer++];",
"buffer[bufferPointer++]",
"buffer",
"bufferPointer++",
"bufferPointer",
"public void close() throws IOException {\n if (din == null)\n return;\n din.close();\n }",
"close",
"{\n if (din == null)\n return;\n din.close();\n }",
"if (din == null)\n return;",
"din == null",
"din",
"null",
"return;",
"din.close()",
"din.close",
"din",
"private void fillBuffer() throws IOException {\n bytesRead = din.read (buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1)\n buffer[0] = -1;\n }",
"fillBuffer",
"{\n bytesRead = din.read (buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1)\n buffer[0] = -1;\n }",
"bytesRead = din.read (buffer, bufferPointer = 0, BUFFER_SIZE)",
"bytesRead",
"din.read (buffer, bufferPointer = 0, BUFFER_SIZE)",
"din.read",
"din",
"buffer",
"bufferPointer = 0",
"bufferPointer",
"0",
"BUFFER_SIZE",
"if (bytesRead == -1)\n buffer[0] = -1;",
"bytesRead == -1",
"bytesRead",
"-1",
"1",
"buffer[0] = -1",
"buffer[0]",
"buffer",
"0",
"-1",
"1",
"public char nextChar() throws IOException {\n byte c = read();\n while (Character.isWhitespace (c)) {\n c = read();\n }\n return (char)c;\n }",
"nextChar",
"{\n byte c = read();\n while (Character.isWhitespace (c)) {\n c = read();\n }\n return (char)c;\n }",
"byte c = read();",
"c",
"read()",
"read",
"while (Character.isWhitespace (c)) {\n c = read();\n }",
"Character.isWhitespace (c)",
"Character.isWhitespace",
"Character",
"c",
"{\n c = read();\n }",
"c = read()",
"c",
"read()",
"read",
"return (char)c;",
"(char)c",
"public String nextString() throws IOException {\n byte c = read();\n while (Character.isWhitespace (c)) {\n c = read();\n }\n StringBuilder builder = new StringBuilder();\n builder.append ((char)c);\n c = read();\n while (!Character.isWhitespace (c)) {\n builder.append ((char)c);\n c = read();\n }\n return builder.toString();\n }",
"nextString",
"{\n byte c = read();\n while (Character.isWhitespace (c)) {\n c = read();\n }\n StringBuilder builder = new StringBuilder();\n builder.append ((char)c);\n c = read();\n while (!Character.isWhitespace (c)) {\n builder.append ((char)c);\n c = read();\n }\n return builder.toString();\n }",
"byte c = read();",
"c",
"read()",
"read",
"while (Character.isWhitespace (c)) {\n c = read();\n }",
"Character.isWhitespace (c)",
"Character.isWhitespace",
"Character",
"c",
"{\n c = read();\n }",
"c = read()",
"c",
"read()",
"read",
"StringBuilder builder = new StringBuilder();",
"builder",
"new StringBuilder()",
"builder.append ((char)c)",
"builder.append",
"builder",
"(char)c",
"c = read()",
"c",
"read()",
"read",
"while (!Character.isWhitespace (c)) {\n builder.append ((char)c);\n c = read();\n }",
"!Character.isWhitespace (c)",
"Character.isWhitespace (c)",
"Character.isWhitespace",
"Character",
"c",
"{\n builder.append ((char)c);\n c = read();\n }",
"builder.append ((char)c)",
"builder.append",
"builder",
"(char)c",
"c = read()",
"c",
"read()",
"read",
"return builder.toString();",
"builder.toString()",
"builder.toString",
"builder",
"public int nextInt() throws IOException {\n int ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }",
"nextInt",
"{\n int ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }",
"int ret = 0;",
"ret",
"0",
"byte c = read();",
"c",
"read()",
"read",
"while (c <= ' ')\n c = read();",
"c <= ' '",
"c",
"' '",
"c = read()",
"c",
"read()",
"read",
"boolean neg = (c == '-');",
"neg",
"(c == '-')",
"c",
"'-'",
"if (neg)\n c = read();",
"neg",
"c = read()",
"c",
"read()",
"read",
"do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');",
"(c = read()) >= '0' && c <= '9'",
"(c = read()) >= '0'",
"(c = read())",
"c",
"read()",
"read",
"'0'",
"c <= '9'",
"c",
"'9'",
"{\n ret = ret * 10 + c - '0';\n }",
"ret = ret * 10 + c - '0'",
"ret",
"ret * 10 + c - '0'",
"ret * 10 + c",
"ret * 10",
"ret",
"10",
"c",
"'0'",
"if (neg)\n return -ret;",
"neg",
"return -ret;",
"-ret",
"ret",
"return ret;",
"ret",
"public long nextLong() throws IOException {\n long ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }",
"nextLong",
"{\n long ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }",
"long ret = 0;",
"ret",
"0",
"byte c = read();",
"c",
"read()",
"read",
"while (c <= ' ')\n c = read();",
"c <= ' '",
"c",
"' '",
"c = read()",
"c",
"read()",
"read",
"boolean neg = (c == '-');",
"neg",
"(c == '-')",
"c",
"'-'",
"if (neg)\n c = read();",
"neg",
"c = read()",
"c",
"read()",
"read",
"do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');",
"(c = read()) >= '0' && c <= '9'",
"(c = read()) >= '0'",
"(c = read())",
"c",
"read()",
"read",
"'0'",
"c <= '9'",
"c",
"'9'",
"{\n ret = ret * 10 + c - '0';\n }",
"ret = ret * 10 + c - '0'",
"ret",
"ret * 10 + c - '0'",
"ret * 10 + c",
"ret * 10",
"ret",
"10",
"c",
"'0'",
"if (neg)\n return -ret;",
"neg",
"return -ret;",
"-ret",
"ret",
"return ret;",
"ret",
"public double nextDouble() throws IOException {\n double ret = 0, div = 1;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (c == '.') {\n while ((c = read()) >= '0' && c <= '9') {\n ret += (c - '0') / (div *= 10);\n }\n }\n if (neg)\n return -ret;\n return ret;\n }",
"nextDouble",
"{\n double ret = 0, div = 1;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (c == '.') {\n while ((c = read()) >= '0' && c <= '9') {\n ret += (c - '0') / (div *= 10);\n }\n }\n if (neg)\n return -ret;\n return ret;\n }",
"double ret = 0",
"ret",
"0",
"div = 1;",
"div",
"1",
"byte c = read();",
"c",
"read()",
"read",
"while (c <= ' ')\n c = read();",
"c <= ' '",
"c",
"' '",
"c = read()",
"c",
"read()",
"read",
"boolean neg = (c == '-');",
"neg",
"(c == '-')",
"c",
"'-'",
"if (neg)\n c = read();",
"neg",
"c = read()",
"c",
"read()",
"read",
"do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');",
"(c = read()) >= '0' && c <= '9'",
"(c = read()) >= '0'",
"(c = read())",
"c",
"read()",
"read",
"'0'",
"c <= '9'",
"c",
"'9'",
"{\n ret = ret * 10 + c - '0';\n }",
"ret = ret * 10 + c - '0'",
"ret",
"ret * 10 + c - '0'",
"ret * 10 + c",
"ret * 10",
"ret",
"10",
"c",
"'0'",
"if (c == '.') {\n while ((c = read()) >= '0' && c <= '9') {\n ret += (c - '0') / (div *= 10);\n }\n }",
"c == '.'",
"c",
"'.'",
"{\n while ((c = read()) >= '0' && c <= '9') {\n ret += (c - '0') / (div *= 10);\n }\n }",
"while ((c = read()) >= '0' && c <= '9') {\n ret += (c - '0') / (div *= 10);\n }",
"(c = read()) >= '0' && c <= '9'",
"(c = read()) >= '0'",
"(c = read())",
"c",
"read()",
"read",
"'0'",
"c <= '9'",
"c",
"'9'",
"{\n ret += (c - '0') / (div *= 10);\n }",
"ret += (c - '0') / (div *= 10)",
"ret",
"(c - '0') / (div *= 10)",
"(c - '0')",
"c",
"'0'",
"(div *= 10)",
"div",
"10",
"if (neg)\n return -ret;",
"neg",
"return -ret;",
"-ret",
"ret",
"return ret;",
"ret",
"public int[] intArray (int n) throws IOException {\n int arr[] = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextInt();\n }\n return arr;\n }",
"intArray",
"{\n int arr[] = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextInt();\n }\n return arr;\n }",
"int arr[] = new int[n];",
"arr",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n arr[i] = nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n arr[i] = nextInt();\n }",
"{\n arr[i] = nextInt();\n }",
"arr[i] = nextInt()",
"arr[i]",
"arr",
"i",
"nextInt()",
"nextInt",
"return arr;",
"arr",
"int n",
"n",
"public long[] longArray (int n) throws IOException {\n long arr[] = new long[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextLong();\n }\n return arr;\n }",
"longArray",
"{\n long arr[] = new long[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextLong();\n }\n return arr;\n }",
"long arr[] = new long[n];",
"arr",
"new long[n]",
"n",
"for (int i = 0; i < n; i++) {\n arr[i] = nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n arr[i] = nextLong();\n }",
"{\n arr[i] = nextLong();\n }",
"arr[i] = nextLong()",
"arr[i]",
"arr",
"i",
"nextLong()",
"nextLong",
"return arr;",
"arr",
"int n",
"n",
"public double[] doubleArray (int n) throws IOException {\n double arr[] = new double[n];\n for (int i = 0; i < n; i++)\n arr[i] = nextDouble();\n return arr;\n }",
"doubleArray",
"{\n double arr[] = new double[n];\n for (int i = 0; i < n; i++)\n arr[i] = nextDouble();\n return arr;\n }",
"double arr[] = new double[n];",
"arr",
"new double[n]",
"n",
"for (int i = 0; i < n; i++)\n arr[i] = nextDouble();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"arr[i] = nextDouble();",
"arr[i] = nextDouble()",
"arr[i]",
"arr",
"i",
"nextDouble()",
"nextDouble",
"return arr;",
"arr",
"int n",
"n",
"public class Main {\n public static void main (String[] args) throws IOException {\n final long INF =(long)1e18;\n FastScanner sc = new FastScanner();\n final int N = sc.nextInt();\n long[] A = sc.longArray (N);\n Arrays.sort (A);\n if (A[0] == 0L) {\n System.out.println (0);\n return;\n }\n long ans = 1;\n for (long Ai : A) {\n if (INF / ans < Ai) {\n System.out.println (-1);\n return;\n } else {\n ans *= Ai;\n }\n }\n System.out.println (ans);\n return;\n }\n\n // FastScanner start\n static class FastScanner {\n final private int BUFFER_SIZE = 1 << 16;\n private DataInputStream din;\n private byte[] buffer;\n private int bufferPointer, bytesRead;\n\n public FastScanner() {\n din = new DataInputStream (System.in);\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n public FastScanner (String file_name) throws IOException {\n din = new DataInputStream (new FileInputStream (file_name));\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n private byte read() throws IOException {\n if (bufferPointer == bytesRead)\n fillBuffer();\n return buffer[bufferPointer++];\n }\n\n public void close() throws IOException {\n if (din == null)\n return;\n din.close();\n }\n\n private void fillBuffer() throws IOException {\n bytesRead = din.read (buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1)\n buffer[0] = -1;\n }\n\n public char nextChar() throws IOException {\n byte c = read();\n while (Character.isWhitespace (c)) {\n c = read();\n }\n return (char)c;\n }\n\n public String nextString() throws IOException {\n byte c = read();\n while (Character.isWhitespace (c)) {\n c = read();\n }\n StringBuilder builder = new StringBuilder();\n builder.append ((char)c);\n c = read();\n while (!Character.isWhitespace (c)) {\n builder.append ((char)c);\n c = read();\n }\n return builder.toString();\n }\n\n public int nextInt() throws IOException {\n int ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }\n\n public long nextLong() throws IOException {\n long ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }\n\n public double nextDouble() throws IOException {\n double ret = 0, div = 1;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (c == '.') {\n while ((c = read()) >= '0' && c <= '9') {\n ret += (c - '0') / (div *= 10);\n }\n }\n if (neg)\n return -ret;\n return ret;\n }\n\n public int[] intArray (int n) throws IOException {\n int arr[] = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextInt();\n }\n return arr;\n }\n\n public long[] longArray (int n) throws IOException {\n long arr[] = new long[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextLong();\n }\n return arr;\n }\n\n public double[] doubleArray (int n) throws IOException {\n double arr[] = new double[n];\n for (int i = 0; i < n; i++)\n arr[i] = nextDouble();\n return arr;\n }\n }\n // FastScanner end\n}",
"public class Main {\n public static void main (String[] args) throws IOException {\n final long INF =(long)1e18;\n FastScanner sc = new FastScanner();\n final int N = sc.nextInt();\n long[] A = sc.longArray (N);\n Arrays.sort (A);\n if (A[0] == 0L) {\n System.out.println (0);\n return;\n }\n long ans = 1;\n for (long Ai : A) {\n if (INF / ans < Ai) {\n System.out.println (-1);\n return;\n } else {\n ans *= Ai;\n }\n }\n System.out.println (ans);\n return;\n }\n\n // FastScanner start\n static class FastScanner {\n final private int BUFFER_SIZE = 1 << 16;\n private DataInputStream din;\n private byte[] buffer;\n private int bufferPointer, bytesRead;\n\n public FastScanner() {\n din = new DataInputStream (System.in);\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n public FastScanner (String file_name) throws IOException {\n din = new DataInputStream (new FileInputStream (file_name));\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n private byte read() throws IOException {\n if (bufferPointer == bytesRead)\n fillBuffer();\n return buffer[bufferPointer++];\n }\n\n public void close() throws IOException {\n if (din == null)\n return;\n din.close();\n }\n\n private void fillBuffer() throws IOException {\n bytesRead = din.read (buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1)\n buffer[0] = -1;\n }\n\n public char nextChar() throws IOException {\n byte c = read();\n while (Character.isWhitespace (c)) {\n c = read();\n }\n return (char)c;\n }\n\n public String nextString() throws IOException {\n byte c = read();\n while (Character.isWhitespace (c)) {\n c = read();\n }\n StringBuilder builder = new StringBuilder();\n builder.append ((char)c);\n c = read();\n while (!Character.isWhitespace (c)) {\n builder.append ((char)c);\n c = read();\n }\n return builder.toString();\n }\n\n public int nextInt() throws IOException {\n int ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }\n\n public long nextLong() throws IOException {\n long ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }\n\n public double nextDouble() throws IOException {\n double ret = 0, div = 1;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (c == '.') {\n while ((c = read()) >= '0' && c <= '9') {\n ret += (c - '0') / (div *= 10);\n }\n }\n if (neg)\n return -ret;\n return ret;\n }\n\n public int[] intArray (int n) throws IOException {\n int arr[] = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextInt();\n }\n return arr;\n }\n\n public long[] longArray (int n) throws IOException {\n long arr[] = new long[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextLong();\n }\n return arr;\n }\n\n public double[] doubleArray (int n) throws IOException {\n double arr[] = new double[n];\n for (int i = 0; i < n; i++)\n arr[i] = nextDouble();\n return arr;\n }\n }\n // FastScanner end\n}",
"Main"
] |
import java.io.*;
// import java.math.*;
import java.util.*;
// import java.util.Map.*;
// import java.util.stream.*;
public class Main {
public static void main (String[] args) throws IOException {
final long INF =(long)1e18;
FastScanner sc = new FastScanner();
final int N = sc.nextInt();
long[] A = sc.longArray (N);
Arrays.sort (A);
if (A[0] == 0L) {
System.out.println (0);
return;
}
long ans = 1;
for (long Ai : A) {
if (INF / ans < Ai) {
System.out.println (-1);
return;
} else {
ans *= Ai;
}
}
System.out.println (ans);
return;
}
// FastScanner start
static class FastScanner {
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public FastScanner() {
din = new DataInputStream (System.in);
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public FastScanner (String file_name) throws IOException {
din = new DataInputStream (new FileInputStream (file_name));
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
private byte read() throws IOException {
if (bufferPointer == bytesRead)
fillBuffer();
return buffer[bufferPointer++];
}
public void close() throws IOException {
if (din == null)
return;
din.close();
}
private void fillBuffer() throws IOException {
bytesRead = din.read (buffer, bufferPointer = 0, BUFFER_SIZE);
if (bytesRead == -1)
buffer[0] = -1;
}
public char nextChar() throws IOException {
byte c = read();
while (Character.isWhitespace (c)) {
c = read();
}
return (char)c;
}
public String nextString() throws IOException {
byte c = read();
while (Character.isWhitespace (c)) {
c = read();
}
StringBuilder builder = new StringBuilder();
builder.append ((char)c);
c = read();
while (!Character.isWhitespace (c)) {
builder.append ((char)c);
c = read();
}
return builder.toString();
}
public int nextInt() throws IOException {
int ret = 0;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (neg)
return -ret;
return ret;
}
public long nextLong() throws IOException {
long ret = 0;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (neg)
return -ret;
return ret;
}
public double nextDouble() throws IOException {
double ret = 0, div = 1;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (c == '.') {
while ((c = read()) >= '0' && c <= '9') {
ret += (c - '0') / (div *= 10);
}
}
if (neg)
return -ret;
return ret;
}
public int[] intArray (int n) throws IOException {
int arr[] = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = nextInt();
}
return arr;
}
public long[] longArray (int n) throws IOException {
long arr[] = new long[n];
for (int i = 0; i < n; i++) {
arr[i] = nextLong();
}
return arr;
}
public double[] doubleArray (int n) throws IOException {
double arr[] = new double[n];
for (int i = 0; i < n; i++)
arr[i] = nextDouble();
return arr;
}
}
// FastScanner end
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
17,
17,
41,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
0,
18,
13,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
4,
18,
13,
13,
4,
18,
13,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
29,
0,
13,
18,
13,
13,
14,
2,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
132,
8
],
[
132,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
22,
25
],
[
22,
26
],
[
11,
27
],
[
27,
28
],
[
27,
29
],
[
11,
30
],
[
30,
31
],
[
30,
32
],
[
11,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
34,
39
],
[
39,
40
],
[
39,
41
],
[
34,
42
],
[
42,
43
],
[
43,
44
],
[
34,
45
],
[
46,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
46,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
57,
62
],
[
56,
63
],
[
46,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
11,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
74,
75
],
[
74,
76
],
[
69,
77
],
[
77,
78
],
[
78,
79
],
[
69,
80
],
[
81,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
84,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
92,
93
],
[
92,
94
],
[
83,
95
],
[
82,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
102,
103
],
[
96,
104
],
[
81,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
107,
109
],
[
11,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
115,
120
],
[
120,
121
],
[
114,
122
],
[
11,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
9,
129
],
[
129,
130
],
[
0,
131
],
[
131,
132
],
[
131,
133
]
] |
[
"import java.util.*;\nimport java.lang.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int a = scan.nextInt();\n\n long limit = (long) Math.pow(10,18);\n long sum = 1;\n long [] c = new long[a];\n for (int i=0;i<a;i++){\n long b = scan.nextLong();\n if (b==0){\n System.out.println(0);\n return;\n }\n c[i] = b;\n }\n\n for (int j=0;j<a;j++){\n if (Math.log10(sum)+Math.log10(c[j])>18){\n System.out.println(-1);\n return;\n }\n sum*=c[j];\n }\n\n if (sum>limit){\n System.out.println(-1);\n return;\n }\n System.out.println(sum);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.lang.*;",
"lang.*",
"java",
"public class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int a = scan.nextInt();\n\n long limit = (long) Math.pow(10,18);\n long sum = 1;\n long [] c = new long[a];\n for (int i=0;i<a;i++){\n long b = scan.nextLong();\n if (b==0){\n System.out.println(0);\n return;\n }\n c[i] = b;\n }\n\n for (int j=0;j<a;j++){\n if (Math.log10(sum)+Math.log10(c[j])>18){\n System.out.println(-1);\n return;\n }\n sum*=c[j];\n }\n\n if (sum>limit){\n System.out.println(-1);\n return;\n }\n System.out.println(sum);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int a = scan.nextInt();\n\n long limit = (long) Math.pow(10,18);\n long sum = 1;\n long [] c = new long[a];\n for (int i=0;i<a;i++){\n long b = scan.nextLong();\n if (b==0){\n System.out.println(0);\n return;\n }\n c[i] = b;\n }\n\n for (int j=0;j<a;j++){\n if (Math.log10(sum)+Math.log10(c[j])>18){\n System.out.println(-1);\n return;\n }\n sum*=c[j];\n }\n\n if (sum>limit){\n System.out.println(-1);\n return;\n }\n System.out.println(sum);\n }",
"main",
"{\n Scanner scan = new Scanner(System.in);\n int a = scan.nextInt();\n\n long limit = (long) Math.pow(10,18);\n long sum = 1;\n long [] c = new long[a];\n for (int i=0;i<a;i++){\n long b = scan.nextLong();\n if (b==0){\n System.out.println(0);\n return;\n }\n c[i] = b;\n }\n\n for (int j=0;j<a;j++){\n if (Math.log10(sum)+Math.log10(c[j])>18){\n System.out.println(-1);\n return;\n }\n sum*=c[j];\n }\n\n if (sum>limit){\n System.out.println(-1);\n return;\n }\n System.out.println(sum);\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int a = scan.nextInt();",
"a",
"scan.nextInt()",
"scan.nextInt",
"scan",
"long limit = (long) Math.pow(10,18);",
"limit",
"(long) Math.pow(10,18)",
"Math.pow",
"Math",
"10",
"18",
"long sum = 1;",
"sum",
"1",
"long [] c = new long[a];",
"c",
"new long[a]",
"a",
"for (int i=0;i<a;i++){\n long b = scan.nextLong();\n if (b==0){\n System.out.println(0);\n return;\n }\n c[i] = b;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<a",
"i",
"a",
"i++",
"i++",
"i",
"{\n long b = scan.nextLong();\n if (b==0){\n System.out.println(0);\n return;\n }\n c[i] = b;\n }",
"{\n long b = scan.nextLong();\n if (b==0){\n System.out.println(0);\n return;\n }\n c[i] = b;\n }",
"long b = scan.nextLong();",
"b",
"scan.nextLong()",
"scan.nextLong",
"scan",
"if (b==0){\n System.out.println(0);\n return;\n }",
"b==0",
"b",
"0",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"c[i] = b",
"c[i]",
"c",
"i",
"b",
"for (int j=0;j<a;j++){\n if (Math.log10(sum)+Math.log10(c[j])>18){\n System.out.println(-1);\n return;\n }\n sum*=c[j];\n }",
"int j=0;",
"int j=0;",
"j",
"0",
"j<a",
"j",
"a",
"j++",
"j++",
"j",
"{\n if (Math.log10(sum)+Math.log10(c[j])>18){\n System.out.println(-1);\n return;\n }\n sum*=c[j];\n }",
"{\n if (Math.log10(sum)+Math.log10(c[j])>18){\n System.out.println(-1);\n return;\n }\n sum*=c[j];\n }",
"if (Math.log10(sum)+Math.log10(c[j])>18){\n System.out.println(-1);\n return;\n }",
"Math.log10(sum)+Math.log10(c[j])>18",
"Math.log10(sum)+Math.log10(c[j])",
"Math.log10(sum)",
"Math.log10",
"Math",
"sum",
"Math.log10(c[j])",
"Math.log10",
"Math",
"c[j]",
"c",
"j",
"18",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"sum*=c[j]",
"sum",
"c[j]",
"c",
"j",
"if (sum>limit){\n System.out.println(-1);\n return;\n }",
"sum>limit",
"sum",
"limit",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int a = scan.nextInt();\n\n long limit = (long) Math.pow(10,18);\n long sum = 1;\n long [] c = new long[a];\n for (int i=0;i<a;i++){\n long b = scan.nextLong();\n if (b==0){\n System.out.println(0);\n return;\n }\n c[i] = b;\n }\n\n for (int j=0;j<a;j++){\n if (Math.log10(sum)+Math.log10(c[j])>18){\n System.out.println(-1);\n return;\n }\n sum*=c[j];\n }\n\n if (sum>limit){\n System.out.println(-1);\n return;\n }\n System.out.println(sum);\n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int a = scan.nextInt();\n\n long limit = (long) Math.pow(10,18);\n long sum = 1;\n long [] c = new long[a];\n for (int i=0;i<a;i++){\n long b = scan.nextLong();\n if (b==0){\n System.out.println(0);\n return;\n }\n c[i] = b;\n }\n\n for (int j=0;j<a;j++){\n if (Math.log10(sum)+Math.log10(c[j])>18){\n System.out.println(-1);\n return;\n }\n sum*=c[j];\n }\n\n if (sum>limit){\n System.out.println(-1);\n return;\n }\n System.out.println(sum);\n }\n}",
"Main"
] |
import java.util.*;
import java.lang.*;
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int a = scan.nextInt();
long limit = (long) Math.pow(10,18);
long sum = 1;
long [] c = new long[a];
for (int i=0;i<a;i++){
long b = scan.nextLong();
if (b==0){
System.out.println(0);
return;
}
c[i] = b;
}
for (int j=0;j<a;j++){
if (Math.log10(sum)+Math.log10(c[j])>18){
System.out.println(-1);
return;
}
sum*=c[j];
}
if (sum>limit){
System.out.println(-1);
return;
}
System.out.println(sum);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
0,
13,
17,
3,
14,
2,
18,
13,
13,
2,
13,
13,
30,
0,
13,
18,
13,
13,
30,
0,
13,
40,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
99,
5
],
[
99,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
8,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
32,
33
],
[
32,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
27,
38
],
[
39,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
8,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
47,
52
],
[
52,
53
],
[
52,
54
],
[
47,
55
],
[
55,
56
],
[
56,
57
],
[
47,
58
],
[
59,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
60,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
60,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
76,
78
],
[
71,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
71,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
8,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
6,
96
],
[
96,
97
],
[
0,
98
],
[
98,
99
],
[
98,
100
]
] |
[
"import java.util.*;\n \npublic class Main {\n public static void main(String[] args){\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n long [] A = new long [N];\n long number = 1;\n long max = 1000000000000000000L;\n \n for(int i=0; i<N; i++){\n A[i] = scanner.nextLong();\n }\n \n for(int i = 0; i<N; i++){ \n \n if(A[i] ==0){\n number = 0;\n break;\n }\n else if(A[i]<=(max/number)){\n number *= A[i];\n }\n else{\n number = -1;\n }\n }\n \n System.out.println(number);\n \n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args){\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n long [] A = new long [N];\n long number = 1;\n long max = 1000000000000000000L;\n \n for(int i=0; i<N; i++){\n A[i] = scanner.nextLong();\n }\n \n for(int i = 0; i<N; i++){ \n \n if(A[i] ==0){\n number = 0;\n break;\n }\n else if(A[i]<=(max/number)){\n number *= A[i];\n }\n else{\n number = -1;\n }\n }\n \n System.out.println(number);\n \n }\n}",
"Main",
"public static void main(String[] args){\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n long [] A = new long [N];\n long number = 1;\n long max = 1000000000000000000L;\n \n for(int i=0; i<N; i++){\n A[i] = scanner.nextLong();\n }\n \n for(int i = 0; i<N; i++){ \n \n if(A[i] ==0){\n number = 0;\n break;\n }\n else if(A[i]<=(max/number)){\n number *= A[i];\n }\n else{\n number = -1;\n }\n }\n \n System.out.println(number);\n \n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n long [] A = new long [N];\n long number = 1;\n long max = 1000000000000000000L;\n \n for(int i=0; i<N; i++){\n A[i] = scanner.nextLong();\n }\n \n for(int i = 0; i<N; i++){ \n \n if(A[i] ==0){\n number = 0;\n break;\n }\n else if(A[i]<=(max/number)){\n number *= A[i];\n }\n else{\n number = -1;\n }\n }\n \n System.out.println(number);\n \n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int N = scanner.nextInt();",
"N",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"long [] A = new long [N];",
"A",
"new long [N]",
"N",
"long number = 1;",
"number",
"1",
"long max = 1000000000000000000L;",
"max",
"1000000000000000000L",
"for(int i=0; i<N; i++){\n A[i] = scanner.nextLong();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i] = scanner.nextLong();\n }",
"{\n A[i] = scanner.nextLong();\n }",
"A[i] = scanner.nextLong()",
"A[i]",
"A",
"i",
"scanner.nextLong()",
"scanner.nextLong",
"scanner",
"for(int i = 0; i<N; i++){ \n \n if(A[i] ==0){\n number = 0;\n break;\n }\n else if(A[i]<=(max/number)){\n number *= A[i];\n }\n else{\n number = -1;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{ \n \n if(A[i] ==0){\n number = 0;\n break;\n }\n else if(A[i]<=(max/number)){\n number *= A[i];\n }\n else{\n number = -1;\n }\n }",
"{ \n \n if(A[i] ==0){\n number = 0;\n break;\n }\n else if(A[i]<=(max/number)){\n number *= A[i];\n }\n else{\n number = -1;\n }\n }",
"if(A[i] ==0){\n number = 0;\n break;\n }\n else if(A[i]<=(max/number)){\n number *= A[i];\n }\n else{\n number = -1;\n }",
"A[i] ==0",
"A[i]",
"A",
"i",
"0",
"{\n number = 0;\n break;\n }",
"number = 0",
"number",
"0",
"break;",
"if(A[i]<=(max/number)){\n number *= A[i];\n }\n else{\n number = -1;\n }",
"A[i]<=(max/number)",
"A[i]",
"A",
"i",
"(max/number)",
"max",
"number",
"{\n number *= A[i];\n }",
"number *= A[i]",
"number",
"A[i]",
"A",
"i",
"{\n number = -1;\n }",
"number = -1",
"number",
"-1",
"1",
"System.out.println(number)",
"System.out.println",
"System.out",
"System",
"System.out",
"number",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args){\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n long [] A = new long [N];\n long number = 1;\n long max = 1000000000000000000L;\n \n for(int i=0; i<N; i++){\n A[i] = scanner.nextLong();\n }\n \n for(int i = 0; i<N; i++){ \n \n if(A[i] ==0){\n number = 0;\n break;\n }\n else if(A[i]<=(max/number)){\n number *= A[i];\n }\n else{\n number = -1;\n }\n }\n \n System.out.println(number);\n \n }\n}",
"public class Main {\n public static void main(String[] args){\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n long [] A = new long [N];\n long number = 1;\n long max = 1000000000000000000L;\n \n for(int i=0; i<N; i++){\n A[i] = scanner.nextLong();\n }\n \n for(int i = 0; i<N; i++){ \n \n if(A[i] ==0){\n number = 0;\n break;\n }\n else if(A[i]<=(max/number)){\n number *= A[i];\n }\n else{\n number = -1;\n }\n }\n \n System.out.println(number);\n \n }\n}",
"Main"
] |
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
long [] A = new long [N];
long number = 1;
long max = 1000000000000000000L;
for(int i=0; i<N; i++){
A[i] = scanner.nextLong();
}
for(int i = 0; i<N; i++){
if(A[i] ==0){
number = 0;
break;
}
else if(A[i]<=(max/number)){
number *= A[i];
}
else{
number = -1;
}
}
System.out.println(number);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
0,
13,
17,
14,
13,
30,
0,
13,
17,
30,
41,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
17,
30,
0,
13,
2,
13,
18,
13,
13,
14,
2,
2,
13,
17,
2,
13,
13,
30,
0,
13,
40,
17,
3,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
119,
5
],
[
119,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
8,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
32,
33
],
[
32,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
27,
38
],
[
39,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
39,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
47,
53
],
[
53,
54
],
[
53,
55
],
[
8,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
56,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
62,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
68,
73
],
[
73,
74
],
[
73,
75
],
[
68,
76
],
[
76,
77
],
[
77,
78
],
[
68,
79
],
[
80,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
85,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
98,
100
],
[
93,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
101,
106
],
[
85,
107
],
[
107,
108
],
[
107,
109
],
[
8,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
6,
116
],
[
116,
117
],
[
0,
118
],
[
118,
119
],
[
118,
120
]
] |
[
"import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long r = 1;\n long[] a = new long[n];\n boolean flag =false;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if(a[i] == 0) flag = true;\n }\n if (flag) {\n r = 0;\n } else {\n long t = a[0];\n for (int i = 0; i < n; i++) {\n if (i > 0) {\n r = t * a[i];\n if (r > 1000000000000000000L || r < t) {\n r = -1;\n break;\n }\n t = r;\n }\n }\n }\n\n System.out.println(r);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long r = 1;\n long[] a = new long[n];\n boolean flag =false;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if(a[i] == 0) flag = true;\n }\n if (flag) {\n r = 0;\n } else {\n long t = a[0];\n for (int i = 0; i < n; i++) {\n if (i > 0) {\n r = t * a[i];\n if (r > 1000000000000000000L || r < t) {\n r = -1;\n break;\n }\n t = r;\n }\n }\n }\n\n System.out.println(r);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long r = 1;\n long[] a = new long[n];\n boolean flag =false;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if(a[i] == 0) flag = true;\n }\n if (flag) {\n r = 0;\n } else {\n long t = a[0];\n for (int i = 0; i < n; i++) {\n if (i > 0) {\n r = t * a[i];\n if (r > 1000000000000000000L || r < t) {\n r = -1;\n break;\n }\n t = r;\n }\n }\n }\n\n System.out.println(r);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long r = 1;\n long[] a = new long[n];\n boolean flag =false;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if(a[i] == 0) flag = true;\n }\n if (flag) {\n r = 0;\n } else {\n long t = a[0];\n for (int i = 0; i < n; i++) {\n if (i > 0) {\n r = t * a[i];\n if (r > 1000000000000000000L || r < t) {\n r = -1;\n break;\n }\n t = r;\n }\n }\n }\n\n System.out.println(r);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long r = 1;",
"r",
"1",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"boolean flag =false;",
"flag",
"false",
"for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if(a[i] == 0) flag = true;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = sc.nextLong();\n if(a[i] == 0) flag = true;\n }",
"{\n a[i] = sc.nextLong();\n if(a[i] == 0) flag = true;\n }",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(a[i] == 0) flag = true;",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"flag = true",
"flag",
"true",
"if (flag) {\n r = 0;\n } else {\n long t = a[0];\n for (int i = 0; i < n; i++) {\n if (i > 0) {\n r = t * a[i];\n if (r > 1000000000000000000L || r < t) {\n r = -1;\n break;\n }\n t = r;\n }\n }\n }",
"flag",
"{\n r = 0;\n }",
"r = 0",
"r",
"0",
"{\n long t = a[0];\n for (int i = 0; i < n; i++) {\n if (i > 0) {\n r = t * a[i];\n if (r > 1000000000000000000L || r < t) {\n r = -1;\n break;\n }\n t = r;\n }\n }\n }",
"long t = a[0];",
"t",
"a[0]",
"a",
"0",
"for (int i = 0; i < n; i++) {\n if (i > 0) {\n r = t * a[i];\n if (r > 1000000000000000000L || r < t) {\n r = -1;\n break;\n }\n t = r;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if (i > 0) {\n r = t * a[i];\n if (r > 1000000000000000000L || r < t) {\n r = -1;\n break;\n }\n t = r;\n }\n }",
"{\n if (i > 0) {\n r = t * a[i];\n if (r > 1000000000000000000L || r < t) {\n r = -1;\n break;\n }\n t = r;\n }\n }",
"if (i > 0) {\n r = t * a[i];\n if (r > 1000000000000000000L || r < t) {\n r = -1;\n break;\n }\n t = r;\n }",
"i > 0",
"i",
"0",
"{\n r = t * a[i];\n if (r > 1000000000000000000L || r < t) {\n r = -1;\n break;\n }\n t = r;\n }",
"r = t * a[i]",
"r",
"t * a[i]",
"t",
"a[i]",
"a",
"i",
"if (r > 1000000000000000000L || r < t) {\n r = -1;\n break;\n }",
"r > 1000000000000000000L || r < t",
"r > 1000000000000000000L",
"r",
"1000000000000000000L",
"r < t",
"r",
"t",
"{\n r = -1;\n break;\n }",
"r = -1",
"r",
"-1",
"1",
"break;",
"t = r",
"t",
"r",
"System.out.println(r)",
"System.out.println",
"System.out",
"System",
"System.out",
"r",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long r = 1;\n long[] a = new long[n];\n boolean flag =false;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if(a[i] == 0) flag = true;\n }\n if (flag) {\n r = 0;\n } else {\n long t = a[0];\n for (int i = 0; i < n; i++) {\n if (i > 0) {\n r = t * a[i];\n if (r > 1000000000000000000L || r < t) {\n r = -1;\n break;\n }\n t = r;\n }\n }\n }\n\n System.out.println(r);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long r = 1;\n long[] a = new long[n];\n boolean flag =false;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if(a[i] == 0) flag = true;\n }\n if (flag) {\n r = 0;\n } else {\n long t = a[0];\n for (int i = 0; i < n; i++) {\n if (i > 0) {\n r = t * a[i];\n if (r > 1000000000000000000L || r < t) {\n r = -1;\n break;\n }\n t = r;\n }\n }\n }\n\n System.out.println(r);\n }\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long r = 1;
long[] a = new long[n];
boolean flag =false;
for (int i = 0; i < n; i++) {
a[i] = sc.nextLong();
if(a[i] == 0) flag = true;
}
if (flag) {
r = 0;
} else {
long t = a[0];
for (int i = 0; i < n; i++) {
if (i > 0) {
r = t * a[i];
if (r > 1000000000000000000L || r < t) {
r = -1;
break;
}
t = r;
}
}
}
System.out.println(r);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
0,
13,
17,
14,
2,
13,
17,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
4,
18,
13,
17,
17,
13,
30,
0,
13,
18,
13,
13,
30,
0,
13,
40,
17,
3,
4,
18,
18,
13,
13,
13,
23,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
36,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
44,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
8,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
59,
64
],
[
64,
65
],
[
64,
66
],
[
59,
67
],
[
67,
68
],
[
68,
69
],
[
59,
70
],
[
71,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
78,
82
],
[
77,
83
],
[
72,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
72,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
90,
95
],
[
8,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
6,
102
],
[
102,
103
]
] |
[
"import java.util.*; \n\nclass Main{\npublic static void main(String[] args){\n\tScanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n \t\tlong[] a=new long[n];\n \t\tlong ans=1;\n\t\tfor(int c=0;c<n;c++){\n \t\ta[c]=sc.nextLong();\n \tif(a[c]==0){\n \tans=0;\n }\n \t}\n \tif(ans!=0){\n\t\tfor(int c=0;c<n;c++){\n if(a[c]<=(long)Math.pow(10,18)/ans){\n ans*=a[c];\n }else{\n \tans=-1;\n break;\n }\n \t}\n }\n \tSystem.out.println(ans);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"class Main{\npublic static void main(String[] args){\n\tScanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n \t\tlong[] a=new long[n];\n \t\tlong ans=1;\n\t\tfor(int c=0;c<n;c++){\n \t\ta[c]=sc.nextLong();\n \tif(a[c]==0){\n \tans=0;\n }\n \t}\n \tif(ans!=0){\n\t\tfor(int c=0;c<n;c++){\n if(a[c]<=(long)Math.pow(10,18)/ans){\n ans*=a[c];\n }else{\n \tans=-1;\n break;\n }\n \t}\n }\n \tSystem.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args){\n\tScanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n \t\tlong[] a=new long[n];\n \t\tlong ans=1;\n\t\tfor(int c=0;c<n;c++){\n \t\ta[c]=sc.nextLong();\n \tif(a[c]==0){\n \tans=0;\n }\n \t}\n \tif(ans!=0){\n\t\tfor(int c=0;c<n;c++){\n if(a[c]<=(long)Math.pow(10,18)/ans){\n ans*=a[c];\n }else{\n \tans=-1;\n break;\n }\n \t}\n }\n \tSystem.out.println(ans);\n }",
"main",
"{\n\tScanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n \t\tlong[] a=new long[n];\n \t\tlong ans=1;\n\t\tfor(int c=0;c<n;c++){\n \t\ta[c]=sc.nextLong();\n \tif(a[c]==0){\n \tans=0;\n }\n \t}\n \tif(ans!=0){\n\t\tfor(int c=0;c<n;c++){\n if(a[c]<=(long)Math.pow(10,18)/ans){\n ans*=a[c];\n }else{\n \tans=-1;\n break;\n }\n \t}\n }\n \tSystem.out.println(ans);\n }",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] a=new long[n];",
"a",
"new long[n]",
"n",
"long ans=1;",
"ans",
"1",
"for(int c=0;c<n;c++){\n \t\ta[c]=sc.nextLong();\n \tif(a[c]==0){\n \tans=0;\n }\n \t}",
"int c=0;",
"int c=0;",
"c",
"0",
"c<n",
"c",
"n",
"c++",
"c++",
"c",
"{\n \t\ta[c]=sc.nextLong();\n \tif(a[c]==0){\n \tans=0;\n }\n \t}",
"{\n \t\ta[c]=sc.nextLong();\n \tif(a[c]==0){\n \tans=0;\n }\n \t}",
"a[c]=sc.nextLong()",
"a[c]",
"a",
"c",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(a[c]==0){\n \tans=0;\n }",
"a[c]==0",
"a[c]",
"a",
"c",
"0",
"{\n \tans=0;\n }",
"ans=0",
"ans",
"0",
"if(ans!=0){\n\t\tfor(int c=0;c<n;c++){\n if(a[c]<=(long)Math.pow(10,18)/ans){\n ans*=a[c];\n }else{\n \tans=-1;\n break;\n }\n \t}\n }",
"ans!=0",
"ans",
"0",
"{\n\t\tfor(int c=0;c<n;c++){\n if(a[c]<=(long)Math.pow(10,18)/ans){\n ans*=a[c];\n }else{\n \tans=-1;\n break;\n }\n \t}\n }",
"for(int c=0;c<n;c++){\n if(a[c]<=(long)Math.pow(10,18)/ans){\n ans*=a[c];\n }else{\n \tans=-1;\n break;\n }\n \t}",
"int c=0;",
"int c=0;",
"c",
"0",
"c<n",
"c",
"n",
"c++",
"c++",
"c",
"{\n if(a[c]<=(long)Math.pow(10,18)/ans){\n ans*=a[c];\n }else{\n \tans=-1;\n break;\n }\n \t}",
"{\n if(a[c]<=(long)Math.pow(10,18)/ans){\n ans*=a[c];\n }else{\n \tans=-1;\n break;\n }\n \t}",
"if(a[c]<=(long)Math.pow(10,18)/ans){\n ans*=a[c];\n }else{\n \tans=-1;\n break;\n }",
"a[c]<=(long)Math.pow(10,18)/ans",
"a[c]",
"a",
"c",
"(long)Math.pow(10,18)/ans",
"(long)Math.pow(10,18)",
"Math.pow",
"Math",
"10",
"18",
"ans",
"{\n ans*=a[c];\n }",
"ans*=a[c]",
"ans",
"a[c]",
"a",
"c",
"{\n \tans=-1;\n break;\n }",
"ans=-1",
"ans",
"-1",
"1",
"break;",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args"
] |
import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
long[] a=new long[n];
long ans=1;
for(int c=0;c<n;c++){
a[c]=sc.nextLong();
if(a[c]==0){
ans=0;
}
}
if(ans!=0){
for(int c=0;c<n;c++){
if(a[c]<=(long)Math.pow(10,18)/ans){
ans*=a[c];
}else{
ans=-1;
break;
}
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
2,
4,
18,
13,
17,
17,
17,
41,
13,
17,
12,
13,
30,
41,
13,
20,
41,
13,
17,
42,
2,
40,
13,
17,
30,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
0,
13,
17,
14,
13,
30,
4,
18,
18,
13,
13,
17,
29,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
4,
18,
13,
17,
17,
13,
0,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
2,
4,
18,
13,
17,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
4,
18,
13,
2,
2,
4,
18,
13,
13,
17,
29,
17,
29,
17,
23,
13,
12,
13,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
13,
13,
17,
30,
14,
2,
13,
4,
18,
13,
13,
4,
18,
13,
13,
30,
4,
18,
13,
13,
4,
18,
13,
2,
13,
13,
4,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
14,
2,
4,
18,
4,
13,
13,
17,
29,
17,
29,
17,
23,
13,
12,
13,
30,
14,
2,
13,
17,
29,
13,
14,
2,
13,
17,
29,
13,
14,
2,
13,
13,
29,
13,
14,
2,
13,
13,
29,
4,
13,
2,
13,
13,
13,
29,
4,
13,
13,
2,
13,
13,
23,
13,
23,
13,
12,
13,
30,
29,
2,
2,
13,
13,
4,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
2,
2,
4,
18,
13,
17,
17,
1,
40,
13,
30,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
2,
4,
18,
13,
13,
17,
0,
18,
13,
2,
2,
4,
18,
13,
13,
17,
13,
41,
13,
20,
29,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
29,
17,
14,
2,
13,
17,
29,
13,
30,
41,
13,
4,
13,
13,
2,
13,
17,
14,
2,
2,
13,
17,
17,
30,
29,
2,
13,
13,
30,
29,
2,
2,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
29,
17,
14,
2,
13,
17,
29,
2,
13,
13,
30,
41,
13,
2,
4,
13,
13,
2,
13,
17,
13,
0,
13,
13,
0,
13,
13,
14,
2,
2,
13,
17,
17,
30,
0,
13,
13,
0,
13,
13,
29,
2,
13,
13,
23,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
485,
11
],
[
485,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
16,
17
],
[
15,
18
],
[
15,
19
],
[
14,
20
],
[
485,
21
],
[
21,
22
],
[
21,
23
],
[
485,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
26,
30
],
[
30,
31
],
[
30,
32
],
[
26,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
34,
37
],
[
33,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
42,
43
],
[
38,
44
],
[
44,
45
],
[
44,
46
],
[
38,
47
],
[
47,
48
],
[
47,
49
],
[
38,
51
],
[
51,
52
],
[
51,
53
],
[
38,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
59,
60
],
[
59,
61
],
[
54,
62
],
[
62,
63
],
[
63,
64
],
[
54,
65
],
[
66,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
71,
72
],
[
72,
73
],
[
66,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
75,
79
],
[
74,
80
],
[
80,
81
],
[
80,
82
],
[
38,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
85,
92
],
[
38,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
98,
99
],
[
98,
100
],
[
93,
101
],
[
101,
102
],
[
102,
103
],
[
93,
104
],
[
105,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
112,
115
],
[
112,
116
],
[
111,
117
],
[
106,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
106,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
124,
129
],
[
129,
130
],
[
123,
131
],
[
38,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
132,
137
],
[
26,
138
],
[
138,
139
],
[
139,
140
],
[
24,
141
],
[
141,
142
],
[
485,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
153,
157
],
[
146,
158
],
[
158,
159
],
[
159,
160
],
[
146,
161
],
[
162,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
165,
168
],
[
164,
169
],
[
169,
170
],
[
170,
171
],
[
169,
172
],
[
173,
173
],
[
173,
174
],
[
174,
175
],
[
175,
176
],
[
173,
177
],
[
173,
178
],
[
163,
179
],
[
179,
180
],
[
145,
181
],
[
181,
182
],
[
143,
183
],
[
183,
184
],
[
485,
185
],
[
185,
186
],
[
185,
187
],
[
187,
188
],
[
188,
189
],
[
188,
190
],
[
187,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
193,
195
],
[
191,
196
],
[
196,
197
],
[
196,
198
],
[
198,
199
],
[
199,
200
],
[
198,
201
],
[
191,
202
],
[
202,
203
],
[
203,
204
],
[
191,
205
],
[
206,
206
],
[
206,
207
],
[
207,
208
],
[
208,
209
],
[
209,
210
],
[
209,
211
],
[
208,
212
],
[
207,
213
],
[
213,
214
],
[
214,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
218,
219
],
[
217,
220
],
[
214,
221
],
[
221,
222
],
[
222,
223
],
[
221,
224
],
[
214,
225
],
[
225,
226
],
[
226,
227
],
[
227,
228
],
[
226,
229
],
[
225,
230
],
[
230,
231
],
[
231,
232
],
[
230,
233
],
[
233,
234
],
[
233,
235
],
[
187,
236
],
[
236,
237
],
[
237,
238
],
[
236,
239
],
[
187,
240
],
[
240,
241
],
[
185,
242
],
[
242,
243
],
[
485,
244
],
[
244,
245
],
[
244,
246
],
[
246,
247
],
[
247,
248
],
[
248,
249
],
[
249,
250
],
[
250,
251
],
[
251,
252
],
[
251,
253
],
[
248,
254
],
[
247,
255
],
[
255,
256
],
[
247,
257
],
[
257,
258
],
[
244,
259
],
[
259,
260
],
[
485,
261
],
[
261,
262
],
[
261,
263
],
[
263,
264
],
[
264,
265
],
[
265,
266
],
[
265,
267
],
[
264,
268
],
[
268,
269
],
[
263,
270
],
[
270,
271
],
[
271,
272
],
[
271,
273
],
[
270,
274
],
[
274,
275
],
[
263,
276
],
[
276,
277
],
[
277,
278
],
[
277,
279
],
[
276,
280
],
[
280,
281
],
[
263,
282
],
[
282,
283
],
[
283,
284
],
[
283,
285
],
[
282,
286
],
[
286,
287
],
[
287,
288
],
[
287,
289
],
[
289,
290
],
[
289,
291
],
[
287,
292
],
[
263,
293
],
[
293,
294
],
[
294,
295
],
[
294,
296
],
[
294,
297
],
[
297,
298
],
[
297,
299
],
[
261,
300
],
[
300,
301
],
[
261,
302
],
[
302,
303
],
[
485,
304
],
[
304,
305
],
[
304,
306
],
[
306,
307
],
[
307,
308
],
[
308,
309
],
[
309,
310
],
[
309,
311
],
[
308,
312
],
[
312,
313
],
[
312,
314
],
[
312,
315
],
[
304,
316
],
[
316,
317
],
[
304,
318
],
[
318,
319
],
[
485,
320
],
[
320,
321
],
[
320,
322
],
[
322,
323
],
[
323,
324
],
[
323,
325
],
[
325,
326
],
[
326,
327
],
[
322,
328
],
[
328,
329
],
[
329,
330
],
[
330,
331
],
[
330,
332
],
[
328,
333
],
[
333,
334
],
[
333,
335
],
[
335,
336
],
[
336,
337
],
[
337,
338
],
[
338,
339
],
[
336,
340
],
[
335,
341
],
[
328,
342
],
[
342,
343
],
[
343,
344
],
[
328,
345
],
[
346,
346
],
[
346,
347
],
[
347,
348
],
[
347,
349
],
[
349,
350
],
[
349,
351
],
[
346,
352
],
[
352,
353
],
[
353,
354
],
[
353,
355
],
[
352,
356
],
[
356,
357
],
[
356,
358
],
[
359,
359
],
[
359,
360
],
[
360,
361
],
[
361,
362
],
[
359,
363
],
[
359,
364
],
[
346,
365
],
[
365,
366
],
[
366,
367
],
[
366,
368
],
[
369,
369
],
[
369,
370
],
[
370,
371
],
[
371,
372
],
[
369,
373
],
[
369,
374
],
[
365,
375
],
[
322,
376
],
[
376,
377
],
[
376,
378
],
[
322,
379
],
[
379,
380
],
[
320,
381
],
[
381,
382
],
[
485,
383
],
[
383,
384
],
[
383,
385
],
[
385,
386
],
[
386,
387
],
[
387,
388
],
[
387,
389
],
[
386,
390
],
[
390,
391
],
[
386,
392
],
[
392,
393
],
[
393,
394
],
[
393,
395
],
[
392,
396
],
[
396,
397
],
[
392,
398
],
[
398,
399
],
[
399,
400
],
[
399,
401
],
[
401,
402
],
[
401,
403
],
[
401,
404
],
[
404,
405
],
[
404,
406
],
[
398,
407
],
[
407,
408
],
[
408,
409
],
[
409,
410
],
[
409,
411
],
[
408,
412
],
[
407,
413
],
[
413,
414
],
[
414,
415
],
[
415,
416
],
[
415,
417
],
[
407,
418
],
[
418,
419
],
[
419,
420
],
[
421,
421
],
[
421,
422
],
[
421,
423
],
[
421,
424
],
[
383,
425
],
[
425,
426
],
[
383,
427
],
[
427,
428
],
[
485,
429
],
[
429,
430
],
[
429,
431
],
[
431,
432
],
[
432,
433
],
[
433,
434
],
[
433,
435
],
[
432,
436
],
[
436,
437
],
[
432,
438
],
[
438,
439
],
[
439,
440
],
[
439,
441
],
[
438,
442
],
[
442,
443
],
[
443,
444
],
[
443,
445
],
[
438,
446
],
[
446,
447
],
[
447,
448
],
[
447,
449
],
[
449,
450
],
[
450,
451
],
[
450,
452
],
[
450,
453
],
[
453,
454
],
[
453,
455
],
[
449,
456
],
[
446,
457
],
[
457,
458
],
[
457,
459
],
[
446,
460
],
[
460,
461
],
[
460,
462
],
[
446,
463
],
[
463,
464
],
[
464,
465
],
[
465,
466
],
[
465,
467
],
[
464,
468
],
[
463,
469
],
[
469,
470
],
[
470,
471
],
[
470,
472
],
[
469,
473
],
[
473,
474
],
[
473,
475
],
[
446,
476
],
[
476,
477
],
[
477,
478
],
[
477,
479
],
[
429,
480
],
[
480,
481
],
[
429,
482
],
[
482,
483
],
[
0,
484
],
[
484,
485
],
[
484,
486
]
] |
[
"import java.lang.reflect.Array;\nimport java.util.*;\nimport java.io.* ;\n/*\nNOTES:\n-more than 10 digits (10^10), use long\n-prefix sum of 1's and -1's to control flow of highlighting a region\n-log(a)/log(b) = log base b of a\n-create a position array if trying to see if elements show up next to each other sequentially\n i.e. elements 1,2,3 are within 3 spots of each other in an array\n arr[scannedInt - 1] = i; (position of i at p[i] in original)\n- use a freq array when counting instances of an element occurring\n- increment the counter first before simulating anything turn-based (two player game)\n\n */\n\npublic class Main {\n static long mod = (long)(Math.pow(10, 9) + 7);\n public static String alpha = \"zabcdefghijklmnopqrstuvwxy\";\n public static void main(String[] args) throws IOException{\n Scanner scan = new Scanner(System.in);\n long t = 1;\n while (t-- > 0){\n int n = scan.nextInt();\n long prod =1;\n long[] arr = new long[n];\n boolean hasZero = false;\n for(int i = 0;i<n; i++){\n arr[i] = scan.nextLong();\n if(arr[i] == 0) hasZero = true;\n }\n if(hasZero) {\n System.out.println(0);\n return;\n }\n for(int i = 0; i<n; i++){\n if(arr[i] <= (long)Math.pow(10,18)/prod) prod *= arr[i];\n else{\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(prod);\n\n }\n scan.close();\n\n }\n\n\n static boolean isPalindrome(String s){\n for(int i = 0; i<s.length()/2; i++){\n if(s.charAt(i) != s.charAt(s.length()-i-1)) return false;\n }\n return true;\n }\n\n static ArrayList factors(int n ){\n ArrayList<Integer> facts = new ArrayList<>();\n for(int i = 1; i<=(int)Math.sqrt(n); i++){\n if(n%i == 0){\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }\n }\n Collections.sort(facts);\n return facts;\n }\n\n static boolean isPrime (int n){\n if(factors(n).size() ==2) return true;\n else return false;\n }\n\n\n\n\n\n static long GCD(long a, long b) {\n // Everything divides 0\n if (a == 0) return b;\n if (b == 0) return a;\n\n // base case\n if (a == b) return a;\n\n // a is greater\n if (a > b) return GCD(a-b, b);\n return GCD(a, b-a);\n }\n static long LCM(long a, long b){\n return (a*b)/(GCD(a,b));\n }\n static String rev(String s){\n char[] arr = s.toCharArray();\n for(int i = 0; i<(s.length()+1)/2; i++){\n char temp = arr[i];\n arr[i] = arr[s.length()-i-1];\n arr[s.length()-i-1] = temp;\n }\n String fin = new String(arr);\n return fin;\n }\n static long pow(long a, long N) {\n if (N == 0) return 1;\n else if (N == 1) return a;\n else {\n long R = pow(a,N/2);\n if (N % 2 == 0) {\n return R*R;\n }\n else {\n return R*R*a;\n }\n }\n }\n\n static long powMod(long a, long N) {\n if (N == 0) return 1;\n else if (N == 1) return a % mod;\n else {\n long R = powMod(a,N/2) % mod;\n R *= R;\n R %= mod;\n if (N % 2 == 1) {\n R *= a;\n R %= mod;\n }\n return R % mod;\n }\n }\n\n}",
"import java.lang.reflect.Array;",
"Array",
"java.lang.reflect",
"import java.util.*;",
"util.*",
"java",
"import java.io.* ;",
"io.*",
"java",
"public class Main {\n static long mod = (long)(Math.pow(10, 9) + 7);\n public static String alpha = \"zabcdefghijklmnopqrstuvwxy\";\n public static void main(String[] args) throws IOException{\n Scanner scan = new Scanner(System.in);\n long t = 1;\n while (t-- > 0){\n int n = scan.nextInt();\n long prod =1;\n long[] arr = new long[n];\n boolean hasZero = false;\n for(int i = 0;i<n; i++){\n arr[i] = scan.nextLong();\n if(arr[i] == 0) hasZero = true;\n }\n if(hasZero) {\n System.out.println(0);\n return;\n }\n for(int i = 0; i<n; i++){\n if(arr[i] <= (long)Math.pow(10,18)/prod) prod *= arr[i];\n else{\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(prod);\n\n }\n scan.close();\n\n }\n\n\n static boolean isPalindrome(String s){\n for(int i = 0; i<s.length()/2; i++){\n if(s.charAt(i) != s.charAt(s.length()-i-1)) return false;\n }\n return true;\n }\n\n static ArrayList factors(int n ){\n ArrayList<Integer> facts = new ArrayList<>();\n for(int i = 1; i<=(int)Math.sqrt(n); i++){\n if(n%i == 0){\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }\n }\n Collections.sort(facts);\n return facts;\n }\n\n static boolean isPrime (int n){\n if(factors(n).size() ==2) return true;\n else return false;\n }\n\n\n\n\n\n static long GCD(long a, long b) {\n // Everything divides 0\n if (a == 0) return b;\n if (b == 0) return a;\n\n // base case\n if (a == b) return a;\n\n // a is greater\n if (a > b) return GCD(a-b, b);\n return GCD(a, b-a);\n }\n static long LCM(long a, long b){\n return (a*b)/(GCD(a,b));\n }\n static String rev(String s){\n char[] arr = s.toCharArray();\n for(int i = 0; i<(s.length()+1)/2; i++){\n char temp = arr[i];\n arr[i] = arr[s.length()-i-1];\n arr[s.length()-i-1] = temp;\n }\n String fin = new String(arr);\n return fin;\n }\n static long pow(long a, long N) {\n if (N == 0) return 1;\n else if (N == 1) return a;\n else {\n long R = pow(a,N/2);\n if (N % 2 == 0) {\n return R*R;\n }\n else {\n return R*R*a;\n }\n }\n }\n\n static long powMod(long a, long N) {\n if (N == 0) return 1;\n else if (N == 1) return a % mod;\n else {\n long R = powMod(a,N/2) % mod;\n R *= R;\n R %= mod;\n if (N % 2 == 1) {\n R *= a;\n R %= mod;\n }\n return R % mod;\n }\n }\n\n}",
"Main",
"static long mod = (long)(Math.pow(10, 9) + 7);",
"mod",
"(long)(Math.pow(10, 9) + 7)",
"Math.pow(10, 9)",
"Math.pow",
"Math",
"10",
"9",
"7",
"public static String alpha = \"zabcdefghijklmnopqrstuvwxy\";",
"alpha",
"\"zabcdefghijklmnopqrstuvwxy\"",
"public static void main(String[] args) throws IOException{\n Scanner scan = new Scanner(System.in);\n long t = 1;\n while (t-- > 0){\n int n = scan.nextInt();\n long prod =1;\n long[] arr = new long[n];\n boolean hasZero = false;\n for(int i = 0;i<n; i++){\n arr[i] = scan.nextLong();\n if(arr[i] == 0) hasZero = true;\n }\n if(hasZero) {\n System.out.println(0);\n return;\n }\n for(int i = 0; i<n; i++){\n if(arr[i] <= (long)Math.pow(10,18)/prod) prod *= arr[i];\n else{\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(prod);\n\n }\n scan.close();\n\n }",
"main",
"{\n Scanner scan = new Scanner(System.in);\n long t = 1;\n while (t-- > 0){\n int n = scan.nextInt();\n long prod =1;\n long[] arr = new long[n];\n boolean hasZero = false;\n for(int i = 0;i<n; i++){\n arr[i] = scan.nextLong();\n if(arr[i] == 0) hasZero = true;\n }\n if(hasZero) {\n System.out.println(0);\n return;\n }\n for(int i = 0; i<n; i++){\n if(arr[i] <= (long)Math.pow(10,18)/prod) prod *= arr[i];\n else{\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(prod);\n\n }\n scan.close();\n\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"long t = 1;",
"t",
"1",
"while (t-- > 0){\n int n = scan.nextInt();\n long prod =1;\n long[] arr = new long[n];\n boolean hasZero = false;\n for(int i = 0;i<n; i++){\n arr[i] = scan.nextLong();\n if(arr[i] == 0) hasZero = true;\n }\n if(hasZero) {\n System.out.println(0);\n return;\n }\n for(int i = 0; i<n; i++){\n if(arr[i] <= (long)Math.pow(10,18)/prod) prod *= arr[i];\n else{\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(prod);\n\n }",
"t-- > 0",
"t--",
"t",
"0",
"{\n int n = scan.nextInt();\n long prod =1;\n long[] arr = new long[n];\n boolean hasZero = false;\n for(int i = 0;i<n; i++){\n arr[i] = scan.nextLong();\n if(arr[i] == 0) hasZero = true;\n }\n if(hasZero) {\n System.out.println(0);\n return;\n }\n for(int i = 0; i<n; i++){\n if(arr[i] <= (long)Math.pow(10,18)/prod) prod *= arr[i];\n else{\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(prod);\n\n }",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"long prod =1;",
"prod",
"1",
"long[] arr = new long[n];",
"arr",
"new long[n]",
"n",
"boolean hasZero = false;",
"hasZero",
"false",
"for(int i = 0;i<n; i++){\n arr[i] = scan.nextLong();\n if(arr[i] == 0) hasZero = true;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n arr[i] = scan.nextLong();\n if(arr[i] == 0) hasZero = true;\n }",
"{\n arr[i] = scan.nextLong();\n if(arr[i] == 0) hasZero = true;\n }",
"arr[i] = scan.nextLong()",
"arr[i]",
"arr",
"i",
"scan.nextLong()",
"scan.nextLong",
"scan",
"if(arr[i] == 0) hasZero = true;",
"arr[i] == 0",
"arr[i]",
"arr",
"i",
"0",
"hasZero = true",
"hasZero",
"true",
"if(hasZero) {\n System.out.println(0);\n return;\n }",
"hasZero",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"for(int i = 0; i<n; i++){\n if(arr[i] <= (long)Math.pow(10,18)/prod) prod *= arr[i];\n else{\n System.out.println(-1);\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(arr[i] <= (long)Math.pow(10,18)/prod) prod *= arr[i];\n else{\n System.out.println(-1);\n return;\n }\n }",
"{\n if(arr[i] <= (long)Math.pow(10,18)/prod) prod *= arr[i];\n else{\n System.out.println(-1);\n return;\n }\n }",
"if(arr[i] <= (long)Math.pow(10,18)/prod) prod *= arr[i];\n else{\n System.out.println(-1);\n return;\n }",
"arr[i] <= (long)Math.pow(10,18)/prod",
"arr[i]",
"arr",
"i",
"(long)Math.pow(10,18)/prod",
"(long)Math.pow(10,18)",
"Math.pow",
"Math",
"10",
"18",
"prod",
"prod *= arr[i]",
"prod",
"arr[i]",
"arr",
"i",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"System.out.println(prod)",
"System.out.println",
"System.out",
"System",
"System.out",
"prod",
"scan.close()",
"scan.close",
"scan",
"String[] args",
"args",
"static boolean isPalindrome(String s){\n for(int i = 0; i<s.length()/2; i++){\n if(s.charAt(i) != s.charAt(s.length()-i-1)) return false;\n }\n return true;\n }",
"isPalindrome",
"{\n for(int i = 0; i<s.length()/2; i++){\n if(s.charAt(i) != s.charAt(s.length()-i-1)) return false;\n }\n return true;\n }",
"for(int i = 0; i<s.length()/2; i++){\n if(s.charAt(i) != s.charAt(s.length()-i-1)) return false;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<s.length()/2",
"i",
"s.length()/2",
"s.length()",
"s.length",
"s",
"2",
"i++",
"i++",
"i",
"{\n if(s.charAt(i) != s.charAt(s.length()-i-1)) return false;\n }",
"{\n if(s.charAt(i) != s.charAt(s.length()-i-1)) return false;\n }",
"if(s.charAt(i) != s.charAt(s.length()-i-1)) return false;",
"s.charAt(i) != s.charAt(s.length()-i-1)",
"s.charAt(i)",
"s.charAt",
"s",
"i",
"s.charAt(s.length()-i-1)",
"s.charAt",
"s",
"s.length()-i-1",
"s.length()-i-1",
"s.length()",
"s.length",
"s",
"i",
"1",
"return false;",
"false",
"return true;",
"true",
"String s",
"s",
"static ArrayList factors(int n ){\n ArrayList<Integer> facts = new ArrayList<>();\n for(int i = 1; i<=(int)Math.sqrt(n); i++){\n if(n%i == 0){\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }\n }\n Collections.sort(facts);\n return facts;\n }",
"factors",
"{\n ArrayList<Integer> facts = new ArrayList<>();\n for(int i = 1; i<=(int)Math.sqrt(n); i++){\n if(n%i == 0){\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }\n }\n Collections.sort(facts);\n return facts;\n }",
"ArrayList<Integer> facts = new ArrayList<>();",
"facts",
"new ArrayList<>()",
"for(int i = 1; i<=(int)Math.sqrt(n); i++){\n if(n%i == 0){\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i<=(int)Math.sqrt(n)",
"i",
"(int)Math.sqrt(n)",
"Math.sqrt",
"Math",
"n",
"i++",
"i++",
"i",
"{\n if(n%i == 0){\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }\n }",
"{\n if(n%i == 0){\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }\n }",
"if(n%i == 0){\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }",
"n%i == 0",
"n%i",
"n",
"i",
"0",
"{\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }",
"if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }",
"i == Math.sqrt(n)",
"i",
"Math.sqrt(n)",
"Math.sqrt",
"Math",
"n",
"facts.add(i)",
"facts.add",
"facts",
"i",
"{\n facts.add(i);\n facts.add(n/i);\n }",
"facts.add(i)",
"facts.add",
"facts",
"i",
"facts.add(n/i)",
"facts.add",
"facts",
"n/i",
"n",
"i",
"Collections.sort(facts)",
"Collections.sort",
"Collections",
"facts",
"return facts;",
"facts",
"int n",
"n",
"static boolean isPrime (int n){\n if(factors(n).size() ==2) return true;\n else return false;\n }",
"isPrime",
"{\n if(factors(n).size() ==2) return true;\n else return false;\n }",
"if(factors(n).size() ==2) return true;\n else return false;",
"factors(n).size() ==2",
"factors(n).size()",
"factors(n).size",
"factors(n)",
"factors",
"n",
"2",
"return true;",
"true",
"return false;",
"false",
"int n",
"n",
"static long GCD(long a, long b) {\n // Everything divides 0\n if (a == 0) return b;\n if (b == 0) return a;\n\n // base case\n if (a == b) return a;\n\n // a is greater\n if (a > b) return GCD(a-b, b);\n return GCD(a, b-a);\n }",
"GCD",
"{\n // Everything divides 0\n if (a == 0) return b;\n if (b == 0) return a;\n\n // base case\n if (a == b) return a;\n\n // a is greater\n if (a > b) return GCD(a-b, b);\n return GCD(a, b-a);\n }",
"if (a == 0) return b;",
"a == 0",
"a",
"0",
"return b;",
"b",
"if (b == 0) return a;",
"b == 0",
"b",
"0",
"return a;",
"a",
"if (a == b) return a;",
"a == b",
"a",
"b",
"return a;",
"a",
"if (a > b) return GCD(a-b, b);",
"a > b",
"a",
"b",
"return GCD(a-b, b);",
"GCD(a-b, b)",
"GCD",
"a-b",
"a",
"b",
"b",
"return GCD(a, b-a);",
"GCD(a, b-a)",
"GCD",
"a",
"b-a",
"b",
"a",
"long a",
"a",
"long b",
"b",
"static long LCM(long a, long b){\n return (a*b)/(GCD(a,b));\n }",
"LCM",
"{\n return (a*b)/(GCD(a,b));\n }",
"return (a*b)/(GCD(a,b));",
"(a*b)/(GCD(a,b))",
"(a*b)",
"a",
"b",
"(GCD(a,b))",
"GCD",
"a",
"b",
"long a",
"a",
"long b",
"b",
"static String rev(String s){\n char[] arr = s.toCharArray();\n for(int i = 0; i<(s.length()+1)/2; i++){\n char temp = arr[i];\n arr[i] = arr[s.length()-i-1];\n arr[s.length()-i-1] = temp;\n }\n String fin = new String(arr);\n return fin;\n }",
"rev",
"{\n char[] arr = s.toCharArray();\n for(int i = 0; i<(s.length()+1)/2; i++){\n char temp = arr[i];\n arr[i] = arr[s.length()-i-1];\n arr[s.length()-i-1] = temp;\n }\n String fin = new String(arr);\n return fin;\n }",
"char[] arr = s.toCharArray();",
"arr",
"s.toCharArray()",
"s.toCharArray",
"s",
"for(int i = 0; i<(s.length()+1)/2; i++){\n char temp = arr[i];\n arr[i] = arr[s.length()-i-1];\n arr[s.length()-i-1] = temp;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<(s.length()+1)/2",
"i",
"(s.length()+1)/2",
"(s.length()+1)",
"s.length()",
"s.length",
"s",
"1",
"2",
"i++",
"i++",
"i",
"{\n char temp = arr[i];\n arr[i] = arr[s.length()-i-1];\n arr[s.length()-i-1] = temp;\n }",
"{\n char temp = arr[i];\n arr[i] = arr[s.length()-i-1];\n arr[s.length()-i-1] = temp;\n }",
"char temp = arr[i];",
"temp",
"arr[i]",
"arr",
"i",
"arr[i] = arr[s.length()-i-1]",
"arr[i]",
"arr",
"i",
"arr[s.length()-i-1]",
"arr",
"s.length()-i-1",
"s.length()-i-1",
"s.length()",
"s.length",
"s",
"i",
"1",
"arr[s.length()-i-1] = temp",
"arr[s.length()-i-1]",
"arr",
"s.length()-i-1",
"s.length()-i-1",
"s.length()",
"s.length",
"s",
"i",
"1",
"temp",
"String fin = new String(arr);",
"fin",
"new String(arr)",
"return fin;",
"fin",
"String s",
"s",
"static long pow(long a, long N) {\n if (N == 0) return 1;\n else if (N == 1) return a;\n else {\n long R = pow(a,N/2);\n if (N % 2 == 0) {\n return R*R;\n }\n else {\n return R*R*a;\n }\n }\n }",
"pow",
"{\n if (N == 0) return 1;\n else if (N == 1) return a;\n else {\n long R = pow(a,N/2);\n if (N % 2 == 0) {\n return R*R;\n }\n else {\n return R*R*a;\n }\n }\n }",
"if (N == 0) return 1;\n else if (N == 1) return a;\n else {\n long R = pow(a,N/2);\n if (N % 2 == 0) {\n return R*R;\n }\n else {\n return R*R*a;\n }\n }",
"N == 0",
"N",
"0",
"return 1;",
"1",
"if (N == 1) return a;\n else {\n long R = pow(a,N/2);\n if (N % 2 == 0) {\n return R*R;\n }\n else {\n return R*R*a;\n }\n }",
"N == 1",
"N",
"1",
"return a;",
"a",
"{\n long R = pow(a,N/2);\n if (N % 2 == 0) {\n return R*R;\n }\n else {\n return R*R*a;\n }\n }",
"long R = pow(a,N/2);",
"R",
"pow(a,N/2)",
"pow",
"a",
"N/2",
"N",
"2",
"if (N % 2 == 0) {\n return R*R;\n }\n else {\n return R*R*a;\n }",
"N % 2 == 0",
"N % 2",
"N",
"2",
"0",
"{\n return R*R;\n }",
"return R*R;",
"R*R",
"R",
"R",
"{\n return R*R*a;\n }",
"return R*R*a;",
"R*R*a",
"R*R*a",
"R",
"R",
"a",
"long a",
"a",
"long N",
"N",
"static long powMod(long a, long N) {\n if (N == 0) return 1;\n else if (N == 1) return a % mod;\n else {\n long R = powMod(a,N/2) % mod;\n R *= R;\n R %= mod;\n if (N % 2 == 1) {\n R *= a;\n R %= mod;\n }\n return R % mod;\n }\n }",
"powMod",
"{\n if (N == 0) return 1;\n else if (N == 1) return a % mod;\n else {\n long R = powMod(a,N/2) % mod;\n R *= R;\n R %= mod;\n if (N % 2 == 1) {\n R *= a;\n R %= mod;\n }\n return R % mod;\n }\n }",
"if (N == 0) return 1;\n else if (N == 1) return a % mod;\n else {\n long R = powMod(a,N/2) % mod;\n R *= R;\n R %= mod;\n if (N % 2 == 1) {\n R *= a;\n R %= mod;\n }\n return R % mod;\n }",
"N == 0",
"N",
"0",
"return 1;",
"1",
"if (N == 1) return a % mod;\n else {\n long R = powMod(a,N/2) % mod;\n R *= R;\n R %= mod;\n if (N % 2 == 1) {\n R *= a;\n R %= mod;\n }\n return R % mod;\n }",
"N == 1",
"N",
"1",
"return a % mod;",
"a % mod",
"a",
"mod",
"{\n long R = powMod(a,N/2) % mod;\n R *= R;\n R %= mod;\n if (N % 2 == 1) {\n R *= a;\n R %= mod;\n }\n return R % mod;\n }",
"long R = powMod(a,N/2) % mod;",
"R",
"powMod(a,N/2) % mod",
"powMod(a,N/2)",
"powMod",
"a",
"N/2",
"N",
"2",
"mod",
"R *= R",
"R",
"R",
"R %= mod",
"R",
"mod",
"if (N % 2 == 1) {\n R *= a;\n R %= mod;\n }",
"N % 2 == 1",
"N % 2",
"N",
"2",
"1",
"{\n R *= a;\n R %= mod;\n }",
"R *= a",
"R",
"a",
"R %= mod",
"R",
"mod",
"return R % mod;",
"R % mod",
"R",
"mod",
"long a",
"a",
"long N",
"N",
"public class Main {\n static long mod = (long)(Math.pow(10, 9) + 7);\n public static String alpha = \"zabcdefghijklmnopqrstuvwxy\";\n public static void main(String[] args) throws IOException{\n Scanner scan = new Scanner(System.in);\n long t = 1;\n while (t-- > 0){\n int n = scan.nextInt();\n long prod =1;\n long[] arr = new long[n];\n boolean hasZero = false;\n for(int i = 0;i<n; i++){\n arr[i] = scan.nextLong();\n if(arr[i] == 0) hasZero = true;\n }\n if(hasZero) {\n System.out.println(0);\n return;\n }\n for(int i = 0; i<n; i++){\n if(arr[i] <= (long)Math.pow(10,18)/prod) prod *= arr[i];\n else{\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(prod);\n\n }\n scan.close();\n\n }\n\n\n static boolean isPalindrome(String s){\n for(int i = 0; i<s.length()/2; i++){\n if(s.charAt(i) != s.charAt(s.length()-i-1)) return false;\n }\n return true;\n }\n\n static ArrayList factors(int n ){\n ArrayList<Integer> facts = new ArrayList<>();\n for(int i = 1; i<=(int)Math.sqrt(n); i++){\n if(n%i == 0){\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }\n }\n Collections.sort(facts);\n return facts;\n }\n\n static boolean isPrime (int n){\n if(factors(n).size() ==2) return true;\n else return false;\n }\n\n\n\n\n\n static long GCD(long a, long b) {\n // Everything divides 0\n if (a == 0) return b;\n if (b == 0) return a;\n\n // base case\n if (a == b) return a;\n\n // a is greater\n if (a > b) return GCD(a-b, b);\n return GCD(a, b-a);\n }\n static long LCM(long a, long b){\n return (a*b)/(GCD(a,b));\n }\n static String rev(String s){\n char[] arr = s.toCharArray();\n for(int i = 0; i<(s.length()+1)/2; i++){\n char temp = arr[i];\n arr[i] = arr[s.length()-i-1];\n arr[s.length()-i-1] = temp;\n }\n String fin = new String(arr);\n return fin;\n }\n static long pow(long a, long N) {\n if (N == 0) return 1;\n else if (N == 1) return a;\n else {\n long R = pow(a,N/2);\n if (N % 2 == 0) {\n return R*R;\n }\n else {\n return R*R*a;\n }\n }\n }\n\n static long powMod(long a, long N) {\n if (N == 0) return 1;\n else if (N == 1) return a % mod;\n else {\n long R = powMod(a,N/2) % mod;\n R *= R;\n R %= mod;\n if (N % 2 == 1) {\n R *= a;\n R %= mod;\n }\n return R % mod;\n }\n }\n\n}",
"public class Main {\n static long mod = (long)(Math.pow(10, 9) + 7);\n public static String alpha = \"zabcdefghijklmnopqrstuvwxy\";\n public static void main(String[] args) throws IOException{\n Scanner scan = new Scanner(System.in);\n long t = 1;\n while (t-- > 0){\n int n = scan.nextInt();\n long prod =1;\n long[] arr = new long[n];\n boolean hasZero = false;\n for(int i = 0;i<n; i++){\n arr[i] = scan.nextLong();\n if(arr[i] == 0) hasZero = true;\n }\n if(hasZero) {\n System.out.println(0);\n return;\n }\n for(int i = 0; i<n; i++){\n if(arr[i] <= (long)Math.pow(10,18)/prod) prod *= arr[i];\n else{\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(prod);\n\n }\n scan.close();\n\n }\n\n\n static boolean isPalindrome(String s){\n for(int i = 0; i<s.length()/2; i++){\n if(s.charAt(i) != s.charAt(s.length()-i-1)) return false;\n }\n return true;\n }\n\n static ArrayList factors(int n ){\n ArrayList<Integer> facts = new ArrayList<>();\n for(int i = 1; i<=(int)Math.sqrt(n); i++){\n if(n%i == 0){\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }\n }\n Collections.sort(facts);\n return facts;\n }\n\n static boolean isPrime (int n){\n if(factors(n).size() ==2) return true;\n else return false;\n }\n\n\n\n\n\n static long GCD(long a, long b) {\n // Everything divides 0\n if (a == 0) return b;\n if (b == 0) return a;\n\n // base case\n if (a == b) return a;\n\n // a is greater\n if (a > b) return GCD(a-b, b);\n return GCD(a, b-a);\n }\n static long LCM(long a, long b){\n return (a*b)/(GCD(a,b));\n }\n static String rev(String s){\n char[] arr = s.toCharArray();\n for(int i = 0; i<(s.length()+1)/2; i++){\n char temp = arr[i];\n arr[i] = arr[s.length()-i-1];\n arr[s.length()-i-1] = temp;\n }\n String fin = new String(arr);\n return fin;\n }\n static long pow(long a, long N) {\n if (N == 0) return 1;\n else if (N == 1) return a;\n else {\n long R = pow(a,N/2);\n if (N % 2 == 0) {\n return R*R;\n }\n else {\n return R*R*a;\n }\n }\n }\n\n static long powMod(long a, long N) {\n if (N == 0) return 1;\n else if (N == 1) return a % mod;\n else {\n long R = powMod(a,N/2) % mod;\n R *= R;\n R %= mod;\n if (N % 2 == 1) {\n R *= a;\n R %= mod;\n }\n return R % mod;\n }\n }\n\n}",
"Main"
] |
import java.lang.reflect.Array;
import java.util.*;
import java.io.* ;
/*
NOTES:
-more than 10 digits (10^10), use long
-prefix sum of 1's and -1's to control flow of highlighting a region
-log(a)/log(b) = log base b of a
-create a position array if trying to see if elements show up next to each other sequentially
i.e. elements 1,2,3 are within 3 spots of each other in an array
arr[scannedInt - 1] = i; (position of i at p[i] in original)
- use a freq array when counting instances of an element occurring
- increment the counter first before simulating anything turn-based (two player game)
*/
public class Main {
static long mod = (long)(Math.pow(10, 9) + 7);
public static String alpha = "zabcdefghijklmnopqrstuvwxy";
public static void main(String[] args) throws IOException{
Scanner scan = new Scanner(System.in);
long t = 1;
while (t-- > 0){
int n = scan.nextInt();
long prod =1;
long[] arr = new long[n];
boolean hasZero = false;
for(int i = 0;i<n; i++){
arr[i] = scan.nextLong();
if(arr[i] == 0) hasZero = true;
}
if(hasZero) {
System.out.println(0);
return;
}
for(int i = 0; i<n; i++){
if(arr[i] <= (long)Math.pow(10,18)/prod) prod *= arr[i];
else{
System.out.println(-1);
return;
}
}
System.out.println(prod);
}
scan.close();
}
static boolean isPalindrome(String s){
for(int i = 0; i<s.length()/2; i++){
if(s.charAt(i) != s.charAt(s.length()-i-1)) return false;
}
return true;
}
static ArrayList factors(int n ){
ArrayList<Integer> facts = new ArrayList<>();
for(int i = 1; i<=(int)Math.sqrt(n); i++){
if(n%i == 0){
if( i == Math.sqrt(n)) facts.add(i);
else{
facts.add(i);
facts.add(n/i);
}
}
}
Collections.sort(facts);
return facts;
}
static boolean isPrime (int n){
if(factors(n).size() ==2) return true;
else return false;
}
static long GCD(long a, long b) {
// Everything divides 0
if (a == 0) return b;
if (b == 0) return a;
// base case
if (a == b) return a;
// a is greater
if (a > b) return GCD(a-b, b);
return GCD(a, b-a);
}
static long LCM(long a, long b){
return (a*b)/(GCD(a,b));
}
static String rev(String s){
char[] arr = s.toCharArray();
for(int i = 0; i<(s.length()+1)/2; i++){
char temp = arr[i];
arr[i] = arr[s.length()-i-1];
arr[s.length()-i-1] = temp;
}
String fin = new String(arr);
return fin;
}
static long pow(long a, long N) {
if (N == 0) return 1;
else if (N == 1) return a;
else {
long R = pow(a,N/2);
if (N % 2 == 0) {
return R*R;
}
else {
return R*R*a;
}
}
}
static long powMod(long a, long N) {
if (N == 0) return 1;
else if (N == 1) return a % mod;
else {
long R = powMod(a,N/2) % mod;
R *= R;
R %= mod;
if (N % 2 == 1) {
R *= a;
R %= mod;
}
return R % mod;
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
20,
41,
13,
20,
4,
18,
13,
13,
41,
13,
18,
13,
17,
14,
2,
4,
18,
13,
17,
30,
4,
18,
18,
13,
13,
17,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
0,
13,
17,
3,
14,
40,
13,
30,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
127,
11
],
[
127,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
14,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
32,
33
],
[
32,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
27,
38
],
[
39,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
14,
45
],
[
45,
46
],
[
45,
47
],
[
14,
48
],
[
48,
49
],
[
49,
50
],
[
48,
51
],
[
14,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
54,
56
],
[
14,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
58,
62
],
[
57,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
64,
69
],
[
57,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
79,
80
],
[
79,
81
],
[
74,
82
],
[
82,
83
],
[
83,
84
],
[
74,
85
],
[
86,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
92,
93
],
[
92,
94
],
[
86,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
96,
101
],
[
95,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
108,
109
],
[
102,
110
],
[
110,
111
],
[
110,
112
],
[
102,
113
],
[
70,
114
],
[
114,
115
],
[
115,
116
],
[
114,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
12,
124
],
[
124,
125
],
[
0,
126
],
[
126,
127
],
[
126,
128
]
] |
[
"import java.math.BigDecimal;\nimport java.util.Arrays;\nimport java.util.Scanner;\n \npublic class Main {\n \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n BigDecimal[] nums = new BigDecimal[N];\n for (int i = 0; i < N; i++) {\n nums[i] = new BigDecimal(sc.next());\n }\n final BigDecimal limit = new BigDecimal(\"1000000000000000000\");\n Arrays.sort(nums);\n BigDecimal ans = nums[0];\n if (ans.longValue() == 0) {\n System.out.println(0);\n } else {\n boolean over = false;\n for (int i = 1; i < N; i++) {\n ans = ans.multiply(nums[i]);\n if (limit.compareTo(ans) < 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }\n if (!over) {\n System.out.println(ans);\n }\n }\n }\n}",
"import java.math.BigDecimal;",
"BigDecimal",
"java.math",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n BigDecimal[] nums = new BigDecimal[N];\n for (int i = 0; i < N; i++) {\n nums[i] = new BigDecimal(sc.next());\n }\n final BigDecimal limit = new BigDecimal(\"1000000000000000000\");\n Arrays.sort(nums);\n BigDecimal ans = nums[0];\n if (ans.longValue() == 0) {\n System.out.println(0);\n } else {\n boolean over = false;\n for (int i = 1; i < N; i++) {\n ans = ans.multiply(nums[i]);\n if (limit.compareTo(ans) < 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }\n if (!over) {\n System.out.println(ans);\n }\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n BigDecimal[] nums = new BigDecimal[N];\n for (int i = 0; i < N; i++) {\n nums[i] = new BigDecimal(sc.next());\n }\n final BigDecimal limit = new BigDecimal(\"1000000000000000000\");\n Arrays.sort(nums);\n BigDecimal ans = nums[0];\n if (ans.longValue() == 0) {\n System.out.println(0);\n } else {\n boolean over = false;\n for (int i = 1; i < N; i++) {\n ans = ans.multiply(nums[i]);\n if (limit.compareTo(ans) < 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }\n if (!over) {\n System.out.println(ans);\n }\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n BigDecimal[] nums = new BigDecimal[N];\n for (int i = 0; i < N; i++) {\n nums[i] = new BigDecimal(sc.next());\n }\n final BigDecimal limit = new BigDecimal(\"1000000000000000000\");\n Arrays.sort(nums);\n BigDecimal ans = nums[0];\n if (ans.longValue() == 0) {\n System.out.println(0);\n } else {\n boolean over = false;\n for (int i = 1; i < N; i++) {\n ans = ans.multiply(nums[i]);\n if (limit.compareTo(ans) < 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }\n if (!over) {\n System.out.println(ans);\n }\n }\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BigDecimal[] nums = new BigDecimal[N];",
"nums",
"new BigDecimal[N]",
"N",
"for (int i = 0; i < N; i++) {\n nums[i] = new BigDecimal(sc.next());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n nums[i] = new BigDecimal(sc.next());\n }",
"{\n nums[i] = new BigDecimal(sc.next());\n }",
"nums[i] = new BigDecimal(sc.next())",
"nums[i]",
"nums",
"i",
"new BigDecimal(sc.next())",
"final BigDecimal limit = new BigDecimal(\"1000000000000000000\");",
"limit",
"new BigDecimal(\"1000000000000000000\")",
"Arrays.sort(nums)",
"Arrays.sort",
"Arrays",
"nums",
"BigDecimal ans = nums[0];",
"ans",
"nums[0]",
"nums",
"0",
"if (ans.longValue() == 0) {\n System.out.println(0);\n } else {\n boolean over = false;\n for (int i = 1; i < N; i++) {\n ans = ans.multiply(nums[i]);\n if (limit.compareTo(ans) < 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }\n if (!over) {\n System.out.println(ans);\n }\n }",
"ans.longValue() == 0",
"ans.longValue()",
"ans.longValue",
"ans",
"0",
"{\n System.out.println(0);\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"{\n boolean over = false;\n for (int i = 1; i < N; i++) {\n ans = ans.multiply(nums[i]);\n if (limit.compareTo(ans) < 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }\n if (!over) {\n System.out.println(ans);\n }\n }",
"boolean over = false;",
"over",
"false",
"for (int i = 1; i < N; i++) {\n ans = ans.multiply(nums[i]);\n if (limit.compareTo(ans) < 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n ans = ans.multiply(nums[i]);\n if (limit.compareTo(ans) < 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }",
"{\n ans = ans.multiply(nums[i]);\n if (limit.compareTo(ans) < 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }",
"ans = ans.multiply(nums[i])",
"ans",
"ans.multiply(nums[i])",
"ans.multiply",
"ans",
"nums[i]",
"nums",
"i",
"if (limit.compareTo(ans) < 0) {\n System.out.println(-1);\n over = true;\n break;\n }",
"limit.compareTo(ans) < 0",
"limit.compareTo(ans)",
"limit.compareTo",
"limit",
"ans",
"0",
"{\n System.out.println(-1);\n over = true;\n break;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"over = true",
"over",
"true",
"break;",
"if (!over) {\n System.out.println(ans);\n }",
"!over",
"over",
"{\n System.out.println(ans);\n }",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n BigDecimal[] nums = new BigDecimal[N];\n for (int i = 0; i < N; i++) {\n nums[i] = new BigDecimal(sc.next());\n }\n final BigDecimal limit = new BigDecimal(\"1000000000000000000\");\n Arrays.sort(nums);\n BigDecimal ans = nums[0];\n if (ans.longValue() == 0) {\n System.out.println(0);\n } else {\n boolean over = false;\n for (int i = 1; i < N; i++) {\n ans = ans.multiply(nums[i]);\n if (limit.compareTo(ans) < 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }\n if (!over) {\n System.out.println(ans);\n }\n }\n }\n}",
"public class Main {\n \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n BigDecimal[] nums = new BigDecimal[N];\n for (int i = 0; i < N; i++) {\n nums[i] = new BigDecimal(sc.next());\n }\n final BigDecimal limit = new BigDecimal(\"1000000000000000000\");\n Arrays.sort(nums);\n BigDecimal ans = nums[0];\n if (ans.longValue() == 0) {\n System.out.println(0);\n } else {\n boolean over = false;\n for (int i = 1; i < N; i++) {\n ans = ans.multiply(nums[i]);\n if (limit.compareTo(ans) < 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }\n if (!over) {\n System.out.println(ans);\n }\n }\n }\n}",
"Main"
] |
import java.math.BigDecimal;
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();
BigDecimal[] nums = new BigDecimal[N];
for (int i = 0; i < N; i++) {
nums[i] = new BigDecimal(sc.next());
}
final BigDecimal limit = new BigDecimal("1000000000000000000");
Arrays.sort(nums);
BigDecimal ans = nums[0];
if (ans.longValue() == 0) {
System.out.println(0);
} else {
boolean over = false;
for (int i = 1; i < N; i++) {
ans = ans.multiply(nums[i]);
if (limit.compareTo(ans) < 0) {
System.out.println(-1);
over = true;
break;
}
}
if (!over) {
System.out.println(ans);
}
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
17,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
41,
13,
4,
13,
41,
13,
4,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
0,
13,
17,
0,
13,
17,
3,
14,
2,
13,
2,
17,
18,
13,
13,
30,
0,
13,
17,
14,
40,
13,
30,
0,
13,
18,
13,
13,
14,
2,
13,
40,
13,
30,
4,
13,
17,
29,
4,
13,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
4,
18,
13,
18,
13,
13,
30,
29,
13,
29,
40,
17,
23,
13,
23,
13,
12,
13,
30,
41,
13,
4,
13,
13,
4,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
14,
2,
2,
13,
17,
2,
13,
18,
13,
13,
30,
0,
13,
4,
13,
0,
13,
17,
29,
18,
13,
40,
13,
12,
13,
30,
14,
2,
2,
13,
17,
2,
13,
18,
13,
13,
30,
0,
13,
4,
13,
0,
13,
17,
29,
18,
13,
40,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
29,
20,
30,
29,
4,
18,
4,
18,
13,
17,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
29,
17,
30,
41,
13,
4,
13,
41,
13,
20,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
29,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
29,
17,
30,
41,
13,
4,
13,
41,
13,
20,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
29,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
29,
17,
30,
41,
13,
4,
13,
41,
13,
20,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
29,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
29,
17,
30,
41,
13,
4,
13,
41,
13,
20,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
29,
13,
12,
13,
30,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
4,
18,
18,
13,
13,
12,
13,
30,
14,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
14,
13,
4,
18,
18,
13,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
554,
17
],
[
554,
18
],
[
18,
19
],
[
554,
20
],
[
20,
21
],
[
20,
22
],
[
554,
23
],
[
23,
24
],
[
554,
25
],
[
25,
26
],
[
554,
27
],
[
27,
28
],
[
554,
29
],
[
29,
30
],
[
554,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
37,
38
],
[
37,
39
],
[
39,
40
],
[
33,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
33,
45
],
[
45,
46
],
[
45,
47
],
[
33,
48
],
[
48,
49
],
[
48,
50
],
[
33,
51
],
[
51,
52
],
[
51,
53
],
[
33,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
59,
60
],
[
59,
61
],
[
54,
62
],
[
62,
63
],
[
63,
64
],
[
54,
65
],
[
66,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
67,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
77,
79
],
[
73,
80
],
[
67,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
81,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
81,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
33,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
102,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
33,
112
],
[
112,
113
],
[
112,
114
],
[
31,
115
],
[
115,
116
],
[
554,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
127,
129
],
[
120,
130
],
[
130,
131
],
[
131,
132
],
[
120,
133
],
[
134,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
136,
139
],
[
139,
140
],
[
139,
141
],
[
135,
142
],
[
142,
143
],
[
143,
144
],
[
119,
145
],
[
145,
146
],
[
146,
147
],
[
117,
148
],
[
148,
149
],
[
117,
150
],
[
150,
151
],
[
554,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
157,
159
],
[
154,
160
],
[
160,
161
],
[
161,
162
],
[
160,
163
],
[
154,
164
],
[
164,
165
],
[
152,
166
],
[
166,
167
],
[
554,
168
],
[
168,
169
],
[
168,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
174,
175
],
[
174,
176
],
[
170,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
177,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
184,
186
],
[
177,
187
],
[
187,
188
],
[
188,
189
],
[
177,
190
],
[
191,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
193,
195
],
[
192,
196
],
[
196,
197
],
[
196,
198
],
[
170,
199
],
[
199,
200
],
[
168,
201
],
[
201,
202
],
[
554,
203
],
[
203,
204
],
[
203,
205
],
[
205,
206
],
[
206,
207
],
[
206,
208
],
[
209,
210
],
[
210,
211
],
[
205,
212
],
[
212,
213
],
[
213,
214
],
[
214,
215
],
[
214,
216
],
[
212,
217
],
[
217,
218
],
[
217,
219
],
[
219,
220
],
[
219,
221
],
[
212,
222
],
[
222,
223
],
[
223,
224
],
[
212,
225
],
[
226,
226
],
[
226,
227
],
[
227,
228
],
[
228,
229
],
[
228,
230
],
[
227,
231
],
[
231,
232
],
[
232,
233
],
[
231,
234
],
[
205,
235
],
[
235,
236
],
[
203,
237
],
[
237,
238
],
[
554,
239
],
[
239,
240
],
[
239,
241
],
[
241,
242
],
[
242,
243
],
[
243,
244
],
[
244,
245
],
[
244,
246
],
[
243,
247
],
[
247,
248
],
[
247,
249
],
[
249,
250
],
[
249,
251
],
[
242,
252
],
[
252,
253
],
[
253,
254
],
[
253,
255
],
[
255,
256
],
[
252,
257
],
[
257,
258
],
[
257,
259
],
[
241,
260
],
[
260,
261
],
[
261,
262
],
[
261,
263
],
[
263,
264
],
[
554,
265
],
[
265,
266
],
[
265,
267
],
[
267,
268
],
[
268,
269
],
[
269,
270
],
[
270,
271
],
[
270,
272
],
[
269,
273
],
[
273,
274
],
[
273,
275
],
[
275,
276
],
[
275,
277
],
[
268,
278
],
[
278,
279
],
[
279,
280
],
[
279,
281
],
[
281,
282
],
[
278,
283
],
[
283,
284
],
[
283,
285
],
[
267,
286
],
[
286,
287
],
[
287,
288
],
[
287,
289
],
[
289,
290
],
[
554,
291
],
[
291,
292
],
[
291,
293
],
[
293,
294
],
[
294,
295
],
[
295,
296
],
[
295,
297
],
[
297,
298
],
[
298,
299
],
[
299,
300
],
[
297,
301
],
[
301,
302
],
[
294,
303
],
[
303,
304
],
[
304,
305
],
[
305,
306
],
[
306,
307
],
[
307,
308
],
[
308,
309
],
[
305,
310
],
[
554,
311
],
[
311,
312
],
[
311,
313
],
[
313,
314
],
[
314,
315
],
[
315,
316
],
[
315,
317
],
[
317,
318
],
[
318,
319
],
[
319,
320
],
[
317,
321
],
[
321,
322
],
[
314,
323
],
[
323,
324
],
[
324,
325
],
[
324,
326
],
[
326,
327
],
[
323,
328
],
[
328,
329
],
[
328,
330
],
[
331,
332
],
[
331,
333
],
[
323,
334
],
[
334,
335
],
[
335,
336
],
[
336,
337
],
[
336,
338
],
[
334,
339
],
[
339,
340
],
[
339,
341
],
[
341,
342
],
[
341,
343
],
[
334,
344
],
[
344,
345
],
[
345,
346
],
[
334,
347
],
[
348,
348
],
[
348,
349
],
[
349,
350
],
[
350,
351
],
[
350,
352
],
[
349,
353
],
[
353,
354
],
[
354,
355
],
[
353,
356
],
[
356,
357
],
[
356,
358
],
[
323,
359
],
[
359,
360
],
[
554,
361
],
[
361,
362
],
[
361,
363
],
[
363,
364
],
[
364,
365
],
[
365,
366
],
[
365,
367
],
[
367,
368
],
[
368,
369
],
[
369,
370
],
[
367,
371
],
[
371,
372
],
[
364,
373
],
[
373,
374
],
[
374,
375
],
[
374,
376
],
[
376,
377
],
[
373,
378
],
[
378,
379
],
[
378,
380
],
[
381,
382
],
[
381,
383
],
[
373,
384
],
[
384,
385
],
[
385,
386
],
[
386,
387
],
[
386,
388
],
[
384,
389
],
[
389,
390
],
[
389,
391
],
[
391,
392
],
[
391,
393
],
[
384,
394
],
[
394,
395
],
[
395,
396
],
[
384,
397
],
[
398,
398
],
[
398,
399
],
[
399,
400
],
[
400,
401
],
[
400,
402
],
[
399,
403
],
[
403,
404
],
[
404,
405
],
[
403,
406
],
[
406,
407
],
[
406,
408
],
[
373,
409
],
[
409,
410
],
[
554,
411
],
[
411,
412
],
[
411,
413
],
[
413,
414
],
[
414,
415
],
[
415,
416
],
[
415,
417
],
[
417,
418
],
[
418,
419
],
[
419,
420
],
[
417,
421
],
[
421,
422
],
[
414,
423
],
[
423,
424
],
[
424,
425
],
[
424,
426
],
[
426,
427
],
[
423,
428
],
[
428,
429
],
[
428,
430
],
[
431,
432
],
[
431,
433
],
[
423,
434
],
[
434,
435
],
[
435,
436
],
[
436,
437
],
[
436,
438
],
[
434,
439
],
[
439,
440
],
[
439,
441
],
[
441,
442
],
[
441,
443
],
[
434,
444
],
[
444,
445
],
[
445,
446
],
[
434,
447
],
[
448,
448
],
[
448,
449
],
[
449,
450
],
[
450,
451
],
[
450,
452
],
[
449,
453
],
[
453,
454
],
[
454,
455
],
[
453,
456
],
[
456,
457
],
[
456,
458
],
[
423,
459
],
[
459,
460
],
[
554,
461
],
[
461,
462
],
[
461,
463
],
[
463,
464
],
[
464,
465
],
[
465,
466
],
[
465,
467
],
[
467,
468
],
[
468,
469
],
[
469,
470
],
[
467,
471
],
[
471,
472
],
[
464,
473
],
[
473,
474
],
[
474,
475
],
[
474,
476
],
[
476,
477
],
[
473,
478
],
[
478,
479
],
[
478,
480
],
[
481,
482
],
[
481,
483
],
[
473,
484
],
[
484,
485
],
[
485,
486
],
[
486,
487
],
[
486,
488
],
[
484,
489
],
[
489,
490
],
[
489,
491
],
[
491,
492
],
[
491,
493
],
[
484,
494
],
[
494,
495
],
[
495,
496
],
[
484,
497
],
[
498,
498
],
[
498,
499
],
[
499,
500
],
[
500,
501
],
[
500,
502
],
[
499,
503
],
[
503,
504
],
[
504,
505
],
[
503,
506
],
[
506,
507
],
[
506,
508
],
[
473,
509
],
[
509,
510
],
[
554,
511
],
[
511,
512
],
[
511,
513
],
[
513,
514
],
[
514,
515
],
[
515,
516
],
[
516,
517
],
[
516,
518
],
[
514,
519
],
[
511,
520
],
[
520,
521
],
[
554,
522
],
[
522,
523
],
[
522,
524
],
[
524,
525
],
[
525,
526
],
[
526,
527
],
[
527,
528
],
[
527,
529
],
[
554,
530
],
[
530,
531
],
[
530,
532
],
[
532,
533
],
[
533,
534
],
[
533,
535
],
[
535,
536
],
[
536,
537
],
[
537,
538
],
[
537,
539
],
[
535,
540
],
[
530,
541
],
[
541,
542
],
[
554,
543
],
[
543,
544
],
[
543,
545
],
[
545,
546
],
[
546,
547
],
[
546,
548
],
[
548,
549
],
[
549,
550
],
[
550,
551
],
[
550,
552
],
[
0,
553
],
[
553,
554
],
[
553,
555
]
] |
[
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.Arrays;\n\npublic class Main {\n\n\tstatic BufferedReader reader;\n\tfinal static boolean MODE_DEBUG = false;\n\tstatic String[] read_line;\n\tstatic int read_line_ptr;\n\tstatic int[] read_line_int;\n\tstatic int read_line_int_ptr;\n\t//static field here\n\t\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t\t//code here\n\t\tint N = readInt();\n\t\tlong[] a = readLineLong();\n\t\tlong ans = 1;\n\t\tboolean fail = false;\n\t\tboolean zero = false;\n\t\tfor(int i=0;i<N;i++) {\n\t\t\t\n\t\t\tif(a[i]==0) {\n\t\t\t\tzero = true;\n\t\t\t\tans=0;\n\t\t\t\tbreak;\n\t\t\t}else if(ans>1000000000000000000l/a[i]) {\n\t\t\t\tfail = true;\n\t\t\t}else if(!fail) {\n\t\t\t\tans*=a[i];\n\t\t\t}\n\t\t}\n\t\tif(fail&&!zero) {print(\"-1\");return;}\n\t\tprint(ans);\n\t\t//String[] s = readLine();\n\t\t//print(num);\n\t}\n\t\n\t//functions here\n\t//note that all methods should be STATIC\n\n\n\tprivate static <T> int arraySearch(T needle, T[] heystack) {\n\t\tfor(int i=0;i<heystack.length;i++) {\n\t\t\tif(needle.equals(heystack[i])) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n\tprivate static int[] sort(int[] base) {\n\t\tint[] copy = array_copy(base);\n\t\tArrays.sort(copy);\n\t\treturn copy;\n\t}\n\tprivate static int[] array_copy(int[] base) {\n\t\tint[] copy = new int[base.length];\n\t\tfor(int i=0;i<base.length;i++) {\n\t\t\tcopy[i] = base[i];\n\t\t}\n\t\treturn copy;\n\t}\n\tprivate static int[] asArray(ArrayList<Integer> ints) {\n\t\tint[] intlist = new int[ints.size()];\n\t\tfor(int i=0;i<intlist.length;i++) {\n\t\t\tintlist[i] = ints.get(i);\n\t\t}\n\t\treturn intlist;\n\t}\n\tprivate static int readInt() {\n\t\tif(read_line_int==null||read_line_int_ptr==read_line_int.length) {\n\t\t\tread_line_int = readLineInt();\n\t\t\tread_line_int_ptr=0;\n\t\t}\n\t\treturn read_line_int[read_line_int_ptr++];\n\t}\n\tprivate static String readString() {\n\t\tif(read_line==null||read_line_int_ptr==read_line.length) {\n\t\t\tread_line = readLine();\n\t\t\tread_line_ptr=0;\n\t\t}\n\t\treturn read_line[read_line_ptr++];\n\t}\n\tprivate static String[] readLine(){\n\t\ttry{\n\t\t\treturn reader.readLine().split(\" \");\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn new String[]{e.getMessage()};\n\t\t}\n\t}\n\tprivate static int[] readLineInt(){\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tint[] ints = new int[s.length];\n\t\t\tfor(int i=0;i<ints.length;i++) {\n\t\t\t\tints[i] = Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\treturn ints;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}\n\tprivate static long[] readLineLong(){\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tlong[] ints = new long[s.length];\n\t\t\tfor(int i=0;i<ints.length;i++) {\n\t\t\t\tints[i] = Long.parseLong(s[i]);\n\t\t\t}\n\t\t\treturn ints;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}\n\tprivate static byte[] readLineByte(){\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tbyte[] bytes = new byte[s.length];\n\t\t\tfor(int i=0;i<bytes.length;i++) {\n\t\t\t\tbytes[i] = Byte.parseByte(s[i]);\n\t\t\t}\n\t\t\treturn bytes;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}\n\tprivate static char[] readLineChar(){\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tchar[] chars = new char[s.length];\n\t\t\tfor(int i=0;i<chars.length;i++) {\n\t\t\t\tchars[i] = (char)Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\treturn chars;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}\n\tprivate static void print(Object o){\n\t\tSystem.out.println(o);\n\t}\n\tprivate static void print(){\n\t\tSystem.out.println();\n\t}\n\tprivate static void printd(Object o){\n\t\tif(MODE_DEBUG)System.err.println(o);\n\t}\n\tprivate static void printd(){\n\t\tif(MODE_DEBUG)System.err.println();\n\t}\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"public class Main {\n\n\tstatic BufferedReader reader;\n\tfinal static boolean MODE_DEBUG = false;\n\tstatic String[] read_line;\n\tstatic int read_line_ptr;\n\tstatic int[] read_line_int;\n\tstatic int read_line_int_ptr;\n\t//static field here\n\t\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t\t//code here\n\t\tint N = readInt();\n\t\tlong[] a = readLineLong();\n\t\tlong ans = 1;\n\t\tboolean fail = false;\n\t\tboolean zero = false;\n\t\tfor(int i=0;i<N;i++) {\n\t\t\t\n\t\t\tif(a[i]==0) {\n\t\t\t\tzero = true;\n\t\t\t\tans=0;\n\t\t\t\tbreak;\n\t\t\t}else if(ans>1000000000000000000l/a[i]) {\n\t\t\t\tfail = true;\n\t\t\t}else if(!fail) {\n\t\t\t\tans*=a[i];\n\t\t\t}\n\t\t}\n\t\tif(fail&&!zero) {print(\"-1\");return;}\n\t\tprint(ans);\n\t\t//String[] s = readLine();\n\t\t//print(num);\n\t}\n\t\n\t//functions here\n\t//note that all methods should be STATIC\n\n\n\tprivate static <T> int arraySearch(T needle, T[] heystack) {\n\t\tfor(int i=0;i<heystack.length;i++) {\n\t\t\tif(needle.equals(heystack[i])) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n\tprivate static int[] sort(int[] base) {\n\t\tint[] copy = array_copy(base);\n\t\tArrays.sort(copy);\n\t\treturn copy;\n\t}\n\tprivate static int[] array_copy(int[] base) {\n\t\tint[] copy = new int[base.length];\n\t\tfor(int i=0;i<base.length;i++) {\n\t\t\tcopy[i] = base[i];\n\t\t}\n\t\treturn copy;\n\t}\n\tprivate static int[] asArray(ArrayList<Integer> ints) {\n\t\tint[] intlist = new int[ints.size()];\n\t\tfor(int i=0;i<intlist.length;i++) {\n\t\t\tintlist[i] = ints.get(i);\n\t\t}\n\t\treturn intlist;\n\t}\n\tprivate static int readInt() {\n\t\tif(read_line_int==null||read_line_int_ptr==read_line_int.length) {\n\t\t\tread_line_int = readLineInt();\n\t\t\tread_line_int_ptr=0;\n\t\t}\n\t\treturn read_line_int[read_line_int_ptr++];\n\t}\n\tprivate static String readString() {\n\t\tif(read_line==null||read_line_int_ptr==read_line.length) {\n\t\t\tread_line = readLine();\n\t\t\tread_line_ptr=0;\n\t\t}\n\t\treturn read_line[read_line_ptr++];\n\t}\n\tprivate static String[] readLine(){\n\t\ttry{\n\t\t\treturn reader.readLine().split(\" \");\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn new String[]{e.getMessage()};\n\t\t}\n\t}\n\tprivate static int[] readLineInt(){\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tint[] ints = new int[s.length];\n\t\t\tfor(int i=0;i<ints.length;i++) {\n\t\t\t\tints[i] = Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\treturn ints;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}\n\tprivate static long[] readLineLong(){\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tlong[] ints = new long[s.length];\n\t\t\tfor(int i=0;i<ints.length;i++) {\n\t\t\t\tints[i] = Long.parseLong(s[i]);\n\t\t\t}\n\t\t\treturn ints;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}\n\tprivate static byte[] readLineByte(){\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tbyte[] bytes = new byte[s.length];\n\t\t\tfor(int i=0;i<bytes.length;i++) {\n\t\t\t\tbytes[i] = Byte.parseByte(s[i]);\n\t\t\t}\n\t\t\treturn bytes;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}\n\tprivate static char[] readLineChar(){\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tchar[] chars = new char[s.length];\n\t\t\tfor(int i=0;i<chars.length;i++) {\n\t\t\t\tchars[i] = (char)Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\treturn chars;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}\n\tprivate static void print(Object o){\n\t\tSystem.out.println(o);\n\t}\n\tprivate static void print(){\n\t\tSystem.out.println();\n\t}\n\tprivate static void printd(Object o){\n\t\tif(MODE_DEBUG)System.err.println(o);\n\t}\n\tprivate static void printd(){\n\t\tif(MODE_DEBUG)System.err.println();\n\t}\n}",
"Main",
"static BufferedReader reader;",
"reader",
"final static boolean MODE_DEBUG = false;",
"MODE_DEBUG",
"false",
"static String[] read_line;",
"read_line",
"static int read_line_ptr;",
"read_line_ptr",
"static int[] read_line_int;",
"read_line_int",
"static int read_line_int_ptr;",
"read_line_int_ptr",
"public static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t\t//code here\n\t\tint N = readInt();\n\t\tlong[] a = readLineLong();\n\t\tlong ans = 1;\n\t\tboolean fail = false;\n\t\tboolean zero = false;\n\t\tfor(int i=0;i<N;i++) {\n\t\t\t\n\t\t\tif(a[i]==0) {\n\t\t\t\tzero = true;\n\t\t\t\tans=0;\n\t\t\t\tbreak;\n\t\t\t}else if(ans>1000000000000000000l/a[i]) {\n\t\t\t\tfail = true;\n\t\t\t}else if(!fail) {\n\t\t\t\tans*=a[i];\n\t\t\t}\n\t\t}\n\t\tif(fail&&!zero) {print(\"-1\");return;}\n\t\tprint(ans);\n\t\t//String[] s = readLine();\n\t\t//print(num);\n\t}",
"main",
"{\n\t\t// TODO Auto-generated method stub\n\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t\t//code here\n\t\tint N = readInt();\n\t\tlong[] a = readLineLong();\n\t\tlong ans = 1;\n\t\tboolean fail = false;\n\t\tboolean zero = false;\n\t\tfor(int i=0;i<N;i++) {\n\t\t\t\n\t\t\tif(a[i]==0) {\n\t\t\t\tzero = true;\n\t\t\t\tans=0;\n\t\t\t\tbreak;\n\t\t\t}else if(ans>1000000000000000000l/a[i]) {\n\t\t\t\tfail = true;\n\t\t\t}else if(!fail) {\n\t\t\t\tans*=a[i];\n\t\t\t}\n\t\t}\n\t\tif(fail&&!zero) {print(\"-1\");return;}\n\t\tprint(ans);\n\t\t//String[] s = readLine();\n\t\t//print(num);\n\t}",
"reader = new BufferedReader(new InputStreamReader(System.in))",
"reader",
"new BufferedReader(new InputStreamReader(System.in))",
"int N = readInt();",
"N",
"readInt()",
"readInt",
"long[] a = readLineLong();",
"a",
"readLineLong()",
"readLineLong",
"long ans = 1;",
"ans",
"1",
"boolean fail = false;",
"fail",
"false",
"boolean zero = false;",
"zero",
"false",
"for(int i=0;i<N;i++) {\n\t\t\t\n\t\t\tif(a[i]==0) {\n\t\t\t\tzero = true;\n\t\t\t\tans=0;\n\t\t\t\tbreak;\n\t\t\t}else if(ans>1000000000000000000l/a[i]) {\n\t\t\t\tfail = true;\n\t\t\t}else if(!fail) {\n\t\t\t\tans*=a[i];\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\t\n\t\t\tif(a[i]==0) {\n\t\t\t\tzero = true;\n\t\t\t\tans=0;\n\t\t\t\tbreak;\n\t\t\t}else if(ans>1000000000000000000l/a[i]) {\n\t\t\t\tfail = true;\n\t\t\t}else if(!fail) {\n\t\t\t\tans*=a[i];\n\t\t\t}\n\t\t}",
"{\n\t\t\t\n\t\t\tif(a[i]==0) {\n\t\t\t\tzero = true;\n\t\t\t\tans=0;\n\t\t\t\tbreak;\n\t\t\t}else if(ans>1000000000000000000l/a[i]) {\n\t\t\t\tfail = true;\n\t\t\t}else if(!fail) {\n\t\t\t\tans*=a[i];\n\t\t\t}\n\t\t}",
"if(a[i]==0) {\n\t\t\t\tzero = true;\n\t\t\t\tans=0;\n\t\t\t\tbreak;\n\t\t\t}else if(ans>1000000000000000000l/a[i]) {\n\t\t\t\tfail = true;\n\t\t\t}else if(!fail) {\n\t\t\t\tans*=a[i];\n\t\t\t}",
"a[i]==0",
"a[i]",
"a",
"i",
"0",
"{\n\t\t\t\tzero = true;\n\t\t\t\tans=0;\n\t\t\t\tbreak;\n\t\t\t}",
"zero = true",
"zero",
"true",
"ans=0",
"ans",
"0",
"break;",
"if(ans>1000000000000000000l/a[i]) {\n\t\t\t\tfail = true;\n\t\t\t}else if(!fail) {\n\t\t\t\tans*=a[i];\n\t\t\t}",
"ans>1000000000000000000l/a[i]",
"ans",
"1000000000000000000l/a[i]",
"1000000000000000000l",
"a[i]",
"a",
"i",
"{\n\t\t\t\tfail = true;\n\t\t\t}",
"fail = true",
"fail",
"true",
"if(!fail) {\n\t\t\t\tans*=a[i];\n\t\t\t}",
"!fail",
"fail",
"{\n\t\t\t\tans*=a[i];\n\t\t\t}",
"ans*=a[i]",
"ans",
"a[i]",
"a",
"i",
"if(fail&&!zero) {print(\"-1\");return;}",
"fail&&!zero",
"fail",
"!zero",
"zero",
"{print(\"-1\");return;}",
"print(\"-1\")",
"print",
"\"-1\"",
"return;",
"print(ans)",
"print",
"ans",
"String[] args",
"args",
"private static <T> int arraySearch(T needle, T[] heystack) {\n\t\tfor(int i=0;i<heystack.length;i++) {\n\t\t\tif(needle.equals(heystack[i])) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}",
"arraySearch",
"{\n\t\tfor(int i=0;i<heystack.length;i++) {\n\t\t\tif(needle.equals(heystack[i])) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}",
"for(int i=0;i<heystack.length;i++) {\n\t\t\tif(needle.equals(heystack[i])) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<heystack.length",
"i",
"heystack.length",
"heystack",
"heystack.length",
"i++",
"i++",
"i",
"{\n\t\t\tif(needle.equals(heystack[i])) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(needle.equals(heystack[i])) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}",
"if(needle.equals(heystack[i])) {\n\t\t\t\treturn i;\n\t\t\t}",
"needle.equals(heystack[i])",
"needle.equals",
"needle",
"heystack[i]",
"heystack",
"i",
"{\n\t\t\t\treturn i;\n\t\t\t}",
"return i;",
"i",
"return -1;",
"-1",
"1",
"T needle",
"needle",
"T[] heystack",
"heystack",
"private static int[] sort(int[] base) {\n\t\tint[] copy = array_copy(base);\n\t\tArrays.sort(copy);\n\t\treturn copy;\n\t}",
"sort",
"{\n\t\tint[] copy = array_copy(base);\n\t\tArrays.sort(copy);\n\t\treturn copy;\n\t}",
"int[] copy = array_copy(base);",
"copy",
"array_copy(base)",
"array_copy",
"base",
"Arrays.sort(copy)",
"Arrays.sort",
"Arrays",
"copy",
"return copy;",
"copy",
"int[] base",
"base",
"private static int[] array_copy(int[] base) {\n\t\tint[] copy = new int[base.length];\n\t\tfor(int i=0;i<base.length;i++) {\n\t\t\tcopy[i] = base[i];\n\t\t}\n\t\treturn copy;\n\t}",
"array_copy",
"{\n\t\tint[] copy = new int[base.length];\n\t\tfor(int i=0;i<base.length;i++) {\n\t\t\tcopy[i] = base[i];\n\t\t}\n\t\treturn copy;\n\t}",
"int[] copy = new int[base.length];",
"copy",
"new int[base.length]",
"base.length",
"base",
"base.length",
"for(int i=0;i<base.length;i++) {\n\t\t\tcopy[i] = base[i];\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<base.length",
"i",
"base.length",
"base",
"base.length",
"i++",
"i++",
"i",
"{\n\t\t\tcopy[i] = base[i];\n\t\t}",
"{\n\t\t\tcopy[i] = base[i];\n\t\t}",
"copy[i] = base[i]",
"copy[i]",
"copy",
"i",
"base[i]",
"base",
"i",
"return copy;",
"copy",
"int[] base",
"base",
"private static int[] asArray(ArrayList<Integer> ints) {\n\t\tint[] intlist = new int[ints.size()];\n\t\tfor(int i=0;i<intlist.length;i++) {\n\t\t\tintlist[i] = ints.get(i);\n\t\t}\n\t\treturn intlist;\n\t}",
"asArray",
"{\n\t\tint[] intlist = new int[ints.size()];\n\t\tfor(int i=0;i<intlist.length;i++) {\n\t\t\tintlist[i] = ints.get(i);\n\t\t}\n\t\treturn intlist;\n\t}",
"int[] intlist = new int[ints.size()];",
"intlist",
"new int[ints.size()]",
"ints.size()",
"ints.size",
"ints",
"for(int i=0;i<intlist.length;i++) {\n\t\t\tintlist[i] = ints.get(i);\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<intlist.length",
"i",
"intlist.length",
"intlist",
"intlist.length",
"i++",
"i++",
"i",
"{\n\t\t\tintlist[i] = ints.get(i);\n\t\t}",
"{\n\t\t\tintlist[i] = ints.get(i);\n\t\t}",
"intlist[i] = ints.get(i)",
"intlist[i]",
"intlist",
"i",
"ints.get(i)",
"ints.get",
"ints",
"i",
"return intlist;",
"intlist",
"ArrayList<Integer> ints",
"ints",
"private static int readInt() {\n\t\tif(read_line_int==null||read_line_int_ptr==read_line_int.length) {\n\t\t\tread_line_int = readLineInt();\n\t\t\tread_line_int_ptr=0;\n\t\t}\n\t\treturn read_line_int[read_line_int_ptr++];\n\t}",
"readInt",
"{\n\t\tif(read_line_int==null||read_line_int_ptr==read_line_int.length) {\n\t\t\tread_line_int = readLineInt();\n\t\t\tread_line_int_ptr=0;\n\t\t}\n\t\treturn read_line_int[read_line_int_ptr++];\n\t}",
"if(read_line_int==null||read_line_int_ptr==read_line_int.length) {\n\t\t\tread_line_int = readLineInt();\n\t\t\tread_line_int_ptr=0;\n\t\t}",
"read_line_int==null||read_line_int_ptr==read_line_int.length",
"read_line_int==null",
"read_line_int",
"null",
"read_line_int_ptr==read_line_int.length",
"read_line_int_ptr",
"read_line_int.length",
"read_line_int",
"read_line_int.length",
"{\n\t\t\tread_line_int = readLineInt();\n\t\t\tread_line_int_ptr=0;\n\t\t}",
"read_line_int = readLineInt()",
"read_line_int",
"readLineInt()",
"readLineInt",
"read_line_int_ptr=0",
"read_line_int_ptr",
"0",
"return read_line_int[read_line_int_ptr++];",
"read_line_int[read_line_int_ptr++]",
"read_line_int",
"read_line_int_ptr++",
"read_line_int_ptr",
"private static String readString() {\n\t\tif(read_line==null||read_line_int_ptr==read_line.length) {\n\t\t\tread_line = readLine();\n\t\t\tread_line_ptr=0;\n\t\t}\n\t\treturn read_line[read_line_ptr++];\n\t}",
"readString",
"{\n\t\tif(read_line==null||read_line_int_ptr==read_line.length) {\n\t\t\tread_line = readLine();\n\t\t\tread_line_ptr=0;\n\t\t}\n\t\treturn read_line[read_line_ptr++];\n\t}",
"if(read_line==null||read_line_int_ptr==read_line.length) {\n\t\t\tread_line = readLine();\n\t\t\tread_line_ptr=0;\n\t\t}",
"read_line==null||read_line_int_ptr==read_line.length",
"read_line==null",
"read_line",
"null",
"read_line_int_ptr==read_line.length",
"read_line_int_ptr",
"read_line.length",
"read_line",
"read_line.length",
"{\n\t\t\tread_line = readLine();\n\t\t\tread_line_ptr=0;\n\t\t}",
"read_line = readLine()",
"read_line",
"readLine()",
"readLine",
"read_line_ptr=0",
"read_line_ptr",
"0",
"return read_line[read_line_ptr++];",
"read_line[read_line_ptr++]",
"read_line",
"read_line_ptr++",
"read_line_ptr",
"private static String[] readLine(){\n\t\ttry{\n\t\t\treturn reader.readLine().split(\" \");\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn new String[]{e.getMessage()};\n\t\t}\n\t}",
"readLine",
"{\n\t\ttry{\n\t\t\treturn reader.readLine().split(\" \");\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn new String[]{e.getMessage()};\n\t\t}\n\t}",
"try{\n\t\t\treturn reader.readLine().split(\" \");\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn new String[]{e.getMessage()};\n\t\t}",
"catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn new String[]{e.getMessage()};\n\t\t}",
"Exception e",
"{\n\t\t\te.printStackTrace();\n\t\t\treturn new String[]{e.getMessage()};\n\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"return new String[]{e.getMessage()};",
"new String[]{e.getMessage()}",
"{\n\t\t\treturn reader.readLine().split(\" \");\n\t\t}",
"return reader.readLine().split(\" \");",
"reader.readLine().split(\" \")",
"reader.readLine().split",
"reader.readLine()",
"reader.readLine",
"reader",
"\" \"",
"private static int[] readLineInt(){\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tint[] ints = new int[s.length];\n\t\t\tfor(int i=0;i<ints.length;i++) {\n\t\t\t\tints[i] = Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\treturn ints;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}",
"readLineInt",
"{\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tint[] ints = new int[s.length];\n\t\t\tfor(int i=0;i<ints.length;i++) {\n\t\t\t\tints[i] = Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\treturn ints;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}",
"try{\n\t\t\tString[] s = readLine();\n\t\t\tint[] ints = new int[s.length];\n\t\t\tfor(int i=0;i<ints.length;i++) {\n\t\t\t\tints[i] = Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\treturn ints;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}",
"catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}",
"Exception e",
"{\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"return null;",
"null",
"{\n\t\t\tString[] s = readLine();\n\t\t\tint[] ints = new int[s.length];\n\t\t\tfor(int i=0;i<ints.length;i++) {\n\t\t\t\tints[i] = Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\treturn ints;\n\t\t}",
"String[] s = readLine();",
"s",
"readLine()",
"readLine",
"int[] ints = new int[s.length];",
"ints",
"new int[s.length]",
"s.length",
"s",
"s.length",
"for(int i=0;i<ints.length;i++) {\n\t\t\t\tints[i] = Integer.parseInt(s[i]);\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<ints.length",
"i",
"ints.length",
"ints",
"ints.length",
"i++",
"i++",
"i",
"{\n\t\t\t\tints[i] = Integer.parseInt(s[i]);\n\t\t\t}",
"{\n\t\t\t\tints[i] = Integer.parseInt(s[i]);\n\t\t\t}",
"ints[i] = Integer.parseInt(s[i])",
"ints[i]",
"ints",
"i",
"Integer.parseInt(s[i])",
"Integer.parseInt",
"Integer",
"s[i]",
"s",
"i",
"return ints;",
"ints",
"private static long[] readLineLong(){\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tlong[] ints = new long[s.length];\n\t\t\tfor(int i=0;i<ints.length;i++) {\n\t\t\t\tints[i] = Long.parseLong(s[i]);\n\t\t\t}\n\t\t\treturn ints;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}",
"readLineLong",
"{\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tlong[] ints = new long[s.length];\n\t\t\tfor(int i=0;i<ints.length;i++) {\n\t\t\t\tints[i] = Long.parseLong(s[i]);\n\t\t\t}\n\t\t\treturn ints;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}",
"try{\n\t\t\tString[] s = readLine();\n\t\t\tlong[] ints = new long[s.length];\n\t\t\tfor(int i=0;i<ints.length;i++) {\n\t\t\t\tints[i] = Long.parseLong(s[i]);\n\t\t\t}\n\t\t\treturn ints;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}",
"catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}",
"Exception e",
"{\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"return null;",
"null",
"{\n\t\t\tString[] s = readLine();\n\t\t\tlong[] ints = new long[s.length];\n\t\t\tfor(int i=0;i<ints.length;i++) {\n\t\t\t\tints[i] = Long.parseLong(s[i]);\n\t\t\t}\n\t\t\treturn ints;\n\t\t}",
"String[] s = readLine();",
"s",
"readLine()",
"readLine",
"long[] ints = new long[s.length];",
"ints",
"new long[s.length]",
"s.length",
"s",
"s.length",
"for(int i=0;i<ints.length;i++) {\n\t\t\t\tints[i] = Long.parseLong(s[i]);\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<ints.length",
"i",
"ints.length",
"ints",
"ints.length",
"i++",
"i++",
"i",
"{\n\t\t\t\tints[i] = Long.parseLong(s[i]);\n\t\t\t}",
"{\n\t\t\t\tints[i] = Long.parseLong(s[i]);\n\t\t\t}",
"ints[i] = Long.parseLong(s[i])",
"ints[i]",
"ints",
"i",
"Long.parseLong(s[i])",
"Long.parseLong",
"Long",
"s[i]",
"s",
"i",
"return ints;",
"ints",
"private static byte[] readLineByte(){\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tbyte[] bytes = new byte[s.length];\n\t\t\tfor(int i=0;i<bytes.length;i++) {\n\t\t\t\tbytes[i] = Byte.parseByte(s[i]);\n\t\t\t}\n\t\t\treturn bytes;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}",
"readLineByte",
"{\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tbyte[] bytes = new byte[s.length];\n\t\t\tfor(int i=0;i<bytes.length;i++) {\n\t\t\t\tbytes[i] = Byte.parseByte(s[i]);\n\t\t\t}\n\t\t\treturn bytes;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}",
"try{\n\t\t\tString[] s = readLine();\n\t\t\tbyte[] bytes = new byte[s.length];\n\t\t\tfor(int i=0;i<bytes.length;i++) {\n\t\t\t\tbytes[i] = Byte.parseByte(s[i]);\n\t\t\t}\n\t\t\treturn bytes;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}",
"catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}",
"Exception e",
"{\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"return null;",
"null",
"{\n\t\t\tString[] s = readLine();\n\t\t\tbyte[] bytes = new byte[s.length];\n\t\t\tfor(int i=0;i<bytes.length;i++) {\n\t\t\t\tbytes[i] = Byte.parseByte(s[i]);\n\t\t\t}\n\t\t\treturn bytes;\n\t\t}",
"String[] s = readLine();",
"s",
"readLine()",
"readLine",
"byte[] bytes = new byte[s.length];",
"bytes",
"new byte[s.length]",
"s.length",
"s",
"s.length",
"for(int i=0;i<bytes.length;i++) {\n\t\t\t\tbytes[i] = Byte.parseByte(s[i]);\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<bytes.length",
"i",
"bytes.length",
"bytes",
"bytes.length",
"i++",
"i++",
"i",
"{\n\t\t\t\tbytes[i] = Byte.parseByte(s[i]);\n\t\t\t}",
"{\n\t\t\t\tbytes[i] = Byte.parseByte(s[i]);\n\t\t\t}",
"bytes[i] = Byte.parseByte(s[i])",
"bytes[i]",
"bytes",
"i",
"Byte.parseByte(s[i])",
"Byte.parseByte",
"Byte",
"s[i]",
"s",
"i",
"return bytes;",
"bytes",
"private static char[] readLineChar(){\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tchar[] chars = new char[s.length];\n\t\t\tfor(int i=0;i<chars.length;i++) {\n\t\t\t\tchars[i] = (char)Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\treturn chars;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}",
"readLineChar",
"{\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tchar[] chars = new char[s.length];\n\t\t\tfor(int i=0;i<chars.length;i++) {\n\t\t\t\tchars[i] = (char)Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\treturn chars;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}",
"try{\n\t\t\tString[] s = readLine();\n\t\t\tchar[] chars = new char[s.length];\n\t\t\tfor(int i=0;i<chars.length;i++) {\n\t\t\t\tchars[i] = (char)Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\treturn chars;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}",
"catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}",
"Exception e",
"{\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"return null;",
"null",
"{\n\t\t\tString[] s = readLine();\n\t\t\tchar[] chars = new char[s.length];\n\t\t\tfor(int i=0;i<chars.length;i++) {\n\t\t\t\tchars[i] = (char)Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\treturn chars;\n\t\t}",
"String[] s = readLine();",
"s",
"readLine()",
"readLine",
"char[] chars = new char[s.length];",
"chars",
"new char[s.length]",
"s.length",
"s",
"s.length",
"for(int i=0;i<chars.length;i++) {\n\t\t\t\tchars[i] = (char)Integer.parseInt(s[i]);\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<chars.length",
"i",
"chars.length",
"chars",
"chars.length",
"i++",
"i++",
"i",
"{\n\t\t\t\tchars[i] = (char)Integer.parseInt(s[i]);\n\t\t\t}",
"{\n\t\t\t\tchars[i] = (char)Integer.parseInt(s[i]);\n\t\t\t}",
"chars[i] = (char)Integer.parseInt(s[i])",
"chars[i]",
"chars",
"i",
"(char)Integer.parseInt(s[i])",
"Integer.parseInt",
"Integer",
"s[i]",
"s",
"i",
"return chars;",
"chars",
"private static void print(Object o){\n\t\tSystem.out.println(o);\n\t}",
"print",
"{\n\t\tSystem.out.println(o);\n\t}",
"System.out.println(o)",
"System.out.println",
"System.out",
"System",
"System.out",
"o",
"Object o",
"o",
"private static void print(){\n\t\tSystem.out.println();\n\t}",
"print",
"{\n\t\tSystem.out.println();\n\t}",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"private static void printd(Object o){\n\t\tif(MODE_DEBUG)System.err.println(o);\n\t}",
"printd",
"{\n\t\tif(MODE_DEBUG)System.err.println(o);\n\t}",
"if(MODE_DEBUG)System.err.println(o);",
"MODE_DEBUG",
"System.err.println(o)",
"System.err.println",
"System.err",
"System",
"System.err",
"o",
"Object o",
"o",
"private static void printd(){\n\t\tif(MODE_DEBUG)System.err.println();\n\t}",
"printd",
"{\n\t\tif(MODE_DEBUG)System.err.println();\n\t}",
"if(MODE_DEBUG)System.err.println();",
"MODE_DEBUG",
"System.err.println()",
"System.err.println",
"System.err",
"System",
"System.err",
"public class Main {\n\n\tstatic BufferedReader reader;\n\tfinal static boolean MODE_DEBUG = false;\n\tstatic String[] read_line;\n\tstatic int read_line_ptr;\n\tstatic int[] read_line_int;\n\tstatic int read_line_int_ptr;\n\t//static field here\n\t\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t\t//code here\n\t\tint N = readInt();\n\t\tlong[] a = readLineLong();\n\t\tlong ans = 1;\n\t\tboolean fail = false;\n\t\tboolean zero = false;\n\t\tfor(int i=0;i<N;i++) {\n\t\t\t\n\t\t\tif(a[i]==0) {\n\t\t\t\tzero = true;\n\t\t\t\tans=0;\n\t\t\t\tbreak;\n\t\t\t}else if(ans>1000000000000000000l/a[i]) {\n\t\t\t\tfail = true;\n\t\t\t}else if(!fail) {\n\t\t\t\tans*=a[i];\n\t\t\t}\n\t\t}\n\t\tif(fail&&!zero) {print(\"-1\");return;}\n\t\tprint(ans);\n\t\t//String[] s = readLine();\n\t\t//print(num);\n\t}\n\t\n\t//functions here\n\t//note that all methods should be STATIC\n\n\n\tprivate static <T> int arraySearch(T needle, T[] heystack) {\n\t\tfor(int i=0;i<heystack.length;i++) {\n\t\t\tif(needle.equals(heystack[i])) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n\tprivate static int[] sort(int[] base) {\n\t\tint[] copy = array_copy(base);\n\t\tArrays.sort(copy);\n\t\treturn copy;\n\t}\n\tprivate static int[] array_copy(int[] base) {\n\t\tint[] copy = new int[base.length];\n\t\tfor(int i=0;i<base.length;i++) {\n\t\t\tcopy[i] = base[i];\n\t\t}\n\t\treturn copy;\n\t}\n\tprivate static int[] asArray(ArrayList<Integer> ints) {\n\t\tint[] intlist = new int[ints.size()];\n\t\tfor(int i=0;i<intlist.length;i++) {\n\t\t\tintlist[i] = ints.get(i);\n\t\t}\n\t\treturn intlist;\n\t}\n\tprivate static int readInt() {\n\t\tif(read_line_int==null||read_line_int_ptr==read_line_int.length) {\n\t\t\tread_line_int = readLineInt();\n\t\t\tread_line_int_ptr=0;\n\t\t}\n\t\treturn read_line_int[read_line_int_ptr++];\n\t}\n\tprivate static String readString() {\n\t\tif(read_line==null||read_line_int_ptr==read_line.length) {\n\t\t\tread_line = readLine();\n\t\t\tread_line_ptr=0;\n\t\t}\n\t\treturn read_line[read_line_ptr++];\n\t}\n\tprivate static String[] readLine(){\n\t\ttry{\n\t\t\treturn reader.readLine().split(\" \");\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn new String[]{e.getMessage()};\n\t\t}\n\t}\n\tprivate static int[] readLineInt(){\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tint[] ints = new int[s.length];\n\t\t\tfor(int i=0;i<ints.length;i++) {\n\t\t\t\tints[i] = Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\treturn ints;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}\n\tprivate static long[] readLineLong(){\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tlong[] ints = new long[s.length];\n\t\t\tfor(int i=0;i<ints.length;i++) {\n\t\t\t\tints[i] = Long.parseLong(s[i]);\n\t\t\t}\n\t\t\treturn ints;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}\n\tprivate static byte[] readLineByte(){\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tbyte[] bytes = new byte[s.length];\n\t\t\tfor(int i=0;i<bytes.length;i++) {\n\t\t\t\tbytes[i] = Byte.parseByte(s[i]);\n\t\t\t}\n\t\t\treturn bytes;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}\n\tprivate static char[] readLineChar(){\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tchar[] chars = new char[s.length];\n\t\t\tfor(int i=0;i<chars.length;i++) {\n\t\t\t\tchars[i] = (char)Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\treturn chars;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}\n\tprivate static void print(Object o){\n\t\tSystem.out.println(o);\n\t}\n\tprivate static void print(){\n\t\tSystem.out.println();\n\t}\n\tprivate static void printd(Object o){\n\t\tif(MODE_DEBUG)System.err.println(o);\n\t}\n\tprivate static void printd(){\n\t\tif(MODE_DEBUG)System.err.println();\n\t}\n}",
"public class Main {\n\n\tstatic BufferedReader reader;\n\tfinal static boolean MODE_DEBUG = false;\n\tstatic String[] read_line;\n\tstatic int read_line_ptr;\n\tstatic int[] read_line_int;\n\tstatic int read_line_int_ptr;\n\t//static field here\n\t\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t\t//code here\n\t\tint N = readInt();\n\t\tlong[] a = readLineLong();\n\t\tlong ans = 1;\n\t\tboolean fail = false;\n\t\tboolean zero = false;\n\t\tfor(int i=0;i<N;i++) {\n\t\t\t\n\t\t\tif(a[i]==0) {\n\t\t\t\tzero = true;\n\t\t\t\tans=0;\n\t\t\t\tbreak;\n\t\t\t}else if(ans>1000000000000000000l/a[i]) {\n\t\t\t\tfail = true;\n\t\t\t}else if(!fail) {\n\t\t\t\tans*=a[i];\n\t\t\t}\n\t\t}\n\t\tif(fail&&!zero) {print(\"-1\");return;}\n\t\tprint(ans);\n\t\t//String[] s = readLine();\n\t\t//print(num);\n\t}\n\t\n\t//functions here\n\t//note that all methods should be STATIC\n\n\n\tprivate static <T> int arraySearch(T needle, T[] heystack) {\n\t\tfor(int i=0;i<heystack.length;i++) {\n\t\t\tif(needle.equals(heystack[i])) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n\tprivate static int[] sort(int[] base) {\n\t\tint[] copy = array_copy(base);\n\t\tArrays.sort(copy);\n\t\treturn copy;\n\t}\n\tprivate static int[] array_copy(int[] base) {\n\t\tint[] copy = new int[base.length];\n\t\tfor(int i=0;i<base.length;i++) {\n\t\t\tcopy[i] = base[i];\n\t\t}\n\t\treturn copy;\n\t}\n\tprivate static int[] asArray(ArrayList<Integer> ints) {\n\t\tint[] intlist = new int[ints.size()];\n\t\tfor(int i=0;i<intlist.length;i++) {\n\t\t\tintlist[i] = ints.get(i);\n\t\t}\n\t\treturn intlist;\n\t}\n\tprivate static int readInt() {\n\t\tif(read_line_int==null||read_line_int_ptr==read_line_int.length) {\n\t\t\tread_line_int = readLineInt();\n\t\t\tread_line_int_ptr=0;\n\t\t}\n\t\treturn read_line_int[read_line_int_ptr++];\n\t}\n\tprivate static String readString() {\n\t\tif(read_line==null||read_line_int_ptr==read_line.length) {\n\t\t\tread_line = readLine();\n\t\t\tread_line_ptr=0;\n\t\t}\n\t\treturn read_line[read_line_ptr++];\n\t}\n\tprivate static String[] readLine(){\n\t\ttry{\n\t\t\treturn reader.readLine().split(\" \");\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn new String[]{e.getMessage()};\n\t\t}\n\t}\n\tprivate static int[] readLineInt(){\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tint[] ints = new int[s.length];\n\t\t\tfor(int i=0;i<ints.length;i++) {\n\t\t\t\tints[i] = Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\treturn ints;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}\n\tprivate static long[] readLineLong(){\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tlong[] ints = new long[s.length];\n\t\t\tfor(int i=0;i<ints.length;i++) {\n\t\t\t\tints[i] = Long.parseLong(s[i]);\n\t\t\t}\n\t\t\treturn ints;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}\n\tprivate static byte[] readLineByte(){\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tbyte[] bytes = new byte[s.length];\n\t\t\tfor(int i=0;i<bytes.length;i++) {\n\t\t\t\tbytes[i] = Byte.parseByte(s[i]);\n\t\t\t}\n\t\t\treturn bytes;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}\n\tprivate static char[] readLineChar(){\n\t\ttry{\n\t\t\tString[] s = readLine();\n\t\t\tchar[] chars = new char[s.length];\n\t\t\tfor(int i=0;i<chars.length;i++) {\n\t\t\t\tchars[i] = (char)Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\treturn chars;\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}\n\tprivate static void print(Object o){\n\t\tSystem.out.println(o);\n\t}\n\tprivate static void print(){\n\t\tSystem.out.println();\n\t}\n\tprivate static void printd(Object o){\n\t\tif(MODE_DEBUG)System.err.println(o);\n\t}\n\tprivate static void printd(){\n\t\tif(MODE_DEBUG)System.err.println();\n\t}\n}",
"Main"
] |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
public class Main {
static BufferedReader reader;
final static boolean MODE_DEBUG = false;
static String[] read_line;
static int read_line_ptr;
static int[] read_line_int;
static int read_line_int_ptr;
//static field here
public static void main(String[] args) {
// TODO Auto-generated method stub
reader = new BufferedReader(new InputStreamReader(System.in));
//code here
int N = readInt();
long[] a = readLineLong();
long ans = 1;
boolean fail = false;
boolean zero = false;
for(int i=0;i<N;i++) {
if(a[i]==0) {
zero = true;
ans=0;
break;
}else if(ans>1000000000000000000l/a[i]) {
fail = true;
}else if(!fail) {
ans*=a[i];
}
}
if(fail&&!zero) {print("-1");return;}
print(ans);
//String[] s = readLine();
//print(num);
}
//functions here
//note that all methods should be STATIC
private static <T> int arraySearch(T needle, T[] heystack) {
for(int i=0;i<heystack.length;i++) {
if(needle.equals(heystack[i])) {
return i;
}
}
return -1;
}
private static int[] sort(int[] base) {
int[] copy = array_copy(base);
Arrays.sort(copy);
return copy;
}
private static int[] array_copy(int[] base) {
int[] copy = new int[base.length];
for(int i=0;i<base.length;i++) {
copy[i] = base[i];
}
return copy;
}
private static int[] asArray(ArrayList<Integer> ints) {
int[] intlist = new int[ints.size()];
for(int i=0;i<intlist.length;i++) {
intlist[i] = ints.get(i);
}
return intlist;
}
private static int readInt() {
if(read_line_int==null||read_line_int_ptr==read_line_int.length) {
read_line_int = readLineInt();
read_line_int_ptr=0;
}
return read_line_int[read_line_int_ptr++];
}
private static String readString() {
if(read_line==null||read_line_int_ptr==read_line.length) {
read_line = readLine();
read_line_ptr=0;
}
return read_line[read_line_ptr++];
}
private static String[] readLine(){
try{
return reader.readLine().split(" ");
}catch(Exception e){
e.printStackTrace();
return new String[]{e.getMessage()};
}
}
private static int[] readLineInt(){
try{
String[] s = readLine();
int[] ints = new int[s.length];
for(int i=0;i<ints.length;i++) {
ints[i] = Integer.parseInt(s[i]);
}
return ints;
}catch(Exception e){
e.printStackTrace();
return null;
}
}
private static long[] readLineLong(){
try{
String[] s = readLine();
long[] ints = new long[s.length];
for(int i=0;i<ints.length;i++) {
ints[i] = Long.parseLong(s[i]);
}
return ints;
}catch(Exception e){
e.printStackTrace();
return null;
}
}
private static byte[] readLineByte(){
try{
String[] s = readLine();
byte[] bytes = new byte[s.length];
for(int i=0;i<bytes.length;i++) {
bytes[i] = Byte.parseByte(s[i]);
}
return bytes;
}catch(Exception e){
e.printStackTrace();
return null;
}
}
private static char[] readLineChar(){
try{
String[] s = readLine();
char[] chars = new char[s.length];
for(int i=0;i<chars.length;i++) {
chars[i] = (char)Integer.parseInt(s[i]);
}
return chars;
}catch(Exception e){
e.printStackTrace();
return null;
}
}
private static void print(Object o){
System.out.println(o);
}
private static void print(){
System.out.println();
}
private static void printd(Object o){
if(MODE_DEBUG)System.err.println(o);
}
private static void printd(){
if(MODE_DEBUG)System.err.println();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
41,
13,
20,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
2,
13,
13,
3,
14,
2,
13,
2,
17,
13,
30,
0,
13,
17,
0,
13,
2,
13,
13,
14,
2,
13,
17,
30,
0,
13,
40,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
92,
8
],
[
92,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
11,
18
],
[
18,
19
],
[
18,
20
],
[
11,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
11,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
42,
43
],
[
38,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
48,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
55,
57
],
[
48,
58
],
[
38,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
62,
64
],
[
59,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
38,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
11,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
74,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
11,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
83,
88
],
[
9,
89
],
[
89,
90
],
[
0,
91
],
[
91,
92
],
[
91,
93
]
] |
[
"import java.util.*;\nimport java.io.*;\n\npublic class Main\n{\n\tpublic static void main(String [] Args)\n\t{\n\t\tlong ans=1;\n\t\tint flag=0;\n\t\tScanner in = new Scanner(System.in);\n\t\tint n=in.nextInt();\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tlong a=in.nextLong();\n\t\t\tif(a==0)\n\t\t\t{\n\t\t\t\tflag=-1;\n\t\t\t\tans=ans*a;\n\t\t\t\tbreak;\n\t\t\t}\t\t\t\n\t\t\tif(ans>(long)1e18/a)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t}\n\t\t\tans=ans*a;\n\t\t}\n\t\tif(flag==1)\n\t\t{\n\t\t\tans=-1;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n\t",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main\n{\n\tpublic static void main(String [] Args)\n\t{\n\t\tlong ans=1;\n\t\tint flag=0;\n\t\tScanner in = new Scanner(System.in);\n\t\tint n=in.nextInt();\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tlong a=in.nextLong();\n\t\t\tif(a==0)\n\t\t\t{\n\t\t\t\tflag=-1;\n\t\t\t\tans=ans*a;\n\t\t\t\tbreak;\n\t\t\t}\t\t\t\n\t\t\tif(ans>(long)1e18/a)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t}\n\t\t\tans=ans*a;\n\t\t}\n\t\tif(flag==1)\n\t\t{\n\t\t\tans=-1;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main",
"public static void main(String [] Args)\n\t{\n\t\tlong ans=1;\n\t\tint flag=0;\n\t\tScanner in = new Scanner(System.in);\n\t\tint n=in.nextInt();\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tlong a=in.nextLong();\n\t\t\tif(a==0)\n\t\t\t{\n\t\t\t\tflag=-1;\n\t\t\t\tans=ans*a;\n\t\t\t\tbreak;\n\t\t\t}\t\t\t\n\t\t\tif(ans>(long)1e18/a)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t}\n\t\t\tans=ans*a;\n\t\t}\n\t\tif(flag==1)\n\t\t{\n\t\t\tans=-1;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\tlong ans=1;\n\t\tint flag=0;\n\t\tScanner in = new Scanner(System.in);\n\t\tint n=in.nextInt();\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tlong a=in.nextLong();\n\t\t\tif(a==0)\n\t\t\t{\n\t\t\t\tflag=-1;\n\t\t\t\tans=ans*a;\n\t\t\t\tbreak;\n\t\t\t}\t\t\t\n\t\t\tif(ans>(long)1e18/a)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t}\n\t\t\tans=ans*a;\n\t\t}\n\t\tif(flag==1)\n\t\t{\n\t\t\tans=-1;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"long ans=1;",
"ans",
"1",
"int flag=0;",
"flag",
"0",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int n=in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"for(int i=0;i<n;i++)\n\t\t{\n\t\t\tlong a=in.nextLong();\n\t\t\tif(a==0)\n\t\t\t{\n\t\t\t\tflag=-1;\n\t\t\t\tans=ans*a;\n\t\t\t\tbreak;\n\t\t\t}\t\t\t\n\t\t\tif(ans>(long)1e18/a)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t}\n\t\t\tans=ans*a;\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tlong a=in.nextLong();\n\t\t\tif(a==0)\n\t\t\t{\n\t\t\t\tflag=-1;\n\t\t\t\tans=ans*a;\n\t\t\t\tbreak;\n\t\t\t}\t\t\t\n\t\t\tif(ans>(long)1e18/a)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t}\n\t\t\tans=ans*a;\n\t\t}",
"{\n\t\t\tlong a=in.nextLong();\n\t\t\tif(a==0)\n\t\t\t{\n\t\t\t\tflag=-1;\n\t\t\t\tans=ans*a;\n\t\t\t\tbreak;\n\t\t\t}\t\t\t\n\t\t\tif(ans>(long)1e18/a)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t}\n\t\t\tans=ans*a;\n\t\t}",
"long a=in.nextLong();",
"a",
"in.nextLong()",
"in.nextLong",
"in",
"if(a==0)\n\t\t\t{\n\t\t\t\tflag=-1;\n\t\t\t\tans=ans*a;\n\t\t\t\tbreak;\n\t\t\t}",
"a==0",
"a",
"0",
"{\n\t\t\t\tflag=-1;\n\t\t\t\tans=ans*a;\n\t\t\t\tbreak;\n\t\t\t}",
"flag=-1",
"flag",
"-1",
"1",
"ans=ans*a",
"ans",
"ans*a",
"ans",
"a",
"break;",
"if(ans>(long)1e18/a)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t}",
"ans>(long)1e18/a",
"ans",
"(long)1e18/a",
"(long)1e18",
"a",
"{\n\t\t\t\tflag=1;\n\t\t\t}",
"flag=1",
"flag",
"1",
"ans=ans*a",
"ans",
"ans*a",
"ans",
"a",
"if(flag==1)\n\t\t{\n\t\t\tans=-1;\n\t\t}",
"flag==1",
"flag",
"1",
"{\n\t\t\tans=-1;\n\t\t}",
"ans=-1",
"ans",
"-1",
"1",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String [] Args",
"Args",
"public class Main\n{\n\tpublic static void main(String [] Args)\n\t{\n\t\tlong ans=1;\n\t\tint flag=0;\n\t\tScanner in = new Scanner(System.in);\n\t\tint n=in.nextInt();\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tlong a=in.nextLong();\n\t\t\tif(a==0)\n\t\t\t{\n\t\t\t\tflag=-1;\n\t\t\t\tans=ans*a;\n\t\t\t\tbreak;\n\t\t\t}\t\t\t\n\t\t\tif(ans>(long)1e18/a)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t}\n\t\t\tans=ans*a;\n\t\t}\n\t\tif(flag==1)\n\t\t{\n\t\t\tans=-1;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"public class Main\n{\n\tpublic static void main(String [] Args)\n\t{\n\t\tlong ans=1;\n\t\tint flag=0;\n\t\tScanner in = new Scanner(System.in);\n\t\tint n=in.nextInt();\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tlong a=in.nextLong();\n\t\t\tif(a==0)\n\t\t\t{\n\t\t\t\tflag=-1;\n\t\t\t\tans=ans*a;\n\t\t\t\tbreak;\n\t\t\t}\t\t\t\n\t\t\tif(ans>(long)1e18/a)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t}\n\t\t\tans=ans*a;\n\t\t}\n\t\tif(flag==1)\n\t\t{\n\t\t\tans=-1;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main"
] |
import java.util.*;
import java.io.*;
public class Main
{
public static void main(String [] Args)
{
long ans=1;
int flag=0;
Scanner in = new Scanner(System.in);
int n=in.nextInt();
for(int i=0;i<n;i++)
{
long a=in.nextLong();
if(a==0)
{
flag=-1;
ans=ans*a;
break;
}
if(ans>(long)1e18/a)
{
flag=1;
}
ans=ans*a;
}
if(flag==1)
{
ans=-1;
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
4,
18,
13,
18,
13,
17,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
18,
13,
13,
0,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
29,
4,
18,
18,
13,
13,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
29,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
211,
20
],
[
211,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
23,
32
],
[
32,
33
],
[
32,
34
],
[
23,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
36,
41
],
[
41,
42
],
[
41,
43
],
[
36,
44
],
[
44,
45
],
[
45,
46
],
[
36,
47
],
[
48,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
54,
55
],
[
23,
56
],
[
56,
57
],
[
57,
58
],
[
56,
59
],
[
23,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
62,
65
],
[
65,
66
],
[
65,
67
],
[
23,
68
],
[
68,
69
],
[
68,
70
],
[
23,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
71,
76
],
[
76,
77
],
[
76,
78
],
[
71,
79
],
[
79,
80
],
[
80,
81
],
[
71,
82
],
[
83,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
89,
90
],
[
89,
91
],
[
83,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
94,
97
],
[
83,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
100,
103
],
[
99,
104
],
[
98,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
111,
112
],
[
105,
113
],
[
23,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
21,
120
],
[
120,
121
],
[
211,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
122,
126
],
[
126,
127
],
[
122,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
122,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
137,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
147,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
136,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
122,
162
],
[
162,
163
],
[
162,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
166,
169
],
[
169,
170
],
[
122,
171
],
[
171,
172
],
[
171,
173
],
[
173,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
175,
178
],
[
178,
179
],
[
122,
180
],
[
180,
181
],
[
180,
182
],
[
182,
183
],
[
183,
184
],
[
184,
185
],
[
185,
186
],
[
184,
187
],
[
187,
188
],
[
122,
189
],
[
189,
190
],
[
189,
191
],
[
191,
192
],
[
192,
193
],
[
192,
194
],
[
191,
195
],
[
195,
196
],
[
196,
197
],
[
196,
198
],
[
198,
199
],
[
199,
200
],
[
200,
201
],
[
195,
202
],
[
202,
203
],
[
203,
204
],
[
203,
205
],
[
205,
206
],
[
206,
207
],
[
191,
208
],
[
208,
209
],
[
0,
210
],
[
210,
211
],
[
210,
212
]
] |
[
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class Main {\n public static void main(String[] args) {\n FastReader input = new FastReader();\n int n = input.nextInt();\n long[] arr = new long[n];\n for(int i = 0;i < n;i++){\n arr[i] = input.nextLong();\n }\n Arrays.sort(arr);\n\n BigInteger a1 = BigInteger.valueOf(arr[0]);\n BigInteger k = new BigInteger(\"1000000000000000000\");\n\n for(int i = 1;i < n;i++){\n BigInteger b1 = BigInteger.valueOf(arr[i]);\n a1 = a1.multiply(b1);\n if(a1.compareTo(k) == 1){\n\n System.out.println(-1);\n return;\n }\n }\n System.out.println(a1);\n }\n static class FastReader\n {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader()\n {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\n\n String next()\n {\n while (st == null || !st.hasMoreElements())\n {\n try\n {\n st = new StringTokenizer(br.readLine());\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt()\n {\n return Integer.parseInt(next());\n }\n\n long nextLong()\n {\n return Long.parseLong(next());\n }\n\n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n\n String nextLine()\n {\n String str = \"\";\n try\n {\n str = br.readLine();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n return str;\n }\n }\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"public class Main {\n public static void main(String[] args) {\n FastReader input = new FastReader();\n int n = input.nextInt();\n long[] arr = new long[n];\n for(int i = 0;i < n;i++){\n arr[i] = input.nextLong();\n }\n Arrays.sort(arr);\n\n BigInteger a1 = BigInteger.valueOf(arr[0]);\n BigInteger k = new BigInteger(\"1000000000000000000\");\n\n for(int i = 1;i < n;i++){\n BigInteger b1 = BigInteger.valueOf(arr[i]);\n a1 = a1.multiply(b1);\n if(a1.compareTo(k) == 1){\n\n System.out.println(-1);\n return;\n }\n }\n System.out.println(a1);\n }\n static class FastReader\n {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader()\n {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\n\n String next()\n {\n while (st == null || !st.hasMoreElements())\n {\n try\n {\n st = new StringTokenizer(br.readLine());\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt()\n {\n return Integer.parseInt(next());\n }\n\n long nextLong()\n {\n return Long.parseLong(next());\n }\n\n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n\n String nextLine()\n {\n String str = \"\";\n try\n {\n str = br.readLine();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n return str;\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n FastReader input = new FastReader();\n int n = input.nextInt();\n long[] arr = new long[n];\n for(int i = 0;i < n;i++){\n arr[i] = input.nextLong();\n }\n Arrays.sort(arr);\n\n BigInteger a1 = BigInteger.valueOf(arr[0]);\n BigInteger k = new BigInteger(\"1000000000000000000\");\n\n for(int i = 1;i < n;i++){\n BigInteger b1 = BigInteger.valueOf(arr[i]);\n a1 = a1.multiply(b1);\n if(a1.compareTo(k) == 1){\n\n System.out.println(-1);\n return;\n }\n }\n System.out.println(a1);\n }",
"main",
"{\n FastReader input = new FastReader();\n int n = input.nextInt();\n long[] arr = new long[n];\n for(int i = 0;i < n;i++){\n arr[i] = input.nextLong();\n }\n Arrays.sort(arr);\n\n BigInteger a1 = BigInteger.valueOf(arr[0]);\n BigInteger k = new BigInteger(\"1000000000000000000\");\n\n for(int i = 1;i < n;i++){\n BigInteger b1 = BigInteger.valueOf(arr[i]);\n a1 = a1.multiply(b1);\n if(a1.compareTo(k) == 1){\n\n System.out.println(-1);\n return;\n }\n }\n System.out.println(a1);\n }",
"FastReader input = new FastReader();",
"input",
"new FastReader()",
"int n = input.nextInt();",
"n",
"input.nextInt()",
"input.nextInt",
"input",
"long[] arr = new long[n];",
"arr",
"new long[n]",
"n",
"for(int i = 0;i < n;i++){\n arr[i] = input.nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n arr[i] = input.nextLong();\n }",
"{\n arr[i] = input.nextLong();\n }",
"arr[i] = input.nextLong()",
"arr[i]",
"arr",
"i",
"input.nextLong()",
"input.nextLong",
"input",
"Arrays.sort(arr)",
"Arrays.sort",
"Arrays",
"arr",
"BigInteger a1 = BigInteger.valueOf(arr[0]);",
"a1",
"BigInteger.valueOf(arr[0])",
"BigInteger.valueOf",
"BigInteger",
"arr[0]",
"arr",
"0",
"BigInteger k = new BigInteger(\"1000000000000000000\");",
"k",
"new BigInteger(\"1000000000000000000\")",
"for(int i = 1;i < n;i++){\n BigInteger b1 = BigInteger.valueOf(arr[i]);\n a1 = a1.multiply(b1);\n if(a1.compareTo(k) == 1){\n\n System.out.println(-1);\n return;\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n BigInteger b1 = BigInteger.valueOf(arr[i]);\n a1 = a1.multiply(b1);\n if(a1.compareTo(k) == 1){\n\n System.out.println(-1);\n return;\n }\n }",
"{\n BigInteger b1 = BigInteger.valueOf(arr[i]);\n a1 = a1.multiply(b1);\n if(a1.compareTo(k) == 1){\n\n System.out.println(-1);\n return;\n }\n }",
"BigInteger b1 = BigInteger.valueOf(arr[i]);",
"b1",
"BigInteger.valueOf(arr[i])",
"BigInteger.valueOf",
"BigInteger",
"arr[i]",
"arr",
"i",
"a1 = a1.multiply(b1)",
"a1",
"a1.multiply(b1)",
"a1.multiply",
"a1",
"b1",
"if(a1.compareTo(k) == 1){\n\n System.out.println(-1);\n return;\n }",
"a1.compareTo(k) == 1",
"a1.compareTo(k)",
"a1.compareTo",
"a1",
"k",
"1",
"{\n\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"System.out.println(a1)",
"System.out.println",
"System.out",
"System",
"System.out",
"a1",
"String[] args",
"args",
"static class FastReader\n {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader()\n {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\n\n String next()\n {\n while (st == null || !st.hasMoreElements())\n {\n try\n {\n st = new StringTokenizer(br.readLine());\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt()\n {\n return Integer.parseInt(next());\n }\n\n long nextLong()\n {\n return Long.parseLong(next());\n }\n\n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n\n String nextLine()\n {\n String str = \"\";\n try\n {\n str = br.readLine();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n return str;\n }\n }",
"FastReader",
"BufferedReader br;",
"br",
"StringTokenizer st;",
"st",
"public FastReader()\n {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }",
"FastReader",
"{\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }",
"br = new BufferedReader(new\n InputStreamReader(System.in))",
"br",
"new BufferedReader(new\n InputStreamReader(System.in))",
"String next()\n {\n while (st == null || !st.hasMoreElements())\n {\n try\n {\n st = new StringTokenizer(br.readLine());\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }",
"next",
"{\n while (st == null || !st.hasMoreElements())\n {\n try\n {\n st = new StringTokenizer(br.readLine());\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }",
"while (st == null || !st.hasMoreElements())\n {\n try\n {\n st = new StringTokenizer(br.readLine());\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n }",
"st == null || !st.hasMoreElements()",
"st == null",
"st",
"null",
"!st.hasMoreElements()",
"st.hasMoreElements()",
"st.hasMoreElements",
"st",
"{\n try\n {\n st = new StringTokenizer(br.readLine());\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n }",
"try\n {\n st = new StringTokenizer(br.readLine());\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }",
"catch (IOException e)\n {\n e.printStackTrace();\n }",
"IOException e",
"{\n e.printStackTrace();\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n st = new StringTokenizer(br.readLine());\n }",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"int nextInt()\n {\n return Integer.parseInt(next());\n }",
"nextInt",
"{\n return Integer.parseInt(next());\n }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"long nextLong()\n {\n return Long.parseLong(next());\n }",
"nextLong",
"{\n return Long.parseLong(next());\n }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"double nextDouble()\n {\n return Double.parseDouble(next());\n }",
"nextDouble",
"{\n return Double.parseDouble(next());\n }",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"String nextLine()\n {\n String str = \"\";\n try\n {\n str = br.readLine();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n return str;\n }",
"nextLine",
"{\n String str = \"\";\n try\n {\n str = br.readLine();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n return str;\n }",
"String str = \"\";",
"str",
"\"\"",
"try\n {\n str = br.readLine();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }",
"catch (IOException e)\n {\n e.printStackTrace();\n }",
"IOException e",
"{\n e.printStackTrace();\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n str = br.readLine();\n }",
"str = br.readLine()",
"str",
"br.readLine()",
"br.readLine",
"br",
"return str;",
"str",
"public class Main {\n public static void main(String[] args) {\n FastReader input = new FastReader();\n int n = input.nextInt();\n long[] arr = new long[n];\n for(int i = 0;i < n;i++){\n arr[i] = input.nextLong();\n }\n Arrays.sort(arr);\n\n BigInteger a1 = BigInteger.valueOf(arr[0]);\n BigInteger k = new BigInteger(\"1000000000000000000\");\n\n for(int i = 1;i < n;i++){\n BigInteger b1 = BigInteger.valueOf(arr[i]);\n a1 = a1.multiply(b1);\n if(a1.compareTo(k) == 1){\n\n System.out.println(-1);\n return;\n }\n }\n System.out.println(a1);\n }\n static class FastReader\n {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader()\n {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\n\n String next()\n {\n while (st == null || !st.hasMoreElements())\n {\n try\n {\n st = new StringTokenizer(br.readLine());\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt()\n {\n return Integer.parseInt(next());\n }\n\n long nextLong()\n {\n return Long.parseLong(next());\n }\n\n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n\n String nextLine()\n {\n String str = \"\";\n try\n {\n str = br.readLine();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n return str;\n }\n }\n}",
"public class Main {\n public static void main(String[] args) {\n FastReader input = new FastReader();\n int n = input.nextInt();\n long[] arr = new long[n];\n for(int i = 0;i < n;i++){\n arr[i] = input.nextLong();\n }\n Arrays.sort(arr);\n\n BigInteger a1 = BigInteger.valueOf(arr[0]);\n BigInteger k = new BigInteger(\"1000000000000000000\");\n\n for(int i = 1;i < n;i++){\n BigInteger b1 = BigInteger.valueOf(arr[i]);\n a1 = a1.multiply(b1);\n if(a1.compareTo(k) == 1){\n\n System.out.println(-1);\n return;\n }\n }\n System.out.println(a1);\n }\n static class FastReader\n {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader()\n {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\n\n String next()\n {\n while (st == null || !st.hasMoreElements())\n {\n try\n {\n st = new StringTokenizer(br.readLine());\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt()\n {\n return Integer.parseInt(next());\n }\n\n long nextLong()\n {\n return Long.parseLong(next());\n }\n\n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n\n String nextLine()\n {\n String str = \"\";\n try\n {\n str = br.readLine();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n return str;\n }\n }\n}",
"Main"
] |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
FastReader input = new FastReader();
int n = input.nextInt();
long[] arr = new long[n];
for(int i = 0;i < n;i++){
arr[i] = input.nextLong();
}
Arrays.sort(arr);
BigInteger a1 = BigInteger.valueOf(arr[0]);
BigInteger k = new BigInteger("1000000000000000000");
for(int i = 1;i < n;i++){
BigInteger b1 = BigInteger.valueOf(arr[i]);
a1 = a1.multiply(b1);
if(a1.compareTo(k) == 1){
System.out.println(-1);
return;
}
}
System.out.println(a1);
}
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next()
{
while (st == null || !st.hasMoreElements())
{
try
{
st = new StringTokenizer(br.readLine());
}
catch (IOException e)
{
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt()
{
return Integer.parseInt(next());
}
long nextLong()
{
return Long.parseLong(next());
}
double nextDouble()
{
return Double.parseDouble(next());
}
String nextLine()
{
String str = "";
try
{
str = br.readLine();
}
catch (IOException e)
{
e.printStackTrace();
}
return str;
}
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
17,
12,
13,
30,
41,
13,
17,
41,
13,
20,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
14,
2,
13,
40,
17,
30,
14,
2,
13,
2,
13,
13,
30,
0,
13,
40,
17,
30,
0,
13,
13,
14,
2,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
30,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
96,
5
],
[
96,
6
],
[
6,
7
],
[
6,
8
],
[
96,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
11,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
11,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
35,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
41,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
46,
51
],
[
45,
52
],
[
35,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
53,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
62,
64
],
[
59,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
59,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
11,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
74,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
79,
84
],
[
84,
85
],
[
74,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
9,
93
],
[
93,
94
],
[
0,
95
],
[
95,
96
],
[
95,
97
]
] |
[
"import java.util.*;\n\npublic class Main {\n private static final long MAX = (long)1e18;\n \n public static void main(String args[]) {\n \tlong multiplication = 1;\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n \n for (int i=0; i<n; i++) {\n long num = in.nextLong();\n if (num == 0) {\n System.out.print(0);\n return;\n } \n \n if (multiplication != -1) {\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }\n }\n \n if (multiplication > MAX) {\n System.out.print(-1);\n } else {\n System.out.print(multiplication);\n }\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n private static final long MAX = (long)1e18;\n \n public static void main(String args[]) {\n \tlong multiplication = 1;\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n \n for (int i=0; i<n; i++) {\n long num = in.nextLong();\n if (num == 0) {\n System.out.print(0);\n return;\n } \n \n if (multiplication != -1) {\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }\n }\n \n if (multiplication > MAX) {\n System.out.print(-1);\n } else {\n System.out.print(multiplication);\n }\n }\n}",
"Main",
"private static final long MAX = (long)1e18;",
"MAX",
"(long)1e18",
"public static void main(String args[]) {\n \tlong multiplication = 1;\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n \n for (int i=0; i<n; i++) {\n long num = in.nextLong();\n if (num == 0) {\n System.out.print(0);\n return;\n } \n \n if (multiplication != -1) {\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }\n }\n \n if (multiplication > MAX) {\n System.out.print(-1);\n } else {\n System.out.print(multiplication);\n }\n }",
"main",
"{\n \tlong multiplication = 1;\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n \n for (int i=0; i<n; i++) {\n long num = in.nextLong();\n if (num == 0) {\n System.out.print(0);\n return;\n } \n \n if (multiplication != -1) {\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }\n }\n \n if (multiplication > MAX) {\n System.out.print(-1);\n } else {\n System.out.print(multiplication);\n }\n }",
"long multiplication = 1;",
"multiplication",
"1",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"for (int i=0; i<n; i++) {\n long num = in.nextLong();\n if (num == 0) {\n System.out.print(0);\n return;\n } \n \n if (multiplication != -1) {\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n long num = in.nextLong();\n if (num == 0) {\n System.out.print(0);\n return;\n } \n \n if (multiplication != -1) {\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }\n }",
"{\n long num = in.nextLong();\n if (num == 0) {\n System.out.print(0);\n return;\n } \n \n if (multiplication != -1) {\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }\n }",
"long num = in.nextLong();",
"num",
"in.nextLong()",
"in.nextLong",
"in",
"if (num == 0) {\n System.out.print(0);\n return;\n }",
"num == 0",
"num",
"0",
"{\n System.out.print(0);\n return;\n }",
"System.out.print(0)",
"System.out.print",
"System.out",
"System",
"System.out",
"0",
"return;",
"if (multiplication != -1) {\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }",
"multiplication != -1",
"multiplication",
"-1",
"1",
"{\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }",
"if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }",
"num > MAX / multiplication",
"num",
"MAX / multiplication",
"MAX",
"multiplication",
"{\n multiplication = -1;\n }",
"multiplication = -1",
"multiplication",
"-1",
"1",
"{ \n multiplication *= num;\n }",
"multiplication *= num",
"multiplication",
"num",
"if (multiplication > MAX) {\n System.out.print(-1);\n } else {\n System.out.print(multiplication);\n }",
"multiplication > MAX",
"multiplication",
"MAX",
"{\n System.out.print(-1);\n }",
"System.out.print(-1)",
"System.out.print",
"System.out",
"System",
"System.out",
"-1",
"1",
"{\n System.out.print(multiplication);\n }",
"System.out.print(multiplication)",
"System.out.print",
"System.out",
"System",
"System.out",
"multiplication",
"String args[]",
"args",
"public class Main {\n private static final long MAX = (long)1e18;\n \n public static void main(String args[]) {\n \tlong multiplication = 1;\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n \n for (int i=0; i<n; i++) {\n long num = in.nextLong();\n if (num == 0) {\n System.out.print(0);\n return;\n } \n \n if (multiplication != -1) {\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }\n }\n \n if (multiplication > MAX) {\n System.out.print(-1);\n } else {\n System.out.print(multiplication);\n }\n }\n}",
"public class Main {\n private static final long MAX = (long)1e18;\n \n public static void main(String args[]) {\n \tlong multiplication = 1;\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n \n for (int i=0; i<n; i++) {\n long num = in.nextLong();\n if (num == 0) {\n System.out.print(0);\n return;\n } \n \n if (multiplication != -1) {\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }\n }\n \n if (multiplication > MAX) {\n System.out.print(-1);\n } else {\n System.out.print(multiplication);\n }\n }\n}",
"Main"
] |
import java.util.*;
public class Main {
private static final long MAX = (long)1e18;
public static void main(String args[]) {
long multiplication = 1;
Scanner in = new Scanner(System.in);
int n = in.nextInt();
for (int i=0; i<n; i++) {
long num = in.nextLong();
if (num == 0) {
System.out.print(0);
return;
}
if (multiplication != -1) {
if (num > MAX / multiplication) {
multiplication = -1;
} else {
multiplication *= num;
}
}
}
if (multiplication > MAX) {
System.out.print(-1);
} else {
System.out.print(multiplication);
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
4,
18,
18,
13,
13,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
4,
18,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
123,
8
],
[
123,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
11,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
11,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
29,
31
],
[
11,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
32,
37
],
[
37,
38
],
[
37,
39
],
[
32,
40
],
[
40,
41
],
[
41,
42
],
[
32,
43
],
[
44,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
44,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
59,
60
],
[
59,
61
],
[
53,
62
],
[
52,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
64,
69
],
[
63,
70
],
[
70,
71
],
[
71,
72
],
[
70,
73
],
[
11,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
79,
80
],
[
79,
81
],
[
74,
82
],
[
82,
83
],
[
83,
84
],
[
74,
85
],
[
86,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
92,
93
],
[
92,
94
],
[
86,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
96,
101
],
[
95,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
108,
109
],
[
102,
110
],
[
110,
111
],
[
111,
112
],
[
110,
113
],
[
11,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
9,
120
],
[
120,
121
],
[
0,
122
],
[
122,
123
],
[
122,
124
]
] |
[
"import java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tBigInteger MAX = new BigInteger(\"1000000000000000000\");\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger[] s = new BigInteger[n];\n\t\tBigInteger ans = BigInteger.ONE;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextBigInteger();\n\t\t\tif (s[i].compareTo(BigInteger.ZERO) == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans = ans.multiply(s[i]);\n\t\t\tif (ans.compareTo(MAX) == 1) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t}\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tBigInteger MAX = new BigInteger(\"1000000000000000000\");\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger[] s = new BigInteger[n];\n\t\tBigInteger ans = BigInteger.ONE;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextBigInteger();\n\t\t\tif (s[i].compareTo(BigInteger.ZERO) == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans = ans.multiply(s[i]);\n\t\t\tif (ans.compareTo(MAX) == 1) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tBigInteger MAX = new BigInteger(\"1000000000000000000\");\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger[] s = new BigInteger[n];\n\t\tBigInteger ans = BigInteger.ONE;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextBigInteger();\n\t\t\tif (s[i].compareTo(BigInteger.ZERO) == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans = ans.multiply(s[i]);\n\t\t\tif (ans.compareTo(MAX) == 1) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\tBigInteger MAX = new BigInteger(\"1000000000000000000\");\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger[] s = new BigInteger[n];\n\t\tBigInteger ans = BigInteger.ONE;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextBigInteger();\n\t\t\tif (s[i].compareTo(BigInteger.ZERO) == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans = ans.multiply(s[i]);\n\t\t\tif (ans.compareTo(MAX) == 1) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t}",
"BigInteger MAX = new BigInteger(\"1000000000000000000\");",
"MAX",
"new BigInteger(\"1000000000000000000\")",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BigInteger[] s = new BigInteger[n];",
"s",
"new BigInteger[n]",
"n",
"BigInteger ans = BigInteger.ONE;",
"ans",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"for (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextBigInteger();\n\t\t\tif (s[i].compareTo(BigInteger.ZERO) == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ts[i] = sc.nextBigInteger();\n\t\t\tif (s[i].compareTo(BigInteger.ZERO) == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}",
"{\n\t\t\ts[i] = sc.nextBigInteger();\n\t\t\tif (s[i].compareTo(BigInteger.ZERO) == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}",
"s[i] = sc.nextBigInteger()",
"s[i]",
"s",
"i",
"sc.nextBigInteger()",
"sc.nextBigInteger",
"sc",
"if (s[i].compareTo(BigInteger.ZERO) == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}",
"s[i].compareTo(BigInteger.ZERO) == 0",
"s[i].compareTo(BigInteger.ZERO)",
"s[i].compareTo",
"s[i]",
"s",
"i",
"BigInteger.ZERO",
"BigInteger",
"BigInteger.ZERO",
"0",
"{\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"System.exit(0)",
"System.exit",
"System",
"0",
"for (int i = 0; i < n; i++) {\n\t\t\tans = ans.multiply(s[i]);\n\t\t\tif (ans.compareTo(MAX) == 1) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tans = ans.multiply(s[i]);\n\t\t\tif (ans.compareTo(MAX) == 1) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}",
"{\n\t\t\tans = ans.multiply(s[i]);\n\t\t\tif (ans.compareTo(MAX) == 1) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}",
"ans = ans.multiply(s[i])",
"ans",
"ans.multiply(s[i])",
"ans.multiply",
"ans",
"s[i]",
"s",
"i",
"if (ans.compareTo(MAX) == 1) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}",
"ans.compareTo(MAX) == 1",
"ans.compareTo(MAX)",
"ans.compareTo",
"ans",
"MAX",
"1",
"{\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"System.exit(0)",
"System.exit",
"System",
"0",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tBigInteger MAX = new BigInteger(\"1000000000000000000\");\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger[] s = new BigInteger[n];\n\t\tBigInteger ans = BigInteger.ONE;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextBigInteger();\n\t\t\tif (s[i].compareTo(BigInteger.ZERO) == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans = ans.multiply(s[i]);\n\t\t\tif (ans.compareTo(MAX) == 1) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tBigInteger MAX = new BigInteger(\"1000000000000000000\");\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger[] s = new BigInteger[n];\n\t\tBigInteger ans = BigInteger.ONE;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextBigInteger();\n\t\t\tif (s[i].compareTo(BigInteger.ZERO) == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans = ans.multiply(s[i]);\n\t\t\tif (ans.compareTo(MAX) == 1) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main"
] |
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.ONE;
for (int i = 0; i < n; i++) {
s[i] = sc.nextBigInteger();
if (s[i].compareTo(BigInteger.ZERO) == 0) {
System.out.println(0);
System.exit(0);
}
}
for (int i = 0; i < n; i++) {
ans = ans.multiply(s[i]);
if (ans.compareTo(MAX) == 1) {
System.out.println(-1);
System.exit(0);
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
0,
13,
17,
3,
14,
2,
18,
13,
13,
2,
17,
13,
30,
0,
13,
18,
13,
13,
30,
0,
13,
40,
17,
3,
14,
2,
13,
17,
30,
0,
13,
40,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
110,
5
],
[
110,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
8,
44
],
[
44,
45
],
[
45,
46
],
[
44,
47
],
[
8,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
48,
53
],
[
53,
54
],
[
53,
55
],
[
48,
56
],
[
56,
57
],
[
57,
58
],
[
48,
59
],
[
60,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
61,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
61,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
77,
79
],
[
72,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
72,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
86,
91
],
[
8,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
8,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
6,
107
],
[
107,
108
],
[
0,
109
],
[
109,
110
],
[
109,
111
]
] |
[
"import java.util.*;\npublic class Main{\n\tpublic static void main(String args[]){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N];\n\t\tlong ans = 1;\n\t\tfor(int i = 0;i < N;i++){\n\t\t\tA[i] = sc.nextLong();\n\t\t}\n\t\tArrays.sort(A);\n\t\tfor(int i = 0;i < N;i++){\n\t\t\tif(A[i] == 0){\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(A[i] <= 1000000000000000000L / ans){\n\t\t\t\tans *= A[i];\n\t\t\t}else{\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(ans > 1000000000000000000L){\n\t\t\tans = -1;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n\tpublic static void main(String args[]){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N];\n\t\tlong ans = 1;\n\t\tfor(int i = 0;i < N;i++){\n\t\t\tA[i] = sc.nextLong();\n\t\t}\n\t\tArrays.sort(A);\n\t\tfor(int i = 0;i < N;i++){\n\t\t\tif(A[i] == 0){\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(A[i] <= 1000000000000000000L / ans){\n\t\t\t\tans *= A[i];\n\t\t\t}else{\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(ans > 1000000000000000000L){\n\t\t\tans = -1;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main",
"public static void main(String args[]){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N];\n\t\tlong ans = 1;\n\t\tfor(int i = 0;i < N;i++){\n\t\t\tA[i] = sc.nextLong();\n\t\t}\n\t\tArrays.sort(A);\n\t\tfor(int i = 0;i < N;i++){\n\t\t\tif(A[i] == 0){\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(A[i] <= 1000000000000000000L / ans){\n\t\t\t\tans *= A[i];\n\t\t\t}else{\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(ans > 1000000000000000000L){\n\t\t\tans = -1;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N];\n\t\tlong ans = 1;\n\t\tfor(int i = 0;i < N;i++){\n\t\t\tA[i] = sc.nextLong();\n\t\t}\n\t\tArrays.sort(A);\n\t\tfor(int i = 0;i < N;i++){\n\t\t\tif(A[i] == 0){\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(A[i] <= 1000000000000000000L / ans){\n\t\t\t\tans *= A[i];\n\t\t\t}else{\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(ans > 1000000000000000000L){\n\t\t\tans = -1;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] A = new long[N];",
"A",
"new long[N]",
"N",
"long ans = 1;",
"ans",
"1",
"for(int i = 0;i < N;i++){\n\t\t\tA[i] = sc.nextLong();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tA[i] = sc.nextLong();\n\t\t}",
"{\n\t\t\tA[i] = sc.nextLong();\n\t\t}",
"A[i] = sc.nextLong()",
"A[i]",
"A",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"Arrays.sort(A)",
"Arrays.sort",
"Arrays",
"A",
"for(int i = 0;i < N;i++){\n\t\t\tif(A[i] == 0){\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(A[i] <= 1000000000000000000L / ans){\n\t\t\t\tans *= A[i];\n\t\t\t}else{\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tif(A[i] == 0){\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(A[i] <= 1000000000000000000L / ans){\n\t\t\t\tans *= A[i];\n\t\t\t}else{\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(A[i] == 0){\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(A[i] <= 1000000000000000000L / ans){\n\t\t\t\tans *= A[i];\n\t\t\t}else{\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"if(A[i] == 0){\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(A[i] <= 1000000000000000000L / ans){\n\t\t\t\tans *= A[i];\n\t\t\t}else{\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}",
"A[i] == 0",
"A[i]",
"A",
"i",
"0",
"{\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}",
"ans = 0",
"ans",
"0",
"break;",
"if(A[i] <= 1000000000000000000L / ans){\n\t\t\t\tans *= A[i];\n\t\t\t}else{\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}",
"A[i] <= 1000000000000000000L / ans",
"A[i]",
"A",
"i",
"1000000000000000000L / ans",
"1000000000000000000L",
"ans",
"{\n\t\t\t\tans *= A[i];\n\t\t\t}",
"ans *= A[i]",
"ans",
"A[i]",
"A",
"i",
"{\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}",
"ans = -1",
"ans",
"-1",
"1",
"break;",
"if(ans > 1000000000000000000L){\n\t\t\tans = -1;\n\t\t}",
"ans > 1000000000000000000L",
"ans",
"1000000000000000000L",
"{\n\t\t\tans = -1;\n\t\t}",
"ans = -1",
"ans",
"-1",
"1",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String args[]",
"args",
"public class Main{\n\tpublic static void main(String args[]){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N];\n\t\tlong ans = 1;\n\t\tfor(int i = 0;i < N;i++){\n\t\t\tA[i] = sc.nextLong();\n\t\t}\n\t\tArrays.sort(A);\n\t\tfor(int i = 0;i < N;i++){\n\t\t\tif(A[i] == 0){\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(A[i] <= 1000000000000000000L / ans){\n\t\t\t\tans *= A[i];\n\t\t\t}else{\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(ans > 1000000000000000000L){\n\t\t\tans = -1;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"public class Main{\n\tpublic static void main(String args[]){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N];\n\t\tlong ans = 1;\n\t\tfor(int i = 0;i < N;i++){\n\t\t\tA[i] = sc.nextLong();\n\t\t}\n\t\tArrays.sort(A);\n\t\tfor(int i = 0;i < N;i++){\n\t\t\tif(A[i] == 0){\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(A[i] <= 1000000000000000000L / ans){\n\t\t\t\tans *= A[i];\n\t\t\t}else{\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(ans > 1000000000000000000L){\n\t\t\tans = -1;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main"
] |
import java.util.*;
public class Main{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long[] A = new long[N];
long ans = 1;
for(int i = 0;i < N;i++){
A[i] = sc.nextLong();
}
Arrays.sort(A);
for(int i = 0;i < N;i++){
if(A[i] == 0){
ans = 0;
break;
}else if(A[i] <= 1000000000000000000L / ans){
ans *= A[i];
}else{
ans = -1;
break;
}
}
if(ans > 1000000000000000000L){
ans = -1;
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
17,
13,
18,
13,
13,
30,
0,
13,
17,
0,
13,
18,
13,
13,
14,
2,
13,
17,
30,
0,
13,
17,
4,
18,
18,
13,
13,
8,
13,
13,
40,
17,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
102,
5
],
[
102,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
42,
43
],
[
41,
44
],
[
8,
45
],
[
45,
46
],
[
45,
47
],
[
8,
48
],
[
48,
49
],
[
48,
50
],
[
8,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
56,
57
],
[
56,
58
],
[
51,
59
],
[
59,
60
],
[
60,
61
],
[
51,
62
],
[
63,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
69,
70
],
[
69,
71
],
[
64,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
63,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
63,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
8,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
94,
95
],
[
94,
96
],
[
94,
97
],
[
97,
98
],
[
6,
99
],
[
99,
100
],
[
0,
101
],
[
101,
102
],
[
101,
103
]
] |
[
"import java.util.*;\npublic class Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int N = in.nextInt();\n long[] arr = new long[N];\n for (int i = 0; i < N; i++) {\n arr[i] = in.nextLong();\n }\n Arrays.sort(arr);\n long res = 1;\n boolean valid = true;\n for (int i = 0; i < N; i++) {\n if (1_000_000_000_000_000_000.0 / res < arr[i]) {\n valid = false;\n }\n res *= arr[i];\n if (res > 1_000_000_000_000_000_000L) {\n valid = false;\n }\n }\n System.out.println(valid ? res : -1);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int N = in.nextInt();\n long[] arr = new long[N];\n for (int i = 0; i < N; i++) {\n arr[i] = in.nextLong();\n }\n Arrays.sort(arr);\n long res = 1;\n boolean valid = true;\n for (int i = 0; i < N; i++) {\n if (1_000_000_000_000_000_000.0 / res < arr[i]) {\n valid = false;\n }\n res *= arr[i];\n if (res > 1_000_000_000_000_000_000L) {\n valid = false;\n }\n }\n System.out.println(valid ? res : -1);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int N = in.nextInt();\n long[] arr = new long[N];\n for (int i = 0; i < N; i++) {\n arr[i] = in.nextLong();\n }\n Arrays.sort(arr);\n long res = 1;\n boolean valid = true;\n for (int i = 0; i < N; i++) {\n if (1_000_000_000_000_000_000.0 / res < arr[i]) {\n valid = false;\n }\n res *= arr[i];\n if (res > 1_000_000_000_000_000_000L) {\n valid = false;\n }\n }\n System.out.println(valid ? res : -1);\n }",
"main",
"{\n Scanner in = new Scanner(System.in);\n int N = in.nextInt();\n long[] arr = new long[N];\n for (int i = 0; i < N; i++) {\n arr[i] = in.nextLong();\n }\n Arrays.sort(arr);\n long res = 1;\n boolean valid = true;\n for (int i = 0; i < N; i++) {\n if (1_000_000_000_000_000_000.0 / res < arr[i]) {\n valid = false;\n }\n res *= arr[i];\n if (res > 1_000_000_000_000_000_000L) {\n valid = false;\n }\n }\n System.out.println(valid ? res : -1);\n }",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int N = in.nextInt();",
"N",
"in.nextInt()",
"in.nextInt",
"in",
"long[] arr = new long[N];",
"arr",
"new long[N]",
"N",
"for (int i = 0; i < N; i++) {\n arr[i] = in.nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n arr[i] = in.nextLong();\n }",
"{\n arr[i] = in.nextLong();\n }",
"arr[i] = in.nextLong()",
"arr[i]",
"arr",
"i",
"in.nextLong()",
"in.nextLong",
"in",
"Arrays.sort(arr)",
"Arrays.sort",
"Arrays",
"arr",
"long res = 1;",
"res",
"1",
"boolean valid = true;",
"valid",
"true",
"for (int i = 0; i < N; i++) {\n if (1_000_000_000_000_000_000.0 / res < arr[i]) {\n valid = false;\n }\n res *= arr[i];\n if (res > 1_000_000_000_000_000_000L) {\n valid = false;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if (1_000_000_000_000_000_000.0 / res < arr[i]) {\n valid = false;\n }\n res *= arr[i];\n if (res > 1_000_000_000_000_000_000L) {\n valid = false;\n }\n }",
"{\n if (1_000_000_000_000_000_000.0 / res < arr[i]) {\n valid = false;\n }\n res *= arr[i];\n if (res > 1_000_000_000_000_000_000L) {\n valid = false;\n }\n }",
"if (1_000_000_000_000_000_000.0 / res < arr[i]) {\n valid = false;\n }",
"1_000_000_000_000_000_000.0 / res < arr[i]",
"1_000_000_000_000_000_000.0 / res",
"1_000_000_000_000_000_000.0",
"res",
"arr[i]",
"arr",
"i",
"{\n valid = false;\n }",
"valid = false",
"valid",
"false",
"res *= arr[i]",
"res",
"arr[i]",
"arr",
"i",
"if (res > 1_000_000_000_000_000_000L) {\n valid = false;\n }",
"res > 1_000_000_000_000_000_000L",
"res",
"1_000_000_000_000_000_000L",
"{\n valid = false;\n }",
"valid = false",
"valid",
"false",
"System.out.println(valid ? res : -1)",
"System.out.println",
"System.out",
"System",
"System.out",
"valid ? res : -1",
"valid",
"res",
"-1",
"1",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int N = in.nextInt();\n long[] arr = new long[N];\n for (int i = 0; i < N; i++) {\n arr[i] = in.nextLong();\n }\n Arrays.sort(arr);\n long res = 1;\n boolean valid = true;\n for (int i = 0; i < N; i++) {\n if (1_000_000_000_000_000_000.0 / res < arr[i]) {\n valid = false;\n }\n res *= arr[i];\n if (res > 1_000_000_000_000_000_000L) {\n valid = false;\n }\n }\n System.out.println(valid ? res : -1);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int N = in.nextInt();\n long[] arr = new long[N];\n for (int i = 0; i < N; i++) {\n arr[i] = in.nextLong();\n }\n Arrays.sort(arr);\n long res = 1;\n boolean valid = true;\n for (int i = 0; i < N; i++) {\n if (1_000_000_000_000_000_000.0 / res < arr[i]) {\n valid = false;\n }\n res *= arr[i];\n if (res > 1_000_000_000_000_000_000L) {\n valid = false;\n }\n }\n System.out.println(valid ? res : -1);\n }\n}",
"Main"
] |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int N = in.nextInt();
long[] arr = new long[N];
for (int i = 0; i < N; i++) {
arr[i] = in.nextLong();
}
Arrays.sort(arr);
long res = 1;
boolean valid = true;
for (int i = 0; i < N; i++) {
if (1_000_000_000_000_000_000.0 / res < arr[i]) {
valid = false;
}
res *= arr[i];
if (res > 1_000_000_000_000_000_000L) {
valid = false;
}
}
System.out.println(valid ? res : -1);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
20,
41,
13,
20,
0,
13,
4,
18,
13,
41,
13,
4,
18,
13,
17,
41,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
28,
13,
13,
30,
30,
0,
13,
4,
18,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
115,
11
],
[
115,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
14,
17
],
[
17,
18
],
[
17,
19
],
[
14,
20
],
[
20,
21
],
[
20,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
14,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
30,
33
],
[
14,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
37,
38
],
[
36,
39
],
[
14,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
40,
45
],
[
45,
46
],
[
45,
47
],
[
40,
48
],
[
48,
49
],
[
49,
50
],
[
40,
51
],
[
52,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
53,
56
],
[
56,
57
],
[
57,
58
],
[
52,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
60,
65
],
[
59,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
66,
73
],
[
14,
74
],
[
74,
75
],
[
74,
76
],
[
74,
77
],
[
78,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
84,
85
],
[
85,
86
],
[
84,
87
],
[
78,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
89,
94
],
[
88,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
95,
102
],
[
14,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
14,
109
],
[
109,
110
],
[
110,
111
],
[
12,
112
],
[
112,
113
],
[
0,
114
],
[
114,
115
],
[
114,
116
]
] |
[
"import java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n int n;\n ArrayList<Long> aa = new ArrayList<Long>();\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n BigInteger min = BigInteger.valueOf(1L);\n final BigInteger max = BigInteger.valueOf(1_000_000_000_000_000_000L);\n for(int i=0; i<n; i++) {\n aa.add(sc.nextLong());\n if(aa.get(i)==0L) {\n System.out.println(\"0\");\n return ;\n }\n }\n for(long a : aa) {\n min = min.multiply(BigInteger.valueOf(a));\n if(min.compareTo(max) > 0) {\n System.out.println(\"-1\");\n return ;\n }\n }\n System.out.println(min);\n sc.close();\n \n }\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n int n;\n ArrayList<Long> aa = new ArrayList<Long>();\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n BigInteger min = BigInteger.valueOf(1L);\n final BigInteger max = BigInteger.valueOf(1_000_000_000_000_000_000L);\n for(int i=0; i<n; i++) {\n aa.add(sc.nextLong());\n if(aa.get(i)==0L) {\n System.out.println(\"0\");\n return ;\n }\n }\n for(long a : aa) {\n min = min.multiply(BigInteger.valueOf(a));\n if(min.compareTo(max) > 0) {\n System.out.println(\"-1\");\n return ;\n }\n }\n System.out.println(min);\n sc.close();\n \n }\n}",
"Main",
"public static void main(String[] args) {\n int n;\n ArrayList<Long> aa = new ArrayList<Long>();\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n BigInteger min = BigInteger.valueOf(1L);\n final BigInteger max = BigInteger.valueOf(1_000_000_000_000_000_000L);\n for(int i=0; i<n; i++) {\n aa.add(sc.nextLong());\n if(aa.get(i)==0L) {\n System.out.println(\"0\");\n return ;\n }\n }\n for(long a : aa) {\n min = min.multiply(BigInteger.valueOf(a));\n if(min.compareTo(max) > 0) {\n System.out.println(\"-1\");\n return ;\n }\n }\n System.out.println(min);\n sc.close();\n \n }",
"main",
"{\n int n;\n ArrayList<Long> aa = new ArrayList<Long>();\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n BigInteger min = BigInteger.valueOf(1L);\n final BigInteger max = BigInteger.valueOf(1_000_000_000_000_000_000L);\n for(int i=0; i<n; i++) {\n aa.add(sc.nextLong());\n if(aa.get(i)==0L) {\n System.out.println(\"0\");\n return ;\n }\n }\n for(long a : aa) {\n min = min.multiply(BigInteger.valueOf(a));\n if(min.compareTo(max) > 0) {\n System.out.println(\"-1\");\n return ;\n }\n }\n System.out.println(min);\n sc.close();\n \n }",
"int n;",
"n",
"ArrayList<Long> aa = new ArrayList<Long>();",
"aa",
"new ArrayList<Long>()",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BigInteger min = BigInteger.valueOf(1L);",
"min",
"BigInteger.valueOf(1L)",
"BigInteger.valueOf",
"BigInteger",
"1L",
"final BigInteger max = BigInteger.valueOf(1_000_000_000_000_000_000L);",
"max",
"BigInteger.valueOf(1_000_000_000_000_000_000L)",
"BigInteger.valueOf",
"BigInteger",
"1_000_000_000_000_000_000L",
"for(int i=0; i<n; i++) {\n aa.add(sc.nextLong());\n if(aa.get(i)==0L) {\n System.out.println(\"0\");\n return ;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n aa.add(sc.nextLong());\n if(aa.get(i)==0L) {\n System.out.println(\"0\");\n return ;\n }\n }",
"{\n aa.add(sc.nextLong());\n if(aa.get(i)==0L) {\n System.out.println(\"0\");\n return ;\n }\n }",
"aa.add(sc.nextLong())",
"aa.add",
"aa",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(aa.get(i)==0L) {\n System.out.println(\"0\");\n return ;\n }",
"aa.get(i)==0L",
"aa.get(i)",
"aa.get",
"aa",
"i",
"0L",
"{\n System.out.println(\"0\");\n return ;\n }",
"System.out.println(\"0\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"0\"",
"return ;",
"for(long a : aa) {\n min = min.multiply(BigInteger.valueOf(a));\n if(min.compareTo(max) > 0) {\n System.out.println(\"-1\");\n return ;\n }\n }",
"long a",
"aa",
"{\n min = min.multiply(BigInteger.valueOf(a));\n if(min.compareTo(max) > 0) {\n System.out.println(\"-1\");\n return ;\n }\n }",
"{\n min = min.multiply(BigInteger.valueOf(a));\n if(min.compareTo(max) > 0) {\n System.out.println(\"-1\");\n return ;\n }\n }",
"min = min.multiply(BigInteger.valueOf(a))",
"min",
"min.multiply(BigInteger.valueOf(a))",
"min.multiply",
"min",
"BigInteger.valueOf(a)",
"BigInteger.valueOf",
"BigInteger",
"a",
"if(min.compareTo(max) > 0) {\n System.out.println(\"-1\");\n return ;\n }",
"min.compareTo(max) > 0",
"min.compareTo(max)",
"min.compareTo",
"min",
"max",
"0",
"{\n System.out.println(\"-1\");\n return ;\n }",
"System.out.println(\"-1\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"return ;",
"System.out.println(min)",
"System.out.println",
"System.out",
"System",
"System.out",
"min",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"public class Main {\n\n public static void main(String[] args) {\n int n;\n ArrayList<Long> aa = new ArrayList<Long>();\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n BigInteger min = BigInteger.valueOf(1L);\n final BigInteger max = BigInteger.valueOf(1_000_000_000_000_000_000L);\n for(int i=0; i<n; i++) {\n aa.add(sc.nextLong());\n if(aa.get(i)==0L) {\n System.out.println(\"0\");\n return ;\n }\n }\n for(long a : aa) {\n min = min.multiply(BigInteger.valueOf(a));\n if(min.compareTo(max) > 0) {\n System.out.println(\"-1\");\n return ;\n }\n }\n System.out.println(min);\n sc.close();\n \n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n int n;\n ArrayList<Long> aa = new ArrayList<Long>();\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n BigInteger min = BigInteger.valueOf(1L);\n final BigInteger max = BigInteger.valueOf(1_000_000_000_000_000_000L);\n for(int i=0; i<n; i++) {\n aa.add(sc.nextLong());\n if(aa.get(i)==0L) {\n System.out.println(\"0\");\n return ;\n }\n }\n for(long a : aa) {\n min = min.multiply(BigInteger.valueOf(a));\n if(min.compareTo(max) > 0) {\n System.out.println(\"-1\");\n return ;\n }\n }\n System.out.println(min);\n sc.close();\n \n }\n}",
"Main"
] |
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int n;
ArrayList<Long> aa = new ArrayList<Long>();
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
BigInteger min = BigInteger.valueOf(1L);
final BigInteger max = BigInteger.valueOf(1_000_000_000_000_000_000L);
for(int i=0; i<n; i++) {
aa.add(sc.nextLong());
if(aa.get(i)==0L) {
System.out.println("0");
return ;
}
}
for(long a : aa) {
min = min.multiply(BigInteger.valueOf(a));
if(min.compareTo(max) > 0) {
System.out.println("-1");
return ;
}
}
System.out.println(min);
sc.close();
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
13,
18,
13,
13,
30,
0,
13,
2,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
116,
5
],
[
116,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
14,
17
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
43,
46
],
[
46,
47
],
[
47,
48
],
[
38,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
49,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
55,
62
],
[
8,
63
],
[
63,
64
],
[
63,
65
],
[
8,
66
],
[
66,
67
],
[
66,
68
],
[
8,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
74,
75
],
[
74,
76
],
[
69,
77
],
[
77,
78
],
[
78,
79
],
[
69,
80
],
[
81,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
82,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
82,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
99,
104
],
[
104,
105
],
[
98,
106
],
[
8,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
6,
113
],
[
113,
114
],
[
0,
115
],
[
115,
116
],
[
115,
117
]
] |
[
"\nimport java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = Integer.parseInt(sc.next());\n\n\t\tlong a[];\n\t\ta = new long[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Long.parseLong(sc.next());\n\t\t\tif (a[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tlong result = 1;\n\t\tlong limit = 1000000000000000000L;\n\t\tfor (int i = 0; i < n; i++) {\n\n\t\t\tif (result <= limit / a[i]) {\n\t\t\t\tresult = result * a[i];\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result);\n\n\t}\n\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = Integer.parseInt(sc.next());\n\n\t\tlong a[];\n\t\ta = new long[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Long.parseLong(sc.next());\n\t\t\tif (a[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tlong result = 1;\n\t\tlong limit = 1000000000000000000L;\n\t\tfor (int i = 0; i < n; i++) {\n\n\t\t\tif (result <= limit / a[i]) {\n\t\t\t\tresult = result * a[i];\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result);\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = Integer.parseInt(sc.next());\n\n\t\tlong a[];\n\t\ta = new long[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Long.parseLong(sc.next());\n\t\t\tif (a[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tlong result = 1;\n\t\tlong limit = 1000000000000000000L;\n\t\tfor (int i = 0; i < n; i++) {\n\n\t\t\tif (result <= limit / a[i]) {\n\t\t\t\tresult = result * a[i];\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result);\n\n\t}",
"main",
"{\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = Integer.parseInt(sc.next());\n\n\t\tlong a[];\n\t\ta = new long[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Long.parseLong(sc.next());\n\t\t\tif (a[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tlong result = 1;\n\t\tlong limit = 1000000000000000000L;\n\t\tfor (int i = 0; i < n; i++) {\n\n\t\t\tif (result <= limit / a[i]) {\n\t\t\t\tresult = result * a[i];\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result);\n\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = Integer.parseInt(sc.next());",
"n",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"long a[];",
"a",
"a = new long[n]",
"a",
"new long[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\ta[i] = Long.parseLong(sc.next());\n\t\t\tif (a[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = Long.parseLong(sc.next());\n\t\t\tif (a[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"{\n\t\t\ta[i] = Long.parseLong(sc.next());\n\t\t\tif (a[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"a[i] = Long.parseLong(sc.next())",
"a[i]",
"a",
"i",
"Long.parseLong(sc.next())",
"Long.parseLong",
"Long",
"sc.next()",
"sc.next",
"sc",
"if (a[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"{\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"long result = 1;",
"result",
"1",
"long limit = 1000000000000000000L;",
"limit",
"1000000000000000000L",
"for (int i = 0; i < n; i++) {\n\n\t\t\tif (result <= limit / a[i]) {\n\t\t\t\tresult = result * a[i];\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\n\t\t\tif (result <= limit / a[i]) {\n\t\t\t\tresult = result * a[i];\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"{\n\n\t\t\tif (result <= limit / a[i]) {\n\t\t\t\tresult = result * a[i];\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"if (result <= limit / a[i]) {\n\t\t\t\tresult = result * a[i];\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}",
"result <= limit / a[i]",
"result",
"limit / a[i]",
"limit",
"a[i]",
"a",
"i",
"{\n\t\t\t\tresult = result * a[i];\n\t\t\t}",
"result = result * a[i]",
"result",
"result * a[i]",
"result",
"a[i]",
"a",
"i",
"{\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = Integer.parseInt(sc.next());\n\n\t\tlong a[];\n\t\ta = new long[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Long.parseLong(sc.next());\n\t\t\tif (a[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tlong result = 1;\n\t\tlong limit = 1000000000000000000L;\n\t\tfor (int i = 0; i < n; i++) {\n\n\t\t\tif (result <= limit / a[i]) {\n\t\t\t\tresult = result * a[i];\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result);\n\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = Integer.parseInt(sc.next());\n\n\t\tlong a[];\n\t\ta = new long[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Long.parseLong(sc.next());\n\t\t\tif (a[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tlong result = 1;\n\t\tlong limit = 1000000000000000000L;\n\t\tfor (int i = 0; i < n; i++) {\n\n\t\t\tif (result <= limit / a[i]) {\n\t\t\t\tresult = result * a[i];\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result);\n\n\t}\n\n}",
"Main"
] |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.next());
long a[];
a = new long[n];
for (int i = 0; i < n; i++) {
a[i] = Long.parseLong(sc.next());
if (a[i] == 0) {
System.out.println(0);
return;
}
}
long result = 1;
long limit = 1000000000000000000L;
for (int i = 0; i < n; i++) {
if (result <= limit / a[i]) {
result = result * a[i];
} else {
System.out.println(-1);
return;
}
}
System.out.println(result);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
4,
13,
18,
13,
13,
18,
13,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
4,
18,
13,
17,
29,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
13,
18,
13,
13,
0,
13,
4,
13,
13,
14,
2,
13,
17,
30,
4,
18,
13,
40,
17,
29,
14,
2,
13,
17,
30,
41,
13,
4,
13,
18,
13,
13,
41,
13,
4,
13,
13,
14,
2,
2,
13,
17,
2,
13,
17,
30,
4,
18,
13,
40,
17,
29,
0,
13,
18,
13,
13,
14,
2,
13,
13,
30,
4,
18,
13,
40,
17,
29,
4,
18,
13,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
42,
2,
2,
13,
17,
17,
30,
0,
13,
17,
40,
13,
29,
13,
23,
13,
12,
13,
30,
42,
2,
2,
13,
17,
17,
30,
0,
13,
17,
29,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
210,
11
],
[
210,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
17,
19
],
[
15,
20
],
[
20,
21
],
[
20,
22
],
[
12,
23
],
[
23,
24
],
[
210,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
27,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
34,
35
],
[
27,
36
],
[
36,
37
],
[
36,
38
],
[
27,
39
],
[
39,
40
],
[
39,
41
],
[
27,
43
],
[
43,
44
],
[
43,
45
],
[
27,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
46,
51
],
[
51,
52
],
[
51,
53
],
[
46,
54
],
[
54,
55
],
[
55,
56
],
[
46,
57
],
[
58,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
63,
64
],
[
64,
65
],
[
58,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
66,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
73,
76
],
[
72,
77
],
[
27,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
83,
84
],
[
83,
85
],
[
78,
86
],
[
86,
87
],
[
87,
88
],
[
78,
89
],
[
90,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
90,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
90,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
108,
111
],
[
111,
112
],
[
107,
113
],
[
90,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
123,
125
],
[
118,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
128,
130
],
[
118,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
132,
136
],
[
136,
137
],
[
136,
138
],
[
131,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
140,
143
],
[
143,
144
],
[
139,
145
],
[
90,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
148,
150
],
[
90,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
151,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
156,
159
],
[
159,
160
],
[
155,
161
],
[
27,
162
],
[
162,
163
],
[
163,
164
],
[
162,
165
],
[
25,
166
],
[
166,
167
],
[
25,
168
],
[
168,
169
],
[
210,
170
],
[
170,
171
],
[
170,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
172,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
177,
181
],
[
176,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
182,
186
],
[
186,
187
],
[
172,
188
],
[
188,
189
],
[
170,
190
],
[
190,
191
],
[
210,
192
],
[
192,
193
],
[
192,
194
],
[
194,
195
],
[
195,
196
],
[
196,
197
],
[
197,
198
],
[
197,
199
],
[
196,
200
],
[
195,
201
],
[
201,
202
],
[
202,
203
],
[
202,
204
],
[
194,
205
],
[
205,
206
],
[
192,
207
],
[
207,
208
],
[
0,
209
],
[
209,
210
],
[
209,
211
]
] |
[
"\nimport java.io.InputStream;\nimport java.io.PrintStream;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n solve(System.in, System.out);\n }\n\n static void solve(InputStream is, PrintStream os) {\n // Your code here!\n Scanner scan = new Scanner(is);\n int N = scan.nextInt();\n long ans = 1;\n long A[] = new long[N];\n long max = 1000000000000000000l;\n\n for(int i = 0; i < N; i++) {\n A[i] = scan.nextLong();\n if(A[i] == 0) {\n os.println(0);\n return;\n }\n }\n\n for(int i = 0; i < N; i++) {\n long digits = digits(A[i]);\n digits += digits(ans);\n\n if(digits > 18) {\n os.println(-1);\n return;\n }\n if(digits == 18) {\n int AFirst = fitstDigit(A[i]);\n int ansFirst = fitstDigit(ans);\n if(ansFirst != 1 || AFirst != 1){\n os.println(-1);\n return;\n }\n }\n ans *= A[i];\n if(ans > max) {\n os.println(-1);\n return;\n }\n }\n os.println(ans);\n\n }\n\n static int digits(long value) {\n int digits = 0;\n while(value/10 > 1){\n value /= 10;\n digits++;\n }\n return digits;\n }\n\n static int fitstDigit(long value) {\n while(value/10 > 1){\n value /= 10;\n }\n return (int)value;\n }\n}",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.PrintStream;",
"PrintStream",
"java.io",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) throws Exception {\n solve(System.in, System.out);\n }\n\n static void solve(InputStream is, PrintStream os) {\n // Your code here!\n Scanner scan = new Scanner(is);\n int N = scan.nextInt();\n long ans = 1;\n long A[] = new long[N];\n long max = 1000000000000000000l;\n\n for(int i = 0; i < N; i++) {\n A[i] = scan.nextLong();\n if(A[i] == 0) {\n os.println(0);\n return;\n }\n }\n\n for(int i = 0; i < N; i++) {\n long digits = digits(A[i]);\n digits += digits(ans);\n\n if(digits > 18) {\n os.println(-1);\n return;\n }\n if(digits == 18) {\n int AFirst = fitstDigit(A[i]);\n int ansFirst = fitstDigit(ans);\n if(ansFirst != 1 || AFirst != 1){\n os.println(-1);\n return;\n }\n }\n ans *= A[i];\n if(ans > max) {\n os.println(-1);\n return;\n }\n }\n os.println(ans);\n\n }\n\n static int digits(long value) {\n int digits = 0;\n while(value/10 > 1){\n value /= 10;\n digits++;\n }\n return digits;\n }\n\n static int fitstDigit(long value) {\n while(value/10 > 1){\n value /= 10;\n }\n return (int)value;\n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n solve(System.in, System.out);\n }",
"main",
"{\n solve(System.in, System.out);\n }",
"solve(System.in, System.out)",
"solve",
"System.in",
"System",
"System.in",
"System.out",
"System",
"System.out",
"String[] args",
"args",
"static void solve(InputStream is, PrintStream os) {\n // Your code here!\n Scanner scan = new Scanner(is);\n int N = scan.nextInt();\n long ans = 1;\n long A[] = new long[N];\n long max = 1000000000000000000l;\n\n for(int i = 0; i < N; i++) {\n A[i] = scan.nextLong();\n if(A[i] == 0) {\n os.println(0);\n return;\n }\n }\n\n for(int i = 0; i < N; i++) {\n long digits = digits(A[i]);\n digits += digits(ans);\n\n if(digits > 18) {\n os.println(-1);\n return;\n }\n if(digits == 18) {\n int AFirst = fitstDigit(A[i]);\n int ansFirst = fitstDigit(ans);\n if(ansFirst != 1 || AFirst != 1){\n os.println(-1);\n return;\n }\n }\n ans *= A[i];\n if(ans > max) {\n os.println(-1);\n return;\n }\n }\n os.println(ans);\n\n }",
"solve",
"{\n // Your code here!\n Scanner scan = new Scanner(is);\n int N = scan.nextInt();\n long ans = 1;\n long A[] = new long[N];\n long max = 1000000000000000000l;\n\n for(int i = 0; i < N; i++) {\n A[i] = scan.nextLong();\n if(A[i] == 0) {\n os.println(0);\n return;\n }\n }\n\n for(int i = 0; i < N; i++) {\n long digits = digits(A[i]);\n digits += digits(ans);\n\n if(digits > 18) {\n os.println(-1);\n return;\n }\n if(digits == 18) {\n int AFirst = fitstDigit(A[i]);\n int ansFirst = fitstDigit(ans);\n if(ansFirst != 1 || AFirst != 1){\n os.println(-1);\n return;\n }\n }\n ans *= A[i];\n if(ans > max) {\n os.println(-1);\n return;\n }\n }\n os.println(ans);\n\n }",
"Scanner scan = new Scanner(is);",
"scan",
"new Scanner(is)",
"int N = scan.nextInt();",
"N",
"scan.nextInt()",
"scan.nextInt",
"scan",
"long ans = 1;",
"ans",
"1",
"long A[] = new long[N];",
"A",
"new long[N]",
"N",
"long max = 1000000000000000000l;",
"max",
"1000000000000000000l",
"for(int i = 0; i < N; i++) {\n A[i] = scan.nextLong();\n if(A[i] == 0) {\n os.println(0);\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i] = scan.nextLong();\n if(A[i] == 0) {\n os.println(0);\n return;\n }\n }",
"{\n A[i] = scan.nextLong();\n if(A[i] == 0) {\n os.println(0);\n return;\n }\n }",
"A[i] = scan.nextLong()",
"A[i]",
"A",
"i",
"scan.nextLong()",
"scan.nextLong",
"scan",
"if(A[i] == 0) {\n os.println(0);\n return;\n }",
"A[i] == 0",
"A[i]",
"A",
"i",
"0",
"{\n os.println(0);\n return;\n }",
"os.println(0)",
"os.println",
"os",
"0",
"return;",
"for(int i = 0; i < N; i++) {\n long digits = digits(A[i]);\n digits += digits(ans);\n\n if(digits > 18) {\n os.println(-1);\n return;\n }\n if(digits == 18) {\n int AFirst = fitstDigit(A[i]);\n int ansFirst = fitstDigit(ans);\n if(ansFirst != 1 || AFirst != 1){\n os.println(-1);\n return;\n }\n }\n ans *= A[i];\n if(ans > max) {\n os.println(-1);\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n long digits = digits(A[i]);\n digits += digits(ans);\n\n if(digits > 18) {\n os.println(-1);\n return;\n }\n if(digits == 18) {\n int AFirst = fitstDigit(A[i]);\n int ansFirst = fitstDigit(ans);\n if(ansFirst != 1 || AFirst != 1){\n os.println(-1);\n return;\n }\n }\n ans *= A[i];\n if(ans > max) {\n os.println(-1);\n return;\n }\n }",
"{\n long digits = digits(A[i]);\n digits += digits(ans);\n\n if(digits > 18) {\n os.println(-1);\n return;\n }\n if(digits == 18) {\n int AFirst = fitstDigit(A[i]);\n int ansFirst = fitstDigit(ans);\n if(ansFirst != 1 || AFirst != 1){\n os.println(-1);\n return;\n }\n }\n ans *= A[i];\n if(ans > max) {\n os.println(-1);\n return;\n }\n }",
"long digits = digits(A[i]);",
"digits",
"digits(A[i])",
"digits",
"A[i]",
"A",
"i",
"digits += digits(ans)",
"digits",
"digits(ans)",
"digits",
"ans",
"if(digits > 18) {\n os.println(-1);\n return;\n }",
"digits > 18",
"digits",
"18",
"{\n os.println(-1);\n return;\n }",
"os.println(-1)",
"os.println",
"os",
"-1",
"1",
"return;",
"if(digits == 18) {\n int AFirst = fitstDigit(A[i]);\n int ansFirst = fitstDigit(ans);\n if(ansFirst != 1 || AFirst != 1){\n os.println(-1);\n return;\n }\n }",
"digits == 18",
"digits",
"18",
"{\n int AFirst = fitstDigit(A[i]);\n int ansFirst = fitstDigit(ans);\n if(ansFirst != 1 || AFirst != 1){\n os.println(-1);\n return;\n }\n }",
"int AFirst = fitstDigit(A[i]);",
"AFirst",
"fitstDigit(A[i])",
"fitstDigit",
"A[i]",
"A",
"i",
"int ansFirst = fitstDigit(ans);",
"ansFirst",
"fitstDigit(ans)",
"fitstDigit",
"ans",
"if(ansFirst != 1 || AFirst != 1){\n os.println(-1);\n return;\n }",
"ansFirst != 1 || AFirst != 1",
"ansFirst != 1",
"ansFirst",
"1",
"AFirst != 1",
"AFirst",
"1",
"{\n os.println(-1);\n return;\n }",
"os.println(-1)",
"os.println",
"os",
"-1",
"1",
"return;",
"ans *= A[i]",
"ans",
"A[i]",
"A",
"i",
"if(ans > max) {\n os.println(-1);\n return;\n }",
"ans > max",
"ans",
"max",
"{\n os.println(-1);\n return;\n }",
"os.println(-1)",
"os.println",
"os",
"-1",
"1",
"return;",
"os.println(ans)",
"os.println",
"os",
"ans",
"InputStream is",
"is",
"PrintStream os",
"os",
"static int digits(long value) {\n int digits = 0;\n while(value/10 > 1){\n value /= 10;\n digits++;\n }\n return digits;\n }",
"digits",
"{\n int digits = 0;\n while(value/10 > 1){\n value /= 10;\n digits++;\n }\n return digits;\n }",
"int digits = 0;",
"digits",
"0",
"while(value/10 > 1){\n value /= 10;\n digits++;\n }",
"value/10 > 1",
"value/10",
"value",
"10",
"1",
"{\n value /= 10;\n digits++;\n }",
"value /= 10",
"value",
"10",
"digits++",
"digits",
"return digits;",
"digits",
"long value",
"value",
"static int fitstDigit(long value) {\n while(value/10 > 1){\n value /= 10;\n }\n return (int)value;\n }",
"fitstDigit",
"{\n while(value/10 > 1){\n value /= 10;\n }\n return (int)value;\n }",
"while(value/10 > 1){\n value /= 10;\n }",
"value/10 > 1",
"value/10",
"value",
"10",
"1",
"{\n value /= 10;\n }",
"value /= 10",
"value",
"10",
"return (int)value;",
"(int)value",
"long value",
"value",
"public class Main {\n public static void main(String[] args) throws Exception {\n solve(System.in, System.out);\n }\n\n static void solve(InputStream is, PrintStream os) {\n // Your code here!\n Scanner scan = new Scanner(is);\n int N = scan.nextInt();\n long ans = 1;\n long A[] = new long[N];\n long max = 1000000000000000000l;\n\n for(int i = 0; i < N; i++) {\n A[i] = scan.nextLong();\n if(A[i] == 0) {\n os.println(0);\n return;\n }\n }\n\n for(int i = 0; i < N; i++) {\n long digits = digits(A[i]);\n digits += digits(ans);\n\n if(digits > 18) {\n os.println(-1);\n return;\n }\n if(digits == 18) {\n int AFirst = fitstDigit(A[i]);\n int ansFirst = fitstDigit(ans);\n if(ansFirst != 1 || AFirst != 1){\n os.println(-1);\n return;\n }\n }\n ans *= A[i];\n if(ans > max) {\n os.println(-1);\n return;\n }\n }\n os.println(ans);\n\n }\n\n static int digits(long value) {\n int digits = 0;\n while(value/10 > 1){\n value /= 10;\n digits++;\n }\n return digits;\n }\n\n static int fitstDigit(long value) {\n while(value/10 > 1){\n value /= 10;\n }\n return (int)value;\n }\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n solve(System.in, System.out);\n }\n\n static void solve(InputStream is, PrintStream os) {\n // Your code here!\n Scanner scan = new Scanner(is);\n int N = scan.nextInt();\n long ans = 1;\n long A[] = new long[N];\n long max = 1000000000000000000l;\n\n for(int i = 0; i < N; i++) {\n A[i] = scan.nextLong();\n if(A[i] == 0) {\n os.println(0);\n return;\n }\n }\n\n for(int i = 0; i < N; i++) {\n long digits = digits(A[i]);\n digits += digits(ans);\n\n if(digits > 18) {\n os.println(-1);\n return;\n }\n if(digits == 18) {\n int AFirst = fitstDigit(A[i]);\n int ansFirst = fitstDigit(ans);\n if(ansFirst != 1 || AFirst != 1){\n os.println(-1);\n return;\n }\n }\n ans *= A[i];\n if(ans > max) {\n os.println(-1);\n return;\n }\n }\n os.println(ans);\n\n }\n\n static int digits(long value) {\n int digits = 0;\n while(value/10 > 1){\n value /= 10;\n digits++;\n }\n return digits;\n }\n\n static int fitstDigit(long value) {\n while(value/10 > 1){\n value /= 10;\n }\n return (int)value;\n }\n}",
"Main"
] |
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
solve(System.in, System.out);
}
static void solve(InputStream is, PrintStream os) {
// Your code here!
Scanner scan = new Scanner(is);
int N = scan.nextInt();
long ans = 1;
long A[] = new long[N];
long max = 1000000000000000000l;
for(int i = 0; i < N; i++) {
A[i] = scan.nextLong();
if(A[i] == 0) {
os.println(0);
return;
}
}
for(int i = 0; i < N; i++) {
long digits = digits(A[i]);
digits += digits(ans);
if(digits > 18) {
os.println(-1);
return;
}
if(digits == 18) {
int AFirst = fitstDigit(A[i]);
int ansFirst = fitstDigit(ans);
if(ansFirst != 1 || AFirst != 1){
os.println(-1);
return;
}
}
ans *= A[i];
if(ans > max) {
os.println(-1);
return;
}
}
os.println(ans);
}
static int digits(long value) {
int digits = 0;
while(value/10 > 1){
value /= 10;
digits++;
}
return digits;
}
static int fitstDigit(long value) {
while(value/10 > 1){
value /= 10;
}
return (int)value;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
18,
13,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
17,
17,
30,
4,
18,
18,
13,
13,
17,
29,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
2,
17,
13,
13,
30,
0,
13,
17,
3,
30,
0,
13,
13,
14,
13,
30,
4,
18,
18,
13,
13,
40,
17,
30,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
127,
8
],
[
127,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
35,
41
],
[
41,
42
],
[
42,
43
],
[
41,
44
],
[
11,
45
],
[
45,
46
],
[
46,
47
],
[
45,
48
],
[
11,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
51,
54
],
[
50,
55
],
[
49,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
57,
62
],
[
56,
63
],
[
11,
64
],
[
64,
65
],
[
64,
66
],
[
11,
67
],
[
67,
68
],
[
67,
69
],
[
11,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
70,
75
],
[
75,
76
],
[
75,
77
],
[
70,
78
],
[
78,
79
],
[
79,
80
],
[
70,
81
],
[
82,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
82,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
94,
95
],
[
94,
96
],
[
90,
97
],
[
89,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
89,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
11,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
115,
116
],
[
107,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
9,
124
],
[
124,
125
],
[
0,
126
],
[
126,
127
],
[
126,
128
]
] |
[
"import java.util.*;\nimport java.math.BigInteger;\n \npublic class Main {\n public static void main(String[] args) {\n\n Scanner scan = new Scanner(System.in);\n \n int n = scan.nextInt();\n\n List<Long> list = new ArrayList<Long>();\n for (int i = 0; i < n; i++) {\n long a = scan.nextLong();\n list.add(a);\n }\n\n Collections.sort(list);//System.out.println(list);\n // listの先頭が0だったら、0を出力して即終了\n if (list.get(0) == 0) {\n System.out.println(0);\n return;\n }\n\n /*\n * 1. BigIntegerクラスを用いて、オーバーフローが起きないようにする。\n BigInteger ans = BigInteger.ONE;\n boolean isOver = false;\n for (int i = 0; i < n; i++) {\n ans = ans.multiply(BigInteger.valueOf(list.get(i)));\n if (ans.compareTo(BigInteger.valueOf(1000000000000000000l)) > 0) {\n isOver = true;\n break;\n }\n } \n \n\n if (isOver) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n */\n\n\n /* 2. multiplyExactメソッド(オーバーフローすると例外送出)を利用する方法。\n long ans = 1l;\n boolean isOver = false;\n try {\n for (int i = 0; i < n; i++) {\n long a = list.get(i);\n ans = Math.multiplyExact(ans, a);\n if (ans > 1000000000000000000l) {\n isOver = true;\n break;\n }\n } \n } catch (ArithmeticException e) {\n isOver = true;\n }\n \n if (isOver) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n \t*/\n \n /* \n * 3. オーバーフローすると、負の数や0になる可能性があることを考慮して場合わけする。\n long ans = 1l;\n for (int i = 0; i < n; i++) {\n long a = list.get(i);\n ans *= a;\n if (ans > 1000000000000000000l || ans <= 0) {\n break;\n }\n }\n if (ans > 1000000000000000000l || ans <= 0) {\n //System.out.println(ans);\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n */\n \n \n long ans = 1l;\n boolean isOver = false;\n for (int i = 0; i < n; i++) {\n long a = list.get(i); \n if (Math.floor(1000000000000000000l / ans) < a) {\n isOver = true;\n break;\n } else {\n ans *= a;\n }\n }\n if (isOver) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n \n\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"public class Main {\n public static void main(String[] args) {\n\n Scanner scan = new Scanner(System.in);\n \n int n = scan.nextInt();\n\n List<Long> list = new ArrayList<Long>();\n for (int i = 0; i < n; i++) {\n long a = scan.nextLong();\n list.add(a);\n }\n\n Collections.sort(list);//System.out.println(list);\n // listの先頭が0だったら、0を出力して即終了\n if (list.get(0) == 0) {\n System.out.println(0);\n return;\n }\n\n /*\n * 1. BigIntegerクラスを用いて、オーバーフローが起きないようにする。\n BigInteger ans = BigInteger.ONE;\n boolean isOver = false;\n for (int i = 0; i < n; i++) {\n ans = ans.multiply(BigInteger.valueOf(list.get(i)));\n if (ans.compareTo(BigInteger.valueOf(1000000000000000000l)) > 0) {\n isOver = true;\n break;\n }\n } \n \n\n if (isOver) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n */\n\n\n /* 2. multiplyExactメソッド(オーバーフローすると例外送出)を利用する方法。\n long ans = 1l;\n boolean isOver = false;\n try {\n for (int i = 0; i < n; i++) {\n long a = list.get(i);\n ans = Math.multiplyExact(ans, a);\n if (ans > 1000000000000000000l) {\n isOver = true;\n break;\n }\n } \n } catch (ArithmeticException e) {\n isOver = true;\n }\n \n if (isOver) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n \t*/\n \n /* \n * 3. オーバーフローすると、負の数や0になる可能性があることを考慮して場合わけする。\n long ans = 1l;\n for (int i = 0; i < n; i++) {\n long a = list.get(i);\n ans *= a;\n if (ans > 1000000000000000000l || ans <= 0) {\n break;\n }\n }\n if (ans > 1000000000000000000l || ans <= 0) {\n //System.out.println(ans);\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n */\n \n \n long ans = 1l;\n boolean isOver = false;\n for (int i = 0; i < n; i++) {\n long a = list.get(i); \n if (Math.floor(1000000000000000000l / ans) < a) {\n isOver = true;\n break;\n } else {\n ans *= a;\n }\n }\n if (isOver) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n \n\n }\n}",
"Main",
"public static void main(String[] args) {\n\n Scanner scan = new Scanner(System.in);\n \n int n = scan.nextInt();\n\n List<Long> list = new ArrayList<Long>();\n for (int i = 0; i < n; i++) {\n long a = scan.nextLong();\n list.add(a);\n }\n\n Collections.sort(list);//System.out.println(list);\n // listの先頭が0だったら、0を出力して即終了\n if (list.get(0) == 0) {\n System.out.println(0);\n return;\n }\n\n /*\n * 1. BigIntegerクラスを用いて、オーバーフローが起きないようにする。\n BigInteger ans = BigInteger.ONE;\n boolean isOver = false;\n for (int i = 0; i < n; i++) {\n ans = ans.multiply(BigInteger.valueOf(list.get(i)));\n if (ans.compareTo(BigInteger.valueOf(1000000000000000000l)) > 0) {\n isOver = true;\n break;\n }\n } \n \n\n if (isOver) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n */\n\n\n /* 2. multiplyExactメソッド(オーバーフローすると例外送出)を利用する方法。\n long ans = 1l;\n boolean isOver = false;\n try {\n for (int i = 0; i < n; i++) {\n long a = list.get(i);\n ans = Math.multiplyExact(ans, a);\n if (ans > 1000000000000000000l) {\n isOver = true;\n break;\n }\n } \n } catch (ArithmeticException e) {\n isOver = true;\n }\n \n if (isOver) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n \t*/\n \n /* \n * 3. オーバーフローすると、負の数や0になる可能性があることを考慮して場合わけする。\n long ans = 1l;\n for (int i = 0; i < n; i++) {\n long a = list.get(i);\n ans *= a;\n if (ans > 1000000000000000000l || ans <= 0) {\n break;\n }\n }\n if (ans > 1000000000000000000l || ans <= 0) {\n //System.out.println(ans);\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n */\n \n \n long ans = 1l;\n boolean isOver = false;\n for (int i = 0; i < n; i++) {\n long a = list.get(i); \n if (Math.floor(1000000000000000000l / ans) < a) {\n isOver = true;\n break;\n } else {\n ans *= a;\n }\n }\n if (isOver) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n \n\n }",
"main",
"{\n\n Scanner scan = new Scanner(System.in);\n \n int n = scan.nextInt();\n\n List<Long> list = new ArrayList<Long>();\n for (int i = 0; i < n; i++) {\n long a = scan.nextLong();\n list.add(a);\n }\n\n Collections.sort(list);//System.out.println(list);\n // listの先頭が0だったら、0を出力して即終了\n if (list.get(0) == 0) {\n System.out.println(0);\n return;\n }\n\n /*\n * 1. BigIntegerクラスを用いて、オーバーフローが起きないようにする。\n BigInteger ans = BigInteger.ONE;\n boolean isOver = false;\n for (int i = 0; i < n; i++) {\n ans = ans.multiply(BigInteger.valueOf(list.get(i)));\n if (ans.compareTo(BigInteger.valueOf(1000000000000000000l)) > 0) {\n isOver = true;\n break;\n }\n } \n \n\n if (isOver) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n */\n\n\n /* 2. multiplyExactメソッド(オーバーフローすると例外送出)を利用する方法。\n long ans = 1l;\n boolean isOver = false;\n try {\n for (int i = 0; i < n; i++) {\n long a = list.get(i);\n ans = Math.multiplyExact(ans, a);\n if (ans > 1000000000000000000l) {\n isOver = true;\n break;\n }\n } \n } catch (ArithmeticException e) {\n isOver = true;\n }\n \n if (isOver) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n \t*/\n \n /* \n * 3. オーバーフローすると、負の数や0になる可能性があることを考慮して場合わけする。\n long ans = 1l;\n for (int i = 0; i < n; i++) {\n long a = list.get(i);\n ans *= a;\n if (ans > 1000000000000000000l || ans <= 0) {\n break;\n }\n }\n if (ans > 1000000000000000000l || ans <= 0) {\n //System.out.println(ans);\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n */\n \n \n long ans = 1l;\n boolean isOver = false;\n for (int i = 0; i < n; i++) {\n long a = list.get(i); \n if (Math.floor(1000000000000000000l / ans) < a) {\n isOver = true;\n break;\n } else {\n ans *= a;\n }\n }\n if (isOver) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n \n\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"List<Long> list = new ArrayList<Long>();",
"list",
"new ArrayList<Long>()",
"for (int i = 0; i < n; i++) {\n long a = scan.nextLong();\n list.add(a);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n long a = scan.nextLong();\n list.add(a);\n }",
"{\n long a = scan.nextLong();\n list.add(a);\n }",
"long a = scan.nextLong();",
"a",
"scan.nextLong()",
"scan.nextLong",
"scan",
"list.add(a)",
"list.add",
"list",
"a",
"Collections.sort(list)",
"Collections.sort",
"Collections",
"list",
"if (list.get(0) == 0) {\n System.out.println(0);\n return;\n }",
"list.get(0) == 0",
"list.get(0)",
"list.get",
"list",
"0",
"0",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"long ans = 1l;",
"ans",
"1l",
"boolean isOver = false;",
"isOver",
"false",
"for (int i = 0; i < n; i++) {\n long a = list.get(i); \n if (Math.floor(1000000000000000000l / ans) < a) {\n isOver = true;\n break;\n } else {\n ans *= a;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n long a = list.get(i); \n if (Math.floor(1000000000000000000l / ans) < a) {\n isOver = true;\n break;\n } else {\n ans *= a;\n }\n }",
"{\n long a = list.get(i); \n if (Math.floor(1000000000000000000l / ans) < a) {\n isOver = true;\n break;\n } else {\n ans *= a;\n }\n }",
"long a = list.get(i);",
"a",
"list.get(i)",
"list.get",
"list",
"i",
"if (Math.floor(1000000000000000000l / ans) < a) {\n isOver = true;\n break;\n } else {\n ans *= a;\n }",
"Math.floor(1000000000000000000l / ans) < a",
"Math.floor(1000000000000000000l / ans)",
"Math.floor",
"Math",
"1000000000000000000l / ans",
"1000000000000000000l",
"ans",
"a",
"{\n isOver = true;\n break;\n }",
"isOver = true",
"isOver",
"true",
"break;",
"{\n ans *= a;\n }",
"ans *= a",
"ans",
"a",
"if (isOver) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }",
"isOver",
"{\n System.out.println(-1);\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"{\n System.out.println(ans);\n }",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n\n Scanner scan = new Scanner(System.in);\n \n int n = scan.nextInt();\n\n List<Long> list = new ArrayList<Long>();\n for (int i = 0; i < n; i++) {\n long a = scan.nextLong();\n list.add(a);\n }\n\n Collections.sort(list);//System.out.println(list);\n // listの先頭が0だったら、0を出力して即終了\n if (list.get(0) == 0) {\n System.out.println(0);\n return;\n }\n\n /*\n * 1. BigIntegerクラスを用いて、オーバーフローが起きないようにする。\n BigInteger ans = BigInteger.ONE;\n boolean isOver = false;\n for (int i = 0; i < n; i++) {\n ans = ans.multiply(BigInteger.valueOf(list.get(i)));\n if (ans.compareTo(BigInteger.valueOf(1000000000000000000l)) > 0) {\n isOver = true;\n break;\n }\n } \n \n\n if (isOver) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n */\n\n\n /* 2. multiplyExactメソッド(オーバーフローすると例外送出)を利用する方法。\n long ans = 1l;\n boolean isOver = false;\n try {\n for (int i = 0; i < n; i++) {\n long a = list.get(i);\n ans = Math.multiplyExact(ans, a);\n if (ans > 1000000000000000000l) {\n isOver = true;\n break;\n }\n } \n } catch (ArithmeticException e) {\n isOver = true;\n }\n \n if (isOver) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n \t*/\n \n /* \n * 3. オーバーフローすると、負の数や0になる可能性があることを考慮して場合わけする。\n long ans = 1l;\n for (int i = 0; i < n; i++) {\n long a = list.get(i);\n ans *= a;\n if (ans > 1000000000000000000l || ans <= 0) {\n break;\n }\n }\n if (ans > 1000000000000000000l || ans <= 0) {\n //System.out.println(ans);\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n */\n \n \n long ans = 1l;\n boolean isOver = false;\n for (int i = 0; i < n; i++) {\n long a = list.get(i); \n if (Math.floor(1000000000000000000l / ans) < a) {\n isOver = true;\n break;\n } else {\n ans *= a;\n }\n }\n if (isOver) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n \n\n }\n}",
"public class Main {\n public static void main(String[] args) {\n\n Scanner scan = new Scanner(System.in);\n \n int n = scan.nextInt();\n\n List<Long> list = new ArrayList<Long>();\n for (int i = 0; i < n; i++) {\n long a = scan.nextLong();\n list.add(a);\n }\n\n Collections.sort(list);//System.out.println(list);\n // listの先頭が0だったら、0を出力して即終了\n if (list.get(0) == 0) {\n System.out.println(0);\n return;\n }\n\n /*\n * 1. BigIntegerクラスを用いて、オーバーフローが起きないようにする。\n BigInteger ans = BigInteger.ONE;\n boolean isOver = false;\n for (int i = 0; i < n; i++) {\n ans = ans.multiply(BigInteger.valueOf(list.get(i)));\n if (ans.compareTo(BigInteger.valueOf(1000000000000000000l)) > 0) {\n isOver = true;\n break;\n }\n } \n \n\n if (isOver) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n */\n\n\n /* 2. multiplyExactメソッド(オーバーフローすると例外送出)を利用する方法。\n long ans = 1l;\n boolean isOver = false;\n try {\n for (int i = 0; i < n; i++) {\n long a = list.get(i);\n ans = Math.multiplyExact(ans, a);\n if (ans > 1000000000000000000l) {\n isOver = true;\n break;\n }\n } \n } catch (ArithmeticException e) {\n isOver = true;\n }\n \n if (isOver) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n \t*/\n \n /* \n * 3. オーバーフローすると、負の数や0になる可能性があることを考慮して場合わけする。\n long ans = 1l;\n for (int i = 0; i < n; i++) {\n long a = list.get(i);\n ans *= a;\n if (ans > 1000000000000000000l || ans <= 0) {\n break;\n }\n }\n if (ans > 1000000000000000000l || ans <= 0) {\n //System.out.println(ans);\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n */\n \n \n long ans = 1l;\n boolean isOver = false;\n for (int i = 0; i < n; i++) {\n long a = list.get(i); \n if (Math.floor(1000000000000000000l / ans) < a) {\n isOver = true;\n break;\n } else {\n ans *= a;\n }\n }\n if (isOver) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n \n\n }\n}",
"Main"
] |
import java.util.*;
import java.math.BigInteger;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
List<Long> list = new ArrayList<Long>();
for (int i = 0; i < n; i++) {
long a = scan.nextLong();
list.add(a);
}
Collections.sort(list);//System.out.println(list);
// listの先頭が0だったら、0を出力して即終了
if (list.get(0) == 0) {
System.out.println(0);
return;
}
/*
* 1. BigIntegerクラスを用いて、オーバーフローが起きないようにする。
BigInteger ans = BigInteger.ONE;
boolean isOver = false;
for (int i = 0; i < n; i++) {
ans = ans.multiply(BigInteger.valueOf(list.get(i)));
if (ans.compareTo(BigInteger.valueOf(1000000000000000000l)) > 0) {
isOver = true;
break;
}
}
if (isOver) {
System.out.println(-1);
} else {
System.out.println(ans);
}
*/
/* 2. multiplyExactメソッド(オーバーフローすると例外送出)を利用する方法。
long ans = 1l;
boolean isOver = false;
try {
for (int i = 0; i < n; i++) {
long a = list.get(i);
ans = Math.multiplyExact(ans, a);
if (ans > 1000000000000000000l) {
isOver = true;
break;
}
}
} catch (ArithmeticException e) {
isOver = true;
}
if (isOver) {
System.out.println(-1);
} else {
System.out.println(ans);
}
*/
/*
* 3. オーバーフローすると、負の数や0になる可能性があることを考慮して場合わけする。
long ans = 1l;
for (int i = 0; i < n; i++) {
long a = list.get(i);
ans *= a;
if (ans > 1000000000000000000l || ans <= 0) {
break;
}
}
if (ans > 1000000000000000000l || ans <= 0) {
//System.out.println(ans);
System.out.println(-1);
} else {
System.out.println(ans);
}
*/
long ans = 1l;
boolean isOver = false;
for (int i = 0; i < n; i++) {
long a = list.get(i);
if (Math.floor(1000000000000000000l / ans) < a) {
isOver = true;
break;
} else {
ans *= a;
}
}
if (isOver) {
System.out.println(-1);
} else {
System.out.println(ans);
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
17,
41,
13,
20,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
0,
13,
17,
14,
2,
13,
17,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
4,
18,
13,
17,
17,
13,
0,
13,
18,
13,
13,
30,
0,
13,
40,
17,
3,
4,
18,
13,
2,
13,
17,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
133,
20
],
[
133,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
27,
28
],
[
27,
29
],
[
23,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
32,
35
],
[
35,
36
],
[
36,
37
],
[
23,
38
],
[
38,
39
],
[
38,
40
],
[
23,
41
],
[
41,
42
],
[
41,
43
],
[
23,
45
],
[
45,
46
],
[
45,
47
],
[
23,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
48,
53
],
[
53,
54
],
[
53,
55
],
[
48,
56
],
[
56,
57
],
[
57,
58
],
[
48,
59
],
[
60,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
65,
66
],
[
66,
67
],
[
65,
68
],
[
68,
69
],
[
69,
70
],
[
60,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
71,
77
],
[
77,
78
],
[
77,
79
],
[
23,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
80,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
85,
90
],
[
90,
91
],
[
90,
92
],
[
85,
93
],
[
93,
94
],
[
94,
95
],
[
85,
96
],
[
97,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
104,
107
],
[
104,
108
],
[
103,
109
],
[
98,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
98,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
115,
120
],
[
23,
121
],
[
121,
122
],
[
122,
123
],
[
121,
124
],
[
124,
125
],
[
124,
126
],
[
23,
127
],
[
127,
128
],
[
128,
129
],
[
21,
130
],
[
130,
131
],
[
0,
132
],
[
132,
133
],
[
132,
134
]
] |
[
"import java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tBufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n\t\t\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tlong res = 1;\n\t\tlong[] a = new long[n];\n\t\t\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tfor(int i=0; i<n; i++) {\n\t\t\ta[i] = Long.parseLong(st.nextToken());\n\t\t\tif(a[i] == 0)\n\t\t\t\tres = 0;\n\t\t}\n\t\t\n\t\tif(res != 0) {\n\t\t\tfor(int i=0; i<n; i++) {\n\t\t\t\tif(a[i] <= (long)Math.pow(10, 18)/res)\n\t\t\t\t\tres *= a[i];\n\t\t\t\telse {\n\t\t\t\t\tres = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tbw.write(res + \"\\n\");\n\t\tbw.flush();\n\t}\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.BufferedWriter;",
"BufferedWriter",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.io.OutputStreamWriter;",
"OutputStreamWriter",
"java.io",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tBufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n\t\t\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tlong res = 1;\n\t\tlong[] a = new long[n];\n\t\t\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tfor(int i=0; i<n; i++) {\n\t\t\ta[i] = Long.parseLong(st.nextToken());\n\t\t\tif(a[i] == 0)\n\t\t\t\tres = 0;\n\t\t}\n\t\t\n\t\tif(res != 0) {\n\t\t\tfor(int i=0; i<n; i++) {\n\t\t\t\tif(a[i] <= (long)Math.pow(10, 18)/res)\n\t\t\t\t\tres *= a[i];\n\t\t\t\telse {\n\t\t\t\t\tres = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tbw.write(res + \"\\n\");\n\t\tbw.flush();\n\t}\n\n}",
"Main",
"public static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tBufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n\t\t\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tlong res = 1;\n\t\tlong[] a = new long[n];\n\t\t\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tfor(int i=0; i<n; i++) {\n\t\t\ta[i] = Long.parseLong(st.nextToken());\n\t\t\tif(a[i] == 0)\n\t\t\t\tres = 0;\n\t\t}\n\t\t\n\t\tif(res != 0) {\n\t\t\tfor(int i=0; i<n; i++) {\n\t\t\t\tif(a[i] <= (long)Math.pow(10, 18)/res)\n\t\t\t\t\tres *= a[i];\n\t\t\t\telse {\n\t\t\t\t\tres = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tbw.write(res + \"\\n\");\n\t\tbw.flush();\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tBufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n\t\t\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tlong res = 1;\n\t\tlong[] a = new long[n];\n\t\t\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tfor(int i=0; i<n; i++) {\n\t\t\ta[i] = Long.parseLong(st.nextToken());\n\t\t\tif(a[i] == 0)\n\t\t\t\tres = 0;\n\t\t}\n\t\t\n\t\tif(res != 0) {\n\t\t\tfor(int i=0; i<n; i++) {\n\t\t\t\tif(a[i] <= (long)Math.pow(10, 18)/res)\n\t\t\t\t\tres *= a[i];\n\t\t\t\telse {\n\t\t\t\t\tres = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tbw.write(res + \"\\n\");\n\t\tbw.flush();\n\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));",
"bw",
"new BufferedWriter(new OutputStreamWriter(System.out))",
"int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"long res = 1;",
"res",
"1",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"StringTokenizer st = new StringTokenizer(br.readLine());",
"st",
"new StringTokenizer(br.readLine())",
"for(int i=0; i<n; i++) {\n\t\t\ta[i] = Long.parseLong(st.nextToken());\n\t\t\tif(a[i] == 0)\n\t\t\t\tres = 0;\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = Long.parseLong(st.nextToken());\n\t\t\tif(a[i] == 0)\n\t\t\t\tres = 0;\n\t\t}",
"{\n\t\t\ta[i] = Long.parseLong(st.nextToken());\n\t\t\tif(a[i] == 0)\n\t\t\t\tres = 0;\n\t\t}",
"a[i] = Long.parseLong(st.nextToken())",
"a[i]",
"a",
"i",
"Long.parseLong(st.nextToken())",
"Long.parseLong",
"Long",
"st.nextToken()",
"st.nextToken",
"st",
"if(a[i] == 0)\n\t\t\t\tres = 0;",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"res = 0",
"res",
"0",
"if(res != 0) {\n\t\t\tfor(int i=0; i<n; i++) {\n\t\t\t\tif(a[i] <= (long)Math.pow(10, 18)/res)\n\t\t\t\t\tres *= a[i];\n\t\t\t\telse {\n\t\t\t\t\tres = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"res != 0",
"res",
"0",
"{\n\t\t\tfor(int i=0; i<n; i++) {\n\t\t\t\tif(a[i] <= (long)Math.pow(10, 18)/res)\n\t\t\t\t\tres *= a[i];\n\t\t\t\telse {\n\t\t\t\t\tres = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for(int i=0; i<n; i++) {\n\t\t\t\tif(a[i] <= (long)Math.pow(10, 18)/res)\n\t\t\t\t\tres *= a[i];\n\t\t\t\telse {\n\t\t\t\t\tres = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tif(a[i] <= (long)Math.pow(10, 18)/res)\n\t\t\t\t\tres *= a[i];\n\t\t\t\telse {\n\t\t\t\t\tres = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(a[i] <= (long)Math.pow(10, 18)/res)\n\t\t\t\t\tres *= a[i];\n\t\t\t\telse {\n\t\t\t\t\tres = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"if(a[i] <= (long)Math.pow(10, 18)/res)\n\t\t\t\t\tres *= a[i];\n\t\t\t\telse {\n\t\t\t\t\tres = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"a[i] <= (long)Math.pow(10, 18)/res",
"a[i]",
"a",
"i",
"(long)Math.pow(10, 18)/res",
"(long)Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"res",
"res *= a[i]",
"res",
"a[i]",
"a",
"i",
"{\n\t\t\t\t\tres = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"res = -1",
"res",
"-1",
"1",
"break;",
"bw.write(res + \"\\n\")",
"bw.write",
"bw",
"res + \"\\n\"",
"res",
"\"\\n\"",
"bw.flush()",
"bw.flush",
"bw",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tBufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n\t\t\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tlong res = 1;\n\t\tlong[] a = new long[n];\n\t\t\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tfor(int i=0; i<n; i++) {\n\t\t\ta[i] = Long.parseLong(st.nextToken());\n\t\t\tif(a[i] == 0)\n\t\t\t\tres = 0;\n\t\t}\n\t\t\n\t\tif(res != 0) {\n\t\t\tfor(int i=0; i<n; i++) {\n\t\t\t\tif(a[i] <= (long)Math.pow(10, 18)/res)\n\t\t\t\t\tres *= a[i];\n\t\t\t\telse {\n\t\t\t\t\tres = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tbw.write(res + \"\\n\");\n\t\tbw.flush();\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tBufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n\t\t\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tlong res = 1;\n\t\tlong[] a = new long[n];\n\t\t\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tfor(int i=0; i<n; i++) {\n\t\t\ta[i] = Long.parseLong(st.nextToken());\n\t\t\tif(a[i] == 0)\n\t\t\t\tres = 0;\n\t\t}\n\t\t\n\t\tif(res != 0) {\n\t\t\tfor(int i=0; i<n; i++) {\n\t\t\t\tif(a[i] <= (long)Math.pow(10, 18)/res)\n\t\t\t\t\tres *= a[i];\n\t\t\t\telse {\n\t\t\t\t\tres = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tbw.write(res + \"\\n\");\n\t\tbw.flush();\n\t}\n\n}",
"Main"
] |
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int n = Integer.parseInt(br.readLine());
long res = 1;
long[] a = new long[n];
StringTokenizer st = new StringTokenizer(br.readLine());
for(int i=0; i<n; i++) {
a[i] = Long.parseLong(st.nextToken());
if(a[i] == 0)
res = 0;
}
if(res != 0) {
for(int i=0; i<n; i++) {
if(a[i] <= (long)Math.pow(10, 18)/res)
res *= a[i];
else {
res = -1;
break;
}
}
}
bw.write(res + "\n");
bw.flush();
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
41,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
17,
13,
30,
0,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
105,
5
],
[
105,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
33,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
41,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
48,
53
],
[
47,
54
],
[
8,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
57,
59
],
[
8,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
60,
65
],
[
65,
66
],
[
65,
67
],
[
60,
68
],
[
68,
69
],
[
69,
70
],
[
60,
71
],
[
72,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
74,
78
],
[
78,
79
],
[
78,
80
],
[
73,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
73,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
88,
93
],
[
93,
94
],
[
87,
95
],
[
8,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
6,
102
],
[
102,
103
],
[
0,
104
],
[
104,
105
],
[
104,
106
]
] |
[
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t//入力表示\n\t\tint N = sc.nextInt();\n\t\tlong[] a = new long[N];\n\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tlong b = a[0];\n\t\tfor (int i = 1; i < N; i++) {\n\t\t\tif (a[i] <= 1000000000000000000L / b) {\n\t\t\t\tb *= a[i];\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(b);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t//入力表示\n\t\tint N = sc.nextInt();\n\t\tlong[] a = new long[N];\n\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tlong b = a[0];\n\t\tfor (int i = 1; i < N; i++) {\n\t\t\tif (a[i] <= 1000000000000000000L / b) {\n\t\t\t\tb *= a[i];\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(b);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t//入力表示\n\t\tint N = sc.nextInt();\n\t\tlong[] a = new long[N];\n\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tlong b = a[0];\n\t\tfor (int i = 1; i < N; i++) {\n\t\t\tif (a[i] <= 1000000000000000000L / b) {\n\t\t\t\tb *= a[i];\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(b);\n\t}",
"main",
"{\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t//入力表示\n\t\tint N = sc.nextInt();\n\t\tlong[] a = new long[N];\n\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tlong b = a[0];\n\t\tfor (int i = 1; i < N; i++) {\n\t\t\tif (a[i] <= 1000000000000000000L / b) {\n\t\t\t\tb *= a[i];\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(b);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] a = new long[N];",
"a",
"new long[N]",
"N",
"for (int i = 0; i < N; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"{\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (a[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"{\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"long b = a[0];",
"b",
"a[0]",
"a",
"0",
"for (int i = 1; i < N; i++) {\n\t\t\tif (a[i] <= 1000000000000000000L / b) {\n\t\t\t\tb *= a[i];\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tif (a[i] <= 1000000000000000000L / b) {\n\t\t\t\tb *= a[i];\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (a[i] <= 1000000000000000000L / b) {\n\t\t\t\tb *= a[i];\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"if (a[i] <= 1000000000000000000L / b) {\n\t\t\t\tb *= a[i];\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}",
"a[i] <= 1000000000000000000L / b",
"a[i]",
"a",
"i",
"1000000000000000000L / b",
"1000000000000000000L",
"b",
"{\n\t\t\t\tb *= a[i];\n\t\t\t}",
"b *= a[i]",
"b",
"a[i]",
"a",
"i",
"{\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"System.out.println(b)",
"System.out.println",
"System.out",
"System",
"System.out",
"b",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t//入力表示\n\t\tint N = sc.nextInt();\n\t\tlong[] a = new long[N];\n\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tlong b = a[0];\n\t\tfor (int i = 1; i < N; i++) {\n\t\t\tif (a[i] <= 1000000000000000000L / b) {\n\t\t\t\tb *= a[i];\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(b);\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t//入力表示\n\t\tint N = sc.nextInt();\n\t\tlong[] a = new long[N];\n\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tlong b = a[0];\n\t\tfor (int i = 1; i < N; i++) {\n\t\t\tif (a[i] <= 1000000000000000000L / b) {\n\t\t\t\tb *= a[i];\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(b);\n\t}\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
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();
if (a[i] == 0) {
System.out.println(0);
return;
}
}
long b = a[0];
for (int i = 1; i < N; i++) {
if (a[i] <= 1000000000000000000L / b) {
b *= a[i];
} else {
System.out.println(-1);
return;
}
}
System.out.println(b);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
17,
12,
13,
30,
41,
13,
17,
41,
13,
20,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
14,
2,
13,
40,
17,
30,
14,
2,
13,
2,
13,
13,
30,
0,
13,
40,
17,
30,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
83,
5
],
[
83,
6
],
[
6,
7
],
[
6,
8
],
[
83,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
11,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
11,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
35,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
41,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
46,
51
],
[
45,
52
],
[
35,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
53,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
62,
64
],
[
59,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
59,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
11,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
9,
80
],
[
80,
81
],
[
0,
82
],
[
82,
83
],
[
82,
84
]
] |
[
"import java.util.*;\n\npublic class Main {\n private static final long MAX = (long)1e18;\n \n public static void main(String args[]) {\n \tlong multiplication = 1;\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n \n for (int i=0; i<n; i++) {\n long num = in.nextLong();\n if (num == 0) {\n System.out.print(0);\n return;\n } \n \n if (multiplication != -1) {\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }\n }\n \n System.out.print(multiplication);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n private static final long MAX = (long)1e18;\n \n public static void main(String args[]) {\n \tlong multiplication = 1;\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n \n for (int i=0; i<n; i++) {\n long num = in.nextLong();\n if (num == 0) {\n System.out.print(0);\n return;\n } \n \n if (multiplication != -1) {\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }\n }\n \n System.out.print(multiplication);\n }\n}",
"Main",
"private static final long MAX = (long)1e18;",
"MAX",
"(long)1e18",
"public static void main(String args[]) {\n \tlong multiplication = 1;\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n \n for (int i=0; i<n; i++) {\n long num = in.nextLong();\n if (num == 0) {\n System.out.print(0);\n return;\n } \n \n if (multiplication != -1) {\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }\n }\n \n System.out.print(multiplication);\n }",
"main",
"{\n \tlong multiplication = 1;\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n \n for (int i=0; i<n; i++) {\n long num = in.nextLong();\n if (num == 0) {\n System.out.print(0);\n return;\n } \n \n if (multiplication != -1) {\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }\n }\n \n System.out.print(multiplication);\n }",
"long multiplication = 1;",
"multiplication",
"1",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"for (int i=0; i<n; i++) {\n long num = in.nextLong();\n if (num == 0) {\n System.out.print(0);\n return;\n } \n \n if (multiplication != -1) {\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n long num = in.nextLong();\n if (num == 0) {\n System.out.print(0);\n return;\n } \n \n if (multiplication != -1) {\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }\n }",
"{\n long num = in.nextLong();\n if (num == 0) {\n System.out.print(0);\n return;\n } \n \n if (multiplication != -1) {\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }\n }",
"long num = in.nextLong();",
"num",
"in.nextLong()",
"in.nextLong",
"in",
"if (num == 0) {\n System.out.print(0);\n return;\n }",
"num == 0",
"num",
"0",
"{\n System.out.print(0);\n return;\n }",
"System.out.print(0)",
"System.out.print",
"System.out",
"System",
"System.out",
"0",
"return;",
"if (multiplication != -1) {\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }",
"multiplication != -1",
"multiplication",
"-1",
"1",
"{\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }",
"if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }",
"num > MAX / multiplication",
"num",
"MAX / multiplication",
"MAX",
"multiplication",
"{\n multiplication = -1;\n }",
"multiplication = -1",
"multiplication",
"-1",
"1",
"{ \n multiplication *= num;\n }",
"multiplication *= num",
"multiplication",
"num",
"System.out.print(multiplication)",
"System.out.print",
"System.out",
"System",
"System.out",
"multiplication",
"String args[]",
"args",
"public class Main {\n private static final long MAX = (long)1e18;\n \n public static void main(String args[]) {\n \tlong multiplication = 1;\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n \n for (int i=0; i<n; i++) {\n long num = in.nextLong();\n if (num == 0) {\n System.out.print(0);\n return;\n } \n \n if (multiplication != -1) {\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }\n }\n \n System.out.print(multiplication);\n }\n}",
"public class Main {\n private static final long MAX = (long)1e18;\n \n public static void main(String args[]) {\n \tlong multiplication = 1;\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n \n for (int i=0; i<n; i++) {\n long num = in.nextLong();\n if (num == 0) {\n System.out.print(0);\n return;\n } \n \n if (multiplication != -1) {\n if (num > MAX / multiplication) {\n multiplication = -1;\n } else { \n multiplication *= num;\n }\n }\n }\n \n System.out.print(multiplication);\n }\n}",
"Main"
] |
import java.util.*;
public class Main {
private static final long MAX = (long)1e18;
public static void main(String args[]) {
long multiplication = 1;
Scanner in = new Scanner(System.in);
int n = in.nextInt();
for (int i=0; i<n; i++) {
long num = in.nextLong();
if (num == 0) {
System.out.print(0);
return;
}
if (multiplication != -1) {
if (num > MAX / multiplication) {
multiplication = -1;
} else {
multiplication *= num;
}
}
}
System.out.print(multiplication);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
4,
18,
13,
13,
30,
4,
18,
18,
13,
13,
17,
29,
4,
18,
13,
13,
41,
13,
41,
13,
41,
13,
0,
13,
20,
0,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
13,
0,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
29,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
123,
8
],
[
123,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
11,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
42,
43
],
[
38,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
45,
48
],
[
44,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
49,
56
],
[
38,
57
],
[
57,
58
],
[
58,
59
],
[
57,
60
],
[
11,
61
],
[
61,
62
],
[
11,
63
],
[
63,
64
],
[
11,
65
],
[
65,
66
],
[
11,
67
],
[
67,
68
],
[
67,
69
],
[
11,
70
],
[
70,
71
],
[
70,
72
],
[
11,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
78,
80
],
[
73,
81
],
[
81,
82
],
[
82,
83
],
[
73,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
89,
90
],
[
88,
91
],
[
85,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
94,
97
],
[
85,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
100,
103
],
[
99,
104
],
[
98,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
111,
112
],
[
105,
113
],
[
11,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
9,
120
],
[
120,
121
],
[
0,
122
],
[
122,
123
],
[
122,
124
]
] |
[
"import java.math.BigInteger;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n List<BigInteger> list = new ArrayList<>();\n BigInteger zero = new BigInteger(\"0\");\n for (int i = 0; i < n; i++) {\n BigInteger bi = sc.nextBigInteger();\n if (bi.equals(zero)) {\n System.out.println(0);\n return;\n }\n list.add(bi);\n }\n\n BigInteger a, b, c;\n a = new BigInteger(\"1\");\n c = new BigInteger(\"1000000000000000000\");\n\n for (int i = 0; i < n; i++) {\n b = list.get(i);\n a = a.multiply(b);\n if (a.compareTo(c) > 0) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(a);\n }\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n List<BigInteger> list = new ArrayList<>();\n BigInteger zero = new BigInteger(\"0\");\n for (int i = 0; i < n; i++) {\n BigInteger bi = sc.nextBigInteger();\n if (bi.equals(zero)) {\n System.out.println(0);\n return;\n }\n list.add(bi);\n }\n\n BigInteger a, b, c;\n a = new BigInteger(\"1\");\n c = new BigInteger(\"1000000000000000000\");\n\n for (int i = 0; i < n; i++) {\n b = list.get(i);\n a = a.multiply(b);\n if (a.compareTo(c) > 0) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(a);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n List<BigInteger> list = new ArrayList<>();\n BigInteger zero = new BigInteger(\"0\");\n for (int i = 0; i < n; i++) {\n BigInteger bi = sc.nextBigInteger();\n if (bi.equals(zero)) {\n System.out.println(0);\n return;\n }\n list.add(bi);\n }\n\n BigInteger a, b, c;\n a = new BigInteger(\"1\");\n c = new BigInteger(\"1000000000000000000\");\n\n for (int i = 0; i < n; i++) {\n b = list.get(i);\n a = a.multiply(b);\n if (a.compareTo(c) > 0) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(a);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n List<BigInteger> list = new ArrayList<>();\n BigInteger zero = new BigInteger(\"0\");\n for (int i = 0; i < n; i++) {\n BigInteger bi = sc.nextBigInteger();\n if (bi.equals(zero)) {\n System.out.println(0);\n return;\n }\n list.add(bi);\n }\n\n BigInteger a, b, c;\n a = new BigInteger(\"1\");\n c = new BigInteger(\"1000000000000000000\");\n\n for (int i = 0; i < n; i++) {\n b = list.get(i);\n a = a.multiply(b);\n if (a.compareTo(c) > 0) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(a);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"List<BigInteger> list = new ArrayList<>();",
"list",
"new ArrayList<>()",
"BigInteger zero = new BigInteger(\"0\");",
"zero",
"new BigInteger(\"0\")",
"for (int i = 0; i < n; i++) {\n BigInteger bi = sc.nextBigInteger();\n if (bi.equals(zero)) {\n System.out.println(0);\n return;\n }\n list.add(bi);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n BigInteger bi = sc.nextBigInteger();\n if (bi.equals(zero)) {\n System.out.println(0);\n return;\n }\n list.add(bi);\n }",
"{\n BigInteger bi = sc.nextBigInteger();\n if (bi.equals(zero)) {\n System.out.println(0);\n return;\n }\n list.add(bi);\n }",
"BigInteger bi = sc.nextBigInteger();",
"bi",
"sc.nextBigInteger()",
"sc.nextBigInteger",
"sc",
"if (bi.equals(zero)) {\n System.out.println(0);\n return;\n }",
"bi.equals(zero)",
"bi.equals",
"bi",
"zero",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"list.add(bi)",
"list.add",
"list",
"bi",
"BigInteger a",
"a",
"b",
"b",
"c;",
"c",
"a = new BigInteger(\"1\")",
"a",
"new BigInteger(\"1\")",
"c = new BigInteger(\"1000000000000000000\")",
"c",
"new BigInteger(\"1000000000000000000\")",
"for (int i = 0; i < n; i++) {\n b = list.get(i);\n a = a.multiply(b);\n if (a.compareTo(c) > 0) {\n System.out.println(-1);\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n b = list.get(i);\n a = a.multiply(b);\n if (a.compareTo(c) > 0) {\n System.out.println(-1);\n return;\n }\n }",
"{\n b = list.get(i);\n a = a.multiply(b);\n if (a.compareTo(c) > 0) {\n System.out.println(-1);\n return;\n }\n }",
"b = list.get(i)",
"b",
"list.get(i)",
"list.get",
"list",
"i",
"a = a.multiply(b)",
"a",
"a.multiply(b)",
"a.multiply",
"a",
"b",
"if (a.compareTo(c) > 0) {\n System.out.println(-1);\n return;\n }",
"a.compareTo(c) > 0",
"a.compareTo(c)",
"a.compareTo",
"a",
"c",
"0",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"System.out.println(a)",
"System.out.println",
"System.out",
"System",
"System.out",
"a",
"String[] args",
"args",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n List<BigInteger> list = new ArrayList<>();\n BigInteger zero = new BigInteger(\"0\");\n for (int i = 0; i < n; i++) {\n BigInteger bi = sc.nextBigInteger();\n if (bi.equals(zero)) {\n System.out.println(0);\n return;\n }\n list.add(bi);\n }\n\n BigInteger a, b, c;\n a = new BigInteger(\"1\");\n c = new BigInteger(\"1000000000000000000\");\n\n for (int i = 0; i < n; i++) {\n b = list.get(i);\n a = a.multiply(b);\n if (a.compareTo(c) > 0) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(a);\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n List<BigInteger> list = new ArrayList<>();\n BigInteger zero = new BigInteger(\"0\");\n for (int i = 0; i < n; i++) {\n BigInteger bi = sc.nextBigInteger();\n if (bi.equals(zero)) {\n System.out.println(0);\n return;\n }\n list.add(bi);\n }\n\n BigInteger a, b, c;\n a = new BigInteger(\"1\");\n c = new BigInteger(\"1000000000000000000\");\n\n for (int i = 0; i < n; i++) {\n b = list.get(i);\n a = a.multiply(b);\n if (a.compareTo(c) > 0) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(a);\n }\n}",
"Main"
] |
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
List<BigInteger> list = new ArrayList<>();
BigInteger zero = new BigInteger("0");
for (int i = 0; i < n; i++) {
BigInteger bi = sc.nextBigInteger();
if (bi.equals(zero)) {
System.out.println(0);
return;
}
list.add(bi);
}
BigInteger a, b, c;
a = new BigInteger("1");
c = new BigInteger("1000000000000000000");
for (int i = 0; i < n; i++) {
b = list.get(i);
a = a.multiply(b);
if (a.compareTo(c) > 0) {
System.out.println(-1);
return;
}
}
System.out.println(a);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
4,
13,
23,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
18,
13,
13,
2,
17,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
17,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
4,
18,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
17,
17,
30,
4,
18,
18,
13,
13,
17,
29,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
4,
18,
4,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
4,
18,
13,
4,
18,
13,
17,
17,
17,
30,
4,
18,
18,
13,
13,
40,
17,
29,
0,
13,
4,
18,
13,
13,
4,
18,
18,
13,
13,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
167,
20
],
[
167,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
21,
26
],
[
26,
27
],
[
167,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
35,
40
],
[
40,
41
],
[
40,
42
],
[
31,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
52,
53
],
[
53,
54
],
[
43,
55
],
[
55,
56
],
[
55,
57
],
[
43,
58
],
[
58,
59
],
[
58,
60
],
[
43,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
61,
66
],
[
66,
67
],
[
66,
68
],
[
61,
69
],
[
69,
70
],
[
70,
71
],
[
61,
72
],
[
73,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
77,
78
],
[
78,
79
],
[
77,
80
],
[
80,
81
],
[
81,
82
],
[
43,
83
],
[
83,
84
],
[
84,
85
],
[
83,
86
],
[
43,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
88,
93
],
[
87,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
95,
100
],
[
94,
101
],
[
43,
102
],
[
102,
103
],
[
103,
104
],
[
102,
105
],
[
43,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
111,
112
],
[
111,
113
],
[
106,
114
],
[
114,
115
],
[
115,
116
],
[
106,
117
],
[
118,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
125,
128
],
[
123,
129
],
[
129,
130
],
[
130,
131
],
[
129,
132
],
[
132,
133
],
[
133,
134
],
[
132,
135
],
[
121,
136
],
[
136,
137
],
[
137,
138
],
[
136,
139
],
[
139,
140
],
[
140,
141
],
[
139,
142
],
[
139,
143
],
[
120,
144
],
[
119,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
151,
152
],
[
145,
153
],
[
118,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
157,
158
],
[
156,
159
],
[
43,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
160,
165
],
[
0,
166
],
[
166,
167
],
[
166,
168
]
] |
[
"import java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n // printTestValue();\n // abc170_d();\n abc169_b();\n\n }\n\n public static void abc169_b() {\n try (Scanner sc = new Scanner(System.in)) {\n int size = Integer.parseInt(sc.next());\n long ans = 1L;\n List<Long> list = new ArrayList<Long>();\n\n for (int xx = 0; xx < size; xx++) {\n list.add(Long.parseLong(sc.next()));\n }\n Collections.sort(list);\n if (list.get(0) == 0L) {\n System.out.println(0);\n return;\n }\n Collections.reverse(list);\n for (int yy = 0; yy < size; yy++) {\n if (BigInteger.valueOf(ans).multiply(BigInteger.valueOf(list.get(yy)))\n .compareTo(BigInteger.valueOf((long) Math.pow(10d, 18d))) == 1) {\n System.out.println(-1);\n return;\n }\n ans *= list.get(yy);\n }\n System.out.println(ans);\n } catch (Exception e) {\n System.out.println(\"エラー\" + e);\n }\n }\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Collections;",
"Collections",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n // printTestValue();\n // abc170_d();\n abc169_b();\n\n }\n\n public static void abc169_b() {\n try (Scanner sc = new Scanner(System.in)) {\n int size = Integer.parseInt(sc.next());\n long ans = 1L;\n List<Long> list = new ArrayList<Long>();\n\n for (int xx = 0; xx < size; xx++) {\n list.add(Long.parseLong(sc.next()));\n }\n Collections.sort(list);\n if (list.get(0) == 0L) {\n System.out.println(0);\n return;\n }\n Collections.reverse(list);\n for (int yy = 0; yy < size; yy++) {\n if (BigInteger.valueOf(ans).multiply(BigInteger.valueOf(list.get(yy)))\n .compareTo(BigInteger.valueOf((long) Math.pow(10d, 18d))) == 1) {\n System.out.println(-1);\n return;\n }\n ans *= list.get(yy);\n }\n System.out.println(ans);\n } catch (Exception e) {\n System.out.println(\"エラー\" + e);\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n // printTestValue();\n // abc170_d();\n abc169_b();\n\n }",
"main",
"{\n // printTestValue();\n // abc170_d();\n abc169_b();\n\n }",
"abc169_b()",
"abc169_b",
"String[] args",
"args",
"public static void abc169_b() {\n try (Scanner sc = new Scanner(System.in)) {\n int size = Integer.parseInt(sc.next());\n long ans = 1L;\n List<Long> list = new ArrayList<Long>();\n\n for (int xx = 0; xx < size; xx++) {\n list.add(Long.parseLong(sc.next()));\n }\n Collections.sort(list);\n if (list.get(0) == 0L) {\n System.out.println(0);\n return;\n }\n Collections.reverse(list);\n for (int yy = 0; yy < size; yy++) {\n if (BigInteger.valueOf(ans).multiply(BigInteger.valueOf(list.get(yy)))\n .compareTo(BigInteger.valueOf((long) Math.pow(10d, 18d))) == 1) {\n System.out.println(-1);\n return;\n }\n ans *= list.get(yy);\n }\n System.out.println(ans);\n } catch (Exception e) {\n System.out.println(\"エラー\" + e);\n }\n }",
"abc169_b",
"{\n try (Scanner sc = new Scanner(System.in)) {\n int size = Integer.parseInt(sc.next());\n long ans = 1L;\n List<Long> list = new ArrayList<Long>();\n\n for (int xx = 0; xx < size; xx++) {\n list.add(Long.parseLong(sc.next()));\n }\n Collections.sort(list);\n if (list.get(0) == 0L) {\n System.out.println(0);\n return;\n }\n Collections.reverse(list);\n for (int yy = 0; yy < size; yy++) {\n if (BigInteger.valueOf(ans).multiply(BigInteger.valueOf(list.get(yy)))\n .compareTo(BigInteger.valueOf((long) Math.pow(10d, 18d))) == 1) {\n System.out.println(-1);\n return;\n }\n ans *= list.get(yy);\n }\n System.out.println(ans);\n } catch (Exception e) {\n System.out.println(\"エラー\" + e);\n }\n }",
"try (Scanner sc = new Scanner(System.in)) {\n int size = Integer.parseInt(sc.next());\n long ans = 1L;\n List<Long> list = new ArrayList<Long>();\n\n for (int xx = 0; xx < size; xx++) {\n list.add(Long.parseLong(sc.next()));\n }\n Collections.sort(list);\n if (list.get(0) == 0L) {\n System.out.println(0);\n return;\n }\n Collections.reverse(list);\n for (int yy = 0; yy < size; yy++) {\n if (BigInteger.valueOf(ans).multiply(BigInteger.valueOf(list.get(yy)))\n .compareTo(BigInteger.valueOf((long) Math.pow(10d, 18d))) == 1) {\n System.out.println(-1);\n return;\n }\n ans *= list.get(yy);\n }\n System.out.println(ans);\n } catch (Exception e) {\n System.out.println(\"エラー\" + e);\n }",
"catch (Exception e) {\n System.out.println(\"エラー\" + e);\n }",
"Exception e",
"{\n System.out.println(\"エラー\" + e);\n }",
"System.out.println(\"エラー\" + e)",
"System.out.println",
"System.out",
"System",
"System.out",
"\"エラー\" + e",
"\"エラー\"",
"e",
"{\n int size = Integer.parseInt(sc.next());\n long ans = 1L;\n List<Long> list = new ArrayList<Long>();\n\n for (int xx = 0; xx < size; xx++) {\n list.add(Long.parseLong(sc.next()));\n }\n Collections.sort(list);\n if (list.get(0) == 0L) {\n System.out.println(0);\n return;\n }\n Collections.reverse(list);\n for (int yy = 0; yy < size; yy++) {\n if (BigInteger.valueOf(ans).multiply(BigInteger.valueOf(list.get(yy)))\n .compareTo(BigInteger.valueOf((long) Math.pow(10d, 18d))) == 1) {\n System.out.println(-1);\n return;\n }\n ans *= list.get(yy);\n }\n System.out.println(ans);\n }",
"Scanner sc = new Scanner(System.in)",
"Scanner sc = new Scanner(System.in)",
"new Scanner(System.in)",
"int size = Integer.parseInt(sc.next());",
"size",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"long ans = 1L;",
"ans",
"1L",
"List<Long> list = new ArrayList<Long>();",
"list",
"new ArrayList<Long>()",
"for (int xx = 0; xx < size; xx++) {\n list.add(Long.parseLong(sc.next()));\n }",
"int xx = 0;",
"int xx = 0;",
"xx",
"0",
"xx < size",
"xx",
"size",
"xx++",
"xx++",
"xx",
"{\n list.add(Long.parseLong(sc.next()));\n }",
"{\n list.add(Long.parseLong(sc.next()));\n }",
"list.add(Long.parseLong(sc.next()))",
"list.add",
"list",
"Long.parseLong(sc.next())",
"Long.parseLong",
"Long",
"sc.next()",
"sc.next",
"sc",
"Collections.sort(list)",
"Collections.sort",
"Collections",
"list",
"if (list.get(0) == 0L) {\n System.out.println(0);\n return;\n }",
"list.get(0) == 0L",
"list.get(0)",
"list.get",
"list",
"0",
"0L",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"Collections.reverse(list)",
"Collections.reverse",
"Collections",
"list",
"for (int yy = 0; yy < size; yy++) {\n if (BigInteger.valueOf(ans).multiply(BigInteger.valueOf(list.get(yy)))\n .compareTo(BigInteger.valueOf((long) Math.pow(10d, 18d))) == 1) {\n System.out.println(-1);\n return;\n }\n ans *= list.get(yy);\n }",
"int yy = 0;",
"int yy = 0;",
"yy",
"0",
"yy < size",
"yy",
"size",
"yy++",
"yy++",
"yy",
"{\n if (BigInteger.valueOf(ans).multiply(BigInteger.valueOf(list.get(yy)))\n .compareTo(BigInteger.valueOf((long) Math.pow(10d, 18d))) == 1) {\n System.out.println(-1);\n return;\n }\n ans *= list.get(yy);\n }",
"{\n if (BigInteger.valueOf(ans).multiply(BigInteger.valueOf(list.get(yy)))\n .compareTo(BigInteger.valueOf((long) Math.pow(10d, 18d))) == 1) {\n System.out.println(-1);\n return;\n }\n ans *= list.get(yy);\n }",
"if (BigInteger.valueOf(ans).multiply(BigInteger.valueOf(list.get(yy)))\n .compareTo(BigInteger.valueOf((long) Math.pow(10d, 18d))) == 1) {\n System.out.println(-1);\n return;\n }",
"BigInteger.valueOf(ans).multiply(BigInteger.valueOf(list.get(yy)))\n .compareTo(BigInteger.valueOf((long) Math.pow(10d, 18d))) == 1",
"BigInteger.valueOf(ans).multiply(BigInteger.valueOf(list.get(yy)))\n .compareTo(BigInteger.valueOf((long) Math.pow(10d, 18d)))",
"BigInteger.valueOf(ans).multiply(BigInteger.valueOf(list.get(yy)))\n .compareTo",
"BigInteger.valueOf(ans).multiply(BigInteger.valueOf(list.get(yy)))",
"BigInteger.valueOf(ans).multiply",
"BigInteger.valueOf(ans)",
"BigInteger.valueOf",
"BigInteger",
"ans",
"BigInteger.valueOf(list.get(yy))",
"BigInteger.valueOf",
"BigInteger",
"list.get(yy)",
"list.get",
"list",
"yy",
"BigInteger.valueOf((long) Math.pow(10d, 18d))",
"BigInteger.valueOf",
"BigInteger",
"(long) Math.pow(10d, 18d)",
"Math.pow",
"Math",
"10d",
"18d",
"1",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"ans *= list.get(yy)",
"ans",
"list.get(yy)",
"list.get",
"list",
"yy",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"public class Main {\n\n public static void main(String[] args) {\n // printTestValue();\n // abc170_d();\n abc169_b();\n\n }\n\n public static void abc169_b() {\n try (Scanner sc = new Scanner(System.in)) {\n int size = Integer.parseInt(sc.next());\n long ans = 1L;\n List<Long> list = new ArrayList<Long>();\n\n for (int xx = 0; xx < size; xx++) {\n list.add(Long.parseLong(sc.next()));\n }\n Collections.sort(list);\n if (list.get(0) == 0L) {\n System.out.println(0);\n return;\n }\n Collections.reverse(list);\n for (int yy = 0; yy < size; yy++) {\n if (BigInteger.valueOf(ans).multiply(BigInteger.valueOf(list.get(yy)))\n .compareTo(BigInteger.valueOf((long) Math.pow(10d, 18d))) == 1) {\n System.out.println(-1);\n return;\n }\n ans *= list.get(yy);\n }\n System.out.println(ans);\n } catch (Exception e) {\n System.out.println(\"エラー\" + e);\n }\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n // printTestValue();\n // abc170_d();\n abc169_b();\n\n }\n\n public static void abc169_b() {\n try (Scanner sc = new Scanner(System.in)) {\n int size = Integer.parseInt(sc.next());\n long ans = 1L;\n List<Long> list = new ArrayList<Long>();\n\n for (int xx = 0; xx < size; xx++) {\n list.add(Long.parseLong(sc.next()));\n }\n Collections.sort(list);\n if (list.get(0) == 0L) {\n System.out.println(0);\n return;\n }\n Collections.reverse(list);\n for (int yy = 0; yy < size; yy++) {\n if (BigInteger.valueOf(ans).multiply(BigInteger.valueOf(list.get(yy)))\n .compareTo(BigInteger.valueOf((long) Math.pow(10d, 18d))) == 1) {\n System.out.println(-1);\n return;\n }\n ans *= list.get(yy);\n }\n System.out.println(ans);\n } catch (Exception e) {\n System.out.println(\"エラー\" + e);\n }\n }\n}",
"Main"
] |
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// printTestValue();
// abc170_d();
abc169_b();
}
public static void abc169_b() {
try (Scanner sc = new Scanner(System.in)) {
int size = Integer.parseInt(sc.next());
long ans = 1L;
List<Long> list = new ArrayList<Long>();
for (int xx = 0; xx < size; xx++) {
list.add(Long.parseLong(sc.next()));
}
Collections.sort(list);
if (list.get(0) == 0L) {
System.out.println(0);
return;
}
Collections.reverse(list);
for (int yy = 0; yy < size; yy++) {
if (BigInteger.valueOf(ans).multiply(BigInteger.valueOf(list.get(yy)))
.compareTo(BigInteger.valueOf((long) Math.pow(10d, 18d))) == 1) {
System.out.println(-1);
return;
}
ans *= list.get(yy);
}
System.out.println(ans);
} catch (Exception e) {
System.out.println("エラー" + e);
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
41,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
13,
13,
30,
0,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
108,
5
],
[
108,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
36,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
44,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
50,
57
],
[
8,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
60,
62
],
[
8,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
63,
68
],
[
68,
69
],
[
68,
70
],
[
63,
71
],
[
71,
72
],
[
72,
73
],
[
63,
74
],
[
75,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
81,
82
],
[
81,
83
],
[
76,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
76,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
96,
97
],
[
90,
98
],
[
8,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
99,
104
],
[
6,
105
],
[
105,
106
],
[
0,
107
],
[
107,
108
],
[
107,
109
]
] |
[
"import java.util.*;\n \npublic class Main {\n public static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n \tlong[] a = new long[n];\n long std = 1000000000000000000L;\n \tfor (int i=0; i < n; i++) {\n a[i]= sc.nextLong();\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n \n long seki = a[0];\n for(int i=1; i < n; i++) {\n if (a[i] <= (std / seki)) {\n seki *= a[i];\n } else {\n System.out.println(-1);\n \treturn;\n }\n }\n System.out.println(seki);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n \tlong[] a = new long[n];\n long std = 1000000000000000000L;\n \tfor (int i=0; i < n; i++) {\n a[i]= sc.nextLong();\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n \n long seki = a[0];\n for(int i=1; i < n; i++) {\n if (a[i] <= (std / seki)) {\n seki *= a[i];\n } else {\n System.out.println(-1);\n \treturn;\n }\n }\n System.out.println(seki);\n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n \tlong[] a = new long[n];\n long std = 1000000000000000000L;\n \tfor (int i=0; i < n; i++) {\n a[i]= sc.nextLong();\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n \n long seki = a[0];\n for(int i=1; i < n; i++) {\n if (a[i] <= (std / seki)) {\n seki *= a[i];\n } else {\n System.out.println(-1);\n \treturn;\n }\n }\n System.out.println(seki);\n }",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n \tlong[] a = new long[n];\n long std = 1000000000000000000L;\n \tfor (int i=0; i < n; i++) {\n a[i]= sc.nextLong();\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n \n long seki = a[0];\n for(int i=1; i < n; i++) {\n if (a[i] <= (std / seki)) {\n seki *= a[i];\n } else {\n System.out.println(-1);\n \treturn;\n }\n }\n System.out.println(seki);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"long std = 1000000000000000000L;",
"std",
"1000000000000000000L",
"for (int i=0; i < n; i++) {\n a[i]= sc.nextLong();\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i]= sc.nextLong();\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }",
"{\n a[i]= sc.nextLong();\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }",
"a[i]= sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (a[i] == 0) {\n System.out.println(0);\n return;\n }",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"long seki = a[0];",
"seki",
"a[0]",
"a",
"0",
"for(int i=1; i < n; i++) {\n if (a[i] <= (std / seki)) {\n seki *= a[i];\n } else {\n System.out.println(-1);\n \treturn;\n }\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if (a[i] <= (std / seki)) {\n seki *= a[i];\n } else {\n System.out.println(-1);\n \treturn;\n }\n }",
"{\n if (a[i] <= (std / seki)) {\n seki *= a[i];\n } else {\n System.out.println(-1);\n \treturn;\n }\n }",
"if (a[i] <= (std / seki)) {\n seki *= a[i];\n } else {\n System.out.println(-1);\n \treturn;\n }",
"a[i] <= (std / seki)",
"a[i]",
"a",
"i",
"(std / seki)",
"std",
"seki",
"{\n seki *= a[i];\n }",
"seki *= a[i]",
"seki",
"a[i]",
"a",
"i",
"{\n System.out.println(-1);\n \treturn;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"System.out.println(seki)",
"System.out.println",
"System.out",
"System",
"System.out",
"seki",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n \tlong[] a = new long[n];\n long std = 1000000000000000000L;\n \tfor (int i=0; i < n; i++) {\n a[i]= sc.nextLong();\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n \n long seki = a[0];\n for(int i=1; i < n; i++) {\n if (a[i] <= (std / seki)) {\n seki *= a[i];\n } else {\n System.out.println(-1);\n \treturn;\n }\n }\n System.out.println(seki);\n }\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n \tlong[] a = new long[n];\n long std = 1000000000000000000L;\n \tfor (int i=0; i < n; i++) {\n a[i]= sc.nextLong();\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n \n long seki = a[0];\n for(int i=1; i < n; i++) {\n if (a[i] <= (std / seki)) {\n seki *= a[i];\n } else {\n System.out.println(-1);\n \treturn;\n }\n }\n System.out.println(seki);\n }\n}",
"Main"
] |
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) {
System.out.println(0);
return;
}
}
long seki = a[0];
for(int i=1; i < n; i++) {
if (a[i] <= (std / seki)) {
seki *= a[i];
} else {
System.out.println(-1);
return;
}
}
System.out.println(seki);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
28,
13,
13,
30,
30,
14,
2,
13,
17,
30,
0,
13,
17,
3,
14,
2,
13,
2,
13,
13,
30,
0,
13,
13,
30,
0,
13,
40,
17,
3,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
93,
8
],
[
93,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
24,
26
],
[
11,
27
],
[
27,
28
],
[
27,
29
],
[
11,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
30,
41
],
[
42,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
47,
48
],
[
48,
49
],
[
11,
50
],
[
50,
51
],
[
51,
52
],
[
50,
53
],
[
11,
54
],
[
54,
55
],
[
54,
56
],
[
54,
57
],
[
58,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
59,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
68,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
68,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
78,
83
],
[
11,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
84,
89
],
[
9,
90
],
[
90,
91
],
[
0,
92
],
[
92,
93
],
[
92,
94
]
] |
[
"import java.util.Arrays;\nimport java.util.Scanner;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\tScanner scan =new Scanner(System.in);\n\tint N=scan.nextInt();\n\tlong num[]=new long[N];\n\tlong answer=1;\n\tlong max =1000000000000000000L;\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tnum[i]=scan.nextLong();\n\t\t}\n\t\tArrays.sort(num);\n\t\tfor(Long tmp:num) {\n\t\t\tif(tmp==0) {\n\t\t\t\tanswer=0;\n\t\t\t\tbreak;\n\t\t\t}else if(tmp<=(max/answer)) {\n\t\t\t\tanswer*=tmp;\n\t\t\t}else {\n\t\t\t\tanswer =-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(answer);\n\t}\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\tScanner scan =new Scanner(System.in);\n\tint N=scan.nextInt();\n\tlong num[]=new long[N];\n\tlong answer=1;\n\tlong max =1000000000000000000L;\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tnum[i]=scan.nextLong();\n\t\t}\n\t\tArrays.sort(num);\n\t\tfor(Long tmp:num) {\n\t\t\tif(tmp==0) {\n\t\t\t\tanswer=0;\n\t\t\t\tbreak;\n\t\t\t}else if(tmp<=(max/answer)) {\n\t\t\t\tanswer*=tmp;\n\t\t\t}else {\n\t\t\t\tanswer =-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(answer);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\tScanner scan =new Scanner(System.in);\n\tint N=scan.nextInt();\n\tlong num[]=new long[N];\n\tlong answer=1;\n\tlong max =1000000000000000000L;\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tnum[i]=scan.nextLong();\n\t\t}\n\t\tArrays.sort(num);\n\t\tfor(Long tmp:num) {\n\t\t\tif(tmp==0) {\n\t\t\t\tanswer=0;\n\t\t\t\tbreak;\n\t\t\t}else if(tmp<=(max/answer)) {\n\t\t\t\tanswer*=tmp;\n\t\t\t}else {\n\t\t\t\tanswer =-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(answer);\n\t}",
"main",
"{\n\t\t// TODO 自動生成されたメソッド・スタブ\n\tScanner scan =new Scanner(System.in);\n\tint N=scan.nextInt();\n\tlong num[]=new long[N];\n\tlong answer=1;\n\tlong max =1000000000000000000L;\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tnum[i]=scan.nextLong();\n\t\t}\n\t\tArrays.sort(num);\n\t\tfor(Long tmp:num) {\n\t\t\tif(tmp==0) {\n\t\t\t\tanswer=0;\n\t\t\t\tbreak;\n\t\t\t}else if(tmp<=(max/answer)) {\n\t\t\t\tanswer*=tmp;\n\t\t\t}else {\n\t\t\t\tanswer =-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(answer);\n\t}",
"Scanner scan =new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int N=scan.nextInt();",
"N",
"scan.nextInt()",
"scan.nextInt",
"scan",
"long num[]=new long[N];",
"num",
"new long[N]",
"N",
"long answer=1;",
"answer",
"1",
"long max =1000000000000000000L;",
"max",
"1000000000000000000L",
"for(int i=0;i<N;i++) {\n\t\t\tnum[i]=scan.nextLong();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tnum[i]=scan.nextLong();\n\t\t}",
"{\n\t\t\tnum[i]=scan.nextLong();\n\t\t}",
"num[i]=scan.nextLong()",
"num[i]",
"num",
"i",
"scan.nextLong()",
"scan.nextLong",
"scan",
"Arrays.sort(num)",
"Arrays.sort",
"Arrays",
"num",
"for(Long tmp:num) {\n\t\t\tif(tmp==0) {\n\t\t\t\tanswer=0;\n\t\t\t\tbreak;\n\t\t\t}else if(tmp<=(max/answer)) {\n\t\t\t\tanswer*=tmp;\n\t\t\t}else {\n\t\t\t\tanswer =-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"Long tmp",
"num",
"{\n\t\t\tif(tmp==0) {\n\t\t\t\tanswer=0;\n\t\t\t\tbreak;\n\t\t\t}else if(tmp<=(max/answer)) {\n\t\t\t\tanswer*=tmp;\n\t\t\t}else {\n\t\t\t\tanswer =-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(tmp==0) {\n\t\t\t\tanswer=0;\n\t\t\t\tbreak;\n\t\t\t}else if(tmp<=(max/answer)) {\n\t\t\t\tanswer*=tmp;\n\t\t\t}else {\n\t\t\t\tanswer =-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"if(tmp==0) {\n\t\t\t\tanswer=0;\n\t\t\t\tbreak;\n\t\t\t}else if(tmp<=(max/answer)) {\n\t\t\t\tanswer*=tmp;\n\t\t\t}else {\n\t\t\t\tanswer =-1;\n\t\t\t\tbreak;\n\t\t\t}",
"tmp==0",
"tmp",
"0",
"{\n\t\t\t\tanswer=0;\n\t\t\t\tbreak;\n\t\t\t}",
"answer=0",
"answer",
"0",
"break;",
"if(tmp<=(max/answer)) {\n\t\t\t\tanswer*=tmp;\n\t\t\t}else {\n\t\t\t\tanswer =-1;\n\t\t\t\tbreak;\n\t\t\t}",
"tmp<=(max/answer)",
"tmp",
"(max/answer)",
"max",
"answer",
"{\n\t\t\t\tanswer*=tmp;\n\t\t\t}",
"answer*=tmp",
"answer",
"tmp",
"{\n\t\t\t\tanswer =-1;\n\t\t\t\tbreak;\n\t\t\t}",
"answer =-1",
"answer",
"-1",
"1",
"break;",
"System.out.println(answer)",
"System.out.println",
"System.out",
"System",
"System.out",
"answer",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\tScanner scan =new Scanner(System.in);\n\tint N=scan.nextInt();\n\tlong num[]=new long[N];\n\tlong answer=1;\n\tlong max =1000000000000000000L;\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tnum[i]=scan.nextLong();\n\t\t}\n\t\tArrays.sort(num);\n\t\tfor(Long tmp:num) {\n\t\t\tif(tmp==0) {\n\t\t\t\tanswer=0;\n\t\t\t\tbreak;\n\t\t\t}else if(tmp<=(max/answer)) {\n\t\t\t\tanswer*=tmp;\n\t\t\t}else {\n\t\t\t\tanswer =-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(answer);\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\tScanner scan =new Scanner(System.in);\n\tint N=scan.nextInt();\n\tlong num[]=new long[N];\n\tlong answer=1;\n\tlong max =1000000000000000000L;\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tnum[i]=scan.nextLong();\n\t\t}\n\t\tArrays.sort(num);\n\t\tfor(Long tmp:num) {\n\t\t\tif(tmp==0) {\n\t\t\t\tanswer=0;\n\t\t\t\tbreak;\n\t\t\t}else if(tmp<=(max/answer)) {\n\t\t\t\tanswer*=tmp;\n\t\t\t}else {\n\t\t\t\tanswer =-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(answer);\n\t}\n}",
"Main"
] |
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner scan =new Scanner(System.in);
int N=scan.nextInt();
long num[]=new long[N];
long answer=1;
long max =1000000000000000000L;
for(int i=0;i<N;i++) {
num[i]=scan.nextLong();
}
Arrays.sort(num);
for(Long tmp:num) {
if(tmp==0) {
answer=0;
break;
}else if(tmp<=(max/answer)) {
answer*=tmp;
}else {
answer =-1;
break;
}
}
System.out.println(answer);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
20,
41,
13,
20,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
4,
18,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
13,
29,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
20,
0,
13,
4,
18,
13,
13,
14,
2,
4,
18,
4,
18,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
4,
18,
13,
29,
4,
18,
13,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
143,
8
],
[
143,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
11,
26
],
[
26,
27
],
[
26,
28
],
[
11,
29
],
[
29,
30
],
[
29,
31
],
[
11,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
33,
38
],
[
38,
39
],
[
38,
40
],
[
33,
41
],
[
41,
42
],
[
42,
43
],
[
33,
44
],
[
45,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
46,
50
],
[
50,
51
],
[
51,
52
],
[
45,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
53,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
61,
66
],
[
60,
67
],
[
67,
68
],
[
68,
69
],
[
60,
70
],
[
11,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
71,
76
],
[
76,
77
],
[
76,
78
],
[
71,
79
],
[
79,
80
],
[
80,
81
],
[
71,
82
],
[
83,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
83,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
94,
103
],
[
93,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
110,
111
],
[
104,
112
],
[
112,
113
],
[
113,
114
],
[
104,
115
],
[
83,
116
],
[
116,
117
],
[
117,
118
],
[
116,
119
],
[
11,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
123,
124
],
[
11,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
128,
129
],
[
127,
130
],
[
11,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
11,
137
],
[
137,
138
],
[
138,
139
],
[
9,
140
],
[
140,
141
],
[
0,
142
],
[
142,
143
],
[
142,
144
]
] |
[
"import java.math.BigDecimal;\nimport java.util.Scanner;\n \npublic class Main { \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n String s = \"1\";\n BigDecimal biga = new BigDecimal(s);\n BigDecimal one = new BigDecimal(s);\n String[] array = new String[n];\n for(int i=0;i<n;i++){\n array[i] = sc.next();\n if(array[i].equals(\"0\")){\n System.out.println(0);\n sc.close();\n return;\n }\n }\n for(int i=0;i<n;i++){\n BigDecimal bigb = new BigDecimal(array[i]);\n biga = biga.multiply(bigb);\n if(biga.subtract(one).toString().length()>18){\n System.out.println(-1);\n sc.close();\n return;\n }\n biga.add(one);\n }\n String aa = biga.toString();\n long bb = Long.parseLong(aa);\n System.out.println(bb);\n sc.close();\n }\n}",
"import java.math.BigDecimal;",
"BigDecimal",
"java.math",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main { \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n String s = \"1\";\n BigDecimal biga = new BigDecimal(s);\n BigDecimal one = new BigDecimal(s);\n String[] array = new String[n];\n for(int i=0;i<n;i++){\n array[i] = sc.next();\n if(array[i].equals(\"0\")){\n System.out.println(0);\n sc.close();\n return;\n }\n }\n for(int i=0;i<n;i++){\n BigDecimal bigb = new BigDecimal(array[i]);\n biga = biga.multiply(bigb);\n if(biga.subtract(one).toString().length()>18){\n System.out.println(-1);\n sc.close();\n return;\n }\n biga.add(one);\n }\n String aa = biga.toString();\n long bb = Long.parseLong(aa);\n System.out.println(bb);\n sc.close();\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n String s = \"1\";\n BigDecimal biga = new BigDecimal(s);\n BigDecimal one = new BigDecimal(s);\n String[] array = new String[n];\n for(int i=0;i<n;i++){\n array[i] = sc.next();\n if(array[i].equals(\"0\")){\n System.out.println(0);\n sc.close();\n return;\n }\n }\n for(int i=0;i<n;i++){\n BigDecimal bigb = new BigDecimal(array[i]);\n biga = biga.multiply(bigb);\n if(biga.subtract(one).toString().length()>18){\n System.out.println(-1);\n sc.close();\n return;\n }\n biga.add(one);\n }\n String aa = biga.toString();\n long bb = Long.parseLong(aa);\n System.out.println(bb);\n sc.close();\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n String s = \"1\";\n BigDecimal biga = new BigDecimal(s);\n BigDecimal one = new BigDecimal(s);\n String[] array = new String[n];\n for(int i=0;i<n;i++){\n array[i] = sc.next();\n if(array[i].equals(\"0\")){\n System.out.println(0);\n sc.close();\n return;\n }\n }\n for(int i=0;i<n;i++){\n BigDecimal bigb = new BigDecimal(array[i]);\n biga = biga.multiply(bigb);\n if(biga.subtract(one).toString().length()>18){\n System.out.println(-1);\n sc.close();\n return;\n }\n biga.add(one);\n }\n String aa = biga.toString();\n long bb = Long.parseLong(aa);\n System.out.println(bb);\n sc.close();\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"String s = \"1\";",
"s",
"\"1\"",
"BigDecimal biga = new BigDecimal(s);",
"biga",
"new BigDecimal(s)",
"BigDecimal one = new BigDecimal(s);",
"one",
"new BigDecimal(s)",
"String[] array = new String[n];",
"array",
"new String[n]",
"n",
"for(int i=0;i<n;i++){\n array[i] = sc.next();\n if(array[i].equals(\"0\")){\n System.out.println(0);\n sc.close();\n return;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n array[i] = sc.next();\n if(array[i].equals(\"0\")){\n System.out.println(0);\n sc.close();\n return;\n }\n }",
"{\n array[i] = sc.next();\n if(array[i].equals(\"0\")){\n System.out.println(0);\n sc.close();\n return;\n }\n }",
"array[i] = sc.next()",
"array[i]",
"array",
"i",
"sc.next()",
"sc.next",
"sc",
"if(array[i].equals(\"0\")){\n System.out.println(0);\n sc.close();\n return;\n }",
"array[i].equals(\"0\")",
"array[i].equals",
"array[i]",
"array",
"i",
"\"0\"",
"{\n System.out.println(0);\n sc.close();\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"sc.close()",
"sc.close",
"sc",
"return;",
"for(int i=0;i<n;i++){\n BigDecimal bigb = new BigDecimal(array[i]);\n biga = biga.multiply(bigb);\n if(biga.subtract(one).toString().length()>18){\n System.out.println(-1);\n sc.close();\n return;\n }\n biga.add(one);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n BigDecimal bigb = new BigDecimal(array[i]);\n biga = biga.multiply(bigb);\n if(biga.subtract(one).toString().length()>18){\n System.out.println(-1);\n sc.close();\n return;\n }\n biga.add(one);\n }",
"{\n BigDecimal bigb = new BigDecimal(array[i]);\n biga = biga.multiply(bigb);\n if(biga.subtract(one).toString().length()>18){\n System.out.println(-1);\n sc.close();\n return;\n }\n biga.add(one);\n }",
"BigDecimal bigb = new BigDecimal(array[i]);",
"bigb",
"new BigDecimal(array[i])",
"biga = biga.multiply(bigb)",
"biga",
"biga.multiply(bigb)",
"biga.multiply",
"biga",
"bigb",
"if(biga.subtract(one).toString().length()>18){\n System.out.println(-1);\n sc.close();\n return;\n }",
"biga.subtract(one).toString().length()>18",
"biga.subtract(one).toString().length()",
"biga.subtract(one).toString().length",
"biga.subtract(one).toString()",
"biga.subtract(one).toString",
"biga.subtract(one)",
"biga.subtract",
"biga",
"one",
"18",
"{\n System.out.println(-1);\n sc.close();\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"sc.close()",
"sc.close",
"sc",
"return;",
"biga.add(one)",
"biga.add",
"biga",
"one",
"String aa = biga.toString();",
"aa",
"biga.toString()",
"biga.toString",
"biga",
"long bb = Long.parseLong(aa);",
"bb",
"Long.parseLong(aa)",
"Long.parseLong",
"Long",
"aa",
"System.out.println(bb)",
"System.out.println",
"System.out",
"System",
"System.out",
"bb",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"public class Main { \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n String s = \"1\";\n BigDecimal biga = new BigDecimal(s);\n BigDecimal one = new BigDecimal(s);\n String[] array = new String[n];\n for(int i=0;i<n;i++){\n array[i] = sc.next();\n if(array[i].equals(\"0\")){\n System.out.println(0);\n sc.close();\n return;\n }\n }\n for(int i=0;i<n;i++){\n BigDecimal bigb = new BigDecimal(array[i]);\n biga = biga.multiply(bigb);\n if(biga.subtract(one).toString().length()>18){\n System.out.println(-1);\n sc.close();\n return;\n }\n biga.add(one);\n }\n String aa = biga.toString();\n long bb = Long.parseLong(aa);\n System.out.println(bb);\n sc.close();\n }\n}",
"public class Main { \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n String s = \"1\";\n BigDecimal biga = new BigDecimal(s);\n BigDecimal one = new BigDecimal(s);\n String[] array = new String[n];\n for(int i=0;i<n;i++){\n array[i] = sc.next();\n if(array[i].equals(\"0\")){\n System.out.println(0);\n sc.close();\n return;\n }\n }\n for(int i=0;i<n;i++){\n BigDecimal bigb = new BigDecimal(array[i]);\n biga = biga.multiply(bigb);\n if(biga.subtract(one).toString().length()>18){\n System.out.println(-1);\n sc.close();\n return;\n }\n biga.add(one);\n }\n String aa = biga.toString();\n long bb = Long.parseLong(aa);\n System.out.println(bb);\n sc.close();\n }\n}",
"Main"
] |
import java.math.BigDecimal;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String s = "1";
BigDecimal biga = new BigDecimal(s);
BigDecimal one = new BigDecimal(s);
String[] array = new String[n];
for(int i=0;i<n;i++){
array[i] = sc.next();
if(array[i].equals("0")){
System.out.println(0);
sc.close();
return;
}
}
for(int i=0;i<n;i++){
BigDecimal bigb = new BigDecimal(array[i]);
biga = biga.multiply(bigb);
if(biga.subtract(one).toString().length()>18){
System.out.println(-1);
sc.close();
return;
}
biga.add(one);
}
String aa = biga.toString();
long bb = Long.parseLong(aa);
System.out.println(bb);
sc.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
0,
13,
4,
18,
13,
41,
13,
20,
41,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
4,
18,
13,
17,
14,
2,
13,
17,
30,
0,
13,
4,
18,
13,
17,
0,
13,
4,
18,
13,
13,
14,
2,
2,
13,
17,
2,
13,
17,
0,
13,
4,
18,
13,
13,
41,
13,
4,
18,
13,
13,
14,
2,
13,
17,
4,
18,
18,
13,
13,
13,
4,
18,
18,
13,
13,
17,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
116,
8
],
[
116,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
11,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
11,
22
],
[
22,
23
],
[
22,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
27,
30
],
[
11,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
36,
37
],
[
36,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
31,
42
],
[
43,
43
],
[
43,
44
],
[
44,
45
],
[
43,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
43,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
53,
56
],
[
56,
57
],
[
57,
58
],
[
56,
59
],
[
43,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
43,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
73,
76
],
[
43,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
82,
84
],
[
77,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
11,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
11,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
97,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
9,
113
],
[
113,
114
],
[
0,
115
],
[
115,
116
],
[
115,
117
]
] |
[
"import java.math.*;\nimport java.util.*;\npublic class Main\n{\n public static void main(String[] args)\n {\n Scanner cin = new Scanner(System.in);\n int a;\n a = cin.nextInt();\n BigInteger t = new BigInteger(\"1000000000000000000\");\n BigInteger ans = BigInteger.valueOf(1);\n for(int i=1;i<=a;i++)\n {\n int f;\n BigInteger n = cin.nextBigInteger();\n int vis = n.compareTo(BigInteger.valueOf(0));\n if (vis == 0)\n {\n ans = BigInteger.valueOf(0);\n }\n f = ans.compareTo(t);\n if(vis != 0 && f <= 0)\n ans = ans.multiply(n);\n }\n int k = ans.compareTo(t);\n if(k <= 0)\n System.out.println(ans);\n else System.out.println(\"-1\\n\");\n }\n}",
"import java.math.*;",
"math.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main\n{\n public static void main(String[] args)\n {\n Scanner cin = new Scanner(System.in);\n int a;\n a = cin.nextInt();\n BigInteger t = new BigInteger(\"1000000000000000000\");\n BigInteger ans = BigInteger.valueOf(1);\n for(int i=1;i<=a;i++)\n {\n int f;\n BigInteger n = cin.nextBigInteger();\n int vis = n.compareTo(BigInteger.valueOf(0));\n if (vis == 0)\n {\n ans = BigInteger.valueOf(0);\n }\n f = ans.compareTo(t);\n if(vis != 0 && f <= 0)\n ans = ans.multiply(n);\n }\n int k = ans.compareTo(t);\n if(k <= 0)\n System.out.println(ans);\n else System.out.println(\"-1\\n\");\n }\n}",
"Main",
"public static void main(String[] args)\n {\n Scanner cin = new Scanner(System.in);\n int a;\n a = cin.nextInt();\n BigInteger t = new BigInteger(\"1000000000000000000\");\n BigInteger ans = BigInteger.valueOf(1);\n for(int i=1;i<=a;i++)\n {\n int f;\n BigInteger n = cin.nextBigInteger();\n int vis = n.compareTo(BigInteger.valueOf(0));\n if (vis == 0)\n {\n ans = BigInteger.valueOf(0);\n }\n f = ans.compareTo(t);\n if(vis != 0 && f <= 0)\n ans = ans.multiply(n);\n }\n int k = ans.compareTo(t);\n if(k <= 0)\n System.out.println(ans);\n else System.out.println(\"-1\\n\");\n }",
"main",
"{\n Scanner cin = new Scanner(System.in);\n int a;\n a = cin.nextInt();\n BigInteger t = new BigInteger(\"1000000000000000000\");\n BigInteger ans = BigInteger.valueOf(1);\n for(int i=1;i<=a;i++)\n {\n int f;\n BigInteger n = cin.nextBigInteger();\n int vis = n.compareTo(BigInteger.valueOf(0));\n if (vis == 0)\n {\n ans = BigInteger.valueOf(0);\n }\n f = ans.compareTo(t);\n if(vis != 0 && f <= 0)\n ans = ans.multiply(n);\n }\n int k = ans.compareTo(t);\n if(k <= 0)\n System.out.println(ans);\n else System.out.println(\"-1\\n\");\n }",
"Scanner cin = new Scanner(System.in);",
"cin",
"new Scanner(System.in)",
"int a;",
"a",
"a = cin.nextInt()",
"a",
"cin.nextInt()",
"cin.nextInt",
"cin",
"BigInteger t = new BigInteger(\"1000000000000000000\");",
"t",
"new BigInteger(\"1000000000000000000\")",
"BigInteger ans = BigInteger.valueOf(1);",
"ans",
"BigInteger.valueOf(1)",
"BigInteger.valueOf",
"BigInteger",
"1",
"for(int i=1;i<=a;i++)\n {\n int f;\n BigInteger n = cin.nextBigInteger();\n int vis = n.compareTo(BigInteger.valueOf(0));\n if (vis == 0)\n {\n ans = BigInteger.valueOf(0);\n }\n f = ans.compareTo(t);\n if(vis != 0 && f <= 0)\n ans = ans.multiply(n);\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<=a",
"i",
"a",
"i++",
"i++",
"i",
"{\n int f;\n BigInteger n = cin.nextBigInteger();\n int vis = n.compareTo(BigInteger.valueOf(0));\n if (vis == 0)\n {\n ans = BigInteger.valueOf(0);\n }\n f = ans.compareTo(t);\n if(vis != 0 && f <= 0)\n ans = ans.multiply(n);\n }",
"{\n int f;\n BigInteger n = cin.nextBigInteger();\n int vis = n.compareTo(BigInteger.valueOf(0));\n if (vis == 0)\n {\n ans = BigInteger.valueOf(0);\n }\n f = ans.compareTo(t);\n if(vis != 0 && f <= 0)\n ans = ans.multiply(n);\n }",
"int f;",
"f",
"BigInteger n = cin.nextBigInteger();",
"n",
"cin.nextBigInteger()",
"cin.nextBigInteger",
"cin",
"int vis = n.compareTo(BigInteger.valueOf(0));",
"vis",
"n.compareTo(BigInteger.valueOf(0))",
"n.compareTo",
"n",
"BigInteger.valueOf(0)",
"BigInteger.valueOf",
"BigInteger",
"0",
"if (vis == 0)\n {\n ans = BigInteger.valueOf(0);\n }",
"vis == 0",
"vis",
"0",
"{\n ans = BigInteger.valueOf(0);\n }",
"ans = BigInteger.valueOf(0)",
"ans",
"BigInteger.valueOf(0)",
"BigInteger.valueOf",
"BigInteger",
"0",
"f = ans.compareTo(t)",
"f",
"ans.compareTo(t)",
"ans.compareTo",
"ans",
"t",
"if(vis != 0 && f <= 0)\n ans = ans.multiply(n);",
"vis != 0 && f <= 0",
"vis != 0",
"vis",
"0",
"f <= 0",
"f",
"0",
"ans = ans.multiply(n)",
"ans",
"ans.multiply(n)",
"ans.multiply",
"ans",
"n",
"int k = ans.compareTo(t);",
"k",
"ans.compareTo(t)",
"ans.compareTo",
"ans",
"t",
"if(k <= 0)\n System.out.println(ans);\n else System.out.println(\"-1\\n\");",
"k <= 0",
"k",
"0",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"System.out.println(\"-1\\n\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\\n\"",
"String[] args",
"args",
"public class Main\n{\n public static void main(String[] args)\n {\n Scanner cin = new Scanner(System.in);\n int a;\n a = cin.nextInt();\n BigInteger t = new BigInteger(\"1000000000000000000\");\n BigInteger ans = BigInteger.valueOf(1);\n for(int i=1;i<=a;i++)\n {\n int f;\n BigInteger n = cin.nextBigInteger();\n int vis = n.compareTo(BigInteger.valueOf(0));\n if (vis == 0)\n {\n ans = BigInteger.valueOf(0);\n }\n f = ans.compareTo(t);\n if(vis != 0 && f <= 0)\n ans = ans.multiply(n);\n }\n int k = ans.compareTo(t);\n if(k <= 0)\n System.out.println(ans);\n else System.out.println(\"-1\\n\");\n }\n}",
"public class Main\n{\n public static void main(String[] args)\n {\n Scanner cin = new Scanner(System.in);\n int a;\n a = cin.nextInt();\n BigInteger t = new BigInteger(\"1000000000000000000\");\n BigInteger ans = BigInteger.valueOf(1);\n for(int i=1;i<=a;i++)\n {\n int f;\n BigInteger n = cin.nextBigInteger();\n int vis = n.compareTo(BigInteger.valueOf(0));\n if (vis == 0)\n {\n ans = BigInteger.valueOf(0);\n }\n f = ans.compareTo(t);\n if(vis != 0 && f <= 0)\n ans = ans.multiply(n);\n }\n int k = ans.compareTo(t);\n if(k <= 0)\n System.out.println(ans);\n else System.out.println(\"-1\\n\");\n }\n}",
"Main"
] |
import java.math.*;
import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner cin = new Scanner(System.in);
int a;
a = cin.nextInt();
BigInteger t = new BigInteger("1000000000000000000");
BigInteger ans = BigInteger.valueOf(1);
for(int i=1;i<=a;i++)
{
int f;
BigInteger n = cin.nextBigInteger();
int vis = n.compareTo(BigInteger.valueOf(0));
if (vis == 0)
{
ans = BigInteger.valueOf(0);
}
f = ans.compareTo(t);
if(vis != 0 && f <= 0)
ans = ans.multiply(n);
}
int k = ans.compareTo(t);
if(k <= 0)
System.out.println(ans);
else System.out.println("-1\n");
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
18,
13,
13,
14,
2,
2,
4,
18,
13,
13,
17,
4,
18,
13,
17,
30,
3,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
30,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
119,
11
],
[
119,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
14,
27
],
[
27,
28
],
[
27,
29
],
[
14,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
30,
41
],
[
42,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
47,
48
],
[
48,
49
],
[
14,
50
],
[
50,
51
],
[
51,
52
],
[
50,
53
],
[
14,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
56,
58
],
[
14,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
59,
64
],
[
64,
65
],
[
64,
66
],
[
59,
67
],
[
67,
68
],
[
68,
69
],
[
59,
70
],
[
71,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
77,
78
],
[
77,
79
],
[
71,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
83,
86
],
[
82,
87
],
[
81,
88
],
[
88,
89
],
[
89,
90
],
[
88,
91
],
[
80,
92
],
[
92,
93
],
[
14,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
96,
99
],
[
95,
100
],
[
94,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
102,
107
],
[
107,
108
],
[
94,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
12,
116
],
[
116,
117
],
[
0,
118
],
[
118,
119
],
[
118,
120
]
] |
[
"import java.math.BigInteger; \nimport java.util.Scanner;\nimport java.util.Arrays;\npublic class Main\n{\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tBigInteger[] A = new BigInteger[N];\n\t\tBigInteger comp = new BigInteger(\"1000000000000000000\");\n\t\tfor(int i=0;i<N;i++)\n\t\t{\n\t\t A[i]=sc.nextBigInteger();\n\t\t}\n\t\tArrays.sort(A); \n\t\tBigInteger ans = A[0];\n\t\tfor(int i=1;i<N;i++)\n\t\t{\n\t\t ans = ans.multiply(A[i]);\n\t\t if(ans.compareTo(comp)>0 || ans.equals(0))\n\t\t {\n\t\t break;\n\t\t }\n\t\t}\n\t\tif(ans.compareTo(comp)>0)\n\t\t{\n\t\t System.out.println(-1);\n\t\t}\n\t\telse{\n\t\t System.out.println(ans);\n\t\t}\n\t}\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"public class Main\n{\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tBigInteger[] A = new BigInteger[N];\n\t\tBigInteger comp = new BigInteger(\"1000000000000000000\");\n\t\tfor(int i=0;i<N;i++)\n\t\t{\n\t\t A[i]=sc.nextBigInteger();\n\t\t}\n\t\tArrays.sort(A); \n\t\tBigInteger ans = A[0];\n\t\tfor(int i=1;i<N;i++)\n\t\t{\n\t\t ans = ans.multiply(A[i]);\n\t\t if(ans.compareTo(comp)>0 || ans.equals(0))\n\t\t {\n\t\t break;\n\t\t }\n\t\t}\n\t\tif(ans.compareTo(comp)>0)\n\t\t{\n\t\t System.out.println(-1);\n\t\t}\n\t\telse{\n\t\t System.out.println(ans);\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tBigInteger[] A = new BigInteger[N];\n\t\tBigInteger comp = new BigInteger(\"1000000000000000000\");\n\t\tfor(int i=0;i<N;i++)\n\t\t{\n\t\t A[i]=sc.nextBigInteger();\n\t\t}\n\t\tArrays.sort(A); \n\t\tBigInteger ans = A[0];\n\t\tfor(int i=1;i<N;i++)\n\t\t{\n\t\t ans = ans.multiply(A[i]);\n\t\t if(ans.compareTo(comp)>0 || ans.equals(0))\n\t\t {\n\t\t break;\n\t\t }\n\t\t}\n\t\tif(ans.compareTo(comp)>0)\n\t\t{\n\t\t System.out.println(-1);\n\t\t}\n\t\telse{\n\t\t System.out.println(ans);\n\t\t}\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tBigInteger[] A = new BigInteger[N];\n\t\tBigInteger comp = new BigInteger(\"1000000000000000000\");\n\t\tfor(int i=0;i<N;i++)\n\t\t{\n\t\t A[i]=sc.nextBigInteger();\n\t\t}\n\t\tArrays.sort(A); \n\t\tBigInteger ans = A[0];\n\t\tfor(int i=1;i<N;i++)\n\t\t{\n\t\t ans = ans.multiply(A[i]);\n\t\t if(ans.compareTo(comp)>0 || ans.equals(0))\n\t\t {\n\t\t break;\n\t\t }\n\t\t}\n\t\tif(ans.compareTo(comp)>0)\n\t\t{\n\t\t System.out.println(-1);\n\t\t}\n\t\telse{\n\t\t System.out.println(ans);\n\t\t}\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BigInteger[] A = new BigInteger[N];",
"A",
"new BigInteger[N]",
"N",
"BigInteger comp = new BigInteger(\"1000000000000000000\");",
"comp",
"new BigInteger(\"1000000000000000000\")",
"for(int i=0;i<N;i++)\n\t\t{\n\t\t A[i]=sc.nextBigInteger();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t A[i]=sc.nextBigInteger();\n\t\t}",
"{\n\t\t A[i]=sc.nextBigInteger();\n\t\t}",
"A[i]=sc.nextBigInteger()",
"A[i]",
"A",
"i",
"sc.nextBigInteger()",
"sc.nextBigInteger",
"sc",
"Arrays.sort(A)",
"Arrays.sort",
"Arrays",
"A",
"BigInteger ans = A[0];",
"ans",
"A[0]",
"A",
"0",
"for(int i=1;i<N;i++)\n\t\t{\n\t\t ans = ans.multiply(A[i]);\n\t\t if(ans.compareTo(comp)>0 || ans.equals(0))\n\t\t {\n\t\t break;\n\t\t }\n\t\t}",
"int i=1;",
"int i=1;",
"i",
"1",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t ans = ans.multiply(A[i]);\n\t\t if(ans.compareTo(comp)>0 || ans.equals(0))\n\t\t {\n\t\t break;\n\t\t }\n\t\t}",
"{\n\t\t ans = ans.multiply(A[i]);\n\t\t if(ans.compareTo(comp)>0 || ans.equals(0))\n\t\t {\n\t\t break;\n\t\t }\n\t\t}",
"ans = ans.multiply(A[i])",
"ans",
"ans.multiply(A[i])",
"ans.multiply",
"ans",
"A[i]",
"A",
"i",
"if(ans.compareTo(comp)>0 || ans.equals(0))\n\t\t {\n\t\t break;\n\t\t }",
"ans.compareTo(comp)>0 || ans.equals(0)",
"ans.compareTo(comp)>0",
"ans.compareTo(comp)",
"ans.compareTo",
"ans",
"comp",
"0",
"ans.equals(0)",
"ans.equals",
"ans",
"0",
"{\n\t\t break;\n\t\t }",
"break;",
"if(ans.compareTo(comp)>0)\n\t\t{\n\t\t System.out.println(-1);\n\t\t}\n\t\telse{\n\t\t System.out.println(ans);\n\t\t}",
"ans.compareTo(comp)>0",
"ans.compareTo(comp)",
"ans.compareTo",
"ans",
"comp",
"0",
"{\n\t\t System.out.println(-1);\n\t\t}",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"{\n\t\t System.out.println(ans);\n\t\t}",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main\n{\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tBigInteger[] A = new BigInteger[N];\n\t\tBigInteger comp = new BigInteger(\"1000000000000000000\");\n\t\tfor(int i=0;i<N;i++)\n\t\t{\n\t\t A[i]=sc.nextBigInteger();\n\t\t}\n\t\tArrays.sort(A); \n\t\tBigInteger ans = A[0];\n\t\tfor(int i=1;i<N;i++)\n\t\t{\n\t\t ans = ans.multiply(A[i]);\n\t\t if(ans.compareTo(comp)>0 || ans.equals(0))\n\t\t {\n\t\t break;\n\t\t }\n\t\t}\n\t\tif(ans.compareTo(comp)>0)\n\t\t{\n\t\t System.out.println(-1);\n\t\t}\n\t\telse{\n\t\t System.out.println(ans);\n\t\t}\n\t}\n}",
"public class Main\n{\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tBigInteger[] A = new BigInteger[N];\n\t\tBigInteger comp = new BigInteger(\"1000000000000000000\");\n\t\tfor(int i=0;i<N;i++)\n\t\t{\n\t\t A[i]=sc.nextBigInteger();\n\t\t}\n\t\tArrays.sort(A); \n\t\tBigInteger ans = A[0];\n\t\tfor(int i=1;i<N;i++)\n\t\t{\n\t\t ans = ans.multiply(A[i]);\n\t\t if(ans.compareTo(comp)>0 || ans.equals(0))\n\t\t {\n\t\t break;\n\t\t }\n\t\t}\n\t\tif(ans.compareTo(comp)>0)\n\t\t{\n\t\t System.out.println(-1);\n\t\t}\n\t\telse{\n\t\t System.out.println(ans);\n\t\t}\n\t}\n}",
"Main"
] |
import java.math.BigInteger;
import java.util.Scanner;
import java.util.Arrays;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
BigInteger[] A = new BigInteger[N];
BigInteger comp = new BigInteger("1000000000000000000");
for(int i=0;i<N;i++)
{
A[i]=sc.nextBigInteger();
}
Arrays.sort(A);
BigInteger ans = A[0];
for(int i=1;i<N;i++)
{
ans = ans.multiply(A[i]);
if(ans.compareTo(comp)>0 || ans.equals(0))
{
break;
}
}
if(ans.compareTo(comp)>0)
{
System.out.println(-1);
}
else{
System.out.println(ans);
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
13,
29,
4,
18,
13,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
13,
14,
2,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
4,
18,
13,
29,
0,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
124,
5
],
[
124,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
13,
14
],
[
6,
15
],
[
15,
16
],
[
124,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
19,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
19,
28
],
[
28,
29
],
[
28,
30
],
[
19,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
36,
37
],
[
36,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
31,
42
],
[
43,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
43,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
53,
60
],
[
60,
61
],
[
61,
62
],
[
53,
63
],
[
43,
64
],
[
64,
65
],
[
65,
66
],
[
64,
67
],
[
19,
68
],
[
68,
69
],
[
68,
70
],
[
19,
71
],
[
71,
72
],
[
71,
73
],
[
19,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
79,
80
],
[
79,
81
],
[
74,
82
],
[
82,
83
],
[
83,
84
],
[
74,
85
],
[
86,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
86,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
93,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
100,
105
],
[
105,
106
],
[
99,
107
],
[
107,
108
],
[
108,
109
],
[
99,
110
],
[
86,
111
],
[
111,
112
],
[
111,
113
],
[
19,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
19,
120
],
[
120,
121
],
[
121,
122
],
[
0,
123
],
[
123,
124
],
[
123,
125
]
] |
[
"\nimport java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tMain main = new Main();\n\t\tmain.run();\n\t}\n\n\tpublic void run() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tArrayList<Long> a = new ArrayList<>();\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tlong v = sc.nextLong();\n\t\t\tif(v==0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ta.add(v);\n\t\t}\n\t\tlong ans = 1;\n\t\tlong MAX = (long)1e18;\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tlong v = a.get(i);\n\t\t\tif(ans > MAX/v) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans *= v;\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}\n\n\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tMain main = new Main();\n\t\tmain.run();\n\t}\n\n\tpublic void run() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tArrayList<Long> a = new ArrayList<>();\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tlong v = sc.nextLong();\n\t\t\tif(v==0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ta.add(v);\n\t\t}\n\t\tlong ans = 1;\n\t\tlong MAX = (long)1e18;\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tlong v = a.get(i);\n\t\t\tif(ans > MAX/v) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans *= v;\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}\n\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tMain main = new Main();\n\t\tmain.run();\n\t}",
"main",
"{\n\t\tMain main = new Main();\n\t\tmain.run();\n\t}",
"Main main = new Main();",
"main",
"new Main()",
"main.run()",
"main.run",
"main",
"String[] args",
"args",
"public void run() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tArrayList<Long> a = new ArrayList<>();\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tlong v = sc.nextLong();\n\t\t\tif(v==0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ta.add(v);\n\t\t}\n\t\tlong ans = 1;\n\t\tlong MAX = (long)1e18;\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tlong v = a.get(i);\n\t\t\tif(ans > MAX/v) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans *= v;\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}",
"run",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tArrayList<Long> a = new ArrayList<>();\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tlong v = sc.nextLong();\n\t\t\tif(v==0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ta.add(v);\n\t\t}\n\t\tlong ans = 1;\n\t\tlong MAX = (long)1e18;\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tlong v = a.get(i);\n\t\t\tif(ans > MAX/v) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans *= v;\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"ArrayList<Long> a = new ArrayList<>();",
"a",
"new ArrayList<>()",
"for(int i=0; i<n; i++) {\n\t\t\tlong v = sc.nextLong();\n\t\t\tif(v==0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ta.add(v);\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tlong v = sc.nextLong();\n\t\t\tif(v==0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ta.add(v);\n\t\t}",
"{\n\t\t\tlong v = sc.nextLong();\n\t\t\tif(v==0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ta.add(v);\n\t\t}",
"long v = sc.nextLong();",
"v",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(v==0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}",
"v==0",
"v",
"0",
"{\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"sc.close()",
"sc.close",
"sc",
"return;",
"a.add(v)",
"a.add",
"a",
"v",
"long ans = 1;",
"ans",
"1",
"long MAX = (long)1e18;",
"MAX",
"(long)1e18",
"for(int i=0; i<n; i++) {\n\t\t\tlong v = a.get(i);\n\t\t\tif(ans > MAX/v) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans *= v;\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tlong v = a.get(i);\n\t\t\tif(ans > MAX/v) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans *= v;\n\t\t}",
"{\n\t\t\tlong v = a.get(i);\n\t\t\tif(ans > MAX/v) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans *= v;\n\t\t}",
"long v = a.get(i);",
"v",
"a.get(i)",
"a.get",
"a",
"i",
"if(ans > MAX/v) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}",
"ans > MAX/v",
"ans",
"MAX/v",
"MAX",
"v",
"{\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"sc.close()",
"sc.close",
"sc",
"return;",
"ans *= v",
"ans",
"v",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"sc.close()",
"sc.close",
"sc",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tMain main = new Main();\n\t\tmain.run();\n\t}\n\n\tpublic void run() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tArrayList<Long> a = new ArrayList<>();\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tlong v = sc.nextLong();\n\t\t\tif(v==0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ta.add(v);\n\t\t}\n\t\tlong ans = 1;\n\t\tlong MAX = (long)1e18;\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tlong v = a.get(i);\n\t\t\tif(ans > MAX/v) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans *= v;\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}\n\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tMain main = new Main();\n\t\tmain.run();\n\t}\n\n\tpublic void run() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tArrayList<Long> a = new ArrayList<>();\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tlong v = sc.nextLong();\n\t\t\tif(v==0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ta.add(v);\n\t\t}\n\t\tlong ans = 1;\n\t\tlong MAX = (long)1e18;\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tlong v = a.get(i);\n\t\t\tif(ans > MAX/v) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tsc.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans *= v;\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}\n\n\n}",
"Main"
] |
import java.util.*;
public class Main {
public static void main(String[] args) {
Main main = new Main();
main.run();
}
public void run() {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
ArrayList<Long> a = new ArrayList<>();
for(int i=0; i<n; i++) {
long v = sc.nextLong();
if(v==0) {
System.out.println(0);
sc.close();
return;
}
a.add(v);
}
long ans = 1;
long MAX = (long)1e18;
for(int i=0; i<n; i++) {
long v = a.get(i);
if(ans > MAX/v) {
System.out.println(-1);
sc.close();
return;
}
ans *= v;
}
System.out.println(ans);
sc.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
2,
17,
17,
41,
13,
17,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
17,
12,
13,
30,
41,
13,
20,
0,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
0,
13,
17,
14,
13,
30,
4,
18,
18,
13,
13,
17,
29,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
2,
13,
18,
13,
13,
14,
2,
2,
13,
17,
2,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
29,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
23,
13,
12,
13,
30,
0,
13,
20,
23,
13,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
4,
13,
17,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
12,
13,
30,
4,
18,
13,
17,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
317,
8
],
[
317,
9
],
[
9,
10
],
[
317,
11
],
[
11,
12
],
[
317,
13
],
[
13,
14
],
[
13,
15
],
[
15,
16
],
[
15,
17
],
[
317,
18
],
[
18,
19
],
[
18,
20
],
[
317,
21
],
[
21,
22
],
[
317,
23
],
[
23,
24
],
[
317,
25
],
[
25,
26
],
[
317,
27
],
[
27,
28
],
[
317,
29
],
[
29,
30
],
[
317,
31
],
[
31,
32
],
[
317,
33
],
[
33,
34
],
[
317,
35
],
[
35,
36
],
[
317,
37
],
[
37,
38
],
[
317,
39
],
[
39,
40
],
[
317,
41
],
[
41,
42
],
[
41,
43
],
[
317,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
46,
50
],
[
50,
51
],
[
50,
52
],
[
46,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
46,
58
],
[
58,
59
],
[
58,
60
],
[
46,
62
],
[
62,
63
],
[
62,
64
],
[
46,
65
],
[
65,
66
],
[
65,
67
],
[
46,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
68,
73
],
[
73,
74
],
[
73,
75
],
[
68,
76
],
[
76,
77
],
[
77,
78
],
[
68,
79
],
[
80,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
86,
87
],
[
80,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
88,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
46,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
100,
107
],
[
46,
108
],
[
108,
109
],
[
109,
110
],
[
108,
111
],
[
46,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
112,
117
],
[
117,
118
],
[
117,
119
],
[
112,
120
],
[
120,
121
],
[
121,
122
],
[
112,
123
],
[
124,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
124,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
137,
138
],
[
137,
139
],
[
132,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
141,
146
],
[
146,
147
],
[
140,
148
],
[
46,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
46,
155
],
[
155,
156
],
[
156,
157
],
[
44,
158
],
[
158,
159
],
[
317,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
160,
164
],
[
164,
165
],
[
160,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
166,
172
],
[
172,
173
],
[
160,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
174,
180
],
[
180,
181
],
[
160,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
186,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
185,
194
],
[
194,
195
],
[
194,
196
],
[
184,
197
],
[
197,
198
],
[
198,
199
],
[
199,
200
],
[
160,
201
],
[
201,
202
],
[
201,
203
],
[
203,
204
],
[
204,
205
],
[
205,
206
],
[
206,
207
],
[
160,
208
],
[
208,
209
],
[
208,
210
],
[
210,
211
],
[
211,
212
],
[
212,
213
],
[
213,
214
],
[
212,
215
],
[
215,
216
],
[
160,
217
],
[
217,
218
],
[
217,
219
],
[
219,
220
],
[
220,
221
],
[
221,
222
],
[
222,
223
],
[
221,
224
],
[
224,
225
],
[
160,
226
],
[
226,
227
],
[
226,
228
],
[
228,
229
],
[
229,
230
],
[
230,
231
],
[
231,
232
],
[
232,
233
],
[
230,
234
],
[
160,
235
],
[
235,
236
],
[
235,
237
],
[
237,
238
],
[
238,
239
],
[
239,
240
],
[
240,
241
],
[
239,
242
],
[
242,
243
],
[
160,
244
],
[
244,
245
],
[
244,
246
],
[
246,
247
],
[
247,
248
],
[
247,
249
],
[
246,
251
],
[
251,
252
],
[
252,
253
],
[
253,
254
],
[
253,
255
],
[
251,
256
],
[
256,
257
],
[
256,
258
],
[
251,
259
],
[
259,
260
],
[
260,
261
],
[
251,
262
],
[
262,
263
],
[
263,
264
],
[
264,
265
],
[
264,
266
],
[
263,
267
],
[
267,
268
],
[
246,
269
],
[
269,
270
],
[
244,
271
],
[
271,
272
],
[
160,
273
],
[
273,
274
],
[
273,
275
],
[
275,
276
],
[
276,
277
],
[
276,
278
],
[
275,
280
],
[
280,
281
],
[
281,
282
],
[
282,
283
],
[
282,
284
],
[
280,
285
],
[
285,
286
],
[
285,
287
],
[
280,
288
],
[
288,
289
],
[
289,
290
],
[
280,
291
],
[
291,
292
],
[
292,
293
],
[
293,
294
],
[
293,
295
],
[
292,
296
],
[
296,
297
],
[
275,
298
],
[
298,
299
],
[
273,
300
],
[
300,
301
],
[
160,
302
],
[
302,
303
],
[
302,
304
],
[
304,
305
],
[
305,
306
],
[
306,
307
],
[
307,
308
],
[
160,
309
],
[
309,
310
],
[
309,
311
],
[
311,
312
],
[
312,
313
],
[
313,
314
],
[
312,
315
],
[
0,
316
],
[
316,
317
],
[
316,
318
]
] |
[
"import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\tstatic PrintWriter out;\n\tstatic StringBuilder sb;\n\tstatic int mod = (int) 1e9 + 7;\n\tstatic int inf = (int) 1e8;\n\tstatic int[] col;\n\tstatic int n, m, k;\n\tstatic ArrayList<Integer>[] ad;\n\tstatic int[][][] memo;\n\tstatic ArrayList<Integer> h;\n\tstatic char[][] grid;\n\tstatic int[] a;\n\tstatic boolean f;\n\tstatic int offest = 30;\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\tout = new PrintWriter(System.out);\n\t\tint n = sc.nextInt();\n\t\tLong[] a = new Long[n];\n\t\tlong ans = 1;\n\t\tf = false;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tf = true;\n\t\t\t}\n\t\t}\n\t\tif (f) {\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}\n\t\tArrays.sort(a);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans = ans * a[i];\n\t\t\tif (ans <= 0 || ans > ((long) 1e18)) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tout.flush();\n\t}\n\n\tstatic class Scanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream system) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(system));\n\t\t}\n\n\t\tpublic Scanner(String file) throws Exception {\n\t\t\tbr = new BufferedReader(new FileReader(file));\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic String nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic double nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic char nextChar() throws IOException {\n\t\t\treturn next().charAt(0);\n\t\t}\n\n\t\tpublic Long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic int[] nextArrInt(int n) throws IOException {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long[] nextArrLong(int n) throws IOException {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\n\t\tpublic void waitForInput() throws InterruptedException {\n\t\t\tThread.sleep(3000);\n\t\t}\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main {\n\tstatic PrintWriter out;\n\tstatic StringBuilder sb;\n\tstatic int mod = (int) 1e9 + 7;\n\tstatic int inf = (int) 1e8;\n\tstatic int[] col;\n\tstatic int n, m, k;\n\tstatic ArrayList<Integer>[] ad;\n\tstatic int[][][] memo;\n\tstatic ArrayList<Integer> h;\n\tstatic char[][] grid;\n\tstatic int[] a;\n\tstatic boolean f;\n\tstatic int offest = 30;\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\tout = new PrintWriter(System.out);\n\t\tint n = sc.nextInt();\n\t\tLong[] a = new Long[n];\n\t\tlong ans = 1;\n\t\tf = false;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tf = true;\n\t\t\t}\n\t\t}\n\t\tif (f) {\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}\n\t\tArrays.sort(a);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans = ans * a[i];\n\t\t\tif (ans <= 0 || ans > ((long) 1e18)) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tout.flush();\n\t}\n\n\tstatic class Scanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream system) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(system));\n\t\t}\n\n\t\tpublic Scanner(String file) throws Exception {\n\t\t\tbr = new BufferedReader(new FileReader(file));\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic String nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic double nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic char nextChar() throws IOException {\n\t\t\treturn next().charAt(0);\n\t\t}\n\n\t\tpublic Long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic int[] nextArrInt(int n) throws IOException {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long[] nextArrLong(int n) throws IOException {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\n\t\tpublic void waitForInput() throws InterruptedException {\n\t\t\tThread.sleep(3000);\n\t\t}\n\t}\n}",
"Main",
"static PrintWriter out;",
"out",
"static StringBuilder sb;",
"sb",
"static int mod = (int) 1e9 + 7;",
"mod",
"(int) 1e9 + 7",
"(int) 1e9",
"7",
"static int inf = (int) 1e8;",
"inf",
"(int) 1e8",
"static int[] col;",
"col",
"static int n",
"n",
"m",
"m",
"k;",
"k",
"static ArrayList<Integer>[] ad;",
"ad",
"static int[][][] memo;",
"memo",
"static ArrayList<Integer> h;",
"h",
"static char[][] grid;",
"grid",
"static int[] a;",
"a",
"static boolean f;",
"f",
"static int offest = 30;",
"offest",
"30",
"public static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\tout = new PrintWriter(System.out);\n\t\tint n = sc.nextInt();\n\t\tLong[] a = new Long[n];\n\t\tlong ans = 1;\n\t\tf = false;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tf = true;\n\t\t\t}\n\t\t}\n\t\tif (f) {\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}\n\t\tArrays.sort(a);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans = ans * a[i];\n\t\t\tif (ans <= 0 || ans > ((long) 1e18)) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tout.flush();\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tout = new PrintWriter(System.out);\n\t\tint n = sc.nextInt();\n\t\tLong[] a = new Long[n];\n\t\tlong ans = 1;\n\t\tf = false;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tf = true;\n\t\t\t}\n\t\t}\n\t\tif (f) {\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}\n\t\tArrays.sort(a);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans = ans * a[i];\n\t\t\tif (ans <= 0 || ans > ((long) 1e18)) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tout.flush();\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"out = new PrintWriter(System.out)",
"out",
"new PrintWriter(System.out)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Long[] a = new Long[n];",
"a",
"new Long[n]",
"n",
"long ans = 1;",
"ans",
"1",
"f = false",
"f",
"false",
"for (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tf = true;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tf = true;\n\t\t\t}\n\t\t}",
"{\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tf = true;\n\t\t\t}\n\t\t}",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (a[i] == 0) {\n\t\t\t\tf = true;\n\t\t\t}",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"{\n\t\t\t\tf = true;\n\t\t\t}",
"f = true",
"f",
"true",
"if (f) {\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}",
"f",
"{\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"for (int i = 0; i < n; i++) {\n\t\t\tans = ans * a[i];\n\t\t\tif (ans <= 0 || ans > ((long) 1e18)) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tans = ans * a[i];\n\t\t\tif (ans <= 0 || ans > ((long) 1e18)) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"{\n\t\t\tans = ans * a[i];\n\t\t\tif (ans <= 0 || ans > ((long) 1e18)) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"ans = ans * a[i]",
"ans",
"ans * a[i]",
"ans",
"a[i]",
"a",
"i",
"if (ans <= 0 || ans > ((long) 1e18)) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}",
"ans <= 0 || ans > ((long) 1e18)",
"ans <= 0",
"ans",
"0",
"ans > ((long) 1e18)",
"ans",
"((long) 1e18)",
"{\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"out.flush()",
"out.flush",
"out",
"String[] args",
"args",
"static class Scanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream system) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(system));\n\t\t}\n\n\t\tpublic Scanner(String file) throws Exception {\n\t\t\tbr = new BufferedReader(new FileReader(file));\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic String nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic double nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic char nextChar() throws IOException {\n\t\t\treturn next().charAt(0);\n\t\t}\n\n\t\tpublic Long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic int[] nextArrInt(int n) throws IOException {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long[] nextArrLong(int n) throws IOException {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\n\t\tpublic void waitForInput() throws InterruptedException {\n\t\t\tThread.sleep(3000);\n\t\t}\n\t}",
"Scanner",
"StringTokenizer st;",
"st",
"BufferedReader br;",
"br",
"public Scanner(InputStream system) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(system));\n\t\t}",
"Scanner",
"{\n\t\t\tbr = new BufferedReader(new InputStreamReader(system));\n\t\t}",
"br = new BufferedReader(new InputStreamReader(system))",
"br",
"new BufferedReader(new InputStreamReader(system))",
"InputStream system",
"system",
"public Scanner(String file) throws Exception {\n\t\t\tbr = new BufferedReader(new FileReader(file));\n\t\t}",
"Scanner",
"{\n\t\t\tbr = new BufferedReader(new FileReader(file));\n\t\t}",
"br = new BufferedReader(new FileReader(file))",
"br",
"new BufferedReader(new FileReader(file))",
"String file",
"file",
"public String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}",
"next",
"{\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}",
"while (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());",
"st == null || !st.hasMoreTokens()",
"st == null",
"st",
"null",
"!st.hasMoreTokens()",
"st.hasMoreTokens()",
"st.hasMoreTokens",
"st",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"public String nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}",
"nextLine",
"{\n\t\t\treturn br.readLine();\n\t\t}",
"return br.readLine();",
"br.readLine()",
"br.readLine",
"br",
"public int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}",
"nextInt",
"{\n\t\t\treturn Integer.parseInt(next());\n\t\t}",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"public double nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}",
"nextDouble",
"{\n\t\t\treturn Double.parseDouble(next());\n\t\t}",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public char nextChar() throws IOException {\n\t\t\treturn next().charAt(0);\n\t\t}",
"nextChar",
"{\n\t\t\treturn next().charAt(0);\n\t\t}",
"return next().charAt(0);",
"next().charAt(0)",
"next().charAt",
"next()",
"next",
"0",
"public Long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}",
"nextLong",
"{\n\t\t\treturn Long.parseLong(next());\n\t\t}",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"public int[] nextArrInt(int n) throws IOException {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}",
"nextArrInt",
"{\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = nextInt();",
"a[i] = nextInt()",
"a[i]",
"a",
"i",
"nextInt()",
"nextInt",
"return a;",
"a",
"int n",
"n",
"public long[] nextArrLong(int n) throws IOException {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}",
"nextArrLong",
"{\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = nextLong();",
"a[i] = nextLong()",
"a[i]",
"a",
"i",
"nextLong()",
"nextLong",
"return a;",
"a",
"int n",
"n",
"public boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}",
"ready",
"{\n\t\t\treturn br.ready();\n\t\t}",
"return br.ready();",
"br.ready()",
"br.ready",
"br",
"public void waitForInput() throws InterruptedException {\n\t\t\tThread.sleep(3000);\n\t\t}",
"waitForInput",
"{\n\t\t\tThread.sleep(3000);\n\t\t}",
"Thread.sleep(3000)",
"Thread.sleep",
"Thread",
"3000",
"public class Main {\n\tstatic PrintWriter out;\n\tstatic StringBuilder sb;\n\tstatic int mod = (int) 1e9 + 7;\n\tstatic int inf = (int) 1e8;\n\tstatic int[] col;\n\tstatic int n, m, k;\n\tstatic ArrayList<Integer>[] ad;\n\tstatic int[][][] memo;\n\tstatic ArrayList<Integer> h;\n\tstatic char[][] grid;\n\tstatic int[] a;\n\tstatic boolean f;\n\tstatic int offest = 30;\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\tout = new PrintWriter(System.out);\n\t\tint n = sc.nextInt();\n\t\tLong[] a = new Long[n];\n\t\tlong ans = 1;\n\t\tf = false;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tf = true;\n\t\t\t}\n\t\t}\n\t\tif (f) {\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}\n\t\tArrays.sort(a);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans = ans * a[i];\n\t\t\tif (ans <= 0 || ans > ((long) 1e18)) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tout.flush();\n\t}\n\n\tstatic class Scanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream system) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(system));\n\t\t}\n\n\t\tpublic Scanner(String file) throws Exception {\n\t\t\tbr = new BufferedReader(new FileReader(file));\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic String nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic double nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic char nextChar() throws IOException {\n\t\t\treturn next().charAt(0);\n\t\t}\n\n\t\tpublic Long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic int[] nextArrInt(int n) throws IOException {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long[] nextArrLong(int n) throws IOException {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\n\t\tpublic void waitForInput() throws InterruptedException {\n\t\t\tThread.sleep(3000);\n\t\t}\n\t}\n}",
"public class Main {\n\tstatic PrintWriter out;\n\tstatic StringBuilder sb;\n\tstatic int mod = (int) 1e9 + 7;\n\tstatic int inf = (int) 1e8;\n\tstatic int[] col;\n\tstatic int n, m, k;\n\tstatic ArrayList<Integer>[] ad;\n\tstatic int[][][] memo;\n\tstatic ArrayList<Integer> h;\n\tstatic char[][] grid;\n\tstatic int[] a;\n\tstatic boolean f;\n\tstatic int offest = 30;\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\tout = new PrintWriter(System.out);\n\t\tint n = sc.nextInt();\n\t\tLong[] a = new Long[n];\n\t\tlong ans = 1;\n\t\tf = false;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tf = true;\n\t\t\t}\n\t\t}\n\t\tif (f) {\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}\n\t\tArrays.sort(a);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans = ans * a[i];\n\t\t\tif (ans <= 0 || ans > ((long) 1e18)) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tout.flush();\n\t}\n\n\tstatic class Scanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream system) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(system));\n\t\t}\n\n\t\tpublic Scanner(String file) throws Exception {\n\t\t\tbr = new BufferedReader(new FileReader(file));\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic String nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic double nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic char nextChar() throws IOException {\n\t\t\treturn next().charAt(0);\n\t\t}\n\n\t\tpublic Long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic int[] nextArrInt(int n) throws IOException {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long[] nextArrLong(int n) throws IOException {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\n\t\tpublic void waitForInput() throws InterruptedException {\n\t\t\tThread.sleep(3000);\n\t\t}\n\t}\n}",
"Main"
] |
import java.util.*;
import java.io.*;
public class Main {
static PrintWriter out;
static StringBuilder sb;
static int mod = (int) 1e9 + 7;
static int inf = (int) 1e8;
static int[] col;
static int n, m, k;
static ArrayList<Integer>[] ad;
static int[][][] memo;
static ArrayList<Integer> h;
static char[][] grid;
static int[] a;
static boolean f;
static int offest = 30;
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
out = new PrintWriter(System.out);
int n = sc.nextInt();
Long[] a = new Long[n];
long ans = 1;
f = false;
for (int i = 0; i < n; i++) {
a[i] = sc.nextLong();
if (a[i] == 0) {
f = true;
}
}
if (f) {
System.out.println(0);
return;
}
Arrays.sort(a);
for (int i = 0; i < n; i++) {
ans = ans * a[i];
if (ans <= 0 || ans > ((long) 1e18)) {
System.out.println(-1);
return;
}
}
System.out.println(ans);
out.flush();
}
static class Scanner {
StringTokenizer st;
BufferedReader br;
public Scanner(InputStream system) {
br = new BufferedReader(new InputStreamReader(system));
}
public Scanner(String file) throws Exception {
br = new BufferedReader(new FileReader(file));
}
public String next() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
public String nextLine() throws IOException {
return br.readLine();
}
public int nextInt() throws IOException {
return Integer.parseInt(next());
}
public double nextDouble() throws IOException {
return Double.parseDouble(next());
}
public char nextChar() throws IOException {
return next().charAt(0);
}
public Long nextLong() throws IOException {
return Long.parseLong(next());
}
public int[] nextArrInt(int n) throws IOException {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
public long[] nextArrLong(int n) throws IOException {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
public boolean ready() throws IOException {
return br.ready();
}
public void waitForInput() throws InterruptedException {
Thread.sleep(3000);
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
18,
13,
13,
41,
13,
4,
18,
13,
17,
17,
41,
13,
4,
18,
13,
13,
42,
4,
18,
13,
30,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
0,
13,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
0,
13,
4,
18,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
100,
8
],
[
100,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
22,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
27,
30
],
[
27,
31
],
[
11,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
34,
37
],
[
11,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
38,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
42,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
55,
57
],
[
48,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
60,
63
],
[
59,
64
],
[
58,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
11,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
77,
80
],
[
76,
81
],
[
75,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
83,
88
],
[
75,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
95,
96
],
[
9,
97
],
[
97,
98
],
[
0,
99
],
[
99,
100
],
[
99,
101
]
] |
[
"import java.util.*;\nimport java.math.BigInteger;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n BigInteger ans = BigInteger.ONE;\n long l = (long)Math.pow(10,18);\n BigInteger L = BigInteger.valueOf(l);\n while(sc.hasNext()){\n long a = sc.nextLong();\n if (a == 0) {\n ans = BigInteger.ZERO;\n } else if (ans.compareTo(L) <= 0) {\n ans = ans.multiply(BigInteger.valueOf(a));\n }\n }\n if(ans.compareTo(L) <= 0){\n System.out.println(ans);\n }else{\n System.out.println(-1);\n }\n } \n}",
"import java.util.*;",
"util.*",
"java",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n BigInteger ans = BigInteger.ONE;\n long l = (long)Math.pow(10,18);\n BigInteger L = BigInteger.valueOf(l);\n while(sc.hasNext()){\n long a = sc.nextLong();\n if (a == 0) {\n ans = BigInteger.ZERO;\n } else if (ans.compareTo(L) <= 0) {\n ans = ans.multiply(BigInteger.valueOf(a));\n }\n }\n if(ans.compareTo(L) <= 0){\n System.out.println(ans);\n }else{\n System.out.println(-1);\n }\n } \n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n BigInteger ans = BigInteger.ONE;\n long l = (long)Math.pow(10,18);\n BigInteger L = BigInteger.valueOf(l);\n while(sc.hasNext()){\n long a = sc.nextLong();\n if (a == 0) {\n ans = BigInteger.ZERO;\n } else if (ans.compareTo(L) <= 0) {\n ans = ans.multiply(BigInteger.valueOf(a));\n }\n }\n if(ans.compareTo(L) <= 0){\n System.out.println(ans);\n }else{\n System.out.println(-1);\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n BigInteger ans = BigInteger.ONE;\n long l = (long)Math.pow(10,18);\n BigInteger L = BigInteger.valueOf(l);\n while(sc.hasNext()){\n long a = sc.nextLong();\n if (a == 0) {\n ans = BigInteger.ZERO;\n } else if (ans.compareTo(L) <= 0) {\n ans = ans.multiply(BigInteger.valueOf(a));\n }\n }\n if(ans.compareTo(L) <= 0){\n System.out.println(ans);\n }else{\n System.out.println(-1);\n }\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int num = sc.nextInt();",
"num",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BigInteger ans = BigInteger.ONE;",
"ans",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"long l = (long)Math.pow(10,18);",
"l",
"(long)Math.pow(10,18)",
"Math.pow",
"Math",
"10",
"18",
"BigInteger L = BigInteger.valueOf(l);",
"L",
"BigInteger.valueOf(l)",
"BigInteger.valueOf",
"BigInteger",
"l",
"while(sc.hasNext()){\n long a = sc.nextLong();\n if (a == 0) {\n ans = BigInteger.ZERO;\n } else if (ans.compareTo(L) <= 0) {\n ans = ans.multiply(BigInteger.valueOf(a));\n }\n }",
"sc.hasNext()",
"sc.hasNext",
"sc",
"{\n long a = sc.nextLong();\n if (a == 0) {\n ans = BigInteger.ZERO;\n } else if (ans.compareTo(L) <= 0) {\n ans = ans.multiply(BigInteger.valueOf(a));\n }\n }",
"long a = sc.nextLong();",
"a",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (a == 0) {\n ans = BigInteger.ZERO;\n } else if (ans.compareTo(L) <= 0) {\n ans = ans.multiply(BigInteger.valueOf(a));\n }",
"a == 0",
"a",
"0",
"{\n ans = BigInteger.ZERO;\n }",
"ans = BigInteger.ZERO",
"ans",
"BigInteger.ZERO",
"BigInteger",
"BigInteger.ZERO",
"if (ans.compareTo(L) <= 0) {\n ans = ans.multiply(BigInteger.valueOf(a));\n }",
"ans.compareTo(L) <= 0",
"ans.compareTo(L)",
"ans.compareTo",
"ans",
"L",
"0",
"{\n ans = ans.multiply(BigInteger.valueOf(a));\n }",
"ans = ans.multiply(BigInteger.valueOf(a))",
"ans",
"ans.multiply(BigInteger.valueOf(a))",
"ans.multiply",
"ans",
"BigInteger.valueOf(a)",
"BigInteger.valueOf",
"BigInteger",
"a",
"if(ans.compareTo(L) <= 0){\n System.out.println(ans);\n }else{\n System.out.println(-1);\n }",
"ans.compareTo(L) <= 0",
"ans.compareTo(L)",
"ans.compareTo",
"ans",
"L",
"0",
"{\n System.out.println(ans);\n }",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"{\n System.out.println(-1);\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n BigInteger ans = BigInteger.ONE;\n long l = (long)Math.pow(10,18);\n BigInteger L = BigInteger.valueOf(l);\n while(sc.hasNext()){\n long a = sc.nextLong();\n if (a == 0) {\n ans = BigInteger.ZERO;\n } else if (ans.compareTo(L) <= 0) {\n ans = ans.multiply(BigInteger.valueOf(a));\n }\n }\n if(ans.compareTo(L) <= 0){\n System.out.println(ans);\n }else{\n System.out.println(-1);\n }\n } \n}",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n BigInteger ans = BigInteger.ONE;\n long l = (long)Math.pow(10,18);\n BigInteger L = BigInteger.valueOf(l);\n while(sc.hasNext()){\n long a = sc.nextLong();\n if (a == 0) {\n ans = BigInteger.ZERO;\n } else if (ans.compareTo(L) <= 0) {\n ans = ans.multiply(BigInteger.valueOf(a));\n }\n }\n if(ans.compareTo(L) <= 0){\n System.out.println(ans);\n }else{\n System.out.println(-1);\n }\n } \n}",
"Main"
] |
import java.util.*;
import java.math.BigInteger;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
BigInteger ans = BigInteger.ONE;
long l = (long)Math.pow(10,18);
BigInteger L = BigInteger.valueOf(l);
while(sc.hasNext()){
long a = sc.nextLong();
if (a == 0) {
ans = BigInteger.ZERO;
} else if (ans.compareTo(L) <= 0) {
ans = ans.multiply(BigInteger.valueOf(a));
}
}
if(ans.compareTo(L) <= 0){
System.out.println(ans);
}else{
System.out.println(-1);
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
2,
17,
17,
41,
13,
20,
41,
13,
20,
13,
41,
13,
41,
13,
20,
0,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
4,
18,
18,
13,
13,
13,
17,
30,
0,
13,
17,
14,
2,
4,
18,
18,
13,
13,
20,
17,
30,
0,
13,
17,
41,
13,
20,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
0,
13,
17,
3,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
166,
8
],
[
166,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
14,
16
],
[
11,
17
],
[
17,
18
],
[
17,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
11,
26
],
[
26,
27
],
[
26,
28
],
[
11,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
11,
34
],
[
34,
35
],
[
34,
36
],
[
11,
37
],
[
37,
38
],
[
37,
39
],
[
11,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
40,
45
],
[
45,
46
],
[
45,
47
],
[
40,
48
],
[
48,
49
],
[
49,
50
],
[
40,
51
],
[
52,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
57,
58
],
[
58,
59
],
[
52,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
62,
67
],
[
61,
68
],
[
60,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
52,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
75,
80
],
[
74,
81
],
[
73,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
11,
86
],
[
86,
87
],
[
86,
88
],
[
11,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
94,
99
],
[
89,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
100,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
112,
117
],
[
117,
118
],
[
117,
119
],
[
112,
120
],
[
120,
121
],
[
121,
122
],
[
112,
123
],
[
124,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
128,
129
],
[
127,
130
],
[
130,
131
],
[
130,
132
],
[
124,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
135,
138
],
[
134,
139
],
[
133,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
111,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
145,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
150,
155
],
[
145,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
157,
162
],
[
9,
163
],
[
163,
164
],
[
0,
165
],
[
165,
166
],
[
165,
167
]
] |
[
"import java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n // write your code here\n int N = (int) 1e5 + 5;\n BigInteger max = new BigInteger(\"1000000000000000000\");\n BigInteger[] A = new BigInteger[N];\n int n;\n Scanner in = new Scanner(System.in);\n n = in.nextInt();\n int flag = 0, flag1 = 0;\n for (int i = 0; i < n; i++) {\n A[i] = in.nextBigInteger();\n if (A[i].compareTo(max) == 1) {\n flag = 1;\n }\n if (A[i].compareTo(new BigInteger(\"0\")) == 0) {\n flag1 = 1;\n }\n }\n BigInteger m = new BigInteger(String.valueOf(1));\n if (flag1 == 1) {\n System.out.println(\"0\");\n } else if (flag == 1) {\n System.out.println(\"-1\");\n } else {\n for (int i = 0; i < n; i++) {\n m = m.multiply(A[i]);\n// System.out.println(m.compareTo(max));\n if (m.compareTo(max) == 1) {\n flag = 1;\n break;\n }\n }\n if (flag == 1) {\n System.out.println(\"-1\");\n } else {\n System.out.println(m);\n }\n }\n\n\n }\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n // write your code here\n int N = (int) 1e5 + 5;\n BigInteger max = new BigInteger(\"1000000000000000000\");\n BigInteger[] A = new BigInteger[N];\n int n;\n Scanner in = new Scanner(System.in);\n n = in.nextInt();\n int flag = 0, flag1 = 0;\n for (int i = 0; i < n; i++) {\n A[i] = in.nextBigInteger();\n if (A[i].compareTo(max) == 1) {\n flag = 1;\n }\n if (A[i].compareTo(new BigInteger(\"0\")) == 0) {\n flag1 = 1;\n }\n }\n BigInteger m = new BigInteger(String.valueOf(1));\n if (flag1 == 1) {\n System.out.println(\"0\");\n } else if (flag == 1) {\n System.out.println(\"-1\");\n } else {\n for (int i = 0; i < n; i++) {\n m = m.multiply(A[i]);\n// System.out.println(m.compareTo(max));\n if (m.compareTo(max) == 1) {\n flag = 1;\n break;\n }\n }\n if (flag == 1) {\n System.out.println(\"-1\");\n } else {\n System.out.println(m);\n }\n }\n\n\n }\n}",
"Main",
"public static void main(String[] args) {\n // write your code here\n int N = (int) 1e5 + 5;\n BigInteger max = new BigInteger(\"1000000000000000000\");\n BigInteger[] A = new BigInteger[N];\n int n;\n Scanner in = new Scanner(System.in);\n n = in.nextInt();\n int flag = 0, flag1 = 0;\n for (int i = 0; i < n; i++) {\n A[i] = in.nextBigInteger();\n if (A[i].compareTo(max) == 1) {\n flag = 1;\n }\n if (A[i].compareTo(new BigInteger(\"0\")) == 0) {\n flag1 = 1;\n }\n }\n BigInteger m = new BigInteger(String.valueOf(1));\n if (flag1 == 1) {\n System.out.println(\"0\");\n } else if (flag == 1) {\n System.out.println(\"-1\");\n } else {\n for (int i = 0; i < n; i++) {\n m = m.multiply(A[i]);\n// System.out.println(m.compareTo(max));\n if (m.compareTo(max) == 1) {\n flag = 1;\n break;\n }\n }\n if (flag == 1) {\n System.out.println(\"-1\");\n } else {\n System.out.println(m);\n }\n }\n\n\n }",
"main",
"{\n // write your code here\n int N = (int) 1e5 + 5;\n BigInteger max = new BigInteger(\"1000000000000000000\");\n BigInteger[] A = new BigInteger[N];\n int n;\n Scanner in = new Scanner(System.in);\n n = in.nextInt();\n int flag = 0, flag1 = 0;\n for (int i = 0; i < n; i++) {\n A[i] = in.nextBigInteger();\n if (A[i].compareTo(max) == 1) {\n flag = 1;\n }\n if (A[i].compareTo(new BigInteger(\"0\")) == 0) {\n flag1 = 1;\n }\n }\n BigInteger m = new BigInteger(String.valueOf(1));\n if (flag1 == 1) {\n System.out.println(\"0\");\n } else if (flag == 1) {\n System.out.println(\"-1\");\n } else {\n for (int i = 0; i < n; i++) {\n m = m.multiply(A[i]);\n// System.out.println(m.compareTo(max));\n if (m.compareTo(max) == 1) {\n flag = 1;\n break;\n }\n }\n if (flag == 1) {\n System.out.println(\"-1\");\n } else {\n System.out.println(m);\n }\n }\n\n\n }",
"int N = (int) 1e5 + 5;",
"N",
"(int) 1e5 + 5",
"(int) 1e5",
"5",
"BigInteger max = new BigInteger(\"1000000000000000000\");",
"max",
"new BigInteger(\"1000000000000000000\")",
"BigInteger[] A = new BigInteger[N];",
"A",
"new BigInteger[N]",
"N",
"int n;",
"n",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"n = in.nextInt()",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"int flag = 0",
"flag",
"0",
"flag1 = 0;",
"flag1",
"0",
"for (int i = 0; i < n; i++) {\n A[i] = in.nextBigInteger();\n if (A[i].compareTo(max) == 1) {\n flag = 1;\n }\n if (A[i].compareTo(new BigInteger(\"0\")) == 0) {\n flag1 = 1;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n A[i] = in.nextBigInteger();\n if (A[i].compareTo(max) == 1) {\n flag = 1;\n }\n if (A[i].compareTo(new BigInteger(\"0\")) == 0) {\n flag1 = 1;\n }\n }",
"{\n A[i] = in.nextBigInteger();\n if (A[i].compareTo(max) == 1) {\n flag = 1;\n }\n if (A[i].compareTo(new BigInteger(\"0\")) == 0) {\n flag1 = 1;\n }\n }",
"A[i] = in.nextBigInteger()",
"A[i]",
"A",
"i",
"in.nextBigInteger()",
"in.nextBigInteger",
"in",
"if (A[i].compareTo(max) == 1) {\n flag = 1;\n }",
"A[i].compareTo(max) == 1",
"A[i].compareTo(max)",
"A[i].compareTo",
"A[i]",
"A",
"i",
"max",
"1",
"{\n flag = 1;\n }",
"flag = 1",
"flag",
"1",
"if (A[i].compareTo(new BigInteger(\"0\")) == 0) {\n flag1 = 1;\n }",
"A[i].compareTo(new BigInteger(\"0\")) == 0",
"A[i].compareTo(new BigInteger(\"0\"))",
"A[i].compareTo",
"A[i]",
"A",
"i",
"new BigInteger(\"0\")",
"0",
"{\n flag1 = 1;\n }",
"flag1 = 1",
"flag1",
"1",
"BigInteger m = new BigInteger(String.valueOf(1));",
"m",
"new BigInteger(String.valueOf(1))",
"if (flag1 == 1) {\n System.out.println(\"0\");\n } else if (flag == 1) {\n System.out.println(\"-1\");\n } else {\n for (int i = 0; i < n; i++) {\n m = m.multiply(A[i]);\n// System.out.println(m.compareTo(max));\n if (m.compareTo(max) == 1) {\n flag = 1;\n break;\n }\n }\n if (flag == 1) {\n System.out.println(\"-1\");\n } else {\n System.out.println(m);\n }\n }",
"flag1 == 1",
"flag1",
"1",
"{\n System.out.println(\"0\");\n }",
"System.out.println(\"0\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"0\"",
"if (flag == 1) {\n System.out.println(\"-1\");\n } else {\n for (int i = 0; i < n; i++) {\n m = m.multiply(A[i]);\n// System.out.println(m.compareTo(max));\n if (m.compareTo(max) == 1) {\n flag = 1;\n break;\n }\n }\n if (flag == 1) {\n System.out.println(\"-1\");\n } else {\n System.out.println(m);\n }\n }",
"flag == 1",
"flag",
"1",
"{\n System.out.println(\"-1\");\n }",
"System.out.println(\"-1\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"{\n for (int i = 0; i < n; i++) {\n m = m.multiply(A[i]);\n// System.out.println(m.compareTo(max));\n if (m.compareTo(max) == 1) {\n flag = 1;\n break;\n }\n }\n if (flag == 1) {\n System.out.println(\"-1\");\n } else {\n System.out.println(m);\n }\n }",
"for (int i = 0; i < n; i++) {\n m = m.multiply(A[i]);\n// System.out.println(m.compareTo(max));\n if (m.compareTo(max) == 1) {\n flag = 1;\n break;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n m = m.multiply(A[i]);\n// System.out.println(m.compareTo(max));\n if (m.compareTo(max) == 1) {\n flag = 1;\n break;\n }\n }",
"{\n m = m.multiply(A[i]);\n// System.out.println(m.compareTo(max));\n if (m.compareTo(max) == 1) {\n flag = 1;\n break;\n }\n }",
"m = m.multiply(A[i])",
"m",
"m.multiply(A[i])",
"m.multiply",
"m",
"A[i]",
"A",
"i",
"if (m.compareTo(max) == 1) {\n flag = 1;\n break;\n }",
"m.compareTo(max) == 1",
"m.compareTo(max)",
"m.compareTo",
"m",
"max",
"1",
"{\n flag = 1;\n break;\n }",
"flag = 1",
"flag",
"1",
"break;",
"if (flag == 1) {\n System.out.println(\"-1\");\n } else {\n System.out.println(m);\n }",
"flag == 1",
"flag",
"1",
"{\n System.out.println(\"-1\");\n }",
"System.out.println(\"-1\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"{\n System.out.println(m);\n }",
"System.out.println(m)",
"System.out.println",
"System.out",
"System",
"System.out",
"m",
"String[] args",
"args",
"public class Main {\n\n public static void main(String[] args) {\n // write your code here\n int N = (int) 1e5 + 5;\n BigInteger max = new BigInteger(\"1000000000000000000\");\n BigInteger[] A = new BigInteger[N];\n int n;\n Scanner in = new Scanner(System.in);\n n = in.nextInt();\n int flag = 0, flag1 = 0;\n for (int i = 0; i < n; i++) {\n A[i] = in.nextBigInteger();\n if (A[i].compareTo(max) == 1) {\n flag = 1;\n }\n if (A[i].compareTo(new BigInteger(\"0\")) == 0) {\n flag1 = 1;\n }\n }\n BigInteger m = new BigInteger(String.valueOf(1));\n if (flag1 == 1) {\n System.out.println(\"0\");\n } else if (flag == 1) {\n System.out.println(\"-1\");\n } else {\n for (int i = 0; i < n; i++) {\n m = m.multiply(A[i]);\n// System.out.println(m.compareTo(max));\n if (m.compareTo(max) == 1) {\n flag = 1;\n break;\n }\n }\n if (flag == 1) {\n System.out.println(\"-1\");\n } else {\n System.out.println(m);\n }\n }\n\n\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n // write your code here\n int N = (int) 1e5 + 5;\n BigInteger max = new BigInteger(\"1000000000000000000\");\n BigInteger[] A = new BigInteger[N];\n int n;\n Scanner in = new Scanner(System.in);\n n = in.nextInt();\n int flag = 0, flag1 = 0;\n for (int i = 0; i < n; i++) {\n A[i] = in.nextBigInteger();\n if (A[i].compareTo(max) == 1) {\n flag = 1;\n }\n if (A[i].compareTo(new BigInteger(\"0\")) == 0) {\n flag1 = 1;\n }\n }\n BigInteger m = new BigInteger(String.valueOf(1));\n if (flag1 == 1) {\n System.out.println(\"0\");\n } else if (flag == 1) {\n System.out.println(\"-1\");\n } else {\n for (int i = 0; i < n; i++) {\n m = m.multiply(A[i]);\n// System.out.println(m.compareTo(max));\n if (m.compareTo(max) == 1) {\n flag = 1;\n break;\n }\n }\n if (flag == 1) {\n System.out.println(\"-1\");\n } else {\n System.out.println(m);\n }\n }\n\n\n }\n}",
"Main"
] |
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// write your code here
int N = (int) 1e5 + 5;
BigInteger max = new BigInteger("1000000000000000000");
BigInteger[] A = new BigInteger[N];
int n;
Scanner in = new Scanner(System.in);
n = in.nextInt();
int flag = 0, flag1 = 0;
for (int i = 0; i < n; i++) {
A[i] = in.nextBigInteger();
if (A[i].compareTo(max) == 1) {
flag = 1;
}
if (A[i].compareTo(new BigInteger("0")) == 0) {
flag1 = 1;
}
}
BigInteger m = new BigInteger(String.valueOf(1));
if (flag1 == 1) {
System.out.println("0");
} else if (flag == 1) {
System.out.println("-1");
} else {
for (int i = 0; i < n; i++) {
m = m.multiply(A[i]);
// System.out.println(m.compareTo(max));
if (m.compareTo(max) == 1) {
flag = 1;
break;
}
}
if (flag == 1) {
System.out.println("-1");
} else {
System.out.println(m);
}
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
4,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
14,
2,
18,
13,
17,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
13,
17,
41,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
38,
5,
13,
30,
4,
18,
18,
13,
13,
40,
17,
4,
18,
13,
17,
30,
0,
13,
4,
13,
13,
18,
13,
13,
14,
2,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
4,
18,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
142,
11
],
[
142,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
14,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
29,
32
],
[
29,
33
],
[
14,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
34,
39
],
[
39,
40
],
[
39,
41
],
[
34,
42
],
[
42,
43
],
[
43,
44
],
[
34,
45
],
[
46,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
52,
53
],
[
14,
54
],
[
54,
55
],
[
55,
56
],
[
54,
57
],
[
14,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
58,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
65,
70
],
[
64,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
14,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
14,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
80,
85
],
[
85,
86
],
[
85,
87
],
[
80,
88
],
[
88,
89
],
[
89,
90
],
[
80,
91
],
[
92,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
102,
103
],
[
96,
104
],
[
104,
105
],
[
105,
106
],
[
104,
107
],
[
93,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
111,
113
],
[
111,
114
],
[
114,
115
],
[
114,
116
],
[
92,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
127,
128
],
[
121,
129
],
[
129,
130
],
[
130,
131
],
[
129,
132
],
[
14,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
133,
138
],
[
12,
139
],
[
139,
140
],
[
0,
141
],
[
141,
142
],
[
141,
143
]
] |
[
"import static java.lang.Math.multiplyExact;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n Integer n = scanner.nextInt();\n Long[] a = new Long[n];\n Long limit = (long)Math.pow(10,18);\n\n for (int i = 0; i < n; i++) {\n a[i] = scanner.nextLong();\n }\n\n Arrays.sort(a);\n\n if (a[0] == 0){\n System.out.print(0);\n System.exit(0);\n }\n\n Long result = a[0];\n\n for (int i = 1; i < n; i++) {\n try {\n result = multiplyExact(result,a[i]);\n } catch (Exception e) {\n System.out.print(-1);\n System.exit(0);\n }\n if (result > limit) {\n System.out.print(-1);\n System.exit(0);\n }\n }\n System.out.print(result);\n }\n}",
"import static java.lang.Math.multiplyExact;",
"import static java.lang.Math.multiplyExact;",
"import static java.lang.Math.multiplyExact;",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n Integer n = scanner.nextInt();\n Long[] a = new Long[n];\n Long limit = (long)Math.pow(10,18);\n\n for (int i = 0; i < n; i++) {\n a[i] = scanner.nextLong();\n }\n\n Arrays.sort(a);\n\n if (a[0] == 0){\n System.out.print(0);\n System.exit(0);\n }\n\n Long result = a[0];\n\n for (int i = 1; i < n; i++) {\n try {\n result = multiplyExact(result,a[i]);\n } catch (Exception e) {\n System.out.print(-1);\n System.exit(0);\n }\n if (result > limit) {\n System.out.print(-1);\n System.exit(0);\n }\n }\n System.out.print(result);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n Integer n = scanner.nextInt();\n Long[] a = new Long[n];\n Long limit = (long)Math.pow(10,18);\n\n for (int i = 0; i < n; i++) {\n a[i] = scanner.nextLong();\n }\n\n Arrays.sort(a);\n\n if (a[0] == 0){\n System.out.print(0);\n System.exit(0);\n }\n\n Long result = a[0];\n\n for (int i = 1; i < n; i++) {\n try {\n result = multiplyExact(result,a[i]);\n } catch (Exception e) {\n System.out.print(-1);\n System.exit(0);\n }\n if (result > limit) {\n System.out.print(-1);\n System.exit(0);\n }\n }\n System.out.print(result);\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n Integer n = scanner.nextInt();\n Long[] a = new Long[n];\n Long limit = (long)Math.pow(10,18);\n\n for (int i = 0; i < n; i++) {\n a[i] = scanner.nextLong();\n }\n\n Arrays.sort(a);\n\n if (a[0] == 0){\n System.out.print(0);\n System.exit(0);\n }\n\n Long result = a[0];\n\n for (int i = 1; i < n; i++) {\n try {\n result = multiplyExact(result,a[i]);\n } catch (Exception e) {\n System.out.print(-1);\n System.exit(0);\n }\n if (result > limit) {\n System.out.print(-1);\n System.exit(0);\n }\n }\n System.out.print(result);\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"Integer n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"Long[] a = new Long[n];",
"a",
"new Long[n]",
"n",
"Long limit = (long)Math.pow(10,18);",
"limit",
"(long)Math.pow(10,18)",
"Math.pow",
"Math",
"10",
"18",
"for (int i = 0; i < n; i++) {\n a[i] = scanner.nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = scanner.nextLong();\n }",
"{\n a[i] = scanner.nextLong();\n }",
"a[i] = scanner.nextLong()",
"a[i]",
"a",
"i",
"scanner.nextLong()",
"scanner.nextLong",
"scanner",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"if (a[0] == 0){\n System.out.print(0);\n System.exit(0);\n }",
"a[0] == 0",
"a[0]",
"a",
"0",
"0",
"{\n System.out.print(0);\n System.exit(0);\n }",
"System.out.print(0)",
"System.out.print",
"System.out",
"System",
"System.out",
"0",
"System.exit(0)",
"System.exit",
"System",
"0",
"Long result = a[0];",
"result",
"a[0]",
"a",
"0",
"for (int i = 1; i < n; i++) {\n try {\n result = multiplyExact(result,a[i]);\n } catch (Exception e) {\n System.out.print(-1);\n System.exit(0);\n }\n if (result > limit) {\n System.out.print(-1);\n System.exit(0);\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n try {\n result = multiplyExact(result,a[i]);\n } catch (Exception e) {\n System.out.print(-1);\n System.exit(0);\n }\n if (result > limit) {\n System.out.print(-1);\n System.exit(0);\n }\n }",
"{\n try {\n result = multiplyExact(result,a[i]);\n } catch (Exception e) {\n System.out.print(-1);\n System.exit(0);\n }\n if (result > limit) {\n System.out.print(-1);\n System.exit(0);\n }\n }",
"try {\n result = multiplyExact(result,a[i]);\n } catch (Exception e) {\n System.out.print(-1);\n System.exit(0);\n }",
"catch (Exception e) {\n System.out.print(-1);\n System.exit(0);\n }",
"Exception e",
"{\n System.out.print(-1);\n System.exit(0);\n }",
"System.out.print(-1)",
"System.out.print",
"System.out",
"System",
"System.out",
"-1",
"1",
"System.exit(0)",
"System.exit",
"System",
"0",
"{\n result = multiplyExact(result,a[i]);\n }",
"result = multiplyExact(result,a[i])",
"result",
"multiplyExact(result,a[i])",
"multiplyExact",
"result",
"a[i]",
"a",
"i",
"if (result > limit) {\n System.out.print(-1);\n System.exit(0);\n }",
"result > limit",
"result",
"limit",
"{\n System.out.print(-1);\n System.exit(0);\n }",
"System.out.print(-1)",
"System.out.print",
"System.out",
"System",
"System.out",
"-1",
"1",
"System.exit(0)",
"System.exit",
"System",
"0",
"System.out.print(result)",
"System.out.print",
"System.out",
"System",
"System.out",
"result",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n Integer n = scanner.nextInt();\n Long[] a = new Long[n];\n Long limit = (long)Math.pow(10,18);\n\n for (int i = 0; i < n; i++) {\n a[i] = scanner.nextLong();\n }\n\n Arrays.sort(a);\n\n if (a[0] == 0){\n System.out.print(0);\n System.exit(0);\n }\n\n Long result = a[0];\n\n for (int i = 1; i < n; i++) {\n try {\n result = multiplyExact(result,a[i]);\n } catch (Exception e) {\n System.out.print(-1);\n System.exit(0);\n }\n if (result > limit) {\n System.out.print(-1);\n System.exit(0);\n }\n }\n System.out.print(result);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n Integer n = scanner.nextInt();\n Long[] a = new Long[n];\n Long limit = (long)Math.pow(10,18);\n\n for (int i = 0; i < n; i++) {\n a[i] = scanner.nextLong();\n }\n\n Arrays.sort(a);\n\n if (a[0] == 0){\n System.out.print(0);\n System.exit(0);\n }\n\n Long result = a[0];\n\n for (int i = 1; i < n; i++) {\n try {\n result = multiplyExact(result,a[i]);\n } catch (Exception e) {\n System.out.print(-1);\n System.exit(0);\n }\n if (result > limit) {\n System.out.print(-1);\n System.exit(0);\n }\n }\n System.out.print(result);\n }\n}",
"Main"
] |
import static java.lang.Math.multiplyExact;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Integer n = scanner.nextInt();
Long[] a = new Long[n];
Long limit = (long)Math.pow(10,18);
for (int i = 0; i < n; i++) {
a[i] = scanner.nextLong();
}
Arrays.sort(a);
if (a[0] == 0){
System.out.print(0);
System.exit(0);
}
Long result = a[0];
for (int i = 1; i < n; i++) {
try {
result = multiplyExact(result,a[i]);
} catch (Exception e) {
System.out.print(-1);
System.exit(0);
}
if (result > limit) {
System.out.print(-1);
System.exit(0);
}
}
System.out.print(result);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
41,
13,
4,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
13,
13,
30,
0,
13,
18,
13,
13,
30,
0,
13,
40,
17,
3,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
110,
5
],
[
110,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
26,
29
],
[
26,
30
],
[
8,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
36,
37
],
[
36,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
31,
42
],
[
43,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
48,
49
],
[
49,
50
],
[
43,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
51,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
58,
63
],
[
57,
64
],
[
64,
65
],
[
65,
66
],
[
64,
67
],
[
8,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
68,
73
],
[
73,
74
],
[
73,
75
],
[
68,
76
],
[
76,
77
],
[
77,
78
],
[
68,
79
],
[
80,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
86,
87
],
[
86,
88
],
[
81,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
81,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
95,
100
],
[
8,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
6,
107
],
[
107,
108
],
[
0,
109
],
[
109,
110
],
[
109,
111
]
] |
[
"import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n long[] a = new long[n];\n long ans = 1;\n long max = (long)Math.pow(10, 18);\n\n for(int i = 0; i < n; i++){\n a[i] = sc.nextLong();\n \n if(a[i] == 0){\n System.out.println(0);\n System.exit(0);\n }\n }\n\n for(int i = 0; i < n; i++){\n if(a[i] <= max / ans){\n ans *= a[i];\n } else {\n ans = -1;\n break;\n }\n }\n\n System.out.println(ans);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n long[] a = new long[n];\n long ans = 1;\n long max = (long)Math.pow(10, 18);\n\n for(int i = 0; i < n; i++){\n a[i] = sc.nextLong();\n \n if(a[i] == 0){\n System.out.println(0);\n System.exit(0);\n }\n }\n\n for(int i = 0; i < n; i++){\n if(a[i] <= max / ans){\n ans *= a[i];\n } else {\n ans = -1;\n break;\n }\n }\n\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n long[] a = new long[n];\n long ans = 1;\n long max = (long)Math.pow(10, 18);\n\n for(int i = 0; i < n; i++){\n a[i] = sc.nextLong();\n \n if(a[i] == 0){\n System.out.println(0);\n System.exit(0);\n }\n }\n\n for(int i = 0; i < n; i++){\n if(a[i] <= max / ans){\n ans *= a[i];\n } else {\n ans = -1;\n break;\n }\n }\n\n System.out.println(ans);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n long[] a = new long[n];\n long ans = 1;\n long max = (long)Math.pow(10, 18);\n\n for(int i = 0; i < n; i++){\n a[i] = sc.nextLong();\n \n if(a[i] == 0){\n System.out.println(0);\n System.exit(0);\n }\n }\n\n for(int i = 0; i < n; i++){\n if(a[i] <= max / ans){\n ans *= a[i];\n } else {\n ans = -1;\n break;\n }\n }\n\n System.out.println(ans);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"long ans = 1;",
"ans",
"1",
"long max = (long)Math.pow(10, 18);",
"max",
"(long)Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"for(int i = 0; i < n; i++){\n a[i] = sc.nextLong();\n \n if(a[i] == 0){\n System.out.println(0);\n System.exit(0);\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = sc.nextLong();\n \n if(a[i] == 0){\n System.out.println(0);\n System.exit(0);\n }\n }",
"{\n a[i] = sc.nextLong();\n \n if(a[i] == 0){\n System.out.println(0);\n System.exit(0);\n }\n }",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(a[i] == 0){\n System.out.println(0);\n System.exit(0);\n }",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"{\n System.out.println(0);\n System.exit(0);\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"System.exit(0)",
"System.exit",
"System",
"0",
"for(int i = 0; i < n; i++){\n if(a[i] <= max / ans){\n ans *= a[i];\n } else {\n ans = -1;\n break;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(a[i] <= max / ans){\n ans *= a[i];\n } else {\n ans = -1;\n break;\n }\n }",
"{\n if(a[i] <= max / ans){\n ans *= a[i];\n } else {\n ans = -1;\n break;\n }\n }",
"if(a[i] <= max / ans){\n ans *= a[i];\n } else {\n ans = -1;\n break;\n }",
"a[i] <= max / ans",
"a[i]",
"a",
"i",
"max / ans",
"max",
"ans",
"{\n ans *= a[i];\n }",
"ans *= a[i]",
"ans",
"a[i]",
"a",
"i",
"{\n ans = -1;\n break;\n }",
"ans = -1",
"ans",
"-1",
"1",
"break;",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n long[] a = new long[n];\n long ans = 1;\n long max = (long)Math.pow(10, 18);\n\n for(int i = 0; i < n; i++){\n a[i] = sc.nextLong();\n \n if(a[i] == 0){\n System.out.println(0);\n System.exit(0);\n }\n }\n\n for(int i = 0; i < n; i++){\n if(a[i] <= max / ans){\n ans *= a[i];\n } else {\n ans = -1;\n break;\n }\n }\n\n System.out.println(ans);\n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n long[] a = new long[n];\n long ans = 1;\n long max = (long)Math.pow(10, 18);\n\n for(int i = 0; i < n; i++){\n a[i] = sc.nextLong();\n \n if(a[i] == 0){\n System.out.println(0);\n System.exit(0);\n }\n }\n\n for(int i = 0; i < n; i++){\n if(a[i] <= max / ans){\n ans *= a[i];\n } else {\n ans = -1;\n break;\n }\n }\n\n System.out.println(ans);\n }\n}",
"Main"
] |
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long[] a = new long[n];
long ans = 1;
long max = (long)Math.pow(10, 18);
for(int i = 0; i < n; i++){
a[i] = sc.nextLong();
if(a[i] == 0){
System.out.println(0);
System.exit(0);
}
}
for(int i = 0; i < n; i++){
if(a[i] <= max / ans){
ans *= a[i];
} else {
ans = -1;
break;
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
4,
18,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
14,
40,
13,
30,
41,
13,
20,
0,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
0,
13,
17,
14,
13,
30,
4,
18,
18,
13,
13,
40,
17,
30,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
104,
8
],
[
104,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
11,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
11,
26
],
[
26,
27
],
[
26,
28
],
[
11,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
29,
34
],
[
34,
35
],
[
34,
36
],
[
29,
37
],
[
37,
38
],
[
38,
39
],
[
29,
40
],
[
41,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
45,
46
],
[
41,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
48,
51
],
[
47,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
52,
59
],
[
41,
60
],
[
60,
61
],
[
61,
62
],
[
60,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
70,
71
],
[
69,
72
],
[
41,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
74,
79
],
[
73,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
11,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
92,
93
],
[
84,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
95,
100
],
[
9,
101
],
[
101,
102
],
[
0,
103
],
[
103,
104
],
[
103,
105
]
] |
[
"import java.math.BigDecimal;\nimport java.util.*;\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n \tBigDecimal maximum = new BigDecimal(\"1000000000000000000\");\n // 整数の入力\n int N = sc.nextInt();\n boolean isbiggerthan = false;\n\t\tBigDecimal bdNum1 = new BigDecimal(sc.next());\n for(int i=1;i<N;i++){\n String s = sc.next();\n if(s.equals(\"0\")){\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n }\n if (!isbiggerthan){\n BigDecimal bdNumx = new BigDecimal(s);\n bdNum1 = bdNum1.multiply(bdNumx); \n }\n if(bdNum1.compareTo(maximum) == 1){\n isbiggerthan = true;\n }\n }\n if(isbiggerthan){\n System.out.println(-1);\n }else{\n System.out.println(bdNum1);\n \n }\n }\n}",
"import java.math.BigDecimal;",
"BigDecimal",
"java.math",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n \tBigDecimal maximum = new BigDecimal(\"1000000000000000000\");\n // 整数の入力\n int N = sc.nextInt();\n boolean isbiggerthan = false;\n\t\tBigDecimal bdNum1 = new BigDecimal(sc.next());\n for(int i=1;i<N;i++){\n String s = sc.next();\n if(s.equals(\"0\")){\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n }\n if (!isbiggerthan){\n BigDecimal bdNumx = new BigDecimal(s);\n bdNum1 = bdNum1.multiply(bdNumx); \n }\n if(bdNum1.compareTo(maximum) == 1){\n isbiggerthan = true;\n }\n }\n if(isbiggerthan){\n System.out.println(-1);\n }else{\n System.out.println(bdNum1);\n \n }\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n \tBigDecimal maximum = new BigDecimal(\"1000000000000000000\");\n // 整数の入力\n int N = sc.nextInt();\n boolean isbiggerthan = false;\n\t\tBigDecimal bdNum1 = new BigDecimal(sc.next());\n for(int i=1;i<N;i++){\n String s = sc.next();\n if(s.equals(\"0\")){\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n }\n if (!isbiggerthan){\n BigDecimal bdNumx = new BigDecimal(s);\n bdNum1 = bdNum1.multiply(bdNumx); \n }\n if(bdNum1.compareTo(maximum) == 1){\n isbiggerthan = true;\n }\n }\n if(isbiggerthan){\n System.out.println(-1);\n }else{\n System.out.println(bdNum1);\n \n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n \n \tBigDecimal maximum = new BigDecimal(\"1000000000000000000\");\n // 整数の入力\n int N = sc.nextInt();\n boolean isbiggerthan = false;\n\t\tBigDecimal bdNum1 = new BigDecimal(sc.next());\n for(int i=1;i<N;i++){\n String s = sc.next();\n if(s.equals(\"0\")){\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n }\n if (!isbiggerthan){\n BigDecimal bdNumx = new BigDecimal(s);\n bdNum1 = bdNum1.multiply(bdNumx); \n }\n if(bdNum1.compareTo(maximum) == 1){\n isbiggerthan = true;\n }\n }\n if(isbiggerthan){\n System.out.println(-1);\n }else{\n System.out.println(bdNum1);\n \n }\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"BigDecimal maximum = new BigDecimal(\"1000000000000000000\");",
"maximum",
"new BigDecimal(\"1000000000000000000\")",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"boolean isbiggerthan = false;",
"isbiggerthan",
"false",
"BigDecimal bdNum1 = new BigDecimal(sc.next());",
"bdNum1",
"new BigDecimal(sc.next())",
"for(int i=1;i<N;i++){\n String s = sc.next();\n if(s.equals(\"0\")){\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n }\n if (!isbiggerthan){\n BigDecimal bdNumx = new BigDecimal(s);\n bdNum1 = bdNum1.multiply(bdNumx); \n }\n if(bdNum1.compareTo(maximum) == 1){\n isbiggerthan = true;\n }\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n String s = sc.next();\n if(s.equals(\"0\")){\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n }\n if (!isbiggerthan){\n BigDecimal bdNumx = new BigDecimal(s);\n bdNum1 = bdNum1.multiply(bdNumx); \n }\n if(bdNum1.compareTo(maximum) == 1){\n isbiggerthan = true;\n }\n }",
"{\n String s = sc.next();\n if(s.equals(\"0\")){\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n }\n if (!isbiggerthan){\n BigDecimal bdNumx = new BigDecimal(s);\n bdNum1 = bdNum1.multiply(bdNumx); \n }\n if(bdNum1.compareTo(maximum) == 1){\n isbiggerthan = true;\n }\n }",
"String s = sc.next();",
"s",
"sc.next()",
"sc.next",
"sc",
"if(s.equals(\"0\")){\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n }",
"s.equals(\"0\")",
"s.equals",
"s",
"\"0\"",
"{\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"if (!isbiggerthan){\n BigDecimal bdNumx = new BigDecimal(s);\n bdNum1 = bdNum1.multiply(bdNumx); \n }",
"!isbiggerthan",
"isbiggerthan",
"{\n BigDecimal bdNumx = new BigDecimal(s);\n bdNum1 = bdNum1.multiply(bdNumx); \n }",
"BigDecimal bdNumx = new BigDecimal(s);",
"bdNumx",
"new BigDecimal(s)",
"bdNum1 = bdNum1.multiply(bdNumx)",
"bdNum1",
"bdNum1.multiply(bdNumx)",
"bdNum1.multiply",
"bdNum1",
"bdNumx",
"if(bdNum1.compareTo(maximum) == 1){\n isbiggerthan = true;\n }",
"bdNum1.compareTo(maximum) == 1",
"bdNum1.compareTo(maximum)",
"bdNum1.compareTo",
"bdNum1",
"maximum",
"1",
"{\n isbiggerthan = true;\n }",
"isbiggerthan = true",
"isbiggerthan",
"true",
"if(isbiggerthan){\n System.out.println(-1);\n }else{\n System.out.println(bdNum1);\n \n }",
"isbiggerthan",
"{\n System.out.println(-1);\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"{\n System.out.println(bdNum1);\n \n }",
"System.out.println(bdNum1)",
"System.out.println",
"System.out",
"System",
"System.out",
"bdNum1",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n \tBigDecimal maximum = new BigDecimal(\"1000000000000000000\");\n // 整数の入力\n int N = sc.nextInt();\n boolean isbiggerthan = false;\n\t\tBigDecimal bdNum1 = new BigDecimal(sc.next());\n for(int i=1;i<N;i++){\n String s = sc.next();\n if(s.equals(\"0\")){\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n }\n if (!isbiggerthan){\n BigDecimal bdNumx = new BigDecimal(s);\n bdNum1 = bdNum1.multiply(bdNumx); \n }\n if(bdNum1.compareTo(maximum) == 1){\n isbiggerthan = true;\n }\n }\n if(isbiggerthan){\n System.out.println(-1);\n }else{\n System.out.println(bdNum1);\n \n }\n }\n}",
"public class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n \tBigDecimal maximum = new BigDecimal(\"1000000000000000000\");\n // 整数の入力\n int N = sc.nextInt();\n boolean isbiggerthan = false;\n\t\tBigDecimal bdNum1 = new BigDecimal(sc.next());\n for(int i=1;i<N;i++){\n String s = sc.next();\n if(s.equals(\"0\")){\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n }\n if (!isbiggerthan){\n BigDecimal bdNumx = new BigDecimal(s);\n bdNum1 = bdNum1.multiply(bdNumx); \n }\n if(bdNum1.compareTo(maximum) == 1){\n isbiggerthan = true;\n }\n }\n if(isbiggerthan){\n System.out.println(-1);\n }else{\n System.out.println(bdNum1);\n \n }\n }\n}",
"Main"
] |
import java.math.BigDecimal;
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
BigDecimal maximum = new BigDecimal("1000000000000000000");
// 整数の入力
int N = sc.nextInt();
boolean isbiggerthan = false;
BigDecimal bdNum1 = new BigDecimal(sc.next());
for(int i=1;i<N;i++){
String s = sc.next();
if(s.equals("0")){
System.out.println(0);
return;
}
if (!isbiggerthan){
BigDecimal bdNumx = new BigDecimal(s);
bdNum1 = bdNum1.multiply(bdNumx);
}
if(bdNum1.compareTo(maximum) == 1){
isbiggerthan = true;
}
}
if(isbiggerthan){
System.out.println(-1);
}else{
System.out.println(bdNum1);
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
41,
13,
17,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
14,
2,
2,
13,
18,
13,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
0,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
115,
5
],
[
115,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
14,
17
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
41,
44
],
[
44,
45
],
[
45,
46
],
[
8,
47
],
[
47,
48
],
[
47,
49
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
50,
53
],
[
8,
54
],
[
54,
55
],
[
54,
56
],
[
8,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
57,
62
],
[
62,
63
],
[
62,
64
],
[
57,
65
],
[
65,
66
],
[
66,
67
],
[
57,
68
],
[
69,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
70,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
76,
83
],
[
69,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
85,
91
],
[
84,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
98,
99
],
[
92,
100
],
[
69,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
103,
105
],
[
8,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
6,
112
],
[
112,
113
],
[
0,
114
],
[
114,
115
],
[
114,
116
]
] |
[
"import java.util.*;\npublic class Main{\n \n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n int n = Integer.parseInt(sc.next());\n long[] a = new long[n];\n for(int i=0; i<n; i++){\n a[i] = Long.parseLong(sc.next());\n }\n \n long z = (long)1e18;\n \n Arrays.sort(a);\n long ans = 1;\n for(int i=0; i<n; i++){\n if(a[i]==0){\n System.out.println(0);\n return;\n }\n if(z/a[i]<ans){\n System.out.println(-1);\n return;\n }\n ans *= a[i];\n }\n \n \n System.out.println(ans);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n \n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n int n = Integer.parseInt(sc.next());\n long[] a = new long[n];\n for(int i=0; i<n; i++){\n a[i] = Long.parseLong(sc.next());\n }\n \n long z = (long)1e18;\n \n Arrays.sort(a);\n long ans = 1;\n for(int i=0; i<n; i++){\n if(a[i]==0){\n System.out.println(0);\n return;\n }\n if(z/a[i]<ans){\n System.out.println(-1);\n return;\n }\n ans *= a[i];\n }\n \n \n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n int n = Integer.parseInt(sc.next());\n long[] a = new long[n];\n for(int i=0; i<n; i++){\n a[i] = Long.parseLong(sc.next());\n }\n \n long z = (long)1e18;\n \n Arrays.sort(a);\n long ans = 1;\n for(int i=0; i<n; i++){\n if(a[i]==0){\n System.out.println(0);\n return;\n }\n if(z/a[i]<ans){\n System.out.println(-1);\n return;\n }\n ans *= a[i];\n }\n \n \n System.out.println(ans);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n \n int n = Integer.parseInt(sc.next());\n long[] a = new long[n];\n for(int i=0; i<n; i++){\n a[i] = Long.parseLong(sc.next());\n }\n \n long z = (long)1e18;\n \n Arrays.sort(a);\n long ans = 1;\n for(int i=0; i<n; i++){\n if(a[i]==0){\n System.out.println(0);\n return;\n }\n if(z/a[i]<ans){\n System.out.println(-1);\n return;\n }\n ans *= a[i];\n }\n \n \n System.out.println(ans);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = Integer.parseInt(sc.next());",
"n",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for(int i=0; i<n; i++){\n a[i] = Long.parseLong(sc.next());\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = Long.parseLong(sc.next());\n }",
"{\n a[i] = Long.parseLong(sc.next());\n }",
"a[i] = Long.parseLong(sc.next())",
"a[i]",
"a",
"i",
"Long.parseLong(sc.next())",
"Long.parseLong",
"Long",
"sc.next()",
"sc.next",
"sc",
"long z = (long)1e18;",
"z",
"(long)1e18",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"long ans = 1;",
"ans",
"1",
"for(int i=0; i<n; i++){\n if(a[i]==0){\n System.out.println(0);\n return;\n }\n if(z/a[i]<ans){\n System.out.println(-1);\n return;\n }\n ans *= a[i];\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(a[i]==0){\n System.out.println(0);\n return;\n }\n if(z/a[i]<ans){\n System.out.println(-1);\n return;\n }\n ans *= a[i];\n }",
"{\n if(a[i]==0){\n System.out.println(0);\n return;\n }\n if(z/a[i]<ans){\n System.out.println(-1);\n return;\n }\n ans *= a[i];\n }",
"if(a[i]==0){\n System.out.println(0);\n return;\n }",
"a[i]==0",
"a[i]",
"a",
"i",
"0",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"if(z/a[i]<ans){\n System.out.println(-1);\n return;\n }",
"z/a[i]<ans",
"z/a[i]",
"z",
"a[i]",
"a",
"i",
"ans",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"ans *= a[i]",
"ans",
"a[i]",
"a",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main{\n \n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n int n = Integer.parseInt(sc.next());\n long[] a = new long[n];\n for(int i=0; i<n; i++){\n a[i] = Long.parseLong(sc.next());\n }\n \n long z = (long)1e18;\n \n Arrays.sort(a);\n long ans = 1;\n for(int i=0; i<n; i++){\n if(a[i]==0){\n System.out.println(0);\n return;\n }\n if(z/a[i]<ans){\n System.out.println(-1);\n return;\n }\n ans *= a[i];\n }\n \n \n System.out.println(ans);\n }\n}",
"public class Main{\n \n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n int n = Integer.parseInt(sc.next());\n long[] a = new long[n];\n for(int i=0; i<n; i++){\n a[i] = Long.parseLong(sc.next());\n }\n \n long z = (long)1e18;\n \n Arrays.sort(a);\n long ans = 1;\n for(int i=0; i<n; i++){\n if(a[i]==0){\n System.out.println(0);\n return;\n }\n if(z/a[i]<ans){\n System.out.println(-1);\n return;\n }\n ans *= a[i];\n }\n \n \n System.out.println(ans);\n }\n}",
"Main"
] |
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.next());
long[] a = new long[n];
for(int i=0; i<n; i++){
a[i] = Long.parseLong(sc.next());
}
long z = (long)1e18;
Arrays.sort(a);
long ans = 1;
for(int i=0; i<n; i++){
if(a[i]==0){
System.out.println(0);
return;
}
if(z/a[i]<ans){
System.out.println(-1);
return;
}
ans *= a[i];
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
4,
18,
13,
17,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
0,
13,
17,
3,
14,
2,
18,
13,
13,
2,
13,
13,
30,
0,
13,
40,
17,
30,
0,
13,
2,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
105,
5
],
[
105,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
23,
26
],
[
23,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
8,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
36,
37
],
[
36,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
31,
42
],
[
43,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
48,
49
],
[
49,
50
],
[
8,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
56,
57
],
[
56,
58
],
[
51,
59
],
[
59,
60
],
[
60,
61
],
[
51,
62
],
[
63,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
64,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
74
],
[
64,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
80,
81
],
[
80,
82
],
[
75,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
75,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
8,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
6,
102
],
[
102,
103
],
[
0,
104
],
[
104,
105
],
[
104,
106
]
] |
[
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\t\n\t\t\n\t\tint input = in.nextInt();\n\t\tlong[] a = new long[input];\n\t\tlong max = (long)Math.pow(10, 18);\n\t\tlong ans = 1;\n\t\tfor(int i = 0;i<input;i++) {\n\t\t\ta[i] = in.nextLong();\n\t\t}\n\t\tfor(int i = 0;i<input;i++) {\n\t\tif(a[i] == 0) {\n\t\t\tans = 0;\n\t\t\tbreak;\n\t\t}\n\t\telse if(a[i]>(max/ans)) {\n\t\t\tans = -1;\n\t\t}\n\t\telse {\n\t\t\tans = ans * a[i];\n\t\t}\n\t\t\n\t\t\n\t}\n\t\tSystem.out.println(ans);\n\n \n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\t\n\t\t\n\t\tint input = in.nextInt();\n\t\tlong[] a = new long[input];\n\t\tlong max = (long)Math.pow(10, 18);\n\t\tlong ans = 1;\n\t\tfor(int i = 0;i<input;i++) {\n\t\t\ta[i] = in.nextLong();\n\t\t}\n\t\tfor(int i = 0;i<input;i++) {\n\t\tif(a[i] == 0) {\n\t\t\tans = 0;\n\t\t\tbreak;\n\t\t}\n\t\telse if(a[i]>(max/ans)) {\n\t\t\tans = -1;\n\t\t}\n\t\telse {\n\t\t\tans = ans * a[i];\n\t\t}\n\t\t\n\t\t\n\t}\n\t\tSystem.out.println(ans);\n\n \n }\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\t\n\t\t\n\t\tint input = in.nextInt();\n\t\tlong[] a = new long[input];\n\t\tlong max = (long)Math.pow(10, 18);\n\t\tlong ans = 1;\n\t\tfor(int i = 0;i<input;i++) {\n\t\t\ta[i] = in.nextLong();\n\t\t}\n\t\tfor(int i = 0;i<input;i++) {\n\t\tif(a[i] == 0) {\n\t\t\tans = 0;\n\t\t\tbreak;\n\t\t}\n\t\telse if(a[i]>(max/ans)) {\n\t\t\tans = -1;\n\t\t}\n\t\telse {\n\t\t\tans = ans * a[i];\n\t\t}\n\t\t\n\t\t\n\t}\n\t\tSystem.out.println(ans);\n\n \n }",
"main",
"{\n\t\tScanner in = new Scanner(System.in);\n\t\t\n\t\t\n\t\tint input = in.nextInt();\n\t\tlong[] a = new long[input];\n\t\tlong max = (long)Math.pow(10, 18);\n\t\tlong ans = 1;\n\t\tfor(int i = 0;i<input;i++) {\n\t\t\ta[i] = in.nextLong();\n\t\t}\n\t\tfor(int i = 0;i<input;i++) {\n\t\tif(a[i] == 0) {\n\t\t\tans = 0;\n\t\t\tbreak;\n\t\t}\n\t\telse if(a[i]>(max/ans)) {\n\t\t\tans = -1;\n\t\t}\n\t\telse {\n\t\t\tans = ans * a[i];\n\t\t}\n\t\t\n\t\t\n\t}\n\t\tSystem.out.println(ans);\n\n \n }",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int input = in.nextInt();",
"input",
"in.nextInt()",
"in.nextInt",
"in",
"long[] a = new long[input];",
"a",
"new long[input]",
"input",
"long max = (long)Math.pow(10, 18);",
"max",
"(long)Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"long ans = 1;",
"ans",
"1",
"for(int i = 0;i<input;i++) {\n\t\t\ta[i] = in.nextLong();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<input",
"i",
"input",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = in.nextLong();\n\t\t}",
"{\n\t\t\ta[i] = in.nextLong();\n\t\t}",
"a[i] = in.nextLong()",
"a[i]",
"a",
"i",
"in.nextLong()",
"in.nextLong",
"in",
"for(int i = 0;i<input;i++) {\n\t\tif(a[i] == 0) {\n\t\t\tans = 0;\n\t\t\tbreak;\n\t\t}\n\t\telse if(a[i]>(max/ans)) {\n\t\t\tans = -1;\n\t\t}\n\t\telse {\n\t\t\tans = ans * a[i];\n\t\t}\n\t\t\n\t\t\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<input",
"i",
"input",
"i++",
"i++",
"i",
"{\n\t\tif(a[i] == 0) {\n\t\t\tans = 0;\n\t\t\tbreak;\n\t\t}\n\t\telse if(a[i]>(max/ans)) {\n\t\t\tans = -1;\n\t\t}\n\t\telse {\n\t\t\tans = ans * a[i];\n\t\t}\n\t\t\n\t\t\n\t}",
"{\n\t\tif(a[i] == 0) {\n\t\t\tans = 0;\n\t\t\tbreak;\n\t\t}\n\t\telse if(a[i]>(max/ans)) {\n\t\t\tans = -1;\n\t\t}\n\t\telse {\n\t\t\tans = ans * a[i];\n\t\t}\n\t\t\n\t\t\n\t}",
"if(a[i] == 0) {\n\t\t\tans = 0;\n\t\t\tbreak;\n\t\t}\n\t\telse if(a[i]>(max/ans)) {\n\t\t\tans = -1;\n\t\t}\n\t\telse {\n\t\t\tans = ans * a[i];\n\t\t}",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"{\n\t\t\tans = 0;\n\t\t\tbreak;\n\t\t}",
"ans = 0",
"ans",
"0",
"break;",
"if(a[i]>(max/ans)) {\n\t\t\tans = -1;\n\t\t}\n\t\telse {\n\t\t\tans = ans * a[i];\n\t\t}",
"a[i]>(max/ans)",
"a[i]",
"a",
"i",
"(max/ans)",
"max",
"ans",
"{\n\t\t\tans = -1;\n\t\t}",
"ans = -1",
"ans",
"-1",
"1",
"{\n\t\t\tans = ans * a[i];\n\t\t}",
"ans = ans * a[i]",
"ans",
"ans * a[i]",
"ans",
"a[i]",
"a",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\t\n\t\t\n\t\tint input = in.nextInt();\n\t\tlong[] a = new long[input];\n\t\tlong max = (long)Math.pow(10, 18);\n\t\tlong ans = 1;\n\t\tfor(int i = 0;i<input;i++) {\n\t\t\ta[i] = in.nextLong();\n\t\t}\n\t\tfor(int i = 0;i<input;i++) {\n\t\tif(a[i] == 0) {\n\t\t\tans = 0;\n\t\t\tbreak;\n\t\t}\n\t\telse if(a[i]>(max/ans)) {\n\t\t\tans = -1;\n\t\t}\n\t\telse {\n\t\t\tans = ans * a[i];\n\t\t}\n\t\t\n\t\t\n\t}\n\t\tSystem.out.println(ans);\n\n \n }\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\t\n\t\t\n\t\tint input = in.nextInt();\n\t\tlong[] a = new long[input];\n\t\tlong max = (long)Math.pow(10, 18);\n\t\tlong ans = 1;\n\t\tfor(int i = 0;i<input;i++) {\n\t\t\ta[i] = in.nextLong();\n\t\t}\n\t\tfor(int i = 0;i<input;i++) {\n\t\tif(a[i] == 0) {\n\t\t\tans = 0;\n\t\t\tbreak;\n\t\t}\n\t\telse if(a[i]>(max/ans)) {\n\t\t\tans = -1;\n\t\t}\n\t\telse {\n\t\t\tans = ans * a[i];\n\t\t}\n\t\t\n\t\t\n\t}\n\t\tSystem.out.println(ans);\n\n \n }\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int input = in.nextInt();
long[] a = new long[input];
long max = (long)Math.pow(10, 18);
long ans = 1;
for(int i = 0;i<input;i++) {
a[i] = in.nextLong();
}
for(int i = 0;i<input;i++) {
if(a[i] == 0) {
ans = 0;
break;
}
else if(a[i]>(max/ans)) {
ans = -1;
}
else {
ans = ans * a[i];
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
17,
41,
13,
4,
18,
13,
17,
4,
18,
13,
13,
28,
13,
13,
30,
30,
14,
4,
18,
17,
13,
30,
4,
18,
13,
17,
4,
18,
13,
29,
14,
2,
13,
2,
13,
4,
18,
13,
13,
30,
4,
18,
13,
40,
17,
4,
18,
13,
29,
0,
13,
4,
18,
13,
13,
4,
18,
13,
13,
4,
18,
13,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
116,
17
],
[
116,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
20,
24
],
[
24,
25
],
[
24,
26
],
[
20,
27
],
[
27,
28
],
[
27,
29
],
[
20,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
32,
35
],
[
35,
36
],
[
36,
37
],
[
20,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
40,
45
],
[
20,
46
],
[
46,
47
],
[
46,
48
],
[
20,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
52,
53
],
[
51,
54
],
[
20,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
20,
59
],
[
59,
60
],
[
59,
61
],
[
59,
62
],
[
63,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
65,
68
],
[
64,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
70,
73
],
[
69,
74
],
[
74,
75
],
[
75,
76
],
[
69,
77
],
[
63,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
84,
85
],
[
83,
86
],
[
78,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
88,
91
],
[
91,
92
],
[
87,
93
],
[
93,
94
],
[
94,
95
],
[
87,
96
],
[
63,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
20,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
20,
107
],
[
107,
108
],
[
108,
109
],
[
20,
110
],
[
110,
111
],
[
111,
112
],
[
18,
113
],
[
113,
114
],
[
0,
115
],
[
115,
116
],
[
115,
117
]
] |
[
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class Main {\n \n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(System.out);\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int N = Integer.parseInt(st.nextToken());\n String[] str_array = br.readLine().split(\" \");\n\n long ans = 1;\n long cut = Long.parseLong(\"1000000000000000000\");\n\n Arrays.sort(str_array);\n\n for(String str : str_array) {\n\n if(\"0\".equals(str)) {\n pw.println(0);\n pw.close();\n return;\n }\n\n if(ans > cut / Long.parseLong(str)) {\n pw.println(-1);\n pw.close();\n return;\n }\n ans *= Long.parseLong(str);\n }\n\n pw.println(ans);\n br.close();\n pw.close();\n }\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"public class Main {\n \n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(System.out);\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int N = Integer.parseInt(st.nextToken());\n String[] str_array = br.readLine().split(\" \");\n\n long ans = 1;\n long cut = Long.parseLong(\"1000000000000000000\");\n\n Arrays.sort(str_array);\n\n for(String str : str_array) {\n\n if(\"0\".equals(str)) {\n pw.println(0);\n pw.close();\n return;\n }\n\n if(ans > cut / Long.parseLong(str)) {\n pw.println(-1);\n pw.close();\n return;\n }\n ans *= Long.parseLong(str);\n }\n\n pw.println(ans);\n br.close();\n pw.close();\n }\n}",
"Main",
"public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(System.out);\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int N = Integer.parseInt(st.nextToken());\n String[] str_array = br.readLine().split(\" \");\n\n long ans = 1;\n long cut = Long.parseLong(\"1000000000000000000\");\n\n Arrays.sort(str_array);\n\n for(String str : str_array) {\n\n if(\"0\".equals(str)) {\n pw.println(0);\n pw.close();\n return;\n }\n\n if(ans > cut / Long.parseLong(str)) {\n pw.println(-1);\n pw.close();\n return;\n }\n ans *= Long.parseLong(str);\n }\n\n pw.println(ans);\n br.close();\n pw.close();\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(System.out);\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int N = Integer.parseInt(st.nextToken());\n String[] str_array = br.readLine().split(\" \");\n\n long ans = 1;\n long cut = Long.parseLong(\"1000000000000000000\");\n\n Arrays.sort(str_array);\n\n for(String str : str_array) {\n\n if(\"0\".equals(str)) {\n pw.println(0);\n pw.close();\n return;\n }\n\n if(ans > cut / Long.parseLong(str)) {\n pw.println(-1);\n pw.close();\n return;\n }\n ans *= Long.parseLong(str);\n }\n\n pw.println(ans);\n br.close();\n pw.close();\n }",
"BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));",
"br",
"new BufferedReader(new java.io.InputStreamReader(System.in))",
"PrintWriter pw = new PrintWriter(System.out);",
"pw",
"new PrintWriter(System.out)",
"StringTokenizer st = new StringTokenizer(br.readLine());",
"st",
"new StringTokenizer(br.readLine())",
"int N = Integer.parseInt(st.nextToken());",
"N",
"Integer.parseInt(st.nextToken())",
"Integer.parseInt",
"Integer",
"st.nextToken()",
"st.nextToken",
"st",
"String[] str_array = br.readLine().split(\" \");",
"str_array",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"long ans = 1;",
"ans",
"1",
"long cut = Long.parseLong(\"1000000000000000000\");",
"cut",
"Long.parseLong(\"1000000000000000000\")",
"Long.parseLong",
"Long",
"\"1000000000000000000\"",
"Arrays.sort(str_array)",
"Arrays.sort",
"Arrays",
"str_array",
"for(String str : str_array) {\n\n if(\"0\".equals(str)) {\n pw.println(0);\n pw.close();\n return;\n }\n\n if(ans > cut / Long.parseLong(str)) {\n pw.println(-1);\n pw.close();\n return;\n }\n ans *= Long.parseLong(str);\n }",
"String str",
"str_array",
"{\n\n if(\"0\".equals(str)) {\n pw.println(0);\n pw.close();\n return;\n }\n\n if(ans > cut / Long.parseLong(str)) {\n pw.println(-1);\n pw.close();\n return;\n }\n ans *= Long.parseLong(str);\n }",
"{\n\n if(\"0\".equals(str)) {\n pw.println(0);\n pw.close();\n return;\n }\n\n if(ans > cut / Long.parseLong(str)) {\n pw.println(-1);\n pw.close();\n return;\n }\n ans *= Long.parseLong(str);\n }",
"if(\"0\".equals(str)) {\n pw.println(0);\n pw.close();\n return;\n }",
"\"0\".equals(str)",
"\"0\".equals",
"\"0\"",
"str",
"{\n pw.println(0);\n pw.close();\n return;\n }",
"pw.println(0)",
"pw.println",
"pw",
"0",
"pw.close()",
"pw.close",
"pw",
"return;",
"if(ans > cut / Long.parseLong(str)) {\n pw.println(-1);\n pw.close();\n return;\n }",
"ans > cut / Long.parseLong(str)",
"ans",
"cut / Long.parseLong(str)",
"cut",
"Long.parseLong(str)",
"Long.parseLong",
"Long",
"str",
"{\n pw.println(-1);\n pw.close();\n return;\n }",
"pw.println(-1)",
"pw.println",
"pw",
"-1",
"1",
"pw.close()",
"pw.close",
"pw",
"return;",
"ans *= Long.parseLong(str)",
"ans",
"Long.parseLong(str)",
"Long.parseLong",
"Long",
"str",
"pw.println(ans)",
"pw.println",
"pw",
"ans",
"br.close()",
"br.close",
"br",
"pw.close()",
"pw.close",
"pw",
"String[] args",
"args",
"public class Main {\n \n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(System.out);\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int N = Integer.parseInt(st.nextToken());\n String[] str_array = br.readLine().split(\" \");\n\n long ans = 1;\n long cut = Long.parseLong(\"1000000000000000000\");\n\n Arrays.sort(str_array);\n\n for(String str : str_array) {\n\n if(\"0\".equals(str)) {\n pw.println(0);\n pw.close();\n return;\n }\n\n if(ans > cut / Long.parseLong(str)) {\n pw.println(-1);\n pw.close();\n return;\n }\n ans *= Long.parseLong(str);\n }\n\n pw.println(ans);\n br.close();\n pw.close();\n }\n}",
"public class Main {\n \n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(System.out);\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int N = Integer.parseInt(st.nextToken());\n String[] str_array = br.readLine().split(\" \");\n\n long ans = 1;\n long cut = Long.parseLong(\"1000000000000000000\");\n\n Arrays.sort(str_array);\n\n for(String str : str_array) {\n\n if(\"0\".equals(str)) {\n pw.println(0);\n pw.close();\n return;\n }\n\n if(ans > cut / Long.parseLong(str)) {\n pw.println(-1);\n pw.close();\n return;\n }\n ans *= Long.parseLong(str);\n }\n\n pw.println(ans);\n br.close();\n pw.close();\n }\n}",
"Main"
] |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
StringTokenizer st = new StringTokenizer(br.readLine());
int N = Integer.parseInt(st.nextToken());
String[] str_array = br.readLine().split(" ");
long ans = 1;
long cut = Long.parseLong("1000000000000000000");
Arrays.sort(str_array);
for(String str : str_array) {
if("0".equals(str)) {
pw.println(0);
pw.close();
return;
}
if(ans > cut / Long.parseLong(str)) {
pw.println(-1);
pw.close();
return;
}
ans *= Long.parseLong(str);
}
pw.println(ans);
br.close();
pw.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
14,
2,
18,
13,
17,
17,
30,
4,
18,
18,
13,
13,
17,
30,
41,
13,
18,
13,
13,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
4,
18,
13,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
0,
13,
20,
3,
4,
18,
18,
13,
13,
13,
23,
13,
6,
13,
41,
13,
17,
41,
13,
17,
12,
13,
30,
0,
13,
20,
0,
13,
17,
23,
13,
12,
13,
30,
14,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
37,
20,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
14,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
37,
20,
30,
29,
4,
18,
13,
29,
4,
18,
13,
17,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
292,
23
],
[
292,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
26,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
26,
35
],
[
35,
36
],
[
35,
37
],
[
26,
38
],
[
38,
39
],
[
38,
40
],
[
26,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
42,
47
],
[
47,
48
],
[
47,
49
],
[
42,
50
],
[
50,
51
],
[
51,
52
],
[
42,
53
],
[
54,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
55,
59
],
[
59,
60
],
[
60,
61
],
[
26,
62
],
[
62,
63
],
[
63,
64
],
[
62,
65
],
[
26,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
66,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
66,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
79,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
85,
92
],
[
92,
93
],
[
92,
94
],
[
85,
95
],
[
95,
96
],
[
96,
97
],
[
85,
98
],
[
99,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
103,
104
],
[
102,
105
],
[
105,
106
],
[
106,
107
],
[
105,
108
],
[
108,
109
],
[
108,
110
],
[
99,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
113,
116
],
[
112,
117
],
[
111,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
79,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
24,
129
],
[
129,
130
],
[
292,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
136,
137
],
[
136,
138
],
[
131,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
145,
146
],
[
145,
147
],
[
139,
148
],
[
148,
149
],
[
131,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
153,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
166,
167
],
[
167,
168
],
[
163,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
152,
173
],
[
173,
174
],
[
174,
175
],
[
175,
176
],
[
131,
177
],
[
177,
178
],
[
177,
179
],
[
179,
180
],
[
180,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
181,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
180,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
194,
195
],
[
190,
196
],
[
196,
197
],
[
197,
198
],
[
198,
199
],
[
199,
200
],
[
179,
201
],
[
201,
202
],
[
202,
203
],
[
203,
204
],
[
202,
205
],
[
131,
206
],
[
206,
207
],
[
206,
208
],
[
208,
209
],
[
209,
210
],
[
210,
211
],
[
211,
212
],
[
210,
213
],
[
213,
214
],
[
131,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
218,
219
],
[
219,
220
],
[
220,
221
],
[
219,
222
],
[
222,
223
],
[
131,
224
],
[
224,
225
],
[
224,
226
],
[
226,
227
],
[
227,
228
],
[
228,
229
],
[
229,
230
],
[
228,
231
],
[
231,
232
],
[
131,
233
],
[
233,
234
],
[
233,
235
],
[
235,
236
],
[
236,
237
],
[
236,
238
],
[
235,
240
],
[
240,
241
],
[
241,
242
],
[
242,
243
],
[
242,
244
],
[
240,
245
],
[
245,
246
],
[
245,
247
],
[
240,
248
],
[
248,
249
],
[
249,
250
],
[
240,
251
],
[
251,
252
],
[
252,
253
],
[
253,
254
],
[
253,
255
],
[
252,
256
],
[
256,
257
],
[
235,
258
],
[
258,
259
],
[
233,
260
],
[
260,
261
],
[
131,
262
],
[
262,
263
],
[
262,
264
],
[
264,
265
],
[
265,
266
],
[
265,
267
],
[
264,
269
],
[
269,
270
],
[
270,
271
],
[
271,
272
],
[
271,
273
],
[
269,
274
],
[
274,
275
],
[
274,
276
],
[
269,
277
],
[
277,
278
],
[
278,
279
],
[
269,
280
],
[
280,
281
],
[
281,
282
],
[
282,
283
],
[
282,
284
],
[
281,
285
],
[
285,
286
],
[
264,
287
],
[
287,
288
],
[
262,
289
],
[
289,
290
],
[
0,
291
],
[
291,
292
],
[
291,
293
]
] |
[
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger max = new BigInteger(\"1000000000000000000\");\n\t\tlong[] a = new long[n];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\tArrays.sort(a);\n\t\tif(a[0] == 0) {\n\t\t\tSystem.out.println(0);\n\t\t}else {\n\t\t\tBigInteger ans = BigInteger.ONE;\n\t\t\tfor(int i = n-1; i >= 0; i--) {\n\t\t\t\tans = ans.multiply(BigInteger.valueOf(a[i]));\n\t\t\t\tif(ans.compareTo(max) == 1) {\n\t\t\t\t\tans = new BigInteger(\"-1\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t\t\n\t}\n\t\n\tstatic class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t private StringTokenizer tokenizer = null;\n\t public FastScanner(InputStream in) {\n\t reader = new BufferedReader(new InputStreamReader(in));\n\t tokenizer = null;\n\t }\n\n\t public String next() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\t return tokenizer.nextToken();\n\t }\n\n\t public String nextLine() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\n\t return tokenizer.nextToken(\"\\n\");\n\t }\n\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\n\t public int nextInt() {\n\t return Integer.parseInt(next());\n\t }\n\n\t public double nextDouble() {\n\t return Double.parseDouble(next());\n\t }\n\n\t public int[] nextIntArray(int n) {\n\t int[] a = new int[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextInt();\n\t return a;\n\t }\n\n\t public long[] nextLongArray(int n) {\n\t long[] a = new long[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextLong();\n\t return a;\n\t }\n\t}\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger max = new BigInteger(\"1000000000000000000\");\n\t\tlong[] a = new long[n];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\tArrays.sort(a);\n\t\tif(a[0] == 0) {\n\t\t\tSystem.out.println(0);\n\t\t}else {\n\t\t\tBigInteger ans = BigInteger.ONE;\n\t\t\tfor(int i = n-1; i >= 0; i--) {\n\t\t\t\tans = ans.multiply(BigInteger.valueOf(a[i]));\n\t\t\t\tif(ans.compareTo(max) == 1) {\n\t\t\t\t\tans = new BigInteger(\"-1\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t\t\n\t}\n\t\n\tstatic class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t private StringTokenizer tokenizer = null;\n\t public FastScanner(InputStream in) {\n\t reader = new BufferedReader(new InputStreamReader(in));\n\t tokenizer = null;\n\t }\n\n\t public String next() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\t return tokenizer.nextToken();\n\t }\n\n\t public String nextLine() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\n\t return tokenizer.nextToken(\"\\n\");\n\t }\n\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\n\t public int nextInt() {\n\t return Integer.parseInt(next());\n\t }\n\n\t public double nextDouble() {\n\t return Double.parseDouble(next());\n\t }\n\n\t public int[] nextIntArray(int n) {\n\t int[] a = new int[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextInt();\n\t return a;\n\t }\n\n\t public long[] nextLongArray(int n) {\n\t long[] a = new long[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextLong();\n\t return a;\n\t }\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger max = new BigInteger(\"1000000000000000000\");\n\t\tlong[] a = new long[n];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\tArrays.sort(a);\n\t\tif(a[0] == 0) {\n\t\t\tSystem.out.println(0);\n\t\t}else {\n\t\t\tBigInteger ans = BigInteger.ONE;\n\t\t\tfor(int i = n-1; i >= 0; i--) {\n\t\t\t\tans = ans.multiply(BigInteger.valueOf(a[i]));\n\t\t\t\tif(ans.compareTo(max) == 1) {\n\t\t\t\t\tans = new BigInteger(\"-1\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t\t\n\t}",
"main",
"{\n\t\tFastScanner sc = new FastScanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger max = new BigInteger(\"1000000000000000000\");\n\t\tlong[] a = new long[n];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\tArrays.sort(a);\n\t\tif(a[0] == 0) {\n\t\t\tSystem.out.println(0);\n\t\t}else {\n\t\t\tBigInteger ans = BigInteger.ONE;\n\t\t\tfor(int i = n-1; i >= 0; i--) {\n\t\t\t\tans = ans.multiply(BigInteger.valueOf(a[i]));\n\t\t\t\tif(ans.compareTo(max) == 1) {\n\t\t\t\t\tans = new BigInteger(\"-1\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t\t\n\t}",
"FastScanner sc = new FastScanner(System.in);",
"sc",
"new FastScanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BigInteger max = new BigInteger(\"1000000000000000000\");",
"max",
"new BigInteger(\"1000000000000000000\")",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = sc.nextLong();\n\t\t}",
"{\n\t\t\ta[i] = sc.nextLong();\n\t\t}",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"if(a[0] == 0) {\n\t\t\tSystem.out.println(0);\n\t\t}else {\n\t\t\tBigInteger ans = BigInteger.ONE;\n\t\t\tfor(int i = n-1; i >= 0; i--) {\n\t\t\t\tans = ans.multiply(BigInteger.valueOf(a[i]));\n\t\t\t\tif(ans.compareTo(max) == 1) {\n\t\t\t\t\tans = new BigInteger(\"-1\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}",
"a[0] == 0",
"a[0]",
"a",
"0",
"0",
"{\n\t\t\tSystem.out.println(0);\n\t\t}",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"{\n\t\t\tBigInteger ans = BigInteger.ONE;\n\t\t\tfor(int i = n-1; i >= 0; i--) {\n\t\t\t\tans = ans.multiply(BigInteger.valueOf(a[i]));\n\t\t\t\tif(ans.compareTo(max) == 1) {\n\t\t\t\t\tans = new BigInteger(\"-1\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}",
"BigInteger ans = BigInteger.ONE;",
"ans",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"for(int i = n-1; i >= 0; i--) {\n\t\t\t\tans = ans.multiply(BigInteger.valueOf(a[i]));\n\t\t\t\tif(ans.compareTo(max) == 1) {\n\t\t\t\t\tans = new BigInteger(\"-1\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"int i = n-1;",
"int i = n-1;",
"i",
"n-1",
"n",
"1",
"i >= 0",
"i",
"0",
"i--",
"i--",
"i",
"{\n\t\t\t\tans = ans.multiply(BigInteger.valueOf(a[i]));\n\t\t\t\tif(ans.compareTo(max) == 1) {\n\t\t\t\t\tans = new BigInteger(\"-1\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tans = ans.multiply(BigInteger.valueOf(a[i]));\n\t\t\t\tif(ans.compareTo(max) == 1) {\n\t\t\t\t\tans = new BigInteger(\"-1\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"ans = ans.multiply(BigInteger.valueOf(a[i]))",
"ans",
"ans.multiply(BigInteger.valueOf(a[i]))",
"ans.multiply",
"ans",
"BigInteger.valueOf(a[i])",
"BigInteger.valueOf",
"BigInteger",
"a[i]",
"a",
"i",
"if(ans.compareTo(max) == 1) {\n\t\t\t\t\tans = new BigInteger(\"-1\");\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"ans.compareTo(max) == 1",
"ans.compareTo(max)",
"ans.compareTo",
"ans",
"max",
"1",
"{\n\t\t\t\t\tans = new BigInteger(\"-1\");\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"ans = new BigInteger(\"-1\")",
"ans",
"new BigInteger(\"-1\")",
"break;",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"static class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t private StringTokenizer tokenizer = null;\n\t public FastScanner(InputStream in) {\n\t reader = new BufferedReader(new InputStreamReader(in));\n\t tokenizer = null;\n\t }\n\n\t public String next() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\t return tokenizer.nextToken();\n\t }\n\n\t public String nextLine() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\n\t return tokenizer.nextToken(\"\\n\");\n\t }\n\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\n\t public int nextInt() {\n\t return Integer.parseInt(next());\n\t }\n\n\t public double nextDouble() {\n\t return Double.parseDouble(next());\n\t }\n\n\t public int[] nextIntArray(int n) {\n\t int[] a = new int[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextInt();\n\t return a;\n\t }\n\n\t public long[] nextLongArray(int n) {\n\t long[] a = new long[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextLong();\n\t return a;\n\t }\n\t}",
"FastScanner",
"private BufferedReader reader = null;",
"reader",
"null",
"private StringTokenizer tokenizer = null;",
"tokenizer",
"null",
"public FastScanner(InputStream in) {\n\t reader = new BufferedReader(new InputStreamReader(in));\n\t tokenizer = null;\n\t }",
"FastScanner",
"{\n\t reader = new BufferedReader(new InputStreamReader(in));\n\t tokenizer = null;\n\t }",
"reader = new BufferedReader(new InputStreamReader(in))",
"reader",
"new BufferedReader(new InputStreamReader(in))",
"tokenizer = null",
"tokenizer",
"null",
"InputStream in",
"in",
"public String next() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\t return tokenizer.nextToken();\n\t }",
"next",
"{\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\t return tokenizer.nextToken();\n\t }",
"if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }",
"tokenizer == null || !tokenizer.hasMoreTokens()",
"tokenizer == null",
"tokenizer",
"null",
"!tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens",
"tokenizer",
"{\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }",
"try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }",
"catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }",
"IOException e",
"{\n\t throw new RuntimeException(e);\n\t }",
"throw new RuntimeException(e);",
"new RuntimeException(e)",
"{\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t }",
"tokenizer = new StringTokenizer(reader.readLine())",
"tokenizer",
"new StringTokenizer(reader.readLine())",
"return tokenizer.nextToken();",
"tokenizer.nextToken()",
"tokenizer.nextToken",
"tokenizer",
"public String nextLine() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\n\t return tokenizer.nextToken(\"\\n\");\n\t }",
"nextLine",
"{\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\n\t return tokenizer.nextToken(\"\\n\");\n\t }",
"if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }",
"tokenizer == null || !tokenizer.hasMoreTokens()",
"tokenizer == null",
"tokenizer",
"null",
"!tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens",
"tokenizer",
"{\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }",
"try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }",
"catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }",
"IOException e",
"{\n\t throw new RuntimeException(e);\n\t }",
"throw new RuntimeException(e);",
"new RuntimeException(e)",
"{\n\t return reader.readLine();\n\t }",
"return reader.readLine();",
"reader.readLine()",
"reader.readLine",
"reader",
"return tokenizer.nextToken(\"\\n\");",
"tokenizer.nextToken(\"\\n\")",
"tokenizer.nextToken",
"tokenizer",
"\"\\n\"",
"public long nextLong() {\n\t return Long.parseLong(next());\n\t }",
"nextLong",
"{\n\t return Long.parseLong(next());\n\t }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"public int nextInt() {\n\t return Integer.parseInt(next());\n\t }",
"nextInt",
"{\n\t return Integer.parseInt(next());\n\t }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"public double nextDouble() {\n\t return Double.parseDouble(next());\n\t }",
"nextDouble",
"{\n\t return Double.parseDouble(next());\n\t }",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public int[] nextIntArray(int n) {\n\t int[] a = new int[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextInt();\n\t return a;\n\t }",
"nextIntArray",
"{\n\t int[] a = new int[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextInt();\n\t return a;\n\t }",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++)\n\t a[i] = nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = nextInt();",
"a[i] = nextInt()",
"a[i]",
"a",
"i",
"nextInt()",
"nextInt",
"return a;",
"a",
"int n",
"n",
"public long[] nextLongArray(int n) {\n\t long[] a = new long[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextLong();\n\t return a;\n\t }",
"nextLongArray",
"{\n\t long[] a = new long[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextLong();\n\t return a;\n\t }",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for (int i = 0; i < n; i++)\n\t a[i] = nextLong();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = nextLong();",
"a[i] = nextLong()",
"a[i]",
"a",
"i",
"nextLong()",
"nextLong",
"return a;",
"a",
"int n",
"n",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger max = new BigInteger(\"1000000000000000000\");\n\t\tlong[] a = new long[n];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\tArrays.sort(a);\n\t\tif(a[0] == 0) {\n\t\t\tSystem.out.println(0);\n\t\t}else {\n\t\t\tBigInteger ans = BigInteger.ONE;\n\t\t\tfor(int i = n-1; i >= 0; i--) {\n\t\t\t\tans = ans.multiply(BigInteger.valueOf(a[i]));\n\t\t\t\tif(ans.compareTo(max) == 1) {\n\t\t\t\t\tans = new BigInteger(\"-1\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t\t\n\t}\n\t\n\tstatic class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t private StringTokenizer tokenizer = null;\n\t public FastScanner(InputStream in) {\n\t reader = new BufferedReader(new InputStreamReader(in));\n\t tokenizer = null;\n\t }\n\n\t public String next() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\t return tokenizer.nextToken();\n\t }\n\n\t public String nextLine() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\n\t return tokenizer.nextToken(\"\\n\");\n\t }\n\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\n\t public int nextInt() {\n\t return Integer.parseInt(next());\n\t }\n\n\t public double nextDouble() {\n\t return Double.parseDouble(next());\n\t }\n\n\t public int[] nextIntArray(int n) {\n\t int[] a = new int[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextInt();\n\t return a;\n\t }\n\n\t public long[] nextLongArray(int n) {\n\t long[] a = new long[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextLong();\n\t return a;\n\t }\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger max = new BigInteger(\"1000000000000000000\");\n\t\tlong[] a = new long[n];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\tArrays.sort(a);\n\t\tif(a[0] == 0) {\n\t\t\tSystem.out.println(0);\n\t\t}else {\n\t\t\tBigInteger ans = BigInteger.ONE;\n\t\t\tfor(int i = n-1; i >= 0; i--) {\n\t\t\t\tans = ans.multiply(BigInteger.valueOf(a[i]));\n\t\t\t\tif(ans.compareTo(max) == 1) {\n\t\t\t\t\tans = new BigInteger(\"-1\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t\t\n\t}\n\t\n\tstatic class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t private StringTokenizer tokenizer = null;\n\t public FastScanner(InputStream in) {\n\t reader = new BufferedReader(new InputStreamReader(in));\n\t tokenizer = null;\n\t }\n\n\t public String next() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\t return tokenizer.nextToken();\n\t }\n\n\t public String nextLine() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\n\t return tokenizer.nextToken(\"\\n\");\n\t }\n\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\n\t public int nextInt() {\n\t return Integer.parseInt(next());\n\t }\n\n\t public double nextDouble() {\n\t return Double.parseDouble(next());\n\t }\n\n\t public int[] nextIntArray(int n) {\n\t int[] a = new int[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextInt();\n\t return a;\n\t }\n\n\t public long[] nextLongArray(int n) {\n\t long[] a = new long[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextLong();\n\t return a;\n\t }\n\t}\n}",
"Main"
] |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
FastScanner sc = new FastScanner(System.in);
int n = sc.nextInt();
BigInteger max = new BigInteger("1000000000000000000");
long[] a = new long[n];
for(int i = 0; i < n; i++) {
a[i] = sc.nextLong();
}
Arrays.sort(a);
if(a[0] == 0) {
System.out.println(0);
}else {
BigInteger ans = BigInteger.ONE;
for(int i = n-1; i >= 0; i--) {
ans = ans.multiply(BigInteger.valueOf(a[i]));
if(ans.compareTo(max) == 1) {
ans = new BigInteger("-1");
break;
}
}
System.out.println(ans);
}
}
static class FastScanner {
private BufferedReader reader = null;
private StringTokenizer tokenizer = null;
public FastScanner(InputStream in) {
reader = new BufferedReader(new InputStreamReader(in));
tokenizer = null;
}
public String next() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public String nextLine() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
return reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken("\n");
}
public long nextLong() {
return Long.parseLong(next());
}
public int nextInt() {
return Integer.parseInt(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
public int[] nextIntArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
public long[] nextLongArray(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
40,
17,
30,
14,
2,
2,
17,
13,
13,
30,
0,
13,
40,
17,
30,
0,
13,
13,
30,
14,
2,
13,
17,
30,
0,
13,
17,
3,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
78,
5
],
[
78,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
8,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
20,
25
],
[
25,
26
],
[
25,
27
],
[
20,
28
],
[
28,
29
],
[
29,
30
],
[
20,
31
],
[
32,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
32,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
38,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
44,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
44,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
38,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
8,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
6,
75
],
[
75,
76
],
[
0,
77
],
[
77,
78
],
[
77,
79
]
] |
[
"import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long ans = 1;\n int n = sc.nextInt();\n\n for (int i = 0; i < n; i++) {\n long next = sc.nextLong();\n\n if (ans != -1) {\n if (1000000000000000000L / next < ans) {\n ans = -1;\n } else {\n ans *= next;\n }\n } else {\n if (next == 0) {\n ans = 0;\n break;\n }\n }\n }\n\n System.out.println(ans);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long ans = 1;\n int n = sc.nextInt();\n\n for (int i = 0; i < n; i++) {\n long next = sc.nextLong();\n\n if (ans != -1) {\n if (1000000000000000000L / next < ans) {\n ans = -1;\n } else {\n ans *= next;\n }\n } else {\n if (next == 0) {\n ans = 0;\n break;\n }\n }\n }\n\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long ans = 1;\n int n = sc.nextInt();\n\n for (int i = 0; i < n; i++) {\n long next = sc.nextLong();\n\n if (ans != -1) {\n if (1000000000000000000L / next < ans) {\n ans = -1;\n } else {\n ans *= next;\n }\n } else {\n if (next == 0) {\n ans = 0;\n break;\n }\n }\n }\n\n System.out.println(ans);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n long ans = 1;\n int n = sc.nextInt();\n\n for (int i = 0; i < n; i++) {\n long next = sc.nextLong();\n\n if (ans != -1) {\n if (1000000000000000000L / next < ans) {\n ans = -1;\n } else {\n ans *= next;\n }\n } else {\n if (next == 0) {\n ans = 0;\n break;\n }\n }\n }\n\n System.out.println(ans);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"long ans = 1;",
"ans",
"1",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for (int i = 0; i < n; i++) {\n long next = sc.nextLong();\n\n if (ans != -1) {\n if (1000000000000000000L / next < ans) {\n ans = -1;\n } else {\n ans *= next;\n }\n } else {\n if (next == 0) {\n ans = 0;\n break;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n long next = sc.nextLong();\n\n if (ans != -1) {\n if (1000000000000000000L / next < ans) {\n ans = -1;\n } else {\n ans *= next;\n }\n } else {\n if (next == 0) {\n ans = 0;\n break;\n }\n }\n }",
"{\n long next = sc.nextLong();\n\n if (ans != -1) {\n if (1000000000000000000L / next < ans) {\n ans = -1;\n } else {\n ans *= next;\n }\n } else {\n if (next == 0) {\n ans = 0;\n break;\n }\n }\n }",
"long next = sc.nextLong();",
"next",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (ans != -1) {\n if (1000000000000000000L / next < ans) {\n ans = -1;\n } else {\n ans *= next;\n }\n } else {\n if (next == 0) {\n ans = 0;\n break;\n }\n }",
"ans != -1",
"ans",
"-1",
"1",
"{\n if (1000000000000000000L / next < ans) {\n ans = -1;\n } else {\n ans *= next;\n }\n }",
"if (1000000000000000000L / next < ans) {\n ans = -1;\n } else {\n ans *= next;\n }",
"1000000000000000000L / next < ans",
"1000000000000000000L / next",
"1000000000000000000L",
"next",
"ans",
"{\n ans = -1;\n }",
"ans = -1",
"ans",
"-1",
"1",
"{\n ans *= next;\n }",
"ans *= next",
"ans",
"next",
"{\n if (next == 0) {\n ans = 0;\n break;\n }\n }",
"if (next == 0) {\n ans = 0;\n break;\n }",
"next == 0",
"next",
"0",
"{\n ans = 0;\n break;\n }",
"ans = 0",
"ans",
"0",
"break;",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long ans = 1;\n int n = sc.nextInt();\n\n for (int i = 0; i < n; i++) {\n long next = sc.nextLong();\n\n if (ans != -1) {\n if (1000000000000000000L / next < ans) {\n ans = -1;\n } else {\n ans *= next;\n }\n } else {\n if (next == 0) {\n ans = 0;\n break;\n }\n }\n }\n\n System.out.println(ans);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long ans = 1;\n int n = sc.nextInt();\n\n for (int i = 0; i < n; i++) {\n long next = sc.nextLong();\n\n if (ans != -1) {\n if (1000000000000000000L / next < ans) {\n ans = -1;\n } else {\n ans *= next;\n }\n } else {\n if (next == 0) {\n ans = 0;\n break;\n }\n }\n }\n\n System.out.println(ans);\n }\n}",
"Main"
] |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long ans = 1;
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
long next = sc.nextLong();
if (ans != -1) {
if (1000000000000000000L / next < ans) {
ans = -1;
} else {
ans *= next;
}
} else {
if (next == 0) {
ans = 0;
break;
}
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
4,
18,
13,
13,
14,
2,
18,
13,
17,
17,
30,
4,
18,
18,
13,
13,
17,
29,
41,
13,
4,
18,
13,
17,
41,
13,
4,
18,
13,
17,
28,
13,
13,
30,
30,
0,
13,
4,
18,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
29,
4,
18,
18,
13,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
17,
41,
13,
17,
12,
13,
30,
0,
13,
20,
0,
13,
17,
23,
13,
12,
13,
30,
14,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
37,
20,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
14,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
37,
20,
30,
29,
4,
18,
13,
29,
4,
18,
13,
17,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
272,
23
],
[
272,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
26,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
26,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
37,
40
],
[
26,
41
],
[
41,
42
],
[
42,
43
],
[
41,
44
],
[
26,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
46,
50
],
[
45,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
51,
58
],
[
26,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
26,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
26,
71
],
[
71,
72
],
[
71,
73
],
[
71,
74
],
[
75,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
75,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
86,
91
],
[
85,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
98,
99
],
[
92,
100
],
[
26,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
106,
107
],
[
107,
108
],
[
24,
109
],
[
109,
110
],
[
272,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
116,
117
],
[
116,
118
],
[
111,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
125,
127
],
[
119,
128
],
[
128,
129
],
[
111,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
133,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
147,
148
],
[
143,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
132,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
111,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
161,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
160,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
173,
174
],
[
174,
175
],
[
170,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
159,
181
],
[
181,
182
],
[
182,
183
],
[
183,
184
],
[
182,
185
],
[
111,
186
],
[
186,
187
],
[
186,
188
],
[
188,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
190,
193
],
[
193,
194
],
[
111,
195
],
[
195,
196
],
[
195,
197
],
[
197,
198
],
[
198,
199
],
[
199,
200
],
[
200,
201
],
[
199,
202
],
[
202,
203
],
[
111,
204
],
[
204,
205
],
[
204,
206
],
[
206,
207
],
[
207,
208
],
[
208,
209
],
[
209,
210
],
[
208,
211
],
[
211,
212
],
[
111,
213
],
[
213,
214
],
[
213,
215
],
[
215,
216
],
[
216,
217
],
[
216,
218
],
[
215,
220
],
[
220,
221
],
[
221,
222
],
[
222,
223
],
[
222,
224
],
[
220,
225
],
[
225,
226
],
[
225,
227
],
[
220,
228
],
[
228,
229
],
[
229,
230
],
[
220,
231
],
[
231,
232
],
[
232,
233
],
[
233,
234
],
[
233,
235
],
[
232,
236
],
[
236,
237
],
[
215,
238
],
[
238,
239
],
[
213,
240
],
[
240,
241
],
[
111,
242
],
[
242,
243
],
[
242,
244
],
[
244,
245
],
[
245,
246
],
[
245,
247
],
[
244,
249
],
[
249,
250
],
[
250,
251
],
[
251,
252
],
[
251,
253
],
[
249,
254
],
[
254,
255
],
[
254,
256
],
[
249,
257
],
[
257,
258
],
[
258,
259
],
[
249,
260
],
[
260,
261
],
[
261,
262
],
[
262,
263
],
[
262,
264
],
[
261,
265
],
[
265,
266
],
[
244,
267
],
[
267,
268
],
[
242,
269
],
[
269,
270
],
[
0,
271
],
[
271,
272
],
[
271,
273
]
] |
[
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class Main {\n private static class FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n }\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner(System.in);\n int n = sc.nextInt();\n long[] a = sc.nextLongArray(n);\n Arrays.sort(a);\n if (a[0] == 0L) {\n System.out.println(0);\n return;\n }\n BigInteger mul = BigInteger.valueOf(1L);\n BigInteger max = BigInteger.valueOf(1_000_000_000_000_000_000L);\n for (long ai: a) {\n mul = mul.multiply(BigInteger.valueOf(ai));\n if (mul.compareTo(max) > 0) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(mul.toString());\n }\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"public class Main {\n private static class FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n }\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner(System.in);\n int n = sc.nextInt();\n long[] a = sc.nextLongArray(n);\n Arrays.sort(a);\n if (a[0] == 0L) {\n System.out.println(0);\n return;\n }\n BigInteger mul = BigInteger.valueOf(1L);\n BigInteger max = BigInteger.valueOf(1_000_000_000_000_000_000L);\n for (long ai: a) {\n mul = mul.multiply(BigInteger.valueOf(ai));\n if (mul.compareTo(max) > 0) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(mul.toString());\n }\n}",
"Main",
"public static void main(String[] args) {\n FastScanner sc = new FastScanner(System.in);\n int n = sc.nextInt();\n long[] a = sc.nextLongArray(n);\n Arrays.sort(a);\n if (a[0] == 0L) {\n System.out.println(0);\n return;\n }\n BigInteger mul = BigInteger.valueOf(1L);\n BigInteger max = BigInteger.valueOf(1_000_000_000_000_000_000L);\n for (long ai: a) {\n mul = mul.multiply(BigInteger.valueOf(ai));\n if (mul.compareTo(max) > 0) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(mul.toString());\n }",
"main",
"{\n FastScanner sc = new FastScanner(System.in);\n int n = sc.nextInt();\n long[] a = sc.nextLongArray(n);\n Arrays.sort(a);\n if (a[0] == 0L) {\n System.out.println(0);\n return;\n }\n BigInteger mul = BigInteger.valueOf(1L);\n BigInteger max = BigInteger.valueOf(1_000_000_000_000_000_000L);\n for (long ai: a) {\n mul = mul.multiply(BigInteger.valueOf(ai));\n if (mul.compareTo(max) > 0) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(mul.toString());\n }",
"FastScanner sc = new FastScanner(System.in);",
"sc",
"new FastScanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] a = sc.nextLongArray(n);",
"a",
"sc.nextLongArray(n)",
"sc.nextLongArray",
"sc",
"n",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"if (a[0] == 0L) {\n System.out.println(0);\n return;\n }",
"a[0] == 0L",
"a[0]",
"a",
"0",
"0L",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"BigInteger mul = BigInteger.valueOf(1L);",
"mul",
"BigInteger.valueOf(1L)",
"BigInteger.valueOf",
"BigInteger",
"1L",
"BigInteger max = BigInteger.valueOf(1_000_000_000_000_000_000L);",
"max",
"BigInteger.valueOf(1_000_000_000_000_000_000L)",
"BigInteger.valueOf",
"BigInteger",
"1_000_000_000_000_000_000L",
"for (long ai: a) {\n mul = mul.multiply(BigInteger.valueOf(ai));\n if (mul.compareTo(max) > 0) {\n System.out.println(-1);\n return;\n }\n }",
"long ai",
"a",
"{\n mul = mul.multiply(BigInteger.valueOf(ai));\n if (mul.compareTo(max) > 0) {\n System.out.println(-1);\n return;\n }\n }",
"{\n mul = mul.multiply(BigInteger.valueOf(ai));\n if (mul.compareTo(max) > 0) {\n System.out.println(-1);\n return;\n }\n }",
"mul = mul.multiply(BigInteger.valueOf(ai))",
"mul",
"mul.multiply(BigInteger.valueOf(ai))",
"mul.multiply",
"mul",
"BigInteger.valueOf(ai)",
"BigInteger.valueOf",
"BigInteger",
"ai",
"if (mul.compareTo(max) > 0) {\n System.out.println(-1);\n return;\n }",
"mul.compareTo(max) > 0",
"mul.compareTo(max)",
"mul.compareTo",
"mul",
"max",
"0",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"System.out.println(mul.toString())",
"System.out.println",
"System.out",
"System",
"System.out",
"mul.toString()",
"mul.toString",
"mul",
"String[] args",
"args",
"private static class FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n }",
"FastScanner",
"private BufferedReader reader = null;",
"reader",
"null",
"private StringTokenizer tokenizer = null;",
"tokenizer",
"null",
"public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }",
"FastScanner",
"{\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }",
"reader = new BufferedReader(new InputStreamReader(in))",
"reader",
"new BufferedReader(new InputStreamReader(in))",
"tokenizer = null",
"tokenizer",
"null",
"InputStream in",
"in",
"public String next() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }",
"next",
"{\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }",
"if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }",
"tokenizer == null || !tokenizer.hasMoreTokens()",
"tokenizer == null",
"tokenizer",
"null",
"!tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens",
"tokenizer",
"{\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }",
"try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }",
"catch (IOException e) {\n throw new RuntimeException(e);\n }",
"IOException e",
"{\n throw new RuntimeException(e);\n }",
"throw new RuntimeException(e);",
"new RuntimeException(e)",
"{\n tokenizer = new StringTokenizer(reader.readLine());\n }",
"tokenizer = new StringTokenizer(reader.readLine())",
"tokenizer",
"new StringTokenizer(reader.readLine())",
"return tokenizer.nextToken();",
"tokenizer.nextToken()",
"tokenizer.nextToken",
"tokenizer",
"public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }",
"nextLine",
"{\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }",
"if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }",
"tokenizer == null || !tokenizer.hasMoreTokens()",
"tokenizer == null",
"tokenizer",
"null",
"!tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens",
"tokenizer",
"{\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }",
"try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }",
"catch (IOException e) {\n throw new RuntimeException(e);\n }",
"IOException e",
"{\n throw new RuntimeException(e);\n }",
"throw new RuntimeException(e);",
"new RuntimeException(e)",
"{\n return reader.readLine();\n }",
"return reader.readLine();",
"reader.readLine()",
"reader.readLine",
"reader",
"return tokenizer.nextToken(\"\\n\");",
"tokenizer.nextToken(\"\\n\")",
"tokenizer.nextToken",
"tokenizer",
"\"\\n\"",
"public long nextLong() {\n return Long.parseLong(next());\n }",
"nextLong",
"{\n return Long.parseLong(next());\n }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"public int nextInt() {\n return Integer.parseInt(next());\n }",
"nextInt",
"{\n return Integer.parseInt(next());\n }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"public double nextDouble() {\n return Double.parseDouble(next());\n }",
"nextDouble",
"{\n return Double.parseDouble(next());\n }",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }",
"nextIntArray",
"{\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++)\n a[i] = nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = nextInt();",
"a[i] = nextInt()",
"a[i]",
"a",
"i",
"nextInt()",
"nextInt",
"return a;",
"a",
"int n",
"n",
"public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }",
"nextLongArray",
"{\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for (int i = 0; i < n; i++)\n a[i] = nextLong();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = nextLong();",
"a[i] = nextLong()",
"a[i]",
"a",
"i",
"nextLong()",
"nextLong",
"return a;",
"a",
"int n",
"n",
"public class Main {\n private static class FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n }\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner(System.in);\n int n = sc.nextInt();\n long[] a = sc.nextLongArray(n);\n Arrays.sort(a);\n if (a[0] == 0L) {\n System.out.println(0);\n return;\n }\n BigInteger mul = BigInteger.valueOf(1L);\n BigInteger max = BigInteger.valueOf(1_000_000_000_000_000_000L);\n for (long ai: a) {\n mul = mul.multiply(BigInteger.valueOf(ai));\n if (mul.compareTo(max) > 0) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(mul.toString());\n }\n}",
"public class Main {\n private static class FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n }\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner(System.in);\n int n = sc.nextInt();\n long[] a = sc.nextLongArray(n);\n Arrays.sort(a);\n if (a[0] == 0L) {\n System.out.println(0);\n return;\n }\n BigInteger mul = BigInteger.valueOf(1L);\n BigInteger max = BigInteger.valueOf(1_000_000_000_000_000_000L);\n for (long ai: a) {\n mul = mul.multiply(BigInteger.valueOf(ai));\n if (mul.compareTo(max) > 0) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(mul.toString());\n }\n}",
"Main"
] |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
private static class FastScanner {
private BufferedReader reader = null;
private StringTokenizer tokenizer = null;
public FastScanner(InputStream in) {
reader = new BufferedReader(new InputStreamReader(in));
tokenizer = null;
}
public String next() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public String nextLine() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
return reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken("\n");
}
public long nextLong() {
return Long.parseLong(next());
}
public int nextInt() {
return Integer.parseInt(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
public int[] nextIntArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
public long[] nextLongArray(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
}
public static void main(String[] args) {
FastScanner sc = new FastScanner(System.in);
int n = sc.nextInt();
long[] a = sc.nextLongArray(n);
Arrays.sort(a);
if (a[0] == 0L) {
System.out.println(0);
return;
}
BigInteger mul = BigInteger.valueOf(1L);
BigInteger max = BigInteger.valueOf(1_000_000_000_000_000_000L);
for (long ai: a) {
mul = mul.multiply(BigInteger.valueOf(ai));
if (mul.compareTo(max) > 0) {
System.out.println(-1);
return;
}
}
System.out.println(mul.toString());
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
18,
13,
13,
4,
18,
13,
13,
41,
13,
17,
41,
13,
17,
38,
5,
13,
30,
4,
18,
18,
13,
13,
40,
17,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
0,
13,
17,
3,
0,
13,
13,
14,
2,
2,
13,
17,
2,
13,
17,
30,
3,
14,
13,
30,
4,
18,
18,
13,
13,
17,
30,
14,
2,
2,
13,
17,
2,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
30,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
141,
5
],
[
141,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
20,
25
],
[
25,
26
],
[
25,
27
],
[
20,
28
],
[
28,
29
],
[
29,
30
],
[
20,
31
],
[
32,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
32,
38
],
[
38,
39
],
[
39,
40
],
[
38,
41
],
[
8,
42
],
[
42,
43
],
[
43,
44
],
[
42,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
49,
51
],
[
8,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
61,
62
],
[
52,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
64,
69
],
[
69,
70
],
[
69,
71
],
[
64,
72
],
[
72,
73
],
[
73,
74
],
[
64,
75
],
[
76,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
80,
81
],
[
79,
82
],
[
76,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
76,
92
],
[
92,
93
],
[
92,
94
],
[
76,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
100,
102
],
[
95,
103
],
[
103,
104
],
[
63,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
105,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
120,
121
],
[
120,
122
],
[
115,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
124,
129
],
[
129,
130
],
[
115,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
132,
137
],
[
6,
138
],
[
138,
139
],
[
0,
140
],
[
140,
141
],
[
140,
142
]
] |
[
"import java.util.*;\n \npublic class Main {\n public static void main(String[] args) {\n\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n\n List<Long> list = new ArrayList<Long>();\n\n for (int i = 0; i < n; i++) {\n long a = scan.nextLong();\n list.add(a);\n }\n\n Collections.sort(list);\n //System.out.println(list);\n \n long ans = 1l;\n\n boolean flag = false;\n try {\n for (int i = 0; i < n; i++) {\n long a = list.get(i);\n if (a == 0) {\n flag = true;\n break;\n }\n ans *= a;\n if (ans > 1000000000000000000l || ans <= 0) {\n break;\n }\n }\n\n if (flag) {\n System.out.println(0);\n } else {\n if (ans > 1000000000000000000l || ans <= 0) {\n //System.out.println(ans);\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n }\n } catch (Exception e) {\n System.out.println(-1);\n }\n \n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n\n List<Long> list = new ArrayList<Long>();\n\n for (int i = 0; i < n; i++) {\n long a = scan.nextLong();\n list.add(a);\n }\n\n Collections.sort(list);\n //System.out.println(list);\n \n long ans = 1l;\n\n boolean flag = false;\n try {\n for (int i = 0; i < n; i++) {\n long a = list.get(i);\n if (a == 0) {\n flag = true;\n break;\n }\n ans *= a;\n if (ans > 1000000000000000000l || ans <= 0) {\n break;\n }\n }\n\n if (flag) {\n System.out.println(0);\n } else {\n if (ans > 1000000000000000000l || ans <= 0) {\n //System.out.println(ans);\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n }\n } catch (Exception e) {\n System.out.println(-1);\n }\n \n }\n}",
"Main",
"public static void main(String[] args) {\n\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n\n List<Long> list = new ArrayList<Long>();\n\n for (int i = 0; i < n; i++) {\n long a = scan.nextLong();\n list.add(a);\n }\n\n Collections.sort(list);\n //System.out.println(list);\n \n long ans = 1l;\n\n boolean flag = false;\n try {\n for (int i = 0; i < n; i++) {\n long a = list.get(i);\n if (a == 0) {\n flag = true;\n break;\n }\n ans *= a;\n if (ans > 1000000000000000000l || ans <= 0) {\n break;\n }\n }\n\n if (flag) {\n System.out.println(0);\n } else {\n if (ans > 1000000000000000000l || ans <= 0) {\n //System.out.println(ans);\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n }\n } catch (Exception e) {\n System.out.println(-1);\n }\n \n }",
"main",
"{\n\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n\n List<Long> list = new ArrayList<Long>();\n\n for (int i = 0; i < n; i++) {\n long a = scan.nextLong();\n list.add(a);\n }\n\n Collections.sort(list);\n //System.out.println(list);\n \n long ans = 1l;\n\n boolean flag = false;\n try {\n for (int i = 0; i < n; i++) {\n long a = list.get(i);\n if (a == 0) {\n flag = true;\n break;\n }\n ans *= a;\n if (ans > 1000000000000000000l || ans <= 0) {\n break;\n }\n }\n\n if (flag) {\n System.out.println(0);\n } else {\n if (ans > 1000000000000000000l || ans <= 0) {\n //System.out.println(ans);\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n }\n } catch (Exception e) {\n System.out.println(-1);\n }\n \n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"List<Long> list = new ArrayList<Long>();",
"list",
"new ArrayList<Long>()",
"for (int i = 0; i < n; i++) {\n long a = scan.nextLong();\n list.add(a);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n long a = scan.nextLong();\n list.add(a);\n }",
"{\n long a = scan.nextLong();\n list.add(a);\n }",
"long a = scan.nextLong();",
"a",
"scan.nextLong()",
"scan.nextLong",
"scan",
"list.add(a)",
"list.add",
"list",
"a",
"Collections.sort(list)",
"Collections.sort",
"Collections",
"list",
"long ans = 1l;",
"ans",
"1l",
"boolean flag = false;",
"flag",
"false",
"try {\n for (int i = 0; i < n; i++) {\n long a = list.get(i);\n if (a == 0) {\n flag = true;\n break;\n }\n ans *= a;\n if (ans > 1000000000000000000l || ans <= 0) {\n break;\n }\n }\n\n if (flag) {\n System.out.println(0);\n } else {\n if (ans > 1000000000000000000l || ans <= 0) {\n //System.out.println(ans);\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n }\n } catch (Exception e) {\n System.out.println(-1);\n }",
"catch (Exception e) {\n System.out.println(-1);\n }",
"Exception e",
"{\n System.out.println(-1);\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"{\n for (int i = 0; i < n; i++) {\n long a = list.get(i);\n if (a == 0) {\n flag = true;\n break;\n }\n ans *= a;\n if (ans > 1000000000000000000l || ans <= 0) {\n break;\n }\n }\n\n if (flag) {\n System.out.println(0);\n } else {\n if (ans > 1000000000000000000l || ans <= 0) {\n //System.out.println(ans);\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n }\n }",
"for (int i = 0; i < n; i++) {\n long a = list.get(i);\n if (a == 0) {\n flag = true;\n break;\n }\n ans *= a;\n if (ans > 1000000000000000000l || ans <= 0) {\n break;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n long a = list.get(i);\n if (a == 0) {\n flag = true;\n break;\n }\n ans *= a;\n if (ans > 1000000000000000000l || ans <= 0) {\n break;\n }\n }",
"{\n long a = list.get(i);\n if (a == 0) {\n flag = true;\n break;\n }\n ans *= a;\n if (ans > 1000000000000000000l || ans <= 0) {\n break;\n }\n }",
"long a = list.get(i);",
"a",
"list.get(i)",
"list.get",
"list",
"i",
"if (a == 0) {\n flag = true;\n break;\n }",
"a == 0",
"a",
"0",
"{\n flag = true;\n break;\n }",
"flag = true",
"flag",
"true",
"break;",
"ans *= a",
"ans",
"a",
"if (ans > 1000000000000000000l || ans <= 0) {\n break;\n }",
"ans > 1000000000000000000l || ans <= 0",
"ans > 1000000000000000000l",
"ans",
"1000000000000000000l",
"ans <= 0",
"ans",
"0",
"{\n break;\n }",
"break;",
"if (flag) {\n System.out.println(0);\n } else {\n if (ans > 1000000000000000000l || ans <= 0) {\n //System.out.println(ans);\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n }",
"flag",
"{\n System.out.println(0);\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"{\n if (ans > 1000000000000000000l || ans <= 0) {\n //System.out.println(ans);\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n }",
"if (ans > 1000000000000000000l || ans <= 0) {\n //System.out.println(ans);\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }",
"ans > 1000000000000000000l || ans <= 0",
"ans > 1000000000000000000l",
"ans",
"1000000000000000000l",
"ans <= 0",
"ans",
"0",
"{\n //System.out.println(ans);\n System.out.println(-1);\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"{\n System.out.println(ans);\n }",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n\n List<Long> list = new ArrayList<Long>();\n\n for (int i = 0; i < n; i++) {\n long a = scan.nextLong();\n list.add(a);\n }\n\n Collections.sort(list);\n //System.out.println(list);\n \n long ans = 1l;\n\n boolean flag = false;\n try {\n for (int i = 0; i < n; i++) {\n long a = list.get(i);\n if (a == 0) {\n flag = true;\n break;\n }\n ans *= a;\n if (ans > 1000000000000000000l || ans <= 0) {\n break;\n }\n }\n\n if (flag) {\n System.out.println(0);\n } else {\n if (ans > 1000000000000000000l || ans <= 0) {\n //System.out.println(ans);\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n }\n } catch (Exception e) {\n System.out.println(-1);\n }\n \n }\n}",
"public class Main {\n public static void main(String[] args) {\n\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n\n List<Long> list = new ArrayList<Long>();\n\n for (int i = 0; i < n; i++) {\n long a = scan.nextLong();\n list.add(a);\n }\n\n Collections.sort(list);\n //System.out.println(list);\n \n long ans = 1l;\n\n boolean flag = false;\n try {\n for (int i = 0; i < n; i++) {\n long a = list.get(i);\n if (a == 0) {\n flag = true;\n break;\n }\n ans *= a;\n if (ans > 1000000000000000000l || ans <= 0) {\n break;\n }\n }\n\n if (flag) {\n System.out.println(0);\n } else {\n if (ans > 1000000000000000000l || ans <= 0) {\n //System.out.println(ans);\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n }\n } catch (Exception e) {\n System.out.println(-1);\n }\n \n }\n}",
"Main"
] |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
List<Long> list = new ArrayList<Long>();
for (int i = 0; i < n; i++) {
long a = scan.nextLong();
list.add(a);
}
Collections.sort(list);
//System.out.println(list);
long ans = 1l;
boolean flag = false;
try {
for (int i = 0; i < n; i++) {
long a = list.get(i);
if (a == 0) {
flag = true;
break;
}
ans *= a;
if (ans > 1000000000000000000l || ans <= 0) {
break;
}
}
if (flag) {
System.out.println(0);
} else {
if (ans > 1000000000000000000l || ans <= 0) {
//System.out.println(ans);
System.out.println(-1);
} else {
System.out.println(ans);
}
}
} catch (Exception e) {
System.out.println(-1);
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
41,
13,
20,
41,
13,
20,
41,
13,
20,
4,
18,
13,
17,
13,
13,
4,
18,
13,
23,
13,
6,
13,
12,
13,
30,
41,
13,
17,
42,
2,
40,
13,
17,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
4,
18,
13,
17,
29,
14,
2,
2,
18,
13,
13,
17,
2,
2,
2,
13,
18,
13,
13,
18,
13,
13,
13,
30,
0,
13,
17,
30,
0,
13,
18,
13,
13,
14,
2,
13,
17,
0,
13,
17,
14,
40,
13,
30,
4,
18,
13,
40,
17,
30,
4,
18,
13,
13,
23,
13,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
20,
17,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
23,
13,
12,
13,
30,
14,
2,
13,
40,
17,
30,
37,
20,
14,
2,
13,
13,
30,
0,
13,
17,
38,
5,
13,
30,
37,
20,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
29,
40,
17,
29,
18,
13,
40,
13,
12,
13,
30,
41,
13,
4,
13,
42,
4,
13,
13,
30,
0,
13,
4,
13,
41,
13,
17,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
13,
41,
13,
17,
42,
40,
4,
13,
13,
30,
14,
2,
2,
13,
17,
2,
13,
17,
30,
37,
20,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
29,
2,
13,
13,
12,
13,
30,
41,
13,
4,
13,
42,
4,
13,
13,
30,
0,
13,
4,
13,
41,
13,
17,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
13,
41,
13,
17,
42,
40,
4,
13,
13,
30,
14,
2,
2,
13,
17,
2,
13,
17,
30,
37,
20,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
29,
2,
13,
13,
12,
13,
30,
14,
2,
13,
17,
30,
29,
4,
18,
13,
13,
29,
4,
13,
13,
23,
13,
12,
13,
30,
29,
2,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
40,
17,
23,
13,
12,
13,
30,
29,
4,
13,
13,
17,
23,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
13,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
23,
13,
6,
13,
12,
13,
23,
13,
6,
13,
41,
13,
12,
13,
30,
0,
13,
20,
23,
13,
12,
13,
30,
0,
18,
36,
13,
20,
23,
13,
12,
13,
30,
4,
18,
13,
12,
13,
30,
4,
18,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
25,
26
],
[
25,
27
],
[
0,
28
],
[
28,
29
],
[
28,
30
],
[
0,
31
],
[
31,
32
],
[
31,
33
],
[
0,
34
],
[
515,
35
],
[
515,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
41,
43
],
[
38,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
46,
48
],
[
38,
49
],
[
49,
50
],
[
49,
51
],
[
38,
52
],
[
52,
53
],
[
52,
54
],
[
38,
55
],
[
55,
56
],
[
55,
57
],
[
38,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
58,
62
],
[
58,
63
],
[
38,
64
],
[
64,
65
],
[
65,
66
],
[
36,
67
],
[
67,
68
],
[
515,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
77,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
82,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
82,
94
],
[
94,
95
],
[
94,
96
],
[
82,
97
],
[
97,
98
],
[
97,
99
],
[
82,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
100,
105
],
[
105,
106
],
[
105,
107
],
[
100,
108
],
[
108,
109
],
[
109,
110
],
[
100,
111
],
[
112,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
113,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
119,
124
],
[
112,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
126,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
133,
139
],
[
139,
140
],
[
139,
141
],
[
132,
142
],
[
125,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
125,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
150,
152
],
[
112,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
157,
158
],
[
157,
159
],
[
82,
160
],
[
160,
161
],
[
161,
162
],
[
160,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
164,
167
],
[
167,
168
],
[
160,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
170,
173
],
[
71,
174
],
[
174,
175
],
[
71,
176
],
[
176,
177
],
[
71,
178
],
[
178,
179
],
[
515,
180
],
[
180,
181
],
[
180,
182
],
[
182,
183
],
[
180,
184
],
[
184,
185
],
[
184,
186
],
[
180,
188
],
[
188,
189
],
[
180,
190
],
[
190,
191
],
[
180,
192
],
[
192,
193
],
[
180,
194
],
[
194,
195
],
[
194,
196
],
[
196,
197
],
[
197,
198
],
[
198,
199
],
[
198,
200
],
[
197,
201
],
[
194,
202
],
[
202,
203
],
[
180,
204
],
[
204,
205
],
[
204,
206
],
[
206,
207
],
[
207,
208
],
[
208,
209
],
[
208,
210
],
[
210,
211
],
[
207,
212
],
[
212,
213
],
[
213,
214
],
[
206,
215
],
[
215,
216
],
[
216,
217
],
[
216,
218
],
[
215,
219
],
[
219,
220
],
[
220,
221
],
[
220,
222
],
[
219,
223
],
[
223,
224
],
[
224,
225
],
[
224,
226
],
[
226,
227
],
[
227,
228
],
[
223,
229
],
[
229,
230
],
[
230,
231
],
[
230,
232
],
[
232,
233
],
[
233,
234
],
[
232,
235
],
[
219,
236
],
[
236,
237
],
[
237,
238
],
[
237,
239
],
[
236,
240
],
[
240,
241
],
[
241,
242
],
[
242,
243
],
[
206,
244
],
[
244,
245
],
[
245,
246
],
[
245,
247
],
[
247,
248
],
[
180,
249
],
[
249,
250
],
[
249,
251
],
[
251,
252
],
[
252,
253
],
[
252,
254
],
[
254,
255
],
[
251,
256
],
[
256,
257
],
[
257,
258
],
[
257,
259
],
[
256,
260
],
[
260,
261
],
[
261,
262
],
[
261,
263
],
[
263,
264
],
[
251,
265
],
[
265,
266
],
[
265,
267
],
[
251,
268
],
[
268,
269
],
[
269,
270
],
[
269,
271
],
[
268,
272
],
[
272,
273
],
[
273,
274
],
[
273,
275
],
[
275,
276
],
[
272,
277
],
[
277,
278
],
[
277,
279
],
[
279,
280
],
[
251,
281
],
[
281,
282
],
[
281,
283
],
[
251,
284
],
[
284,
285
],
[
285,
286
],
[
286,
287
],
[
286,
288
],
[
284,
289
],
[
289,
290
],
[
290,
291
],
[
291,
292
],
[
292,
293
],
[
292,
294
],
[
291,
295
],
[
295,
296
],
[
295,
297
],
[
290,
298
],
[
298,
299
],
[
299,
300
],
[
289,
301
],
[
301,
302
],
[
301,
303
],
[
289,
304
],
[
304,
305
],
[
304,
306
],
[
306,
307
],
[
306,
308
],
[
289,
309
],
[
309,
310
],
[
309,
311
],
[
311,
312
],
[
251,
313
],
[
313,
314
],
[
314,
315
],
[
314,
316
],
[
180,
317
],
[
317,
318
],
[
317,
319
],
[
319,
320
],
[
320,
321
],
[
320,
322
],
[
322,
323
],
[
319,
324
],
[
324,
325
],
[
325,
326
],
[
325,
327
],
[
324,
328
],
[
328,
329
],
[
329,
330
],
[
329,
331
],
[
331,
332
],
[
319,
333
],
[
333,
334
],
[
333,
335
],
[
319,
336
],
[
336,
337
],
[
337,
338
],
[
337,
339
],
[
336,
340
],
[
340,
341
],
[
341,
342
],
[
341,
343
],
[
343,
344
],
[
340,
345
],
[
345,
346
],
[
345,
347
],
[
347,
348
],
[
319,
349
],
[
349,
350
],
[
349,
351
],
[
319,
352
],
[
352,
353
],
[
353,
354
],
[
354,
355
],
[
354,
356
],
[
352,
357
],
[
357,
358
],
[
358,
359
],
[
359,
360
],
[
360,
361
],
[
360,
362
],
[
359,
363
],
[
363,
364
],
[
363,
365
],
[
358,
366
],
[
366,
367
],
[
367,
368
],
[
357,
369
],
[
369,
370
],
[
369,
371
],
[
357,
372
],
[
372,
373
],
[
372,
374
],
[
374,
375
],
[
374,
376
],
[
357,
377
],
[
377,
378
],
[
377,
379
],
[
379,
380
],
[
319,
381
],
[
381,
382
],
[
382,
383
],
[
382,
384
],
[
180,
385
],
[
385,
386
],
[
385,
387
],
[
387,
388
],
[
388,
389
],
[
389,
390
],
[
389,
391
],
[
388,
392
],
[
392,
393
],
[
393,
394
],
[
394,
395
],
[
395,
396
],
[
394,
397
],
[
387,
398
],
[
398,
399
],
[
399,
400
],
[
399,
401
],
[
385,
402
],
[
402,
403
],
[
180,
404
],
[
404,
405
],
[
404,
406
],
[
406,
407
],
[
407,
408
],
[
411,
409
],
[
421,
410
],
[
418,
411
],
[
411,
412
],
[
412,
413
],
[
412,
414
],
[
411,
415
],
[
415,
416
],
[
415,
417
],
[
418,
418
],
[
418,
419
],
[
418,
420
],
[
421,
421
],
[
421,
422
],
[
421,
423
],
[
411,
424
],
[
424,
425
],
[
424,
426
],
[
426,
427
],
[
404,
428
],
[
428,
429
],
[
180,
430
],
[
430,
431
],
[
430,
432
],
[
432,
433
],
[
433,
434
],
[
434,
435
],
[
434,
436
],
[
434,
437
],
[
430,
438
],
[
438,
439
],
[
180,
440
],
[
440,
441
],
[
440,
442
],
[
442,
443
],
[
443,
444
],
[
443,
445
],
[
442,
447
],
[
447,
448
],
[
448,
449
],
[
449,
450
],
[
449,
451
],
[
447,
452
],
[
452,
453
],
[
452,
454
],
[
447,
455
],
[
455,
456
],
[
456,
457
],
[
447,
458
],
[
458,
459
],
[
459,
460
],
[
460,
461
],
[
460,
462
],
[
459,
463
],
[
463,
464
],
[
442,
465
],
[
465,
466
],
[
440,
467
],
[
467,
468
],
[
440,
469
],
[
469,
470
],
[
180,
471
],
[
471,
472
],
[
471,
473
],
[
473,
474
],
[
473,
475
],
[
475,
476
],
[
515,
477
],
[
477,
478
],
[
477,
479
],
[
479,
480
],
[
477,
481
],
[
481,
482
],
[
481,
483
],
[
483,
484
],
[
484,
485
],
[
484,
486
],
[
481,
487
],
[
487,
488
],
[
477,
489
],
[
489,
490
],
[
489,
491
],
[
491,
492
],
[
492,
493
],
[
493,
494
],
[
493,
495
],
[
492,
496
],
[
489,
497
],
[
497,
498
],
[
477,
499
],
[
499,
500
],
[
499,
501
],
[
501,
502
],
[
502,
503
],
[
503,
504
],
[
477,
505
],
[
505,
506
],
[
505,
507
],
[
507,
508
],
[
508,
509
],
[
509,
510
],
[
508,
511
],
[
505,
512
],
[
512,
513
],
[
0,
514
],
[
514,
515
],
[
514,
516
]
] |
[
"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.BufferedWriter;\nimport java.io.Writer;\nimport java.io.OutputStreamWriter;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n BMultiplication2 solver = new BMultiplication2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class BMultiplication2 {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int ntc = 1;\n// ntc = in.nextInt();\n while ((ntc--) > 0) {\n int n = in.nextInt();\n long[] arr = in.nextLongArray(n);\n long prodd = 1;\n boolean ok = true;\n for (int i = 0; i < n; i++) {\n if (arr[i] == 0) {\n out.println(0);\n return;\n }\n // overflow handling\n if (arr[i] != 0 && (prodd * arr[i]) / arr[i] != prodd) {\n ok = false;\n } else {\n prodd *= arr[i];\n }\n if (prodd > (long) 1e18) ok = false;\n }\n if (!ok) {\n out.println(-1);\n } else {\n out.println(prodd);\n }\n }\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public long[] nextLongArray(int n) {\n return nextLongArray(n, 0);\n }\n\n public long[] nextLongArray(int n, int startFrom) {\n long[] array = new long[n];\n for (int i = startFrom; i < n; ++i) array[i] = nextLong();\n return array;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void println(long i) {\n writer.println(i);\n }\n\n }\n}\n",
"import java.io.OutputStream;",
"OutputStream",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.OutputStream;",
"OutputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.io.BufferedWriter;",
"BufferedWriter",
"java.io",
"import java.io.Writer;",
"Writer",
"java.io",
"import java.io.OutputStreamWriter;",
"OutputStreamWriter",
"java.io",
"import java.util.InputMismatchException;",
"InputMismatchException",
"java.util",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n BMultiplication2 solver = new BMultiplication2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class BMultiplication2 {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int ntc = 1;\n// ntc = in.nextInt();\n while ((ntc--) > 0) {\n int n = in.nextInt();\n long[] arr = in.nextLongArray(n);\n long prodd = 1;\n boolean ok = true;\n for (int i = 0; i < n; i++) {\n if (arr[i] == 0) {\n out.println(0);\n return;\n }\n // overflow handling\n if (arr[i] != 0 && (prodd * arr[i]) / arr[i] != prodd) {\n ok = false;\n } else {\n prodd *= arr[i];\n }\n if (prodd > (long) 1e18) ok = false;\n }\n if (!ok) {\n out.println(-1);\n } else {\n out.println(prodd);\n }\n }\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public long[] nextLongArray(int n) {\n return nextLongArray(n, 0);\n }\n\n public long[] nextLongArray(int n, int startFrom) {\n long[] array = new long[n];\n for (int i = startFrom; i < n; ++i) array[i] = nextLong();\n return array;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void println(long i) {\n writer.println(i);\n }\n\n }\n}",
"Main",
"public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n BMultiplication2 solver = new BMultiplication2();\n solver.solve(1, in, out);\n out.close();\n }",
"main",
"{\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n BMultiplication2 solver = new BMultiplication2();\n solver.solve(1, in, out);\n out.close();\n }",
"InputStream inputStream = System.in;",
"inputStream",
"System.in",
"System",
"System.in",
"OutputStream outputStream = System.out;",
"outputStream",
"System.out",
"System",
"System.out",
"InputReader in = new InputReader(inputStream);",
"in",
"new InputReader(inputStream)",
"OutputWriter out = new OutputWriter(outputStream);",
"out",
"new OutputWriter(outputStream)",
"BMultiplication2 solver = new BMultiplication2();",
"solver",
"new BMultiplication2()",
"solver.solve(1, in, out)",
"solver.solve",
"solver",
"1",
"in",
"out",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class BMultiplication2 {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int ntc = 1;\n// ntc = in.nextInt();\n while ((ntc--) > 0) {\n int n = in.nextInt();\n long[] arr = in.nextLongArray(n);\n long prodd = 1;\n boolean ok = true;\n for (int i = 0; i < n; i++) {\n if (arr[i] == 0) {\n out.println(0);\n return;\n }\n // overflow handling\n if (arr[i] != 0 && (prodd * arr[i]) / arr[i] != prodd) {\n ok = false;\n } else {\n prodd *= arr[i];\n }\n if (prodd > (long) 1e18) ok = false;\n }\n if (!ok) {\n out.println(-1);\n } else {\n out.println(prodd);\n }\n }\n }\n\n }",
"BMultiplication2",
"public void solve(int testNumber, InputReader in, OutputWriter out) {\n int ntc = 1;\n// ntc = in.nextInt();\n while ((ntc--) > 0) {\n int n = in.nextInt();\n long[] arr = in.nextLongArray(n);\n long prodd = 1;\n boolean ok = true;\n for (int i = 0; i < n; i++) {\n if (arr[i] == 0) {\n out.println(0);\n return;\n }\n // overflow handling\n if (arr[i] != 0 && (prodd * arr[i]) / arr[i] != prodd) {\n ok = false;\n } else {\n prodd *= arr[i];\n }\n if (prodd > (long) 1e18) ok = false;\n }\n if (!ok) {\n out.println(-1);\n } else {\n out.println(prodd);\n }\n }\n }",
"solve",
"{\n int ntc = 1;\n// ntc = in.nextInt();\n while ((ntc--) > 0) {\n int n = in.nextInt();\n long[] arr = in.nextLongArray(n);\n long prodd = 1;\n boolean ok = true;\n for (int i = 0; i < n; i++) {\n if (arr[i] == 0) {\n out.println(0);\n return;\n }\n // overflow handling\n if (arr[i] != 0 && (prodd * arr[i]) / arr[i] != prodd) {\n ok = false;\n } else {\n prodd *= arr[i];\n }\n if (prodd > (long) 1e18) ok = false;\n }\n if (!ok) {\n out.println(-1);\n } else {\n out.println(prodd);\n }\n }\n }",
"int ntc = 1;",
"ntc",
"1",
"while ((ntc--) > 0) {\n int n = in.nextInt();\n long[] arr = in.nextLongArray(n);\n long prodd = 1;\n boolean ok = true;\n for (int i = 0; i < n; i++) {\n if (arr[i] == 0) {\n out.println(0);\n return;\n }\n // overflow handling\n if (arr[i] != 0 && (prodd * arr[i]) / arr[i] != prodd) {\n ok = false;\n } else {\n prodd *= arr[i];\n }\n if (prodd > (long) 1e18) ok = false;\n }\n if (!ok) {\n out.println(-1);\n } else {\n out.println(prodd);\n }\n }",
"(ntc--) > 0",
"(ntc--)",
"ntc",
"0",
"{\n int n = in.nextInt();\n long[] arr = in.nextLongArray(n);\n long prodd = 1;\n boolean ok = true;\n for (int i = 0; i < n; i++) {\n if (arr[i] == 0) {\n out.println(0);\n return;\n }\n // overflow handling\n if (arr[i] != 0 && (prodd * arr[i]) / arr[i] != prodd) {\n ok = false;\n } else {\n prodd *= arr[i];\n }\n if (prodd > (long) 1e18) ok = false;\n }\n if (!ok) {\n out.println(-1);\n } else {\n out.println(prodd);\n }\n }",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"long[] arr = in.nextLongArray(n);",
"arr",
"in.nextLongArray(n)",
"in.nextLongArray",
"in",
"n",
"long prodd = 1;",
"prodd",
"1",
"boolean ok = true;",
"ok",
"true",
"for (int i = 0; i < n; i++) {\n if (arr[i] == 0) {\n out.println(0);\n return;\n }\n // overflow handling\n if (arr[i] != 0 && (prodd * arr[i]) / arr[i] != prodd) {\n ok = false;\n } else {\n prodd *= arr[i];\n }\n if (prodd > (long) 1e18) ok = false;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if (arr[i] == 0) {\n out.println(0);\n return;\n }\n // overflow handling\n if (arr[i] != 0 && (prodd * arr[i]) / arr[i] != prodd) {\n ok = false;\n } else {\n prodd *= arr[i];\n }\n if (prodd > (long) 1e18) ok = false;\n }",
"{\n if (arr[i] == 0) {\n out.println(0);\n return;\n }\n // overflow handling\n if (arr[i] != 0 && (prodd * arr[i]) / arr[i] != prodd) {\n ok = false;\n } else {\n prodd *= arr[i];\n }\n if (prodd > (long) 1e18) ok = false;\n }",
"if (arr[i] == 0) {\n out.println(0);\n return;\n }",
"arr[i] == 0",
"arr[i]",
"arr",
"i",
"0",
"{\n out.println(0);\n return;\n }",
"out.println(0)",
"out.println",
"out",
"0",
"return;",
"if (arr[i] != 0 && (prodd * arr[i]) / arr[i] != prodd) {\n ok = false;\n } else {\n prodd *= arr[i];\n }",
"arr[i] != 0 && (prodd * arr[i]) / arr[i] != prodd",
"arr[i] != 0",
"arr[i]",
"arr",
"i",
"0",
"(prodd * arr[i]) / arr[i] != prodd",
"(prodd * arr[i]) / arr[i]",
"(prodd * arr[i])",
"prodd",
"arr[i]",
"arr",
"i",
"arr[i]",
"arr",
"i",
"prodd",
"{\n ok = false;\n }",
"ok = false",
"ok",
"false",
"{\n prodd *= arr[i];\n }",
"prodd *= arr[i]",
"prodd",
"arr[i]",
"arr",
"i",
"if (prodd > (long) 1e18) ok = false;",
"prodd > (long) 1e18",
"prodd",
"(long) 1e18",
"ok = false",
"ok",
"false",
"if (!ok) {\n out.println(-1);\n } else {\n out.println(prodd);\n }",
"!ok",
"ok",
"{\n out.println(-1);\n }",
"out.println(-1)",
"out.println",
"out",
"-1",
"1",
"{\n out.println(prodd);\n }",
"out.println(prodd)",
"out.println",
"out",
"prodd",
"int testNumber",
"testNumber",
"InputReader in",
"in",
"OutputWriter out",
"out",
"static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public long[] nextLongArray(int n) {\n return nextLongArray(n, 0);\n }\n\n public long[] nextLongArray(int n, int startFrom) {\n long[] array = new long[n];\n for (int i = startFrom; i < n; ++i) array[i] = nextLong();\n return array;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }",
"InputReader",
"private InputStream stream;",
"stream",
"private byte[] buf = new byte[1024];",
"buf",
"new byte[1024]",
"1024",
"private int curChar;",
"curChar",
"private int numChars;",
"numChars",
"private InputReader.SpaceCharFilter filter;",
"filter",
"public InputReader(InputStream stream) {\n this.stream = stream;\n }",
"InputReader",
"{\n this.stream = stream;\n }",
"this.stream = stream",
"this.stream",
"this",
"this.stream",
"stream",
"InputStream stream",
"stream",
"public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }",
"read",
"{\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }",
"if (numChars == -1) {\n throw new InputMismatchException();\n }",
"numChars == -1",
"numChars",
"-1",
"1",
"{\n throw new InputMismatchException();\n }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }",
"curChar >= numChars",
"curChar",
"numChars",
"{\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }",
"curChar = 0",
"curChar",
"0",
"try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }",
"catch (IOException e) {\n throw new InputMismatchException();\n }",
"IOException e",
"{\n throw new InputMismatchException();\n }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"{\n numChars = stream.read(buf);\n }",
"numChars = stream.read(buf)",
"numChars",
"stream.read(buf)",
"stream.read",
"stream",
"buf",
"if (numChars <= 0) {\n return -1;\n }",
"numChars <= 0",
"numChars",
"0",
"{\n return -1;\n }",
"return -1;",
"-1",
"1",
"return buf[curChar++];",
"buf[curChar++]",
"buf",
"curChar++",
"curChar",
"public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"nextInt",
"{\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"int c = read();",
"c",
"read()",
"read",
"while (isSpaceChar(c)) {\n c = read();\n }",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n c = read();\n }",
"c = read()",
"c",
"read()",
"read",
"int sgn = 1;",
"sgn",
"1",
"if (c == '-') {\n sgn = -1;\n c = read();\n }",
"c == '-'",
"c",
"'-'",
"{\n sgn = -1;\n c = read();\n }",
"sgn = -1",
"sgn",
"-1",
"1",
"c = read()",
"c",
"read()",
"read",
"int res = 0;",
"res",
"0",
"do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n }",
"if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }",
"c < '0' || c > '9'",
"c < '0'",
"c",
"'0'",
"c > '9'",
"c",
"'9'",
"{\n throw new InputMismatchException();\n }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"res *= 10",
"res",
"10",
"res += c - '0'",
"res",
"c - '0'",
"c",
"'0'",
"c = read()",
"c",
"read()",
"read",
"return res * sgn;",
"res * sgn",
"res",
"sgn",
"public long nextLong() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"nextLong",
"{\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"int c = read();",
"c",
"read()",
"read",
"while (isSpaceChar(c)) {\n c = read();\n }",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n c = read();\n }",
"c = read()",
"c",
"read()",
"read",
"int sgn = 1;",
"sgn",
"1",
"if (c == '-') {\n sgn = -1;\n c = read();\n }",
"c == '-'",
"c",
"'-'",
"{\n sgn = -1;\n c = read();\n }",
"sgn = -1",
"sgn",
"-1",
"1",
"c = read()",
"c",
"read()",
"read",
"long res = 0;",
"res",
"0",
"do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n }",
"if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }",
"c < '0' || c > '9'",
"c < '0'",
"c",
"'0'",
"c > '9'",
"c",
"'9'",
"{\n throw new InputMismatchException();\n }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"res *= 10",
"res",
"10",
"res += c - '0'",
"res",
"c - '0'",
"c",
"'0'",
"c = read()",
"c",
"read()",
"read",
"return res * sgn;",
"res * sgn",
"res",
"sgn",
"public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }",
"isSpaceChar",
"{\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }",
"if (filter != null) {\n return filter.isSpaceChar(c);\n }",
"filter != null",
"filter",
"null",
"{\n return filter.isSpaceChar(c);\n }",
"return filter.isSpaceChar(c);",
"filter.isSpaceChar(c)",
"filter.isSpaceChar",
"filter",
"c",
"return isWhitespace(c);",
"isWhitespace(c)",
"isWhitespace",
"c",
"int c",
"c",
"public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"isWhitespace",
"{\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == '\\t'",
"c == '\\r'",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == ' '",
"c",
"' '",
"c == '\\n'",
"c",
"'\\n'",
"c == '\\r'",
"c",
"'\\r'",
"c == '\\t'",
"c",
"'\\t'",
"c == -1",
"c",
"-1",
"1",
"int c",
"c",
"public long[] nextLongArray(int n) {\n return nextLongArray(n, 0);\n }",
"nextLongArray",
"{\n return nextLongArray(n, 0);\n }",
"return nextLongArray(n, 0);",
"nextLongArray(n, 0)",
"nextLongArray",
"n",
"0",
"int n",
"n",
"public long[] nextLongArray(int n, int startFrom) {\n long[] array = new long[n];\n for (int i = startFrom; i < n; ++i) array[i] = nextLong();\n return array;\n }",
"nextLongArray",
"{\n long[] array = new long[n];\n for (int i = startFrom; i < n; ++i) array[i] = nextLong();\n return array;\n }",
"long[] array = new long[n];",
"array",
"new long[n]",
"n",
"for (int i = startFrom; i < n; ++i) array[i] = nextLong();",
"int i = startFrom;",
"int i = startFrom;",
"i",
"startFrom",
"i < n",
"i",
"n",
"++i",
"++i",
"i",
"array[i] = nextLong();",
"array[i] = nextLong()",
"array[i]",
"array",
"i",
"nextLong()",
"nextLong",
"return array;",
"array",
"int n",
"n",
"int startFrom",
"startFrom",
"public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }",
"SpaceCharFilter",
"public boolean isSpaceChar(int ch);",
"isSpaceChar",
"int ch",
"ch",
"static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void println(long i) {\n writer.println(i);\n }\n\n }",
"OutputWriter",
"private final PrintWriter writer;",
"writer",
"public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }",
"OutputWriter",
"{\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }",
"writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)))",
"writer",
"new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)))",
"OutputStream outputStream",
"outputStream",
"public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }",
"OutputWriter",
"{\n this.writer = new PrintWriter(writer);\n }",
"this.writer = new PrintWriter(writer)",
"this.writer",
"this",
"this.writer",
"new PrintWriter(writer)",
"Writer writer",
"writer",
"public void close() {\n writer.close();\n }",
"close",
"{\n writer.close();\n }",
"writer.close()",
"writer.close",
"writer",
"public void println(long i) {\n writer.println(i);\n }",
"println",
"{\n writer.println(i);\n }",
"writer.println(i)",
"writer.println",
"writer",
"i",
"long i",
"i",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n BMultiplication2 solver = new BMultiplication2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class BMultiplication2 {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int ntc = 1;\n// ntc = in.nextInt();\n while ((ntc--) > 0) {\n int n = in.nextInt();\n long[] arr = in.nextLongArray(n);\n long prodd = 1;\n boolean ok = true;\n for (int i = 0; i < n; i++) {\n if (arr[i] == 0) {\n out.println(0);\n return;\n }\n // overflow handling\n if (arr[i] != 0 && (prodd * arr[i]) / arr[i] != prodd) {\n ok = false;\n } else {\n prodd *= arr[i];\n }\n if (prodd > (long) 1e18) ok = false;\n }\n if (!ok) {\n out.println(-1);\n } else {\n out.println(prodd);\n }\n }\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public long[] nextLongArray(int n) {\n return nextLongArray(n, 0);\n }\n\n public long[] nextLongArray(int n, int startFrom) {\n long[] array = new long[n];\n for (int i = startFrom; i < n; ++i) array[i] = nextLong();\n return array;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void println(long i) {\n writer.println(i);\n }\n\n }\n}",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n BMultiplication2 solver = new BMultiplication2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class BMultiplication2 {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int ntc = 1;\n// ntc = in.nextInt();\n while ((ntc--) > 0) {\n int n = in.nextInt();\n long[] arr = in.nextLongArray(n);\n long prodd = 1;\n boolean ok = true;\n for (int i = 0; i < n; i++) {\n if (arr[i] == 0) {\n out.println(0);\n return;\n }\n // overflow handling\n if (arr[i] != 0 && (prodd * arr[i]) / arr[i] != prodd) {\n ok = false;\n } else {\n prodd *= arr[i];\n }\n if (prodd > (long) 1e18) ok = false;\n }\n if (!ok) {\n out.println(-1);\n } else {\n out.println(prodd);\n }\n }\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public long[] nextLongArray(int n) {\n return nextLongArray(n, 0);\n }\n\n public long[] nextLongArray(int n, int startFrom) {\n long[] array = new long[n];\n for (int i = startFrom; i < n; ++i) array[i] = nextLong();\n return array;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void println(long i) {\n writer.println(i);\n }\n\n }\n}",
"Main"
] |
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
OutputWriter out = new OutputWriter(outputStream);
BMultiplication2 solver = new BMultiplication2();
solver.solve(1, in, out);
out.close();
}
static class BMultiplication2 {
public void solve(int testNumber, InputReader in, OutputWriter out) {
int ntc = 1;
// ntc = in.nextInt();
while ((ntc--) > 0) {
int n = in.nextInt();
long[] arr = in.nextLongArray(n);
long prodd = 1;
boolean ok = true;
for (int i = 0; i < n; i++) {
if (arr[i] == 0) {
out.println(0);
return;
}
// overflow handling
if (arr[i] != 0 && (prodd * arr[i]) / arr[i] != prodd) {
ok = false;
} else {
prodd *= arr[i];
}
if (prodd > (long) 1e18) ok = false;
}
if (!ok) {
out.println(-1);
} else {
out.println(prodd);
}
}
}
}
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private InputReader.SpaceCharFilter filter;
public InputReader(InputStream stream) {
this.stream = stream;
}
public int read() {
if (numChars == -1) {
throw new InputMismatchException();
}
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0) {
return -1;
}
}
return buf[curChar++];
}
public int nextInt() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
if (c < '0' || c > '9') {
throw new InputMismatchException();
}
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public long nextLong() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
long res = 0;
do {
if (c < '0' || c > '9') {
throw new InputMismatchException();
}
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public boolean isSpaceChar(int c) {
if (filter != null) {
return filter.isSpaceChar(c);
}
return isWhitespace(c);
}
public static boolean isWhitespace(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public long[] nextLongArray(int n) {
return nextLongArray(n, 0);
}
public long[] nextLongArray(int n, int startFrom) {
long[] array = new long[n];
for (int i = startFrom; i < n; ++i) array[i] = nextLong();
return array;
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
static class OutputWriter {
private final PrintWriter writer;
public OutputWriter(OutputStream outputStream) {
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
}
public OutputWriter(Writer writer) {
this.writer = new PrintWriter(writer);
}
public void close() {
writer.close();
}
public void println(long i) {
writer.println(i);
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
20,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
20,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
20,
0,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
3,
14,
2,
4,
18,
13,
13,
17,
30,
0,
13,
20,
3,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
112,
8
],
[
112,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
24,
26
],
[
11,
27
],
[
27,
28
],
[
27,
29
],
[
11,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
30,
41
],
[
42,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
47,
48
],
[
48,
49
],
[
11,
50
],
[
50,
51
],
[
51,
52
],
[
50,
53
],
[
11,
54
],
[
54,
55
],
[
54,
56
],
[
11,
57
],
[
57,
58
],
[
57,
59
],
[
11,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
60,
65
],
[
65,
66
],
[
65,
67
],
[
60,
68
],
[
68,
69
],
[
69,
70
],
[
60,
71
],
[
72,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
72,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
84,
87
],
[
83,
88
],
[
82,
89
],
[
89,
90
],
[
82,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
92,
97
],
[
91,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
11,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
9,
109
],
[
109,
110
],
[
0,
111
],
[
111,
112
],
[
111,
113
]
] |
[
"import java.util.*;\nimport java.math.BigDecimal;\n\npublic class Main {\n public static void main (String args[]) {\n Scanner sc = new Scanner(System.in);\n \n int N = sc.nextInt();\n String A[] = new String[N];\n BigDecimal C = new BigDecimal(\"1000000000000000000\");\n String B = \"\";\n \n for(int i=0; i<N; i++) {\n A[i] = sc.next();\n }\n Arrays.sort(A);\n BigDecimal z = new BigDecimal(\"0\");\n BigDecimal b = new BigDecimal(\"1\");\n for(int j=0; j<N; j++) {\n BigDecimal b1 = new BigDecimal(A[j]);\n b= b.multiply(b1);\n if(b.compareTo(z) == 0) {\n break;\n } else if(b.compareTo(C) > 0) {\n b = new BigDecimal(\"-1\");\n break;\n }\n }\n System.out.println(b);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.math.BigDecimal;",
"BigDecimal",
"java.math",
"public class Main {\n public static void main (String args[]) {\n Scanner sc = new Scanner(System.in);\n \n int N = sc.nextInt();\n String A[] = new String[N];\n BigDecimal C = new BigDecimal(\"1000000000000000000\");\n String B = \"\";\n \n for(int i=0; i<N; i++) {\n A[i] = sc.next();\n }\n Arrays.sort(A);\n BigDecimal z = new BigDecimal(\"0\");\n BigDecimal b = new BigDecimal(\"1\");\n for(int j=0; j<N; j++) {\n BigDecimal b1 = new BigDecimal(A[j]);\n b= b.multiply(b1);\n if(b.compareTo(z) == 0) {\n break;\n } else if(b.compareTo(C) > 0) {\n b = new BigDecimal(\"-1\");\n break;\n }\n }\n System.out.println(b);\n }\n}",
"Main",
"public static void main (String args[]) {\n Scanner sc = new Scanner(System.in);\n \n int N = sc.nextInt();\n String A[] = new String[N];\n BigDecimal C = new BigDecimal(\"1000000000000000000\");\n String B = \"\";\n \n for(int i=0; i<N; i++) {\n A[i] = sc.next();\n }\n Arrays.sort(A);\n BigDecimal z = new BigDecimal(\"0\");\n BigDecimal b = new BigDecimal(\"1\");\n for(int j=0; j<N; j++) {\n BigDecimal b1 = new BigDecimal(A[j]);\n b= b.multiply(b1);\n if(b.compareTo(z) == 0) {\n break;\n } else if(b.compareTo(C) > 0) {\n b = new BigDecimal(\"-1\");\n break;\n }\n }\n System.out.println(b);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n \n int N = sc.nextInt();\n String A[] = new String[N];\n BigDecimal C = new BigDecimal(\"1000000000000000000\");\n String B = \"\";\n \n for(int i=0; i<N; i++) {\n A[i] = sc.next();\n }\n Arrays.sort(A);\n BigDecimal z = new BigDecimal(\"0\");\n BigDecimal b = new BigDecimal(\"1\");\n for(int j=0; j<N; j++) {\n BigDecimal b1 = new BigDecimal(A[j]);\n b= b.multiply(b1);\n if(b.compareTo(z) == 0) {\n break;\n } else if(b.compareTo(C) > 0) {\n b = new BigDecimal(\"-1\");\n break;\n }\n }\n System.out.println(b);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"String A[] = new String[N];",
"A",
"new String[N]",
"N",
"BigDecimal C = new BigDecimal(\"1000000000000000000\");",
"C",
"new BigDecimal(\"1000000000000000000\")",
"String B = \"\";",
"B",
"\"\"",
"for(int i=0; i<N; i++) {\n A[i] = sc.next();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i] = sc.next();\n }",
"{\n A[i] = sc.next();\n }",
"A[i] = sc.next()",
"A[i]",
"A",
"i",
"sc.next()",
"sc.next",
"sc",
"Arrays.sort(A)",
"Arrays.sort",
"Arrays",
"A",
"BigDecimal z = new BigDecimal(\"0\");",
"z",
"new BigDecimal(\"0\")",
"BigDecimal b = new BigDecimal(\"1\");",
"b",
"new BigDecimal(\"1\")",
"for(int j=0; j<N; j++) {\n BigDecimal b1 = new BigDecimal(A[j]);\n b= b.multiply(b1);\n if(b.compareTo(z) == 0) {\n break;\n } else if(b.compareTo(C) > 0) {\n b = new BigDecimal(\"-1\");\n break;\n }\n }",
"int j=0;",
"int j=0;",
"j",
"0",
"j<N",
"j",
"N",
"j++",
"j++",
"j",
"{\n BigDecimal b1 = new BigDecimal(A[j]);\n b= b.multiply(b1);\n if(b.compareTo(z) == 0) {\n break;\n } else if(b.compareTo(C) > 0) {\n b = new BigDecimal(\"-1\");\n break;\n }\n }",
"{\n BigDecimal b1 = new BigDecimal(A[j]);\n b= b.multiply(b1);\n if(b.compareTo(z) == 0) {\n break;\n } else if(b.compareTo(C) > 0) {\n b = new BigDecimal(\"-1\");\n break;\n }\n }",
"BigDecimal b1 = new BigDecimal(A[j]);",
"b1",
"new BigDecimal(A[j])",
"b= b.multiply(b1)",
"b",
"b.multiply(b1)",
"b.multiply",
"b",
"b1",
"if(b.compareTo(z) == 0) {\n break;\n } else if(b.compareTo(C) > 0) {\n b = new BigDecimal(\"-1\");\n break;\n }",
"b.compareTo(z) == 0",
"b.compareTo(z)",
"b.compareTo",
"b",
"z",
"0",
"{\n break;\n }",
"break;",
"if(b.compareTo(C) > 0) {\n b = new BigDecimal(\"-1\");\n break;\n }",
"b.compareTo(C) > 0",
"b.compareTo(C)",
"b.compareTo",
"b",
"C",
"0",
"{\n b = new BigDecimal(\"-1\");\n break;\n }",
"b = new BigDecimal(\"-1\")",
"b",
"new BigDecimal(\"-1\")",
"break;",
"System.out.println(b)",
"System.out.println",
"System.out",
"System",
"System.out",
"b",
"String args[]",
"args",
"public class Main {\n public static void main (String args[]) {\n Scanner sc = new Scanner(System.in);\n \n int N = sc.nextInt();\n String A[] = new String[N];\n BigDecimal C = new BigDecimal(\"1000000000000000000\");\n String B = \"\";\n \n for(int i=0; i<N; i++) {\n A[i] = sc.next();\n }\n Arrays.sort(A);\n BigDecimal z = new BigDecimal(\"0\");\n BigDecimal b = new BigDecimal(\"1\");\n for(int j=0; j<N; j++) {\n BigDecimal b1 = new BigDecimal(A[j]);\n b= b.multiply(b1);\n if(b.compareTo(z) == 0) {\n break;\n } else if(b.compareTo(C) > 0) {\n b = new BigDecimal(\"-1\");\n break;\n }\n }\n System.out.println(b);\n }\n}",
"public class Main {\n public static void main (String args[]) {\n Scanner sc = new Scanner(System.in);\n \n int N = sc.nextInt();\n String A[] = new String[N];\n BigDecimal C = new BigDecimal(\"1000000000000000000\");\n String B = \"\";\n \n for(int i=0; i<N; i++) {\n A[i] = sc.next();\n }\n Arrays.sort(A);\n BigDecimal z = new BigDecimal(\"0\");\n BigDecimal b = new BigDecimal(\"1\");\n for(int j=0; j<N; j++) {\n BigDecimal b1 = new BigDecimal(A[j]);\n b= b.multiply(b1);\n if(b.compareTo(z) == 0) {\n break;\n } else if(b.compareTo(C) > 0) {\n b = new BigDecimal(\"-1\");\n break;\n }\n }\n System.out.println(b);\n }\n}",
"Main"
] |
import java.util.*;
import java.math.BigDecimal;
public class Main {
public static void main (String args[]) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
String A[] = new String[N];
BigDecimal C = new BigDecimal("1000000000000000000");
String B = "";
for(int i=0; i<N; i++) {
A[i] = sc.next();
}
Arrays.sort(A);
BigDecimal z = new BigDecimal("0");
BigDecimal b = new BigDecimal("1");
for(int j=0; j<N; j++) {
BigDecimal b1 = new BigDecimal(A[j]);
b= b.multiply(b1);
if(b.compareTo(z) == 0) {
break;
} else if(b.compareTo(C) > 0) {
b = new BigDecimal("-1");
break;
}
}
System.out.println(b);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
4,
18,
18,
13,
13,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
18,
13,
13,
14,
2,
4,
18,
13,
20,
17,
30,
4,
18,
18,
13,
13,
40,
17,
4,
18,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
26,
28
],
[
11,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
29,
34
],
[
34,
35
],
[
34,
36
],
[
29,
37
],
[
37,
38
],
[
38,
39
],
[
29,
40
],
[
41,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
46,
47
],
[
47,
48
],
[
41,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
56,
57
],
[
56,
58
],
[
50,
59
],
[
49,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
61,
66
],
[
60,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
11,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
71,
76
],
[
76,
77
],
[
76,
78
],
[
71,
79
],
[
79,
80
],
[
80,
81
],
[
71,
82
],
[
83,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
89,
90
],
[
89,
91
],
[
83,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
94,
97
],
[
93,
98
],
[
92,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
100,
105
],
[
105,
106
],
[
99,
107
],
[
107,
108
],
[
108,
109
],
[
107,
110
],
[
11,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
9,
117
],
[
117,
118
]
] |
[
"import java.util.*;\nimport java.math.*;\n\nclass Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n BigInteger[] A = new BigInteger[N];\n BigInteger sum = BigInteger.ONE;\n \n for(int i=0; i<N; i++){\n A[i] = sc.nextBigInteger();\n if(A[i].compareTo(BigInteger.ZERO) == 0){\n System.out.println(0);\n System.exit(0);\n }\n }\n \n for(int i=0; i<N; i++){\n sum = sum.multiply(A[i]);\n if(sum.compareTo(new BigInteger(\"1000000000000000000\")) == 1){\n System.out.println(-1);\n System.exit(0);\n }\n }\n \n System.out.println(sum);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.math.*;",
"math.*",
"java",
"class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n BigInteger[] A = new BigInteger[N];\n BigInteger sum = BigInteger.ONE;\n \n for(int i=0; i<N; i++){\n A[i] = sc.nextBigInteger();\n if(A[i].compareTo(BigInteger.ZERO) == 0){\n System.out.println(0);\n System.exit(0);\n }\n }\n \n for(int i=0; i<N; i++){\n sum = sum.multiply(A[i]);\n if(sum.compareTo(new BigInteger(\"1000000000000000000\")) == 1){\n System.out.println(-1);\n System.exit(0);\n }\n }\n \n System.out.println(sum);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n BigInteger[] A = new BigInteger[N];\n BigInteger sum = BigInteger.ONE;\n \n for(int i=0; i<N; i++){\n A[i] = sc.nextBigInteger();\n if(A[i].compareTo(BigInteger.ZERO) == 0){\n System.out.println(0);\n System.exit(0);\n }\n }\n \n for(int i=0; i<N; i++){\n sum = sum.multiply(A[i]);\n if(sum.compareTo(new BigInteger(\"1000000000000000000\")) == 1){\n System.out.println(-1);\n System.exit(0);\n }\n }\n \n System.out.println(sum);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n BigInteger[] A = new BigInteger[N];\n BigInteger sum = BigInteger.ONE;\n \n for(int i=0; i<N; i++){\n A[i] = sc.nextBigInteger();\n if(A[i].compareTo(BigInteger.ZERO) == 0){\n System.out.println(0);\n System.exit(0);\n }\n }\n \n for(int i=0; i<N; i++){\n sum = sum.multiply(A[i]);\n if(sum.compareTo(new BigInteger(\"1000000000000000000\")) == 1){\n System.out.println(-1);\n System.exit(0);\n }\n }\n \n System.out.println(sum);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BigInteger[] A = new BigInteger[N];",
"A",
"new BigInteger[N]",
"N",
"BigInteger sum = BigInteger.ONE;",
"sum",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"for(int i=0; i<N; i++){\n A[i] = sc.nextBigInteger();\n if(A[i].compareTo(BigInteger.ZERO) == 0){\n System.out.println(0);\n System.exit(0);\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i] = sc.nextBigInteger();\n if(A[i].compareTo(BigInteger.ZERO) == 0){\n System.out.println(0);\n System.exit(0);\n }\n }",
"{\n A[i] = sc.nextBigInteger();\n if(A[i].compareTo(BigInteger.ZERO) == 0){\n System.out.println(0);\n System.exit(0);\n }\n }",
"A[i] = sc.nextBigInteger()",
"A[i]",
"A",
"i",
"sc.nextBigInteger()",
"sc.nextBigInteger",
"sc",
"if(A[i].compareTo(BigInteger.ZERO) == 0){\n System.out.println(0);\n System.exit(0);\n }",
"A[i].compareTo(BigInteger.ZERO) == 0",
"A[i].compareTo(BigInteger.ZERO)",
"A[i].compareTo",
"A[i]",
"A",
"i",
"BigInteger.ZERO",
"BigInteger",
"BigInteger.ZERO",
"0",
"{\n System.out.println(0);\n System.exit(0);\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"System.exit(0)",
"System.exit",
"System",
"0",
"for(int i=0; i<N; i++){\n sum = sum.multiply(A[i]);\n if(sum.compareTo(new BigInteger(\"1000000000000000000\")) == 1){\n System.out.println(-1);\n System.exit(0);\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n sum = sum.multiply(A[i]);\n if(sum.compareTo(new BigInteger(\"1000000000000000000\")) == 1){\n System.out.println(-1);\n System.exit(0);\n }\n }",
"{\n sum = sum.multiply(A[i]);\n if(sum.compareTo(new BigInteger(\"1000000000000000000\")) == 1){\n System.out.println(-1);\n System.exit(0);\n }\n }",
"sum = sum.multiply(A[i])",
"sum",
"sum.multiply(A[i])",
"sum.multiply",
"sum",
"A[i]",
"A",
"i",
"if(sum.compareTo(new BigInteger(\"1000000000000000000\")) == 1){\n System.out.println(-1);\n System.exit(0);\n }",
"sum.compareTo(new BigInteger(\"1000000000000000000\")) == 1",
"sum.compareTo(new BigInteger(\"1000000000000000000\"))",
"sum.compareTo",
"sum",
"new BigInteger(\"1000000000000000000\")",
"1",
"{\n System.out.println(-1);\n System.exit(0);\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"System.exit(0)",
"System.exit",
"System",
"0",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args"
] |
import java.util.*;
import java.math.*;
class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
BigInteger[] A = new BigInteger[N];
BigInteger sum = BigInteger.ONE;
for(int i=0; i<N; i++){
A[i] = sc.nextBigInteger();
if(A[i].compareTo(BigInteger.ZERO) == 0){
System.out.println(0);
System.exit(0);
}
}
for(int i=0; i<N; i++){
sum = sum.multiply(A[i]);
if(sum.compareTo(new BigInteger("1000000000000000000")) == 1){
System.out.println(-1);
System.exit(0);
}
}
System.out.println(sum);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
4,
18,
13,
17,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
13,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
30,
0,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
110,
5
],
[
110,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
23,
26
],
[
23,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
8,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
36,
37
],
[
36,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
31,
42
],
[
43,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
48,
49
],
[
49,
50
],
[
43,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
51,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
58,
63
],
[
57,
64
],
[
8,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
65,
70
],
[
70,
71
],
[
70,
72
],
[
65,
73
],
[
73,
74
],
[
74,
75
],
[
65,
76
],
[
77,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
83,
85
],
[
78,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
92,
93
],
[
86,
94
],
[
78,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
8,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
6,
107
],
[
107,
108
],
[
0,
109
],
[
109,
110
],
[
109,
111
]
] |
[
"import java.util.*;\npublic class Main\n{\n public static void main(String[] args)\n {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n long[] b = new long[a];\n long MAX = (long)Math.pow(10,18);\n long result = 1;\n \n \n for(int i = 0; i < a; i++)\n {\n b[i] = sc.nextLong();\n if(b[i] == 0)\n {\n System.out.println(0);\n \treturn;\n }\n }\n \n \n for(int i = 0; i < a; i++)\n {\n if(MAX/result < b[i])\n {\n System.out.println(-1);\n return;\n }\n else\n {\n result *= b[i];\n }\n }\n System.out.println(result);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main\n{\n public static void main(String[] args)\n {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n long[] b = new long[a];\n long MAX = (long)Math.pow(10,18);\n long result = 1;\n \n \n for(int i = 0; i < a; i++)\n {\n b[i] = sc.nextLong();\n if(b[i] == 0)\n {\n System.out.println(0);\n \treturn;\n }\n }\n \n \n for(int i = 0; i < a; i++)\n {\n if(MAX/result < b[i])\n {\n System.out.println(-1);\n return;\n }\n else\n {\n result *= b[i];\n }\n }\n System.out.println(result);\n }\n}",
"Main",
"public static void main(String[] args)\n {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n long[] b = new long[a];\n long MAX = (long)Math.pow(10,18);\n long result = 1;\n \n \n for(int i = 0; i < a; i++)\n {\n b[i] = sc.nextLong();\n if(b[i] == 0)\n {\n System.out.println(0);\n \treturn;\n }\n }\n \n \n for(int i = 0; i < a; i++)\n {\n if(MAX/result < b[i])\n {\n System.out.println(-1);\n return;\n }\n else\n {\n result *= b[i];\n }\n }\n System.out.println(result);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n long[] b = new long[a];\n long MAX = (long)Math.pow(10,18);\n long result = 1;\n \n \n for(int i = 0; i < a; i++)\n {\n b[i] = sc.nextLong();\n if(b[i] == 0)\n {\n System.out.println(0);\n \treturn;\n }\n }\n \n \n for(int i = 0; i < a; i++)\n {\n if(MAX/result < b[i])\n {\n System.out.println(-1);\n return;\n }\n else\n {\n result *= b[i];\n }\n }\n System.out.println(result);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int a = sc.nextInt();",
"a",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] b = new long[a];",
"b",
"new long[a]",
"a",
"long MAX = (long)Math.pow(10,18);",
"MAX",
"(long)Math.pow(10,18)",
"Math.pow",
"Math",
"10",
"18",
"long result = 1;",
"result",
"1",
"for(int i = 0; i < a; i++)\n {\n b[i] = sc.nextLong();\n if(b[i] == 0)\n {\n System.out.println(0);\n \treturn;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < a",
"i",
"a",
"i++",
"i++",
"i",
"{\n b[i] = sc.nextLong();\n if(b[i] == 0)\n {\n System.out.println(0);\n \treturn;\n }\n }",
"{\n b[i] = sc.nextLong();\n if(b[i] == 0)\n {\n System.out.println(0);\n \treturn;\n }\n }",
"b[i] = sc.nextLong()",
"b[i]",
"b",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(b[i] == 0)\n {\n System.out.println(0);\n \treturn;\n }",
"b[i] == 0",
"b[i]",
"b",
"i",
"0",
"{\n System.out.println(0);\n \treturn;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"for(int i = 0; i < a; i++)\n {\n if(MAX/result < b[i])\n {\n System.out.println(-1);\n return;\n }\n else\n {\n result *= b[i];\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < a",
"i",
"a",
"i++",
"i++",
"i",
"{\n if(MAX/result < b[i])\n {\n System.out.println(-1);\n return;\n }\n else\n {\n result *= b[i];\n }\n }",
"{\n if(MAX/result < b[i])\n {\n System.out.println(-1);\n return;\n }\n else\n {\n result *= b[i];\n }\n }",
"if(MAX/result < b[i])\n {\n System.out.println(-1);\n return;\n }\n else\n {\n result *= b[i];\n }",
"MAX/result < b[i]",
"MAX/result",
"MAX",
"result",
"b[i]",
"b",
"i",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"{\n result *= b[i];\n }",
"result *= b[i]",
"result",
"b[i]",
"b",
"i",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"String[] args",
"args",
"public class Main\n{\n public static void main(String[] args)\n {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n long[] b = new long[a];\n long MAX = (long)Math.pow(10,18);\n long result = 1;\n \n \n for(int i = 0; i < a; i++)\n {\n b[i] = sc.nextLong();\n if(b[i] == 0)\n {\n System.out.println(0);\n \treturn;\n }\n }\n \n \n for(int i = 0; i < a; i++)\n {\n if(MAX/result < b[i])\n {\n System.out.println(-1);\n return;\n }\n else\n {\n result *= b[i];\n }\n }\n System.out.println(result);\n }\n}",
"public class Main\n{\n public static void main(String[] args)\n {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n long[] b = new long[a];\n long MAX = (long)Math.pow(10,18);\n long result = 1;\n \n \n for(int i = 0; i < a; i++)\n {\n b[i] = sc.nextLong();\n if(b[i] == 0)\n {\n System.out.println(0);\n \treturn;\n }\n }\n \n \n for(int i = 0; i < a; i++)\n {\n if(MAX/result < b[i])\n {\n System.out.println(-1);\n return;\n }\n else\n {\n result *= b[i];\n }\n }\n System.out.println(result);\n }\n}",
"Main"
] |
import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
long[] b = new long[a];
long MAX = (long)Math.pow(10,18);
long result = 1;
for(int i = 0; i < a; i++)
{
b[i] = sc.nextLong();
if(b[i] == 0)
{
System.out.println(0);
return;
}
}
for(int i = 0; i < a; i++)
{
if(MAX/result < b[i])
{
System.out.println(-1);
return;
}
else
{
result *= b[i];
}
}
System.out.println(result);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
41,
13,
20,
41,
13,
20,
41,
13,
20,
4,
18,
13,
17,
13,
13,
4,
18,
13,
23,
13,
6,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
41,
13,
4,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
0,
13,
17,
14,
2,
13,
17,
4,
18,
13,
17,
30,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
13,
18,
13,
13,
13,
30,
4,
18,
13,
17,
29,
14,
2,
2,
17,
13,
18,
13,
13,
30,
4,
18,
13,
17,
29,
30,
0,
13,
2,
13,
18,
13,
13,
4,
18,
13,
13,
23,
13,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
0,
13,
17,
23,
13,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
37,
20,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
25,
26
],
[
25,
27
],
[
0,
28
],
[
253,
29
],
[
253,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
35,
37
],
[
32,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
40,
42
],
[
32,
43
],
[
43,
44
],
[
43,
45
],
[
32,
46
],
[
46,
47
],
[
46,
48
],
[
32,
49
],
[
49,
50
],
[
49,
51
],
[
32,
52
],
[
52,
53
],
[
53,
54
],
[
52,
55
],
[
52,
56
],
[
52,
57
],
[
32,
58
],
[
58,
59
],
[
59,
60
],
[
30,
61
],
[
61,
62
],
[
253,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
67,
73
],
[
73,
74
],
[
73,
75
],
[
67,
77
],
[
77,
78
],
[
77,
79
],
[
67,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
82,
86
],
[
67,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
92,
93
],
[
92,
94
],
[
87,
95
],
[
95,
96
],
[
96,
97
],
[
87,
98
],
[
99,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
104,
105
],
[
105,
106
],
[
99,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
107,
113
],
[
113,
114
],
[
113,
115
],
[
67,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
116,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
128,
129
],
[
128,
130
],
[
124,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
136,
137
],
[
136,
138
],
[
131,
139
],
[
139,
140
],
[
140,
141
],
[
131,
142
],
[
143,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
148,
150
],
[
145,
151
],
[
144,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
153,
156
],
[
152,
157
],
[
143,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
159,
163
],
[
163,
164
],
[
163,
165
],
[
158,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
167,
170
],
[
166,
171
],
[
158,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
175,
176
],
[
175,
177
],
[
177,
178
],
[
177,
179
],
[
124,
180
],
[
180,
181
],
[
181,
182
],
[
180,
183
],
[
65,
184
],
[
184,
185
],
[
65,
186
],
[
186,
187
],
[
65,
188
],
[
188,
189
],
[
253,
190
],
[
190,
191
],
[
190,
192
],
[
192,
193
],
[
190,
194
],
[
194,
195
],
[
190,
196
],
[
196,
197
],
[
196,
198
],
[
198,
199
],
[
199,
200
],
[
199,
201
],
[
198,
202
],
[
202,
203
],
[
202,
204
],
[
196,
205
],
[
205,
206
],
[
190,
207
],
[
207,
208
],
[
207,
209
],
[
209,
210
],
[
210,
211
],
[
211,
212
],
[
212,
213
],
[
212,
214
],
[
211,
215
],
[
215,
216
],
[
216,
217
],
[
217,
218
],
[
210,
219
],
[
219,
220
],
[
220,
221
],
[
221,
222
],
[
221,
223
],
[
223,
224
],
[
224,
225
],
[
220,
226
],
[
226,
227
],
[
227,
228
],
[
227,
229
],
[
209,
230
],
[
230,
231
],
[
231,
232
],
[
232,
233
],
[
190,
234
],
[
234,
235
],
[
234,
236
],
[
236,
237
],
[
237,
238
],
[
238,
239
],
[
239,
240
],
[
238,
241
],
[
241,
242
],
[
190,
243
],
[
243,
244
],
[
243,
245
],
[
245,
246
],
[
246,
247
],
[
247,
248
],
[
248,
249
],
[
247,
250
],
[
250,
251
],
[
0,
252
],
[
252,
253
],
[
252,
254
]
] |
[
"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Tarek\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n BMultiplication2 solver = new BMultiplication2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class BMultiplication2 {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n long a[] = new long[n];\n int f = 0;\n long sum2 = (long) Math.pow(10, 18);\n for (int i = 0; i < n; i++) {\n a[i] = in.nextLong();\n if (a[i] == 0) f = 1;\n }\n if (f == 1) out.println(\"0\");\n else {\n int m = 0;\n long sum = 1;\n for (int i = 0; i < n; i++) {\n if ((sum * a[i]) > sum2) {\n out.println(\"-1\");\n return;\n }\n if (1000000000000000000L / sum < a[i]) {\n out.println(\"-1\");\n return;\n } else {\n sum = sum * a[i];\n }\n }\n out.println(sum);\n }\n }\n\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}\n",
"import java.io.OutputStream;",
"OutputStream",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n BMultiplication2 solver = new BMultiplication2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class BMultiplication2 {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n long a[] = new long[n];\n int f = 0;\n long sum2 = (long) Math.pow(10, 18);\n for (int i = 0; i < n; i++) {\n a[i] = in.nextLong();\n if (a[i] == 0) f = 1;\n }\n if (f == 1) out.println(\"0\");\n else {\n int m = 0;\n long sum = 1;\n for (int i = 0; i < n; i++) {\n if ((sum * a[i]) > sum2) {\n out.println(\"-1\");\n return;\n }\n if (1000000000000000000L / sum < a[i]) {\n out.println(\"-1\");\n return;\n } else {\n sum = sum * a[i];\n }\n }\n out.println(sum);\n }\n }\n\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}",
"Main",
"public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n BMultiplication2 solver = new BMultiplication2();\n solver.solve(1, in, out);\n out.close();\n }",
"main",
"{\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n BMultiplication2 solver = new BMultiplication2();\n solver.solve(1, in, out);\n out.close();\n }",
"InputStream inputStream = System.in;",
"inputStream",
"System.in",
"System",
"System.in",
"OutputStream outputStream = System.out;",
"outputStream",
"System.out",
"System",
"System.out",
"InputReader in = new InputReader(inputStream);",
"in",
"new InputReader(inputStream)",
"PrintWriter out = new PrintWriter(outputStream);",
"out",
"new PrintWriter(outputStream)",
"BMultiplication2 solver = new BMultiplication2();",
"solver",
"new BMultiplication2()",
"solver.solve(1, in, out)",
"solver.solve",
"solver",
"1",
"in",
"out",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class BMultiplication2 {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n long a[] = new long[n];\n int f = 0;\n long sum2 = (long) Math.pow(10, 18);\n for (int i = 0; i < n; i++) {\n a[i] = in.nextLong();\n if (a[i] == 0) f = 1;\n }\n if (f == 1) out.println(\"0\");\n else {\n int m = 0;\n long sum = 1;\n for (int i = 0; i < n; i++) {\n if ((sum * a[i]) > sum2) {\n out.println(\"-1\");\n return;\n }\n if (1000000000000000000L / sum < a[i]) {\n out.println(\"-1\");\n return;\n } else {\n sum = sum * a[i];\n }\n }\n out.println(sum);\n }\n }\n\n }",
"BMultiplication2",
"public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n long a[] = new long[n];\n int f = 0;\n long sum2 = (long) Math.pow(10, 18);\n for (int i = 0; i < n; i++) {\n a[i] = in.nextLong();\n if (a[i] == 0) f = 1;\n }\n if (f == 1) out.println(\"0\");\n else {\n int m = 0;\n long sum = 1;\n for (int i = 0; i < n; i++) {\n if ((sum * a[i]) > sum2) {\n out.println(\"-1\");\n return;\n }\n if (1000000000000000000L / sum < a[i]) {\n out.println(\"-1\");\n return;\n } else {\n sum = sum * a[i];\n }\n }\n out.println(sum);\n }\n }",
"solve",
"{\n int n = in.nextInt();\n long a[] = new long[n];\n int f = 0;\n long sum2 = (long) Math.pow(10, 18);\n for (int i = 0; i < n; i++) {\n a[i] = in.nextLong();\n if (a[i] == 0) f = 1;\n }\n if (f == 1) out.println(\"0\");\n else {\n int m = 0;\n long sum = 1;\n for (int i = 0; i < n; i++) {\n if ((sum * a[i]) > sum2) {\n out.println(\"-1\");\n return;\n }\n if (1000000000000000000L / sum < a[i]) {\n out.println(\"-1\");\n return;\n } else {\n sum = sum * a[i];\n }\n }\n out.println(sum);\n }\n }",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"long a[] = new long[n];",
"a",
"new long[n]",
"n",
"int f = 0;",
"f",
"0",
"long sum2 = (long) Math.pow(10, 18);",
"sum2",
"(long) Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"for (int i = 0; i < n; i++) {\n a[i] = in.nextLong();\n if (a[i] == 0) f = 1;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = in.nextLong();\n if (a[i] == 0) f = 1;\n }",
"{\n a[i] = in.nextLong();\n if (a[i] == 0) f = 1;\n }",
"a[i] = in.nextLong()",
"a[i]",
"a",
"i",
"in.nextLong()",
"in.nextLong",
"in",
"if (a[i] == 0) f = 1;",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"f = 1",
"f",
"1",
"if (f == 1) out.println(\"0\");\n else {\n int m = 0;\n long sum = 1;\n for (int i = 0; i < n; i++) {\n if ((sum * a[i]) > sum2) {\n out.println(\"-1\");\n return;\n }\n if (1000000000000000000L / sum < a[i]) {\n out.println(\"-1\");\n return;\n } else {\n sum = sum * a[i];\n }\n }\n out.println(sum);\n }",
"f == 1",
"f",
"1",
"out.println(\"0\")",
"out.println",
"out",
"\"0\"",
"{\n int m = 0;\n long sum = 1;\n for (int i = 0; i < n; i++) {\n if ((sum * a[i]) > sum2) {\n out.println(\"-1\");\n return;\n }\n if (1000000000000000000L / sum < a[i]) {\n out.println(\"-1\");\n return;\n } else {\n sum = sum * a[i];\n }\n }\n out.println(sum);\n }",
"int m = 0;",
"m",
"0",
"long sum = 1;",
"sum",
"1",
"for (int i = 0; i < n; i++) {\n if ((sum * a[i]) > sum2) {\n out.println(\"-1\");\n return;\n }\n if (1000000000000000000L / sum < a[i]) {\n out.println(\"-1\");\n return;\n } else {\n sum = sum * a[i];\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if ((sum * a[i]) > sum2) {\n out.println(\"-1\");\n return;\n }\n if (1000000000000000000L / sum < a[i]) {\n out.println(\"-1\");\n return;\n } else {\n sum = sum * a[i];\n }\n }",
"{\n if ((sum * a[i]) > sum2) {\n out.println(\"-1\");\n return;\n }\n if (1000000000000000000L / sum < a[i]) {\n out.println(\"-1\");\n return;\n } else {\n sum = sum * a[i];\n }\n }",
"if ((sum * a[i]) > sum2) {\n out.println(\"-1\");\n return;\n }",
"(sum * a[i]) > sum2",
"(sum * a[i])",
"sum",
"a[i]",
"a",
"i",
"sum2",
"{\n out.println(\"-1\");\n return;\n }",
"out.println(\"-1\")",
"out.println",
"out",
"\"-1\"",
"return;",
"if (1000000000000000000L / sum < a[i]) {\n out.println(\"-1\");\n return;\n } else {\n sum = sum * a[i];\n }",
"1000000000000000000L / sum < a[i]",
"1000000000000000000L / sum",
"1000000000000000000L",
"sum",
"a[i]",
"a",
"i",
"{\n out.println(\"-1\");\n return;\n }",
"out.println(\"-1\")",
"out.println",
"out",
"\"-1\"",
"return;",
"{\n sum = sum * a[i];\n }",
"sum = sum * a[i]",
"sum",
"sum * a[i]",
"sum",
"a[i]",
"a",
"i",
"out.println(sum)",
"out.println",
"out",
"sum",
"int testNumber",
"testNumber",
"InputReader in",
"in",
"PrintWriter out",
"out",
"static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }",
"InputReader",
"public BufferedReader reader;",
"reader",
"public StringTokenizer tokenizer;",
"tokenizer",
"public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }",
"InputReader",
"{\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }",
"reader = new BufferedReader(new InputStreamReader(stream), 32768)",
"reader",
"new BufferedReader(new InputStreamReader(stream), 32768)",
"tokenizer = null",
"tokenizer",
"null",
"InputStream stream",
"stream",
"public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }",
"next",
"{\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }",
"while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }",
"tokenizer == null || !tokenizer.hasMoreTokens()",
"tokenizer == null",
"tokenizer",
"null",
"!tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens",
"tokenizer",
"{\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }",
"try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }",
"catch (IOException e) {\n throw new RuntimeException(e);\n }",
"IOException e",
"{\n throw new RuntimeException(e);\n }",
"throw new RuntimeException(e);",
"new RuntimeException(e)",
"{\n tokenizer = new StringTokenizer(reader.readLine());\n }",
"tokenizer = new StringTokenizer(reader.readLine())",
"tokenizer",
"new StringTokenizer(reader.readLine())",
"return tokenizer.nextToken();",
"tokenizer.nextToken()",
"tokenizer.nextToken",
"tokenizer",
"public long nextLong() {\n return Long.parseLong(next());\n }",
"nextLong",
"{\n return Long.parseLong(next());\n }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"public int nextInt() {\n return Integer.parseInt(next());\n }",
"nextInt",
"{\n return Integer.parseInt(next());\n }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n BMultiplication2 solver = new BMultiplication2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class BMultiplication2 {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n long a[] = new long[n];\n int f = 0;\n long sum2 = (long) Math.pow(10, 18);\n for (int i = 0; i < n; i++) {\n a[i] = in.nextLong();\n if (a[i] == 0) f = 1;\n }\n if (f == 1) out.println(\"0\");\n else {\n int m = 0;\n long sum = 1;\n for (int i = 0; i < n; i++) {\n if ((sum * a[i]) > sum2) {\n out.println(\"-1\");\n return;\n }\n if (1000000000000000000L / sum < a[i]) {\n out.println(\"-1\");\n return;\n } else {\n sum = sum * a[i];\n }\n }\n out.println(sum);\n }\n }\n\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n BMultiplication2 solver = new BMultiplication2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class BMultiplication2 {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n long a[] = new long[n];\n int f = 0;\n long sum2 = (long) Math.pow(10, 18);\n for (int i = 0; i < n; i++) {\n a[i] = in.nextLong();\n if (a[i] == 0) f = 1;\n }\n if (f == 1) out.println(\"0\");\n else {\n int m = 0;\n long sum = 1;\n for (int i = 0; i < n; i++) {\n if ((sum * a[i]) > sum2) {\n out.println(\"-1\");\n return;\n }\n if (1000000000000000000L / sum < a[i]) {\n out.println(\"-1\");\n return;\n } else {\n sum = sum * a[i];\n }\n }\n out.println(sum);\n }\n }\n\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}",
"Main"
] |
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Tarek
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
BMultiplication2 solver = new BMultiplication2();
solver.solve(1, in, out);
out.close();
}
static class BMultiplication2 {
public void solve(int testNumber, InputReader in, PrintWriter out) {
int n = in.nextInt();
long a[] = new long[n];
int f = 0;
long sum2 = (long) Math.pow(10, 18);
for (int i = 0; i < n; i++) {
a[i] = in.nextLong();
if (a[i] == 0) f = 1;
}
if (f == 1) out.println("0");
else {
int m = 0;
long sum = 1;
for (int i = 0; i < n; i++) {
if ((sum * a[i]) > sum2) {
out.println("-1");
return;
}
if (1000000000000000000L / sum < a[i]) {
out.println("-1");
return;
} else {
sum = sum * a[i];
}
}
out.println(sum);
}
}
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public long nextLong() {
return Long.parseLong(next());
}
public int nextInt() {
return Integer.parseInt(next());
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
4,
18,
13,
17,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
0,
18,
13,
13,
13,
41,
13,
18,
13,
13,
28,
13,
13,
30,
30,
0,
13,
4,
18,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
4,
18,
18,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
116,
8
],
[
116,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
11,
14
],
[
116,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
23,
26
],
[
26,
27
],
[
27,
28
],
[
17,
29
],
[
29,
30
],
[
29,
31
],
[
17,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
33,
38
],
[
38,
39
],
[
38,
40
],
[
33,
41
],
[
41,
42
],
[
42,
43
],
[
33,
44
],
[
45,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
48,
51
],
[
51,
52
],
[
52,
53
],
[
45,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
59,
64
],
[
58,
65
],
[
45,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
17,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
73,
75
],
[
17,
76
],
[
76,
77
],
[
76,
78
],
[
76,
79
],
[
80,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
84,
85
],
[
83,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
80,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
92,
95
],
[
91,
96
],
[
90,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
98,
103
],
[
97,
104
],
[
17,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
110,
111
],
[
111,
112
],
[
15,
113
],
[
113,
114
],
[
0,
115
],
[
115,
116
],
[
115,
117
]
] |
[
"import java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class Main {\n\n private static BigInteger THRESHOLD_VALUE = BigInteger.valueOf(1000000000000000000L);\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = Integer.parseInt(scanner.next());\n\n // 取得と同時に乗算をすると閾値が超えた後に 0 が来た場合に WA になるため、保持する\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n long num = Long.parseLong(scanner.next());\n if (num == 0) {\n System.out.println(\"0\");\n return;\n }\n a[i] = num;\n }\n\n BigInteger ans = BigInteger.ONE;\n for (long num : a) {\n ans = ans.multiply(BigInteger.valueOf(num));\n\n if (ans.compareTo(THRESHOLD_VALUE) > 0) {\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(ans.toString());\n }\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n private static BigInteger THRESHOLD_VALUE = BigInteger.valueOf(1000000000000000000L);\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = Integer.parseInt(scanner.next());\n\n // 取得と同時に乗算をすると閾値が超えた後に 0 が来た場合に WA になるため、保持する\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n long num = Long.parseLong(scanner.next());\n if (num == 0) {\n System.out.println(\"0\");\n return;\n }\n a[i] = num;\n }\n\n BigInteger ans = BigInteger.ONE;\n for (long num : a) {\n ans = ans.multiply(BigInteger.valueOf(num));\n\n if (ans.compareTo(THRESHOLD_VALUE) > 0) {\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(ans.toString());\n }\n}",
"Main",
"private static BigInteger THRESHOLD_VALUE = BigInteger.valueOf(1000000000000000000L);",
"THRESHOLD_VALUE",
"BigInteger.valueOf(1000000000000000000L)",
"BigInteger.valueOf",
"BigInteger",
"1000000000000000000L",
"public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = Integer.parseInt(scanner.next());\n\n // 取得と同時に乗算をすると閾値が超えた後に 0 が来た場合に WA になるため、保持する\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n long num = Long.parseLong(scanner.next());\n if (num == 0) {\n System.out.println(\"0\");\n return;\n }\n a[i] = num;\n }\n\n BigInteger ans = BigInteger.ONE;\n for (long num : a) {\n ans = ans.multiply(BigInteger.valueOf(num));\n\n if (ans.compareTo(THRESHOLD_VALUE) > 0) {\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(ans.toString());\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n int N = Integer.parseInt(scanner.next());\n\n // 取得と同時に乗算をすると閾値が超えた後に 0 が来た場合に WA になるため、保持する\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n long num = Long.parseLong(scanner.next());\n if (num == 0) {\n System.out.println(\"0\");\n return;\n }\n a[i] = num;\n }\n\n BigInteger ans = BigInteger.ONE;\n for (long num : a) {\n ans = ans.multiply(BigInteger.valueOf(num));\n\n if (ans.compareTo(THRESHOLD_VALUE) > 0) {\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(ans.toString());\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int N = Integer.parseInt(scanner.next());",
"N",
"Integer.parseInt(scanner.next())",
"Integer.parseInt",
"Integer",
"scanner.next()",
"scanner.next",
"scanner",
"long[] a = new long[N];",
"a",
"new long[N]",
"N",
"for (int i = 0; i < N; i++) {\n long num = Long.parseLong(scanner.next());\n if (num == 0) {\n System.out.println(\"0\");\n return;\n }\n a[i] = num;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n long num = Long.parseLong(scanner.next());\n if (num == 0) {\n System.out.println(\"0\");\n return;\n }\n a[i] = num;\n }",
"{\n long num = Long.parseLong(scanner.next());\n if (num == 0) {\n System.out.println(\"0\");\n return;\n }\n a[i] = num;\n }",
"long num = Long.parseLong(scanner.next());",
"num",
"Long.parseLong(scanner.next())",
"Long.parseLong",
"Long",
"scanner.next()",
"scanner.next",
"scanner",
"if (num == 0) {\n System.out.println(\"0\");\n return;\n }",
"num == 0",
"num",
"0",
"{\n System.out.println(\"0\");\n return;\n }",
"System.out.println(\"0\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"0\"",
"return;",
"a[i] = num",
"a[i]",
"a",
"i",
"num",
"BigInteger ans = BigInteger.ONE;",
"ans",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"for (long num : a) {\n ans = ans.multiply(BigInteger.valueOf(num));\n\n if (ans.compareTo(THRESHOLD_VALUE) > 0) {\n System.out.println(\"-1\");\n return;\n }\n }",
"long num",
"a",
"{\n ans = ans.multiply(BigInteger.valueOf(num));\n\n if (ans.compareTo(THRESHOLD_VALUE) > 0) {\n System.out.println(\"-1\");\n return;\n }\n }",
"{\n ans = ans.multiply(BigInteger.valueOf(num));\n\n if (ans.compareTo(THRESHOLD_VALUE) > 0) {\n System.out.println(\"-1\");\n return;\n }\n }",
"ans = ans.multiply(BigInteger.valueOf(num))",
"ans",
"ans.multiply(BigInteger.valueOf(num))",
"ans.multiply",
"ans",
"BigInteger.valueOf(num)",
"BigInteger.valueOf",
"BigInteger",
"num",
"if (ans.compareTo(THRESHOLD_VALUE) > 0) {\n System.out.println(\"-1\");\n return;\n }",
"ans.compareTo(THRESHOLD_VALUE) > 0",
"ans.compareTo(THRESHOLD_VALUE)",
"ans.compareTo",
"ans",
"THRESHOLD_VALUE",
"0",
"{\n System.out.println(\"-1\");\n return;\n }",
"System.out.println(\"-1\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"return;",
"System.out.println(ans.toString())",
"System.out.println",
"System.out",
"System",
"System.out",
"ans.toString()",
"ans.toString",
"ans",
"String[] args",
"args",
"public class Main {\n\n private static BigInteger THRESHOLD_VALUE = BigInteger.valueOf(1000000000000000000L);\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = Integer.parseInt(scanner.next());\n\n // 取得と同時に乗算をすると閾値が超えた後に 0 が来た場合に WA になるため、保持する\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n long num = Long.parseLong(scanner.next());\n if (num == 0) {\n System.out.println(\"0\");\n return;\n }\n a[i] = num;\n }\n\n BigInteger ans = BigInteger.ONE;\n for (long num : a) {\n ans = ans.multiply(BigInteger.valueOf(num));\n\n if (ans.compareTo(THRESHOLD_VALUE) > 0) {\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(ans.toString());\n }\n}",
"public class Main {\n\n private static BigInteger THRESHOLD_VALUE = BigInteger.valueOf(1000000000000000000L);\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = Integer.parseInt(scanner.next());\n\n // 取得と同時に乗算をすると閾値が超えた後に 0 が来た場合に WA になるため、保持する\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n long num = Long.parseLong(scanner.next());\n if (num == 0) {\n System.out.println(\"0\");\n return;\n }\n a[i] = num;\n }\n\n BigInteger ans = BigInteger.ONE;\n for (long num : a) {\n ans = ans.multiply(BigInteger.valueOf(num));\n\n if (ans.compareTo(THRESHOLD_VALUE) > 0) {\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(ans.toString());\n }\n}",
"Main"
] |
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
private static BigInteger THRESHOLD_VALUE = BigInteger.valueOf(1000000000000000000L);
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int N = Integer.parseInt(scanner.next());
// 取得と同時に乗算をすると閾値が超えた後に 0 が来た場合に WA になるため、保持する
long[] a = new long[N];
for (int i = 0; i < N; i++) {
long num = Long.parseLong(scanner.next());
if (num == 0) {
System.out.println("0");
return;
}
a[i] = num;
}
BigInteger ans = BigInteger.ONE;
for (long num : a) {
ans = ans.multiply(BigInteger.valueOf(num));
if (ans.compareTo(THRESHOLD_VALUE) > 0) {
System.out.println("-1");
return;
}
}
System.out.println(ans.toString());
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
17,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
40,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
0,
13,
13,
4,
18,
13,
14,
2,
13,
40,
17,
30,
4,
13,
17,
29,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
38,
5,
13,
30,
4,
13,
40,
17,
29,
30,
0,
13,
4,
18,
13,
13,
18,
13,
13,
14,
2,
13,
13,
30,
4,
13,
40,
17,
29,
4,
13,
13,
23,
13,
12,
13,
30,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
132,
5
],
[
132,
6
],
[
6,
7
],
[
6,
8
],
[
132,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
11,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
28,
33
],
[
33,
34
],
[
33,
35
],
[
28,
36
],
[
36,
37
],
[
37,
38
],
[
28,
39
],
[
40,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
41,
45
],
[
45,
46
],
[
46,
47
],
[
40,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
48,
54
],
[
54,
55
],
[
54,
56
],
[
11,
57
],
[
57,
58
],
[
58,
59
],
[
11,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
60,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
11,
70
],
[
70,
71
],
[
70,
72
],
[
11,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
78,
80
],
[
73,
81
],
[
81,
82
],
[
82,
83
],
[
73,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
89,
94
],
[
86,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
85,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
109,
114
],
[
11,
115
],
[
115,
116
],
[
115,
117
],
[
9,
118
],
[
118,
119
],
[
132,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
120,
129
],
[
129,
130
],
[
0,
131
],
[
131,
132
],
[
131,
133
]
] |
[
"import java.util.Scanner;\n\npublic class Main {\n\tprivate static final long MAX = 1000000000000000000L;\n\tpublic static void main(final String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N];\n\t\tint zero = -1;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA[i] = sc.nextLong();\n\t\t\tif(A[i] == 0) zero = i;\n\t\t}\n\t\tsc.close();\n\t\tif(zero > -1) {\n\t\t\tprtln(0);\n\t\t\treturn;\n\t\t}\n\t\tlong answer = 1L;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\ttry {\n\t\t\t\tanswer = Math.multiplyExact(answer, A[i]);\n\t\t\t} catch(ArithmeticException e) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(answer > MAX) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tprtln(answer);\n\t}\n\n\tpublic static <T> void prtln(T t) { System.out.println(t); }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tprivate static final long MAX = 1000000000000000000L;\n\tpublic static void main(final String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N];\n\t\tint zero = -1;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA[i] = sc.nextLong();\n\t\t\tif(A[i] == 0) zero = i;\n\t\t}\n\t\tsc.close();\n\t\tif(zero > -1) {\n\t\t\tprtln(0);\n\t\t\treturn;\n\t\t}\n\t\tlong answer = 1L;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\ttry {\n\t\t\t\tanswer = Math.multiplyExact(answer, A[i]);\n\t\t\t} catch(ArithmeticException e) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(answer > MAX) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tprtln(answer);\n\t}\n\n\tpublic static <T> void prtln(T t) { System.out.println(t); }\n}",
"Main",
"private static final long MAX = 1000000000000000000L;",
"MAX",
"1000000000000000000L",
"public static void main(final String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N];\n\t\tint zero = -1;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA[i] = sc.nextLong();\n\t\t\tif(A[i] == 0) zero = i;\n\t\t}\n\t\tsc.close();\n\t\tif(zero > -1) {\n\t\t\tprtln(0);\n\t\t\treturn;\n\t\t}\n\t\tlong answer = 1L;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\ttry {\n\t\t\t\tanswer = Math.multiplyExact(answer, A[i]);\n\t\t\t} catch(ArithmeticException e) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(answer > MAX) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tprtln(answer);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N];\n\t\tint zero = -1;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA[i] = sc.nextLong();\n\t\t\tif(A[i] == 0) zero = i;\n\t\t}\n\t\tsc.close();\n\t\tif(zero > -1) {\n\t\t\tprtln(0);\n\t\t\treturn;\n\t\t}\n\t\tlong answer = 1L;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\ttry {\n\t\t\t\tanswer = Math.multiplyExact(answer, A[i]);\n\t\t\t} catch(ArithmeticException e) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(answer > MAX) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tprtln(answer);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] A = new long[N];",
"A",
"new long[N]",
"N",
"int zero = -1;",
"zero",
"-1",
"1",
"for(int i = 0; i < N; i++) {\n\t\t\tA[i] = sc.nextLong();\n\t\t\tif(A[i] == 0) zero = i;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tA[i] = sc.nextLong();\n\t\t\tif(A[i] == 0) zero = i;\n\t\t}",
"{\n\t\t\tA[i] = sc.nextLong();\n\t\t\tif(A[i] == 0) zero = i;\n\t\t}",
"A[i] = sc.nextLong()",
"A[i]",
"A",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(A[i] == 0) zero = i;",
"A[i] == 0",
"A[i]",
"A",
"i",
"0",
"zero = i",
"zero",
"i",
"sc.close()",
"sc.close",
"sc",
"if(zero > -1) {\n\t\t\tprtln(0);\n\t\t\treturn;\n\t\t}",
"zero > -1",
"zero",
"-1",
"1",
"{\n\t\t\tprtln(0);\n\t\t\treturn;\n\t\t}",
"prtln(0)",
"prtln",
"0",
"return;",
"long answer = 1L;",
"answer",
"1L",
"for(int i = 0; i < N; i++) {\n\t\t\ttry {\n\t\t\t\tanswer = Math.multiplyExact(answer, A[i]);\n\t\t\t} catch(ArithmeticException e) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(answer > MAX) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\ttry {\n\t\t\t\tanswer = Math.multiplyExact(answer, A[i]);\n\t\t\t} catch(ArithmeticException e) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(answer > MAX) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"{\n\t\t\ttry {\n\t\t\t\tanswer = Math.multiplyExact(answer, A[i]);\n\t\t\t} catch(ArithmeticException e) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(answer > MAX) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"try {\n\t\t\t\tanswer = Math.multiplyExact(answer, A[i]);\n\t\t\t} catch(ArithmeticException e) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}",
"catch(ArithmeticException e) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}",
"ArithmeticException e",
"{\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}",
"prtln(-1)",
"prtln",
"-1",
"1",
"return;",
"{\n\t\t\t\tanswer = Math.multiplyExact(answer, A[i]);\n\t\t\t}",
"answer = Math.multiplyExact(answer, A[i])",
"answer",
"Math.multiplyExact(answer, A[i])",
"Math.multiplyExact",
"Math",
"answer",
"A[i]",
"A",
"i",
"if(answer > MAX) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}",
"answer > MAX",
"answer",
"MAX",
"{\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}",
"prtln(-1)",
"prtln",
"-1",
"1",
"return;",
"prtln(answer)",
"prtln",
"answer",
"final String[] args",
"args",
"public static <T> void prtln(T t) { System.out.println(t); }",
"prtln",
"{ System.out.println(t); }",
"System.out.println(t)",
"System.out.println",
"System.out",
"System",
"System.out",
"t",
"T t",
"t",
"public class Main {\n\tprivate static final long MAX = 1000000000000000000L;\n\tpublic static void main(final String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N];\n\t\tint zero = -1;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA[i] = sc.nextLong();\n\t\t\tif(A[i] == 0) zero = i;\n\t\t}\n\t\tsc.close();\n\t\tif(zero > -1) {\n\t\t\tprtln(0);\n\t\t\treturn;\n\t\t}\n\t\tlong answer = 1L;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\ttry {\n\t\t\t\tanswer = Math.multiplyExact(answer, A[i]);\n\t\t\t} catch(ArithmeticException e) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(answer > MAX) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tprtln(answer);\n\t}\n\n\tpublic static <T> void prtln(T t) { System.out.println(t); }\n}",
"public class Main {\n\tprivate static final long MAX = 1000000000000000000L;\n\tpublic static void main(final String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N];\n\t\tint zero = -1;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA[i] = sc.nextLong();\n\t\t\tif(A[i] == 0) zero = i;\n\t\t}\n\t\tsc.close();\n\t\tif(zero > -1) {\n\t\t\tprtln(0);\n\t\t\treturn;\n\t\t}\n\t\tlong answer = 1L;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\ttry {\n\t\t\t\tanswer = Math.multiplyExact(answer, A[i]);\n\t\t\t} catch(ArithmeticException e) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(answer > MAX) {\n\t\t\t\tprtln(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tprtln(answer);\n\t}\n\n\tpublic static <T> void prtln(T t) { System.out.println(t); }\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
private static final long MAX = 1000000000000000000L;
public static void main(final String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long[] A = new long[N];
int zero = -1;
for(int i = 0; i < N; i++) {
A[i] = sc.nextLong();
if(A[i] == 0) zero = i;
}
sc.close();
if(zero > -1) {
prtln(0);
return;
}
long answer = 1L;
for(int i = 0; i < N; i++) {
try {
answer = Math.multiplyExact(answer, A[i]);
} catch(ArithmeticException e) {
prtln(-1);
return;
}
if(answer > MAX) {
prtln(-1);
return;
}
}
prtln(answer);
}
public static <T> void prtln(T t) { System.out.println(t); }
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
41,
13,
17,
41,
13,
4,
13,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
13,
14,
2,
18,
13,
13,
17,
30,
0,
13,
17,
3,
14,
2,
13,
17,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
18,
13,
13,
14,
2,
2,
13,
13,
2,
13,
18,
13,
13,
30,
0,
13,
40,
17,
3,
4,
13,
2,
13,
17,
23,
13,
12,
13,
30,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
29,
17,
30,
29,
4,
18,
13,
12,
13,
30,
41,
13,
20,
42,
17,
30,
38,
5,
13,
30,
4,
18,
13,
30,
41,
13,
4,
18,
13,
14,
2,
2,
2,
13,
40,
17,
2,
13,
17,
2,
13,
17,
30,
3,
4,
18,
13,
13,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
13,
4,
13,
12,
13,
30,
29,
4,
18,
4,
13,
17,
12,
13,
30,
29,
4,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
13,
23,
13,
12,
13,
30,
41,
13,
20,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
13,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
13,
23,
13,
12,
13,
30,
41,
13,
20,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
13,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
13,
23,
13,
12,
13,
30,
29,
20,
23,
13,
12,
13,
30,
29,
4,
18,
13,
17,
23,
13,
12,
13,
30,
29,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
20,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
18,
13,
13,
29,
13,
23,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
9,
10
],
[
9,
11
],
[
7,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
14,
22
],
[
22,
23
],
[
22,
24
],
[
14,
26
],
[
26,
27
],
[
26,
28
],
[
14,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
29,
34
],
[
34,
35
],
[
34,
36
],
[
29,
37
],
[
37,
38
],
[
38,
39
],
[
29,
40
],
[
41,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
46,
47
],
[
41,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
48,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
14,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
64,
69
],
[
69,
70
],
[
69,
71
],
[
64,
72
],
[
72,
73
],
[
73,
74
],
[
64,
75
],
[
76,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
76,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
82,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
92,
97
],
[
14,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
12,
103
],
[
103,
104
],
[
7,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
105,
114
],
[
114,
115
],
[
7,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
116,
125
],
[
125,
126
],
[
7,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
133,
137
],
[
137,
138
],
[
130,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
7,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
146,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
153,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
164,
165
],
[
160,
166
],
[
166,
167
],
[
168,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
171,
172
],
[
168,
173
],
[
173,
174
],
[
173,
175
],
[
168,
176
],
[
176,
177
],
[
176,
178
],
[
166,
179
],
[
179,
180
],
[
160,
181
],
[
181,
182
],
[
182,
183
],
[
181,
184
],
[
146,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
7,
189
],
[
189,
190
],
[
189,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
194,
195
],
[
193,
196
],
[
196,
197
],
[
7,
198
],
[
198,
199
],
[
198,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
202,
204
],
[
204,
205
],
[
7,
206
],
[
206,
207
],
[
206,
208
],
[
208,
209
],
[
209,
210
],
[
210,
211
],
[
211,
212
],
[
212,
213
],
[
210,
214
],
[
7,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
218,
219
],
[
219,
220
],
[
219,
221
],
[
221,
222
],
[
7,
223
],
[
223,
224
],
[
223,
225
],
[
225,
226
],
[
226,
227
],
[
227,
228
],
[
228,
229
],
[
227,
230
],
[
223,
231
],
[
231,
232
],
[
7,
233
],
[
233,
234
],
[
233,
235
],
[
235,
236
],
[
236,
237
],
[
236,
238
],
[
239,
240
],
[
239,
241
],
[
235,
242
],
[
242,
243
],
[
243,
244
],
[
244,
245
],
[
244,
246
],
[
242,
247
],
[
247,
248
],
[
247,
249
],
[
249,
250
],
[
249,
251
],
[
242,
252
],
[
252,
253
],
[
253,
254
],
[
242,
255
],
[
256,
256
],
[
256,
257
],
[
257,
258
],
[
258,
259
],
[
258,
260
],
[
257,
261
],
[
261,
262
],
[
261,
263
],
[
263,
264
],
[
263,
265
],
[
235,
266
],
[
266,
267
],
[
233,
268
],
[
268,
269
],
[
7,
270
],
[
270,
271
],
[
270,
272
],
[
272,
273
],
[
273,
274
],
[
274,
275
],
[
275,
276
],
[
274,
277
],
[
270,
278
],
[
278,
279
],
[
7,
280
],
[
280,
281
],
[
280,
282
],
[
282,
283
],
[
283,
284
],
[
283,
285
],
[
286,
287
],
[
286,
288
],
[
282,
289
],
[
289,
290
],
[
290,
291
],
[
291,
292
],
[
291,
293
],
[
289,
294
],
[
294,
295
],
[
294,
296
],
[
296,
297
],
[
296,
298
],
[
289,
299
],
[
299,
300
],
[
300,
301
],
[
289,
302
],
[
303,
303
],
[
303,
304
],
[
304,
305
],
[
305,
306
],
[
305,
307
],
[
304,
308
],
[
308,
309
],
[
308,
310
],
[
310,
311
],
[
310,
312
],
[
282,
313
],
[
313,
314
],
[
280,
315
],
[
315,
316
],
[
7,
317
],
[
317,
318
],
[
317,
319
],
[
319,
320
],
[
320,
321
],
[
321,
322
],
[
322,
323
],
[
321,
324
],
[
317,
325
],
[
325,
326
],
[
7,
327
],
[
327,
328
],
[
327,
329
],
[
329,
330
],
[
330,
331
],
[
327,
332
],
[
332,
333
],
[
7,
334
],
[
334,
335
],
[
334,
336
],
[
336,
337
],
[
337,
338
],
[
338,
339
],
[
339,
340
],
[
338,
341
],
[
334,
342
],
[
342,
343
],
[
7,
344
],
[
344,
345
],
[
344,
346
],
[
346,
347
],
[
347,
348
],
[
348,
349
],
[
349,
350
],
[
344,
351
],
[
351,
352
],
[
7,
353
],
[
353,
354
],
[
353,
355
],
[
355,
356
],
[
356,
357
],
[
356,
358
],
[
359,
360
],
[
359,
361
],
[
355,
362
],
[
362,
363
],
[
363,
364
],
[
364,
365
],
[
364,
366
],
[
362,
367
],
[
367,
368
],
[
367,
369
],
[
369,
370
],
[
369,
371
],
[
362,
372
],
[
372,
373
],
[
373,
374
],
[
362,
375
],
[
376,
376
],
[
376,
377
],
[
377,
378
],
[
378,
379
],
[
378,
380
],
[
377,
381
],
[
381,
382
],
[
381,
383
],
[
355,
384
],
[
384,
385
],
[
353,
386
],
[
386,
387
]
] |
[
"import java.util.*;\nimport java.io.*;\nclass Main{\n public static void main(String args[]){\n long test = 1000000000000000000L;\n int n = readI();\n long a[]=new long[n];\n long r=1;\n for(int i=0;i<n;i++){\n a[i]=readLong();\n if(a[i]==0){\n r=0;break;\n }\n }\n if(r!=0){\n for(int i=0;i<n;i++){\n r*=a[i];\n if(r>test||r<a[i]){\n r=-1;break;\n }\n }\n }\n pl(r+\"\");\n }\n\n static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n public static void pr(String str){\n System.out.print(str);\n }\n public static void pl(String str){\n System.out.println(str);\n }\n public static String readL(){\n try{\n return br.readLine();\n }catch(IOException e){\n e.printStackTrace();\n return \"\";\n }\n }\n public static String readS(){\n StringBuilder sb = new StringBuilder();\n while(true){\n try{\n int k = br.read();\n if(k==-1||(char)k==' '||(char)k=='\\n'){break;}\n sb.append((char)k);\n }catch(IOException e){\n e.printStackTrace();\n }\n }\n return sb.toString();\n }\n public static long readLong(){\n return Long.parseLong(readS());\n }\n public static int readI(){\n return stoi(readS());\n }\n public static String[] readSs(){\n return readL().split(\" \");\n }\n public static int[] readIs(){\n return stoi(readSs());\n }\n public static int stoi(String s){\n return Integer.parseInt(s);\n }\n public static int[] stoi(String s[]){\n int a[]=new int[s.length];\n for(int i=0;i<s.length;i++){\n a[i]=stoi(s[i]);\n }\n return a;\n }\n public static String itos(int i){\n return String.valueOf(i);\n }\n public static String[] itos(int[] a){\n String s[]=new String[a.length];\n for(int i=0;i<a.length;i++){\n s[i]=itos(a[i]);\n }\n return s;\n }\n public static String ctos(char c){\n return String.valueOf(c);\n }\n public static String cstos(char[] c){\n return new String(c);\n }\n public static char stoc(String s){\n return s.charAt(0);\n }\n public static char[] stocs(String s){\n return s.toCharArray();\n }\n public static int[] Itoi(Integer a[]){\n int[]result=new int[a.length];\n for(int i=0;i<a.length;i++){\n result[i]=a[i];\n }\n return result;\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"class Main{\n public static void main(String args[]){\n long test = 1000000000000000000L;\n int n = readI();\n long a[]=new long[n];\n long r=1;\n for(int i=0;i<n;i++){\n a[i]=readLong();\n if(a[i]==0){\n r=0;break;\n }\n }\n if(r!=0){\n for(int i=0;i<n;i++){\n r*=a[i];\n if(r>test||r<a[i]){\n r=-1;break;\n }\n }\n }\n pl(r+\"\");\n }\n\n static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n public static void pr(String str){\n System.out.print(str);\n }\n public static void pl(String str){\n System.out.println(str);\n }\n public static String readL(){\n try{\n return br.readLine();\n }catch(IOException e){\n e.printStackTrace();\n return \"\";\n }\n }\n public static String readS(){\n StringBuilder sb = new StringBuilder();\n while(true){\n try{\n int k = br.read();\n if(k==-1||(char)k==' '||(char)k=='\\n'){break;}\n sb.append((char)k);\n }catch(IOException e){\n e.printStackTrace();\n }\n }\n return sb.toString();\n }\n public static long readLong(){\n return Long.parseLong(readS());\n }\n public static int readI(){\n return stoi(readS());\n }\n public static String[] readSs(){\n return readL().split(\" \");\n }\n public static int[] readIs(){\n return stoi(readSs());\n }\n public static int stoi(String s){\n return Integer.parseInt(s);\n }\n public static int[] stoi(String s[]){\n int a[]=new int[s.length];\n for(int i=0;i<s.length;i++){\n a[i]=stoi(s[i]);\n }\n return a;\n }\n public static String itos(int i){\n return String.valueOf(i);\n }\n public static String[] itos(int[] a){\n String s[]=new String[a.length];\n for(int i=0;i<a.length;i++){\n s[i]=itos(a[i]);\n }\n return s;\n }\n public static String ctos(char c){\n return String.valueOf(c);\n }\n public static String cstos(char[] c){\n return new String(c);\n }\n public static char stoc(String s){\n return s.charAt(0);\n }\n public static char[] stocs(String s){\n return s.toCharArray();\n }\n public static int[] Itoi(Integer a[]){\n int[]result=new int[a.length];\n for(int i=0;i<a.length;i++){\n result[i]=a[i];\n }\n return result;\n }\n}",
"Main",
"static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"public static void main(String args[]){\n long test = 1000000000000000000L;\n int n = readI();\n long a[]=new long[n];\n long r=1;\n for(int i=0;i<n;i++){\n a[i]=readLong();\n if(a[i]==0){\n r=0;break;\n }\n }\n if(r!=0){\n for(int i=0;i<n;i++){\n r*=a[i];\n if(r>test||r<a[i]){\n r=-1;break;\n }\n }\n }\n pl(r+\"\");\n }",
"main",
"{\n long test = 1000000000000000000L;\n int n = readI();\n long a[]=new long[n];\n long r=1;\n for(int i=0;i<n;i++){\n a[i]=readLong();\n if(a[i]==0){\n r=0;break;\n }\n }\n if(r!=0){\n for(int i=0;i<n;i++){\n r*=a[i];\n if(r>test||r<a[i]){\n r=-1;break;\n }\n }\n }\n pl(r+\"\");\n }",
"long test = 1000000000000000000L;",
"test",
"1000000000000000000L",
"int n = readI();",
"n",
"readI()",
"readI",
"long a[]=new long[n];",
"a",
"new long[n]",
"n",
"long r=1;",
"r",
"1",
"for(int i=0;i<n;i++){\n a[i]=readLong();\n if(a[i]==0){\n r=0;break;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i]=readLong();\n if(a[i]==0){\n r=0;break;\n }\n }",
"{\n a[i]=readLong();\n if(a[i]==0){\n r=0;break;\n }\n }",
"a[i]=readLong()",
"a[i]",
"a",
"i",
"readLong()",
"readLong",
"if(a[i]==0){\n r=0;break;\n }",
"a[i]==0",
"a[i]",
"a",
"i",
"0",
"{\n r=0;break;\n }",
"r=0",
"r",
"0",
"break;",
"if(r!=0){\n for(int i=0;i<n;i++){\n r*=a[i];\n if(r>test||r<a[i]){\n r=-1;break;\n }\n }\n }",
"r!=0",
"r",
"0",
"{\n for(int i=0;i<n;i++){\n r*=a[i];\n if(r>test||r<a[i]){\n r=-1;break;\n }\n }\n }",
"for(int i=0;i<n;i++){\n r*=a[i];\n if(r>test||r<a[i]){\n r=-1;break;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n r*=a[i];\n if(r>test||r<a[i]){\n r=-1;break;\n }\n }",
"{\n r*=a[i];\n if(r>test||r<a[i]){\n r=-1;break;\n }\n }",
"r*=a[i]",
"r",
"a[i]",
"a",
"i",
"if(r>test||r<a[i]){\n r=-1;break;\n }",
"r>test||r<a[i]",
"r>test",
"r",
"test",
"r<a[i]",
"r",
"a[i]",
"a",
"i",
"{\n r=-1;break;\n }",
"r=-1",
"r",
"-1",
"1",
"break;",
"pl(r+\"\")",
"pl",
"r+\"\"",
"r",
"\"\"",
"String args[]",
"args",
"public static void pr(String str){\n System.out.print(str);\n }",
"pr",
"{\n System.out.print(str);\n }",
"System.out.print(str)",
"System.out.print",
"System.out",
"System",
"System.out",
"str",
"String str",
"str",
"public static void pl(String str){\n System.out.println(str);\n }",
"pl",
"{\n System.out.println(str);\n }",
"System.out.println(str)",
"System.out.println",
"System.out",
"System",
"System.out",
"str",
"String str",
"str",
"public static String readL(){\n try{\n return br.readLine();\n }catch(IOException e){\n e.printStackTrace();\n return \"\";\n }\n }",
"readL",
"{\n try{\n return br.readLine();\n }catch(IOException e){\n e.printStackTrace();\n return \"\";\n }\n }",
"try{\n return br.readLine();\n }catch(IOException e){\n e.printStackTrace();\n return \"\";\n }",
"catch(IOException e){\n e.printStackTrace();\n return \"\";\n }",
"IOException e",
"{\n e.printStackTrace();\n return \"\";\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"return \"\";",
"\"\"",
"{\n return br.readLine();\n }",
"return br.readLine();",
"br.readLine()",
"br.readLine",
"br",
"public static String readS(){\n StringBuilder sb = new StringBuilder();\n while(true){\n try{\n int k = br.read();\n if(k==-1||(char)k==' '||(char)k=='\\n'){break;}\n sb.append((char)k);\n }catch(IOException e){\n e.printStackTrace();\n }\n }\n return sb.toString();\n }",
"readS",
"{\n StringBuilder sb = new StringBuilder();\n while(true){\n try{\n int k = br.read();\n if(k==-1||(char)k==' '||(char)k=='\\n'){break;}\n sb.append((char)k);\n }catch(IOException e){\n e.printStackTrace();\n }\n }\n return sb.toString();\n }",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"while(true){\n try{\n int k = br.read();\n if(k==-1||(char)k==' '||(char)k=='\\n'){break;}\n sb.append((char)k);\n }catch(IOException e){\n e.printStackTrace();\n }\n }",
"true",
"{\n try{\n int k = br.read();\n if(k==-1||(char)k==' '||(char)k=='\\n'){break;}\n sb.append((char)k);\n }catch(IOException e){\n e.printStackTrace();\n }\n }",
"try{\n int k = br.read();\n if(k==-1||(char)k==' '||(char)k=='\\n'){break;}\n sb.append((char)k);\n }catch(IOException e){\n e.printStackTrace();\n }",
"catch(IOException e){\n e.printStackTrace();\n }",
"IOException e",
"{\n e.printStackTrace();\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n int k = br.read();\n if(k==-1||(char)k==' '||(char)k=='\\n'){break;}\n sb.append((char)k);\n }",
"int k = br.read();",
"k",
"br.read()",
"br.read",
"br",
"if(k==-1||(char)k==' '||(char)k=='\\n'){break;}",
"k==-1||(char)k==' '||(char)k=='\\n'",
"k==-1||(char)k==' '||(char)k=='\\n'",
"k==-1",
"k",
"-1",
"1",
"(char)k==' '",
"(char)k",
"' '",
"(char)k=='\\n'",
"(char)k",
"'\\n'",
"{break;}",
"break;",
"sb.append((char)k)",
"sb.append",
"sb",
"(char)k",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public static long readLong(){\n return Long.parseLong(readS());\n }",
"readLong",
"{\n return Long.parseLong(readS());\n }",
"return Long.parseLong(readS());",
"Long.parseLong(readS())",
"Long.parseLong",
"Long",
"readS()",
"readS",
"public static int readI(){\n return stoi(readS());\n }",
"readI",
"{\n return stoi(readS());\n }",
"return stoi(readS());",
"stoi(readS())",
"stoi",
"readS()",
"readS",
"public static String[] readSs(){\n return readL().split(\" \");\n }",
"readSs",
"{\n return readL().split(\" \");\n }",
"return readL().split(\" \");",
"readL().split(\" \")",
"readL().split",
"readL()",
"readL",
"\" \"",
"public static int[] readIs(){\n return stoi(readSs());\n }",
"readIs",
"{\n return stoi(readSs());\n }",
"return stoi(readSs());",
"stoi(readSs())",
"stoi",
"readSs()",
"readSs",
"public static int stoi(String s){\n return Integer.parseInt(s);\n }",
"stoi",
"{\n return Integer.parseInt(s);\n }",
"return Integer.parseInt(s);",
"Integer.parseInt(s)",
"Integer.parseInt",
"Integer",
"s",
"String s",
"s",
"public static int[] stoi(String s[]){\n int a[]=new int[s.length];\n for(int i=0;i<s.length;i++){\n a[i]=stoi(s[i]);\n }\n return a;\n }",
"stoi",
"{\n int a[]=new int[s.length];\n for(int i=0;i<s.length;i++){\n a[i]=stoi(s[i]);\n }\n return a;\n }",
"int a[]=new int[s.length];",
"a",
"new int[s.length]",
"s.length",
"s",
"s.length",
"for(int i=0;i<s.length;i++){\n a[i]=stoi(s[i]);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<s.length",
"i",
"s.length",
"s",
"s.length",
"i++",
"i++",
"i",
"{\n a[i]=stoi(s[i]);\n }",
"{\n a[i]=stoi(s[i]);\n }",
"a[i]=stoi(s[i])",
"a[i]",
"a",
"i",
"stoi(s[i])",
"stoi",
"s[i]",
"s",
"i",
"return a;",
"a",
"String s[]",
"s",
"public static String itos(int i){\n return String.valueOf(i);\n }",
"itos",
"{\n return String.valueOf(i);\n }",
"return String.valueOf(i);",
"String.valueOf(i)",
"String.valueOf",
"String",
"i",
"int i",
"i",
"public static String[] itos(int[] a){\n String s[]=new String[a.length];\n for(int i=0;i<a.length;i++){\n s[i]=itos(a[i]);\n }\n return s;\n }",
"itos",
"{\n String s[]=new String[a.length];\n for(int i=0;i<a.length;i++){\n s[i]=itos(a[i]);\n }\n return s;\n }",
"String s[]=new String[a.length];",
"s",
"new String[a.length]",
"a.length",
"a",
"a.length",
"for(int i=0;i<a.length;i++){\n s[i]=itos(a[i]);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"{\n s[i]=itos(a[i]);\n }",
"{\n s[i]=itos(a[i]);\n }",
"s[i]=itos(a[i])",
"s[i]",
"s",
"i",
"itos(a[i])",
"itos",
"a[i]",
"a",
"i",
"return s;",
"s",
"int[] a",
"a",
"public static String ctos(char c){\n return String.valueOf(c);\n }",
"ctos",
"{\n return String.valueOf(c);\n }",
"return String.valueOf(c);",
"String.valueOf(c)",
"String.valueOf",
"String",
"c",
"char c",
"c",
"public static String cstos(char[] c){\n return new String(c);\n }",
"cstos",
"{\n return new String(c);\n }",
"return new String(c);",
"new String(c)",
"char[] c",
"c",
"public static char stoc(String s){\n return s.charAt(0);\n }",
"stoc",
"{\n return s.charAt(0);\n }",
"return s.charAt(0);",
"s.charAt(0)",
"s.charAt",
"s",
"0",
"String s",
"s",
"public static char[] stocs(String s){\n return s.toCharArray();\n }",
"stocs",
"{\n return s.toCharArray();\n }",
"return s.toCharArray();",
"s.toCharArray()",
"s.toCharArray",
"s",
"String s",
"s",
"public static int[] Itoi(Integer a[]){\n int[]result=new int[a.length];\n for(int i=0;i<a.length;i++){\n result[i]=a[i];\n }\n return result;\n }",
"Itoi",
"{\n int[]result=new int[a.length];\n for(int i=0;i<a.length;i++){\n result[i]=a[i];\n }\n return result;\n }",
"int[]result=new int[a.length];",
"result",
"new int[a.length]",
"a.length",
"a",
"a.length",
"for(int i=0;i<a.length;i++){\n result[i]=a[i];\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"{\n result[i]=a[i];\n }",
"{\n result[i]=a[i];\n }",
"result[i]=a[i]",
"result[i]",
"result",
"i",
"a[i]",
"a",
"i",
"return result;",
"result",
"Integer a[]",
"a"
] |
import java.util.*;
import java.io.*;
class Main{
public static void main(String args[]){
long test = 1000000000000000000L;
int n = readI();
long a[]=new long[n];
long r=1;
for(int i=0;i<n;i++){
a[i]=readLong();
if(a[i]==0){
r=0;break;
}
}
if(r!=0){
for(int i=0;i<n;i++){
r*=a[i];
if(r>test||r<a[i]){
r=-1;break;
}
}
}
pl(r+"");
}
static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public static void pr(String str){
System.out.print(str);
}
public static void pl(String str){
System.out.println(str);
}
public static String readL(){
try{
return br.readLine();
}catch(IOException e){
e.printStackTrace();
return "";
}
}
public static String readS(){
StringBuilder sb = new StringBuilder();
while(true){
try{
int k = br.read();
if(k==-1||(char)k==' '||(char)k=='\n'){break;}
sb.append((char)k);
}catch(IOException e){
e.printStackTrace();
}
}
return sb.toString();
}
public static long readLong(){
return Long.parseLong(readS());
}
public static int readI(){
return stoi(readS());
}
public static String[] readSs(){
return readL().split(" ");
}
public static int[] readIs(){
return stoi(readSs());
}
public static int stoi(String s){
return Integer.parseInt(s);
}
public static int[] stoi(String s[]){
int a[]=new int[s.length];
for(int i=0;i<s.length;i++){
a[i]=stoi(s[i]);
}
return a;
}
public static String itos(int i){
return String.valueOf(i);
}
public static String[] itos(int[] a){
String s[]=new String[a.length];
for(int i=0;i<a.length;i++){
s[i]=itos(a[i]);
}
return s;
}
public static String ctos(char c){
return String.valueOf(c);
}
public static String cstos(char[] c){
return new String(c);
}
public static char stoc(String s){
return s.charAt(0);
}
public static char[] stocs(String s){
return s.toCharArray();
}
public static int[] Itoi(Integer a[]){
int[]result=new int[a.length];
for(int i=0;i<a.length;i++){
result[i]=a[i];
}
return result;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
41,
13,
20,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
4,
18,
18,
13,
13,
17,
30,
4,
18,
13,
17,
4,
18,
13,
29,
28,
13,
13,
30,
30,
0,
13,
4,
18,
13,
20,
14,
2,
4,
18,
13,
20,
17,
30,
4,
18,
13,
17,
4,
18,
13,
29,
4,
18,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
112,
11
],
[
112,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
14,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
23,
26
],
[
26,
27
],
[
27,
28
],
[
14,
29
],
[
29,
30
],
[
29,
31
],
[
14,
32
],
[
32,
33
],
[
32,
34
],
[
14,
35
],
[
35,
36
],
[
35,
37
],
[
14,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
39,
44
],
[
44,
45
],
[
44,
46
],
[
39,
47
],
[
47,
48
],
[
48,
49
],
[
39,
50
],
[
51,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
56,
57
],
[
57,
58
],
[
51,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
60,
65
],
[
59,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
66,
71
],
[
71,
72
],
[
72,
73
],
[
66,
74
],
[
14,
75
],
[
75,
76
],
[
75,
77
],
[
75,
78
],
[
79,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
79,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
88,
91
],
[
87,
92
],
[
86,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
94,
97
],
[
93,
98
],
[
98,
99
],
[
99,
100
],
[
93,
101
],
[
14,
102
],
[
102,
103
],
[
103,
104
],
[
102,
105
],
[
14,
106
],
[
106,
107
],
[
107,
108
],
[
12,
109
],
[
109,
110
],
[
0,
111
],
[
111,
112
],
[
111,
113
]
] |
[
"import java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));\n\n int n = Integer.parseInt(br.readLine());\n\n BigInteger prod = new BigInteger(\"1\");\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n String[] arr = new String[n];\n\n for (int i = 0; i < n; i++) {\n arr[i] = (st.nextToken());\n if (arr[i].equals(\"0\")) {\n pw.println(\"0\");\n pw.close();\n return;\n }\n }\n\n for (String x : arr) {\n prod = prod.multiply(new BigInteger(x));\n if (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0) {\n pw.println(\"-1\");\n pw.close();\n return;\n }\n }\n\n pw.println(prod);\n pw.close();\n }\n}",
"import java.io.*;",
"io.*",
"java",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));\n\n int n = Integer.parseInt(br.readLine());\n\n BigInteger prod = new BigInteger(\"1\");\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n String[] arr = new String[n];\n\n for (int i = 0; i < n; i++) {\n arr[i] = (st.nextToken());\n if (arr[i].equals(\"0\")) {\n pw.println(\"0\");\n pw.close();\n return;\n }\n }\n\n for (String x : arr) {\n prod = prod.multiply(new BigInteger(x));\n if (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0) {\n pw.println(\"-1\");\n pw.close();\n return;\n }\n }\n\n pw.println(prod);\n pw.close();\n }\n}",
"Main",
"public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));\n\n int n = Integer.parseInt(br.readLine());\n\n BigInteger prod = new BigInteger(\"1\");\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n String[] arr = new String[n];\n\n for (int i = 0; i < n; i++) {\n arr[i] = (st.nextToken());\n if (arr[i].equals(\"0\")) {\n pw.println(\"0\");\n pw.close();\n return;\n }\n }\n\n for (String x : arr) {\n prod = prod.multiply(new BigInteger(x));\n if (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0) {\n pw.println(\"-1\");\n pw.close();\n return;\n }\n }\n\n pw.println(prod);\n pw.close();\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));\n\n int n = Integer.parseInt(br.readLine());\n\n BigInteger prod = new BigInteger(\"1\");\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n String[] arr = new String[n];\n\n for (int i = 0; i < n; i++) {\n arr[i] = (st.nextToken());\n if (arr[i].equals(\"0\")) {\n pw.println(\"0\");\n pw.close();\n return;\n }\n }\n\n for (String x : arr) {\n prod = prod.multiply(new BigInteger(x));\n if (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0) {\n pw.println(\"-1\");\n pw.close();\n return;\n }\n }\n\n pw.println(prod);\n pw.close();\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));",
"pw",
"new PrintWriter(new OutputStreamWriter(System.out))",
"int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"BigInteger prod = new BigInteger(\"1\");",
"prod",
"new BigInteger(\"1\")",
"StringTokenizer st = new StringTokenizer(br.readLine());",
"st",
"new StringTokenizer(br.readLine())",
"String[] arr = new String[n];",
"arr",
"new String[n]",
"n",
"for (int i = 0; i < n; i++) {\n arr[i] = (st.nextToken());\n if (arr[i].equals(\"0\")) {\n pw.println(\"0\");\n pw.close();\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n arr[i] = (st.nextToken());\n if (arr[i].equals(\"0\")) {\n pw.println(\"0\");\n pw.close();\n return;\n }\n }",
"{\n arr[i] = (st.nextToken());\n if (arr[i].equals(\"0\")) {\n pw.println(\"0\");\n pw.close();\n return;\n }\n }",
"arr[i] = (st.nextToken())",
"arr[i]",
"arr",
"i",
"(st.nextToken())",
"st.nextToken",
"st",
"if (arr[i].equals(\"0\")) {\n pw.println(\"0\");\n pw.close();\n return;\n }",
"arr[i].equals(\"0\")",
"arr[i].equals",
"arr[i]",
"arr",
"i",
"\"0\"",
"{\n pw.println(\"0\");\n pw.close();\n return;\n }",
"pw.println(\"0\")",
"pw.println",
"pw",
"\"0\"",
"pw.close()",
"pw.close",
"pw",
"return;",
"for (String x : arr) {\n prod = prod.multiply(new BigInteger(x));\n if (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0) {\n pw.println(\"-1\");\n pw.close();\n return;\n }\n }",
"String x",
"arr",
"{\n prod = prod.multiply(new BigInteger(x));\n if (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0) {\n pw.println(\"-1\");\n pw.close();\n return;\n }\n }",
"{\n prod = prod.multiply(new BigInteger(x));\n if (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0) {\n pw.println(\"-1\");\n pw.close();\n return;\n }\n }",
"prod = prod.multiply(new BigInteger(x))",
"prod",
"prod.multiply(new BigInteger(x))",
"prod.multiply",
"prod",
"new BigInteger(x)",
"if (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0) {\n pw.println(\"-1\");\n pw.close();\n return;\n }",
"prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0",
"prod.compareTo(new BigInteger(\"1000000000000000000\"))",
"prod.compareTo",
"prod",
"new BigInteger(\"1000000000000000000\")",
"0",
"{\n pw.println(\"-1\");\n pw.close();\n return;\n }",
"pw.println(\"-1\")",
"pw.println",
"pw",
"\"-1\"",
"pw.close()",
"pw.close",
"pw",
"return;",
"pw.println(prod)",
"pw.println",
"pw",
"prod",
"pw.close()",
"pw.close",
"pw",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));\n\n int n = Integer.parseInt(br.readLine());\n\n BigInteger prod = new BigInteger(\"1\");\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n String[] arr = new String[n];\n\n for (int i = 0; i < n; i++) {\n arr[i] = (st.nextToken());\n if (arr[i].equals(\"0\")) {\n pw.println(\"0\");\n pw.close();\n return;\n }\n }\n\n for (String x : arr) {\n prod = prod.multiply(new BigInteger(x));\n if (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0) {\n pw.println(\"-1\");\n pw.close();\n return;\n }\n }\n\n pw.println(prod);\n pw.close();\n }\n}",
"public class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));\n\n int n = Integer.parseInt(br.readLine());\n\n BigInteger prod = new BigInteger(\"1\");\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n String[] arr = new String[n];\n\n for (int i = 0; i < n; i++) {\n arr[i] = (st.nextToken());\n if (arr[i].equals(\"0\")) {\n pw.println(\"0\");\n pw.close();\n return;\n }\n }\n\n for (String x : arr) {\n prod = prod.multiply(new BigInteger(x));\n if (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0) {\n pw.println(\"-1\");\n pw.close();\n return;\n }\n }\n\n pw.println(prod);\n pw.close();\n }\n}",
"Main"
] |
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
int n = Integer.parseInt(br.readLine());
BigInteger prod = new BigInteger("1");
StringTokenizer st = new StringTokenizer(br.readLine());
String[] arr = new String[n];
for (int i = 0; i < n; i++) {
arr[i] = (st.nextToken());
if (arr[i].equals("0")) {
pw.println("0");
pw.close();
return;
}
}
for (String x : arr) {
prod = prod.multiply(new BigInteger(x));
if (prod.compareTo(new BigInteger("1000000000000000000")) > 0) {
pw.println("-1");
pw.close();
return;
}
}
pw.println(prod);
pw.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
2,
4,
18,
13,
17,
17,
17,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
14,
2,
2,
4,
18,
13,
17,
17,
13,
18,
13,
13,
30,
0,
13,
40,
17,
14,
2,
13,
40,
17,
30,
0,
13,
2,
13,
18,
13,
13,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
14,
2,
13,
4,
18,
13,
17,
17,
0,
13,
40,
17,
4,
18,
18,
13,
13,
13,
23,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
13,
14
],
[
12,
15
],
[
12,
16
],
[
11,
17
],
[
7,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
20,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
20,
29
],
[
29,
30
],
[
29,
31
],
[
20,
32
],
[
32,
33
],
[
32,
34
],
[
20,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
36,
41
],
[
41,
42
],
[
41,
43
],
[
36,
44
],
[
44,
45
],
[
45,
46
],
[
36,
47
],
[
48,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
54,
55
],
[
53,
56
],
[
56,
57
],
[
57,
58
],
[
48,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
62,
65
],
[
62,
66
],
[
61,
67
],
[
60,
68
],
[
68,
69
],
[
68,
70
],
[
59,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
59,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
76,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
48,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
89,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
95,
102
],
[
20,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
106,
109
],
[
106,
110
],
[
103,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
20,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
115,
120
],
[
18,
121
],
[
121,
122
]
] |
[
"\timport java.util.*;\n\timport java.util.Map.Entry;\n\t \n\t \n\t class Main {\n\t\t static int mod = (int) (Math.pow(10,9)+7);\n//\t\t static int mod = (int) 998244353;\n\t\t public static void main(String[] args) {\n\t \t\n\t Scanner sc = new Scanner(System.in);\n\n\t int N = sc.nextInt();\n\t long ans=1;\n\t long[] a = new long[N];\n\t for (int i=0 ; i<N; i++) {\n\t a[i] = Long.parseLong(sc.next());\n\t if((long)(Math.pow(10, 18)/ans)<a[i]) {\n\t \tans=-1;\n\t } else if(ans!=-1){\n\t \tans=ans*a[i];\n\t }\n\t if(a[i]==0) {\n\t \tSystem.out.println(0);\n\t \treturn;\n\t }\n\t }\n\t if(ans>(long)Math.pow(10, 18))ans=-1;\n \t\tSystem.out.println(ans);\n\t }\n\t}",
"import java.util.*;",
"util.*",
"java",
"import java.util.Map.Entry;",
"Entry",
"java.util.Map",
"class Main {\n\t\t static int mod = (int) (Math.pow(10,9)+7);\n//\t\t static int mod = (int) 998244353;\n\t\t public static void main(String[] args) {\n\t \t\n\t Scanner sc = new Scanner(System.in);\n\n\t int N = sc.nextInt();\n\t long ans=1;\n\t long[] a = new long[N];\n\t for (int i=0 ; i<N; i++) {\n\t a[i] = Long.parseLong(sc.next());\n\t if((long)(Math.pow(10, 18)/ans)<a[i]) {\n\t \tans=-1;\n\t } else if(ans!=-1){\n\t \tans=ans*a[i];\n\t }\n\t if(a[i]==0) {\n\t \tSystem.out.println(0);\n\t \treturn;\n\t }\n\t }\n\t if(ans>(long)Math.pow(10, 18))ans=-1;\n \t\tSystem.out.println(ans);\n\t }\n\t}",
"Main",
"static int mod = (int) (Math.pow(10,9)+7);",
"mod",
"(int) (Math.pow(10,9)+7)",
"Math.pow(10,9)",
"Math.pow",
"Math",
"10",
"9",
"7",
"//\t\t static int mod = (int) 998244353;\n\t\t public static void main(String[] args) {\n\t \t\n\t Scanner sc = new Scanner(System.in);\n\n\t int N = sc.nextInt();\n\t long ans=1;\n\t long[] a = new long[N];\n\t for (int i=0 ; i<N; i++) {\n\t a[i] = Long.parseLong(sc.next());\n\t if((long)(Math.pow(10, 18)/ans)<a[i]) {\n\t \tans=-1;\n\t } else if(ans!=-1){\n\t \tans=ans*a[i];\n\t }\n\t if(a[i]==0) {\n\t \tSystem.out.println(0);\n\t \treturn;\n\t }\n\t }\n\t if(ans>(long)Math.pow(10, 18))ans=-1;\n \t\tSystem.out.println(ans);\n\t }",
"main",
"{\n\t \t\n\t Scanner sc = new Scanner(System.in);\n\n\t int N = sc.nextInt();\n\t long ans=1;\n\t long[] a = new long[N];\n\t for (int i=0 ; i<N; i++) {\n\t a[i] = Long.parseLong(sc.next());\n\t if((long)(Math.pow(10, 18)/ans)<a[i]) {\n\t \tans=-1;\n\t } else if(ans!=-1){\n\t \tans=ans*a[i];\n\t }\n\t if(a[i]==0) {\n\t \tSystem.out.println(0);\n\t \treturn;\n\t }\n\t }\n\t if(ans>(long)Math.pow(10, 18))ans=-1;\n \t\tSystem.out.println(ans);\n\t }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long ans=1;",
"ans",
"1",
"long[] a = new long[N];",
"a",
"new long[N]",
"N",
"for (int i=0 ; i<N; i++) {\n\t a[i] = Long.parseLong(sc.next());\n\t if((long)(Math.pow(10, 18)/ans)<a[i]) {\n\t \tans=-1;\n\t } else if(ans!=-1){\n\t \tans=ans*a[i];\n\t }\n\t if(a[i]==0) {\n\t \tSystem.out.println(0);\n\t \treturn;\n\t }\n\t }",
"int i=0 ;",
"int i=0 ;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t a[i] = Long.parseLong(sc.next());\n\t if((long)(Math.pow(10, 18)/ans)<a[i]) {\n\t \tans=-1;\n\t } else if(ans!=-1){\n\t \tans=ans*a[i];\n\t }\n\t if(a[i]==0) {\n\t \tSystem.out.println(0);\n\t \treturn;\n\t }\n\t }",
"{\n\t a[i] = Long.parseLong(sc.next());\n\t if((long)(Math.pow(10, 18)/ans)<a[i]) {\n\t \tans=-1;\n\t } else if(ans!=-1){\n\t \tans=ans*a[i];\n\t }\n\t if(a[i]==0) {\n\t \tSystem.out.println(0);\n\t \treturn;\n\t }\n\t }",
"a[i] = Long.parseLong(sc.next())",
"a[i]",
"a",
"i",
"Long.parseLong(sc.next())",
"Long.parseLong",
"Long",
"sc.next()",
"sc.next",
"sc",
"if((long)(Math.pow(10, 18)/ans)<a[i]) {\n\t \tans=-1;\n\t } else if(ans!=-1){\n\t \tans=ans*a[i];\n\t }",
"(long)(Math.pow(10, 18)/ans)<a[i]",
"(long)(Math.pow(10, 18)/ans)",
"Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"ans",
"a[i]",
"a",
"i",
"{\n\t \tans=-1;\n\t }",
"ans=-1",
"ans",
"-1",
"1",
"if(ans!=-1){\n\t \tans=ans*a[i];\n\t }",
"ans!=-1",
"ans",
"-1",
"1",
"{\n\t \tans=ans*a[i];\n\t }",
"ans=ans*a[i]",
"ans",
"ans*a[i]",
"ans",
"a[i]",
"a",
"i",
"if(a[i]==0) {\n\t \tSystem.out.println(0);\n\t \treturn;\n\t }",
"a[i]==0",
"a[i]",
"a",
"i",
"0",
"{\n\t \tSystem.out.println(0);\n\t \treturn;\n\t }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"if(ans>(long)Math.pow(10, 18))ans=-1;",
"ans>(long)Math.pow(10, 18)",
"ans",
"(long)Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"ans=-1",
"ans",
"-1",
"1",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args"
] |
import java.util.*;
import java.util.Map.Entry;
class Main {
static int mod = (int) (Math.pow(10,9)+7);
// static int mod = (int) 998244353;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long ans=1;
long[] a = new long[N];
for (int i=0 ; i<N; i++) {
a[i] = Long.parseLong(sc.next());
if((long)(Math.pow(10, 18)/ans)<a[i]) {
ans=-1;
} else if(ans!=-1){
ans=ans*a[i];
}
if(a[i]==0) {
System.out.println(0);
return;
}
}
if(ans>(long)Math.pow(10, 18))ans=-1;
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
18,
13,
13,
14,
2,
13,
17,
30,
0,
13,
17,
30,
14,
2,
13,
2,
4,
18,
13,
17,
17,
13,
30,
14,
2,
13,
17,
0,
13,
13,
30,
0,
13,
40,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
99,
11
],
[
99,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
20,
23
],
[
23,
24
],
[
24,
25
],
[
14,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
28,
33
],
[
14,
34
],
[
34,
35
],
[
34,
36
],
[
14,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
37,
42
],
[
42,
43
],
[
42,
44
],
[
37,
45
],
[
45,
46
],
[
46,
47
],
[
37,
48
],
[
49,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
52,
55
],
[
55,
56
],
[
55,
57
],
[
49,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
58,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
58,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
71,
75
],
[
70,
76
],
[
67,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
82,
84
],
[
67,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
14,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
12,
96
],
[
96,
97
],
[
0,
98
],
[
98,
99
],
[
98,
100
]
] |
[
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n public static void main(String args[]) throws IOException {\n\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\tlong n = Long.parseLong(br.readLine());\n\tString array[] = br.readLine().split(\" \");\n\tlong ans = 1;\n\tfor (int i = 0; i < n; i++) {\n\t long a = Long.parseLong(array[i]);\n\t if (a == 0) {\n\t\tans = 0;\n\t } else {\n\t\tif (ans <= (long) Math.pow(10, 18) / a) {\n\t\t if (ans >= 0)\n\t\t\tans *= a;\n\t\t} else {\n\t\t ans = -1;\n\t\t}\n\t }\n\n\t}\n\tSystem.out.println(ans);\n }\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main {\n public static void main(String args[]) throws IOException {\n\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\tlong n = Long.parseLong(br.readLine());\n\tString array[] = br.readLine().split(\" \");\n\tlong ans = 1;\n\tfor (int i = 0; i < n; i++) {\n\t long a = Long.parseLong(array[i]);\n\t if (a == 0) {\n\t\tans = 0;\n\t } else {\n\t\tif (ans <= (long) Math.pow(10, 18) / a) {\n\t\t if (ans >= 0)\n\t\t\tans *= a;\n\t\t} else {\n\t\t ans = -1;\n\t\t}\n\t }\n\n\t}\n\tSystem.out.println(ans);\n }\n}",
"Main",
"public static void main(String args[]) throws IOException {\n\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\tlong n = Long.parseLong(br.readLine());\n\tString array[] = br.readLine().split(\" \");\n\tlong ans = 1;\n\tfor (int i = 0; i < n; i++) {\n\t long a = Long.parseLong(array[i]);\n\t if (a == 0) {\n\t\tans = 0;\n\t } else {\n\t\tif (ans <= (long) Math.pow(10, 18) / a) {\n\t\t if (ans >= 0)\n\t\t\tans *= a;\n\t\t} else {\n\t\t ans = -1;\n\t\t}\n\t }\n\n\t}\n\tSystem.out.println(ans);\n }",
"main",
"{\n\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\tlong n = Long.parseLong(br.readLine());\n\tString array[] = br.readLine().split(\" \");\n\tlong ans = 1;\n\tfor (int i = 0; i < n; i++) {\n\t long a = Long.parseLong(array[i]);\n\t if (a == 0) {\n\t\tans = 0;\n\t } else {\n\t\tif (ans <= (long) Math.pow(10, 18) / a) {\n\t\t if (ans >= 0)\n\t\t\tans *= a;\n\t\t} else {\n\t\t ans = -1;\n\t\t}\n\t }\n\n\t}\n\tSystem.out.println(ans);\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"long n = Long.parseLong(br.readLine());",
"n",
"Long.parseLong(br.readLine())",
"Long.parseLong",
"Long",
"br.readLine()",
"br.readLine",
"br",
"String array[] = br.readLine().split(\" \");",
"array",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"long ans = 1;",
"ans",
"1",
"for (int i = 0; i < n; i++) {\n\t long a = Long.parseLong(array[i]);\n\t if (a == 0) {\n\t\tans = 0;\n\t } else {\n\t\tif (ans <= (long) Math.pow(10, 18) / a) {\n\t\t if (ans >= 0)\n\t\t\tans *= a;\n\t\t} else {\n\t\t ans = -1;\n\t\t}\n\t }\n\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t long a = Long.parseLong(array[i]);\n\t if (a == 0) {\n\t\tans = 0;\n\t } else {\n\t\tif (ans <= (long) Math.pow(10, 18) / a) {\n\t\t if (ans >= 0)\n\t\t\tans *= a;\n\t\t} else {\n\t\t ans = -1;\n\t\t}\n\t }\n\n\t}",
"{\n\t long a = Long.parseLong(array[i]);\n\t if (a == 0) {\n\t\tans = 0;\n\t } else {\n\t\tif (ans <= (long) Math.pow(10, 18) / a) {\n\t\t if (ans >= 0)\n\t\t\tans *= a;\n\t\t} else {\n\t\t ans = -1;\n\t\t}\n\t }\n\n\t}",
"long a = Long.parseLong(array[i]);",
"a",
"Long.parseLong(array[i])",
"Long.parseLong",
"Long",
"array[i]",
"array",
"i",
"if (a == 0) {\n\t\tans = 0;\n\t } else {\n\t\tif (ans <= (long) Math.pow(10, 18) / a) {\n\t\t if (ans >= 0)\n\t\t\tans *= a;\n\t\t} else {\n\t\t ans = -1;\n\t\t}\n\t }",
"a == 0",
"a",
"0",
"{\n\t\tans = 0;\n\t }",
"ans = 0",
"ans",
"0",
"{\n\t\tif (ans <= (long) Math.pow(10, 18) / a) {\n\t\t if (ans >= 0)\n\t\t\tans *= a;\n\t\t} else {\n\t\t ans = -1;\n\t\t}\n\t }",
"if (ans <= (long) Math.pow(10, 18) / a) {\n\t\t if (ans >= 0)\n\t\t\tans *= a;\n\t\t} else {\n\t\t ans = -1;\n\t\t}",
"ans <= (long) Math.pow(10, 18) / a",
"ans",
"(long) Math.pow(10, 18) / a",
"(long) Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"a",
"{\n\t\t if (ans >= 0)\n\t\t\tans *= a;\n\t\t}",
"if (ans >= 0)\n\t\t\tans *= a;",
"ans >= 0",
"ans",
"0",
"ans *= a",
"ans",
"a",
"{\n\t\t ans = -1;\n\t\t}",
"ans = -1",
"ans",
"-1",
"1",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String args[]",
"args",
"public class Main {\n public static void main(String args[]) throws IOException {\n\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\tlong n = Long.parseLong(br.readLine());\n\tString array[] = br.readLine().split(\" \");\n\tlong ans = 1;\n\tfor (int i = 0; i < n; i++) {\n\t long a = Long.parseLong(array[i]);\n\t if (a == 0) {\n\t\tans = 0;\n\t } else {\n\t\tif (ans <= (long) Math.pow(10, 18) / a) {\n\t\t if (ans >= 0)\n\t\t\tans *= a;\n\t\t} else {\n\t\t ans = -1;\n\t\t}\n\t }\n\n\t}\n\tSystem.out.println(ans);\n }\n}",
"public class Main {\n public static void main(String args[]) throws IOException {\n\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\tlong n = Long.parseLong(br.readLine());\n\tString array[] = br.readLine().split(\" \");\n\tlong ans = 1;\n\tfor (int i = 0; i < n; i++) {\n\t long a = Long.parseLong(array[i]);\n\t if (a == 0) {\n\t\tans = 0;\n\t } else {\n\t\tif (ans <= (long) Math.pow(10, 18) / a) {\n\t\t if (ans >= 0)\n\t\t\tans *= a;\n\t\t} else {\n\t\t ans = -1;\n\t\t}\n\t }\n\n\t}\n\tSystem.out.println(ans);\n }\n}",
"Main"
] |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
long n = Long.parseLong(br.readLine());
String array[] = br.readLine().split(" ");
long ans = 1;
for (int i = 0; i < n; i++) {
long a = Long.parseLong(array[i]);
if (a == 0) {
ans = 0;
} else {
if (ans <= (long) Math.pow(10, 18) / a) {
if (ans >= 0)
ans *= a;
} else {
ans = -1;
}
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
0,
13,
17,
0,
13,
17,
14,
2,
13,
17,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
2,
2,
13,
18,
13,
13,
18,
13,
13,
13,
2,
13,
4,
18,
13,
17,
17,
30,
0,
13,
2,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
2,
13,
17,
2,
13,
4,
18,
13,
17,
17,
4,
18,
18,
13,
13,
13,
4,
18,
18,
13,
13,
17,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
153,
5
],
[
153,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
23,
25
],
[
8,
27
],
[
27,
28
],
[
27,
29
],
[
8,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
30,
41
],
[
42,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
47,
48
],
[
48,
49
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
63,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
73,
74
],
[
73,
75
],
[
8,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
81,
86
],
[
86,
87
],
[
86,
88
],
[
81,
89
],
[
89,
90
],
[
90,
91
],
[
81,
92
],
[
93,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
97,
103
],
[
103,
104
],
[
103,
105
],
[
96,
106
],
[
95,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
110,
111
],
[
109,
112
],
[
109,
113
],
[
94,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
119,
121
],
[
94,
122
],
[
122,
123
],
[
123,
124
],
[
122,
125
],
[
8,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
133,
137
],
[
126,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
126,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
6,
150
],
[
150,
151
],
[
0,
152
],
[
152,
153
],
[
152,
154
]
] |
[
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint N = scan.nextInt();\n\t\tint f_overflow = 0;\n\t\tint f_zero = 0;\n\t\tlong[] A = new long[N];\n\t\tlong X = 1;\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA[i] = scan.nextLong();\n\t\t}\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tif(A[i] == 0) {\n\t\t\t\tX = 0; f_zero = 1;\n\t\t\t}\n\t\t}\n\n\t\tif(f_zero == 0) {\n\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\tif(X * A[i] / A[i] == X && X <= (long) Math.pow(10, 18)) {\n\t\t\t\t\tX = X * A[i];\n\t\t\t\t} else {\n\t\t\t\t\tf_overflow++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(f_overflow == 0 && X <= (long) Math.pow(10, 18)) System.out.println(X);\n\t\telse System.out.println(\"-1\");\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint N = scan.nextInt();\n\t\tint f_overflow = 0;\n\t\tint f_zero = 0;\n\t\tlong[] A = new long[N];\n\t\tlong X = 1;\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA[i] = scan.nextLong();\n\t\t}\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tif(A[i] == 0) {\n\t\t\t\tX = 0; f_zero = 1;\n\t\t\t}\n\t\t}\n\n\t\tif(f_zero == 0) {\n\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\tif(X * A[i] / A[i] == X && X <= (long) Math.pow(10, 18)) {\n\t\t\t\t\tX = X * A[i];\n\t\t\t\t} else {\n\t\t\t\t\tf_overflow++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(f_overflow == 0 && X <= (long) Math.pow(10, 18)) System.out.println(X);\n\t\telse System.out.println(\"-1\");\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint N = scan.nextInt();\n\t\tint f_overflow = 0;\n\t\tint f_zero = 0;\n\t\tlong[] A = new long[N];\n\t\tlong X = 1;\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA[i] = scan.nextLong();\n\t\t}\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tif(A[i] == 0) {\n\t\t\t\tX = 0; f_zero = 1;\n\t\t\t}\n\t\t}\n\n\t\tif(f_zero == 0) {\n\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\tif(X * A[i] / A[i] == X && X <= (long) Math.pow(10, 18)) {\n\t\t\t\t\tX = X * A[i];\n\t\t\t\t} else {\n\t\t\t\t\tf_overflow++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(f_overflow == 0 && X <= (long) Math.pow(10, 18)) System.out.println(X);\n\t\telse System.out.println(\"-1\");\n\t}",
"main",
"{\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint N = scan.nextInt();\n\t\tint f_overflow = 0;\n\t\tint f_zero = 0;\n\t\tlong[] A = new long[N];\n\t\tlong X = 1;\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA[i] = scan.nextLong();\n\t\t}\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tif(A[i] == 0) {\n\t\t\t\tX = 0; f_zero = 1;\n\t\t\t}\n\t\t}\n\n\t\tif(f_zero == 0) {\n\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\tif(X * A[i] / A[i] == X && X <= (long) Math.pow(10, 18)) {\n\t\t\t\t\tX = X * A[i];\n\t\t\t\t} else {\n\t\t\t\t\tf_overflow++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(f_overflow == 0 && X <= (long) Math.pow(10, 18)) System.out.println(X);\n\t\telse System.out.println(\"-1\");\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int N = scan.nextInt();",
"N",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int f_overflow = 0;",
"f_overflow",
"0",
"int f_zero = 0;",
"f_zero",
"0",
"long[] A = new long[N];",
"A",
"new long[N]",
"N",
"long X = 1;",
"X",
"1",
"for(int i = 0; i < N; i++) {\n\t\t\tA[i] = scan.nextLong();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tA[i] = scan.nextLong();\n\t\t}",
"{\n\t\t\tA[i] = scan.nextLong();\n\t\t}",
"A[i] = scan.nextLong()",
"A[i]",
"A",
"i",
"scan.nextLong()",
"scan.nextLong",
"scan",
"for(int i = 0; i < N; i++) {\n\t\t\tif(A[i] == 0) {\n\t\t\t\tX = 0; f_zero = 1;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tif(A[i] == 0) {\n\t\t\t\tX = 0; f_zero = 1;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(A[i] == 0) {\n\t\t\t\tX = 0; f_zero = 1;\n\t\t\t}\n\t\t}",
"if(A[i] == 0) {\n\t\t\t\tX = 0; f_zero = 1;\n\t\t\t}",
"A[i] == 0",
"A[i]",
"A",
"i",
"0",
"{\n\t\t\t\tX = 0; f_zero = 1;\n\t\t\t}",
"X = 0",
"X",
"0",
"f_zero = 1",
"f_zero",
"1",
"if(f_zero == 0) {\n\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\tif(X * A[i] / A[i] == X && X <= (long) Math.pow(10, 18)) {\n\t\t\t\t\tX = X * A[i];\n\t\t\t\t} else {\n\t\t\t\t\tf_overflow++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"f_zero == 0",
"f_zero",
"0",
"{\n\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\tif(X * A[i] / A[i] == X && X <= (long) Math.pow(10, 18)) {\n\t\t\t\t\tX = X * A[i];\n\t\t\t\t} else {\n\t\t\t\t\tf_overflow++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for (int i = 0; i < N; i++) {\n\t\t\t\tif(X * A[i] / A[i] == X && X <= (long) Math.pow(10, 18)) {\n\t\t\t\t\tX = X * A[i];\n\t\t\t\t} else {\n\t\t\t\t\tf_overflow++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\t\tif(X * A[i] / A[i] == X && X <= (long) Math.pow(10, 18)) {\n\t\t\t\t\tX = X * A[i];\n\t\t\t\t} else {\n\t\t\t\t\tf_overflow++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(X * A[i] / A[i] == X && X <= (long) Math.pow(10, 18)) {\n\t\t\t\t\tX = X * A[i];\n\t\t\t\t} else {\n\t\t\t\t\tf_overflow++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"if(X * A[i] / A[i] == X && X <= (long) Math.pow(10, 18)) {\n\t\t\t\t\tX = X * A[i];\n\t\t\t\t} else {\n\t\t\t\t\tf_overflow++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"X * A[i] / A[i] == X && X <= (long) Math.pow(10, 18)",
"X * A[i] / A[i] == X",
"X * A[i] / A[i]",
"X * A[i]",
"X",
"A[i]",
"A",
"i",
"A[i]",
"A",
"i",
"X",
"X <= (long) Math.pow(10, 18)",
"X",
"(long) Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"{\n\t\t\t\t\tX = X * A[i];\n\t\t\t\t}",
"X = X * A[i]",
"X",
"X * A[i]",
"X",
"A[i]",
"A",
"i",
"{\n\t\t\t\t\tf_overflow++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"f_overflow++",
"f_overflow",
"break;",
"if(f_overflow == 0 && X <= (long) Math.pow(10, 18)) System.out.println(X);\n\t\telse System.out.println(\"-1\");",
"f_overflow == 0 && X <= (long) Math.pow(10, 18)",
"f_overflow == 0",
"f_overflow",
"0",
"X <= (long) Math.pow(10, 18)",
"X",
"(long) Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"System.out.println(X)",
"System.out.println",
"System.out",
"System",
"System.out",
"X",
"System.out.println(\"-1\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint N = scan.nextInt();\n\t\tint f_overflow = 0;\n\t\tint f_zero = 0;\n\t\tlong[] A = new long[N];\n\t\tlong X = 1;\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA[i] = scan.nextLong();\n\t\t}\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tif(A[i] == 0) {\n\t\t\t\tX = 0; f_zero = 1;\n\t\t\t}\n\t\t}\n\n\t\tif(f_zero == 0) {\n\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\tif(X * A[i] / A[i] == X && X <= (long) Math.pow(10, 18)) {\n\t\t\t\t\tX = X * A[i];\n\t\t\t\t} else {\n\t\t\t\t\tf_overflow++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(f_overflow == 0 && X <= (long) Math.pow(10, 18)) System.out.println(X);\n\t\telse System.out.println(\"-1\");\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint N = scan.nextInt();\n\t\tint f_overflow = 0;\n\t\tint f_zero = 0;\n\t\tlong[] A = new long[N];\n\t\tlong X = 1;\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA[i] = scan.nextLong();\n\t\t}\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tif(A[i] == 0) {\n\t\t\t\tX = 0; f_zero = 1;\n\t\t\t}\n\t\t}\n\n\t\tif(f_zero == 0) {\n\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\tif(X * A[i] / A[i] == X && X <= (long) Math.pow(10, 18)) {\n\t\t\t\t\tX = X * A[i];\n\t\t\t\t} else {\n\t\t\t\t\tf_overflow++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(f_overflow == 0 && X <= (long) Math.pow(10, 18)) System.out.println(X);\n\t\telse System.out.println(\"-1\");\n\t}\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
int f_overflow = 0;
int f_zero = 0;
long[] A = new long[N];
long X = 1;
for(int i = 0; i < N; i++) {
A[i] = scan.nextLong();
}
for(int i = 0; i < N; i++) {
if(A[i] == 0) {
X = 0; f_zero = 1;
}
}
if(f_zero == 0) {
for (int i = 0; i < N; i++) {
if(X * A[i] / A[i] == X && X <= (long) Math.pow(10, 18)) {
X = X * A[i];
} else {
f_overflow++;
break;
}
}
}
if(f_overflow == 0 && X <= (long) Math.pow(10, 18)) System.out.println(X);
else System.out.println("-1");
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
17,
18,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
0,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
112,
11
],
[
112,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
14,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
32,
33
],
[
32,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
27,
38
],
[
39,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
39,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
47,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
53,
60
],
[
14,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
14,
65
],
[
65,
66
],
[
65,
67
],
[
14,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
68,
73
],
[
73,
74
],
[
73,
75
],
[
68,
76
],
[
76,
77
],
[
77,
78
],
[
68,
79
],
[
80,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
81,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
95,
96
],
[
89,
97
],
[
80,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
14,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
12,
109
],
[
109,
110
],
[
0,
111
],
[
111,
112
],
[
111,
113
]
] |
[
"import java.util.*;\nimport java.math.*;\nimport java.lang.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n Arrays.sort(a);\n\n long ans = 1;\n\n for (int i = 0; i < n; i++) {\n if (ans > 1000000000000000000L/a[i]) {\n System.out.println(-1);\n return;\n }\n ans *= a[i];\n }\n\n System.out.println(ans);\n\n }\n\n}",
"import java.util.*;",
"util.*",
"java",
"import java.math.*;",
"math.*",
"java",
"import java.lang.*;",
"lang.*",
"java",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n Arrays.sort(a);\n\n long ans = 1;\n\n for (int i = 0; i < n; i++) {\n if (ans > 1000000000000000000L/a[i]) {\n System.out.println(-1);\n return;\n }\n ans *= a[i];\n }\n\n System.out.println(ans);\n\n }\n\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n Arrays.sort(a);\n\n long ans = 1;\n\n for (int i = 0; i < n; i++) {\n if (ans > 1000000000000000000L/a[i]) {\n System.out.println(-1);\n return;\n }\n ans *= a[i];\n }\n\n System.out.println(ans);\n\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n Arrays.sort(a);\n\n long ans = 1;\n\n for (int i = 0; i < n; i++) {\n if (ans > 1000000000000000000L/a[i]) {\n System.out.println(-1);\n return;\n }\n ans *= a[i];\n }\n\n System.out.println(ans);\n\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = sc.nextLong();\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }",
"{\n a[i] = sc.nextLong();\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (a[i] == 0) {\n System.out.println(0);\n return;\n }",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"long ans = 1;",
"ans",
"1",
"for (int i = 0; i < n; i++) {\n if (ans > 1000000000000000000L/a[i]) {\n System.out.println(-1);\n return;\n }\n ans *= a[i];\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if (ans > 1000000000000000000L/a[i]) {\n System.out.println(-1);\n return;\n }\n ans *= a[i];\n }",
"{\n if (ans > 1000000000000000000L/a[i]) {\n System.out.println(-1);\n return;\n }\n ans *= a[i];\n }",
"if (ans > 1000000000000000000L/a[i]) {\n System.out.println(-1);\n return;\n }",
"ans > 1000000000000000000L/a[i]",
"ans",
"1000000000000000000L/a[i]",
"1000000000000000000L",
"a[i]",
"a",
"i",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"ans *= a[i]",
"ans",
"a[i]",
"a",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n Arrays.sort(a);\n\n long ans = 1;\n\n for (int i = 0; i < n; i++) {\n if (ans > 1000000000000000000L/a[i]) {\n System.out.println(-1);\n return;\n }\n ans *= a[i];\n }\n\n System.out.println(ans);\n\n }\n\n}",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n Arrays.sort(a);\n\n long ans = 1;\n\n for (int i = 0; i < n; i++) {\n if (ans > 1000000000000000000L/a[i]) {\n System.out.println(-1);\n return;\n }\n ans *= a[i];\n }\n\n System.out.println(ans);\n\n }\n\n}",
"Main"
] |
import java.util.*;
import java.math.*;
import java.lang.*;
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();
if (a[i] == 0) {
System.out.println(0);
return;
}
}
Arrays.sort(a);
long ans = 1;
for (int i = 0; i < n; i++) {
if (ans > 1000000000000000000L/a[i]) {
System.out.println(-1);
return;
}
ans *= a[i];
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
17,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
0,
13,
18,
13,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
29,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
115,
5
],
[
115,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
36,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
44,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
50,
57
],
[
8,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
58,
63
],
[
63,
64
],
[
63,
65
],
[
58,
66
],
[
66,
67
],
[
67,
68
],
[
58,
69
],
[
70,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
76,
78
],
[
71,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
80,
85
],
[
85,
86
],
[
79,
87
],
[
70,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
70,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
98,
103
],
[
103,
104
],
[
97,
105
],
[
8,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
6,
112
],
[
112,
113
],
[
0,
114
],
[
114,
115
],
[
114,
116
]
] |
[
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tlong all = 1;\n for(int i = 0 ; i < n ; i++) {\n\t\t\ta[i] = sc.nextLong();\n if(a[i]== 0){\n System.out.println(0);\n return;\n } \n\n\t\t}\n \n\n\n\t\tfor(int i = 0 ; i < n ; i++) {\n if(1000000000000000000L / all < a[i]) {\n System.out.println(-1);\n\t\t\treturn;\n }\n\t\t\tall *= a[i];\n if(all > 1000000000000000000L) {\n\t\t\tSystem.out.println(-1);\n\t\t\treturn;\n\t\t}\n\t\t}\n\n\t\t\tSystem.out.println(all);\n\n\n\t}\n\n}\n\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tlong all = 1;\n for(int i = 0 ; i < n ; i++) {\n\t\t\ta[i] = sc.nextLong();\n if(a[i]== 0){\n System.out.println(0);\n return;\n } \n\n\t\t}\n \n\n\n\t\tfor(int i = 0 ; i < n ; i++) {\n if(1000000000000000000L / all < a[i]) {\n System.out.println(-1);\n\t\t\treturn;\n }\n\t\t\tall *= a[i];\n if(all > 1000000000000000000L) {\n\t\t\tSystem.out.println(-1);\n\t\t\treturn;\n\t\t}\n\t\t}\n\n\t\t\tSystem.out.println(all);\n\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tlong all = 1;\n for(int i = 0 ; i < n ; i++) {\n\t\t\ta[i] = sc.nextLong();\n if(a[i]== 0){\n System.out.println(0);\n return;\n } \n\n\t\t}\n \n\n\n\t\tfor(int i = 0 ; i < n ; i++) {\n if(1000000000000000000L / all < a[i]) {\n System.out.println(-1);\n\t\t\treturn;\n }\n\t\t\tall *= a[i];\n if(all > 1000000000000000000L) {\n\t\t\tSystem.out.println(-1);\n\t\t\treturn;\n\t\t}\n\t\t}\n\n\t\t\tSystem.out.println(all);\n\n\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tlong all = 1;\n for(int i = 0 ; i < n ; i++) {\n\t\t\ta[i] = sc.nextLong();\n if(a[i]== 0){\n System.out.println(0);\n return;\n } \n\n\t\t}\n \n\n\n\t\tfor(int i = 0 ; i < n ; i++) {\n if(1000000000000000000L / all < a[i]) {\n System.out.println(-1);\n\t\t\treturn;\n }\n\t\t\tall *= a[i];\n if(all > 1000000000000000000L) {\n\t\t\tSystem.out.println(-1);\n\t\t\treturn;\n\t\t}\n\t\t}\n\n\t\t\tSystem.out.println(all);\n\n\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"long all = 1;",
"all",
"1",
"for(int i = 0 ; i < n ; i++) {\n\t\t\ta[i] = sc.nextLong();\n if(a[i]== 0){\n System.out.println(0);\n return;\n } \n\n\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = sc.nextLong();\n if(a[i]== 0){\n System.out.println(0);\n return;\n } \n\n\t\t}",
"{\n\t\t\ta[i] = sc.nextLong();\n if(a[i]== 0){\n System.out.println(0);\n return;\n } \n\n\t\t}",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(a[i]== 0){\n System.out.println(0);\n return;\n }",
"a[i]== 0",
"a[i]",
"a",
"i",
"0",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"for(int i = 0 ; i < n ; i++) {\n if(1000000000000000000L / all < a[i]) {\n System.out.println(-1);\n\t\t\treturn;\n }\n\t\t\tall *= a[i];\n if(all > 1000000000000000000L) {\n\t\t\tSystem.out.println(-1);\n\t\t\treturn;\n\t\t}\n\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(1000000000000000000L / all < a[i]) {\n System.out.println(-1);\n\t\t\treturn;\n }\n\t\t\tall *= a[i];\n if(all > 1000000000000000000L) {\n\t\t\tSystem.out.println(-1);\n\t\t\treturn;\n\t\t}\n\t\t}",
"{\n if(1000000000000000000L / all < a[i]) {\n System.out.println(-1);\n\t\t\treturn;\n }\n\t\t\tall *= a[i];\n if(all > 1000000000000000000L) {\n\t\t\tSystem.out.println(-1);\n\t\t\treturn;\n\t\t}\n\t\t}",
"if(1000000000000000000L / all < a[i]) {\n System.out.println(-1);\n\t\t\treturn;\n }",
"1000000000000000000L / all < a[i]",
"1000000000000000000L / all",
"1000000000000000000L",
"all",
"a[i]",
"a",
"i",
"{\n System.out.println(-1);\n\t\t\treturn;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"all *= a[i]",
"all",
"a[i]",
"a",
"i",
"if(all > 1000000000000000000L) {\n\t\t\tSystem.out.println(-1);\n\t\t\treturn;\n\t\t}",
"all > 1000000000000000000L",
"all",
"1000000000000000000L",
"{\n\t\t\tSystem.out.println(-1);\n\t\t\treturn;\n\t\t}",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"System.out.println(all)",
"System.out.println",
"System.out",
"System",
"System.out",
"all",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tlong all = 1;\n for(int i = 0 ; i < n ; i++) {\n\t\t\ta[i] = sc.nextLong();\n if(a[i]== 0){\n System.out.println(0);\n return;\n } \n\n\t\t}\n \n\n\n\t\tfor(int i = 0 ; i < n ; i++) {\n if(1000000000000000000L / all < a[i]) {\n System.out.println(-1);\n\t\t\treturn;\n }\n\t\t\tall *= a[i];\n if(all > 1000000000000000000L) {\n\t\t\tSystem.out.println(-1);\n\t\t\treturn;\n\t\t}\n\t\t}\n\n\t\t\tSystem.out.println(all);\n\n\n\t}\n\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tlong all = 1;\n for(int i = 0 ; i < n ; i++) {\n\t\t\ta[i] = sc.nextLong();\n if(a[i]== 0){\n System.out.println(0);\n return;\n } \n\n\t\t}\n \n\n\n\t\tfor(int i = 0 ; i < n ; i++) {\n if(1000000000000000000L / all < a[i]) {\n System.out.println(-1);\n\t\t\treturn;\n }\n\t\t\tall *= a[i];\n if(all > 1000000000000000000L) {\n\t\t\tSystem.out.println(-1);\n\t\t\treturn;\n\t\t}\n\t\t}\n\n\t\t\tSystem.out.println(all);\n\n\n\t}\n\n}",
"Main"
] |
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];
long all = 1;
for(int i = 0 ; i < n ; i++) {
a[i] = sc.nextLong();
if(a[i]== 0){
System.out.println(0);
return;
}
}
for(int i = 0 ; i < n ; i++) {
if(1000000000000000000L / all < a[i]) {
System.out.println(-1);
return;
}
all *= a[i];
if(all > 1000000000000000000L) {
System.out.println(-1);
return;
}
}
System.out.println(all);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
4,
18,
17,
13,
30,
4,
18,
18,
13,
13,
17,
29,
30,
4,
18,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
17,
17,
41,
13,
4,
18,
13,
17,
28,
13,
13,
30,
30,
14,
2,
4,
18,
13,
13,
17,
30,
3,
30,
0,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
4,
18,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
139,
20
],
[
139,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
23,
32
],
[
32,
33
],
[
33,
34
],
[
23,
35
],
[
35,
36
],
[
35,
37
],
[
23,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
38,
43
],
[
43,
44
],
[
43,
45
],
[
38,
46
],
[
46,
47
],
[
47,
48
],
[
38,
49
],
[
50,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
50,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
57,
60
],
[
56,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
62,
67
],
[
61,
68
],
[
56,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
70,
73
],
[
23,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
79,
80
],
[
80,
81
],
[
79,
82
],
[
79,
83
],
[
23,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
23,
90
],
[
90,
91
],
[
90,
92
],
[
90,
93
],
[
94,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
96,
101
],
[
95,
102
],
[
102,
103
],
[
95,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
108,
109
],
[
107,
110
],
[
23,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
113,
116
],
[
112,
117
],
[
111,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
111,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
126,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
21,
136
],
[
136,
137
],
[
0,
138
],
[
138,
139
],
[
138,
140
]
] |
[
"import java.math.BigDecimal;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n sc.nextLine();\n List<BigDecimal> list = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n String value = sc.next();\n if(\"0\".equals(value)) {\n System.out.println(\"0\");\n return;\n } else {\n list.add(new BigDecimal(value));\n }\n\n }\n BigDecimal x = BigDecimal.valueOf(Math.pow(10, 18));\n BigDecimal result = BigDecimal.valueOf(1);\n for (BigDecimal decimal : list) {\n if (result.compareTo(x) > 0) {\n break;\n } else {\n result = result.multiply(decimal);\n }\n }\n if (result.compareTo(x) > 0) {\n System.out.println(\"-1\");\n } else {\n System.out.println(result.stripTrailingZeros().toPlainString());\n }\n }\n}",
"import java.math.BigDecimal;",
"BigDecimal",
"java.math",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.stream.Collectors;",
"Collectors",
"java.util.stream",
"import java.util.stream.IntStream;",
"IntStream",
"java.util.stream",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n sc.nextLine();\n List<BigDecimal> list = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n String value = sc.next();\n if(\"0\".equals(value)) {\n System.out.println(\"0\");\n return;\n } else {\n list.add(new BigDecimal(value));\n }\n\n }\n BigDecimal x = BigDecimal.valueOf(Math.pow(10, 18));\n BigDecimal result = BigDecimal.valueOf(1);\n for (BigDecimal decimal : list) {\n if (result.compareTo(x) > 0) {\n break;\n } else {\n result = result.multiply(decimal);\n }\n }\n if (result.compareTo(x) > 0) {\n System.out.println(\"-1\");\n } else {\n System.out.println(result.stripTrailingZeros().toPlainString());\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n sc.nextLine();\n List<BigDecimal> list = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n String value = sc.next();\n if(\"0\".equals(value)) {\n System.out.println(\"0\");\n return;\n } else {\n list.add(new BigDecimal(value));\n }\n\n }\n BigDecimal x = BigDecimal.valueOf(Math.pow(10, 18));\n BigDecimal result = BigDecimal.valueOf(1);\n for (BigDecimal decimal : list) {\n if (result.compareTo(x) > 0) {\n break;\n } else {\n result = result.multiply(decimal);\n }\n }\n if (result.compareTo(x) > 0) {\n System.out.println(\"-1\");\n } else {\n System.out.println(result.stripTrailingZeros().toPlainString());\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n sc.nextLine();\n List<BigDecimal> list = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n String value = sc.next();\n if(\"0\".equals(value)) {\n System.out.println(\"0\");\n return;\n } else {\n list.add(new BigDecimal(value));\n }\n\n }\n BigDecimal x = BigDecimal.valueOf(Math.pow(10, 18));\n BigDecimal result = BigDecimal.valueOf(1);\n for (BigDecimal decimal : list) {\n if (result.compareTo(x) > 0) {\n break;\n } else {\n result = result.multiply(decimal);\n }\n }\n if (result.compareTo(x) > 0) {\n System.out.println(\"-1\");\n } else {\n System.out.println(result.stripTrailingZeros().toPlainString());\n }\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"sc.nextLine()",
"sc.nextLine",
"sc",
"List<BigDecimal> list = new ArrayList<>();",
"list",
"new ArrayList<>()",
"for (int i = 0; i < n; i++) {\n String value = sc.next();\n if(\"0\".equals(value)) {\n System.out.println(\"0\");\n return;\n } else {\n list.add(new BigDecimal(value));\n }\n\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n String value = sc.next();\n if(\"0\".equals(value)) {\n System.out.println(\"0\");\n return;\n } else {\n list.add(new BigDecimal(value));\n }\n\n }",
"{\n String value = sc.next();\n if(\"0\".equals(value)) {\n System.out.println(\"0\");\n return;\n } else {\n list.add(new BigDecimal(value));\n }\n\n }",
"String value = sc.next();",
"value",
"sc.next()",
"sc.next",
"sc",
"if(\"0\".equals(value)) {\n System.out.println(\"0\");\n return;\n } else {\n list.add(new BigDecimal(value));\n }",
"\"0\".equals(value)",
"\"0\".equals",
"\"0\"",
"value",
"{\n System.out.println(\"0\");\n return;\n }",
"System.out.println(\"0\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"0\"",
"return;",
"{\n list.add(new BigDecimal(value));\n }",
"list.add(new BigDecimal(value))",
"list.add",
"list",
"new BigDecimal(value)",
"BigDecimal x = BigDecimal.valueOf(Math.pow(10, 18));",
"x",
"BigDecimal.valueOf(Math.pow(10, 18))",
"BigDecimal.valueOf",
"BigDecimal",
"Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"BigDecimal result = BigDecimal.valueOf(1);",
"result",
"BigDecimal.valueOf(1)",
"BigDecimal.valueOf",
"BigDecimal",
"1",
"for (BigDecimal decimal : list) {\n if (result.compareTo(x) > 0) {\n break;\n } else {\n result = result.multiply(decimal);\n }\n }",
"BigDecimal decimal",
"list",
"{\n if (result.compareTo(x) > 0) {\n break;\n } else {\n result = result.multiply(decimal);\n }\n }",
"{\n if (result.compareTo(x) > 0) {\n break;\n } else {\n result = result.multiply(decimal);\n }\n }",
"if (result.compareTo(x) > 0) {\n break;\n } else {\n result = result.multiply(decimal);\n }",
"result.compareTo(x) > 0",
"result.compareTo(x)",
"result.compareTo",
"result",
"x",
"0",
"{\n break;\n }",
"break;",
"{\n result = result.multiply(decimal);\n }",
"result = result.multiply(decimal)",
"result",
"result.multiply(decimal)",
"result.multiply",
"result",
"decimal",
"if (result.compareTo(x) > 0) {\n System.out.println(\"-1\");\n } else {\n System.out.println(result.stripTrailingZeros().toPlainString());\n }",
"result.compareTo(x) > 0",
"result.compareTo(x)",
"result.compareTo",
"result",
"x",
"0",
"{\n System.out.println(\"-1\");\n }",
"System.out.println(\"-1\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"{\n System.out.println(result.stripTrailingZeros().toPlainString());\n }",
"System.out.println(result.stripTrailingZeros().toPlainString())",
"System.out.println",
"System.out",
"System",
"System.out",
"result.stripTrailingZeros().toPlainString()",
"result.stripTrailingZeros().toPlainString",
"result.stripTrailingZeros()",
"result.stripTrailingZeros",
"result",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n sc.nextLine();\n List<BigDecimal> list = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n String value = sc.next();\n if(\"0\".equals(value)) {\n System.out.println(\"0\");\n return;\n } else {\n list.add(new BigDecimal(value));\n }\n\n }\n BigDecimal x = BigDecimal.valueOf(Math.pow(10, 18));\n BigDecimal result = BigDecimal.valueOf(1);\n for (BigDecimal decimal : list) {\n if (result.compareTo(x) > 0) {\n break;\n } else {\n result = result.multiply(decimal);\n }\n }\n if (result.compareTo(x) > 0) {\n System.out.println(\"-1\");\n } else {\n System.out.println(result.stripTrailingZeros().toPlainString());\n }\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n sc.nextLine();\n List<BigDecimal> list = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n String value = sc.next();\n if(\"0\".equals(value)) {\n System.out.println(\"0\");\n return;\n } else {\n list.add(new BigDecimal(value));\n }\n\n }\n BigDecimal x = BigDecimal.valueOf(Math.pow(10, 18));\n BigDecimal result = BigDecimal.valueOf(1);\n for (BigDecimal decimal : list) {\n if (result.compareTo(x) > 0) {\n break;\n } else {\n result = result.multiply(decimal);\n }\n }\n if (result.compareTo(x) > 0) {\n System.out.println(\"-1\");\n } else {\n System.out.println(result.stripTrailingZeros().toPlainString());\n }\n }\n}",
"Main"
] |
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
sc.nextLine();
List<BigDecimal> list = new ArrayList<>();
for (int i = 0; i < n; i++) {
String value = sc.next();
if("0".equals(value)) {
System.out.println("0");
return;
} else {
list.add(new BigDecimal(value));
}
}
BigDecimal x = BigDecimal.valueOf(Math.pow(10, 18));
BigDecimal result = BigDecimal.valueOf(1);
for (BigDecimal decimal : list) {
if (result.compareTo(x) > 0) {
break;
} else {
result = result.multiply(decimal);
}
}
if (result.compareTo(x) > 0) {
System.out.println("-1");
} else {
System.out.println(result.stripTrailingZeros().toPlainString());
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
20,
13,
41,
13,
4,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
14,
2,
18,
13,
17,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
13,
29,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
4,
18,
13,
29,
0,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
125,
8
],
[
125,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
11,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
29,
32
],
[
29,
33
],
[
11,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
34,
39
],
[
39,
40
],
[
39,
41
],
[
34,
42
],
[
42,
43
],
[
43,
44
],
[
34,
45
],
[
46,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
52,
53
],
[
11,
54
],
[
54,
55
],
[
55,
56
],
[
54,
57
],
[
11,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
58,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
65,
70
],
[
64,
71
],
[
71,
72
],
[
72,
73
],
[
64,
74
],
[
11,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
75,
80
],
[
80,
81
],
[
80,
82
],
[
75,
83
],
[
83,
84
],
[
84,
85
],
[
75,
86
],
[
87,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
88,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
102,
103
],
[
96,
104
],
[
104,
105
],
[
105,
106
],
[
96,
107
],
[
87,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
11,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
113,
118
],
[
11,
119
],
[
119,
120
],
[
120,
121
],
[
9,
122
],
[
122,
123
],
[
0,
124
],
[
124,
125
],
[
124,
126
]
] |
[
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n\n int a = scan.nextInt();\n long result = 1;\n long[] c = new long[a];\n long b = (long) Math.pow(10,18);\n\n for (int i = 0; i < a; i++) {\n c[i] = scan.nextLong();\n\n }\n\n Arrays.sort(c);\n if (c[0] == 0) {\n System.out.println(0);\n scan.close();\n return;\n }\n\n for (int j = 0; j < a; j++) {\n if (result > b/c[j]) {\n System.out.println(-1);\n scan.close();\n return;\n }\n result *= c[j];\n }\n\n System.out.println(result);\n scan.close();\n\n }\n\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n\n int a = scan.nextInt();\n long result = 1;\n long[] c = new long[a];\n long b = (long) Math.pow(10,18);\n\n for (int i = 0; i < a; i++) {\n c[i] = scan.nextLong();\n\n }\n\n Arrays.sort(c);\n if (c[0] == 0) {\n System.out.println(0);\n scan.close();\n return;\n }\n\n for (int j = 0; j < a; j++) {\n if (result > b/c[j]) {\n System.out.println(-1);\n scan.close();\n return;\n }\n result *= c[j];\n }\n\n System.out.println(result);\n scan.close();\n\n }\n\n}",
"Main",
"public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n\n int a = scan.nextInt();\n long result = 1;\n long[] c = new long[a];\n long b = (long) Math.pow(10,18);\n\n for (int i = 0; i < a; i++) {\n c[i] = scan.nextLong();\n\n }\n\n Arrays.sort(c);\n if (c[0] == 0) {\n System.out.println(0);\n scan.close();\n return;\n }\n\n for (int j = 0; j < a; j++) {\n if (result > b/c[j]) {\n System.out.println(-1);\n scan.close();\n return;\n }\n result *= c[j];\n }\n\n System.out.println(result);\n scan.close();\n\n }",
"main",
"{\n Scanner scan = new Scanner(System.in);\n\n int a = scan.nextInt();\n long result = 1;\n long[] c = new long[a];\n long b = (long) Math.pow(10,18);\n\n for (int i = 0; i < a; i++) {\n c[i] = scan.nextLong();\n\n }\n\n Arrays.sort(c);\n if (c[0] == 0) {\n System.out.println(0);\n scan.close();\n return;\n }\n\n for (int j = 0; j < a; j++) {\n if (result > b/c[j]) {\n System.out.println(-1);\n scan.close();\n return;\n }\n result *= c[j];\n }\n\n System.out.println(result);\n scan.close();\n\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int a = scan.nextInt();",
"a",
"scan.nextInt()",
"scan.nextInt",
"scan",
"long result = 1;",
"result",
"1",
"long[] c = new long[a];",
"c",
"new long[a]",
"a",
"long b = (long) Math.pow(10,18);",
"b",
"(long) Math.pow(10,18)",
"Math.pow",
"Math",
"10",
"18",
"for (int i = 0; i < a; i++) {\n c[i] = scan.nextLong();\n\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < a",
"i",
"a",
"i++",
"i++",
"i",
"{\n c[i] = scan.nextLong();\n\n }",
"{\n c[i] = scan.nextLong();\n\n }",
"c[i] = scan.nextLong()",
"c[i]",
"c",
"i",
"scan.nextLong()",
"scan.nextLong",
"scan",
"Arrays.sort(c)",
"Arrays.sort",
"Arrays",
"c",
"if (c[0] == 0) {\n System.out.println(0);\n scan.close();\n return;\n }",
"c[0] == 0",
"c[0]",
"c",
"0",
"0",
"{\n System.out.println(0);\n scan.close();\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"scan.close()",
"scan.close",
"scan",
"return;",
"for (int j = 0; j < a; j++) {\n if (result > b/c[j]) {\n System.out.println(-1);\n scan.close();\n return;\n }\n result *= c[j];\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < a",
"j",
"a",
"j++",
"j++",
"j",
"{\n if (result > b/c[j]) {\n System.out.println(-1);\n scan.close();\n return;\n }\n result *= c[j];\n }",
"{\n if (result > b/c[j]) {\n System.out.println(-1);\n scan.close();\n return;\n }\n result *= c[j];\n }",
"if (result > b/c[j]) {\n System.out.println(-1);\n scan.close();\n return;\n }",
"result > b/c[j]",
"result",
"b/c[j]",
"b",
"c[j]",
"c",
"j",
"{\n System.out.println(-1);\n scan.close();\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"scan.close()",
"scan.close",
"scan",
"return;",
"result *= c[j]",
"result",
"c[j]",
"c",
"j",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"scan.close()",
"scan.close",
"scan",
"String[] args",
"args",
"public class Main {\n\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n\n int a = scan.nextInt();\n long result = 1;\n long[] c = new long[a];\n long b = (long) Math.pow(10,18);\n\n for (int i = 0; i < a; i++) {\n c[i] = scan.nextLong();\n\n }\n\n Arrays.sort(c);\n if (c[0] == 0) {\n System.out.println(0);\n scan.close();\n return;\n }\n\n for (int j = 0; j < a; j++) {\n if (result > b/c[j]) {\n System.out.println(-1);\n scan.close();\n return;\n }\n result *= c[j];\n }\n\n System.out.println(result);\n scan.close();\n\n }\n\n}",
"public class Main {\n\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n\n int a = scan.nextInt();\n long result = 1;\n long[] c = new long[a];\n long b = (long) Math.pow(10,18);\n\n for (int i = 0; i < a; i++) {\n c[i] = scan.nextLong();\n\n }\n\n Arrays.sort(c);\n if (c[0] == 0) {\n System.out.println(0);\n scan.close();\n return;\n }\n\n for (int j = 0; j < a; j++) {\n if (result > b/c[j]) {\n System.out.println(-1);\n scan.close();\n return;\n }\n result *= c[j];\n }\n\n System.out.println(result);\n scan.close();\n\n }\n\n}",
"Main"
] |
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int a = scan.nextInt();
long result = 1;
long[] c = new long[a];
long b = (long) Math.pow(10,18);
for (int i = 0; i < a; i++) {
c[i] = scan.nextLong();
}
Arrays.sort(c);
if (c[0] == 0) {
System.out.println(0);
scan.close();
return;
}
for (int j = 0; j < a; j++) {
if (result > b/c[j]) {
System.out.println(-1);
scan.close();
return;
}
result *= c[j];
}
System.out.println(result);
scan.close();
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
0,
13,
17,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
17,
18,
13,
13,
0,
13,
2,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
17,
29,
4,
18,
18,
13,
13,
13,
23,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
8,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
32,
33
],
[
32,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
27,
38
],
[
39,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
39,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
47,
53
],
[
53,
54
],
[
53,
55
],
[
8,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
61,
66
],
[
60,
67
],
[
8,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
68,
73
],
[
73,
74
],
[
73,
75
],
[
68,
76
],
[
76,
77
],
[
77,
78
],
[
68,
79
],
[
80,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
81,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
81,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
96,
103
],
[
8,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
6,
110
],
[
110,
111
]
] |
[
"import java.util.Scanner;\n \nclass Main { \n public static void main(String[] args) { \n Scanner in = new Scanner(System.in);\n int n = in.nextInt(),zero=0;\n long[] arr = new long[n];\n long ans = 1;\n for(int i=0;i<n;++i) {\n arr[i] = in.nextLong();\n if(arr[i]==0) zero=1;\n }\n if(zero==1) {\n System.out.println(\"0\");\n return ;\n }\n \n for(int i=0;i<n;++i) {\n if(ans <= 1000000000000000000L/arr[i]) ans = ans*arr[i];\n else {\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(ans);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main { \n public static void main(String[] args) { \n Scanner in = new Scanner(System.in);\n int n = in.nextInt(),zero=0;\n long[] arr = new long[n];\n long ans = 1;\n for(int i=0;i<n;++i) {\n arr[i] = in.nextLong();\n if(arr[i]==0) zero=1;\n }\n if(zero==1) {\n System.out.println(\"0\");\n return ;\n }\n \n for(int i=0;i<n;++i) {\n if(ans <= 1000000000000000000L/arr[i]) ans = ans*arr[i];\n else {\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) { \n Scanner in = new Scanner(System.in);\n int n = in.nextInt(),zero=0;\n long[] arr = new long[n];\n long ans = 1;\n for(int i=0;i<n;++i) {\n arr[i] = in.nextLong();\n if(arr[i]==0) zero=1;\n }\n if(zero==1) {\n System.out.println(\"0\");\n return ;\n }\n \n for(int i=0;i<n;++i) {\n if(ans <= 1000000000000000000L/arr[i]) ans = ans*arr[i];\n else {\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(ans);\n }",
"main",
"{ \n Scanner in = new Scanner(System.in);\n int n = in.nextInt(),zero=0;\n long[] arr = new long[n];\n long ans = 1;\n for(int i=0;i<n;++i) {\n arr[i] = in.nextLong();\n if(arr[i]==0) zero=1;\n }\n if(zero==1) {\n System.out.println(\"0\");\n return ;\n }\n \n for(int i=0;i<n;++i) {\n if(ans <= 1000000000000000000L/arr[i]) ans = ans*arr[i];\n else {\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(ans);\n }",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int n = in.nextInt()",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"zero=0;",
"zero",
"0",
"long[] arr = new long[n];",
"arr",
"new long[n]",
"n",
"long ans = 1;",
"ans",
"1",
"for(int i=0;i<n;++i) {\n arr[i] = in.nextLong();\n if(arr[i]==0) zero=1;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"++i",
"++i",
"i",
"{\n arr[i] = in.nextLong();\n if(arr[i]==0) zero=1;\n }",
"{\n arr[i] = in.nextLong();\n if(arr[i]==0) zero=1;\n }",
"arr[i] = in.nextLong()",
"arr[i]",
"arr",
"i",
"in.nextLong()",
"in.nextLong",
"in",
"if(arr[i]==0) zero=1;",
"arr[i]==0",
"arr[i]",
"arr",
"i",
"0",
"zero=1",
"zero",
"1",
"if(zero==1) {\n System.out.println(\"0\");\n return ;\n }",
"zero==1",
"zero",
"1",
"{\n System.out.println(\"0\");\n return ;\n }",
"System.out.println(\"0\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"0\"",
"return ;",
"for(int i=0;i<n;++i) {\n if(ans <= 1000000000000000000L/arr[i]) ans = ans*arr[i];\n else {\n System.out.println(\"-1\");\n return;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"++i",
"++i",
"i",
"{\n if(ans <= 1000000000000000000L/arr[i]) ans = ans*arr[i];\n else {\n System.out.println(\"-1\");\n return;\n }\n }",
"{\n if(ans <= 1000000000000000000L/arr[i]) ans = ans*arr[i];\n else {\n System.out.println(\"-1\");\n return;\n }\n }",
"if(ans <= 1000000000000000000L/arr[i]) ans = ans*arr[i];\n else {\n System.out.println(\"-1\");\n return;\n }",
"ans <= 1000000000000000000L/arr[i]",
"ans",
"1000000000000000000L/arr[i]",
"1000000000000000000L",
"arr[i]",
"arr",
"i",
"ans = ans*arr[i]",
"ans",
"ans*arr[i]",
"ans",
"arr[i]",
"arr",
"i",
"{\n System.out.println(\"-1\");\n return;\n }",
"System.out.println(\"-1\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"return;",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args"
] |
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt(),zero=0;
long[] arr = new long[n];
long ans = 1;
for(int i=0;i<n;++i) {
arr[i] = in.nextLong();
if(arr[i]==0) zero=1;
}
if(zero==1) {
System.out.println("0");
return ;
}
for(int i=0;i<n;++i) {
if(ans <= 1000000000000000000L/arr[i]) ans = ans*arr[i];
else {
System.out.println("-1");
return;
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
38,
5,
13,
30,
4,
18,
18,
13,
13,
40,
17,
4,
18,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
18,
13,
13,
28,
13,
13,
30,
30,
0,
13,
4,
18,
13,
13,
14,
4,
18,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
17,
29,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
29,
4,
18,
18,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
131,
17
],
[
131,
18
],
[
18,
19
],
[
18,
20
],
[
131,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
28,
33
],
[
33,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
24,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
38,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
45,
46
],
[
38,
47
],
[
47,
48
],
[
47,
49
],
[
38,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
63,
66
],
[
66,
67
],
[
67,
68
],
[
38,
69
],
[
69,
70
],
[
70,
71
],
[
69,
72
],
[
38,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
38,
78
],
[
78,
79
],
[
78,
80
],
[
78,
81
],
[
82,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
82,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
93,
94
],
[
93,
95
],
[
89,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
96,
103
],
[
89,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
106,
109
],
[
105,
110
],
[
104,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
112,
117
],
[
117,
118
],
[
111,
119
],
[
38,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
125,
126
],
[
126,
127
],
[
21,
128
],
[
128,
129
],
[
0,
130
],
[
130,
131
],
[
130,
132
]
] |
[
"import java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tstatic BigInteger limit = new BigInteger(\"1000000000000000000\");\n\n\tpublic static void main(String[] args) {\n\t\ttry (Scanner sc = new Scanner(System.in);) {\n\t\t\tint num = sc.nextInt();\n\t\t\tList<BigInteger> values = new ArrayList<BigInteger>();\n\t\t\tfor (int i = 0; i < num; i++) {\n\t\t\t\tvalues.add(sc.nextBigInteger());\n\t\t\t}\n\t\t\tCollections.sort(values);\n\n\t\t\tBigInteger result = BigInteger.ONE;\n\t\t\tfor (BigInteger value : values) {\n\t\t\t\tresult = result.multiply(value);\n\n\t\t\t\tif (result.equals(BigInteger.ZERO)) {\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\treturn;\n\t\t\t\t} else if (limit.compareTo(result) < 0) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println(result.toString());\n\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(-1);\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Collections;",
"Collections",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tstatic BigInteger limit = new BigInteger(\"1000000000000000000\");\n\n\tpublic static void main(String[] args) {\n\t\ttry (Scanner sc = new Scanner(System.in);) {\n\t\t\tint num = sc.nextInt();\n\t\t\tList<BigInteger> values = new ArrayList<BigInteger>();\n\t\t\tfor (int i = 0; i < num; i++) {\n\t\t\t\tvalues.add(sc.nextBigInteger());\n\t\t\t}\n\t\t\tCollections.sort(values);\n\n\t\t\tBigInteger result = BigInteger.ONE;\n\t\t\tfor (BigInteger value : values) {\n\t\t\t\tresult = result.multiply(value);\n\n\t\t\t\tif (result.equals(BigInteger.ZERO)) {\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\treturn;\n\t\t\t\t} else if (limit.compareTo(result) < 0) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println(result.toString());\n\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(-1);\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}\n}",
"Main",
"static BigInteger limit = new BigInteger(\"1000000000000000000\");",
"limit",
"new BigInteger(\"1000000000000000000\")",
"public static void main(String[] args) {\n\t\ttry (Scanner sc = new Scanner(System.in);) {\n\t\t\tint num = sc.nextInt();\n\t\t\tList<BigInteger> values = new ArrayList<BigInteger>();\n\t\t\tfor (int i = 0; i < num; i++) {\n\t\t\t\tvalues.add(sc.nextBigInteger());\n\t\t\t}\n\t\t\tCollections.sort(values);\n\n\t\t\tBigInteger result = BigInteger.ONE;\n\t\t\tfor (BigInteger value : values) {\n\t\t\t\tresult = result.multiply(value);\n\n\t\t\t\tif (result.equals(BigInteger.ZERO)) {\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\treturn;\n\t\t\t\t} else if (limit.compareTo(result) < 0) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println(result.toString());\n\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(-1);\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}",
"main",
"{\n\t\ttry (Scanner sc = new Scanner(System.in);) {\n\t\t\tint num = sc.nextInt();\n\t\t\tList<BigInteger> values = new ArrayList<BigInteger>();\n\t\t\tfor (int i = 0; i < num; i++) {\n\t\t\t\tvalues.add(sc.nextBigInteger());\n\t\t\t}\n\t\t\tCollections.sort(values);\n\n\t\t\tBigInteger result = BigInteger.ONE;\n\t\t\tfor (BigInteger value : values) {\n\t\t\t\tresult = result.multiply(value);\n\n\t\t\t\tif (result.equals(BigInteger.ZERO)) {\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\treturn;\n\t\t\t\t} else if (limit.compareTo(result) < 0) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println(result.toString());\n\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(-1);\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}",
"try (Scanner sc = new Scanner(System.in);) {\n\t\t\tint num = sc.nextInt();\n\t\t\tList<BigInteger> values = new ArrayList<BigInteger>();\n\t\t\tfor (int i = 0; i < num; i++) {\n\t\t\t\tvalues.add(sc.nextBigInteger());\n\t\t\t}\n\t\t\tCollections.sort(values);\n\n\t\t\tBigInteger result = BigInteger.ONE;\n\t\t\tfor (BigInteger value : values) {\n\t\t\t\tresult = result.multiply(value);\n\n\t\t\t\tif (result.equals(BigInteger.ZERO)) {\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\treturn;\n\t\t\t\t} else if (limit.compareTo(result) < 0) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println(result.toString());\n\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(-1);\n\t\t\te.printStackTrace();\n\t\t}",
"catch (Exception e) {\n\t\t\tSystem.out.println(-1);\n\t\t\te.printStackTrace();\n\t\t}",
"Exception e",
"{\n\t\t\tSystem.out.println(-1);\n\t\t\te.printStackTrace();\n\t\t}",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t\t\tint num = sc.nextInt();\n\t\t\tList<BigInteger> values = new ArrayList<BigInteger>();\n\t\t\tfor (int i = 0; i < num; i++) {\n\t\t\t\tvalues.add(sc.nextBigInteger());\n\t\t\t}\n\t\t\tCollections.sort(values);\n\n\t\t\tBigInteger result = BigInteger.ONE;\n\t\t\tfor (BigInteger value : values) {\n\t\t\t\tresult = result.multiply(value);\n\n\t\t\t\tif (result.equals(BigInteger.ZERO)) {\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\treturn;\n\t\t\t\t} else if (limit.compareTo(result) < 0) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println(result.toString());\n\n\t\t}",
"Scanner sc = new Scanner(System.in)",
"Scanner sc = new Scanner(System.in)",
"new Scanner(System.in)",
"int num = sc.nextInt();",
"num",
"sc.nextInt()",
"sc.nextInt",
"sc",
"List<BigInteger> values = new ArrayList<BigInteger>();",
"values",
"new ArrayList<BigInteger>()",
"for (int i = 0; i < num; i++) {\n\t\t\t\tvalues.add(sc.nextBigInteger());\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num",
"i",
"num",
"i++",
"i++",
"i",
"{\n\t\t\t\tvalues.add(sc.nextBigInteger());\n\t\t\t}",
"{\n\t\t\t\tvalues.add(sc.nextBigInteger());\n\t\t\t}",
"values.add(sc.nextBigInteger())",
"values.add",
"values",
"sc.nextBigInteger()",
"sc.nextBigInteger",
"sc",
"Collections.sort(values)",
"Collections.sort",
"Collections",
"values",
"BigInteger result = BigInteger.ONE;",
"result",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"for (BigInteger value : values) {\n\t\t\t\tresult = result.multiply(value);\n\n\t\t\t\tif (result.equals(BigInteger.ZERO)) {\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\treturn;\n\t\t\t\t} else if (limit.compareTo(result) < 0) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}",
"BigInteger value",
"values",
"{\n\t\t\t\tresult = result.multiply(value);\n\n\t\t\t\tif (result.equals(BigInteger.ZERO)) {\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\treturn;\n\t\t\t\t} else if (limit.compareTo(result) < 0) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tresult = result.multiply(value);\n\n\t\t\t\tif (result.equals(BigInteger.ZERO)) {\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\treturn;\n\t\t\t\t} else if (limit.compareTo(result) < 0) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}",
"result = result.multiply(value)",
"result",
"result.multiply(value)",
"result.multiply",
"result",
"value",
"if (result.equals(BigInteger.ZERO)) {\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\treturn;\n\t\t\t\t} else if (limit.compareTo(result) < 0) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}",
"result.equals(BigInteger.ZERO)",
"result.equals",
"result",
"BigInteger.ZERO",
"BigInteger",
"BigInteger.ZERO",
"{\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\treturn;\n\t\t\t\t}",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"if (limit.compareTo(result) < 0) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}",
"limit.compareTo(result) < 0",
"limit.compareTo(result)",
"limit.compareTo",
"limit",
"result",
"0",
"{\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"System.out.println(result.toString())",
"System.out.println",
"System.out",
"System",
"System.out",
"result.toString()",
"result.toString",
"result",
"String[] args",
"args",
"public class Main {\n\n\tstatic BigInteger limit = new BigInteger(\"1000000000000000000\");\n\n\tpublic static void main(String[] args) {\n\t\ttry (Scanner sc = new Scanner(System.in);) {\n\t\t\tint num = sc.nextInt();\n\t\t\tList<BigInteger> values = new ArrayList<BigInteger>();\n\t\t\tfor (int i = 0; i < num; i++) {\n\t\t\t\tvalues.add(sc.nextBigInteger());\n\t\t\t}\n\t\t\tCollections.sort(values);\n\n\t\t\tBigInteger result = BigInteger.ONE;\n\t\t\tfor (BigInteger value : values) {\n\t\t\t\tresult = result.multiply(value);\n\n\t\t\t\tif (result.equals(BigInteger.ZERO)) {\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\treturn;\n\t\t\t\t} else if (limit.compareTo(result) < 0) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println(result.toString());\n\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(-1);\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}\n}",
"public class Main {\n\n\tstatic BigInteger limit = new BigInteger(\"1000000000000000000\");\n\n\tpublic static void main(String[] args) {\n\t\ttry (Scanner sc = new Scanner(System.in);) {\n\t\t\tint num = sc.nextInt();\n\t\t\tList<BigInteger> values = new ArrayList<BigInteger>();\n\t\t\tfor (int i = 0; i < num; i++) {\n\t\t\t\tvalues.add(sc.nextBigInteger());\n\t\t\t}\n\t\t\tCollections.sort(values);\n\n\t\t\tBigInteger result = BigInteger.ONE;\n\t\t\tfor (BigInteger value : values) {\n\t\t\t\tresult = result.multiply(value);\n\n\t\t\t\tif (result.equals(BigInteger.ZERO)) {\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\treturn;\n\t\t\t\t} else if (limit.compareTo(result) < 0) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println(result.toString());\n\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(-1);\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}\n}",
"Main"
] |
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class Main {
static BigInteger limit = new BigInteger("1000000000000000000");
public static void main(String[] args) {
try (Scanner sc = new Scanner(System.in);) {
int num = sc.nextInt();
List<BigInteger> values = new ArrayList<BigInteger>();
for (int i = 0; i < num; i++) {
values.add(sc.nextBigInteger());
}
Collections.sort(values);
BigInteger result = BigInteger.ONE;
for (BigInteger value : values) {
result = result.multiply(value);
if (result.equals(BigInteger.ZERO)) {
System.out.println(0);
return;
} else if (limit.compareTo(result) < 0) {
System.out.println(-1);
return;
}
}
System.out.println(result.toString());
} catch (Exception e) {
System.out.println(-1);
e.printStackTrace();
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
4,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
13,
30,
14,
4,
18,
18,
13,
13,
20,
30,
0,
13,
18,
13,
13,
3,
30,
0,
13,
4,
18,
13,
20,
14,
4,
18,
13,
18,
13,
13,
30,
3,
14,
2,
4,
18,
13,
13,
17,
30,
0,
13,
4,
18,
13,
40,
17,
0,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
128,
8
],
[
128,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
22,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
27,
29
],
[
11,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
30,
41
],
[
42,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
45,
48
],
[
48,
49
],
[
49,
50
],
[
48,
51
],
[
11,
52
],
[
52,
53
],
[
52,
54
],
[
11,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
60,
61
],
[
60,
62
],
[
55,
63
],
[
63,
64
],
[
64,
65
],
[
55,
66
],
[
67,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
72,
77
],
[
71,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
78,
84
],
[
68,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
89,
90
],
[
88,
91
],
[
85,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
96,
97
],
[
96,
98
],
[
92,
99
],
[
99,
100
],
[
85,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
102,
107
],
[
101,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
114,
115
],
[
108,
116
],
[
116,
117
],
[
116,
118
],
[
11,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
9,
125
],
[
125,
126
],
[
0,
127
],
[
127,
128
],
[
127,
129
]
] |
[
"import java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger ans = BigInteger.ONE;\n\t\t\n\t\tBigInteger border = BigInteger.ONE;\n\t\tfor (int i = 0; i < 18; i++) {\n\t\t\tborder = border.multiply(BigInteger.valueOf(10));\n\t\t}\n\t\t\n\t\tboolean overFlg = false;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (overFlg) {\n\t\t\t\t// 0かだけチェック\n\t\t\t\tif (BigInteger.ZERO.equals(new BigInteger(sc.next()))) {\n\t\t\t\t\tans = BigInteger.ZERO;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// ボーダー以下\n\t\t\t\tans = ans.multiply(new BigInteger(sc.next()));\n\t\t\t\tif (ans.equals(BigInteger.ZERO)) {\n\t\t\t\t\t// 0終了\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (ans.compareTo(border) > 0) {\n\t\t\t\t\t// ボーダー越え\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\toverFlg = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger ans = BigInteger.ONE;\n\t\t\n\t\tBigInteger border = BigInteger.ONE;\n\t\tfor (int i = 0; i < 18; i++) {\n\t\t\tborder = border.multiply(BigInteger.valueOf(10));\n\t\t}\n\t\t\n\t\tboolean overFlg = false;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (overFlg) {\n\t\t\t\t// 0かだけチェック\n\t\t\t\tif (BigInteger.ZERO.equals(new BigInteger(sc.next()))) {\n\t\t\t\t\tans = BigInteger.ZERO;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// ボーダー以下\n\t\t\t\tans = ans.multiply(new BigInteger(sc.next()));\n\t\t\t\tif (ans.equals(BigInteger.ZERO)) {\n\t\t\t\t\t// 0終了\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (ans.compareTo(border) > 0) {\n\t\t\t\t\t// ボーダー越え\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\toverFlg = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger ans = BigInteger.ONE;\n\t\t\n\t\tBigInteger border = BigInteger.ONE;\n\t\tfor (int i = 0; i < 18; i++) {\n\t\t\tborder = border.multiply(BigInteger.valueOf(10));\n\t\t}\n\t\t\n\t\tboolean overFlg = false;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (overFlg) {\n\t\t\t\t// 0かだけチェック\n\t\t\t\tif (BigInteger.ZERO.equals(new BigInteger(sc.next()))) {\n\t\t\t\t\tans = BigInteger.ZERO;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// ボーダー以下\n\t\t\t\tans = ans.multiply(new BigInteger(sc.next()));\n\t\t\t\tif (ans.equals(BigInteger.ZERO)) {\n\t\t\t\t\t// 0終了\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (ans.compareTo(border) > 0) {\n\t\t\t\t\t// ボーダー越え\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\toverFlg = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger ans = BigInteger.ONE;\n\t\t\n\t\tBigInteger border = BigInteger.ONE;\n\t\tfor (int i = 0; i < 18; i++) {\n\t\t\tborder = border.multiply(BigInteger.valueOf(10));\n\t\t}\n\t\t\n\t\tboolean overFlg = false;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (overFlg) {\n\t\t\t\t// 0かだけチェック\n\t\t\t\tif (BigInteger.ZERO.equals(new BigInteger(sc.next()))) {\n\t\t\t\t\tans = BigInteger.ZERO;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// ボーダー以下\n\t\t\t\tans = ans.multiply(new BigInteger(sc.next()));\n\t\t\t\tif (ans.equals(BigInteger.ZERO)) {\n\t\t\t\t\t// 0終了\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (ans.compareTo(border) > 0) {\n\t\t\t\t\t// ボーダー越え\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\toverFlg = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BigInteger ans = BigInteger.ONE;",
"ans",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"BigInteger border = BigInteger.ONE;",
"border",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"for (int i = 0; i < 18; i++) {\n\t\t\tborder = border.multiply(BigInteger.valueOf(10));\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < 18",
"i",
"18",
"i++",
"i++",
"i",
"{\n\t\t\tborder = border.multiply(BigInteger.valueOf(10));\n\t\t}",
"{\n\t\t\tborder = border.multiply(BigInteger.valueOf(10));\n\t\t}",
"border = border.multiply(BigInteger.valueOf(10))",
"border",
"border.multiply(BigInteger.valueOf(10))",
"border.multiply",
"border",
"BigInteger.valueOf(10)",
"BigInteger.valueOf",
"BigInteger",
"10",
"boolean overFlg = false;",
"overFlg",
"false",
"for (int i = 0; i < n; i++) {\n\t\t\tif (overFlg) {\n\t\t\t\t// 0かだけチェック\n\t\t\t\tif (BigInteger.ZERO.equals(new BigInteger(sc.next()))) {\n\t\t\t\t\tans = BigInteger.ZERO;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// ボーダー以下\n\t\t\t\tans = ans.multiply(new BigInteger(sc.next()));\n\t\t\t\tif (ans.equals(BigInteger.ZERO)) {\n\t\t\t\t\t// 0終了\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (ans.compareTo(border) > 0) {\n\t\t\t\t\t// ボーダー越え\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\toverFlg = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tif (overFlg) {\n\t\t\t\t// 0かだけチェック\n\t\t\t\tif (BigInteger.ZERO.equals(new BigInteger(sc.next()))) {\n\t\t\t\t\tans = BigInteger.ZERO;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// ボーダー以下\n\t\t\t\tans = ans.multiply(new BigInteger(sc.next()));\n\t\t\t\tif (ans.equals(BigInteger.ZERO)) {\n\t\t\t\t\t// 0終了\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (ans.compareTo(border) > 0) {\n\t\t\t\t\t// ボーダー越え\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\toverFlg = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (overFlg) {\n\t\t\t\t// 0かだけチェック\n\t\t\t\tif (BigInteger.ZERO.equals(new BigInteger(sc.next()))) {\n\t\t\t\t\tans = BigInteger.ZERO;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// ボーダー以下\n\t\t\t\tans = ans.multiply(new BigInteger(sc.next()));\n\t\t\t\tif (ans.equals(BigInteger.ZERO)) {\n\t\t\t\t\t// 0終了\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (ans.compareTo(border) > 0) {\n\t\t\t\t\t// ボーダー越え\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\toverFlg = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"if (overFlg) {\n\t\t\t\t// 0かだけチェック\n\t\t\t\tif (BigInteger.ZERO.equals(new BigInteger(sc.next()))) {\n\t\t\t\t\tans = BigInteger.ZERO;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// ボーダー以下\n\t\t\t\tans = ans.multiply(new BigInteger(sc.next()));\n\t\t\t\tif (ans.equals(BigInteger.ZERO)) {\n\t\t\t\t\t// 0終了\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (ans.compareTo(border) > 0) {\n\t\t\t\t\t// ボーダー越え\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\toverFlg = true;\n\t\t\t\t}\n\t\t\t}",
"overFlg",
"{\n\t\t\t\t// 0かだけチェック\n\t\t\t\tif (BigInteger.ZERO.equals(new BigInteger(sc.next()))) {\n\t\t\t\t\tans = BigInteger.ZERO;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"if (BigInteger.ZERO.equals(new BigInteger(sc.next()))) {\n\t\t\t\t\tans = BigInteger.ZERO;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"BigInteger.ZERO.equals(new BigInteger(sc.next()))",
"BigInteger.ZERO.equals",
"BigInteger.ZERO",
"BigInteger",
"BigInteger.ZERO",
"new BigInteger(sc.next())",
"{\n\t\t\t\t\tans = BigInteger.ZERO;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"ans = BigInteger.ZERO",
"ans",
"BigInteger.ZERO",
"BigInteger",
"BigInteger.ZERO",
"break;",
"{\n\t\t\t\t// ボーダー以下\n\t\t\t\tans = ans.multiply(new BigInteger(sc.next()));\n\t\t\t\tif (ans.equals(BigInteger.ZERO)) {\n\t\t\t\t\t// 0終了\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (ans.compareTo(border) > 0) {\n\t\t\t\t\t// ボーダー越え\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\toverFlg = true;\n\t\t\t\t}\n\t\t\t}",
"ans = ans.multiply(new BigInteger(sc.next()))",
"ans",
"ans.multiply(new BigInteger(sc.next()))",
"ans.multiply",
"ans",
"new BigInteger(sc.next())",
"if (ans.equals(BigInteger.ZERO)) {\n\t\t\t\t\t// 0終了\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"ans.equals(BigInteger.ZERO)",
"ans.equals",
"ans",
"BigInteger.ZERO",
"BigInteger",
"BigInteger.ZERO",
"{\n\t\t\t\t\t// 0終了\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"break;",
"if (ans.compareTo(border) > 0) {\n\t\t\t\t\t// ボーダー越え\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\toverFlg = true;\n\t\t\t\t}",
"ans.compareTo(border) > 0",
"ans.compareTo(border)",
"ans.compareTo",
"ans",
"border",
"0",
"{\n\t\t\t\t\t// ボーダー越え\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\toverFlg = true;\n\t\t\t\t}",
"ans = BigInteger.valueOf(-1)",
"ans",
"BigInteger.valueOf(-1)",
"BigInteger.valueOf",
"BigInteger",
"-1",
"1",
"overFlg = true",
"overFlg",
"true",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger ans = BigInteger.ONE;\n\t\t\n\t\tBigInteger border = BigInteger.ONE;\n\t\tfor (int i = 0; i < 18; i++) {\n\t\t\tborder = border.multiply(BigInteger.valueOf(10));\n\t\t}\n\t\t\n\t\tboolean overFlg = false;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (overFlg) {\n\t\t\t\t// 0かだけチェック\n\t\t\t\tif (BigInteger.ZERO.equals(new BigInteger(sc.next()))) {\n\t\t\t\t\tans = BigInteger.ZERO;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// ボーダー以下\n\t\t\t\tans = ans.multiply(new BigInteger(sc.next()));\n\t\t\t\tif (ans.equals(BigInteger.ZERO)) {\n\t\t\t\t\t// 0終了\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (ans.compareTo(border) > 0) {\n\t\t\t\t\t// ボーダー越え\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\toverFlg = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger ans = BigInteger.ONE;\n\t\t\n\t\tBigInteger border = BigInteger.ONE;\n\t\tfor (int i = 0; i < 18; i++) {\n\t\t\tborder = border.multiply(BigInteger.valueOf(10));\n\t\t}\n\t\t\n\t\tboolean overFlg = false;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (overFlg) {\n\t\t\t\t// 0かだけチェック\n\t\t\t\tif (BigInteger.ZERO.equals(new BigInteger(sc.next()))) {\n\t\t\t\t\tans = BigInteger.ZERO;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// ボーダー以下\n\t\t\t\tans = ans.multiply(new BigInteger(sc.next()));\n\t\t\t\tif (ans.equals(BigInteger.ZERO)) {\n\t\t\t\t\t// 0終了\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (ans.compareTo(border) > 0) {\n\t\t\t\t\t// ボーダー越え\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\toverFlg = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main"
] |
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
BigInteger ans = BigInteger.ONE;
BigInteger border = BigInteger.ONE;
for (int i = 0; i < 18; i++) {
border = border.multiply(BigInteger.valueOf(10));
}
boolean overFlg = false;
for (int i = 0; i < n; i++) {
if (overFlg) {
// 0かだけチェック
if (BigInteger.ZERO.equals(new BigInteger(sc.next()))) {
ans = BigInteger.ZERO;
break;
}
} else {
// ボーダー以下
ans = ans.multiply(new BigInteger(sc.next()));
if (ans.equals(BigInteger.ZERO)) {
// 0終了
break;
}
if (ans.compareTo(border) > 0) {
// ボーダー越え
ans = BigInteger.valueOf(-1);
overFlg = true;
}
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
13,
4,
18,
13,
18,
13,
13,
41,
13,
17,
41,
13,
4,
18,
13,
17,
17,
14,
2,
13,
17,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
13,
18,
13,
13,
14,
2,
13,
17,
4,
18,
18,
13,
13,
13,
4,
18,
18,
13,
13,
40,
17,
4,
18,
18,
13,
13,
40,
17,
23,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
37,
38
],
[
38,
39
],
[
8,
40
],
[
40,
41
],
[
41,
42
],
[
40,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
8,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
47,
52
],
[
52,
53
],
[
52,
54
],
[
47,
55
],
[
55,
56
],
[
56,
57
],
[
47,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
64,
65
],
[
64,
66
],
[
8,
67
],
[
67,
68
],
[
67,
69
],
[
8,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
73,
74
],
[
72,
75
],
[
72,
76
],
[
8,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
87,
88
],
[
87,
89
],
[
82,
90
],
[
90,
91
],
[
91,
92
],
[
82,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
81,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
99,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
109,
114
],
[
114,
115
],
[
77,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
116,
121
],
[
121,
122
],
[
6,
123
],
[
123,
124
]
] |
[
"import java.util.*;\n\nclass Main{\n\n public static void main(String args[]){\n\n Scanner s=new Scanner(System.in);\n int N=s.nextInt();\n long[] List=new long[N];\n for(int i=0;i<N;i++) List[i]=s.nextLong();\n Arrays.sort(List);\n double d=0d;\n for(int i=0;i<N;i++) d+=Math.log10(List[i]);\n long ans=1;\n long comp=(long)Math.pow(10,18);\n \n if(d<=18){\n for(int i=0;i<N;i++) ans*=List[i];\n if(ans<=1000000000000000000L) System.out.println(ans);\n else System.out.println(-1);\n }\n else System.out.println(-1); \n } \n}",
"import java.util.*;",
"util.*",
"java",
"class Main{\n\n public static void main(String args[]){\n\n Scanner s=new Scanner(System.in);\n int N=s.nextInt();\n long[] List=new long[N];\n for(int i=0;i<N;i++) List[i]=s.nextLong();\n Arrays.sort(List);\n double d=0d;\n for(int i=0;i<N;i++) d+=Math.log10(List[i]);\n long ans=1;\n long comp=(long)Math.pow(10,18);\n \n if(d<=18){\n for(int i=0;i<N;i++) ans*=List[i];\n if(ans<=1000000000000000000L) System.out.println(ans);\n else System.out.println(-1);\n }\n else System.out.println(-1); \n } \n}",
"Main",
"public static void main(String args[]){\n\n Scanner s=new Scanner(System.in);\n int N=s.nextInt();\n long[] List=new long[N];\n for(int i=0;i<N;i++) List[i]=s.nextLong();\n Arrays.sort(List);\n double d=0d;\n for(int i=0;i<N;i++) d+=Math.log10(List[i]);\n long ans=1;\n long comp=(long)Math.pow(10,18);\n \n if(d<=18){\n for(int i=0;i<N;i++) ans*=List[i];\n if(ans<=1000000000000000000L) System.out.println(ans);\n else System.out.println(-1);\n }\n else System.out.println(-1); \n }",
"main",
"{\n\n Scanner s=new Scanner(System.in);\n int N=s.nextInt();\n long[] List=new long[N];\n for(int i=0;i<N;i++) List[i]=s.nextLong();\n Arrays.sort(List);\n double d=0d;\n for(int i=0;i<N;i++) d+=Math.log10(List[i]);\n long ans=1;\n long comp=(long)Math.pow(10,18);\n \n if(d<=18){\n for(int i=0;i<N;i++) ans*=List[i];\n if(ans<=1000000000000000000L) System.out.println(ans);\n else System.out.println(-1);\n }\n else System.out.println(-1); \n }",
"Scanner s=new Scanner(System.in);",
"s",
"new Scanner(System.in)",
"int N=s.nextInt();",
"N",
"s.nextInt()",
"s.nextInt",
"s",
"long[] List=new long[N];",
"List",
"new long[N]",
"N",
"for(int i=0;i<N;i++) List[i]=s.nextLong();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"List[i]=s.nextLong();",
"List[i]=s.nextLong()",
"List[i]",
"List",
"i",
"s.nextLong()",
"s.nextLong",
"s",
"Arrays.sort(List)",
"Arrays.sort",
"Arrays",
"List",
"double d=0d;",
"d",
"0d",
"for(int i=0;i<N;i++) d+=Math.log10(List[i]);",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"d+=Math.log10(List[i]);",
"d+=Math.log10(List[i])",
"d",
"Math.log10(List[i])",
"Math.log10",
"Math",
"List[i]",
"List",
"i",
"long ans=1;",
"ans",
"1",
"long comp=(long)Math.pow(10,18);",
"comp",
"(long)Math.pow(10,18)",
"Math.pow",
"Math",
"10",
"18",
"if(d<=18){\n for(int i=0;i<N;i++) ans*=List[i];\n if(ans<=1000000000000000000L) System.out.println(ans);\n else System.out.println(-1);\n }\n else System.out.println(-1);",
"d<=18",
"d",
"18",
"{\n for(int i=0;i<N;i++) ans*=List[i];\n if(ans<=1000000000000000000L) System.out.println(ans);\n else System.out.println(-1);\n }",
"for(int i=0;i<N;i++) ans*=List[i];",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"ans*=List[i];",
"ans*=List[i]",
"ans",
"List[i]",
"List",
"i",
"if(ans<=1000000000000000000L) System.out.println(ans);\n else System.out.println(-1);",
"ans<=1000000000000000000L",
"ans",
"1000000000000000000L",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"String args[]",
"args"
] |
import java.util.*;
class Main{
public static void main(String args[]){
Scanner s=new Scanner(System.in);
int N=s.nextInt();
long[] List=new long[N];
for(int i=0;i<N;i++) List[i]=s.nextLong();
Arrays.sort(List);
double d=0d;
for(int i=0;i<N;i++) d+=Math.log10(List[i]);
long ans=1;
long comp=(long)Math.pow(10,18);
if(d<=18){
for(int i=0;i<N;i++) ans*=List[i];
if(ans<=1000000000000000000L) System.out.println(ans);
else System.out.println(-1);
}
else System.out.println(-1);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
4,
18,
20,
23,
13,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
0,
13,
17,
14,
13,
30,
4,
18,
18,
13,
13,
17,
29,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
13,
13,
30,
0,
13,
40,
17,
3,
0,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
29
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
10,
11
],
[
6,
12
],
[
12,
13
],
[
0,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
16,
18
],
[
18,
19
],
[
19,
20
],
[
19,
21
],
[
18,
22
],
[
22,
23
],
[
22,
24
],
[
18,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
18,
30
],
[
30,
31
],
[
30,
32
],
[
18,
34
],
[
34,
35
],
[
34,
36
],
[
18,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
37,
42
],
[
42,
43
],
[
42,
44
],
[
37,
45
],
[
45,
46
],
[
46,
47
],
[
37,
48
],
[
49,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
55,
56
],
[
49,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
58,
62
],
[
57,
63
],
[
63,
64
],
[
63,
65
],
[
18,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
68,
75
],
[
18,
76
],
[
76,
77
],
[
76,
78
],
[
18,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
79,
84
],
[
84,
85
],
[
84,
86
],
[
79,
87
],
[
87,
88
],
[
88,
89
],
[
79,
90
],
[
91,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
97,
98
],
[
97,
99
],
[
92,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
100,
105
],
[
91,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
108,
110
],
[
18,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
18,
117
]
] |
[
"import java.util.*;\n\nclass Main {\n public static void main(String[] args) {\n new Solver().run();\n }\n}\n\nclass Solver {\n\n public void run() {\n Scanner sc = new Scanner(System.in);\n long THREASHOLD=1000000000000000000L;\n int N = sc.nextInt();\n long[] A = new long[N];\n boolean zero = false;\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextLong();\n if (A[i] == 0) zero = true;\n }\n if (zero) {\n System.out.println(\"0\");\n return;\n }\n\n long ans = 1;\n for (int i = 0; i < N; i++) {\n if (A[i] > THREASHOLD/ans) {\n ans = -1;\n break;\n }\n ans *= A[i];\n }\n\n System.out.println(ans);\n return;\n }\n\n}",
"import java.util.*;",
"util.*",
"java",
"class Main {\n public static void main(String[] args) {\n new Solver().run();\n }\n}",
"Main",
"public static void main(String[] args) {\n new Solver().run();\n }",
"main",
"{\n new Solver().run();\n }",
"new Solver().run()",
"new Solver().run",
"new Solver()",
"String[] args",
"args",
"class Solver {\n\n public void run() {\n Scanner sc = new Scanner(System.in);\n long THREASHOLD=1000000000000000000L;\n int N = sc.nextInt();\n long[] A = new long[N];\n boolean zero = false;\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextLong();\n if (A[i] == 0) zero = true;\n }\n if (zero) {\n System.out.println(\"0\");\n return;\n }\n\n long ans = 1;\n for (int i = 0; i < N; i++) {\n if (A[i] > THREASHOLD/ans) {\n ans = -1;\n break;\n }\n ans *= A[i];\n }\n\n System.out.println(ans);\n return;\n }\n\n}",
"Solver",
"public void run() {\n Scanner sc = new Scanner(System.in);\n long THREASHOLD=1000000000000000000L;\n int N = sc.nextInt();\n long[] A = new long[N];\n boolean zero = false;\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextLong();\n if (A[i] == 0) zero = true;\n }\n if (zero) {\n System.out.println(\"0\");\n return;\n }\n\n long ans = 1;\n for (int i = 0; i < N; i++) {\n if (A[i] > THREASHOLD/ans) {\n ans = -1;\n break;\n }\n ans *= A[i];\n }\n\n System.out.println(ans);\n return;\n }",
"run",
"{\n Scanner sc = new Scanner(System.in);\n long THREASHOLD=1000000000000000000L;\n int N = sc.nextInt();\n long[] A = new long[N];\n boolean zero = false;\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextLong();\n if (A[i] == 0) zero = true;\n }\n if (zero) {\n System.out.println(\"0\");\n return;\n }\n\n long ans = 1;\n for (int i = 0; i < N; i++) {\n if (A[i] > THREASHOLD/ans) {\n ans = -1;\n break;\n }\n ans *= A[i];\n }\n\n System.out.println(ans);\n return;\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"long THREASHOLD=1000000000000000000L;",
"THREASHOLD",
"1000000000000000000L",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] A = new long[N];",
"A",
"new long[N]",
"N",
"boolean zero = false;",
"zero",
"false",
"for (int i = 0; i < N; i++) {\n A[i] = sc.nextLong();\n if (A[i] == 0) zero = true;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i] = sc.nextLong();\n if (A[i] == 0) zero = true;\n }",
"{\n A[i] = sc.nextLong();\n if (A[i] == 0) zero = true;\n }",
"A[i] = sc.nextLong()",
"A[i]",
"A",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (A[i] == 0) zero = true;",
"A[i] == 0",
"A[i]",
"A",
"i",
"0",
"zero = true",
"zero",
"true",
"if (zero) {\n System.out.println(\"0\");\n return;\n }",
"zero",
"{\n System.out.println(\"0\");\n return;\n }",
"System.out.println(\"0\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"0\"",
"return;",
"long ans = 1;",
"ans",
"1",
"for (int i = 0; i < N; i++) {\n if (A[i] > THREASHOLD/ans) {\n ans = -1;\n break;\n }\n ans *= A[i];\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if (A[i] > THREASHOLD/ans) {\n ans = -1;\n break;\n }\n ans *= A[i];\n }",
"{\n if (A[i] > THREASHOLD/ans) {\n ans = -1;\n break;\n }\n ans *= A[i];\n }",
"if (A[i] > THREASHOLD/ans) {\n ans = -1;\n break;\n }",
"A[i] > THREASHOLD/ans",
"A[i]",
"A",
"i",
"THREASHOLD/ans",
"THREASHOLD",
"ans",
"{\n ans = -1;\n break;\n }",
"ans = -1",
"ans",
"-1",
"1",
"break;",
"ans *= A[i]",
"ans",
"A[i]",
"A",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"return;"
] |
import java.util.*;
class Main {
public static void main(String[] args) {
new Solver().run();
}
}
class Solver {
public void run() {
Scanner sc = new Scanner(System.in);
long THREASHOLD=1000000000000000000L;
int N = sc.nextInt();
long[] A = new long[N];
boolean zero = false;
for (int i = 0; i < N; i++) {
A[i] = sc.nextLong();
if (A[i] == 0) zero = true;
}
if (zero) {
System.out.println("0");
return;
}
long ans = 1;
for (int i = 0; i < N; i++) {
if (A[i] > THREASHOLD/ans) {
ans = -1;
break;
}
ans *= A[i];
}
System.out.println(ans);
return;
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
14,
2,
13,
2,
13,
13,
30,
0,
13,
2,
13,
13,
30,
0,
13,
17,
14,
2,
13,
2,
13,
17,
30,
0,
13,
40,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
98,
5
],
[
98,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
14,
17
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
23,
25
],
[
8,
26
],
[
26,
27
],
[
26,
28
],
[
8,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
29,
34
],
[
34,
35
],
[
34,
36
],
[
29,
37
],
[
37,
38
],
[
38,
39
],
[
29,
40
],
[
41,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
45,
46
],
[
44,
47
],
[
47,
48
],
[
48,
49
],
[
41,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
54,
61
],
[
41,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
62,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
62,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
8,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
78,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
8,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
6,
95
],
[
95,
96
],
[
0,
97
],
[
97,
98
],
[
97,
99
]
] |
[
"import java.util.*;\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long count = Long.parseLong(sc.next());\n \tlong suuzi = 1;\n \tfinal long limit = 1000000000000000000L;\n \tboolean flg = false;\n \tfor (int i=0; i<count; i++){\n \tlong item = Long.parseLong(sc.next());\n \tif (item == 0){\n System.out.println(\"0\");\n return;\n }\n \tif (item <= limit/suuzi){\n \t\tsuuzi = item * suuzi;\n }else{\n \tflg = true; \n }\n }\n \n \tif(flg && suuzi != 0){\n \tsuuzi = -1;\n }\n \tSystem.out.println(suuzi);\n }\n\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long count = Long.parseLong(sc.next());\n \tlong suuzi = 1;\n \tfinal long limit = 1000000000000000000L;\n \tboolean flg = false;\n \tfor (int i=0; i<count; i++){\n \tlong item = Long.parseLong(sc.next());\n \tif (item == 0){\n System.out.println(\"0\");\n return;\n }\n \tif (item <= limit/suuzi){\n \t\tsuuzi = item * suuzi;\n }else{\n \tflg = true; \n }\n }\n \n \tif(flg && suuzi != 0){\n \tsuuzi = -1;\n }\n \tSystem.out.println(suuzi);\n }\n\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long count = Long.parseLong(sc.next());\n \tlong suuzi = 1;\n \tfinal long limit = 1000000000000000000L;\n \tboolean flg = false;\n \tfor (int i=0; i<count; i++){\n \tlong item = Long.parseLong(sc.next());\n \tif (item == 0){\n System.out.println(\"0\");\n return;\n }\n \tif (item <= limit/suuzi){\n \t\tsuuzi = item * suuzi;\n }else{\n \tflg = true; \n }\n }\n \n \tif(flg && suuzi != 0){\n \tsuuzi = -1;\n }\n \tSystem.out.println(suuzi);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n long count = Long.parseLong(sc.next());\n \tlong suuzi = 1;\n \tfinal long limit = 1000000000000000000L;\n \tboolean flg = false;\n \tfor (int i=0; i<count; i++){\n \tlong item = Long.parseLong(sc.next());\n \tif (item == 0){\n System.out.println(\"0\");\n return;\n }\n \tif (item <= limit/suuzi){\n \t\tsuuzi = item * suuzi;\n }else{\n \tflg = true; \n }\n }\n \n \tif(flg && suuzi != 0){\n \tsuuzi = -1;\n }\n \tSystem.out.println(suuzi);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"long count = Long.parseLong(sc.next());",
"count",
"Long.parseLong(sc.next())",
"Long.parseLong",
"Long",
"sc.next()",
"sc.next",
"sc",
"long suuzi = 1;",
"suuzi",
"1",
"final long limit = 1000000000000000000L;",
"limit",
"1000000000000000000L",
"boolean flg = false;",
"flg",
"false",
"for (int i=0; i<count; i++){\n \tlong item = Long.parseLong(sc.next());\n \tif (item == 0){\n System.out.println(\"0\");\n return;\n }\n \tif (item <= limit/suuzi){\n \t\tsuuzi = item * suuzi;\n }else{\n \tflg = true; \n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<count",
"i",
"count",
"i++",
"i++",
"i",
"{\n \tlong item = Long.parseLong(sc.next());\n \tif (item == 0){\n System.out.println(\"0\");\n return;\n }\n \tif (item <= limit/suuzi){\n \t\tsuuzi = item * suuzi;\n }else{\n \tflg = true; \n }\n }",
"{\n \tlong item = Long.parseLong(sc.next());\n \tif (item == 0){\n System.out.println(\"0\");\n return;\n }\n \tif (item <= limit/suuzi){\n \t\tsuuzi = item * suuzi;\n }else{\n \tflg = true; \n }\n }",
"long item = Long.parseLong(sc.next());",
"item",
"Long.parseLong(sc.next())",
"Long.parseLong",
"Long",
"sc.next()",
"sc.next",
"sc",
"if (item == 0){\n System.out.println(\"0\");\n return;\n }",
"item == 0",
"item",
"0",
"{\n System.out.println(\"0\");\n return;\n }",
"System.out.println(\"0\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"0\"",
"return;",
"if (item <= limit/suuzi){\n \t\tsuuzi = item * suuzi;\n }else{\n \tflg = true; \n }",
"item <= limit/suuzi",
"item",
"limit/suuzi",
"limit",
"suuzi",
"{\n \t\tsuuzi = item * suuzi;\n }",
"suuzi = item * suuzi",
"suuzi",
"item * suuzi",
"item",
"suuzi",
"{\n \tflg = true; \n }",
"flg = true",
"flg",
"true",
"if(flg && suuzi != 0){\n \tsuuzi = -1;\n }",
"flg && suuzi != 0",
"flg",
"suuzi != 0",
"suuzi",
"0",
"{\n \tsuuzi = -1;\n }",
"suuzi = -1",
"suuzi",
"-1",
"1",
"System.out.println(suuzi)",
"System.out.println",
"System.out",
"System",
"System.out",
"suuzi",
"String[] args",
"args",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long count = Long.parseLong(sc.next());\n \tlong suuzi = 1;\n \tfinal long limit = 1000000000000000000L;\n \tboolean flg = false;\n \tfor (int i=0; i<count; i++){\n \tlong item = Long.parseLong(sc.next());\n \tif (item == 0){\n System.out.println(\"0\");\n return;\n }\n \tif (item <= limit/suuzi){\n \t\tsuuzi = item * suuzi;\n }else{\n \tflg = true; \n }\n }\n \n \tif(flg && suuzi != 0){\n \tsuuzi = -1;\n }\n \tSystem.out.println(suuzi);\n }\n\n}",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long count = Long.parseLong(sc.next());\n \tlong suuzi = 1;\n \tfinal long limit = 1000000000000000000L;\n \tboolean flg = false;\n \tfor (int i=0; i<count; i++){\n \tlong item = Long.parseLong(sc.next());\n \tif (item == 0){\n System.out.println(\"0\");\n return;\n }\n \tif (item <= limit/suuzi){\n \t\tsuuzi = item * suuzi;\n }else{\n \tflg = true; \n }\n }\n \n \tif(flg && suuzi != 0){\n \tsuuzi = -1;\n }\n \tSystem.out.println(suuzi);\n }\n\n}",
"Main"
] |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long count = Long.parseLong(sc.next());
long suuzi = 1;
final long limit = 1000000000000000000L;
boolean flg = false;
for (int i=0; i<count; i++){
long item = Long.parseLong(sc.next());
if (item == 0){
System.out.println("0");
return;
}
if (item <= limit/suuzi){
suuzi = item * suuzi;
}else{
flg = true;
}
}
if(flg && suuzi != 0){
suuzi = -1;
}
System.out.println(suuzi);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
14,
4,
18,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
41,
13,
18,
13,
13,
41,
13,
20,
41,
13,
17,
28,
13,
13,
30,
30,
0,
13,
4,
18,
13,
20,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
0,
13,
17,
3,
14,
40,
13,
30,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
96,
8
],
[
96,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
16,
17
],
[
11,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
20,
25
],
[
11,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
29,
32
],
[
27,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
35,
40
],
[
34,
41
],
[
11,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
44,
46
],
[
11,
47
],
[
47,
48
],
[
47,
49
],
[
11,
50
],
[
50,
51
],
[
50,
52
],
[
11,
53
],
[
53,
54
],
[
53,
55
],
[
53,
56
],
[
57,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
61,
62
],
[
60,
63
],
[
57,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
66,
69
],
[
65,
70
],
[
64,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
72,
77
],
[
77,
78
],
[
71,
79
],
[
79,
80
],
[
79,
81
],
[
71,
82
],
[
11,
83
],
[
83,
84
],
[
84,
85
],
[
83,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
9,
93
],
[
93,
94
],
[
0,
95
],
[
95,
96
],
[
95,
97
]
] |
[
"import java.math.BigDecimal;\nimport java.util.*;\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n // 整数の入力\n sc.nextLine();\n String[] arr = sc.nextLine().split(\" \");\n // 0\n if(Arrays.asList(arr).contains(\"0\")){\n System.out.println(0);\n return;\n }\n\n BigDecimal ans = BigDecimal.ONE;\n BigDecimal max = new BigDecimal(\"1000000000000000000\");\n boolean over = false;\n for(String str : arr){\n ans = ans.multiply(new BigDecimal(str));\n\n // 上限\n if(ans.compareTo(max) == 1){\n System.out.println(-1);\n over = true;\n break;\n }\n }\n\n if(!over){\n System.out.println(ans);\n }\n }\n}",
"import java.math.BigDecimal;",
"BigDecimal",
"java.math",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n // 整数の入力\n sc.nextLine();\n String[] arr = sc.nextLine().split(\" \");\n // 0\n if(Arrays.asList(arr).contains(\"0\")){\n System.out.println(0);\n return;\n }\n\n BigDecimal ans = BigDecimal.ONE;\n BigDecimal max = new BigDecimal(\"1000000000000000000\");\n boolean over = false;\n for(String str : arr){\n ans = ans.multiply(new BigDecimal(str));\n\n // 上限\n if(ans.compareTo(max) == 1){\n System.out.println(-1);\n over = true;\n break;\n }\n }\n\n if(!over){\n System.out.println(ans);\n }\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n // 整数の入力\n sc.nextLine();\n String[] arr = sc.nextLine().split(\" \");\n // 0\n if(Arrays.asList(arr).contains(\"0\")){\n System.out.println(0);\n return;\n }\n\n BigDecimal ans = BigDecimal.ONE;\n BigDecimal max = new BigDecimal(\"1000000000000000000\");\n boolean over = false;\n for(String str : arr){\n ans = ans.multiply(new BigDecimal(str));\n\n // 上限\n if(ans.compareTo(max) == 1){\n System.out.println(-1);\n over = true;\n break;\n }\n }\n\n if(!over){\n System.out.println(ans);\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n // 整数の入力\n sc.nextLine();\n String[] arr = sc.nextLine().split(\" \");\n // 0\n if(Arrays.asList(arr).contains(\"0\")){\n System.out.println(0);\n return;\n }\n\n BigDecimal ans = BigDecimal.ONE;\n BigDecimal max = new BigDecimal(\"1000000000000000000\");\n boolean over = false;\n for(String str : arr){\n ans = ans.multiply(new BigDecimal(str));\n\n // 上限\n if(ans.compareTo(max) == 1){\n System.out.println(-1);\n over = true;\n break;\n }\n }\n\n if(!over){\n System.out.println(ans);\n }\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"sc.nextLine()",
"sc.nextLine",
"sc",
"String[] arr = sc.nextLine().split(\" \");",
"arr",
"sc.nextLine().split(\" \")",
"sc.nextLine().split",
"sc.nextLine()",
"sc.nextLine",
"sc",
"\" \"",
"if(Arrays.asList(arr).contains(\"0\")){\n System.out.println(0);\n return;\n }",
"Arrays.asList(arr).contains(\"0\")",
"Arrays.asList(arr).contains",
"Arrays.asList(arr)",
"Arrays.asList",
"Arrays",
"arr",
"\"0\"",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"BigDecimal ans = BigDecimal.ONE;",
"ans",
"BigDecimal.ONE",
"BigDecimal",
"BigDecimal.ONE",
"BigDecimal max = new BigDecimal(\"1000000000000000000\");",
"max",
"new BigDecimal(\"1000000000000000000\")",
"boolean over = false;",
"over",
"false",
"for(String str : arr){\n ans = ans.multiply(new BigDecimal(str));\n\n // 上限\n if(ans.compareTo(max) == 1){\n System.out.println(-1);\n over = true;\n break;\n }\n }",
"String str",
"arr",
"{\n ans = ans.multiply(new BigDecimal(str));\n\n // 上限\n if(ans.compareTo(max) == 1){\n System.out.println(-1);\n over = true;\n break;\n }\n }",
"{\n ans = ans.multiply(new BigDecimal(str));\n\n // 上限\n if(ans.compareTo(max) == 1){\n System.out.println(-1);\n over = true;\n break;\n }\n }",
"ans = ans.multiply(new BigDecimal(str))",
"ans",
"ans.multiply(new BigDecimal(str))",
"ans.multiply",
"ans",
"new BigDecimal(str)",
"if(ans.compareTo(max) == 1){\n System.out.println(-1);\n over = true;\n break;\n }",
"ans.compareTo(max) == 1",
"ans.compareTo(max)",
"ans.compareTo",
"ans",
"max",
"1",
"{\n System.out.println(-1);\n over = true;\n break;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"over = true",
"over",
"true",
"break;",
"if(!over){\n System.out.println(ans);\n }",
"!over",
"over",
"{\n System.out.println(ans);\n }",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n // 整数の入力\n sc.nextLine();\n String[] arr = sc.nextLine().split(\" \");\n // 0\n if(Arrays.asList(arr).contains(\"0\")){\n System.out.println(0);\n return;\n }\n\n BigDecimal ans = BigDecimal.ONE;\n BigDecimal max = new BigDecimal(\"1000000000000000000\");\n boolean over = false;\n for(String str : arr){\n ans = ans.multiply(new BigDecimal(str));\n\n // 上限\n if(ans.compareTo(max) == 1){\n System.out.println(-1);\n over = true;\n break;\n }\n }\n\n if(!over){\n System.out.println(ans);\n }\n }\n}",
"public class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n // 整数の入力\n sc.nextLine();\n String[] arr = sc.nextLine().split(\" \");\n // 0\n if(Arrays.asList(arr).contains(\"0\")){\n System.out.println(0);\n return;\n }\n\n BigDecimal ans = BigDecimal.ONE;\n BigDecimal max = new BigDecimal(\"1000000000000000000\");\n boolean over = false;\n for(String str : arr){\n ans = ans.multiply(new BigDecimal(str));\n\n // 上限\n if(ans.compareTo(max) == 1){\n System.out.println(-1);\n over = true;\n break;\n }\n }\n\n if(!over){\n System.out.println(ans);\n }\n }\n}",
"Main"
] |
import java.math.BigDecimal;
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
// 整数の入力
sc.nextLine();
String[] arr = sc.nextLine().split(" ");
// 0
if(Arrays.asList(arr).contains("0")){
System.out.println(0);
return;
}
BigDecimal ans = BigDecimal.ONE;
BigDecimal max = new BigDecimal("1000000000000000000");
boolean over = false;
for(String str : arr){
ans = ans.multiply(new BigDecimal(str));
// 上限
if(ans.compareTo(max) == 1){
System.out.println(-1);
over = true;
break;
}
}
if(!over){
System.out.println(ans);
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
41,
13,
20,
41,
13,
20,
41,
13,
20,
4,
18,
13,
17,
13,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
17,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
28,
13,
13,
30,
30,
14,
2,
13,
17,
30,
4,
18,
13,
17,
29,
41,
13,
17,
28,
13,
13,
30,
30,
38,
5,
13,
30,
4,
18,
13,
40,
17,
29,
30,
0,
13,
4,
18,
13,
13,
13,
14,
2,
13,
13,
30,
4,
18,
13,
40,
17,
29,
4,
18,
13,
13,
23,
13,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
0,
13,
17,
23,
13,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
37,
20,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
25,
26
],
[
25,
27
],
[
0,
28
],
[
237,
29
],
[
237,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
35,
37
],
[
32,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
40,
42
],
[
32,
43
],
[
43,
44
],
[
43,
45
],
[
32,
46
],
[
46,
47
],
[
46,
48
],
[
32,
49
],
[
49,
50
],
[
49,
51
],
[
32,
52
],
[
52,
53
],
[
53,
54
],
[
52,
55
],
[
52,
56
],
[
52,
57
],
[
32,
58
],
[
58,
59
],
[
59,
60
],
[
30,
61
],
[
61,
62
],
[
237,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
63,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
70,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
70,
82
],
[
82,
83
],
[
82,
84
],
[
82,
85
],
[
86,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
92,
95
],
[
91,
96
],
[
70,
97
],
[
97,
98
],
[
97,
99
],
[
70,
100
],
[
100,
101
],
[
100,
102
],
[
100,
103
],
[
104,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
109,
112
],
[
112,
113
],
[
108,
114
],
[
105,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
119,
120
],
[
118,
121
],
[
118,
122
],
[
70,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
128,
131
],
[
131,
132
],
[
127,
133
],
[
70,
134
],
[
134,
135
],
[
135,
136
],
[
134,
137
],
[
68,
138
],
[
138,
139
],
[
68,
140
],
[
140,
141
],
[
68,
142
],
[
142,
143
],
[
237,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
144,
148
],
[
148,
149
],
[
144,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
152,
156
],
[
156,
157
],
[
156,
158
],
[
150,
159
],
[
159,
160
],
[
144,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
165,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
164,
173
],
[
173,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
177,
178
],
[
178,
179
],
[
174,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
163,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
144,
188
],
[
188,
189
],
[
188,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
192,
195
],
[
195,
196
],
[
144,
197
],
[
197,
198
],
[
197,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
201,
204
],
[
204,
205
],
[
144,
206
],
[
206,
207
],
[
206,
208
],
[
208,
209
],
[
209,
210
],
[
209,
211
],
[
208,
213
],
[
213,
214
],
[
214,
215
],
[
215,
216
],
[
215,
217
],
[
213,
218
],
[
218,
219
],
[
218,
220
],
[
213,
221
],
[
221,
222
],
[
222,
223
],
[
213,
224
],
[
225,
225
],
[
225,
226
],
[
226,
227
],
[
227,
228
],
[
227,
229
],
[
226,
230
],
[
230,
231
],
[
208,
232
],
[
232,
233
],
[
206,
234
],
[
234,
235
],
[
0,
236
],
[
236,
237
],
[
236,
238
]
] |
[
"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n BMultiplication2 solver = new BMultiplication2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class BMultiplication2 {\n private static final long MAX = 1_000_000_000_000_000_000L;\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n long[] a = in.readLongArray(n);\n\n for (long x : a) {\n if (x == 0) {\n out.println(0);\n return;\n }\n }\n\n long answer = 1;\n for (long x : a) {\n try {\n answer = Math.multiplyExact(answer, x);\n } catch (ArithmeticException e) {\n out.println(-1);\n return;\n }\n }\n\n if (answer > MAX) {\n out.println(-1);\n return;\n }\n\n out.println(answer);\n }\n\n }\n\n static class InputReader {\n public final BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public long[] readLongArray(int n) {\n long[] x = new long[n];\n for (int i = 0; i < n; i++) {\n x[i] = nextLong();\n }\n return x;\n }\n\n }\n}\n",
"import java.io.OutputStream;",
"OutputStream",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n BMultiplication2 solver = new BMultiplication2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class BMultiplication2 {\n private static final long MAX = 1_000_000_000_000_000_000L;\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n long[] a = in.readLongArray(n);\n\n for (long x : a) {\n if (x == 0) {\n out.println(0);\n return;\n }\n }\n\n long answer = 1;\n for (long x : a) {\n try {\n answer = Math.multiplyExact(answer, x);\n } catch (ArithmeticException e) {\n out.println(-1);\n return;\n }\n }\n\n if (answer > MAX) {\n out.println(-1);\n return;\n }\n\n out.println(answer);\n }\n\n }\n\n static class InputReader {\n public final BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public long[] readLongArray(int n) {\n long[] x = new long[n];\n for (int i = 0; i < n; i++) {\n x[i] = nextLong();\n }\n return x;\n }\n\n }\n}",
"Main",
"public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n BMultiplication2 solver = new BMultiplication2();\n solver.solve(1, in, out);\n out.close();\n }",
"main",
"{\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n BMultiplication2 solver = new BMultiplication2();\n solver.solve(1, in, out);\n out.close();\n }",
"InputStream inputStream = System.in;",
"inputStream",
"System.in",
"System",
"System.in",
"OutputStream outputStream = System.out;",
"outputStream",
"System.out",
"System",
"System.out",
"InputReader in = new InputReader(inputStream);",
"in",
"new InputReader(inputStream)",
"PrintWriter out = new PrintWriter(outputStream);",
"out",
"new PrintWriter(outputStream)",
"BMultiplication2 solver = new BMultiplication2();",
"solver",
"new BMultiplication2()",
"solver.solve(1, in, out)",
"solver.solve",
"solver",
"1",
"in",
"out",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class BMultiplication2 {\n private static final long MAX = 1_000_000_000_000_000_000L;\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n long[] a = in.readLongArray(n);\n\n for (long x : a) {\n if (x == 0) {\n out.println(0);\n return;\n }\n }\n\n long answer = 1;\n for (long x : a) {\n try {\n answer = Math.multiplyExact(answer, x);\n } catch (ArithmeticException e) {\n out.println(-1);\n return;\n }\n }\n\n if (answer > MAX) {\n out.println(-1);\n return;\n }\n\n out.println(answer);\n }\n\n }",
"BMultiplication2",
"private static final long MAX = 1_000_000_000_000_000_000L;",
"MAX",
"1_000_000_000_000_000_000L",
"public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n long[] a = in.readLongArray(n);\n\n for (long x : a) {\n if (x == 0) {\n out.println(0);\n return;\n }\n }\n\n long answer = 1;\n for (long x : a) {\n try {\n answer = Math.multiplyExact(answer, x);\n } catch (ArithmeticException e) {\n out.println(-1);\n return;\n }\n }\n\n if (answer > MAX) {\n out.println(-1);\n return;\n }\n\n out.println(answer);\n }",
"solve",
"{\n int n = in.nextInt();\n long[] a = in.readLongArray(n);\n\n for (long x : a) {\n if (x == 0) {\n out.println(0);\n return;\n }\n }\n\n long answer = 1;\n for (long x : a) {\n try {\n answer = Math.multiplyExact(answer, x);\n } catch (ArithmeticException e) {\n out.println(-1);\n return;\n }\n }\n\n if (answer > MAX) {\n out.println(-1);\n return;\n }\n\n out.println(answer);\n }",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"long[] a = in.readLongArray(n);",
"a",
"in.readLongArray(n)",
"in.readLongArray",
"in",
"n",
"for (long x : a) {\n if (x == 0) {\n out.println(0);\n return;\n }\n }",
"long x",
"a",
"{\n if (x == 0) {\n out.println(0);\n return;\n }\n }",
"{\n if (x == 0) {\n out.println(0);\n return;\n }\n }",
"if (x == 0) {\n out.println(0);\n return;\n }",
"x == 0",
"x",
"0",
"{\n out.println(0);\n return;\n }",
"out.println(0)",
"out.println",
"out",
"0",
"return;",
"long answer = 1;",
"answer",
"1",
"for (long x : a) {\n try {\n answer = Math.multiplyExact(answer, x);\n } catch (ArithmeticException e) {\n out.println(-1);\n return;\n }\n }",
"long x",
"a",
"{\n try {\n answer = Math.multiplyExact(answer, x);\n } catch (ArithmeticException e) {\n out.println(-1);\n return;\n }\n }",
"{\n try {\n answer = Math.multiplyExact(answer, x);\n } catch (ArithmeticException e) {\n out.println(-1);\n return;\n }\n }",
"try {\n answer = Math.multiplyExact(answer, x);\n } catch (ArithmeticException e) {\n out.println(-1);\n return;\n }",
"catch (ArithmeticException e) {\n out.println(-1);\n return;\n }",
"ArithmeticException e",
"{\n out.println(-1);\n return;\n }",
"out.println(-1)",
"out.println",
"out",
"-1",
"1",
"return;",
"{\n answer = Math.multiplyExact(answer, x);\n }",
"answer = Math.multiplyExact(answer, x)",
"answer",
"Math.multiplyExact(answer, x)",
"Math.multiplyExact",
"Math",
"answer",
"x",
"if (answer > MAX) {\n out.println(-1);\n return;\n }",
"answer > MAX",
"answer",
"MAX",
"{\n out.println(-1);\n return;\n }",
"out.println(-1)",
"out.println",
"out",
"-1",
"1",
"return;",
"out.println(answer)",
"out.println",
"out",
"answer",
"int testNumber",
"testNumber",
"InputReader in",
"in",
"PrintWriter out",
"out",
"static class InputReader {\n public final BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public long[] readLongArray(int n) {\n long[] x = new long[n];\n for (int i = 0; i < n; i++) {\n x[i] = nextLong();\n }\n return x;\n }\n\n }",
"InputReader",
"public final BufferedReader reader;",
"reader",
"public StringTokenizer tokenizer;",
"tokenizer",
"public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }",
"InputReader",
"{\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }",
"reader = new BufferedReader(new InputStreamReader(stream), 32768)",
"reader",
"new BufferedReader(new InputStreamReader(stream), 32768)",
"tokenizer = null",
"tokenizer",
"null",
"InputStream stream",
"stream",
"public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }",
"next",
"{\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }",
"while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }",
"tokenizer == null || !tokenizer.hasMoreTokens()",
"tokenizer == null",
"tokenizer",
"null",
"!tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens",
"tokenizer",
"{\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }",
"try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }",
"catch (IOException e) {\n throw new RuntimeException(e);\n }",
"IOException e",
"{\n throw new RuntimeException(e);\n }",
"throw new RuntimeException(e);",
"new RuntimeException(e)",
"{\n tokenizer = new StringTokenizer(reader.readLine());\n }",
"tokenizer = new StringTokenizer(reader.readLine())",
"tokenizer",
"new StringTokenizer(reader.readLine())",
"return tokenizer.nextToken();",
"tokenizer.nextToken()",
"tokenizer.nextToken",
"tokenizer",
"public int nextInt() {\n return Integer.parseInt(next());\n }",
"nextInt",
"{\n return Integer.parseInt(next());\n }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"public long nextLong() {\n return Long.parseLong(next());\n }",
"nextLong",
"{\n return Long.parseLong(next());\n }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"public long[] readLongArray(int n) {\n long[] x = new long[n];\n for (int i = 0; i < n; i++) {\n x[i] = nextLong();\n }\n return x;\n }",
"readLongArray",
"{\n long[] x = new long[n];\n for (int i = 0; i < n; i++) {\n x[i] = nextLong();\n }\n return x;\n }",
"long[] x = new long[n];",
"x",
"new long[n]",
"n",
"for (int i = 0; i < n; i++) {\n x[i] = nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n x[i] = nextLong();\n }",
"{\n x[i] = nextLong();\n }",
"x[i] = nextLong()",
"x[i]",
"x",
"i",
"nextLong()",
"nextLong",
"return x;",
"x",
"int n",
"n",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n BMultiplication2 solver = new BMultiplication2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class BMultiplication2 {\n private static final long MAX = 1_000_000_000_000_000_000L;\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n long[] a = in.readLongArray(n);\n\n for (long x : a) {\n if (x == 0) {\n out.println(0);\n return;\n }\n }\n\n long answer = 1;\n for (long x : a) {\n try {\n answer = Math.multiplyExact(answer, x);\n } catch (ArithmeticException e) {\n out.println(-1);\n return;\n }\n }\n\n if (answer > MAX) {\n out.println(-1);\n return;\n }\n\n out.println(answer);\n }\n\n }\n\n static class InputReader {\n public final BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public long[] readLongArray(int n) {\n long[] x = new long[n];\n for (int i = 0; i < n; i++) {\n x[i] = nextLong();\n }\n return x;\n }\n\n }\n}",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n BMultiplication2 solver = new BMultiplication2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class BMultiplication2 {\n private static final long MAX = 1_000_000_000_000_000_000L;\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n long[] a = in.readLongArray(n);\n\n for (long x : a) {\n if (x == 0) {\n out.println(0);\n return;\n }\n }\n\n long answer = 1;\n for (long x : a) {\n try {\n answer = Math.multiplyExact(answer, x);\n } catch (ArithmeticException e) {\n out.println(-1);\n return;\n }\n }\n\n if (answer > MAX) {\n out.println(-1);\n return;\n }\n\n out.println(answer);\n }\n\n }\n\n static class InputReader {\n public final BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public long[] readLongArray(int n) {\n long[] x = new long[n];\n for (int i = 0; i < n; i++) {\n x[i] = nextLong();\n }\n return x;\n }\n\n }\n}",
"Main"
] |
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
BMultiplication2 solver = new BMultiplication2();
solver.solve(1, in, out);
out.close();
}
static class BMultiplication2 {
private static final long MAX = 1_000_000_000_000_000_000L;
public void solve(int testNumber, InputReader in, PrintWriter out) {
int n = in.nextInt();
long[] a = in.readLongArray(n);
for (long x : a) {
if (x == 0) {
out.println(0);
return;
}
}
long answer = 1;
for (long x : a) {
try {
answer = Math.multiplyExact(answer, x);
} catch (ArithmeticException e) {
out.println(-1);
return;
}
}
if (answer > MAX) {
out.println(-1);
return;
}
out.println(answer);
}
}
static class InputReader {
public final BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
public long[] readLongArray(int n) {
long[] x = new long[n];
for (int i = 0; i < n; i++) {
x[i] = nextLong();
}
return x;
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
38,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
13,
13,
30,
0,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
114,
5
],
[
114,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
10,
11
],
[
11,
12
],
[
11,
13
],
[
10,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
16,
19
],
[
19,
20
],
[
20,
21
],
[
10,
22
],
[
22,
23
],
[
22,
24
],
[
10,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
43,
46
],
[
46,
47
],
[
47,
48
],
[
38,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
49,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
55,
62
],
[
10,
63
],
[
63,
64
],
[
63,
65
],
[
10,
66
],
[
66,
67
],
[
66,
68
],
[
10,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
74,
75
],
[
74,
76
],
[
69,
77
],
[
77,
78
],
[
78,
79
],
[
69,
80
],
[
81,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
87,
89
],
[
82,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
82,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
102,
103
],
[
96,
104
],
[
10,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
6,
111
],
[
111,
112
],
[
0,
113
],
[
113,
114
],
[
113,
115
]
] |
[
"import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n // Input\n int N = Integer.parseInt(sc.next());\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n // Calc\n long total = 1L;\n long LIMIT = 1000000000000000000L;\n for (int i = 0; i < N; i++) {\n if (a[i] <= LIMIT / total) {\n total *= a[i];\n } else {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(total);\n }\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n // Input\n int N = Integer.parseInt(sc.next());\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n // Calc\n long total = 1L;\n long LIMIT = 1000000000000000000L;\n for (int i = 0; i < N; i++) {\n if (a[i] <= LIMIT / total) {\n total *= a[i];\n } else {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(total);\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n // Input\n int N = Integer.parseInt(sc.next());\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n // Calc\n long total = 1L;\n long LIMIT = 1000000000000000000L;\n for (int i = 0; i < N; i++) {\n if (a[i] <= LIMIT / total) {\n total *= a[i];\n } else {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(total);\n }\n }",
"main",
"{\n try (Scanner sc = new Scanner(System.in)) {\n // Input\n int N = Integer.parseInt(sc.next());\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n // Calc\n long total = 1L;\n long LIMIT = 1000000000000000000L;\n for (int i = 0; i < N; i++) {\n if (a[i] <= LIMIT / total) {\n total *= a[i];\n } else {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(total);\n }\n }",
"try (Scanner sc = new Scanner(System.in)) {\n // Input\n int N = Integer.parseInt(sc.next());\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n // Calc\n long total = 1L;\n long LIMIT = 1000000000000000000L;\n for (int i = 0; i < N; i++) {\n if (a[i] <= LIMIT / total) {\n total *= a[i];\n } else {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(total);\n }",
"{\n // Input\n int N = Integer.parseInt(sc.next());\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n // Calc\n long total = 1L;\n long LIMIT = 1000000000000000000L;\n for (int i = 0; i < N; i++) {\n if (a[i] <= LIMIT / total) {\n total *= a[i];\n } else {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(total);\n }",
"Scanner sc = new Scanner(System.in)",
"Scanner sc = new Scanner(System.in)",
"new Scanner(System.in)",
"int N = Integer.parseInt(sc.next());",
"N",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"long[] a = new long[N];",
"a",
"new long[N]",
"N",
"for (int i = 0; i < N; i++) {\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }",
"{\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }",
"a[i] = Long.parseLong(sc.next())",
"a[i]",
"a",
"i",
"Long.parseLong(sc.next())",
"Long.parseLong",
"Long",
"sc.next()",
"sc.next",
"sc",
"if (a[i] == 0) {\n System.out.println(0);\n return;\n }",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"long total = 1L;",
"total",
"1L",
"long LIMIT = 1000000000000000000L;",
"LIMIT",
"1000000000000000000L",
"for (int i = 0; i < N; i++) {\n if (a[i] <= LIMIT / total) {\n total *= a[i];\n } else {\n System.out.println(-1);\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if (a[i] <= LIMIT / total) {\n total *= a[i];\n } else {\n System.out.println(-1);\n return;\n }\n }",
"{\n if (a[i] <= LIMIT / total) {\n total *= a[i];\n } else {\n System.out.println(-1);\n return;\n }\n }",
"if (a[i] <= LIMIT / total) {\n total *= a[i];\n } else {\n System.out.println(-1);\n return;\n }",
"a[i] <= LIMIT / total",
"a[i]",
"a",
"i",
"LIMIT / total",
"LIMIT",
"total",
"{\n total *= a[i];\n }",
"total *= a[i]",
"total",
"a[i]",
"a",
"i",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"System.out.println(total)",
"System.out.println",
"System.out",
"System",
"System.out",
"total",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n // Input\n int N = Integer.parseInt(sc.next());\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n // Calc\n long total = 1L;\n long LIMIT = 1000000000000000000L;\n for (int i = 0; i < N; i++) {\n if (a[i] <= LIMIT / total) {\n total *= a[i];\n } else {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(total);\n }\n }\n}",
"public class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n // Input\n int N = Integer.parseInt(sc.next());\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n // Calc\n long total = 1L;\n long LIMIT = 1000000000000000000L;\n for (int i = 0; i < N; i++) {\n if (a[i] <= LIMIT / total) {\n total *= a[i];\n } else {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(total);\n }\n }\n}",
"Main"
] |
import java.util.*;
public class Main {
public static void main(String[] args) {
try (Scanner sc = new Scanner(System.in)) {
// Input
int N = Integer.parseInt(sc.next());
long[] a = new long[N];
for (int i = 0; i < N; i++) {
a[i] = Long.parseLong(sc.next());
if (a[i] == 0) {
System.out.println(0);
return;
}
}
// Calc
long total = 1L;
long LIMIT = 1000000000000000000L;
for (int i = 0; i < N; i++) {
if (a[i] <= LIMIT / total) {
total *= a[i];
} else {
System.out.println(-1);
return;
}
}
System.out.println(total);
}
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
4,
18,
20,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
14,
2,
2,
4,
18,
13,
13,
4,
18,
13,
13,
17,
30,
0,
13,
17,
0,
13,
13,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
29,
4,
18,
18,
13,
13,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
4,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
13,
14
],
[
9,
15
],
[
15,
16
],
[
4,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
19,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
19,
30
],
[
30,
31
],
[
30,
32
],
[
19,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
33,
38
],
[
38,
39
],
[
38,
40
],
[
33,
41
],
[
41,
42
],
[
42,
43
],
[
33,
44
],
[
45,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
45,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
55,
62
],
[
45,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
66,
69
],
[
65,
70
],
[
70,
71
],
[
71,
72
],
[
70,
73
],
[
64,
74
],
[
63,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
45,
79
],
[
79,
80
],
[
79,
81
],
[
19,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
82,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
94,
95
],
[
88,
96
],
[
19,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
]
] |
[
"import java.util.*;\n\nclass Main {\n final Scanner sc = new Scanner(System.in);\n\n public static void main(String[] args) {\n new Main().run();\n }\n\n private void run() {\n int n = sc.nextInt();\n\n long a = sc.nextLong();\n boolean over = false;\n for (int i = 1; i < n; i++) {\n long m = sc.nextLong();\n if (m == 0) {\n System.out.println(0);\n return;\n }\n\n if (Math.log10(a) + Math.log10(m) > 18) {\n over = true;\n }\n a *= m;\n }\n if (over || a > 1000000000000000000L) {\n System.out.println(-1);\n return;\n }\n System.out.println(a);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"class Main {\n final Scanner sc = new Scanner(System.in);\n\n public static void main(String[] args) {\n new Main().run();\n }\n\n private void run() {\n int n = sc.nextInt();\n\n long a = sc.nextLong();\n boolean over = false;\n for (int i = 1; i < n; i++) {\n long m = sc.nextLong();\n if (m == 0) {\n System.out.println(0);\n return;\n }\n\n if (Math.log10(a) + Math.log10(m) > 18) {\n over = true;\n }\n a *= m;\n }\n if (over || a > 1000000000000000000L) {\n System.out.println(-1);\n return;\n }\n System.out.println(a);\n }\n}",
"Main",
"final Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"public static void main(String[] args) {\n new Main().run();\n }",
"main",
"{\n new Main().run();\n }",
"new Main().run()",
"new Main().run",
"new Main()",
"String[] args",
"args",
"private void run() {\n int n = sc.nextInt();\n\n long a = sc.nextLong();\n boolean over = false;\n for (int i = 1; i < n; i++) {\n long m = sc.nextLong();\n if (m == 0) {\n System.out.println(0);\n return;\n }\n\n if (Math.log10(a) + Math.log10(m) > 18) {\n over = true;\n }\n a *= m;\n }\n if (over || a > 1000000000000000000L) {\n System.out.println(-1);\n return;\n }\n System.out.println(a);\n }",
"run",
"{\n int n = sc.nextInt();\n\n long a = sc.nextLong();\n boolean over = false;\n for (int i = 1; i < n; i++) {\n long m = sc.nextLong();\n if (m == 0) {\n System.out.println(0);\n return;\n }\n\n if (Math.log10(a) + Math.log10(m) > 18) {\n over = true;\n }\n a *= m;\n }\n if (over || a > 1000000000000000000L) {\n System.out.println(-1);\n return;\n }\n System.out.println(a);\n }",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long a = sc.nextLong();",
"a",
"sc.nextLong()",
"sc.nextLong",
"sc",
"boolean over = false;",
"over",
"false",
"for (int i = 1; i < n; i++) {\n long m = sc.nextLong();\n if (m == 0) {\n System.out.println(0);\n return;\n }\n\n if (Math.log10(a) + Math.log10(m) > 18) {\n over = true;\n }\n a *= m;\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n long m = sc.nextLong();\n if (m == 0) {\n System.out.println(0);\n return;\n }\n\n if (Math.log10(a) + Math.log10(m) > 18) {\n over = true;\n }\n a *= m;\n }",
"{\n long m = sc.nextLong();\n if (m == 0) {\n System.out.println(0);\n return;\n }\n\n if (Math.log10(a) + Math.log10(m) > 18) {\n over = true;\n }\n a *= m;\n }",
"long m = sc.nextLong();",
"m",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (m == 0) {\n System.out.println(0);\n return;\n }",
"m == 0",
"m",
"0",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"if (Math.log10(a) + Math.log10(m) > 18) {\n over = true;\n }",
"Math.log10(a) + Math.log10(m) > 18",
"Math.log10(a) + Math.log10(m)",
"Math.log10(a)",
"Math.log10",
"Math",
"a",
"Math.log10(m)",
"Math.log10",
"Math",
"m",
"18",
"{\n over = true;\n }",
"over = true",
"over",
"true",
"a *= m",
"a",
"m",
"if (over || a > 1000000000000000000L) {\n System.out.println(-1);\n return;\n }",
"over || a > 1000000000000000000L",
"over",
"a > 1000000000000000000L",
"a",
"1000000000000000000L",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"System.out.println(a)",
"System.out.println",
"System.out",
"System",
"System.out",
"a"
] |
import java.util.*;
class Main {
final Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
new Main().run();
}
private void run() {
int n = sc.nextInt();
long a = sc.nextLong();
boolean over = false;
for (int i = 1; i < n; i++) {
long m = sc.nextLong();
if (m == 0) {
System.out.println(0);
return;
}
if (Math.log10(a) + Math.log10(m) > 18) {
over = true;
}
a *= m;
}
if (over || a > 1000000000000000000L) {
System.out.println(-1);
return;
}
System.out.println(a);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
18,
13,
17,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
18,
13,
13,
14,
2,
2,
17,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
0,
13,
17,
3,
14,
40,
13,
30,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
119,
8
],
[
119,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
11,
44
],
[
44,
45
],
[
45,
46
],
[
44,
47
],
[
11,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
50,
52
],
[
11,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
58,
63
],
[
53,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
68,
73
],
[
73,
74
],
[
73,
75
],
[
68,
76
],
[
76,
77
],
[
77,
78
],
[
68,
79
],
[
80,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
80,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
91,
92
],
[
91,
93
],
[
86,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
95,
100
],
[
100,
101
],
[
94,
102
],
[
102,
103
],
[
102,
104
],
[
94,
105
],
[
64,
106
],
[
106,
107
],
[
107,
108
],
[
106,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
9,
116
],
[
116,
117
],
[
0,
118
],
[
118,
119
],
[
118,
120
]
] |
[
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long[] nums = new long[N];\n for (int i = 0; i < N; i++) {\n nums[i] = sc.nextLong();\n }\n Arrays.sort(nums);\n long ans = nums[0];\n if (ans == 0) {\n System.out.println(0);\n } else {\n boolean over = false;\n for (int i = 1; i < N; i++) {\n ans *= nums[i];\n if (1000000000000000000L < ans || ans <= 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }\n if (!over) {\n System.out.println(ans);\n }\n }\n }\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long[] nums = new long[N];\n for (int i = 0; i < N; i++) {\n nums[i] = sc.nextLong();\n }\n Arrays.sort(nums);\n long ans = nums[0];\n if (ans == 0) {\n System.out.println(0);\n } else {\n boolean over = false;\n for (int i = 1; i < N; i++) {\n ans *= nums[i];\n if (1000000000000000000L < ans || ans <= 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }\n if (!over) {\n System.out.println(ans);\n }\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long[] nums = new long[N];\n for (int i = 0; i < N; i++) {\n nums[i] = sc.nextLong();\n }\n Arrays.sort(nums);\n long ans = nums[0];\n if (ans == 0) {\n System.out.println(0);\n } else {\n boolean over = false;\n for (int i = 1; i < N; i++) {\n ans *= nums[i];\n if (1000000000000000000L < ans || ans <= 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }\n if (!over) {\n System.out.println(ans);\n }\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long[] nums = new long[N];\n for (int i = 0; i < N; i++) {\n nums[i] = sc.nextLong();\n }\n Arrays.sort(nums);\n long ans = nums[0];\n if (ans == 0) {\n System.out.println(0);\n } else {\n boolean over = false;\n for (int i = 1; i < N; i++) {\n ans *= nums[i];\n if (1000000000000000000L < ans || ans <= 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }\n if (!over) {\n System.out.println(ans);\n }\n }\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] nums = new long[N];",
"nums",
"new long[N]",
"N",
"for (int i = 0; i < N; i++) {\n nums[i] = sc.nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n nums[i] = sc.nextLong();\n }",
"{\n nums[i] = sc.nextLong();\n }",
"nums[i] = sc.nextLong()",
"nums[i]",
"nums",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"Arrays.sort(nums)",
"Arrays.sort",
"Arrays",
"nums",
"long ans = nums[0];",
"ans",
"nums[0]",
"nums",
"0",
"if (ans == 0) {\n System.out.println(0);\n } else {\n boolean over = false;\n for (int i = 1; i < N; i++) {\n ans *= nums[i];\n if (1000000000000000000L < ans || ans <= 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }\n if (!over) {\n System.out.println(ans);\n }\n }",
"ans == 0",
"ans",
"0",
"{\n System.out.println(0);\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"{\n boolean over = false;\n for (int i = 1; i < N; i++) {\n ans *= nums[i];\n if (1000000000000000000L < ans || ans <= 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }\n if (!over) {\n System.out.println(ans);\n }\n }",
"boolean over = false;",
"over",
"false",
"for (int i = 1; i < N; i++) {\n ans *= nums[i];\n if (1000000000000000000L < ans || ans <= 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n ans *= nums[i];\n if (1000000000000000000L < ans || ans <= 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }",
"{\n ans *= nums[i];\n if (1000000000000000000L < ans || ans <= 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }",
"ans *= nums[i]",
"ans",
"nums[i]",
"nums",
"i",
"if (1000000000000000000L < ans || ans <= 0) {\n System.out.println(-1);\n over = true;\n break;\n }",
"1000000000000000000L < ans || ans <= 0",
"1000000000000000000L < ans",
"1000000000000000000L",
"ans",
"ans <= 0",
"ans",
"0",
"{\n System.out.println(-1);\n over = true;\n break;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"over = true",
"over",
"true",
"break;",
"if (!over) {\n System.out.println(ans);\n }",
"!over",
"over",
"{\n System.out.println(ans);\n }",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long[] nums = new long[N];\n for (int i = 0; i < N; i++) {\n nums[i] = sc.nextLong();\n }\n Arrays.sort(nums);\n long ans = nums[0];\n if (ans == 0) {\n System.out.println(0);\n } else {\n boolean over = false;\n for (int i = 1; i < N; i++) {\n ans *= nums[i];\n if (1000000000000000000L < ans || ans <= 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }\n if (!over) {\n System.out.println(ans);\n }\n }\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long[] nums = new long[N];\n for (int i = 0; i < N; i++) {\n nums[i] = sc.nextLong();\n }\n Arrays.sort(nums);\n long ans = nums[0];\n if (ans == 0) {\n System.out.println(0);\n } else {\n boolean over = false;\n for (int i = 1; i < N; i++) {\n ans *= nums[i];\n if (1000000000000000000L < ans || ans <= 0) {\n System.out.println(-1);\n over = true;\n break;\n }\n }\n if (!over) {\n System.out.println(ans);\n }\n }\n }\n}",
"Main"
] |
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[] nums = new long[N];
for (int i = 0; i < N; i++) {
nums[i] = sc.nextLong();
}
Arrays.sort(nums);
long ans = nums[0];
if (ans == 0) {
System.out.println(0);
} else {
boolean over = false;
for (int i = 1; i < N; i++) {
ans *= nums[i];
if (1000000000000000000L < ans || ans <= 0) {
System.out.println(-1);
over = true;
break;
}
}
if (!over) {
System.out.println(ans);
}
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
2,
13,
13,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
29,
30,
0,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
12,
13,
30,
20,
23,
13,
6,
13,
41,
13,
18,
13,
13,
41,
13,
20,
17,
41,
13,
17,
41,
13,
17,
12,
13,
30,
14,
2,
13,
13,
30,
29,
17,
30,
0,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
29,
17,
29,
17,
12,
13,
30,
14,
4,
13,
29,
18,
13,
40,
13,
29,
40,
17,
12,
13,
30,
29,
2,
2,
17,
13,
2,
13,
17,
23,
13,
12,
13,
30,
42,
2,
4,
13,
40,
4,
13,
18,
13,
13,
40,
13,
29,
4,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
20,
41,
13,
4,
13,
42,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
17,
41,
13,
17,
41,
13,
4,
13,
14,
2,
13,
17,
30,
0,
13,
17,
0,
13,
4,
13,
14,
2,
2,
13,
17,
2,
17,
13,
30,
37,
20,
42,
17,
30,
14,
2,
2,
17,
13,
2,
13,
17,
30,
0,
13,
17,
0,
13,
2,
13,
17,
14,
2,
2,
13,
40,
17,
40,
4,
13,
13,
30,
29,
8,
13,
40,
13,
13,
30,
37,
20,
0,
13,
4,
13,
12,
13,
30,
41,
13,
4,
13,
14,
2,
2,
13,
18,
13,
13,
2,
13,
18,
13,
13,
37,
20,
29,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
371,
14
],
[
371,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
17,
26
],
[
26,
27
],
[
26,
28
],
[
17,
29
],
[
29,
30
],
[
29,
31
],
[
17,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
33,
38
],
[
38,
39
],
[
38,
40
],
[
33,
41
],
[
41,
42
],
[
42,
43
],
[
33,
44
],
[
45,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
46,
50
],
[
50,
51
],
[
51,
52
],
[
45,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
53,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
60,
65
],
[
59,
66
],
[
17,
67
],
[
67,
68
],
[
67,
69
],
[
17,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
70,
75
],
[
75,
76
],
[
75,
77
],
[
70,
78
],
[
78,
79
],
[
79,
80
],
[
70,
81
],
[
82,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
89,
90
],
[
89,
91
],
[
84,
92
],
[
83,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
94,
99
],
[
99,
100
],
[
93,
101
],
[
83,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
17,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
371,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
114,
118
],
[
118,
119
],
[
0,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
124,
126
],
[
120,
127
],
[
127,
128
],
[
127,
129
],
[
120,
131
],
[
131,
132
],
[
131,
133
],
[
120,
134
],
[
134,
135
],
[
134,
136
],
[
120,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
144,
145
],
[
145,
146
],
[
140,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
147,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
151,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
162,
163
],
[
161,
164
],
[
147,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
165,
169
],
[
169,
170
],
[
170,
171
],
[
139,
172
],
[
172,
173
],
[
120,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
177,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
183,
184
],
[
177,
185
],
[
185,
186
],
[
186,
187
],
[
120,
188
],
[
188,
189
],
[
188,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
193,
195
],
[
192,
196
],
[
196,
197
],
[
196,
198
],
[
188,
199
],
[
199,
200
],
[
120,
201
],
[
201,
202
],
[
201,
203
],
[
203,
204
],
[
204,
205
],
[
205,
206
],
[
206,
207
],
[
205,
208
],
[
208,
209
],
[
209,
210
],
[
209,
211
],
[
211,
212
],
[
211,
213
],
[
204,
214
],
[
214,
215
],
[
203,
216
],
[
216,
217
],
[
217,
218
],
[
120,
219
],
[
219,
220
],
[
219,
221
],
[
221,
222
],
[
222,
223
],
[
223,
224
],
[
224,
225
],
[
222,
226
],
[
226,
227
],
[
221,
228
],
[
228,
229
],
[
228,
230
],
[
221,
231
],
[
231,
232
],
[
231,
233
],
[
233,
234
],
[
221,
235
],
[
235,
236
],
[
236,
237
],
[
236,
238
],
[
235,
239
],
[
239,
240
],
[
240,
241
],
[
241,
242
],
[
240,
243
],
[
239,
244
],
[
244,
245
],
[
244,
246
],
[
246,
247
],
[
221,
248
],
[
248,
249
],
[
249,
250
],
[
250,
251
],
[
120,
252
],
[
252,
253
],
[
252,
254
],
[
254,
255
],
[
255,
256
],
[
256,
257
],
[
257,
258
],
[
255,
259
],
[
259,
260
],
[
254,
261
],
[
261,
262
],
[
261,
263
],
[
254,
264
],
[
264,
265
],
[
264,
266
],
[
254,
267
],
[
267,
268
],
[
267,
269
],
[
269,
270
],
[
254,
271
],
[
271,
272
],
[
272,
273
],
[
272,
274
],
[
271,
275
],
[
275,
276
],
[
276,
277
],
[
276,
278
],
[
275,
279
],
[
279,
280
],
[
279,
281
],
[
281,
282
],
[
254,
283
],
[
283,
284
],
[
284,
285
],
[
285,
286
],
[
285,
287
],
[
284,
288
],
[
288,
289
],
[
288,
290
],
[
283,
291
],
[
291,
292
],
[
292,
293
],
[
254,
294
],
[
294,
295
],
[
294,
296
],
[
296,
297
],
[
297,
298
],
[
298,
299
],
[
299,
300
],
[
299,
301
],
[
298,
302
],
[
302,
303
],
[
302,
304
],
[
297,
305
],
[
305,
306
],
[
306,
307
],
[
306,
308
],
[
305,
309
],
[
309,
310
],
[
309,
311
],
[
311,
312
],
[
311,
313
],
[
297,
314
],
[
314,
315
],
[
315,
316
],
[
316,
317
],
[
316,
318
],
[
318,
319
],
[
315,
320
],
[
320,
321
],
[
321,
322
],
[
321,
323
],
[
314,
324
],
[
324,
325
],
[
325,
326
],
[
326,
327
],
[
326,
328
],
[
328,
329
],
[
326,
330
],
[
314,
331
],
[
331,
332
],
[
332,
333
],
[
296,
334
],
[
334,
335
],
[
334,
336
],
[
336,
337
],
[
120,
338
],
[
338,
339
],
[
338,
340
],
[
340,
341
],
[
341,
342
],
[
341,
343
],
[
343,
344
],
[
340,
345
],
[
345,
346
],
[
346,
347
],
[
347,
348
],
[
347,
349
],
[
349,
350
],
[
349,
351
],
[
346,
352
],
[
352,
353
],
[
352,
354
],
[
354,
355
],
[
354,
356
],
[
345,
357
],
[
357,
358
],
[
340,
359
],
[
359,
360
],
[
120,
361
],
[
361,
362
],
[
361,
363
],
[
363,
364
],
[
364,
365
],
[
365,
366
],
[
366,
367
],
[
365,
368
],
[
368,
369
],
[
0,
370
],
[
370,
371
],
[
370,
372
]
] |
[
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.math.BigInteger;\nimport java.util.*;\n\npublic class Main {\n\t\n\tpublic Main() {\n\t\tFastScanner scanner = new FastScanner();\n\t\tint N = scanner.nextInt();\n\t\t\n\t\tlong limit = 1000000000000000000L;\n\t\tlong[] A = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = scanner.nextLong();\n\t\t\tif (A[i] == 0L) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlong Ans = 1;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\t if( ((limit/Ans)/A[i]) == 0L ) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tAns *= A[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(Ans);\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main();\n\t}\n}\n\nclass FastScanner {\n\tprivate final InputStream in = System.in;\n\tprivate final byte[] buffer = new byte[1024];\n\tprivate int ptr = 0;\n\tprivate int buflen = 0;\n\t\n\tprivate boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\t\n\tprivate int readByte() {\n\t\tif (hasNextByte()) return buffer[ptr++];\n\t\telse return -1;\n\t}\n\t\n\tprivate static boolean isPrintableChar(int c) {\n\t\treturn 33 <= c && c <= 126;\n\t}\n\t\n\tpublic boolean hasNext() {\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n\t\treturn hasNextByte();\n\t}\n\t\n\tpublic String next() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\t\n\tpublic long nextLong() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t\n\tpublic int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n\t\treturn (int) nl;\n\t}\n\t\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\t\n\tpublic Main() {\n\t\tFastScanner scanner = new FastScanner();\n\t\tint N = scanner.nextInt();\n\t\t\n\t\tlong limit = 1000000000000000000L;\n\t\tlong[] A = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = scanner.nextLong();\n\t\t\tif (A[i] == 0L) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlong Ans = 1;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\t if( ((limit/Ans)/A[i]) == 0L ) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tAns *= A[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(Ans);\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main();\n\t}\n}",
"Main",
"public Main() {\n\t\tFastScanner scanner = new FastScanner();\n\t\tint N = scanner.nextInt();\n\t\t\n\t\tlong limit = 1000000000000000000L;\n\t\tlong[] A = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = scanner.nextLong();\n\t\t\tif (A[i] == 0L) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlong Ans = 1;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\t if( ((limit/Ans)/A[i]) == 0L ) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tAns *= A[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(Ans);\n\t}",
"Main",
"{\n\t\tFastScanner scanner = new FastScanner();\n\t\tint N = scanner.nextInt();\n\t\t\n\t\tlong limit = 1000000000000000000L;\n\t\tlong[] A = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = scanner.nextLong();\n\t\t\tif (A[i] == 0L) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlong Ans = 1;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\t if( ((limit/Ans)/A[i]) == 0L ) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tAns *= A[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(Ans);\n\t}",
"FastScanner scanner = new FastScanner();",
"scanner",
"new FastScanner()",
"int N = scanner.nextInt();",
"N",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"long limit = 1000000000000000000L;",
"limit",
"1000000000000000000L",
"long[] A = new long[N];",
"A",
"new long[N]",
"N",
"for (int i = 0; i < N; i++) {\n\t\t\tA[i] = scanner.nextLong();\n\t\t\tif (A[i] == 0L) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tA[i] = scanner.nextLong();\n\t\t\tif (A[i] == 0L) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"{\n\t\t\tA[i] = scanner.nextLong();\n\t\t\tif (A[i] == 0L) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"A[i] = scanner.nextLong()",
"A[i]",
"A",
"i",
"scanner.nextLong()",
"scanner.nextLong",
"scanner",
"if (A[i] == 0L) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}",
"A[i] == 0L",
"A[i]",
"A",
"i",
"0L",
"{\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"long Ans = 1;",
"Ans",
"1",
"for (int i = 0; i < N; i++) {\n\t\t\t if( ((limit/Ans)/A[i]) == 0L ) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tAns *= A[i];\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\t if( ((limit/Ans)/A[i]) == 0L ) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tAns *= A[i];\n\t\t\t}\n\t\t}",
"{\n\t\t\t if( ((limit/Ans)/A[i]) == 0L ) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tAns *= A[i];\n\t\t\t}\n\t\t}",
"if( ((limit/Ans)/A[i]) == 0L ) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tAns *= A[i];\n\t\t\t}",
"((limit/Ans)/A[i]) == 0L",
"((limit/Ans)/A[i])",
"(limit/Ans)",
"limit",
"Ans",
"A[i]",
"A",
"i",
"0L",
"{\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"{\n\t\t\t\tAns *= A[i];\n\t\t\t}",
"Ans *= A[i]",
"Ans",
"A[i]",
"A",
"i",
"System.out.println(Ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"Ans",
"public static void main(String[] args) {\n\t\tnew Main();\n\t}",
"main",
"{\n\t\tnew Main();\n\t}",
"new Main()",
"String[] args",
"args",
"class FastScanner {\n\tprivate final InputStream in = System.in;\n\tprivate final byte[] buffer = new byte[1024];\n\tprivate int ptr = 0;\n\tprivate int buflen = 0;\n\t\n\tprivate boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\t\n\tprivate int readByte() {\n\t\tif (hasNextByte()) return buffer[ptr++];\n\t\telse return -1;\n\t}\n\t\n\tprivate static boolean isPrintableChar(int c) {\n\t\treturn 33 <= c && c <= 126;\n\t}\n\t\n\tpublic boolean hasNext() {\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n\t\treturn hasNextByte();\n\t}\n\t\n\tpublic String next() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\t\n\tpublic long nextLong() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t\n\tpublic int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n\t\treturn (int) nl;\n\t}\n\t\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}",
"FastScanner",
"private final InputStream in = System.in;",
"in",
"System.in",
"System",
"System.in",
"private final byte[] buffer = new byte[1024];",
"buffer",
"new byte[1024]",
"1024",
"private int ptr = 0;",
"ptr",
"0",
"private int buflen = 0;",
"buflen",
"0",
"private boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}",
"hasNextByte",
"{\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}",
"if (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}",
"ptr < buflen",
"ptr",
"buflen",
"{\n\t\t\treturn true;\n\t\t}",
"return true;",
"true",
"{\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}",
"ptr = 0",
"ptr",
"0",
"try {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}",
"catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}",
"IOException e",
"{\n\t\t\t\te.printStackTrace();\n\t\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t}",
"buflen = in.read(buffer)",
"buflen",
"in.read(buffer)",
"in.read",
"in",
"buffer",
"if (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}",
"buflen <= 0",
"buflen",
"0",
"{\n\t\t\t\treturn false;\n\t\t\t}",
"return false;",
"false",
"return true;",
"true",
"private int readByte() {\n\t\tif (hasNextByte()) return buffer[ptr++];\n\t\telse return -1;\n\t}",
"readByte",
"{\n\t\tif (hasNextByte()) return buffer[ptr++];\n\t\telse return -1;\n\t}",
"if (hasNextByte()) return buffer[ptr++];\n\t\telse return -1;",
"hasNextByte()",
"hasNextByte",
"return buffer[ptr++];",
"buffer[ptr++]",
"buffer",
"ptr++",
"ptr",
"return -1;",
"-1",
"1",
"private static boolean isPrintableChar(int c) {\n\t\treturn 33 <= c && c <= 126;\n\t}",
"isPrintableChar",
"{\n\t\treturn 33 <= c && c <= 126;\n\t}",
"return 33 <= c && c <= 126;",
"33 <= c && c <= 126",
"33 <= c",
"33",
"c",
"c <= 126",
"c",
"126",
"int c",
"c",
"public boolean hasNext() {\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n\t\treturn hasNextByte();\n\t}",
"hasNext",
"{\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n\t\treturn hasNextByte();\n\t}",
"while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;",
"hasNextByte() && !isPrintableChar(buffer[ptr])",
"hasNextByte()",
"hasNextByte",
"!isPrintableChar(buffer[ptr])",
"isPrintableChar(buffer[ptr])",
"isPrintableChar",
"buffer[ptr]",
"buffer",
"ptr",
"ptr++",
"ptr",
"return hasNextByte();",
"hasNextByte()",
"hasNextByte",
"public String next() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}",
"next",
"{\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}",
"if (!hasNext()) throw new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"while (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}",
"sb.appendCodePoint(b)",
"sb.appendCodePoint",
"sb",
"b",
"b = readByte()",
"b",
"readByte()",
"readByte",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public long nextLong() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}",
"nextLong",
"{\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}",
"if (!hasNext()) throw new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"long n = 0;",
"n",
"0",
"boolean minus = false;",
"minus",
"false",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"if (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}",
"b == '-'",
"b",
"'-'",
"{\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}",
"minus = true",
"minus",
"true",
"b = readByte()",
"b",
"readByte()",
"readByte",
"if (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}",
"b < '0' || '9' < b",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"{\n\t\t\tthrow new NumberFormatException();\n\t\t}",
"throw new NumberFormatException();",
"new NumberFormatException()",
"while (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}",
"true",
"{\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}",
"if ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}",
"'0' <= b && b <= '9'",
"'0' <= b",
"'0'",
"b",
"b <= '9'",
"b",
"'9'",
"{\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t}",
"n *= 10",
"n",
"10",
"n += b - '0'",
"n",
"b - '0'",
"b",
"'0'",
"if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}",
"b == -1 || !isPrintableChar(b)",
"b == -1",
"b",
"-1",
"1",
"!isPrintableChar(b)",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n\t\t\t\treturn minus ? -n : n;\n\t\t\t}",
"return minus ? -n : n;",
"minus ? -n : n",
"minus",
"-n",
"n",
"n",
"{\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}",
"throw new NumberFormatException();",
"new NumberFormatException()",
"b = readByte()",
"b",
"readByte()",
"readByte",
"public int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n\t\treturn (int) nl;\n\t}",
"nextInt",
"{\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n\t\treturn (int) nl;\n\t}",
"long nl = nextLong();",
"nl",
"nextLong()",
"nextLong",
"if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();",
"nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE",
"nl < Integer.MIN_VALUE",
"nl",
"Integer.MIN_VALUE",
"Integer",
"Integer.MIN_VALUE",
"nl > Integer.MAX_VALUE",
"nl",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"throw new NumberFormatException();",
"new NumberFormatException()",
"return (int) nl;",
"(int) nl",
"public double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}",
"nextDouble",
"{\n\t\treturn Double.parseDouble(next());\n\t}",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public class Main {\n\t\n\tpublic Main() {\n\t\tFastScanner scanner = new FastScanner();\n\t\tint N = scanner.nextInt();\n\t\t\n\t\tlong limit = 1000000000000000000L;\n\t\tlong[] A = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = scanner.nextLong();\n\t\t\tif (A[i] == 0L) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlong Ans = 1;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\t if( ((limit/Ans)/A[i]) == 0L ) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tAns *= A[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(Ans);\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main();\n\t}\n}",
"public class Main {\n\t\n\tpublic Main() {\n\t\tFastScanner scanner = new FastScanner();\n\t\tint N = scanner.nextInt();\n\t\t\n\t\tlong limit = 1000000000000000000L;\n\t\tlong[] A = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = scanner.nextLong();\n\t\t\tif (A[i] == 0L) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlong Ans = 1;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\t if( ((limit/Ans)/A[i]) == 0L ) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tAns *= A[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(Ans);\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main();\n\t}\n}",
"Main"
] |
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.*;
public class Main {
public Main() {
FastScanner scanner = new FastScanner();
int N = scanner.nextInt();
long limit = 1000000000000000000L;
long[] A = new long[N];
for (int i = 0; i < N; i++) {
A[i] = scanner.nextLong();
if (A[i] == 0L) {
System.out.println(0);
return;
}
}
long Ans = 1;
for (int i = 0; i < N; i++) {
if( ((limit/Ans)/A[i]) == 0L ) {
System.out.println(-1);
return;
} else {
Ans *= A[i];
}
}
System.out.println(Ans);
}
public static void main(String[] args) {
new Main();
}
}
class FastScanner {
private final InputStream in = System.in;
private final byte[] buffer = new byte[1024];
private int ptr = 0;
private int buflen = 0;
private boolean hasNextByte() {
if (ptr < buflen) {
return true;
} else {
ptr = 0;
try {
buflen = in.read(buffer);
} catch (IOException e) {
e.printStackTrace();
}
if (buflen <= 0) {
return false;
}
}
return true;
}
private int readByte() {
if (hasNextByte()) return buffer[ptr++];
else return -1;
}
private static boolean isPrintableChar(int c) {
return 33 <= c && c <= 126;
}
public boolean hasNext() {
while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
return hasNextByte();
}
public String next() {
if (!hasNext()) throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int b = readByte();
while (isPrintableChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public long nextLong() {
if (!hasNext()) throw new NoSuchElementException();
long n = 0;
boolean minus = false;
int b = readByte();
if (b == '-') {
minus = true;
b = readByte();
}
if (b < '0' || '9' < b) {
throw new NumberFormatException();
}
while (true) {
if ('0' <= b && b <= '9') {
n *= 10;
n += b - '0';
} else if (b == -1 || !isPrintableChar(b)) {
return minus ? -n : n;
} else {
throw new NumberFormatException();
}
b = readByte();
}
}
public int nextInt() {
long nl = nextLong();
if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
return (int) nl;
}
public double nextDouble() {
return Double.parseDouble(next());
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
38,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
2,
13,
18,
13,
13,
14,
2,
2,
2,
13,
18,
13,
13,
13,
2,
13,
13,
30,
0,
13,
40,
17,
3,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
119,
5
],
[
119,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
10,
11
],
[
11,
12
],
[
11,
13
],
[
10,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
16,
19
],
[
19,
20
],
[
20,
21
],
[
10,
22
],
[
22,
23
],
[
22,
24
],
[
10,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
43,
46
],
[
46,
47
],
[
47,
48
],
[
38,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
49,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
55,
62
],
[
10,
63
],
[
63,
64
],
[
63,
65
],
[
10,
66
],
[
66,
67
],
[
66,
68
],
[
10,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
74,
75
],
[
74,
76
],
[
69,
77
],
[
77,
78
],
[
78,
79
],
[
69,
80
],
[
81,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
81,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
94,
96
],
[
91,
97
],
[
90,
98
],
[
98,
99
],
[
98,
100
],
[
89,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
101,
106
],
[
81,
107
],
[
107,
108
],
[
107,
109
],
[
10,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
6,
116
],
[
116,
117
],
[
0,
118
],
[
118,
119
],
[
118,
120
]
] |
[
"import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n // Input\n int N = Integer.parseInt(sc.next());\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n // Calc\n long total = 1L;\n long LIMIT = 1000000000000000000L;\n for (int i = 0; i < N; i++) {\n long mul = total * a[i];\n if (mul / a[i] != total || mul > LIMIT) {\n total = -1;\n break;\n }\n total = mul;\n }\n System.out.println(total);\n }\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n // Input\n int N = Integer.parseInt(sc.next());\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n // Calc\n long total = 1L;\n long LIMIT = 1000000000000000000L;\n for (int i = 0; i < N; i++) {\n long mul = total * a[i];\n if (mul / a[i] != total || mul > LIMIT) {\n total = -1;\n break;\n }\n total = mul;\n }\n System.out.println(total);\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n // Input\n int N = Integer.parseInt(sc.next());\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n // Calc\n long total = 1L;\n long LIMIT = 1000000000000000000L;\n for (int i = 0; i < N; i++) {\n long mul = total * a[i];\n if (mul / a[i] != total || mul > LIMIT) {\n total = -1;\n break;\n }\n total = mul;\n }\n System.out.println(total);\n }\n }",
"main",
"{\n try (Scanner sc = new Scanner(System.in)) {\n // Input\n int N = Integer.parseInt(sc.next());\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n // Calc\n long total = 1L;\n long LIMIT = 1000000000000000000L;\n for (int i = 0; i < N; i++) {\n long mul = total * a[i];\n if (mul / a[i] != total || mul > LIMIT) {\n total = -1;\n break;\n }\n total = mul;\n }\n System.out.println(total);\n }\n }",
"try (Scanner sc = new Scanner(System.in)) {\n // Input\n int N = Integer.parseInt(sc.next());\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n // Calc\n long total = 1L;\n long LIMIT = 1000000000000000000L;\n for (int i = 0; i < N; i++) {\n long mul = total * a[i];\n if (mul / a[i] != total || mul > LIMIT) {\n total = -1;\n break;\n }\n total = mul;\n }\n System.out.println(total);\n }",
"{\n // Input\n int N = Integer.parseInt(sc.next());\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n // Calc\n long total = 1L;\n long LIMIT = 1000000000000000000L;\n for (int i = 0; i < N; i++) {\n long mul = total * a[i];\n if (mul / a[i] != total || mul > LIMIT) {\n total = -1;\n break;\n }\n total = mul;\n }\n System.out.println(total);\n }",
"Scanner sc = new Scanner(System.in)",
"Scanner sc = new Scanner(System.in)",
"new Scanner(System.in)",
"int N = Integer.parseInt(sc.next());",
"N",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"long[] a = new long[N];",
"a",
"new long[N]",
"N",
"for (int i = 0; i < N; i++) {\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }",
"{\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }",
"a[i] = Long.parseLong(sc.next())",
"a[i]",
"a",
"i",
"Long.parseLong(sc.next())",
"Long.parseLong",
"Long",
"sc.next()",
"sc.next",
"sc",
"if (a[i] == 0) {\n System.out.println(0);\n return;\n }",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"long total = 1L;",
"total",
"1L",
"long LIMIT = 1000000000000000000L;",
"LIMIT",
"1000000000000000000L",
"for (int i = 0; i < N; i++) {\n long mul = total * a[i];\n if (mul / a[i] != total || mul > LIMIT) {\n total = -1;\n break;\n }\n total = mul;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n long mul = total * a[i];\n if (mul / a[i] != total || mul > LIMIT) {\n total = -1;\n break;\n }\n total = mul;\n }",
"{\n long mul = total * a[i];\n if (mul / a[i] != total || mul > LIMIT) {\n total = -1;\n break;\n }\n total = mul;\n }",
"long mul = total * a[i];",
"mul",
"total * a[i]",
"total",
"a[i]",
"a",
"i",
"if (mul / a[i] != total || mul > LIMIT) {\n total = -1;\n break;\n }",
"mul / a[i] != total || mul > LIMIT",
"mul / a[i] != total",
"mul / a[i]",
"mul",
"a[i]",
"a",
"i",
"total",
"mul > LIMIT",
"mul",
"LIMIT",
"{\n total = -1;\n break;\n }",
"total = -1",
"total",
"-1",
"1",
"break;",
"total = mul",
"total",
"mul",
"System.out.println(total)",
"System.out.println",
"System.out",
"System",
"System.out",
"total",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n // Input\n int N = Integer.parseInt(sc.next());\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n // Calc\n long total = 1L;\n long LIMIT = 1000000000000000000L;\n for (int i = 0; i < N; i++) {\n long mul = total * a[i];\n if (mul / a[i] != total || mul > LIMIT) {\n total = -1;\n break;\n }\n total = mul;\n }\n System.out.println(total);\n }\n }\n}",
"public class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n // Input\n int N = Integer.parseInt(sc.next());\n long[] a = new long[N];\n for (int i = 0; i < N; i++) {\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n System.out.println(0);\n return;\n }\n }\n\n // Calc\n long total = 1L;\n long LIMIT = 1000000000000000000L;\n for (int i = 0; i < N; i++) {\n long mul = total * a[i];\n if (mul / a[i] != total || mul > LIMIT) {\n total = -1;\n break;\n }\n total = mul;\n }\n System.out.println(total);\n }\n }\n}",
"Main"
] |
import java.util.*;
public class Main {
public static void main(String[] args) {
try (Scanner sc = new Scanner(System.in)) {
// Input
int N = Integer.parseInt(sc.next());
long[] a = new long[N];
for (int i = 0; i < N; i++) {
a[i] = Long.parseLong(sc.next());
if (a[i] == 0) {
System.out.println(0);
return;
}
}
// Calc
long total = 1L;
long LIMIT = 1000000000000000000L;
for (int i = 0; i < N; i++) {
long mul = total * a[i];
if (mul / a[i] != total || mul > LIMIT) {
total = -1;
break;
}
total = mul;
}
System.out.println(total);
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
20,
13,
41,
13,
4,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
0,
13,
17,
3,
14,
2,
18,
13,
13,
2,
13,
13,
30,
0,
13,
40,
17,
30,
0,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
106,
5
],
[
106,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
26,
29
],
[
26,
30
],
[
8,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
36,
37
],
[
36,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
31,
42
],
[
43,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
48,
49
],
[
49,
50
],
[
8,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
56,
57
],
[
56,
58
],
[
51,
59
],
[
59,
60
],
[
60,
61
],
[
51,
62
],
[
63,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
64,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
74
],
[
64,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
80,
81
],
[
80,
82
],
[
75,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
75,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
8,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
94,
99
],
[
8,
100
],
[
100,
101
],
[
101,
102
],
[
6,
103
],
[
103,
104
],
[
0,
105
],
[
105,
106
],
[
105,
107
]
] |
[
"\n\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scanner = new Scanner(System.in);\n\n\t\tint n = scanner.nextInt();\n\t\tlong ans = 1 ;\n\t\tlong[] a = new long[n];\n\t\tlong max = (long)Math.pow(10, 18);\n\n\t\tfor(int i=0 ; i<n ; i++) {\n\t\t\t a[i] = scanner.nextLong();\n\t\t}\n\n\t\tfor(int i=0 ; i<n ; i++) {\n\t\t\tif(a[i]==0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(a[i] > (max/ans)) {\n\t\t\t\tans = -1;\n\t\t\t}else {\n\t\t\t\tans *= a[i];\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(ans);\n\n\t\tscanner.close();\n\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scanner = new Scanner(System.in);\n\n\t\tint n = scanner.nextInt();\n\t\tlong ans = 1 ;\n\t\tlong[] a = new long[n];\n\t\tlong max = (long)Math.pow(10, 18);\n\n\t\tfor(int i=0 ; i<n ; i++) {\n\t\t\t a[i] = scanner.nextLong();\n\t\t}\n\n\t\tfor(int i=0 ; i<n ; i++) {\n\t\t\tif(a[i]==0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(a[i] > (max/ans)) {\n\t\t\t\tans = -1;\n\t\t\t}else {\n\t\t\t\tans *= a[i];\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(ans);\n\n\t\tscanner.close();\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\n\t\tScanner scanner = new Scanner(System.in);\n\n\t\tint n = scanner.nextInt();\n\t\tlong ans = 1 ;\n\t\tlong[] a = new long[n];\n\t\tlong max = (long)Math.pow(10, 18);\n\n\t\tfor(int i=0 ; i<n ; i++) {\n\t\t\t a[i] = scanner.nextLong();\n\t\t}\n\n\t\tfor(int i=0 ; i<n ; i++) {\n\t\t\tif(a[i]==0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(a[i] > (max/ans)) {\n\t\t\t\tans = -1;\n\t\t\t}else {\n\t\t\t\tans *= a[i];\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(ans);\n\n\t\tscanner.close();\n\n\t}",
"main",
"{\n\n\t\tScanner scanner = new Scanner(System.in);\n\n\t\tint n = scanner.nextInt();\n\t\tlong ans = 1 ;\n\t\tlong[] a = new long[n];\n\t\tlong max = (long)Math.pow(10, 18);\n\n\t\tfor(int i=0 ; i<n ; i++) {\n\t\t\t a[i] = scanner.nextLong();\n\t\t}\n\n\t\tfor(int i=0 ; i<n ; i++) {\n\t\t\tif(a[i]==0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(a[i] > (max/ans)) {\n\t\t\t\tans = -1;\n\t\t\t}else {\n\t\t\t\tans *= a[i];\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(ans);\n\n\t\tscanner.close();\n\n\t}",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"long ans = 1 ;",
"ans",
"1",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"long max = (long)Math.pow(10, 18);",
"max",
"(long)Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"for(int i=0 ; i<n ; i++) {\n\t\t\t a[i] = scanner.nextLong();\n\t\t}",
"int i=0 ;",
"int i=0 ;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t a[i] = scanner.nextLong();\n\t\t}",
"{\n\t\t\t a[i] = scanner.nextLong();\n\t\t}",
"a[i] = scanner.nextLong()",
"a[i]",
"a",
"i",
"scanner.nextLong()",
"scanner.nextLong",
"scanner",
"for(int i=0 ; i<n ; i++) {\n\t\t\tif(a[i]==0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(a[i] > (max/ans)) {\n\t\t\t\tans = -1;\n\t\t\t}else {\n\t\t\t\tans *= a[i];\n\t\t\t}\n\n\t\t}",
"int i=0 ;",
"int i=0 ;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tif(a[i]==0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(a[i] > (max/ans)) {\n\t\t\t\tans = -1;\n\t\t\t}else {\n\t\t\t\tans *= a[i];\n\t\t\t}\n\n\t\t}",
"{\n\t\t\tif(a[i]==0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(a[i] > (max/ans)) {\n\t\t\t\tans = -1;\n\t\t\t}else {\n\t\t\t\tans *= a[i];\n\t\t\t}\n\n\t\t}",
"if(a[i]==0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(a[i] > (max/ans)) {\n\t\t\t\tans = -1;\n\t\t\t}else {\n\t\t\t\tans *= a[i];\n\t\t\t}",
"a[i]==0",
"a[i]",
"a",
"i",
"0",
"{\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}",
"ans = 0",
"ans",
"0",
"break;",
"if(a[i] > (max/ans)) {\n\t\t\t\tans = -1;\n\t\t\t}else {\n\t\t\t\tans *= a[i];\n\t\t\t}",
"a[i] > (max/ans)",
"a[i]",
"a",
"i",
"(max/ans)",
"max",
"ans",
"{\n\t\t\t\tans = -1;\n\t\t\t}",
"ans = -1",
"ans",
"-1",
"1",
"{\n\t\t\t\tans *= a[i];\n\t\t\t}",
"ans *= a[i]",
"ans",
"a[i]",
"a",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"scanner.close()",
"scanner.close",
"scanner",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scanner = new Scanner(System.in);\n\n\t\tint n = scanner.nextInt();\n\t\tlong ans = 1 ;\n\t\tlong[] a = new long[n];\n\t\tlong max = (long)Math.pow(10, 18);\n\n\t\tfor(int i=0 ; i<n ; i++) {\n\t\t\t a[i] = scanner.nextLong();\n\t\t}\n\n\t\tfor(int i=0 ; i<n ; i++) {\n\t\t\tif(a[i]==0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(a[i] > (max/ans)) {\n\t\t\t\tans = -1;\n\t\t\t}else {\n\t\t\t\tans *= a[i];\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(ans);\n\n\t\tscanner.close();\n\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scanner = new Scanner(System.in);\n\n\t\tint n = scanner.nextInt();\n\t\tlong ans = 1 ;\n\t\tlong[] a = new long[n];\n\t\tlong max = (long)Math.pow(10, 18);\n\n\t\tfor(int i=0 ; i<n ; i++) {\n\t\t\t a[i] = scanner.nextLong();\n\t\t}\n\n\t\tfor(int i=0 ; i<n ; i++) {\n\t\t\tif(a[i]==0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(a[i] > (max/ans)) {\n\t\t\t\tans = -1;\n\t\t\t}else {\n\t\t\t\tans *= a[i];\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(ans);\n\n\t\tscanner.close();\n\n\t}\n\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
long ans = 1 ;
long[] a = new long[n];
long max = (long)Math.pow(10, 18);
for(int i=0 ; i<n ; i++) {
a[i] = scanner.nextLong();
}
for(int i=0 ; i<n ; i++) {
if(a[i]==0) {
ans = 0;
break;
}else if(a[i] > (max/ans)) {
ans = -1;
}else {
ans *= a[i];
}
}
System.out.println(ans);
scanner.close();
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
0,
13,
17,
3,
38,
5,
13,
30,
0,
13,
40,
17,
30,
14,
2,
13,
17,
30,
0,
13,
17,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
13,
18,
13,
13,
14,
2,
13,
17,
30,
0,
13,
40,
17,
3,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
117,
5
],
[
117,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
8,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
32,
33
],
[
32,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
27,
38
],
[
39,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
39,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
47,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
8,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
58,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
67,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
81,
82
],
[
81,
83
],
[
76,
84
],
[
84,
85
],
[
85,
86
],
[
76,
87
],
[
88,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
91,
95
],
[
95,
96
],
[
95,
97
],
[
88,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
102,
107
],
[
8,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
6,
114
],
[
114,
115
],
[
0,
116
],
[
116,
117
],
[
116,
118
]
] |
[
"import java.util.Scanner;\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long A[] = new long[N];\n long ans = 1;\n int zero = 2;\n \n for(int i = 0; i < N ; i++){\n A[i] = sc.nextLong();\n if(A[i] == 0){\n zero = 0;\n break;\n }\n }\n try{\n if(zero == 0){\n ans = 0;\n }else{for(int i = 0; i < N ; i++){\n ans = Math.multiplyExact(ans, A[i]);\n if(ans > 1000000000000000000L){\n ans = -1;\n break;\n }\n }\n }\n }catch(ArithmeticException e){\n ans = -1;\n }\n System.out.println(ans);\n \n \n } \n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long A[] = new long[N];\n long ans = 1;\n int zero = 2;\n \n for(int i = 0; i < N ; i++){\n A[i] = sc.nextLong();\n if(A[i] == 0){\n zero = 0;\n break;\n }\n }\n try{\n if(zero == 0){\n ans = 0;\n }else{for(int i = 0; i < N ; i++){\n ans = Math.multiplyExact(ans, A[i]);\n if(ans > 1000000000000000000L){\n ans = -1;\n break;\n }\n }\n }\n }catch(ArithmeticException e){\n ans = -1;\n }\n System.out.println(ans);\n \n \n } \n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long A[] = new long[N];\n long ans = 1;\n int zero = 2;\n \n for(int i = 0; i < N ; i++){\n A[i] = sc.nextLong();\n if(A[i] == 0){\n zero = 0;\n break;\n }\n }\n try{\n if(zero == 0){\n ans = 0;\n }else{for(int i = 0; i < N ; i++){\n ans = Math.multiplyExact(ans, A[i]);\n if(ans > 1000000000000000000L){\n ans = -1;\n break;\n }\n }\n }\n }catch(ArithmeticException e){\n ans = -1;\n }\n System.out.println(ans);\n \n \n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long A[] = new long[N];\n long ans = 1;\n int zero = 2;\n \n for(int i = 0; i < N ; i++){\n A[i] = sc.nextLong();\n if(A[i] == 0){\n zero = 0;\n break;\n }\n }\n try{\n if(zero == 0){\n ans = 0;\n }else{for(int i = 0; i < N ; i++){\n ans = Math.multiplyExact(ans, A[i]);\n if(ans > 1000000000000000000L){\n ans = -1;\n break;\n }\n }\n }\n }catch(ArithmeticException e){\n ans = -1;\n }\n System.out.println(ans);\n \n \n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long A[] = new long[N];",
"A",
"new long[N]",
"N",
"long ans = 1;",
"ans",
"1",
"int zero = 2;",
"zero",
"2",
"for(int i = 0; i < N ; i++){\n A[i] = sc.nextLong();\n if(A[i] == 0){\n zero = 0;\n break;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i] = sc.nextLong();\n if(A[i] == 0){\n zero = 0;\n break;\n }\n }",
"{\n A[i] = sc.nextLong();\n if(A[i] == 0){\n zero = 0;\n break;\n }\n }",
"A[i] = sc.nextLong()",
"A[i]",
"A",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(A[i] == 0){\n zero = 0;\n break;\n }",
"A[i] == 0",
"A[i]",
"A",
"i",
"0",
"{\n zero = 0;\n break;\n }",
"zero = 0",
"zero",
"0",
"break;",
"try{\n if(zero == 0){\n ans = 0;\n }else{for(int i = 0; i < N ; i++){\n ans = Math.multiplyExact(ans, A[i]);\n if(ans > 1000000000000000000L){\n ans = -1;\n break;\n }\n }\n }\n }catch(ArithmeticException e){\n ans = -1;\n }",
"catch(ArithmeticException e){\n ans = -1;\n }",
"ArithmeticException e",
"{\n ans = -1;\n }",
"ans = -1",
"ans",
"-1",
"1",
"{\n if(zero == 0){\n ans = 0;\n }else{for(int i = 0; i < N ; i++){\n ans = Math.multiplyExact(ans, A[i]);\n if(ans > 1000000000000000000L){\n ans = -1;\n break;\n }\n }\n }\n }",
"if(zero == 0){\n ans = 0;\n }else{for(int i = 0; i < N ; i++){\n ans = Math.multiplyExact(ans, A[i]);\n if(ans > 1000000000000000000L){\n ans = -1;\n break;\n }\n }\n }",
"zero == 0",
"zero",
"0",
"{\n ans = 0;\n }",
"ans = 0",
"ans",
"0",
"{for(int i = 0; i < N ; i++){\n ans = Math.multiplyExact(ans, A[i]);\n if(ans > 1000000000000000000L){\n ans = -1;\n break;\n }\n }\n }",
"for(int i = 0; i < N ; i++){\n ans = Math.multiplyExact(ans, A[i]);\n if(ans > 1000000000000000000L){\n ans = -1;\n break;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n ans = Math.multiplyExact(ans, A[i]);\n if(ans > 1000000000000000000L){\n ans = -1;\n break;\n }\n }",
"{\n ans = Math.multiplyExact(ans, A[i]);\n if(ans > 1000000000000000000L){\n ans = -1;\n break;\n }\n }",
"ans = Math.multiplyExact(ans, A[i])",
"ans",
"Math.multiplyExact(ans, A[i])",
"Math.multiplyExact",
"Math",
"ans",
"A[i]",
"A",
"i",
"if(ans > 1000000000000000000L){\n ans = -1;\n break;\n }",
"ans > 1000000000000000000L",
"ans",
"1000000000000000000L",
"{\n ans = -1;\n break;\n }",
"ans = -1",
"ans",
"-1",
"1",
"break;",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long A[] = new long[N];\n long ans = 1;\n int zero = 2;\n \n for(int i = 0; i < N ; i++){\n A[i] = sc.nextLong();\n if(A[i] == 0){\n zero = 0;\n break;\n }\n }\n try{\n if(zero == 0){\n ans = 0;\n }else{for(int i = 0; i < N ; i++){\n ans = Math.multiplyExact(ans, A[i]);\n if(ans > 1000000000000000000L){\n ans = -1;\n break;\n }\n }\n }\n }catch(ArithmeticException e){\n ans = -1;\n }\n System.out.println(ans);\n \n \n } \n}",
"public class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long A[] = new long[N];\n long ans = 1;\n int zero = 2;\n \n for(int i = 0; i < N ; i++){\n A[i] = sc.nextLong();\n if(A[i] == 0){\n zero = 0;\n break;\n }\n }\n try{\n if(zero == 0){\n ans = 0;\n }else{for(int i = 0; i < N ; i++){\n ans = Math.multiplyExact(ans, A[i]);\n if(ans > 1000000000000000000L){\n ans = -1;\n break;\n }\n }\n }\n }catch(ArithmeticException e){\n ans = -1;\n }\n System.out.println(ans);\n \n \n } \n}",
"Main"
] |
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];
long ans = 1;
int zero = 2;
for(int i = 0; i < N ; i++){
A[i] = sc.nextLong();
if(A[i] == 0){
zero = 0;
break;
}
}
try{
if(zero == 0){
ans = 0;
}else{for(int i = 0; i < N ; i++){
ans = Math.multiplyExact(ans, A[i]);
if(ans > 1000000000000000000L){
ans = -1;
break;
}
}
}
}catch(ArithmeticException e){
ans = -1;
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
13,
29,
41,
13,
4,
18,
13,
17,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
38,
5,
13,
30,
4,
18,
18,
13,
13,
17,
4,
18,
13,
29,
30,
0,
13,
4,
18,
13,
13,
18,
13,
13,
14,
2,
13,
13,
30,
4,
18,
18,
13,
13,
17,
4,
18,
13,
29,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
132,
5
],
[
132,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
33,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
41,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
48,
53
],
[
47,
54
],
[
54,
55
],
[
55,
56
],
[
47,
57
],
[
8,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
61,
62
],
[
60,
63
],
[
60,
64
],
[
8,
65
],
[
65,
66
],
[
65,
67
],
[
8,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
68,
73
],
[
73,
74
],
[
73,
75
],
[
68,
76
],
[
76,
77
],
[
77,
78
],
[
68,
79
],
[
80,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
85,
90
],
[
84,
91
],
[
91,
92
],
[
92,
93
],
[
84,
94
],
[
81,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
95,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
109,
116
],
[
116,
117
],
[
117,
118
],
[
109,
119
],
[
8,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
8,
126
],
[
126,
127
],
[
127,
128
],
[
6,
129
],
[
129,
130
],
[
0,
131
],
[
131,
132
],
[
131,
133
]
] |
[
"import java.util.Scanner;\n\n/**\n * B - Multiplication 2\n * N 個の整数 A1,...,AN が与えられます。\n * A1×...×AN を求めてください。\n * ただし、結果が 10の18乗 を超える場合は、代わりに -1 を出力してください。\n */\npublic class Main {\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner( System.in );\n // 入力値\n int n = sc.nextInt();\n long[] a = new long[n];\n\n for ( int i = 0; i < n; i++ ) {\n a[i] = sc.nextLong();\n if ( a[i] == 0 ) {\n System.out.println(0);\n sc.close();\n return;\n }\n }\n\n // 最大値\n long max = ( long ) Math.pow( 10, 18 );\n\n // 入力値を計算\n long result = 1;\n for( int i = 0; i < n; i++ ) {\n\n try {\n result = Math.multiplyExact( result, a[i] );\n if( result > max ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }\n }\n catch ( Exception e ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }\n }\n\n System.out.println( result );\n\n sc.close();\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner( System.in );\n // 入力値\n int n = sc.nextInt();\n long[] a = new long[n];\n\n for ( int i = 0; i < n; i++ ) {\n a[i] = sc.nextLong();\n if ( a[i] == 0 ) {\n System.out.println(0);\n sc.close();\n return;\n }\n }\n\n // 最大値\n long max = ( long ) Math.pow( 10, 18 );\n\n // 入力値を計算\n long result = 1;\n for( int i = 0; i < n; i++ ) {\n\n try {\n result = Math.multiplyExact( result, a[i] );\n if( result > max ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }\n }\n catch ( Exception e ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }\n }\n\n System.out.println( result );\n\n sc.close();\n }\n}",
"Main",
"public static void main(String[] args) {\n\n Scanner sc = new Scanner( System.in );\n // 入力値\n int n = sc.nextInt();\n long[] a = new long[n];\n\n for ( int i = 0; i < n; i++ ) {\n a[i] = sc.nextLong();\n if ( a[i] == 0 ) {\n System.out.println(0);\n sc.close();\n return;\n }\n }\n\n // 最大値\n long max = ( long ) Math.pow( 10, 18 );\n\n // 入力値を計算\n long result = 1;\n for( int i = 0; i < n; i++ ) {\n\n try {\n result = Math.multiplyExact( result, a[i] );\n if( result > max ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }\n }\n catch ( Exception e ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }\n }\n\n System.out.println( result );\n\n sc.close();\n }",
"main",
"{\n\n Scanner sc = new Scanner( System.in );\n // 入力値\n int n = sc.nextInt();\n long[] a = new long[n];\n\n for ( int i = 0; i < n; i++ ) {\n a[i] = sc.nextLong();\n if ( a[i] == 0 ) {\n System.out.println(0);\n sc.close();\n return;\n }\n }\n\n // 最大値\n long max = ( long ) Math.pow( 10, 18 );\n\n // 入力値を計算\n long result = 1;\n for( int i = 0; i < n; i++ ) {\n\n try {\n result = Math.multiplyExact( result, a[i] );\n if( result > max ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }\n }\n catch ( Exception e ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }\n }\n\n System.out.println( result );\n\n sc.close();\n }",
"Scanner sc = new Scanner( System.in );",
"sc",
"new Scanner( System.in )",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for ( int i = 0; i < n; i++ ) {\n a[i] = sc.nextLong();\n if ( a[i] == 0 ) {\n System.out.println(0);\n sc.close();\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = sc.nextLong();\n if ( a[i] == 0 ) {\n System.out.println(0);\n sc.close();\n return;\n }\n }",
"{\n a[i] = sc.nextLong();\n if ( a[i] == 0 ) {\n System.out.println(0);\n sc.close();\n return;\n }\n }",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if ( a[i] == 0 ) {\n System.out.println(0);\n sc.close();\n return;\n }",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"{\n System.out.println(0);\n sc.close();\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"sc.close()",
"sc.close",
"sc",
"return;",
"long max = ( long ) Math.pow( 10, 18 );",
"max",
"( long ) Math.pow( 10, 18 )",
"Math.pow",
"Math",
"10",
"18",
"long result = 1;",
"result",
"1",
"for( int i = 0; i < n; i++ ) {\n\n try {\n result = Math.multiplyExact( result, a[i] );\n if( result > max ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }\n }\n catch ( Exception e ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\n try {\n result = Math.multiplyExact( result, a[i] );\n if( result > max ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }\n }\n catch ( Exception e ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }\n }",
"{\n\n try {\n result = Math.multiplyExact( result, a[i] );\n if( result > max ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }\n }\n catch ( Exception e ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }\n }",
"try {\n result = Math.multiplyExact( result, a[i] );\n if( result > max ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }\n }\n catch ( Exception e ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }",
"catch ( Exception e ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }",
"Exception e",
"{\n System.out.println( \"-1\" );\n sc.close();\n return;\n }",
"System.out.println( \"-1\" )",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"sc.close()",
"sc.close",
"sc",
"return;",
"{\n result = Math.multiplyExact( result, a[i] );\n if( result > max ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }\n }",
"result = Math.multiplyExact( result, a[i] )",
"result",
"Math.multiplyExact( result, a[i] )",
"Math.multiplyExact",
"Math",
"result",
"a[i]",
"a",
"i",
"if( result > max ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }",
"result > max",
"result",
"max",
"{\n System.out.println( \"-1\" );\n sc.close();\n return;\n }",
"System.out.println( \"-1\" )",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"sc.close()",
"sc.close",
"sc",
"return;",
"System.out.println( result )",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"public class Main {\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner( System.in );\n // 入力値\n int n = sc.nextInt();\n long[] a = new long[n];\n\n for ( int i = 0; i < n; i++ ) {\n a[i] = sc.nextLong();\n if ( a[i] == 0 ) {\n System.out.println(0);\n sc.close();\n return;\n }\n }\n\n // 最大値\n long max = ( long ) Math.pow( 10, 18 );\n\n // 入力値を計算\n long result = 1;\n for( int i = 0; i < n; i++ ) {\n\n try {\n result = Math.multiplyExact( result, a[i] );\n if( result > max ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }\n }\n catch ( Exception e ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }\n }\n\n System.out.println( result );\n\n sc.close();\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner( System.in );\n // 入力値\n int n = sc.nextInt();\n long[] a = new long[n];\n\n for ( int i = 0; i < n; i++ ) {\n a[i] = sc.nextLong();\n if ( a[i] == 0 ) {\n System.out.println(0);\n sc.close();\n return;\n }\n }\n\n // 最大値\n long max = ( long ) Math.pow( 10, 18 );\n\n // 入力値を計算\n long result = 1;\n for( int i = 0; i < n; i++ ) {\n\n try {\n result = Math.multiplyExact( result, a[i] );\n if( result > max ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }\n }\n catch ( Exception e ) {\n System.out.println( \"-1\" );\n sc.close();\n return;\n }\n }\n\n System.out.println( result );\n\n sc.close();\n }\n}",
"Main"
] |
import java.util.Scanner;
/**
* B - Multiplication 2
* N 個の整数 A1,...,AN が与えられます。
* A1×...×AN を求めてください。
* ただし、結果が 10の18乗 を超える場合は、代わりに -1 を出力してください。
*/
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();
if ( a[i] == 0 ) {
System.out.println(0);
sc.close();
return;
}
}
// 最大値
long max = ( long ) Math.pow( 10, 18 );
// 入力値を計算
long result = 1;
for( int i = 0; i < n; i++ ) {
try {
result = Math.multiplyExact( result, a[i] );
if( result > max ) {
System.out.println( "-1" );
sc.close();
return;
}
}
catch ( Exception e ) {
System.out.println( "-1" );
sc.close();
return;
}
}
System.out.println( result );
sc.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
17,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
30,
0,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
112,
8
],
[
112,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
36,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
44,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
50,
57
],
[
11,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
11,
62
],
[
62,
63
],
[
62,
64
],
[
11,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
69,
71
],
[
65,
72
],
[
72,
73
],
[
72,
74
],
[
65,
75
],
[
75,
76
],
[
76,
77
],
[
65,
78
],
[
79,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
85,
87
],
[
80,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
94,
95
],
[
88,
96
],
[
80,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
11,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
9,
109
],
[
109,
110
],
[
0,
111
],
[
111,
112
],
[
111,
113
]
] |
[
"import java.util.Scanner;\nimport java.util.Arrays;\npublic class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n long [] a = new long[n];\n for (int i = 0; i < n; i++){\n a[i] = scan.nextLong();\n if (a[i] == 0){\n System.out.println(0);\n return;\n }\n }\n \n Arrays.sort(a);\n \n long ans = 1;\n\n for (int i = n-1; i >= 0; i--){\n if (a[i] > 1000000000000000000L/ans){\n System.out.println(-1);\n return;\n }else{\n ans *= a[i];\n }\n }\n System.out.println(ans);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"public class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n long [] a = new long[n];\n for (int i = 0; i < n; i++){\n a[i] = scan.nextLong();\n if (a[i] == 0){\n System.out.println(0);\n return;\n }\n }\n \n Arrays.sort(a);\n \n long ans = 1;\n\n for (int i = n-1; i >= 0; i--){\n if (a[i] > 1000000000000000000L/ans){\n System.out.println(-1);\n return;\n }else{\n ans *= a[i];\n }\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n long [] a = new long[n];\n for (int i = 0; i < n; i++){\n a[i] = scan.nextLong();\n if (a[i] == 0){\n System.out.println(0);\n return;\n }\n }\n \n Arrays.sort(a);\n \n long ans = 1;\n\n for (int i = n-1; i >= 0; i--){\n if (a[i] > 1000000000000000000L/ans){\n System.out.println(-1);\n return;\n }else{\n ans *= a[i];\n }\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n long [] a = new long[n];\n for (int i = 0; i < n; i++){\n a[i] = scan.nextLong();\n if (a[i] == 0){\n System.out.println(0);\n return;\n }\n }\n \n Arrays.sort(a);\n \n long ans = 1;\n\n for (int i = n-1; i >= 0; i--){\n if (a[i] > 1000000000000000000L/ans){\n System.out.println(-1);\n return;\n }else{\n ans *= a[i];\n }\n }\n System.out.println(ans);\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"long [] a = new long[n];",
"a",
"new long[n]",
"n",
"for (int i = 0; i < n; i++){\n a[i] = scan.nextLong();\n if (a[i] == 0){\n System.out.println(0);\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = scan.nextLong();\n if (a[i] == 0){\n System.out.println(0);\n return;\n }\n }",
"{\n a[i] = scan.nextLong();\n if (a[i] == 0){\n System.out.println(0);\n return;\n }\n }",
"a[i] = scan.nextLong()",
"a[i]",
"a",
"i",
"scan.nextLong()",
"scan.nextLong",
"scan",
"if (a[i] == 0){\n System.out.println(0);\n return;\n }",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"long ans = 1;",
"ans",
"1",
"for (int i = n-1; i >= 0; i--){\n if (a[i] > 1000000000000000000L/ans){\n System.out.println(-1);\n return;\n }else{\n ans *= a[i];\n }\n }",
"int i = n-1;",
"int i = n-1;",
"i",
"n-1",
"n",
"1",
"i >= 0",
"i",
"0",
"i--",
"i--",
"i",
"{\n if (a[i] > 1000000000000000000L/ans){\n System.out.println(-1);\n return;\n }else{\n ans *= a[i];\n }\n }",
"{\n if (a[i] > 1000000000000000000L/ans){\n System.out.println(-1);\n return;\n }else{\n ans *= a[i];\n }\n }",
"if (a[i] > 1000000000000000000L/ans){\n System.out.println(-1);\n return;\n }else{\n ans *= a[i];\n }",
"a[i] > 1000000000000000000L/ans",
"a[i]",
"a",
"i",
"1000000000000000000L/ans",
"1000000000000000000L",
"ans",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"{\n ans *= a[i];\n }",
"ans *= a[i]",
"ans",
"a[i]",
"a",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n long [] a = new long[n];\n for (int i = 0; i < n; i++){\n a[i] = scan.nextLong();\n if (a[i] == 0){\n System.out.println(0);\n return;\n }\n }\n \n Arrays.sort(a);\n \n long ans = 1;\n\n for (int i = n-1; i >= 0; i--){\n if (a[i] > 1000000000000000000L/ans){\n System.out.println(-1);\n return;\n }else{\n ans *= a[i];\n }\n }\n System.out.println(ans);\n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n long [] a = new long[n];\n for (int i = 0; i < n; i++){\n a[i] = scan.nextLong();\n if (a[i] == 0){\n System.out.println(0);\n return;\n }\n }\n \n Arrays.sort(a);\n \n long ans = 1;\n\n for (int i = n-1; i >= 0; i--){\n if (a[i] > 1000000000000000000L/ans){\n System.out.println(-1);\n return;\n }else{\n ans *= a[i];\n }\n }\n System.out.println(ans);\n }\n}",
"Main"
] |
import java.util.Scanner;
import java.util.Arrays;
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
long [] a = new long[n];
for (int i = 0; i < n; i++){
a[i] = scan.nextLong();
if (a[i] == 0){
System.out.println(0);
return;
}
}
Arrays.sort(a);
long ans = 1;
for (int i = n-1; i >= 0; i--){
if (a[i] > 1000000000000000000L/ans){
System.out.println(-1);
return;
}else{
ans *= a[i];
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
4,
18,
18,
13,
13,
4,
18,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
13,
17,
4,
18,
13,
4,
18,
18,
18,
13,
13,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
17,
41,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
4,
18,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
146,
14
],
[
146,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
17,
26
],
[
26,
27
],
[
26,
28
],
[
17,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
30,
41
],
[
42,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
47,
48
],
[
48,
49
],
[
42,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
56,
57
],
[
57,
58
],
[
56,
59
],
[
50,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
61,
66
],
[
60,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
17,
71
],
[
71,
72
],
[
72,
73
],
[
17,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
74,
81
],
[
74,
82
],
[
82,
83
],
[
83,
84
],
[
17,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
17,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
17,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
102,
103
],
[
102,
104
],
[
97,
105
],
[
105,
106
],
[
106,
107
],
[
97,
108
],
[
109,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
113,
114
],
[
112,
115
],
[
115,
116
],
[
115,
117
],
[
109,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
119,
124
],
[
118,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
126,
131
],
[
131,
132
],
[
125,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
17,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
137,
142
],
[
15,
143
],
[
143,
144
],
[
0,
145
],
[
145,
146
],
[
145,
147
]
] |
[
"import java.util.Scanner;\nimport java.util.Collections;\nimport java.util.Arrays;\nimport java.math.BigInteger;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n\n BigInteger[] a = new BigInteger[n];\n for(int i=0; i<n; i++) {\n a[i] = sc.nextBigInteger();\n if(a[i].equals(BigInteger.valueOf(0))) {\n System.out.println(0);\n System.exit(0);\n }\n }\n sc.close();\n java.util.Arrays.sort(a, Collections.reverseOrder());\n\n BigInteger ans = BigInteger.valueOf(1);\n //1000000000000000000\n BigInteger limit = BigInteger.valueOf(1000000000000000000L);\n for(int i=0; i<n; i++) {\n ans = ans.multiply(a[i]);\n if(ans.compareTo(limit) > 0) {\n System.out.println(-1);\n System.exit(0);\n }\n }\n System.out.println(ans);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Collections;",
"Collections",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n\n BigInteger[] a = new BigInteger[n];\n for(int i=0; i<n; i++) {\n a[i] = sc.nextBigInteger();\n if(a[i].equals(BigInteger.valueOf(0))) {\n System.out.println(0);\n System.exit(0);\n }\n }\n sc.close();\n java.util.Arrays.sort(a, Collections.reverseOrder());\n\n BigInteger ans = BigInteger.valueOf(1);\n //1000000000000000000\n BigInteger limit = BigInteger.valueOf(1000000000000000000L);\n for(int i=0; i<n; i++) {\n ans = ans.multiply(a[i]);\n if(ans.compareTo(limit) > 0) {\n System.out.println(-1);\n System.exit(0);\n }\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n\n BigInteger[] a = new BigInteger[n];\n for(int i=0; i<n; i++) {\n a[i] = sc.nextBigInteger();\n if(a[i].equals(BigInteger.valueOf(0))) {\n System.out.println(0);\n System.exit(0);\n }\n }\n sc.close();\n java.util.Arrays.sort(a, Collections.reverseOrder());\n\n BigInteger ans = BigInteger.valueOf(1);\n //1000000000000000000\n BigInteger limit = BigInteger.valueOf(1000000000000000000L);\n for(int i=0; i<n; i++) {\n ans = ans.multiply(a[i]);\n if(ans.compareTo(limit) > 0) {\n System.out.println(-1);\n System.exit(0);\n }\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n\n BigInteger[] a = new BigInteger[n];\n for(int i=0; i<n; i++) {\n a[i] = sc.nextBigInteger();\n if(a[i].equals(BigInteger.valueOf(0))) {\n System.out.println(0);\n System.exit(0);\n }\n }\n sc.close();\n java.util.Arrays.sort(a, Collections.reverseOrder());\n\n BigInteger ans = BigInteger.valueOf(1);\n //1000000000000000000\n BigInteger limit = BigInteger.valueOf(1000000000000000000L);\n for(int i=0; i<n; i++) {\n ans = ans.multiply(a[i]);\n if(ans.compareTo(limit) > 0) {\n System.out.println(-1);\n System.exit(0);\n }\n }\n System.out.println(ans);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BigInteger[] a = new BigInteger[n];",
"a",
"new BigInteger[n]",
"n",
"for(int i=0; i<n; i++) {\n a[i] = sc.nextBigInteger();\n if(a[i].equals(BigInteger.valueOf(0))) {\n System.out.println(0);\n System.exit(0);\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = sc.nextBigInteger();\n if(a[i].equals(BigInteger.valueOf(0))) {\n System.out.println(0);\n System.exit(0);\n }\n }",
"{\n a[i] = sc.nextBigInteger();\n if(a[i].equals(BigInteger.valueOf(0))) {\n System.out.println(0);\n System.exit(0);\n }\n }",
"a[i] = sc.nextBigInteger()",
"a[i]",
"a",
"i",
"sc.nextBigInteger()",
"sc.nextBigInteger",
"sc",
"if(a[i].equals(BigInteger.valueOf(0))) {\n System.out.println(0);\n System.exit(0);\n }",
"a[i].equals(BigInteger.valueOf(0))",
"a[i].equals",
"a[i]",
"a",
"i",
"BigInteger.valueOf(0)",
"BigInteger.valueOf",
"BigInteger",
"0",
"{\n System.out.println(0);\n System.exit(0);\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"System.exit(0)",
"System.exit",
"System",
"0",
"sc.close()",
"sc.close",
"sc",
"java.util.Arrays.sort(a, Collections.reverseOrder())",
"java.util.Arrays.sort",
"java.util.Arrays",
"java.util",
"java",
"java.util",
"java.util.Arrays",
"a",
"Collections.reverseOrder()",
"Collections.reverseOrder",
"Collections",
"BigInteger ans = BigInteger.valueOf(1);",
"ans",
"BigInteger.valueOf(1)",
"BigInteger.valueOf",
"BigInteger",
"1",
"BigInteger limit = BigInteger.valueOf(1000000000000000000L);",
"limit",
"BigInteger.valueOf(1000000000000000000L)",
"BigInteger.valueOf",
"BigInteger",
"1000000000000000000L",
"for(int i=0; i<n; i++) {\n ans = ans.multiply(a[i]);\n if(ans.compareTo(limit) > 0) {\n System.out.println(-1);\n System.exit(0);\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n ans = ans.multiply(a[i]);\n if(ans.compareTo(limit) > 0) {\n System.out.println(-1);\n System.exit(0);\n }\n }",
"{\n ans = ans.multiply(a[i]);\n if(ans.compareTo(limit) > 0) {\n System.out.println(-1);\n System.exit(0);\n }\n }",
"ans = ans.multiply(a[i])",
"ans",
"ans.multiply(a[i])",
"ans.multiply",
"ans",
"a[i]",
"a",
"i",
"if(ans.compareTo(limit) > 0) {\n System.out.println(-1);\n System.exit(0);\n }",
"ans.compareTo(limit) > 0",
"ans.compareTo(limit)",
"ans.compareTo",
"ans",
"limit",
"0",
"{\n System.out.println(-1);\n System.exit(0);\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"System.exit(0)",
"System.exit",
"System",
"0",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n\n BigInteger[] a = new BigInteger[n];\n for(int i=0; i<n; i++) {\n a[i] = sc.nextBigInteger();\n if(a[i].equals(BigInteger.valueOf(0))) {\n System.out.println(0);\n System.exit(0);\n }\n }\n sc.close();\n java.util.Arrays.sort(a, Collections.reverseOrder());\n\n BigInteger ans = BigInteger.valueOf(1);\n //1000000000000000000\n BigInteger limit = BigInteger.valueOf(1000000000000000000L);\n for(int i=0; i<n; i++) {\n ans = ans.multiply(a[i]);\n if(ans.compareTo(limit) > 0) {\n System.out.println(-1);\n System.exit(0);\n }\n }\n System.out.println(ans);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n\n BigInteger[] a = new BigInteger[n];\n for(int i=0; i<n; i++) {\n a[i] = sc.nextBigInteger();\n if(a[i].equals(BigInteger.valueOf(0))) {\n System.out.println(0);\n System.exit(0);\n }\n }\n sc.close();\n java.util.Arrays.sort(a, Collections.reverseOrder());\n\n BigInteger ans = BigInteger.valueOf(1);\n //1000000000000000000\n BigInteger limit = BigInteger.valueOf(1000000000000000000L);\n for(int i=0; i<n; i++) {\n ans = ans.multiply(a[i]);\n if(ans.compareTo(limit) > 0) {\n System.out.println(-1);\n System.exit(0);\n }\n }\n System.out.println(ans);\n }\n}",
"Main"
] |
import java.util.Scanner;
import java.util.Collections;
import java.util.Arrays;
import java.math.BigInteger;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
BigInteger[] a = new BigInteger[n];
for(int i=0; i<n; i++) {
a[i] = sc.nextBigInteger();
if(a[i].equals(BigInteger.valueOf(0))) {
System.out.println(0);
System.exit(0);
}
}
sc.close();
java.util.Arrays.sort(a, Collections.reverseOrder());
BigInteger ans = BigInteger.valueOf(1);
//1000000000000000000
BigInteger limit = BigInteger.valueOf(1000000000000000000L);
for(int i=0; i<n; i++) {
ans = ans.multiply(a[i]);
if(ans.compareTo(limit) > 0) {
System.out.println(-1);
System.exit(0);
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
4,
18,
18,
13,
13,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
4,
18,
13,
41,
13,
4,
18,
13,
17,
41,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
29,
4,
18,
18,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
125,
8
],
[
125,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
36,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
46,
51
],
[
51,
52
],
[
51,
53
],
[
45,
54
],
[
44,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
55,
62
],
[
11,
63
],
[
63,
64
],
[
64,
65
],
[
11,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
11,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
74,
76
],
[
11,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
82,
83
],
[
82,
84
],
[
77,
85
],
[
85,
86
],
[
86,
87
],
[
77,
88
],
[
89,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
93,
94
],
[
92,
95
],
[
95,
96
],
[
95,
97
],
[
89,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
100,
103
],
[
99,
104
],
[
98,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
111,
112
],
[
105,
113
],
[
11,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
119,
120
],
[
120,
121
],
[
9,
122
],
[
122,
123
],
[
0,
124
],
[
124,
125
],
[
124,
126
]
] |
[
"import java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger[] a = new BigInteger[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextBigInteger();\n\t\t\tif (a[i].compareTo(BigInteger.ZERO) == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tsc.close();\n\n\t\tBigInteger lim = BigInteger.valueOf(1000000000000000000L);\n\t\tBigInteger ans = BigInteger.ONE;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans = ans.multiply(a[i]);\n\t\t\tif (ans.compareTo(lim) > 0) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans.toString());\n\t}\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger[] a = new BigInteger[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextBigInteger();\n\t\t\tif (a[i].compareTo(BigInteger.ZERO) == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tsc.close();\n\n\t\tBigInteger lim = BigInteger.valueOf(1000000000000000000L);\n\t\tBigInteger ans = BigInteger.ONE;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans = ans.multiply(a[i]);\n\t\t\tif (ans.compareTo(lim) > 0) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans.toString());\n\t}\n}",
"Main",
"public static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger[] a = new BigInteger[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextBigInteger();\n\t\t\tif (a[i].compareTo(BigInteger.ZERO) == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tsc.close();\n\n\t\tBigInteger lim = BigInteger.valueOf(1000000000000000000L);\n\t\tBigInteger ans = BigInteger.ONE;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans = ans.multiply(a[i]);\n\t\t\tif (ans.compareTo(lim) > 0) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans.toString());\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger[] a = new BigInteger[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextBigInteger();\n\t\t\tif (a[i].compareTo(BigInteger.ZERO) == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tsc.close();\n\n\t\tBigInteger lim = BigInteger.valueOf(1000000000000000000L);\n\t\tBigInteger ans = BigInteger.ONE;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans = ans.multiply(a[i]);\n\t\t\tif (ans.compareTo(lim) > 0) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans.toString());\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BigInteger[] a = new BigInteger[n];",
"a",
"new BigInteger[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextBigInteger();\n\t\t\tif (a[i].compareTo(BigInteger.ZERO) == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = sc.nextBigInteger();\n\t\t\tif (a[i].compareTo(BigInteger.ZERO) == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"{\n\t\t\ta[i] = sc.nextBigInteger();\n\t\t\tif (a[i].compareTo(BigInteger.ZERO) == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"a[i] = sc.nextBigInteger()",
"a[i]",
"a",
"i",
"sc.nextBigInteger()",
"sc.nextBigInteger",
"sc",
"if (a[i].compareTo(BigInteger.ZERO) == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}",
"a[i].compareTo(BigInteger.ZERO) == 0",
"a[i].compareTo(BigInteger.ZERO)",
"a[i].compareTo",
"a[i]",
"a",
"i",
"BigInteger.ZERO",
"BigInteger",
"BigInteger.ZERO",
"0",
"{\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"sc.close()",
"sc.close",
"sc",
"BigInteger lim = BigInteger.valueOf(1000000000000000000L);",
"lim",
"BigInteger.valueOf(1000000000000000000L)",
"BigInteger.valueOf",
"BigInteger",
"1000000000000000000L",
"BigInteger ans = BigInteger.ONE;",
"ans",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"for (int i = 0; i < n; i++) {\n\t\t\tans = ans.multiply(a[i]);\n\t\t\tif (ans.compareTo(lim) > 0) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tans = ans.multiply(a[i]);\n\t\t\tif (ans.compareTo(lim) > 0) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"{\n\t\t\tans = ans.multiply(a[i]);\n\t\t\tif (ans.compareTo(lim) > 0) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"ans = ans.multiply(a[i])",
"ans",
"ans.multiply(a[i])",
"ans.multiply",
"ans",
"a[i]",
"a",
"i",
"if (ans.compareTo(lim) > 0) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}",
"ans.compareTo(lim) > 0",
"ans.compareTo(lim)",
"ans.compareTo",
"ans",
"lim",
"0",
"{\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"System.out.println(ans.toString())",
"System.out.println",
"System.out",
"System",
"System.out",
"ans.toString()",
"ans.toString",
"ans",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger[] a = new BigInteger[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextBigInteger();\n\t\t\tif (a[i].compareTo(BigInteger.ZERO) == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tsc.close();\n\n\t\tBigInteger lim = BigInteger.valueOf(1000000000000000000L);\n\t\tBigInteger ans = BigInteger.ONE;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans = ans.multiply(a[i]);\n\t\t\tif (ans.compareTo(lim) > 0) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans.toString());\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tBigInteger[] a = new BigInteger[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextBigInteger();\n\t\t\tif (a[i].compareTo(BigInteger.ZERO) == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tsc.close();\n\n\t\tBigInteger lim = BigInteger.valueOf(1000000000000000000L);\n\t\tBigInteger ans = BigInteger.ONE;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans = ans.multiply(a[i]);\n\t\t\tif (ans.compareTo(lim) > 0) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans.toString());\n\t}\n}",
"Main"
] |
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
BigInteger[] a = new BigInteger[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextBigInteger();
if (a[i].compareTo(BigInteger.ZERO) == 0) {
System.out.println(0);
return;
}
}
sc.close();
BigInteger lim = BigInteger.valueOf(1000000000000000000L);
BigInteger ans = BigInteger.ONE;
for (int i = 0; i < n; i++) {
ans = ans.multiply(a[i]);
if (ans.compareTo(lim) > 0) {
System.out.println(-1);
return;
}
}
System.out.println(ans.toString());
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
4,
18,
13,
17,
17,
14,
2,
13,
17,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
0,
13,
17,
3,
14,
2,
2,
13,
40,
17,
2,
13,
2,
13,
13,
30,
0,
13,
13,
0,
13,
40,
17,
4,
18,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
90,
5
],
[
90,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
22,
25
],
[
22,
26
],
[
8,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
27,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
32,
37
],
[
37,
38
],
[
37,
39
],
[
32,
40
],
[
40,
41
],
[
41,
42
],
[
32,
43
],
[
44,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
44,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
44,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
60,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
67,
69
],
[
59,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
59,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
8,
78
],
[
78,
79
],
[
79,
80
],
[
8,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
81,
86
],
[
6,
87
],
[
87,
88
],
[
0,
89
],
[
89,
90
],
[
89,
91
]
] |
[
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String args[]) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint count = scan.nextInt();\n\t\tlong sum = 1;\n\t\tlong max = (long) Math.pow(10, 18);\n\n\t\tif (count >= 2) {\n\t\t\tfor (int i = 0 ; i < count ; i++) {\n\t\t\t\tlong value = scan.nextLong();\n\t\t\t\tif (value == 0) {\n\t\t\t\t\tsum = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (sum != -1 && sum <= max / value) {\n\t\t\t\t\tsum *= value;\n\t\t\t\t}\n\t\t\t\telse sum = -1;\n\t\t\t}\n\t\t}\n\t\t\tscan.close();\n\t\t\tSystem.out.println(sum);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String args[]) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint count = scan.nextInt();\n\t\tlong sum = 1;\n\t\tlong max = (long) Math.pow(10, 18);\n\n\t\tif (count >= 2) {\n\t\t\tfor (int i = 0 ; i < count ; i++) {\n\t\t\t\tlong value = scan.nextLong();\n\t\t\t\tif (value == 0) {\n\t\t\t\t\tsum = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (sum != -1 && sum <= max / value) {\n\t\t\t\t\tsum *= value;\n\t\t\t\t}\n\t\t\t\telse sum = -1;\n\t\t\t}\n\t\t}\n\t\t\tscan.close();\n\t\t\tSystem.out.println(sum);\n\t}\n}",
"Main",
"public static void main(String args[]) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint count = scan.nextInt();\n\t\tlong sum = 1;\n\t\tlong max = (long) Math.pow(10, 18);\n\n\t\tif (count >= 2) {\n\t\t\tfor (int i = 0 ; i < count ; i++) {\n\t\t\t\tlong value = scan.nextLong();\n\t\t\t\tif (value == 0) {\n\t\t\t\t\tsum = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (sum != -1 && sum <= max / value) {\n\t\t\t\t\tsum *= value;\n\t\t\t\t}\n\t\t\t\telse sum = -1;\n\t\t\t}\n\t\t}\n\t\t\tscan.close();\n\t\t\tSystem.out.println(sum);\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\t\tint count = scan.nextInt();\n\t\tlong sum = 1;\n\t\tlong max = (long) Math.pow(10, 18);\n\n\t\tif (count >= 2) {\n\t\t\tfor (int i = 0 ; i < count ; i++) {\n\t\t\t\tlong value = scan.nextLong();\n\t\t\t\tif (value == 0) {\n\t\t\t\t\tsum = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (sum != -1 && sum <= max / value) {\n\t\t\t\t\tsum *= value;\n\t\t\t\t}\n\t\t\t\telse sum = -1;\n\t\t\t}\n\t\t}\n\t\t\tscan.close();\n\t\t\tSystem.out.println(sum);\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int count = scan.nextInt();",
"count",
"scan.nextInt()",
"scan.nextInt",
"scan",
"long sum = 1;",
"sum",
"1",
"long max = (long) Math.pow(10, 18);",
"max",
"(long) Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"if (count >= 2) {\n\t\t\tfor (int i = 0 ; i < count ; i++) {\n\t\t\t\tlong value = scan.nextLong();\n\t\t\t\tif (value == 0) {\n\t\t\t\t\tsum = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (sum != -1 && sum <= max / value) {\n\t\t\t\t\tsum *= value;\n\t\t\t\t}\n\t\t\t\telse sum = -1;\n\t\t\t}\n\t\t}",
"count >= 2",
"count",
"2",
"{\n\t\t\tfor (int i = 0 ; i < count ; i++) {\n\t\t\t\tlong value = scan.nextLong();\n\t\t\t\tif (value == 0) {\n\t\t\t\t\tsum = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (sum != -1 && sum <= max / value) {\n\t\t\t\t\tsum *= value;\n\t\t\t\t}\n\t\t\t\telse sum = -1;\n\t\t\t}\n\t\t}",
"for (int i = 0 ; i < count ; i++) {\n\t\t\t\tlong value = scan.nextLong();\n\t\t\t\tif (value == 0) {\n\t\t\t\t\tsum = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (sum != -1 && sum <= max / value) {\n\t\t\t\t\tsum *= value;\n\t\t\t\t}\n\t\t\t\telse sum = -1;\n\t\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < count",
"i",
"count",
"i++",
"i++",
"i",
"{\n\t\t\t\tlong value = scan.nextLong();\n\t\t\t\tif (value == 0) {\n\t\t\t\t\tsum = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (sum != -1 && sum <= max / value) {\n\t\t\t\t\tsum *= value;\n\t\t\t\t}\n\t\t\t\telse sum = -1;\n\t\t\t}",
"{\n\t\t\t\tlong value = scan.nextLong();\n\t\t\t\tif (value == 0) {\n\t\t\t\t\tsum = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (sum != -1 && sum <= max / value) {\n\t\t\t\t\tsum *= value;\n\t\t\t\t}\n\t\t\t\telse sum = -1;\n\t\t\t}",
"long value = scan.nextLong();",
"value",
"scan.nextLong()",
"scan.nextLong",
"scan",
"if (value == 0) {\n\t\t\t\t\tsum = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"value == 0",
"value",
"0",
"{\n\t\t\t\t\tsum = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"sum = 0",
"sum",
"0",
"break;",
"if (sum != -1 && sum <= max / value) {\n\t\t\t\t\tsum *= value;\n\t\t\t\t}\n\t\t\t\telse sum = -1;",
"sum != -1 && sum <= max / value",
"sum != -1",
"sum",
"-1",
"1",
"sum <= max / value",
"sum",
"max / value",
"max",
"value",
"{\n\t\t\t\t\tsum *= value;\n\t\t\t\t}",
"sum *= value",
"sum",
"value",
"sum = -1",
"sum",
"-1",
"1",
"scan.close()",
"scan.close",
"scan",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String args[]",
"args",
"public class Main {\n\tpublic static void main(String args[]) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint count = scan.nextInt();\n\t\tlong sum = 1;\n\t\tlong max = (long) Math.pow(10, 18);\n\n\t\tif (count >= 2) {\n\t\t\tfor (int i = 0 ; i < count ; i++) {\n\t\t\t\tlong value = scan.nextLong();\n\t\t\t\tif (value == 0) {\n\t\t\t\t\tsum = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (sum != -1 && sum <= max / value) {\n\t\t\t\t\tsum *= value;\n\t\t\t\t}\n\t\t\t\telse sum = -1;\n\t\t\t}\n\t\t}\n\t\t\tscan.close();\n\t\t\tSystem.out.println(sum);\n\t}\n}",
"public class Main {\n\tpublic static void main(String args[]) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint count = scan.nextInt();\n\t\tlong sum = 1;\n\t\tlong max = (long) Math.pow(10, 18);\n\n\t\tif (count >= 2) {\n\t\t\tfor (int i = 0 ; i < count ; i++) {\n\t\t\t\tlong value = scan.nextLong();\n\t\t\t\tif (value == 0) {\n\t\t\t\t\tsum = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (sum != -1 && sum <= max / value) {\n\t\t\t\t\tsum *= value;\n\t\t\t\t}\n\t\t\t\telse sum = -1;\n\t\t\t}\n\t\t}\n\t\t\tscan.close();\n\t\t\tSystem.out.println(sum);\n\t}\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int count = scan.nextInt();
long sum = 1;
long max = (long) Math.pow(10, 18);
if (count >= 2) {
for (int i = 0 ; i < count ; i++) {
long value = scan.nextLong();
if (value == 0) {
sum = 0;
break;
}
if (sum != -1 && sum <= max / value) {
sum *= value;
}
else sum = -1;
}
}
scan.close();
System.out.println(sum);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
18,
13,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
29,
0,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
106,
5
],
[
106,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
23,
25
],
[
8,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
32,
33
],
[
32,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
27,
38
],
[
39,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
39,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
47,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
53,
60
],
[
8,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
61,
66
],
[
66,
67
],
[
66,
68
],
[
61,
69
],
[
69,
70
],
[
70,
71
],
[
61,
72
],
[
73,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
76,
78
],
[
73,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
84,
89
],
[
89,
90
],
[
83,
91
],
[
73,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
94,
96
],
[
8,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
6,
103
],
[
103,
104
],
[
0,
105
],
[
105,
106
],
[
105,
107
]
] |
[
"import java.util.*;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long max = 1000000000000000000l;\n long now = 1l;\n long[] a = new long[n];\n for(int i = 0;i<n;i++){\n a[i] = sc.nextLong();\n if(a[i] == 0){\n System.out.println(0);\n return;\n }\n }\n for(int i = 0;i<n;i++){\n max /= a[i];\n // if(max % long != 0)koe = true;\n if(max == 0){\n System.out.println(-1);\n return;\n }\n now *= a[i];\n }\n System.out.println(now);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long max = 1000000000000000000l;\n long now = 1l;\n long[] a = new long[n];\n for(int i = 0;i<n;i++){\n a[i] = sc.nextLong();\n if(a[i] == 0){\n System.out.println(0);\n return;\n }\n }\n for(int i = 0;i<n;i++){\n max /= a[i];\n // if(max % long != 0)koe = true;\n if(max == 0){\n System.out.println(-1);\n return;\n }\n now *= a[i];\n }\n System.out.println(now);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long max = 1000000000000000000l;\n long now = 1l;\n long[] a = new long[n];\n for(int i = 0;i<n;i++){\n a[i] = sc.nextLong();\n if(a[i] == 0){\n System.out.println(0);\n return;\n }\n }\n for(int i = 0;i<n;i++){\n max /= a[i];\n // if(max % long != 0)koe = true;\n if(max == 0){\n System.out.println(-1);\n return;\n }\n now *= a[i];\n }\n System.out.println(now);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long max = 1000000000000000000l;\n long now = 1l;\n long[] a = new long[n];\n for(int i = 0;i<n;i++){\n a[i] = sc.nextLong();\n if(a[i] == 0){\n System.out.println(0);\n return;\n }\n }\n for(int i = 0;i<n;i++){\n max /= a[i];\n // if(max % long != 0)koe = true;\n if(max == 0){\n System.out.println(-1);\n return;\n }\n now *= a[i];\n }\n System.out.println(now);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long max = 1000000000000000000l;",
"max",
"1000000000000000000l",
"long now = 1l;",
"now",
"1l",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for(int i = 0;i<n;i++){\n a[i] = sc.nextLong();\n if(a[i] == 0){\n System.out.println(0);\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = sc.nextLong();\n if(a[i] == 0){\n System.out.println(0);\n return;\n }\n }",
"{\n a[i] = sc.nextLong();\n if(a[i] == 0){\n System.out.println(0);\n return;\n }\n }",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(a[i] == 0){\n System.out.println(0);\n return;\n }",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"for(int i = 0;i<n;i++){\n max /= a[i];\n // if(max % long != 0)koe = true;\n if(max == 0){\n System.out.println(-1);\n return;\n }\n now *= a[i];\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n max /= a[i];\n // if(max % long != 0)koe = true;\n if(max == 0){\n System.out.println(-1);\n return;\n }\n now *= a[i];\n }",
"{\n max /= a[i];\n // if(max % long != 0)koe = true;\n if(max == 0){\n System.out.println(-1);\n return;\n }\n now *= a[i];\n }",
"max /= a[i]",
"max",
"a[i]",
"a",
"i",
"if(max == 0){\n System.out.println(-1);\n return;\n }",
"max == 0",
"max",
"0",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"now *= a[i]",
"now",
"a[i]",
"a",
"i",
"System.out.println(now)",
"System.out.println",
"System.out",
"System",
"System.out",
"now",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long max = 1000000000000000000l;\n long now = 1l;\n long[] a = new long[n];\n for(int i = 0;i<n;i++){\n a[i] = sc.nextLong();\n if(a[i] == 0){\n System.out.println(0);\n return;\n }\n }\n for(int i = 0;i<n;i++){\n max /= a[i];\n // if(max % long != 0)koe = true;\n if(max == 0){\n System.out.println(-1);\n return;\n }\n now *= a[i];\n }\n System.out.println(now);\n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long max = 1000000000000000000l;\n long now = 1l;\n long[] a = new long[n];\n for(int i = 0;i<n;i++){\n a[i] = sc.nextLong();\n if(a[i] == 0){\n System.out.println(0);\n return;\n }\n }\n for(int i = 0;i<n;i++){\n max /= a[i];\n // if(max % long != 0)koe = true;\n if(max == 0){\n System.out.println(-1);\n return;\n }\n now *= a[i];\n }\n System.out.println(now);\n }\n}",
"Main"
] |
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long max = 1000000000000000000l;
long now = 1l;
long[] a = new long[n];
for(int i = 0;i<n;i++){
a[i] = sc.nextLong();
if(a[i] == 0){
System.out.println(0);
return;
}
}
for(int i = 0;i<n;i++){
max /= a[i];
// if(max % long != 0)koe = true;
if(max == 0){
System.out.println(-1);
return;
}
now *= a[i];
}
System.out.println(now);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
41,
13,
20,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
14,
2,
18,
13,
17,
17,
30,
4,
18,
18,
13,
13,
17,
29,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
20,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
29,
4,
18,
18,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
120,
14
],
[
120,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
17,
26
],
[
26,
27
],
[
26,
28
],
[
17,
29
],
[
29,
30
],
[
29,
31
],
[
17,
32
],
[
32,
33
],
[
32,
34
],
[
17,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
36,
41
],
[
41,
42
],
[
41,
43
],
[
36,
44
],
[
44,
45
],
[
45,
46
],
[
36,
47
],
[
48,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
54,
55
],
[
17,
56
],
[
56,
57
],
[
57,
58
],
[
56,
59
],
[
17,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
60,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
66,
73
],
[
17,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
79,
80
],
[
79,
81
],
[
74,
82
],
[
82,
83
],
[
83,
84
],
[
74,
85
],
[
86,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
86,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
95,
98
],
[
94,
99
],
[
93,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
106,
107
],
[
100,
108
],
[
17,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
109,
114
],
[
114,
115
],
[
115,
116
],
[
15,
117
],
[
117,
118
],
[
0,
119
],
[
119,
120
],
[
119,
121
]
] |
[
"import java.io.FileNotFoundException;\nimport java.math.BigInteger;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) throws FileNotFoundException {\n\n Scanner in = new Scanner(System.in);\n// Scanner in = new Scanner(new File(\"input.txt\"));\n\n int n = in.nextInt();\n BigInteger b = new BigInteger(\"1\");\n BigInteger c = new BigInteger(\"1000000000000000000\");\n long[] nums = new long[n];\n for (int i = 0; i < n; i++) {\n nums[i] = in.nextLong();\n }\n Arrays.sort(nums);\n\n if (nums[0] == 0) {\n System.out.println(0);\n return;\n }\n\n for (int i = 0; i < n; i++) {\n b = b.multiply(new BigInteger(String.valueOf(nums[i])));\n\n if (b.compareTo(c) > 0) {\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(b.toString());\n }\n}",
"import java.io.FileNotFoundException;",
"FileNotFoundException",
"java.io",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) throws FileNotFoundException {\n\n Scanner in = new Scanner(System.in);\n// Scanner in = new Scanner(new File(\"input.txt\"));\n\n int n = in.nextInt();\n BigInteger b = new BigInteger(\"1\");\n BigInteger c = new BigInteger(\"1000000000000000000\");\n long[] nums = new long[n];\n for (int i = 0; i < n; i++) {\n nums[i] = in.nextLong();\n }\n Arrays.sort(nums);\n\n if (nums[0] == 0) {\n System.out.println(0);\n return;\n }\n\n for (int i = 0; i < n; i++) {\n b = b.multiply(new BigInteger(String.valueOf(nums[i])));\n\n if (b.compareTo(c) > 0) {\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(b.toString());\n }\n}",
"Main",
"public static void main(String[] args) throws FileNotFoundException {\n\n Scanner in = new Scanner(System.in);\n// Scanner in = new Scanner(new File(\"input.txt\"));\n\n int n = in.nextInt();\n BigInteger b = new BigInteger(\"1\");\n BigInteger c = new BigInteger(\"1000000000000000000\");\n long[] nums = new long[n];\n for (int i = 0; i < n; i++) {\n nums[i] = in.nextLong();\n }\n Arrays.sort(nums);\n\n if (nums[0] == 0) {\n System.out.println(0);\n return;\n }\n\n for (int i = 0; i < n; i++) {\n b = b.multiply(new BigInteger(String.valueOf(nums[i])));\n\n if (b.compareTo(c) > 0) {\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(b.toString());\n }",
"main",
"{\n\n Scanner in = new Scanner(System.in);\n// Scanner in = new Scanner(new File(\"input.txt\"));\n\n int n = in.nextInt();\n BigInteger b = new BigInteger(\"1\");\n BigInteger c = new BigInteger(\"1000000000000000000\");\n long[] nums = new long[n];\n for (int i = 0; i < n; i++) {\n nums[i] = in.nextLong();\n }\n Arrays.sort(nums);\n\n if (nums[0] == 0) {\n System.out.println(0);\n return;\n }\n\n for (int i = 0; i < n; i++) {\n b = b.multiply(new BigInteger(String.valueOf(nums[i])));\n\n if (b.compareTo(c) > 0) {\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(b.toString());\n }",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"BigInteger b = new BigInteger(\"1\");",
"b",
"new BigInteger(\"1\")",
"BigInteger c = new BigInteger(\"1000000000000000000\");",
"c",
"new BigInteger(\"1000000000000000000\")",
"long[] nums = new long[n];",
"nums",
"new long[n]",
"n",
"for (int i = 0; i < n; i++) {\n nums[i] = in.nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n nums[i] = in.nextLong();\n }",
"{\n nums[i] = in.nextLong();\n }",
"nums[i] = in.nextLong()",
"nums[i]",
"nums",
"i",
"in.nextLong()",
"in.nextLong",
"in",
"Arrays.sort(nums)",
"Arrays.sort",
"Arrays",
"nums",
"if (nums[0] == 0) {\n System.out.println(0);\n return;\n }",
"nums[0] == 0",
"nums[0]",
"nums",
"0",
"0",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"for (int i = 0; i < n; i++) {\n b = b.multiply(new BigInteger(String.valueOf(nums[i])));\n\n if (b.compareTo(c) > 0) {\n System.out.println(-1);\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n b = b.multiply(new BigInteger(String.valueOf(nums[i])));\n\n if (b.compareTo(c) > 0) {\n System.out.println(-1);\n return;\n }\n }",
"{\n b = b.multiply(new BigInteger(String.valueOf(nums[i])));\n\n if (b.compareTo(c) > 0) {\n System.out.println(-1);\n return;\n }\n }",
"b = b.multiply(new BigInteger(String.valueOf(nums[i])))",
"b",
"b.multiply(new BigInteger(String.valueOf(nums[i])))",
"b.multiply",
"b",
"new BigInteger(String.valueOf(nums[i]))",
"if (b.compareTo(c) > 0) {\n System.out.println(-1);\n return;\n }",
"b.compareTo(c) > 0",
"b.compareTo(c)",
"b.compareTo",
"b",
"c",
"0",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"System.out.println(b.toString())",
"System.out.println",
"System.out",
"System",
"System.out",
"b.toString()",
"b.toString",
"b",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) throws FileNotFoundException {\n\n Scanner in = new Scanner(System.in);\n// Scanner in = new Scanner(new File(\"input.txt\"));\n\n int n = in.nextInt();\n BigInteger b = new BigInteger(\"1\");\n BigInteger c = new BigInteger(\"1000000000000000000\");\n long[] nums = new long[n];\n for (int i = 0; i < n; i++) {\n nums[i] = in.nextLong();\n }\n Arrays.sort(nums);\n\n if (nums[0] == 0) {\n System.out.println(0);\n return;\n }\n\n for (int i = 0; i < n; i++) {\n b = b.multiply(new BigInteger(String.valueOf(nums[i])));\n\n if (b.compareTo(c) > 0) {\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(b.toString());\n }\n}",
"public class Main {\n public static void main(String[] args) throws FileNotFoundException {\n\n Scanner in = new Scanner(System.in);\n// Scanner in = new Scanner(new File(\"input.txt\"));\n\n int n = in.nextInt();\n BigInteger b = new BigInteger(\"1\");\n BigInteger c = new BigInteger(\"1000000000000000000\");\n long[] nums = new long[n];\n for (int i = 0; i < n; i++) {\n nums[i] = in.nextLong();\n }\n Arrays.sort(nums);\n\n if (nums[0] == 0) {\n System.out.println(0);\n return;\n }\n\n for (int i = 0; i < n; i++) {\n b = b.multiply(new BigInteger(String.valueOf(nums[i])));\n\n if (b.compareTo(c) > 0) {\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(b.toString());\n }\n}",
"Main"
] |
import java.io.FileNotFoundException;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
Scanner in = new Scanner(System.in);
// Scanner in = new Scanner(new File("input.txt"));
int n = in.nextInt();
BigInteger b = new BigInteger("1");
BigInteger c = new BigInteger("1000000000000000000");
long[] nums = new long[n];
for (int i = 0; i < n; i++) {
nums[i] = in.nextLong();
}
Arrays.sort(nums);
if (nums[0] == 0) {
System.out.println(0);
return;
}
for (int i = 0; i < n; i++) {
b = b.multiply(new BigInteger(String.valueOf(nums[i])));
if (b.compareTo(c) > 0) {
System.out.println(-1);
return;
}
}
System.out.println(b.toString());
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
13,
13,
41,
13,
4,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
38,
5,
13,
30,
0,
13,
17,
30,
41,
13,
4,
18,
13,
13,
4,
13,
13,
0,
13,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
14,
2,
4,
13,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
30,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
30,
29,
17,
29,
17,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
18,
13,
13,
41,
13,
20,
18,
13,
13,
29,
4,
13,
13,
13,
13,
13,
17,
23,
13,
12,
13,
30,
14,
2,
13,
18,
13,
13,
30,
4,
18,
13,
4,
18,
13,
29,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
18,
13,
13,
30,
9,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
17,
0,
13,
4,
13,
13,
13,
13,
13,
2,
13,
17,
0,
18,
13,
13,
17,
29,
13,
23,
13,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
17,
42,
4,
18,
13,
17,
30,
0,
13,
4,
18,
13,
41,
13,
4,
18,
13,
17,
41,
13,
20,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
29,
13,
23,
13,
6,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
12,
13,
30,
0,
18,
36,
13,
13,
0,
18,
36,
13,
13,
0,
18,
36,
13,
13,
23,
13,
23,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
346,
11
],
[
346,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
20,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
25,
27
],
[
14,
28
],
[
28,
29
],
[
28,
30
],
[
14,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
36,
37
],
[
36,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
31,
42
],
[
43,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
44,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
55,
56
],
[
54,
57
],
[
54,
58
],
[
58,
59
],
[
58,
60
],
[
51,
61
],
[
61,
62
],
[
61,
63
],
[
14,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
64,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
75,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
87,
88
],
[
75,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
12,
96
],
[
96,
97
],
[
346,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
105,
106
],
[
106,
107
],
[
100,
108
],
[
108,
109
],
[
98,
110
],
[
110,
111
],
[
346,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
118,
120
],
[
121,
122
],
[
121,
123
],
[
114,
124
],
[
124,
125
],
[
124,
126
],
[
127,
128
],
[
127,
129
],
[
114,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
131,
134
],
[
131,
135
],
[
131,
136
],
[
131,
137
],
[
112,
138
],
[
138,
139
],
[
346,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
146,
148
],
[
143,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
150,
153
],
[
153,
154
],
[
154,
155
],
[
149,
156
],
[
156,
157
],
[
142,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
158,
163
],
[
163,
164
],
[
163,
165
],
[
165,
166
],
[
165,
167
],
[
158,
168
],
[
168,
169
],
[
169,
170
],
[
158,
171
],
[
172,
172
],
[
172,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
173,
177
],
[
177,
178
],
[
172,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
179,
183
],
[
183,
184
],
[
183,
185
],
[
172,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
186,
190
],
[
172,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
193,
195
],
[
193,
196
],
[
193,
197
],
[
193,
198
],
[
193,
199
],
[
199,
200
],
[
199,
201
],
[
172,
202
],
[
202,
203
],
[
203,
204
],
[
203,
205
],
[
202,
206
],
[
142,
207
],
[
207,
208
],
[
140,
209
],
[
209,
210
],
[
140,
211
],
[
211,
212
],
[
140,
213
],
[
213,
214
],
[
140,
215
],
[
215,
216
],
[
140,
217
],
[
217,
218
],
[
346,
219
],
[
219,
220
],
[
219,
221
],
[
221,
222
],
[
222,
223
],
[
223,
224
],
[
224,
225
],
[
223,
226
],
[
226,
227
],
[
227,
228
],
[
219,
229
],
[
229,
230
],
[
346,
231
],
[
231,
232
],
[
231,
233
],
[
233,
234
],
[
234,
235
],
[
235,
236
],
[
236,
237
],
[
235,
238
],
[
238,
239
],
[
239,
240
],
[
231,
241
],
[
241,
242
],
[
346,
243
],
[
243,
244
],
[
243,
245
],
[
245,
246
],
[
246,
247
],
[
247,
248
],
[
248,
249
],
[
243,
250
],
[
250,
251
],
[
346,
252
],
[
252,
253
],
[
252,
254
],
[
254,
255
],
[
255,
256
],
[
255,
257
],
[
254,
258
],
[
258,
259
],
[
259,
260
],
[
260,
261
],
[
259,
262
],
[
258,
263
],
[
263,
264
],
[
264,
265
],
[
264,
266
],
[
266,
267
],
[
267,
268
],
[
254,
269
],
[
269,
270
],
[
269,
271
],
[
271,
272
],
[
272,
273
],
[
271,
274
],
[
254,
275
],
[
275,
276
],
[
275,
277
],
[
278,
279
],
[
278,
280
],
[
254,
281
],
[
281,
282
],
[
282,
283
],
[
283,
284
],
[
283,
285
],
[
281,
286
],
[
286,
287
],
[
286,
288
],
[
288,
289
],
[
288,
290
],
[
281,
291
],
[
291,
292
],
[
292,
293
],
[
281,
294
],
[
295,
295
],
[
295,
296
],
[
296,
297
],
[
297,
298
],
[
297,
299
],
[
296,
300
],
[
300,
301
],
[
301,
302
],
[
300,
303
],
[
303,
304
],
[
303,
305
],
[
254,
306
],
[
306,
307
],
[
252,
308
],
[
308,
309
],
[
0,
310
],
[
310,
311
],
[
310,
312
],
[
312,
313
],
[
312,
314
],
[
310,
315
],
[
315,
316
],
[
315,
317
],
[
310,
318
],
[
318,
319
],
[
318,
320
],
[
310,
321
],
[
321,
322
],
[
321,
323
],
[
323,
324
],
[
324,
325
],
[
325,
326
],
[
325,
327
],
[
324,
328
],
[
323,
329
],
[
329,
330
],
[
330,
331
],
[
330,
332
],
[
329,
333
],
[
323,
334
],
[
334,
335
],
[
335,
336
],
[
335,
337
],
[
334,
338
],
[
321,
339
],
[
339,
340
],
[
321,
341
],
[
341,
342
],
[
321,
343
],
[
343,
344
],
[
0,
345
],
[
345,
346
],
[
345,
347
]
] |
[
"import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = getInt(sc);\n\n\t\tlong sum = getLong(sc);\n\t\tboolean overflow = false;\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\ttry {\n\t\t\t\tlong next = Math.multiplyExact(sum, getLong(sc));\n\t\t\t\tsum = next;\n\t\t\t} catch (Exception e) {\n\t\t\t\toverflow = true;\n\t\t\t}\n\n\t\t}\n\t\tif (sum == 0) {\n\t\t\tSystem.out.println(0);\n\t\t} else if (isOver(sum) || overflow) {\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(sum);\n\t\t}\n\n\t}\n\n\tprivate static boolean isOver(long sum) {\n\t\tif (sum > 1000000000000000000L) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * *汎用メソッド<br>\n\t * 入力した配列に対する順列を取得\n\t *\n\t * @param numArray\n\t * @return\n\t */\n\tprivate static List<Integer[]> getPermutation(int[] numArray) {\n\t\tList<Integer[]> permutation = new ArrayList<>();\n\t\tInteger[] ans = new Integer[numArray.length];\n\t\tboolean[] used = new boolean[numArray.length];\n\n\t\treturn buildPermutaion(permutation, numArray, ans, used, 0);\n\t}\n\n\t/**\n\t * *汎用メソッド(内部)<br>\n\t * 入力した配列に対する順列を作成\n\t *\n\t * @param list\n\t * @param numArray\n\t * @param ans\n\t * @param used\n\t * @param depth\n\t * @return\n\t */\n\tprivate static List<Integer[]> buildPermutaion(List<Integer[]> list, int[] numArray, Integer[] ans, boolean[] used,\n\t\t\tint depth) {\n\n\t\t// 全部使い切った時=>できた順列を返す\n\t\tif (depth == numArray.length) {\n\t\t\tlist.add(ans.clone());\n\t\t\treturn list;\n\t\t}\n\t\t// 使い切っていない場合\n\n\t\tfor (int i = 0; i < numArray.length; i++) {\n\t\t\tif (used[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tans[depth] = numArray[i];\n\t\t\tused[i] = true;\n\t\t\tlist = buildPermutaion(list, numArray, ans, used, depth + 1);\n\n\t\t\tused[i] = false;\n\t\t}\n\n\t\treturn list;\n\t}\n\n\t/**\n\t * *汎用メソッド <br>\n\t * スキャナーからの入力値をlongで返却\n\t *\n\t * @return\n\t */\n\tpublic static long getLong(Scanner sc) {\n\n\t\treturn Long.parseLong(sc.next());\n\t}\n\n\t/**\n\t * *汎用メソッド <br>\n\t * スキャナーからの入力値をintで返却\n\t *\n\t * @return\n\t */\n\tpublic static int getInt(Scanner sc) {\n\n\t\treturn Integer.parseInt(sc.next());\n\t}\n\n\t/**\n\t * *汎用メソッド <br>\n\t * スキャナーからの入力値をStringで返却\n\t *\n\t * @return\n\t */\n\tpublic static String getString(Scanner sc) {\n\n\t\treturn sc.next();\n\t}\n\n\t/**\n\t * *汎用メソッド <br>\n\t * スキャナーからの入力値をint配列で返却\n\t *\n\t * @return\n\t */\n\tpublic static int[] getIntArray(Scanner sc) {\n\t\tString line = \"\";\n\t\t// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策\n\t\twhile (line.equals(\"\")) {\n\t\t\tline = sc.nextLine();\n\t\t}\n\n\t\tString[] strArray = line.split(\" \");\n\t\tint[] intArray = new int[strArray.length];\n\t\tfor (int i = 0; i < strArray.length; i++) {\n\t\t\tintArray[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\treturn intArray;\n\t}\n\n}\n\nclass Status {\n\tint row = 0;\n\tint col = 0;\n\tint candies = 0;\n\n\tpublic Status(int row, int col, int candies) {\n\t\tthis.row = row;\n\t\tthis.col = col;\n\t\tthis.candies = candies;\n\t}\n}",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = getInt(sc);\n\n\t\tlong sum = getLong(sc);\n\t\tboolean overflow = false;\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\ttry {\n\t\t\t\tlong next = Math.multiplyExact(sum, getLong(sc));\n\t\t\t\tsum = next;\n\t\t\t} catch (Exception e) {\n\t\t\t\toverflow = true;\n\t\t\t}\n\n\t\t}\n\t\tif (sum == 0) {\n\t\t\tSystem.out.println(0);\n\t\t} else if (isOver(sum) || overflow) {\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(sum);\n\t\t}\n\n\t}\n\n\tprivate static boolean isOver(long sum) {\n\t\tif (sum > 1000000000000000000L) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * *汎用メソッド<br>\n\t * 入力した配列に対する順列を取得\n\t *\n\t * @param numArray\n\t * @return\n\t */\n\tprivate static List<Integer[]> getPermutation(int[] numArray) {\n\t\tList<Integer[]> permutation = new ArrayList<>();\n\t\tInteger[] ans = new Integer[numArray.length];\n\t\tboolean[] used = new boolean[numArray.length];\n\n\t\treturn buildPermutaion(permutation, numArray, ans, used, 0);\n\t}\n\n\t/**\n\t * *汎用メソッド(内部)<br>\n\t * 入力した配列に対する順列を作成\n\t *\n\t * @param list\n\t * @param numArray\n\t * @param ans\n\t * @param used\n\t * @param depth\n\t * @return\n\t */\n\tprivate static List<Integer[]> buildPermutaion(List<Integer[]> list, int[] numArray, Integer[] ans, boolean[] used,\n\t\t\tint depth) {\n\n\t\t// 全部使い切った時=>できた順列を返す\n\t\tif (depth == numArray.length) {\n\t\t\tlist.add(ans.clone());\n\t\t\treturn list;\n\t\t}\n\t\t// 使い切っていない場合\n\n\t\tfor (int i = 0; i < numArray.length; i++) {\n\t\t\tif (used[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tans[depth] = numArray[i];\n\t\t\tused[i] = true;\n\t\t\tlist = buildPermutaion(list, numArray, ans, used, depth + 1);\n\n\t\t\tused[i] = false;\n\t\t}\n\n\t\treturn list;\n\t}\n\n\t/**\n\t * *汎用メソッド <br>\n\t * スキャナーからの入力値をlongで返却\n\t *\n\t * @return\n\t */\n\tpublic static long getLong(Scanner sc) {\n\n\t\treturn Long.parseLong(sc.next());\n\t}\n\n\t/**\n\t * *汎用メソッド <br>\n\t * スキャナーからの入力値をintで返却\n\t *\n\t * @return\n\t */\n\tpublic static int getInt(Scanner sc) {\n\n\t\treturn Integer.parseInt(sc.next());\n\t}\n\n\t/**\n\t * *汎用メソッド <br>\n\t * スキャナーからの入力値をStringで返却\n\t *\n\t * @return\n\t */\n\tpublic static String getString(Scanner sc) {\n\n\t\treturn sc.next();\n\t}\n\n\t/**\n\t * *汎用メソッド <br>\n\t * スキャナーからの入力値をint配列で返却\n\t *\n\t * @return\n\t */\n\tpublic static int[] getIntArray(Scanner sc) {\n\t\tString line = \"\";\n\t\t// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策\n\t\twhile (line.equals(\"\")) {\n\t\t\tline = sc.nextLine();\n\t\t}\n\n\t\tString[] strArray = line.split(\" \");\n\t\tint[] intArray = new int[strArray.length];\n\t\tfor (int i = 0; i < strArray.length; i++) {\n\t\t\tintArray[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\treturn intArray;\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = getInt(sc);\n\n\t\tlong sum = getLong(sc);\n\t\tboolean overflow = false;\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\ttry {\n\t\t\t\tlong next = Math.multiplyExact(sum, getLong(sc));\n\t\t\t\tsum = next;\n\t\t\t} catch (Exception e) {\n\t\t\t\toverflow = true;\n\t\t\t}\n\n\t\t}\n\t\tif (sum == 0) {\n\t\t\tSystem.out.println(0);\n\t\t} else if (isOver(sum) || overflow) {\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(sum);\n\t\t}\n\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = getInt(sc);\n\n\t\tlong sum = getLong(sc);\n\t\tboolean overflow = false;\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\ttry {\n\t\t\t\tlong next = Math.multiplyExact(sum, getLong(sc));\n\t\t\t\tsum = next;\n\t\t\t} catch (Exception e) {\n\t\t\t\toverflow = true;\n\t\t\t}\n\n\t\t}\n\t\tif (sum == 0) {\n\t\t\tSystem.out.println(0);\n\t\t} else if (isOver(sum) || overflow) {\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(sum);\n\t\t}\n\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = getInt(sc);",
"n",
"getInt(sc)",
"getInt",
"sc",
"long sum = getLong(sc);",
"sum",
"getLong(sc)",
"getLong",
"sc",
"boolean overflow = false;",
"overflow",
"false",
"for (int i = 1; i < n; i++) {\n\t\t\ttry {\n\t\t\t\tlong next = Math.multiplyExact(sum, getLong(sc));\n\t\t\t\tsum = next;\n\t\t\t} catch (Exception e) {\n\t\t\t\toverflow = true;\n\t\t\t}\n\n\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ttry {\n\t\t\t\tlong next = Math.multiplyExact(sum, getLong(sc));\n\t\t\t\tsum = next;\n\t\t\t} catch (Exception e) {\n\t\t\t\toverflow = true;\n\t\t\t}\n\n\t\t}",
"{\n\t\t\ttry {\n\t\t\t\tlong next = Math.multiplyExact(sum, getLong(sc));\n\t\t\t\tsum = next;\n\t\t\t} catch (Exception e) {\n\t\t\t\toverflow = true;\n\t\t\t}\n\n\t\t}",
"try {\n\t\t\t\tlong next = Math.multiplyExact(sum, getLong(sc));\n\t\t\t\tsum = next;\n\t\t\t} catch (Exception e) {\n\t\t\t\toverflow = true;\n\t\t\t}",
"catch (Exception e) {\n\t\t\t\toverflow = true;\n\t\t\t}",
"Exception e",
"{\n\t\t\t\toverflow = true;\n\t\t\t}",
"overflow = true",
"overflow",
"true",
"{\n\t\t\t\tlong next = Math.multiplyExact(sum, getLong(sc));\n\t\t\t\tsum = next;\n\t\t\t}",
"long next = Math.multiplyExact(sum, getLong(sc));",
"next",
"Math.multiplyExact(sum, getLong(sc))",
"Math.multiplyExact",
"Math",
"sum",
"getLong(sc)",
"getLong",
"sc",
"sum = next",
"sum",
"next",
"if (sum == 0) {\n\t\t\tSystem.out.println(0);\n\t\t} else if (isOver(sum) || overflow) {\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(sum);\n\t\t}",
"sum == 0",
"sum",
"0",
"{\n\t\t\tSystem.out.println(0);\n\t\t}",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"if (isOver(sum) || overflow) {\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(sum);\n\t\t}",
"isOver(sum) || overflow",
"isOver(sum)",
"isOver",
"sum",
"overflow",
"{\n\t\t\tSystem.out.println(-1);\n\t\t}",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"{\n\t\t\tSystem.out.println(sum);\n\t\t}",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"private static boolean isOver(long sum) {\n\t\tif (sum > 1000000000000000000L) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}",
"isOver",
"{\n\t\tif (sum > 1000000000000000000L) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}",
"if (sum > 1000000000000000000L) {\n\t\t\treturn true;\n\t\t}",
"sum > 1000000000000000000L",
"sum",
"1000000000000000000L",
"{\n\t\t\treturn true;\n\t\t}",
"return true;",
"true",
"return false;",
"false",
"long sum",
"sum",
"/**\n\t * *汎用メソッド<br>\n\t * 入力した配列に対する順列を取得\n\t *\n\t * @param numArray\n\t * @return\n\t */\n\tprivate static List<Integer[]> getPermutation(int[] numArray) {\n\t\tList<Integer[]> permutation = new ArrayList<>();\n\t\tInteger[] ans = new Integer[numArray.length];\n\t\tboolean[] used = new boolean[numArray.length];\n\n\t\treturn buildPermutaion(permutation, numArray, ans, used, 0);\n\t}",
"getPermutation",
"{\n\t\tList<Integer[]> permutation = new ArrayList<>();\n\t\tInteger[] ans = new Integer[numArray.length];\n\t\tboolean[] used = new boolean[numArray.length];\n\n\t\treturn buildPermutaion(permutation, numArray, ans, used, 0);\n\t}",
"List<Integer[]> permutation = new ArrayList<>();",
"permutation",
"new ArrayList<>()",
"Integer[] ans = new Integer[numArray.length];",
"ans",
"new Integer[numArray.length]",
"numArray.length",
"numArray",
"numArray.length",
"boolean[] used = new boolean[numArray.length];",
"used",
"new boolean[numArray.length]",
"numArray.length",
"numArray",
"numArray.length",
"return buildPermutaion(permutation, numArray, ans, used, 0);",
"buildPermutaion(permutation, numArray, ans, used, 0)",
"buildPermutaion",
"permutation",
"numArray",
"ans",
"used",
"0",
"int[] numArray",
"numArray",
"/**\n\t * *汎用メソッド(内部)<br>\n\t * 入力した配列に対する順列を作成\n\t *\n\t * @param list\n\t * @param numArray\n\t * @param ans\n\t * @param used\n\t * @param depth\n\t * @return\n\t */\n\tprivate static List<Integer[]> buildPermutaion(List<Integer[]> list, int[] numArray, Integer[] ans, boolean[] used,\n\t\t\tint depth) {\n\n\t\t// 全部使い切った時=>できた順列を返す\n\t\tif (depth == numArray.length) {\n\t\t\tlist.add(ans.clone());\n\t\t\treturn list;\n\t\t}\n\t\t// 使い切っていない場合\n\n\t\tfor (int i = 0; i < numArray.length; i++) {\n\t\t\tif (used[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tans[depth] = numArray[i];\n\t\t\tused[i] = true;\n\t\t\tlist = buildPermutaion(list, numArray, ans, used, depth + 1);\n\n\t\t\tused[i] = false;\n\t\t}\n\n\t\treturn list;\n\t}",
"buildPermutaion",
"{\n\n\t\t// 全部使い切った時=>できた順列を返す\n\t\tif (depth == numArray.length) {\n\t\t\tlist.add(ans.clone());\n\t\t\treturn list;\n\t\t}\n\t\t// 使い切っていない場合\n\n\t\tfor (int i = 0; i < numArray.length; i++) {\n\t\t\tif (used[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tans[depth] = numArray[i];\n\t\t\tused[i] = true;\n\t\t\tlist = buildPermutaion(list, numArray, ans, used, depth + 1);\n\n\t\t\tused[i] = false;\n\t\t}\n\n\t\treturn list;\n\t}",
"if (depth == numArray.length) {\n\t\t\tlist.add(ans.clone());\n\t\t\treturn list;\n\t\t}",
"depth == numArray.length",
"depth",
"numArray.length",
"numArray",
"numArray.length",
"{\n\t\t\tlist.add(ans.clone());\n\t\t\treturn list;\n\t\t}",
"list.add(ans.clone())",
"list.add",
"list",
"ans.clone()",
"ans.clone",
"ans",
"return list;",
"list",
"for (int i = 0; i < numArray.length; i++) {\n\t\t\tif (used[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tans[depth] = numArray[i];\n\t\t\tused[i] = true;\n\t\t\tlist = buildPermutaion(list, numArray, ans, used, depth + 1);\n\n\t\t\tused[i] = false;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < numArray.length",
"i",
"numArray.length",
"numArray",
"numArray.length",
"i++",
"i++",
"i",
"{\n\t\t\tif (used[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tans[depth] = numArray[i];\n\t\t\tused[i] = true;\n\t\t\tlist = buildPermutaion(list, numArray, ans, used, depth + 1);\n\n\t\t\tused[i] = false;\n\t\t}",
"{\n\t\t\tif (used[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tans[depth] = numArray[i];\n\t\t\tused[i] = true;\n\t\t\tlist = buildPermutaion(list, numArray, ans, used, depth + 1);\n\n\t\t\tused[i] = false;\n\t\t}",
"if (used[i]) {\n\t\t\t\tcontinue;\n\t\t\t}",
"used[i]",
"used",
"i",
"{\n\t\t\t\tcontinue;\n\t\t\t}",
"continue;",
"ans[depth] = numArray[i]",
"ans[depth]",
"ans",
"depth",
"numArray[i]",
"numArray",
"i",
"used[i] = true",
"used[i]",
"used",
"i",
"true",
"list = buildPermutaion(list, numArray, ans, used, depth + 1)",
"list",
"buildPermutaion(list, numArray, ans, used, depth + 1)",
"buildPermutaion",
"list",
"numArray",
"ans",
"used",
"depth + 1",
"depth",
"1",
"used[i] = false",
"used[i]",
"used",
"i",
"false",
"return list;",
"list",
"List<Integer[]> list",
"list",
"int[] numArray",
"numArray",
"Integer[] ans",
"ans",
"boolean[] used",
"used",
"int depth",
"depth",
"/**\n\t * *汎用メソッド <br>\n\t * スキャナーからの入力値をlongで返却\n\t *\n\t * @return\n\t */\n\tpublic static long getLong(Scanner sc) {\n\n\t\treturn Long.parseLong(sc.next());\n\t}",
"getLong",
"{\n\n\t\treturn Long.parseLong(sc.next());\n\t}",
"return Long.parseLong(sc.next());",
"Long.parseLong(sc.next())",
"Long.parseLong",
"Long",
"sc.next()",
"sc.next",
"sc",
"Scanner sc",
"sc",
"/**\n\t * *汎用メソッド <br>\n\t * スキャナーからの入力値をintで返却\n\t *\n\t * @return\n\t */\n\tpublic static int getInt(Scanner sc) {\n\n\t\treturn Integer.parseInt(sc.next());\n\t}",
"getInt",
"{\n\n\t\treturn Integer.parseInt(sc.next());\n\t}",
"return Integer.parseInt(sc.next());",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"Scanner sc",
"sc",
"/**\n\t * *汎用メソッド <br>\n\t * スキャナーからの入力値をStringで返却\n\t *\n\t * @return\n\t */\n\tpublic static String getString(Scanner sc) {\n\n\t\treturn sc.next();\n\t}",
"getString",
"{\n\n\t\treturn sc.next();\n\t}",
"return sc.next();",
"sc.next()",
"sc.next",
"sc",
"Scanner sc",
"sc",
"/**\n\t * *汎用メソッド <br>\n\t * スキャナーからの入力値をint配列で返却\n\t *\n\t * @return\n\t */\n\tpublic static int[] getIntArray(Scanner sc) {\n\t\tString line = \"\";\n\t\t// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策\n\t\twhile (line.equals(\"\")) {\n\t\t\tline = sc.nextLine();\n\t\t}\n\n\t\tString[] strArray = line.split(\" \");\n\t\tint[] intArray = new int[strArray.length];\n\t\tfor (int i = 0; i < strArray.length; i++) {\n\t\t\tintArray[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\treturn intArray;\n\t}",
"getIntArray",
"{\n\t\tString line = \"\";\n\t\t// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策\n\t\twhile (line.equals(\"\")) {\n\t\t\tline = sc.nextLine();\n\t\t}\n\n\t\tString[] strArray = line.split(\" \");\n\t\tint[] intArray = new int[strArray.length];\n\t\tfor (int i = 0; i < strArray.length; i++) {\n\t\t\tintArray[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\treturn intArray;\n\t}",
"String line = \"\";",
"line",
"\"\"",
"while (line.equals(\"\")) {\n\t\t\tline = sc.nextLine();\n\t\t}",
"line.equals(\"\")",
"line.equals",
"line",
"\"\"",
"{\n\t\t\tline = sc.nextLine();\n\t\t}",
"line = sc.nextLine()",
"line",
"sc.nextLine()",
"sc.nextLine",
"sc",
"String[] strArray = line.split(\" \");",
"strArray",
"line.split(\" \")",
"line.split",
"line",
"\" \"",
"int[] intArray = new int[strArray.length];",
"intArray",
"new int[strArray.length]",
"strArray.length",
"strArray",
"strArray.length",
"for (int i = 0; i < strArray.length; i++) {\n\t\t\tintArray[i] = Integer.parseInt(strArray[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < strArray.length",
"i",
"strArray.length",
"strArray",
"strArray.length",
"i++",
"i++",
"i",
"{\n\t\t\tintArray[i] = Integer.parseInt(strArray[i]);\n\t\t}",
"{\n\t\t\tintArray[i] = Integer.parseInt(strArray[i]);\n\t\t}",
"intArray[i] = Integer.parseInt(strArray[i])",
"intArray[i]",
"intArray",
"i",
"Integer.parseInt(strArray[i])",
"Integer.parseInt",
"Integer",
"strArray[i]",
"strArray",
"i",
"return intArray;",
"intArray",
"Scanner sc",
"sc",
"class Status {\n\tint row = 0;\n\tint col = 0;\n\tint candies = 0;\n\n\tpublic Status(int row, int col, int candies) {\n\t\tthis.row = row;\n\t\tthis.col = col;\n\t\tthis.candies = candies;\n\t}\n}",
"Status",
"int row = 0;",
"row",
"0",
"int col = 0;",
"col",
"0",
"int candies = 0;",
"candies",
"0",
"public Status(int row, int col, int candies) {\n\t\tthis.row = row;\n\t\tthis.col = col;\n\t\tthis.candies = candies;\n\t}",
"Status",
"{\n\t\tthis.row = row;\n\t\tthis.col = col;\n\t\tthis.candies = candies;\n\t}",
"this.row = row",
"this.row",
"this",
"this.row",
"row",
"this.col = col",
"this.col",
"this",
"this.col",
"col",
"this.candies = candies",
"this.candies",
"this",
"this.candies",
"candies",
"int row",
"row",
"int col",
"col",
"int candies",
"candies",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = getInt(sc);\n\n\t\tlong sum = getLong(sc);\n\t\tboolean overflow = false;\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\ttry {\n\t\t\t\tlong next = Math.multiplyExact(sum, getLong(sc));\n\t\t\t\tsum = next;\n\t\t\t} catch (Exception e) {\n\t\t\t\toverflow = true;\n\t\t\t}\n\n\t\t}\n\t\tif (sum == 0) {\n\t\t\tSystem.out.println(0);\n\t\t} else if (isOver(sum) || overflow) {\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(sum);\n\t\t}\n\n\t}\n\n\tprivate static boolean isOver(long sum) {\n\t\tif (sum > 1000000000000000000L) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * *汎用メソッド<br>\n\t * 入力した配列に対する順列を取得\n\t *\n\t * @param numArray\n\t * @return\n\t */\n\tprivate static List<Integer[]> getPermutation(int[] numArray) {\n\t\tList<Integer[]> permutation = new ArrayList<>();\n\t\tInteger[] ans = new Integer[numArray.length];\n\t\tboolean[] used = new boolean[numArray.length];\n\n\t\treturn buildPermutaion(permutation, numArray, ans, used, 0);\n\t}\n\n\t/**\n\t * *汎用メソッド(内部)<br>\n\t * 入力した配列に対する順列を作成\n\t *\n\t * @param list\n\t * @param numArray\n\t * @param ans\n\t * @param used\n\t * @param depth\n\t * @return\n\t */\n\tprivate static List<Integer[]> buildPermutaion(List<Integer[]> list, int[] numArray, Integer[] ans, boolean[] used,\n\t\t\tint depth) {\n\n\t\t// 全部使い切った時=>できた順列を返す\n\t\tif (depth == numArray.length) {\n\t\t\tlist.add(ans.clone());\n\t\t\treturn list;\n\t\t}\n\t\t// 使い切っていない場合\n\n\t\tfor (int i = 0; i < numArray.length; i++) {\n\t\t\tif (used[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tans[depth] = numArray[i];\n\t\t\tused[i] = true;\n\t\t\tlist = buildPermutaion(list, numArray, ans, used, depth + 1);\n\n\t\t\tused[i] = false;\n\t\t}\n\n\t\treturn list;\n\t}\n\n\t/**\n\t * *汎用メソッド <br>\n\t * スキャナーからの入力値をlongで返却\n\t *\n\t * @return\n\t */\n\tpublic static long getLong(Scanner sc) {\n\n\t\treturn Long.parseLong(sc.next());\n\t}\n\n\t/**\n\t * *汎用メソッド <br>\n\t * スキャナーからの入力値をintで返却\n\t *\n\t * @return\n\t */\n\tpublic static int getInt(Scanner sc) {\n\n\t\treturn Integer.parseInt(sc.next());\n\t}\n\n\t/**\n\t * *汎用メソッド <br>\n\t * スキャナーからの入力値をStringで返却\n\t *\n\t * @return\n\t */\n\tpublic static String getString(Scanner sc) {\n\n\t\treturn sc.next();\n\t}\n\n\t/**\n\t * *汎用メソッド <br>\n\t * スキャナーからの入力値をint配列で返却\n\t *\n\t * @return\n\t */\n\tpublic static int[] getIntArray(Scanner sc) {\n\t\tString line = \"\";\n\t\t// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策\n\t\twhile (line.equals(\"\")) {\n\t\t\tline = sc.nextLine();\n\t\t}\n\n\t\tString[] strArray = line.split(\" \");\n\t\tint[] intArray = new int[strArray.length];\n\t\tfor (int i = 0; i < strArray.length; i++) {\n\t\t\tintArray[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\treturn intArray;\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = getInt(sc);\n\n\t\tlong sum = getLong(sc);\n\t\tboolean overflow = false;\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\ttry {\n\t\t\t\tlong next = Math.multiplyExact(sum, getLong(sc));\n\t\t\t\tsum = next;\n\t\t\t} catch (Exception e) {\n\t\t\t\toverflow = true;\n\t\t\t}\n\n\t\t}\n\t\tif (sum == 0) {\n\t\t\tSystem.out.println(0);\n\t\t} else if (isOver(sum) || overflow) {\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(sum);\n\t\t}\n\n\t}\n\n\tprivate static boolean isOver(long sum) {\n\t\tif (sum > 1000000000000000000L) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * *汎用メソッド<br>\n\t * 入力した配列に対する順列を取得\n\t *\n\t * @param numArray\n\t * @return\n\t */\n\tprivate static List<Integer[]> getPermutation(int[] numArray) {\n\t\tList<Integer[]> permutation = new ArrayList<>();\n\t\tInteger[] ans = new Integer[numArray.length];\n\t\tboolean[] used = new boolean[numArray.length];\n\n\t\treturn buildPermutaion(permutation, numArray, ans, used, 0);\n\t}\n\n\t/**\n\t * *汎用メソッド(内部)<br>\n\t * 入力した配列に対する順列を作成\n\t *\n\t * @param list\n\t * @param numArray\n\t * @param ans\n\t * @param used\n\t * @param depth\n\t * @return\n\t */\n\tprivate static List<Integer[]> buildPermutaion(List<Integer[]> list, int[] numArray, Integer[] ans, boolean[] used,\n\t\t\tint depth) {\n\n\t\t// 全部使い切った時=>できた順列を返す\n\t\tif (depth == numArray.length) {\n\t\t\tlist.add(ans.clone());\n\t\t\treturn list;\n\t\t}\n\t\t// 使い切っていない場合\n\n\t\tfor (int i = 0; i < numArray.length; i++) {\n\t\t\tif (used[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tans[depth] = numArray[i];\n\t\t\tused[i] = true;\n\t\t\tlist = buildPermutaion(list, numArray, ans, used, depth + 1);\n\n\t\t\tused[i] = false;\n\t\t}\n\n\t\treturn list;\n\t}\n\n\t/**\n\t * *汎用メソッド <br>\n\t * スキャナーからの入力値をlongで返却\n\t *\n\t * @return\n\t */\n\tpublic static long getLong(Scanner sc) {\n\n\t\treturn Long.parseLong(sc.next());\n\t}\n\n\t/**\n\t * *汎用メソッド <br>\n\t * スキャナーからの入力値をintで返却\n\t *\n\t * @return\n\t */\n\tpublic static int getInt(Scanner sc) {\n\n\t\treturn Integer.parseInt(sc.next());\n\t}\n\n\t/**\n\t * *汎用メソッド <br>\n\t * スキャナーからの入力値をStringで返却\n\t *\n\t * @return\n\t */\n\tpublic static String getString(Scanner sc) {\n\n\t\treturn sc.next();\n\t}\n\n\t/**\n\t * *汎用メソッド <br>\n\t * スキャナーからの入力値をint配列で返却\n\t *\n\t * @return\n\t */\n\tpublic static int[] getIntArray(Scanner sc) {\n\t\tString line = \"\";\n\t\t// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策\n\t\twhile (line.equals(\"\")) {\n\t\t\tline = sc.nextLine();\n\t\t}\n\n\t\tString[] strArray = line.split(\" \");\n\t\tint[] intArray = new int[strArray.length];\n\t\tfor (int i = 0; i < strArray.length; i++) {\n\t\t\tintArray[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\treturn intArray;\n\t}\n\n}",
"Main"
] |
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = getInt(sc);
long sum = getLong(sc);
boolean overflow = false;
for (int i = 1; i < n; i++) {
try {
long next = Math.multiplyExact(sum, getLong(sc));
sum = next;
} catch (Exception e) {
overflow = true;
}
}
if (sum == 0) {
System.out.println(0);
} else if (isOver(sum) || overflow) {
System.out.println(-1);
} else {
System.out.println(sum);
}
}
private static boolean isOver(long sum) {
if (sum > 1000000000000000000L) {
return true;
}
return false;
}
/**
* *汎用メソッド<br>
* 入力した配列に対する順列を取得
*
* @param numArray
* @return
*/
private static List<Integer[]> getPermutation(int[] numArray) {
List<Integer[]> permutation = new ArrayList<>();
Integer[] ans = new Integer[numArray.length];
boolean[] used = new boolean[numArray.length];
return buildPermutaion(permutation, numArray, ans, used, 0);
}
/**
* *汎用メソッド(内部)<br>
* 入力した配列に対する順列を作成
*
* @param list
* @param numArray
* @param ans
* @param used
* @param depth
* @return
*/
private static List<Integer[]> buildPermutaion(List<Integer[]> list, int[] numArray, Integer[] ans, boolean[] used,
int depth) {
// 全部使い切った時=>できた順列を返す
if (depth == numArray.length) {
list.add(ans.clone());
return list;
}
// 使い切っていない場合
for (int i = 0; i < numArray.length; i++) {
if (used[i]) {
continue;
}
ans[depth] = numArray[i];
used[i] = true;
list = buildPermutaion(list, numArray, ans, used, depth + 1);
used[i] = false;
}
return list;
}
/**
* *汎用メソッド <br>
* スキャナーからの入力値をlongで返却
*
* @return
*/
public static long getLong(Scanner sc) {
return Long.parseLong(sc.next());
}
/**
* *汎用メソッド <br>
* スキャナーからの入力値をintで返却
*
* @return
*/
public static int getInt(Scanner sc) {
return Integer.parseInt(sc.next());
}
/**
* *汎用メソッド <br>
* スキャナーからの入力値をStringで返却
*
* @return
*/
public static String getString(Scanner sc) {
return sc.next();
}
/**
* *汎用メソッド <br>
* スキャナーからの入力値をint配列で返却
*
* @return
*/
public static int[] getIntArray(Scanner sc) {
String line = "";
// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策
while (line.equals("")) {
line = sc.nextLine();
}
String[] strArray = line.split(" ");
int[] intArray = new int[strArray.length];
for (int i = 0; i < strArray.length; i++) {
intArray[i] = Integer.parseInt(strArray[i]);
}
return intArray;
}
}
class Status {
int row = 0;
int col = 0;
int candies = 0;
public Status(int row, int col, int candies) {
this.row = row;
this.col = col;
this.candies = candies;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
18,
13,
13,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
40,
4,
18,
13,
4,
18,
13,
40,
17,
30,
14,
2,
4,
18,
4,
18,
13,
13,
4,
18,
13,
17,
17,
30,
0,
13,
4,
18,
13,
40,
17,
30,
0,
13,
4,
18,
13,
13,
30,
14,
4,
18,
13,
18,
13,
13,
30,
0,
13,
18,
13,
13,
3,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
106,
8
],
[
106,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
17,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
11,
25
],
[
25,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
25,
30
],
[
30,
31
],
[
30,
32
],
[
25,
33
],
[
33,
34
],
[
34,
35
],
[
25,
36
],
[
37,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
41,
42
],
[
37,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
45,
48
],
[
48,
49
],
[
49,
50
],
[
48,
51
],
[
51,
52
],
[
43,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
56,
62
],
[
62,
63
],
[
63,
64
],
[
62,
65
],
[
55,
66
],
[
54,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
70,
73
],
[
73,
74
],
[
54,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
43,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
84,
87
],
[
87,
88
],
[
87,
89
],
[
83,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
90,
96
],
[
11,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
9,
103
],
[
103,
104
],
[
0,
105
],
[
105,
106
],
[
105,
107
]
] |
[
"import java.util.*;\nimport java.math.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n BigInteger ans = BigInteger.ONE;\n int n = sc.nextInt();\n\n for (int i = 0; i < n; i++) {\n BigInteger next = sc.nextBigInteger();\n\n if (!ans.equals(BigInteger.valueOf(-1))) {\n if (ans.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0) {\n ans = BigInteger.valueOf(-1);\n } else {\n ans = ans.multiply(next);\n }\n } else {\n if (next.equals(BigInteger.ZERO)) {\n ans = BigInteger.ZERO;\n break;\n }\n }\n }\n\n System.out.println(ans);\n }\n}\n",
"import java.util.*;",
"util.*",
"java",
"import java.math.*;",
"math.*",
"java",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n BigInteger ans = BigInteger.ONE;\n int n = sc.nextInt();\n\n for (int i = 0; i < n; i++) {\n BigInteger next = sc.nextBigInteger();\n\n if (!ans.equals(BigInteger.valueOf(-1))) {\n if (ans.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0) {\n ans = BigInteger.valueOf(-1);\n } else {\n ans = ans.multiply(next);\n }\n } else {\n if (next.equals(BigInteger.ZERO)) {\n ans = BigInteger.ZERO;\n break;\n }\n }\n }\n\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n BigInteger ans = BigInteger.ONE;\n int n = sc.nextInt();\n\n for (int i = 0; i < n; i++) {\n BigInteger next = sc.nextBigInteger();\n\n if (!ans.equals(BigInteger.valueOf(-1))) {\n if (ans.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0) {\n ans = BigInteger.valueOf(-1);\n } else {\n ans = ans.multiply(next);\n }\n } else {\n if (next.equals(BigInteger.ZERO)) {\n ans = BigInteger.ZERO;\n break;\n }\n }\n }\n\n System.out.println(ans);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n BigInteger ans = BigInteger.ONE;\n int n = sc.nextInt();\n\n for (int i = 0; i < n; i++) {\n BigInteger next = sc.nextBigInteger();\n\n if (!ans.equals(BigInteger.valueOf(-1))) {\n if (ans.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0) {\n ans = BigInteger.valueOf(-1);\n } else {\n ans = ans.multiply(next);\n }\n } else {\n if (next.equals(BigInteger.ZERO)) {\n ans = BigInteger.ZERO;\n break;\n }\n }\n }\n\n System.out.println(ans);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"BigInteger ans = BigInteger.ONE;",
"ans",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for (int i = 0; i < n; i++) {\n BigInteger next = sc.nextBigInteger();\n\n if (!ans.equals(BigInteger.valueOf(-1))) {\n if (ans.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0) {\n ans = BigInteger.valueOf(-1);\n } else {\n ans = ans.multiply(next);\n }\n } else {\n if (next.equals(BigInteger.ZERO)) {\n ans = BigInteger.ZERO;\n break;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n BigInteger next = sc.nextBigInteger();\n\n if (!ans.equals(BigInteger.valueOf(-1))) {\n if (ans.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0) {\n ans = BigInteger.valueOf(-1);\n } else {\n ans = ans.multiply(next);\n }\n } else {\n if (next.equals(BigInteger.ZERO)) {\n ans = BigInteger.ZERO;\n break;\n }\n }\n }",
"{\n BigInteger next = sc.nextBigInteger();\n\n if (!ans.equals(BigInteger.valueOf(-1))) {\n if (ans.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0) {\n ans = BigInteger.valueOf(-1);\n } else {\n ans = ans.multiply(next);\n }\n } else {\n if (next.equals(BigInteger.ZERO)) {\n ans = BigInteger.ZERO;\n break;\n }\n }\n }",
"BigInteger next = sc.nextBigInteger();",
"next",
"sc.nextBigInteger()",
"sc.nextBigInteger",
"sc",
"if (!ans.equals(BigInteger.valueOf(-1))) {\n if (ans.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0) {\n ans = BigInteger.valueOf(-1);\n } else {\n ans = ans.multiply(next);\n }\n } else {\n if (next.equals(BigInteger.ZERO)) {\n ans = BigInteger.ZERO;\n break;\n }\n }",
"!ans.equals(BigInteger.valueOf(-1))",
"ans.equals(BigInteger.valueOf(-1))",
"ans.equals",
"ans",
"BigInteger.valueOf(-1)",
"BigInteger.valueOf",
"BigInteger",
"-1",
"1",
"{\n if (ans.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0) {\n ans = BigInteger.valueOf(-1);\n } else {\n ans = ans.multiply(next);\n }\n }",
"if (ans.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0) {\n ans = BigInteger.valueOf(-1);\n } else {\n ans = ans.multiply(next);\n }",
"ans.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0",
"ans.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L))",
"ans.multiply(next).compareTo",
"ans.multiply(next)",
"ans.multiply",
"ans",
"next",
"BigInteger.valueOf(1000000000000000000L)",
"BigInteger.valueOf",
"BigInteger",
"1000000000000000000L",
"0",
"{\n ans = BigInteger.valueOf(-1);\n }",
"ans = BigInteger.valueOf(-1)",
"ans",
"BigInteger.valueOf(-1)",
"BigInteger.valueOf",
"BigInteger",
"-1",
"1",
"{\n ans = ans.multiply(next);\n }",
"ans = ans.multiply(next)",
"ans",
"ans.multiply(next)",
"ans.multiply",
"ans",
"next",
"{\n if (next.equals(BigInteger.ZERO)) {\n ans = BigInteger.ZERO;\n break;\n }\n }",
"if (next.equals(BigInteger.ZERO)) {\n ans = BigInteger.ZERO;\n break;\n }",
"next.equals(BigInteger.ZERO)",
"next.equals",
"next",
"BigInteger.ZERO",
"BigInteger",
"BigInteger.ZERO",
"{\n ans = BigInteger.ZERO;\n break;\n }",
"ans = BigInteger.ZERO",
"ans",
"BigInteger.ZERO",
"BigInteger",
"BigInteger.ZERO",
"break;",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n BigInteger ans = BigInteger.ONE;\n int n = sc.nextInt();\n\n for (int i = 0; i < n; i++) {\n BigInteger next = sc.nextBigInteger();\n\n if (!ans.equals(BigInteger.valueOf(-1))) {\n if (ans.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0) {\n ans = BigInteger.valueOf(-1);\n } else {\n ans = ans.multiply(next);\n }\n } else {\n if (next.equals(BigInteger.ZERO)) {\n ans = BigInteger.ZERO;\n break;\n }\n }\n }\n\n System.out.println(ans);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n BigInteger ans = BigInteger.ONE;\n int n = sc.nextInt();\n\n for (int i = 0; i < n; i++) {\n BigInteger next = sc.nextBigInteger();\n\n if (!ans.equals(BigInteger.valueOf(-1))) {\n if (ans.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0) {\n ans = BigInteger.valueOf(-1);\n } else {\n ans = ans.multiply(next);\n }\n } else {\n if (next.equals(BigInteger.ZERO)) {\n ans = BigInteger.ZERO;\n break;\n }\n }\n }\n\n System.out.println(ans);\n }\n}",
"Main"
] |
import java.util.*;
import java.math.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
BigInteger ans = BigInteger.ONE;
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
BigInteger next = sc.nextBigInteger();
if (!ans.equals(BigInteger.valueOf(-1))) {
if (ans.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0) {
ans = BigInteger.valueOf(-1);
} else {
ans = ans.multiply(next);
}
} else {
if (next.equals(BigInteger.ZERO)) {
ans = BigInteger.ZERO;
break;
}
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
2,
13,
17,
41,
13,
20,
41,
13,
20,
41,
13,
20,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
4,
18,
18,
13,
13,
13,
17,
30,
0,
13,
20,
3,
14,
2,
4,
18,
13,
13,
17,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
0,
13,
20,
40,
13,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
30,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
150,
8
],
[
150,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
23,
24
],
[
23,
25
],
[
11,
26
],
[
26,
27
],
[
26,
28
],
[
11,
29
],
[
29,
30
],
[
29,
31
],
[
11,
32
],
[
32,
33
],
[
32,
34
],
[
11,
35
],
[
35,
36
],
[
35,
37
],
[
11,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
38,
43
],
[
43,
44
],
[
43,
45
],
[
38,
46
],
[
46,
47
],
[
47,
48
],
[
38,
49
],
[
50,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
60,
65
],
[
59,
66
],
[
58,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
11,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
73,
78
],
[
72,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
80,
85
],
[
85,
86
],
[
85,
87
],
[
80,
88
],
[
88,
89
],
[
89,
90
],
[
80,
91
],
[
92,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
96,
97
],
[
95,
98
],
[
98,
99
],
[
98,
100
],
[
92,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
102,
107
],
[
101,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
112,
113
],
[
11,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
116,
119
],
[
115,
120
],
[
114,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
114,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
133,
138
],
[
138,
139
],
[
128,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
141,
146
],
[
9,
147
],
[
147,
148
],
[
0,
149
],
[
149,
150
],
[
149,
151
]
] |
[
"import java.util.*;\nimport java.math.*;\n\npublic class Main {\n\n public static void main (String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n BigDecimal[] A = new BigDecimal[N+1];\n BigDecimal a = new BigDecimal(1);\n BigDecimal b = new BigDecimal(Math.pow(10,18));\n BigDecimal c = new BigDecimal(0);\n int check =0;\n for (int i =1; i<=N; i++) {\n A[i] = sc.nextBigDecimal();\n if (A[i].compareTo(c) == 0) {\n a = new BigDecimal(0);\n break;\n }\n }\n if (a.compareTo(c) != 0) {\n for (int i =1; i<=N; i++) {\n a = a.multiply(A[i]);\n if (a.compareTo(b) >0) {\n a = new BigDecimal(1);\n check++;\n }\n }\n }\n if (a.compareTo(c) == 0) {\n System.out.println(0);\n } else if (check != 0) {\n System.out.println(-1);\n } else {\n System.out.println(a);\n }\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.math.*;",
"math.*",
"java",
"public class Main {\n\n public static void main (String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n BigDecimal[] A = new BigDecimal[N+1];\n BigDecimal a = new BigDecimal(1);\n BigDecimal b = new BigDecimal(Math.pow(10,18));\n BigDecimal c = new BigDecimal(0);\n int check =0;\n for (int i =1; i<=N; i++) {\n A[i] = sc.nextBigDecimal();\n if (A[i].compareTo(c) == 0) {\n a = new BigDecimal(0);\n break;\n }\n }\n if (a.compareTo(c) != 0) {\n for (int i =1; i<=N; i++) {\n a = a.multiply(A[i]);\n if (a.compareTo(b) >0) {\n a = new BigDecimal(1);\n check++;\n }\n }\n }\n if (a.compareTo(c) == 0) {\n System.out.println(0);\n } else if (check != 0) {\n System.out.println(-1);\n } else {\n System.out.println(a);\n }\n }\n}",
"Main",
"public static void main (String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n BigDecimal[] A = new BigDecimal[N+1];\n BigDecimal a = new BigDecimal(1);\n BigDecimal b = new BigDecimal(Math.pow(10,18));\n BigDecimal c = new BigDecimal(0);\n int check =0;\n for (int i =1; i<=N; i++) {\n A[i] = sc.nextBigDecimal();\n if (A[i].compareTo(c) == 0) {\n a = new BigDecimal(0);\n break;\n }\n }\n if (a.compareTo(c) != 0) {\n for (int i =1; i<=N; i++) {\n a = a.multiply(A[i]);\n if (a.compareTo(b) >0) {\n a = new BigDecimal(1);\n check++;\n }\n }\n }\n if (a.compareTo(c) == 0) {\n System.out.println(0);\n } else if (check != 0) {\n System.out.println(-1);\n } else {\n System.out.println(a);\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n BigDecimal[] A = new BigDecimal[N+1];\n BigDecimal a = new BigDecimal(1);\n BigDecimal b = new BigDecimal(Math.pow(10,18));\n BigDecimal c = new BigDecimal(0);\n int check =0;\n for (int i =1; i<=N; i++) {\n A[i] = sc.nextBigDecimal();\n if (A[i].compareTo(c) == 0) {\n a = new BigDecimal(0);\n break;\n }\n }\n if (a.compareTo(c) != 0) {\n for (int i =1; i<=N; i++) {\n a = a.multiply(A[i]);\n if (a.compareTo(b) >0) {\n a = new BigDecimal(1);\n check++;\n }\n }\n }\n if (a.compareTo(c) == 0) {\n System.out.println(0);\n } else if (check != 0) {\n System.out.println(-1);\n } else {\n System.out.println(a);\n }\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BigDecimal[] A = new BigDecimal[N+1];",
"A",
"new BigDecimal[N+1]",
"N+1",
"N",
"1",
"BigDecimal a = new BigDecimal(1);",
"a",
"new BigDecimal(1)",
"BigDecimal b = new BigDecimal(Math.pow(10,18));",
"b",
"new BigDecimal(Math.pow(10,18))",
"BigDecimal c = new BigDecimal(0);",
"c",
"new BigDecimal(0)",
"int check =0;",
"check",
"0",
"for (int i =1; i<=N; i++) {\n A[i] = sc.nextBigDecimal();\n if (A[i].compareTo(c) == 0) {\n a = new BigDecimal(0);\n break;\n }\n }",
"int i =1;",
"int i =1;",
"i",
"1",
"i<=N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i] = sc.nextBigDecimal();\n if (A[i].compareTo(c) == 0) {\n a = new BigDecimal(0);\n break;\n }\n }",
"{\n A[i] = sc.nextBigDecimal();\n if (A[i].compareTo(c) == 0) {\n a = new BigDecimal(0);\n break;\n }\n }",
"A[i] = sc.nextBigDecimal()",
"A[i]",
"A",
"i",
"sc.nextBigDecimal()",
"sc.nextBigDecimal",
"sc",
"if (A[i].compareTo(c) == 0) {\n a = new BigDecimal(0);\n break;\n }",
"A[i].compareTo(c) == 0",
"A[i].compareTo(c)",
"A[i].compareTo",
"A[i]",
"A",
"i",
"c",
"0",
"{\n a = new BigDecimal(0);\n break;\n }",
"a = new BigDecimal(0)",
"a",
"new BigDecimal(0)",
"break;",
"if (a.compareTo(c) != 0) {\n for (int i =1; i<=N; i++) {\n a = a.multiply(A[i]);\n if (a.compareTo(b) >0) {\n a = new BigDecimal(1);\n check++;\n }\n }\n }",
"a.compareTo(c) != 0",
"a.compareTo(c)",
"a.compareTo",
"a",
"c",
"0",
"{\n for (int i =1; i<=N; i++) {\n a = a.multiply(A[i]);\n if (a.compareTo(b) >0) {\n a = new BigDecimal(1);\n check++;\n }\n }\n }",
"for (int i =1; i<=N; i++) {\n a = a.multiply(A[i]);\n if (a.compareTo(b) >0) {\n a = new BigDecimal(1);\n check++;\n }\n }",
"int i =1;",
"int i =1;",
"i",
"1",
"i<=N",
"i",
"N",
"i++",
"i++",
"i",
"{\n a = a.multiply(A[i]);\n if (a.compareTo(b) >0) {\n a = new BigDecimal(1);\n check++;\n }\n }",
"{\n a = a.multiply(A[i]);\n if (a.compareTo(b) >0) {\n a = new BigDecimal(1);\n check++;\n }\n }",
"a = a.multiply(A[i])",
"a",
"a.multiply(A[i])",
"a.multiply",
"a",
"A[i]",
"A",
"i",
"if (a.compareTo(b) >0) {\n a = new BigDecimal(1);\n check++;\n }",
"a.compareTo(b) >0",
"a.compareTo(b)",
"a.compareTo",
"a",
"b",
"0",
"{\n a = new BigDecimal(1);\n check++;\n }",
"a = new BigDecimal(1)",
"a",
"new BigDecimal(1)",
"check++",
"check",
"if (a.compareTo(c) == 0) {\n System.out.println(0);\n } else if (check != 0) {\n System.out.println(-1);\n } else {\n System.out.println(a);\n }",
"a.compareTo(c) == 0",
"a.compareTo(c)",
"a.compareTo",
"a",
"c",
"0",
"{\n System.out.println(0);\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"if (check != 0) {\n System.out.println(-1);\n } else {\n System.out.println(a);\n }",
"check != 0",
"check",
"0",
"{\n System.out.println(-1);\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"{\n System.out.println(a);\n }",
"System.out.println(a)",
"System.out.println",
"System.out",
"System",
"System.out",
"a",
"String[] args",
"args",
"public class Main {\n\n public static void main (String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n BigDecimal[] A = new BigDecimal[N+1];\n BigDecimal a = new BigDecimal(1);\n BigDecimal b = new BigDecimal(Math.pow(10,18));\n BigDecimal c = new BigDecimal(0);\n int check =0;\n for (int i =1; i<=N; i++) {\n A[i] = sc.nextBigDecimal();\n if (A[i].compareTo(c) == 0) {\n a = new BigDecimal(0);\n break;\n }\n }\n if (a.compareTo(c) != 0) {\n for (int i =1; i<=N; i++) {\n a = a.multiply(A[i]);\n if (a.compareTo(b) >0) {\n a = new BigDecimal(1);\n check++;\n }\n }\n }\n if (a.compareTo(c) == 0) {\n System.out.println(0);\n } else if (check != 0) {\n System.out.println(-1);\n } else {\n System.out.println(a);\n }\n }\n}",
"public class Main {\n\n public static void main (String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n BigDecimal[] A = new BigDecimal[N+1];\n BigDecimal a = new BigDecimal(1);\n BigDecimal b = new BigDecimal(Math.pow(10,18));\n BigDecimal c = new BigDecimal(0);\n int check =0;\n for (int i =1; i<=N; i++) {\n A[i] = sc.nextBigDecimal();\n if (A[i].compareTo(c) == 0) {\n a = new BigDecimal(0);\n break;\n }\n }\n if (a.compareTo(c) != 0) {\n for (int i =1; i<=N; i++) {\n a = a.multiply(A[i]);\n if (a.compareTo(b) >0) {\n a = new BigDecimal(1);\n check++;\n }\n }\n }\n if (a.compareTo(c) == 0) {\n System.out.println(0);\n } else if (check != 0) {\n System.out.println(-1);\n } else {\n System.out.println(a);\n }\n }\n}",
"Main"
] |
import java.util.*;
import java.math.*;
public class Main {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
BigDecimal[] A = new BigDecimal[N+1];
BigDecimal a = new BigDecimal(1);
BigDecimal b = new BigDecimal(Math.pow(10,18));
BigDecimal c = new BigDecimal(0);
int check =0;
for (int i =1; i<=N; i++) {
A[i] = sc.nextBigDecimal();
if (A[i].compareTo(c) == 0) {
a = new BigDecimal(0);
break;
}
}
if (a.compareTo(c) != 0) {
for (int i =1; i<=N; i++) {
a = a.multiply(A[i]);
if (a.compareTo(b) >0) {
a = new BigDecimal(1);
check++;
}
}
}
if (a.compareTo(c) == 0) {
System.out.println(0);
} else if (check != 0) {
System.out.println(-1);
} else {
System.out.println(a);
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
41,
13,
20,
41,
13,
41,
13,
41,
13,
17,
12,
13,
30,
0,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
17,
4,
18,
13,
13,
14,
2,
18,
13,
17,
17,
4,
18,
13,
17,
30,
41,
13,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
18,
13,
13,
14,
2,
13,
2,
13,
13,
30,
0,
13,
13,
30,
0,
13,
17,
3,
14,
13,
4,
18,
13,
13,
4,
18,
13,
40,
17,
4,
18,
13,
23,
13,
6,
13,
41,
13,
18,
13,
13,
41,
13,
20,
17,
41,
13,
17,
41,
13,
17,
12,
13,
30,
14,
2,
13,
13,
30,
29,
17,
30,
0,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
29,
17,
29,
17,
12,
13,
30,
14,
4,
13,
29,
18,
13,
40,
13,
29,
40,
17,
12,
13,
30,
29,
2,
2,
17,
13,
2,
13,
17,
23,
13,
12,
13,
30,
42,
2,
4,
13,
40,
4,
13,
18,
13,
13,
40,
13,
12,
13,
30,
4,
13,
29,
4,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
20,
41,
13,
4,
13,
42,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
17,
41,
13,
17,
41,
13,
4,
13,
14,
2,
13,
17,
30,
0,
13,
17,
0,
13,
4,
13,
14,
2,
2,
13,
17,
2,
17,
13,
30,
37,
20,
42,
17,
30,
14,
2,
2,
17,
13,
2,
13,
17,
30,
0,
13,
17,
0,
13,
2,
13,
17,
14,
2,
2,
13,
40,
17,
40,
4,
13,
13,
30,
29,
8,
13,
40,
13,
13,
30,
37,
20,
0,
13,
4,
13,
12,
13,
30,
29,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
14,
13,
30,
41,
13,
20,
2,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
29,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
14,
13,
30,
41,
13,
20,
2,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
29,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
29,
13,
23,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
487,
17
],
[
487,
18
],
[
18,
19
],
[
18,
20
],
[
487,
21
],
[
21,
22
],
[
21,
23
],
[
487,
24
],
[
24,
25
],
[
487,
26
],
[
26,
27
],
[
487,
28
],
[
28,
29
],
[
28,
30
],
[
487,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
37,
38
],
[
33,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
42,
43
],
[
41,
44
],
[
41,
45
],
[
33,
46
],
[
46,
47
],
[
47,
48
],
[
46,
49
],
[
33,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
50,
56
],
[
56,
57
],
[
57,
58
],
[
56,
59
],
[
50,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
63,
65
],
[
60,
66
],
[
66,
67
],
[
66,
68
],
[
60,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
74,
75
],
[
74,
76
],
[
69,
77
],
[
77,
78
],
[
78,
79
],
[
69,
80
],
[
81,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
81,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
87,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
87,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
60,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
105,
106
],
[
104,
107
],
[
102,
108
],
[
108,
109
],
[
109,
110
],
[
108,
111
],
[
111,
112
],
[
33,
113
],
[
113,
114
],
[
114,
115
],
[
31,
116
],
[
116,
117
],
[
487,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
118,
125
],
[
125,
126
],
[
125,
127
],
[
118,
129
],
[
129,
130
],
[
129,
131
],
[
118,
132
],
[
132,
133
],
[
132,
134
],
[
118,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
142,
143
],
[
143,
144
],
[
138,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
145,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
149,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
160,
161
],
[
159,
162
],
[
145,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
163,
167
],
[
167,
168
],
[
168,
169
],
[
137,
170
],
[
170,
171
],
[
118,
172
],
[
172,
173
],
[
172,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
175,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
181,
182
],
[
175,
183
],
[
183,
184
],
[
184,
185
],
[
118,
186
],
[
186,
187
],
[
186,
188
],
[
188,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
190,
194
],
[
194,
195
],
[
194,
196
],
[
186,
197
],
[
197,
198
],
[
118,
199
],
[
199,
200
],
[
199,
201
],
[
201,
202
],
[
202,
203
],
[
203,
204
],
[
204,
205
],
[
203,
206
],
[
206,
207
],
[
207,
208
],
[
207,
209
],
[
209,
210
],
[
209,
211
],
[
202,
212
],
[
212,
213
],
[
118,
214
],
[
214,
215
],
[
214,
216
],
[
216,
217
],
[
217,
218
],
[
216,
219
],
[
219,
220
],
[
220,
221
],
[
118,
222
],
[
222,
223
],
[
222,
224
],
[
224,
225
],
[
225,
226
],
[
226,
227
],
[
227,
228
],
[
225,
229
],
[
229,
230
],
[
224,
231
],
[
231,
232
],
[
231,
233
],
[
224,
234
],
[
234,
235
],
[
234,
236
],
[
236,
237
],
[
224,
238
],
[
238,
239
],
[
239,
240
],
[
239,
241
],
[
238,
242
],
[
242,
243
],
[
243,
244
],
[
244,
245
],
[
243,
246
],
[
242,
247
],
[
247,
248
],
[
247,
249
],
[
249,
250
],
[
224,
251
],
[
251,
252
],
[
252,
253
],
[
253,
254
],
[
118,
255
],
[
255,
256
],
[
255,
257
],
[
257,
258
],
[
258,
259
],
[
259,
260
],
[
260,
261
],
[
258,
262
],
[
262,
263
],
[
257,
264
],
[
264,
265
],
[
264,
266
],
[
257,
267
],
[
267,
268
],
[
267,
269
],
[
257,
270
],
[
270,
271
],
[
270,
272
],
[
272,
273
],
[
257,
274
],
[
274,
275
],
[
275,
276
],
[
275,
277
],
[
274,
278
],
[
278,
279
],
[
279,
280
],
[
279,
281
],
[
278,
282
],
[
282,
283
],
[
282,
284
],
[
284,
285
],
[
257,
286
],
[
286,
287
],
[
287,
288
],
[
288,
289
],
[
288,
290
],
[
287,
291
],
[
291,
292
],
[
291,
293
],
[
286,
294
],
[
294,
295
],
[
295,
296
],
[
257,
297
],
[
297,
298
],
[
297,
299
],
[
299,
300
],
[
300,
301
],
[
301,
302
],
[
302,
303
],
[
302,
304
],
[
301,
305
],
[
305,
306
],
[
305,
307
],
[
300,
308
],
[
308,
309
],
[
309,
310
],
[
309,
311
],
[
308,
312
],
[
312,
313
],
[
312,
314
],
[
314,
315
],
[
314,
316
],
[
300,
317
],
[
317,
318
],
[
318,
319
],
[
319,
320
],
[
319,
321
],
[
321,
322
],
[
318,
323
],
[
323,
324
],
[
324,
325
],
[
324,
326
],
[
317,
327
],
[
327,
328
],
[
328,
329
],
[
329,
330
],
[
329,
331
],
[
331,
332
],
[
329,
333
],
[
317,
334
],
[
334,
335
],
[
335,
336
],
[
299,
337
],
[
337,
338
],
[
337,
339
],
[
339,
340
],
[
118,
341
],
[
341,
342
],
[
341,
343
],
[
343,
344
],
[
344,
345
],
[
345,
346
],
[
118,
347
],
[
347,
348
],
[
347,
349
],
[
349,
350
],
[
350,
351
],
[
351,
352
],
[
352,
353
],
[
351,
354
],
[
354,
355
],
[
118,
356
],
[
356,
357
],
[
356,
358
],
[
358,
359
],
[
359,
360
],
[
359,
361
],
[
361,
362
],
[
362,
363
],
[
362,
364
],
[
365,
366
],
[
365,
367
],
[
361,
368
],
[
368,
369
],
[
369,
370
],
[
370,
371
],
[
370,
372
],
[
368,
373
],
[
373,
374
],
[
373,
375
],
[
368,
376
],
[
376,
377
],
[
377,
378
],
[
368,
379
],
[
380,
380
],
[
380,
381
],
[
381,
382
],
[
382,
383
],
[
382,
384
],
[
381,
385
],
[
385,
386
],
[
386,
387
],
[
361,
388
],
[
388,
389
],
[
359,
390
],
[
390,
391
],
[
391,
392
],
[
391,
393
],
[
390,
395
],
[
395,
396
],
[
396,
397
],
[
397,
398
],
[
397,
399
],
[
395,
400
],
[
400,
401
],
[
400,
402
],
[
395,
403
],
[
403,
404
],
[
404,
405
],
[
395,
406
],
[
407,
407
],
[
407,
408
],
[
408,
409
],
[
409,
410
],
[
409,
411
],
[
408,
412
],
[
412,
413
],
[
413,
414
],
[
390,
415
],
[
415,
416
],
[
356,
417
],
[
417,
418
],
[
356,
419
],
[
419,
420
],
[
118,
421
],
[
421,
422
],
[
421,
423
],
[
423,
424
],
[
424,
425
],
[
424,
426
],
[
426,
427
],
[
427,
428
],
[
427,
429
],
[
430,
431
],
[
430,
432
],
[
426,
433
],
[
433,
434
],
[
434,
435
],
[
435,
436
],
[
435,
437
],
[
433,
438
],
[
438,
439
],
[
438,
440
],
[
433,
441
],
[
441,
442
],
[
442,
443
],
[
433,
444
],
[
445,
445
],
[
445,
446
],
[
446,
447
],
[
447,
448
],
[
447,
449
],
[
446,
450
],
[
450,
451
],
[
451,
452
],
[
426,
453
],
[
453,
454
],
[
424,
455
],
[
455,
456
],
[
456,
457
],
[
456,
458
],
[
455,
460
],
[
460,
461
],
[
461,
462
],
[
462,
463
],
[
462,
464
],
[
460,
465
],
[
465,
466
],
[
465,
467
],
[
460,
468
],
[
468,
469
],
[
469,
470
],
[
460,
471
],
[
472,
472
],
[
472,
473
],
[
473,
474
],
[
474,
475
],
[
474,
476
],
[
473,
477
],
[
477,
478
],
[
478,
479
],
[
455,
480
],
[
480,
481
],
[
421,
482
],
[
482,
483
],
[
421,
484
],
[
484,
485
],
[
0,
486
],
[
486,
487
],
[
486,
488
]
] |
[
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.NoSuchElementException;\n\n\npublic class Main{\n\tstatic FastScanner sc = new FastScanner();\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\tstatic int n;\n\tstatic String s;\n\t//static Queue <Long> q = new ArrayDeque <Long>();\n\t//static List<ArrayList<Integer>> e;\n\t//static LinkedList<Integer> adj[]; \n\t\n\tstatic final long lim = 1_000_000_000_000_000_000L;\n\n\tpublic static void main(String[] args) {\n\t\tn = sc.nextInt();\n\t\t\n\t\tlong a [] = sc.nextLongArray(n, false);\n\t\t\n\t\tArrays.sort(a);\n\t\t\n\t\tif (a[0]==0)\n\t\t\tout.println(0);\n\t\t\n\t\telse {\n\t\t\tlong A = a[0];\n\t\t\tboolean ok = true;\n\t\t\tfor (int i=1; i<n; i++) {\n\t\t\t\tlong cur = a[i];\n\t\t\t\t\n\t\t\t\tif (cur<=lim/A) {\n\t\t\t\t\tA*=cur;\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse {\n\t\t\t\t\tok = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif (ok)\n\t\t\t\tout.println(A);\n\t\t\t\n\t\t\telse\n\t\t\t\tout.println(-1);\n\t\t}\n\t\tout.flush();\n\t}\n\t\n\t\n\t\n\t\tstatic class FastScanner {\n\t\t private final InputStream in = System.in;\n\t\t private final byte[] buffer = new byte[1024];\n\t\t private int ptr = 0;\n\t\t private int buflen = 0;\n\n\t\t private boolean hasNextByte() {\n\t\t if (ptr < buflen) {\n\t\t return true;\n\t\t } else {\n\t\t ptr = 0;\n\t\t try {\n\t\t buflen = in.read(buffer);\n\t\t } catch (IOException e) {\n\t\t e.printStackTrace();\n\t\t }\n\t\t if (buflen <= 0) {\n\t\t return false;\n\t\t }\n\t\t }\n\t\t return true;\n\t\t }\n\n\t\t private int readByte() {\n\t\t if (hasNextByte()) return buffer[ptr++];\n\t\t else return -1;\n\t\t }\n\n\t\t private static boolean isPrintableChar(int c) {\n\t\t return 33 <= c && c <= 126;\n\t\t }\n\n\t\t private void skipUnprintable() {\n\t\t while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n\t\t }\n\n\t\t public boolean hasNext() {\n\t\t skipUnprintable();\n\t\t return hasNextByte();\n\t\t }\n\n\t\t public String next() {\n\t\t if (!hasNext()) throw new NoSuchElementException();\n\t\t StringBuilder sb = new StringBuilder();\n\t\t int b = readByte();\n\t\t while (isPrintableChar(b)) {\n\t\t sb.appendCodePoint(b);\n\t\t b = readByte();\n\t\t }\n\t\t return sb.toString();\n\t\t }\n\n\t\t public long nextLong() {\n\t\t if (!hasNext()) throw new NoSuchElementException();\n\t\t long n = 0;\n\t\t boolean minus = false;\n\t\t int b = readByte();\n\t\t if (b == '-') {\n\t\t minus = true;\n\t\t b = readByte();\n\t\t }\n\t\t if (b < '0' || '9' < b) {\n\t\t throw new NumberFormatException();\n\t\t }\n\t\t while (true) {\n\t\t if ('0' <= b && b <= '9') {\n\t\t n *= 10;\n\t\t n += b - '0';\n\t\t } else if (b == -1 || !isPrintableChar(b)) {\n\t\t return minus ? -n : n;\n\t\t } else {\n\t\t throw new NumberFormatException();\n\t\t }\n\t\t b = readByte();\n\t\t }\n\t\t }\n\n\t\t public int nextInt() {\n\t\t return (int) nextLong();\n\t\t }\n\t\t \n\t\t public double nextDouble(){\n\t\t \treturn Double.parseDouble(next());\n\t\t }\n\n\t\t public int[] nextIntArray(int N, boolean oneBased) {\n\t\t if (oneBased) {\n\t\t int[] array = new int[N + 1];\n\t\t for (int i = 1; i <= N; i++) {\n\t\t array[i] = sc.nextInt();\n\t\t }\n\t\t return array;\n\t\t } else {\n\t\t int[] array = new int[N];\n\t\t for (int i = 0; i < N; i++) {\n\t\t array[i] = sc.nextInt();\n\t\t }\n\t\t return array;\n\t\t }\n\t\t }\n\n\t\t public long[] nextLongArray(int N, boolean oneBased) {\n\t\t if (oneBased) {\n\t\t long[] array = new long[N + 1];\n\t\t for (int i = 1; i <= N; i++) {\n\t\t array[i] = sc.nextLong();\n\t\t }\n\t\t return array;\n\t\t } else {\n\t\t long[] array = new long[N];\n\t\t for (int i = 0; i < N; i++) {\n\t\t array[i] = sc.nextLong();\n\t\t }\n\t\t return array;\n\t\t }\n\t\t }\n\t\t }\n\n\t\t}\t \n\n\n",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.NoSuchElementException;",
"NoSuchElementException",
"java.util",
"public class Main{\n\tstatic FastScanner sc = new FastScanner();\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\tstatic int n;\n\tstatic String s;\n\t//static Queue <Long> q = new ArrayDeque <Long>();\n\t//static List<ArrayList<Integer>> e;\n\t//static LinkedList<Integer> adj[]; \n\t\n\tstatic final long lim = 1_000_000_000_000_000_000L;\n\n\tpublic static void main(String[] args) {\n\t\tn = sc.nextInt();\n\t\t\n\t\tlong a [] = sc.nextLongArray(n, false);\n\t\t\n\t\tArrays.sort(a);\n\t\t\n\t\tif (a[0]==0)\n\t\t\tout.println(0);\n\t\t\n\t\telse {\n\t\t\tlong A = a[0];\n\t\t\tboolean ok = true;\n\t\t\tfor (int i=1; i<n; i++) {\n\t\t\t\tlong cur = a[i];\n\t\t\t\t\n\t\t\t\tif (cur<=lim/A) {\n\t\t\t\t\tA*=cur;\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse {\n\t\t\t\t\tok = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif (ok)\n\t\t\t\tout.println(A);\n\t\t\t\n\t\t\telse\n\t\t\t\tout.println(-1);\n\t\t}\n\t\tout.flush();\n\t}\n\t\n\t\n\t\n\t\tstatic class FastScanner {\n\t\t private final InputStream in = System.in;\n\t\t private final byte[] buffer = new byte[1024];\n\t\t private int ptr = 0;\n\t\t private int buflen = 0;\n\n\t\t private boolean hasNextByte() {\n\t\t if (ptr < buflen) {\n\t\t return true;\n\t\t } else {\n\t\t ptr = 0;\n\t\t try {\n\t\t buflen = in.read(buffer);\n\t\t } catch (IOException e) {\n\t\t e.printStackTrace();\n\t\t }\n\t\t if (buflen <= 0) {\n\t\t return false;\n\t\t }\n\t\t }\n\t\t return true;\n\t\t }\n\n\t\t private int readByte() {\n\t\t if (hasNextByte()) return buffer[ptr++];\n\t\t else return -1;\n\t\t }\n\n\t\t private static boolean isPrintableChar(int c) {\n\t\t return 33 <= c && c <= 126;\n\t\t }\n\n\t\t private void skipUnprintable() {\n\t\t while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n\t\t }\n\n\t\t public boolean hasNext() {\n\t\t skipUnprintable();\n\t\t return hasNextByte();\n\t\t }\n\n\t\t public String next() {\n\t\t if (!hasNext()) throw new NoSuchElementException();\n\t\t StringBuilder sb = new StringBuilder();\n\t\t int b = readByte();\n\t\t while (isPrintableChar(b)) {\n\t\t sb.appendCodePoint(b);\n\t\t b = readByte();\n\t\t }\n\t\t return sb.toString();\n\t\t }\n\n\t\t public long nextLong() {\n\t\t if (!hasNext()) throw new NoSuchElementException();\n\t\t long n = 0;\n\t\t boolean minus = false;\n\t\t int b = readByte();\n\t\t if (b == '-') {\n\t\t minus = true;\n\t\t b = readByte();\n\t\t }\n\t\t if (b < '0' || '9' < b) {\n\t\t throw new NumberFormatException();\n\t\t }\n\t\t while (true) {\n\t\t if ('0' <= b && b <= '9') {\n\t\t n *= 10;\n\t\t n += b - '0';\n\t\t } else if (b == -1 || !isPrintableChar(b)) {\n\t\t return minus ? -n : n;\n\t\t } else {\n\t\t throw new NumberFormatException();\n\t\t }\n\t\t b = readByte();\n\t\t }\n\t\t }\n\n\t\t public int nextInt() {\n\t\t return (int) nextLong();\n\t\t }\n\t\t \n\t\t public double nextDouble(){\n\t\t \treturn Double.parseDouble(next());\n\t\t }\n\n\t\t public int[] nextIntArray(int N, boolean oneBased) {\n\t\t if (oneBased) {\n\t\t int[] array = new int[N + 1];\n\t\t for (int i = 1; i <= N; i++) {\n\t\t array[i] = sc.nextInt();\n\t\t }\n\t\t return array;\n\t\t } else {\n\t\t int[] array = new int[N];\n\t\t for (int i = 0; i < N; i++) {\n\t\t array[i] = sc.nextInt();\n\t\t }\n\t\t return array;\n\t\t }\n\t\t }\n\n\t\t public long[] nextLongArray(int N, boolean oneBased) {\n\t\t if (oneBased) {\n\t\t long[] array = new long[N + 1];\n\t\t for (int i = 1; i <= N; i++) {\n\t\t array[i] = sc.nextLong();\n\t\t }\n\t\t return array;\n\t\t } else {\n\t\t long[] array = new long[N];\n\t\t for (int i = 0; i < N; i++) {\n\t\t array[i] = sc.nextLong();\n\t\t }\n\t\t return array;\n\t\t }\n\t\t }\n\t\t }\n\n\t\t}",
"Main",
"static FastScanner sc = new FastScanner();",
"sc",
"new FastScanner()",
"static PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"static int n;",
"n",
"static String s;",
"s",
"static final long lim = 1_000_000_000_000_000_000L;",
"lim",
"1_000_000_000_000_000_000L",
"public static void main(String[] args) {\n\t\tn = sc.nextInt();\n\t\t\n\t\tlong a [] = sc.nextLongArray(n, false);\n\t\t\n\t\tArrays.sort(a);\n\t\t\n\t\tif (a[0]==0)\n\t\t\tout.println(0);\n\t\t\n\t\telse {\n\t\t\tlong A = a[0];\n\t\t\tboolean ok = true;\n\t\t\tfor (int i=1; i<n; i++) {\n\t\t\t\tlong cur = a[i];\n\t\t\t\t\n\t\t\t\tif (cur<=lim/A) {\n\t\t\t\t\tA*=cur;\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse {\n\t\t\t\t\tok = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif (ok)\n\t\t\t\tout.println(A);\n\t\t\t\n\t\t\telse\n\t\t\t\tout.println(-1);\n\t\t}\n\t\tout.flush();\n\t}",
"main",
"{\n\t\tn = sc.nextInt();\n\t\t\n\t\tlong a [] = sc.nextLongArray(n, false);\n\t\t\n\t\tArrays.sort(a);\n\t\t\n\t\tif (a[0]==0)\n\t\t\tout.println(0);\n\t\t\n\t\telse {\n\t\t\tlong A = a[0];\n\t\t\tboolean ok = true;\n\t\t\tfor (int i=1; i<n; i++) {\n\t\t\t\tlong cur = a[i];\n\t\t\t\t\n\t\t\t\tif (cur<=lim/A) {\n\t\t\t\t\tA*=cur;\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse {\n\t\t\t\t\tok = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif (ok)\n\t\t\t\tout.println(A);\n\t\t\t\n\t\t\telse\n\t\t\t\tout.println(-1);\n\t\t}\n\t\tout.flush();\n\t}",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long a [] = sc.nextLongArray(n, false);",
"a",
"sc.nextLongArray(n, false)",
"sc.nextLongArray",
"sc",
"n",
"false",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"if (a[0]==0)\n\t\t\tout.println(0);\n\t\t\n\t\telse {\n\t\t\tlong A = a[0];\n\t\t\tboolean ok = true;\n\t\t\tfor (int i=1; i<n; i++) {\n\t\t\t\tlong cur = a[i];\n\t\t\t\t\n\t\t\t\tif (cur<=lim/A) {\n\t\t\t\t\tA*=cur;\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse {\n\t\t\t\t\tok = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif (ok)\n\t\t\t\tout.println(A);\n\t\t\t\n\t\t\telse\n\t\t\t\tout.println(-1);\n\t\t}",
"a[0]==0",
"a[0]",
"a",
"0",
"0",
"out.println(0)",
"out.println",
"out",
"0",
"{\n\t\t\tlong A = a[0];\n\t\t\tboolean ok = true;\n\t\t\tfor (int i=1; i<n; i++) {\n\t\t\t\tlong cur = a[i];\n\t\t\t\t\n\t\t\t\tif (cur<=lim/A) {\n\t\t\t\t\tA*=cur;\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse {\n\t\t\t\t\tok = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif (ok)\n\t\t\t\tout.println(A);\n\t\t\t\n\t\t\telse\n\t\t\t\tout.println(-1);\n\t\t}",
"long A = a[0];",
"A",
"a[0]",
"a",
"0",
"boolean ok = true;",
"ok",
"true",
"for (int i=1; i<n; i++) {\n\t\t\t\tlong cur = a[i];\n\t\t\t\t\n\t\t\t\tif (cur<=lim/A) {\n\t\t\t\t\tA*=cur;\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse {\n\t\t\t\t\tok = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}",
"int i=1;",
"int i=1;",
"i",
"1",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tlong cur = a[i];\n\t\t\t\t\n\t\t\t\tif (cur<=lim/A) {\n\t\t\t\t\tA*=cur;\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse {\n\t\t\t\t\tok = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}",
"{\n\t\t\t\tlong cur = a[i];\n\t\t\t\t\n\t\t\t\tif (cur<=lim/A) {\n\t\t\t\t\tA*=cur;\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse {\n\t\t\t\t\tok = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}",
"long cur = a[i];",
"cur",
"a[i]",
"a",
"i",
"if (cur<=lim/A) {\n\t\t\t\t\tA*=cur;\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse {\n\t\t\t\t\tok = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"cur<=lim/A",
"cur",
"lim/A",
"lim",
"A",
"{\n\t\t\t\t\tA*=cur;\t\n\t\t\t\t}",
"A*=cur",
"A",
"cur",
"{\n\t\t\t\t\tok = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"ok = false",
"ok",
"false",
"break;",
"if (ok)\n\t\t\t\tout.println(A);\n\t\t\t\n\t\t\telse\n\t\t\t\tout.println(-1);",
"ok",
"out.println(A)",
"out.println",
"out",
"A",
"out.println(-1)",
"out.println",
"out",
"-1",
"1",
"out.flush()",
"out.flush",
"out",
"String[] args",
"args",
"static class FastScanner {\n\t\t private final InputStream in = System.in;\n\t\t private final byte[] buffer = new byte[1024];\n\t\t private int ptr = 0;\n\t\t private int buflen = 0;\n\n\t\t private boolean hasNextByte() {\n\t\t if (ptr < buflen) {\n\t\t return true;\n\t\t } else {\n\t\t ptr = 0;\n\t\t try {\n\t\t buflen = in.read(buffer);\n\t\t } catch (IOException e) {\n\t\t e.printStackTrace();\n\t\t }\n\t\t if (buflen <= 0) {\n\t\t return false;\n\t\t }\n\t\t }\n\t\t return true;\n\t\t }\n\n\t\t private int readByte() {\n\t\t if (hasNextByte()) return buffer[ptr++];\n\t\t else return -1;\n\t\t }\n\n\t\t private static boolean isPrintableChar(int c) {\n\t\t return 33 <= c && c <= 126;\n\t\t }\n\n\t\t private void skipUnprintable() {\n\t\t while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n\t\t }\n\n\t\t public boolean hasNext() {\n\t\t skipUnprintable();\n\t\t return hasNextByte();\n\t\t }\n\n\t\t public String next() {\n\t\t if (!hasNext()) throw new NoSuchElementException();\n\t\t StringBuilder sb = new StringBuilder();\n\t\t int b = readByte();\n\t\t while (isPrintableChar(b)) {\n\t\t sb.appendCodePoint(b);\n\t\t b = readByte();\n\t\t }\n\t\t return sb.toString();\n\t\t }\n\n\t\t public long nextLong() {\n\t\t if (!hasNext()) throw new NoSuchElementException();\n\t\t long n = 0;\n\t\t boolean minus = false;\n\t\t int b = readByte();\n\t\t if (b == '-') {\n\t\t minus = true;\n\t\t b = readByte();\n\t\t }\n\t\t if (b < '0' || '9' < b) {\n\t\t throw new NumberFormatException();\n\t\t }\n\t\t while (true) {\n\t\t if ('0' <= b && b <= '9') {\n\t\t n *= 10;\n\t\t n += b - '0';\n\t\t } else if (b == -1 || !isPrintableChar(b)) {\n\t\t return minus ? -n : n;\n\t\t } else {\n\t\t throw new NumberFormatException();\n\t\t }\n\t\t b = readByte();\n\t\t }\n\t\t }\n\n\t\t public int nextInt() {\n\t\t return (int) nextLong();\n\t\t }\n\t\t \n\t\t public double nextDouble(){\n\t\t \treturn Double.parseDouble(next());\n\t\t }\n\n\t\t public int[] nextIntArray(int N, boolean oneBased) {\n\t\t if (oneBased) {\n\t\t int[] array = new int[N + 1];\n\t\t for (int i = 1; i <= N; i++) {\n\t\t array[i] = sc.nextInt();\n\t\t }\n\t\t return array;\n\t\t } else {\n\t\t int[] array = new int[N];\n\t\t for (int i = 0; i < N; i++) {\n\t\t array[i] = sc.nextInt();\n\t\t }\n\t\t return array;\n\t\t }\n\t\t }\n\n\t\t public long[] nextLongArray(int N, boolean oneBased) {\n\t\t if (oneBased) {\n\t\t long[] array = new long[N + 1];\n\t\t for (int i = 1; i <= N; i++) {\n\t\t array[i] = sc.nextLong();\n\t\t }\n\t\t return array;\n\t\t } else {\n\t\t long[] array = new long[N];\n\t\t for (int i = 0; i < N; i++) {\n\t\t array[i] = sc.nextLong();\n\t\t }\n\t\t return array;\n\t\t }\n\t\t }\n\t\t }",
"FastScanner",
"private final InputStream in = System.in;",
"in",
"System.in",
"System",
"System.in",
"private final byte[] buffer = new byte[1024];",
"buffer",
"new byte[1024]",
"1024",
"private int ptr = 0;",
"ptr",
"0",
"private int buflen = 0;",
"buflen",
"0",
"private boolean hasNextByte() {\n\t\t if (ptr < buflen) {\n\t\t return true;\n\t\t } else {\n\t\t ptr = 0;\n\t\t try {\n\t\t buflen = in.read(buffer);\n\t\t } catch (IOException e) {\n\t\t e.printStackTrace();\n\t\t }\n\t\t if (buflen <= 0) {\n\t\t return false;\n\t\t }\n\t\t }\n\t\t return true;\n\t\t }",
"hasNextByte",
"{\n\t\t if (ptr < buflen) {\n\t\t return true;\n\t\t } else {\n\t\t ptr = 0;\n\t\t try {\n\t\t buflen = in.read(buffer);\n\t\t } catch (IOException e) {\n\t\t e.printStackTrace();\n\t\t }\n\t\t if (buflen <= 0) {\n\t\t return false;\n\t\t }\n\t\t }\n\t\t return true;\n\t\t }",
"if (ptr < buflen) {\n\t\t return true;\n\t\t } else {\n\t\t ptr = 0;\n\t\t try {\n\t\t buflen = in.read(buffer);\n\t\t } catch (IOException e) {\n\t\t e.printStackTrace();\n\t\t }\n\t\t if (buflen <= 0) {\n\t\t return false;\n\t\t }\n\t\t }",
"ptr < buflen",
"ptr",
"buflen",
"{\n\t\t return true;\n\t\t }",
"return true;",
"true",
"{\n\t\t ptr = 0;\n\t\t try {\n\t\t buflen = in.read(buffer);\n\t\t } catch (IOException e) {\n\t\t e.printStackTrace();\n\t\t }\n\t\t if (buflen <= 0) {\n\t\t return false;\n\t\t }\n\t\t }",
"ptr = 0",
"ptr",
"0",
"try {\n\t\t buflen = in.read(buffer);\n\t\t } catch (IOException e) {\n\t\t e.printStackTrace();\n\t\t }",
"catch (IOException e) {\n\t\t e.printStackTrace();\n\t\t }",
"IOException e",
"{\n\t\t e.printStackTrace();\n\t\t }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t\t buflen = in.read(buffer);\n\t\t }",
"buflen = in.read(buffer)",
"buflen",
"in.read(buffer)",
"in.read",
"in",
"buffer",
"if (buflen <= 0) {\n\t\t return false;\n\t\t }",
"buflen <= 0",
"buflen",
"0",
"{\n\t\t return false;\n\t\t }",
"return false;",
"false",
"return true;",
"true",
"private int readByte() {\n\t\t if (hasNextByte()) return buffer[ptr++];\n\t\t else return -1;\n\t\t }",
"readByte",
"{\n\t\t if (hasNextByte()) return buffer[ptr++];\n\t\t else return -1;\n\t\t }",
"if (hasNextByte()) return buffer[ptr++];\n\t\t else return -1;",
"hasNextByte()",
"hasNextByte",
"return buffer[ptr++];",
"buffer[ptr++]",
"buffer",
"ptr++",
"ptr",
"return -1;",
"-1",
"1",
"private static boolean isPrintableChar(int c) {\n\t\t return 33 <= c && c <= 126;\n\t\t }",
"isPrintableChar",
"{\n\t\t return 33 <= c && c <= 126;\n\t\t }",
"return 33 <= c && c <= 126;",
"33 <= c && c <= 126",
"33 <= c",
"33",
"c",
"c <= 126",
"c",
"126",
"int c",
"c",
"private void skipUnprintable() {\n\t\t while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n\t\t }",
"skipUnprintable",
"{\n\t\t while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n\t\t }",
"while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;",
"hasNextByte() && !isPrintableChar(buffer[ptr])",
"hasNextByte()",
"hasNextByte",
"!isPrintableChar(buffer[ptr])",
"isPrintableChar(buffer[ptr])",
"isPrintableChar",
"buffer[ptr]",
"buffer",
"ptr",
"ptr++",
"ptr",
"public boolean hasNext() {\n\t\t skipUnprintable();\n\t\t return hasNextByte();\n\t\t }",
"hasNext",
"{\n\t\t skipUnprintable();\n\t\t return hasNextByte();\n\t\t }",
"skipUnprintable()",
"skipUnprintable",
"return hasNextByte();",
"hasNextByte()",
"hasNextByte",
"public String next() {\n\t\t if (!hasNext()) throw new NoSuchElementException();\n\t\t StringBuilder sb = new StringBuilder();\n\t\t int b = readByte();\n\t\t while (isPrintableChar(b)) {\n\t\t sb.appendCodePoint(b);\n\t\t b = readByte();\n\t\t }\n\t\t return sb.toString();\n\t\t }",
"next",
"{\n\t\t if (!hasNext()) throw new NoSuchElementException();\n\t\t StringBuilder sb = new StringBuilder();\n\t\t int b = readByte();\n\t\t while (isPrintableChar(b)) {\n\t\t sb.appendCodePoint(b);\n\t\t b = readByte();\n\t\t }\n\t\t return sb.toString();\n\t\t }",
"if (!hasNext()) throw new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"while (isPrintableChar(b)) {\n\t\t sb.appendCodePoint(b);\n\t\t b = readByte();\n\t\t }",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n\t\t sb.appendCodePoint(b);\n\t\t b = readByte();\n\t\t }",
"sb.appendCodePoint(b)",
"sb.appendCodePoint",
"sb",
"b",
"b = readByte()",
"b",
"readByte()",
"readByte",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public long nextLong() {\n\t\t if (!hasNext()) throw new NoSuchElementException();\n\t\t long n = 0;\n\t\t boolean minus = false;\n\t\t int b = readByte();\n\t\t if (b == '-') {\n\t\t minus = true;\n\t\t b = readByte();\n\t\t }\n\t\t if (b < '0' || '9' < b) {\n\t\t throw new NumberFormatException();\n\t\t }\n\t\t while (true) {\n\t\t if ('0' <= b && b <= '9') {\n\t\t n *= 10;\n\t\t n += b - '0';\n\t\t } else if (b == -1 || !isPrintableChar(b)) {\n\t\t return minus ? -n : n;\n\t\t } else {\n\t\t throw new NumberFormatException();\n\t\t }\n\t\t b = readByte();\n\t\t }\n\t\t }",
"nextLong",
"{\n\t\t if (!hasNext()) throw new NoSuchElementException();\n\t\t long n = 0;\n\t\t boolean minus = false;\n\t\t int b = readByte();\n\t\t if (b == '-') {\n\t\t minus = true;\n\t\t b = readByte();\n\t\t }\n\t\t if (b < '0' || '9' < b) {\n\t\t throw new NumberFormatException();\n\t\t }\n\t\t while (true) {\n\t\t if ('0' <= b && b <= '9') {\n\t\t n *= 10;\n\t\t n += b - '0';\n\t\t } else if (b == -1 || !isPrintableChar(b)) {\n\t\t return minus ? -n : n;\n\t\t } else {\n\t\t throw new NumberFormatException();\n\t\t }\n\t\t b = readByte();\n\t\t }\n\t\t }",
"if (!hasNext()) throw new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"long n = 0;",
"n",
"0",
"boolean minus = false;",
"minus",
"false",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"if (b == '-') {\n\t\t minus = true;\n\t\t b = readByte();\n\t\t }",
"b == '-'",
"b",
"'-'",
"{\n\t\t minus = true;\n\t\t b = readByte();\n\t\t }",
"minus = true",
"minus",
"true",
"b = readByte()",
"b",
"readByte()",
"readByte",
"if (b < '0' || '9' < b) {\n\t\t throw new NumberFormatException();\n\t\t }",
"b < '0' || '9' < b",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"{\n\t\t throw new NumberFormatException();\n\t\t }",
"throw new NumberFormatException();",
"new NumberFormatException()",
"while (true) {\n\t\t if ('0' <= b && b <= '9') {\n\t\t n *= 10;\n\t\t n += b - '0';\n\t\t } else if (b == -1 || !isPrintableChar(b)) {\n\t\t return minus ? -n : n;\n\t\t } else {\n\t\t throw new NumberFormatException();\n\t\t }\n\t\t b = readByte();\n\t\t }",
"true",
"{\n\t\t if ('0' <= b && b <= '9') {\n\t\t n *= 10;\n\t\t n += b - '0';\n\t\t } else if (b == -1 || !isPrintableChar(b)) {\n\t\t return minus ? -n : n;\n\t\t } else {\n\t\t throw new NumberFormatException();\n\t\t }\n\t\t b = readByte();\n\t\t }",
"if ('0' <= b && b <= '9') {\n\t\t n *= 10;\n\t\t n += b - '0';\n\t\t } else if (b == -1 || !isPrintableChar(b)) {\n\t\t return minus ? -n : n;\n\t\t } else {\n\t\t throw new NumberFormatException();\n\t\t }",
"'0' <= b && b <= '9'",
"'0' <= b",
"'0'",
"b",
"b <= '9'",
"b",
"'9'",
"{\n\t\t n *= 10;\n\t\t n += b - '0';\n\t\t }",
"n *= 10",
"n",
"10",
"n += b - '0'",
"n",
"b - '0'",
"b",
"'0'",
"if (b == -1 || !isPrintableChar(b)) {\n\t\t return minus ? -n : n;\n\t\t } else {\n\t\t throw new NumberFormatException();\n\t\t }",
"b == -1 || !isPrintableChar(b)",
"b == -1",
"b",
"-1",
"1",
"!isPrintableChar(b)",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n\t\t return minus ? -n : n;\n\t\t }",
"return minus ? -n : n;",
"minus ? -n : n",
"minus",
"-n",
"n",
"n",
"{\n\t\t throw new NumberFormatException();\n\t\t }",
"throw new NumberFormatException();",
"new NumberFormatException()",
"b = readByte()",
"b",
"readByte()",
"readByte",
"public int nextInt() {\n\t\t return (int) nextLong();\n\t\t }",
"nextInt",
"{\n\t\t return (int) nextLong();\n\t\t }",
"return (int) nextLong();",
"(int) nextLong()",
"nextLong",
"public double nextDouble(){\n\t\t \treturn Double.parseDouble(next());\n\t\t }",
"nextDouble",
"{\n\t\t \treturn Double.parseDouble(next());\n\t\t }",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public int[] nextIntArray(int N, boolean oneBased) {\n\t\t if (oneBased) {\n\t\t int[] array = new int[N + 1];\n\t\t for (int i = 1; i <= N; i++) {\n\t\t array[i] = sc.nextInt();\n\t\t }\n\t\t return array;\n\t\t } else {\n\t\t int[] array = new int[N];\n\t\t for (int i = 0; i < N; i++) {\n\t\t array[i] = sc.nextInt();\n\t\t }\n\t\t return array;\n\t\t }\n\t\t }",
"nextIntArray",
"{\n\t\t if (oneBased) {\n\t\t int[] array = new int[N + 1];\n\t\t for (int i = 1; i <= N; i++) {\n\t\t array[i] = sc.nextInt();\n\t\t }\n\t\t return array;\n\t\t } else {\n\t\t int[] array = new int[N];\n\t\t for (int i = 0; i < N; i++) {\n\t\t array[i] = sc.nextInt();\n\t\t }\n\t\t return array;\n\t\t }\n\t\t }",
"if (oneBased) {\n\t\t int[] array = new int[N + 1];\n\t\t for (int i = 1; i <= N; i++) {\n\t\t array[i] = sc.nextInt();\n\t\t }\n\t\t return array;\n\t\t } else {\n\t\t int[] array = new int[N];\n\t\t for (int i = 0; i < N; i++) {\n\t\t array[i] = sc.nextInt();\n\t\t }\n\t\t return array;\n\t\t }",
"oneBased",
"{\n\t\t int[] array = new int[N + 1];\n\t\t for (int i = 1; i <= N; i++) {\n\t\t array[i] = sc.nextInt();\n\t\t }\n\t\t return array;\n\t\t }",
"int[] array = new int[N + 1];",
"array",
"new int[N + 1]",
"N + 1",
"N",
"1",
"for (int i = 1; i <= N; i++) {\n\t\t array[i] = sc.nextInt();\n\t\t }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i <= N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t array[i] = sc.nextInt();\n\t\t }",
"{\n\t\t array[i] = sc.nextInt();\n\t\t }",
"array[i] = sc.nextInt()",
"array[i]",
"array",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"return array;",
"array",
"{\n\t\t int[] array = new int[N];\n\t\t for (int i = 0; i < N; i++) {\n\t\t array[i] = sc.nextInt();\n\t\t }\n\t\t return array;\n\t\t }",
"int[] array = new int[N];",
"array",
"new int[N]",
"N",
"for (int i = 0; i < N; i++) {\n\t\t array[i] = sc.nextInt();\n\t\t }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t array[i] = sc.nextInt();\n\t\t }",
"{\n\t\t array[i] = sc.nextInt();\n\t\t }",
"array[i] = sc.nextInt()",
"array[i]",
"array",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"return array;",
"array",
"int N",
"N",
"boolean oneBased",
"oneBased",
"public long[] nextLongArray(int N, boolean oneBased) {\n\t\t if (oneBased) {\n\t\t long[] array = new long[N + 1];\n\t\t for (int i = 1; i <= N; i++) {\n\t\t array[i] = sc.nextLong();\n\t\t }\n\t\t return array;\n\t\t } else {\n\t\t long[] array = new long[N];\n\t\t for (int i = 0; i < N; i++) {\n\t\t array[i] = sc.nextLong();\n\t\t }\n\t\t return array;\n\t\t }\n\t\t }",
"nextLongArray",
"{\n\t\t if (oneBased) {\n\t\t long[] array = new long[N + 1];\n\t\t for (int i = 1; i <= N; i++) {\n\t\t array[i] = sc.nextLong();\n\t\t }\n\t\t return array;\n\t\t } else {\n\t\t long[] array = new long[N];\n\t\t for (int i = 0; i < N; i++) {\n\t\t array[i] = sc.nextLong();\n\t\t }\n\t\t return array;\n\t\t }\n\t\t }",
"if (oneBased) {\n\t\t long[] array = new long[N + 1];\n\t\t for (int i = 1; i <= N; i++) {\n\t\t array[i] = sc.nextLong();\n\t\t }\n\t\t return array;\n\t\t } else {\n\t\t long[] array = new long[N];\n\t\t for (int i = 0; i < N; i++) {\n\t\t array[i] = sc.nextLong();\n\t\t }\n\t\t return array;\n\t\t }",
"oneBased",
"{\n\t\t long[] array = new long[N + 1];\n\t\t for (int i = 1; i <= N; i++) {\n\t\t array[i] = sc.nextLong();\n\t\t }\n\t\t return array;\n\t\t }",
"long[] array = new long[N + 1];",
"array",
"new long[N + 1]",
"N + 1",
"N",
"1",
"for (int i = 1; i <= N; i++) {\n\t\t array[i] = sc.nextLong();\n\t\t }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i <= N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t array[i] = sc.nextLong();\n\t\t }",
"{\n\t\t array[i] = sc.nextLong();\n\t\t }",
"array[i] = sc.nextLong()",
"array[i]",
"array",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"return array;",
"array",
"{\n\t\t long[] array = new long[N];\n\t\t for (int i = 0; i < N; i++) {\n\t\t array[i] = sc.nextLong();\n\t\t }\n\t\t return array;\n\t\t }",
"long[] array = new long[N];",
"array",
"new long[N]",
"N",
"for (int i = 0; i < N; i++) {\n\t\t array[i] = sc.nextLong();\n\t\t }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t array[i] = sc.nextLong();\n\t\t }",
"{\n\t\t array[i] = sc.nextLong();\n\t\t }",
"array[i] = sc.nextLong()",
"array[i]",
"array",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"return array;",
"array",
"int N",
"N",
"boolean oneBased",
"oneBased",
"public class Main{\n\tstatic FastScanner sc = new FastScanner();\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\tstatic int n;\n\tstatic String s;\n\t//static Queue <Long> q = new ArrayDeque <Long>();\n\t//static List<ArrayList<Integer>> e;\n\t//static LinkedList<Integer> adj[]; \n\t\n\tstatic final long lim = 1_000_000_000_000_000_000L;\n\n\tpublic static void main(String[] args) {\n\t\tn = sc.nextInt();\n\t\t\n\t\tlong a [] = sc.nextLongArray(n, false);\n\t\t\n\t\tArrays.sort(a);\n\t\t\n\t\tif (a[0]==0)\n\t\t\tout.println(0);\n\t\t\n\t\telse {\n\t\t\tlong A = a[0];\n\t\t\tboolean ok = true;\n\t\t\tfor (int i=1; i<n; i++) {\n\t\t\t\tlong cur = a[i];\n\t\t\t\t\n\t\t\t\tif (cur<=lim/A) {\n\t\t\t\t\tA*=cur;\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse {\n\t\t\t\t\tok = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif (ok)\n\t\t\t\tout.println(A);\n\t\t\t\n\t\t\telse\n\t\t\t\tout.println(-1);\n\t\t}\n\t\tout.flush();\n\t}\n\t\n\t\n\t\n\t\tstatic class FastScanner {\n\t\t private final InputStream in = System.in;\n\t\t private final byte[] buffer = new byte[1024];\n\t\t private int ptr = 0;\n\t\t private int buflen = 0;\n\n\t\t private boolean hasNextByte() {\n\t\t if (ptr < buflen) {\n\t\t return true;\n\t\t } else {\n\t\t ptr = 0;\n\t\t try {\n\t\t buflen = in.read(buffer);\n\t\t } catch (IOException e) {\n\t\t e.printStackTrace();\n\t\t }\n\t\t if (buflen <= 0) {\n\t\t return false;\n\t\t }\n\t\t }\n\t\t return true;\n\t\t }\n\n\t\t private int readByte() {\n\t\t if (hasNextByte()) return buffer[ptr++];\n\t\t else return -1;\n\t\t }\n\n\t\t private static boolean isPrintableChar(int c) {\n\t\t return 33 <= c && c <= 126;\n\t\t }\n\n\t\t private void skipUnprintable() {\n\t\t while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n\t\t }\n\n\t\t public boolean hasNext() {\n\t\t skipUnprintable();\n\t\t return hasNextByte();\n\t\t }\n\n\t\t public String next() {\n\t\t if (!hasNext()) throw new NoSuchElementException();\n\t\t StringBuilder sb = new StringBuilder();\n\t\t int b = readByte();\n\t\t while (isPrintableChar(b)) {\n\t\t sb.appendCodePoint(b);\n\t\t b = readByte();\n\t\t }\n\t\t return sb.toString();\n\t\t }\n\n\t\t public long nextLong() {\n\t\t if (!hasNext()) throw new NoSuchElementException();\n\t\t long n = 0;\n\t\t boolean minus = false;\n\t\t int b = readByte();\n\t\t if (b == '-') {\n\t\t minus = true;\n\t\t b = readByte();\n\t\t }\n\t\t if (b < '0' || '9' < b) {\n\t\t throw new NumberFormatException();\n\t\t }\n\t\t while (true) {\n\t\t if ('0' <= b && b <= '9') {\n\t\t n *= 10;\n\t\t n += b - '0';\n\t\t } else if (b == -1 || !isPrintableChar(b)) {\n\t\t return minus ? -n : n;\n\t\t } else {\n\t\t throw new NumberFormatException();\n\t\t }\n\t\t b = readByte();\n\t\t }\n\t\t }\n\n\t\t public int nextInt() {\n\t\t return (int) nextLong();\n\t\t }\n\t\t \n\t\t public double nextDouble(){\n\t\t \treturn Double.parseDouble(next());\n\t\t }\n\n\t\t public int[] nextIntArray(int N, boolean oneBased) {\n\t\t if (oneBased) {\n\t\t int[] array = new int[N + 1];\n\t\t for (int i = 1; i <= N; i++) {\n\t\t array[i] = sc.nextInt();\n\t\t }\n\t\t return array;\n\t\t } else {\n\t\t int[] array = new int[N];\n\t\t for (int i = 0; i < N; i++) {\n\t\t array[i] = sc.nextInt();\n\t\t }\n\t\t return array;\n\t\t }\n\t\t }\n\n\t\t public long[] nextLongArray(int N, boolean oneBased) {\n\t\t if (oneBased) {\n\t\t long[] array = new long[N + 1];\n\t\t for (int i = 1; i <= N; i++) {\n\t\t array[i] = sc.nextLong();\n\t\t }\n\t\t return array;\n\t\t } else {\n\t\t long[] array = new long[N];\n\t\t for (int i = 0; i < N; i++) {\n\t\t array[i] = sc.nextLong();\n\t\t }\n\t\t return array;\n\t\t }\n\t\t }\n\t\t }\n\n\t\t}",
"public class Main{\n\tstatic FastScanner sc = new FastScanner();\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\tstatic int n;\n\tstatic String s;\n\t//static Queue <Long> q = new ArrayDeque <Long>();\n\t//static List<ArrayList<Integer>> e;\n\t//static LinkedList<Integer> adj[]; \n\t\n\tstatic final long lim = 1_000_000_000_000_000_000L;\n\n\tpublic static void main(String[] args) {\n\t\tn = sc.nextInt();\n\t\t\n\t\tlong a [] = sc.nextLongArray(n, false);\n\t\t\n\t\tArrays.sort(a);\n\t\t\n\t\tif (a[0]==0)\n\t\t\tout.println(0);\n\t\t\n\t\telse {\n\t\t\tlong A = a[0];\n\t\t\tboolean ok = true;\n\t\t\tfor (int i=1; i<n; i++) {\n\t\t\t\tlong cur = a[i];\n\t\t\t\t\n\t\t\t\tif (cur<=lim/A) {\n\t\t\t\t\tA*=cur;\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse {\n\t\t\t\t\tok = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif (ok)\n\t\t\t\tout.println(A);\n\t\t\t\n\t\t\telse\n\t\t\t\tout.println(-1);\n\t\t}\n\t\tout.flush();\n\t}\n\t\n\t\n\t\n\t\tstatic class FastScanner {\n\t\t private final InputStream in = System.in;\n\t\t private final byte[] buffer = new byte[1024];\n\t\t private int ptr = 0;\n\t\t private int buflen = 0;\n\n\t\t private boolean hasNextByte() {\n\t\t if (ptr < buflen) {\n\t\t return true;\n\t\t } else {\n\t\t ptr = 0;\n\t\t try {\n\t\t buflen = in.read(buffer);\n\t\t } catch (IOException e) {\n\t\t e.printStackTrace();\n\t\t }\n\t\t if (buflen <= 0) {\n\t\t return false;\n\t\t }\n\t\t }\n\t\t return true;\n\t\t }\n\n\t\t private int readByte() {\n\t\t if (hasNextByte()) return buffer[ptr++];\n\t\t else return -1;\n\t\t }\n\n\t\t private static boolean isPrintableChar(int c) {\n\t\t return 33 <= c && c <= 126;\n\t\t }\n\n\t\t private void skipUnprintable() {\n\t\t while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n\t\t }\n\n\t\t public boolean hasNext() {\n\t\t skipUnprintable();\n\t\t return hasNextByte();\n\t\t }\n\n\t\t public String next() {\n\t\t if (!hasNext()) throw new NoSuchElementException();\n\t\t StringBuilder sb = new StringBuilder();\n\t\t int b = readByte();\n\t\t while (isPrintableChar(b)) {\n\t\t sb.appendCodePoint(b);\n\t\t b = readByte();\n\t\t }\n\t\t return sb.toString();\n\t\t }\n\n\t\t public long nextLong() {\n\t\t if (!hasNext()) throw new NoSuchElementException();\n\t\t long n = 0;\n\t\t boolean minus = false;\n\t\t int b = readByte();\n\t\t if (b == '-') {\n\t\t minus = true;\n\t\t b = readByte();\n\t\t }\n\t\t if (b < '0' || '9' < b) {\n\t\t throw new NumberFormatException();\n\t\t }\n\t\t while (true) {\n\t\t if ('0' <= b && b <= '9') {\n\t\t n *= 10;\n\t\t n += b - '0';\n\t\t } else if (b == -1 || !isPrintableChar(b)) {\n\t\t return minus ? -n : n;\n\t\t } else {\n\t\t throw new NumberFormatException();\n\t\t }\n\t\t b = readByte();\n\t\t }\n\t\t }\n\n\t\t public int nextInt() {\n\t\t return (int) nextLong();\n\t\t }\n\t\t \n\t\t public double nextDouble(){\n\t\t \treturn Double.parseDouble(next());\n\t\t }\n\n\t\t public int[] nextIntArray(int N, boolean oneBased) {\n\t\t if (oneBased) {\n\t\t int[] array = new int[N + 1];\n\t\t for (int i = 1; i <= N; i++) {\n\t\t array[i] = sc.nextInt();\n\t\t }\n\t\t return array;\n\t\t } else {\n\t\t int[] array = new int[N];\n\t\t for (int i = 0; i < N; i++) {\n\t\t array[i] = sc.nextInt();\n\t\t }\n\t\t return array;\n\t\t }\n\t\t }\n\n\t\t public long[] nextLongArray(int N, boolean oneBased) {\n\t\t if (oneBased) {\n\t\t long[] array = new long[N + 1];\n\t\t for (int i = 1; i <= N; i++) {\n\t\t array[i] = sc.nextLong();\n\t\t }\n\t\t return array;\n\t\t } else {\n\t\t long[] array = new long[N];\n\t\t for (int i = 0; i < N; i++) {\n\t\t array[i] = sc.nextLong();\n\t\t }\n\t\t return array;\n\t\t }\n\t\t }\n\t\t }\n\n\t\t}",
"Main"
] |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;
public class Main{
static FastScanner sc = new FastScanner();
static PrintWriter out = new PrintWriter(System.out);
static int n;
static String s;
//static Queue <Long> q = new ArrayDeque <Long>();
//static List<ArrayList<Integer>> e;
//static LinkedList<Integer> adj[];
static final long lim = 1_000_000_000_000_000_000L;
public static void main(String[] args) {
n = sc.nextInt();
long a [] = sc.nextLongArray(n, false);
Arrays.sort(a);
if (a[0]==0)
out.println(0);
else {
long A = a[0];
boolean ok = true;
for (int i=1; i<n; i++) {
long cur = a[i];
if (cur<=lim/A) {
A*=cur;
}
else {
ok = false;
break;
}
}
if (ok)
out.println(A);
else
out.println(-1);
}
out.flush();
}
static class FastScanner {
private final InputStream in = System.in;
private final byte[] buffer = new byte[1024];
private int ptr = 0;
private int buflen = 0;
private boolean hasNextByte() {
if (ptr < buflen) {
return true;
} else {
ptr = 0;
try {
buflen = in.read(buffer);
} catch (IOException e) {
e.printStackTrace();
}
if (buflen <= 0) {
return false;
}
}
return true;
}
private int readByte() {
if (hasNextByte()) return buffer[ptr++];
else return -1;
}
private static boolean isPrintableChar(int c) {
return 33 <= c && c <= 126;
}
private void skipUnprintable() {
while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
}
public boolean hasNext() {
skipUnprintable();
return hasNextByte();
}
public String next() {
if (!hasNext()) throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int b = readByte();
while (isPrintableChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public long nextLong() {
if (!hasNext()) throw new NoSuchElementException();
long n = 0;
boolean minus = false;
int b = readByte();
if (b == '-') {
minus = true;
b = readByte();
}
if (b < '0' || '9' < b) {
throw new NumberFormatException();
}
while (true) {
if ('0' <= b && b <= '9') {
n *= 10;
n += b - '0';
} else if (b == -1 || !isPrintableChar(b)) {
return minus ? -n : n;
} else {
throw new NumberFormatException();
}
b = readByte();
}
}
public int nextInt() {
return (int) nextLong();
}
public double nextDouble(){
return Double.parseDouble(next());
}
public int[] nextIntArray(int N, boolean oneBased) {
if (oneBased) {
int[] array = new int[N + 1];
for (int i = 1; i <= N; i++) {
array[i] = sc.nextInt();
}
return array;
} else {
int[] array = new int[N];
for (int i = 0; i < N; i++) {
array[i] = sc.nextInt();
}
return array;
}
}
public long[] nextLongArray(int N, boolean oneBased) {
if (oneBased) {
long[] array = new long[N + 1];
for (int i = 1; i <= N; i++) {
array[i] = sc.nextLong();
}
return array;
} else {
long[] array = new long[N];
for (int i = 0; i < N; i++) {
array[i] = sc.nextLong();
}
return array;
}
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
0,
13,
17,
3,
14,
2,
2,
13,
40,
17,
2,
2,
13,
13,
13,
30,
0,
13,
13,
30,
0,
13,
40,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
79,
5
],
[
79,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
35,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
41,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
35,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
51,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
50,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
50,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
8,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
70,
75
],
[
6,
76
],
[
76,
77
],
[
0,
78
],
[
78,
79
],
[
78,
80
]
] |
[
"import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n long result = 1;\n long max = 1000000000000000000L;\n for (int i = 0 ; i < N ; i++) {\n long a = scanner.nextLong();\n if (a == 0) {\n result = 0;\n break;\n }\n if (result != -1 && max / result >= a) {\n result *= a;\n } else {\n result = -1;\n }\n }\n \n System.out.println(result);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n long result = 1;\n long max = 1000000000000000000L;\n for (int i = 0 ; i < N ; i++) {\n long a = scanner.nextLong();\n if (a == 0) {\n result = 0;\n break;\n }\n if (result != -1 && max / result >= a) {\n result *= a;\n } else {\n result = -1;\n }\n }\n \n System.out.println(result);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n long result = 1;\n long max = 1000000000000000000L;\n for (int i = 0 ; i < N ; i++) {\n long a = scanner.nextLong();\n if (a == 0) {\n result = 0;\n break;\n }\n if (result != -1 && max / result >= a) {\n result *= a;\n } else {\n result = -1;\n }\n }\n \n System.out.println(result);\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n long result = 1;\n long max = 1000000000000000000L;\n for (int i = 0 ; i < N ; i++) {\n long a = scanner.nextLong();\n if (a == 0) {\n result = 0;\n break;\n }\n if (result != -1 && max / result >= a) {\n result *= a;\n } else {\n result = -1;\n }\n }\n \n System.out.println(result);\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int N = scanner.nextInt();",
"N",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"long result = 1;",
"result",
"1",
"long max = 1000000000000000000L;",
"max",
"1000000000000000000L",
"for (int i = 0 ; i < N ; i++) {\n long a = scanner.nextLong();\n if (a == 0) {\n result = 0;\n break;\n }\n if (result != -1 && max / result >= a) {\n result *= a;\n } else {\n result = -1;\n }\n }",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n long a = scanner.nextLong();\n if (a == 0) {\n result = 0;\n break;\n }\n if (result != -1 && max / result >= a) {\n result *= a;\n } else {\n result = -1;\n }\n }",
"{\n long a = scanner.nextLong();\n if (a == 0) {\n result = 0;\n break;\n }\n if (result != -1 && max / result >= a) {\n result *= a;\n } else {\n result = -1;\n }\n }",
"long a = scanner.nextLong();",
"a",
"scanner.nextLong()",
"scanner.nextLong",
"scanner",
"if (a == 0) {\n result = 0;\n break;\n }",
"a == 0",
"a",
"0",
"{\n result = 0;\n break;\n }",
"result = 0",
"result",
"0",
"break;",
"if (result != -1 && max / result >= a) {\n result *= a;\n } else {\n result = -1;\n }",
"result != -1 && max / result >= a",
"result != -1",
"result",
"-1",
"1",
"max / result >= a",
"max / result",
"max",
"result",
"a",
"{\n result *= a;\n }",
"result *= a",
"result",
"a",
"{\n result = -1;\n }",
"result = -1",
"result",
"-1",
"1",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n long result = 1;\n long max = 1000000000000000000L;\n for (int i = 0 ; i < N ; i++) {\n long a = scanner.nextLong();\n if (a == 0) {\n result = 0;\n break;\n }\n if (result != -1 && max / result >= a) {\n result *= a;\n } else {\n result = -1;\n }\n }\n \n System.out.println(result);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n long result = 1;\n long max = 1000000000000000000L;\n for (int i = 0 ; i < N ; i++) {\n long a = scanner.nextLong();\n if (a == 0) {\n result = 0;\n break;\n }\n if (result != -1 && max / result >= a) {\n result *= a;\n } else {\n result = -1;\n }\n }\n \n System.out.println(result);\n }\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
long result = 1;
long max = 1000000000000000000L;
for (int i = 0 ; i < N ; i++) {
long a = scanner.nextLong();
if (a == 0) {
result = 0;
break;
}
if (result != -1 && max / result >= a) {
result *= a;
} else {
result = -1;
}
}
System.out.println(result);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
14,
2,
2,
13,
17,
2,
13,
17,
29,
17,
41,
13,
2,
13,
13,
14,
2,
13,
2,
13,
13,
29,
17,
29,
17,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
0,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
4,
18,
13,
13,
14,
2,
18,
13,
17,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
4,
18,
13,
17,
0,
13,
18,
13,
13,
14,
2,
13,
4,
18,
13,
17,
17,
30,
4,
18,
18,
13,
13,
40,
17,
4,
18,
18,
13,
13,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
29,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
25,
26
],
[
25,
27
],
[
0,
28
],
[
28,
29
],
[
28,
30
],
[
0,
31
],
[
303,
32
],
[
303,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
36,
41
],
[
33,
42
],
[
42,
43
],
[
303,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
47,
52
],
[
44,
53
],
[
53,
54
],
[
303,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
63,
64
],
[
63,
65
],
[
58,
66
],
[
66,
67
],
[
57,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
70,
72
],
[
57,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
76,
78
],
[
73,
79
],
[
79,
80
],
[
73,
81
],
[
81,
82
],
[
55,
83
],
[
83,
84
],
[
55,
85
],
[
85,
86
],
[
303,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
93,
94
],
[
93,
95
],
[
89,
96
],
[
96,
97
],
[
89,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
101,
102
],
[
89,
103
],
[
103,
104
],
[
103,
105
],
[
89,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
112,
113
],
[
112,
114
],
[
107,
115
],
[
115,
116
],
[
116,
117
],
[
107,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
123,
124
],
[
124,
125
],
[
89,
126
],
[
126,
127
],
[
126,
128
],
[
89,
129
],
[
129,
130
],
[
129,
131
],
[
89,
132
],
[
132,
133
],
[
133,
134
],
[
132,
135
],
[
89,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
136,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
143,
148
],
[
142,
149
],
[
149,
150
],
[
150,
151
],
[
149,
152
],
[
89,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
153,
158
],
[
158,
159
],
[
158,
160
],
[
153,
161
],
[
161,
162
],
[
162,
163
],
[
153,
164
],
[
165,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
167,
170
],
[
170,
171
],
[
170,
172
],
[
166,
173
],
[
173,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
174,
179
],
[
179,
180
],
[
173,
181
],
[
181,
182
],
[
182,
183
],
[
181,
184
],
[
165,
185
],
[
185,
186
],
[
185,
187
],
[
187,
188
],
[
187,
189
],
[
89,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
194,
195
],
[
193,
196
],
[
193,
197
],
[
190,
198
],
[
198,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
201,
203
],
[
199,
204
],
[
204,
205
],
[
190,
206
],
[
206,
207
],
[
207,
208
],
[
208,
209
],
[
208,
210
],
[
206,
211
],
[
87,
212
],
[
212,
213
],
[
303,
214
],
[
214,
215
],
[
214,
216
],
[
216,
217
],
[
214,
218
],
[
218,
219
],
[
214,
220
],
[
220,
221
],
[
220,
222
],
[
222,
223
],
[
223,
224
],
[
223,
225
],
[
214,
226
],
[
226,
227
],
[
226,
228
],
[
228,
229
],
[
229,
230
],
[
230,
231
],
[
231,
232
],
[
231,
233
],
[
230,
234
],
[
234,
235
],
[
235,
236
],
[
236,
237
],
[
229,
238
],
[
238,
239
],
[
239,
240
],
[
240,
241
],
[
240,
242
],
[
242,
243
],
[
243,
244
],
[
244,
245
],
[
239,
246
],
[
246,
247
],
[
247,
248
],
[
247,
249
],
[
228,
250
],
[
250,
251
],
[
251,
252
],
[
252,
253
],
[
214,
254
],
[
254,
255
],
[
254,
256
],
[
256,
257
],
[
257,
258
],
[
258,
259
],
[
259,
260
],
[
258,
261
],
[
261,
262
],
[
214,
263
],
[
263,
264
],
[
263,
265
],
[
265,
266
],
[
266,
267
],
[
267,
268
],
[
268,
269
],
[
267,
270
],
[
270,
271
],
[
214,
272
],
[
272,
273
],
[
272,
274
],
[
274,
275
],
[
275,
276
],
[
276,
277
],
[
277,
278
],
[
276,
279
],
[
279,
280
],
[
214,
281
],
[
281,
282
],
[
281,
283
],
[
283,
284
],
[
284,
285
],
[
284,
286
],
[
283,
287
],
[
287,
288
],
[
288,
289
],
[
288,
290
],
[
290,
291
],
[
291,
292
],
[
292,
293
],
[
287,
294
],
[
294,
295
],
[
295,
296
],
[
295,
297
],
[
297,
298
],
[
298,
299
],
[
283,
300
],
[
300,
301
],
[
0,
302
],
[
302,
303
],
[
302,
304
]
] |
[
"//package MyJavaProject;\n \nimport java.util.*;\nimport java.io.BufferedReader;\nimport java.io.IOException; \nimport java.io.InputStreamReader;\nimport java.lang.Math;\nimport java.util.concurrent.TimeUnit;\nimport java.util.stream.Collectors;\nimport java.io.*;\nimport java.math.BigInteger; \nimport java.io.PrintWriter; \n\npublic class Main \n{\n\tstatic class FastReader \n\n\t { \n\t BufferedReader br; \n\t StringTokenizer st; \n\t \n\t public FastReader() \n\t { \n\t br = new BufferedReader(new\n\t InputStreamReader(System.in)); \n\t } \n\t \n\t String next() \n\t { \n\t while (st == null || !st.hasMoreElements()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t } \n\t return st.nextToken(); \n\t } \n\t \n\t int nextInt() \n\t { \n\t return Integer.parseInt(next()); \n\t } \n\t \n\t long nextLong() \n\t { \n\t return Long.parseLong(next()); \n\t } \n\t \n\t double nextDouble() \n\t { \n\t return Double.parseDouble(next()); \n\t } \n\t \n\t String nextLine() \n\t { \n\t String str = \"\"; \n\t try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t } \n\t }\n\t\n\t\n\tstatic void print(String s)\n\t{\n\t\tSystem.out.print(s);\n\t}\n\tstatic void print(boolean s)\n\t{\n\t\tSystem.out.print(s);\n\t}\n\tstatic Boolean isOverflow( long a, long b) \n { \n // Check if either of them is zero \n if (a == 0 || b == 0) \n return false; \n \n long result = a * b; \n if (a == result / b) \n return false; \n else\n return true; \n } \n\tpublic static void main(String args[]) throws Exception\n\t{\n\t\tFastReader f=new FastReader();\n\t\tBufferedWriter w=new BufferedWriter(new OutputStreamWriter(System.out));\n\t\t \n\t\t\n\t\t\n\t\t\tint n;\n\t\t\tn=f.nextInt();\n\t\t\tlong a[]=new long[n];\n\t\t\tfor(int i=0;i<n;i++)\n\t\t\t\ta[i]=f.nextLong();\n\t\t\tlong p=1;\n\t\t\tint c=0;\n \t\tArrays.sort(a);\n \t\tif(a[0]==0)\n {\n System.out.println(0);\n System.exit(0);\n }\n\t\t\t//BigInteger p=new BigInteger(\"1\");\n\t\t\t//BigInteger big=new BigInteger(\"1000000000000000000\");\n\t\t\tfor(int i=0;i<n;i++)\n\t\t\t{\n\t\t\t\tif(isOverflow(p,a[i]))\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\t\t\t\tp*=a[i];\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif(p>(long)(Math.pow(100, 9)))\n\t\t\t{\tSystem.out.println(-1);\n\t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t\t\n\t\t\tSystem.out.println(p);\n\t\t\t\n\t\t\n\t}\n}\n\t\n\n\t\n\t\n\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t",
"import java.util.*;",
"util.*",
"java",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.lang.Math;",
"Math",
"java.lang",
"import java.util.concurrent.TimeUnit;",
"TimeUnit",
"java.util.concurrent",
"import java.util.stream.Collectors;",
"Collectors",
"java.util.stream",
"import java.io.*;",
"io.*",
"java",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"public class Main \n{\n\tstatic class FastReader \n\n\t { \n\t BufferedReader br; \n\t StringTokenizer st; \n\t \n\t public FastReader() \n\t { \n\t br = new BufferedReader(new\n\t InputStreamReader(System.in)); \n\t } \n\t \n\t String next() \n\t { \n\t while (st == null || !st.hasMoreElements()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t } \n\t return st.nextToken(); \n\t } \n\t \n\t int nextInt() \n\t { \n\t return Integer.parseInt(next()); \n\t } \n\t \n\t long nextLong() \n\t { \n\t return Long.parseLong(next()); \n\t } \n\t \n\t double nextDouble() \n\t { \n\t return Double.parseDouble(next()); \n\t } \n\t \n\t String nextLine() \n\t { \n\t String str = \"\"; \n\t try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t } \n\t }\n\t\n\t\n\tstatic void print(String s)\n\t{\n\t\tSystem.out.print(s);\n\t}\n\tstatic void print(boolean s)\n\t{\n\t\tSystem.out.print(s);\n\t}\n\tstatic Boolean isOverflow( long a, long b) \n { \n // Check if either of them is zero \n if (a == 0 || b == 0) \n return false; \n \n long result = a * b; \n if (a == result / b) \n return false; \n else\n return true; \n } \n\tpublic static void main(String args[]) throws Exception\n\t{\n\t\tFastReader f=new FastReader();\n\t\tBufferedWriter w=new BufferedWriter(new OutputStreamWriter(System.out));\n\t\t \n\t\t\n\t\t\n\t\t\tint n;\n\t\t\tn=f.nextInt();\n\t\t\tlong a[]=new long[n];\n\t\t\tfor(int i=0;i<n;i++)\n\t\t\t\ta[i]=f.nextLong();\n\t\t\tlong p=1;\n\t\t\tint c=0;\n \t\tArrays.sort(a);\n \t\tif(a[0]==0)\n {\n System.out.println(0);\n System.exit(0);\n }\n\t\t\t//BigInteger p=new BigInteger(\"1\");\n\t\t\t//BigInteger big=new BigInteger(\"1000000000000000000\");\n\t\t\tfor(int i=0;i<n;i++)\n\t\t\t{\n\t\t\t\tif(isOverflow(p,a[i]))\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\t\t\t\tp*=a[i];\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif(p>(long)(Math.pow(100, 9)))\n\t\t\t{\tSystem.out.println(-1);\n\t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t\t\n\t\t\tSystem.out.println(p);\n\t\t\t\n\t\t\n\t}\n}",
"Main",
"static void print(String s)\n\t{\n\t\tSystem.out.print(s);\n\t}",
"print",
"{\n\t\tSystem.out.print(s);\n\t}",
"System.out.print(s)",
"System.out.print",
"System.out",
"System",
"System.out",
"s",
"String s",
"s",
"static void print(boolean s)\n\t{\n\t\tSystem.out.print(s);\n\t}",
"print",
"{\n\t\tSystem.out.print(s);\n\t}",
"System.out.print(s)",
"System.out.print",
"System.out",
"System",
"System.out",
"s",
"boolean s",
"s",
"static Boolean isOverflow( long a, long b) \n { \n // Check if either of them is zero \n if (a == 0 || b == 0) \n return false; \n \n long result = a * b; \n if (a == result / b) \n return false; \n else\n return true; \n }",
"isOverflow",
"{ \n // Check if either of them is zero \n if (a == 0 || b == 0) \n return false; \n \n long result = a * b; \n if (a == result / b) \n return false; \n else\n return true; \n }",
"if (a == 0 || b == 0) \n return false;",
"a == 0 || b == 0",
"a == 0",
"a",
"0",
"b == 0",
"b",
"0",
"return false;",
"false",
"long result = a * b;",
"result",
"a * b",
"a",
"b",
"if (a == result / b) \n return false; \n else\n return true;",
"a == result / b",
"a",
"result / b",
"result",
"b",
"return false;",
"false",
"return true;",
"true",
"long a",
"a",
"long b",
"b",
"public static void main(String args[]) throws Exception\n\t{\n\t\tFastReader f=new FastReader();\n\t\tBufferedWriter w=new BufferedWriter(new OutputStreamWriter(System.out));\n\t\t \n\t\t\n\t\t\n\t\t\tint n;\n\t\t\tn=f.nextInt();\n\t\t\tlong a[]=new long[n];\n\t\t\tfor(int i=0;i<n;i++)\n\t\t\t\ta[i]=f.nextLong();\n\t\t\tlong p=1;\n\t\t\tint c=0;\n \t\tArrays.sort(a);\n \t\tif(a[0]==0)\n {\n System.out.println(0);\n System.exit(0);\n }\n\t\t\t//BigInteger p=new BigInteger(\"1\");\n\t\t\t//BigInteger big=new BigInteger(\"1000000000000000000\");\n\t\t\tfor(int i=0;i<n;i++)\n\t\t\t{\n\t\t\t\tif(isOverflow(p,a[i]))\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\t\t\t\tp*=a[i];\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif(p>(long)(Math.pow(100, 9)))\n\t\t\t{\tSystem.out.println(-1);\n\t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t\t\n\t\t\tSystem.out.println(p);\n\t\t\t\n\t\t\n\t}",
"main",
"{\n\t\tFastReader f=new FastReader();\n\t\tBufferedWriter w=new BufferedWriter(new OutputStreamWriter(System.out));\n\t\t \n\t\t\n\t\t\n\t\t\tint n;\n\t\t\tn=f.nextInt();\n\t\t\tlong a[]=new long[n];\n\t\t\tfor(int i=0;i<n;i++)\n\t\t\t\ta[i]=f.nextLong();\n\t\t\tlong p=1;\n\t\t\tint c=0;\n \t\tArrays.sort(a);\n \t\tif(a[0]==0)\n {\n System.out.println(0);\n System.exit(0);\n }\n\t\t\t//BigInteger p=new BigInteger(\"1\");\n\t\t\t//BigInteger big=new BigInteger(\"1000000000000000000\");\n\t\t\tfor(int i=0;i<n;i++)\n\t\t\t{\n\t\t\t\tif(isOverflow(p,a[i]))\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\t\t\t\tp*=a[i];\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif(p>(long)(Math.pow(100, 9)))\n\t\t\t{\tSystem.out.println(-1);\n\t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t\t\n\t\t\tSystem.out.println(p);\n\t\t\t\n\t\t\n\t}",
"FastReader f=new FastReader();",
"f",
"new FastReader()",
"BufferedWriter w=new BufferedWriter(new OutputStreamWriter(System.out));",
"w",
"new BufferedWriter(new OutputStreamWriter(System.out))",
"int n;",
"n",
"n=f.nextInt()",
"n",
"f.nextInt()",
"f.nextInt",
"f",
"long a[]=new long[n];",
"a",
"new long[n]",
"n",
"for(int i=0;i<n;i++)\n\t\t\t\ta[i]=f.nextLong();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"a[i]=f.nextLong();",
"a[i]=f.nextLong()",
"a[i]",
"a",
"i",
"f.nextLong()",
"f.nextLong",
"f",
"long p=1;",
"p",
"1",
"int c=0;",
"c",
"0",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"if(a[0]==0)\n {\n System.out.println(0);\n System.exit(0);\n }",
"a[0]==0",
"a[0]",
"a",
"0",
"0",
"{\n System.out.println(0);\n System.exit(0);\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"System.exit(0)",
"System.exit",
"System",
"0",
"for(int i=0;i<n;i++)\n\t\t\t{\n\t\t\t\tif(isOverflow(p,a[i]))\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\t\t\t\tp*=a[i];\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tif(isOverflow(p,a[i]))\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\t\t\t\tp*=a[i];\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t}",
"{\n\t\t\t\tif(isOverflow(p,a[i]))\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\t\t\t\tp*=a[i];\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t}",
"if(isOverflow(p,a[i]))\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}",
"isOverflow(p,a[i])",
"isOverflow",
"p",
"a[i]",
"a",
"i",
"{\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"System.exit(0)",
"System.exit",
"System",
"0",
"p*=a[i]",
"p",
"a[i]",
"a",
"i",
"if(p>(long)(Math.pow(100, 9)))\n\t\t\t{\tSystem.out.println(-1);\n\t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t\t\n\t\t\tSystem.out.println(p);",
"p>(long)(Math.pow(100, 9))",
"p",
"(long)(Math.pow(100, 9))",
"Math.pow",
"Math",
"100",
"9",
"{\tSystem.out.println(-1);\n\t\t\t\n\t\t\t}",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"System.out.println(p)",
"System.out.println",
"System.out",
"System",
"System.out",
"p",
"String args[]",
"args",
"static class FastReader \n\n\t { \n\t BufferedReader br; \n\t StringTokenizer st; \n\t \n\t public FastReader() \n\t { \n\t br = new BufferedReader(new\n\t InputStreamReader(System.in)); \n\t } \n\t \n\t String next() \n\t { \n\t while (st == null || !st.hasMoreElements()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t } \n\t return st.nextToken(); \n\t } \n\t \n\t int nextInt() \n\t { \n\t return Integer.parseInt(next()); \n\t } \n\t \n\t long nextLong() \n\t { \n\t return Long.parseLong(next()); \n\t } \n\t \n\t double nextDouble() \n\t { \n\t return Double.parseDouble(next()); \n\t } \n\t \n\t String nextLine() \n\t { \n\t String str = \"\"; \n\t try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t } \n\t }",
"FastReader",
"BufferedReader br;",
"br",
"StringTokenizer st;",
"st",
"public FastReader() \n\t { \n\t br = new BufferedReader(new\n\t InputStreamReader(System.in)); \n\t }",
"FastReader",
"{ \n\t br = new BufferedReader(new\n\t InputStreamReader(System.in)); \n\t }",
"br = new BufferedReader(new\n\t InputStreamReader(System.in))",
"br",
"new BufferedReader(new\n\t InputStreamReader(System.in))",
"String next() \n\t { \n\t while (st == null || !st.hasMoreElements()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t } \n\t return st.nextToken(); \n\t }",
"next",
"{ \n\t while (st == null || !st.hasMoreElements()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t } \n\t return st.nextToken(); \n\t }",
"while (st == null || !st.hasMoreElements()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t }",
"st == null || !st.hasMoreElements()",
"st == null",
"st",
"null",
"!st.hasMoreElements()",
"st.hasMoreElements()",
"st.hasMoreElements",
"st",
"{ \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t }",
"try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t }",
"catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t }",
"IOException e",
"{ \n\t e.printStackTrace(); \n\t }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{ \n\t st = new StringTokenizer(br.readLine()); \n\t }",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"int nextInt() \n\t { \n\t return Integer.parseInt(next()); \n\t }",
"nextInt",
"{ \n\t return Integer.parseInt(next()); \n\t }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"long nextLong() \n\t { \n\t return Long.parseLong(next()); \n\t }",
"nextLong",
"{ \n\t return Long.parseLong(next()); \n\t }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"double nextDouble() \n\t { \n\t return Double.parseDouble(next()); \n\t }",
"nextDouble",
"{ \n\t return Double.parseDouble(next()); \n\t }",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"String nextLine() \n\t { \n\t String str = \"\"; \n\t try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t }",
"nextLine",
"{ \n\t String str = \"\"; \n\t try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t }",
"String str = \"\";",
"str",
"\"\"",
"try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t }",
"catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t }",
"IOException e",
"{ \n\t e.printStackTrace(); \n\t }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{ \n\t str = br.readLine(); \n\t }",
"str = br.readLine()",
"str",
"br.readLine()",
"br.readLine",
"br",
"return str;",
"str",
"public class Main \n{\n\tstatic class FastReader \n\n\t { \n\t BufferedReader br; \n\t StringTokenizer st; \n\t \n\t public FastReader() \n\t { \n\t br = new BufferedReader(new\n\t InputStreamReader(System.in)); \n\t } \n\t \n\t String next() \n\t { \n\t while (st == null || !st.hasMoreElements()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t } \n\t return st.nextToken(); \n\t } \n\t \n\t int nextInt() \n\t { \n\t return Integer.parseInt(next()); \n\t } \n\t \n\t long nextLong() \n\t { \n\t return Long.parseLong(next()); \n\t } \n\t \n\t double nextDouble() \n\t { \n\t return Double.parseDouble(next()); \n\t } \n\t \n\t String nextLine() \n\t { \n\t String str = \"\"; \n\t try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t } \n\t }\n\t\n\t\n\tstatic void print(String s)\n\t{\n\t\tSystem.out.print(s);\n\t}\n\tstatic void print(boolean s)\n\t{\n\t\tSystem.out.print(s);\n\t}\n\tstatic Boolean isOverflow( long a, long b) \n { \n // Check if either of them is zero \n if (a == 0 || b == 0) \n return false; \n \n long result = a * b; \n if (a == result / b) \n return false; \n else\n return true; \n } \n\tpublic static void main(String args[]) throws Exception\n\t{\n\t\tFastReader f=new FastReader();\n\t\tBufferedWriter w=new BufferedWriter(new OutputStreamWriter(System.out));\n\t\t \n\t\t\n\t\t\n\t\t\tint n;\n\t\t\tn=f.nextInt();\n\t\t\tlong a[]=new long[n];\n\t\t\tfor(int i=0;i<n;i++)\n\t\t\t\ta[i]=f.nextLong();\n\t\t\tlong p=1;\n\t\t\tint c=0;\n \t\tArrays.sort(a);\n \t\tif(a[0]==0)\n {\n System.out.println(0);\n System.exit(0);\n }\n\t\t\t//BigInteger p=new BigInteger(\"1\");\n\t\t\t//BigInteger big=new BigInteger(\"1000000000000000000\");\n\t\t\tfor(int i=0;i<n;i++)\n\t\t\t{\n\t\t\t\tif(isOverflow(p,a[i]))\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\t\t\t\tp*=a[i];\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif(p>(long)(Math.pow(100, 9)))\n\t\t\t{\tSystem.out.println(-1);\n\t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t\t\n\t\t\tSystem.out.println(p);\n\t\t\t\n\t\t\n\t}\n}",
"public class Main \n{\n\tstatic class FastReader \n\n\t { \n\t BufferedReader br; \n\t StringTokenizer st; \n\t \n\t public FastReader() \n\t { \n\t br = new BufferedReader(new\n\t InputStreamReader(System.in)); \n\t } \n\t \n\t String next() \n\t { \n\t while (st == null || !st.hasMoreElements()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t } \n\t return st.nextToken(); \n\t } \n\t \n\t int nextInt() \n\t { \n\t return Integer.parseInt(next()); \n\t } \n\t \n\t long nextLong() \n\t { \n\t return Long.parseLong(next()); \n\t } \n\t \n\t double nextDouble() \n\t { \n\t return Double.parseDouble(next()); \n\t } \n\t \n\t String nextLine() \n\t { \n\t String str = \"\"; \n\t try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t } \n\t }\n\t\n\t\n\tstatic void print(String s)\n\t{\n\t\tSystem.out.print(s);\n\t}\n\tstatic void print(boolean s)\n\t{\n\t\tSystem.out.print(s);\n\t}\n\tstatic Boolean isOverflow( long a, long b) \n { \n // Check if either of them is zero \n if (a == 0 || b == 0) \n return false; \n \n long result = a * b; \n if (a == result / b) \n return false; \n else\n return true; \n } \n\tpublic static void main(String args[]) throws Exception\n\t{\n\t\tFastReader f=new FastReader();\n\t\tBufferedWriter w=new BufferedWriter(new OutputStreamWriter(System.out));\n\t\t \n\t\t\n\t\t\n\t\t\tint n;\n\t\t\tn=f.nextInt();\n\t\t\tlong a[]=new long[n];\n\t\t\tfor(int i=0;i<n;i++)\n\t\t\t\ta[i]=f.nextLong();\n\t\t\tlong p=1;\n\t\t\tint c=0;\n \t\tArrays.sort(a);\n \t\tif(a[0]==0)\n {\n System.out.println(0);\n System.exit(0);\n }\n\t\t\t//BigInteger p=new BigInteger(\"1\");\n\t\t\t//BigInteger big=new BigInteger(\"1000000000000000000\");\n\t\t\tfor(int i=0;i<n;i++)\n\t\t\t{\n\t\t\t\tif(isOverflow(p,a[i]))\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\t\t\t\tp*=a[i];\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif(p>(long)(Math.pow(100, 9)))\n\t\t\t{\tSystem.out.println(-1);\n\t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t\t\n\t\t\tSystem.out.println(p);\n\t\t\t\n\t\t\n\t}\n}",
"Main"
] |
//package MyJavaProject;
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.Math;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.io.*;
import java.math.BigInteger;
import java.io.PrintWriter;
public class Main
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next()
{
while (st == null || !st.hasMoreElements())
{
try
{
st = new StringTokenizer(br.readLine());
}
catch (IOException e)
{
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt()
{
return Integer.parseInt(next());
}
long nextLong()
{
return Long.parseLong(next());
}
double nextDouble()
{
return Double.parseDouble(next());
}
String nextLine()
{
String str = "";
try
{
str = br.readLine();
}
catch (IOException e)
{
e.printStackTrace();
}
return str;
}
}
static void print(String s)
{
System.out.print(s);
}
static void print(boolean s)
{
System.out.print(s);
}
static Boolean isOverflow( long a, long b)
{
// Check if either of them is zero
if (a == 0 || b == 0)
return false;
long result = a * b;
if (a == result / b)
return false;
else
return true;
}
public static void main(String args[]) throws Exception
{
FastReader f=new FastReader();
BufferedWriter w=new BufferedWriter(new OutputStreamWriter(System.out));
int n;
n=f.nextInt();
long a[]=new long[n];
for(int i=0;i<n;i++)
a[i]=f.nextLong();
long p=1;
int c=0;
Arrays.sort(a);
if(a[0]==0)
{
System.out.println(0);
System.exit(0);
}
//BigInteger p=new BigInteger("1");
//BigInteger big=new BigInteger("1000000000000000000");
for(int i=0;i<n;i++)
{
if(isOverflow(p,a[i]))
{
System.out.println(-1);
System.exit(0);
}
p*=a[i];
}
if(p>(long)(Math.pow(100, 9)))
{ System.out.println(-1);
}
else
System.out.println(p);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
41,
13,
18,
13,
13,
28,
13,
13,
30,
30,
0,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
29,
20,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
20,
14,
2,
4,
18,
18,
13,
13,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
4,
18,
18,
13,
13,
4,
18,
4,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
109,
8
],
[
109,
9
],
[
9,
10
],
[
9,
11
],
[
109,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
17,
19
],
[
14,
20
],
[
20,
21
],
[
20,
22
],
[
20,
23
],
[
24,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
27,
30
],
[
24,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
33,
36
],
[
32,
37
],
[
31,
38
],
[
38,
39
],
[
14,
40
],
[
40,
41
],
[
12,
42
],
[
42,
43
],
[
109,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
46,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
46,
55
],
[
55,
56
],
[
55,
57
],
[
46,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
59,
64
],
[
64,
65
],
[
64,
66
],
[
59,
67
],
[
67,
68
],
[
68,
69
],
[
59,
70
],
[
71,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
71,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
79,
84
],
[
84,
85
],
[
84,
86
],
[
78,
87
],
[
77,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
88,
95
],
[
46,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
44,
106
],
[
106,
107
],
[
0,
108
],
[
108,
109
],
[
108,
110
]
] |
[
"import java.math.BigInteger;\nimport java.util.Scanner;\npublic class Main {\n public static final BigInteger MAX_VALUE = new BigInteger(\"1000000000000000000\") ;\n\n public static BigInteger solve(BigInteger [] arr) {\n BigInteger result = BigInteger.ONE;\n for (BigInteger value : arr) {\n\n result = value.multiply(result);\n if (result.compareTo(MAX_VALUE) > 0) return new BigInteger(\"-1\");\n }\n return result;\n }\n public static void main(String[] args) {\n Scanner sn = new Scanner(System.in);\n\n int n = sn.nextInt();\n BigInteger [] arr = new BigInteger[n];\n for(int i = 0; i<n ; i++) {\n arr[i] = new BigInteger(sn.next());\n if(arr[i].compareTo(BigInteger.ZERO) == 0) {\n System.out.println(0);\n return;\n }\n }\n System.out.println(solve(arr).toString());\n }\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static final BigInteger MAX_VALUE = new BigInteger(\"1000000000000000000\") ;\n\n public static BigInteger solve(BigInteger [] arr) {\n BigInteger result = BigInteger.ONE;\n for (BigInteger value : arr) {\n\n result = value.multiply(result);\n if (result.compareTo(MAX_VALUE) > 0) return new BigInteger(\"-1\");\n }\n return result;\n }\n public static void main(String[] args) {\n Scanner sn = new Scanner(System.in);\n\n int n = sn.nextInt();\n BigInteger [] arr = new BigInteger[n];\n for(int i = 0; i<n ; i++) {\n arr[i] = new BigInteger(sn.next());\n if(arr[i].compareTo(BigInteger.ZERO) == 0) {\n System.out.println(0);\n return;\n }\n }\n System.out.println(solve(arr).toString());\n }\n}",
"Main",
"public static final BigInteger MAX_VALUE = new BigInteger(\"1000000000000000000\") ;",
"MAX_VALUE",
"new BigInteger(\"1000000000000000000\")",
"public static BigInteger solve(BigInteger [] arr) {\n BigInteger result = BigInteger.ONE;\n for (BigInteger value : arr) {\n\n result = value.multiply(result);\n if (result.compareTo(MAX_VALUE) > 0) return new BigInteger(\"-1\");\n }\n return result;\n }",
"solve",
"{\n BigInteger result = BigInteger.ONE;\n for (BigInteger value : arr) {\n\n result = value.multiply(result);\n if (result.compareTo(MAX_VALUE) > 0) return new BigInteger(\"-1\");\n }\n return result;\n }",
"BigInteger result = BigInteger.ONE;",
"result",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"for (BigInteger value : arr) {\n\n result = value.multiply(result);\n if (result.compareTo(MAX_VALUE) > 0) return new BigInteger(\"-1\");\n }",
"BigInteger value",
"arr",
"{\n\n result = value.multiply(result);\n if (result.compareTo(MAX_VALUE) > 0) return new BigInteger(\"-1\");\n }",
"{\n\n result = value.multiply(result);\n if (result.compareTo(MAX_VALUE) > 0) return new BigInteger(\"-1\");\n }",
"result = value.multiply(result)",
"result",
"value.multiply(result)",
"value.multiply",
"value",
"result",
"if (result.compareTo(MAX_VALUE) > 0) return new BigInteger(\"-1\");",
"result.compareTo(MAX_VALUE) > 0",
"result.compareTo(MAX_VALUE)",
"result.compareTo",
"result",
"MAX_VALUE",
"0",
"return new BigInteger(\"-1\");",
"new BigInteger(\"-1\")",
"return result;",
"result",
"BigInteger [] arr",
"arr",
"public static void main(String[] args) {\n Scanner sn = new Scanner(System.in);\n\n int n = sn.nextInt();\n BigInteger [] arr = new BigInteger[n];\n for(int i = 0; i<n ; i++) {\n arr[i] = new BigInteger(sn.next());\n if(arr[i].compareTo(BigInteger.ZERO) == 0) {\n System.out.println(0);\n return;\n }\n }\n System.out.println(solve(arr).toString());\n }",
"main",
"{\n Scanner sn = new Scanner(System.in);\n\n int n = sn.nextInt();\n BigInteger [] arr = new BigInteger[n];\n for(int i = 0; i<n ; i++) {\n arr[i] = new BigInteger(sn.next());\n if(arr[i].compareTo(BigInteger.ZERO) == 0) {\n System.out.println(0);\n return;\n }\n }\n System.out.println(solve(arr).toString());\n }",
"Scanner sn = new Scanner(System.in);",
"sn",
"new Scanner(System.in)",
"int n = sn.nextInt();",
"n",
"sn.nextInt()",
"sn.nextInt",
"sn",
"BigInteger [] arr = new BigInteger[n];",
"arr",
"new BigInteger[n]",
"n",
"for(int i = 0; i<n ; i++) {\n arr[i] = new BigInteger(sn.next());\n if(arr[i].compareTo(BigInteger.ZERO) == 0) {\n System.out.println(0);\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n arr[i] = new BigInteger(sn.next());\n if(arr[i].compareTo(BigInteger.ZERO) == 0) {\n System.out.println(0);\n return;\n }\n }",
"{\n arr[i] = new BigInteger(sn.next());\n if(arr[i].compareTo(BigInteger.ZERO) == 0) {\n System.out.println(0);\n return;\n }\n }",
"arr[i] = new BigInteger(sn.next())",
"arr[i]",
"arr",
"i",
"new BigInteger(sn.next())",
"if(arr[i].compareTo(BigInteger.ZERO) == 0) {\n System.out.println(0);\n return;\n }",
"arr[i].compareTo(BigInteger.ZERO) == 0",
"arr[i].compareTo(BigInteger.ZERO)",
"arr[i].compareTo",
"arr[i]",
"arr",
"i",
"BigInteger.ZERO",
"BigInteger",
"BigInteger.ZERO",
"0",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"System.out.println(solve(arr).toString())",
"System.out.println",
"System.out",
"System",
"System.out",
"solve(arr).toString()",
"solve(arr).toString",
"solve(arr)",
"solve",
"arr",
"String[] args",
"args",
"public class Main {\n public static final BigInteger MAX_VALUE = new BigInteger(\"1000000000000000000\") ;\n\n public static BigInteger solve(BigInteger [] arr) {\n BigInteger result = BigInteger.ONE;\n for (BigInteger value : arr) {\n\n result = value.multiply(result);\n if (result.compareTo(MAX_VALUE) > 0) return new BigInteger(\"-1\");\n }\n return result;\n }\n public static void main(String[] args) {\n Scanner sn = new Scanner(System.in);\n\n int n = sn.nextInt();\n BigInteger [] arr = new BigInteger[n];\n for(int i = 0; i<n ; i++) {\n arr[i] = new BigInteger(sn.next());\n if(arr[i].compareTo(BigInteger.ZERO) == 0) {\n System.out.println(0);\n return;\n }\n }\n System.out.println(solve(arr).toString());\n }\n}",
"public class Main {\n public static final BigInteger MAX_VALUE = new BigInteger(\"1000000000000000000\") ;\n\n public static BigInteger solve(BigInteger [] arr) {\n BigInteger result = BigInteger.ONE;\n for (BigInteger value : arr) {\n\n result = value.multiply(result);\n if (result.compareTo(MAX_VALUE) > 0) return new BigInteger(\"-1\");\n }\n return result;\n }\n public static void main(String[] args) {\n Scanner sn = new Scanner(System.in);\n\n int n = sn.nextInt();\n BigInteger [] arr = new BigInteger[n];\n for(int i = 0; i<n ; i++) {\n arr[i] = new BigInteger(sn.next());\n if(arr[i].compareTo(BigInteger.ZERO) == 0) {\n System.out.println(0);\n return;\n }\n }\n System.out.println(solve(arr).toString());\n }\n}",
"Main"
] |
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static final BigInteger MAX_VALUE = new BigInteger("1000000000000000000") ;
public static BigInteger solve(BigInteger [] arr) {
BigInteger result = BigInteger.ONE;
for (BigInteger value : arr) {
result = value.multiply(result);
if (result.compareTo(MAX_VALUE) > 0) return new BigInteger("-1");
}
return result;
}
public static void main(String[] args) {
Scanner sn = new Scanner(System.in);
int n = sn.nextInt();
BigInteger [] arr = new BigInteger[n];
for(int i = 0; i<n ; i++) {
arr[i] = new BigInteger(sn.next());
if(arr[i].compareTo(BigInteger.ZERO) == 0) {
System.out.println(0);
return;
}
}
System.out.println(solve(arr).toString());
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
41,
13,
20,
41,
13,
20,
41,
13,
20,
4,
18,
13,
17,
13,
13,
4,
18,
13,
23,
13,
6,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
13,
41,
13,
17,
28,
13,
13,
30,
30,
14,
2,
13,
17,
30,
4,
18,
13,
17,
29,
41,
13,
20,
28,
13,
13,
30,
30,
0,
13,
4,
18,
13,
20,
14,
2,
4,
18,
13,
20,
17,
30,
4,
18,
13,
40,
17,
29,
4,
18,
13,
4,
18,
13,
23,
13,
23,
13,
23,
13,
6,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
29,
13,
23,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
165,
20
],
[
165,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
26,
28
],
[
23,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
31,
33
],
[
23,
34
],
[
34,
35
],
[
34,
36
],
[
23,
37
],
[
37,
38
],
[
37,
39
],
[
23,
40
],
[
40,
41
],
[
40,
42
],
[
23,
43
],
[
43,
44
],
[
44,
45
],
[
43,
46
],
[
43,
47
],
[
43,
48
],
[
23,
49
],
[
49,
50
],
[
50,
51
],
[
21,
52
],
[
52,
53
],
[
165,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
58,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
67,
68
],
[
66,
69
],
[
66,
70
],
[
58,
71
],
[
71,
72
],
[
71,
73
],
[
58,
74
],
[
74,
75
],
[
74,
76
],
[
74,
77
],
[
78,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
84,
87
],
[
83,
88
],
[
58,
89
],
[
89,
90
],
[
89,
91
],
[
58,
92
],
[
92,
93
],
[
92,
94
],
[
92,
95
],
[
96,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
96,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
105,
108
],
[
104,
109
],
[
103,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
114,
115
],
[
110,
116
],
[
58,
117
],
[
117,
118
],
[
118,
119
],
[
117,
120
],
[
120,
121
],
[
121,
122
],
[
56,
123
],
[
123,
124
],
[
56,
125
],
[
125,
126
],
[
56,
127
],
[
127,
128
],
[
165,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
143,
144
],
[
143,
145
],
[
138,
146
],
[
146,
147
],
[
147,
148
],
[
138,
149
],
[
150,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
151,
155
],
[
155,
156
],
[
156,
157
],
[
133,
158
],
[
158,
159
],
[
131,
160
],
[
160,
161
],
[
131,
162
],
[
162,
163
],
[
0,
164
],
[
164,
165
],
[
164,
166
]
] |
[
"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.math.BigDecimal;\nimport java.util.Scanner;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main\n{\n public static void main(String[] args)\n {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Task solver = new Task();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Task\n {\n public void solve(int testNumber, Scanner in, PrintWriter out)\n {\n int N = in.nextInt();\n long A[] = CPUtils.readLongArray(N, in);\n long answer = 1;\n for (long a : A)\n {\n if (a == 0)\n {\n out.println(0);\n return;\n }\n }\n BigDecimal bigDecimal = new BigDecimal(\"1\");\n for (long a : A)\n {\n bigDecimal = bigDecimal.multiply(new BigDecimal(\"\" + a));\n if (bigDecimal.compareTo(new BigDecimal(\"\" + 1000000000000000000L)) > 0)\n {\n out.println(-1);\n return;\n }\n }\n out.println(bigDecimal.toString());\n }\n\n }\n\n static class CPUtils\n {\n public static long[] readLongArray(int size, Scanner in)\n {\n long[] array = new long[size];\n for (int i = 0; i < size; i++)\n {\n array[i] = in.nextLong();\n }\n return array;\n }\n\n }\n}\n",
"import java.io.OutputStream;",
"OutputStream",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.math.BigDecimal;",
"BigDecimal",
"java.math",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main\n{\n public static void main(String[] args)\n {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Task solver = new Task();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Task\n {\n public void solve(int testNumber, Scanner in, PrintWriter out)\n {\n int N = in.nextInt();\n long A[] = CPUtils.readLongArray(N, in);\n long answer = 1;\n for (long a : A)\n {\n if (a == 0)\n {\n out.println(0);\n return;\n }\n }\n BigDecimal bigDecimal = new BigDecimal(\"1\");\n for (long a : A)\n {\n bigDecimal = bigDecimal.multiply(new BigDecimal(\"\" + a));\n if (bigDecimal.compareTo(new BigDecimal(\"\" + 1000000000000000000L)) > 0)\n {\n out.println(-1);\n return;\n }\n }\n out.println(bigDecimal.toString());\n }\n\n }\n\n static class CPUtils\n {\n public static long[] readLongArray(int size, Scanner in)\n {\n long[] array = new long[size];\n for (int i = 0; i < size; i++)\n {\n array[i] = in.nextLong();\n }\n return array;\n }\n\n }\n}",
"Main",
"public static void main(String[] args)\n {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Task solver = new Task();\n solver.solve(1, in, out);\n out.close();\n }",
"main",
"{\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Task solver = new Task();\n solver.solve(1, in, out);\n out.close();\n }",
"InputStream inputStream = System.in;",
"inputStream",
"System.in",
"System",
"System.in",
"OutputStream outputStream = System.out;",
"outputStream",
"System.out",
"System",
"System.out",
"Scanner in = new Scanner(inputStream);",
"in",
"new Scanner(inputStream)",
"PrintWriter out = new PrintWriter(outputStream);",
"out",
"new PrintWriter(outputStream)",
"Task solver = new Task();",
"solver",
"new Task()",
"solver.solve(1, in, out)",
"solver.solve",
"solver",
"1",
"in",
"out",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class Task\n {\n public void solve(int testNumber, Scanner in, PrintWriter out)\n {\n int N = in.nextInt();\n long A[] = CPUtils.readLongArray(N, in);\n long answer = 1;\n for (long a : A)\n {\n if (a == 0)\n {\n out.println(0);\n return;\n }\n }\n BigDecimal bigDecimal = new BigDecimal(\"1\");\n for (long a : A)\n {\n bigDecimal = bigDecimal.multiply(new BigDecimal(\"\" + a));\n if (bigDecimal.compareTo(new BigDecimal(\"\" + 1000000000000000000L)) > 0)\n {\n out.println(-1);\n return;\n }\n }\n out.println(bigDecimal.toString());\n }\n\n }",
"Task",
"public void solve(int testNumber, Scanner in, PrintWriter out)\n {\n int N = in.nextInt();\n long A[] = CPUtils.readLongArray(N, in);\n long answer = 1;\n for (long a : A)\n {\n if (a == 0)\n {\n out.println(0);\n return;\n }\n }\n BigDecimal bigDecimal = new BigDecimal(\"1\");\n for (long a : A)\n {\n bigDecimal = bigDecimal.multiply(new BigDecimal(\"\" + a));\n if (bigDecimal.compareTo(new BigDecimal(\"\" + 1000000000000000000L)) > 0)\n {\n out.println(-1);\n return;\n }\n }\n out.println(bigDecimal.toString());\n }",
"solve",
"{\n int N = in.nextInt();\n long A[] = CPUtils.readLongArray(N, in);\n long answer = 1;\n for (long a : A)\n {\n if (a == 0)\n {\n out.println(0);\n return;\n }\n }\n BigDecimal bigDecimal = new BigDecimal(\"1\");\n for (long a : A)\n {\n bigDecimal = bigDecimal.multiply(new BigDecimal(\"\" + a));\n if (bigDecimal.compareTo(new BigDecimal(\"\" + 1000000000000000000L)) > 0)\n {\n out.println(-1);\n return;\n }\n }\n out.println(bigDecimal.toString());\n }",
"int N = in.nextInt();",
"N",
"in.nextInt()",
"in.nextInt",
"in",
"long A[] = CPUtils.readLongArray(N, in);",
"A",
"CPUtils.readLongArray(N, in)",
"CPUtils.readLongArray",
"CPUtils",
"N",
"in",
"long answer = 1;",
"answer",
"1",
"for (long a : A)\n {\n if (a == 0)\n {\n out.println(0);\n return;\n }\n }",
"long a",
"A",
"{\n if (a == 0)\n {\n out.println(0);\n return;\n }\n }",
"{\n if (a == 0)\n {\n out.println(0);\n return;\n }\n }",
"if (a == 0)\n {\n out.println(0);\n return;\n }",
"a == 0",
"a",
"0",
"{\n out.println(0);\n return;\n }",
"out.println(0)",
"out.println",
"out",
"0",
"return;",
"BigDecimal bigDecimal = new BigDecimal(\"1\");",
"bigDecimal",
"new BigDecimal(\"1\")",
"for (long a : A)\n {\n bigDecimal = bigDecimal.multiply(new BigDecimal(\"\" + a));\n if (bigDecimal.compareTo(new BigDecimal(\"\" + 1000000000000000000L)) > 0)\n {\n out.println(-1);\n return;\n }\n }",
"long a",
"A",
"{\n bigDecimal = bigDecimal.multiply(new BigDecimal(\"\" + a));\n if (bigDecimal.compareTo(new BigDecimal(\"\" + 1000000000000000000L)) > 0)\n {\n out.println(-1);\n return;\n }\n }",
"{\n bigDecimal = bigDecimal.multiply(new BigDecimal(\"\" + a));\n if (bigDecimal.compareTo(new BigDecimal(\"\" + 1000000000000000000L)) > 0)\n {\n out.println(-1);\n return;\n }\n }",
"bigDecimal = bigDecimal.multiply(new BigDecimal(\"\" + a))",
"bigDecimal",
"bigDecimal.multiply(new BigDecimal(\"\" + a))",
"bigDecimal.multiply",
"bigDecimal",
"new BigDecimal(\"\" + a)",
"if (bigDecimal.compareTo(new BigDecimal(\"\" + 1000000000000000000L)) > 0)\n {\n out.println(-1);\n return;\n }",
"bigDecimal.compareTo(new BigDecimal(\"\" + 1000000000000000000L)) > 0",
"bigDecimal.compareTo(new BigDecimal(\"\" + 1000000000000000000L))",
"bigDecimal.compareTo",
"bigDecimal",
"new BigDecimal(\"\" + 1000000000000000000L)",
"0",
"{\n out.println(-1);\n return;\n }",
"out.println(-1)",
"out.println",
"out",
"-1",
"1",
"return;",
"out.println(bigDecimal.toString())",
"out.println",
"out",
"bigDecimal.toString()",
"bigDecimal.toString",
"bigDecimal",
"int testNumber",
"testNumber",
"Scanner in",
"in",
"PrintWriter out",
"out",
"static class CPUtils\n {\n public static long[] readLongArray(int size, Scanner in)\n {\n long[] array = new long[size];\n for (int i = 0; i < size; i++)\n {\n array[i] = in.nextLong();\n }\n return array;\n }\n\n }",
"CPUtils",
"public static long[] readLongArray(int size, Scanner in)\n {\n long[] array = new long[size];\n for (int i = 0; i < size; i++)\n {\n array[i] = in.nextLong();\n }\n return array;\n }",
"readLongArray",
"{\n long[] array = new long[size];\n for (int i = 0; i < size; i++)\n {\n array[i] = in.nextLong();\n }\n return array;\n }",
"long[] array = new long[size];",
"array",
"new long[size]",
"size",
"for (int i = 0; i < size; i++)\n {\n array[i] = in.nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < size",
"i",
"size",
"i++",
"i++",
"i",
"{\n array[i] = in.nextLong();\n }",
"{\n array[i] = in.nextLong();\n }",
"array[i] = in.nextLong()",
"array[i]",
"array",
"i",
"in.nextLong()",
"in.nextLong",
"in",
"return array;",
"array",
"int size",
"size",
"Scanner in",
"in",
"public class Main\n{\n public static void main(String[] args)\n {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Task solver = new Task();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Task\n {\n public void solve(int testNumber, Scanner in, PrintWriter out)\n {\n int N = in.nextInt();\n long A[] = CPUtils.readLongArray(N, in);\n long answer = 1;\n for (long a : A)\n {\n if (a == 0)\n {\n out.println(0);\n return;\n }\n }\n BigDecimal bigDecimal = new BigDecimal(\"1\");\n for (long a : A)\n {\n bigDecimal = bigDecimal.multiply(new BigDecimal(\"\" + a));\n if (bigDecimal.compareTo(new BigDecimal(\"\" + 1000000000000000000L)) > 0)\n {\n out.println(-1);\n return;\n }\n }\n out.println(bigDecimal.toString());\n }\n\n }\n\n static class CPUtils\n {\n public static long[] readLongArray(int size, Scanner in)\n {\n long[] array = new long[size];\n for (int i = 0; i < size; i++)\n {\n array[i] = in.nextLong();\n }\n return array;\n }\n\n }\n}",
"public class Main\n{\n public static void main(String[] args)\n {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Task solver = new Task();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Task\n {\n public void solve(int testNumber, Scanner in, PrintWriter out)\n {\n int N = in.nextInt();\n long A[] = CPUtils.readLongArray(N, in);\n long answer = 1;\n for (long a : A)\n {\n if (a == 0)\n {\n out.println(0);\n return;\n }\n }\n BigDecimal bigDecimal = new BigDecimal(\"1\");\n for (long a : A)\n {\n bigDecimal = bigDecimal.multiply(new BigDecimal(\"\" + a));\n if (bigDecimal.compareTo(new BigDecimal(\"\" + 1000000000000000000L)) > 0)\n {\n out.println(-1);\n return;\n }\n }\n out.println(bigDecimal.toString());\n }\n\n }\n\n static class CPUtils\n {\n public static long[] readLongArray(int size, Scanner in)\n {\n long[] array = new long[size];\n for (int i = 0; i < size; i++)\n {\n array[i] = in.nextLong();\n }\n return array;\n }\n\n }\n}",
"Main"
] |
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main
{
public static void main(String[] args)
{
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
Scanner in = new Scanner(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Task solver = new Task();
solver.solve(1, in, out);
out.close();
}
static class Task
{
public void solve(int testNumber, Scanner in, PrintWriter out)
{
int N = in.nextInt();
long A[] = CPUtils.readLongArray(N, in);
long answer = 1;
for (long a : A)
{
if (a == 0)
{
out.println(0);
return;
}
}
BigDecimal bigDecimal = new BigDecimal("1");
for (long a : A)
{
bigDecimal = bigDecimal.multiply(new BigDecimal("" + a));
if (bigDecimal.compareTo(new BigDecimal("" + 1000000000000000000L)) > 0)
{
out.println(-1);
return;
}
}
out.println(bigDecimal.toString());
}
}
static class CPUtils
{
public static long[] readLongArray(int size, Scanner in)
{
long[] array = new long[size];
for (int i = 0; i < size; i++)
{
array[i] = in.nextLong();
}
return array;
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
0,
13,
17,
30,
14,
2,
13,
2,
4,
18,
13,
17,
17,
13,
30,
14,
2,
13,
17,
30,
0,
13,
13,
30,
0,
13,
40,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
80,
5
],
[
80,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
20,
25
],
[
25,
26
],
[
25,
27
],
[
20,
28
],
[
28,
29
],
[
29,
30
],
[
20,
31
],
[
32,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
32,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
38,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
38,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
51,
54
],
[
51,
55
],
[
50,
56
],
[
47,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
58,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
47,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
8,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
71,
76
],
[
6,
77
],
[
77,
78
],
[
0,
79
],
[
79,
80
],
[
79,
81
]
] |
[
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner scan = new Scanner(System.in);\n\t\tlong a = scan.nextLong();\n\t\tlong total = 1;\n\t\t\n\t\tfor(int i=0;i<a;i++) {\n\t\t\tlong n = scan.nextLong();\n\t\t\tif(n == 0) {\n\t\t\t\ttotal = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif(total <= ((long)Math.pow(10,18)/n)) {\n\t\t\t\t\tif(total >= 0) {\n\t\t\t\t\t\ttotal *= n;\n\t\t\t\t\t}\n\t\t\t\t}else {\n\t\t\t\t\ttotal = -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(total);\n\t\t\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner scan = new Scanner(System.in);\n\t\tlong a = scan.nextLong();\n\t\tlong total = 1;\n\t\t\n\t\tfor(int i=0;i<a;i++) {\n\t\t\tlong n = scan.nextLong();\n\t\t\tif(n == 0) {\n\t\t\t\ttotal = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif(total <= ((long)Math.pow(10,18)/n)) {\n\t\t\t\t\tif(total >= 0) {\n\t\t\t\t\t\ttotal *= n;\n\t\t\t\t\t}\n\t\t\t\t}else {\n\t\t\t\t\ttotal = -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(total);\n\t\t\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner scan = new Scanner(System.in);\n\t\tlong a = scan.nextLong();\n\t\tlong total = 1;\n\t\t\n\t\tfor(int i=0;i<a;i++) {\n\t\t\tlong n = scan.nextLong();\n\t\t\tif(n == 0) {\n\t\t\t\ttotal = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif(total <= ((long)Math.pow(10,18)/n)) {\n\t\t\t\t\tif(total >= 0) {\n\t\t\t\t\t\ttotal *= n;\n\t\t\t\t\t}\n\t\t\t\t}else {\n\t\t\t\t\ttotal = -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(total);\n\t\t\n\t}",
"main",
"{\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner scan = new Scanner(System.in);\n\t\tlong a = scan.nextLong();\n\t\tlong total = 1;\n\t\t\n\t\tfor(int i=0;i<a;i++) {\n\t\t\tlong n = scan.nextLong();\n\t\t\tif(n == 0) {\n\t\t\t\ttotal = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif(total <= ((long)Math.pow(10,18)/n)) {\n\t\t\t\t\tif(total >= 0) {\n\t\t\t\t\t\ttotal *= n;\n\t\t\t\t\t}\n\t\t\t\t}else {\n\t\t\t\t\ttotal = -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(total);\n\t\t\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"long a = scan.nextLong();",
"a",
"scan.nextLong()",
"scan.nextLong",
"scan",
"long total = 1;",
"total",
"1",
"for(int i=0;i<a;i++) {\n\t\t\tlong n = scan.nextLong();\n\t\t\tif(n == 0) {\n\t\t\t\ttotal = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif(total <= ((long)Math.pow(10,18)/n)) {\n\t\t\t\t\tif(total >= 0) {\n\t\t\t\t\t\ttotal *= n;\n\t\t\t\t\t}\n\t\t\t\t}else {\n\t\t\t\t\ttotal = -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<a",
"i",
"a",
"i++",
"i++",
"i",
"{\n\t\t\tlong n = scan.nextLong();\n\t\t\tif(n == 0) {\n\t\t\t\ttotal = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif(total <= ((long)Math.pow(10,18)/n)) {\n\t\t\t\t\tif(total >= 0) {\n\t\t\t\t\t\ttotal *= n;\n\t\t\t\t\t}\n\t\t\t\t}else {\n\t\t\t\t\ttotal = -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tlong n = scan.nextLong();\n\t\t\tif(n == 0) {\n\t\t\t\ttotal = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif(total <= ((long)Math.pow(10,18)/n)) {\n\t\t\t\t\tif(total >= 0) {\n\t\t\t\t\t\ttotal *= n;\n\t\t\t\t\t}\n\t\t\t\t}else {\n\t\t\t\t\ttotal = -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"long n = scan.nextLong();",
"n",
"scan.nextLong()",
"scan.nextLong",
"scan",
"if(n == 0) {\n\t\t\t\ttotal = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif(total <= ((long)Math.pow(10,18)/n)) {\n\t\t\t\t\tif(total >= 0) {\n\t\t\t\t\t\ttotal *= n;\n\t\t\t\t\t}\n\t\t\t\t}else {\n\t\t\t\t\ttotal = -1;\n\t\t\t\t}\n\t\t\t}",
"n == 0",
"n",
"0",
"{\n\t\t\t\ttotal = 0;\n\t\t\t}",
"total = 0",
"total",
"0",
"{\n\t\t\t\tif(total <= ((long)Math.pow(10,18)/n)) {\n\t\t\t\t\tif(total >= 0) {\n\t\t\t\t\t\ttotal *= n;\n\t\t\t\t\t}\n\t\t\t\t}else {\n\t\t\t\t\ttotal = -1;\n\t\t\t\t}\n\t\t\t}",
"if(total <= ((long)Math.pow(10,18)/n)) {\n\t\t\t\t\tif(total >= 0) {\n\t\t\t\t\t\ttotal *= n;\n\t\t\t\t\t}\n\t\t\t\t}else {\n\t\t\t\t\ttotal = -1;\n\t\t\t\t}",
"total <= ((long)Math.pow(10,18)/n)",
"total",
"((long)Math.pow(10,18)/n)",
"(long)Math.pow(10,18)",
"Math.pow",
"Math",
"10",
"18",
"n",
"{\n\t\t\t\t\tif(total >= 0) {\n\t\t\t\t\t\ttotal *= n;\n\t\t\t\t\t}\n\t\t\t\t}",
"if(total >= 0) {\n\t\t\t\t\t\ttotal *= n;\n\t\t\t\t\t}",
"total >= 0",
"total",
"0",
"{\n\t\t\t\t\t\ttotal *= n;\n\t\t\t\t\t}",
"total *= n",
"total",
"n",
"{\n\t\t\t\t\ttotal = -1;\n\t\t\t\t}",
"total = -1",
"total",
"-1",
"1",
"System.out.print(total)",
"System.out.print",
"System.out",
"System",
"System.out",
"total",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner scan = new Scanner(System.in);\n\t\tlong a = scan.nextLong();\n\t\tlong total = 1;\n\t\t\n\t\tfor(int i=0;i<a;i++) {\n\t\t\tlong n = scan.nextLong();\n\t\t\tif(n == 0) {\n\t\t\t\ttotal = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif(total <= ((long)Math.pow(10,18)/n)) {\n\t\t\t\t\tif(total >= 0) {\n\t\t\t\t\t\ttotal *= n;\n\t\t\t\t\t}\n\t\t\t\t}else {\n\t\t\t\t\ttotal = -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(total);\n\t\t\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner scan = new Scanner(System.in);\n\t\tlong a = scan.nextLong();\n\t\tlong total = 1;\n\t\t\n\t\tfor(int i=0;i<a;i++) {\n\t\t\tlong n = scan.nextLong();\n\t\t\tif(n == 0) {\n\t\t\t\ttotal = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif(total <= ((long)Math.pow(10,18)/n)) {\n\t\t\t\t\tif(total >= 0) {\n\t\t\t\t\t\ttotal *= n;\n\t\t\t\t\t}\n\t\t\t\t}else {\n\t\t\t\t\ttotal = -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(total);\n\t\t\n\t}\n\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner scan = new Scanner(System.in);
long a = scan.nextLong();
long total = 1;
for(int i=0;i<a;i++) {
long n = scan.nextLong();
if(n == 0) {
total = 0;
}
else {
if(total <= ((long)Math.pow(10,18)/n)) {
if(total >= 0) {
total *= n;
}
}else {
total = -1;
}
}
}
System.out.print(total);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
17,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
14,
2,
13,
2,
13,
13,
30,
0,
13,
17,
30,
0,
13,
13,
14,
13,
30,
4,
18,
18,
13,
13,
40,
17,
30,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
90,
5
],
[
90,
6
],
[
6,
7
],
[
6,
8
],
[
90,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
11,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
42,
43
],
[
38,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
48,
55
],
[
38,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
59,
61
],
[
56,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
56,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
11,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
70,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
81,
86
],
[
9,
87
],
[
87,
88
],
[
0,
89
],
[
89,
90
],
[
89,
91
]
] |
[
"\nimport java.util.Scanner;\n\npublic class Main {\n\tfinal static long limit = 1000000000000000000l;\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long mul = 1l;\n boolean isOver = false;\n \n for(int i=0; i<N; i++) {\n \tlong a = sc.nextLong();\n \tif(a==0) {\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif (mul>limit/a) {\n \t\tisOver = true;\n \t}else {\n \tmul *= a;\n \t}\n }\n \n if(isOver) {\n \tSystem.out.println(-1);\n }else {\n \tSystem.out.println(mul);\n }\n \n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tfinal static long limit = 1000000000000000000l;\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long mul = 1l;\n boolean isOver = false;\n \n for(int i=0; i<N; i++) {\n \tlong a = sc.nextLong();\n \tif(a==0) {\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif (mul>limit/a) {\n \t\tisOver = true;\n \t}else {\n \tmul *= a;\n \t}\n }\n \n if(isOver) {\n \tSystem.out.println(-1);\n }else {\n \tSystem.out.println(mul);\n }\n \n\t}\n\n}",
"Main",
"final static long limit = 1000000000000000000l;",
"limit",
"1000000000000000000l",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long mul = 1l;\n boolean isOver = false;\n \n for(int i=0; i<N; i++) {\n \tlong a = sc.nextLong();\n \tif(a==0) {\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif (mul>limit/a) {\n \t\tisOver = true;\n \t}else {\n \tmul *= a;\n \t}\n }\n \n if(isOver) {\n \tSystem.out.println(-1);\n }else {\n \tSystem.out.println(mul);\n }\n \n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long mul = 1l;\n boolean isOver = false;\n \n for(int i=0; i<N; i++) {\n \tlong a = sc.nextLong();\n \tif(a==0) {\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif (mul>limit/a) {\n \t\tisOver = true;\n \t}else {\n \tmul *= a;\n \t}\n }\n \n if(isOver) {\n \tSystem.out.println(-1);\n }else {\n \tSystem.out.println(mul);\n }\n \n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long mul = 1l;",
"mul",
"1l",
"boolean isOver = false;",
"isOver",
"false",
"for(int i=0; i<N; i++) {\n \tlong a = sc.nextLong();\n \tif(a==0) {\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif (mul>limit/a) {\n \t\tisOver = true;\n \t}else {\n \tmul *= a;\n \t}\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n \tlong a = sc.nextLong();\n \tif(a==0) {\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif (mul>limit/a) {\n \t\tisOver = true;\n \t}else {\n \tmul *= a;\n \t}\n }",
"{\n \tlong a = sc.nextLong();\n \tif(a==0) {\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif (mul>limit/a) {\n \t\tisOver = true;\n \t}else {\n \tmul *= a;\n \t}\n }",
"long a = sc.nextLong();",
"a",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(a==0) {\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}",
"a==0",
"a",
"0",
"{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"if (mul>limit/a) {\n \t\tisOver = true;\n \t}else {\n \tmul *= a;\n \t}",
"mul>limit/a",
"mul",
"limit/a",
"limit",
"a",
"{\n \t\tisOver = true;\n \t}",
"isOver = true",
"isOver",
"true",
"{\n \tmul *= a;\n \t}",
"mul *= a",
"mul",
"a",
"if(isOver) {\n \tSystem.out.println(-1);\n }else {\n \tSystem.out.println(mul);\n }",
"isOver",
"{\n \tSystem.out.println(-1);\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"{\n \tSystem.out.println(mul);\n }",
"System.out.println(mul)",
"System.out.println",
"System.out",
"System",
"System.out",
"mul",
"String[] args",
"args",
"public class Main {\n\tfinal static long limit = 1000000000000000000l;\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long mul = 1l;\n boolean isOver = false;\n \n for(int i=0; i<N; i++) {\n \tlong a = sc.nextLong();\n \tif(a==0) {\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif (mul>limit/a) {\n \t\tisOver = true;\n \t}else {\n \tmul *= a;\n \t}\n }\n \n if(isOver) {\n \tSystem.out.println(-1);\n }else {\n \tSystem.out.println(mul);\n }\n \n\t}\n\n}",
"public class Main {\n\tfinal static long limit = 1000000000000000000l;\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long mul = 1l;\n boolean isOver = false;\n \n for(int i=0; i<N; i++) {\n \tlong a = sc.nextLong();\n \tif(a==0) {\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif (mul>limit/a) {\n \t\tisOver = true;\n \t}else {\n \tmul *= a;\n \t}\n }\n \n if(isOver) {\n \tSystem.out.println(-1);\n }else {\n \tSystem.out.println(mul);\n }\n \n\t}\n\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
final static long limit = 1000000000000000000l;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long mul = 1l;
boolean isOver = false;
for(int i=0; i<N; i++) {
long a = sc.nextLong();
if(a==0) {
System.out.println(0);
return;
}
if (mul>limit/a) {
isOver = true;
}else {
mul *= a;
}
}
if(isOver) {
System.out.println(-1);
}else {
System.out.println(mul);
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
41,
13,
41,
13,
17,
41,
13,
17,
0,
13,
4,
18,
13,
41,
13,
4,
18,
13,
17,
41,
13,
20,
41,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
14,
2,
4,
18,
13,
4,
18,
13,
17,
17,
30,
0,
13,
17,
3,
14,
2,
13,
17,
30,
0,
13,
4,
18,
13,
13,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
0,
13,
17,
14,
2,
13,
17,
4,
18,
18,
13,
13,
17,
30,
14,
2,
13,
17,
4,
18,
18,
13,
13,
40,
17,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
133,
8
],
[
133,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
11,
17
],
[
17,
18
],
[
11,
19
],
[
19,
20
],
[
19,
21
],
[
11,
22
],
[
22,
23
],
[
22,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
11,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
32,
35
],
[
11,
36
],
[
36,
37
],
[
36,
38
],
[
11,
39
],
[
39,
40
],
[
11,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
41,
46
],
[
46,
47
],
[
46,
48
],
[
41,
49
],
[
49,
50
],
[
50,
51
],
[
41,
52
],
[
53,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
57,
58
],
[
53,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
64,
65
],
[
65,
66
],
[
64,
67
],
[
60,
68
],
[
59,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
53,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
74,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
78,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
78,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
11,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
99,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
119,
120
],
[
110,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
121,
126
],
[
11,
127
],
[
127,
128
],
[
128,
129
],
[
9,
130
],
[
130,
131
],
[
0,
132
],
[
132,
133
],
[
132,
134
]
] |
[
"import java.math.*;\nimport java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in) ;\n\t\tint n, result, flag = 0, zero = 0 ;\n\t\tn = sc.nextInt() ;\n\t\tBigInteger val = BigInteger.valueOf(1), check = new BigInteger(\"1000000000000000000\"), x ;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tx = sc.nextBigInteger() ;\n\t\t\tif (x.compareTo(BigInteger.valueOf(0)) == 0) {\n\t\t\t\tzero = 1 ;\n\t\t\t\tbreak ;\n\t\t\t}\n\t\t\tif (flag == 0) {\n\t\t\t\tval = val.multiply(x) ;\n\t\t\t\tresult = val.compareTo(check) ;\n\t\t\t\tif (result == 1) {\n\t\t\t\t\tflag = 1 ;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (zero == 1)\tSystem.out.print(0) ;\n\t\telse {\n\t\t\tif (flag == 1)\tSystem.out.println(-1) ;\n\t\t\telse\tSystem.out.println(val) ;\n\t\t}\n\t\tSystem.gc(); \n\t}\n}",
"import java.math.*;",
"math.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in) ;\n\t\tint n, result, flag = 0, zero = 0 ;\n\t\tn = sc.nextInt() ;\n\t\tBigInteger val = BigInteger.valueOf(1), check = new BigInteger(\"1000000000000000000\"), x ;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tx = sc.nextBigInteger() ;\n\t\t\tif (x.compareTo(BigInteger.valueOf(0)) == 0) {\n\t\t\t\tzero = 1 ;\n\t\t\t\tbreak ;\n\t\t\t}\n\t\t\tif (flag == 0) {\n\t\t\t\tval = val.multiply(x) ;\n\t\t\t\tresult = val.compareTo(check) ;\n\t\t\t\tif (result == 1) {\n\t\t\t\t\tflag = 1 ;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (zero == 1)\tSystem.out.print(0) ;\n\t\telse {\n\t\t\tif (flag == 1)\tSystem.out.println(-1) ;\n\t\t\telse\tSystem.out.println(val) ;\n\t\t}\n\t\tSystem.gc(); \n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in) ;\n\t\tint n, result, flag = 0, zero = 0 ;\n\t\tn = sc.nextInt() ;\n\t\tBigInteger val = BigInteger.valueOf(1), check = new BigInteger(\"1000000000000000000\"), x ;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tx = sc.nextBigInteger() ;\n\t\t\tif (x.compareTo(BigInteger.valueOf(0)) == 0) {\n\t\t\t\tzero = 1 ;\n\t\t\t\tbreak ;\n\t\t\t}\n\t\t\tif (flag == 0) {\n\t\t\t\tval = val.multiply(x) ;\n\t\t\t\tresult = val.compareTo(check) ;\n\t\t\t\tif (result == 1) {\n\t\t\t\t\tflag = 1 ;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (zero == 1)\tSystem.out.print(0) ;\n\t\telse {\n\t\t\tif (flag == 1)\tSystem.out.println(-1) ;\n\t\t\telse\tSystem.out.println(val) ;\n\t\t}\n\t\tSystem.gc(); \n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in) ;\n\t\tint n, result, flag = 0, zero = 0 ;\n\t\tn = sc.nextInt() ;\n\t\tBigInteger val = BigInteger.valueOf(1), check = new BigInteger(\"1000000000000000000\"), x ;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tx = sc.nextBigInteger() ;\n\t\t\tif (x.compareTo(BigInteger.valueOf(0)) == 0) {\n\t\t\t\tzero = 1 ;\n\t\t\t\tbreak ;\n\t\t\t}\n\t\t\tif (flag == 0) {\n\t\t\t\tval = val.multiply(x) ;\n\t\t\t\tresult = val.compareTo(check) ;\n\t\t\t\tif (result == 1) {\n\t\t\t\t\tflag = 1 ;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (zero == 1)\tSystem.out.print(0) ;\n\t\telse {\n\t\t\tif (flag == 1)\tSystem.out.println(-1) ;\n\t\t\telse\tSystem.out.println(val) ;\n\t\t}\n\t\tSystem.gc(); \n\t}",
"Scanner sc = new Scanner(System.in) ;",
"sc",
"new Scanner(System.in)",
"int n",
"n",
"result",
"result",
"flag = 0",
"flag",
"0",
"zero = 0 ;",
"zero",
"0",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BigInteger val = BigInteger.valueOf(1)",
"val",
"BigInteger.valueOf(1)",
"BigInteger.valueOf",
"BigInteger",
"1",
"check = new BigInteger(\"1000000000000000000\")",
"check",
"new BigInteger(\"1000000000000000000\")",
"x ;",
"x",
"for (int i = 0; i < n; i++) {\n\t\t\tx = sc.nextBigInteger() ;\n\t\t\tif (x.compareTo(BigInteger.valueOf(0)) == 0) {\n\t\t\t\tzero = 1 ;\n\t\t\t\tbreak ;\n\t\t\t}\n\t\t\tif (flag == 0) {\n\t\t\t\tval = val.multiply(x) ;\n\t\t\t\tresult = val.compareTo(check) ;\n\t\t\t\tif (result == 1) {\n\t\t\t\t\tflag = 1 ;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tx = sc.nextBigInteger() ;\n\t\t\tif (x.compareTo(BigInteger.valueOf(0)) == 0) {\n\t\t\t\tzero = 1 ;\n\t\t\t\tbreak ;\n\t\t\t}\n\t\t\tif (flag == 0) {\n\t\t\t\tval = val.multiply(x) ;\n\t\t\t\tresult = val.compareTo(check) ;\n\t\t\t\tif (result == 1) {\n\t\t\t\t\tflag = 1 ;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tx = sc.nextBigInteger() ;\n\t\t\tif (x.compareTo(BigInteger.valueOf(0)) == 0) {\n\t\t\t\tzero = 1 ;\n\t\t\t\tbreak ;\n\t\t\t}\n\t\t\tif (flag == 0) {\n\t\t\t\tval = val.multiply(x) ;\n\t\t\t\tresult = val.compareTo(check) ;\n\t\t\t\tif (result == 1) {\n\t\t\t\t\tflag = 1 ;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"x = sc.nextBigInteger()",
"x",
"sc.nextBigInteger()",
"sc.nextBigInteger",
"sc",
"if (x.compareTo(BigInteger.valueOf(0)) == 0) {\n\t\t\t\tzero = 1 ;\n\t\t\t\tbreak ;\n\t\t\t}",
"x.compareTo(BigInteger.valueOf(0)) == 0",
"x.compareTo(BigInteger.valueOf(0))",
"x.compareTo",
"x",
"BigInteger.valueOf(0)",
"BigInteger.valueOf",
"BigInteger",
"0",
"0",
"{\n\t\t\t\tzero = 1 ;\n\t\t\t\tbreak ;\n\t\t\t}",
"zero = 1",
"zero",
"1",
"break ;",
"if (flag == 0) {\n\t\t\t\tval = val.multiply(x) ;\n\t\t\t\tresult = val.compareTo(check) ;\n\t\t\t\tif (result == 1) {\n\t\t\t\t\tflag = 1 ;\n\t\t\t\t}\n\t\t\t}",
"flag == 0",
"flag",
"0",
"{\n\t\t\t\tval = val.multiply(x) ;\n\t\t\t\tresult = val.compareTo(check) ;\n\t\t\t\tif (result == 1) {\n\t\t\t\t\tflag = 1 ;\n\t\t\t\t}\n\t\t\t}",
"val = val.multiply(x)",
"val",
"val.multiply(x)",
"val.multiply",
"val",
"x",
"result = val.compareTo(check)",
"result",
"val.compareTo(check)",
"val.compareTo",
"val",
"check",
"if (result == 1) {\n\t\t\t\t\tflag = 1 ;\n\t\t\t\t}",
"result == 1",
"result",
"1",
"{\n\t\t\t\t\tflag = 1 ;\n\t\t\t\t}",
"flag = 1",
"flag",
"1",
"if (zero == 1)\tSystem.out.print(0) ;\n\t\telse {\n\t\t\tif (flag == 1)\tSystem.out.println(-1) ;\n\t\t\telse\tSystem.out.println(val) ;\n\t\t}",
"zero == 1",
"zero",
"1",
"System.out.print(0)",
"System.out.print",
"System.out",
"System",
"System.out",
"0",
"{\n\t\t\tif (flag == 1)\tSystem.out.println(-1) ;\n\t\t\telse\tSystem.out.println(val) ;\n\t\t}",
"if (flag == 1)\tSystem.out.println(-1) ;\n\t\t\telse\tSystem.out.println(val) ;",
"flag == 1",
"flag",
"1",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"System.out.println(val)",
"System.out.println",
"System.out",
"System",
"System.out",
"val",
"System.gc()",
"System.gc",
"System",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in) ;\n\t\tint n, result, flag = 0, zero = 0 ;\n\t\tn = sc.nextInt() ;\n\t\tBigInteger val = BigInteger.valueOf(1), check = new BigInteger(\"1000000000000000000\"), x ;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tx = sc.nextBigInteger() ;\n\t\t\tif (x.compareTo(BigInteger.valueOf(0)) == 0) {\n\t\t\t\tzero = 1 ;\n\t\t\t\tbreak ;\n\t\t\t}\n\t\t\tif (flag == 0) {\n\t\t\t\tval = val.multiply(x) ;\n\t\t\t\tresult = val.compareTo(check) ;\n\t\t\t\tif (result == 1) {\n\t\t\t\t\tflag = 1 ;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (zero == 1)\tSystem.out.print(0) ;\n\t\telse {\n\t\t\tif (flag == 1)\tSystem.out.println(-1) ;\n\t\t\telse\tSystem.out.println(val) ;\n\t\t}\n\t\tSystem.gc(); \n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in) ;\n\t\tint n, result, flag = 0, zero = 0 ;\n\t\tn = sc.nextInt() ;\n\t\tBigInteger val = BigInteger.valueOf(1), check = new BigInteger(\"1000000000000000000\"), x ;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tx = sc.nextBigInteger() ;\n\t\t\tif (x.compareTo(BigInteger.valueOf(0)) == 0) {\n\t\t\t\tzero = 1 ;\n\t\t\t\tbreak ;\n\t\t\t}\n\t\t\tif (flag == 0) {\n\t\t\t\tval = val.multiply(x) ;\n\t\t\t\tresult = val.compareTo(check) ;\n\t\t\t\tif (result == 1) {\n\t\t\t\t\tflag = 1 ;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (zero == 1)\tSystem.out.print(0) ;\n\t\telse {\n\t\t\tif (flag == 1)\tSystem.out.println(-1) ;\n\t\t\telse\tSystem.out.println(val) ;\n\t\t}\n\t\tSystem.gc(); \n\t}\n}",
"Main"
] |
import java.math.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in) ;
int n, result, flag = 0, zero = 0 ;
n = sc.nextInt() ;
BigInteger val = BigInteger.valueOf(1), check = new BigInteger("1000000000000000000"), x ;
for (int i = 0; i < n; i++) {
x = sc.nextBigInteger() ;
if (x.compareTo(BigInteger.valueOf(0)) == 0) {
zero = 1 ;
break ;
}
if (flag == 0) {
val = val.multiply(x) ;
result = val.compareTo(check) ;
if (result == 1) {
flag = 1 ;
}
}
}
if (zero == 1) System.out.print(0) ;
else {
if (flag == 1) System.out.println(-1) ;
else System.out.println(val) ;
}
System.gc();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
0,
13,
4,
18,
13,
41,
13,
20,
41,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
4,
18,
13,
17,
14,
2,
13,
17,
30,
0,
13,
4,
18,
13,
17,
0,
13,
4,
18,
13,
13,
14,
2,
2,
13,
17,
2,
13,
17,
0,
13,
4,
18,
13,
13,
41,
13,
4,
18,
13,
13,
14,
2,
13,
17,
4,
18,
18,
13,
13,
13,
4,
18,
18,
13,
13,
17,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
116,
8
],
[
116,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
11,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
11,
22
],
[
22,
23
],
[
22,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
27,
30
],
[
11,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
36,
37
],
[
36,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
31,
42
],
[
43,
43
],
[
43,
44
],
[
44,
45
],
[
43,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
43,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
53,
56
],
[
56,
57
],
[
57,
58
],
[
56,
59
],
[
43,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
43,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
73,
76
],
[
43,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
82,
84
],
[
77,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
11,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
11,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
97,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
9,
113
],
[
113,
114
],
[
0,
115
],
[
115,
116
],
[
115,
117
]
] |
[
"import java.math.*;\nimport java.util.*;\npublic class Main\n{\n public static void main(String[] args)\n {\n Scanner cin = new Scanner(System.in);\n int tt;\n tt = cin.nextInt();\n BigInteger t = new BigInteger(\"1000000000000000000\");\n BigInteger ans = BigInteger.valueOf(1);\n for(int i = 1;i <= tt;i ++)\n {\n int f;\n BigInteger m = cin.nextBigInteger();\n int s = m.compareTo(BigInteger.valueOf(0));\n if (s == 0)\n {\n ans = BigInteger.valueOf(0);\n }\n f = ans.compareTo(t);\n if(s != 0 && f <= 0)\n ans = ans.multiply(m);\n }\n int kk = ans.compareTo(t);\n if(kk <= 0)\n System.out.println(ans);\n else System.out.println(\"-1\\n\");\n }\n}",
"import java.math.*;",
"math.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main\n{\n public static void main(String[] args)\n {\n Scanner cin = new Scanner(System.in);\n int tt;\n tt = cin.nextInt();\n BigInteger t = new BigInteger(\"1000000000000000000\");\n BigInteger ans = BigInteger.valueOf(1);\n for(int i = 1;i <= tt;i ++)\n {\n int f;\n BigInteger m = cin.nextBigInteger();\n int s = m.compareTo(BigInteger.valueOf(0));\n if (s == 0)\n {\n ans = BigInteger.valueOf(0);\n }\n f = ans.compareTo(t);\n if(s != 0 && f <= 0)\n ans = ans.multiply(m);\n }\n int kk = ans.compareTo(t);\n if(kk <= 0)\n System.out.println(ans);\n else System.out.println(\"-1\\n\");\n }\n}",
"Main",
"public static void main(String[] args)\n {\n Scanner cin = new Scanner(System.in);\n int tt;\n tt = cin.nextInt();\n BigInteger t = new BigInteger(\"1000000000000000000\");\n BigInteger ans = BigInteger.valueOf(1);\n for(int i = 1;i <= tt;i ++)\n {\n int f;\n BigInteger m = cin.nextBigInteger();\n int s = m.compareTo(BigInteger.valueOf(0));\n if (s == 0)\n {\n ans = BigInteger.valueOf(0);\n }\n f = ans.compareTo(t);\n if(s != 0 && f <= 0)\n ans = ans.multiply(m);\n }\n int kk = ans.compareTo(t);\n if(kk <= 0)\n System.out.println(ans);\n else System.out.println(\"-1\\n\");\n }",
"main",
"{\n Scanner cin = new Scanner(System.in);\n int tt;\n tt = cin.nextInt();\n BigInteger t = new BigInteger(\"1000000000000000000\");\n BigInteger ans = BigInteger.valueOf(1);\n for(int i = 1;i <= tt;i ++)\n {\n int f;\n BigInteger m = cin.nextBigInteger();\n int s = m.compareTo(BigInteger.valueOf(0));\n if (s == 0)\n {\n ans = BigInteger.valueOf(0);\n }\n f = ans.compareTo(t);\n if(s != 0 && f <= 0)\n ans = ans.multiply(m);\n }\n int kk = ans.compareTo(t);\n if(kk <= 0)\n System.out.println(ans);\n else System.out.println(\"-1\\n\");\n }",
"Scanner cin = new Scanner(System.in);",
"cin",
"new Scanner(System.in)",
"int tt;",
"tt",
"tt = cin.nextInt()",
"tt",
"cin.nextInt()",
"cin.nextInt",
"cin",
"BigInteger t = new BigInteger(\"1000000000000000000\");",
"t",
"new BigInteger(\"1000000000000000000\")",
"BigInteger ans = BigInteger.valueOf(1);",
"ans",
"BigInteger.valueOf(1)",
"BigInteger.valueOf",
"BigInteger",
"1",
"for(int i = 1;i <= tt;i ++)\n {\n int f;\n BigInteger m = cin.nextBigInteger();\n int s = m.compareTo(BigInteger.valueOf(0));\n if (s == 0)\n {\n ans = BigInteger.valueOf(0);\n }\n f = ans.compareTo(t);\n if(s != 0 && f <= 0)\n ans = ans.multiply(m);\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i <= tt",
"i",
"tt",
"i ++",
"i ++",
"i",
"{\n int f;\n BigInteger m = cin.nextBigInteger();\n int s = m.compareTo(BigInteger.valueOf(0));\n if (s == 0)\n {\n ans = BigInteger.valueOf(0);\n }\n f = ans.compareTo(t);\n if(s != 0 && f <= 0)\n ans = ans.multiply(m);\n }",
"{\n int f;\n BigInteger m = cin.nextBigInteger();\n int s = m.compareTo(BigInteger.valueOf(0));\n if (s == 0)\n {\n ans = BigInteger.valueOf(0);\n }\n f = ans.compareTo(t);\n if(s != 0 && f <= 0)\n ans = ans.multiply(m);\n }",
"int f;",
"f",
"BigInteger m = cin.nextBigInteger();",
"m",
"cin.nextBigInteger()",
"cin.nextBigInteger",
"cin",
"int s = m.compareTo(BigInteger.valueOf(0));",
"s",
"m.compareTo(BigInteger.valueOf(0))",
"m.compareTo",
"m",
"BigInteger.valueOf(0)",
"BigInteger.valueOf",
"BigInteger",
"0",
"if (s == 0)\n {\n ans = BigInteger.valueOf(0);\n }",
"s == 0",
"s",
"0",
"{\n ans = BigInteger.valueOf(0);\n }",
"ans = BigInteger.valueOf(0)",
"ans",
"BigInteger.valueOf(0)",
"BigInteger.valueOf",
"BigInteger",
"0",
"f = ans.compareTo(t)",
"f",
"ans.compareTo(t)",
"ans.compareTo",
"ans",
"t",
"if(s != 0 && f <= 0)\n ans = ans.multiply(m);",
"s != 0 && f <= 0",
"s != 0",
"s",
"0",
"f <= 0",
"f",
"0",
"ans = ans.multiply(m)",
"ans",
"ans.multiply(m)",
"ans.multiply",
"ans",
"m",
"int kk = ans.compareTo(t);",
"kk",
"ans.compareTo(t)",
"ans.compareTo",
"ans",
"t",
"if(kk <= 0)\n System.out.println(ans);\n else System.out.println(\"-1\\n\");",
"kk <= 0",
"kk",
"0",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"System.out.println(\"-1\\n\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\\n\"",
"String[] args",
"args",
"public class Main\n{\n public static void main(String[] args)\n {\n Scanner cin = new Scanner(System.in);\n int tt;\n tt = cin.nextInt();\n BigInteger t = new BigInteger(\"1000000000000000000\");\n BigInteger ans = BigInteger.valueOf(1);\n for(int i = 1;i <= tt;i ++)\n {\n int f;\n BigInteger m = cin.nextBigInteger();\n int s = m.compareTo(BigInteger.valueOf(0));\n if (s == 0)\n {\n ans = BigInteger.valueOf(0);\n }\n f = ans.compareTo(t);\n if(s != 0 && f <= 0)\n ans = ans.multiply(m);\n }\n int kk = ans.compareTo(t);\n if(kk <= 0)\n System.out.println(ans);\n else System.out.println(\"-1\\n\");\n }\n}",
"public class Main\n{\n public static void main(String[] args)\n {\n Scanner cin = new Scanner(System.in);\n int tt;\n tt = cin.nextInt();\n BigInteger t = new BigInteger(\"1000000000000000000\");\n BigInteger ans = BigInteger.valueOf(1);\n for(int i = 1;i <= tt;i ++)\n {\n int f;\n BigInteger m = cin.nextBigInteger();\n int s = m.compareTo(BigInteger.valueOf(0));\n if (s == 0)\n {\n ans = BigInteger.valueOf(0);\n }\n f = ans.compareTo(t);\n if(s != 0 && f <= 0)\n ans = ans.multiply(m);\n }\n int kk = ans.compareTo(t);\n if(kk <= 0)\n System.out.println(ans);\n else System.out.println(\"-1\\n\");\n }\n}",
"Main"
] |
import java.math.*;
import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner cin = new Scanner(System.in);
int tt;
tt = cin.nextInt();
BigInteger t = new BigInteger("1000000000000000000");
BigInteger ans = BigInteger.valueOf(1);
for(int i = 1;i <= tt;i ++)
{
int f;
BigInteger m = cin.nextBigInteger();
int s = m.compareTo(BigInteger.valueOf(0));
if (s == 0)
{
ans = BigInteger.valueOf(0);
}
f = ans.compareTo(t);
if(s != 0 && f <= 0)
ans = ans.multiply(m);
}
int kk = ans.compareTo(t);
if(kk <= 0)
System.out.println(ans);
else System.out.println("-1\n");
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
41,
13,
17,
41,
13,
4,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
0,
13,
17,
3,
14,
13,
30,
0,
13,
17,
30,
28,
13,
13,
30,
30,
14,
2,
2,
13,
13,
13,
30,
0,
13,
13,
30,
0,
13,
40,
17,
3,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
102,
5
],
[
102,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
8,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
29,
32
],
[
29,
33
],
[
8,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
34,
39
],
[
39,
40
],
[
39,
41
],
[
34,
42
],
[
42,
43
],
[
43,
44
],
[
34,
45
],
[
46,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
52,
53
],
[
46,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
55,
59
],
[
54,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
64
],
[
8,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
65,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
72,
75
],
[
76,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
77,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
77,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
87,
92
],
[
8,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
6,
99
],
[
99,
100
],
[
0,
101
],
[
101,
102
],
[
101,
103
]
] |
[
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tlong v = 1;\n\t\tboolean zeroFlg = false;\n\n\t\tlong max = (long) Math.pow(10, 18);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tzeroFlg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (zeroFlg) {\n\t\t\tv = 0;\n\t\t} else {\n\t\t\tfor (long a1 : a) {\n\t\t\t\tif (max / v >= a1) {\n\t\t\t\t\tv *= a1;\n\t\t\t\t} else {\n\t\t\t\t\tv = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(v);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tlong v = 1;\n\t\tboolean zeroFlg = false;\n\n\t\tlong max = (long) Math.pow(10, 18);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tzeroFlg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (zeroFlg) {\n\t\t\tv = 0;\n\t\t} else {\n\t\t\tfor (long a1 : a) {\n\t\t\t\tif (max / v >= a1) {\n\t\t\t\t\tv *= a1;\n\t\t\t\t} else {\n\t\t\t\t\tv = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(v);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tlong v = 1;\n\t\tboolean zeroFlg = false;\n\n\t\tlong max = (long) Math.pow(10, 18);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tzeroFlg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (zeroFlg) {\n\t\t\tv = 0;\n\t\t} else {\n\t\t\tfor (long a1 : a) {\n\t\t\t\tif (max / v >= a1) {\n\t\t\t\t\tv *= a1;\n\t\t\t\t} else {\n\t\t\t\t\tv = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(v);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tlong v = 1;\n\t\tboolean zeroFlg = false;\n\n\t\tlong max = (long) Math.pow(10, 18);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tzeroFlg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (zeroFlg) {\n\t\t\tv = 0;\n\t\t} else {\n\t\t\tfor (long a1 : a) {\n\t\t\t\tif (max / v >= a1) {\n\t\t\t\t\tv *= a1;\n\t\t\t\t} else {\n\t\t\t\t\tv = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(v);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"long v = 1;",
"v",
"1",
"boolean zeroFlg = false;",
"zeroFlg",
"false",
"long max = (long) Math.pow(10, 18);",
"max",
"(long) Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"for (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tzeroFlg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tzeroFlg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"{\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tzeroFlg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (a[i] == 0) {\n\t\t\t\tzeroFlg = true;\n\t\t\t\tbreak;\n\t\t\t}",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"{\n\t\t\t\tzeroFlg = true;\n\t\t\t\tbreak;\n\t\t\t}",
"zeroFlg = true",
"zeroFlg",
"true",
"break;",
"if (zeroFlg) {\n\t\t\tv = 0;\n\t\t} else {\n\t\t\tfor (long a1 : a) {\n\t\t\t\tif (max / v >= a1) {\n\t\t\t\t\tv *= a1;\n\t\t\t\t} else {\n\t\t\t\t\tv = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"zeroFlg",
"{\n\t\t\tv = 0;\n\t\t}",
"v = 0",
"v",
"0",
"{\n\t\t\tfor (long a1 : a) {\n\t\t\t\tif (max / v >= a1) {\n\t\t\t\t\tv *= a1;\n\t\t\t\t} else {\n\t\t\t\t\tv = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for (long a1 : a) {\n\t\t\t\tif (max / v >= a1) {\n\t\t\t\t\tv *= a1;\n\t\t\t\t} else {\n\t\t\t\t\tv = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"long a1",
"a",
"{\n\t\t\t\tif (max / v >= a1) {\n\t\t\t\t\tv *= a1;\n\t\t\t\t} else {\n\t\t\t\t\tv = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (max / v >= a1) {\n\t\t\t\t\tv *= a1;\n\t\t\t\t} else {\n\t\t\t\t\tv = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"if (max / v >= a1) {\n\t\t\t\t\tv *= a1;\n\t\t\t\t} else {\n\t\t\t\t\tv = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"max / v >= a1",
"max / v",
"max",
"v",
"a1",
"{\n\t\t\t\t\tv *= a1;\n\t\t\t\t}",
"v *= a1",
"v",
"a1",
"{\n\t\t\t\t\tv = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"v = -1",
"v",
"-1",
"1",
"break;",
"System.out.println(v)",
"System.out.println",
"System.out",
"System",
"System.out",
"v",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tlong v = 1;\n\t\tboolean zeroFlg = false;\n\n\t\tlong max = (long) Math.pow(10, 18);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tzeroFlg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (zeroFlg) {\n\t\t\tv = 0;\n\t\t} else {\n\t\t\tfor (long a1 : a) {\n\t\t\t\tif (max / v >= a1) {\n\t\t\t\t\tv *= a1;\n\t\t\t\t} else {\n\t\t\t\t\tv = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(v);\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tlong v = 1;\n\t\tboolean zeroFlg = false;\n\n\t\tlong max = (long) Math.pow(10, 18);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t\tif (a[i] == 0) {\n\t\t\t\tzeroFlg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (zeroFlg) {\n\t\t\tv = 0;\n\t\t} else {\n\t\t\tfor (long a1 : a) {\n\t\t\t\tif (max / v >= a1) {\n\t\t\t\t\tv *= a1;\n\t\t\t\t} else {\n\t\t\t\t\tv = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(v);\n\t}\n}",
"Main"
] |
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];
long v = 1;
boolean zeroFlg = false;
long max = (long) Math.pow(10, 18);
for (int i = 0; i < n; i++) {
a[i] = sc.nextLong();
if (a[i] == 0) {
zeroFlg = true;
break;
}
}
if (zeroFlg) {
v = 0;
} else {
for (long a1 : a) {
if (max / v >= a1) {
v *= a1;
} else {
v = -1;
break;
}
}
}
System.out.println(v);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
17,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
2,
2,
17,
13,
17,
14,
4,
18,
13,
17,
4,
18,
18,
13,
13,
17,
30,
41,
13,
4,
18,
13,
17,
41,
13,
17,
41,
13,
17,
42,
2,
40,
13,
17,
30,
41,
13,
4,
18,
13,
18,
13,
13,
0,
13,
4,
18,
13,
13,
0,
13,
13,
14,
2,
2,
2,
13,
17,
2,
13,
13,
2,
13,
17,
4,
18,
18,
13,
13,
40,
17,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
121,
11
],
[
121,
12
],
[
12,
13
],
[
12,
14
],
[
121,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
17,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
17,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
34,
35
],
[
17,
36
],
[
36,
37
],
[
36,
38
],
[
39,
39
],
[
39,
40
],
[
39,
41
],
[
39,
42
],
[
17,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
44,
47
],
[
43,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
48,
53
],
[
43,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
58,
59
],
[
57,
60
],
[
54,
61
],
[
61,
62
],
[
61,
63
],
[
54,
64
],
[
64,
65
],
[
64,
66
],
[
54,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
67,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
78,
79
],
[
78,
80
],
[
72,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
84,
85
],
[
83,
86
],
[
72,
87
],
[
87,
88
],
[
87,
89
],
[
54,
90
],
[
90,
91
],
[
92,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
96,
98
],
[
92,
99
],
[
99,
100
],
[
99,
101
],
[
90,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
102,
107
],
[
107,
108
],
[
90,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
109,
114
],
[
17,
115
],
[
115,
116
],
[
116,
117
],
[
15,
118
],
[
118,
119
],
[
0,
120
],
[
120,
121
],
[
120,
122
]
] |
[
"import java.math.BigInteger;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\tstatic long max = 1000000000000000000L;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tString eatEmpty = sc.nextLine();\n\t\tString input = sc.nextLine();\n\t\tString tempInput = \" \" + input + \" \";\n\t\tif (tempInput.contains(\" 0 \"))\n\t\t\tSystem.out.println(0);\n\t\telse {\n\t\t\tString nums[] = input.split(\" \");\n\t\t\tdouble logAns = 0;\n\t\t\tlong ans = 1;\n\t\t\twhile (--N >= 0) {\n\t\t\t\tlong temp = Long.parseLong(nums[N]);\n\t\t\t\tlogAns += Math.log10(temp);\n\t\t\t\tans *= temp;\n\t\t\t}\n//\t\t\tSystem.out.println(logAns + \" \" + ans + \" \" + max);\n\t\t\tif (logAns > 18.1 || ans > max || ans <= 0)\n\t\t\t\tSystem.out.println(-1);\n\t\t\telse\n\t\t\t\tSystem.out.println(ans);\n\t\t}\n\t\tsc.close();\n\n\t}\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tstatic long max = 1000000000000000000L;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tString eatEmpty = sc.nextLine();\n\t\tString input = sc.nextLine();\n\t\tString tempInput = \" \" + input + \" \";\n\t\tif (tempInput.contains(\" 0 \"))\n\t\t\tSystem.out.println(0);\n\t\telse {\n\t\t\tString nums[] = input.split(\" \");\n\t\t\tdouble logAns = 0;\n\t\t\tlong ans = 1;\n\t\t\twhile (--N >= 0) {\n\t\t\t\tlong temp = Long.parseLong(nums[N]);\n\t\t\t\tlogAns += Math.log10(temp);\n\t\t\t\tans *= temp;\n\t\t\t}\n//\t\t\tSystem.out.println(logAns + \" \" + ans + \" \" + max);\n\t\t\tif (logAns > 18.1 || ans > max || ans <= 0)\n\t\t\t\tSystem.out.println(-1);\n\t\t\telse\n\t\t\t\tSystem.out.println(ans);\n\t\t}\n\t\tsc.close();\n\n\t}\n}",
"Main",
"static long max = 1000000000000000000L;",
"max",
"1000000000000000000L",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tString eatEmpty = sc.nextLine();\n\t\tString input = sc.nextLine();\n\t\tString tempInput = \" \" + input + \" \";\n\t\tif (tempInput.contains(\" 0 \"))\n\t\t\tSystem.out.println(0);\n\t\telse {\n\t\t\tString nums[] = input.split(\" \");\n\t\t\tdouble logAns = 0;\n\t\t\tlong ans = 1;\n\t\t\twhile (--N >= 0) {\n\t\t\t\tlong temp = Long.parseLong(nums[N]);\n\t\t\t\tlogAns += Math.log10(temp);\n\t\t\t\tans *= temp;\n\t\t\t}\n//\t\t\tSystem.out.println(logAns + \" \" + ans + \" \" + max);\n\t\t\tif (logAns > 18.1 || ans > max || ans <= 0)\n\t\t\t\tSystem.out.println(-1);\n\t\t\telse\n\t\t\t\tSystem.out.println(ans);\n\t\t}\n\t\tsc.close();\n\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tString eatEmpty = sc.nextLine();\n\t\tString input = sc.nextLine();\n\t\tString tempInput = \" \" + input + \" \";\n\t\tif (tempInput.contains(\" 0 \"))\n\t\t\tSystem.out.println(0);\n\t\telse {\n\t\t\tString nums[] = input.split(\" \");\n\t\t\tdouble logAns = 0;\n\t\t\tlong ans = 1;\n\t\t\twhile (--N >= 0) {\n\t\t\t\tlong temp = Long.parseLong(nums[N]);\n\t\t\t\tlogAns += Math.log10(temp);\n\t\t\t\tans *= temp;\n\t\t\t}\n//\t\t\tSystem.out.println(logAns + \" \" + ans + \" \" + max);\n\t\t\tif (logAns > 18.1 || ans > max || ans <= 0)\n\t\t\t\tSystem.out.println(-1);\n\t\t\telse\n\t\t\t\tSystem.out.println(ans);\n\t\t}\n\t\tsc.close();\n\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"String eatEmpty = sc.nextLine();",
"eatEmpty",
"sc.nextLine()",
"sc.nextLine",
"sc",
"String input = sc.nextLine();",
"input",
"sc.nextLine()",
"sc.nextLine",
"sc",
"String tempInput = \" \" + input + \" \";",
"tempInput",
"\" \" + input + \" \"",
"\" \" + input + \" \"",
"\" \"",
"input",
"\" \"",
"if (tempInput.contains(\" 0 \"))\n\t\t\tSystem.out.println(0);\n\t\telse {\n\t\t\tString nums[] = input.split(\" \");\n\t\t\tdouble logAns = 0;\n\t\t\tlong ans = 1;\n\t\t\twhile (--N >= 0) {\n\t\t\t\tlong temp = Long.parseLong(nums[N]);\n\t\t\t\tlogAns += Math.log10(temp);\n\t\t\t\tans *= temp;\n\t\t\t}\n//\t\t\tSystem.out.println(logAns + \" \" + ans + \" \" + max);\n\t\t\tif (logAns > 18.1 || ans > max || ans <= 0)\n\t\t\t\tSystem.out.println(-1);\n\t\t\telse\n\t\t\t\tSystem.out.println(ans);\n\t\t}",
"tempInput.contains(\" 0 \")",
"tempInput.contains",
"tempInput",
"\" 0 \"",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"{\n\t\t\tString nums[] = input.split(\" \");\n\t\t\tdouble logAns = 0;\n\t\t\tlong ans = 1;\n\t\t\twhile (--N >= 0) {\n\t\t\t\tlong temp = Long.parseLong(nums[N]);\n\t\t\t\tlogAns += Math.log10(temp);\n\t\t\t\tans *= temp;\n\t\t\t}\n//\t\t\tSystem.out.println(logAns + \" \" + ans + \" \" + max);\n\t\t\tif (logAns > 18.1 || ans > max || ans <= 0)\n\t\t\t\tSystem.out.println(-1);\n\t\t\telse\n\t\t\t\tSystem.out.println(ans);\n\t\t}",
"String nums[] = input.split(\" \");",
"nums",
"input.split(\" \")",
"input.split",
"input",
"\" \"",
"double logAns = 0;",
"logAns",
"0",
"long ans = 1;",
"ans",
"1",
"while (--N >= 0) {\n\t\t\t\tlong temp = Long.parseLong(nums[N]);\n\t\t\t\tlogAns += Math.log10(temp);\n\t\t\t\tans *= temp;\n\t\t\t}",
"--N >= 0",
"--N",
"N",
"0",
"{\n\t\t\t\tlong temp = Long.parseLong(nums[N]);\n\t\t\t\tlogAns += Math.log10(temp);\n\t\t\t\tans *= temp;\n\t\t\t}",
"long temp = Long.parseLong(nums[N]);",
"temp",
"Long.parseLong(nums[N])",
"Long.parseLong",
"Long",
"nums[N]",
"nums",
"N",
"logAns += Math.log10(temp)",
"logAns",
"Math.log10(temp)",
"Math.log10",
"Math",
"temp",
"ans *= temp",
"ans",
"temp",
"if (logAns > 18.1 || ans > max || ans <= 0)\n\t\t\t\tSystem.out.println(-1);\n\t\t\telse\n\t\t\t\tSystem.out.println(ans);",
"logAns > 18.1 || ans > max || ans <= 0",
"logAns > 18.1 || ans > max || ans <= 0",
"logAns > 18.1",
"logAns",
"18.1",
"ans > max",
"ans",
"max",
"ans <= 0",
"ans",
"0",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"public class Main {\n\tstatic long max = 1000000000000000000L;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tString eatEmpty = sc.nextLine();\n\t\tString input = sc.nextLine();\n\t\tString tempInput = \" \" + input + \" \";\n\t\tif (tempInput.contains(\" 0 \"))\n\t\t\tSystem.out.println(0);\n\t\telse {\n\t\t\tString nums[] = input.split(\" \");\n\t\t\tdouble logAns = 0;\n\t\t\tlong ans = 1;\n\t\t\twhile (--N >= 0) {\n\t\t\t\tlong temp = Long.parseLong(nums[N]);\n\t\t\t\tlogAns += Math.log10(temp);\n\t\t\t\tans *= temp;\n\t\t\t}\n//\t\t\tSystem.out.println(logAns + \" \" + ans + \" \" + max);\n\t\t\tif (logAns > 18.1 || ans > max || ans <= 0)\n\t\t\t\tSystem.out.println(-1);\n\t\t\telse\n\t\t\t\tSystem.out.println(ans);\n\t\t}\n\t\tsc.close();\n\n\t}\n}",
"public class Main {\n\tstatic long max = 1000000000000000000L;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tString eatEmpty = sc.nextLine();\n\t\tString input = sc.nextLine();\n\t\tString tempInput = \" \" + input + \" \";\n\t\tif (tempInput.contains(\" 0 \"))\n\t\t\tSystem.out.println(0);\n\t\telse {\n\t\t\tString nums[] = input.split(\" \");\n\t\t\tdouble logAns = 0;\n\t\t\tlong ans = 1;\n\t\t\twhile (--N >= 0) {\n\t\t\t\tlong temp = Long.parseLong(nums[N]);\n\t\t\t\tlogAns += Math.log10(temp);\n\t\t\t\tans *= temp;\n\t\t\t}\n//\t\t\tSystem.out.println(logAns + \" \" + ans + \" \" + max);\n\t\t\tif (logAns > 18.1 || ans > max || ans <= 0)\n\t\t\t\tSystem.out.println(-1);\n\t\t\telse\n\t\t\t\tSystem.out.println(ans);\n\t\t}\n\t\tsc.close();\n\n\t}\n}",
"Main"
] |
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
static long max = 1000000000000000000L;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
String eatEmpty = sc.nextLine();
String input = sc.nextLine();
String tempInput = " " + input + " ";
if (tempInput.contains(" 0 "))
System.out.println(0);
else {
String nums[] = input.split(" ");
double logAns = 0;
long ans = 1;
while (--N >= 0) {
long temp = Long.parseLong(nums[N]);
logAns += Math.log10(temp);
ans *= temp;
}
// System.out.println(logAns + " " + ans + " " + max);
if (logAns > 18.1 || ans > max || ans <= 0)
System.out.println(-1);
else
System.out.println(ans);
}
sc.close();
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
14,
2,
2,
18,
13,
13,
13,
2,
18,
13,
13,
2,
13,
13,
30,
0,
13,
2,
13,
18,
13,
13,
30,
0,
13,
40,
17,
3,
30,
0,
13,
17,
3,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
116,
5
],
[
116,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
42,
43
],
[
41,
44
],
[
8,
45
],
[
45,
46
],
[
45,
47
],
[
8,
48
],
[
48,
49
],
[
48,
50
],
[
8,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
56,
57
],
[
56,
58
],
[
51,
59
],
[
59,
60
],
[
60,
61
],
[
51,
62
],
[
63,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
64,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
72,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
82,
84
],
[
71,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
71,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
93,
98
],
[
64,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
8,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
8,
110
],
[
110,
111
],
[
111,
112
],
[
6,
113
],
[
113,
114
],
[
0,
115
],
[
115,
116
],
[
115,
117
]
] |
[
"import java.util.*;\n\npublic class Main {\npublic static void main(String[] args) {\n\t\t\n\t\tScanner keyboard = new Scanner(System.in); \n\t\t\n\t\tint N= keyboard.nextInt();\n\t\tlong[] a = new long[N];\n\t\t\n\t\tfor(int i =0; i<N; i++) {\n\t\t\ta[i] = keyboard.nextLong();\t\t\t\n\t\t}\n\t\tArrays.sort(a);\n\t\t\n\t\tlong cons = 1000000000000000000L;\n\t\tlong ans = 1 ;\n\t\t\n\t\tfor(int j=0; j<N; j++) {\n\t\t\tif(a[j] !=0) {\n\t\t\t\tif(a[j]<=cons && a[j] <= cons/ans) {\n\t\t\t\t\tans = ans*a[j];\t\n\t\t\t\t}else {\n\t\t\t\t\tans = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.print(ans);\n\t\tkeyboard.close();\t\n\t\t\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\npublic static void main(String[] args) {\n\t\t\n\t\tScanner keyboard = new Scanner(System.in); \n\t\t\n\t\tint N= keyboard.nextInt();\n\t\tlong[] a = new long[N];\n\t\t\n\t\tfor(int i =0; i<N; i++) {\n\t\t\ta[i] = keyboard.nextLong();\t\t\t\n\t\t}\n\t\tArrays.sort(a);\n\t\t\n\t\tlong cons = 1000000000000000000L;\n\t\tlong ans = 1 ;\n\t\t\n\t\tfor(int j=0; j<N; j++) {\n\t\t\tif(a[j] !=0) {\n\t\t\t\tif(a[j]<=cons && a[j] <= cons/ans) {\n\t\t\t\t\tans = ans*a[j];\t\n\t\t\t\t}else {\n\t\t\t\t\tans = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.print(ans);\n\t\tkeyboard.close();\t\n\t\t\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\t\n\t\tScanner keyboard = new Scanner(System.in); \n\t\t\n\t\tint N= keyboard.nextInt();\n\t\tlong[] a = new long[N];\n\t\t\n\t\tfor(int i =0; i<N; i++) {\n\t\t\ta[i] = keyboard.nextLong();\t\t\t\n\t\t}\n\t\tArrays.sort(a);\n\t\t\n\t\tlong cons = 1000000000000000000L;\n\t\tlong ans = 1 ;\n\t\t\n\t\tfor(int j=0; j<N; j++) {\n\t\t\tif(a[j] !=0) {\n\t\t\t\tif(a[j]<=cons && a[j] <= cons/ans) {\n\t\t\t\t\tans = ans*a[j];\t\n\t\t\t\t}else {\n\t\t\t\t\tans = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.print(ans);\n\t\tkeyboard.close();\t\n\t\t\n\t}",
"main",
"{\n\t\t\n\t\tScanner keyboard = new Scanner(System.in); \n\t\t\n\t\tint N= keyboard.nextInt();\n\t\tlong[] a = new long[N];\n\t\t\n\t\tfor(int i =0; i<N; i++) {\n\t\t\ta[i] = keyboard.nextLong();\t\t\t\n\t\t}\n\t\tArrays.sort(a);\n\t\t\n\t\tlong cons = 1000000000000000000L;\n\t\tlong ans = 1 ;\n\t\t\n\t\tfor(int j=0; j<N; j++) {\n\t\t\tif(a[j] !=0) {\n\t\t\t\tif(a[j]<=cons && a[j] <= cons/ans) {\n\t\t\t\t\tans = ans*a[j];\t\n\t\t\t\t}else {\n\t\t\t\t\tans = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.print(ans);\n\t\tkeyboard.close();\t\n\t\t\n\t}",
"Scanner keyboard = new Scanner(System.in);",
"keyboard",
"new Scanner(System.in)",
"int N= keyboard.nextInt();",
"N",
"keyboard.nextInt()",
"keyboard.nextInt",
"keyboard",
"long[] a = new long[N];",
"a",
"new long[N]",
"N",
"for(int i =0; i<N; i++) {\n\t\t\ta[i] = keyboard.nextLong();\t\t\t\n\t\t}",
"int i =0;",
"int i =0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = keyboard.nextLong();\t\t\t\n\t\t}",
"{\n\t\t\ta[i] = keyboard.nextLong();\t\t\t\n\t\t}",
"a[i] = keyboard.nextLong()",
"a[i]",
"a",
"i",
"keyboard.nextLong()",
"keyboard.nextLong",
"keyboard",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"long cons = 1000000000000000000L;",
"cons",
"1000000000000000000L",
"long ans = 1 ;",
"ans",
"1",
"for(int j=0; j<N; j++) {\n\t\t\tif(a[j] !=0) {\n\t\t\t\tif(a[j]<=cons && a[j] <= cons/ans) {\n\t\t\t\t\tans = ans*a[j];\t\n\t\t\t\t}else {\n\t\t\t\t\tans = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"int j=0;",
"int j=0;",
"j",
"0",
"j<N",
"j",
"N",
"j++",
"j++",
"j",
"{\n\t\t\tif(a[j] !=0) {\n\t\t\t\tif(a[j]<=cons && a[j] <= cons/ans) {\n\t\t\t\t\tans = ans*a[j];\t\n\t\t\t\t}else {\n\t\t\t\t\tans = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(a[j] !=0) {\n\t\t\t\tif(a[j]<=cons && a[j] <= cons/ans) {\n\t\t\t\t\tans = ans*a[j];\t\n\t\t\t\t}else {\n\t\t\t\t\tans = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"if(a[j] !=0) {\n\t\t\t\tif(a[j]<=cons && a[j] <= cons/ans) {\n\t\t\t\t\tans = ans*a[j];\t\n\t\t\t\t}else {\n\t\t\t\t\tans = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}",
"a[j] !=0",
"a[j]",
"a",
"j",
"0",
"{\n\t\t\t\tif(a[j]<=cons && a[j] <= cons/ans) {\n\t\t\t\t\tans = ans*a[j];\t\n\t\t\t\t}else {\n\t\t\t\t\tans = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"if(a[j]<=cons && a[j] <= cons/ans) {\n\t\t\t\t\tans = ans*a[j];\t\n\t\t\t\t}else {\n\t\t\t\t\tans = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"a[j]<=cons && a[j] <= cons/ans",
"a[j]<=cons",
"a[j]",
"a",
"j",
"cons",
"a[j] <= cons/ans",
"a[j]",
"a",
"j",
"cons/ans",
"cons",
"ans",
"{\n\t\t\t\t\tans = ans*a[j];\t\n\t\t\t\t}",
"ans = ans*a[j]",
"ans",
"ans*a[j]",
"ans",
"a[j]",
"a",
"j",
"{\n\t\t\t\t\tans = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"ans = -1",
"ans",
"-1",
"1",
"break;",
"{\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}",
"ans = 0",
"ans",
"0",
"break;",
"System.out.print(ans)",
"System.out.print",
"System.out",
"System",
"System.out",
"ans",
"keyboard.close()",
"keyboard.close",
"keyboard",
"String[] args",
"args",
"public class Main {\npublic static void main(String[] args) {\n\t\t\n\t\tScanner keyboard = new Scanner(System.in); \n\t\t\n\t\tint N= keyboard.nextInt();\n\t\tlong[] a = new long[N];\n\t\t\n\t\tfor(int i =0; i<N; i++) {\n\t\t\ta[i] = keyboard.nextLong();\t\t\t\n\t\t}\n\t\tArrays.sort(a);\n\t\t\n\t\tlong cons = 1000000000000000000L;\n\t\tlong ans = 1 ;\n\t\t\n\t\tfor(int j=0; j<N; j++) {\n\t\t\tif(a[j] !=0) {\n\t\t\t\tif(a[j]<=cons && a[j] <= cons/ans) {\n\t\t\t\t\tans = ans*a[j];\t\n\t\t\t\t}else {\n\t\t\t\t\tans = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.print(ans);\n\t\tkeyboard.close();\t\n\t\t\n\t}\n}",
"public class Main {\npublic static void main(String[] args) {\n\t\t\n\t\tScanner keyboard = new Scanner(System.in); \n\t\t\n\t\tint N= keyboard.nextInt();\n\t\tlong[] a = new long[N];\n\t\t\n\t\tfor(int i =0; i<N; i++) {\n\t\t\ta[i] = keyboard.nextLong();\t\t\t\n\t\t}\n\t\tArrays.sort(a);\n\t\t\n\t\tlong cons = 1000000000000000000L;\n\t\tlong ans = 1 ;\n\t\t\n\t\tfor(int j=0; j<N; j++) {\n\t\t\tif(a[j] !=0) {\n\t\t\t\tif(a[j]<=cons && a[j] <= cons/ans) {\n\t\t\t\t\tans = ans*a[j];\t\n\t\t\t\t}else {\n\t\t\t\t\tans = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.print(ans);\n\t\tkeyboard.close();\t\n\t\t\n\t}\n}",
"Main"
] |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
int N= keyboard.nextInt();
long[] a = new long[N];
for(int i =0; i<N; i++) {
a[i] = keyboard.nextLong();
}
Arrays.sort(a);
long cons = 1000000000000000000L;
long ans = 1 ;
for(int j=0; j<N; j++) {
if(a[j] !=0) {
if(a[j]<=cons && a[j] <= cons/ans) {
ans = ans*a[j];
}else {
ans = -1;
break;
}
}else{
ans = 0;
break;
}
}
System.out.print(ans);
keyboard.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
41,
13,
20,
41,
13,
17,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
2,
2,
17,
13,
17,
14,
4,
18,
13,
17,
30,
0,
13,
17,
4,
18,
18,
13,
13,
17,
30,
41,
13,
4,
18,
13,
17,
42,
2,
40,
13,
17,
30,
14,
2,
2,
13,
17,
2,
4,
18,
13,
13,
17,
30,
41,
13,
20,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
0,
13,
17,
3,
4,
18,
18,
13,
13,
8,
2,
2,
13,
17,
2,
4,
18,
13,
13,
17,
40,
17,
13,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
132,
11
],
[
132,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
14,
26
],
[
26,
27
],
[
26,
28
],
[
14,
29
],
[
29,
30
],
[
29,
31
],
[
14,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
14,
37
],
[
37,
38
],
[
37,
39
],
[
39,
40
],
[
40,
41
],
[
14,
42
],
[
42,
43
],
[
42,
44
],
[
45,
45
],
[
45,
46
],
[
45,
47
],
[
45,
48
],
[
14,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
50,
53
],
[
49,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
58,
63
],
[
49,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
64,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
72,
75
],
[
71,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
83,
86
],
[
82,
87
],
[
77,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
94,
97
],
[
77,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
64,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
118,
121
],
[
117,
122
],
[
112,
123
],
[
123,
124
],
[
112,
125
],
[
14,
126
],
[
126,
127
],
[
127,
128
],
[
12,
129
],
[
129,
130
],
[
0,
131
],
[
131,
132
],
[
131,
133
]
] |
[
"import java.math.BigInteger;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tBigInteger ans = new BigInteger(\"1\");\n\t\tBigInteger max = new BigInteger((long) Math.pow(10, 18) + \"\");\n\t\tint flag = 0;\n\t\tString eatEmpty = sc.nextLine();\n\t\tString input = sc.nextLine();\n\t\tString tempInput = \" \" + input + \" \";\n\t\tif (tempInput.contains(\" 0 \")) {\n\t\t\tflag = 1;\n\t\t\tSystem.out.println(0);\n\t\t} else {\n\t\t\tString nums[] = input.split(\" \");\n//\t\t\tSystem.out.println(Arrays.toString(nums));\n\t\t\twhile (--N >= 0) {\n\t\t\t\tif (flag == 0 && max.compareTo(ans) >= 0) {\n\t\t\t\t\tBigInteger a = new BigInteger(nums[N]);\n\t\t\t\t\tans = ans.multiply(a);\n\t\t\t\t} else if (flag == 0) {\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println((flag == 1 || max.compareTo(ans) < 0) ? -1 : ans);\n\t\t}\n\t\tsc.close();\n\t}\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tBigInteger ans = new BigInteger(\"1\");\n\t\tBigInteger max = new BigInteger((long) Math.pow(10, 18) + \"\");\n\t\tint flag = 0;\n\t\tString eatEmpty = sc.nextLine();\n\t\tString input = sc.nextLine();\n\t\tString tempInput = \" \" + input + \" \";\n\t\tif (tempInput.contains(\" 0 \")) {\n\t\t\tflag = 1;\n\t\t\tSystem.out.println(0);\n\t\t} else {\n\t\t\tString nums[] = input.split(\" \");\n//\t\t\tSystem.out.println(Arrays.toString(nums));\n\t\t\twhile (--N >= 0) {\n\t\t\t\tif (flag == 0 && max.compareTo(ans) >= 0) {\n\t\t\t\t\tBigInteger a = new BigInteger(nums[N]);\n\t\t\t\t\tans = ans.multiply(a);\n\t\t\t\t} else if (flag == 0) {\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println((flag == 1 || max.compareTo(ans) < 0) ? -1 : ans);\n\t\t}\n\t\tsc.close();\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tBigInteger ans = new BigInteger(\"1\");\n\t\tBigInteger max = new BigInteger((long) Math.pow(10, 18) + \"\");\n\t\tint flag = 0;\n\t\tString eatEmpty = sc.nextLine();\n\t\tString input = sc.nextLine();\n\t\tString tempInput = \" \" + input + \" \";\n\t\tif (tempInput.contains(\" 0 \")) {\n\t\t\tflag = 1;\n\t\t\tSystem.out.println(0);\n\t\t} else {\n\t\t\tString nums[] = input.split(\" \");\n//\t\t\tSystem.out.println(Arrays.toString(nums));\n\t\t\twhile (--N >= 0) {\n\t\t\t\tif (flag == 0 && max.compareTo(ans) >= 0) {\n\t\t\t\t\tBigInteger a = new BigInteger(nums[N]);\n\t\t\t\t\tans = ans.multiply(a);\n\t\t\t\t} else if (flag == 0) {\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println((flag == 1 || max.compareTo(ans) < 0) ? -1 : ans);\n\t\t}\n\t\tsc.close();\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tBigInteger ans = new BigInteger(\"1\");\n\t\tBigInteger max = new BigInteger((long) Math.pow(10, 18) + \"\");\n\t\tint flag = 0;\n\t\tString eatEmpty = sc.nextLine();\n\t\tString input = sc.nextLine();\n\t\tString tempInput = \" \" + input + \" \";\n\t\tif (tempInput.contains(\" 0 \")) {\n\t\t\tflag = 1;\n\t\t\tSystem.out.println(0);\n\t\t} else {\n\t\t\tString nums[] = input.split(\" \");\n//\t\t\tSystem.out.println(Arrays.toString(nums));\n\t\t\twhile (--N >= 0) {\n\t\t\t\tif (flag == 0 && max.compareTo(ans) >= 0) {\n\t\t\t\t\tBigInteger a = new BigInteger(nums[N]);\n\t\t\t\t\tans = ans.multiply(a);\n\t\t\t\t} else if (flag == 0) {\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println((flag == 1 || max.compareTo(ans) < 0) ? -1 : ans);\n\t\t}\n\t\tsc.close();\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BigInteger ans = new BigInteger(\"1\");",
"ans",
"new BigInteger(\"1\")",
"BigInteger max = new BigInteger((long) Math.pow(10, 18) + \"\");",
"max",
"new BigInteger((long) Math.pow(10, 18) + \"\")",
"int flag = 0;",
"flag",
"0",
"String eatEmpty = sc.nextLine();",
"eatEmpty",
"sc.nextLine()",
"sc.nextLine",
"sc",
"String input = sc.nextLine();",
"input",
"sc.nextLine()",
"sc.nextLine",
"sc",
"String tempInput = \" \" + input + \" \";",
"tempInput",
"\" \" + input + \" \"",
"\" \" + input + \" \"",
"\" \"",
"input",
"\" \"",
"if (tempInput.contains(\" 0 \")) {\n\t\t\tflag = 1;\n\t\t\tSystem.out.println(0);\n\t\t} else {\n\t\t\tString nums[] = input.split(\" \");\n//\t\t\tSystem.out.println(Arrays.toString(nums));\n\t\t\twhile (--N >= 0) {\n\t\t\t\tif (flag == 0 && max.compareTo(ans) >= 0) {\n\t\t\t\t\tBigInteger a = new BigInteger(nums[N]);\n\t\t\t\t\tans = ans.multiply(a);\n\t\t\t\t} else if (flag == 0) {\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println((flag == 1 || max.compareTo(ans) < 0) ? -1 : ans);\n\t\t}",
"tempInput.contains(\" 0 \")",
"tempInput.contains",
"tempInput",
"\" 0 \"",
"{\n\t\t\tflag = 1;\n\t\t\tSystem.out.println(0);\n\t\t}",
"flag = 1",
"flag",
"1",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"{\n\t\t\tString nums[] = input.split(\" \");\n//\t\t\tSystem.out.println(Arrays.toString(nums));\n\t\t\twhile (--N >= 0) {\n\t\t\t\tif (flag == 0 && max.compareTo(ans) >= 0) {\n\t\t\t\t\tBigInteger a = new BigInteger(nums[N]);\n\t\t\t\t\tans = ans.multiply(a);\n\t\t\t\t} else if (flag == 0) {\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println((flag == 1 || max.compareTo(ans) < 0) ? -1 : ans);\n\t\t}",
"String nums[] = input.split(\" \");",
"nums",
"input.split(\" \")",
"input.split",
"input",
"\" \"",
"while (--N >= 0) {\n\t\t\t\tif (flag == 0 && max.compareTo(ans) >= 0) {\n\t\t\t\t\tBigInteger a = new BigInteger(nums[N]);\n\t\t\t\t\tans = ans.multiply(a);\n\t\t\t\t} else if (flag == 0) {\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"--N >= 0",
"--N",
"N",
"0",
"{\n\t\t\t\tif (flag == 0 && max.compareTo(ans) >= 0) {\n\t\t\t\t\tBigInteger a = new BigInteger(nums[N]);\n\t\t\t\t\tans = ans.multiply(a);\n\t\t\t\t} else if (flag == 0) {\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"if (flag == 0 && max.compareTo(ans) >= 0) {\n\t\t\t\t\tBigInteger a = new BigInteger(nums[N]);\n\t\t\t\t\tans = ans.multiply(a);\n\t\t\t\t} else if (flag == 0) {\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"flag == 0 && max.compareTo(ans) >= 0",
"flag == 0",
"flag",
"0",
"max.compareTo(ans) >= 0",
"max.compareTo(ans)",
"max.compareTo",
"max",
"ans",
"0",
"{\n\t\t\t\t\tBigInteger a = new BigInteger(nums[N]);\n\t\t\t\t\tans = ans.multiply(a);\n\t\t\t\t}",
"BigInteger a = new BigInteger(nums[N]);",
"a",
"new BigInteger(nums[N])",
"ans = ans.multiply(a)",
"ans",
"ans.multiply(a)",
"ans.multiply",
"ans",
"a",
"if (flag == 0) {\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"flag == 0",
"flag",
"0",
"{\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"flag = 1",
"flag",
"1",
"break;",
"System.out.println((flag == 1 || max.compareTo(ans) < 0) ? -1 : ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"(flag == 1 || max.compareTo(ans) < 0) ? -1 : ans",
"(flag == 1 || max.compareTo(ans) < 0)",
"flag == 1",
"flag",
"1",
"max.compareTo(ans) < 0",
"max.compareTo(ans)",
"max.compareTo",
"max",
"ans",
"0",
"-1",
"1",
"ans",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tBigInteger ans = new BigInteger(\"1\");\n\t\tBigInteger max = new BigInteger((long) Math.pow(10, 18) + \"\");\n\t\tint flag = 0;\n\t\tString eatEmpty = sc.nextLine();\n\t\tString input = sc.nextLine();\n\t\tString tempInput = \" \" + input + \" \";\n\t\tif (tempInput.contains(\" 0 \")) {\n\t\t\tflag = 1;\n\t\t\tSystem.out.println(0);\n\t\t} else {\n\t\t\tString nums[] = input.split(\" \");\n//\t\t\tSystem.out.println(Arrays.toString(nums));\n\t\t\twhile (--N >= 0) {\n\t\t\t\tif (flag == 0 && max.compareTo(ans) >= 0) {\n\t\t\t\t\tBigInteger a = new BigInteger(nums[N]);\n\t\t\t\t\tans = ans.multiply(a);\n\t\t\t\t} else if (flag == 0) {\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println((flag == 1 || max.compareTo(ans) < 0) ? -1 : ans);\n\t\t}\n\t\tsc.close();\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tBigInteger ans = new BigInteger(\"1\");\n\t\tBigInteger max = new BigInteger((long) Math.pow(10, 18) + \"\");\n\t\tint flag = 0;\n\t\tString eatEmpty = sc.nextLine();\n\t\tString input = sc.nextLine();\n\t\tString tempInput = \" \" + input + \" \";\n\t\tif (tempInput.contains(\" 0 \")) {\n\t\t\tflag = 1;\n\t\t\tSystem.out.println(0);\n\t\t} else {\n\t\t\tString nums[] = input.split(\" \");\n//\t\t\tSystem.out.println(Arrays.toString(nums));\n\t\t\twhile (--N >= 0) {\n\t\t\t\tif (flag == 0 && max.compareTo(ans) >= 0) {\n\t\t\t\t\tBigInteger a = new BigInteger(nums[N]);\n\t\t\t\t\tans = ans.multiply(a);\n\t\t\t\t} else if (flag == 0) {\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println((flag == 1 || max.compareTo(ans) < 0) ? -1 : ans);\n\t\t}\n\t\tsc.close();\n\t}\n}",
"Main"
] |
import java.math.BigInteger;
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();
BigInteger ans = new BigInteger("1");
BigInteger max = new BigInteger((long) Math.pow(10, 18) + "");
int flag = 0;
String eatEmpty = sc.nextLine();
String input = sc.nextLine();
String tempInput = " " + input + " ";
if (tempInput.contains(" 0 ")) {
flag = 1;
System.out.println(0);
} else {
String nums[] = input.split(" ");
// System.out.println(Arrays.toString(nums));
while (--N >= 0) {
if (flag == 0 && max.compareTo(ans) >= 0) {
BigInteger a = new BigInteger(nums[N]);
ans = ans.multiply(a);
} else if (flag == 0) {
flag = 1;
break;
}
}
System.out.println((flag == 1 || max.compareTo(ans) < 0) ? -1 : ans);
}
sc.close();
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
13,
17,
41,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
4,
18,
13,
17,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
4,
18,
13,
2,
13,
13,
30,
0,
13,
18,
13,
13,
30,
0,
13,
40,
17,
3,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
160,
5
],
[
160,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
20,
25
],
[
25,
26
],
[
25,
27
],
[
20,
28
],
[
28,
29
],
[
29,
30
],
[
20,
31
],
[
32,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
8,
36
],
[
36,
37
],
[
36,
38
],
[
8,
39
],
[
39,
40
],
[
39,
41
],
[
8,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
43,
48
],
[
48,
49
],
[
48,
50
],
[
43,
51
],
[
51,
52
],
[
52,
53
],
[
43,
54
],
[
55,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
60,
61
],
[
61,
62
],
[
55,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
63,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
70,
75
],
[
69,
76
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
8,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
80,
85
],
[
85,
86
],
[
85,
87
],
[
80,
88
],
[
88,
89
],
[
89,
90
],
[
80,
91
],
[
92,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
93,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
100,
105
],
[
105,
106
],
[
99,
107
],
[
107,
108
],
[
108,
109
],
[
107,
110
],
[
8,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
8,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
115,
120
],
[
120,
121
],
[
120,
122
],
[
115,
123
],
[
123,
124
],
[
124,
125
],
[
115,
126
],
[
127,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
129,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
136,
137
],
[
136,
138
],
[
128,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
142,
144
],
[
128,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
145,
150
],
[
8,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
6,
157
],
[
157,
158
],
[
0,
159
],
[
159,
160
],
[
159,
161
]
] |
[
"import java.util.*;\n\npublic class Main {\n\t\n\n\tpublic static void main(String[] args) {\n\t Scanner sc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\t\n\t\tlong end=1;\n\t\tfor(int i=0;i<18;i++) {\n\t\t\tend*=10;\n\t\t}\n\t\t\n\t\tlong ans=1;\n\t\t\n\t\tlong[] a=new long[n];\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ta[i]=sc.nextLong();\n\t\t\tif(a[i]==0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tif(a[i]>end) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\t\tArrays.sort(a);\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tif(a[i]<=Math.floor(end/ans)) {\n\t\t\t\tans*=a[i];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tans=-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}\n\n}\n",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\t\n\n\tpublic static void main(String[] args) {\n\t Scanner sc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\t\n\t\tlong end=1;\n\t\tfor(int i=0;i<18;i++) {\n\t\t\tend*=10;\n\t\t}\n\t\t\n\t\tlong ans=1;\n\t\t\n\t\tlong[] a=new long[n];\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ta[i]=sc.nextLong();\n\t\t\tif(a[i]==0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tif(a[i]>end) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\t\tArrays.sort(a);\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tif(a[i]<=Math.floor(end/ans)) {\n\t\t\t\tans*=a[i];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tans=-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t Scanner sc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\t\n\t\tlong end=1;\n\t\tfor(int i=0;i<18;i++) {\n\t\t\tend*=10;\n\t\t}\n\t\t\n\t\tlong ans=1;\n\t\t\n\t\tlong[] a=new long[n];\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ta[i]=sc.nextLong();\n\t\t\tif(a[i]==0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tif(a[i]>end) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\t\tArrays.sort(a);\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tif(a[i]<=Math.floor(end/ans)) {\n\t\t\t\tans*=a[i];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tans=-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t Scanner sc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\t\n\t\tlong end=1;\n\t\tfor(int i=0;i<18;i++) {\n\t\t\tend*=10;\n\t\t}\n\t\t\n\t\tlong ans=1;\n\t\t\n\t\tlong[] a=new long[n];\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ta[i]=sc.nextLong();\n\t\t\tif(a[i]==0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tif(a[i]>end) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\t\tArrays.sort(a);\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tif(a[i]<=Math.floor(end/ans)) {\n\t\t\t\tans*=a[i];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tans=-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long end=1;",
"end",
"1",
"for(int i=0;i<18;i++) {\n\t\t\tend*=10;\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<18",
"i",
"18",
"i++",
"i++",
"i",
"{\n\t\t\tend*=10;\n\t\t}",
"{\n\t\t\tend*=10;\n\t\t}",
"end*=10",
"end",
"10",
"long ans=1;",
"ans",
"1",
"long[] a=new long[n];",
"a",
"new long[n]",
"n",
"for(int i=0;i<n;i++) {\n\t\t\ta[i]=sc.nextLong();\n\t\t\tif(a[i]==0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i]=sc.nextLong();\n\t\t\tif(a[i]==0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}",
"{\n\t\t\ta[i]=sc.nextLong();\n\t\t\tif(a[i]==0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}",
"a[i]=sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(a[i]==0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}",
"a[i]==0",
"a[i]",
"a",
"i",
"0",
"{\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"System.exit(0)",
"System.exit",
"System",
"0",
"for(int i=0;i<n;i++) {\n\t\t\tif(a[i]>end) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tif(a[i]>end) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(a[i]>end) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}",
"if(a[i]>end) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}",
"a[i]>end",
"a[i]",
"a",
"i",
"end",
"{\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"System.exit(0)",
"System.exit",
"System",
"0",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"for(int i=0;i<n;i++) {\n\t\t\tif(a[i]<=Math.floor(end/ans)) {\n\t\t\t\tans*=a[i];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tans=-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tif(a[i]<=Math.floor(end/ans)) {\n\t\t\t\tans*=a[i];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tans=-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(a[i]<=Math.floor(end/ans)) {\n\t\t\t\tans*=a[i];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tans=-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"if(a[i]<=Math.floor(end/ans)) {\n\t\t\t\tans*=a[i];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tans=-1;\n\t\t\t\tbreak;\n\t\t\t}",
"a[i]<=Math.floor(end/ans)",
"a[i]",
"a",
"i",
"Math.floor(end/ans)",
"Math.floor",
"Math",
"end/ans",
"end",
"ans",
"{\n\t\t\t\tans*=a[i];\n\t\t\t}",
"ans*=a[i]",
"ans",
"a[i]",
"a",
"i",
"{\n\t\t\t\tans=-1;\n\t\t\t\tbreak;\n\t\t\t}",
"ans=-1",
"ans",
"-1",
"1",
"break;",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\t\n\n\tpublic static void main(String[] args) {\n\t Scanner sc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\t\n\t\tlong end=1;\n\t\tfor(int i=0;i<18;i++) {\n\t\t\tend*=10;\n\t\t}\n\t\t\n\t\tlong ans=1;\n\t\t\n\t\tlong[] a=new long[n];\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ta[i]=sc.nextLong();\n\t\t\tif(a[i]==0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tif(a[i]>end) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\t\tArrays.sort(a);\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tif(a[i]<=Math.floor(end/ans)) {\n\t\t\t\tans*=a[i];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tans=-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}\n\n}",
"public class Main {\n\t\n\n\tpublic static void main(String[] args) {\n\t Scanner sc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\t\n\t\tlong end=1;\n\t\tfor(int i=0;i<18;i++) {\n\t\t\tend*=10;\n\t\t}\n\t\t\n\t\tlong ans=1;\n\t\t\n\t\tlong[] a=new long[n];\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ta[i]=sc.nextLong();\n\t\t\tif(a[i]==0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tif(a[i]>end) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\t\tArrays.sort(a);\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tif(a[i]<=Math.floor(end/ans)) {\n\t\t\t\tans*=a[i];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tans=-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}\n\n}",
"Main"
] |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
long end=1;
for(int i=0;i<18;i++) {
end*=10;
}
long ans=1;
long[] a=new long[n];
for(int i=0;i<n;i++) {
a[i]=sc.nextLong();
if(a[i]==0) {
System.out.println(0);
System.exit(0);
}
}
for(int i=0;i<n;i++) {
if(a[i]>end) {
System.out.println(-1);
System.exit(0);
}
}
Arrays.sort(a);
for(int i=0;i<n;i++) {
if(a[i]<=Math.floor(end/ans)) {
ans*=a[i];
}
else {
ans=-1;
break;
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
144,
26
],
[
144,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
29,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
29,
38
],
[
38,
39
],
[
38,
40
],
[
29,
41
],
[
41,
42
],
[
41,
43
],
[
29,
44
],
[
44,
45
],
[
44,
46
],
[
29,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
47,
52
],
[
52,
53
],
[
52,
54
],
[
47,
55
],
[
55,
56
],
[
56,
57
],
[
47,
58
],
[
59,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
60,
63
],
[
63,
64
],
[
64,
65
],
[
59,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
67,
72
],
[
66,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
73,
80
],
[
80,
81
],
[
81,
82
],
[
80,
83
],
[
29,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
84,
89
],
[
89,
90
],
[
89,
91
],
[
84,
92
],
[
92,
93
],
[
93,
94
],
[
84,
95
],
[
96,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
29,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
113,
114
],
[
103,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
116,
121
],
[
121,
122
],
[
121,
123
],
[
116,
124
],
[
124,
125
],
[
125,
126
],
[
116,
127
],
[
128,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
132,
133
],
[
131,
134
],
[
115,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
135,
140
],
[
27,
141
],
[
141,
142
],
[
0,
143
],
[
143,
144
],
[
143,
145
]
] |
[
"import java.io.BufferedReader;\nimport java.io.*;\nimport java.util.*;\nimport java.util.ArrayList;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Collections;\nimport java.util.Arrays;\n\npublic class Main {\n\tpublic static void main(final String[] args){\n \n final Scanner sc = new Scanner(System.in);\n final int n = sc.nextInt();\n final List<Long> list = new ArrayList<>();\n\n long max = 1000000000000000000L;\n long count = 1;\n \n for(int i = 0; i < n ; i++){\n list.add(sc.nextLong());\n if(list.get(i) == 0){\n System.out.println(0);\n System.exit(0);\n }\n }\n\n for(int i = 0; i < n ; i++){\n max /= list.get(i);\n //System.out.println(max);\n }\n\n\n if(max < 1){\n System.out.println(-1);\n }else{\n for(int i = 0 ; i < n ; i++){\n count *= list.get(i);\n }\n System.out.println(count);\n }\n\n\n \n\n\n\n\n\n\n\n\n\n \n\n \n\n\n\n \n \n\n \n\n\n \n\n\n \n\n \n \n \n\n\n\n \n\n\n\n\n\n}\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Iterator;",
"Iterator",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Collections;",
"Collections",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"public class Main {\n\tpublic static void main(final String[] args){\n \n final Scanner sc = new Scanner(System.in);\n final int n = sc.nextInt();\n final List<Long> list = new ArrayList<>();\n\n long max = 1000000000000000000L;\n long count = 1;\n \n for(int i = 0; i < n ; i++){\n list.add(sc.nextLong());\n if(list.get(i) == 0){\n System.out.println(0);\n System.exit(0);\n }\n }\n\n for(int i = 0; i < n ; i++){\n max /= list.get(i);\n //System.out.println(max);\n }\n\n\n if(max < 1){\n System.out.println(-1);\n }else{\n for(int i = 0 ; i < n ; i++){\n count *= list.get(i);\n }\n System.out.println(count);\n }\n\n\n \n\n\n\n\n\n\n\n\n\n \n\n \n\n\n\n \n \n\n \n\n\n \n\n\n \n\n \n \n \n\n\n\n \n\n\n\n\n\n}\n}",
"Main",
"public static void main(final String[] args){\n \n final Scanner sc = new Scanner(System.in);\n final int n = sc.nextInt();\n final List<Long> list = new ArrayList<>();\n\n long max = 1000000000000000000L;\n long count = 1;\n \n for(int i = 0; i < n ; i++){\n list.add(sc.nextLong());\n if(list.get(i) == 0){\n System.out.println(0);\n System.exit(0);\n }\n }\n\n for(int i = 0; i < n ; i++){\n max /= list.get(i);\n //System.out.println(max);\n }\n\n\n if(max < 1){\n System.out.println(-1);\n }else{\n for(int i = 0 ; i < n ; i++){\n count *= list.get(i);\n }\n System.out.println(count);\n }\n\n\n \n\n\n\n\n\n\n\n\n\n \n\n \n\n\n\n \n \n\n \n\n\n \n\n\n \n\n \n \n \n\n\n\n \n\n\n\n\n\n}",
"main",
"{\n \n final Scanner sc = new Scanner(System.in);\n final int n = sc.nextInt();\n final List<Long> list = new ArrayList<>();\n\n long max = 1000000000000000000L;\n long count = 1;\n \n for(int i = 0; i < n ; i++){\n list.add(sc.nextLong());\n if(list.get(i) == 0){\n System.out.println(0);\n System.exit(0);\n }\n }\n\n for(int i = 0; i < n ; i++){\n max /= list.get(i);\n //System.out.println(max);\n }\n\n\n if(max < 1){\n System.out.println(-1);\n }else{\n for(int i = 0 ; i < n ; i++){\n count *= list.get(i);\n }\n System.out.println(count);\n }\n\n\n \n\n\n\n\n\n\n\n\n\n \n\n \n\n\n\n \n \n\n \n\n\n \n\n\n \n\n \n \n \n\n\n\n \n\n\n\n\n\n}",
"final Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"final int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"final List<Long> list = new ArrayList<>();",
"list",
"new ArrayList<>()",
"long max = 1000000000000000000L;",
"max",
"1000000000000000000L",
"long count = 1;",
"count",
"1",
"for(int i = 0; i < n ; i++){\n list.add(sc.nextLong());\n if(list.get(i) == 0){\n System.out.println(0);\n System.exit(0);\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n list.add(sc.nextLong());\n if(list.get(i) == 0){\n System.out.println(0);\n System.exit(0);\n }\n }",
"{\n list.add(sc.nextLong());\n if(list.get(i) == 0){\n System.out.println(0);\n System.exit(0);\n }\n }",
"list.add(sc.nextLong())",
"list.add",
"list",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(list.get(i) == 0){\n System.out.println(0);\n System.exit(0);\n }",
"list.get(i) == 0",
"list.get(i)",
"list.get",
"list",
"i",
"0",
"{\n System.out.println(0);\n System.exit(0);\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"System.exit(0)",
"System.exit",
"System",
"0",
"for(int i = 0; i < n ; i++){\n max /= list.get(i);\n //System.out.println(max);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n max /= list.get(i);\n //System.out.println(max);\n }",
"{\n max /= list.get(i);\n //System.out.println(max);\n }",
"max /= list.get(i)",
"max",
"list.get(i)",
"list.get",
"list",
"i",
"if(max < 1){\n System.out.println(-1);\n }else{\n for(int i = 0 ; i < n ; i++){\n count *= list.get(i);\n }\n System.out.println(count);\n }",
"max < 1",
"max",
"1",
"{\n System.out.println(-1);\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"{\n for(int i = 0 ; i < n ; i++){\n count *= list.get(i);\n }\n System.out.println(count);\n }",
"for(int i = 0 ; i < n ; i++){\n count *= list.get(i);\n }",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n count *= list.get(i);\n }",
"{\n count *= list.get(i);\n }",
"count *= list.get(i)",
"count",
"list.get(i)",
"list.get",
"list",
"i",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"final String[] args",
"args",
"public class Main {\n\tpublic static void main(final String[] args){\n \n final Scanner sc = new Scanner(System.in);\n final int n = sc.nextInt();\n final List<Long> list = new ArrayList<>();\n\n long max = 1000000000000000000L;\n long count = 1;\n \n for(int i = 0; i < n ; i++){\n list.add(sc.nextLong());\n if(list.get(i) == 0){\n System.out.println(0);\n System.exit(0);\n }\n }\n\n for(int i = 0; i < n ; i++){\n max /= list.get(i);\n //System.out.println(max);\n }\n\n\n if(max < 1){\n System.out.println(-1);\n }else{\n for(int i = 0 ; i < n ; i++){\n count *= list.get(i);\n }\n System.out.println(count);\n }\n\n\n \n\n\n\n\n\n\n\n\n\n \n\n \n\n\n\n \n \n\n \n\n\n \n\n\n \n\n \n \n \n\n\n\n \n\n\n\n\n\n}\n}",
"public class Main {\n\tpublic static void main(final String[] args){\n \n final Scanner sc = new Scanner(System.in);\n final int n = sc.nextInt();\n final List<Long> list = new ArrayList<>();\n\n long max = 1000000000000000000L;\n long count = 1;\n \n for(int i = 0; i < n ; i++){\n list.add(sc.nextLong());\n if(list.get(i) == 0){\n System.out.println(0);\n System.exit(0);\n }\n }\n\n for(int i = 0; i < n ; i++){\n max /= list.get(i);\n //System.out.println(max);\n }\n\n\n if(max < 1){\n System.out.println(-1);\n }else{\n for(int i = 0 ; i < n ; i++){\n count *= list.get(i);\n }\n System.out.println(count);\n }\n\n\n \n\n\n\n\n\n\n\n\n\n \n\n \n\n\n\n \n \n\n \n\n\n \n\n\n \n\n \n \n \n\n\n\n \n\n\n\n\n\n}\n}",
"Main"
] |
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;
public class Main {
public static void main(final String[] args){
final Scanner sc = new Scanner(System.in);
final int n = sc.nextInt();
final List<Long> list = new ArrayList<>();
long max = 1000000000000000000L;
long count = 1;
for(int i = 0; i < n ; i++){
list.add(sc.nextLong());
if(list.get(i) == 0){
System.out.println(0);
System.exit(0);
}
}
for(int i = 0; i < n ; i++){
max /= list.get(i);
//System.out.println(max);
}
if(max < 1){
System.out.println(-1);
}else{
for(int i = 0 ; i < n ; i++){
count *= list.get(i);
}
System.out.println(count);
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.