DatasetRepo commited on
Commit
540c128
·
verified ·
1 Parent(s): b629ff6

28e253573a301e90b33ecaa8d9fa477bbb3ae9775c74dfd0144d375ddcc69e5f

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 +4 -0
  2. count_prefix_and_suffix_pairs_i/ocaml_tests/main.ml +45 -0
  3. count_prefix_and_suffix_pairs_i/scala_tests/MySuite.scala +36 -0
  4. count_prefixes_of_a_given_string/.DS_Store +0 -0
  5. count_prefixes_of_a_given_string/haskell_tests/Main.hs +24 -0
  6. count_prefixes_of_a_given_string/java_tests/Main.java +21 -0
  7. count_prefixes_of_a_given_string/meta.json +26 -0
  8. count_prefixes_of_a_given_string/ocaml_tests/main.ml +26 -0
  9. count_prefixes_of_a_given_string/scala_tests/MySuite.scala +12 -0
  10. count_special_subsequences/haskell_tests/Main.hs +41 -0
  11. count_special_subsequences/java_tests/Main.java +20 -0
  12. count_special_subsequences/meta.json +3568 -0
  13. count_special_subsequences/ocaml_tests/main.ml +42 -0
  14. count_special_subsequences/scala_tests/MySuite.scala +32 -0
  15. count_stepping_numbers_in_range/.DS_Store +0 -0
  16. count_stepping_numbers_in_range/haskell_tests/Main.hs +24 -0
  17. count_stepping_numbers_in_range/java_tests/Main.java +21 -0
  18. count_stepping_numbers_in_range/meta.json +26 -0
  19. count_stepping_numbers_in_range/ocaml_tests/main.ml +26 -0
  20. count_stepping_numbers_in_range/scala_tests/MySuite.scala +12 -0
  21. count_subarrays_of_length_three_with_a_condition/haskell_tests/Main.hs +41 -0
  22. count_subarrays_of_length_three_with_a_condition/java_tests/Main.java +20 -0
  23. count_subarrays_of_length_three_with_a_condition/meta.json +222 -0
  24. count_subarrays_of_length_three_with_a_condition/ocaml_tests/main.ml +42 -0
  25. count_subarrays_of_length_three_with_a_condition/scala_tests/MySuite.scala +32 -0
  26. count_subarrays_where_max_element_appears_at_least_k_times/haskell_tests/Main.hs +0 -0
  27. count_subarrays_where_max_element_appears_at_least_k_times/java_tests/Main.java +21 -0
  28. count_subarrays_where_max_element_appears_at_least_k_times/meta.json +3 -0
  29. count_subarrays_where_max_element_appears_at_least_k_times/ocaml_tests/main.ml +0 -0
  30. count_subarrays_where_max_element_appears_at_least_k_times/scala_tests/MySuite.scala +0 -0
  31. count_subarrays_with_fixed_bounds/.DS_Store +0 -0
  32. count_subarrays_with_fixed_bounds/haskell_tests/Main.hs +24 -0
  33. count_subarrays_with_fixed_bounds/java_tests/Main.java +21 -0
  34. count_subarrays_with_fixed_bounds/meta.json +658 -0
  35. count_subarrays_with_fixed_bounds/ocaml_tests/main.ml +26 -0
  36. count_subarrays_with_fixed_bounds/scala_tests/MySuite.scala +12 -0
  37. count_subarrays_with_median_k/.DS_Store +0 -0
  38. count_subarrays_with_median_k/haskell_tests/Main.hs +24 -0
  39. count_subarrays_with_median_k/java_tests/Main.java +21 -0
  40. count_subarrays_with_median_k/meta.json +0 -0
  41. count_subarrays_with_median_k/ocaml_tests/main.ml +26 -0
  42. count_subarrays_with_median_k/scala_tests/MySuite.scala +12 -0
  43. count_subarrays_with_score_less_than_k/haskell_tests/Main.hs +0 -0
  44. count_subarrays_with_score_less_than_k/java_tests/Main.java +21 -0
  45. count_subarrays_with_score_less_than_k/meta.json +3 -0
  46. count_subarrays_with_score_less_than_k/ocaml_tests/main.ml +0 -0
  47. count_subarrays_with_score_less_than_k/scala_tests/MySuite.scala +0 -0
  48. count_submatrices_with_equal_frequency_of_x_and_y/haskell_tests/Main.hs +3 -0
  49. count_submatrices_with_equal_frequency_of_x_and_y/java_tests/Main.java +24 -0
  50. count_submatrices_with_equal_frequency_of_x_and_y/meta.json +3 -0
.gitattributes CHANGED
@@ -81,3 +81,7 @@ count_non_decreasing_subarrays_after_k_operations/meta.json filter=lfs diff=lfs
81
  count_number_of_bad_pairs/meta.json filter=lfs diff=lfs merge=lfs -text
82
  count_of_interesting_subarrays/meta.json filter=lfs diff=lfs merge=lfs -text
83
  count_pairs_of_points_with_distance_k/meta.json filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
81
  count_number_of_bad_pairs/meta.json filter=lfs diff=lfs merge=lfs -text
82
  count_of_interesting_subarrays/meta.json filter=lfs diff=lfs merge=lfs -text
83
  count_pairs_of_points_with_distance_k/meta.json filter=lfs diff=lfs merge=lfs -text
84
+ count_subarrays_where_max_element_appears_at_least_k_times/meta.json filter=lfs diff=lfs merge=lfs -text
85
+ count_subarrays_with_score_less_than_k/meta.json filter=lfs diff=lfs merge=lfs -text
86
+ count_submatrices_with_equal_frequency_of_x_and_y/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
87
+ count_submatrices_with_equal_frequency_of_x_and_y/meta.json filter=lfs diff=lfs merge=lfs -text
count_prefix_and_suffix_pairs_i/ocaml_tests/main.ml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let countPrefixSuffixPairs (words: string list) : int = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal 4 (countPrefixSuffixPairs ["a";"aba";"ababa";"aa"])
13
+
14
+ let test2 _ = assert_equal 2 (countPrefixSuffixPairs ["pa";"papa";"ma";"mama"])
15
+
16
+ let test3 _ = assert_equal 0 (countPrefixSuffixPairs ["abab";"ab"])
17
+
18
+ let test4 _ = assert_equal 0 (countPrefixSuffixPairs ["zyfn"; "ujuvsucqd"; "fin"; "vkzcgb"; "odgfyz"; "focupzrq"; "jocaylejk"; "bgm"; "fpmavzz"; "pmeuqcapjg"; "w"; "lbt"; "tqcbdaopp"; "jx"; "jrn"; "uyoqpbxl"; "csn"; "deorcs"; "tkwvtvfpls"; "zxwifl"; "jqfc"; "nyrrfiwojv"; "whwl"; "x"; "ydsrxiplz"; "arzz"; "ymngfqx"])
19
+
20
+ let test5 _ = assert_equal 0 (countPrefixSuffixPairs ["agtqjfw"; "i"; "ffnfx"; "fxdud"; "oq"; "nyoadavbp"; "fvvcbr"; "mcfox"; "nlmrkr"; "sgmwin"; "anthihed"; "kaajld"; "ak"; "wnp"; "ijklwgrb"; "puqktr"; "by"; "xwq"; "rkbphyelux"; "hjom"; "ptp"; "xahpd"; "ztmealb"; "cmnmeiyl"; "xckksy"; "gzojok"; "canomipks"; "udpgrrnhz"])
21
+
22
+ let test6 _ = assert_equal 0 (countPrefixSuffixPairs ["cql"; "lfeaau"; "hghzxkea"; "arw"; "esfgwzhiy"; "joomofen"; "s"; "mb"; "gfums"; "cslailpgz"; "alrrcpzm"; "zwbsi"; "szdswocnji"; "w"; "we"; "m"; "zfniocou"; "e"; "mwzjl"; "gpbs"; "cxzkhltg"; "bvktqilzl"; "dwdqhi"; "hajxu"; "fnprdxxgdv"; "hhj"; "nrwjnkv"; "jietmjj"; "vxauqqmht"; "opmplgs"; "swdzgbmu"; "ek"; "sojcvovdny"; "szs"; "g"; "jxoattqel"; "mtrjn"; "wl"])
23
+
24
+ let test7 _ = assert_equal 0 (countPrefixSuffixPairs ["jzspzok"; "lvcmouwhdr"; "rnhwwiikw"; "ykzhqidutg"; "jizyv"; "lv"; "sksgsmp"; "otevict"; "xshdigu"; "xji"; "ggymskwnpv"; "hre"; "jsk"; "chhol"; "glnyoo"; "zk"; "kwp"; "vk"; "kjqgjaftr"; "rrt"; "tjhrk"; "epj"; "i"; "uxlvexs"; "zkrtksdgvs"; "jeuhmsnad"; "opqunjyc"; "szut"; "ljtz"; "hmq"; "deie"; "ahak"])
25
+
26
+ let test8 _ = assert_equal 0 (countPrefixSuffixPairs ["tioefbiyzd"; "x"; "tx"; "zgvaelmla"; "lezuiqxwcu"; "mraf"; "fi"; "fxkq"; "qcejhxlgfr"; "wgyacuewhz"; "ooij"; "uo"; "qx"; "dhr"; "tbmx"; "xgbtnouan"; "xbetthbx"; "bpoq"; "jgropqunp"; "qqzwd"; "srgwdcqorb"; "yqcqrpvasi"; "f"; "gepw"; "hokn"; "edkqckl"; "qdzrfs"; "mznhanzqf"; "bshbc"; "xotl"; "wkeiwlidg"; "icet"; "qmtwngj"; "poodfvmes"])
27
+
28
+
29
+ (* Grouping test cases *)
30
+ let suite = "Test Suite for countPrefixSuffixPairs" >::: [
31
+
32
+ "test1" >:: test1;
33
+ "test2" >:: test2;
34
+ "test3" >:: test3;
35
+ "test4" >:: test4;
36
+ "test5" >:: test5;
37
+ "test6" >:: test6;
38
+ "test7" >:: test7;
39
+ "test8" >:: test8;
40
+ ]
41
+
42
+
43
+ (* Running the tests *)
44
+ let () = run_test_tt_main suite
45
+ end
count_prefix_and_suffix_pairs_i/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.countPrefixSuffixPairs(List("a","aba","ababa","aa")), 4)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.countPrefixSuffixPairs(List("pa","papa","ma","mama")), 2)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.countPrefixSuffixPairs(List("abab","ab")), 0)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.countPrefixSuffixPairs("zyfn","ujuvsucqd","fin","vkzcgb","odgfyz","focupzrq","jocaylejk","bgm","fpmavzz","pmeuqcapjg","w","lbt","tqcbdaopp","jx","jrn","uyoqpbxl","csn","deorcs","tkwvtvfpls","zxwifl","jqfc","nyrrfiwojv","whwl","x","ydsrxiplz","arzz","ymngfqx"), 0)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.countPrefixSuffixPairs("agtqjfw","i","ffnfx","fxdud","oq","nyoadavbp","fvvcbr","mcfox","nlmrkr","sgmwin","anthihed","kaajld","ak","wnp","ijklwgrb","puqktr","by","xwq","rkbphyelux","hjom","ptp","xahpd","ztmealb","cmnmeiyl","xckksy","gzojok","canomipks","udpgrrnhz"), 0)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.countPrefixSuffixPairs("cql","lfeaau","hghzxkea","arw","esfgwzhiy","joomofen","s","mb","gfums","cslailpgz","alrrcpzm","zwbsi","szdswocnji","w","we","m","zfniocou","e","mwzjl","gpbs","cxzkhltg","bvktqilzl","dwdqhi","hajxu","fnprdxxgdv","hhj","nrwjnkv","jietmjj","vxauqqmht","opmplgs","swdzgbmu","ek","sojcvovdny","szs","g","jxoattqel","mtrjn","wl"), 1)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.countPrefixSuffixPairs("jzspzok","lvcmouwhdr","rnhwwiikw","ykzhqidutg","jizyv","lv","sksgsmp","otevict","xshdigu","xji","ggymskwnpv","hre","jsk","chhol","glnyoo","zk","kwp","vk","kjqgjaftr","rrt","tjhrk","epj","i","uxlvexs","zkrtksdgvs","jeuhmsnad","opqunjyc","szut","ljtz","hmq","deie","ahak"), 0)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.countPrefixSuffixPairs("tioefbiyzd","x","tx","zgvaelmla","lezuiqxwcu","mraf","fi","fxkq","qcejhxlgfr","wgyacuewhz","ooij","uo","qx","dhr","tbmx","xgbtnouan","xbetthbx","bpoq","jgropqunp","qqzwd","srgwdcqorb","yqcqrpvasi","f","gepw","hokn","edkqckl","qdzrfs","mznhanzqf","bshbc","xotl","wkeiwlidg","icet","qmtwngj","poodfvmes"), 1)
34
+ }
35
+
36
+ }
count_prefixes_of_a_given_string/.DS_Store ADDED
Binary file (6.15 kB). View file
 
count_prefixes_of_a_given_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 (countPrefixes [ \"a \", \"b \", \"c \", \"ab \", \"bc \", \"abc \"] \"abc \")," 3 (countPrefixes ["a","b","c","ab","bc","abc"] "abc"))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (countPrefixes [ \"a \", \"a \"] \"aa \")," 2 (countPrefixes ["a","a"] "aa"))
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
count_prefixes_of_a_given_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(3, countPrefixes(new ArrayList<>(Arrays.asList("a","b","c","ab","bc","abc")), new ArrayList<>(Arrays.asList("a","b","c","ab","bc","abc")), "abc"));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(2, countPrefixes(new ArrayList<>(Arrays.asList("a","a")), new ArrayList<>(Arrays.asList("a","a")), "aa"));
19
+ }
20
+
21
+ }
count_prefixes_of_a_given_string/meta.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2341,
3
+ "name": "count_prefixes_of_a_given_string",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/count-prefixes-of-a-given-string/",
6
+ "date": "1650067200000",
7
+ "task_description": "You are given a string array `words` and a string `s`, where `words[i]` and `s` comprise only of **lowercase English letters**. Return _the **number of strings** in_ `words` _that are a **prefix** of_ `s`. A **prefix** of a string is a substring that occurs at the beginning of the string. A substring is a contiguous sequence of characters within a string. **Example 1:** ``` **Input:** words = [\"a\",\"b\",\"c\",\"ab\",\"bc\",\"abc\"], s = \"abc\" **Output:** 3 **Explanation:** The strings in words which are a prefix of s = \"abc\" are: \"a\", \"ab\", and \"abc\". Thus the number of strings in words which are a prefix of s is 3. ``` **Example 2:** ``` **Input:** words = [\"a\",\"a\"], s = \"aa\" **Output:** 2 **Explanation: **Both of the strings are a prefix of s. Note that the same string can occur multiple times in words, and it should be counted each time. ``` **Constraints:** `1 <= words.length <= 1000` `1 <= words[i].length, s.length <= 10` `words[i]` and `s` consist of lowercase English letters **only**.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "words = [\"a\",\"b\",\"c\",\"ab\",\"bc\",\"abc\"], s = \"abc\"",
12
+ "output": "3 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "words = [\"a\",\"a\"], s = \"aa\"",
17
+ "output": "2 "
18
+ }
19
+ ],
20
+ "private_test_cases": [],
21
+ "haskell_template": "countPrefixes :: [String] -> String -> Int\ncountPrefixes words s ",
22
+ "ocaml_template": "let countPrefixes (words: string list) (s: string) : int = ",
23
+ "scala_template": "def countPrefixes(words: List[String],s: String): Int = { \n \n}",
24
+ "java_template": "public static int countPrefixes(List<String> words, String s) {\n\n}",
25
+ "python_template": "class Solution(object):\n def countPrefixes(self, words, s):\n \"\"\"\n :type words: List[str]\n :type s: str\n :rtype: int\n \"\"\"\n "
26
+ }
count_prefixes_of_a_given_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 3 (countPrefixes ["a";"b";"c";"ab";"bc";"abc"] ["a";"b";"c";"ab";"bc";"abc"]; s = "abc")
12
+
13
+ let test2 _ = assert_equal 2 (countPrefixes ["a";"a"] ["a";"a"]; s = "aa")
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for countPrefixes" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
count_prefixes_of_a_given_string/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.countPrefixes(List("a","b","c","ab","bc","abc"),List("a","b","c","ab","bc","abc"), s = "abc"), 3)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.countPrefixes(List("a","a"),List("a","a"), s = "aa"), 2)
10
+ }
11
+
12
+ }
count_special_subsequences/haskell_tests/Main.hs ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+ numberOfSubsequences :: [Int] -> Int
7
+ numberOfSubsequences nums = undefined
8
+
9
+ --Program end
10
+
11
+ -- Test cases
12
+
13
+ test1 :: Test
14
+ test1 = TestCase (assertEqual "for (numberOfSubsequences [1,2,3,4,3,6,1])," 1 (numberOfSubsequences [1,2,3,4,3,6,1]))
15
+
16
+ test2 :: Test
17
+ test2 = TestCase (assertEqual "for (numberOfSubsequences [3,4,3,4,3,4,3,4])," 3 (numberOfSubsequences [3,4,3,4,3,4,3,4]))
18
+
19
+ test3 :: Test
20
+ test3 = TestCase (assertEqual "for (numberOfSubsequences [157, 123, 292, 72, 538, 948, 379, 889, 202, 45, 444, 413, 532, 36, 787, 657, 764, 805, 24, 93, 314, 864, 344, 897, 565, 971, 940, 888, 931, 970, 526, 531, 156, 404, 772, 391, 939, 892, 533, 579, 767, 290, 576, 119, 412, 571, 932, 987, 284, 137, 842, 659, 79, 914, 83, 258, 63, 315, 525, 944, 439, 145, 609, 953, 544, 593, 252, 322, 360, 710, 502, 476, 664, 47, 872, 248, 387, 715, 258, 733, 652, 741, 813, 678, 624, 327, 784, 133, 92, 191, 877, 540, 573, 485, 489, 118, 824, 88, 506, 676, 335, 793, 123, 93, 37, 570, 50, 633, 392, 356, 976, 634, 712, 953, 249, 408, 202, 622, 598, 102, 475, 33, 886, 208, 531, 47, 931, 436, 835, 377, 913, 232, 992, 95, 814, 71, 77, 738, 256, 999, 369, 871, 328, 575, 352, 376, 895, 833, 557, 485, 794, 632, 208, 81, 304, 586, 270, 715, 385, 52, 635, 395, 746, 773, 88, 843, 801, 539, 627, 829, 831, 221, 784, 479, 598, 907, 740, 905, 979, 314, 827, 207, 182, 44, 772, 700, 690, 590, 890, 593, 902, 689, 111, 365, 36, 34, 462, 542, 674, 620, 858, 203, 568, 657, 993, 284, 862, 888, 178, 359, 879, 712, 365, 671, 559, 366, 392, 226, 754, 755, 101, 411, 500, 717, 622, 531, 383, 548, 718, 969, 317, 258, 325, 833, 699, 360, 113, 234, 355, 924, 123, 708, 775, 818, 54, 637, 588, 415, 599, 137, 464, 577, 790, 996, 636, 354, 612, 232, 946, 343, 673, 282, 360, 751, 204, 246, 904, 778, 352, 797, 33, 257, 40, 949, 718, 32, 113, 146, 147, 428, 564, 147, 854, 81, 986, 596, 687, 265, 559, 417, 70, 199, 969, 631, 317, 98, 981, 307, 111, 18, 865, 856, 688, 658, 732, 808, 610, 10, 622, 258, 220, 571, 273, 703, 631, 954, 498, 272, 878, 549, 743, 703, 869, 406, 833, 232, 677, 929, 724, 263, 108, 462, 772, 896, 574, 712, 75, 479, 845, 169, 877, 652, 634, 603, 213, 37, 202, 619, 422, 624, 164, 887, 163, 82, 326, 898, 465, 878, 118, 880, 410, 824, 887, 564, 540, 515, 807, 280, 266, 115, 418, 155, 509, 822, 696, 575, 643, 347, 314, 744, 341, 983, 279, 670, 724, 953, 113, 68, 542, 212, 336, 536, 392, 804, 507, 855, 887, 37, 83, 160, 410, 915, 730, 978, 753, 330, 241, 92, 535, 44, 626, 807, 690, 835, 551, 67, 577, 844, 370, 787, 254, 775, 315, 431, 767, 150, 183, 538, 922, 558, 48, 268, 508, 115, 311, 828, 37, 649, 604, 813, 779, 789, 285, 804, 212, 686, 416, 959, 807, 387, 24, 977, 464, 230, 796, 392, 776, 835, 843, 246, 347, 635, 359, 569, 404, 349, 931, 987, 100, 102, 990, 754, 666, 880, 250, 206, 744, 23, 719, 412, 467, 807, 796, 312, 346, 481, 210, 855, 72, 489, 479, 525, 611, 539, 534, 995, 429, 444, 676, 770, 793, 12, 586, 245, 131, 92, 370, 382, 944, 41, 627, 94, 107, 731, 58, 183, 226, 530, 431, 283, 438, 919, 697, 211, 911, 748, 339, 357, 797, 727, 938, 619, 279, 453, 360, 721, 984, 428, 603, 865, 277, 944, 548, 42, 611, 106, 557, 929, 631, 525, 278, 315, 891, 380, 782, 998, 531, 750, 106, 347, 565, 953, 35, 204, 114, 327, 886, 508, 514, 938, 229, 230, 710, 4, 951, 484, 269, 280, 11, 613, 865, 750, 185, 378, 582, 948, 845, 825, 16, 628, 493, 371, 84, 718, 127, 206, 998, 783, 259, 859, 970, 157, 360, 452, 605, 385, 404, 106, 637, 783, 950, 562, 735, 288, 796, 371, 738, 775, 334, 886, 204, 188, 290, 365, 75, 220, 116, 513, 361, 821, 793, 900, 992, 825, 503, 964, 446, 815, 106, 279, 983, 310, 970, 429, 584, 258, 293, 880, 903, 326, 607, 704, 431, 838, 167, 632, 969, 82, 769, 304, 800, 101, 187, 319, 960, 214, 208, 175, 857, 82, 862, 663, 13, 495, 299, 731, 306, 73, 869, 8, 444, 87, 55, 622, 118, 452, 245, 280, 546, 989, 762, 330, 717, 471, 327, 680, 998, 328, 215, 681, 581, 115, 39, 67, 529, 835, 591, 350, 559, 779, 566, 513, 318, 362, 914, 258, 986, 520, 289, 266, 477, 490, 857, 185, 687, 305, 343, 908, 795, 404, 567, 123, 102, 231, 871, 670, 162, 961, 266, 80, 335, 702, 342, 268, 517, 173, 61, 544, 687, 671, 335, 155, 606, 810, 920, 783, 52, 963, 964, 921, 724, 704, 953, 628, 247, 650, 433, 901, 144, 125, 648, 888, 286, 445, 379, 430, 309, 723, 986, 535, 464, 820, 323, 987, 797, 781, 721, 562, 540, 664, 952, 485, 500, 987, 480, 72, 861, 31, 922, 122, 6, 674, 863, 300, 755, 88, 260, 50, 478, 391, 626, 663, 241, 66, 535, 575, 344, 981, 289, 759, 457, 728, 848, 739, 154, 733, 408, 455, 356, 328, 79, 410, 485, 4, 554, 584, 562, 63, 902, 444, 21, 237, 258, 532, 350, 880, 257, 242, 250, 676, 522, 43, 816, 773, 810, 300, 445, 419, 34, 307, 971, 925, 725, 243, 177, 392, 510, 35, 534, 720, 925, 420, 632, 328, 752, 569, 835, 448, 443, 346, 941, 220, 209, 439, 257, 311, 192, 271, 141, 876, 647, 479, 98, 102, 694, 770, 201, 181, 478, 970, 451, 61, 280, 836, 255, 704, 712, 321, 899, 200, 461, 53, 181, 567, 869, 909, 270, 830, 351, 245, 222, 771, 3, 398, 948, 697, 476, 944, 229, 881, 382, 902, 405, 834, 422, 627, 899, 55, 736, 196, 921, 293, 933, 278, 378, 471, 615, 359, 62, 119, 405, 583, 998, 710, 503, 470, 378, 498, 773, 40, 240, 439, 341, 785, 444, 282, 619, 465, 963, 206, 451, 141, 517, 958, 111, 855, 851, 712, 105, 158, 327, 423, 444, 977, 841, 237, 804, 605, 964, 406, 617])," 304006 (numberOfSubsequences [157, 123, 292, 72, 538, 948, 379, 889, 202, 45, 444, 413, 532, 36, 787, 657, 764, 805, 24, 93, 314, 864, 344, 897, 565, 971, 940, 888, 931, 970, 526, 531, 156, 404, 772, 391, 939, 892, 533, 579, 767, 290, 576, 119, 412, 571, 932, 987, 284, 137, 842, 659, 79, 914, 83, 258, 63, 315, 525, 944, 439, 145, 609, 953, 544, 593, 252, 322, 360, 710, 502, 476, 664, 47, 872, 248, 387, 715, 258, 733, 652, 741, 813, 678, 624, 327, 784, 133, 92, 191, 877, 540, 573, 485, 489, 118, 824, 88, 506, 676, 335, 793, 123, 93, 37, 570, 50, 633, 392, 356, 976, 634, 712, 953, 249, 408, 202, 622, 598, 102, 475, 33, 886, 208, 531, 47, 931, 436, 835, 377, 913, 232, 992, 95, 814, 71, 77, 738, 256, 999, 369, 871, 328, 575, 352, 376, 895, 833, 557, 485, 794, 632, 208, 81, 304, 586, 270, 715, 385, 52, 635, 395, 746, 773, 88, 843, 801, 539, 627, 829, 831, 221, 784, 479, 598, 907, 740, 905, 979, 314, 827, 207, 182, 44, 772, 700, 690, 590, 890, 593, 902, 689, 111, 365, 36, 34, 462, 542, 674, 620, 858, 203, 568, 657, 993, 284, 862, 888, 178, 359, 879, 712, 365, 671, 559, 366, 392, 226, 754, 755, 101, 411, 500, 717, 622, 531, 383, 548, 718, 969, 317, 258, 325, 833, 699, 360, 113, 234, 355, 924, 123, 708, 775, 818, 54, 637, 588, 415, 599, 137, 464, 577, 790, 996, 636, 354, 612, 232, 946, 343, 673, 282, 360, 751, 204, 246, 904, 778, 352, 797, 33, 257, 40, 949, 718, 32, 113, 146, 147, 428, 564, 147, 854, 81, 986, 596, 687, 265, 559, 417, 70, 199, 969, 631, 317, 98, 981, 307, 111, 18, 865, 856, 688, 658, 732, 808, 610, 10, 622, 258, 220, 571, 273, 703, 631, 954, 498, 272, 878, 549, 743, 703, 869, 406, 833, 232, 677, 929, 724, 263, 108, 462, 772, 896, 574, 712, 75, 479, 845, 169, 877, 652, 634, 603, 213, 37, 202, 619, 422, 624, 164, 887, 163, 82, 326, 898, 465, 878, 118, 880, 410, 824, 887, 564, 540, 515, 807, 280, 266, 115, 418, 155, 509, 822, 696, 575, 643, 347, 314, 744, 341, 983, 279, 670, 724, 953, 113, 68, 542, 212, 336, 536, 392, 804, 507, 855, 887, 37, 83, 160, 410, 915, 730, 978, 753, 330, 241, 92, 535, 44, 626, 807, 690, 835, 551, 67, 577, 844, 370, 787, 254, 775, 315, 431, 767, 150, 183, 538, 922, 558, 48, 268, 508, 115, 311, 828, 37, 649, 604, 813, 779, 789, 285, 804, 212, 686, 416, 959, 807, 387, 24, 977, 464, 230, 796, 392, 776, 835, 843, 246, 347, 635, 359, 569, 404, 349, 931, 987, 100, 102, 990, 754, 666, 880, 250, 206, 744, 23, 719, 412, 467, 807, 796, 312, 346, 481, 210, 855, 72, 489, 479, 525, 611, 539, 534, 995, 429, 444, 676, 770, 793, 12, 586, 245, 131, 92, 370, 382, 944, 41, 627, 94, 107, 731, 58, 183, 226, 530, 431, 283, 438, 919, 697, 211, 911, 748, 339, 357, 797, 727, 938, 619, 279, 453, 360, 721, 984, 428, 603, 865, 277, 944, 548, 42, 611, 106, 557, 929, 631, 525, 278, 315, 891, 380, 782, 998, 531, 750, 106, 347, 565, 953, 35, 204, 114, 327, 886, 508, 514, 938, 229, 230, 710, 4, 951, 484, 269, 280, 11, 613, 865, 750, 185, 378, 582, 948, 845, 825, 16, 628, 493, 371, 84, 718, 127, 206, 998, 783, 259, 859, 970, 157, 360, 452, 605, 385, 404, 106, 637, 783, 950, 562, 735, 288, 796, 371, 738, 775, 334, 886, 204, 188, 290, 365, 75, 220, 116, 513, 361, 821, 793, 900, 992, 825, 503, 964, 446, 815, 106, 279, 983, 310, 970, 429, 584, 258, 293, 880, 903, 326, 607, 704, 431, 838, 167, 632, 969, 82, 769, 304, 800, 101, 187, 319, 960, 214, 208, 175, 857, 82, 862, 663, 13, 495, 299, 731, 306, 73, 869, 8, 444, 87, 55, 622, 118, 452, 245, 280, 546, 989, 762, 330, 717, 471, 327, 680, 998, 328, 215, 681, 581, 115, 39, 67, 529, 835, 591, 350, 559, 779, 566, 513, 318, 362, 914, 258, 986, 520, 289, 266, 477, 490, 857, 185, 687, 305, 343, 908, 795, 404, 567, 123, 102, 231, 871, 670, 162, 961, 266, 80, 335, 702, 342, 268, 517, 173, 61, 544, 687, 671, 335, 155, 606, 810, 920, 783, 52, 963, 964, 921, 724, 704, 953, 628, 247, 650, 433, 901, 144, 125, 648, 888, 286, 445, 379, 430, 309, 723, 986, 535, 464, 820, 323, 987, 797, 781, 721, 562, 540, 664, 952, 485, 500, 987, 480, 72, 861, 31, 922, 122, 6, 674, 863, 300, 755, 88, 260, 50, 478, 391, 626, 663, 241, 66, 535, 575, 344, 981, 289, 759, 457, 728, 848, 739, 154, 733, 408, 455, 356, 328, 79, 410, 485, 4, 554, 584, 562, 63, 902, 444, 21, 237, 258, 532, 350, 880, 257, 242, 250, 676, 522, 43, 816, 773, 810, 300, 445, 419, 34, 307, 971, 925, 725, 243, 177, 392, 510, 35, 534, 720, 925, 420, 632, 328, 752, 569, 835, 448, 443, 346, 941, 220, 209, 439, 257, 311, 192, 271, 141, 876, 647, 479, 98, 102, 694, 770, 201, 181, 478, 970, 451, 61, 280, 836, 255, 704, 712, 321, 899, 200, 461, 53, 181, 567, 869, 909, 270, 830, 351, 245, 222, 771, 3, 398, 948, 697, 476, 944, 229, 881, 382, 902, 405, 834, 422, 627, 899, 55, 736, 196, 921, 293, 933, 278, 378, 471, 615, 359, 62, 119, 405, 583, 998, 710, 503, 470, 378, 498, 773, 40, 240, 439, 341, 785, 444, 282, 619, 465, 963, 206, 451, 141, 517, 958, 111, 855, 851, 712, 105, 158, 327, 423, 444, 977, 841, 237, 804, 605, 964, 406, 617]))
21
+
22
+ test4 :: Test
23
+ test4 = TestCase (assertEqual "for (numberOfSubsequences [822, 69, 148, 353, 692, 228, 730, 335, 775, 94, 77, 117, 605, 943, 577, 520, 87, 363, 995, 720, 520, 785, 994, 439, 111, 903, 222, 94, 482, 958, 679, 117, 610, 55, 580, 746, 105, 175, 249, 612, 834, 766, 624, 615, 128, 536, 756, 419, 455, 18, 89, 44, 281, 132, 626, 68, 25, 603, 229, 10, 832, 158, 658, 628, 590, 571, 150, 606, 818, 274, 106, 396, 921, 502, 717, 95, 680, 386, 536, 307, 866, 864, 268, 429, 476, 826, 527, 845, 148, 450, 1, 947, 80, 680, 474, 188, 904, 92, 645, 218, 838, 576, 331, 145, 69, 894, 716, 235, 346, 399, 661, 571, 430, 853, 539, 713, 466, 345, 616, 963, 292, 16, 371, 334, 464, 550, 614, 709, 899, 288, 793, 186, 428, 129, 617, 166, 391, 901, 318, 674, 431, 750, 546, 499, 4, 487, 809, 325, 620, 371, 891, 393, 118, 665, 602, 511, 285, 225, 186, 450, 866, 320, 381, 203, 155, 276, 353, 35, 392, 243, 885, 783, 511, 660, 88, 161, 377, 183, 135, 114, 148, 661, 951, 490, 705, 728, 275, 754, 944, 506, 226, 331, 90, 194, 11, 792, 253, 369, 486, 193, 262, 647, 988, 713, 925, 876, 796, 836, 832, 692, 543, 808, 918, 512, 661, 110, 225, 597, 877, 681, 238, 213, 343, 987, 986, 397, 550, 649, 41, 884, 791, 214, 124, 796, 70, 484, 709, 901, 63, 415, 769, 360, 702, 21, 547, 929, 399, 863, 394, 250, 846, 810, 976, 648, 970, 889, 402, 44, 373, 927, 686, 109, 558, 310, 61, 919, 519, 952, 910, 980, 874, 747, 315, 423, 482, 623, 612, 507, 863, 757, 624, 378, 867, 618, 567, 714, 721, 123, 308, 420, 467, 977, 736, 239, 674, 16, 694, 353, 506, 802, 604, 301, 344, 656, 525, 149, 175, 748, 280, 46, 841, 438, 723, 67, 680, 790, 969, 455, 133, 745, 882, 29, 578, 480, 51, 841, 527, 345, 261, 597, 469, 447, 586, 874, 211, 827, 65, 772, 258, 37, 612, 441, 691, 726, 337, 137, 414, 147, 427, 398, 219, 28, 46, 508, 642, 144, 139, 813, 411, 88, 302, 970, 960, 51, 337, 795, 203, 665, 298, 387, 218, 490, 984, 532, 57, 800, 664, 703, 654, 689, 697, 150, 988, 188, 302, 20, 40, 395, 553, 343, 381, 225, 550, 359, 619, 283, 921, 92, 766, 765, 687, 28, 862, 750, 516, 963, 569, 962, 259, 934, 655, 751, 443, 983, 154, 758, 28, 339, 502, 104, 471, 829, 694, 339, 396, 159, 830, 470, 196, 530, 673, 246, 9, 496, 338, 565, 427, 111, 406, 878, 985, 616, 392, 522, 851, 721, 119, 287, 324, 807, 178, 262, 187, 437, 464, 697, 658, 785, 953, 297, 239, 136, 873, 324, 146, 527, 85, 451, 722, 985, 121, 479, 292, 570, 134, 23, 606, 838, 160, 72, 683, 133, 69, 793, 364, 430, 442, 355, 663, 92, 851, 168, 967, 909, 311, 687, 37, 29, 780, 48, 530, 765, 580, 828, 93, 5, 48, 758, 819, 884, 221, 309, 446, 868, 984, 701, 945, 119, 747, 200, 84, 544, 326, 376, 521, 883, 681, 923, 615, 394, 916, 68, 568, 999, 40, 839, 84, 422, 617, 5, 686, 444, 740, 181, 542, 744, 270, 437, 134, 769, 781, 312, 928, 889, 115, 119, 446, 533, 677, 968, 404, 539, 598, 802, 140, 761, 592, 114, 604, 719, 585, 21, 973, 679, 572, 9, 857, 168, 779, 298, 363, 770, 346, 887, 852, 909, 799, 549, 566, 985, 300, 681, 873, 815, 290, 801, 837, 167, 95, 552, 126, 561, 688, 828, 324, 444, 400, 100, 741, 61, 465, 187, 244, 750, 75, 157, 868, 405, 379, 846, 552, 921, 671, 685, 731, 272, 542, 692, 971, 835, 130, 284, 670, 272, 30, 371, 533, 119, 480, 910, 986, 365, 501, 393, 692, 764, 913, 768, 562, 105, 154, 94, 169, 241, 732, 964, 928, 949, 639, 653, 116, 575, 866, 81, 393, 347, 319, 467, 936, 178, 901, 968, 674, 594, 10, 453, 766, 965, 975, 825, 781, 809, 253, 535, 334, 624, 480, 537, 479, 303, 507, 116, 263, 614, 536, 800, 95, 875, 739, 142, 459, 219, 525, 184, 256, 367, 614, 476, 890, 389, 662, 169, 207, 898, 4, 540, 710, 303, 720, 235, 172, 123, 264, 672, 437, 547, 55, 178, 859, 160, 633, 756, 245, 808, 281, 592, 763, 115, 35, 977, 437, 105, 21, 764, 500, 819, 634, 717, 822, 427, 362, 452, 944, 601, 578, 971, 141, 598, 85, 474, 797, 416, 506, 742, 945, 449, 398, 506, 495, 130, 583, 693, 37, 287, 745, 634, 794, 324, 323, 76, 576, 45, 788, 39, 78, 363, 837, 455, 38, 502, 964, 356, 236, 243, 268, 920, 59, 620, 797, 137, 930, 824, 613, 640, 634, 331, 75, 20, 424, 49, 896, 203])," 136000 (numberOfSubsequences [822, 69, 148, 353, 692, 228, 730, 335, 775, 94, 77, 117, 605, 943, 577, 520, 87, 363, 995, 720, 520, 785, 994, 439, 111, 903, 222, 94, 482, 958, 679, 117, 610, 55, 580, 746, 105, 175, 249, 612, 834, 766, 624, 615, 128, 536, 756, 419, 455, 18, 89, 44, 281, 132, 626, 68, 25, 603, 229, 10, 832, 158, 658, 628, 590, 571, 150, 606, 818, 274, 106, 396, 921, 502, 717, 95, 680, 386, 536, 307, 866, 864, 268, 429, 476, 826, 527, 845, 148, 450, 1, 947, 80, 680, 474, 188, 904, 92, 645, 218, 838, 576, 331, 145, 69, 894, 716, 235, 346, 399, 661, 571, 430, 853, 539, 713, 466, 345, 616, 963, 292, 16, 371, 334, 464, 550, 614, 709, 899, 288, 793, 186, 428, 129, 617, 166, 391, 901, 318, 674, 431, 750, 546, 499, 4, 487, 809, 325, 620, 371, 891, 393, 118, 665, 602, 511, 285, 225, 186, 450, 866, 320, 381, 203, 155, 276, 353, 35, 392, 243, 885, 783, 511, 660, 88, 161, 377, 183, 135, 114, 148, 661, 951, 490, 705, 728, 275, 754, 944, 506, 226, 331, 90, 194, 11, 792, 253, 369, 486, 193, 262, 647, 988, 713, 925, 876, 796, 836, 832, 692, 543, 808, 918, 512, 661, 110, 225, 597, 877, 681, 238, 213, 343, 987, 986, 397, 550, 649, 41, 884, 791, 214, 124, 796, 70, 484, 709, 901, 63, 415, 769, 360, 702, 21, 547, 929, 399, 863, 394, 250, 846, 810, 976, 648, 970, 889, 402, 44, 373, 927, 686, 109, 558, 310, 61, 919, 519, 952, 910, 980, 874, 747, 315, 423, 482, 623, 612, 507, 863, 757, 624, 378, 867, 618, 567, 714, 721, 123, 308, 420, 467, 977, 736, 239, 674, 16, 694, 353, 506, 802, 604, 301, 344, 656, 525, 149, 175, 748, 280, 46, 841, 438, 723, 67, 680, 790, 969, 455, 133, 745, 882, 29, 578, 480, 51, 841, 527, 345, 261, 597, 469, 447, 586, 874, 211, 827, 65, 772, 258, 37, 612, 441, 691, 726, 337, 137, 414, 147, 427, 398, 219, 28, 46, 508, 642, 144, 139, 813, 411, 88, 302, 970, 960, 51, 337, 795, 203, 665, 298, 387, 218, 490, 984, 532, 57, 800, 664, 703, 654, 689, 697, 150, 988, 188, 302, 20, 40, 395, 553, 343, 381, 225, 550, 359, 619, 283, 921, 92, 766, 765, 687, 28, 862, 750, 516, 963, 569, 962, 259, 934, 655, 751, 443, 983, 154, 758, 28, 339, 502, 104, 471, 829, 694, 339, 396, 159, 830, 470, 196, 530, 673, 246, 9, 496, 338, 565, 427, 111, 406, 878, 985, 616, 392, 522, 851, 721, 119, 287, 324, 807, 178, 262, 187, 437, 464, 697, 658, 785, 953, 297, 239, 136, 873, 324, 146, 527, 85, 451, 722, 985, 121, 479, 292, 570, 134, 23, 606, 838, 160, 72, 683, 133, 69, 793, 364, 430, 442, 355, 663, 92, 851, 168, 967, 909, 311, 687, 37, 29, 780, 48, 530, 765, 580, 828, 93, 5, 48, 758, 819, 884, 221, 309, 446, 868, 984, 701, 945, 119, 747, 200, 84, 544, 326, 376, 521, 883, 681, 923, 615, 394, 916, 68, 568, 999, 40, 839, 84, 422, 617, 5, 686, 444, 740, 181, 542, 744, 270, 437, 134, 769, 781, 312, 928, 889, 115, 119, 446, 533, 677, 968, 404, 539, 598, 802, 140, 761, 592, 114, 604, 719, 585, 21, 973, 679, 572, 9, 857, 168, 779, 298, 363, 770, 346, 887, 852, 909, 799, 549, 566, 985, 300, 681, 873, 815, 290, 801, 837, 167, 95, 552, 126, 561, 688, 828, 324, 444, 400, 100, 741, 61, 465, 187, 244, 750, 75, 157, 868, 405, 379, 846, 552, 921, 671, 685, 731, 272, 542, 692, 971, 835, 130, 284, 670, 272, 30, 371, 533, 119, 480, 910, 986, 365, 501, 393, 692, 764, 913, 768, 562, 105, 154, 94, 169, 241, 732, 964, 928, 949, 639, 653, 116, 575, 866, 81, 393, 347, 319, 467, 936, 178, 901, 968, 674, 594, 10, 453, 766, 965, 975, 825, 781, 809, 253, 535, 334, 624, 480, 537, 479, 303, 507, 116, 263, 614, 536, 800, 95, 875, 739, 142, 459, 219, 525, 184, 256, 367, 614, 476, 890, 389, 662, 169, 207, 898, 4, 540, 710, 303, 720, 235, 172, 123, 264, 672, 437, 547, 55, 178, 859, 160, 633, 756, 245, 808, 281, 592, 763, 115, 35, 977, 437, 105, 21, 764, 500, 819, 634, 717, 822, 427, 362, 452, 944, 601, 578, 971, 141, 598, 85, 474, 797, 416, 506, 742, 945, 449, 398, 506, 495, 130, 583, 693, 37, 287, 745, 634, 794, 324, 323, 76, 576, 45, 788, 39, 78, 363, 837, 455, 38, 502, 964, 356, 236, 243, 268, 920, 59, 620, 797, 137, 930, 824, 613, 640, 634, 331, 75, 20, 424, 49, 896, 203]))
24
+
25
+ test5 :: Test
26
+ test5 = TestCase (assertEqual "for (numberOfSubsequences [554, 726, 312, 607, 51, 859, 471, 711, 782, 273, 563, 447, 595, 68, 522, 591, 530, 710, 800, 633, 301, 935, 931, 485, 267, 163, 231, 612, 814, 618, 257, 11, 270, 349, 938, 919, 253, 938, 143, 449, 236, 484, 979, 569, 823, 26, 473, 709, 981, 310, 937, 582, 642, 117, 885, 794, 125, 36, 853, 692, 452, 539, 901, 551, 999, 127, 913, 532, 68, 987, 201, 8, 998, 141, 401, 438, 759, 19, 552, 698, 530, 686, 514, 167, 294, 285, 514, 852, 299, 548, 418, 565, 284, 864, 736, 338, 778, 614, 278, 464, 327, 391, 527, 887, 581, 439, 91, 811, 656, 136, 949, 888, 820, 268, 393, 470, 946, 517, 276, 521, 893, 906, 270, 336, 13, 444, 57, 328])," 46 (numberOfSubsequences [554, 726, 312, 607, 51, 859, 471, 711, 782, 273, 563, 447, 595, 68, 522, 591, 530, 710, 800, 633, 301, 935, 931, 485, 267, 163, 231, 612, 814, 618, 257, 11, 270, 349, 938, 919, 253, 938, 143, 449, 236, 484, 979, 569, 823, 26, 473, 709, 981, 310, 937, 582, 642, 117, 885, 794, 125, 36, 853, 692, 452, 539, 901, 551, 999, 127, 913, 532, 68, 987, 201, 8, 998, 141, 401, 438, 759, 19, 552, 698, 530, 686, 514, 167, 294, 285, 514, 852, 299, 548, 418, 565, 284, 864, 736, 338, 778, 614, 278, 464, 327, 391, 527, 887, 581, 439, 91, 811, 656, 136, 949, 888, 820, 268, 393, 470, 946, 517, 276, 521, 893, 906, 270, 336, 13, 444, 57, 328]))
27
+
28
+ test6 :: Test
29
+ test6 = TestCase (assertEqual "for (numberOfSubsequences [215, 54, 712, 806, 815, 931, 923, 410, 409, 583, 701, 928, 557, 254, 940, 891, 722, 78, 493, 995, 333, 587, 387, 549, 948, 907, 514, 267, 766, 93, 163, 74, 764, 732, 322, 240, 461, 289, 324, 78, 915, 172, 71, 87, 344, 43, 573, 944, 470, 801, 78, 894, 990, 5, 426, 748, 366, 349, 983, 556, 673, 996, 176, 747, 800, 57, 516, 834, 114, 940, 577, 237, 906, 535, 698, 615, 334, 155, 382, 119, 786, 950, 266, 785, 824, 83, 457, 493, 38, 234, 294, 623, 71, 960, 777, 555, 280, 143, 199, 850, 870, 394, 724, 921, 79, 626, 595, 369, 606, 442, 260, 165, 800, 882, 913, 456, 880, 370, 179, 623, 553, 537, 494, 900, 280, 524, 526, 121, 671, 222, 962, 875, 962, 562, 774, 223, 87, 100, 164, 465, 745, 985, 902, 143, 9, 358, 898, 12, 500, 199, 404, 179, 425, 482, 819, 38, 271, 252, 644, 225, 290, 694, 658, 206, 615, 212, 490, 472, 636, 8, 51, 966, 169, 946, 749, 798, 107, 210, 998, 291, 334, 495, 447, 36, 528, 415, 369, 13, 497, 868, 880, 144, 503, 319, 559, 878, 974, 62, 766, 556, 402, 452, 968, 659, 737, 416, 405, 777, 73, 162, 762, 95, 988, 155, 254, 153, 415, 858, 152, 570, 158, 948, 700, 654, 941, 895, 137, 786, 546, 436, 151, 394, 765, 445, 980, 198, 652, 557, 81, 810, 183, 116, 924, 699, 489, 313, 825, 934, 240, 555, 706, 808, 616, 639, 11, 143, 199, 925, 741, 690, 307, 161, 983, 655, 632, 724, 507, 614, 652, 706, 313, 554, 598, 458, 566, 603, 434, 331, 695, 770, 690, 706, 254, 725, 681, 250, 89, 286, 860, 885, 276, 166, 639, 404, 475, 438, 1000, 354, 529, 68, 581, 507, 433, 156, 180, 506, 585, 162, 959, 391, 762, 399, 112, 3, 260, 364, 523, 325, 443, 336, 966, 23, 332, 19, 216, 84, 999, 846, 522, 906, 7, 898, 953, 244, 600, 642, 648, 390, 973, 209, 438, 829, 433, 807, 196, 978, 168, 512, 218, 835, 735, 307, 120, 880, 739, 219, 41, 446, 750, 619, 850, 140, 243, 275, 353, 798, 611, 896, 449, 593, 997, 748, 384, 881, 443, 902, 769, 641, 719, 535, 591, 948, 592, 691, 266, 62, 996, 334, 460, 223, 103, 413, 392, 49, 648, 881, 643, 225, 722, 658, 257, 803, 655, 285, 243, 5, 311, 248, 430, 895, 350, 610, 222, 991, 952, 891, 596, 130, 418, 697, 211, 33, 135, 128, 955, 836, 625, 490, 258, 841, 99, 355, 753, 810, 607, 510, 679, 639, 911, 404, 603, 680, 247, 10, 509, 503, 813, 678, 346, 63, 647, 522, 885, 48, 492, 91, 990, 935, 569, 766, 329, 504, 336, 41, 672, 491, 357, 856, 328, 894, 625, 662, 821, 591, 240, 13, 997, 836, 259, 231, 970, 943, 655, 402, 643, 379, 201, 702, 233, 637, 323, 650, 738, 411, 709, 196, 638, 723, 334, 737, 518, 35, 713, 525, 866, 18, 171, 292, 272, 427, 195, 670, 704, 724, 608, 57, 867, 304, 94, 826, 401, 197, 854, 439, 451, 981, 108, 999, 364, 104, 251, 557, 900, 155, 253, 415, 971, 389, 64, 363, 442, 496, 369, 657, 985, 269, 866, 57, 532, 678, 786, 584, 564, 663, 585, 164, 422, 940, 330, 401, 855, 45, 287, 928, 456, 667, 551, 921, 252, 411, 968, 372, 715, 420, 21, 572, 373, 499, 528, 163, 519, 274, 628, 365, 937, 433, 912, 580, 253, 56, 933, 741, 134, 510, 394, 54, 352, 531, 408, 606, 523, 55, 564, 461, 690, 398, 245, 813, 819, 130, 721, 452, 624, 555, 216, 988, 992, 483, 566, 687, 548, 367, 786, 15, 672, 889, 869, 317, 618, 571, 131, 525, 386, 137, 328, 843, 612, 336, 644, 548, 604, 41, 663, 241, 776, 232, 668, 596, 65, 772, 98, 59, 12, 877, 502, 58, 900, 519, 943, 220, 476, 111, 476, 418, 860, 643, 759, 754, 408, 808, 1000, 626, 383, 675, 455, 268, 268, 571, 915, 132, 192, 573, 274, 720, 872, 819, 369, 497, 143, 109, 438, 264, 750, 944, 39, 496, 274, 295, 84, 359, 465, 605, 133, 915, 906, 682, 541, 134, 76, 51, 823, 425, 490, 653, 656, 745, 428, 289, 387, 755, 937, 513, 578, 480, 429, 706, 82, 740, 404, 1, 248, 392, 209, 106, 575, 590, 128, 253, 559, 481, 134, 452, 513, 858, 310, 511, 812, 142, 730, 694, 144, 431, 209, 420, 759, 91, 257, 549, 794, 39, 508, 559, 713, 38, 778, 507, 200, 17, 95, 462, 186, 873, 616, 409, 635, 97, 200, 91, 375, 815, 625, 544, 874, 306, 788, 64, 942, 626, 719, 266, 881, 828, 233, 201, 8, 547, 394, 720, 314, 628, 885, 538, 602, 94, 616, 4, 188, 873, 901, 695, 287, 953, 469, 787, 65, 76, 132, 937, 908, 455, 551, 404, 850, 762, 670, 56, 371, 161, 412, 671, 740, 60, 908, 846, 549, 56, 280, 940, 417, 839, 732, 77, 646, 831, 771, 426, 102, 775, 509, 795, 910, 701, 151, 520, 79, 771, 771, 155, 945, 436, 612, 68, 606, 164, 806, 20, 423, 561, 814, 885, 121, 501, 199, 704, 467, 895, 412, 549, 853, 180, 204, 322, 555, 748, 750, 711, 809, 362, 861, 413, 417, 880, 709, 767, 161, 566, 370, 673, 478, 240, 204, 189, 698, 496, 92, 433, 415, 765, 525, 945, 858, 420, 198, 562, 216, 722, 434, 859, 231, 8, 935, 499, 672, 857, 39, 381, 707, 265, 286, 976, 613, 119, 763, 913, 381, 349, 595])," 254317 (numberOfSubsequences [215, 54, 712, 806, 815, 931, 923, 410, 409, 583, 701, 928, 557, 254, 940, 891, 722, 78, 493, 995, 333, 587, 387, 549, 948, 907, 514, 267, 766, 93, 163, 74, 764, 732, 322, 240, 461, 289, 324, 78, 915, 172, 71, 87, 344, 43, 573, 944, 470, 801, 78, 894, 990, 5, 426, 748, 366, 349, 983, 556, 673, 996, 176, 747, 800, 57, 516, 834, 114, 940, 577, 237, 906, 535, 698, 615, 334, 155, 382, 119, 786, 950, 266, 785, 824, 83, 457, 493, 38, 234, 294, 623, 71, 960, 777, 555, 280, 143, 199, 850, 870, 394, 724, 921, 79, 626, 595, 369, 606, 442, 260, 165, 800, 882, 913, 456, 880, 370, 179, 623, 553, 537, 494, 900, 280, 524, 526, 121, 671, 222, 962, 875, 962, 562, 774, 223, 87, 100, 164, 465, 745, 985, 902, 143, 9, 358, 898, 12, 500, 199, 404, 179, 425, 482, 819, 38, 271, 252, 644, 225, 290, 694, 658, 206, 615, 212, 490, 472, 636, 8, 51, 966, 169, 946, 749, 798, 107, 210, 998, 291, 334, 495, 447, 36, 528, 415, 369, 13, 497, 868, 880, 144, 503, 319, 559, 878, 974, 62, 766, 556, 402, 452, 968, 659, 737, 416, 405, 777, 73, 162, 762, 95, 988, 155, 254, 153, 415, 858, 152, 570, 158, 948, 700, 654, 941, 895, 137, 786, 546, 436, 151, 394, 765, 445, 980, 198, 652, 557, 81, 810, 183, 116, 924, 699, 489, 313, 825, 934, 240, 555, 706, 808, 616, 639, 11, 143, 199, 925, 741, 690, 307, 161, 983, 655, 632, 724, 507, 614, 652, 706, 313, 554, 598, 458, 566, 603, 434, 331, 695, 770, 690, 706, 254, 725, 681, 250, 89, 286, 860, 885, 276, 166, 639, 404, 475, 438, 1000, 354, 529, 68, 581, 507, 433, 156, 180, 506, 585, 162, 959, 391, 762, 399, 112, 3, 260, 364, 523, 325, 443, 336, 966, 23, 332, 19, 216, 84, 999, 846, 522, 906, 7, 898, 953, 244, 600, 642, 648, 390, 973, 209, 438, 829, 433, 807, 196, 978, 168, 512, 218, 835, 735, 307, 120, 880, 739, 219, 41, 446, 750, 619, 850, 140, 243, 275, 353, 798, 611, 896, 449, 593, 997, 748, 384, 881, 443, 902, 769, 641, 719, 535, 591, 948, 592, 691, 266, 62, 996, 334, 460, 223, 103, 413, 392, 49, 648, 881, 643, 225, 722, 658, 257, 803, 655, 285, 243, 5, 311, 248, 430, 895, 350, 610, 222, 991, 952, 891, 596, 130, 418, 697, 211, 33, 135, 128, 955, 836, 625, 490, 258, 841, 99, 355, 753, 810, 607, 510, 679, 639, 911, 404, 603, 680, 247, 10, 509, 503, 813, 678, 346, 63, 647, 522, 885, 48, 492, 91, 990, 935, 569, 766, 329, 504, 336, 41, 672, 491, 357, 856, 328, 894, 625, 662, 821, 591, 240, 13, 997, 836, 259, 231, 970, 943, 655, 402, 643, 379, 201, 702, 233, 637, 323, 650, 738, 411, 709, 196, 638, 723, 334, 737, 518, 35, 713, 525, 866, 18, 171, 292, 272, 427, 195, 670, 704, 724, 608, 57, 867, 304, 94, 826, 401, 197, 854, 439, 451, 981, 108, 999, 364, 104, 251, 557, 900, 155, 253, 415, 971, 389, 64, 363, 442, 496, 369, 657, 985, 269, 866, 57, 532, 678, 786, 584, 564, 663, 585, 164, 422, 940, 330, 401, 855, 45, 287, 928, 456, 667, 551, 921, 252, 411, 968, 372, 715, 420, 21, 572, 373, 499, 528, 163, 519, 274, 628, 365, 937, 433, 912, 580, 253, 56, 933, 741, 134, 510, 394, 54, 352, 531, 408, 606, 523, 55, 564, 461, 690, 398, 245, 813, 819, 130, 721, 452, 624, 555, 216, 988, 992, 483, 566, 687, 548, 367, 786, 15, 672, 889, 869, 317, 618, 571, 131, 525, 386, 137, 328, 843, 612, 336, 644, 548, 604, 41, 663, 241, 776, 232, 668, 596, 65, 772, 98, 59, 12, 877, 502, 58, 900, 519, 943, 220, 476, 111, 476, 418, 860, 643, 759, 754, 408, 808, 1000, 626, 383, 675, 455, 268, 268, 571, 915, 132, 192, 573, 274, 720, 872, 819, 369, 497, 143, 109, 438, 264, 750, 944, 39, 496, 274, 295, 84, 359, 465, 605, 133, 915, 906, 682, 541, 134, 76, 51, 823, 425, 490, 653, 656, 745, 428, 289, 387, 755, 937, 513, 578, 480, 429, 706, 82, 740, 404, 1, 248, 392, 209, 106, 575, 590, 128, 253, 559, 481, 134, 452, 513, 858, 310, 511, 812, 142, 730, 694, 144, 431, 209, 420, 759, 91, 257, 549, 794, 39, 508, 559, 713, 38, 778, 507, 200, 17, 95, 462, 186, 873, 616, 409, 635, 97, 200, 91, 375, 815, 625, 544, 874, 306, 788, 64, 942, 626, 719, 266, 881, 828, 233, 201, 8, 547, 394, 720, 314, 628, 885, 538, 602, 94, 616, 4, 188, 873, 901, 695, 287, 953, 469, 787, 65, 76, 132, 937, 908, 455, 551, 404, 850, 762, 670, 56, 371, 161, 412, 671, 740, 60, 908, 846, 549, 56, 280, 940, 417, 839, 732, 77, 646, 831, 771, 426, 102, 775, 509, 795, 910, 701, 151, 520, 79, 771, 771, 155, 945, 436, 612, 68, 606, 164, 806, 20, 423, 561, 814, 885, 121, 501, 199, 704, 467, 895, 412, 549, 853, 180, 204, 322, 555, 748, 750, 711, 809, 362, 861, 413, 417, 880, 709, 767, 161, 566, 370, 673, 478, 240, 204, 189, 698, 496, 92, 433, 415, 765, 525, 945, 858, 420, 198, 562, 216, 722, 434, 859, 231, 8, 935, 499, 672, 857, 39, 381, 707, 265, 286, 976, 613, 119, 763, 913, 381, 349, 595]))
30
+
31
+ test7 :: Test
32
+ test7 = TestCase (assertEqual "for (numberOfSubsequences [902, 905, 731, 604, 350, 252, 535, 709, 601, 399, 372, 843, 927, 576, 311, 428, 736, 323, 378, 22, 263, 568, 181, 422, 512, 577, 275, 175, 283, 701, 861, 518, 290, 624, 123, 727, 284, 880, 759, 817, 504, 258, 720, 188, 349, 516, 202, 492, 663, 233, 391, 33, 311, 643, 259, 162, 208, 726, 241, 388, 89, 327, 134, 631, 433, 144, 574, 12, 600, 447, 138, 13, 908, 84, 48, 529, 853, 747, 13, 227, 127, 721, 832, 399, 949, 360, 331, 538, 153, 534, 378, 943, 800, 221, 535, 821, 355, 332, 794, 576, 887, 827, 29, 895, 381, 658, 155, 646, 999, 798, 543, 300, 92, 479, 577, 23, 194, 956, 323, 2, 548, 592, 317, 693, 908, 241, 366, 688, 378, 307, 124, 749, 446, 585, 390, 140, 238, 231, 324, 79, 522, 880, 623, 950, 234, 695, 404, 937, 461, 28, 483, 572, 636, 980, 267, 99, 720, 947, 581, 584, 635, 762, 547, 305, 715, 223, 338, 33, 891, 754, 358, 858, 473, 807, 396, 604, 255, 746, 547, 830, 20, 727, 83, 448, 760, 943, 16, 714, 371, 994, 704, 549, 41, 391, 403, 70, 299, 414, 462, 575, 897, 99, 602, 623, 340, 599, 605, 741, 195, 193, 978, 927, 80, 509, 626, 912, 704, 705, 360, 134, 299, 40, 511, 1000, 519, 44, 886, 529, 963, 1000, 973, 618, 579, 632, 624, 2, 151, 54, 525, 418, 26, 545, 917, 653, 648, 776, 389, 867, 315, 542, 760, 54, 891, 334, 937, 617, 747, 646, 481, 43, 514, 63, 887, 219, 464, 746, 817, 804, 427, 927, 815, 545, 738, 478, 491, 648, 704, 422, 237, 136, 854, 612, 760, 643, 80, 760, 560, 606, 961, 474, 372, 396, 622, 752, 559, 564, 236, 261, 306, 642, 902, 554, 874, 185, 229, 870, 945, 64, 392, 723, 138, 911, 105, 161, 565, 202, 33, 907, 708, 32, 33, 79, 671, 811, 696, 955, 475, 459, 703, 748, 855, 491, 224, 828, 117, 777, 153, 175, 745, 233, 559, 131, 971, 516, 908, 256, 59, 192, 225, 279, 950, 944, 358, 835, 741, 928, 42, 868, 594, 462, 848, 722, 316, 943, 895, 742, 379, 623, 613, 132, 779, 641, 831, 556, 609, 216, 716, 964, 200, 614, 627, 684, 676, 209, 505, 454, 25, 157, 65, 153, 713, 74, 781, 804, 646, 863, 30, 841, 702, 498, 709, 677, 280, 992, 920, 914, 978, 122, 69, 732, 152, 945, 471, 156, 391, 935, 391, 859, 117, 105, 3, 623, 156, 440, 209, 242, 604, 541, 556, 700, 258, 756, 845, 763, 190, 296, 114, 363, 684, 254, 310, 549, 58, 829, 983, 923, 193, 727, 834, 253, 303, 907, 18, 89, 939, 463, 62, 773, 408, 472, 838, 721, 277, 108, 68, 413, 825, 15, 365, 546, 484, 165, 97, 474, 799, 963, 922, 867, 704, 192, 980, 300, 997, 248, 29, 474, 237, 60, 239, 462, 882, 29, 779, 277, 926, 941, 534, 550, 417, 859, 768, 658, 939, 32, 659, 402, 610, 488, 979, 298, 945, 271, 286, 739, 433, 69, 901, 979, 725, 239, 308, 502, 397, 692, 745, 720, 95, 241, 952, 604, 537, 473, 450, 136, 946, 82, 238, 535, 33, 653, 393, 13, 105, 937, 407, 217, 578, 774, 486, 567, 23, 148, 137, 238, 599, 921, 638, 827, 327, 63, 705, 550, 920, 504, 471, 469, 953, 363, 39, 816, 729, 907, 547, 961, 937, 842, 94, 488, 687, 15, 471, 197, 390, 207, 843, 618, 256, 204, 530, 997, 963, 919, 661, 590, 322, 40, 165, 753, 985, 677, 911, 248, 609, 941, 86, 934, 512, 745, 279, 180, 503, 352, 688, 537, 702, 788, 818, 672, 733, 419, 914, 906, 624, 968, 269, 420, 221, 838, 435, 108, 732, 274, 200, 65, 940, 711, 98, 126, 509, 838, 285, 859, 607, 634, 594, 282, 804, 160])," 59229 (numberOfSubsequences [902, 905, 731, 604, 350, 252, 535, 709, 601, 399, 372, 843, 927, 576, 311, 428, 736, 323, 378, 22, 263, 568, 181, 422, 512, 577, 275, 175, 283, 701, 861, 518, 290, 624, 123, 727, 284, 880, 759, 817, 504, 258, 720, 188, 349, 516, 202, 492, 663, 233, 391, 33, 311, 643, 259, 162, 208, 726, 241, 388, 89, 327, 134, 631, 433, 144, 574, 12, 600, 447, 138, 13, 908, 84, 48, 529, 853, 747, 13, 227, 127, 721, 832, 399, 949, 360, 331, 538, 153, 534, 378, 943, 800, 221, 535, 821, 355, 332, 794, 576, 887, 827, 29, 895, 381, 658, 155, 646, 999, 798, 543, 300, 92, 479, 577, 23, 194, 956, 323, 2, 548, 592, 317, 693, 908, 241, 366, 688, 378, 307, 124, 749, 446, 585, 390, 140, 238, 231, 324, 79, 522, 880, 623, 950, 234, 695, 404, 937, 461, 28, 483, 572, 636, 980, 267, 99, 720, 947, 581, 584, 635, 762, 547, 305, 715, 223, 338, 33, 891, 754, 358, 858, 473, 807, 396, 604, 255, 746, 547, 830, 20, 727, 83, 448, 760, 943, 16, 714, 371, 994, 704, 549, 41, 391, 403, 70, 299, 414, 462, 575, 897, 99, 602, 623, 340, 599, 605, 741, 195, 193, 978, 927, 80, 509, 626, 912, 704, 705, 360, 134, 299, 40, 511, 1000, 519, 44, 886, 529, 963, 1000, 973, 618, 579, 632, 624, 2, 151, 54, 525, 418, 26, 545, 917, 653, 648, 776, 389, 867, 315, 542, 760, 54, 891, 334, 937, 617, 747, 646, 481, 43, 514, 63, 887, 219, 464, 746, 817, 804, 427, 927, 815, 545, 738, 478, 491, 648, 704, 422, 237, 136, 854, 612, 760, 643, 80, 760, 560, 606, 961, 474, 372, 396, 622, 752, 559, 564, 236, 261, 306, 642, 902, 554, 874, 185, 229, 870, 945, 64, 392, 723, 138, 911, 105, 161, 565, 202, 33, 907, 708, 32, 33, 79, 671, 811, 696, 955, 475, 459, 703, 748, 855, 491, 224, 828, 117, 777, 153, 175, 745, 233, 559, 131, 971, 516, 908, 256, 59, 192, 225, 279, 950, 944, 358, 835, 741, 928, 42, 868, 594, 462, 848, 722, 316, 943, 895, 742, 379, 623, 613, 132, 779, 641, 831, 556, 609, 216, 716, 964, 200, 614, 627, 684, 676, 209, 505, 454, 25, 157, 65, 153, 713, 74, 781, 804, 646, 863, 30, 841, 702, 498, 709, 677, 280, 992, 920, 914, 978, 122, 69, 732, 152, 945, 471, 156, 391, 935, 391, 859, 117, 105, 3, 623, 156, 440, 209, 242, 604, 541, 556, 700, 258, 756, 845, 763, 190, 296, 114, 363, 684, 254, 310, 549, 58, 829, 983, 923, 193, 727, 834, 253, 303, 907, 18, 89, 939, 463, 62, 773, 408, 472, 838, 721, 277, 108, 68, 413, 825, 15, 365, 546, 484, 165, 97, 474, 799, 963, 922, 867, 704, 192, 980, 300, 997, 248, 29, 474, 237, 60, 239, 462, 882, 29, 779, 277, 926, 941, 534, 550, 417, 859, 768, 658, 939, 32, 659, 402, 610, 488, 979, 298, 945, 271, 286, 739, 433, 69, 901, 979, 725, 239, 308, 502, 397, 692, 745, 720, 95, 241, 952, 604, 537, 473, 450, 136, 946, 82, 238, 535, 33, 653, 393, 13, 105, 937, 407, 217, 578, 774, 486, 567, 23, 148, 137, 238, 599, 921, 638, 827, 327, 63, 705, 550, 920, 504, 471, 469, 953, 363, 39, 816, 729, 907, 547, 961, 937, 842, 94, 488, 687, 15, 471, 197, 390, 207, 843, 618, 256, 204, 530, 997, 963, 919, 661, 590, 322, 40, 165, 753, 985, 677, 911, 248, 609, 941, 86, 934, 512, 745, 279, 180, 503, 352, 688, 537, 702, 788, 818, 672, 733, 419, 914, 906, 624, 968, 269, 420, 221, 838, 435, 108, 732, 274, 200, 65, 940, 711, 98, 126, 509, 838, 285, 859, 607, 634, 594, 282, 804, 160]))
33
+
34
+
35
+ -- Grouping test cases
36
+ tests :: Test
37
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6]
38
+
39
+ -- Running the tests
40
+ main :: IO Counts
41
+ main = runTestTT tests
count_special_subsequences/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(1, numberOfSubsequences(Arrays.asList(1,2,3,4,3,6,1)));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(3, numberOfSubsequences(Arrays.asList(3,4,3,4,3,4,3,4)));
18
+ }
19
+
20
+ }
count_special_subsequences/meta.json ADDED
@@ -0,0 +1,3568 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3699,
3
+ "name": "count_special_subsequences",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/count-special-subsequences/",
6
+ "date": "2024-12-22 00:00:00",
7
+ "task_description": "You are given an array `nums` consisting of positive integers. A **special subsequence** is defined as a subsequence of length 4, represented by indices `(p, q, r, s)`, where `p < q < r < s`. This subsequence **must** satisfy the following conditions: `nums[p] * nums[r] == nums[q] * nums[s]` There must be _at least_ **one** element between each pair of indices. In other words, `q - p > 1`, `r - q > 1` and `s - r > 1`. Return the _number_ of different **special** **subsequences** in `nums`. **Example 1:** **Input:** nums = [1,2,3,4,3,6,1] **Output:** 1 **Explanation:** There is one special subsequence in `nums`. `(p, q, r, s) = (0, 2, 4, 6)`: This corresponds to elements `(1, 3, 3, 1)`. `nums[p] * nums[r] = nums[0] * nums[4] = 1 * 3 = 3` `nums[q] * nums[s] = nums[2] * nums[6] = 3 * 1 = 3` **Example 2:** **Input:** nums = [3,4,3,4,3,4,3,4] **Output:** 3 **Explanation:** There are three special subsequences in `nums`. `(p, q, r, s) = (0, 2, 4, 6)`: This corresponds to elements `(3, 3, 3, 3)`. `nums[p] * nums[r] = nums[0] * nums[4] = 3 * 3 = 9` `nums[q] * nums[s] = nums[2] * nums[6] = 3 * 3 = 9` `(p, q, r, s) = (1, 3, 5, 7)`: This corresponds to elements `(4, 4, 4, 4)`. `nums[p] * nums[r] = nums[1] * nums[5] = 4 * 4 = 16` `nums[q] * nums[s] = nums[3] * nums[7] = 4 * 4 = 16` `(p, q, r, s) = (0, 2, 5, 7)`: This corresponds to elements `(3, 3, 4, 4)`. `nums[p] * nums[r] = nums[0] * nums[5] = 3 * 4 = 12` `nums[q] * nums[s] = nums[2] * nums[7] = 3 * 4 = 12` **Constraints:** `7 <= nums.length <= 1000` `1 <= nums[i] <= 1000`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [1,2,3,4,3,6,1]",
12
+ "output": "1 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [3,4,3,4,3,4,3,4]",
17
+ "output": "3 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 157,
24
+ 123,
25
+ 292,
26
+ 72,
27
+ 538,
28
+ 948,
29
+ 379,
30
+ 889,
31
+ 202,
32
+ 45,
33
+ 444,
34
+ 413,
35
+ 532,
36
+ 36,
37
+ 787,
38
+ 657,
39
+ 764,
40
+ 805,
41
+ 24,
42
+ 93,
43
+ 314,
44
+ 864,
45
+ 344,
46
+ 897,
47
+ 565,
48
+ 971,
49
+ 940,
50
+ 888,
51
+ 931,
52
+ 970,
53
+ 526,
54
+ 531,
55
+ 156,
56
+ 404,
57
+ 772,
58
+ 391,
59
+ 939,
60
+ 892,
61
+ 533,
62
+ 579,
63
+ 767,
64
+ 290,
65
+ 576,
66
+ 119,
67
+ 412,
68
+ 571,
69
+ 932,
70
+ 987,
71
+ 284,
72
+ 137,
73
+ 842,
74
+ 659,
75
+ 79,
76
+ 914,
77
+ 83,
78
+ 258,
79
+ 63,
80
+ 315,
81
+ 525,
82
+ 944,
83
+ 439,
84
+ 145,
85
+ 609,
86
+ 953,
87
+ 544,
88
+ 593,
89
+ 252,
90
+ 322,
91
+ 360,
92
+ 710,
93
+ 502,
94
+ 476,
95
+ 664,
96
+ 47,
97
+ 872,
98
+ 248,
99
+ 387,
100
+ 715,
101
+ 258,
102
+ 733,
103
+ 652,
104
+ 741,
105
+ 813,
106
+ 678,
107
+ 624,
108
+ 327,
109
+ 784,
110
+ 133,
111
+ 92,
112
+ 191,
113
+ 877,
114
+ 540,
115
+ 573,
116
+ 485,
117
+ 489,
118
+ 118,
119
+ 824,
120
+ 88,
121
+ 506,
122
+ 676,
123
+ 335,
124
+ 793,
125
+ 123,
126
+ 93,
127
+ 37,
128
+ 570,
129
+ 50,
130
+ 633,
131
+ 392,
132
+ 356,
133
+ 976,
134
+ 634,
135
+ 712,
136
+ 953,
137
+ 249,
138
+ 408,
139
+ 202,
140
+ 622,
141
+ 598,
142
+ 102,
143
+ 475,
144
+ 33,
145
+ 886,
146
+ 208,
147
+ 531,
148
+ 47,
149
+ 931,
150
+ 436,
151
+ 835,
152
+ 377,
153
+ 913,
154
+ 232,
155
+ 992,
156
+ 95,
157
+ 814,
158
+ 71,
159
+ 77,
160
+ 738,
161
+ 256,
162
+ 999,
163
+ 369,
164
+ 871,
165
+ 328,
166
+ 575,
167
+ 352,
168
+ 376,
169
+ 895,
170
+ 833,
171
+ 557,
172
+ 485,
173
+ 794,
174
+ 632,
175
+ 208,
176
+ 81,
177
+ 304,
178
+ 586,
179
+ 270,
180
+ 715,
181
+ 385,
182
+ 52,
183
+ 635,
184
+ 395,
185
+ 746,
186
+ 773,
187
+ 88,
188
+ 843,
189
+ 801,
190
+ 539,
191
+ 627,
192
+ 829,
193
+ 831,
194
+ 221,
195
+ 784,
196
+ 479,
197
+ 598,
198
+ 907,
199
+ 740,
200
+ 905,
201
+ 979,
202
+ 314,
203
+ 827,
204
+ 207,
205
+ 182,
206
+ 44,
207
+ 772,
208
+ 700,
209
+ 690,
210
+ 590,
211
+ 890,
212
+ 593,
213
+ 902,
214
+ 689,
215
+ 111,
216
+ 365,
217
+ 36,
218
+ 34,
219
+ 462,
220
+ 542,
221
+ 674,
222
+ 620,
223
+ 858,
224
+ 203,
225
+ 568,
226
+ 657,
227
+ 993,
228
+ 284,
229
+ 862,
230
+ 888,
231
+ 178,
232
+ 359,
233
+ 879,
234
+ 712,
235
+ 365,
236
+ 671,
237
+ 559,
238
+ 366,
239
+ 392,
240
+ 226,
241
+ 754,
242
+ 755,
243
+ 101,
244
+ 411,
245
+ 500,
246
+ 717,
247
+ 622,
248
+ 531,
249
+ 383,
250
+ 548,
251
+ 718,
252
+ 969,
253
+ 317,
254
+ 258,
255
+ 325,
256
+ 833,
257
+ 699,
258
+ 360,
259
+ 113,
260
+ 234,
261
+ 355,
262
+ 924,
263
+ 123,
264
+ 708,
265
+ 775,
266
+ 818,
267
+ 54,
268
+ 637,
269
+ 588,
270
+ 415,
271
+ 599,
272
+ 137,
273
+ 464,
274
+ 577,
275
+ 790,
276
+ 996,
277
+ 636,
278
+ 354,
279
+ 612,
280
+ 232,
281
+ 946,
282
+ 343,
283
+ 673,
284
+ 282,
285
+ 360,
286
+ 751,
287
+ 204,
288
+ 246,
289
+ 904,
290
+ 778,
291
+ 352,
292
+ 797,
293
+ 33,
294
+ 257,
295
+ 40,
296
+ 949,
297
+ 718,
298
+ 32,
299
+ 113,
300
+ 146,
301
+ 147,
302
+ 428,
303
+ 564,
304
+ 147,
305
+ 854,
306
+ 81,
307
+ 986,
308
+ 596,
309
+ 687,
310
+ 265,
311
+ 559,
312
+ 417,
313
+ 70,
314
+ 199,
315
+ 969,
316
+ 631,
317
+ 317,
318
+ 98,
319
+ 981,
320
+ 307,
321
+ 111,
322
+ 18,
323
+ 865,
324
+ 856,
325
+ 688,
326
+ 658,
327
+ 732,
328
+ 808,
329
+ 610,
330
+ 10,
331
+ 622,
332
+ 258,
333
+ 220,
334
+ 571,
335
+ 273,
336
+ 703,
337
+ 631,
338
+ 954,
339
+ 498,
340
+ 272,
341
+ 878,
342
+ 549,
343
+ 743,
344
+ 703,
345
+ 869,
346
+ 406,
347
+ 833,
348
+ 232,
349
+ 677,
350
+ 929,
351
+ 724,
352
+ 263,
353
+ 108,
354
+ 462,
355
+ 772,
356
+ 896,
357
+ 574,
358
+ 712,
359
+ 75,
360
+ 479,
361
+ 845,
362
+ 169,
363
+ 877,
364
+ 652,
365
+ 634,
366
+ 603,
367
+ 213,
368
+ 37,
369
+ 202,
370
+ 619,
371
+ 422,
372
+ 624,
373
+ 164,
374
+ 887,
375
+ 163,
376
+ 82,
377
+ 326,
378
+ 898,
379
+ 465,
380
+ 878,
381
+ 118,
382
+ 880,
383
+ 410,
384
+ 824,
385
+ 887,
386
+ 564,
387
+ 540,
388
+ 515,
389
+ 807,
390
+ 280,
391
+ 266,
392
+ 115,
393
+ 418,
394
+ 155,
395
+ 509,
396
+ 822,
397
+ 696,
398
+ 575,
399
+ 643,
400
+ 347,
401
+ 314,
402
+ 744,
403
+ 341,
404
+ 983,
405
+ 279,
406
+ 670,
407
+ 724,
408
+ 953,
409
+ 113,
410
+ 68,
411
+ 542,
412
+ 212,
413
+ 336,
414
+ 536,
415
+ 392,
416
+ 804,
417
+ 507,
418
+ 855,
419
+ 887,
420
+ 37,
421
+ 83,
422
+ 160,
423
+ 410,
424
+ 915,
425
+ 730,
426
+ 978,
427
+ 753,
428
+ 330,
429
+ 241,
430
+ 92,
431
+ 535,
432
+ 44,
433
+ 626,
434
+ 807,
435
+ 690,
436
+ 835,
437
+ 551,
438
+ 67,
439
+ 577,
440
+ 844,
441
+ 370,
442
+ 787,
443
+ 254,
444
+ 775,
445
+ 315,
446
+ 431,
447
+ 767,
448
+ 150,
449
+ 183,
450
+ 538,
451
+ 922,
452
+ 558,
453
+ 48,
454
+ 268,
455
+ 508,
456
+ 115,
457
+ 311,
458
+ 828,
459
+ 37,
460
+ 649,
461
+ 604,
462
+ 813,
463
+ 779,
464
+ 789,
465
+ 285,
466
+ 804,
467
+ 212,
468
+ 686,
469
+ 416,
470
+ 959,
471
+ 807,
472
+ 387,
473
+ 24,
474
+ 977,
475
+ 464,
476
+ 230,
477
+ 796,
478
+ 392,
479
+ 776,
480
+ 835,
481
+ 843,
482
+ 246,
483
+ 347,
484
+ 635,
485
+ 359,
486
+ 569,
487
+ 404,
488
+ 349,
489
+ 931,
490
+ 987,
491
+ 100,
492
+ 102,
493
+ 990,
494
+ 754,
495
+ 666,
496
+ 880,
497
+ 250,
498
+ 206,
499
+ 744,
500
+ 23,
501
+ 719,
502
+ 412,
503
+ 467,
504
+ 807,
505
+ 796,
506
+ 312,
507
+ 346,
508
+ 481,
509
+ 210,
510
+ 855,
511
+ 72,
512
+ 489,
513
+ 479,
514
+ 525,
515
+ 611,
516
+ 539,
517
+ 534,
518
+ 995,
519
+ 429,
520
+ 444,
521
+ 676,
522
+ 770,
523
+ 793,
524
+ 12,
525
+ 586,
526
+ 245,
527
+ 131,
528
+ 92,
529
+ 370,
530
+ 382,
531
+ 944,
532
+ 41,
533
+ 627,
534
+ 94,
535
+ 107,
536
+ 731,
537
+ 58,
538
+ 183,
539
+ 226,
540
+ 530,
541
+ 431,
542
+ 283,
543
+ 438,
544
+ 919,
545
+ 697,
546
+ 211,
547
+ 911,
548
+ 748,
549
+ 339,
550
+ 357,
551
+ 797,
552
+ 727,
553
+ 938,
554
+ 619,
555
+ 279,
556
+ 453,
557
+ 360,
558
+ 721,
559
+ 984,
560
+ 428,
561
+ 603,
562
+ 865,
563
+ 277,
564
+ 944,
565
+ 548,
566
+ 42,
567
+ 611,
568
+ 106,
569
+ 557,
570
+ 929,
571
+ 631,
572
+ 525,
573
+ 278,
574
+ 315,
575
+ 891,
576
+ 380,
577
+ 782,
578
+ 998,
579
+ 531,
580
+ 750,
581
+ 106,
582
+ 347,
583
+ 565,
584
+ 953,
585
+ 35,
586
+ 204,
587
+ 114,
588
+ 327,
589
+ 886,
590
+ 508,
591
+ 514,
592
+ 938,
593
+ 229,
594
+ 230,
595
+ 710,
596
+ 4,
597
+ 951,
598
+ 484,
599
+ 269,
600
+ 280,
601
+ 11,
602
+ 613,
603
+ 865,
604
+ 750,
605
+ 185,
606
+ 378,
607
+ 582,
608
+ 948,
609
+ 845,
610
+ 825,
611
+ 16,
612
+ 628,
613
+ 493,
614
+ 371,
615
+ 84,
616
+ 718,
617
+ 127,
618
+ 206,
619
+ 998,
620
+ 783,
621
+ 259,
622
+ 859,
623
+ 970,
624
+ 157,
625
+ 360,
626
+ 452,
627
+ 605,
628
+ 385,
629
+ 404,
630
+ 106,
631
+ 637,
632
+ 783,
633
+ 950,
634
+ 562,
635
+ 735,
636
+ 288,
637
+ 796,
638
+ 371,
639
+ 738,
640
+ 775,
641
+ 334,
642
+ 886,
643
+ 204,
644
+ 188,
645
+ 290,
646
+ 365,
647
+ 75,
648
+ 220,
649
+ 116,
650
+ 513,
651
+ 361,
652
+ 821,
653
+ 793,
654
+ 900,
655
+ 992,
656
+ 825,
657
+ 503,
658
+ 964,
659
+ 446,
660
+ 815,
661
+ 106,
662
+ 279,
663
+ 983,
664
+ 310,
665
+ 970,
666
+ 429,
667
+ 584,
668
+ 258,
669
+ 293,
670
+ 880,
671
+ 903,
672
+ 326,
673
+ 607,
674
+ 704,
675
+ 431,
676
+ 838,
677
+ 167,
678
+ 632,
679
+ 969,
680
+ 82,
681
+ 769,
682
+ 304,
683
+ 800,
684
+ 101,
685
+ 187,
686
+ 319,
687
+ 960,
688
+ 214,
689
+ 208,
690
+ 175,
691
+ 857,
692
+ 82,
693
+ 862,
694
+ 663,
695
+ 13,
696
+ 495,
697
+ 299,
698
+ 731,
699
+ 306,
700
+ 73,
701
+ 869,
702
+ 8,
703
+ 444,
704
+ 87,
705
+ 55,
706
+ 622,
707
+ 118,
708
+ 452,
709
+ 245,
710
+ 280,
711
+ 546,
712
+ 989,
713
+ 762,
714
+ 330,
715
+ 717,
716
+ 471,
717
+ 327,
718
+ 680,
719
+ 998,
720
+ 328,
721
+ 215,
722
+ 681,
723
+ 581,
724
+ 115,
725
+ 39,
726
+ 67,
727
+ 529,
728
+ 835,
729
+ 591,
730
+ 350,
731
+ 559,
732
+ 779,
733
+ 566,
734
+ 513,
735
+ 318,
736
+ 362,
737
+ 914,
738
+ 258,
739
+ 986,
740
+ 520,
741
+ 289,
742
+ 266,
743
+ 477,
744
+ 490,
745
+ 857,
746
+ 185,
747
+ 687,
748
+ 305,
749
+ 343,
750
+ 908,
751
+ 795,
752
+ 404,
753
+ 567,
754
+ 123,
755
+ 102,
756
+ 231,
757
+ 871,
758
+ 670,
759
+ 162,
760
+ 961,
761
+ 266,
762
+ 80,
763
+ 335,
764
+ 702,
765
+ 342,
766
+ 268,
767
+ 517,
768
+ 173,
769
+ 61,
770
+ 544,
771
+ 687,
772
+ 671,
773
+ 335,
774
+ 155,
775
+ 606,
776
+ 810,
777
+ 920,
778
+ 783,
779
+ 52,
780
+ 963,
781
+ 964,
782
+ 921,
783
+ 724,
784
+ 704,
785
+ 953,
786
+ 628,
787
+ 247,
788
+ 650,
789
+ 433,
790
+ 901,
791
+ 144,
792
+ 125,
793
+ 648,
794
+ 888,
795
+ 286,
796
+ 445,
797
+ 379,
798
+ 430,
799
+ 309,
800
+ 723,
801
+ 986,
802
+ 535,
803
+ 464,
804
+ 820,
805
+ 323,
806
+ 987,
807
+ 797,
808
+ 781,
809
+ 721,
810
+ 562,
811
+ 540,
812
+ 664,
813
+ 952,
814
+ 485,
815
+ 500,
816
+ 987,
817
+ 480,
818
+ 72,
819
+ 861,
820
+ 31,
821
+ 922,
822
+ 122,
823
+ 6,
824
+ 674,
825
+ 863,
826
+ 300,
827
+ 755,
828
+ 88,
829
+ 260,
830
+ 50,
831
+ 478,
832
+ 391,
833
+ 626,
834
+ 663,
835
+ 241,
836
+ 66,
837
+ 535,
838
+ 575,
839
+ 344,
840
+ 981,
841
+ 289,
842
+ 759,
843
+ 457,
844
+ 728,
845
+ 848,
846
+ 739,
847
+ 154,
848
+ 733,
849
+ 408,
850
+ 455,
851
+ 356,
852
+ 328,
853
+ 79,
854
+ 410,
855
+ 485,
856
+ 4,
857
+ 554,
858
+ 584,
859
+ 562,
860
+ 63,
861
+ 902,
862
+ 444,
863
+ 21,
864
+ 237,
865
+ 258,
866
+ 532,
867
+ 350,
868
+ 880,
869
+ 257,
870
+ 242,
871
+ 250,
872
+ 676,
873
+ 522,
874
+ 43,
875
+ 816,
876
+ 773,
877
+ 810,
878
+ 300,
879
+ 445,
880
+ 419,
881
+ 34,
882
+ 307,
883
+ 971,
884
+ 925,
885
+ 725,
886
+ 243,
887
+ 177,
888
+ 392,
889
+ 510,
890
+ 35,
891
+ 534,
892
+ 720,
893
+ 925,
894
+ 420,
895
+ 632,
896
+ 328,
897
+ 752,
898
+ 569,
899
+ 835,
900
+ 448,
901
+ 443,
902
+ 346,
903
+ 941,
904
+ 220,
905
+ 209,
906
+ 439,
907
+ 257,
908
+ 311,
909
+ 192,
910
+ 271,
911
+ 141,
912
+ 876,
913
+ 647,
914
+ 479,
915
+ 98,
916
+ 102,
917
+ 694,
918
+ 770,
919
+ 201,
920
+ 181,
921
+ 478,
922
+ 970,
923
+ 451,
924
+ 61,
925
+ 280,
926
+ 836,
927
+ 255,
928
+ 704,
929
+ 712,
930
+ 321,
931
+ 899,
932
+ 200,
933
+ 461,
934
+ 53,
935
+ 181,
936
+ 567,
937
+ 869,
938
+ 909,
939
+ 270,
940
+ 830,
941
+ 351,
942
+ 245,
943
+ 222,
944
+ 771,
945
+ 3,
946
+ 398,
947
+ 948,
948
+ 697,
949
+ 476,
950
+ 944,
951
+ 229,
952
+ 881,
953
+ 382,
954
+ 902,
955
+ 405,
956
+ 834,
957
+ 422,
958
+ 627,
959
+ 899,
960
+ 55,
961
+ 736,
962
+ 196,
963
+ 921,
964
+ 293,
965
+ 933,
966
+ 278,
967
+ 378,
968
+ 471,
969
+ 615,
970
+ 359,
971
+ 62,
972
+ 119,
973
+ 405,
974
+ 583,
975
+ 998,
976
+ 710,
977
+ 503,
978
+ 470,
979
+ 378,
980
+ 498,
981
+ 773,
982
+ 40,
983
+ 240,
984
+ 439,
985
+ 341,
986
+ 785,
987
+ 444,
988
+ 282,
989
+ 619,
990
+ 465,
991
+ 963,
992
+ 206,
993
+ 451,
994
+ 141,
995
+ 517,
996
+ 958,
997
+ 111,
998
+ 855,
999
+ 851,
1000
+ 712,
1001
+ 105,
1002
+ 158,
1003
+ 327,
1004
+ 423,
1005
+ 444,
1006
+ 977,
1007
+ 841,
1008
+ 237,
1009
+ 804,
1010
+ 605,
1011
+ 964,
1012
+ 406,
1013
+ 617
1014
+ ],
1015
+ "output": 304006
1016
+ },
1017
+ {
1018
+ "input": [
1019
+ 822,
1020
+ 69,
1021
+ 148,
1022
+ 353,
1023
+ 692,
1024
+ 228,
1025
+ 730,
1026
+ 335,
1027
+ 775,
1028
+ 94,
1029
+ 77,
1030
+ 117,
1031
+ 605,
1032
+ 943,
1033
+ 577,
1034
+ 520,
1035
+ 87,
1036
+ 363,
1037
+ 995,
1038
+ 720,
1039
+ 520,
1040
+ 785,
1041
+ 994,
1042
+ 439,
1043
+ 111,
1044
+ 903,
1045
+ 222,
1046
+ 94,
1047
+ 482,
1048
+ 958,
1049
+ 679,
1050
+ 117,
1051
+ 610,
1052
+ 55,
1053
+ 580,
1054
+ 746,
1055
+ 105,
1056
+ 175,
1057
+ 249,
1058
+ 612,
1059
+ 834,
1060
+ 766,
1061
+ 624,
1062
+ 615,
1063
+ 128,
1064
+ 536,
1065
+ 756,
1066
+ 419,
1067
+ 455,
1068
+ 18,
1069
+ 89,
1070
+ 44,
1071
+ 281,
1072
+ 132,
1073
+ 626,
1074
+ 68,
1075
+ 25,
1076
+ 603,
1077
+ 229,
1078
+ 10,
1079
+ 832,
1080
+ 158,
1081
+ 658,
1082
+ 628,
1083
+ 590,
1084
+ 571,
1085
+ 150,
1086
+ 606,
1087
+ 818,
1088
+ 274,
1089
+ 106,
1090
+ 396,
1091
+ 921,
1092
+ 502,
1093
+ 717,
1094
+ 95,
1095
+ 680,
1096
+ 386,
1097
+ 536,
1098
+ 307,
1099
+ 866,
1100
+ 864,
1101
+ 268,
1102
+ 429,
1103
+ 476,
1104
+ 826,
1105
+ 527,
1106
+ 845,
1107
+ 148,
1108
+ 450,
1109
+ 1,
1110
+ 947,
1111
+ 80,
1112
+ 680,
1113
+ 474,
1114
+ 188,
1115
+ 904,
1116
+ 92,
1117
+ 645,
1118
+ 218,
1119
+ 838,
1120
+ 576,
1121
+ 331,
1122
+ 145,
1123
+ 69,
1124
+ 894,
1125
+ 716,
1126
+ 235,
1127
+ 346,
1128
+ 399,
1129
+ 661,
1130
+ 571,
1131
+ 430,
1132
+ 853,
1133
+ 539,
1134
+ 713,
1135
+ 466,
1136
+ 345,
1137
+ 616,
1138
+ 963,
1139
+ 292,
1140
+ 16,
1141
+ 371,
1142
+ 334,
1143
+ 464,
1144
+ 550,
1145
+ 614,
1146
+ 709,
1147
+ 899,
1148
+ 288,
1149
+ 793,
1150
+ 186,
1151
+ 428,
1152
+ 129,
1153
+ 617,
1154
+ 166,
1155
+ 391,
1156
+ 901,
1157
+ 318,
1158
+ 674,
1159
+ 431,
1160
+ 750,
1161
+ 546,
1162
+ 499,
1163
+ 4,
1164
+ 487,
1165
+ 809,
1166
+ 325,
1167
+ 620,
1168
+ 371,
1169
+ 891,
1170
+ 393,
1171
+ 118,
1172
+ 665,
1173
+ 602,
1174
+ 511,
1175
+ 285,
1176
+ 225,
1177
+ 186,
1178
+ 450,
1179
+ 866,
1180
+ 320,
1181
+ 381,
1182
+ 203,
1183
+ 155,
1184
+ 276,
1185
+ 353,
1186
+ 35,
1187
+ 392,
1188
+ 243,
1189
+ 885,
1190
+ 783,
1191
+ 511,
1192
+ 660,
1193
+ 88,
1194
+ 161,
1195
+ 377,
1196
+ 183,
1197
+ 135,
1198
+ 114,
1199
+ 148,
1200
+ 661,
1201
+ 951,
1202
+ 490,
1203
+ 705,
1204
+ 728,
1205
+ 275,
1206
+ 754,
1207
+ 944,
1208
+ 506,
1209
+ 226,
1210
+ 331,
1211
+ 90,
1212
+ 194,
1213
+ 11,
1214
+ 792,
1215
+ 253,
1216
+ 369,
1217
+ 486,
1218
+ 193,
1219
+ 262,
1220
+ 647,
1221
+ 988,
1222
+ 713,
1223
+ 925,
1224
+ 876,
1225
+ 796,
1226
+ 836,
1227
+ 832,
1228
+ 692,
1229
+ 543,
1230
+ 808,
1231
+ 918,
1232
+ 512,
1233
+ 661,
1234
+ 110,
1235
+ 225,
1236
+ 597,
1237
+ 877,
1238
+ 681,
1239
+ 238,
1240
+ 213,
1241
+ 343,
1242
+ 987,
1243
+ 986,
1244
+ 397,
1245
+ 550,
1246
+ 649,
1247
+ 41,
1248
+ 884,
1249
+ 791,
1250
+ 214,
1251
+ 124,
1252
+ 796,
1253
+ 70,
1254
+ 484,
1255
+ 709,
1256
+ 901,
1257
+ 63,
1258
+ 415,
1259
+ 769,
1260
+ 360,
1261
+ 702,
1262
+ 21,
1263
+ 547,
1264
+ 929,
1265
+ 399,
1266
+ 863,
1267
+ 394,
1268
+ 250,
1269
+ 846,
1270
+ 810,
1271
+ 976,
1272
+ 648,
1273
+ 970,
1274
+ 889,
1275
+ 402,
1276
+ 44,
1277
+ 373,
1278
+ 927,
1279
+ 686,
1280
+ 109,
1281
+ 558,
1282
+ 310,
1283
+ 61,
1284
+ 919,
1285
+ 519,
1286
+ 952,
1287
+ 910,
1288
+ 980,
1289
+ 874,
1290
+ 747,
1291
+ 315,
1292
+ 423,
1293
+ 482,
1294
+ 623,
1295
+ 612,
1296
+ 507,
1297
+ 863,
1298
+ 757,
1299
+ 624,
1300
+ 378,
1301
+ 867,
1302
+ 618,
1303
+ 567,
1304
+ 714,
1305
+ 721,
1306
+ 123,
1307
+ 308,
1308
+ 420,
1309
+ 467,
1310
+ 977,
1311
+ 736,
1312
+ 239,
1313
+ 674,
1314
+ 16,
1315
+ 694,
1316
+ 353,
1317
+ 506,
1318
+ 802,
1319
+ 604,
1320
+ 301,
1321
+ 344,
1322
+ 656,
1323
+ 525,
1324
+ 149,
1325
+ 175,
1326
+ 748,
1327
+ 280,
1328
+ 46,
1329
+ 841,
1330
+ 438,
1331
+ 723,
1332
+ 67,
1333
+ 680,
1334
+ 790,
1335
+ 969,
1336
+ 455,
1337
+ 133,
1338
+ 745,
1339
+ 882,
1340
+ 29,
1341
+ 578,
1342
+ 480,
1343
+ 51,
1344
+ 841,
1345
+ 527,
1346
+ 345,
1347
+ 261,
1348
+ 597,
1349
+ 469,
1350
+ 447,
1351
+ 586,
1352
+ 874,
1353
+ 211,
1354
+ 827,
1355
+ 65,
1356
+ 772,
1357
+ 258,
1358
+ 37,
1359
+ 612,
1360
+ 441,
1361
+ 691,
1362
+ 726,
1363
+ 337,
1364
+ 137,
1365
+ 414,
1366
+ 147,
1367
+ 427,
1368
+ 398,
1369
+ 219,
1370
+ 28,
1371
+ 46,
1372
+ 508,
1373
+ 642,
1374
+ 144,
1375
+ 139,
1376
+ 813,
1377
+ 411,
1378
+ 88,
1379
+ 302,
1380
+ 970,
1381
+ 960,
1382
+ 51,
1383
+ 337,
1384
+ 795,
1385
+ 203,
1386
+ 665,
1387
+ 298,
1388
+ 387,
1389
+ 218,
1390
+ 490,
1391
+ 984,
1392
+ 532,
1393
+ 57,
1394
+ 800,
1395
+ 664,
1396
+ 703,
1397
+ 654,
1398
+ 689,
1399
+ 697,
1400
+ 150,
1401
+ 988,
1402
+ 188,
1403
+ 302,
1404
+ 20,
1405
+ 40,
1406
+ 395,
1407
+ 553,
1408
+ 343,
1409
+ 381,
1410
+ 225,
1411
+ 550,
1412
+ 359,
1413
+ 619,
1414
+ 283,
1415
+ 921,
1416
+ 92,
1417
+ 766,
1418
+ 765,
1419
+ 687,
1420
+ 28,
1421
+ 862,
1422
+ 750,
1423
+ 516,
1424
+ 963,
1425
+ 569,
1426
+ 962,
1427
+ 259,
1428
+ 934,
1429
+ 655,
1430
+ 751,
1431
+ 443,
1432
+ 983,
1433
+ 154,
1434
+ 758,
1435
+ 28,
1436
+ 339,
1437
+ 502,
1438
+ 104,
1439
+ 471,
1440
+ 829,
1441
+ 694,
1442
+ 339,
1443
+ 396,
1444
+ 159,
1445
+ 830,
1446
+ 470,
1447
+ 196,
1448
+ 530,
1449
+ 673,
1450
+ 246,
1451
+ 9,
1452
+ 496,
1453
+ 338,
1454
+ 565,
1455
+ 427,
1456
+ 111,
1457
+ 406,
1458
+ 878,
1459
+ 985,
1460
+ 616,
1461
+ 392,
1462
+ 522,
1463
+ 851,
1464
+ 721,
1465
+ 119,
1466
+ 287,
1467
+ 324,
1468
+ 807,
1469
+ 178,
1470
+ 262,
1471
+ 187,
1472
+ 437,
1473
+ 464,
1474
+ 697,
1475
+ 658,
1476
+ 785,
1477
+ 953,
1478
+ 297,
1479
+ 239,
1480
+ 136,
1481
+ 873,
1482
+ 324,
1483
+ 146,
1484
+ 527,
1485
+ 85,
1486
+ 451,
1487
+ 722,
1488
+ 985,
1489
+ 121,
1490
+ 479,
1491
+ 292,
1492
+ 570,
1493
+ 134,
1494
+ 23,
1495
+ 606,
1496
+ 838,
1497
+ 160,
1498
+ 72,
1499
+ 683,
1500
+ 133,
1501
+ 69,
1502
+ 793,
1503
+ 364,
1504
+ 430,
1505
+ 442,
1506
+ 355,
1507
+ 663,
1508
+ 92,
1509
+ 851,
1510
+ 168,
1511
+ 967,
1512
+ 909,
1513
+ 311,
1514
+ 687,
1515
+ 37,
1516
+ 29,
1517
+ 780,
1518
+ 48,
1519
+ 530,
1520
+ 765,
1521
+ 580,
1522
+ 828,
1523
+ 93,
1524
+ 5,
1525
+ 48,
1526
+ 758,
1527
+ 819,
1528
+ 884,
1529
+ 221,
1530
+ 309,
1531
+ 446,
1532
+ 868,
1533
+ 984,
1534
+ 701,
1535
+ 945,
1536
+ 119,
1537
+ 747,
1538
+ 200,
1539
+ 84,
1540
+ 544,
1541
+ 326,
1542
+ 376,
1543
+ 521,
1544
+ 883,
1545
+ 681,
1546
+ 923,
1547
+ 615,
1548
+ 394,
1549
+ 916,
1550
+ 68,
1551
+ 568,
1552
+ 999,
1553
+ 40,
1554
+ 839,
1555
+ 84,
1556
+ 422,
1557
+ 617,
1558
+ 5,
1559
+ 686,
1560
+ 444,
1561
+ 740,
1562
+ 181,
1563
+ 542,
1564
+ 744,
1565
+ 270,
1566
+ 437,
1567
+ 134,
1568
+ 769,
1569
+ 781,
1570
+ 312,
1571
+ 928,
1572
+ 889,
1573
+ 115,
1574
+ 119,
1575
+ 446,
1576
+ 533,
1577
+ 677,
1578
+ 968,
1579
+ 404,
1580
+ 539,
1581
+ 598,
1582
+ 802,
1583
+ 140,
1584
+ 761,
1585
+ 592,
1586
+ 114,
1587
+ 604,
1588
+ 719,
1589
+ 585,
1590
+ 21,
1591
+ 973,
1592
+ 679,
1593
+ 572,
1594
+ 9,
1595
+ 857,
1596
+ 168,
1597
+ 779,
1598
+ 298,
1599
+ 363,
1600
+ 770,
1601
+ 346,
1602
+ 887,
1603
+ 852,
1604
+ 909,
1605
+ 799,
1606
+ 549,
1607
+ 566,
1608
+ 985,
1609
+ 300,
1610
+ 681,
1611
+ 873,
1612
+ 815,
1613
+ 290,
1614
+ 801,
1615
+ 837,
1616
+ 167,
1617
+ 95,
1618
+ 552,
1619
+ 126,
1620
+ 561,
1621
+ 688,
1622
+ 828,
1623
+ 324,
1624
+ 444,
1625
+ 400,
1626
+ 100,
1627
+ 741,
1628
+ 61,
1629
+ 465,
1630
+ 187,
1631
+ 244,
1632
+ 750,
1633
+ 75,
1634
+ 157,
1635
+ 868,
1636
+ 405,
1637
+ 379,
1638
+ 846,
1639
+ 552,
1640
+ 921,
1641
+ 671,
1642
+ 685,
1643
+ 731,
1644
+ 272,
1645
+ 542,
1646
+ 692,
1647
+ 971,
1648
+ 835,
1649
+ 130,
1650
+ 284,
1651
+ 670,
1652
+ 272,
1653
+ 30,
1654
+ 371,
1655
+ 533,
1656
+ 119,
1657
+ 480,
1658
+ 910,
1659
+ 986,
1660
+ 365,
1661
+ 501,
1662
+ 393,
1663
+ 692,
1664
+ 764,
1665
+ 913,
1666
+ 768,
1667
+ 562,
1668
+ 105,
1669
+ 154,
1670
+ 94,
1671
+ 169,
1672
+ 241,
1673
+ 732,
1674
+ 964,
1675
+ 928,
1676
+ 949,
1677
+ 639,
1678
+ 653,
1679
+ 116,
1680
+ 575,
1681
+ 866,
1682
+ 81,
1683
+ 393,
1684
+ 347,
1685
+ 319,
1686
+ 467,
1687
+ 936,
1688
+ 178,
1689
+ 901,
1690
+ 968,
1691
+ 674,
1692
+ 594,
1693
+ 10,
1694
+ 453,
1695
+ 766,
1696
+ 965,
1697
+ 975,
1698
+ 825,
1699
+ 781,
1700
+ 809,
1701
+ 253,
1702
+ 535,
1703
+ 334,
1704
+ 624,
1705
+ 480,
1706
+ 537,
1707
+ 479,
1708
+ 303,
1709
+ 507,
1710
+ 116,
1711
+ 263,
1712
+ 614,
1713
+ 536,
1714
+ 800,
1715
+ 95,
1716
+ 875,
1717
+ 739,
1718
+ 142,
1719
+ 459,
1720
+ 219,
1721
+ 525,
1722
+ 184,
1723
+ 256,
1724
+ 367,
1725
+ 614,
1726
+ 476,
1727
+ 890,
1728
+ 389,
1729
+ 662,
1730
+ 169,
1731
+ 207,
1732
+ 898,
1733
+ 4,
1734
+ 540,
1735
+ 710,
1736
+ 303,
1737
+ 720,
1738
+ 235,
1739
+ 172,
1740
+ 123,
1741
+ 264,
1742
+ 672,
1743
+ 437,
1744
+ 547,
1745
+ 55,
1746
+ 178,
1747
+ 859,
1748
+ 160,
1749
+ 633,
1750
+ 756,
1751
+ 245,
1752
+ 808,
1753
+ 281,
1754
+ 592,
1755
+ 763,
1756
+ 115,
1757
+ 35,
1758
+ 977,
1759
+ 437,
1760
+ 105,
1761
+ 21,
1762
+ 764,
1763
+ 500,
1764
+ 819,
1765
+ 634,
1766
+ 717,
1767
+ 822,
1768
+ 427,
1769
+ 362,
1770
+ 452,
1771
+ 944,
1772
+ 601,
1773
+ 578,
1774
+ 971,
1775
+ 141,
1776
+ 598,
1777
+ 85,
1778
+ 474,
1779
+ 797,
1780
+ 416,
1781
+ 506,
1782
+ 742,
1783
+ 945,
1784
+ 449,
1785
+ 398,
1786
+ 506,
1787
+ 495,
1788
+ 130,
1789
+ 583,
1790
+ 693,
1791
+ 37,
1792
+ 287,
1793
+ 745,
1794
+ 634,
1795
+ 794,
1796
+ 324,
1797
+ 323,
1798
+ 76,
1799
+ 576,
1800
+ 45,
1801
+ 788,
1802
+ 39,
1803
+ 78,
1804
+ 363,
1805
+ 837,
1806
+ 455,
1807
+ 38,
1808
+ 502,
1809
+ 964,
1810
+ 356,
1811
+ 236,
1812
+ 243,
1813
+ 268,
1814
+ 920,
1815
+ 59,
1816
+ 620,
1817
+ 797,
1818
+ 137,
1819
+ 930,
1820
+ 824,
1821
+ 613,
1822
+ 640,
1823
+ 634,
1824
+ 331,
1825
+ 75,
1826
+ 20,
1827
+ 424,
1828
+ 49,
1829
+ 896,
1830
+ 203
1831
+ ],
1832
+ "output": 136000
1833
+ },
1834
+ {
1835
+ "input": [
1836
+ 554,
1837
+ 726,
1838
+ 312,
1839
+ 607,
1840
+ 51,
1841
+ 859,
1842
+ 471,
1843
+ 711,
1844
+ 782,
1845
+ 273,
1846
+ 563,
1847
+ 447,
1848
+ 595,
1849
+ 68,
1850
+ 522,
1851
+ 591,
1852
+ 530,
1853
+ 710,
1854
+ 800,
1855
+ 633,
1856
+ 301,
1857
+ 935,
1858
+ 931,
1859
+ 485,
1860
+ 267,
1861
+ 163,
1862
+ 231,
1863
+ 612,
1864
+ 814,
1865
+ 618,
1866
+ 257,
1867
+ 11,
1868
+ 270,
1869
+ 349,
1870
+ 938,
1871
+ 919,
1872
+ 253,
1873
+ 938,
1874
+ 143,
1875
+ 449,
1876
+ 236,
1877
+ 484,
1878
+ 979,
1879
+ 569,
1880
+ 823,
1881
+ 26,
1882
+ 473,
1883
+ 709,
1884
+ 981,
1885
+ 310,
1886
+ 937,
1887
+ 582,
1888
+ 642,
1889
+ 117,
1890
+ 885,
1891
+ 794,
1892
+ 125,
1893
+ 36,
1894
+ 853,
1895
+ 692,
1896
+ 452,
1897
+ 539,
1898
+ 901,
1899
+ 551,
1900
+ 999,
1901
+ 127,
1902
+ 913,
1903
+ 532,
1904
+ 68,
1905
+ 987,
1906
+ 201,
1907
+ 8,
1908
+ 998,
1909
+ 141,
1910
+ 401,
1911
+ 438,
1912
+ 759,
1913
+ 19,
1914
+ 552,
1915
+ 698,
1916
+ 530,
1917
+ 686,
1918
+ 514,
1919
+ 167,
1920
+ 294,
1921
+ 285,
1922
+ 514,
1923
+ 852,
1924
+ 299,
1925
+ 548,
1926
+ 418,
1927
+ 565,
1928
+ 284,
1929
+ 864,
1930
+ 736,
1931
+ 338,
1932
+ 778,
1933
+ 614,
1934
+ 278,
1935
+ 464,
1936
+ 327,
1937
+ 391,
1938
+ 527,
1939
+ 887,
1940
+ 581,
1941
+ 439,
1942
+ 91,
1943
+ 811,
1944
+ 656,
1945
+ 136,
1946
+ 949,
1947
+ 888,
1948
+ 820,
1949
+ 268,
1950
+ 393,
1951
+ 470,
1952
+ 946,
1953
+ 517,
1954
+ 276,
1955
+ 521,
1956
+ 893,
1957
+ 906,
1958
+ 270,
1959
+ 336,
1960
+ 13,
1961
+ 444,
1962
+ 57,
1963
+ 328
1964
+ ],
1965
+ "output": 46
1966
+ },
1967
+ {
1968
+ "input": [
1969
+ 215,
1970
+ 54,
1971
+ 712,
1972
+ 806,
1973
+ 815,
1974
+ 931,
1975
+ 923,
1976
+ 410,
1977
+ 409,
1978
+ 583,
1979
+ 701,
1980
+ 928,
1981
+ 557,
1982
+ 254,
1983
+ 940,
1984
+ 891,
1985
+ 722,
1986
+ 78,
1987
+ 493,
1988
+ 995,
1989
+ 333,
1990
+ 587,
1991
+ 387,
1992
+ 549,
1993
+ 948,
1994
+ 907,
1995
+ 514,
1996
+ 267,
1997
+ 766,
1998
+ 93,
1999
+ 163,
2000
+ 74,
2001
+ 764,
2002
+ 732,
2003
+ 322,
2004
+ 240,
2005
+ 461,
2006
+ 289,
2007
+ 324,
2008
+ 78,
2009
+ 915,
2010
+ 172,
2011
+ 71,
2012
+ 87,
2013
+ 344,
2014
+ 43,
2015
+ 573,
2016
+ 944,
2017
+ 470,
2018
+ 801,
2019
+ 78,
2020
+ 894,
2021
+ 990,
2022
+ 5,
2023
+ 426,
2024
+ 748,
2025
+ 366,
2026
+ 349,
2027
+ 983,
2028
+ 556,
2029
+ 673,
2030
+ 996,
2031
+ 176,
2032
+ 747,
2033
+ 800,
2034
+ 57,
2035
+ 516,
2036
+ 834,
2037
+ 114,
2038
+ 940,
2039
+ 577,
2040
+ 237,
2041
+ 906,
2042
+ 535,
2043
+ 698,
2044
+ 615,
2045
+ 334,
2046
+ 155,
2047
+ 382,
2048
+ 119,
2049
+ 786,
2050
+ 950,
2051
+ 266,
2052
+ 785,
2053
+ 824,
2054
+ 83,
2055
+ 457,
2056
+ 493,
2057
+ 38,
2058
+ 234,
2059
+ 294,
2060
+ 623,
2061
+ 71,
2062
+ 960,
2063
+ 777,
2064
+ 555,
2065
+ 280,
2066
+ 143,
2067
+ 199,
2068
+ 850,
2069
+ 870,
2070
+ 394,
2071
+ 724,
2072
+ 921,
2073
+ 79,
2074
+ 626,
2075
+ 595,
2076
+ 369,
2077
+ 606,
2078
+ 442,
2079
+ 260,
2080
+ 165,
2081
+ 800,
2082
+ 882,
2083
+ 913,
2084
+ 456,
2085
+ 880,
2086
+ 370,
2087
+ 179,
2088
+ 623,
2089
+ 553,
2090
+ 537,
2091
+ 494,
2092
+ 900,
2093
+ 280,
2094
+ 524,
2095
+ 526,
2096
+ 121,
2097
+ 671,
2098
+ 222,
2099
+ 962,
2100
+ 875,
2101
+ 962,
2102
+ 562,
2103
+ 774,
2104
+ 223,
2105
+ 87,
2106
+ 100,
2107
+ 164,
2108
+ 465,
2109
+ 745,
2110
+ 985,
2111
+ 902,
2112
+ 143,
2113
+ 9,
2114
+ 358,
2115
+ 898,
2116
+ 12,
2117
+ 500,
2118
+ 199,
2119
+ 404,
2120
+ 179,
2121
+ 425,
2122
+ 482,
2123
+ 819,
2124
+ 38,
2125
+ 271,
2126
+ 252,
2127
+ 644,
2128
+ 225,
2129
+ 290,
2130
+ 694,
2131
+ 658,
2132
+ 206,
2133
+ 615,
2134
+ 212,
2135
+ 490,
2136
+ 472,
2137
+ 636,
2138
+ 8,
2139
+ 51,
2140
+ 966,
2141
+ 169,
2142
+ 946,
2143
+ 749,
2144
+ 798,
2145
+ 107,
2146
+ 210,
2147
+ 998,
2148
+ 291,
2149
+ 334,
2150
+ 495,
2151
+ 447,
2152
+ 36,
2153
+ 528,
2154
+ 415,
2155
+ 369,
2156
+ 13,
2157
+ 497,
2158
+ 868,
2159
+ 880,
2160
+ 144,
2161
+ 503,
2162
+ 319,
2163
+ 559,
2164
+ 878,
2165
+ 974,
2166
+ 62,
2167
+ 766,
2168
+ 556,
2169
+ 402,
2170
+ 452,
2171
+ 968,
2172
+ 659,
2173
+ 737,
2174
+ 416,
2175
+ 405,
2176
+ 777,
2177
+ 73,
2178
+ 162,
2179
+ 762,
2180
+ 95,
2181
+ 988,
2182
+ 155,
2183
+ 254,
2184
+ 153,
2185
+ 415,
2186
+ 858,
2187
+ 152,
2188
+ 570,
2189
+ 158,
2190
+ 948,
2191
+ 700,
2192
+ 654,
2193
+ 941,
2194
+ 895,
2195
+ 137,
2196
+ 786,
2197
+ 546,
2198
+ 436,
2199
+ 151,
2200
+ 394,
2201
+ 765,
2202
+ 445,
2203
+ 980,
2204
+ 198,
2205
+ 652,
2206
+ 557,
2207
+ 81,
2208
+ 810,
2209
+ 183,
2210
+ 116,
2211
+ 924,
2212
+ 699,
2213
+ 489,
2214
+ 313,
2215
+ 825,
2216
+ 934,
2217
+ 240,
2218
+ 555,
2219
+ 706,
2220
+ 808,
2221
+ 616,
2222
+ 639,
2223
+ 11,
2224
+ 143,
2225
+ 199,
2226
+ 925,
2227
+ 741,
2228
+ 690,
2229
+ 307,
2230
+ 161,
2231
+ 983,
2232
+ 655,
2233
+ 632,
2234
+ 724,
2235
+ 507,
2236
+ 614,
2237
+ 652,
2238
+ 706,
2239
+ 313,
2240
+ 554,
2241
+ 598,
2242
+ 458,
2243
+ 566,
2244
+ 603,
2245
+ 434,
2246
+ 331,
2247
+ 695,
2248
+ 770,
2249
+ 690,
2250
+ 706,
2251
+ 254,
2252
+ 725,
2253
+ 681,
2254
+ 250,
2255
+ 89,
2256
+ 286,
2257
+ 860,
2258
+ 885,
2259
+ 276,
2260
+ 166,
2261
+ 639,
2262
+ 404,
2263
+ 475,
2264
+ 438,
2265
+ 1000,
2266
+ 354,
2267
+ 529,
2268
+ 68,
2269
+ 581,
2270
+ 507,
2271
+ 433,
2272
+ 156,
2273
+ 180,
2274
+ 506,
2275
+ 585,
2276
+ 162,
2277
+ 959,
2278
+ 391,
2279
+ 762,
2280
+ 399,
2281
+ 112,
2282
+ 3,
2283
+ 260,
2284
+ 364,
2285
+ 523,
2286
+ 325,
2287
+ 443,
2288
+ 336,
2289
+ 966,
2290
+ 23,
2291
+ 332,
2292
+ 19,
2293
+ 216,
2294
+ 84,
2295
+ 999,
2296
+ 846,
2297
+ 522,
2298
+ 906,
2299
+ 7,
2300
+ 898,
2301
+ 953,
2302
+ 244,
2303
+ 600,
2304
+ 642,
2305
+ 648,
2306
+ 390,
2307
+ 973,
2308
+ 209,
2309
+ 438,
2310
+ 829,
2311
+ 433,
2312
+ 807,
2313
+ 196,
2314
+ 978,
2315
+ 168,
2316
+ 512,
2317
+ 218,
2318
+ 835,
2319
+ 735,
2320
+ 307,
2321
+ 120,
2322
+ 880,
2323
+ 739,
2324
+ 219,
2325
+ 41,
2326
+ 446,
2327
+ 750,
2328
+ 619,
2329
+ 850,
2330
+ 140,
2331
+ 243,
2332
+ 275,
2333
+ 353,
2334
+ 798,
2335
+ 611,
2336
+ 896,
2337
+ 449,
2338
+ 593,
2339
+ 997,
2340
+ 748,
2341
+ 384,
2342
+ 881,
2343
+ 443,
2344
+ 902,
2345
+ 769,
2346
+ 641,
2347
+ 719,
2348
+ 535,
2349
+ 591,
2350
+ 948,
2351
+ 592,
2352
+ 691,
2353
+ 266,
2354
+ 62,
2355
+ 996,
2356
+ 334,
2357
+ 460,
2358
+ 223,
2359
+ 103,
2360
+ 413,
2361
+ 392,
2362
+ 49,
2363
+ 648,
2364
+ 881,
2365
+ 643,
2366
+ 225,
2367
+ 722,
2368
+ 658,
2369
+ 257,
2370
+ 803,
2371
+ 655,
2372
+ 285,
2373
+ 243,
2374
+ 5,
2375
+ 311,
2376
+ 248,
2377
+ 430,
2378
+ 895,
2379
+ 350,
2380
+ 610,
2381
+ 222,
2382
+ 991,
2383
+ 952,
2384
+ 891,
2385
+ 596,
2386
+ 130,
2387
+ 418,
2388
+ 697,
2389
+ 211,
2390
+ 33,
2391
+ 135,
2392
+ 128,
2393
+ 955,
2394
+ 836,
2395
+ 625,
2396
+ 490,
2397
+ 258,
2398
+ 841,
2399
+ 99,
2400
+ 355,
2401
+ 753,
2402
+ 810,
2403
+ 607,
2404
+ 510,
2405
+ 679,
2406
+ 639,
2407
+ 911,
2408
+ 404,
2409
+ 603,
2410
+ 680,
2411
+ 247,
2412
+ 10,
2413
+ 509,
2414
+ 503,
2415
+ 813,
2416
+ 678,
2417
+ 346,
2418
+ 63,
2419
+ 647,
2420
+ 522,
2421
+ 885,
2422
+ 48,
2423
+ 492,
2424
+ 91,
2425
+ 990,
2426
+ 935,
2427
+ 569,
2428
+ 766,
2429
+ 329,
2430
+ 504,
2431
+ 336,
2432
+ 41,
2433
+ 672,
2434
+ 491,
2435
+ 357,
2436
+ 856,
2437
+ 328,
2438
+ 894,
2439
+ 625,
2440
+ 662,
2441
+ 821,
2442
+ 591,
2443
+ 240,
2444
+ 13,
2445
+ 997,
2446
+ 836,
2447
+ 259,
2448
+ 231,
2449
+ 970,
2450
+ 943,
2451
+ 655,
2452
+ 402,
2453
+ 643,
2454
+ 379,
2455
+ 201,
2456
+ 702,
2457
+ 233,
2458
+ 637,
2459
+ 323,
2460
+ 650,
2461
+ 738,
2462
+ 411,
2463
+ 709,
2464
+ 196,
2465
+ 638,
2466
+ 723,
2467
+ 334,
2468
+ 737,
2469
+ 518,
2470
+ 35,
2471
+ 713,
2472
+ 525,
2473
+ 866,
2474
+ 18,
2475
+ 171,
2476
+ 292,
2477
+ 272,
2478
+ 427,
2479
+ 195,
2480
+ 670,
2481
+ 704,
2482
+ 724,
2483
+ 608,
2484
+ 57,
2485
+ 867,
2486
+ 304,
2487
+ 94,
2488
+ 826,
2489
+ 401,
2490
+ 197,
2491
+ 854,
2492
+ 439,
2493
+ 451,
2494
+ 981,
2495
+ 108,
2496
+ 999,
2497
+ 364,
2498
+ 104,
2499
+ 251,
2500
+ 557,
2501
+ 900,
2502
+ 155,
2503
+ 253,
2504
+ 415,
2505
+ 971,
2506
+ 389,
2507
+ 64,
2508
+ 363,
2509
+ 442,
2510
+ 496,
2511
+ 369,
2512
+ 657,
2513
+ 985,
2514
+ 269,
2515
+ 866,
2516
+ 57,
2517
+ 532,
2518
+ 678,
2519
+ 786,
2520
+ 584,
2521
+ 564,
2522
+ 663,
2523
+ 585,
2524
+ 164,
2525
+ 422,
2526
+ 940,
2527
+ 330,
2528
+ 401,
2529
+ 855,
2530
+ 45,
2531
+ 287,
2532
+ 928,
2533
+ 456,
2534
+ 667,
2535
+ 551,
2536
+ 921,
2537
+ 252,
2538
+ 411,
2539
+ 968,
2540
+ 372,
2541
+ 715,
2542
+ 420,
2543
+ 21,
2544
+ 572,
2545
+ 373,
2546
+ 499,
2547
+ 528,
2548
+ 163,
2549
+ 519,
2550
+ 274,
2551
+ 628,
2552
+ 365,
2553
+ 937,
2554
+ 433,
2555
+ 912,
2556
+ 580,
2557
+ 253,
2558
+ 56,
2559
+ 933,
2560
+ 741,
2561
+ 134,
2562
+ 510,
2563
+ 394,
2564
+ 54,
2565
+ 352,
2566
+ 531,
2567
+ 408,
2568
+ 606,
2569
+ 523,
2570
+ 55,
2571
+ 564,
2572
+ 461,
2573
+ 690,
2574
+ 398,
2575
+ 245,
2576
+ 813,
2577
+ 819,
2578
+ 130,
2579
+ 721,
2580
+ 452,
2581
+ 624,
2582
+ 555,
2583
+ 216,
2584
+ 988,
2585
+ 992,
2586
+ 483,
2587
+ 566,
2588
+ 687,
2589
+ 548,
2590
+ 367,
2591
+ 786,
2592
+ 15,
2593
+ 672,
2594
+ 889,
2595
+ 869,
2596
+ 317,
2597
+ 618,
2598
+ 571,
2599
+ 131,
2600
+ 525,
2601
+ 386,
2602
+ 137,
2603
+ 328,
2604
+ 843,
2605
+ 612,
2606
+ 336,
2607
+ 644,
2608
+ 548,
2609
+ 604,
2610
+ 41,
2611
+ 663,
2612
+ 241,
2613
+ 776,
2614
+ 232,
2615
+ 668,
2616
+ 596,
2617
+ 65,
2618
+ 772,
2619
+ 98,
2620
+ 59,
2621
+ 12,
2622
+ 877,
2623
+ 502,
2624
+ 58,
2625
+ 900,
2626
+ 519,
2627
+ 943,
2628
+ 220,
2629
+ 476,
2630
+ 111,
2631
+ 476,
2632
+ 418,
2633
+ 860,
2634
+ 643,
2635
+ 759,
2636
+ 754,
2637
+ 408,
2638
+ 808,
2639
+ 1000,
2640
+ 626,
2641
+ 383,
2642
+ 675,
2643
+ 455,
2644
+ 268,
2645
+ 268,
2646
+ 571,
2647
+ 915,
2648
+ 132,
2649
+ 192,
2650
+ 573,
2651
+ 274,
2652
+ 720,
2653
+ 872,
2654
+ 819,
2655
+ 369,
2656
+ 497,
2657
+ 143,
2658
+ 109,
2659
+ 438,
2660
+ 264,
2661
+ 750,
2662
+ 944,
2663
+ 39,
2664
+ 496,
2665
+ 274,
2666
+ 295,
2667
+ 84,
2668
+ 359,
2669
+ 465,
2670
+ 605,
2671
+ 133,
2672
+ 915,
2673
+ 906,
2674
+ 682,
2675
+ 541,
2676
+ 134,
2677
+ 76,
2678
+ 51,
2679
+ 823,
2680
+ 425,
2681
+ 490,
2682
+ 653,
2683
+ 656,
2684
+ 745,
2685
+ 428,
2686
+ 289,
2687
+ 387,
2688
+ 755,
2689
+ 937,
2690
+ 513,
2691
+ 578,
2692
+ 480,
2693
+ 429,
2694
+ 706,
2695
+ 82,
2696
+ 740,
2697
+ 404,
2698
+ 1,
2699
+ 248,
2700
+ 392,
2701
+ 209,
2702
+ 106,
2703
+ 575,
2704
+ 590,
2705
+ 128,
2706
+ 253,
2707
+ 559,
2708
+ 481,
2709
+ 134,
2710
+ 452,
2711
+ 513,
2712
+ 858,
2713
+ 310,
2714
+ 511,
2715
+ 812,
2716
+ 142,
2717
+ 730,
2718
+ 694,
2719
+ 144,
2720
+ 431,
2721
+ 209,
2722
+ 420,
2723
+ 759,
2724
+ 91,
2725
+ 257,
2726
+ 549,
2727
+ 794,
2728
+ 39,
2729
+ 508,
2730
+ 559,
2731
+ 713,
2732
+ 38,
2733
+ 778,
2734
+ 507,
2735
+ 200,
2736
+ 17,
2737
+ 95,
2738
+ 462,
2739
+ 186,
2740
+ 873,
2741
+ 616,
2742
+ 409,
2743
+ 635,
2744
+ 97,
2745
+ 200,
2746
+ 91,
2747
+ 375,
2748
+ 815,
2749
+ 625,
2750
+ 544,
2751
+ 874,
2752
+ 306,
2753
+ 788,
2754
+ 64,
2755
+ 942,
2756
+ 626,
2757
+ 719,
2758
+ 266,
2759
+ 881,
2760
+ 828,
2761
+ 233,
2762
+ 201,
2763
+ 8,
2764
+ 547,
2765
+ 394,
2766
+ 720,
2767
+ 314,
2768
+ 628,
2769
+ 885,
2770
+ 538,
2771
+ 602,
2772
+ 94,
2773
+ 616,
2774
+ 4,
2775
+ 188,
2776
+ 873,
2777
+ 901,
2778
+ 695,
2779
+ 287,
2780
+ 953,
2781
+ 469,
2782
+ 787,
2783
+ 65,
2784
+ 76,
2785
+ 132,
2786
+ 937,
2787
+ 908,
2788
+ 455,
2789
+ 551,
2790
+ 404,
2791
+ 850,
2792
+ 762,
2793
+ 670,
2794
+ 56,
2795
+ 371,
2796
+ 161,
2797
+ 412,
2798
+ 671,
2799
+ 740,
2800
+ 60,
2801
+ 908,
2802
+ 846,
2803
+ 549,
2804
+ 56,
2805
+ 280,
2806
+ 940,
2807
+ 417,
2808
+ 839,
2809
+ 732,
2810
+ 77,
2811
+ 646,
2812
+ 831,
2813
+ 771,
2814
+ 426,
2815
+ 102,
2816
+ 775,
2817
+ 509,
2818
+ 795,
2819
+ 910,
2820
+ 701,
2821
+ 151,
2822
+ 520,
2823
+ 79,
2824
+ 771,
2825
+ 771,
2826
+ 155,
2827
+ 945,
2828
+ 436,
2829
+ 612,
2830
+ 68,
2831
+ 606,
2832
+ 164,
2833
+ 806,
2834
+ 20,
2835
+ 423,
2836
+ 561,
2837
+ 814,
2838
+ 885,
2839
+ 121,
2840
+ 501,
2841
+ 199,
2842
+ 704,
2843
+ 467,
2844
+ 895,
2845
+ 412,
2846
+ 549,
2847
+ 853,
2848
+ 180,
2849
+ 204,
2850
+ 322,
2851
+ 555,
2852
+ 748,
2853
+ 750,
2854
+ 711,
2855
+ 809,
2856
+ 362,
2857
+ 861,
2858
+ 413,
2859
+ 417,
2860
+ 880,
2861
+ 709,
2862
+ 767,
2863
+ 161,
2864
+ 566,
2865
+ 370,
2866
+ 673,
2867
+ 478,
2868
+ 240,
2869
+ 204,
2870
+ 189,
2871
+ 698,
2872
+ 496,
2873
+ 92,
2874
+ 433,
2875
+ 415,
2876
+ 765,
2877
+ 525,
2878
+ 945,
2879
+ 858,
2880
+ 420,
2881
+ 198,
2882
+ 562,
2883
+ 216,
2884
+ 722,
2885
+ 434,
2886
+ 859,
2887
+ 231,
2888
+ 8,
2889
+ 935,
2890
+ 499,
2891
+ 672,
2892
+ 857,
2893
+ 39,
2894
+ 381,
2895
+ 707,
2896
+ 265,
2897
+ 286,
2898
+ 976,
2899
+ 613,
2900
+ 119,
2901
+ 763,
2902
+ 913,
2903
+ 381,
2904
+ 349,
2905
+ 595
2906
+ ],
2907
+ "output": 254317
2908
+ },
2909
+ {
2910
+ "input": [
2911
+ 902,
2912
+ 905,
2913
+ 731,
2914
+ 604,
2915
+ 350,
2916
+ 252,
2917
+ 535,
2918
+ 709,
2919
+ 601,
2920
+ 399,
2921
+ 372,
2922
+ 843,
2923
+ 927,
2924
+ 576,
2925
+ 311,
2926
+ 428,
2927
+ 736,
2928
+ 323,
2929
+ 378,
2930
+ 22,
2931
+ 263,
2932
+ 568,
2933
+ 181,
2934
+ 422,
2935
+ 512,
2936
+ 577,
2937
+ 275,
2938
+ 175,
2939
+ 283,
2940
+ 701,
2941
+ 861,
2942
+ 518,
2943
+ 290,
2944
+ 624,
2945
+ 123,
2946
+ 727,
2947
+ 284,
2948
+ 880,
2949
+ 759,
2950
+ 817,
2951
+ 504,
2952
+ 258,
2953
+ 720,
2954
+ 188,
2955
+ 349,
2956
+ 516,
2957
+ 202,
2958
+ 492,
2959
+ 663,
2960
+ 233,
2961
+ 391,
2962
+ 33,
2963
+ 311,
2964
+ 643,
2965
+ 259,
2966
+ 162,
2967
+ 208,
2968
+ 726,
2969
+ 241,
2970
+ 388,
2971
+ 89,
2972
+ 327,
2973
+ 134,
2974
+ 631,
2975
+ 433,
2976
+ 144,
2977
+ 574,
2978
+ 12,
2979
+ 600,
2980
+ 447,
2981
+ 138,
2982
+ 13,
2983
+ 908,
2984
+ 84,
2985
+ 48,
2986
+ 529,
2987
+ 853,
2988
+ 747,
2989
+ 13,
2990
+ 227,
2991
+ 127,
2992
+ 721,
2993
+ 832,
2994
+ 399,
2995
+ 949,
2996
+ 360,
2997
+ 331,
2998
+ 538,
2999
+ 153,
3000
+ 534,
3001
+ 378,
3002
+ 943,
3003
+ 800,
3004
+ 221,
3005
+ 535,
3006
+ 821,
3007
+ 355,
3008
+ 332,
3009
+ 794,
3010
+ 576,
3011
+ 887,
3012
+ 827,
3013
+ 29,
3014
+ 895,
3015
+ 381,
3016
+ 658,
3017
+ 155,
3018
+ 646,
3019
+ 999,
3020
+ 798,
3021
+ 543,
3022
+ 300,
3023
+ 92,
3024
+ 479,
3025
+ 577,
3026
+ 23,
3027
+ 194,
3028
+ 956,
3029
+ 323,
3030
+ 2,
3031
+ 548,
3032
+ 592,
3033
+ 317,
3034
+ 693,
3035
+ 908,
3036
+ 241,
3037
+ 366,
3038
+ 688,
3039
+ 378,
3040
+ 307,
3041
+ 124,
3042
+ 749,
3043
+ 446,
3044
+ 585,
3045
+ 390,
3046
+ 140,
3047
+ 238,
3048
+ 231,
3049
+ 324,
3050
+ 79,
3051
+ 522,
3052
+ 880,
3053
+ 623,
3054
+ 950,
3055
+ 234,
3056
+ 695,
3057
+ 404,
3058
+ 937,
3059
+ 461,
3060
+ 28,
3061
+ 483,
3062
+ 572,
3063
+ 636,
3064
+ 980,
3065
+ 267,
3066
+ 99,
3067
+ 720,
3068
+ 947,
3069
+ 581,
3070
+ 584,
3071
+ 635,
3072
+ 762,
3073
+ 547,
3074
+ 305,
3075
+ 715,
3076
+ 223,
3077
+ 338,
3078
+ 33,
3079
+ 891,
3080
+ 754,
3081
+ 358,
3082
+ 858,
3083
+ 473,
3084
+ 807,
3085
+ 396,
3086
+ 604,
3087
+ 255,
3088
+ 746,
3089
+ 547,
3090
+ 830,
3091
+ 20,
3092
+ 727,
3093
+ 83,
3094
+ 448,
3095
+ 760,
3096
+ 943,
3097
+ 16,
3098
+ 714,
3099
+ 371,
3100
+ 994,
3101
+ 704,
3102
+ 549,
3103
+ 41,
3104
+ 391,
3105
+ 403,
3106
+ 70,
3107
+ 299,
3108
+ 414,
3109
+ 462,
3110
+ 575,
3111
+ 897,
3112
+ 99,
3113
+ 602,
3114
+ 623,
3115
+ 340,
3116
+ 599,
3117
+ 605,
3118
+ 741,
3119
+ 195,
3120
+ 193,
3121
+ 978,
3122
+ 927,
3123
+ 80,
3124
+ 509,
3125
+ 626,
3126
+ 912,
3127
+ 704,
3128
+ 705,
3129
+ 360,
3130
+ 134,
3131
+ 299,
3132
+ 40,
3133
+ 511,
3134
+ 1000,
3135
+ 519,
3136
+ 44,
3137
+ 886,
3138
+ 529,
3139
+ 963,
3140
+ 1000,
3141
+ 973,
3142
+ 618,
3143
+ 579,
3144
+ 632,
3145
+ 624,
3146
+ 2,
3147
+ 151,
3148
+ 54,
3149
+ 525,
3150
+ 418,
3151
+ 26,
3152
+ 545,
3153
+ 917,
3154
+ 653,
3155
+ 648,
3156
+ 776,
3157
+ 389,
3158
+ 867,
3159
+ 315,
3160
+ 542,
3161
+ 760,
3162
+ 54,
3163
+ 891,
3164
+ 334,
3165
+ 937,
3166
+ 617,
3167
+ 747,
3168
+ 646,
3169
+ 481,
3170
+ 43,
3171
+ 514,
3172
+ 63,
3173
+ 887,
3174
+ 219,
3175
+ 464,
3176
+ 746,
3177
+ 817,
3178
+ 804,
3179
+ 427,
3180
+ 927,
3181
+ 815,
3182
+ 545,
3183
+ 738,
3184
+ 478,
3185
+ 491,
3186
+ 648,
3187
+ 704,
3188
+ 422,
3189
+ 237,
3190
+ 136,
3191
+ 854,
3192
+ 612,
3193
+ 760,
3194
+ 643,
3195
+ 80,
3196
+ 760,
3197
+ 560,
3198
+ 606,
3199
+ 961,
3200
+ 474,
3201
+ 372,
3202
+ 396,
3203
+ 622,
3204
+ 752,
3205
+ 559,
3206
+ 564,
3207
+ 236,
3208
+ 261,
3209
+ 306,
3210
+ 642,
3211
+ 902,
3212
+ 554,
3213
+ 874,
3214
+ 185,
3215
+ 229,
3216
+ 870,
3217
+ 945,
3218
+ 64,
3219
+ 392,
3220
+ 723,
3221
+ 138,
3222
+ 911,
3223
+ 105,
3224
+ 161,
3225
+ 565,
3226
+ 202,
3227
+ 33,
3228
+ 907,
3229
+ 708,
3230
+ 32,
3231
+ 33,
3232
+ 79,
3233
+ 671,
3234
+ 811,
3235
+ 696,
3236
+ 955,
3237
+ 475,
3238
+ 459,
3239
+ 703,
3240
+ 748,
3241
+ 855,
3242
+ 491,
3243
+ 224,
3244
+ 828,
3245
+ 117,
3246
+ 777,
3247
+ 153,
3248
+ 175,
3249
+ 745,
3250
+ 233,
3251
+ 559,
3252
+ 131,
3253
+ 971,
3254
+ 516,
3255
+ 908,
3256
+ 256,
3257
+ 59,
3258
+ 192,
3259
+ 225,
3260
+ 279,
3261
+ 950,
3262
+ 944,
3263
+ 358,
3264
+ 835,
3265
+ 741,
3266
+ 928,
3267
+ 42,
3268
+ 868,
3269
+ 594,
3270
+ 462,
3271
+ 848,
3272
+ 722,
3273
+ 316,
3274
+ 943,
3275
+ 895,
3276
+ 742,
3277
+ 379,
3278
+ 623,
3279
+ 613,
3280
+ 132,
3281
+ 779,
3282
+ 641,
3283
+ 831,
3284
+ 556,
3285
+ 609,
3286
+ 216,
3287
+ 716,
3288
+ 964,
3289
+ 200,
3290
+ 614,
3291
+ 627,
3292
+ 684,
3293
+ 676,
3294
+ 209,
3295
+ 505,
3296
+ 454,
3297
+ 25,
3298
+ 157,
3299
+ 65,
3300
+ 153,
3301
+ 713,
3302
+ 74,
3303
+ 781,
3304
+ 804,
3305
+ 646,
3306
+ 863,
3307
+ 30,
3308
+ 841,
3309
+ 702,
3310
+ 498,
3311
+ 709,
3312
+ 677,
3313
+ 280,
3314
+ 992,
3315
+ 920,
3316
+ 914,
3317
+ 978,
3318
+ 122,
3319
+ 69,
3320
+ 732,
3321
+ 152,
3322
+ 945,
3323
+ 471,
3324
+ 156,
3325
+ 391,
3326
+ 935,
3327
+ 391,
3328
+ 859,
3329
+ 117,
3330
+ 105,
3331
+ 3,
3332
+ 623,
3333
+ 156,
3334
+ 440,
3335
+ 209,
3336
+ 242,
3337
+ 604,
3338
+ 541,
3339
+ 556,
3340
+ 700,
3341
+ 258,
3342
+ 756,
3343
+ 845,
3344
+ 763,
3345
+ 190,
3346
+ 296,
3347
+ 114,
3348
+ 363,
3349
+ 684,
3350
+ 254,
3351
+ 310,
3352
+ 549,
3353
+ 58,
3354
+ 829,
3355
+ 983,
3356
+ 923,
3357
+ 193,
3358
+ 727,
3359
+ 834,
3360
+ 253,
3361
+ 303,
3362
+ 907,
3363
+ 18,
3364
+ 89,
3365
+ 939,
3366
+ 463,
3367
+ 62,
3368
+ 773,
3369
+ 408,
3370
+ 472,
3371
+ 838,
3372
+ 721,
3373
+ 277,
3374
+ 108,
3375
+ 68,
3376
+ 413,
3377
+ 825,
3378
+ 15,
3379
+ 365,
3380
+ 546,
3381
+ 484,
3382
+ 165,
3383
+ 97,
3384
+ 474,
3385
+ 799,
3386
+ 963,
3387
+ 922,
3388
+ 867,
3389
+ 704,
3390
+ 192,
3391
+ 980,
3392
+ 300,
3393
+ 997,
3394
+ 248,
3395
+ 29,
3396
+ 474,
3397
+ 237,
3398
+ 60,
3399
+ 239,
3400
+ 462,
3401
+ 882,
3402
+ 29,
3403
+ 779,
3404
+ 277,
3405
+ 926,
3406
+ 941,
3407
+ 534,
3408
+ 550,
3409
+ 417,
3410
+ 859,
3411
+ 768,
3412
+ 658,
3413
+ 939,
3414
+ 32,
3415
+ 659,
3416
+ 402,
3417
+ 610,
3418
+ 488,
3419
+ 979,
3420
+ 298,
3421
+ 945,
3422
+ 271,
3423
+ 286,
3424
+ 739,
3425
+ 433,
3426
+ 69,
3427
+ 901,
3428
+ 979,
3429
+ 725,
3430
+ 239,
3431
+ 308,
3432
+ 502,
3433
+ 397,
3434
+ 692,
3435
+ 745,
3436
+ 720,
3437
+ 95,
3438
+ 241,
3439
+ 952,
3440
+ 604,
3441
+ 537,
3442
+ 473,
3443
+ 450,
3444
+ 136,
3445
+ 946,
3446
+ 82,
3447
+ 238,
3448
+ 535,
3449
+ 33,
3450
+ 653,
3451
+ 393,
3452
+ 13,
3453
+ 105,
3454
+ 937,
3455
+ 407,
3456
+ 217,
3457
+ 578,
3458
+ 774,
3459
+ 486,
3460
+ 567,
3461
+ 23,
3462
+ 148,
3463
+ 137,
3464
+ 238,
3465
+ 599,
3466
+ 921,
3467
+ 638,
3468
+ 827,
3469
+ 327,
3470
+ 63,
3471
+ 705,
3472
+ 550,
3473
+ 920,
3474
+ 504,
3475
+ 471,
3476
+ 469,
3477
+ 953,
3478
+ 363,
3479
+ 39,
3480
+ 816,
3481
+ 729,
3482
+ 907,
3483
+ 547,
3484
+ 961,
3485
+ 937,
3486
+ 842,
3487
+ 94,
3488
+ 488,
3489
+ 687,
3490
+ 15,
3491
+ 471,
3492
+ 197,
3493
+ 390,
3494
+ 207,
3495
+ 843,
3496
+ 618,
3497
+ 256,
3498
+ 204,
3499
+ 530,
3500
+ 997,
3501
+ 963,
3502
+ 919,
3503
+ 661,
3504
+ 590,
3505
+ 322,
3506
+ 40,
3507
+ 165,
3508
+ 753,
3509
+ 985,
3510
+ 677,
3511
+ 911,
3512
+ 248,
3513
+ 609,
3514
+ 941,
3515
+ 86,
3516
+ 934,
3517
+ 512,
3518
+ 745,
3519
+ 279,
3520
+ 180,
3521
+ 503,
3522
+ 352,
3523
+ 688,
3524
+ 537,
3525
+ 702,
3526
+ 788,
3527
+ 818,
3528
+ 672,
3529
+ 733,
3530
+ 419,
3531
+ 914,
3532
+ 906,
3533
+ 624,
3534
+ 968,
3535
+ 269,
3536
+ 420,
3537
+ 221,
3538
+ 838,
3539
+ 435,
3540
+ 108,
3541
+ 732,
3542
+ 274,
3543
+ 200,
3544
+ 65,
3545
+ 940,
3546
+ 711,
3547
+ 98,
3548
+ 126,
3549
+ 509,
3550
+ 838,
3551
+ 285,
3552
+ 859,
3553
+ 607,
3554
+ 634,
3555
+ 594,
3556
+ 282,
3557
+ 804,
3558
+ 160
3559
+ ],
3560
+ "output": 59229
3561
+ }
3562
+ ],
3563
+ "haskell_template": "numberOfSubsequences :: [Int] -> Int\nnumberOfSubsequences nums ",
3564
+ "ocaml_template": "let numberOfSubsequences (nums: int list) : int = ",
3565
+ "scala_template": "def numberOfSubsequences(nums: List[Int]): Int = { \n \n}",
3566
+ "java_template": "class Solution {\n public long numberOfSubsequences(int[] nums) {\n \n }\n}",
3567
+ "python_template": "class Solution(object):\n def numberOfSubsequences(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n "
3568
+ }
count_special_subsequences/ocaml_tests/main.ml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let numberOfSubsequences (nums: int list) : int = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal 1 (numberOfSubsequences [1;2;3;4;3;6;1])
13
+
14
+ let test2 _ = assert_equal 3 (numberOfSubsequences [3;4;3;4;3;4;3;4])
15
+
16
+ let test3 _ = assert_equal 3 (numberOfSubsequences [157; 123; 292; 72; 538; 948; 379; 889; 202; 45; 444; 413; 532; 36; 787; 657; 764; 805; 24; 93; 314; 864; 344; 897; 565; 971; 940; 888; 931; 970; 526; 531; 156; 404; 772; 391; 939; 892; 533; 579; 767; 290; 576; 119; 412; 571; 932; 987; 284; 137; 842; 659; 79; 914; 83; 258; 63; 315; 525; 944; 439; 145; 609; 953; 544; 593; 252; 322; 360; 710; 502; 476; 664; 47; 872; 248; 387; 715; 258; 733; 652; 741; 813; 678; 624; 327; 784; 133; 92; 191; 877; 540; 573; 485; 489; 118; 824; 88; 506; 676; 335; 793; 123; 93; 37; 570; 50; 633; 392; 356; 976; 634; 712; 953; 249; 408; 202; 622; 598; 102; 475; 33; 886; 208; 531; 47; 931; 436; 835; 377; 913; 232; 992; 95; 814; 71; 77; 738; 256; 999; 369; 871; 328; 575; 352; 376; 895; 833; 557; 485; 794; 632; 208; 81; 304; 586; 270; 715; 385; 52; 635; 395; 746; 773; 88; 843; 801; 539; 627; 829; 831; 221; 784; 479; 598; 907; 740; 905; 979; 314; 827; 207; 182; 44; 772; 700; 690; 590; 890; 593; 902; 689; 111; 365; 36; 34; 462; 542; 674; 620; 858; 203; 568; 657; 993; 284; 862; 888; 178; 359; 879; 712; 365; 671; 559; 366; 392; 226; 754; 755; 101; 411; 500; 717; 622; 531; 383; 548; 718; 969; 317; 258; 325; 833; 699; 360; 113; 234; 355; 924; 123; 708; 775; 818; 54; 637; 588; 415; 599; 137; 464; 577; 790; 996; 636; 354; 612; 232; 946; 343; 673; 282; 360; 751; 204; 246; 904; 778; 352; 797; 33; 257; 40; 949; 718; 32; 113; 146; 147; 428; 564; 147; 854; 81; 986; 596; 687; 265; 559; 417; 70; 199; 969; 631; 317; 98; 981; 307; 111; 18; 865; 856; 688; 658; 732; 808; 610; 10; 622; 258; 220; 571; 273; 703; 631; 954; 498; 272; 878; 549; 743; 703; 869; 406; 833; 232; 677; 929; 724; 263; 108; 462; 772; 896; 574; 712; 75; 479; 845; 169; 877; 652; 634; 603; 213; 37; 202; 619; 422; 624; 164; 887; 163; 82; 326; 898; 465; 878; 118; 880; 410; 824; 887; 564; 540; 515; 807; 280; 266; 115; 418; 155; 509; 822; 696; 575; 643; 347; 314; 744; 341; 983; 279; 670; 724; 953; 113; 68; 542; 212; 336; 536; 392; 804; 507; 855; 887; 37; 83; 160; 410; 915; 730; 978; 753; 330; 241; 92; 535; 44; 626; 807; 690; 835; 551; 67; 577; 844; 370; 787; 254; 775; 315; 431; 767; 150; 183; 538; 922; 558; 48; 268; 508; 115; 311; 828; 37; 649; 604; 813; 779; 789; 285; 804; 212; 686; 416; 959; 807; 387; 24; 977; 464; 230; 796; 392; 776; 835; 843; 246; 347; 635; 359; 569; 404; 349; 931; 987; 100; 102; 990; 754; 666; 880; 250; 206; 744; 23; 719; 412; 467; 807; 796; 312; 346; 481; 210; 855; 72; 489; 479; 525; 611; 539; 534; 995; 429; 444; 676; 770; 793; 12; 586; 245; 131; 92; 370; 382; 944; 41; 627; 94; 107; 731; 58; 183; 226; 530; 431; 283; 438; 919; 697; 211; 911; 748; 339; 357; 797; 727; 938; 619; 279; 453; 360; 721; 984; 428; 603; 865; 277; 944; 548; 42; 611; 106; 557; 929; 631; 525; 278; 315; 891; 380; 782; 998; 531; 750; 106; 347; 565; 953; 35; 204; 114; 327; 886; 508; 514; 938; 229; 230; 710; 4; 951; 484; 269; 280; 11; 613; 865; 750; 185; 378; 582; 948; 845; 825; 16; 628; 493; 371; 84; 718; 127; 206; 998; 783; 259; 859; 970; 157; 360; 452; 605; 385; 404; 106; 637; 783; 950; 562; 735; 288; 796; 371; 738; 775; 334; 886; 204; 188; 290; 365; 75; 220; 116; 513; 361; 821; 793; 900; 992; 825; 503; 964; 446; 815; 106; 279; 983; 310; 970; 429; 584; 258; 293; 880; 903; 326; 607; 704; 431; 838; 167; 632; 969; 82; 769; 304; 800; 101; 187; 319; 960; 214; 208; 175; 857; 82; 862; 663; 13; 495; 299; 731; 306; 73; 869; 8; 444; 87; 55; 622; 118; 452; 245; 280; 546; 989; 762; 330; 717; 471; 327; 680; 998; 328; 215; 681; 581; 115; 39; 67; 529; 835; 591; 350; 559; 779; 566; 513; 318; 362; 914; 258; 986; 520; 289; 266; 477; 490; 857; 185; 687; 305; 343; 908; 795; 404; 567; 123; 102; 231; 871; 670; 162; 961; 266; 80; 335; 702; 342; 268; 517; 173; 61; 544; 687; 671; 335; 155; 606; 810; 920; 783; 52; 963; 964; 921; 724; 704; 953; 628; 247; 650; 433; 901; 144; 125; 648; 888; 286; 445; 379; 430; 309; 723; 986; 535; 464; 820; 323; 987; 797; 781; 721; 562; 540; 664; 952; 485; 500; 987; 480; 72; 861; 31; 922; 122; 6; 674; 863; 300; 755; 88; 260; 50; 478; 391; 626; 663; 241; 66; 535; 575; 344; 981; 289; 759; 457; 728; 848; 739; 154; 733; 408; 455; 356; 328; 79; 410; 485; 4; 554; 584; 562; 63; 902; 444; 21; 237; 258; 532; 350; 880; 257; 242; 250; 676; 522; 43; 816; 773; 810; 300; 445; 419; 34; 307; 971; 925; 725; 243; 177; 392; 510; 35; 534; 720; 925; 420; 632; 328; 752; 569; 835; 448; 443; 346; 941; 220; 209; 439; 257; 311; 192; 271; 141; 876; 647; 479; 98; 102; 694; 770; 201; 181; 478; 970; 451; 61; 280; 836; 255; 704; 712; 321; 899; 200; 461; 53; 181; 567; 869; 909; 270; 830; 351; 245; 222; 771; 3; 398; 948; 697; 476; 944; 229; 881; 382; 902; 405; 834; 422; 627; 899; 55; 736; 196; 921; 293; 933; 278; 378; 471; 615; 359; 62; 119; 405; 583; 998; 710; 503; 470; 378; 498; 773; 40; 240; 439; 341; 785; 444; 282; 619; 465; 963; 206; 451; 141; 517; 958; 111; 855; 851; 712; 105; 158; 327; 423; 444; 977; 841; 237; 804; 605; 964; 406; 617])
17
+
18
+ let test4 _ = assert_equal 3 (numberOfSubsequences [822; 69; 148; 353; 692; 228; 730; 335; 775; 94; 77; 117; 605; 943; 577; 520; 87; 363; 995; 720; 520; 785; 994; 439; 111; 903; 222; 94; 482; 958; 679; 117; 610; 55; 580; 746; 105; 175; 249; 612; 834; 766; 624; 615; 128; 536; 756; 419; 455; 18; 89; 44; 281; 132; 626; 68; 25; 603; 229; 10; 832; 158; 658; 628; 590; 571; 150; 606; 818; 274; 106; 396; 921; 502; 717; 95; 680; 386; 536; 307; 866; 864; 268; 429; 476; 826; 527; 845; 148; 450; 1; 947; 80; 680; 474; 188; 904; 92; 645; 218; 838; 576; 331; 145; 69; 894; 716; 235; 346; 399; 661; 571; 430; 853; 539; 713; 466; 345; 616; 963; 292; 16; 371; 334; 464; 550; 614; 709; 899; 288; 793; 186; 428; 129; 617; 166; 391; 901; 318; 674; 431; 750; 546; 499; 4; 487; 809; 325; 620; 371; 891; 393; 118; 665; 602; 511; 285; 225; 186; 450; 866; 320; 381; 203; 155; 276; 353; 35; 392; 243; 885; 783; 511; 660; 88; 161; 377; 183; 135; 114; 148; 661; 951; 490; 705; 728; 275; 754; 944; 506; 226; 331; 90; 194; 11; 792; 253; 369; 486; 193; 262; 647; 988; 713; 925; 876; 796; 836; 832; 692; 543; 808; 918; 512; 661; 110; 225; 597; 877; 681; 238; 213; 343; 987; 986; 397; 550; 649; 41; 884; 791; 214; 124; 796; 70; 484; 709; 901; 63; 415; 769; 360; 702; 21; 547; 929; 399; 863; 394; 250; 846; 810; 976; 648; 970; 889; 402; 44; 373; 927; 686; 109; 558; 310; 61; 919; 519; 952; 910; 980; 874; 747; 315; 423; 482; 623; 612; 507; 863; 757; 624; 378; 867; 618; 567; 714; 721; 123; 308; 420; 467; 977; 736; 239; 674; 16; 694; 353; 506; 802; 604; 301; 344; 656; 525; 149; 175; 748; 280; 46; 841; 438; 723; 67; 680; 790; 969; 455; 133; 745; 882; 29; 578; 480; 51; 841; 527; 345; 261; 597; 469; 447; 586; 874; 211; 827; 65; 772; 258; 37; 612; 441; 691; 726; 337; 137; 414; 147; 427; 398; 219; 28; 46; 508; 642; 144; 139; 813; 411; 88; 302; 970; 960; 51; 337; 795; 203; 665; 298; 387; 218; 490; 984; 532; 57; 800; 664; 703; 654; 689; 697; 150; 988; 188; 302; 20; 40; 395; 553; 343; 381; 225; 550; 359; 619; 283; 921; 92; 766; 765; 687; 28; 862; 750; 516; 963; 569; 962; 259; 934; 655; 751; 443; 983; 154; 758; 28; 339; 502; 104; 471; 829; 694; 339; 396; 159; 830; 470; 196; 530; 673; 246; 9; 496; 338; 565; 427; 111; 406; 878; 985; 616; 392; 522; 851; 721; 119; 287; 324; 807; 178; 262; 187; 437; 464; 697; 658; 785; 953; 297; 239; 136; 873; 324; 146; 527; 85; 451; 722; 985; 121; 479; 292; 570; 134; 23; 606; 838; 160; 72; 683; 133; 69; 793; 364; 430; 442; 355; 663; 92; 851; 168; 967; 909; 311; 687; 37; 29; 780; 48; 530; 765; 580; 828; 93; 5; 48; 758; 819; 884; 221; 309; 446; 868; 984; 701; 945; 119; 747; 200; 84; 544; 326; 376; 521; 883; 681; 923; 615; 394; 916; 68; 568; 999; 40; 839; 84; 422; 617; 5; 686; 444; 740; 181; 542; 744; 270; 437; 134; 769; 781; 312; 928; 889; 115; 119; 446; 533; 677; 968; 404; 539; 598; 802; 140; 761; 592; 114; 604; 719; 585; 21; 973; 679; 572; 9; 857; 168; 779; 298; 363; 770; 346; 887; 852; 909; 799; 549; 566; 985; 300; 681; 873; 815; 290; 801; 837; 167; 95; 552; 126; 561; 688; 828; 324; 444; 400; 100; 741; 61; 465; 187; 244; 750; 75; 157; 868; 405; 379; 846; 552; 921; 671; 685; 731; 272; 542; 692; 971; 835; 130; 284; 670; 272; 30; 371; 533; 119; 480; 910; 986; 365; 501; 393; 692; 764; 913; 768; 562; 105; 154; 94; 169; 241; 732; 964; 928; 949; 639; 653; 116; 575; 866; 81; 393; 347; 319; 467; 936; 178; 901; 968; 674; 594; 10; 453; 766; 965; 975; 825; 781; 809; 253; 535; 334; 624; 480; 537; 479; 303; 507; 116; 263; 614; 536; 800; 95; 875; 739; 142; 459; 219; 525; 184; 256; 367; 614; 476; 890; 389; 662; 169; 207; 898; 4; 540; 710; 303; 720; 235; 172; 123; 264; 672; 437; 547; 55; 178; 859; 160; 633; 756; 245; 808; 281; 592; 763; 115; 35; 977; 437; 105; 21; 764; 500; 819; 634; 717; 822; 427; 362; 452; 944; 601; 578; 971; 141; 598; 85; 474; 797; 416; 506; 742; 945; 449; 398; 506; 495; 130; 583; 693; 37; 287; 745; 634; 794; 324; 323; 76; 576; 45; 788; 39; 78; 363; 837; 455; 38; 502; 964; 356; 236; 243; 268; 920; 59; 620; 797; 137; 930; 824; 613; 640; 634; 331; 75; 20; 424; 49; 896; 203])
19
+
20
+ let test5 _ = assert_equal 3 (numberOfSubsequences [554; 726; 312; 607; 51; 859; 471; 711; 782; 273; 563; 447; 595; 68; 522; 591; 530; 710; 800; 633; 301; 935; 931; 485; 267; 163; 231; 612; 814; 618; 257; 11; 270; 349; 938; 919; 253; 938; 143; 449; 236; 484; 979; 569; 823; 26; 473; 709; 981; 310; 937; 582; 642; 117; 885; 794; 125; 36; 853; 692; 452; 539; 901; 551; 999; 127; 913; 532; 68; 987; 201; 8; 998; 141; 401; 438; 759; 19; 552; 698; 530; 686; 514; 167; 294; 285; 514; 852; 299; 548; 418; 565; 284; 864; 736; 338; 778; 614; 278; 464; 327; 391; 527; 887; 581; 439; 91; 811; 656; 136; 949; 888; 820; 268; 393; 470; 946; 517; 276; 521; 893; 906; 270; 336; 13; 444; 57; 328])
21
+
22
+ let test6 _ = assert_equal 3 (numberOfSubsequences [215; 54; 712; 806; 815; 931; 923; 410; 409; 583; 701; 928; 557; 254; 940; 891; 722; 78; 493; 995; 333; 587; 387; 549; 948; 907; 514; 267; 766; 93; 163; 74; 764; 732; 322; 240; 461; 289; 324; 78; 915; 172; 71; 87; 344; 43; 573; 944; 470; 801; 78; 894; 990; 5; 426; 748; 366; 349; 983; 556; 673; 996; 176; 747; 800; 57; 516; 834; 114; 940; 577; 237; 906; 535; 698; 615; 334; 155; 382; 119; 786; 950; 266; 785; 824; 83; 457; 493; 38; 234; 294; 623; 71; 960; 777; 555; 280; 143; 199; 850; 870; 394; 724; 921; 79; 626; 595; 369; 606; 442; 260; 165; 800; 882; 913; 456; 880; 370; 179; 623; 553; 537; 494; 900; 280; 524; 526; 121; 671; 222; 962; 875; 962; 562; 774; 223; 87; 100; 164; 465; 745; 985; 902; 143; 9; 358; 898; 12; 500; 199; 404; 179; 425; 482; 819; 38; 271; 252; 644; 225; 290; 694; 658; 206; 615; 212; 490; 472; 636; 8; 51; 966; 169; 946; 749; 798; 107; 210; 998; 291; 334; 495; 447; 36; 528; 415; 369; 13; 497; 868; 880; 144; 503; 319; 559; 878; 974; 62; 766; 556; 402; 452; 968; 659; 737; 416; 405; 777; 73; 162; 762; 95; 988; 155; 254; 153; 415; 858; 152; 570; 158; 948; 700; 654; 941; 895; 137; 786; 546; 436; 151; 394; 765; 445; 980; 198; 652; 557; 81; 810; 183; 116; 924; 699; 489; 313; 825; 934; 240; 555; 706; 808; 616; 639; 11; 143; 199; 925; 741; 690; 307; 161; 983; 655; 632; 724; 507; 614; 652; 706; 313; 554; 598; 458; 566; 603; 434; 331; 695; 770; 690; 706; 254; 725; 681; 250; 89; 286; 860; 885; 276; 166; 639; 404; 475; 438; 1000; 354; 529; 68; 581; 507; 433; 156; 180; 506; 585; 162; 959; 391; 762; 399; 112; 3; 260; 364; 523; 325; 443; 336; 966; 23; 332; 19; 216; 84; 999; 846; 522; 906; 7; 898; 953; 244; 600; 642; 648; 390; 973; 209; 438; 829; 433; 807; 196; 978; 168; 512; 218; 835; 735; 307; 120; 880; 739; 219; 41; 446; 750; 619; 850; 140; 243; 275; 353; 798; 611; 896; 449; 593; 997; 748; 384; 881; 443; 902; 769; 641; 719; 535; 591; 948; 592; 691; 266; 62; 996; 334; 460; 223; 103; 413; 392; 49; 648; 881; 643; 225; 722; 658; 257; 803; 655; 285; 243; 5; 311; 248; 430; 895; 350; 610; 222; 991; 952; 891; 596; 130; 418; 697; 211; 33; 135; 128; 955; 836; 625; 490; 258; 841; 99; 355; 753; 810; 607; 510; 679; 639; 911; 404; 603; 680; 247; 10; 509; 503; 813; 678; 346; 63; 647; 522; 885; 48; 492; 91; 990; 935; 569; 766; 329; 504; 336; 41; 672; 491; 357; 856; 328; 894; 625; 662; 821; 591; 240; 13; 997; 836; 259; 231; 970; 943; 655; 402; 643; 379; 201; 702; 233; 637; 323; 650; 738; 411; 709; 196; 638; 723; 334; 737; 518; 35; 713; 525; 866; 18; 171; 292; 272; 427; 195; 670; 704; 724; 608; 57; 867; 304; 94; 826; 401; 197; 854; 439; 451; 981; 108; 999; 364; 104; 251; 557; 900; 155; 253; 415; 971; 389; 64; 363; 442; 496; 369; 657; 985; 269; 866; 57; 532; 678; 786; 584; 564; 663; 585; 164; 422; 940; 330; 401; 855; 45; 287; 928; 456; 667; 551; 921; 252; 411; 968; 372; 715; 420; 21; 572; 373; 499; 528; 163; 519; 274; 628; 365; 937; 433; 912; 580; 253; 56; 933; 741; 134; 510; 394; 54; 352; 531; 408; 606; 523; 55; 564; 461; 690; 398; 245; 813; 819; 130; 721; 452; 624; 555; 216; 988; 992; 483; 566; 687; 548; 367; 786; 15; 672; 889; 869; 317; 618; 571; 131; 525; 386; 137; 328; 843; 612; 336; 644; 548; 604; 41; 663; 241; 776; 232; 668; 596; 65; 772; 98; 59; 12; 877; 502; 58; 900; 519; 943; 220; 476; 111; 476; 418; 860; 643; 759; 754; 408; 808; 1000; 626; 383; 675; 455; 268; 268; 571; 915; 132; 192; 573; 274; 720; 872; 819; 369; 497; 143; 109; 438; 264; 750; 944; 39; 496; 274; 295; 84; 359; 465; 605; 133; 915; 906; 682; 541; 134; 76; 51; 823; 425; 490; 653; 656; 745; 428; 289; 387; 755; 937; 513; 578; 480; 429; 706; 82; 740; 404; 1; 248; 392; 209; 106; 575; 590; 128; 253; 559; 481; 134; 452; 513; 858; 310; 511; 812; 142; 730; 694; 144; 431; 209; 420; 759; 91; 257; 549; 794; 39; 508; 559; 713; 38; 778; 507; 200; 17; 95; 462; 186; 873; 616; 409; 635; 97; 200; 91; 375; 815; 625; 544; 874; 306; 788; 64; 942; 626; 719; 266; 881; 828; 233; 201; 8; 547; 394; 720; 314; 628; 885; 538; 602; 94; 616; 4; 188; 873; 901; 695; 287; 953; 469; 787; 65; 76; 132; 937; 908; 455; 551; 404; 850; 762; 670; 56; 371; 161; 412; 671; 740; 60; 908; 846; 549; 56; 280; 940; 417; 839; 732; 77; 646; 831; 771; 426; 102; 775; 509; 795; 910; 701; 151; 520; 79; 771; 771; 155; 945; 436; 612; 68; 606; 164; 806; 20; 423; 561; 814; 885; 121; 501; 199; 704; 467; 895; 412; 549; 853; 180; 204; 322; 555; 748; 750; 711; 809; 362; 861; 413; 417; 880; 709; 767; 161; 566; 370; 673; 478; 240; 204; 189; 698; 496; 92; 433; 415; 765; 525; 945; 858; 420; 198; 562; 216; 722; 434; 859; 231; 8; 935; 499; 672; 857; 39; 381; 707; 265; 286; 976; 613; 119; 763; 913; 381; 349; 595])
23
+
24
+ let test7 _ = assert_equal 3 (numberOfSubsequences [902; 905; 731; 604; 350; 252; 535; 709; 601; 399; 372; 843; 927; 576; 311; 428; 736; 323; 378; 22; 263; 568; 181; 422; 512; 577; 275; 175; 283; 701; 861; 518; 290; 624; 123; 727; 284; 880; 759; 817; 504; 258; 720; 188; 349; 516; 202; 492; 663; 233; 391; 33; 311; 643; 259; 162; 208; 726; 241; 388; 89; 327; 134; 631; 433; 144; 574; 12; 600; 447; 138; 13; 908; 84; 48; 529; 853; 747; 13; 227; 127; 721; 832; 399; 949; 360; 331; 538; 153; 534; 378; 943; 800; 221; 535; 821; 355; 332; 794; 576; 887; 827; 29; 895; 381; 658; 155; 646; 999; 798; 543; 300; 92; 479; 577; 23; 194; 956; 323; 2; 548; 592; 317; 693; 908; 241; 366; 688; 378; 307; 124; 749; 446; 585; 390; 140; 238; 231; 324; 79; 522; 880; 623; 950; 234; 695; 404; 937; 461; 28; 483; 572; 636; 980; 267; 99; 720; 947; 581; 584; 635; 762; 547; 305; 715; 223; 338; 33; 891; 754; 358; 858; 473; 807; 396; 604; 255; 746; 547; 830; 20; 727; 83; 448; 760; 943; 16; 714; 371; 994; 704; 549; 41; 391; 403; 70; 299; 414; 462; 575; 897; 99; 602; 623; 340; 599; 605; 741; 195; 193; 978; 927; 80; 509; 626; 912; 704; 705; 360; 134; 299; 40; 511; 1000; 519; 44; 886; 529; 963; 1000; 973; 618; 579; 632; 624; 2; 151; 54; 525; 418; 26; 545; 917; 653; 648; 776; 389; 867; 315; 542; 760; 54; 891; 334; 937; 617; 747; 646; 481; 43; 514; 63; 887; 219; 464; 746; 817; 804; 427; 927; 815; 545; 738; 478; 491; 648; 704; 422; 237; 136; 854; 612; 760; 643; 80; 760; 560; 606; 961; 474; 372; 396; 622; 752; 559; 564; 236; 261; 306; 642; 902; 554; 874; 185; 229; 870; 945; 64; 392; 723; 138; 911; 105; 161; 565; 202; 33; 907; 708; 32; 33; 79; 671; 811; 696; 955; 475; 459; 703; 748; 855; 491; 224; 828; 117; 777; 153; 175; 745; 233; 559; 131; 971; 516; 908; 256; 59; 192; 225; 279; 950; 944; 358; 835; 741; 928; 42; 868; 594; 462; 848; 722; 316; 943; 895; 742; 379; 623; 613; 132; 779; 641; 831; 556; 609; 216; 716; 964; 200; 614; 627; 684; 676; 209; 505; 454; 25; 157; 65; 153; 713; 74; 781; 804; 646; 863; 30; 841; 702; 498; 709; 677; 280; 992; 920; 914; 978; 122; 69; 732; 152; 945; 471; 156; 391; 935; 391; 859; 117; 105; 3; 623; 156; 440; 209; 242; 604; 541; 556; 700; 258; 756; 845; 763; 190; 296; 114; 363; 684; 254; 310; 549; 58; 829; 983; 923; 193; 727; 834; 253; 303; 907; 18; 89; 939; 463; 62; 773; 408; 472; 838; 721; 277; 108; 68; 413; 825; 15; 365; 546; 484; 165; 97; 474; 799; 963; 922; 867; 704; 192; 980; 300; 997; 248; 29; 474; 237; 60; 239; 462; 882; 29; 779; 277; 926; 941; 534; 550; 417; 859; 768; 658; 939; 32; 659; 402; 610; 488; 979; 298; 945; 271; 286; 739; 433; 69; 901; 979; 725; 239; 308; 502; 397; 692; 745; 720; 95; 241; 952; 604; 537; 473; 450; 136; 946; 82; 238; 535; 33; 653; 393; 13; 105; 937; 407; 217; 578; 774; 486; 567; 23; 148; 137; 238; 599; 921; 638; 827; 327; 63; 705; 550; 920; 504; 471; 469; 953; 363; 39; 816; 729; 907; 547; 961; 937; 842; 94; 488; 687; 15; 471; 197; 390; 207; 843; 618; 256; 204; 530; 997; 963; 919; 661; 590; 322; 40; 165; 753; 985; 677; 911; 248; 609; 941; 86; 934; 512; 745; 279; 180; 503; 352; 688; 537; 702; 788; 818; 672; 733; 419; 914; 906; 624; 968; 269; 420; 221; 838; 435; 108; 732; 274; 200; 65; 940; 711; 98; 126; 509; 838; 285; 859; 607; 634; 594; 282; 804; 160])
25
+
26
+
27
+ (* Grouping test cases *)
28
+ let suite = "Test Suite for numberOfSubsequences" >::: [
29
+
30
+ "test1" >:: test1;
31
+ "test2" >:: test2;
32
+ "test3" >:: test3;
33
+ "test4" >:: test4;
34
+ "test5" >:: test5;
35
+ "test6" >:: test6;
36
+ "test7" >:: test7;
37
+ ]
38
+
39
+
40
+ (* Running the tests *)
41
+ let () = run_test_tt_main suite
42
+ end
count_special_subsequences/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.numberOfSubsequences(List(1,2,3,4,3,6,1)), 1)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.numberOfSubsequences(List(3,4,3,4,3,4,3,4)), 3)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.numberOfSubsequences(157,123,292,72,538,948,379,889,202,45,444,413,532,36,787,657,764,805,24,93,314,864,344,897,565,971,940,888,931,970,526,531,156,404,772,391,939,892,533,579,767,290,576,119,412,571,932,987,284,137,842,659,79,914,83,258,63,315,525,944,439,145,609,953,544,593,252,322,360,710,502,476,664,47,872,248,387,715,258,733,652,741,813,678,624,327,784,133,92,191,877,540,573,485,489,118,824,88,506,676,335,793,123,93,37,570,50,633,392,356,976,634,712,953,249,408,202,622,598,102,475,33,886,208,531,47,931,436,835,377,913,232,992,95,814,71,77,738,256,999,369,871,328,575,352,376,895,833,557,485,794,632,208,81,304,586,270,715,385,52,635,395,746,773,88,843,801,539,627,829,831,221,784,479,598,907,740,905,979,314,827,207,182,44,772,700,690,590,890,593,902,689,111,365,36,34,462,542,674,620,858,203,568,657,993,284,862,888,178,359,879,712,365,671,559,366,392,226,754,755,101,411,500,717,622,531,383,548,718,969,317,258,325,833,699,360,113,234,355,924,123,708,775,818,54,637,588,415,599,137,464,577,790,996,636,354,612,232,946,343,673,282,360,751,204,246,904,778,352,797,33,257,40,949,718,32,113,146,147,428,564,147,854,81,986,596,687,265,559,417,70,199,969,631,317,98,981,307,111,18,865,856,688,658,732,808,610,10,622,258,220,571,273,703,631,954,498,272,878,549,743,703,869,406,833,232,677,929,724,263,108,462,772,896,574,712,75,479,845,169,877,652,634,603,213,37,202,619,422,624,164,887,163,82,326,898,465,878,118,880,410,824,887,564,540,515,807,280,266,115,418,155,509,822,696,575,643,347,314,744,341,983,279,670,724,953,113,68,542,212,336,536,392,804,507,855,887,37,83,160,410,915,730,978,753,330,241,92,535,44,626,807,690,835,551,67,577,844,370,787,254,775,315,431,767,150,183,538,922,558,48,268,508,115,311,828,37,649,604,813,779,789,285,804,212,686,416,959,807,387,24,977,464,230,796,392,776,835,843,246,347,635,359,569,404,349,931,987,100,102,990,754,666,880,250,206,744,23,719,412,467,807,796,312,346,481,210,855,72,489,479,525,611,539,534,995,429,444,676,770,793,12,586,245,131,92,370,382,944,41,627,94,107,731,58,183,226,530,431,283,438,919,697,211,911,748,339,357,797,727,938,619,279,453,360,721,984,428,603,865,277,944,548,42,611,106,557,929,631,525,278,315,891,380,782,998,531,750,106,347,565,953,35,204,114,327,886,508,514,938,229,230,710,4,951,484,269,280,11,613,865,750,185,378,582,948,845,825,16,628,493,371,84,718,127,206,998,783,259,859,970,157,360,452,605,385,404,106,637,783,950,562,735,288,796,371,738,775,334,886,204,188,290,365,75,220,116,513,361,821,793,900,992,825,503,964,446,815,106,279,983,310,970,429,584,258,293,880,903,326,607,704,431,838,167,632,969,82,769,304,800,101,187,319,960,214,208,175,857,82,862,663,13,495,299,731,306,73,869,8,444,87,55,622,118,452,245,280,546,989,762,330,717,471,327,680,998,328,215,681,581,115,39,67,529,835,591,350,559,779,566,513,318,362,914,258,986,520,289,266,477,490,857,185,687,305,343,908,795,404,567,123,102,231,871,670,162,961,266,80,335,702,342,268,517,173,61,544,687,671,335,155,606,810,920,783,52,963,964,921,724,704,953,628,247,650,433,901,144,125,648,888,286,445,379,430,309,723,986,535,464,820,323,987,797,781,721,562,540,664,952,485,500,987,480,72,861,31,922,122,6,674,863,300,755,88,260,50,478,391,626,663,241,66,535,575,344,981,289,759,457,728,848,739,154,733,408,455,356,328,79,410,485,4,554,584,562,63,902,444,21,237,258,532,350,880,257,242,250,676,522,43,816,773,810,300,445,419,34,307,971,925,725,243,177,392,510,35,534,720,925,420,632,328,752,569,835,448,443,346,941,220,209,439,257,311,192,271,141,876,647,479,98,102,694,770,201,181,478,970,451,61,280,836,255,704,712,321,899,200,461,53,181,567,869,909,270,830,351,245,222,771,3,398,948,697,476,944,229,881,382,902,405,834,422,627,899,55,736,196,921,293,933,278,378,471,615,359,62,119,405,583,998,710,503,470,378,498,773,40,240,439,341,785,444,282,619,465,963,206,451,141,517,958,111,855,851,712,105,158,327,423,444,977,841,237,804,605,964,406,617), 304006)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.numberOfSubsequences(822,69,148,353,692,228,730,335,775,94,77,117,605,943,577,520,87,363,995,720,520,785,994,439,111,903,222,94,482,958,679,117,610,55,580,746,105,175,249,612,834,766,624,615,128,536,756,419,455,18,89,44,281,132,626,68,25,603,229,10,832,158,658,628,590,571,150,606,818,274,106,396,921,502,717,95,680,386,536,307,866,864,268,429,476,826,527,845,148,450,1,947,80,680,474,188,904,92,645,218,838,576,331,145,69,894,716,235,346,399,661,571,430,853,539,713,466,345,616,963,292,16,371,334,464,550,614,709,899,288,793,186,428,129,617,166,391,901,318,674,431,750,546,499,4,487,809,325,620,371,891,393,118,665,602,511,285,225,186,450,866,320,381,203,155,276,353,35,392,243,885,783,511,660,88,161,377,183,135,114,148,661,951,490,705,728,275,754,944,506,226,331,90,194,11,792,253,369,486,193,262,647,988,713,925,876,796,836,832,692,543,808,918,512,661,110,225,597,877,681,238,213,343,987,986,397,550,649,41,884,791,214,124,796,70,484,709,901,63,415,769,360,702,21,547,929,399,863,394,250,846,810,976,648,970,889,402,44,373,927,686,109,558,310,61,919,519,952,910,980,874,747,315,423,482,623,612,507,863,757,624,378,867,618,567,714,721,123,308,420,467,977,736,239,674,16,694,353,506,802,604,301,344,656,525,149,175,748,280,46,841,438,723,67,680,790,969,455,133,745,882,29,578,480,51,841,527,345,261,597,469,447,586,874,211,827,65,772,258,37,612,441,691,726,337,137,414,147,427,398,219,28,46,508,642,144,139,813,411,88,302,970,960,51,337,795,203,665,298,387,218,490,984,532,57,800,664,703,654,689,697,150,988,188,302,20,40,395,553,343,381,225,550,359,619,283,921,92,766,765,687,28,862,750,516,963,569,962,259,934,655,751,443,983,154,758,28,339,502,104,471,829,694,339,396,159,830,470,196,530,673,246,9,496,338,565,427,111,406,878,985,616,392,522,851,721,119,287,324,807,178,262,187,437,464,697,658,785,953,297,239,136,873,324,146,527,85,451,722,985,121,479,292,570,134,23,606,838,160,72,683,133,69,793,364,430,442,355,663,92,851,168,967,909,311,687,37,29,780,48,530,765,580,828,93,5,48,758,819,884,221,309,446,868,984,701,945,119,747,200,84,544,326,376,521,883,681,923,615,394,916,68,568,999,40,839,84,422,617,5,686,444,740,181,542,744,270,437,134,769,781,312,928,889,115,119,446,533,677,968,404,539,598,802,140,761,592,114,604,719,585,21,973,679,572,9,857,168,779,298,363,770,346,887,852,909,799,549,566,985,300,681,873,815,290,801,837,167,95,552,126,561,688,828,324,444,400,100,741,61,465,187,244,750,75,157,868,405,379,846,552,921,671,685,731,272,542,692,971,835,130,284,670,272,30,371,533,119,480,910,986,365,501,393,692,764,913,768,562,105,154,94,169,241,732,964,928,949,639,653,116,575,866,81,393,347,319,467,936,178,901,968,674,594,10,453,766,965,975,825,781,809,253,535,334,624,480,537,479,303,507,116,263,614,536,800,95,875,739,142,459,219,525,184,256,367,614,476,890,389,662,169,207,898,4,540,710,303,720,235,172,123,264,672,437,547,55,178,859,160,633,756,245,808,281,592,763,115,35,977,437,105,21,764,500,819,634,717,822,427,362,452,944,601,578,971,141,598,85,474,797,416,506,742,945,449,398,506,495,130,583,693,37,287,745,634,794,324,323,76,576,45,788,39,78,363,837,455,38,502,964,356,236,243,268,920,59,620,797,137,930,824,613,640,634,331,75,20,424,49,896,203), 136000)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.numberOfSubsequences(554,726,312,607,51,859,471,711,782,273,563,447,595,68,522,591,530,710,800,633,301,935,931,485,267,163,231,612,814,618,257,11,270,349,938,919,253,938,143,449,236,484,979,569,823,26,473,709,981,310,937,582,642,117,885,794,125,36,853,692,452,539,901,551,999,127,913,532,68,987,201,8,998,141,401,438,759,19,552,698,530,686,514,167,294,285,514,852,299,548,418,565,284,864,736,338,778,614,278,464,327,391,527,887,581,439,91,811,656,136,949,888,820,268,393,470,946,517,276,521,893,906,270,336,13,444,57,328), 46)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.numberOfSubsequences(215,54,712,806,815,931,923,410,409,583,701,928,557,254,940,891,722,78,493,995,333,587,387,549,948,907,514,267,766,93,163,74,764,732,322,240,461,289,324,78,915,172,71,87,344,43,573,944,470,801,78,894,990,5,426,748,366,349,983,556,673,996,176,747,800,57,516,834,114,940,577,237,906,535,698,615,334,155,382,119,786,950,266,785,824,83,457,493,38,234,294,623,71,960,777,555,280,143,199,850,870,394,724,921,79,626,595,369,606,442,260,165,800,882,913,456,880,370,179,623,553,537,494,900,280,524,526,121,671,222,962,875,962,562,774,223,87,100,164,465,745,985,902,143,9,358,898,12,500,199,404,179,425,482,819,38,271,252,644,225,290,694,658,206,615,212,490,472,636,8,51,966,169,946,749,798,107,210,998,291,334,495,447,36,528,415,369,13,497,868,880,144,503,319,559,878,974,62,766,556,402,452,968,659,737,416,405,777,73,162,762,95,988,155,254,153,415,858,152,570,158,948,700,654,941,895,137,786,546,436,151,394,765,445,980,198,652,557,81,810,183,116,924,699,489,313,825,934,240,555,706,808,616,639,11,143,199,925,741,690,307,161,983,655,632,724,507,614,652,706,313,554,598,458,566,603,434,331,695,770,690,706,254,725,681,250,89,286,860,885,276,166,639,404,475,438,1000,354,529,68,581,507,433,156,180,506,585,162,959,391,762,399,112,3,260,364,523,325,443,336,966,23,332,19,216,84,999,846,522,906,7,898,953,244,600,642,648,390,973,209,438,829,433,807,196,978,168,512,218,835,735,307,120,880,739,219,41,446,750,619,850,140,243,275,353,798,611,896,449,593,997,748,384,881,443,902,769,641,719,535,591,948,592,691,266,62,996,334,460,223,103,413,392,49,648,881,643,225,722,658,257,803,655,285,243,5,311,248,430,895,350,610,222,991,952,891,596,130,418,697,211,33,135,128,955,836,625,490,258,841,99,355,753,810,607,510,679,639,911,404,603,680,247,10,509,503,813,678,346,63,647,522,885,48,492,91,990,935,569,766,329,504,336,41,672,491,357,856,328,894,625,662,821,591,240,13,997,836,259,231,970,943,655,402,643,379,201,702,233,637,323,650,738,411,709,196,638,723,334,737,518,35,713,525,866,18,171,292,272,427,195,670,704,724,608,57,867,304,94,826,401,197,854,439,451,981,108,999,364,104,251,557,900,155,253,415,971,389,64,363,442,496,369,657,985,269,866,57,532,678,786,584,564,663,585,164,422,940,330,401,855,45,287,928,456,667,551,921,252,411,968,372,715,420,21,572,373,499,528,163,519,274,628,365,937,433,912,580,253,56,933,741,134,510,394,54,352,531,408,606,523,55,564,461,690,398,245,813,819,130,721,452,624,555,216,988,992,483,566,687,548,367,786,15,672,889,869,317,618,571,131,525,386,137,328,843,612,336,644,548,604,41,663,241,776,232,668,596,65,772,98,59,12,877,502,58,900,519,943,220,476,111,476,418,860,643,759,754,408,808,1000,626,383,675,455,268,268,571,915,132,192,573,274,720,872,819,369,497,143,109,438,264,750,944,39,496,274,295,84,359,465,605,133,915,906,682,541,134,76,51,823,425,490,653,656,745,428,289,387,755,937,513,578,480,429,706,82,740,404,1,248,392,209,106,575,590,128,253,559,481,134,452,513,858,310,511,812,142,730,694,144,431,209,420,759,91,257,549,794,39,508,559,713,38,778,507,200,17,95,462,186,873,616,409,635,97,200,91,375,815,625,544,874,306,788,64,942,626,719,266,881,828,233,201,8,547,394,720,314,628,885,538,602,94,616,4,188,873,901,695,287,953,469,787,65,76,132,937,908,455,551,404,850,762,670,56,371,161,412,671,740,60,908,846,549,56,280,940,417,839,732,77,646,831,771,426,102,775,509,795,910,701,151,520,79,771,771,155,945,436,612,68,606,164,806,20,423,561,814,885,121,501,199,704,467,895,412,549,853,180,204,322,555,748,750,711,809,362,861,413,417,880,709,767,161,566,370,673,478,240,204,189,698,496,92,433,415,765,525,945,858,420,198,562,216,722,434,859,231,8,935,499,672,857,39,381,707,265,286,976,613,119,763,913,381,349,595), 254317)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.numberOfSubsequences(902,905,731,604,350,252,535,709,601,399,372,843,927,576,311,428,736,323,378,22,263,568,181,422,512,577,275,175,283,701,861,518,290,624,123,727,284,880,759,817,504,258,720,188,349,516,202,492,663,233,391,33,311,643,259,162,208,726,241,388,89,327,134,631,433,144,574,12,600,447,138,13,908,84,48,529,853,747,13,227,127,721,832,399,949,360,331,538,153,534,378,943,800,221,535,821,355,332,794,576,887,827,29,895,381,658,155,646,999,798,543,300,92,479,577,23,194,956,323,2,548,592,317,693,908,241,366,688,378,307,124,749,446,585,390,140,238,231,324,79,522,880,623,950,234,695,404,937,461,28,483,572,636,980,267,99,720,947,581,584,635,762,547,305,715,223,338,33,891,754,358,858,473,807,396,604,255,746,547,830,20,727,83,448,760,943,16,714,371,994,704,549,41,391,403,70,299,414,462,575,897,99,602,623,340,599,605,741,195,193,978,927,80,509,626,912,704,705,360,134,299,40,511,1000,519,44,886,529,963,1000,973,618,579,632,624,2,151,54,525,418,26,545,917,653,648,776,389,867,315,542,760,54,891,334,937,617,747,646,481,43,514,63,887,219,464,746,817,804,427,927,815,545,738,478,491,648,704,422,237,136,854,612,760,643,80,760,560,606,961,474,372,396,622,752,559,564,236,261,306,642,902,554,874,185,229,870,945,64,392,723,138,911,105,161,565,202,33,907,708,32,33,79,671,811,696,955,475,459,703,748,855,491,224,828,117,777,153,175,745,233,559,131,971,516,908,256,59,192,225,279,950,944,358,835,741,928,42,868,594,462,848,722,316,943,895,742,379,623,613,132,779,641,831,556,609,216,716,964,200,614,627,684,676,209,505,454,25,157,65,153,713,74,781,804,646,863,30,841,702,498,709,677,280,992,920,914,978,122,69,732,152,945,471,156,391,935,391,859,117,105,3,623,156,440,209,242,604,541,556,700,258,756,845,763,190,296,114,363,684,254,310,549,58,829,983,923,193,727,834,253,303,907,18,89,939,463,62,773,408,472,838,721,277,108,68,413,825,15,365,546,484,165,97,474,799,963,922,867,704,192,980,300,997,248,29,474,237,60,239,462,882,29,779,277,926,941,534,550,417,859,768,658,939,32,659,402,610,488,979,298,945,271,286,739,433,69,901,979,725,239,308,502,397,692,745,720,95,241,952,604,537,473,450,136,946,82,238,535,33,653,393,13,105,937,407,217,578,774,486,567,23,148,137,238,599,921,638,827,327,63,705,550,920,504,471,469,953,363,39,816,729,907,547,961,937,842,94,488,687,15,471,197,390,207,843,618,256,204,530,997,963,919,661,590,322,40,165,753,985,677,911,248,609,941,86,934,512,745,279,180,503,352,688,537,702,788,818,672,733,419,914,906,624,968,269,420,221,838,435,108,732,274,200,65,940,711,98,126,509,838,285,859,607,634,594,282,804,160), 59229)
30
+ }
31
+
32
+ }
count_stepping_numbers_in_range/.DS_Store ADDED
Binary file (6.15 kB). View file
 
count_stepping_numbers_in_range/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 (countSteppingNumbers \"1 \" \"11 \")," 10 (countSteppingNumbers "1" "11"))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (countSteppingNumbers \"90 \" \"101 \")," 2 (countSteppingNumbers "90" "101"))
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
count_stepping_numbers_in_range/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(10, countSteppingNumbers("1", "11"));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(2, countSteppingNumbers("90", "101"));
19
+ }
20
+
21
+ }
count_stepping_numbers_in_range/meta.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2921,
3
+ "name": "count_stepping_numbers_in_range",
4
+ "difficulty": "Hard",
5
+ "link": "https://leetcode.com/problems/count-stepping-numbers-in-range/",
6
+ "date": "1690070400000",
7
+ "task_description": "Given two positive integers `low` and `high` represented as strings, find the count of **stepping numbers** in the inclusive range `[low, high]`. A **stepping number** is an integer such that all of its adjacent digits have an absolute difference of **exactly** `1`. Return _an integer denoting the count of stepping numbers in the inclusive range_ `[low, high]`_. _ Since the answer may be very large, return it **modulo** `109 + 7`. **Note:** A stepping number should not have a leading zero. **Example 1:** ``` **Input:** low = \"1\", high = \"11\" **Output:** 10 **Explanation: **The stepping numbers in the range [1,11] are 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10. There are a total of 10 stepping numbers in the range. Hence, the output is 10. ``` **Example 2:** ``` **Input:** low = \"90\", high = \"101\" **Output:** 2 **Explanation: **The stepping numbers in the range [90,101] are 98 and 101. There are a total of 2 stepping numbers in the range. Hence, the output is 2. ``` **Constraints:** `1 <= int(low) <= int(high) < 10100` `1 <= low.length, high.length <= 100` `low` and `high` consist of only digits. `low` and `high` don't have any leading zeros.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "low = \"1\", high = \"11\"",
12
+ "output": "10 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "low = \"90\", high = \"101\"",
17
+ "output": "2 "
18
+ }
19
+ ],
20
+ "private_test_cases": [],
21
+ "haskell_template": "countSteppingNumbers :: String -> String -> Int\ncountSteppingNumbers low high ",
22
+ "ocaml_template": "let countSteppingNumbers (low: string) (high: string) : int = ",
23
+ "scala_template": "def countSteppingNumbers(low: String,high: String): Int = { \n \n}",
24
+ "java_template": "public static int countSteppingNumbers(String low, String high) {\n\n}",
25
+ "python_template": "class Solution(object):\n def countSteppingNumbers(self, low, high):\n \"\"\"\n :type low: str\n :type high: str\n :rtype: int\n \"\"\"\n "
26
+ }
count_stepping_numbers_in_range/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 10 (countSteppingNumbers "1" "11")
12
+
13
+ let test2 _ = assert_equal 2 (countSteppingNumbers "90" "101")
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for countSteppingNumbers" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
count_stepping_numbers_in_range/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.countSteppingNumbers("1","11"), 10)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.countSteppingNumbers("90","101"), 2)
10
+ }
11
+
12
+ }
count_subarrays_of_length_three_with_a_condition/haskell_tests/Main.hs ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+ countSubarrays :: [Int] -> Int
7
+ countSubarrays nums = undefined
8
+
9
+ --Program end
10
+
11
+ -- Test cases
12
+
13
+ test1 :: Test
14
+ test1 = TestCase (assertEqual "for (countSubarrays [1,2,1,4,1])," 1 (countSubarrays [1,2,1,4,1]))
15
+
16
+ test2 :: Test
17
+ test2 = TestCase (assertEqual "for (countSubarrays [1,1,1])," 0 (countSubarrays [1,1,1]))
18
+
19
+ test3 :: Test
20
+ test3 = TestCase (assertEqual "for (countSubarrays [24, 78, ( -95), 86, 33, 26, 85, ( -52), 5, 92, ( -31), ( -85), 1, ( -62), ( -15), 43, ( -1), 9, 12, ( -89), ( -72), ( -14), 95, 69])," 0 (countSubarrays [24, 78, -95, 86, 33, 26, 85, -52, 5, 92, -31, -85, 1, -62, -15, 43, -1, 9, 12, -89, -72, -14, 95, 69]))
21
+
22
+ test4 :: Test
23
+ test4 = TestCase (assertEqual "for (countSubarrays [-96, ( -49), 76, ( -55), ( -29), 28, ( -65), 9, ( -17), 45, 59, 64, ( -44), 20, ( -23), ( -77), 87, ( -74), ( -49), ( -77), ( -23), 73, ( -65), 22, ( -93), 91, ( -72), ( -24), ( -32), ( -6), ( -15), ( -43), ( -100), 80, 12, ( -56), ( -15), ( -19), ( -52), ( -29), ( -33), 93, 12, ( -34), ( -39), 47, ( -17), 2, ( -26), ( -88), 53, ( -66), 84, 15, 62, ( -60), 98, ( -91), 20, ( -89), ( -13), ( -70), ( -70)])," 0 (countSubarrays [-96, -49, 76, -55, -29, 28, -65, 9, -17, 45, 59, 64, -44, 20, -23, -77, 87, -74, -49, -77, -23, 73, -65, 22, -93, 91, -72, -24, -32, -6, -15, -43, -100, 80, 12, -56, -15, -19, -52, -29, -33, 93, 12, -34, -39, 47, -17, 2, -26, -88, 53, -66, 84, 15, 62, -60, 98, -91, 20, -89, -13, -70, -70]))
24
+
25
+ test5 :: Test
26
+ test5 = TestCase (assertEqual "for (countSubarrays [92, ( -67), ( -52), ( -20), ( -96), ( -5), ( -3), 70, ( -1), ( -5), 71, ( -59), 89, ( -88), ( -57), ( -58), 7, ( -46), 15, ( -19), ( -2), 53, 13, ( -15), ( -48), ( -24), ( -15), ( -5), 67, ( -53), 13, 41, 89, ( -99), ( -19), ( -48), ( -26), 91])," 0 (countSubarrays [92, -67, -52, -20, -96, -5, -3, 70, -1, -5, 71, -59, 89, -88, -57, -58, 7, -46, 15, -19, -2, 53, 13, -15, -48, -24, -15, -5, 67, -53, 13, 41, 89, -99, -19, -48, -26, 91]))
27
+
28
+ test6 :: Test
29
+ test6 = TestCase (assertEqual "for (countSubarrays [-67, 66, 57, 64, 59, ( -47), ( -44), ( -85), ( -78), 63, 27, 89, 46, 50])," 0 (countSubarrays [-67, 66, 57, 64, 59, -47, -44, -85, -78, 63, 27, 89, 46, 50]))
30
+
31
+ test7 :: Test
32
+ test7 = TestCase (assertEqual "for (countSubarrays [35, ( -60), 20, 10, 86, ( -9), 83, ( -26), ( -26), ( -34), ( -98), ( -22), ( -90), 64, 99, 70, 66, ( -31), ( -78), ( -29), ( -63), ( -25), 44, 39, ( -24), 86, 34, 53, 61, 36, 12])," 0 (countSubarrays [35, -60, 20, 10, 86, -9, 83, -26, -26, -34, -98, -22, -90, 64, 99, 70, 66, -31, -78, -29, -63, -25, 44, 39, -24, 86, 34, 53, 61, 36, 12]))
33
+
34
+
35
+ -- Grouping test cases
36
+ tests :: Test
37
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6]
38
+
39
+ -- Running the tests
40
+ main :: IO Counts
41
+ main = runTestTT tests
count_subarrays_of_length_three_with_a_condition/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(1, countSubarrays(Arrays.asList(1,2,1,4,1)));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(0, countSubarrays(Arrays.asList(1,1,1)));
18
+ }
19
+
20
+ }
count_subarrays_of_length_three_with_a_condition/meta.json ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3685,
3
+ "name": "count_subarrays_of_length_three_with_a_condition",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/count-subarrays-of-length-three-with-a-condition/",
6
+ "date": "2024-12-07 00:00:00",
7
+ "task_description": "Given an integer array `nums`, return the number of subarrays of length 3 such that the sum of the first and third numbers equals _exactly_ half of the second number. **Example 1:** **Input:** nums = [1,2,1,4,1] **Output:** 1 **Explanation:** Only the subarray `[1,4,1]` contains exactly 3 elements where the sum of the first and third numbers equals half the middle number. **Example 2:** **Input:** nums = [1,1,1] **Output:** 0 **Explanation:** `[1,1,1]` is the only subarray of length 3. However, its first and third numbers do not add to half the middle number. **Constraints:** `3 <= nums.length <= 100` `-100 <= nums[i] <= 100`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [1,2,1,4,1]",
12
+ "output": "1 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [1,1,1]",
17
+ "output": "0 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 24,
24
+ 78,
25
+ -95,
26
+ 86,
27
+ 33,
28
+ 26,
29
+ 85,
30
+ -52,
31
+ 5,
32
+ 92,
33
+ -31,
34
+ -85,
35
+ 1,
36
+ -62,
37
+ -15,
38
+ 43,
39
+ -1,
40
+ 9,
41
+ 12,
42
+ -89,
43
+ -72,
44
+ -14,
45
+ 95,
46
+ 69
47
+ ],
48
+ "output": 0
49
+ },
50
+ {
51
+ "input": [
52
+ -96,
53
+ -49,
54
+ 76,
55
+ -55,
56
+ -29,
57
+ 28,
58
+ -65,
59
+ 9,
60
+ -17,
61
+ 45,
62
+ 59,
63
+ 64,
64
+ -44,
65
+ 20,
66
+ -23,
67
+ -77,
68
+ 87,
69
+ -74,
70
+ -49,
71
+ -77,
72
+ -23,
73
+ 73,
74
+ -65,
75
+ 22,
76
+ -93,
77
+ 91,
78
+ -72,
79
+ -24,
80
+ -32,
81
+ -6,
82
+ -15,
83
+ -43,
84
+ -100,
85
+ 80,
86
+ 12,
87
+ -56,
88
+ -15,
89
+ -19,
90
+ -52,
91
+ -29,
92
+ -33,
93
+ 93,
94
+ 12,
95
+ -34,
96
+ -39,
97
+ 47,
98
+ -17,
99
+ 2,
100
+ -26,
101
+ -88,
102
+ 53,
103
+ -66,
104
+ 84,
105
+ 15,
106
+ 62,
107
+ -60,
108
+ 98,
109
+ -91,
110
+ 20,
111
+ -89,
112
+ -13,
113
+ -70,
114
+ -70
115
+ ],
116
+ "output": 0
117
+ },
118
+ {
119
+ "input": [
120
+ 92,
121
+ -67,
122
+ -52,
123
+ -20,
124
+ -96,
125
+ -5,
126
+ -3,
127
+ 70,
128
+ -1,
129
+ -5,
130
+ 71,
131
+ -59,
132
+ 89,
133
+ -88,
134
+ -57,
135
+ -58,
136
+ 7,
137
+ -46,
138
+ 15,
139
+ -19,
140
+ -2,
141
+ 53,
142
+ 13,
143
+ -15,
144
+ -48,
145
+ -24,
146
+ -15,
147
+ -5,
148
+ 67,
149
+ -53,
150
+ 13,
151
+ 41,
152
+ 89,
153
+ -99,
154
+ -19,
155
+ -48,
156
+ -26,
157
+ 91
158
+ ],
159
+ "output": 0
160
+ },
161
+ {
162
+ "input": [
163
+ -67,
164
+ 66,
165
+ 57,
166
+ 64,
167
+ 59,
168
+ -47,
169
+ -44,
170
+ -85,
171
+ -78,
172
+ 63,
173
+ 27,
174
+ 89,
175
+ 46,
176
+ 50
177
+ ],
178
+ "output": 0
179
+ },
180
+ {
181
+ "input": [
182
+ 35,
183
+ -60,
184
+ 20,
185
+ 10,
186
+ 86,
187
+ -9,
188
+ 83,
189
+ -26,
190
+ -26,
191
+ -34,
192
+ -98,
193
+ -22,
194
+ -90,
195
+ 64,
196
+ 99,
197
+ 70,
198
+ 66,
199
+ -31,
200
+ -78,
201
+ -29,
202
+ -63,
203
+ -25,
204
+ 44,
205
+ 39,
206
+ -24,
207
+ 86,
208
+ 34,
209
+ 53,
210
+ 61,
211
+ 36,
212
+ 12
213
+ ],
214
+ "output": 0
215
+ }
216
+ ],
217
+ "haskell_template": "countSubarrays :: [Int] -> Int\ncountSubarrays nums ",
218
+ "ocaml_template": "let countSubarrays (nums: int list) : int = ",
219
+ "scala_template": "def countSubarrays(nums: List[Int]): Int = { \n \n}",
220
+ "java_template": "class Solution {\n public int countSubarrays(int[] nums) {\n \n }\n}",
221
+ "python_template": "class Solution(object):\n def countSubarrays(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n "
222
+ }
count_subarrays_of_length_three_with_a_condition/ocaml_tests/main.ml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let countSubarrays (nums: int list) : int = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal 1 (countSubarrays [1;2;1;4;1])
13
+
14
+ let test2 _ = assert_equal 0 (countSubarrays [1;1;1])
15
+
16
+ let test3 _ = assert_equal 0 (countSubarrays [24; 78; -95; 86; 33; 26; 85; -52; 5; 92; -31; -85; 1; -62; -15; 43; -1; 9; 12; -89; -72; -14; 95; 69])
17
+
18
+ let test4 _ = assert_equal 0 (countSubarrays [-96; -49; 76; -55; -29; 28; -65; 9; -17; 45; 59; 64; -44; 20; -23; -77; 87; -74; -49; -77; -23; 73; -65; 22; -93; 91; -72; -24; -32; -6; -15; -43; -100; 80; 12; -56; -15; -19; -52; -29; -33; 93; 12; -34; -39; 47; -17; 2; -26; -88; 53; -66; 84; 15; 62; -60; 98; -91; 20; -89; -13; -70; -70])
19
+
20
+ let test5 _ = assert_equal 0 (countSubarrays [92; -67; -52; -20; -96; -5; -3; 70; -1; -5; 71; -59; 89; -88; -57; -58; 7; -46; 15; -19; -2; 53; 13; -15; -48; -24; -15; -5; 67; -53; 13; 41; 89; -99; -19; -48; -26; 91])
21
+
22
+ let test6 _ = assert_equal 0 (countSubarrays [-67; 66; 57; 64; 59; -47; -44; -85; -78; 63; 27; 89; 46; 50])
23
+
24
+ let test7 _ = assert_equal 0 (countSubarrays [35; -60; 20; 10; 86; -9; 83; -26; -26; -34; -98; -22; -90; 64; 99; 70; 66; -31; -78; -29; -63; -25; 44; 39; -24; 86; 34; 53; 61; 36; 12])
25
+
26
+
27
+ (* Grouping test cases *)
28
+ let suite = "Test Suite for countSubarrays" >::: [
29
+
30
+ "test1" >:: test1;
31
+ "test2" >:: test2;
32
+ "test3" >:: test3;
33
+ "test4" >:: test4;
34
+ "test5" >:: test5;
35
+ "test6" >:: test6;
36
+ "test7" >:: test7;
37
+ ]
38
+
39
+
40
+ (* Running the tests *)
41
+ let () = run_test_tt_main suite
42
+ end
count_subarrays_of_length_three_with_a_condition/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.countSubarrays(List(1,2,1,4,1)), 1)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.countSubarrays(List(1,1,1)), 0)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.countSubarrays(24,78,-95,86,33,26,85,-52,5,92,-31,-85,1,-62,-15,43,-1,9,12,-89,-72,-14,95,69), 0)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.countSubarrays(-96,-49,76,-55,-29,28,-65,9,-17,45,59,64,-44,20,-23,-77,87,-74,-49,-77,-23,73,-65,22,-93,91,-72,-24,-32,-6,-15,-43,-100,80,12,-56,-15,-19,-52,-29,-33,93,12,-34,-39,47,-17,2,-26,-88,53,-66,84,15,62,-60,98,-91,20,-89,-13,-70,-70), 0)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.countSubarrays(92,-67,-52,-20,-96,-5,-3,70,-1,-5,71,-59,89,-88,-57,-58,7,-46,15,-19,-2,53,13,-15,-48,-24,-15,-5,67,-53,13,41,89,-99,-19,-48,-26,91), 0)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.countSubarrays(-67,66,57,64,59,-47,-44,-85,-78,63,27,89,46,50), 0)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.countSubarrays(35,-60,20,10,86,-9,83,-26,-26,-34,-98,-22,-90,64,99,70,66,-31,-78,-29,-63,-25,44,39,-24,86,34,53,61,36,12), 0)
30
+ }
31
+
32
+ }
count_subarrays_where_max_element_appears_at_least_k_times/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
count_subarrays_where_max_element_appears_at_least_k_times/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, countSubarrays(new ArrayList<>(Arrays.asList(1,3,2,3,3)), 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(0, countSubarrays(new ArrayList<>(Arrays.asList(1,4,2,1)), 3));
19
+ }
20
+
21
+ }
count_subarrays_where_max_element_appears_at_least_k_times/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:973041749c74be9856db636c6276a26d347af84cb4ca6ed3d20ef0aed66c28f3
3
+ size 12068827
count_subarrays_where_max_element_appears_at_least_k_times/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
count_subarrays_where_max_element_appears_at_least_k_times/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
count_subarrays_with_fixed_bounds/.DS_Store ADDED
Binary file (6.15 kB). View file
 
count_subarrays_with_fixed_bounds/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 (countSubarrays [1,3,5,2,7,5] 1 5)," 2 (countSubarrays [1,3,5,2,7,5] 1 5))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (countSubarrays [1,1,1,1] 1 1)," 10 (countSubarrays [1,1,1,1] 1 1))
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
count_subarrays_with_fixed_bounds/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(2, countSubarrays(new ArrayList<>(Arrays.asList(1,3,5,2,7,5)), 1, 5));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(10, countSubarrays(new ArrayList<>(Arrays.asList(1,1,1,1)), 1, 1));
19
+ }
20
+
21
+ }
count_subarrays_with_fixed_bounds/meta.json ADDED
@@ -0,0 +1,658 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2527,
3
+ "name": "count_subarrays_with_fixed_bounds",
4
+ "difficulty": "Hard",
5
+ "link": "https://leetcode.com/problems/count-subarrays-with-fixed-bounds/",
6
+ "date": "1665273600000",
7
+ "task_description": "You are given an integer array `nums` and two integers `minK` and `maxK`. A **fixed-bound subarray** of `nums` is a subarray that satisfies the following conditions: The **minimum** value in the subarray is equal to `minK`. The **maximum** value in the subarray is equal to `maxK`. Return _the **number** of fixed-bound subarrays_. A **subarray** is a **contiguous** part of an array. **Example 1:** ``` **Input:** nums = [1,3,5,2,7,5], minK = 1, maxK = 5 **Output:** 2 **Explanation:** The fixed-bound subarrays are [1,3,5] and [1,3,5,2]. ``` **Example 2:** ``` **Input:** nums = [1,1,1,1], minK = 1, maxK = 1 **Output:** 10 **Explanation:** Every subarray of nums is a fixed-bound subarray. There are 10 possible subarrays. ``` **Constraints:** `2 <= nums.length <= 105` `1 <= nums[i], minK, maxK <= 106`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [1,3,5,2,7,5], minK = 1, maxK = 5",
12
+ "output": "2 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [1,1,1,1], minK = 1, maxK = 1",
17
+ "output": "10 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ [
24
+ 386055,
25
+ 328262,
26
+ 578770,
27
+ 84579,
28
+ 41863,
29
+ 641490,
30
+ 601102,
31
+ 685117,
32
+ 451094,
33
+ 157592,
34
+ 226381,
35
+ 938146,
36
+ 673654,
37
+ 816424,
38
+ 194982,
39
+ 294240,
40
+ 164180,
41
+ 853629,
42
+ 78962,
43
+ 348433,
44
+ 286035,
45
+ 764505,
46
+ 838707,
47
+ 184235,
48
+ 135703,
49
+ 597475,
50
+ 94714,
51
+ 951013,
52
+ 463215,
53
+ 371478,
54
+ 411410,
55
+ 738702,
56
+ 689117,
57
+ 255436,
58
+ 816961,
59
+ 602207,
60
+ 126918,
61
+ 1932,
62
+ 117608,
63
+ 823905,
64
+ 574735,
65
+ 750634,
66
+ 538101,
67
+ 607677
68
+ ],
69
+ 850178,
70
+ 932745
71
+ ],
72
+ "output": 0
73
+ },
74
+ {
75
+ "input": [
76
+ [
77
+ 609792,
78
+ 570514,
79
+ 834538,
80
+ 321561,
81
+ 844707,
82
+ 395259,
83
+ 248623,
84
+ 28899,
85
+ 757527,
86
+ 234418,
87
+ 284955,
88
+ 834090,
89
+ 433148,
90
+ 720816,
91
+ 96886,
92
+ 987961,
93
+ 779993,
94
+ 555810,
95
+ 925741,
96
+ 581642,
97
+ 247164,
98
+ 85187,
99
+ 963810
100
+ ],
101
+ 228547,
102
+ 530353
103
+ ],
104
+ "output": 0
105
+ },
106
+ {
107
+ "input": [
108
+ [
109
+ 733806,
110
+ 458772,
111
+ 402035,
112
+ 761574,
113
+ 322988,
114
+ 259924,
115
+ 17153,
116
+ 19346,
117
+ 848831,
118
+ 371603,
119
+ 244944,
120
+ 583333,
121
+ 198160,
122
+ 901690,
123
+ 459892,
124
+ 37339,
125
+ 317669,
126
+ 462098,
127
+ 922532,
128
+ 127333,
129
+ 624184,
130
+ 952118
131
+ ],
132
+ 515712,
133
+ 814694
134
+ ],
135
+ "output": 0
136
+ },
137
+ {
138
+ "input": [
139
+ [
140
+ 623451,
141
+ 94947,
142
+ 74030,
143
+ 803974,
144
+ 336848,
145
+ 981546,
146
+ 250593,
147
+ 993470,
148
+ 191578,
149
+ 48441,
150
+ 501493,
151
+ 388471,
152
+ 310767,
153
+ 747862,
154
+ 888145,
155
+ 916598,
156
+ 882502,
157
+ 382930,
158
+ 413655,
159
+ 694127,
160
+ 58935,
161
+ 459286,
162
+ 25573,
163
+ 439444,
164
+ 53114,
165
+ 208590,
166
+ 640696,
167
+ 38248,
168
+ 940733,
169
+ 124052,
170
+ 39529,
171
+ 975374,
172
+ 634191,
173
+ 608929,
174
+ 211940,
175
+ 294390,
176
+ 279558,
177
+ 89073,
178
+ 827650,
179
+ 826422,
180
+ 770598,
181
+ 409007,
182
+ 209559,
183
+ 977096,
184
+ 727885,
185
+ 40829,
186
+ 284959,
187
+ 850896,
188
+ 386635,
189
+ 440038,
190
+ 525770,
191
+ 540947,
192
+ 327490,
193
+ 110157,
194
+ 658205,
195
+ 944131,
196
+ 934275,
197
+ 982370,
198
+ 500350,
199
+ 53968,
200
+ 995892,
201
+ 43536,
202
+ 565621,
203
+ 914469,
204
+ 644596,
205
+ 736788,
206
+ 743089,
207
+ 657566,
208
+ 360938,
209
+ 537814,
210
+ 869084,
211
+ 211281,
212
+ 547085,
213
+ 661522,
214
+ 439131,
215
+ 332231,
216
+ 568914,
217
+ 92726
218
+ ],
219
+ 410870,
220
+ 893195
221
+ ],
222
+ "output": 0
223
+ },
224
+ {
225
+ "input": [
226
+ [
227
+ 138662,
228
+ 608236,
229
+ 318934,
230
+ 469861,
231
+ 756184,
232
+ 372630,
233
+ 188358,
234
+ 974703,
235
+ 960814,
236
+ 81235,
237
+ 517631,
238
+ 911337,
239
+ 444499,
240
+ 918570,
241
+ 900584,
242
+ 182499,
243
+ 378450,
244
+ 124649,
245
+ 374013,
246
+ 278946,
247
+ 881508,
248
+ 883358,
249
+ 293915,
250
+ 515216,
251
+ 230952,
252
+ 834886,
253
+ 774304,
254
+ 324040,
255
+ 626037,
256
+ 29295,
257
+ 978065,
258
+ 493309,
259
+ 986867,
260
+ 331847,
261
+ 760207,
262
+ 851215,
263
+ 723365,
264
+ 883148,
265
+ 419712,
266
+ 30558,
267
+ 180168,
268
+ 497171,
269
+ 313045,
270
+ 134411,
271
+ 353159,
272
+ 402233,
273
+ 460280,
274
+ 39904,
275
+ 465524,
276
+ 145703,
277
+ 477073,
278
+ 736502,
279
+ 21202,
280
+ 248652,
281
+ 646868,
282
+ 548986,
283
+ 176099,
284
+ 677740,
285
+ 890981,
286
+ 887484,
287
+ 646032,
288
+ 836826,
289
+ 959779,
290
+ 146011,
291
+ 701208,
292
+ 928092,
293
+ 799338,
294
+ 487477,
295
+ 832695,
296
+ 841160,
297
+ 853623,
298
+ 742250,
299
+ 6196,
300
+ 268882,
301
+ 545571,
302
+ 909806,
303
+ 321861,
304
+ 9810,
305
+ 626048,
306
+ 694043,
307
+ 388142,
308
+ 975761,
309
+ 118005,
310
+ 857287,
311
+ 686600,
312
+ 842193,
313
+ 831046,
314
+ 512542,
315
+ 768295,
316
+ 333475,
317
+ 962098,
318
+ 894062,
319
+ 510315
320
+ ],
321
+ 497651,
322
+ 674030
323
+ ],
324
+ "output": 0
325
+ },
326
+ {
327
+ "input": [
328
+ [
329
+ 983134,
330
+ 890418,
331
+ 587396,
332
+ 943513,
333
+ 425109,
334
+ 876931,
335
+ 754347,
336
+ 990452,
337
+ 561393,
338
+ 809836,
339
+ 24234,
340
+ 585329,
341
+ 202469,
342
+ 199966,
343
+ 984185,
344
+ 465074,
345
+ 423937,
346
+ 945190,
347
+ 588029,
348
+ 126743,
349
+ 611886,
350
+ 444683,
351
+ 82646,
352
+ 767199,
353
+ 453722,
354
+ 389355,
355
+ 360048,
356
+ 710808,
357
+ 962529,
358
+ 946423,
359
+ 438125,
360
+ 908238,
361
+ 349308,
362
+ 721227,
363
+ 645930,
364
+ 554217,
365
+ 472124,
366
+ 986030,
367
+ 877382,
368
+ 740535,
369
+ 202829,
370
+ 640732,
371
+ 843439,
372
+ 764945,
373
+ 457358,
374
+ 630273,
375
+ 827249
376
+ ],
377
+ 439319,
378
+ 474398
379
+ ],
380
+ "output": 0
381
+ },
382
+ {
383
+ "input": [
384
+ [
385
+ 604363,
386
+ 260210,
387
+ 124405,
388
+ 87488,
389
+ 582644,
390
+ 26952,
391
+ 276250,
392
+ 196784,
393
+ 994876,
394
+ 223692,
395
+ 904763,
396
+ 689454,
397
+ 318752,
398
+ 997090,
399
+ 788943,
400
+ 926267,
401
+ 229520,
402
+ 278261,
403
+ 496770,
404
+ 376516,
405
+ 39331,
406
+ 609427,
407
+ 479786,
408
+ 470649,
409
+ 649228,
410
+ 108682,
411
+ 416622,
412
+ 941365,
413
+ 233699,
414
+ 919806,
415
+ 857879,
416
+ 248747,
417
+ 706421,
418
+ 219746,
419
+ 284748,
420
+ 703548,
421
+ 556981,
422
+ 954593,
423
+ 377309,
424
+ 489273,
425
+ 515168,
426
+ 757447,
427
+ 528892,
428
+ 671368,
429
+ 65322,
430
+ 171229,
431
+ 24596,
432
+ 367703,
433
+ 314555,
434
+ 212865,
435
+ 91430
436
+ ],
437
+ 94012,
438
+ 166238
439
+ ],
440
+ "output": 0
441
+ },
442
+ {
443
+ "input": [
444
+ [
445
+ 952415,
446
+ 157755,
447
+ 278643,
448
+ 263222,
449
+ 484889,
450
+ 997235,
451
+ 714755,
452
+ 43439,
453
+ 180460,
454
+ 742327,
455
+ 927054,
456
+ 668967,
457
+ 228293,
458
+ 3589,
459
+ 733227,
460
+ 864553,
461
+ 624427,
462
+ 397639,
463
+ 273372,
464
+ 112630,
465
+ 906738,
466
+ 334990,
467
+ 507007,
468
+ 814765,
469
+ 579768,
470
+ 215278,
471
+ 684611,
472
+ 430868,
473
+ 709478,
474
+ 47497,
475
+ 262649,
476
+ 781242,
477
+ 508445,
478
+ 46742,
479
+ 948801,
480
+ 401717,
481
+ 698850,
482
+ 744156,
483
+ 966599,
484
+ 377098,
485
+ 700988,
486
+ 830391,
487
+ 269079,
488
+ 434126,
489
+ 493284
490
+ ],
491
+ 569627,
492
+ 741395
493
+ ],
494
+ "output": 0
495
+ },
496
+ {
497
+ "input": [
498
+ [
499
+ 360909,
500
+ 828436,
501
+ 400550,
502
+ 594802,
503
+ 197177,
504
+ 26543,
505
+ 645299,
506
+ 847052,
507
+ 100541,
508
+ 809931,
509
+ 887933,
510
+ 674184,
511
+ 584607,
512
+ 770104,
513
+ 84134,
514
+ 60055,
515
+ 264329,
516
+ 571197,
517
+ 942617,
518
+ 108589,
519
+ 558318,
520
+ 487837,
521
+ 520989,
522
+ 868559,
523
+ 175496,
524
+ 759119,
525
+ 129318,
526
+ 431762,
527
+ 797994,
528
+ 638657,
529
+ 884491,
530
+ 254371,
531
+ 864946,
532
+ 392152,
533
+ 481035,
534
+ 426722,
535
+ 563680,
536
+ 3870,
537
+ 410770,
538
+ 668801,
539
+ 83276,
540
+ 803486,
541
+ 685602,
542
+ 671628,
543
+ 397962,
544
+ 748073,
545
+ 803118,
546
+ 888378,
547
+ 816134,
548
+ 996710,
549
+ 359415,
550
+ 654347,
551
+ 400922,
552
+ 384601
553
+ ],
554
+ 142415,
555
+ 862453
556
+ ],
557
+ "output": 0
558
+ },
559
+ {
560
+ "input": [
561
+ [
562
+ 986076,
563
+ 745188,
564
+ 112637,
565
+ 601835,
566
+ 876526,
567
+ 278159,
568
+ 249592,
569
+ 754955,
570
+ 240974,
571
+ 539323,
572
+ 312417,
573
+ 514427,
574
+ 488090,
575
+ 825300,
576
+ 551796,
577
+ 637430,
578
+ 983233,
579
+ 772492,
580
+ 477179,
581
+ 886424,
582
+ 543396,
583
+ 99680,
584
+ 369901,
585
+ 362233,
586
+ 790562,
587
+ 279349,
588
+ 413351,
589
+ 657532,
590
+ 958535,
591
+ 441474,
592
+ 690026,
593
+ 999240,
594
+ 420446,
595
+ 669557,
596
+ 638585,
597
+ 353249,
598
+ 107791,
599
+ 16093,
600
+ 481396,
601
+ 252383,
602
+ 400514,
603
+ 323453,
604
+ 858467,
605
+ 406359,
606
+ 121348,
607
+ 647820,
608
+ 97323,
609
+ 430118,
610
+ 919119,
611
+ 266850,
612
+ 702963,
613
+ 954750,
614
+ 143191,
615
+ 429305,
616
+ 510857,
617
+ 176838,
618
+ 14532,
619
+ 238891,
620
+ 851044,
621
+ 53876,
622
+ 202292,
623
+ 512939,
624
+ 633742,
625
+ 229675,
626
+ 762842,
627
+ 271902,
628
+ 876370,
629
+ 602166,
630
+ 560051,
631
+ 331399,
632
+ 435949,
633
+ 838822,
634
+ 964890,
635
+ 631563,
636
+ 254371,
637
+ 467499,
638
+ 367574,
639
+ 510599,
640
+ 710033,
641
+ 343811,
642
+ 136946,
643
+ 619967,
644
+ 485166,
645
+ 128512
646
+ ],
647
+ 469805,
648
+ 523062
649
+ ],
650
+ "output": 0
651
+ }
652
+ ],
653
+ "haskell_template": "countSubarrays :: [Int] -> Int -> Int -> Int\ncountSubarrays nums minK maxK ",
654
+ "ocaml_template": "let countSubarrays (nums: int list) (minK: int) (maxK: int) : int = ",
655
+ "scala_template": "def countSubarrays(nums: List[Int],minK: Int,maxK: Int): Int = { \n \n}",
656
+ "java_template": "public static int countSubarrays(List<Integer> nums, int minK, int maxK) {\n\n}",
657
+ "python_template": "class Solution(object):\n def countSubarrays(self, nums, minK, maxK):\n \"\"\"\n :type nums: List[int]\n :type minK: int\n :type maxK: int\n :rtype: int\n \"\"\"\n "
658
+ }
count_subarrays_with_fixed_bounds/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 2 (countSubarrays [1;3;5;2;7;5] 1 5)
12
+
13
+ let test2 _ = assert_equal 10 (countSubarrays [1;1;1;1] 1 1)
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for countSubarrays" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
count_subarrays_with_fixed_bounds/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.countSubarrays(List(1,3,5,2,7,5),1,5), 2)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.countSubarrays(List(1,1,1,1),1,1), 10)
10
+ }
11
+
12
+ }
count_subarrays_with_median_k/.DS_Store ADDED
Binary file (6.15 kB). View file
 
count_subarrays_with_median_k/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 (countSubarrays [3,2,1,4,5] 4)," 3 (countSubarrays [3,2,1,4,5] 4))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (countSubarrays [2,3,1] 3)," 1 (countSubarrays [2,3,1] 3))
16
+
17
+
18
+ -- Grouping test cases
19
+ tests :: Test
20
+ tests = TestList [TestLabel "Test1" test1]
21
+
22
+ -- Running the tests
23
+ main :: IO Counts
24
+ main = runTestTT tests
count_subarrays_with_median_k/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, countSubarrays(new ArrayList<>(Arrays.asList(3,2,1,4,5)), 4));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(1, countSubarrays(new ArrayList<>(Arrays.asList(2,3,1)), 3));
19
+ }
20
+
21
+ }
count_subarrays_with_median_k/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
count_subarrays_with_median_k/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 (countSubarrays [3;2;1;4;5] 4)
12
+
13
+ let test2 _ = assert_equal 1 (countSubarrays [2;3;1] 3)
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for countSubarrays" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
count_subarrays_with_median_k/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.countSubarrays(List(3,2,1,4,5),4), 3)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.countSubarrays(List(2,3,1),3), 1)
10
+ }
11
+
12
+ }
count_subarrays_with_score_less_than_k/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
count_subarrays_with_score_less_than_k/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, countSubarrays(new ArrayList<>(Arrays.asList(2,1,4,3,5)), 10));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(5, countSubarrays(new ArrayList<>(Arrays.asList(1,1,1)), 5));
19
+ }
20
+
21
+ }
count_subarrays_with_score_less_than_k/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0b82ed40958acc4e4d8239da84bcbbb9a91e07a5a6e91dc6a716682f6ec9bfdb
3
+ size 14168557
count_subarrays_with_score_less_than_k/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
count_subarrays_with_score_less_than_k/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
count_submatrices_with_equal_frequency_of_x_and_y/haskell_tests/Main.hs ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aa7c2b4910edf3095ab02ff80d01c5e65ffc1dba2c5072b8b79bd1a15b882c59
3
+ size 25614226
count_submatrices_with_equal_frequency_of_x_and_y/java_tests/Main.java ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ public class Main {
7
+ //Program start
8
+
9
+ //Program end
10
+
11
+ @Test
12
+ public void test1() {
13
+ assertEquals(3, numberOfSubmatrices(Arrays.asList(Arrays.asList("X","Y","."),Arrays.asList("Y",".","."))));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(0, numberOfSubmatrices(Arrays.asList(Arrays.asList("X","X"),Arrays.asList("X","Y"))));
18
+ }
19
+ @Test
20
+ public void test3() {
21
+ assertEquals(0, numberOfSubmatrices(Arrays.asList(Arrays.asList(".","."),Arrays.asList(".","."))));
22
+ }
23
+
24
+ }
count_submatrices_with_equal_frequency_of_x_and_y/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e504d21f63d0528b1ceab153a92cab389e7c1006dc7c8f9c918bb3a4e036d51e
3
+ size 45816944