DatasetRepo commited on
Commit
7bb84d8
·
verified ·
1 Parent(s): 5bf0765

605caf3f91256bf157721222a7e30a5041f4a4cae4b7f4677de012105522d744

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 +7 -0
  2. maximize_consecutive_elements_in_an_array_after_modification/ocaml_tests/main.ml +0 -0
  3. maximize_consecutive_elements_in_an_array_after_modification/scala_tests/MySuite.scala +0 -0
  4. maximize_greatness_of_an_array/.DS_Store +0 -0
  5. maximize_greatness_of_an_array/haskell_tests/Main.hs +24 -0
  6. maximize_greatness_of_an_array/java_tests/Main.java +21 -0
  7. maximize_greatness_of_an_array/meta.json +26 -0
  8. maximize_greatness_of_an_array/ocaml_tests/main.ml +26 -0
  9. maximize_greatness_of_an_array/scala_tests/MySuite.scala +12 -0
  10. maximize_happiness_of_selected_children/haskell_tests/Main.hs +3 -0
  11. maximize_happiness_of_selected_children/java_tests/Main.java +25 -0
  12. maximize_happiness_of_selected_children/meta.json +3 -0
  13. maximize_happiness_of_selected_children/ocaml_tests/main.ml +0 -0
  14. maximize_happiness_of_selected_children/scala_tests/MySuite.scala +0 -0
  15. maximize_number_of_subsequences_in_a_string/.DS_Store +0 -0
  16. maximize_number_of_subsequences_in_a_string/haskell_tests/Main.hs +24 -0
  17. maximize_number_of_subsequences_in_a_string/java_tests/Main.java +21 -0
  18. maximize_number_of_subsequences_in_a_string/meta.json +0 -0
  19. maximize_number_of_subsequences_in_a_string/ocaml_tests/main.ml +26 -0
  20. maximize_number_of_subsequences_in_a_string/scala_tests/MySuite.scala +12 -0
  21. maximize_score_of_numbers_in_ranges/haskell_tests/Main.hs +0 -0
  22. maximize_score_of_numbers_in_ranges/java_tests/Main.java +21 -0
  23. maximize_score_of_numbers_in_ranges/meta.json +3 -0
  24. maximize_score_of_numbers_in_ranges/ocaml_tests/main.ml +0 -0
  25. maximize_score_of_numbers_in_ranges/scala_tests/MySuite.scala +0 -0
  26. maximize_subarray_sum_after_removing_all_occurrences_of_one_element/haskell_tests/Main.hs +0 -0
  27. maximize_subarray_sum_after_removing_all_occurrences_of_one_element/java_tests/Main.java +20 -0
  28. maximize_subarray_sum_after_removing_all_occurrences_of_one_element/meta.json +0 -0
  29. maximize_subarray_sum_after_removing_all_occurrences_of_one_element/ocaml_tests/main.ml +0 -0
  30. maximize_subarray_sum_after_removing_all_occurrences_of_one_element/scala_tests/MySuite.scala +0 -0
  31. maximize_subarrays_after_removing_one_conflicting_pair/haskell_tests/Main.hs +45 -0
  32. maximize_subarrays_after_removing_one_conflicting_pair/java_tests/Main.java +21 -0
  33. maximize_subarrays_after_removing_one_conflicting_pair/meta.json +2067 -0
  34. maximize_subarrays_after_removing_one_conflicting_pair/ocaml_tests/main.ml +50 -0
  35. maximize_subarrays_after_removing_one_conflicting_pair/scala_tests/MySuite.scala +44 -0
  36. maximize_sum_of_weights_after_edge_removals/haskell_tests/Main.hs +3 -0
  37. maximize_sum_of_weights_after_edge_removals/java_tests/Main.java +21 -0
  38. maximize_sum_of_weights_after_edge_removals/meta.json +3 -0
  39. maximize_sum_of_weights_after_edge_removals/ocaml_tests/main.ml +3 -0
  40. maximize_sum_of_weights_after_edge_removals/scala_tests/MySuite.scala +3 -0
  41. maximize_the_minimum_game_score/haskell_tests/Main.hs +0 -0
  42. maximize_the_minimum_game_score/java_tests/Main.java +21 -0
  43. maximize_the_minimum_game_score/meta.json +0 -0
  44. maximize_the_minimum_game_score/ocaml_tests/main.ml +0 -0
  45. maximize_the_minimum_game_score/scala_tests/MySuite.scala +0 -0
  46. maximize_the_minimum_powered_city/.DS_Store +0 -0
  47. maximize_the_minimum_powered_city/haskell_tests/Main.hs +24 -0
  48. maximize_the_minimum_powered_city/java_tests/Main.java +21 -0
  49. maximize_the_minimum_powered_city/meta.json +26 -0
  50. maximize_the_minimum_powered_city/ocaml_tests/main.ml +26 -0
.gitattributes CHANGED
@@ -154,3 +154,10 @@ longest_special_path_ii/meta.json filter=lfs diff=lfs merge=lfs -text
154
  longest_subarray_with_maximum_bitwise_and/meta.json filter=lfs diff=lfs merge=lfs -text
155
  max_sum_of_a_pair_with_equal_sum_of_digits/meta.json filter=lfs diff=lfs merge=lfs -text
156
  maximal_score_after_applying_k_operations/meta.json filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
154
  longest_subarray_with_maximum_bitwise_and/meta.json filter=lfs diff=lfs merge=lfs -text
155
  max_sum_of_a_pair_with_equal_sum_of_digits/meta.json filter=lfs diff=lfs merge=lfs -text
156
  maximal_score_after_applying_k_operations/meta.json filter=lfs diff=lfs merge=lfs -text
157
+ maximize_happiness_of_selected_children/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
158
+ maximize_happiness_of_selected_children/meta.json filter=lfs diff=lfs merge=lfs -text
159
+ maximize_score_of_numbers_in_ranges/meta.json filter=lfs diff=lfs merge=lfs -text
160
+ maximize_sum_of_weights_after_edge_removals/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
161
+ maximize_sum_of_weights_after_edge_removals/meta.json filter=lfs diff=lfs merge=lfs -text
162
+ maximize_sum_of_weights_after_edge_removals/ocaml_tests/main.ml filter=lfs diff=lfs merge=lfs -text
163
+ maximize_sum_of_weights_after_edge_removals/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
maximize_consecutive_elements_in_an_array_after_modification/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
maximize_consecutive_elements_in_an_array_after_modification/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
maximize_greatness_of_an_array/.DS_Store ADDED
Binary file (6.15 kB). View file
 
maximize_greatness_of_an_array/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 (maximizeGreatness [1,3,5,2,1,3,1])," 4 (maximizeGreatness [1,3,5,2,1,3,1]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (maximizeGreatness [1,2,3,4])," 3 (maximizeGreatness [1,2,3,4]))
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
maximize_greatness_of_an_array/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(4, maximizeGreatness(new ArrayList<>(Arrays.asList(1,3,5,2,1,3,1))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(3, maximizeGreatness(new ArrayList<>(Arrays.asList(1,2,3,4))));
19
+ }
20
+
21
+ }
maximize_greatness_of_an_array/meta.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2664,
3
+ "name": "maximize_greatness_of_an_array",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/maximize-greatness-of-an-array/",
6
+ "date": "1677888000000",
7
+ "task_description": "You are given a 0-indexed integer array `nums`. You are allowed to permute `nums` into a new array `perm` of your choosing. We define the **greatness** of `nums` be the number of indices `0 <= i < nums.length` for which `perm[i] > nums[i]`. Return _the **maximum** possible greatness you can achieve after permuting_ `nums`. **Example 1:** ``` **Input:** nums = [1,3,5,2,1,3,1] **Output:** 4 **Explanation:** One of the optimal rearrangements is perm = [2,5,1,3,3,1,1]. At indices = 0, 1, 3, and 4, perm[i] > nums[i]. Hence, we return 4. ``` **Example 2:** ``` **Input:** nums = [1,2,3,4] **Output:** 3 **Explanation:** We can prove the optimal perm is [2,3,4,1]. At indices = 0, 1, and 2, perm[i] > nums[i]. Hence, we return 3. ``` **Constraints:** `1 <= nums.length <= 105` `0 <= nums[i] <= 109`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [1,3,5,2,1,3,1]",
12
+ "output": "4 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [1,2,3,4]",
17
+ "output": "3 "
18
+ }
19
+ ],
20
+ "private_test_cases": [],
21
+ "haskell_template": "maximizeGreatness :: [Int] -> Int\nmaximizeGreatness nums ",
22
+ "ocaml_template": "let maximizeGreatness (nums: int list) : int = ",
23
+ "scala_template": "def maximizeGreatness(nums: List[Int]): Int = { \n \n}",
24
+ "java_template": "public static int maximizeGreatness(List<Integer> nums) {\n\n}",
25
+ "python_template": "class Solution(object):\n def maximizeGreatness(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n "
26
+ }
maximize_greatness_of_an_array/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 4 (maximizeGreatness [1;3;5;2;1;3;1])
12
+
13
+ let test2 _ = assert_equal 3 (maximizeGreatness [1;2;3;4])
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for maximizeGreatness" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
maximize_greatness_of_an_array/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.maximizeGreatness(List(1,3,5,2,1,3,1)), 4)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.maximizeGreatness(List(1,2,3,4)), 3)
10
+ }
11
+
12
+ }
maximize_happiness_of_selected_children/haskell_tests/Main.hs ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:699e9e2da3edf05414758edf5e159f907e8dd4e1bd461eb5438ecb3cc3b00084
3
+ size 11195831
maximize_happiness_of_selected_children/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, maximumHappinessSum(new ArrayList<>(Arrays.asList(1,2,3)), 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(1, maximumHappinessSum(new ArrayList<>(Arrays.asList(1,1,1,1)), 2));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(5, maximumHappinessSum(new ArrayList<>(Arrays.asList(2,3,4,5)), 1));
23
+ }
24
+
25
+ }
maximize_happiness_of_selected_children/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:85fe1c77989ae4dc0b5c99a7b7398b82734ba98c00363a7af9ac2fbe03492968
3
+ size 27033882
maximize_happiness_of_selected_children/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
maximize_happiness_of_selected_children/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
maximize_number_of_subsequences_in_a_string/.DS_Store ADDED
Binary file (6.15 kB). View file
 
maximize_number_of_subsequences_in_a_string/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 (maximumSubsequenceCount \"abdcdbc \" \"ac \")," 4 (maximumSubsequenceCount "abdcdbc" "ac"))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (maximumSubsequenceCount \"aabb \" \"ab \")," 6 (maximumSubsequenceCount "aabb" "ab"))
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
maximize_number_of_subsequences_in_a_string/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(4, maximumSubsequenceCount("abdcdbc", "ac"));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(6, maximumSubsequenceCount("aabb", "ab"));
19
+ }
20
+
21
+ }
maximize_number_of_subsequences_in_a_string/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
maximize_number_of_subsequences_in_a_string/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 4 (maximumSubsequenceCount "abdcdbc" "ac")
12
+
13
+ let test2 _ = assert_equal 6 (maximumSubsequenceCount "aabb" "ab")
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for maximumSubsequenceCount" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
maximize_number_of_subsequences_in_a_string/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.maximumSubsequenceCount("abdcdbc","ac"), 4)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.maximumSubsequenceCount("aabb","ab"), 6)
10
+ }
11
+
12
+ }
maximize_score_of_numbers_in_ranges/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
maximize_score_of_numbers_in_ranges/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(4, maxPossibleScore(new ArrayList<>(Arrays.asList(6,0,3)), 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(5, maxPossibleScore(new ArrayList<>(Arrays.asList(2,6,13,13)), 5));
19
+ }
20
+
21
+ }
maximize_score_of_numbers_in_ranges/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:368dd5dfe6dd280f0de38c0e63a43badff16317db1698ad02750093e123aa924
3
+ size 14024828
maximize_score_of_numbers_in_ranges/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
maximize_score_of_numbers_in_ranges/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
maximize_subarray_sum_after_removing_all_occurrences_of_one_element/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
maximize_subarray_sum_after_removing_all_occurrences_of_one_element/java_tests/Main.java ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ public class Main {
7
+ //Program start
8
+
9
+ //Program end
10
+
11
+ @Test
12
+ public void test1() {
13
+ assertEquals(7, maxSubarraySum(Arrays.asList(-3,2,-2,-1,3,-2,3)));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(10, maxSubarraySum(Arrays.asList(1,2,3,4)));
18
+ }
19
+
20
+ }
maximize_subarray_sum_after_removing_all_occurrences_of_one_element/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
maximize_subarray_sum_after_removing_all_occurrences_of_one_element/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
maximize_subarray_sum_after_removing_all_occurrences_of_one_element/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
maximize_subarrays_after_removing_one_conflicting_pair/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 (maxSubarrays 4 [[2,3],[1,4]])," 9 (maxSubarrays 4 [[2,3],[1,4]]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (maxSubarrays 5 [[1,2],[2,5],[3,5]])," 12 (maxSubarrays 5 [[1,2],[2,5],[3,5]]))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (maxSubarrays 9 [[2, 7], [4, 3], [3, 1], [5, 9], [2, 5]])," 30 (maxSubarrays 9 [[2, 7], [4, 3], [3, 1], [5, 9], [2, 5]]))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (maxSubarrays 35 [[30, 24], [26, 11], [27, 34], [1, 15], [19, 7], [22, 30], [23, 29], [2, 12], [23, 2], [20, 12], [12, 8]])," 328 (maxSubarrays 35 [[30, 24], [26, 11], [27, 34], [1, 15], [19, 7], [22, 30], [23, 29], [2, 12], [23, 2], [20, 12], [12, 8]]))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (maxSubarrays 82 [[81, 76], [55, 57], [53, 14], [59, 73], [28, 67], [22, 35], [69, 22], [23, 43], [32, 76], [49, 16], [39, 17], [30, 48], [35, 44], [5, 21], [46, 4], [67, 36], [80, 60], [44, 49], [36, 75], [9, 58], [47, 20], [2, 52], [65, 1], [73, 39], [11, 64], [75, 12], [5, 23], [41, 74], [49, 57], [6, 52], [80, 35], [13, 67], [55, 45], [33, 79], [82, 8], [18, 69], [50, 49], [54, 74], [45, 16], [22, 78], [34, 25], [67, 22], [50, 15], [13, 23], [54, 58], [19, 36], [63, 70], [46, 29], [9, 44], [17, 57], [45, 73], [29, 22], [29, 31], [17, 11], [37, 14], [68, 65], [32, 75], [61, 26], [1, 69], [82, 76], [54, 78], [37, 71], [29, 33], [32, 77], [48, 12], [57, 79], [56, 4], [63, 74], [37, 64], [6, 79], [45, 77], [39, 27], [43, 52], [4, 15], [21, 31], [7, 59], [2, 72], [25, 19], [19, 33], [42, 35], [57, 35], [22, 13], [41, 57], [50, 69], [47, 15], [27, 76], [18, 61], [9, 25], [37, 41], [48, 80], [20, 73], [66, 40], [77, 70], [58, 20], [10, 62], [30, 10], [1, 13], [48, 73], [67, 53], [80, 50], [20, 66], [61, 46], [14, 4], [78, 71], [60, 65], [26, 51], [35, 63], [36, 28], [17, 24], [39, 54], [57, 69], [28, 33], [34, 49], [74, 30], [14, 52], [50, 57], [45, 15], [34, 15], [7, 40], [2, 53], [8, 69], [2, 7], [56, 42], [25, 73], [11, 19], [17, 35], [82, 70], [31, 70], [26, 28], [14, 20], [82, 54], [29, 48], [32, 19], [43, 28], [77, 60]])," 556 (maxSubarrays 82 [[81, 76], [55, 57], [53, 14], [59, 73], [28, 67], [22, 35], [69, 22], [23, 43], [32, 76], [49, 16], [39, 17], [30, 48], [35, 44], [5, 21], [46, 4], [67, 36], [80, 60], [44, 49], [36, 75], [9, 58], [47, 20], [2, 52], [65, 1], [73, 39], [11, 64], [75, 12], [5, 23], [41, 74], [49, 57], [6, 52], [80, 35], [13, 67], [55, 45], [33, 79], [82, 8], [18, 69], [50, 49], [54, 74], [45, 16], [22, 78], [34, 25], [67, 22], [50, 15], [13, 23], [54, 58], [19, 36], [63, 70], [46, 29], [9, 44], [17, 57], [45, 73], [29, 22], [29, 31], [17, 11], [37, 14], [68, 65], [32, 75], [61, 26], [1, 69], [82, 76], [54, 78], [37, 71], [29, 33], [32, 77], [48, 12], [57, 79], [56, 4], [63, 74], [37, 64], [6, 79], [45, 77], [39, 27], [43, 52], [4, 15], [21, 31], [7, 59], [2, 72], [25, 19], [19, 33], [42, 35], [57, 35], [22, 13], [41, 57], [50, 69], [47, 15], [27, 76], [18, 61], [9, 25], [37, 41], [48, 80], [20, 73], [66, 40], [77, 70], [58, 20], [10, 62], [30, 10], [1, 13], [48, 73], [67, 53], [80, 50], [20, 66], [61, 46], [14, 4], [78, 71], [60, 65], [26, 51], [35, 63], [36, 28], [17, 24], [39, 54], [57, 69], [28, 33], [34, 49], [74, 30], [14, 52], [50, 57], [45, 15], [34, 15], [7, 40], [2, 53], [8, 69], [2, 7], [56, 42], [25, 73], [11, 19], [17, 35], [82, 70], [31, 70], [26, 28], [14, 20], [82, 54], [29, 48], [32, 19], [43, 28], [77, 60]]))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (maxSubarrays 96 [[48, 21], [72, 18], [33, 36], [60, 50], [89, 7], [81, 91], [70, 58], [59, 67], [80, 10], [20, 93], [86, 35], [31, 38], [82, 1], [40, 53], [23, 49], [61, 36], [42, 32], [10, 94], [80, 58], [93, 49], [94, 69], [43, 63], [11, 56], [23, 27], [47, 24], [10, 11], [65, 11], [13, 7], [27, 94], [5, 39], [53, 58], [15, 65], [27, 39], [18, 64], [37, 52], [84, 12], [13, 92], [68, 86], [87, 75], [79, 86], [53, 18], [42, 37], [32, 41], [29, 30], [41, 47], [40, 94], [83, 7], [32, 1], [6, 34], [29, 36], [78, 32], [81, 52], [10, 65], [34, 47], [17, 37], [47, 41], [64, 8]])," 1002 (maxSubarrays 96 [[48, 21], [72, 18], [33, 36], [60, 50], [89, 7], [81, 91], [70, 58], [59, 67], [80, 10], [20, 93], [86, 35], [31, 38], [82, 1], [40, 53], [23, 49], [61, 36], [42, 32], [10, 94], [80, 58], [93, 49], [94, 69], [43, 63], [11, 56], [23, 27], [47, 24], [10, 11], [65, 11], [13, 7], [27, 94], [5, 39], [53, 58], [15, 65], [27, 39], [18, 64], [37, 52], [84, 12], [13, 92], [68, 86], [87, 75], [79, 86], [53, 18], [42, 37], [32, 41], [29, 30], [41, 47], [40, 94], [83, 7], [32, 1], [6, 34], [29, 36], [78, 32], [81, 52], [10, 65], [34, 47], [17, 37], [47, 41], [64, 8]]))
28
+
29
+ test7 :: Test
30
+ test7 = TestCase (assertEqual "for (maxSubarrays 82 [[62, 30], [5, 76], [37, 55], [62, 58], [53, 33], [82, 80], [19, 36], [57, 26], [11, 2], [67, 73], [33, 82], [63, 46], [44, 8], [38, 49]])," 1482 (maxSubarrays 82 [[62, 30], [5, 76], [37, 55], [62, 58], [53, 33], [82, 80], [19, 36], [57, 26], [11, 2], [67, 73], [33, 82], [63, 46], [44, 8], [38, 49]]))
31
+
32
+ test8 :: Test
33
+ test8 = TestCase (assertEqual "for (maxSubarrays 17 [[12, 1], [12, 7], [12, 10], [3, 1], [14, 13], [5, 10], [17, 12], [8, 3], [11, 5], [11, 14], [11, 17], [7, 4], [15, 5], [1, 15], [15, 8], [4, 2], [4, 5], [17, 11], [9, 1], [3, 15], [17, 14], [10, 5], [10, 8], [16, 3], [13, 10], [2, 10], [6, 4], [7, 12], [12, 8], [4, 13], [1, 16]])," 47 (maxSubarrays 17 [[12, 1], [12, 7], [12, 10], [3, 1], [14, 13], [5, 10], [17, 12], [8, 3], [11, 5], [11, 14], [11, 17], [7, 4], [15, 5], [1, 15], [15, 8], [4, 2], [4, 5], [17, 11], [9, 1], [3, 15], [17, 14], [10, 5], [10, 8], [16, 3], [13, 10], [2, 10], [6, 4], [7, 12], [12, 8], [4, 13], [1, 16]]))
34
+
35
+ test9 :: Test
36
+ test9 = TestCase (assertEqual "for (maxSubarrays 39 [[6, 18], [29, 23], [21, 13], [14, 7], [15, 36], [6, 36], [30, 3], [9, 11], [2, 5], [36, 31], [1, 9], [36, 34], [12, 3], [27, 6], [22, 25], [23, 27], [35, 13], [15, 7], [33, 31], [20, 9], [25, 27], [9, 37], [27, 2], [29, 27], [36, 17], [25, 2], [2, 3], [27, 35], [8, 31], [26, 18], [13, 24]])," 222 (maxSubarrays 39 [[6, 18], [29, 23], [21, 13], [14, 7], [15, 36], [6, 36], [30, 3], [9, 11], [2, 5], [36, 31], [1, 9], [36, 34], [12, 3], [27, 6], [22, 25], [23, 27], [35, 13], [15, 7], [33, 31], [20, 9], [25, 27], [9, 37], [27, 2], [29, 27], [36, 17], [25, 2], [2, 3], [27, 35], [8, 31], [26, 18], [13, 24]]))
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
maximize_subarrays_after_removing_one_conflicting_pair/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(9, maxSubarrays(4, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(2,3)),new ArrayList<>(Arrays.asList(1,4))))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(12, maxSubarrays(5, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,2)),new ArrayList<>(Arrays.asList(2,5)),new ArrayList<>(Arrays.asList(3,5))))));
19
+ }
20
+
21
+ }
maximize_subarrays_after_removing_one_conflicting_pair/meta.json ADDED
@@ -0,0 +1,2067 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3789,
3
+ "name": "maximize_subarrays_after_removing_one_conflicting_pair",
4
+ "difficulty": "Hard",
5
+ "link": "https://leetcode.com/problems/maximize-subarrays-after-removing-one-conflicting-pair/",
6
+ "date": "2025-03-02 00:00:00",
7
+ "task_description": "You are given an integer `n` which represents an array `nums` containing the numbers from 1 to `n` in order. Additionally, you are given a 2D array `conflictingPairs`, where `conflictingPairs[i] = [a, b]` indicates that `a` and `b` form a conflicting pair. Remove **exactly** one element from `conflictingPairs`. Afterward, count the number of non-empty subarrays of `nums` which do not contain both `a` and `b` for any remaining conflicting pair `[a, b]`. Return the **maximum** number of subarrays possible after removing **exactly** one conflicting pair. **Example 1:** **Input:** n = 4, conflictingPairs = [[2,3],[1,4]] **Output:** 9 **Explanation:** Remove `[2, 3]` from `conflictingPairs`. Now, `conflictingPairs = [[1, 4]]`. There are 9 subarrays in `nums` where `[1, 4]` do not appear together. They are `[1]`, `[2]`, `[3]`, `[4]`, `[1, 2]`, `[2, 3]`, `[3, 4]`, `[1, 2, 3]` and `[2, 3, 4]`. The maximum number of subarrays we can achieve after removing one element from `conflictingPairs` is 9. **Example 2:** **Input:** n = 5, conflictingPairs = [[1,2],[2,5],[3,5]] **Output:** 12 **Explanation:** Remove `[1, 2]` from `conflictingPairs`. Now, `conflictingPairs = [[2, 5], [3, 5]]`. There are 12 subarrays in `nums` where `[2, 5]` and `[3, 5]` do not appear together. The maximum number of subarrays we can achieve after removing one element from `conflictingPairs` is 12. **Constraints:** `2 <= n <= 105` `1 <= conflictingPairs.length <= 2 * n` `conflictingPairs[i].length == 2` `1 <= conflictingPairs[i][j] <= n` `conflictingPairs[i][0] != conflictingPairs[i][1]`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "n = 4, conflictingPairs = [[2,3],[1,4]]",
12
+ "output": "9 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "n = 5, conflictingPairs = [[1,2],[2,5],[3,5]]",
17
+ "output": "12 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 9,
24
+ [
25
+ [
26
+ 2,
27
+ 7
28
+ ],
29
+ [
30
+ 4,
31
+ 3
32
+ ],
33
+ [
34
+ 3,
35
+ 1
36
+ ],
37
+ [
38
+ 5,
39
+ 9
40
+ ],
41
+ [
42
+ 2,
43
+ 5
44
+ ]
45
+ ]
46
+ ],
47
+ "output": 30
48
+ },
49
+ {
50
+ "input": [
51
+ 35,
52
+ [
53
+ [
54
+ 30,
55
+ 24
56
+ ],
57
+ [
58
+ 26,
59
+ 11
60
+ ],
61
+ [
62
+ 27,
63
+ 34
64
+ ],
65
+ [
66
+ 1,
67
+ 15
68
+ ],
69
+ [
70
+ 19,
71
+ 7
72
+ ],
73
+ [
74
+ 22,
75
+ 30
76
+ ],
77
+ [
78
+ 23,
79
+ 29
80
+ ],
81
+ [
82
+ 2,
83
+ 12
84
+ ],
85
+ [
86
+ 23,
87
+ 2
88
+ ],
89
+ [
90
+ 20,
91
+ 12
92
+ ],
93
+ [
94
+ 12,
95
+ 8
96
+ ]
97
+ ]
98
+ ],
99
+ "output": 328
100
+ },
101
+ {
102
+ "input": [
103
+ 82,
104
+ [
105
+ [
106
+ 81,
107
+ 76
108
+ ],
109
+ [
110
+ 55,
111
+ 57
112
+ ],
113
+ [
114
+ 53,
115
+ 14
116
+ ],
117
+ [
118
+ 59,
119
+ 73
120
+ ],
121
+ [
122
+ 28,
123
+ 67
124
+ ],
125
+ [
126
+ 22,
127
+ 35
128
+ ],
129
+ [
130
+ 69,
131
+ 22
132
+ ],
133
+ [
134
+ 23,
135
+ 43
136
+ ],
137
+ [
138
+ 32,
139
+ 76
140
+ ],
141
+ [
142
+ 49,
143
+ 16
144
+ ],
145
+ [
146
+ 39,
147
+ 17
148
+ ],
149
+ [
150
+ 30,
151
+ 48
152
+ ],
153
+ [
154
+ 35,
155
+ 44
156
+ ],
157
+ [
158
+ 5,
159
+ 21
160
+ ],
161
+ [
162
+ 46,
163
+ 4
164
+ ],
165
+ [
166
+ 67,
167
+ 36
168
+ ],
169
+ [
170
+ 80,
171
+ 60
172
+ ],
173
+ [
174
+ 44,
175
+ 49
176
+ ],
177
+ [
178
+ 36,
179
+ 75
180
+ ],
181
+ [
182
+ 9,
183
+ 58
184
+ ],
185
+ [
186
+ 47,
187
+ 20
188
+ ],
189
+ [
190
+ 2,
191
+ 52
192
+ ],
193
+ [
194
+ 65,
195
+ 1
196
+ ],
197
+ [
198
+ 73,
199
+ 39
200
+ ],
201
+ [
202
+ 11,
203
+ 64
204
+ ],
205
+ [
206
+ 75,
207
+ 12
208
+ ],
209
+ [
210
+ 5,
211
+ 23
212
+ ],
213
+ [
214
+ 41,
215
+ 74
216
+ ],
217
+ [
218
+ 49,
219
+ 57
220
+ ],
221
+ [
222
+ 6,
223
+ 52
224
+ ],
225
+ [
226
+ 80,
227
+ 35
228
+ ],
229
+ [
230
+ 13,
231
+ 67
232
+ ],
233
+ [
234
+ 55,
235
+ 45
236
+ ],
237
+ [
238
+ 33,
239
+ 79
240
+ ],
241
+ [
242
+ 82,
243
+ 8
244
+ ],
245
+ [
246
+ 18,
247
+ 69
248
+ ],
249
+ [
250
+ 50,
251
+ 49
252
+ ],
253
+ [
254
+ 54,
255
+ 74
256
+ ],
257
+ [
258
+ 45,
259
+ 16
260
+ ],
261
+ [
262
+ 22,
263
+ 78
264
+ ],
265
+ [
266
+ 34,
267
+ 25
268
+ ],
269
+ [
270
+ 67,
271
+ 22
272
+ ],
273
+ [
274
+ 50,
275
+ 15
276
+ ],
277
+ [
278
+ 13,
279
+ 23
280
+ ],
281
+ [
282
+ 54,
283
+ 58
284
+ ],
285
+ [
286
+ 19,
287
+ 36
288
+ ],
289
+ [
290
+ 63,
291
+ 70
292
+ ],
293
+ [
294
+ 46,
295
+ 29
296
+ ],
297
+ [
298
+ 9,
299
+ 44
300
+ ],
301
+ [
302
+ 17,
303
+ 57
304
+ ],
305
+ [
306
+ 45,
307
+ 73
308
+ ],
309
+ [
310
+ 29,
311
+ 22
312
+ ],
313
+ [
314
+ 29,
315
+ 31
316
+ ],
317
+ [
318
+ 17,
319
+ 11
320
+ ],
321
+ [
322
+ 37,
323
+ 14
324
+ ],
325
+ [
326
+ 68,
327
+ 65
328
+ ],
329
+ [
330
+ 32,
331
+ 75
332
+ ],
333
+ [
334
+ 61,
335
+ 26
336
+ ],
337
+ [
338
+ 1,
339
+ 69
340
+ ],
341
+ [
342
+ 82,
343
+ 76
344
+ ],
345
+ [
346
+ 54,
347
+ 78
348
+ ],
349
+ [
350
+ 37,
351
+ 71
352
+ ],
353
+ [
354
+ 29,
355
+ 33
356
+ ],
357
+ [
358
+ 32,
359
+ 77
360
+ ],
361
+ [
362
+ 48,
363
+ 12
364
+ ],
365
+ [
366
+ 57,
367
+ 79
368
+ ],
369
+ [
370
+ 56,
371
+ 4
372
+ ],
373
+ [
374
+ 63,
375
+ 74
376
+ ],
377
+ [
378
+ 37,
379
+ 64
380
+ ],
381
+ [
382
+ 6,
383
+ 79
384
+ ],
385
+ [
386
+ 45,
387
+ 77
388
+ ],
389
+ [
390
+ 39,
391
+ 27
392
+ ],
393
+ [
394
+ 43,
395
+ 52
396
+ ],
397
+ [
398
+ 4,
399
+ 15
400
+ ],
401
+ [
402
+ 21,
403
+ 31
404
+ ],
405
+ [
406
+ 7,
407
+ 59
408
+ ],
409
+ [
410
+ 2,
411
+ 72
412
+ ],
413
+ [
414
+ 25,
415
+ 19
416
+ ],
417
+ [
418
+ 19,
419
+ 33
420
+ ],
421
+ [
422
+ 42,
423
+ 35
424
+ ],
425
+ [
426
+ 57,
427
+ 35
428
+ ],
429
+ [
430
+ 22,
431
+ 13
432
+ ],
433
+ [
434
+ 41,
435
+ 57
436
+ ],
437
+ [
438
+ 50,
439
+ 69
440
+ ],
441
+ [
442
+ 47,
443
+ 15
444
+ ],
445
+ [
446
+ 27,
447
+ 76
448
+ ],
449
+ [
450
+ 18,
451
+ 61
452
+ ],
453
+ [
454
+ 9,
455
+ 25
456
+ ],
457
+ [
458
+ 37,
459
+ 41
460
+ ],
461
+ [
462
+ 48,
463
+ 80
464
+ ],
465
+ [
466
+ 20,
467
+ 73
468
+ ],
469
+ [
470
+ 66,
471
+ 40
472
+ ],
473
+ [
474
+ 77,
475
+ 70
476
+ ],
477
+ [
478
+ 58,
479
+ 20
480
+ ],
481
+ [
482
+ 10,
483
+ 62
484
+ ],
485
+ [
486
+ 30,
487
+ 10
488
+ ],
489
+ [
490
+ 1,
491
+ 13
492
+ ],
493
+ [
494
+ 48,
495
+ 73
496
+ ],
497
+ [
498
+ 67,
499
+ 53
500
+ ],
501
+ [
502
+ 80,
503
+ 50
504
+ ],
505
+ [
506
+ 20,
507
+ 66
508
+ ],
509
+ [
510
+ 61,
511
+ 46
512
+ ],
513
+ [
514
+ 14,
515
+ 4
516
+ ],
517
+ [
518
+ 78,
519
+ 71
520
+ ],
521
+ [
522
+ 60,
523
+ 65
524
+ ],
525
+ [
526
+ 26,
527
+ 51
528
+ ],
529
+ [
530
+ 35,
531
+ 63
532
+ ],
533
+ [
534
+ 36,
535
+ 28
536
+ ],
537
+ [
538
+ 17,
539
+ 24
540
+ ],
541
+ [
542
+ 39,
543
+ 54
544
+ ],
545
+ [
546
+ 57,
547
+ 69
548
+ ],
549
+ [
550
+ 28,
551
+ 33
552
+ ],
553
+ [
554
+ 34,
555
+ 49
556
+ ],
557
+ [
558
+ 74,
559
+ 30
560
+ ],
561
+ [
562
+ 14,
563
+ 52
564
+ ],
565
+ [
566
+ 50,
567
+ 57
568
+ ],
569
+ [
570
+ 45,
571
+ 15
572
+ ],
573
+ [
574
+ 34,
575
+ 15
576
+ ],
577
+ [
578
+ 7,
579
+ 40
580
+ ],
581
+ [
582
+ 2,
583
+ 53
584
+ ],
585
+ [
586
+ 8,
587
+ 69
588
+ ],
589
+ [
590
+ 2,
591
+ 7
592
+ ],
593
+ [
594
+ 56,
595
+ 42
596
+ ],
597
+ [
598
+ 25,
599
+ 73
600
+ ],
601
+ [
602
+ 11,
603
+ 19
604
+ ],
605
+ [
606
+ 17,
607
+ 35
608
+ ],
609
+ [
610
+ 82,
611
+ 70
612
+ ],
613
+ [
614
+ 31,
615
+ 70
616
+ ],
617
+ [
618
+ 26,
619
+ 28
620
+ ],
621
+ [
622
+ 14,
623
+ 20
624
+ ],
625
+ [
626
+ 82,
627
+ 54
628
+ ],
629
+ [
630
+ 29,
631
+ 48
632
+ ],
633
+ [
634
+ 32,
635
+ 19
636
+ ],
637
+ [
638
+ 43,
639
+ 28
640
+ ],
641
+ [
642
+ 77,
643
+ 60
644
+ ]
645
+ ]
646
+ ],
647
+ "output": 556
648
+ },
649
+ {
650
+ "input": [
651
+ 96,
652
+ [
653
+ [
654
+ 48,
655
+ 21
656
+ ],
657
+ [
658
+ 72,
659
+ 18
660
+ ],
661
+ [
662
+ 33,
663
+ 36
664
+ ],
665
+ [
666
+ 60,
667
+ 50
668
+ ],
669
+ [
670
+ 89,
671
+ 7
672
+ ],
673
+ [
674
+ 81,
675
+ 91
676
+ ],
677
+ [
678
+ 70,
679
+ 58
680
+ ],
681
+ [
682
+ 59,
683
+ 67
684
+ ],
685
+ [
686
+ 80,
687
+ 10
688
+ ],
689
+ [
690
+ 20,
691
+ 93
692
+ ],
693
+ [
694
+ 86,
695
+ 35
696
+ ],
697
+ [
698
+ 31,
699
+ 38
700
+ ],
701
+ [
702
+ 82,
703
+ 1
704
+ ],
705
+ [
706
+ 40,
707
+ 53
708
+ ],
709
+ [
710
+ 23,
711
+ 49
712
+ ],
713
+ [
714
+ 61,
715
+ 36
716
+ ],
717
+ [
718
+ 42,
719
+ 32
720
+ ],
721
+ [
722
+ 10,
723
+ 94
724
+ ],
725
+ [
726
+ 80,
727
+ 58
728
+ ],
729
+ [
730
+ 93,
731
+ 49
732
+ ],
733
+ [
734
+ 94,
735
+ 69
736
+ ],
737
+ [
738
+ 43,
739
+ 63
740
+ ],
741
+ [
742
+ 11,
743
+ 56
744
+ ],
745
+ [
746
+ 23,
747
+ 27
748
+ ],
749
+ [
750
+ 47,
751
+ 24
752
+ ],
753
+ [
754
+ 10,
755
+ 11
756
+ ],
757
+ [
758
+ 65,
759
+ 11
760
+ ],
761
+ [
762
+ 13,
763
+ 7
764
+ ],
765
+ [
766
+ 27,
767
+ 94
768
+ ],
769
+ [
770
+ 5,
771
+ 39
772
+ ],
773
+ [
774
+ 53,
775
+ 58
776
+ ],
777
+ [
778
+ 15,
779
+ 65
780
+ ],
781
+ [
782
+ 27,
783
+ 39
784
+ ],
785
+ [
786
+ 18,
787
+ 64
788
+ ],
789
+ [
790
+ 37,
791
+ 52
792
+ ],
793
+ [
794
+ 84,
795
+ 12
796
+ ],
797
+ [
798
+ 13,
799
+ 92
800
+ ],
801
+ [
802
+ 68,
803
+ 86
804
+ ],
805
+ [
806
+ 87,
807
+ 75
808
+ ],
809
+ [
810
+ 79,
811
+ 86
812
+ ],
813
+ [
814
+ 53,
815
+ 18
816
+ ],
817
+ [
818
+ 42,
819
+ 37
820
+ ],
821
+ [
822
+ 32,
823
+ 41
824
+ ],
825
+ [
826
+ 29,
827
+ 30
828
+ ],
829
+ [
830
+ 41,
831
+ 47
832
+ ],
833
+ [
834
+ 40,
835
+ 94
836
+ ],
837
+ [
838
+ 83,
839
+ 7
840
+ ],
841
+ [
842
+ 32,
843
+ 1
844
+ ],
845
+ [
846
+ 6,
847
+ 34
848
+ ],
849
+ [
850
+ 29,
851
+ 36
852
+ ],
853
+ [
854
+ 78,
855
+ 32
856
+ ],
857
+ [
858
+ 81,
859
+ 52
860
+ ],
861
+ [
862
+ 10,
863
+ 65
864
+ ],
865
+ [
866
+ 34,
867
+ 47
868
+ ],
869
+ [
870
+ 17,
871
+ 37
872
+ ],
873
+ [
874
+ 47,
875
+ 41
876
+ ],
877
+ [
878
+ 64,
879
+ 8
880
+ ]
881
+ ]
882
+ ],
883
+ "output": 1002
884
+ },
885
+ {
886
+ "input": [
887
+ 82,
888
+ [
889
+ [
890
+ 62,
891
+ 30
892
+ ],
893
+ [
894
+ 5,
895
+ 76
896
+ ],
897
+ [
898
+ 37,
899
+ 55
900
+ ],
901
+ [
902
+ 62,
903
+ 58
904
+ ],
905
+ [
906
+ 53,
907
+ 33
908
+ ],
909
+ [
910
+ 82,
911
+ 80
912
+ ],
913
+ [
914
+ 19,
915
+ 36
916
+ ],
917
+ [
918
+ 57,
919
+ 26
920
+ ],
921
+ [
922
+ 11,
923
+ 2
924
+ ],
925
+ [
926
+ 67,
927
+ 73
928
+ ],
929
+ [
930
+ 33,
931
+ 82
932
+ ],
933
+ [
934
+ 63,
935
+ 46
936
+ ],
937
+ [
938
+ 44,
939
+ 8
940
+ ],
941
+ [
942
+ 38,
943
+ 49
944
+ ]
945
+ ]
946
+ ],
947
+ "output": 1482
948
+ },
949
+ {
950
+ "input": [
951
+ 17,
952
+ [
953
+ [
954
+ 12,
955
+ 1
956
+ ],
957
+ [
958
+ 12,
959
+ 7
960
+ ],
961
+ [
962
+ 12,
963
+ 10
964
+ ],
965
+ [
966
+ 3,
967
+ 1
968
+ ],
969
+ [
970
+ 14,
971
+ 13
972
+ ],
973
+ [
974
+ 5,
975
+ 10
976
+ ],
977
+ [
978
+ 17,
979
+ 12
980
+ ],
981
+ [
982
+ 8,
983
+ 3
984
+ ],
985
+ [
986
+ 11,
987
+ 5
988
+ ],
989
+ [
990
+ 11,
991
+ 14
992
+ ],
993
+ [
994
+ 11,
995
+ 17
996
+ ],
997
+ [
998
+ 7,
999
+ 4
1000
+ ],
1001
+ [
1002
+ 15,
1003
+ 5
1004
+ ],
1005
+ [
1006
+ 1,
1007
+ 15
1008
+ ],
1009
+ [
1010
+ 15,
1011
+ 8
1012
+ ],
1013
+ [
1014
+ 4,
1015
+ 2
1016
+ ],
1017
+ [
1018
+ 4,
1019
+ 5
1020
+ ],
1021
+ [
1022
+ 17,
1023
+ 11
1024
+ ],
1025
+ [
1026
+ 9,
1027
+ 1
1028
+ ],
1029
+ [
1030
+ 3,
1031
+ 15
1032
+ ],
1033
+ [
1034
+ 17,
1035
+ 14
1036
+ ],
1037
+ [
1038
+ 10,
1039
+ 5
1040
+ ],
1041
+ [
1042
+ 10,
1043
+ 8
1044
+ ],
1045
+ [
1046
+ 16,
1047
+ 3
1048
+ ],
1049
+ [
1050
+ 13,
1051
+ 10
1052
+ ],
1053
+ [
1054
+ 2,
1055
+ 10
1056
+ ],
1057
+ [
1058
+ 6,
1059
+ 4
1060
+ ],
1061
+ [
1062
+ 7,
1063
+ 12
1064
+ ],
1065
+ [
1066
+ 12,
1067
+ 8
1068
+ ],
1069
+ [
1070
+ 4,
1071
+ 13
1072
+ ],
1073
+ [
1074
+ 1,
1075
+ 16
1076
+ ]
1077
+ ]
1078
+ ],
1079
+ "output": 47
1080
+ },
1081
+ {
1082
+ "input": [
1083
+ 39,
1084
+ [
1085
+ [
1086
+ 6,
1087
+ 18
1088
+ ],
1089
+ [
1090
+ 29,
1091
+ 23
1092
+ ],
1093
+ [
1094
+ 21,
1095
+ 13
1096
+ ],
1097
+ [
1098
+ 14,
1099
+ 7
1100
+ ],
1101
+ [
1102
+ 15,
1103
+ 36
1104
+ ],
1105
+ [
1106
+ 6,
1107
+ 36
1108
+ ],
1109
+ [
1110
+ 30,
1111
+ 3
1112
+ ],
1113
+ [
1114
+ 9,
1115
+ 11
1116
+ ],
1117
+ [
1118
+ 2,
1119
+ 5
1120
+ ],
1121
+ [
1122
+ 36,
1123
+ 31
1124
+ ],
1125
+ [
1126
+ 1,
1127
+ 9
1128
+ ],
1129
+ [
1130
+ 36,
1131
+ 34
1132
+ ],
1133
+ [
1134
+ 12,
1135
+ 3
1136
+ ],
1137
+ [
1138
+ 27,
1139
+ 6
1140
+ ],
1141
+ [
1142
+ 22,
1143
+ 25
1144
+ ],
1145
+ [
1146
+ 23,
1147
+ 27
1148
+ ],
1149
+ [
1150
+ 35,
1151
+ 13
1152
+ ],
1153
+ [
1154
+ 15,
1155
+ 7
1156
+ ],
1157
+ [
1158
+ 33,
1159
+ 31
1160
+ ],
1161
+ [
1162
+ 20,
1163
+ 9
1164
+ ],
1165
+ [
1166
+ 25,
1167
+ 27
1168
+ ],
1169
+ [
1170
+ 9,
1171
+ 37
1172
+ ],
1173
+ [
1174
+ 27,
1175
+ 2
1176
+ ],
1177
+ [
1178
+ 29,
1179
+ 27
1180
+ ],
1181
+ [
1182
+ 36,
1183
+ 17
1184
+ ],
1185
+ [
1186
+ 25,
1187
+ 2
1188
+ ],
1189
+ [
1190
+ 2,
1191
+ 3
1192
+ ],
1193
+ [
1194
+ 27,
1195
+ 35
1196
+ ],
1197
+ [
1198
+ 8,
1199
+ 31
1200
+ ],
1201
+ [
1202
+ 26,
1203
+ 18
1204
+ ],
1205
+ [
1206
+ 13,
1207
+ 24
1208
+ ]
1209
+ ]
1210
+ ],
1211
+ "output": 222
1212
+ },
1213
+ {
1214
+ "input": [
1215
+ 105,
1216
+ [
1217
+ [
1218
+ 83,
1219
+ 49
1220
+ ],
1221
+ [
1222
+ 103,
1223
+ 76
1224
+ ],
1225
+ [
1226
+ 71,
1227
+ 81
1228
+ ],
1229
+ [
1230
+ 64,
1231
+ 72
1232
+ ],
1233
+ [
1234
+ 40,
1235
+ 23
1236
+ ],
1237
+ [
1238
+ 17,
1239
+ 61
1240
+ ],
1241
+ [
1242
+ 100,
1243
+ 28
1244
+ ],
1245
+ [
1246
+ 17,
1247
+ 76
1248
+ ],
1249
+ [
1250
+ 102,
1251
+ 28
1252
+ ],
1253
+ [
1254
+ 99,
1255
+ 11
1256
+ ],
1257
+ [
1258
+ 15,
1259
+ 63
1260
+ ],
1261
+ [
1262
+ 94,
1263
+ 27
1264
+ ],
1265
+ [
1266
+ 33,
1267
+ 20
1268
+ ],
1269
+ [
1270
+ 54,
1271
+ 61
1272
+ ],
1273
+ [
1274
+ 30,
1275
+ 42
1276
+ ],
1277
+ [
1278
+ 99,
1279
+ 29
1280
+ ],
1281
+ [
1282
+ 36,
1283
+ 6
1284
+ ],
1285
+ [
1286
+ 97,
1287
+ 22
1288
+ ],
1289
+ [
1290
+ 81,
1291
+ 35
1292
+ ],
1293
+ [
1294
+ 42,
1295
+ 53
1296
+ ],
1297
+ [
1298
+ 54,
1299
+ 91
1300
+ ],
1301
+ [
1302
+ 84,
1303
+ 46
1304
+ ],
1305
+ [
1306
+ 31,
1307
+ 101
1308
+ ],
1309
+ [
1310
+ 15,
1311
+ 68
1312
+ ],
1313
+ [
1314
+ 27,
1315
+ 97
1316
+ ],
1317
+ [
1318
+ 41,
1319
+ 96
1320
+ ],
1321
+ [
1322
+ 6,
1323
+ 68
1324
+ ],
1325
+ [
1326
+ 66,
1327
+ 95
1328
+ ],
1329
+ [
1330
+ 54,
1331
+ 72
1332
+ ],
1333
+ [
1334
+ 47,
1335
+ 66
1336
+ ],
1337
+ [
1338
+ 92,
1339
+ 77
1340
+ ],
1341
+ [
1342
+ 1,
1343
+ 50
1344
+ ],
1345
+ [
1346
+ 37,
1347
+ 28
1348
+ ],
1349
+ [
1350
+ 4,
1351
+ 92
1352
+ ],
1353
+ [
1354
+ 105,
1355
+ 19
1356
+ ],
1357
+ [
1358
+ 8,
1359
+ 80
1360
+ ],
1361
+ [
1362
+ 6,
1363
+ 58
1364
+ ],
1365
+ [
1366
+ 23,
1367
+ 47
1368
+ ],
1369
+ [
1370
+ 54,
1371
+ 56
1372
+ ],
1373
+ [
1374
+ 25,
1375
+ 17
1376
+ ],
1377
+ [
1378
+ 41,
1379
+ 92
1380
+ ],
1381
+ [
1382
+ 73,
1383
+ 66
1384
+ ]
1385
+ ]
1386
+ ],
1387
+ "output": 1574
1388
+ },
1389
+ {
1390
+ "input": [
1391
+ 13,
1392
+ [
1393
+ [
1394
+ 3,
1395
+ 13
1396
+ ],
1397
+ [
1398
+ 13,
1399
+ 5
1400
+ ],
1401
+ [
1402
+ 1,
1403
+ 12
1404
+ ],
1405
+ [
1406
+ 6,
1407
+ 11
1408
+ ],
1409
+ [
1410
+ 3,
1411
+ 6
1412
+ ],
1413
+ [
1414
+ 3,
1415
+ 12
1416
+ ],
1417
+ [
1418
+ 5,
1419
+ 3
1420
+ ],
1421
+ [
1422
+ 2,
1423
+ 4
1424
+ ],
1425
+ [
1426
+ 2,
1427
+ 1
1428
+ ],
1429
+ [
1430
+ 11,
1431
+ 10
1432
+ ],
1433
+ [
1434
+ 13,
1435
+ 7
1436
+ ],
1437
+ [
1438
+ 2,
1439
+ 7
1440
+ ],
1441
+ [
1442
+ 7,
1443
+ 3
1444
+ ],
1445
+ [
1446
+ 7,
1447
+ 9
1448
+ ],
1449
+ [
1450
+ 12,
1451
+ 5
1452
+ ],
1453
+ [
1454
+ 12,
1455
+ 8
1456
+ ],
1457
+ [
1458
+ 3,
1459
+ 5
1460
+ ],
1461
+ [
1462
+ 5,
1463
+ 2
1464
+ ],
1465
+ [
1466
+ 5,
1467
+ 11
1468
+ ],
1469
+ [
1470
+ 4,
1471
+ 13
1472
+ ],
1473
+ [
1474
+ 13,
1475
+ 3
1476
+ ],
1477
+ [
1478
+ 13,
1479
+ 9
1480
+ ],
1481
+ [
1482
+ 2,
1483
+ 12
1484
+ ],
1485
+ [
1486
+ 6,
1487
+ 9
1488
+ ]
1489
+ ]
1490
+ ],
1491
+ "output": 37
1492
+ },
1493
+ {
1494
+ "input": [
1495
+ 76,
1496
+ [
1497
+ [
1498
+ 21,
1499
+ 16
1500
+ ],
1501
+ [
1502
+ 71,
1503
+ 29
1504
+ ],
1505
+ [
1506
+ 17,
1507
+ 3
1508
+ ],
1509
+ [
1510
+ 34,
1511
+ 28
1512
+ ],
1513
+ [
1514
+ 30,
1515
+ 18
1516
+ ],
1517
+ [
1518
+ 66,
1519
+ 5
1520
+ ],
1521
+ [
1522
+ 29,
1523
+ 4
1524
+ ],
1525
+ [
1526
+ 26,
1527
+ 69
1528
+ ],
1529
+ [
1530
+ 59,
1531
+ 66
1532
+ ],
1533
+ [
1534
+ 13,
1535
+ 44
1536
+ ],
1537
+ [
1538
+ 48,
1539
+ 29
1540
+ ],
1541
+ [
1542
+ 16,
1543
+ 40
1544
+ ],
1545
+ [
1546
+ 20,
1547
+ 22
1548
+ ],
1549
+ [
1550
+ 42,
1551
+ 4
1552
+ ],
1553
+ [
1554
+ 9,
1555
+ 1
1556
+ ],
1557
+ [
1558
+ 6,
1559
+ 41
1560
+ ],
1561
+ [
1562
+ 68,
1563
+ 13
1564
+ ],
1565
+ [
1566
+ 38,
1567
+ 9
1568
+ ],
1569
+ [
1570
+ 41,
1571
+ 35
1572
+ ],
1573
+ [
1574
+ 25,
1575
+ 27
1576
+ ],
1577
+ [
1578
+ 54,
1579
+ 8
1580
+ ],
1581
+ [
1582
+ 47,
1583
+ 57
1584
+ ],
1585
+ [
1586
+ 74,
1587
+ 59
1588
+ ],
1589
+ [
1590
+ 11,
1591
+ 55
1592
+ ],
1593
+ [
1594
+ 8,
1595
+ 4
1596
+ ],
1597
+ [
1598
+ 22,
1599
+ 30
1600
+ ],
1601
+ [
1602
+ 12,
1603
+ 29
1604
+ ],
1605
+ [
1606
+ 50,
1607
+ 22
1608
+ ],
1609
+ [
1610
+ 32,
1611
+ 71
1612
+ ],
1613
+ [
1614
+ 61,
1615
+ 31
1616
+ ],
1617
+ [
1618
+ 6,
1619
+ 70
1620
+ ],
1621
+ [
1622
+ 54,
1623
+ 1
1624
+ ],
1625
+ [
1626
+ 67,
1627
+ 65
1628
+ ],
1629
+ [
1630
+ 54,
1631
+ 65
1632
+ ],
1633
+ [
1634
+ 7,
1635
+ 23
1636
+ ],
1637
+ [
1638
+ 48,
1639
+ 24
1640
+ ],
1641
+ [
1642
+ 34,
1643
+ 71
1644
+ ],
1645
+ [
1646
+ 45,
1647
+ 71
1648
+ ],
1649
+ [
1650
+ 1,
1651
+ 46
1652
+ ],
1653
+ [
1654
+ 47,
1655
+ 13
1656
+ ],
1657
+ [
1658
+ 12,
1659
+ 22
1660
+ ],
1661
+ [
1662
+ 21,
1663
+ 34
1664
+ ],
1665
+ [
1666
+ 68,
1667
+ 8
1668
+ ],
1669
+ [
1670
+ 36,
1671
+ 34
1672
+ ],
1673
+ [
1674
+ 64,
1675
+ 59
1676
+ ],
1677
+ [
1678
+ 56,
1679
+ 64
1680
+ ],
1681
+ [
1682
+ 36,
1683
+ 61
1684
+ ],
1685
+ [
1686
+ 9,
1687
+ 44
1688
+ ],
1689
+ [
1690
+ 2,
1691
+ 38
1692
+ ],
1693
+ [
1694
+ 19,
1695
+ 54
1696
+ ],
1697
+ [
1698
+ 28,
1699
+ 75
1700
+ ],
1701
+ [
1702
+ 24,
1703
+ 53
1704
+ ],
1705
+ [
1706
+ 24,
1707
+ 7
1708
+ ],
1709
+ [
1710
+ 1,
1711
+ 5
1712
+ ],
1713
+ [
1714
+ 39,
1715
+ 7
1716
+ ],
1717
+ [
1718
+ 70,
1719
+ 56
1720
+ ],
1721
+ [
1722
+ 61,
1723
+ 1
1724
+ ],
1725
+ [
1726
+ 21,
1727
+ 29
1728
+ ],
1729
+ [
1730
+ 59,
1731
+ 13
1732
+ ],
1733
+ [
1734
+ 32,
1735
+ 59
1736
+ ],
1737
+ [
1738
+ 75,
1739
+ 9
1740
+ ],
1741
+ [
1742
+ 4,
1743
+ 22
1744
+ ],
1745
+ [
1746
+ 61,
1747
+ 65
1748
+ ],
1749
+ [
1750
+ 52,
1751
+ 62
1752
+ ],
1753
+ [
1754
+ 7,
1755
+ 8
1756
+ ],
1757
+ [
1758
+ 39,
1759
+ 64
1760
+ ],
1761
+ [
1762
+ 57,
1763
+ 15
1764
+ ],
1765
+ [
1766
+ 27,
1767
+ 44
1768
+ ],
1769
+ [
1770
+ 9,
1771
+ 39
1772
+ ],
1773
+ [
1774
+ 62,
1775
+ 20
1776
+ ],
1777
+ [
1778
+ 34,
1779
+ 68
1780
+ ],
1781
+ [
1782
+ 36,
1783
+ 65
1784
+ ],
1785
+ [
1786
+ 22,
1787
+ 11
1788
+ ],
1789
+ [
1790
+ 29,
1791
+ 26
1792
+ ],
1793
+ [
1794
+ 15,
1795
+ 36
1796
+ ],
1797
+ [
1798
+ 32,
1799
+ 52
1800
+ ],
1801
+ [
1802
+ 33,
1803
+ 60
1804
+ ],
1805
+ [
1806
+ 41,
1807
+ 18
1808
+ ],
1809
+ [
1810
+ 44,
1811
+ 69
1812
+ ],
1813
+ [
1814
+ 71,
1815
+ 62
1816
+ ],
1817
+ [
1818
+ 61,
1819
+ 39
1820
+ ],
1821
+ [
1822
+ 25,
1823
+ 19
1824
+ ],
1825
+ [
1826
+ 30,
1827
+ 42
1828
+ ],
1829
+ [
1830
+ 56,
1831
+ 70
1832
+ ],
1833
+ [
1834
+ 67,
1835
+ 3
1836
+ ],
1837
+ [
1838
+ 52,
1839
+ 48
1840
+ ],
1841
+ [
1842
+ 4,
1843
+ 8
1844
+ ],
1845
+ [
1846
+ 32,
1847
+ 54
1848
+ ],
1849
+ [
1850
+ 32,
1851
+ 63
1852
+ ],
1853
+ [
1854
+ 32,
1855
+ 72
1856
+ ],
1857
+ [
1858
+ 25,
1859
+ 12
1860
+ ],
1861
+ [
1862
+ 16,
1863
+ 9
1864
+ ],
1865
+ [
1866
+ 56,
1867
+ 45
1868
+ ],
1869
+ [
1870
+ 49,
1871
+ 15
1872
+ ],
1873
+ [
1874
+ 23,
1875
+ 5
1876
+ ],
1877
+ [
1878
+ 3,
1879
+ 66
1880
+ ],
1881
+ [
1882
+ 64,
1883
+ 24
1884
+ ],
1885
+ [
1886
+ 1,
1887
+ 50
1888
+ ],
1889
+ [
1890
+ 19,
1891
+ 74
1892
+ ],
1893
+ [
1894
+ 63,
1895
+ 44
1896
+ ],
1897
+ [
1898
+ 56,
1899
+ 38
1900
+ ],
1901
+ [
1902
+ 46,
1903
+ 3
1904
+ ],
1905
+ [
1906
+ 22,
1907
+ 45
1908
+ ],
1909
+ [
1910
+ 48,
1911
+ 9
1912
+ ],
1913
+ [
1914
+ 39,
1915
+ 6
1916
+ ],
1917
+ [
1918
+ 60,
1919
+ 47
1920
+ ],
1921
+ [
1922
+ 4,
1923
+ 3
1924
+ ],
1925
+ [
1926
+ 12,
1927
+ 71
1928
+ ],
1929
+ [
1930
+ 67,
1931
+ 25
1932
+ ],
1933
+ [
1934
+ 53,
1935
+ 35
1936
+ ],
1937
+ [
1938
+ 74,
1939
+ 67
1940
+ ],
1941
+ [
1942
+ 8,
1943
+ 76
1944
+ ],
1945
+ [
1946
+ 11,
1947
+ 8
1948
+ ],
1949
+ [
1950
+ 48,
1951
+ 2
1952
+ ],
1953
+ [
1954
+ 2,
1955
+ 69
1956
+ ],
1957
+ [
1958
+ 46,
1959
+ 14
1960
+ ],
1961
+ [
1962
+ 22,
1963
+ 56
1964
+ ],
1965
+ [
1966
+ 48,
1967
+ 20
1968
+ ],
1969
+ [
1970
+ 21,
1971
+ 12
1972
+ ],
1973
+ [
1974
+ 55,
1975
+ 62
1976
+ ],
1977
+ [
1978
+ 4,
1979
+ 60
1980
+ ],
1981
+ [
1982
+ 67,
1983
+ 9
1984
+ ],
1985
+ [
1986
+ 18,
1987
+ 49
1988
+ ],
1989
+ [
1990
+ 71,
1991
+ 52
1992
+ ],
1993
+ [
1994
+ 46,
1995
+ 62
1996
+ ],
1997
+ [
1998
+ 32,
1999
+ 17
2000
+ ],
2001
+ [
2002
+ 38,
2003
+ 76
2004
+ ],
2005
+ [
2006
+ 40,
2007
+ 18
2008
+ ],
2009
+ [
2010
+ 7,
2011
+ 15
2012
+ ],
2013
+ [
2014
+ 24,
2015
+ 31
2016
+ ],
2017
+ [
2018
+ 23,
2019
+ 11
2020
+ ],
2021
+ [
2022
+ 18,
2023
+ 24
2024
+ ],
2025
+ [
2026
+ 26,
2027
+ 46
2028
+ ],
2029
+ [
2030
+ 65,
2031
+ 50
2032
+ ],
2033
+ [
2034
+ 34,
2035
+ 26
2036
+ ],
2037
+ [
2038
+ 73,
2039
+ 42
2040
+ ],
2041
+ [
2042
+ 20,
2043
+ 45
2044
+ ],
2045
+ [
2046
+ 61,
2047
+ 34
2048
+ ],
2049
+ [
2050
+ 43,
2051
+ 28
2052
+ ],
2053
+ [
2054
+ 33,
2055
+ 27
2056
+ ]
2057
+ ]
2058
+ ],
2059
+ "output": 533
2060
+ }
2061
+ ],
2062
+ "haskell_template": "maxSubarrays :: Int -> [[Int]] -> Int\nmaxSubarrays n conflictingPairs ",
2063
+ "ocaml_template": "let maxSubarrays (n: int) (conflictingPairs: int list list) : int = ",
2064
+ "scala_template": "def maxSubarrays(n: Int,conflictingPairs: List[List[Int]]): Int = { \n \n}",
2065
+ "java_template": "class Solution {\n public long maxSubarrays(int n, int[][] conflictingPairs) {\n \n }\n}",
2066
+ "python_template": "class Solution(object):\n def maxSubarrays(self, n, conflictingPairs):\n \"\"\"\n :type n: int\n :type conflictingPairs: List[List[int]]\n :rtype: int\n \"\"\"\n "
2067
+ }
maximize_subarrays_after_removing_one_conflicting_pair/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 9 (maxSubarrays 4 [[2;3];[1;4]])
12
+
13
+ let test2 _ = assert_equal 12 (maxSubarrays 5 [[1;2];[2;5];[3;5]])
14
+
15
+ let test3 _ = assert_equal 30 (maxSubarrays 9 [[2; 7]; [4; 3]; [3; 1]; [5; 9]; [2; 5]])
16
+
17
+ let test4 _ = assert_equal 328 (maxSubarrays 35 [[30; 24]; [26; 11]; [27; 34]; [1; 15]; [19; 7]; [22; 30]; [23; 29]; [2; 12]; [23; 2]; [20; 12]; [12; 8]])
18
+
19
+ let test5 _ = assert_equal 556 (maxSubarrays 82 [[81; 76]; [55; 57]; [53; 14]; [59; 73]; [28; 67]; [22; 35]; [69; 22]; [23; 43]; [32; 76]; [49; 16]; [39; 17]; [30; 48]; [35; 44]; [5; 21]; [46; 4]; [67; 36]; [80; 60]; [44; 49]; [36; 75]; [9; 58]; [47; 20]; [2; 52]; [65; 1]; [73; 39]; [11; 64]; [75; 12]; [5; 23]; [41; 74]; [49; 57]; [6; 52]; [80; 35]; [13; 67]; [55; 45]; [33; 79]; [82; 8]; [18; 69]; [50; 49]; [54; 74]; [45; 16]; [22; 78]; [34; 25]; [67; 22]; [50; 15]; [13; 23]; [54; 58]; [19; 36]; [63; 70]; [46; 29]; [9; 44]; [17; 57]; [45; 73]; [29; 22]; [29; 31]; [17; 11]; [37; 14]; [68; 65]; [32; 75]; [61; 26]; [1; 69]; [82; 76]; [54; 78]; [37; 71]; [29; 33]; [32; 77]; [48; 12]; [57; 79]; [56; 4]; [63; 74]; [37; 64]; [6; 79]; [45; 77]; [39; 27]; [43; 52]; [4; 15]; [21; 31]; [7; 59]; [2; 72]; [25; 19]; [19; 33]; [42; 35]; [57; 35]; [22; 13]; [41; 57]; [50; 69]; [47; 15]; [27; 76]; [18; 61]; [9; 25]; [37; 41]; [48; 80]; [20; 73]; [66; 40]; [77; 70]; [58; 20]; [10; 62]; [30; 10]; [1; 13]; [48; 73]; [67; 53]; [80; 50]; [20; 66]; [61; 46]; [14; 4]; [78; 71]; [60; 65]; [26; 51]; [35; 63]; [36; 28]; [17; 24]; [39; 54]; [57; 69]; [28; 33]; [34; 49]; [74; 30]; [14; 52]; [50; 57]; [45; 15]; [34; 15]; [7; 40]; [2; 53]; [8; 69]; [2; 7]; [56; 42]; [25; 73]; [11; 19]; [17; 35]; [82; 70]; [31; 70]; [26; 28]; [14; 20]; [82; 54]; [29; 48]; [32; 19]; [43; 28]; [77; 60]])
20
+
21
+ let test6 _ = assert_equal 1002 (maxSubarrays 96 [[48; 21]; [72; 18]; [33; 36]; [60; 50]; [89; 7]; [81; 91]; [70; 58]; [59; 67]; [80; 10]; [20; 93]; [86; 35]; [31; 38]; [82; 1]; [40; 53]; [23; 49]; [61; 36]; [42; 32]; [10; 94]; [80; 58]; [93; 49]; [94; 69]; [43; 63]; [11; 56]; [23; 27]; [47; 24]; [10; 11]; [65; 11]; [13; 7]; [27; 94]; [5; 39]; [53; 58]; [15; 65]; [27; 39]; [18; 64]; [37; 52]; [84; 12]; [13; 92]; [68; 86]; [87; 75]; [79; 86]; [53; 18]; [42; 37]; [32; 41]; [29; 30]; [41; 47]; [40; 94]; [83; 7]; [32; 1]; [6; 34]; [29; 36]; [78; 32]; [81; 52]; [10; 65]; [34; 47]; [17; 37]; [47; 41]; [64; 8]])
22
+
23
+ let test7 _ = assert_equal 1482 (maxSubarrays 82 [[62; 30]; [5; 76]; [37; 55]; [62; 58]; [53; 33]; [82; 80]; [19; 36]; [57; 26]; [11; 2]; [67; 73]; [33; 82]; [63; 46]; [44; 8]; [38; 49]])
24
+
25
+ let test8 _ = assert_equal 47 (maxSubarrays 17 [[12; 1]; [12; 7]; [12; 10]; [3; 1]; [14; 13]; [5; 10]; [17; 12]; [8; 3]; [11; 5]; [11; 14]; [11; 17]; [7; 4]; [15; 5]; [1; 15]; [15; 8]; [4; 2]; [4; 5]; [17; 11]; [9; 1]; [3; 15]; [17; 14]; [10; 5]; [10; 8]; [16; 3]; [13; 10]; [2; 10]; [6; 4]; [7; 12]; [12; 8]; [4; 13]; [1; 16]])
26
+
27
+ let test9 _ = assert_equal 222 (maxSubarrays 39 [[6; 18]; [29; 23]; [21; 13]; [14; 7]; [15; 36]; [6; 36]; [30; 3]; [9; 11]; [2; 5]; [36; 31]; [1; 9]; [36; 34]; [12; 3]; [27; 6]; [22; 25]; [23; 27]; [35; 13]; [15; 7]; [33; 31]; [20; 9]; [25; 27]; [9; 37]; [27; 2]; [29; 27]; [36; 17]; [25; 2]; [2; 3]; [27; 35]; [8; 31]; [26; 18]; [13; 24]])
28
+
29
+ let test10 _ = assert_equal 1574 (maxSubarrays 105 [[83; 49]; [103; 76]; [71; 81]; [64; 72]; [40; 23]; [17; 61]; [100; 28]; [17; 76]; [102; 28]; [99; 11]; [15; 63]; [94; 27]; [33; 20]; [54; 61]; [30; 42]; [99; 29]; [36; 6]; [97; 22]; [81; 35]; [42; 53]; [54; 91]; [84; 46]; [31; 101]; [15; 68]; [27; 97]; [41; 96]; [6; 68]; [66; 95]; [54; 72]; [47; 66]; [92; 77]; [1; 50]; [37; 28]; [4; 92]; [105; 19]; [8; 80]; [6; 58]; [23; 47]; [54; 56]; [25; 17]; [41; 92]; [73; 66]])
30
+
31
+
32
+ (* Grouping test cases *)
33
+ let suite = "Test Suite for maxSubarrays" >::: [
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
maximize_subarrays_after_removing_one_conflicting_pair/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.maxSubarrays(4,List(List(2,3),List(1,4))), 9)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.maxSubarrays(5,List(List(1,2),List(2,5),List(3,5))), 12)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.maxSubarrays(9,List(List(2, 7), List(4, 3), List(3, 1), List(5, 9), List(2, 5))), 30)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.maxSubarrays(35,List(List(30, 24), List(26, 11), List(27, 34), List(1, 15), List(19, 7), List(22, 30), List(23, 29), List(2, 12), List(23, 2), List(20, 12), List(12, 8))), 328)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.maxSubarrays(82,List(List(81, 76), List(55, 57), List(53, 14), List(59, 73), List(28, 67), List(22, 35), List(69, 22), List(23, 43), List(32, 76), List(49, 16), List(39, 17), List(30, 48), List(35, 44), List(5, 21), List(46, 4), List(67, 36), List(80, 60), List(44, 49), List(36, 75), List(9, 58), List(47, 20), List(2, 52), List(65, 1), List(73, 39), List(11, 64), List(75, 12), List(5, 23), List(41, 74), List(49, 57), List(6, 52), List(80, 35), List(13, 67), List(55, 45), List(33, 79), List(82, 8), List(18, 69), List(50, 49), List(54, 74), List(45, 16), List(22, 78), List(34, 25), List(67, 22), List(50, 15), List(13, 23), List(54, 58), List(19, 36), List(63, 70), List(46, 29), List(9, 44), List(17, 57), List(45, 73), List(29, 22), List(29, 31), List(17, 11), List(37, 14), List(68, 65), List(32, 75), List(61, 26), List(1, 69), List(82, 76), List(54, 78), List(37, 71), List(29, 33), List(32, 77), List(48, 12), List(57, 79), List(56, 4), List(63, 74), List(37, 64), List(6, 79), List(45, 77), List(39, 27), List(43, 52), List(4, 15), List(21, 31), List(7, 59), List(2, 72), List(25, 19), List(19, 33), List(42, 35), List(57, 35), List(22, 13), List(41, 57), List(50, 69), List(47, 15), List(27, 76), List(18, 61), List(9, 25), List(37, 41), List(48, 80), List(20, 73), List(66, 40), List(77, 70), List(58, 20), List(10, 62), List(30, 10), List(1, 13), List(48, 73), List(67, 53), List(80, 50), List(20, 66), List(61, 46), List(14, 4), List(78, 71), List(60, 65), List(26, 51), List(35, 63), List(36, 28), List(17, 24), List(39, 54), List(57, 69), List(28, 33), List(34, 49), List(74, 30), List(14, 52), List(50, 57), List(45, 15), List(34, 15), List(7, 40), List(2, 53), List(8, 69), List(2, 7), List(56, 42), List(25, 73), List(11, 19), List(17, 35), List(82, 70), List(31, 70), List(26, 28), List(14, 20), List(82, 54), List(29, 48), List(32, 19), List(43, 28), List(77, 60))), 556)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.maxSubarrays(96,List(List(48, 21), List(72, 18), List(33, 36), List(60, 50), List(89, 7), List(81, 91), List(70, 58), List(59, 67), List(80, 10), List(20, 93), List(86, 35), List(31, 38), List(82, 1), List(40, 53), List(23, 49), List(61, 36), List(42, 32), List(10, 94), List(80, 58), List(93, 49), List(94, 69), List(43, 63), List(11, 56), List(23, 27), List(47, 24), List(10, 11), List(65, 11), List(13, 7), List(27, 94), List(5, 39), List(53, 58), List(15, 65), List(27, 39), List(18, 64), List(37, 52), List(84, 12), List(13, 92), List(68, 86), List(87, 75), List(79, 86), List(53, 18), List(42, 37), List(32, 41), List(29, 30), List(41, 47), List(40, 94), List(83, 7), List(32, 1), List(6, 34), List(29, 36), List(78, 32), List(81, 52), List(10, 65), List(34, 47), List(17, 37), List(47, 41), List(64, 8))), 1002)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.maxSubarrays(82,List(List(62, 30), List(5, 76), List(37, 55), List(62, 58), List(53, 33), List(82, 80), List(19, 36), List(57, 26), List(11, 2), List(67, 73), List(33, 82), List(63, 46), List(44, 8), List(38, 49))), 1482)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.maxSubarrays(17,List(List(12, 1), List(12, 7), List(12, 10), List(3, 1), List(14, 13), List(5, 10), List(17, 12), List(8, 3), List(11, 5), List(11, 14), List(11, 17), List(7, 4), List(15, 5), List(1, 15), List(15, 8), List(4, 2), List(4, 5), List(17, 11), List(9, 1), List(3, 15), List(17, 14), List(10, 5), List(10, 8), List(16, 3), List(13, 10), List(2, 10), List(6, 4), List(7, 12), List(12, 8), List(4, 13), List(1, 16))), 47)
34
+ }
35
+
36
+ test("test9") {
37
+ assertEquals(Main.maxSubarrays(39,List(List(6, 18), List(29, 23), List(21, 13), List(14, 7), List(15, 36), List(6, 36), List(30, 3), List(9, 11), List(2, 5), List(36, 31), List(1, 9), List(36, 34), List(12, 3), List(27, 6), List(22, 25), List(23, 27), List(35, 13), List(15, 7), List(33, 31), List(20, 9), List(25, 27), List(9, 37), List(27, 2), List(29, 27), List(36, 17), List(25, 2), List(2, 3), List(27, 35), List(8, 31), List(26, 18), List(13, 24))), 222)
38
+ }
39
+
40
+ test("test10") {
41
+ assertEquals(Main.maxSubarrays(105,List(List(83, 49), List(103, 76), List(71, 81), List(64, 72), List(40, 23), List(17, 61), List(100, 28), List(17, 76), List(102, 28), List(99, 11), List(15, 63), List(94, 27), List(33, 20), List(54, 61), List(30, 42), List(99, 29), List(36, 6), List(97, 22), List(81, 35), List(42, 53), List(54, 91), List(84, 46), List(31, 101), List(15, 68), List(27, 97), List(41, 96), List(6, 68), List(66, 95), List(54, 72), List(47, 66), List(92, 77), List(1, 50), List(37, 28), List(4, 92), List(105, 19), List(8, 80), List(6, 58), List(23, 47), List(54, 56), List(25, 17), List(41, 92), List(73, 66))), 1574)
42
+ }
43
+
44
+ }
maximize_sum_of_weights_after_edge_removals/haskell_tests/Main.hs ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e46387fef32669a82e732114717cab253b30d8e823efe1fbd7cdb9aa0316414c
3
+ size 20445812
maximize_sum_of_weights_after_edge_removals/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(22, maximizeSumOfWeights(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,1,4)),new ArrayList<>(Arrays.asList(0,2,2)),new ArrayList<>(Arrays.asList(2,3,12)),new ArrayList<>(Arrays.asList(2,4,6)))), 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(65, maximizeSumOfWeights(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,1,5)),new ArrayList<>(Arrays.asList(1,2,10)),new ArrayList<>(Arrays.asList(0,3,15)),new ArrayList<>(Arrays.asList(3,4,20)),new ArrayList<>(Arrays.asList(3,5,5)),new ArrayList<>(Arrays.asList(0,6,10)))), 3));
19
+ }
20
+
21
+ }
maximize_sum_of_weights_after_edge_removals/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fdd896abbad4b6b34d40e9d350f63cc2eea32a5a941d8c53bd312bedf9a1d330
3
+ size 90844894
maximize_sum_of_weights_after_edge_removals/ocaml_tests/main.ml ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d1db318b8072e04fa7c5f013df69cee8619df80fb3b9ab3dd81add8182745bad
3
+ size 11267437
maximize_sum_of_weights_after_edge_removals/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1d6167c48623deba0272cbaaaae18eff9dbaaf765b3e3500be0d38d6977f2ae0
3
+ size 13208562
maximize_the_minimum_game_score/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
maximize_the_minimum_game_score/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(4, maxScore(new ArrayList<>(Arrays.asList(2,4)), 3));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(2, maxScore(new ArrayList<>(Arrays.asList(1,2,3)), 5));
19
+ }
20
+
21
+ }
maximize_the_minimum_game_score/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
maximize_the_minimum_game_score/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
maximize_the_minimum_game_score/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
maximize_the_minimum_powered_city/.DS_Store ADDED
Binary file (6.15 kB). View file
 
maximize_the_minimum_powered_city/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 (maxPower [1,2,4,5,0] 1 2)," 5 (maxPower [1,2,4,5,0] 1 2))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (maxPower [4,4,4,4] 0 3)," 4 (maxPower [4,4,4,4] 0 3))
16
+
17
+
18
+ -- Grouping test cases
19
+ tests :: Test
20
+ tests = TestList [TestLabel "Test1" test1]
21
+
22
+ -- Running the tests
23
+ main :: IO Counts
24
+ main = runTestTT tests
maximize_the_minimum_powered_city/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(5, maxPower(new ArrayList<>(Arrays.asList(1,2,4,5,0)), 1, 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(4, maxPower(new ArrayList<>(Arrays.asList(4,4,4,4)), 0, 3));
19
+ }
20
+
21
+ }
maximize_the_minimum_powered_city/meta.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2618,
3
+ "name": "maximize_the_minimum_powered_city",
4
+ "difficulty": "Hard",
5
+ "link": "https://leetcode.com/problems/maximize-the-minimum-powered-city/",
6
+ "date": "1671840000000",
7
+ "task_description": "You are given a **0-indexed** integer array `stations` of length `n`, where `stations[i]` represents the number of power stations in the `ith` city. Each power station can provide power to every city in a fixed **range**. In other words, if the range is denoted by `r`, then a power station at city `i` can provide power to all cities `j` such that `|i - j| <= r` and `0 <= i, j <= n - 1`. Note that `|x|` denotes **absolute** value. For example, `|7 - 5| = 2` and `|3 - 10| = 7`. The **power** of a city is the total number of power stations it is being provided power from. The government has sanctioned building `k` more power stations, each of which can be built in any city, and have the same range as the pre-existing ones. Given the two integers `r` and `k`, return _the **maximum possible minimum power** of a city, if the additional power stations are built optimally._ **Note** that you can build the `k` power stations in multiple cities. **Example 1:** ``` **Input:** stations = [1,2,4,5,0], r = 1, k = 2 **Output:** 5 **Explanation:** One of the optimal ways is to install both the power stations at city 1. So stations will become [1,4,4,5,0]. - City 0 is provided by 1 + 4 = 5 power stations. - City 1 is provided by 1 + 4 + 4 = 9 power stations. - City 2 is provided by 4 + 4 + 5 = 13 power stations. - City 3 is provided by 5 + 4 = 9 power stations. - City 4 is provided by 5 + 0 = 5 power stations. So the minimum power of a city is 5. Since it is not possible to obtain a larger power, we return 5. ``` **Example 2:** ``` **Input:** stations = [4,4,4,4], r = 0, k = 3 **Output:** 4 **Explanation:** It can be proved that we cannot make the minimum power of a city greater than 4. ``` **Constraints:** `n == stations.length` `1 <= n <= 105` `0 <= stations[i] <= 105` `0 <= r <= n - 1` `0 <= k <= 109`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "stations = [1,2,4,5,0], r = 1, k = 2",
12
+ "output": "5 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "stations = [4,4,4,4], r = 0, k = 3",
17
+ "output": "4 "
18
+ }
19
+ ],
20
+ "private_test_cases": [],
21
+ "haskell_template": "maxPower :: [Int] -> Int -> Int -> Int\nmaxPower stations r k ",
22
+ "ocaml_template": "let maxPower (stations: int list) (r: int) (k: int) : int = ",
23
+ "scala_template": "def maxPower(stations: List[Int],r: Int,k: Int): Int = { \n \n}",
24
+ "java_template": "public static int maxPower(List<Integer> stations, int r, int k) {\n\n}",
25
+ "python_template": "class Solution(object):\n def maxPower(self, stations, r, k):\n \"\"\"\n :type stations: List[int]\n :type r: int\n :type k: int\n :rtype: int\n \"\"\"\n "
26
+ }
maximize_the_minimum_powered_city/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 5 (maxPower [1;2;4;5;0] 1 2)
12
+
13
+ let test2 _ = assert_equal 4 (maxPower [4;4;4;4] 0 3)
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for maxPower" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end