DatasetRepo commited on
Commit
22c282e
·
verified ·
1 Parent(s): 61c037a

c0858bc5e7f8bd0ad3db5ff53452fafdaa09386d3c620ed5a58ef4fe07dfb1dc

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +2 -0
  2. minimum_cost_of_a_path_with_special_roads/.DS_Store +0 -0
  3. minimum_cost_of_a_path_with_special_roads/haskell_tests/Main.hs +27 -0
  4. minimum_cost_of_a_path_with_special_roads/java_tests/Main.java +25 -0
  5. minimum_cost_of_a_path_with_special_roads/meta.json +0 -0
  6. minimum_cost_of_a_path_with_special_roads/ocaml_tests/main.ml +29 -0
  7. minimum_cost_of_a_path_with_special_roads/scala_tests/MySuite.scala +16 -0
  8. minimum_cost_of_buying_candies_with_discount/.DS_Store +0 -0
  9. minimum_cost_of_buying_candies_with_discount/haskell_tests/Main.hs +27 -0
  10. minimum_cost_of_buying_candies_with_discount/java_tests/Main.java +25 -0
  11. minimum_cost_of_buying_candies_with_discount/meta.json +533 -0
  12. minimum_cost_of_buying_candies_with_discount/ocaml_tests/main.ml +29 -0
  13. minimum_cost_of_buying_candies_with_discount/scala_tests/MySuite.scala +16 -0
  14. minimum_cost_to_convert_string_i/java_tests/Main.java +25 -0
  15. minimum_cost_to_convert_string_ii/java_tests/Main.java +25 -0
  16. minimum_cost_to_equalize_array/haskell_tests/Main.hs +0 -0
  17. minimum_cost_to_equalize_array/java_tests/Main.java +25 -0
  18. minimum_cost_to_equalize_array/meta.json +3 -0
  19. minimum_cost_to_equalize_array/ocaml_tests/main.ml +0 -0
  20. minimum_cost_to_equalize_array/scala_tests/MySuite.scala +0 -0
  21. minimum_cost_to_make_all_characters_equal/haskell_tests/Main.hs +0 -0
  22. minimum_cost_to_make_all_characters_equal/java_tests/Main.java +20 -0
  23. minimum_cost_to_make_all_characters_equal/meta.json +0 -0
  24. minimum_cost_to_make_all_characters_equal/ocaml_tests/main.ml +0 -0
  25. minimum_cost_to_make_all_characters_equal/scala_tests/MySuite.scala +0 -0
  26. minimum_cost_to_make_array_equal/.DS_Store +0 -0
  27. minimum_cost_to_make_array_equal/haskell_tests/Main.hs +24 -0
  28. minimum_cost_to_make_array_equal/java_tests/Main.java +21 -0
  29. minimum_cost_to_make_array_equal/meta.json +26 -0
  30. minimum_cost_to_make_array_equal/ocaml_tests/main.ml +26 -0
  31. minimum_cost_to_make_array_equal/scala_tests/MySuite.scala +12 -0
  32. minimum_cost_to_make_array_equalindromic/haskell_tests/Main.hs +29 -0
  33. minimum_cost_to_make_array_equalindromic/java_tests/Main.java +24 -0
  34. minimum_cost_to_make_array_equalindromic/meta.json +31 -0
  35. minimum_cost_to_make_array_equalindromic/ocaml_tests/main.ml +30 -0
  36. minimum_cost_to_make_array_equalindromic/scala_tests/MySuite.scala +16 -0
  37. minimum_cost_to_make_arrays_identical/haskell_tests/Main.hs +0 -0
  38. minimum_cost_to_make_arrays_identical/java_tests/Main.java +21 -0
  39. minimum_cost_to_make_arrays_identical/meta.json +3 -0
  40. minimum_cost_to_make_arrays_identical/ocaml_tests/main.ml +0 -0
  41. minimum_cost_to_make_arrays_identical/scala_tests/MySuite.scala +0 -0
  42. minimum_cost_to_set_cooking_time/.DS_Store +0 -0
  43. minimum_cost_to_set_cooking_time/haskell_tests/Main.hs +24 -0
  44. minimum_cost_to_set_cooking_time/java_tests/Main.java +21 -0
  45. minimum_cost_to_set_cooking_time/meta.json +117 -0
  46. minimum_cost_to_set_cooking_time/ocaml_tests/main.ml +26 -0
  47. minimum_cost_to_set_cooking_time/scala_tests/MySuite.scala +12 -0
  48. minimum_cost_to_split_an_array/haskell_tests/Main.hs +45 -0
  49. minimum_cost_to_split_an_array/java_tests/Main.java +25 -0
  50. minimum_cost_to_split_an_array/meta.json +3728 -0
.gitattributes CHANGED
@@ -213,3 +213,5 @@ minimize_or_of_remaining_elements_using_operations/meta.json filter=lfs diff=lfs
213
  minimize_the_maximum_difference_of_pairs/meta.json filter=lfs diff=lfs merge=lfs -text
214
  minimum_absolute_difference_between_elements_with_constraint/meta.json filter=lfs diff=lfs merge=lfs -text
215
  minimum_array_length_after_pair_removals/meta.json filter=lfs diff=lfs merge=lfs -text
 
 
 
213
  minimize_the_maximum_difference_of_pairs/meta.json filter=lfs diff=lfs merge=lfs -text
214
  minimum_absolute_difference_between_elements_with_constraint/meta.json filter=lfs diff=lfs merge=lfs -text
215
  minimum_array_length_after_pair_removals/meta.json filter=lfs diff=lfs merge=lfs -text
216
+ minimum_cost_to_equalize_array/meta.json filter=lfs diff=lfs merge=lfs -text
217
+ minimum_cost_to_make_arrays_identical/meta.json filter=lfs diff=lfs merge=lfs -text
minimum_cost_of_a_path_with_special_roads/.DS_Store ADDED
Binary file (6.15 kB). View file
 
minimum_cost_of_a_path_with_special_roads/haskell_tests/Main.hs ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (minimumCost [1,1] [4,5] [[1,2,3,3,2],[3,4,4,5,1]])," 5 (minimumCost [1,1] [4,5] [[1,2,3,3,2],[3,4,4,5,1]]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (minimumCost [3,2] [5,7] [[5,7,3,2,1],[3,2,3,4,4],[3,3,5,5,5],[3,4,5,6,6]])," 7 (minimumCost [3,2] [5,7] [[5,7,3,2,1],[3,2,3,4,4],[3,3,5,5,5],[3,4,5,6,6]]))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (minimumCost [1,1] [10,4] [[4,2,1,1,3],[1,2,7,4,4],[10,3,6,1,2],[6,1,1,2,3]])," 8 (minimumCost [1,1] [10,4] [[4,2,1,1,3],[1,2,7,4,4],[10,3,6,1,2],[6,1,1,2,3]]))
19
+
20
+
21
+ -- Grouping test cases
22
+ tests :: Test
23
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2]
24
+
25
+ -- Running the tests
26
+ main :: IO Counts
27
+ main = runTestTT tests
minimum_cost_of_a_path_with_special_roads/java_tests/Main.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(5, minimumCost(new ArrayList<>(Arrays.asList(1,1)), new ArrayList<>(Arrays.asList(4,5)), new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,2,3,3,2)),new ArrayList<>(Arrays.asList(3,4,4,5,1))))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(7, minimumCost(new ArrayList<>(Arrays.asList(3,2)), new ArrayList<>(Arrays.asList(5,7)), new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(5,7,3,2,1)),new ArrayList<>(Arrays.asList(3,2,3,4,4)),new ArrayList<>(Arrays.asList(3,3,5,5,5)),new ArrayList<>(Arrays.asList(3,4,5,6,6))))));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(8, minimumCost(new ArrayList<>(Arrays.asList(1,1)), new ArrayList<>(Arrays.asList(10,4)), new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(4,2,1,1,3)),new ArrayList<>(Arrays.asList(1,2,7,4,4)),new ArrayList<>(Arrays.asList(10,3,6,1,2)),new ArrayList<>(Arrays.asList(6,1,1,2,3))))));
23
+ }
24
+
25
+ }
minimum_cost_of_a_path_with_special_roads/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
minimum_cost_of_a_path_with_special_roads/ocaml_tests/main.ml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal 5 (minimumCost [1;1] [4;5] [[1;2;3;3;2];[3;4;4;5;1]])
12
+
13
+ let test2 _ = assert_equal 7 (minimumCost [3;2] [5;7] [[5;7;3;2;1];[3;2;3;4;4];[3;3;5;5;5];[3;4;5;6;6]])
14
+
15
+ let test3 _ = assert_equal 8 (minimumCost [1;1] [10;4] [[4;2;1;1;3];[1;2;7;4;4];[10;3;6;1;2];[6;1;1;2;3]])
16
+
17
+
18
+ (* Grouping test cases *)
19
+ let suite = "Test Suite for minimumCost" >::: [
20
+
21
+ "test1" >:: test1;
22
+ "test2" >:: test2;
23
+ "test3" >:: test3;
24
+ ]
25
+
26
+
27
+ (* Running the tests *)
28
+ let () = run_test_tt_main suite
29
+ end
minimum_cost_of_a_path_with_special_roads/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.minimumCost(List(1,1),List(4,5),List(List(1,2,3,3,2),List(3,4,4,5,1))), 5)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.minimumCost(List(3,2),List(5,7),List(List(5,7,3,2,1),List(3,2,3,4,4),List(3,3,5,5,5),List(3,4,5,6,6))), 7)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.minimumCost(List(1,1),List(10,4),List(List(4,2,1,1,3),List(1,2,7,4,4),List(10,3,6,1,2),List(6,1,1,2,3))), 8)
14
+ }
15
+
16
+ }
minimum_cost_of_buying_candies_with_discount/.DS_Store ADDED
Binary file (6.15 kB). View file
 
minimum_cost_of_buying_candies_with_discount/haskell_tests/Main.hs ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (minimumCost [1,2,3])," 5 (minimumCost [1,2,3]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (minimumCost [6,5,7,9,2,2])," 23 (minimumCost [6,5,7,9,2,2]))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (minimumCost [5,5])," 10 (minimumCost [5,5]))
19
+
20
+
21
+ -- Grouping test cases
22
+ tests :: Test
23
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2]
24
+
25
+ -- Running the tests
26
+ main :: IO Counts
27
+ main = runTestTT tests
minimum_cost_of_buying_candies_with_discount/java_tests/Main.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(5, minimumCost(new ArrayList<>(Arrays.asList(1,2,3))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(23, minimumCost(new ArrayList<>(Arrays.asList(6,5,7,9,2,2))));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(10, minimumCost(new ArrayList<>(Arrays.asList(5,5))));
23
+ }
24
+
25
+ }
minimum_cost_of_buying_candies_with_discount/meta.json ADDED
@@ -0,0 +1,533 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2248,
3
+ "name": "minimum_cost_of_buying_candies_with_discount",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/minimum-cost-of-buying-candies-with-discount/",
6
+ "date": "1641600000000",
7
+ "task_description": "A shop is selling candies at a discount. For **every two** candies sold, the shop gives a **third** candy for **free**. The customer can choose **any** candy to take away for free as long as the cost of the chosen candy is less than or equal to the **minimum** cost of the two candies bought. For example, if there are `4` candies with costs `1`, `2`, `3`, and `4`, and the customer buys candies with costs `2` and `3`, they can take the candy with cost `1` for free, but not the candy with cost `4`. Given a **0-indexed** integer array `cost`, where `cost[i]` denotes the cost of the `ith` candy, return _the **minimum cost** of buying **all** the candies_. **Example 1:** ``` **Input:** cost = [1,2,3] **Output:** 5 **Explanation:** We buy the candies with costs 2 and 3, and take the candy with cost 1 for free. The total cost of buying all candies is 2 + 3 = 5. This is the **only** way we can buy the candies. Note that we cannot buy candies with costs 1 and 3, and then take the candy with cost 2 for free. The cost of the free candy has to be less than or equal to the minimum cost of the purchased candies. ``` **Example 2:** ``` **Input:** cost = [6,5,7,9,2,2] **Output:** 23 **Explanation:** The way in which we can get the minimum cost is described below: - Buy candies with costs 9 and 7 - Take the candy with cost 6 for free - We buy candies with costs 5 and 2 - Take the last remaining candy with cost 2 for free Hence, the minimum cost to buy all candies is 9 + 7 + 5 + 2 = 23. ``` **Example 3:** ``` **Input:** cost = [5,5] **Output:** 10 **Explanation:** Since there are only 2 candies, we buy both of them. There is not a third candy we can take for free. Hence, the minimum cost to buy all candies is 5 + 5 = 10. ``` **Constraints:** `1 <= cost.length <= 100` `1 <= cost[i] <= 100`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "cost = [1,2,3]",
12
+ "output": "5 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "cost = [6,5,7,9,2,2]",
17
+ "output": "23 "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "cost = [5,5]",
22
+ "output": "10 "
23
+ }
24
+ ],
25
+ "private_test_cases": [
26
+ {
27
+ "input": [
28
+ 97,
29
+ 94,
30
+ 93,
31
+ 83,
32
+ 75,
33
+ 75,
34
+ 73,
35
+ 59,
36
+ 58,
37
+ 56,
38
+ 53,
39
+ 48,
40
+ 43,
41
+ 29,
42
+ 25,
43
+ 18,
44
+ 12,
45
+ 9,
46
+ 7
47
+ ],
48
+ "output": 699
49
+ },
50
+ {
51
+ "input": [
52
+ 92,
53
+ 92,
54
+ 81,
55
+ 80,
56
+ 70,
57
+ 65,
58
+ 63,
59
+ 50,
60
+ 47,
61
+ 44,
62
+ 42,
63
+ 36,
64
+ 35,
65
+ 30,
66
+ 25,
67
+ 24,
68
+ 21,
69
+ 8,
70
+ 6
71
+ ],
72
+ "output": 649
73
+ },
74
+ {
75
+ "input": [
76
+ 70,
77
+ 53,
78
+ 20,
79
+ 18,
80
+ 17,
81
+ 2
82
+ ],
83
+ "output": 158
84
+ },
85
+ {
86
+ "input": [
87
+ 100,
88
+ 100,
89
+ 96,
90
+ 95,
91
+ 93,
92
+ 93,
93
+ 92,
94
+ 88,
95
+ 85,
96
+ 84,
97
+ 80,
98
+ 80,
99
+ 77,
100
+ 75,
101
+ 75,
102
+ 74,
103
+ 68,
104
+ 67,
105
+ 66,
106
+ 66,
107
+ 66,
108
+ 65,
109
+ 65,
110
+ 64,
111
+ 64,
112
+ 61,
113
+ 61,
114
+ 61,
115
+ 59,
116
+ 58,
117
+ 57,
118
+ 57,
119
+ 57,
120
+ 56,
121
+ 55,
122
+ 55,
123
+ 52,
124
+ 51,
125
+ 49,
126
+ 45,
127
+ 44,
128
+ 42,
129
+ 42,
130
+ 41,
131
+ 39,
132
+ 39,
133
+ 38,
134
+ 38,
135
+ 38,
136
+ 37,
137
+ 35,
138
+ 34,
139
+ 32,
140
+ 32,
141
+ 31,
142
+ 30,
143
+ 30,
144
+ 29,
145
+ 29,
146
+ 28,
147
+ 28,
148
+ 24,
149
+ 22,
150
+ 21,
151
+ 20,
152
+ 19,
153
+ 19,
154
+ 17,
155
+ 17,
156
+ 17,
157
+ 16,
158
+ 15,
159
+ 15,
160
+ 14,
161
+ 14,
162
+ 14,
163
+ 13,
164
+ 13,
165
+ 12,
166
+ 11,
167
+ 8,
168
+ 7,
169
+ 7,
170
+ 6,
171
+ 5,
172
+ 4,
173
+ 3
174
+ ],
175
+ "output": 2634
176
+ },
177
+ {
178
+ "input": [
179
+ 100,
180
+ 100,
181
+ 100,
182
+ 96,
183
+ 94,
184
+ 93,
185
+ 89,
186
+ 88,
187
+ 83,
188
+ 81,
189
+ 79,
190
+ 79,
191
+ 77,
192
+ 75,
193
+ 73,
194
+ 72,
195
+ 68,
196
+ 66,
197
+ 61,
198
+ 57,
199
+ 57,
200
+ 56,
201
+ 56,
202
+ 51,
203
+ 51,
204
+ 41,
205
+ 41,
206
+ 38,
207
+ 35,
208
+ 32,
209
+ 32,
210
+ 30,
211
+ 29,
212
+ 24,
213
+ 19,
214
+ 16,
215
+ 13,
216
+ 12,
217
+ 12,
218
+ 7,
219
+ 4
220
+ ],
221
+ "output": 1555
222
+ },
223
+ {
224
+ "input": [
225
+ 100,
226
+ 98,
227
+ 94,
228
+ 93,
229
+ 91,
230
+ 89,
231
+ 89,
232
+ 85,
233
+ 85,
234
+ 83,
235
+ 77,
236
+ 73,
237
+ 70,
238
+ 69,
239
+ 66,
240
+ 63,
241
+ 59,
242
+ 55,
243
+ 53,
244
+ 39,
245
+ 38,
246
+ 38,
247
+ 37,
248
+ 36,
249
+ 34,
250
+ 29,
251
+ 27,
252
+ 27,
253
+ 26,
254
+ 18,
255
+ 16,
256
+ 14,
257
+ 10,
258
+ 8,
259
+ 2
260
+ ],
261
+ "output": 1300
262
+ },
263
+ {
264
+ "input": [
265
+ 100,
266
+ 98,
267
+ 98,
268
+ 97,
269
+ 97,
270
+ 97,
271
+ 92,
272
+ 85,
273
+ 83,
274
+ 82,
275
+ 78,
276
+ 78,
277
+ 77,
278
+ 74,
279
+ 74,
280
+ 73,
281
+ 72,
282
+ 72,
283
+ 66,
284
+ 63,
285
+ 57,
286
+ 56,
287
+ 53,
288
+ 48,
289
+ 48,
290
+ 48,
291
+ 46,
292
+ 46,
293
+ 44,
294
+ 42,
295
+ 42,
296
+ 40,
297
+ 27,
298
+ 27,
299
+ 27,
300
+ 25,
301
+ 24,
302
+ 20,
303
+ 20,
304
+ 19,
305
+ 19,
306
+ 18,
307
+ 15,
308
+ 15,
309
+ 15,
310
+ 15,
311
+ 13,
312
+ 12,
313
+ 11,
314
+ 8,
315
+ 7,
316
+ 7,
317
+ 6,
318
+ 5,
319
+ 5,
320
+ 3,
321
+ 3,
322
+ 2,
323
+ 1
324
+ ],
325
+ "output": 1768
326
+ },
327
+ {
328
+ "input": [
329
+ 99,
330
+ 99,
331
+ 98,
332
+ 97,
333
+ 97,
334
+ 93,
335
+ 92,
336
+ 91,
337
+ 91,
338
+ 91,
339
+ 89,
340
+ 86,
341
+ 86,
342
+ 86,
343
+ 85,
344
+ 81,
345
+ 81,
346
+ 80,
347
+ 79,
348
+ 76,
349
+ 75,
350
+ 74,
351
+ 73,
352
+ 73,
353
+ 73,
354
+ 68,
355
+ 66,
356
+ 64,
357
+ 62,
358
+ 59,
359
+ 58,
360
+ 58,
361
+ 57,
362
+ 55,
363
+ 53,
364
+ 50,
365
+ 47,
366
+ 46,
367
+ 46,
368
+ 46,
369
+ 45,
370
+ 43,
371
+ 41,
372
+ 41,
373
+ 35,
374
+ 35,
375
+ 33,
376
+ 32,
377
+ 32,
378
+ 32,
379
+ 28,
380
+ 28,
381
+ 26,
382
+ 25,
383
+ 23,
384
+ 16,
385
+ 14,
386
+ 13,
387
+ 11,
388
+ 9,
389
+ 9,
390
+ 9,
391
+ 8,
392
+ 6,
393
+ 4
394
+ ],
395
+ "output": 2425
396
+ },
397
+ {
398
+ "input": [
399
+ 98,
400
+ 96,
401
+ 93,
402
+ 83,
403
+ 83,
404
+ 80,
405
+ 79,
406
+ 79,
407
+ 75,
408
+ 73,
409
+ 72,
410
+ 72,
411
+ 71,
412
+ 70,
413
+ 69,
414
+ 67,
415
+ 62,
416
+ 54,
417
+ 54,
418
+ 53,
419
+ 52,
420
+ 50,
421
+ 50,
422
+ 49,
423
+ 48,
424
+ 48,
425
+ 44,
426
+ 40,
427
+ 39,
428
+ 36,
429
+ 35,
430
+ 33,
431
+ 29,
432
+ 24,
433
+ 24,
434
+ 23,
435
+ 22,
436
+ 21,
437
+ 18,
438
+ 15,
439
+ 13,
440
+ 13,
441
+ 11,
442
+ 11,
443
+ 11,
444
+ 7,
445
+ 7,
446
+ 4,
447
+ 2
448
+ ],
449
+ "output": 1540
450
+ },
451
+ {
452
+ "input": [
453
+ 99,
454
+ 98,
455
+ 98,
456
+ 97,
457
+ 96,
458
+ 96,
459
+ 96,
460
+ 96,
461
+ 94,
462
+ 91,
463
+ 90,
464
+ 90,
465
+ 90,
466
+ 88,
467
+ 86,
468
+ 85,
469
+ 85,
470
+ 85,
471
+ 84,
472
+ 82,
473
+ 81,
474
+ 81,
475
+ 80,
476
+ 80,
477
+ 80,
478
+ 79,
479
+ 79,
480
+ 78,
481
+ 77,
482
+ 72,
483
+ 71,
484
+ 70,
485
+ 69,
486
+ 69,
487
+ 68,
488
+ 67,
489
+ 66,
490
+ 64,
491
+ 64,
492
+ 58,
493
+ 57,
494
+ 52,
495
+ 52,
496
+ 48,
497
+ 46,
498
+ 45,
499
+ 45,
500
+ 44,
501
+ 44,
502
+ 44,
503
+ 38,
504
+ 37,
505
+ 35,
506
+ 35,
507
+ 34,
508
+ 34,
509
+ 31,
510
+ 29,
511
+ 29,
512
+ 28,
513
+ 26,
514
+ 24,
515
+ 22,
516
+ 15,
517
+ 15,
518
+ 11,
519
+ 10,
520
+ 10,
521
+ 8,
522
+ 7,
523
+ 1
524
+ ],
525
+ "output": 2859
526
+ }
527
+ ],
528
+ "haskell_template": "minimumCost :: [Int] -> Int\nminimumCost cost ",
529
+ "ocaml_template": "let minimumCost (cost: int list) : int = ",
530
+ "scala_template": "def minimumCost(cost: List[Int]): Int = { \n \n}",
531
+ "java_template": "public static int minimumCost(List<Integer> cost) {\n\n}",
532
+ "python_template": "class Solution(object):\n def minimumCost(self, cost):\n \"\"\"\n :type cost: List[int]\n :rtype: int\n \"\"\"\n "
533
+ }
minimum_cost_of_buying_candies_with_discount/ocaml_tests/main.ml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal 5 (minimumCost [1;2;3])
12
+
13
+ let test2 _ = assert_equal 23 (minimumCost [6;5;7;9;2;2])
14
+
15
+ let test3 _ = assert_equal 10 (minimumCost [5;5])
16
+
17
+
18
+ (* Grouping test cases *)
19
+ let suite = "Test Suite for minimumCost" >::: [
20
+
21
+ "test1" >:: test1;
22
+ "test2" >:: test2;
23
+ "test3" >:: test3;
24
+ ]
25
+
26
+
27
+ (* Running the tests *)
28
+ let () = run_test_tt_main suite
29
+ end
minimum_cost_of_buying_candies_with_discount/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.minimumCost(List(1,2,3)), 5)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.minimumCost(List(6,5,7,9,2,2)), 23)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.minimumCost(List(5,5)), 10)
14
+ }
15
+
16
+ }
minimum_cost_to_convert_string_i/java_tests/Main.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(28, minimumCost("abcd", "acbe", new ArrayList<>(Arrays.asList("a","b","c","c","e","d")), new ArrayList<>(Arrays.asList("b","c","b","e","b","e")), new ArrayList<>(Arrays.asList(2,5,5,1,2,20))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(12, minimumCost("aaaa", "bbbb", new ArrayList<>(Arrays.asList("a","c")), new ArrayList<>(Arrays.asList("c","b")), new ArrayList<>(Arrays.asList(1,2))));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(-1, minimumCost("abcd", "abce", new ArrayList<>(Arrays.asList("a")), new ArrayList<>(Arrays.asList("e")), new ArrayList<>(Arrays.asList(10000))));
23
+ }
24
+
25
+ }
minimum_cost_to_convert_string_ii/java_tests/Main.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(28, minimumCost("abcd", "acbe", new ArrayList<>(Arrays.asList("a","b","c","c","e","d")), new ArrayList<>(Arrays.asList("b","c","b","e","b","e")), new ArrayList<>(Arrays.asList(2,5,5,1,2,20))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(9, minimumCost("abcdefgh", "acdeeghh", new ArrayList<>(Arrays.asList("bcd","fgh","thh")), new ArrayList<>(Arrays.asList("cde","thh","ghh")), new ArrayList<>(Arrays.asList(1,3,5))));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(-1, minimumCost("abcdefgh", "addddddd", new ArrayList<>(Arrays.asList("bcd","defgh")), new ArrayList<>(Arrays.asList("ddd","ddddd")), new ArrayList<>(Arrays.asList(100,1578))));
23
+ }
24
+
25
+ }
minimum_cost_to_equalize_array/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
minimum_cost_to_equalize_array/java_tests/Main.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(15, minCostToEqualizeArray(new ArrayList<>(Arrays.asList(4,1)), 5, 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(6, minCostToEqualizeArray(new ArrayList<>(Arrays.asList(2,3,3,3,5)), 2, 1));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(4, minCostToEqualizeArray(new ArrayList<>(Arrays.asList(3,5,3)), 1, 3));
23
+ }
24
+
25
+ }
minimum_cost_to_equalize_array/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0596bea3920fdc27894c39e8d437feb0f8ef548bb8d218cb9ca782824e8e002
3
+ size 13756679
minimum_cost_to_equalize_array/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
minimum_cost_to_equalize_array/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
minimum_cost_to_make_all_characters_equal/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
minimum_cost_to_make_all_characters_equal/java_tests/Main.java ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ public class Main {
7
+ //Program start
8
+
9
+ //Program end
10
+
11
+ @Test
12
+ public void test1() {
13
+ assertEquals(2, minimumCost("0011"));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(9, minimumCost("010101"));
18
+ }
19
+
20
+ }
minimum_cost_to_make_all_characters_equal/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
minimum_cost_to_make_all_characters_equal/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
minimum_cost_to_make_all_characters_equal/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
minimum_cost_to_make_array_equal/.DS_Store ADDED
Binary file (6.15 kB). View file
 
minimum_cost_to_make_array_equal/haskell_tests/Main.hs ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (minCost [1,3,5,2] [2,3,1,14])," 8 (minCost [1,3,5,2] [2,3,1,14]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (minCost [2,2,2,2,2] [4,2,8,1,3])," 0 (minCost [2,2,2,2,2] [4,2,8,1,3]))
16
+
17
+
18
+ -- Grouping test cases
19
+ tests :: Test
20
+ tests = TestList [TestLabel "Test1" test1]
21
+
22
+ -- Running the tests
23
+ main :: IO Counts
24
+ main = runTestTT tests
minimum_cost_to_make_array_equal/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(8, minCost(new ArrayList<>(Arrays.asList(1,3,5,2)), new ArrayList<>(Arrays.asList(2,3,1,14))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(0, minCost(new ArrayList<>(Arrays.asList(2,2,2,2,2)), new ArrayList<>(Arrays.asList(4,2,8,1,3))));
19
+ }
20
+
21
+ }
minimum_cost_to_make_array_equal/meta.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2538,
3
+ "name": "minimum_cost_to_make_array_equal",
4
+ "difficulty": "Hard",
5
+ "link": "https://leetcode.com/problems/minimum-cost-to-make-array-equal/",
6
+ "date": "1665878400000",
7
+ "task_description": "You are given two **0-indexed** arrays `nums` and `cost` consisting each of `n` **positive** integers. You can do the following operation **any** number of times: Increase or decrease **any** element of the array `nums` by `1`. The cost of doing one operation on the `ith` element is `cost[i]`. Return _the **minimum** total cost such that all the elements of the array _`nums`_ become **equal**_. **Example 1:** ``` **Input:** nums = [1,3,5,2], cost = [2,3,1,14] **Output:** 8 **Explanation:** We can make all the elements equal to 2 in the following way: - Increase the 0th element one time. The cost is 2. - Decrease the 1st element one time. The cost is 3. - Decrease the 2nd element three times. The cost is 1 + 1 + 1 = 3. The total cost is 2 + 3 + 3 = 8. It can be shown that we cannot make the array equal with a smaller cost. ``` **Example 2:** ``` **Input:** nums = [2,2,2,2,2], cost = [4,2,8,1,3] **Output:** 0 **Explanation:** All the elements are already equal, so no operations are needed. ``` **Constraints:** `n == nums.length == cost.length` `1 <= n <= 105` `1 <= nums[i], cost[i] <= 106` Test cases are generated in a way that the output doesn't exceed 253-1",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [1,3,5,2], cost = [2,3,1,14]",
12
+ "output": "8 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [2,2,2,2,2], cost = [4,2,8,1,3]",
17
+ "output": "0 "
18
+ }
19
+ ],
20
+ "private_test_cases": [],
21
+ "haskell_template": "minCost :: [Int] -> [Int] -> Int\nminCost nums cost ",
22
+ "ocaml_template": "let minCost (nums: int list) (cost: int list) : int = ",
23
+ "scala_template": "def minCost(nums: List[Int],cost: List[Int]): Int = { \n \n}",
24
+ "java_template": "public static int minCost(List<Integer> nums, List<Integer> cost) {\n\n}",
25
+ "python_template": "class Solution(object):\n def minCost(self, nums, cost):\n \"\"\"\n :type nums: List[int]\n :type cost: List[int]\n :rtype: int\n \"\"\"\n "
26
+ }
minimum_cost_to_make_array_equal/ocaml_tests/main.ml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal 8 (minCost [1;3;5;2] [2;3;1;14])
12
+
13
+ let test2 _ = assert_equal 0 (minCost [2;2;2;2;2] [4;2;8;1;3])
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for minCost" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
minimum_cost_to_make_array_equal/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.minCost(List(1,3,5,2),List(2,3,1,14)), 8)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.minCost(List(2,2,2,2,2),List(4,2,8,1,3)), 0)
10
+ }
11
+
12
+ }
minimum_cost_to_make_array_equalindromic/haskell_tests/Main.hs ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+ minimumCost :: [Int] -> Int
7
+ minimumCost nums = undefined
8
+
9
+ --Program end
10
+
11
+ -- Test cases
12
+
13
+ test1 :: Test
14
+ test1 = TestCase (assertEqual "for (minimumCost [1,2,3,4,5])," 6 (minimumCost [1,2,3,4,5]))
15
+
16
+ test2 :: Test
17
+ test2 = TestCase (assertEqual "for (minimumCost [10,12,13,14,15])," 11 (minimumCost [10,12,13,14,15]))
18
+
19
+ test3 :: Test
20
+ test3 = TestCase (assertEqual "for (minimumCost [22,33,22,33,22])," 22 (minimumCost [22,33,22,33,22]))
21
+
22
+
23
+ -- Grouping test cases
24
+ tests :: Test
25
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2]
26
+
27
+ -- Running the tests
28
+ main :: IO Counts
29
+ main = runTestTT tests
minimum_cost_to_make_array_equalindromic/java_tests/Main.java ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ public class Main {
7
+ //Program start
8
+
9
+ //Program end
10
+
11
+ @Test
12
+ public void test1() {
13
+ assertEquals(6, minimumCost(Arrays.asList(1,2,3,4,5)));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(11, minimumCost(Arrays.asList(10,12,13,14,15)));
18
+ }
19
+ @Test
20
+ public void test3() {
21
+ assertEquals(22, minimumCost(Arrays.asList(22,33,22,33,22)));
22
+ }
23
+
24
+ }
minimum_cost_to_make_array_equalindromic/meta.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3229,
3
+ "name": "minimum_cost_to_make_array_equalindromic",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/minimum-cost-to-make-array-equalindromic/",
6
+ "date": "2023-12-10 00:00:00",
7
+ "task_description": "You are given a **0-indexed** integer array `nums` having length `n`. You are allowed to perform a special move **any** number of times (**including zero**) on `nums`. In one **special** **move** you perform the following steps **in order**: Choose an index `i` in the range `[0, n - 1]`, and a **positive** integer `x`. Add `|nums[i] - x|` to the total cost. Change the value of `nums[i]` to `x`. A **palindromic number** is a positive integer that remains the same when its digits are reversed. For example, `121`, `2552` and `65756` are palindromic numbers whereas `24`, `46`, `235` are not palindromic numbers. An array is considered **equalindromic** if all the elements in the array are equal to an integer `y`, where `y` is a **palindromic number** less than `109`. Return _an integer denoting the **minimum** possible total cost to make _`nums`_ **equalindromic** by performing any number of special moves._ **Example 1:** ``` **Input:** nums = [1,2,3,4,5] **Output:** 6 **Explanation:** We can make the array equalindromic by changing all elements to 3 which is a palindromic number. The cost of changing the array to [3,3,3,3,3] using 4 special moves is given by |1 - 3| + |2 - 3| + |4 - 3| + |5 - 3| = 6. It can be shown that changing all elements to any palindromic number other than 3 cannot be achieved at a lower cost. ``` **Example 2:** ``` **Input:** nums = [10,12,13,14,15] **Output:** 11 **Explanation:** We can make the array equalindromic by changing all elements to 11 which is a palindromic number. The cost of changing the array to [11,11,11,11,11] using 5 special moves is given by |10 - 11| + |12 - 11| + |13 - 11| + |14 - 11| + |15 - 11| = 11. It can be shown that changing all elements to any palindromic number other than 11 cannot be achieved at a lower cost. ``` **Example 3:** ``` **Input:** nums = [22,33,22,33,22] **Output:** 22 **Explanation:** We can make the array equalindromic by changing all elements to 22 which is a palindromic number. The cost of changing the array to [22,22,22,22,22] using 2 special moves is given by |33 - 22| + |33 - 22| = 22. It can be shown that changing all elements to any palindromic number other than 22 cannot be achieved at a lower cost. ``` **Constraints:** `1 <= n <= 105` `1 <= nums[i] <= 109`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [1,2,3,4,5]",
12
+ "output": "6 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [10,12,13,14,15]",
17
+ "output": "11 "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "nums = [22,33,22,33,22]",
22
+ "output": "22 "
23
+ }
24
+ ],
25
+ "private_test_cases": [],
26
+ "haskell_template": "minimumCost :: [Int] -> Int\nminimumCost nums ",
27
+ "ocaml_template": "let minimumCost (nums: int list) : int = ",
28
+ "scala_template": "def minimumCost(nums: List[Int]): Int = { \n \n}",
29
+ "java_template": "class Solution {\n public long minimumCost(int[] nums) {\n \n }\n}",
30
+ "python_template": "class Solution(object):\n def minimumCost(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n "
31
+ }
minimum_cost_to_make_array_equalindromic/ocaml_tests/main.ml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let minimumCost (nums: int list) : int = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal 6 (minimumCost [1;2;3;4;5])
13
+
14
+ let test2 _ = assert_equal 11 (minimumCost [10;12;13;14;15])
15
+
16
+ let test3 _ = assert_equal 22 (minimumCost [22;33;22;33;22])
17
+
18
+
19
+ (* Grouping test cases *)
20
+ let suite = "Test Suite for minimumCost" >::: [
21
+
22
+ "test1" >:: test1;
23
+ "test2" >:: test2;
24
+ "test3" >:: test3;
25
+ ]
26
+
27
+
28
+ (* Running the tests *)
29
+ let () = run_test_tt_main suite
30
+ end
minimum_cost_to_make_array_equalindromic/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.minimumCost(List(1,2,3,4,5)), 6)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.minimumCost(List(10,12,13,14,15)), 11)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.minimumCost(List(22,33,22,33,22)), 22)
14
+ }
15
+
16
+ }
minimum_cost_to_make_arrays_identical/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
minimum_cost_to_make_arrays_identical/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(13, minCost(new ArrayList<>(Arrays.asList(-7,9,5)), new ArrayList<>(Arrays.asList(7,-2,-5)), 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(0, minCost(new ArrayList<>(Arrays.asList(2,1)), new ArrayList<>(Arrays.asList(2,1)), 0));
19
+ }
20
+
21
+ }
minimum_cost_to_make_arrays_identical/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e39b6b62904b627772544c0b977aa12d49ff1206dedf1f9e84d5b9e973307b42
3
+ size 24706067
minimum_cost_to_make_arrays_identical/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
minimum_cost_to_make_arrays_identical/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
minimum_cost_to_set_cooking_time/.DS_Store ADDED
Binary file (6.15 kB). View file
 
minimum_cost_to_set_cooking_time/haskell_tests/Main.hs ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (minCostSetTime 1 2 1 600)," 6 (minCostSetTime 1 2 1 600))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (minCostSetTime 0 1 2 76)," 6 (minCostSetTime 0 1 2 76))
16
+
17
+
18
+ -- Grouping test cases
19
+ tests :: Test
20
+ tests = TestList [TestLabel "Test1" test1]
21
+
22
+ -- Running the tests
23
+ main :: IO Counts
24
+ main = runTestTT tests
minimum_cost_to_set_cooking_time/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(6, minCostSetTime(1, 2, 1, 600));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(6, minCostSetTime(0, 1, 2, 76));
19
+ }
20
+
21
+ }
minimum_cost_to_set_cooking_time/meta.json ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2266,
3
+ "name": "minimum_cost_to_set_cooking_time",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/minimum-cost-to-set-cooking-time/",
6
+ "date": "1642809600000",
7
+ "task_description": "A generic microwave supports cooking times for: at least `1` second. at most `99` minutes and `99` seconds. To set the cooking time, you push **at most four digits**. The microwave normalizes what you push as four digits by **prepending zeroes**. It interprets the **first** two digits as the minutes and the **last** two digits as the seconds. It then **adds** them up as the cooking time. For example, You push `9` `5` `4` (three digits). It is normalized as `0954` and interpreted as `9` minutes and `54` seconds. You push `0` `0` `0` `8` (four digits). It is interpreted as `0` minutes and `8` seconds. You push `8` `0` `9` `0`. It is interpreted as `80` minutes and `90` seconds. You push `8` `1` `3` `0`. It is interpreted as `81` minutes and `30` seconds. You are given integers `startAt`, `moveCost`, `pushCost`, and `targetSeconds`. **Initially**, your finger is on the digit `startAt`. Moving the finger above **any specific digit** costs `moveCost` units of fatigue. Pushing the digit below the finger **once** costs `pushCost` units of fatigue. There can be multiple ways to set the microwave to cook for `targetSeconds` seconds but you are interested in the way with the minimum cost. Return _the **minimum cost** to set_ `targetSeconds` _seconds of cooking time_. Remember that one minute consists of `60` seconds. **Example 1:** ``` **Input:** startAt = 1, moveCost = 2, pushCost = 1, targetSeconds = 600 **Output:** 6 **Explanation:** The following are the possible ways to set the cooking time. - 1 0 0 0, interpreted as 10 minutes and 0 seconds. The finger is already on digit 1, pushes 1 (with cost 1), moves to 0 (with cost 2), pushes 0 (with cost 1), pushes 0 (with cost 1), and pushes 0 (with cost 1). The cost is: 1 + 2 + 1 + 1 + 1 = 6. This is the minimum cost. - 0 9 6 0, interpreted as 9 minutes and 60 seconds. That is also 600 seconds. The finger moves to 0 (with cost 2), pushes 0 (with cost 1), moves to 9 (with cost 2), pushes 9 (with cost 1), moves to 6 (with cost 2), pushes 6 (with cost 1), moves to 0 (with cost 2), and pushes 0 (with cost 1). The cost is: 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 = 12. - 9 6 0, normalized as 0960 and interpreted as 9 minutes and 60 seconds. The finger moves to 9 (with cost 2), pushes 9 (with cost 1), moves to 6 (with cost 2), pushes 6 (with cost 1), moves to 0 (with cost 2), and pushes 0 (with cost 1). The cost is: 2 + 1 + 2 + 1 + 2 + 1 = 9. ``` **Example 2:** ``` **Input:** startAt = 0, moveCost = 1, pushCost = 2, targetSeconds = 76 **Output:** 6 **Explanation:** The optimal way is to push two digits: 7 6, interpreted as 76 seconds. The finger moves to 7 (with cost 1), pushes 7 (with cost 2), moves to 6 (with cost 1), and pushes 6 (with cost 2). The total cost is: 1 + 2 + 1 + 2 = 6 Note other possible ways are 0076, 076, 0116, and 116, but none of them produces the minimum cost. ``` **Constraints:** `0 <= startAt <= 9` `1 <= moveCost, pushCost <= 105` `1 <= targetSeconds <= 6039`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "startAt = 1, moveCost = 2, pushCost = 1, targetSeconds = 600",
12
+ "output": "6 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "startAt = 0, moveCost = 1, pushCost = 2, targetSeconds = 76",
17
+ "output": "6 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 7,
24
+ 71964,
25
+ 50245,
26
+ 4721
27
+ ],
28
+ "output": 416872
29
+ },
30
+ {
31
+ "input": [
32
+ 6,
33
+ 91933,
34
+ 82787,
35
+ 3978
36
+ ],
37
+ "output": 515014
38
+ },
39
+ {
40
+ "input": [
41
+ 8,
42
+ 557,
43
+ 34344,
44
+ 5384
45
+ ],
46
+ "output": 138490
47
+ },
48
+ {
49
+ "input": [
50
+ 7,
51
+ 5088,
52
+ 70480,
53
+ 358
54
+ ],
55
+ "output": 221616
56
+ },
57
+ {
58
+ "input": [
59
+ 7,
60
+ 35988,
61
+ 89071,
62
+ 5807
63
+ ],
64
+ "output": 500236
65
+ },
66
+ {
67
+ "input": [
68
+ 5,
69
+ 46652,
70
+ 46124,
71
+ 5331
72
+ ],
73
+ "output": 324452
74
+ },
75
+ {
76
+ "input": [
77
+ 3,
78
+ 88643,
79
+ 80681,
80
+ 809
81
+ ],
82
+ "output": 677296
83
+ },
84
+ {
85
+ "input": [
86
+ 3,
87
+ 15189,
88
+ 6466,
89
+ 4984
90
+ ],
91
+ "output": 86620
92
+ },
93
+ {
94
+ "input": [
95
+ 9,
96
+ 14158,
97
+ 13109,
98
+ 6038
99
+ ],
100
+ "output": 66594
101
+ },
102
+ {
103
+ "input": [
104
+ 5,
105
+ 83324,
106
+ 22235,
107
+ 2554
108
+ ],
109
+ "output": 422236
110
+ }
111
+ ],
112
+ "haskell_template": "minCostSetTime :: Int -> Int -> Int -> Int -> Int\nminCostSetTime startAt moveCost pushCost targetSeconds ",
113
+ "ocaml_template": "let minCostSetTime (startAt: int) (moveCost: int) (pushCost: int) (targetSeconds: int) : int = ",
114
+ "scala_template": "def minCostSetTime(startAt: Int,moveCost: Int,pushCost: Int,targetSeconds: Int): Int = { \n \n}",
115
+ "java_template": "public static int minCostSetTime(int startAt, int moveCost, int pushCost, int targetSeconds) {\n\n}",
116
+ "python_template": "class Solution(object):\n def minCostSetTime(self, startAt, moveCost, pushCost, targetSeconds):\n \"\"\"\n :type startAt: int\n :type moveCost: int\n :type pushCost: int\n :type targetSeconds: int\n :rtype: int\n \"\"\"\n "
117
+ }
minimum_cost_to_set_cooking_time/ocaml_tests/main.ml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal 6 (minCostSetTime 1 2 1 600)
12
+
13
+ let test2 _ = assert_equal 6 (minCostSetTime 0 1 2 76)
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for minCostSetTime" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
minimum_cost_to_set_cooking_time/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.minCostSetTime(1,2,1,600), 6)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.minCostSetTime(0,1,2,76), 6)
10
+ }
11
+
12
+ }
minimum_cost_to_split_an_array/haskell_tests/Main.hs ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (minCost [1,2,1,2,1,3,3] 2)," 8 (minCost [1,2,1,2,1,3,3] 2))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (minCost [1,2,1,2,1] 2)," 6 (minCost [1,2,1,2,1] 2))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (minCost [1,2,1,2,1] 5)," 10 (minCost [1,2,1,2,1] 5))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (minCost [556, 295, 236, 505, 105, 289, 147, 189, 148, 495, 184, 477, 405, 14, 117, 380, 585, 124, 22, 152, 105, 115, 407, 366, 143, 525, 274, 11, 340, 133, 298, 565, 577, 398, 283, 117, 163, 593, 535, 259, 177, 211, 340, 436, 130, 112, 148, 65, 342, 580, 361, 430, 581, 285, 378, 425, 218, 214, 592, 491, 342, 363, 94, 394, 555, 232, 308, 345, 95, 600, 412, 131, 115, 390, 170, 75, 556, 501, 391, 7, 99, 242, 576, 556, 369, 126, 55, 491, 386, 168, 587, 582, 316, 199, 171, 122, 591, 184, 299, 570, 596, 42, 545, 191, 239, 474, 115, 301, 571, 4, 214, 257, 125, 161, 596, 330, 174, 243, 360, 608, 388, 358, 300, 521, 610, 134, 385, 56, 146, 394, 29, 422, 285, 79, 156, 294, 269, 35, 371, 143, 610, 293, 403, 139, 381, 53, 35, 4, 498, 590, 451, 101, 560, 525, 11, 411, 524, 371, 352, 196, 170, 214, 236, 232, 340, 568, 283, 600, 31, 114, 115, 500, 178, 72, 372, 344, 98, 160, 36, 475, 151, 132, 560, 432, 23, 21, 130, 429, 109, 176, 582, 472, 492, 166, 595, 163, 62, 274, 223, 430, 532, 519, 239, 402, 494, 176, 197, 85, 278, 330, 502, 157, 101, 47, 122, 219, 313, 252, 432, 412, 493, 289, 535, 427, 244, 498, 561, 377, 296, 167, 502, 497, 519, 580, 339, 418, 379, 232, 41, 553, 133, 28, 242, 151, 445, 319, 526, 326, 403, 487, 449, 448, 361, 297, 110, 1, 129, 293, 20, 23, 389, 92, 37, 66, 222, 403, 155, 180, 251, 258, 530, 386, 271, 414, 477, 4, 509, 575, 56, 335, 604, 546, 426, 88, 412, 75, 245, 445, 448, 161, 535, 53, 171, 197, 456, 292, 611, 337, 321, 473, 294, 12, 113, 528, 52, 424, 24, 201, 428, 378, 71, 551, 486, 458, 279, 567, 41, 312, 374, 28, 426, 567, 280, 447, 552, 432, 516, 479, 369, 276, 465, 287, 101, 521, 177, 164, 162, 298, 472, 399, 104, 545, 562, 342, 278, 371, 115, 245, 258, 154, 248, 46, 257, 18, 360, 322, 302, 31, 593, 425, 107, 405, 290, 264, 365, 548, 400, 200, 132, 312, 257, 524, 534, 31, 545, 554, 601, 211, 472, 402, 493, 28, 583, 367, 16, 282, 565, 488, 351, 517, 503, 148, 389, 78, 14, 208, 482, 153, 80, 336, 570, 537, 1, 226, 387, 150, 394, 275, 17, 387, 577, 454, 293, 356, 548, 464, 197, 291, 47, 299, 62, 197, 278, 286, 188, 486, 601, 15, 594, 276, 160, 265, 159, 188, 119, 259, 116, 5, 521, 58, 146, 222, 610, 141, 419, 514, 324, 352, 188, 244, 80, 572, 292, 293, 62, 357, 293, 376, 100, 450, 156, 440, 84, 305, 239, 424, 419, 406, 254, 213, 558, 100, 553, 1, 113, 153, 97, 189, 101, 302, 217, 414, 407, 515, 31, 194, 158, 237, 418, 592, 387, 345, 182, 439, 505, 59, 91, 220, 428, 178, 94, 606, 122, 412, 443, 471, 363, 331, 176, 324, 502, 123, 244, 261, 385, 310, 455, 609, 213, 557, 443, 347, 428, 123, 157, 561, 286, 317, 136, 324, 565, 87, 395, 598, 529, 451, 10, 574, 540, 351, 305, 560, 427, 503, 575, 71, 70, 431, 114, 147, 0, 577, 496, 227, 447, 441, 350, 47, 500, 610, 539, 209, 514, 490, 320, 539, 515, 567, 308, 327, 74, 494, 579, 551, 420, 494, 35, 603, 9, 473, 31, 105, 353, 116, 503, 403, 163, 151, 195, 146, 544, 338, 537, 188, 132, 375, 300, 571, 396, 398, 201, 356, 603, 291, 228, 566, 53, 236, 583, 209, 241, 288] 318885581)," 318885978 (minCost [556, 295, 236, 505, 105, 289, 147, 189, 148, 495, 184, 477, 405, 14, 117, 380, 585, 124, 22, 152, 105, 115, 407, 366, 143, 525, 274, 11, 340, 133, 298, 565, 577, 398, 283, 117, 163, 593, 535, 259, 177, 211, 340, 436, 130, 112, 148, 65, 342, 580, 361, 430, 581, 285, 378, 425, 218, 214, 592, 491, 342, 363, 94, 394, 555, 232, 308, 345, 95, 600, 412, 131, 115, 390, 170, 75, 556, 501, 391, 7, 99, 242, 576, 556, 369, 126, 55, 491, 386, 168, 587, 582, 316, 199, 171, 122, 591, 184, 299, 570, 596, 42, 545, 191, 239, 474, 115, 301, 571, 4, 214, 257, 125, 161, 596, 330, 174, 243, 360, 608, 388, 358, 300, 521, 610, 134, 385, 56, 146, 394, 29, 422, 285, 79, 156, 294, 269, 35, 371, 143, 610, 293, 403, 139, 381, 53, 35, 4, 498, 590, 451, 101, 560, 525, 11, 411, 524, 371, 352, 196, 170, 214, 236, 232, 340, 568, 283, 600, 31, 114, 115, 500, 178, 72, 372, 344, 98, 160, 36, 475, 151, 132, 560, 432, 23, 21, 130, 429, 109, 176, 582, 472, 492, 166, 595, 163, 62, 274, 223, 430, 532, 519, 239, 402, 494, 176, 197, 85, 278, 330, 502, 157, 101, 47, 122, 219, 313, 252, 432, 412, 493, 289, 535, 427, 244, 498, 561, 377, 296, 167, 502, 497, 519, 580, 339, 418, 379, 232, 41, 553, 133, 28, 242, 151, 445, 319, 526, 326, 403, 487, 449, 448, 361, 297, 110, 1, 129, 293, 20, 23, 389, 92, 37, 66, 222, 403, 155, 180, 251, 258, 530, 386, 271, 414, 477, 4, 509, 575, 56, 335, 604, 546, 426, 88, 412, 75, 245, 445, 448, 161, 535, 53, 171, 197, 456, 292, 611, 337, 321, 473, 294, 12, 113, 528, 52, 424, 24, 201, 428, 378, 71, 551, 486, 458, 279, 567, 41, 312, 374, 28, 426, 567, 280, 447, 552, 432, 516, 479, 369, 276, 465, 287, 101, 521, 177, 164, 162, 298, 472, 399, 104, 545, 562, 342, 278, 371, 115, 245, 258, 154, 248, 46, 257, 18, 360, 322, 302, 31, 593, 425, 107, 405, 290, 264, 365, 548, 400, 200, 132, 312, 257, 524, 534, 31, 545, 554, 601, 211, 472, 402, 493, 28, 583, 367, 16, 282, 565, 488, 351, 517, 503, 148, 389, 78, 14, 208, 482, 153, 80, 336, 570, 537, 1, 226, 387, 150, 394, 275, 17, 387, 577, 454, 293, 356, 548, 464, 197, 291, 47, 299, 62, 197, 278, 286, 188, 486, 601, 15, 594, 276, 160, 265, 159, 188, 119, 259, 116, 5, 521, 58, 146, 222, 610, 141, 419, 514, 324, 352, 188, 244, 80, 572, 292, 293, 62, 357, 293, 376, 100, 450, 156, 440, 84, 305, 239, 424, 419, 406, 254, 213, 558, 100, 553, 1, 113, 153, 97, 189, 101, 302, 217, 414, 407, 515, 31, 194, 158, 237, 418, 592, 387, 345, 182, 439, 505, 59, 91, 220, 428, 178, 94, 606, 122, 412, 443, 471, 363, 331, 176, 324, 502, 123, 244, 261, 385, 310, 455, 609, 213, 557, 443, 347, 428, 123, 157, 561, 286, 317, 136, 324, 565, 87, 395, 598, 529, 451, 10, 574, 540, 351, 305, 560, 427, 503, 575, 71, 70, 431, 114, 147, 0, 577, 496, 227, 447, 441, 350, 47, 500, 610, 539, 209, 514, 490, 320, 539, 515, 567, 308, 327, 74, 494, 579, 551, 420, 494, 35, 603, 9, 473, 31, 105, 353, 116, 503, 403, 163, 151, 195, 146, 544, 338, 537, 188, 132, 375, 300, 571, 396, 398, 201, 356, 603, 291, 228, 566, 53, 236, 583, 209, 241, 288] 318885581))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (minCost [436, 88, 79, 214, 18, 319, 225, 299, 468, 11, 446, 320, 111, 295, 115, 449, 195, 57, 75, 493, 460, 229, 460, 75, 215, 208, 372, 255, 398, 484, 400, 265, 102, 24, 79, 384, 363, 58, 220, 256, 323, 141, 177, 80, 321, 471, 20, 219, 263, 353, 135, 127, 478, 143, 197, 431, 241, 461, 475, 36, 146, 51, 452, 336, 370, 217, 97, 92, 443, 343, 379, 378, 375, 251, 31, 246, 159, 259, 519, 33, 212, 199, 415, 230, 404, 350, 98, 37, 287, 158, 234, 7, 281, 365, 507, 380, 363, 230, 170, 159, 492, 232, 122, 98, 380, 196, 520, 480, 218, 490, 120, 453, 177, 134, 457, 199, 361, 54, 241, 416, 107, 339, 425, 249, 246, 39, 529, 48, 42, 342, 136, 128, 311, 460, 189, 150, 272, 211, 404, 358, 462, 496, 327, 102, 428, 507, 468, 170, 273, 54, 52, 444, 34, 292, 479, 262, 15, 436, 480, 226, 175, 216, 71, 501, 361, 155, 139, 200, 148, 422, 93, 383, 195, 88, 29, 251, 336, 100, 456, 291, 367, 50, 364, 409, 158, 372, 223, 470, 289, 471, 451, 359, 345, 435, 16, 360, 234, 402, 105, 5, 351, 310, 51, 39, 288, 73, 379, 306, 331, 80, 275, 217, 125, 423, 75, 334, 61, 108, 165, 11, 112, 486, 62, 85, 105, 268, 255, 76, 406, 382, 317, 528, 21, 146, 477, 349, 101, 249, 27, 198, 292, 399, 363, 316, 137, 105, 211, 166, 295, 149, 17, 165, 282, 250, 395, 396, 65, 254, 77, 402, 442, 366, 113, 336, 79, 195, 458, 233, 366, 513, 402, 352, 131, 109, 497, 149, 363, 196, 1, 46, 226, 272, 400, 349, 138, 105, 290, 149, 253, 58, 498, 47, 529, 208, 232, 296, 423, 260, 98, 253, 47, 180, 524, 94, 70, 28, 503, 18, 75, 260, 61, 425, 458, 231, 212, 190, 50, 207, 237, 414, 164, 350, 9, 409, 183, 234, 334, 158, 177, 224, 204, 273, 27, 502, 462, 337, 365, 521, 466, 319, 428, 180, 242, 266, 250, 458, 293, 19, 53, 270, 349, 13, 246, 226, 315, 53, 409, 368, 103, 364, 57, 286, 455, 320, 112, 17, 57, 137, 234, 344, 167, 529, 270, 324, 382, 4, 420, 70, 257, 444, 185, 32, 103, 261, 215, 227, 477, 431, 448, 335, 171, 165, 161, 168, 530, 409, 78, 407, 378, 412, 326, 338, 302, 106, 274, 375, 78, 44, 395, 92, 438, 75, 152, 116, 270, 332, 182, 484, 470, 142, 283, 344, 243, 183, 169, 446, 262, 425, 518, 198, 44, 383, 332, 381, 311, 434, 213, 242, 255, 530, 343, 265, 434, 229, 255, 114, 466, 477, 159, 521, 498, 8, 289, 323, 293, 527, 471, 459, 206, 431, 23, 266, 179, 66, 502, 207, 138, 286, 239, 394, 437, 60, 510, 325, 407, 197, 136, 373, 347, 441, 72, 419, 179, 305, 381, 10, 119, 288, 16, 386, 188, 241, 15, 322, 349, 181, 54, 295, 297, 335, 211, 199, 281, 397, 282, 215, 131, 7, 92, 324, 252, 201, 506, 299, 135, 98, 468, 1, 258, 377, 97, 371, 520, 426, 179, 514, 488, 238, 506, 47, 393] 440648021)," 440648356 (minCost [436, 88, 79, 214, 18, 319, 225, 299, 468, 11, 446, 320, 111, 295, 115, 449, 195, 57, 75, 493, 460, 229, 460, 75, 215, 208, 372, 255, 398, 484, 400, 265, 102, 24, 79, 384, 363, 58, 220, 256, 323, 141, 177, 80, 321, 471, 20, 219, 263, 353, 135, 127, 478, 143, 197, 431, 241, 461, 475, 36, 146, 51, 452, 336, 370, 217, 97, 92, 443, 343, 379, 378, 375, 251, 31, 246, 159, 259, 519, 33, 212, 199, 415, 230, 404, 350, 98, 37, 287, 158, 234, 7, 281, 365, 507, 380, 363, 230, 170, 159, 492, 232, 122, 98, 380, 196, 520, 480, 218, 490, 120, 453, 177, 134, 457, 199, 361, 54, 241, 416, 107, 339, 425, 249, 246, 39, 529, 48, 42, 342, 136, 128, 311, 460, 189, 150, 272, 211, 404, 358, 462, 496, 327, 102, 428, 507, 468, 170, 273, 54, 52, 444, 34, 292, 479, 262, 15, 436, 480, 226, 175, 216, 71, 501, 361, 155, 139, 200, 148, 422, 93, 383, 195, 88, 29, 251, 336, 100, 456, 291, 367, 50, 364, 409, 158, 372, 223, 470, 289, 471, 451, 359, 345, 435, 16, 360, 234, 402, 105, 5, 351, 310, 51, 39, 288, 73, 379, 306, 331, 80, 275, 217, 125, 423, 75, 334, 61, 108, 165, 11, 112, 486, 62, 85, 105, 268, 255, 76, 406, 382, 317, 528, 21, 146, 477, 349, 101, 249, 27, 198, 292, 399, 363, 316, 137, 105, 211, 166, 295, 149, 17, 165, 282, 250, 395, 396, 65, 254, 77, 402, 442, 366, 113, 336, 79, 195, 458, 233, 366, 513, 402, 352, 131, 109, 497, 149, 363, 196, 1, 46, 226, 272, 400, 349, 138, 105, 290, 149, 253, 58, 498, 47, 529, 208, 232, 296, 423, 260, 98, 253, 47, 180, 524, 94, 70, 28, 503, 18, 75, 260, 61, 425, 458, 231, 212, 190, 50, 207, 237, 414, 164, 350, 9, 409, 183, 234, 334, 158, 177, 224, 204, 273, 27, 502, 462, 337, 365, 521, 466, 319, 428, 180, 242, 266, 250, 458, 293, 19, 53, 270, 349, 13, 246, 226, 315, 53, 409, 368, 103, 364, 57, 286, 455, 320, 112, 17, 57, 137, 234, 344, 167, 529, 270, 324, 382, 4, 420, 70, 257, 444, 185, 32, 103, 261, 215, 227, 477, 431, 448, 335, 171, 165, 161, 168, 530, 409, 78, 407, 378, 412, 326, 338, 302, 106, 274, 375, 78, 44, 395, 92, 438, 75, 152, 116, 270, 332, 182, 484, 470, 142, 283, 344, 243, 183, 169, 446, 262, 425, 518, 198, 44, 383, 332, 381, 311, 434, 213, 242, 255, 530, 343, 265, 434, 229, 255, 114, 466, 477, 159, 521, 498, 8, 289, 323, 293, 527, 471, 459, 206, 431, 23, 266, 179, 66, 502, 207, 138, 286, 239, 394, 437, 60, 510, 325, 407, 197, 136, 373, 347, 441, 72, 419, 179, 305, 381, 10, 119, 288, 16, 386, 188, 241, 15, 322, 349, 181, 54, 295, 297, 335, 211, 199, 281, 397, 282, 215, 131, 7, 92, 324, 252, 201, 506, 299, 135, 98, 468, 1, 258, 377, 97, 371, 520, 426, 179, 514, 488, 238, 506, 47, 393] 440648021))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (minCost [699, 277, 733, 143, 496, 112, 374, 61, 228, 297, 536, 119, 671, 314, 426, 668, 534, 58, 701, 159, 464, 119, 494, 58, 232, 271, 751, 367, 692, 473, 325, 274, 665, 688, 456, 167, 6, 484, 301, 353, 431, 86, 39, 727, 570, 14, 18, 176, 8, 234, 722, 405, 385, 396, 363, 405, 676, 586, 578, 735, 239, 368, 363, 258, 310, 278, 470, 712, 364, 753, 76, 175, 20, 634, 518, 252, 732, 679, 291, 475, 344, 405, 655, 699, 729, 543, 734, 426, 66, 1, 670, 550, 330, 175, 269, 184, 632, 605, 487, 91, 706, 743, 253, 230, 52, 609, 622, 663, 14, 8, 190, 258, 715, 38, 436, 259, 218, 489, 153, 129, 751, 30, 288, 408, 59, 79, 409, 332, 421, 391, 312, 156, 422, 13, 178, 251, 271, 325, 347, 446, 729, 187, 178, 114, 52, 428, 642, 620, 642, 618, 152, 402, 694, 671, 444, 29, 503, 482, 99, 64, 119, 575, 162, 354, 223, 365, 359, 731, 341, 36, 188, 488, 723, 398, 499, 428, 546, 87, 704, 155, 422, 87, 106, 223, 392, 399, 577, 59, 190, 725, 609, 411, 550, 611, 205, 731, 677, 85, 477, 416, 67, 440, 661, 734, 226, 457, 104, 177, 73, 109, 225, 157, 62, 442, 593, 118, 716, 514, 395, 509, 357, 130, 27, 661, 49, 433, 380, 116, 93, 651, 306, 359, 119, 466, 554, 152, 398, 425, 206, 524, 259, 334, 40, 60, 397, 431, 98, 315, 549, 214, 738, 392, 508, 429, 37, 26, 468, 197, 412, 714, 731, 17, 478, 647, 535, 689, 72, 516, 366, 682, 499, 200, 751, 441, 561, 723, 121, 253, 170, 646, 735, 10, 57, 413, 498, 520, 655, 243, 76, 672, 247, 20, 175, 472, 45, 198, 280, 316, 86, 214, 125, 192, 309, 569, 359, 504, 509, 737, 439, 609, 147, 158, 82, 319, 29, 329, 609, 724, 484, 111, 718, 221, 229, 692, 282, 458, 546, 251, 455, 700, 476, 423, 300, 166, 106, 268, 384, 372, 457, 378, 342, 617, 478, 536, 201, 394, 282, 262, 71, 207, 562, 91, 550, 165, 31, 274, 575, 478, 437, 511, 297, 737, 262, 753, 670, 240, 553, 672, 391, 281, 559, 385, 303, 109, 110, 261, 252, 738, 236, 97, 368, 564, 73, 290, 308, 296, 250, 409, 708, 744, 698, 714, 161, 712, 46, 229, 677, 529, 202, 456, 80, 2, 612, 147, 221, 634, 319, 487, 556, 78, 344, 215, 80, 150, 594, 691, 268, 565, 499, 311, 109, 276, 240, 87, 642, 341, 0, 663, 0, 132, 432, 430, 21, 502, 31, 625, 84, 273, 137, 752, 261, 657, 469, 253, 255, 53, 28, 520, 79, 386, 314, 93, 129, 51, 126, 672, 365, 55, 400, 90, 201, 381, 628, 249, 237, 179, 671, 59, 235, 502, 198, 204, 502, 199, 592, 568, 45, 586, 37, 697, 179, 640, 513, 517, 310, 213, 85, 500, 148, 438, 128, 350, 242, 381, 657, 299, 451, 509, 494, 380, 161, 26, 690, 347, 7, 510, 94, 696, 46, 43, 177, 345, 625, 678, 31, 588, 668, 744, 253, 552, 281, 390, 151, 168, 722, 529, 187, 123, 613, 593, 2, 429, 517, 7, 612, 273, 280, 367, 625, 218, 711, 143, 196, 38, 132, 222, 714, 4, 76, 97, 554, 112, 262, 657, 350, 278, 702, 282, 717, 426, 320, 218, 87, 743, 100, 125, 463, 370, 127, 571, 699, 214, 703, 201, 480, 115, 81, 104, 293, 244, 90, 653, 342, 727, 200, 644, 678, 151, 331, 357, 511, 496, 736, 94, 499, 587, 13, 631, 571, 683, 9, 105, 706, 640, 617, 267, 348, 501, 33, 0, 577, 245, 669, 369, 518, 206, 34, 511, 232, 448, 283, 733, 478, 676, 586, 664, 515, 162, 509, 641, 9, 58, 442, 650, 713, 11, 249, 466, 54, 298, 137, 206, 415, 15, 199, 71, 336, 602, 410, 295, 621, 168, 262, 314, 656, 217, 696, 116, 394, 504, 59, 209, 409, 424, 713, 601, 101, 32, 602, 569, 585, 219, 141, 455, 269, 574, 506, 258, 437, 358, 294, 703, 626, 330, 467, 627, 417, 702, 13, 495, 56, 665, 454, 253, 203, 387, 524, 375, 656, 4, 436, 557, 584, 435, 236, 452, 448, 537, 713, 352, 656, 728, 632, 518, 680, 464, 489, 205, 307, 360, 30, 384, 1, 87, 743, 714, 337, 114, 303, 30, 526, 354, 80, 13, 658, 412, 220, 668, 709, 558, 192, 549, 518, 169, 327, 180, 634, 547, 180, 717, 85, 401, 121, 299] 930884210)," 930884693 (minCost [699, 277, 733, 143, 496, 112, 374, 61, 228, 297, 536, 119, 671, 314, 426, 668, 534, 58, 701, 159, 464, 119, 494, 58, 232, 271, 751, 367, 692, 473, 325, 274, 665, 688, 456, 167, 6, 484, 301, 353, 431, 86, 39, 727, 570, 14, 18, 176, 8, 234, 722, 405, 385, 396, 363, 405, 676, 586, 578, 735, 239, 368, 363, 258, 310, 278, 470, 712, 364, 753, 76, 175, 20, 634, 518, 252, 732, 679, 291, 475, 344, 405, 655, 699, 729, 543, 734, 426, 66, 1, 670, 550, 330, 175, 269, 184, 632, 605, 487, 91, 706, 743, 253, 230, 52, 609, 622, 663, 14, 8, 190, 258, 715, 38, 436, 259, 218, 489, 153, 129, 751, 30, 288, 408, 59, 79, 409, 332, 421, 391, 312, 156, 422, 13, 178, 251, 271, 325, 347, 446, 729, 187, 178, 114, 52, 428, 642, 620, 642, 618, 152, 402, 694, 671, 444, 29, 503, 482, 99, 64, 119, 575, 162, 354, 223, 365, 359, 731, 341, 36, 188, 488, 723, 398, 499, 428, 546, 87, 704, 155, 422, 87, 106, 223, 392, 399, 577, 59, 190, 725, 609, 411, 550, 611, 205, 731, 677, 85, 477, 416, 67, 440, 661, 734, 226, 457, 104, 177, 73, 109, 225, 157, 62, 442, 593, 118, 716, 514, 395, 509, 357, 130, 27, 661, 49, 433, 380, 116, 93, 651, 306, 359, 119, 466, 554, 152, 398, 425, 206, 524, 259, 334, 40, 60, 397, 431, 98, 315, 549, 214, 738, 392, 508, 429, 37, 26, 468, 197, 412, 714, 731, 17, 478, 647, 535, 689, 72, 516, 366, 682, 499, 200, 751, 441, 561, 723, 121, 253, 170, 646, 735, 10, 57, 413, 498, 520, 655, 243, 76, 672, 247, 20, 175, 472, 45, 198, 280, 316, 86, 214, 125, 192, 309, 569, 359, 504, 509, 737, 439, 609, 147, 158, 82, 319, 29, 329, 609, 724, 484, 111, 718, 221, 229, 692, 282, 458, 546, 251, 455, 700, 476, 423, 300, 166, 106, 268, 384, 372, 457, 378, 342, 617, 478, 536, 201, 394, 282, 262, 71, 207, 562, 91, 550, 165, 31, 274, 575, 478, 437, 511, 297, 737, 262, 753, 670, 240, 553, 672, 391, 281, 559, 385, 303, 109, 110, 261, 252, 738, 236, 97, 368, 564, 73, 290, 308, 296, 250, 409, 708, 744, 698, 714, 161, 712, 46, 229, 677, 529, 202, 456, 80, 2, 612, 147, 221, 634, 319, 487, 556, 78, 344, 215, 80, 150, 594, 691, 268, 565, 499, 311, 109, 276, 240, 87, 642, 341, 0, 663, 0, 132, 432, 430, 21, 502, 31, 625, 84, 273, 137, 752, 261, 657, 469, 253, 255, 53, 28, 520, 79, 386, 314, 93, 129, 51, 126, 672, 365, 55, 400, 90, 201, 381, 628, 249, 237, 179, 671, 59, 235, 502, 198, 204, 502, 199, 592, 568, 45, 586, 37, 697, 179, 640, 513, 517, 310, 213, 85, 500, 148, 438, 128, 350, 242, 381, 657, 299, 451, 509, 494, 380, 161, 26, 690, 347, 7, 510, 94, 696, 46, 43, 177, 345, 625, 678, 31, 588, 668, 744, 253, 552, 281, 390, 151, 168, 722, 529, 187, 123, 613, 593, 2, 429, 517, 7, 612, 273, 280, 367, 625, 218, 711, 143, 196, 38, 132, 222, 714, 4, 76, 97, 554, 112, 262, 657, 350, 278, 702, 282, 717, 426, 320, 218, 87, 743, 100, 125, 463, 370, 127, 571, 699, 214, 703, 201, 480, 115, 81, 104, 293, 244, 90, 653, 342, 727, 200, 644, 678, 151, 331, 357, 511, 496, 736, 94, 499, 587, 13, 631, 571, 683, 9, 105, 706, 640, 617, 267, 348, 501, 33, 0, 577, 245, 669, 369, 518, 206, 34, 511, 232, 448, 283, 733, 478, 676, 586, 664, 515, 162, 509, 641, 9, 58, 442, 650, 713, 11, 249, 466, 54, 298, 137, 206, 415, 15, 199, 71, 336, 602, 410, 295, 621, 168, 262, 314, 656, 217, 696, 116, 394, 504, 59, 209, 409, 424, 713, 601, 101, 32, 602, 569, 585, 219, 141, 455, 269, 574, 506, 258, 437, 358, 294, 703, 626, 330, 467, 627, 417, 702, 13, 495, 56, 665, 454, 253, 203, 387, 524, 375, 656, 4, 436, 557, 584, 435, 236, 452, 448, 537, 713, 352, 656, 728, 632, 518, 680, 464, 489, 205, 307, 360, 30, 384, 1, 87, 743, 714, 337, 114, 303, 30, 526, 354, 80, 13, 658, 412, 220, 668, 709, 558, 192, 549, 518, 169, 327, 180, 634, 547, 180, 717, 85, 401, 121, 299] 930884210))
28
+
29
+ test7 :: Test
30
+ test7 = TestCase (assertEqual "for (minCost [59, 51, 83, 114, 94, 60, 119, 97, 2, 96, 80, 13, 76, 59, 137, 89, 29, 108, 133, 100, 66, 110, 42, 131, 110, 53, 5, 139, 130, 143, 27, 30, 105, 77, 80, 125, 32, 66, 105, 112, 41, 127, 75, 15, 26, 90, 89, 83, 5, 45, 24, 56, 36, 109, 98, 25, 61, 101, 120, 115, 12, 76, 121, 26, 25, 131, 110, 35, 21, 22, 44, 97, 25, 120, 104, 101, 82, 36, 70, 84, 43, 41, 22, 53, 19, 47, 95, 53, 123, 9, 114, 119, 91, 122, 80, 80, 60, 99, 142, 145, 123, 124, 137, 124, 61, 30, 59, 133, 59, 29, 39, 127, 22, 2, 107, 31, 76, 3, 64, 106, 83, 38, 28, 32, 124, 78, 37, 40, 110, 99, 65, 21, 93, 121, 50, 16, 32, 23, 12, 131, 40, 60, 34, 36, 129, 67] 495868694)," 495868784 (minCost [59, 51, 83, 114, 94, 60, 119, 97, 2, 96, 80, 13, 76, 59, 137, 89, 29, 108, 133, 100, 66, 110, 42, 131, 110, 53, 5, 139, 130, 143, 27, 30, 105, 77, 80, 125, 32, 66, 105, 112, 41, 127, 75, 15, 26, 90, 89, 83, 5, 45, 24, 56, 36, 109, 98, 25, 61, 101, 120, 115, 12, 76, 121, 26, 25, 131, 110, 35, 21, 22, 44, 97, 25, 120, 104, 101, 82, 36, 70, 84, 43, 41, 22, 53, 19, 47, 95, 53, 123, 9, 114, 119, 91, 122, 80, 80, 60, 99, 142, 145, 123, 124, 137, 124, 61, 30, 59, 133, 59, 29, 39, 127, 22, 2, 107, 31, 76, 3, 64, 106, 83, 38, 28, 32, 124, 78, 37, 40, 110, 99, 65, 21, 93, 121, 50, 16, 32, 23, 12, 131, 40, 60, 34, 36, 129, 67] 495868694))
31
+
32
+ test8 :: Test
33
+ test8 = TestCase (assertEqual "for (minCost [203, 1, 252, 243, 29, 258, 14, 190, 83, 215, 8, 77, 215, 131, 168, 72, 4, 251, 147, 150, 79, 244, 125, 182, 141, 104, 147, 202, 62, 105, 95, 204, 16, 183, 165, 145, 208, 88, 90, 95, 11, 83, 228, 124, 136, 10, 49, 132, 100, 34, 75, 89, 111, 258, 95, 12, 12, 220, 59, 126, 26, 226, 110, 145, 251, 125, 53, 60, 9, 197, 224, 243, 260, 68, 117, 84, 162, 227, 130, 118, 245, 204, 139, 247, 195, 218, 194, 17, 144, 262, 152, 51, 254, 16, 204, 99, 32, 156, 67, 47, 47, 10, 216, 252, 34, 207, 202, 206, 44, 230, 37, 170, 50, 7, 130, 59, 241, 159, 68, 210, 148, 163, 245, 260, 159, 152, 51, 11, 21, 263, 155, 150, 189, 223, 142, 140, 131, 205, 74, 66, 138, 0, 172, 96, 140, 118, 89, 222, 218, 22, 174, 43, 80, 169, 88, 206, 92, 180, 252, 202, 65, 86, 130, 69, 122, 116, 214, 116, 225, 118, 188, 223, 122, 118, 113, 224, 98, 193, 39, 254, 80, 161, 204, 93, 182, 206, 84, 234, 177, 47, 74, 54, 182, 57, 146, 64, 137, 14, 161, 214, 194, 93, 106, 171, 260, 51, 114, 202, 219, 122, 149, 208, 161, 219, 36, 3, 215, 66, 114, 26, 177, 244, 65, 55, 211, 56, 50, 28, 169, 31, 39, 36, 192, 260, 148, 172, 221, 200, 84, 6, 246, 11, 75, 144, 38, 14, 49, 236, 90, 9, 74, 158, 236, 111, 159, 250, 204, 250, 94, 65, 230, 81, 41, 39] 207184027)," 207184195 (minCost [203, 1, 252, 243, 29, 258, 14, 190, 83, 215, 8, 77, 215, 131, 168, 72, 4, 251, 147, 150, 79, 244, 125, 182, 141, 104, 147, 202, 62, 105, 95, 204, 16, 183, 165, 145, 208, 88, 90, 95, 11, 83, 228, 124, 136, 10, 49, 132, 100, 34, 75, 89, 111, 258, 95, 12, 12, 220, 59, 126, 26, 226, 110, 145, 251, 125, 53, 60, 9, 197, 224, 243, 260, 68, 117, 84, 162, 227, 130, 118, 245, 204, 139, 247, 195, 218, 194, 17, 144, 262, 152, 51, 254, 16, 204, 99, 32, 156, 67, 47, 47, 10, 216, 252, 34, 207, 202, 206, 44, 230, 37, 170, 50, 7, 130, 59, 241, 159, 68, 210, 148, 163, 245, 260, 159, 152, 51, 11, 21, 263, 155, 150, 189, 223, 142, 140, 131, 205, 74, 66, 138, 0, 172, 96, 140, 118, 89, 222, 218, 22, 174, 43, 80, 169, 88, 206, 92, 180, 252, 202, 65, 86, 130, 69, 122, 116, 214, 116, 225, 118, 188, 223, 122, 118, 113, 224, 98, 193, 39, 254, 80, 161, 204, 93, 182, 206, 84, 234, 177, 47, 74, 54, 182, 57, 146, 64, 137, 14, 161, 214, 194, 93, 106, 171, 260, 51, 114, 202, 219, 122, 149, 208, 161, 219, 36, 3, 215, 66, 114, 26, 177, 244, 65, 55, 211, 56, 50, 28, 169, 31, 39, 36, 192, 260, 148, 172, 221, 200, 84, 6, 246, 11, 75, 144, 38, 14, 49, 236, 90, 9, 74, 158, 236, 111, 159, 250, 204, 250, 94, 65, 230, 81, 41, 39] 207184027))
34
+
35
+ test9 :: Test
36
+ test9 = TestCase (assertEqual "for (minCost [340, 77, 284, 344, 349, 100, 397, 234, 284, 331, 29, 59, 416, 87, 354, 250, 125, 176, 345, 286, 188, 118, 380, 324, 308, 383, 118, 210, 145, 35, 141, 233, 196, 298, 153, 221, 208, 18, 75, 142, 403, 104, 252, 248, 413, 12, 200, 167, 346, 57, 19, 392, 7, 279, 278, 331, 285, 129, 295, 300, 19, 418, 338, 370, 7, 56, 271, 116, 321, 165, 45, 413, 21, 60, 161, 271, 204, 288, 372, 67, 366, 278, 224, 205, 144, 103, 241, 27, 182, 406, 325, 238, 49, 292, 385, 57, 297, 364, 135, 173, 345, 318, 58, 29, 416, 248, 291, 333, 274, 68, 104, 89, 250, 173, 32, 323, 190, 209, 104, 81, 250, 207, 149, 60, 170, 303, 73, 215, 345, 390, 255, 233, 331, 274, 12, 172, 235, 105, 349, 294, 163, 353, 36, 227, 239, 9, 375, 118, 40, 231, 41, 406, 211, 79, 122, 105, 341, 160, 403, 162, 253, 60, 339, 22, 137, 173, 161, 21, 95, 179, 160, 62, 337, 396, 410, 325, 387, 237, 290, 31, 258, 303, 397, 239, 351, 37, 218, 60, 201, 60, 125, 330, 175, 70, 195, 297, 385, 333, 326, 157, 236, 176, 242, 222, 181, 262, 113, 404, 75, 156, 131, 406, 273, 48, 134, 6, 240, 299, 307, 52, 151, 33, 277, 344, 2, 114, 185, 266, 39, 26, 351, 77, 9, 388, 7, 183, 77, 390, 126, 145, 16, 195, 47, 116, 34, 96, 211, 376, 159, 222, 13, 242, 174, 376, 154, 255, 2, 288, 195, 355, 47, 190, 161, 3, 198, 330, 217, 46, 403, 362, 8, 77, 389, 344, 208, 293, 299, 191, 12, 183, 406, 356, 311, 33, 223, 378, 153, 271, 302, 131, 209, 99, 205, 163, 59, 84, 288, 402, 118, 286, 362, 216, 418, 344, 253, 111, 184, 128, 149, 191, 184, 47, 14, 176, 202, 331, 97, 11, 307, 324, 120, 219, 200, 103, 207, 215, 388, 10, 391, 142, 254, 383, 28, 213, 212, 63, 395, 96, 285, 182, 239, 196, 338, 259, 208, 407, 169, 107, 224, 39, 282, 22, 123, 181, 248, 384, 184, 63, 369, 138, 152, 180, 304, 418, 388, 418, 108, 73, 175, 114, 409, 175, 83, 364, 8, 39, 127, 391, 217, 282, 364, 73, 231, 105, 55, 303, 107, 387, 207, 127, 37, 344, 94, 269, 157, 252, 151, 318, 203, 153, 254, 123, 349, 235, 164, 329, 268, 355, 61, 233, 247, 86, 39, 125, 371, 415, 143, 350, 402, 59] 939948695)," 939948968 (minCost [340, 77, 284, 344, 349, 100, 397, 234, 284, 331, 29, 59, 416, 87, 354, 250, 125, 176, 345, 286, 188, 118, 380, 324, 308, 383, 118, 210, 145, 35, 141, 233, 196, 298, 153, 221, 208, 18, 75, 142, 403, 104, 252, 248, 413, 12, 200, 167, 346, 57, 19, 392, 7, 279, 278, 331, 285, 129, 295, 300, 19, 418, 338, 370, 7, 56, 271, 116, 321, 165, 45, 413, 21, 60, 161, 271, 204, 288, 372, 67, 366, 278, 224, 205, 144, 103, 241, 27, 182, 406, 325, 238, 49, 292, 385, 57, 297, 364, 135, 173, 345, 318, 58, 29, 416, 248, 291, 333, 274, 68, 104, 89, 250, 173, 32, 323, 190, 209, 104, 81, 250, 207, 149, 60, 170, 303, 73, 215, 345, 390, 255, 233, 331, 274, 12, 172, 235, 105, 349, 294, 163, 353, 36, 227, 239, 9, 375, 118, 40, 231, 41, 406, 211, 79, 122, 105, 341, 160, 403, 162, 253, 60, 339, 22, 137, 173, 161, 21, 95, 179, 160, 62, 337, 396, 410, 325, 387, 237, 290, 31, 258, 303, 397, 239, 351, 37, 218, 60, 201, 60, 125, 330, 175, 70, 195, 297, 385, 333, 326, 157, 236, 176, 242, 222, 181, 262, 113, 404, 75, 156, 131, 406, 273, 48, 134, 6, 240, 299, 307, 52, 151, 33, 277, 344, 2, 114, 185, 266, 39, 26, 351, 77, 9, 388, 7, 183, 77, 390, 126, 145, 16, 195, 47, 116, 34, 96, 211, 376, 159, 222, 13, 242, 174, 376, 154, 255, 2, 288, 195, 355, 47, 190, 161, 3, 198, 330, 217, 46, 403, 362, 8, 77, 389, 344, 208, 293, 299, 191, 12, 183, 406, 356, 311, 33, 223, 378, 153, 271, 302, 131, 209, 99, 205, 163, 59, 84, 288, 402, 118, 286, 362, 216, 418, 344, 253, 111, 184, 128, 149, 191, 184, 47, 14, 176, 202, 331, 97, 11, 307, 324, 120, 219, 200, 103, 207, 215, 388, 10, 391, 142, 254, 383, 28, 213, 212, 63, 395, 96, 285, 182, 239, 196, 338, 259, 208, 407, 169, 107, 224, 39, 282, 22, 123, 181, 248, 384, 184, 63, 369, 138, 152, 180, 304, 418, 388, 418, 108, 73, 175, 114, 409, 175, 83, 364, 8, 39, 127, 391, 217, 282, 364, 73, 231, 105, 55, 303, 107, 387, 207, 127, 37, 344, 94, 269, 157, 252, 151, 318, 203, 153, 254, 123, 349, 235, 164, 329, 268, 355, 61, 233, 247, 86, 39, 125, 371, 415, 143, 350, 402, 59] 939948695))
37
+
38
+
39
+ -- Grouping test cases
40
+ tests :: Test
41
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6, TestLabel "Test7" test7, TestLabel "Test8" test8, TestLabel "Test9" test9]
42
+
43
+ -- Running the tests
44
+ main :: IO Counts
45
+ main = runTestTT tests
minimum_cost_to_split_an_array/java_tests/Main.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(8, minCost(new ArrayList<>(Arrays.asList(1,2,1,2,1,3,3)), 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(6, minCost(new ArrayList<>(Arrays.asList(1,2,1,2,1)), 2));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(10, minCost(new ArrayList<>(Arrays.asList(1,2,1,2,1)), 5));
23
+ }
24
+
25
+ }
minimum_cost_to_split_an_array/meta.json ADDED
@@ -0,0 +1,3728 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2633,
3
+ "name": "minimum_cost_to_split_an_array",
4
+ "difficulty": "Hard",
5
+ "link": "https://leetcode.com/problems/minimum-cost-to-split-an-array/",
6
+ "date": "2023-01-15 00:00:00",
7
+ "task_description": "You are given an integer array `nums` and an integer `k`. Split the array into some number of non-empty subarrays. The **cost** of a split is the sum of the **importance value** of each subarray in the split. Let `trimmed(subarray)` be the version of the subarray where all numbers which appear only once are removed. For example, `trimmed([3,1,2,4,3,4]) = [3,4,3,4].` The **importance value** of a subarray is `k + trimmed(subarray).length`. For example, if a subarray is `[1,2,3,3,3,4,4]`, then trimmed(`[1,2,3,3,3,4,4]) = [3,3,3,4,4].`The importance value of this subarray will be `k + 5`. Return _the minimum possible cost of a split of _`nums`. A **subarray** is a contiguous **non-empty** sequence of elements within an array. **Example 1:** ``` **Input:** nums = [1,2,1,2,1,3,3], k = 2 **Output:** 8 **Explanation:** We split nums to have two subarrays: [1,2], [1,2,1,3,3]. The importance value of [1,2] is 2 + (0) = 2. The importance value of [1,2,1,3,3] is 2 + (2 + 2) = 6. The cost of the split is 2 + 6 = 8. It can be shown that this is the minimum possible cost among all the possible splits. ``` **Example 2:** ``` **Input:** nums = [1,2,1,2,1], k = 2 **Output:** 6 **Explanation:** We split nums to have two subarrays: [1,2], [1,2,1]. The importance value of [1,2] is 2 + (0) = 2. The importance value of [1,2,1] is 2 + (2) = 4. The cost of the split is 2 + 4 = 6. It can be shown that this is the minimum possible cost among all the possible splits. ``` **Example 3:** ``` **Input:** nums = [1,2,1,2,1], k = 5 **Output:** 10 **Explanation:** We split nums to have one subarray: [1,2,1,2,1]. The importance value of [1,2,1,2,1] is 5 + (3 + 2) = 10. The cost of the split is 10. It can be shown that this is the minimum possible cost among all the possible splits. ``` **Constraints:** `1 <= nums.length <= 1000` `0 <= nums[i] < nums.length` `1 <= k <= 109`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [1,2,1,2,1,3,3], k = 2",
12
+ "output": "8 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [1,2,1,2,1], k = 2",
17
+ "output": "6 "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "nums = [1,2,1,2,1], k = 5",
22
+ "output": "10 "
23
+ }
24
+ ],
25
+ "private_test_cases": [
26
+ {
27
+ "input": [
28
+ [
29
+ 556,
30
+ 295,
31
+ 236,
32
+ 505,
33
+ 105,
34
+ 289,
35
+ 147,
36
+ 189,
37
+ 148,
38
+ 495,
39
+ 184,
40
+ 477,
41
+ 405,
42
+ 14,
43
+ 117,
44
+ 380,
45
+ 585,
46
+ 124,
47
+ 22,
48
+ 152,
49
+ 105,
50
+ 115,
51
+ 407,
52
+ 366,
53
+ 143,
54
+ 525,
55
+ 274,
56
+ 11,
57
+ 340,
58
+ 133,
59
+ 298,
60
+ 565,
61
+ 577,
62
+ 398,
63
+ 283,
64
+ 117,
65
+ 163,
66
+ 593,
67
+ 535,
68
+ 259,
69
+ 177,
70
+ 211,
71
+ 340,
72
+ 436,
73
+ 130,
74
+ 112,
75
+ 148,
76
+ 65,
77
+ 342,
78
+ 580,
79
+ 361,
80
+ 430,
81
+ 581,
82
+ 285,
83
+ 378,
84
+ 425,
85
+ 218,
86
+ 214,
87
+ 592,
88
+ 491,
89
+ 342,
90
+ 363,
91
+ 94,
92
+ 394,
93
+ 555,
94
+ 232,
95
+ 308,
96
+ 345,
97
+ 95,
98
+ 600,
99
+ 412,
100
+ 131,
101
+ 115,
102
+ 390,
103
+ 170,
104
+ 75,
105
+ 556,
106
+ 501,
107
+ 391,
108
+ 7,
109
+ 99,
110
+ 242,
111
+ 576,
112
+ 556,
113
+ 369,
114
+ 126,
115
+ 55,
116
+ 491,
117
+ 386,
118
+ 168,
119
+ 587,
120
+ 582,
121
+ 316,
122
+ 199,
123
+ 171,
124
+ 122,
125
+ 591,
126
+ 184,
127
+ 299,
128
+ 570,
129
+ 596,
130
+ 42,
131
+ 545,
132
+ 191,
133
+ 239,
134
+ 474,
135
+ 115,
136
+ 301,
137
+ 571,
138
+ 4,
139
+ 214,
140
+ 257,
141
+ 125,
142
+ 161,
143
+ 596,
144
+ 330,
145
+ 174,
146
+ 243,
147
+ 360,
148
+ 608,
149
+ 388,
150
+ 358,
151
+ 300,
152
+ 521,
153
+ 610,
154
+ 134,
155
+ 385,
156
+ 56,
157
+ 146,
158
+ 394,
159
+ 29,
160
+ 422,
161
+ 285,
162
+ 79,
163
+ 156,
164
+ 294,
165
+ 269,
166
+ 35,
167
+ 371,
168
+ 143,
169
+ 610,
170
+ 293,
171
+ 403,
172
+ 139,
173
+ 381,
174
+ 53,
175
+ 35,
176
+ 4,
177
+ 498,
178
+ 590,
179
+ 451,
180
+ 101,
181
+ 560,
182
+ 525,
183
+ 11,
184
+ 411,
185
+ 524,
186
+ 371,
187
+ 352,
188
+ 196,
189
+ 170,
190
+ 214,
191
+ 236,
192
+ 232,
193
+ 340,
194
+ 568,
195
+ 283,
196
+ 600,
197
+ 31,
198
+ 114,
199
+ 115,
200
+ 500,
201
+ 178,
202
+ 72,
203
+ 372,
204
+ 344,
205
+ 98,
206
+ 160,
207
+ 36,
208
+ 475,
209
+ 151,
210
+ 132,
211
+ 560,
212
+ 432,
213
+ 23,
214
+ 21,
215
+ 130,
216
+ 429,
217
+ 109,
218
+ 176,
219
+ 582,
220
+ 472,
221
+ 492,
222
+ 166,
223
+ 595,
224
+ 163,
225
+ 62,
226
+ 274,
227
+ 223,
228
+ 430,
229
+ 532,
230
+ 519,
231
+ 239,
232
+ 402,
233
+ 494,
234
+ 176,
235
+ 197,
236
+ 85,
237
+ 278,
238
+ 330,
239
+ 502,
240
+ 157,
241
+ 101,
242
+ 47,
243
+ 122,
244
+ 219,
245
+ 313,
246
+ 252,
247
+ 432,
248
+ 412,
249
+ 493,
250
+ 289,
251
+ 535,
252
+ 427,
253
+ 244,
254
+ 498,
255
+ 561,
256
+ 377,
257
+ 296,
258
+ 167,
259
+ 502,
260
+ 497,
261
+ 519,
262
+ 580,
263
+ 339,
264
+ 418,
265
+ 379,
266
+ 232,
267
+ 41,
268
+ 553,
269
+ 133,
270
+ 28,
271
+ 242,
272
+ 151,
273
+ 445,
274
+ 319,
275
+ 526,
276
+ 326,
277
+ 403,
278
+ 487,
279
+ 449,
280
+ 448,
281
+ 361,
282
+ 297,
283
+ 110,
284
+ 1,
285
+ 129,
286
+ 293,
287
+ 20,
288
+ 23,
289
+ 389,
290
+ 92,
291
+ 37,
292
+ 66,
293
+ 222,
294
+ 403,
295
+ 155,
296
+ 180,
297
+ 251,
298
+ 258,
299
+ 530,
300
+ 386,
301
+ 271,
302
+ 414,
303
+ 477,
304
+ 4,
305
+ 509,
306
+ 575,
307
+ 56,
308
+ 335,
309
+ 604,
310
+ 546,
311
+ 426,
312
+ 88,
313
+ 412,
314
+ 75,
315
+ 245,
316
+ 445,
317
+ 448,
318
+ 161,
319
+ 535,
320
+ 53,
321
+ 171,
322
+ 197,
323
+ 456,
324
+ 292,
325
+ 611,
326
+ 337,
327
+ 321,
328
+ 473,
329
+ 294,
330
+ 12,
331
+ 113,
332
+ 528,
333
+ 52,
334
+ 424,
335
+ 24,
336
+ 201,
337
+ 428,
338
+ 378,
339
+ 71,
340
+ 551,
341
+ 486,
342
+ 458,
343
+ 279,
344
+ 567,
345
+ 41,
346
+ 312,
347
+ 374,
348
+ 28,
349
+ 426,
350
+ 567,
351
+ 280,
352
+ 447,
353
+ 552,
354
+ 432,
355
+ 516,
356
+ 479,
357
+ 369,
358
+ 276,
359
+ 465,
360
+ 287,
361
+ 101,
362
+ 521,
363
+ 177,
364
+ 164,
365
+ 162,
366
+ 298,
367
+ 472,
368
+ 399,
369
+ 104,
370
+ 545,
371
+ 562,
372
+ 342,
373
+ 278,
374
+ 371,
375
+ 115,
376
+ 245,
377
+ 258,
378
+ 154,
379
+ 248,
380
+ 46,
381
+ 257,
382
+ 18,
383
+ 360,
384
+ 322,
385
+ 302,
386
+ 31,
387
+ 593,
388
+ 425,
389
+ 107,
390
+ 405,
391
+ 290,
392
+ 264,
393
+ 365,
394
+ 548,
395
+ 400,
396
+ 200,
397
+ 132,
398
+ 312,
399
+ 257,
400
+ 524,
401
+ 534,
402
+ 31,
403
+ 545,
404
+ 554,
405
+ 601,
406
+ 211,
407
+ 472,
408
+ 402,
409
+ 493,
410
+ 28,
411
+ 583,
412
+ 367,
413
+ 16,
414
+ 282,
415
+ 565,
416
+ 488,
417
+ 351,
418
+ 517,
419
+ 503,
420
+ 148,
421
+ 389,
422
+ 78,
423
+ 14,
424
+ 208,
425
+ 482,
426
+ 153,
427
+ 80,
428
+ 336,
429
+ 570,
430
+ 537,
431
+ 1,
432
+ 226,
433
+ 387,
434
+ 150,
435
+ 394,
436
+ 275,
437
+ 17,
438
+ 387,
439
+ 577,
440
+ 454,
441
+ 293,
442
+ 356,
443
+ 548,
444
+ 464,
445
+ 197,
446
+ 291,
447
+ 47,
448
+ 299,
449
+ 62,
450
+ 197,
451
+ 278,
452
+ 286,
453
+ 188,
454
+ 486,
455
+ 601,
456
+ 15,
457
+ 594,
458
+ 276,
459
+ 160,
460
+ 265,
461
+ 159,
462
+ 188,
463
+ 119,
464
+ 259,
465
+ 116,
466
+ 5,
467
+ 521,
468
+ 58,
469
+ 146,
470
+ 222,
471
+ 610,
472
+ 141,
473
+ 419,
474
+ 514,
475
+ 324,
476
+ 352,
477
+ 188,
478
+ 244,
479
+ 80,
480
+ 572,
481
+ 292,
482
+ 293,
483
+ 62,
484
+ 357,
485
+ 293,
486
+ 376,
487
+ 100,
488
+ 450,
489
+ 156,
490
+ 440,
491
+ 84,
492
+ 305,
493
+ 239,
494
+ 424,
495
+ 419,
496
+ 406,
497
+ 254,
498
+ 213,
499
+ 558,
500
+ 100,
501
+ 553,
502
+ 1,
503
+ 113,
504
+ 153,
505
+ 97,
506
+ 189,
507
+ 101,
508
+ 302,
509
+ 217,
510
+ 414,
511
+ 407,
512
+ 515,
513
+ 31,
514
+ 194,
515
+ 158,
516
+ 237,
517
+ 418,
518
+ 592,
519
+ 387,
520
+ 345,
521
+ 182,
522
+ 439,
523
+ 505,
524
+ 59,
525
+ 91,
526
+ 220,
527
+ 428,
528
+ 178,
529
+ 94,
530
+ 606,
531
+ 122,
532
+ 412,
533
+ 443,
534
+ 471,
535
+ 363,
536
+ 331,
537
+ 176,
538
+ 324,
539
+ 502,
540
+ 123,
541
+ 244,
542
+ 261,
543
+ 385,
544
+ 310,
545
+ 455,
546
+ 609,
547
+ 213,
548
+ 557,
549
+ 443,
550
+ 347,
551
+ 428,
552
+ 123,
553
+ 157,
554
+ 561,
555
+ 286,
556
+ 317,
557
+ 136,
558
+ 324,
559
+ 565,
560
+ 87,
561
+ 395,
562
+ 598,
563
+ 529,
564
+ 451,
565
+ 10,
566
+ 574,
567
+ 540,
568
+ 351,
569
+ 305,
570
+ 560,
571
+ 427,
572
+ 503,
573
+ 575,
574
+ 71,
575
+ 70,
576
+ 431,
577
+ 114,
578
+ 147,
579
+ 0,
580
+ 577,
581
+ 496,
582
+ 227,
583
+ 447,
584
+ 441,
585
+ 350,
586
+ 47,
587
+ 500,
588
+ 610,
589
+ 539,
590
+ 209,
591
+ 514,
592
+ 490,
593
+ 320,
594
+ 539,
595
+ 515,
596
+ 567,
597
+ 308,
598
+ 327,
599
+ 74,
600
+ 494,
601
+ 579,
602
+ 551,
603
+ 420,
604
+ 494,
605
+ 35,
606
+ 603,
607
+ 9,
608
+ 473,
609
+ 31,
610
+ 105,
611
+ 353,
612
+ 116,
613
+ 503,
614
+ 403,
615
+ 163,
616
+ 151,
617
+ 195,
618
+ 146,
619
+ 544,
620
+ 338,
621
+ 537,
622
+ 188,
623
+ 132,
624
+ 375,
625
+ 300,
626
+ 571,
627
+ 396,
628
+ 398,
629
+ 201,
630
+ 356,
631
+ 603,
632
+ 291,
633
+ 228,
634
+ 566,
635
+ 53,
636
+ 236,
637
+ 583,
638
+ 209,
639
+ 241,
640
+ 288
641
+ ],
642
+ 318885581
643
+ ],
644
+ "output": 318885978
645
+ },
646
+ {
647
+ "input": [
648
+ [
649
+ 436,
650
+ 88,
651
+ 79,
652
+ 214,
653
+ 18,
654
+ 319,
655
+ 225,
656
+ 299,
657
+ 468,
658
+ 11,
659
+ 446,
660
+ 320,
661
+ 111,
662
+ 295,
663
+ 115,
664
+ 449,
665
+ 195,
666
+ 57,
667
+ 75,
668
+ 493,
669
+ 460,
670
+ 229,
671
+ 460,
672
+ 75,
673
+ 215,
674
+ 208,
675
+ 372,
676
+ 255,
677
+ 398,
678
+ 484,
679
+ 400,
680
+ 265,
681
+ 102,
682
+ 24,
683
+ 79,
684
+ 384,
685
+ 363,
686
+ 58,
687
+ 220,
688
+ 256,
689
+ 323,
690
+ 141,
691
+ 177,
692
+ 80,
693
+ 321,
694
+ 471,
695
+ 20,
696
+ 219,
697
+ 263,
698
+ 353,
699
+ 135,
700
+ 127,
701
+ 478,
702
+ 143,
703
+ 197,
704
+ 431,
705
+ 241,
706
+ 461,
707
+ 475,
708
+ 36,
709
+ 146,
710
+ 51,
711
+ 452,
712
+ 336,
713
+ 370,
714
+ 217,
715
+ 97,
716
+ 92,
717
+ 443,
718
+ 343,
719
+ 379,
720
+ 378,
721
+ 375,
722
+ 251,
723
+ 31,
724
+ 246,
725
+ 159,
726
+ 259,
727
+ 519,
728
+ 33,
729
+ 212,
730
+ 199,
731
+ 415,
732
+ 230,
733
+ 404,
734
+ 350,
735
+ 98,
736
+ 37,
737
+ 287,
738
+ 158,
739
+ 234,
740
+ 7,
741
+ 281,
742
+ 365,
743
+ 507,
744
+ 380,
745
+ 363,
746
+ 230,
747
+ 170,
748
+ 159,
749
+ 492,
750
+ 232,
751
+ 122,
752
+ 98,
753
+ 380,
754
+ 196,
755
+ 520,
756
+ 480,
757
+ 218,
758
+ 490,
759
+ 120,
760
+ 453,
761
+ 177,
762
+ 134,
763
+ 457,
764
+ 199,
765
+ 361,
766
+ 54,
767
+ 241,
768
+ 416,
769
+ 107,
770
+ 339,
771
+ 425,
772
+ 249,
773
+ 246,
774
+ 39,
775
+ 529,
776
+ 48,
777
+ 42,
778
+ 342,
779
+ 136,
780
+ 128,
781
+ 311,
782
+ 460,
783
+ 189,
784
+ 150,
785
+ 272,
786
+ 211,
787
+ 404,
788
+ 358,
789
+ 462,
790
+ 496,
791
+ 327,
792
+ 102,
793
+ 428,
794
+ 507,
795
+ 468,
796
+ 170,
797
+ 273,
798
+ 54,
799
+ 52,
800
+ 444,
801
+ 34,
802
+ 292,
803
+ 479,
804
+ 262,
805
+ 15,
806
+ 436,
807
+ 480,
808
+ 226,
809
+ 175,
810
+ 216,
811
+ 71,
812
+ 501,
813
+ 361,
814
+ 155,
815
+ 139,
816
+ 200,
817
+ 148,
818
+ 422,
819
+ 93,
820
+ 383,
821
+ 195,
822
+ 88,
823
+ 29,
824
+ 251,
825
+ 336,
826
+ 100,
827
+ 456,
828
+ 291,
829
+ 367,
830
+ 50,
831
+ 364,
832
+ 409,
833
+ 158,
834
+ 372,
835
+ 223,
836
+ 470,
837
+ 289,
838
+ 471,
839
+ 451,
840
+ 359,
841
+ 345,
842
+ 435,
843
+ 16,
844
+ 360,
845
+ 234,
846
+ 402,
847
+ 105,
848
+ 5,
849
+ 351,
850
+ 310,
851
+ 51,
852
+ 39,
853
+ 288,
854
+ 73,
855
+ 379,
856
+ 306,
857
+ 331,
858
+ 80,
859
+ 275,
860
+ 217,
861
+ 125,
862
+ 423,
863
+ 75,
864
+ 334,
865
+ 61,
866
+ 108,
867
+ 165,
868
+ 11,
869
+ 112,
870
+ 486,
871
+ 62,
872
+ 85,
873
+ 105,
874
+ 268,
875
+ 255,
876
+ 76,
877
+ 406,
878
+ 382,
879
+ 317,
880
+ 528,
881
+ 21,
882
+ 146,
883
+ 477,
884
+ 349,
885
+ 101,
886
+ 249,
887
+ 27,
888
+ 198,
889
+ 292,
890
+ 399,
891
+ 363,
892
+ 316,
893
+ 137,
894
+ 105,
895
+ 211,
896
+ 166,
897
+ 295,
898
+ 149,
899
+ 17,
900
+ 165,
901
+ 282,
902
+ 250,
903
+ 395,
904
+ 396,
905
+ 65,
906
+ 254,
907
+ 77,
908
+ 402,
909
+ 442,
910
+ 366,
911
+ 113,
912
+ 336,
913
+ 79,
914
+ 195,
915
+ 458,
916
+ 233,
917
+ 366,
918
+ 513,
919
+ 402,
920
+ 352,
921
+ 131,
922
+ 109,
923
+ 497,
924
+ 149,
925
+ 363,
926
+ 196,
927
+ 1,
928
+ 46,
929
+ 226,
930
+ 272,
931
+ 400,
932
+ 349,
933
+ 138,
934
+ 105,
935
+ 290,
936
+ 149,
937
+ 253,
938
+ 58,
939
+ 498,
940
+ 47,
941
+ 529,
942
+ 208,
943
+ 232,
944
+ 296,
945
+ 423,
946
+ 260,
947
+ 98,
948
+ 253,
949
+ 47,
950
+ 180,
951
+ 524,
952
+ 94,
953
+ 70,
954
+ 28,
955
+ 503,
956
+ 18,
957
+ 75,
958
+ 260,
959
+ 61,
960
+ 425,
961
+ 458,
962
+ 231,
963
+ 212,
964
+ 190,
965
+ 50,
966
+ 207,
967
+ 237,
968
+ 414,
969
+ 164,
970
+ 350,
971
+ 9,
972
+ 409,
973
+ 183,
974
+ 234,
975
+ 334,
976
+ 158,
977
+ 177,
978
+ 224,
979
+ 204,
980
+ 273,
981
+ 27,
982
+ 502,
983
+ 462,
984
+ 337,
985
+ 365,
986
+ 521,
987
+ 466,
988
+ 319,
989
+ 428,
990
+ 180,
991
+ 242,
992
+ 266,
993
+ 250,
994
+ 458,
995
+ 293,
996
+ 19,
997
+ 53,
998
+ 270,
999
+ 349,
1000
+ 13,
1001
+ 246,
1002
+ 226,
1003
+ 315,
1004
+ 53,
1005
+ 409,
1006
+ 368,
1007
+ 103,
1008
+ 364,
1009
+ 57,
1010
+ 286,
1011
+ 455,
1012
+ 320,
1013
+ 112,
1014
+ 17,
1015
+ 57,
1016
+ 137,
1017
+ 234,
1018
+ 344,
1019
+ 167,
1020
+ 529,
1021
+ 270,
1022
+ 324,
1023
+ 382,
1024
+ 4,
1025
+ 420,
1026
+ 70,
1027
+ 257,
1028
+ 444,
1029
+ 185,
1030
+ 32,
1031
+ 103,
1032
+ 261,
1033
+ 215,
1034
+ 227,
1035
+ 477,
1036
+ 431,
1037
+ 448,
1038
+ 335,
1039
+ 171,
1040
+ 165,
1041
+ 161,
1042
+ 168,
1043
+ 530,
1044
+ 409,
1045
+ 78,
1046
+ 407,
1047
+ 378,
1048
+ 412,
1049
+ 326,
1050
+ 338,
1051
+ 302,
1052
+ 106,
1053
+ 274,
1054
+ 375,
1055
+ 78,
1056
+ 44,
1057
+ 395,
1058
+ 92,
1059
+ 438,
1060
+ 75,
1061
+ 152,
1062
+ 116,
1063
+ 270,
1064
+ 332,
1065
+ 182,
1066
+ 484,
1067
+ 470,
1068
+ 142,
1069
+ 283,
1070
+ 344,
1071
+ 243,
1072
+ 183,
1073
+ 169,
1074
+ 446,
1075
+ 262,
1076
+ 425,
1077
+ 518,
1078
+ 198,
1079
+ 44,
1080
+ 383,
1081
+ 332,
1082
+ 381,
1083
+ 311,
1084
+ 434,
1085
+ 213,
1086
+ 242,
1087
+ 255,
1088
+ 530,
1089
+ 343,
1090
+ 265,
1091
+ 434,
1092
+ 229,
1093
+ 255,
1094
+ 114,
1095
+ 466,
1096
+ 477,
1097
+ 159,
1098
+ 521,
1099
+ 498,
1100
+ 8,
1101
+ 289,
1102
+ 323,
1103
+ 293,
1104
+ 527,
1105
+ 471,
1106
+ 459,
1107
+ 206,
1108
+ 431,
1109
+ 23,
1110
+ 266,
1111
+ 179,
1112
+ 66,
1113
+ 502,
1114
+ 207,
1115
+ 138,
1116
+ 286,
1117
+ 239,
1118
+ 394,
1119
+ 437,
1120
+ 60,
1121
+ 510,
1122
+ 325,
1123
+ 407,
1124
+ 197,
1125
+ 136,
1126
+ 373,
1127
+ 347,
1128
+ 441,
1129
+ 72,
1130
+ 419,
1131
+ 179,
1132
+ 305,
1133
+ 381,
1134
+ 10,
1135
+ 119,
1136
+ 288,
1137
+ 16,
1138
+ 386,
1139
+ 188,
1140
+ 241,
1141
+ 15,
1142
+ 322,
1143
+ 349,
1144
+ 181,
1145
+ 54,
1146
+ 295,
1147
+ 297,
1148
+ 335,
1149
+ 211,
1150
+ 199,
1151
+ 281,
1152
+ 397,
1153
+ 282,
1154
+ 215,
1155
+ 131,
1156
+ 7,
1157
+ 92,
1158
+ 324,
1159
+ 252,
1160
+ 201,
1161
+ 506,
1162
+ 299,
1163
+ 135,
1164
+ 98,
1165
+ 468,
1166
+ 1,
1167
+ 258,
1168
+ 377,
1169
+ 97,
1170
+ 371,
1171
+ 520,
1172
+ 426,
1173
+ 179,
1174
+ 514,
1175
+ 488,
1176
+ 238,
1177
+ 506,
1178
+ 47,
1179
+ 393
1180
+ ],
1181
+ 440648021
1182
+ ],
1183
+ "output": 440648356
1184
+ },
1185
+ {
1186
+ "input": [
1187
+ [
1188
+ 699,
1189
+ 277,
1190
+ 733,
1191
+ 143,
1192
+ 496,
1193
+ 112,
1194
+ 374,
1195
+ 61,
1196
+ 228,
1197
+ 297,
1198
+ 536,
1199
+ 119,
1200
+ 671,
1201
+ 314,
1202
+ 426,
1203
+ 668,
1204
+ 534,
1205
+ 58,
1206
+ 701,
1207
+ 159,
1208
+ 464,
1209
+ 119,
1210
+ 494,
1211
+ 58,
1212
+ 232,
1213
+ 271,
1214
+ 751,
1215
+ 367,
1216
+ 692,
1217
+ 473,
1218
+ 325,
1219
+ 274,
1220
+ 665,
1221
+ 688,
1222
+ 456,
1223
+ 167,
1224
+ 6,
1225
+ 484,
1226
+ 301,
1227
+ 353,
1228
+ 431,
1229
+ 86,
1230
+ 39,
1231
+ 727,
1232
+ 570,
1233
+ 14,
1234
+ 18,
1235
+ 176,
1236
+ 8,
1237
+ 234,
1238
+ 722,
1239
+ 405,
1240
+ 385,
1241
+ 396,
1242
+ 363,
1243
+ 405,
1244
+ 676,
1245
+ 586,
1246
+ 578,
1247
+ 735,
1248
+ 239,
1249
+ 368,
1250
+ 363,
1251
+ 258,
1252
+ 310,
1253
+ 278,
1254
+ 470,
1255
+ 712,
1256
+ 364,
1257
+ 753,
1258
+ 76,
1259
+ 175,
1260
+ 20,
1261
+ 634,
1262
+ 518,
1263
+ 252,
1264
+ 732,
1265
+ 679,
1266
+ 291,
1267
+ 475,
1268
+ 344,
1269
+ 405,
1270
+ 655,
1271
+ 699,
1272
+ 729,
1273
+ 543,
1274
+ 734,
1275
+ 426,
1276
+ 66,
1277
+ 1,
1278
+ 670,
1279
+ 550,
1280
+ 330,
1281
+ 175,
1282
+ 269,
1283
+ 184,
1284
+ 632,
1285
+ 605,
1286
+ 487,
1287
+ 91,
1288
+ 706,
1289
+ 743,
1290
+ 253,
1291
+ 230,
1292
+ 52,
1293
+ 609,
1294
+ 622,
1295
+ 663,
1296
+ 14,
1297
+ 8,
1298
+ 190,
1299
+ 258,
1300
+ 715,
1301
+ 38,
1302
+ 436,
1303
+ 259,
1304
+ 218,
1305
+ 489,
1306
+ 153,
1307
+ 129,
1308
+ 751,
1309
+ 30,
1310
+ 288,
1311
+ 408,
1312
+ 59,
1313
+ 79,
1314
+ 409,
1315
+ 332,
1316
+ 421,
1317
+ 391,
1318
+ 312,
1319
+ 156,
1320
+ 422,
1321
+ 13,
1322
+ 178,
1323
+ 251,
1324
+ 271,
1325
+ 325,
1326
+ 347,
1327
+ 446,
1328
+ 729,
1329
+ 187,
1330
+ 178,
1331
+ 114,
1332
+ 52,
1333
+ 428,
1334
+ 642,
1335
+ 620,
1336
+ 642,
1337
+ 618,
1338
+ 152,
1339
+ 402,
1340
+ 694,
1341
+ 671,
1342
+ 444,
1343
+ 29,
1344
+ 503,
1345
+ 482,
1346
+ 99,
1347
+ 64,
1348
+ 119,
1349
+ 575,
1350
+ 162,
1351
+ 354,
1352
+ 223,
1353
+ 365,
1354
+ 359,
1355
+ 731,
1356
+ 341,
1357
+ 36,
1358
+ 188,
1359
+ 488,
1360
+ 723,
1361
+ 398,
1362
+ 499,
1363
+ 428,
1364
+ 546,
1365
+ 87,
1366
+ 704,
1367
+ 155,
1368
+ 422,
1369
+ 87,
1370
+ 106,
1371
+ 223,
1372
+ 392,
1373
+ 399,
1374
+ 577,
1375
+ 59,
1376
+ 190,
1377
+ 725,
1378
+ 609,
1379
+ 411,
1380
+ 550,
1381
+ 611,
1382
+ 205,
1383
+ 731,
1384
+ 677,
1385
+ 85,
1386
+ 477,
1387
+ 416,
1388
+ 67,
1389
+ 440,
1390
+ 661,
1391
+ 734,
1392
+ 226,
1393
+ 457,
1394
+ 104,
1395
+ 177,
1396
+ 73,
1397
+ 109,
1398
+ 225,
1399
+ 157,
1400
+ 62,
1401
+ 442,
1402
+ 593,
1403
+ 118,
1404
+ 716,
1405
+ 514,
1406
+ 395,
1407
+ 509,
1408
+ 357,
1409
+ 130,
1410
+ 27,
1411
+ 661,
1412
+ 49,
1413
+ 433,
1414
+ 380,
1415
+ 116,
1416
+ 93,
1417
+ 651,
1418
+ 306,
1419
+ 359,
1420
+ 119,
1421
+ 466,
1422
+ 554,
1423
+ 152,
1424
+ 398,
1425
+ 425,
1426
+ 206,
1427
+ 524,
1428
+ 259,
1429
+ 334,
1430
+ 40,
1431
+ 60,
1432
+ 397,
1433
+ 431,
1434
+ 98,
1435
+ 315,
1436
+ 549,
1437
+ 214,
1438
+ 738,
1439
+ 392,
1440
+ 508,
1441
+ 429,
1442
+ 37,
1443
+ 26,
1444
+ 468,
1445
+ 197,
1446
+ 412,
1447
+ 714,
1448
+ 731,
1449
+ 17,
1450
+ 478,
1451
+ 647,
1452
+ 535,
1453
+ 689,
1454
+ 72,
1455
+ 516,
1456
+ 366,
1457
+ 682,
1458
+ 499,
1459
+ 200,
1460
+ 751,
1461
+ 441,
1462
+ 561,
1463
+ 723,
1464
+ 121,
1465
+ 253,
1466
+ 170,
1467
+ 646,
1468
+ 735,
1469
+ 10,
1470
+ 57,
1471
+ 413,
1472
+ 498,
1473
+ 520,
1474
+ 655,
1475
+ 243,
1476
+ 76,
1477
+ 672,
1478
+ 247,
1479
+ 20,
1480
+ 175,
1481
+ 472,
1482
+ 45,
1483
+ 198,
1484
+ 280,
1485
+ 316,
1486
+ 86,
1487
+ 214,
1488
+ 125,
1489
+ 192,
1490
+ 309,
1491
+ 569,
1492
+ 359,
1493
+ 504,
1494
+ 509,
1495
+ 737,
1496
+ 439,
1497
+ 609,
1498
+ 147,
1499
+ 158,
1500
+ 82,
1501
+ 319,
1502
+ 29,
1503
+ 329,
1504
+ 609,
1505
+ 724,
1506
+ 484,
1507
+ 111,
1508
+ 718,
1509
+ 221,
1510
+ 229,
1511
+ 692,
1512
+ 282,
1513
+ 458,
1514
+ 546,
1515
+ 251,
1516
+ 455,
1517
+ 700,
1518
+ 476,
1519
+ 423,
1520
+ 300,
1521
+ 166,
1522
+ 106,
1523
+ 268,
1524
+ 384,
1525
+ 372,
1526
+ 457,
1527
+ 378,
1528
+ 342,
1529
+ 617,
1530
+ 478,
1531
+ 536,
1532
+ 201,
1533
+ 394,
1534
+ 282,
1535
+ 262,
1536
+ 71,
1537
+ 207,
1538
+ 562,
1539
+ 91,
1540
+ 550,
1541
+ 165,
1542
+ 31,
1543
+ 274,
1544
+ 575,
1545
+ 478,
1546
+ 437,
1547
+ 511,
1548
+ 297,
1549
+ 737,
1550
+ 262,
1551
+ 753,
1552
+ 670,
1553
+ 240,
1554
+ 553,
1555
+ 672,
1556
+ 391,
1557
+ 281,
1558
+ 559,
1559
+ 385,
1560
+ 303,
1561
+ 109,
1562
+ 110,
1563
+ 261,
1564
+ 252,
1565
+ 738,
1566
+ 236,
1567
+ 97,
1568
+ 368,
1569
+ 564,
1570
+ 73,
1571
+ 290,
1572
+ 308,
1573
+ 296,
1574
+ 250,
1575
+ 409,
1576
+ 708,
1577
+ 744,
1578
+ 698,
1579
+ 714,
1580
+ 161,
1581
+ 712,
1582
+ 46,
1583
+ 229,
1584
+ 677,
1585
+ 529,
1586
+ 202,
1587
+ 456,
1588
+ 80,
1589
+ 2,
1590
+ 612,
1591
+ 147,
1592
+ 221,
1593
+ 634,
1594
+ 319,
1595
+ 487,
1596
+ 556,
1597
+ 78,
1598
+ 344,
1599
+ 215,
1600
+ 80,
1601
+ 150,
1602
+ 594,
1603
+ 691,
1604
+ 268,
1605
+ 565,
1606
+ 499,
1607
+ 311,
1608
+ 109,
1609
+ 276,
1610
+ 240,
1611
+ 87,
1612
+ 642,
1613
+ 341,
1614
+ 0,
1615
+ 663,
1616
+ 0,
1617
+ 132,
1618
+ 432,
1619
+ 430,
1620
+ 21,
1621
+ 502,
1622
+ 31,
1623
+ 625,
1624
+ 84,
1625
+ 273,
1626
+ 137,
1627
+ 752,
1628
+ 261,
1629
+ 657,
1630
+ 469,
1631
+ 253,
1632
+ 255,
1633
+ 53,
1634
+ 28,
1635
+ 520,
1636
+ 79,
1637
+ 386,
1638
+ 314,
1639
+ 93,
1640
+ 129,
1641
+ 51,
1642
+ 126,
1643
+ 672,
1644
+ 365,
1645
+ 55,
1646
+ 400,
1647
+ 90,
1648
+ 201,
1649
+ 381,
1650
+ 628,
1651
+ 249,
1652
+ 237,
1653
+ 179,
1654
+ 671,
1655
+ 59,
1656
+ 235,
1657
+ 502,
1658
+ 198,
1659
+ 204,
1660
+ 502,
1661
+ 199,
1662
+ 592,
1663
+ 568,
1664
+ 45,
1665
+ 586,
1666
+ 37,
1667
+ 697,
1668
+ 179,
1669
+ 640,
1670
+ 513,
1671
+ 517,
1672
+ 310,
1673
+ 213,
1674
+ 85,
1675
+ 500,
1676
+ 148,
1677
+ 438,
1678
+ 128,
1679
+ 350,
1680
+ 242,
1681
+ 381,
1682
+ 657,
1683
+ 299,
1684
+ 451,
1685
+ 509,
1686
+ 494,
1687
+ 380,
1688
+ 161,
1689
+ 26,
1690
+ 690,
1691
+ 347,
1692
+ 7,
1693
+ 510,
1694
+ 94,
1695
+ 696,
1696
+ 46,
1697
+ 43,
1698
+ 177,
1699
+ 345,
1700
+ 625,
1701
+ 678,
1702
+ 31,
1703
+ 588,
1704
+ 668,
1705
+ 744,
1706
+ 253,
1707
+ 552,
1708
+ 281,
1709
+ 390,
1710
+ 151,
1711
+ 168,
1712
+ 722,
1713
+ 529,
1714
+ 187,
1715
+ 123,
1716
+ 613,
1717
+ 593,
1718
+ 2,
1719
+ 429,
1720
+ 517,
1721
+ 7,
1722
+ 612,
1723
+ 273,
1724
+ 280,
1725
+ 367,
1726
+ 625,
1727
+ 218,
1728
+ 711,
1729
+ 143,
1730
+ 196,
1731
+ 38,
1732
+ 132,
1733
+ 222,
1734
+ 714,
1735
+ 4,
1736
+ 76,
1737
+ 97,
1738
+ 554,
1739
+ 112,
1740
+ 262,
1741
+ 657,
1742
+ 350,
1743
+ 278,
1744
+ 702,
1745
+ 282,
1746
+ 717,
1747
+ 426,
1748
+ 320,
1749
+ 218,
1750
+ 87,
1751
+ 743,
1752
+ 100,
1753
+ 125,
1754
+ 463,
1755
+ 370,
1756
+ 127,
1757
+ 571,
1758
+ 699,
1759
+ 214,
1760
+ 703,
1761
+ 201,
1762
+ 480,
1763
+ 115,
1764
+ 81,
1765
+ 104,
1766
+ 293,
1767
+ 244,
1768
+ 90,
1769
+ 653,
1770
+ 342,
1771
+ 727,
1772
+ 200,
1773
+ 644,
1774
+ 678,
1775
+ 151,
1776
+ 331,
1777
+ 357,
1778
+ 511,
1779
+ 496,
1780
+ 736,
1781
+ 94,
1782
+ 499,
1783
+ 587,
1784
+ 13,
1785
+ 631,
1786
+ 571,
1787
+ 683,
1788
+ 9,
1789
+ 105,
1790
+ 706,
1791
+ 640,
1792
+ 617,
1793
+ 267,
1794
+ 348,
1795
+ 501,
1796
+ 33,
1797
+ 0,
1798
+ 577,
1799
+ 245,
1800
+ 669,
1801
+ 369,
1802
+ 518,
1803
+ 206,
1804
+ 34,
1805
+ 511,
1806
+ 232,
1807
+ 448,
1808
+ 283,
1809
+ 733,
1810
+ 478,
1811
+ 676,
1812
+ 586,
1813
+ 664,
1814
+ 515,
1815
+ 162,
1816
+ 509,
1817
+ 641,
1818
+ 9,
1819
+ 58,
1820
+ 442,
1821
+ 650,
1822
+ 713,
1823
+ 11,
1824
+ 249,
1825
+ 466,
1826
+ 54,
1827
+ 298,
1828
+ 137,
1829
+ 206,
1830
+ 415,
1831
+ 15,
1832
+ 199,
1833
+ 71,
1834
+ 336,
1835
+ 602,
1836
+ 410,
1837
+ 295,
1838
+ 621,
1839
+ 168,
1840
+ 262,
1841
+ 314,
1842
+ 656,
1843
+ 217,
1844
+ 696,
1845
+ 116,
1846
+ 394,
1847
+ 504,
1848
+ 59,
1849
+ 209,
1850
+ 409,
1851
+ 424,
1852
+ 713,
1853
+ 601,
1854
+ 101,
1855
+ 32,
1856
+ 602,
1857
+ 569,
1858
+ 585,
1859
+ 219,
1860
+ 141,
1861
+ 455,
1862
+ 269,
1863
+ 574,
1864
+ 506,
1865
+ 258,
1866
+ 437,
1867
+ 358,
1868
+ 294,
1869
+ 703,
1870
+ 626,
1871
+ 330,
1872
+ 467,
1873
+ 627,
1874
+ 417,
1875
+ 702,
1876
+ 13,
1877
+ 495,
1878
+ 56,
1879
+ 665,
1880
+ 454,
1881
+ 253,
1882
+ 203,
1883
+ 387,
1884
+ 524,
1885
+ 375,
1886
+ 656,
1887
+ 4,
1888
+ 436,
1889
+ 557,
1890
+ 584,
1891
+ 435,
1892
+ 236,
1893
+ 452,
1894
+ 448,
1895
+ 537,
1896
+ 713,
1897
+ 352,
1898
+ 656,
1899
+ 728,
1900
+ 632,
1901
+ 518,
1902
+ 680,
1903
+ 464,
1904
+ 489,
1905
+ 205,
1906
+ 307,
1907
+ 360,
1908
+ 30,
1909
+ 384,
1910
+ 1,
1911
+ 87,
1912
+ 743,
1913
+ 714,
1914
+ 337,
1915
+ 114,
1916
+ 303,
1917
+ 30,
1918
+ 526,
1919
+ 354,
1920
+ 80,
1921
+ 13,
1922
+ 658,
1923
+ 412,
1924
+ 220,
1925
+ 668,
1926
+ 709,
1927
+ 558,
1928
+ 192,
1929
+ 549,
1930
+ 518,
1931
+ 169,
1932
+ 327,
1933
+ 180,
1934
+ 634,
1935
+ 547,
1936
+ 180,
1937
+ 717,
1938
+ 85,
1939
+ 401,
1940
+ 121,
1941
+ 299
1942
+ ],
1943
+ 930884210
1944
+ ],
1945
+ "output": 930884693
1946
+ },
1947
+ {
1948
+ "input": [
1949
+ [
1950
+ 59,
1951
+ 51,
1952
+ 83,
1953
+ 114,
1954
+ 94,
1955
+ 60,
1956
+ 119,
1957
+ 97,
1958
+ 2,
1959
+ 96,
1960
+ 80,
1961
+ 13,
1962
+ 76,
1963
+ 59,
1964
+ 137,
1965
+ 89,
1966
+ 29,
1967
+ 108,
1968
+ 133,
1969
+ 100,
1970
+ 66,
1971
+ 110,
1972
+ 42,
1973
+ 131,
1974
+ 110,
1975
+ 53,
1976
+ 5,
1977
+ 139,
1978
+ 130,
1979
+ 143,
1980
+ 27,
1981
+ 30,
1982
+ 105,
1983
+ 77,
1984
+ 80,
1985
+ 125,
1986
+ 32,
1987
+ 66,
1988
+ 105,
1989
+ 112,
1990
+ 41,
1991
+ 127,
1992
+ 75,
1993
+ 15,
1994
+ 26,
1995
+ 90,
1996
+ 89,
1997
+ 83,
1998
+ 5,
1999
+ 45,
2000
+ 24,
2001
+ 56,
2002
+ 36,
2003
+ 109,
2004
+ 98,
2005
+ 25,
2006
+ 61,
2007
+ 101,
2008
+ 120,
2009
+ 115,
2010
+ 12,
2011
+ 76,
2012
+ 121,
2013
+ 26,
2014
+ 25,
2015
+ 131,
2016
+ 110,
2017
+ 35,
2018
+ 21,
2019
+ 22,
2020
+ 44,
2021
+ 97,
2022
+ 25,
2023
+ 120,
2024
+ 104,
2025
+ 101,
2026
+ 82,
2027
+ 36,
2028
+ 70,
2029
+ 84,
2030
+ 43,
2031
+ 41,
2032
+ 22,
2033
+ 53,
2034
+ 19,
2035
+ 47,
2036
+ 95,
2037
+ 53,
2038
+ 123,
2039
+ 9,
2040
+ 114,
2041
+ 119,
2042
+ 91,
2043
+ 122,
2044
+ 80,
2045
+ 80,
2046
+ 60,
2047
+ 99,
2048
+ 142,
2049
+ 145,
2050
+ 123,
2051
+ 124,
2052
+ 137,
2053
+ 124,
2054
+ 61,
2055
+ 30,
2056
+ 59,
2057
+ 133,
2058
+ 59,
2059
+ 29,
2060
+ 39,
2061
+ 127,
2062
+ 22,
2063
+ 2,
2064
+ 107,
2065
+ 31,
2066
+ 76,
2067
+ 3,
2068
+ 64,
2069
+ 106,
2070
+ 83,
2071
+ 38,
2072
+ 28,
2073
+ 32,
2074
+ 124,
2075
+ 78,
2076
+ 37,
2077
+ 40,
2078
+ 110,
2079
+ 99,
2080
+ 65,
2081
+ 21,
2082
+ 93,
2083
+ 121,
2084
+ 50,
2085
+ 16,
2086
+ 32,
2087
+ 23,
2088
+ 12,
2089
+ 131,
2090
+ 40,
2091
+ 60,
2092
+ 34,
2093
+ 36,
2094
+ 129,
2095
+ 67
2096
+ ],
2097
+ 495868694
2098
+ ],
2099
+ "output": 495868784
2100
+ },
2101
+ {
2102
+ "input": [
2103
+ [
2104
+ 203,
2105
+ 1,
2106
+ 252,
2107
+ 243,
2108
+ 29,
2109
+ 258,
2110
+ 14,
2111
+ 190,
2112
+ 83,
2113
+ 215,
2114
+ 8,
2115
+ 77,
2116
+ 215,
2117
+ 131,
2118
+ 168,
2119
+ 72,
2120
+ 4,
2121
+ 251,
2122
+ 147,
2123
+ 150,
2124
+ 79,
2125
+ 244,
2126
+ 125,
2127
+ 182,
2128
+ 141,
2129
+ 104,
2130
+ 147,
2131
+ 202,
2132
+ 62,
2133
+ 105,
2134
+ 95,
2135
+ 204,
2136
+ 16,
2137
+ 183,
2138
+ 165,
2139
+ 145,
2140
+ 208,
2141
+ 88,
2142
+ 90,
2143
+ 95,
2144
+ 11,
2145
+ 83,
2146
+ 228,
2147
+ 124,
2148
+ 136,
2149
+ 10,
2150
+ 49,
2151
+ 132,
2152
+ 100,
2153
+ 34,
2154
+ 75,
2155
+ 89,
2156
+ 111,
2157
+ 258,
2158
+ 95,
2159
+ 12,
2160
+ 12,
2161
+ 220,
2162
+ 59,
2163
+ 126,
2164
+ 26,
2165
+ 226,
2166
+ 110,
2167
+ 145,
2168
+ 251,
2169
+ 125,
2170
+ 53,
2171
+ 60,
2172
+ 9,
2173
+ 197,
2174
+ 224,
2175
+ 243,
2176
+ 260,
2177
+ 68,
2178
+ 117,
2179
+ 84,
2180
+ 162,
2181
+ 227,
2182
+ 130,
2183
+ 118,
2184
+ 245,
2185
+ 204,
2186
+ 139,
2187
+ 247,
2188
+ 195,
2189
+ 218,
2190
+ 194,
2191
+ 17,
2192
+ 144,
2193
+ 262,
2194
+ 152,
2195
+ 51,
2196
+ 254,
2197
+ 16,
2198
+ 204,
2199
+ 99,
2200
+ 32,
2201
+ 156,
2202
+ 67,
2203
+ 47,
2204
+ 47,
2205
+ 10,
2206
+ 216,
2207
+ 252,
2208
+ 34,
2209
+ 207,
2210
+ 202,
2211
+ 206,
2212
+ 44,
2213
+ 230,
2214
+ 37,
2215
+ 170,
2216
+ 50,
2217
+ 7,
2218
+ 130,
2219
+ 59,
2220
+ 241,
2221
+ 159,
2222
+ 68,
2223
+ 210,
2224
+ 148,
2225
+ 163,
2226
+ 245,
2227
+ 260,
2228
+ 159,
2229
+ 152,
2230
+ 51,
2231
+ 11,
2232
+ 21,
2233
+ 263,
2234
+ 155,
2235
+ 150,
2236
+ 189,
2237
+ 223,
2238
+ 142,
2239
+ 140,
2240
+ 131,
2241
+ 205,
2242
+ 74,
2243
+ 66,
2244
+ 138,
2245
+ 0,
2246
+ 172,
2247
+ 96,
2248
+ 140,
2249
+ 118,
2250
+ 89,
2251
+ 222,
2252
+ 218,
2253
+ 22,
2254
+ 174,
2255
+ 43,
2256
+ 80,
2257
+ 169,
2258
+ 88,
2259
+ 206,
2260
+ 92,
2261
+ 180,
2262
+ 252,
2263
+ 202,
2264
+ 65,
2265
+ 86,
2266
+ 130,
2267
+ 69,
2268
+ 122,
2269
+ 116,
2270
+ 214,
2271
+ 116,
2272
+ 225,
2273
+ 118,
2274
+ 188,
2275
+ 223,
2276
+ 122,
2277
+ 118,
2278
+ 113,
2279
+ 224,
2280
+ 98,
2281
+ 193,
2282
+ 39,
2283
+ 254,
2284
+ 80,
2285
+ 161,
2286
+ 204,
2287
+ 93,
2288
+ 182,
2289
+ 206,
2290
+ 84,
2291
+ 234,
2292
+ 177,
2293
+ 47,
2294
+ 74,
2295
+ 54,
2296
+ 182,
2297
+ 57,
2298
+ 146,
2299
+ 64,
2300
+ 137,
2301
+ 14,
2302
+ 161,
2303
+ 214,
2304
+ 194,
2305
+ 93,
2306
+ 106,
2307
+ 171,
2308
+ 260,
2309
+ 51,
2310
+ 114,
2311
+ 202,
2312
+ 219,
2313
+ 122,
2314
+ 149,
2315
+ 208,
2316
+ 161,
2317
+ 219,
2318
+ 36,
2319
+ 3,
2320
+ 215,
2321
+ 66,
2322
+ 114,
2323
+ 26,
2324
+ 177,
2325
+ 244,
2326
+ 65,
2327
+ 55,
2328
+ 211,
2329
+ 56,
2330
+ 50,
2331
+ 28,
2332
+ 169,
2333
+ 31,
2334
+ 39,
2335
+ 36,
2336
+ 192,
2337
+ 260,
2338
+ 148,
2339
+ 172,
2340
+ 221,
2341
+ 200,
2342
+ 84,
2343
+ 6,
2344
+ 246,
2345
+ 11,
2346
+ 75,
2347
+ 144,
2348
+ 38,
2349
+ 14,
2350
+ 49,
2351
+ 236,
2352
+ 90,
2353
+ 9,
2354
+ 74,
2355
+ 158,
2356
+ 236,
2357
+ 111,
2358
+ 159,
2359
+ 250,
2360
+ 204,
2361
+ 250,
2362
+ 94,
2363
+ 65,
2364
+ 230,
2365
+ 81,
2366
+ 41,
2367
+ 39
2368
+ ],
2369
+ 207184027
2370
+ ],
2371
+ "output": 207184195
2372
+ },
2373
+ {
2374
+ "input": [
2375
+ [
2376
+ 340,
2377
+ 77,
2378
+ 284,
2379
+ 344,
2380
+ 349,
2381
+ 100,
2382
+ 397,
2383
+ 234,
2384
+ 284,
2385
+ 331,
2386
+ 29,
2387
+ 59,
2388
+ 416,
2389
+ 87,
2390
+ 354,
2391
+ 250,
2392
+ 125,
2393
+ 176,
2394
+ 345,
2395
+ 286,
2396
+ 188,
2397
+ 118,
2398
+ 380,
2399
+ 324,
2400
+ 308,
2401
+ 383,
2402
+ 118,
2403
+ 210,
2404
+ 145,
2405
+ 35,
2406
+ 141,
2407
+ 233,
2408
+ 196,
2409
+ 298,
2410
+ 153,
2411
+ 221,
2412
+ 208,
2413
+ 18,
2414
+ 75,
2415
+ 142,
2416
+ 403,
2417
+ 104,
2418
+ 252,
2419
+ 248,
2420
+ 413,
2421
+ 12,
2422
+ 200,
2423
+ 167,
2424
+ 346,
2425
+ 57,
2426
+ 19,
2427
+ 392,
2428
+ 7,
2429
+ 279,
2430
+ 278,
2431
+ 331,
2432
+ 285,
2433
+ 129,
2434
+ 295,
2435
+ 300,
2436
+ 19,
2437
+ 418,
2438
+ 338,
2439
+ 370,
2440
+ 7,
2441
+ 56,
2442
+ 271,
2443
+ 116,
2444
+ 321,
2445
+ 165,
2446
+ 45,
2447
+ 413,
2448
+ 21,
2449
+ 60,
2450
+ 161,
2451
+ 271,
2452
+ 204,
2453
+ 288,
2454
+ 372,
2455
+ 67,
2456
+ 366,
2457
+ 278,
2458
+ 224,
2459
+ 205,
2460
+ 144,
2461
+ 103,
2462
+ 241,
2463
+ 27,
2464
+ 182,
2465
+ 406,
2466
+ 325,
2467
+ 238,
2468
+ 49,
2469
+ 292,
2470
+ 385,
2471
+ 57,
2472
+ 297,
2473
+ 364,
2474
+ 135,
2475
+ 173,
2476
+ 345,
2477
+ 318,
2478
+ 58,
2479
+ 29,
2480
+ 416,
2481
+ 248,
2482
+ 291,
2483
+ 333,
2484
+ 274,
2485
+ 68,
2486
+ 104,
2487
+ 89,
2488
+ 250,
2489
+ 173,
2490
+ 32,
2491
+ 323,
2492
+ 190,
2493
+ 209,
2494
+ 104,
2495
+ 81,
2496
+ 250,
2497
+ 207,
2498
+ 149,
2499
+ 60,
2500
+ 170,
2501
+ 303,
2502
+ 73,
2503
+ 215,
2504
+ 345,
2505
+ 390,
2506
+ 255,
2507
+ 233,
2508
+ 331,
2509
+ 274,
2510
+ 12,
2511
+ 172,
2512
+ 235,
2513
+ 105,
2514
+ 349,
2515
+ 294,
2516
+ 163,
2517
+ 353,
2518
+ 36,
2519
+ 227,
2520
+ 239,
2521
+ 9,
2522
+ 375,
2523
+ 118,
2524
+ 40,
2525
+ 231,
2526
+ 41,
2527
+ 406,
2528
+ 211,
2529
+ 79,
2530
+ 122,
2531
+ 105,
2532
+ 341,
2533
+ 160,
2534
+ 403,
2535
+ 162,
2536
+ 253,
2537
+ 60,
2538
+ 339,
2539
+ 22,
2540
+ 137,
2541
+ 173,
2542
+ 161,
2543
+ 21,
2544
+ 95,
2545
+ 179,
2546
+ 160,
2547
+ 62,
2548
+ 337,
2549
+ 396,
2550
+ 410,
2551
+ 325,
2552
+ 387,
2553
+ 237,
2554
+ 290,
2555
+ 31,
2556
+ 258,
2557
+ 303,
2558
+ 397,
2559
+ 239,
2560
+ 351,
2561
+ 37,
2562
+ 218,
2563
+ 60,
2564
+ 201,
2565
+ 60,
2566
+ 125,
2567
+ 330,
2568
+ 175,
2569
+ 70,
2570
+ 195,
2571
+ 297,
2572
+ 385,
2573
+ 333,
2574
+ 326,
2575
+ 157,
2576
+ 236,
2577
+ 176,
2578
+ 242,
2579
+ 222,
2580
+ 181,
2581
+ 262,
2582
+ 113,
2583
+ 404,
2584
+ 75,
2585
+ 156,
2586
+ 131,
2587
+ 406,
2588
+ 273,
2589
+ 48,
2590
+ 134,
2591
+ 6,
2592
+ 240,
2593
+ 299,
2594
+ 307,
2595
+ 52,
2596
+ 151,
2597
+ 33,
2598
+ 277,
2599
+ 344,
2600
+ 2,
2601
+ 114,
2602
+ 185,
2603
+ 266,
2604
+ 39,
2605
+ 26,
2606
+ 351,
2607
+ 77,
2608
+ 9,
2609
+ 388,
2610
+ 7,
2611
+ 183,
2612
+ 77,
2613
+ 390,
2614
+ 126,
2615
+ 145,
2616
+ 16,
2617
+ 195,
2618
+ 47,
2619
+ 116,
2620
+ 34,
2621
+ 96,
2622
+ 211,
2623
+ 376,
2624
+ 159,
2625
+ 222,
2626
+ 13,
2627
+ 242,
2628
+ 174,
2629
+ 376,
2630
+ 154,
2631
+ 255,
2632
+ 2,
2633
+ 288,
2634
+ 195,
2635
+ 355,
2636
+ 47,
2637
+ 190,
2638
+ 161,
2639
+ 3,
2640
+ 198,
2641
+ 330,
2642
+ 217,
2643
+ 46,
2644
+ 403,
2645
+ 362,
2646
+ 8,
2647
+ 77,
2648
+ 389,
2649
+ 344,
2650
+ 208,
2651
+ 293,
2652
+ 299,
2653
+ 191,
2654
+ 12,
2655
+ 183,
2656
+ 406,
2657
+ 356,
2658
+ 311,
2659
+ 33,
2660
+ 223,
2661
+ 378,
2662
+ 153,
2663
+ 271,
2664
+ 302,
2665
+ 131,
2666
+ 209,
2667
+ 99,
2668
+ 205,
2669
+ 163,
2670
+ 59,
2671
+ 84,
2672
+ 288,
2673
+ 402,
2674
+ 118,
2675
+ 286,
2676
+ 362,
2677
+ 216,
2678
+ 418,
2679
+ 344,
2680
+ 253,
2681
+ 111,
2682
+ 184,
2683
+ 128,
2684
+ 149,
2685
+ 191,
2686
+ 184,
2687
+ 47,
2688
+ 14,
2689
+ 176,
2690
+ 202,
2691
+ 331,
2692
+ 97,
2693
+ 11,
2694
+ 307,
2695
+ 324,
2696
+ 120,
2697
+ 219,
2698
+ 200,
2699
+ 103,
2700
+ 207,
2701
+ 215,
2702
+ 388,
2703
+ 10,
2704
+ 391,
2705
+ 142,
2706
+ 254,
2707
+ 383,
2708
+ 28,
2709
+ 213,
2710
+ 212,
2711
+ 63,
2712
+ 395,
2713
+ 96,
2714
+ 285,
2715
+ 182,
2716
+ 239,
2717
+ 196,
2718
+ 338,
2719
+ 259,
2720
+ 208,
2721
+ 407,
2722
+ 169,
2723
+ 107,
2724
+ 224,
2725
+ 39,
2726
+ 282,
2727
+ 22,
2728
+ 123,
2729
+ 181,
2730
+ 248,
2731
+ 384,
2732
+ 184,
2733
+ 63,
2734
+ 369,
2735
+ 138,
2736
+ 152,
2737
+ 180,
2738
+ 304,
2739
+ 418,
2740
+ 388,
2741
+ 418,
2742
+ 108,
2743
+ 73,
2744
+ 175,
2745
+ 114,
2746
+ 409,
2747
+ 175,
2748
+ 83,
2749
+ 364,
2750
+ 8,
2751
+ 39,
2752
+ 127,
2753
+ 391,
2754
+ 217,
2755
+ 282,
2756
+ 364,
2757
+ 73,
2758
+ 231,
2759
+ 105,
2760
+ 55,
2761
+ 303,
2762
+ 107,
2763
+ 387,
2764
+ 207,
2765
+ 127,
2766
+ 37,
2767
+ 344,
2768
+ 94,
2769
+ 269,
2770
+ 157,
2771
+ 252,
2772
+ 151,
2773
+ 318,
2774
+ 203,
2775
+ 153,
2776
+ 254,
2777
+ 123,
2778
+ 349,
2779
+ 235,
2780
+ 164,
2781
+ 329,
2782
+ 268,
2783
+ 355,
2784
+ 61,
2785
+ 233,
2786
+ 247,
2787
+ 86,
2788
+ 39,
2789
+ 125,
2790
+ 371,
2791
+ 415,
2792
+ 143,
2793
+ 350,
2794
+ 402,
2795
+ 59
2796
+ ],
2797
+ 939948695
2798
+ ],
2799
+ "output": 939948968
2800
+ },
2801
+ {
2802
+ "input": [
2803
+ [
2804
+ 176,
2805
+ 100,
2806
+ 95,
2807
+ 166,
2808
+ 175,
2809
+ 33,
2810
+ 180,
2811
+ 239,
2812
+ 7,
2813
+ 174,
2814
+ 192,
2815
+ 52,
2816
+ 235,
2817
+ 155,
2818
+ 27,
2819
+ 144,
2820
+ 202,
2821
+ 245,
2822
+ 198,
2823
+ 39,
2824
+ 44,
2825
+ 221,
2826
+ 134,
2827
+ 191,
2828
+ 226,
2829
+ 83,
2830
+ 42,
2831
+ 246,
2832
+ 137,
2833
+ 23,
2834
+ 188,
2835
+ 89,
2836
+ 185,
2837
+ 147,
2838
+ 16,
2839
+ 53,
2840
+ 12,
2841
+ 71,
2842
+ 187,
2843
+ 48,
2844
+ 202,
2845
+ 135,
2846
+ 125,
2847
+ 18,
2848
+ 122,
2849
+ 69,
2850
+ 214,
2851
+ 203,
2852
+ 162,
2853
+ 245,
2854
+ 155,
2855
+ 142,
2856
+ 92,
2857
+ 98,
2858
+ 69,
2859
+ 101,
2860
+ 31,
2861
+ 141,
2862
+ 57,
2863
+ 196,
2864
+ 20,
2865
+ 228,
2866
+ 67,
2867
+ 44,
2868
+ 9,
2869
+ 51,
2870
+ 8,
2871
+ 136,
2872
+ 161,
2873
+ 219,
2874
+ 215,
2875
+ 229,
2876
+ 115,
2877
+ 24,
2878
+ 204,
2879
+ 49,
2880
+ 227,
2881
+ 184,
2882
+ 231,
2883
+ 148,
2884
+ 79,
2885
+ 91,
2886
+ 176,
2887
+ 2,
2888
+ 59,
2889
+ 224,
2890
+ 79,
2891
+ 236,
2892
+ 4,
2893
+ 191,
2894
+ 208,
2895
+ 129,
2896
+ 137,
2897
+ 100,
2898
+ 219,
2899
+ 117,
2900
+ 187,
2901
+ 213,
2902
+ 203,
2903
+ 119,
2904
+ 147,
2905
+ 149,
2906
+ 20,
2907
+ 71,
2908
+ 46,
2909
+ 6,
2910
+ 121,
2911
+ 71,
2912
+ 205,
2913
+ 178,
2914
+ 172,
2915
+ 208,
2916
+ 220,
2917
+ 101,
2918
+ 103,
2919
+ 168,
2920
+ 18,
2921
+ 79,
2922
+ 155,
2923
+ 68,
2924
+ 208,
2925
+ 4,
2926
+ 171,
2927
+ 41,
2928
+ 17,
2929
+ 157,
2930
+ 68,
2931
+ 145,
2932
+ 213,
2933
+ 222,
2934
+ 6,
2935
+ 1,
2936
+ 85,
2937
+ 173,
2938
+ 31,
2939
+ 190,
2940
+ 68,
2941
+ 131,
2942
+ 99,
2943
+ 191,
2944
+ 64,
2945
+ 178,
2946
+ 78,
2947
+ 168,
2948
+ 23,
2949
+ 29,
2950
+ 157,
2951
+ 187,
2952
+ 57,
2953
+ 157,
2954
+ 182,
2955
+ 31,
2956
+ 190,
2957
+ 196,
2958
+ 140,
2959
+ 50,
2960
+ 114,
2961
+ 74,
2962
+ 204,
2963
+ 38,
2964
+ 147,
2965
+ 86,
2966
+ 124,
2967
+ 220,
2968
+ 98,
2969
+ 74,
2970
+ 66,
2971
+ 135,
2972
+ 23,
2973
+ 134,
2974
+ 120,
2975
+ 104,
2976
+ 90,
2977
+ 103,
2978
+ 152,
2979
+ 140,
2980
+ 26,
2981
+ 98,
2982
+ 221,
2983
+ 234,
2984
+ 82,
2985
+ 27,
2986
+ 100,
2987
+ 23,
2988
+ 196,
2989
+ 231,
2990
+ 160,
2991
+ 126,
2992
+ 112,
2993
+ 84,
2994
+ 17,
2995
+ 229,
2996
+ 26,
2997
+ 20,
2998
+ 126,
2999
+ 166,
3000
+ 53,
3001
+ 81,
3002
+ 186,
3003
+ 177,
3004
+ 132,
3005
+ 14,
3006
+ 72,
3007
+ 154,
3008
+ 72,
3009
+ 19,
3010
+ 137,
3011
+ 48,
3012
+ 6,
3013
+ 112,
3014
+ 190,
3015
+ 21,
3016
+ 155,
3017
+ 182,
3018
+ 127,
3019
+ 188,
3020
+ 107,
3021
+ 216,
3022
+ 41,
3023
+ 21,
3024
+ 100,
3025
+ 35,
3026
+ 144,
3027
+ 51,
3028
+ 119,
3029
+ 161,
3030
+ 218,
3031
+ 191,
3032
+ 95,
3033
+ 203,
3034
+ 34,
3035
+ 79,
3036
+ 32,
3037
+ 175,
3038
+ 171,
3039
+ 193,
3040
+ 114,
3041
+ 99,
3042
+ 97,
3043
+ 209,
3044
+ 123,
3045
+ 109,
3046
+ 236,
3047
+ 87,
3048
+ 181,
3049
+ 133,
3050
+ 230,
3051
+ 229,
3052
+ 107
3053
+ ],
3054
+ 268850864
3055
+ ],
3056
+ "output": 268851021
3057
+ },
3058
+ {
3059
+ "input": [
3060
+ [
3061
+ 114,
3062
+ 121,
3063
+ 14,
3064
+ 24,
3065
+ 40,
3066
+ 6,
3067
+ 46,
3068
+ 83,
3069
+ 42,
3070
+ 118,
3071
+ 107,
3072
+ 72,
3073
+ 101,
3074
+ 48,
3075
+ 48,
3076
+ 31,
3077
+ 50,
3078
+ 47,
3079
+ 93,
3080
+ 66,
3081
+ 86,
3082
+ 62,
3083
+ 119,
3084
+ 13,
3085
+ 25,
3086
+ 94,
3087
+ 8,
3088
+ 101,
3089
+ 15,
3090
+ 69,
3091
+ 95,
3092
+ 96,
3093
+ 103,
3094
+ 126,
3095
+ 27,
3096
+ 16,
3097
+ 30,
3098
+ 60,
3099
+ 5,
3100
+ 69,
3101
+ 53,
3102
+ 123,
3103
+ 114,
3104
+ 45,
3105
+ 92,
3106
+ 8,
3107
+ 4,
3108
+ 38,
3109
+ 63,
3110
+ 98,
3111
+ 96,
3112
+ 48,
3113
+ 69,
3114
+ 100,
3115
+ 34,
3116
+ 17,
3117
+ 8,
3118
+ 61,
3119
+ 17,
3120
+ 62,
3121
+ 17,
3122
+ 19,
3123
+ 3,
3124
+ 48,
3125
+ 61,
3126
+ 28,
3127
+ 99,
3128
+ 32,
3129
+ 42,
3130
+ 73,
3131
+ 60,
3132
+ 48,
3133
+ 104,
3134
+ 70,
3135
+ 124,
3136
+ 62,
3137
+ 7,
3138
+ 73,
3139
+ 68,
3140
+ 16,
3141
+ 88,
3142
+ 54,
3143
+ 113,
3144
+ 79,
3145
+ 74,
3146
+ 100,
3147
+ 88,
3148
+ 54,
3149
+ 5,
3150
+ 112,
3151
+ 14,
3152
+ 47,
3153
+ 103,
3154
+ 103,
3155
+ 3,
3156
+ 2,
3157
+ 108,
3158
+ 60,
3159
+ 59,
3160
+ 126,
3161
+ 4,
3162
+ 24,
3163
+ 41,
3164
+ 75,
3165
+ 66,
3166
+ 58,
3167
+ 52,
3168
+ 74,
3169
+ 78,
3170
+ 81,
3171
+ 8,
3172
+ 120,
3173
+ 6,
3174
+ 46,
3175
+ 90,
3176
+ 12,
3177
+ 84,
3178
+ 70,
3179
+ 108,
3180
+ 1,
3181
+ 123,
3182
+ 121,
3183
+ 26,
3184
+ 34,
3185
+ 124,
3186
+ 79,
3187
+ 87
3188
+ ],
3189
+ 334897499
3190
+ ],
3191
+ "output": 334897579
3192
+ },
3193
+ {
3194
+ "input": [
3195
+ [
3196
+ 214,
3197
+ 24,
3198
+ 8,
3199
+ 165,
3200
+ 469,
3201
+ 295,
3202
+ 238,
3203
+ 174,
3204
+ 305,
3205
+ 327,
3206
+ 377,
3207
+ 77,
3208
+ 320,
3209
+ 309,
3210
+ 441,
3211
+ 180,
3212
+ 425,
3213
+ 222,
3214
+ 379,
3215
+ 489,
3216
+ 137,
3217
+ 397,
3218
+ 90,
3219
+ 373,
3220
+ 398,
3221
+ 16,
3222
+ 285,
3223
+ 440,
3224
+ 262,
3225
+ 45,
3226
+ 469,
3227
+ 367,
3228
+ 102,
3229
+ 397,
3230
+ 200,
3231
+ 199,
3232
+ 304,
3233
+ 239,
3234
+ 458,
3235
+ 17,
3236
+ 155,
3237
+ 207,
3238
+ 154,
3239
+ 435,
3240
+ 300,
3241
+ 169,
3242
+ 0,
3243
+ 220,
3244
+ 288,
3245
+ 1,
3246
+ 439,
3247
+ 424,
3248
+ 252,
3249
+ 216,
3250
+ 345,
3251
+ 387,
3252
+ 30,
3253
+ 315,
3254
+ 368,
3255
+ 484,
3256
+ 258,
3257
+ 492,
3258
+ 435,
3259
+ 282,
3260
+ 45,
3261
+ 488,
3262
+ 447,
3263
+ 464,
3264
+ 202,
3265
+ 47,
3266
+ 39,
3267
+ 122,
3268
+ 132,
3269
+ 210,
3270
+ 286,
3271
+ 161,
3272
+ 75,
3273
+ 310,
3274
+ 341,
3275
+ 275,
3276
+ 376,
3277
+ 326,
3278
+ 37,
3279
+ 436,
3280
+ 42,
3281
+ 137,
3282
+ 86,
3283
+ 32,
3284
+ 99,
3285
+ 471,
3286
+ 409,
3287
+ 461,
3288
+ 459,
3289
+ 488,
3290
+ 243,
3291
+ 209,
3292
+ 456,
3293
+ 225,
3294
+ 188,
3295
+ 295,
3296
+ 16,
3297
+ 102,
3298
+ 333,
3299
+ 275,
3300
+ 7,
3301
+ 290,
3302
+ 58,
3303
+ 254,
3304
+ 372,
3305
+ 467,
3306
+ 221,
3307
+ 473,
3308
+ 118,
3309
+ 61,
3310
+ 173,
3311
+ 338,
3312
+ 177,
3313
+ 306,
3314
+ 170,
3315
+ 199,
3316
+ 157,
3317
+ 210,
3318
+ 456,
3319
+ 308,
3320
+ 27,
3321
+ 26,
3322
+ 249,
3323
+ 284,
3324
+ 159,
3325
+ 317,
3326
+ 432,
3327
+ 10,
3328
+ 18,
3329
+ 284,
3330
+ 60,
3331
+ 232,
3332
+ 266,
3333
+ 333,
3334
+ 412,
3335
+ 108,
3336
+ 143,
3337
+ 311,
3338
+ 310,
3339
+ 223,
3340
+ 201,
3341
+ 132,
3342
+ 339,
3343
+ 100,
3344
+ 149,
3345
+ 158,
3346
+ 333,
3347
+ 235,
3348
+ 336,
3349
+ 317,
3350
+ 69,
3351
+ 30,
3352
+ 457,
3353
+ 137,
3354
+ 333,
3355
+ 420,
3356
+ 370,
3357
+ 417,
3358
+ 340,
3359
+ 83,
3360
+ 112,
3361
+ 450,
3362
+ 246,
3363
+ 382,
3364
+ 262,
3365
+ 237,
3366
+ 148,
3367
+ 447,
3368
+ 180,
3369
+ 201,
3370
+ 86,
3371
+ 46,
3372
+ 307,
3373
+ 115,
3374
+ 193,
3375
+ 383,
3376
+ 424,
3377
+ 84,
3378
+ 414,
3379
+ 392,
3380
+ 355,
3381
+ 367,
3382
+ 271,
3383
+ 322,
3384
+ 14,
3385
+ 22,
3386
+ 151,
3387
+ 251,
3388
+ 188,
3389
+ 121,
3390
+ 356,
3391
+ 18,
3392
+ 344,
3393
+ 35,
3394
+ 230,
3395
+ 397,
3396
+ 108,
3397
+ 252,
3398
+ 226,
3399
+ 63,
3400
+ 269,
3401
+ 333,
3402
+ 83,
3403
+ 158,
3404
+ 1,
3405
+ 27,
3406
+ 400,
3407
+ 325,
3408
+ 224,
3409
+ 449,
3410
+ 125,
3411
+ 331,
3412
+ 49,
3413
+ 373,
3414
+ 13,
3415
+ 482,
3416
+ 194,
3417
+ 470,
3418
+ 260,
3419
+ 223,
3420
+ 109,
3421
+ 282,
3422
+ 472,
3423
+ 426,
3424
+ 169,
3425
+ 130,
3426
+ 479,
3427
+ 407,
3428
+ 477,
3429
+ 241,
3430
+ 342,
3431
+ 390,
3432
+ 134,
3433
+ 339,
3434
+ 107,
3435
+ 334,
3436
+ 327,
3437
+ 75,
3438
+ 109,
3439
+ 184,
3440
+ 216,
3441
+ 192,
3442
+ 147,
3443
+ 441,
3444
+ 158,
3445
+ 173,
3446
+ 307,
3447
+ 255,
3448
+ 115,
3449
+ 316,
3450
+ 51,
3451
+ 253,
3452
+ 58,
3453
+ 71,
3454
+ 354,
3455
+ 450,
3456
+ 146,
3457
+ 354,
3458
+ 223,
3459
+ 252,
3460
+ 119,
3461
+ 272,
3462
+ 418,
3463
+ 323,
3464
+ 483,
3465
+ 272,
3466
+ 291,
3467
+ 8,
3468
+ 437,
3469
+ 16,
3470
+ 481,
3471
+ 412,
3472
+ 208,
3473
+ 365,
3474
+ 237,
3475
+ 435,
3476
+ 363,
3477
+ 424,
3478
+ 420,
3479
+ 259,
3480
+ 132,
3481
+ 364,
3482
+ 164,
3483
+ 424,
3484
+ 347,
3485
+ 450,
3486
+ 13,
3487
+ 98,
3488
+ 396,
3489
+ 7,
3490
+ 194,
3491
+ 180,
3492
+ 143,
3493
+ 218,
3494
+ 31,
3495
+ 168,
3496
+ 344,
3497
+ 210,
3498
+ 38,
3499
+ 184,
3500
+ 353,
3501
+ 399,
3502
+ 366,
3503
+ 410,
3504
+ 210,
3505
+ 430,
3506
+ 86,
3507
+ 244,
3508
+ 408,
3509
+ 52,
3510
+ 82,
3511
+ 415,
3512
+ 162,
3513
+ 421,
3514
+ 108,
3515
+ 261,
3516
+ 38,
3517
+ 467,
3518
+ 323,
3519
+ 78,
3520
+ 96,
3521
+ 141,
3522
+ 159,
3523
+ 237,
3524
+ 106,
3525
+ 488,
3526
+ 250,
3527
+ 204,
3528
+ 242,
3529
+ 394,
3530
+ 309,
3531
+ 264,
3532
+ 267,
3533
+ 148,
3534
+ 285,
3535
+ 183,
3536
+ 467,
3537
+ 204,
3538
+ 449,
3539
+ 368,
3540
+ 435,
3541
+ 138,
3542
+ 222,
3543
+ 477,
3544
+ 289,
3545
+ 403,
3546
+ 79,
3547
+ 163,
3548
+ 453,
3549
+ 283,
3550
+ 301,
3551
+ 112,
3552
+ 294,
3553
+ 476,
3554
+ 197,
3555
+ 149,
3556
+ 210,
3557
+ 411,
3558
+ 365,
3559
+ 2,
3560
+ 152,
3561
+ 15,
3562
+ 251,
3563
+ 460,
3564
+ 328,
3565
+ 202,
3566
+ 254,
3567
+ 168,
3568
+ 474,
3569
+ 221,
3570
+ 280,
3571
+ 42,
3572
+ 106,
3573
+ 207,
3574
+ 82,
3575
+ 167,
3576
+ 118,
3577
+ 146,
3578
+ 91,
3579
+ 223,
3580
+ 207,
3581
+ 114,
3582
+ 62,
3583
+ 428,
3584
+ 466,
3585
+ 214,
3586
+ 250,
3587
+ 138,
3588
+ 301,
3589
+ 206,
3590
+ 250,
3591
+ 7,
3592
+ 385,
3593
+ 170,
3594
+ 399,
3595
+ 47,
3596
+ 193,
3597
+ 165,
3598
+ 5,
3599
+ 45,
3600
+ 193,
3601
+ 90,
3602
+ 218,
3603
+ 300,
3604
+ 21,
3605
+ 339,
3606
+ 191,
3607
+ 251,
3608
+ 428,
3609
+ 148,
3610
+ 164,
3611
+ 4,
3612
+ 350,
3613
+ 176,
3614
+ 153,
3615
+ 151,
3616
+ 455,
3617
+ 449,
3618
+ 96,
3619
+ 350,
3620
+ 372,
3621
+ 209,
3622
+ 302,
3623
+ 271,
3624
+ 125,
3625
+ 24,
3626
+ 92,
3627
+ 35,
3628
+ 486,
3629
+ 90,
3630
+ 237,
3631
+ 179,
3632
+ 351,
3633
+ 454,
3634
+ 306,
3635
+ 404,
3636
+ 310,
3637
+ 322,
3638
+ 415,
3639
+ 327,
3640
+ 462,
3641
+ 344,
3642
+ 491,
3643
+ 71,
3644
+ 51,
3645
+ 155,
3646
+ 249,
3647
+ 378,
3648
+ 25,
3649
+ 47,
3650
+ 293,
3651
+ 92,
3652
+ 459,
3653
+ 125,
3654
+ 169,
3655
+ 145,
3656
+ 434,
3657
+ 161,
3658
+ 165,
3659
+ 74,
3660
+ 21,
3661
+ 201,
3662
+ 113,
3663
+ 160,
3664
+ 259,
3665
+ 196,
3666
+ 418,
3667
+ 153,
3668
+ 89,
3669
+ 394,
3670
+ 217,
3671
+ 412,
3672
+ 487,
3673
+ 447,
3674
+ 261,
3675
+ 486,
3676
+ 383,
3677
+ 77,
3678
+ 187,
3679
+ 310,
3680
+ 474,
3681
+ 50,
3682
+ 112,
3683
+ 387,
3684
+ 259,
3685
+ 26,
3686
+ 116,
3687
+ 222,
3688
+ 373
3689
+ ],
3690
+ 247598608
3691
+ ],
3692
+ "output": 247598923
3693
+ },
3694
+ {
3695
+ "input": [
3696
+ [
3697
+ 14,
3698
+ 4,
3699
+ 8,
3700
+ 3,
3701
+ 8,
3702
+ 8,
3703
+ 10,
3704
+ 16,
3705
+ 14,
3706
+ 4,
3707
+ 3,
3708
+ 16,
3709
+ 1,
3710
+ 2,
3711
+ 15,
3712
+ 14,
3713
+ 10,
3714
+ 7,
3715
+ 5,
3716
+ 14
3717
+ ],
3718
+ 350801952
3719
+ ],
3720
+ "output": 350801967
3721
+ }
3722
+ ],
3723
+ "haskell_template": "minCost :: [Int] -> Int -> Int\nminCost nums k ",
3724
+ "ocaml_template": "let minCost (nums: int list) (k: int) : int = ",
3725
+ "scala_template": "def minCost(nums: List[Int],k: Int): Int = { \n \n}",
3726
+ "java_template": "class Solution {\n public int minCost(int[] nums, int k) {\n \n }\n}",
3727
+ "python_template": "class Solution(object):\n def minCost(self, nums, k):\n \"\"\"\n :type nums: List[int]\n :type k: int\n :rtype: int\n \"\"\"\n "
3728
+ }