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,
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,
38,
5,
13,
30,
0,
13,
17,
30,
0,
13,
4,
18,
13,
13,
4,
18,
13,
4,
18,
13,
14,
2,
2,
13,
17,
2,
2,
13,
17,
13,
30,
4,
18,
18,
13,
13,
17,
30,
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,
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
],
[
37,
38
],
[
37,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
36,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
46,
49
],
[
46,
50
],
[
50,
51
],
[
51,
52
],
[
8,
53
],
[
53,
54
],
[
54,
55
],
[
8,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
57,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
56,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
56,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
6,
80
],
[
80,
81
]
] |
[
"import java.util.Scanner;\n\nclass Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long acum = 1;\n boolean cs = false;\n for(int i = 0; i < n; i++) {\n try {\n acum = Math.multiplyExact(acum, sc.nextLong()); \n } catch(ArithmeticException e) {\n cs = true;\n }\n }\n sc.close();\n if(acum != 0 && (acum > 1000000000000000000L || cs)) {\n System.out.println(\"-1\");\n } else {\n System.out.println(acum);\n }\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long acum = 1;\n boolean cs = false;\n for(int i = 0; i < n; i++) {\n try {\n acum = Math.multiplyExact(acum, sc.nextLong()); \n } catch(ArithmeticException e) {\n cs = true;\n }\n }\n sc.close();\n if(acum != 0 && (acum > 1000000000000000000L || cs)) {\n System.out.println(\"-1\");\n } else {\n System.out.println(acum);\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long acum = 1;\n boolean cs = false;\n for(int i = 0; i < n; i++) {\n try {\n acum = Math.multiplyExact(acum, sc.nextLong()); \n } catch(ArithmeticException e) {\n cs = true;\n }\n }\n sc.close();\n if(acum != 0 && (acum > 1000000000000000000L || cs)) {\n System.out.println(\"-1\");\n } else {\n System.out.println(acum);\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long acum = 1;\n boolean cs = false;\n for(int i = 0; i < n; i++) {\n try {\n acum = Math.multiplyExact(acum, sc.nextLong()); \n } catch(ArithmeticException e) {\n cs = true;\n }\n }\n sc.close();\n if(acum != 0 && (acum > 1000000000000000000L || cs)) {\n System.out.println(\"-1\");\n } else {\n System.out.println(acum);\n }\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long acum = 1;",
"acum",
"1",
"boolean cs = false;",
"cs",
"false",
"for(int i = 0; i < n; i++) {\n try {\n acum = Math.multiplyExact(acum, sc.nextLong()); \n } catch(ArithmeticException e) {\n cs = true;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n try {\n acum = Math.multiplyExact(acum, sc.nextLong()); \n } catch(ArithmeticException e) {\n cs = true;\n }\n }",
"{\n try {\n acum = Math.multiplyExact(acum, sc.nextLong()); \n } catch(ArithmeticException e) {\n cs = true;\n }\n }",
"try {\n acum = Math.multiplyExact(acum, sc.nextLong()); \n } catch(ArithmeticException e) {\n cs = true;\n }",
"catch(ArithmeticException e) {\n cs = true;\n }",
"ArithmeticException e",
"{\n cs = true;\n }",
"cs = true",
"cs",
"true",
"{\n acum = Math.multiplyExact(acum, sc.nextLong()); \n }",
"acum = Math.multiplyExact(acum, sc.nextLong())",
"acum",
"Math.multiplyExact(acum, sc.nextLong())",
"Math.multiplyExact",
"Math",
"acum",
"sc.nextLong()",
"sc.nextLong",
"sc",
"sc.close()",
"sc.close",
"sc",
"if(acum != 0 && (acum > 1000000000000000000L || cs)) {\n System.out.println(\"-1\");\n } else {\n System.out.println(acum);\n }",
"acum != 0 && (acum > 1000000000000000000L || cs)",
"acum != 0",
"acum",
"0",
"(acum > 1000000000000000000L || cs)",
"acum > 1000000000000000000L",
"acum",
"1000000000000000000L",
"cs",
"{\n System.out.println(\"-1\");\n }",
"System.out.println(\"-1\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"{\n System.out.println(acum);\n }",
"System.out.println(acum)",
"System.out.println",
"System.out",
"System",
"System.out",
"acum",
"String[] args",
"args"
] |
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long acum = 1;
boolean cs = false;
for(int i = 0; i < n; i++) {
try {
acum = Math.multiplyExact(acum, sc.nextLong());
} catch(ArithmeticException e) {
cs = true;
}
}
sc.close();
if(acum != 0 && (acum > 1000000000000000000L || cs)) {
System.out.println("-1");
} else {
System.out.println(acum);
}
}
}
|
[
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,
18,
13,
13,
4,
13,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
14,
2,
18,
13,
13,
17,
29,
18,
13,
13,
41,
13,
18,
13,
13,
41,
13,
4,
18,
13,
4,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
4,
18,
13,
18,
13,
13,
14,
2,
2,
4,
18,
13,
13,
13,
40,
4,
18,
13,
13,
29,
4,
18,
13,
40,
17,
29,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
146,
8
],
[
146,
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
],
[
46,
47
],
[
46,
48
],
[
44,
49
],
[
49,
50
],
[
49,
51
],
[
9,
52
],
[
52,
53
],
[
146,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
57,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
64,
66
],
[
57,
67
],
[
67,
68
],
[
68,
69
],
[
57,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
71,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
56,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
56,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
89,
90
],
[
88,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
91,
95
],
[
56,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
103,
105
],
[
96,
106
],
[
106,
107
],
[
107,
108
],
[
96,
109
],
[
110,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
114,
115
],
[
113,
116
],
[
116,
117
],
[
117,
118
],
[
116,
119
],
[
119,
120
],
[
119,
121
],
[
110,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
125,
128
],
[
124,
129
],
[
123,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
131,
134
],
[
122,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
136,
139
],
[
139,
140
],
[
56,
141
],
[
141,
142
],
[
54,
143
],
[
143,
144
],
[
0,
145
],
[
145,
146
],
[
145,
147
]
] |
[
"import java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n \tint factorAmount = scanner.nextInt();\n \tlong[] factors = new long[factorAmount];\n \tfor(int i = 0; i < factorAmount; i++) {\n \t\tfactors[i] = scanner.nextLong(); \n \t}\n \t\n \t\tSystem.out.print(Calculate(factors));\n\t}\n\t\n\tprivate static BigInteger Calculate(long[] numbers) {\n\t\tfor(int i = 0; i < numbers.length; i++) \n \t\tif(numbers[i] == 0l)\n \t\t\treturn BigInteger.ZERO;\n \t\n \tBigInteger result = BigInteger.ONE;\n \tBigInteger limit = BigInteger.valueOf((long)Math.pow(10, 18));\n \tfor(int i = 0; i < numbers.length; i++) {\n \t\tresult = result.multiply(BigInteger.valueOf(numbers[i]));\n \t\tif (result.min(limit) == limit && !result.equals(limit))\n \t\t return BigInteger.valueOf(-1); \n \t\t\n \t}\n \t\n\t\treturn result;\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\tScanner scanner = new Scanner(System.in);\n \tint factorAmount = scanner.nextInt();\n \tlong[] factors = new long[factorAmount];\n \tfor(int i = 0; i < factorAmount; i++) {\n \t\tfactors[i] = scanner.nextLong(); \n \t}\n \t\n \t\tSystem.out.print(Calculate(factors));\n\t}\n\t\n\tprivate static BigInteger Calculate(long[] numbers) {\n\t\tfor(int i = 0; i < numbers.length; i++) \n \t\tif(numbers[i] == 0l)\n \t\t\treturn BigInteger.ZERO;\n \t\n \tBigInteger result = BigInteger.ONE;\n \tBigInteger limit = BigInteger.valueOf((long)Math.pow(10, 18));\n \tfor(int i = 0; i < numbers.length; i++) {\n \t\tresult = result.multiply(BigInteger.valueOf(numbers[i]));\n \t\tif (result.min(limit) == limit && !result.equals(limit))\n \t\t return BigInteger.valueOf(-1); \n \t\t\n \t}\n \t\n\t\treturn result;\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n \tint factorAmount = scanner.nextInt();\n \tlong[] factors = new long[factorAmount];\n \tfor(int i = 0; i < factorAmount; i++) {\n \t\tfactors[i] = scanner.nextLong(); \n \t}\n \t\n \t\tSystem.out.print(Calculate(factors));\n\t}",
"main",
"{\n\t\tScanner scanner = new Scanner(System.in);\n \tint factorAmount = scanner.nextInt();\n \tlong[] factors = new long[factorAmount];\n \tfor(int i = 0; i < factorAmount; i++) {\n \t\tfactors[i] = scanner.nextLong(); \n \t}\n \t\n \t\tSystem.out.print(Calculate(factors));\n\t}",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int factorAmount = scanner.nextInt();",
"factorAmount",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"long[] factors = new long[factorAmount];",
"factors",
"new long[factorAmount]",
"factorAmount",
"for(int i = 0; i < factorAmount; i++) {\n \t\tfactors[i] = scanner.nextLong(); \n \t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < factorAmount",
"i",
"factorAmount",
"i++",
"i++",
"i",
"{\n \t\tfactors[i] = scanner.nextLong(); \n \t}",
"{\n \t\tfactors[i] = scanner.nextLong(); \n \t}",
"factors[i] = scanner.nextLong()",
"factors[i]",
"factors",
"i",
"scanner.nextLong()",
"scanner.nextLong",
"scanner",
"System.out.print(Calculate(factors))",
"System.out.print",
"System.out",
"System",
"System.out",
"Calculate(factors)",
"Calculate",
"factors",
"String[] args",
"args",
"private static BigInteger Calculate(long[] numbers) {\n\t\tfor(int i = 0; i < numbers.length; i++) \n \t\tif(numbers[i] == 0l)\n \t\t\treturn BigInteger.ZERO;\n \t\n \tBigInteger result = BigInteger.ONE;\n \tBigInteger limit = BigInteger.valueOf((long)Math.pow(10, 18));\n \tfor(int i = 0; i < numbers.length; i++) {\n \t\tresult = result.multiply(BigInteger.valueOf(numbers[i]));\n \t\tif (result.min(limit) == limit && !result.equals(limit))\n \t\t return BigInteger.valueOf(-1); \n \t\t\n \t}\n \t\n\t\treturn result;\n\t}",
"Calculate",
"{\n\t\tfor(int i = 0; i < numbers.length; i++) \n \t\tif(numbers[i] == 0l)\n \t\t\treturn BigInteger.ZERO;\n \t\n \tBigInteger result = BigInteger.ONE;\n \tBigInteger limit = BigInteger.valueOf((long)Math.pow(10, 18));\n \tfor(int i = 0; i < numbers.length; i++) {\n \t\tresult = result.multiply(BigInteger.valueOf(numbers[i]));\n \t\tif (result.min(limit) == limit && !result.equals(limit))\n \t\t return BigInteger.valueOf(-1); \n \t\t\n \t}\n \t\n\t\treturn result;\n\t}",
"for(int i = 0; i < numbers.length; i++) \n \t\tif(numbers[i] == 0l)\n \t\t\treturn BigInteger.ZERO;",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < numbers.length",
"i",
"numbers.length",
"numbers",
"numbers.length",
"i++",
"i++",
"i",
"if(numbers[i] == 0l)\n \t\t\treturn BigInteger.ZERO;",
"if(numbers[i] == 0l)\n \t\t\treturn BigInteger.ZERO;",
"numbers[i] == 0l",
"numbers[i]",
"numbers",
"i",
"0l",
"return BigInteger.ZERO;",
"BigInteger.ZERO",
"BigInteger",
"BigInteger.ZERO",
"BigInteger result = BigInteger.ONE;",
"result",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"BigInteger limit = BigInteger.valueOf((long)Math.pow(10, 18));",
"limit",
"BigInteger.valueOf((long)Math.pow(10, 18))",
"BigInteger.valueOf",
"BigInteger",
"(long)Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"for(int i = 0; i < numbers.length; i++) {\n \t\tresult = result.multiply(BigInteger.valueOf(numbers[i]));\n \t\tif (result.min(limit) == limit && !result.equals(limit))\n \t\t return BigInteger.valueOf(-1); \n \t\t\n \t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < numbers.length",
"i",
"numbers.length",
"numbers",
"numbers.length",
"i++",
"i++",
"i",
"{\n \t\tresult = result.multiply(BigInteger.valueOf(numbers[i]));\n \t\tif (result.min(limit) == limit && !result.equals(limit))\n \t\t return BigInteger.valueOf(-1); \n \t\t\n \t}",
"{\n \t\tresult = result.multiply(BigInteger.valueOf(numbers[i]));\n \t\tif (result.min(limit) == limit && !result.equals(limit))\n \t\t return BigInteger.valueOf(-1); \n \t\t\n \t}",
"result = result.multiply(BigInteger.valueOf(numbers[i]))",
"result",
"result.multiply(BigInteger.valueOf(numbers[i]))",
"result.multiply",
"result",
"BigInteger.valueOf(numbers[i])",
"BigInteger.valueOf",
"BigInteger",
"numbers[i]",
"numbers",
"i",
"if (result.min(limit) == limit && !result.equals(limit))\n \t\t return BigInteger.valueOf(-1);",
"result.min(limit) == limit && !result.equals(limit)",
"result.min(limit) == limit",
"result.min(limit)",
"result.min",
"result",
"limit",
"limit",
"!result.equals(limit)",
"result.equals(limit)",
"result.equals",
"result",
"limit",
"return BigInteger.valueOf(-1);",
"BigInteger.valueOf(-1)",
"BigInteger.valueOf",
"BigInteger",
"-1",
"1",
"return result;",
"result",
"long[] numbers",
"numbers",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n \tint factorAmount = scanner.nextInt();\n \tlong[] factors = new long[factorAmount];\n \tfor(int i = 0; i < factorAmount; i++) {\n \t\tfactors[i] = scanner.nextLong(); \n \t}\n \t\n \t\tSystem.out.print(Calculate(factors));\n\t}\n\t\n\tprivate static BigInteger Calculate(long[] numbers) {\n\t\tfor(int i = 0; i < numbers.length; i++) \n \t\tif(numbers[i] == 0l)\n \t\t\treturn BigInteger.ZERO;\n \t\n \tBigInteger result = BigInteger.ONE;\n \tBigInteger limit = BigInteger.valueOf((long)Math.pow(10, 18));\n \tfor(int i = 0; i < numbers.length; i++) {\n \t\tresult = result.multiply(BigInteger.valueOf(numbers[i]));\n \t\tif (result.min(limit) == limit && !result.equals(limit))\n \t\t return BigInteger.valueOf(-1); \n \t\t\n \t}\n \t\n\t\treturn result;\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n \tint factorAmount = scanner.nextInt();\n \tlong[] factors = new long[factorAmount];\n \tfor(int i = 0; i < factorAmount; i++) {\n \t\tfactors[i] = scanner.nextLong(); \n \t}\n \t\n \t\tSystem.out.print(Calculate(factors));\n\t}\n\t\n\tprivate static BigInteger Calculate(long[] numbers) {\n\t\tfor(int i = 0; i < numbers.length; i++) \n \t\tif(numbers[i] == 0l)\n \t\t\treturn BigInteger.ZERO;\n \t\n \tBigInteger result = BigInteger.ONE;\n \tBigInteger limit = BigInteger.valueOf((long)Math.pow(10, 18));\n \tfor(int i = 0; i < numbers.length; i++) {\n \t\tresult = result.multiply(BigInteger.valueOf(numbers[i]));\n \t\tif (result.min(limit) == limit && !result.equals(limit))\n \t\t return BigInteger.valueOf(-1); \n \t\t\n \t}\n \t\n\t\treturn result;\n\t}\n}",
"Main"
] |
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int factorAmount = scanner.nextInt();
long[] factors = new long[factorAmount];
for(int i = 0; i < factorAmount; i++) {
factors[i] = scanner.nextLong();
}
System.out.print(Calculate(factors));
}
private static BigInteger Calculate(long[] numbers) {
for(int i = 0; i < numbers.length; i++)
if(numbers[i] == 0l)
return BigInteger.ZERO;
BigInteger result = BigInteger.ONE;
BigInteger limit = BigInteger.valueOf((long)Math.pow(10, 18));
for(int i = 0; i < numbers.length; i++) {
result = result.multiply(BigInteger.valueOf(numbers[i]));
if (result.min(limit) == limit && !result.equals(limit))
return BigInteger.valueOf(-1);
}
return 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,
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,
2,
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
],
[
107,
5
],
[
107,
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
],
[
89,
90
],
[
89,
91
],
[
72,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
92,
97
],
[
8,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
98,
103
],
[
6,
104
],
[
104,
105
],
[
0,
106
],
[
106,
107
],
[
106,
108
]
] |
[
"import java.util.*;\n \npublic class Main{\n\tpublic static void main(String[] args){\n\t Scanner sc = new Scanner(System.in);\n \tint num = sc.nextInt();\n long number[] = new long[num];\n long mul = 1;\n for(int i = 0; i < num; i++){\n \tnumber[i] = sc.nextLong();\n if(number[i] == 0){\n \tmul = 0;\n }\n }\n if(mul != 0){\n \tfor(int i = 0; i < num; i++){\n \t\tif(number[i] <= (long)Math.pow(10,18)/mul){\n \t\t\tmul = mul * number[i];\n \t\t}else{\n \t\t\tmul = -1;\n break;\n }\n \t}\n }\n System.out.println(mul);\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n\tpublic static void main(String[] args){\n\t Scanner sc = new Scanner(System.in);\n \tint num = sc.nextInt();\n long number[] = new long[num];\n long mul = 1;\n for(int i = 0; i < num; i++){\n \tnumber[i] = sc.nextLong();\n if(number[i] == 0){\n \tmul = 0;\n }\n }\n if(mul != 0){\n \tfor(int i = 0; i < num; i++){\n \t\tif(number[i] <= (long)Math.pow(10,18)/mul){\n \t\t\tmul = mul * number[i];\n \t\t}else{\n \t\t\tmul = -1;\n break;\n }\n \t}\n }\n System.out.println(mul);\n\t}\n}",
"Main",
"public static void main(String[] args){\n\t Scanner sc = new Scanner(System.in);\n \tint num = sc.nextInt();\n long number[] = new long[num];\n long mul = 1;\n for(int i = 0; i < num; i++){\n \tnumber[i] = sc.nextLong();\n if(number[i] == 0){\n \tmul = 0;\n }\n }\n if(mul != 0){\n \tfor(int i = 0; i < num; i++){\n \t\tif(number[i] <= (long)Math.pow(10,18)/mul){\n \t\t\tmul = mul * number[i];\n \t\t}else{\n \t\t\tmul = -1;\n break;\n }\n \t}\n }\n System.out.println(mul);\n\t}",
"main",
"{\n\t Scanner sc = new Scanner(System.in);\n \tint num = sc.nextInt();\n long number[] = new long[num];\n long mul = 1;\n for(int i = 0; i < num; i++){\n \tnumber[i] = sc.nextLong();\n if(number[i] == 0){\n \tmul = 0;\n }\n }\n if(mul != 0){\n \tfor(int i = 0; i < num; i++){\n \t\tif(number[i] <= (long)Math.pow(10,18)/mul){\n \t\t\tmul = mul * number[i];\n \t\t}else{\n \t\t\tmul = -1;\n break;\n }\n \t}\n }\n System.out.println(mul);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int num = sc.nextInt();",
"num",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long number[] = new long[num];",
"number",
"new long[num]",
"num",
"long mul = 1;",
"mul",
"1",
"for(int i = 0; i < num; i++){\n \tnumber[i] = sc.nextLong();\n if(number[i] == 0){\n \tmul = 0;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num",
"i",
"num",
"i++",
"i++",
"i",
"{\n \tnumber[i] = sc.nextLong();\n if(number[i] == 0){\n \tmul = 0;\n }\n }",
"{\n \tnumber[i] = sc.nextLong();\n if(number[i] == 0){\n \tmul = 0;\n }\n }",
"number[i] = sc.nextLong()",
"number[i]",
"number",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(number[i] == 0){\n \tmul = 0;\n }",
"number[i] == 0",
"number[i]",
"number",
"i",
"0",
"{\n \tmul = 0;\n }",
"mul = 0",
"mul",
"0",
"if(mul != 0){\n \tfor(int i = 0; i < num; i++){\n \t\tif(number[i] <= (long)Math.pow(10,18)/mul){\n \t\t\tmul = mul * number[i];\n \t\t}else{\n \t\t\tmul = -1;\n break;\n }\n \t}\n }",
"mul != 0",
"mul",
"0",
"{\n \tfor(int i = 0; i < num; i++){\n \t\tif(number[i] <= (long)Math.pow(10,18)/mul){\n \t\t\tmul = mul * number[i];\n \t\t}else{\n \t\t\tmul = -1;\n break;\n }\n \t}\n }",
"for(int i = 0; i < num; i++){\n \t\tif(number[i] <= (long)Math.pow(10,18)/mul){\n \t\t\tmul = mul * number[i];\n \t\t}else{\n \t\t\tmul = -1;\n break;\n }\n \t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num",
"i",
"num",
"i++",
"i++",
"i",
"{\n \t\tif(number[i] <= (long)Math.pow(10,18)/mul){\n \t\t\tmul = mul * number[i];\n \t\t}else{\n \t\t\tmul = -1;\n break;\n }\n \t}",
"{\n \t\tif(number[i] <= (long)Math.pow(10,18)/mul){\n \t\t\tmul = mul * number[i];\n \t\t}else{\n \t\t\tmul = -1;\n break;\n }\n \t}",
"if(number[i] <= (long)Math.pow(10,18)/mul){\n \t\t\tmul = mul * number[i];\n \t\t}else{\n \t\t\tmul = -1;\n break;\n }",
"number[i] <= (long)Math.pow(10,18)/mul",
"number[i]",
"number",
"i",
"(long)Math.pow(10,18)/mul",
"(long)Math.pow(10,18)",
"Math.pow",
"Math",
"10",
"18",
"mul",
"{\n \t\t\tmul = mul * number[i];\n \t\t}",
"mul = mul * number[i]",
"mul",
"mul * number[i]",
"mul",
"number[i]",
"number",
"i",
"{\n \t\t\tmul = -1;\n break;\n }",
"mul = -1",
"mul",
"-1",
"1",
"break;",
"System.out.println(mul)",
"System.out.println",
"System.out",
"System",
"System.out",
"mul",
"String[] args",
"args",
"public class Main{\n\tpublic static void main(String[] args){\n\t Scanner sc = new Scanner(System.in);\n \tint num = sc.nextInt();\n long number[] = new long[num];\n long mul = 1;\n for(int i = 0; i < num; i++){\n \tnumber[i] = sc.nextLong();\n if(number[i] == 0){\n \tmul = 0;\n }\n }\n if(mul != 0){\n \tfor(int i = 0; i < num; i++){\n \t\tif(number[i] <= (long)Math.pow(10,18)/mul){\n \t\t\tmul = mul * number[i];\n \t\t}else{\n \t\t\tmul = -1;\n break;\n }\n \t}\n }\n System.out.println(mul);\n\t}\n}",
"public class Main{\n\tpublic static void main(String[] args){\n\t Scanner sc = new Scanner(System.in);\n \tint num = sc.nextInt();\n long number[] = new long[num];\n long mul = 1;\n for(int i = 0; i < num; i++){\n \tnumber[i] = sc.nextLong();\n if(number[i] == 0){\n \tmul = 0;\n }\n }\n if(mul != 0){\n \tfor(int i = 0; i < num; i++){\n \t\tif(number[i] <= (long)Math.pow(10,18)/mul){\n \t\t\tmul = mul * number[i];\n \t\t}else{\n \t\t\tmul = -1;\n break;\n }\n \t}\n }\n System.out.println(mul);\n\t}\n}",
"Main"
] |
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
long number[] = new long[num];
long mul = 1;
for(int i = 0; i < num; i++){
number[i] = sc.nextLong();
if(number[i] == 0){
mul = 0;
}
}
if(mul != 0){
for(int i = 0; i < num; i++){
if(number[i] <= (long)Math.pow(10,18)/mul){
mul = mul * number[i];
}else{
mul = -1;
break;
}
}
}
System.out.println(mul);
}
}
|
[
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,
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,
17,
41,
13,
20,
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,
14,
4,
18,
13,
17,
30,
4,
18,
13,
17,
29,
28,
13,
13,
30,
30,
41,
13,
4,
18,
13,
20,
17,
18,
13,
13,
14,
2,
4,
18,
20,
13,
17,
30,
4,
18,
13,
17,
29,
0,
13,
13,
4,
18,
13,
4,
18,
13,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
30,
29,
17,
41,
13,
4,
13,
13,
2,
13,
17,
14,
2,
2,
13,
17,
17,
30,
29,
2,
13,
13,
29,
2,
2,
13,
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
],
[
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
],
[
196,
26
],
[
196,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
32,
34
],
[
29,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
37,
39
],
[
29,
40
],
[
40,
41
],
[
40,
42
],
[
29,
43
],
[
43,
44
],
[
43,
45
],
[
29,
46
],
[
46,
47
],
[
46,
48
],
[
29,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
49,
53
],
[
49,
54
],
[
29,
55
],
[
55,
56
],
[
56,
57
],
[
27,
58
],
[
58,
59
],
[
196,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
64,
70
],
[
70,
71
],
[
70,
72
],
[
64,
73
],
[
73,
74
],
[
73,
75
],
[
64,
76
],
[
76,
77
],
[
76,
78
],
[
64,
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
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
91,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
64,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
102,
105
],
[
101,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
107,
110
],
[
106,
111
],
[
64,
112
],
[
112,
113
],
[
112,
114
],
[
112,
115
],
[
116,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
120,
121
],
[
119,
122
],
[
119,
123
],
[
119,
124
],
[
124,
125
],
[
124,
126
],
[
116,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
129,
132
],
[
128,
133
],
[
127,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
135,
138
],
[
134,
139
],
[
116,
140
],
[
140,
141
],
[
140,
142
],
[
64,
143
],
[
143,
144
],
[
144,
145
],
[
143,
146
],
[
146,
147
],
[
147,
148
],
[
146,
149
],
[
62,
150
],
[
150,
151
],
[
62,
152
],
[
152,
153
],
[
62,
154
],
[
154,
155
],
[
60,
156
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
159,
163
],
[
163,
164
],
[
164,
165
],
[
158,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
168,
170
],
[
168,
171
],
[
171,
172
],
[
171,
173
],
[
158,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
175,
179
],
[
174,
180
],
[
180,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
158,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
186,
190
],
[
156,
191
],
[
191,
192
],
[
156,
193
],
[
193,
194
],
[
0,
195
],
[
195,
196
],
[
195,
197
]
] |
[
"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.math.BigDecimal;\nimport java.util.List;\nimport java.util.Scanner;\nimport java.util.ArrayList;\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 Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Multiplication2 solver = new Multiplication2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Multiplication2 {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int num = in.nextInt();\n long ans = 1;\n\n BigDecimal border = new BigDecimal(pow(10, 18));\n List<Long> lists = new ArrayList<>();\n\n for (int i = 0; i < num; i++) {\n long a = in.nextLong();\n lists.add(a);\n }\n\n if (lists.contains(0L)) {\n out.append(\"0\\n\");\n return;\n }\n\n for (Long a : lists) {\n BigDecimal judge = border.divide(new BigDecimal(a), 40, BigDecimal.ROUND_CEILING);\n if ((new BigDecimal(ans)).compareTo(judge) > 0) {\n out.append(\"-1\\n\");\n return;\n }\n ans *= a;\n }\n out.append(String.valueOf(ans));\n }\n\n static long pow(long x, long n) {\n\n if (n == 0) {\n return 1;\n }\n long result = pow(x, n / 2);\n\n if (n % 2 == 0) {\n return (result * result);\n }\n return ((result * result)) * 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.math.BigDecimal;",
"BigDecimal",
"java.math",
"import java.util.List;",
"List",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Multiplication2 solver = new Multiplication2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Multiplication2 {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int num = in.nextInt();\n long ans = 1;\n\n BigDecimal border = new BigDecimal(pow(10, 18));\n List<Long> lists = new ArrayList<>();\n\n for (int i = 0; i < num; i++) {\n long a = in.nextLong();\n lists.add(a);\n }\n\n if (lists.contains(0L)) {\n out.append(\"0\\n\");\n return;\n }\n\n for (Long a : lists) {\n BigDecimal judge = border.divide(new BigDecimal(a), 40, BigDecimal.ROUND_CEILING);\n if ((new BigDecimal(ans)).compareTo(judge) > 0) {\n out.append(\"-1\\n\");\n return;\n }\n ans *= a;\n }\n out.append(String.valueOf(ans));\n }\n\n static long pow(long x, long n) {\n\n if (n == 0) {\n return 1;\n }\n long result = pow(x, n / 2);\n\n if (n % 2 == 0) {\n return (result * result);\n }\n return ((result * result)) * x;\n }\n\n }\n}",
"Main",
"public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Multiplication2 solver = new Multiplication2();\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 Multiplication2 solver = new Multiplication2();\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)",
"Multiplication2 solver = new Multiplication2();",
"solver",
"new Multiplication2()",
"solver.solve(1, in, out)",
"solver.solve",
"solver",
"1",
"in",
"out",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class Multiplication2 {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int num = in.nextInt();\n long ans = 1;\n\n BigDecimal border = new BigDecimal(pow(10, 18));\n List<Long> lists = new ArrayList<>();\n\n for (int i = 0; i < num; i++) {\n long a = in.nextLong();\n lists.add(a);\n }\n\n if (lists.contains(0L)) {\n out.append(\"0\\n\");\n return;\n }\n\n for (Long a : lists) {\n BigDecimal judge = border.divide(new BigDecimal(a), 40, BigDecimal.ROUND_CEILING);\n if ((new BigDecimal(ans)).compareTo(judge) > 0) {\n out.append(\"-1\\n\");\n return;\n }\n ans *= a;\n }\n out.append(String.valueOf(ans));\n }\n\n static long pow(long x, long n) {\n\n if (n == 0) {\n return 1;\n }\n long result = pow(x, n / 2);\n\n if (n % 2 == 0) {\n return (result * result);\n }\n return ((result * result)) * x;\n }\n\n }",
"Multiplication2",
"public void solve(int testNumber, Scanner in, PrintWriter out) {\n int num = in.nextInt();\n long ans = 1;\n\n BigDecimal border = new BigDecimal(pow(10, 18));\n List<Long> lists = new ArrayList<>();\n\n for (int i = 0; i < num; i++) {\n long a = in.nextLong();\n lists.add(a);\n }\n\n if (lists.contains(0L)) {\n out.append(\"0\\n\");\n return;\n }\n\n for (Long a : lists) {\n BigDecimal judge = border.divide(new BigDecimal(a), 40, BigDecimal.ROUND_CEILING);\n if ((new BigDecimal(ans)).compareTo(judge) > 0) {\n out.append(\"-1\\n\");\n return;\n }\n ans *= a;\n }\n out.append(String.valueOf(ans));\n }",
"solve",
"{\n int num = in.nextInt();\n long ans = 1;\n\n BigDecimal border = new BigDecimal(pow(10, 18));\n List<Long> lists = new ArrayList<>();\n\n for (int i = 0; i < num; i++) {\n long a = in.nextLong();\n lists.add(a);\n }\n\n if (lists.contains(0L)) {\n out.append(\"0\\n\");\n return;\n }\n\n for (Long a : lists) {\n BigDecimal judge = border.divide(new BigDecimal(a), 40, BigDecimal.ROUND_CEILING);\n if ((new BigDecimal(ans)).compareTo(judge) > 0) {\n out.append(\"-1\\n\");\n return;\n }\n ans *= a;\n }\n out.append(String.valueOf(ans));\n }",
"int num = in.nextInt();",
"num",
"in.nextInt()",
"in.nextInt",
"in",
"long ans = 1;",
"ans",
"1",
"BigDecimal border = new BigDecimal(pow(10, 18));",
"border",
"new BigDecimal(pow(10, 18))",
"List<Long> lists = new ArrayList<>();",
"lists",
"new ArrayList<>()",
"for (int i = 0; i < num; i++) {\n long a = in.nextLong();\n lists.add(a);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num",
"i",
"num",
"i++",
"i++",
"i",
"{\n long a = in.nextLong();\n lists.add(a);\n }",
"{\n long a = in.nextLong();\n lists.add(a);\n }",
"long a = in.nextLong();",
"a",
"in.nextLong()",
"in.nextLong",
"in",
"lists.add(a)",
"lists.add",
"lists",
"a",
"if (lists.contains(0L)) {\n out.append(\"0\\n\");\n return;\n }",
"lists.contains(0L)",
"lists.contains",
"lists",
"0L",
"{\n out.append(\"0\\n\");\n return;\n }",
"out.append(\"0\\n\")",
"out.append",
"out",
"\"0\\n\"",
"return;",
"for (Long a : lists) {\n BigDecimal judge = border.divide(new BigDecimal(a), 40, BigDecimal.ROUND_CEILING);\n if ((new BigDecimal(ans)).compareTo(judge) > 0) {\n out.append(\"-1\\n\");\n return;\n }\n ans *= a;\n }",
"Long a",
"lists",
"{\n BigDecimal judge = border.divide(new BigDecimal(a), 40, BigDecimal.ROUND_CEILING);\n if ((new BigDecimal(ans)).compareTo(judge) > 0) {\n out.append(\"-1\\n\");\n return;\n }\n ans *= a;\n }",
"{\n BigDecimal judge = border.divide(new BigDecimal(a), 40, BigDecimal.ROUND_CEILING);\n if ((new BigDecimal(ans)).compareTo(judge) > 0) {\n out.append(\"-1\\n\");\n return;\n }\n ans *= a;\n }",
"BigDecimal judge = border.divide(new BigDecimal(a), 40, BigDecimal.ROUND_CEILING);",
"judge",
"border.divide(new BigDecimal(a), 40, BigDecimal.ROUND_CEILING)",
"border.divide",
"border",
"new BigDecimal(a)",
"40",
"BigDecimal.ROUND_CEILING",
"BigDecimal",
"BigDecimal.ROUND_CEILING",
"if ((new BigDecimal(ans)).compareTo(judge) > 0) {\n out.append(\"-1\\n\");\n return;\n }",
"(new BigDecimal(ans)).compareTo(judge) > 0",
"(new BigDecimal(ans)).compareTo(judge)",
"(new BigDecimal(ans)).compareTo",
"(new BigDecimal(ans))",
"judge",
"0",
"{\n out.append(\"-1\\n\");\n return;\n }",
"out.append(\"-1\\n\")",
"out.append",
"out",
"\"-1\\n\"",
"return;",
"ans *= a",
"ans",
"a",
"out.append(String.valueOf(ans))",
"out.append",
"out",
"String.valueOf(ans)",
"String.valueOf",
"String",
"ans",
"int testNumber",
"testNumber",
"Scanner in",
"in",
"PrintWriter out",
"out",
"static long pow(long x, long n) {\n\n if (n == 0) {\n return 1;\n }\n long result = pow(x, n / 2);\n\n if (n % 2 == 0) {\n return (result * result);\n }\n return ((result * result)) * x;\n }",
"pow",
"{\n\n if (n == 0) {\n return 1;\n }\n long result = pow(x, n / 2);\n\n if (n % 2 == 0) {\n return (result * result);\n }\n return ((result * result)) * x;\n }",
"if (n == 0) {\n return 1;\n }",
"n == 0",
"n",
"0",
"{\n return 1;\n }",
"return 1;",
"1",
"long result = pow(x, n / 2);",
"result",
"pow(x, n / 2)",
"pow",
"x",
"n / 2",
"n",
"2",
"if (n % 2 == 0) {\n return (result * result);\n }",
"n % 2 == 0",
"n % 2",
"n",
"2",
"0",
"{\n return (result * result);\n }",
"return (result * result);",
"(result * result)",
"result",
"result",
"return ((result * result)) * x;",
"((result * result)) * x",
"((result * result))",
"result",
"result",
"x",
"long x",
"x",
"long n",
"n",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Multiplication2 solver = new Multiplication2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Multiplication2 {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int num = in.nextInt();\n long ans = 1;\n\n BigDecimal border = new BigDecimal(pow(10, 18));\n List<Long> lists = new ArrayList<>();\n\n for (int i = 0; i < num; i++) {\n long a = in.nextLong();\n lists.add(a);\n }\n\n if (lists.contains(0L)) {\n out.append(\"0\\n\");\n return;\n }\n\n for (Long a : lists) {\n BigDecimal judge = border.divide(new BigDecimal(a), 40, BigDecimal.ROUND_CEILING);\n if ((new BigDecimal(ans)).compareTo(judge) > 0) {\n out.append(\"-1\\n\");\n return;\n }\n ans *= a;\n }\n out.append(String.valueOf(ans));\n }\n\n static long pow(long x, long n) {\n\n if (n == 0) {\n return 1;\n }\n long result = pow(x, n / 2);\n\n if (n % 2 == 0) {\n return (result * result);\n }\n return ((result * result)) * 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 Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Multiplication2 solver = new Multiplication2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Multiplication2 {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int num = in.nextInt();\n long ans = 1;\n\n BigDecimal border = new BigDecimal(pow(10, 18));\n List<Long> lists = new ArrayList<>();\n\n for (int i = 0; i < num; i++) {\n long a = in.nextLong();\n lists.add(a);\n }\n\n if (lists.contains(0L)) {\n out.append(\"0\\n\");\n return;\n }\n\n for (Long a : lists) {\n BigDecimal judge = border.divide(new BigDecimal(a), 40, BigDecimal.ROUND_CEILING);\n if ((new BigDecimal(ans)).compareTo(judge) > 0) {\n out.append(\"-1\\n\");\n return;\n }\n ans *= a;\n }\n out.append(String.valueOf(ans));\n }\n\n static long pow(long x, long n) {\n\n if (n == 0) {\n return 1;\n }\n long result = pow(x, n / 2);\n\n if (n % 2 == 0) {\n return (result * result);\n }\n return ((result * result)) * x;\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.List;
import java.util.Scanner;
import java.util.ArrayList;
/**
* 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);
Multiplication2 solver = new Multiplication2();
solver.solve(1, in, out);
out.close();
}
static class Multiplication2 {
public void solve(int testNumber, Scanner in, PrintWriter out) {
int num = in.nextInt();
long ans = 1;
BigDecimal border = new BigDecimal(pow(10, 18));
List<Long> lists = new ArrayList<>();
for (int i = 0; i < num; i++) {
long a = in.nextLong();
lists.add(a);
}
if (lists.contains(0L)) {
out.append("0\n");
return;
}
for (Long a : lists) {
BigDecimal judge = border.divide(new BigDecimal(a), 40, BigDecimal.ROUND_CEILING);
if ((new BigDecimal(ans)).compareTo(judge) > 0) {
out.append("-1\n");
return;
}
ans *= a;
}
out.append(String.valueOf(ans));
}
static long pow(long x, long n) {
if (n == 0) {
return 1;
}
long result = pow(x, n / 2);
if (n % 2 == 0) {
return (result * result);
}
return ((result * result)) * x;
}
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
12,
13,
30,
0,
13,
20,
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,
4,
18,
18,
13,
13,
17,
29,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
17,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
17,
29,
0,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
140,
5
],
[
140,
6
],
[
6,
7
],
[
140,
8
],
[
8,
9
],
[
8,
10
],
[
10,
11
],
[
11,
12
],
[
11,
13
],
[
10,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
10,
18
],
[
18,
19
],
[
18,
20
],
[
10,
22
],
[
22,
23
],
[
22,
24
],
[
10,
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
],
[
39,
40
],
[
39,
41
],
[
38,
42
],
[
42,
43
],
[
37,
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
],
[
10,
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
],
[
74,
75
],
[
73,
76
],
[
73,
77
],
[
72,
78
],
[
78,
79
],
[
78,
80
],
[
71,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
81,
88
],
[
70,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
10,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
94,
99
],
[
8,
100
],
[
100,
101
],
[
140,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
140,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
113,
116
],
[
116,
117
],
[
117,
118
],
[
140,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
123,
126
],
[
126,
127
],
[
127,
128
],
[
140,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
136,
137
],
[
137,
138
],
[
0,
139
],
[
139,
140
],
[
139,
141
]
] |
[
"import java.util.Scanner;\n\npublic class Main {\n\n\tstatic Scanner scanner;\n\n\tpublic static void main(String[] args) {\n\t scanner = new Scanner(System.in);\n\n\t int N=gi();\n\t long[] A=new long[N];\n\t \n\t long m=1;\n\t for (int i=0; i<N; i++) {\n\t \tA[i]=gl();\n\t \tif(A[i]==0) {\n\t \t\tSystem.out.print(\"0\");\n\t \t\treturn;\n\t \t}\n\t }\n\t \n\t for (int i=0; i<N; i++) {\n\t \tif (Math.floorDiv(1000000000000000000l, m)<A[i]) {\n\t \t\tSystem.out.print(\"-1\");\n\t \t\treturn;\n\t \t}\n\t \tm*=A[i];\n\t }\n\n\t \tSystem.out.print(m);\n\n// if (flg) {\n// \tSystem.out.print(\"YES\");\n// }else {\n// \tSystem.out.print(\"NO\");\n// }\n\n\n\t}\n\n\t// 文字列として入力を取得\n\tpublic static String gs() {\n\t\treturn scanner.next();\n\t}\n\n\t// intとして入力を取得\n\tpublic static int gi() {\n\t\treturn Integer.parseInt(scanner.next());\n\t}\n\n\t// longとして入力を取得\n\tpublic static long gl() {\n\t\treturn Long.parseLong(scanner.next());\n\t}\n\n\t// doubleとして入力を取得\n\tpublic static double gd() {\n\t\treturn Double.parseDouble(scanner.next());\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tstatic Scanner scanner;\n\n\tpublic static void main(String[] args) {\n\t scanner = new Scanner(System.in);\n\n\t int N=gi();\n\t long[] A=new long[N];\n\t \n\t long m=1;\n\t for (int i=0; i<N; i++) {\n\t \tA[i]=gl();\n\t \tif(A[i]==0) {\n\t \t\tSystem.out.print(\"0\");\n\t \t\treturn;\n\t \t}\n\t }\n\t \n\t for (int i=0; i<N; i++) {\n\t \tif (Math.floorDiv(1000000000000000000l, m)<A[i]) {\n\t \t\tSystem.out.print(\"-1\");\n\t \t\treturn;\n\t \t}\n\t \tm*=A[i];\n\t }\n\n\t \tSystem.out.print(m);\n\n// if (flg) {\n// \tSystem.out.print(\"YES\");\n// }else {\n// \tSystem.out.print(\"NO\");\n// }\n\n\n\t}\n\n\t// 文字列として入力を取得\n\tpublic static String gs() {\n\t\treturn scanner.next();\n\t}\n\n\t// intとして入力を取得\n\tpublic static int gi() {\n\t\treturn Integer.parseInt(scanner.next());\n\t}\n\n\t// longとして入力を取得\n\tpublic static long gl() {\n\t\treturn Long.parseLong(scanner.next());\n\t}\n\n\t// doubleとして入力を取得\n\tpublic static double gd() {\n\t\treturn Double.parseDouble(scanner.next());\n\t}\n}",
"Main",
"static Scanner scanner;",
"scanner",
"public static void main(String[] args) {\n\t scanner = new Scanner(System.in);\n\n\t int N=gi();\n\t long[] A=new long[N];\n\t \n\t long m=1;\n\t for (int i=0; i<N; i++) {\n\t \tA[i]=gl();\n\t \tif(A[i]==0) {\n\t \t\tSystem.out.print(\"0\");\n\t \t\treturn;\n\t \t}\n\t }\n\t \n\t for (int i=0; i<N; i++) {\n\t \tif (Math.floorDiv(1000000000000000000l, m)<A[i]) {\n\t \t\tSystem.out.print(\"-1\");\n\t \t\treturn;\n\t \t}\n\t \tm*=A[i];\n\t }\n\n\t \tSystem.out.print(m);\n\n// if (flg) {\n// \tSystem.out.print(\"YES\");\n// }else {\n// \tSystem.out.print(\"NO\");\n// }\n\n\n\t}",
"main",
"{\n\t scanner = new Scanner(System.in);\n\n\t int N=gi();\n\t long[] A=new long[N];\n\t \n\t long m=1;\n\t for (int i=0; i<N; i++) {\n\t \tA[i]=gl();\n\t \tif(A[i]==0) {\n\t \t\tSystem.out.print(\"0\");\n\t \t\treturn;\n\t \t}\n\t }\n\t \n\t for (int i=0; i<N; i++) {\n\t \tif (Math.floorDiv(1000000000000000000l, m)<A[i]) {\n\t \t\tSystem.out.print(\"-1\");\n\t \t\treturn;\n\t \t}\n\t \tm*=A[i];\n\t }\n\n\t \tSystem.out.print(m);\n\n// if (flg) {\n// \tSystem.out.print(\"YES\");\n// }else {\n// \tSystem.out.print(\"NO\");\n// }\n\n\n\t}",
"scanner = new Scanner(System.in)",
"scanner",
"new Scanner(System.in)",
"int N=gi();",
"N",
"gi()",
"gi",
"long[] A=new long[N];",
"A",
"new long[N]",
"N",
"long m=1;",
"m",
"1",
"for (int i=0; i<N; i++) {\n\t \tA[i]=gl();\n\t \tif(A[i]==0) {\n\t \t\tSystem.out.print(\"0\");\n\t \t\treturn;\n\t \t}\n\t }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t \tA[i]=gl();\n\t \tif(A[i]==0) {\n\t \t\tSystem.out.print(\"0\");\n\t \t\treturn;\n\t \t}\n\t }",
"{\n\t \tA[i]=gl();\n\t \tif(A[i]==0) {\n\t \t\tSystem.out.print(\"0\");\n\t \t\treturn;\n\t \t}\n\t }",
"A[i]=gl()",
"A[i]",
"A",
"i",
"gl()",
"gl",
"if(A[i]==0) {\n\t \t\tSystem.out.print(\"0\");\n\t \t\treturn;\n\t \t}",
"A[i]==0",
"A[i]",
"A",
"i",
"0",
"{\n\t \t\tSystem.out.print(\"0\");\n\t \t\treturn;\n\t \t}",
"System.out.print(\"0\")",
"System.out.print",
"System.out",
"System",
"System.out",
"\"0\"",
"return;",
"for (int i=0; i<N; i++) {\n\t \tif (Math.floorDiv(1000000000000000000l, m)<A[i]) {\n\t \t\tSystem.out.print(\"-1\");\n\t \t\treturn;\n\t \t}\n\t \tm*=A[i];\n\t }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t \tif (Math.floorDiv(1000000000000000000l, m)<A[i]) {\n\t \t\tSystem.out.print(\"-1\");\n\t \t\treturn;\n\t \t}\n\t \tm*=A[i];\n\t }",
"{\n\t \tif (Math.floorDiv(1000000000000000000l, m)<A[i]) {\n\t \t\tSystem.out.print(\"-1\");\n\t \t\treturn;\n\t \t}\n\t \tm*=A[i];\n\t }",
"if (Math.floorDiv(1000000000000000000l, m)<A[i]) {\n\t \t\tSystem.out.print(\"-1\");\n\t \t\treturn;\n\t \t}",
"Math.floorDiv(1000000000000000000l, m)<A[i]",
"Math.floorDiv(1000000000000000000l, m)",
"Math.floorDiv",
"Math",
"1000000000000000000l",
"m",
"A[i]",
"A",
"i",
"{\n\t \t\tSystem.out.print(\"-1\");\n\t \t\treturn;\n\t \t}",
"System.out.print(\"-1\")",
"System.out.print",
"System.out",
"System",
"System.out",
"\"-1\"",
"return;",
"m*=A[i]",
"m",
"A[i]",
"A",
"i",
"System.out.print(m)",
"System.out.print",
"System.out",
"System",
"System.out",
"m",
"String[] args",
"args",
"// 文字列として入力を取得\n\tpublic static String gs() {\n\t\treturn scanner.next();\n\t}",
"gs",
"{\n\t\treturn scanner.next();\n\t}",
"return scanner.next();",
"scanner.next()",
"scanner.next",
"scanner",
"// intとして入力を取得\n\tpublic static int gi() {\n\t\treturn Integer.parseInt(scanner.next());\n\t}",
"gi",
"{\n\t\treturn Integer.parseInt(scanner.next());\n\t}",
"return Integer.parseInt(scanner.next());",
"Integer.parseInt(scanner.next())",
"Integer.parseInt",
"Integer",
"scanner.next()",
"scanner.next",
"scanner",
"// longとして入力を取得\n\tpublic static long gl() {\n\t\treturn Long.parseLong(scanner.next());\n\t}",
"gl",
"{\n\t\treturn Long.parseLong(scanner.next());\n\t}",
"return Long.parseLong(scanner.next());",
"Long.parseLong(scanner.next())",
"Long.parseLong",
"Long",
"scanner.next()",
"scanner.next",
"scanner",
"// doubleとして入力を取得\n\tpublic static double gd() {\n\t\treturn Double.parseDouble(scanner.next());\n\t}",
"gd",
"{\n\t\treturn Double.parseDouble(scanner.next());\n\t}",
"return Double.parseDouble(scanner.next());",
"Double.parseDouble(scanner.next())",
"Double.parseDouble",
"Double",
"scanner.next()",
"scanner.next",
"scanner",
"public class Main {\n\n\tstatic Scanner scanner;\n\n\tpublic static void main(String[] args) {\n\t scanner = new Scanner(System.in);\n\n\t int N=gi();\n\t long[] A=new long[N];\n\t \n\t long m=1;\n\t for (int i=0; i<N; i++) {\n\t \tA[i]=gl();\n\t \tif(A[i]==0) {\n\t \t\tSystem.out.print(\"0\");\n\t \t\treturn;\n\t \t}\n\t }\n\t \n\t for (int i=0; i<N; i++) {\n\t \tif (Math.floorDiv(1000000000000000000l, m)<A[i]) {\n\t \t\tSystem.out.print(\"-1\");\n\t \t\treturn;\n\t \t}\n\t \tm*=A[i];\n\t }\n\n\t \tSystem.out.print(m);\n\n// if (flg) {\n// \tSystem.out.print(\"YES\");\n// }else {\n// \tSystem.out.print(\"NO\");\n// }\n\n\n\t}\n\n\t// 文字列として入力を取得\n\tpublic static String gs() {\n\t\treturn scanner.next();\n\t}\n\n\t// intとして入力を取得\n\tpublic static int gi() {\n\t\treturn Integer.parseInt(scanner.next());\n\t}\n\n\t// longとして入力を取得\n\tpublic static long gl() {\n\t\treturn Long.parseLong(scanner.next());\n\t}\n\n\t// doubleとして入力を取得\n\tpublic static double gd() {\n\t\treturn Double.parseDouble(scanner.next());\n\t}\n}",
"public class Main {\n\n\tstatic Scanner scanner;\n\n\tpublic static void main(String[] args) {\n\t scanner = new Scanner(System.in);\n\n\t int N=gi();\n\t long[] A=new long[N];\n\t \n\t long m=1;\n\t for (int i=0; i<N; i++) {\n\t \tA[i]=gl();\n\t \tif(A[i]==0) {\n\t \t\tSystem.out.print(\"0\");\n\t \t\treturn;\n\t \t}\n\t }\n\t \n\t for (int i=0; i<N; i++) {\n\t \tif (Math.floorDiv(1000000000000000000l, m)<A[i]) {\n\t \t\tSystem.out.print(\"-1\");\n\t \t\treturn;\n\t \t}\n\t \tm*=A[i];\n\t }\n\n\t \tSystem.out.print(m);\n\n// if (flg) {\n// \tSystem.out.print(\"YES\");\n// }else {\n// \tSystem.out.print(\"NO\");\n// }\n\n\n\t}\n\n\t// 文字列として入力を取得\n\tpublic static String gs() {\n\t\treturn scanner.next();\n\t}\n\n\t// intとして入力を取得\n\tpublic static int gi() {\n\t\treturn Integer.parseInt(scanner.next());\n\t}\n\n\t// longとして入力を取得\n\tpublic static long gl() {\n\t\treturn Long.parseLong(scanner.next());\n\t}\n\n\t// doubleとして入力を取得\n\tpublic static double gd() {\n\t\treturn Double.parseDouble(scanner.next());\n\t}\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
static Scanner scanner;
public static void main(String[] args) {
scanner = new Scanner(System.in);
int N=gi();
long[] A=new long[N];
long m=1;
for (int i=0; i<N; i++) {
A[i]=gl();
if(A[i]==0) {
System.out.print("0");
return;
}
}
for (int i=0; i<N; i++) {
if (Math.floorDiv(1000000000000000000l, m)<A[i]) {
System.out.print("-1");
return;
}
m*=A[i];
}
System.out.print(m);
// if (flg) {
// System.out.print("YES");
// }else {
// System.out.print("NO");
// }
}
// 文字列として入力を取得
public static String gs() {
return scanner.next();
}
// intとして入力を取得
public static int gi() {
return Integer.parseInt(scanner.next());
}
// longとして入力を取得
public static long gl() {
return Long.parseLong(scanner.next());
}
// doubleとして入力を取得
public static double gd() {
return Double.parseDouble(scanner.next());
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
41,
13,
4,
13,
41,
13,
18,
13,
13,
41,
13,
20,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
14,
13,
30,
9,
0,
13,
4,
18,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
0,
13,
17,
41,
13,
8,
13,
17,
4,
18,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
4,
18,
13,
17,
42,
17,
30,
38,
5,
13,
30,
3,
30,
41,
13,
4,
18,
18,
13,
13,
14,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
40,
17,
30,
3,
30,
4,
18,
13,
13,
12,
13,
30,
4,
13,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
4,
13,
29,
4,
18,
13,
4,
18,
13,
13,
23,
13,
12,
13,
30,
4,
13,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
4,
13,
29,
4,
18,
13,
4,
18,
13,
13,
23,
13,
12,
13,
30,
4,
13,
29,
20,
12,
13,
30,
4,
13,
29,
20,
23,
13,
12,
13,
30,
42,
17,
30,
38,
5,
13,
30,
3,
30,
41,
13,
4,
18,
18,
13,
13,
14,
2,
2,
13,
17,
2,
13,
40,
17,
30,
3,
12,
13,
30,
42,
17,
30,
38,
5,
13,
30,
3,
30,
41,
13,
4,
18,
18,
13,
13,
14,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
40,
17,
3,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
276,
8
],
[
276,
9
],
[
9,
10
],
[
9,
11
],
[
276,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
14,
19
],
[
19,
20
],
[
19,
21
],
[
21,
22
],
[
21,
23
],
[
14,
24
],
[
24,
25
],
[
24,
26
],
[
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
],
[
43,
45
],
[
45,
46
],
[
42,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
51,
58
],
[
42,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
42,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
65,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
42,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
73,
78
],
[
72,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
14,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
85,
88
],
[
88,
89
],
[
89,
90
],
[
14,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
12,
97
],
[
97,
98
],
[
276,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
102,
105
],
[
101,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
109,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
114,
122
],
[
122,
123
],
[
124,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
128,
129
],
[
128,
130
],
[
124,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
122,
135
],
[
135,
136
],
[
122,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
138,
141
],
[
276,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
145,
146
],
[
144,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
148,
151
],
[
151,
152
],
[
152,
153
],
[
276,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
157,
158
],
[
156,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
160,
163
],
[
163,
164
],
[
164,
165
],
[
160,
166
],
[
154,
167
],
[
167,
168
],
[
276,
169
],
[
169,
170
],
[
169,
171
],
[
171,
172
],
[
172,
173
],
[
171,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
175,
178
],
[
178,
179
],
[
179,
180
],
[
276,
181
],
[
181,
182
],
[
181,
183
],
[
183,
184
],
[
184,
185
],
[
183,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
187,
190
],
[
190,
191
],
[
191,
192
],
[
187,
193
],
[
181,
194
],
[
194,
195
],
[
276,
196
],
[
196,
197
],
[
196,
198
],
[
198,
199
],
[
199,
200
],
[
198,
201
],
[
201,
202
],
[
276,
203
],
[
203,
204
],
[
203,
205
],
[
205,
206
],
[
206,
207
],
[
205,
208
],
[
208,
209
],
[
203,
210
],
[
210,
211
],
[
276,
212
],
[
212,
213
],
[
212,
214
],
[
214,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
218,
219
],
[
219,
220
],
[
219,
221
],
[
221,
222
],
[
218,
223
],
[
223,
224
],
[
224,
225
],
[
224,
226
],
[
226,
227
],
[
227,
228
],
[
228,
229
],
[
228,
230
],
[
223,
231
],
[
231,
232
],
[
232,
233
],
[
233,
234
],
[
233,
235
],
[
232,
236
],
[
236,
237
],
[
236,
238
],
[
238,
239
],
[
231,
240
],
[
240,
241
],
[
276,
242
],
[
242,
243
],
[
242,
244
],
[
244,
245
],
[
245,
246
],
[
245,
247
],
[
247,
248
],
[
248,
249
],
[
249,
250
],
[
249,
251
],
[
251,
252
],
[
248,
253
],
[
253,
254
],
[
254,
255
],
[
254,
256
],
[
256,
257
],
[
257,
258
],
[
258,
259
],
[
258,
260
],
[
253,
261
],
[
261,
262
],
[
263,
263
],
[
263,
264
],
[
264,
265
],
[
264,
266
],
[
263,
267
],
[
267,
268
],
[
267,
269
],
[
263,
270
],
[
270,
271
],
[
270,
272
],
[
272,
273
],
[
261,
274
],
[
0,
275
],
[
275,
276
],
[
275,
277
]
] |
[
"import java.io.IOException;\nimport java.math.BigInteger;\n\npublic class Main {\n private static final StringBuilder builder = new StringBuilder();\n public static void main(String[] args) {\n int n = readInt();\n BigInteger bi = BigInteger.ONE;\n BigInteger comp = new BigInteger(\"1000000000000000000\");\n boolean over = false;\n\n for (int i = 0; i < n; i++) {\n long a = readLong();\n if (a == 0) {\n System.out.print(0);\n return;\n }\n \n if (over) {\n continue;\n }\n \n bi = bi.multiply(BigInteger.valueOf(a));\n if (bi.compareTo(comp) > 0) {\n over = true;\n }\n }\n \n String ans = over ? \"-1\" : bi.toString();\n\n System.out.print(ans);\n }\n\n private static void read() {\n builder.setLength(0);\n while (true) {\n try {\n int b = System.in.read();\n if (b == ' ' || b == '\\n' || b == -1) {\n break;\n } else {\n builder.appendCodePoint(b);\n }\n } catch (IOException e) {\n break;\n }\n }\n }\n\n private static int readInt() {\n read();\n return Integer.parseInt(builder.toString());\n }\n\n private static int readInt(int radix) {\n read();\n return Integer.parseInt(builder.toString(), radix);\n }\n\n private static long readLong() {\n read();\n return Long.parseLong(builder.toString());\n }\n\n private static long readLong(int radix) {\n read();\n return Long.parseLong(builder.toString(), radix);\n }\n\n private static BigInteger readBigInteger() {\n read();\n return new BigInteger(builder.toString());\n }\n\n private static BigInteger readBigInteger(int radix) {\n read();\n return new BigInteger(builder.toString(), radix);\n }\n\n private static void skipLine() {\n while (true) {\n try {\n int b = System.in.read();\n if (b == '\\n' || b == -1) {\n break;\n }\n } catch (IOException e) {\n break;\n }\n }\n }\n\n private static void skip() {\n while (true) {\n try {\n int b = System.in.read();\n if (b == ' ' || b == '\\n' || b == -1) break;\n } catch (IOException e) {\n break;\n }\n }\n }\n\n}",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"public class Main {\n private static final StringBuilder builder = new StringBuilder();\n public static void main(String[] args) {\n int n = readInt();\n BigInteger bi = BigInteger.ONE;\n BigInteger comp = new BigInteger(\"1000000000000000000\");\n boolean over = false;\n\n for (int i = 0; i < n; i++) {\n long a = readLong();\n if (a == 0) {\n System.out.print(0);\n return;\n }\n \n if (over) {\n continue;\n }\n \n bi = bi.multiply(BigInteger.valueOf(a));\n if (bi.compareTo(comp) > 0) {\n over = true;\n }\n }\n \n String ans = over ? \"-1\" : bi.toString();\n\n System.out.print(ans);\n }\n\n private static void read() {\n builder.setLength(0);\n while (true) {\n try {\n int b = System.in.read();\n if (b == ' ' || b == '\\n' || b == -1) {\n break;\n } else {\n builder.appendCodePoint(b);\n }\n } catch (IOException e) {\n break;\n }\n }\n }\n\n private static int readInt() {\n read();\n return Integer.parseInt(builder.toString());\n }\n\n private static int readInt(int radix) {\n read();\n return Integer.parseInt(builder.toString(), radix);\n }\n\n private static long readLong() {\n read();\n return Long.parseLong(builder.toString());\n }\n\n private static long readLong(int radix) {\n read();\n return Long.parseLong(builder.toString(), radix);\n }\n\n private static BigInteger readBigInteger() {\n read();\n return new BigInteger(builder.toString());\n }\n\n private static BigInteger readBigInteger(int radix) {\n read();\n return new BigInteger(builder.toString(), radix);\n }\n\n private static void skipLine() {\n while (true) {\n try {\n int b = System.in.read();\n if (b == '\\n' || b == -1) {\n break;\n }\n } catch (IOException e) {\n break;\n }\n }\n }\n\n private static void skip() {\n while (true) {\n try {\n int b = System.in.read();\n if (b == ' ' || b == '\\n' || b == -1) break;\n } catch (IOException e) {\n break;\n }\n }\n }\n\n}",
"Main",
"private static final StringBuilder builder = new StringBuilder();",
"builder",
"new StringBuilder()",
"public static void main(String[] args) {\n int n = readInt();\n BigInteger bi = BigInteger.ONE;\n BigInteger comp = new BigInteger(\"1000000000000000000\");\n boolean over = false;\n\n for (int i = 0; i < n; i++) {\n long a = readLong();\n if (a == 0) {\n System.out.print(0);\n return;\n }\n \n if (over) {\n continue;\n }\n \n bi = bi.multiply(BigInteger.valueOf(a));\n if (bi.compareTo(comp) > 0) {\n over = true;\n }\n }\n \n String ans = over ? \"-1\" : bi.toString();\n\n System.out.print(ans);\n }",
"main",
"{\n int n = readInt();\n BigInteger bi = BigInteger.ONE;\n BigInteger comp = new BigInteger(\"1000000000000000000\");\n boolean over = false;\n\n for (int i = 0; i < n; i++) {\n long a = readLong();\n if (a == 0) {\n System.out.print(0);\n return;\n }\n \n if (over) {\n continue;\n }\n \n bi = bi.multiply(BigInteger.valueOf(a));\n if (bi.compareTo(comp) > 0) {\n over = true;\n }\n }\n \n String ans = over ? \"-1\" : bi.toString();\n\n System.out.print(ans);\n }",
"int n = readInt();",
"n",
"readInt()",
"readInt",
"BigInteger bi = BigInteger.ONE;",
"bi",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"BigInteger comp = new BigInteger(\"1000000000000000000\");",
"comp",
"new BigInteger(\"1000000000000000000\")",
"boolean over = false;",
"over",
"false",
"for (int i = 0; i < n; i++) {\n long a = readLong();\n if (a == 0) {\n System.out.print(0);\n return;\n }\n \n if (over) {\n continue;\n }\n \n bi = bi.multiply(BigInteger.valueOf(a));\n if (bi.compareTo(comp) > 0) {\n over = true;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n long a = readLong();\n if (a == 0) {\n System.out.print(0);\n return;\n }\n \n if (over) {\n continue;\n }\n \n bi = bi.multiply(BigInteger.valueOf(a));\n if (bi.compareTo(comp) > 0) {\n over = true;\n }\n }",
"{\n long a = readLong();\n if (a == 0) {\n System.out.print(0);\n return;\n }\n \n if (over) {\n continue;\n }\n \n bi = bi.multiply(BigInteger.valueOf(a));\n if (bi.compareTo(comp) > 0) {\n over = true;\n }\n }",
"long a = readLong();",
"a",
"readLong()",
"readLong",
"if (a == 0) {\n System.out.print(0);\n return;\n }",
"a == 0",
"a",
"0",
"{\n System.out.print(0);\n return;\n }",
"System.out.print(0)",
"System.out.print",
"System.out",
"System",
"System.out",
"0",
"return;",
"if (over) {\n continue;\n }",
"over",
"{\n continue;\n }",
"continue;",
"bi = bi.multiply(BigInteger.valueOf(a))",
"bi",
"bi.multiply(BigInteger.valueOf(a))",
"bi.multiply",
"bi",
"BigInteger.valueOf(a)",
"BigInteger.valueOf",
"BigInteger",
"a",
"if (bi.compareTo(comp) > 0) {\n over = true;\n }",
"bi.compareTo(comp) > 0",
"bi.compareTo(comp)",
"bi.compareTo",
"bi",
"comp",
"0",
"{\n over = true;\n }",
"over = true",
"over",
"true",
"String ans = over ? \"-1\" : bi.toString();",
"ans",
"over ? \"-1\" : bi.toString()",
"over",
"\"-1\"",
"bi.toString()",
"bi.toString",
"bi",
"System.out.print(ans)",
"System.out.print",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"private static void read() {\n builder.setLength(0);\n while (true) {\n try {\n int b = System.in.read();\n if (b == ' ' || b == '\\n' || b == -1) {\n break;\n } else {\n builder.appendCodePoint(b);\n }\n } catch (IOException e) {\n break;\n }\n }\n }",
"read",
"{\n builder.setLength(0);\n while (true) {\n try {\n int b = System.in.read();\n if (b == ' ' || b == '\\n' || b == -1) {\n break;\n } else {\n builder.appendCodePoint(b);\n }\n } catch (IOException e) {\n break;\n }\n }\n }",
"builder.setLength(0)",
"builder.setLength",
"builder",
"0",
"while (true) {\n try {\n int b = System.in.read();\n if (b == ' ' || b == '\\n' || b == -1) {\n break;\n } else {\n builder.appendCodePoint(b);\n }\n } catch (IOException e) {\n break;\n }\n }",
"true",
"{\n try {\n int b = System.in.read();\n if (b == ' ' || b == '\\n' || b == -1) {\n break;\n } else {\n builder.appendCodePoint(b);\n }\n } catch (IOException e) {\n break;\n }\n }",
"try {\n int b = System.in.read();\n if (b == ' ' || b == '\\n' || b == -1) {\n break;\n } else {\n builder.appendCodePoint(b);\n }\n } catch (IOException e) {\n break;\n }",
"catch (IOException e) {\n break;\n }",
"IOException e",
"{\n break;\n }",
"break;",
"{\n int b = System.in.read();\n if (b == ' ' || b == '\\n' || b == -1) {\n break;\n } else {\n builder.appendCodePoint(b);\n }\n }",
"int b = System.in.read();",
"b",
"System.in.read()",
"System.in.read",
"System.in",
"System",
"System.in",
"if (b == ' ' || b == '\\n' || b == -1) {\n break;\n } else {\n builder.appendCodePoint(b);\n }",
"b == ' ' || b == '\\n' || b == -1",
"b == ' ' || b == '\\n' || b == -1",
"b == ' '",
"b",
"' '",
"b == '\\n'",
"b",
"'\\n'",
"b == -1",
"b",
"-1",
"1",
"{\n break;\n }",
"break;",
"{\n builder.appendCodePoint(b);\n }",
"builder.appendCodePoint(b)",
"builder.appendCodePoint",
"builder",
"b",
"private static int readInt() {\n read();\n return Integer.parseInt(builder.toString());\n }",
"readInt",
"{\n read();\n return Integer.parseInt(builder.toString());\n }",
"read()",
"read",
"return Integer.parseInt(builder.toString());",
"Integer.parseInt(builder.toString())",
"Integer.parseInt",
"Integer",
"builder.toString()",
"builder.toString",
"builder",
"private static int readInt(int radix) {\n read();\n return Integer.parseInt(builder.toString(), radix);\n }",
"readInt",
"{\n read();\n return Integer.parseInt(builder.toString(), radix);\n }",
"read()",
"read",
"return Integer.parseInt(builder.toString(), radix);",
"Integer.parseInt(builder.toString(), radix)",
"Integer.parseInt",
"Integer",
"builder.toString()",
"builder.toString",
"builder",
"radix",
"int radix",
"radix",
"private static long readLong() {\n read();\n return Long.parseLong(builder.toString());\n }",
"readLong",
"{\n read();\n return Long.parseLong(builder.toString());\n }",
"read()",
"read",
"return Long.parseLong(builder.toString());",
"Long.parseLong(builder.toString())",
"Long.parseLong",
"Long",
"builder.toString()",
"builder.toString",
"builder",
"private static long readLong(int radix) {\n read();\n return Long.parseLong(builder.toString(), radix);\n }",
"readLong",
"{\n read();\n return Long.parseLong(builder.toString(), radix);\n }",
"read()",
"read",
"return Long.parseLong(builder.toString(), radix);",
"Long.parseLong(builder.toString(), radix)",
"Long.parseLong",
"Long",
"builder.toString()",
"builder.toString",
"builder",
"radix",
"int radix",
"radix",
"private static BigInteger readBigInteger() {\n read();\n return new BigInteger(builder.toString());\n }",
"readBigInteger",
"{\n read();\n return new BigInteger(builder.toString());\n }",
"read()",
"read",
"return new BigInteger(builder.toString());",
"new BigInteger(builder.toString())",
"private static BigInteger readBigInteger(int radix) {\n read();\n return new BigInteger(builder.toString(), radix);\n }",
"readBigInteger",
"{\n read();\n return new BigInteger(builder.toString(), radix);\n }",
"read()",
"read",
"return new BigInteger(builder.toString(), radix);",
"new BigInteger(builder.toString(), radix)",
"int radix",
"radix",
"private static void skipLine() {\n while (true) {\n try {\n int b = System.in.read();\n if (b == '\\n' || b == -1) {\n break;\n }\n } catch (IOException e) {\n break;\n }\n }\n }",
"skipLine",
"{\n while (true) {\n try {\n int b = System.in.read();\n if (b == '\\n' || b == -1) {\n break;\n }\n } catch (IOException e) {\n break;\n }\n }\n }",
"while (true) {\n try {\n int b = System.in.read();\n if (b == '\\n' || b == -1) {\n break;\n }\n } catch (IOException e) {\n break;\n }\n }",
"true",
"{\n try {\n int b = System.in.read();\n if (b == '\\n' || b == -1) {\n break;\n }\n } catch (IOException e) {\n break;\n }\n }",
"try {\n int b = System.in.read();\n if (b == '\\n' || b == -1) {\n break;\n }\n } catch (IOException e) {\n break;\n }",
"catch (IOException e) {\n break;\n }",
"IOException e",
"{\n break;\n }",
"break;",
"{\n int b = System.in.read();\n if (b == '\\n' || b == -1) {\n break;\n }\n }",
"int b = System.in.read();",
"b",
"System.in.read()",
"System.in.read",
"System.in",
"System",
"System.in",
"if (b == '\\n' || b == -1) {\n break;\n }",
"b == '\\n' || b == -1",
"b == '\\n'",
"b",
"'\\n'",
"b == -1",
"b",
"-1",
"1",
"{\n break;\n }",
"break;",
"private static void skip() {\n while (true) {\n try {\n int b = System.in.read();\n if (b == ' ' || b == '\\n' || b == -1) break;\n } catch (IOException e) {\n break;\n }\n }\n }",
"skip",
"{\n while (true) {\n try {\n int b = System.in.read();\n if (b == ' ' || b == '\\n' || b == -1) break;\n } catch (IOException e) {\n break;\n }\n }\n }",
"while (true) {\n try {\n int b = System.in.read();\n if (b == ' ' || b == '\\n' || b == -1) break;\n } catch (IOException e) {\n break;\n }\n }",
"true",
"{\n try {\n int b = System.in.read();\n if (b == ' ' || b == '\\n' || b == -1) break;\n } catch (IOException e) {\n break;\n }\n }",
"try {\n int b = System.in.read();\n if (b == ' ' || b == '\\n' || b == -1) break;\n } catch (IOException e) {\n break;\n }",
"catch (IOException e) {\n break;\n }",
"IOException e",
"{\n break;\n }",
"break;",
"{\n int b = System.in.read();\n if (b == ' ' || b == '\\n' || b == -1) break;\n }",
"int b = System.in.read();",
"b",
"System.in.read()",
"System.in.read",
"System.in",
"System",
"System.in",
"if (b == ' ' || b == '\\n' || b == -1) break;",
"b == ' ' || b == '\\n' || b == -1",
"b == ' ' || b == '\\n' || b == -1",
"b == ' '",
"b",
"' '",
"b == '\\n'",
"b",
"'\\n'",
"b == -1",
"b",
"-1",
"1",
"break;",
"public class Main {\n private static final StringBuilder builder = new StringBuilder();\n public static void main(String[] args) {\n int n = readInt();\n BigInteger bi = BigInteger.ONE;\n BigInteger comp = new BigInteger(\"1000000000000000000\");\n boolean over = false;\n\n for (int i = 0; i < n; i++) {\n long a = readLong();\n if (a == 0) {\n System.out.print(0);\n return;\n }\n \n if (over) {\n continue;\n }\n \n bi = bi.multiply(BigInteger.valueOf(a));\n if (bi.compareTo(comp) > 0) {\n over = true;\n }\n }\n \n String ans = over ? \"-1\" : bi.toString();\n\n System.out.print(ans);\n }\n\n private static void read() {\n builder.setLength(0);\n while (true) {\n try {\n int b = System.in.read();\n if (b == ' ' || b == '\\n' || b == -1) {\n break;\n } else {\n builder.appendCodePoint(b);\n }\n } catch (IOException e) {\n break;\n }\n }\n }\n\n private static int readInt() {\n read();\n return Integer.parseInt(builder.toString());\n }\n\n private static int readInt(int radix) {\n read();\n return Integer.parseInt(builder.toString(), radix);\n }\n\n private static long readLong() {\n read();\n return Long.parseLong(builder.toString());\n }\n\n private static long readLong(int radix) {\n read();\n return Long.parseLong(builder.toString(), radix);\n }\n\n private static BigInteger readBigInteger() {\n read();\n return new BigInteger(builder.toString());\n }\n\n private static BigInteger readBigInteger(int radix) {\n read();\n return new BigInteger(builder.toString(), radix);\n }\n\n private static void skipLine() {\n while (true) {\n try {\n int b = System.in.read();\n if (b == '\\n' || b == -1) {\n break;\n }\n } catch (IOException e) {\n break;\n }\n }\n }\n\n private static void skip() {\n while (true) {\n try {\n int b = System.in.read();\n if (b == ' ' || b == '\\n' || b == -1) break;\n } catch (IOException e) {\n break;\n }\n }\n }\n\n}",
"public class Main {\n private static final StringBuilder builder = new StringBuilder();\n public static void main(String[] args) {\n int n = readInt();\n BigInteger bi = BigInteger.ONE;\n BigInteger comp = new BigInteger(\"1000000000000000000\");\n boolean over = false;\n\n for (int i = 0; i < n; i++) {\n long a = readLong();\n if (a == 0) {\n System.out.print(0);\n return;\n }\n \n if (over) {\n continue;\n }\n \n bi = bi.multiply(BigInteger.valueOf(a));\n if (bi.compareTo(comp) > 0) {\n over = true;\n }\n }\n \n String ans = over ? \"-1\" : bi.toString();\n\n System.out.print(ans);\n }\n\n private static void read() {\n builder.setLength(0);\n while (true) {\n try {\n int b = System.in.read();\n if (b == ' ' || b == '\\n' || b == -1) {\n break;\n } else {\n builder.appendCodePoint(b);\n }\n } catch (IOException e) {\n break;\n }\n }\n }\n\n private static int readInt() {\n read();\n return Integer.parseInt(builder.toString());\n }\n\n private static int readInt(int radix) {\n read();\n return Integer.parseInt(builder.toString(), radix);\n }\n\n private static long readLong() {\n read();\n return Long.parseLong(builder.toString());\n }\n\n private static long readLong(int radix) {\n read();\n return Long.parseLong(builder.toString(), radix);\n }\n\n private static BigInteger readBigInteger() {\n read();\n return new BigInteger(builder.toString());\n }\n\n private static BigInteger readBigInteger(int radix) {\n read();\n return new BigInteger(builder.toString(), radix);\n }\n\n private static void skipLine() {\n while (true) {\n try {\n int b = System.in.read();\n if (b == '\\n' || b == -1) {\n break;\n }\n } catch (IOException e) {\n break;\n }\n }\n }\n\n private static void skip() {\n while (true) {\n try {\n int b = System.in.read();\n if (b == ' ' || b == '\\n' || b == -1) break;\n } catch (IOException e) {\n break;\n }\n }\n }\n\n}",
"Main"
] |
import java.io.IOException;
import java.math.BigInteger;
public class Main {
private static final StringBuilder builder = new StringBuilder();
public static void main(String[] args) {
int n = readInt();
BigInteger bi = BigInteger.ONE;
BigInteger comp = new BigInteger("1000000000000000000");
boolean over = false;
for (int i = 0; i < n; i++) {
long a = readLong();
if (a == 0) {
System.out.print(0);
return;
}
if (over) {
continue;
}
bi = bi.multiply(BigInteger.valueOf(a));
if (bi.compareTo(comp) > 0) {
over = true;
}
}
String ans = over ? "-1" : bi.toString();
System.out.print(ans);
}
private static void read() {
builder.setLength(0);
while (true) {
try {
int b = System.in.read();
if (b == ' ' || b == '\n' || b == -1) {
break;
} else {
builder.appendCodePoint(b);
}
} catch (IOException e) {
break;
}
}
}
private static int readInt() {
read();
return Integer.parseInt(builder.toString());
}
private static int readInt(int radix) {
read();
return Integer.parseInt(builder.toString(), radix);
}
private static long readLong() {
read();
return Long.parseLong(builder.toString());
}
private static long readLong(int radix) {
read();
return Long.parseLong(builder.toString(), radix);
}
private static BigInteger readBigInteger() {
read();
return new BigInteger(builder.toString());
}
private static BigInteger readBigInteger(int radix) {
read();
return new BigInteger(builder.toString(), radix);
}
private static void skipLine() {
while (true) {
try {
int b = System.in.read();
if (b == '\n' || b == -1) {
break;
}
} catch (IOException e) {
break;
}
}
}
private static void skip() {
while (true) {
try {
int b = System.in.read();
if (b == ' ' || b == '\n' || b == -1) break;
} catch (IOException e) {
break;
}
}
}
}
|
[
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,
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,
0,
18,
13,
13,
13,
4,
18,
13,
41,
13,
17,
41,
13,
4,
18,
13,
17,
17,
41,
13,
17,
41,
13,
17,
4,
18,
13,
13,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
13,
18,
13,
13,
14,
2,
18,
13,
13,
13,
30,
40,
13,
14,
2,
2,
13,
17,
2,
13,
2,
13,
13,
30,
0,
13,
17,
3,
14,
13,
30,
4,
18,
18,
13,
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
],
[
155,
8
],
[
155,
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
],
[
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
],
[
40,
42
],
[
42,
43
],
[
43,
44
],
[
39,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
39,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
11,
59
],
[
59,
60
],
[
60,
61
],
[
11,
62
],
[
62,
63
],
[
62,
64
],
[
11,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
67,
71
],
[
11,
72
],
[
72,
73
],
[
72,
74
],
[
11,
75
],
[
75,
76
],
[
75,
77
],
[
11,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
11,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
82,
89
],
[
89,
90
],
[
89,
91
],
[
82,
92
],
[
92,
93
],
[
93,
94
],
[
82,
95
],
[
96,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
96,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
102,
108
],
[
108,
109
],
[
109,
110
],
[
96,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
118,
120
],
[
111,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
11,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
129,
134
],
[
126,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
143,
144
],
[
135,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
9,
152
],
[
152,
153
],
[
0,
154
],
[
154,
155
],
[
154,
156
]
] |
[
"import java.util.Arrays;\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 = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tboolean isZero = false;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong tmp = sc.nextLong();\n\t\t\tif (tmp == 0) {\n\t\t\t\tisZero = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta[i] = tmp;\n\n\t\t}\n\t\tsc.close();\n\t\tlong ans = 1;\n\t\tlong max = (long) Math.pow(10, 9);\n\t\tint count = 0;\n\t\tboolean isLarge = false;\n\t\tArrays.sort(a);\n\t\tfor (int i = n - 1; i >= 0; i--) {\n\t\t\tans *= a[i];\n\t\t\tif (a[i] > max) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tif (count == 2 || ans > max * max) {\n\t\t\t\tisLarge = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (isZero) {\n\t\t\tSystem.out.println(0);\n\t\t} else if (isLarge) {\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(ans);\n\t\t}\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\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tboolean isZero = false;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong tmp = sc.nextLong();\n\t\t\tif (tmp == 0) {\n\t\t\t\tisZero = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta[i] = tmp;\n\n\t\t}\n\t\tsc.close();\n\t\tlong ans = 1;\n\t\tlong max = (long) Math.pow(10, 9);\n\t\tint count = 0;\n\t\tboolean isLarge = false;\n\t\tArrays.sort(a);\n\t\tfor (int i = n - 1; i >= 0; i--) {\n\t\t\tans *= a[i];\n\t\t\tif (a[i] > max) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tif (count == 2 || ans > max * max) {\n\t\t\t\tisLarge = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (isZero) {\n\t\t\tSystem.out.println(0);\n\t\t} else if (isLarge) {\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.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\tlong[] a = new long[n];\n\t\tboolean isZero = false;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong tmp = sc.nextLong();\n\t\t\tif (tmp == 0) {\n\t\t\t\tisZero = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta[i] = tmp;\n\n\t\t}\n\t\tsc.close();\n\t\tlong ans = 1;\n\t\tlong max = (long) Math.pow(10, 9);\n\t\tint count = 0;\n\t\tboolean isLarge = false;\n\t\tArrays.sort(a);\n\t\tfor (int i = n - 1; i >= 0; i--) {\n\t\t\tans *= a[i];\n\t\t\tif (a[i] > max) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tif (count == 2 || ans > max * max) {\n\t\t\t\tisLarge = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (isZero) {\n\t\t\tSystem.out.println(0);\n\t\t} else if (isLarge) {\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.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\tlong[] a = new long[n];\n\t\tboolean isZero = false;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong tmp = sc.nextLong();\n\t\t\tif (tmp == 0) {\n\t\t\t\tisZero = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta[i] = tmp;\n\n\t\t}\n\t\tsc.close();\n\t\tlong ans = 1;\n\t\tlong max = (long) Math.pow(10, 9);\n\t\tint count = 0;\n\t\tboolean isLarge = false;\n\t\tArrays.sort(a);\n\t\tfor (int i = n - 1; i >= 0; i--) {\n\t\t\tans *= a[i];\n\t\t\tif (a[i] > max) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tif (count == 2 || ans > max * max) {\n\t\t\t\tisLarge = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (isZero) {\n\t\t\tSystem.out.println(0);\n\t\t} else if (isLarge) {\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.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",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"boolean isZero = false;",
"isZero",
"false",
"for (int i = 0; i < n; i++) {\n\t\t\tlong tmp = sc.nextLong();\n\t\t\tif (tmp == 0) {\n\t\t\t\tisZero = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta[i] = tmp;\n\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tlong tmp = sc.nextLong();\n\t\t\tif (tmp == 0) {\n\t\t\t\tisZero = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta[i] = tmp;\n\n\t\t}",
"{\n\t\t\tlong tmp = sc.nextLong();\n\t\t\tif (tmp == 0) {\n\t\t\t\tisZero = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta[i] = tmp;\n\n\t\t}",
"long tmp = sc.nextLong();",
"tmp",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (tmp == 0) {\n\t\t\t\tisZero = true;\n\t\t\t\tbreak;\n\t\t\t}",
"tmp == 0",
"tmp",
"0",
"{\n\t\t\t\tisZero = true;\n\t\t\t\tbreak;\n\t\t\t}",
"isZero = true",
"isZero",
"true",
"break;",
"a[i] = tmp",
"a[i]",
"a",
"i",
"tmp",
"sc.close()",
"sc.close",
"sc",
"long ans = 1;",
"ans",
"1",
"long max = (long) Math.pow(10, 9);",
"max",
"(long) Math.pow(10, 9)",
"Math.pow",
"Math",
"10",
"9",
"int count = 0;",
"count",
"0",
"boolean isLarge = false;",
"isLarge",
"false",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"for (int i = n - 1; i >= 0; i--) {\n\t\t\tans *= a[i];\n\t\t\tif (a[i] > max) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tif (count == 2 || ans > max * max) {\n\t\t\t\tisLarge = true;\n\t\t\t\tbreak;\n\t\t\t}\n\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\tans *= a[i];\n\t\t\tif (a[i] > max) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tif (count == 2 || ans > max * max) {\n\t\t\t\tisLarge = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"{\n\t\t\tans *= a[i];\n\t\t\tif (a[i] > max) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tif (count == 2 || ans > max * max) {\n\t\t\t\tisLarge = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"ans *= a[i]",
"ans",
"a[i]",
"a",
"i",
"if (a[i] > max) {\n\t\t\t\tcount++;\n\t\t\t}",
"a[i] > max",
"a[i]",
"a",
"i",
"max",
"{\n\t\t\t\tcount++;\n\t\t\t}",
"count++",
"count",
"if (count == 2 || ans > max * max) {\n\t\t\t\tisLarge = true;\n\t\t\t\tbreak;\n\t\t\t}",
"count == 2 || ans > max * max",
"count == 2",
"count",
"2",
"ans > max * max",
"ans",
"max * max",
"max",
"max",
"{\n\t\t\t\tisLarge = true;\n\t\t\t\tbreak;\n\t\t\t}",
"isLarge = true",
"isLarge",
"true",
"break;",
"if (isZero) {\n\t\t\tSystem.out.println(0);\n\t\t} else if (isLarge) {\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(ans);\n\t\t}",
"isZero",
"{\n\t\t\tSystem.out.println(0);\n\t\t}",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"if (isLarge) {\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(ans);\n\t\t}",
"isLarge",
"{\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(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\tlong[] a = new long[n];\n\t\tboolean isZero = false;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong tmp = sc.nextLong();\n\t\t\tif (tmp == 0) {\n\t\t\t\tisZero = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta[i] = tmp;\n\n\t\t}\n\t\tsc.close();\n\t\tlong ans = 1;\n\t\tlong max = (long) Math.pow(10, 9);\n\t\tint count = 0;\n\t\tboolean isLarge = false;\n\t\tArrays.sort(a);\n\t\tfor (int i = n - 1; i >= 0; i--) {\n\t\t\tans *= a[i];\n\t\t\tif (a[i] > max) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tif (count == 2 || ans > max * max) {\n\t\t\t\tisLarge = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (isZero) {\n\t\t\tSystem.out.println(0);\n\t\t} else if (isLarge) {\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.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\tlong[] a = new long[n];\n\t\tboolean isZero = false;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong tmp = sc.nextLong();\n\t\t\tif (tmp == 0) {\n\t\t\t\tisZero = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta[i] = tmp;\n\n\t\t}\n\t\tsc.close();\n\t\tlong ans = 1;\n\t\tlong max = (long) Math.pow(10, 9);\n\t\tint count = 0;\n\t\tboolean isLarge = false;\n\t\tArrays.sort(a);\n\t\tfor (int i = n - 1; i >= 0; i--) {\n\t\t\tans *= a[i];\n\t\t\tif (a[i] > max) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tif (count == 2 || ans > max * max) {\n\t\t\t\tisLarge = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (isZero) {\n\t\t\tSystem.out.println(0);\n\t\t} else if (isLarge) {\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\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[] a = new long[n];
boolean isZero = false;
for (int i = 0; i < n; i++) {
long tmp = sc.nextLong();
if (tmp == 0) {
isZero = true;
break;
}
a[i] = tmp;
}
sc.close();
long ans = 1;
long max = (long) Math.pow(10, 9);
int count = 0;
boolean isLarge = false;
Arrays.sort(a);
for (int i = n - 1; i >= 0; i--) {
ans *= a[i];
if (a[i] > max) {
count++;
}
if (count == 2 || ans > max * max) {
isLarge = true;
break;
}
}
if (isZero) {
System.out.println(0);
} else if (isLarge) {
System.out.println(-1);
} else {
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,
29,
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,
29,
30,
41,
13,
18,
13,
13,
0,
13,
4,
18,
13,
13,
13,
14,
2,
4,
18,
13,
17,
17,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
127,
5
],
[
127,
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
],
[
74,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
82,
83
],
[
76,
84
],
[
73,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
85,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
93,
97
],
[
85,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
100,
103
],
[
100,
104
],
[
99,
105
],
[
98,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
112,
113
],
[
106,
114
],
[
8,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
115,
120
],
[
8,
121
],
[
121,
122
],
[
122,
123
],
[
6,
124
],
[
124,
125
],
[
0,
126
],
[
126,
127
],
[
126,
128
]
] |
[
"import java.util.Scanner;\n\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 = sc.nextInt();\n\t\tlong[] nums = new long[n]; \n\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tnums[i] = sc.nextLong();\n\t\t\tif(nums[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\n\t\tlong ans = nums[0];\n\t\tfor(int i = 1; i < n; i++){\n\t\t\ttry{\n\t\t\t\tlong ai = nums[i];\n\t\t\t\tans = Math.multiplyExact(ans,ai);\n\t\t\t\tif((long)Math.pow(10, 18) < ans) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}catch (Exception e){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t\tsc.close();\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 sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] nums = new long[n]; \n\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tnums[i] = sc.nextLong();\n\t\t\tif(nums[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\n\t\tlong ans = nums[0];\n\t\tfor(int i = 1; i < n; i++){\n\t\t\ttry{\n\t\t\t\tlong ai = nums[i];\n\t\t\t\tans = Math.multiplyExact(ans,ai);\n\t\t\t\tif((long)Math.pow(10, 18) < ans) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}catch (Exception e){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t\tsc.close();\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] nums = new long[n]; \n\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tnums[i] = sc.nextLong();\n\t\t\tif(nums[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\n\t\tlong ans = nums[0];\n\t\tfor(int i = 1; i < n; i++){\n\t\t\ttry{\n\t\t\t\tlong ai = nums[i];\n\t\t\t\tans = Math.multiplyExact(ans,ai);\n\t\t\t\tif((long)Math.pow(10, 18) < ans) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}catch (Exception e){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t\tsc.close();\n\t}",
"main",
"{\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] nums = new long[n]; \n\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tnums[i] = sc.nextLong();\n\t\t\tif(nums[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\n\t\tlong ans = nums[0];\n\t\tfor(int i = 1; i < n; i++){\n\t\t\ttry{\n\t\t\t\tlong ai = nums[i];\n\t\t\t\tans = Math.multiplyExact(ans,ai);\n\t\t\t\tif((long)Math.pow(10, 18) < ans) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}catch (Exception e){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(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",
"long[] nums = new long[n];",
"nums",
"new long[n]",
"n",
"for(int i = 0; i < n; i++){\n\t\t\tnums[i] = sc.nextLong();\n\t\t\tif(nums[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\tnums[i] = sc.nextLong();\n\t\t\tif(nums[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\tnums[i] = sc.nextLong();\n\t\t\tif(nums[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"nums[i] = sc.nextLong()",
"nums[i]",
"nums",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(nums[i] == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}",
"nums[i] == 0",
"nums[i]",
"nums",
"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 ans = nums[0];",
"ans",
"nums[0]",
"nums",
"0",
"for(int i = 1; i < n; i++){\n\t\t\ttry{\n\t\t\t\tlong ai = nums[i];\n\t\t\t\tans = Math.multiplyExact(ans,ai);\n\t\t\t\tif((long)Math.pow(10, 18) < ans) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}catch (Exception e){\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\ttry{\n\t\t\t\tlong ai = nums[i];\n\t\t\t\tans = Math.multiplyExact(ans,ai);\n\t\t\t\tif((long)Math.pow(10, 18) < ans) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}catch (Exception e){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"{\n\t\t\ttry{\n\t\t\t\tlong ai = nums[i];\n\t\t\t\tans = Math.multiplyExact(ans,ai);\n\t\t\t\tif((long)Math.pow(10, 18) < ans) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}catch (Exception e){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"try{\n\t\t\t\tlong ai = nums[i];\n\t\t\t\tans = Math.multiplyExact(ans,ai);\n\t\t\t\tif((long)Math.pow(10, 18) < ans) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}catch (Exception e){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}",
"catch (Exception e){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}",
"Exception e",
"{\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\tlong ai = nums[i];\n\t\t\t\tans = Math.multiplyExact(ans,ai);\n\t\t\t\tif((long)Math.pow(10, 18) < ans) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}",
"long ai = nums[i];",
"ai",
"nums[i]",
"nums",
"i",
"ans = Math.multiplyExact(ans,ai)",
"ans",
"Math.multiplyExact(ans,ai)",
"Math.multiplyExact",
"Math",
"ans",
"ai",
"if((long)Math.pow(10, 18) < ans) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}",
"(long)Math.pow(10, 18) < ans",
"(long)Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"ans",
"{\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(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"sc.close()",
"sc.close",
"sc",
"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 = sc.nextInt();\n\t\tlong[] nums = new long[n]; \n\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tnums[i] = sc.nextLong();\n\t\t\tif(nums[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\n\t\tlong ans = nums[0];\n\t\tfor(int i = 1; i < n; i++){\n\t\t\ttry{\n\t\t\t\tlong ai = nums[i];\n\t\t\t\tans = Math.multiplyExact(ans,ai);\n\t\t\t\tif((long)Math.pow(10, 18) < ans) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}catch (Exception e){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t\tsc.close();\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 = sc.nextInt();\n\t\tlong[] nums = new long[n]; \n\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tnums[i] = sc.nextLong();\n\t\t\tif(nums[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\n\t\tlong ans = nums[0];\n\t\tfor(int i = 1; i < n; i++){\n\t\t\ttry{\n\t\t\t\tlong ai = nums[i];\n\t\t\t\tans = Math.multiplyExact(ans,ai);\n\t\t\t\tif((long)Math.pow(10, 18) < ans) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}catch (Exception e){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t\tsc.close();\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[] nums = new long[n];
for(int i = 0; i < n; i++){
nums[i] = sc.nextLong();
if(nums[i] == 0) {
System.out.println(0);
return;
}
}
long ans = nums[0];
for(int i = 1; i < n; i++){
try{
long ai = nums[i];
ans = Math.multiplyExact(ans,ai);
if((long)Math.pow(10, 18) < ans) {
System.out.println(-1);
return;
}
}catch (Exception e){
System.out.println(-1);
return;
}
}
System.out.println(ans);
sc.close();
}
}
|
[
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,
20,
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,
13,
30,
0,
13,
4,
18,
13,
4,
18,
13,
13,
14,
2,
13,
2,
4,
18,
13,
4,
18,
13,
13,
17,
30,
0,
13,
17,
14,
13,
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
],
[
111,
8
],
[
111,
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,
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
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
45,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
79,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
78,
86
],
[
75,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
11,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
94,
99
],
[
91,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
106,
107
],
[
9,
108
],
[
108,
109
],
[
0,
110
],
[
110,
111
],
[
110,
112
]
] |
[
"import java.util.*;\nimport java.math.BigInteger;\n\npublic class Main {\n \n public static void main(String[] args) {\n \n Scanner scan = new Scanner(System.in);\n long N = scan.nextLong();\n long limit = (long) Math.pow(10,18);\n BigInteger product = new BigInteger(\"1\");\n boolean smaller = true;\n \n for (int i = 1; i <= N; i++) {\n long A_i = scan.nextLong();\n \n if (A_i == 0) {\n System.out.println(0);\n return;\n }\n \n if (smaller) {\n product = product.multiply(BigInteger.valueOf(A_i));\n }\n \n if (smaller && product.compareTo(BigInteger.valueOf(limit)) == 1) {\n smaller = false;\n } \n }\n \n if (smaller) {\n System.out.println(product);\n }\n \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 \n public static void main(String[] args) {\n \n Scanner scan = new Scanner(System.in);\n long N = scan.nextLong();\n long limit = (long) Math.pow(10,18);\n BigInteger product = new BigInteger(\"1\");\n boolean smaller = true;\n \n for (int i = 1; i <= N; i++) {\n long A_i = scan.nextLong();\n \n if (A_i == 0) {\n System.out.println(0);\n return;\n }\n \n if (smaller) {\n product = product.multiply(BigInteger.valueOf(A_i));\n }\n \n if (smaller && product.compareTo(BigInteger.valueOf(limit)) == 1) {\n smaller = false;\n } \n }\n \n if (smaller) {\n System.out.println(product);\n }\n \n else {\n System.out.println(-1);\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n \n Scanner scan = new Scanner(System.in);\n long N = scan.nextLong();\n long limit = (long) Math.pow(10,18);\n BigInteger product = new BigInteger(\"1\");\n boolean smaller = true;\n \n for (int i = 1; i <= N; i++) {\n long A_i = scan.nextLong();\n \n if (A_i == 0) {\n System.out.println(0);\n return;\n }\n \n if (smaller) {\n product = product.multiply(BigInteger.valueOf(A_i));\n }\n \n if (smaller && product.compareTo(BigInteger.valueOf(limit)) == 1) {\n smaller = false;\n } \n }\n \n if (smaller) {\n System.out.println(product);\n }\n \n else {\n System.out.println(-1);\n }\n }",
"main",
"{\n \n Scanner scan = new Scanner(System.in);\n long N = scan.nextLong();\n long limit = (long) Math.pow(10,18);\n BigInteger product = new BigInteger(\"1\");\n boolean smaller = true;\n \n for (int i = 1; i <= N; i++) {\n long A_i = scan.nextLong();\n \n if (A_i == 0) {\n System.out.println(0);\n return;\n }\n \n if (smaller) {\n product = product.multiply(BigInteger.valueOf(A_i));\n }\n \n if (smaller && product.compareTo(BigInteger.valueOf(limit)) == 1) {\n smaller = false;\n } \n }\n \n if (smaller) {\n System.out.println(product);\n }\n \n else {\n System.out.println(-1);\n }\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"long N = scan.nextLong();",
"N",
"scan.nextLong()",
"scan.nextLong",
"scan",
"long limit = (long) Math.pow(10,18);",
"limit",
"(long) Math.pow(10,18)",
"Math.pow",
"Math",
"10",
"18",
"BigInteger product = new BigInteger(\"1\");",
"product",
"new BigInteger(\"1\")",
"boolean smaller = true;",
"smaller",
"true",
"for (int i = 1; i <= N; i++) {\n long A_i = scan.nextLong();\n \n if (A_i == 0) {\n System.out.println(0);\n return;\n }\n \n if (smaller) {\n product = product.multiply(BigInteger.valueOf(A_i));\n }\n \n if (smaller && product.compareTo(BigInteger.valueOf(limit)) == 1) {\n smaller = false;\n } \n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i <= N",
"i",
"N",
"i++",
"i++",
"i",
"{\n long A_i = scan.nextLong();\n \n if (A_i == 0) {\n System.out.println(0);\n return;\n }\n \n if (smaller) {\n product = product.multiply(BigInteger.valueOf(A_i));\n }\n \n if (smaller && product.compareTo(BigInteger.valueOf(limit)) == 1) {\n smaller = false;\n } \n }",
"{\n long A_i = scan.nextLong();\n \n if (A_i == 0) {\n System.out.println(0);\n return;\n }\n \n if (smaller) {\n product = product.multiply(BigInteger.valueOf(A_i));\n }\n \n if (smaller && product.compareTo(BigInteger.valueOf(limit)) == 1) {\n smaller = false;\n } \n }",
"long A_i = scan.nextLong();",
"A_i",
"scan.nextLong()",
"scan.nextLong",
"scan",
"if (A_i == 0) {\n System.out.println(0);\n return;\n }",
"A_i == 0",
"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 (smaller) {\n product = product.multiply(BigInteger.valueOf(A_i));\n }",
"smaller",
"{\n product = product.multiply(BigInteger.valueOf(A_i));\n }",
"product = product.multiply(BigInteger.valueOf(A_i))",
"product",
"product.multiply(BigInteger.valueOf(A_i))",
"product.multiply",
"product",
"BigInteger.valueOf(A_i)",
"BigInteger.valueOf",
"BigInteger",
"A_i",
"if (smaller && product.compareTo(BigInteger.valueOf(limit)) == 1) {\n smaller = false;\n }",
"smaller && product.compareTo(BigInteger.valueOf(limit)) == 1",
"smaller",
"product.compareTo(BigInteger.valueOf(limit)) == 1",
"product.compareTo(BigInteger.valueOf(limit))",
"product.compareTo",
"product",
"BigInteger.valueOf(limit)",
"BigInteger.valueOf",
"BigInteger",
"limit",
"1",
"{\n smaller = false;\n }",
"smaller = false",
"smaller",
"false",
"if (smaller) {\n System.out.println(product);\n }\n \n else {\n System.out.println(-1);\n }",
"smaller",
"{\n System.out.println(product);\n }",
"System.out.println(product)",
"System.out.println",
"System.out",
"System",
"System.out",
"product",
"{\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 \n public static void main(String[] args) {\n \n Scanner scan = new Scanner(System.in);\n long N = scan.nextLong();\n long limit = (long) Math.pow(10,18);\n BigInteger product = new BigInteger(\"1\");\n boolean smaller = true;\n \n for (int i = 1; i <= N; i++) {\n long A_i = scan.nextLong();\n \n if (A_i == 0) {\n System.out.println(0);\n return;\n }\n \n if (smaller) {\n product = product.multiply(BigInteger.valueOf(A_i));\n }\n \n if (smaller && product.compareTo(BigInteger.valueOf(limit)) == 1) {\n smaller = false;\n } \n }\n \n if (smaller) {\n System.out.println(product);\n }\n \n else {\n System.out.println(-1);\n }\n }\n}",
"public class Main {\n \n public static void main(String[] args) {\n \n Scanner scan = new Scanner(System.in);\n long N = scan.nextLong();\n long limit = (long) Math.pow(10,18);\n BigInteger product = new BigInteger(\"1\");\n boolean smaller = true;\n \n for (int i = 1; i <= N; i++) {\n long A_i = scan.nextLong();\n \n if (A_i == 0) {\n System.out.println(0);\n return;\n }\n \n if (smaller) {\n product = product.multiply(BigInteger.valueOf(A_i));\n }\n \n if (smaller && product.compareTo(BigInteger.valueOf(limit)) == 1) {\n smaller = false;\n } \n }\n \n if (smaller) {\n System.out.println(product);\n }\n \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 scan = new Scanner(System.in);
long N = scan.nextLong();
long limit = (long) Math.pow(10,18);
BigInteger product = new BigInteger("1");
boolean smaller = true;
for (int i = 1; i <= N; i++) {
long A_i = scan.nextLong();
if (A_i == 0) {
System.out.println(0);
return;
}
if (smaller) {
product = product.multiply(BigInteger.valueOf(A_i));
}
if (smaller && product.compareTo(BigInteger.valueOf(limit)) == 1) {
smaller = false;
}
}
if (smaller) {
System.out.println(product);
}
else {
System.out.println(-1);
}
}
}
|
[
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,
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,
30,
38,
5,
13,
30,
4,
18,
18,
13,
13,
40,
17,
4,
18,
13,
17,
30,
0,
13,
4,
18,
13,
13,
18,
13,
13,
14,
2,
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
],
[
113,
8
],
[
113,
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
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
41,
42
],
[
11,
43
],
[
43,
44
],
[
44,
45
],
[
43,
46
],
[
11,
47
],
[
47,
48
],
[
47,
49
],
[
11,
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
],
[
64,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
72,
73
],
[
66,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
63,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
81,
85
],
[
85,
86
],
[
85,
87
],
[
62,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
98,
99
],
[
92,
100
],
[
100,
101
],
[
101,
102
],
[
100,
103
],
[
11,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
9,
110
],
[
110,
111
],
[
0,
112
],
[
112,
113
],
[
112,
114
]
] |
[
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main{\n public static void main(String[] args){\n\t Scanner sc = new Scanner(System.in);\n\t int n=sc.nextInt();\n\t long[] a=new long[n];\n\t for(int i=0;i<n;i++)a[i]=sc.nextLong();\n\t Arrays.sort(a);\n\t long sum=1;\n\t for(int i=0;i<n;i++) {\n\t\t try{\n\t\t\t sum=Math.multiplyExact(sum, a[i]);\n\t\t }catch(ArithmeticException e){\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }\n\t\t if(sum>1000000000000000000L) {\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }\n\t }\n\t System.out.println(sum);\n }\n}\n",
"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\t Scanner sc = new Scanner(System.in);\n\t int n=sc.nextInt();\n\t long[] a=new long[n];\n\t for(int i=0;i<n;i++)a[i]=sc.nextLong();\n\t Arrays.sort(a);\n\t long sum=1;\n\t for(int i=0;i<n;i++) {\n\t\t try{\n\t\t\t sum=Math.multiplyExact(sum, a[i]);\n\t\t }catch(ArithmeticException e){\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }\n\t\t if(sum>1000000000000000000L) {\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }\n\t }\n\t System.out.println(sum);\n }\n}",
"Main",
"public static void main(String[] args){\n\t Scanner sc = new Scanner(System.in);\n\t int n=sc.nextInt();\n\t long[] a=new long[n];\n\t for(int i=0;i<n;i++)a[i]=sc.nextLong();\n\t Arrays.sort(a);\n\t long sum=1;\n\t for(int i=0;i<n;i++) {\n\t\t try{\n\t\t\t sum=Math.multiplyExact(sum, a[i]);\n\t\t }catch(ArithmeticException e){\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }\n\t\t if(sum>1000000000000000000L) {\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }\n\t }\n\t System.out.println(sum);\n }",
"main",
"{\n\t Scanner sc = new Scanner(System.in);\n\t int n=sc.nextInt();\n\t long[] a=new long[n];\n\t for(int i=0;i<n;i++)a[i]=sc.nextLong();\n\t Arrays.sort(a);\n\t long sum=1;\n\t for(int i=0;i<n;i++) {\n\t\t try{\n\t\t\t sum=Math.multiplyExact(sum, a[i]);\n\t\t }catch(ArithmeticException e){\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }\n\t\t if(sum>1000000000000000000L) {\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }\n\t }\n\t 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",
"long[] a=new long[n];",
"a",
"new long[n]",
"n",
"for(int i=0;i<n;i++)a[i]=sc.nextLong();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"a[i]=sc.nextLong();",
"a[i]=sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"long sum=1;",
"sum",
"1",
"for(int i=0;i<n;i++) {\n\t\t try{\n\t\t\t sum=Math.multiplyExact(sum, a[i]);\n\t\t }catch(ArithmeticException e){\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }\n\t\t if(sum>1000000000000000000L) {\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }\n\t }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t try{\n\t\t\t sum=Math.multiplyExact(sum, a[i]);\n\t\t }catch(ArithmeticException e){\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }\n\t\t if(sum>1000000000000000000L) {\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }\n\t }",
"{\n\t\t try{\n\t\t\t sum=Math.multiplyExact(sum, a[i]);\n\t\t }catch(ArithmeticException e){\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }\n\t\t if(sum>1000000000000000000L) {\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }\n\t }",
"try{\n\t\t\t sum=Math.multiplyExact(sum, a[i]);\n\t\t }catch(ArithmeticException e){\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }",
"catch(ArithmeticException e){\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }",
"ArithmeticException e",
"{\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"System.exit(0)",
"System.exit",
"System",
"0",
"{\n\t\t\t sum=Math.multiplyExact(sum, a[i]);\n\t\t }",
"sum=Math.multiplyExact(sum, a[i])",
"sum",
"Math.multiplyExact(sum, a[i])",
"Math.multiplyExact",
"Math",
"sum",
"a[i]",
"a",
"i",
"if(sum>1000000000000000000L) {\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }",
"sum>1000000000000000000L",
"sum",
"1000000000000000000L",
"{\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\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(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n\t Scanner sc = new Scanner(System.in);\n\t int n=sc.nextInt();\n\t long[] a=new long[n];\n\t for(int i=0;i<n;i++)a[i]=sc.nextLong();\n\t Arrays.sort(a);\n\t long sum=1;\n\t for(int i=0;i<n;i++) {\n\t\t try{\n\t\t\t sum=Math.multiplyExact(sum, a[i]);\n\t\t }catch(ArithmeticException e){\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }\n\t\t if(sum>1000000000000000000L) {\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }\n\t }\n\t System.out.println(sum);\n }\n}",
"public class Main{\n public static void main(String[] args){\n\t Scanner sc = new Scanner(System.in);\n\t int n=sc.nextInt();\n\t long[] a=new long[n];\n\t for(int i=0;i<n;i++)a[i]=sc.nextLong();\n\t Arrays.sort(a);\n\t long sum=1;\n\t for(int i=0;i<n;i++) {\n\t\t try{\n\t\t\t sum=Math.multiplyExact(sum, a[i]);\n\t\t }catch(ArithmeticException e){\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }\n\t\t if(sum>1000000000000000000L) {\n\t\t\t System.out.println(-1);\n\t\t\t System.exit(0);\n\t\t }\n\t }\n\t System.out.println(sum);\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[] a=new long[n];
for(int i=0;i<n;i++)a[i]=sc.nextLong();
Arrays.sort(a);
long sum=1;
for(int i=0;i<n;i++) {
try{
sum=Math.multiplyExact(sum, a[i]);
}catch(ArithmeticException e){
System.out.println(-1);
System.exit(0);
}
if(sum>1000000000000000000L) {
System.out.println(-1);
System.exit(0);
}
}
System.out.println(sum);
}
}
|
[
7,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
14,
2,
13,
17,
30,
4,
18,
13,
17,
29,
30,
0,
18,
13,
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,
9,
14,
2,
18,
13,
13,
2,
17,
13,
30,
0,
13,
18,
13,
13,
30,
4,
18,
13,
40,
17,
29,
4,
18,
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
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
160,
17
],
[
160,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
23,
25
],
[
20,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
28,
30
],
[
20,
31
],
[
31,
32
],
[
31,
33
],
[
20,
34
],
[
34,
35
],
[
34,
36
],
[
20,
37
],
[
37,
38
],
[
37,
39
],
[
20,
40
],
[
40,
41
],
[
41,
42
],
[
40,
43
],
[
40,
44
],
[
40,
45
],
[
20,
46
],
[
46,
47
],
[
47,
48
],
[
18,
49
],
[
49,
50
],
[
160,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
59,
60
],
[
55,
61
],
[
61,
62
],
[
61,
63
],
[
55,
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
],
[
78,
80
],
[
80,
81
],
[
81,
82
],
[
77,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
92,
97
],
[
83,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
55,
104
],
[
104,
105
],
[
104,
106
],
[
55,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
112,
113
],
[
112,
114
],
[
107,
115
],
[
115,
116
],
[
116,
117
],
[
107,
118
],
[
119,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
120,
126
],
[
126,
127
],
[
119,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
129,
133
],
[
133,
134
],
[
133,
135
],
[
128,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
139,
141
],
[
128,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
143,
146
],
[
146,
147
],
[
142,
148
],
[
55,
149
],
[
149,
150
],
[
150,
151
],
[
149,
152
],
[
53,
153
],
[
153,
154
],
[
53,
155
],
[
155,
156
],
[
53,
157
],
[
157,
158
],
[
0,
159
],
[
159,
160
],
[
159,
161
]
] |
[
"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\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 Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n abc169_b solver = new abc169_b();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class abc169_b {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int N = in.nextInt();\n long a[] = new long[N];\n for (int i = 0; i < N; i++) {\n long by = in.nextLong();\n if (by == 0) {\n if (by == 0) {\n out.println(0);\n return;\n }\n } else {\n a[i] = by;\n }\n }\n /*\n BigInteger multi = new BigInteger(0);\n long max = 1000000000000000000l;\n if (multi.compareTo(BigInteger.valueOf(0)) ==0) {\n out.println(0);\n return;\n }\n */\n long wkval = 1;\n for (int i = 0; i < N; i++) {\n if (a[i] == 1) {\n continue;\n }\n if (a[i] <= (1000000000000000000l / wkval)) {\n wkval *= a[i];\n } else {\n out.println(-1);\n return;\n }\n /*\n if (multi.compareTo(BigInteger.valueOf(1000000000000000000l/multi.longValue())) ==1) {\n out.println(-1);\n return;\n }\n multi =multi.multiply(BigInteger.valueOf(by));\n */\n }\n out.println(wkval);\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.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n abc169_b solver = new abc169_b();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class abc169_b {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int N = in.nextInt();\n long a[] = new long[N];\n for (int i = 0; i < N; i++) {\n long by = in.nextLong();\n if (by == 0) {\n if (by == 0) {\n out.println(0);\n return;\n }\n } else {\n a[i] = by;\n }\n }\n /*\n BigInteger multi = new BigInteger(0);\n long max = 1000000000000000000l;\n if (multi.compareTo(BigInteger.valueOf(0)) ==0) {\n out.println(0);\n return;\n }\n */\n long wkval = 1;\n for (int i = 0; i < N; i++) {\n if (a[i] == 1) {\n continue;\n }\n if (a[i] <= (1000000000000000000l / wkval)) {\n wkval *= a[i];\n } else {\n out.println(-1);\n return;\n }\n /*\n if (multi.compareTo(BigInteger.valueOf(1000000000000000000l/multi.longValue())) ==1) {\n out.println(-1);\n return;\n }\n multi =multi.multiply(BigInteger.valueOf(by));\n */\n }\n out.println(wkval);\n }\n\n }\n}",
"Main",
"public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n abc169_b solver = new abc169_b();\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 abc169_b solver = new abc169_b();\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)",
"abc169_b solver = new abc169_b();",
"solver",
"new abc169_b()",
"solver.solve(1, in, out)",
"solver.solve",
"solver",
"1",
"in",
"out",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class abc169_b {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int N = in.nextInt();\n long a[] = new long[N];\n for (int i = 0; i < N; i++) {\n long by = in.nextLong();\n if (by == 0) {\n if (by == 0) {\n out.println(0);\n return;\n }\n } else {\n a[i] = by;\n }\n }\n /*\n BigInteger multi = new BigInteger(0);\n long max = 1000000000000000000l;\n if (multi.compareTo(BigInteger.valueOf(0)) ==0) {\n out.println(0);\n return;\n }\n */\n long wkval = 1;\n for (int i = 0; i < N; i++) {\n if (a[i] == 1) {\n continue;\n }\n if (a[i] <= (1000000000000000000l / wkval)) {\n wkval *= a[i];\n } else {\n out.println(-1);\n return;\n }\n /*\n if (multi.compareTo(BigInteger.valueOf(1000000000000000000l/multi.longValue())) ==1) {\n out.println(-1);\n return;\n }\n multi =multi.multiply(BigInteger.valueOf(by));\n */\n }\n out.println(wkval);\n }\n\n }",
"abc169_b",
"public void solve(int testNumber, Scanner in, PrintWriter out) {\n int N = in.nextInt();\n long a[] = new long[N];\n for (int i = 0; i < N; i++) {\n long by = in.nextLong();\n if (by == 0) {\n if (by == 0) {\n out.println(0);\n return;\n }\n } else {\n a[i] = by;\n }\n }\n /*\n BigInteger multi = new BigInteger(0);\n long max = 1000000000000000000l;\n if (multi.compareTo(BigInteger.valueOf(0)) ==0) {\n out.println(0);\n return;\n }\n */\n long wkval = 1;\n for (int i = 0; i < N; i++) {\n if (a[i] == 1) {\n continue;\n }\n if (a[i] <= (1000000000000000000l / wkval)) {\n wkval *= a[i];\n } else {\n out.println(-1);\n return;\n }\n /*\n if (multi.compareTo(BigInteger.valueOf(1000000000000000000l/multi.longValue())) ==1) {\n out.println(-1);\n return;\n }\n multi =multi.multiply(BigInteger.valueOf(by));\n */\n }\n out.println(wkval);\n }",
"solve",
"{\n int N = in.nextInt();\n long a[] = new long[N];\n for (int i = 0; i < N; i++) {\n long by = in.nextLong();\n if (by == 0) {\n if (by == 0) {\n out.println(0);\n return;\n }\n } else {\n a[i] = by;\n }\n }\n /*\n BigInteger multi = new BigInteger(0);\n long max = 1000000000000000000l;\n if (multi.compareTo(BigInteger.valueOf(0)) ==0) {\n out.println(0);\n return;\n }\n */\n long wkval = 1;\n for (int i = 0; i < N; i++) {\n if (a[i] == 1) {\n continue;\n }\n if (a[i] <= (1000000000000000000l / wkval)) {\n wkval *= a[i];\n } else {\n out.println(-1);\n return;\n }\n /*\n if (multi.compareTo(BigInteger.valueOf(1000000000000000000l/multi.longValue())) ==1) {\n out.println(-1);\n return;\n }\n multi =multi.multiply(BigInteger.valueOf(by));\n */\n }\n out.println(wkval);\n }",
"int N = in.nextInt();",
"N",
"in.nextInt()",
"in.nextInt",
"in",
"long a[] = new long[N];",
"a",
"new long[N]",
"N",
"for (int i = 0; i < N; i++) {\n long by = in.nextLong();\n if (by == 0) {\n if (by == 0) {\n out.println(0);\n return;\n }\n } else {\n a[i] = by;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n long by = in.nextLong();\n if (by == 0) {\n if (by == 0) {\n out.println(0);\n return;\n }\n } else {\n a[i] = by;\n }\n }",
"{\n long by = in.nextLong();\n if (by == 0) {\n if (by == 0) {\n out.println(0);\n return;\n }\n } else {\n a[i] = by;\n }\n }",
"long by = in.nextLong();",
"by",
"in.nextLong()",
"in.nextLong",
"in",
"if (by == 0) {\n if (by == 0) {\n out.println(0);\n return;\n }\n } else {\n a[i] = by;\n }",
"by == 0",
"by",
"0",
"{\n if (by == 0) {\n out.println(0);\n return;\n }\n }",
"if (by == 0) {\n out.println(0);\n return;\n }",
"by == 0",
"by",
"0",
"{\n out.println(0);\n return;\n }",
"out.println(0)",
"out.println",
"out",
"0",
"return;",
"{\n a[i] = by;\n }",
"a[i] = by",
"a[i]",
"a",
"i",
"by",
"long wkval = 1;",
"wkval",
"1",
"for (int i = 0; i < N; i++) {\n if (a[i] == 1) {\n continue;\n }\n if (a[i] <= (1000000000000000000l / wkval)) {\n wkval *= a[i];\n } else {\n out.println(-1);\n return;\n }\n /*\n if (multi.compareTo(BigInteger.valueOf(1000000000000000000l/multi.longValue())) ==1) {\n out.println(-1);\n return;\n }\n multi =multi.multiply(BigInteger.valueOf(by));\n */\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if (a[i] == 1) {\n continue;\n }\n if (a[i] <= (1000000000000000000l / wkval)) {\n wkval *= a[i];\n } else {\n out.println(-1);\n return;\n }\n /*\n if (multi.compareTo(BigInteger.valueOf(1000000000000000000l/multi.longValue())) ==1) {\n out.println(-1);\n return;\n }\n multi =multi.multiply(BigInteger.valueOf(by));\n */\n }",
"{\n if (a[i] == 1) {\n continue;\n }\n if (a[i] <= (1000000000000000000l / wkval)) {\n wkval *= a[i];\n } else {\n out.println(-1);\n return;\n }\n /*\n if (multi.compareTo(BigInteger.valueOf(1000000000000000000l/multi.longValue())) ==1) {\n out.println(-1);\n return;\n }\n multi =multi.multiply(BigInteger.valueOf(by));\n */\n }",
"if (a[i] == 1) {\n continue;\n }",
"a[i] == 1",
"a[i]",
"a",
"i",
"1",
"{\n continue;\n }",
"continue;",
"if (a[i] <= (1000000000000000000l / wkval)) {\n wkval *= a[i];\n } else {\n out.println(-1);\n return;\n }",
"a[i] <= (1000000000000000000l / wkval)",
"a[i]",
"a",
"i",
"(1000000000000000000l / wkval)",
"1000000000000000000l",
"wkval",
"{\n wkval *= a[i];\n }",
"wkval *= a[i]",
"wkval",
"a[i]",
"a",
"i",
"{\n out.println(-1);\n return;\n }",
"out.println(-1)",
"out.println",
"out",
"-1",
"1",
"return;",
"out.println(wkval)",
"out.println",
"out",
"wkval",
"int testNumber",
"testNumber",
"Scanner in",
"in",
"PrintWriter out",
"out",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n abc169_b solver = new abc169_b();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class abc169_b {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int N = in.nextInt();\n long a[] = new long[N];\n for (int i = 0; i < N; i++) {\n long by = in.nextLong();\n if (by == 0) {\n if (by == 0) {\n out.println(0);\n return;\n }\n } else {\n a[i] = by;\n }\n }\n /*\n BigInteger multi = new BigInteger(0);\n long max = 1000000000000000000l;\n if (multi.compareTo(BigInteger.valueOf(0)) ==0) {\n out.println(0);\n return;\n }\n */\n long wkval = 1;\n for (int i = 0; i < N; i++) {\n if (a[i] == 1) {\n continue;\n }\n if (a[i] <= (1000000000000000000l / wkval)) {\n wkval *= a[i];\n } else {\n out.println(-1);\n return;\n }\n /*\n if (multi.compareTo(BigInteger.valueOf(1000000000000000000l/multi.longValue())) ==1) {\n out.println(-1);\n return;\n }\n multi =multi.multiply(BigInteger.valueOf(by));\n */\n }\n out.println(wkval);\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 Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n abc169_b solver = new abc169_b();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class abc169_b {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int N = in.nextInt();\n long a[] = new long[N];\n for (int i = 0; i < N; i++) {\n long by = in.nextLong();\n if (by == 0) {\n if (by == 0) {\n out.println(0);\n return;\n }\n } else {\n a[i] = by;\n }\n }\n /*\n BigInteger multi = new BigInteger(0);\n long max = 1000000000000000000l;\n if (multi.compareTo(BigInteger.valueOf(0)) ==0) {\n out.println(0);\n return;\n }\n */\n long wkval = 1;\n for (int i = 0; i < N; i++) {\n if (a[i] == 1) {\n continue;\n }\n if (a[i] <= (1000000000000000000l / wkval)) {\n wkval *= a[i];\n } else {\n out.println(-1);\n return;\n }\n /*\n if (multi.compareTo(BigInteger.valueOf(1000000000000000000l/multi.longValue())) ==1) {\n out.println(-1);\n return;\n }\n multi =multi.multiply(BigInteger.valueOf(by));\n */\n }\n out.println(wkval);\n }\n\n }\n}",
"Main"
] |
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
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);
abc169_b solver = new abc169_b();
solver.solve(1, in, out);
out.close();
}
static class abc169_b {
public void solve(int testNumber, Scanner in, PrintWriter out) {
int N = in.nextInt();
long a[] = new long[N];
for (int i = 0; i < N; i++) {
long by = in.nextLong();
if (by == 0) {
if (by == 0) {
out.println(0);
return;
}
} else {
a[i] = by;
}
}
/*
BigInteger multi = new BigInteger(0);
long max = 1000000000000000000l;
if (multi.compareTo(BigInteger.valueOf(0)) ==0) {
out.println(0);
return;
}
*/
long wkval = 1;
for (int i = 0; i < N; i++) {
if (a[i] == 1) {
continue;
}
if (a[i] <= (1000000000000000000l / wkval)) {
wkval *= a[i];
} else {
out.println(-1);
return;
}
/*
if (multi.compareTo(BigInteger.valueOf(1000000000000000000l/multi.longValue())) ==1) {
out.println(-1);
return;
}
multi =multi.multiply(BigInteger.valueOf(by));
*/
}
out.println(wkval);
}
}
}
|
[
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,
18,
13,
13,
41,
13,
4,
18,
13,
17,
17,
41,
13,
18,
13,
13,
0,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
38,
5,
13,
30,
4,
18,
18,
13,
13,
40,
17,
4,
18,
13,
17,
30,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
4,
18,
13,
4,
18,
13,
14,
2,
4,
18,
13,
13,
17,
30,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
17,
30,
4,
18,
18,
13,
13,
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
],
[
138,
11
],
[
138,
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
],
[
25,
26
],
[
25,
27
],
[
14,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
30,
33
],
[
30,
34
],
[
14,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
37,
39
],
[
14,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
43,
44
],
[
42,
45
],
[
45,
46
],
[
46,
47
],
[
45,
48
],
[
14,
49
],
[
49,
50
],
[
14,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
60,
61
],
[
54,
62
],
[
62,
63
],
[
63,
64
],
[
62,
65
],
[
51,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
72,
73
],
[
72,
74
],
[
67,
75
],
[
75,
76
],
[
76,
77
],
[
67,
78
],
[
79,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
88,
89
],
[
89,
90
],
[
79,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
92,
97
],
[
91,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
99,
104
],
[
104,
105
],
[
104,
106
],
[
99,
107
],
[
107,
108
],
[
108,
109
],
[
99,
110
],
[
111,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
113,
117
],
[
112,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
118,
125
],
[
125,
126
],
[
126,
127
],
[
125,
128
],
[
14,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
129,
134
],
[
12,
135
],
[
135,
136
],
[
0,
137
],
[
137,
138
],
[
137,
139
]
] |
[
"import java.util.*;\nimport java.lang.*;\nimport java.math.BigInteger;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tlong n = sc.nextLong();\n BigInteger count = BigInteger.ONE;\n \tlong z = (long)Math.pow(10, 18);\n \tBigInteger check = BigInteger.ONE;\n \tcheck = check.multiply(BigInteger.valueOf(z));\n int i;\n \t\n try{\n \t\tfor(i = 0;i < n; i++){\n count = count.multiply(BigInteger.valueOf(sc.nextLong()));\n \t//10の18乗を超えた時\n \tif(count.compareTo(check) > 0){\n \t//強引にキャッチさせる構文にする\n \tfor(i = 0;i <= n ; i++){\n if(sc.nextLong() == 0){\n System.out.println(0);\n \t\t System.exit(0); \n }\n }\n \t\t\t }\n \t}\n }catch (NoSuchElementException e){\n System.out.println(-1);\n \tSystem.exit(0);\n }\n\n \t System.out.println(count);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.lang.*;",
"lang.*",
"java",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tlong n = sc.nextLong();\n BigInteger count = BigInteger.ONE;\n \tlong z = (long)Math.pow(10, 18);\n \tBigInteger check = BigInteger.ONE;\n \tcheck = check.multiply(BigInteger.valueOf(z));\n int i;\n \t\n try{\n \t\tfor(i = 0;i < n; i++){\n count = count.multiply(BigInteger.valueOf(sc.nextLong()));\n \t//10の18乗を超えた時\n \tif(count.compareTo(check) > 0){\n \t//強引にキャッチさせる構文にする\n \tfor(i = 0;i <= n ; i++){\n if(sc.nextLong() == 0){\n System.out.println(0);\n \t\t System.exit(0); \n }\n }\n \t\t\t }\n \t}\n }catch (NoSuchElementException e){\n System.out.println(-1);\n \tSystem.exit(0);\n }\n\n \t System.out.println(count);\n }\n}",
"Main",
"public static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tlong n = sc.nextLong();\n BigInteger count = BigInteger.ONE;\n \tlong z = (long)Math.pow(10, 18);\n \tBigInteger check = BigInteger.ONE;\n \tcheck = check.multiply(BigInteger.valueOf(z));\n int i;\n \t\n try{\n \t\tfor(i = 0;i < n; i++){\n count = count.multiply(BigInteger.valueOf(sc.nextLong()));\n \t//10の18乗を超えた時\n \tif(count.compareTo(check) > 0){\n \t//強引にキャッチさせる構文にする\n \tfor(i = 0;i <= n ; i++){\n if(sc.nextLong() == 0){\n System.out.println(0);\n \t\t System.exit(0); \n }\n }\n \t\t\t }\n \t}\n }catch (NoSuchElementException e){\n System.out.println(-1);\n \tSystem.exit(0);\n }\n\n \t System.out.println(count);\n }",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tlong n = sc.nextLong();\n BigInteger count = BigInteger.ONE;\n \tlong z = (long)Math.pow(10, 18);\n \tBigInteger check = BigInteger.ONE;\n \tcheck = check.multiply(BigInteger.valueOf(z));\n int i;\n \t\n try{\n \t\tfor(i = 0;i < n; i++){\n count = count.multiply(BigInteger.valueOf(sc.nextLong()));\n \t//10の18乗を超えた時\n \tif(count.compareTo(check) > 0){\n \t//強引にキャッチさせる構文にする\n \tfor(i = 0;i <= n ; i++){\n if(sc.nextLong() == 0){\n System.out.println(0);\n \t\t System.exit(0); \n }\n }\n \t\t\t }\n \t}\n }catch (NoSuchElementException e){\n System.out.println(-1);\n \tSystem.exit(0);\n }\n\n \t System.out.println(count);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"long n = sc.nextLong();",
"n",
"sc.nextLong()",
"sc.nextLong",
"sc",
"BigInteger count = BigInteger.ONE;",
"count",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"long z = (long)Math.pow(10, 18);",
"z",
"(long)Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"BigInteger check = BigInteger.ONE;",
"check",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"check = check.multiply(BigInteger.valueOf(z))",
"check",
"check.multiply(BigInteger.valueOf(z))",
"check.multiply",
"check",
"BigInteger.valueOf(z)",
"BigInteger.valueOf",
"BigInteger",
"z",
"int i;",
"i",
"try{\n \t\tfor(i = 0;i < n; i++){\n count = count.multiply(BigInteger.valueOf(sc.nextLong()));\n \t//10の18乗を超えた時\n \tif(count.compareTo(check) > 0){\n \t//強引にキャッチさせる構文にする\n \tfor(i = 0;i <= n ; i++){\n if(sc.nextLong() == 0){\n System.out.println(0);\n \t\t System.exit(0); \n }\n }\n \t\t\t }\n \t}\n }catch (NoSuchElementException e){\n System.out.println(-1);\n \tSystem.exit(0);\n }",
"catch (NoSuchElementException e){\n System.out.println(-1);\n \tSystem.exit(0);\n }",
"NoSuchElementException e",
"{\n System.out.println(-1);\n \tSystem.exit(0);\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"System.exit(0)",
"System.exit",
"System",
"0",
"{\n \t\tfor(i = 0;i < n; i++){\n count = count.multiply(BigInteger.valueOf(sc.nextLong()));\n \t//10の18乗を超えた時\n \tif(count.compareTo(check) > 0){\n \t//強引にキャッチさせる構文にする\n \tfor(i = 0;i <= n ; i++){\n if(sc.nextLong() == 0){\n System.out.println(0);\n \t\t System.exit(0); \n }\n }\n \t\t\t }\n \t}\n }",
"for(i = 0;i < n; i++){\n count = count.multiply(BigInteger.valueOf(sc.nextLong()));\n \t//10の18乗を超えた時\n \tif(count.compareTo(check) > 0){\n \t//強引にキャッチさせる構文にする\n \tfor(i = 0;i <= n ; i++){\n if(sc.nextLong() == 0){\n System.out.println(0);\n \t\t System.exit(0); \n }\n }\n \t\t\t }\n \t}",
"i = 0;",
"i = 0",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n count = count.multiply(BigInteger.valueOf(sc.nextLong()));\n \t//10の18乗を超えた時\n \tif(count.compareTo(check) > 0){\n \t//強引にキャッチさせる構文にする\n \tfor(i = 0;i <= n ; i++){\n if(sc.nextLong() == 0){\n System.out.println(0);\n \t\t System.exit(0); \n }\n }\n \t\t\t }\n \t}",
"{\n count = count.multiply(BigInteger.valueOf(sc.nextLong()));\n \t//10の18乗を超えた時\n \tif(count.compareTo(check) > 0){\n \t//強引にキャッチさせる構文にする\n \tfor(i = 0;i <= n ; i++){\n if(sc.nextLong() == 0){\n System.out.println(0);\n \t\t System.exit(0); \n }\n }\n \t\t\t }\n \t}",
"count = count.multiply(BigInteger.valueOf(sc.nextLong()))",
"count",
"count.multiply(BigInteger.valueOf(sc.nextLong()))",
"count.multiply",
"count",
"BigInteger.valueOf(sc.nextLong())",
"BigInteger.valueOf",
"BigInteger",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(count.compareTo(check) > 0){\n \t//強引にキャッチさせる構文にする\n \tfor(i = 0;i <= n ; i++){\n if(sc.nextLong() == 0){\n System.out.println(0);\n \t\t System.exit(0); \n }\n }\n \t\t\t }",
"count.compareTo(check) > 0",
"count.compareTo(check)",
"count.compareTo",
"count",
"check",
"0",
"{\n \t//強引にキャッチさせる構文にする\n \tfor(i = 0;i <= n ; i++){\n if(sc.nextLong() == 0){\n System.out.println(0);\n \t\t System.exit(0); \n }\n }\n \t\t\t }",
"for(i = 0;i <= n ; i++){\n if(sc.nextLong() == 0){\n System.out.println(0);\n \t\t System.exit(0); \n }\n }",
"i = 0;",
"i = 0",
"i",
"0",
"i <= n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(sc.nextLong() == 0){\n System.out.println(0);\n \t\t System.exit(0); \n }\n }",
"{\n if(sc.nextLong() == 0){\n System.out.println(0);\n \t\t System.exit(0); \n }\n }",
"if(sc.nextLong() == 0){\n System.out.println(0);\n \t\t System.exit(0); \n }",
"sc.nextLong() == 0",
"sc.nextLong()",
"sc.nextLong",
"sc",
"0",
"{\n System.out.println(0);\n \t\t System.exit(0); \n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"System.exit(0)",
"System.exit",
"System",
"0",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tlong n = sc.nextLong();\n BigInteger count = BigInteger.ONE;\n \tlong z = (long)Math.pow(10, 18);\n \tBigInteger check = BigInteger.ONE;\n \tcheck = check.multiply(BigInteger.valueOf(z));\n int i;\n \t\n try{\n \t\tfor(i = 0;i < n; i++){\n count = count.multiply(BigInteger.valueOf(sc.nextLong()));\n \t//10の18乗を超えた時\n \tif(count.compareTo(check) > 0){\n \t//強引にキャッチさせる構文にする\n \tfor(i = 0;i <= n ; i++){\n if(sc.nextLong() == 0){\n System.out.println(0);\n \t\t System.exit(0); \n }\n }\n \t\t\t }\n \t}\n }catch (NoSuchElementException e){\n System.out.println(-1);\n \tSystem.exit(0);\n }\n\n \t System.out.println(count);\n }\n}",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tlong n = sc.nextLong();\n BigInteger count = BigInteger.ONE;\n \tlong z = (long)Math.pow(10, 18);\n \tBigInteger check = BigInteger.ONE;\n \tcheck = check.multiply(BigInteger.valueOf(z));\n int i;\n \t\n try{\n \t\tfor(i = 0;i < n; i++){\n count = count.multiply(BigInteger.valueOf(sc.nextLong()));\n \t//10の18乗を超えた時\n \tif(count.compareTo(check) > 0){\n \t//強引にキャッチさせる構文にする\n \tfor(i = 0;i <= n ; i++){\n if(sc.nextLong() == 0){\n System.out.println(0);\n \t\t System.exit(0); \n }\n }\n \t\t\t }\n \t}\n }catch (NoSuchElementException e){\n System.out.println(-1);\n \tSystem.exit(0);\n }\n\n \t System.out.println(count);\n }\n}",
"Main"
] |
import java.util.*;
import java.lang.*;
import java.math.BigInteger;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
// 整数の入力
long n = sc.nextLong();
BigInteger count = BigInteger.ONE;
long z = (long)Math.pow(10, 18);
BigInteger check = BigInteger.ONE;
check = check.multiply(BigInteger.valueOf(z));
int i;
try{
for(i = 0;i < n; i++){
count = count.multiply(BigInteger.valueOf(sc.nextLong()));
//10の18乗を超えた時
if(count.compareTo(check) > 0){
//強引にキャッチさせる構文にする
for(i = 0;i <= n ; i++){
if(sc.nextLong() == 0){
System.out.println(0);
System.exit(0);
}
}
}
}
}catch (NoSuchElementException e){
System.out.println(-1);
System.exit(0);
}
System.out.println(count);
}
}
|
[
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,
17,
11,
1,
41,
13,
17,
2,
13,
13,
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
],
[
103,
5
],
[
103,
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
],
[
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
],
[
71,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
8,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
94,
99
],
[
6,
100
],
[
100,
101
],
[
0,
102
],
[
102,
103
],
[
102,
104
]
] |
[
"import java.util.Scanner;\npublic class Main {\n\tpublic static void main(String[] args) {\n\n//\t入力の読み込み\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N]; //Aという配列を作成。N+1個の配列がある。\n\n//\tいずれかのAに0が含まれる場合\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\n//\tAへの入力の時点で結果が「-1」になる場合を判断\n//\t「-1」にならんかったら下の処理に続く\n\t\tlong total = 1; //計算結果を表す変数\n\t\tfor(int i=0 ; i<N ; i++) {\n\t\t\tif(A[i] > 1000000000000000000L / total) { //1000...を超える値が変わってくるからtotalで割ってる\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal *= A[i];\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.print(total);\n\n//\t計算し終わった段階でtotalの表示をする\n//\n//\t\tif(total <= 1000000000000000000L) {\n//\t\t\tSystem.out.print(total);\n//\t\t}\n//\t\telse {\n//\t\t\tSystem.out.print(-1);\n//\t\t}\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\n//\t入力の読み込み\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N]; //Aという配列を作成。N+1個の配列がある。\n\n//\tいずれかのAに0が含まれる場合\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\n//\tAへの入力の時点で結果が「-1」になる場合を判断\n//\t「-1」にならんかったら下の処理に続く\n\t\tlong total = 1; //計算結果を表す変数\n\t\tfor(int i=0 ; i<N ; i++) {\n\t\t\tif(A[i] > 1000000000000000000L / total) { //1000...を超える値が変わってくるからtotalで割ってる\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal *= A[i];\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.print(total);\n\n//\t計算し終わった段階でtotalの表示をする\n//\n//\t\tif(total <= 1000000000000000000L) {\n//\t\t\tSystem.out.print(total);\n//\t\t}\n//\t\telse {\n//\t\t\tSystem.out.print(-1);\n//\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\n//\t入力の読み込み\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N]; //Aという配列を作成。N+1個の配列がある。\n\n//\tいずれかのAに0が含まれる場合\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\n//\tAへの入力の時点で結果が「-1」になる場合を判断\n//\t「-1」にならんかったら下の処理に続く\n\t\tlong total = 1; //計算結果を表す変数\n\t\tfor(int i=0 ; i<N ; i++) {\n\t\t\tif(A[i] > 1000000000000000000L / total) { //1000...を超える値が変わってくるからtotalで割ってる\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal *= A[i];\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.print(total);\n\n//\t計算し終わった段階でtotalの表示をする\n//\n//\t\tif(total <= 1000000000000000000L) {\n//\t\t\tSystem.out.print(total);\n//\t\t}\n//\t\telse {\n//\t\t\tSystem.out.print(-1);\n//\t\t}\n\t}",
"main",
"{\n\n//\t入力の読み込み\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N]; //Aという配列を作成。N+1個の配列がある。\n\n//\tいずれかのAに0が含まれる場合\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\n//\tAへの入力の時点で結果が「-1」になる場合を判断\n//\t「-1」にならんかったら下の処理に続く\n\t\tlong total = 1; //計算結果を表す変数\n\t\tfor(int i=0 ; i<N ; i++) {\n\t\t\tif(A[i] > 1000000000000000000L / total) { //1000...を超える値が変わってくるからtotalで割ってる\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal *= A[i];\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.print(total);\n\n//\t計算し終わった段階でtotalの表示をする\n//\n//\t\tif(total <= 1000000000000000000L) {\n//\t\t\tSystem.out.print(total);\n//\t\t}\n//\t\telse {\n//\t\t\tSystem.out.print(-1);\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",
"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 total = 1;",
"total",
"1",
"for(int i=0 ; i<N ; i++) {\n\t\t\tif(A[i] > 1000000000000000000L / total) { //1000...を超える値が変わってくるからtotalで割ってる\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal *= 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\tif(A[i] > 1000000000000000000L / total) { //1000...を超える値が変わってくるからtotalで割ってる\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal *= A[i];\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(A[i] > 1000000000000000000L / total) { //1000...を超える値が変わってくるからtotalで割ってる\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal *= A[i];\n\t\t\t}\n\t\t}",
"if(A[i] > 1000000000000000000L / total) { //1000...を超える値が変わってくるからtotalで割ってる\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal *= A[i];\n\t\t\t}",
"A[i] > 1000000000000000000L / total",
"A[i]",
"A",
"i",
"1000000000000000000L / total",
"1000000000000000000L",
"total",
"{ //1000...を超える値が変わってくるからtotalで割ってる\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\ttotal *= A[i];\n\t\t\t}",
"total *= A[i]",
"total",
"A[i]",
"A",
"i",
"System.out.print(total)",
"System.out.print",
"System.out",
"System",
"System.out",
"total",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\n//\t入力の読み込み\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N]; //Aという配列を作成。N+1個の配列がある。\n\n//\tいずれかのAに0が含まれる場合\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\n//\tAへの入力の時点で結果が「-1」になる場合を判断\n//\t「-1」にならんかったら下の処理に続く\n\t\tlong total = 1; //計算結果を表す変数\n\t\tfor(int i=0 ; i<N ; i++) {\n\t\t\tif(A[i] > 1000000000000000000L / total) { //1000...を超える値が変わってくるからtotalで割ってる\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal *= A[i];\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.print(total);\n\n//\t計算し終わった段階でtotalの表示をする\n//\n//\t\tif(total <= 1000000000000000000L) {\n//\t\t\tSystem.out.print(total);\n//\t\t}\n//\t\telse {\n//\t\t\tSystem.out.print(-1);\n//\t\t}\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\n//\t入力の読み込み\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N]; //Aという配列を作成。N+1個の配列がある。\n\n//\tいずれかのAに0が含まれる場合\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\n//\tAへの入力の時点で結果が「-1」になる場合を判断\n//\t「-1」にならんかったら下の処理に続く\n\t\tlong total = 1; //計算結果を表す変数\n\t\tfor(int i=0 ; i<N ; i++) {\n\t\t\tif(A[i] > 1000000000000000000L / total) { //1000...を超える値が変わってくるからtotalで割ってる\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal *= A[i];\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.print(total);\n\n//\t計算し終わった段階でtotalの表示をする\n//\n//\t\tif(total <= 1000000000000000000L) {\n//\t\t\tSystem.out.print(total);\n//\t\t}\n//\t\telse {\n//\t\t\tSystem.out.print(-1);\n//\t\t}\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]; //Aという配列を作成。N+1個の配列がある。
// いずれかのAに0が含まれる場合
for(int i=0 ; i<N ; i++) {
A[i]=sc.nextLong(); //入力された配列の読み込み
if(A[i] == 0) {
System.out.println(0);
return;
}
}
// Aへの入力の時点で結果が「-1」になる場合を判断
// 「-1」にならんかったら下の処理に続く
long total = 1; //計算結果を表す変数
for(int i=0 ; i<N ; i++) {
if(A[i] > 1000000000000000000L / total) { //1000...を超える値が変わってくるからtotalで割ってる
System.out.println(-1);
return;
}
else {
total *= A[i];
}
}
System.out.print(total);
// 計算し終わった段階でtotalの表示をする
//
// if(total <= 1000000000000000000L) {
// System.out.print(total);
// }
// else {
// System.out.print(-1);
// }
}
}
|
[
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,
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,
41,
13,
18,
13,
13,
14,
2,
2,
4,
18,
13,
13,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
29,
0,
13,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
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,
23
],
[
23,
24
],
[
23,
25
],
[
11,
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
],
[
11,
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
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
81,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
80,
90
],
[
79,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
92,
97
],
[
97,
98
],
[
91,
99
],
[
73,
100
],
[
100,
101
],
[
100,
102
],
[
11,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
103,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
115,
120
],
[
120,
121
],
[
9,
122
],
[
122,
123
]
] |
[
"import java.math.BigDecimal;\nimport java.util.Scanner;\n\nclass Main {\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 ans = 1;\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\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tlong a = A[i];\n\t\t\tif(Math.log10(ans) + Math.log10(a) > 18) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans *= a;\n\n\t\t}\n\n\n\t\tif(ans <= 1000000000000000000l) {\n\t\t\tSystem.out.println(ans);\n\t\t}else {\n\t\t\tSystem.out.println(-1);\n\t\t}\n\n\t}\n}\n",
"import java.math.BigDecimal;",
"BigDecimal",
"java.math",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main {\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 ans = 1;\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\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tlong a = A[i];\n\t\t\tif(Math.log10(ans) + Math.log10(a) > 18) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans *= a;\n\n\t\t}\n\n\n\t\tif(ans <= 1000000000000000000l) {\n\t\t\tSystem.out.println(ans);\n\t\t}else {\n\t\t\tSystem.out.println(-1);\n\t\t}\n\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 ans = 1;\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\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tlong a = A[i];\n\t\t\tif(Math.log10(ans) + Math.log10(a) > 18) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans *= a;\n\n\t\t}\n\n\n\t\tif(ans <= 1000000000000000000l) {\n\t\t\tSystem.out.println(ans);\n\t\t}else {\n\t\t\tSystem.out.println(-1);\n\t\t}\n\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint N = sc.nextInt();\n\t\tlong ans = 1;\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\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tlong a = A[i];\n\t\t\tif(Math.log10(ans) + Math.log10(a) > 18) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans *= a;\n\n\t\t}\n\n\n\t\tif(ans <= 1000000000000000000l) {\n\t\t\tSystem.out.println(ans);\n\t\t}else {\n\t\t\tSystem.out.println(-1);\n\t\t}\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 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\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 ;",
"for(int i=0; i<N; i++) {\n\t\t\tlong a = A[i];\n\t\t\tif(Math.log10(ans) + Math.log10(a) > 18) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans *= a;\n\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tlong a = A[i];\n\t\t\tif(Math.log10(ans) + Math.log10(a) > 18) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans *= a;\n\n\t\t}",
"{\n\t\t\tlong a = A[i];\n\t\t\tif(Math.log10(ans) + Math.log10(a) > 18) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans *= a;\n\n\t\t}",
"long a = A[i];",
"a",
"A[i]",
"A",
"i",
"if(Math.log10(ans) + Math.log10(a) > 18) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}",
"Math.log10(ans) + Math.log10(a) > 18",
"Math.log10(ans) + Math.log10(a)",
"Math.log10(ans)",
"Math.log10",
"Math",
"ans",
"Math.log10(a)",
"Math.log10",
"Math",
"a",
"18",
"{\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;",
"ans *= a",
"ans",
"a",
"if(ans <= 1000000000000000000l) {\n\t\t\tSystem.out.println(ans);\n\t\t}else {\n\t\t\tSystem.out.println(-1);\n\t\t}",
"ans <= 1000000000000000000l",
"ans",
"1000000000000000000l",
"{\n\t\t\tSystem.out.println(ans);\n\t\t}",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"{\n\t\t\tSystem.out.println(-1);\n\t\t}",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"String[] args",
"args"
] |
import java.math.BigDecimal;
import java.util.Scanner;
class Main {
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] = sc.nextLong();
if(A[i] == 0) {
System.out.println(0);
return ;
}
}
for(int i=0; i<N; i++) {
long a = A[i];
if(Math.log10(ans) + Math.log10(a) > 18) {
System.out.println(-1);
return;
}
ans *= a;
}
if(ans <= 1000000000000000000l) {
System.out.println(ans);
}else {
System.out.println(-1);
}
}
}
|
[
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,
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,
0,
13,
13,
14,
2,
2,
13,
17,
2,
13,
17,
30,
0,
13,
17,
14,
13,
30,
4,
18,
18,
13,
13,
17,
30,
14,
13,
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
],
[
100,
5
],
[
100,
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
],
[
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
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
42,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
42,
56
],
[
56,
57
],
[
56,
58
],
[
42,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
64
],
[
64,
65
],
[
64,
66
],
[
59,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
8,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
71,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
84,
89
],
[
81,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
6,
97
],
[
97,
98
],
[
0,
99
],
[
99,
100
],
[
99,
101
]
] |
[
"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 ans = 1;\n long[] array = new long[n];\n boolean flag = false;\n boolean flag_z = false;\n\n for(int i=0; i<n; i++){\n long num = sc.nextLong();\n if(num==0){\n flag_z = true;\n }\n ans *= num;\n if(ans<=0||ans>1000000000000000000L){\n flag = true;\n }\n\n //System.out.println(\"ans:\"+ans);\n }\n\n if(flag_z){\n System.out.println(0);\n }else{\n if(flag){\n System.out.println(\"-1\");\n }else{\n System.out.println(ans);\n }\n }\n\n\n\n // System.out.println(900000000000000000L*900000000000000000L);\n //\n // String bin = Long.toBinaryString(1000000000000000000L);\n // System.out.println(bin);\n // System.out.println(bin.length());\n\n // for(long i=1000000000000000000L; i>1e17; i--){\n // System.out.println(i*1000000000000000000L);\n // if(i*1000000000000000000L<1000000000000000000L&&i*1000000000000000000L>0){\n // System.out.println(\"i\"+i);\n // break;\n // }\n // }\n //999999999999999988\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 ans = 1;\n long[] array = new long[n];\n boolean flag = false;\n boolean flag_z = false;\n\n for(int i=0; i<n; i++){\n long num = sc.nextLong();\n if(num==0){\n flag_z = true;\n }\n ans *= num;\n if(ans<=0||ans>1000000000000000000L){\n flag = true;\n }\n\n //System.out.println(\"ans:\"+ans);\n }\n\n if(flag_z){\n System.out.println(0);\n }else{\n if(flag){\n System.out.println(\"-1\");\n }else{\n System.out.println(ans);\n }\n }\n\n\n\n // System.out.println(900000000000000000L*900000000000000000L);\n //\n // String bin = Long.toBinaryString(1000000000000000000L);\n // System.out.println(bin);\n // System.out.println(bin.length());\n\n // for(long i=1000000000000000000L; i>1e17; i--){\n // System.out.println(i*1000000000000000000L);\n // if(i*1000000000000000000L<1000000000000000000L&&i*1000000000000000000L>0){\n // System.out.println(\"i\"+i);\n // break;\n // }\n // }\n //999999999999999988\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n long ans = 1;\n long[] array = new long[n];\n boolean flag = false;\n boolean flag_z = false;\n\n for(int i=0; i<n; i++){\n long num = sc.nextLong();\n if(num==0){\n flag_z = true;\n }\n ans *= num;\n if(ans<=0||ans>1000000000000000000L){\n flag = true;\n }\n\n //System.out.println(\"ans:\"+ans);\n }\n\n if(flag_z){\n System.out.println(0);\n }else{\n if(flag){\n System.out.println(\"-1\");\n }else{\n System.out.println(ans);\n }\n }\n\n\n\n // System.out.println(900000000000000000L*900000000000000000L);\n //\n // String bin = Long.toBinaryString(1000000000000000000L);\n // System.out.println(bin);\n // System.out.println(bin.length());\n\n // for(long i=1000000000000000000L; i>1e17; i--){\n // System.out.println(i*1000000000000000000L);\n // if(i*1000000000000000000L<1000000000000000000L&&i*1000000000000000000L>0){\n // System.out.println(\"i\"+i);\n // break;\n // }\n // }\n //999999999999999988\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n long ans = 1;\n long[] array = new long[n];\n boolean flag = false;\n boolean flag_z = false;\n\n for(int i=0; i<n; i++){\n long num = sc.nextLong();\n if(num==0){\n flag_z = true;\n }\n ans *= num;\n if(ans<=0||ans>1000000000000000000L){\n flag = true;\n }\n\n //System.out.println(\"ans:\"+ans);\n }\n\n if(flag_z){\n System.out.println(0);\n }else{\n if(flag){\n System.out.println(\"-1\");\n }else{\n System.out.println(ans);\n }\n }\n\n\n\n // System.out.println(900000000000000000L*900000000000000000L);\n //\n // String bin = Long.toBinaryString(1000000000000000000L);\n // System.out.println(bin);\n // System.out.println(bin.length());\n\n // for(long i=1000000000000000000L; i>1e17; i--){\n // System.out.println(i*1000000000000000000L);\n // if(i*1000000000000000000L<1000000000000000000L&&i*1000000000000000000L>0){\n // System.out.println(\"i\"+i);\n // break;\n // }\n // }\n //999999999999999988\n }",
"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[] array = new long[n];",
"array",
"new long[n]",
"n",
"boolean flag = false;",
"flag",
"false",
"boolean flag_z = false;",
"flag_z",
"false",
"for(int i=0; i<n; i++){\n long num = sc.nextLong();\n if(num==0){\n flag_z = true;\n }\n ans *= num;\n if(ans<=0||ans>1000000000000000000L){\n flag = true;\n }\n\n //System.out.println(\"ans:\"+ans);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n long num = sc.nextLong();\n if(num==0){\n flag_z = true;\n }\n ans *= num;\n if(ans<=0||ans>1000000000000000000L){\n flag = true;\n }\n\n //System.out.println(\"ans:\"+ans);\n }",
"{\n long num = sc.nextLong();\n if(num==0){\n flag_z = true;\n }\n ans *= num;\n if(ans<=0||ans>1000000000000000000L){\n flag = true;\n }\n\n //System.out.println(\"ans:\"+ans);\n }",
"long num = sc.nextLong();",
"num",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(num==0){\n flag_z = true;\n }",
"num==0",
"num",
"0",
"{\n flag_z = true;\n }",
"flag_z = true",
"flag_z",
"true",
"ans *= num",
"ans",
"num",
"if(ans<=0||ans>1000000000000000000L){\n flag = true;\n }",
"ans<=0||ans>1000000000000000000L",
"ans<=0",
"ans",
"0",
"ans>1000000000000000000L",
"ans",
"1000000000000000000L",
"{\n flag = true;\n }",
"flag = true",
"flag",
"true",
"if(flag_z){\n System.out.println(0);\n }else{\n if(flag){\n System.out.println(\"-1\");\n }else{\n System.out.println(ans);\n }\n }",
"flag_z",
"{\n System.out.println(0);\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"{\n if(flag){\n System.out.println(\"-1\");\n }else{\n System.out.println(ans);\n }\n }",
"if(flag){\n System.out.println(\"-1\");\n }else{\n System.out.println(ans);\n }",
"flag",
"{\n System.out.println(\"-1\");\n }",
"System.out.println(\"-1\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-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 Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n long ans = 1;\n long[] array = new long[n];\n boolean flag = false;\n boolean flag_z = false;\n\n for(int i=0; i<n; i++){\n long num = sc.nextLong();\n if(num==0){\n flag_z = true;\n }\n ans *= num;\n if(ans<=0||ans>1000000000000000000L){\n flag = true;\n }\n\n //System.out.println(\"ans:\"+ans);\n }\n\n if(flag_z){\n System.out.println(0);\n }else{\n if(flag){\n System.out.println(\"-1\");\n }else{\n System.out.println(ans);\n }\n }\n\n\n\n // System.out.println(900000000000000000L*900000000000000000L);\n //\n // String bin = Long.toBinaryString(1000000000000000000L);\n // System.out.println(bin);\n // System.out.println(bin.length());\n\n // for(long i=1000000000000000000L; i>1e17; i--){\n // System.out.println(i*1000000000000000000L);\n // if(i*1000000000000000000L<1000000000000000000L&&i*1000000000000000000L>0){\n // System.out.println(\"i\"+i);\n // break;\n // }\n // }\n //999999999999999988\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 ans = 1;\n long[] array = new long[n];\n boolean flag = false;\n boolean flag_z = false;\n\n for(int i=0; i<n; i++){\n long num = sc.nextLong();\n if(num==0){\n flag_z = true;\n }\n ans *= num;\n if(ans<=0||ans>1000000000000000000L){\n flag = true;\n }\n\n //System.out.println(\"ans:\"+ans);\n }\n\n if(flag_z){\n System.out.println(0);\n }else{\n if(flag){\n System.out.println(\"-1\");\n }else{\n System.out.println(ans);\n }\n }\n\n\n\n // System.out.println(900000000000000000L*900000000000000000L);\n //\n // String bin = Long.toBinaryString(1000000000000000000L);\n // System.out.println(bin);\n // System.out.println(bin.length());\n\n // for(long i=1000000000000000000L; i>1e17; i--){\n // System.out.println(i*1000000000000000000L);\n // if(i*1000000000000000000L<1000000000000000000L&&i*1000000000000000000L>0){\n // System.out.println(\"i\"+i);\n // break;\n // }\n // }\n //999999999999999988\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 ans = 1;
long[] array = new long[n];
boolean flag = false;
boolean flag_z = false;
for(int i=0; i<n; i++){
long num = sc.nextLong();
if(num==0){
flag_z = true;
}
ans *= num;
if(ans<=0||ans>1000000000000000000L){
flag = true;
}
//System.out.println("ans:"+ans);
}
if(flag_z){
System.out.println(0);
}else{
if(flag){
System.out.println("-1");
}else{
System.out.println(ans);
}
}
// System.out.println(900000000000000000L*900000000000000000L);
//
// String bin = Long.toBinaryString(1000000000000000000L);
// System.out.println(bin);
// System.out.println(bin.length());
// for(long i=1000000000000000000L; i>1e17; i--){
// System.out.println(i*1000000000000000000L);
// if(i*1000000000000000000L<1000000000000000000L&&i*1000000000000000000L>0){
// System.out.println("i"+i);
// break;
// }
// }
//999999999999999988
}
}
|
[
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,
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,
14,
13,
9,
14,
2,
13,
17,
30,
0,
13,
17,
9,
41,
13,
2,
13,
13,
14,
2,
2,
2,
2,
13,
13,
2,
13,
17,
2,
13,
13,
2,
13,
13,
30,
0,
13,
17,
0,
13,
13,
14,
13,
30,
4,
18,
18,
13,
13,
17,
29,
14,
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
],
[
120,
8
],
[
120,
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,
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
],
[
50,
52
],
[
44,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
57,
61
],
[
44,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
64,
66
],
[
44,
67
],
[
67,
68
],
[
70,
69
],
[
77,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
74
],
[
74,
75
],
[
74,
76
],
[
77,
77
],
[
77,
78
],
[
77,
79
],
[
70,
80
],
[
80,
81
],
[
80,
82
],
[
67,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
44,
87
],
[
87,
88
],
[
87,
89
],
[
11,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
92,
99
],
[
11,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
108,
109
],
[
102,
110
],
[
11,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
9,
117
],
[
117,
118
],
[
0,
119
],
[
119,
120
],
[
119,
121
]
] |
[
"import java.math.BigInteger;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n long N = sc.nextLong();\n long r = 1L;\n boolean existZero = false;\n boolean overThres = false;\n final long thres = 1000000000000000000L;\n for(int i=1; i<=N; i++) {\n long tmp = sc.nextLong();\n if(existZero) continue;\n if(tmp==0L) {\n existZero = true;\n continue;\n }\n long new_r = r * tmp;\n if(new_r> thres || new_r < 0 || new_r < r || new_r < tmp) {\n overThres = true;\n }\n r = new_r;\n }\n if(existZero) {\n System.out.println(0);\n return;\n }\n if(overThres) {\n System.out.println(-1);\n return;\n }\n System.out.println(r);\n }\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n long N = sc.nextLong();\n long r = 1L;\n boolean existZero = false;\n boolean overThres = false;\n final long thres = 1000000000000000000L;\n for(int i=1; i<=N; i++) {\n long tmp = sc.nextLong();\n if(existZero) continue;\n if(tmp==0L) {\n existZero = true;\n continue;\n }\n long new_r = r * tmp;\n if(new_r> thres || new_r < 0 || new_r < r || new_r < tmp) {\n overThres = true;\n }\n r = new_r;\n }\n if(existZero) {\n System.out.println(0);\n return;\n }\n if(overThres) {\n System.out.println(-1);\n return;\n }\n System.out.println(r);\n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n long N = sc.nextLong();\n long r = 1L;\n boolean existZero = false;\n boolean overThres = false;\n final long thres = 1000000000000000000L;\n for(int i=1; i<=N; i++) {\n long tmp = sc.nextLong();\n if(existZero) continue;\n if(tmp==0L) {\n existZero = true;\n continue;\n }\n long new_r = r * tmp;\n if(new_r> thres || new_r < 0 || new_r < r || new_r < tmp) {\n overThres = true;\n }\n r = new_r;\n }\n if(existZero) {\n System.out.println(0);\n return;\n }\n if(overThres) {\n System.out.println(-1);\n return;\n }\n System.out.println(r);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n long N = sc.nextLong();\n long r = 1L;\n boolean existZero = false;\n boolean overThres = false;\n final long thres = 1000000000000000000L;\n for(int i=1; i<=N; i++) {\n long tmp = sc.nextLong();\n if(existZero) continue;\n if(tmp==0L) {\n existZero = true;\n continue;\n }\n long new_r = r * tmp;\n if(new_r> thres || new_r < 0 || new_r < r || new_r < tmp) {\n overThres = true;\n }\n r = new_r;\n }\n if(existZero) {\n System.out.println(0);\n return;\n }\n if(overThres) {\n System.out.println(-1);\n return;\n }\n System.out.println(r);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"long N = sc.nextLong();",
"N",
"sc.nextLong()",
"sc.nextLong",
"sc",
"long r = 1L;",
"r",
"1L",
"boolean existZero = false;",
"existZero",
"false",
"boolean overThres = false;",
"overThres",
"false",
"final long thres = 1000000000000000000L;",
"thres",
"1000000000000000000L",
"for(int i=1; i<=N; i++) {\n long tmp = sc.nextLong();\n if(existZero) continue;\n if(tmp==0L) {\n existZero = true;\n continue;\n }\n long new_r = r * tmp;\n if(new_r> thres || new_r < 0 || new_r < r || new_r < tmp) {\n overThres = true;\n }\n r = new_r;\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<=N",
"i",
"N",
"i++",
"i++",
"i",
"{\n long tmp = sc.nextLong();\n if(existZero) continue;\n if(tmp==0L) {\n existZero = true;\n continue;\n }\n long new_r = r * tmp;\n if(new_r> thres || new_r < 0 || new_r < r || new_r < tmp) {\n overThres = true;\n }\n r = new_r;\n }",
"{\n long tmp = sc.nextLong();\n if(existZero) continue;\n if(tmp==0L) {\n existZero = true;\n continue;\n }\n long new_r = r * tmp;\n if(new_r> thres || new_r < 0 || new_r < r || new_r < tmp) {\n overThres = true;\n }\n r = new_r;\n }",
"long tmp = sc.nextLong();",
"tmp",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(existZero) continue;",
"existZero",
"continue;",
"if(tmp==0L) {\n existZero = true;\n continue;\n }",
"tmp==0L",
"tmp",
"0L",
"{\n existZero = true;\n continue;\n }",
"existZero = true",
"existZero",
"true",
"continue;",
"long new_r = r * tmp;",
"new_r",
"r * tmp",
"r",
"tmp",
"if(new_r> thres || new_r < 0 || new_r < r || new_r < tmp) {\n overThres = true;\n }",
"new_r> thres || new_r < 0 || new_r < r || new_r < tmp",
"new_r < r",
"new_r> thres || new_r < 0 || new_r < r || new_r < tmp",
"new_r> thres",
"new_r",
"thres",
"new_r < 0",
"new_r",
"0",
"new_r < r",
"new_r",
"r",
"new_r < tmp",
"new_r",
"tmp",
"{\n overThres = true;\n }",
"overThres = true",
"overThres",
"true",
"r = new_r",
"r",
"new_r",
"if(existZero) {\n System.out.println(0);\n return;\n }",
"existZero",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"if(overThres) {\n System.out.println(-1);\n return;\n }",
"overThres",
"{\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(r)",
"System.out.println",
"System.out",
"System",
"System.out",
"r",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n long N = sc.nextLong();\n long r = 1L;\n boolean existZero = false;\n boolean overThres = false;\n final long thres = 1000000000000000000L;\n for(int i=1; i<=N; i++) {\n long tmp = sc.nextLong();\n if(existZero) continue;\n if(tmp==0L) {\n existZero = true;\n continue;\n }\n long new_r = r * tmp;\n if(new_r> thres || new_r < 0 || new_r < r || new_r < tmp) {\n overThres = true;\n }\n r = new_r;\n }\n if(existZero) {\n System.out.println(0);\n return;\n }\n if(overThres) {\n System.out.println(-1);\n return;\n }\n System.out.println(r);\n }\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n long N = sc.nextLong();\n long r = 1L;\n boolean existZero = false;\n boolean overThres = false;\n final long thres = 1000000000000000000L;\n for(int i=1; i<=N; i++) {\n long tmp = sc.nextLong();\n if(existZero) continue;\n if(tmp==0L) {\n existZero = true;\n continue;\n }\n long new_r = r * tmp;\n if(new_r> thres || new_r < 0 || new_r < r || new_r < tmp) {\n overThres = true;\n }\n r = new_r;\n }\n if(existZero) {\n System.out.println(0);\n return;\n }\n if(overThres) {\n System.out.println(-1);\n return;\n }\n System.out.println(r);\n }\n}",
"Main"
] |
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
long N = sc.nextLong();
long r = 1L;
boolean existZero = false;
boolean overThres = false;
final long thres = 1000000000000000000L;
for(int i=1; i<=N; i++) {
long tmp = sc.nextLong();
if(existZero) continue;
if(tmp==0L) {
existZero = true;
continue;
}
long new_r = r * tmp;
if(new_r> thres || new_r < 0 || new_r < r || new_r < tmp) {
overThres = true;
}
r = new_r;
}
if(existZero) {
System.out.println(0);
return;
}
if(overThres) {
System.out.println(-1);
return;
}
System.out.println(r);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
41,
13,
17,
41,
13,
20,
17,
0,
13,
4,
18,
13,
41,
13,
20,
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,
4,
18,
18,
13,
13,
13,
30,
0,
13,
17,
3,
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
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
139,
11
],
[
139,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
14,
20
],
[
20,
21
],
[
20,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
14,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
14,
32
],
[
32,
33
],
[
32,
34
],
[
14,
35
],
[
35,
36
],
[
35,
37
],
[
14,
38
],
[
38,
39
],
[
38,
40
],
[
14,
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
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
58,
59
],
[
59,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
62,
67
],
[
61,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
14,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
73,
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
],
[
98,
100
],
[
100,
101
],
[
101,
102
],
[
100,
103
],
[
103,
104
],
[
103,
105
],
[
97,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
108,
111
],
[
107,
112
],
[
106,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
84,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
118,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
130,
135
],
[
12,
136
],
[
136,
137
],
[
0,
138
],
[
138,
139
],
[
138,
140
]
] |
[
"import java.math.BigInteger;\nimport java.math.BigDecimal;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String args[])\n\t{\n\t\tScanner input=new Scanner(System.in);\n\t\tint n,f=0;\n\t\tBigInteger a[]=new BigInteger[100005];\n\t\tn=input.nextInt();\n\t\tBigInteger b=new BigInteger(\"1\");\n\t\tBigInteger c=new BigInteger(\"1000000000000000000\");\n\t\tBigInteger d=new BigInteger(\"0\");\n\t\tfor(int i=1;i<=n;i++){\n\t\t\ta[i]=input.nextBigInteger();\n\t\t\tif(a[i].equals(d)){\n\t\t\t\tf=2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(f==2){\n\t\t\tSystem.out.println(\"0\");\n\t\t}\n\t\telse{\n\t\t\tfor(int i=1;i<=n;i++){\n\t\t\t\tb=b.multiply(a[i]);\n\t\t\t\tif(b.compareTo(c)>0){\n\t\t\t\t\tf=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(f==1){\n\t\t\tSystem.out.println(\"-1\");\n\t\t}\n\t\t\telse{\n\t\t\tSystem.out.println(b);\n\t\t}\n\t\t}\n\t\t\n\t\t\n\t}\n\n\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.math.BigDecimal;",
"BigDecimal",
"java.math",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String args[])\n\t{\n\t\tScanner input=new Scanner(System.in);\n\t\tint n,f=0;\n\t\tBigInteger a[]=new BigInteger[100005];\n\t\tn=input.nextInt();\n\t\tBigInteger b=new BigInteger(\"1\");\n\t\tBigInteger c=new BigInteger(\"1000000000000000000\");\n\t\tBigInteger d=new BigInteger(\"0\");\n\t\tfor(int i=1;i<=n;i++){\n\t\t\ta[i]=input.nextBigInteger();\n\t\t\tif(a[i].equals(d)){\n\t\t\t\tf=2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(f==2){\n\t\t\tSystem.out.println(\"0\");\n\t\t}\n\t\telse{\n\t\t\tfor(int i=1;i<=n;i++){\n\t\t\t\tb=b.multiply(a[i]);\n\t\t\t\tif(b.compareTo(c)>0){\n\t\t\t\t\tf=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(f==1){\n\t\t\tSystem.out.println(\"-1\");\n\t\t}\n\t\t\telse{\n\t\t\tSystem.out.println(b);\n\t\t}\n\t\t}\n\t\t\n\t\t\n\t}\n\n\n}",
"Main",
"public static void main(String args[])\n\t{\n\t\tScanner input=new Scanner(System.in);\n\t\tint n,f=0;\n\t\tBigInteger a[]=new BigInteger[100005];\n\t\tn=input.nextInt();\n\t\tBigInteger b=new BigInteger(\"1\");\n\t\tBigInteger c=new BigInteger(\"1000000000000000000\");\n\t\tBigInteger d=new BigInteger(\"0\");\n\t\tfor(int i=1;i<=n;i++){\n\t\t\ta[i]=input.nextBigInteger();\n\t\t\tif(a[i].equals(d)){\n\t\t\t\tf=2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(f==2){\n\t\t\tSystem.out.println(\"0\");\n\t\t}\n\t\telse{\n\t\t\tfor(int i=1;i<=n;i++){\n\t\t\t\tb=b.multiply(a[i]);\n\t\t\t\tif(b.compareTo(c)>0){\n\t\t\t\t\tf=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(f==1){\n\t\t\tSystem.out.println(\"-1\");\n\t\t}\n\t\t\telse{\n\t\t\tSystem.out.println(b);\n\t\t}\n\t\t}\n\t\t\n\t\t\n\t}",
"main",
"{\n\t\tScanner input=new Scanner(System.in);\n\t\tint n,f=0;\n\t\tBigInteger a[]=new BigInteger[100005];\n\t\tn=input.nextInt();\n\t\tBigInteger b=new BigInteger(\"1\");\n\t\tBigInteger c=new BigInteger(\"1000000000000000000\");\n\t\tBigInteger d=new BigInteger(\"0\");\n\t\tfor(int i=1;i<=n;i++){\n\t\t\ta[i]=input.nextBigInteger();\n\t\t\tif(a[i].equals(d)){\n\t\t\t\tf=2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(f==2){\n\t\t\tSystem.out.println(\"0\");\n\t\t}\n\t\telse{\n\t\t\tfor(int i=1;i<=n;i++){\n\t\t\t\tb=b.multiply(a[i]);\n\t\t\t\tif(b.compareTo(c)>0){\n\t\t\t\t\tf=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(f==1){\n\t\t\tSystem.out.println(\"-1\");\n\t\t}\n\t\t\telse{\n\t\t\tSystem.out.println(b);\n\t\t}\n\t\t}\n\t\t\n\t\t\n\t}",
"Scanner input=new Scanner(System.in);",
"input",
"new Scanner(System.in)",
"int n",
"n",
"f=0;",
"f",
"0",
"BigInteger a[]=new BigInteger[100005];",
"a",
"new BigInteger[100005]",
"100005",
"n=input.nextInt()",
"n",
"input.nextInt()",
"input.nextInt",
"input",
"BigInteger b=new BigInteger(\"1\");",
"b",
"new BigInteger(\"1\")",
"BigInteger c=new BigInteger(\"1000000000000000000\");",
"c",
"new BigInteger(\"1000000000000000000\")",
"BigInteger d=new BigInteger(\"0\");",
"d",
"new BigInteger(\"0\")",
"for(int i=1;i<=n;i++){\n\t\t\ta[i]=input.nextBigInteger();\n\t\t\tif(a[i].equals(d)){\n\t\t\t\tf=2;\n\t\t\t\tbreak;\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\ta[i]=input.nextBigInteger();\n\t\t\tif(a[i].equals(d)){\n\t\t\t\tf=2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"{\n\t\t\ta[i]=input.nextBigInteger();\n\t\t\tif(a[i].equals(d)){\n\t\t\t\tf=2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"a[i]=input.nextBigInteger()",
"a[i]",
"a",
"i",
"input.nextBigInteger()",
"input.nextBigInteger",
"input",
"if(a[i].equals(d)){\n\t\t\t\tf=2;\n\t\t\t\tbreak;\n\t\t\t}",
"a[i].equals(d)",
"a[i].equals",
"a[i]",
"a",
"i",
"d",
"{\n\t\t\t\tf=2;\n\t\t\t\tbreak;\n\t\t\t}",
"f=2",
"f",
"2",
"break;",
"if(f==2){\n\t\t\tSystem.out.println(\"0\");\n\t\t}\n\t\telse{\n\t\t\tfor(int i=1;i<=n;i++){\n\t\t\t\tb=b.multiply(a[i]);\n\t\t\t\tif(b.compareTo(c)>0){\n\t\t\t\t\tf=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(f==1){\n\t\t\tSystem.out.println(\"-1\");\n\t\t}\n\t\t\telse{\n\t\t\tSystem.out.println(b);\n\t\t}\n\t\t}",
"f==2",
"f",
"2",
"{\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\tfor(int i=1;i<=n;i++){\n\t\t\t\tb=b.multiply(a[i]);\n\t\t\t\tif(b.compareTo(c)>0){\n\t\t\t\t\tf=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(f==1){\n\t\t\tSystem.out.println(\"-1\");\n\t\t}\n\t\t\telse{\n\t\t\tSystem.out.println(b);\n\t\t}\n\t\t}",
"for(int i=1;i<=n;i++){\n\t\t\t\tb=b.multiply(a[i]);\n\t\t\t\tif(b.compareTo(c)>0){\n\t\t\t\t\tf=1;\n\t\t\t\t\tbreak;\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\tb=b.multiply(a[i]);\n\t\t\t\tif(b.compareTo(c)>0){\n\t\t\t\t\tf=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tb=b.multiply(a[i]);\n\t\t\t\tif(b.compareTo(c)>0){\n\t\t\t\t\tf=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"b=b.multiply(a[i])",
"b",
"b.multiply(a[i])",
"b.multiply",
"b",
"a[i]",
"a",
"i",
"if(b.compareTo(c)>0){\n\t\t\t\t\tf=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"b.compareTo(c)>0",
"b.compareTo(c)",
"b.compareTo",
"b",
"c",
"0",
"{\n\t\t\t\t\tf=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"f=1",
"f",
"1",
"break;",
"if(f==1){\n\t\t\tSystem.out.println(\"-1\");\n\t\t}\n\t\t\telse{\n\t\t\tSystem.out.println(b);\n\t\t}",
"f==1",
"f",
"1",
"{\n\t\t\tSystem.out.println(\"-1\");\n\t\t}",
"System.out.println(\"-1\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"{\n\t\t\tSystem.out.println(b);\n\t\t}",
"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{\n\t\tScanner input=new Scanner(System.in);\n\t\tint n,f=0;\n\t\tBigInteger a[]=new BigInteger[100005];\n\t\tn=input.nextInt();\n\t\tBigInteger b=new BigInteger(\"1\");\n\t\tBigInteger c=new BigInteger(\"1000000000000000000\");\n\t\tBigInteger d=new BigInteger(\"0\");\n\t\tfor(int i=1;i<=n;i++){\n\t\t\ta[i]=input.nextBigInteger();\n\t\t\tif(a[i].equals(d)){\n\t\t\t\tf=2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(f==2){\n\t\t\tSystem.out.println(\"0\");\n\t\t}\n\t\telse{\n\t\t\tfor(int i=1;i<=n;i++){\n\t\t\t\tb=b.multiply(a[i]);\n\t\t\t\tif(b.compareTo(c)>0){\n\t\t\t\t\tf=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(f==1){\n\t\t\tSystem.out.println(\"-1\");\n\t\t}\n\t\t\telse{\n\t\t\tSystem.out.println(b);\n\t\t}\n\t\t}\n\t\t\n\t\t\n\t}\n\n\n}",
"public class Main {\n\n\tpublic static void main(String args[])\n\t{\n\t\tScanner input=new Scanner(System.in);\n\t\tint n,f=0;\n\t\tBigInteger a[]=new BigInteger[100005];\n\t\tn=input.nextInt();\n\t\tBigInteger b=new BigInteger(\"1\");\n\t\tBigInteger c=new BigInteger(\"1000000000000000000\");\n\t\tBigInteger d=new BigInteger(\"0\");\n\t\tfor(int i=1;i<=n;i++){\n\t\t\ta[i]=input.nextBigInteger();\n\t\t\tif(a[i].equals(d)){\n\t\t\t\tf=2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(f==2){\n\t\t\tSystem.out.println(\"0\");\n\t\t}\n\t\telse{\n\t\t\tfor(int i=1;i<=n;i++){\n\t\t\t\tb=b.multiply(a[i]);\n\t\t\t\tif(b.compareTo(c)>0){\n\t\t\t\t\tf=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(f==1){\n\t\t\tSystem.out.println(\"-1\");\n\t\t}\n\t\t\telse{\n\t\t\tSystem.out.println(b);\n\t\t}\n\t\t}\n\t\t\n\t\t\n\t}\n\n\n}",
"Main"
] |
import java.math.BigInteger;
import java.math.BigDecimal;
import java.util.Scanner;
public class Main {
public static void main(String args[])
{
Scanner input=new Scanner(System.in);
int n,f=0;
BigInteger a[]=new BigInteger[100005];
n=input.nextInt();
BigInteger b=new BigInteger("1");
BigInteger c=new BigInteger("1000000000000000000");
BigInteger d=new BigInteger("0");
for(int i=1;i<=n;i++){
a[i]=input.nextBigInteger();
if(a[i].equals(d)){
f=2;
break;
}
}
if(f==2){
System.out.println("0");
}
else{
for(int i=1;i<=n;i++){
b=b.multiply(a[i]);
if(b.compareTo(c)>0){
f=1;
break;
}
}
if(f==1){
System.out.println("-1");
}
else{
System.out.println(b);
}
}
}
}
|
[
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,
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,
40,
17,
3,
0,
13,
18,
13,
13,
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
],
[
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
],
[
8,
58
],
[
58,
59
],
[
58,
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
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
75,
79
],
[
79,
80
],
[
79,
81
],
[
74,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
82,
87
],
[
73,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
8,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
6,
99
],
[
99,
100
]
] |
[
"import java.util.*;\n\nclass Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n // a[i]の取得\n long[] a = new long[n];\n for(int i=0; i<n; i++){\n a[i] = sc.nextLong();\n // ゼロがあった場合は,0を返して終了\n if(a[i]==0){\n System.out.println(0);\n return;\n }\n }\n // ゼロがない場合,回答を求める\n long ans = 1L;\n long upper = 1000000000000000000L;\n for(int j=0; j<n; j++){\n // 10^18を超えたら-1にしてループを抜ける\n if(a[j] > upper/ans){\n ans = -1;\n break;\n }\n // 乗算を行う\n ans *= a[j];\n }\n System.out.println(ans);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n // a[i]の取得\n long[] a = new long[n];\n for(int i=0; i<n; i++){\n a[i] = sc.nextLong();\n // ゼロがあった場合は,0を返して終了\n if(a[i]==0){\n System.out.println(0);\n return;\n }\n }\n // ゼロがない場合,回答を求める\n long ans = 1L;\n long upper = 1000000000000000000L;\n for(int j=0; j<n; j++){\n // 10^18を超えたら-1にしてループを抜ける\n if(a[j] > upper/ans){\n ans = -1;\n break;\n }\n // 乗算を行う\n ans *= a[j];\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 // a[i]の取得\n long[] a = new long[n];\n for(int i=0; i<n; i++){\n a[i] = sc.nextLong();\n // ゼロがあった場合は,0を返して終了\n if(a[i]==0){\n System.out.println(0);\n return;\n }\n }\n // ゼロがない場合,回答を求める\n long ans = 1L;\n long upper = 1000000000000000000L;\n for(int j=0; j<n; j++){\n // 10^18を超えたら-1にしてループを抜ける\n if(a[j] > upper/ans){\n ans = -1;\n break;\n }\n // 乗算を行う\n ans *= a[j];\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n // a[i]の取得\n long[] a = new long[n];\n for(int i=0; i<n; i++){\n a[i] = sc.nextLong();\n // ゼロがあった場合は,0を返して終了\n if(a[i]==0){\n System.out.println(0);\n return;\n }\n }\n // ゼロがない場合,回答を求める\n long ans = 1L;\n long upper = 1000000000000000000L;\n for(int j=0; j<n; j++){\n // 10^18を超えたら-1にしてループを抜ける\n if(a[j] > upper/ans){\n ans = -1;\n break;\n }\n // 乗算を行う\n ans *= a[j];\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",
"for(int i=0; i<n; i++){\n a[i] = sc.nextLong();\n // ゼロがあった場合は,0を返して終了\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 // ゼロがあった場合は,0を返して終了\n if(a[i]==0){\n System.out.println(0);\n return;\n }\n }",
"{\n a[i] = sc.nextLong();\n // ゼロがあった場合は,0を返して終了\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 ans = 1L;",
"ans",
"1L",
"long upper = 1000000000000000000L;",
"upper",
"1000000000000000000L",
"for(int j=0; j<n; j++){\n // 10^18を超えたら-1にしてループを抜ける\n if(a[j] > upper/ans){\n ans = -1;\n break;\n }\n // 乗算を行う\n ans *= a[j];\n }",
"int j=0;",
"int j=0;",
"j",
"0",
"j<n",
"j",
"n",
"j++",
"j++",
"j",
"{\n // 10^18を超えたら-1にしてループを抜ける\n if(a[j] > upper/ans){\n ans = -1;\n break;\n }\n // 乗算を行う\n ans *= a[j];\n }",
"{\n // 10^18を超えたら-1にしてループを抜ける\n if(a[j] > upper/ans){\n ans = -1;\n break;\n }\n // 乗算を行う\n ans *= a[j];\n }",
"if(a[j] > upper/ans){\n ans = -1;\n break;\n }",
"a[j] > upper/ans",
"a[j]",
"a",
"j",
"upper/ans",
"upper",
"ans",
"{\n ans = -1;\n break;\n }",
"ans = -1",
"ans",
"-1",
"1",
"break;",
"ans *= a[j]",
"ans",
"a[j]",
"a",
"j",
"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();
// a[i]の取得
long[] a = new long[n];
for(int i=0; i<n; i++){
a[i] = sc.nextLong();
// ゼロがあった場合は,0を返して終了
if(a[i]==0){
System.out.println(0);
return;
}
}
// ゼロがない場合,回答を求める
long ans = 1L;
long upper = 1000000000000000000L;
for(int j=0; j<n; j++){
// 10^18を超えたら-1にしてループを抜ける
if(a[j] > upper/ans){
ans = -1;
break;
}
// 乗算を行う
ans *= a[j];
}
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,
18,
13,
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,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
17,
0,
13,
17,
14,
2,
13,
17,
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,
4,
18,
13,
18,
13,
13,
14,
2,
4,
18,
13,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
0,
13,
17,
3,
14,
2,
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
],
[
138,
8
],
[
138,
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
],
[
11,
35
],
[
35,
36
],
[
35,
37
],
[
11,
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
],
[
61,
63
],
[
60,
64
],
[
59,
65
],
[
65,
66
],
[
65,
67
],
[
11,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
72,
77
],
[
68,
78
],
[
78,
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
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
94,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
100,
101
],
[
100,
102
],
[
91,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
105,
108
],
[
108,
109
],
[
109,
110
],
[
108,
111
],
[
104,
112
],
[
103,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
119,
120
],
[
113,
121
],
[
121,
122
],
[
121,
123
],
[
113,
124
],
[
78,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
125,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
129,
134
],
[
9,
135
],
[
135,
136
],
[
0,
137
],
[
137,
138
],
[
137,
139
]
] |
[
"import java.math.BigInteger;\nimport java.util.*;\n \npublic class Main{\n public static void main(String args[]){\n Scanner sn = new Scanner(System.in);\n int N = sn.nextInt();\n BigInteger result = BigInteger.ONE;\n long x = (long)Math.pow(10, 18);\n int flag = 0;\n \n long[] A = new long[N];\n \n for(int n=0; n<N; n++){\n A[n] = sn.nextLong();\n if (A[n] == 0) flag = 1;\n }\n \n if(flag == 1) System.out.println(0);\n else{\n for(int n=0; n<N; n++){\n result = result.multiply(BigInteger.valueOf(A[n]));\n if(result.compareTo(BigInteger.valueOf(x)) == 1){\n System.out.println(-1);\n flag = 2;\n break;\n }\n }\n if(flag != 2)System.out.println(result);\n }\n }\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n public static void main(String args[]){\n Scanner sn = new Scanner(System.in);\n int N = sn.nextInt();\n BigInteger result = BigInteger.ONE;\n long x = (long)Math.pow(10, 18);\n int flag = 0;\n \n long[] A = new long[N];\n \n for(int n=0; n<N; n++){\n A[n] = sn.nextLong();\n if (A[n] == 0) flag = 1;\n }\n \n if(flag == 1) System.out.println(0);\n else{\n for(int n=0; n<N; n++){\n result = result.multiply(BigInteger.valueOf(A[n]));\n if(result.compareTo(BigInteger.valueOf(x)) == 1){\n System.out.println(-1);\n flag = 2;\n break;\n }\n }\n if(flag != 2)System.out.println(result);\n }\n }\n}",
"Main",
"public static void main(String args[]){\n Scanner sn = new Scanner(System.in);\n int N = sn.nextInt();\n BigInteger result = BigInteger.ONE;\n long x = (long)Math.pow(10, 18);\n int flag = 0;\n \n long[] A = new long[N];\n \n for(int n=0; n<N; n++){\n A[n] = sn.nextLong();\n if (A[n] == 0) flag = 1;\n }\n \n if(flag == 1) System.out.println(0);\n else{\n for(int n=0; n<N; n++){\n result = result.multiply(BigInteger.valueOf(A[n]));\n if(result.compareTo(BigInteger.valueOf(x)) == 1){\n System.out.println(-1);\n flag = 2;\n break;\n }\n }\n if(flag != 2)System.out.println(result);\n }\n }",
"main",
"{\n Scanner sn = new Scanner(System.in);\n int N = sn.nextInt();\n BigInteger result = BigInteger.ONE;\n long x = (long)Math.pow(10, 18);\n int flag = 0;\n \n long[] A = new long[N];\n \n for(int n=0; n<N; n++){\n A[n] = sn.nextLong();\n if (A[n] == 0) flag = 1;\n }\n \n if(flag == 1) System.out.println(0);\n else{\n for(int n=0; n<N; n++){\n result = result.multiply(BigInteger.valueOf(A[n]));\n if(result.compareTo(BigInteger.valueOf(x)) == 1){\n System.out.println(-1);\n flag = 2;\n break;\n }\n }\n if(flag != 2)System.out.println(result);\n }\n }",
"Scanner sn = new Scanner(System.in);",
"sn",
"new Scanner(System.in)",
"int N = sn.nextInt();",
"N",
"sn.nextInt()",
"sn.nextInt",
"sn",
"BigInteger result = BigInteger.ONE;",
"result",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"long x = (long)Math.pow(10, 18);",
"x",
"(long)Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"int flag = 0;",
"flag",
"0",
"long[] A = new long[N];",
"A",
"new long[N]",
"N",
"for(int n=0; n<N; n++){\n A[n] = sn.nextLong();\n if (A[n] == 0) flag = 1;\n }",
"int n=0;",
"int n=0;",
"n",
"0",
"n<N",
"n",
"N",
"n++",
"n++",
"n",
"{\n A[n] = sn.nextLong();\n if (A[n] == 0) flag = 1;\n }",
"{\n A[n] = sn.nextLong();\n if (A[n] == 0) flag = 1;\n }",
"A[n] = sn.nextLong()",
"A[n]",
"A",
"n",
"sn.nextLong()",
"sn.nextLong",
"sn",
"if (A[n] == 0) flag = 1;",
"A[n] == 0",
"A[n]",
"A",
"n",
"0",
"flag = 1",
"flag",
"1",
"if(flag == 1) System.out.println(0);\n else{\n for(int n=0; n<N; n++){\n result = result.multiply(BigInteger.valueOf(A[n]));\n if(result.compareTo(BigInteger.valueOf(x)) == 1){\n System.out.println(-1);\n flag = 2;\n break;\n }\n }\n if(flag != 2)System.out.println(result);\n }",
"flag == 1",
"flag",
"1",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"{\n for(int n=0; n<N; n++){\n result = result.multiply(BigInteger.valueOf(A[n]));\n if(result.compareTo(BigInteger.valueOf(x)) == 1){\n System.out.println(-1);\n flag = 2;\n break;\n }\n }\n if(flag != 2)System.out.println(result);\n }",
"for(int n=0; n<N; n++){\n result = result.multiply(BigInteger.valueOf(A[n]));\n if(result.compareTo(BigInteger.valueOf(x)) == 1){\n System.out.println(-1);\n flag = 2;\n break;\n }\n }",
"int n=0;",
"int n=0;",
"n",
"0",
"n<N",
"n",
"N",
"n++",
"n++",
"n",
"{\n result = result.multiply(BigInteger.valueOf(A[n]));\n if(result.compareTo(BigInteger.valueOf(x)) == 1){\n System.out.println(-1);\n flag = 2;\n break;\n }\n }",
"{\n result = result.multiply(BigInteger.valueOf(A[n]));\n if(result.compareTo(BigInteger.valueOf(x)) == 1){\n System.out.println(-1);\n flag = 2;\n break;\n }\n }",
"result = result.multiply(BigInteger.valueOf(A[n]))",
"result",
"result.multiply(BigInteger.valueOf(A[n]))",
"result.multiply",
"result",
"BigInteger.valueOf(A[n])",
"BigInteger.valueOf",
"BigInteger",
"A[n]",
"A",
"n",
"if(result.compareTo(BigInteger.valueOf(x)) == 1){\n System.out.println(-1);\n flag = 2;\n break;\n }",
"result.compareTo(BigInteger.valueOf(x)) == 1",
"result.compareTo(BigInteger.valueOf(x))",
"result.compareTo",
"result",
"BigInteger.valueOf(x)",
"BigInteger.valueOf",
"BigInteger",
"x",
"1",
"{\n System.out.println(-1);\n flag = 2;\n break;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"flag = 2",
"flag",
"2",
"break;",
"if(flag != 2)System.out.println(result);",
"flag != 2",
"flag",
"2",
"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 sn = new Scanner(System.in);\n int N = sn.nextInt();\n BigInteger result = BigInteger.ONE;\n long x = (long)Math.pow(10, 18);\n int flag = 0;\n \n long[] A = new long[N];\n \n for(int n=0; n<N; n++){\n A[n] = sn.nextLong();\n if (A[n] == 0) flag = 1;\n }\n \n if(flag == 1) System.out.println(0);\n else{\n for(int n=0; n<N; n++){\n result = result.multiply(BigInteger.valueOf(A[n]));\n if(result.compareTo(BigInteger.valueOf(x)) == 1){\n System.out.println(-1);\n flag = 2;\n break;\n }\n }\n if(flag != 2)System.out.println(result);\n }\n }\n}",
"public class Main{\n public static void main(String args[]){\n Scanner sn = new Scanner(System.in);\n int N = sn.nextInt();\n BigInteger result = BigInteger.ONE;\n long x = (long)Math.pow(10, 18);\n int flag = 0;\n \n long[] A = new long[N];\n \n for(int n=0; n<N; n++){\n A[n] = sn.nextLong();\n if (A[n] == 0) flag = 1;\n }\n \n if(flag == 1) System.out.println(0);\n else{\n for(int n=0; n<N; n++){\n result = result.multiply(BigInteger.valueOf(A[n]));\n if(result.compareTo(BigInteger.valueOf(x)) == 1){\n System.out.println(-1);\n flag = 2;\n break;\n }\n }\n if(flag != 2)System.out.println(result);\n }\n }\n}",
"Main"
] |
import java.math.BigInteger;
import java.util.*;
public class Main{
public static void main(String args[]){
Scanner sn = new Scanner(System.in);
int N = sn.nextInt();
BigInteger result = BigInteger.ONE;
long x = (long)Math.pow(10, 18);
int flag = 0;
long[] A = new long[N];
for(int n=0; n<N; n++){
A[n] = sn.nextLong();
if (A[n] == 0) flag = 1;
}
if(flag == 1) System.out.println(0);
else{
for(int n=0; n<N; n++){
result = result.multiply(BigInteger.valueOf(A[n]));
if(result.compareTo(BigInteger.valueOf(x)) == 1){
System.out.println(-1);
flag = 2;
break;
}
}
if(flag != 2)System.out.println(result);
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
13,
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,
14,
2,
18,
13,
13,
17,
30,
0,
13,
17,
14,
13,
30,
4,
18,
18,
13,
13,
17,
29,
38,
5,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
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,
4,
18,
18,
13,
13,
40,
17,
29,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
139,
5
],
[
139,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
14,
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
],
[
44,
47
],
[
47,
48
],
[
48,
49
],
[
39,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
50,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
8,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
63,
68
],
[
62,
69
],
[
8,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
79,
80
],
[
73,
81
],
[
70,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
83,
88
],
[
88,
89
],
[
88,
90
],
[
83,
91
],
[
91,
92
],
[
92,
93
],
[
83,
94
],
[
95,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
8,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
115,
116
],
[
109,
117
],
[
8,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
6,
124
],
[
124,
125
],
[
139,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
130,
133
],
[
133,
134
],
[
134,
135
],
[
126,
136
],
[
136,
137
],
[
0,
138
],
[
138,
139
],
[
138,
140
]
] |
[
"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 = nextInt(scanner);\n long[] a = new long[n];\n long p = 1;\n boolean isZero = false;\n for (int i = 0; i < n; i++) {\n a[i] = Long.parseLong(scanner.next());\n if (a[i] == 0) {\n isZero = true;\n }\n }\n if (isZero) {\n System.out.println(0);\n return;\n }\n try {\n for (int i = 0; i < n; i++) {\n p = Math.multiplyExact(p, a[i]);\n }\n }catch (Exception e) {\n System.out.println(-1);\n return;\n }\n if (p > 1000000000000000000L) {\n System.out.println(-1);\n return;\n }\n System.out.println(p);\n\n\n }\n\n public static int nextInt(Scanner scanner) {\n return Integer.parseInt(scanner.next());\n }\n\n}\n\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 = nextInt(scanner);\n long[] a = new long[n];\n long p = 1;\n boolean isZero = false;\n for (int i = 0; i < n; i++) {\n a[i] = Long.parseLong(scanner.next());\n if (a[i] == 0) {\n isZero = true;\n }\n }\n if (isZero) {\n System.out.println(0);\n return;\n }\n try {\n for (int i = 0; i < n; i++) {\n p = Math.multiplyExact(p, a[i]);\n }\n }catch (Exception e) {\n System.out.println(-1);\n return;\n }\n if (p > 1000000000000000000L) {\n System.out.println(-1);\n return;\n }\n System.out.println(p);\n\n\n }\n\n public static int nextInt(Scanner scanner) {\n return Integer.parseInt(scanner.next());\n }\n\n}",
"Main",
"public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = nextInt(scanner);\n long[] a = new long[n];\n long p = 1;\n boolean isZero = false;\n for (int i = 0; i < n; i++) {\n a[i] = Long.parseLong(scanner.next());\n if (a[i] == 0) {\n isZero = true;\n }\n }\n if (isZero) {\n System.out.println(0);\n return;\n }\n try {\n for (int i = 0; i < n; i++) {\n p = Math.multiplyExact(p, a[i]);\n }\n }catch (Exception e) {\n System.out.println(-1);\n return;\n }\n if (p > 1000000000000000000L) {\n System.out.println(-1);\n return;\n }\n System.out.println(p);\n\n\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n int n = nextInt(scanner);\n long[] a = new long[n];\n long p = 1;\n boolean isZero = false;\n for (int i = 0; i < n; i++) {\n a[i] = Long.parseLong(scanner.next());\n if (a[i] == 0) {\n isZero = true;\n }\n }\n if (isZero) {\n System.out.println(0);\n return;\n }\n try {\n for (int i = 0; i < n; i++) {\n p = Math.multiplyExact(p, a[i]);\n }\n }catch (Exception e) {\n System.out.println(-1);\n return;\n }\n if (p > 1000000000000000000L) {\n System.out.println(-1);\n return;\n }\n System.out.println(p);\n\n\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int n = nextInt(scanner);",
"n",
"nextInt(scanner)",
"nextInt",
"scanner",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"long p = 1;",
"p",
"1",
"boolean isZero = false;",
"isZero",
"false",
"for (int i = 0; i < n; i++) {\n a[i] = Long.parseLong(scanner.next());\n if (a[i] == 0) {\n isZero = true;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = Long.parseLong(scanner.next());\n if (a[i] == 0) {\n isZero = true;\n }\n }",
"{\n a[i] = Long.parseLong(scanner.next());\n if (a[i] == 0) {\n isZero = true;\n }\n }",
"a[i] = Long.parseLong(scanner.next())",
"a[i]",
"a",
"i",
"Long.parseLong(scanner.next())",
"Long.parseLong",
"Long",
"scanner.next()",
"scanner.next",
"scanner",
"if (a[i] == 0) {\n isZero = true;\n }",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"{\n isZero = true;\n }",
"isZero = true",
"isZero",
"true",
"if (isZero) {\n System.out.println(0);\n return;\n }",
"isZero",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"try {\n for (int i = 0; i < n; i++) {\n p = Math.multiplyExact(p, a[i]);\n }\n }catch (Exception e) {\n System.out.println(-1);\n return;\n }",
"catch (Exception e) {\n System.out.println(-1);\n return;\n }",
"Exception e",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"{\n for (int i = 0; i < n; i++) {\n p = Math.multiplyExact(p, a[i]);\n }\n }",
"for (int i = 0; i < n; i++) {\n p = Math.multiplyExact(p, a[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n p = Math.multiplyExact(p, a[i]);\n }",
"{\n p = Math.multiplyExact(p, a[i]);\n }",
"p = Math.multiplyExact(p, a[i])",
"p",
"Math.multiplyExact(p, a[i])",
"Math.multiplyExact",
"Math",
"p",
"a[i]",
"a",
"i",
"if (p > 1000000000000000000L) {\n System.out.println(-1);\n return;\n }",
"p > 1000000000000000000L",
"p",
"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(p)",
"System.out.println",
"System.out",
"System",
"System.out",
"p",
"String[] args",
"args",
"public static int nextInt(Scanner scanner) {\n return Integer.parseInt(scanner.next());\n }",
"nextInt",
"{\n return Integer.parseInt(scanner.next());\n }",
"return Integer.parseInt(scanner.next());",
"Integer.parseInt(scanner.next())",
"Integer.parseInt",
"Integer",
"scanner.next()",
"scanner.next",
"scanner",
"Scanner scanner",
"scanner",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = nextInt(scanner);\n long[] a = new long[n];\n long p = 1;\n boolean isZero = false;\n for (int i = 0; i < n; i++) {\n a[i] = Long.parseLong(scanner.next());\n if (a[i] == 0) {\n isZero = true;\n }\n }\n if (isZero) {\n System.out.println(0);\n return;\n }\n try {\n for (int i = 0; i < n; i++) {\n p = Math.multiplyExact(p, a[i]);\n }\n }catch (Exception e) {\n System.out.println(-1);\n return;\n }\n if (p > 1000000000000000000L) {\n System.out.println(-1);\n return;\n }\n System.out.println(p);\n\n\n }\n\n public static int nextInt(Scanner scanner) {\n return Integer.parseInt(scanner.next());\n }\n\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = nextInt(scanner);\n long[] a = new long[n];\n long p = 1;\n boolean isZero = false;\n for (int i = 0; i < n; i++) {\n a[i] = Long.parseLong(scanner.next());\n if (a[i] == 0) {\n isZero = true;\n }\n }\n if (isZero) {\n System.out.println(0);\n return;\n }\n try {\n for (int i = 0; i < n; i++) {\n p = Math.multiplyExact(p, a[i]);\n }\n }catch (Exception e) {\n System.out.println(-1);\n return;\n }\n if (p > 1000000000000000000L) {\n System.out.println(-1);\n return;\n }\n System.out.println(p);\n\n\n }\n\n public static int nextInt(Scanner scanner) {\n return Integer.parseInt(scanner.next());\n }\n\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = nextInt(scanner);
long[] a = new long[n];
long p = 1;
boolean isZero = false;
for (int i = 0; i < n; i++) {
a[i] = Long.parseLong(scanner.next());
if (a[i] == 0) {
isZero = true;
}
}
if (isZero) {
System.out.println(0);
return;
}
try {
for (int i = 0; i < n; i++) {
p = Math.multiplyExact(p, a[i]);
}
}catch (Exception e) {
System.out.println(-1);
return;
}
if (p > 1000000000000000000L) {
System.out.println(-1);
return;
}
System.out.println(p);
}
public static int nextInt(Scanner scanner) {
return Integer.parseInt(scanner.next());
}
}
|
[
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,
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
],
[
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
],
[
0,
104
],
[
104,
105
],
[
104,
106
]
] |
[
"import java.util.*; \n \npublic class Main{\n public static void main(String[] args){\n\t Scanner sc=new Scanner(System.in);\n int N =sc.nextInt();\n \t\t long[] A = new long[N];\n \t\t long ans=1;\n\t\t for(int i=0; i<N; i++){\n \t\t A[i]=sc.nextLong();\n \t if(A[i]==0){\n \t ans=0;\n }\n \t }\n \t \tif(ans!=0){\n\t\t \tfor(int i=0; i<N; i++){\n \tif(A[i] <= (long)Math.pow(10,18)/ans){\n \tans *= A[i];\n \t}else{\n \t \tans=-1;\n \tbreak;\n \t}\n \t\t}\n \t }\n \tSystem.out.println(ans);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n public static void main(String[] args){\n\t Scanner sc=new Scanner(System.in);\n int N =sc.nextInt();\n \t\t long[] A = new long[N];\n \t\t long ans=1;\n\t\t for(int i=0; i<N; i++){\n \t\t A[i]=sc.nextLong();\n \t if(A[i]==0){\n \t ans=0;\n }\n \t }\n \t \tif(ans!=0){\n\t\t \tfor(int i=0; i<N; i++){\n \tif(A[i] <= (long)Math.pow(10,18)/ans){\n \tans *= A[i];\n \t}else{\n \t \tans=-1;\n \tbreak;\n \t}\n \t\t}\n \t }\n \tSystem.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args){\n\t Scanner sc=new Scanner(System.in);\n int N =sc.nextInt();\n \t\t long[] A = new long[N];\n \t\t long ans=1;\n\t\t for(int i=0; i<N; i++){\n \t\t A[i]=sc.nextLong();\n \t if(A[i]==0){\n \t ans=0;\n }\n \t }\n \t \tif(ans!=0){\n\t\t \tfor(int i=0; i<N; i++){\n \tif(A[i] <= (long)Math.pow(10,18)/ans){\n \tans *= A[i];\n \t}else{\n \t \tans=-1;\n \tbreak;\n \t}\n \t\t}\n \t }\n \tSystem.out.println(ans);\n }",
"main",
"{\n\t Scanner sc=new Scanner(System.in);\n int N =sc.nextInt();\n \t\t long[] A = new long[N];\n \t\t long ans=1;\n\t\t for(int i=0; i<N; i++){\n \t\t A[i]=sc.nextLong();\n \t if(A[i]==0){\n \t ans=0;\n }\n \t }\n \t \tif(ans!=0){\n\t\t \tfor(int i=0; i<N; i++){\n \tif(A[i] <= (long)Math.pow(10,18)/ans){\n \tans *= A[i];\n \t}else{\n \t \tans=-1;\n \tbreak;\n \t}\n \t\t}\n \t }\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 i=0; i<N; i++){\n \t\t A[i]=sc.nextLong();\n \t if(A[i]==0){\n \t ans=0;\n }\n \t }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n \t\t A[i]=sc.nextLong();\n \t if(A[i]==0){\n \t ans=0;\n }\n \t }",
"{\n \t\t A[i]=sc.nextLong();\n \t if(A[i]==0){\n \t ans=0;\n }\n \t }",
"A[i]=sc.nextLong()",
"A[i]",
"A",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(A[i]==0){\n \t ans=0;\n }",
"A[i]==0",
"A[i]",
"A",
"i",
"0",
"{\n \t ans=0;\n }",
"ans=0",
"ans",
"0",
"if(ans!=0){\n\t\t \tfor(int i=0; i<N; i++){\n \tif(A[i] <= (long)Math.pow(10,18)/ans){\n \tans *= A[i];\n \t}else{\n \t \tans=-1;\n \tbreak;\n \t}\n \t\t}\n \t }",
"ans!=0",
"ans",
"0",
"{\n\t\t \tfor(int i=0; i<N; i++){\n \tif(A[i] <= (long)Math.pow(10,18)/ans){\n \tans *= A[i];\n \t}else{\n \t \tans=-1;\n \tbreak;\n \t}\n \t\t}\n \t }",
"for(int i=0; i<N; i++){\n \tif(A[i] <= (long)Math.pow(10,18)/ans){\n \tans *= A[i];\n \t}else{\n \t \tans=-1;\n \tbreak;\n \t}\n \t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n \tif(A[i] <= (long)Math.pow(10,18)/ans){\n \tans *= A[i];\n \t}else{\n \t \tans=-1;\n \tbreak;\n \t}\n \t\t}",
"{\n \tif(A[i] <= (long)Math.pow(10,18)/ans){\n \tans *= A[i];\n \t}else{\n \t \tans=-1;\n \tbreak;\n \t}\n \t\t}",
"if(A[i] <= (long)Math.pow(10,18)/ans){\n \tans *= A[i];\n \t}else{\n \t \tans=-1;\n \tbreak;\n \t}",
"A[i] <= (long)Math.pow(10,18)/ans",
"A[i]",
"A",
"i",
"(long)Math.pow(10,18)/ans",
"(long)Math.pow(10,18)",
"Math.pow",
"Math",
"10",
"18",
"ans",
"{\n \tans *= A[i];\n \t}",
"ans *= A[i]",
"ans",
"A[i]",
"A",
"i",
"{\n \t \tans=-1;\n \tbreak;\n \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 public static void main(String[] args){\n\t Scanner sc=new Scanner(System.in);\n int N =sc.nextInt();\n \t\t long[] A = new long[N];\n \t\t long ans=1;\n\t\t for(int i=0; i<N; i++){\n \t\t A[i]=sc.nextLong();\n \t if(A[i]==0){\n \t ans=0;\n }\n \t }\n \t \tif(ans!=0){\n\t\t \tfor(int i=0; i<N; i++){\n \tif(A[i] <= (long)Math.pow(10,18)/ans){\n \tans *= A[i];\n \t}else{\n \t \tans=-1;\n \tbreak;\n \t}\n \t\t}\n \t }\n \tSystem.out.println(ans);\n }\n}",
"public class Main{\n public static void main(String[] args){\n\t Scanner sc=new Scanner(System.in);\n int N =sc.nextInt();\n \t\t long[] A = new long[N];\n \t\t long ans=1;\n\t\t for(int i=0; i<N; i++){\n \t\t A[i]=sc.nextLong();\n \t if(A[i]==0){\n \t ans=0;\n }\n \t }\n \t \tif(ans!=0){\n\t\t \tfor(int i=0; i<N; i++){\n \tif(A[i] <= (long)Math.pow(10,18)/ans){\n \tans *= A[i];\n \t}else{\n \t \tans=-1;\n \tbreak;\n \t}\n \t\t}\n \t }\n \tSystem.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;
for(int i=0; i<N; i++){
A[i]=sc.nextLong();
if(A[i]==0){
ans=0;
}
}
if(ans!=0){
for(int i=0; i<N; i++){
if(A[i] <= (long)Math.pow(10,18)/ans){
ans *= A[i];
}else{
ans=-1;
break;
}
}
}
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,
41,
13,
17,
41,
13,
17,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
13,
17,
2,
2,
13,
13,
18,
13,
13,
30,
0,
13,
17,
14,
2,
18,
13,
13,
17,
30,
0,
13,
17,
0,
13,
17,
3,
30,
0,
13,
18,
13,
13,
14,
13,
30,
4,
18,
18,
13,
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
],
[
131,
5
],
[
131,
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
],
[
41,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
8,
47
],
[
47,
48
],
[
47,
49
],
[
8,
50
],
[
50,
51
],
[
50,
52
],
[
8,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
53,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
75,
76
],
[
75,
77
],
[
66,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
65,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
82,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
92,
93
],
[
92,
94
],
[
88,
95
],
[
82,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
8,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
102,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
119,
120
],
[
111,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
6,
128
],
[
128,
129
],
[
0,
130
],
[
130,
131
],
[
130,
132
]
] |
[
"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\t\n\t\tint n = sc.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] = sc.nextLong();\n\t\t}\n\t\t\n\t\tlong sum = 1;\n\t\tlong max = 1000000000000000000l;\n\t\tboolean chk = false;\n\t\tboolean zero = false;\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tif(sum!= 0 && max / sum < a[i]) {\n\t\t\t\tchk = true;\n\t\t\t}\n\t\t\tif(a[i] == 0) {\n\t\t\t\tsum = 0;\n\t\t\t\tzero = true;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tsum*= a[i];\n\t\t\t}\n\t\t}\n\t\t\n\t\tif( zero ) {\n\t\t\tSystem.out.println(0);\n\t\t}else if( chk ){\n\t\t\tSystem.out.println(-1);\n\t\t}else {\n\t\t\tSystem.out.println(sum);\n\t\t}\n\t}\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\t\n\t\tint n = sc.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] = sc.nextLong();\n\t\t}\n\t\t\n\t\tlong sum = 1;\n\t\tlong max = 1000000000000000000l;\n\t\tboolean chk = false;\n\t\tboolean zero = false;\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tif(sum!= 0 && max / sum < a[i]) {\n\t\t\t\tchk = true;\n\t\t\t}\n\t\t\tif(a[i] == 0) {\n\t\t\t\tsum = 0;\n\t\t\t\tzero = true;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tsum*= a[i];\n\t\t\t}\n\t\t}\n\t\t\n\t\tif( zero ) {\n\t\t\tSystem.out.println(0);\n\t\t}else if( chk ){\n\t\t\tSystem.out.println(-1);\n\t\t}else {\n\t\t\tSystem.out.println(sum);\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n = sc.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] = sc.nextLong();\n\t\t}\n\t\t\n\t\tlong sum = 1;\n\t\tlong max = 1000000000000000000l;\n\t\tboolean chk = false;\n\t\tboolean zero = false;\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tif(sum!= 0 && max / sum < a[i]) {\n\t\t\t\tchk = true;\n\t\t\t}\n\t\t\tif(a[i] == 0) {\n\t\t\t\tsum = 0;\n\t\t\t\tzero = true;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tsum*= a[i];\n\t\t\t}\n\t\t}\n\t\t\n\t\tif( zero ) {\n\t\t\tSystem.out.println(0);\n\t\t}else if( chk ){\n\t\t\tSystem.out.println(-1);\n\t\t}else {\n\t\t\tSystem.out.println(sum);\n\t\t}\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n = sc.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] = sc.nextLong();\n\t\t}\n\t\t\n\t\tlong sum = 1;\n\t\tlong max = 1000000000000000000l;\n\t\tboolean chk = false;\n\t\tboolean zero = false;\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tif(sum!= 0 && max / sum < a[i]) {\n\t\t\t\tchk = true;\n\t\t\t}\n\t\t\tif(a[i] == 0) {\n\t\t\t\tsum = 0;\n\t\t\t\tzero = true;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tsum*= a[i];\n\t\t\t}\n\t\t}\n\t\t\n\t\tif( zero ) {\n\t\t\tSystem.out.println(0);\n\t\t}else if( chk ){\n\t\t\tSystem.out.println(-1);\n\t\t}else {\n\t\t\tSystem.out.println(sum);\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",
"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",
"long sum = 1;",
"sum",
"1",
"long max = 1000000000000000000l;",
"max",
"1000000000000000000l",
"boolean chk = false;",
"chk",
"false",
"boolean zero = false;",
"zero",
"false",
"for(int i = 0; i < n; i++) {\n\t\t\tif(sum!= 0 && max / sum < a[i]) {\n\t\t\t\tchk = true;\n\t\t\t}\n\t\t\tif(a[i] == 0) {\n\t\t\t\tsum = 0;\n\t\t\t\tzero = true;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tsum*= 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\tif(sum!= 0 && max / sum < a[i]) {\n\t\t\t\tchk = true;\n\t\t\t}\n\t\t\tif(a[i] == 0) {\n\t\t\t\tsum = 0;\n\t\t\t\tzero = true;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tsum*= a[i];\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(sum!= 0 && max / sum < a[i]) {\n\t\t\t\tchk = true;\n\t\t\t}\n\t\t\tif(a[i] == 0) {\n\t\t\t\tsum = 0;\n\t\t\t\tzero = true;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tsum*= a[i];\n\t\t\t}\n\t\t}",
"if(sum!= 0 && max / sum < a[i]) {\n\t\t\t\tchk = true;\n\t\t\t}",
"sum!= 0 && max / sum < a[i]",
"sum!= 0",
"sum",
"0",
"max / sum < a[i]",
"max / sum",
"max",
"sum",
"a[i]",
"a",
"i",
"{\n\t\t\t\tchk = true;\n\t\t\t}",
"chk = true",
"chk",
"true",
"if(a[i] == 0) {\n\t\t\t\tsum = 0;\n\t\t\t\tzero = true;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tsum*= a[i];\n\t\t\t}",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"{\n\t\t\t\tsum = 0;\n\t\t\t\tzero = true;\n\t\t\t\tbreak;\n\t\t\t}",
"sum = 0",
"sum",
"0",
"zero = true",
"zero",
"true",
"break;",
"{\n\t\t\t\tsum*= a[i];\n\t\t\t}",
"sum*= a[i]",
"sum",
"a[i]",
"a",
"i",
"if( zero ) {\n\t\t\tSystem.out.println(0);\n\t\t}else if( chk ){\n\t\t\tSystem.out.println(-1);\n\t\t}else {\n\t\t\tSystem.out.println(sum);\n\t\t}",
"zero",
"{\n\t\t\tSystem.out.println(0);\n\t\t}",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"if( chk ){\n\t\t\tSystem.out.println(-1);\n\t\t}else {\n\t\t\tSystem.out.println(sum);\n\t\t}",
"chk",
"{\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",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n = sc.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] = sc.nextLong();\n\t\t}\n\t\t\n\t\tlong sum = 1;\n\t\tlong max = 1000000000000000000l;\n\t\tboolean chk = false;\n\t\tboolean zero = false;\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tif(sum!= 0 && max / sum < a[i]) {\n\t\t\t\tchk = true;\n\t\t\t}\n\t\t\tif(a[i] == 0) {\n\t\t\t\tsum = 0;\n\t\t\t\tzero = true;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tsum*= a[i];\n\t\t\t}\n\t\t}\n\t\t\n\t\tif( zero ) {\n\t\t\tSystem.out.println(0);\n\t\t}else if( chk ){\n\t\t\tSystem.out.println(-1);\n\t\t}else {\n\t\t\tSystem.out.println(sum);\n\t\t}\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n = sc.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] = sc.nextLong();\n\t\t}\n\t\t\n\t\tlong sum = 1;\n\t\tlong max = 1000000000000000000l;\n\t\tboolean chk = false;\n\t\tboolean zero = false;\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tif(sum!= 0 && max / sum < a[i]) {\n\t\t\t\tchk = true;\n\t\t\t}\n\t\t\tif(a[i] == 0) {\n\t\t\t\tsum = 0;\n\t\t\t\tzero = true;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tsum*= a[i];\n\t\t\t}\n\t\t}\n\t\t\n\t\tif( zero ) {\n\t\t\tSystem.out.println(0);\n\t\t}else if( chk ){\n\t\t\tSystem.out.println(-1);\n\t\t}else {\n\t\t\tSystem.out.println(sum);\n\t\t}\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];
for(int i = 0; i < n; i++) {
a[i] = sc.nextLong();
}
long sum = 1;
long max = 1000000000000000000l;
boolean chk = false;
boolean zero = false;
for(int i = 0; i < n; i++) {
if(sum!= 0 && max / sum < a[i]) {
chk = true;
}
if(a[i] == 0) {
sum = 0;
zero = true;
break;
}else {
sum*= a[i];
}
}
if( zero ) {
System.out.println(0);
}else if( chk ){
System.out.println(-1);
}else {
System.out.println(sum);
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
29,
17,
29,
17,
23,
13,
23,
13,
12,
13,
30,
14,
4,
13,
17,
13,
29,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
17,
2,
17,
18,
13,
13,
29,
40,
17,
0,
13,
18,
13,
13,
29,
8,
2,
13,
17,
40,
17,
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,
0,
18,
13,
13,
4,
18,
13,
4,
18,
18,
13,
13,
4,
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
],
[
148,
14
],
[
148,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
18,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
25,
27
],
[
18,
28
],
[
28,
29
],
[
29,
30
],
[
18,
31
],
[
32,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
33,
39
],
[
39,
40
],
[
17,
41
],
[
41,
42
],
[
15,
43
],
[
43,
44
],
[
15,
45
],
[
45,
46
],
[
148,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
51,
54
],
[
50,
55
],
[
55,
56
],
[
49,
57
],
[
57,
58
],
[
57,
59
],
[
49,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
60,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
67,
69
],
[
60,
70
],
[
70,
71
],
[
71,
72
],
[
60,
73
],
[
74,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
75,
85
],
[
85,
86
],
[
86,
87
],
[
74,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
49,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
94,
100
],
[
47,
101
],
[
101,
102
],
[
148,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
105,
114
],
[
114,
115
],
[
114,
116
],
[
105,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
123,
124
],
[
123,
125
],
[
118,
126
],
[
126,
127
],
[
127,
128
],
[
118,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
134,
135
],
[
135,
136
],
[
105,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
137,
142
],
[
142,
143
],
[
142,
144
],
[
103,
145
],
[
145,
146
],
[
0,
147
],
[
147,
148
],
[
147,
149
]
] |
[
"import java.util.*;\nimport java.util.function.*;\nimport java.lang.*;\nimport java.io.*;\n\n\npublic class Main {\n \n static boolean contains(long e, long[] array){\n for(int i=0; i<array.length; i++){\n if(array[i]==e) return true;\n }\n return false;\n }\n\n static long mults(long[] array){\n if(contains(0, array)) return 0;\n long ans = 1;\n for(int i=0; i<array.length; i++){\n if(ans > 1 + 1000000000000000000L / array[i]) return -1;\n ans *= array[i];\n }\n return ans > 1000000000000000000L ? -1 : ans;\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 for(int n=0; n<N; n++) A[n]=sc.nextLong();\n System.out.println(mults(A));\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.util.function.*;",
"function.*",
"java.util",
"import java.lang.*;",
"lang.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main {\n \n static boolean contains(long e, long[] array){\n for(int i=0; i<array.length; i++){\n if(array[i]==e) return true;\n }\n return false;\n }\n\n static long mults(long[] array){\n if(contains(0, array)) return 0;\n long ans = 1;\n for(int i=0; i<array.length; i++){\n if(ans > 1 + 1000000000000000000L / array[i]) return -1;\n ans *= array[i];\n }\n return ans > 1000000000000000000L ? -1 : ans;\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 for(int n=0; n<N; n++) A[n]=sc.nextLong();\n System.out.println(mults(A));\n }\n}",
"Main",
"static boolean contains(long e, long[] array){\n for(int i=0; i<array.length; i++){\n if(array[i]==e) return true;\n }\n return false;\n }",
"contains",
"{\n for(int i=0; i<array.length; i++){\n if(array[i]==e) return true;\n }\n return false;\n }",
"for(int i=0; i<array.length; i++){\n if(array[i]==e) return true;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<array.length",
"i",
"array.length",
"array",
"array.length",
"i++",
"i++",
"i",
"{\n if(array[i]==e) return true;\n }",
"{\n if(array[i]==e) return true;\n }",
"if(array[i]==e) return true;",
"array[i]==e",
"array[i]",
"array",
"i",
"e",
"return true;",
"true",
"return false;",
"false",
"long e",
"e",
"long[] array",
"array",
"static long mults(long[] array){\n if(contains(0, array)) return 0;\n long ans = 1;\n for(int i=0; i<array.length; i++){\n if(ans > 1 + 1000000000000000000L / array[i]) return -1;\n ans *= array[i];\n }\n return ans > 1000000000000000000L ? -1 : ans;\n }",
"mults",
"{\n if(contains(0, array)) return 0;\n long ans = 1;\n for(int i=0; i<array.length; i++){\n if(ans > 1 + 1000000000000000000L / array[i]) return -1;\n ans *= array[i];\n }\n return ans > 1000000000000000000L ? -1 : ans;\n }",
"if(contains(0, array)) return 0;",
"contains(0, array)",
"contains",
"0",
"array",
"return 0;",
"0",
"long ans = 1;",
"ans",
"1",
"for(int i=0; i<array.length; i++){\n if(ans > 1 + 1000000000000000000L / array[i]) return -1;\n ans *= array[i];\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<array.length",
"i",
"array.length",
"array",
"array.length",
"i++",
"i++",
"i",
"{\n if(ans > 1 + 1000000000000000000L / array[i]) return -1;\n ans *= array[i];\n }",
"{\n if(ans > 1 + 1000000000000000000L / array[i]) return -1;\n ans *= array[i];\n }",
"if(ans > 1 + 1000000000000000000L / array[i]) return -1;",
"ans > 1 + 1000000000000000000L / array[i]",
"ans",
"1 + 1000000000000000000L / array[i]",
"1",
"1000000000000000000L / array[i]",
"1000000000000000000L",
"array[i]",
"array",
"i",
"return -1;",
"-1",
"1",
"ans *= array[i]",
"ans",
"array[i]",
"array",
"i",
"return ans > 1000000000000000000L ? -1 : ans;",
"ans > 1000000000000000000L ? -1 : ans",
"ans > 1000000000000000000L",
"ans",
"1000000000000000000L",
"-1",
"1",
"ans",
"long[] array",
"array",
"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 for(int n=0; n<N; n++) A[n]=sc.nextLong();\n System.out.println(mults(A));\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long[] A = new long[N];\n for(int n=0; n<N; n++) A[n]=sc.nextLong();\n System.out.println(mults(A));\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 n=0; n<N; n++) A[n]=sc.nextLong();",
"int n=0;",
"int n=0;",
"n",
"0",
"n<N",
"n",
"N",
"n++",
"n++",
"n",
"A[n]=sc.nextLong();",
"A[n]=sc.nextLong()",
"A[n]",
"A",
"n",
"sc.nextLong()",
"sc.nextLong",
"sc",
"System.out.println(mults(A))",
"System.out.println",
"System.out",
"System",
"System.out",
"mults(A)",
"mults",
"A",
"String[] args",
"args",
"public class Main {\n \n static boolean contains(long e, long[] array){\n for(int i=0; i<array.length; i++){\n if(array[i]==e) return true;\n }\n return false;\n }\n\n static long mults(long[] array){\n if(contains(0, array)) return 0;\n long ans = 1;\n for(int i=0; i<array.length; i++){\n if(ans > 1 + 1000000000000000000L / array[i]) return -1;\n ans *= array[i];\n }\n return ans > 1000000000000000000L ? -1 : ans;\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 for(int n=0; n<N; n++) A[n]=sc.nextLong();\n System.out.println(mults(A));\n }\n}",
"public class Main {\n \n static boolean contains(long e, long[] array){\n for(int i=0; i<array.length; i++){\n if(array[i]==e) return true;\n }\n return false;\n }\n\n static long mults(long[] array){\n if(contains(0, array)) return 0;\n long ans = 1;\n for(int i=0; i<array.length; i++){\n if(ans > 1 + 1000000000000000000L / array[i]) return -1;\n ans *= array[i];\n }\n return ans > 1000000000000000000L ? -1 : ans;\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 for(int n=0; n<N; n++) A[n]=sc.nextLong();\n System.out.println(mults(A));\n }\n}",
"Main"
] |
import java.util.*;
import java.util.function.*;
import java.lang.*;
import java.io.*;
public class Main {
static boolean contains(long e, long[] array){
for(int i=0; i<array.length; i++){
if(array[i]==e) return true;
}
return false;
}
static long mults(long[] array){
if(contains(0, array)) return 0;
long ans = 1;
for(int i=0; i<array.length; i++){
if(ans > 1 + 1000000000000000000L / array[i]) return -1;
ans *= array[i];
}
return ans > 1000000000000000000L ? -1 : ans;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long[] A = new long[N];
for(int n=0; n<N; n++) A[n]=sc.nextLong();
System.out.println(mults(A));
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
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,
41,
13,
17,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
4,
18,
13,
13,
28,
13,
13,
30,
30,
14,
2,
2,
13,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
0,
13,
13,
14,
2,
2,
13,
17,
2,
13,
13,
30,
4,
18,
18,
13,
13,
40,
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
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
154,
17
],
[
154,
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
],
[
20,
35
],
[
35,
36
],
[
35,
37
],
[
20,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
38,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
43,
48
],
[
42,
49
],
[
20,
50
],
[
50,
51
],
[
50,
52
],
[
20,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
53,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
65,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
81,
82
],
[
75,
83
],
[
65,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
84,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
88,
95
],
[
65,
96
],
[
96,
97
],
[
97,
98
],
[
96,
99
],
[
20,
100
],
[
100,
101
],
[
100,
102
],
[
100,
103
],
[
104,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
110,
111
],
[
110,
112
],
[
105,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
119,
120
],
[
113,
121
],
[
104,
122
],
[
122,
123
],
[
122,
124
],
[
104,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
130,
131
],
[
130,
132
],
[
125,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
134,
139
],
[
139,
140
],
[
133,
141
],
[
20,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
142,
147
],
[
20,
148
],
[
148,
149
],
[
149,
150
],
[
18,
151
],
[
151,
152
],
[
0,
153
],
[
153,
154
],
[
153,
155
]
] |
[
"\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n long max = 1_000_000_000_000_000_000L;\n long root = 3037000499L;\n Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n int N = in.nextInt();\n long ans = 1;\n\n if (N == 0) {\n System.out.println(0);\n return;\n }\n\n //System.out.println(max * max);\n\n List<Long> list = new ArrayList<>();\n for (int i = 0; i < N; ++i) {\n long a = in.nextLong();\n if (a > max) {\n System.out.println(-1);\n return;\n }\n\n if (a == 0) {\n System.out.println(0);\n return;\n }\n\n list.add(a);\n\n }\n\n for (long a : list) {\n if (ans > root && a > root) {\n System.out.println(-1);\n return;\n }\n ans *= a;\n\n if (ans < 0 || ans > max) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(ans);\n in.close();\n }\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"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 public static void main(String[] args) {\n long max = 1_000_000_000_000_000_000L;\n long root = 3037000499L;\n Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n int N = in.nextInt();\n long ans = 1;\n\n if (N == 0) {\n System.out.println(0);\n return;\n }\n\n //System.out.println(max * max);\n\n List<Long> list = new ArrayList<>();\n for (int i = 0; i < N; ++i) {\n long a = in.nextLong();\n if (a > max) {\n System.out.println(-1);\n return;\n }\n\n if (a == 0) {\n System.out.println(0);\n return;\n }\n\n list.add(a);\n\n }\n\n for (long a : list) {\n if (ans > root && a > root) {\n System.out.println(-1);\n return;\n }\n ans *= a;\n\n if (ans < 0 || ans > max) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(ans);\n in.close();\n }\n}",
"Main",
"public static void main(String[] args) {\n long max = 1_000_000_000_000_000_000L;\n long root = 3037000499L;\n Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n int N = in.nextInt();\n long ans = 1;\n\n if (N == 0) {\n System.out.println(0);\n return;\n }\n\n //System.out.println(max * max);\n\n List<Long> list = new ArrayList<>();\n for (int i = 0; i < N; ++i) {\n long a = in.nextLong();\n if (a > max) {\n System.out.println(-1);\n return;\n }\n\n if (a == 0) {\n System.out.println(0);\n return;\n }\n\n list.add(a);\n\n }\n\n for (long a : list) {\n if (ans > root && a > root) {\n System.out.println(-1);\n return;\n }\n ans *= a;\n\n if (ans < 0 || ans > max) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(ans);\n in.close();\n }",
"main",
"{\n long max = 1_000_000_000_000_000_000L;\n long root = 3037000499L;\n Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n int N = in.nextInt();\n long ans = 1;\n\n if (N == 0) {\n System.out.println(0);\n return;\n }\n\n //System.out.println(max * max);\n\n List<Long> list = new ArrayList<>();\n for (int i = 0; i < N; ++i) {\n long a = in.nextLong();\n if (a > max) {\n System.out.println(-1);\n return;\n }\n\n if (a == 0) {\n System.out.println(0);\n return;\n }\n\n list.add(a);\n\n }\n\n for (long a : list) {\n if (ans > root && a > root) {\n System.out.println(-1);\n return;\n }\n ans *= a;\n\n if (ans < 0 || ans > max) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(ans);\n in.close();\n }",
"long max = 1_000_000_000_000_000_000L;",
"max",
"1_000_000_000_000_000_000L",
"long root = 3037000499L;",
"root",
"3037000499L",
"Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));",
"in",
"new Scanner(new BufferedReader(new InputStreamReader(System.in)))",
"int N = in.nextInt();",
"N",
"in.nextInt()",
"in.nextInt",
"in",
"long ans = 1;",
"ans",
"1",
"if (N == 0) {\n System.out.println(0);\n return;\n }",
"N == 0",
"N",
"0",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"List<Long> list = new ArrayList<>();",
"list",
"new ArrayList<>()",
"for (int i = 0; i < N; ++i) {\n long a = in.nextLong();\n if (a > max) {\n System.out.println(-1);\n return;\n }\n\n if (a == 0) {\n System.out.println(0);\n return;\n }\n\n list.add(a);\n\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"++i",
"++i",
"i",
"{\n long a = in.nextLong();\n if (a > max) {\n System.out.println(-1);\n return;\n }\n\n if (a == 0) {\n System.out.println(0);\n return;\n }\n\n list.add(a);\n\n }",
"{\n long a = in.nextLong();\n if (a > max) {\n System.out.println(-1);\n return;\n }\n\n if (a == 0) {\n System.out.println(0);\n return;\n }\n\n list.add(a);\n\n }",
"long a = in.nextLong();",
"a",
"in.nextLong()",
"in.nextLong",
"in",
"if (a > max) {\n System.out.println(-1);\n return;\n }",
"a > max",
"a",
"max",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"if (a == 0) {\n System.out.println(0);\n return;\n }",
"a == 0",
"a",
"0",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"list.add(a)",
"list.add",
"list",
"a",
"for (long a : list) {\n if (ans > root && a > root) {\n System.out.println(-1);\n return;\n }\n ans *= a;\n\n if (ans < 0 || ans > max) {\n System.out.println(-1);\n return;\n }\n }",
"long a",
"list",
"{\n if (ans > root && a > root) {\n System.out.println(-1);\n return;\n }\n ans *= a;\n\n if (ans < 0 || ans > max) {\n System.out.println(-1);\n return;\n }\n }",
"{\n if (ans > root && a > root) {\n System.out.println(-1);\n return;\n }\n ans *= a;\n\n if (ans < 0 || ans > max) {\n System.out.println(-1);\n return;\n }\n }",
"if (ans > root && a > root) {\n System.out.println(-1);\n return;\n }",
"ans > root && a > root",
"ans > root",
"ans",
"root",
"a > root",
"a",
"root",
"{\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",
"ans",
"a",
"if (ans < 0 || ans > max) {\n System.out.println(-1);\n return;\n }",
"ans < 0 || ans > max",
"ans < 0",
"ans",
"0",
"ans > max",
"ans",
"max",
"{\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(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"in.close()",
"in.close",
"in",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n long max = 1_000_000_000_000_000_000L;\n long root = 3037000499L;\n Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n int N = in.nextInt();\n long ans = 1;\n\n if (N == 0) {\n System.out.println(0);\n return;\n }\n\n //System.out.println(max * max);\n\n List<Long> list = new ArrayList<>();\n for (int i = 0; i < N; ++i) {\n long a = in.nextLong();\n if (a > max) {\n System.out.println(-1);\n return;\n }\n\n if (a == 0) {\n System.out.println(0);\n return;\n }\n\n list.add(a);\n\n }\n\n for (long a : list) {\n if (ans > root && a > root) {\n System.out.println(-1);\n return;\n }\n ans *= a;\n\n if (ans < 0 || ans > max) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(ans);\n in.close();\n }\n}",
"public class Main {\n public static void main(String[] args) {\n long max = 1_000_000_000_000_000_000L;\n long root = 3037000499L;\n Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n int N = in.nextInt();\n long ans = 1;\n\n if (N == 0) {\n System.out.println(0);\n return;\n }\n\n //System.out.println(max * max);\n\n List<Long> list = new ArrayList<>();\n for (int i = 0; i < N; ++i) {\n long a = in.nextLong();\n if (a > max) {\n System.out.println(-1);\n return;\n }\n\n if (a == 0) {\n System.out.println(0);\n return;\n }\n\n list.add(a);\n\n }\n\n for (long a : list) {\n if (ans > root && a > root) {\n System.out.println(-1);\n return;\n }\n ans *= a;\n\n if (ans < 0 || ans > max) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(ans);\n in.close();\n }\n}",
"Main"
] |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
long max = 1_000_000_000_000_000_000L;
long root = 3037000499L;
Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int N = in.nextInt();
long ans = 1;
if (N == 0) {
System.out.println(0);
return;
}
//System.out.println(max * max);
List<Long> list = new ArrayList<>();
for (int i = 0; i < N; ++i) {
long a = in.nextLong();
if (a > max) {
System.out.println(-1);
return;
}
if (a == 0) {
System.out.println(0);
return;
}
list.add(a);
}
for (long a : list) {
if (ans > root && a > root) {
System.out.println(-1);
return;
}
ans *= a;
if (ans < 0 || ans > max) {
System.out.println(-1);
return;
}
}
System.out.println(ans);
in.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,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
41,
13,
17,
28,
13,
13,
30,
30,
14,
2,
2,
17,
13,
13,
30,
0,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
94,
5
],
[
94,
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
],
[
8,
58
],
[
58,
59
],
[
58,
60
],
[
58,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
63,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
63,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
79,
80
],
[
73,
81
],
[
8,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
8,
88
],
[
88,
89
],
[
89,
90
],
[
6,
91
],
[
91,
92
],
[
0,
93
],
[
93,
94
],
[
93,
95
]
] |
[
"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\n\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\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 SUM = 1l;\n\n\t\tfor (long I: A) {\n\t\t\tif (1000000000000000000L / I >= SUM) {\n\t\t\t\tSUM *= 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\n\t\tSystem.out.println(SUM);\n\t\tsc.close();\n\t}\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\n\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\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 SUM = 1l;\n\n\t\tfor (long I: A) {\n\t\t\tif (1000000000000000000L / I >= SUM) {\n\t\t\t\tSUM *= 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\n\t\tSystem.out.println(SUM);\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\n\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\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 SUM = 1l;\n\n\t\tfor (long I: A) {\n\t\t\tif (1000000000000000000L / I >= SUM) {\n\t\t\t\tSUM *= 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\n\t\tSystem.out.println(SUM);\n\t\tsc.close();\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\n\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\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 SUM = 1l;\n\n\t\tfor (long I: A) {\n\t\t\tif (1000000000000000000L / I >= SUM) {\n\t\t\t\tSUM *= 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\n\t\tSystem.out.println(SUM);\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",
"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 SUM = 1l;",
"SUM",
"1l",
"for (long I: A) {\n\t\t\tif (1000000000000000000L / I >= SUM) {\n\t\t\t\tSUM *= 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}",
"long I",
"A",
"{\n\t\t\tif (1000000000000000000L / I >= SUM) {\n\t\t\t\tSUM *= 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 (1000000000000000000L / I >= SUM) {\n\t\t\t\tSUM *= 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 (1000000000000000000L / I >= SUM) {\n\t\t\t\tSUM *= I;\n\t\t\t} else {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}",
"1000000000000000000L / I >= SUM",
"1000000000000000000L / I",
"1000000000000000000L",
"I",
"SUM",
"{\n\t\t\t\tSUM *= I;\n\t\t\t}",
"SUM *= I",
"SUM",
"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(SUM)",
"System.out.println",
"System.out",
"System",
"System.out",
"SUM",
"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\n\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\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 SUM = 1l;\n\n\t\tfor (long I: A) {\n\t\t\tif (1000000000000000000L / I >= SUM) {\n\t\t\t\tSUM *= 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\n\t\tSystem.out.println(SUM);\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\n\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\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 SUM = 1l;\n\n\t\tfor (long I: A) {\n\t\t\tif (1000000000000000000L / I >= SUM) {\n\t\t\t\tSUM *= 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\n\t\tSystem.out.println(SUM);\n\t\tsc.close();\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];
for (int i = 0; i < N; i++) {
A[i] = sc.nextLong();
if(A[i] == 0) {
System.out.println(0);
return;
}
}
long SUM = 1l;
for (long I: A) {
if (1000000000000000000L / I >= SUM) {
SUM *= I;
} else {
System.out.println(-1);
return;
}
}
System.out.println(SUM);
sc.close();
}
}
|
[
7,
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,
4,
18,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
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,
18,
13,
13,
4,
18,
13,
13,
41,
13,
20,
41,
13,
20,
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,
17,
29,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
12,
13,
30,
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
],
[
140,
14
],
[
140,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
17,
24
],
[
24,
25
],
[
24,
26
],
[
17,
27
],
[
27,
28
],
[
28,
29
],
[
17,
30
],
[
30,
31
],
[
31,
32
],
[
15,
33
],
[
33,
34
],
[
140,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
41,
42
],
[
40,
43
],
[
43,
44
],
[
44,
45
],
[
37,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
48,
53
],
[
37,
54
],
[
54,
55
],
[
54,
56
],
[
37,
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
],
[
72,
74
],
[
71,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
78,
79
],
[
78,
80
],
[
37,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
37,
85
],
[
85,
86
],
[
85,
87
],
[
37,
88
],
[
88,
89
],
[
88,
90
],
[
37,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
96,
97
],
[
96,
98
],
[
91,
99
],
[
99,
100
],
[
100,
101
],
[
91,
102
],
[
103,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
106,
109
],
[
103,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
112,
115
],
[
111,
116
],
[
110,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
117,
124
],
[
37,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
125,
130
],
[
35,
131
],
[
131,
132
],
[
140,
133
],
[
133,
134
],
[
133,
135
],
[
140,
136
],
[
136,
137
],
[
136,
138
],
[
0,
139
],
[
139,
140
],
[
139,
141
]
] |
[
"import java.util.*;\nimport java.io.*;\nimport java.math.BigDecimal;\nimport java.nio.charset.StandardCharsets;\n\npublic class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tInputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t\tBufferedReader in = new BufferedReader(reader);\n\t\tMain ins = new Main(in);\n\t\tins.calc();\n\t\tins.showResult();\n\t}\n\n\tMain(BufferedReader in) throws IOException {\n\t\tint N = Integer.parseInt(in.readLine());\n\n\t\tString[] tokens = in.readLine().split(\" \");\n\t\tlong[] A = new long[N];\n\t\tfor (int i = 0; i < N; ++i) {\n\t\t\tA[i] = Long.parseLong(tokens[i]);\n\t\t}\n\t\tArrays.sort(A);\n\t\tBigDecimal result = new BigDecimal(A[0]);\n\t\tBigDecimal threshold = new BigDecimal(1000000000000000000L);\n\t\tfor (int i = 1; i < N; ++i) {\n\t\t\tresult = result.multiply(new BigDecimal(A[i]));\n\t\t\tif (result.compareTo(threshold) > 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(result);\n\n\t}\n\n\tvoid calc() {\n\t}\n\n\tvoid showResult() {\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"import java.math.BigDecimal;",
"BigDecimal",
"java.math",
"import java.nio.charset.StandardCharsets;",
"StandardCharsets",
"java.nio.charset",
"public class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tInputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t\tBufferedReader in = new BufferedReader(reader);\n\t\tMain ins = new Main(in);\n\t\tins.calc();\n\t\tins.showResult();\n\t}\n\n\tMain(BufferedReader in) throws IOException {\n\t\tint N = Integer.parseInt(in.readLine());\n\n\t\tString[] tokens = in.readLine().split(\" \");\n\t\tlong[] A = new long[N];\n\t\tfor (int i = 0; i < N; ++i) {\n\t\t\tA[i] = Long.parseLong(tokens[i]);\n\t\t}\n\t\tArrays.sort(A);\n\t\tBigDecimal result = new BigDecimal(A[0]);\n\t\tBigDecimal threshold = new BigDecimal(1000000000000000000L);\n\t\tfor (int i = 1; i < N; ++i) {\n\t\t\tresult = result.multiply(new BigDecimal(A[i]));\n\t\t\tif (result.compareTo(threshold) > 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(result);\n\n\t}\n\n\tvoid calc() {\n\t}\n\n\tvoid showResult() {\n\t}\n}",
"Main",
"public static void main(String[] args) throws IOException {\n\t\tInputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t\tBufferedReader in = new BufferedReader(reader);\n\t\tMain ins = new Main(in);\n\t\tins.calc();\n\t\tins.showResult();\n\t}",
"main",
"{\n\t\tInputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t\tBufferedReader in = new BufferedReader(reader);\n\t\tMain ins = new Main(in);\n\t\tins.calc();\n\t\tins.showResult();\n\t}",
"InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);",
"reader",
"new InputStreamReader(System.in, StandardCharsets.UTF_8)",
"BufferedReader in = new BufferedReader(reader);",
"in",
"new BufferedReader(reader)",
"Main ins = new Main(in);",
"ins",
"new Main(in)",
"ins.calc()",
"ins.calc",
"ins",
"ins.showResult()",
"ins.showResult",
"ins",
"String[] args",
"args",
"Main(BufferedReader in) throws IOException {\n\t\tint N = Integer.parseInt(in.readLine());\n\n\t\tString[] tokens = in.readLine().split(\" \");\n\t\tlong[] A = new long[N];\n\t\tfor (int i = 0; i < N; ++i) {\n\t\t\tA[i] = Long.parseLong(tokens[i]);\n\t\t}\n\t\tArrays.sort(A);\n\t\tBigDecimal result = new BigDecimal(A[0]);\n\t\tBigDecimal threshold = new BigDecimal(1000000000000000000L);\n\t\tfor (int i = 1; i < N; ++i) {\n\t\t\tresult = result.multiply(new BigDecimal(A[i]));\n\t\t\tif (result.compareTo(threshold) > 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(result);\n\n\t}",
"Main",
"{\n\t\tint N = Integer.parseInt(in.readLine());\n\n\t\tString[] tokens = in.readLine().split(\" \");\n\t\tlong[] A = new long[N];\n\t\tfor (int i = 0; i < N; ++i) {\n\t\t\tA[i] = Long.parseLong(tokens[i]);\n\t\t}\n\t\tArrays.sort(A);\n\t\tBigDecimal result = new BigDecimal(A[0]);\n\t\tBigDecimal threshold = new BigDecimal(1000000000000000000L);\n\t\tfor (int i = 1; i < N; ++i) {\n\t\t\tresult = result.multiply(new BigDecimal(A[i]));\n\t\t\tif (result.compareTo(threshold) > 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(result);\n\n\t}",
"int N = Integer.parseInt(in.readLine());",
"N",
"Integer.parseInt(in.readLine())",
"Integer.parseInt",
"Integer",
"in.readLine()",
"in.readLine",
"in",
"String[] tokens = in.readLine().split(\" \");",
"tokens",
"in.readLine().split(\" \")",
"in.readLine().split",
"in.readLine()",
"in.readLine",
"in",
"\" \"",
"long[] A = new long[N];",
"A",
"new long[N]",
"N",
"for (int i = 0; i < N; ++i) {\n\t\t\tA[i] = Long.parseLong(tokens[i]);\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(tokens[i]);\n\t\t}",
"{\n\t\t\tA[i] = Long.parseLong(tokens[i]);\n\t\t}",
"A[i] = Long.parseLong(tokens[i])",
"A[i]",
"A",
"i",
"Long.parseLong(tokens[i])",
"Long.parseLong",
"Long",
"tokens[i]",
"tokens",
"i",
"Arrays.sort(A)",
"Arrays.sort",
"Arrays",
"A",
"BigDecimal result = new BigDecimal(A[0]);",
"result",
"new BigDecimal(A[0])",
"BigDecimal threshold = new BigDecimal(1000000000000000000L);",
"threshold",
"new BigDecimal(1000000000000000000L)",
"for (int i = 1; i < N; ++i) {\n\t\t\tresult = result.multiply(new BigDecimal(A[i]));\n\t\t\tif (result.compareTo(threshold) > 0) {\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\tresult = result.multiply(new BigDecimal(A[i]));\n\t\t\tif (result.compareTo(threshold) > 0) {\n\t\t\t\tSystem.out.println(\"-1\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"{\n\t\t\tresult = result.multiply(new BigDecimal(A[i]));\n\t\t\tif (result.compareTo(threshold) > 0) {\n\t\t\t\tSystem.out.println(\"-1\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"result = result.multiply(new BigDecimal(A[i]))",
"result",
"result.multiply(new BigDecimal(A[i]))",
"result.multiply",
"result",
"new BigDecimal(A[i])",
"if (result.compareTo(threshold) > 0) {\n\t\t\t\tSystem.out.println(\"-1\");\n\t\t\t\treturn;\n\t\t\t}",
"result.compareTo(threshold) > 0",
"result.compareTo(threshold)",
"result.compareTo",
"result",
"threshold",
"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\"",
"return;",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"BufferedReader in",
"in",
"void calc() {\n\t}",
"calc",
"{\n\t}",
"void showResult() {\n\t}",
"showResult",
"{\n\t}",
"public class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tInputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t\tBufferedReader in = new BufferedReader(reader);\n\t\tMain ins = new Main(in);\n\t\tins.calc();\n\t\tins.showResult();\n\t}\n\n\tMain(BufferedReader in) throws IOException {\n\t\tint N = Integer.parseInt(in.readLine());\n\n\t\tString[] tokens = in.readLine().split(\" \");\n\t\tlong[] A = new long[N];\n\t\tfor (int i = 0; i < N; ++i) {\n\t\t\tA[i] = Long.parseLong(tokens[i]);\n\t\t}\n\t\tArrays.sort(A);\n\t\tBigDecimal result = new BigDecimal(A[0]);\n\t\tBigDecimal threshold = new BigDecimal(1000000000000000000L);\n\t\tfor (int i = 1; i < N; ++i) {\n\t\t\tresult = result.multiply(new BigDecimal(A[i]));\n\t\t\tif (result.compareTo(threshold) > 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(result);\n\n\t}\n\n\tvoid calc() {\n\t}\n\n\tvoid showResult() {\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tInputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t\tBufferedReader in = new BufferedReader(reader);\n\t\tMain ins = new Main(in);\n\t\tins.calc();\n\t\tins.showResult();\n\t}\n\n\tMain(BufferedReader in) throws IOException {\n\t\tint N = Integer.parseInt(in.readLine());\n\n\t\tString[] tokens = in.readLine().split(\" \");\n\t\tlong[] A = new long[N];\n\t\tfor (int i = 0; i < N; ++i) {\n\t\t\tA[i] = Long.parseLong(tokens[i]);\n\t\t}\n\t\tArrays.sort(A);\n\t\tBigDecimal result = new BigDecimal(A[0]);\n\t\tBigDecimal threshold = new BigDecimal(1000000000000000000L);\n\t\tfor (int i = 1; i < N; ++i) {\n\t\t\tresult = result.multiply(new BigDecimal(A[i]));\n\t\t\tif (result.compareTo(threshold) > 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(result);\n\n\t}\n\n\tvoid calc() {\n\t}\n\n\tvoid showResult() {\n\t}\n}",
"Main"
] |
import java.util.*;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
public class Main {
public static void main(String[] args) throws IOException {
InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
BufferedReader in = new BufferedReader(reader);
Main ins = new Main(in);
ins.calc();
ins.showResult();
}
Main(BufferedReader in) throws IOException {
int N = Integer.parseInt(in.readLine());
String[] tokens = in.readLine().split(" ");
long[] A = new long[N];
for (int i = 0; i < N; ++i) {
A[i] = Long.parseLong(tokens[i]);
}
Arrays.sort(A);
BigDecimal result = new BigDecimal(A[0]);
BigDecimal threshold = new BigDecimal(1000000000000000000L);
for (int i = 1; i < N; ++i) {
result = result.multiply(new BigDecimal(A[i]));
if (result.compareTo(threshold) > 0) {
System.out.println("-1");
return;
}
}
System.out.println(result);
}
void calc() {
}
void showResult() {
}
}
|
[
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
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,
14,
13,
30,
0,
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,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
126,
8
],
[
126,
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
],
[
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
],
[
11,
47
],
[
47,
48
],
[
47,
49
],
[
11,
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
],
[
11,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
73,
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
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
99,
103
],
[
98,
104
],
[
93,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
108,
110
],
[
93,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
111,
116
],
[
11,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
117,
122
],
[
9,
123
],
[
123,
124
],
[
0,
125
],
[
125,
126
],
[
125,
127
]
] |
[
"import java.util.*;\nimport java.io.*;\n \npublic class Main{\n\tpublic static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n int n = sc.nextInt();\n long sum = 1;\n long[] arr = new long[n];\n for(int i = 0; i < n; i++){\n arr[i] = sc.nextLong();\n }\n\n boolean zero = false;\n for(int i = 0; i < n; i++){\n if(arr[i] == 0){\n zero = true;\n }\n }\n\n if(zero){\n sum = 0;\n } else{\n for(int i = 0; i < n; i++){\n if(arr[i] <= (long) Math.pow(10, 18) / sum){\n sum *= arr[i];\n } else{\n sum = -1;\n break;\n }\n }\n }\n System.out.println(sum);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main{\n\tpublic static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n int n = sc.nextInt();\n long sum = 1;\n long[] arr = new long[n];\n for(int i = 0; i < n; i++){\n arr[i] = sc.nextLong();\n }\n\n boolean zero = false;\n for(int i = 0; i < n; i++){\n if(arr[i] == 0){\n zero = true;\n }\n }\n\n if(zero){\n sum = 0;\n } else{\n for(int i = 0; i < n; i++){\n if(arr[i] <= (long) Math.pow(10, 18) / sum){\n sum *= arr[i];\n } else{\n sum = -1;\n break;\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 \n int n = sc.nextInt();\n long sum = 1;\n long[] arr = new long[n];\n for(int i = 0; i < n; i++){\n arr[i] = sc.nextLong();\n }\n\n boolean zero = false;\n for(int i = 0; i < n; i++){\n if(arr[i] == 0){\n zero = true;\n }\n }\n\n if(zero){\n sum = 0;\n } else{\n for(int i = 0; i < n; i++){\n if(arr[i] <= (long) Math.pow(10, 18) / sum){\n sum *= arr[i];\n } else{\n sum = -1;\n break;\n }\n }\n }\n System.out.println(sum);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n \n int n = sc.nextInt();\n long sum = 1;\n long[] arr = new long[n];\n for(int i = 0; i < n; i++){\n arr[i] = sc.nextLong();\n }\n\n boolean zero = false;\n for(int i = 0; i < n; i++){\n if(arr[i] == 0){\n zero = true;\n }\n }\n\n if(zero){\n sum = 0;\n } else{\n for(int i = 0; i < n; i++){\n if(arr[i] <= (long) Math.pow(10, 18) / sum){\n sum *= arr[i];\n } else{\n sum = -1;\n break;\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",
"long sum = 1;",
"sum",
"1",
"long[] arr = new long[n];",
"arr",
"new long[n]",
"n",
"for(int i = 0; i < n; i++){\n arr[i] = sc.nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n arr[i] = sc.nextLong();\n }",
"{\n arr[i] = sc.nextLong();\n }",
"arr[i] = sc.nextLong()",
"arr[i]",
"arr",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"boolean zero = false;",
"zero",
"false",
"for(int i = 0; i < n; i++){\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 if(arr[i] == 0){\n zero = true;\n }\n }",
"{\n if(arr[i] == 0){\n zero = true;\n }\n }",
"if(arr[i] == 0){\n zero = true;\n }",
"arr[i] == 0",
"arr[i]",
"arr",
"i",
"0",
"{\n zero = true;\n }",
"zero = true",
"zero",
"true",
"if(zero){\n sum = 0;\n } else{\n for(int i = 0; i < n; i++){\n if(arr[i] <= (long) Math.pow(10, 18) / sum){\n sum *= arr[i];\n } else{\n sum = -1;\n break;\n }\n }\n }",
"zero",
"{\n sum = 0;\n }",
"sum = 0",
"sum",
"0",
"{\n for(int i = 0; i < n; i++){\n if(arr[i] <= (long) Math.pow(10, 18) / sum){\n sum *= arr[i];\n } else{\n sum = -1;\n break;\n }\n }\n }",
"for(int i = 0; i < n; i++){\n if(arr[i] <= (long) Math.pow(10, 18) / sum){\n sum *= arr[i];\n } else{\n sum = -1;\n break;\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) / sum){\n sum *= arr[i];\n } else{\n sum = -1;\n break;\n }\n }",
"{\n if(arr[i] <= (long) Math.pow(10, 18) / sum){\n sum *= arr[i];\n } else{\n sum = -1;\n break;\n }\n }",
"if(arr[i] <= (long) Math.pow(10, 18) / sum){\n sum *= arr[i];\n } else{\n sum = -1;\n break;\n }",
"arr[i] <= (long) Math.pow(10, 18) / sum",
"arr[i]",
"arr",
"i",
"(long) Math.pow(10, 18) / sum",
"(long) Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"sum",
"{\n sum *= arr[i];\n }",
"sum *= arr[i]",
"sum",
"arr[i]",
"arr",
"i",
"{\n sum = -1;\n break;\n }",
"sum = -1",
"sum",
"-1",
"1",
"break;",
"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 Scanner sc = new Scanner(System.in);\n \n int n = sc.nextInt();\n long sum = 1;\n long[] arr = new long[n];\n for(int i = 0; i < n; i++){\n arr[i] = sc.nextLong();\n }\n\n boolean zero = false;\n for(int i = 0; i < n; i++){\n if(arr[i] == 0){\n zero = true;\n }\n }\n\n if(zero){\n sum = 0;\n } else{\n for(int i = 0; i < n; i++){\n if(arr[i] <= (long) Math.pow(10, 18) / sum){\n sum *= arr[i];\n } else{\n sum = -1;\n break;\n }\n }\n }\n System.out.println(sum);\n }\n}",
"public class Main{\n\tpublic static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n int n = sc.nextInt();\n long sum = 1;\n long[] arr = new long[n];\n for(int i = 0; i < n; i++){\n arr[i] = sc.nextLong();\n }\n\n boolean zero = false;\n for(int i = 0; i < n; i++){\n if(arr[i] == 0){\n zero = true;\n }\n }\n\n if(zero){\n sum = 0;\n } else{\n for(int i = 0; i < n; i++){\n if(arr[i] <= (long) Math.pow(10, 18) / sum){\n sum *= arr[i];\n } else{\n sum = -1;\n break;\n }\n }\n }\n System.out.println(sum);\n }\n}",
"Main"
] |
import java.util.*;
import java.io.*;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long sum = 1;
long[] arr = new long[n];
for(int i = 0; i < n; i++){
arr[i] = sc.nextLong();
}
boolean zero = false;
for(int i = 0; i < n; i++){
if(arr[i] == 0){
zero = true;
}
}
if(zero){
sum = 0;
} else{
for(int i = 0; i < n; i++){
if(arr[i] <= (long) Math.pow(10, 18) / sum){
sum *= arr[i];
} else{
sum = -1;
break;
}
}
}
System.out.println(sum);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
4,
18,
13,
17,
17,
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,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
0,
18,
13,
13,
13,
4,
18,
13,
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,
40,
17,
29,
30,
0,
13,
4,
18,
13,
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
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
132,
11
],
[
132,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
14,
17
],
[
14,
18
],
[
132,
19
],
[
19,
20
],
[
19,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
21,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
21,
30
],
[
30,
31
],
[
30,
32
],
[
21,
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
],
[
21,
69
],
[
69,
70
],
[
70,
71
],
[
21,
72
],
[
72,
73
],
[
72,
74
],
[
21,
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
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
92,
97
],
[
97,
98
],
[
91,
99
],
[
88,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
103,
107
],
[
107,
108
],
[
107,
109
],
[
87,
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
],
[
21,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
19,
129
],
[
129,
130
],
[
0,
131
],
[
131,
132
],
[
131,
133
]
] |
[
"import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tprivate static long max = (long) Math.pow(10.0, 18.0);\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\tfor (int i = 0; i < n; i++) {\n\t\t\tlong next = sc.nextLong();\n\t\t\tif (next == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ta[i] = next;\n\t\t}\n\t\tsc.close();\n\n\t\tlong result = 1L;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ttry {\n\t\t\t\tresult = Math.multiplyExact(result, a[i]);\n\t\t\t} catch (ArithmeticException e) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (result > max) {\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(result);\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\tprivate static long max = (long) Math.pow(10.0, 18.0);\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\tfor (int i = 0; i < n; i++) {\n\t\t\tlong next = sc.nextLong();\n\t\t\tif (next == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ta[i] = next;\n\t\t}\n\t\tsc.close();\n\n\t\tlong result = 1L;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ttry {\n\t\t\t\tresult = Math.multiplyExact(result, a[i]);\n\t\t\t} catch (ArithmeticException e) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (result > max) {\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(result);\n\t}\n}",
"Main",
"private static long max = (long) Math.pow(10.0, 18.0);",
"max",
"(long) Math.pow(10.0, 18.0)",
"Math.pow",
"Math",
"10.0",
"18.0",
"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\tfor (int i = 0; i < n; i++) {\n\t\t\tlong next = sc.nextLong();\n\t\t\tif (next == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ta[i] = next;\n\t\t}\n\t\tsc.close();\n\n\t\tlong result = 1L;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ttry {\n\t\t\t\tresult = Math.multiplyExact(result, a[i]);\n\t\t\t} catch (ArithmeticException e) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (result > max) {\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(result);\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\tfor (int i = 0; i < n; i++) {\n\t\t\tlong next = sc.nextLong();\n\t\t\tif (next == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ta[i] = next;\n\t\t}\n\t\tsc.close();\n\n\t\tlong result = 1L;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ttry {\n\t\t\t\tresult = Math.multiplyExact(result, a[i]);\n\t\t\t} catch (ArithmeticException e) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (result > max) {\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(result);\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\tlong next = sc.nextLong();\n\t\t\tif (next == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ta[i] = next;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tlong next = sc.nextLong();\n\t\t\tif (next == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ta[i] = next;\n\t\t}",
"{\n\t\t\tlong next = sc.nextLong();\n\t\t\tif (next == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ta[i] = next;\n\t\t}",
"long next = sc.nextLong();",
"next",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (next == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}",
"next == 0",
"next",
"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;",
"a[i] = next",
"a[i]",
"a",
"i",
"next",
"sc.close()",
"sc.close",
"sc",
"long result = 1L;",
"result",
"1L",
"for (int i = 0; i < n; i++) {\n\t\t\ttry {\n\t\t\t\tresult = Math.multiplyExact(result, a[i]);\n\t\t\t} catch (ArithmeticException e) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (result > max) {\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\ttry {\n\t\t\t\tresult = Math.multiplyExact(result, a[i]);\n\t\t\t} catch (ArithmeticException e) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (result > max) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"{\n\t\t\ttry {\n\t\t\t\tresult = Math.multiplyExact(result, a[i]);\n\t\t\t} catch (ArithmeticException e) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (result > max) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"try {\n\t\t\t\tresult = Math.multiplyExact(result, a[i]);\n\t\t\t} catch (ArithmeticException e) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}",
"catch (ArithmeticException e) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}",
"ArithmeticException e",
"{\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\tresult = Math.multiplyExact(result, a[i]);\n\t\t\t}",
"result = Math.multiplyExact(result, a[i])",
"result",
"Math.multiplyExact(result, a[i])",
"Math.multiplyExact",
"Math",
"result",
"a[i]",
"a",
"i",
"if (result > max) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}",
"result > max",
"result",
"max",
"{\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\tprivate static long max = (long) Math.pow(10.0, 18.0);\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\tfor (int i = 0; i < n; i++) {\n\t\t\tlong next = sc.nextLong();\n\t\t\tif (next == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ta[i] = next;\n\t\t}\n\t\tsc.close();\n\n\t\tlong result = 1L;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ttry {\n\t\t\t\tresult = Math.multiplyExact(result, a[i]);\n\t\t\t} catch (ArithmeticException e) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (result > max) {\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(result);\n\t}\n}",
"public class Main {\n\n\tprivate static long max = (long) Math.pow(10.0, 18.0);\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\tfor (int i = 0; i < n; i++) {\n\t\t\tlong next = sc.nextLong();\n\t\t\tif (next == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ta[i] = next;\n\t\t}\n\t\tsc.close();\n\n\t\tlong result = 1L;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ttry {\n\t\t\t\tresult = Math.multiplyExact(result, a[i]);\n\t\t\t} catch (ArithmeticException e) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (result > max) {\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(result);\n\t}\n}",
"Main"
] |
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
private static long max = (long) Math.pow(10.0, 18.0);
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++) {
long next = sc.nextLong();
if (next == 0) {
System.out.println(0);
return;
}
a[i] = next;
}
sc.close();
long result = 1L;
for (int i = 0; i < n; i++) {
try {
result = Math.multiplyExact(result, a[i]);
} catch (ArithmeticException e) {
System.out.println(-1);
return;
}
if (result > max) {
System.out.println(-1);
return;
}
}
System.out.println(result);
}
}
|
[
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,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
38,
5,
13,
30,
0,
13,
17,
0,
13,
17,
30,
0,
13,
4,
13,
13,
13,
14,
2,
13,
17,
0,
13,
40,
17,
14,
2,
13,
2,
13,
17,
0,
13,
40,
17,
4,
18,
18,
13,
13,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
23,
13,
12,
13,
30,
42,
40,
4,
13,
0,
13,
20,
12,
13,
30,
29,
2,
2,
13,
17,
4,
18,
13,
12,
13,
30,
4,
13,
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,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
162,
11
],
[
162,
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
],
[
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
],
[
48,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
54,
56
],
[
47,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
60,
62
],
[
60,
63
],
[
14,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
14,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
72,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
14,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
12,
88
],
[
88,
89
],
[
162,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
90,
94
],
[
94,
95
],
[
90,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
96,
102
],
[
102,
103
],
[
90,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
107,
111
],
[
111,
112
],
[
111,
113
],
[
90,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
122,
123
],
[
123,
124
],
[
90,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
128,
129
],
[
127,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
90,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
138,
141
],
[
141,
142
],
[
90,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
147,
150
],
[
150,
151
],
[
90,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
156,
159
],
[
159,
160
],
[
0,
161
],
[
161,
162
],
[
161,
163
]
] |
[
"import java.util.*;\nimport java.io.*;\nimport static java.lang.Math.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\t// 入力\n\t\tlong n = sc.nextLong();\n\t\tlong result = 1;\n\t\tboolean flg = false;\n\t\tfor(int i = 0; i < n; i++){\n\t\t long a = sc.nextLong();\n\t\t try{\n\t\t result = multiplyExact(result, a);\n\t\t }catch(Exception e){\n\t\t flg = true;\n\t\t result = 1;\n\t\t }\n\t\t}\n\t\tif(result > 1000000000000000000L) result = -1;\n\t\tif(flg && result != 0) result = -1;\n\t\t\n\t\t// 計算\n\t\t//int result = 0;\n\t\t\n\t\t// 出力\n\t\tSystem.out.println(result);\n\t}\n\n\tpublic static class Scanner {\n\t\tprivate BufferedReader br; private StringTokenizer tok;\n\t\tpublic Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}\n\t\tprivate void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}\n\t\tprivate boolean hasNext() { return tok != null && tok.hasMoreTokens();}\n\t\tpublic String next() throws IOException { getLine(); return tok.nextToken();}\n\t\tpublic int nextInt() throws IOException { return Integer.parseInt(next());}\n\t\tpublic long nextLong() throws IOException { return Long.parseLong(next());}\n\t\tpublic double nextDouble() throws IOException { return Double.parseDouble(next());}\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"import static java.lang.Math.*;",
"import static java.lang.Math.*;",
"import static java.lang.Math.*;",
"public class Main {\n public static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\t// 入力\n\t\tlong n = sc.nextLong();\n\t\tlong result = 1;\n\t\tboolean flg = false;\n\t\tfor(int i = 0; i < n; i++){\n\t\t long a = sc.nextLong();\n\t\t try{\n\t\t result = multiplyExact(result, a);\n\t\t }catch(Exception e){\n\t\t flg = true;\n\t\t result = 1;\n\t\t }\n\t\t}\n\t\tif(result > 1000000000000000000L) result = -1;\n\t\tif(flg && result != 0) result = -1;\n\t\t\n\t\t// 計算\n\t\t//int result = 0;\n\t\t\n\t\t// 出力\n\t\tSystem.out.println(result);\n\t}\n\n\tpublic static class Scanner {\n\t\tprivate BufferedReader br; private StringTokenizer tok;\n\t\tpublic Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}\n\t\tprivate void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}\n\t\tprivate boolean hasNext() { return tok != null && tok.hasMoreTokens();}\n\t\tpublic String next() throws IOException { getLine(); return tok.nextToken();}\n\t\tpublic int nextInt() throws IOException { return Integer.parseInt(next());}\n\t\tpublic long nextLong() throws IOException { return Long.parseLong(next());}\n\t\tpublic double nextDouble() throws IOException { return Double.parseDouble(next());}\n\t}\n}",
"Main",
"public static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\t// 入力\n\t\tlong n = sc.nextLong();\n\t\tlong result = 1;\n\t\tboolean flg = false;\n\t\tfor(int i = 0; i < n; i++){\n\t\t long a = sc.nextLong();\n\t\t try{\n\t\t result = multiplyExact(result, a);\n\t\t }catch(Exception e){\n\t\t flg = true;\n\t\t result = 1;\n\t\t }\n\t\t}\n\t\tif(result > 1000000000000000000L) result = -1;\n\t\tif(flg && result != 0) result = -1;\n\t\t\n\t\t// 計算\n\t\t//int result = 0;\n\t\t\n\t\t// 出力\n\t\tSystem.out.println(result);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\t// 入力\n\t\tlong n = sc.nextLong();\n\t\tlong result = 1;\n\t\tboolean flg = false;\n\t\tfor(int i = 0; i < n; i++){\n\t\t long a = sc.nextLong();\n\t\t try{\n\t\t result = multiplyExact(result, a);\n\t\t }catch(Exception e){\n\t\t flg = true;\n\t\t result = 1;\n\t\t }\n\t\t}\n\t\tif(result > 1000000000000000000L) result = -1;\n\t\tif(flg && result != 0) result = -1;\n\t\t\n\t\t// 計算\n\t\t//int result = 0;\n\t\t\n\t\t// 出力\n\t\tSystem.out.println(result);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"long n = sc.nextLong();",
"n",
"sc.nextLong()",
"sc.nextLong",
"sc",
"long result = 1;",
"result",
"1",
"boolean flg = false;",
"flg",
"false",
"for(int i = 0; i < n; i++){\n\t\t long a = sc.nextLong();\n\t\t try{\n\t\t result = multiplyExact(result, a);\n\t\t }catch(Exception e){\n\t\t flg = true;\n\t\t result = 1;\n\t\t }\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t long a = sc.nextLong();\n\t\t try{\n\t\t result = multiplyExact(result, a);\n\t\t }catch(Exception e){\n\t\t flg = true;\n\t\t result = 1;\n\t\t }\n\t\t}",
"{\n\t\t long a = sc.nextLong();\n\t\t try{\n\t\t result = multiplyExact(result, a);\n\t\t }catch(Exception e){\n\t\t flg = true;\n\t\t result = 1;\n\t\t }\n\t\t}",
"long a = sc.nextLong();",
"a",
"sc.nextLong()",
"sc.nextLong",
"sc",
"try{\n\t\t result = multiplyExact(result, a);\n\t\t }catch(Exception e){\n\t\t flg = true;\n\t\t result = 1;\n\t\t }",
"catch(Exception e){\n\t\t flg = true;\n\t\t result = 1;\n\t\t }",
"Exception e",
"{\n\t\t flg = true;\n\t\t result = 1;\n\t\t }",
"flg = true",
"flg",
"true",
"result = 1",
"result",
"1",
"{\n\t\t result = multiplyExact(result, a);\n\t\t }",
"result = multiplyExact(result, a)",
"result",
"multiplyExact(result, a)",
"multiplyExact",
"result",
"a",
"if(result > 1000000000000000000L) result = -1;",
"result > 1000000000000000000L",
"result",
"1000000000000000000L",
"result = -1",
"result",
"-1",
"1",
"if(flg && result != 0) result = -1;",
"flg && result != 0",
"flg",
"result != 0",
"result",
"0",
"result = -1",
"result",
"-1",
"1",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"String[] args",
"args",
"public static class Scanner {\n\t\tprivate BufferedReader br; private StringTokenizer tok;\n\t\tpublic Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}\n\t\tprivate void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}\n\t\tprivate boolean hasNext() { return tok != null && tok.hasMoreTokens();}\n\t\tpublic String next() throws IOException { getLine(); return tok.nextToken();}\n\t\tpublic int nextInt() throws IOException { return Integer.parseInt(next());}\n\t\tpublic long nextLong() throws IOException { return Long.parseLong(next());}\n\t\tpublic double nextDouble() throws IOException { return Double.parseDouble(next());}\n\t}",
"Scanner",
"private BufferedReader br;",
"br",
"private StringTokenizer tok;",
"tok",
"public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}",
"Scanner",
"{ br = new BufferedReader(new InputStreamReader(is));}",
"br = new BufferedReader(new InputStreamReader(is))",
"br",
"new BufferedReader(new InputStreamReader(is))",
"InputStream is",
"is",
"private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}",
"getLine",
"{ while(!hasNext()) tok = new StringTokenizer(br.readLine());}",
"while(!hasNext()) tok = new StringTokenizer(br.readLine());",
"!hasNext()",
"hasNext()",
"hasNext",
"tok = new StringTokenizer(br.readLine())",
"tok",
"new StringTokenizer(br.readLine())",
"private boolean hasNext() { return tok != null && tok.hasMoreTokens();}",
"hasNext",
"{ return tok != null && tok.hasMoreTokens();}",
"return tok != null && tok.hasMoreTokens();",
"tok != null && tok.hasMoreTokens()",
"tok != null",
"tok",
"null",
"tok.hasMoreTokens()",
"tok.hasMoreTokens",
"tok",
"public String next() throws IOException { getLine(); return tok.nextToken();}",
"next",
"{ getLine(); return tok.nextToken();}",
"getLine()",
"getLine",
"return tok.nextToken();",
"tok.nextToken()",
"tok.nextToken",
"tok",
"public int nextInt() throws IOException { return Integer.parseInt(next());}",
"nextInt",
"{ return Integer.parseInt(next());}",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"public long nextLong() throws IOException { return Long.parseLong(next());}",
"nextLong",
"{ return Long.parseLong(next());}",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"public double nextDouble() throws IOException { return Double.parseDouble(next());}",
"nextDouble",
"{ return Double.parseDouble(next());}",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public class Main {\n public static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\t// 入力\n\t\tlong n = sc.nextLong();\n\t\tlong result = 1;\n\t\tboolean flg = false;\n\t\tfor(int i = 0; i < n; i++){\n\t\t long a = sc.nextLong();\n\t\t try{\n\t\t result = multiplyExact(result, a);\n\t\t }catch(Exception e){\n\t\t flg = true;\n\t\t result = 1;\n\t\t }\n\t\t}\n\t\tif(result > 1000000000000000000L) result = -1;\n\t\tif(flg && result != 0) result = -1;\n\t\t\n\t\t// 計算\n\t\t//int result = 0;\n\t\t\n\t\t// 出力\n\t\tSystem.out.println(result);\n\t}\n\n\tpublic static class Scanner {\n\t\tprivate BufferedReader br; private StringTokenizer tok;\n\t\tpublic Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}\n\t\tprivate void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}\n\t\tprivate boolean hasNext() { return tok != null && tok.hasMoreTokens();}\n\t\tpublic String next() throws IOException { getLine(); return tok.nextToken();}\n\t\tpublic int nextInt() throws IOException { return Integer.parseInt(next());}\n\t\tpublic long nextLong() throws IOException { return Long.parseLong(next());}\n\t\tpublic double nextDouble() throws IOException { return Double.parseDouble(next());}\n\t}\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\t// 入力\n\t\tlong n = sc.nextLong();\n\t\tlong result = 1;\n\t\tboolean flg = false;\n\t\tfor(int i = 0; i < n; i++){\n\t\t long a = sc.nextLong();\n\t\t try{\n\t\t result = multiplyExact(result, a);\n\t\t }catch(Exception e){\n\t\t flg = true;\n\t\t result = 1;\n\t\t }\n\t\t}\n\t\tif(result > 1000000000000000000L) result = -1;\n\t\tif(flg && result != 0) result = -1;\n\t\t\n\t\t// 計算\n\t\t//int result = 0;\n\t\t\n\t\t// 出力\n\t\tSystem.out.println(result);\n\t}\n\n\tpublic static class Scanner {\n\t\tprivate BufferedReader br; private StringTokenizer tok;\n\t\tpublic Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}\n\t\tprivate void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}\n\t\tprivate boolean hasNext() { return tok != null && tok.hasMoreTokens();}\n\t\tpublic String next() throws IOException { getLine(); return tok.nextToken();}\n\t\tpublic int nextInt() throws IOException { return Integer.parseInt(next());}\n\t\tpublic long nextLong() throws IOException { return Long.parseLong(next());}\n\t\tpublic double nextDouble() throws IOException { return Double.parseDouble(next());}\n\t}\n}",
"Main"
] |
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
// 入力
long n = sc.nextLong();
long result = 1;
boolean flg = false;
for(int i = 0; i < n; i++){
long a = sc.nextLong();
try{
result = multiplyExact(result, a);
}catch(Exception e){
flg = true;
result = 1;
}
}
if(result > 1000000000000000000L) result = -1;
if(flg && result != 0) result = -1;
// 計算
//int result = 0;
// 出力
System.out.println(result);
}
public static class Scanner {
private BufferedReader br; private StringTokenizer tok;
public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
public String next() throws IOException { getLine(); return tok.nextToken();}
public int nextInt() throws IOException { return Integer.parseInt(next());}
public long nextLong() throws IOException { return Long.parseLong(next());}
public double nextDouble() throws IOException { return Double.parseDouble(next());}
}
}
|
[
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,
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,
28,
13,
13,
30,
30,
14,
2,
13,
17,
30,
4,
18,
13,
17,
29,
41,
13,
4,
18,
13,
17,
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,
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
],
[
28,
29
],
[
28,
30
],
[
0,
31
],
[
239,
32
],
[
239,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
38,
40
],
[
35,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
43,
45
],
[
35,
46
],
[
46,
47
],
[
46,
48
],
[
35,
49
],
[
49,
50
],
[
49,
51
],
[
35,
52
],
[
52,
53
],
[
52,
54
],
[
35,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
55,
59
],
[
55,
60
],
[
35,
61
],
[
61,
62
],
[
62,
63
],
[
33,
64
],
[
64,
65
],
[
239,
66
],
[
66,
67
],
[
66,
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
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
70,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
70,
108
],
[
108,
109
],
[
108,
110
],
[
108,
111
],
[
112,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
116,
117
],
[
115,
118
],
[
118,
119
],
[
119,
120
],
[
118,
121
],
[
112,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
124,
127
],
[
123,
128
],
[
122,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
130,
133
],
[
133,
134
],
[
129,
135
],
[
70,
136
],
[
136,
137
],
[
137,
138
],
[
136,
139
],
[
68,
140
],
[
140,
141
],
[
68,
142
],
[
142,
143
],
[
68,
144
],
[
144,
145
],
[
239,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
146,
150
],
[
150,
151
],
[
146,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
158,
159
],
[
158,
160
],
[
152,
161
],
[
161,
162
],
[
146,
163
],
[
163,
164
],
[
163,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
167,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
166,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
179,
180
],
[
180,
181
],
[
176,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
165,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
146,
190
],
[
190,
191
],
[
190,
192
],
[
192,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
194,
197
],
[
197,
198
],
[
146,
199
],
[
199,
200
],
[
199,
201
],
[
201,
202
],
[
202,
203
],
[
203,
204
],
[
204,
205
],
[
203,
206
],
[
206,
207
],
[
146,
208
],
[
208,
209
],
[
208,
210
],
[
210,
211
],
[
211,
212
],
[
211,
213
],
[
210,
215
],
[
215,
216
],
[
216,
217
],
[
217,
218
],
[
217,
219
],
[
215,
220
],
[
220,
221
],
[
220,
222
],
[
215,
223
],
[
223,
224
],
[
224,
225
],
[
215,
226
],
[
227,
227
],
[
227,
228
],
[
228,
229
],
[
229,
230
],
[
229,
231
],
[
228,
232
],
[
232,
233
],
[
210,
234
],
[
234,
235
],
[
208,
236
],
[
236,
237
],
[
0,
238
],
[
238,
239
],
[
238,
240
]
] |
[
"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.math.BigInteger;\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 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 final BigInteger MAX = BigInteger.valueOf(1_000_000_000_000_000_000L);\n\n BigInteger answer = BigInteger.ONE;\n for (long x : a) {\n answer = answer.multiply(BigInteger.valueOf(x));\n if (answer.compareTo(MAX) > 0) {\n out.println(-1);\n return;\n }\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.math.BigInteger;",
"BigInteger",
"java.math",
"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 = in.readLongArray(n);\n\n for (long x : a) {\n if (x == 0) {\n out.println(0);\n return;\n }\n }\n\n final BigInteger MAX = BigInteger.valueOf(1_000_000_000_000_000_000L);\n\n BigInteger answer = BigInteger.ONE;\n for (long x : a) {\n answer = answer.multiply(BigInteger.valueOf(x));\n if (answer.compareTo(MAX) > 0) {\n out.println(-1);\n return;\n }\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 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 final BigInteger MAX = BigInteger.valueOf(1_000_000_000_000_000_000L);\n\n BigInteger answer = BigInteger.ONE;\n for (long x : a) {\n answer = answer.multiply(BigInteger.valueOf(x));\n if (answer.compareTo(MAX) > 0) {\n out.println(-1);\n return;\n }\n }\n\n out.println(answer);\n }\n\n }",
"BMultiplication2",
"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 final BigInteger MAX = BigInteger.valueOf(1_000_000_000_000_000_000L);\n\n BigInteger answer = BigInteger.ONE;\n for (long x : a) {\n answer = answer.multiply(BigInteger.valueOf(x));\n if (answer.compareTo(MAX) > 0) {\n out.println(-1);\n return;\n }\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 final BigInteger MAX = BigInteger.valueOf(1_000_000_000_000_000_000L);\n\n BigInteger answer = BigInteger.ONE;\n for (long x : a) {\n answer = answer.multiply(BigInteger.valueOf(x));\n if (answer.compareTo(MAX) > 0) {\n out.println(-1);\n return;\n }\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;",
"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",
"BigInteger answer = BigInteger.ONE;",
"answer",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"for (long x : a) {\n answer = answer.multiply(BigInteger.valueOf(x));\n if (answer.compareTo(MAX) > 0) {\n out.println(-1);\n return;\n }\n }",
"long x",
"a",
"{\n answer = answer.multiply(BigInteger.valueOf(x));\n if (answer.compareTo(MAX) > 0) {\n out.println(-1);\n return;\n }\n }",
"{\n answer = answer.multiply(BigInteger.valueOf(x));\n if (answer.compareTo(MAX) > 0) {\n out.println(-1);\n return;\n }\n }",
"answer = answer.multiply(BigInteger.valueOf(x))",
"answer",
"answer.multiply(BigInteger.valueOf(x))",
"answer.multiply",
"answer",
"BigInteger.valueOf(x)",
"BigInteger.valueOf",
"BigInteger",
"x",
"if (answer.compareTo(MAX) > 0) {\n out.println(-1);\n return;\n }",
"answer.compareTo(MAX) > 0",
"answer.compareTo(MAX)",
"answer.compareTo",
"answer",
"MAX",
"0",
"{\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 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 final BigInteger MAX = BigInteger.valueOf(1_000_000_000_000_000_000L);\n\n BigInteger answer = BigInteger.ONE;\n for (long x : a) {\n answer = answer.multiply(BigInteger.valueOf(x));\n if (answer.compareTo(MAX) > 0) {\n out.println(-1);\n return;\n }\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 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 final BigInteger MAX = BigInteger.valueOf(1_000_000_000_000_000_000L);\n\n BigInteger answer = BigInteger.ONE;\n for (long x : a) {\n answer = answer.multiply(BigInteger.valueOf(x));\n if (answer.compareTo(MAX) > 0) {\n out.println(-1);\n return;\n }\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.math.BigInteger;
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 {
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;
}
}
final BigInteger MAX = BigInteger.valueOf(1_000_000_000_000_000_000L);
BigInteger answer = BigInteger.ONE;
for (long x : a) {
answer = answer.multiply(BigInteger.valueOf(x));
if (answer.compareTo(MAX) > 0) {
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,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
41,
13,
20,
12,
13,
30,
4,
18,
13,
12,
13,
30,
4,
18,
13,
13,
23,
13,
12,
13,
30,
4,
18,
18,
13,
13,
13,
23,
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,
13,
4,
13,
12,
13,
30,
29,
20,
23,
13,
12,
13,
30,
29,
4,
13,
4,
13,
12,
13,
30,
29,
20,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
13,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
4,
18,
13,
13,
29,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
13,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
4,
18,
13,
13,
29,
13,
12,
13,
30,
29,
4,
18,
13,
17,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
17,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
17,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
17,
13,
23,
13,
12,
13,
30,
4,
13,
4,
13,
23,
13,
12,
13,
30,
41,
13,
4,
13,
41,
13,
4,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
18,
4,
18,
13,
13,
17,
30,
4,
13,
17,
29,
41,
13,
20,
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,
13,
40,
17,
29,
4,
13,
4,
18,
13,
6,
13,
41,
13,
20,
41,
13,
17,
41,
13,
12,
13,
30,
41,
13,
20,
42,
17,
30,
41,
13,
38,
5,
13,
30,
0,
13,
17,
30,
0,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
13,
13,
30,
3,
0,
13,
4,
18,
13,
12,
13,
30,
29,
2,
13,
13,
12,
13,
30,
14,
4,
13,
30,
41,
13,
4,
18,
13,
13,
40,
13,
29,
13,
30,
37,
20,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
384,
11
],
[
384,
12
],
[
12,
13
],
[
12,
14
],
[
384,
15
],
[
15,
16
],
[
15,
17
],
[
384,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
384,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
27,
30
],
[
24,
31
],
[
31,
32
],
[
384,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
36,
41
],
[
33,
42
],
[
42,
43
],
[
384,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
384,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
58,
59
],
[
384,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
64,
67
],
[
67,
68
],
[
384,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
384,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
80,
81
],
[
77,
82
],
[
82,
83
],
[
384,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
384,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
92,
97
],
[
97,
98
],
[
384,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
101,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
109,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
117,
118
],
[
109,
119
],
[
119,
120
],
[
120,
121
],
[
109,
122
],
[
123,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
124,
127
],
[
127,
128
],
[
128,
129
],
[
127,
130
],
[
130,
131
],
[
131,
132
],
[
130,
133
],
[
101,
134
],
[
134,
135
],
[
384,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
138,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
154,
155
],
[
146,
156
],
[
156,
157
],
[
157,
158
],
[
146,
159
],
[
160,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
161,
164
],
[
164,
165
],
[
165,
166
],
[
164,
167
],
[
167,
168
],
[
168,
169
],
[
167,
170
],
[
138,
171
],
[
171,
172
],
[
384,
173
],
[
173,
174
],
[
173,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
177,
180
],
[
177,
181
],
[
173,
182
],
[
182,
183
],
[
384,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
189,
190
],
[
188,
191
],
[
188,
192
],
[
184,
193
],
[
193,
194
],
[
384,
195
],
[
195,
196
],
[
195,
197
],
[
197,
198
],
[
198,
199
],
[
199,
200
],
[
200,
201
],
[
199,
202
],
[
199,
203
],
[
195,
204
],
[
204,
205
],
[
384,
206
],
[
206,
207
],
[
206,
208
],
[
208,
209
],
[
209,
210
],
[
210,
211
],
[
211,
212
],
[
210,
213
],
[
210,
214
],
[
206,
215
],
[
215,
216
],
[
384,
217
],
[
217,
218
],
[
217,
219
],
[
219,
220
],
[
220,
221
],
[
219,
222
],
[
222,
223
],
[
217,
224
],
[
224,
225
],
[
384,
226
],
[
226,
227
],
[
226,
228
],
[
228,
229
],
[
229,
230
],
[
229,
231
],
[
231,
232
],
[
228,
233
],
[
233,
234
],
[
233,
235
],
[
235,
236
],
[
228,
237
],
[
237,
238
],
[
237,
239
],
[
228,
240
],
[
240,
241
],
[
241,
242
],
[
242,
243
],
[
242,
244
],
[
240,
245
],
[
245,
246
],
[
245,
247
],
[
240,
248
],
[
248,
249
],
[
249,
250
],
[
240,
251
],
[
252,
252
],
[
252,
253
],
[
253,
254
],
[
254,
255
],
[
255,
256
],
[
256,
257
],
[
257,
258
],
[
256,
259
],
[
254,
260
],
[
253,
261
],
[
261,
262
],
[
262,
263
],
[
262,
264
],
[
261,
265
],
[
228,
266
],
[
266,
267
],
[
266,
268
],
[
228,
269
],
[
269,
270
],
[
270,
271
],
[
271,
272
],
[
271,
273
],
[
269,
274
],
[
274,
275
],
[
274,
276
],
[
269,
277
],
[
277,
278
],
[
278,
279
],
[
269,
280
],
[
281,
281
],
[
281,
282
],
[
282,
283
],
[
282,
284
],
[
284,
285
],
[
285,
286
],
[
284,
287
],
[
281,
288
],
[
288,
289
],
[
289,
290
],
[
290,
291
],
[
291,
292
],
[
290,
293
],
[
289,
294
],
[
288,
295
],
[
295,
296
],
[
296,
297
],
[
296,
298
],
[
298,
299
],
[
295,
300
],
[
228,
301
],
[
301,
302
],
[
301,
303
],
[
303,
304
],
[
304,
305
],
[
384,
306
],
[
306,
307
],
[
306,
308
],
[
308,
309
],
[
308,
310
],
[
306,
311
],
[
311,
312
],
[
311,
313
],
[
306,
314
],
[
314,
315
],
[
306,
316
],
[
316,
317
],
[
316,
318
],
[
318,
319
],
[
319,
320
],
[
319,
321
],
[
318,
322
],
[
322,
323
],
[
322,
324
],
[
324,
325
],
[
325,
326
],
[
324,
327
],
[
327,
328
],
[
328,
329
],
[
328,
330
],
[
330,
331
],
[
331,
332
],
[
331,
333
],
[
327,
334
],
[
334,
335
],
[
335,
336
],
[
335,
337
],
[
337,
338
],
[
338,
339
],
[
324,
340
],
[
340,
341
],
[
341,
342
],
[
341,
343
],
[
340,
344
],
[
344,
345
],
[
345,
346
],
[
346,
347
],
[
345,
348
],
[
340,
349
],
[
349,
350
],
[
318,
351
],
[
351,
352
],
[
351,
353
],
[
353,
354
],
[
354,
355
],
[
306,
356
],
[
356,
357
],
[
356,
358
],
[
358,
359
],
[
359,
360
],
[
360,
361
],
[
360,
362
],
[
306,
363
],
[
363,
364
],
[
363,
365
],
[
365,
366
],
[
366,
367
],
[
367,
368
],
[
366,
369
],
[
369,
370
],
[
370,
371
],
[
370,
372
],
[
372,
373
],
[
373,
374
],
[
372,
375
],
[
369,
376
],
[
376,
377
],
[
369,
378
],
[
378,
379
],
[
366,
380
],
[
380,
381
],
[
381,
382
],
[
0,
383
],
[
383,
384
],
[
383,
385
]
] |
[
"import java.util.*;\nimport java.io.*;\nimport java.math.*;\npublic class Main{\n //↓見なくていいよ!ここから------------------------------------------\n static public class InputIterator{\n ArrayList<String> inputLine = new ArrayList<String>(1024);\n int index = 0; int max;\n InputIterator(){\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n while(true){\n String read;\n try{\n read = br.readLine();\n }catch(IOException e){\n read = null;\n }\n if(read != null){\n inputLine.add(read);\n }else{\n break;\n }\n }\n max = inputLine.size();\n }\n public boolean hasNext(){return (index < max);}\n public String next(){\n if(hasNext()){\n String returnStr = inputLine.get(index);\n index++;\n return returnStr;\n }else{\n throw new IndexOutOfBoundsException(\"これ以上入力はないよ。\");\n }\n }\n }\n \n static InputIterator ii = new InputIterator();//リアクティブでは使えないので諦めてScanner使うこと\n static PrintWriter out = new PrintWriter(System.out);\n static void flush(){out.flush();}\n static void myout(Object t){out.println(t);}\n static void myerr(Object t){System.err.println(t);}\n static String next(){return ii.next();}\n static int nextInt(){return Integer.parseInt(next());}\n static long nextLong(){return Long.parseLong(next());}\n static ArrayList<String> nextStrArray(){return myHanSpSplit(next());}\n static ArrayList<String> myHanSpSplit(String str){return new ArrayList<String>(Arrays.asList(str.split(\" \")));}\n static ArrayList<String> nextCharArray(){return mySingleSplit(next());}\n static ArrayList<String> mySingleSplit(String str){return new ArrayList<String>(Arrays.asList(str.split(\"\")));}\n static ArrayList<Integer> nextIntArray(){\n ArrayList<Integer> ret = new ArrayList<Integer>();\n ArrayList<String> input = nextStrArray();\n for(int i = 0; i < input.size(); i++){\n ret.add(Integer.parseInt(input.get(i)));\n }\n return ret;\n }\n static ArrayList<Long> nextLongArray(){\n ArrayList<Long> ret = new ArrayList<Long>();\n ArrayList<String> input = nextStrArray();\n for(int i = 0; i < input.size(); i++){\n ret.add(Long.parseLong(input.get(i)));\n }\n return ret;\n }\n static String kaigyoToStr(String[] list){return String.join(\"\\n\",list);}\n static String kaigyoToStr(ArrayList<String> list){return String.join(\"\\n\",list);}\n static String hanSpToStr(String[] list){return String.join(\" \",list);}\n static String hanSpToStr(ArrayList<String> list){return String.join(\" \",list);}\n public static void main(String[] args){\n solve();\n flush();\n }\n //↑見なくていいよ!ここまで------------------------------------------\n static public void solve(){//ここがメイン関数代わり\n int N = nextInt();\n ArrayList<String> list = nextStrArray();\n BigInteger output = new BigInteger(\"1\");\n for(int i = 0; i < N; i++){\n if(list.get(i).equals(\"0\")){\n myout(0);\n return;\n }\n }\n BigInteger max = new BigInteger(\"1000000000000000000\");\n for(int i = 0; i < N; i++){\n output = output.multiply(new BigInteger(list.get(i)));\n if(output.compareTo(max) == 1){\n myout(-1);\n return;\n }\n }\n myout(output.toString());\n }\n //Method addition frame start\n\n //Method addition frame end\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"import java.math.*;",
"math.*",
"java",
"public class Main{\n //↓見なくていいよ!ここから------------------------------------------\n static public class InputIterator{\n ArrayList<String> inputLine = new ArrayList<String>(1024);\n int index = 0; int max;\n InputIterator(){\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n while(true){\n String read;\n try{\n read = br.readLine();\n }catch(IOException e){\n read = null;\n }\n if(read != null){\n inputLine.add(read);\n }else{\n break;\n }\n }\n max = inputLine.size();\n }\n public boolean hasNext(){return (index < max);}\n public String next(){\n if(hasNext()){\n String returnStr = inputLine.get(index);\n index++;\n return returnStr;\n }else{\n throw new IndexOutOfBoundsException(\"これ以上入力はないよ。\");\n }\n }\n }\n \n static InputIterator ii = new InputIterator();//リアクティブでは使えないので諦めてScanner使うこと\n static PrintWriter out = new PrintWriter(System.out);\n static void flush(){out.flush();}\n static void myout(Object t){out.println(t);}\n static void myerr(Object t){System.err.println(t);}\n static String next(){return ii.next();}\n static int nextInt(){return Integer.parseInt(next());}\n static long nextLong(){return Long.parseLong(next());}\n static ArrayList<String> nextStrArray(){return myHanSpSplit(next());}\n static ArrayList<String> myHanSpSplit(String str){return new ArrayList<String>(Arrays.asList(str.split(\" \")));}\n static ArrayList<String> nextCharArray(){return mySingleSplit(next());}\n static ArrayList<String> mySingleSplit(String str){return new ArrayList<String>(Arrays.asList(str.split(\"\")));}\n static ArrayList<Integer> nextIntArray(){\n ArrayList<Integer> ret = new ArrayList<Integer>();\n ArrayList<String> input = nextStrArray();\n for(int i = 0; i < input.size(); i++){\n ret.add(Integer.parseInt(input.get(i)));\n }\n return ret;\n }\n static ArrayList<Long> nextLongArray(){\n ArrayList<Long> ret = new ArrayList<Long>();\n ArrayList<String> input = nextStrArray();\n for(int i = 0; i < input.size(); i++){\n ret.add(Long.parseLong(input.get(i)));\n }\n return ret;\n }\n static String kaigyoToStr(String[] list){return String.join(\"\\n\",list);}\n static String kaigyoToStr(ArrayList<String> list){return String.join(\"\\n\",list);}\n static String hanSpToStr(String[] list){return String.join(\" \",list);}\n static String hanSpToStr(ArrayList<String> list){return String.join(\" \",list);}\n public static void main(String[] args){\n solve();\n flush();\n }\n //↑見なくていいよ!ここまで------------------------------------------\n static public void solve(){//ここがメイン関数代わり\n int N = nextInt();\n ArrayList<String> list = nextStrArray();\n BigInteger output = new BigInteger(\"1\");\n for(int i = 0; i < N; i++){\n if(list.get(i).equals(\"0\")){\n myout(0);\n return;\n }\n }\n BigInteger max = new BigInteger(\"1000000000000000000\");\n for(int i = 0; i < N; i++){\n output = output.multiply(new BigInteger(list.get(i)));\n if(output.compareTo(max) == 1){\n myout(-1);\n return;\n }\n }\n myout(output.toString());\n }\n //Method addition frame start\n\n //Method addition frame end\n}",
"Main",
"static InputIterator ii = new InputIterator();//リアクティブでは使えないので諦めてScanner使うこと",
"ii",
"new InputIterator()",
"static PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"static void flush(){out.flush();}",
"flush",
"{out.flush();}",
"out.flush()",
"out.flush",
"out",
"static void myout(Object t){out.println(t);}",
"myout",
"{out.println(t);}",
"out.println(t)",
"out.println",
"out",
"t",
"Object t",
"t",
"static void myerr(Object t){System.err.println(t);}",
"myerr",
"{System.err.println(t);}",
"System.err.println(t)",
"System.err.println",
"System.err",
"System",
"System.err",
"t",
"Object t",
"t",
"static String next(){return ii.next();}",
"next",
"{return ii.next();}",
"return ii.next();",
"ii.next()",
"ii.next",
"ii",
"static int nextInt(){return Integer.parseInt(next());}",
"nextInt",
"{return Integer.parseInt(next());}",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"static long nextLong(){return Long.parseLong(next());}",
"nextLong",
"{return Long.parseLong(next());}",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"static ArrayList<String> nextStrArray(){return myHanSpSplit(next());}",
"nextStrArray",
"{return myHanSpSplit(next());}",
"return myHanSpSplit(next());",
"myHanSpSplit(next())",
"myHanSpSplit",
"next()",
"next",
"static ArrayList<String> myHanSpSplit(String str){return new ArrayList<String>(Arrays.asList(str.split(\" \")));}",
"myHanSpSplit",
"{return new ArrayList<String>(Arrays.asList(str.split(\" \")));}",
"return new ArrayList<String>(Arrays.asList(str.split(\" \")));",
"new ArrayList<String>(Arrays.asList(str.split(\" \")))",
"String str",
"str",
"static ArrayList<String> nextCharArray(){return mySingleSplit(next());}",
"nextCharArray",
"{return mySingleSplit(next());}",
"return mySingleSplit(next());",
"mySingleSplit(next())",
"mySingleSplit",
"next()",
"next",
"static ArrayList<String> mySingleSplit(String str){return new ArrayList<String>(Arrays.asList(str.split(\"\")));}",
"mySingleSplit",
"{return new ArrayList<String>(Arrays.asList(str.split(\"\")));}",
"return new ArrayList<String>(Arrays.asList(str.split(\"\")));",
"new ArrayList<String>(Arrays.asList(str.split(\"\")))",
"String str",
"str",
"static ArrayList<Integer> nextIntArray(){\n ArrayList<Integer> ret = new ArrayList<Integer>();\n ArrayList<String> input = nextStrArray();\n for(int i = 0; i < input.size(); i++){\n ret.add(Integer.parseInt(input.get(i)));\n }\n return ret;\n }",
"nextIntArray",
"{\n ArrayList<Integer> ret = new ArrayList<Integer>();\n ArrayList<String> input = nextStrArray();\n for(int i = 0; i < input.size(); i++){\n ret.add(Integer.parseInt(input.get(i)));\n }\n return ret;\n }",
"ArrayList<Integer> ret = new ArrayList<Integer>();",
"ret",
"new ArrayList<Integer>()",
"ArrayList<String> input = nextStrArray();",
"input",
"nextStrArray()",
"nextStrArray",
"for(int i = 0; i < input.size(); i++){\n ret.add(Integer.parseInt(input.get(i)));\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < input.size()",
"i",
"input.size()",
"input.size",
"input",
"i++",
"i++",
"i",
"{\n ret.add(Integer.parseInt(input.get(i)));\n }",
"{\n ret.add(Integer.parseInt(input.get(i)));\n }",
"ret.add(Integer.parseInt(input.get(i)))",
"ret.add",
"ret",
"Integer.parseInt(input.get(i))",
"Integer.parseInt",
"Integer",
"input.get(i)",
"input.get",
"input",
"i",
"return ret;",
"ret",
"static ArrayList<Long> nextLongArray(){\n ArrayList<Long> ret = new ArrayList<Long>();\n ArrayList<String> input = nextStrArray();\n for(int i = 0; i < input.size(); i++){\n ret.add(Long.parseLong(input.get(i)));\n }\n return ret;\n }",
"nextLongArray",
"{\n ArrayList<Long> ret = new ArrayList<Long>();\n ArrayList<String> input = nextStrArray();\n for(int i = 0; i < input.size(); i++){\n ret.add(Long.parseLong(input.get(i)));\n }\n return ret;\n }",
"ArrayList<Long> ret = new ArrayList<Long>();",
"ret",
"new ArrayList<Long>()",
"ArrayList<String> input = nextStrArray();",
"input",
"nextStrArray()",
"nextStrArray",
"for(int i = 0; i < input.size(); i++){\n ret.add(Long.parseLong(input.get(i)));\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < input.size()",
"i",
"input.size()",
"input.size",
"input",
"i++",
"i++",
"i",
"{\n ret.add(Long.parseLong(input.get(i)));\n }",
"{\n ret.add(Long.parseLong(input.get(i)));\n }",
"ret.add(Long.parseLong(input.get(i)))",
"ret.add",
"ret",
"Long.parseLong(input.get(i))",
"Long.parseLong",
"Long",
"input.get(i)",
"input.get",
"input",
"i",
"return ret;",
"ret",
"static String kaigyoToStr(String[] list){return String.join(\"\\n\",list);}",
"kaigyoToStr",
"{return String.join(\"\\n\",list);}",
"return String.join(\"\\n\",list);",
"String.join(\"\\n\",list)",
"String.join",
"String",
"\"\\n\"",
"list",
"String[] list",
"list",
"static String kaigyoToStr(ArrayList<String> list){return String.join(\"\\n\",list);}",
"kaigyoToStr",
"{return String.join(\"\\n\",list);}",
"return String.join(\"\\n\",list);",
"String.join(\"\\n\",list)",
"String.join",
"String",
"\"\\n\"",
"list",
"ArrayList<String> list",
"list",
"static String hanSpToStr(String[] list){return String.join(\" \",list);}",
"hanSpToStr",
"{return String.join(\" \",list);}",
"return String.join(\" \",list);",
"String.join(\" \",list)",
"String.join",
"String",
"\" \"",
"list",
"String[] list",
"list",
"static String hanSpToStr(ArrayList<String> list){return String.join(\" \",list);}",
"hanSpToStr",
"{return String.join(\" \",list);}",
"return String.join(\" \",list);",
"String.join(\" \",list)",
"String.join",
"String",
"\" \"",
"list",
"ArrayList<String> list",
"list",
"public static void main(String[] args){\n solve();\n flush();\n }",
"main",
"{\n solve();\n flush();\n }",
"solve()",
"solve",
"flush()",
"flush",
"String[] args",
"args",
"//↑見なくていいよ!ここまで------------------------------------------\n static public void solve(){//ここがメイン関数代わり\n int N = nextInt();\n ArrayList<String> list = nextStrArray();\n BigInteger output = new BigInteger(\"1\");\n for(int i = 0; i < N; i++){\n if(list.get(i).equals(\"0\")){\n myout(0);\n return;\n }\n }\n BigInteger max = new BigInteger(\"1000000000000000000\");\n for(int i = 0; i < N; i++){\n output = output.multiply(new BigInteger(list.get(i)));\n if(output.compareTo(max) == 1){\n myout(-1);\n return;\n }\n }\n myout(output.toString());\n }",
"solve",
"{//ここがメイン関数代わり\n int N = nextInt();\n ArrayList<String> list = nextStrArray();\n BigInteger output = new BigInteger(\"1\");\n for(int i = 0; i < N; i++){\n if(list.get(i).equals(\"0\")){\n myout(0);\n return;\n }\n }\n BigInteger max = new BigInteger(\"1000000000000000000\");\n for(int i = 0; i < N; i++){\n output = output.multiply(new BigInteger(list.get(i)));\n if(output.compareTo(max) == 1){\n myout(-1);\n return;\n }\n }\n myout(output.toString());\n }",
"int N = nextInt();",
"N",
"nextInt()",
"nextInt",
"ArrayList<String> list = nextStrArray();",
"list",
"nextStrArray()",
"nextStrArray",
"BigInteger output = new BigInteger(\"1\");",
"output",
"new BigInteger(\"1\")",
"for(int i = 0; i < N; i++){\n if(list.get(i).equals(\"0\")){\n myout(0);\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if(list.get(i).equals(\"0\")){\n myout(0);\n return;\n }\n }",
"{\n if(list.get(i).equals(\"0\")){\n myout(0);\n return;\n }\n }",
"if(list.get(i).equals(\"0\")){\n myout(0);\n return;\n }",
"list.get(i).equals(\"0\")",
"list.get(i).equals",
"list.get(i)",
"list.get",
"list",
"i",
"\"0\"",
"{\n myout(0);\n return;\n }",
"myout(0)",
"myout",
"0",
"return;",
"BigInteger max = new BigInteger(\"1000000000000000000\");",
"max",
"new BigInteger(\"1000000000000000000\")",
"for(int i = 0; i < N; i++){\n output = output.multiply(new BigInteger(list.get(i)));\n if(output.compareTo(max) == 1){\n myout(-1);\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n output = output.multiply(new BigInteger(list.get(i)));\n if(output.compareTo(max) == 1){\n myout(-1);\n return;\n }\n }",
"{\n output = output.multiply(new BigInteger(list.get(i)));\n if(output.compareTo(max) == 1){\n myout(-1);\n return;\n }\n }",
"output = output.multiply(new BigInteger(list.get(i)))",
"output",
"output.multiply(new BigInteger(list.get(i)))",
"output.multiply",
"output",
"new BigInteger(list.get(i))",
"if(output.compareTo(max) == 1){\n myout(-1);\n return;\n }",
"output.compareTo(max) == 1",
"output.compareTo(max)",
"output.compareTo",
"output",
"max",
"1",
"{\n myout(-1);\n return;\n }",
"myout(-1)",
"myout",
"-1",
"1",
"return;",
"myout(output.toString())",
"myout",
"output.toString()",
"output.toString",
"output",
"static public class InputIterator{\n ArrayList<String> inputLine = new ArrayList<String>(1024);\n int index = 0; int max;\n InputIterator(){\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n while(true){\n String read;\n try{\n read = br.readLine();\n }catch(IOException e){\n read = null;\n }\n if(read != null){\n inputLine.add(read);\n }else{\n break;\n }\n }\n max = inputLine.size();\n }\n public boolean hasNext(){return (index < max);}\n public String next(){\n if(hasNext()){\n String returnStr = inputLine.get(index);\n index++;\n return returnStr;\n }else{\n throw new IndexOutOfBoundsException(\"これ以上入力はないよ。\");\n }\n }\n }",
"InputIterator",
"ArrayList<String> inputLine = new ArrayList<String>(1024);",
"inputLine",
"new ArrayList<String>(1024)",
"int index = 0;",
"index",
"0",
"int max;",
"max",
"InputIterator(){\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n while(true){\n String read;\n try{\n read = br.readLine();\n }catch(IOException e){\n read = null;\n }\n if(read != null){\n inputLine.add(read);\n }else{\n break;\n }\n }\n max = inputLine.size();\n }",
"InputIterator",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n while(true){\n String read;\n try{\n read = br.readLine();\n }catch(IOException e){\n read = null;\n }\n if(read != null){\n inputLine.add(read);\n }else{\n break;\n }\n }\n max = inputLine.size();\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"while(true){\n String read;\n try{\n read = br.readLine();\n }catch(IOException e){\n read = null;\n }\n if(read != null){\n inputLine.add(read);\n }else{\n break;\n }\n }",
"true",
"{\n String read;\n try{\n read = br.readLine();\n }catch(IOException e){\n read = null;\n }\n if(read != null){\n inputLine.add(read);\n }else{\n break;\n }\n }",
"String read;",
"read",
"try{\n read = br.readLine();\n }catch(IOException e){\n read = null;\n }",
"catch(IOException e){\n read = null;\n }",
"IOException e",
"{\n read = null;\n }",
"read = null",
"read",
"null",
"{\n read = br.readLine();\n }",
"read = br.readLine()",
"read",
"br.readLine()",
"br.readLine",
"br",
"if(read != null){\n inputLine.add(read);\n }else{\n break;\n }",
"read != null",
"read",
"null",
"{\n inputLine.add(read);\n }",
"inputLine.add(read)",
"inputLine.add",
"inputLine",
"read",
"{\n break;\n }",
"break;",
"max = inputLine.size()",
"max",
"inputLine.size()",
"inputLine.size",
"inputLine",
"public boolean hasNext(){return (index < max);}",
"hasNext",
"{return (index < max);}",
"return (index < max);",
"(index < max)",
"index",
"max",
"public String next(){\n if(hasNext()){\n String returnStr = inputLine.get(index);\n index++;\n return returnStr;\n }else{\n throw new IndexOutOfBoundsException(\"これ以上入力はないよ。\");\n }\n }",
"next",
"{\n if(hasNext()){\n String returnStr = inputLine.get(index);\n index++;\n return returnStr;\n }else{\n throw new IndexOutOfBoundsException(\"これ以上入力はないよ。\");\n }\n }",
"if(hasNext()){\n String returnStr = inputLine.get(index);\n index++;\n return returnStr;\n }else{\n throw new IndexOutOfBoundsException(\"これ以上入力はないよ。\");\n }",
"hasNext()",
"hasNext",
"{\n String returnStr = inputLine.get(index);\n index++;\n return returnStr;\n }",
"String returnStr = inputLine.get(index);",
"returnStr",
"inputLine.get(index)",
"inputLine.get",
"inputLine",
"index",
"index++",
"index",
"return returnStr;",
"returnStr",
"{\n throw new IndexOutOfBoundsException(\"これ以上入力はないよ。\");\n }",
"throw new IndexOutOfBoundsException(\"これ以上入力はないよ。\");",
"new IndexOutOfBoundsException(\"これ以上入力はないよ。\")",
"public class Main{\n //↓見なくていいよ!ここから------------------------------------------\n static public class InputIterator{\n ArrayList<String> inputLine = new ArrayList<String>(1024);\n int index = 0; int max;\n InputIterator(){\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n while(true){\n String read;\n try{\n read = br.readLine();\n }catch(IOException e){\n read = null;\n }\n if(read != null){\n inputLine.add(read);\n }else{\n break;\n }\n }\n max = inputLine.size();\n }\n public boolean hasNext(){return (index < max);}\n public String next(){\n if(hasNext()){\n String returnStr = inputLine.get(index);\n index++;\n return returnStr;\n }else{\n throw new IndexOutOfBoundsException(\"これ以上入力はないよ。\");\n }\n }\n }\n \n static InputIterator ii = new InputIterator();//リアクティブでは使えないので諦めてScanner使うこと\n static PrintWriter out = new PrintWriter(System.out);\n static void flush(){out.flush();}\n static void myout(Object t){out.println(t);}\n static void myerr(Object t){System.err.println(t);}\n static String next(){return ii.next();}\n static int nextInt(){return Integer.parseInt(next());}\n static long nextLong(){return Long.parseLong(next());}\n static ArrayList<String> nextStrArray(){return myHanSpSplit(next());}\n static ArrayList<String> myHanSpSplit(String str){return new ArrayList<String>(Arrays.asList(str.split(\" \")));}\n static ArrayList<String> nextCharArray(){return mySingleSplit(next());}\n static ArrayList<String> mySingleSplit(String str){return new ArrayList<String>(Arrays.asList(str.split(\"\")));}\n static ArrayList<Integer> nextIntArray(){\n ArrayList<Integer> ret = new ArrayList<Integer>();\n ArrayList<String> input = nextStrArray();\n for(int i = 0; i < input.size(); i++){\n ret.add(Integer.parseInt(input.get(i)));\n }\n return ret;\n }\n static ArrayList<Long> nextLongArray(){\n ArrayList<Long> ret = new ArrayList<Long>();\n ArrayList<String> input = nextStrArray();\n for(int i = 0; i < input.size(); i++){\n ret.add(Long.parseLong(input.get(i)));\n }\n return ret;\n }\n static String kaigyoToStr(String[] list){return String.join(\"\\n\",list);}\n static String kaigyoToStr(ArrayList<String> list){return String.join(\"\\n\",list);}\n static String hanSpToStr(String[] list){return String.join(\" \",list);}\n static String hanSpToStr(ArrayList<String> list){return String.join(\" \",list);}\n public static void main(String[] args){\n solve();\n flush();\n }\n //↑見なくていいよ!ここまで------------------------------------------\n static public void solve(){//ここがメイン関数代わり\n int N = nextInt();\n ArrayList<String> list = nextStrArray();\n BigInteger output = new BigInteger(\"1\");\n for(int i = 0; i < N; i++){\n if(list.get(i).equals(\"0\")){\n myout(0);\n return;\n }\n }\n BigInteger max = new BigInteger(\"1000000000000000000\");\n for(int i = 0; i < N; i++){\n output = output.multiply(new BigInteger(list.get(i)));\n if(output.compareTo(max) == 1){\n myout(-1);\n return;\n }\n }\n myout(output.toString());\n }\n //Method addition frame start\n\n //Method addition frame end\n}",
"public class Main{\n //↓見なくていいよ!ここから------------------------------------------\n static public class InputIterator{\n ArrayList<String> inputLine = new ArrayList<String>(1024);\n int index = 0; int max;\n InputIterator(){\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n while(true){\n String read;\n try{\n read = br.readLine();\n }catch(IOException e){\n read = null;\n }\n if(read != null){\n inputLine.add(read);\n }else{\n break;\n }\n }\n max = inputLine.size();\n }\n public boolean hasNext(){return (index < max);}\n public String next(){\n if(hasNext()){\n String returnStr = inputLine.get(index);\n index++;\n return returnStr;\n }else{\n throw new IndexOutOfBoundsException(\"これ以上入力はないよ。\");\n }\n }\n }\n \n static InputIterator ii = new InputIterator();//リアクティブでは使えないので諦めてScanner使うこと\n static PrintWriter out = new PrintWriter(System.out);\n static void flush(){out.flush();}\n static void myout(Object t){out.println(t);}\n static void myerr(Object t){System.err.println(t);}\n static String next(){return ii.next();}\n static int nextInt(){return Integer.parseInt(next());}\n static long nextLong(){return Long.parseLong(next());}\n static ArrayList<String> nextStrArray(){return myHanSpSplit(next());}\n static ArrayList<String> myHanSpSplit(String str){return new ArrayList<String>(Arrays.asList(str.split(\" \")));}\n static ArrayList<String> nextCharArray(){return mySingleSplit(next());}\n static ArrayList<String> mySingleSplit(String str){return new ArrayList<String>(Arrays.asList(str.split(\"\")));}\n static ArrayList<Integer> nextIntArray(){\n ArrayList<Integer> ret = new ArrayList<Integer>();\n ArrayList<String> input = nextStrArray();\n for(int i = 0; i < input.size(); i++){\n ret.add(Integer.parseInt(input.get(i)));\n }\n return ret;\n }\n static ArrayList<Long> nextLongArray(){\n ArrayList<Long> ret = new ArrayList<Long>();\n ArrayList<String> input = nextStrArray();\n for(int i = 0; i < input.size(); i++){\n ret.add(Long.parseLong(input.get(i)));\n }\n return ret;\n }\n static String kaigyoToStr(String[] list){return String.join(\"\\n\",list);}\n static String kaigyoToStr(ArrayList<String> list){return String.join(\"\\n\",list);}\n static String hanSpToStr(String[] list){return String.join(\" \",list);}\n static String hanSpToStr(ArrayList<String> list){return String.join(\" \",list);}\n public static void main(String[] args){\n solve();\n flush();\n }\n //↑見なくていいよ!ここまで------------------------------------------\n static public void solve(){//ここがメイン関数代わり\n int N = nextInt();\n ArrayList<String> list = nextStrArray();\n BigInteger output = new BigInteger(\"1\");\n for(int i = 0; i < N; i++){\n if(list.get(i).equals(\"0\")){\n myout(0);\n return;\n }\n }\n BigInteger max = new BigInteger(\"1000000000000000000\");\n for(int i = 0; i < N; i++){\n output = output.multiply(new BigInteger(list.get(i)));\n if(output.compareTo(max) == 1){\n myout(-1);\n return;\n }\n }\n myout(output.toString());\n }\n //Method addition frame start\n\n //Method addition frame end\n}",
"Main"
] |
import java.util.*;
import java.io.*;
import java.math.*;
public class Main{
//↓見なくていいよ!ここから------------------------------------------
static public class InputIterator{
ArrayList<String> inputLine = new ArrayList<String>(1024);
int index = 0; int max;
InputIterator(){
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while(true){
String read;
try{
read = br.readLine();
}catch(IOException e){
read = null;
}
if(read != null){
inputLine.add(read);
}else{
break;
}
}
max = inputLine.size();
}
public boolean hasNext(){return (index < max);}
public String next(){
if(hasNext()){
String returnStr = inputLine.get(index);
index++;
return returnStr;
}else{
throw new IndexOutOfBoundsException("これ以上入力はないよ。");
}
}
}
static InputIterator ii = new InputIterator();//リアクティブでは使えないので諦めてScanner使うこと
static PrintWriter out = new PrintWriter(System.out);
static void flush(){out.flush();}
static void myout(Object t){out.println(t);}
static void myerr(Object t){System.err.println(t);}
static String next(){return ii.next();}
static int nextInt(){return Integer.parseInt(next());}
static long nextLong(){return Long.parseLong(next());}
static ArrayList<String> nextStrArray(){return myHanSpSplit(next());}
static ArrayList<String> myHanSpSplit(String str){return new ArrayList<String>(Arrays.asList(str.split(" ")));}
static ArrayList<String> nextCharArray(){return mySingleSplit(next());}
static ArrayList<String> mySingleSplit(String str){return new ArrayList<String>(Arrays.asList(str.split("")));}
static ArrayList<Integer> nextIntArray(){
ArrayList<Integer> ret = new ArrayList<Integer>();
ArrayList<String> input = nextStrArray();
for(int i = 0; i < input.size(); i++){
ret.add(Integer.parseInt(input.get(i)));
}
return ret;
}
static ArrayList<Long> nextLongArray(){
ArrayList<Long> ret = new ArrayList<Long>();
ArrayList<String> input = nextStrArray();
for(int i = 0; i < input.size(); i++){
ret.add(Long.parseLong(input.get(i)));
}
return ret;
}
static String kaigyoToStr(String[] list){return String.join("\n",list);}
static String kaigyoToStr(ArrayList<String> list){return String.join("\n",list);}
static String hanSpToStr(String[] list){return String.join(" ",list);}
static String hanSpToStr(ArrayList<String> list){return String.join(" ",list);}
public static void main(String[] args){
solve();
flush();
}
//↑見なくていいよ!ここまで------------------------------------------
static public void solve(){//ここがメイン関数代わり
int N = nextInt();
ArrayList<String> list = nextStrArray();
BigInteger output = new BigInteger("1");
for(int i = 0; i < N; i++){
if(list.get(i).equals("0")){
myout(0);
return;
}
}
BigInteger max = new BigInteger("1000000000000000000");
for(int i = 0; i < N; i++){
output = output.multiply(new BigInteger(list.get(i)));
if(output.compareTo(max) == 1){
myout(-1);
return;
}
}
myout(output.toString());
}
//Method addition frame start
//Method addition frame end
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
41,
13,
17,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
14,
2,
13,
17,
30,
0,
13,
17,
14,
13,
30,
9,
14,
40,
13,
30,
0,
13,
4,
18,
13,
13,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
13,
17,
14,
2,
40,
13,
2,
13,
17,
30,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
13,
30,
4,
18,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
13,
14,
13,
30,
4,
18,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
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
],
[
11,
18
],
[
18,
19
],
[
18,
20
],
[
11,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
11,
26
],
[
26,
27
],
[
26,
28
],
[
11,
29
],
[
29,
30
],
[
11,
31
],
[
31,
32
],
[
31,
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
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
46,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
46,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
46,
64
],
[
64,
65
],
[
65,
66
],
[
64,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
70,
73
],
[
67,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
11,
78
],
[
78,
79
],
[
78,
80
],
[
11,
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
],
[
94,
96
],
[
11,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
101,
102
],
[
101,
103
],
[
97,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
113,
114
],
[
105,
115
],
[
115,
116
],
[
116,
117
],
[
105,
118
],
[
119,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
123,
124
],
[
122,
125
],
[
104,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
126,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
97,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
147,
152
],
[
144,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
154,
159
],
[
9,
160
],
[
160,
161
]
] |
[
"import java.util.Scanner;\nimport java.util.ArrayList;\n\nclass Main{\n public static void main(String args[]){\n\tScanner sc = new Scanner(System.in);\n\tlong a = 1;\n\tdouble p = 0;\n\tint n = sc.nextInt();\n\tboolean zero = false;\n\tlong m;\n\tArrayList<Long> l = new ArrayList<Long>();\n\tfor(int i=0;i<n;i++){\n\t m = sc.nextLong();\n\t if(m==0){\n\t\tzero = true;\n\t }\n\t if(zero){\n\t\tcontinue;\n\t }\n\t if(!zero){\n\t\tp+=Math.log10(m);\n\t\tl.add(m);\n\t }\n\t}\n\tlong x = 1;\n\tfor(int i=0;i<18;i++){\n\t x*=10;\n\t}\n\tif(!zero&&p<=18){\n\t for(int i=0;i<l.size();i++){\n\t\ta*=l.get(i);\n\t }\n\t if(a>x){\n\t\tSystem.out.println(\"-1\");\n\t }else{\n\t\tSystem.out.println(a);\n\t }\n\t}else if(zero){\n\t System.out.println(\"0\");\n\t}else{\n\t System.out.println(\"-1\");\n\t}\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"class Main{\n public static void main(String args[]){\n\tScanner sc = new Scanner(System.in);\n\tlong a = 1;\n\tdouble p = 0;\n\tint n = sc.nextInt();\n\tboolean zero = false;\n\tlong m;\n\tArrayList<Long> l = new ArrayList<Long>();\n\tfor(int i=0;i<n;i++){\n\t m = sc.nextLong();\n\t if(m==0){\n\t\tzero = true;\n\t }\n\t if(zero){\n\t\tcontinue;\n\t }\n\t if(!zero){\n\t\tp+=Math.log10(m);\n\t\tl.add(m);\n\t }\n\t}\n\tlong x = 1;\n\tfor(int i=0;i<18;i++){\n\t x*=10;\n\t}\n\tif(!zero&&p<=18){\n\t for(int i=0;i<l.size();i++){\n\t\ta*=l.get(i);\n\t }\n\t if(a>x){\n\t\tSystem.out.println(\"-1\");\n\t }else{\n\t\tSystem.out.println(a);\n\t }\n\t}else if(zero){\n\t System.out.println(\"0\");\n\t}else{\n\t System.out.println(\"-1\");\n\t}\n }\n}",
"Main",
"public static void main(String args[]){\n\tScanner sc = new Scanner(System.in);\n\tlong a = 1;\n\tdouble p = 0;\n\tint n = sc.nextInt();\n\tboolean zero = false;\n\tlong m;\n\tArrayList<Long> l = new ArrayList<Long>();\n\tfor(int i=0;i<n;i++){\n\t m = sc.nextLong();\n\t if(m==0){\n\t\tzero = true;\n\t }\n\t if(zero){\n\t\tcontinue;\n\t }\n\t if(!zero){\n\t\tp+=Math.log10(m);\n\t\tl.add(m);\n\t }\n\t}\n\tlong x = 1;\n\tfor(int i=0;i<18;i++){\n\t x*=10;\n\t}\n\tif(!zero&&p<=18){\n\t for(int i=0;i<l.size();i++){\n\t\ta*=l.get(i);\n\t }\n\t if(a>x){\n\t\tSystem.out.println(\"-1\");\n\t }else{\n\t\tSystem.out.println(a);\n\t }\n\t}else if(zero){\n\t System.out.println(\"0\");\n\t}else{\n\t System.out.println(\"-1\");\n\t}\n }",
"main",
"{\n\tScanner sc = new Scanner(System.in);\n\tlong a = 1;\n\tdouble p = 0;\n\tint n = sc.nextInt();\n\tboolean zero = false;\n\tlong m;\n\tArrayList<Long> l = new ArrayList<Long>();\n\tfor(int i=0;i<n;i++){\n\t m = sc.nextLong();\n\t if(m==0){\n\t\tzero = true;\n\t }\n\t if(zero){\n\t\tcontinue;\n\t }\n\t if(!zero){\n\t\tp+=Math.log10(m);\n\t\tl.add(m);\n\t }\n\t}\n\tlong x = 1;\n\tfor(int i=0;i<18;i++){\n\t x*=10;\n\t}\n\tif(!zero&&p<=18){\n\t for(int i=0;i<l.size();i++){\n\t\ta*=l.get(i);\n\t }\n\t if(a>x){\n\t\tSystem.out.println(\"-1\");\n\t }else{\n\t\tSystem.out.println(a);\n\t }\n\t}else if(zero){\n\t System.out.println(\"0\");\n\t}else{\n\t System.out.println(\"-1\");\n\t}\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"long a = 1;",
"a",
"1",
"double p = 0;",
"p",
"0",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"boolean zero = false;",
"zero",
"false",
"long m;",
"m",
"ArrayList<Long> l = new ArrayList<Long>();",
"l",
"new ArrayList<Long>()",
"for(int i=0;i<n;i++){\n\t m = sc.nextLong();\n\t if(m==0){\n\t\tzero = true;\n\t }\n\t if(zero){\n\t\tcontinue;\n\t }\n\t if(!zero){\n\t\tp+=Math.log10(m);\n\t\tl.add(m);\n\t }\n\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t m = sc.nextLong();\n\t if(m==0){\n\t\tzero = true;\n\t }\n\t if(zero){\n\t\tcontinue;\n\t }\n\t if(!zero){\n\t\tp+=Math.log10(m);\n\t\tl.add(m);\n\t }\n\t}",
"{\n\t m = sc.nextLong();\n\t if(m==0){\n\t\tzero = true;\n\t }\n\t if(zero){\n\t\tcontinue;\n\t }\n\t if(!zero){\n\t\tp+=Math.log10(m);\n\t\tl.add(m);\n\t }\n\t}",
"m = sc.nextLong()",
"m",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(m==0){\n\t\tzero = true;\n\t }",
"m==0",
"m",
"0",
"{\n\t\tzero = true;\n\t }",
"zero = true",
"zero",
"true",
"if(zero){\n\t\tcontinue;\n\t }",
"zero",
"{\n\t\tcontinue;\n\t }",
"continue;",
"if(!zero){\n\t\tp+=Math.log10(m);\n\t\tl.add(m);\n\t }",
"!zero",
"zero",
"{\n\t\tp+=Math.log10(m);\n\t\tl.add(m);\n\t }",
"p+=Math.log10(m)",
"p",
"Math.log10(m)",
"Math.log10",
"Math",
"m",
"l.add(m)",
"l.add",
"l",
"m",
"long x = 1;",
"x",
"1",
"for(int i=0;i<18;i++){\n\t x*=10;\n\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<18",
"i",
"18",
"i++",
"i++",
"i",
"{\n\t x*=10;\n\t}",
"{\n\t x*=10;\n\t}",
"x*=10",
"x",
"10",
"if(!zero&&p<=18){\n\t for(int i=0;i<l.size();i++){\n\t\ta*=l.get(i);\n\t }\n\t if(a>x){\n\t\tSystem.out.println(\"-1\");\n\t }else{\n\t\tSystem.out.println(a);\n\t }\n\t}else if(zero){\n\t System.out.println(\"0\");\n\t}else{\n\t System.out.println(\"-1\");\n\t}",
"!zero&&p<=18",
"!zero",
"zero",
"p<=18",
"p",
"18",
"{\n\t for(int i=0;i<l.size();i++){\n\t\ta*=l.get(i);\n\t }\n\t if(a>x){\n\t\tSystem.out.println(\"-1\");\n\t }else{\n\t\tSystem.out.println(a);\n\t }\n\t}",
"for(int i=0;i<l.size();i++){\n\t\ta*=l.get(i);\n\t }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<l.size()",
"i",
"l.size()",
"l.size",
"l",
"i++",
"i++",
"i",
"{\n\t\ta*=l.get(i);\n\t }",
"{\n\t\ta*=l.get(i);\n\t }",
"a*=l.get(i)",
"a",
"l.get(i)",
"l.get",
"l",
"i",
"if(a>x){\n\t\tSystem.out.println(\"-1\");\n\t }else{\n\t\tSystem.out.println(a);\n\t }",
"a>x",
"a",
"x",
"{\n\t\tSystem.out.println(\"-1\");\n\t }",
"System.out.println(\"-1\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"{\n\t\tSystem.out.println(a);\n\t }",
"System.out.println(a)",
"System.out.println",
"System.out",
"System",
"System.out",
"a",
"if(zero){\n\t System.out.println(\"0\");\n\t}else{\n\t System.out.println(\"-1\");\n\t}",
"zero",
"{\n\t System.out.println(\"0\");\n\t}",
"System.out.println(\"0\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"0\"",
"{\n\t System.out.println(\"-1\");\n\t}",
"System.out.println(\"-1\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"String args[]",
"args"
] |
import java.util.Scanner;
import java.util.ArrayList;
class Main{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
long a = 1;
double p = 0;
int n = sc.nextInt();
boolean zero = false;
long m;
ArrayList<Long> l = new ArrayList<Long>();
for(int i=0;i<n;i++){
m = sc.nextLong();
if(m==0){
zero = true;
}
if(zero){
continue;
}
if(!zero){
p+=Math.log10(m);
l.add(m);
}
}
long x = 1;
for(int i=0;i<18;i++){
x*=10;
}
if(!zero&&p<=18){
for(int i=0;i<l.size();i++){
a*=l.get(i);
}
if(a>x){
System.out.println("-1");
}else{
System.out.println(a);
}
}else if(zero){
System.out.println("0");
}else{
System.out.println("-1");
}
}
}
|
[
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,
14,
2,
13,
17,
30,
0,
13,
4,
18,
13,
30,
0,
13,
4,
18,
13,
14,
2,
4,
18,
13,
20,
17,
30,
0,
13,
4,
18,
13,
13,
14,
2,
2,
4,
18,
13,
20,
17,
2,
4,
18,
13,
20,
17,
30,
4,
18,
18,
13,
13,
17,
29,
14,
2,
4,
18,
13,
20,
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
],
[
116,
8
],
[
116,
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
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
39,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
49,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
57,
60
],
[
56,
61
],
[
55,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
65,
68
],
[
49,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
72,
75
],
[
71,
76
],
[
70,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
77,
82
],
[
69,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
84,
89
],
[
83,
90
],
[
11,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
92,
97
],
[
91,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
99,
104
],
[
104,
105
],
[
91,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
9,
113
],
[
113,
114
],
[
0,
115
],
[
115,
116
],
[
115,
117
]
] |
[
"import java.math.BigDecimal;\nimport java.util.Scanner;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t// 整数の入力\n\t\tint a = sc.nextInt();\n \tBigDecimal b = new BigDecimal(\"0\");\n BigDecimal c = new BigDecimal(\"0\");\n\n \tfor (int i = 0; i < a; i++) {\n \tif (i == 0) {\n b = sc.nextBigDecimal();\n } else {\n c = sc.nextBigDecimal();\n \tif (b.compareTo(new BigDecimal(\"1000000000000000000\")) <= 0) {\n b = b.multiply(c);\n }\n \tif (b.compareTo(new BigDecimal(\"0\")) == 0\n || c.compareTo(new BigDecimal(\"0\")) == 0) {\n System.out.println(0);\n return;\n }\n }\n }\n\n \tif (b.compareTo(new BigDecimal(\"1000000000000000000\")) > 0) {\n System.out.println(-1);\n } else {\n System.out.println(b);\n }\n\t}\n}",
"import java.math.BigDecimal;",
"BigDecimal",
"java.math",
"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\n\t\t// 整数の入力\n\t\tint a = sc.nextInt();\n \tBigDecimal b = new BigDecimal(\"0\");\n BigDecimal c = new BigDecimal(\"0\");\n\n \tfor (int i = 0; i < a; i++) {\n \tif (i == 0) {\n b = sc.nextBigDecimal();\n } else {\n c = sc.nextBigDecimal();\n \tif (b.compareTo(new BigDecimal(\"1000000000000000000\")) <= 0) {\n b = b.multiply(c);\n }\n \tif (b.compareTo(new BigDecimal(\"0\")) == 0\n || c.compareTo(new BigDecimal(\"0\")) == 0) {\n System.out.println(0);\n return;\n }\n }\n }\n\n \tif (b.compareTo(new BigDecimal(\"1000000000000000000\")) > 0) {\n System.out.println(-1);\n } else {\n System.out.println(b);\n }\n\t}\n}",
"Main",
"public static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t// 整数の入力\n\t\tint a = sc.nextInt();\n \tBigDecimal b = new BigDecimal(\"0\");\n BigDecimal c = new BigDecimal(\"0\");\n\n \tfor (int i = 0; i < a; i++) {\n \tif (i == 0) {\n b = sc.nextBigDecimal();\n } else {\n c = sc.nextBigDecimal();\n \tif (b.compareTo(new BigDecimal(\"1000000000000000000\")) <= 0) {\n b = b.multiply(c);\n }\n \tif (b.compareTo(new BigDecimal(\"0\")) == 0\n || c.compareTo(new BigDecimal(\"0\")) == 0) {\n System.out.println(0);\n return;\n }\n }\n }\n\n \tif (b.compareTo(new BigDecimal(\"1000000000000000000\")) > 0) {\n System.out.println(-1);\n } else {\n System.out.println(b);\n }\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t// 整数の入力\n\t\tint a = sc.nextInt();\n \tBigDecimal b = new BigDecimal(\"0\");\n BigDecimal c = new BigDecimal(\"0\");\n\n \tfor (int i = 0; i < a; i++) {\n \tif (i == 0) {\n b = sc.nextBigDecimal();\n } else {\n c = sc.nextBigDecimal();\n \tif (b.compareTo(new BigDecimal(\"1000000000000000000\")) <= 0) {\n b = b.multiply(c);\n }\n \tif (b.compareTo(new BigDecimal(\"0\")) == 0\n || c.compareTo(new BigDecimal(\"0\")) == 0) {\n System.out.println(0);\n return;\n }\n }\n }\n\n \tif (b.compareTo(new BigDecimal(\"1000000000000000000\")) > 0) {\n System.out.println(-1);\n } else {\n System.out.println(b);\n }\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int a = sc.nextInt();",
"a",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BigDecimal b = new BigDecimal(\"0\");",
"b",
"new BigDecimal(\"0\")",
"BigDecimal c = new BigDecimal(\"0\");",
"c",
"new BigDecimal(\"0\")",
"for (int i = 0; i < a; i++) {\n \tif (i == 0) {\n b = sc.nextBigDecimal();\n } else {\n c = sc.nextBigDecimal();\n \tif (b.compareTo(new BigDecimal(\"1000000000000000000\")) <= 0) {\n b = b.multiply(c);\n }\n \tif (b.compareTo(new BigDecimal(\"0\")) == 0\n || c.compareTo(new BigDecimal(\"0\")) == 0) {\n System.out.println(0);\n return;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < a",
"i",
"a",
"i++",
"i++",
"i",
"{\n \tif (i == 0) {\n b = sc.nextBigDecimal();\n } else {\n c = sc.nextBigDecimal();\n \tif (b.compareTo(new BigDecimal(\"1000000000000000000\")) <= 0) {\n b = b.multiply(c);\n }\n \tif (b.compareTo(new BigDecimal(\"0\")) == 0\n || c.compareTo(new BigDecimal(\"0\")) == 0) {\n System.out.println(0);\n return;\n }\n }\n }",
"{\n \tif (i == 0) {\n b = sc.nextBigDecimal();\n } else {\n c = sc.nextBigDecimal();\n \tif (b.compareTo(new BigDecimal(\"1000000000000000000\")) <= 0) {\n b = b.multiply(c);\n }\n \tif (b.compareTo(new BigDecimal(\"0\")) == 0\n || c.compareTo(new BigDecimal(\"0\")) == 0) {\n System.out.println(0);\n return;\n }\n }\n }",
"if (i == 0) {\n b = sc.nextBigDecimal();\n } else {\n c = sc.nextBigDecimal();\n \tif (b.compareTo(new BigDecimal(\"1000000000000000000\")) <= 0) {\n b = b.multiply(c);\n }\n \tif (b.compareTo(new BigDecimal(\"0\")) == 0\n || c.compareTo(new BigDecimal(\"0\")) == 0) {\n System.out.println(0);\n return;\n }\n }",
"i == 0",
"i",
"0",
"{\n b = sc.nextBigDecimal();\n }",
"b = sc.nextBigDecimal()",
"b",
"sc.nextBigDecimal()",
"sc.nextBigDecimal",
"sc",
"{\n c = sc.nextBigDecimal();\n \tif (b.compareTo(new BigDecimal(\"1000000000000000000\")) <= 0) {\n b = b.multiply(c);\n }\n \tif (b.compareTo(new BigDecimal(\"0\")) == 0\n || c.compareTo(new BigDecimal(\"0\")) == 0) {\n System.out.println(0);\n return;\n }\n }",
"c = sc.nextBigDecimal()",
"c",
"sc.nextBigDecimal()",
"sc.nextBigDecimal",
"sc",
"if (b.compareTo(new BigDecimal(\"1000000000000000000\")) <= 0) {\n b = b.multiply(c);\n }",
"b.compareTo(new BigDecimal(\"1000000000000000000\")) <= 0",
"b.compareTo(new BigDecimal(\"1000000000000000000\"))",
"b.compareTo",
"b",
"new BigDecimal(\"1000000000000000000\")",
"0",
"{\n b = b.multiply(c);\n }",
"b = b.multiply(c)",
"b",
"b.multiply(c)",
"b.multiply",
"b",
"c",
"if (b.compareTo(new BigDecimal(\"0\")) == 0\n || c.compareTo(new BigDecimal(\"0\")) == 0) {\n System.out.println(0);\n return;\n }",
"b.compareTo(new BigDecimal(\"0\")) == 0\n || c.compareTo(new BigDecimal(\"0\")) == 0",
"b.compareTo(new BigDecimal(\"0\")) == 0",
"b.compareTo(new BigDecimal(\"0\"))",
"b.compareTo",
"b",
"new BigDecimal(\"0\")",
"0",
"c.compareTo(new BigDecimal(\"0\")) == 0",
"c.compareTo(new BigDecimal(\"0\"))",
"c.compareTo",
"c",
"new BigDecimal(\"0\")",
"0",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"if (b.compareTo(new BigDecimal(\"1000000000000000000\")) > 0) {\n System.out.println(-1);\n } else {\n System.out.println(b);\n }",
"b.compareTo(new BigDecimal(\"1000000000000000000\")) > 0",
"b.compareTo(new BigDecimal(\"1000000000000000000\"))",
"b.compareTo",
"b",
"new BigDecimal(\"1000000000000000000\")",
"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(b);\n }",
"System.out.println(b)",
"System.out.println",
"System.out",
"System",
"System.out",
"b",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t// 整数の入力\n\t\tint a = sc.nextInt();\n \tBigDecimal b = new BigDecimal(\"0\");\n BigDecimal c = new BigDecimal(\"0\");\n\n \tfor (int i = 0; i < a; i++) {\n \tif (i == 0) {\n b = sc.nextBigDecimal();\n } else {\n c = sc.nextBigDecimal();\n \tif (b.compareTo(new BigDecimal(\"1000000000000000000\")) <= 0) {\n b = b.multiply(c);\n }\n \tif (b.compareTo(new BigDecimal(\"0\")) == 0\n || c.compareTo(new BigDecimal(\"0\")) == 0) {\n System.out.println(0);\n return;\n }\n }\n }\n\n \tif (b.compareTo(new BigDecimal(\"1000000000000000000\")) > 0) {\n System.out.println(-1);\n } else {\n System.out.println(b);\n }\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t// 整数の入力\n\t\tint a = sc.nextInt();\n \tBigDecimal b = new BigDecimal(\"0\");\n BigDecimal c = new BigDecimal(\"0\");\n\n \tfor (int i = 0; i < a; i++) {\n \tif (i == 0) {\n b = sc.nextBigDecimal();\n } else {\n c = sc.nextBigDecimal();\n \tif (b.compareTo(new BigDecimal(\"1000000000000000000\")) <= 0) {\n b = b.multiply(c);\n }\n \tif (b.compareTo(new BigDecimal(\"0\")) == 0\n || c.compareTo(new BigDecimal(\"0\")) == 0) {\n System.out.println(0);\n return;\n }\n }\n }\n\n \tif (b.compareTo(new BigDecimal(\"1000000000000000000\")) > 0) {\n System.out.println(-1);\n } else {\n System.out.println(b);\n }\n\t}\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 a = sc.nextInt();
BigDecimal b = new BigDecimal("0");
BigDecimal c = new BigDecimal("0");
for (int i = 0; i < a; i++) {
if (i == 0) {
b = sc.nextBigDecimal();
} else {
c = sc.nextBigDecimal();
if (b.compareTo(new BigDecimal("1000000000000000000")) <= 0) {
b = b.multiply(c);
}
if (b.compareTo(new BigDecimal("0")) == 0
|| c.compareTo(new BigDecimal("0")) == 0) {
System.out.println(0);
return;
}
}
}
if (b.compareTo(new BigDecimal("1000000000000000000")) > 0) {
System.out.println(-1);
} else {
System.out.println(b);
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
41,
13,
4,
18,
13,
41,
13,
17,
0,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
17,
30,
3,
30,
41,
13,
4,
18,
13,
14,
2,
2,
13,
13,
13,
30,
0,
13,
13,
30,
0,
13,
17,
4,
18,
18,
13,
13,
8,
13,
13,
8,
2,
13,
17,
17,
40,
17,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
86,
5
],
[
86,
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
],
[
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
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
46,
47
],
[
42,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
52,
53
],
[
48,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
55,
59
],
[
54,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
54,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
8,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
68,
73
],
[
73,
74
],
[
73,
75
],
[
73,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
76,
81
],
[
81,
82
],
[
6,
83
],
[
83,
84
],
[
0,
85
],
[
85,
86
],
[
85,
87
]
] |
[
"import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc=new Scanner(System.in);\n boolean b=true;\n int n=sc.nextInt();\n long l=1000000000;\n l*=l;\n long po=1;\n for(int i=0;i<n;i++){\n if(po==0){\n break;\n }else{\n long a=sc.nextLong();\n if((l/po>=a)){\n po*=a;\n }else{\n b=false;\n }\n }\n }\n System.out.println(b?po:(po==0)?0:-1);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc=new Scanner(System.in);\n boolean b=true;\n int n=sc.nextInt();\n long l=1000000000;\n l*=l;\n long po=1;\n for(int i=0;i<n;i++){\n if(po==0){\n break;\n }else{\n long a=sc.nextLong();\n if((l/po>=a)){\n po*=a;\n }else{\n b=false;\n }\n }\n }\n System.out.println(b?po:(po==0)?0:-1);\n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc=new Scanner(System.in);\n boolean b=true;\n int n=sc.nextInt();\n long l=1000000000;\n l*=l;\n long po=1;\n for(int i=0;i<n;i++){\n if(po==0){\n break;\n }else{\n long a=sc.nextLong();\n if((l/po>=a)){\n po*=a;\n }else{\n b=false;\n }\n }\n }\n System.out.println(b?po:(po==0)?0:-1);\n }",
"main",
"{\n // Your code here!\n Scanner sc=new Scanner(System.in);\n boolean b=true;\n int n=sc.nextInt();\n long l=1000000000;\n l*=l;\n long po=1;\n for(int i=0;i<n;i++){\n if(po==0){\n break;\n }else{\n long a=sc.nextLong();\n if((l/po>=a)){\n po*=a;\n }else{\n b=false;\n }\n }\n }\n System.out.println(b?po:(po==0)?0:-1);\n }",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"boolean b=true;",
"b",
"true",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long l=1000000000;",
"l",
"1000000000",
"l*=l",
"l",
"l",
"long po=1;",
"po",
"1",
"for(int i=0;i<n;i++){\n if(po==0){\n break;\n }else{\n long a=sc.nextLong();\n if((l/po>=a)){\n po*=a;\n }else{\n b=false;\n }\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(po==0){\n break;\n }else{\n long a=sc.nextLong();\n if((l/po>=a)){\n po*=a;\n }else{\n b=false;\n }\n }\n }",
"{\n if(po==0){\n break;\n }else{\n long a=sc.nextLong();\n if((l/po>=a)){\n po*=a;\n }else{\n b=false;\n }\n }\n }",
"if(po==0){\n break;\n }else{\n long a=sc.nextLong();\n if((l/po>=a)){\n po*=a;\n }else{\n b=false;\n }\n }",
"po==0",
"po",
"0",
"{\n break;\n }",
"break;",
"{\n long a=sc.nextLong();\n if((l/po>=a)){\n po*=a;\n }else{\n b=false;\n }\n }",
"long a=sc.nextLong();",
"a",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if((l/po>=a)){\n po*=a;\n }else{\n b=false;\n }",
"(l/po>=a)",
"l/po",
"l",
"po",
"a",
"{\n po*=a;\n }",
"po*=a",
"po",
"a",
"{\n b=false;\n }",
"b=false",
"b",
"false",
"System.out.println(b?po:(po==0)?0:-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"b?po:(po==0)?0:-1",
"b",
"po",
"(po==0)?0:-1",
"(po==0)",
"po",
"0",
"0",
"-1",
"1",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc=new Scanner(System.in);\n boolean b=true;\n int n=sc.nextInt();\n long l=1000000000;\n l*=l;\n long po=1;\n for(int i=0;i<n;i++){\n if(po==0){\n break;\n }else{\n long a=sc.nextLong();\n if((l/po>=a)){\n po*=a;\n }else{\n b=false;\n }\n }\n }\n System.out.println(b?po:(po==0)?0:-1);\n }\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc=new Scanner(System.in);\n boolean b=true;\n int n=sc.nextInt();\n long l=1000000000;\n l*=l;\n long po=1;\n for(int i=0;i<n;i++){\n if(po==0){\n break;\n }else{\n long a=sc.nextLong();\n if((l/po>=a)){\n po*=a;\n }else{\n b=false;\n }\n }\n }\n System.out.println(b?po:(po==0)?0:-1);\n }\n}",
"Main"
] |
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
// Your code here!
Scanner sc=new Scanner(System.in);
boolean b=true;
int n=sc.nextInt();
long l=1000000000;
l*=l;
long po=1;
for(int i=0;i<n;i++){
if(po==0){
break;
}else{
long a=sc.nextLong();
if((l/po>=a)){
po*=a;
}else{
b=false;
}
}
}
System.out.println(b?po:(po==0)?0:-1);
}
}
|
[
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,
4,
18,
13,
17,
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,
14,
2,
13,
2,
13,
18,
13,
13,
30,
0,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
17,
29,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
112,
5
],
[
112,
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
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
25,
28
],
[
25,
29
],
[
8,
30
],
[
30,
31
],
[
30,
32
],
[
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
],
[
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
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
81,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
95,
102
],
[
8,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
6,
109
],
[
109,
110
],
[
0,
111
],
[
111,
112
],
[
111,
113
]
] |
[
"import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n sc.nextLine();\n long multi = 1;\n long max = (long)Math.pow(10.0, 18.0);\n long[] nums = new long[num];\n \n for(int i = 0; i < num; i++){\n nums[i] = sc.nextLong();\n if(nums[i] == 0){\n \tSystem.out.println(0);\n return;\n }\n }\n for(int j = 0; j < num; j++){\n if(multi <= max / nums[j]){\n multi *= nums[j];\n }else{\n \tSystem.out.println(\"-1\");\n return;\n }\n }\n \n System.out.println(multi);\n \n }\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 num = sc.nextInt();\n sc.nextLine();\n long multi = 1;\n long max = (long)Math.pow(10.0, 18.0);\n long[] nums = new long[num];\n \n for(int i = 0; i < num; i++){\n nums[i] = sc.nextLong();\n if(nums[i] == 0){\n \tSystem.out.println(0);\n return;\n }\n }\n for(int j = 0; j < num; j++){\n if(multi <= max / nums[j]){\n multi *= nums[j];\n }else{\n \tSystem.out.println(\"-1\");\n return;\n }\n }\n \n System.out.println(multi);\n \n }\n\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n sc.nextLine();\n long multi = 1;\n long max = (long)Math.pow(10.0, 18.0);\n long[] nums = new long[num];\n \n for(int i = 0; i < num; i++){\n nums[i] = sc.nextLong();\n if(nums[i] == 0){\n \tSystem.out.println(0);\n return;\n }\n }\n for(int j = 0; j < num; j++){\n if(multi <= max / nums[j]){\n multi *= nums[j];\n }else{\n \tSystem.out.println(\"-1\");\n return;\n }\n }\n \n System.out.println(multi);\n \n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n sc.nextLine();\n long multi = 1;\n long max = (long)Math.pow(10.0, 18.0);\n long[] nums = new long[num];\n \n for(int i = 0; i < num; i++){\n nums[i] = sc.nextLong();\n if(nums[i] == 0){\n \tSystem.out.println(0);\n return;\n }\n }\n for(int j = 0; j < num; j++){\n if(multi <= max / nums[j]){\n multi *= nums[j];\n }else{\n \tSystem.out.println(\"-1\");\n return;\n }\n }\n \n System.out.println(multi);\n \n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int num = sc.nextInt();",
"num",
"sc.nextInt()",
"sc.nextInt",
"sc",
"sc.nextLine()",
"sc.nextLine",
"sc",
"long multi = 1;",
"multi",
"1",
"long max = (long)Math.pow(10.0, 18.0);",
"max",
"(long)Math.pow(10.0, 18.0)",
"Math.pow",
"Math",
"10.0",
"18.0",
"long[] nums = new long[num];",
"nums",
"new long[num]",
"num",
"for(int i = 0; i < num; i++){\n nums[i] = sc.nextLong();\n if(nums[i] == 0){\n \tSystem.out.println(0);\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num",
"i",
"num",
"i++",
"i++",
"i",
"{\n nums[i] = sc.nextLong();\n if(nums[i] == 0){\n \tSystem.out.println(0);\n return;\n }\n }",
"{\n nums[i] = sc.nextLong();\n if(nums[i] == 0){\n \tSystem.out.println(0);\n return;\n }\n }",
"nums[i] = sc.nextLong()",
"nums[i]",
"nums",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(nums[i] == 0){\n \tSystem.out.println(0);\n return;\n }",
"nums[i] == 0",
"nums[i]",
"nums",
"i",
"0",
"{\n \tSystem.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"for(int j = 0; j < num; j++){\n if(multi <= max / nums[j]){\n multi *= nums[j];\n }else{\n \tSystem.out.println(\"-1\");\n return;\n }\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < num",
"j",
"num",
"j++",
"j++",
"j",
"{\n if(multi <= max / nums[j]){\n multi *= nums[j];\n }else{\n \tSystem.out.println(\"-1\");\n return;\n }\n }",
"{\n if(multi <= max / nums[j]){\n multi *= nums[j];\n }else{\n \tSystem.out.println(\"-1\");\n return;\n }\n }",
"if(multi <= max / nums[j]){\n multi *= nums[j];\n }else{\n \tSystem.out.println(\"-1\");\n return;\n }",
"multi <= max / nums[j]",
"multi",
"max / nums[j]",
"max",
"nums[j]",
"nums",
"j",
"{\n multi *= nums[j];\n }",
"multi *= nums[j]",
"multi",
"nums[j]",
"nums",
"j",
"{\n \tSystem.out.println(\"-1\");\n return;\n }",
"System.out.println(\"-1\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"return;",
"System.out.println(multi)",
"System.out.println",
"System.out",
"System",
"System.out",
"multi",
"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 sc.nextLine();\n long multi = 1;\n long max = (long)Math.pow(10.0, 18.0);\n long[] nums = new long[num];\n \n for(int i = 0; i < num; i++){\n nums[i] = sc.nextLong();\n if(nums[i] == 0){\n \tSystem.out.println(0);\n return;\n }\n }\n for(int j = 0; j < num; j++){\n if(multi <= max / nums[j]){\n multi *= nums[j];\n }else{\n \tSystem.out.println(\"-1\");\n return;\n }\n }\n \n System.out.println(multi);\n \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 sc.nextLine();\n long multi = 1;\n long max = (long)Math.pow(10.0, 18.0);\n long[] nums = new long[num];\n \n for(int i = 0; i < num; i++){\n nums[i] = sc.nextLong();\n if(nums[i] == 0){\n \tSystem.out.println(0);\n return;\n }\n }\n for(int j = 0; j < num; j++){\n if(multi <= max / nums[j]){\n multi *= nums[j];\n }else{\n \tSystem.out.println(\"-1\");\n return;\n }\n }\n \n System.out.println(multi);\n \n }\n\n}",
"Main"
] |
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
sc.nextLine();
long multi = 1;
long max = (long)Math.pow(10.0, 18.0);
long[] nums = new long[num];
for(int i = 0; i < num; i++){
nums[i] = sc.nextLong();
if(nums[i] == 0){
System.out.println(0);
return;
}
}
for(int j = 0; j < num; j++){
if(multi <= max / nums[j]){
multi *= nums[j];
}else{
System.out.println("-1");
return;
}
}
System.out.println(multi);
}
}
|
[
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,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
17,
13,
0,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
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
],
[
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
],
[
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
],
[
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
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
71,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
85,
90
],
[
90,
91
],
[
84,
92
],
[
8,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
102,
103
],
[
93,
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
]
] |
[
"\nimport java.util.Scanner;\n\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\t\tScanner scan = new java.util.Scanner(System.in);\n\n\t\tint n = scan.nextInt();\n\t\tlong[] a = new long[n];\n\n\n\t\tfor(int i=0;i<n;i++) {\n\n\t\t\t a[i] = scan.nextLong();\n\t\t\t if(a[i]==0) {\n\t\t\t\t System.out.println(0);\n\t\t\t\t return;\n\t\t\t }\n\t\t}\n\nlong c =1;\nfor(int i=0;i<n;i++) {\n\tif(a[i] <= 1000000000000000000L / c)\n\t\tc *= a[i];\n\telse {\n\t\tSystem.out.println(-1);\n\t\treturn;\n\t}\n}\n\nif(c > 1000000000000000000L)\n\t\t\tSystem.out.println(-1);\nelse\n\tSystem.out.println(c);\n\n\tscan.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\t\t// TODO 自動生成されたメソッド・スタブ\n\n\t\tScanner scan = new java.util.Scanner(System.in);\n\n\t\tint n = scan.nextInt();\n\t\tlong[] a = new long[n];\n\n\n\t\tfor(int i=0;i<n;i++) {\n\n\t\t\t a[i] = scan.nextLong();\n\t\t\t if(a[i]==0) {\n\t\t\t\t System.out.println(0);\n\t\t\t\t return;\n\t\t\t }\n\t\t}\n\nlong c =1;\nfor(int i=0;i<n;i++) {\n\tif(a[i] <= 1000000000000000000L / c)\n\t\tc *= a[i];\n\telse {\n\t\tSystem.out.println(-1);\n\t\treturn;\n\t}\n}\n\nif(c > 1000000000000000000L)\n\t\t\tSystem.out.println(-1);\nelse\n\tSystem.out.println(c);\n\n\tscan.close();\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\t\tScanner scan = new java.util.Scanner(System.in);\n\n\t\tint n = scan.nextInt();\n\t\tlong[] a = new long[n];\n\n\n\t\tfor(int i=0;i<n;i++) {\n\n\t\t\t a[i] = scan.nextLong();\n\t\t\t if(a[i]==0) {\n\t\t\t\t System.out.println(0);\n\t\t\t\t return;\n\t\t\t }\n\t\t}\n\nlong c =1;\nfor(int i=0;i<n;i++) {\n\tif(a[i] <= 1000000000000000000L / c)\n\t\tc *= a[i];\n\telse {\n\t\tSystem.out.println(-1);\n\t\treturn;\n\t}\n}\n\nif(c > 1000000000000000000L)\n\t\t\tSystem.out.println(-1);\nelse\n\tSystem.out.println(c);\n\n\tscan.close();\n\n\t}",
"main",
"{\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\t\tScanner scan = new java.util.Scanner(System.in);\n\n\t\tint n = scan.nextInt();\n\t\tlong[] a = new long[n];\n\n\n\t\tfor(int i=0;i<n;i++) {\n\n\t\t\t a[i] = scan.nextLong();\n\t\t\t if(a[i]==0) {\n\t\t\t\t System.out.println(0);\n\t\t\t\t return;\n\t\t\t }\n\t\t}\n\nlong c =1;\nfor(int i=0;i<n;i++) {\n\tif(a[i] <= 1000000000000000000L / c)\n\t\tc *= a[i];\n\telse {\n\t\tSystem.out.println(-1);\n\t\treturn;\n\t}\n}\n\nif(c > 1000000000000000000L)\n\t\t\tSystem.out.println(-1);\nelse\n\tSystem.out.println(c);\n\n\tscan.close();\n\n\t}",
"Scanner scan = new java.util.Scanner(System.in);",
"scan",
"new java.util.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\n\t\t\t a[i] = scan.nextLong();\n\t\t\t if(a[i]==0) {\n\t\t\t\t System.out.println(0);\n\t\t\t\t return;\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\t a[i] = scan.nextLong();\n\t\t\t if(a[i]==0) {\n\t\t\t\t System.out.println(0);\n\t\t\t\t return;\n\t\t\t }\n\t\t}",
"{\n\n\t\t\t a[i] = scan.nextLong();\n\t\t\t if(a[i]==0) {\n\t\t\t\t System.out.println(0);\n\t\t\t\t return;\n\t\t\t }\n\t\t}",
"a[i] = scan.nextLong()",
"a[i]",
"a",
"i",
"scan.nextLong()",
"scan.nextLong",
"scan",
"if(a[i]==0) {\n\t\t\t\t System.out.println(0);\n\t\t\t\t return;\n\t\t\t }",
"a[i]==0",
"a[i]",
"a",
"i",
"0",
"{\n\t\t\t\t System.out.println(0);\n\t\t\t\t return;\n\t\t\t }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"long c =1;",
"c",
"1",
"for(int i=0;i<n;i++) {\n\tif(a[i] <= 1000000000000000000L / c)\n\t\tc *= a[i];\n\telse {\n\t\tSystem.out.println(-1);\n\t\treturn;\n\t}\n}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\tif(a[i] <= 1000000000000000000L / c)\n\t\tc *= a[i];\n\telse {\n\t\tSystem.out.println(-1);\n\t\treturn;\n\t}\n}",
"{\n\tif(a[i] <= 1000000000000000000L / c)\n\t\tc *= a[i];\n\telse {\n\t\tSystem.out.println(-1);\n\t\treturn;\n\t}\n}",
"if(a[i] <= 1000000000000000000L / c)\n\t\tc *= a[i];\n\telse {\n\t\tSystem.out.println(-1);\n\t\treturn;\n\t}",
"a[i] <= 1000000000000000000L / c",
"a[i]",
"a",
"i",
"1000000000000000000L / c",
"1000000000000000000L",
"c",
"c *= a[i]",
"c",
"a[i]",
"a",
"i",
"{\n\t\tSystem.out.println(-1);\n\t\treturn;\n\t}",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"if(c > 1000000000000000000L)\n\t\t\tSystem.out.println(-1);\nelse\n\tSystem.out.println(c);",
"c > 1000000000000000000L",
"c",
"1000000000000000000L",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"System.out.println(c)",
"System.out.println",
"System.out",
"System",
"System.out",
"c",
"scan.close()",
"scan.close",
"scan",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\t\tScanner scan = new java.util.Scanner(System.in);\n\n\t\tint n = scan.nextInt();\n\t\tlong[] a = new long[n];\n\n\n\t\tfor(int i=0;i<n;i++) {\n\n\t\t\t a[i] = scan.nextLong();\n\t\t\t if(a[i]==0) {\n\t\t\t\t System.out.println(0);\n\t\t\t\t return;\n\t\t\t }\n\t\t}\n\nlong c =1;\nfor(int i=0;i<n;i++) {\n\tif(a[i] <= 1000000000000000000L / c)\n\t\tc *= a[i];\n\telse {\n\t\tSystem.out.println(-1);\n\t\treturn;\n\t}\n}\n\nif(c > 1000000000000000000L)\n\t\t\tSystem.out.println(-1);\nelse\n\tSystem.out.println(c);\n\n\tscan.close();\n\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\t\tScanner scan = new java.util.Scanner(System.in);\n\n\t\tint n = scan.nextInt();\n\t\tlong[] a = new long[n];\n\n\n\t\tfor(int i=0;i<n;i++) {\n\n\t\t\t a[i] = scan.nextLong();\n\t\t\t if(a[i]==0) {\n\t\t\t\t System.out.println(0);\n\t\t\t\t return;\n\t\t\t }\n\t\t}\n\nlong c =1;\nfor(int i=0;i<n;i++) {\n\tif(a[i] <= 1000000000000000000L / c)\n\t\tc *= a[i];\n\telse {\n\t\tSystem.out.println(-1);\n\t\treturn;\n\t}\n}\n\nif(c > 1000000000000000000L)\n\t\t\tSystem.out.println(-1);\nelse\n\tSystem.out.println(c);\n\n\tscan.close();\n\n\t}\n\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner scan = new java.util.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;
}
}
long c =1;
for(int i=0;i<n;i++) {
if(a[i] <= 1000000000000000000L / c)
c *= a[i];
else {
System.out.println(-1);
return;
}
}
if(c > 1000000000000000000L)
System.out.println(-1);
else
System.out.println(c);
scan.close();
}
}
|
[
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,
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,
0,
13,
17,
3,
41,
13,
2,
13,
13,
14,
2,
13,
13,
30,
0,
13,
17,
30,
0,
13,
13,
4,
18,
18,
13,
13,
8,
13,
40,
17,
13,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
89,
5
],
[
89,
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,
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
],
[
48,
52
],
[
52,
53
],
[
52,
54
],
[
48,
55
],
[
38,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
58,
60
],
[
38,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
61,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
8,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
78,
82
],
[
8,
83
],
[
83,
84
],
[
84,
85
],
[
6,
86
],
[
86,
87
],
[
0,
88
],
[
88,
89
],
[
88,
90
]
] |
[
"import java.util.Scanner;\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 max = 1000000000000000000L;\n long ans = 1;\n boolean of = false;\n for(int i=0; i<N; i++) {\n long A = sc.nextLong();\n if(A==0) {\n ans = 0;\n of = false;\n break;\n }\n long Amax = max/ans;\n if(A>Amax) {\n of = true;\n } else {\n ans *= A;\n }\n }\n System.out.println(of? -1 : ans);\n\n sc.close();\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\n int N = sc.nextInt();\n long max = 1000000000000000000L;\n long ans = 1;\n boolean of = false;\n for(int i=0; i<N; i++) {\n long A = sc.nextLong();\n if(A==0) {\n ans = 0;\n of = false;\n break;\n }\n long Amax = max/ans;\n if(A>Amax) {\n of = true;\n } else {\n ans *= A;\n }\n }\n System.out.println(of? -1 : ans);\n\n sc.close();\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int N = sc.nextInt();\n long max = 1000000000000000000L;\n long ans = 1;\n boolean of = false;\n for(int i=0; i<N; i++) {\n long A = sc.nextLong();\n if(A==0) {\n ans = 0;\n of = false;\n break;\n }\n long Amax = max/ans;\n if(A>Amax) {\n of = true;\n } else {\n ans *= A;\n }\n }\n System.out.println(of? -1 : ans);\n\n sc.close();\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\n int N = sc.nextInt();\n long max = 1000000000000000000L;\n long ans = 1;\n boolean of = false;\n for(int i=0; i<N; i++) {\n long A = sc.nextLong();\n if(A==0) {\n ans = 0;\n of = false;\n break;\n }\n long Amax = max/ans;\n if(A>Amax) {\n of = true;\n } else {\n ans *= A;\n }\n }\n System.out.println(of? -1 : ans);\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 max = 1000000000000000000L;",
"max",
"1000000000000000000L",
"long ans = 1;",
"ans",
"1",
"boolean of = false;",
"of",
"false",
"for(int i=0; i<N; i++) {\n long A = sc.nextLong();\n if(A==0) {\n ans = 0;\n of = false;\n break;\n }\n long Amax = max/ans;\n if(A>Amax) {\n of = true;\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 = sc.nextLong();\n if(A==0) {\n ans = 0;\n of = false;\n break;\n }\n long Amax = max/ans;\n if(A>Amax) {\n of = true;\n } else {\n ans *= A;\n }\n }",
"{\n long A = sc.nextLong();\n if(A==0) {\n ans = 0;\n of = false;\n break;\n }\n long Amax = max/ans;\n if(A>Amax) {\n of = true;\n } else {\n ans *= A;\n }\n }",
"long A = sc.nextLong();",
"A",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(A==0) {\n ans = 0;\n of = false;\n break;\n }",
"A==0",
"A",
"0",
"{\n ans = 0;\n of = false;\n break;\n }",
"ans = 0",
"ans",
"0",
"of = false",
"of",
"false",
"break;",
"long Amax = max/ans;",
"Amax",
"max/ans",
"max",
"ans",
"if(A>Amax) {\n of = true;\n } else {\n ans *= A;\n }",
"A>Amax",
"A",
"Amax",
"{\n of = true;\n }",
"of = true",
"of",
"true",
"{\n ans *= A;\n }",
"ans *= A",
"ans",
"A",
"System.out.println(of? -1 : ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"of? -1 : ans",
"of",
"-1",
"1",
"ans",
"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\n int N = sc.nextInt();\n long max = 1000000000000000000L;\n long ans = 1;\n boolean of = false;\n for(int i=0; i<N; i++) {\n long A = sc.nextLong();\n if(A==0) {\n ans = 0;\n of = false;\n break;\n }\n long Amax = max/ans;\n if(A>Amax) {\n of = true;\n } else {\n ans *= A;\n }\n }\n System.out.println(of? -1 : ans);\n\n sc.close();\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 max = 1000000000000000000L;\n long ans = 1;\n boolean of = false;\n for(int i=0; i<N; i++) {\n long A = sc.nextLong();\n if(A==0) {\n ans = 0;\n of = false;\n break;\n }\n long Amax = max/ans;\n if(A>Amax) {\n of = true;\n } else {\n ans *= A;\n }\n }\n System.out.println(of? -1 : ans);\n\n sc.close();\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 max = 1000000000000000000L;
long ans = 1;
boolean of = false;
for(int i=0; i<N; i++) {
long A = sc.nextLong();
if(A==0) {
ans = 0;
of = false;
break;
}
long Amax = max/ans;
if(A>Amax) {
of = true;
} else {
ans *= A;
}
}
System.out.println(of? -1 : ans);
sc.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,
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,
18,
13,
13,
2,
17,
13,
30,
0,
13,
2,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
30,
4,
18,
18,
13,
13,
40,
17,
29,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
120,
5
],
[
120,
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
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
71,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
88,
93
],
[
93,
94
],
[
87,
95
],
[
8,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
100,
107
],
[
96,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
109,
114
],
[
114,
115
],
[
108,
116
],
[
6,
117
],
[
117,
118
],
[
0,
119
],
[
119,
120
],
[
119,
121
]
] |
[
"import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n int N=sc.nextInt();\n long[] a=new long[N];\n long x=1;\n for(int i=0;i<N;i++){\n \ta[i]=sc.nextLong();\n if(a[i]==0){\n \tSystem.out.println(0);\n return;\n }\n }\n for(int i=0;i<N;i++){\n \tif(a[i]<=1000000000000000000L/x){\n \tx=x*a[i];\n }else{\n \tSystem.out.println(-1);\n return;\n }\n }\n if(x<=1000000000000000000L){\n \tSystem.out.println(x);\n return;\n }else{\n \tSystem.out.println(-1);\n return;\n }\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 int N=sc.nextInt();\n long[] a=new long[N];\n long x=1;\n for(int i=0;i<N;i++){\n \ta[i]=sc.nextLong();\n if(a[i]==0){\n \tSystem.out.println(0);\n return;\n }\n }\n for(int i=0;i<N;i++){\n \tif(a[i]<=1000000000000000000L/x){\n \tx=x*a[i];\n }else{\n \tSystem.out.println(-1);\n return;\n }\n }\n if(x<=1000000000000000000L){\n \tSystem.out.println(x);\n return;\n }else{\n \tSystem.out.println(-1);\n return;\n }\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n int N=sc.nextInt();\n long[] a=new long[N];\n long x=1;\n for(int i=0;i<N;i++){\n \ta[i]=sc.nextLong();\n if(a[i]==0){\n \tSystem.out.println(0);\n return;\n }\n }\n for(int i=0;i<N;i++){\n \tif(a[i]<=1000000000000000000L/x){\n \tx=x*a[i];\n }else{\n \tSystem.out.println(-1);\n return;\n }\n }\n if(x<=1000000000000000000L){\n \tSystem.out.println(x);\n return;\n }else{\n \tSystem.out.println(-1);\n return;\n }\n\t}",
"main",
"{\n\t\tScanner sc=new Scanner(System.in);\n int N=sc.nextInt();\n long[] a=new long[N];\n long x=1;\n for(int i=0;i<N;i++){\n \ta[i]=sc.nextLong();\n if(a[i]==0){\n \tSystem.out.println(0);\n return;\n }\n }\n for(int i=0;i<N;i++){\n \tif(a[i]<=1000000000000000000L/x){\n \tx=x*a[i];\n }else{\n \tSystem.out.println(-1);\n return;\n }\n }\n if(x<=1000000000000000000L){\n \tSystem.out.println(x);\n return;\n }else{\n \tSystem.out.println(-1);\n return;\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 x=1;",
"x",
"1",
"for(int i=0;i<N;i++){\n \ta[i]=sc.nextLong();\n if(a[i]==0){\n \tSystem.out.println(0);\n return;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n \ta[i]=sc.nextLong();\n if(a[i]==0){\n \tSystem.out.println(0);\n return;\n }\n }",
"{\n \ta[i]=sc.nextLong();\n if(a[i]==0){\n \tSystem.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 \tSystem.out.println(0);\n return;\n }",
"a[i]==0",
"a[i]",
"a",
"i",
"0",
"{\n \tSystem.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 \tif(a[i]<=1000000000000000000L/x){\n \tx=x*a[i];\n }else{\n \tSystem.out.println(-1);\n return;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n \tif(a[i]<=1000000000000000000L/x){\n \tx=x*a[i];\n }else{\n \tSystem.out.println(-1);\n return;\n }\n }",
"{\n \tif(a[i]<=1000000000000000000L/x){\n \tx=x*a[i];\n }else{\n \tSystem.out.println(-1);\n return;\n }\n }",
"if(a[i]<=1000000000000000000L/x){\n \tx=x*a[i];\n }else{\n \tSystem.out.println(-1);\n return;\n }",
"a[i]<=1000000000000000000L/x",
"a[i]",
"a",
"i",
"1000000000000000000L/x",
"1000000000000000000L",
"x",
"{\n \tx=x*a[i];\n }",
"x=x*a[i]",
"x",
"x*a[i]",
"x",
"a[i]",
"a",
"i",
"{\n \tSystem.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"if(x<=1000000000000000000L){\n \tSystem.out.println(x);\n return;\n }else{\n \tSystem.out.println(-1);\n return;\n }",
"x<=1000000000000000000L",
"x",
"1000000000000000000L",
"{\n \tSystem.out.println(x);\n return;\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"return;",
"{\n \tSystem.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n int N=sc.nextInt();\n long[] a=new long[N];\n long x=1;\n for(int i=0;i<N;i++){\n \ta[i]=sc.nextLong();\n if(a[i]==0){\n \tSystem.out.println(0);\n return;\n }\n }\n for(int i=0;i<N;i++){\n \tif(a[i]<=1000000000000000000L/x){\n \tx=x*a[i];\n }else{\n \tSystem.out.println(-1);\n return;\n }\n }\n if(x<=1000000000000000000L){\n \tSystem.out.println(x);\n return;\n }else{\n \tSystem.out.println(-1);\n return;\n }\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n int N=sc.nextInt();\n long[] a=new long[N];\n long x=1;\n for(int i=0;i<N;i++){\n \ta[i]=sc.nextLong();\n if(a[i]==0){\n \tSystem.out.println(0);\n return;\n }\n }\n for(int i=0;i<N;i++){\n \tif(a[i]<=1000000000000000000L/x){\n \tx=x*a[i];\n }else{\n \tSystem.out.println(-1);\n return;\n }\n }\n if(x<=1000000000000000000L){\n \tSystem.out.println(x);\n return;\n }else{\n \tSystem.out.println(-1);\n return;\n }\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 x=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(a[i]<=1000000000000000000L/x){
x=x*a[i];
}else{
System.out.println(-1);
return;
}
}
if(x<=1000000000000000000L){
System.out.println(x);
return;
}else{
System.out.println(-1);
return;
}
}
}
|
[
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,
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,
4,
18,
13,
14,
2,
18,
13,
13,
17,
30,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
13,
30,
0,
13,
4,
18,
13,
17,
3,
14,
2,
4,
18,
4,
18,
4,
18,
13,
4,
18,
13,
18,
13,
13,
4,
18,
13,
13,
17,
30,
0,
13,
4,
18,
13,
40,
17,
3,
30,
0,
13,
4,
18,
13,
4,
18,
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
],
[
141,
8
],
[
141,
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
],
[
11,
28
],
[
28,
29
],
[
28,
30
],
[
11,
32
],
[
32,
33
],
[
32,
34
],
[
11,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
35,
40
],
[
40,
41
],
[
40,
42
],
[
35,
43
],
[
43,
44
],
[
44,
45
],
[
35,
46
],
[
47,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
52,
53
],
[
53,
54
],
[
52,
55
],
[
55,
56
],
[
56,
57
],
[
47,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
58,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
11,
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
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
83,
90
],
[
81,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
100,
101
],
[
101,
102
],
[
100,
103
],
[
103,
104
],
[
103,
105
],
[
95,
106
],
[
106,
107
],
[
107,
108
],
[
106,
109
],
[
92,
110
],
[
91,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
115,
116
],
[
114,
117
],
[
117,
118
],
[
111,
119
],
[
91,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
124,
125
],
[
123,
126
],
[
126,
127
],
[
127,
128
],
[
126,
129
],
[
129,
130
],
[
129,
131
],
[
11,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
132,
137
],
[
9,
138
],
[
138,
139
],
[
0,
140
],
[
140,
141
],
[
140,
142
]
] |
[
"import java.math.BigInteger;\nimport java.util.Scanner;\n \npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n int x = sc.nextInt();\n BigInteger aaa = BigInteger.ONE;\n long check = 1000000000000000000L;\n long[] y = new long[x];\n boolean flag = false;\n for (int i = 0; i < x; i++) {\n y[i] = Long.parseLong(sc.next());\n if (y[i] == 0) {\n flag = true;\n }\n }\n for (int i = 0; i < x; i++) {\n if (flag) {\n aaa = BigInteger.valueOf(0);\n break;\n } else if (aaa.multiply(BigInteger.valueOf(y[i])).subtract(BigInteger.valueOf(check)).signum() == 1) {\n aaa = BigInteger.valueOf(-1);\n break;\n } else {\n aaa = aaa.multiply(BigInteger.valueOf(y[i]));\n }\n }\n System.out.println(aaa);\n }\n}",
"import java.math.BigInteger;",
"BigInteger",
"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 \n int x = sc.nextInt();\n BigInteger aaa = BigInteger.ONE;\n long check = 1000000000000000000L;\n long[] y = new long[x];\n boolean flag = false;\n for (int i = 0; i < x; i++) {\n y[i] = Long.parseLong(sc.next());\n if (y[i] == 0) {\n flag = true;\n }\n }\n for (int i = 0; i < x; i++) {\n if (flag) {\n aaa = BigInteger.valueOf(0);\n break;\n } else if (aaa.multiply(BigInteger.valueOf(y[i])).subtract(BigInteger.valueOf(check)).signum() == 1) {\n aaa = BigInteger.valueOf(-1);\n break;\n } else {\n aaa = aaa.multiply(BigInteger.valueOf(y[i]));\n }\n }\n System.out.println(aaa);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n int x = sc.nextInt();\n BigInteger aaa = BigInteger.ONE;\n long check = 1000000000000000000L;\n long[] y = new long[x];\n boolean flag = false;\n for (int i = 0; i < x; i++) {\n y[i] = Long.parseLong(sc.next());\n if (y[i] == 0) {\n flag = true;\n }\n }\n for (int i = 0; i < x; i++) {\n if (flag) {\n aaa = BigInteger.valueOf(0);\n break;\n } else if (aaa.multiply(BigInteger.valueOf(y[i])).subtract(BigInteger.valueOf(check)).signum() == 1) {\n aaa = BigInteger.valueOf(-1);\n break;\n } else {\n aaa = aaa.multiply(BigInteger.valueOf(y[i]));\n }\n }\n System.out.println(aaa);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n \n int x = sc.nextInt();\n BigInteger aaa = BigInteger.ONE;\n long check = 1000000000000000000L;\n long[] y = new long[x];\n boolean flag = false;\n for (int i = 0; i < x; i++) {\n y[i] = Long.parseLong(sc.next());\n if (y[i] == 0) {\n flag = true;\n }\n }\n for (int i = 0; i < x; i++) {\n if (flag) {\n aaa = BigInteger.valueOf(0);\n break;\n } else if (aaa.multiply(BigInteger.valueOf(y[i])).subtract(BigInteger.valueOf(check)).signum() == 1) {\n aaa = BigInteger.valueOf(-1);\n break;\n } else {\n aaa = aaa.multiply(BigInteger.valueOf(y[i]));\n }\n }\n System.out.println(aaa);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BigInteger aaa = BigInteger.ONE;",
"aaa",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"long check = 1000000000000000000L;",
"check",
"1000000000000000000L",
"long[] y = new long[x];",
"y",
"new long[x]",
"x",
"boolean flag = false;",
"flag",
"false",
"for (int i = 0; i < x; i++) {\n y[i] = Long.parseLong(sc.next());\n if (y[i] == 0) {\n flag = true;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < x",
"i",
"x",
"i++",
"i++",
"i",
"{\n y[i] = Long.parseLong(sc.next());\n if (y[i] == 0) {\n flag = true;\n }\n }",
"{\n y[i] = Long.parseLong(sc.next());\n if (y[i] == 0) {\n flag = true;\n }\n }",
"y[i] = Long.parseLong(sc.next())",
"y[i]",
"y",
"i",
"Long.parseLong(sc.next())",
"Long.parseLong",
"Long",
"sc.next()",
"sc.next",
"sc",
"if (y[i] == 0) {\n flag = true;\n }",
"y[i] == 0",
"y[i]",
"y",
"i",
"0",
"{\n flag = true;\n }",
"flag = true",
"flag",
"true",
"for (int i = 0; i < x; i++) {\n if (flag) {\n aaa = BigInteger.valueOf(0);\n break;\n } else if (aaa.multiply(BigInteger.valueOf(y[i])).subtract(BigInteger.valueOf(check)).signum() == 1) {\n aaa = BigInteger.valueOf(-1);\n break;\n } else {\n aaa = aaa.multiply(BigInteger.valueOf(y[i]));\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < x",
"i",
"x",
"i++",
"i++",
"i",
"{\n if (flag) {\n aaa = BigInteger.valueOf(0);\n break;\n } else if (aaa.multiply(BigInteger.valueOf(y[i])).subtract(BigInteger.valueOf(check)).signum() == 1) {\n aaa = BigInteger.valueOf(-1);\n break;\n } else {\n aaa = aaa.multiply(BigInteger.valueOf(y[i]));\n }\n }",
"{\n if (flag) {\n aaa = BigInteger.valueOf(0);\n break;\n } else if (aaa.multiply(BigInteger.valueOf(y[i])).subtract(BigInteger.valueOf(check)).signum() == 1) {\n aaa = BigInteger.valueOf(-1);\n break;\n } else {\n aaa = aaa.multiply(BigInteger.valueOf(y[i]));\n }\n }",
"if (flag) {\n aaa = BigInteger.valueOf(0);\n break;\n } else if (aaa.multiply(BigInteger.valueOf(y[i])).subtract(BigInteger.valueOf(check)).signum() == 1) {\n aaa = BigInteger.valueOf(-1);\n break;\n } else {\n aaa = aaa.multiply(BigInteger.valueOf(y[i]));\n }",
"flag",
"{\n aaa = BigInteger.valueOf(0);\n break;\n }",
"aaa = BigInteger.valueOf(0)",
"aaa",
"BigInteger.valueOf(0)",
"BigInteger.valueOf",
"BigInteger",
"0",
"break;",
"if (aaa.multiply(BigInteger.valueOf(y[i])).subtract(BigInteger.valueOf(check)).signum() == 1) {\n aaa = BigInteger.valueOf(-1);\n break;\n } else {\n aaa = aaa.multiply(BigInteger.valueOf(y[i]));\n }",
"aaa.multiply(BigInteger.valueOf(y[i])).subtract(BigInteger.valueOf(check)).signum() == 1",
"aaa.multiply(BigInteger.valueOf(y[i])).subtract(BigInteger.valueOf(check)).signum()",
"aaa.multiply(BigInteger.valueOf(y[i])).subtract(BigInteger.valueOf(check)).signum",
"aaa.multiply(BigInteger.valueOf(y[i])).subtract(BigInteger.valueOf(check))",
"aaa.multiply(BigInteger.valueOf(y[i])).subtract",
"aaa.multiply(BigInteger.valueOf(y[i]))",
"aaa.multiply",
"aaa",
"BigInteger.valueOf(y[i])",
"BigInteger.valueOf",
"BigInteger",
"y[i]",
"y",
"i",
"BigInteger.valueOf(check)",
"BigInteger.valueOf",
"BigInteger",
"check",
"1",
"{\n aaa = BigInteger.valueOf(-1);\n break;\n }",
"aaa = BigInteger.valueOf(-1)",
"aaa",
"BigInteger.valueOf(-1)",
"BigInteger.valueOf",
"BigInteger",
"-1",
"1",
"break;",
"{\n aaa = aaa.multiply(BigInteger.valueOf(y[i]));\n }",
"aaa = aaa.multiply(BigInteger.valueOf(y[i]))",
"aaa",
"aaa.multiply(BigInteger.valueOf(y[i]))",
"aaa.multiply",
"aaa",
"BigInteger.valueOf(y[i])",
"BigInteger.valueOf",
"BigInteger",
"y[i]",
"y",
"i",
"System.out.println(aaa)",
"System.out.println",
"System.out",
"System",
"System.out",
"aaa",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n int x = sc.nextInt();\n BigInteger aaa = BigInteger.ONE;\n long check = 1000000000000000000L;\n long[] y = new long[x];\n boolean flag = false;\n for (int i = 0; i < x; i++) {\n y[i] = Long.parseLong(sc.next());\n if (y[i] == 0) {\n flag = true;\n }\n }\n for (int i = 0; i < x; i++) {\n if (flag) {\n aaa = BigInteger.valueOf(0);\n break;\n } else if (aaa.multiply(BigInteger.valueOf(y[i])).subtract(BigInteger.valueOf(check)).signum() == 1) {\n aaa = BigInteger.valueOf(-1);\n break;\n } else {\n aaa = aaa.multiply(BigInteger.valueOf(y[i]));\n }\n }\n System.out.println(aaa);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n int x = sc.nextInt();\n BigInteger aaa = BigInteger.ONE;\n long check = 1000000000000000000L;\n long[] y = new long[x];\n boolean flag = false;\n for (int i = 0; i < x; i++) {\n y[i] = Long.parseLong(sc.next());\n if (y[i] == 0) {\n flag = true;\n }\n }\n for (int i = 0; i < x; i++) {\n if (flag) {\n aaa = BigInteger.valueOf(0);\n break;\n } else if (aaa.multiply(BigInteger.valueOf(y[i])).subtract(BigInteger.valueOf(check)).signum() == 1) {\n aaa = BigInteger.valueOf(-1);\n break;\n } else {\n aaa = aaa.multiply(BigInteger.valueOf(y[i]));\n }\n }\n System.out.println(aaa);\n }\n}",
"Main"
] |
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
BigInteger aaa = BigInteger.ONE;
long check = 1000000000000000000L;
long[] y = new long[x];
boolean flag = false;
for (int i = 0; i < x; i++) {
y[i] = Long.parseLong(sc.next());
if (y[i] == 0) {
flag = true;
}
}
for (int i = 0; i < x; i++) {
if (flag) {
aaa = BigInteger.valueOf(0);
break;
} else if (aaa.multiply(BigInteger.valueOf(y[i])).subtract(BigInteger.valueOf(check)).signum() == 1) {
aaa = BigInteger.valueOf(-1);
break;
} else {
aaa = aaa.multiply(BigInteger.valueOf(y[i]));
}
}
System.out.println(aaa);
}
}
|
[
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,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
2,
13,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
4,
18,
18,
13,
13,
17,
30,
0,
13,
17,
0,
13,
20,
11,
1,
41,
13,
17,
2,
2,
13,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
20,
14,
2,
2,
4,
18,
4,
18,
13,
17,
40,
4,
18,
4,
18,
13,
17,
30,
0,
13,
17,
0,
13,
20,
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
],
[
121,
8
],
[
121,
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,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
35,
39
],
[
30,
40
],
[
40,
41
],
[
41,
42
],
[
30,
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
],
[
55,
57
],
[
53,
58
],
[
52,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
63,
64
],
[
63,
65
],
[
11,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
66,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
66,
76
],
[
76,
77
],
[
77,
78
],
[
66,
79
],
[
80,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
84,
85
],
[
83,
86
],
[
80,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
89,
95
],
[
88,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
97,
102
],
[
87,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
107,
109
],
[
11,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
115,
116
],
[
116,
117
],
[
9,
118
],
[
118,
119
],
[
0,
120
],
[
120,
121
],
[
120,
122
]
] |
[
"import java.math.BigInteger;\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 BigInteger ans = new BigInteger(\"1\");\n boolean b = true;\n String[] s = new String[n];\n for (int i=0;i<n&&b;i++){\n s[i]=sc.next();\n if (s[i].equals(\"0\")){\n b=false;\n ans=new BigInteger(\"0\");\n }\n }\n for (int i=0;i<n&&b;i++){\n ans=ans.multiply(new BigInteger(s[i]));\n if (ans.toString().length()>18&& !ans.toString().equals(\"1000000000000000000\")){\n b=false;\n ans = new BigInteger(\"-1\");\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 public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n=sc.nextInt();\n BigInteger ans = new BigInteger(\"1\");\n boolean b = true;\n String[] s = new String[n];\n for (int i=0;i<n&&b;i++){\n s[i]=sc.next();\n if (s[i].equals(\"0\")){\n b=false;\n ans=new BigInteger(\"0\");\n }\n }\n for (int i=0;i<n&&b;i++){\n ans=ans.multiply(new BigInteger(s[i]));\n if (ans.toString().length()>18&& !ans.toString().equals(\"1000000000000000000\")){\n b=false;\n ans = new BigInteger(\"-1\");\n }\n }\n System.out.println(ans.toString());\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n=sc.nextInt();\n BigInteger ans = new BigInteger(\"1\");\n boolean b = true;\n String[] s = new String[n];\n for (int i=0;i<n&&b;i++){\n s[i]=sc.next();\n if (s[i].equals(\"0\")){\n b=false;\n ans=new BigInteger(\"0\");\n }\n }\n for (int i=0;i<n&&b;i++){\n ans=ans.multiply(new BigInteger(s[i]));\n if (ans.toString().length()>18&& !ans.toString().equals(\"1000000000000000000\")){\n b=false;\n ans = new BigInteger(\"-1\");\n }\n }\n System.out.println(ans.toString());\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n=sc.nextInt();\n BigInteger ans = new BigInteger(\"1\");\n boolean b = true;\n String[] s = new String[n];\n for (int i=0;i<n&&b;i++){\n s[i]=sc.next();\n if (s[i].equals(\"0\")){\n b=false;\n ans=new BigInteger(\"0\");\n }\n }\n for (int i=0;i<n&&b;i++){\n ans=ans.multiply(new BigInteger(s[i]));\n if (ans.toString().length()>18&& !ans.toString().equals(\"1000000000000000000\")){\n b=false;\n ans = new BigInteger(\"-1\");\n }\n }\n System.out.println(ans.toString());\n }",
"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\")",
"boolean b = true;",
"b",
"true",
"String[] s = new String[n];",
"s",
"new String[n]",
"n",
"for (int i=0;i<n&&b;i++){\n s[i]=sc.next();\n if (s[i].equals(\"0\")){\n b=false;\n ans=new BigInteger(\"0\");\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n&&b",
"i<n",
"i",
"n",
"b",
"i++",
"i++",
"i",
"{\n s[i]=sc.next();\n if (s[i].equals(\"0\")){\n b=false;\n ans=new BigInteger(\"0\");\n }\n }",
"{\n s[i]=sc.next();\n if (s[i].equals(\"0\")){\n b=false;\n ans=new BigInteger(\"0\");\n }\n }",
"s[i]=sc.next()",
"s[i]",
"s",
"i",
"sc.next()",
"sc.next",
"sc",
"if (s[i].equals(\"0\")){\n b=false;\n ans=new BigInteger(\"0\");\n }",
"s[i].equals(\"0\")",
"s[i].equals",
"s[i]",
"s",
"i",
"\"0\"",
"{\n b=false;\n ans=new BigInteger(\"0\");\n }",
"b=false",
"b",
"false",
"ans=new BigInteger(\"0\")",
"ans",
"new BigInteger(\"0\")",
"for (int i=0;i<n&&b;i++){\n ans=ans.multiply(new BigInteger(s[i]));\n if (ans.toString().length()>18&& !ans.toString().equals(\"1000000000000000000\")){\n b=false;\n ans = new BigInteger(\"-1\");\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n&&b",
"i<n",
"i",
"n",
"b",
"i++",
"i++",
"i",
"{\n ans=ans.multiply(new BigInteger(s[i]));\n if (ans.toString().length()>18&& !ans.toString().equals(\"1000000000000000000\")){\n b=false;\n ans = new BigInteger(\"-1\");\n }\n }",
"{\n ans=ans.multiply(new BigInteger(s[i]));\n if (ans.toString().length()>18&& !ans.toString().equals(\"1000000000000000000\")){\n b=false;\n ans = new BigInteger(\"-1\");\n }\n }",
"ans=ans.multiply(new BigInteger(s[i]))",
"ans",
"ans.multiply(new BigInteger(s[i]))",
"ans.multiply",
"ans",
"new BigInteger(s[i])",
"if (ans.toString().length()>18&& !ans.toString().equals(\"1000000000000000000\")){\n b=false;\n ans = new BigInteger(\"-1\");\n }",
"ans.toString().length()>18&& !ans.toString().equals(\"1000000000000000000\")",
"ans.toString().length()>18",
"ans.toString().length()",
"ans.toString().length",
"ans.toString()",
"ans.toString",
"ans",
"18",
"!ans.toString().equals(\"1000000000000000000\")",
"ans.toString().equals(\"1000000000000000000\")",
"ans.toString().equals",
"ans.toString()",
"ans.toString",
"ans",
"\"1000000000000000000\"",
"{\n b=false;\n ans = new BigInteger(\"-1\");\n }",
"b=false",
"b",
"false",
"ans = new BigInteger(\"-1\")",
"ans",
"new BigInteger(\"-1\")",
"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 public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n=sc.nextInt();\n BigInteger ans = new BigInteger(\"1\");\n boolean b = true;\n String[] s = new String[n];\n for (int i=0;i<n&&b;i++){\n s[i]=sc.next();\n if (s[i].equals(\"0\")){\n b=false;\n ans=new BigInteger(\"0\");\n }\n }\n for (int i=0;i<n&&b;i++){\n ans=ans.multiply(new BigInteger(s[i]));\n if (ans.toString().length()>18&& !ans.toString().equals(\"1000000000000000000\")){\n b=false;\n ans = new BigInteger(\"-1\");\n }\n }\n System.out.println(ans.toString());\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 BigInteger ans = new BigInteger(\"1\");\n boolean b = true;\n String[] s = new String[n];\n for (int i=0;i<n&&b;i++){\n s[i]=sc.next();\n if (s[i].equals(\"0\")){\n b=false;\n ans=new BigInteger(\"0\");\n }\n }\n for (int i=0;i<n&&b;i++){\n ans=ans.multiply(new BigInteger(s[i]));\n if (ans.toString().length()>18&& !ans.toString().equals(\"1000000000000000000\")){\n b=false;\n ans = new BigInteger(\"-1\");\n }\n }\n System.out.println(ans.toString());\n }\n}",
"Main"
] |
import java.math.BigInteger;
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");
boolean b = true;
String[] s = new String[n];
for (int i=0;i<n&&b;i++){
s[i]=sc.next();
if (s[i].equals("0")){
b=false;
ans=new BigInteger("0");
}
}
for (int i=0;i<n&&b;i++){
ans=ans.multiply(new BigInteger(s[i]));
if (ans.toString().length()>18&& !ans.toString().equals("1000000000000000000")){
b=false;
ans = new BigInteger("-1");
}
}
System.out.println(ans.toString());
}
}
|
[
7,
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,
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,
41,
13,
17,
14,
40,
13,
30,
0,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
38,
5,
13,
30,
0,
13,
17,
3,
30,
0,
13,
4,
18,
13,
13,
18,
13,
13,
14,
2,
40,
13,
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
],
[
134,
5
],
[
134,
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
],
[
19,
20
],
[
20,
21
],
[
19,
22
],
[
19,
23
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
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
],
[
58,
60
],
[
8,
61
],
[
61,
62
],
[
61,
63
],
[
8,
64
],
[
64,
65
],
[
64,
66
],
[
8,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
73,
75
],
[
70,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
76,
86
],
[
86,
87
],
[
87,
88
],
[
76,
89
],
[
90,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
91,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
103,
104
],
[
102,
105
],
[
102,
106
],
[
106,
107
],
[
106,
108
],
[
8,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
110,
113
],
[
113,
114
],
[
113,
115
],
[
109,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
117,
122
],
[
122,
123
],
[
109,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
125,
130
],
[
6,
131
],
[
131,
132
],
[
0,
133
],
[
133,
134
],
[
133,
135
]
] |
[
"import java.util.*;\n \npublic class Main {\n public static void main(String[] args) throws Exception {\n \n Scanner sc = new Scanner(System.in);\n \n int N = sc.nextInt();\n \n \tlong A = (long)(Math.pow(10, 18));\n \n \tlong[] B = new long[N];\n \n \tboolean chk_0 = false;\n \n \tfor (int i = 0; i < N; i++){\n B[i] = sc.nextLong();\n if ( B[i] == 0){\n chk_0 = true;\n }\n }\n \n \tlong C = 0L;\n \tboolean chk = true;\n if (!chk_0){ \n \tC = B[0];\n \t\tfor (int i = 1; i < B.length; i++){ \n \t\ttry {\n C = Math.multiplyExact(C, B[i]);\n } catch (ArithmeticException e) {\n chk = false;\n break;\n }\n }\n }\n\n \tif (!chk || A < C){\n\t\t\tSystem.out.println(-1);\n } else {\n System.out.println(C);\n }\n\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) throws Exception {\n \n Scanner sc = new Scanner(System.in);\n \n int N = sc.nextInt();\n \n \tlong A = (long)(Math.pow(10, 18));\n \n \tlong[] B = new long[N];\n \n \tboolean chk_0 = false;\n \n \tfor (int i = 0; i < N; i++){\n B[i] = sc.nextLong();\n if ( B[i] == 0){\n chk_0 = true;\n }\n }\n \n \tlong C = 0L;\n \tboolean chk = true;\n if (!chk_0){ \n \tC = B[0];\n \t\tfor (int i = 1; i < B.length; i++){ \n \t\ttry {\n C = Math.multiplyExact(C, B[i]);\n } catch (ArithmeticException e) {\n chk = false;\n break;\n }\n }\n }\n\n \tif (!chk || A < C){\n\t\t\tSystem.out.println(-1);\n } else {\n System.out.println(C);\n }\n\n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n \n Scanner sc = new Scanner(System.in);\n \n int N = sc.nextInt();\n \n \tlong A = (long)(Math.pow(10, 18));\n \n \tlong[] B = new long[N];\n \n \tboolean chk_0 = false;\n \n \tfor (int i = 0; i < N; i++){\n B[i] = sc.nextLong();\n if ( B[i] == 0){\n chk_0 = true;\n }\n }\n \n \tlong C = 0L;\n \tboolean chk = true;\n if (!chk_0){ \n \tC = B[0];\n \t\tfor (int i = 1; i < B.length; i++){ \n \t\ttry {\n C = Math.multiplyExact(C, B[i]);\n } catch (ArithmeticException e) {\n chk = false;\n break;\n }\n }\n }\n\n \tif (!chk || A < C){\n\t\t\tSystem.out.println(-1);\n } else {\n System.out.println(C);\n }\n\n }",
"main",
"{\n \n Scanner sc = new Scanner(System.in);\n \n int N = sc.nextInt();\n \n \tlong A = (long)(Math.pow(10, 18));\n \n \tlong[] B = new long[N];\n \n \tboolean chk_0 = false;\n \n \tfor (int i = 0; i < N; i++){\n B[i] = sc.nextLong();\n if ( B[i] == 0){\n chk_0 = true;\n }\n }\n \n \tlong C = 0L;\n \tboolean chk = true;\n if (!chk_0){ \n \tC = B[0];\n \t\tfor (int i = 1; i < B.length; i++){ \n \t\ttry {\n C = Math.multiplyExact(C, B[i]);\n } catch (ArithmeticException e) {\n chk = false;\n break;\n }\n }\n }\n\n \tif (!chk || A < C){\n\t\t\tSystem.out.println(-1);\n } else {\n System.out.println(C);\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 = (long)(Math.pow(10, 18));",
"A",
"(long)(Math.pow(10, 18))",
"Math.pow",
"Math",
"10",
"18",
"long[] B = new long[N];",
"B",
"new long[N]",
"N",
"boolean chk_0 = false;",
"chk_0",
"false",
"for (int i = 0; i < N; i++){\n B[i] = sc.nextLong();\n if ( B[i] == 0){\n chk_0 = true;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n B[i] = sc.nextLong();\n if ( B[i] == 0){\n chk_0 = true;\n }\n }",
"{\n B[i] = sc.nextLong();\n if ( B[i] == 0){\n chk_0 = true;\n }\n }",
"B[i] = sc.nextLong()",
"B[i]",
"B",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if ( B[i] == 0){\n chk_0 = true;\n }",
"B[i] == 0",
"B[i]",
"B",
"i",
"0",
"{\n chk_0 = true;\n }",
"chk_0 = true",
"chk_0",
"true",
"long C = 0L;",
"C",
"0L",
"boolean chk = true;",
"chk",
"true",
"if (!chk_0){ \n \tC = B[0];\n \t\tfor (int i = 1; i < B.length; i++){ \n \t\ttry {\n C = Math.multiplyExact(C, B[i]);\n } catch (ArithmeticException e) {\n chk = false;\n break;\n }\n }\n }",
"!chk_0",
"chk_0",
"{ \n \tC = B[0];\n \t\tfor (int i = 1; i < B.length; i++){ \n \t\ttry {\n C = Math.multiplyExact(C, B[i]);\n } catch (ArithmeticException e) {\n chk = false;\n break;\n }\n }\n }",
"C = B[0]",
"C",
"B[0]",
"B",
"0",
"for (int i = 1; i < B.length; i++){ \n \t\ttry {\n C = Math.multiplyExact(C, B[i]);\n } catch (ArithmeticException e) {\n chk = false;\n break;\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < B.length",
"i",
"B.length",
"B",
"B.length",
"i++",
"i++",
"i",
"{ \n \t\ttry {\n C = Math.multiplyExact(C, B[i]);\n } catch (ArithmeticException e) {\n chk = false;\n break;\n }\n }",
"{ \n \t\ttry {\n C = Math.multiplyExact(C, B[i]);\n } catch (ArithmeticException e) {\n chk = false;\n break;\n }\n }",
"try {\n C = Math.multiplyExact(C, B[i]);\n } catch (ArithmeticException e) {\n chk = false;\n break;\n }",
"catch (ArithmeticException e) {\n chk = false;\n break;\n }",
"ArithmeticException e",
"{\n chk = false;\n break;\n }",
"chk = false",
"chk",
"false",
"break;",
"{\n C = Math.multiplyExact(C, B[i]);\n }",
"C = Math.multiplyExact(C, B[i])",
"C",
"Math.multiplyExact(C, B[i])",
"Math.multiplyExact",
"Math",
"C",
"B[i]",
"B",
"i",
"if (!chk || A < C){\n\t\t\tSystem.out.println(-1);\n } else {\n System.out.println(C);\n }",
"!chk || A < C",
"!chk",
"chk",
"A < C",
"A",
"C",
"{\n\t\t\tSystem.out.println(-1);\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"{\n System.out.println(C);\n }",
"System.out.println(C)",
"System.out.println",
"System.out",
"System",
"System.out",
"C",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) throws Exception {\n \n Scanner sc = new Scanner(System.in);\n \n int N = sc.nextInt();\n \n \tlong A = (long)(Math.pow(10, 18));\n \n \tlong[] B = new long[N];\n \n \tboolean chk_0 = false;\n \n \tfor (int i = 0; i < N; i++){\n B[i] = sc.nextLong();\n if ( B[i] == 0){\n chk_0 = true;\n }\n }\n \n \tlong C = 0L;\n \tboolean chk = true;\n if (!chk_0){ \n \tC = B[0];\n \t\tfor (int i = 1; i < B.length; i++){ \n \t\ttry {\n C = Math.multiplyExact(C, B[i]);\n } catch (ArithmeticException e) {\n chk = false;\n break;\n }\n }\n }\n\n \tif (!chk || A < C){\n\t\t\tSystem.out.println(-1);\n } else {\n System.out.println(C);\n }\n\n }\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n \n Scanner sc = new Scanner(System.in);\n \n int N = sc.nextInt();\n \n \tlong A = (long)(Math.pow(10, 18));\n \n \tlong[] B = new long[N];\n \n \tboolean chk_0 = false;\n \n \tfor (int i = 0; i < N; i++){\n B[i] = sc.nextLong();\n if ( B[i] == 0){\n chk_0 = true;\n }\n }\n \n \tlong C = 0L;\n \tboolean chk = true;\n if (!chk_0){ \n \tC = B[0];\n \t\tfor (int i = 1; i < B.length; i++){ \n \t\ttry {\n C = Math.multiplyExact(C, B[i]);\n } catch (ArithmeticException e) {\n chk = false;\n break;\n }\n }\n }\n\n \tif (!chk || A < C){\n\t\t\tSystem.out.println(-1);\n } else {\n System.out.println(C);\n }\n\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 = (long)(Math.pow(10, 18));
long[] B = new long[N];
boolean chk_0 = false;
for (int i = 0; i < N; i++){
B[i] = sc.nextLong();
if ( B[i] == 0){
chk_0 = true;
}
}
long C = 0L;
boolean chk = true;
if (!chk_0){
C = B[0];
for (int i = 1; i < B.length; i++){
try {
C = Math.multiplyExact(C, B[i]);
} catch (ArithmeticException e) {
chk = false;
break;
}
}
}
if (!chk || A < C){
System.out.println(-1);
} else {
System.out.println(C);
}
}
}
|
[
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,
14,
2,
18,
13,
13,
17,
30,
0,
13,
17,
14,
13,
30,
4,
18,
18,
13,
13,
17,
29,
41,
13,
17,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
2,
13,
18,
13,
13,
0,
13,
2,
13,
18,
13,
13,
14,
2,
2,
2,
13,
13,
2,
13,
17,
2,
13,
17,
30,
4,
18,
18,
13,
13,
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
],
[
135,
8
],
[
135,
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
],
[
52,
54
],
[
51,
55
],
[
50,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
11,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
63,
68
],
[
62,
69
],
[
11,
70
],
[
70,
71
],
[
70,
72
],
[
11,
73
],
[
73,
74
],
[
73,
75
],
[
11,
76
],
[
76,
77
],
[
76,
78
],
[
11,
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
],
[
92,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
91,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
103,
105
],
[
91,
106
],
[
106,
107
],
[
108,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
112,
113
],
[
112,
114
],
[
108,
115
],
[
115,
116
],
[
115,
117
],
[
106,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
118,
125
],
[
11,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
126,
131
],
[
9,
132
],
[
132,
133
],
[
0,
134
],
[
134,
135
],
[
134,
136
]
] |
[
"import java.util.Arrays;\nimport java.util.Scanner;\n\n/*\n\n*/\n\npublic class Main {\n public static void main(String[] args){\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n\n int count = 0;\n boolean flg = false;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if (a[i] == 0) {\n flg = true;\n }\n }\n if (flg) {\n System.out.println(0);\n return;\n }\n\n long ans = 1;\n long tmp = 1000000000000000000L;\n long std = 1000000000000000000L;\n for (int i = 0; i < n; i++) {\n ans = ans * a[i];\n tmp = tmp / a[i];\n if (std < ans || ans < 0 || tmp == 0) {\n System.out.println(\"-1\");\n return;\n }\n }\n\n System.out.println(ans);\n\n }\n}",
"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\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n\n int count = 0;\n boolean flg = false;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if (a[i] == 0) {\n flg = true;\n }\n }\n if (flg) {\n System.out.println(0);\n return;\n }\n\n long ans = 1;\n long tmp = 1000000000000000000L;\n long std = 1000000000000000000L;\n for (int i = 0; i < n; i++) {\n ans = ans * a[i];\n tmp = tmp / a[i];\n if (std < ans || ans < 0 || tmp == 0) {\n System.out.println(\"-1\");\n return;\n }\n }\n\n System.out.println(ans);\n\n }\n}",
"Main",
"public static void main(String[] args){\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n\n int count = 0;\n boolean flg = false;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if (a[i] == 0) {\n flg = true;\n }\n }\n if (flg) {\n System.out.println(0);\n return;\n }\n\n long ans = 1;\n long tmp = 1000000000000000000L;\n long std = 1000000000000000000L;\n for (int i = 0; i < n; i++) {\n ans = ans * a[i];\n tmp = tmp / a[i];\n if (std < ans || ans < 0 || tmp == 0) {\n System.out.println(\"-1\");\n return;\n }\n }\n\n System.out.println(ans);\n\n }",
"main",
"{\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n\n int count = 0;\n boolean flg = false;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if (a[i] == 0) {\n flg = true;\n }\n }\n if (flg) {\n System.out.println(0);\n return;\n }\n\n long ans = 1;\n long tmp = 1000000000000000000L;\n long std = 1000000000000000000L;\n for (int i = 0; i < n; i++) {\n ans = ans * a[i];\n tmp = tmp / a[i];\n if (std < ans || ans < 0 || tmp == 0) {\n System.out.println(\"-1\");\n return;\n }\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",
"int count = 0;",
"count",
"0",
"boolean flg = false;",
"flg",
"false",
"for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if (a[i] == 0) {\n flg = true;\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 flg = true;\n }\n }",
"{\n a[i] = sc.nextLong();\n if (a[i] == 0) {\n flg = true;\n }\n }",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (a[i] == 0) {\n flg = true;\n }",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"{\n flg = true;\n }",
"flg = true",
"flg",
"true",
"if (flg) {\n System.out.println(0);\n return;\n }",
"flg",
"{\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",
"long tmp = 1000000000000000000L;",
"tmp",
"1000000000000000000L",
"long std = 1000000000000000000L;",
"std",
"1000000000000000000L",
"for (int i = 0; i < n; i++) {\n ans = ans * a[i];\n tmp = tmp / a[i];\n if (std < ans || ans < 0 || tmp == 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 ans = ans * a[i];\n tmp = tmp / a[i];\n if (std < ans || ans < 0 || tmp == 0) {\n System.out.println(\"-1\");\n return;\n }\n }",
"{\n ans = ans * a[i];\n tmp = tmp / a[i];\n if (std < ans || ans < 0 || tmp == 0) {\n System.out.println(\"-1\");\n return;\n }\n }",
"ans = ans * a[i]",
"ans",
"ans * a[i]",
"ans",
"a[i]",
"a",
"i",
"tmp = tmp / a[i]",
"tmp",
"tmp / a[i]",
"tmp",
"a[i]",
"a",
"i",
"if (std < ans || ans < 0 || tmp == 0) {\n System.out.println(\"-1\");\n return;\n }",
"std < ans || ans < 0 || tmp == 0",
"std < ans || ans < 0 || tmp == 0",
"std < ans",
"std",
"ans",
"ans < 0",
"ans",
"0",
"tmp == 0",
"tmp",
"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)",
"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 sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n\n int count = 0;\n boolean flg = false;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if (a[i] == 0) {\n flg = true;\n }\n }\n if (flg) {\n System.out.println(0);\n return;\n }\n\n long ans = 1;\n long tmp = 1000000000000000000L;\n long std = 1000000000000000000L;\n for (int i = 0; i < n; i++) {\n ans = ans * a[i];\n tmp = tmp / a[i];\n if (std < ans || ans < 0 || tmp == 0) {\n System.out.println(\"-1\");\n return;\n }\n }\n\n System.out.println(ans);\n\n }\n}",
"public class Main {\n public static void main(String[] args){\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n\n int count = 0;\n boolean flg = false;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n if (a[i] == 0) {\n flg = true;\n }\n }\n if (flg) {\n System.out.println(0);\n return;\n }\n\n long ans = 1;\n long tmp = 1000000000000000000L;\n long std = 1000000000000000000L;\n for (int i = 0; i < n; i++) {\n ans = ans * a[i];\n tmp = tmp / a[i];\n if (std < ans || ans < 0 || tmp == 0) {\n System.out.println(\"-1\");\n return;\n }\n }\n\n System.out.println(ans);\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[] a = new long[n];
int count = 0;
boolean flg = false;
for (int i = 0; i < n; i++) {
a[i] = sc.nextLong();
if (a[i] == 0) {
flg = true;
}
}
if (flg) {
System.out.println(0);
return;
}
long ans = 1;
long tmp = 1000000000000000000L;
long std = 1000000000000000000L;
for (int i = 0; i < n; i++) {
ans = ans * a[i];
tmp = tmp / a[i];
if (std < ans || ans < 0 || tmp == 0) {
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,
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,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
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
],
[
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
],
[
135,
20
],
[
135,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
29,
32
],
[
32,
33
],
[
33,
34
],
[
23,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
37,
42
],
[
23,
43
],
[
43,
44
],
[
43,
45
],
[
23,
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
],
[
61,
63
],
[
60,
64
],
[
64,
65
],
[
65,
66
],
[
64,
67
],
[
67,
68
],
[
67,
69
],
[
59,
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
],
[
23,
84
],
[
84,
85
],
[
84,
86
],
[
23,
87
],
[
87,
88
],
[
87,
89
],
[
23,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
95,
96
],
[
95,
97
],
[
90,
98
],
[
98,
99
],
[
99,
100
],
[
90,
101
],
[
102,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
108,
109
],
[
108,
110
],
[
103,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
103,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
123,
124
],
[
117,
125
],
[
23,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
126,
131
],
[
21,
132
],
[
132,
133
],
[
0,
134
],
[
134,
135
],
[
134,
136
]
] |
[
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.Map;\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\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tString str[] = br.readLine().split(\" \");\n\n\t\tlong a[] = new long[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Long.parseLong(str[i]);\n\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 sum = 1L;\n\t\tlong max = 1000000000000000000L;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (a[i] <= max / sum) {\n\t\t\t\tsum *= 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(sum);\n\t}\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.HashMap;",
"HashMap",
"java.util",
"import java.util.Map;",
"Map",
"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\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tString str[] = br.readLine().split(\" \");\n\n\t\tlong a[] = new long[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Long.parseLong(str[i]);\n\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 sum = 1L;\n\t\tlong max = 1000000000000000000L;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (a[i] <= max / sum) {\n\t\t\t\tsum *= 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(sum);\n\t}\n}",
"Main",
"public static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tString str[] = br.readLine().split(\" \");\n\n\t\tlong a[] = new long[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Long.parseLong(str[i]);\n\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 sum = 1L;\n\t\tlong max = 1000000000000000000L;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (a[i] <= max / sum) {\n\t\t\t\tsum *= 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(sum);\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tString str[] = br.readLine().split(\" \");\n\n\t\tlong a[] = new long[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Long.parseLong(str[i]);\n\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 sum = 1L;\n\t\tlong max = 1000000000000000000L;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (a[i] <= max / sum) {\n\t\t\t\tsum *= 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(sum);\n\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String str[] = br.readLine().split(\" \");",
"str",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"long a[] = new long[n];",
"a",
"new long[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\ta[i] = Long.parseLong(str[i]);\n\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(str[i]);\n\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(str[i]);\n\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(str[i])",
"a[i]",
"a",
"i",
"Long.parseLong(str[i])",
"Long.parseLong",
"Long",
"str[i]",
"str",
"i",
"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 sum = 1L;",
"sum",
"1L",
"long max = 1000000000000000000L;",
"max",
"1000000000000000000L",
"for (int i = 0; i < n; i++) {\n\t\t\tif (a[i] <= max / sum) {\n\t\t\t\tsum *= 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\t\t\tif (a[i] <= max / sum) {\n\t\t\t\tsum *= 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] <= max / sum) {\n\t\t\t\tsum *= 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] <= max / sum) {\n\t\t\t\tsum *= 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] <= max / sum",
"a[i]",
"a",
"i",
"max / sum",
"max",
"sum",
"{\n\t\t\t\tsum *= a[i];\n\t\t\t}",
"sum *= a[i]",
"sum",
"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(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"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\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tString str[] = br.readLine().split(\" \");\n\n\t\tlong a[] = new long[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Long.parseLong(str[i]);\n\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 sum = 1L;\n\t\tlong max = 1000000000000000000L;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (a[i] <= max / sum) {\n\t\t\t\tsum *= 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(sum);\n\t}\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\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tString str[] = br.readLine().split(\" \");\n\n\t\tlong a[] = new long[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Long.parseLong(str[i]);\n\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 sum = 1L;\n\t\tlong max = 1000000000000000000L;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (a[i] <= max / sum) {\n\t\t\t\tsum *= 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(sum);\n\t}\n}",
"Main"
] |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String str[] = br.readLine().split(" ");
long a[] = new long[n];
for (int i = 0; i < n; i++) {
a[i] = Long.parseLong(str[i]);
if (a[i] == 0) {
System.out.println("0");
return;
}
}
long sum = 1L;
long max = 1000000000000000000L;
for (int i = 0; i < n; i++) {
if (a[i] <= max / sum) {
sum *= a[i];
} else {
System.out.println(-1);
return;
}
}
System.out.println(sum);
}
}
|
[
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,
41,
13,
20,
41,
13,
18,
13,
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,
14,
2,
4,
18,
18,
13,
13,
13,
17,
30,
0,
13,
13,
14,
2,
13,
17,
30,
11,
1,
41,
13,
13,
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,
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,
4,
18,
18,
13,
13,
40,
17,
29,
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
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
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
],
[
30,
32
],
[
17,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
35,
37
],
[
17,
38
],
[
38,
39
],
[
38,
40
],
[
17,
41
],
[
41,
42
],
[
41,
43
],
[
17,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
44,
49
],
[
49,
50
],
[
49,
51
],
[
44,
52
],
[
52,
53
],
[
53,
54
],
[
44,
55
],
[
56,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
57,
61
],
[
61,
62
],
[
62,
63
],
[
56,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
66,
71
],
[
65,
72
],
[
64,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
17,
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
],
[
94,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
100,
101
],
[
100,
102
],
[
94,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
105,
108
],
[
104,
109
],
[
103,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
116,
117
],
[
110,
118
],
[
77,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
125,
126
],
[
125,
127
],
[
120,
128
],
[
128,
129
],
[
129,
130
],
[
120,
131
],
[
132,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
136,
137
],
[
135,
138
],
[
138,
139
],
[
138,
140
],
[
132,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
143,
146
],
[
142,
147
],
[
141,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
154,
155
],
[
148,
156
],
[
17,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
157,
162
],
[
15,
163
],
[
163,
164
]
] |
[
"import java.util.Scanner;\nimport java.util.Comparator;\nimport java.util.Arrays;\nimport java.math.BigInteger;\nclass Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int N = scan.nextInt();\n BigInteger A[] = new BigInteger[N];\n BigInteger big = new BigInteger(\"1000000000000000000\");\n BigInteger result = BigInteger.ONE;\n BigInteger zero = new BigInteger(\"0\");\n int K = 0;\n for (int i = 0;i < N;i++) {\n A[i] = scan.nextBigInteger();\n if (A[i].compareTo(zero) == 0) {\n K = i;\n }\n }\n if (K > 0) {\n for (int i = K;i < N;i++) {\n result = result.multiply(A[i]);\n if (result.compareTo(big) > 0) {\n System.out.println(-1);\n return;\n }\n }\n }\n else{\n for (int i = 0;i < N;i++) {\n result = result.multiply(A[i]);\n if (result.compareTo(big) > 0) {\n System.out.println(-1);\n return;\n }\n }\n }\n System.out.println(result);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Comparator;",
"Comparator",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int N = scan.nextInt();\n BigInteger A[] = new BigInteger[N];\n BigInteger big = new BigInteger(\"1000000000000000000\");\n BigInteger result = BigInteger.ONE;\n BigInteger zero = new BigInteger(\"0\");\n int K = 0;\n for (int i = 0;i < N;i++) {\n A[i] = scan.nextBigInteger();\n if (A[i].compareTo(zero) == 0) {\n K = i;\n }\n }\n if (K > 0) {\n for (int i = K;i < N;i++) {\n result = result.multiply(A[i]);\n if (result.compareTo(big) > 0) {\n System.out.println(-1);\n return;\n }\n }\n }\n else{\n for (int i = 0;i < N;i++) {\n result = result.multiply(A[i]);\n if (result.compareTo(big) > 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 scan = new Scanner(System.in);\n int N = scan.nextInt();\n BigInteger A[] = new BigInteger[N];\n BigInteger big = new BigInteger(\"1000000000000000000\");\n BigInteger result = BigInteger.ONE;\n BigInteger zero = new BigInteger(\"0\");\n int K = 0;\n for (int i = 0;i < N;i++) {\n A[i] = scan.nextBigInteger();\n if (A[i].compareTo(zero) == 0) {\n K = i;\n }\n }\n if (K > 0) {\n for (int i = K;i < N;i++) {\n result = result.multiply(A[i]);\n if (result.compareTo(big) > 0) {\n System.out.println(-1);\n return;\n }\n }\n }\n else{\n for (int i = 0;i < N;i++) {\n result = result.multiply(A[i]);\n if (result.compareTo(big) > 0) {\n System.out.println(-1);\n return;\n }\n }\n }\n System.out.println(result);\n }",
"main",
"{\n Scanner scan = new Scanner(System.in);\n int N = scan.nextInt();\n BigInteger A[] = new BigInteger[N];\n BigInteger big = new BigInteger(\"1000000000000000000\");\n BigInteger result = BigInteger.ONE;\n BigInteger zero = new BigInteger(\"0\");\n int K = 0;\n for (int i = 0;i < N;i++) {\n A[i] = scan.nextBigInteger();\n if (A[i].compareTo(zero) == 0) {\n K = i;\n }\n }\n if (K > 0) {\n for (int i = K;i < N;i++) {\n result = result.multiply(A[i]);\n if (result.compareTo(big) > 0) {\n System.out.println(-1);\n return;\n }\n }\n }\n else{\n for (int i = 0;i < N;i++) {\n result = result.multiply(A[i]);\n if (result.compareTo(big) > 0) {\n System.out.println(-1);\n return;\n }\n }\n }\n System.out.println(result);\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int N = scan.nextInt();",
"N",
"scan.nextInt()",
"scan.nextInt",
"scan",
"BigInteger A[] = new BigInteger[N];",
"A",
"new BigInteger[N]",
"N",
"BigInteger big = new BigInteger(\"1000000000000000000\");",
"big",
"new BigInteger(\"1000000000000000000\")",
"BigInteger result = BigInteger.ONE;",
"result",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"BigInteger zero = new BigInteger(\"0\");",
"zero",
"new BigInteger(\"0\")",
"int K = 0;",
"K",
"0",
"for (int i = 0;i < N;i++) {\n A[i] = scan.nextBigInteger();\n if (A[i].compareTo(zero) == 0) {\n K = i;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i] = scan.nextBigInteger();\n if (A[i].compareTo(zero) == 0) {\n K = i;\n }\n }",
"{\n A[i] = scan.nextBigInteger();\n if (A[i].compareTo(zero) == 0) {\n K = i;\n }\n }",
"A[i] = scan.nextBigInteger()",
"A[i]",
"A",
"i",
"scan.nextBigInteger()",
"scan.nextBigInteger",
"scan",
"if (A[i].compareTo(zero) == 0) {\n K = i;\n }",
"A[i].compareTo(zero) == 0",
"A[i].compareTo(zero)",
"A[i].compareTo",
"A[i]",
"A",
"i",
"zero",
"0",
"{\n K = i;\n }",
"K = i",
"K",
"i",
"if (K > 0) {\n for (int i = K;i < N;i++) {\n result = result.multiply(A[i]);\n if (result.compareTo(big) > 0) {\n System.out.println(-1);\n return;\n }\n }\n }\n else{\n for (int i = 0;i < N;i++) {\n result = result.multiply(A[i]);\n if (result.compareTo(big) > 0) {\n System.out.println(-1);\n return;\n }\n }\n }",
"K > 0",
"K",
"0",
"{\n for (int i = K;i < N;i++) {\n result = result.multiply(A[i]);\n if (result.compareTo(big) > 0) {\n System.out.println(-1);\n return;\n }\n }\n }",
"for (int i = K;i < N;i++) {\n result = result.multiply(A[i]);\n if (result.compareTo(big) > 0) {\n System.out.println(-1);\n return;\n }\n }",
"int i = K;",
"int i = K;",
"i",
"K",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n result = result.multiply(A[i]);\n if (result.compareTo(big) > 0) {\n System.out.println(-1);\n return;\n }\n }",
"{\n result = result.multiply(A[i]);\n if (result.compareTo(big) > 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(big) > 0) {\n System.out.println(-1);\n return;\n }",
"result.compareTo(big) > 0",
"result.compareTo(big)",
"result.compareTo",
"result",
"big",
"0",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"{\n for (int i = 0;i < N;i++) {\n result = result.multiply(A[i]);\n if (result.compareTo(big) > 0) {\n System.out.println(-1);\n return;\n }\n }\n }",
"for (int i = 0;i < N;i++) {\n result = result.multiply(A[i]);\n if (result.compareTo(big) > 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(big) > 0) {\n System.out.println(-1);\n return;\n }\n }",
"{\n result = result.multiply(A[i]);\n if (result.compareTo(big) > 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(big) > 0) {\n System.out.println(-1);\n return;\n }",
"result.compareTo(big) > 0",
"result.compareTo(big)",
"result.compareTo",
"result",
"big",
"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"
] |
import java.util.Scanner;
import java.util.Comparator;
import java.util.Arrays;
import java.math.BigInteger;
class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
BigInteger A[] = new BigInteger[N];
BigInteger big = new BigInteger("1000000000000000000");
BigInteger result = BigInteger.ONE;
BigInteger zero = new BigInteger("0");
int K = 0;
for (int i = 0;i < N;i++) {
A[i] = scan.nextBigInteger();
if (A[i].compareTo(zero) == 0) {
K = i;
}
}
if (K > 0) {
for (int i = K;i < N;i++) {
result = result.multiply(A[i]);
if (result.compareTo(big) > 0) {
System.out.println(-1);
return;
}
}
}
else{
for (int i = 0;i < N;i++) {
result = result.multiply(A[i]);
if (result.compareTo(big) > 0) {
System.out.println(-1);
return;
}
}
}
System.out.println(result);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
17,
3,
14,
2,
18,
13,
13,
2,
4,
18,
13,
17,
17,
13,
30,
0,
13,
40,
17,
3,
0,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
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
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
11,
17
],
[
17,
18
],
[
17,
19
],
[
11,
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
],
[
11,
41
],
[
41,
42
],
[
42,
43
],
[
41,
44
],
[
11,
45
],
[
45,
46
],
[
45,
47
],
[
11,
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
],
[
60,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
72,
75
],
[
72,
76
],
[
71,
77
],
[
66,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
78,
83
],
[
60,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
11,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
9,
95
],
[
95,
96
]
] |
[
"import java.util.*;\n\nclass Main {\n\n\tstatic Scanner sc = new Scanner(System.in);\n\n\tpublic static void main(String[] args) {\n int N =sc.nextInt();\n long A[] = new long[N];\n for(int i=0;i<N;i++){\n A[i] = sc.nextLong();\n }\n Arrays.sort(A);\n long ans = 1;\n for(int i=0;i<N;i++){\n if(ans==0) break;\n if(A[i]>(long)Math.pow(10,18)/ans){\n ans = -1;\n break;\n }\n ans*=A[i];\n }\n System.out.println(ans);\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"class Main {\n\n\tstatic Scanner sc = new Scanner(System.in);\n\n\tpublic static void main(String[] args) {\n int N =sc.nextInt();\n long A[] = new long[N];\n for(int i=0;i<N;i++){\n A[i] = sc.nextLong();\n }\n Arrays.sort(A);\n long ans = 1;\n for(int i=0;i<N;i++){\n if(ans==0) break;\n if(A[i]>(long)Math.pow(10,18)/ans){\n ans = -1;\n break;\n }\n ans*=A[i];\n }\n System.out.println(ans);\n\t}\n}",
"Main",
"static Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"public static void main(String[] args) {\n int N =sc.nextInt();\n long A[] = new long[N];\n for(int i=0;i<N;i++){\n A[i] = sc.nextLong();\n }\n Arrays.sort(A);\n long ans = 1;\n for(int i=0;i<N;i++){\n if(ans==0) break;\n if(A[i]>(long)Math.pow(10,18)/ans){\n ans = -1;\n break;\n }\n ans*=A[i];\n }\n System.out.println(ans);\n\t}",
"main",
"{\n int N =sc.nextInt();\n long A[] = new long[N];\n for(int i=0;i<N;i++){\n A[i] = sc.nextLong();\n }\n Arrays.sort(A);\n long ans = 1;\n for(int i=0;i<N;i++){\n if(ans==0) break;\n if(A[i]>(long)Math.pow(10,18)/ans){\n ans = -1;\n break;\n }\n ans*=A[i];\n }\n System.out.println(ans);\n\t}",
"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 }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i] = sc.nextLong();\n }",
"{\n A[i] = sc.nextLong();\n }",
"A[i] = sc.nextLong()",
"A[i]",
"A",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"Arrays.sort(A)",
"Arrays.sort",
"Arrays",
"A",
"long ans = 1;",
"ans",
"1",
"for(int i=0;i<N;i++){\n if(ans==0) break;\n if(A[i]>(long)Math.pow(10,18)/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(ans==0) break;\n if(A[i]>(long)Math.pow(10,18)/ans){\n ans = -1;\n break;\n }\n ans*=A[i];\n }",
"{\n if(ans==0) break;\n if(A[i]>(long)Math.pow(10,18)/ans){\n ans = -1;\n break;\n }\n ans*=A[i];\n }",
"if(ans==0) break;",
"ans==0",
"ans",
"0",
"break;",
"if(A[i]>(long)Math.pow(10,18)/ans){\n ans = -1;\n break;\n }",
"A[i]>(long)Math.pow(10,18)/ans",
"A[i]",
"A",
"i",
"(long)Math.pow(10,18)/ans",
"(long)Math.pow(10,18)",
"Math.pow",
"Math",
"10",
"18",
"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",
"String[] args",
"args"
] |
import java.util.*;
class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int N =sc.nextInt();
long A[] = new long[N];
for(int i=0;i<N;i++){
A[i] = sc.nextLong();
}
Arrays.sort(A);
long ans = 1;
for(int i=0;i<N;i++){
if(ans==0) break;
if(A[i]>(long)Math.pow(10,18)/ans){
ans = -1;
break;
}
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
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,
18,
13,
13,
17,
4,
18,
13,
17,
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,
17,
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
],
[
125,
5
],
[
125,
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
],
[
41,
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
],
[
59,
59
],
[
59,
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
],
[
73,
74
],
[
74,
75
],
[
73,
76
],
[
8,
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
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
90,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
99,
104
],
[
104,
105
],
[
98,
106
],
[
106,
107
],
[
107,
108
],
[
106,
109
],
[
90,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
113,
115
],
[
8,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
116,
121
],
[
6,
122
],
[
122,
123
],
[
0,
124
],
[
124,
125
],
[
124,
126
]
] |
[
"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[] nums = new long[N];\n for(int i=0;i<N;i++) {\n nums[i]=sc.nextLong();\n }\n long border=1000000000000000000l;\n long result=1l;\n for(int i=0;i<N;i++) {\n if(nums[i]==0) {\n System.out.println(0);\n System.exit(0);\n }\n }\n for(int i=0;i<N;i++) {\n if(result>border/nums[i]) {\n System.out.println(-1);\n System.exit(0);\n }else {\n result*=nums[i];\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 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 long border=1000000000000000000l;\n long result=1l;\n for(int i=0;i<N;i++) {\n if(nums[i]==0) {\n System.out.println(0);\n System.exit(0);\n }\n }\n for(int i=0;i<N;i++) {\n if(result>border/nums[i]) {\n System.out.println(-1);\n System.exit(0);\n }else {\n result*=nums[i];\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 long[] nums = new long[N];\n for(int i=0;i<N;i++) {\n nums[i]=sc.nextLong();\n }\n long border=1000000000000000000l;\n long result=1l;\n for(int i=0;i<N;i++) {\n if(nums[i]==0) {\n System.out.println(0);\n System.exit(0);\n }\n }\n for(int i=0;i<N;i++) {\n if(result>border/nums[i]) {\n System.out.println(-1);\n System.exit(0);\n }else {\n result*=nums[i];\n }\n }\n System.out.println(result);\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 long border=1000000000000000000l;\n long result=1l;\n for(int i=0;i<N;i++) {\n if(nums[i]==0) {\n System.out.println(0);\n System.exit(0);\n }\n }\n for(int i=0;i<N;i++) {\n if(result>border/nums[i]) {\n System.out.println(-1);\n System.exit(0);\n }else {\n result*=nums[i];\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",
"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",
"long border=1000000000000000000l;",
"border",
"1000000000000000000l",
"long result=1l;",
"result",
"1l",
"for(int i=0;i<N;i++) {\n if(nums[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 if(nums[i]==0) {\n System.out.println(0);\n System.exit(0);\n }\n }",
"{\n if(nums[i]==0) {\n System.out.println(0);\n System.exit(0);\n }\n }",
"if(nums[i]==0) {\n System.out.println(0);\n System.exit(0);\n }",
"nums[i]==0",
"nums[i]",
"nums",
"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(result>border/nums[i]) {\n System.out.println(-1);\n System.exit(0);\n }else {\n result*=nums[i];\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if(result>border/nums[i]) {\n System.out.println(-1);\n System.exit(0);\n }else {\n result*=nums[i];\n }\n }",
"{\n if(result>border/nums[i]) {\n System.out.println(-1);\n System.exit(0);\n }else {\n result*=nums[i];\n }\n }",
"if(result>border/nums[i]) {\n System.out.println(-1);\n System.exit(0);\n }else {\n result*=nums[i];\n }",
"result>border/nums[i]",
"result",
"border/nums[i]",
"border",
"nums[i]",
"nums",
"i",
"{\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",
"{\n result*=nums[i];\n }",
"result*=nums[i]",
"result",
"nums[i]",
"nums",
"i",
"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 long[] nums = new long[N];\n for(int i=0;i<N;i++) {\n nums[i]=sc.nextLong();\n }\n long border=1000000000000000000l;\n long result=1l;\n for(int i=0;i<N;i++) {\n if(nums[i]==0) {\n System.out.println(0);\n System.exit(0);\n }\n }\n for(int i=0;i<N;i++) {\n if(result>border/nums[i]) {\n System.out.println(-1);\n System.exit(0);\n }else {\n result*=nums[i];\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 long[] nums = new long[N];\n for(int i=0;i<N;i++) {\n nums[i]=sc.nextLong();\n }\n long border=1000000000000000000l;\n long result=1l;\n for(int i=0;i<N;i++) {\n if(nums[i]==0) {\n System.out.println(0);\n System.exit(0);\n }\n }\n for(int i=0;i<N;i++) {\n if(result>border/nums[i]) {\n System.out.println(-1);\n System.exit(0);\n }else {\n result*=nums[i];\n }\n }\n System.out.println(result);\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[] nums = new long[N];
for(int i=0;i<N;i++) {
nums[i]=sc.nextLong();
}
long border=1000000000000000000l;
long result=1l;
for(int i=0;i<N;i++) {
if(nums[i]==0) {
System.out.println(0);
System.exit(0);
}
}
for(int i=0;i<N;i++) {
if(result>border/nums[i]) {
System.out.println(-1);
System.exit(0);
}else {
result*=nums[i];
}
}
System.out.println(result);
}
}
|
[
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,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
0,
13,
18,
13,
13,
3,
14,
2,
4,
18,
13,
4,
18,
13,
40,
17,
17,
30,
3,
0,
13,
4,
18,
13,
4,
18,
13,
18,
13,
13,
14,
2,
4,
18,
13,
4,
18,
13,
17,
17,
30,
0,
13,
4,
18,
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
],
[
137,
11
],
[
137,
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
],
[
34,
35
],
[
34,
36
],
[
27,
37
],
[
37,
38
],
[
38,
39
],
[
27,
40
],
[
41,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
46,
47
],
[
47,
48
],
[
14,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
14,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
55,
57
],
[
14,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
58,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
58,
68
],
[
68,
69
],
[
69,
70
],
[
58,
71
],
[
72,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
74,
78
],
[
73,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
79,
85
],
[
73,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
88,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
94,
95
],
[
87,
96
],
[
86,
97
],
[
97,
98
],
[
72,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
104,
105
],
[
105,
106
],
[
104,
107
],
[
107,
108
],
[
107,
109
],
[
72,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
112,
115
],
[
115,
116
],
[
116,
117
],
[
115,
118
],
[
111,
119
],
[
110,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
124,
125
],
[
123,
126
],
[
126,
127
],
[
14,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
128,
133
],
[
12,
134
],
[
134,
135
],
[
0,
136
],
[
136,
137
],
[
136,
138
]
] |
[
"import java.math.BigDecimal;\nimport java.util.Arrays;\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 = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\tArrays.parallelSort(a);\n\t\tBigDecimal result = BigDecimal.ONE;\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tif(a[i] == 0) {\n\t\t\t\tresult = BigDecimal.ZERO;\n\t\t\t\tbreak;\n\t\t\t} else if(result.compareTo(BigDecimal.valueOf(-1)) == 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tresult = result.multiply(BigDecimal.valueOf(a[i]));\n\t\t\tif(result.compareTo(BigDecimal.valueOf(1000000000000000000L)) > 0) {\n\t\t\t\tresult = BigDecimal.valueOf(-1);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\n\t}\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\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\tfor (int i = 0; i < a.length; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\tArrays.parallelSort(a);\n\t\tBigDecimal result = BigDecimal.ONE;\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tif(a[i] == 0) {\n\t\t\t\tresult = BigDecimal.ZERO;\n\t\t\t\tbreak;\n\t\t\t} else if(result.compareTo(BigDecimal.valueOf(-1)) == 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tresult = result.multiply(BigDecimal.valueOf(a[i]));\n\t\t\tif(result.compareTo(BigDecimal.valueOf(1000000000000000000L)) > 0) {\n\t\t\t\tresult = BigDecimal.valueOf(-1);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\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\tfor (int i = 0; i < a.length; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\tArrays.parallelSort(a);\n\t\tBigDecimal result = BigDecimal.ONE;\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tif(a[i] == 0) {\n\t\t\t\tresult = BigDecimal.ZERO;\n\t\t\t\tbreak;\n\t\t\t} else if(result.compareTo(BigDecimal.valueOf(-1)) == 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tresult = result.multiply(BigDecimal.valueOf(a[i]));\n\t\t\tif(result.compareTo(BigDecimal.valueOf(1000000000000000000L)) > 0) {\n\t\t\t\tresult = BigDecimal.valueOf(-1);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\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\tfor (int i = 0; i < a.length; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\tArrays.parallelSort(a);\n\t\tBigDecimal result = BigDecimal.ONE;\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tif(a[i] == 0) {\n\t\t\t\tresult = BigDecimal.ZERO;\n\t\t\t\tbreak;\n\t\t\t} else if(result.compareTo(BigDecimal.valueOf(-1)) == 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tresult = result.multiply(BigDecimal.valueOf(a[i]));\n\t\t\tif(result.compareTo(BigDecimal.valueOf(1000000000000000000L)) > 0) {\n\t\t\t\tresult = BigDecimal.valueOf(-1);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\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 < a.length; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < a.length",
"i",
"a.length",
"a",
"a.length",
"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.parallelSort(a)",
"Arrays.parallelSort",
"Arrays",
"a",
"BigDecimal result = BigDecimal.ONE;",
"result",
"BigDecimal.ONE",
"BigDecimal",
"BigDecimal.ONE",
"for (int i = 0; i < a.length; i++) {\n\t\t\tif(a[i] == 0) {\n\t\t\t\tresult = BigDecimal.ZERO;\n\t\t\t\tbreak;\n\t\t\t} else if(result.compareTo(BigDecimal.valueOf(-1)) == 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tresult = result.multiply(BigDecimal.valueOf(a[i]));\n\t\t\tif(result.compareTo(BigDecimal.valueOf(1000000000000000000L)) > 0) {\n\t\t\t\tresult = BigDecimal.valueOf(-1);\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"{\n\t\t\tif(a[i] == 0) {\n\t\t\t\tresult = BigDecimal.ZERO;\n\t\t\t\tbreak;\n\t\t\t} else if(result.compareTo(BigDecimal.valueOf(-1)) == 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tresult = result.multiply(BigDecimal.valueOf(a[i]));\n\t\t\tif(result.compareTo(BigDecimal.valueOf(1000000000000000000L)) > 0) {\n\t\t\t\tresult = BigDecimal.valueOf(-1);\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(a[i] == 0) {\n\t\t\t\tresult = BigDecimal.ZERO;\n\t\t\t\tbreak;\n\t\t\t} else if(result.compareTo(BigDecimal.valueOf(-1)) == 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tresult = result.multiply(BigDecimal.valueOf(a[i]));\n\t\t\tif(result.compareTo(BigDecimal.valueOf(1000000000000000000L)) > 0) {\n\t\t\t\tresult = BigDecimal.valueOf(-1);\n\t\t\t}\n\t\t}",
"if(a[i] == 0) {\n\t\t\t\tresult = BigDecimal.ZERO;\n\t\t\t\tbreak;\n\t\t\t} else if(result.compareTo(BigDecimal.valueOf(-1)) == 0) {\n\t\t\t\tbreak;\n\t\t\t}",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"{\n\t\t\t\tresult = BigDecimal.ZERO;\n\t\t\t\tbreak;\n\t\t\t}",
"result = BigDecimal.ZERO",
"result",
"BigDecimal.ZERO",
"BigDecimal",
"BigDecimal.ZERO",
"break;",
"if(result.compareTo(BigDecimal.valueOf(-1)) == 0) {\n\t\t\t\tbreak;\n\t\t\t}",
"result.compareTo(BigDecimal.valueOf(-1)) == 0",
"result.compareTo(BigDecimal.valueOf(-1))",
"result.compareTo",
"result",
"BigDecimal.valueOf(-1)",
"BigDecimal.valueOf",
"BigDecimal",
"-1",
"1",
"0",
"{\n\t\t\t\tbreak;\n\t\t\t}",
"break;",
"result = result.multiply(BigDecimal.valueOf(a[i]))",
"result",
"result.multiply(BigDecimal.valueOf(a[i]))",
"result.multiply",
"result",
"BigDecimal.valueOf(a[i])",
"BigDecimal.valueOf",
"BigDecimal",
"a[i]",
"a",
"i",
"if(result.compareTo(BigDecimal.valueOf(1000000000000000000L)) > 0) {\n\t\t\t\tresult = BigDecimal.valueOf(-1);\n\t\t\t}",
"result.compareTo(BigDecimal.valueOf(1000000000000000000L)) > 0",
"result.compareTo(BigDecimal.valueOf(1000000000000000000L))",
"result.compareTo",
"result",
"BigDecimal.valueOf(1000000000000000000L)",
"BigDecimal.valueOf",
"BigDecimal",
"1000000000000000000L",
"0",
"{\n\t\t\t\tresult = BigDecimal.valueOf(-1);\n\t\t\t}",
"result = BigDecimal.valueOf(-1)",
"result",
"BigDecimal.valueOf(-1)",
"BigDecimal.valueOf",
"BigDecimal",
"-1",
"1",
"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\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\tArrays.parallelSort(a);\n\t\tBigDecimal result = BigDecimal.ONE;\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tif(a[i] == 0) {\n\t\t\t\tresult = BigDecimal.ZERO;\n\t\t\t\tbreak;\n\t\t\t} else if(result.compareTo(BigDecimal.valueOf(-1)) == 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tresult = result.multiply(BigDecimal.valueOf(a[i]));\n\t\t\tif(result.compareTo(BigDecimal.valueOf(1000000000000000000L)) > 0) {\n\t\t\t\tresult = BigDecimal.valueOf(-1);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\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\tlong[] a = new long[n];\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\tArrays.parallelSort(a);\n\t\tBigDecimal result = BigDecimal.ONE;\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tif(a[i] == 0) {\n\t\t\t\tresult = BigDecimal.ZERO;\n\t\t\t\tbreak;\n\t\t\t} else if(result.compareTo(BigDecimal.valueOf(-1)) == 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tresult = result.multiply(BigDecimal.valueOf(a[i]));\n\t\t\tif(result.compareTo(BigDecimal.valueOf(1000000000000000000L)) > 0) {\n\t\t\t\tresult = BigDecimal.valueOf(-1);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\n\t}\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();
long[] a = new long[n];
for (int i = 0; i < a.length; i++) {
a[i] = sc.nextLong();
}
Arrays.parallelSort(a);
BigDecimal result = BigDecimal.ONE;
for (int i = 0; i < a.length; i++) {
if(a[i] == 0) {
result = BigDecimal.ZERO;
break;
} else if(result.compareTo(BigDecimal.valueOf(-1)) == 0) {
break;
}
result = result.multiply(BigDecimal.valueOf(a[i]));
if(result.compareTo(BigDecimal.valueOf(1000000000000000000L)) > 0) {
result = BigDecimal.valueOf(-1);
}
}
System.out.println(result);
}
}
|
[
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,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
14,
4,
18,
13,
17,
30,
4,
18,
18,
13,
13,
17,
30,
41,
13,
2,
17,
17,
41,
13,
17,
28,
13,
13,
30,
30,
14,
2,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
0,
13,
17,
29,
0,
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
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
107,
11
],
[
107,
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
],
[
24,
25
],
[
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
],
[
42,
45
],
[
45,
46
],
[
46,
47
],
[
14,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
48,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
48,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
63,
65
],
[
60,
66
],
[
66,
67
],
[
66,
68
],
[
60,
69
],
[
69,
70
],
[
69,
71
],
[
69,
72
],
[
73,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
74,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
81,
86
],
[
86,
87
],
[
80,
88
],
[
88,
89
],
[
88,
90
],
[
80,
91
],
[
73,
92
],
[
92,
93
],
[
92,
94
],
[
60,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
95,
100
],
[
14,
101
],
[
101,
102
],
[
102,
103
],
[
12,
104
],
[
104,
105
],
[
0,
106
],
[
106,
107
],
[
106,
108
]
] |
[
"\nimport java.util.ArrayList;\nimport java.util.List;\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 sc.nextLine();\n List<Long> l = new ArrayList<Long>();\n for(int i = 0;i < n;i++) {\n l.add(sc.nextLong());\n }\n\n if(l.contains(0L)) {\n System.out.println(0);\n }else {\n Long max = 1000000000L * 1000000000;\n\n Long sum = 1L;\n\n for(Long l2:l) {\n if(sum > max/l2) {\n System.out.println(-1);\n sum = 0L;\n return;\n }\n sum *= l2;\n }\n System.out.println(sum);\n }\n\n sc.close();\n }\n\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 public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n sc.nextLine();\n List<Long> l = new ArrayList<Long>();\n for(int i = 0;i < n;i++) {\n l.add(sc.nextLong());\n }\n\n if(l.contains(0L)) {\n System.out.println(0);\n }else {\n Long max = 1000000000L * 1000000000;\n\n Long sum = 1L;\n\n for(Long l2:l) {\n if(sum > max/l2) {\n System.out.println(-1);\n sum = 0L;\n return;\n }\n sum *= l2;\n }\n System.out.println(sum);\n }\n\n sc.close();\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<Long> l = new ArrayList<Long>();\n for(int i = 0;i < n;i++) {\n l.add(sc.nextLong());\n }\n\n if(l.contains(0L)) {\n System.out.println(0);\n }else {\n Long max = 1000000000L * 1000000000;\n\n Long sum = 1L;\n\n for(Long l2:l) {\n if(sum > max/l2) {\n System.out.println(-1);\n sum = 0L;\n return;\n }\n sum *= l2;\n }\n System.out.println(sum);\n }\n\n sc.close();\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n sc.nextLine();\n List<Long> l = new ArrayList<Long>();\n for(int i = 0;i < n;i++) {\n l.add(sc.nextLong());\n }\n\n if(l.contains(0L)) {\n System.out.println(0);\n }else {\n Long max = 1000000000L * 1000000000;\n\n Long sum = 1L;\n\n for(Long l2:l) {\n if(sum > max/l2) {\n System.out.println(-1);\n sum = 0L;\n return;\n }\n sum *= l2;\n }\n System.out.println(sum);\n }\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",
"sc.nextLine()",
"sc.nextLine",
"sc",
"List<Long> l = new ArrayList<Long>();",
"l",
"new ArrayList<Long>()",
"for(int i = 0;i < n;i++) {\n l.add(sc.nextLong());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n l.add(sc.nextLong());\n }",
"{\n l.add(sc.nextLong());\n }",
"l.add(sc.nextLong())",
"l.add",
"l",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(l.contains(0L)) {\n System.out.println(0);\n }else {\n Long max = 1000000000L * 1000000000;\n\n Long sum = 1L;\n\n for(Long l2:l) {\n if(sum > max/l2) {\n System.out.println(-1);\n sum = 0L;\n return;\n }\n sum *= l2;\n }\n System.out.println(sum);\n }",
"l.contains(0L)",
"l.contains",
"l",
"0L",
"{\n System.out.println(0);\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"{\n Long max = 1000000000L * 1000000000;\n\n Long sum = 1L;\n\n for(Long l2:l) {\n if(sum > max/l2) {\n System.out.println(-1);\n sum = 0L;\n return;\n }\n sum *= l2;\n }\n System.out.println(sum);\n }",
"Long max = 1000000000L * 1000000000;",
"max",
"1000000000L * 1000000000",
"1000000000L",
"1000000000",
"Long sum = 1L;",
"sum",
"1L",
"for(Long l2:l) {\n if(sum > max/l2) {\n System.out.println(-1);\n sum = 0L;\n return;\n }\n sum *= l2;\n }",
"Long l2",
"l",
"{\n if(sum > max/l2) {\n System.out.println(-1);\n sum = 0L;\n return;\n }\n sum *= l2;\n }",
"{\n if(sum > max/l2) {\n System.out.println(-1);\n sum = 0L;\n return;\n }\n sum *= l2;\n }",
"if(sum > max/l2) {\n System.out.println(-1);\n sum = 0L;\n return;\n }",
"sum > max/l2",
"sum",
"max/l2",
"max",
"l2",
"{\n System.out.println(-1);\n sum = 0L;\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"sum = 0L",
"sum",
"0L",
"return;",
"sum *= l2",
"sum",
"l2",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"sc.close()",
"sc.close",
"sc",
"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 sc.nextLine();\n List<Long> l = new ArrayList<Long>();\n for(int i = 0;i < n;i++) {\n l.add(sc.nextLong());\n }\n\n if(l.contains(0L)) {\n System.out.println(0);\n }else {\n Long max = 1000000000L * 1000000000;\n\n Long sum = 1L;\n\n for(Long l2:l) {\n if(sum > max/l2) {\n System.out.println(-1);\n sum = 0L;\n return;\n }\n sum *= l2;\n }\n System.out.println(sum);\n }\n\n sc.close();\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 sc.nextLine();\n List<Long> l = new ArrayList<Long>();\n for(int i = 0;i < n;i++) {\n l.add(sc.nextLong());\n }\n\n if(l.contains(0L)) {\n System.out.println(0);\n }else {\n Long max = 1000000000L * 1000000000;\n\n Long sum = 1L;\n\n for(Long l2:l) {\n if(sum > max/l2) {\n System.out.println(-1);\n sum = 0L;\n return;\n }\n sum *= l2;\n }\n System.out.println(sum);\n }\n\n sc.close();\n }\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 = sc.nextInt();
sc.nextLine();
List<Long> l = new ArrayList<Long>();
for(int i = 0;i < n;i++) {
l.add(sc.nextLong());
}
if(l.contains(0L)) {
System.out.println(0);
}else {
Long max = 1000000000L * 1000000000;
Long sum = 1L;
for(Long l2:l) {
if(sum > max/l2) {
System.out.println(-1);
sum = 0L;
return;
}
sum *= l2;
}
System.out.println(sum);
}
sc.close();
}
}
|
[
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,
18,
13,
13,
41,
13,
4,
18,
13,
4,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
13,
30,
14,
2,
13,
17,
30,
0,
13,
18,
13,
13,
0,
13,
17,
3,
9,
41,
13,
4,
18,
13,
13,
0,
13,
8,
2,
13,
17,
4,
18,
13,
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
],
[
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
],
[
25,
26
],
[
25,
27
],
[
11,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
30,
33
],
[
33,
34
],
[
34,
35
],
[
33,
36
],
[
33,
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
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
50,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
63,
69
],
[
69,
70
],
[
69,
71
],
[
63,
72
],
[
58,
73
],
[
50,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
50,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
82,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
50,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
96,
99
],
[
95,
100
],
[
94,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
11,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
113,
114
],
[
105,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
116,
121
],
[
9,
122
],
[
122,
123
],
[
0,
124
],
[
124,
125
],
[
124,
126
]
] |
[
"import java.math.BigInteger;\nimport java.util.Scanner;\n\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\n\t //入力数字の数を入力\n\t\tScanner sc=new Scanner(System.in);\n\n\t int count=sc.nextInt();\n\n\t\tboolean isOverflow = false; // 桁あふれしたかフラグ\n\t\tBigInteger result=BigInteger.ZERO;\n\t\tBigInteger max=BigInteger.valueOf((long)Math.pow(10, 18));\n\n\t //入力処理\n\t\tfor(int i = 0; i < count; i++) {\n\t\t\tlong a = sc.nextLong();\n\n\t\t\t// 桁あふれしている時は、それ以降ゼロが現れるかチェックする\n\t\t\tif (isOverflow) {\n\t\t\t\t// 桁あふれ後にゼロが出てきたとき\n\t\t\t\tif (a == (long)0) {\n\t\t\t\t\t// 求める値はゼロになる\n\t\t\t\t\tresult = BigInteger.ZERO;\n\t\t\t\t\tisOverflow = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// 次の値を処理する\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// 積を求める\n\t\t\tBigInteger nyuryoku=BigInteger.valueOf(a);\n\t\t\tresult= i==0 ? result.add(nyuryoku):result.multiply(nyuryoku);\n\t\t\t// 桁あふれしているか?\n\t\t\tif (result.compareTo(max) > 0) {\n\t\t\t\tisOverflow = true;\n\t\t\t}\n\t\t}\n\n\t\t// 結果を出力する\n\t\tif(isOverflow) {\n\t\t\t// 桁あふれ時は「-1」\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(result);\n\t\t}\n\t}\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\n\t //入力数字の数を入力\n\t\tScanner sc=new Scanner(System.in);\n\n\t int count=sc.nextInt();\n\n\t\tboolean isOverflow = false; // 桁あふれしたかフラグ\n\t\tBigInteger result=BigInteger.ZERO;\n\t\tBigInteger max=BigInteger.valueOf((long)Math.pow(10, 18));\n\n\t //入力処理\n\t\tfor(int i = 0; i < count; i++) {\n\t\t\tlong a = sc.nextLong();\n\n\t\t\t// 桁あふれしている時は、それ以降ゼロが現れるかチェックする\n\t\t\tif (isOverflow) {\n\t\t\t\t// 桁あふれ後にゼロが出てきたとき\n\t\t\t\tif (a == (long)0) {\n\t\t\t\t\t// 求める値はゼロになる\n\t\t\t\t\tresult = BigInteger.ZERO;\n\t\t\t\t\tisOverflow = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// 次の値を処理する\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// 積を求める\n\t\t\tBigInteger nyuryoku=BigInteger.valueOf(a);\n\t\t\tresult= i==0 ? result.add(nyuryoku):result.multiply(nyuryoku);\n\t\t\t// 桁あふれしているか?\n\t\t\tif (result.compareTo(max) > 0) {\n\t\t\t\tisOverflow = true;\n\t\t\t}\n\t\t}\n\n\t\t// 結果を出力する\n\t\tif(isOverflow) {\n\t\t\t// 桁あふれ時は「-1」\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(result);\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\n\t //入力数字の数を入力\n\t\tScanner sc=new Scanner(System.in);\n\n\t int count=sc.nextInt();\n\n\t\tboolean isOverflow = false; // 桁あふれしたかフラグ\n\t\tBigInteger result=BigInteger.ZERO;\n\t\tBigInteger max=BigInteger.valueOf((long)Math.pow(10, 18));\n\n\t //入力処理\n\t\tfor(int i = 0; i < count; i++) {\n\t\t\tlong a = sc.nextLong();\n\n\t\t\t// 桁あふれしている時は、それ以降ゼロが現れるかチェックする\n\t\t\tif (isOverflow) {\n\t\t\t\t// 桁あふれ後にゼロが出てきたとき\n\t\t\t\tif (a == (long)0) {\n\t\t\t\t\t// 求める値はゼロになる\n\t\t\t\t\tresult = BigInteger.ZERO;\n\t\t\t\t\tisOverflow = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// 次の値を処理する\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// 積を求める\n\t\t\tBigInteger nyuryoku=BigInteger.valueOf(a);\n\t\t\tresult= i==0 ? result.add(nyuryoku):result.multiply(nyuryoku);\n\t\t\t// 桁あふれしているか?\n\t\t\tif (result.compareTo(max) > 0) {\n\t\t\t\tisOverflow = true;\n\t\t\t}\n\t\t}\n\n\t\t// 結果を出力する\n\t\tif(isOverflow) {\n\t\t\t// 桁あふれ時は「-1」\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(result);\n\t\t}\n\t}",
"main",
"{\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\n\t //入力数字の数を入力\n\t\tScanner sc=new Scanner(System.in);\n\n\t int count=sc.nextInt();\n\n\t\tboolean isOverflow = false; // 桁あふれしたかフラグ\n\t\tBigInteger result=BigInteger.ZERO;\n\t\tBigInteger max=BigInteger.valueOf((long)Math.pow(10, 18));\n\n\t //入力処理\n\t\tfor(int i = 0; i < count; i++) {\n\t\t\tlong a = sc.nextLong();\n\n\t\t\t// 桁あふれしている時は、それ以降ゼロが現れるかチェックする\n\t\t\tif (isOverflow) {\n\t\t\t\t// 桁あふれ後にゼロが出てきたとき\n\t\t\t\tif (a == (long)0) {\n\t\t\t\t\t// 求める値はゼロになる\n\t\t\t\t\tresult = BigInteger.ZERO;\n\t\t\t\t\tisOverflow = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// 次の値を処理する\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// 積を求める\n\t\t\tBigInteger nyuryoku=BigInteger.valueOf(a);\n\t\t\tresult= i==0 ? result.add(nyuryoku):result.multiply(nyuryoku);\n\t\t\t// 桁あふれしているか?\n\t\t\tif (result.compareTo(max) > 0) {\n\t\t\t\tisOverflow = true;\n\t\t\t}\n\t\t}\n\n\t\t// 結果を出力する\n\t\tif(isOverflow) {\n\t\t\t// 桁あふれ時は「-1」\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(result);\n\t\t}\n\t}",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int count=sc.nextInt();",
"count",
"sc.nextInt()",
"sc.nextInt",
"sc",
"boolean isOverflow = false;",
"isOverflow",
"false",
"BigInteger result=BigInteger.ZERO;",
"result",
"BigInteger.ZERO",
"BigInteger",
"BigInteger.ZERO",
"BigInteger max=BigInteger.valueOf((long)Math.pow(10, 18));",
"max",
"BigInteger.valueOf((long)Math.pow(10, 18))",
"BigInteger.valueOf",
"BigInteger",
"(long)Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"for(int i = 0; i < count; i++) {\n\t\t\tlong a = sc.nextLong();\n\n\t\t\t// 桁あふれしている時は、それ以降ゼロが現れるかチェックする\n\t\t\tif (isOverflow) {\n\t\t\t\t// 桁あふれ後にゼロが出てきたとき\n\t\t\t\tif (a == (long)0) {\n\t\t\t\t\t// 求める値はゼロになる\n\t\t\t\t\tresult = BigInteger.ZERO;\n\t\t\t\t\tisOverflow = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// 次の値を処理する\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// 積を求める\n\t\t\tBigInteger nyuryoku=BigInteger.valueOf(a);\n\t\t\tresult= i==0 ? result.add(nyuryoku):result.multiply(nyuryoku);\n\t\t\t// 桁あふれしているか?\n\t\t\tif (result.compareTo(max) > 0) {\n\t\t\t\tisOverflow = true;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < count",
"i",
"count",
"i++",
"i++",
"i",
"{\n\t\t\tlong a = sc.nextLong();\n\n\t\t\t// 桁あふれしている時は、それ以降ゼロが現れるかチェックする\n\t\t\tif (isOverflow) {\n\t\t\t\t// 桁あふれ後にゼロが出てきたとき\n\t\t\t\tif (a == (long)0) {\n\t\t\t\t\t// 求める値はゼロになる\n\t\t\t\t\tresult = BigInteger.ZERO;\n\t\t\t\t\tisOverflow = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// 次の値を処理する\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// 積を求める\n\t\t\tBigInteger nyuryoku=BigInteger.valueOf(a);\n\t\t\tresult= i==0 ? result.add(nyuryoku):result.multiply(nyuryoku);\n\t\t\t// 桁あふれしているか?\n\t\t\tif (result.compareTo(max) > 0) {\n\t\t\t\tisOverflow = true;\n\t\t\t}\n\t\t}",
"{\n\t\t\tlong a = sc.nextLong();\n\n\t\t\t// 桁あふれしている時は、それ以降ゼロが現れるかチェックする\n\t\t\tif (isOverflow) {\n\t\t\t\t// 桁あふれ後にゼロが出てきたとき\n\t\t\t\tif (a == (long)0) {\n\t\t\t\t\t// 求める値はゼロになる\n\t\t\t\t\tresult = BigInteger.ZERO;\n\t\t\t\t\tisOverflow = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// 次の値を処理する\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// 積を求める\n\t\t\tBigInteger nyuryoku=BigInteger.valueOf(a);\n\t\t\tresult= i==0 ? result.add(nyuryoku):result.multiply(nyuryoku);\n\t\t\t// 桁あふれしているか?\n\t\t\tif (result.compareTo(max) > 0) {\n\t\t\t\tisOverflow = true;\n\t\t\t}\n\t\t}",
"long a = sc.nextLong();",
"a",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (isOverflow) {\n\t\t\t\t// 桁あふれ後にゼロが出てきたとき\n\t\t\t\tif (a == (long)0) {\n\t\t\t\t\t// 求める値はゼロになる\n\t\t\t\t\tresult = BigInteger.ZERO;\n\t\t\t\t\tisOverflow = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// 次の値を処理する\n\t\t\t\tcontinue;\n\t\t\t}",
"isOverflow",
"{\n\t\t\t\t// 桁あふれ後にゼロが出てきたとき\n\t\t\t\tif (a == (long)0) {\n\t\t\t\t\t// 求める値はゼロになる\n\t\t\t\t\tresult = BigInteger.ZERO;\n\t\t\t\t\tisOverflow = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// 次の値を処理する\n\t\t\t\tcontinue;\n\t\t\t}",
"if (a == (long)0) {\n\t\t\t\t\t// 求める値はゼロになる\n\t\t\t\t\tresult = BigInteger.ZERO;\n\t\t\t\t\tisOverflow = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"a == (long)0",
"a",
"(long)0",
"{\n\t\t\t\t\t// 求める値はゼロになる\n\t\t\t\t\tresult = BigInteger.ZERO;\n\t\t\t\t\tisOverflow = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"result = BigInteger.ZERO",
"result",
"BigInteger.ZERO",
"BigInteger",
"BigInteger.ZERO",
"isOverflow = false",
"isOverflow",
"false",
"break;",
"continue;",
"BigInteger nyuryoku=BigInteger.valueOf(a);",
"nyuryoku",
"BigInteger.valueOf(a)",
"BigInteger.valueOf",
"BigInteger",
"a",
"result= i==0 ? result.add(nyuryoku):result.multiply(nyuryoku)",
"result",
"i==0 ? result.add(nyuryoku):result.multiply(nyuryoku)",
"i==0",
"i",
"0",
"result.add(nyuryoku)",
"result.add",
"result",
"nyuryoku",
"result.multiply(nyuryoku)",
"result.multiply",
"result",
"nyuryoku",
"if (result.compareTo(max) > 0) {\n\t\t\t\tisOverflow = true;\n\t\t\t}",
"result.compareTo(max) > 0",
"result.compareTo(max)",
"result.compareTo",
"result",
"max",
"0",
"{\n\t\t\t\tisOverflow = true;\n\t\t\t}",
"isOverflow = true",
"isOverflow",
"true",
"if(isOverflow) {\n\t\t\t// 桁あふれ時は「-1」\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(result);\n\t\t}",
"isOverflow",
"{\n\t\t\t// 桁あふれ時は「-1」\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(result);\n\t\t}",
"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\t\t// TODO 自動生成されたメソッド・スタブ\n\n\n\t //入力数字の数を入力\n\t\tScanner sc=new Scanner(System.in);\n\n\t int count=sc.nextInt();\n\n\t\tboolean isOverflow = false; // 桁あふれしたかフラグ\n\t\tBigInteger result=BigInteger.ZERO;\n\t\tBigInteger max=BigInteger.valueOf((long)Math.pow(10, 18));\n\n\t //入力処理\n\t\tfor(int i = 0; i < count; i++) {\n\t\t\tlong a = sc.nextLong();\n\n\t\t\t// 桁あふれしている時は、それ以降ゼロが現れるかチェックする\n\t\t\tif (isOverflow) {\n\t\t\t\t// 桁あふれ後にゼロが出てきたとき\n\t\t\t\tif (a == (long)0) {\n\t\t\t\t\t// 求める値はゼロになる\n\t\t\t\t\tresult = BigInteger.ZERO;\n\t\t\t\t\tisOverflow = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// 次の値を処理する\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// 積を求める\n\t\t\tBigInteger nyuryoku=BigInteger.valueOf(a);\n\t\t\tresult= i==0 ? result.add(nyuryoku):result.multiply(nyuryoku);\n\t\t\t// 桁あふれしているか?\n\t\t\tif (result.compareTo(max) > 0) {\n\t\t\t\tisOverflow = true;\n\t\t\t}\n\t\t}\n\n\t\t// 結果を出力する\n\t\tif(isOverflow) {\n\t\t\t// 桁あふれ時は「-1」\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(result);\n\t\t}\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\n\t //入力数字の数を入力\n\t\tScanner sc=new Scanner(System.in);\n\n\t int count=sc.nextInt();\n\n\t\tboolean isOverflow = false; // 桁あふれしたかフラグ\n\t\tBigInteger result=BigInteger.ZERO;\n\t\tBigInteger max=BigInteger.valueOf((long)Math.pow(10, 18));\n\n\t //入力処理\n\t\tfor(int i = 0; i < count; i++) {\n\t\t\tlong a = sc.nextLong();\n\n\t\t\t// 桁あふれしている時は、それ以降ゼロが現れるかチェックする\n\t\t\tif (isOverflow) {\n\t\t\t\t// 桁あふれ後にゼロが出てきたとき\n\t\t\t\tif (a == (long)0) {\n\t\t\t\t\t// 求める値はゼロになる\n\t\t\t\t\tresult = BigInteger.ZERO;\n\t\t\t\t\tisOverflow = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// 次の値を処理する\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// 積を求める\n\t\t\tBigInteger nyuryoku=BigInteger.valueOf(a);\n\t\t\tresult= i==0 ? result.add(nyuryoku):result.multiply(nyuryoku);\n\t\t\t// 桁あふれしているか?\n\t\t\tif (result.compareTo(max) > 0) {\n\t\t\t\tisOverflow = true;\n\t\t\t}\n\t\t}\n\n\t\t// 結果を出力する\n\t\tif(isOverflow) {\n\t\t\t// 桁あふれ時は「-1」\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(result);\n\t\t}\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 count=sc.nextInt();
boolean isOverflow = false; // 桁あふれしたかフラグ
BigInteger result=BigInteger.ZERO;
BigInteger max=BigInteger.valueOf((long)Math.pow(10, 18));
//入力処理
for(int i = 0; i < count; i++) {
long a = sc.nextLong();
// 桁あふれしている時は、それ以降ゼロが現れるかチェックする
if (isOverflow) {
// 桁あふれ後にゼロが出てきたとき
if (a == (long)0) {
// 求める値はゼロになる
result = BigInteger.ZERO;
isOverflow = false;
break;
}
// 次の値を処理する
continue;
}
// 積を求める
BigInteger nyuryoku=BigInteger.valueOf(a);
result= i==0 ? result.add(nyuryoku):result.multiply(nyuryoku);
// 桁あふれしているか?
if (result.compareTo(max) > 0) {
isOverflow = true;
}
}
// 結果を出力する
if(isOverflow) {
// 桁あふれ時は「-1」
System.out.println(-1);
} else {
System.out.println(result);
}
}
}
|
[
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,
17,
11,
1,
41,
13,
17,
2,
13,
13,
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,
14,
2,
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
],
[
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
],
[
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
],
[
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
],
[
71,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
8,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
99,
104
],
[
94,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
111,
112
],
[
6,
113
],
[
113,
114
],
[
0,
115
],
[
115,
116
],
[
115,
117
]
] |
[
"import java.util.Scanner;\npublic class Main {\n\tpublic static void main(String[] args) {\n\n//\t入力の読み込み\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N]; //Aという配列を作成。N+1個の配列がある。\n\n//\tいずれかのAに0が含まれる場合\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\n//\tAへの入力の時点で結果が「-1」になる場合\n\t\tlong total = 1; //計算結果を表す変数\n\t\tfor(int i=0 ; i<N ; i++) {\n\t\t\tif(A[i] > 1000000000000000000L / total) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal *= A[i];\n\t\t\t}\n\t\t}\n\n//\t計算してみないと「-1」になるかわからない場合\n\t\tif(total <= 1000000000000000000L) {\n\t\t\tSystem.out.print(total);\n\t\t}\n\t\telse {\n\t\t\tSystem.out.print(-1);\n\t\t}\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\n//\t入力の読み込み\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N]; //Aという配列を作成。N+1個の配列がある。\n\n//\tいずれかのAに0が含まれる場合\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\n//\tAへの入力の時点で結果が「-1」になる場合\n\t\tlong total = 1; //計算結果を表す変数\n\t\tfor(int i=0 ; i<N ; i++) {\n\t\t\tif(A[i] > 1000000000000000000L / total) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal *= A[i];\n\t\t\t}\n\t\t}\n\n//\t計算してみないと「-1」になるかわからない場合\n\t\tif(total <= 1000000000000000000L) {\n\t\t\tSystem.out.print(total);\n\t\t}\n\t\telse {\n\t\t\tSystem.out.print(-1);\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\n//\t入力の読み込み\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N]; //Aという配列を作成。N+1個の配列がある。\n\n//\tいずれかのAに0が含まれる場合\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\n//\tAへの入力の時点で結果が「-1」になる場合\n\t\tlong total = 1; //計算結果を表す変数\n\t\tfor(int i=0 ; i<N ; i++) {\n\t\t\tif(A[i] > 1000000000000000000L / total) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal *= A[i];\n\t\t\t}\n\t\t}\n\n//\t計算してみないと「-1」になるかわからない場合\n\t\tif(total <= 1000000000000000000L) {\n\t\t\tSystem.out.print(total);\n\t\t}\n\t\telse {\n\t\t\tSystem.out.print(-1);\n\t\t}\n\t}",
"main",
"{\n\n//\t入力の読み込み\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N]; //Aという配列を作成。N+1個の配列がある。\n\n//\tいずれかのAに0が含まれる場合\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\n//\tAへの入力の時点で結果が「-1」になる場合\n\t\tlong total = 1; //計算結果を表す変数\n\t\tfor(int i=0 ; i<N ; i++) {\n\t\t\tif(A[i] > 1000000000000000000L / total) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal *= A[i];\n\t\t\t}\n\t\t}\n\n//\t計算してみないと「-1」になるかわからない場合\n\t\tif(total <= 1000000000000000000L) {\n\t\t\tSystem.out.print(total);\n\t\t}\n\t\telse {\n\t\t\tSystem.out.print(-1);\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",
"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 total = 1;",
"total",
"1",
"for(int i=0 ; i<N ; i++) {\n\t\t\tif(A[i] > 1000000000000000000L / total) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal *= 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\tif(A[i] > 1000000000000000000L / total) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal *= A[i];\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(A[i] > 1000000000000000000L / total) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal *= A[i];\n\t\t\t}\n\t\t}",
"if(A[i] > 1000000000000000000L / total) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal *= A[i];\n\t\t\t}",
"A[i] > 1000000000000000000L / total",
"A[i]",
"A",
"i",
"1000000000000000000L / total",
"1000000000000000000L",
"total",
"{\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\ttotal *= A[i];\n\t\t\t}",
"total *= A[i]",
"total",
"A[i]",
"A",
"i",
"if(total <= 1000000000000000000L) {\n\t\t\tSystem.out.print(total);\n\t\t}\n\t\telse {\n\t\t\tSystem.out.print(-1);\n\t\t}",
"total <= 1000000000000000000L",
"total",
"1000000000000000000L",
"{\n\t\t\tSystem.out.print(total);\n\t\t}",
"System.out.print(total)",
"System.out.print",
"System.out",
"System",
"System.out",
"total",
"{\n\t\t\tSystem.out.print(-1);\n\t\t}",
"System.out.print(-1)",
"System.out.print",
"System.out",
"System",
"System.out",
"-1",
"1",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\n//\t入力の読み込み\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N]; //Aという配列を作成。N+1個の配列がある。\n\n//\tいずれかのAに0が含まれる場合\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\n//\tAへの入力の時点で結果が「-1」になる場合\n\t\tlong total = 1; //計算結果を表す変数\n\t\tfor(int i=0 ; i<N ; i++) {\n\t\t\tif(A[i] > 1000000000000000000L / total) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal *= A[i];\n\t\t\t}\n\t\t}\n\n//\t計算してみないと「-1」になるかわからない場合\n\t\tif(total <= 1000000000000000000L) {\n\t\t\tSystem.out.print(total);\n\t\t}\n\t\telse {\n\t\t\tSystem.out.print(-1);\n\t\t}\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\n//\t入力の読み込み\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N]; //Aという配列を作成。N+1個の配列がある。\n\n//\tいずれかのAに0が含まれる場合\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\n//\tAへの入力の時点で結果が「-1」になる場合\n\t\tlong total = 1; //計算結果を表す変数\n\t\tfor(int i=0 ; i<N ; i++) {\n\t\t\tif(A[i] > 1000000000000000000L / total) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal *= A[i];\n\t\t\t}\n\t\t}\n\n//\t計算してみないと「-1」になるかわからない場合\n\t\tif(total <= 1000000000000000000L) {\n\t\t\tSystem.out.print(total);\n\t\t}\n\t\telse {\n\t\t\tSystem.out.print(-1);\n\t\t}\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]; //Aという配列を作成。N+1個の配列がある。
// いずれかのAに0が含まれる場合
for(int i=0 ; i<N ; i++) {
A[i]=sc.nextLong(); //入力された配列の読み込み
if(A[i] == 0) {
System.out.println(0);
return;
}
}
// Aへの入力の時点で結果が「-1」になる場合
long total = 1; //計算結果を表す変数
for(int i=0 ; i<N ; i++) {
if(A[i] > 1000000000000000000L / total) {
System.out.println(-1);
return;
}
else {
total *= A[i];
}
}
// 計算してみないと「-1」になるかわからない場合
if(total <= 1000000000000000000L) {
System.out.print(total);
}
else {
System.out.print(-1);
}
}
}
|
[
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,
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,
13,
4,
18,
13,
14,
2,
13,
17,
30,
0,
13,
17,
3,
41,
13,
18,
13,
13,
14,
2,
4,
18,
4,
18,
20,
20,
20,
40,
17,
30,
0,
13,
13,
30,
0,
13,
13,
14,
2,
2,
13,
13,
2,
13,
17,
30,
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
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
114,
8
],
[
114,
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
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
11,
28
],
[
28,
29
],
[
28,
30
],
[
11,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
34,
35
],
[
33,
36
],
[
33,
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
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
50,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
64
],
[
50,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
67,
69
],
[
50,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
72,
78
],
[
71,
79
],
[
79,
80
],
[
70,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
70,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
50,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
94,
95
],
[
94,
96
],
[
89,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
11,
102
],
[
102,
103
],
[
103,
104
],
[
11,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
9,
111
],
[
111,
112
],
[
0,
113
],
[
113,
114
],
[
113,
115
]
] |
[
"import java.math.BigDecimal;\nimport java.util.Scanner;\n\npublic class Main\n{\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tString str = sc.nextLine();\n\t\tlong b = 0;\n\t\tlong ans = 1;\n\t\tlong c = (long)Math.pow(10, 18);\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tb = sc.nextLong();\n\t\t\tif (b == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlong ans2 = Long.MAX_VALUE;\n\t\t\tif(new BigDecimal(ans).multiply(new BigDecimal(b)).compareTo(new BigDecimal(ans2)) == -1) {\n\t\t\t\tans *= b ;\n\t\t\t} else {\n\t\t\t\tans = ans2;\n\t\t\t}\n\t\t\tif (ans > c || ans < 0) {\n\t\t\t\tans = -1;\n\t\t\t}\n\t\t}\n\t\tsc.close();\n\n\t\tSystem.out.println(ans);\n\t}\n}\n\n",
"import java.math.BigDecimal;",
"BigDecimal",
"java.math",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main\n{\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tString str = sc.nextLine();\n\t\tlong b = 0;\n\t\tlong ans = 1;\n\t\tlong c = (long)Math.pow(10, 18);\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tb = sc.nextLong();\n\t\t\tif (b == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlong ans2 = Long.MAX_VALUE;\n\t\t\tif(new BigDecimal(ans).multiply(new BigDecimal(b)).compareTo(new BigDecimal(ans2)) == -1) {\n\t\t\t\tans *= b ;\n\t\t\t} else {\n\t\t\t\tans = ans2;\n\t\t\t}\n\t\t\tif (ans > c || ans < 0) {\n\t\t\t\tans = -1;\n\t\t\t}\n\t\t}\n\t\tsc.close();\n\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main",
"public static void main(String[] args)\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tString str = sc.nextLine();\n\t\tlong b = 0;\n\t\tlong ans = 1;\n\t\tlong c = (long)Math.pow(10, 18);\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tb = sc.nextLong();\n\t\t\tif (b == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlong ans2 = Long.MAX_VALUE;\n\t\t\tif(new BigDecimal(ans).multiply(new BigDecimal(b)).compareTo(new BigDecimal(ans2)) == -1) {\n\t\t\t\tans *= b ;\n\t\t\t} else {\n\t\t\t\tans = ans2;\n\t\t\t}\n\t\t\tif (ans > c || ans < 0) {\n\t\t\t\tans = -1;\n\t\t\t}\n\t\t}\n\t\tsc.close();\n\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\tString str = sc.nextLine();\n\t\tlong b = 0;\n\t\tlong ans = 1;\n\t\tlong c = (long)Math.pow(10, 18);\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tb = sc.nextLong();\n\t\t\tif (b == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlong ans2 = Long.MAX_VALUE;\n\t\t\tif(new BigDecimal(ans).multiply(new BigDecimal(b)).compareTo(new BigDecimal(ans2)) == -1) {\n\t\t\t\tans *= b ;\n\t\t\t} else {\n\t\t\t\tans = ans2;\n\t\t\t}\n\t\t\tif (ans > c || ans < 0) {\n\t\t\t\tans = -1;\n\t\t\t}\n\t\t}\n\t\tsc.close();\n\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",
"String str = sc.nextLine();",
"str",
"sc.nextLine()",
"sc.nextLine",
"sc",
"long b = 0;",
"b",
"0",
"long ans = 1;",
"ans",
"1",
"long c = (long)Math.pow(10, 18);",
"c",
"(long)Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"for (int i=0; i<n; i++) {\n\t\t\tb = sc.nextLong();\n\t\t\tif (b == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlong ans2 = Long.MAX_VALUE;\n\t\t\tif(new BigDecimal(ans).multiply(new BigDecimal(b)).compareTo(new BigDecimal(ans2)) == -1) {\n\t\t\t\tans *= b ;\n\t\t\t} else {\n\t\t\t\tans = ans2;\n\t\t\t}\n\t\t\tif (ans > c || ans < 0) {\n\t\t\t\tans = -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\tb = sc.nextLong();\n\t\t\tif (b == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlong ans2 = Long.MAX_VALUE;\n\t\t\tif(new BigDecimal(ans).multiply(new BigDecimal(b)).compareTo(new BigDecimal(ans2)) == -1) {\n\t\t\t\tans *= b ;\n\t\t\t} else {\n\t\t\t\tans = ans2;\n\t\t\t}\n\t\t\tif (ans > c || ans < 0) {\n\t\t\t\tans = -1;\n\t\t\t}\n\t\t}",
"{\n\t\t\tb = sc.nextLong();\n\t\t\tif (b == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlong ans2 = Long.MAX_VALUE;\n\t\t\tif(new BigDecimal(ans).multiply(new BigDecimal(b)).compareTo(new BigDecimal(ans2)) == -1) {\n\t\t\t\tans *= b ;\n\t\t\t} else {\n\t\t\t\tans = ans2;\n\t\t\t}\n\t\t\tif (ans > c || ans < 0) {\n\t\t\t\tans = -1;\n\t\t\t}\n\t\t}",
"b = sc.nextLong()",
"b",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (b == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}",
"b == 0",
"b",
"0",
"{\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}",
"ans = 0",
"ans",
"0",
"break;",
"long ans2 = Long.MAX_VALUE;",
"ans2",
"Long.MAX_VALUE",
"Long",
"Long.MAX_VALUE",
"if(new BigDecimal(ans).multiply(new BigDecimal(b)).compareTo(new BigDecimal(ans2)) == -1) {\n\t\t\t\tans *= b ;\n\t\t\t} else {\n\t\t\t\tans = ans2;\n\t\t\t}",
"new BigDecimal(ans).multiply(new BigDecimal(b)).compareTo(new BigDecimal(ans2)) == -1",
"new BigDecimal(ans).multiply(new BigDecimal(b)).compareTo(new BigDecimal(ans2))",
"new BigDecimal(ans).multiply(new BigDecimal(b)).compareTo",
"new BigDecimal(ans).multiply(new BigDecimal(b))",
"new BigDecimal(ans).multiply",
"new BigDecimal(ans)",
"new BigDecimal(b)",
"new BigDecimal(ans2)",
"-1",
"1",
"{\n\t\t\t\tans *= b ;\n\t\t\t}",
"ans *= b",
"ans",
"b",
"{\n\t\t\t\tans = ans2;\n\t\t\t}",
"ans = ans2",
"ans",
"ans2",
"if (ans > c || ans < 0) {\n\t\t\t\tans = -1;\n\t\t\t}",
"ans > c || ans < 0",
"ans > c",
"ans",
"c",
"ans < 0",
"ans",
"0",
"{\n\t\t\t\tans = -1;\n\t\t\t}",
"ans = -1",
"ans",
"-1",
"1",
"sc.close()",
"sc.close",
"sc",
"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\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tString str = sc.nextLine();\n\t\tlong b = 0;\n\t\tlong ans = 1;\n\t\tlong c = (long)Math.pow(10, 18);\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tb = sc.nextLong();\n\t\t\tif (b == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlong ans2 = Long.MAX_VALUE;\n\t\t\tif(new BigDecimal(ans).multiply(new BigDecimal(b)).compareTo(new BigDecimal(ans2)) == -1) {\n\t\t\t\tans *= b ;\n\t\t\t} else {\n\t\t\t\tans = ans2;\n\t\t\t}\n\t\t\tif (ans > c || ans < 0) {\n\t\t\t\tans = -1;\n\t\t\t}\n\t\t}\n\t\tsc.close();\n\n\t\tSystem.out.println(ans);\n\t}\n}",
"public class Main\n{\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tString str = sc.nextLine();\n\t\tlong b = 0;\n\t\tlong ans = 1;\n\t\tlong c = (long)Math.pow(10, 18);\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tb = sc.nextLong();\n\t\t\tif (b == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlong ans2 = Long.MAX_VALUE;\n\t\t\tif(new BigDecimal(ans).multiply(new BigDecimal(b)).compareTo(new BigDecimal(ans2)) == -1) {\n\t\t\t\tans *= b ;\n\t\t\t} else {\n\t\t\t\tans = ans2;\n\t\t\t}\n\t\t\tif (ans > c || ans < 0) {\n\t\t\t\tans = -1;\n\t\t\t}\n\t\t}\n\t\tsc.close();\n\n\t\tSystem.out.println(ans);\n\t}\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 str = sc.nextLine();
long b = 0;
long ans = 1;
long c = (long)Math.pow(10, 18);
for (int i=0; i<n; i++) {
b = sc.nextLong();
if (b == 0) {
ans = 0;
break;
}
long ans2 = Long.MAX_VALUE;
if(new BigDecimal(ans).multiply(new BigDecimal(b)).compareTo(new BigDecimal(ans2)) == -1) {
ans *= b ;
} else {
ans = ans2;
}
if (ans > c || ans < 0) {
ans = -1;
}
}
sc.close();
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,
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,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
2,
13,
18,
13,
13,
14,
2,
2,
13,
13,
2,
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
],
[
120,
5
],
[
120,
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
],
[
31,
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
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
61,
66
],
[
60,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
8,
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
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
83,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
96,
98
],
[
91,
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
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
6,
117
],
[
117,
118
],
[
0,
119
],
[
119,
120
],
[
119,
121
]
] |
[
"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 A[] =new long[N];\n double e =Math.pow(10,18);\n long f =(long) e;long l =1;\n for(int j=0;j<N;j++){\n A[j]=sc.nextLong();if(A[j]==0){System.out.println(0);System.exit(0);}}\n for(int i=0;i<N;i++){\n l=l*A[i];\n if(l>f||l<=0){System.out.println(-1);System.exit(0);}}\n System.out.println(l);\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 A[] =new long[N];\n double e =Math.pow(10,18);\n long f =(long) e;long l =1;\n for(int j=0;j<N;j++){\n A[j]=sc.nextLong();if(A[j]==0){System.out.println(0);System.exit(0);}}\n for(int i=0;i<N;i++){\n l=l*A[i];\n if(l>f||l<=0){System.out.println(-1);System.exit(0);}}\n System.out.println(l);\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 double e =Math.pow(10,18);\n long f =(long) e;long l =1;\n for(int j=0;j<N;j++){\n A[j]=sc.nextLong();if(A[j]==0){System.out.println(0);System.exit(0);}}\n for(int i=0;i<N;i++){\n l=l*A[i];\n if(l>f||l<=0){System.out.println(-1);System.exit(0);}}\n System.out.println(l);\n }",
"main",
"{\n Scanner sc =new Scanner(System.in);\n int N =sc.nextInt();\n long A[] =new long[N];\n double e =Math.pow(10,18);\n long f =(long) e;long l =1;\n for(int j=0;j<N;j++){\n A[j]=sc.nextLong();if(A[j]==0){System.out.println(0);System.exit(0);}}\n for(int i=0;i<N;i++){\n l=l*A[i];\n if(l>f||l<=0){System.out.println(-1);System.exit(0);}}\n System.out.println(l);\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",
"double e =Math.pow(10,18);",
"e",
"Math.pow(10,18)",
"Math.pow",
"Math",
"10",
"18",
"long f =(long) e;",
"f",
"(long) e",
"long l =1;",
"l",
"1",
"for(int j=0;j<N;j++){\n A[j]=sc.nextLong();if(A[j]==0){System.out.println(0);System.exit(0);}}",
"int j=0;",
"int j=0;",
"j",
"0",
"j<N",
"j",
"N",
"j++",
"j++",
"j",
"{\n A[j]=sc.nextLong();if(A[j]==0){System.out.println(0);System.exit(0);}}",
"{\n A[j]=sc.nextLong();if(A[j]==0){System.out.println(0);System.exit(0);}}",
"A[j]=sc.nextLong()",
"A[j]",
"A",
"j",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(A[j]==0){System.out.println(0);System.exit(0);}",
"A[j]==0",
"A[j]",
"A",
"j",
"0",
"{System.out.println(0);System.exit(0);}",
"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 l=l*A[i];\n if(l>f||l<=0){System.out.println(-1);System.exit(0);}}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n l=l*A[i];\n if(l>f||l<=0){System.out.println(-1);System.exit(0);}}",
"{\n l=l*A[i];\n if(l>f||l<=0){System.out.println(-1);System.exit(0);}}",
"l=l*A[i]",
"l",
"l*A[i]",
"l",
"A[i]",
"A",
"i",
"if(l>f||l<=0){System.out.println(-1);System.exit(0);}",
"l>f||l<=0",
"l>f",
"l",
"f",
"l<=0",
"l",
"0",
"{System.out.println(-1);System.exit(0);}",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"System.exit(0)",
"System.exit",
"System",
"0",
"System.out.println(l)",
"System.out.println",
"System.out",
"System",
"System.out",
"l",
"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 double e =Math.pow(10,18);\n long f =(long) e;long l =1;\n for(int j=0;j<N;j++){\n A[j]=sc.nextLong();if(A[j]==0){System.out.println(0);System.exit(0);}}\n for(int i=0;i<N;i++){\n l=l*A[i];\n if(l>f||l<=0){System.out.println(-1);System.exit(0);}}\n System.out.println(l);\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 double e =Math.pow(10,18);\n long f =(long) e;long l =1;\n for(int j=0;j<N;j++){\n A[j]=sc.nextLong();if(A[j]==0){System.out.println(0);System.exit(0);}}\n for(int i=0;i<N;i++){\n l=l*A[i];\n if(l>f||l<=0){System.out.println(-1);System.exit(0);}}\n System.out.println(l);\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];
double e =Math.pow(10,18);
long f =(long) e;long l =1;
for(int j=0;j<N;j++){
A[j]=sc.nextLong();if(A[j]==0){System.out.println(0);System.exit(0);}}
for(int i=0;i<N;i++){
l=l*A[i];
if(l>f||l<=0){System.out.println(-1);System.exit(0);}}
System.out.println(l);
}
}
|
[
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,
3,
14,
2,
2,
13,
2,
17,
13,
2,
13,
40,
17,
30,
0,
13,
40,
17,
30,
0,
13,
2,
13,
13,
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
],
[
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
],
[
42,
46
],
[
32,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
51,
53
],
[
48,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
47,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
47,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
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 int n = sc.nextInt();\n long result = 1;\n\n for (int i=0;i<n;i++){\n long input = sc.nextLong();\n if (input == 0) { result = 0; break;}\n\n if (result > 1000000000000000000L/input || result == -1) {\n result = -1;\n } else {\n result = result * input;\n }\n }\n\n System.out.println(result);\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 result = 1;\n\n for (int i=0;i<n;i++){\n long input = sc.nextLong();\n if (input == 0) { result = 0; break;}\n\n if (result > 1000000000000000000L/input || result == -1) {\n result = -1;\n } else {\n result = result * input;\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 long result = 1;\n\n for (int i=0;i<n;i++){\n long input = sc.nextLong();\n if (input == 0) { result = 0; break;}\n\n if (result > 1000000000000000000L/input || result == -1) {\n result = -1;\n } else {\n result = result * input;\n }\n }\n\n System.out.println(result);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long result = 1;\n\n for (int i=0;i<n;i++){\n long input = sc.nextLong();\n if (input == 0) { result = 0; break;}\n\n if (result > 1000000000000000000L/input || result == -1) {\n result = -1;\n } else {\n result = result * input;\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",
"long result = 1;",
"result",
"1",
"for (int i=0;i<n;i++){\n long input = sc.nextLong();\n if (input == 0) { result = 0; break;}\n\n if (result > 1000000000000000000L/input || result == -1) {\n result = -1;\n } else {\n result = result * input;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n long input = sc.nextLong();\n if (input == 0) { result = 0; break;}\n\n if (result > 1000000000000000000L/input || result == -1) {\n result = -1;\n } else {\n result = result * input;\n }\n }",
"{\n long input = sc.nextLong();\n if (input == 0) { result = 0; break;}\n\n if (result > 1000000000000000000L/input || result == -1) {\n result = -1;\n } else {\n result = result * input;\n }\n }",
"long input = sc.nextLong();",
"input",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (input == 0) { result = 0; break;}",
"input == 0",
"input",
"0",
"{ result = 0; break;}",
"result = 0",
"result",
"0",
"break;",
"if (result > 1000000000000000000L/input || result == -1) {\n result = -1;\n } else {\n result = result * input;\n }",
"result > 1000000000000000000L/input || result == -1",
"result > 1000000000000000000L/input",
"result",
"1000000000000000000L/input",
"1000000000000000000L",
"input",
"result == -1",
"result",
"-1",
"1",
"{\n result = -1;\n }",
"result = -1",
"result",
"-1",
"1",
"{\n result = result * input;\n }",
"result = result * input",
"result",
"result * input",
"result",
"input",
"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 long result = 1;\n\n for (int i=0;i<n;i++){\n long input = sc.nextLong();\n if (input == 0) { result = 0; break;}\n\n if (result > 1000000000000000000L/input || result == -1) {\n result = -1;\n } else {\n result = result * input;\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 long result = 1;\n\n for (int i=0;i<n;i++){\n long input = sc.nextLong();\n if (input == 0) { result = 0; break;}\n\n if (result > 1000000000000000000L/input || result == -1) {\n result = -1;\n } else {\n result = result * input;\n }\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 n = sc.nextInt();
long result = 1;
for (int i=0;i<n;i++){
long input = sc.nextLong();
if (input == 0) { result = 0; break;}
if (result > 1000000000000000000L/input || result == -1) {
result = -1;
} else {
result = result * input;
}
}
System.out.println(result);
}
}
|
[
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,
17,
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,
13,
4,
18,
13,
41,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
4,
18,
13,
18,
13,
13,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
29,
0,
13,
4,
18,
13,
18,
13,
13,
4,
18,
18,
13,
13,
8,
2,
4,
18,
13,
4,
18,
13,
13,
17,
40,
17,
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
],
[
156,
20
],
[
156,
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
],
[
23,
35
],
[
35,
36
],
[
35,
37
],
[
23,
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
],
[
63,
64
],
[
63,
65
],
[
61,
66
],
[
66,
67
],
[
66,
68
],
[
60,
69
],
[
59,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
71,
76
],
[
70,
77
],
[
23,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
78,
82
],
[
82,
83
],
[
83,
84
],
[
23,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
23,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
95,
96
],
[
95,
97
],
[
90,
98
],
[
98,
99
],
[
99,
100
],
[
90,
101
],
[
102,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
107,
110
],
[
110,
111
],
[
110,
112
],
[
105,
113
],
[
113,
114
],
[
114,
115
],
[
113,
116
],
[
104,
117
],
[
103,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
124,
125
],
[
118,
126
],
[
102,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
130,
131
],
[
129,
132
],
[
132,
133
],
[
132,
134
],
[
23,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
135,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
142,
145
],
[
145,
146
],
[
146,
147
],
[
145,
148
],
[
141,
149
],
[
140,
150
],
[
150,
151
],
[
140,
152
],
[
21,
153
],
[
153,
154
],
[
0,
155
],
[
155,
156
],
[
155,
157
]
] |
[
"import java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.util.Arrays;\nimport java.util.Comparator;\nimport java.util.Scanner;\nimport java.util.stream.LongStream;\n\npublic class Main {\n\n public static void main(String[] args) {\n final Scanner sc = new Scanner(System.in);\n\n final long MAX = 1000000000000000000L;\n final int N = sc.nextInt();\n\n\n BigInteger[] A = new BigInteger[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 return;\n }\n }\n\n Arrays.sort(A, Comparator.reverseOrder());\n\n BigInteger ans = BigInteger.ONE;\n for (int i = 0; i < N; i++) {\n if (ans.multiply(A[i]).compareTo(BigInteger.valueOf(MAX)) > 0) {\n System.out.println(-1);\n return;\n }\n ans = ans.multiply(A[i]);\n }\n\n System.out.println(ans.compareTo(BigInteger.valueOf(MAX)) > 0 ? -1 : ans);\n }\n}",
"import java.math.BigDecimal;",
"BigDecimal",
"java.math",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Comparator;",
"Comparator",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.stream.LongStream;",
"LongStream",
"java.util.stream",
"public class Main {\n\n public static void main(String[] args) {\n final Scanner sc = new Scanner(System.in);\n\n final long MAX = 1000000000000000000L;\n final int N = sc.nextInt();\n\n\n BigInteger[] A = new BigInteger[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 return;\n }\n }\n\n Arrays.sort(A, Comparator.reverseOrder());\n\n BigInteger ans = BigInteger.ONE;\n for (int i = 0; i < N; i++) {\n if (ans.multiply(A[i]).compareTo(BigInteger.valueOf(MAX)) > 0) {\n System.out.println(-1);\n return;\n }\n ans = ans.multiply(A[i]);\n }\n\n System.out.println(ans.compareTo(BigInteger.valueOf(MAX)) > 0 ? -1 : ans);\n }\n}",
"Main",
"public static void main(String[] args) {\n final Scanner sc = new Scanner(System.in);\n\n final long MAX = 1000000000000000000L;\n final int N = sc.nextInt();\n\n\n BigInteger[] A = new BigInteger[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 return;\n }\n }\n\n Arrays.sort(A, Comparator.reverseOrder());\n\n BigInteger ans = BigInteger.ONE;\n for (int i = 0; i < N; i++) {\n if (ans.multiply(A[i]).compareTo(BigInteger.valueOf(MAX)) > 0) {\n System.out.println(-1);\n return;\n }\n ans = ans.multiply(A[i]);\n }\n\n System.out.println(ans.compareTo(BigInteger.valueOf(MAX)) > 0 ? -1 : ans);\n }",
"main",
"{\n final Scanner sc = new Scanner(System.in);\n\n final long MAX = 1000000000000000000L;\n final int N = sc.nextInt();\n\n\n BigInteger[] A = new BigInteger[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 return;\n }\n }\n\n Arrays.sort(A, Comparator.reverseOrder());\n\n BigInteger ans = BigInteger.ONE;\n for (int i = 0; i < N; i++) {\n if (ans.multiply(A[i]).compareTo(BigInteger.valueOf(MAX)) > 0) {\n System.out.println(-1);\n return;\n }\n ans = ans.multiply(A[i]);\n }\n\n System.out.println(ans.compareTo(BigInteger.valueOf(MAX)) > 0 ? -1 : ans);\n }",
"final Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"final long MAX = 1000000000000000000L;",
"MAX",
"1000000000000000000L",
"final 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].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 A[i] = sc.nextBigInteger();\n if (A[i].compareTo(BigInteger.ZERO) == 0) {\n System.out.println(0);\n return;\n }\n }",
"{\n A[i] = sc.nextBigInteger();\n if (A[i].compareTo(BigInteger.ZERO) == 0) {\n System.out.println(0);\n return;\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 return;\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 return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"Arrays.sort(A, Comparator.reverseOrder())",
"Arrays.sort",
"Arrays",
"A",
"Comparator.reverseOrder()",
"Comparator.reverseOrder",
"Comparator",
"BigInteger ans = BigInteger.ONE;",
"ans",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"for (int i = 0; i < N; i++) {\n if (ans.multiply(A[i]).compareTo(BigInteger.valueOf(MAX)) > 0) {\n System.out.println(-1);\n return;\n }\n ans = ans.multiply(A[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if (ans.multiply(A[i]).compareTo(BigInteger.valueOf(MAX)) > 0) {\n System.out.println(-1);\n return;\n }\n ans = ans.multiply(A[i]);\n }",
"{\n if (ans.multiply(A[i]).compareTo(BigInteger.valueOf(MAX)) > 0) {\n System.out.println(-1);\n return;\n }\n ans = ans.multiply(A[i]);\n }",
"if (ans.multiply(A[i]).compareTo(BigInteger.valueOf(MAX)) > 0) {\n System.out.println(-1);\n return;\n }",
"ans.multiply(A[i]).compareTo(BigInteger.valueOf(MAX)) > 0",
"ans.multiply(A[i]).compareTo(BigInteger.valueOf(MAX))",
"ans.multiply(A[i]).compareTo",
"ans.multiply(A[i])",
"ans.multiply",
"ans",
"A[i]",
"A",
"i",
"BigInteger.valueOf(MAX)",
"BigInteger.valueOf",
"BigInteger",
"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;",
"ans = ans.multiply(A[i])",
"ans",
"ans.multiply(A[i])",
"ans.multiply",
"ans",
"A[i]",
"A",
"i",
"System.out.println(ans.compareTo(BigInteger.valueOf(MAX)) > 0 ? -1 : ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans.compareTo(BigInteger.valueOf(MAX)) > 0 ? -1 : ans",
"ans.compareTo(BigInteger.valueOf(MAX)) > 0",
"ans.compareTo(BigInteger.valueOf(MAX))",
"ans.compareTo",
"ans",
"BigInteger.valueOf(MAX)",
"BigInteger.valueOf",
"BigInteger",
"MAX",
"0",
"-1",
"1",
"ans",
"String[] args",
"args",
"public class Main {\n\n public static void main(String[] args) {\n final Scanner sc = new Scanner(System.in);\n\n final long MAX = 1000000000000000000L;\n final int N = sc.nextInt();\n\n\n BigInteger[] A = new BigInteger[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 return;\n }\n }\n\n Arrays.sort(A, Comparator.reverseOrder());\n\n BigInteger ans = BigInteger.ONE;\n for (int i = 0; i < N; i++) {\n if (ans.multiply(A[i]).compareTo(BigInteger.valueOf(MAX)) > 0) {\n System.out.println(-1);\n return;\n }\n ans = ans.multiply(A[i]);\n }\n\n System.out.println(ans.compareTo(BigInteger.valueOf(MAX)) > 0 ? -1 : ans);\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n final Scanner sc = new Scanner(System.in);\n\n final long MAX = 1000000000000000000L;\n final int N = sc.nextInt();\n\n\n BigInteger[] A = new BigInteger[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 return;\n }\n }\n\n Arrays.sort(A, Comparator.reverseOrder());\n\n BigInteger ans = BigInteger.ONE;\n for (int i = 0; i < N; i++) {\n if (ans.multiply(A[i]).compareTo(BigInteger.valueOf(MAX)) > 0) {\n System.out.println(-1);\n return;\n }\n ans = ans.multiply(A[i]);\n }\n\n System.out.println(ans.compareTo(BigInteger.valueOf(MAX)) > 0 ? -1 : ans);\n }\n}",
"Main"
] |
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
import java.util.stream.LongStream;
public class Main {
public static void main(String[] args) {
final Scanner sc = new Scanner(System.in);
final long MAX = 1000000000000000000L;
final 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;
}
}
Arrays.sort(A, Comparator.reverseOrder());
BigInteger ans = BigInteger.ONE;
for (int i = 0; i < N; i++) {
if (ans.multiply(A[i]).compareTo(BigInteger.valueOf(MAX)) > 0) {
System.out.println(-1);
return;
}
ans = ans.multiply(A[i]);
}
System.out.println(ans.compareTo(BigInteger.valueOf(MAX)) > 0 ? -1 : 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,
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,
4,
18,
18,
13,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
17,
29,
41,
13,
4,
18,
18,
13,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
18,
13,
13,
13,
14,
2,
17,
4,
18,
13,
13,
30,
4,
18,
18,
13,
13,
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
],
[
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
],
[
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
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
49,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
59,
64
],
[
58,
65
],
[
11,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
68,
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
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
86,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
95,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
102,
109
],
[
11,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
9,
116
],
[
116,
117
],
[
0,
118
],
[
118,
119
],
[
118,
120
]
] |
[
"import java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n BigInteger[] b = new BigInteger[a];\n BigInteger total = BigInteger.ONE;\n for(int i =0; i<a; i++) {\n b[i] = sc.nextBigInteger();\n if(BigInteger.ZERO.equals(b[i])) {\n System.out.println(\"0\");\n return;\n }\n }\n BigInteger c = BigInteger.TEN.pow(18);\n for(int i =0; i<a; i++) {\n total = b[i].multiply(total);\n if(0 < total.compareTo(c) ) {\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(total);\n }\n}",
"import java.math.BigInteger;",
"BigInteger",
"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 a = sc.nextInt();\n BigInteger[] b = new BigInteger[a];\n BigInteger total = BigInteger.ONE;\n for(int i =0; i<a; i++) {\n b[i] = sc.nextBigInteger();\n if(BigInteger.ZERO.equals(b[i])) {\n System.out.println(\"0\");\n return;\n }\n }\n BigInteger c = BigInteger.TEN.pow(18);\n for(int i =0; i<a; i++) {\n total = b[i].multiply(total);\n if(0 < total.compareTo(c) ) {\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(total);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n BigInteger[] b = new BigInteger[a];\n BigInteger total = BigInteger.ONE;\n for(int i =0; i<a; i++) {\n b[i] = sc.nextBigInteger();\n if(BigInteger.ZERO.equals(b[i])) {\n System.out.println(\"0\");\n return;\n }\n }\n BigInteger c = BigInteger.TEN.pow(18);\n for(int i =0; i<a; i++) {\n total = b[i].multiply(total);\n if(0 < total.compareTo(c) ) {\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(total);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n BigInteger[] b = new BigInteger[a];\n BigInteger total = BigInteger.ONE;\n for(int i =0; i<a; i++) {\n b[i] = sc.nextBigInteger();\n if(BigInteger.ZERO.equals(b[i])) {\n System.out.println(\"0\");\n return;\n }\n }\n BigInteger c = BigInteger.TEN.pow(18);\n for(int i =0; i<a; i++) {\n total = b[i].multiply(total);\n if(0 < total.compareTo(c) ) {\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(total);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int a = sc.nextInt();",
"a",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BigInteger[] b = new BigInteger[a];",
"b",
"new BigInteger[a]",
"a",
"BigInteger total = BigInteger.ONE;",
"total",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"for(int i =0; i<a; i++) {\n b[i] = sc.nextBigInteger();\n if(BigInteger.ZERO.equals(b[i])) {\n System.out.println(\"0\");\n return;\n }\n }",
"int i =0;",
"int i =0;",
"i",
"0",
"i<a",
"i",
"a",
"i++",
"i++",
"i",
"{\n b[i] = sc.nextBigInteger();\n if(BigInteger.ZERO.equals(b[i])) {\n System.out.println(\"0\");\n return;\n }\n }",
"{\n b[i] = sc.nextBigInteger();\n if(BigInteger.ZERO.equals(b[i])) {\n System.out.println(\"0\");\n return;\n }\n }",
"b[i] = sc.nextBigInteger()",
"b[i]",
"b",
"i",
"sc.nextBigInteger()",
"sc.nextBigInteger",
"sc",
"if(BigInteger.ZERO.equals(b[i])) {\n System.out.println(\"0\");\n return;\n }",
"BigInteger.ZERO.equals(b[i])",
"BigInteger.ZERO.equals",
"BigInteger.ZERO",
"BigInteger",
"BigInteger.ZERO",
"b[i]",
"b",
"i",
"{\n System.out.println(\"0\");\n return;\n }",
"System.out.println(\"0\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"0\"",
"return;",
"BigInteger c = BigInteger.TEN.pow(18);",
"c",
"BigInteger.TEN.pow(18)",
"BigInteger.TEN.pow",
"BigInteger.TEN",
"BigInteger",
"BigInteger.TEN",
"18",
"for(int i =0; i<a; i++) {\n total = b[i].multiply(total);\n if(0 < total.compareTo(c) ) {\n System.out.println(\"-1\");\n return;\n }\n }",
"int i =0;",
"int i =0;",
"i",
"0",
"i<a",
"i",
"a",
"i++",
"i++",
"i",
"{\n total = b[i].multiply(total);\n if(0 < total.compareTo(c) ) {\n System.out.println(\"-1\");\n return;\n }\n }",
"{\n total = b[i].multiply(total);\n if(0 < total.compareTo(c) ) {\n System.out.println(\"-1\");\n return;\n }\n }",
"total = b[i].multiply(total)",
"total",
"b[i].multiply(total)",
"b[i].multiply",
"b[i]",
"b",
"i",
"total",
"if(0 < total.compareTo(c) ) {\n System.out.println(\"-1\");\n return;\n }",
"0 < total.compareTo(c)",
"0",
"total.compareTo(c)",
"total.compareTo",
"total",
"c",
"{\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(total)",
"System.out.println",
"System.out",
"System",
"System.out",
"total",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n BigInteger[] b = new BigInteger[a];\n BigInteger total = BigInteger.ONE;\n for(int i =0; i<a; i++) {\n b[i] = sc.nextBigInteger();\n if(BigInteger.ZERO.equals(b[i])) {\n System.out.println(\"0\");\n return;\n }\n }\n BigInteger c = BigInteger.TEN.pow(18);\n for(int i =0; i<a; i++) {\n total = b[i].multiply(total);\n if(0 < total.compareTo(c) ) {\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(total);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n BigInteger[] b = new BigInteger[a];\n BigInteger total = BigInteger.ONE;\n for(int i =0; i<a; i++) {\n b[i] = sc.nextBigInteger();\n if(BigInteger.ZERO.equals(b[i])) {\n System.out.println(\"0\");\n return;\n }\n }\n BigInteger c = BigInteger.TEN.pow(18);\n for(int i =0; i<a; i++) {\n total = b[i].multiply(total);\n if(0 < total.compareTo(c) ) {\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(total);\n }\n}",
"Main"
] |
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
BigInteger[] b = new BigInteger[a];
BigInteger total = BigInteger.ONE;
for(int i =0; i<a; i++) {
b[i] = sc.nextBigInteger();
if(BigInteger.ZERO.equals(b[i])) {
System.out.println("0");
return;
}
}
BigInteger c = BigInteger.TEN.pow(18);
for(int i =0; i<a; i++) {
total = b[i].multiply(total);
if(0 < total.compareTo(c) ) {
System.out.println("-1");
return;
}
}
System.out.println(total);
}
}
|
[
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,
41,
13,
17,
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,
18,
13,
13,
30,
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,
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
],
[
122,
8
],
[
122,
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
],
[
30,
32
],
[
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
],
[
59,
60
],
[
59,
61
],
[
53,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
11,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
68,
75
],
[
11,
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
],
[
94,
95
],
[
94,
96
],
[
88,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
98,
103
],
[
97,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
110,
111
],
[
104,
112
],
[
11,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
113,
118
],
[
9,
119
],
[
119,
120
],
[
0,
121
],
[
121,
122
],
[
121,
123
]
] |
[
"import java.math.BigInteger;\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 BigInteger[] a = new BigInteger[n];\n BigInteger aa = new BigInteger(\"1000000000000000000\");\n BigInteger sum = new BigInteger(\"1\");\n boolean flg = false;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextBigInteger();\n if(a[i].equals(BigInteger.ZERO)) {\n flg = true;\n }\n }\n if(flg) {\n System.out.println(0);\n return;\n }\n for (int i = 0; i < n; i++) {\n sum = sum.multiply(a[i]);\n if(sum.compareTo(aa) > 0) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(sum);\n }\n}",
"import java.math.BigInteger;",
"BigInteger",
"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 BigInteger[] a = new BigInteger[n];\n BigInteger aa = new BigInteger(\"1000000000000000000\");\n BigInteger sum = new BigInteger(\"1\");\n boolean flg = false;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextBigInteger();\n if(a[i].equals(BigInteger.ZERO)) {\n flg = true;\n }\n }\n if(flg) {\n System.out.println(0);\n return;\n }\n for (int i = 0; i < n; i++) {\n sum = sum.multiply(a[i]);\n if(sum.compareTo(aa) > 0) {\n System.out.println(-1);\n return;\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 aa = new BigInteger(\"1000000000000000000\");\n BigInteger sum = new BigInteger(\"1\");\n boolean flg = false;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextBigInteger();\n if(a[i].equals(BigInteger.ZERO)) {\n flg = true;\n }\n }\n if(flg) {\n System.out.println(0);\n return;\n }\n for (int i = 0; i < n; i++) {\n sum = sum.multiply(a[i]);\n if(sum.compareTo(aa) > 0) {\n System.out.println(-1);\n return;\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 aa = new BigInteger(\"1000000000000000000\");\n BigInteger sum = new BigInteger(\"1\");\n boolean flg = false;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextBigInteger();\n if(a[i].equals(BigInteger.ZERO)) {\n flg = true;\n }\n }\n if(flg) {\n System.out.println(0);\n return;\n }\n for (int i = 0; i < n; i++) {\n sum = sum.multiply(a[i]);\n if(sum.compareTo(aa) > 0) {\n System.out.println(-1);\n return;\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 aa = new BigInteger(\"1000000000000000000\");",
"aa",
"new BigInteger(\"1000000000000000000\")",
"BigInteger sum = new BigInteger(\"1\");",
"sum",
"new BigInteger(\"1\")",
"boolean flg = false;",
"flg",
"false",
"for (int i = 0; i < n; i++) {\n a[i] = sc.nextBigInteger();\n if(a[i].equals(BigInteger.ZERO)) {\n flg = true;\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.ZERO)) {\n flg = true;\n }\n }",
"{\n a[i] = sc.nextBigInteger();\n if(a[i].equals(BigInteger.ZERO)) {\n flg = true;\n }\n }",
"a[i] = sc.nextBigInteger()",
"a[i]",
"a",
"i",
"sc.nextBigInteger()",
"sc.nextBigInteger",
"sc",
"if(a[i].equals(BigInteger.ZERO)) {\n flg = true;\n }",
"a[i].equals(BigInteger.ZERO)",
"a[i].equals",
"a[i]",
"a",
"i",
"BigInteger.ZERO",
"BigInteger",
"BigInteger.ZERO",
"{\n flg = true;\n }",
"flg = true",
"flg",
"true",
"if(flg) {\n System.out.println(0);\n return;\n }",
"flg",
"{\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 sum = sum.multiply(a[i]);\n if(sum.compareTo(aa) > 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 sum = sum.multiply(a[i]);\n if(sum.compareTo(aa) > 0) {\n System.out.println(-1);\n return;\n }\n }",
"{\n sum = sum.multiply(a[i]);\n if(sum.compareTo(aa) > 0) {\n System.out.println(-1);\n return;\n }\n }",
"sum = sum.multiply(a[i])",
"sum",
"sum.multiply(a[i])",
"sum.multiply",
"sum",
"a[i]",
"a",
"i",
"if(sum.compareTo(aa) > 0) {\n System.out.println(-1);\n return;\n }",
"sum.compareTo(aa) > 0",
"sum.compareTo(aa)",
"sum.compareTo",
"sum",
"aa",
"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(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 sc = new Scanner(System.in);\n int n = sc.nextInt();\n BigInteger[] a = new BigInteger[n];\n BigInteger aa = new BigInteger(\"1000000000000000000\");\n BigInteger sum = new BigInteger(\"1\");\n boolean flg = false;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextBigInteger();\n if(a[i].equals(BigInteger.ZERO)) {\n flg = true;\n }\n }\n if(flg) {\n System.out.println(0);\n return;\n }\n for (int i = 0; i < n; i++) {\n sum = sum.multiply(a[i]);\n if(sum.compareTo(aa) > 0) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(sum);\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 BigInteger[] a = new BigInteger[n];\n BigInteger aa = new BigInteger(\"1000000000000000000\");\n BigInteger sum = new BigInteger(\"1\");\n boolean flg = false;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextBigInteger();\n if(a[i].equals(BigInteger.ZERO)) {\n flg = true;\n }\n }\n if(flg) {\n System.out.println(0);\n return;\n }\n for (int i = 0; i < n; i++) {\n sum = sum.multiply(a[i]);\n if(sum.compareTo(aa) > 0) {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(sum);\n }\n}",
"Main"
] |
import java.math.BigInteger;
import java.util.Scanner;
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 aa = new BigInteger("1000000000000000000");
BigInteger sum = new BigInteger("1");
boolean flg = false;
for (int i = 0; i < n; i++) {
a[i] = sc.nextBigInteger();
if(a[i].equals(BigInteger.ZERO)) {
flg = true;
}
}
if(flg) {
System.out.println(0);
return;
}
for (int i = 0; i < n; i++) {
sum = sum.multiply(a[i]);
if(sum.compareTo(aa) > 0) {
System.out.println(-1);
return;
}
}
System.out.println(sum);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
17,
12,
13,
30,
4,
13,
23,
13,
12,
13,
30,
41,
13,
20,
0,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
4,
18,
13,
13,
41,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
4,
18,
13,
18,
13,
13,
14,
2,
4,
18,
13,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
40,
17,
4,
18,
13,
29,
4,
18,
18,
13,
13,
13,
4,
18,
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
],
[
146,
17
],
[
146,
18
],
[
18,
19
],
[
146,
20
],
[
20,
21
],
[
146,
22
],
[
22,
23
],
[
22,
24
],
[
146,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
25,
30
],
[
30,
31
],
[
146,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
41,
42
],
[
40,
43
],
[
43,
44
],
[
44,
45
],
[
34,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
48,
53
],
[
34,
54
],
[
54,
55
],
[
54,
56
],
[
34,
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
],
[
72,
74
],
[
71,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
78,
79
],
[
78,
80
],
[
34,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
34,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
34,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
95,
96
],
[
95,
97
],
[
90,
98
],
[
98,
99
],
[
99,
100
],
[
90,
101
],
[
102,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
106,
107
],
[
105,
108
],
[
108,
109
],
[
109,
110
],
[
108,
111
],
[
111,
112
],
[
111,
113
],
[
102,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
116,
119
],
[
119,
120
],
[
120,
121
],
[
119,
122
],
[
115,
123
],
[
114,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
125,
130
],
[
130,
131
],
[
124,
132
],
[
132,
133
],
[
133,
134
],
[
124,
135
],
[
34,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
34,
142
],
[
142,
143
],
[
143,
144
],
[
0,
145
],
[
145,
146
],
[
145,
147
]
] |
[
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\nimport java.util.Arrays;\n\npublic class Main {\n\tstatic int N;\n\tstatic long[] A;\n\tstatic long MAX = (long) 1e18;\n\t\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tread();\n\t}\n\n\tprivate static void read() throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tN = Integer.parseInt(br.readLine());\n\t\tString[] word = br.readLine().split(\"\\\\s+\");\n\t\tA = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = Long.valueOf(word[i]);\n\t\t}\n\t\tArrays.sort(A);\n\t\tBigInteger res = BigInteger.ONE;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tres = res.multiply(BigInteger.valueOf(A[i]));\n\t\t\tif ( res.compareTo(BigInteger.valueOf(MAX) ) > 0 ){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tbr.close();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(res);\n\t\tbr.close();\n\t}\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",
"public class Main {\n\tstatic int N;\n\tstatic long[] A;\n\tstatic long MAX = (long) 1e18;\n\t\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tread();\n\t}\n\n\tprivate static void read() throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tN = Integer.parseInt(br.readLine());\n\t\tString[] word = br.readLine().split(\"\\\\s+\");\n\t\tA = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = Long.valueOf(word[i]);\n\t\t}\n\t\tArrays.sort(A);\n\t\tBigInteger res = BigInteger.ONE;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tres = res.multiply(BigInteger.valueOf(A[i]));\n\t\t\tif ( res.compareTo(BigInteger.valueOf(MAX) ) > 0 ){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tbr.close();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(res);\n\t\tbr.close();\n\t}\n\n}",
"Main",
"static int N;",
"N",
"static long[] A;",
"A",
"static long MAX = (long) 1e18;",
"MAX",
"(long) 1e18",
"public static void main(String[] args) throws NumberFormatException, IOException {\n\t\tread();\n\t}",
"main",
"{\n\t\tread();\n\t}",
"read()",
"read",
"String[] args",
"args",
"private static void read() throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tN = Integer.parseInt(br.readLine());\n\t\tString[] word = br.readLine().split(\"\\\\s+\");\n\t\tA = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = Long.valueOf(word[i]);\n\t\t}\n\t\tArrays.sort(A);\n\t\tBigInteger res = BigInteger.ONE;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tres = res.multiply(BigInteger.valueOf(A[i]));\n\t\t\tif ( res.compareTo(BigInteger.valueOf(MAX) ) > 0 ){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tbr.close();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(res);\n\t\tbr.close();\n\t}",
"read",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tN = Integer.parseInt(br.readLine());\n\t\tString[] word = br.readLine().split(\"\\\\s+\");\n\t\tA = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = Long.valueOf(word[i]);\n\t\t}\n\t\tArrays.sort(A);\n\t\tBigInteger res = BigInteger.ONE;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tres = res.multiply(BigInteger.valueOf(A[i]));\n\t\t\tif ( res.compareTo(BigInteger.valueOf(MAX) ) > 0 ){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tbr.close();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(res);\n\t\tbr.close();\n\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"N = Integer.parseInt(br.readLine())",
"N",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] word = br.readLine().split(\"\\\\s+\");",
"word",
"br.readLine().split(\"\\\\s+\")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\"\\\\s+\"",
"A = new long[N]",
"A",
"new long[N]",
"N",
"for (int i = 0; i < N; i++) {\n\t\t\tA[i] = Long.valueOf(word[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tA[i] = Long.valueOf(word[i]);\n\t\t}",
"{\n\t\t\tA[i] = Long.valueOf(word[i]);\n\t\t}",
"A[i] = Long.valueOf(word[i])",
"A[i]",
"A",
"i",
"Long.valueOf(word[i])",
"Long.valueOf",
"Long",
"word[i]",
"word",
"i",
"Arrays.sort(A)",
"Arrays.sort",
"Arrays",
"A",
"BigInteger res = BigInteger.ONE;",
"res",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"for (int i = 0; i < N; i++) {\n\t\t\tres = res.multiply(BigInteger.valueOf(A[i]));\n\t\t\tif ( res.compareTo(BigInteger.valueOf(MAX) ) > 0 ){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tbr.close();\n\t\t\t\treturn;\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\tres = res.multiply(BigInteger.valueOf(A[i]));\n\t\t\tif ( res.compareTo(BigInteger.valueOf(MAX) ) > 0 ){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tbr.close();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t}",
"{\n\t\t\tres = res.multiply(BigInteger.valueOf(A[i]));\n\t\t\tif ( res.compareTo(BigInteger.valueOf(MAX) ) > 0 ){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tbr.close();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t}",
"res = res.multiply(BigInteger.valueOf(A[i]))",
"res",
"res.multiply(BigInteger.valueOf(A[i]))",
"res.multiply",
"res",
"BigInteger.valueOf(A[i])",
"BigInteger.valueOf",
"BigInteger",
"A[i]",
"A",
"i",
"if ( res.compareTo(BigInteger.valueOf(MAX) ) > 0 ){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tbr.close();\n\t\t\t\treturn;\n\t\t\t}",
"res.compareTo(BigInteger.valueOf(MAX) ) > 0",
"res.compareTo(BigInteger.valueOf(MAX) )",
"res.compareTo",
"res",
"BigInteger.valueOf(MAX)",
"BigInteger.valueOf",
"BigInteger",
"MAX",
"0",
"{\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tbr.close();\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"br.close()",
"br.close",
"br",
"return;",
"System.out.println(res)",
"System.out.println",
"System.out",
"System",
"System.out",
"res",
"br.close()",
"br.close",
"br",
"public class Main {\n\tstatic int N;\n\tstatic long[] A;\n\tstatic long MAX = (long) 1e18;\n\t\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tread();\n\t}\n\n\tprivate static void read() throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tN = Integer.parseInt(br.readLine());\n\t\tString[] word = br.readLine().split(\"\\\\s+\");\n\t\tA = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = Long.valueOf(word[i]);\n\t\t}\n\t\tArrays.sort(A);\n\t\tBigInteger res = BigInteger.ONE;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tres = res.multiply(BigInteger.valueOf(A[i]));\n\t\t\tif ( res.compareTo(BigInteger.valueOf(MAX) ) > 0 ){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tbr.close();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(res);\n\t\tbr.close();\n\t}\n\n}",
"public class Main {\n\tstatic int N;\n\tstatic long[] A;\n\tstatic long MAX = (long) 1e18;\n\t\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tread();\n\t}\n\n\tprivate static void read() throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tN = Integer.parseInt(br.readLine());\n\t\tString[] word = br.readLine().split(\"\\\\s+\");\n\t\tA = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = Long.valueOf(word[i]);\n\t\t}\n\t\tArrays.sort(A);\n\t\tBigInteger res = BigInteger.ONE;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tres = res.multiply(BigInteger.valueOf(A[i]));\n\t\t\tif ( res.compareTo(BigInteger.valueOf(MAX) ) > 0 ){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tbr.close();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(res);\n\t\tbr.close();\n\t}\n\n}",
"Main"
] |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
public class Main {
static int N;
static long[] A;
static long MAX = (long) 1e18;
public static void main(String[] args) throws NumberFormatException, IOException {
read();
}
private static void read() throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
N = Integer.parseInt(br.readLine());
String[] word = br.readLine().split("\\s+");
A = new long[N];
for (int i = 0; i < N; i++) {
A[i] = Long.valueOf(word[i]);
}
Arrays.sort(A);
BigInteger res = BigInteger.ONE;
for (int i = 0; i < N; i++) {
res = res.multiply(BigInteger.valueOf(A[i]));
if ( res.compareTo(BigInteger.valueOf(MAX) ) > 0 ){
System.out.println(-1);
br.close();
return;
}
}
System.out.println(res);
br.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,
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,
4,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
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
],
[
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
],
[
61,
62
],
[
60,
63
],
[
60,
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
],
[
86,
93
],
[
77,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
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.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n long[] b = new long[a];\n long total = 1;\n for(int i =0; i<a; i++) {\n b[i] = sc.nextLong();\n if(b[i] == 0) {\n System.out.println(\"0\");\n return;\n }\n }\n long c = (long) Math.pow(10, 18);\n for(int i =0; i<a; i++) {\n if(b[i] > c/total ) {\n System.out.println(\"-1\");\n return;\n }\n total *= b[i];\n }\n System.out.println(total);\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 a = sc.nextInt();\n long[] b = new long[a];\n long total = 1;\n for(int i =0; i<a; i++) {\n b[i] = sc.nextLong();\n if(b[i] == 0) {\n System.out.println(\"0\");\n return;\n }\n }\n long c = (long) Math.pow(10, 18);\n for(int i =0; i<a; i++) {\n if(b[i] > c/total ) {\n System.out.println(\"-1\");\n return;\n }\n total *= b[i];\n }\n System.out.println(total);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n long[] b = new long[a];\n long total = 1;\n for(int i =0; i<a; i++) {\n b[i] = sc.nextLong();\n if(b[i] == 0) {\n System.out.println(\"0\");\n return;\n }\n }\n long c = (long) Math.pow(10, 18);\n for(int i =0; i<a; i++) {\n if(b[i] > c/total ) {\n System.out.println(\"-1\");\n return;\n }\n total *= b[i];\n }\n System.out.println(total);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n long[] b = new long[a];\n long total = 1;\n for(int i =0; i<a; i++) {\n b[i] = sc.nextLong();\n if(b[i] == 0) {\n System.out.println(\"0\");\n return;\n }\n }\n long c = (long) Math.pow(10, 18);\n for(int i =0; i<a; i++) {\n if(b[i] > c/total ) {\n System.out.println(\"-1\");\n return;\n }\n total *= b[i];\n }\n System.out.println(total);\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 total = 1;",
"total",
"1",
"for(int i =0; i<a; i++) {\n b[i] = sc.nextLong();\n if(b[i] == 0) {\n System.out.println(\"0\");\n return;\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 System.out.println(\"0\");\n return;\n }\n }",
"{\n b[i] = sc.nextLong();\n if(b[i] == 0) {\n System.out.println(\"0\");\n return;\n }\n }",
"b[i] = sc.nextLong()",
"b[i]",
"b",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(b[i] == 0) {\n System.out.println(\"0\");\n return;\n }",
"b[i] == 0",
"b[i]",
"b",
"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 c = (long) Math.pow(10, 18);",
"c",
"(long) Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"for(int i =0; i<a; i++) {\n if(b[i] > c/total ) {\n System.out.println(\"-1\");\n return;\n }\n total *= b[i];\n }",
"int i =0;",
"int i =0;",
"i",
"0",
"i<a",
"i",
"a",
"i++",
"i++",
"i",
"{\n if(b[i] > c/total ) {\n System.out.println(\"-1\");\n return;\n }\n total *= b[i];\n }",
"{\n if(b[i] > c/total ) {\n System.out.println(\"-1\");\n return;\n }\n total *= b[i];\n }",
"if(b[i] > c/total ) {\n System.out.println(\"-1\");\n return;\n }",
"b[i] > c/total",
"b[i]",
"b",
"i",
"c/total",
"c",
"total",
"{\n System.out.println(\"-1\");\n return;\n }",
"System.out.println(\"-1\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"return;",
"total *= b[i]",
"total",
"b[i]",
"b",
"i",
"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 Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n long[] b = new long[a];\n long total = 1;\n for(int i =0; i<a; i++) {\n b[i] = sc.nextLong();\n if(b[i] == 0) {\n System.out.println(\"0\");\n return;\n }\n }\n long c = (long) Math.pow(10, 18);\n for(int i =0; i<a; i++) {\n if(b[i] > c/total ) {\n System.out.println(\"-1\");\n return;\n }\n total *= b[i];\n }\n System.out.println(total);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n long[] b = new long[a];\n long total = 1;\n for(int i =0; i<a; i++) {\n b[i] = sc.nextLong();\n if(b[i] == 0) {\n System.out.println(\"0\");\n return;\n }\n }\n long c = (long) Math.pow(10, 18);\n for(int i =0; i<a; i++) {\n if(b[i] > c/total ) {\n System.out.println(\"-1\");\n return;\n }\n total *= b[i];\n }\n System.out.println(total);\n }\n}",
"Main"
] |
import java.util.Scanner;
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 total = 1;
for(int i =0; i<a; i++) {
b[i] = sc.nextLong();
if(b[i] == 0) {
System.out.println("0");
return;
}
}
long c = (long) Math.pow(10, 18);
for(int i =0; i<a; i++) {
if(b[i] > c/total ) {
System.out.println("-1");
return;
}
total *= b[i];
}
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,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
18,
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,
20,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
18,
13,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
13,
2,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
13,
13,
30,
0,
13,
2,
13,
18,
13,
13,
30,
0,
13,
17,
3,
14,
2,
13,
17,
30,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
13,
30,
4,
18,
18,
13,
13,
17,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
171,
5
],
[
171,
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
],
[
34,
35
],
[
34,
36
],
[
27,
37
],
[
37,
38
],
[
38,
39
],
[
27,
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
],
[
51,
53
],
[
50,
54
],
[
49,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
8,
59
],
[
59,
60
],
[
59,
61
],
[
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
],
[
77,
79
],
[
76,
80
],
[
8,
81
],
[
81,
82
],
[
81,
83
],
[
8,
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
],
[
99,
101
],
[
101,
102
],
[
101,
103
],
[
8,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
109,
110
],
[
109,
111
],
[
104,
112
],
[
112,
113
],
[
113,
114
],
[
104,
115
],
[
116,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
122,
123
],
[
122,
124
],
[
117,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
130,
132
],
[
117,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
8,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
143,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
148,
153
],
[
143,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
138,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
162,
167
],
[
6,
168
],
[
168,
169
],
[
0,
170
],
[
170,
171
],
[
170,
172
]
] |
[
"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 ans = 1;\n\t\tint check = 0;\n\t\tlong[] a = new long[n];\n\t\tfor(int i = 0; i < a.length; ++i){\n a[i] = sc.nextLong();\n if(a[i]==0){\n check = 1;\n }\n }\n int[] b = new int[18];\n for(int j=0; j<18; ++j){\n b[j] = 10;\n }\n long num = 1;\n for(int j=0; j<18; ++j){\n num = num*b[j];\n }\n for(int i=0; i<n; ++i){\n if(a[i]<=num/ans){\n ans = ans*a[i];\n }else{\n ans=0;\n \tbreak;\n }\n }\n if(check == 0){\n if(ans == 0){\n System.out.println(\"-1\");\n }else{\n System.out.println(ans);\n }\n }else{\n System.out.println(\"0\");\n }\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 ans = 1;\n\t\tint check = 0;\n\t\tlong[] a = new long[n];\n\t\tfor(int i = 0; i < a.length; ++i){\n a[i] = sc.nextLong();\n if(a[i]==0){\n check = 1;\n }\n }\n int[] b = new int[18];\n for(int j=0; j<18; ++j){\n b[j] = 10;\n }\n long num = 1;\n for(int j=0; j<18; ++j){\n num = num*b[j];\n }\n for(int i=0; i<n; ++i){\n if(a[i]<=num/ans){\n ans = ans*a[i];\n }else{\n ans=0;\n \tbreak;\n }\n }\n if(check == 0){\n if(ans == 0){\n System.out.println(\"-1\");\n }else{\n System.out.println(ans);\n }\n }else{\n System.out.println(\"0\");\n }\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 ans = 1;\n\t\tint check = 0;\n\t\tlong[] a = new long[n];\n\t\tfor(int i = 0; i < a.length; ++i){\n a[i] = sc.nextLong();\n if(a[i]==0){\n check = 1;\n }\n }\n int[] b = new int[18];\n for(int j=0; j<18; ++j){\n b[j] = 10;\n }\n long num = 1;\n for(int j=0; j<18; ++j){\n num = num*b[j];\n }\n for(int i=0; i<n; ++i){\n if(a[i]<=num/ans){\n ans = ans*a[i];\n }else{\n ans=0;\n \tbreak;\n }\n }\n if(check == 0){\n if(ans == 0){\n System.out.println(\"-1\");\n }else{\n System.out.println(ans);\n }\n }else{\n System.out.println(\"0\");\n }\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong ans = 1;\n\t\tint check = 0;\n\t\tlong[] a = new long[n];\n\t\tfor(int i = 0; i < a.length; ++i){\n a[i] = sc.nextLong();\n if(a[i]==0){\n check = 1;\n }\n }\n int[] b = new int[18];\n for(int j=0; j<18; ++j){\n b[j] = 10;\n }\n long num = 1;\n for(int j=0; j<18; ++j){\n num = num*b[j];\n }\n for(int i=0; i<n; ++i){\n if(a[i]<=num/ans){\n ans = ans*a[i];\n }else{\n ans=0;\n \tbreak;\n }\n }\n if(check == 0){\n if(ans == 0){\n System.out.println(\"-1\");\n }else{\n System.out.println(ans);\n }\n }else{\n System.out.println(\"0\");\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 ans = 1;",
"ans",
"1",
"int check = 0;",
"check",
"0",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for(int i = 0; i < a.length; ++i){\n a[i] = sc.nextLong();\n if(a[i]==0){\n check = 1;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < a.length",
"i",
"a.length",
"a",
"a.length",
"++i",
"++i",
"i",
"{\n a[i] = sc.nextLong();\n if(a[i]==0){\n check = 1;\n }\n }",
"{\n a[i] = sc.nextLong();\n if(a[i]==0){\n check = 1;\n }\n }",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(a[i]==0){\n check = 1;\n }",
"a[i]==0",
"a[i]",
"a",
"i",
"0",
"{\n check = 1;\n }",
"check = 1",
"check",
"1",
"int[] b = new int[18];",
"b",
"new int[18]",
"18",
"for(int j=0; j<18; ++j){\n b[j] = 10;\n }",
"int j=0;",
"int j=0;",
"j",
"0",
"j<18",
"j",
"18",
"++j",
"++j",
"j",
"{\n b[j] = 10;\n }",
"{\n b[j] = 10;\n }",
"b[j] = 10",
"b[j]",
"b",
"j",
"10",
"long num = 1;",
"num",
"1",
"for(int j=0; j<18; ++j){\n num = num*b[j];\n }",
"int j=0;",
"int j=0;",
"j",
"0",
"j<18",
"j",
"18",
"++j",
"++j",
"j",
"{\n num = num*b[j];\n }",
"{\n num = num*b[j];\n }",
"num = num*b[j]",
"num",
"num*b[j]",
"num",
"b[j]",
"b",
"j",
"for(int i=0; i<n; ++i){\n if(a[i]<=num/ans){\n ans = ans*a[i];\n }else{\n ans=0;\n \tbreak;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"++i",
"++i",
"i",
"{\n if(a[i]<=num/ans){\n ans = ans*a[i];\n }else{\n ans=0;\n \tbreak;\n }\n }",
"{\n if(a[i]<=num/ans){\n ans = ans*a[i];\n }else{\n ans=0;\n \tbreak;\n }\n }",
"if(a[i]<=num/ans){\n ans = ans*a[i];\n }else{\n ans=0;\n \tbreak;\n }",
"a[i]<=num/ans",
"a[i]",
"a",
"i",
"num/ans",
"num",
"ans",
"{\n ans = ans*a[i];\n }",
"ans = ans*a[i]",
"ans",
"ans*a[i]",
"ans",
"a[i]",
"a",
"i",
"{\n ans=0;\n \tbreak;\n }",
"ans=0",
"ans",
"0",
"break;",
"if(check == 0){\n if(ans == 0){\n System.out.println(\"-1\");\n }else{\n System.out.println(ans);\n }\n }else{\n System.out.println(\"0\");\n }",
"check == 0",
"check",
"0",
"{\n if(ans == 0){\n System.out.println(\"-1\");\n }else{\n System.out.println(ans);\n }\n }",
"if(ans == 0){\n System.out.println(\"-1\");\n }else{\n System.out.println(ans);\n }",
"ans == 0",
"ans",
"0",
"{\n System.out.println(\"-1\");\n }",
"System.out.println(\"-1\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"{\n System.out.println(ans);\n }",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"{\n System.out.println(\"0\");\n }",
"System.out.println(\"0\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"0\"",
"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 ans = 1;\n\t\tint check = 0;\n\t\tlong[] a = new long[n];\n\t\tfor(int i = 0; i < a.length; ++i){\n a[i] = sc.nextLong();\n if(a[i]==0){\n check = 1;\n }\n }\n int[] b = new int[18];\n for(int j=0; j<18; ++j){\n b[j] = 10;\n }\n long num = 1;\n for(int j=0; j<18; ++j){\n num = num*b[j];\n }\n for(int i=0; i<n; ++i){\n if(a[i]<=num/ans){\n ans = ans*a[i];\n }else{\n ans=0;\n \tbreak;\n }\n }\n if(check == 0){\n if(ans == 0){\n System.out.println(\"-1\");\n }else{\n System.out.println(ans);\n }\n }else{\n System.out.println(\"0\");\n }\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 ans = 1;\n\t\tint check = 0;\n\t\tlong[] a = new long[n];\n\t\tfor(int i = 0; i < a.length; ++i){\n a[i] = sc.nextLong();\n if(a[i]==0){\n check = 1;\n }\n }\n int[] b = new int[18];\n for(int j=0; j<18; ++j){\n b[j] = 10;\n }\n long num = 1;\n for(int j=0; j<18; ++j){\n num = num*b[j];\n }\n for(int i=0; i<n; ++i){\n if(a[i]<=num/ans){\n ans = ans*a[i];\n }else{\n ans=0;\n \tbreak;\n }\n }\n if(check == 0){\n if(ans == 0){\n System.out.println(\"-1\");\n }else{\n System.out.println(ans);\n }\n }else{\n System.out.println(\"0\");\n }\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 ans = 1;
int check = 0;
long[] a = new long[n];
for(int i = 0; i < a.length; ++i){
a[i] = sc.nextLong();
if(a[i]==0){
check = 1;
}
}
int[] b = new int[18];
for(int j=0; j<18; ++j){
b[j] = 10;
}
long num = 1;
for(int j=0; j<18; ++j){
num = num*b[j];
}
for(int i=0; i<n; ++i){
if(a[i]<=num/ans){
ans = ans*a[i];
}else{
ans=0;
break;
}
}
if(check == 0){
if(ans == 0){
System.out.println("-1");
}else{
System.out.println(ans);
}
}else{
System.out.println("0");
}
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
41,
13,
20,
12,
13,
30,
41,
13,
4,
13,
41,
13,
20,
13,
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,
4,
18,
18,
13,
13,
17,
4,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
18,
13,
13,
41,
13,
4,
18,
13,
17,
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,
13,
13,
30,
4,
18,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
29,
2,
2,
13,
13,
4,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
2,
13,
13,
17,
30,
29,
4,
13,
13,
2,
13,
13,
30,
29,
13,
23,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
17,
23,
13,
12,
13,
30,
29,
4,
18,
13,
23,
13,
12,
13,
30,
29,
2,
13,
17,
23,
13,
12,
13,
30,
41,
13,
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,
13,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
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,
13,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
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,
13,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
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,
13,
18,
13,
13,
29,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
423,
5
],
[
423,
6
],
[
6,
7
],
[
6,
8
],
[
423,
9
],
[
9,
10
],
[
9,
11
],
[
423,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
14,
19
],
[
19,
20
],
[
19,
21
],
[
14,
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
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
35,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
42,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
48,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
14,
59
],
[
59,
60
],
[
59,
61
],
[
14,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
62,
67
],
[
67,
68
],
[
67,
69
],
[
62,
70
],
[
70,
71
],
[
71,
72
],
[
62,
73
],
[
74,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
78,
79
],
[
77,
80
],
[
80,
81
],
[
80,
82
],
[
14,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
85,
89
],
[
14,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
95,
100
],
[
90,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
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
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
101,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
128,
133
],
[
123,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
135,
140
],
[
12,
141
],
[
141,
142
],
[
423,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
146,
147
],
[
148,
148
],
[
148,
149
],
[
148,
150
],
[
148,
151
],
[
151,
152
],
[
151,
153
],
[
151,
154
],
[
143,
155
],
[
155,
156
],
[
143,
157
],
[
157,
158
],
[
423,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
163,
167
],
[
162,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
170,
173
],
[
173,
174
],
[
173,
175
],
[
162,
176
],
[
176,
177
],
[
177,
178
],
[
159,
179
],
[
179,
180
],
[
159,
181
],
[
181,
182
],
[
423,
183
],
[
183,
184
],
[
183,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
183,
190
],
[
190,
191
],
[
423,
192
],
[
192,
193
],
[
192,
194
],
[
194,
195
],
[
195,
196
],
[
196,
197
],
[
197,
198
],
[
192,
199
],
[
199,
200
],
[
423,
201
],
[
201,
202
],
[
201,
203
],
[
203,
204
],
[
204,
205
],
[
205,
206
],
[
206,
207
],
[
423,
208
],
[
208,
209
],
[
208,
210
],
[
210,
211
],
[
211,
212
],
[
212,
213
],
[
213,
214
],
[
212,
215
],
[
215,
216
],
[
216,
217
],
[
423,
218
],
[
218,
219
],
[
218,
220
],
[
220,
221
],
[
221,
222
],
[
222,
223
],
[
223,
224
],
[
222,
225
],
[
225,
226
],
[
226,
227
],
[
423,
228
],
[
228,
229
],
[
228,
230
],
[
230,
231
],
[
231,
232
],
[
232,
233
],
[
233,
234
],
[
232,
235
],
[
235,
236
],
[
236,
237
],
[
423,
238
],
[
238,
239
],
[
238,
240
],
[
240,
241
],
[
241,
242
],
[
242,
243
],
[
243,
244
],
[
242,
245
],
[
238,
246
],
[
246,
247
],
[
423,
248
],
[
248,
249
],
[
248,
250
],
[
250,
251
],
[
251,
252
],
[
252,
253
],
[
253,
254
],
[
248,
255
],
[
255,
256
],
[
423,
257
],
[
257,
258
],
[
257,
259
],
[
259,
260
],
[
260,
261
],
[
261,
262
],
[
261,
263
],
[
257,
264
],
[
264,
265
],
[
423,
266
],
[
266,
267
],
[
266,
268
],
[
268,
269
],
[
269,
270
],
[
269,
271
],
[
271,
272
],
[
271,
273
],
[
268,
274
],
[
274,
275
],
[
274,
276
],
[
276,
277
],
[
276,
278
],
[
268,
279
],
[
279,
280
],
[
280,
281
],
[
281,
282
],
[
281,
283
],
[
279,
284
],
[
284,
285
],
[
284,
286
],
[
279,
287
],
[
287,
288
],
[
288,
289
],
[
279,
290
],
[
291,
291
],
[
291,
292
],
[
292,
293
],
[
292,
294
],
[
294,
295
],
[
295,
296
],
[
294,
297
],
[
294,
298
],
[
298,
299
],
[
298,
300
],
[
268,
301
],
[
301,
302
],
[
266,
303
],
[
303,
304
],
[
423,
305
],
[
305,
306
],
[
305,
307
],
[
307,
308
],
[
308,
309
],
[
308,
310
],
[
310,
311
],
[
310,
312
],
[
307,
313
],
[
313,
314
],
[
313,
315
],
[
315,
316
],
[
315,
317
],
[
307,
318
],
[
318,
319
],
[
319,
320
],
[
320,
321
],
[
320,
322
],
[
318,
323
],
[
323,
324
],
[
323,
325
],
[
318,
326
],
[
326,
327
],
[
327,
328
],
[
318,
329
],
[
330,
330
],
[
330,
331
],
[
331,
332
],
[
331,
333
],
[
333,
334
],
[
334,
335
],
[
333,
336
],
[
333,
337
],
[
337,
338
],
[
337,
339
],
[
307,
340
],
[
340,
341
],
[
305,
342
],
[
342,
343
],
[
423,
344
],
[
344,
345
],
[
344,
346
],
[
346,
347
],
[
347,
348
],
[
347,
349
],
[
349,
350
],
[
349,
351
],
[
346,
352
],
[
352,
353
],
[
352,
354
],
[
354,
355
],
[
354,
356
],
[
346,
357
],
[
357,
358
],
[
358,
359
],
[
359,
360
],
[
359,
361
],
[
357,
362
],
[
362,
363
],
[
362,
364
],
[
357,
365
],
[
365,
366
],
[
366,
367
],
[
357,
368
],
[
369,
369
],
[
369,
370
],
[
370,
371
],
[
370,
372
],
[
372,
373
],
[
373,
374
],
[
372,
375
],
[
372,
376
],
[
376,
377
],
[
376,
378
],
[
346,
379
],
[
379,
380
],
[
344,
381
],
[
381,
382
],
[
423,
383
],
[
383,
384
],
[
383,
385
],
[
385,
386
],
[
386,
387
],
[
386,
388
],
[
388,
389
],
[
388,
390
],
[
385,
391
],
[
391,
392
],
[
391,
393
],
[
393,
394
],
[
393,
395
],
[
385,
396
],
[
396,
397
],
[
397,
398
],
[
398,
399
],
[
398,
400
],
[
396,
401
],
[
401,
402
],
[
401,
403
],
[
396,
404
],
[
404,
405
],
[
405,
406
],
[
396,
407
],
[
408,
408
],
[
408,
409
],
[
409,
410
],
[
409,
411
],
[
411,
412
],
[
412,
413
],
[
411,
414
],
[
411,
415
],
[
415,
416
],
[
415,
417
],
[
385,
418
],
[
418,
419
],
[
383,
420
],
[
420,
421
],
[
0,
422
],
[
422,
423
],
[
422,
424
]
] |
[
"import java.util.*;\n\n//update 2020/1/1 23:01\n\npublic class Main{\n\n static Scanner sc = new Scanner(System.in);\n static StringBuilder sb = new StringBuilder();\n\n public static void main(String[] args) {\n\n\tint n = nextInt();\n long[] a = new long[n];\n for(int i=0;i<n;i++){\n a[i] = nextLong();\n if(a[i]==0){\n System.out.println(\"0\");\n System.exit(0);\n }\n }\n \n double ans = 0;\n \n for(int i=0;i<n;i++){\n ans += Math.log10(a[i]);\n }\n \n //System.out.println(\"ans=\"+ans);\n \n long limit = (long)Math.pow(10,18);\n \n if(ans>18.0){\n System.out.println(\"-1\");\n }\n else{\n long cnt = 1;\n for(int i=0;i<n;i++){\n cnt *= a[i];\n }\n if(cnt>limit){\n System.out.println(\"-1\");\n }\n else{\n System.out.println(cnt);\n }\n \n } \n \n\n }\n\n static int lcm(int a,int b){\n return a*b*gcd(a,b);\n }\n\n static int gcd(int a,int b){\n if(a%b!=0){\n return gcd(b,a%b);\n }\n else{\n return b;\n }\n }\n\n /*\n static String toSmall(String s){\n char c = s.charAt(0);\n //if(Character.isUpperCase(c)){\n if(c<=90){\n c += 32;\n }\n return String.valueOf(c);\n }\n static String toBig(String s){\n char c = s.charAt(0);\n //if(Character.isLowerCase(c)){\n if(c>=97){\n c -= 32;\n }\n return String.valueOf(c);\n }\n */\n\n static String toSmall(String s){\n return s.toLowerCase();\n }\n\n static String toBig(String s){\n return s.toUpperCase();\n }\n\n static String next(){\n return sc.next();\n }\n\n static int nextInt(){\n return Integer.parseInt(sc.next());\n }\n\n static long nextLong(){\n return Long.parseLong(sc.next());\n }\n\n static double nextDouble(){\n return Double.parseDouble(sc.next());\n }\n\n static String[] splitString(String s){\n return s.split(\"\");\n }\n\n static char[] splitChar(String s){\n return s.toCharArray();\n }\n\n static int charToInt(char a){\n return a - 48;\n }\n\n////////////////////////////////////////////\n public static int max(int[] a){\n int lng = a.length;\n int max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }\n public static long max(long[] a){\n int lng = a.length;\n long max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }\n////////////////////////////////////////////\n\n////////////////////////////////////////////\n public static int min(int[] a){\n int lng = a.length;\n int min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }\n public static long min(long[] a){\n int lng = a.length;\n long min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }\n////////////////////////////////////////////\n\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n\n static Scanner sc = new Scanner(System.in);\n static StringBuilder sb = new StringBuilder();\n\n public static void main(String[] args) {\n\n\tint n = nextInt();\n long[] a = new long[n];\n for(int i=0;i<n;i++){\n a[i] = nextLong();\n if(a[i]==0){\n System.out.println(\"0\");\n System.exit(0);\n }\n }\n \n double ans = 0;\n \n for(int i=0;i<n;i++){\n ans += Math.log10(a[i]);\n }\n \n //System.out.println(\"ans=\"+ans);\n \n long limit = (long)Math.pow(10,18);\n \n if(ans>18.0){\n System.out.println(\"-1\");\n }\n else{\n long cnt = 1;\n for(int i=0;i<n;i++){\n cnt *= a[i];\n }\n if(cnt>limit){\n System.out.println(\"-1\");\n }\n else{\n System.out.println(cnt);\n }\n \n } \n \n\n }\n\n static int lcm(int a,int b){\n return a*b*gcd(a,b);\n }\n\n static int gcd(int a,int b){\n if(a%b!=0){\n return gcd(b,a%b);\n }\n else{\n return b;\n }\n }\n\n /*\n static String toSmall(String s){\n char c = s.charAt(0);\n //if(Character.isUpperCase(c)){\n if(c<=90){\n c += 32;\n }\n return String.valueOf(c);\n }\n static String toBig(String s){\n char c = s.charAt(0);\n //if(Character.isLowerCase(c)){\n if(c>=97){\n c -= 32;\n }\n return String.valueOf(c);\n }\n */\n\n static String toSmall(String s){\n return s.toLowerCase();\n }\n\n static String toBig(String s){\n return s.toUpperCase();\n }\n\n static String next(){\n return sc.next();\n }\n\n static int nextInt(){\n return Integer.parseInt(sc.next());\n }\n\n static long nextLong(){\n return Long.parseLong(sc.next());\n }\n\n static double nextDouble(){\n return Double.parseDouble(sc.next());\n }\n\n static String[] splitString(String s){\n return s.split(\"\");\n }\n\n static char[] splitChar(String s){\n return s.toCharArray();\n }\n\n static int charToInt(char a){\n return a - 48;\n }\n\n////////////////////////////////////////////\n public static int max(int[] a){\n int lng = a.length;\n int max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }\n public static long max(long[] a){\n int lng = a.length;\n long max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }\n////////////////////////////////////////////\n\n////////////////////////////////////////////\n public static int min(int[] a){\n int lng = a.length;\n int min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }\n public static long min(long[] a){\n int lng = a.length;\n long min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }\n////////////////////////////////////////////\n\n}",
"Main",
"static Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"static StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"public static void main(String[] args) {\n\n\tint n = nextInt();\n long[] a = new long[n];\n for(int i=0;i<n;i++){\n a[i] = nextLong();\n if(a[i]==0){\n System.out.println(\"0\");\n System.exit(0);\n }\n }\n \n double ans = 0;\n \n for(int i=0;i<n;i++){\n ans += Math.log10(a[i]);\n }\n \n //System.out.println(\"ans=\"+ans);\n \n long limit = (long)Math.pow(10,18);\n \n if(ans>18.0){\n System.out.println(\"-1\");\n }\n else{\n long cnt = 1;\n for(int i=0;i<n;i++){\n cnt *= a[i];\n }\n if(cnt>limit){\n System.out.println(\"-1\");\n }\n else{\n System.out.println(cnt);\n }\n \n } \n \n\n }",
"main",
"{\n\n\tint n = nextInt();\n long[] a = new long[n];\n for(int i=0;i<n;i++){\n a[i] = nextLong();\n if(a[i]==0){\n System.out.println(\"0\");\n System.exit(0);\n }\n }\n \n double ans = 0;\n \n for(int i=0;i<n;i++){\n ans += Math.log10(a[i]);\n }\n \n //System.out.println(\"ans=\"+ans);\n \n long limit = (long)Math.pow(10,18);\n \n if(ans>18.0){\n System.out.println(\"-1\");\n }\n else{\n long cnt = 1;\n for(int i=0;i<n;i++){\n cnt *= a[i];\n }\n if(cnt>limit){\n System.out.println(\"-1\");\n }\n else{\n System.out.println(cnt);\n }\n \n } \n \n\n }",
"int n = nextInt();",
"n",
"nextInt()",
"nextInt",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for(int i=0;i<n;i++){\n a[i] = nextLong();\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] = nextLong();\n if(a[i]==0){\n System.out.println(\"0\");\n System.exit(0);\n }\n }",
"{\n a[i] = nextLong();\n if(a[i]==0){\n System.out.println(\"0\");\n System.exit(0);\n }\n }",
"a[i] = nextLong()",
"a[i]",
"a",
"i",
"nextLong()",
"nextLong",
"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",
"double ans = 0;",
"ans",
"0",
"for(int i=0;i<n;i++){\n ans += Math.log10(a[i]);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n ans += Math.log10(a[i]);\n }",
"{\n ans += Math.log10(a[i]);\n }",
"ans += Math.log10(a[i])",
"ans",
"Math.log10(a[i])",
"Math.log10",
"Math",
"a[i]",
"a",
"i",
"long limit = (long)Math.pow(10,18);",
"limit",
"(long)Math.pow(10,18)",
"Math.pow",
"Math",
"10",
"18",
"if(ans>18.0){\n System.out.println(\"-1\");\n }\n else{\n long cnt = 1;\n for(int i=0;i<n;i++){\n cnt *= a[i];\n }\n if(cnt>limit){\n System.out.println(\"-1\");\n }\n else{\n System.out.println(cnt);\n }\n \n }",
"ans>18.0",
"ans",
"18.0",
"{\n System.out.println(\"-1\");\n }",
"System.out.println(\"-1\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"{\n long cnt = 1;\n for(int i=0;i<n;i++){\n cnt *= a[i];\n }\n if(cnt>limit){\n System.out.println(\"-1\");\n }\n else{\n System.out.println(cnt);\n }\n \n }",
"long cnt = 1;",
"cnt",
"1",
"for(int i=0;i<n;i++){\n cnt *= a[i];\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n cnt *= a[i];\n }",
"{\n cnt *= a[i];\n }",
"cnt *= a[i]",
"cnt",
"a[i]",
"a",
"i",
"if(cnt>limit){\n System.out.println(\"-1\");\n }\n else{\n System.out.println(cnt);\n }",
"cnt>limit",
"cnt",
"limit",
"{\n System.out.println(\"-1\");\n }",
"System.out.println(\"-1\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"{\n System.out.println(cnt);\n }",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"static int lcm(int a,int 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*gcd(a,b)",
"a",
"b",
"gcd(a,b)",
"gcd",
"a",
"b",
"int a",
"a",
"int b",
"b",
"static int gcd(int a,int b){\n if(a%b!=0){\n return gcd(b,a%b);\n }\n else{\n return b;\n }\n }",
"gcd",
"{\n if(a%b!=0){\n return gcd(b,a%b);\n }\n else{\n return b;\n }\n }",
"if(a%b!=0){\n return gcd(b,a%b);\n }\n else{\n return b;\n }",
"a%b!=0",
"a%b",
"a",
"b",
"0",
"{\n return gcd(b,a%b);\n }",
"return gcd(b,a%b);",
"gcd(b,a%b)",
"gcd",
"b",
"a%b",
"a",
"b",
"{\n return b;\n }",
"return b;",
"b",
"int a",
"a",
"int b",
"b",
"static String toSmall(String s){\n return s.toLowerCase();\n }",
"toSmall",
"{\n return s.toLowerCase();\n }",
"return s.toLowerCase();",
"s.toLowerCase()",
"s.toLowerCase",
"s",
"String s",
"s",
"static String toBig(String s){\n return s.toUpperCase();\n }",
"toBig",
"{\n return s.toUpperCase();\n }",
"return s.toUpperCase();",
"s.toUpperCase()",
"s.toUpperCase",
"s",
"String s",
"s",
"static String next(){\n return sc.next();\n }",
"next",
"{\n return sc.next();\n }",
"return sc.next();",
"sc.next()",
"sc.next",
"sc",
"static int nextInt(){\n return Integer.parseInt(sc.next());\n }",
"nextInt",
"{\n return Integer.parseInt(sc.next());\n }",
"return Integer.parseInt(sc.next());",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"static long nextLong(){\n return Long.parseLong(sc.next());\n }",
"nextLong",
"{\n return Long.parseLong(sc.next());\n }",
"return Long.parseLong(sc.next());",
"Long.parseLong(sc.next())",
"Long.parseLong",
"Long",
"sc.next()",
"sc.next",
"sc",
"static double nextDouble(){\n return Double.parseDouble(sc.next());\n }",
"nextDouble",
"{\n return Double.parseDouble(sc.next());\n }",
"return Double.parseDouble(sc.next());",
"Double.parseDouble(sc.next())",
"Double.parseDouble",
"Double",
"sc.next()",
"sc.next",
"sc",
"static String[] splitString(String s){\n return s.split(\"\");\n }",
"splitString",
"{\n return s.split(\"\");\n }",
"return s.split(\"\");",
"s.split(\"\")",
"s.split",
"s",
"\"\"",
"String s",
"s",
"static char[] splitChar(String s){\n return s.toCharArray();\n }",
"splitChar",
"{\n return s.toCharArray();\n }",
"return s.toCharArray();",
"s.toCharArray()",
"s.toCharArray",
"s",
"String s",
"s",
"static int charToInt(char a){\n return a - 48;\n }",
"charToInt",
"{\n return a - 48;\n }",
"return a - 48;",
"a - 48",
"a",
"48",
"char a",
"a",
"////////////////////////////////////////////\n public static int max(int[] a){\n int lng = a.length;\n int max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }",
"max",
"{\n int lng = a.length;\n int max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }",
"int lng = a.length;",
"lng",
"a.length",
"a",
"a.length",
"int max = a[0];",
"max",
"a[0]",
"a",
"0",
"for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<lng",
"i",
"lng",
"i++",
"i++",
"i",
"{\n max = Math.max(max,a[i]);\n }",
"{\n max = Math.max(max,a[i]);\n }",
"max = Math.max(max,a[i])",
"max",
"Math.max(max,a[i])",
"Math.max",
"Math",
"max",
"a[i]",
"a",
"i",
"return max;",
"max",
"int[] a",
"a",
"public static long max(long[] a){\n int lng = a.length;\n long max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }",
"max",
"{\n int lng = a.length;\n long max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }",
"int lng = a.length;",
"lng",
"a.length",
"a",
"a.length",
"long max = a[0];",
"max",
"a[0]",
"a",
"0",
"for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<lng",
"i",
"lng",
"i++",
"i++",
"i",
"{\n max = Math.max(max,a[i]);\n }",
"{\n max = Math.max(max,a[i]);\n }",
"max = Math.max(max,a[i])",
"max",
"Math.max(max,a[i])",
"Math.max",
"Math",
"max",
"a[i]",
"a",
"i",
"return max;",
"max",
"long[] a",
"a",
"////////////////////////////////////////////\n public static int min(int[] a){\n int lng = a.length;\n int min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }",
"min",
"{\n int lng = a.length;\n int min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }",
"int lng = a.length;",
"lng",
"a.length",
"a",
"a.length",
"int min = a[0];",
"min",
"a[0]",
"a",
"0",
"for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<lng",
"i",
"lng",
"i++",
"i++",
"i",
"{\n min = Math.min(min,a[i]);\n }",
"{\n min = Math.min(min,a[i]);\n }",
"min = Math.min(min,a[i])",
"min",
"Math.min(min,a[i])",
"Math.min",
"Math",
"min",
"a[i]",
"a",
"i",
"return min;",
"min",
"int[] a",
"a",
"public static long min(long[] a){\n int lng = a.length;\n long min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }",
"min",
"{\n int lng = a.length;\n long min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }",
"int lng = a.length;",
"lng",
"a.length",
"a",
"a.length",
"long min = a[0];",
"min",
"a[0]",
"a",
"0",
"for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<lng",
"i",
"lng",
"i++",
"i++",
"i",
"{\n min = Math.min(min,a[i]);\n }",
"{\n min = Math.min(min,a[i]);\n }",
"min = Math.min(min,a[i])",
"min",
"Math.min(min,a[i])",
"Math.min",
"Math",
"min",
"a[i]",
"a",
"i",
"return min;",
"min",
"long[] a",
"a",
"public class Main{\n\n static Scanner sc = new Scanner(System.in);\n static StringBuilder sb = new StringBuilder();\n\n public static void main(String[] args) {\n\n\tint n = nextInt();\n long[] a = new long[n];\n for(int i=0;i<n;i++){\n a[i] = nextLong();\n if(a[i]==0){\n System.out.println(\"0\");\n System.exit(0);\n }\n }\n \n double ans = 0;\n \n for(int i=0;i<n;i++){\n ans += Math.log10(a[i]);\n }\n \n //System.out.println(\"ans=\"+ans);\n \n long limit = (long)Math.pow(10,18);\n \n if(ans>18.0){\n System.out.println(\"-1\");\n }\n else{\n long cnt = 1;\n for(int i=0;i<n;i++){\n cnt *= a[i];\n }\n if(cnt>limit){\n System.out.println(\"-1\");\n }\n else{\n System.out.println(cnt);\n }\n \n } \n \n\n }\n\n static int lcm(int a,int b){\n return a*b*gcd(a,b);\n }\n\n static int gcd(int a,int b){\n if(a%b!=0){\n return gcd(b,a%b);\n }\n else{\n return b;\n }\n }\n\n /*\n static String toSmall(String s){\n char c = s.charAt(0);\n //if(Character.isUpperCase(c)){\n if(c<=90){\n c += 32;\n }\n return String.valueOf(c);\n }\n static String toBig(String s){\n char c = s.charAt(0);\n //if(Character.isLowerCase(c)){\n if(c>=97){\n c -= 32;\n }\n return String.valueOf(c);\n }\n */\n\n static String toSmall(String s){\n return s.toLowerCase();\n }\n\n static String toBig(String s){\n return s.toUpperCase();\n }\n\n static String next(){\n return sc.next();\n }\n\n static int nextInt(){\n return Integer.parseInt(sc.next());\n }\n\n static long nextLong(){\n return Long.parseLong(sc.next());\n }\n\n static double nextDouble(){\n return Double.parseDouble(sc.next());\n }\n\n static String[] splitString(String s){\n return s.split(\"\");\n }\n\n static char[] splitChar(String s){\n return s.toCharArray();\n }\n\n static int charToInt(char a){\n return a - 48;\n }\n\n////////////////////////////////////////////\n public static int max(int[] a){\n int lng = a.length;\n int max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }\n public static long max(long[] a){\n int lng = a.length;\n long max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }\n////////////////////////////////////////////\n\n////////////////////////////////////////////\n public static int min(int[] a){\n int lng = a.length;\n int min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }\n public static long min(long[] a){\n int lng = a.length;\n long min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }\n////////////////////////////////////////////\n\n}",
"public class Main{\n\n static Scanner sc = new Scanner(System.in);\n static StringBuilder sb = new StringBuilder();\n\n public static void main(String[] args) {\n\n\tint n = nextInt();\n long[] a = new long[n];\n for(int i=0;i<n;i++){\n a[i] = nextLong();\n if(a[i]==0){\n System.out.println(\"0\");\n System.exit(0);\n }\n }\n \n double ans = 0;\n \n for(int i=0;i<n;i++){\n ans += Math.log10(a[i]);\n }\n \n //System.out.println(\"ans=\"+ans);\n \n long limit = (long)Math.pow(10,18);\n \n if(ans>18.0){\n System.out.println(\"-1\");\n }\n else{\n long cnt = 1;\n for(int i=0;i<n;i++){\n cnt *= a[i];\n }\n if(cnt>limit){\n System.out.println(\"-1\");\n }\n else{\n System.out.println(cnt);\n }\n \n } \n \n\n }\n\n static int lcm(int a,int b){\n return a*b*gcd(a,b);\n }\n\n static int gcd(int a,int b){\n if(a%b!=0){\n return gcd(b,a%b);\n }\n else{\n return b;\n }\n }\n\n /*\n static String toSmall(String s){\n char c = s.charAt(0);\n //if(Character.isUpperCase(c)){\n if(c<=90){\n c += 32;\n }\n return String.valueOf(c);\n }\n static String toBig(String s){\n char c = s.charAt(0);\n //if(Character.isLowerCase(c)){\n if(c>=97){\n c -= 32;\n }\n return String.valueOf(c);\n }\n */\n\n static String toSmall(String s){\n return s.toLowerCase();\n }\n\n static String toBig(String s){\n return s.toUpperCase();\n }\n\n static String next(){\n return sc.next();\n }\n\n static int nextInt(){\n return Integer.parseInt(sc.next());\n }\n\n static long nextLong(){\n return Long.parseLong(sc.next());\n }\n\n static double nextDouble(){\n return Double.parseDouble(sc.next());\n }\n\n static String[] splitString(String s){\n return s.split(\"\");\n }\n\n static char[] splitChar(String s){\n return s.toCharArray();\n }\n\n static int charToInt(char a){\n return a - 48;\n }\n\n////////////////////////////////////////////\n public static int max(int[] a){\n int lng = a.length;\n int max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }\n public static long max(long[] a){\n int lng = a.length;\n long max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }\n////////////////////////////////////////////\n\n////////////////////////////////////////////\n public static int min(int[] a){\n int lng = a.length;\n int min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }\n public static long min(long[] a){\n int lng = a.length;\n long min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }\n////////////////////////////////////////////\n\n}",
"Main"
] |
import java.util.*;
//update 2020/1/1 23:01
public class Main{
static Scanner sc = new Scanner(System.in);
static StringBuilder sb = new StringBuilder();
public static void main(String[] args) {
int n = nextInt();
long[] a = new long[n];
for(int i=0;i<n;i++){
a[i] = nextLong();
if(a[i]==0){
System.out.println("0");
System.exit(0);
}
}
double ans = 0;
for(int i=0;i<n;i++){
ans += Math.log10(a[i]);
}
//System.out.println("ans="+ans);
long limit = (long)Math.pow(10,18);
if(ans>18.0){
System.out.println("-1");
}
else{
long cnt = 1;
for(int i=0;i<n;i++){
cnt *= a[i];
}
if(cnt>limit){
System.out.println("-1");
}
else{
System.out.println(cnt);
}
}
}
static int lcm(int a,int b){
return a*b*gcd(a,b);
}
static int gcd(int a,int b){
if(a%b!=0){
return gcd(b,a%b);
}
else{
return b;
}
}
/*
static String toSmall(String s){
char c = s.charAt(0);
//if(Character.isUpperCase(c)){
if(c<=90){
c += 32;
}
return String.valueOf(c);
}
static String toBig(String s){
char c = s.charAt(0);
//if(Character.isLowerCase(c)){
if(c>=97){
c -= 32;
}
return String.valueOf(c);
}
*/
static String toSmall(String s){
return s.toLowerCase();
}
static String toBig(String s){
return s.toUpperCase();
}
static String next(){
return sc.next();
}
static int nextInt(){
return Integer.parseInt(sc.next());
}
static long nextLong(){
return Long.parseLong(sc.next());
}
static double nextDouble(){
return Double.parseDouble(sc.next());
}
static String[] splitString(String s){
return s.split("");
}
static char[] splitChar(String s){
return s.toCharArray();
}
static int charToInt(char a){
return a - 48;
}
////////////////////////////////////////////
public static int max(int[] a){
int lng = a.length;
int max = a[0];
for(int i=1;i<lng;i++){
max = Math.max(max,a[i]);
}
return max;
}
public static long max(long[] a){
int lng = a.length;
long max = a[0];
for(int i=1;i<lng;i++){
max = Math.max(max,a[i]);
}
return max;
}
////////////////////////////////////////////
////////////////////////////////////////////
public static int min(int[] a){
int lng = a.length;
int min = a[0];
for(int i=1;i<lng;i++){
min = Math.min(min,a[i]);
}
return min;
}
public static long min(long[] a){
int lng = a.length;
long min = a[0];
for(int i=1;i<lng;i++){
min = Math.min(min,a[i]);
}
return min;
}
////////////////////////////////////////////
}
|
[
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
0,
18,
13,
13,
20,
14,
2,
4,
18,
18,
13,
13,
20,
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,
0,
13,
4,
18,
13,
18,
13,
13,
14,
2,
4,
18,
13,
20,
17,
30,
4,
18,
18,
13,
13,
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
],
[
117,
8
],
[
117,
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
],
[
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
],
[
40,
42
],
[
42,
43
],
[
43,
44
],
[
39,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
39,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
51,
58
],
[
50,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
60,
65
],
[
59,
66
],
[
11,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
69,
71
],
[
11,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
72,
77
],
[
77,
78
],
[
77,
79
],
[
72,
80
],
[
80,
81
],
[
81,
82
],
[
72,
83
],
[
84,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
90,
91
],
[
90,
92
],
[
84,
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
],
[
100,
107
],
[
11,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
9,
114
],
[
114,
115
],
[
0,
116
],
[
116,
117
],
[
116,
118
]
] |
[
"// Java program to find large factorials using BigInteger \nimport java.math.BigInteger; \nimport java.util.Scanner; \n\npublic class Main\n{\n\n\t// Driver method \n\tpublic static void main(String args[]) throws Exception \n\t{ \n \tScanner sc=new Scanner(System.in);\n\t\tint N = sc.nextInt();\n BigInteger [] a = new BigInteger[N];\n String MX = \"1000000000000000000\";\n for(int i=0;i<N;i++)\n {\n String str = sc.next();\n a[i]=new BigInteger(str); \n if(a[i].compareTo(new BigInteger(\"0\"))==0)\n {\n System.out.println(\"0\");\n return ;\n }\n }\n BigInteger f= a[0];\n for(int i=1;i<N;i++)\n {\n f=f.multiply(a[i]);\n if(f.compareTo(new BigInteger(MX))==1)\n {\n System.out.println(\"-1\");\n return ;\n }\n }\n\t\tSystem.out.println(f); \n\t} \n} ",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main\n{\n\n\t// Driver method \n\tpublic static void main(String args[]) throws Exception \n\t{ \n \tScanner sc=new Scanner(System.in);\n\t\tint N = sc.nextInt();\n BigInteger [] a = new BigInteger[N];\n String MX = \"1000000000000000000\";\n for(int i=0;i<N;i++)\n {\n String str = sc.next();\n a[i]=new BigInteger(str); \n if(a[i].compareTo(new BigInteger(\"0\"))==0)\n {\n System.out.println(\"0\");\n return ;\n }\n }\n BigInteger f= a[0];\n for(int i=1;i<N;i++)\n {\n f=f.multiply(a[i]);\n if(f.compareTo(new BigInteger(MX))==1)\n {\n System.out.println(\"-1\");\n return ;\n }\n }\n\t\tSystem.out.println(f); \n\t} \n}",
"Main",
"// Driver method \n\tpublic static void main(String args[]) throws Exception \n\t{ \n \tScanner sc=new Scanner(System.in);\n\t\tint N = sc.nextInt();\n BigInteger [] a = new BigInteger[N];\n String MX = \"1000000000000000000\";\n for(int i=0;i<N;i++)\n {\n String str = sc.next();\n a[i]=new BigInteger(str); \n if(a[i].compareTo(new BigInteger(\"0\"))==0)\n {\n System.out.println(\"0\");\n return ;\n }\n }\n BigInteger f= a[0];\n for(int i=1;i<N;i++)\n {\n f=f.multiply(a[i]);\n if(f.compareTo(new BigInteger(MX))==1)\n {\n System.out.println(\"-1\");\n return ;\n }\n }\n\t\tSystem.out.println(f); \n\t}",
"main",
"{ \n \tScanner sc=new Scanner(System.in);\n\t\tint N = sc.nextInt();\n BigInteger [] a = new BigInteger[N];\n String MX = \"1000000000000000000\";\n for(int i=0;i<N;i++)\n {\n String str = sc.next();\n a[i]=new BigInteger(str); \n if(a[i].compareTo(new BigInteger(\"0\"))==0)\n {\n System.out.println(\"0\");\n return ;\n }\n }\n BigInteger f= a[0];\n for(int i=1;i<N;i++)\n {\n f=f.multiply(a[i]);\n if(f.compareTo(new BigInteger(MX))==1)\n {\n System.out.println(\"-1\");\n return ;\n }\n }\n\t\tSystem.out.println(f); \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",
"String MX = \"1000000000000000000\";",
"MX",
"\"1000000000000000000\"",
"for(int i=0;i<N;i++)\n {\n String str = sc.next();\n a[i]=new BigInteger(str); \n if(a[i].compareTo(new BigInteger(\"0\"))==0)\n {\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 String str = sc.next();\n a[i]=new BigInteger(str); \n if(a[i].compareTo(new BigInteger(\"0\"))==0)\n {\n System.out.println(\"0\");\n return ;\n }\n }",
"{\n String str = sc.next();\n a[i]=new BigInteger(str); \n if(a[i].compareTo(new BigInteger(\"0\"))==0)\n {\n System.out.println(\"0\");\n return ;\n }\n }",
"String str = sc.next();",
"str",
"sc.next()",
"sc.next",
"sc",
"a[i]=new BigInteger(str)",
"a[i]",
"a",
"i",
"new BigInteger(str)",
"if(a[i].compareTo(new BigInteger(\"0\"))==0)\n {\n System.out.println(\"0\");\n return ;\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 System.out.println(\"0\");\n return ;\n }",
"System.out.println(\"0\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"0\"",
"return ;",
"BigInteger f= a[0];",
"f",
"a[0]",
"a",
"0",
"for(int i=1;i<N;i++)\n {\n f=f.multiply(a[i]);\n if(f.compareTo(new BigInteger(MX))==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 f=f.multiply(a[i]);\n if(f.compareTo(new BigInteger(MX))==1)\n {\n System.out.println(\"-1\");\n return ;\n }\n }",
"{\n f=f.multiply(a[i]);\n if(f.compareTo(new BigInteger(MX))==1)\n {\n System.out.println(\"-1\");\n return ;\n }\n }",
"f=f.multiply(a[i])",
"f",
"f.multiply(a[i])",
"f.multiply",
"f",
"a[i]",
"a",
"i",
"if(f.compareTo(new BigInteger(MX))==1)\n {\n System.out.println(\"-1\");\n return ;\n }",
"f.compareTo(new BigInteger(MX))==1",
"f.compareTo(new BigInteger(MX))",
"f.compareTo",
"f",
"new BigInteger(MX)",
"1",
"{\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(f)",
"System.out.println",
"System.out",
"System",
"System.out",
"f",
"String args[]",
"args",
"public class Main\n{\n\n\t// Driver method \n\tpublic static void main(String args[]) throws Exception \n\t{ \n \tScanner sc=new Scanner(System.in);\n\t\tint N = sc.nextInt();\n BigInteger [] a = new BigInteger[N];\n String MX = \"1000000000000000000\";\n for(int i=0;i<N;i++)\n {\n String str = sc.next();\n a[i]=new BigInteger(str); \n if(a[i].compareTo(new BigInteger(\"0\"))==0)\n {\n System.out.println(\"0\");\n return ;\n }\n }\n BigInteger f= a[0];\n for(int i=1;i<N;i++)\n {\n f=f.multiply(a[i]);\n if(f.compareTo(new BigInteger(MX))==1)\n {\n System.out.println(\"-1\");\n return ;\n }\n }\n\t\tSystem.out.println(f); \n\t} \n}",
"public class Main\n{\n\n\t// Driver method \n\tpublic static void main(String args[]) throws Exception \n\t{ \n \tScanner sc=new Scanner(System.in);\n\t\tint N = sc.nextInt();\n BigInteger [] a = new BigInteger[N];\n String MX = \"1000000000000000000\";\n for(int i=0;i<N;i++)\n {\n String str = sc.next();\n a[i]=new BigInteger(str); \n if(a[i].compareTo(new BigInteger(\"0\"))==0)\n {\n System.out.println(\"0\");\n return ;\n }\n }\n BigInteger f= a[0];\n for(int i=1;i<N;i++)\n {\n f=f.multiply(a[i]);\n if(f.compareTo(new BigInteger(MX))==1)\n {\n System.out.println(\"-1\");\n return ;\n }\n }\n\t\tSystem.out.println(f); \n\t} \n}",
"Main"
] |
// Java program to find large factorials using BigInteger
import java.math.BigInteger;
import java.util.Scanner;
public class Main
{
// Driver method
public static void main(String args[]) throws Exception
{
Scanner sc=new Scanner(System.in);
int N = sc.nextInt();
BigInteger [] a = new BigInteger[N];
String MX = "1000000000000000000";
for(int i=0;i<N;i++)
{
String str = sc.next();
a[i]=new BigInteger(str);
if(a[i].compareTo(new BigInteger("0"))==0)
{
System.out.println("0");
return ;
}
}
BigInteger f= a[0];
for(int i=1;i<N;i++)
{
f=f.multiply(a[i]);
if(f.compareTo(new BigInteger(MX))==1)
{
System.out.println("-1");
return ;
}
}
System.out.println(f);
}
}
|
[
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,
41,
13,
17,
11,
1,
0,
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,
30,
41,
13,
20,
41,
13,
17,
0,
13,
4,
18,
13,
13,
41,
13,
17,
41,
13,
20,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
18,
13,
13,
0,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
0,
13,
17,
3,
14,
2,
13,
17,
4,
18,
18,
13,
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
],
[
152,
8
],
[
152,
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
],
[
11,
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
],
[
54,
56
],
[
53,
57
],
[
52,
58
],
[
58,
59
],
[
58,
60
],
[
11,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
66,
71
],
[
61,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
76,
78
],
[
72,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
72,
85
],
[
85,
86
],
[
85,
87
],
[
72,
88
],
[
88,
89
],
[
88,
90
],
[
72,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
96,
97
],
[
96,
98
],
[
91,
99
],
[
99,
100
],
[
100,
101
],
[
91,
102
],
[
103,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
106,
108
],
[
103,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
114,
115
],
[
115,
116
],
[
114,
117
],
[
103,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
103,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
72,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
137,
142
],
[
133,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
143,
148
],
[
9,
149
],
[
149,
150
],
[
0,
151
],
[
151,
152
],
[
151,
153
]
] |
[
"/******************************************************************************\n\n Online Java Compiler.\n Code, Compile, Run and Debug java program online.\nWrite your code in this editor and press \"Run\" button to execute it.\n\n*******************************************************************************/\nimport java.util.*;\nimport java.math.*;\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\tlong []a = new long[n];\n\t\tlong ans = 1;\n\t\tint i,k=0;\n\t\tfor(i=0; i<n; i++)\n\t\t{\n\t\t a[i] = sc.nextLong();\n\t\t if(a[i] == 0)\n\t\t k = 1;\n\t\t}\n\t\tif(k == 1)\n\t\t{\n\t\t System.out.println(0);\n\t\t}\n\t\telse\n\t\t{\n\t\t \n\t\tBigInteger b = new BigInteger(\"10\");\n\t\tint ex = 18;\n\t\tb = b.pow(ex);\n\t\tint p = 0;\n\t\tBigInteger f = new BigInteger(\"1\");\n\t\tfor(i=0; i<n; i++)\n\t\t{\n\t\t long x = a[i];\n\t\t f = f.multiply(BigInteger.valueOf(x));\n\t\t int com = f.compareTo(b);\n\t\t if(com == 1)\n\t\t {\n\t\t p = 1;\n\t\t break;\n\t\t }\n\t\t \n\t\t}\n\t if(p == 1)\n\t System.out.println(\"-1\");\n\t else\n\t System.out.println(f);\n\t\t}\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"import java.math.*;",
"math.*",
"java",
"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\tlong []a = new long[n];\n\t\tlong ans = 1;\n\t\tint i,k=0;\n\t\tfor(i=0; i<n; i++)\n\t\t{\n\t\t a[i] = sc.nextLong();\n\t\t if(a[i] == 0)\n\t\t k = 1;\n\t\t}\n\t\tif(k == 1)\n\t\t{\n\t\t System.out.println(0);\n\t\t}\n\t\telse\n\t\t{\n\t\t \n\t\tBigInteger b = new BigInteger(\"10\");\n\t\tint ex = 18;\n\t\tb = b.pow(ex);\n\t\tint p = 0;\n\t\tBigInteger f = new BigInteger(\"1\");\n\t\tfor(i=0; i<n; i++)\n\t\t{\n\t\t long x = a[i];\n\t\t f = f.multiply(BigInteger.valueOf(x));\n\t\t int com = f.compareTo(b);\n\t\t if(com == 1)\n\t\t {\n\t\t p = 1;\n\t\t break;\n\t\t }\n\t\t \n\t\t}\n\t if(p == 1)\n\t System.out.println(\"-1\");\n\t else\n\t System.out.println(f);\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\tlong []a = new long[n];\n\t\tlong ans = 1;\n\t\tint i,k=0;\n\t\tfor(i=0; i<n; i++)\n\t\t{\n\t\t a[i] = sc.nextLong();\n\t\t if(a[i] == 0)\n\t\t k = 1;\n\t\t}\n\t\tif(k == 1)\n\t\t{\n\t\t System.out.println(0);\n\t\t}\n\t\telse\n\t\t{\n\t\t \n\t\tBigInteger b = new BigInteger(\"10\");\n\t\tint ex = 18;\n\t\tb = b.pow(ex);\n\t\tint p = 0;\n\t\tBigInteger f = new BigInteger(\"1\");\n\t\tfor(i=0; i<n; i++)\n\t\t{\n\t\t long x = a[i];\n\t\t f = f.multiply(BigInteger.valueOf(x));\n\t\t int com = f.compareTo(b);\n\t\t if(com == 1)\n\t\t {\n\t\t p = 1;\n\t\t break;\n\t\t }\n\t\t \n\t\t}\n\t if(p == 1)\n\t System.out.println(\"-1\");\n\t else\n\t System.out.println(f);\n\t\t}\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\tint i,k=0;\n\t\tfor(i=0; i<n; i++)\n\t\t{\n\t\t a[i] = sc.nextLong();\n\t\t if(a[i] == 0)\n\t\t k = 1;\n\t\t}\n\t\tif(k == 1)\n\t\t{\n\t\t System.out.println(0);\n\t\t}\n\t\telse\n\t\t{\n\t\t \n\t\tBigInteger b = new BigInteger(\"10\");\n\t\tint ex = 18;\n\t\tb = b.pow(ex);\n\t\tint p = 0;\n\t\tBigInteger f = new BigInteger(\"1\");\n\t\tfor(i=0; i<n; i++)\n\t\t{\n\t\t long x = a[i];\n\t\t f = f.multiply(BigInteger.valueOf(x));\n\t\t int com = f.compareTo(b);\n\t\t if(com == 1)\n\t\t {\n\t\t p = 1;\n\t\t break;\n\t\t }\n\t\t \n\t\t}\n\t if(p == 1)\n\t System.out.println(\"-1\");\n\t else\n\t System.out.println(f);\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",
"long []a = new long[n];",
"a",
"new long[n]",
"n",
"long ans = 1;",
"ans",
"1",
"int i",
"i",
"k=0;",
"k",
"0",
"for(i=0; i<n; i++)\n\t\t{\n\t\t a[i] = sc.nextLong();\n\t\t if(a[i] == 0)\n\t\t k = 1;\n\t\t}",
"i=0;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t a[i] = sc.nextLong();\n\t\t if(a[i] == 0)\n\t\t k = 1;\n\t\t}",
"{\n\t\t a[i] = sc.nextLong();\n\t\t if(a[i] == 0)\n\t\t k = 1;\n\t\t}",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(a[i] == 0)\n\t\t k = 1;",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"k = 1",
"k",
"1",
"if(k == 1)\n\t\t{\n\t\t System.out.println(0);\n\t\t}\n\t\telse\n\t\t{\n\t\t \n\t\tBigInteger b = new BigInteger(\"10\");\n\t\tint ex = 18;\n\t\tb = b.pow(ex);\n\t\tint p = 0;\n\t\tBigInteger f = new BigInteger(\"1\");\n\t\tfor(i=0; i<n; i++)\n\t\t{\n\t\t long x = a[i];\n\t\t f = f.multiply(BigInteger.valueOf(x));\n\t\t int com = f.compareTo(b);\n\t\t if(com == 1)\n\t\t {\n\t\t p = 1;\n\t\t break;\n\t\t }\n\t\t \n\t\t}\n\t if(p == 1)\n\t System.out.println(\"-1\");\n\t else\n\t System.out.println(f);\n\t\t}",
"k == 1",
"k",
"1",
"{\n\t\t System.out.println(0);\n\t\t}",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"{\n\t\t \n\t\tBigInteger b = new BigInteger(\"10\");\n\t\tint ex = 18;\n\t\tb = b.pow(ex);\n\t\tint p = 0;\n\t\tBigInteger f = new BigInteger(\"1\");\n\t\tfor(i=0; i<n; i++)\n\t\t{\n\t\t long x = a[i];\n\t\t f = f.multiply(BigInteger.valueOf(x));\n\t\t int com = f.compareTo(b);\n\t\t if(com == 1)\n\t\t {\n\t\t p = 1;\n\t\t break;\n\t\t }\n\t\t \n\t\t}\n\t if(p == 1)\n\t System.out.println(\"-1\");\n\t else\n\t System.out.println(f);\n\t\t}",
"BigInteger b = new BigInteger(\"10\");",
"b",
"new BigInteger(\"10\")",
"int ex = 18;",
"ex",
"18",
"b = b.pow(ex)",
"b",
"b.pow(ex)",
"b.pow",
"b",
"ex",
"int p = 0;",
"p",
"0",
"BigInteger f = new BigInteger(\"1\");",
"f",
"new BigInteger(\"1\")",
"for(i=0; i<n; i++)\n\t\t{\n\t\t long x = a[i];\n\t\t f = f.multiply(BigInteger.valueOf(x));\n\t\t int com = f.compareTo(b);\n\t\t if(com == 1)\n\t\t {\n\t\t p = 1;\n\t\t break;\n\t\t }\n\t\t \n\t\t}",
"i=0;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t long x = a[i];\n\t\t f = f.multiply(BigInteger.valueOf(x));\n\t\t int com = f.compareTo(b);\n\t\t if(com == 1)\n\t\t {\n\t\t p = 1;\n\t\t break;\n\t\t }\n\t\t \n\t\t}",
"{\n\t\t long x = a[i];\n\t\t f = f.multiply(BigInteger.valueOf(x));\n\t\t int com = f.compareTo(b);\n\t\t if(com == 1)\n\t\t {\n\t\t p = 1;\n\t\t break;\n\t\t }\n\t\t \n\t\t}",
"long x = a[i];",
"x",
"a[i]",
"a",
"i",
"f = f.multiply(BigInteger.valueOf(x))",
"f",
"f.multiply(BigInteger.valueOf(x))",
"f.multiply",
"f",
"BigInteger.valueOf(x)",
"BigInteger.valueOf",
"BigInteger",
"x",
"int com = f.compareTo(b);",
"com",
"f.compareTo(b)",
"f.compareTo",
"f",
"b",
"if(com == 1)\n\t\t {\n\t\t p = 1;\n\t\t break;\n\t\t }",
"com == 1",
"com",
"1",
"{\n\t\t p = 1;\n\t\t break;\n\t\t }",
"p = 1",
"p",
"1",
"break;",
"if(p == 1)\n\t System.out.println(\"-1\");\n\t else\n\t System.out.println(f);",
"p == 1",
"p",
"1",
"System.out.println(\"-1\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"System.out.println(f)",
"System.out.println",
"System.out",
"System",
"System.out",
"f",
"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\tlong []a = new long[n];\n\t\tlong ans = 1;\n\t\tint i,k=0;\n\t\tfor(i=0; i<n; i++)\n\t\t{\n\t\t a[i] = sc.nextLong();\n\t\t if(a[i] == 0)\n\t\t k = 1;\n\t\t}\n\t\tif(k == 1)\n\t\t{\n\t\t System.out.println(0);\n\t\t}\n\t\telse\n\t\t{\n\t\t \n\t\tBigInteger b = new BigInteger(\"10\");\n\t\tint ex = 18;\n\t\tb = b.pow(ex);\n\t\tint p = 0;\n\t\tBigInteger f = new BigInteger(\"1\");\n\t\tfor(i=0; i<n; i++)\n\t\t{\n\t\t long x = a[i];\n\t\t f = f.multiply(BigInteger.valueOf(x));\n\t\t int com = f.compareTo(b);\n\t\t if(com == 1)\n\t\t {\n\t\t p = 1;\n\t\t break;\n\t\t }\n\t\t \n\t\t}\n\t if(p == 1)\n\t System.out.println(\"-1\");\n\t else\n\t System.out.println(f);\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\tlong []a = new long[n];\n\t\tlong ans = 1;\n\t\tint i,k=0;\n\t\tfor(i=0; i<n; i++)\n\t\t{\n\t\t a[i] = sc.nextLong();\n\t\t if(a[i] == 0)\n\t\t k = 1;\n\t\t}\n\t\tif(k == 1)\n\t\t{\n\t\t System.out.println(0);\n\t\t}\n\t\telse\n\t\t{\n\t\t \n\t\tBigInteger b = new BigInteger(\"10\");\n\t\tint ex = 18;\n\t\tb = b.pow(ex);\n\t\tint p = 0;\n\t\tBigInteger f = new BigInteger(\"1\");\n\t\tfor(i=0; i<n; i++)\n\t\t{\n\t\t long x = a[i];\n\t\t f = f.multiply(BigInteger.valueOf(x));\n\t\t int com = f.compareTo(b);\n\t\t if(com == 1)\n\t\t {\n\t\t p = 1;\n\t\t break;\n\t\t }\n\t\t \n\t\t}\n\t if(p == 1)\n\t System.out.println(\"-1\");\n\t else\n\t System.out.println(f);\n\t\t}\n\t}\n}",
"Main"
] |
/******************************************************************************
Online Java Compiler.
Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.
*******************************************************************************/
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();
long []a = new long[n];
long ans = 1;
int i,k=0;
for(i=0; i<n; i++)
{
a[i] = sc.nextLong();
if(a[i] == 0)
k = 1;
}
if(k == 1)
{
System.out.println(0);
}
else
{
BigInteger b = new BigInteger("10");
int ex = 18;
b = b.pow(ex);
int p = 0;
BigInteger f = new BigInteger("1");
for(i=0; i<n; i++)
{
long x = a[i];
f = f.multiply(BigInteger.valueOf(x));
int com = f.compareTo(b);
if(com == 1)
{
p = 1;
break;
}
}
if(p == 1)
System.out.println("-1");
else
System.out.println(f);
}
}
}
|
[
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,
20,
4,
18,
20,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
20,
14,
4,
18,
13,
18,
13,
13,
30,
4,
18,
13,
17,
29,
4,
18,
13,
13,
41,
13,
20,
41,
13,
18,
13,
13,
28,
13,
13,
30,
30,
0,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
13,
40,
17,
29,
4,
18,
13,
13,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
20,
17,
41,
13,
17,
41,
13,
17,
12,
13,
30,
0,
18,
36,
13,
13,
23,
13,
12,
13,
30,
41,
13,
20,
11,
1,
41,
13,
4,
13,
40,
4,
13,
13,
30,
30,
4,
18,
13,
13,
0,
13,
4,
13,
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,
29,
4,
13,
12,
13,
30,
11,
1,
41,
13,
2,
0,
13,
4,
13,
40,
17,
30,
30,
14,
40,
4,
13,
13,
30,
29,
13,
29,
40,
17,
12,
13,
30,
29,
2,
2,
13,
17,
2,
13,
17,
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,
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
],
[
301,
23
],
[
301,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
26,
30
],
[
30,
31
],
[
30,
32
],
[
26,
33
],
[
33,
34
],
[
34,
35
],
[
33,
36
],
[
33,
37
],
[
26,
38
],
[
38,
39
],
[
39,
40
],
[
24,
41
],
[
41,
42
],
[
301,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
45,
51
],
[
51,
52
],
[
51,
53
],
[
45,
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
],
[
67,
69
],
[
66,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
74,
75
],
[
74,
76
],
[
70,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
77,
82
],
[
66,
83
],
[
83,
84
],
[
84,
85
],
[
83,
86
],
[
45,
87
],
[
87,
88
],
[
87,
89
],
[
45,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
45,
95
],
[
95,
96
],
[
95,
97
],
[
95,
98
],
[
99,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
103,
104
],
[
102,
105
],
[
99,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
108,
111
],
[
107,
112
],
[
106,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
114,
117
],
[
117,
118
],
[
113,
119
],
[
45,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
43,
124
],
[
124,
125
],
[
43,
126
],
[
126,
127
],
[
301,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
128,
132
],
[
132,
133
],
[
132,
134
],
[
128,
136
],
[
136,
137
],
[
136,
138
],
[
128,
139
],
[
139,
140
],
[
139,
141
],
[
128,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
145,
149
],
[
142,
150
],
[
150,
151
],
[
128,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
158,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
158,
168
],
[
169,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
170,
173
],
[
169,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
154,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
128,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
186,
189
],
[
189,
190
],
[
128,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
196,
197
],
[
195,
198
],
[
198,
199
],
[
128,
200
],
[
200,
201
],
[
200,
202
],
[
202,
203
],
[
203,
204
],
[
204,
205
],
[
205,
206
],
[
204,
207
],
[
207,
208
],
[
128,
209
],
[
209,
210
],
[
209,
211
],
[
211,
212
],
[
212,
213
],
[
213,
214
],
[
128,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
218,
219
],
[
219,
220
],
[
220,
221
],
[
218,
222
],
[
222,
223
],
[
223,
224
],
[
223,
225
],
[
225,
226
],
[
222,
227
],
[
227,
228
],
[
218,
229
],
[
230,
230
],
[
230,
231
],
[
231,
232
],
[
232,
233
],
[
233,
234
],
[
233,
235
],
[
231,
236
],
[
236,
237
],
[
237,
238
],
[
217,
239
],
[
239,
240
],
[
240,
241
],
[
128,
242
],
[
242,
243
],
[
242,
244
],
[
244,
245
],
[
245,
246
],
[
246,
247
],
[
247,
248
],
[
247,
249
],
[
246,
250
],
[
250,
251
],
[
250,
252
],
[
242,
253
],
[
253,
254
],
[
128,
255
],
[
255,
256
],
[
255,
257
],
[
257,
258
],
[
258,
259
],
[
259,
260
],
[
259,
261
],
[
261,
262
],
[
258,
263
],
[
263,
264
],
[
264,
265
],
[
257,
266
],
[
266,
267
],
[
267,
268
],
[
267,
269
],
[
266,
270
],
[
270,
271
],
[
271,
272
],
[
271,
273
],
[
270,
274
],
[
274,
275
],
[
275,
276
],
[
275,
277
],
[
277,
278
],
[
278,
279
],
[
274,
280
],
[
280,
281
],
[
281,
282
],
[
281,
283
],
[
283,
284
],
[
284,
285
],
[
283,
286
],
[
270,
287
],
[
287,
288
],
[
288,
289
],
[
288,
290
],
[
287,
291
],
[
291,
292
],
[
292,
293
],
[
293,
294
],
[
257,
295
],
[
295,
296
],
[
296,
297
],
[
296,
298
],
[
298,
299
],
[
0,
300
],
[
300,
301
],
[
300,
302
]
] |
[
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.InputMismatchException;\nimport java.util.List;\n\npublic class Main {\n public static void main(String[] args) {\n PrintWriter out = new PrintWriter(System.out);\n InputStreamScanner in = new InputStreamScanner(System.in);\n new Main().solve(in, out);\n out.flush();\n }\n\n private void solve(InputStreamScanner in, PrintWriter out) {\n int n = in.nextInt();\n List<BigInteger> a = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n BigInteger bi = new BigInteger(in.next());\n if (bi.equals(BigInteger.ZERO)) {\n out.println(0);\n return;\n }\n a.add(bi);\n }\n BigInteger th = new BigInteger(\"1000000000000000000\");\n BigInteger ans = BigInteger.ONE;\n for (BigInteger bi : a) {\n ans = ans.multiply(bi);\n if (ans.compareTo(th) > 0) {\n out.println(-1);\n return;\n }\n }\n out.println(ans);\n }\n\n static class InputStreamScanner {\n\n private InputStream in;\n\n private byte[] buf = new byte[1024];\n private int len = 0;\n private int off = 0;\n\n InputStreamScanner(InputStream in)\t{\n this.in = in;\n }\n\n String next() {\n StringBuilder sb = new StringBuilder();\n for (int b = skip(); !isSpace(b);){\n sb.appendCodePoint(b);\n b = read();\n }\n return sb.toString();\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 char nextChar() {\n return (char)skip();\n }\n\n int skip() {\n for (int b; (b = read()) != -1;) {\n if (!isSpace(b)) {\n return b;\n }\n }\n return -1;\n }\n\n private boolean isSpace(int c) {\n return c < 33 || c > 126;\n }\n\n private int read() {\n if (len == -1) {\n throw new InputMismatchException(\"End of Input\");\n }\n if (off >= len){\n off = 0;\n try {\n len = in.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException(e.getMessage());\n }\n if (len <= 0) {\n return -1;\n }\n }\n return buf[off++];\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.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.InputMismatchException;",
"InputMismatchException",
"java.util",
"import java.util.List;",
"List",
"java.util",
"public class Main {\n public static void main(String[] args) {\n PrintWriter out = new PrintWriter(System.out);\n InputStreamScanner in = new InputStreamScanner(System.in);\n new Main().solve(in, out);\n out.flush();\n }\n\n private void solve(InputStreamScanner in, PrintWriter out) {\n int n = in.nextInt();\n List<BigInteger> a = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n BigInteger bi = new BigInteger(in.next());\n if (bi.equals(BigInteger.ZERO)) {\n out.println(0);\n return;\n }\n a.add(bi);\n }\n BigInteger th = new BigInteger(\"1000000000000000000\");\n BigInteger ans = BigInteger.ONE;\n for (BigInteger bi : a) {\n ans = ans.multiply(bi);\n if (ans.compareTo(th) > 0) {\n out.println(-1);\n return;\n }\n }\n out.println(ans);\n }\n\n static class InputStreamScanner {\n\n private InputStream in;\n\n private byte[] buf = new byte[1024];\n private int len = 0;\n private int off = 0;\n\n InputStreamScanner(InputStream in)\t{\n this.in = in;\n }\n\n String next() {\n StringBuilder sb = new StringBuilder();\n for (int b = skip(); !isSpace(b);){\n sb.appendCodePoint(b);\n b = read();\n }\n return sb.toString();\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 char nextChar() {\n return (char)skip();\n }\n\n int skip() {\n for (int b; (b = read()) != -1;) {\n if (!isSpace(b)) {\n return b;\n }\n }\n return -1;\n }\n\n private boolean isSpace(int c) {\n return c < 33 || c > 126;\n }\n\n private int read() {\n if (len == -1) {\n throw new InputMismatchException(\"End of Input\");\n }\n if (off >= len){\n off = 0;\n try {\n len = in.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException(e.getMessage());\n }\n if (len <= 0) {\n return -1;\n }\n }\n return buf[off++];\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n PrintWriter out = new PrintWriter(System.out);\n InputStreamScanner in = new InputStreamScanner(System.in);\n new Main().solve(in, out);\n out.flush();\n }",
"main",
"{\n PrintWriter out = new PrintWriter(System.out);\n InputStreamScanner in = new InputStreamScanner(System.in);\n new Main().solve(in, out);\n out.flush();\n }",
"PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"InputStreamScanner in = new InputStreamScanner(System.in);",
"in",
"new InputStreamScanner(System.in)",
"new Main().solve(in, out)",
"new Main().solve",
"new Main()",
"in",
"out",
"out.flush()",
"out.flush",
"out",
"String[] args",
"args",
"private void solve(InputStreamScanner in, PrintWriter out) {\n int n = in.nextInt();\n List<BigInteger> a = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n BigInteger bi = new BigInteger(in.next());\n if (bi.equals(BigInteger.ZERO)) {\n out.println(0);\n return;\n }\n a.add(bi);\n }\n BigInteger th = new BigInteger(\"1000000000000000000\");\n BigInteger ans = BigInteger.ONE;\n for (BigInteger bi : a) {\n ans = ans.multiply(bi);\n if (ans.compareTo(th) > 0) {\n out.println(-1);\n return;\n }\n }\n out.println(ans);\n }",
"solve",
"{\n int n = in.nextInt();\n List<BigInteger> a = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n BigInteger bi = new BigInteger(in.next());\n if (bi.equals(BigInteger.ZERO)) {\n out.println(0);\n return;\n }\n a.add(bi);\n }\n BigInteger th = new BigInteger(\"1000000000000000000\");\n BigInteger ans = BigInteger.ONE;\n for (BigInteger bi : a) {\n ans = ans.multiply(bi);\n if (ans.compareTo(th) > 0) {\n out.println(-1);\n return;\n }\n }\n out.println(ans);\n }",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"List<BigInteger> a = new ArrayList<>();",
"a",
"new ArrayList<>()",
"for (int i = 0; i < n; i++) {\n BigInteger bi = new BigInteger(in.next());\n if (bi.equals(BigInteger.ZERO)) {\n out.println(0);\n return;\n }\n a.add(bi);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n BigInteger bi = new BigInteger(in.next());\n if (bi.equals(BigInteger.ZERO)) {\n out.println(0);\n return;\n }\n a.add(bi);\n }",
"{\n BigInteger bi = new BigInteger(in.next());\n if (bi.equals(BigInteger.ZERO)) {\n out.println(0);\n return;\n }\n a.add(bi);\n }",
"BigInteger bi = new BigInteger(in.next());",
"bi",
"new BigInteger(in.next())",
"if (bi.equals(BigInteger.ZERO)) {\n out.println(0);\n return;\n }",
"bi.equals(BigInteger.ZERO)",
"bi.equals",
"bi",
"BigInteger.ZERO",
"BigInteger",
"BigInteger.ZERO",
"{\n out.println(0);\n return;\n }",
"out.println(0)",
"out.println",
"out",
"0",
"return;",
"a.add(bi)",
"a.add",
"a",
"bi",
"BigInteger th = new BigInteger(\"1000000000000000000\");",
"th",
"new BigInteger(\"1000000000000000000\")",
"BigInteger ans = BigInteger.ONE;",
"ans",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"for (BigInteger bi : a) {\n ans = ans.multiply(bi);\n if (ans.compareTo(th) > 0) {\n out.println(-1);\n return;\n }\n }",
"BigInteger bi",
"a",
"{\n ans = ans.multiply(bi);\n if (ans.compareTo(th) > 0) {\n out.println(-1);\n return;\n }\n }",
"{\n ans = ans.multiply(bi);\n if (ans.compareTo(th) > 0) {\n out.println(-1);\n return;\n }\n }",
"ans = ans.multiply(bi)",
"ans",
"ans.multiply(bi)",
"ans.multiply",
"ans",
"bi",
"if (ans.compareTo(th) > 0) {\n out.println(-1);\n return;\n }",
"ans.compareTo(th) > 0",
"ans.compareTo(th)",
"ans.compareTo",
"ans",
"th",
"0",
"{\n out.println(-1);\n return;\n }",
"out.println(-1)",
"out.println",
"out",
"-1",
"1",
"return;",
"out.println(ans)",
"out.println",
"out",
"ans",
"InputStreamScanner in",
"in",
"PrintWriter out",
"out",
"static class InputStreamScanner {\n\n private InputStream in;\n\n private byte[] buf = new byte[1024];\n private int len = 0;\n private int off = 0;\n\n InputStreamScanner(InputStream in)\t{\n this.in = in;\n }\n\n String next() {\n StringBuilder sb = new StringBuilder();\n for (int b = skip(); !isSpace(b);){\n sb.appendCodePoint(b);\n b = read();\n }\n return sb.toString();\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 char nextChar() {\n return (char)skip();\n }\n\n int skip() {\n for (int b; (b = read()) != -1;) {\n if (!isSpace(b)) {\n return b;\n }\n }\n return -1;\n }\n\n private boolean isSpace(int c) {\n return c < 33 || c > 126;\n }\n\n private int read() {\n if (len == -1) {\n throw new InputMismatchException(\"End of Input\");\n }\n if (off >= len){\n off = 0;\n try {\n len = in.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException(e.getMessage());\n }\n if (len <= 0) {\n return -1;\n }\n }\n return buf[off++];\n }\n }",
"InputStreamScanner",
"private InputStream in;",
"in",
"private byte[] buf = new byte[1024];",
"buf",
"new byte[1024]",
"1024",
"private int len = 0;",
"len",
"0",
"private int off = 0;",
"off",
"0",
"InputStreamScanner(InputStream in)\t{\n this.in = in;\n }",
"InputStreamScanner",
"{\n this.in = in;\n }",
"this.in = in",
"this.in",
"this",
"this.in",
"in",
"InputStream in",
"in",
"String next() {\n StringBuilder sb = new StringBuilder();\n for (int b = skip(); !isSpace(b);){\n sb.appendCodePoint(b);\n b = read();\n }\n return sb.toString();\n }",
"next",
"{\n StringBuilder sb = new StringBuilder();\n for (int b = skip(); !isSpace(b);){\n sb.appendCodePoint(b);\n b = read();\n }\n return sb.toString();\n }",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"for (int b = skip(); !isSpace(b);){\n sb.appendCodePoint(b);\n b = read();\n }",
"int b = skip();",
"int b = skip();",
"b",
"skip()",
"skip",
"!isSpace(b)",
"isSpace(b)",
"isSpace",
"b",
"{\n sb.appendCodePoint(b);\n b = read();\n }",
"{\n sb.appendCodePoint(b);\n b = read();\n }",
"sb.appendCodePoint(b)",
"sb.appendCodePoint",
"sb",
"b",
"b = read()",
"b",
"read()",
"read",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"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",
"char nextChar() {\n return (char)skip();\n }",
"nextChar",
"{\n return (char)skip();\n }",
"return (char)skip();",
"(char)skip()",
"skip",
"int skip() {\n for (int b; (b = read()) != -1;) {\n if (!isSpace(b)) {\n return b;\n }\n }\n return -1;\n }",
"skip",
"{\n for (int b; (b = read()) != -1;) {\n if (!isSpace(b)) {\n return b;\n }\n }\n return -1;\n }",
"for (int b; (b = read()) != -1;) {\n if (!isSpace(b)) {\n return b;\n }\n }",
"int b;",
"int b;",
"b",
"(b = read()) != -1",
"(b = read())",
"b",
"read()",
"read",
"-1",
"1",
"{\n if (!isSpace(b)) {\n return b;\n }\n }",
"{\n if (!isSpace(b)) {\n return b;\n }\n }",
"if (!isSpace(b)) {\n return b;\n }",
"!isSpace(b)",
"isSpace(b)",
"isSpace",
"b",
"{\n return b;\n }",
"return b;",
"b",
"return -1;",
"-1",
"1",
"private boolean isSpace(int c) {\n return c < 33 || c > 126;\n }",
"isSpace",
"{\n return c < 33 || c > 126;\n }",
"return c < 33 || c > 126;",
"c < 33 || c > 126",
"c < 33",
"c",
"33",
"c > 126",
"c",
"126",
"int c",
"c",
"private int read() {\n if (len == -1) {\n throw new InputMismatchException(\"End of Input\");\n }\n if (off >= len){\n off = 0;\n try {\n len = in.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException(e.getMessage());\n }\n if (len <= 0) {\n return -1;\n }\n }\n return buf[off++];\n }",
"read",
"{\n if (len == -1) {\n throw new InputMismatchException(\"End of Input\");\n }\n if (off >= len){\n off = 0;\n try {\n len = in.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException(e.getMessage());\n }\n if (len <= 0) {\n return -1;\n }\n }\n return buf[off++];\n }",
"if (len == -1) {\n throw new InputMismatchException(\"End of Input\");\n }",
"len == -1",
"len",
"-1",
"1",
"{\n throw new InputMismatchException(\"End of Input\");\n }",
"throw new InputMismatchException(\"End of Input\");",
"new InputMismatchException(\"End of Input\")",
"if (off >= len){\n off = 0;\n try {\n len = in.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException(e.getMessage());\n }\n if (len <= 0) {\n return -1;\n }\n }",
"off >= len",
"off",
"len",
"{\n off = 0;\n try {\n len = in.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException(e.getMessage());\n }\n if (len <= 0) {\n return -1;\n }\n }",
"off = 0",
"off",
"0",
"try {\n len = in.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException(e.getMessage());\n }",
"catch (IOException e) {\n throw new InputMismatchException(e.getMessage());\n }",
"IOException e",
"{\n throw new InputMismatchException(e.getMessage());\n }",
"throw new InputMismatchException(e.getMessage());",
"new InputMismatchException(e.getMessage())",
"{\n len = in.read(buf);\n }",
"len = in.read(buf)",
"len",
"in.read(buf)",
"in.read",
"in",
"buf",
"if (len <= 0) {\n return -1;\n }",
"len <= 0",
"len",
"0",
"{\n return -1;\n }",
"return -1;",
"-1",
"1",
"return buf[off++];",
"buf[off++]",
"buf",
"off++",
"off",
"public class Main {\n public static void main(String[] args) {\n PrintWriter out = new PrintWriter(System.out);\n InputStreamScanner in = new InputStreamScanner(System.in);\n new Main().solve(in, out);\n out.flush();\n }\n\n private void solve(InputStreamScanner in, PrintWriter out) {\n int n = in.nextInt();\n List<BigInteger> a = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n BigInteger bi = new BigInteger(in.next());\n if (bi.equals(BigInteger.ZERO)) {\n out.println(0);\n return;\n }\n a.add(bi);\n }\n BigInteger th = new BigInteger(\"1000000000000000000\");\n BigInteger ans = BigInteger.ONE;\n for (BigInteger bi : a) {\n ans = ans.multiply(bi);\n if (ans.compareTo(th) > 0) {\n out.println(-1);\n return;\n }\n }\n out.println(ans);\n }\n\n static class InputStreamScanner {\n\n private InputStream in;\n\n private byte[] buf = new byte[1024];\n private int len = 0;\n private int off = 0;\n\n InputStreamScanner(InputStream in)\t{\n this.in = in;\n }\n\n String next() {\n StringBuilder sb = new StringBuilder();\n for (int b = skip(); !isSpace(b);){\n sb.appendCodePoint(b);\n b = read();\n }\n return sb.toString();\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 char nextChar() {\n return (char)skip();\n }\n\n int skip() {\n for (int b; (b = read()) != -1;) {\n if (!isSpace(b)) {\n return b;\n }\n }\n return -1;\n }\n\n private boolean isSpace(int c) {\n return c < 33 || c > 126;\n }\n\n private int read() {\n if (len == -1) {\n throw new InputMismatchException(\"End of Input\");\n }\n if (off >= len){\n off = 0;\n try {\n len = in.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException(e.getMessage());\n }\n if (len <= 0) {\n return -1;\n }\n }\n return buf[off++];\n }\n }\n}",
"public class Main {\n public static void main(String[] args) {\n PrintWriter out = new PrintWriter(System.out);\n InputStreamScanner in = new InputStreamScanner(System.in);\n new Main().solve(in, out);\n out.flush();\n }\n\n private void solve(InputStreamScanner in, PrintWriter out) {\n int n = in.nextInt();\n List<BigInteger> a = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n BigInteger bi = new BigInteger(in.next());\n if (bi.equals(BigInteger.ZERO)) {\n out.println(0);\n return;\n }\n a.add(bi);\n }\n BigInteger th = new BigInteger(\"1000000000000000000\");\n BigInteger ans = BigInteger.ONE;\n for (BigInteger bi : a) {\n ans = ans.multiply(bi);\n if (ans.compareTo(th) > 0) {\n out.println(-1);\n return;\n }\n }\n out.println(ans);\n }\n\n static class InputStreamScanner {\n\n private InputStream in;\n\n private byte[] buf = new byte[1024];\n private int len = 0;\n private int off = 0;\n\n InputStreamScanner(InputStream in)\t{\n this.in = in;\n }\n\n String next() {\n StringBuilder sb = new StringBuilder();\n for (int b = skip(); !isSpace(b);){\n sb.appendCodePoint(b);\n b = read();\n }\n return sb.toString();\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 char nextChar() {\n return (char)skip();\n }\n\n int skip() {\n for (int b; (b = read()) != -1;) {\n if (!isSpace(b)) {\n return b;\n }\n }\n return -1;\n }\n\n private boolean isSpace(int c) {\n return c < 33 || c > 126;\n }\n\n private int read() {\n if (len == -1) {\n throw new InputMismatchException(\"End of Input\");\n }\n if (off >= len){\n off = 0;\n try {\n len = in.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException(e.getMessage());\n }\n if (len <= 0) {\n return -1;\n }\n }\n return buf[off++];\n }\n }\n}",
"Main"
] |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.List;
public class Main {
public static void main(String[] args) {
PrintWriter out = new PrintWriter(System.out);
InputStreamScanner in = new InputStreamScanner(System.in);
new Main().solve(in, out);
out.flush();
}
private void solve(InputStreamScanner in, PrintWriter out) {
int n = in.nextInt();
List<BigInteger> a = new ArrayList<>();
for (int i = 0; i < n; i++) {
BigInteger bi = new BigInteger(in.next());
if (bi.equals(BigInteger.ZERO)) {
out.println(0);
return;
}
a.add(bi);
}
BigInteger th = new BigInteger("1000000000000000000");
BigInteger ans = BigInteger.ONE;
for (BigInteger bi : a) {
ans = ans.multiply(bi);
if (ans.compareTo(th) > 0) {
out.println(-1);
return;
}
}
out.println(ans);
}
static class InputStreamScanner {
private InputStream in;
private byte[] buf = new byte[1024];
private int len = 0;
private int off = 0;
InputStreamScanner(InputStream in) {
this.in = in;
}
String next() {
StringBuilder sb = new StringBuilder();
for (int b = skip(); !isSpace(b);){
sb.appendCodePoint(b);
b = read();
}
return sb.toString();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
char nextChar() {
return (char)skip();
}
int skip() {
for (int b; (b = read()) != -1;) {
if (!isSpace(b)) {
return b;
}
}
return -1;
}
private boolean isSpace(int c) {
return c < 33 || c > 126;
}
private int read() {
if (len == -1) {
throw new InputMismatchException("End of Input");
}
if (off >= len){
off = 0;
try {
len = in.read(buf);
} catch (IOException e) {
throw new InputMismatchException(e.getMessage());
}
if (len <= 0) {
return -1;
}
}
return buf[off++];
}
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
17,
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,
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,
3,
38,
5,
13,
30,
0,
13,
17,
30,
4,
18,
13,
13,
18,
13,
13,
14,
40,
13,
30,
0,
13,
18,
13,
13,
14,
2,
13,
13,
30,
0,
13,
17,
14,
13,
30,
4,
18,
18,
13,
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
],
[
138,
5
],
[
138,
6
],
[
6,
7
],
[
6,
8
],
[
138,
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
],
[
44,
46
],
[
11,
47
],
[
47,
48
],
[
47,
49
],
[
11,
50
],
[
50,
51
],
[
50,
52
],
[
11,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
53,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
66,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
65,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
77,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
85,
89
],
[
89,
90
],
[
89,
91
],
[
65,
92
],
[
92,
93
],
[
93,
94
],
[
92,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
65,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
11,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
112,
117
],
[
109,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
121,
126
],
[
126,
127
],
[
118,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
129,
134
],
[
9,
135
],
[
135,
136
],
[
0,
137
],
[
137,
138
],
[
137,
139
]
] |
[
"import java.util.Scanner;\n\npublic class Main {\n static final long MX = 1000000000000000000L;\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = in.nextLong();\n }\n\n long sum = 1;\n boolean zero = false;\n boolean over = false;\n for (int i = 0; i < n; i++) {\n if (a[i] == 0) {\n zero = true;\n break;\n }\n\n try {\n Math.multiplyExact(sum, a[i]);\n } catch (ArithmeticException e) {\n over = true;\n }\n\n if (!over) {\n sum *= a[i];\n }\n\n if (sum > MX) {\n over = true;\n }\n }\n\n if (zero) {\n System.out.println(0);\n } else if (over) {\n System.out.println(-1);\n } else {\n System.out.println(sum);\n }\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n static final long MX = 1000000000000000000L;\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = in.nextLong();\n }\n\n long sum = 1;\n boolean zero = false;\n boolean over = false;\n for (int i = 0; i < n; i++) {\n if (a[i] == 0) {\n zero = true;\n break;\n }\n\n try {\n Math.multiplyExact(sum, a[i]);\n } catch (ArithmeticException e) {\n over = true;\n }\n\n if (!over) {\n sum *= a[i];\n }\n\n if (sum > MX) {\n over = true;\n }\n }\n\n if (zero) {\n System.out.println(0);\n } else if (over) {\n System.out.println(-1);\n } else {\n System.out.println(sum);\n }\n }\n}",
"Main",
"static final long MX = 1000000000000000000L;",
"MX",
"1000000000000000000L",
"public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = in.nextLong();\n }\n\n long sum = 1;\n boolean zero = false;\n boolean over = false;\n for (int i = 0; i < n; i++) {\n if (a[i] == 0) {\n zero = true;\n break;\n }\n\n try {\n Math.multiplyExact(sum, a[i]);\n } catch (ArithmeticException e) {\n over = true;\n }\n\n if (!over) {\n sum *= a[i];\n }\n\n if (sum > MX) {\n over = true;\n }\n }\n\n if (zero) {\n System.out.println(0);\n } else if (over) {\n System.out.println(-1);\n } else {\n System.out.println(sum);\n }\n }",
"main",
"{\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = in.nextLong();\n }\n\n long sum = 1;\n boolean zero = false;\n boolean over = false;\n for (int i = 0; i < n; i++) {\n if (a[i] == 0) {\n zero = true;\n break;\n }\n\n try {\n Math.multiplyExact(sum, a[i]);\n } catch (ArithmeticException e) {\n over = true;\n }\n\n if (!over) {\n sum *= a[i];\n }\n\n if (sum > MX) {\n over = true;\n }\n }\n\n if (zero) {\n System.out.println(0);\n } else if (over) {\n System.out.println(-1);\n } else {\n System.out.println(sum);\n }\n }",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"long a[] = new long[n];",
"a",
"new long[n]",
"n",
"for (int i = 0; i < n; i++) {\n a[i] = in.nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = in.nextLong();\n }",
"{\n a[i] = in.nextLong();\n }",
"a[i] = in.nextLong()",
"a[i]",
"a",
"i",
"in.nextLong()",
"in.nextLong",
"in",
"long sum = 1;",
"sum",
"1",
"boolean zero = false;",
"zero",
"false",
"boolean over = false;",
"over",
"false",
"for (int i = 0; i < n; i++) {\n if (a[i] == 0) {\n zero = true;\n break;\n }\n\n try {\n Math.multiplyExact(sum, a[i]);\n } catch (ArithmeticException e) {\n over = true;\n }\n\n if (!over) {\n sum *= a[i];\n }\n\n if (sum > MX) {\n over = true;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if (a[i] == 0) {\n zero = true;\n break;\n }\n\n try {\n Math.multiplyExact(sum, a[i]);\n } catch (ArithmeticException e) {\n over = true;\n }\n\n if (!over) {\n sum *= a[i];\n }\n\n if (sum > MX) {\n over = true;\n }\n }",
"{\n if (a[i] == 0) {\n zero = true;\n break;\n }\n\n try {\n Math.multiplyExact(sum, a[i]);\n } catch (ArithmeticException e) {\n over = true;\n }\n\n if (!over) {\n sum *= a[i];\n }\n\n if (sum > MX) {\n over = true;\n }\n }",
"if (a[i] == 0) {\n zero = true;\n break;\n }",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"{\n zero = true;\n break;\n }",
"zero = true",
"zero",
"true",
"break;",
"try {\n Math.multiplyExact(sum, a[i]);\n } catch (ArithmeticException e) {\n over = true;\n }",
"catch (ArithmeticException e) {\n over = true;\n }",
"ArithmeticException e",
"{\n over = true;\n }",
"over = true",
"over",
"true",
"{\n Math.multiplyExact(sum, a[i]);\n }",
"Math.multiplyExact(sum, a[i])",
"Math.multiplyExact",
"Math",
"sum",
"a[i]",
"a",
"i",
"if (!over) {\n sum *= a[i];\n }",
"!over",
"over",
"{\n sum *= a[i];\n }",
"sum *= a[i]",
"sum",
"a[i]",
"a",
"i",
"if (sum > MX) {\n over = true;\n }",
"sum > MX",
"sum",
"MX",
"{\n over = true;\n }",
"over = true",
"over",
"true",
"if (zero) {\n System.out.println(0);\n } else if (over) {\n System.out.println(-1);\n } else {\n System.out.println(sum);\n }",
"zero",
"{\n System.out.println(0);\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"if (over) {\n System.out.println(-1);\n } else {\n System.out.println(sum);\n }",
"over",
"{\n System.out.println(-1);\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"{\n System.out.println(sum);\n }",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"public class Main {\n static final long MX = 1000000000000000000L;\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = in.nextLong();\n }\n\n long sum = 1;\n boolean zero = false;\n boolean over = false;\n for (int i = 0; i < n; i++) {\n if (a[i] == 0) {\n zero = true;\n break;\n }\n\n try {\n Math.multiplyExact(sum, a[i]);\n } catch (ArithmeticException e) {\n over = true;\n }\n\n if (!over) {\n sum *= a[i];\n }\n\n if (sum > MX) {\n over = true;\n }\n }\n\n if (zero) {\n System.out.println(0);\n } else if (over) {\n System.out.println(-1);\n } else {\n System.out.println(sum);\n }\n }\n}",
"public class Main {\n static final long MX = 1000000000000000000L;\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = in.nextLong();\n }\n\n long sum = 1;\n boolean zero = false;\n boolean over = false;\n for (int i = 0; i < n; i++) {\n if (a[i] == 0) {\n zero = true;\n break;\n }\n\n try {\n Math.multiplyExact(sum, a[i]);\n } catch (ArithmeticException e) {\n over = true;\n }\n\n if (!over) {\n sum *= a[i];\n }\n\n if (sum > MX) {\n over = true;\n }\n }\n\n if (zero) {\n System.out.println(0);\n } else if (over) {\n System.out.println(-1);\n } else {\n System.out.println(sum);\n }\n }\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
static final long MX = 1000000000000000000L;
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
long a[] = new long[n];
for (int i = 0; i < n; i++) {
a[i] = in.nextLong();
}
long sum = 1;
boolean zero = false;
boolean over = false;
for (int i = 0; i < n; i++) {
if (a[i] == 0) {
zero = true;
break;
}
try {
Math.multiplyExact(sum, a[i]);
} catch (ArithmeticException e) {
over = true;
}
if (!over) {
sum *= a[i];
}
if (sum > MX) {
over = true;
}
}
if (zero) {
System.out.println(0);
} else if (over) {
System.out.println(-1);
} else {
System.out.println(sum);
}
}
}
|
[
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,
4,
18,
13,
17,
41,
13,
17,
41,
13,
4,
18,
13,
4,
18,
13,
17,
41,
13,
17,
41,
13,
0,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
14,
2,
13,
17,
30,
0,
13,
17,
3,
4,
18,
13,
13,
14,
40,
13,
30,
0,
13,
4,
18,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
4,
18,
13,
4,
18,
13,
13,
38,
5,
13,
30,
0,
13,
4,
18,
13,
40,
17,
3,
30,
14,
2,
4,
18,
4,
18,
13,
13,
17,
30,
0,
13,
4,
18,
13,
40,
17,
3,
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
],
[
0,
10
],
[
10,
11
],
[
10,
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
],
[
25,
26
],
[
26,
27
],
[
25,
28
],
[
14,
29
],
[
29,
30
],
[
29,
31
],
[
14,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
34,
37
],
[
37,
38
],
[
38,
39
],
[
37,
40
],
[
14,
41
],
[
41,
42
],
[
41,
43
],
[
14,
44
],
[
44,
45
],
[
14,
46
],
[
46,
47
],
[
46,
48
],
[
14,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
54,
55
],
[
54,
56
],
[
49,
57
],
[
57,
58
],
[
58,
59
],
[
49,
60
],
[
61,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
61,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
61,
76
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
14,
80
],
[
80,
81
],
[
81,
82
],
[
80,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
83,
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
],
[
106,
108
],
[
108,
109
],
[
109,
110
],
[
108,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
114,
115
],
[
115,
116
],
[
114,
117
],
[
105,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
125,
126
],
[
124,
127
],
[
127,
128
],
[
121,
129
],
[
118,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
135,
138
],
[
132,
139
],
[
131,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
144,
145
],
[
143,
146
],
[
146,
147
],
[
140,
148
],
[
14,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
12,
155
],
[
155,
156
]
] |
[
"import java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.Scanner;\n// A - Multiplication 1\nclass Main{\n\tpublic static void main(String[] args){\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong N= sc.nextInt(); //\n\n\t\t//long ans = sc.nextLong();\n\t\tBigInteger ans = BigInteger.valueOf(0);\n\t\tlong x = 0;\n\t\tBigInteger v = BigInteger.valueOf(Long.valueOf(\"1000000000000000000\"));\n\n\t\tboolean exFlg = false;\n\n\t\tArrayList<Long> lstA;\n\t\tlstA = new ArrayList<Long>();\n\n\t\tfor (int i=0; i < N; i++) {\n\t\t\tx = sc.nextLong();\n\t\t\t// 0掛けしていれば終わり\n\t\t\tif (x == 0) {\n\t\t\t\texFlg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlstA.add(x);\n\t\t}\n\n\t\tif (!exFlg) {\n\t\t\tans = BigInteger.valueOf(lstA.get(0));\n\t\t\tfor (int i=1; i < N; i++) {\n\n\t\t\t\tans= ans.multiply(BigInteger.valueOf(lstA.get(i)));\n\n\t\t\t\ttry {\n\t\t\t\t\tif (ans.subtract(v).longValueExact() > 0) {\n\t\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main{\n\tpublic static void main(String[] args){\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong N= sc.nextInt(); //\n\n\t\t//long ans = sc.nextLong();\n\t\tBigInteger ans = BigInteger.valueOf(0);\n\t\tlong x = 0;\n\t\tBigInteger v = BigInteger.valueOf(Long.valueOf(\"1000000000000000000\"));\n\n\t\tboolean exFlg = false;\n\n\t\tArrayList<Long> lstA;\n\t\tlstA = new ArrayList<Long>();\n\n\t\tfor (int i=0; i < N; i++) {\n\t\t\tx = sc.nextLong();\n\t\t\t// 0掛けしていれば終わり\n\t\t\tif (x == 0) {\n\t\t\t\texFlg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlstA.add(x);\n\t\t}\n\n\t\tif (!exFlg) {\n\t\t\tans = BigInteger.valueOf(lstA.get(0));\n\t\t\tfor (int i=1; i < N; i++) {\n\n\t\t\t\tans= ans.multiply(BigInteger.valueOf(lstA.get(i)));\n\n\t\t\t\ttry {\n\t\t\t\t\tif (ans.subtract(v).longValueExact() > 0) {\n\t\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main",
"public static void main(String[] args){\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong N= sc.nextInt(); //\n\n\t\t//long ans = sc.nextLong();\n\t\tBigInteger ans = BigInteger.valueOf(0);\n\t\tlong x = 0;\n\t\tBigInteger v = BigInteger.valueOf(Long.valueOf(\"1000000000000000000\"));\n\n\t\tboolean exFlg = false;\n\n\t\tArrayList<Long> lstA;\n\t\tlstA = new ArrayList<Long>();\n\n\t\tfor (int i=0; i < N; i++) {\n\t\t\tx = sc.nextLong();\n\t\t\t// 0掛けしていれば終わり\n\t\t\tif (x == 0) {\n\t\t\t\texFlg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlstA.add(x);\n\t\t}\n\n\t\tif (!exFlg) {\n\t\t\tans = BigInteger.valueOf(lstA.get(0));\n\t\t\tfor (int i=1; i < N; i++) {\n\n\t\t\t\tans= ans.multiply(BigInteger.valueOf(lstA.get(i)));\n\n\t\t\t\ttry {\n\t\t\t\t\tif (ans.subtract(v).longValueExact() > 0) {\n\t\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong N= sc.nextInt(); //\n\n\t\t//long ans = sc.nextLong();\n\t\tBigInteger ans = BigInteger.valueOf(0);\n\t\tlong x = 0;\n\t\tBigInteger v = BigInteger.valueOf(Long.valueOf(\"1000000000000000000\"));\n\n\t\tboolean exFlg = false;\n\n\t\tArrayList<Long> lstA;\n\t\tlstA = new ArrayList<Long>();\n\n\t\tfor (int i=0; i < N; i++) {\n\t\t\tx = sc.nextLong();\n\t\t\t// 0掛けしていれば終わり\n\t\t\tif (x == 0) {\n\t\t\t\texFlg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlstA.add(x);\n\t\t}\n\n\t\tif (!exFlg) {\n\t\t\tans = BigInteger.valueOf(lstA.get(0));\n\t\t\tfor (int i=1; i < N; i++) {\n\n\t\t\t\tans= ans.multiply(BigInteger.valueOf(lstA.get(i)));\n\n\t\t\t\ttry {\n\t\t\t\t\tif (ans.subtract(v).longValueExact() > 0) {\n\t\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"long N= sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BigInteger ans = BigInteger.valueOf(0);",
"ans",
"BigInteger.valueOf(0)",
"BigInteger.valueOf",
"BigInteger",
"0",
"long x = 0;",
"x",
"0",
"BigInteger v = BigInteger.valueOf(Long.valueOf(\"1000000000000000000\"));",
"v",
"BigInteger.valueOf(Long.valueOf(\"1000000000000000000\"))",
"BigInteger.valueOf",
"BigInteger",
"Long.valueOf(\"1000000000000000000\")",
"Long.valueOf",
"Long",
"\"1000000000000000000\"",
"boolean exFlg = false;",
"exFlg",
"false",
"ArrayList<Long> lstA;",
"lstA",
"lstA = new ArrayList<Long>()",
"lstA",
"new ArrayList<Long>()",
"for (int i=0; i < N; i++) {\n\t\t\tx = sc.nextLong();\n\t\t\t// 0掛けしていれば終わり\n\t\t\tif (x == 0) {\n\t\t\t\texFlg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlstA.add(x);\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tx = sc.nextLong();\n\t\t\t// 0掛けしていれば終わり\n\t\t\tif (x == 0) {\n\t\t\t\texFlg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlstA.add(x);\n\t\t}",
"{\n\t\t\tx = sc.nextLong();\n\t\t\t// 0掛けしていれば終わり\n\t\t\tif (x == 0) {\n\t\t\t\texFlg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlstA.add(x);\n\t\t}",
"x = sc.nextLong()",
"x",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (x == 0) {\n\t\t\t\texFlg = true;\n\t\t\t\tbreak;\n\t\t\t}",
"x == 0",
"x",
"0",
"{\n\t\t\t\texFlg = true;\n\t\t\t\tbreak;\n\t\t\t}",
"exFlg = true",
"exFlg",
"true",
"break;",
"lstA.add(x)",
"lstA.add",
"lstA",
"x",
"if (!exFlg) {\n\t\t\tans = BigInteger.valueOf(lstA.get(0));\n\t\t\tfor (int i=1; i < N; i++) {\n\n\t\t\t\tans= ans.multiply(BigInteger.valueOf(lstA.get(i)));\n\n\t\t\t\ttry {\n\t\t\t\t\tif (ans.subtract(v).longValueExact() > 0) {\n\t\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}",
"!exFlg",
"exFlg",
"{\n\t\t\tans = BigInteger.valueOf(lstA.get(0));\n\t\t\tfor (int i=1; i < N; i++) {\n\n\t\t\t\tans= ans.multiply(BigInteger.valueOf(lstA.get(i)));\n\n\t\t\t\ttry {\n\t\t\t\t\tif (ans.subtract(v).longValueExact() > 0) {\n\t\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}",
"ans = BigInteger.valueOf(lstA.get(0))",
"ans",
"BigInteger.valueOf(lstA.get(0))",
"BigInteger.valueOf",
"BigInteger",
"lstA.get(0)",
"lstA.get",
"lstA",
"0",
"for (int i=1; i < N; i++) {\n\n\t\t\t\tans= ans.multiply(BigInteger.valueOf(lstA.get(i)));\n\n\t\t\t\ttry {\n\t\t\t\t\tif (ans.subtract(v).longValueExact() > 0) {\n\t\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t}",
"int i=1;",
"int i=1;",
"i",
"1",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\n\t\t\t\tans= ans.multiply(BigInteger.valueOf(lstA.get(i)));\n\n\t\t\t\ttry {\n\t\t\t\t\tif (ans.subtract(v).longValueExact() > 0) {\n\t\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t}",
"{\n\n\t\t\t\tans= ans.multiply(BigInteger.valueOf(lstA.get(i)));\n\n\t\t\t\ttry {\n\t\t\t\t\tif (ans.subtract(v).longValueExact() > 0) {\n\t\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t}",
"ans= ans.multiply(BigInteger.valueOf(lstA.get(i)))",
"ans",
"ans.multiply(BigInteger.valueOf(lstA.get(i)))",
"ans.multiply",
"ans",
"BigInteger.valueOf(lstA.get(i))",
"BigInteger.valueOf",
"BigInteger",
"lstA.get(i)",
"lstA.get",
"lstA",
"i",
"try {\n\t\t\t\t\tif (ans.subtract(v).longValueExact() > 0) {\n\t\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"catch (Exception e) {\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"Exception e",
"{\n\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"ans = BigInteger.valueOf(-1)",
"ans",
"BigInteger.valueOf(-1)",
"BigInteger.valueOf",
"BigInteger",
"-1",
"1",
"break;",
"{\n\t\t\t\t\tif (ans.subtract(v).longValueExact() > 0) {\n\t\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t}",
"if (ans.subtract(v).longValueExact() > 0) {\n\t\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"ans.subtract(v).longValueExact() > 0",
"ans.subtract(v).longValueExact()",
"ans.subtract(v).longValueExact",
"ans.subtract(v)",
"ans.subtract",
"ans",
"v",
"0",
"{\n\t\t\t\t\t\tans = BigInteger.valueOf(-1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"ans = BigInteger.valueOf(-1)",
"ans",
"BigInteger.valueOf(-1)",
"BigInteger.valueOf",
"BigInteger",
"-1",
"1",
"break;",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args"
] |
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Scanner;
// A - Multiplication 1
class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
long N= sc.nextInt(); //
//long ans = sc.nextLong();
BigInteger ans = BigInteger.valueOf(0);
long x = 0;
BigInteger v = BigInteger.valueOf(Long.valueOf("1000000000000000000"));
boolean exFlg = false;
ArrayList<Long> lstA;
lstA = new ArrayList<Long>();
for (int i=0; i < N; i++) {
x = sc.nextLong();
// 0掛けしていれば終わり
if (x == 0) {
exFlg = true;
break;
}
lstA.add(x);
}
if (!exFlg) {
ans = BigInteger.valueOf(lstA.get(0));
for (int i=1; i < N; i++) {
ans= ans.multiply(BigInteger.valueOf(lstA.get(i)));
try {
if (ans.subtract(v).longValueExact() > 0) {
ans = BigInteger.valueOf(-1);
break;
}
} catch (Exception e) {
ans = BigInteger.valueOf(-1);
break;
}
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
41,
13,
20,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
20,
14,
4,
18,
4,
18,
13,
13,
20,
30,
4,
18,
13,
17,
4,
18,
13,
0,
13,
17,
14,
2,
13,
17,
30,
41,
13,
20,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
20,
17,
30,
4,
18,
13,
40,
17,
0,
13,
17,
3,
14,
2,
13,
17,
30,
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
],
[
142,
11
],
[
142,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
14,
21
],
[
21,
22
],
[
21,
23
],
[
14,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
26,
29
],
[
29,
30
],
[
30,
31
],
[
14,
32
],
[
32,
33
],
[
32,
34
],
[
14,
35
],
[
35,
36
],
[
35,
37
],
[
14,
38
],
[
38,
39
],
[
38,
40
],
[
14,
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
],
[
55,
56
],
[
54,
57
],
[
53,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
59,
65
],
[
58,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
66,
71
],
[
71,
72
],
[
72,
73
],
[
66,
74
],
[
74,
75
],
[
74,
76
],
[
14,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
85,
87
],
[
81,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
88,
93
],
[
93,
94
],
[
93,
95
],
[
88,
96
],
[
96,
97
],
[
97,
98
],
[
88,
99
],
[
100,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
106,
107
],
[
107,
108
],
[
106,
109
],
[
100,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
112,
115
],
[
111,
116
],
[
110,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
118,
121
],
[
121,
122
],
[
117,
123
],
[
123,
124
],
[
123,
125
],
[
117,
126
],
[
81,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
132,
135
],
[
14,
136
],
[
136,
137
],
[
137,
138
],
[
12,
139
],
[
139,
140
],
[
0,
141
],
[
141,
142
],
[
141,
143
]
] |
[
"import java.util.*;\nimport java.math.*;\nimport java.io.*;\npublic class Main {\n \n\tpublic static void main(String[] args) throws Exception{\n\t\tint num = 998244353;\n \n\t\t// TODO Auto-generated method stub\n \t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n \t\tPrintWriter out = new PrintWriter(System.out);\n//\t \t\n \t\tint n = Integer.parseInt(bf.readLine());\n \t\tStringTokenizer st = new StringTokenizer(bf.readLine());\n \t\tArrayList<BigInteger> array = new ArrayList<BigInteger>();\n \t\tboolean found = false;\n \t\tfor(int i = 0;i<n;i++){\n \t\t\tarray.add(new BigInteger(st.nextToken()));\n \t\t\tif (array.get(i).equals(new BigInteger(\"0\"))){\n \t\t\t\tout.println(0);\n \t\t\t\tout.close();\n \t\t\t\tfound = true;\n \t\t\t}\n \t\t}\n \t\tif (found == false){\n\t \t\tBigInteger prod = new BigInteger(\"1\");\n\t \t\t\n\t \t\tboolean found1 = true;\n\t \t\tfor(int i = 0;i<n;i++){\n\t \t\t\tprod = prod.multiply(array.get(i));\n\t \t\t\tif (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0){\n\t \t\t\t\tout.println(-1);\n\t \t\t\t\tfound1 = false;\n\t \t\t\t\tbreak;\n\t \t\t\t}\n\t \t\t}\n\t \t\tif (found1 == true){\n\t \t\t\tout.println(prod);\n\t \t\t}\n \t\t}\n \t\tout.close();\n \t\t\n \t\t\n \t\t\n \t}\n}",
"import java.util.*;",
"util.*",
"java",
"import java.math.*;",
"math.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main {\n \n\tpublic static void main(String[] args) throws Exception{\n\t\tint num = 998244353;\n \n\t\t// TODO Auto-generated method stub\n \t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n \t\tPrintWriter out = new PrintWriter(System.out);\n//\t \t\n \t\tint n = Integer.parseInt(bf.readLine());\n \t\tStringTokenizer st = new StringTokenizer(bf.readLine());\n \t\tArrayList<BigInteger> array = new ArrayList<BigInteger>();\n \t\tboolean found = false;\n \t\tfor(int i = 0;i<n;i++){\n \t\t\tarray.add(new BigInteger(st.nextToken()));\n \t\t\tif (array.get(i).equals(new BigInteger(\"0\"))){\n \t\t\t\tout.println(0);\n \t\t\t\tout.close();\n \t\t\t\tfound = true;\n \t\t\t}\n \t\t}\n \t\tif (found == false){\n\t \t\tBigInteger prod = new BigInteger(\"1\");\n\t \t\t\n\t \t\tboolean found1 = true;\n\t \t\tfor(int i = 0;i<n;i++){\n\t \t\t\tprod = prod.multiply(array.get(i));\n\t \t\t\tif (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0){\n\t \t\t\t\tout.println(-1);\n\t \t\t\t\tfound1 = false;\n\t \t\t\t\tbreak;\n\t \t\t\t}\n\t \t\t}\n\t \t\tif (found1 == true){\n\t \t\t\tout.println(prod);\n\t \t\t}\n \t\t}\n \t\tout.close();\n \t\t\n \t\t\n \t\t\n \t}\n}",
"Main",
"public static void main(String[] args) throws Exception{\n\t\tint num = 998244353;\n \n\t\t// TODO Auto-generated method stub\n \t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n \t\tPrintWriter out = new PrintWriter(System.out);\n//\t \t\n \t\tint n = Integer.parseInt(bf.readLine());\n \t\tStringTokenizer st = new StringTokenizer(bf.readLine());\n \t\tArrayList<BigInteger> array = new ArrayList<BigInteger>();\n \t\tboolean found = false;\n \t\tfor(int i = 0;i<n;i++){\n \t\t\tarray.add(new BigInteger(st.nextToken()));\n \t\t\tif (array.get(i).equals(new BigInteger(\"0\"))){\n \t\t\t\tout.println(0);\n \t\t\t\tout.close();\n \t\t\t\tfound = true;\n \t\t\t}\n \t\t}\n \t\tif (found == false){\n\t \t\tBigInteger prod = new BigInteger(\"1\");\n\t \t\t\n\t \t\tboolean found1 = true;\n\t \t\tfor(int i = 0;i<n;i++){\n\t \t\t\tprod = prod.multiply(array.get(i));\n\t \t\t\tif (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0){\n\t \t\t\t\tout.println(-1);\n\t \t\t\t\tfound1 = false;\n\t \t\t\t\tbreak;\n\t \t\t\t}\n\t \t\t}\n\t \t\tif (found1 == true){\n\t \t\t\tout.println(prod);\n\t \t\t}\n \t\t}\n \t\tout.close();\n \t\t\n \t\t\n \t\t\n \t}",
"main",
"{\n\t\tint num = 998244353;\n \n\t\t// TODO Auto-generated method stub\n \t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n \t\tPrintWriter out = new PrintWriter(System.out);\n//\t \t\n \t\tint n = Integer.parseInt(bf.readLine());\n \t\tStringTokenizer st = new StringTokenizer(bf.readLine());\n \t\tArrayList<BigInteger> array = new ArrayList<BigInteger>();\n \t\tboolean found = false;\n \t\tfor(int i = 0;i<n;i++){\n \t\t\tarray.add(new BigInteger(st.nextToken()));\n \t\t\tif (array.get(i).equals(new BigInteger(\"0\"))){\n \t\t\t\tout.println(0);\n \t\t\t\tout.close();\n \t\t\t\tfound = true;\n \t\t\t}\n \t\t}\n \t\tif (found == false){\n\t \t\tBigInteger prod = new BigInteger(\"1\");\n\t \t\t\n\t \t\tboolean found1 = true;\n\t \t\tfor(int i = 0;i<n;i++){\n\t \t\t\tprod = prod.multiply(array.get(i));\n\t \t\t\tif (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0){\n\t \t\t\t\tout.println(-1);\n\t \t\t\t\tfound1 = false;\n\t \t\t\t\tbreak;\n\t \t\t\t}\n\t \t\t}\n\t \t\tif (found1 == true){\n\t \t\t\tout.println(prod);\n\t \t\t}\n \t\t}\n \t\tout.close();\n \t\t\n \t\t\n \t\t\n \t}",
"int num = 998244353;",
"num",
"998244353",
"BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));",
"bf",
"new BufferedReader(new InputStreamReader(System.in))",
"PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"int n = Integer.parseInt(bf.readLine());",
"n",
"Integer.parseInt(bf.readLine())",
"Integer.parseInt",
"Integer",
"bf.readLine()",
"bf.readLine",
"bf",
"StringTokenizer st = new StringTokenizer(bf.readLine());",
"st",
"new StringTokenizer(bf.readLine())",
"ArrayList<BigInteger> array = new ArrayList<BigInteger>();",
"array",
"new ArrayList<BigInteger>()",
"boolean found = false;",
"found",
"false",
"for(int i = 0;i<n;i++){\n \t\t\tarray.add(new BigInteger(st.nextToken()));\n \t\t\tif (array.get(i).equals(new BigInteger(\"0\"))){\n \t\t\t\tout.println(0);\n \t\t\t\tout.close();\n \t\t\t\tfound = 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\tarray.add(new BigInteger(st.nextToken()));\n \t\t\tif (array.get(i).equals(new BigInteger(\"0\"))){\n \t\t\t\tout.println(0);\n \t\t\t\tout.close();\n \t\t\t\tfound = true;\n \t\t\t}\n \t\t}",
"{\n \t\t\tarray.add(new BigInteger(st.nextToken()));\n \t\t\tif (array.get(i).equals(new BigInteger(\"0\"))){\n \t\t\t\tout.println(0);\n \t\t\t\tout.close();\n \t\t\t\tfound = true;\n \t\t\t}\n \t\t}",
"array.add(new BigInteger(st.nextToken()))",
"array.add",
"array",
"new BigInteger(st.nextToken())",
"if (array.get(i).equals(new BigInteger(\"0\"))){\n \t\t\t\tout.println(0);\n \t\t\t\tout.close();\n \t\t\t\tfound = true;\n \t\t\t}",
"array.get(i).equals(new BigInteger(\"0\"))",
"array.get(i).equals",
"array.get(i)",
"array.get",
"array",
"i",
"new BigInteger(\"0\")",
"{\n \t\t\t\tout.println(0);\n \t\t\t\tout.close();\n \t\t\t\tfound = true;\n \t\t\t}",
"out.println(0)",
"out.println",
"out",
"0",
"out.close()",
"out.close",
"out",
"found = true",
"found",
"true",
"if (found == false){\n\t \t\tBigInteger prod = new BigInteger(\"1\");\n\t \t\t\n\t \t\tboolean found1 = true;\n\t \t\tfor(int i = 0;i<n;i++){\n\t \t\t\tprod = prod.multiply(array.get(i));\n\t \t\t\tif (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0){\n\t \t\t\t\tout.println(-1);\n\t \t\t\t\tfound1 = false;\n\t \t\t\t\tbreak;\n\t \t\t\t}\n\t \t\t}\n\t \t\tif (found1 == true){\n\t \t\t\tout.println(prod);\n\t \t\t}\n \t\t}",
"found == false",
"found",
"false",
"{\n\t \t\tBigInteger prod = new BigInteger(\"1\");\n\t \t\t\n\t \t\tboolean found1 = true;\n\t \t\tfor(int i = 0;i<n;i++){\n\t \t\t\tprod = prod.multiply(array.get(i));\n\t \t\t\tif (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0){\n\t \t\t\t\tout.println(-1);\n\t \t\t\t\tfound1 = false;\n\t \t\t\t\tbreak;\n\t \t\t\t}\n\t \t\t}\n\t \t\tif (found1 == true){\n\t \t\t\tout.println(prod);\n\t \t\t}\n \t\t}",
"BigInteger prod = new BigInteger(\"1\");",
"prod",
"new BigInteger(\"1\")",
"boolean found1 = true;",
"found1",
"true",
"for(int i = 0;i<n;i++){\n\t \t\t\tprod = prod.multiply(array.get(i));\n\t \t\t\tif (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0){\n\t \t\t\t\tout.println(-1);\n\t \t\t\t\tfound1 = false;\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\tprod = prod.multiply(array.get(i));\n\t \t\t\tif (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0){\n\t \t\t\t\tout.println(-1);\n\t \t\t\t\tfound1 = false;\n\t \t\t\t\tbreak;\n\t \t\t\t}\n\t \t\t}",
"{\n\t \t\t\tprod = prod.multiply(array.get(i));\n\t \t\t\tif (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0){\n\t \t\t\t\tout.println(-1);\n\t \t\t\t\tfound1 = false;\n\t \t\t\t\tbreak;\n\t \t\t\t}\n\t \t\t}",
"prod = prod.multiply(array.get(i))",
"prod",
"prod.multiply(array.get(i))",
"prod.multiply",
"prod",
"array.get(i)",
"array.get",
"array",
"i",
"if (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0){\n\t \t\t\t\tout.println(-1);\n\t \t\t\t\tfound1 = false;\n\t \t\t\t\tbreak;\n\t \t\t\t}",
"prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0",
"prod.compareTo(new BigInteger(\"1000000000000000000\"))",
"prod.compareTo",
"prod",
"new BigInteger(\"1000000000000000000\")",
"0",
"{\n\t \t\t\t\tout.println(-1);\n\t \t\t\t\tfound1 = false;\n\t \t\t\t\tbreak;\n\t \t\t\t}",
"out.println(-1)",
"out.println",
"out",
"-1",
"1",
"found1 = false",
"found1",
"false",
"break;",
"if (found1 == true){\n\t \t\t\tout.println(prod);\n\t \t\t}",
"found1 == true",
"found1",
"true",
"{\n\t \t\t\tout.println(prod);\n\t \t\t}",
"out.println(prod)",
"out.println",
"out",
"prod",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"public class Main {\n \n\tpublic static void main(String[] args) throws Exception{\n\t\tint num = 998244353;\n \n\t\t// TODO Auto-generated method stub\n \t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n \t\tPrintWriter out = new PrintWriter(System.out);\n//\t \t\n \t\tint n = Integer.parseInt(bf.readLine());\n \t\tStringTokenizer st = new StringTokenizer(bf.readLine());\n \t\tArrayList<BigInteger> array = new ArrayList<BigInteger>();\n \t\tboolean found = false;\n \t\tfor(int i = 0;i<n;i++){\n \t\t\tarray.add(new BigInteger(st.nextToken()));\n \t\t\tif (array.get(i).equals(new BigInteger(\"0\"))){\n \t\t\t\tout.println(0);\n \t\t\t\tout.close();\n \t\t\t\tfound = true;\n \t\t\t}\n \t\t}\n \t\tif (found == false){\n\t \t\tBigInteger prod = new BigInteger(\"1\");\n\t \t\t\n\t \t\tboolean found1 = true;\n\t \t\tfor(int i = 0;i<n;i++){\n\t \t\t\tprod = prod.multiply(array.get(i));\n\t \t\t\tif (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0){\n\t \t\t\t\tout.println(-1);\n\t \t\t\t\tfound1 = false;\n\t \t\t\t\tbreak;\n\t \t\t\t}\n\t \t\t}\n\t \t\tif (found1 == true){\n\t \t\t\tout.println(prod);\n\t \t\t}\n \t\t}\n \t\tout.close();\n \t\t\n \t\t\n \t\t\n \t}\n}",
"public class Main {\n \n\tpublic static void main(String[] args) throws Exception{\n\t\tint num = 998244353;\n \n\t\t// TODO Auto-generated method stub\n \t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n \t\tPrintWriter out = new PrintWriter(System.out);\n//\t \t\n \t\tint n = Integer.parseInt(bf.readLine());\n \t\tStringTokenizer st = new StringTokenizer(bf.readLine());\n \t\tArrayList<BigInteger> array = new ArrayList<BigInteger>();\n \t\tboolean found = false;\n \t\tfor(int i = 0;i<n;i++){\n \t\t\tarray.add(new BigInteger(st.nextToken()));\n \t\t\tif (array.get(i).equals(new BigInteger(\"0\"))){\n \t\t\t\tout.println(0);\n \t\t\t\tout.close();\n \t\t\t\tfound = true;\n \t\t\t}\n \t\t}\n \t\tif (found == false){\n\t \t\tBigInteger prod = new BigInteger(\"1\");\n\t \t\t\n\t \t\tboolean found1 = true;\n\t \t\tfor(int i = 0;i<n;i++){\n\t \t\t\tprod = prod.multiply(array.get(i));\n\t \t\t\tif (prod.compareTo(new BigInteger(\"1000000000000000000\")) > 0){\n\t \t\t\t\tout.println(-1);\n\t \t\t\t\tfound1 = false;\n\t \t\t\t\tbreak;\n\t \t\t\t}\n\t \t\t}\n\t \t\tif (found1 == true){\n\t \t\t\tout.println(prod);\n\t \t\t}\n \t\t}\n \t\tout.close();\n \t\t\n \t\t\n \t\t\n \t}\n}",
"Main"
] |
import java.util.*;
import java.math.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws Exception{
int num = 998244353;
// TODO Auto-generated method stub
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
//
int n = Integer.parseInt(bf.readLine());
StringTokenizer st = new StringTokenizer(bf.readLine());
ArrayList<BigInteger> array = new ArrayList<BigInteger>();
boolean found = false;
for(int i = 0;i<n;i++){
array.add(new BigInteger(st.nextToken()));
if (array.get(i).equals(new BigInteger("0"))){
out.println(0);
out.close();
found = true;
}
}
if (found == false){
BigInteger prod = new BigInteger("1");
boolean found1 = true;
for(int i = 0;i<n;i++){
prod = prod.multiply(array.get(i));
if (prod.compareTo(new BigInteger("1000000000000000000")) > 0){
out.println(-1);
found1 = false;
break;
}
}
if (found1 == true){
out.println(prod);
}
}
out.close();
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
17,
12,
13,
30,
0,
18,
36,
13,
13,
0,
18,
36,
13,
13,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
0,
13,
17,
23,
13,
23,
13,
12,
13,
30,
4,
18,
18,
13,
13,
4,
13,
12,
13,
30,
14,
4,
13,
29,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
13,
13,
18,
13,
13,
29,
40,
17,
0,
13,
18,
13,
13,
29,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
14,
2,
18,
13,
13,
17,
29,
17,
29,
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,
41,
13,
20,
4,
18,
13,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
4,
8
],
[
8,
9
],
[
4,
10
],
[
10,
11
],
[
10,
12
],
[
4,
13
],
[
13,
14
],
[
13,
15
],
[
15,
16
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
16,
20
],
[
15,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
21,
25
],
[
15,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
13,
41
],
[
41,
42
],
[
13,
43
],
[
43,
44
],
[
4,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
48,
53
],
[
53,
54
],
[
4,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
61,
62
],
[
57,
63
],
[
63,
64
],
[
63,
65
],
[
57,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
66,
71
],
[
71,
72
],
[
71,
73
],
[
66,
74
],
[
74,
75
],
[
75,
76
],
[
66,
77
],
[
78,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
80,
84
],
[
84,
85
],
[
84,
86
],
[
79,
87
],
[
87,
88
],
[
88,
89
],
[
78,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
57,
95
],
[
95,
96
],
[
4,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
100,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
107,
109
],
[
100,
110
],
[
110,
111
],
[
111,
112
],
[
100,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
114,
120
],
[
120,
121
],
[
99,
122
],
[
122,
123
],
[
0,
124
],
[
169,
125
],
[
169,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
135,
136
],
[
128,
137
],
[
137,
138
],
[
137,
139
],
[
128,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
141,
146
],
[
146,
147
],
[
146,
148
],
[
141,
149
],
[
149,
150
],
[
150,
151
],
[
141,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
157,
158
],
[
158,
159
],
[
128,
160
],
[
160,
161
],
[
160,
162
],
[
128,
163
],
[
163,
164
],
[
164,
165
],
[
126,
166
],
[
166,
167
],
[
0,
168
],
[
168,
169
],
[
168,
170
]
] |
[
"import java.util.*;\n\nclass Problem {\n int n;\n long[] a;\n long MAX = 1;\n \n public Problem(int n, long[] a) {\n this.n = n;\n this.a = a;\n for (int i = 0; i < 18; i++) MAX *= 10;\n }\n\n public void solve() {\n System.out.println(calc());\n }\n\n public long calc() {\n if (hasAnyZero()) return 0;\n long ans = 1;\n for (int i = 0; i < n; i++) {\n if (MAX / ans < a[i]) return -1;\n ans *= a[i];\n }\n return ans;\n }\n\n public boolean hasAnyZero() {\n for (int i = 0; i < a.length; i++) if (a[i] == 0) return true;\n return false;\n }\n}\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[] a = new long[n];\n for (int i = 0; i < n; i++) a[i] = sc.nextLong();\n Problem p = new Problem(n, a);\n p.solve();\n }\n}\n",
"import java.util.*;",
"util.*",
"java",
"class Problem {\n int n;\n long[] a;\n long MAX = 1;\n \n public Problem(int n, long[] a) {\n this.n = n;\n this.a = a;\n for (int i = 0; i < 18; i++) MAX *= 10;\n }\n\n public void solve() {\n System.out.println(calc());\n }\n\n public long calc() {\n if (hasAnyZero()) return 0;\n long ans = 1;\n for (int i = 0; i < n; i++) {\n if (MAX / ans < a[i]) return -1;\n ans *= a[i];\n }\n return ans;\n }\n\n public boolean hasAnyZero() {\n for (int i = 0; i < a.length; i++) if (a[i] == 0) return true;\n return false;\n }\n}",
"Problem",
"int n;",
"n",
"long[] a;",
"a",
"long MAX = 1;",
"MAX",
"1",
"public Problem(int n, long[] a) {\n this.n = n;\n this.a = a;\n for (int i = 0; i < 18; i++) MAX *= 10;\n }",
"Problem",
"{\n this.n = n;\n this.a = a;\n for (int i = 0; i < 18; i++) MAX *= 10;\n }",
"this.n = n",
"this.n",
"this",
"this.n",
"n",
"this.a = a",
"this.a",
"this",
"this.a",
"a",
"for (int i = 0; i < 18; i++) MAX *= 10;",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < 18",
"i",
"18",
"i++",
"i++",
"i",
"MAX *= 10;",
"MAX *= 10",
"MAX",
"10",
"int n",
"n",
"long[] a",
"a",
"public void solve() {\n System.out.println(calc());\n }",
"solve",
"{\n System.out.println(calc());\n }",
"System.out.println(calc())",
"System.out.println",
"System.out",
"System",
"System.out",
"calc()",
"calc",
"public long calc() {\n if (hasAnyZero()) return 0;\n long ans = 1;\n for (int i = 0; i < n; i++) {\n if (MAX / ans < a[i]) return -1;\n ans *= a[i];\n }\n return ans;\n }",
"calc",
"{\n if (hasAnyZero()) return 0;\n long ans = 1;\n for (int i = 0; i < n; i++) {\n if (MAX / ans < a[i]) return -1;\n ans *= a[i];\n }\n return ans;\n }",
"if (hasAnyZero()) return 0;",
"hasAnyZero()",
"hasAnyZero",
"return 0;",
"0",
"long ans = 1;",
"ans",
"1",
"for (int i = 0; i < n; i++) {\n if (MAX / ans < a[i]) return -1;\n ans *= a[i];\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if (MAX / ans < a[i]) return -1;\n ans *= a[i];\n }",
"{\n if (MAX / ans < a[i]) return -1;\n ans *= a[i];\n }",
"if (MAX / ans < a[i]) return -1;",
"MAX / ans < a[i]",
"MAX / ans",
"MAX",
"ans",
"a[i]",
"a",
"i",
"return -1;",
"-1",
"1",
"ans *= a[i]",
"ans",
"a[i]",
"a",
"i",
"return ans;",
"ans",
"public boolean hasAnyZero() {\n for (int i = 0; i < a.length; i++) if (a[i] == 0) return true;\n return false;\n }",
"hasAnyZero",
"{\n for (int i = 0; i < a.length; i++) if (a[i] == 0) return true;\n return false;\n }",
"for (int i = 0; i < a.length; i++) if (a[i] == 0) return true;",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"if (a[i] == 0) return true;",
"if (a[i] == 0) return true;",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"return true;",
"true",
"return false;",
"false",
"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 for (int i = 0; i < n; i++) a[i] = sc.nextLong();\n Problem p = new Problem(n, a);\n p.solve();\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 for (int i = 0; i < n; i++) a[i] = sc.nextLong();\n Problem p = new Problem(n, a);\n p.solve();\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n for (int i = 0; i < n; i++) a[i] = sc.nextLong();\n Problem p = new Problem(n, a);\n p.solve();\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++) a[i] = sc.nextLong();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = sc.nextLong();",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"Problem p = new Problem(n, a);",
"p",
"new Problem(n, a)",
"p.solve()",
"p.solve",
"p",
"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 for (int i = 0; i < n; i++) a[i] = sc.nextLong();\n Problem p = new Problem(n, a);\n p.solve();\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 for (int i = 0; i < n; i++) a[i] = sc.nextLong();\n Problem p = new Problem(n, a);\n p.solve();\n }\n}",
"Main"
] |
import java.util.*;
class Problem {
int n;
long[] a;
long MAX = 1;
public Problem(int n, long[] a) {
this.n = n;
this.a = a;
for (int i = 0; i < 18; i++) MAX *= 10;
}
public void solve() {
System.out.println(calc());
}
public long calc() {
if (hasAnyZero()) return 0;
long ans = 1;
for (int i = 0; i < n; i++) {
if (MAX / ans < a[i]) return -1;
ans *= a[i];
}
return ans;
}
public boolean hasAnyZero() {
for (int i = 0; i < a.length; i++) if (a[i] == 0) return true;
return false;
}
}
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();
Problem p = new Problem(n, a);
p.solve();
}
}
|
[
7,
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,
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,
13,
40,
17,
9,
14,
2,
2,
13,
2,
13,
13,
2,
2,
13,
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
],
[
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
],
[
19,
20
],
[
20,
21
],
[
19,
22
],
[
19,
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
],
[
40,
42
],
[
42,
43
],
[
43,
44
],
[
39,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
39,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
54,
59
],
[
39,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
64,
66
],
[
61,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
60,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
60,
77
],
[
77,
78
],
[
78,
79
],
[
78,
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.*;\n\npublic class Main {\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n \n long mx = (long)Math.pow(10, 18);\n \n long ans = 1;\n for(int i = 0; i < n; i++) {\n long next = sc.nextLong();\n if(next == 0) {\n ans = 0;\n break;\n }\n if(ans == -1) continue;\n if(ans > mx/next || ans*next > mx) {\n ans = -1;\n } else {\n ans *= next;\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\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n \n long mx = (long)Math.pow(10, 18);\n \n long ans = 1;\n for(int i = 0; i < n; i++) {\n long next = sc.nextLong();\n if(next == 0) {\n ans = 0;\n break;\n }\n if(ans == -1) continue;\n if(ans > mx/next || ans*next > mx) {\n ans = -1;\n } else {\n ans *= next;\n }\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n \n long mx = (long)Math.pow(10, 18);\n \n long ans = 1;\n for(int i = 0; i < n; i++) {\n long next = sc.nextLong();\n if(next == 0) {\n ans = 0;\n break;\n }\n if(ans == -1) continue;\n if(ans > mx/next || ans*next > mx) {\n ans = -1;\n } else {\n ans *= next;\n }\n }\n System.out.println(ans);\n }",
"main",
"{\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n \n long mx = (long)Math.pow(10, 18);\n \n long ans = 1;\n for(int i = 0; i < n; i++) {\n long next = sc.nextLong();\n if(next == 0) {\n ans = 0;\n break;\n }\n if(ans == -1) continue;\n if(ans > mx/next || ans*next > mx) {\n ans = -1;\n } else {\n ans *= next;\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 mx = (long)Math.pow(10, 18);",
"mx",
"(long)Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"long ans = 1;",
"ans",
"1",
"for(int i = 0; i < n; i++) {\n long next = sc.nextLong();\n if(next == 0) {\n ans = 0;\n break;\n }\n if(ans == -1) continue;\n if(ans > mx/next || ans*next > mx) {\n ans = -1;\n } else {\n ans *= next;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n long next = sc.nextLong();\n if(next == 0) {\n ans = 0;\n break;\n }\n if(ans == -1) continue;\n if(ans > mx/next || ans*next > mx) {\n ans = -1;\n } else {\n ans *= next;\n }\n }",
"{\n long next = sc.nextLong();\n if(next == 0) {\n ans = 0;\n break;\n }\n if(ans == -1) continue;\n if(ans > mx/next || ans*next > mx) {\n ans = -1;\n } else {\n ans *= next;\n }\n }",
"long next = sc.nextLong();",
"next",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(next == 0) {\n ans = 0;\n break;\n }",
"next == 0",
"next",
"0",
"{\n ans = 0;\n break;\n }",
"ans = 0",
"ans",
"0",
"break;",
"if(ans == -1) continue;",
"ans == -1",
"ans",
"-1",
"1",
"continue;",
"if(ans > mx/next || ans*next > mx) {\n ans = -1;\n } else {\n ans *= next;\n }",
"ans > mx/next || ans*next > mx",
"ans > mx/next",
"ans",
"mx/next",
"mx",
"next",
"ans*next > mx",
"ans*next",
"ans",
"next",
"mx",
"{\n ans = -1;\n }",
"ans = -1",
"ans",
"-1",
"1",
"{\n ans *= next;\n }",
"ans *= next",
"ans",
"next",
"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 sc = new Scanner(System.in);\n int n = sc.nextInt();\n \n long mx = (long)Math.pow(10, 18);\n \n long ans = 1;\n for(int i = 0; i < n; i++) {\n long next = sc.nextLong();\n if(next == 0) {\n ans = 0;\n break;\n }\n if(ans == -1) continue;\n if(ans > mx/next || ans*next > mx) {\n ans = -1;\n } else {\n ans *= next;\n }\n }\n System.out.println(ans);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n \n long mx = (long)Math.pow(10, 18);\n \n long ans = 1;\n for(int i = 0; i < n; i++) {\n long next = sc.nextLong();\n if(next == 0) {\n ans = 0;\n break;\n }\n if(ans == -1) continue;\n if(ans > mx/next || ans*next > mx) {\n ans = -1;\n } else {\n ans *= next;\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 mx = (long)Math.pow(10, 18);
long ans = 1;
for(int i = 0; i < n; i++) {
long next = sc.nextLong();
if(next == 0) {
ans = 0;
break;
}
if(ans == -1) continue;
if(ans > mx/next || ans*next > mx) {
ans = -1;
} else {
ans *= next;
}
}
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,
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,
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,
3,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
14,
13,
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
],
[
130,
5
],
[
130,
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
],
[
8,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
32,
35
],
[
32,
36
],
[
8,
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
],
[
64,
65
],
[
64,
66
],
[
8,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
72,
73
],
[
72,
74
],
[
67,
75
],
[
75,
76
],
[
76,
77
],
[
67,
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
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
80,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
8,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
99,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
113,
118
],
[
110,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
125,
126
],
[
6,
127
],
[
127,
128
],
[
0,
129
],
[
129,
130
],
[
129,
131
]
] |
[
"import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n \n Scanner scanner = new Scanner(System.in);\n \n int N = scanner.nextInt();\n long[] A = new long[N];\n long Sum = 1;\n int hantei = 1;\n boolean hnt = true;\n long S = (long)Math.pow(10,18);\n \n for(int i=0; i<N; i++){\n A[i] = scanner.nextLong();\n if(A[i]==0){\n hantei = 0;\n }\n }\n \n for(int i=0; i<N; i++){\n if(A[i]<=S/Sum){\n Sum *= A[i];\n }else{\n hnt = false;\n break;\n }\n }\n \n \n if(hantei==0){\n System.out.println(0);\n }else if(hnt){\n System.out.println(Sum);\n }else{\n System.out.println(-1);\n }\n\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) throws Exception {\n \n Scanner scanner = new Scanner(System.in);\n \n int N = scanner.nextInt();\n long[] A = new long[N];\n long Sum = 1;\n int hantei = 1;\n boolean hnt = true;\n long S = (long)Math.pow(10,18);\n \n for(int i=0; i<N; i++){\n A[i] = scanner.nextLong();\n if(A[i]==0){\n hantei = 0;\n }\n }\n \n for(int i=0; i<N; i++){\n if(A[i]<=S/Sum){\n Sum *= A[i];\n }else{\n hnt = false;\n break;\n }\n }\n \n \n if(hantei==0){\n System.out.println(0);\n }else if(hnt){\n System.out.println(Sum);\n }else{\n System.out.println(-1);\n }\n\n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n \n Scanner scanner = new Scanner(System.in);\n \n int N = scanner.nextInt();\n long[] A = new long[N];\n long Sum = 1;\n int hantei = 1;\n boolean hnt = true;\n long S = (long)Math.pow(10,18);\n \n for(int i=0; i<N; i++){\n A[i] = scanner.nextLong();\n if(A[i]==0){\n hantei = 0;\n }\n }\n \n for(int i=0; i<N; i++){\n if(A[i]<=S/Sum){\n Sum *= A[i];\n }else{\n hnt = false;\n break;\n }\n }\n \n \n if(hantei==0){\n System.out.println(0);\n }else if(hnt){\n System.out.println(Sum);\n }else{\n System.out.println(-1);\n }\n\n }",
"main",
"{\n \n Scanner scanner = new Scanner(System.in);\n \n int N = scanner.nextInt();\n long[] A = new long[N];\n long Sum = 1;\n int hantei = 1;\n boolean hnt = true;\n long S = (long)Math.pow(10,18);\n \n for(int i=0; i<N; i++){\n A[i] = scanner.nextLong();\n if(A[i]==0){\n hantei = 0;\n }\n }\n \n for(int i=0; i<N; i++){\n if(A[i]<=S/Sum){\n Sum *= A[i];\n }else{\n hnt = false;\n break;\n }\n }\n \n \n if(hantei==0){\n System.out.println(0);\n }else if(hnt){\n System.out.println(Sum);\n }else{\n System.out.println(-1);\n }\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 Sum = 1;",
"Sum",
"1",
"int hantei = 1;",
"hantei",
"1",
"boolean hnt = true;",
"hnt",
"true",
"long S = (long)Math.pow(10,18);",
"S",
"(long)Math.pow(10,18)",
"Math.pow",
"Math",
"10",
"18",
"for(int i=0; i<N; i++){\n A[i] = scanner.nextLong();\n if(A[i]==0){\n hantei = 0;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i] = scanner.nextLong();\n if(A[i]==0){\n hantei = 0;\n }\n }",
"{\n A[i] = scanner.nextLong();\n if(A[i]==0){\n hantei = 0;\n }\n }",
"A[i] = scanner.nextLong()",
"A[i]",
"A",
"i",
"scanner.nextLong()",
"scanner.nextLong",
"scanner",
"if(A[i]==0){\n hantei = 0;\n }",
"A[i]==0",
"A[i]",
"A",
"i",
"0",
"{\n hantei = 0;\n }",
"hantei = 0",
"hantei",
"0",
"for(int i=0; i<N; i++){\n if(A[i]<=S/Sum){\n Sum *= A[i];\n }else{\n hnt = false;\n break;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if(A[i]<=S/Sum){\n Sum *= A[i];\n }else{\n hnt = false;\n break;\n }\n }",
"{\n if(A[i]<=S/Sum){\n Sum *= A[i];\n }else{\n hnt = false;\n break;\n }\n }",
"if(A[i]<=S/Sum){\n Sum *= A[i];\n }else{\n hnt = false;\n break;\n }",
"A[i]<=S/Sum",
"A[i]",
"A",
"i",
"S/Sum",
"S",
"Sum",
"{\n Sum *= A[i];\n }",
"Sum *= A[i]",
"Sum",
"A[i]",
"A",
"i",
"{\n hnt = false;\n break;\n }",
"hnt = false",
"hnt",
"false",
"break;",
"if(hantei==0){\n System.out.println(0);\n }else if(hnt){\n System.out.println(Sum);\n }else{\n System.out.println(-1);\n }",
"hantei==0",
"hantei",
"0",
"{\n System.out.println(0);\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"if(hnt){\n System.out.println(Sum);\n }else{\n System.out.println(-1);\n }",
"hnt",
"{\n System.out.println(Sum);\n }",
"System.out.println(Sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"Sum",
"{\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) throws Exception {\n \n Scanner scanner = new Scanner(System.in);\n \n int N = scanner.nextInt();\n long[] A = new long[N];\n long Sum = 1;\n int hantei = 1;\n boolean hnt = true;\n long S = (long)Math.pow(10,18);\n \n for(int i=0; i<N; i++){\n A[i] = scanner.nextLong();\n if(A[i]==0){\n hantei = 0;\n }\n }\n \n for(int i=0; i<N; i++){\n if(A[i]<=S/Sum){\n Sum *= A[i];\n }else{\n hnt = false;\n break;\n }\n }\n \n \n if(hantei==0){\n System.out.println(0);\n }else if(hnt){\n System.out.println(Sum);\n }else{\n System.out.println(-1);\n }\n\n }\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n \n Scanner scanner = new Scanner(System.in);\n \n int N = scanner.nextInt();\n long[] A = new long[N];\n long Sum = 1;\n int hantei = 1;\n boolean hnt = true;\n long S = (long)Math.pow(10,18);\n \n for(int i=0; i<N; i++){\n A[i] = scanner.nextLong();\n if(A[i]==0){\n hantei = 0;\n }\n }\n \n for(int i=0; i<N; i++){\n if(A[i]<=S/Sum){\n Sum *= A[i];\n }else{\n hnt = false;\n break;\n }\n }\n \n \n if(hantei==0){\n System.out.println(0);\n }else if(hnt){\n System.out.println(Sum);\n }else{\n System.out.println(-1);\n }\n\n }\n}",
"Main"
] |
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
long[] A = new long[N];
long Sum = 1;
int hantei = 1;
boolean hnt = true;
long S = (long)Math.pow(10,18);
for(int i=0; i<N; i++){
A[i] = scanner.nextLong();
if(A[i]==0){
hantei = 0;
}
}
for(int i=0; i<N; i++){
if(A[i]<=S/Sum){
Sum *= A[i];
}else{
hnt = false;
break;
}
}
if(hantei==0){
System.out.println(0);
}else if(hnt){
System.out.println(Sum);
}else{
System.out.println(-1);
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
38,
30,
41,
13,
20,
41,
13,
4,
18,
13,
17,
17,
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,
40,
13,
30,
38,
5,
13,
30,
0,
13,
17,
30,
0,
13,
4,
18,
13,
13,
13,
14,
2,
2,
13,
13,
2,
13,
17,
30,
0,
13,
17,
14,
13,
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
],
[
112,
5
],
[
112,
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
],
[
16,
20
],
[
10,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
10,
26
],
[
26,
27
],
[
26,
28
],
[
10,
29
],
[
29,
30
],
[
29,
31
],
[
10,
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
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
54,
61
],
[
44,
62
],
[
62,
63
],
[
63,
64
],
[
62,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
66,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
76,
80
],
[
44,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
86,
87
],
[
86,
88
],
[
81,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
10,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
93,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
6,
109
],
[
109,
110
],
[
0,
111
],
[
111,
112
],
[
111,
113
]
] |
[
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\ttry(Scanner sc = new Scanner(System.in)) {\n\n\t\t\t//\t\t\tlong a = Long.MAX_VALUE + 1;\n\t\t\tlong max = (long)Math.pow(10, 18);\n\n\t\t\t//\t\t\tSystem.out.println(a);\n\t\t\t//\t\t\tSystem.out.println(max+1);\n\n\n\t\t\tint n = sc.nextInt();\n\n\t\t\tlong ans = 1;\n\t\t\tboolean isOver = false;\n\t\t\tfor(int i = 0 ; i < n ; i++ ) {\n\t\t\t\tlong ai = sc.nextLong();\n\n\t\t\t\tif ( ai == 0 ) {\n\t\t\t\t\tSystem.out.println(\"0\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( !isOver ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tans = Math.multiplyExact(ans, ai);\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e) {\n\t\t\t\t\t\tisOver = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( ans > max || ans < 0 ) {\n\t\t\t\t\tisOver = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( isOver ) {\n\t\t\t\tSystem.out.println(\"-1\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t}\n\n\t\t}\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args){\n\t\ttry(Scanner sc = new Scanner(System.in)) {\n\n\t\t\t//\t\t\tlong a = Long.MAX_VALUE + 1;\n\t\t\tlong max = (long)Math.pow(10, 18);\n\n\t\t\t//\t\t\tSystem.out.println(a);\n\t\t\t//\t\t\tSystem.out.println(max+1);\n\n\n\t\t\tint n = sc.nextInt();\n\n\t\t\tlong ans = 1;\n\t\t\tboolean isOver = false;\n\t\t\tfor(int i = 0 ; i < n ; i++ ) {\n\t\t\t\tlong ai = sc.nextLong();\n\n\t\t\t\tif ( ai == 0 ) {\n\t\t\t\t\tSystem.out.println(\"0\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( !isOver ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tans = Math.multiplyExact(ans, ai);\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e) {\n\t\t\t\t\t\tisOver = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( ans > max || ans < 0 ) {\n\t\t\t\t\tisOver = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( isOver ) {\n\t\t\t\tSystem.out.println(\"-1\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t}\n\n\t\t}\n\t}\n\n}",
"Main",
"public static void main(String[] args){\n\t\ttry(Scanner sc = new Scanner(System.in)) {\n\n\t\t\t//\t\t\tlong a = Long.MAX_VALUE + 1;\n\t\t\tlong max = (long)Math.pow(10, 18);\n\n\t\t\t//\t\t\tSystem.out.println(a);\n\t\t\t//\t\t\tSystem.out.println(max+1);\n\n\n\t\t\tint n = sc.nextInt();\n\n\t\t\tlong ans = 1;\n\t\t\tboolean isOver = false;\n\t\t\tfor(int i = 0 ; i < n ; i++ ) {\n\t\t\t\tlong ai = sc.nextLong();\n\n\t\t\t\tif ( ai == 0 ) {\n\t\t\t\t\tSystem.out.println(\"0\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( !isOver ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tans = Math.multiplyExact(ans, ai);\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e) {\n\t\t\t\t\t\tisOver = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( ans > max || ans < 0 ) {\n\t\t\t\t\tisOver = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( isOver ) {\n\t\t\t\tSystem.out.println(\"-1\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t}\n\n\t\t}\n\t}",
"main",
"{\n\t\ttry(Scanner sc = new Scanner(System.in)) {\n\n\t\t\t//\t\t\tlong a = Long.MAX_VALUE + 1;\n\t\t\tlong max = (long)Math.pow(10, 18);\n\n\t\t\t//\t\t\tSystem.out.println(a);\n\t\t\t//\t\t\tSystem.out.println(max+1);\n\n\n\t\t\tint n = sc.nextInt();\n\n\t\t\tlong ans = 1;\n\t\t\tboolean isOver = false;\n\t\t\tfor(int i = 0 ; i < n ; i++ ) {\n\t\t\t\tlong ai = sc.nextLong();\n\n\t\t\t\tif ( ai == 0 ) {\n\t\t\t\t\tSystem.out.println(\"0\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( !isOver ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tans = Math.multiplyExact(ans, ai);\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e) {\n\t\t\t\t\t\tisOver = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( ans > max || ans < 0 ) {\n\t\t\t\t\tisOver = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( isOver ) {\n\t\t\t\tSystem.out.println(\"-1\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t}\n\n\t\t}\n\t}",
"try(Scanner sc = new Scanner(System.in)) {\n\n\t\t\t//\t\t\tlong a = Long.MAX_VALUE + 1;\n\t\t\tlong max = (long)Math.pow(10, 18);\n\n\t\t\t//\t\t\tSystem.out.println(a);\n\t\t\t//\t\t\tSystem.out.println(max+1);\n\n\n\t\t\tint n = sc.nextInt();\n\n\t\t\tlong ans = 1;\n\t\t\tboolean isOver = false;\n\t\t\tfor(int i = 0 ; i < n ; i++ ) {\n\t\t\t\tlong ai = sc.nextLong();\n\n\t\t\t\tif ( ai == 0 ) {\n\t\t\t\t\tSystem.out.println(\"0\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( !isOver ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tans = Math.multiplyExact(ans, ai);\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e) {\n\t\t\t\t\t\tisOver = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( ans > max || ans < 0 ) {\n\t\t\t\t\tisOver = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( isOver ) {\n\t\t\t\tSystem.out.println(\"-1\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t}\n\n\t\t}",
"{\n\n\t\t\t//\t\t\tlong a = Long.MAX_VALUE + 1;\n\t\t\tlong max = (long)Math.pow(10, 18);\n\n\t\t\t//\t\t\tSystem.out.println(a);\n\t\t\t//\t\t\tSystem.out.println(max+1);\n\n\n\t\t\tint n = sc.nextInt();\n\n\t\t\tlong ans = 1;\n\t\t\tboolean isOver = false;\n\t\t\tfor(int i = 0 ; i < n ; i++ ) {\n\t\t\t\tlong ai = sc.nextLong();\n\n\t\t\t\tif ( ai == 0 ) {\n\t\t\t\t\tSystem.out.println(\"0\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( !isOver ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tans = Math.multiplyExact(ans, ai);\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e) {\n\t\t\t\t\t\tisOver = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( ans > max || ans < 0 ) {\n\t\t\t\t\tisOver = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( isOver ) {\n\t\t\t\tSystem.out.println(\"-1\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t}\n\n\t\t}",
"Scanner sc = new Scanner(System.in)",
"Scanner sc = new Scanner(System.in)",
"new Scanner(System.in)",
"long max = (long)Math.pow(10, 18);",
"max",
"(long)Math.pow(10, 18)",
"Math.pow",
"Math",
"10",
"18",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long ans = 1;",
"ans",
"1",
"boolean isOver = false;",
"isOver",
"false",
"for(int i = 0 ; i < n ; i++ ) {\n\t\t\t\tlong ai = sc.nextLong();\n\n\t\t\t\tif ( ai == 0 ) {\n\t\t\t\t\tSystem.out.println(\"0\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( !isOver ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tans = Math.multiplyExact(ans, ai);\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e) {\n\t\t\t\t\t\tisOver = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( ans > max || ans < 0 ) {\n\t\t\t\t\tisOver = true;\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\tlong ai = sc.nextLong();\n\n\t\t\t\tif ( ai == 0 ) {\n\t\t\t\t\tSystem.out.println(\"0\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( !isOver ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tans = Math.multiplyExact(ans, ai);\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e) {\n\t\t\t\t\t\tisOver = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( ans > max || ans < 0 ) {\n\t\t\t\t\tisOver = true;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tlong ai = sc.nextLong();\n\n\t\t\t\tif ( ai == 0 ) {\n\t\t\t\t\tSystem.out.println(\"0\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( !isOver ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tans = Math.multiplyExact(ans, ai);\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e) {\n\t\t\t\t\t\tisOver = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( ans > max || ans < 0 ) {\n\t\t\t\t\tisOver = true;\n\t\t\t\t}\n\t\t\t}",
"long ai = sc.nextLong();",
"ai",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if ( ai == 0 ) {\n\t\t\t\t\tSystem.out.println(\"0\");\n\t\t\t\t\treturn;\n\t\t\t\t}",
"ai == 0",
"ai",
"0",
"{\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 ( !isOver ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tans = Math.multiplyExact(ans, ai);\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e) {\n\t\t\t\t\t\tisOver = true;\n\t\t\t\t\t}\n\t\t\t\t}",
"!isOver",
"isOver",
"{\n\t\t\t\t\ttry {\n\t\t\t\t\t\tans = Math.multiplyExact(ans, ai);\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e) {\n\t\t\t\t\t\tisOver = true;\n\t\t\t\t\t}\n\t\t\t\t}",
"try {\n\t\t\t\t\t\tans = Math.multiplyExact(ans, ai);\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e) {\n\t\t\t\t\t\tisOver = true;\n\t\t\t\t\t}",
"catch(Exception e) {\n\t\t\t\t\t\tisOver = true;\n\t\t\t\t\t}",
"Exception e",
"{\n\t\t\t\t\t\tisOver = true;\n\t\t\t\t\t}",
"isOver = true",
"isOver",
"true",
"{\n\t\t\t\t\t\tans = Math.multiplyExact(ans, ai);\n\t\t\t\t\t}",
"ans = Math.multiplyExact(ans, ai)",
"ans",
"Math.multiplyExact(ans, ai)",
"Math.multiplyExact",
"Math",
"ans",
"ai",
"if ( ans > max || ans < 0 ) {\n\t\t\t\t\tisOver = true;\n\t\t\t\t}",
"ans > max || ans < 0",
"ans > max",
"ans",
"max",
"ans < 0",
"ans",
"0",
"{\n\t\t\t\t\tisOver = true;\n\t\t\t\t}",
"isOver = true",
"isOver",
"true",
"if ( isOver ) {\n\t\t\t\tSystem.out.println(\"-1\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t}",
"isOver",
"{\n\t\t\t\tSystem.out.println(\"-1\");\n\t\t\t}",
"System.out.println(\"-1\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"{\n\t\t\t\tSystem.out.println(ans);\n\t\t\t}",
"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\ttry(Scanner sc = new Scanner(System.in)) {\n\n\t\t\t//\t\t\tlong a = Long.MAX_VALUE + 1;\n\t\t\tlong max = (long)Math.pow(10, 18);\n\n\t\t\t//\t\t\tSystem.out.println(a);\n\t\t\t//\t\t\tSystem.out.println(max+1);\n\n\n\t\t\tint n = sc.nextInt();\n\n\t\t\tlong ans = 1;\n\t\t\tboolean isOver = false;\n\t\t\tfor(int i = 0 ; i < n ; i++ ) {\n\t\t\t\tlong ai = sc.nextLong();\n\n\t\t\t\tif ( ai == 0 ) {\n\t\t\t\t\tSystem.out.println(\"0\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( !isOver ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tans = Math.multiplyExact(ans, ai);\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e) {\n\t\t\t\t\t\tisOver = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( ans > max || ans < 0 ) {\n\t\t\t\t\tisOver = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( isOver ) {\n\t\t\t\tSystem.out.println(\"-1\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t}\n\n\t\t}\n\t}\n\n}",
"public class Main {\n\tpublic static void main(String[] args){\n\t\ttry(Scanner sc = new Scanner(System.in)) {\n\n\t\t\t//\t\t\tlong a = Long.MAX_VALUE + 1;\n\t\t\tlong max = (long)Math.pow(10, 18);\n\n\t\t\t//\t\t\tSystem.out.println(a);\n\t\t\t//\t\t\tSystem.out.println(max+1);\n\n\n\t\t\tint n = sc.nextInt();\n\n\t\t\tlong ans = 1;\n\t\t\tboolean isOver = false;\n\t\t\tfor(int i = 0 ; i < n ; i++ ) {\n\t\t\t\tlong ai = sc.nextLong();\n\n\t\t\t\tif ( ai == 0 ) {\n\t\t\t\t\tSystem.out.println(\"0\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( !isOver ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tans = Math.multiplyExact(ans, ai);\n\t\t\t\t\t}\n\t\t\t\t\tcatch(Exception e) {\n\t\t\t\t\t\tisOver = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( ans > max || ans < 0 ) {\n\t\t\t\t\tisOver = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( isOver ) {\n\t\t\t\tSystem.out.println(\"-1\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t}\n\n\t\t}\n\t}\n\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static void main(String[] args){
try(Scanner sc = new Scanner(System.in)) {
// long a = Long.MAX_VALUE + 1;
long max = (long)Math.pow(10, 18);
// System.out.println(a);
// System.out.println(max+1);
int n = sc.nextInt();
long ans = 1;
boolean isOver = false;
for(int i = 0 ; i < n ; i++ ) {
long ai = sc.nextLong();
if ( ai == 0 ) {
System.out.println("0");
return;
}
if ( !isOver ) {
try {
ans = Math.multiplyExact(ans, ai);
}
catch(Exception e) {
isOver = true;
}
}
if ( ans > max || ans < 0 ) {
isOver = true;
}
}
if ( isOver ) {
System.out.println("-1");
}
else {
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,
4,
18,
13,
41,
13,
20,
13,
0,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
38,
5,
13,
30,
0,
13,
40,
17,
3,
30,
0,
13,
4,
18,
13,
13,
18,
13,
13,
14,
2,
13,
17,
30,
0,
13,
40,
17,
3,
14,
2,
13,
17,
30,
3,
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
],
[
11,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
20,
23
],
[
23,
24
],
[
24,
25
],
[
11,
26
],
[
26,
27
],
[
26,
28
],
[
11,
30
],
[
30,
31
],
[
30,
32
],
[
11,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
33,
38
],
[
38,
39
],
[
38,
40
],
[
33,
41
],
[
41,
42
],
[
42,
43
],
[
33,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
52,
53
],
[
53,
54
],
[
11,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
11,
59
],
[
59,
60
],
[
59,
61
],
[
11,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
62,
67
],
[
67,
68
],
[
67,
69
],
[
62,
70
],
[
70,
71
],
[
71,
72
],
[
62,
73
],
[
74,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
78,
83
],
[
75,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
87,
91
],
[
91,
92
],
[
91,
93
],
[
74,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
98,
103
],
[
74,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
108,
109
],
[
11,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
9,
116
],
[
116,
117
]
] |
[
"\nimport java.io.*;\nimport java.util.*;\n\nclass Main {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int N = Integer.parseInt(st.nextToken());\n long[] arr = new long[N];\n st = new StringTokenizer(br.readLine());\n for (int i=0; i<N; i++)\n arr[i] = Long.parseLong(st.nextToken());\n Arrays.sort(arr);\n\n long res = 1;\n for (int i=0; i<N; i++){\n try{\n res = Math.multiplyExact(res,arr[i]);\n }\n catch (Exception e){\n res = -1;\n break;\n }\n if (res>1000000000000000000L){\n res=-1;\n break;\n }\n if(res==0){\n break;\n }\n\n }\n System.out.println(res);\n\n }\n\n\n\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int N = Integer.parseInt(st.nextToken());\n long[] arr = new long[N];\n st = new StringTokenizer(br.readLine());\n for (int i=0; i<N; i++)\n arr[i] = Long.parseLong(st.nextToken());\n Arrays.sort(arr);\n\n long res = 1;\n for (int i=0; i<N; i++){\n try{\n res = Math.multiplyExact(res,arr[i]);\n }\n catch (Exception e){\n res = -1;\n break;\n }\n if (res>1000000000000000000L){\n res=-1;\n break;\n }\n if(res==0){\n break;\n }\n\n }\n System.out.println(res);\n\n }\n\n\n\n}",
"Main",
"public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int N = Integer.parseInt(st.nextToken());\n long[] arr = new long[N];\n st = new StringTokenizer(br.readLine());\n for (int i=0; i<N; i++)\n arr[i] = Long.parseLong(st.nextToken());\n Arrays.sort(arr);\n\n long res = 1;\n for (int i=0; i<N; i++){\n try{\n res = Math.multiplyExact(res,arr[i]);\n }\n catch (Exception e){\n res = -1;\n break;\n }\n if (res>1000000000000000000L){\n res=-1;\n break;\n }\n if(res==0){\n break;\n }\n\n }\n System.out.println(res);\n\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int N = Integer.parseInt(st.nextToken());\n long[] arr = new long[N];\n st = new StringTokenizer(br.readLine());\n for (int i=0; i<N; i++)\n arr[i] = Long.parseLong(st.nextToken());\n Arrays.sort(arr);\n\n long res = 1;\n for (int i=0; i<N; i++){\n try{\n res = Math.multiplyExact(res,arr[i]);\n }\n catch (Exception e){\n res = -1;\n break;\n }\n if (res>1000000000000000000L){\n res=-1;\n break;\n }\n if(res==0){\n break;\n }\n\n }\n System.out.println(res);\n\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"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",
"long[] arr = new long[N];",
"arr",
"new long[N]",
"N",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"for (int i=0; i<N; i++)\n arr[i] = Long.parseLong(st.nextToken());",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"arr[i] = Long.parseLong(st.nextToken());",
"arr[i] = Long.parseLong(st.nextToken())",
"arr[i]",
"arr",
"i",
"Long.parseLong(st.nextToken())",
"Long.parseLong",
"Long",
"st.nextToken()",
"st.nextToken",
"st",
"Arrays.sort(arr)",
"Arrays.sort",
"Arrays",
"arr",
"long res = 1;",
"res",
"1",
"for (int i=0; i<N; i++){\n try{\n res = Math.multiplyExact(res,arr[i]);\n }\n catch (Exception e){\n res = -1;\n break;\n }\n if (res>1000000000000000000L){\n res=-1;\n break;\n }\n if(res==0){\n break;\n }\n\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n try{\n res = Math.multiplyExact(res,arr[i]);\n }\n catch (Exception e){\n res = -1;\n break;\n }\n if (res>1000000000000000000L){\n res=-1;\n break;\n }\n if(res==0){\n break;\n }\n\n }",
"{\n try{\n res = Math.multiplyExact(res,arr[i]);\n }\n catch (Exception e){\n res = -1;\n break;\n }\n if (res>1000000000000000000L){\n res=-1;\n break;\n }\n if(res==0){\n break;\n }\n\n }",
"try{\n res = Math.multiplyExact(res,arr[i]);\n }\n catch (Exception e){\n res = -1;\n break;\n }",
"catch (Exception e){\n res = -1;\n break;\n }",
"Exception e",
"{\n res = -1;\n break;\n }",
"res = -1",
"res",
"-1",
"1",
"break;",
"{\n res = Math.multiplyExact(res,arr[i]);\n }",
"res = Math.multiplyExact(res,arr[i])",
"res",
"Math.multiplyExact(res,arr[i])",
"Math.multiplyExact",
"Math",
"res",
"arr[i]",
"arr",
"i",
"if (res>1000000000000000000L){\n res=-1;\n break;\n }",
"res>1000000000000000000L",
"res",
"1000000000000000000L",
"{\n res=-1;\n break;\n }",
"res=-1",
"res",
"-1",
"1",
"break;",
"if(res==0){\n break;\n }",
"res==0",
"res",
"0",
"{\n break;\n }",
"break;",
"System.out.println(res)",
"System.out.println",
"System.out",
"System",
"System.out",
"res",
"String[] args",
"args"
] |
import java.io.*;
import java.util.*;
class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int N = Integer.parseInt(st.nextToken());
long[] arr = new long[N];
st = new StringTokenizer(br.readLine());
for (int i=0; i<N; i++)
arr[i] = Long.parseLong(st.nextToken());
Arrays.sort(arr);
long res = 1;
for (int i=0; i<N; i++){
try{
res = Math.multiplyExact(res,arr[i]);
}
catch (Exception e){
res = -1;
break;
}
if (res>1000000000000000000L){
res=-1;
break;
}
if(res==0){
break;
}
}
System.out.println(res);
}
}
|
[
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,
20,
41,
13,
20,
4,
18,
13,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
4,
18,
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,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
4,
18,
13,
13,
14,
2,
18,
13,
17,
17,
30,
4,
18,
13,
17,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
13,
40,
17,
29,
30,
0,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
13,
40,
17,
29,
4,
18,
13,
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,
30,
29,
18,
13,
40,
13,
30,
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,
30,
40,
13,
29,
4,
13,
12,
13,
30,
14,
40,
4,
13,
30,
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,
30,
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,
30,
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
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
432,
26
],
[
432,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
29,
33
],
[
33,
34
],
[
33,
35
],
[
29,
36
],
[
36,
37
],
[
36,
38
],
[
29,
39
],
[
39,
40
],
[
40,
41
],
[
39,
42
],
[
29,
43
],
[
43,
44
],
[
44,
45
],
[
27,
46
],
[
46,
47
],
[
0,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
48,
52
],
[
52,
53
],
[
48,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
60,
61
],
[
56,
62
],
[
62,
63
],
[
62,
64
],
[
56,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
66,
71
],
[
71,
72
],
[
71,
73
],
[
66,
74
],
[
74,
75
],
[
75,
76
],
[
66,
77
],
[
78,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
84,
85
],
[
54,
86
],
[
86,
87
],
[
48,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
94,
95
],
[
94,
96
],
[
90,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
90,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
101,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
108,
111
],
[
101,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
113,
118
],
[
118,
119
],
[
118,
120
],
[
113,
121
],
[
121,
122
],
[
122,
123
],
[
113,
124
],
[
125,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
129,
130
],
[
128,
131
],
[
131,
132
],
[
131,
133
],
[
125,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
136,
139
],
[
135,
140
],
[
134,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
142,
145
],
[
145,
146
],
[
141,
147
],
[
134,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
152,
153
],
[
151,
154
],
[
112,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
157,
160
],
[
156,
161
],
[
155,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
163,
166
],
[
166,
167
],
[
162,
168
],
[
112,
169
],
[
169,
170
],
[
170,
171
],
[
169,
172
],
[
88,
173
],
[
173,
174
],
[
0,
175
],
[
175,
176
],
[
175,
177
],
[
177,
178
],
[
177,
179
],
[
179,
180
],
[
179,
181
],
[
175,
182
],
[
182,
183
],
[
182,
184
],
[
175,
186
],
[
186,
187
],
[
186,
188
],
[
175,
189
],
[
189,
190
],
[
189,
191
],
[
175,
192
],
[
192,
193
],
[
192,
194
],
[
194,
195
],
[
195,
196
],
[
196,
197
],
[
196,
198
],
[
195,
199
],
[
199,
200
],
[
200,
201
],
[
195,
202
],
[
202,
203
],
[
203,
204
],
[
203,
205
],
[
202,
206
],
[
206,
207
],
[
207,
208
],
[
207,
209
],
[
209,
210
],
[
210,
211
],
[
211,
212
],
[
206,
213
],
[
213,
214
],
[
214,
215
],
[
214,
216
],
[
216,
217
],
[
217,
218
],
[
216,
219
],
[
202,
220
],
[
220,
221
],
[
221,
222
],
[
221,
223
],
[
220,
224
],
[
224,
225
],
[
225,
226
],
[
194,
227
],
[
227,
228
],
[
175,
229
],
[
229,
230
],
[
229,
231
],
[
231,
232
],
[
232,
233
],
[
233,
234
],
[
232,
235
],
[
235,
236
],
[
236,
237
],
[
237,
238
],
[
237,
239
],
[
239,
240
],
[
232,
241
],
[
241,
242
],
[
242,
243
],
[
243,
244
],
[
175,
245
],
[
245,
246
],
[
245,
247
],
[
247,
248
],
[
248,
249
],
[
249,
250
],
[
250,
251
],
[
250,
252
],
[
249,
253
],
[
253,
254
],
[
253,
255
],
[
245,
256
],
[
256,
257
],
[
175,
258
],
[
258,
259
],
[
258,
260
],
[
260,
261
],
[
261,
262
],
[
262,
263
],
[
263,
264
],
[
262,
265
],
[
265,
266
],
[
266,
267
],
[
266,
268
],
[
268,
269
],
[
268,
270
],
[
261,
271
],
[
271,
272
],
[
272,
273
],
[
260,
274
],
[
274,
275
],
[
275,
276
],
[
175,
277
],
[
277,
278
],
[
277,
279
],
[
279,
280
],
[
280,
281
],
[
281,
282
],
[
282,
283
],
[
280,
284
],
[
284,
285
],
[
285,
286
],
[
279,
287
],
[
287,
288
],
[
287,
289
],
[
279,
290
],
[
290,
291
],
[
290,
292
],
[
292,
293
],
[
279,
294
],
[
294,
295
],
[
295,
296
],
[
295,
297
],
[
294,
298
],
[
298,
299
],
[
299,
300
],
[
300,
301
],
[
299,
302
],
[
298,
303
],
[
303,
304
],
[
303,
305
],
[
305,
306
],
[
279,
307
],
[
307,
308
],
[
308,
309
],
[
309,
310
],
[
175,
311
],
[
311,
312
],
[
311,
313
],
[
313,
314
],
[
314,
315
],
[
315,
316
],
[
316,
317
],
[
314,
318
],
[
318,
319
],
[
319,
320
],
[
313,
321
],
[
321,
322
],
[
321,
323
],
[
313,
324
],
[
324,
325
],
[
324,
326
],
[
313,
327
],
[
327,
328
],
[
327,
329
],
[
329,
330
],
[
313,
331
],
[
331,
332
],
[
332,
333
],
[
332,
334
],
[
331,
335
],
[
335,
336
],
[
336,
337
],
[
336,
338
],
[
335,
339
],
[
339,
340
],
[
339,
341
],
[
341,
342
],
[
313,
343
],
[
343,
344
],
[
344,
345
],
[
345,
346
],
[
345,
347
],
[
344,
348
],
[
348,
349
],
[
348,
350
],
[
343,
351
],
[
351,
352
],
[
352,
353
],
[
313,
354
],
[
354,
355
],
[
354,
356
],
[
356,
357
],
[
357,
358
],
[
358,
359
],
[
359,
360
],
[
359,
361
],
[
358,
362
],
[
362,
363
],
[
362,
364
],
[
357,
365
],
[
365,
366
],
[
366,
367
],
[
366,
368
],
[
365,
369
],
[
369,
370
],
[
369,
371
],
[
371,
372
],
[
371,
373
],
[
357,
374
],
[
374,
375
],
[
375,
376
],
[
376,
377
],
[
376,
378
],
[
378,
379
],
[
375,
380
],
[
380,
381
],
[
381,
382
],
[
381,
383
],
[
374,
384
],
[
384,
385
],
[
385,
386
],
[
386,
387
],
[
386,
388
],
[
388,
389
],
[
386,
390
],
[
374,
391
],
[
391,
392
],
[
392,
393
],
[
356,
394
],
[
394,
395
],
[
394,
396
],
[
396,
397
],
[
175,
398
],
[
398,
399
],
[
398,
400
],
[
400,
401
],
[
401,
402
],
[
401,
403
],
[
403,
404
],
[
400,
405
],
[
405,
406
],
[
406,
407
],
[
407,
408
],
[
407,
409
],
[
409,
410
],
[
409,
411
],
[
406,
412
],
[
412,
413
],
[
412,
414
],
[
414,
415
],
[
414,
416
],
[
405,
417
],
[
417,
418
],
[
418,
419
],
[
400,
420
],
[
420,
421
],
[
175,
422
],
[
422,
423
],
[
422,
424
],
[
424,
425
],
[
425,
426
],
[
426,
427
],
[
427,
428
],
[
426,
429
],
[
429,
430
],
[
0,
431
],
[
431,
432
],
[
431,
433
]
] |
[
"import java.text.DecimalFormat;\nimport java.util.stream.LongStream;\nimport java.util.stream.IntStream;\nimport java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\nimport java.util.List;\nimport java.awt.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AtCoder problem = new AtCoder(sc);\n problem.solve(out);\n\n out.flush();\n }\n\n}\n\nclass AtCoder {\n\n /* 変数宣言 */\n int N;\n long[] A;\n\n AtCoder(FastScanner sc) {\n N = sc.nextInt();\n A = new long[N];\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextLong();\n }\n }\n\n void solve(PrintWriter out) {\n final BigInteger MAX_VALUE = new BigInteger(\"1000000000000000000\");\n BigInteger result = new BigInteger(\"1\");\n Arrays.sort(A);\n\n if (A[0] == 0) {\n out.println(0);\n } else {\n for (int i = 0; i < N; i++) {\n BigInteger b1 = BigInteger.valueOf(A[i]);\n if (result.compareTo(MAX_VALUE) == 1) {\n out.println(-1);\n return;\n } else {\n result = result.multiply(b1);\n }\n }\n if (result.compareTo(MAX_VALUE) == 1) {\n out.println(-1);\n return;\n }\n out.println(result);\n }\n }\n}\n\n// https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4\nclass FastScanner {\n\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n}",
"import java.text.DecimalFormat;",
"DecimalFormat",
"java.text",
"import java.util.stream.LongStream;",
"LongStream",
"java.util.stream",
"import java.util.stream.IntStream;",
"IntStream",
"java.util.stream",
"import java.io.*;",
"io.*",
"java",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.*;",
"util.*",
"java",
"import java.util.List;",
"List",
"java.util",
"import java.awt.*;",
"awt.*",
"java",
"public class Main {\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AtCoder problem = new AtCoder(sc);\n problem.solve(out);\n\n out.flush();\n }\n\n}",
"Main",
"public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AtCoder problem = new AtCoder(sc);\n problem.solve(out);\n\n out.flush();\n }",
"main",
"{\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AtCoder problem = new AtCoder(sc);\n problem.solve(out);\n\n out.flush();\n }",
"FastScanner sc = new FastScanner();",
"sc",
"new FastScanner()",
"PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"AtCoder problem = new AtCoder(sc);",
"problem",
"new AtCoder(sc)",
"problem.solve(out)",
"problem.solve",
"problem",
"out",
"out.flush()",
"out.flush",
"out",
"String[] args",
"args",
"class AtCoder {\n\n /* 変数宣言 */\n int N;\n long[] A;\n\n AtCoder(FastScanner sc) {\n N = sc.nextInt();\n A = new long[N];\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextLong();\n }\n }\n\n void solve(PrintWriter out) {\n final BigInteger MAX_VALUE = new BigInteger(\"1000000000000000000\");\n BigInteger result = new BigInteger(\"1\");\n Arrays.sort(A);\n\n if (A[0] == 0) {\n out.println(0);\n } else {\n for (int i = 0; i < N; i++) {\n BigInteger b1 = BigInteger.valueOf(A[i]);\n if (result.compareTo(MAX_VALUE) == 1) {\n out.println(-1);\n return;\n } else {\n result = result.multiply(b1);\n }\n }\n if (result.compareTo(MAX_VALUE) == 1) {\n out.println(-1);\n return;\n }\n out.println(result);\n }\n }\n}",
"AtCoder",
"/* 変数宣言 */\n int N;",
"N",
"long[] A;",
"A",
"AtCoder(FastScanner sc) {\n N = sc.nextInt();\n A = new long[N];\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextLong();\n }\n }",
"AtCoder",
"{\n N = sc.nextInt();\n A = new long[N];\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextLong();\n }\n }",
"N = sc.nextInt()",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"A = new long[N]",
"A",
"new long[N]",
"N",
"for (int i = 0; i < N; i++) {\n A[i] = sc.nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i] = sc.nextLong();\n }",
"{\n A[i] = sc.nextLong();\n }",
"A[i] = sc.nextLong()",
"A[i]",
"A",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"FastScanner sc",
"sc",
"void solve(PrintWriter out) {\n final BigInteger MAX_VALUE = new BigInteger(\"1000000000000000000\");\n BigInteger result = new BigInteger(\"1\");\n Arrays.sort(A);\n\n if (A[0] == 0) {\n out.println(0);\n } else {\n for (int i = 0; i < N; i++) {\n BigInteger b1 = BigInteger.valueOf(A[i]);\n if (result.compareTo(MAX_VALUE) == 1) {\n out.println(-1);\n return;\n } else {\n result = result.multiply(b1);\n }\n }\n if (result.compareTo(MAX_VALUE) == 1) {\n out.println(-1);\n return;\n }\n out.println(result);\n }\n }",
"solve",
"{\n final BigInteger MAX_VALUE = new BigInteger(\"1000000000000000000\");\n BigInteger result = new BigInteger(\"1\");\n Arrays.sort(A);\n\n if (A[0] == 0) {\n out.println(0);\n } else {\n for (int i = 0; i < N; i++) {\n BigInteger b1 = BigInteger.valueOf(A[i]);\n if (result.compareTo(MAX_VALUE) == 1) {\n out.println(-1);\n return;\n } else {\n result = result.multiply(b1);\n }\n }\n if (result.compareTo(MAX_VALUE) == 1) {\n out.println(-1);\n return;\n }\n out.println(result);\n }\n }",
"final BigInteger MAX_VALUE = new BigInteger(\"1000000000000000000\");",
"MAX_VALUE",
"new BigInteger(\"1000000000000000000\")",
"BigInteger result = new BigInteger(\"1\");",
"result",
"new BigInteger(\"1\")",
"Arrays.sort(A)",
"Arrays.sort",
"Arrays",
"A",
"if (A[0] == 0) {\n out.println(0);\n } else {\n for (int i = 0; i < N; i++) {\n BigInteger b1 = BigInteger.valueOf(A[i]);\n if (result.compareTo(MAX_VALUE) == 1) {\n out.println(-1);\n return;\n } else {\n result = result.multiply(b1);\n }\n }\n if (result.compareTo(MAX_VALUE) == 1) {\n out.println(-1);\n return;\n }\n out.println(result);\n }",
"A[0] == 0",
"A[0]",
"A",
"0",
"0",
"{\n out.println(0);\n }",
"out.println(0)",
"out.println",
"out",
"0",
"{\n for (int i = 0; i < N; i++) {\n BigInteger b1 = BigInteger.valueOf(A[i]);\n if (result.compareTo(MAX_VALUE) == 1) {\n out.println(-1);\n return;\n } else {\n result = result.multiply(b1);\n }\n }\n if (result.compareTo(MAX_VALUE) == 1) {\n out.println(-1);\n return;\n }\n out.println(result);\n }",
"for (int i = 0; i < N; i++) {\n BigInteger b1 = BigInteger.valueOf(A[i]);\n if (result.compareTo(MAX_VALUE) == 1) {\n out.println(-1);\n return;\n } else {\n result = result.multiply(b1);\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n BigInteger b1 = BigInteger.valueOf(A[i]);\n if (result.compareTo(MAX_VALUE) == 1) {\n out.println(-1);\n return;\n } else {\n result = result.multiply(b1);\n }\n }",
"{\n BigInteger b1 = BigInteger.valueOf(A[i]);\n if (result.compareTo(MAX_VALUE) == 1) {\n out.println(-1);\n return;\n } else {\n result = result.multiply(b1);\n }\n }",
"BigInteger b1 = BigInteger.valueOf(A[i]);",
"b1",
"BigInteger.valueOf(A[i])",
"BigInteger.valueOf",
"BigInteger",
"A[i]",
"A",
"i",
"if (result.compareTo(MAX_VALUE) == 1) {\n out.println(-1);\n return;\n } else {\n result = result.multiply(b1);\n }",
"result.compareTo(MAX_VALUE) == 1",
"result.compareTo(MAX_VALUE)",
"result.compareTo",
"result",
"MAX_VALUE",
"1",
"{\n out.println(-1);\n return;\n }",
"out.println(-1)",
"out.println",
"out",
"-1",
"1",
"return;",
"{\n result = result.multiply(b1);\n }",
"result = result.multiply(b1)",
"result",
"result.multiply(b1)",
"result.multiply",
"result",
"b1",
"if (result.compareTo(MAX_VALUE) == 1) {\n out.println(-1);\n return;\n }",
"result.compareTo(MAX_VALUE) == 1",
"result.compareTo(MAX_VALUE)",
"result.compareTo",
"result",
"MAX_VALUE",
"1",
"{\n out.println(-1);\n return;\n }",
"out.println(-1)",
"out.println",
"out",
"-1",
"1",
"return;",
"out.println(result)",
"out.println",
"out",
"result",
"PrintWriter out",
"out",
"class FastScanner {\n\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\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 if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }",
"hasNextByte",
"{\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }",
"if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }",
"ptr < buflen",
"ptr",
"buflen",
"{\n return true;\n }",
"return true;",
"true",
"{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }",
"ptr = 0",
"ptr",
"0",
"try {\n buflen = in.read(buffer);\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 buflen = in.read(buffer);\n }",
"buflen = in.read(buffer)",
"buflen",
"in.read(buffer)",
"in.read",
"in",
"buffer",
"if (buflen <= 0) {\n return false;\n }",
"buflen <= 0",
"buflen",
"0",
"{\n return false;\n }",
"return false;",
"false",
"return true;",
"true",
"private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }",
"readByte",
"{\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }",
"if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }",
"hasNextByte()",
"hasNextByte",
"{\n return buffer[ptr++];\n }",
"return buffer[ptr++];",
"buffer[ptr++]",
"buffer",
"ptr++",
"ptr",
"{\n return -1;\n }",
"return -1;",
"-1",
"1",
"private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }",
"isPrintableChar",
"{\n return 33 <= c && c <= 126;\n }",
"return 33 <= c && c <= 126;",
"33 <= c && c <= 126",
"33 <= c",
"33",
"c",
"c <= 126",
"c",
"126",
"int c",
"c",
"public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }",
"hasNext",
"{\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }",
"while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }",
"hasNextByte() && !isPrintableChar(buffer[ptr])",
"hasNextByte()",
"hasNextByte",
"!isPrintableChar(buffer[ptr])",
"isPrintableChar(buffer[ptr])",
"isPrintableChar",
"buffer[ptr]",
"buffer",
"ptr",
"{\n ptr++;\n }",
"ptr++",
"ptr",
"return hasNextByte();",
"hasNextByte()",
"hasNextByte",
"public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }",
"next",
"{\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }",
"if (!hasNext()) {\n throw new NoSuchElementException();\n }",
"!hasNext()",
"hasNext()",
"hasNext",
"{\n throw new NoSuchElementException();\n }",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n sb.appendCodePoint(b);\n b = readByte();\n }",
"sb.appendCodePoint(b)",
"sb.appendCodePoint",
"sb",
"b",
"b = readByte()",
"b",
"readByte()",
"readByte",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }",
"nextLong",
"{\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }",
"if (!hasNext()) {\n throw new NoSuchElementException();\n }",
"!hasNext()",
"hasNext()",
"hasNext",
"{\n throw new NoSuchElementException();\n }",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"long n = 0;",
"n",
"0",
"boolean minus = false;",
"minus",
"false",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"if (b == '-') {\n minus = true;\n b = readByte();\n }",
"b == '-'",
"b",
"'-'",
"{\n minus = true;\n b = readByte();\n }",
"minus = true",
"minus",
"true",
"b = readByte()",
"b",
"readByte()",
"readByte",
"if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }",
"b < '0' || '9' < b",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"{\n throw new NumberFormatException();\n }",
"throw new NumberFormatException();",
"new NumberFormatException()",
"while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }",
"true",
"{\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }",
"if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }",
"'0' <= b && b <= '9'",
"'0' <= b",
"'0'",
"b",
"b <= '9'",
"b",
"'9'",
"{\n n *= 10;\n n += b - '0';\n }",
"n *= 10",
"n",
"10",
"n += b - '0'",
"n",
"b - '0'",
"b",
"'0'",
"if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }",
"b == -1 || !isPrintableChar(b)",
"b == -1",
"b",
"-1",
"1",
"!isPrintableChar(b)",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n return minus ? -n : n;\n }",
"return minus ? -n : n;",
"minus ? -n : n",
"minus",
"-n",
"n",
"n",
"{\n throw new NumberFormatException();\n }",
"throw new NumberFormatException();",
"new NumberFormatException()",
"b = readByte()",
"b",
"readByte()",
"readByte",
"public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }",
"nextInt",
"{\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }",
"long nl = nextLong();",
"nl",
"nextLong()",
"nextLong",
"if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }",
"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",
"{\n throw new NumberFormatException();\n }",
"throw new NumberFormatException();",
"new NumberFormatException()",
"return (int) nl;",
"(int) nl",
"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 class Main {\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AtCoder problem = new AtCoder(sc);\n problem.solve(out);\n\n out.flush();\n }\n\n}",
"public class Main {\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AtCoder problem = new AtCoder(sc);\n problem.solve(out);\n\n out.flush();\n }\n\n}",
"Main"
] |
import java.text.DecimalFormat;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.List;
import java.awt.*;
public class Main {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
AtCoder problem = new AtCoder(sc);
problem.solve(out);
out.flush();
}
}
class AtCoder {
/* 変数宣言 */
int N;
long[] A;
AtCoder(FastScanner sc) {
N = sc.nextInt();
A = new long[N];
for (int i = 0; i < N; i++) {
A[i] = sc.nextLong();
}
}
void solve(PrintWriter out) {
final BigInteger MAX_VALUE = new BigInteger("1000000000000000000");
BigInteger result = new BigInteger("1");
Arrays.sort(A);
if (A[0] == 0) {
out.println(0);
} else {
for (int i = 0; i < N; i++) {
BigInteger b1 = BigInteger.valueOf(A[i]);
if (result.compareTo(MAX_VALUE) == 1) {
out.println(-1);
return;
} else {
result = result.multiply(b1);
}
}
if (result.compareTo(MAX_VALUE) == 1) {
out.println(-1);
return;
}
out.println(result);
}
}
}
// https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4
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,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
18,
13,
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,
14,
4,
18,
13,
18,
13,
13,
30,
0,
13,
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
],
[
22,
23
],
[
22,
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
],
[
83,
86
],
[
86,
87
],
[
86,
88
],
[
82,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
93,
94
],
[
92,
95
],
[
11,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
9,
102
],
[
102,
103
]
] |
[
"import java.util.*;\nimport java.math.BigInteger;\n\nclass 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 bi = BigInteger.ONE;\n\t\tfor(int i=0; i<N; i++){\n\t\t\tBigInteger next = sc.nextBigInteger();\n\t\t\tif(!bi.equals(BigInteger.valueOf(-1))){\n\t\t\t\tif(bi.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0){\n\t\t\t\t\tbi = BigInteger.valueOf(-1);\n\t\t\t\t}else{\n\t\t\t\t\tbi = bi.multiply(next);\n\t\t\t\t}\n\t\t\t}else if(next.equals(BigInteger.ZERO)){\n\t\t\t\tbi = BigInteger.valueOf(0);\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(bi);\n\t}\n}\n",
"import java.util.*;",
"util.*",
"java",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"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 bi = BigInteger.ONE;\n\t\tfor(int i=0; i<N; i++){\n\t\t\tBigInteger next = sc.nextBigInteger();\n\t\t\tif(!bi.equals(BigInteger.valueOf(-1))){\n\t\t\t\tif(bi.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0){\n\t\t\t\t\tbi = BigInteger.valueOf(-1);\n\t\t\t\t}else{\n\t\t\t\t\tbi = bi.multiply(next);\n\t\t\t\t}\n\t\t\t}else if(next.equals(BigInteger.ZERO)){\n\t\t\t\tbi = BigInteger.valueOf(0);\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(bi);\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 bi = BigInteger.ONE;\n\t\tfor(int i=0; i<N; i++){\n\t\t\tBigInteger next = sc.nextBigInteger();\n\t\t\tif(!bi.equals(BigInteger.valueOf(-1))){\n\t\t\t\tif(bi.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0){\n\t\t\t\t\tbi = BigInteger.valueOf(-1);\n\t\t\t\t}else{\n\t\t\t\t\tbi = bi.multiply(next);\n\t\t\t\t}\n\t\t\t}else if(next.equals(BigInteger.ZERO)){\n\t\t\t\tbi = BigInteger.valueOf(0);\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(bi);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tBigInteger bi = BigInteger.ONE;\n\t\tfor(int i=0; i<N; i++){\n\t\t\tBigInteger next = sc.nextBigInteger();\n\t\t\tif(!bi.equals(BigInteger.valueOf(-1))){\n\t\t\t\tif(bi.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0){\n\t\t\t\t\tbi = BigInteger.valueOf(-1);\n\t\t\t\t}else{\n\t\t\t\t\tbi = bi.multiply(next);\n\t\t\t\t}\n\t\t\t}else if(next.equals(BigInteger.ZERO)){\n\t\t\t\tbi = BigInteger.valueOf(0);\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(bi);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BigInteger bi = BigInteger.ONE;",
"bi",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"for(int i=0; i<N; i++){\n\t\t\tBigInteger next = sc.nextBigInteger();\n\t\t\tif(!bi.equals(BigInteger.valueOf(-1))){\n\t\t\t\tif(bi.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0){\n\t\t\t\t\tbi = BigInteger.valueOf(-1);\n\t\t\t\t}else{\n\t\t\t\t\tbi = bi.multiply(next);\n\t\t\t\t}\n\t\t\t}else if(next.equals(BigInteger.ZERO)){\n\t\t\t\tbi = BigInteger.valueOf(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\tBigInteger next = sc.nextBigInteger();\n\t\t\tif(!bi.equals(BigInteger.valueOf(-1))){\n\t\t\t\tif(bi.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0){\n\t\t\t\t\tbi = BigInteger.valueOf(-1);\n\t\t\t\t}else{\n\t\t\t\t\tbi = bi.multiply(next);\n\t\t\t\t}\n\t\t\t}else if(next.equals(BigInteger.ZERO)){\n\t\t\t\tbi = BigInteger.valueOf(0);\n\t\t\t}\n\t\t}",
"{\n\t\t\tBigInteger next = sc.nextBigInteger();\n\t\t\tif(!bi.equals(BigInteger.valueOf(-1))){\n\t\t\t\tif(bi.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0){\n\t\t\t\t\tbi = BigInteger.valueOf(-1);\n\t\t\t\t}else{\n\t\t\t\t\tbi = bi.multiply(next);\n\t\t\t\t}\n\t\t\t}else if(next.equals(BigInteger.ZERO)){\n\t\t\t\tbi = BigInteger.valueOf(0);\n\t\t\t}\n\t\t}",
"BigInteger next = sc.nextBigInteger();",
"next",
"sc.nextBigInteger()",
"sc.nextBigInteger",
"sc",
"if(!bi.equals(BigInteger.valueOf(-1))){\n\t\t\t\tif(bi.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0){\n\t\t\t\t\tbi = BigInteger.valueOf(-1);\n\t\t\t\t}else{\n\t\t\t\t\tbi = bi.multiply(next);\n\t\t\t\t}\n\t\t\t}else if(next.equals(BigInteger.ZERO)){\n\t\t\t\tbi = BigInteger.valueOf(0);\n\t\t\t}",
"!bi.equals(BigInteger.valueOf(-1))",
"bi.equals(BigInteger.valueOf(-1))",
"bi.equals",
"bi",
"BigInteger.valueOf(-1)",
"BigInteger.valueOf",
"BigInteger",
"-1",
"1",
"{\n\t\t\t\tif(bi.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0){\n\t\t\t\t\tbi = BigInteger.valueOf(-1);\n\t\t\t\t}else{\n\t\t\t\t\tbi = bi.multiply(next);\n\t\t\t\t}\n\t\t\t}",
"if(bi.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0){\n\t\t\t\t\tbi = BigInteger.valueOf(-1);\n\t\t\t\t}else{\n\t\t\t\t\tbi = bi.multiply(next);\n\t\t\t\t}",
"bi.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0",
"bi.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L))",
"bi.multiply(next).compareTo",
"bi.multiply(next)",
"bi.multiply",
"bi",
"next",
"BigInteger.valueOf(1000000000000000000L)",
"BigInteger.valueOf",
"BigInteger",
"1000000000000000000L",
"0",
"{\n\t\t\t\t\tbi = BigInteger.valueOf(-1);\n\t\t\t\t}",
"bi = BigInteger.valueOf(-1)",
"bi",
"BigInteger.valueOf(-1)",
"BigInteger.valueOf",
"BigInteger",
"-1",
"1",
"{\n\t\t\t\t\tbi = bi.multiply(next);\n\t\t\t\t}",
"bi = bi.multiply(next)",
"bi",
"bi.multiply(next)",
"bi.multiply",
"bi",
"next",
"if(next.equals(BigInteger.ZERO)){\n\t\t\t\tbi = BigInteger.valueOf(0);\n\t\t\t}",
"next.equals(BigInteger.ZERO)",
"next.equals",
"next",
"BigInteger.ZERO",
"BigInteger",
"BigInteger.ZERO",
"{\n\t\t\t\tbi = BigInteger.valueOf(0);\n\t\t\t}",
"bi = BigInteger.valueOf(0)",
"bi",
"BigInteger.valueOf(0)",
"BigInteger.valueOf",
"BigInteger",
"0",
"System.out.print(bi)",
"System.out.print",
"System.out",
"System",
"System.out",
"bi",
"String[] args",
"args"
] |
import java.util.*;
import java.math.BigInteger;
class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
BigInteger bi = BigInteger.ONE;
for(int i=0; i<N; i++){
BigInteger next = sc.nextBigInteger();
if(!bi.equals(BigInteger.valueOf(-1))){
if(bi.multiply(next).compareTo(BigInteger.valueOf(1000000000000000000L)) > 0){
bi = BigInteger.valueOf(-1);
}else{
bi = bi.multiply(next);
}
}else if(next.equals(BigInteger.ZERO)){
bi = BigInteger.valueOf(0);
}
}
System.out.print(bi);
}
}
|
[
7,
15,
13,
17,
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,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
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,
18,
13,
13,
17,
30,
4,
18,
13,
17,
29,
41,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
4,
18,
13,
18,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
4,
18,
13,
40,
17,
29,
4,
18,
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
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
143,
14
],
[
143,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
20,
22
],
[
18,
23
],
[
23,
24
],
[
23,
25
],
[
15,
26
],
[
26,
27
],
[
143,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
30,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
37,
38
],
[
36,
39
],
[
39,
40
],
[
40,
41
],
[
30,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
46,
49
],
[
44,
50
],
[
30,
51
],
[
51,
52
],
[
51,
53
],
[
30,
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
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
73,
74
],
[
72,
75
],
[
75,
76
],
[
76,
77
],
[
67,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
78,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
84,
89
],
[
30,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
93,
94
],
[
92,
95
],
[
30,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
101,
102
],
[
101,
103
],
[
96,
104
],
[
104,
105
],
[
105,
106
],
[
96,
107
],
[
108,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
114,
115
],
[
115,
116
],
[
114,
117
],
[
117,
118
],
[
117,
119
],
[
108,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
122,
125
],
[
121,
126
],
[
120,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
128,
131
],
[
131,
132
],
[
127,
133
],
[
30,
134
],
[
134,
135
],
[
135,
136
],
[
134,
137
],
[
28,
138
],
[
138,
139
],
[
28,
140
],
[
140,
141
],
[
0,
142
],
[
142,
143
],
[
142,
144
]
] |
[
"import java.io.InputStream;\nimport java.io.PrintStream;\nimport java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n resolve(System.in, System.out);\n }\n\n static void resolve(InputStream is, PrintStream pw) {\n Scanner sc = new Scanner(is);\n int n = Integer.parseInt(sc.next());\n BigInteger border = BigInteger.valueOf(10).pow(18);\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 pw.println(0);\n return;\n }\n }\n BigInteger ans = BigInteger.valueOf(1);\n for (int i = 0; i < n; i++) {\n ans = ans.multiply(BigInteger.valueOf(a[i]));\n if (ans.compareTo(border) > 0) {\n pw.println(-1);\n return;\n }\n }\n pw.println(ans);\n }\n}",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.PrintStream;",
"PrintStream",
"java.io",
"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 resolve(System.in, System.out);\n }\n\n static void resolve(InputStream is, PrintStream pw) {\n Scanner sc = new Scanner(is);\n int n = Integer.parseInt(sc.next());\n BigInteger border = BigInteger.valueOf(10).pow(18);\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 pw.println(0);\n return;\n }\n }\n BigInteger ans = BigInteger.valueOf(1);\n for (int i = 0; i < n; i++) {\n ans = ans.multiply(BigInteger.valueOf(a[i]));\n if (ans.compareTo(border) > 0) {\n pw.println(-1);\n return;\n }\n }\n pw.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) {\n resolve(System.in, System.out);\n }",
"main",
"{\n resolve(System.in, System.out);\n }",
"resolve(System.in, System.out)",
"resolve",
"System.in",
"System",
"System.in",
"System.out",
"System",
"System.out",
"String[] args",
"args",
"static void resolve(InputStream is, PrintStream pw) {\n Scanner sc = new Scanner(is);\n int n = Integer.parseInt(sc.next());\n BigInteger border = BigInteger.valueOf(10).pow(18);\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 pw.println(0);\n return;\n }\n }\n BigInteger ans = BigInteger.valueOf(1);\n for (int i = 0; i < n; i++) {\n ans = ans.multiply(BigInteger.valueOf(a[i]));\n if (ans.compareTo(border) > 0) {\n pw.println(-1);\n return;\n }\n }\n pw.println(ans);\n }",
"resolve",
"{\n Scanner sc = new Scanner(is);\n int n = Integer.parseInt(sc.next());\n BigInteger border = BigInteger.valueOf(10).pow(18);\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 pw.println(0);\n return;\n }\n }\n BigInteger ans = BigInteger.valueOf(1);\n for (int i = 0; i < n; i++) {\n ans = ans.multiply(BigInteger.valueOf(a[i]));\n if (ans.compareTo(border) > 0) {\n pw.println(-1);\n return;\n }\n }\n pw.println(ans);\n }",
"Scanner sc = new Scanner(is);",
"sc",
"new Scanner(is)",
"int n = Integer.parseInt(sc.next());",
"n",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"BigInteger border = BigInteger.valueOf(10).pow(18);",
"border",
"BigInteger.valueOf(10).pow(18)",
"BigInteger.valueOf(10).pow",
"BigInteger.valueOf(10)",
"BigInteger.valueOf",
"BigInteger",
"10",
"18",
"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 pw.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 pw.println(0);\n return;\n }\n }",
"{\n a[i] = Long.parseLong(sc.next());\n if (a[i] == 0) {\n pw.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 pw.println(0);\n return;\n }",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"{\n pw.println(0);\n return;\n }",
"pw.println(0)",
"pw.println",
"pw",
"0",
"return;",
"BigInteger ans = BigInteger.valueOf(1);",
"ans",
"BigInteger.valueOf(1)",
"BigInteger.valueOf",
"BigInteger",
"1",
"for (int i = 0; i < n; i++) {\n ans = ans.multiply(BigInteger.valueOf(a[i]));\n if (ans.compareTo(border) > 0) {\n pw.println(-1);\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n ans = ans.multiply(BigInteger.valueOf(a[i]));\n if (ans.compareTo(border) > 0) {\n pw.println(-1);\n return;\n }\n }",
"{\n ans = ans.multiply(BigInteger.valueOf(a[i]));\n if (ans.compareTo(border) > 0) {\n pw.println(-1);\n return;\n }\n }",
"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(border) > 0) {\n pw.println(-1);\n return;\n }",
"ans.compareTo(border) > 0",
"ans.compareTo(border)",
"ans.compareTo",
"ans",
"border",
"0",
"{\n pw.println(-1);\n return;\n }",
"pw.println(-1)",
"pw.println",
"pw",
"-1",
"1",
"return;",
"pw.println(ans)",
"pw.println",
"pw",
"ans",
"InputStream is",
"is",
"PrintStream pw",
"pw",
"public class Main {\n\n public static void main(String[] args) {\n resolve(System.in, System.out);\n }\n\n static void resolve(InputStream is, PrintStream pw) {\n Scanner sc = new Scanner(is);\n int n = Integer.parseInt(sc.next());\n BigInteger border = BigInteger.valueOf(10).pow(18);\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 pw.println(0);\n return;\n }\n }\n BigInteger ans = BigInteger.valueOf(1);\n for (int i = 0; i < n; i++) {\n ans = ans.multiply(BigInteger.valueOf(a[i]));\n if (ans.compareTo(border) > 0) {\n pw.println(-1);\n return;\n }\n }\n pw.println(ans);\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n resolve(System.in, System.out);\n }\n\n static void resolve(InputStream is, PrintStream pw) {\n Scanner sc = new Scanner(is);\n int n = Integer.parseInt(sc.next());\n BigInteger border = BigInteger.valueOf(10).pow(18);\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 pw.println(0);\n return;\n }\n }\n BigInteger ans = BigInteger.valueOf(1);\n for (int i = 0; i < n; i++) {\n ans = ans.multiply(BigInteger.valueOf(a[i]));\n if (ans.compareTo(border) > 0) {\n pw.println(-1);\n return;\n }\n }\n pw.println(ans);\n }\n}",
"Main"
] |
import java.io.InputStream;
import java.io.PrintStream;
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
resolve(System.in, System.out);
}
static void resolve(InputStream is, PrintStream pw) {
Scanner sc = new Scanner(is);
int n = Integer.parseInt(sc.next());
BigInteger border = BigInteger.valueOf(10).pow(18);
long a[] = new long[n];
for (int i = 0; i < n; i++) {
a[i] = Long.parseLong(sc.next());
if (a[i] == 0) {
pw.println(0);
return;
}
}
BigInteger ans = BigInteger.valueOf(1);
for (int i = 0; i < n; i++) {
ans = ans.multiply(BigInteger.valueOf(a[i]));
if (ans.compareTo(border) > 0) {
pw.println(-1);
return;
}
}
pw.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
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,
4,
18,
13,
4,
18,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
17,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
13,
17,
28,
13,
13,
30,
30,
0,
13,
13,
14,
2,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
4,
18,
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
],
[
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,
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
],
[
37,
38
],
[
36,
39
],
[
39,
40
],
[
40,
41
],
[
8,
42
],
[
42,
43
],
[
43,
44
],
[
42,
45
],
[
8,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
48,
51
],
[
47,
52
],
[
46,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
53,
60
],
[
60,
61
],
[
61,
62
],
[
60,
63
],
[
8,
64
],
[
64,
65
],
[
64,
66
],
[
64,
67
],
[
68,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
82,
83
],
[
76,
84
],
[
84,
85
],
[
85,
86
],
[
84,
87
],
[
8,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
98,
99
],
[
88,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
6,
107
],
[
107,
108
],
[
0,
109
],
[
109,
110
],
[
109,
111
]
] |
[
"\n\nimport java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\n\t\tlong num = s.nextLong();\n\t\tlong mul = 1;\n\t\tArrayList<Long> inputs = new ArrayList<>();\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tinputs.add(s.nextLong());\n\t\t}\n\t\t\n\t\tCollections.sort(inputs);\n\t\t\t\t\t\n\t\tif (inputs.get(0) == 0) {\n\t\t\t System.out.println(0);\n\t\t\t System.exit(0);\n\t\t\n\t\t}\n\t\t\n\t\tfor(long l:inputs) {\n\t\t\t\n\t\t\tmul *= l;\n\t\t\t\n if (mul < l) {\n \t\t\tSystem.out.println(-1);\n \t\t\tSystem.exit(0);\n }\t\n\t\t}\n\t\t\n\n\t\tif (mul > 1000000000000000000L) {\n\t\t\tSystem.out.println(-1);\n\t\t}\n\n\t\telse {\n\t\t\tSystem.out.println(mul);\n\t\t}\n\t\t\n\n\t}\n\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\n\t\tlong num = s.nextLong();\n\t\tlong mul = 1;\n\t\tArrayList<Long> inputs = new ArrayList<>();\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tinputs.add(s.nextLong());\n\t\t}\n\t\t\n\t\tCollections.sort(inputs);\n\t\t\t\t\t\n\t\tif (inputs.get(0) == 0) {\n\t\t\t System.out.println(0);\n\t\t\t System.exit(0);\n\t\t\n\t\t}\n\t\t\n\t\tfor(long l:inputs) {\n\t\t\t\n\t\t\tmul *= l;\n\t\t\t\n if (mul < l) {\n \t\t\tSystem.out.println(-1);\n \t\t\tSystem.exit(0);\n }\t\n\t\t}\n\t\t\n\n\t\tif (mul > 1000000000000000000L) {\n\t\t\tSystem.out.println(-1);\n\t\t}\n\n\t\telse {\n\t\t\tSystem.out.println(mul);\n\t\t}\n\t\t\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\n\t\tlong num = s.nextLong();\n\t\tlong mul = 1;\n\t\tArrayList<Long> inputs = new ArrayList<>();\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tinputs.add(s.nextLong());\n\t\t}\n\t\t\n\t\tCollections.sort(inputs);\n\t\t\t\t\t\n\t\tif (inputs.get(0) == 0) {\n\t\t\t System.out.println(0);\n\t\t\t System.exit(0);\n\t\t\n\t\t}\n\t\t\n\t\tfor(long l:inputs) {\n\t\t\t\n\t\t\tmul *= l;\n\t\t\t\n if (mul < l) {\n \t\t\tSystem.out.println(-1);\n \t\t\tSystem.exit(0);\n }\t\n\t\t}\n\t\t\n\n\t\tif (mul > 1000000000000000000L) {\n\t\t\tSystem.out.println(-1);\n\t\t}\n\n\t\telse {\n\t\t\tSystem.out.println(mul);\n\t\t}\n\t\t\n\n\t}",
"main",
"{\n\t\tScanner s = new Scanner(System.in);\n\n\t\tlong num = s.nextLong();\n\t\tlong mul = 1;\n\t\tArrayList<Long> inputs = new ArrayList<>();\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tinputs.add(s.nextLong());\n\t\t}\n\t\t\n\t\tCollections.sort(inputs);\n\t\t\t\t\t\n\t\tif (inputs.get(0) == 0) {\n\t\t\t System.out.println(0);\n\t\t\t System.exit(0);\n\t\t\n\t\t}\n\t\t\n\t\tfor(long l:inputs) {\n\t\t\t\n\t\t\tmul *= l;\n\t\t\t\n if (mul < l) {\n \t\t\tSystem.out.println(-1);\n \t\t\tSystem.exit(0);\n }\t\n\t\t}\n\t\t\n\n\t\tif (mul > 1000000000000000000L) {\n\t\t\tSystem.out.println(-1);\n\t\t}\n\n\t\telse {\n\t\t\tSystem.out.println(mul);\n\t\t}\n\t\t\n\n\t}",
"Scanner s = new Scanner(System.in);",
"s",
"new Scanner(System.in)",
"long num = s.nextLong();",
"num",
"s.nextLong()",
"s.nextLong",
"s",
"long mul = 1;",
"mul",
"1",
"ArrayList<Long> inputs = new ArrayList<>();",
"inputs",
"new ArrayList<>()",
"for (int i = 0; i < num; i++) {\n\t\t\tinputs.add(s.nextLong());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num",
"i",
"num",
"i++",
"i++",
"i",
"{\n\t\t\tinputs.add(s.nextLong());\n\t\t}",
"{\n\t\t\tinputs.add(s.nextLong());\n\t\t}",
"inputs.add(s.nextLong())",
"inputs.add",
"inputs",
"s.nextLong()",
"s.nextLong",
"s",
"Collections.sort(inputs)",
"Collections.sort",
"Collections",
"inputs",
"if (inputs.get(0) == 0) {\n\t\t\t System.out.println(0);\n\t\t\t System.exit(0);\n\t\t\n\t\t}",
"inputs.get(0) == 0",
"inputs.get(0)",
"inputs.get",
"inputs",
"0",
"0",
"{\n\t\t\t System.out.println(0);\n\t\t\t System.exit(0);\n\t\t\n\t\t}",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"System.exit(0)",
"System.exit",
"System",
"0",
"for(long l:inputs) {\n\t\t\t\n\t\t\tmul *= l;\n\t\t\t\n if (mul < l) {\n \t\t\tSystem.out.println(-1);\n \t\t\tSystem.exit(0);\n }\t\n\t\t}",
"long l",
"inputs",
"{\n\t\t\t\n\t\t\tmul *= l;\n\t\t\t\n if (mul < l) {\n \t\t\tSystem.out.println(-1);\n \t\t\tSystem.exit(0);\n }\t\n\t\t}",
"{\n\t\t\t\n\t\t\tmul *= l;\n\t\t\t\n if (mul < l) {\n \t\t\tSystem.out.println(-1);\n \t\t\tSystem.exit(0);\n }\t\n\t\t}",
"mul *= l",
"mul",
"l",
"if (mul < l) {\n \t\t\tSystem.out.println(-1);\n \t\t\tSystem.exit(0);\n }",
"mul < l",
"mul",
"l",
"{\n \t\t\tSystem.out.println(-1);\n \t\t\tSystem.exit(0);\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"System.exit(0)",
"System.exit",
"System",
"0",
"if (mul > 1000000000000000000L) {\n\t\t\tSystem.out.println(-1);\n\t\t}\n\n\t\telse {\n\t\t\tSystem.out.println(mul);\n\t\t}",
"mul > 1000000000000000000L",
"mul",
"1000000000000000000L",
"{\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(mul);\n\t\t}",
"System.out.println(mul)",
"System.out.println",
"System.out",
"System",
"System.out",
"mul",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\n\t\tlong num = s.nextLong();\n\t\tlong mul = 1;\n\t\tArrayList<Long> inputs = new ArrayList<>();\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tinputs.add(s.nextLong());\n\t\t}\n\t\t\n\t\tCollections.sort(inputs);\n\t\t\t\t\t\n\t\tif (inputs.get(0) == 0) {\n\t\t\t System.out.println(0);\n\t\t\t System.exit(0);\n\t\t\n\t\t}\n\t\t\n\t\tfor(long l:inputs) {\n\t\t\t\n\t\t\tmul *= l;\n\t\t\t\n if (mul < l) {\n \t\t\tSystem.out.println(-1);\n \t\t\tSystem.exit(0);\n }\t\n\t\t}\n\t\t\n\n\t\tif (mul > 1000000000000000000L) {\n\t\t\tSystem.out.println(-1);\n\t\t}\n\n\t\telse {\n\t\t\tSystem.out.println(mul);\n\t\t}\n\t\t\n\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\n\t\tlong num = s.nextLong();\n\t\tlong mul = 1;\n\t\tArrayList<Long> inputs = new ArrayList<>();\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tinputs.add(s.nextLong());\n\t\t}\n\t\t\n\t\tCollections.sort(inputs);\n\t\t\t\t\t\n\t\tif (inputs.get(0) == 0) {\n\t\t\t System.out.println(0);\n\t\t\t System.exit(0);\n\t\t\n\t\t}\n\t\t\n\t\tfor(long l:inputs) {\n\t\t\t\n\t\t\tmul *= l;\n\t\t\t\n if (mul < l) {\n \t\t\tSystem.out.println(-1);\n \t\t\tSystem.exit(0);\n }\t\n\t\t}\n\t\t\n\n\t\tif (mul > 1000000000000000000L) {\n\t\t\tSystem.out.println(-1);\n\t\t}\n\n\t\telse {\n\t\t\tSystem.out.println(mul);\n\t\t}\n\t\t\n\n\t}\n\n}",
"Main"
] |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
long num = s.nextLong();
long mul = 1;
ArrayList<Long> inputs = new ArrayList<>();
for (int i = 0; i < num; i++) {
inputs.add(s.nextLong());
}
Collections.sort(inputs);
if (inputs.get(0) == 0) {
System.out.println(0);
System.exit(0);
}
for(long l:inputs) {
mul *= l;
if (mul < l) {
System.out.println(-1);
System.exit(0);
}
}
if (mul > 1000000000000000000L) {
System.out.println(-1);
}
else {
System.out.println(mul);
}
}
}
|
[
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,
41,
13,
17,
41,
13,
4,
18,
13,
17,
17,
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,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
103,
5
],
[
103,
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
],
[
41,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
46,
49
],
[
46,
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
],
[
6,
100
],
[
100,
101
],
[
0,
102
],
[
102,
103
],
[
102,
104
]
] |
[
"import java.util.*;\npublic class Main{\n\tpublic static void main(String[] args){\n \tScanner sc = new Scanner(System.in);\n \tint N = sc.nextInt();\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\tlong sum = 1L;\n\t\tlong max = (long)Math.pow(10, 18);\n\t\tfor(int i = 0; i < N; i ++){\n\t\t\tif(A[i] == 0){\n\t\t\t\tsum = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(A[i] > max / sum){\n\t\t\t\tsum = -1;\n\t\t\t}else{\n\t\t\tsum *= A[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n\tpublic static void main(String[] args){\n \tScanner sc = new Scanner(System.in);\n \tint N = sc.nextInt();\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\tlong sum = 1L;\n\t\tlong max = (long)Math.pow(10, 18);\n\t\tfor(int i = 0; i < N; i ++){\n\t\t\tif(A[i] == 0){\n\t\t\t\tsum = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(A[i] > max / sum){\n\t\t\t\tsum = -1;\n\t\t\t}else{\n\t\t\tsum *= A[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n }\n}",
"Main",
"public static void main(String[] args){\n \tScanner sc = new Scanner(System.in);\n \tint N = sc.nextInt();\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\tlong sum = 1L;\n\t\tlong max = (long)Math.pow(10, 18);\n\t\tfor(int i = 0; i < N; i ++){\n\t\t\tif(A[i] == 0){\n\t\t\t\tsum = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(A[i] > max / sum){\n\t\t\t\tsum = -1;\n\t\t\t}else{\n\t\t\tsum *= A[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n }",
"main",
"{\n \tScanner sc = new Scanner(System.in);\n \tint N = sc.nextInt();\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\tlong sum = 1L;\n\t\tlong max = (long)Math.pow(10, 18);\n\t\tfor(int i = 0; i < N; i ++){\n\t\t\tif(A[i] == 0){\n\t\t\t\tsum = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(A[i] > max / sum){\n\t\t\t\tsum = -1;\n\t\t\t}else{\n\t\t\tsum *= A[i];\n\t\t\t}\n\t\t}\n\t\tSystem.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",
"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",
"long sum = 1L;",
"sum",
"1L",
"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\tif(A[i] == 0){\n\t\t\t\tsum = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(A[i] > max / sum){\n\t\t\t\tsum = -1;\n\t\t\t}else{\n\t\t\tsum *= 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\tif(A[i] == 0){\n\t\t\t\tsum = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(A[i] > max / sum){\n\t\t\t\tsum = -1;\n\t\t\t}else{\n\t\t\tsum *= A[i];\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(A[i] == 0){\n\t\t\t\tsum = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(A[i] > max / sum){\n\t\t\t\tsum = -1;\n\t\t\t}else{\n\t\t\tsum *= A[i];\n\t\t\t}\n\t\t}",
"if(A[i] == 0){\n\t\t\t\tsum = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(A[i] > max / sum){\n\t\t\t\tsum = -1;\n\t\t\t}else{\n\t\t\tsum *= A[i];\n\t\t\t}",
"A[i] == 0",
"A[i]",
"A",
"i",
"0",
"{\n\t\t\t\tsum = 0;\n\t\t\t\tbreak;\n\t\t\t}",
"sum = 0",
"sum",
"0",
"break;",
"if(A[i] > max / sum){\n\t\t\t\tsum = -1;\n\t\t\t}else{\n\t\t\tsum *= A[i];\n\t\t\t}",
"A[i] > max / sum",
"A[i]",
"A",
"i",
"max / sum",
"max",
"sum",
"{\n\t\t\t\tsum = -1;\n\t\t\t}",
"sum = -1",
"sum",
"-1",
"1",
"{\n\t\t\tsum *= A[i];\n\t\t\t}",
"sum *= A[i]",
"sum",
"A[i]",
"A",
"i",
"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 \tScanner sc = new Scanner(System.in);\n \tint N = sc.nextInt();\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\tlong sum = 1L;\n\t\tlong max = (long)Math.pow(10, 18);\n\t\tfor(int i = 0; i < N; i ++){\n\t\t\tif(A[i] == 0){\n\t\t\t\tsum = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(A[i] > max / sum){\n\t\t\t\tsum = -1;\n\t\t\t}else{\n\t\t\tsum *= A[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n }\n}",
"public class Main{\n\tpublic static void main(String[] args){\n \tScanner sc = new Scanner(System.in);\n \tint N = sc.nextInt();\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\tlong sum = 1L;\n\t\tlong max = (long)Math.pow(10, 18);\n\t\tfor(int i = 0; i < N; i ++){\n\t\t\tif(A[i] == 0){\n\t\t\t\tsum = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(A[i] > max / sum){\n\t\t\t\tsum = -1;\n\t\t\t}else{\n\t\t\tsum *= A[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\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];
for(int i = 0; i < N; i ++){
A[i] = sc.nextLong();
}
long sum = 1L;
long max = (long)Math.pow(10, 18);
for(int i = 0; i < N; i ++){
if(A[i] == 0){
sum = 0;
break;
}else if(A[i] > max / sum){
sum = -1;
}else{
sum *= A[i];
}
}
System.out.println(sum);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
0,
13,
4,
18,
13,
13,
41,
13,
20,
41,
13,
17,
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,
4,
18,
13,
18,
13,
13,
14,
2,
18,
13,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
17,
29,
28,
13,
13,
30,
30,
0,
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,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
13,
4,
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
],
[
158,
17
],
[
158,
18
],
[
18,
19
],
[
18,
20
],
[
158,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
26,
29
],
[
23,
30
],
[
30,
31
],
[
30,
32
],
[
23,
33
],
[
33,
34
],
[
33,
35
],
[
23,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
38,
41
],
[
23,
42
],
[
42,
43
],
[
42,
44
],
[
45,
46
],
[
45,
47
],
[
23,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
48,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
55,
57
],
[
48,
58
],
[
58,
59
],
[
59,
60
],
[
48,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
70,
71
],
[
71,
72
],
[
70,
73
],
[
73,
74
],
[
73,
75
],
[
62,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
81,
82
],
[
81,
83
],
[
76,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
85,
90
],
[
84,
91
],
[
23,
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
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
110,
117
],
[
23,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
21,
124
],
[
124,
125
],
[
21,
126
],
[
126,
127
],
[
158,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
134,
135
],
[
134,
136
],
[
130,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
140,
141
],
[
139,
142
],
[
142,
143
],
[
143,
144
],
[
130,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
148,
149
],
[
130,
150
],
[
150,
151
],
[
151,
152
],
[
150,
153
],
[
150,
154
],
[
128,
155
],
[
155,
156
],
[
0,
157
],
[
157,
158
],
[
157,
159
]
] |
[
"import java.util.*;\nimport java.io.*;\nimport java.math.BigDecimal;\nimport java.nio.file.Files;\nimport java.nio.charset.StandardCharsets;\npublic class Main {\n BigDecimal asd = new BigDecimal(1000000000);\n public void sol(String s,long j) {\n asd= asd.multiply(asd);\n BigDecimal ans = new BigDecimal(1);\n boolean ret = false;\n String[] ss = s.split(\" \");\n BigDecimal[] arr = new BigDecimal[ss.length];\n for (int i=0;i<ss.length;i++) {\n arr[i] = BigDecimal.valueOf(Long.parseLong(ss[i]));\n if (arr[i] == BigDecimal.ZERO) {\n System.out.println(\"0\");\n return;\n }\n }\n for(BigDecimal k:arr){\n ans = ans.multiply(k);\n if(ans.compareTo(asd)>0){\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(ans);\n\n\n }\n\n public static void main(String[] args) throws IOException {\n // Use the Scanner class\n Main aka = new Main();\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n long num = Long.parseLong(br.readLine());\n String s = br.readLine();\n //int tot = Integer.parseInt(br.readLine());\n\n aka.sol(s,num);\n// int i =1;\n// System.out.println();\n// while(tot>0){\n//\n// String s = br.readLine();\n// String[] sr = s.split(\" \");\n// List<Long> ls = new ArrayList<>();\n// for(String ss:sr){\n// ls.add(Long.parseLong(ss));\n// }\n// Main tt = new Main();\n// tt.sol(ls);\n// // String Buffer to store answer\n// StringBuffer sb = new StringBuffer();\n//// Solution obj = new Solution();\n////\n//// System.out.println(\"Case #\"+i+\": \"+obj.sol());\n// tot--;\n// i++;\n// }\n }\n\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"import java.math.BigDecimal;",
"BigDecimal",
"java.math",
"import java.nio.file.Files;",
"Files",
"java.nio.file",
"import java.nio.charset.StandardCharsets;",
"StandardCharsets",
"java.nio.charset",
"public class Main {\n BigDecimal asd = new BigDecimal(1000000000);\n public void sol(String s,long j) {\n asd= asd.multiply(asd);\n BigDecimal ans = new BigDecimal(1);\n boolean ret = false;\n String[] ss = s.split(\" \");\n BigDecimal[] arr = new BigDecimal[ss.length];\n for (int i=0;i<ss.length;i++) {\n arr[i] = BigDecimal.valueOf(Long.parseLong(ss[i]));\n if (arr[i] == BigDecimal.ZERO) {\n System.out.println(\"0\");\n return;\n }\n }\n for(BigDecimal k:arr){\n ans = ans.multiply(k);\n if(ans.compareTo(asd)>0){\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(ans);\n\n\n }\n\n public static void main(String[] args) throws IOException {\n // Use the Scanner class\n Main aka = new Main();\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n long num = Long.parseLong(br.readLine());\n String s = br.readLine();\n //int tot = Integer.parseInt(br.readLine());\n\n aka.sol(s,num);\n// int i =1;\n// System.out.println();\n// while(tot>0){\n//\n// String s = br.readLine();\n// String[] sr = s.split(\" \");\n// List<Long> ls = new ArrayList<>();\n// for(String ss:sr){\n// ls.add(Long.parseLong(ss));\n// }\n// Main tt = new Main();\n// tt.sol(ls);\n// // String Buffer to store answer\n// StringBuffer sb = new StringBuffer();\n//// Solution obj = new Solution();\n////\n//// System.out.println(\"Case #\"+i+\": \"+obj.sol());\n// tot--;\n// i++;\n// }\n }\n\n}",
"Main",
"BigDecimal asd = new BigDecimal(1000000000);",
"asd",
"new BigDecimal(1000000000)",
"public void sol(String s,long j) {\n asd= asd.multiply(asd);\n BigDecimal ans = new BigDecimal(1);\n boolean ret = false;\n String[] ss = s.split(\" \");\n BigDecimal[] arr = new BigDecimal[ss.length];\n for (int i=0;i<ss.length;i++) {\n arr[i] = BigDecimal.valueOf(Long.parseLong(ss[i]));\n if (arr[i] == BigDecimal.ZERO) {\n System.out.println(\"0\");\n return;\n }\n }\n for(BigDecimal k:arr){\n ans = ans.multiply(k);\n if(ans.compareTo(asd)>0){\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(ans);\n\n\n }",
"sol",
"{\n asd= asd.multiply(asd);\n BigDecimal ans = new BigDecimal(1);\n boolean ret = false;\n String[] ss = s.split(\" \");\n BigDecimal[] arr = new BigDecimal[ss.length];\n for (int i=0;i<ss.length;i++) {\n arr[i] = BigDecimal.valueOf(Long.parseLong(ss[i]));\n if (arr[i] == BigDecimal.ZERO) {\n System.out.println(\"0\");\n return;\n }\n }\n for(BigDecimal k:arr){\n ans = ans.multiply(k);\n if(ans.compareTo(asd)>0){\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(ans);\n\n\n }",
"asd= asd.multiply(asd)",
"asd",
"asd.multiply(asd)",
"asd.multiply",
"asd",
"asd",
"BigDecimal ans = new BigDecimal(1);",
"ans",
"new BigDecimal(1)",
"boolean ret = false;",
"ret",
"false",
"String[] ss = s.split(\" \");",
"ss",
"s.split(\" \")",
"s.split",
"s",
"\" \"",
"BigDecimal[] arr = new BigDecimal[ss.length];",
"arr",
"new BigDecimal[ss.length]",
"ss.length",
"ss",
"ss.length",
"for (int i=0;i<ss.length;i++) {\n arr[i] = BigDecimal.valueOf(Long.parseLong(ss[i]));\n if (arr[i] == BigDecimal.ZERO) {\n System.out.println(\"0\");\n return;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<ss.length",
"i",
"ss.length",
"ss",
"ss.length",
"i++",
"i++",
"i",
"{\n arr[i] = BigDecimal.valueOf(Long.parseLong(ss[i]));\n if (arr[i] == BigDecimal.ZERO) {\n System.out.println(\"0\");\n return;\n }\n }",
"{\n arr[i] = BigDecimal.valueOf(Long.parseLong(ss[i]));\n if (arr[i] == BigDecimal.ZERO) {\n System.out.println(\"0\");\n return;\n }\n }",
"arr[i] = BigDecimal.valueOf(Long.parseLong(ss[i]))",
"arr[i]",
"arr",
"i",
"BigDecimal.valueOf(Long.parseLong(ss[i]))",
"BigDecimal.valueOf",
"BigDecimal",
"Long.parseLong(ss[i])",
"Long.parseLong",
"Long",
"ss[i]",
"ss",
"i",
"if (arr[i] == BigDecimal.ZERO) {\n System.out.println(\"0\");\n return;\n }",
"arr[i] == BigDecimal.ZERO",
"arr[i]",
"arr",
"i",
"BigDecimal.ZERO",
"BigDecimal",
"BigDecimal.ZERO",
"{\n System.out.println(\"0\");\n return;\n }",
"System.out.println(\"0\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"0\"",
"return;",
"for(BigDecimal k:arr){\n ans = ans.multiply(k);\n if(ans.compareTo(asd)>0){\n System.out.println(\"-1\");\n return;\n }\n }",
"BigDecimal k",
"arr",
"{\n ans = ans.multiply(k);\n if(ans.compareTo(asd)>0){\n System.out.println(\"-1\");\n return;\n }\n }",
"{\n ans = ans.multiply(k);\n if(ans.compareTo(asd)>0){\n System.out.println(\"-1\");\n return;\n }\n }",
"ans = ans.multiply(k)",
"ans",
"ans.multiply(k)",
"ans.multiply",
"ans",
"k",
"if(ans.compareTo(asd)>0){\n System.out.println(\"-1\");\n return;\n }",
"ans.compareTo(asd)>0",
"ans.compareTo(asd)",
"ans.compareTo",
"ans",
"asd",
"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)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String s",
"s",
"long j",
"j",
"public static void main(String[] args) throws IOException {\n // Use the Scanner class\n Main aka = new Main();\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n long num = Long.parseLong(br.readLine());\n String s = br.readLine();\n //int tot = Integer.parseInt(br.readLine());\n\n aka.sol(s,num);\n// int i =1;\n// System.out.println();\n// while(tot>0){\n//\n// String s = br.readLine();\n// String[] sr = s.split(\" \");\n// List<Long> ls = new ArrayList<>();\n// for(String ss:sr){\n// ls.add(Long.parseLong(ss));\n// }\n// Main tt = new Main();\n// tt.sol(ls);\n// // String Buffer to store answer\n// StringBuffer sb = new StringBuffer();\n//// Solution obj = new Solution();\n////\n//// System.out.println(\"Case #\"+i+\": \"+obj.sol());\n// tot--;\n// i++;\n// }\n }",
"main",
"{\n // Use the Scanner class\n Main aka = new Main();\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n long num = Long.parseLong(br.readLine());\n String s = br.readLine();\n //int tot = Integer.parseInt(br.readLine());\n\n aka.sol(s,num);\n// int i =1;\n// System.out.println();\n// while(tot>0){\n//\n// String s = br.readLine();\n// String[] sr = s.split(\" \");\n// List<Long> ls = new ArrayList<>();\n// for(String ss:sr){\n// ls.add(Long.parseLong(ss));\n// }\n// Main tt = new Main();\n// tt.sol(ls);\n// // String Buffer to store answer\n// StringBuffer sb = new StringBuffer();\n//// Solution obj = new Solution();\n////\n//// System.out.println(\"Case #\"+i+\": \"+obj.sol());\n// tot--;\n// i++;\n// }\n }",
"Main aka = new Main();",
"aka",
"new Main()",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"long num = Long.parseLong(br.readLine());",
"num",
"Long.parseLong(br.readLine())",
"Long.parseLong",
"Long",
"br.readLine()",
"br.readLine",
"br",
"String s = br.readLine();",
"s",
"br.readLine()",
"br.readLine",
"br",
"aka.sol(s,num)",
"aka.sol",
"aka",
"s",
"num",
"String[] args",
"args",
"public class Main {\n BigDecimal asd = new BigDecimal(1000000000);\n public void sol(String s,long j) {\n asd= asd.multiply(asd);\n BigDecimal ans = new BigDecimal(1);\n boolean ret = false;\n String[] ss = s.split(\" \");\n BigDecimal[] arr = new BigDecimal[ss.length];\n for (int i=0;i<ss.length;i++) {\n arr[i] = BigDecimal.valueOf(Long.parseLong(ss[i]));\n if (arr[i] == BigDecimal.ZERO) {\n System.out.println(\"0\");\n return;\n }\n }\n for(BigDecimal k:arr){\n ans = ans.multiply(k);\n if(ans.compareTo(asd)>0){\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(ans);\n\n\n }\n\n public static void main(String[] args) throws IOException {\n // Use the Scanner class\n Main aka = new Main();\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n long num = Long.parseLong(br.readLine());\n String s = br.readLine();\n //int tot = Integer.parseInt(br.readLine());\n\n aka.sol(s,num);\n// int i =1;\n// System.out.println();\n// while(tot>0){\n//\n// String s = br.readLine();\n// String[] sr = s.split(\" \");\n// List<Long> ls = new ArrayList<>();\n// for(String ss:sr){\n// ls.add(Long.parseLong(ss));\n// }\n// Main tt = new Main();\n// tt.sol(ls);\n// // String Buffer to store answer\n// StringBuffer sb = new StringBuffer();\n//// Solution obj = new Solution();\n////\n//// System.out.println(\"Case #\"+i+\": \"+obj.sol());\n// tot--;\n// i++;\n// }\n }\n\n}",
"public class Main {\n BigDecimal asd = new BigDecimal(1000000000);\n public void sol(String s,long j) {\n asd= asd.multiply(asd);\n BigDecimal ans = new BigDecimal(1);\n boolean ret = false;\n String[] ss = s.split(\" \");\n BigDecimal[] arr = new BigDecimal[ss.length];\n for (int i=0;i<ss.length;i++) {\n arr[i] = BigDecimal.valueOf(Long.parseLong(ss[i]));\n if (arr[i] == BigDecimal.ZERO) {\n System.out.println(\"0\");\n return;\n }\n }\n for(BigDecimal k:arr){\n ans = ans.multiply(k);\n if(ans.compareTo(asd)>0){\n System.out.println(\"-1\");\n return;\n }\n }\n System.out.println(ans);\n\n\n }\n\n public static void main(String[] args) throws IOException {\n // Use the Scanner class\n Main aka = new Main();\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n long num = Long.parseLong(br.readLine());\n String s = br.readLine();\n //int tot = Integer.parseInt(br.readLine());\n\n aka.sol(s,num);\n// int i =1;\n// System.out.println();\n// while(tot>0){\n//\n// String s = br.readLine();\n// String[] sr = s.split(\" \");\n// List<Long> ls = new ArrayList<>();\n// for(String ss:sr){\n// ls.add(Long.parseLong(ss));\n// }\n// Main tt = new Main();\n// tt.sol(ls);\n// // String Buffer to store answer\n// StringBuffer sb = new StringBuffer();\n//// Solution obj = new Solution();\n////\n//// System.out.println(\"Case #\"+i+\": \"+obj.sol());\n// tot--;\n// i++;\n// }\n }\n\n}",
"Main"
] |
import java.util.*;
import java.io.*;
import java.math.BigDecimal;
import java.nio.file.Files;
import java.nio.charset.StandardCharsets;
public class Main {
BigDecimal asd = new BigDecimal(1000000000);
public void sol(String s,long j) {
asd= asd.multiply(asd);
BigDecimal ans = new BigDecimal(1);
boolean ret = false;
String[] ss = s.split(" ");
BigDecimal[] arr = new BigDecimal[ss.length];
for (int i=0;i<ss.length;i++) {
arr[i] = BigDecimal.valueOf(Long.parseLong(ss[i]));
if (arr[i] == BigDecimal.ZERO) {
System.out.println("0");
return;
}
}
for(BigDecimal k:arr){
ans = ans.multiply(k);
if(ans.compareTo(asd)>0){
System.out.println("-1");
return;
}
}
System.out.println(ans);
}
public static void main(String[] args) throws IOException {
// Use the Scanner class
Main aka = new Main();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
long num = Long.parseLong(br.readLine());
String s = br.readLine();
//int tot = Integer.parseInt(br.readLine());
aka.sol(s,num);
// int i =1;
// System.out.println();
// while(tot>0){
//
// String s = br.readLine();
// String[] sr = s.split(" ");
// List<Long> ls = new ArrayList<>();
// for(String ss:sr){
// ls.add(Long.parseLong(ss));
// }
// Main tt = new Main();
// tt.sol(ls);
// // String Buffer to store answer
// StringBuffer sb = new StringBuffer();
//// Solution obj = new Solution();
////
//// System.out.println("Case #"+i+": "+obj.sol());
// tot--;
// i++;
// }
}
}
|
[
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,
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,
13,
13,
30,
0,
13,
13,
30,
0,
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
],
[
81,
5
],
[
81,
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
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
32,
33
],
[
32,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
27,
38
],
[
39,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
43,
44
],
[
39,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
39,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
55,
59
],
[
54,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
54,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
8,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
8,
75
],
[
75,
76
],
[
76,
77
],
[
6,
78
],
[
78,
79
],
[
0,
80
],
[
80,
81
],
[
80,
82
]
] |
[
"\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\t\tint N = scanner.nextInt();\n\t\tlong ans = 1;\n\t\tlong max = (long)Math.pow(10, 18);\n\n\t\tfor(int i = 0 ; i < N ; i++) {\n\t\t\tlong a = scanner.nextLong();\n\t\t\tif(a == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(max / ans >= a) {\n\t\t\t\tans *= a;\n\t\t\t}else {\n\t\t\t\tans = -1;\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\t\tint N = scanner.nextInt();\n\t\tlong ans = 1;\n\t\tlong max = (long)Math.pow(10, 18);\n\n\t\tfor(int i = 0 ; i < N ; i++) {\n\t\t\tlong a = scanner.nextLong();\n\t\t\tif(a == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(max / ans >= a) {\n\t\t\t\tans *= a;\n\t\t\t}else {\n\t\t\t\tans = -1;\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\t\tint N = scanner.nextInt();\n\t\tlong ans = 1;\n\t\tlong max = (long)Math.pow(10, 18);\n\n\t\tfor(int i = 0 ; i < N ; i++) {\n\t\t\tlong a = scanner.nextLong();\n\t\t\tif(a == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(max / ans >= a) {\n\t\t\t\tans *= a;\n\t\t\t}else {\n\t\t\t\tans = -1;\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\t\tint N = scanner.nextInt();\n\t\tlong ans = 1;\n\t\tlong max = (long)Math.pow(10, 18);\n\n\t\tfor(int i = 0 ; i < N ; i++) {\n\t\t\tlong a = scanner.nextLong();\n\t\t\tif(a == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(max / ans >= a) {\n\t\t\t\tans *= a;\n\t\t\t}else {\n\t\t\t\tans = -1;\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 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\tlong a = scanner.nextLong();\n\t\t\tif(a == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(max / ans >= a) {\n\t\t\t\tans *= a;\n\t\t\t}else {\n\t\t\t\tans = -1;\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\tlong a = scanner.nextLong();\n\t\t\tif(a == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(max / ans >= a) {\n\t\t\t\tans *= a;\n\t\t\t}else {\n\t\t\t\tans = -1;\n\t\t\t}\n\n\t\t}",
"{\n\t\t\tlong a = scanner.nextLong();\n\t\t\tif(a == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(max / ans >= a) {\n\t\t\t\tans *= a;\n\t\t\t}else {\n\t\t\t\tans = -1;\n\t\t\t}\n\n\t\t}",
"long a = scanner.nextLong();",
"a",
"scanner.nextLong()",
"scanner.nextLong",
"scanner",
"if(a == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}",
"a == 0",
"a",
"0",
"{\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}",
"ans = 0",
"ans",
"0",
"break;",
"if(max / ans >= a) {\n\t\t\t\tans *= a;\n\t\t\t}else {\n\t\t\t\tans = -1;\n\t\t\t}",
"max / ans >= a",
"max / ans",
"max",
"ans",
"a",
"{\n\t\t\t\tans *= a;\n\t\t\t}",
"ans *= a",
"ans",
"a",
"{\n\t\t\t\tans = -1;\n\t\t\t}",
"ans = -1",
"ans",
"-1",
"1",
"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\t\tint N = scanner.nextInt();\n\t\tlong ans = 1;\n\t\tlong max = (long)Math.pow(10, 18);\n\n\t\tfor(int i = 0 ; i < N ; i++) {\n\t\t\tlong a = scanner.nextLong();\n\t\t\tif(a == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(max / ans >= a) {\n\t\t\t\tans *= a;\n\t\t\t}else {\n\t\t\t\tans = -1;\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\t\tint N = scanner.nextInt();\n\t\tlong ans = 1;\n\t\tlong max = (long)Math.pow(10, 18);\n\n\t\tfor(int i = 0 ; i < N ; i++) {\n\t\t\tlong a = scanner.nextLong();\n\t\t\tif(a == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(max / ans >= a) {\n\t\t\t\tans *= a;\n\t\t\t}else {\n\t\t\t\tans = -1;\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 max = (long)Math.pow(10, 18);
for(int i = 0 ; i < N ; i++) {
long a = scanner.nextLong();
if(a == 0) {
ans = 0;
break;
}
if(max / ans >= a) {
ans *= a;
}else {
ans = -1;
}
}
System.out.println(ans);
scanner.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
0,
18,
36,
13,
13,
23,
13,
23,
13,
12,
13,
30,
4,
18,
18,
13,
13,
4,
13,
12,
13,
30,
14,
4,
13,
29,
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,
29,
40,
17,
0,
13,
18,
13,
13,
29,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
14,
2,
18,
13,
13,
17,
29,
17,
29,
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,
41,
13,
20,
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
],
[
9,
10
],
[
7,
11
],
[
11,
12
],
[
7,
13
],
[
13,
14
],
[
13,
15
],
[
15,
16
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
16,
20
],
[
15,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
21,
25
],
[
13,
26
],
[
26,
27
],
[
13,
28
],
[
28,
29
],
[
7,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
33,
38
],
[
38,
39
],
[
7,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
43,
46
],
[
46,
47
],
[
42,
48
],
[
48,
49
],
[
48,
50
],
[
42,
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
],
[
63,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
42,
80
],
[
80,
81
],
[
7,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
85,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
85,
95
],
[
95,
96
],
[
96,
97
],
[
85,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
99,
105
],
[
105,
106
],
[
84,
107
],
[
107,
108
],
[
0,
109
],
[
154,
110
],
[
154,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
120,
121
],
[
113,
122
],
[
122,
123
],
[
122,
124
],
[
113,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
126,
131
],
[
131,
132
],
[
131,
133
],
[
126,
134
],
[
134,
135
],
[
135,
136
],
[
126,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
142,
143
],
[
143,
144
],
[
113,
145
],
[
145,
146
],
[
145,
147
],
[
113,
148
],
[
148,
149
],
[
149,
150
],
[
111,
151
],
[
151,
152
],
[
0,
153
],
[
153,
154
],
[
153,
155
]
] |
[
"import java.util.*;\nimport java.math.*;\n\nclass Problem {\n int n;\n long[] a;\n \n public Problem(int n, long[] a) {\n this.n = n;\n this.a = a;\n }\n\n public void solve() {\n System.out.println(calc());\n }\n\n public long calc() {\n if (hasAnyZero()) return 0;\n long ans = 1;\n for (int i = 0; i < n; i++) {\n if (1000000000000000000L / ans < a[i]) return -1;\n ans *= a[i];\n }\n return ans;\n }\n\n public boolean hasAnyZero() {\n for (int i = 0; i < a.length; i++) if (a[i] == 0) return true;\n return false;\n }\n}\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[] a = new long[n];\n for (int i = 0; i < n; i++) a[i] = sc.nextLong();\n Problem p = new Problem(n, a);\n p.solve();\n }\n}\n",
"import java.util.*;",
"util.*",
"java",
"import java.math.*;",
"math.*",
"java",
"class Problem {\n int n;\n long[] a;\n \n public Problem(int n, long[] a) {\n this.n = n;\n this.a = a;\n }\n\n public void solve() {\n System.out.println(calc());\n }\n\n public long calc() {\n if (hasAnyZero()) return 0;\n long ans = 1;\n for (int i = 0; i < n; i++) {\n if (1000000000000000000L / ans < a[i]) return -1;\n ans *= a[i];\n }\n return ans;\n }\n\n public boolean hasAnyZero() {\n for (int i = 0; i < a.length; i++) if (a[i] == 0) return true;\n return false;\n }\n}",
"Problem",
"int n;",
"n",
"long[] a;",
"a",
"public Problem(int n, long[] a) {\n this.n = n;\n this.a = a;\n }",
"Problem",
"{\n this.n = n;\n this.a = a;\n }",
"this.n = n",
"this.n",
"this",
"this.n",
"n",
"this.a = a",
"this.a",
"this",
"this.a",
"a",
"int n",
"n",
"long[] a",
"a",
"public void solve() {\n System.out.println(calc());\n }",
"solve",
"{\n System.out.println(calc());\n }",
"System.out.println(calc())",
"System.out.println",
"System.out",
"System",
"System.out",
"calc()",
"calc",
"public long calc() {\n if (hasAnyZero()) return 0;\n long ans = 1;\n for (int i = 0; i < n; i++) {\n if (1000000000000000000L / ans < a[i]) return -1;\n ans *= a[i];\n }\n return ans;\n }",
"calc",
"{\n if (hasAnyZero()) return 0;\n long ans = 1;\n for (int i = 0; i < n; i++) {\n if (1000000000000000000L / ans < a[i]) return -1;\n ans *= a[i];\n }\n return ans;\n }",
"if (hasAnyZero()) return 0;",
"hasAnyZero()",
"hasAnyZero",
"return 0;",
"0",
"long ans = 1;",
"ans",
"1",
"for (int i = 0; i < n; i++) {\n if (1000000000000000000L / ans < a[i]) return -1;\n ans *= a[i];\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if (1000000000000000000L / ans < a[i]) return -1;\n ans *= a[i];\n }",
"{\n if (1000000000000000000L / ans < a[i]) return -1;\n ans *= a[i];\n }",
"if (1000000000000000000L / ans < a[i]) return -1;",
"1000000000000000000L / ans < a[i]",
"1000000000000000000L / ans",
"1000000000000000000L",
"ans",
"a[i]",
"a",
"i",
"return -1;",
"-1",
"1",
"ans *= a[i]",
"ans",
"a[i]",
"a",
"i",
"return ans;",
"ans",
"public boolean hasAnyZero() {\n for (int i = 0; i < a.length; i++) if (a[i] == 0) return true;\n return false;\n }",
"hasAnyZero",
"{\n for (int i = 0; i < a.length; i++) if (a[i] == 0) return true;\n return false;\n }",
"for (int i = 0; i < a.length; i++) if (a[i] == 0) return true;",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"if (a[i] == 0) return true;",
"if (a[i] == 0) return true;",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"return true;",
"true",
"return false;",
"false",
"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 for (int i = 0; i < n; i++) a[i] = sc.nextLong();\n Problem p = new Problem(n, a);\n p.solve();\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 for (int i = 0; i < n; i++) a[i] = sc.nextLong();\n Problem p = new Problem(n, a);\n p.solve();\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n for (int i = 0; i < n; i++) a[i] = sc.nextLong();\n Problem p = new Problem(n, a);\n p.solve();\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++) a[i] = sc.nextLong();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = sc.nextLong();",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"Problem p = new Problem(n, a);",
"p",
"new Problem(n, a)",
"p.solve()",
"p.solve",
"p",
"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 for (int i = 0; i < n; i++) a[i] = sc.nextLong();\n Problem p = new Problem(n, a);\n p.solve();\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 for (int i = 0; i < n; i++) a[i] = sc.nextLong();\n Problem p = new Problem(n, a);\n p.solve();\n }\n}",
"Main"
] |
import java.util.*;
import java.math.*;
class Problem {
int n;
long[] a;
public Problem(int n, long[] a) {
this.n = n;
this.a = a;
}
public void solve() {
System.out.println(calc());
}
public long calc() {
if (hasAnyZero()) return 0;
long ans = 1;
for (int i = 0; i < n; i++) {
if (1000000000000000000L / ans < a[i]) return -1;
ans *= a[i];
}
return ans;
}
public boolean hasAnyZero() {
for (int i = 0; i < a.length; i++) if (a[i] == 0) return true;
return false;
}
}
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();
Problem p = new Problem(n, a);
p.solve();
}
}
|
[
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,
20,
4,
18,
13,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
4,
18,
13,
0,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
18,
13,
13,
23,
13,
12,
13,
30,
14,
4,
18,
13,
17,
30,
4,
18,
13,
17,
29,
38,
5,
13,
30,
4,
18,
13,
17,
30,
41,
13,
17,
28,
13,
13,
30,
30,
0,
13,
4,
18,
13,
13,
13,
4,
18,
13,
8,
2,
13,
17,
17,
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,
30,
29,
18,
13,
40,
13,
30,
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,
30,
40,
13,
29,
4,
13,
12,
13,
30,
14,
40,
4,
13,
30,
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,
30,
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,
30,
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
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
389,
20
],
[
389,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
27,
28
],
[
27,
29
],
[
23,
30
],
[
30,
31
],
[
30,
32
],
[
23,
33
],
[
33,
34
],
[
34,
35
],
[
33,
36
],
[
23,
37
],
[
37,
38
],
[
38,
39
],
[
21,
40
],
[
40,
41
],
[
0,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
42,
46
],
[
46,
47
],
[
42,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
50,
56
],
[
56,
57
],
[
56,
58
],
[
50,
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
],
[
71,
77
],
[
77,
78
],
[
78,
79
],
[
77,
80
],
[
48,
81
],
[
81,
82
],
[
42,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
86,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
92,
95
],
[
91,
96
],
[
85,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
97,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
109,
110
],
[
109,
111
],
[
109,
112
],
[
113,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
117,
118
],
[
116,
119
],
[
116,
120
],
[
105,
121
],
[
121,
122
],
[
122,
123
],
[
121,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
124,
129
],
[
83,
130
],
[
130,
131
],
[
0,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
132,
139
],
[
139,
140
],
[
139,
141
],
[
132,
143
],
[
143,
144
],
[
143,
145
],
[
132,
146
],
[
146,
147
],
[
146,
148
],
[
132,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
152,
156
],
[
156,
157
],
[
157,
158
],
[
152,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
159,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
163,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
173,
174
],
[
174,
175
],
[
173,
176
],
[
159,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
177,
181
],
[
181,
182
],
[
182,
183
],
[
151,
184
],
[
184,
185
],
[
132,
186
],
[
186,
187
],
[
186,
188
],
[
188,
189
],
[
189,
190
],
[
190,
191
],
[
189,
192
],
[
192,
193
],
[
193,
194
],
[
194,
195
],
[
194,
196
],
[
196,
197
],
[
189,
198
],
[
198,
199
],
[
199,
200
],
[
200,
201
],
[
132,
202
],
[
202,
203
],
[
202,
204
],
[
204,
205
],
[
205,
206
],
[
206,
207
],
[
207,
208
],
[
207,
209
],
[
206,
210
],
[
210,
211
],
[
210,
212
],
[
202,
213
],
[
213,
214
],
[
132,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
218,
219
],
[
219,
220
],
[
220,
221
],
[
219,
222
],
[
222,
223
],
[
223,
224
],
[
223,
225
],
[
225,
226
],
[
225,
227
],
[
218,
228
],
[
228,
229
],
[
229,
230
],
[
217,
231
],
[
231,
232
],
[
232,
233
],
[
132,
234
],
[
234,
235
],
[
234,
236
],
[
236,
237
],
[
237,
238
],
[
238,
239
],
[
239,
240
],
[
237,
241
],
[
241,
242
],
[
242,
243
],
[
236,
244
],
[
244,
245
],
[
244,
246
],
[
236,
247
],
[
247,
248
],
[
247,
249
],
[
249,
250
],
[
236,
251
],
[
251,
252
],
[
252,
253
],
[
252,
254
],
[
251,
255
],
[
255,
256
],
[
256,
257
],
[
257,
258
],
[
256,
259
],
[
255,
260
],
[
260,
261
],
[
260,
262
],
[
262,
263
],
[
236,
264
],
[
264,
265
],
[
265,
266
],
[
266,
267
],
[
132,
268
],
[
268,
269
],
[
268,
270
],
[
270,
271
],
[
271,
272
],
[
272,
273
],
[
273,
274
],
[
271,
275
],
[
275,
276
],
[
276,
277
],
[
270,
278
],
[
278,
279
],
[
278,
280
],
[
270,
281
],
[
281,
282
],
[
281,
283
],
[
270,
284
],
[
284,
285
],
[
284,
286
],
[
286,
287
],
[
270,
288
],
[
288,
289
],
[
289,
290
],
[
289,
291
],
[
288,
292
],
[
292,
293
],
[
293,
294
],
[
293,
295
],
[
292,
296
],
[
296,
297
],
[
296,
298
],
[
298,
299
],
[
270,
300
],
[
300,
301
],
[
301,
302
],
[
302,
303
],
[
302,
304
],
[
301,
305
],
[
305,
306
],
[
305,
307
],
[
300,
308
],
[
308,
309
],
[
309,
310
],
[
270,
311
],
[
311,
312
],
[
311,
313
],
[
313,
314
],
[
314,
315
],
[
315,
316
],
[
316,
317
],
[
316,
318
],
[
315,
319
],
[
319,
320
],
[
319,
321
],
[
314,
322
],
[
322,
323
],
[
323,
324
],
[
323,
325
],
[
322,
326
],
[
326,
327
],
[
326,
328
],
[
328,
329
],
[
328,
330
],
[
314,
331
],
[
331,
332
],
[
332,
333
],
[
333,
334
],
[
333,
335
],
[
335,
336
],
[
332,
337
],
[
337,
338
],
[
338,
339
],
[
338,
340
],
[
331,
341
],
[
341,
342
],
[
342,
343
],
[
343,
344
],
[
343,
345
],
[
345,
346
],
[
343,
347
],
[
331,
348
],
[
348,
349
],
[
349,
350
],
[
313,
351
],
[
351,
352
],
[
351,
353
],
[
353,
354
],
[
132,
355
],
[
355,
356
],
[
355,
357
],
[
357,
358
],
[
358,
359
],
[
358,
360
],
[
360,
361
],
[
357,
362
],
[
362,
363
],
[
363,
364
],
[
364,
365
],
[
364,
366
],
[
366,
367
],
[
366,
368
],
[
363,
369
],
[
369,
370
],
[
369,
371
],
[
371,
372
],
[
371,
373
],
[
362,
374
],
[
374,
375
],
[
375,
376
],
[
357,
377
],
[
377,
378
],
[
132,
379
],
[
379,
380
],
[
379,
381
],
[
381,
382
],
[
382,
383
],
[
383,
384
],
[
384,
385
],
[
383,
386
],
[
386,
387
],
[
0,
388
],
[
388,
389
],
[
388,
390
]
] |
[
"\nimport java.text.DecimalFormat;\nimport java.util.stream.LongStream;\nimport java.util.stream.IntStream;\nimport java.io.*;\nimport java.util.*;\nimport java.util.stream.Collectors;\n\npublic class Main {\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AtCoder problem = new AtCoder(sc);\n problem.solve(out);\n\n out.flush();\n }\n\n}\n\nclass AtCoder {\n\n final int N;\n List<Long> list;\n\n AtCoder(FastScanner sc) {\n N = sc.nextInt();\n list = new ArrayList<>(N);\n for (int i = 0; i < N; i++) {\n long a = sc.nextLong();\n list.add(a);\n }\n }\n\n void solve(PrintWriter out) {\n if (list.contains(0L)) {\n out.println(0L);\n return;\n }\n try {\n long ans = 1;\n for (long a : list) {\n ans = Math.multiplyExact(ans, a);\n }\n out.println(ans > (long) 1e18 ? \"-1\" : ans);\n } catch (ArithmeticException ae) {\n out.println(\"-1\");\n }\n }\n\n}\n\n// https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4\nclass FastScanner {\n\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n}",
"import java.text.DecimalFormat;",
"DecimalFormat",
"java.text",
"import java.util.stream.LongStream;",
"LongStream",
"java.util.stream",
"import java.util.stream.IntStream;",
"IntStream",
"java.util.stream",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"import java.util.stream.Collectors;",
"Collectors",
"java.util.stream",
"public class Main {\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AtCoder problem = new AtCoder(sc);\n problem.solve(out);\n\n out.flush();\n }\n\n}",
"Main",
"public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AtCoder problem = new AtCoder(sc);\n problem.solve(out);\n\n out.flush();\n }",
"main",
"{\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AtCoder problem = new AtCoder(sc);\n problem.solve(out);\n\n out.flush();\n }",
"FastScanner sc = new FastScanner();",
"sc",
"new FastScanner()",
"PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"AtCoder problem = new AtCoder(sc);",
"problem",
"new AtCoder(sc)",
"problem.solve(out)",
"problem.solve",
"problem",
"out",
"out.flush()",
"out.flush",
"out",
"String[] args",
"args",
"class AtCoder {\n\n final int N;\n List<Long> list;\n\n AtCoder(FastScanner sc) {\n N = sc.nextInt();\n list = new ArrayList<>(N);\n for (int i = 0; i < N; i++) {\n long a = sc.nextLong();\n list.add(a);\n }\n }\n\n void solve(PrintWriter out) {\n if (list.contains(0L)) {\n out.println(0L);\n return;\n }\n try {\n long ans = 1;\n for (long a : list) {\n ans = Math.multiplyExact(ans, a);\n }\n out.println(ans > (long) 1e18 ? \"-1\" : ans);\n } catch (ArithmeticException ae) {\n out.println(\"-1\");\n }\n }\n\n}",
"AtCoder",
"final int N;",
"N",
"List<Long> list;",
"list",
"AtCoder(FastScanner sc) {\n N = sc.nextInt();\n list = new ArrayList<>(N);\n for (int i = 0; i < N; i++) {\n long a = sc.nextLong();\n list.add(a);\n }\n }",
"AtCoder",
"{\n N = sc.nextInt();\n list = new ArrayList<>(N);\n for (int i = 0; i < N; i++) {\n long a = sc.nextLong();\n list.add(a);\n }\n }",
"N = sc.nextInt()",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"list = new ArrayList<>(N)",
"list",
"new ArrayList<>(N)",
"for (int i = 0; i < N; i++) {\n long a = sc.nextLong();\n list.add(a);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n long a = sc.nextLong();\n list.add(a);\n }",
"{\n long a = sc.nextLong();\n list.add(a);\n }",
"long a = sc.nextLong();",
"a",
"sc.nextLong()",
"sc.nextLong",
"sc",
"list.add(a)",
"list.add",
"list",
"a",
"FastScanner sc",
"sc",
"void solve(PrintWriter out) {\n if (list.contains(0L)) {\n out.println(0L);\n return;\n }\n try {\n long ans = 1;\n for (long a : list) {\n ans = Math.multiplyExact(ans, a);\n }\n out.println(ans > (long) 1e18 ? \"-1\" : ans);\n } catch (ArithmeticException ae) {\n out.println(\"-1\");\n }\n }",
"solve",
"{\n if (list.contains(0L)) {\n out.println(0L);\n return;\n }\n try {\n long ans = 1;\n for (long a : list) {\n ans = Math.multiplyExact(ans, a);\n }\n out.println(ans > (long) 1e18 ? \"-1\" : ans);\n } catch (ArithmeticException ae) {\n out.println(\"-1\");\n }\n }",
"if (list.contains(0L)) {\n out.println(0L);\n return;\n }",
"list.contains(0L)",
"list.contains",
"list",
"0L",
"{\n out.println(0L);\n return;\n }",
"out.println(0L)",
"out.println",
"out",
"0L",
"return;",
"try {\n long ans = 1;\n for (long a : list) {\n ans = Math.multiplyExact(ans, a);\n }\n out.println(ans > (long) 1e18 ? \"-1\" : ans);\n } catch (ArithmeticException ae) {\n out.println(\"-1\");\n }",
"catch (ArithmeticException ae) {\n out.println(\"-1\");\n }",
"ArithmeticException ae",
"{\n out.println(\"-1\");\n }",
"out.println(\"-1\")",
"out.println",
"out",
"\"-1\"",
"{\n long ans = 1;\n for (long a : list) {\n ans = Math.multiplyExact(ans, a);\n }\n out.println(ans > (long) 1e18 ? \"-1\" : ans);\n }",
"long ans = 1;",
"ans",
"1",
"for (long a : list) {\n ans = Math.multiplyExact(ans, a);\n }",
"long a",
"list",
"{\n ans = Math.multiplyExact(ans, a);\n }",
"{\n ans = Math.multiplyExact(ans, a);\n }",
"ans = Math.multiplyExact(ans, a)",
"ans",
"Math.multiplyExact(ans, a)",
"Math.multiplyExact",
"Math",
"ans",
"a",
"out.println(ans > (long) 1e18 ? \"-1\" : ans)",
"out.println",
"out",
"ans > (long) 1e18 ? \"-1\" : ans",
"ans > (long) 1e18",
"ans",
"(long) 1e18",
"\"-1\"",
"ans",
"PrintWriter out",
"out",
"class FastScanner {\n\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\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 if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }",
"hasNextByte",
"{\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }",
"if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }",
"ptr < buflen",
"ptr",
"buflen",
"{\n return true;\n }",
"return true;",
"true",
"{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }",
"ptr = 0",
"ptr",
"0",
"try {\n buflen = in.read(buffer);\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 buflen = in.read(buffer);\n }",
"buflen = in.read(buffer)",
"buflen",
"in.read(buffer)",
"in.read",
"in",
"buffer",
"if (buflen <= 0) {\n return false;\n }",
"buflen <= 0",
"buflen",
"0",
"{\n return false;\n }",
"return false;",
"false",
"return true;",
"true",
"private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }",
"readByte",
"{\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }",
"if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }",
"hasNextByte()",
"hasNextByte",
"{\n return buffer[ptr++];\n }",
"return buffer[ptr++];",
"buffer[ptr++]",
"buffer",
"ptr++",
"ptr",
"{\n return -1;\n }",
"return -1;",
"-1",
"1",
"private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }",
"isPrintableChar",
"{\n return 33 <= c && c <= 126;\n }",
"return 33 <= c && c <= 126;",
"33 <= c && c <= 126",
"33 <= c",
"33",
"c",
"c <= 126",
"c",
"126",
"int c",
"c",
"public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }",
"hasNext",
"{\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }",
"while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }",
"hasNextByte() && !isPrintableChar(buffer[ptr])",
"hasNextByte()",
"hasNextByte",
"!isPrintableChar(buffer[ptr])",
"isPrintableChar(buffer[ptr])",
"isPrintableChar",
"buffer[ptr]",
"buffer",
"ptr",
"{\n ptr++;\n }",
"ptr++",
"ptr",
"return hasNextByte();",
"hasNextByte()",
"hasNextByte",
"public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }",
"next",
"{\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }",
"if (!hasNext()) {\n throw new NoSuchElementException();\n }",
"!hasNext()",
"hasNext()",
"hasNext",
"{\n throw new NoSuchElementException();\n }",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n sb.appendCodePoint(b);\n b = readByte();\n }",
"sb.appendCodePoint(b)",
"sb.appendCodePoint",
"sb",
"b",
"b = readByte()",
"b",
"readByte()",
"readByte",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }",
"nextLong",
"{\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }",
"if (!hasNext()) {\n throw new NoSuchElementException();\n }",
"!hasNext()",
"hasNext()",
"hasNext",
"{\n throw new NoSuchElementException();\n }",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"long n = 0;",
"n",
"0",
"boolean minus = false;",
"minus",
"false",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"if (b == '-') {\n minus = true;\n b = readByte();\n }",
"b == '-'",
"b",
"'-'",
"{\n minus = true;\n b = readByte();\n }",
"minus = true",
"minus",
"true",
"b = readByte()",
"b",
"readByte()",
"readByte",
"if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }",
"b < '0' || '9' < b",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"{\n throw new NumberFormatException();\n }",
"throw new NumberFormatException();",
"new NumberFormatException()",
"while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }",
"true",
"{\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }",
"if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }",
"'0' <= b && b <= '9'",
"'0' <= b",
"'0'",
"b",
"b <= '9'",
"b",
"'9'",
"{\n n *= 10;\n n += b - '0';\n }",
"n *= 10",
"n",
"10",
"n += b - '0'",
"n",
"b - '0'",
"b",
"'0'",
"if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }",
"b == -1 || !isPrintableChar(b)",
"b == -1",
"b",
"-1",
"1",
"!isPrintableChar(b)",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n return minus ? -n : n;\n }",
"return minus ? -n : n;",
"minus ? -n : n",
"minus",
"-n",
"n",
"n",
"{\n throw new NumberFormatException();\n }",
"throw new NumberFormatException();",
"new NumberFormatException()",
"b = readByte()",
"b",
"readByte()",
"readByte",
"public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }",
"nextInt",
"{\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }",
"long nl = nextLong();",
"nl",
"nextLong()",
"nextLong",
"if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }",
"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",
"{\n throw new NumberFormatException();\n }",
"throw new NumberFormatException();",
"new NumberFormatException()",
"return (int) nl;",
"(int) nl",
"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 class Main {\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AtCoder problem = new AtCoder(sc);\n problem.solve(out);\n\n out.flush();\n }\n\n}",
"public class Main {\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AtCoder problem = new AtCoder(sc);\n problem.solve(out);\n\n out.flush();\n }\n\n}",
"Main"
] |
import java.text.DecimalFormat;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;
import java.util.stream.Collectors;
public class Main {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
AtCoder problem = new AtCoder(sc);
problem.solve(out);
out.flush();
}
}
class AtCoder {
final int N;
List<Long> list;
AtCoder(FastScanner sc) {
N = sc.nextInt();
list = new ArrayList<>(N);
for (int i = 0; i < N; i++) {
long a = sc.nextLong();
list.add(a);
}
}
void solve(PrintWriter out) {
if (list.contains(0L)) {
out.println(0L);
return;
}
try {
long ans = 1;
for (long a : list) {
ans = Math.multiplyExact(ans, a);
}
out.println(ans > (long) 1e18 ? "-1" : ans);
} catch (ArithmeticException ae) {
out.println("-1");
}
}
}
// https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4
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,
41,
13,
17,
12,
13,
30,
41,
13,
20,
41,
13,
17,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
18,
13,
13,
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,
23,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
107,
5
],
[
107,
6
],
[
6,
7
],
[
6,
8
],
[
107,
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
],
[
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
],
[
11,
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
],
[
81,
82
],
[
81,
83
],
[
80,
84
],
[
79,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
91,
92
],
[
85,
93
],
[
79,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
11,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
98,
103
],
[
9,
104
],
[
104,
105
],
[
0,
106
],
[
106,
107
],
[
106,
108
]
] |
[
"import java.util.Scanner;\n\npublic class Main {\n static final long MAX_NUMBER = 1000000000000000000L;\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long answer = 1l;\n int n = sc.nextInt();\n long[] values = new long[n];\n for(int i = 0; i < n; i++) {\n values[i] = sc.nextLong();\n if(values[i] == 0){\n System.out.println(0);\n return;\n }\n }\n for(int i = 0; i < n; i++) {\n long tmp = values[i];\n if(MAX_NUMBER / tmp < answer){\n System.out.println(-1);\n return;\n } else {\n answer *= tmp;\n }\n }\n System.out.println(answer);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n static final long MAX_NUMBER = 1000000000000000000L;\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long answer = 1l;\n int n = sc.nextInt();\n long[] values = new long[n];\n for(int i = 0; i < n; i++) {\n values[i] = sc.nextLong();\n if(values[i] == 0){\n System.out.println(0);\n return;\n }\n }\n for(int i = 0; i < n; i++) {\n long tmp = values[i];\n if(MAX_NUMBER / tmp < answer){\n System.out.println(-1);\n return;\n } else {\n answer *= tmp;\n }\n }\n System.out.println(answer);\n }\n}",
"Main",
"static final long MAX_NUMBER = 1000000000000000000L;",
"MAX_NUMBER",
"1000000000000000000L",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long answer = 1l;\n int n = sc.nextInt();\n long[] values = new long[n];\n for(int i = 0; i < n; i++) {\n values[i] = sc.nextLong();\n if(values[i] == 0){\n System.out.println(0);\n return;\n }\n }\n for(int i = 0; i < n; i++) {\n long tmp = values[i];\n if(MAX_NUMBER / tmp < answer){\n System.out.println(-1);\n return;\n } else {\n answer *= tmp;\n }\n }\n System.out.println(answer);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n long answer = 1l;\n int n = sc.nextInt();\n long[] values = new long[n];\n for(int i = 0; i < n; i++) {\n values[i] = sc.nextLong();\n if(values[i] == 0){\n System.out.println(0);\n return;\n }\n }\n for(int i = 0; i < n; i++) {\n long tmp = values[i];\n if(MAX_NUMBER / tmp < answer){\n System.out.println(-1);\n return;\n } else {\n answer *= tmp;\n }\n }\n System.out.println(answer);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"long answer = 1l;",
"answer",
"1l",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] values = new long[n];",
"values",
"new long[n]",
"n",
"for(int i = 0; i < n; i++) {\n values[i] = sc.nextLong();\n if(values[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 values[i] = sc.nextLong();\n if(values[i] == 0){\n System.out.println(0);\n return;\n }\n }",
"{\n values[i] = sc.nextLong();\n if(values[i] == 0){\n System.out.println(0);\n return;\n }\n }",
"values[i] = sc.nextLong()",
"values[i]",
"values",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(values[i] == 0){\n System.out.println(0);\n return;\n }",
"values[i] == 0",
"values[i]",
"values",
"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 long tmp = values[i];\n if(MAX_NUMBER / tmp < answer){\n System.out.println(-1);\n return;\n } else {\n answer *= tmp;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n long tmp = values[i];\n if(MAX_NUMBER / tmp < answer){\n System.out.println(-1);\n return;\n } else {\n answer *= tmp;\n }\n }",
"{\n long tmp = values[i];\n if(MAX_NUMBER / tmp < answer){\n System.out.println(-1);\n return;\n } else {\n answer *= tmp;\n }\n }",
"long tmp = values[i];",
"tmp",
"values[i]",
"values",
"i",
"if(MAX_NUMBER / tmp < answer){\n System.out.println(-1);\n return;\n } else {\n answer *= tmp;\n }",
"MAX_NUMBER / tmp < answer",
"MAX_NUMBER / tmp",
"MAX_NUMBER",
"tmp",
"answer",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"{\n answer *= tmp;\n }",
"answer *= tmp",
"answer",
"tmp",
"System.out.println(answer)",
"System.out.println",
"System.out",
"System",
"System.out",
"answer",
"String[] args",
"args",
"public class Main {\n static final long MAX_NUMBER = 1000000000000000000L;\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long answer = 1l;\n int n = sc.nextInt();\n long[] values = new long[n];\n for(int i = 0; i < n; i++) {\n values[i] = sc.nextLong();\n if(values[i] == 0){\n System.out.println(0);\n return;\n }\n }\n for(int i = 0; i < n; i++) {\n long tmp = values[i];\n if(MAX_NUMBER / tmp < answer){\n System.out.println(-1);\n return;\n } else {\n answer *= tmp;\n }\n }\n System.out.println(answer);\n }\n}",
"public class Main {\n static final long MAX_NUMBER = 1000000000000000000L;\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long answer = 1l;\n int n = sc.nextInt();\n long[] values = new long[n];\n for(int i = 0; i < n; i++) {\n values[i] = sc.nextLong();\n if(values[i] == 0){\n System.out.println(0);\n return;\n }\n }\n for(int i = 0; i < n; i++) {\n long tmp = values[i];\n if(MAX_NUMBER / tmp < answer){\n System.out.println(-1);\n return;\n } else {\n answer *= tmp;\n }\n }\n System.out.println(answer);\n }\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
static final long MAX_NUMBER = 1000000000000000000L;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long answer = 1l;
int n = sc.nextInt();
long[] values = new long[n];
for(int i = 0; i < n; i++) {
values[i] = sc.nextLong();
if(values[i] == 0){
System.out.println(0);
return;
}
}
for(int i = 0; i < n; i++) {
long tmp = values[i];
if(MAX_NUMBER / tmp < answer){
System.out.println(-1);
return;
} else {
answer *= tmp;
}
}
System.out.println(answer);
}
}
|
[
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,
3,
14,
2,
18,
13,
13,
2,
17,
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
],
[
86,
5
],
[
86,
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
],
[
50,
54
],
[
44,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
60,
61
],
[
60,
62
],
[
55,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
55,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
8,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
8,
80
],
[
80,
81
],
[
81,
82
],
[
6,
83
],
[
83,
84
],
[
0,
85
],
[
85,
86
],
[
85,
87
]
] |
[
"import java.util.*;\n\npublic class Main {\n \n public static void main(String[] args) {\n \n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long[] A = new long[N];\n long sum = 1;\n \n for (int i = 0; i < N; i++) {\n A[i] = sc.nextLong();\n if (A[i] == 0) {\n sum = 0;\n break;\n } else if (A[i] > (1000000000000000000L / sum)) {\n sum = -1;\n } else {\n sum *= A[i];\n }\n } \n System.out.println(sum);\n \n sc.close();\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 N = sc.nextInt();\n long[] A = new long[N];\n long sum = 1;\n \n for (int i = 0; i < N; i++) {\n A[i] = sc.nextLong();\n if (A[i] == 0) {\n sum = 0;\n break;\n } else if (A[i] > (1000000000000000000L / sum)) {\n sum = -1;\n } else {\n sum *= A[i];\n }\n } \n System.out.println(sum);\n \n sc.close();\n }\n}",
"Main",
"public static void main(String[] args) {\n \n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long[] A = new long[N];\n long sum = 1;\n \n for (int i = 0; i < N; i++) {\n A[i] = sc.nextLong();\n if (A[i] == 0) {\n sum = 0;\n break;\n } else if (A[i] > (1000000000000000000L / sum)) {\n sum = -1;\n } else {\n sum *= A[i];\n }\n } \n System.out.println(sum);\n \n sc.close();\n }",
"main",
"{\n \n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long[] A = new long[N];\n long sum = 1;\n \n for (int i = 0; i < N; i++) {\n A[i] = sc.nextLong();\n if (A[i] == 0) {\n sum = 0;\n break;\n } else if (A[i] > (1000000000000000000L / sum)) {\n sum = -1;\n } else {\n sum *= A[i];\n }\n } \n System.out.println(sum);\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",
"long sum = 1;",
"sum",
"1",
"for (int i = 0; i < N; i++) {\n A[i] = sc.nextLong();\n if (A[i] == 0) {\n sum = 0;\n break;\n } else if (A[i] > (1000000000000000000L / sum)) {\n sum = -1;\n } else {\n sum *= A[i];\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 sum = 0;\n break;\n } else if (A[i] > (1000000000000000000L / sum)) {\n sum = -1;\n } else {\n sum *= A[i];\n }\n }",
"{\n A[i] = sc.nextLong();\n if (A[i] == 0) {\n sum = 0;\n break;\n } else if (A[i] > (1000000000000000000L / sum)) {\n sum = -1;\n } else {\n sum *= A[i];\n }\n }",
"A[i] = sc.nextLong()",
"A[i]",
"A",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (A[i] == 0) {\n sum = 0;\n break;\n } else if (A[i] > (1000000000000000000L / sum)) {\n sum = -1;\n } else {\n sum *= A[i];\n }",
"A[i] == 0",
"A[i]",
"A",
"i",
"0",
"{\n sum = 0;\n break;\n }",
"sum = 0",
"sum",
"0",
"break;",
"if (A[i] > (1000000000000000000L / sum)) {\n sum = -1;\n } else {\n sum *= A[i];\n }",
"A[i] > (1000000000000000000L / sum)",
"A[i]",
"A",
"i",
"(1000000000000000000L / sum)",
"1000000000000000000L",
"sum",
"{\n sum = -1;\n }",
"sum = -1",
"sum",
"-1",
"1",
"{\n sum *= A[i];\n }",
"sum *= A[i]",
"sum",
"A[i]",
"A",
"i",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"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 int N = sc.nextInt();\n long[] A = new long[N];\n long sum = 1;\n \n for (int i = 0; i < N; i++) {\n A[i] = sc.nextLong();\n if (A[i] == 0) {\n sum = 0;\n break;\n } else if (A[i] > (1000000000000000000L / sum)) {\n sum = -1;\n } else {\n sum *= A[i];\n }\n } \n System.out.println(sum);\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 int N = sc.nextInt();\n long[] A = new long[N];\n long sum = 1;\n \n for (int i = 0; i < N; i++) {\n A[i] = sc.nextLong();\n if (A[i] == 0) {\n sum = 0;\n break;\n } else if (A[i] > (1000000000000000000L / sum)) {\n sum = -1;\n } else {\n sum *= A[i];\n }\n } \n System.out.println(sum);\n \n sc.close();\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 sum = 1;
for (int i = 0; i < N; i++) {
A[i] = sc.nextLong();
if (A[i] == 0) {
sum = 0;
break;
} else if (A[i] > (1000000000000000000L / sum)) {
sum = -1;
} else {
sum *= A[i];
}
}
System.out.println(sum);
sc.close();
}
}
|
[
7,
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,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
4,
18,
13,
13,
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,
13,
2,
18,
13,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
0,
13,
2,
13,
18,
13,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
14,
2,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
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
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
17,
24
],
[
24,
25
],
[
24,
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
],
[
47,
48
],
[
47,
49
],
[
46,
50
],
[
50,
51
],
[
51,
52
],
[
17,
53
],
[
53,
54
],
[
53,
55
],
[
17,
56
],
[
56,
57
],
[
56,
58
],
[
17,
59
],
[
59,
60
],
[
59,
61
],
[
17,
62
],
[
62,
63
],
[
63,
64
],
[
62,
65
],
[
17,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
66,
71
],
[
71,
72
],
[
71,
73
],
[
66,
74
],
[
74,
75
],
[
75,
76
],
[
66,
77
],
[
78,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
80,
84
],
[
79,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
85,
92
],
[
78,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
100,
102
],
[
93,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
109,
110
],
[
103,
111
],
[
78,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
116,
118
],
[
78,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
124,
129
],
[
123,
130
],
[
78,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
141,
142
],
[
135,
143
],
[
17,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
15,
150
],
[
150,
151
]
] |
[
"//package Contest169;\n\n\nimport java.util.*;\nimport java.io.*;\nimport java.math.*;\n\nimport java.math.*;\nclass Main {\n public static void main(String args[] ) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \n //Start here:\n //System.out.println(Long.MAX_VALUE);\n //.out.println(Integer.MAX_VALUE);\n //System.out.println(\"Hello\");\n \n Scanner sc=new Scanner(System.in);\n \n int t=sc.nextInt();\n \n long a[]=new long[t];\n \n \n for(int i=0;i<t;i++)\n {\n \ta[i]=sc.nextLong();\n }\n \n //BigInteger b=new BigInteger(\"1000000000000000000\");\n //9223372036854775807\n //1000000000000000000\n //BigInteger ans=BigInteger.ONE;\n long max=1000000000000000000L;\n long ans=1L;\n boolean flag=true;\n Arrays.sort(a);\n //System.out.println(Long.MAX_VALUE);\n //System.out.println(Integer.MAX_VALUE);\n //System.out.println(\"Hello\");\n for(int i=0;i<t;i++)\n {\n \tif(a[i]==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans>Long.MAX_VALUE/a[i])\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}\n \tans=(long)ans*a[i];\n \t\n \tif(ans==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans>max)\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}\n \t/*\n \tBigInteger bb=new BigInteger(Long.toString(a[i]));\n \t\n \t//System.out.println(ans);\n \tans=ans.multiply(bb);\n \t\n \tif(ans.compareTo(BigInteger.ZERO)==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans.compareTo(BigInteger.ZERO)<0)\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}*/\n }\n System.out.println(ans);\n \n\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"import java.math.*;",
"math.*",
"java",
"import java.math.*;",
"math.*",
"java",
"class Main {\n public static void main(String args[] ) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \n //Start here:\n //System.out.println(Long.MAX_VALUE);\n //.out.println(Integer.MAX_VALUE);\n //System.out.println(\"Hello\");\n \n Scanner sc=new Scanner(System.in);\n \n int t=sc.nextInt();\n \n long a[]=new long[t];\n \n \n for(int i=0;i<t;i++)\n {\n \ta[i]=sc.nextLong();\n }\n \n //BigInteger b=new BigInteger(\"1000000000000000000\");\n //9223372036854775807\n //1000000000000000000\n //BigInteger ans=BigInteger.ONE;\n long max=1000000000000000000L;\n long ans=1L;\n boolean flag=true;\n Arrays.sort(a);\n //System.out.println(Long.MAX_VALUE);\n //System.out.println(Integer.MAX_VALUE);\n //System.out.println(\"Hello\");\n for(int i=0;i<t;i++)\n {\n \tif(a[i]==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans>Long.MAX_VALUE/a[i])\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}\n \tans=(long)ans*a[i];\n \t\n \tif(ans==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans>max)\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}\n \t/*\n \tBigInteger bb=new BigInteger(Long.toString(a[i]));\n \t\n \t//System.out.println(ans);\n \tans=ans.multiply(bb);\n \t\n \tif(ans.compareTo(BigInteger.ZERO)==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans.compareTo(BigInteger.ZERO)<0)\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}*/\n }\n System.out.println(ans);\n \n\n }\n}",
"Main",
"public static void main(String args[] ) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \n //Start here:\n //System.out.println(Long.MAX_VALUE);\n //.out.println(Integer.MAX_VALUE);\n //System.out.println(\"Hello\");\n \n Scanner sc=new Scanner(System.in);\n \n int t=sc.nextInt();\n \n long a[]=new long[t];\n \n \n for(int i=0;i<t;i++)\n {\n \ta[i]=sc.nextLong();\n }\n \n //BigInteger b=new BigInteger(\"1000000000000000000\");\n //9223372036854775807\n //1000000000000000000\n //BigInteger ans=BigInteger.ONE;\n long max=1000000000000000000L;\n long ans=1L;\n boolean flag=true;\n Arrays.sort(a);\n //System.out.println(Long.MAX_VALUE);\n //System.out.println(Integer.MAX_VALUE);\n //System.out.println(\"Hello\");\n for(int i=0;i<t;i++)\n {\n \tif(a[i]==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans>Long.MAX_VALUE/a[i])\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}\n \tans=(long)ans*a[i];\n \t\n \tif(ans==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans>max)\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}\n \t/*\n \tBigInteger bb=new BigInteger(Long.toString(a[i]));\n \t\n \t//System.out.println(ans);\n \tans=ans.multiply(bb);\n \t\n \tif(ans.compareTo(BigInteger.ZERO)==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans.compareTo(BigInteger.ZERO)<0)\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}*/\n }\n System.out.println(ans);\n \n\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \n //Start here:\n //System.out.println(Long.MAX_VALUE);\n //.out.println(Integer.MAX_VALUE);\n //System.out.println(\"Hello\");\n \n Scanner sc=new Scanner(System.in);\n \n int t=sc.nextInt();\n \n long a[]=new long[t];\n \n \n for(int i=0;i<t;i++)\n {\n \ta[i]=sc.nextLong();\n }\n \n //BigInteger b=new BigInteger(\"1000000000000000000\");\n //9223372036854775807\n //1000000000000000000\n //BigInteger ans=BigInteger.ONE;\n long max=1000000000000000000L;\n long ans=1L;\n boolean flag=true;\n Arrays.sort(a);\n //System.out.println(Long.MAX_VALUE);\n //System.out.println(Integer.MAX_VALUE);\n //System.out.println(\"Hello\");\n for(int i=0;i<t;i++)\n {\n \tif(a[i]==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans>Long.MAX_VALUE/a[i])\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}\n \tans=(long)ans*a[i];\n \t\n \tif(ans==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans>max)\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}\n \t/*\n \tBigInteger bb=new BigInteger(Long.toString(a[i]));\n \t\n \t//System.out.println(ans);\n \tans=ans.multiply(bb);\n \t\n \tif(ans.compareTo(BigInteger.ZERO)==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans.compareTo(BigInteger.ZERO)<0)\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}*/\n }\n System.out.println(ans);\n \n\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int t=sc.nextInt();",
"t",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long a[]=new long[t];",
"a",
"new long[t]",
"t",
"for(int i=0;i<t;i++)\n {\n \ta[i]=sc.nextLong();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<t",
"i",
"t",
"i++",
"i++",
"i",
"{\n \ta[i]=sc.nextLong();\n }",
"{\n \ta[i]=sc.nextLong();\n }",
"a[i]=sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"long max=1000000000000000000L;",
"max",
"1000000000000000000L",
"long ans=1L;",
"ans",
"1L",
"boolean flag=true;",
"flag",
"true",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"for(int i=0;i<t;i++)\n {\n \tif(a[i]==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans>Long.MAX_VALUE/a[i])\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}\n \tans=(long)ans*a[i];\n \t\n \tif(ans==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans>max)\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}\n \t/*\n \tBigInteger bb=new BigInteger(Long.toString(a[i]));\n \t\n \t//System.out.println(ans);\n \tans=ans.multiply(bb);\n \t\n \tif(ans.compareTo(BigInteger.ZERO)==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans.compareTo(BigInteger.ZERO)<0)\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}*/\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<t",
"i",
"t",
"i++",
"i++",
"i",
"{\n \tif(a[i]==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans>Long.MAX_VALUE/a[i])\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}\n \tans=(long)ans*a[i];\n \t\n \tif(ans==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans>max)\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}\n \t/*\n \tBigInteger bb=new BigInteger(Long.toString(a[i]));\n \t\n \t//System.out.println(ans);\n \tans=ans.multiply(bb);\n \t\n \tif(ans.compareTo(BigInteger.ZERO)==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans.compareTo(BigInteger.ZERO)<0)\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}*/\n }",
"{\n \tif(a[i]==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans>Long.MAX_VALUE/a[i])\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}\n \tans=(long)ans*a[i];\n \t\n \tif(ans==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans>max)\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}\n \t/*\n \tBigInteger bb=new BigInteger(Long.toString(a[i]));\n \t\n \t//System.out.println(ans);\n \tans=ans.multiply(bb);\n \t\n \tif(ans.compareTo(BigInteger.ZERO)==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}\n \tif(ans.compareTo(BigInteger.ZERO)<0)\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}*/\n }",
"if(a[i]==0)\n \t{\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.MAX_VALUE/a[i])\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}",
"ans>Long.MAX_VALUE/a[i]",
"ans",
"Long.MAX_VALUE/a[i]",
"Long.MAX_VALUE",
"Long",
"Long.MAX_VALUE",
"a[i]",
"a",
"i",
"{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"ans=(long)ans*a[i]",
"ans",
"(long)ans*a[i]",
"(long)ans",
"a[i]",
"a",
"i",
"if(ans==0)\n \t{\n \t\tSystem.out.println(0);\n \t\treturn;\n \t}",
"ans==0",
"ans",
"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>max)\n \t{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}",
"ans>max",
"ans",
"max",
"{\n \t\tSystem.out.println(-1);\n \t\treturn;\n \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",
"String args[]",
"args"
] |
//package Contest169;
import java.util.*;
import java.io.*;
import java.math.*;
import java.math.*;
class Main {
public static void main(String args[] ) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//Start here:
//System.out.println(Long.MAX_VALUE);
//.out.println(Integer.MAX_VALUE);
//System.out.println("Hello");
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
long a[]=new long[t];
for(int i=0;i<t;i++)
{
a[i]=sc.nextLong();
}
//BigInteger b=new BigInteger("1000000000000000000");
//9223372036854775807
//1000000000000000000
//BigInteger ans=BigInteger.ONE;
long max=1000000000000000000L;
long ans=1L;
boolean flag=true;
Arrays.sort(a);
//System.out.println(Long.MAX_VALUE);
//System.out.println(Integer.MAX_VALUE);
//System.out.println("Hello");
for(int i=0;i<t;i++)
{
if(a[i]==0)
{
System.out.println(0);
return;
}
if(ans>Long.MAX_VALUE/a[i])
{
System.out.println(-1);
return;
}
ans=(long)ans*a[i];
if(ans==0)
{
System.out.println(0);
return;
}
if(ans>max)
{
System.out.println(-1);
return;
}
/*
BigInteger bb=new BigInteger(Long.toString(a[i]));
//System.out.println(ans);
ans=ans.multiply(bb);
if(ans.compareTo(BigInteger.ZERO)==0)
{
System.out.println(0);
return;
}
if(ans.compareTo(BigInteger.ZERO)<0)
{
System.out.println(-1);
return;
}*/
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
38,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
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,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
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,
4,
18,
13,
17,
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
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
121,
14
],
[
121,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
19,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
25,
28
],
[
28,
29
],
[
29,
30
],
[
19,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
33,
38
],
[
19,
39
],
[
39,
40
],
[
39,
41
],
[
19,
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
],
[
60,
63
],
[
63,
64
],
[
63,
65
],
[
19,
66
],
[
66,
67
],
[
67,
68
],
[
19,
69
],
[
69,
70
],
[
70,
71
],
[
69,
72
],
[
19,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
19,
79
],
[
79,
80
],
[
79,
81
],
[
79,
82
],
[
83,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
83,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
95,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
94,
102
],
[
93,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
109,
110
],
[
103,
111
],
[
19,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
112,
117
],
[
15,
118
],
[
118,
119
],
[
0,
120
],
[
120,
121
],
[
120,
122
]
] |
[
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\nimport java.util.Arrays;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n\n int n = Integer.parseInt(br.readLine());\n String[] in = br.readLine().split(\" \");\n long[] a = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = Long.parseLong(in[i]);\n }\n\n br.close();\n\n Arrays.sort(a);\n\n BigInteger ans = BigInteger.valueOf(1);\n for (long i : a) {\n ans = ans.multiply(BigInteger.valueOf(i));\n if (ans.compareTo(BigInteger.valueOf((long) 1e18)) == 1) {\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(ans);\n\n }\n }\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.Arrays;",
"Arrays",
"java.util",
"public class Main {\n public static void main(String[] args) throws Exception {\n try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n\n int n = Integer.parseInt(br.readLine());\n String[] in = br.readLine().split(\" \");\n long[] a = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = Long.parseLong(in[i]);\n }\n\n br.close();\n\n Arrays.sort(a);\n\n BigInteger ans = BigInteger.valueOf(1);\n for (long i : a) {\n ans = ans.multiply(BigInteger.valueOf(i));\n if (ans.compareTo(BigInteger.valueOf((long) 1e18)) == 1) {\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(ans);\n\n }\n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n\n int n = Integer.parseInt(br.readLine());\n String[] in = br.readLine().split(\" \");\n long[] a = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = Long.parseLong(in[i]);\n }\n\n br.close();\n\n Arrays.sort(a);\n\n BigInteger ans = BigInteger.valueOf(1);\n for (long i : a) {\n ans = ans.multiply(BigInteger.valueOf(i));\n if (ans.compareTo(BigInteger.valueOf((long) 1e18)) == 1) {\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(ans);\n\n }\n }",
"main",
"{\n try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n\n int n = Integer.parseInt(br.readLine());\n String[] in = br.readLine().split(\" \");\n long[] a = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = Long.parseLong(in[i]);\n }\n\n br.close();\n\n Arrays.sort(a);\n\n BigInteger ans = BigInteger.valueOf(1);\n for (long i : a) {\n ans = ans.multiply(BigInteger.valueOf(i));\n if (ans.compareTo(BigInteger.valueOf((long) 1e18)) == 1) {\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(ans);\n\n }\n }",
"try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n\n int n = Integer.parseInt(br.readLine());\n String[] in = br.readLine().split(\" \");\n long[] a = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = Long.parseLong(in[i]);\n }\n\n br.close();\n\n Arrays.sort(a);\n\n BigInteger ans = BigInteger.valueOf(1);\n for (long i : a) {\n ans = ans.multiply(BigInteger.valueOf(i));\n if (ans.compareTo(BigInteger.valueOf((long) 1e18)) == 1) {\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(ans);\n\n }",
"{\n\n int n = Integer.parseInt(br.readLine());\n String[] in = br.readLine().split(\" \");\n long[] a = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = Long.parseLong(in[i]);\n }\n\n br.close();\n\n Arrays.sort(a);\n\n BigInteger ans = BigInteger.valueOf(1);\n for (long i : a) {\n ans = ans.multiply(BigInteger.valueOf(i));\n if (ans.compareTo(BigInteger.valueOf((long) 1e18)) == 1) {\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(ans);\n\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in))",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in))",
"new BufferedReader(new InputStreamReader(System.in))",
"int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] in = br.readLine().split(\" \");",
"in",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for (int i = 0; i < n; i++) {\n a[i] = Long.parseLong(in[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = Long.parseLong(in[i]);\n }",
"{\n a[i] = Long.parseLong(in[i]);\n }",
"a[i] = Long.parseLong(in[i])",
"a[i]",
"a",
"i",
"Long.parseLong(in[i])",
"Long.parseLong",
"Long",
"in[i]",
"in",
"i",
"br.close()",
"br.close",
"br",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"BigInteger ans = BigInteger.valueOf(1);",
"ans",
"BigInteger.valueOf(1)",
"BigInteger.valueOf",
"BigInteger",
"1",
"for (long i : a) {\n ans = ans.multiply(BigInteger.valueOf(i));\n if (ans.compareTo(BigInteger.valueOf((long) 1e18)) == 1) {\n System.out.println(-1);\n return;\n }\n }",
"long i",
"a",
"{\n ans = ans.multiply(BigInteger.valueOf(i));\n if (ans.compareTo(BigInteger.valueOf((long) 1e18)) == 1) {\n System.out.println(-1);\n return;\n }\n }",
"{\n ans = ans.multiply(BigInteger.valueOf(i));\n if (ans.compareTo(BigInteger.valueOf((long) 1e18)) == 1) {\n System.out.println(-1);\n return;\n }\n }",
"ans = ans.multiply(BigInteger.valueOf(i))",
"ans",
"ans.multiply(BigInteger.valueOf(i))",
"ans.multiply",
"ans",
"BigInteger.valueOf(i)",
"BigInteger.valueOf",
"BigInteger",
"i",
"if (ans.compareTo(BigInteger.valueOf((long) 1e18)) == 1) {\n System.out.println(-1);\n return;\n }",
"ans.compareTo(BigInteger.valueOf((long) 1e18)) == 1",
"ans.compareTo(BigInteger.valueOf((long) 1e18))",
"ans.compareTo",
"ans",
"BigInteger.valueOf((long) 1e18)",
"BigInteger.valueOf",
"BigInteger",
"(long) 1e18",
"1",
"{\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(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) throws Exception {\n try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n\n int n = Integer.parseInt(br.readLine());\n String[] in = br.readLine().split(\" \");\n long[] a = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = Long.parseLong(in[i]);\n }\n\n br.close();\n\n Arrays.sort(a);\n\n BigInteger ans = BigInteger.valueOf(1);\n for (long i : a) {\n ans = ans.multiply(BigInteger.valueOf(i));\n if (ans.compareTo(BigInteger.valueOf((long) 1e18)) == 1) {\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(ans);\n\n }\n }\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n\n int n = Integer.parseInt(br.readLine());\n String[] in = br.readLine().split(\" \");\n long[] a = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = Long.parseLong(in[i]);\n }\n\n br.close();\n\n Arrays.sort(a);\n\n BigInteger ans = BigInteger.valueOf(1);\n for (long i : a) {\n ans = ans.multiply(BigInteger.valueOf(i));\n if (ans.compareTo(BigInteger.valueOf((long) 1e18)) == 1) {\n System.out.println(-1);\n return;\n }\n }\n\n System.out.println(ans);\n\n }\n }\n}",
"Main"
] |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws Exception {
try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
int n = Integer.parseInt(br.readLine());
String[] in = br.readLine().split(" ");
long[] a = new long[n];
for (int i = 0; i < n; i++) {
a[i] = Long.parseLong(in[i]);
}
br.close();
Arrays.sort(a);
BigInteger ans = BigInteger.valueOf(1);
for (long i : a) {
ans = ans.multiply(BigInteger.valueOf(i));
if (ans.compareTo(BigInteger.valueOf((long) 1e18)) == 1) {
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,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
17,
41,
13,
41,
13,
20,
41,
13,
17,
41,
13,
17,
41,
13,
20,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
41,
13,
20,
0,
13,
20,
41,
13,
17,
42,
2,
40,
13,
17,
30,
41,
13,
17,
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,
13,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
0,
13,
18,
13,
13,
4,
18,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
14,
2,
2,
13,
17,
2,
13,
13,
29,
17,
14,
2,
2,
13,
13,
2,
13,
17,
29,
17,
41,
13,
2,
2,
18,
13,
13,
4,
13,
2,
2,
18,
13,
13,
18,
13,
2,
13,
13,
13,
2,
13,
17,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
42,
2,
13,
17,
30,
14,
2,
2,
13,
17,
17,
0,
13,
2,
2,
13,
13,
13,
0,
13,
2,
2,
13,
13,
13,
0,
13,
17,
29,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
2,
13,
13,
17,
29,
13,
29,
4,
13,
13,
2,
13,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
2,
13,
13,
17,
29,
13,
29,
4,
13,
13,
2,
13,
13,
23,
13,
23,
13,
12,
13,
30,
29,
17,
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
],
[
31,
32
],
[
31,
33
],
[
0,
34
],
[
408,
35
],
[
408,
36
],
[
36,
37
],
[
36,
38
],
[
408,
39
],
[
39,
40
],
[
408,
41
],
[
41,
42
],
[
41,
43
],
[
408,
44
],
[
44,
45
],
[
44,
46
],
[
408,
47
],
[
47,
48
],
[
47,
49
],
[
408,
50
],
[
50,
51
],
[
50,
52
],
[
408,
53
],
[
53,
54
],
[
408,
55
],
[
55,
56
],
[
408,
57
],
[
57,
58
],
[
408,
59
],
[
59,
60
],
[
408,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
67,
69
],
[
63,
70
],
[
70,
71
],
[
70,
72
],
[
63,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
73,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
85,
86
],
[
78,
87
],
[
87,
88
],
[
87,
89
],
[
78,
90
],
[
90,
91
],
[
90,
92
],
[
78,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
94,
99
],
[
99,
100
],
[
99,
101
],
[
94,
102
],
[
102,
103
],
[
103,
104
],
[
94,
105
],
[
106,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
112,
113
],
[
106,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
114,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
121,
126
],
[
120,
127
],
[
78,
128
],
[
128,
129
],
[
128,
130
],
[
78,
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
],
[
145,
149
],
[
149,
150
],
[
149,
151
],
[
144,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
153,
158
],
[
158,
159
],
[
152,
160
],
[
143,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
163,
165
],
[
78,
166
],
[
166,
167
],
[
167,
168
],
[
166,
169
],
[
63,
170
],
[
170,
171
],
[
171,
172
],
[
61,
173
],
[
173,
174
],
[
408,
175
],
[
175,
176
],
[
175,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
179,
183
],
[
183,
184
],
[
183,
185
],
[
178,
186
],
[
186,
187
],
[
177,
188
],
[
188,
189
],
[
189,
190
],
[
190,
191
],
[
190,
192
],
[
189,
193
],
[
193,
194
],
[
193,
195
],
[
188,
196
],
[
196,
197
],
[
177,
198
],
[
198,
199
],
[
198,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
202,
204
],
[
201,
205
],
[
205,
206
],
[
205,
207
],
[
207,
208
],
[
208,
209
],
[
209,
210
],
[
209,
211
],
[
208,
212
],
[
212,
213
],
[
212,
214
],
[
214,
215
],
[
214,
216
],
[
207,
217
],
[
205,
218
],
[
218,
219
],
[
218,
220
],
[
200,
221
],
[
177,
222
],
[
222,
223
],
[
175,
224
],
[
224,
225
],
[
175,
226
],
[
226,
227
],
[
408,
228
],
[
228,
229
],
[
228,
230
],
[
230,
231
],
[
231,
232
],
[
231,
233
],
[
230,
234
],
[
234,
235
],
[
235,
236
],
[
235,
237
],
[
234,
238
],
[
238,
239
],
[
239,
240
],
[
240,
241
],
[
241,
242
],
[
241,
243
],
[
240,
244
],
[
239,
245
],
[
245,
246
],
[
245,
247
],
[
247,
248
],
[
248,
249
],
[
248,
250
],
[
247,
251
],
[
238,
252
],
[
252,
253
],
[
252,
254
],
[
254,
255
],
[
255,
256
],
[
255,
257
],
[
254,
258
],
[
238,
259
],
[
259,
260
],
[
259,
261
],
[
230,
262
],
[
262,
263
],
[
228,
264
],
[
264,
265
],
[
228,
266
],
[
266,
267
],
[
408,
268
],
[
268,
269
],
[
268,
270
],
[
270,
271
],
[
271,
272
],
[
272,
273
],
[
273,
274
],
[
273,
275
],
[
272,
276
],
[
271,
277
],
[
277,
278
],
[
270,
279
],
[
279,
280
],
[
280,
281
],
[
280,
282
],
[
280,
283
],
[
283,
284
],
[
283,
285
],
[
268,
286
],
[
286,
287
],
[
268,
288
],
[
288,
289
],
[
408,
290
],
[
290,
291
],
[
290,
292
],
[
292,
293
],
[
293,
294
],
[
294,
295
],
[
295,
296
],
[
295,
297
],
[
294,
298
],
[
293,
299
],
[
299,
300
],
[
292,
301
],
[
301,
302
],
[
302,
303
],
[
302,
304
],
[
302,
305
],
[
305,
306
],
[
305,
307
],
[
290,
308
],
[
308,
309
],
[
290,
310
],
[
310,
311
],
[
408,
312
],
[
312,
313
],
[
312,
314
],
[
314,
315
],
[
315,
316
],
[
312,
317
],
[
317,
318
],
[
408,
319
],
[
319,
320
],
[
319,
321
],
[
321,
322
],
[
319,
323
],
[
323,
324
],
[
319,
325
],
[
325,
326
],
[
325,
327
],
[
327,
328
],
[
328,
329
],
[
328,
330
],
[
319,
331
],
[
331,
332
],
[
331,
333
],
[
333,
334
],
[
334,
335
],
[
335,
336
],
[
336,
337
],
[
336,
338
],
[
335,
339
],
[
339,
340
],
[
340,
341
],
[
341,
342
],
[
334,
343
],
[
343,
344
],
[
344,
345
],
[
345,
346
],
[
345,
347
],
[
347,
348
],
[
348,
349
],
[
349,
350
],
[
344,
351
],
[
351,
352
],
[
352,
353
],
[
352,
354
],
[
333,
355
],
[
355,
356
],
[
356,
357
],
[
357,
358
],
[
319,
359
],
[
359,
360
],
[
359,
361
],
[
361,
362
],
[
362,
363
],
[
363,
364
],
[
364,
365
],
[
363,
366
],
[
366,
367
],
[
319,
368
],
[
368,
369
],
[
368,
370
],
[
370,
371
],
[
371,
372
],
[
372,
373
],
[
373,
374
],
[
372,
375
],
[
375,
376
],
[
319,
377
],
[
377,
378
],
[
377,
379
],
[
379,
380
],
[
380,
381
],
[
381,
382
],
[
382,
383
],
[
381,
384
],
[
384,
385
],
[
319,
386
],
[
386,
387
],
[
386,
388
],
[
388,
389
],
[
389,
390
],
[
389,
391
],
[
388,
392
],
[
392,
393
],
[
393,
394
],
[
393,
395
],
[
395,
396
],
[
396,
397
],
[
397,
398
],
[
392,
399
],
[
399,
400
],
[
400,
401
],
[
400,
402
],
[
402,
403
],
[
403,
404
],
[
388,
405
],
[
405,
406
],
[
0,
407
],
[
407,
408
],
[
407,
409
]
] |
[
"import java.io.*;\nimport java.math.*;\nimport java.security.*;\nimport java.text.*;\nimport java.util.*;\nimport java.util.concurrent.*;\nimport java.util.function.*;\nimport java.util.regex.*;\nimport java.util.stream.*;\nimport static java.util.stream.Collectors.joining;\nimport static java.util.stream.Collectors.toList;\npublic class Main{\n\n static long MOD = 1000000007L;\n static long [] fac;\n static int[][] dir = new int[][]{{1, 0}, {0, 1}, {-1, 0}, {0, -1}};\n static long lMax = 0x3f3f3f3f3f3f3f3fL;\n static int iMax = 0x3f3f3f3f;\n static HashMap <Long, Long> memo = new HashMap();\n static int n, m;\n static int[][] mat;\n public static void main(String[] args) {\n MyScanner sc = new MyScanner();\n out = new PrintWriter(new BufferedOutputStream(System.out));\n // Start writing your solution here. -------------------------------------\n //int t = sc.nextInt();\n int t = 1;\n while(t-- > 0){\n long threshold = 1000000000000000000L;\n int n = sc.nextInt();\n long res = 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 {\n System.out.println(0);\n return;\n }\n }\n boolean printed = false;\n for(int i = 0; i < n; i++)\n {\n if(threshold / res < a[i])\n {\n System.out.println(-1);\n return;\n }\n res *= a[i];\n }\n out.println(res);\n }\n out.close();\n }\n public static long C(int n, int m)\n {\n if(m == 0 || m == n) return 1l;\n if(m > n || m < 0) return 0l;\n long res = fac[n] * quickPOW((fac[m] * fac[n - m]) % MOD, MOD - 2) % MOD;\n\n return res;\n }\n public static long quickPOW(long n, long m)\n {\n long ans = 1l;\n while(m > 0)\n {\n if(m % 2 == 1)\n ans = (ans * n) % MOD;\n n = (n * n) % MOD;\n m >>= 1;\n }\n return ans;\n }\n public static int gcd(int a, int b)\n {\n if(a % b == 0) return b;\n return gcd(b, a % b);\n }\n public static long gcd(long a, long b)\n {\n if(a % b == 0) return b;\n return gcd(b, a % b);\n }\n public static long solve(long cur){\n return 0L;\n }\n //-----------PrintWriter for faster output---------------------------------\n public static PrintWriter out;\n //-----------MyScanner class for faster input----------\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 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 int nextInt() {\n return Integer.parseInt(next());\n }\n long nextLong() {\n return Long.parseLong(next());\n }\n double nextDouble() {\n return Double.parseDouble(next());\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.security.*;",
"security.*",
"java",
"import java.text.*;",
"text.*",
"java",
"import java.util.*;",
"util.*",
"java",
"import java.util.concurrent.*;",
"concurrent.*",
"java.util",
"import java.util.function.*;",
"function.*",
"java.util",
"import java.util.regex.*;",
"regex.*",
"java.util",
"import java.util.stream.*;",
"stream.*",
"java.util",
"import static java.util.stream.Collectors.joining;",
"import static java.util.stream.Collectors.joining;",
"import static java.util.stream.Collectors.joining;",
"import static java.util.stream.Collectors.toList;",
"import static java.util.stream.Collectors.toList;",
"import static java.util.stream.Collectors.toList;",
"public class Main{\n\n static long MOD = 1000000007L;\n static long [] fac;\n static int[][] dir = new int[][]{{1, 0}, {0, 1}, {-1, 0}, {0, -1}};\n static long lMax = 0x3f3f3f3f3f3f3f3fL;\n static int iMax = 0x3f3f3f3f;\n static HashMap <Long, Long> memo = new HashMap();\n static int n, m;\n static int[][] mat;\n public static void main(String[] args) {\n MyScanner sc = new MyScanner();\n out = new PrintWriter(new BufferedOutputStream(System.out));\n // Start writing your solution here. -------------------------------------\n //int t = sc.nextInt();\n int t = 1;\n while(t-- > 0){\n long threshold = 1000000000000000000L;\n int n = sc.nextInt();\n long res = 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 {\n System.out.println(0);\n return;\n }\n }\n boolean printed = false;\n for(int i = 0; i < n; i++)\n {\n if(threshold / res < a[i])\n {\n System.out.println(-1);\n return;\n }\n res *= a[i];\n }\n out.println(res);\n }\n out.close();\n }\n public static long C(int n, int m)\n {\n if(m == 0 || m == n) return 1l;\n if(m > n || m < 0) return 0l;\n long res = fac[n] * quickPOW((fac[m] * fac[n - m]) % MOD, MOD - 2) % MOD;\n\n return res;\n }\n public static long quickPOW(long n, long m)\n {\n long ans = 1l;\n while(m > 0)\n {\n if(m % 2 == 1)\n ans = (ans * n) % MOD;\n n = (n * n) % MOD;\n m >>= 1;\n }\n return ans;\n }\n public static int gcd(int a, int b)\n {\n if(a % b == 0) return b;\n return gcd(b, a % b);\n }\n public static long gcd(long a, long b)\n {\n if(a % b == 0) return b;\n return gcd(b, a % b);\n }\n public static long solve(long cur){\n return 0L;\n }\n //-----------PrintWriter for faster output---------------------------------\n public static PrintWriter out;\n //-----------MyScanner class for faster input----------\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 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 int nextInt() {\n return Integer.parseInt(next());\n }\n long nextLong() {\n return Long.parseLong(next());\n }\n double nextDouble() {\n return Double.parseDouble(next());\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 long MOD = 1000000007L;",
"MOD",
"1000000007L",
"static long [] fac;",
"fac",
"static int[][] dir = new int[][]{{1, 0}, {0, 1}, {-1, 0}, {0, -1}};",
"dir",
"new int[][]{{1, 0}, {0, 1}, {-1, 0}, {0, -1}}",
"static long lMax = 0x3f3f3f3f3f3f3f3fL;",
"lMax",
"0x3f3f3f3f3f3f3f3fL",
"static int iMax = 0x3f3f3f3f;",
"iMax",
"0x3f3f3f3f",
"static HashMap <Long, Long> memo = new HashMap();",
"memo",
"new HashMap()",
"static int n",
"n",
"m;",
"m",
"static int[][] mat;",
"mat",
"//-----------PrintWriter for faster output---------------------------------\n public static PrintWriter out;",
"out",
"public static void main(String[] args) {\n MyScanner sc = new MyScanner();\n out = new PrintWriter(new BufferedOutputStream(System.out));\n // Start writing your solution here. -------------------------------------\n //int t = sc.nextInt();\n int t = 1;\n while(t-- > 0){\n long threshold = 1000000000000000000L;\n int n = sc.nextInt();\n long res = 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 {\n System.out.println(0);\n return;\n }\n }\n boolean printed = false;\n for(int i = 0; i < n; i++)\n {\n if(threshold / res < a[i])\n {\n System.out.println(-1);\n return;\n }\n res *= a[i];\n }\n out.println(res);\n }\n out.close();\n }",
"main",
"{\n MyScanner sc = new MyScanner();\n out = new PrintWriter(new BufferedOutputStream(System.out));\n // Start writing your solution here. -------------------------------------\n //int t = sc.nextInt();\n int t = 1;\n while(t-- > 0){\n long threshold = 1000000000000000000L;\n int n = sc.nextInt();\n long res = 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 {\n System.out.println(0);\n return;\n }\n }\n boolean printed = false;\n for(int i = 0; i < n; i++)\n {\n if(threshold / res < a[i])\n {\n System.out.println(-1);\n return;\n }\n res *= a[i];\n }\n out.println(res);\n }\n out.close();\n }",
"MyScanner sc = new MyScanner();",
"sc",
"new MyScanner()",
"out = new PrintWriter(new BufferedOutputStream(System.out))",
"out",
"new PrintWriter(new BufferedOutputStream(System.out))",
"int t = 1;",
"t",
"1",
"while(t-- > 0){\n long threshold = 1000000000000000000L;\n int n = sc.nextInt();\n long res = 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 {\n System.out.println(0);\n return;\n }\n }\n boolean printed = false;\n for(int i = 0; i < n; i++)\n {\n if(threshold / res < a[i])\n {\n System.out.println(-1);\n return;\n }\n res *= a[i];\n }\n out.println(res);\n }",
"t-- > 0",
"t--",
"t",
"0",
"{\n long threshold = 1000000000000000000L;\n int n = sc.nextInt();\n long res = 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 {\n System.out.println(0);\n return;\n }\n }\n boolean printed = false;\n for(int i = 0; i < n; i++)\n {\n if(threshold / res < a[i])\n {\n System.out.println(-1);\n return;\n }\n res *= a[i];\n }\n out.println(res);\n }",
"long threshold = 1000000000000000000L;",
"threshold",
"1000000000000000000L",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long res = 1L;",
"res",
"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 {\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 {\n System.out.println(0);\n return;\n }\n }",
"{\n a[i] = sc.nextLong();\n if(a[i] == 0)\n {\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 {\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;",
"boolean printed = false;",
"printed",
"false",
"for(int i = 0; i < n; i++)\n {\n if(threshold / res < a[i])\n {\n System.out.println(-1);\n return;\n }\n res *= a[i];\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(threshold / res < a[i])\n {\n System.out.println(-1);\n return;\n }\n res *= a[i];\n }",
"{\n if(threshold / res < a[i])\n {\n System.out.println(-1);\n return;\n }\n res *= a[i];\n }",
"if(threshold / res < a[i])\n {\n System.out.println(-1);\n return;\n }",
"threshold / res < a[i]",
"threshold / res",
"threshold",
"res",
"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;",
"res *= a[i]",
"res",
"a[i]",
"a",
"i",
"out.println(res)",
"out.println",
"out",
"res",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"public static long C(int n, int m)\n {\n if(m == 0 || m == n) return 1l;\n if(m > n || m < 0) return 0l;\n long res = fac[n] * quickPOW((fac[m] * fac[n - m]) % MOD, MOD - 2) % MOD;\n\n return res;\n }",
"C",
"{\n if(m == 0 || m == n) return 1l;\n if(m > n || m < 0) return 0l;\n long res = fac[n] * quickPOW((fac[m] * fac[n - m]) % MOD, MOD - 2) % MOD;\n\n return res;\n }",
"if(m == 0 || m == n) return 1l;",
"m == 0 || m == n",
"m == 0",
"m",
"0",
"m == n",
"m",
"n",
"return 1l;",
"1l",
"if(m > n || m < 0) return 0l;",
"m > n || m < 0",
"m > n",
"m",
"n",
"m < 0",
"m",
"0",
"return 0l;",
"0l",
"long res = fac[n] * quickPOW((fac[m] * fac[n - m]) % MOD, MOD - 2) % MOD;",
"res",
"fac[n] * quickPOW((fac[m] * fac[n - m]) % MOD, MOD - 2) % MOD",
"fac[n] * quickPOW((fac[m] * fac[n - m]) % MOD, MOD - 2)",
"fac[n]",
"fac",
"n",
"quickPOW((fac[m] * fac[n - m]) % MOD, MOD - 2)",
"quickPOW",
"(fac[m] * fac[n - m]) % MOD",
"(fac[m] * fac[n - m])",
"fac[m]",
"fac",
"m",
"fac[n - m]",
"fac",
"n - m",
"n",
"m",
"MOD",
"MOD - 2",
"MOD",
"2",
"MOD",
"return res;",
"res",
"int n",
"n",
"int m",
"m",
"public static long quickPOW(long n, long m)\n {\n long ans = 1l;\n while(m > 0)\n {\n if(m % 2 == 1)\n ans = (ans * n) % MOD;\n n = (n * n) % MOD;\n m >>= 1;\n }\n return ans;\n }",
"quickPOW",
"{\n long ans = 1l;\n while(m > 0)\n {\n if(m % 2 == 1)\n ans = (ans * n) % MOD;\n n = (n * n) % MOD;\n m >>= 1;\n }\n return ans;\n }",
"long ans = 1l;",
"ans",
"1l",
"while(m > 0)\n {\n if(m % 2 == 1)\n ans = (ans * n) % MOD;\n n = (n * n) % MOD;\n m >>= 1;\n }",
"m > 0",
"m",
"0",
"{\n if(m % 2 == 1)\n ans = (ans * n) % MOD;\n n = (n * n) % MOD;\n m >>= 1;\n }",
"if(m % 2 == 1)\n ans = (ans * n) % MOD;",
"m % 2 == 1",
"m % 2",
"m",
"2",
"1",
"ans = (ans * n) % MOD",
"ans",
"(ans * n) % MOD",
"(ans * n)",
"ans",
"n",
"MOD",
"n = (n * n) % MOD",
"n",
"(n * n) % MOD",
"(n * n)",
"n",
"n",
"MOD",
"m >>= 1",
"m",
"1",
"return ans;",
"ans",
"long n",
"n",
"long m",
"m",
"public static int gcd(int a, int b)\n {\n if(a % b == 0) return b;\n return gcd(b, a % b);\n }",
"gcd",
"{\n if(a % b == 0) return b;\n return gcd(b, a % b);\n }",
"if(a % b == 0) return b;",
"a % b == 0",
"a % b",
"a",
"b",
"0",
"return b;",
"b",
"return gcd(b, a % b);",
"gcd(b, a % b)",
"gcd",
"b",
"a % b",
"a",
"b",
"int a",
"a",
"int b",
"b",
"public static long gcd(long a, long b)\n {\n if(a % b == 0) return b;\n return gcd(b, a % b);\n }",
"gcd",
"{\n if(a % b == 0) return b;\n return gcd(b, a % b);\n }",
"if(a % b == 0) return b;",
"a % b == 0",
"a % b",
"a",
"b",
"0",
"return b;",
"b",
"return gcd(b, a % b);",
"gcd(b, a % b)",
"gcd",
"b",
"a % b",
"a",
"b",
"long a",
"a",
"long b",
"b",
"public static long solve(long cur){\n return 0L;\n }",
"solve",
"{\n return 0L;\n }",
"return 0L;",
"0L",
"long cur",
"cur",
"public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\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 int nextInt() {\n return Integer.parseInt(next());\n }\n long nextLong() {\n return Long.parseLong(next());\n }\n double nextDouble() {\n return Double.parseDouble(next());\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 }",
"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 long MOD = 1000000007L;\n static long [] fac;\n static int[][] dir = new int[][]{{1, 0}, {0, 1}, {-1, 0}, {0, -1}};\n static long lMax = 0x3f3f3f3f3f3f3f3fL;\n static int iMax = 0x3f3f3f3f;\n static HashMap <Long, Long> memo = new HashMap();\n static int n, m;\n static int[][] mat;\n public static void main(String[] args) {\n MyScanner sc = new MyScanner();\n out = new PrintWriter(new BufferedOutputStream(System.out));\n // Start writing your solution here. -------------------------------------\n //int t = sc.nextInt();\n int t = 1;\n while(t-- > 0){\n long threshold = 1000000000000000000L;\n int n = sc.nextInt();\n long res = 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 {\n System.out.println(0);\n return;\n }\n }\n boolean printed = false;\n for(int i = 0; i < n; i++)\n {\n if(threshold / res < a[i])\n {\n System.out.println(-1);\n return;\n }\n res *= a[i];\n }\n out.println(res);\n }\n out.close();\n }\n public static long C(int n, int m)\n {\n if(m == 0 || m == n) return 1l;\n if(m > n || m < 0) return 0l;\n long res = fac[n] * quickPOW((fac[m] * fac[n - m]) % MOD, MOD - 2) % MOD;\n\n return res;\n }\n public static long quickPOW(long n, long m)\n {\n long ans = 1l;\n while(m > 0)\n {\n if(m % 2 == 1)\n ans = (ans * n) % MOD;\n n = (n * n) % MOD;\n m >>= 1;\n }\n return ans;\n }\n public static int gcd(int a, int b)\n {\n if(a % b == 0) return b;\n return gcd(b, a % b);\n }\n public static long gcd(long a, long b)\n {\n if(a % b == 0) return b;\n return gcd(b, a % b);\n }\n public static long solve(long cur){\n return 0L;\n }\n //-----------PrintWriter for faster output---------------------------------\n public static PrintWriter out;\n //-----------MyScanner class for faster input----------\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 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 int nextInt() {\n return Integer.parseInt(next());\n }\n long nextLong() {\n return Long.parseLong(next());\n }\n double nextDouble() {\n return Double.parseDouble(next());\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 long MOD = 1000000007L;\n static long [] fac;\n static int[][] dir = new int[][]{{1, 0}, {0, 1}, {-1, 0}, {0, -1}};\n static long lMax = 0x3f3f3f3f3f3f3f3fL;\n static int iMax = 0x3f3f3f3f;\n static HashMap <Long, Long> memo = new HashMap();\n static int n, m;\n static int[][] mat;\n public static void main(String[] args) {\n MyScanner sc = new MyScanner();\n out = new PrintWriter(new BufferedOutputStream(System.out));\n // Start writing your solution here. -------------------------------------\n //int t = sc.nextInt();\n int t = 1;\n while(t-- > 0){\n long threshold = 1000000000000000000L;\n int n = sc.nextInt();\n long res = 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 {\n System.out.println(0);\n return;\n }\n }\n boolean printed = false;\n for(int i = 0; i < n; i++)\n {\n if(threshold / res < a[i])\n {\n System.out.println(-1);\n return;\n }\n res *= a[i];\n }\n out.println(res);\n }\n out.close();\n }\n public static long C(int n, int m)\n {\n if(m == 0 || m == n) return 1l;\n if(m > n || m < 0) return 0l;\n long res = fac[n] * quickPOW((fac[m] * fac[n - m]) % MOD, MOD - 2) % MOD;\n\n return res;\n }\n public static long quickPOW(long n, long m)\n {\n long ans = 1l;\n while(m > 0)\n {\n if(m % 2 == 1)\n ans = (ans * n) % MOD;\n n = (n * n) % MOD;\n m >>= 1;\n }\n return ans;\n }\n public static int gcd(int a, int b)\n {\n if(a % b == 0) return b;\n return gcd(b, a % b);\n }\n public static long gcd(long a, long b)\n {\n if(a % b == 0) return b;\n return gcd(b, a % b);\n }\n public static long solve(long cur){\n return 0L;\n }\n //-----------PrintWriter for faster output---------------------------------\n public static PrintWriter out;\n //-----------MyScanner class for faster input----------\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 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 int nextInt() {\n return Integer.parseInt(next());\n }\n long nextLong() {\n return Long.parseLong(next());\n }\n double nextDouble() {\n return Double.parseDouble(next());\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.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.*;
import java.util.regex.*;
import java.util.stream.*;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;
public class Main{
static long MOD = 1000000007L;
static long [] fac;
static int[][] dir = new int[][]{{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
static long lMax = 0x3f3f3f3f3f3f3f3fL;
static int iMax = 0x3f3f3f3f;
static HashMap <Long, Long> memo = new HashMap();
static int n, m;
static int[][] mat;
public static void main(String[] args) {
MyScanner sc = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
// Start writing your solution here. -------------------------------------
//int t = sc.nextInt();
int t = 1;
while(t-- > 0){
long threshold = 1000000000000000000L;
int n = sc.nextInt();
long res = 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;
}
}
boolean printed = false;
for(int i = 0; i < n; i++)
{
if(threshold / res < a[i])
{
System.out.println(-1);
return;
}
res *= a[i];
}
out.println(res);
}
out.close();
}
public static long C(int n, int m)
{
if(m == 0 || m == n) return 1l;
if(m > n || m < 0) return 0l;
long res = fac[n] * quickPOW((fac[m] * fac[n - m]) % MOD, MOD - 2) % MOD;
return res;
}
public static long quickPOW(long n, long m)
{
long ans = 1l;
while(m > 0)
{
if(m % 2 == 1)
ans = (ans * n) % MOD;
n = (n * n) % MOD;
m >>= 1;
}
return ans;
}
public static int gcd(int a, int b)
{
if(a % b == 0) return b;
return gcd(b, a % b);
}
public static long gcd(long a, long b)
{
if(a % b == 0) return b;
return gcd(b, a % b);
}
public static long solve(long cur){
return 0L;
}
//-----------PrintWriter for faster output---------------------------------
public static PrintWriter out;
//-----------MyScanner class for faster input----------
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,
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
],
[
9,
15
],
[
15,
16
]
] |
[
"\nimport java.util.*;\nimport java.math.*;\n\nclass Main {\n\tpublic static void main(String args[]) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tprocess: {\n\t\t\tint num = sc.nextInt();\n\t\t\tString[] input = new String[num];\n\t\t\tfor (int j = 0; j < num; j++) {\n\t\t\t\tinput[j] = sc.next();\n\t\t\t}\n\t\t\tfor (int k = 0; k < num; k++) {\n\t\t\t\tif (input[k].equals(\"0\")) {\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\tbreak process;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (int k = 0; k < num; k++) {\n\t\t\t\tif (input[k].length() >= 18) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\tbreak process;\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tBigInteger[] bigArray = new BigInteger[num];\n\t\t\tfor (int i = 0; i < num; i++) {\n\t\t\t\tbigArray[i] = new BigInteger(input[i]);\n\t\t\t}\n\t\t\tBigInteger ans = new BigInteger(input[0]);\n\t\t\tfor (int i = 1; i < num; i++) {\n\t\t\t\tans = ans.multiply(bigArray[i]);\n\t\t\t}\n\n\t\t\tif (ans.compareTo(new BigInteger(\"1000000000000000000\")) == 1) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t} else {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t}\n\t\t\tsc.close();\n\t\t}\n\t}// main\n}\n// class",
"import java.util.*;",
"util.*",
"java",
"import java.math.*;",
"math.*",
"java",
"class Main {\n\tpublic static void main(String args[]) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tprocess: {\n\t\t\tint num = sc.nextInt();\n\t\t\tString[] input = new String[num];\n\t\t\tfor (int j = 0; j < num; j++) {\n\t\t\t\tinput[j] = sc.next();\n\t\t\t}\n\t\t\tfor (int k = 0; k < num; k++) {\n\t\t\t\tif (input[k].equals(\"0\")) {\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\tbreak process;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (int k = 0; k < num; k++) {\n\t\t\t\tif (input[k].length() >= 18) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\tbreak process;\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tBigInteger[] bigArray = new BigInteger[num];\n\t\t\tfor (int i = 0; i < num; i++) {\n\t\t\t\tbigArray[i] = new BigInteger(input[i]);\n\t\t\t}\n\t\t\tBigInteger ans = new BigInteger(input[0]);\n\t\t\tfor (int i = 1; i < num; i++) {\n\t\t\t\tans = ans.multiply(bigArray[i]);\n\t\t\t}\n\n\t\t\tif (ans.compareTo(new BigInteger(\"1000000000000000000\")) == 1) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t} else {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t}\n\t\t\tsc.close();\n\t\t}\n\t}// main\n}",
"Main",
"public static void main(String args[]) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tprocess: {\n\t\t\tint num = sc.nextInt();\n\t\t\tString[] input = new String[num];\n\t\t\tfor (int j = 0; j < num; j++) {\n\t\t\t\tinput[j] = sc.next();\n\t\t\t}\n\t\t\tfor (int k = 0; k < num; k++) {\n\t\t\t\tif (input[k].equals(\"0\")) {\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\tbreak process;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (int k = 0; k < num; k++) {\n\t\t\t\tif (input[k].length() >= 18) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\tbreak process;\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tBigInteger[] bigArray = new BigInteger[num];\n\t\t\tfor (int i = 0; i < num; i++) {\n\t\t\t\tbigArray[i] = new BigInteger(input[i]);\n\t\t\t}\n\t\t\tBigInteger ans = new BigInteger(input[0]);\n\t\t\tfor (int i = 1; i < num; i++) {\n\t\t\t\tans = ans.multiply(bigArray[i]);\n\t\t\t}\n\n\t\t\tif (ans.compareTo(new BigInteger(\"1000000000000000000\")) == 1) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t} else {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t}\n\t\t\tsc.close();\n\t\t}\n\t}// main",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tprocess: {\n\t\t\tint num = sc.nextInt();\n\t\t\tString[] input = new String[num];\n\t\t\tfor (int j = 0; j < num; j++) {\n\t\t\t\tinput[j] = sc.next();\n\t\t\t}\n\t\t\tfor (int k = 0; k < num; k++) {\n\t\t\t\tif (input[k].equals(\"0\")) {\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\tbreak process;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (int k = 0; k < num; k++) {\n\t\t\t\tif (input[k].length() >= 18) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\tbreak process;\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tBigInteger[] bigArray = new BigInteger[num];\n\t\t\tfor (int i = 0; i < num; i++) {\n\t\t\t\tbigArray[i] = new BigInteger(input[i]);\n\t\t\t}\n\t\t\tBigInteger ans = new BigInteger(input[0]);\n\t\t\tfor (int i = 1; i < num; i++) {\n\t\t\t\tans = ans.multiply(bigArray[i]);\n\t\t\t}\n\n\t\t\tif (ans.compareTo(new BigInteger(\"1000000000000000000\")) == 1) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t} else {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t}\n\t\t\tsc.close();\n\t\t}\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"String args[]",
"args"
] |
import java.util.*;
import java.math.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
process: {
int num = sc.nextInt();
String[] input = new String[num];
for (int j = 0; j < num; j++) {
input[j] = sc.next();
}
for (int k = 0; k < num; k++) {
if (input[k].equals("0")) {
System.out.println(0);
break process;
}
}
for (int k = 0; k < num; k++) {
if (input[k].length() >= 18) {
System.out.println(-1);
break process;
}
}
BigInteger[] bigArray = new BigInteger[num];
for (int i = 0; i < num; i++) {
bigArray[i] = new BigInteger(input[i]);
}
BigInteger ans = new BigInteger(input[0]);
for (int i = 1; i < num; i++) {
ans = ans.multiply(bigArray[i]);
}
if (ans.compareTo(new BigInteger("1000000000000000000")) == 1) {
System.out.println(-1);
} else {
System.out.println(ans);
}
sc.close();
}
}// main
}
// class
|
[
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,
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,
14,
4,
18,
13,
17,
30,
4,
18,
18,
13,
13,
17,
30,
41,
13,
17,
28,
13,
13,
30,
30,
14,
2,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
40,
17,
29,
0,
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
],
[
102,
11
],
[
102,
12
],
[
12,
13
],
[
12,
14
],
[
102,
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
],
[
27,
28
],
[
17,
29
],
[
29,
30
],
[
29,
31
],
[
17,
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
],
[
45,
48
],
[
48,
49
],
[
49,
50
],
[
17,
51
],
[
51,
52
],
[
52,
53
],
[
17,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
54,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
60,
65
],
[
54,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
70,
71
],
[
70,
72
],
[
70,
73
],
[
74,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
75,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
87,
88
],
[
81,
89
],
[
74,
90
],
[
90,
91
],
[
90,
92
],
[
66,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
15,
99
],
[
99,
100
],
[
0,
101
],
[
101,
102
],
[
101,
103
]
] |
[
"\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n final static Long MAX = 1000000000000000000L;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n sc.nextLine();\n List<Long> l = new ArrayList<Long>();\n for(int i = 0;i < n;i++) {\n l.add(sc.nextLong());\n }\n sc.close();\n\n if(l.contains(0L)) {\n System.out.println(0);\n }else {\n\n Long sum = 1L;\n\n for(Long l2:l) {\n if(sum > MAX/l2) {\n System.out.println(-1);\n return;\n }\n sum *= l2;\n }\n System.out.println(sum);\n }\n\n\n }\n\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 final static Long MAX = 1000000000000000000L;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n sc.nextLine();\n List<Long> l = new ArrayList<Long>();\n for(int i = 0;i < n;i++) {\n l.add(sc.nextLong());\n }\n sc.close();\n\n if(l.contains(0L)) {\n System.out.println(0);\n }else {\n\n Long sum = 1L;\n\n for(Long l2:l) {\n if(sum > MAX/l2) {\n System.out.println(-1);\n return;\n }\n sum *= l2;\n }\n System.out.println(sum);\n }\n\n\n }\n\n}",
"Main",
"final static Long MAX = 1000000000000000000L;",
"MAX",
"1000000000000000000L",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n sc.nextLine();\n List<Long> l = new ArrayList<Long>();\n for(int i = 0;i < n;i++) {\n l.add(sc.nextLong());\n }\n sc.close();\n\n if(l.contains(0L)) {\n System.out.println(0);\n }else {\n\n Long sum = 1L;\n\n for(Long l2:l) {\n if(sum > MAX/l2) {\n System.out.println(-1);\n return;\n }\n sum *= l2;\n }\n System.out.println(sum);\n }\n\n\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n sc.nextLine();\n List<Long> l = new ArrayList<Long>();\n for(int i = 0;i < n;i++) {\n l.add(sc.nextLong());\n }\n sc.close();\n\n if(l.contains(0L)) {\n System.out.println(0);\n }else {\n\n Long sum = 1L;\n\n for(Long l2:l) {\n if(sum > MAX/l2) {\n System.out.println(-1);\n return;\n }\n sum *= l2;\n }\n System.out.println(sum);\n }\n\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<Long> l = new ArrayList<Long>();",
"l",
"new ArrayList<Long>()",
"for(int i = 0;i < n;i++) {\n l.add(sc.nextLong());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n l.add(sc.nextLong());\n }",
"{\n l.add(sc.nextLong());\n }",
"l.add(sc.nextLong())",
"l.add",
"l",
"sc.nextLong()",
"sc.nextLong",
"sc",
"sc.close()",
"sc.close",
"sc",
"if(l.contains(0L)) {\n System.out.println(0);\n }else {\n\n Long sum = 1L;\n\n for(Long l2:l) {\n if(sum > MAX/l2) {\n System.out.println(-1);\n return;\n }\n sum *= l2;\n }\n System.out.println(sum);\n }",
"l.contains(0L)",
"l.contains",
"l",
"0L",
"{\n System.out.println(0);\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"{\n\n Long sum = 1L;\n\n for(Long l2:l) {\n if(sum > MAX/l2) {\n System.out.println(-1);\n return;\n }\n sum *= l2;\n }\n System.out.println(sum);\n }",
"Long sum = 1L;",
"sum",
"1L",
"for(Long l2:l) {\n if(sum > MAX/l2) {\n System.out.println(-1);\n return;\n }\n sum *= l2;\n }",
"Long l2",
"l",
"{\n if(sum > MAX/l2) {\n System.out.println(-1);\n return;\n }\n sum *= l2;\n }",
"{\n if(sum > MAX/l2) {\n System.out.println(-1);\n return;\n }\n sum *= l2;\n }",
"if(sum > MAX/l2) {\n System.out.println(-1);\n return;\n }",
"sum > MAX/l2",
"sum",
"MAX/l2",
"MAX",
"l2",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"sum *= l2",
"sum",
"l2",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"public class Main {\n\n final static Long MAX = 1000000000000000000L;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n sc.nextLine();\n List<Long> l = new ArrayList<Long>();\n for(int i = 0;i < n;i++) {\n l.add(sc.nextLong());\n }\n sc.close();\n\n if(l.contains(0L)) {\n System.out.println(0);\n }else {\n\n Long sum = 1L;\n\n for(Long l2:l) {\n if(sum > MAX/l2) {\n System.out.println(-1);\n return;\n }\n sum *= l2;\n }\n System.out.println(sum);\n }\n\n\n }\n\n}",
"public class Main {\n\n final static Long MAX = 1000000000000000000L;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n sc.nextLine();\n List<Long> l = new ArrayList<Long>();\n for(int i = 0;i < n;i++) {\n l.add(sc.nextLong());\n }\n sc.close();\n\n if(l.contains(0L)) {\n System.out.println(0);\n }else {\n\n Long sum = 1L;\n\n for(Long l2:l) {\n if(sum > MAX/l2) {\n System.out.println(-1);\n return;\n }\n sum *= l2;\n }\n System.out.println(sum);\n }\n\n\n }\n\n}",
"Main"
] |
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
final static Long MAX = 1000000000000000000L;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
sc.nextLine();
List<Long> l = new ArrayList<Long>();
for(int i = 0;i < n;i++) {
l.add(sc.nextLong());
}
sc.close();
if(l.contains(0L)) {
System.out.println(0);
}else {
Long sum = 1L;
for(Long l2:l) {
if(sum > MAX/l2) {
System.out.println(-1);
return;
}
sum *= l2;
}
System.out.println(sum);
}
}
}
|
[
7,
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,
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,
4,
18,
18,
13,
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,
2,
18,
13,
13,
13,
18,
13,
13,
13,
30,
0,
13,
17,
3,
0,
13,
18,
13,
13,
14,
13,
4,
18,
18,
13,
13,
40,
17,
4,
18,
18,
13,
13,
8,
2,
13,
17,
40,
17,
13,
23,
13,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
20,
17,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
23,
13,
12,
13,
30,
14,
2,
13,
40,
17,
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,
29,
40,
17,
29,
18,
13,
40,
13,
12,
13,
30,
41,
13,
4,
13,
42,
4,
13,
13,
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,
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,
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,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
29,
2,
13,
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,
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
],
[
375,
14
],
[
375,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
20,
22
],
[
17,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
25,
27
],
[
17,
28
],
[
28,
29
],
[
28,
30
],
[
17,
31
],
[
31,
32
],
[
31,
33
],
[
17,
34
],
[
34,
35
],
[
34,
36
],
[
17,
37
],
[
37,
38
],
[
38,
39
],
[
37,
40
],
[
37,
41
],
[
37,
42
],
[
17,
43
],
[
43,
44
],
[
44,
45
],
[
15,
46
],
[
46,
47
],
[
375,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
52,
58
],
[
58,
59
],
[
58,
60
],
[
52,
62
],
[
62,
63
],
[
62,
64
],
[
52,
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
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
83,
84
],
[
77,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
86,
90
],
[
85,
91
],
[
91,
92
],
[
91,
93
],
[
52,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
94,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
106,
107
],
[
106,
108
],
[
102,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
109,
114
],
[
114,
115
],
[
114,
116
],
[
109,
117
],
[
117,
118
],
[
118,
119
],
[
109,
120
],
[
121,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
125,
129
],
[
124,
130
],
[
130,
131
],
[
130,
132
],
[
123,
133
],
[
122,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
121,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
141,
143
],
[
102,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
151,
152
],
[
144,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
153,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
158,
162
],
[
162,
163
],
[
158,
164
],
[
50,
165
],
[
165,
166
],
[
50,
167
],
[
167,
168
],
[
50,
169
],
[
169,
170
],
[
375,
171
],
[
171,
172
],
[
171,
173
],
[
173,
174
],
[
171,
175
],
[
175,
176
],
[
175,
177
],
[
171,
179
],
[
179,
180
],
[
171,
181
],
[
181,
182
],
[
171,
183
],
[
183,
184
],
[
183,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
186,
190
],
[
183,
191
],
[
191,
192
],
[
171,
193
],
[
193,
194
],
[
193,
195
],
[
195,
196
],
[
196,
197
],
[
197,
198
],
[
197,
199
],
[
199,
200
],
[
196,
201
],
[
201,
202
],
[
195,
203
],
[
203,
204
],
[
204,
205
],
[
204,
206
],
[
203,
207
],
[
207,
208
],
[
208,
209
],
[
208,
210
],
[
207,
211
],
[
211,
212
],
[
212,
213
],
[
212,
214
],
[
214,
215
],
[
215,
216
],
[
211,
217
],
[
217,
218
],
[
218,
219
],
[
218,
220
],
[
220,
221
],
[
221,
222
],
[
220,
223
],
[
207,
224
],
[
224,
225
],
[
225,
226
],
[
225,
227
],
[
224,
228
],
[
228,
229
],
[
229,
230
],
[
195,
231
],
[
231,
232
],
[
232,
233
],
[
232,
234
],
[
234,
235
],
[
171,
236
],
[
236,
237
],
[
236,
238
],
[
238,
239
],
[
239,
240
],
[
239,
241
],
[
241,
242
],
[
238,
243
],
[
243,
244
],
[
244,
245
],
[
244,
246
],
[
243,
247
],
[
247,
248
],
[
247,
249
],
[
249,
250
],
[
238,
251
],
[
251,
252
],
[
251,
253
],
[
238,
254
],
[
254,
255
],
[
255,
256
],
[
255,
257
],
[
254,
258
],
[
258,
259
],
[
259,
260
],
[
259,
261
],
[
261,
262
],
[
258,
263
],
[
263,
264
],
[
263,
265
],
[
265,
266
],
[
238,
267
],
[
267,
268
],
[
267,
269
],
[
238,
270
],
[
270,
271
],
[
271,
272
],
[
272,
273
],
[
272,
274
],
[
270,
275
],
[
275,
276
],
[
276,
277
],
[
276,
278
],
[
275,
279
],
[
279,
280
],
[
279,
281
],
[
281,
282
],
[
281,
283
],
[
275,
284
],
[
284,
285
],
[
284,
286
],
[
286,
287
],
[
238,
288
],
[
288,
289
],
[
289,
290
],
[
289,
291
],
[
171,
292
],
[
292,
293
],
[
292,
294
],
[
294,
295
],
[
295,
296
],
[
295,
297
],
[
297,
298
],
[
294,
299
],
[
299,
300
],
[
300,
301
],
[
300,
302
],
[
299,
303
],
[
303,
304
],
[
303,
305
],
[
305,
306
],
[
294,
307
],
[
307,
308
],
[
307,
309
],
[
294,
310
],
[
310,
311
],
[
311,
312
],
[
311,
313
],
[
310,
314
],
[
314,
315
],
[
315,
316
],
[
315,
317
],
[
317,
318
],
[
314,
319
],
[
319,
320
],
[
319,
321
],
[
321,
322
],
[
294,
323
],
[
323,
324
],
[
323,
325
],
[
294,
326
],
[
326,
327
],
[
327,
328
],
[
328,
329
],
[
328,
330
],
[
326,
331
],
[
331,
332
],
[
332,
333
],
[
332,
334
],
[
331,
335
],
[
335,
336
],
[
335,
337
],
[
337,
338
],
[
337,
339
],
[
331,
340
],
[
340,
341
],
[
340,
342
],
[
342,
343
],
[
294,
344
],
[
344,
345
],
[
345,
346
],
[
345,
347
],
[
171,
348
],
[
348,
349
],
[
348,
350
],
[
350,
351
],
[
351,
352
],
[
355,
353
],
[
365,
354
],
[
362,
355
],
[
355,
356
],
[
356,
357
],
[
356,
358
],
[
355,
359
],
[
359,
360
],
[
359,
361
],
[
362,
362
],
[
362,
363
],
[
362,
364
],
[
365,
365
],
[
365,
366
],
[
365,
367
],
[
355,
368
],
[
368,
369
],
[
368,
370
],
[
370,
371
],
[
348,
372
],
[
372,
373
],
[
0,
374
],
[
374,
375
],
[
374,
376
]
] |
[
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Spandan Mishra\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.readInt();\n long[] a = new long[n];\n boolean zero = false;\n for (int i = 0; i < n; i++) {\n a[i] = in.readLong();\n if (a[i] == 0)\n zero = true;\n }\n\n if (zero)\n System.out.println(0);\n else { //-1 or product case\n long res = 1;\n boolean neg = false;\n for (int i = 0; i < n; i++) {\n if ((a[i] * res) / a[i] != res) { //overflow check\n neg = true;\n break;\n }\n res *= a[i];\n\n }\n\n if (neg)\n System.out.println(-1);\n else\n System.out.println(res > (long) 1e18 ? -1 : res);\n\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\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1)\n throw new RuntimeException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new RuntimeException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int readInt() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long readLong() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\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 return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n }\n}\n",
"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",
"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.readInt();\n long[] a = new long[n];\n boolean zero = false;\n for (int i = 0; i < n; i++) {\n a[i] = in.readLong();\n if (a[i] == 0)\n zero = true;\n }\n\n if (zero)\n System.out.println(0);\n else { //-1 or product case\n long res = 1;\n boolean neg = false;\n for (int i = 0; i < n; i++) {\n if ((a[i] * res) / a[i] != res) { //overflow check\n neg = true;\n break;\n }\n res *= a[i];\n\n }\n\n if (neg)\n System.out.println(-1);\n else\n System.out.println(res > (long) 1e18 ? -1 : res);\n\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\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1)\n throw new RuntimeException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new RuntimeException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int readInt() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long readLong() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\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 return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\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.readInt();\n long[] a = new long[n];\n boolean zero = false;\n for (int i = 0; i < n; i++) {\n a[i] = in.readLong();\n if (a[i] == 0)\n zero = true;\n }\n\n if (zero)\n System.out.println(0);\n else { //-1 or product case\n long res = 1;\n boolean neg = false;\n for (int i = 0; i < n; i++) {\n if ((a[i] * res) / a[i] != res) { //overflow check\n neg = true;\n break;\n }\n res *= a[i];\n\n }\n\n if (neg)\n System.out.println(-1);\n else\n System.out.println(res > (long) 1e18 ? -1 : res);\n\n\n }\n }\n\n }",
"BMultiplication2",
"public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.readInt();\n long[] a = new long[n];\n boolean zero = false;\n for (int i = 0; i < n; i++) {\n a[i] = in.readLong();\n if (a[i] == 0)\n zero = true;\n }\n\n if (zero)\n System.out.println(0);\n else { //-1 or product case\n long res = 1;\n boolean neg = false;\n for (int i = 0; i < n; i++) {\n if ((a[i] * res) / a[i] != res) { //overflow check\n neg = true;\n break;\n }\n res *= a[i];\n\n }\n\n if (neg)\n System.out.println(-1);\n else\n System.out.println(res > (long) 1e18 ? -1 : res);\n\n\n }\n }",
"solve",
"{\n int n = in.readInt();\n long[] a = new long[n];\n boolean zero = false;\n for (int i = 0; i < n; i++) {\n a[i] = in.readLong();\n if (a[i] == 0)\n zero = true;\n }\n\n if (zero)\n System.out.println(0);\n else { //-1 or product case\n long res = 1;\n boolean neg = false;\n for (int i = 0; i < n; i++) {\n if ((a[i] * res) / a[i] != res) { //overflow check\n neg = true;\n break;\n }\n res *= a[i];\n\n }\n\n if (neg)\n System.out.println(-1);\n else\n System.out.println(res > (long) 1e18 ? -1 : res);\n\n\n }\n }",
"int n = in.readInt();",
"n",
"in.readInt()",
"in.readInt",
"in",
"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] = in.readLong();\n if (a[i] == 0)\n zero = true;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = in.readLong();\n if (a[i] == 0)\n zero = true;\n }",
"{\n a[i] = in.readLong();\n if (a[i] == 0)\n zero = true;\n }",
"a[i] = in.readLong()",
"a[i]",
"a",
"i",
"in.readLong()",
"in.readLong",
"in",
"if (a[i] == 0)\n zero = true;",
"a[i] == 0",
"a[i]",
"a",
"i",
"0",
"zero = true",
"zero",
"true",
"if (zero)\n System.out.println(0);\n else { //-1 or product case\n long res = 1;\n boolean neg = false;\n for (int i = 0; i < n; i++) {\n if ((a[i] * res) / a[i] != res) { //overflow check\n neg = true;\n break;\n }\n res *= a[i];\n\n }\n\n if (neg)\n System.out.println(-1);\n else\n System.out.println(res > (long) 1e18 ? -1 : res);\n\n\n }",
"zero",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"{ //-1 or product case\n long res = 1;\n boolean neg = false;\n for (int i = 0; i < n; i++) {\n if ((a[i] * res) / a[i] != res) { //overflow check\n neg = true;\n break;\n }\n res *= a[i];\n\n }\n\n if (neg)\n System.out.println(-1);\n else\n System.out.println(res > (long) 1e18 ? -1 : res);\n\n\n }",
"long res = 1;",
"res",
"1",
"boolean neg = false;",
"neg",
"false",
"for (int i = 0; i < n; i++) {\n if ((a[i] * res) / a[i] != res) { //overflow check\n neg = true;\n break;\n }\n res *= a[i];\n\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if ((a[i] * res) / a[i] != res) { //overflow check\n neg = true;\n break;\n }\n res *= a[i];\n\n }",
"{\n if ((a[i] * res) / a[i] != res) { //overflow check\n neg = true;\n break;\n }\n res *= a[i];\n\n }",
"if ((a[i] * res) / a[i] != res) { //overflow check\n neg = true;\n break;\n }",
"(a[i] * res) / a[i] != res",
"(a[i] * res) / a[i]",
"(a[i] * res)",
"a[i]",
"a",
"i",
"res",
"a[i]",
"a",
"i",
"res",
"{ //overflow check\n neg = true;\n break;\n }",
"neg = true",
"neg",
"true",
"break;",
"res *= a[i]",
"res",
"a[i]",
"a",
"i",
"if (neg)\n System.out.println(-1);\n else\n System.out.println(res > (long) 1e18 ? -1 : res);",
"neg",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"System.out.println(res > (long) 1e18 ? -1 : res)",
"System.out.println",
"System.out",
"System",
"System.out",
"res > (long) 1e18 ? -1 : res",
"res > (long) 1e18",
"res",
"(long) 1e18",
"-1",
"1",
"res",
"int testNumber",
"testNumber",
"InputReader in",
"in",
"PrintWriter 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\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1)\n throw new RuntimeException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new RuntimeException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int readInt() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long readLong() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\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 return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\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",
"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 RuntimeException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new RuntimeException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }",
"read",
"{\n if (numChars == -1)\n throw new RuntimeException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new RuntimeException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }",
"if (numChars == -1)\n throw new RuntimeException();",
"numChars == -1",
"numChars",
"-1",
"1",
"throw new RuntimeException();",
"new RuntimeException()",
"if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new RuntimeException();\n }\n if (numChars <= 0)\n return -1;\n }",
"curChar >= numChars",
"curChar",
"numChars",
"{\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new RuntimeException();\n }\n if (numChars <= 0)\n return -1;\n }",
"curChar = 0",
"curChar",
"0",
"try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new RuntimeException();\n }",
"catch (IOException e) {\n throw new RuntimeException();\n }",
"IOException e",
"{\n throw new RuntimeException();\n }",
"throw new RuntimeException();",
"new RuntimeException()",
"{\n numChars = stream.read(buf);\n }",
"numChars = stream.read(buf)",
"numChars",
"stream.read(buf)",
"stream.read",
"stream",
"buf",
"if (numChars <= 0)\n return -1;",
"numChars <= 0",
"numChars",
"0",
"return -1;",
"-1",
"1",
"return buf[curChar++];",
"buf[curChar++]",
"buf",
"curChar++",
"curChar",
"public int readInt() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"readInt",
"{\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\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();",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"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 res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n res *= 10;\n res += c - '0';\n c = read();\n }",
"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 readLong() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"readLong",
"{\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\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();",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"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 res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n res *= 10;\n res += c - '0';\n c = read();\n }",
"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 return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"isSpaceChar",
"{\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 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.readInt();\n long[] a = new long[n];\n boolean zero = false;\n for (int i = 0; i < n; i++) {\n a[i] = in.readLong();\n if (a[i] == 0)\n zero = true;\n }\n\n if (zero)\n System.out.println(0);\n else { //-1 or product case\n long res = 1;\n boolean neg = false;\n for (int i = 0; i < n; i++) {\n if ((a[i] * res) / a[i] != res) { //overflow check\n neg = true;\n break;\n }\n res *= a[i];\n\n }\n\n if (neg)\n System.out.println(-1);\n else\n System.out.println(res > (long) 1e18 ? -1 : res);\n\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\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1)\n throw new RuntimeException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new RuntimeException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int readInt() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long readLong() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\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 return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\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.readInt();\n long[] a = new long[n];\n boolean zero = false;\n for (int i = 0; i < n; i++) {\n a[i] = in.readLong();\n if (a[i] == 0)\n zero = true;\n }\n\n if (zero)\n System.out.println(0);\n else { //-1 or product case\n long res = 1;\n boolean neg = false;\n for (int i = 0; i < n; i++) {\n if ((a[i] * res) / a[i] != res) { //overflow check\n neg = true;\n break;\n }\n res *= a[i];\n\n }\n\n if (neg)\n System.out.println(-1);\n else\n System.out.println(res > (long) 1e18 ? -1 : res);\n\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\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1)\n throw new RuntimeException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new RuntimeException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int readInt() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long readLong() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\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 return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n }\n}",
"Main"
] |
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Spandan Mishra
*/
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.readInt();
long[] a = new long[n];
boolean zero = false;
for (int i = 0; i < n; i++) {
a[i] = in.readLong();
if (a[i] == 0)
zero = true;
}
if (zero)
System.out.println(0);
else { //-1 or product case
long res = 1;
boolean neg = false;
for (int i = 0; i < n; i++) {
if ((a[i] * res) / a[i] != res) { //overflow check
neg = true;
break;
}
res *= a[i];
}
if (neg)
System.out.println(-1);
else
System.out.println(res > (long) 1e18 ? -1 : res);
}
}
}
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
public InputReader(InputStream stream) {
this.stream = stream;
}
public int read() {
if (numChars == -1)
throw new RuntimeException();
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new RuntimeException();
}
if (numChars <= 0)
return -1;
}
return buf[curChar++];
}
public int readInt() {
int c = read();
while (isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public long readLong() {
int c = read();
while (isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
long res = 0;
do {
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public boolean isSpaceChar(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
}
}
|
[
7,
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,
41,
13,
20,
13,
41,
13,
4,
18,
13,
17,
17,
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,
14,
13,
30,
4,
18,
13,
17,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
13,
13,
30,
0,
13,
17,
3,
0,
13,
18,
13,
13,
14,
13,
30,
4,
18,
13,
40,
17,
30,
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
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
134,
14
],
[
134,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
17,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
17,
29
],
[
29,
30
],
[
29,
31
],
[
17,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
35,
38
],
[
35,
39
],
[
17,
40
],
[
40,
41
],
[
40,
42
],
[
17,
43
],
[
43,
44
],
[
43,
45
],
[
17,
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
],
[
73,
75
],
[
17,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
79,
82
],
[
76,
83
],
[
83,
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
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
97,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
96,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
83,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
118,
121
],
[
121,
122
],
[
115,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
124,
127
],
[
17,
128
],
[
128,
129
],
[
129,
130
],
[
15,
131
],
[
131,
132
],
[
0,
133
],
[
133,
134
],
[
133,
135
]
] |
[
"import java.util.*;\nimport java.lang.*;\nimport java.math.*;\nimport java.io.*;\npublic class Main{\n public static void main(String agrs[])\n {\n Scanner in = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n int n = in.nextInt();\n long[] arr = new long[n];\n long max = (long) Math.pow(10,18);\n boolean zero = false;\n long counter = 1;\n for(int i = 0; i < n; i++)\n {\n arr[i] = in.nextLong();\n if(arr[i] == 0)\n {\n zero = true;\n }\n }\n if(zero)\n {\n out.println(0);\n }\n else\n {\n for(int i = 0; i < n; i++)\n {\n if(arr[i] > max / counter)\n {\n zero = true;\n break;\n }\n counter *= arr[i];\n }\n if(zero)\n {\n out.println(-1);\n }\n else\n {\n out.println(counter);\n }\n }\n out.close();\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.lang.*;",
"lang.*",
"java",
"import java.math.*;",
"math.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main{\n public static void main(String agrs[])\n {\n Scanner in = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n int n = in.nextInt();\n long[] arr = new long[n];\n long max = (long) Math.pow(10,18);\n boolean zero = false;\n long counter = 1;\n for(int i = 0; i < n; i++)\n {\n arr[i] = in.nextLong();\n if(arr[i] == 0)\n {\n zero = true;\n }\n }\n if(zero)\n {\n out.println(0);\n }\n else\n {\n for(int i = 0; i < n; i++)\n {\n if(arr[i] > max / counter)\n {\n zero = true;\n break;\n }\n counter *= arr[i];\n }\n if(zero)\n {\n out.println(-1);\n }\n else\n {\n out.println(counter);\n }\n }\n out.close();\n }\n}",
"Main",
"public static void main(String agrs[])\n {\n Scanner in = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n int n = in.nextInt();\n long[] arr = new long[n];\n long max = (long) Math.pow(10,18);\n boolean zero = false;\n long counter = 1;\n for(int i = 0; i < n; i++)\n {\n arr[i] = in.nextLong();\n if(arr[i] == 0)\n {\n zero = true;\n }\n }\n if(zero)\n {\n out.println(0);\n }\n else\n {\n for(int i = 0; i < n; i++)\n {\n if(arr[i] > max / counter)\n {\n zero = true;\n break;\n }\n counter *= arr[i];\n }\n if(zero)\n {\n out.println(-1);\n }\n else\n {\n out.println(counter);\n }\n }\n out.close();\n }",
"main",
"{\n Scanner in = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n int n = in.nextInt();\n long[] arr = new long[n];\n long max = (long) Math.pow(10,18);\n boolean zero = false;\n long counter = 1;\n for(int i = 0; i < n; i++)\n {\n arr[i] = in.nextLong();\n if(arr[i] == 0)\n {\n zero = true;\n }\n }\n if(zero)\n {\n out.println(0);\n }\n else\n {\n for(int i = 0; i < n; i++)\n {\n if(arr[i] > max / counter)\n {\n zero = true;\n break;\n }\n counter *= arr[i];\n }\n if(zero)\n {\n out.println(-1);\n }\n else\n {\n out.println(counter);\n }\n }\n out.close();\n }",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"long[] arr = new long[n];",
"arr",
"new long[n]",
"n",
"long max = (long) Math.pow(10,18);",
"max",
"(long) Math.pow(10,18)",
"Math.pow",
"Math",
"10",
"18",
"boolean zero = false;",
"zero",
"false",
"long counter = 1;",
"counter",
"1",
"for(int i = 0; i < n; i++)\n {\n arr[i] = in.nextLong();\n if(arr[i] == 0)\n {\n zero = true;\n }\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)\n {\n zero = true;\n }\n }",
"{\n arr[i] = in.nextLong();\n if(arr[i] == 0)\n {\n zero = true;\n }\n }",
"arr[i] = in.nextLong()",
"arr[i]",
"arr",
"i",
"in.nextLong()",
"in.nextLong",
"in",
"if(arr[i] == 0)\n {\n zero = true;\n }",
"arr[i] == 0",
"arr[i]",
"arr",
"i",
"0",
"{\n zero = true;\n }",
"zero = true",
"zero",
"true",
"if(zero)\n {\n out.println(0);\n }\n else\n {\n for(int i = 0; i < n; i++)\n {\n if(arr[i] > max / counter)\n {\n zero = true;\n break;\n }\n counter *= arr[i];\n }\n if(zero)\n {\n out.println(-1);\n }\n else\n {\n out.println(counter);\n }\n }",
"zero",
"{\n out.println(0);\n }",
"out.println(0)",
"out.println",
"out",
"0",
"{\n for(int i = 0; i < n; i++)\n {\n if(arr[i] > max / counter)\n {\n zero = true;\n break;\n }\n counter *= arr[i];\n }\n if(zero)\n {\n out.println(-1);\n }\n else\n {\n out.println(counter);\n }\n }",
"for(int i = 0; i < n; i++)\n {\n if(arr[i] > max / counter)\n {\n zero = true;\n break;\n }\n counter *= arr[i];\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(arr[i] > max / counter)\n {\n zero = true;\n break;\n }\n counter *= arr[i];\n }",
"{\n if(arr[i] > max / counter)\n {\n zero = true;\n break;\n }\n counter *= arr[i];\n }",
"if(arr[i] > max / counter)\n {\n zero = true;\n break;\n }",
"arr[i] > max / counter",
"arr[i]",
"arr",
"i",
"max / counter",
"max",
"counter",
"{\n zero = true;\n break;\n }",
"zero = true",
"zero",
"true",
"break;",
"counter *= arr[i]",
"counter",
"arr[i]",
"arr",
"i",
"if(zero)\n {\n out.println(-1);\n }\n else\n {\n out.println(counter);\n }",
"zero",
"{\n out.println(-1);\n }",
"out.println(-1)",
"out.println",
"out",
"-1",
"1",
"{\n out.println(counter);\n }",
"out.println(counter)",
"out.println",
"out",
"counter",
"out.close()",
"out.close",
"out",
"String agrs[]",
"agrs",
"public class Main{\n public static void main(String agrs[])\n {\n Scanner in = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n int n = in.nextInt();\n long[] arr = new long[n];\n long max = (long) Math.pow(10,18);\n boolean zero = false;\n long counter = 1;\n for(int i = 0; i < n; i++)\n {\n arr[i] = in.nextLong();\n if(arr[i] == 0)\n {\n zero = true;\n }\n }\n if(zero)\n {\n out.println(0);\n }\n else\n {\n for(int i = 0; i < n; i++)\n {\n if(arr[i] > max / counter)\n {\n zero = true;\n break;\n }\n counter *= arr[i];\n }\n if(zero)\n {\n out.println(-1);\n }\n else\n {\n out.println(counter);\n }\n }\n out.close();\n }\n}",
"public class Main{\n public static void main(String agrs[])\n {\n Scanner in = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n int n = in.nextInt();\n long[] arr = new long[n];\n long max = (long) Math.pow(10,18);\n boolean zero = false;\n long counter = 1;\n for(int i = 0; i < n; i++)\n {\n arr[i] = in.nextLong();\n if(arr[i] == 0)\n {\n zero = true;\n }\n }\n if(zero)\n {\n out.println(0);\n }\n else\n {\n for(int i = 0; i < n; i++)\n {\n if(arr[i] > max / counter)\n {\n zero = true;\n break;\n }\n counter *= arr[i];\n }\n if(zero)\n {\n out.println(-1);\n }\n else\n {\n out.println(counter);\n }\n }\n out.close();\n }\n}",
"Main"
] |
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
public class Main{
public static void main(String agrs[])
{
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
long[] arr = new long[n];
long max = (long) Math.pow(10,18);
boolean zero = false;
long counter = 1;
for(int i = 0; i < n; i++)
{
arr[i] = in.nextLong();
if(arr[i] == 0)
{
zero = true;
}
}
if(zero)
{
out.println(0);
}
else
{
for(int i = 0; i < n; i++)
{
if(arr[i] > max / counter)
{
zero = true;
break;
}
counter *= arr[i];
}
if(zero)
{
out.println(-1);
}
else
{
out.println(counter);
}
}
out.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
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,
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,
2,
2,
4,
18,
13,
18,
13,
13,
4,
18,
13,
13,
17,
2,
2,
13,
18,
13,
13,
17,
30,
0,
13,
40,
17,
3,
0,
13,
18,
13,
13,
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
],
[
17,
20
],
[
20,
21
],
[
21,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
11,
26
],
[
26,
27
],
[
26,
28
],
[
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
],
[
47,
50
],
[
50,
51
],
[
51,
52
],
[
11,
53
],
[
53,
54
],
[
54,
55
],
[
53,
56
],
[
11,
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
],
[
77,
79
],
[
76,
80
],
[
69,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
88,
89
],
[
88,
90
],
[
84,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
83,
95
],
[
82,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
96,
102
],
[
81,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
103,
108
],
[
69,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
111,
113
],
[
11,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
9,
120
],
[
120,
121
]
] |
[
"import java.util.*;\nimport java.math.*;\nclass Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n long ans = 1;\n long[] s = new long[n];\n for(int i =0;i<n;i++){\n s[i]=Long.parseLong(sc.next());\n }\n Arrays.sort(s);\n for(int i = 0;i<n;i++){\n if(s[i]==0){\n ans = 0;\n break;\n }\n if(Math.log10(s[i])+Math.log10(ans)>18||ans*s[i]>1000000000000000000L){\n ans = -1;\n break;\n }\n ans*=s[i];\n }\n System.out.println(ans);\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 = Integer.parseInt(sc.next());\n long ans = 1;\n long[] s = new long[n];\n for(int i =0;i<n;i++){\n s[i]=Long.parseLong(sc.next());\n }\n Arrays.sort(s);\n for(int i = 0;i<n;i++){\n if(s[i]==0){\n ans = 0;\n break;\n }\n if(Math.log10(s[i])+Math.log10(ans)>18||ans*s[i]>1000000000000000000L){\n ans = -1;\n break;\n }\n ans*=s[i];\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 = Integer.parseInt(sc.next());\n long ans = 1;\n long[] s = new long[n];\n for(int i =0;i<n;i++){\n s[i]=Long.parseLong(sc.next());\n }\n Arrays.sort(s);\n for(int i = 0;i<n;i++){\n if(s[i]==0){\n ans = 0;\n break;\n }\n if(Math.log10(s[i])+Math.log10(ans)>18||ans*s[i]>1000000000000000000L){\n ans = -1;\n break;\n }\n ans*=s[i];\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n long ans = 1;\n long[] s = new long[n];\n for(int i =0;i<n;i++){\n s[i]=Long.parseLong(sc.next());\n }\n Arrays.sort(s);\n for(int i = 0;i<n;i++){\n if(s[i]==0){\n ans = 0;\n break;\n }\n if(Math.log10(s[i])+Math.log10(ans)>18||ans*s[i]>1000000000000000000L){\n ans = -1;\n break;\n }\n ans*=s[i];\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 ans = 1;",
"ans",
"1",
"long[] s = new long[n];",
"s",
"new long[n]",
"n",
"for(int i =0;i<n;i++){\n s[i]=Long.parseLong(sc.next());\n }",
"int i =0;",
"int i =0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i]=Long.parseLong(sc.next());\n }",
"{\n s[i]=Long.parseLong(sc.next());\n }",
"s[i]=Long.parseLong(sc.next())",
"s[i]",
"s",
"i",
"Long.parseLong(sc.next())",
"Long.parseLong",
"Long",
"sc.next()",
"sc.next",
"sc",
"Arrays.sort(s)",
"Arrays.sort",
"Arrays",
"s",
"for(int i = 0;i<n;i++){\n if(s[i]==0){\n ans = 0;\n break;\n }\n if(Math.log10(s[i])+Math.log10(ans)>18||ans*s[i]>1000000000000000000L){\n ans = -1;\n break;\n }\n ans*=s[i];\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(s[i]==0){\n ans = 0;\n break;\n }\n if(Math.log10(s[i])+Math.log10(ans)>18||ans*s[i]>1000000000000000000L){\n ans = -1;\n break;\n }\n ans*=s[i];\n }",
"{\n if(s[i]==0){\n ans = 0;\n break;\n }\n if(Math.log10(s[i])+Math.log10(ans)>18||ans*s[i]>1000000000000000000L){\n ans = -1;\n break;\n }\n ans*=s[i];\n }",
"if(s[i]==0){\n ans = 0;\n break;\n }",
"s[i]==0",
"s[i]",
"s",
"i",
"0",
"{\n ans = 0;\n break;\n }",
"ans = 0",
"ans",
"0",
"break;",
"if(Math.log10(s[i])+Math.log10(ans)>18||ans*s[i]>1000000000000000000L){\n ans = -1;\n break;\n }",
"Math.log10(s[i])+Math.log10(ans)>18||ans*s[i]>1000000000000000000L",
"Math.log10(s[i])+Math.log10(ans)>18",
"Math.log10(s[i])+Math.log10(ans)",
"Math.log10(s[i])",
"Math.log10",
"Math",
"s[i]",
"s",
"i",
"Math.log10(ans)",
"Math.log10",
"Math",
"ans",
"18",
"ans*s[i]>1000000000000000000L",
"ans*s[i]",
"ans",
"s[i]",
"s",
"i",
"1000000000000000000L",
"{\n ans = -1;\n break;\n }",
"ans = -1",
"ans",
"-1",
"1",
"break;",
"ans*=s[i]",
"ans",
"s[i]",
"s",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"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 = Integer.parseInt(sc.next());
long ans = 1;
long[] s = new long[n];
for(int i =0;i<n;i++){
s[i]=Long.parseLong(sc.next());
}
Arrays.sort(s);
for(int i = 0;i<n;i++){
if(s[i]==0){
ans = 0;
break;
}
if(Math.log10(s[i])+Math.log10(ans)>18||ans*s[i]>1000000000000000000L){
ans = -1;
break;
}
ans*=s[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,
0,
13,
17,
14,
2,
13,
17,
30,
41,
13,
4,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
2,
13,
13,
14,
2,
18,
13,
13,
13,
30,
0,
13,
40,
17,
3,
0,
13,
18,
13,
13,
14,
2,
13,
40,
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
],
[
123,
5
],
[
123,
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
],
[
50,
52
],
[
8,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
61,
62
],
[
60,
63
],
[
60,
64
],
[
57,
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
],
[
78,
80
],
[
80,
81
],
[
81,
82
],
[
80,
83
],
[
83,
84
],
[
83,
85
],
[
77,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
86,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
92,
97
],
[
86,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
8,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
103,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
103,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
6,
120
],
[
120,
121
],
[
0,
122
],
[
122,
123
],
[
122,
124
]
] |
[
"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 [] L = new long[n];\n long sum = 1;\n for(int i=0;i<n;i++){\n L[i]= sc.nextLong();\n if(L[i]==0) sum = 0;\n }\n if(sum!=0) {\n long lim = (long)Math.pow(10,18);\n for(int i=0;i<n;i++){\n long lim2 = (long)Math.ceil(lim/sum);\n if(L[i]>lim2){\n sum=-1;\n break;\n }\n else sum*=L[i];\n }\n }\n if(sum!=-1)System.out.println(sum);\n else System.out.println(\"-1\");\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 [] L = new long[n];\n long sum = 1;\n for(int i=0;i<n;i++){\n L[i]= sc.nextLong();\n if(L[i]==0) sum = 0;\n }\n if(sum!=0) {\n long lim = (long)Math.pow(10,18);\n for(int i=0;i<n;i++){\n long lim2 = (long)Math.ceil(lim/sum);\n if(L[i]>lim2){\n sum=-1;\n break;\n }\n else sum*=L[i];\n }\n }\n if(sum!=-1)System.out.println(sum);\n else System.out.println(\"-1\");\n }\n}",
"Main",
"public static void main(String [] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long [] L = new long[n];\n long sum = 1;\n for(int i=0;i<n;i++){\n L[i]= sc.nextLong();\n if(L[i]==0) sum = 0;\n }\n if(sum!=0) {\n long lim = (long)Math.pow(10,18);\n for(int i=0;i<n;i++){\n long lim2 = (long)Math.ceil(lim/sum);\n if(L[i]>lim2){\n sum=-1;\n break;\n }\n else sum*=L[i];\n }\n }\n if(sum!=-1)System.out.println(sum);\n else System.out.println(\"-1\");\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long [] L = new long[n];\n long sum = 1;\n for(int i=0;i<n;i++){\n L[i]= sc.nextLong();\n if(L[i]==0) sum = 0;\n }\n if(sum!=0) {\n long lim = (long)Math.pow(10,18);\n for(int i=0;i<n;i++){\n long lim2 = (long)Math.ceil(lim/sum);\n if(L[i]>lim2){\n sum=-1;\n break;\n }\n else sum*=L[i];\n }\n }\n if(sum!=-1)System.out.println(sum);\n else System.out.println(\"-1\");\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long [] L = new long[n];",
"L",
"new long[n]",
"n",
"long sum = 1;",
"sum",
"1",
"for(int i=0;i<n;i++){\n L[i]= sc.nextLong();\n if(L[i]==0) sum = 0;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n L[i]= sc.nextLong();\n if(L[i]==0) sum = 0;\n }",
"{\n L[i]= sc.nextLong();\n if(L[i]==0) sum = 0;\n }",
"L[i]= sc.nextLong()",
"L[i]",
"L",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(L[i]==0) sum = 0;",
"L[i]==0",
"L[i]",
"L",
"i",
"0",
"sum = 0",
"sum",
"0",
"if(sum!=0) {\n long lim = (long)Math.pow(10,18);\n for(int i=0;i<n;i++){\n long lim2 = (long)Math.ceil(lim/sum);\n if(L[i]>lim2){\n sum=-1;\n break;\n }\n else sum*=L[i];\n }\n }",
"sum!=0",
"sum",
"0",
"{\n long lim = (long)Math.pow(10,18);\n for(int i=0;i<n;i++){\n long lim2 = (long)Math.ceil(lim/sum);\n if(L[i]>lim2){\n sum=-1;\n break;\n }\n else sum*=L[i];\n }\n }",
"long lim = (long)Math.pow(10,18);",
"lim",
"(long)Math.pow(10,18)",
"Math.pow",
"Math",
"10",
"18",
"for(int i=0;i<n;i++){\n long lim2 = (long)Math.ceil(lim/sum);\n if(L[i]>lim2){\n sum=-1;\n break;\n }\n else sum*=L[i];\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n long lim2 = (long)Math.ceil(lim/sum);\n if(L[i]>lim2){\n sum=-1;\n break;\n }\n else sum*=L[i];\n }",
"{\n long lim2 = (long)Math.ceil(lim/sum);\n if(L[i]>lim2){\n sum=-1;\n break;\n }\n else sum*=L[i];\n }",
"long lim2 = (long)Math.ceil(lim/sum);",
"lim2",
"(long)Math.ceil(lim/sum)",
"Math.ceil",
"Math",
"lim/sum",
"lim",
"sum",
"if(L[i]>lim2){\n sum=-1;\n break;\n }\n else sum*=L[i];",
"L[i]>lim2",
"L[i]",
"L",
"i",
"lim2",
"{\n sum=-1;\n break;\n }",
"sum=-1",
"sum",
"-1",
"1",
"break;",
"sum*=L[i]",
"sum",
"L[i]",
"L",
"i",
"if(sum!=-1)System.out.println(sum);\n else System.out.println(\"-1\");",
"sum!=-1",
"sum",
"-1",
"1",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"System.out.println(\"-1\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"-1\"",
"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 [] L = new long[n];\n long sum = 1;\n for(int i=0;i<n;i++){\n L[i]= sc.nextLong();\n if(L[i]==0) sum = 0;\n }\n if(sum!=0) {\n long lim = (long)Math.pow(10,18);\n for(int i=0;i<n;i++){\n long lim2 = (long)Math.ceil(lim/sum);\n if(L[i]>lim2){\n sum=-1;\n break;\n }\n else sum*=L[i];\n }\n }\n if(sum!=-1)System.out.println(sum);\n else System.out.println(\"-1\");\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 [] L = new long[n];\n long sum = 1;\n for(int i=0;i<n;i++){\n L[i]= sc.nextLong();\n if(L[i]==0) sum = 0;\n }\n if(sum!=0) {\n long lim = (long)Math.pow(10,18);\n for(int i=0;i<n;i++){\n long lim2 = (long)Math.ceil(lim/sum);\n if(L[i]>lim2){\n sum=-1;\n break;\n }\n else sum*=L[i];\n }\n }\n if(sum!=-1)System.out.println(sum);\n else System.out.println(\"-1\");\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 [] L = new long[n];
long sum = 1;
for(int i=0;i<n;i++){
L[i]= sc.nextLong();
if(L[i]==0) sum = 0;
}
if(sum!=0) {
long lim = (long)Math.pow(10,18);
for(int i=0;i<n;i++){
long lim2 = (long)Math.ceil(lim/sum);
if(L[i]>lim2){
sum=-1;
break;
}
else sum*=L[i];
}
}
if(sum!=-1)System.out.println(sum);
else System.out.println("-1");
}
}
|
[
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,
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,
13,
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
],
[
116,
8
],
[
116,
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
],
[
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
],
[
11,
47
],
[
47,
48
],
[
48,
49
],
[
47,
50
],
[
11,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
53,
55
],
[
11,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
61,
62
],
[
61,
63
],
[
56,
64
],
[
64,
65
],
[
65,
66
],
[
56,
67
],
[
68,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
74,
75
],
[
74,
76
],
[
68,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
80,
83
],
[
79,
84
],
[
78,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
77,
89
],
[
89,
90
],
[
11,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
92,
97
],
[
91,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
99,
104
],
[
104,
105
],
[
91,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
9,
113
],
[
113,
114
],
[
0,
115
],
[
115,
116
],
[
115,
117
]
] |
[
"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 n = sc.nextInt();\n BigInteger[] A = new BigInteger[n];\n BigInteger max = new BigInteger(\"1000000000000000000\");\n for (int i = 0; i < n; i++) {\n A[i] = sc.nextBigInteger();\n }\n Arrays.sort(A);\n BigInteger ans = BigInteger.ONE;\n for (int i = 0; i < n; i++) {\n ans = ans.multiply(A[i]);\n if (ans.compareTo(max) == 1 || ans.equals(0)) {\n break;\n }\n }\n if (ans.compareTo(max) == 1) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\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 n = sc.nextInt();\n BigInteger[] A = new BigInteger[n];\n BigInteger max = new BigInteger(\"1000000000000000000\");\n for (int i = 0; i < n; i++) {\n A[i] = sc.nextBigInteger();\n }\n Arrays.sort(A);\n BigInteger ans = BigInteger.ONE;\n for (int i = 0; i < n; i++) {\n ans = ans.multiply(A[i]);\n if (ans.compareTo(max) == 1 || ans.equals(0)) {\n break;\n }\n }\n if (ans.compareTo(max) == 1) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\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 max = new BigInteger(\"1000000000000000000\");\n for (int i = 0; i < n; i++) {\n A[i] = sc.nextBigInteger();\n }\n Arrays.sort(A);\n BigInteger ans = BigInteger.ONE;\n for (int i = 0; i < n; i++) {\n ans = ans.multiply(A[i]);\n if (ans.compareTo(max) == 1 || ans.equals(0)) {\n break;\n }\n }\n if (ans.compareTo(max) == 1) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n BigInteger[] A = new BigInteger[n];\n BigInteger max = new BigInteger(\"1000000000000000000\");\n for (int i = 0; i < n; i++) {\n A[i] = sc.nextBigInteger();\n }\n Arrays.sort(A);\n BigInteger ans = BigInteger.ONE;\n for (int i = 0; i < n; i++) {\n ans = ans.multiply(A[i]);\n if (ans.compareTo(max) == 1 || ans.equals(0)) {\n break;\n }\n }\n if (ans.compareTo(max) == 1) {\n System.out.println(-1);\n } else {\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",
"BigInteger[] A = new BigInteger[n];",
"A",
"new BigInteger[n]",
"n",
"BigInteger max = new BigInteger(\"1000000000000000000\");",
"max",
"new BigInteger(\"1000000000000000000\")",
"for (int i = 0; i < n; i++) {\n A[i] = sc.nextBigInteger();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n A[i] = sc.nextBigInteger();\n }",
"{\n A[i] = sc.nextBigInteger();\n }",
"A[i] = sc.nextBigInteger()",
"A[i]",
"A",
"i",
"sc.nextBigInteger()",
"sc.nextBigInteger",
"sc",
"Arrays.sort(A)",
"Arrays.sort",
"Arrays",
"A",
"BigInteger ans = BigInteger.ONE;",
"ans",
"BigInteger.ONE",
"BigInteger",
"BigInteger.ONE",
"for (int i = 0; i < n; i++) {\n ans = ans.multiply(A[i]);\n if (ans.compareTo(max) == 1 || ans.equals(0)) {\n break;\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(max) == 1 || ans.equals(0)) {\n break;\n }\n }",
"{\n ans = ans.multiply(A[i]);\n if (ans.compareTo(max) == 1 || ans.equals(0)) {\n break;\n }\n }",
"ans = ans.multiply(A[i])",
"ans",
"ans.multiply(A[i])",
"ans.multiply",
"ans",
"A[i]",
"A",
"i",
"if (ans.compareTo(max) == 1 || ans.equals(0)) {\n break;\n }",
"ans.compareTo(max) == 1 || ans.equals(0)",
"ans.compareTo(max) == 1",
"ans.compareTo(max)",
"ans.compareTo",
"ans",
"max",
"1",
"ans.equals(0)",
"ans.equals",
"ans",
"0",
"{\n break;\n }",
"break;",
"if (ans.compareTo(max) == 1) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }",
"ans.compareTo(max) == 1",
"ans.compareTo(max)",
"ans.compareTo",
"ans",
"max",
"1",
"{\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 Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n BigInteger[] A = new BigInteger[n];\n BigInteger max = new BigInteger(\"1000000000000000000\");\n for (int i = 0; i < n; i++) {\n A[i] = sc.nextBigInteger();\n }\n Arrays.sort(A);\n BigInteger ans = BigInteger.ONE;\n for (int i = 0; i < n; i++) {\n ans = ans.multiply(A[i]);\n if (ans.compareTo(max) == 1 || ans.equals(0)) {\n break;\n }\n }\n if (ans.compareTo(max) == 1) {\n System.out.println(-1);\n } else {\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 int n = sc.nextInt();\n BigInteger[] A = new BigInteger[n];\n BigInteger max = new BigInteger(\"1000000000000000000\");\n for (int i = 0; i < n; i++) {\n A[i] = sc.nextBigInteger();\n }\n Arrays.sort(A);\n BigInteger ans = BigInteger.ONE;\n for (int i = 0; i < n; i++) {\n ans = ans.multiply(A[i]);\n if (ans.compareTo(max) == 1 || ans.equals(0)) {\n break;\n }\n }\n if (ans.compareTo(max) == 1) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\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 n = sc.nextInt();
BigInteger[] A = new BigInteger[n];
BigInteger max = new BigInteger("1000000000000000000");
for (int i = 0; i < n; i++) {
A[i] = sc.nextBigInteger();
}
Arrays.sort(A);
BigInteger ans = BigInteger.ONE;
for (int i = 0; i < n; i++) {
ans = ans.multiply(A[i]);
if (ans.compareTo(max) == 1 || ans.equals(0)) {
break;
}
}
if (ans.compareTo(max) == 1) {
System.out.println(-1);
} else {
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
4,
18,
13,
13,
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,
14,
2,
13,
13,
30,
0,
13,
40,
17,
3,
14,
2,
13,
2,
13,
13,
30,
0,
13,
40,
17,
3,
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
],
[
114,
5
],
[
114,
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,
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
],
[
39,
42
],
[
42,
43
],
[
43,
44
],
[
8,
45
],
[
45,
46
],
[
46,
47
],
[
45,
48
],
[
8,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
54,
55
],
[
54,
56
],
[
49,
57
],
[
57,
58
],
[
58,
59
],
[
49,
60
],
[
61,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
64,
67
],
[
61,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
61,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
81,
86
],
[
61,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
87,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
93,
98
],
[
61,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
8,
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\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong ans = 1;\n\t\tlong max = 1000000000000000000l;\n\t\t// System.out.println(max);\n\t\tList<Long> arr = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr.add(sc.nextLong());\n\t\t}\n\t\tCollections.sort(arr);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong a = arr.get(i);\n\t\t\tif (a == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (a > max) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (ans > max / a) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tans *= arr.get(i);\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n\n\n\n\n\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 ans = 1;\n\t\tlong max = 1000000000000000000l;\n\t\t// System.out.println(max);\n\t\tList<Long> arr = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr.add(sc.nextLong());\n\t\t}\n\t\tCollections.sort(arr);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong a = arr.get(i);\n\t\t\tif (a == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (a > max) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (ans > max / a) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tans *= arr.get(i);\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 ans = 1;\n\t\tlong max = 1000000000000000000l;\n\t\t// System.out.println(max);\n\t\tList<Long> arr = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr.add(sc.nextLong());\n\t\t}\n\t\tCollections.sort(arr);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong a = arr.get(i);\n\t\t\tif (a == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (a > max) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (ans > max / a) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tans *= arr.get(i);\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 ans = 1;\n\t\tlong max = 1000000000000000000l;\n\t\t// System.out.println(max);\n\t\tList<Long> arr = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr.add(sc.nextLong());\n\t\t}\n\t\tCollections.sort(arr);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong a = arr.get(i);\n\t\t\tif (a == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (a > max) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (ans > max / a) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tans *= arr.get(i);\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 ans = 1;",
"ans",
"1",
"long max = 1000000000000000000l;",
"max",
"1000000000000000000l",
"List<Long> arr = new ArrayList<>();",
"arr",
"new ArrayList<>()",
"for (int i = 0; i < n; i++) {\n\t\t\tarr.add(sc.nextLong());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tarr.add(sc.nextLong());\n\t\t}",
"{\n\t\t\tarr.add(sc.nextLong());\n\t\t}",
"arr.add(sc.nextLong())",
"arr.add",
"arr",
"sc.nextLong()",
"sc.nextLong",
"sc",
"Collections.sort(arr)",
"Collections.sort",
"Collections",
"arr",
"for (int i = 0; i < n; i++) {\n\t\t\tlong a = arr.get(i);\n\t\t\tif (a == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (a > max) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (ans > max / a) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tans *= arr.get(i);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tlong a = arr.get(i);\n\t\t\tif (a == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (a > max) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (ans > max / a) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tans *= arr.get(i);\n\t\t}",
"{\n\t\t\tlong a = arr.get(i);\n\t\t\tif (a == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (a > max) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (ans > max / a) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tans *= arr.get(i);\n\t\t}",
"long a = arr.get(i);",
"a",
"arr.get(i)",
"arr.get",
"arr",
"i",
"if (a == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}",
"a == 0",
"a",
"0",
"{\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}",
"ans = 0",
"ans",
"0",
"break;",
"if (a > max) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}",
"a > max",
"a",
"max",
"{\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}",
"ans = -1",
"ans",
"-1",
"1",
"break;",
"if (ans > max / a) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}",
"ans > max / a",
"ans",
"max / a",
"max",
"a",
"{\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}",
"ans = -1",
"ans",
"-1",
"1",
"break;",
"ans *= arr.get(i)",
"ans",
"arr.get(i)",
"arr.get",
"arr",
"i",
"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 ans = 1;\n\t\tlong max = 1000000000000000000l;\n\t\t// System.out.println(max);\n\t\tList<Long> arr = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr.add(sc.nextLong());\n\t\t}\n\t\tCollections.sort(arr);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong a = arr.get(i);\n\t\t\tif (a == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (a > max) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (ans > max / a) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tans *= arr.get(i);\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 ans = 1;\n\t\tlong max = 1000000000000000000l;\n\t\t// System.out.println(max);\n\t\tList<Long> arr = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr.add(sc.nextLong());\n\t\t}\n\t\tCollections.sort(arr);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong a = arr.get(i);\n\t\t\tif (a == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (a > max) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (ans > max / a) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tans *= arr.get(i);\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 ans = 1;
long max = 1000000000000000000l;
// System.out.println(max);
List<Long> arr = new ArrayList<>();
for (int i = 0; i < n; i++) {
arr.add(sc.nextLong());
}
Collections.sort(arr);
for (int i = 0; i < n; i++) {
long a = arr.get(i);
if (a == 0) {
ans = 0;
break;
}
if (a > max) {
ans = -1;
break;
}
if (ans > max / a) {
ans = -1;
break;
}
ans *= arr.get(i);
}
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,
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,
4,
18,
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
],
[
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
],
[
11,
109
],
[
109,
110
],
[
110,
111
],
[
9,
112
],
[
112,
113
],
[
0,
114
],
[
114,
115
],
[
114,
116
]
] |
[
"import 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\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\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tArrays.sort(A);\n\t\t\n\t\tlong ans =1;\n\t\t\n\t\tfor(int i=N-1;i>=0;i--) {\n\t\t\tif(A[i]> 1000000000000000000L/ans) {\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\tsc.close();\n\t}\n\n}",
"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\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\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tArrays.sort(A);\n\t\t\n\t\tlong ans =1;\n\t\t\n\t\tfor(int i=N-1;i>=0;i--) {\n\t\t\tif(A[i]> 1000000000000000000L/ans) {\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\tsc.close();\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\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\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tArrays.sort(A);\n\t\t\n\t\tlong ans =1;\n\t\t\n\t\tfor(int i=N-1;i>=0;i--) {\n\t\t\tif(A[i]> 1000000000000000000L/ans) {\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\tsc.close();\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\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\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tArrays.sort(A);\n\t\t\n\t\tlong ans =1;\n\t\t\n\t\tfor(int i=N-1;i>=0;i--) {\n\t\t\tif(A[i]> 1000000000000000000L/ans) {\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\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",
"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;",
"Arrays.sort(A)",
"Arrays.sort",
"Arrays",
"A",
"long ans =1;",
"ans",
"1",
"for(int i=N-1;i>=0;i--) {\n\t\t\tif(A[i]> 1000000000000000000L/ans) {\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=N-1;",
"int i=N-1;",
"i",
"N-1",
"N",
"1",
"i>=0",
"i",
"0",
"i--",
"i--",
"i",
"{\n\t\t\tif(A[i]> 1000000000000000000L/ans) {\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\tif(A[i]> 1000000000000000000L/ans) {\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(A[i]> 1000000000000000000L/ans) {\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}",
"A[i]> 1000000000000000000L/ans",
"A[i]",
"A",
"i",
"1000000000000000000L/ans",
"1000000000000000000L",
"ans",
"{\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",
"sc.close()",
"sc.close",
"sc",
"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\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\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tArrays.sort(A);\n\t\t\n\t\tlong ans =1;\n\t\t\n\t\tfor(int i=N-1;i>=0;i--) {\n\t\t\tif(A[i]> 1000000000000000000L/ans) {\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\tsc.close();\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 = sc.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]=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\n\t\tArrays.sort(A);\n\t\t\n\t\tlong ans =1;\n\t\t\n\t\tfor(int i=N-1;i>=0;i--) {\n\t\t\tif(A[i]> 1000000000000000000L/ans) {\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\tsc.close();\n\t}\n\n}",
"Main"
] |
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();
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=N-1;i>=0;i--) {
if(A[i]> 1000000000000000000L/ans) {
System.out.println(-1);
return;
}else {
ans *= A[i];
}
}
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,
41,
13,
17,
41,
13,
17,
41,
13,
17,
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,
0,
13,
17,
14,
2,
13,
17,
30,
0,
13,
18,
13,
17,
0,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
2,
13,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
0,
13,
17,
14,
13,
30,
0,
13,
18,
13,
13,
0,
13,
18,
13,
13,
14,
13,
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
],
[
136,
5
],
[
136,
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
],
[
8,
30
],
[
30,
31
],
[
30,
32
],
[
8,
33
],
[
33,
34
],
[
33,
35
],
[
8,
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
],
[
48,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
57,
61
],
[
56,
62
],
[
62,
63
],
[
62,
64
],
[
8,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
72,
74
],
[
69,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
8,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
80,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
89,
90
],
[
89,
91
],
[
80,
92
],
[
92,
93
],
[
93,
94
],
[
80,
95
],
[
96,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
97,
103
],
[
103,
104
],
[
103,
105
],
[
96,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
111,
113
],
[
108,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
116,
118
],
[
8,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
121,
126
],
[
119,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
127,
132
],
[
6,
133
],
[
133,
134
],
[
0,
135
],
[
135,
136
],
[
135,
137
]
] |
[
"import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\n \t\tint n = sc.nextInt();\n \tlong nums[] = new long[n];\n \tlong ans = 1;\n \tboolean con = true;\n \tlong zero = 0; \n \tlong limit = 1000000000;\n \tlimit *= 1000000000;\n \tfor(int i = 0;i < n; i++) {\n nums[i] = sc.nextLong();\n if(nums[i] == 0) ans = 0; \n }\n \n \tif(ans != 0) {\n ans = nums[0];\n limit /= nums[0];\n }\n \n \tfor(int i = 1;i < n && ans != 0; i++) {\n \tif(nums[i] > limit) con = false;\n \tif(con){\n ans *= nums[i];\n limit /= nums[i];\n }\n }\n \n \tif(con) System.out.println(ans);\n \telse System.out.println(\"-1\");\n \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\n \t\tint n = sc.nextInt();\n \tlong nums[] = new long[n];\n \tlong ans = 1;\n \tboolean con = true;\n \tlong zero = 0; \n \tlong limit = 1000000000;\n \tlimit *= 1000000000;\n \tfor(int i = 0;i < n; i++) {\n nums[i] = sc.nextLong();\n if(nums[i] == 0) ans = 0; \n }\n \n \tif(ans != 0) {\n ans = nums[0];\n limit /= nums[0];\n }\n \n \tfor(int i = 1;i < n && ans != 0; i++) {\n \tif(nums[i] > limit) con = false;\n \tif(con){\n ans *= nums[i];\n limit /= nums[i];\n }\n }\n \n \tif(con) System.out.println(ans);\n \telse System.out.println(\"-1\");\n \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 \tlong nums[] = new long[n];\n \tlong ans = 1;\n \tboolean con = true;\n \tlong zero = 0; \n \tlong limit = 1000000000;\n \tlimit *= 1000000000;\n \tfor(int i = 0;i < n; i++) {\n nums[i] = sc.nextLong();\n if(nums[i] == 0) ans = 0; \n }\n \n \tif(ans != 0) {\n ans = nums[0];\n limit /= nums[0];\n }\n \n \tfor(int i = 1;i < n && ans != 0; i++) {\n \tif(nums[i] > limit) con = false;\n \tif(con){\n ans *= nums[i];\n limit /= nums[i];\n }\n }\n \n \tif(con) System.out.println(ans);\n \telse System.out.println(\"-1\");\n \n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\n \t\tint n = sc.nextInt();\n \tlong nums[] = new long[n];\n \tlong ans = 1;\n \tboolean con = true;\n \tlong zero = 0; \n \tlong limit = 1000000000;\n \tlimit *= 1000000000;\n \tfor(int i = 0;i < n; i++) {\n nums[i] = sc.nextLong();\n if(nums[i] == 0) ans = 0; \n }\n \n \tif(ans != 0) {\n ans = nums[0];\n limit /= nums[0];\n }\n \n \tfor(int i = 1;i < n && ans != 0; i++) {\n \tif(nums[i] > limit) con = false;\n \tif(con){\n ans *= nums[i];\n limit /= nums[i];\n }\n }\n \n \tif(con) System.out.println(ans);\n \telse System.out.println(\"-1\");\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 nums[] = new long[n];",
"nums",
"new long[n]",
"n",
"long ans = 1;",
"ans",
"1",
"boolean con = true;",
"con",
"true",
"long zero = 0;",
"zero",
"0",
"long limit = 1000000000;",
"limit",
"1000000000",
"limit *= 1000000000",
"limit",
"1000000000",
"for(int i = 0;i < n; i++) {\n nums[i] = sc.nextLong();\n if(nums[i] == 0) ans = 0; \n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n nums[i] = sc.nextLong();\n if(nums[i] == 0) ans = 0; \n }",
"{\n nums[i] = sc.nextLong();\n if(nums[i] == 0) ans = 0; \n }",
"nums[i] = sc.nextLong()",
"nums[i]",
"nums",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(nums[i] == 0) ans = 0;",
"nums[i] == 0",
"nums[i]",
"nums",
"i",
"0",
"ans = 0",
"ans",
"0",
"if(ans != 0) {\n ans = nums[0];\n limit /= nums[0];\n }",
"ans != 0",
"ans",
"0",
"{\n ans = nums[0];\n limit /= nums[0];\n }",
"ans = nums[0]",
"ans",
"nums[0]",
"nums",
"0",
"limit /= nums[0]",
"limit",
"nums[0]",
"nums",
"0",
"for(int i = 1;i < n && ans != 0; i++) {\n \tif(nums[i] > limit) con = false;\n \tif(con){\n ans *= nums[i];\n limit /= nums[i];\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n && ans != 0",
"i < n",
"i",
"n",
"ans != 0",
"ans",
"0",
"i++",
"i++",
"i",
"{\n \tif(nums[i] > limit) con = false;\n \tif(con){\n ans *= nums[i];\n limit /= nums[i];\n }\n }",
"{\n \tif(nums[i] > limit) con = false;\n \tif(con){\n ans *= nums[i];\n limit /= nums[i];\n }\n }",
"if(nums[i] > limit) con = false;",
"nums[i] > limit",
"nums[i]",
"nums",
"i",
"limit",
"con = false",
"con",
"false",
"if(con){\n ans *= nums[i];\n limit /= nums[i];\n }",
"con",
"{\n ans *= nums[i];\n limit /= nums[i];\n }",
"ans *= nums[i]",
"ans",
"nums[i]",
"nums",
"i",
"limit /= nums[i]",
"limit",
"nums[i]",
"nums",
"i",
"if(con) System.out.println(ans);\n \telse System.out.println(\"-1\");",
"con",
"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\"",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\n \t\tint n = sc.nextInt();\n \tlong nums[] = new long[n];\n \tlong ans = 1;\n \tboolean con = true;\n \tlong zero = 0; \n \tlong limit = 1000000000;\n \tlimit *= 1000000000;\n \tfor(int i = 0;i < n; i++) {\n nums[i] = sc.nextLong();\n if(nums[i] == 0) ans = 0; \n }\n \n \tif(ans != 0) {\n ans = nums[0];\n limit /= nums[0];\n }\n \n \tfor(int i = 1;i < n && ans != 0; i++) {\n \tif(nums[i] > limit) con = false;\n \tif(con){\n ans *= nums[i];\n limit /= nums[i];\n }\n }\n \n \tif(con) System.out.println(ans);\n \telse System.out.println(\"-1\");\n \n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\n \t\tint n = sc.nextInt();\n \tlong nums[] = new long[n];\n \tlong ans = 1;\n \tboolean con = true;\n \tlong zero = 0; \n \tlong limit = 1000000000;\n \tlimit *= 1000000000;\n \tfor(int i = 0;i < n; i++) {\n nums[i] = sc.nextLong();\n if(nums[i] == 0) ans = 0; \n }\n \n \tif(ans != 0) {\n ans = nums[0];\n limit /= nums[0];\n }\n \n \tfor(int i = 1;i < n && ans != 0; i++) {\n \tif(nums[i] > limit) con = false;\n \tif(con){\n ans *= nums[i];\n limit /= nums[i];\n }\n }\n \n \tif(con) System.out.println(ans);\n \telse System.out.println(\"-1\");\n \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 nums[] = new long[n];
long ans = 1;
boolean con = true;
long zero = 0;
long limit = 1000000000;
limit *= 1000000000;
for(int i = 0;i < n; i++) {
nums[i] = sc.nextLong();
if(nums[i] == 0) ans = 0;
}
if(ans != 0) {
ans = nums[0];
limit /= nums[0];
}
for(int i = 1;i < n && ans != 0; i++) {
if(nums[i] > limit) con = false;
if(con){
ans *= nums[i];
limit /= nums[i];
}
}
if(con) System.out.println(ans);
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
4,
18,
13,
4,
18,
13,
14,
4,
18,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
41,
13,
17,
41,
13,
4,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
13,
13,
4,
18,
13,
13,
30,
0,
13,
4,
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
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
114,
11
],
[
114,
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
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
38,
41
],
[
41,
42
],
[
42,
43
],
[
14,
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
],
[
14,
57
],
[
57,
58
],
[
57,
59
],
[
14,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
62,
65
],
[
62,
66
],
[
14,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
72,
73
],
[
72,
74
],
[
67,
75
],
[
75,
76
],
[
76,
77
],
[
67,
78
],
[
79,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
80,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
93,
94
],
[
92,
95
],
[
80,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
102,
103
],
[
96,
104
],
[
14,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
12,
111
],
[
111,
112
],
[
0,
113
],
[
113,
114
],
[
113,
115
]
] |
[
"import java.util.ArrayList;\nimport java.util.List;\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 List<Long> list = new ArrayList<>();\n for (int i = 0; i < n; i++) list.add(sc.nextLong());\n \n if (list.contains(0L)) {\n System.out.println(0);\n return;\n }\n\n long result = 1;\n long max = (long) Math.pow(10, 18);\n for (int i = 0; i < n; i++) {\n if (max / result >= list.get(i)) {\n result *= list.get(i);\n } else {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(result);\n }\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 public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n List<Long> list = new ArrayList<>();\n for (int i = 0; i < n; i++) list.add(sc.nextLong());\n \n if (list.contains(0L)) {\n System.out.println(0);\n return;\n }\n\n long result = 1;\n long max = (long) Math.pow(10, 18);\n for (int i = 0; i < n; i++) {\n if (max / result >= list.get(i)) {\n result *= list.get(i);\n } else {\n System.out.println(-1);\n return;\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 List<Long> list = new ArrayList<>();\n for (int i = 0; i < n; i++) list.add(sc.nextLong());\n \n if (list.contains(0L)) {\n System.out.println(0);\n return;\n }\n\n long result = 1;\n long max = (long) Math.pow(10, 18);\n for (int i = 0; i < n; i++) {\n if (max / result >= list.get(i)) {\n result *= list.get(i);\n } else {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(result);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n List<Long> list = new ArrayList<>();\n for (int i = 0; i < n; i++) list.add(sc.nextLong());\n \n if (list.contains(0L)) {\n System.out.println(0);\n return;\n }\n\n long result = 1;\n long max = (long) Math.pow(10, 18);\n for (int i = 0; i < n; i++) {\n if (max / result >= list.get(i)) {\n result *= list.get(i);\n } else {\n System.out.println(-1);\n return;\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",
"List<Long> list = new ArrayList<>();",
"list",
"new ArrayList<>()",
"for (int i = 0; i < n; i++) list.add(sc.nextLong());",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"list.add(sc.nextLong());",
"list.add(sc.nextLong())",
"list.add",
"list",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (list.contains(0L)) {\n System.out.println(0);\n return;\n }",
"list.contains(0L)",
"list.contains",
"list",
"0L",
"{\n System.out.println(0);\n return;\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"long result = 1;",
"result",
"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 if (max / result >= list.get(i)) {\n result *= list.get(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 (max / result >= list.get(i)) {\n result *= list.get(i);\n } else {\n System.out.println(-1);\n return;\n }\n }",
"{\n if (max / result >= list.get(i)) {\n result *= list.get(i);\n } else {\n System.out.println(-1);\n return;\n }\n }",
"if (max / result >= list.get(i)) {\n result *= list.get(i);\n } else {\n System.out.println(-1);\n return;\n }",
"max / result >= list.get(i)",
"max / result",
"max",
"result",
"list.get(i)",
"list.get",
"list",
"i",
"{\n result *= list.get(i);\n }",
"result *= list.get(i)",
"result",
"list.get(i)",
"list.get",
"list",
"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(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 List<Long> list = new ArrayList<>();\n for (int i = 0; i < n; i++) list.add(sc.nextLong());\n \n if (list.contains(0L)) {\n System.out.println(0);\n return;\n }\n\n long result = 1;\n long max = (long) Math.pow(10, 18);\n for (int i = 0; i < n; i++) {\n if (max / result >= list.get(i)) {\n result *= list.get(i);\n } else {\n System.out.println(-1);\n return;\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 List<Long> list = new ArrayList<>();\n for (int i = 0; i < n; i++) list.add(sc.nextLong());\n \n if (list.contains(0L)) {\n System.out.println(0);\n return;\n }\n\n long result = 1;\n long max = (long) Math.pow(10, 18);\n for (int i = 0; i < n; i++) {\n if (max / result >= list.get(i)) {\n result *= list.get(i);\n } else {\n System.out.println(-1);\n return;\n }\n }\n System.out.println(result);\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 = sc.nextInt();
List<Long> list = new ArrayList<>();
for (int i = 0; i < n; i++) list.add(sc.nextLong());
if (list.contains(0L)) {
System.out.println(0);
return;
}
long result = 1;
long max = (long) Math.pow(10, 18);
for (int i = 0; i < n; i++) {
if (max / result >= list.get(i)) {
result *= list.get(i);
} else {
System.out.println(-1);
return;
}
}
System.out.println(result);
}
}
|
[
7,
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,
0,
13,
17,
3,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
17,
13,
18,
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
],
[
109,
5
],
[
109,
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
],
[
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
],
[
50,
54
],
[
8,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
55,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
60,
65
],
[
55,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
72,
73
],
[
72,
74
],
[
67,
75
],
[
75,
76
],
[
76,
77
],
[
67,
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
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
80,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
94,
99
],
[
66,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
100,
105
],
[
6,
106
],
[
106,
107
],
[
0,
108
],
[
108,
109
],
[
108,
110
]
] |
[
"import java.util.*;\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 ans = 1;\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 ans=0;\n break;\n }\n }\n if(ans==0){\n System.out.println(ans);\n }\n else{\n for(int i = 0; i < n; i++){\n if(1000000000000000000l/ans>=a[i]){\n ans *= a[i];\n }\n else{\n ans = -1;\n break;\n }\n }\n System.out.println(ans);\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 int n = sc.nextInt();\n long ans = 1;\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 ans=0;\n break;\n }\n }\n if(ans==0){\n System.out.println(ans);\n }\n else{\n for(int i = 0; i < n; i++){\n if(1000000000000000000l/ans>=a[i]){\n ans *= a[i];\n }\n else{\n ans = -1;\n break;\n }\n }\n System.out.println(ans);\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long ans = 1;\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 ans=0;\n break;\n }\n }\n if(ans==0){\n System.out.println(ans);\n }\n else{\n for(int i = 0; i < n; i++){\n if(1000000000000000000l/ans>=a[i]){\n ans *= a[i];\n }\n else{\n ans = -1;\n break;\n }\n }\n System.out.println(ans);\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long ans = 1;\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 ans=0;\n break;\n }\n }\n if(ans==0){\n System.out.println(ans);\n }\n else{\n for(int i = 0; i < n; i++){\n if(1000000000000000000l/ans>=a[i]){\n ans *= a[i];\n }\n else{\n ans = -1;\n break;\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 ans = 1;",
"ans",
"1",
"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 ans=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 ans=0;\n break;\n }\n }",
"{\n a[i] = sc.nextLong();\n if(a[i]==0){\n ans=0;\n break;\n }\n }",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(a[i]==0){\n ans=0;\n break;\n }",
"a[i]==0",
"a[i]",
"a",
"i",
"0",
"{\n ans=0;\n break;\n }",
"ans=0",
"ans",
"0",
"break;",
"if(ans==0){\n System.out.println(ans);\n }\n else{\n for(int i = 0; i < n; i++){\n if(1000000000000000000l/ans>=a[i]){\n ans *= a[i];\n }\n else{\n ans = -1;\n break;\n }\n }\n System.out.println(ans);\n }",
"ans==0",
"ans",
"0",
"{\n System.out.println(ans);\n }",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"{\n for(int i = 0; i < n; i++){\n if(1000000000000000000l/ans>=a[i]){\n ans *= a[i];\n }\n else{\n ans = -1;\n break;\n }\n }\n System.out.println(ans);\n }",
"for(int i = 0; i < n; i++){\n if(1000000000000000000l/ans>=a[i]){\n ans *= a[i];\n }\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(1000000000000000000l/ans>=a[i]){\n ans *= a[i];\n }\n else{\n ans = -1;\n break;\n }\n }",
"{\n if(1000000000000000000l/ans>=a[i]){\n ans *= a[i];\n }\n else{\n ans = -1;\n break;\n }\n }",
"if(1000000000000000000l/ans>=a[i]){\n ans *= a[i];\n }\n else{\n ans = -1;\n break;\n }",
"1000000000000000000l/ans>=a[i]",
"1000000000000000000l/ans",
"1000000000000000000l",
"ans",
"a[i]",
"a",
"i",
"{\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\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long ans = 1;\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 ans=0;\n break;\n }\n }\n if(ans==0){\n System.out.println(ans);\n }\n else{\n for(int i = 0; i < n; i++){\n if(1000000000000000000l/ans>=a[i]){\n ans *= a[i];\n }\n else{\n ans = -1;\n break;\n }\n }\n System.out.println(ans);\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 ans = 1;\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 ans=0;\n break;\n }\n }\n if(ans==0){\n System.out.println(ans);\n }\n else{\n for(int i = 0; i < n; i++){\n if(1000000000000000000l/ans>=a[i]){\n ans *= a[i];\n }\n else{\n ans = -1;\n break;\n }\n }\n System.out.println(ans);\n }\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 ans = 1;
long a[] = new long[n];
for(int i = 0; i < n; i++){
a[i] = sc.nextLong();
if(a[i]==0){
ans=0;
break;
}
}
if(ans==0){
System.out.println(ans);
}
else{
for(int i = 0; i < n; i++){
if(1000000000000000000l/ans>=a[i]){
ans *= a[i];
}
else{
ans = -1;
break;
}
}
System.out.println(ans);
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
20,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
0,
13,
20,
42,
4,
18,
13,
30,
4,
13,
4,
18,
13,
12,
13,
30,
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,
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,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
2,
13,
13,
14,
2,
18,
13,
13,
13,
30,
4,
18,
13,
17,
29,
0,
13,
18,
13,
13,
4,
18,
13,
13,
29,
6,
13,
41,
13,
41,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
20,
0,
13,
20,
12,
13,
30,
14,
4,
18,
13,
29,
4,
18,
13,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
30,
14,
2,
40,
4,
18,
13,
40,
4,
18,
13,
29,
17,
29,
17,
29,
17,
12,
13,
30,
29,
4,
18,
13,
4,
18,
36,
12,
13,
30,
29,
4,
18,
13,
4,
18,
36,
12,
13,
30,
29,
4,
18,
36,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
249,
11
],
[
249,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
12,
16
],
[
16,
17
],
[
0,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
18,
22
],
[
22,
23
],
[
18,
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
],
[
33,
37
],
[
37,
38
],
[
38,
39
],
[
26,
40
],
[
40,
41
],
[
41,
42
],
[
18,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
45,
51
],
[
51,
52
],
[
51,
53
],
[
45,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
60,
61
],
[
60,
62
],
[
55,
63
],
[
63,
64
],
[
64,
65
],
[
55,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
71,
72
],
[
72,
73
],
[
45,
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
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
87,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
94,
97
],
[
93,
98
],
[
45,
99
],
[
99,
100
],
[
99,
101
],
[
45,
102
],
[
102,
103
],
[
102,
104
],
[
45,
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
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
117,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
123,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
130,
133
],
[
129,
134
],
[
117,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
137,
139
],
[
45,
140
],
[
140,
141
],
[
141,
142
],
[
140,
143
],
[
45,
144
],
[
0,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
145,
149
],
[
149,
150
],
[
145,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
154,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
161,
165
],
[
165,
166
],
[
165,
167
],
[
145,
168
],
[
168,
169
],
[
168,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
171,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
170,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
182,
183
],
[
183,
184
],
[
184,
185
],
[
179,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
170,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
145,
194
],
[
194,
195
],
[
194,
196
],
[
196,
197
],
[
197,
198
],
[
198,
199
],
[
198,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
197,
204
],
[
204,
205
],
[
205,
206
],
[
206,
207
],
[
207,
208
],
[
208,
209
],
[
209,
210
],
[
206,
211
],
[
211,
212
],
[
212,
213
],
[
213,
214
],
[
205,
215
],
[
215,
216
],
[
205,
217
],
[
217,
218
],
[
196,
219
],
[
219,
220
],
[
145,
221
],
[
221,
222
],
[
221,
223
],
[
223,
224
],
[
224,
225
],
[
225,
226
],
[
226,
227
],
[
225,
228
],
[
228,
229
],
[
229,
230
],
[
145,
231
],
[
231,
232
],
[
231,
233
],
[
233,
234
],
[
234,
235
],
[
235,
236
],
[
236,
237
],
[
235,
238
],
[
238,
239
],
[
239,
240
],
[
145,
241
],
[
241,
242
],
[
241,
243
],
[
243,
244
],
[
244,
245
],
[
245,
246
],
[
246,
247
],
[
0,
248
],
[
248,
249
],
[
248,
250
]
] |
[
"//--- pB ---//\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\npublic class Main {\n\tpublic static void main (String[] args) throws java.lang.Exception {\n\t\tnew Solution();\n\t}\n}\nclass Solution {\n\tReader reader;\n\tPrintWriter out;\n\tpublic Solution() {\n\t\treader = new Reader();\n\t\tout = new PrintWriter(System.out);\n\t\twhile (reader.hasNext()) {\n\t\t\trun_case();\n\t\t}\n\t\tout.flush();\n\t}\n\n\tprivate void run_case() {\n\t\tint n = reader.ni();\n\t\tlong[] arr = new long[n];\n\t\tfor (int i=0; i<n; i++) arr[i] = reader.nl();\n\t\t// Arrays.sort(arr);\n\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tif (arr[i] == 0) {\n\t\t\t\tout.println(\"0\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tlong res = 1;\n\t\tlong inf = (long)1e18;\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tlong bound = inf / res;\n\t\t\tif (arr[i] > bound) {\n\t\t\t\tout.println(\"-1\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tres *= arr[i];\n\t\t}\n\n\t\tout.println(res);\n\t\treturn;\n\t}\n}\n\n\nclass Reader {\n\tBufferedReader br;\n\tStringTokenizer st;\n\tpublic Reader(){\n\t\ttry {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\tpublic String next() {\n\t\tif (st.hasMoreTokens()) return st.nextToken();\n\t\ttry {\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn st.nextToken();\n\t}\n\tpublic boolean hasNext() {\n\t\ttry {\n\t\t\tif (!st.hasMoreTokens() && !br.ready()) return false;\n\t\t\telse return true;\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn false;\n\t}\n\tpublic int ni() {return Integer.parseInt(this.next());}\n\tpublic long nl() {return Long.parseLong(this.next());}\n\tpublic String ns() {return this.next();}\n}",
"import java.util.*;",
"util.*",
"java",
"import java.lang.*;",
"lang.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main {\n\tpublic static void main (String[] args) throws java.lang.Exception {\n\t\tnew Solution();\n\t}\n}",
"Main",
"public static void main (String[] args) throws java.lang.Exception {\n\t\tnew Solution();\n\t}",
"main",
"{\n\t\tnew Solution();\n\t}",
"new Solution()",
"String[] args",
"args",
"class Solution {\n\tReader reader;\n\tPrintWriter out;\n\tpublic Solution() {\n\t\treader = new Reader();\n\t\tout = new PrintWriter(System.out);\n\t\twhile (reader.hasNext()) {\n\t\t\trun_case();\n\t\t}\n\t\tout.flush();\n\t}\n\n\tprivate void run_case() {\n\t\tint n = reader.ni();\n\t\tlong[] arr = new long[n];\n\t\tfor (int i=0; i<n; i++) arr[i] = reader.nl();\n\t\t// Arrays.sort(arr);\n\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tif (arr[i] == 0) {\n\t\t\t\tout.println(\"0\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tlong res = 1;\n\t\tlong inf = (long)1e18;\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tlong bound = inf / res;\n\t\t\tif (arr[i] > bound) {\n\t\t\t\tout.println(\"-1\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tres *= arr[i];\n\t\t}\n\n\t\tout.println(res);\n\t\treturn;\n\t}\n}",
"Solution",
"Reader reader;",
"reader",
"PrintWriter out;",
"out",
"public Solution() {\n\t\treader = new Reader();\n\t\tout = new PrintWriter(System.out);\n\t\twhile (reader.hasNext()) {\n\t\t\trun_case();\n\t\t}\n\t\tout.flush();\n\t}",
"Solution",
"{\n\t\treader = new Reader();\n\t\tout = new PrintWriter(System.out);\n\t\twhile (reader.hasNext()) {\n\t\t\trun_case();\n\t\t}\n\t\tout.flush();\n\t}",
"reader = new Reader()",
"reader",
"new Reader()",
"out = new PrintWriter(System.out)",
"out",
"new PrintWriter(System.out)",
"while (reader.hasNext()) {\n\t\t\trun_case();\n\t\t}",
"reader.hasNext()",
"reader.hasNext",
"reader",
"{\n\t\t\trun_case();\n\t\t}",
"run_case()",
"run_case",
"out.flush()",
"out.flush",
"out",
"private void run_case() {\n\t\tint n = reader.ni();\n\t\tlong[] arr = new long[n];\n\t\tfor (int i=0; i<n; i++) arr[i] = reader.nl();\n\t\t// Arrays.sort(arr);\n\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tif (arr[i] == 0) {\n\t\t\t\tout.println(\"0\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tlong res = 1;\n\t\tlong inf = (long)1e18;\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tlong bound = inf / res;\n\t\t\tif (arr[i] > bound) {\n\t\t\t\tout.println(\"-1\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tres *= arr[i];\n\t\t}\n\n\t\tout.println(res);\n\t\treturn;\n\t}",
"run_case",
"{\n\t\tint n = reader.ni();\n\t\tlong[] arr = new long[n];\n\t\tfor (int i=0; i<n; i++) arr[i] = reader.nl();\n\t\t// Arrays.sort(arr);\n\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tif (arr[i] == 0) {\n\t\t\t\tout.println(\"0\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tlong res = 1;\n\t\tlong inf = (long)1e18;\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tlong bound = inf / res;\n\t\t\tif (arr[i] > bound) {\n\t\t\t\tout.println(\"-1\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tres *= arr[i];\n\t\t}\n\n\t\tout.println(res);\n\t\treturn;\n\t}",
"int n = reader.ni();",
"n",
"reader.ni()",
"reader.ni",
"reader",
"long[] arr = new long[n];",
"arr",
"new long[n]",
"n",
"for (int i=0; i<n; i++) arr[i] = reader.nl();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"arr[i] = reader.nl();",
"arr[i] = reader.nl()",
"arr[i]",
"arr",
"i",
"reader.nl()",
"reader.nl",
"reader",
"for (int i=0; i<n; i++) {\n\t\t\tif (arr[i] == 0) {\n\t\t\t\tout.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\tif (arr[i] == 0) {\n\t\t\t\tout.println(\"0\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (arr[i] == 0) {\n\t\t\t\tout.println(\"0\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"if (arr[i] == 0) {\n\t\t\t\tout.println(\"0\");\n\t\t\t\treturn;\n\t\t\t}",
"arr[i] == 0",
"arr[i]",
"arr",
"i",
"0",
"{\n\t\t\t\tout.println(\"0\");\n\t\t\t\treturn;\n\t\t\t}",
"out.println(\"0\")",
"out.println",
"out",
"\"0\"",
"return;",
"long res = 1;",
"res",
"1",
"long inf = (long)1e18;",
"inf",
"(long)1e18",
"for (int i=0; i<n; i++) {\n\t\t\tlong bound = inf / res;\n\t\t\tif (arr[i] > bound) {\n\t\t\t\tout.println(\"-1\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tres *= arr[i];\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tlong bound = inf / res;\n\t\t\tif (arr[i] > bound) {\n\t\t\t\tout.println(\"-1\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tres *= arr[i];\n\t\t}",
"{\n\t\t\tlong bound = inf / res;\n\t\t\tif (arr[i] > bound) {\n\t\t\t\tout.println(\"-1\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tres *= arr[i];\n\t\t}",
"long bound = inf / res;",
"bound",
"inf / res",
"inf",
"res",
"if (arr[i] > bound) {\n\t\t\t\tout.println(\"-1\");\n\t\t\t\treturn;\n\t\t\t}",
"arr[i] > bound",
"arr[i]",
"arr",
"i",
"bound",
"{\n\t\t\t\tout.println(\"-1\");\n\t\t\t\treturn;\n\t\t\t}",
"out.println(\"-1\")",
"out.println",
"out",
"\"-1\"",
"return;",
"res *= arr[i]",
"res",
"arr[i]",
"arr",
"i",
"out.println(res)",
"out.println",
"out",
"res",
"return;",
"class Reader {\n\tBufferedReader br;\n\tStringTokenizer st;\n\tpublic Reader(){\n\t\ttry {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\tpublic String next() {\n\t\tif (st.hasMoreTokens()) return st.nextToken();\n\t\ttry {\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn st.nextToken();\n\t}\n\tpublic boolean hasNext() {\n\t\ttry {\n\t\t\tif (!st.hasMoreTokens() && !br.ready()) return false;\n\t\t\telse return true;\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn false;\n\t}\n\tpublic int ni() {return Integer.parseInt(this.next());}\n\tpublic long nl() {return Long.parseLong(this.next());}\n\tpublic String ns() {return this.next();}\n}",
"Reader",
"BufferedReader br;",
"br",
"StringTokenizer st;",
"st",
"public Reader(){\n\t\ttry {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}",
"Reader",
"{\n\t\ttry {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}",
"try {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}",
"catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}",
"Exception e",
"{\n\t\t\te.printStackTrace();\n\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t}",
"br = new BufferedReader(new InputStreamReader(System.in))",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"public String next() {\n\t\tif (st.hasMoreTokens()) return st.nextToken();\n\t\ttry {\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn st.nextToken();\n\t}",
"next",
"{\n\t\tif (st.hasMoreTokens()) return st.nextToken();\n\t\ttry {\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn st.nextToken();\n\t}",
"if (st.hasMoreTokens()) return st.nextToken();",
"st.hasMoreTokens()",
"st.hasMoreTokens",
"st",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"try {\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}",
"catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}",
"Exception e",
"{\n\t\t\te.printStackTrace();\n\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t}",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"public boolean hasNext() {\n\t\ttry {\n\t\t\tif (!st.hasMoreTokens() && !br.ready()) return false;\n\t\t\telse return true;\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn false;\n\t}",
"hasNext",
"{\n\t\ttry {\n\t\t\tif (!st.hasMoreTokens() && !br.ready()) return false;\n\t\t\telse return true;\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn false;\n\t}",
"try {\n\t\t\tif (!st.hasMoreTokens() && !br.ready()) return false;\n\t\t\telse return true;\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}",
"catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}",
"Exception e",
"{\n\t\t\te.printStackTrace();\n\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t\t\tif (!st.hasMoreTokens() && !br.ready()) return false;\n\t\t\telse return true;\n\t\t}",
"if (!st.hasMoreTokens() && !br.ready()) return false;\n\t\t\telse return true;",
"!st.hasMoreTokens() && !br.ready()",
"!st.hasMoreTokens()",
"st.hasMoreTokens()",
"st.hasMoreTokens",
"st",
"!br.ready()",
"br.ready()",
"br.ready",
"br",
"return false;",
"false",
"return true;",
"true",
"return false;",
"false",
"public int ni() {return Integer.parseInt(this.next());}",
"ni",
"{return Integer.parseInt(this.next());}",
"return Integer.parseInt(this.next());",
"Integer.parseInt(this.next())",
"Integer.parseInt",
"Integer",
"this.next()",
"this.next",
"this",
"public long nl() {return Long.parseLong(this.next());}",
"nl",
"{return Long.parseLong(this.next());}",
"return Long.parseLong(this.next());",
"Long.parseLong(this.next())",
"Long.parseLong",
"Long",
"this.next()",
"this.next",
"this",
"public String ns() {return this.next();}",
"ns",
"{return this.next();}",
"return this.next();",
"this.next()",
"this.next",
"this",
"public class Main {\n\tpublic static void main (String[] args) throws java.lang.Exception {\n\t\tnew Solution();\n\t}\n}",
"public class Main {\n\tpublic static void main (String[] args) throws java.lang.Exception {\n\t\tnew Solution();\n\t}\n}",
"Main"
] |
//--- pB ---//
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
public static void main (String[] args) throws java.lang.Exception {
new Solution();
}
}
class Solution {
Reader reader;
PrintWriter out;
public Solution() {
reader = new Reader();
out = new PrintWriter(System.out);
while (reader.hasNext()) {
run_case();
}
out.flush();
}
private void run_case() {
int n = reader.ni();
long[] arr = new long[n];
for (int i=0; i<n; i++) arr[i] = reader.nl();
// Arrays.sort(arr);
for (int i=0; i<n; i++) {
if (arr[i] == 0) {
out.println("0");
return;
}
}
long res = 1;
long inf = (long)1e18;
for (int i=0; i<n; i++) {
long bound = inf / res;
if (arr[i] > bound) {
out.println("-1");
return;
}
res *= arr[i];
}
out.println(res);
return;
}
}
class Reader {
BufferedReader br;
StringTokenizer st;
public Reader(){
try {
br = new BufferedReader(new InputStreamReader(System.in));
st = new StringTokenizer(br.readLine());
} catch (Exception e) {
e.printStackTrace();
}
}
public String next() {
if (st.hasMoreTokens()) return st.nextToken();
try {
st = new StringTokenizer(br.readLine());
} catch (Exception e) {
e.printStackTrace();
}
return st.nextToken();
}
public boolean hasNext() {
try {
if (!st.hasMoreTokens() && !br.ready()) return false;
else return true;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
public int ni() {return Integer.parseInt(this.next());}
public long nl() {return Long.parseLong(this.next());}
public String ns() {return this.next();}
}
|
[
7,
6,
12,
13,
30,
29,
2,
18,
13,
13,
18,
13,
13,
23,
13,
23,
13,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
2,
17,
17,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
17,
4,
18,
13,
23,
13,
12,
13,
30,
14,
2,
2,
13,
2,
13,
13,
2,
13,
4,
13,
2,
13,
13,
29,
17,
29,
17,
23,
13,
23,
13,
23,
13,
12,
13,
30,
29,
8,
2,
13,
17,
13,
40,
13,
23,
13,
12,
13,
30,
29,
8,
2,
13,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
29,
17,
41,
13,
4,
13,
13,
2,
13,
17,
41,
13,
2,
2,
13,
13,
13,
14,
2,
2,
13,
17,
17,
29,
13,
29,
2,
2,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
28,
13,
13,
30,
4,
18,
13,
13,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
13,
23,
13,
12,
13,
30,
41,
13,
20,
28,
13,
13,
30,
4,
18,
13,
13,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
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,
13,
29,
13,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
0,
18,
36,
13,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
4,
18,
13,
13,
20,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
0,
13,
20,
23,
13,
12,
13,
30,
42,
40,
4,
18,
13,
30,
38,
5,
13,
30,
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,
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,
6,
13,
12,
13,
30,
4,
13,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
4,
13,
2,
18,
13,
13,
17,
4,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
4,
13,
2,
18,
13,
13,
17,
4,
13,
23,
13,
13,
10,
6,
13
] |
[
[
0,
1
],
[
1,
2
],
[
2,
3
],
[
2,
4
],
[
4,
5
],
[
5,
6
],
[
6,
7
],
[
7,
8
],
[
7,
9
],
[
6,
10
],
[
10,
11
],
[
10,
12
],
[
2,
13
],
[
13,
14
],
[
2,
15
],
[
15,
16
],
[
0,
17
],
[
17,
18
],
[
17,
19
],
[
0,
20
],
[
20,
21
],
[
20,
22
],
[
0,
23
],
[
500,
24
],
[
500,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
27,
29
],
[
500,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
32,
36
],
[
36,
37
],
[
36,
38
],
[
32,
39
],
[
39,
40
],
[
39,
41
],
[
32,
42
],
[
42,
43
],
[
43,
44
],
[
30,
45
],
[
45,
46
],
[
500,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
54,
56
],
[
51,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
61,
63
],
[
50,
64
],
[
64,
65
],
[
49,
66
],
[
66,
67
],
[
47,
68
],
[
68,
69
],
[
47,
70
],
[
70,
71
],
[
47,
72
],
[
72,
73
],
[
500,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
78,
83
],
[
83,
84
],
[
74,
85
],
[
85,
86
],
[
500,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
95
],
[
91,
96
],
[
87,
97
],
[
97,
98
],
[
87,
99
],
[
99,
100
],
[
500,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
108,
109
],
[
103,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
112,
115
],
[
115,
116
],
[
115,
117
],
[
103,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
103,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
125,
131
],
[
131,
132
],
[
103,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
101,
139
],
[
139,
140
],
[
101,
141
],
[
141,
142
],
[
500,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
145,
149
],
[
149,
150
],
[
149,
151
],
[
149,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
153,
156
],
[
145,
157
],
[
157,
158
],
[
158,
159
],
[
157,
160
],
[
145,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
161,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
168,
170
],
[
161,
171
],
[
171,
172
],
[
172,
173
],
[
161,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
175,
179
],
[
179,
180
],
[
180,
181
],
[
179,
182
],
[
143,
183
],
[
183,
184
],
[
500,
185
],
[
185,
186
],
[
185,
187
],
[
187,
188
],
[
188,
189
],
[
188,
190
],
[
187,
191
],
[
191,
192
],
[
191,
193
],
[
191,
194
],
[
194,
195
],
[
195,
196
],
[
196,
197
],
[
195,
198
],
[
187,
199
],
[
199,
200
],
[
200,
201
],
[
199,
202
],
[
187,
203
],
[
203,
204
],
[
204,
205
],
[
205,
206
],
[
205,
207
],
[
203,
208
],
[
208,
209
],
[
208,
210
],
[
210,
211
],
[
210,
212
],
[
203,
213
],
[
213,
214
],
[
214,
215
],
[
203,
216
],
[
216,
217
],
[
217,
218
],
[
218,
219
],
[
218,
220
],
[
217,
221
],
[
221,
222
],
[
222,
223
],
[
221,
224
],
[
185,
225
],
[
225,
226
],
[
500,
227
],
[
227,
228
],
[
227,
229
],
[
229,
230
],
[
230,
231
],
[
230,
232
],
[
229,
234
],
[
234,
235
],
[
235,
236
],
[
236,
237
],
[
236,
238
],
[
234,
239
],
[
239,
240
],
[
239,
241
],
[
234,
242
],
[
242,
243
],
[
243,
244
],
[
234,
245
],
[
245,
246
],
[
246,
247
],
[
247,
248
],
[
247,
249
],
[
246,
250
],
[
229,
251
],
[
251,
252
],
[
227,
253
],
[
253,
254
],
[
227,
255
],
[
255,
256
],
[
500,
257
],
[
257,
258
],
[
257,
259
],
[
259,
260
],
[
257,
261
],
[
261,
262
],
[
257,
263
],
[
263,
264
],
[
263,
265
],
[
265,
266
],
[
266,
267
],
[
267,
268
],
[
267,
269
],
[
266,
270
],
[
265,
271
],
[
271,
272
],
[
272,
273
],
[
272,
274
],
[
271,
275
],
[
263,
276
],
[
276,
277
],
[
263,
278
],
[
278,
279
],
[
257,
280
],
[
280,
281
],
[
280,
282
],
[
282,
283
],
[
283,
284
],
[
283,
285
],
[
282,
286
],
[
286,
287
],
[
287,
288
],
[
286,
289
],
[
286,
290
],
[
282,
291
],
[
291,
292
],
[
292,
293
],
[
293,
294
],
[
293,
295
],
[
291,
296
],
[
296,
297
],
[
296,
298
],
[
298,
299
],
[
299,
300
],
[
291,
301
],
[
301,
302
],
[
302,
303
],
[
291,
304
],
[
305,
305
],
[
305,
306
],
[
306,
307
],
[
307,
308
],
[
307,
309
],
[
306,
310
],
[
310,
311
],
[
311,
312
],
[
310,
313
],
[
280,
314
],
[
314,
315
],
[
500,
316
],
[
316,
317
],
[
316,
318
],
[
318,
319
],
[
316,
320
],
[
320,
321
],
[
316,
322
],
[
322,
323
],
[
322,
324
],
[
324,
325
],
[
325,
326
],
[
325,
327
],
[
324,
328
],
[
328,
329
],
[
328,
330
],
[
322,
331
],
[
331,
332
],
[
316,
333
],
[
333,
334
],
[
333,
335
],
[
335,
336
],
[
336,
337
],
[
337,
338
],
[
338,
339
],
[
339,
340
],
[
336,
341
],
[
341,
342
],
[
342,
343
],
[
343,
344
],
[
343,
345
],
[
342,
346
],
[
346,
347
],
[
347,
348
],
[
347,
349
],
[
335,
350
],
[
350,
351
],
[
351,
352
],
[
352,
353
],
[
316,
354
],
[
354,
355
],
[
354,
356
],
[
356,
357
],
[
357,
358
],
[
358,
359
],
[
359,
360
],
[
358,
361
],
[
361,
362
],
[
316,
363
],
[
363,
364
],
[
363,
365
],
[
365,
366
],
[
366,
367
],
[
367,
368
],
[
368,
369
],
[
367,
370
],
[
370,
371
],
[
316,
372
],
[
372,
373
],
[
372,
374
],
[
374,
375
],
[
375,
376
],
[
375,
377
],
[
374,
379
],
[
379,
380
],
[
380,
381
],
[
381,
382
],
[
381,
383
],
[
379,
384
],
[
384,
385
],
[
384,
386
],
[
379,
387
],
[
387,
388
],
[
388,
389
],
[
379,
390
],
[
390,
391
],
[
391,
392
],
[
392,
393
],
[
392,
394
],
[
391,
395
],
[
395,
396
],
[
374,
397
],
[
397,
398
],
[
372,
399
],
[
399,
400
],
[
316,
401
],
[
401,
402
],
[
401,
403
],
[
403,
404
],
[
404,
405
],
[
404,
406
],
[
403,
408
],
[
408,
409
],
[
409,
410
],
[
410,
411
],
[
410,
412
],
[
408,
413
],
[
413,
414
],
[
413,
415
],
[
408,
416
],
[
416,
417
],
[
417,
418
],
[
408,
419
],
[
419,
420
],
[
420,
421
],
[
421,
422
],
[
421,
423
],
[
420,
424
],
[
424,
425
],
[
403,
426
],
[
426,
427
],
[
401,
428
],
[
428,
429
],
[
500,
430
],
[
430,
431
],
[
430,
432
],
[
432,
433
],
[
432,
434
],
[
434,
435
],
[
435,
436
],
[
435,
437
],
[
432,
438
],
[
438,
439
],
[
430,
440
],
[
440,
441
],
[
440,
442
],
[
442,
443
],
[
443,
444
],
[
444,
445
],
[
445,
446
],
[
445,
447
],
[
443,
448
],
[
448,
449
],
[
448,
450
],
[
450,
451
],
[
450,
452
],
[
443,
453
],
[
453,
454
],
[
454,
455
],
[
443,
456
],
[
457,
457
],
[
457,
458
],
[
458,
459
],
[
458,
460
],
[
460,
461
],
[
461,
462
],
[
461,
463
],
[
460,
464
],
[
442,
465
],
[
465,
466
],
[
440,
467
],
[
467,
468
],
[
430,
469
],
[
469,
470
],
[
469,
471
],
[
471,
472
],
[
472,
473
],
[
473,
474
],
[
474,
475
],
[
474,
476
],
[
472,
477
],
[
477,
478
],
[
477,
479
],
[
479,
480
],
[
479,
481
],
[
472,
482
],
[
482,
483
],
[
483,
484
],
[
472,
485
],
[
486,
486
],
[
486,
487
],
[
487,
488
],
[
487,
489
],
[
489,
490
],
[
490,
491
],
[
490,
492
],
[
489,
493
],
[
471,
494
],
[
494,
495
],
[
469,
496
],
[
496,
497
],
[
430,
498
],
[
0,
499
],
[
499,
500
],
[
499,
501
]
] |
[
"import java.io.*;\nimport java.util.*;\n\npublic class Main{\n\t\n\tstatic long mod=(long)1e9+7;\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tWriter out=new Writer(System.out);\n\t\tReader in=new Reader(System.in);\n\t\tint ts=1;\n\t\t\n\t\touter: while(ts-->0) {\t\n\t\t\tint n=in.nextInt();\n\t\t\tlong a[]=in.readLongArray(n);\n\t\t\tlong pro=1;\n\t\t\tsort(a);\n\t\t\tfor(long i: a) {\n\t\t\t\tif(i!=0 && pro>(long)1e18/i) {\n\t\t\t\t\tout.println(-1);\n\t\t\t\t\tcontinue outer;\n\t\t\t\t}\n\t\t\t\tpro=pro*i;\n\t\t\t}\n\t\t\tout.println(pro);\n\t\t}\n\t\tout.close();\t\t\n\t\t\n\t}\n\n\tstatic boolean tri(int a, int b, int c) {\n\t\tif(c<a+b && c>abs(a-b)) return true;\n\t\treturn false;\n\t}\n\t\n\t\n/*********************************** UTILITY CODE BELOW **************************************/\t\n\t\t\n\tstatic int abs(int a) {\n\t\treturn a>0 ? a : -a;\n\t}\n\t\n\tstatic int max(int a, int b) {\n\t\treturn a>b ? a : b;\n\t}\n\t\n\tstatic int pow(int n, int m) {\n\t\tif(m==0) return 1;\n\t\tint temp=pow(n,m/2);\n\t\tlong res=(((long)temp*temp)%mod);\n\t\tif(m%2==0) return (int)res;\n\t\treturn (int)((res*n)%mod);\n\t}\n\t\n\tstatic class Pair{\n\t\tint u, v;\n\t\t\n\t\tPair(int u, int v){this.u=u; this.v=v;}\n\t\t\n\t\tstatic void sort(Pair [] coll) {\t\t\n\t\t\tList<Pair> al=new ArrayList<>(Arrays.asList(coll));\n\t\t\tCollections.sort(al,new Comparator<Pair>() {\n\t\t\t\tpublic int compare(Pair p1, Pair p2) {\n\t\t\t\t\treturn p1.u-p2.u;\n\t\t\t\t}\t\n\t\t\t});\n\t\t\tfor(int i=0; i<al.size(); i++) {\n\t\t\t\tcoll[i]=al.get(i);\n\t\t\t}\n\t\t}\n\t\t\n\t}\n\t\n\tstatic void sort(int[] a) {\n\t\tArrayList<Integer> list=new ArrayList<>();\n\t\tfor (int i:a) list.add(i);\n\t\tCollections.sort(list);\n\t\tfor (int i=0; i<a.length; i++) a[i]=list.get(i);\n\t}\n\t\n\tstatic void sort(long a[]) {\n\t\tArrayList<Long> list=new ArrayList<>();\n\t\tfor(long i: a) list.add(i);\n\t\tCollections.sort(list);\n\t\tfor(int i=0; i<a.length; i++) a[i]=list.get(i);\n\t}\n\t\n\tstatic int [] array(int n, int value) {\t\n\t\tint a[]=new int[n];\n\t\tfor(int i=0; i<n; i++) a[i]=value;\n\t\treturn a;\n\t}\n\t\n\tstatic class Reader{\n\t\t\n\t\tBufferedReader br;\n\t\tStringTokenizer to;\n\t\t\n\t\tReader(InputStream stream){\n\t\t\tbr=new BufferedReader(new InputStreamReader(stream));\n\t\t\tto=new StringTokenizer(\"\");\n\t\t}\n\t\t\n\t\tString next() {\n\t\t\twhile(!to.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\tto=new StringTokenizer(br.readLine());\t\n\t\t\t\t}catch(IOException e) {}\n\t\t\t\t\n\t\t\t}\n\t\t\treturn to.nextToken();\n\t\t\t\n\t\t}\n\t\t\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t\t\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t\t\n\t\tint [] readArray(int n) {\n\t\t\tint a[]=new int[n];\n\t\t\tfor(int i=0; i<n ;i++) a[i]=nextInt();\n\t\t\treturn a;\n\t\t}\n\t\tlong [] readLongArray(int n) {\n\t\t\tlong a[]=new long[n];\n\t\t\tfor(int i=0; i<n ;i++) a[i]=nextLong();\n\t\t\treturn a;\n\t\t}\n\t\t\n\t}\n\t\n\tstatic class Writer extends PrintWriter{\n\t\tWriter(OutputStream stream){\n\t\t\tsuper(stream);\n\t\t}\n\t\tvoid println(int [] array) {\n\t\t\tfor(int i=0; i<array.length; i++) {\n\t\t\t\tprint(array[i]+\" \");\n\t\t\t}\n\t\t\tprintln();\n\t\t}\n\t\tvoid println(long [] array) {\n\t\t\tfor(int i=0; i<array.length; i++) {\n\t\t\t\tprint(array[i]+\" \");\n\t\t\t}\n\t\t\tprintln();\n\t\t}\n\t}\n\t\n}",
"Comparator<Pair>() {\n\t\t\t\tpublic int compare(Pair p1, Pair p2) {\n\t\t\t\t\treturn p1.u-p2.u;\n\t\t\t\t}\t\n\t\t\t}",
"public int compare(Pair p1, Pair p2) {\n\t\t\t\t\treturn p1.u-p2.u;\n\t\t\t\t}",
"compare",
"{\n\t\t\t\t\treturn p1.u-p2.u;\n\t\t\t\t}",
"return p1.u-p2.u;",
"p1.u-p2.u",
"p1.u",
"p1",
"p1.u",
"p2.u",
"p2",
"p2.u",
"Pair p1",
"p1",
"Pair p2",
"p2",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n\t\n\tstatic long mod=(long)1e9+7;\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tWriter out=new Writer(System.out);\n\t\tReader in=new Reader(System.in);\n\t\tint ts=1;\n\t\t\n\t\touter: while(ts-->0) {\t\n\t\t\tint n=in.nextInt();\n\t\t\tlong a[]=in.readLongArray(n);\n\t\t\tlong pro=1;\n\t\t\tsort(a);\n\t\t\tfor(long i: a) {\n\t\t\t\tif(i!=0 && pro>(long)1e18/i) {\n\t\t\t\t\tout.println(-1);\n\t\t\t\t\tcontinue outer;\n\t\t\t\t}\n\t\t\t\tpro=pro*i;\n\t\t\t}\n\t\t\tout.println(pro);\n\t\t}\n\t\tout.close();\t\t\n\t\t\n\t}\n\n\tstatic boolean tri(int a, int b, int c) {\n\t\tif(c<a+b && c>abs(a-b)) return true;\n\t\treturn false;\n\t}\n\t\n\t\n/*********************************** UTILITY CODE BELOW **************************************/\t\n\t\t\n\tstatic int abs(int a) {\n\t\treturn a>0 ? a : -a;\n\t}\n\t\n\tstatic int max(int a, int b) {\n\t\treturn a>b ? a : b;\n\t}\n\t\n\tstatic int pow(int n, int m) {\n\t\tif(m==0) return 1;\n\t\tint temp=pow(n,m/2);\n\t\tlong res=(((long)temp*temp)%mod);\n\t\tif(m%2==0) return (int)res;\n\t\treturn (int)((res*n)%mod);\n\t}\n\t\n\tstatic class Pair{\n\t\tint u, v;\n\t\t\n\t\tPair(int u, int v){this.u=u; this.v=v;}\n\t\t\n\t\tstatic void sort(Pair [] coll) {\t\t\n\t\t\tList<Pair> al=new ArrayList<>(Arrays.asList(coll));\n\t\t\tCollections.sort(al,new Comparator<Pair>() {\n\t\t\t\tpublic int compare(Pair p1, Pair p2) {\n\t\t\t\t\treturn p1.u-p2.u;\n\t\t\t\t}\t\n\t\t\t});\n\t\t\tfor(int i=0; i<al.size(); i++) {\n\t\t\t\tcoll[i]=al.get(i);\n\t\t\t}\n\t\t}\n\t\t\n\t}\n\t\n\tstatic void sort(int[] a) {\n\t\tArrayList<Integer> list=new ArrayList<>();\n\t\tfor (int i:a) list.add(i);\n\t\tCollections.sort(list);\n\t\tfor (int i=0; i<a.length; i++) a[i]=list.get(i);\n\t}\n\t\n\tstatic void sort(long a[]) {\n\t\tArrayList<Long> list=new ArrayList<>();\n\t\tfor(long i: a) list.add(i);\n\t\tCollections.sort(list);\n\t\tfor(int i=0; i<a.length; i++) a[i]=list.get(i);\n\t}\n\t\n\tstatic int [] array(int n, int value) {\t\n\t\tint a[]=new int[n];\n\t\tfor(int i=0; i<n; i++) a[i]=value;\n\t\treturn a;\n\t}\n\t\n\tstatic class Reader{\n\t\t\n\t\tBufferedReader br;\n\t\tStringTokenizer to;\n\t\t\n\t\tReader(InputStream stream){\n\t\t\tbr=new BufferedReader(new InputStreamReader(stream));\n\t\t\tto=new StringTokenizer(\"\");\n\t\t}\n\t\t\n\t\tString next() {\n\t\t\twhile(!to.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\tto=new StringTokenizer(br.readLine());\t\n\t\t\t\t}catch(IOException e) {}\n\t\t\t\t\n\t\t\t}\n\t\t\treturn to.nextToken();\n\t\t\t\n\t\t}\n\t\t\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t\t\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t\t\n\t\tint [] readArray(int n) {\n\t\t\tint a[]=new int[n];\n\t\t\tfor(int i=0; i<n ;i++) a[i]=nextInt();\n\t\t\treturn a;\n\t\t}\n\t\tlong [] readLongArray(int n) {\n\t\t\tlong a[]=new long[n];\n\t\t\tfor(int i=0; i<n ;i++) a[i]=nextLong();\n\t\t\treturn a;\n\t\t}\n\t\t\n\t}\n\t\n\tstatic class Writer extends PrintWriter{\n\t\tWriter(OutputStream stream){\n\t\t\tsuper(stream);\n\t\t}\n\t\tvoid println(int [] array) {\n\t\t\tfor(int i=0; i<array.length; i++) {\n\t\t\t\tprint(array[i]+\" \");\n\t\t\t}\n\t\t\tprintln();\n\t\t}\n\t\tvoid println(long [] array) {\n\t\t\tfor(int i=0; i<array.length; i++) {\n\t\t\t\tprint(array[i]+\" \");\n\t\t\t}\n\t\t\tprintln();\n\t\t}\n\t}\n\t\n}",
"Main",
"static long mod=(long)1e9+7;",
"mod",
"(long)1e9+7",
"(long)1e9",
"7",
"public static void main(String[] args) throws IOException {\n\t\tWriter out=new Writer(System.out);\n\t\tReader in=new Reader(System.in);\n\t\tint ts=1;\n\t\t\n\t\touter: while(ts-->0) {\t\n\t\t\tint n=in.nextInt();\n\t\t\tlong a[]=in.readLongArray(n);\n\t\t\tlong pro=1;\n\t\t\tsort(a);\n\t\t\tfor(long i: a) {\n\t\t\t\tif(i!=0 && pro>(long)1e18/i) {\n\t\t\t\t\tout.println(-1);\n\t\t\t\t\tcontinue outer;\n\t\t\t\t}\n\t\t\t\tpro=pro*i;\n\t\t\t}\n\t\t\tout.println(pro);\n\t\t}\n\t\tout.close();\t\t\n\t\t\n\t}",
"main",
"{\n\t\tWriter out=new Writer(System.out);\n\t\tReader in=new Reader(System.in);\n\t\tint ts=1;\n\t\t\n\t\touter: while(ts-->0) {\t\n\t\t\tint n=in.nextInt();\n\t\t\tlong a[]=in.readLongArray(n);\n\t\t\tlong pro=1;\n\t\t\tsort(a);\n\t\t\tfor(long i: a) {\n\t\t\t\tif(i!=0 && pro>(long)1e18/i) {\n\t\t\t\t\tout.println(-1);\n\t\t\t\t\tcontinue outer;\n\t\t\t\t}\n\t\t\t\tpro=pro*i;\n\t\t\t}\n\t\t\tout.println(pro);\n\t\t}\n\t\tout.close();\t\t\n\t\t\n\t}",
"Writer out=new Writer(System.out);",
"out",
"new Writer(System.out)",
"Reader in=new Reader(System.in);",
"in",
"new Reader(System.in)",
"int ts=1;",
"ts",
"1",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static boolean tri(int a, int b, int c) {\n\t\tif(c<a+b && c>abs(a-b)) return true;\n\t\treturn false;\n\t}",
"tri",
"{\n\t\tif(c<a+b && c>abs(a-b)) return true;\n\t\treturn false;\n\t}",
"if(c<a+b && c>abs(a-b)) return true;",
"c<a+b && c>abs(a-b)",
"c<a+b",
"c",
"a+b",
"a",
"b",
"c>abs(a-b)",
"c",
"abs(a-b)",
"abs",
"a-b",
"a",
"b",
"return true;",
"true",
"return false;",
"false",
"int a",
"a",
"int b",
"b",
"int c",
"c",
"/*********************************** UTILITY CODE BELOW **************************************/\t\n\t\t\n\tstatic int abs(int a) {\n\t\treturn a>0 ? a : -a;\n\t}",
"abs",
"{\n\t\treturn a>0 ? a : -a;\n\t}",
"return a>0 ? a : -a;",
"a>0 ? a : -a",
"a>0",
"a",
"0",
"a",
"-a",
"a",
"int a",
"a",
"static int max(int a, int b) {\n\t\treturn a>b ? a : b;\n\t}",
"max",
"{\n\t\treturn a>b ? a : b;\n\t}",
"return a>b ? a : b;",
"a>b ? a : b",
"a>b",
"a",
"b",
"a",
"b",
"int a",
"a",
"int b",
"b",
"static int pow(int n, int m) {\n\t\tif(m==0) return 1;\n\t\tint temp=pow(n,m/2);\n\t\tlong res=(((long)temp*temp)%mod);\n\t\tif(m%2==0) return (int)res;\n\t\treturn (int)((res*n)%mod);\n\t}",
"pow",
"{\n\t\tif(m==0) return 1;\n\t\tint temp=pow(n,m/2);\n\t\tlong res=(((long)temp*temp)%mod);\n\t\tif(m%2==0) return (int)res;\n\t\treturn (int)((res*n)%mod);\n\t}",
"if(m==0) return 1;",
"m==0",
"m",
"0",
"return 1;",
"1",
"int temp=pow(n,m/2);",
"temp",
"pow(n,m/2)",
"pow",
"n",
"m/2",
"m",
"2",
"long res=(((long)temp*temp)%mod);",
"res",
"(((long)temp*temp)%mod)",
"((long)temp*temp)",
"(long)temp",
"temp",
"mod",
"if(m%2==0) return (int)res;",
"m%2==0",
"m%2",
"m",
"2",
"0",
"return (int)res;",
"(int)res",
"return (int)((res*n)%mod);",
"(int)((res*n)%mod)",
"(res*n)",
"res",
"n",
"mod",
"int n",
"n",
"int m",
"m",
"static void sort(int[] a) {\n\t\tArrayList<Integer> list=new ArrayList<>();\n\t\tfor (int i:a) list.add(i);\n\t\tCollections.sort(list);\n\t\tfor (int i=0; i<a.length; i++) a[i]=list.get(i);\n\t}",
"sort",
"{\n\t\tArrayList<Integer> list=new ArrayList<>();\n\t\tfor (int i:a) list.add(i);\n\t\tCollections.sort(list);\n\t\tfor (int i=0; i<a.length; i++) a[i]=list.get(i);\n\t}",
"ArrayList<Integer> list=new ArrayList<>();",
"list",
"new ArrayList<>()",
"for (int i:a) list.add(i);",
"int i",
"a",
"list.add(i);",
"list.add(i)",
"list.add",
"list",
"i",
"Collections.sort(list)",
"Collections.sort",
"Collections",
"list",
"for (int i=0; i<a.length; i++) a[i]=list.get(i);",
"int i=0;",
"int i=0;",
"i",
"0",
"i<a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"a[i]=list.get(i);",
"a[i]=list.get(i)",
"a[i]",
"a",
"i",
"list.get(i)",
"list.get",
"list",
"i",
"int[] a",
"a",
"static void sort(long a[]) {\n\t\tArrayList<Long> list=new ArrayList<>();\n\t\tfor(long i: a) list.add(i);\n\t\tCollections.sort(list);\n\t\tfor(int i=0; i<a.length; i++) a[i]=list.get(i);\n\t}",
"sort",
"{\n\t\tArrayList<Long> list=new ArrayList<>();\n\t\tfor(long i: a) list.add(i);\n\t\tCollections.sort(list);\n\t\tfor(int i=0; i<a.length; i++) a[i]=list.get(i);\n\t}",
"ArrayList<Long> list=new ArrayList<>();",
"list",
"new ArrayList<>()",
"for(long i: a) list.add(i);",
"long i",
"a",
"list.add(i);",
"list.add(i)",
"list.add",
"list",
"i",
"Collections.sort(list)",
"Collections.sort",
"Collections",
"list",
"for(int i=0; i<a.length; i++) a[i]=list.get(i);",
"int i=0;",
"int i=0;",
"i",
"0",
"i<a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"a[i]=list.get(i);",
"a[i]=list.get(i)",
"a[i]",
"a",
"i",
"list.get(i)",
"list.get",
"list",
"i",
"long a[]",
"a",
"static int [] array(int n, int value) {\t\n\t\tint a[]=new int[n];\n\t\tfor(int i=0; i<n; i++) a[i]=value;\n\t\treturn a;\n\t}",
"array",
"{\t\n\t\tint a[]=new int[n];\n\t\tfor(int i=0; i<n; i++) a[i]=value;\n\t\treturn a;\n\t}",
"int a[]=new int[n];",
"a",
"new int[n]",
"n",
"for(int i=0; i<n; i++) a[i]=value;",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"a[i]=value;",
"a[i]=value",
"a[i]",
"a",
"i",
"value",
"return a;",
"a",
"int n",
"n",
"int value",
"value",
"static class Pair{\n\t\tint u, v;\n\t\t\n\t\tPair(int u, int v){this.u=u; this.v=v;}\n\t\t\n\t\tstatic void sort(Pair [] coll) {\t\t\n\t\t\tList<Pair> al=new ArrayList<>(Arrays.asList(coll));\n\t\t\tCollections.sort(al,new Comparator<Pair>() {\n\t\t\t\tpublic int compare(Pair p1, Pair p2) {\n\t\t\t\t\treturn p1.u-p2.u;\n\t\t\t\t}\t\n\t\t\t});\n\t\t\tfor(int i=0; i<al.size(); i++) {\n\t\t\t\tcoll[i]=al.get(i);\n\t\t\t}\n\t\t}\n\t\t\n\t}",
"Pair",
"int u",
"u",
"v;",
"v",
"Pair(int u, int v){this.u=u; this.v=v;}",
"Pair",
"{this.u=u; this.v=v;}",
"this.u=u",
"this.u",
"this",
"this.u",
"u",
"this.v=v",
"this.v",
"this",
"this.v",
"v",
"int u",
"u",
"int v",
"v",
"static void sort(Pair [] coll) {\t\t\n\t\t\tList<Pair> al=new ArrayList<>(Arrays.asList(coll));\n\t\t\tCollections.sort(al,new Comparator<Pair>() {\n\t\t\t\tpublic int compare(Pair p1, Pair p2) {\n\t\t\t\t\treturn p1.u-p2.u;\n\t\t\t\t}\t\n\t\t\t});\n\t\t\tfor(int i=0; i<al.size(); i++) {\n\t\t\t\tcoll[i]=al.get(i);\n\t\t\t}\n\t\t}",
"sort",
"{\t\t\n\t\t\tList<Pair> al=new ArrayList<>(Arrays.asList(coll));\n\t\t\tCollections.sort(al,new Comparator<Pair>() {\n\t\t\t\tpublic int compare(Pair p1, Pair p2) {\n\t\t\t\t\treturn p1.u-p2.u;\n\t\t\t\t}\t\n\t\t\t});\n\t\t\tfor(int i=0; i<al.size(); i++) {\n\t\t\t\tcoll[i]=al.get(i);\n\t\t\t}\n\t\t}",
"List<Pair> al=new ArrayList<>(Arrays.asList(coll));",
"al",
"new ArrayList<>(Arrays.asList(coll))",
"Collections.sort(al,new Comparator<Pair>() {\n\t\t\t\tpublic int compare(Pair p1, Pair p2) {\n\t\t\t\t\treturn p1.u-p2.u;\n\t\t\t\t}\t\n\t\t\t})",
"Collections.sort",
"Collections",
"al",
"new Comparator<Pair>() {\n\t\t\t\tpublic int compare(Pair p1, Pair p2) {\n\t\t\t\t\treturn p1.u-p2.u;\n\t\t\t\t}\t\n\t\t\t}",
"for(int i=0; i<al.size(); i++) {\n\t\t\t\tcoll[i]=al.get(i);\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<al.size()",
"i",
"al.size()",
"al.size",
"al",
"i++",
"i++",
"i",
"{\n\t\t\t\tcoll[i]=al.get(i);\n\t\t\t}",
"{\n\t\t\t\tcoll[i]=al.get(i);\n\t\t\t}",
"coll[i]=al.get(i)",
"coll[i]",
"coll",
"i",
"al.get(i)",
"al.get",
"al",
"i",
"Pair [] coll",
"coll",
"static class Reader{\n\t\t\n\t\tBufferedReader br;\n\t\tStringTokenizer to;\n\t\t\n\t\tReader(InputStream stream){\n\t\t\tbr=new BufferedReader(new InputStreamReader(stream));\n\t\t\tto=new StringTokenizer(\"\");\n\t\t}\n\t\t\n\t\tString next() {\n\t\t\twhile(!to.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\tto=new StringTokenizer(br.readLine());\t\n\t\t\t\t}catch(IOException e) {}\n\t\t\t\t\n\t\t\t}\n\t\t\treturn to.nextToken();\n\t\t\t\n\t\t}\n\t\t\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t\t\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t\t\n\t\tint [] readArray(int n) {\n\t\t\tint a[]=new int[n];\n\t\t\tfor(int i=0; i<n ;i++) a[i]=nextInt();\n\t\t\treturn a;\n\t\t}\n\t\tlong [] readLongArray(int n) {\n\t\t\tlong a[]=new long[n];\n\t\t\tfor(int i=0; i<n ;i++) a[i]=nextLong();\n\t\t\treturn a;\n\t\t}\n\t\t\n\t}",
"Reader",
"BufferedReader br;",
"br",
"StringTokenizer to;",
"to",
"Reader(InputStream stream){\n\t\t\tbr=new BufferedReader(new InputStreamReader(stream));\n\t\t\tto=new StringTokenizer(\"\");\n\t\t}",
"Reader",
"{\n\t\t\tbr=new BufferedReader(new InputStreamReader(stream));\n\t\t\tto=new StringTokenizer(\"\");\n\t\t}",
"br=new BufferedReader(new InputStreamReader(stream))",
"br",
"new BufferedReader(new InputStreamReader(stream))",
"to=new StringTokenizer(\"\")",
"to",
"new StringTokenizer(\"\")",
"InputStream stream",
"stream",
"String next() {\n\t\t\twhile(!to.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\tto=new StringTokenizer(br.readLine());\t\n\t\t\t\t}catch(IOException e) {}\n\t\t\t\t\n\t\t\t}\n\t\t\treturn to.nextToken();\n\t\t\t\n\t\t}",
"next",
"{\n\t\t\twhile(!to.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\tto=new StringTokenizer(br.readLine());\t\n\t\t\t\t}catch(IOException e) {}\n\t\t\t\t\n\t\t\t}\n\t\t\treturn to.nextToken();\n\t\t\t\n\t\t}",
"while(!to.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\tto=new StringTokenizer(br.readLine());\t\n\t\t\t\t}catch(IOException e) {}\n\t\t\t\t\n\t\t\t}",
"!to.hasMoreTokens()",
"to.hasMoreTokens()",
"to.hasMoreTokens",
"to",
"{\n\t\t\t\ttry {\n\t\t\t\t\tto=new StringTokenizer(br.readLine());\t\n\t\t\t\t}catch(IOException e) {}\n\t\t\t\t\n\t\t\t}",
"try {\n\t\t\t\t\tto=new StringTokenizer(br.readLine());\t\n\t\t\t\t}catch(IOException e) {}",
"catch(IOException e) {}",
"IOException e",
"{}",
"{\n\t\t\t\t\tto=new StringTokenizer(br.readLine());\t\n\t\t\t\t}",
"to=new StringTokenizer(br.readLine())",
"to",
"new StringTokenizer(br.readLine())",
"return to.nextToken();",
"to.nextToken()",
"to.nextToken",
"to",
"int nextInt() {\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",
"long nextLong() {\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",
"int [] readArray(int n) {\n\t\t\tint a[]=new int[n];\n\t\t\tfor(int i=0; i<n ;i++) a[i]=nextInt();\n\t\t\treturn a;\n\t\t}",
"readArray",
"{\n\t\t\tint a[]=new int[n];\n\t\t\tfor(int i=0; i<n ;i++) a[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++) 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",
"long [] readLongArray(int n) {\n\t\t\tlong a[]=new long[n];\n\t\t\tfor(int i=0; i<n ;i++) a[i]=nextLong();\n\t\t\treturn a;\n\t\t}",
"readLongArray",
"{\n\t\t\tlong a[]=new long[n];\n\t\t\tfor(int i=0; i<n ;i++) a[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++) 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",
"static class Writer extends PrintWriter{\n\t\tWriter(OutputStream stream){\n\t\t\tsuper(stream);\n\t\t}\n\t\tvoid println(int [] array) {\n\t\t\tfor(int i=0; i<array.length; i++) {\n\t\t\t\tprint(array[i]+\" \");\n\t\t\t}\n\t\t\tprintln();\n\t\t}\n\t\tvoid println(long [] array) {\n\t\t\tfor(int i=0; i<array.length; i++) {\n\t\t\t\tprint(array[i]+\" \");\n\t\t\t}\n\t\t\tprintln();\n\t\t}\n\t}",
"Writer",
"Writer(OutputStream stream){\n\t\t\tsuper(stream);\n\t\t}",
"Writer",
"{\n\t\t\tsuper(stream);\n\t\t}",
"super(stream)",
"super",
"stream",
"OutputStream stream",
"stream",
"void println(int [] array) {\n\t\t\tfor(int i=0; i<array.length; i++) {\n\t\t\t\tprint(array[i]+\" \");\n\t\t\t}\n\t\t\tprintln();\n\t\t}",
"println",
"{\n\t\t\tfor(int i=0; i<array.length; i++) {\n\t\t\t\tprint(array[i]+\" \");\n\t\t\t}\n\t\t\tprintln();\n\t\t}",
"for(int i=0; i<array.length; i++) {\n\t\t\t\tprint(array[i]+\" \");\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<array.length",
"i",
"array.length",
"array",
"array.length",
"i++",
"i++",
"i",
"{\n\t\t\t\tprint(array[i]+\" \");\n\t\t\t}",
"{\n\t\t\t\tprint(array[i]+\" \");\n\t\t\t}",
"print(array[i]+\" \")",
"print",
"array[i]+\" \"",
"array[i]",
"array",
"i",
"\" \"",
"println()",
"println",
"int [] array",
"array",
"void println(long [] array) {\n\t\t\tfor(int i=0; i<array.length; i++) {\n\t\t\t\tprint(array[i]+\" \");\n\t\t\t}\n\t\t\tprintln();\n\t\t}",
"println",
"{\n\t\t\tfor(int i=0; i<array.length; i++) {\n\t\t\t\tprint(array[i]+\" \");\n\t\t\t}\n\t\t\tprintln();\n\t\t}",
"for(int i=0; i<array.length; i++) {\n\t\t\t\tprint(array[i]+\" \");\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<array.length",
"i",
"array.length",
"array",
"array.length",
"i++",
"i++",
"i",
"{\n\t\t\t\tprint(array[i]+\" \");\n\t\t\t}",
"{\n\t\t\t\tprint(array[i]+\" \");\n\t\t\t}",
"print(array[i]+\" \")",
"print",
"array[i]+\" \"",
"array[i]",
"array",
"i",
"\" \"",
"println()",
"println",
"long [] array",
"array",
"PrintWriter",
"public class Main{\n\t\n\tstatic long mod=(long)1e9+7;\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tWriter out=new Writer(System.out);\n\t\tReader in=new Reader(System.in);\n\t\tint ts=1;\n\t\t\n\t\touter: while(ts-->0) {\t\n\t\t\tint n=in.nextInt();\n\t\t\tlong a[]=in.readLongArray(n);\n\t\t\tlong pro=1;\n\t\t\tsort(a);\n\t\t\tfor(long i: a) {\n\t\t\t\tif(i!=0 && pro>(long)1e18/i) {\n\t\t\t\t\tout.println(-1);\n\t\t\t\t\tcontinue outer;\n\t\t\t\t}\n\t\t\t\tpro=pro*i;\n\t\t\t}\n\t\t\tout.println(pro);\n\t\t}\n\t\tout.close();\t\t\n\t\t\n\t}\n\n\tstatic boolean tri(int a, int b, int c) {\n\t\tif(c<a+b && c>abs(a-b)) return true;\n\t\treturn false;\n\t}\n\t\n\t\n/*********************************** UTILITY CODE BELOW **************************************/\t\n\t\t\n\tstatic int abs(int a) {\n\t\treturn a>0 ? a : -a;\n\t}\n\t\n\tstatic int max(int a, int b) {\n\t\treturn a>b ? a : b;\n\t}\n\t\n\tstatic int pow(int n, int m) {\n\t\tif(m==0) return 1;\n\t\tint temp=pow(n,m/2);\n\t\tlong res=(((long)temp*temp)%mod);\n\t\tif(m%2==0) return (int)res;\n\t\treturn (int)((res*n)%mod);\n\t}\n\t\n\tstatic class Pair{\n\t\tint u, v;\n\t\t\n\t\tPair(int u, int v){this.u=u; this.v=v;}\n\t\t\n\t\tstatic void sort(Pair [] coll) {\t\t\n\t\t\tList<Pair> al=new ArrayList<>(Arrays.asList(coll));\n\t\t\tCollections.sort(al,new Comparator<Pair>() {\n\t\t\t\tpublic int compare(Pair p1, Pair p2) {\n\t\t\t\t\treturn p1.u-p2.u;\n\t\t\t\t}\t\n\t\t\t});\n\t\t\tfor(int i=0; i<al.size(); i++) {\n\t\t\t\tcoll[i]=al.get(i);\n\t\t\t}\n\t\t}\n\t\t\n\t}\n\t\n\tstatic void sort(int[] a) {\n\t\tArrayList<Integer> list=new ArrayList<>();\n\t\tfor (int i:a) list.add(i);\n\t\tCollections.sort(list);\n\t\tfor (int i=0; i<a.length; i++) a[i]=list.get(i);\n\t}\n\t\n\tstatic void sort(long a[]) {\n\t\tArrayList<Long> list=new ArrayList<>();\n\t\tfor(long i: a) list.add(i);\n\t\tCollections.sort(list);\n\t\tfor(int i=0; i<a.length; i++) a[i]=list.get(i);\n\t}\n\t\n\tstatic int [] array(int n, int value) {\t\n\t\tint a[]=new int[n];\n\t\tfor(int i=0; i<n; i++) a[i]=value;\n\t\treturn a;\n\t}\n\t\n\tstatic class Reader{\n\t\t\n\t\tBufferedReader br;\n\t\tStringTokenizer to;\n\t\t\n\t\tReader(InputStream stream){\n\t\t\tbr=new BufferedReader(new InputStreamReader(stream));\n\t\t\tto=new StringTokenizer(\"\");\n\t\t}\n\t\t\n\t\tString next() {\n\t\t\twhile(!to.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\tto=new StringTokenizer(br.readLine());\t\n\t\t\t\t}catch(IOException e) {}\n\t\t\t\t\n\t\t\t}\n\t\t\treturn to.nextToken();\n\t\t\t\n\t\t}\n\t\t\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t\t\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t\t\n\t\tint [] readArray(int n) {\n\t\t\tint a[]=new int[n];\n\t\t\tfor(int i=0; i<n ;i++) a[i]=nextInt();\n\t\t\treturn a;\n\t\t}\n\t\tlong [] readLongArray(int n) {\n\t\t\tlong a[]=new long[n];\n\t\t\tfor(int i=0; i<n ;i++) a[i]=nextLong();\n\t\t\treturn a;\n\t\t}\n\t\t\n\t}\n\t\n\tstatic class Writer extends PrintWriter{\n\t\tWriter(OutputStream stream){\n\t\t\tsuper(stream);\n\t\t}\n\t\tvoid println(int [] array) {\n\t\t\tfor(int i=0; i<array.length; i++) {\n\t\t\t\tprint(array[i]+\" \");\n\t\t\t}\n\t\t\tprintln();\n\t\t}\n\t\tvoid println(long [] array) {\n\t\t\tfor(int i=0; i<array.length; i++) {\n\t\t\t\tprint(array[i]+\" \");\n\t\t\t}\n\t\t\tprintln();\n\t\t}\n\t}\n\t\n}",
"public class Main{\n\t\n\tstatic long mod=(long)1e9+7;\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tWriter out=new Writer(System.out);\n\t\tReader in=new Reader(System.in);\n\t\tint ts=1;\n\t\t\n\t\touter: while(ts-->0) {\t\n\t\t\tint n=in.nextInt();\n\t\t\tlong a[]=in.readLongArray(n);\n\t\t\tlong pro=1;\n\t\t\tsort(a);\n\t\t\tfor(long i: a) {\n\t\t\t\tif(i!=0 && pro>(long)1e18/i) {\n\t\t\t\t\tout.println(-1);\n\t\t\t\t\tcontinue outer;\n\t\t\t\t}\n\t\t\t\tpro=pro*i;\n\t\t\t}\n\t\t\tout.println(pro);\n\t\t}\n\t\tout.close();\t\t\n\t\t\n\t}\n\n\tstatic boolean tri(int a, int b, int c) {\n\t\tif(c<a+b && c>abs(a-b)) return true;\n\t\treturn false;\n\t}\n\t\n\t\n/*********************************** UTILITY CODE BELOW **************************************/\t\n\t\t\n\tstatic int abs(int a) {\n\t\treturn a>0 ? a : -a;\n\t}\n\t\n\tstatic int max(int a, int b) {\n\t\treturn a>b ? a : b;\n\t}\n\t\n\tstatic int pow(int n, int m) {\n\t\tif(m==0) return 1;\n\t\tint temp=pow(n,m/2);\n\t\tlong res=(((long)temp*temp)%mod);\n\t\tif(m%2==0) return (int)res;\n\t\treturn (int)((res*n)%mod);\n\t}\n\t\n\tstatic class Pair{\n\t\tint u, v;\n\t\t\n\t\tPair(int u, int v){this.u=u; this.v=v;}\n\t\t\n\t\tstatic void sort(Pair [] coll) {\t\t\n\t\t\tList<Pair> al=new ArrayList<>(Arrays.asList(coll));\n\t\t\tCollections.sort(al,new Comparator<Pair>() {\n\t\t\t\tpublic int compare(Pair p1, Pair p2) {\n\t\t\t\t\treturn p1.u-p2.u;\n\t\t\t\t}\t\n\t\t\t});\n\t\t\tfor(int i=0; i<al.size(); i++) {\n\t\t\t\tcoll[i]=al.get(i);\n\t\t\t}\n\t\t}\n\t\t\n\t}\n\t\n\tstatic void sort(int[] a) {\n\t\tArrayList<Integer> list=new ArrayList<>();\n\t\tfor (int i:a) list.add(i);\n\t\tCollections.sort(list);\n\t\tfor (int i=0; i<a.length; i++) a[i]=list.get(i);\n\t}\n\t\n\tstatic void sort(long a[]) {\n\t\tArrayList<Long> list=new ArrayList<>();\n\t\tfor(long i: a) list.add(i);\n\t\tCollections.sort(list);\n\t\tfor(int i=0; i<a.length; i++) a[i]=list.get(i);\n\t}\n\t\n\tstatic int [] array(int n, int value) {\t\n\t\tint a[]=new int[n];\n\t\tfor(int i=0; i<n; i++) a[i]=value;\n\t\treturn a;\n\t}\n\t\n\tstatic class Reader{\n\t\t\n\t\tBufferedReader br;\n\t\tStringTokenizer to;\n\t\t\n\t\tReader(InputStream stream){\n\t\t\tbr=new BufferedReader(new InputStreamReader(stream));\n\t\t\tto=new StringTokenizer(\"\");\n\t\t}\n\t\t\n\t\tString next() {\n\t\t\twhile(!to.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\tto=new StringTokenizer(br.readLine());\t\n\t\t\t\t}catch(IOException e) {}\n\t\t\t\t\n\t\t\t}\n\t\t\treturn to.nextToken();\n\t\t\t\n\t\t}\n\t\t\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t\t\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t\t\n\t\tint [] readArray(int n) {\n\t\t\tint a[]=new int[n];\n\t\t\tfor(int i=0; i<n ;i++) a[i]=nextInt();\n\t\t\treturn a;\n\t\t}\n\t\tlong [] readLongArray(int n) {\n\t\t\tlong a[]=new long[n];\n\t\t\tfor(int i=0; i<n ;i++) a[i]=nextLong();\n\t\t\treturn a;\n\t\t}\n\t\t\n\t}\n\t\n\tstatic class Writer extends PrintWriter{\n\t\tWriter(OutputStream stream){\n\t\t\tsuper(stream);\n\t\t}\n\t\tvoid println(int [] array) {\n\t\t\tfor(int i=0; i<array.length; i++) {\n\t\t\t\tprint(array[i]+\" \");\n\t\t\t}\n\t\t\tprintln();\n\t\t}\n\t\tvoid println(long [] array) {\n\t\t\tfor(int i=0; i<array.length; i++) {\n\t\t\t\tprint(array[i]+\" \");\n\t\t\t}\n\t\t\tprintln();\n\t\t}\n\t}\n\t\n}",
"Main"
] |
import java.io.*;
import java.util.*;
public class Main{
static long mod=(long)1e9+7;
public static void main(String[] args) throws IOException {
Writer out=new Writer(System.out);
Reader in=new Reader(System.in);
int ts=1;
outer: while(ts-->0) {
int n=in.nextInt();
long a[]=in.readLongArray(n);
long pro=1;
sort(a);
for(long i: a) {
if(i!=0 && pro>(long)1e18/i) {
out.println(-1);
continue outer;
}
pro=pro*i;
}
out.println(pro);
}
out.close();
}
static boolean tri(int a, int b, int c) {
if(c<a+b && c>abs(a-b)) return true;
return false;
}
/*********************************** UTILITY CODE BELOW **************************************/
static int abs(int a) {
return a>0 ? a : -a;
}
static int max(int a, int b) {
return a>b ? a : b;
}
static int pow(int n, int m) {
if(m==0) return 1;
int temp=pow(n,m/2);
long res=(((long)temp*temp)%mod);
if(m%2==0) return (int)res;
return (int)((res*n)%mod);
}
static class Pair{
int u, v;
Pair(int u, int v){this.u=u; this.v=v;}
static void sort(Pair [] coll) {
List<Pair> al=new ArrayList<>(Arrays.asList(coll));
Collections.sort(al,new Comparator<Pair>() {
public int compare(Pair p1, Pair p2) {
return p1.u-p2.u;
}
});
for(int i=0; i<al.size(); i++) {
coll[i]=al.get(i);
}
}
}
static void sort(int[] a) {
ArrayList<Integer> list=new ArrayList<>();
for (int i:a) list.add(i);
Collections.sort(list);
for (int i=0; i<a.length; i++) a[i]=list.get(i);
}
static void sort(long a[]) {
ArrayList<Long> list=new ArrayList<>();
for(long i: a) list.add(i);
Collections.sort(list);
for(int i=0; i<a.length; i++) a[i]=list.get(i);
}
static int [] array(int n, int value) {
int a[]=new int[n];
for(int i=0; i<n; i++) a[i]=value;
return a;
}
static class Reader{
BufferedReader br;
StringTokenizer to;
Reader(InputStream stream){
br=new BufferedReader(new InputStreamReader(stream));
to=new StringTokenizer("");
}
String next() {
while(!to.hasMoreTokens()) {
try {
to=new StringTokenizer(br.readLine());
}catch(IOException e) {}
}
return to.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
int [] readArray(int n) {
int a[]=new int[n];
for(int i=0; i<n ;i++) a[i]=nextInt();
return a;
}
long [] readLongArray(int n) {
long a[]=new long[n];
for(int i=0; i<n ;i++) a[i]=nextLong();
return a;
}
}
static class Writer extends PrintWriter{
Writer(OutputStream stream){
super(stream);
}
void println(int [] array) {
for(int i=0; i<array.length; i++) {
print(array[i]+" ");
}
println();
}
void println(long [] array) {
for(int i=0; i<array.length; i++) {
print(array[i]+" ");
}
println();
}
}
}
|
[
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,
29,
14,
2,
13,
17,
30,
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,
2,
13,
18,
13,
13,
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
],
[
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
],
[
8,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
69,
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
],
[
85,
87
],
[
84,
88
],
[
88,
89
],
[
88,
90
],
[
83,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
92,
97
],
[
97,
98
],
[
91,
99
],
[
83,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
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.*;\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\tlong max = (long)Math.pow(10,18);\n\t\t\n\t\tfor(int i=0; i<n; i++){\n\t\t a[i]=sc.nextLong();\n\t\t if(a[i]==0){\n\t\t System.out.println(0);\n\t\t return;\n\t\t }\n\t\t}\n\t\t\n\t\tif(ans != 0){\n\t\t for(int i=0; i<n; i++){\n\t\t if(max/ans <a[i]){\n\t\t System.out.println(-1);\n\t\t return;\n\t\t }else{\n\t\t ans = ans*a[i];\n\t\t }\n\t\t }\n\t\t}\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\tlong max = (long)Math.pow(10,18);\n\t\t\n\t\tfor(int i=0; i<n; i++){\n\t\t a[i]=sc.nextLong();\n\t\t if(a[i]==0){\n\t\t System.out.println(0);\n\t\t return;\n\t\t }\n\t\t}\n\t\t\n\t\tif(ans != 0){\n\t\t for(int i=0; i<n; i++){\n\t\t if(max/ans <a[i]){\n\t\t System.out.println(-1);\n\t\t return;\n\t\t }else{\n\t\t ans = ans*a[i];\n\t\t }\n\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\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\tlong max = (long)Math.pow(10,18);\n\t\t\n\t\tfor(int i=0; i<n; i++){\n\t\t a[i]=sc.nextLong();\n\t\t if(a[i]==0){\n\t\t System.out.println(0);\n\t\t return;\n\t\t }\n\t\t}\n\t\t\n\t\tif(ans != 0){\n\t\t for(int i=0; i<n; i++){\n\t\t if(max/ans <a[i]){\n\t\t System.out.println(-1);\n\t\t return;\n\t\t }else{\n\t\t ans = ans*a[i];\n\t\t }\n\t\t }\n\t\t}\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\tlong max = (long)Math.pow(10,18);\n\t\t\n\t\tfor(int i=0; i<n; i++){\n\t\t a[i]=sc.nextLong();\n\t\t if(a[i]==0){\n\t\t System.out.println(0);\n\t\t return;\n\t\t }\n\t\t}\n\t\t\n\t\tif(ans != 0){\n\t\t for(int i=0; i<n; i++){\n\t\t if(max/ans <a[i]){\n\t\t System.out.println(-1);\n\t\t return;\n\t\t }else{\n\t\t ans = ans*a[i];\n\t\t }\n\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[] 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\t\t a[i]=sc.nextLong();\n\t\t if(a[i]==0){\n\t\t System.out.println(0);\n\t\t return;\n\t\t }\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t a[i]=sc.nextLong();\n\t\t if(a[i]==0){\n\t\t System.out.println(0);\n\t\t return;\n\t\t }\n\t\t}",
"{\n\t\t a[i]=sc.nextLong();\n\t\t if(a[i]==0){\n\t\t System.out.println(0);\n\t\t return;\n\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 System.out.println(0);\n\t\t return;\n\t\t }",
"a[i]==0",
"a[i]",
"a",
"i",
"0",
"{\n\t\t System.out.println(0);\n\t\t return;\n\t\t }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"if(ans != 0){\n\t\t for(int i=0; i<n; i++){\n\t\t if(max/ans <a[i]){\n\t\t System.out.println(-1);\n\t\t return;\n\t\t }else{\n\t\t ans = ans*a[i];\n\t\t }\n\t\t }\n\t\t}",
"ans != 0",
"ans",
"0",
"{\n\t\t for(int i=0; i<n; i++){\n\t\t if(max/ans <a[i]){\n\t\t System.out.println(-1);\n\t\t return;\n\t\t }else{\n\t\t ans = ans*a[i];\n\t\t }\n\t\t }\n\t\t}",
"for(int i=0; i<n; i++){\n\t\t if(max/ans <a[i]){\n\t\t System.out.println(-1);\n\t\t return;\n\t\t }else{\n\t\t ans = ans*a[i];\n\t\t }\n\t\t }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t if(max/ans <a[i]){\n\t\t System.out.println(-1);\n\t\t return;\n\t\t }else{\n\t\t ans = ans*a[i];\n\t\t }\n\t\t }",
"{\n\t\t if(max/ans <a[i]){\n\t\t System.out.println(-1);\n\t\t return;\n\t\t }else{\n\t\t ans = ans*a[i];\n\t\t }\n\t\t }",
"if(max/ans <a[i]){\n\t\t System.out.println(-1);\n\t\t return;\n\t\t }else{\n\t\t ans = ans*a[i];\n\t\t }",
"max/ans <a[i]",
"max/ans",
"max",
"ans",
"a[i]",
"a",
"i",
"{\n\t\t System.out.println(-1);\n\t\t return;\n\t\t }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"{\n\t\t ans = 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\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\tlong max = (long)Math.pow(10,18);\n\t\t\n\t\tfor(int i=0; i<n; i++){\n\t\t a[i]=sc.nextLong();\n\t\t if(a[i]==0){\n\t\t System.out.println(0);\n\t\t return;\n\t\t }\n\t\t}\n\t\t\n\t\tif(ans != 0){\n\t\t for(int i=0; i<n; i++){\n\t\t if(max/ans <a[i]){\n\t\t System.out.println(-1);\n\t\t return;\n\t\t }else{\n\t\t ans = ans*a[i];\n\t\t }\n\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\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\tlong max = (long)Math.pow(10,18);\n\t\t\n\t\tfor(int i=0; i<n; i++){\n\t\t a[i]=sc.nextLong();\n\t\t if(a[i]==0){\n\t\t System.out.println(0);\n\t\t return;\n\t\t }\n\t\t}\n\t\t\n\t\tif(ans != 0){\n\t\t for(int i=0; i<n; i++){\n\t\t if(max/ans <a[i]){\n\t\t System.out.println(-1);\n\t\t return;\n\t\t }else{\n\t\t ans = ans*a[i];\n\t\t }\n\t\t }\n\t\t}\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;
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);
return;
}
}
if(ans != 0){
for(int i=0; i<n; i++){
if(max/ans <a[i]){
System.out.println(-1);
return;
}else{
ans = ans*a[i];
}
}
}
System.out.println(ans);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.