DatasetRepo commited on
Commit
901adde
·
verified ·
1 Parent(s): b677a2e

3c84d0a839e6f58af193dbfafea5976ec5d5c2435f97ab08e3aa3eb4d3ff0398

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. minimize_the_total_price_of_the_trips/.DS_Store +0 -0
  3. minimize_the_total_price_of_the_trips/haskell_tests/Main.hs +24 -0
  4. minimize_the_total_price_of_the_trips/java_tests/Main.java +21 -0
  5. minimize_the_total_price_of_the_trips/meta.json +3531 -0
  6. minimize_the_total_price_of_the_trips/ocaml_tests/main.ml +26 -0
  7. minimize_the_total_price_of_the_trips/scala_tests/MySuite.scala +12 -0
  8. minimize_xor/.DS_Store +0 -0
  9. minimize_xor/haskell_tests/Main.hs +24 -0
  10. minimize_xor/java_tests/Main.java +21 -0
  11. minimize_xor/meta.json +97 -0
  12. minimize_xor/ocaml_tests/main.ml +26 -0
  13. minimize_xor/scala_tests/MySuite.scala +12 -0
  14. minimum_absolute_difference_between_elements_with_constraint/.DS_Store +0 -0
  15. minimum_absolute_difference_between_elements_with_constraint/haskell_tests/Main.hs +27 -0
  16. minimum_absolute_difference_between_elements_with_constraint/java_tests/Main.java +25 -0
  17. minimum_absolute_difference_between_elements_with_constraint/meta.json +3 -0
  18. minimum_absolute_difference_between_elements_with_constraint/ocaml_tests/main.ml +29 -0
  19. minimum_absolute_difference_between_elements_with_constraint/scala_tests/MySuite.scala +16 -0
  20. minimum_additions_to_make_valid_string/.DS_Store +0 -0
  21. minimum_additions_to_make_valid_string/haskell_tests/Main.hs +27 -0
  22. minimum_additions_to_make_valid_string/java_tests/Main.java +25 -0
  23. minimum_additions_to_make_valid_string/meta.json +72 -0
  24. minimum_additions_to_make_valid_string/ocaml_tests/main.ml +29 -0
  25. minimum_additions_to_make_valid_string/scala_tests/MySuite.scala +16 -0
  26. minimum_amount_of_time_to_collect_garbage/.DS_Store +0 -0
  27. minimum_amount_of_time_to_collect_garbage/haskell_tests/Main.hs +24 -0
  28. minimum_amount_of_time_to_collect_garbage/java_tests/Main.java +21 -0
  29. minimum_amount_of_time_to_collect_garbage/meta.json +1221 -0
  30. minimum_amount_of_time_to_collect_garbage/ocaml_tests/main.ml +26 -0
  31. minimum_amount_of_time_to_collect_garbage/scala_tests/MySuite.scala +12 -0
  32. minimum_amount_of_time_to_fill_cups/.DS_Store +0 -0
  33. minimum_amount_of_time_to_fill_cups/haskell_tests/Main.hs +27 -0
  34. minimum_amount_of_time_to_fill_cups/java_tests/Main.java +25 -0
  35. minimum_amount_of_time_to_fill_cups/meta.json +112 -0
  36. minimum_amount_of_time_to_fill_cups/ocaml_tests/main.ml +29 -0
  37. minimum_amount_of_time_to_fill_cups/scala_tests/MySuite.scala +16 -0
  38. minimum_array_end/haskell_tests/Main.hs +45 -0
  39. minimum_array_end/java_tests/Main.java +21 -0
  40. minimum_array_end/meta.json +97 -0
  41. minimum_array_end/ocaml_tests/main.ml +50 -0
  42. minimum_array_end/scala_tests/MySuite.scala +44 -0
  43. minimum_array_length_after_pair_removals/haskell_tests/Main.hs +0 -0
  44. minimum_array_length_after_pair_removals/java_tests/Main.java +28 -0
  45. minimum_array_length_after_pair_removals/meta.json +3 -0
  46. minimum_array_length_after_pair_removals/ocaml_tests/main.ml +0 -0
  47. minimum_array_length_after_pair_removals/scala_tests/MySuite.scala +0 -0
  48. minimum_array_sum/haskell_tests/Main.hs +45 -0
  49. minimum_array_sum/java_tests/Main.java +21 -0
  50. minimum_array_sum/meta.json +596 -0
.gitattributes CHANGED
@@ -211,3 +211,5 @@ mice_and_cheese/meta.json filter=lfs diff=lfs merge=lfs -text
211
  minimize_maximum_of_array/meta.json filter=lfs diff=lfs merge=lfs -text
212
  minimize_or_of_remaining_elements_using_operations/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
 
 
 
211
  minimize_maximum_of_array/meta.json filter=lfs diff=lfs merge=lfs -text
212
  minimize_or_of_remaining_elements_using_operations/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
minimize_the_total_price_of_the_trips/.DS_Store ADDED
Binary file (6.15 kB). View file
 
minimize_the_total_price_of_the_trips/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 (minimumTotalPrice 4 [[0,1],[1,2],[1,3]] [2,2,10,6] [[0,3],[2,1],[2,3]])," 23 (minimumTotalPrice 4 [[0,1],[1,2],[1,3]] [2,2,10,6] [[0,3],[2,1],[2,3]]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (minimumTotalPrice 2 [[0,1]] [2,2] [[0,0]])," 1 (minimumTotalPrice 2 [[0,1]] [2,2] [[0,0]]))
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
minimize_the_total_price_of_the_trips/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(23, minimumTotalPrice(4, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,1)),new ArrayList<>(Arrays.asList(1,2)),new ArrayList<>(Arrays.asList(1,3)))), new ArrayList<>(Arrays.asList(2,2,10,6)), new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,3)),new ArrayList<>(Arrays.asList(2,1)),new ArrayList<>(Arrays.asList(2,3))))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(1, minimumTotalPrice(2, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,1)))), new ArrayList<>(Arrays.asList(2,2)), new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,0))))));
19
+ }
20
+
21
+ }
minimize_the_total_price_of_the_trips/meta.json ADDED
@@ -0,0 +1,3531 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2739,
3
+ "name": "minimize_the_total_price_of_the_trips",
4
+ "difficulty": "Hard",
5
+ "link": "https://leetcode.com/problems/minimize-the-total-price-of-the-trips/",
6
+ "date": "1680998400000",
7
+ "task_description": "There exists an undirected and unrooted tree with `n` nodes indexed from `0` to `n - 1`. You are given the integer `n` and a 2D integer array `edges` of length `n - 1`, where `edges[i] = [ai, bi]` indicates that there is an edge between nodes `ai` and `bi` in the tree. Each node has an associated price. You are given an integer array `price`, where `price[i]` is the price of the `ith` node. The **price sum** of a given path is the sum of the prices of all nodes lying on that path. Additionally, you are given a 2D integer array `trips`, where `trips[i] = [starti, endi]` indicates that you start the `ith` trip from the node `starti` and travel to the node `endi` by any path you like. Before performing your first trip, you can choose some **non-adjacent** nodes and halve the prices. Return _the minimum total price sum to perform all the given trips_. **Example 1:** ``` **Input:** n = 4, edges = [[0,1],[1,2],[1,3]], price = [2,2,10,6], trips = [[0,3],[2,1],[2,3]] **Output:** 23 **Explanation:** The diagram above denotes the tree after rooting it at node 2. The first part shows the initial tree and the second part shows the tree after choosing nodes 0, 2, and 3, and making their price half. For the 1st trip, we choose path [0,1,3]. The price sum of that path is 1 + 2 + 3 = 6. For the 2nd trip, we choose path [2,1]. The price sum of that path is 2 + 5 = 7. For the 3rd trip, we choose path [2,1,3]. The price sum of that path is 5 + 2 + 3 = 10. The total price sum of all trips is 6 + 7 + 10 = 23. It can be proven, that 23 is the minimum answer that we can achieve. ``` **Example 2:** ``` **Input:** n = 2, edges = [[0,1]], price = [2,2], trips = [[0,0]] **Output:** 1 **Explanation:** The diagram above denotes the tree after rooting it at node 0. The first part shows the initial tree and the second part shows the tree after choosing node 0, and making its price half. For the 1st trip, we choose path [0]. The price sum of that path is 1. The total price sum of all trips is 1. It can be proven, that 1 is the minimum answer that we can achieve. ``` **Constraints:** `1 <= n <= 50` `edges.length == n - 1` `0 <= ai, bi <= n - 1` `edges` represents a valid tree. `price.length == n` `price[i]` is an even integer. `1 <= price[i] <= 1000` `1 <= trips.length <= 100` `0 <= starti, endi <= n - 1`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "n = 4, edges = [[0,1],[1,2],[1,3]], price = [2,2,10,6], trips = [[0,3],[2,1],[2,3]]",
12
+ "output": "23 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "n = 2, edges = [[0,1]], price = [2,2], trips = [[0,0]]",
17
+ "output": "1 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 40,
24
+ [
25
+ [
26
+ 23,
27
+ 31
28
+ ],
29
+ [
30
+ 36,
31
+ 23
32
+ ],
33
+ [
34
+ 35,
35
+ 36
36
+ ],
37
+ [
38
+ 1,
39
+ 23
40
+ ],
41
+ [
42
+ 30,
43
+ 36
44
+ ],
45
+ [
46
+ 16,
47
+ 31
48
+ ],
49
+ [
50
+ 27,
51
+ 31
52
+ ],
53
+ [
54
+ 18,
55
+ 31
56
+ ],
57
+ [
58
+ 10,
59
+ 23
60
+ ],
61
+ [
62
+ 0,
63
+ 16
64
+ ],
65
+ [
66
+ 38,
67
+ 1
68
+ ],
69
+ [
70
+ 14,
71
+ 23
72
+ ],
73
+ [
74
+ 29,
75
+ 31
76
+ ],
77
+ [
78
+ 37,
79
+ 30
80
+ ],
81
+ [
82
+ 6,
83
+ 38
84
+ ],
85
+ [
86
+ 25,
87
+ 0
88
+ ],
89
+ [
90
+ 19,
91
+ 25
92
+ ],
93
+ [
94
+ 24,
95
+ 37
96
+ ],
97
+ [
98
+ 12,
99
+ 1
100
+ ],
101
+ [
102
+ 17,
103
+ 19
104
+ ],
105
+ [
106
+ 2,
107
+ 14
108
+ ],
109
+ [
110
+ 22,
111
+ 37
112
+ ],
113
+ [
114
+ 39,
115
+ 38
116
+ ],
117
+ [
118
+ 9,
119
+ 30
120
+ ],
121
+ [
122
+ 3,
123
+ 24
124
+ ],
125
+ [
126
+ 7,
127
+ 12
128
+ ],
129
+ [
130
+ 5,
131
+ 14
132
+ ],
133
+ [
134
+ 34,
135
+ 14
136
+ ],
137
+ [
138
+ 32,
139
+ 19
140
+ ],
141
+ [
142
+ 4,
143
+ 12
144
+ ],
145
+ [
146
+ 11,
147
+ 10
148
+ ],
149
+ [
150
+ 8,
151
+ 5
152
+ ],
153
+ [
154
+ 33,
155
+ 10
156
+ ],
157
+ [
158
+ 20,
159
+ 8
160
+ ],
161
+ [
162
+ 26,
163
+ 4
164
+ ],
165
+ [
166
+ 28,
167
+ 7
168
+ ],
169
+ [
170
+ 15,
171
+ 36
172
+ ],
173
+ [
174
+ 13,
175
+ 18
176
+ ],
177
+ [
178
+ 21,
179
+ 30
180
+ ]
181
+ ],
182
+ [
183
+ 872,
184
+ 326,
185
+ 44,
186
+ 806,
187
+ 968,
188
+ 62,
189
+ 400,
190
+ 948,
191
+ 78,
192
+ 674,
193
+ 110,
194
+ 868,
195
+ 200,
196
+ 598,
197
+ 388,
198
+ 902,
199
+ 488,
200
+ 832,
201
+ 48,
202
+ 218,
203
+ 204,
204
+ 308,
205
+ 34,
206
+ 80,
207
+ 408,
208
+ 450,
209
+ 346,
210
+ 368,
211
+ 638,
212
+ 238,
213
+ 724,
214
+ 408,
215
+ 700,
216
+ 502,
217
+ 462,
218
+ 758,
219
+ 344,
220
+ 954,
221
+ 270,
222
+ 362
223
+ ],
224
+ [
225
+ [
226
+ 11,
227
+ 19
228
+ ],
229
+ [
230
+ 15,
231
+ 23
232
+ ],
233
+ [
234
+ 19,
235
+ 24
236
+ ],
237
+ [
238
+ 11,
239
+ 34
240
+ ],
241
+ [
242
+ 6,
243
+ 36
244
+ ],
245
+ [
246
+ 10,
247
+ 10
248
+ ],
249
+ [
250
+ 22,
251
+ 5
252
+ ],
253
+ [
254
+ 3,
255
+ 26
256
+ ],
257
+ [
258
+ 37,
259
+ 8
260
+ ],
261
+ [
262
+ 6,
263
+ 15
264
+ ],
265
+ [
266
+ 34,
267
+ 38
268
+ ],
269
+ [
270
+ 18,
271
+ 14
272
+ ],
273
+ [
274
+ 23,
275
+ 12
276
+ ],
277
+ [
278
+ 33,
279
+ 15
280
+ ],
281
+ [
282
+ 14,
283
+ 32
284
+ ],
285
+ [
286
+ 30,
287
+ 38
288
+ ],
289
+ [
290
+ 20,
291
+ 2
292
+ ],
293
+ [
294
+ 10,
295
+ 29
296
+ ],
297
+ [
298
+ 30,
299
+ 15
300
+ ],
301
+ [
302
+ 28,
303
+ 15
304
+ ],
305
+ [
306
+ 9,
307
+ 16
308
+ ],
309
+ [
310
+ 0,
311
+ 34
312
+ ],
313
+ [
314
+ 32,
315
+ 33
316
+ ],
317
+ [
318
+ 11,
319
+ 36
320
+ ],
321
+ [
322
+ 1,
323
+ 3
324
+ ],
325
+ [
326
+ 14,
327
+ 15
328
+ ],
329
+ [
330
+ 1,
331
+ 38
332
+ ],
333
+ [
334
+ 12,
335
+ 27
336
+ ],
337
+ [
338
+ 30,
339
+ 37
340
+ ],
341
+ [
342
+ 27,
343
+ 6
344
+ ],
345
+ [
346
+ 36,
347
+ 13
348
+ ],
349
+ [
350
+ 32,
351
+ 6
352
+ ],
353
+ [
354
+ 13,
355
+ 2
356
+ ],
357
+ [
358
+ 6,
359
+ 1
360
+ ],
361
+ [
362
+ 17,
363
+ 12
364
+ ],
365
+ [
366
+ 37,
367
+ 11
368
+ ],
369
+ [
370
+ 30,
371
+ 31
372
+ ],
373
+ [
374
+ 24,
375
+ 32
376
+ ],
377
+ [
378
+ 0,
379
+ 5
380
+ ],
381
+ [
382
+ 15,
383
+ 14
384
+ ],
385
+ [
386
+ 4,
387
+ 34
388
+ ],
389
+ [
390
+ 16,
391
+ 34
392
+ ],
393
+ [
394
+ 29,
395
+ 7
396
+ ],
397
+ [
398
+ 26,
399
+ 13
400
+ ],
401
+ [
402
+ 23,
403
+ 23
404
+ ],
405
+ [
406
+ 8,
407
+ 38
408
+ ],
409
+ [
410
+ 7,
411
+ 14
412
+ ],
413
+ [
414
+ 37,
415
+ 19
416
+ ],
417
+ [
418
+ 19,
419
+ 17
420
+ ],
421
+ [
422
+ 13,
423
+ 18
424
+ ],
425
+ [
426
+ 38,
427
+ 26
428
+ ],
429
+ [
430
+ 24,
431
+ 36
432
+ ],
433
+ [
434
+ 10,
435
+ 6
436
+ ],
437
+ [
438
+ 2,
439
+ 37
440
+ ],
441
+ [
442
+ 24,
443
+ 24
444
+ ],
445
+ [
446
+ 25,
447
+ 2
448
+ ],
449
+ [
450
+ 17,
451
+ 12
452
+ ],
453
+ [
454
+ 4,
455
+ 11
456
+ ],
457
+ [
458
+ 38,
459
+ 36
460
+ ],
461
+ [
462
+ 21,
463
+ 19
464
+ ],
465
+ [
466
+ 0,
467
+ 5
468
+ ],
469
+ [
470
+ 2,
471
+ 32
472
+ ],
473
+ [
474
+ 2,
475
+ 23
476
+ ],
477
+ [
478
+ 26,
479
+ 22
480
+ ],
481
+ [
482
+ 34,
483
+ 14
484
+ ],
485
+ [
486
+ 34,
487
+ 5
488
+ ],
489
+ [
490
+ 37,
491
+ 12
492
+ ],
493
+ [
494
+ 10,
495
+ 12
496
+ ],
497
+ [
498
+ 25,
499
+ 21
500
+ ],
501
+ [
502
+ 25,
503
+ 22
504
+ ],
505
+ [
506
+ 37,
507
+ 23
508
+ ],
509
+ [
510
+ 21,
511
+ 11
512
+ ],
513
+ [
514
+ 8,
515
+ 37
516
+ ],
517
+ [
518
+ 31,
519
+ 26
520
+ ],
521
+ [
522
+ 33,
523
+ 8
524
+ ],
525
+ [
526
+ 38,
527
+ 25
528
+ ]
529
+ ]
530
+ ],
531
+ "output": 117944
532
+ },
533
+ {
534
+ "input": [
535
+ 36,
536
+ [
537
+ [
538
+ 20,
539
+ 2
540
+ ],
541
+ [
542
+ 17,
543
+ 20
544
+ ],
545
+ [
546
+ 5,
547
+ 20
548
+ ],
549
+ [
550
+ 12,
551
+ 5
552
+ ],
553
+ [
554
+ 7,
555
+ 2
556
+ ],
557
+ [
558
+ 14,
559
+ 12
560
+ ],
561
+ [
562
+ 6,
563
+ 17
564
+ ],
565
+ [
566
+ 22,
567
+ 20
568
+ ],
569
+ [
570
+ 21,
571
+ 22
572
+ ],
573
+ [
574
+ 1,
575
+ 6
576
+ ],
577
+ [
578
+ 8,
579
+ 5
580
+ ],
581
+ [
582
+ 3,
583
+ 7
584
+ ],
585
+ [
586
+ 29,
587
+ 8
588
+ ],
589
+ [
590
+ 13,
591
+ 2
592
+ ],
593
+ [
594
+ 18,
595
+ 12
596
+ ],
597
+ [
598
+ 25,
599
+ 12
600
+ ],
601
+ [
602
+ 30,
603
+ 25
604
+ ],
605
+ [
606
+ 27,
607
+ 6
608
+ ],
609
+ [
610
+ 15,
611
+ 12
612
+ ],
613
+ [
614
+ 31,
615
+ 14
616
+ ],
617
+ [
618
+ 0,
619
+ 12
620
+ ],
621
+ [
622
+ 35,
623
+ 0
624
+ ],
625
+ [
626
+ 16,
627
+ 22
628
+ ],
629
+ [
630
+ 24,
631
+ 22
632
+ ],
633
+ [
634
+ 34,
635
+ 31
636
+ ],
637
+ [
638
+ 19,
639
+ 1
640
+ ],
641
+ [
642
+ 28,
643
+ 27
644
+ ],
645
+ [
646
+ 33,
647
+ 20
648
+ ],
649
+ [
650
+ 26,
651
+ 30
652
+ ],
653
+ [
654
+ 9,
655
+ 17
656
+ ],
657
+ [
658
+ 23,
659
+ 8
660
+ ],
661
+ [
662
+ 32,
663
+ 35
664
+ ],
665
+ [
666
+ 11,
667
+ 8
668
+ ],
669
+ [
670
+ 10,
671
+ 15
672
+ ],
673
+ [
674
+ 4,
675
+ 23
676
+ ]
677
+ ],
678
+ [
679
+ 268,
680
+ 776,
681
+ 556,
682
+ 320,
683
+ 646,
684
+ 260,
685
+ 302,
686
+ 824,
687
+ 186,
688
+ 72,
689
+ 130,
690
+ 110,
691
+ 462,
692
+ 152,
693
+ 706,
694
+ 790,
695
+ 662,
696
+ 810,
697
+ 492,
698
+ 374,
699
+ 150,
700
+ 798,
701
+ 700,
702
+ 60,
703
+ 290,
704
+ 742,
705
+ 936,
706
+ 870,
707
+ 148,
708
+ 1000,
709
+ 304,
710
+ 538,
711
+ 968,
712
+ 868,
713
+ 60,
714
+ 534
715
+ ],
716
+ [
717
+ [
718
+ 29,
719
+ 0
720
+ ],
721
+ [
722
+ 3,
723
+ 25
724
+ ],
725
+ [
726
+ 22,
727
+ 22
728
+ ],
729
+ [
730
+ 12,
731
+ 27
732
+ ],
733
+ [
734
+ 7,
735
+ 26
736
+ ],
737
+ [
738
+ 31,
739
+ 30
740
+ ],
741
+ [
742
+ 18,
743
+ 8
744
+ ],
745
+ [
746
+ 14,
747
+ 3
748
+ ],
749
+ [
750
+ 4,
751
+ 21
752
+ ],
753
+ [
754
+ 30,
755
+ 31
756
+ ],
757
+ [
758
+ 3,
759
+ 4
760
+ ],
761
+ [
762
+ 30,
763
+ 28
764
+ ],
765
+ [
766
+ 0,
767
+ 15
768
+ ],
769
+ [
770
+ 11,
771
+ 7
772
+ ],
773
+ [
774
+ 15,
775
+ 31
776
+ ],
777
+ [
778
+ 22,
779
+ 19
780
+ ],
781
+ [
782
+ 9,
783
+ 26
784
+ ],
785
+ [
786
+ 0,
787
+ 16
788
+ ],
789
+ [
790
+ 15,
791
+ 16
792
+ ],
793
+ [
794
+ 8,
795
+ 25
796
+ ],
797
+ [
798
+ 28,
799
+ 25
800
+ ],
801
+ [
802
+ 17,
803
+ 28
804
+ ],
805
+ [
806
+ 32,
807
+ 12
808
+ ],
809
+ [
810
+ 15,
811
+ 35
812
+ ],
813
+ [
814
+ 2,
815
+ 21
816
+ ],
817
+ [
818
+ 0,
819
+ 3
820
+ ],
821
+ [
822
+ 34,
823
+ 18
824
+ ],
825
+ [
826
+ 32,
827
+ 22
828
+ ],
829
+ [
830
+ 34,
831
+ 34
832
+ ],
833
+ [
834
+ 28,
835
+ 33
836
+ ],
837
+ [
838
+ 0,
839
+ 33
840
+ ]
841
+ ]
842
+ ],
843
+ "output": 54772
844
+ },
845
+ {
846
+ "input": [
847
+ 21,
848
+ [
849
+ [
850
+ 16,
851
+ 10
852
+ ],
853
+ [
854
+ 20,
855
+ 16
856
+ ],
857
+ [
858
+ 4,
859
+ 20
860
+ ],
861
+ [
862
+ 15,
863
+ 10
864
+ ],
865
+ [
866
+ 12,
867
+ 4
868
+ ],
869
+ [
870
+ 0,
871
+ 16
872
+ ],
873
+ [
874
+ 11,
875
+ 16
876
+ ],
877
+ [
878
+ 3,
879
+ 15
880
+ ],
881
+ [
882
+ 8,
883
+ 4
884
+ ],
885
+ [
886
+ 7,
887
+ 10
888
+ ],
889
+ [
890
+ 6,
891
+ 10
892
+ ],
893
+ [
894
+ 2,
895
+ 8
896
+ ],
897
+ [
898
+ 1,
899
+ 12
900
+ ],
901
+ [
902
+ 13,
903
+ 0
904
+ ],
905
+ [
906
+ 9,
907
+ 0
908
+ ],
909
+ [
910
+ 19,
911
+ 20
912
+ ],
913
+ [
914
+ 18,
915
+ 11
916
+ ],
917
+ [
918
+ 17,
919
+ 16
920
+ ],
921
+ [
922
+ 5,
923
+ 1
924
+ ],
925
+ [
926
+ 14,
927
+ 19
928
+ ]
929
+ ],
930
+ [
931
+ 254,
932
+ 76,
933
+ 994,
934
+ 424,
935
+ 776,
936
+ 250,
937
+ 318,
938
+ 366,
939
+ 252,
940
+ 432,
941
+ 118,
942
+ 988,
943
+ 922,
944
+ 290,
945
+ 420,
946
+ 608,
947
+ 476,
948
+ 458,
949
+ 90,
950
+ 260,
951
+ 630
952
+ ],
953
+ [
954
+ [
955
+ 1,
956
+ 15
957
+ ],
958
+ [
959
+ 18,
960
+ 8
961
+ ],
962
+ [
963
+ 20,
964
+ 11
965
+ ],
966
+ [
967
+ 8,
968
+ 18
969
+ ],
970
+ [
971
+ 18,
972
+ 4
973
+ ],
974
+ [
975
+ 7,
976
+ 20
977
+ ],
978
+ [
979
+ 11,
980
+ 8
981
+ ],
982
+ [
983
+ 15,
984
+ 9
985
+ ],
986
+ [
987
+ 10,
988
+ 5
989
+ ],
990
+ [
991
+ 16,
992
+ 16
993
+ ],
994
+ [
995
+ 16,
996
+ 17
997
+ ],
998
+ [
999
+ 9,
1000
+ 5
1001
+ ],
1002
+ [
1003
+ 10,
1004
+ 11
1005
+ ],
1006
+ [
1007
+ 13,
1008
+ 16
1009
+ ],
1010
+ [
1011
+ 8,
1012
+ 5
1013
+ ],
1014
+ [
1015
+ 7,
1016
+ 5
1017
+ ],
1018
+ [
1019
+ 20,
1020
+ 12
1021
+ ],
1022
+ [
1023
+ 7,
1024
+ 7
1025
+ ],
1026
+ [
1027
+ 16,
1028
+ 12
1029
+ ],
1030
+ [
1031
+ 12,
1032
+ 3
1033
+ ],
1034
+ [
1035
+ 2,
1036
+ 9
1037
+ ],
1038
+ [
1039
+ 4,
1040
+ 5
1041
+ ],
1042
+ [
1043
+ 7,
1044
+ 2
1045
+ ]
1046
+ ]
1047
+ ],
1048
+ "output": 41429
1049
+ },
1050
+ {
1051
+ "input": [
1052
+ 36,
1053
+ [
1054
+ [
1055
+ 5,
1056
+ 15
1057
+ ],
1058
+ [
1059
+ 6,
1060
+ 15
1061
+ ],
1062
+ [
1063
+ 12,
1064
+ 5
1065
+ ],
1066
+ [
1067
+ 9,
1068
+ 5
1069
+ ],
1070
+ [
1071
+ 1,
1072
+ 6
1073
+ ],
1074
+ [
1075
+ 0,
1076
+ 5
1077
+ ],
1078
+ [
1079
+ 21,
1080
+ 0
1081
+ ],
1082
+ [
1083
+ 13,
1084
+ 9
1085
+ ],
1086
+ [
1087
+ 2,
1088
+ 21
1089
+ ],
1090
+ [
1091
+ 29,
1092
+ 6
1093
+ ],
1094
+ [
1095
+ 27,
1096
+ 6
1097
+ ],
1098
+ [
1099
+ 23,
1100
+ 1
1101
+ ],
1102
+ [
1103
+ 17,
1104
+ 15
1105
+ ],
1106
+ [
1107
+ 16,
1108
+ 1
1109
+ ],
1110
+ [
1111
+ 34,
1112
+ 0
1113
+ ],
1114
+ [
1115
+ 31,
1116
+ 34
1117
+ ],
1118
+ [
1119
+ 7,
1120
+ 1
1121
+ ],
1122
+ [
1123
+ 33,
1124
+ 17
1125
+ ],
1126
+ [
1127
+ 26,
1128
+ 27
1129
+ ],
1130
+ [
1131
+ 11,
1132
+ 0
1133
+ ],
1134
+ [
1135
+ 19,
1136
+ 16
1137
+ ],
1138
+ [
1139
+ 18,
1140
+ 15
1141
+ ],
1142
+ [
1143
+ 22,
1144
+ 7
1145
+ ],
1146
+ [
1147
+ 4,
1148
+ 2
1149
+ ],
1150
+ [
1151
+ 35,
1152
+ 16
1153
+ ],
1154
+ [
1155
+ 3,
1156
+ 7
1157
+ ],
1158
+ [
1159
+ 24,
1160
+ 21
1161
+ ],
1162
+ [
1163
+ 25,
1164
+ 19
1165
+ ],
1166
+ [
1167
+ 28,
1168
+ 17
1169
+ ],
1170
+ [
1171
+ 20,
1172
+ 13
1173
+ ],
1174
+ [
1175
+ 10,
1176
+ 9
1177
+ ],
1178
+ [
1179
+ 32,
1180
+ 0
1181
+ ],
1182
+ [
1183
+ 30,
1184
+ 35
1185
+ ],
1186
+ [
1187
+ 14,
1188
+ 9
1189
+ ],
1190
+ [
1191
+ 8,
1192
+ 6
1193
+ ]
1194
+ ],
1195
+ [
1196
+ 14,
1197
+ 362,
1198
+ 824,
1199
+ 814,
1200
+ 798,
1201
+ 286,
1202
+ 506,
1203
+ 350,
1204
+ 228,
1205
+ 126,
1206
+ 298,
1207
+ 290,
1208
+ 938,
1209
+ 132,
1210
+ 114,
1211
+ 298,
1212
+ 790,
1213
+ 520,
1214
+ 140,
1215
+ 136,
1216
+ 640,
1217
+ 366,
1218
+ 220,
1219
+ 804,
1220
+ 616,
1221
+ 622,
1222
+ 986,
1223
+ 274,
1224
+ 114,
1225
+ 300,
1226
+ 820,
1227
+ 406,
1228
+ 650,
1229
+ 550,
1230
+ 162,
1231
+ 508
1232
+ ],
1233
+ [
1234
+ [
1235
+ 22,
1236
+ 29
1237
+ ],
1238
+ [
1239
+ 3,
1240
+ 29
1241
+ ],
1242
+ [
1243
+ 19,
1244
+ 17
1245
+ ],
1246
+ [
1247
+ 15,
1248
+ 16
1249
+ ],
1250
+ [
1251
+ 8,
1252
+ 22
1253
+ ],
1254
+ [
1255
+ 2,
1256
+ 16
1257
+ ],
1258
+ [
1259
+ 8,
1260
+ 3
1261
+ ],
1262
+ [
1263
+ 0,
1264
+ 11
1265
+ ],
1266
+ [
1267
+ 1,
1268
+ 10
1269
+ ],
1270
+ [
1271
+ 11,
1272
+ 21
1273
+ ],
1274
+ [
1275
+ 11,
1276
+ 33
1277
+ ],
1278
+ [
1279
+ 6,
1280
+ 10
1281
+ ],
1282
+ [
1283
+ 10,
1284
+ 34
1285
+ ],
1286
+ [
1287
+ 9,
1288
+ 20
1289
+ ],
1290
+ [
1291
+ 1,
1292
+ 26
1293
+ ],
1294
+ [
1295
+ 6,
1296
+ 8
1297
+ ],
1298
+ [
1299
+ 3,
1300
+ 6
1301
+ ],
1302
+ [
1303
+ 1,
1304
+ 32
1305
+ ],
1306
+ [
1307
+ 9,
1308
+ 12
1309
+ ],
1310
+ [
1311
+ 29,
1312
+ 15
1313
+ ],
1314
+ [
1315
+ 19,
1316
+ 6
1317
+ ],
1318
+ [
1319
+ 26,
1320
+ 32
1321
+ ],
1322
+ [
1323
+ 24,
1324
+ 0
1325
+ ],
1326
+ [
1327
+ 28,
1328
+ 20
1329
+ ],
1330
+ [
1331
+ 11,
1332
+ 9
1333
+ ],
1334
+ [
1335
+ 13,
1336
+ 13
1337
+ ],
1338
+ [
1339
+ 6,
1340
+ 28
1341
+ ],
1342
+ [
1343
+ 16,
1344
+ 7
1345
+ ],
1346
+ [
1347
+ 18,
1348
+ 30
1349
+ ],
1350
+ [
1351
+ 7,
1352
+ 9
1353
+ ],
1354
+ [
1355
+ 0,
1356
+ 10
1357
+ ],
1358
+ [
1359
+ 5,
1360
+ 2
1361
+ ],
1362
+ [
1363
+ 13,
1364
+ 23
1365
+ ],
1366
+ [
1367
+ 7,
1368
+ 21
1369
+ ],
1370
+ [
1371
+ 0,
1372
+ 0
1373
+ ],
1374
+ [
1375
+ 19,
1376
+ 2
1377
+ ],
1378
+ [
1379
+ 0,
1380
+ 4
1381
+ ],
1382
+ [
1383
+ 34,
1384
+ 19
1385
+ ],
1386
+ [
1387
+ 26,
1388
+ 25
1389
+ ]
1390
+ ]
1391
+ ],
1392
+ "output": 47583
1393
+ },
1394
+ {
1395
+ "input": [
1396
+ 48,
1397
+ [
1398
+ [
1399
+ 43,
1400
+ 16
1401
+ ],
1402
+ [
1403
+ 30,
1404
+ 16
1405
+ ],
1406
+ [
1407
+ 35,
1408
+ 43
1409
+ ],
1410
+ [
1411
+ 14,
1412
+ 16
1413
+ ],
1414
+ [
1415
+ 29,
1416
+ 14
1417
+ ],
1418
+ [
1419
+ 13,
1420
+ 43
1421
+ ],
1422
+ [
1423
+ 37,
1424
+ 29
1425
+ ],
1426
+ [
1427
+ 40,
1428
+ 14
1429
+ ],
1430
+ [
1431
+ 36,
1432
+ 13
1433
+ ],
1434
+ [
1435
+ 15,
1436
+ 13
1437
+ ],
1438
+ [
1439
+ 32,
1440
+ 35
1441
+ ],
1442
+ [
1443
+ 12,
1444
+ 15
1445
+ ],
1446
+ [
1447
+ 18,
1448
+ 35
1449
+ ],
1450
+ [
1451
+ 23,
1452
+ 14
1453
+ ],
1454
+ [
1455
+ 33,
1456
+ 23
1457
+ ],
1458
+ [
1459
+ 26,
1460
+ 13
1461
+ ],
1462
+ [
1463
+ 8,
1464
+ 35
1465
+ ],
1466
+ [
1467
+ 31,
1468
+ 33
1469
+ ],
1470
+ [
1471
+ 21,
1472
+ 13
1473
+ ],
1474
+ [
1475
+ 34,
1476
+ 14
1477
+ ],
1478
+ [
1479
+ 47,
1480
+ 37
1481
+ ],
1482
+ [
1483
+ 11,
1484
+ 12
1485
+ ],
1486
+ [
1487
+ 7,
1488
+ 11
1489
+ ],
1490
+ [
1491
+ 46,
1492
+ 32
1493
+ ],
1494
+ [
1495
+ 25,
1496
+ 11
1497
+ ],
1498
+ [
1499
+ 17,
1500
+ 43
1501
+ ],
1502
+ [
1503
+ 27,
1504
+ 8
1505
+ ],
1506
+ [
1507
+ 20,
1508
+ 36
1509
+ ],
1510
+ [
1511
+ 41,
1512
+ 11
1513
+ ],
1514
+ [
1515
+ 2,
1516
+ 16
1517
+ ],
1518
+ [
1519
+ 0,
1520
+ 33
1521
+ ],
1522
+ [
1523
+ 45,
1524
+ 18
1525
+ ],
1526
+ [
1527
+ 10,
1528
+ 43
1529
+ ],
1530
+ [
1531
+ 3,
1532
+ 36
1533
+ ],
1534
+ [
1535
+ 28,
1536
+ 2
1537
+ ],
1538
+ [
1539
+ 6,
1540
+ 16
1541
+ ],
1542
+ [
1543
+ 39,
1544
+ 30
1545
+ ],
1546
+ [
1547
+ 1,
1548
+ 46
1549
+ ],
1550
+ [
1551
+ 24,
1552
+ 32
1553
+ ],
1554
+ [
1555
+ 4,
1556
+ 28
1557
+ ],
1558
+ [
1559
+ 19,
1560
+ 13
1561
+ ],
1562
+ [
1563
+ 38,
1564
+ 34
1565
+ ],
1566
+ [
1567
+ 44,
1568
+ 15
1569
+ ],
1570
+ [
1571
+ 42,
1572
+ 8
1573
+ ],
1574
+ [
1575
+ 22,
1576
+ 19
1577
+ ],
1578
+ [
1579
+ 9,
1580
+ 7
1581
+ ],
1582
+ [
1583
+ 5,
1584
+ 23
1585
+ ]
1586
+ ],
1587
+ [
1588
+ 686,
1589
+ 994,
1590
+ 744,
1591
+ 196,
1592
+ 494,
1593
+ 356,
1594
+ 320,
1595
+ 920,
1596
+ 292,
1597
+ 276,
1598
+ 856,
1599
+ 704,
1600
+ 756,
1601
+ 238,
1602
+ 900,
1603
+ 514,
1604
+ 252,
1605
+ 904,
1606
+ 448,
1607
+ 124,
1608
+ 770,
1609
+ 22,
1610
+ 58,
1611
+ 542,
1612
+ 960,
1613
+ 368,
1614
+ 862,
1615
+ 252,
1616
+ 502,
1617
+ 216,
1618
+ 304,
1619
+ 968,
1620
+ 82,
1621
+ 894,
1622
+ 546,
1623
+ 252,
1624
+ 94,
1625
+ 410,
1626
+ 440,
1627
+ 966,
1628
+ 322,
1629
+ 114,
1630
+ 554,
1631
+ 502,
1632
+ 164,
1633
+ 604,
1634
+ 606,
1635
+ 730
1636
+ ],
1637
+ [
1638
+ [
1639
+ 21,
1640
+ 31
1641
+ ],
1642
+ [
1643
+ 29,
1644
+ 14
1645
+ ],
1646
+ [
1647
+ 21,
1648
+ 42
1649
+ ],
1650
+ [
1651
+ 8,
1652
+ 8
1653
+ ],
1654
+ [
1655
+ 36,
1656
+ 20
1657
+ ],
1658
+ [
1659
+ 47,
1660
+ 41
1661
+ ],
1662
+ [
1663
+ 47,
1664
+ 11
1665
+ ],
1666
+ [
1667
+ 18,
1668
+ 1
1669
+ ],
1670
+ [
1671
+ 45,
1672
+ 10
1673
+ ],
1674
+ [
1675
+ 26,
1676
+ 37
1677
+ ],
1678
+ [
1679
+ 31,
1680
+ 22
1681
+ ],
1682
+ [
1683
+ 10,
1684
+ 29
1685
+ ],
1686
+ [
1687
+ 25,
1688
+ 41
1689
+ ],
1690
+ [
1691
+ 46,
1692
+ 10
1693
+ ],
1694
+ [
1695
+ 8,
1696
+ 33
1697
+ ],
1698
+ [
1699
+ 24,
1700
+ 16
1701
+ ],
1702
+ [
1703
+ 9,
1704
+ 20
1705
+ ],
1706
+ [
1707
+ 41,
1708
+ 23
1709
+ ],
1710
+ [
1711
+ 39,
1712
+ 29
1713
+ ]
1714
+ ]
1715
+ ],
1716
+ "output": 38985
1717
+ },
1718
+ {
1719
+ "input": [
1720
+ 42,
1721
+ [
1722
+ [
1723
+ 37,
1724
+ 34
1725
+ ],
1726
+ [
1727
+ 10,
1728
+ 37
1729
+ ],
1730
+ [
1731
+ 14,
1732
+ 34
1733
+ ],
1734
+ [
1735
+ 23,
1736
+ 10
1737
+ ],
1738
+ [
1739
+ 8,
1740
+ 10
1741
+ ],
1742
+ [
1743
+ 2,
1744
+ 23
1745
+ ],
1746
+ [
1747
+ 24,
1748
+ 8
1749
+ ],
1750
+ [
1751
+ 33,
1752
+ 37
1753
+ ],
1754
+ [
1755
+ 39,
1756
+ 37
1757
+ ],
1758
+ [
1759
+ 27,
1760
+ 8
1761
+ ],
1762
+ [
1763
+ 16,
1764
+ 33
1765
+ ],
1766
+ [
1767
+ 19,
1768
+ 27
1769
+ ],
1770
+ [
1771
+ 30,
1772
+ 39
1773
+ ],
1774
+ [
1775
+ 0,
1776
+ 24
1777
+ ],
1778
+ [
1779
+ 36,
1780
+ 8
1781
+ ],
1782
+ [
1783
+ 32,
1784
+ 19
1785
+ ],
1786
+ [
1787
+ 28,
1788
+ 24
1789
+ ],
1790
+ [
1791
+ 4,
1792
+ 24
1793
+ ],
1794
+ [
1795
+ 40,
1796
+ 39
1797
+ ],
1798
+ [
1799
+ 12,
1800
+ 39
1801
+ ],
1802
+ [
1803
+ 6,
1804
+ 28
1805
+ ],
1806
+ [
1807
+ 11,
1808
+ 33
1809
+ ],
1810
+ [
1811
+ 17,
1812
+ 16
1813
+ ],
1814
+ [
1815
+ 5,
1816
+ 24
1817
+ ],
1818
+ [
1819
+ 20,
1820
+ 14
1821
+ ],
1822
+ [
1823
+ 21,
1824
+ 6
1825
+ ],
1826
+ [
1827
+ 7,
1828
+ 5
1829
+ ],
1830
+ [
1831
+ 9,
1832
+ 36
1833
+ ],
1834
+ [
1835
+ 13,
1836
+ 19
1837
+ ],
1838
+ [
1839
+ 25,
1840
+ 40
1841
+ ],
1842
+ [
1843
+ 41,
1844
+ 14
1845
+ ],
1846
+ [
1847
+ 26,
1848
+ 11
1849
+ ],
1850
+ [
1851
+ 31,
1852
+ 7
1853
+ ],
1854
+ [
1855
+ 35,
1856
+ 11
1857
+ ],
1858
+ [
1859
+ 38,
1860
+ 0
1861
+ ],
1862
+ [
1863
+ 22,
1864
+ 39
1865
+ ],
1866
+ [
1867
+ 1,
1868
+ 40
1869
+ ],
1870
+ [
1871
+ 15,
1872
+ 11
1873
+ ],
1874
+ [
1875
+ 29,
1876
+ 27
1877
+ ],
1878
+ [
1879
+ 3,
1880
+ 40
1881
+ ],
1882
+ [
1883
+ 18,
1884
+ 31
1885
+ ]
1886
+ ],
1887
+ [
1888
+ 676,
1889
+ 548,
1890
+ 918,
1891
+ 274,
1892
+ 374,
1893
+ 118,
1894
+ 890,
1895
+ 284,
1896
+ 732,
1897
+ 820,
1898
+ 272,
1899
+ 572,
1900
+ 992,
1901
+ 786,
1902
+ 524,
1903
+ 520,
1904
+ 28,
1905
+ 392,
1906
+ 658,
1907
+ 330,
1908
+ 568,
1909
+ 228,
1910
+ 660,
1911
+ 730,
1912
+ 786,
1913
+ 144,
1914
+ 804,
1915
+ 732,
1916
+ 708,
1917
+ 936,
1918
+ 322,
1919
+ 566,
1920
+ 34,
1921
+ 912,
1922
+ 762,
1923
+ 508,
1924
+ 812,
1925
+ 22,
1926
+ 598,
1927
+ 814,
1928
+ 962,
1929
+ 990
1930
+ ],
1931
+ [
1932
+ [
1933
+ 26,
1934
+ 27
1935
+ ],
1936
+ [
1937
+ 25,
1938
+ 2
1939
+ ],
1940
+ [
1941
+ 16,
1942
+ 15
1943
+ ],
1944
+ [
1945
+ 40,
1946
+ 39
1947
+ ],
1948
+ [
1949
+ 14,
1950
+ 28
1951
+ ],
1952
+ [
1953
+ 5,
1954
+ 0
1955
+ ],
1956
+ [
1957
+ 9,
1958
+ 38
1959
+ ],
1960
+ [
1961
+ 37,
1962
+ 11
1963
+ ],
1964
+ [
1965
+ 21,
1966
+ 2
1967
+ ],
1968
+ [
1969
+ 1,
1970
+ 34
1971
+ ],
1972
+ [
1973
+ 4,
1974
+ 17
1975
+ ],
1976
+ [
1977
+ 23,
1978
+ 23
1979
+ ],
1980
+ [
1981
+ 19,
1982
+ 2
1983
+ ],
1984
+ [
1985
+ 37,
1986
+ 16
1987
+ ],
1988
+ [
1989
+ 7,
1990
+ 14
1991
+ ],
1992
+ [
1993
+ 27,
1994
+ 4
1995
+ ],
1996
+ [
1997
+ 0,
1998
+ 13
1999
+ ],
2000
+ [
2001
+ 3,
2002
+ 1
2003
+ ],
2004
+ [
2005
+ 36,
2006
+ 32
2007
+ ],
2008
+ [
2009
+ 27,
2010
+ 18
2011
+ ],
2012
+ [
2013
+ 17,
2014
+ 18
2015
+ ],
2016
+ [
2017
+ 6,
2018
+ 30
2019
+ ],
2020
+ [
2021
+ 7,
2022
+ 7
2023
+ ],
2024
+ [
2025
+ 9,
2026
+ 31
2027
+ ],
2028
+ [
2029
+ 13,
2030
+ 22
2031
+ ],
2032
+ [
2033
+ 2,
2034
+ 27
2035
+ ],
2036
+ [
2037
+ 33,
2038
+ 5
2039
+ ],
2040
+ [
2041
+ 13,
2042
+ 4
2043
+ ],
2044
+ [
2045
+ 18,
2046
+ 6
2047
+ ],
2048
+ [
2049
+ 22,
2050
+ 6
2051
+ ],
2052
+ [
2053
+ 35,
2054
+ 25
2055
+ ],
2056
+ [
2057
+ 15,
2058
+ 0
2059
+ ],
2060
+ [
2061
+ 27,
2062
+ 10
2063
+ ],
2064
+ [
2065
+ 36,
2066
+ 24
2067
+ ],
2068
+ [
2069
+ 39,
2070
+ 24
2071
+ ],
2072
+ [
2073
+ 26,
2074
+ 14
2075
+ ],
2076
+ [
2077
+ 4,
2078
+ 12
2079
+ ],
2080
+ [
2081
+ 21,
2082
+ 11
2083
+ ]
2084
+ ]
2085
+ ],
2086
+ "output": 87166
2087
+ },
2088
+ {
2089
+ "input": [
2090
+ 49,
2091
+ [
2092
+ [
2093
+ 46,
2094
+ 45
2095
+ ],
2096
+ [
2097
+ 20,
2098
+ 45
2099
+ ],
2100
+ [
2101
+ 24,
2102
+ 46
2103
+ ],
2104
+ [
2105
+ 25,
2106
+ 24
2107
+ ],
2108
+ [
2109
+ 14,
2110
+ 46
2111
+ ],
2112
+ [
2113
+ 6,
2114
+ 45
2115
+ ],
2116
+ [
2117
+ 33,
2118
+ 6
2119
+ ],
2120
+ [
2121
+ 19,
2122
+ 6
2123
+ ],
2124
+ [
2125
+ 48,
2126
+ 33
2127
+ ],
2128
+ [
2129
+ 32,
2130
+ 20
2131
+ ],
2132
+ [
2133
+ 17,
2134
+ 19
2135
+ ],
2136
+ [
2137
+ 23,
2138
+ 19
2139
+ ],
2140
+ [
2141
+ 42,
2142
+ 14
2143
+ ],
2144
+ [
2145
+ 2,
2146
+ 45
2147
+ ],
2148
+ [
2149
+ 34,
2150
+ 17
2151
+ ],
2152
+ [
2153
+ 26,
2154
+ 2
2155
+ ],
2156
+ [
2157
+ 31,
2158
+ 26
2159
+ ],
2160
+ [
2161
+ 30,
2162
+ 45
2163
+ ],
2164
+ [
2165
+ 16,
2166
+ 20
2167
+ ],
2168
+ [
2169
+ 41,
2170
+ 33
2171
+ ],
2172
+ [
2173
+ 18,
2174
+ 48
2175
+ ],
2176
+ [
2177
+ 1,
2178
+ 2
2179
+ ],
2180
+ [
2181
+ 28,
2182
+ 42
2183
+ ],
2184
+ [
2185
+ 4,
2186
+ 16
2187
+ ],
2188
+ [
2189
+ 37,
2190
+ 18
2191
+ ],
2192
+ [
2193
+ 8,
2194
+ 24
2195
+ ],
2196
+ [
2197
+ 40,
2198
+ 37
2199
+ ],
2200
+ [
2201
+ 13,
2202
+ 33
2203
+ ],
2204
+ [
2205
+ 3,
2206
+ 6
2207
+ ],
2208
+ [
2209
+ 39,
2210
+ 3
2211
+ ],
2212
+ [
2213
+ 10,
2214
+ 28
2215
+ ],
2216
+ [
2217
+ 15,
2218
+ 13
2219
+ ],
2220
+ [
2221
+ 35,
2222
+ 39
2223
+ ],
2224
+ [
2225
+ 43,
2226
+ 46
2227
+ ],
2228
+ [
2229
+ 44,
2230
+ 2
2231
+ ],
2232
+ [
2233
+ 36,
2234
+ 44
2235
+ ],
2236
+ [
2237
+ 21,
2238
+ 31
2239
+ ],
2240
+ [
2241
+ 0,
2242
+ 19
2243
+ ],
2244
+ [
2245
+ 29,
2246
+ 17
2247
+ ],
2248
+ [
2249
+ 27,
2250
+ 0
2251
+ ],
2252
+ [
2253
+ 9,
2254
+ 13
2255
+ ],
2256
+ [
2257
+ 11,
2258
+ 35
2259
+ ],
2260
+ [
2261
+ 22,
2262
+ 20
2263
+ ],
2264
+ [
2265
+ 38,
2266
+ 3
2267
+ ],
2268
+ [
2269
+ 5,
2270
+ 37
2271
+ ],
2272
+ [
2273
+ 12,
2274
+ 9
2275
+ ],
2276
+ [
2277
+ 7,
2278
+ 43
2279
+ ],
2280
+ [
2281
+ 47,
2282
+ 18
2283
+ ]
2284
+ ],
2285
+ [
2286
+ 138,
2287
+ 740,
2288
+ 82,
2289
+ 324,
2290
+ 748,
2291
+ 988,
2292
+ 660,
2293
+ 602,
2294
+ 614,
2295
+ 838,
2296
+ 634,
2297
+ 346,
2298
+ 136,
2299
+ 126,
2300
+ 260,
2301
+ 112,
2302
+ 294,
2303
+ 668,
2304
+ 652,
2305
+ 856,
2306
+ 842,
2307
+ 858,
2308
+ 674,
2309
+ 204,
2310
+ 686,
2311
+ 212,
2312
+ 940,
2313
+ 92,
2314
+ 302,
2315
+ 780,
2316
+ 486,
2317
+ 888,
2318
+ 868,
2319
+ 564,
2320
+ 618,
2321
+ 518,
2322
+ 498,
2323
+ 358,
2324
+ 194,
2325
+ 102,
2326
+ 516,
2327
+ 694,
2328
+ 138,
2329
+ 962,
2330
+ 192,
2331
+ 118,
2332
+ 940,
2333
+ 876,
2334
+ 946
2335
+ ],
2336
+ [
2337
+ [
2338
+ 20,
2339
+ 21
2340
+ ],
2341
+ [
2342
+ 35,
2343
+ 23
2344
+ ],
2345
+ [
2346
+ 1,
2347
+ 24
2348
+ ],
2349
+ [
2350
+ 26,
2351
+ 8
2352
+ ],
2353
+ [
2354
+ 38,
2355
+ 34
2356
+ ],
2357
+ [
2358
+ 1,
2359
+ 5
2360
+ ],
2361
+ [
2362
+ 13,
2363
+ 32
2364
+ ],
2365
+ [
2366
+ 11,
2367
+ 31
2368
+ ],
2369
+ [
2370
+ 23,
2371
+ 28
2372
+ ],
2373
+ [
2374
+ 46,
2375
+ 43
2376
+ ],
2377
+ [
2378
+ 24,
2379
+ 5
2380
+ ],
2381
+ [
2382
+ 15,
2383
+ 1
2384
+ ],
2385
+ [
2386
+ 15,
2387
+ 4
2388
+ ],
2389
+ [
2390
+ 7,
2391
+ 23
2392
+ ],
2393
+ [
2394
+ 41,
2395
+ 45
2396
+ ],
2397
+ [
2398
+ 27,
2399
+ 25
2400
+ ],
2401
+ [
2402
+ 41,
2403
+ 35
2404
+ ],
2405
+ [
2406
+ 39,
2407
+ 17
2408
+ ],
2409
+ [
2410
+ 17,
2411
+ 34
2412
+ ],
2413
+ [
2414
+ 14,
2415
+ 9
2416
+ ],
2417
+ [
2418
+ 27,
2419
+ 30
2420
+ ],
2421
+ [
2422
+ 4,
2423
+ 25
2424
+ ],
2425
+ [
2426
+ 10,
2427
+ 17
2428
+ ],
2429
+ [
2430
+ 40,
2431
+ 0
2432
+ ],
2433
+ [
2434
+ 20,
2435
+ 0
2436
+ ],
2437
+ [
2438
+ 7,
2439
+ 6
2440
+ ],
2441
+ [
2442
+ 1,
2443
+ 7
2444
+ ],
2445
+ [
2446
+ 30,
2447
+ 32
2448
+ ],
2449
+ [
2450
+ 26,
2451
+ 5
2452
+ ],
2453
+ [
2454
+ 37,
2455
+ 7
2456
+ ],
2457
+ [
2458
+ 38,
2459
+ 40
2460
+ ],
2461
+ [
2462
+ 28,
2463
+ 17
2464
+ ],
2465
+ [
2466
+ 22,
2467
+ 34
2468
+ ],
2469
+ [
2470
+ 9,
2471
+ 40
2472
+ ],
2473
+ [
2474
+ 3,
2475
+ 32
2476
+ ],
2477
+ [
2478
+ 40,
2479
+ 42
2480
+ ],
2481
+ [
2482
+ 9,
2483
+ 9
2484
+ ]
2485
+ ]
2486
+ ],
2487
+ "output": 90453
2488
+ },
2489
+ {
2490
+ "input": [
2491
+ 46,
2492
+ [
2493
+ [
2494
+ 15,
2495
+ 8
2496
+ ],
2497
+ [
2498
+ 27,
2499
+ 15
2500
+ ],
2501
+ [
2502
+ 10,
2503
+ 8
2504
+ ],
2505
+ [
2506
+ 0,
2507
+ 15
2508
+ ],
2509
+ [
2510
+ 45,
2511
+ 27
2512
+ ],
2513
+ [
2514
+ 23,
2515
+ 8
2516
+ ],
2517
+ [
2518
+ 21,
2519
+ 10
2520
+ ],
2521
+ [
2522
+ 43,
2523
+ 0
2524
+ ],
2525
+ [
2526
+ 35,
2527
+ 8
2528
+ ],
2529
+ [
2530
+ 28,
2531
+ 10
2532
+ ],
2533
+ [
2534
+ 2,
2535
+ 21
2536
+ ],
2537
+ [
2538
+ 26,
2539
+ 10
2540
+ ],
2541
+ [
2542
+ 1,
2543
+ 28
2544
+ ],
2545
+ [
2546
+ 33,
2547
+ 0
2548
+ ],
2549
+ [
2550
+ 18,
2551
+ 28
2552
+ ],
2553
+ [
2554
+ 13,
2555
+ 21
2556
+ ],
2557
+ [
2558
+ 29,
2559
+ 13
2560
+ ],
2561
+ [
2562
+ 6,
2563
+ 18
2564
+ ],
2565
+ [
2566
+ 38,
2567
+ 43
2568
+ ],
2569
+ [
2570
+ 24,
2571
+ 35
2572
+ ],
2573
+ [
2574
+ 40,
2575
+ 21
2576
+ ],
2577
+ [
2578
+ 25,
2579
+ 1
2580
+ ],
2581
+ [
2582
+ 22,
2583
+ 13
2584
+ ],
2585
+ [
2586
+ 11,
2587
+ 28
2588
+ ],
2589
+ [
2590
+ 36,
2591
+ 28
2592
+ ],
2593
+ [
2594
+ 42,
2595
+ 8
2596
+ ],
2597
+ [
2598
+ 17,
2599
+ 40
2600
+ ],
2601
+ [
2602
+ 32,
2603
+ 17
2604
+ ],
2605
+ [
2606
+ 20,
2607
+ 15
2608
+ ],
2609
+ [
2610
+ 41,
2611
+ 33
2612
+ ],
2613
+ [
2614
+ 12,
2615
+ 2
2616
+ ],
2617
+ [
2618
+ 44,
2619
+ 12
2620
+ ],
2621
+ [
2622
+ 9,
2623
+ 25
2624
+ ],
2625
+ [
2626
+ 31,
2627
+ 44
2628
+ ],
2629
+ [
2630
+ 7,
2631
+ 32
2632
+ ],
2633
+ [
2634
+ 39,
2635
+ 7
2636
+ ],
2637
+ [
2638
+ 4,
2639
+ 31
2640
+ ],
2641
+ [
2642
+ 34,
2643
+ 38
2644
+ ],
2645
+ [
2646
+ 5,
2647
+ 13
2648
+ ],
2649
+ [
2650
+ 37,
2651
+ 27
2652
+ ],
2653
+ [
2654
+ 14,
2655
+ 13
2656
+ ],
2657
+ [
2658
+ 16,
2659
+ 39
2660
+ ],
2661
+ [
2662
+ 3,
2663
+ 42
2664
+ ],
2665
+ [
2666
+ 19,
2667
+ 40
2668
+ ],
2669
+ [
2670
+ 30,
2671
+ 28
2672
+ ]
2673
+ ],
2674
+ [
2675
+ 658,
2676
+ 914,
2677
+ 786,
2678
+ 418,
2679
+ 136,
2680
+ 222,
2681
+ 168,
2682
+ 300,
2683
+ 342,
2684
+ 976,
2685
+ 458,
2686
+ 590,
2687
+ 350,
2688
+ 684,
2689
+ 864,
2690
+ 820,
2691
+ 222,
2692
+ 982,
2693
+ 994,
2694
+ 374,
2695
+ 60,
2696
+ 284,
2697
+ 516,
2698
+ 686,
2699
+ 492,
2700
+ 154,
2701
+ 500,
2702
+ 158,
2703
+ 482,
2704
+ 86,
2705
+ 384,
2706
+ 384,
2707
+ 976,
2708
+ 742,
2709
+ 154,
2710
+ 570,
2711
+ 918,
2712
+ 446,
2713
+ 308,
2714
+ 626,
2715
+ 768,
2716
+ 552,
2717
+ 446,
2718
+ 470,
2719
+ 324,
2720
+ 866
2721
+ ],
2722
+ [
2723
+ [
2724
+ 2,
2725
+ 31
2726
+ ],
2727
+ [
2728
+ 13,
2729
+ 42
2730
+ ],
2731
+ [
2732
+ 22,
2733
+ 16
2734
+ ],
2735
+ [
2736
+ 37,
2737
+ 19
2738
+ ],
2739
+ [
2740
+ 4,
2741
+ 24
2742
+ ],
2743
+ [
2744
+ 6,
2745
+ 36
2746
+ ],
2747
+ [
2748
+ 29,
2749
+ 4
2750
+ ],
2751
+ [
2752
+ 18,
2753
+ 20
2754
+ ],
2755
+ [
2756
+ 24,
2757
+ 23
2758
+ ],
2759
+ [
2760
+ 7,
2761
+ 40
2762
+ ],
2763
+ [
2764
+ 14,
2765
+ 16
2766
+ ],
2767
+ [
2768
+ 43,
2769
+ 26
2770
+ ],
2771
+ [
2772
+ 41,
2773
+ 30
2774
+ ],
2775
+ [
2776
+ 19,
2777
+ 8
2778
+ ],
2779
+ [
2780
+ 11,
2781
+ 31
2782
+ ],
2783
+ [
2784
+ 9,
2785
+ 37
2786
+ ],
2787
+ [
2788
+ 9,
2789
+ 18
2790
+ ],
2791
+ [
2792
+ 39,
2793
+ 22
2794
+ ],
2795
+ [
2796
+ 2,
2797
+ 19
2798
+ ],
2799
+ [
2800
+ 37,
2801
+ 1
2802
+ ],
2803
+ [
2804
+ 6,
2805
+ 20
2806
+ ],
2807
+ [
2808
+ 14,
2809
+ 31
2810
+ ],
2811
+ [
2812
+ 31,
2813
+ 43
2814
+ ],
2815
+ [
2816
+ 5,
2817
+ 38
2818
+ ],
2819
+ [
2820
+ 1,
2821
+ 15
2822
+ ],
2823
+ [
2824
+ 17,
2825
+ 44
2826
+ ],
2827
+ [
2828
+ 19,
2829
+ 23
2830
+ ],
2831
+ [
2832
+ 24,
2833
+ 0
2834
+ ],
2835
+ [
2836
+ 25,
2837
+ 3
2838
+ ],
2839
+ [
2840
+ 34,
2841
+ 2
2842
+ ],
2843
+ [
2844
+ 29,
2845
+ 12
2846
+ ],
2847
+ [
2848
+ 1,
2849
+ 16
2850
+ ],
2851
+ [
2852
+ 39,
2853
+ 6
2854
+ ],
2855
+ [
2856
+ 34,
2857
+ 22
2858
+ ],
2859
+ [
2860
+ 39,
2861
+ 5
2862
+ ],
2863
+ [
2864
+ 14,
2865
+ 10
2866
+ ],
2867
+ [
2868
+ 0,
2869
+ 28
2870
+ ],
2871
+ [
2872
+ 17,
2873
+ 18
2874
+ ],
2875
+ [
2876
+ 19,
2877
+ 5
2878
+ ],
2879
+ [
2880
+ 2,
2881
+ 25
2882
+ ],
2883
+ [
2884
+ 5,
2885
+ 36
2886
+ ],
2887
+ [
2888
+ 20,
2889
+ 27
2890
+ ],
2891
+ [
2892
+ 5,
2893
+ 19
2894
+ ],
2895
+ [
2896
+ 6,
2897
+ 44
2898
+ ],
2899
+ [
2900
+ 8,
2901
+ 13
2902
+ ],
2903
+ [
2904
+ 30,
2905
+ 26
2906
+ ],
2907
+ [
2908
+ 35,
2909
+ 34
2910
+ ],
2911
+ [
2912
+ 31,
2913
+ 41
2914
+ ],
2915
+ [
2916
+ 44,
2917
+ 31
2918
+ ],
2919
+ [
2920
+ 24,
2921
+ 36
2922
+ ],
2923
+ [
2924
+ 9,
2925
+ 34
2926
+ ],
2927
+ [
2928
+ 36,
2929
+ 30
2930
+ ],
2931
+ [
2932
+ 34,
2933
+ 40
2934
+ ],
2935
+ [
2936
+ 27,
2937
+ 30
2938
+ ],
2939
+ [
2940
+ 10,
2941
+ 23
2942
+ ],
2943
+ [
2944
+ 1,
2945
+ 8
2946
+ ],
2947
+ [
2948
+ 16,
2949
+ 18
2950
+ ],
2951
+ [
2952
+ 0,
2953
+ 29
2954
+ ]
2955
+ ]
2956
+ ],
2957
+ "output": 137007
2958
+ },
2959
+ {
2960
+ "input": [
2961
+ 12,
2962
+ [
2963
+ [
2964
+ 9,
2965
+ 5
2966
+ ],
2967
+ [
2968
+ 8,
2969
+ 5
2970
+ ],
2971
+ [
2972
+ 4,
2973
+ 5
2974
+ ],
2975
+ [
2976
+ 1,
2977
+ 4
2978
+ ],
2979
+ [
2980
+ 7,
2981
+ 1
2982
+ ],
2983
+ [
2984
+ 0,
2985
+ 5
2986
+ ],
2987
+ [
2988
+ 6,
2989
+ 1
2990
+ ],
2991
+ [
2992
+ 10,
2993
+ 7
2994
+ ],
2995
+ [
2996
+ 2,
2997
+ 10
2998
+ ],
2999
+ [
3000
+ 3,
3001
+ 5
3002
+ ],
3003
+ [
3004
+ 11,
3005
+ 8
3006
+ ]
3007
+ ],
3008
+ [
3009
+ 384,
3010
+ 798,
3011
+ 18,
3012
+ 330,
3013
+ 838,
3014
+ 812,
3015
+ 180,
3016
+ 698,
3017
+ 816,
3018
+ 544,
3019
+ 518,
3020
+ 796
3021
+ ],
3022
+ [
3023
+ [
3024
+ 6,
3025
+ 0
3026
+ ],
3027
+ [
3028
+ 7,
3029
+ 11
3030
+ ],
3031
+ [
3032
+ 6,
3033
+ 3
3034
+ ],
3035
+ [
3036
+ 9,
3037
+ 6
3038
+ ],
3039
+ [
3040
+ 2,
3041
+ 2
3042
+ ],
3043
+ [
3044
+ 10,
3045
+ 3
3046
+ ],
3047
+ [
3048
+ 6,
3049
+ 11
3050
+ ],
3051
+ [
3052
+ 0,
3053
+ 3
3054
+ ],
3055
+ [
3056
+ 11,
3057
+ 11
3058
+ ],
3059
+ [
3060
+ 3,
3061
+ 10
3062
+ ],
3063
+ [
3064
+ 0,
3065
+ 9
3066
+ ],
3067
+ [
3068
+ 10,
3069
+ 7
3070
+ ],
3071
+ [
3072
+ 1,
3073
+ 3
3074
+ ],
3075
+ [
3076
+ 3,
3077
+ 11
3078
+ ],
3079
+ [
3080
+ 9,
3081
+ 0
3082
+ ],
3083
+ [
3084
+ 4,
3085
+ 8
3086
+ ],
3087
+ [
3088
+ 7,
3089
+ 11
3090
+ ],
3091
+ [
3092
+ 5,
3093
+ 5
3094
+ ],
3095
+ [
3096
+ 2,
3097
+ 7
3098
+ ],
3099
+ [
3100
+ 8,
3101
+ 10
3102
+ ],
3103
+ [
3104
+ 6,
3105
+ 0
3106
+ ],
3107
+ [
3108
+ 4,
3109
+ 4
3110
+ ],
3111
+ [
3112
+ 11,
3113
+ 9
3114
+ ],
3115
+ [
3116
+ 10,
3117
+ 4
3118
+ ],
3119
+ [
3120
+ 11,
3121
+ 5
3122
+ ],
3123
+ [
3124
+ 2,
3125
+ 6
3126
+ ],
3127
+ [
3128
+ 8,
3129
+ 11
3130
+ ],
3131
+ [
3132
+ 8,
3133
+ 7
3134
+ ],
3135
+ [
3136
+ 0,
3137
+ 9
3138
+ ],
3139
+ [
3140
+ 10,
3141
+ 8
3142
+ ],
3143
+ [
3144
+ 0,
3145
+ 7
3146
+ ],
3147
+ [
3148
+ 6,
3149
+ 2
3150
+ ],
3151
+ [
3152
+ 7,
3153
+ 11
3154
+ ],
3155
+ [
3156
+ 10,
3157
+ 8
3158
+ ],
3159
+ [
3160
+ 4,
3161
+ 2
3162
+ ],
3163
+ [
3164
+ 3,
3165
+ 0
3166
+ ],
3167
+ [
3168
+ 9,
3169
+ 6
3170
+ ],
3171
+ [
3172
+ 7,
3173
+ 4
3174
+ ],
3175
+ [
3176
+ 10,
3177
+ 4
3178
+ ],
3179
+ [
3180
+ 0,
3181
+ 7
3182
+ ],
3183
+ [
3184
+ 10,
3185
+ 1
3186
+ ],
3187
+ [
3188
+ 7,
3189
+ 2
3190
+ ],
3191
+ [
3192
+ 0,
3193
+ 4
3194
+ ],
3195
+ [
3196
+ 8,
3197
+ 8
3198
+ ],
3199
+ [
3200
+ 11,
3201
+ 2
3202
+ ],
3203
+ [
3204
+ 1,
3205
+ 10
3206
+ ],
3207
+ [
3208
+ 3,
3209
+ 3
3210
+ ],
3211
+ [
3212
+ 4,
3213
+ 2
3214
+ ],
3215
+ [
3216
+ 4,
3217
+ 8
3218
+ ],
3219
+ [
3220
+ 5,
3221
+ 7
3222
+ ],
3223
+ [
3224
+ 5,
3225
+ 4
3226
+ ],
3227
+ [
3228
+ 9,
3229
+ 7
3230
+ ]
3231
+ ]
3232
+ ],
3233
+ "output": 102841
3234
+ },
3235
+ {
3236
+ "input": [
3237
+ 38,
3238
+ [
3239
+ [
3240
+ 13,
3241
+ 27
3242
+ ],
3243
+ [
3244
+ 16,
3245
+ 13
3246
+ ],
3247
+ [
3248
+ 8,
3249
+ 13
3250
+ ],
3251
+ [
3252
+ 21,
3253
+ 16
3254
+ ],
3255
+ [
3256
+ 37,
3257
+ 27
3258
+ ],
3259
+ [
3260
+ 9,
3261
+ 8
3262
+ ],
3263
+ [
3264
+ 22,
3265
+ 21
3266
+ ],
3267
+ [
3268
+ 0,
3269
+ 27
3270
+ ],
3271
+ [
3272
+ 34,
3273
+ 22
3274
+ ],
3275
+ [
3276
+ 17,
3277
+ 21
3278
+ ],
3279
+ [
3280
+ 12,
3281
+ 21
3282
+ ],
3283
+ [
3284
+ 36,
3285
+ 16
3286
+ ],
3287
+ [
3288
+ 32,
3289
+ 34
3290
+ ],
3291
+ [
3292
+ 24,
3293
+ 0
3294
+ ],
3295
+ [
3296
+ 20,
3297
+ 12
3298
+ ],
3299
+ [
3300
+ 1,
3301
+ 17
3302
+ ],
3303
+ [
3304
+ 30,
3305
+ 37
3306
+ ],
3307
+ [
3308
+ 3,
3309
+ 22
3310
+ ],
3311
+ [
3312
+ 31,
3313
+ 21
3314
+ ],
3315
+ [
3316
+ 14,
3317
+ 32
3318
+ ],
3319
+ [
3320
+ 29,
3321
+ 37
3322
+ ],
3323
+ [
3324
+ 19,
3325
+ 29
3326
+ ],
3327
+ [
3328
+ 33,
3329
+ 12
3330
+ ],
3331
+ [
3332
+ 7,
3333
+ 1
3334
+ ],
3335
+ [
3336
+ 15,
3337
+ 36
3338
+ ],
3339
+ [
3340
+ 18,
3341
+ 15
3342
+ ],
3343
+ [
3344
+ 28,
3345
+ 19
3346
+ ],
3347
+ [
3348
+ 35,
3349
+ 36
3350
+ ],
3351
+ [
3352
+ 5,
3353
+ 34
3354
+ ],
3355
+ [
3356
+ 2,
3357
+ 8
3358
+ ],
3359
+ [
3360
+ 26,
3361
+ 31
3362
+ ],
3363
+ [
3364
+ 10,
3365
+ 33
3366
+ ],
3367
+ [
3368
+ 11,
3369
+ 34
3370
+ ],
3371
+ [
3372
+ 23,
3373
+ 33
3374
+ ],
3375
+ [
3376
+ 25,
3377
+ 17
3378
+ ],
3379
+ [
3380
+ 4,
3381
+ 2
3382
+ ],
3383
+ [
3384
+ 6,
3385
+ 26
3386
+ ]
3387
+ ],
3388
+ [
3389
+ 430,
3390
+ 364,
3391
+ 504,
3392
+ 852,
3393
+ 728,
3394
+ 384,
3395
+ 960,
3396
+ 644,
3397
+ 890,
3398
+ 72,
3399
+ 920,
3400
+ 980,
3401
+ 572,
3402
+ 398,
3403
+ 342,
3404
+ 790,
3405
+ 638,
3406
+ 538,
3407
+ 252,
3408
+ 276,
3409
+ 228,
3410
+ 94,
3411
+ 224,
3412
+ 416,
3413
+ 264,
3414
+ 592,
3415
+ 324,
3416
+ 314,
3417
+ 162,
3418
+ 378,
3419
+ 114,
3420
+ 280,
3421
+ 570,
3422
+ 720,
3423
+ 506,
3424
+ 982,
3425
+ 926,
3426
+ 204
3427
+ ],
3428
+ [
3429
+ [
3430
+ 25,
3431
+ 7
3432
+ ],
3433
+ [
3434
+ 30,
3435
+ 29
3436
+ ],
3437
+ [
3438
+ 22,
3439
+ 6
3440
+ ],
3441
+ [
3442
+ 20,
3443
+ 8
3444
+ ],
3445
+ [
3446
+ 10,
3447
+ 14
3448
+ ],
3449
+ [
3450
+ 18,
3451
+ 33
3452
+ ],
3453
+ [
3454
+ 33,
3455
+ 7
3456
+ ],
3457
+ [
3458
+ 0,
3459
+ 27
3460
+ ],
3461
+ [
3462
+ 15,
3463
+ 31
3464
+ ],
3465
+ [
3466
+ 25,
3467
+ 27
3468
+ ],
3469
+ [
3470
+ 14,
3471
+ 13
3472
+ ],
3473
+ [
3474
+ 21,
3475
+ 32
3476
+ ],
3477
+ [
3478
+ 3,
3479
+ 17
3480
+ ],
3481
+ [
3482
+ 31,
3483
+ 16
3484
+ ],
3485
+ [
3486
+ 32,
3487
+ 37
3488
+ ],
3489
+ [
3490
+ 10,
3491
+ 9
3492
+ ],
3493
+ [
3494
+ 11,
3495
+ 19
3496
+ ],
3497
+ [
3498
+ 18,
3499
+ 17
3500
+ ],
3501
+ [
3502
+ 30,
3503
+ 27
3504
+ ],
3505
+ [
3506
+ 7,
3507
+ 2
3508
+ ],
3509
+ [
3510
+ 34,
3511
+ 15
3512
+ ],
3513
+ [
3514
+ 30,
3515
+ 19
3516
+ ],
3517
+ [
3518
+ 9,
3519
+ 29
3520
+ ]
3521
+ ]
3522
+ ],
3523
+ "output": 39537
3524
+ }
3525
+ ],
3526
+ "haskell_template": "minimumTotalPrice :: Int -> [[Int]] -> [Int] -> [[Int]] -> Int\nminimumTotalPrice n edges price trips ",
3527
+ "ocaml_template": "let minimumTotalPrice (n: int) (edges: int list list) (price: int list) (trips: int list list) : int = ",
3528
+ "scala_template": "def minimumTotalPrice(n: Int,edges: List[List[Int]],price: List[Int],trips: List[List[Int]]): Int = { \n \n}",
3529
+ "java_template": "public static int minimumTotalPrice(int n, List<List<Integer>> edges, List<Integer> price, List<List<Integer>> trips) {\n\n}",
3530
+ "python_template": "class Solution(object):\n def minimumTotalPrice(self, n, edges, price, trips):\n \"\"\"\n :type n: int\n :type edges: List[List[int]]\n :type price: List[int]\n :type trips: List[List[int]]\n :rtype: int\n \"\"\"\n "
3531
+ }
minimize_the_total_price_of_the_trips/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 23 (minimumTotalPrice 4 [[0;1];[1;2];[1;3]] [2;2;10;6] [[0;3];[2;1];[2;3]])
12
+
13
+ let test2 _ = assert_equal 1 (minimumTotalPrice 2 [[0;1]] [2;2] [[0;0]])
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for minimumTotalPrice" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
minimize_the_total_price_of_the_trips/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.minimumTotalPrice(4,List(List(0,1),List(1,2),List(1,3)),List(2,2,10,6),List(List(0,3),List(2,1),List(2,3))), 23)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.minimumTotalPrice(2,List(List(0,1)),List(2,2),List(List(0,0))), 1)
10
+ }
11
+
12
+ }
minimize_xor/.DS_Store ADDED
Binary file (6.15 kB). View file
 
minimize_xor/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 (minimizeXor 3 5)," 3 (minimizeXor 3 5))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (minimizeXor 1 12)," 3 (minimizeXor 1 12))
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
minimize_xor/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(3, minimizeXor(3, 5));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(3, minimizeXor(1, 12));
19
+ }
20
+
21
+ }
minimize_xor/meta.json ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2509,
3
+ "name": "minimize_xor",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/minimize-xor/",
6
+ "date": "1664064000000",
7
+ "task_description": "Given two positive integers `num1` and `num2`, find the positive integer `x` such that: `x` has the same number of set bits as `num2`, and The value `x XOR num1` is **minimal**. Note that `XOR` is the bitwise XOR operation. Return _the integer _`x`. The test cases are generated such that `x` is **uniquely determined**. The number of **set bits** of an integer is the number of `1`'s in its binary representation. **Example 1:** ``` **Input:** num1 = 3, num2 = 5 **Output:** 3 **Explanation:** The binary representations of num1 and num2 are 0011 and 0101, respectively. The integer **3** has the same number of set bits as num2, and the value `3 XOR 3 = 0` is minimal. ``` **Example 2:** ``` **Input:** num1 = 1, num2 = 12 **Output:** 3 **Explanation:** The binary representations of num1 and num2 are 0001 and 1100, respectively. The integer **3** has the same number of set bits as num2, and the value `3 XOR 1 = 2` is minimal. ``` **Constraints:** `1 <= num1, num2 <= 109`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "num1 = 3, num2 = 5",
12
+ "output": "3 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "num1 = 1, num2 = 12",
17
+ "output": "3 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 72176727,
24
+ 770164438
25
+ ],
26
+ "output": 72179711
27
+ },
28
+ {
29
+ "input": [
30
+ 468575171,
31
+ 27444322
32
+ ],
33
+ "output": 468516864
34
+ },
35
+ {
36
+ "input": [
37
+ 222127838,
38
+ 599095754
39
+ ],
40
+ "output": 222127836
41
+ },
42
+ {
43
+ "input": [
44
+ 507580866,
45
+ 282877334
46
+ ],
47
+ "output": 507580895
48
+ },
49
+ {
50
+ "input": [
51
+ 668869429,
52
+ 942725715
53
+ ],
54
+ "output": 668869408
55
+ },
56
+ {
57
+ "input": [
58
+ 117649255,
59
+ 771918934
60
+ ],
61
+ "output": 117649248
62
+ },
63
+ {
64
+ "input": [
65
+ 295349101,
66
+ 628704578
67
+ ],
68
+ "output": 295349088
69
+ },
70
+ {
71
+ "input": [
72
+ 98205273,
73
+ 230406736
74
+ ],
75
+ "output": 98205272
76
+ },
77
+ {
78
+ "input": [
79
+ 711548599,
80
+ 865594601
81
+ ],
82
+ "output": 711548607
83
+ },
84
+ {
85
+ "input": [
86
+ 394257872,
87
+ 81713535
88
+ ],
89
+ "output": 394257872
90
+ }
91
+ ],
92
+ "haskell_template": "minimizeXor :: Int -> Int -> Int\nminimizeXor num1 num2 ",
93
+ "ocaml_template": "let minimizeXor (num1: int) (num2: int) : int = ",
94
+ "scala_template": "def minimizeXor(num1: Int,num2: Int): Int = { \n \n}",
95
+ "java_template": "public static int minimizeXor(int num1, int num2) {\n\n}",
96
+ "python_template": "class Solution(object):\n def minimizeXor(self, num1, num2):\n \"\"\"\n :type num1: int\n :type num2: int\n :rtype: int\n \"\"\"\n "
97
+ }
minimize_xor/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 3 (minimizeXor 3 5)
12
+
13
+ let test2 _ = assert_equal 3 (minimizeXor 1 12)
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for minimizeXor" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
minimize_xor/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.minimizeXor(3,5), 3)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.minimizeXor(1,12), 3)
10
+ }
11
+
12
+ }
minimum_absolute_difference_between_elements_with_constraint/.DS_Store ADDED
Binary file (6.15 kB). View file
 
minimum_absolute_difference_between_elements_with_constraint/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 (minAbsoluteDifference [4,3,2,4] 2)," 0 (minAbsoluteDifference [4,3,2,4] 2))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (minAbsoluteDifference [5,3,2,10,15] 1)," 1 (minAbsoluteDifference [5,3,2,10,15] 1))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (minAbsoluteDifference [1,2,3,4] 3)," 3 (minAbsoluteDifference [1,2,3,4] 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_absolute_difference_between_elements_with_constraint/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(0, minAbsoluteDifference(new ArrayList<>(Arrays.asList(4,3,2,4)), 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(1, minAbsoluteDifference(new ArrayList<>(Arrays.asList(5,3,2,10,15)), 1));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(3, minAbsoluteDifference(new ArrayList<>(Arrays.asList(1,2,3,4)), 3));
23
+ }
24
+
25
+ }
minimum_absolute_difference_between_elements_with_constraint/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:039f5fd0551319389c2e7013e8d4b8bf1ade9298726f39ce5770368d5f3a6d69
3
+ size 16716244
minimum_absolute_difference_between_elements_with_constraint/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 0 (minAbsoluteDifference [4;3;2;4] 2)
12
+
13
+ let test2 _ = assert_equal 1 (minAbsoluteDifference [5;3;2;10;15] 1)
14
+
15
+ let test3 _ = assert_equal 3 (minAbsoluteDifference [1;2;3;4] 3)
16
+
17
+
18
+ (* Grouping test cases *)
19
+ let suite = "Test Suite for minAbsoluteDifference" >::: [
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_absolute_difference_between_elements_with_constraint/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.minAbsoluteDifference(List(4,3,2,4),2), 0)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.minAbsoluteDifference(List(5,3,2,10,15),1), 1)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.minAbsoluteDifference(List(1,2,3,4),3), 3)
14
+ }
15
+
16
+ }
minimum_additions_to_make_valid_string/.DS_Store ADDED
Binary file (6.15 kB). View file
 
minimum_additions_to_make_valid_string/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 (addMinimum \"b \")," 2 (addMinimum "b"))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (addMinimum \"aaa \")," 6 (addMinimum "aaa"))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (addMinimum \"abc \")," 0 (addMinimum "abc"))
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_additions_to_make_valid_string/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(2, addMinimum("b"));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(6, addMinimum("aaa"));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(0, addMinimum("abc"));
23
+ }
24
+
25
+ }
minimum_additions_to_make_valid_string/meta.json ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2736,
3
+ "name": "minimum_additions_to_make_valid_string",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/minimum-additions-to-make-valid-string/",
6
+ "date": "1680998400000",
7
+ "task_description": "Given a string `word` to which you can insert letters \"a\", \"b\" or \"c\" anywhere and any number of times, return _the minimum number of letters that must be inserted so that `word` becomes **valid**._ A string is called **valid **if it can be formed by concatenating the string \"abc\" several times. **Example 1:** ``` **Input:** word = \"b\" **Output:** 2 **Explanation:** Insert the letter \"a\" right before \"b\", and the letter \"c\" right next to \"b\" to obtain the valid string \"**a**b**c**\". ``` **Example 2:** ``` **Input:** word = \"aaa\" **Output:** 6 **Explanation:** Insert letters \"b\" and \"c\" next to each \"a\" to obtain the valid string \"a**bc**a**bc**a**bc**\". ``` **Example 3:** ``` **Input:** word = \"abc\" **Output:** 0 **Explanation:** word is already valid. No modifications are needed. ``` **Constraints:** `1 <= word.length <= 50` `word` consists of letters \"a\", \"b\" and \"c\" only.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "word = \"b\"",
12
+ "output": "2 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "word = \"aaa\"",
17
+ "output": "6 "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "word = \"abc\"",
22
+ "output": "0 "
23
+ }
24
+ ],
25
+ "private_test_cases": [
26
+ {
27
+ "input": "bcbbcccbabacaacbacbababcccb",
28
+ "output": 27
29
+ },
30
+ {
31
+ "input": "aabbbbbabaacbbaccabaabccacaccbccbccccbaabcac",
32
+ "output": 46
33
+ },
34
+ {
35
+ "input": "ccaabcbc",
36
+ "output": 7
37
+ },
38
+ {
39
+ "input": "bbbbbcbcbbbcabcbbbabacaabccbbbca",
40
+ "output": 34
41
+ },
42
+ {
43
+ "input": "bcbccbccababccbccbbabc",
44
+ "output": 17
45
+ },
46
+ {
47
+ "input": "bbcaccabbbcbcbbcaabcacacbbbccacabbabcbaacbbaaacaac",
48
+ "output": 46
49
+ },
50
+ {
51
+ "input": "bcaabaabacbcbacbcacacabcccacacabbbabbacbbaabcbaba",
52
+ "output": 41
53
+ },
54
+ {
55
+ "input": "ccbcbabacacbbaaaaabbcaabccbabacabacaacb",
56
+ "output": 39
57
+ },
58
+ {
59
+ "input": "bbcbbbcbbabccbaacabaccbcbcbbbbacccbbbabccbaa",
60
+ "output": 52
61
+ },
62
+ {
63
+ "input": "cabcaaaabababbcab",
64
+ "output": 13
65
+ }
66
+ ],
67
+ "haskell_template": "addMinimum :: String -> Int\naddMinimum word ",
68
+ "ocaml_template": "let addMinimum (word: string) : int = ",
69
+ "scala_template": "def addMinimum(word: String): Int = { \n \n}",
70
+ "java_template": "public static int addMinimum(String word) {\n\n}",
71
+ "python_template": "class Solution(object):\n def addMinimum(self, word):\n \"\"\"\n :type word: str\n :rtype: int\n \"\"\"\n "
72
+ }
minimum_additions_to_make_valid_string/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 2 (addMinimum "b")
12
+
13
+ let test2 _ = assert_equal 6 (addMinimum "aaa")
14
+
15
+ let test3 _ = assert_equal 0 (addMinimum "abc")
16
+
17
+
18
+ (* Grouping test cases *)
19
+ let suite = "Test Suite for addMinimum" >::: [
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_additions_to_make_valid_string/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.addMinimum("b"), 2)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.addMinimum("aaa"), 6)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.addMinimum("abc"), 0)
14
+ }
15
+
16
+ }
minimum_amount_of_time_to_collect_garbage/.DS_Store ADDED
Binary file (6.15 kB). View file
 
minimum_amount_of_time_to_collect_garbage/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 (garbageCollection [ \"G \", \"P \", \"GP \", \"GG \"] [2,4,3])," 21 (garbageCollection ["G","P","GP","GG"] [2,4,3]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (garbageCollection [ \"MMM \", \"PGM \", \"GP \"] [3,10])," 37 (garbageCollection ["MMM","PGM","GP"] [3,10]))
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_amount_of_time_to_collect_garbage/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(21, garbageCollection(new ArrayList<>(Arrays.asList("G","P","GP","GG")), new ArrayList<>(Arrays.asList(2,4,3))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(37, garbageCollection(new ArrayList<>(Arrays.asList("MMM","PGM","GP")), new ArrayList<>(Arrays.asList(3,10))));
19
+ }
20
+
21
+ }
minimum_amount_of_time_to_collect_garbage/meta.json ADDED
@@ -0,0 +1,1221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2471,
3
+ "name": "minimum_amount_of_time_to_collect_garbage",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/minimum-amount-of-time-to-collect-garbage/",
6
+ "date": "1661040000000",
7
+ "task_description": "You are given a **0-indexed** array of strings `garbage` where `garbage[i]` represents the assortment of garbage at the `ith` house. `garbage[i]` consists only of the characters `'M'`, `'P'` and `'G'` representing one unit of metal, paper and glass garbage respectively. Picking up **one** unit of any type of garbage takes `1` minute. You are also given a **0-indexed** integer array `travel` where `travel[i]` is the number of minutes needed to go from house `i` to house `i + 1`. There are three garbage trucks in the city, each responsible for picking up one type of garbage. Each garbage truck starts at house `0` and must visit each house **in order**; however, they do **not** need to visit every house. Only **one** garbage truck may be used at any given moment. While one truck is driving or picking up garbage, the other two trucks **cannot** do anything. Return_ the **minimum** number of minutes needed to pick up all the garbage._ **Example 1:** ``` **Input:** garbage = [\"G\",\"P\",\"GP\",\"GG\"], travel = [2,4,3] **Output:** 21 **Explanation:** The paper garbage truck: 1. Travels from house 0 to house 1 2. Collects the paper garbage at house 1 3. Travels from house 1 to house 2 4. Collects the paper garbage at house 2 Altogether, it takes 8 minutes to pick up all the paper garbage. The glass garbage truck: 1. Collects the glass garbage at house 0 2. Travels from house 0 to house 1 3. Travels from house 1 to house 2 4. Collects the glass garbage at house 2 5. Travels from house 2 to house 3 6. Collects the glass garbage at house 3 Altogether, it takes 13 minutes to pick up all the glass garbage. Since there is no metal garbage, we do not need to consider the metal garbage truck. Therefore, it takes a total of 8 + 13 = 21 minutes to collect all the garbage. ``` **Example 2:** ``` **Input:** garbage = [\"MMM\",\"PGM\",\"GP\"], travel = [3,10] **Output:** 37 **Explanation:** The metal garbage truck takes 7 minutes to pick up all the metal garbage. The paper garbage truck takes 15 minutes to pick up all the paper garbage. The glass garbage truck takes 15 minutes to pick up all the glass garbage. It takes a total of 7 + 15 + 15 = 37 minutes to collect all the garbage. ``` **Constraints:** `2 <= garbage.length <= 105` `garbage[i]` consists of only the letters `'M'`, `'P'`, and `'G'`. `1 <= garbage[i].length <= 10` `travel.length == garbage.length - 1` `1 <= travel[i] <= 100`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "garbage = [\"G\",\"P\",\"GP\",\"GG\"], travel = [2,4,3]",
12
+ "output": "21 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "garbage = [\"MMM\",\"PGM\",\"GP\"], travel = [3,10]",
17
+ "output": "37 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ [
24
+ "GMPMGG",
25
+ "PMMGM",
26
+ "PMPPMMGGG",
27
+ "MGPPPPGGG",
28
+ "M",
29
+ "MM",
30
+ "MP",
31
+ "PG",
32
+ "GMGGGGMGG",
33
+ "PMPMMGP",
34
+ "PPGPMGGM",
35
+ "PMM",
36
+ "MGGPM",
37
+ "MPPGMMGGMP",
38
+ "MPMPPGMM",
39
+ "MGMGPMG",
40
+ "PGMGMGP",
41
+ "GMPM",
42
+ "MPMPPMMGG",
43
+ "PMPMMMMGGP",
44
+ "MPMPPMMGMP",
45
+ "MGMMMGPMM",
46
+ "M",
47
+ "PGMMMMPPM",
48
+ "MPP",
49
+ "GGGMMPGMM",
50
+ "MPGMMMMMGP",
51
+ "PMM",
52
+ "MPPGGG",
53
+ "MPMP",
54
+ "PGMGMGPM",
55
+ "PMPGPMGGMM",
56
+ "PGMMGPPMM",
57
+ "PPGG",
58
+ "GGP",
59
+ "M",
60
+ "GMMGMP",
61
+ "M",
62
+ "PMGP",
63
+ "MMGPPPG",
64
+ "P",
65
+ "PMMPGGP",
66
+ "PPMPGP"
67
+ ],
68
+ [
69
+ 81,
70
+ 84,
71
+ 97,
72
+ 196,
73
+ 236,
74
+ 294,
75
+ 358,
76
+ 444,
77
+ 521,
78
+ 549,
79
+ 627,
80
+ 655,
81
+ 656,
82
+ 714,
83
+ 722,
84
+ 723,
85
+ 757,
86
+ 798,
87
+ 801,
88
+ 827,
89
+ 872,
90
+ 890,
91
+ 946,
92
+ 974,
93
+ 1069,
94
+ 1156,
95
+ 1247,
96
+ 1328,
97
+ 1410,
98
+ 1486,
99
+ 1576,
100
+ 1626,
101
+ 1726,
102
+ 1804,
103
+ 1878,
104
+ 1917,
105
+ 1956,
106
+ 2055,
107
+ 2094,
108
+ 2192,
109
+ 2209,
110
+ 2231
111
+ ]
112
+ ],
113
+ "output": 6947
114
+ },
115
+ {
116
+ "input": [
117
+ [
118
+ "PG",
119
+ "PMPMMPMPM",
120
+ "MMPPGGPP",
121
+ "MGGGMMP",
122
+ "GPMMM",
123
+ "G",
124
+ "PGGP",
125
+ "MMGPP",
126
+ "P",
127
+ "GPGMGMPGGP",
128
+ "MMM",
129
+ "MPP",
130
+ "GP",
131
+ "GP",
132
+ "GPPPGMM",
133
+ "PMPGMPPG",
134
+ "G",
135
+ "G",
136
+ "GPMMPMMG",
137
+ "P",
138
+ "G",
139
+ "GMG",
140
+ "PGGMG",
141
+ "PMPMGPGPGP",
142
+ "GG",
143
+ "PGG",
144
+ "MMGMGPGPGP",
145
+ "GGPGMGGMPP",
146
+ "PMMPMGPGP",
147
+ "PPGGGMPGP",
148
+ "PPMMM",
149
+ "MGPMPP",
150
+ "MMPG",
151
+ "MGMGPM",
152
+ "GPMGPPPM",
153
+ "MMG",
154
+ "GP",
155
+ "GGGPMPMG",
156
+ "PPPGGPG",
157
+ "MPPPMGMP",
158
+ "PMMP",
159
+ "GGPMGGPPM",
160
+ "PPMMGPG",
161
+ "MP",
162
+ "MGMMGMG",
163
+ "GPGGPPPGP",
164
+ "MPGPPGGGM",
165
+ "M",
166
+ "MPPPMPPGM",
167
+ "MPGP",
168
+ "GPGGGP",
169
+ "MPMGM",
170
+ "PPMGMMMGPP",
171
+ "PGP",
172
+ "MM",
173
+ "MMMM",
174
+ "GPGMMMGG",
175
+ "MGMGPMPG",
176
+ "GG",
177
+ "PMGPMM",
178
+ "GPPMMGGGGG",
179
+ "MMMGGG",
180
+ "G",
181
+ "MGGG",
182
+ "GGPPGM",
183
+ "MGGMGGGGM",
184
+ "MPPPPGGPMM",
185
+ "PMPMPM",
186
+ "PMMGGPMP",
187
+ "PGGG",
188
+ "MPMGPPPP",
189
+ "MGMM",
190
+ "MPGPGPMPM",
191
+ "MMMGM",
192
+ "MPGPMMP",
193
+ "GPPGGMM",
194
+ "MGGGM",
195
+ "MPGPGPPPMG",
196
+ "GGPGGGG",
197
+ "MMM",
198
+ "MMMMG",
199
+ "GMGPMPGMMG",
200
+ "M",
201
+ "PPGMMM"
202
+ ],
203
+ [
204
+ 12,
205
+ 49,
206
+ 72,
207
+ 155,
208
+ 255,
209
+ 262,
210
+ 263,
211
+ 276,
212
+ 354,
213
+ 394,
214
+ 491,
215
+ 585,
216
+ 590,
217
+ 668,
218
+ 732,
219
+ 748,
220
+ 824,
221
+ 857,
222
+ 894,
223
+ 937,
224
+ 1028,
225
+ 1095,
226
+ 1107,
227
+ 1167,
228
+ 1229,
229
+ 1328,
230
+ 1428,
231
+ 1524,
232
+ 1616,
233
+ 1716,
234
+ 1730,
235
+ 1828,
236
+ 1928,
237
+ 1963,
238
+ 2029,
239
+ 2117,
240
+ 2160,
241
+ 2218,
242
+ 2276,
243
+ 2361,
244
+ 2375,
245
+ 2440,
246
+ 2459,
247
+ 2513,
248
+ 2588,
249
+ 2649,
250
+ 2749,
251
+ 2793,
252
+ 2819,
253
+ 2865,
254
+ 2894,
255
+ 2928,
256
+ 2967,
257
+ 3025,
258
+ 3069,
259
+ 3128,
260
+ 3166,
261
+ 3266,
262
+ 3274,
263
+ 3318,
264
+ 3356,
265
+ 3379,
266
+ 3472,
267
+ 3551,
268
+ 3577,
269
+ 3620,
270
+ 3638,
271
+ 3693,
272
+ 3719,
273
+ 3731,
274
+ 3749,
275
+ 3779,
276
+ 3829,
277
+ 3838,
278
+ 3860,
279
+ 3893,
280
+ 3977,
281
+ 4057,
282
+ 4145,
283
+ 4209,
284
+ 4244,
285
+ 4301,
286
+ 4341
287
+ ]
288
+ ],
289
+ "output": 13496
290
+ },
291
+ {
292
+ "input": [
293
+ [
294
+ "MGPMMPGG",
295
+ "MGMMGGM",
296
+ "PGGGGPMGMM",
297
+ "GMPPMPPPPM",
298
+ "GPMPPPMPGP",
299
+ "MGPGPM",
300
+ "GGGMPGM",
301
+ "MPPMPGP",
302
+ "GMG",
303
+ "PPPGPGMGPP",
304
+ "MM",
305
+ "MMMGMG",
306
+ "GGGMPPPGGG",
307
+ "PMMPMPMPM",
308
+ "PPMMGPMGGG",
309
+ "G",
310
+ "MP",
311
+ "PGPGPMG",
312
+ "PPMPGGM",
313
+ "MM",
314
+ "MPPPMPGMP",
315
+ "MGMMPP",
316
+ "PMPM",
317
+ "MPGGGGGGMM",
318
+ "MGP",
319
+ "P",
320
+ "MGGPGGPMM",
321
+ "PMGMMPGMGP",
322
+ "MGGGGGP",
323
+ "PGPMMGG",
324
+ "GMP",
325
+ "PPMGPMMGMP",
326
+ "PMP",
327
+ "MPPGGMM",
328
+ "PGPPG",
329
+ "MGGGPGMP",
330
+ "GPGPP",
331
+ "PG",
332
+ "GMPPPGGGM",
333
+ "GGGGPPGPGM",
334
+ "GPPMPGPMM",
335
+ "PMGGP",
336
+ "PGMGPM",
337
+ "GMMMMPM",
338
+ "GMM",
339
+ "GMMGGPM",
340
+ "PGP",
341
+ "MG",
342
+ "MMMMMMGG",
343
+ "PPMMMGM",
344
+ "GPPPG",
345
+ "PPGGPGPGP",
346
+ "GGMGMP",
347
+ "GMMMPPGPM",
348
+ "MGP",
349
+ "MGP",
350
+ "MGMGMMMGM",
351
+ "PMGGMGP",
352
+ "GMGGP",
353
+ "PMMMMPGM",
354
+ "GPPP",
355
+ "MMGPMMPMPM",
356
+ "MGP",
357
+ "MMMM",
358
+ "PGM",
359
+ "MGPMPMMPP",
360
+ "MMGMPG",
361
+ "PGMMPMGPMM",
362
+ "GPPMGMMG",
363
+ "MPG",
364
+ "P",
365
+ "MGPPMPGPG",
366
+ "GPPMPGG",
367
+ "GPMGM",
368
+ "GPGGGPGPP"
369
+ ],
370
+ [
371
+ 23,
372
+ 123,
373
+ 147,
374
+ 157,
375
+ 188,
376
+ 287,
377
+ 348,
378
+ 441,
379
+ 459,
380
+ 531,
381
+ 559,
382
+ 579,
383
+ 665,
384
+ 686,
385
+ 693,
386
+ 724,
387
+ 746,
388
+ 792,
389
+ 868,
390
+ 884,
391
+ 906,
392
+ 971,
393
+ 990,
394
+ 1036,
395
+ 1090,
396
+ 1097,
397
+ 1168,
398
+ 1170,
399
+ 1201,
400
+ 1263,
401
+ 1339,
402
+ 1426,
403
+ 1485,
404
+ 1504,
405
+ 1537,
406
+ 1561,
407
+ 1606,
408
+ 1681,
409
+ 1684,
410
+ 1769,
411
+ 1838,
412
+ 1861,
413
+ 1891,
414
+ 1928,
415
+ 1994,
416
+ 2083,
417
+ 2168,
418
+ 2191,
419
+ 2228,
420
+ 2297,
421
+ 2389,
422
+ 2432,
423
+ 2440,
424
+ 2490,
425
+ 2579,
426
+ 2660,
427
+ 2734,
428
+ 2786,
429
+ 2849,
430
+ 2906,
431
+ 2935,
432
+ 3016,
433
+ 3069,
434
+ 3133,
435
+ 3207,
436
+ 3256,
437
+ 3259,
438
+ 3334,
439
+ 3392,
440
+ 3444,
441
+ 3462,
442
+ 3530,
443
+ 3610,
444
+ 3710
445
+ ]
446
+ ],
447
+ "output": 11504
448
+ },
449
+ {
450
+ "input": [
451
+ [
452
+ "GMPMPMPM",
453
+ "PMM",
454
+ "PPG",
455
+ "PGMMPPMPMP",
456
+ "GMM",
457
+ "MGPPGPGPM",
458
+ "PM",
459
+ "PMGPP",
460
+ "G",
461
+ "MMGG",
462
+ "P",
463
+ "MPMMP",
464
+ "PGMPPGPP",
465
+ "MGMPGPMPP",
466
+ "PMGMGMMMGM",
467
+ "MMPGMGMMMM",
468
+ "PGPPPMMMP",
469
+ "GP",
470
+ "PPM",
471
+ "GPMMPG"
472
+ ],
473
+ [
474
+ 68,
475
+ 94,
476
+ 132,
477
+ 193,
478
+ 242,
479
+ 284,
480
+ 372,
481
+ 386,
482
+ 486,
483
+ 487,
484
+ 557,
485
+ 618,
486
+ 637,
487
+ 676,
488
+ 679,
489
+ 770,
490
+ 783,
491
+ 832,
492
+ 917
493
+ ]
494
+ ],
495
+ "output": 2862
496
+ },
497
+ {
498
+ "input": [
499
+ [
500
+ "PGGMPPGG",
501
+ "GGMPPM",
502
+ "PP",
503
+ "MGMPMGG",
504
+ "MGPGMMG",
505
+ "MPPPMGG",
506
+ "MPG",
507
+ "PMPMG",
508
+ "M",
509
+ "MMMPGGMPGM",
510
+ "GMMGPG",
511
+ "GMGMM",
512
+ "PP",
513
+ "GMMPMPGMP",
514
+ "MGGPGPGMG",
515
+ "GMM",
516
+ "MPGMMPM",
517
+ "MMPGMGPPMG",
518
+ "PPPMGPMMG",
519
+ "M",
520
+ "MGGGMGM",
521
+ "GP",
522
+ "GMMPG",
523
+ "MPPPPG",
524
+ "PGPPGGG",
525
+ "GMP",
526
+ "PPGGPMGP",
527
+ "MGGGMP",
528
+ "M",
529
+ "P",
530
+ "MGMG",
531
+ "MMPMGGMMM",
532
+ "GGMM",
533
+ "GPGGMPPMGG",
534
+ "PG",
535
+ "PGGG",
536
+ "GPMGPP",
537
+ "PG",
538
+ "PPPGMMPGP",
539
+ "PGPPPMGG",
540
+ "PGM",
541
+ "GMMPMGMPGP",
542
+ "PGMPGPPG",
543
+ "MGG",
544
+ "PGMPG",
545
+ "MPMPGGGMM",
546
+ "PMMGPP",
547
+ "G",
548
+ "MGGM",
549
+ "P",
550
+ "MGGPMGPG",
551
+ "GM",
552
+ "GMPMMPM",
553
+ "GGGGMGM",
554
+ "PPGGPPGM",
555
+ "PGMPMMM",
556
+ "PPGGM",
557
+ "GGGM",
558
+ "PPGGMGPPM",
559
+ "P",
560
+ "PPGMPMGPPG",
561
+ "MPMMGGGGP",
562
+ "MGPGM",
563
+ "MMPMGGGMMP",
564
+ "GMPM",
565
+ "GGG",
566
+ "MMMG",
567
+ "GPGGMPGMP",
568
+ "PPP",
569
+ "MGMPM",
570
+ "MGMPGMMPG"
571
+ ],
572
+ [
573
+ 18,
574
+ 48,
575
+ 135,
576
+ 198,
577
+ 282,
578
+ 327,
579
+ 331,
580
+ 431,
581
+ 498,
582
+ 540,
583
+ 548,
584
+ 613,
585
+ 696,
586
+ 751,
587
+ 820,
588
+ 852,
589
+ 893,
590
+ 936,
591
+ 1004,
592
+ 1079,
593
+ 1172,
594
+ 1227,
595
+ 1259,
596
+ 1312,
597
+ 1380,
598
+ 1443,
599
+ 1486,
600
+ 1488,
601
+ 1518,
602
+ 1613,
603
+ 1678,
604
+ 1762,
605
+ 1765,
606
+ 1786,
607
+ 1844,
608
+ 1875,
609
+ 1878,
610
+ 1915,
611
+ 1927,
612
+ 1928,
613
+ 1944,
614
+ 2010,
615
+ 2107,
616
+ 2146,
617
+ 2172,
618
+ 2207,
619
+ 2274,
620
+ 2365,
621
+ 2369,
622
+ 2405,
623
+ 2465,
624
+ 2543,
625
+ 2634,
626
+ 2732,
627
+ 2819,
628
+ 2917,
629
+ 2985,
630
+ 3023,
631
+ 3034,
632
+ 3104,
633
+ 3204,
634
+ 3259,
635
+ 3346,
636
+ 3359,
637
+ 3385,
638
+ 3386,
639
+ 3464,
640
+ 3510,
641
+ 3604,
642
+ 3686
643
+ ]
644
+ ],
645
+ "output": 11458
646
+ },
647
+ {
648
+ "input": [
649
+ [
650
+ "M",
651
+ "PMGGPGGGMP",
652
+ "GGMGPM",
653
+ "GMGPPGPGMM",
654
+ "MGG",
655
+ "PGPP",
656
+ "PPPM",
657
+ "GPGPG",
658
+ "PMMPPPPG",
659
+ "MMPGGPP",
660
+ "PGGPPMP",
661
+ "MM",
662
+ "PPPG",
663
+ "MPPM",
664
+ "G",
665
+ "GMMMPGMMPG",
666
+ "M",
667
+ "P",
668
+ "GPPP",
669
+ "PMG",
670
+ "PMPGGGP",
671
+ "M",
672
+ "GPGGPMPP",
673
+ "GM",
674
+ "PGMGPPMP",
675
+ "PGGGMGPMG",
676
+ "MGPM",
677
+ "MMMMGPMPMG",
678
+ "MPMPPP",
679
+ "MP",
680
+ "MMGPMPMMPG",
681
+ "MMGPGPPPPM",
682
+ "GPMPMG",
683
+ "PP",
684
+ "MPMG"
685
+ ],
686
+ [
687
+ 41,
688
+ 138,
689
+ 207,
690
+ 212,
691
+ 289,
692
+ 333,
693
+ 409,
694
+ 475,
695
+ 574,
696
+ 659,
697
+ 696,
698
+ 760,
699
+ 808,
700
+ 872,
701
+ 972,
702
+ 1056,
703
+ 1134,
704
+ 1222,
705
+ 1276,
706
+ 1360,
707
+ 1452,
708
+ 1510,
709
+ 1532,
710
+ 1592,
711
+ 1610,
712
+ 1695,
713
+ 1717,
714
+ 1734,
715
+ 1766,
716
+ 1859,
717
+ 1943,
718
+ 1950,
719
+ 2047,
720
+ 2113
721
+ ]
722
+ ],
723
+ "output": 6523
724
+ },
725
+ {
726
+ "input": [
727
+ [
728
+ "GMMMP",
729
+ "G",
730
+ "GGPGGMGMPG",
731
+ "GMMM",
732
+ "GGP",
733
+ "PMP",
734
+ "M",
735
+ "GPPGGPP",
736
+ "PMGPPMP",
737
+ "MMM",
738
+ "P",
739
+ "MMG",
740
+ "GMPGGM",
741
+ "P",
742
+ "PGGGGPG",
743
+ "GPPPPMMPGP",
744
+ "PPG",
745
+ "PMGP",
746
+ "PGMMP",
747
+ "GMPG",
748
+ "MMP",
749
+ "MPMMGMMM",
750
+ "PMGGPGP",
751
+ "GPPPMP",
752
+ "G",
753
+ "GGMGP",
754
+ "GGMGMGP",
755
+ "GGPMP",
756
+ "PGMP",
757
+ "MGMPMG",
758
+ "MPPG",
759
+ "PPGPGPMP",
760
+ "PM",
761
+ "MGPGGG",
762
+ "GPPPG",
763
+ "GPGPP",
764
+ "MGMMPGG",
765
+ "MPMGPPM",
766
+ "GGMMGMMM",
767
+ "MGMPGM",
768
+ "GMMMMPP",
769
+ "P",
770
+ "MP",
771
+ "MMPGGPPMP",
772
+ "MPP",
773
+ "MPMPPGGPM",
774
+ "PM",
775
+ "P",
776
+ "PPMGGP",
777
+ "P",
778
+ "MPGPGPMM",
779
+ "MM",
780
+ "G",
781
+ "PPGPPMGG",
782
+ "MP",
783
+ "GMPG",
784
+ "MGGGGMMGGP",
785
+ "M",
786
+ "MPPP",
787
+ "GGGMMG",
788
+ "PMPM",
789
+ "GMPPMGPGG",
790
+ "PPMGG",
791
+ "MP",
792
+ "MGGGPP",
793
+ "MMMGMGG",
794
+ "MMPMGM",
795
+ "P",
796
+ "GMPMMMGMP",
797
+ "GPPMMMMGMM",
798
+ "MPGPPP",
799
+ "MMG",
800
+ "PPPMP",
801
+ "GGMGPMGGMP",
802
+ "PMMGGGGGG",
803
+ "GGGGGGPGG",
804
+ "MMMMPM",
805
+ "GPMGPPMMPG",
806
+ "G",
807
+ "MMGPMM",
808
+ "GG",
809
+ "PMGMPGMPM",
810
+ "MGM",
811
+ "PGMPMPGMG",
812
+ "M",
813
+ "MGPGGGM",
814
+ "MGMMPPG",
815
+ "GGPPMPGP",
816
+ "G",
817
+ "GMPM",
818
+ "PPPGMMMPP",
819
+ "MPMPPPGPP",
820
+ "PGP",
821
+ "GPGPMGGG",
822
+ "GMMMMGGP",
823
+ "GMMGPGPM",
824
+ "MG",
825
+ "M",
826
+ "MP"
827
+ ],
828
+ [
829
+ 85,
830
+ 162,
831
+ 210,
832
+ 278,
833
+ 330,
834
+ 413,
835
+ 418,
836
+ 480,
837
+ 542,
838
+ 607,
839
+ 638,
840
+ 654,
841
+ 731,
842
+ 768,
843
+ 777,
844
+ 787,
845
+ 806,
846
+ 844,
847
+ 876,
848
+ 912,
849
+ 939,
850
+ 942,
851
+ 988,
852
+ 1085,
853
+ 1134,
854
+ 1147,
855
+ 1240,
856
+ 1261,
857
+ 1312,
858
+ 1362,
859
+ 1435,
860
+ 1456,
861
+ 1477,
862
+ 1542,
863
+ 1543,
864
+ 1559,
865
+ 1562,
866
+ 1588,
867
+ 1648,
868
+ 1705,
869
+ 1760,
870
+ 1764,
871
+ 1837,
872
+ 1888,
873
+ 1951,
874
+ 1952,
875
+ 2039,
876
+ 2077,
877
+ 2177,
878
+ 2246,
879
+ 2249,
880
+ 2286,
881
+ 2311,
882
+ 2314,
883
+ 2414,
884
+ 2473,
885
+ 2545,
886
+ 2564,
887
+ 2565,
888
+ 2665,
889
+ 2714,
890
+ 2744,
891
+ 2841,
892
+ 2845,
893
+ 2916,
894
+ 2974,
895
+ 3041,
896
+ 3101,
897
+ 3141,
898
+ 3228,
899
+ 3258,
900
+ 3299,
901
+ 3327,
902
+ 3378,
903
+ 3445,
904
+ 3457,
905
+ 3530,
906
+ 3629,
907
+ 3718,
908
+ 3744,
909
+ 3781,
910
+ 3818,
911
+ 3831,
912
+ 3841,
913
+ 3914,
914
+ 3946,
915
+ 3964,
916
+ 4022,
917
+ 4043,
918
+ 4112,
919
+ 4153,
920
+ 4199,
921
+ 4240,
922
+ 4246,
923
+ 4342,
924
+ 4380,
925
+ 4444,
926
+ 4493
927
+ ]
928
+ ],
929
+ "output": 13876
930
+ },
931
+ {
932
+ "input": [
933
+ [
934
+ "PGGGPGMMMG",
935
+ "MGPGPGPP",
936
+ "PMMMGMMG",
937
+ "PPPGPP",
938
+ "PGPMPGGM",
939
+ "MPMMGMMPG",
940
+ "GPGMPMPP",
941
+ "P",
942
+ "GM",
943
+ "PGGMGPPMP",
944
+ "GMPMG",
945
+ "P",
946
+ "P",
947
+ "MGGPGG",
948
+ "PMMMPGGPMG",
949
+ "MGPPM",
950
+ "P",
951
+ "PGPMMMMGG",
952
+ "PM",
953
+ "GGG",
954
+ "MP",
955
+ "PPGGG",
956
+ "PM",
957
+ "PGMPMGPGP",
958
+ "GGPGGMP",
959
+ "GGMGGMGMG",
960
+ "PM",
961
+ "PG",
962
+ "MPG",
963
+ "GGPGM"
964
+ ],
965
+ [
966
+ 75,
967
+ 148,
968
+ 183,
969
+ 193,
970
+ 207,
971
+ 283,
972
+ 289,
973
+ 376,
974
+ 381,
975
+ 456,
976
+ 508,
977
+ 601,
978
+ 631,
979
+ 723,
980
+ 798,
981
+ 837,
982
+ 911,
983
+ 933,
984
+ 934,
985
+ 941,
986
+ 1028,
987
+ 1035,
988
+ 1082,
989
+ 1131,
990
+ 1192,
991
+ 1256,
992
+ 1301,
993
+ 1333,
994
+ 1357
995
+ ]
996
+ ],
997
+ "output": 4229
998
+ },
999
+ {
1000
+ "input": [
1001
+ [
1002
+ "GP",
1003
+ "GMGPGMMGM",
1004
+ "PGGP",
1005
+ "MPMPMPPGMP",
1006
+ "PGPGMGPMM",
1007
+ "GPGPPPG",
1008
+ "MMMPPPPMPM",
1009
+ "GGMP",
1010
+ "MPMM",
1011
+ "GGGMGMM",
1012
+ "PGPGPMPMG",
1013
+ "GGMMPPMGPG",
1014
+ "PMGP",
1015
+ "GGPGMMG",
1016
+ "PGGG",
1017
+ "MGMMM",
1018
+ "GMGM",
1019
+ "GGGGMPGMMG",
1020
+ "PPPGGGG",
1021
+ "GGP",
1022
+ "GGP",
1023
+ "GMG",
1024
+ "PM",
1025
+ "PGGMGPPGPM",
1026
+ "PPPMPPPP",
1027
+ "MMMMMP",
1028
+ "MGPMPGPP",
1029
+ "PP",
1030
+ "GP",
1031
+ "MMPMMPPG",
1032
+ "MMGPGMPMMP",
1033
+ "GGPMPPGMG",
1034
+ "GGMM",
1035
+ "GMPMM",
1036
+ "GGPPGMGPG",
1037
+ "PMM",
1038
+ "GPGGGPMGG",
1039
+ "MPMGGGGG",
1040
+ "MMMPMMGMMM",
1041
+ "PMGPPPMPGP",
1042
+ "GPPMP",
1043
+ "GP",
1044
+ "MGGM",
1045
+ "PPGMPG",
1046
+ "GGPGPMP",
1047
+ "GMMPGPGGP",
1048
+ "GMMPGPMGP",
1049
+ "GMGMP",
1050
+ "PP",
1051
+ "GPGGPMPM",
1052
+ "PPPM",
1053
+ "MPGMGMM",
1054
+ "GMGMG",
1055
+ "GPGGMMPPGG",
1056
+ "PMPGMPPMP",
1057
+ "PMPMPGGP",
1058
+ "PPMPGM",
1059
+ "MGPPM",
1060
+ "PMMPPPPGP",
1061
+ "PPGMG",
1062
+ "PGPPMMGGMM",
1063
+ "MMG",
1064
+ "GMGMPGPMPM",
1065
+ "PMPMM",
1066
+ "PPPMMGPMP",
1067
+ "MG"
1068
+ ],
1069
+ [
1070
+ 1,
1071
+ 22,
1072
+ 106,
1073
+ 165,
1074
+ 214,
1075
+ 288,
1076
+ 328,
1077
+ 391,
1078
+ 395,
1079
+ 429,
1080
+ 451,
1081
+ 529,
1082
+ 618,
1083
+ 688,
1084
+ 756,
1085
+ 845,
1086
+ 889,
1087
+ 953,
1088
+ 1006,
1089
+ 1062,
1090
+ 1136,
1091
+ 1138,
1092
+ 1177,
1093
+ 1272,
1094
+ 1341,
1095
+ 1429,
1096
+ 1459,
1097
+ 1462,
1098
+ 1522,
1099
+ 1571,
1100
+ 1582,
1101
+ 1655,
1102
+ 1686,
1103
+ 1702,
1104
+ 1710,
1105
+ 1803,
1106
+ 1898,
1107
+ 1923,
1108
+ 2015,
1109
+ 2049,
1110
+ 2132,
1111
+ 2189,
1112
+ 2214,
1113
+ 2227,
1114
+ 2229,
1115
+ 2263,
1116
+ 2330,
1117
+ 2349,
1118
+ 2399,
1119
+ 2436,
1120
+ 2532,
1121
+ 2620,
1122
+ 2705,
1123
+ 2746,
1124
+ 2842,
1125
+ 2893,
1126
+ 2979,
1127
+ 3031,
1128
+ 3129,
1129
+ 3186,
1130
+ 3283,
1131
+ 3343,
1132
+ 3369,
1133
+ 3391,
1134
+ 3475
1135
+ ]
1136
+ ],
1137
+ "output": 10763
1138
+ },
1139
+ {
1140
+ "input": [
1141
+ [
1142
+ "PMPMPPP",
1143
+ "G",
1144
+ "MPMG",
1145
+ "GPPMMG",
1146
+ "GMGPGMMPGM",
1147
+ "PGP",
1148
+ "GMGPPGG",
1149
+ "PPPPGGP",
1150
+ "MMP",
1151
+ "GGGMG",
1152
+ "GGMPMPPGG",
1153
+ "G",
1154
+ "MMGM",
1155
+ "M",
1156
+ "P",
1157
+ "GM",
1158
+ "MMPGGPMPPG",
1159
+ "GMGPP",
1160
+ "GPPP",
1161
+ "PGMM",
1162
+ "PGMMPMGP",
1163
+ "GMMMG",
1164
+ "PPPPMGGM",
1165
+ "PGMGGPG",
1166
+ "MGMG",
1167
+ "MMMMPPMG",
1168
+ "MMPMPPPGPG",
1169
+ "MGPG",
1170
+ "PMGM",
1171
+ "MG",
1172
+ "M",
1173
+ "GG",
1174
+ "GM",
1175
+ "GMP"
1176
+ ],
1177
+ [
1178
+ 22,
1179
+ 29,
1180
+ 38,
1181
+ 138,
1182
+ 172,
1183
+ 268,
1184
+ 316,
1185
+ 363,
1186
+ 384,
1187
+ 400,
1188
+ 433,
1189
+ 489,
1190
+ 523,
1191
+ 563,
1192
+ 632,
1193
+ 671,
1194
+ 684,
1195
+ 773,
1196
+ 844,
1197
+ 944,
1198
+ 982,
1199
+ 1028,
1200
+ 1068,
1201
+ 1116,
1202
+ 1166,
1203
+ 1198,
1204
+ 1257,
1205
+ 1298,
1206
+ 1383,
1207
+ 1447,
1208
+ 1467,
1209
+ 1556,
1210
+ 1627
1211
+ ]
1212
+ ],
1213
+ "output": 5043
1214
+ }
1215
+ ],
1216
+ "haskell_template": "garbageCollection :: [String] -> [Int] -> Int\ngarbageCollection garbage travel ",
1217
+ "ocaml_template": "let garbageCollection (garbage: string list) (travel: int list) : int = ",
1218
+ "scala_template": "def garbageCollection(garbage: List[String],travel: List[Int]): Int = { \n \n}",
1219
+ "java_template": "public static int garbageCollection(List<String> garbage, List<Integer> travel) {\n\n}",
1220
+ "python_template": "class Solution(object):\n def garbageCollection(self, garbage, travel):\n \"\"\"\n :type garbage: List[str]\n :type travel: List[int]\n :rtype: int\n \"\"\"\n "
1221
+ }
minimum_amount_of_time_to_collect_garbage/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 21 (garbageCollection ["G";"P";"GP";"GG"] [2;4;3])
12
+
13
+ let test2 _ = assert_equal 37 (garbageCollection ["MMM";"PGM";"GP"] [3;10])
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for garbageCollection" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
minimum_amount_of_time_to_collect_garbage/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.garbageCollection(List("G","P","GP","GG"),List(2,4,3)), 21)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.garbageCollection(List("MMM","PGM","GP"),List(3,10)), 37)
10
+ }
11
+
12
+ }
minimum_amount_of_time_to_fill_cups/.DS_Store ADDED
Binary file (6.15 kB). View file
 
minimum_amount_of_time_to_fill_cups/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 (fillCups [1,4,2])," 4 (fillCups [1,4,2]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (fillCups [5,4,4])," 7 (fillCups [5,4,4]))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (fillCups [5,0,0])," 5 (fillCups [5,0,0]))
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_amount_of_time_to_fill_cups/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(4, fillCups(new ArrayList<>(Arrays.asList(1,4,2))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(7, fillCups(new ArrayList<>(Arrays.asList(5,4,4))));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(5, fillCups(new ArrayList<>(Arrays.asList(5,0,0))));
23
+ }
24
+
25
+ }
minimum_amount_of_time_to_fill_cups/meta.json ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2412,
3
+ "name": "minimum_amount_of_time_to_fill_cups",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/minimum-amount-of-time-to-fill-cups/",
6
+ "date": "1656806400000",
7
+ "task_description": "You have a water dispenser that can dispense cold, warm, and hot water. Every second, you can either fill up `2` cups with **different** types of water, or `1` cup of any type of water. You are given a **0-indexed** integer array `amount` of length `3` where `amount[0]`, `amount[1]`, and `amount[2]` denote the number of cold, warm, and hot water cups you need to fill respectively. Return _the **minimum** number of seconds needed to fill up all the cups_. **Example 1:** ``` **Input:** amount = [1,4,2] **Output:** 4 **Explanation:** One way to fill up the cups is: Second 1: Fill up a cold cup and a warm cup. Second 2: Fill up a warm cup and a hot cup. Second 3: Fill up a warm cup and a hot cup. Second 4: Fill up a warm cup. It can be proven that 4 is the minimum number of seconds needed. ``` **Example 2:** ``` **Input:** amount = [5,4,4] **Output:** 7 **Explanation:** One way to fill up the cups is: Second 1: Fill up a cold cup, and a hot cup. Second 2: Fill up a cold cup, and a warm cup. Second 3: Fill up a cold cup, and a warm cup. Second 4: Fill up a warm cup, and a hot cup. Second 5: Fill up a cold cup, and a hot cup. Second 6: Fill up a cold cup, and a warm cup. Second 7: Fill up a hot cup. ``` **Example 3:** ``` **Input:** amount = [5,0,0] **Output:** 5 **Explanation:** Every second, we fill up a cold cup. ``` **Constraints:** `amount.length == 3` `0 <= amount[i] <= 100`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "amount = [1,4,2]",
12
+ "output": "4 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "amount = [5,4,4]",
17
+ "output": "7 "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "amount = [5,0,0]",
22
+ "output": "5 "
23
+ }
24
+ ],
25
+ "private_test_cases": [
26
+ {
27
+ "input": [
28
+ 0,
29
+ 0,
30
+ 0
31
+ ],
32
+ "output": 0
33
+ },
34
+ {
35
+ "input": [
36
+ 100,
37
+ 0,
38
+ 0
39
+ ],
40
+ "output": 100
41
+ },
42
+ {
43
+ "input": [
44
+ 60,
45
+ 0,
46
+ 0
47
+ ],
48
+ "output": 60
49
+ },
50
+ {
51
+ "input": [
52
+ 10,
53
+ 10,
54
+ 10
55
+ ],
56
+ "output": 15
57
+ },
58
+ {
59
+ "input": [
60
+ 20,
61
+ 54,
62
+ 0
63
+ ],
64
+ "output": 54
65
+ },
66
+ {
67
+ "input": [
68
+ 0,
69
+ 100,
70
+ 100
71
+ ],
72
+ "output": 100
73
+ },
74
+ {
75
+ "input": [
76
+ 86,
77
+ 54,
78
+ 62
79
+ ],
80
+ "output": 101
81
+ },
82
+ {
83
+ "input": [
84
+ 37,
85
+ 43,
86
+ 34
87
+ ],
88
+ "output": 57
89
+ },
90
+ {
91
+ "input": [
92
+ 49,
93
+ 51,
94
+ 7
95
+ ],
96
+ "output": 54
97
+ },
98
+ {
99
+ "input": [
100
+ 19,
101
+ 61,
102
+ 9
103
+ ],
104
+ "output": 61
105
+ }
106
+ ],
107
+ "haskell_template": "fillCups :: [Int] -> Int\nfillCups amount ",
108
+ "ocaml_template": "let fillCups (amount: int list) : int = ",
109
+ "scala_template": "def fillCups(amount: List[Int]): Int = { \n \n}",
110
+ "java_template": "public static int fillCups(List<Integer> amount) {\n\n}",
111
+ "python_template": "class Solution(object):\n def fillCups(self, amount):\n \"\"\"\n :type amount: List[int]\n :rtype: int\n \"\"\"\n "
112
+ }
minimum_amount_of_time_to_fill_cups/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 4 (fillCups [1;4;2])
12
+
13
+ let test2 _ = assert_equal 7 (fillCups [5;4;4])
14
+
15
+ let test3 _ = assert_equal 5 (fillCups [5;0;0])
16
+
17
+
18
+ (* Grouping test cases *)
19
+ let suite = "Test Suite for fillCups" >::: [
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_amount_of_time_to_fill_cups/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.fillCups(List(1,4,2)), 4)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.fillCups(List(5,4,4)), 7)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.fillCups(List(5,0,0)), 5)
14
+ }
15
+
16
+ }
minimum_array_end/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 (minEnd 3 4)," 6 (minEnd 3 4))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (minEnd 2 7)," 15 (minEnd 2 7))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (minEnd 1 72)," 72 (minEnd 1 72))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (minEnd 3 2)," 6 (minEnd 3 2))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (minEnd 4 42)," 47 (minEnd 4 42))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (minEnd 2 80)," 81 (minEnd 2 80))
28
+
29
+ test7 :: Test
30
+ test7 = TestCase (assertEqual "for (minEnd 9 85)," 213 (minEnd 9 85))
31
+
32
+ test8 :: Test
33
+ test8 = TestCase (assertEqual "for (minEnd 7 63)," 447 (minEnd 7 63))
34
+
35
+ test9 :: Test
36
+ test9 = TestCase (assertEqual "for (minEnd 2 72)," 73 (minEnd 2 72))
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_array_end/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, minEnd(3, 4));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(15, minEnd(2, 7));
19
+ }
20
+
21
+ }
minimum_array_end/meta.json ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3394,
3
+ "name": "minimum_array_end",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/minimum-array-end/",
6
+ "date": "2024-04-21 00:00:00",
7
+ "task_description": "You are given two integers `n` and `x`. You have to construct an array of **positive** integers `nums` of size `n` where for every `0 <= i < n - 1`, `nums[i + 1]` is **greater than** `nums[i]`, and the result of the bitwise `AND` operation between all elements of `nums` is `x`. Return the **minimum** possible value of `nums[n - 1]`. **Example 1:** **Input:** n = 3, x = 4 **Output:** 6 **Explanation:** `nums` can be `[4,5,6]` and its last element is 6. **Example 2:** **Input:** n = 2, x = 7 **Output:** 15 **Explanation:** `nums` can be `[7,15]` and its last element is 15. **Constraints:** `1 <= n, x <= 108`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "n = 3, x = 4",
12
+ "output": "6 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "n = 2, x = 7",
17
+ "output": "15 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 1,
24
+ 72
25
+ ],
26
+ "output": 72
27
+ },
28
+ {
29
+ "input": [
30
+ 3,
31
+ 2
32
+ ],
33
+ "output": 6
34
+ },
35
+ {
36
+ "input": [
37
+ 4,
38
+ 42
39
+ ],
40
+ "output": 47
41
+ },
42
+ {
43
+ "input": [
44
+ 2,
45
+ 80
46
+ ],
47
+ "output": 81
48
+ },
49
+ {
50
+ "input": [
51
+ 9,
52
+ 85
53
+ ],
54
+ "output": 213
55
+ },
56
+ {
57
+ "input": [
58
+ 7,
59
+ 63
60
+ ],
61
+ "output": 447
62
+ },
63
+ {
64
+ "input": [
65
+ 2,
66
+ 72
67
+ ],
68
+ "output": 73
69
+ },
70
+ {
71
+ "input": [
72
+ 5,
73
+ 93
74
+ ],
75
+ "output": 221
76
+ },
77
+ {
78
+ "input": [
79
+ 3,
80
+ 37
81
+ ],
82
+ "output": 45
83
+ },
84
+ {
85
+ "input": [
86
+ 4,
87
+ 6
88
+ ],
89
+ "output": 15
90
+ }
91
+ ],
92
+ "haskell_template": "minEnd :: Int -> Int -> Int\nminEnd n x ",
93
+ "ocaml_template": "let minEnd (n: int) (x: int) : int = ",
94
+ "scala_template": "def minEnd(n: Int,x: Int): Int = { \n \n}",
95
+ "java_template": "class Solution {\n public long minEnd(int n, int x) {\n \n }\n}",
96
+ "python_template": "class Solution(object):\n def minEnd(self, n, x):\n \"\"\"\n :type n: int\n :type x: int\n :rtype: int\n \"\"\"\n "
97
+ }
minimum_array_end/ocaml_tests/main.ml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 (minEnd 3 4)
12
+
13
+ let test2 _ = assert_equal 15 (minEnd 2 7)
14
+
15
+ let test3 _ = assert_equal 72 (minEnd 1 72)
16
+
17
+ let test4 _ = assert_equal 6 (minEnd 3 2)
18
+
19
+ let test5 _ = assert_equal 47 (minEnd 4 42)
20
+
21
+ let test6 _ = assert_equal 81 (minEnd 2 80)
22
+
23
+ let test7 _ = assert_equal 213 (minEnd 9 85)
24
+
25
+ let test8 _ = assert_equal 447 (minEnd 7 63)
26
+
27
+ let test9 _ = assert_equal 73 (minEnd 2 72)
28
+
29
+ let test10 _ = assert_equal 221 (minEnd 5 93)
30
+
31
+
32
+ (* Grouping test cases *)
33
+ let suite = "Test Suite for minEnd" >::: [
34
+
35
+ "test1" >:: test1;
36
+ "test2" >:: test2;
37
+ "test3" >:: test3;
38
+ "test4" >:: test4;
39
+ "test5" >:: test5;
40
+ "test6" >:: test6;
41
+ "test7" >:: test7;
42
+ "test8" >:: test8;
43
+ "test9" >:: test9;
44
+ "test10" >:: test10;
45
+ ]
46
+
47
+
48
+ (* Running the tests *)
49
+ let () = run_test_tt_main suite
50
+ end
minimum_array_end/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.minEnd(3,4), 6)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.minEnd(2,7), 15)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.minEnd(1,72), 72)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.minEnd(3,2), 6)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.minEnd(4,42), 47)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.minEnd(2,80), 81)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.minEnd(9,85), 213)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.minEnd(7,63), 447)
34
+ }
35
+
36
+ test("test9") {
37
+ assertEquals(Main.minEnd(2,72), 73)
38
+ }
39
+
40
+ test("test10") {
41
+ assertEquals(Main.minEnd(5,93), 221)
42
+ }
43
+
44
+ }
minimum_array_length_after_pair_removals/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
minimum_array_length_after_pair_removals/java_tests/Main.java ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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(0, minLengthAfterRemovals(Arrays.asList(1,2,3,4)));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(0, minLengthAfterRemovals(Arrays.asList(1,1,2,2,3,3)));
18
+ }
19
+ @Test
20
+ public void test3() {
21
+ assertEquals(2, minLengthAfterRemovals(Arrays.asList(1000000000,1000000000)));
22
+ }
23
+ @Test
24
+ public void test4() {
25
+ assertEquals(1, minLengthAfterRemovals(Arrays.asList(2,3,4,4,4)));
26
+ }
27
+
28
+ }
minimum_array_length_after_pair_removals/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:202638f8feb031e97b4fa382b41b0acfc3bd0fe5276417a417b1ee8a3e648460
3
+ size 10566002
minimum_array_length_after_pair_removals/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
minimum_array_length_after_pair_removals/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
minimum_array_sum/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 (minArraySum [2,8,3,19,3] 3 1 1)," 23 (minArraySum [2,8,3,19,3] 3 1 1))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (minArraySum [2,4,3] 3 2 1)," 3 (minArraySum [2,4,3] 3 2 1))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (minArraySum [0, 6, 8, 16, 17, 13, 17, 18, 20, 20, 20, 21, 34, 35, 5, 6, 12, 16, 16, 16] 73 11 11)," 316 (minArraySum [0, 6, 8, 16, 17, 13, 17, 18, 20, 20, 20, 21, 34, 35, 5, 6, 12, 16, 16, 16] 73 11 11))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (minArraySum [2, 3, 6, 8, 8, 8, 9, 10, 13, 14, 15, 16, 16, 18, 19, 22, 23, 24, 25, 27, 27, 27, 27, 28, 30, 35, 35, 37, 37, 38, 39, 44, 46, 23, 24, 24, 25, 25, 26, 28, 28, 28, 28, 29, 29, 29, 29, 30, 31, 31, 33, 34, 34, 34, 35, 35, 36, 36, 38, 39, 39, 42, 43, 1, 2, 2, 4, 5, 7, 8, 8, 12, 12, 14, 17, 18, 18] 87 30 57)," 1809 (minArraySum [2, 3, 6, 8, 8, 8, 9, 10, 13, 14, 15, 16, 16, 18, 19, 22, 23, 24, 25, 27, 27, 27, 27, 28, 30, 35, 35, 37, 37, 38, 39, 44, 46, 23, 24, 24, 25, 25, 26, 28, 28, 28, 28, 29, 29, 29, 29, 30, 31, 31, 33, 34, 34, 34, 35, 35, 36, 36, 38, 39, 39, 42, 43, 1, 2, 2, 4, 5, 7, 8, 8, 12, 12, 14, 17, 18, 18] 87 30 57))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (minArraySum [0, 0, 0, 1, 3, 3, 4, 5, 5, 7, 10, 11, 12, 14, 15, 17, 18, 9, 10, 10, 12, 14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 19, 1, 1, 2, 3, 22, 23, 23, 24, 24, 24, 24, 25, 25, 26, 27, 27, 29, 29, 31, 31, 31, 31, 33, 33, 33, 34, 34, 36, 37, 37, 38, 38, 38, 39, 39, 39, 0, 0, 1, 2, 3, 3, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 9, 10, 10, 10, 11, 11, 12, 12, 12] 40 76 33)," 1510 (minArraySum [0, 0, 0, 1, 3, 3, 4, 5, 5, 7, 10, 11, 12, 14, 15, 17, 18, 9, 10, 10, 12, 14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 19, 1, 1, 2, 3, 22, 23, 23, 24, 24, 24, 24, 25, 25, 26, 27, 27, 29, 29, 31, 31, 31, 31, 33, 33, 33, 34, 34, 36, 37, 37, 38, 38, 38, 39, 39, 39, 0, 0, 1, 2, 3, 3, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 9, 10, 10, 10, 11, 11, 12, 12, 12] 40 76 33))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (minArraySum [5, 5, 4, 5, 7, 8, 9, 12, 13, 14, 16, 18, 19, 19, 22, 23, 24, 24, 26, 27, 28, 28, 29, 30, 34, 36, 37, 37, 41, 42, 42, 45, 46, 48, 3, 3, 4, 4] 98 35 10)," 837 (minArraySum [5, 5, 4, 5, 7, 8, 9, 12, 13, 14, 16, 18, 19, 19, 22, 23, 24, 24, 26, 27, 28, 28, 29, 30, 34, 36, 37, 37, 41, 42, 42, 45, 46, 48, 3, 3, 4, 4] 98 35 10))
28
+
29
+ test7 :: Test
30
+ test7 = TestCase (assertEqual "for (minArraySum [4, 13, 14, 17, 18, 21, 24, 25, 1, 2, 4, 7, 37, 37, 41, 43, 43, 53, 54, 60, 63, 69, 76, 77, 81, 84, 84, 85, 85, 87, 89, 89, 92, 96, 96] 26 0 4)," 1771 (minArraySum [4, 13, 14, 17, 18, 21, 24, 25, 1, 2, 4, 7, 37, 37, 41, 43, 43, 53, 54, 60, 63, 69, 76, 77, 81, 84, 84, 85, 85, 87, 89, 89, 92, 96, 96] 26 0 4))
31
+
32
+ test8 :: Test
33
+ test8 = TestCase (assertEqual "for (minArraySum [16, 33, 83, 90, 101] 12 0 2)," 323 (minArraySum [16, 33, 83, 90, 101] 12 0 2))
34
+
35
+ test9 :: Test
36
+ test9 = TestCase (assertEqual "for (minArraySum [2, 3, 3, 7, 8, 8, 8, 10, 7, 7, 8, 8, 12, 14, 15, 15, 16, 17, 21, 23, 25, 26, 26, 27, 28, 28, 28, 28, 28, 29, 31, 31, 35, 36, 37, 37, 37, 41, 41, 42, 42, 42, 45, 47, 48, 49, 51, 22, 22, 23] 30 42 3)," 1244 (minArraySum [2, 3, 3, 7, 8, 8, 8, 10, 7, 7, 8, 8, 12, 14, 15, 15, 16, 17, 21, 23, 25, 26, 26, 27, 28, 28, 28, 28, 28, 29, 31, 31, 35, 36, 37, 37, 37, 41, 41, 42, 42, 42, 45, 47, 48, 49, 51, 22, 22, 23] 30 42 3))
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_array_sum/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(23, minArraySum(new ArrayList<>(Arrays.asList(2,8,3,19,3)), 3, 1, 1));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(3, minArraySum(new ArrayList<>(Arrays.asList(2,4,3)), 3, 2, 1));
19
+ }
20
+
21
+ }
minimum_array_sum/meta.json ADDED
@@ -0,0 +1,596 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3654,
3
+ "name": "minimum_array_sum",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/minimum-array-sum/",
6
+ "date": "2024-11-17 00:00:00",
7
+ "task_description": "You are given an integer array `nums` and three integers `k`, `op1`, and `op2`. You can perform the following operations on `nums`: **Operation 1**: Choose an index `i` and divide `nums[i]` by 2, **rounding up** to the nearest whole number. You can perform this operation at most `op1` times, and not more than **once** per index. **Operation 2**: Choose an index `i` and subtract `k` from `nums[i]`, but only if `nums[i]` is greater than or equal to `k`. You can perform this operation at most `op2` times, and not more than **once** per index. **Note:** Both operations can be applied to the same index, but at most once each. Return the **minimum** possible **sum** of all elements in `nums` after performing any number of operations. **Example 1:** **Input:** nums = [2,8,3,19,3], k = 3, op1 = 1, op2 = 1 **Output:** 23 **Explanation:** Apply Operation 2 to `nums[1] = 8`, making `nums[1] = 5`. Apply Operation 1 to `nums[3] = 19`, making `nums[3] = 10`. The resulting array becomes `[2, 5, 3, 10, 3]`, which has the minimum possible sum of 23 after applying the operations. **Example 2:** **Input:** nums = [2,4,3], k = 3, op1 = 2, op2 = 1 **Output:** 3 **Explanation:** Apply Operation 1 to `nums[0] = 2`, making `nums[0] = 1`. Apply Operation 1 to `nums[1] = 4`, making `nums[1] = 2`. Apply Operation 2 to `nums[2] = 3`, making `nums[2] = 0`. The resulting array becomes `[1, 2, 0]`, which has the minimum possible sum of 3 after applying the operations. **Constraints:** `1 <= nums.length <= 100` `0 <= nums[i] <= 105` `0 <= k <= 105` `0 <= op1, op2 <= nums.length`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [2,8,3,19,3], k = 3, op1 = 1, op2 = 1",
12
+ "output": "23 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [2,4,3], k = 3, op1 = 2, op2 = 1",
17
+ "output": "3 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ [
24
+ 0,
25
+ 6,
26
+ 8,
27
+ 16,
28
+ 17,
29
+ 13,
30
+ 17,
31
+ 18,
32
+ 20,
33
+ 20,
34
+ 20,
35
+ 21,
36
+ 34,
37
+ 35,
38
+ 5,
39
+ 6,
40
+ 12,
41
+ 16,
42
+ 16,
43
+ 16
44
+ ],
45
+ 73,
46
+ 11,
47
+ 11
48
+ ],
49
+ "output": 316
50
+ },
51
+ {
52
+ "input": [
53
+ [
54
+ 2,
55
+ 3,
56
+ 6,
57
+ 8,
58
+ 8,
59
+ 8,
60
+ 9,
61
+ 10,
62
+ 13,
63
+ 14,
64
+ 15,
65
+ 16,
66
+ 16,
67
+ 18,
68
+ 19,
69
+ 22,
70
+ 23,
71
+ 24,
72
+ 25,
73
+ 27,
74
+ 27,
75
+ 27,
76
+ 27,
77
+ 28,
78
+ 30,
79
+ 35,
80
+ 35,
81
+ 37,
82
+ 37,
83
+ 38,
84
+ 39,
85
+ 44,
86
+ 46,
87
+ 23,
88
+ 24,
89
+ 24,
90
+ 25,
91
+ 25,
92
+ 26,
93
+ 28,
94
+ 28,
95
+ 28,
96
+ 28,
97
+ 29,
98
+ 29,
99
+ 29,
100
+ 29,
101
+ 30,
102
+ 31,
103
+ 31,
104
+ 33,
105
+ 34,
106
+ 34,
107
+ 34,
108
+ 35,
109
+ 35,
110
+ 36,
111
+ 36,
112
+ 38,
113
+ 39,
114
+ 39,
115
+ 42,
116
+ 43,
117
+ 1,
118
+ 2,
119
+ 2,
120
+ 4,
121
+ 5,
122
+ 7,
123
+ 8,
124
+ 8,
125
+ 12,
126
+ 12,
127
+ 14,
128
+ 17,
129
+ 18,
130
+ 18
131
+ ],
132
+ 87,
133
+ 30,
134
+ 57
135
+ ],
136
+ "output": 1809
137
+ },
138
+ {
139
+ "input": [
140
+ [
141
+ 0,
142
+ 0,
143
+ 0,
144
+ 1,
145
+ 3,
146
+ 3,
147
+ 4,
148
+ 5,
149
+ 5,
150
+ 7,
151
+ 10,
152
+ 11,
153
+ 12,
154
+ 14,
155
+ 15,
156
+ 17,
157
+ 18,
158
+ 9,
159
+ 10,
160
+ 10,
161
+ 12,
162
+ 14,
163
+ 14,
164
+ 15,
165
+ 15,
166
+ 16,
167
+ 16,
168
+ 16,
169
+ 17,
170
+ 17,
171
+ 18,
172
+ 19,
173
+ 1,
174
+ 1,
175
+ 2,
176
+ 3,
177
+ 22,
178
+ 23,
179
+ 23,
180
+ 24,
181
+ 24,
182
+ 24,
183
+ 24,
184
+ 25,
185
+ 25,
186
+ 26,
187
+ 27,
188
+ 27,
189
+ 29,
190
+ 29,
191
+ 31,
192
+ 31,
193
+ 31,
194
+ 31,
195
+ 33,
196
+ 33,
197
+ 33,
198
+ 34,
199
+ 34,
200
+ 36,
201
+ 37,
202
+ 37,
203
+ 38,
204
+ 38,
205
+ 38,
206
+ 39,
207
+ 39,
208
+ 39,
209
+ 0,
210
+ 0,
211
+ 1,
212
+ 2,
213
+ 3,
214
+ 3,
215
+ 3,
216
+ 3,
217
+ 3,
218
+ 4,
219
+ 4,
220
+ 5,
221
+ 5,
222
+ 5,
223
+ 6,
224
+ 6,
225
+ 6,
226
+ 6,
227
+ 7,
228
+ 7,
229
+ 9,
230
+ 10,
231
+ 10,
232
+ 10,
233
+ 11,
234
+ 11,
235
+ 12,
236
+ 12,
237
+ 12
238
+ ],
239
+ 40,
240
+ 76,
241
+ 33
242
+ ],
243
+ "output": 1510
244
+ },
245
+ {
246
+ "input": [
247
+ [
248
+ 5,
249
+ 5,
250
+ 4,
251
+ 5,
252
+ 7,
253
+ 8,
254
+ 9,
255
+ 12,
256
+ 13,
257
+ 14,
258
+ 16,
259
+ 18,
260
+ 19,
261
+ 19,
262
+ 22,
263
+ 23,
264
+ 24,
265
+ 24,
266
+ 26,
267
+ 27,
268
+ 28,
269
+ 28,
270
+ 29,
271
+ 30,
272
+ 34,
273
+ 36,
274
+ 37,
275
+ 37,
276
+ 41,
277
+ 42,
278
+ 42,
279
+ 45,
280
+ 46,
281
+ 48,
282
+ 3,
283
+ 3,
284
+ 4,
285
+ 4
286
+ ],
287
+ 98,
288
+ 35,
289
+ 10
290
+ ],
291
+ "output": 837
292
+ },
293
+ {
294
+ "input": [
295
+ [
296
+ 4,
297
+ 13,
298
+ 14,
299
+ 17,
300
+ 18,
301
+ 21,
302
+ 24,
303
+ 25,
304
+ 1,
305
+ 2,
306
+ 4,
307
+ 7,
308
+ 37,
309
+ 37,
310
+ 41,
311
+ 43,
312
+ 43,
313
+ 53,
314
+ 54,
315
+ 60,
316
+ 63,
317
+ 69,
318
+ 76,
319
+ 77,
320
+ 81,
321
+ 84,
322
+ 84,
323
+ 85,
324
+ 85,
325
+ 87,
326
+ 89,
327
+ 89,
328
+ 92,
329
+ 96,
330
+ 96
331
+ ],
332
+ 26,
333
+ 0,
334
+ 4
335
+ ],
336
+ "output": 1771
337
+ },
338
+ {
339
+ "input": [
340
+ [
341
+ 16,
342
+ 33,
343
+ 83,
344
+ 90,
345
+ 101
346
+ ],
347
+ 12,
348
+ 0,
349
+ 2
350
+ ],
351
+ "output": 323
352
+ },
353
+ {
354
+ "input": [
355
+ [
356
+ 2,
357
+ 3,
358
+ 3,
359
+ 7,
360
+ 8,
361
+ 8,
362
+ 8,
363
+ 10,
364
+ 7,
365
+ 7,
366
+ 8,
367
+ 8,
368
+ 12,
369
+ 14,
370
+ 15,
371
+ 15,
372
+ 16,
373
+ 17,
374
+ 21,
375
+ 23,
376
+ 25,
377
+ 26,
378
+ 26,
379
+ 27,
380
+ 28,
381
+ 28,
382
+ 28,
383
+ 28,
384
+ 28,
385
+ 29,
386
+ 31,
387
+ 31,
388
+ 35,
389
+ 36,
390
+ 37,
391
+ 37,
392
+ 37,
393
+ 41,
394
+ 41,
395
+ 42,
396
+ 42,
397
+ 42,
398
+ 45,
399
+ 47,
400
+ 48,
401
+ 49,
402
+ 51,
403
+ 22,
404
+ 22,
405
+ 23
406
+ ],
407
+ 30,
408
+ 42,
409
+ 3
410
+ ],
411
+ "output": 1244
412
+ },
413
+ {
414
+ "input": [
415
+ [
416
+ 2,
417
+ 3,
418
+ 4,
419
+ 5,
420
+ 6,
421
+ 6,
422
+ 7,
423
+ 8,
424
+ 8,
425
+ 8,
426
+ 9,
427
+ 10,
428
+ 12,
429
+ 12,
430
+ 13,
431
+ 13,
432
+ 13,
433
+ 15,
434
+ 16,
435
+ 17,
436
+ 17,
437
+ 0,
438
+ 1,
439
+ 2,
440
+ 2,
441
+ 5,
442
+ 6,
443
+ 7,
444
+ 8,
445
+ 9,
446
+ 9,
447
+ 10,
448
+ 10,
449
+ 11,
450
+ 11,
451
+ 11,
452
+ 12,
453
+ 13,
454
+ 15,
455
+ 16,
456
+ 17,
457
+ 0,
458
+ 0,
459
+ 2,
460
+ 2,
461
+ 2,
462
+ 2,
463
+ 3,
464
+ 4,
465
+ 6,
466
+ 7,
467
+ 8,
468
+ 8,
469
+ 10,
470
+ 10,
471
+ 11,
472
+ 12,
473
+ 12,
474
+ 13,
475
+ 14,
476
+ 16,
477
+ 16,
478
+ 16
479
+ ],
480
+ 35,
481
+ 62,
482
+ 43
483
+ ],
484
+ "output": 553
485
+ },
486
+ {
487
+ "input": [
488
+ [
489
+ 0,
490
+ 2,
491
+ 6,
492
+ 6,
493
+ 9,
494
+ 13,
495
+ 14,
496
+ 24,
497
+ 4,
498
+ 6,
499
+ 7,
500
+ 7,
501
+ 11,
502
+ 12,
503
+ 14,
504
+ 15,
505
+ 18,
506
+ 19,
507
+ 22,
508
+ 23,
509
+ 23,
510
+ 24,
511
+ 25,
512
+ 26,
513
+ 30,
514
+ 30,
515
+ 31,
516
+ 34,
517
+ 36,
518
+ 37,
519
+ 39,
520
+ 43,
521
+ 43,
522
+ 44,
523
+ 45
524
+ ],
525
+ 8,
526
+ 27,
527
+ 32
528
+ ],
529
+ "output": 742
530
+ },
531
+ {
532
+ "input": [
533
+ [
534
+ 0,
535
+ 1,
536
+ 2,
537
+ 2,
538
+ 6,
539
+ 7,
540
+ 7,
541
+ 9,
542
+ 12,
543
+ 19,
544
+ 19,
545
+ 21,
546
+ 23,
547
+ 25,
548
+ 29,
549
+ 31,
550
+ 31,
551
+ 34,
552
+ 19,
553
+ 19,
554
+ 20,
555
+ 21,
556
+ 21,
557
+ 22,
558
+ 23,
559
+ 1,
560
+ 6,
561
+ 8,
562
+ 10,
563
+ 14,
564
+ 18,
565
+ 19,
566
+ 34,
567
+ 35,
568
+ 35,
569
+ 36,
570
+ 36,
571
+ 39,
572
+ 40,
573
+ 41,
574
+ 41,
575
+ 44,
576
+ 44,
577
+ 44,
578
+ 45,
579
+ 0,
580
+ 1,
581
+ 4,
582
+ 6
583
+ ],
584
+ 47,
585
+ 24,
586
+ 11
587
+ ],
588
+ "output": 1024
589
+ }
590
+ ],
591
+ "haskell_template": "minArraySum :: [Int] -> Int -> Int -> Int -> Int\nminArraySum nums k op1 op2 ",
592
+ "ocaml_template": "let minArraySum (nums: int list) (k: int) (op1: int) (op2: int) : int = ",
593
+ "scala_template": "def minArraySum(nums: List[Int],k: Int,op1: Int,op2: Int): Int = { \n \n}",
594
+ "java_template": "class Solution {\n public int minArraySum(int[] nums, int k, int op1, int op2) {\n \n }\n}",
595
+ "python_template": "class Solution(object):\n def minArraySum(self, nums, k, op1, op2):\n \"\"\"\n :type nums: List[int]\n :type k: int\n :type op1: int\n :type op2: int\n :rtype: int\n \"\"\"\n "
596
+ }