DatasetRepo commited on
Commit
e1192c8
·
verified ·
1 Parent(s): 7ad5bfe

b9c481a4de7aa7344a9ec7ea15860d8d933968e818d73288eec73b5626778aa3

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 +1 -0
  2. sum_of_squares_of_special_elements/meta.json +334 -0
  3. sum_of_squares_of_special_elements/ocaml_tests/main.ml +26 -0
  4. sum_of_squares_of_special_elements/scala_tests/MySuite.scala +12 -0
  5. sum_of_total_strength_of_wizards/haskell_tests/Main.hs +0 -0
  6. sum_of_total_strength_of_wizards/java_tests/Main.java +20 -0
  7. sum_of_total_strength_of_wizards/meta.json +0 -0
  8. sum_of_total_strength_of_wizards/ocaml_tests/main.ml +0 -0
  9. sum_of_total_strength_of_wizards/scala_tests/MySuite.scala +0 -0
  10. sum_of_values_at_indices_with_k_set_bits/haskell_tests/Main.hs +45 -0
  11. sum_of_values_at_indices_with_k_set_bits/java_tests/Main.java +21 -0
  12. sum_of_values_at_indices_with_k_set_bits/meta.json +0 -0
  13. sum_of_values_at_indices_with_k_set_bits/ocaml_tests/main.ml +50 -0
  14. sum_of_values_at_indices_with_k_set_bits/scala_tests/MySuite.scala +44 -0
  15. sum_of_variable_length_subarrays/haskell_tests/Main.hs +41 -0
  16. sum_of_variable_length_subarrays/java_tests/Main.java +20 -0
  17. sum_of_variable_length_subarrays/meta.json +265 -0
  18. sum_of_variable_length_subarrays/ocaml_tests/main.ml +42 -0
  19. sum_of_variable_length_subarrays/scala_tests/MySuite.scala +32 -0
  20. take_gifts_from_the_richest_pile/.DS_Store +0 -0
  21. take_gifts_from_the_richest_pile/haskell_tests/Main.hs +24 -0
  22. take_gifts_from_the_richest_pile/java_tests/Main.java +21 -0
  23. take_gifts_from_the_richest_pile/meta.json +0 -0
  24. take_gifts_from_the_richest_pile/ocaml_tests/main.ml +26 -0
  25. take_gifts_from_the_richest_pile/scala_tests/MySuite.scala +12 -0
  26. take_k_of_each_character_from_left_and_right/.DS_Store +0 -0
  27. take_k_of_each_character_from_left_and_right/haskell_tests/Main.hs +24 -0
  28. take_k_of_each_character_from_left_and_right/java_tests/Main.java +21 -0
  29. take_k_of_each_character_from_left_and_right/meta.json +0 -0
  30. take_k_of_each_character_from_left_and_right/ocaml_tests/main.ml +26 -0
  31. take_k_of_each_character_from_left_and_right/scala_tests/MySuite.scala +12 -0
  32. taking_maximum_energy_from_the_mystic_dungeon/java_tests/Main.java +21 -0
  33. task_scheduler_ii/.DS_Store +0 -0
  34. task_scheduler_ii/haskell_tests/Main.hs +24 -0
  35. task_scheduler_ii/java_tests/Main.java +21 -0
  36. task_scheduler_ii/meta.json +3 -0
  37. task_scheduler_ii/ocaml_tests/main.ml +26 -0
  38. task_scheduler_ii/scala_tests/MySuite.scala +12 -0
  39. the_latest_time_to_catch_a_bus/.DS_Store +0 -0
  40. the_latest_time_to_catch_a_bus/haskell_tests/Main.hs +24 -0
  41. the_latest_time_to_catch_a_bus/java_tests/Main.java +21 -0
  42. the_latest_time_to_catch_a_bus/meta.json +1316 -0
  43. the_latest_time_to_catch_a_bus/ocaml_tests/main.ml +26 -0
  44. the_latest_time_to_catch_a_bus/scala_tests/MySuite.scala +12 -0
  45. the_number_of_beautiful_subsets/.DS_Store +0 -0
  46. the_number_of_beautiful_subsets/haskell_tests/Main.hs +24 -0
  47. the_number_of_beautiful_subsets/java_tests/Main.java +21 -0
  48. the_number_of_beautiful_subsets/meta.json +26 -0
  49. the_number_of_beautiful_subsets/ocaml_tests/main.ml +26 -0
  50. the_number_of_beautiful_subsets/scala_tests/MySuite.scala +12 -0
.gitattributes CHANGED
@@ -286,3 +286,4 @@ substring_xor_queries/meta.json filter=lfs diff=lfs merge=lfs -text
286
  successful_pairs_of_spells_and_potions/meta.json filter=lfs diff=lfs merge=lfs -text
287
  sum_of_distances/meta.json filter=lfs diff=lfs merge=lfs -text
288
  sum_of_matrix_after_queries/meta.json filter=lfs diff=lfs merge=lfs -text
 
 
286
  successful_pairs_of_spells_and_potions/meta.json filter=lfs diff=lfs merge=lfs -text
287
  sum_of_distances/meta.json filter=lfs diff=lfs merge=lfs -text
288
  sum_of_matrix_after_queries/meta.json filter=lfs diff=lfs merge=lfs -text
289
+ task_scheduler_ii/meta.json filter=lfs diff=lfs merge=lfs -text
sum_of_squares_of_special_elements/meta.json ADDED
@@ -0,0 +1,334 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2844,
3
+ "name": "sum_of_squares_of_special_elements",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/sum-of-squares-of-special-elements/",
6
+ "date": "1688860800000",
7
+ "task_description": "You are given a **1-indexed** integer array `nums` of length `n`. An element `nums[i]` of `nums` is called **special** if `i` divides `n`, i.e. `n % i == 0`. Return _the **sum of the squares** of all **special** elements of _`nums`. **Example 1:** ``` **Input:** nums = [1,2,3,4] **Output:** 21 **Explanation:** There are exactly 3 special elements in nums: nums[1] since 1 divides 4, nums[2] since 2 divides 4, and nums[4] since 4 divides 4. Hence, the sum of the squares of all special elements of nums is nums[1] * nums[1] + nums[2] * nums[2] + nums[4] * nums[4] = 1 * 1 + 2 * 2 + 4 * 4 = 21. ``` **Example 2:** ``` **Input:** nums = [2,7,1,19,18,3] **Output:** 63 **Explanation:** There are exactly 4 special elements in nums: nums[1] since 1 divides 6, nums[2] since 2 divides 6, nums[3] since 3 divides 6, and nums[6] since 6 divides 6. Hence, the sum of the squares of all special elements of nums is nums[1] * nums[1] + nums[2] * nums[2] + nums[3] * nums[3] + nums[6] * nums[6] = 2 * 2 + 7 * 7 + 1 * 1 + 3 * 3 = 63. ``` **Constraints:** `1 <= nums.length == n <= 50` `1 <= nums[i] <= 50`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [1,2,3,4]",
12
+ "output": "21 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [2,7,1,19,18,3]",
17
+ "output": "63 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 3,
24
+ 25,
25
+ 45,
26
+ 13,
27
+ 3,
28
+ 7,
29
+ 46,
30
+ 46,
31
+ 21,
32
+ 41,
33
+ 46,
34
+ 1,
35
+ 37,
36
+ 9,
37
+ 12,
38
+ 2,
39
+ 8,
40
+ 14,
41
+ 27,
42
+ 18,
43
+ 45,
44
+ 12,
45
+ 3,
46
+ 43,
47
+ 15,
48
+ 10,
49
+ 31,
50
+ 19
51
+ ],
52
+ "output": 3361
53
+ },
54
+ {
55
+ "input": [
56
+ 6,
57
+ 49,
58
+ 20,
59
+ 5,
60
+ 24,
61
+ 13,
62
+ 15,
63
+ 7,
64
+ 36,
65
+ 40,
66
+ 26,
67
+ 9,
68
+ 24,
69
+ 4,
70
+ 1,
71
+ 13,
72
+ 29,
73
+ 7,
74
+ 4,
75
+ 20,
76
+ 16
77
+ ],
78
+ "output": 917
79
+ },
80
+ {
81
+ "input": [
82
+ 37,
83
+ 10,
84
+ 33,
85
+ 29,
86
+ 45,
87
+ 15,
88
+ 10,
89
+ 35,
90
+ 33,
91
+ 34,
92
+ 29,
93
+ 9,
94
+ 47,
95
+ 35,
96
+ 4,
97
+ 35,
98
+ 20,
99
+ 2,
100
+ 4,
101
+ 22,
102
+ 11,
103
+ 44,
104
+ 7,
105
+ 45,
106
+ 7,
107
+ 14,
108
+ 12,
109
+ 44,
110
+ 4,
111
+ 43,
112
+ 1,
113
+ 2
114
+ ],
115
+ "output": 4764
116
+ },
117
+ {
118
+ "input": [
119
+ 46,
120
+ 15,
121
+ 4,
122
+ 35,
123
+ 11,
124
+ 22,
125
+ 29,
126
+ 25,
127
+ 46,
128
+ 18,
129
+ 19,
130
+ 19,
131
+ 26,
132
+ 43,
133
+ 10,
134
+ 22,
135
+ 24,
136
+ 46,
137
+ 8,
138
+ 38,
139
+ 25,
140
+ 8,
141
+ 30,
142
+ 27,
143
+ 49,
144
+ 15,
145
+ 14,
146
+ 42,
147
+ 6,
148
+ 24,
149
+ 39,
150
+ 28
151
+ ],
152
+ "output": 5459
153
+ },
154
+ {
155
+ "input": [
156
+ 38,
157
+ 3,
158
+ 3,
159
+ 18,
160
+ 40,
161
+ 47,
162
+ 24,
163
+ 21,
164
+ 19
165
+ ],
166
+ "output": 1814
167
+ },
168
+ {
169
+ "input": [
170
+ 28,
171
+ 41,
172
+ 36,
173
+ 49,
174
+ 30,
175
+ 41,
176
+ 50,
177
+ 10,
178
+ 12,
179
+ 31,
180
+ 43,
181
+ 1,
182
+ 39,
183
+ 20,
184
+ 28,
185
+ 22,
186
+ 15,
187
+ 2,
188
+ 1,
189
+ 42,
190
+ 21,
191
+ 17,
192
+ 6,
193
+ 34,
194
+ 47,
195
+ 50,
196
+ 5,
197
+ 7,
198
+ 41,
199
+ 40,
200
+ 12,
201
+ 7,
202
+ 22,
203
+ 9,
204
+ 14,
205
+ 20,
206
+ 50
207
+ ],
208
+ "output": 3284
209
+ },
210
+ {
211
+ "input": [
212
+ 7,
213
+ 1,
214
+ 3,
215
+ 5,
216
+ 41,
217
+ 30,
218
+ 12,
219
+ 3,
220
+ 11,
221
+ 20,
222
+ 35,
223
+ 37,
224
+ 12,
225
+ 25,
226
+ 18,
227
+ 6,
228
+ 1,
229
+ 46,
230
+ 8,
231
+ 48,
232
+ 4,
233
+ 16,
234
+ 28,
235
+ 9,
236
+ 28,
237
+ 45,
238
+ 28,
239
+ 12,
240
+ 46,
241
+ 6,
242
+ 29,
243
+ 15,
244
+ 17,
245
+ 41,
246
+ 27,
247
+ 33,
248
+ 36,
249
+ 21
250
+ ],
251
+ "output": 555
252
+ },
253
+ {
254
+ "input": [
255
+ 7,
256
+ 3,
257
+ 28,
258
+ 3,
259
+ 49,
260
+ 36,
261
+ 45,
262
+ 16,
263
+ 24,
264
+ 23,
265
+ 35,
266
+ 36,
267
+ 50,
268
+ 10,
269
+ 25,
270
+ 7,
271
+ 41,
272
+ 47,
273
+ 40,
274
+ 20,
275
+ 28,
276
+ 38,
277
+ 44,
278
+ 2,
279
+ 19,
280
+ 18,
281
+ 43,
282
+ 22
283
+ ],
284
+ "output": 2676
285
+ },
286
+ {
287
+ "input": [
288
+ 41,
289
+ 5,
290
+ 33,
291
+ 41,
292
+ 3,
293
+ 41,
294
+ 47
295
+ ],
296
+ "output": 3890
297
+ },
298
+ {
299
+ "input": [
300
+ 7,
301
+ 6,
302
+ 15,
303
+ 2,
304
+ 33,
305
+ 21,
306
+ 41,
307
+ 18,
308
+ 42,
309
+ 34,
310
+ 49,
311
+ 46,
312
+ 20,
313
+ 42,
314
+ 4,
315
+ 23,
316
+ 6,
317
+ 26,
318
+ 17,
319
+ 42,
320
+ 3,
321
+ 33,
322
+ 50,
323
+ 14,
324
+ 10
325
+ ],
326
+ "output": 1238
327
+ }
328
+ ],
329
+ "haskell_template": "sumOfSquares :: [Int] -> Int\nsumOfSquares nums ",
330
+ "ocaml_template": "let sumOfSquares (nums: int list) : int = ",
331
+ "scala_template": "def sumOfSquares(nums: List[Int]): Int = { \n \n}",
332
+ "java_template": "public static int sumOfSquares(List<Integer> nums) {\n\n}",
333
+ "python_template": "class Solution(object):\n def sumOfSquares(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n "
334
+ }
sum_of_squares_of_special_elements/ocaml_tests/main.ml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal 21 (sumOfSquares [1;2;3;4])
12
+
13
+ let test2 _ = assert_equal 63 (sumOfSquares [2;7;1;19;18;3])
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for sumOfSquares" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
sum_of_squares_of_special_elements/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.sumOfSquares(List(1,2,3,4)), 21)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.sumOfSquares(List(2,7,1,19,18,3)), 63)
10
+ }
11
+
12
+ }
sum_of_total_strength_of_wizards/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
sum_of_total_strength_of_wizards/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(44, totalStrength(Arrays.asList(1,3,1,2)));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(213, totalStrength(Arrays.asList(5,4,6)));
18
+ }
19
+
20
+ }
sum_of_total_strength_of_wizards/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
sum_of_total_strength_of_wizards/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
sum_of_total_strength_of_wizards/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
sum_of_values_at_indices_with_k_set_bits/haskell_tests/Main.hs ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (sumIndicesWithKSetBits [5,10,1,5,2] 1)," 13 (sumIndicesWithKSetBits [5,10,1,5,2] 1))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (sumIndicesWithKSetBits [4,3,2,1] 2)," 1 (sumIndicesWithKSetBits [4,3,2,1] 2))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (sumIndicesWithKSetBits [68106, 38537, 64713, 74318, 6006, 46213, 18015, 47880, 62297, 41588, 65477, 39949, 62895, 44985, 65995, 99659, 18273, 55105, 56262, 43354, 54733, 28407, 45058, 98235, 85163, 11214, 11639, 28042, 20887, 13202, 95214, 52324, 64273, 73730, 46133, 22802, 65820, 10398, 57531, 56314, 28721, 95071, 87948, 42900, 79783, 57144, 45904, 86334, 10905, 90295, 48239, 74923, 42596, 16417, 69854, 52649, 78038, 94030, 99898, 98085, 22942, 7898, 89953, 67838, 95096, 83749, 50060, 72456, 38585, 34551, 85773, 66609, 47135, 92060] 2)," 1004607 (sumIndicesWithKSetBits [68106, 38537, 64713, 74318, 6006, 46213, 18015, 47880, 62297, 41588, 65477, 39949, 62895, 44985, 65995, 99659, 18273, 55105, 56262, 43354, 54733, 28407, 45058, 98235, 85163, 11214, 11639, 28042, 20887, 13202, 95214, 52324, 64273, 73730, 46133, 22802, 65820, 10398, 57531, 56314, 28721, 95071, 87948, 42900, 79783, 57144, 45904, 86334, 10905, 90295, 48239, 74923, 42596, 16417, 69854, 52649, 78038, 94030, 99898, 98085, 22942, 7898, 89953, 67838, 95096, 83749, 50060, 72456, 38585, 34551, 85773, 66609, 47135, 92060] 2))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (sumIndicesWithKSetBits [6272, 30197, 14726, 85546, 24377, 37456, 78319, 24156, 59515, 30049, 92015, 21049, 3220, 93926, 73958, 48944, 42471, 27391, 73056, 90772, 48639, 92305, 60775, 6542, 51233, 6025, 74867, 52007, 51618, 77508, 11221, 7189, 62785, 38806, 36311, 27556, 45228, 99305, 64539, 75637, 82339, 56128, 27872, 57106, 23328, 73582, 15835, 87859, 92823, 12181, 25909, 38460, 84398, 67227, 60591, 99918, 73562, 28204, 17581, 16171, 36992, 36659, 19823, 99381, 42417, 32222, 19634, 11315, 68611, 17152, 84762, 81091, 11213, 12048, 58152, 10235, 29446, 96786, 94069] 2)," 954111 (sumIndicesWithKSetBits [6272, 30197, 14726, 85546, 24377, 37456, 78319, 24156, 59515, 30049, 92015, 21049, 3220, 93926, 73958, 48944, 42471, 27391, 73056, 90772, 48639, 92305, 60775, 6542, 51233, 6025, 74867, 52007, 51618, 77508, 11221, 7189, 62785, 38806, 36311, 27556, 45228, 99305, 64539, 75637, 82339, 56128, 27872, 57106, 23328, 73582, 15835, 87859, 92823, 12181, 25909, 38460, 84398, 67227, 60591, 99918, 73562, 28204, 17581, 16171, 36992, 36659, 19823, 99381, 42417, 32222, 19634, 11315, 68611, 17152, 84762, 81091, 11213, 12048, 58152, 10235, 29446, 96786, 94069] 2))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (sumIndicesWithKSetBits [46971, 86002, 93986, 72497, 94959, 64944, 39917, 35042, 48791, 42267, 14403, 94054, 10603, 81402, 47189, 85770, 86921, 5130, 7668, 24445, 11680, 41562, 73578, 33447, 78436, 66079, 38951, 70182, 57338, 70241, 3458, 2766, 19702, 2296, 85200, 52343, 66821, 44946, 35929, 4062, 5444, 1215, 57412, 58081, 49883, 56874, 77429, 25551, 60353, 8244, 96773, 35728, 25669, 72693, 46608, 19401, 87834, 75762, 50959, 32704, 8650, 95942, 11820, 59200, 81686, 45975, 68900, 99806, 13483, 23886, 76700, 42126, 58639, 47243, 49640, 1640, 24664, 11233, 19739, 24493, 72883, 15397, 75595, 22314, 47332, 11886, 82540, 21478, 36127, 93344, 39653, 50188, 23508, 43668, 86866, 18950, 37766, 92300, 93147, 7977, 74758, 4881, 38658, 36699, 87592, 38686, 10753, 10513, 12344, 97293, 9896, 7888, 34211, 882, 2979, 28033, 30773, 16664, 76029, 29772, 23706, 47568, 69964, 86788, 72794, 33683, 92705, 73707, 41446, 72023, 10821, 87700, 36492, 26782, 51546, 67038, 70553, 77553, 4361, 2918, 81424, 68427, 9094, 53942, 82880, 65731, 99853, 50558, 88353, 1311, 82043, 13470, 18261, 21977, 22437, 2497, 56477, 83203, 80412, 43887, 29682, 5042, 11071, 88312, 4605, 7443, 92223, 41798, 92879, 63692, 34880, 9790, 19018, 34767, 55399, 5197, 46813, 94401, 45215, 9850, 62131, 74185, 47713, 29586, 42224, 93766, 84341, 87106, 62738, 17162, 91990, 68557, 97193, 93383, 25960, 22202, 21223, 70812, 98927, 43544, 70336, 75793, 52859, 95459, 15109, 84146, 89836, 92557, 2461, 57734, 7292, 55031, 25469, 56923, 89555, 98188, 55860, 94096, 25961, 77249, 68555, 3366, 78293, 81821, 82374, 61536, 16356, 38715, 17820, 42199, 45689, 15921, 46549, 58785, 93511, 89746, 25153, 3221, 94981, 90489, 31873, 98530, 44048, 84189, 93313, 39039, 51274, 24141, 30218, 39442, 29803, 9493, 17426, 25521, 34793, 95109, 27656, 87670, 79528, 73044, 13550, 80051, 86988, 24962, 86197, 51566, 22590, 29451, 35992, 78801, 82541, 80732, 90117, 59762, 56636, 818, 77721, 8660, 79390, 48461, 86940, 67011, 73502, 9367, 45511, 56947, 38398, 72568, 37765, 96600, 30482, 70, 31985, 56397, 87987, 17339, 28465, 9890, 82854, 86550, 89187, 25224, 3472, 56191, 22607, 26602, 42150, 97851, 51198, 47168, 55873, 83722, 74101, 87316, 38451, 91155, 82969, 48667, 29059, 71257, 197, 44227, 8328, 77530, 93698, 83983, 43977, 40936, 56677, 31692, 13545, 97799, 62337, 78431, 31468, 91813, 29214, 39553, 37498, 16559, 72809, 81745, 32036, 45067, 83726, 74629, 61075, 76786, 83897, 58341] 5)," 4276161 (sumIndicesWithKSetBits [46971, 86002, 93986, 72497, 94959, 64944, 39917, 35042, 48791, 42267, 14403, 94054, 10603, 81402, 47189, 85770, 86921, 5130, 7668, 24445, 11680, 41562, 73578, 33447, 78436, 66079, 38951, 70182, 57338, 70241, 3458, 2766, 19702, 2296, 85200, 52343, 66821, 44946, 35929, 4062, 5444, 1215, 57412, 58081, 49883, 56874, 77429, 25551, 60353, 8244, 96773, 35728, 25669, 72693, 46608, 19401, 87834, 75762, 50959, 32704, 8650, 95942, 11820, 59200, 81686, 45975, 68900, 99806, 13483, 23886, 76700, 42126, 58639, 47243, 49640, 1640, 24664, 11233, 19739, 24493, 72883, 15397, 75595, 22314, 47332, 11886, 82540, 21478, 36127, 93344, 39653, 50188, 23508, 43668, 86866, 18950, 37766, 92300, 93147, 7977, 74758, 4881, 38658, 36699, 87592, 38686, 10753, 10513, 12344, 97293, 9896, 7888, 34211, 882, 2979, 28033, 30773, 16664, 76029, 29772, 23706, 47568, 69964, 86788, 72794, 33683, 92705, 73707, 41446, 72023, 10821, 87700, 36492, 26782, 51546, 67038, 70553, 77553, 4361, 2918, 81424, 68427, 9094, 53942, 82880, 65731, 99853, 50558, 88353, 1311, 82043, 13470, 18261, 21977, 22437, 2497, 56477, 83203, 80412, 43887, 29682, 5042, 11071, 88312, 4605, 7443, 92223, 41798, 92879, 63692, 34880, 9790, 19018, 34767, 55399, 5197, 46813, 94401, 45215, 9850, 62131, 74185, 47713, 29586, 42224, 93766, 84341, 87106, 62738, 17162, 91990, 68557, 97193, 93383, 25960, 22202, 21223, 70812, 98927, 43544, 70336, 75793, 52859, 95459, 15109, 84146, 89836, 92557, 2461, 57734, 7292, 55031, 25469, 56923, 89555, 98188, 55860, 94096, 25961, 77249, 68555, 3366, 78293, 81821, 82374, 61536, 16356, 38715, 17820, 42199, 45689, 15921, 46549, 58785, 93511, 89746, 25153, 3221, 94981, 90489, 31873, 98530, 44048, 84189, 93313, 39039, 51274, 24141, 30218, 39442, 29803, 9493, 17426, 25521, 34793, 95109, 27656, 87670, 79528, 73044, 13550, 80051, 86988, 24962, 86197, 51566, 22590, 29451, 35992, 78801, 82541, 80732, 90117, 59762, 56636, 818, 77721, 8660, 79390, 48461, 86940, 67011, 73502, 9367, 45511, 56947, 38398, 72568, 37765, 96600, 30482, 70, 31985, 56397, 87987, 17339, 28465, 9890, 82854, 86550, 89187, 25224, 3472, 56191, 22607, 26602, 42150, 97851, 51198, 47168, 55873, 83722, 74101, 87316, 38451, 91155, 82969, 48667, 29059, 71257, 197, 44227, 8328, 77530, 93698, 83983, 43977, 40936, 56677, 31692, 13545, 97799, 62337, 78431, 31468, 91813, 29214, 39553, 37498, 16559, 72809, 81745, 32036, 45067, 83726, 74629, 61075, 76786, 83897, 58341] 5))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (sumIndicesWithKSetBits [51551, 30382, 18896, 34017, 46568, 11896, 86545, 94478, 18293, 21741, 97953, 85873, 28969, 12553, 79382, 513, 50932, 14125, 45912, 78824, 96253, 47288, 56434, 58736, 56722, 58755, 25460, 76404, 77456, 59429, 82124, 9022, 54042, 2186, 33885, 55844, 78868, 99078, 63262, 12076, 72799, 94522, 69810, 39086, 31672, 99180, 8530, 3040, 9731, 48235, 38507, 2017, 5643, 1612, 50805, 52771, 89057, 34756, 99510, 10145, 41457, 88925, 92588, 12434, 80559, 53883, 61986, 89260, 12074, 55290, 94366, 16282, 8208, 50037, 66081, 3366, 26662, 37625, 88327, 81167, 76718, 38128, 54737, 82075, 55091, 7930, 4914, 70182, 89385, 92601, 29676, 65344, 69844, 39582, 34836, 21910, 61202, 19859, 25762, 23025, 22974, 55848, 4331, 36403, 54073, 80450, 61143, 60589, 98677, 37572, 31886, 26017, 66597, 95033, 26683, 24662, 19392, 92679, 31047, 74014, 46817, 6504, 27071, 30342, 93699, 75694, 27976, 62807, 2363, 14411, 78783, 67747, 78736, 96321, 28748, 62754, 77938, 50408, 1236, 13206, 29091, 24935, 72435, 2766, 10563, 26167, 63833, 62978, 20706, 42553, 45948, 49328, 82610, 54240, 76623, 99903, 75864, 61801, 5326, 13645, 18197, 44033, 27403, 37055, 23032, 85026, 97943, 11782, 3711, 71444, 34404, 46620, 17273, 13375, 86830, 57392, 26715, 22383, 10170, 8214, 58261, 88849, 45791, 6819, 63814, 29213, 83114, 6879, 41144, 22005, 32476, 56464, 82017, 51763, 3406, 47652, 8224, 1723, 82387, 65145, 17618, 67061, 66715, 39680, 63271, 81370, 34119, 91545, 89963, 19204, 30645, 29601, 80532, 81088, 44687, 40468, 60092, 45989, 31598, 74176, 34757, 75986, 72649, 70358, 59397, 59953, 84501, 296, 43935, 44099, 80562, 75087, 46616, 54742, 13267, 81548, 20654, 79129, 63898, 84475, 42672, 21797, 74680, 96092, 86241, 46286, 92655, 46400, 72334, 58743, 17980, 8212, 46171, 15967, 6103, 73319, 62132, 18696, 25305, 61132, 84732, 59204, 60511, 34915, 16507, 35832, 86911, 75294, 9258, 66093, 19978, 21258, 82128, 22965, 5735, 3609, 87694, 83985, 38695, 16582, 43295, 55280, 38190, 64196, 26332, 97257, 71280, 98361, 13020, 52828, 21350, 91330, 43100, 8847, 97213, 28316, 99649, 70934, 19452, 42454, 8547, 51031, 58892, 90145, 97412, 60041, 65356, 8193, 47840, 82218, 22884, 22415, 68951, 47798, 53320, 95281, 49517, 13709, 17373, 83351, 85478, 99738, 7194, 31629, 82911, 2993, 83450, 89582, 35364, 21107, 35168, 27337, 78110, 29513, 46027, 3906, 17389, 62167, 57411, 3130, 21661, 60978, 73522, 65420, 17913, 75331, 97421, 93151, 6339, 16130, 57238, 19829, 57831, 78285, 17235, 57578, 48551, 89149, 26763, 99585, 77049, 53743, 32588, 76442, 94247, 31134, 6849, 60801, 44249, 70802, 53445, 46957, 611, 68427, 48951, 95725, 13104, 9492, 56321, 89549, 51197, 27439, 5866, 18186, 21480, 9719, 21397, 56402, 14633, 3968, 96777, 24366, 38597, 89427, 37945, 54042, 43323, 84770, 71844, 82624, 79773, 98479, 92998, 973, 74774, 93069, 73191, 70306, 33742, 15726, 83553, 92223, 67431, 90421, 22654, 37288, 68160, 45651, 66778, 58519, 61044, 69417, 62033, 25209, 17278, 92970, 70174, 38190, 81775, 56539, 28545, 76326, 67341, 73726, 49455, 20745, 66515, 70672, 85847, 47032, 15346, 24057, 94336, 10796, 24126, 96823, 99884, 24236, 39648, 45352, 16513, 91130, 65252, 14732, 79920, 23690, 51513, 63137, 76521, 19406, 21046, 58266, 59300, 35998, 9731, 14954, 47760, 6506, 80634, 89565, 31543, 42655, 61111, 74532, 34042, 31856, 15184, 44206, 36958, 69263, 6348, 8023, 11457, 43596, 82890, 23579, 53967, 52353, 2774, 53783, 11914, 5829, 90225, 57623, 23407, 17210, 12140, 48627, 85102, 65583, 54527, 64073, 14075, 74869, 54954, 64618, 91559, 64274, 25892, 38198, 41, 8097, 72423, 7753, 2565, 90433, 1905, 67400, 97991, 16984, 35868, 22685, 57323, 46768, 98193, 98218, 16893, 16249, 93374, 13693, 12693, 45058, 53776, 37651, 37522, 12349, 12620, 20521, 69535, 27154, 482, 2770, 94592, 72341, 54150, 29834, 38446, 99302, 46825, 83405, 637, 39323, 78290, 9488, 73773, 52293, 92088, 2156, 14719, 59983, 8266, 38888, 46163, 29960, 65222, 74995, 3555, 97043, 87939, 69699, 87491, 49415, 32862, 85069, 29779, 31133, 39558, 2771, 70251, 12928, 93794, 90181, 458, 46069, 46291, 33871, 97849, 34483, 51467, 83114, 71419, 55019, 71852, 76102, 26120, 62891, 28756, 81100, 29215, 72923, 77731, 50567, 72461, 53803, 32695, 15976, 12020, 49989, 97819, 90796, 20595, 13269, 73849, 31975, 68086, 35116, 86665, 96173, 3794, 35516, 34447, 46409, 50300, 14845, 12476, 36817, 78320] 5)," 7701068 (sumIndicesWithKSetBits [51551, 30382, 18896, 34017, 46568, 11896, 86545, 94478, 18293, 21741, 97953, 85873, 28969, 12553, 79382, 513, 50932, 14125, 45912, 78824, 96253, 47288, 56434, 58736, 56722, 58755, 25460, 76404, 77456, 59429, 82124, 9022, 54042, 2186, 33885, 55844, 78868, 99078, 63262, 12076, 72799, 94522, 69810, 39086, 31672, 99180, 8530, 3040, 9731, 48235, 38507, 2017, 5643, 1612, 50805, 52771, 89057, 34756, 99510, 10145, 41457, 88925, 92588, 12434, 80559, 53883, 61986, 89260, 12074, 55290, 94366, 16282, 8208, 50037, 66081, 3366, 26662, 37625, 88327, 81167, 76718, 38128, 54737, 82075, 55091, 7930, 4914, 70182, 89385, 92601, 29676, 65344, 69844, 39582, 34836, 21910, 61202, 19859, 25762, 23025, 22974, 55848, 4331, 36403, 54073, 80450, 61143, 60589, 98677, 37572, 31886, 26017, 66597, 95033, 26683, 24662, 19392, 92679, 31047, 74014, 46817, 6504, 27071, 30342, 93699, 75694, 27976, 62807, 2363, 14411, 78783, 67747, 78736, 96321, 28748, 62754, 77938, 50408, 1236, 13206, 29091, 24935, 72435, 2766, 10563, 26167, 63833, 62978, 20706, 42553, 45948, 49328, 82610, 54240, 76623, 99903, 75864, 61801, 5326, 13645, 18197, 44033, 27403, 37055, 23032, 85026, 97943, 11782, 3711, 71444, 34404, 46620, 17273, 13375, 86830, 57392, 26715, 22383, 10170, 8214, 58261, 88849, 45791, 6819, 63814, 29213, 83114, 6879, 41144, 22005, 32476, 56464, 82017, 51763, 3406, 47652, 8224, 1723, 82387, 65145, 17618, 67061, 66715, 39680, 63271, 81370, 34119, 91545, 89963, 19204, 30645, 29601, 80532, 81088, 44687, 40468, 60092, 45989, 31598, 74176, 34757, 75986, 72649, 70358, 59397, 59953, 84501, 296, 43935, 44099, 80562, 75087, 46616, 54742, 13267, 81548, 20654, 79129, 63898, 84475, 42672, 21797, 74680, 96092, 86241, 46286, 92655, 46400, 72334, 58743, 17980, 8212, 46171, 15967, 6103, 73319, 62132, 18696, 25305, 61132, 84732, 59204, 60511, 34915, 16507, 35832, 86911, 75294, 9258, 66093, 19978, 21258, 82128, 22965, 5735, 3609, 87694, 83985, 38695, 16582, 43295, 55280, 38190, 64196, 26332, 97257, 71280, 98361, 13020, 52828, 21350, 91330, 43100, 8847, 97213, 28316, 99649, 70934, 19452, 42454, 8547, 51031, 58892, 90145, 97412, 60041, 65356, 8193, 47840, 82218, 22884, 22415, 68951, 47798, 53320, 95281, 49517, 13709, 17373, 83351, 85478, 99738, 7194, 31629, 82911, 2993, 83450, 89582, 35364, 21107, 35168, 27337, 78110, 29513, 46027, 3906, 17389, 62167, 57411, 3130, 21661, 60978, 73522, 65420, 17913, 75331, 97421, 93151, 6339, 16130, 57238, 19829, 57831, 78285, 17235, 57578, 48551, 89149, 26763, 99585, 77049, 53743, 32588, 76442, 94247, 31134, 6849, 60801, 44249, 70802, 53445, 46957, 611, 68427, 48951, 95725, 13104, 9492, 56321, 89549, 51197, 27439, 5866, 18186, 21480, 9719, 21397, 56402, 14633, 3968, 96777, 24366, 38597, 89427, 37945, 54042, 43323, 84770, 71844, 82624, 79773, 98479, 92998, 973, 74774, 93069, 73191, 70306, 33742, 15726, 83553, 92223, 67431, 90421, 22654, 37288, 68160, 45651, 66778, 58519, 61044, 69417, 62033, 25209, 17278, 92970, 70174, 38190, 81775, 56539, 28545, 76326, 67341, 73726, 49455, 20745, 66515, 70672, 85847, 47032, 15346, 24057, 94336, 10796, 24126, 96823, 99884, 24236, 39648, 45352, 16513, 91130, 65252, 14732, 79920, 23690, 51513, 63137, 76521, 19406, 21046, 58266, 59300, 35998, 9731, 14954, 47760, 6506, 80634, 89565, 31543, 42655, 61111, 74532, 34042, 31856, 15184, 44206, 36958, 69263, 6348, 8023, 11457, 43596, 82890, 23579, 53967, 52353, 2774, 53783, 11914, 5829, 90225, 57623, 23407, 17210, 12140, 48627, 85102, 65583, 54527, 64073, 14075, 74869, 54954, 64618, 91559, 64274, 25892, 38198, 41, 8097, 72423, 7753, 2565, 90433, 1905, 67400, 97991, 16984, 35868, 22685, 57323, 46768, 98193, 98218, 16893, 16249, 93374, 13693, 12693, 45058, 53776, 37651, 37522, 12349, 12620, 20521, 69535, 27154, 482, 2770, 94592, 72341, 54150, 29834, 38446, 99302, 46825, 83405, 637, 39323, 78290, 9488, 73773, 52293, 92088, 2156, 14719, 59983, 8266, 38888, 46163, 29960, 65222, 74995, 3555, 97043, 87939, 69699, 87491, 49415, 32862, 85069, 29779, 31133, 39558, 2771, 70251, 12928, 93794, 90181, 458, 46069, 46291, 33871, 97849, 34483, 51467, 83114, 71419, 55019, 71852, 76102, 26120, 62891, 28756, 81100, 29215, 72923, 77731, 50567, 72461, 53803, 32695, 15976, 12020, 49989, 97819, 90796, 20595, 13269, 73849, 31975, 68086, 35116, 86665, 96173, 3794, 35516, 34447, 46409, 50300, 14845, 12476, 36817, 78320] 5))
28
+
29
+ test7 :: Test
30
+ test7 = TestCase (assertEqual "for (sumIndicesWithKSetBits [79755, 37830, 51603, 11779, 20405, 52651, 69395, 31317, 23631, 8966, 96715, 8478, 61927, 58456, 20938, 5090, 66727, 43736, 10821, 43374, 8583, 20464, 93051, 53866, 53870, 77803, 26158, 63885, 17650, 63837, 33005, 53565, 70143, 98016, 25272, 20108, 77159, 63923, 85766, 56204, 94588, 41751, 83470, 38026, 22405, 42895, 41469, 29699, 48282, 12839, 89682, 85560, 78689, 49458, 75994, 46125, 3711, 49666, 42269, 37061, 65148, 71142, 41101, 35962, 26471, 30012, 66529, 52131, 33923, 47242, 52515, 9504, 45080, 87695, 10705, 36985, 40093, 22452, 36104, 36568, 85517, 28117, 82580, 9015, 81153, 36694, 106, 56683, 83548, 19812, 61478, 33338, 69552, 73118, 84255, 49950, 69475, 10346, 17782, 86581, 69158, 89537, 95827, 37528, 83694, 61027, 72122, 54915, 74854, 31773, 37837, 65692, 43789, 91715, 4698, 65055, 77723, 8357, 56223, 73674, 2673, 48566, 97969, 21819, 85155, 1299, 79238, 17951, 3490, 66130, 20619, 43364, 78751, 13996, 25337, 64575, 29338, 55681, 66403, 22644, 99104, 8460, 61516, 93347, 1107, 72580, 86365, 55535, 15714, 88934, 80297, 31204, 78645, 55654, 34968, 42650, 7371, 49482, 59311, 50236, 90995, 97922, 55732, 43349, 6779, 92145, 82918, 80968, 20157, 64462, 82287, 8020, 15411, 11488, 2559, 4992, 85542, 59896, 35960, 33593, 6679, 20699, 74000, 57335, 79139, 66934, 98452, 61796, 28957, 15880, 730, 60812, 49816, 19354, 2345, 17796, 49804, 36282, 42297, 41134, 83431, 97087, 47980, 11404, 84622, 3787, 78774, 50038, 37887, 1097, 78862, 72653, 48372, 4675, 89778, 99888, 23842, 57881, 67484, 4859, 98577, 55461, 70745, 42524, 10659, 52857, 23132, 5375, 87980, 96153, 2649, 15684, 29858, 13166, 17680, 8057, 60463, 8420, 73883, 56362, 93760, 96525, 76869, 85699, 64835, 59409, 6539, 82024, 60304, 50915, 68137, 79997, 42064, 40113, 71537, 78302, 72977, 61888, 84966, 28668, 53650, 95236, 13116, 93975, 97959, 32101, 79344, 86068, 51992, 23236, 30989, 3623, 76269, 43971, 4783, 55864, 31572, 48890, 13734, 63263, 63305, 49912, 35183, 97418, 67778, 81285, 44353, 3110, 38977, 95270, 85268, 98997, 20996, 56635, 80980, 57876, 28024, 92590, 46679, 90805, 8521, 18605, 13712, 93387, 53813, 98416, 97966, 45031, 61940, 27826, 39157, 62096, 18492, 70734, 19786, 79807, 27407, 99401, 5552, 72522, 3321, 92343, 4814, 70503, 48616, 69105, 10153, 60796, 82731, 7158, 46614, 45602, 89209, 46744, 34973, 5088, 37247, 50077, 62982, 63903, 77019, 77890, 66015, 58847, 18087, 27423, 26243, 14178, 35174, 71888, 83363, 1544, 88981, 183, 90176, 27786, 26213, 93836, 14017, 28901, 93401, 46888, 54671, 96926, 63159, 44441, 94026, 36511, 95903, 74800, 9010, 80204, 20266, 67677, 37899, 86492, 52007, 61689, 66556, 50443, 98305, 77822, 23113, 12049, 45884, 72119, 33953, 44999, 73538, 90546, 80143, 59147, 60413, 54638, 20177, 75914, 77348, 27248, 2920, 89116, 7266, 3996, 62128, 93494, 71972, 61540, 22523] 7)," 799767 (sumIndicesWithKSetBits [79755, 37830, 51603, 11779, 20405, 52651, 69395, 31317, 23631, 8966, 96715, 8478, 61927, 58456, 20938, 5090, 66727, 43736, 10821, 43374, 8583, 20464, 93051, 53866, 53870, 77803, 26158, 63885, 17650, 63837, 33005, 53565, 70143, 98016, 25272, 20108, 77159, 63923, 85766, 56204, 94588, 41751, 83470, 38026, 22405, 42895, 41469, 29699, 48282, 12839, 89682, 85560, 78689, 49458, 75994, 46125, 3711, 49666, 42269, 37061, 65148, 71142, 41101, 35962, 26471, 30012, 66529, 52131, 33923, 47242, 52515, 9504, 45080, 87695, 10705, 36985, 40093, 22452, 36104, 36568, 85517, 28117, 82580, 9015, 81153, 36694, 106, 56683, 83548, 19812, 61478, 33338, 69552, 73118, 84255, 49950, 69475, 10346, 17782, 86581, 69158, 89537, 95827, 37528, 83694, 61027, 72122, 54915, 74854, 31773, 37837, 65692, 43789, 91715, 4698, 65055, 77723, 8357, 56223, 73674, 2673, 48566, 97969, 21819, 85155, 1299, 79238, 17951, 3490, 66130, 20619, 43364, 78751, 13996, 25337, 64575, 29338, 55681, 66403, 22644, 99104, 8460, 61516, 93347, 1107, 72580, 86365, 55535, 15714, 88934, 80297, 31204, 78645, 55654, 34968, 42650, 7371, 49482, 59311, 50236, 90995, 97922, 55732, 43349, 6779, 92145, 82918, 80968, 20157, 64462, 82287, 8020, 15411, 11488, 2559, 4992, 85542, 59896, 35960, 33593, 6679, 20699, 74000, 57335, 79139, 66934, 98452, 61796, 28957, 15880, 730, 60812, 49816, 19354, 2345, 17796, 49804, 36282, 42297, 41134, 83431, 97087, 47980, 11404, 84622, 3787, 78774, 50038, 37887, 1097, 78862, 72653, 48372, 4675, 89778, 99888, 23842, 57881, 67484, 4859, 98577, 55461, 70745, 42524, 10659, 52857, 23132, 5375, 87980, 96153, 2649, 15684, 29858, 13166, 17680, 8057, 60463, 8420, 73883, 56362, 93760, 96525, 76869, 85699, 64835, 59409, 6539, 82024, 60304, 50915, 68137, 79997, 42064, 40113, 71537, 78302, 72977, 61888, 84966, 28668, 53650, 95236, 13116, 93975, 97959, 32101, 79344, 86068, 51992, 23236, 30989, 3623, 76269, 43971, 4783, 55864, 31572, 48890, 13734, 63263, 63305, 49912, 35183, 97418, 67778, 81285, 44353, 3110, 38977, 95270, 85268, 98997, 20996, 56635, 80980, 57876, 28024, 92590, 46679, 90805, 8521, 18605, 13712, 93387, 53813, 98416, 97966, 45031, 61940, 27826, 39157, 62096, 18492, 70734, 19786, 79807, 27407, 99401, 5552, 72522, 3321, 92343, 4814, 70503, 48616, 69105, 10153, 60796, 82731, 7158, 46614, 45602, 89209, 46744, 34973, 5088, 37247, 50077, 62982, 63903, 77019, 77890, 66015, 58847, 18087, 27423, 26243, 14178, 35174, 71888, 83363, 1544, 88981, 183, 90176, 27786, 26213, 93836, 14017, 28901, 93401, 46888, 54671, 96926, 63159, 44441, 94026, 36511, 95903, 74800, 9010, 80204, 20266, 67677, 37899, 86492, 52007, 61689, 66556, 50443, 98305, 77822, 23113, 12049, 45884, 72119, 33953, 44999, 73538, 90546, 80143, 59147, 60413, 54638, 20177, 75914, 77348, 27248, 2920, 89116, 7266, 3996, 62128, 93494, 71972, 61540, 22523] 7))
31
+
32
+ test8 :: Test
33
+ test8 = TestCase (assertEqual "for (sumIndicesWithKSetBits [38376, 1193, 60608, 86207, 60101, 51277, 70510, 96627, 41126, 70517, 99795, 68631, 15450, 61367, 26192, 1455, 44152, 70202, 5912, 91181, 27463, 84440, 75307, 54399, 2252, 91869, 69595, 93618, 25501, 28704, 85175, 77733, 44298, 97916, 18899, 91919, 23444, 5106, 11203, 84948, 10507, 97068, 63393, 37719, 81095, 5518, 61160, 52080, 57072, 94703, 70941, 94557, 39199, 8906, 41313, 93232, 18234, 39093, 99607, 12469, 22181, 80964, 71837, 49195, 95932, 35437, 99469, 94990, 9549, 46456, 34323, 41944, 77744, 50474, 70530, 52797, 76497, 46367, 58795, 52094, 12958, 69639, 43298, 31437, 36074, 96308, 75795, 84242, 29478, 49251, 4991, 41645, 16365, 13225, 6483, 75049, 24964, 89148, 49495, 52484, 74160, 44713, 88442, 24803, 32271, 14009, 41511, 97460, 84080, 48143, 30288, 85673, 85301, 60111, 68636, 69307, 30817, 2224, 84755, 5472, 76532, 463, 4878, 89328, 2290, 8919, 90475, 66751, 8211, 84034, 85785, 16083, 49686, 70391, 56786, 63913, 64107, 25282, 74636, 12345, 66694, 86448, 4514, 71439, 14847, 94446, 5921, 45066, 46148, 85800, 99819, 36149, 8611, 18126, 2843, 71497, 41959, 22205, 74842, 72160, 9662, 39788, 46996, 27799, 48652, 93112, 37892, 95183, 67504, 13952, 25398, 7073, 78142, 68708, 27067, 7229, 35439, 88965, 19968, 27853, 90597, 51178, 99277, 53548, 36695, 99486, 65735, 82392, 40972, 36534, 93558, 13159, 66209, 20630, 95090, 38115, 66169, 70997, 73047, 78502, 93303, 18346, 85427, 14251, 995, 72691, 66191, 54038, 62546, 82954, 7015, 36950, 12410, 30528, 55289, 13481, 21292, 9064, 63761, 17746, 31897, 14567, 17021, 57968, 57636, 26846, 52257, 41701, 57454, 89969, 4676, 25051, 87539, 86646, 30573, 10462, 30662, 33151, 84492, 27008, 17626, 21905, 21011, 42733, 32790, 18861, 22549, 50833, 67035, 26935, 25380, 24372, 80339, 86520, 26480, 99568, 83122, 67410, 16497, 8373, 60935, 42808, 70103, 60056, 82962, 12486, 82949, 85143, 53545, 74920, 70934, 13495, 75788, 51579, 77453, 86602, 3189, 89085, 68143, 9035, 13887, 36515, 17960, 5010, 43502, 34949, 32460, 67072, 80070, 2157, 64967, 41716, 65762, 41121, 36486, 86496, 54740, 99571, 6846, 51193, 47112, 61073, 22322, 66132, 91382, 96146, 16580, 38233, 94185, 28167, 27569, 30182, 53788, 53621, 38012, 15960, 1335, 98632, 26701, 73055, 84578, 19708, 91118, 21342, 53904, 62555, 66034, 48205, 67943, 23923, 44330, 39232, 68632, 34599, 93020, 43825, 26421, 62259, 43994, 41849, 35410, 98035, 87796, 59041, 88049, 19997, 92958, 31806, 964, 32525, 86490, 55530, 33143, 94690, 25232, 94164, 17309, 85836, 10418, 11088, 86326, 16, 69035, 57808, 61376, 85521, 71876, 83820, 9340, 9231, 75397, 94074, 10576, 83044, 64745, 33498, 31324, 4401, 51926, 58188, 6426, 87721, 26294, 75982, 82350, 25523, 62131, 86549, 24658, 53734, 1998, 34277, 188, 77879, 11876, 93106, 37688, 8404, 63191, 7348, 92925, 94868, 98115, 8817, 53860, 41005, 79922, 41515, 38266, 1378, 12333, 50293, 93600, 90029, 42698, 23180, 51019, 75391, 93527, 52994, 77323, 5948, 34016, 49119, 9197, 15918, 47795, 38578, 26745, 39060, 87468, 29371, 48659, 33845, 3227, 39838, 47813, 25779, 61692, 20734, 98410, 44904, 9785, 603, 16665, 91575, 75527, 81066, 18053, 52450, 98988, 8925, 41580, 38145, 71267, 78444, 43868, 74913, 10676, 30272, 16082, 35236, 84495, 72873, 38985, 66126, 55458, 14117, 51007, 36497, 59455, 41814, 89668, 84849, 47605, 84714, 8197, 68388, 26565, 52432, 66489, 64526, 33287, 59047, 47043, 17100, 92487, 95003, 69904, 45001, 18659, 59900, 4113, 68184, 36689, 72134, 90930, 61663, 44149, 59312, 32196, 9902, 89717, 98958, 36692, 10736, 75542, 49675, 55789, 46271, 91628, 12721, 3261, 4675, 29470, 97379, 99024, 5658, 14629, 25488, 25209, 45862, 38471, 29679, 86340, 44242, 41309, 32513, 34495, 51777, 37649, 44959, 40139, 50651, 79429, 16393, 34040, 57926, 87114, 65812, 11608, 95097, 54050, 84306, 36079, 77442, 82807, 70477, 71060, 78222, 47807, 4950, 36861, 18893, 71148, 76830, 34284, 58257, 53828, 58573, 29124, 35685, 66387, 99432, 40488, 25855, 74684, 45340, 53658, 27211, 48948, 74623] 4)," 7525991 (sumIndicesWithKSetBits [38376, 1193, 60608, 86207, 60101, 51277, 70510, 96627, 41126, 70517, 99795, 68631, 15450, 61367, 26192, 1455, 44152, 70202, 5912, 91181, 27463, 84440, 75307, 54399, 2252, 91869, 69595, 93618, 25501, 28704, 85175, 77733, 44298, 97916, 18899, 91919, 23444, 5106, 11203, 84948, 10507, 97068, 63393, 37719, 81095, 5518, 61160, 52080, 57072, 94703, 70941, 94557, 39199, 8906, 41313, 93232, 18234, 39093, 99607, 12469, 22181, 80964, 71837, 49195, 95932, 35437, 99469, 94990, 9549, 46456, 34323, 41944, 77744, 50474, 70530, 52797, 76497, 46367, 58795, 52094, 12958, 69639, 43298, 31437, 36074, 96308, 75795, 84242, 29478, 49251, 4991, 41645, 16365, 13225, 6483, 75049, 24964, 89148, 49495, 52484, 74160, 44713, 88442, 24803, 32271, 14009, 41511, 97460, 84080, 48143, 30288, 85673, 85301, 60111, 68636, 69307, 30817, 2224, 84755, 5472, 76532, 463, 4878, 89328, 2290, 8919, 90475, 66751, 8211, 84034, 85785, 16083, 49686, 70391, 56786, 63913, 64107, 25282, 74636, 12345, 66694, 86448, 4514, 71439, 14847, 94446, 5921, 45066, 46148, 85800, 99819, 36149, 8611, 18126, 2843, 71497, 41959, 22205, 74842, 72160, 9662, 39788, 46996, 27799, 48652, 93112, 37892, 95183, 67504, 13952, 25398, 7073, 78142, 68708, 27067, 7229, 35439, 88965, 19968, 27853, 90597, 51178, 99277, 53548, 36695, 99486, 65735, 82392, 40972, 36534, 93558, 13159, 66209, 20630, 95090, 38115, 66169, 70997, 73047, 78502, 93303, 18346, 85427, 14251, 995, 72691, 66191, 54038, 62546, 82954, 7015, 36950, 12410, 30528, 55289, 13481, 21292, 9064, 63761, 17746, 31897, 14567, 17021, 57968, 57636, 26846, 52257, 41701, 57454, 89969, 4676, 25051, 87539, 86646, 30573, 10462, 30662, 33151, 84492, 27008, 17626, 21905, 21011, 42733, 32790, 18861, 22549, 50833, 67035, 26935, 25380, 24372, 80339, 86520, 26480, 99568, 83122, 67410, 16497, 8373, 60935, 42808, 70103, 60056, 82962, 12486, 82949, 85143, 53545, 74920, 70934, 13495, 75788, 51579, 77453, 86602, 3189, 89085, 68143, 9035, 13887, 36515, 17960, 5010, 43502, 34949, 32460, 67072, 80070, 2157, 64967, 41716, 65762, 41121, 36486, 86496, 54740, 99571, 6846, 51193, 47112, 61073, 22322, 66132, 91382, 96146, 16580, 38233, 94185, 28167, 27569, 30182, 53788, 53621, 38012, 15960, 1335, 98632, 26701, 73055, 84578, 19708, 91118, 21342, 53904, 62555, 66034, 48205, 67943, 23923, 44330, 39232, 68632, 34599, 93020, 43825, 26421, 62259, 43994, 41849, 35410, 98035, 87796, 59041, 88049, 19997, 92958, 31806, 964, 32525, 86490, 55530, 33143, 94690, 25232, 94164, 17309, 85836, 10418, 11088, 86326, 16, 69035, 57808, 61376, 85521, 71876, 83820, 9340, 9231, 75397, 94074, 10576, 83044, 64745, 33498, 31324, 4401, 51926, 58188, 6426, 87721, 26294, 75982, 82350, 25523, 62131, 86549, 24658, 53734, 1998, 34277, 188, 77879, 11876, 93106, 37688, 8404, 63191, 7348, 92925, 94868, 98115, 8817, 53860, 41005, 79922, 41515, 38266, 1378, 12333, 50293, 93600, 90029, 42698, 23180, 51019, 75391, 93527, 52994, 77323, 5948, 34016, 49119, 9197, 15918, 47795, 38578, 26745, 39060, 87468, 29371, 48659, 33845, 3227, 39838, 47813, 25779, 61692, 20734, 98410, 44904, 9785, 603, 16665, 91575, 75527, 81066, 18053, 52450, 98988, 8925, 41580, 38145, 71267, 78444, 43868, 74913, 10676, 30272, 16082, 35236, 84495, 72873, 38985, 66126, 55458, 14117, 51007, 36497, 59455, 41814, 89668, 84849, 47605, 84714, 8197, 68388, 26565, 52432, 66489, 64526, 33287, 59047, 47043, 17100, 92487, 95003, 69904, 45001, 18659, 59900, 4113, 68184, 36689, 72134, 90930, 61663, 44149, 59312, 32196, 9902, 89717, 98958, 36692, 10736, 75542, 49675, 55789, 46271, 91628, 12721, 3261, 4675, 29470, 97379, 99024, 5658, 14629, 25488, 25209, 45862, 38471, 29679, 86340, 44242, 41309, 32513, 34495, 51777, 37649, 44959, 40139, 50651, 79429, 16393, 34040, 57926, 87114, 65812, 11608, 95097, 54050, 84306, 36079, 77442, 82807, 70477, 71060, 78222, 47807, 4950, 36861, 18893, 71148, 76830, 34284, 58257, 53828, 58573, 29124, 35685, 66387, 99432, 40488, 25855, 74684, 45340, 53658, 27211, 48948, 74623] 4))
34
+
35
+ test9 :: Test
36
+ test9 = TestCase (assertEqual "for (sumIndicesWithKSetBits [17968, 97887, 78122, 11435, 96193, 88913, 23831, 54875, 73835, 73214, 61748, 37785, 37628, 99097, 46820, 18573, 37933, 43624, 12001, 67568, 44909, 541, 31756, 97685, 53030, 30204, 19227, 43241, 33379, 57612, 66508, 59743, 24597, 26684, 59528, 95588, 62832, 89975, 88084, 59179, 84300, 28377, 84112, 99903, 90042, 32961, 43193, 28481, 73401, 54685, 54754, 13122, 41186, 49551, 80202, 57682, 83670, 4216, 18258, 1823, 13148, 32835, 42689, 61471, 45610, 8061, 75270, 9802, 50388, 69802, 30811, 10031, 10523, 81150, 57971, 58729, 86735, 77752, 17637, 74367, 40336, 78957, 43158, 67239, 46645, 52957, 21387, 73128, 30542, 1449, 98432, 22981, 6815, 29865, 21184, 52408, 88741, 24413, 76163, 51111, 95155, 72051, 68794, 31593, 88122, 66118, 34065, 34488, 12939, 7337, 19995, 61341, 438, 66681, 95693, 75952, 70375, 46324, 14320, 71860, 22078, 13678, 1454, 27556, 11766, 3196, 13734, 12486, 56556, 30052, 23850, 56764, 82676, 30423, 38975, 69517, 95353, 30874, 41224, 79926, 29879, 40214, 7291, 80404, 22156, 14362, 78846, 61074, 2011, 19423, 77593, 26098, 35611, 47988, 91283, 32997, 72431, 57339, 78893, 20668, 53889, 58539, 6200, 24438, 96256, 86549, 43255, 2618, 7392, 838, 88970, 7064, 35175, 98946, 96330, 90304, 86283, 15630, 21953, 91564, 27841, 88462, 57261, 11512, 11501, 30821, 77628, 35380, 39367, 20936, 38196, 55234, 61245, 89258, 8283, 30103, 58425, 7102, 28061, 57841, 42308, 7471, 62767, 50302, 70658, 55978, 4103, 38073, 79021, 46966, 66365, 76162, 5680, 42524, 71477, 40791, 77771, 17105, 48415, 90466, 35560, 6217, 28370, 95390, 88488, 17845, 12010, 58986, 6855, 58549, 33065, 33077, 12023, 54267, 25750, 92513, 94718, 5717, 52702, 57704, 17386, 71304, 16180, 43394, 55949, 90901, 35981, 7883, 33367, 23022, 1703, 43001, 42395, 32279, 18817, 51030, 66692, 5154, 86696, 83161, 32320, 57562, 70891, 78278, 41201, 67445, 14983, 26534, 31933, 75782, 18400, 84016, 53684, 29514, 87880, 59009, 24655, 14794, 96578, 70868, 30113, 27522, 7274, 88363, 21889, 92819, 82389, 12563, 67781, 18718, 41793, 45378, 54104, 15399, 54216, 79551, 54775, 56831, 82908, 33399, 36247, 86010, 14666, 55412, 23472, 34107, 53634, 18667, 65115, 64966, 9269, 96435, 48195, 37042, 12819, 34351, 8607, 75216, 48973, 52077, 38520, 1379, 95958, 24316, 44771, 44506, 8118, 57606, 41771, 51978, 65813, 9037, 25645, 69796, 99793, 27524, 30890, 40958, 18202, 33267, 5107, 41622, 39202, 54057, 81818, 47186, 24786, 79234, 99691, 51990, 56167, 60269, 9690, 74813, 18055, 99850, 15406, 92262, 2502, 10060, 88645, 21772, 52316, 82014, 73658, 4945, 66311, 54785, 17196, 92400, 38029, 40314, 17976, 18189, 1939, 86639, 78688, 13368, 53437, 5567, 72816, 45094, 38781, 78106, 55039, 94524, 59755, 76944, 97897, 2320, 58210, 19235, 43371, 21847, 44570, 30884, 64032, 44878, 35304, 63708, 75150, 45850, 6610, 88238, 46927, 8705, 75614, 80089, 96308, 25036, 90419, 42446, 39197, 55106, 25645, 2320, 34489, 40811, 47316, 85461, 90314, 96701, 20060, 1576, 95130, 758, 61693, 71591, 42146, 89045, 39359, 82180, 2712, 13495] 0)," 17968 (sumIndicesWithKSetBits [17968, 97887, 78122, 11435, 96193, 88913, 23831, 54875, 73835, 73214, 61748, 37785, 37628, 99097, 46820, 18573, 37933, 43624, 12001, 67568, 44909, 541, 31756, 97685, 53030, 30204, 19227, 43241, 33379, 57612, 66508, 59743, 24597, 26684, 59528, 95588, 62832, 89975, 88084, 59179, 84300, 28377, 84112, 99903, 90042, 32961, 43193, 28481, 73401, 54685, 54754, 13122, 41186, 49551, 80202, 57682, 83670, 4216, 18258, 1823, 13148, 32835, 42689, 61471, 45610, 8061, 75270, 9802, 50388, 69802, 30811, 10031, 10523, 81150, 57971, 58729, 86735, 77752, 17637, 74367, 40336, 78957, 43158, 67239, 46645, 52957, 21387, 73128, 30542, 1449, 98432, 22981, 6815, 29865, 21184, 52408, 88741, 24413, 76163, 51111, 95155, 72051, 68794, 31593, 88122, 66118, 34065, 34488, 12939, 7337, 19995, 61341, 438, 66681, 95693, 75952, 70375, 46324, 14320, 71860, 22078, 13678, 1454, 27556, 11766, 3196, 13734, 12486, 56556, 30052, 23850, 56764, 82676, 30423, 38975, 69517, 95353, 30874, 41224, 79926, 29879, 40214, 7291, 80404, 22156, 14362, 78846, 61074, 2011, 19423, 77593, 26098, 35611, 47988, 91283, 32997, 72431, 57339, 78893, 20668, 53889, 58539, 6200, 24438, 96256, 86549, 43255, 2618, 7392, 838, 88970, 7064, 35175, 98946, 96330, 90304, 86283, 15630, 21953, 91564, 27841, 88462, 57261, 11512, 11501, 30821, 77628, 35380, 39367, 20936, 38196, 55234, 61245, 89258, 8283, 30103, 58425, 7102, 28061, 57841, 42308, 7471, 62767, 50302, 70658, 55978, 4103, 38073, 79021, 46966, 66365, 76162, 5680, 42524, 71477, 40791, 77771, 17105, 48415, 90466, 35560, 6217, 28370, 95390, 88488, 17845, 12010, 58986, 6855, 58549, 33065, 33077, 12023, 54267, 25750, 92513, 94718, 5717, 52702, 57704, 17386, 71304, 16180, 43394, 55949, 90901, 35981, 7883, 33367, 23022, 1703, 43001, 42395, 32279, 18817, 51030, 66692, 5154, 86696, 83161, 32320, 57562, 70891, 78278, 41201, 67445, 14983, 26534, 31933, 75782, 18400, 84016, 53684, 29514, 87880, 59009, 24655, 14794, 96578, 70868, 30113, 27522, 7274, 88363, 21889, 92819, 82389, 12563, 67781, 18718, 41793, 45378, 54104, 15399, 54216, 79551, 54775, 56831, 82908, 33399, 36247, 86010, 14666, 55412, 23472, 34107, 53634, 18667, 65115, 64966, 9269, 96435, 48195, 37042, 12819, 34351, 8607, 75216, 48973, 52077, 38520, 1379, 95958, 24316, 44771, 44506, 8118, 57606, 41771, 51978, 65813, 9037, 25645, 69796, 99793, 27524, 30890, 40958, 18202, 33267, 5107, 41622, 39202, 54057, 81818, 47186, 24786, 79234, 99691, 51990, 56167, 60269, 9690, 74813, 18055, 99850, 15406, 92262, 2502, 10060, 88645, 21772, 52316, 82014, 73658, 4945, 66311, 54785, 17196, 92400, 38029, 40314, 17976, 18189, 1939, 86639, 78688, 13368, 53437, 5567, 72816, 45094, 38781, 78106, 55039, 94524, 59755, 76944, 97897, 2320, 58210, 19235, 43371, 21847, 44570, 30884, 64032, 44878, 35304, 63708, 75150, 45850, 6610, 88238, 46927, 8705, 75614, 80089, 96308, 25036, 90419, 42446, 39197, 55106, 25645, 2320, 34489, 40811, 47316, 85461, 90314, 96701, 20060, 1576, 95130, 758, 61693, 71591, 42146, 89045, 39359, 82180, 2712, 13495] 0))
37
+
38
+
39
+ -- Grouping test cases
40
+ tests :: Test
41
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6, TestLabel "Test7" test7, TestLabel "Test8" test8, TestLabel "Test9" test9]
42
+
43
+ -- Running the tests
44
+ main :: IO Counts
45
+ main = runTestTT tests
sum_of_values_at_indices_with_k_set_bits/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(13, sumIndicesWithKSetBits(new ArrayList<>(Arrays.asList(5,10,1,5,2)), 1));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(1, sumIndicesWithKSetBits(new ArrayList<>(Arrays.asList(4,3,2,1)), 2));
19
+ }
20
+
21
+ }
sum_of_values_at_indices_with_k_set_bits/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
sum_of_values_at_indices_with_k_set_bits/ocaml_tests/main.ml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal 13 (sumIndicesWithKSetBits [5;10;1;5;2] 1)
12
+
13
+ let test2 _ = assert_equal 1 (sumIndicesWithKSetBits [4;3;2;1] 2)
14
+
15
+ let test3 _ = assert_equal 1004607 (sumIndicesWithKSetBits [68106; 38537; 64713; 74318; 6006; 46213; 18015; 47880; 62297; 41588; 65477; 39949; 62895; 44985; 65995; 99659; 18273; 55105; 56262; 43354; 54733; 28407; 45058; 98235; 85163; 11214; 11639; 28042; 20887; 13202; 95214; 52324; 64273; 73730; 46133; 22802; 65820; 10398; 57531; 56314; 28721; 95071; 87948; 42900; 79783; 57144; 45904; 86334; 10905; 90295; 48239; 74923; 42596; 16417; 69854; 52649; 78038; 94030; 99898; 98085; 22942; 7898; 89953; 67838; 95096; 83749; 50060; 72456; 38585; 34551; 85773; 66609; 47135; 92060] 2)
16
+
17
+ let test4 _ = assert_equal 954111 (sumIndicesWithKSetBits [6272; 30197; 14726; 85546; 24377; 37456; 78319; 24156; 59515; 30049; 92015; 21049; 3220; 93926; 73958; 48944; 42471; 27391; 73056; 90772; 48639; 92305; 60775; 6542; 51233; 6025; 74867; 52007; 51618; 77508; 11221; 7189; 62785; 38806; 36311; 27556; 45228; 99305; 64539; 75637; 82339; 56128; 27872; 57106; 23328; 73582; 15835; 87859; 92823; 12181; 25909; 38460; 84398; 67227; 60591; 99918; 73562; 28204; 17581; 16171; 36992; 36659; 19823; 99381; 42417; 32222; 19634; 11315; 68611; 17152; 84762; 81091; 11213; 12048; 58152; 10235; 29446; 96786; 94069] 2)
18
+
19
+ let test5 _ = assert_equal 4276161 (sumIndicesWithKSetBits [46971; 86002; 93986; 72497; 94959; 64944; 39917; 35042; 48791; 42267; 14403; 94054; 10603; 81402; 47189; 85770; 86921; 5130; 7668; 24445; 11680; 41562; 73578; 33447; 78436; 66079; 38951; 70182; 57338; 70241; 3458; 2766; 19702; 2296; 85200; 52343; 66821; 44946; 35929; 4062; 5444; 1215; 57412; 58081; 49883; 56874; 77429; 25551; 60353; 8244; 96773; 35728; 25669; 72693; 46608; 19401; 87834; 75762; 50959; 32704; 8650; 95942; 11820; 59200; 81686; 45975; 68900; 99806; 13483; 23886; 76700; 42126; 58639; 47243; 49640; 1640; 24664; 11233; 19739; 24493; 72883; 15397; 75595; 22314; 47332; 11886; 82540; 21478; 36127; 93344; 39653; 50188; 23508; 43668; 86866; 18950; 37766; 92300; 93147; 7977; 74758; 4881; 38658; 36699; 87592; 38686; 10753; 10513; 12344; 97293; 9896; 7888; 34211; 882; 2979; 28033; 30773; 16664; 76029; 29772; 23706; 47568; 69964; 86788; 72794; 33683; 92705; 73707; 41446; 72023; 10821; 87700; 36492; 26782; 51546; 67038; 70553; 77553; 4361; 2918; 81424; 68427; 9094; 53942; 82880; 65731; 99853; 50558; 88353; 1311; 82043; 13470; 18261; 21977; 22437; 2497; 56477; 83203; 80412; 43887; 29682; 5042; 11071; 88312; 4605; 7443; 92223; 41798; 92879; 63692; 34880; 9790; 19018; 34767; 55399; 5197; 46813; 94401; 45215; 9850; 62131; 74185; 47713; 29586; 42224; 93766; 84341; 87106; 62738; 17162; 91990; 68557; 97193; 93383; 25960; 22202; 21223; 70812; 98927; 43544; 70336; 75793; 52859; 95459; 15109; 84146; 89836; 92557; 2461; 57734; 7292; 55031; 25469; 56923; 89555; 98188; 55860; 94096; 25961; 77249; 68555; 3366; 78293; 81821; 82374; 61536; 16356; 38715; 17820; 42199; 45689; 15921; 46549; 58785; 93511; 89746; 25153; 3221; 94981; 90489; 31873; 98530; 44048; 84189; 93313; 39039; 51274; 24141; 30218; 39442; 29803; 9493; 17426; 25521; 34793; 95109; 27656; 87670; 79528; 73044; 13550; 80051; 86988; 24962; 86197; 51566; 22590; 29451; 35992; 78801; 82541; 80732; 90117; 59762; 56636; 818; 77721; 8660; 79390; 48461; 86940; 67011; 73502; 9367; 45511; 56947; 38398; 72568; 37765; 96600; 30482; 70; 31985; 56397; 87987; 17339; 28465; 9890; 82854; 86550; 89187; 25224; 3472; 56191; 22607; 26602; 42150; 97851; 51198; 47168; 55873; 83722; 74101; 87316; 38451; 91155; 82969; 48667; 29059; 71257; 197; 44227; 8328; 77530; 93698; 83983; 43977; 40936; 56677; 31692; 13545; 97799; 62337; 78431; 31468; 91813; 29214; 39553; 37498; 16559; 72809; 81745; 32036; 45067; 83726; 74629; 61075; 76786; 83897; 58341] 5)
20
+
21
+ let test6 _ = assert_equal 7701068 (sumIndicesWithKSetBits [51551; 30382; 18896; 34017; 46568; 11896; 86545; 94478; 18293; 21741; 97953; 85873; 28969; 12553; 79382; 513; 50932; 14125; 45912; 78824; 96253; 47288; 56434; 58736; 56722; 58755; 25460; 76404; 77456; 59429; 82124; 9022; 54042; 2186; 33885; 55844; 78868; 99078; 63262; 12076; 72799; 94522; 69810; 39086; 31672; 99180; 8530; 3040; 9731; 48235; 38507; 2017; 5643; 1612; 50805; 52771; 89057; 34756; 99510; 10145; 41457; 88925; 92588; 12434; 80559; 53883; 61986; 89260; 12074; 55290; 94366; 16282; 8208; 50037; 66081; 3366; 26662; 37625; 88327; 81167; 76718; 38128; 54737; 82075; 55091; 7930; 4914; 70182; 89385; 92601; 29676; 65344; 69844; 39582; 34836; 21910; 61202; 19859; 25762; 23025; 22974; 55848; 4331; 36403; 54073; 80450; 61143; 60589; 98677; 37572; 31886; 26017; 66597; 95033; 26683; 24662; 19392; 92679; 31047; 74014; 46817; 6504; 27071; 30342; 93699; 75694; 27976; 62807; 2363; 14411; 78783; 67747; 78736; 96321; 28748; 62754; 77938; 50408; 1236; 13206; 29091; 24935; 72435; 2766; 10563; 26167; 63833; 62978; 20706; 42553; 45948; 49328; 82610; 54240; 76623; 99903; 75864; 61801; 5326; 13645; 18197; 44033; 27403; 37055; 23032; 85026; 97943; 11782; 3711; 71444; 34404; 46620; 17273; 13375; 86830; 57392; 26715; 22383; 10170; 8214; 58261; 88849; 45791; 6819; 63814; 29213; 83114; 6879; 41144; 22005; 32476; 56464; 82017; 51763; 3406; 47652; 8224; 1723; 82387; 65145; 17618; 67061; 66715; 39680; 63271; 81370; 34119; 91545; 89963; 19204; 30645; 29601; 80532; 81088; 44687; 40468; 60092; 45989; 31598; 74176; 34757; 75986; 72649; 70358; 59397; 59953; 84501; 296; 43935; 44099; 80562; 75087; 46616; 54742; 13267; 81548; 20654; 79129; 63898; 84475; 42672; 21797; 74680; 96092; 86241; 46286; 92655; 46400; 72334; 58743; 17980; 8212; 46171; 15967; 6103; 73319; 62132; 18696; 25305; 61132; 84732; 59204; 60511; 34915; 16507; 35832; 86911; 75294; 9258; 66093; 19978; 21258; 82128; 22965; 5735; 3609; 87694; 83985; 38695; 16582; 43295; 55280; 38190; 64196; 26332; 97257; 71280; 98361; 13020; 52828; 21350; 91330; 43100; 8847; 97213; 28316; 99649; 70934; 19452; 42454; 8547; 51031; 58892; 90145; 97412; 60041; 65356; 8193; 47840; 82218; 22884; 22415; 68951; 47798; 53320; 95281; 49517; 13709; 17373; 83351; 85478; 99738; 7194; 31629; 82911; 2993; 83450; 89582; 35364; 21107; 35168; 27337; 78110; 29513; 46027; 3906; 17389; 62167; 57411; 3130; 21661; 60978; 73522; 65420; 17913; 75331; 97421; 93151; 6339; 16130; 57238; 19829; 57831; 78285; 17235; 57578; 48551; 89149; 26763; 99585; 77049; 53743; 32588; 76442; 94247; 31134; 6849; 60801; 44249; 70802; 53445; 46957; 611; 68427; 48951; 95725; 13104; 9492; 56321; 89549; 51197; 27439; 5866; 18186; 21480; 9719; 21397; 56402; 14633; 3968; 96777; 24366; 38597; 89427; 37945; 54042; 43323; 84770; 71844; 82624; 79773; 98479; 92998; 973; 74774; 93069; 73191; 70306; 33742; 15726; 83553; 92223; 67431; 90421; 22654; 37288; 68160; 45651; 66778; 58519; 61044; 69417; 62033; 25209; 17278; 92970; 70174; 38190; 81775; 56539; 28545; 76326; 67341; 73726; 49455; 20745; 66515; 70672; 85847; 47032; 15346; 24057; 94336; 10796; 24126; 96823; 99884; 24236; 39648; 45352; 16513; 91130; 65252; 14732; 79920; 23690; 51513; 63137; 76521; 19406; 21046; 58266; 59300; 35998; 9731; 14954; 47760; 6506; 80634; 89565; 31543; 42655; 61111; 74532; 34042; 31856; 15184; 44206; 36958; 69263; 6348; 8023; 11457; 43596; 82890; 23579; 53967; 52353; 2774; 53783; 11914; 5829; 90225; 57623; 23407; 17210; 12140; 48627; 85102; 65583; 54527; 64073; 14075; 74869; 54954; 64618; 91559; 64274; 25892; 38198; 41; 8097; 72423; 7753; 2565; 90433; 1905; 67400; 97991; 16984; 35868; 22685; 57323; 46768; 98193; 98218; 16893; 16249; 93374; 13693; 12693; 45058; 53776; 37651; 37522; 12349; 12620; 20521; 69535; 27154; 482; 2770; 94592; 72341; 54150; 29834; 38446; 99302; 46825; 83405; 637; 39323; 78290; 9488; 73773; 52293; 92088; 2156; 14719; 59983; 8266; 38888; 46163; 29960; 65222; 74995; 3555; 97043; 87939; 69699; 87491; 49415; 32862; 85069; 29779; 31133; 39558; 2771; 70251; 12928; 93794; 90181; 458; 46069; 46291; 33871; 97849; 34483; 51467; 83114; 71419; 55019; 71852; 76102; 26120; 62891; 28756; 81100; 29215; 72923; 77731; 50567; 72461; 53803; 32695; 15976; 12020; 49989; 97819; 90796; 20595; 13269; 73849; 31975; 68086; 35116; 86665; 96173; 3794; 35516; 34447; 46409; 50300; 14845; 12476; 36817; 78320] 5)
22
+
23
+ let test7 _ = assert_equal 799767 (sumIndicesWithKSetBits [79755; 37830; 51603; 11779; 20405; 52651; 69395; 31317; 23631; 8966; 96715; 8478; 61927; 58456; 20938; 5090; 66727; 43736; 10821; 43374; 8583; 20464; 93051; 53866; 53870; 77803; 26158; 63885; 17650; 63837; 33005; 53565; 70143; 98016; 25272; 20108; 77159; 63923; 85766; 56204; 94588; 41751; 83470; 38026; 22405; 42895; 41469; 29699; 48282; 12839; 89682; 85560; 78689; 49458; 75994; 46125; 3711; 49666; 42269; 37061; 65148; 71142; 41101; 35962; 26471; 30012; 66529; 52131; 33923; 47242; 52515; 9504; 45080; 87695; 10705; 36985; 40093; 22452; 36104; 36568; 85517; 28117; 82580; 9015; 81153; 36694; 106; 56683; 83548; 19812; 61478; 33338; 69552; 73118; 84255; 49950; 69475; 10346; 17782; 86581; 69158; 89537; 95827; 37528; 83694; 61027; 72122; 54915; 74854; 31773; 37837; 65692; 43789; 91715; 4698; 65055; 77723; 8357; 56223; 73674; 2673; 48566; 97969; 21819; 85155; 1299; 79238; 17951; 3490; 66130; 20619; 43364; 78751; 13996; 25337; 64575; 29338; 55681; 66403; 22644; 99104; 8460; 61516; 93347; 1107; 72580; 86365; 55535; 15714; 88934; 80297; 31204; 78645; 55654; 34968; 42650; 7371; 49482; 59311; 50236; 90995; 97922; 55732; 43349; 6779; 92145; 82918; 80968; 20157; 64462; 82287; 8020; 15411; 11488; 2559; 4992; 85542; 59896; 35960; 33593; 6679; 20699; 74000; 57335; 79139; 66934; 98452; 61796; 28957; 15880; 730; 60812; 49816; 19354; 2345; 17796; 49804; 36282; 42297; 41134; 83431; 97087; 47980; 11404; 84622; 3787; 78774; 50038; 37887; 1097; 78862; 72653; 48372; 4675; 89778; 99888; 23842; 57881; 67484; 4859; 98577; 55461; 70745; 42524; 10659; 52857; 23132; 5375; 87980; 96153; 2649; 15684; 29858; 13166; 17680; 8057; 60463; 8420; 73883; 56362; 93760; 96525; 76869; 85699; 64835; 59409; 6539; 82024; 60304; 50915; 68137; 79997; 42064; 40113; 71537; 78302; 72977; 61888; 84966; 28668; 53650; 95236; 13116; 93975; 97959; 32101; 79344; 86068; 51992; 23236; 30989; 3623; 76269; 43971; 4783; 55864; 31572; 48890; 13734; 63263; 63305; 49912; 35183; 97418; 67778; 81285; 44353; 3110; 38977; 95270; 85268; 98997; 20996; 56635; 80980; 57876; 28024; 92590; 46679; 90805; 8521; 18605; 13712; 93387; 53813; 98416; 97966; 45031; 61940; 27826; 39157; 62096; 18492; 70734; 19786; 79807; 27407; 99401; 5552; 72522; 3321; 92343; 4814; 70503; 48616; 69105; 10153; 60796; 82731; 7158; 46614; 45602; 89209; 46744; 34973; 5088; 37247; 50077; 62982; 63903; 77019; 77890; 66015; 58847; 18087; 27423; 26243; 14178; 35174; 71888; 83363; 1544; 88981; 183; 90176; 27786; 26213; 93836; 14017; 28901; 93401; 46888; 54671; 96926; 63159; 44441; 94026; 36511; 95903; 74800; 9010; 80204; 20266; 67677; 37899; 86492; 52007; 61689; 66556; 50443; 98305; 77822; 23113; 12049; 45884; 72119; 33953; 44999; 73538; 90546; 80143; 59147; 60413; 54638; 20177; 75914; 77348; 27248; 2920; 89116; 7266; 3996; 62128; 93494; 71972; 61540; 22523] 7)
24
+
25
+ let test8 _ = assert_equal 7525991 (sumIndicesWithKSetBits [38376; 1193; 60608; 86207; 60101; 51277; 70510; 96627; 41126; 70517; 99795; 68631; 15450; 61367; 26192; 1455; 44152; 70202; 5912; 91181; 27463; 84440; 75307; 54399; 2252; 91869; 69595; 93618; 25501; 28704; 85175; 77733; 44298; 97916; 18899; 91919; 23444; 5106; 11203; 84948; 10507; 97068; 63393; 37719; 81095; 5518; 61160; 52080; 57072; 94703; 70941; 94557; 39199; 8906; 41313; 93232; 18234; 39093; 99607; 12469; 22181; 80964; 71837; 49195; 95932; 35437; 99469; 94990; 9549; 46456; 34323; 41944; 77744; 50474; 70530; 52797; 76497; 46367; 58795; 52094; 12958; 69639; 43298; 31437; 36074; 96308; 75795; 84242; 29478; 49251; 4991; 41645; 16365; 13225; 6483; 75049; 24964; 89148; 49495; 52484; 74160; 44713; 88442; 24803; 32271; 14009; 41511; 97460; 84080; 48143; 30288; 85673; 85301; 60111; 68636; 69307; 30817; 2224; 84755; 5472; 76532; 463; 4878; 89328; 2290; 8919; 90475; 66751; 8211; 84034; 85785; 16083; 49686; 70391; 56786; 63913; 64107; 25282; 74636; 12345; 66694; 86448; 4514; 71439; 14847; 94446; 5921; 45066; 46148; 85800; 99819; 36149; 8611; 18126; 2843; 71497; 41959; 22205; 74842; 72160; 9662; 39788; 46996; 27799; 48652; 93112; 37892; 95183; 67504; 13952; 25398; 7073; 78142; 68708; 27067; 7229; 35439; 88965; 19968; 27853; 90597; 51178; 99277; 53548; 36695; 99486; 65735; 82392; 40972; 36534; 93558; 13159; 66209; 20630; 95090; 38115; 66169; 70997; 73047; 78502; 93303; 18346; 85427; 14251; 995; 72691; 66191; 54038; 62546; 82954; 7015; 36950; 12410; 30528; 55289; 13481; 21292; 9064; 63761; 17746; 31897; 14567; 17021; 57968; 57636; 26846; 52257; 41701; 57454; 89969; 4676; 25051; 87539; 86646; 30573; 10462; 30662; 33151; 84492; 27008; 17626; 21905; 21011; 42733; 32790; 18861; 22549; 50833; 67035; 26935; 25380; 24372; 80339; 86520; 26480; 99568; 83122; 67410; 16497; 8373; 60935; 42808; 70103; 60056; 82962; 12486; 82949; 85143; 53545; 74920; 70934; 13495; 75788; 51579; 77453; 86602; 3189; 89085; 68143; 9035; 13887; 36515; 17960; 5010; 43502; 34949; 32460; 67072; 80070; 2157; 64967; 41716; 65762; 41121; 36486; 86496; 54740; 99571; 6846; 51193; 47112; 61073; 22322; 66132; 91382; 96146; 16580; 38233; 94185; 28167; 27569; 30182; 53788; 53621; 38012; 15960; 1335; 98632; 26701; 73055; 84578; 19708; 91118; 21342; 53904; 62555; 66034; 48205; 67943; 23923; 44330; 39232; 68632; 34599; 93020; 43825; 26421; 62259; 43994; 41849; 35410; 98035; 87796; 59041; 88049; 19997; 92958; 31806; 964; 32525; 86490; 55530; 33143; 94690; 25232; 94164; 17309; 85836; 10418; 11088; 86326; 16; 69035; 57808; 61376; 85521; 71876; 83820; 9340; 9231; 75397; 94074; 10576; 83044; 64745; 33498; 31324; 4401; 51926; 58188; 6426; 87721; 26294; 75982; 82350; 25523; 62131; 86549; 24658; 53734; 1998; 34277; 188; 77879; 11876; 93106; 37688; 8404; 63191; 7348; 92925; 94868; 98115; 8817; 53860; 41005; 79922; 41515; 38266; 1378; 12333; 50293; 93600; 90029; 42698; 23180; 51019; 75391; 93527; 52994; 77323; 5948; 34016; 49119; 9197; 15918; 47795; 38578; 26745; 39060; 87468; 29371; 48659; 33845; 3227; 39838; 47813; 25779; 61692; 20734; 98410; 44904; 9785; 603; 16665; 91575; 75527; 81066; 18053; 52450; 98988; 8925; 41580; 38145; 71267; 78444; 43868; 74913; 10676; 30272; 16082; 35236; 84495; 72873; 38985; 66126; 55458; 14117; 51007; 36497; 59455; 41814; 89668; 84849; 47605; 84714; 8197; 68388; 26565; 52432; 66489; 64526; 33287; 59047; 47043; 17100; 92487; 95003; 69904; 45001; 18659; 59900; 4113; 68184; 36689; 72134; 90930; 61663; 44149; 59312; 32196; 9902; 89717; 98958; 36692; 10736; 75542; 49675; 55789; 46271; 91628; 12721; 3261; 4675; 29470; 97379; 99024; 5658; 14629; 25488; 25209; 45862; 38471; 29679; 86340; 44242; 41309; 32513; 34495; 51777; 37649; 44959; 40139; 50651; 79429; 16393; 34040; 57926; 87114; 65812; 11608; 95097; 54050; 84306; 36079; 77442; 82807; 70477; 71060; 78222; 47807; 4950; 36861; 18893; 71148; 76830; 34284; 58257; 53828; 58573; 29124; 35685; 66387; 99432; 40488; 25855; 74684; 45340; 53658; 27211; 48948; 74623] 4)
26
+
27
+ let test9 _ = assert_equal 17968 (sumIndicesWithKSetBits [17968; 97887; 78122; 11435; 96193; 88913; 23831; 54875; 73835; 73214; 61748; 37785; 37628; 99097; 46820; 18573; 37933; 43624; 12001; 67568; 44909; 541; 31756; 97685; 53030; 30204; 19227; 43241; 33379; 57612; 66508; 59743; 24597; 26684; 59528; 95588; 62832; 89975; 88084; 59179; 84300; 28377; 84112; 99903; 90042; 32961; 43193; 28481; 73401; 54685; 54754; 13122; 41186; 49551; 80202; 57682; 83670; 4216; 18258; 1823; 13148; 32835; 42689; 61471; 45610; 8061; 75270; 9802; 50388; 69802; 30811; 10031; 10523; 81150; 57971; 58729; 86735; 77752; 17637; 74367; 40336; 78957; 43158; 67239; 46645; 52957; 21387; 73128; 30542; 1449; 98432; 22981; 6815; 29865; 21184; 52408; 88741; 24413; 76163; 51111; 95155; 72051; 68794; 31593; 88122; 66118; 34065; 34488; 12939; 7337; 19995; 61341; 438; 66681; 95693; 75952; 70375; 46324; 14320; 71860; 22078; 13678; 1454; 27556; 11766; 3196; 13734; 12486; 56556; 30052; 23850; 56764; 82676; 30423; 38975; 69517; 95353; 30874; 41224; 79926; 29879; 40214; 7291; 80404; 22156; 14362; 78846; 61074; 2011; 19423; 77593; 26098; 35611; 47988; 91283; 32997; 72431; 57339; 78893; 20668; 53889; 58539; 6200; 24438; 96256; 86549; 43255; 2618; 7392; 838; 88970; 7064; 35175; 98946; 96330; 90304; 86283; 15630; 21953; 91564; 27841; 88462; 57261; 11512; 11501; 30821; 77628; 35380; 39367; 20936; 38196; 55234; 61245; 89258; 8283; 30103; 58425; 7102; 28061; 57841; 42308; 7471; 62767; 50302; 70658; 55978; 4103; 38073; 79021; 46966; 66365; 76162; 5680; 42524; 71477; 40791; 77771; 17105; 48415; 90466; 35560; 6217; 28370; 95390; 88488; 17845; 12010; 58986; 6855; 58549; 33065; 33077; 12023; 54267; 25750; 92513; 94718; 5717; 52702; 57704; 17386; 71304; 16180; 43394; 55949; 90901; 35981; 7883; 33367; 23022; 1703; 43001; 42395; 32279; 18817; 51030; 66692; 5154; 86696; 83161; 32320; 57562; 70891; 78278; 41201; 67445; 14983; 26534; 31933; 75782; 18400; 84016; 53684; 29514; 87880; 59009; 24655; 14794; 96578; 70868; 30113; 27522; 7274; 88363; 21889; 92819; 82389; 12563; 67781; 18718; 41793; 45378; 54104; 15399; 54216; 79551; 54775; 56831; 82908; 33399; 36247; 86010; 14666; 55412; 23472; 34107; 53634; 18667; 65115; 64966; 9269; 96435; 48195; 37042; 12819; 34351; 8607; 75216; 48973; 52077; 38520; 1379; 95958; 24316; 44771; 44506; 8118; 57606; 41771; 51978; 65813; 9037; 25645; 69796; 99793; 27524; 30890; 40958; 18202; 33267; 5107; 41622; 39202; 54057; 81818; 47186; 24786; 79234; 99691; 51990; 56167; 60269; 9690; 74813; 18055; 99850; 15406; 92262; 2502; 10060; 88645; 21772; 52316; 82014; 73658; 4945; 66311; 54785; 17196; 92400; 38029; 40314; 17976; 18189; 1939; 86639; 78688; 13368; 53437; 5567; 72816; 45094; 38781; 78106; 55039; 94524; 59755; 76944; 97897; 2320; 58210; 19235; 43371; 21847; 44570; 30884; 64032; 44878; 35304; 63708; 75150; 45850; 6610; 88238; 46927; 8705; 75614; 80089; 96308; 25036; 90419; 42446; 39197; 55106; 25645; 2320; 34489; 40811; 47316; 85461; 90314; 96701; 20060; 1576; 95130; 758; 61693; 71591; 42146; 89045; 39359; 82180; 2712; 13495] 0)
28
+
29
+ let test10 _ = assert_equal 374027 (sumIndicesWithKSetBits [38079; 51195; 18615; 11635; 86451; 70730; 31508; 66071; 24341; 93218; 12602; 7960; 50506; 97853; 63006; 21536; 61515; 26081; 73011; 24930; 84463; 43429; 18109; 89686; 58997; 75466; 52589; 96755; 22514; 63295; 93839; 51177; 66910; 26062; 75372; 55629; 6842; 78295; 6989; 83628; 88239; 97066; 79638; 26216; 64127; 91335; 1524; 85999; 78038; 20031; 66092; 96643; 57387; 31874; 91824; 69879; 73301; 54590; 43141; 26021; 92778; 24956; 17323; 12079; 86836; 69278; 33410; 57021; 38402; 13441; 2572; 26010; 62126; 42988; 24198; 54898; 92463; 71614; 83020; 2007; 34723; 38052; 8803; 53124; 86041; 17925; 85324; 42385; 28679; 31229; 87030; 70369; 61193; 85259; 30474; 84823; 11478; 71110; 23297; 49679; 99960; 29662; 11999; 59839; 3693; 56160; 23701; 99290; 94512; 69094; 26245; 85088; 4080; 94028; 37046; 79896; 67038; 71349; 35336; 86662; 45591; 32909; 7256; 10195; 28578; 67301; 60454; 17404; 28510; 32450; 65134; 2210; 80350; 57075; 50281; 24974; 556; 74876; 37418; 90951; 2385; 86118; 26649; 12787; 42257; 12296; 58380; 59031; 61773; 40732; 22603; 25093; 5414; 65835; 4566; 50607; 93998; 84131; 93013; 11044; 47581; 24133; 23219; 80600; 65142; 44477; 26947; 22503; 15391; 86683; 71230; 52390; 2068; 90418; 6895; 9168; 22246; 9579; 17209; 5653; 17341; 78047; 72835; 56283; 27989; 71118; 83288; 61071; 90327; 95061; 51862; 47953; 21451; 68139; 39679; 44396; 82872; 88934; 87950; 63538; 62229; 51038; 86151; 98895; 70802; 92113; 48321; 81345; 60800; 97588; 24665; 70495; 80190; 27591; 50230; 91267; 77474; 37792; 35213; 39980; 94239; 53458; 52249; 89729; 7230; 57442; 10059; 20190; 75779; 9492; 86292; 39779; 11455; 93123; 66348; 75580; 57823; 49338; 87718; 93164; 95209; 16897; 55874; 71352; 94954; 61506; 95197; 60497; 76998; 79940; 62333; 80678; 26104; 71210; 45048; 24443; 17860; 83575; 62670; 98401; 93330; 95886; 38410; 65322; 59206; 60460; 29506; 5687; 38321; 44983; 32067; 37175; 83882; 52478; 10848; 67210; 31869; 89249; 94759; 3694; 10146; 9337; 5877; 59650; 6771; 64665; 50559; 29350; 53465; 11641; 67399; 3543; 9896; 76788; 24124; 70038; 5735; 46991; 55282; 72312; 21697; 65656; 86765; 33954; 71049; 65417; 58663; 93370; 42482; 8207; 94023; 67250; 73790; 93402; 13318; 58675; 9715; 37859; 40950; 85492; 65055; 61980; 8550; 78020; 74186; 17070; 68869; 65907; 43965; 41921; 19851; 84628; 47419; 36493; 79662; 86351; 96159; 16161; 55567; 74661; 59787; 84653; 17582; 25283; 14777; 97380; 96173; 82146; 4335; 91428; 78467; 34724; 82206; 3458; 53662; 26700; 56898; 86675; 81724; 88498; 18461; 35713; 83044; 87149; 59821; 93163; 50792; 79972; 28309; 75521; 39945; 93467; 93294; 78400; 35702; 25763; 11635; 31992; 62566; 19924; 94271; 19353; 6904; 27370; 27273; 18309; 73557; 43587; 40111; 42893; 3057; 32140; 14919; 41892; 11890; 14484; 84637; 72015; 93228; 36951; 79086; 13326; 41459; 75571; 91252; 31125; 72389; 40322; 70; 45540; 77001; 82414; 59452; 97612; 17432; 76311; 7087; 25542; 38431; 13816; 82926; 67599; 89740; 44716; 90951; 80370; 57048; 24697; 26723; 57092; 60878; 33519; 84977; 29072; 51681; 16491; 39196; 11223; 99929; 87335; 48260; 7272; 27715; 11983; 23720; 45012; 53686; 23636; 43025; 17725; 43990; 98788; 20110; 81928; 63487; 34630; 42006; 6883; 66365; 40; 33769; 28460; 53817; 21442; 7402; 75348; 10814; 73166; 86304; 4200; 53439; 93329; 81978; 28508; 92582; 53546; 97260; 94057; 49286; 51399; 74933; 21672; 73850; 40662; 18592; 44661; 99802; 61625; 60912; 26595; 80324; 34012; 74397; 9810; 99706; 13475; 24120; 78493; 39967; 68288; 45042; 49678; 29725; 44071; 54438; 59773; 99437; 3648; 36147; 73385; 32533; 46377; 40767; 28917; 11613; 9082; 21861; 80942; 44422; 66620; 94085; 83744; 24952; 15827; 99366; 71328; 27983; 30303; 8680; 33916; 23817; 2733; 92662; 49798; 56486; 21365; 46736; 66009; 91405; 18919; 55002; 73765; 59659; 84247; 35599; 62215; 3828; 24488; 74121; 24180; 83611; 91426; 3187; 67013; 78731; 18314; 78266; 55991; 82218; 78643; 16486; 84377; 54459; 13080; 45744; 68119; 50754; 6632; 81645; 87388; 73414; 48424; 44599; 91498; 10754; 58260; 80602; 87177; 40881; 87057; 41001; 60432; 67551; 48178; 40500; 50977; 91450; 87843; 54517; 3920; 48142; 71078; 61418; 95790; 5180; 27156; 24205; 99086; 9804; 11015; 63635; 93627; 65496; 46807; 21667; 97198; 57474; 3234; 19630; 52248; 21695; 48316; 41942; 29850; 36790; 20727; 41099; 93464; 61539; 48799; 86926; 7909; 62829; 84770; 41242; 67240; 59950; 85831; 59767; 67059; 41036; 81022; 21046; 27188; 91649; 57989; 74940; 44219; 59342; 80067; 37738; 51708; 26407; 31509; 29187; 94328; 32561; 88241; 67847; 75415; 9415; 78033; 43835; 64547; 83899; 49398; 76289; 71071; 94438; 9399; 43900; 22799; 82416; 7941; 60926; 61481; 93268; 80776; 42668; 69003; 22372; 64164; 75397; 16889; 25538; 15744; 20793; 29756; 94311; 30780; 24363; 73277; 47840; 70999; 82640; 6518; 26264; 64597; 48212] 8)
30
+
31
+
32
+ (* Grouping test cases *)
33
+ let suite = "Test Suite for sumIndicesWithKSetBits" >::: [
34
+
35
+ "test1" >:: test1;
36
+ "test2" >:: test2;
37
+ "test3" >:: test3;
38
+ "test4" >:: test4;
39
+ "test5" >:: test5;
40
+ "test6" >:: test6;
41
+ "test7" >:: test7;
42
+ "test8" >:: test8;
43
+ "test9" >:: test9;
44
+ "test10" >:: test10;
45
+ ]
46
+
47
+
48
+ (* Running the tests *)
49
+ let () = run_test_tt_main suite
50
+ end
sum_of_values_at_indices_with_k_set_bits/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.sumIndicesWithKSetBits(List(5,10,1,5,2),1), 13)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.sumIndicesWithKSetBits(List(4,3,2,1),2), 1)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.sumIndicesWithKSetBits(List(68106, 38537, 64713, 74318, 6006, 46213, 18015, 47880, 62297, 41588, 65477, 39949, 62895, 44985, 65995, 99659, 18273, 55105, 56262, 43354, 54733, 28407, 45058, 98235, 85163, 11214, 11639, 28042, 20887, 13202, 95214, 52324, 64273, 73730, 46133, 22802, 65820, 10398, 57531, 56314, 28721, 95071, 87948, 42900, 79783, 57144, 45904, 86334, 10905, 90295, 48239, 74923, 42596, 16417, 69854, 52649, 78038, 94030, 99898, 98085, 22942, 7898, 89953, 67838, 95096, 83749, 50060, 72456, 38585, 34551, 85773, 66609, 47135, 92060),2), 1004607)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.sumIndicesWithKSetBits(List(6272, 30197, 14726, 85546, 24377, 37456, 78319, 24156, 59515, 30049, 92015, 21049, 3220, 93926, 73958, 48944, 42471, 27391, 73056, 90772, 48639, 92305, 60775, 6542, 51233, 6025, 74867, 52007, 51618, 77508, 11221, 7189, 62785, 38806, 36311, 27556, 45228, 99305, 64539, 75637, 82339, 56128, 27872, 57106, 23328, 73582, 15835, 87859, 92823, 12181, 25909, 38460, 84398, 67227, 60591, 99918, 73562, 28204, 17581, 16171, 36992, 36659, 19823, 99381, 42417, 32222, 19634, 11315, 68611, 17152, 84762, 81091, 11213, 12048, 58152, 10235, 29446, 96786, 94069),2), 954111)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.sumIndicesWithKSetBits(List(46971, 86002, 93986, 72497, 94959, 64944, 39917, 35042, 48791, 42267, 14403, 94054, 10603, 81402, 47189, 85770, 86921, 5130, 7668, 24445, 11680, 41562, 73578, 33447, 78436, 66079, 38951, 70182, 57338, 70241, 3458, 2766, 19702, 2296, 85200, 52343, 66821, 44946, 35929, 4062, 5444, 1215, 57412, 58081, 49883, 56874, 77429, 25551, 60353, 8244, 96773, 35728, 25669, 72693, 46608, 19401, 87834, 75762, 50959, 32704, 8650, 95942, 11820, 59200, 81686, 45975, 68900, 99806, 13483, 23886, 76700, 42126, 58639, 47243, 49640, 1640, 24664, 11233, 19739, 24493, 72883, 15397, 75595, 22314, 47332, 11886, 82540, 21478, 36127, 93344, 39653, 50188, 23508, 43668, 86866, 18950, 37766, 92300, 93147, 7977, 74758, 4881, 38658, 36699, 87592, 38686, 10753, 10513, 12344, 97293, 9896, 7888, 34211, 882, 2979, 28033, 30773, 16664, 76029, 29772, 23706, 47568, 69964, 86788, 72794, 33683, 92705, 73707, 41446, 72023, 10821, 87700, 36492, 26782, 51546, 67038, 70553, 77553, 4361, 2918, 81424, 68427, 9094, 53942, 82880, 65731, 99853, 50558, 88353, 1311, 82043, 13470, 18261, 21977, 22437, 2497, 56477, 83203, 80412, 43887, 29682, 5042, 11071, 88312, 4605, 7443, 92223, 41798, 92879, 63692, 34880, 9790, 19018, 34767, 55399, 5197, 46813, 94401, 45215, 9850, 62131, 74185, 47713, 29586, 42224, 93766, 84341, 87106, 62738, 17162, 91990, 68557, 97193, 93383, 25960, 22202, 21223, 70812, 98927, 43544, 70336, 75793, 52859, 95459, 15109, 84146, 89836, 92557, 2461, 57734, 7292, 55031, 25469, 56923, 89555, 98188, 55860, 94096, 25961, 77249, 68555, 3366, 78293, 81821, 82374, 61536, 16356, 38715, 17820, 42199, 45689, 15921, 46549, 58785, 93511, 89746, 25153, 3221, 94981, 90489, 31873, 98530, 44048, 84189, 93313, 39039, 51274, 24141, 30218, 39442, 29803, 9493, 17426, 25521, 34793, 95109, 27656, 87670, 79528, 73044, 13550, 80051, 86988, 24962, 86197, 51566, 22590, 29451, 35992, 78801, 82541, 80732, 90117, 59762, 56636, 818, 77721, 8660, 79390, 48461, 86940, 67011, 73502, 9367, 45511, 56947, 38398, 72568, 37765, 96600, 30482, 70, 31985, 56397, 87987, 17339, 28465, 9890, 82854, 86550, 89187, 25224, 3472, 56191, 22607, 26602, 42150, 97851, 51198, 47168, 55873, 83722, 74101, 87316, 38451, 91155, 82969, 48667, 29059, 71257, 197, 44227, 8328, 77530, 93698, 83983, 43977, 40936, 56677, 31692, 13545, 97799, 62337, 78431, 31468, 91813, 29214, 39553, 37498, 16559, 72809, 81745, 32036, 45067, 83726, 74629, 61075, 76786, 83897, 58341),5), 4276161)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.sumIndicesWithKSetBits(List(51551, 30382, 18896, 34017, 46568, 11896, 86545, 94478, 18293, 21741, 97953, 85873, 28969, 12553, 79382, 513, 50932, 14125, 45912, 78824, 96253, 47288, 56434, 58736, 56722, 58755, 25460, 76404, 77456, 59429, 82124, 9022, 54042, 2186, 33885, 55844, 78868, 99078, 63262, 12076, 72799, 94522, 69810, 39086, 31672, 99180, 8530, 3040, 9731, 48235, 38507, 2017, 5643, 1612, 50805, 52771, 89057, 34756, 99510, 10145, 41457, 88925, 92588, 12434, 80559, 53883, 61986, 89260, 12074, 55290, 94366, 16282, 8208, 50037, 66081, 3366, 26662, 37625, 88327, 81167, 76718, 38128, 54737, 82075, 55091, 7930, 4914, 70182, 89385, 92601, 29676, 65344, 69844, 39582, 34836, 21910, 61202, 19859, 25762, 23025, 22974, 55848, 4331, 36403, 54073, 80450, 61143, 60589, 98677, 37572, 31886, 26017, 66597, 95033, 26683, 24662, 19392, 92679, 31047, 74014, 46817, 6504, 27071, 30342, 93699, 75694, 27976, 62807, 2363, 14411, 78783, 67747, 78736, 96321, 28748, 62754, 77938, 50408, 1236, 13206, 29091, 24935, 72435, 2766, 10563, 26167, 63833, 62978, 20706, 42553, 45948, 49328, 82610, 54240, 76623, 99903, 75864, 61801, 5326, 13645, 18197, 44033, 27403, 37055, 23032, 85026, 97943, 11782, 3711, 71444, 34404, 46620, 17273, 13375, 86830, 57392, 26715, 22383, 10170, 8214, 58261, 88849, 45791, 6819, 63814, 29213, 83114, 6879, 41144, 22005, 32476, 56464, 82017, 51763, 3406, 47652, 8224, 1723, 82387, 65145, 17618, 67061, 66715, 39680, 63271, 81370, 34119, 91545, 89963, 19204, 30645, 29601, 80532, 81088, 44687, 40468, 60092, 45989, 31598, 74176, 34757, 75986, 72649, 70358, 59397, 59953, 84501, 296, 43935, 44099, 80562, 75087, 46616, 54742, 13267, 81548, 20654, 79129, 63898, 84475, 42672, 21797, 74680, 96092, 86241, 46286, 92655, 46400, 72334, 58743, 17980, 8212, 46171, 15967, 6103, 73319, 62132, 18696, 25305, 61132, 84732, 59204, 60511, 34915, 16507, 35832, 86911, 75294, 9258, 66093, 19978, 21258, 82128, 22965, 5735, 3609, 87694, 83985, 38695, 16582, 43295, 55280, 38190, 64196, 26332, 97257, 71280, 98361, 13020, 52828, 21350, 91330, 43100, 8847, 97213, 28316, 99649, 70934, 19452, 42454, 8547, 51031, 58892, 90145, 97412, 60041, 65356, 8193, 47840, 82218, 22884, 22415, 68951, 47798, 53320, 95281, 49517, 13709, 17373, 83351, 85478, 99738, 7194, 31629, 82911, 2993, 83450, 89582, 35364, 21107, 35168, 27337, 78110, 29513, 46027, 3906, 17389, 62167, 57411, 3130, 21661, 60978, 73522, 65420, 17913, 75331, 97421, 93151, 6339, 16130, 57238, 19829, 57831, 78285, 17235, 57578, 48551, 89149, 26763, 99585, 77049, 53743, 32588, 76442, 94247, 31134, 6849, 60801, 44249, 70802, 53445, 46957, 611, 68427, 48951, 95725, 13104, 9492, 56321, 89549, 51197, 27439, 5866, 18186, 21480, 9719, 21397, 56402, 14633, 3968, 96777, 24366, 38597, 89427, 37945, 54042, 43323, 84770, 71844, 82624, 79773, 98479, 92998, 973, 74774, 93069, 73191, 70306, 33742, 15726, 83553, 92223, 67431, 90421, 22654, 37288, 68160, 45651, 66778, 58519, 61044, 69417, 62033, 25209, 17278, 92970, 70174, 38190, 81775, 56539, 28545, 76326, 67341, 73726, 49455, 20745, 66515, 70672, 85847, 47032, 15346, 24057, 94336, 10796, 24126, 96823, 99884, 24236, 39648, 45352, 16513, 91130, 65252, 14732, 79920, 23690, 51513, 63137, 76521, 19406, 21046, 58266, 59300, 35998, 9731, 14954, 47760, 6506, 80634, 89565, 31543, 42655, 61111, 74532, 34042, 31856, 15184, 44206, 36958, 69263, 6348, 8023, 11457, 43596, 82890, 23579, 53967, 52353, 2774, 53783, 11914, 5829, 90225, 57623, 23407, 17210, 12140, 48627, 85102, 65583, 54527, 64073, 14075, 74869, 54954, 64618, 91559, 64274, 25892, 38198, 41, 8097, 72423, 7753, 2565, 90433, 1905, 67400, 97991, 16984, 35868, 22685, 57323, 46768, 98193, 98218, 16893, 16249, 93374, 13693, 12693, 45058, 53776, 37651, 37522, 12349, 12620, 20521, 69535, 27154, 482, 2770, 94592, 72341, 54150, 29834, 38446, 99302, 46825, 83405, 637, 39323, 78290, 9488, 73773, 52293, 92088, 2156, 14719, 59983, 8266, 38888, 46163, 29960, 65222, 74995, 3555, 97043, 87939, 69699, 87491, 49415, 32862, 85069, 29779, 31133, 39558, 2771, 70251, 12928, 93794, 90181, 458, 46069, 46291, 33871, 97849, 34483, 51467, 83114, 71419, 55019, 71852, 76102, 26120, 62891, 28756, 81100, 29215, 72923, 77731, 50567, 72461, 53803, 32695, 15976, 12020, 49989, 97819, 90796, 20595, 13269, 73849, 31975, 68086, 35116, 86665, 96173, 3794, 35516, 34447, 46409, 50300, 14845, 12476, 36817, 78320),5), 7701068)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.sumIndicesWithKSetBits(List(79755, 37830, 51603, 11779, 20405, 52651, 69395, 31317, 23631, 8966, 96715, 8478, 61927, 58456, 20938, 5090, 66727, 43736, 10821, 43374, 8583, 20464, 93051, 53866, 53870, 77803, 26158, 63885, 17650, 63837, 33005, 53565, 70143, 98016, 25272, 20108, 77159, 63923, 85766, 56204, 94588, 41751, 83470, 38026, 22405, 42895, 41469, 29699, 48282, 12839, 89682, 85560, 78689, 49458, 75994, 46125, 3711, 49666, 42269, 37061, 65148, 71142, 41101, 35962, 26471, 30012, 66529, 52131, 33923, 47242, 52515, 9504, 45080, 87695, 10705, 36985, 40093, 22452, 36104, 36568, 85517, 28117, 82580, 9015, 81153, 36694, 106, 56683, 83548, 19812, 61478, 33338, 69552, 73118, 84255, 49950, 69475, 10346, 17782, 86581, 69158, 89537, 95827, 37528, 83694, 61027, 72122, 54915, 74854, 31773, 37837, 65692, 43789, 91715, 4698, 65055, 77723, 8357, 56223, 73674, 2673, 48566, 97969, 21819, 85155, 1299, 79238, 17951, 3490, 66130, 20619, 43364, 78751, 13996, 25337, 64575, 29338, 55681, 66403, 22644, 99104, 8460, 61516, 93347, 1107, 72580, 86365, 55535, 15714, 88934, 80297, 31204, 78645, 55654, 34968, 42650, 7371, 49482, 59311, 50236, 90995, 97922, 55732, 43349, 6779, 92145, 82918, 80968, 20157, 64462, 82287, 8020, 15411, 11488, 2559, 4992, 85542, 59896, 35960, 33593, 6679, 20699, 74000, 57335, 79139, 66934, 98452, 61796, 28957, 15880, 730, 60812, 49816, 19354, 2345, 17796, 49804, 36282, 42297, 41134, 83431, 97087, 47980, 11404, 84622, 3787, 78774, 50038, 37887, 1097, 78862, 72653, 48372, 4675, 89778, 99888, 23842, 57881, 67484, 4859, 98577, 55461, 70745, 42524, 10659, 52857, 23132, 5375, 87980, 96153, 2649, 15684, 29858, 13166, 17680, 8057, 60463, 8420, 73883, 56362, 93760, 96525, 76869, 85699, 64835, 59409, 6539, 82024, 60304, 50915, 68137, 79997, 42064, 40113, 71537, 78302, 72977, 61888, 84966, 28668, 53650, 95236, 13116, 93975, 97959, 32101, 79344, 86068, 51992, 23236, 30989, 3623, 76269, 43971, 4783, 55864, 31572, 48890, 13734, 63263, 63305, 49912, 35183, 97418, 67778, 81285, 44353, 3110, 38977, 95270, 85268, 98997, 20996, 56635, 80980, 57876, 28024, 92590, 46679, 90805, 8521, 18605, 13712, 93387, 53813, 98416, 97966, 45031, 61940, 27826, 39157, 62096, 18492, 70734, 19786, 79807, 27407, 99401, 5552, 72522, 3321, 92343, 4814, 70503, 48616, 69105, 10153, 60796, 82731, 7158, 46614, 45602, 89209, 46744, 34973, 5088, 37247, 50077, 62982, 63903, 77019, 77890, 66015, 58847, 18087, 27423, 26243, 14178, 35174, 71888, 83363, 1544, 88981, 183, 90176, 27786, 26213, 93836, 14017, 28901, 93401, 46888, 54671, 96926, 63159, 44441, 94026, 36511, 95903, 74800, 9010, 80204, 20266, 67677, 37899, 86492, 52007, 61689, 66556, 50443, 98305, 77822, 23113, 12049, 45884, 72119, 33953, 44999, 73538, 90546, 80143, 59147, 60413, 54638, 20177, 75914, 77348, 27248, 2920, 89116, 7266, 3996, 62128, 93494, 71972, 61540, 22523),7), 799767)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.sumIndicesWithKSetBits(List(38376, 1193, 60608, 86207, 60101, 51277, 70510, 96627, 41126, 70517, 99795, 68631, 15450, 61367, 26192, 1455, 44152, 70202, 5912, 91181, 27463, 84440, 75307, 54399, 2252, 91869, 69595, 93618, 25501, 28704, 85175, 77733, 44298, 97916, 18899, 91919, 23444, 5106, 11203, 84948, 10507, 97068, 63393, 37719, 81095, 5518, 61160, 52080, 57072, 94703, 70941, 94557, 39199, 8906, 41313, 93232, 18234, 39093, 99607, 12469, 22181, 80964, 71837, 49195, 95932, 35437, 99469, 94990, 9549, 46456, 34323, 41944, 77744, 50474, 70530, 52797, 76497, 46367, 58795, 52094, 12958, 69639, 43298, 31437, 36074, 96308, 75795, 84242, 29478, 49251, 4991, 41645, 16365, 13225, 6483, 75049, 24964, 89148, 49495, 52484, 74160, 44713, 88442, 24803, 32271, 14009, 41511, 97460, 84080, 48143, 30288, 85673, 85301, 60111, 68636, 69307, 30817, 2224, 84755, 5472, 76532, 463, 4878, 89328, 2290, 8919, 90475, 66751, 8211, 84034, 85785, 16083, 49686, 70391, 56786, 63913, 64107, 25282, 74636, 12345, 66694, 86448, 4514, 71439, 14847, 94446, 5921, 45066, 46148, 85800, 99819, 36149, 8611, 18126, 2843, 71497, 41959, 22205, 74842, 72160, 9662, 39788, 46996, 27799, 48652, 93112, 37892, 95183, 67504, 13952, 25398, 7073, 78142, 68708, 27067, 7229, 35439, 88965, 19968, 27853, 90597, 51178, 99277, 53548, 36695, 99486, 65735, 82392, 40972, 36534, 93558, 13159, 66209, 20630, 95090, 38115, 66169, 70997, 73047, 78502, 93303, 18346, 85427, 14251, 995, 72691, 66191, 54038, 62546, 82954, 7015, 36950, 12410, 30528, 55289, 13481, 21292, 9064, 63761, 17746, 31897, 14567, 17021, 57968, 57636, 26846, 52257, 41701, 57454, 89969, 4676, 25051, 87539, 86646, 30573, 10462, 30662, 33151, 84492, 27008, 17626, 21905, 21011, 42733, 32790, 18861, 22549, 50833, 67035, 26935, 25380, 24372, 80339, 86520, 26480, 99568, 83122, 67410, 16497, 8373, 60935, 42808, 70103, 60056, 82962, 12486, 82949, 85143, 53545, 74920, 70934, 13495, 75788, 51579, 77453, 86602, 3189, 89085, 68143, 9035, 13887, 36515, 17960, 5010, 43502, 34949, 32460, 67072, 80070, 2157, 64967, 41716, 65762, 41121, 36486, 86496, 54740, 99571, 6846, 51193, 47112, 61073, 22322, 66132, 91382, 96146, 16580, 38233, 94185, 28167, 27569, 30182, 53788, 53621, 38012, 15960, 1335, 98632, 26701, 73055, 84578, 19708, 91118, 21342, 53904, 62555, 66034, 48205, 67943, 23923, 44330, 39232, 68632, 34599, 93020, 43825, 26421, 62259, 43994, 41849, 35410, 98035, 87796, 59041, 88049, 19997, 92958, 31806, 964, 32525, 86490, 55530, 33143, 94690, 25232, 94164, 17309, 85836, 10418, 11088, 86326, 16, 69035, 57808, 61376, 85521, 71876, 83820, 9340, 9231, 75397, 94074, 10576, 83044, 64745, 33498, 31324, 4401, 51926, 58188, 6426, 87721, 26294, 75982, 82350, 25523, 62131, 86549, 24658, 53734, 1998, 34277, 188, 77879, 11876, 93106, 37688, 8404, 63191, 7348, 92925, 94868, 98115, 8817, 53860, 41005, 79922, 41515, 38266, 1378, 12333, 50293, 93600, 90029, 42698, 23180, 51019, 75391, 93527, 52994, 77323, 5948, 34016, 49119, 9197, 15918, 47795, 38578, 26745, 39060, 87468, 29371, 48659, 33845, 3227, 39838, 47813, 25779, 61692, 20734, 98410, 44904, 9785, 603, 16665, 91575, 75527, 81066, 18053, 52450, 98988, 8925, 41580, 38145, 71267, 78444, 43868, 74913, 10676, 30272, 16082, 35236, 84495, 72873, 38985, 66126, 55458, 14117, 51007, 36497, 59455, 41814, 89668, 84849, 47605, 84714, 8197, 68388, 26565, 52432, 66489, 64526, 33287, 59047, 47043, 17100, 92487, 95003, 69904, 45001, 18659, 59900, 4113, 68184, 36689, 72134, 90930, 61663, 44149, 59312, 32196, 9902, 89717, 98958, 36692, 10736, 75542, 49675, 55789, 46271, 91628, 12721, 3261, 4675, 29470, 97379, 99024, 5658, 14629, 25488, 25209, 45862, 38471, 29679, 86340, 44242, 41309, 32513, 34495, 51777, 37649, 44959, 40139, 50651, 79429, 16393, 34040, 57926, 87114, 65812, 11608, 95097, 54050, 84306, 36079, 77442, 82807, 70477, 71060, 78222, 47807, 4950, 36861, 18893, 71148, 76830, 34284, 58257, 53828, 58573, 29124, 35685, 66387, 99432, 40488, 25855, 74684, 45340, 53658, 27211, 48948, 74623),4), 7525991)
34
+ }
35
+
36
+ test("test9") {
37
+ assertEquals(Main.sumIndicesWithKSetBits(List(17968, 97887, 78122, 11435, 96193, 88913, 23831, 54875, 73835, 73214, 61748, 37785, 37628, 99097, 46820, 18573, 37933, 43624, 12001, 67568, 44909, 541, 31756, 97685, 53030, 30204, 19227, 43241, 33379, 57612, 66508, 59743, 24597, 26684, 59528, 95588, 62832, 89975, 88084, 59179, 84300, 28377, 84112, 99903, 90042, 32961, 43193, 28481, 73401, 54685, 54754, 13122, 41186, 49551, 80202, 57682, 83670, 4216, 18258, 1823, 13148, 32835, 42689, 61471, 45610, 8061, 75270, 9802, 50388, 69802, 30811, 10031, 10523, 81150, 57971, 58729, 86735, 77752, 17637, 74367, 40336, 78957, 43158, 67239, 46645, 52957, 21387, 73128, 30542, 1449, 98432, 22981, 6815, 29865, 21184, 52408, 88741, 24413, 76163, 51111, 95155, 72051, 68794, 31593, 88122, 66118, 34065, 34488, 12939, 7337, 19995, 61341, 438, 66681, 95693, 75952, 70375, 46324, 14320, 71860, 22078, 13678, 1454, 27556, 11766, 3196, 13734, 12486, 56556, 30052, 23850, 56764, 82676, 30423, 38975, 69517, 95353, 30874, 41224, 79926, 29879, 40214, 7291, 80404, 22156, 14362, 78846, 61074, 2011, 19423, 77593, 26098, 35611, 47988, 91283, 32997, 72431, 57339, 78893, 20668, 53889, 58539, 6200, 24438, 96256, 86549, 43255, 2618, 7392, 838, 88970, 7064, 35175, 98946, 96330, 90304, 86283, 15630, 21953, 91564, 27841, 88462, 57261, 11512, 11501, 30821, 77628, 35380, 39367, 20936, 38196, 55234, 61245, 89258, 8283, 30103, 58425, 7102, 28061, 57841, 42308, 7471, 62767, 50302, 70658, 55978, 4103, 38073, 79021, 46966, 66365, 76162, 5680, 42524, 71477, 40791, 77771, 17105, 48415, 90466, 35560, 6217, 28370, 95390, 88488, 17845, 12010, 58986, 6855, 58549, 33065, 33077, 12023, 54267, 25750, 92513, 94718, 5717, 52702, 57704, 17386, 71304, 16180, 43394, 55949, 90901, 35981, 7883, 33367, 23022, 1703, 43001, 42395, 32279, 18817, 51030, 66692, 5154, 86696, 83161, 32320, 57562, 70891, 78278, 41201, 67445, 14983, 26534, 31933, 75782, 18400, 84016, 53684, 29514, 87880, 59009, 24655, 14794, 96578, 70868, 30113, 27522, 7274, 88363, 21889, 92819, 82389, 12563, 67781, 18718, 41793, 45378, 54104, 15399, 54216, 79551, 54775, 56831, 82908, 33399, 36247, 86010, 14666, 55412, 23472, 34107, 53634, 18667, 65115, 64966, 9269, 96435, 48195, 37042, 12819, 34351, 8607, 75216, 48973, 52077, 38520, 1379, 95958, 24316, 44771, 44506, 8118, 57606, 41771, 51978, 65813, 9037, 25645, 69796, 99793, 27524, 30890, 40958, 18202, 33267, 5107, 41622, 39202, 54057, 81818, 47186, 24786, 79234, 99691, 51990, 56167, 60269, 9690, 74813, 18055, 99850, 15406, 92262, 2502, 10060, 88645, 21772, 52316, 82014, 73658, 4945, 66311, 54785, 17196, 92400, 38029, 40314, 17976, 18189, 1939, 86639, 78688, 13368, 53437, 5567, 72816, 45094, 38781, 78106, 55039, 94524, 59755, 76944, 97897, 2320, 58210, 19235, 43371, 21847, 44570, 30884, 64032, 44878, 35304, 63708, 75150, 45850, 6610, 88238, 46927, 8705, 75614, 80089, 96308, 25036, 90419, 42446, 39197, 55106, 25645, 2320, 34489, 40811, 47316, 85461, 90314, 96701, 20060, 1576, 95130, 758, 61693, 71591, 42146, 89045, 39359, 82180, 2712, 13495),0), 17968)
38
+ }
39
+
40
+ test("test10") {
41
+ assertEquals(Main.sumIndicesWithKSetBits(List(38079, 51195, 18615, 11635, 86451, 70730, 31508, 66071, 24341, 93218, 12602, 7960, 50506, 97853, 63006, 21536, 61515, 26081, 73011, 24930, 84463, 43429, 18109, 89686, 58997, 75466, 52589, 96755, 22514, 63295, 93839, 51177, 66910, 26062, 75372, 55629, 6842, 78295, 6989, 83628, 88239, 97066, 79638, 26216, 64127, 91335, 1524, 85999, 78038, 20031, 66092, 96643, 57387, 31874, 91824, 69879, 73301, 54590, 43141, 26021, 92778, 24956, 17323, 12079, 86836, 69278, 33410, 57021, 38402, 13441, 2572, 26010, 62126, 42988, 24198, 54898, 92463, 71614, 83020, 2007, 34723, 38052, 8803, 53124, 86041, 17925, 85324, 42385, 28679, 31229, 87030, 70369, 61193, 85259, 30474, 84823, 11478, 71110, 23297, 49679, 99960, 29662, 11999, 59839, 3693, 56160, 23701, 99290, 94512, 69094, 26245, 85088, 4080, 94028, 37046, 79896, 67038, 71349, 35336, 86662, 45591, 32909, 7256, 10195, 28578, 67301, 60454, 17404, 28510, 32450, 65134, 2210, 80350, 57075, 50281, 24974, 556, 74876, 37418, 90951, 2385, 86118, 26649, 12787, 42257, 12296, 58380, 59031, 61773, 40732, 22603, 25093, 5414, 65835, 4566, 50607, 93998, 84131, 93013, 11044, 47581, 24133, 23219, 80600, 65142, 44477, 26947, 22503, 15391, 86683, 71230, 52390, 2068, 90418, 6895, 9168, 22246, 9579, 17209, 5653, 17341, 78047, 72835, 56283, 27989, 71118, 83288, 61071, 90327, 95061, 51862, 47953, 21451, 68139, 39679, 44396, 82872, 88934, 87950, 63538, 62229, 51038, 86151, 98895, 70802, 92113, 48321, 81345, 60800, 97588, 24665, 70495, 80190, 27591, 50230, 91267, 77474, 37792, 35213, 39980, 94239, 53458, 52249, 89729, 7230, 57442, 10059, 20190, 75779, 9492, 86292, 39779, 11455, 93123, 66348, 75580, 57823, 49338, 87718, 93164, 95209, 16897, 55874, 71352, 94954, 61506, 95197, 60497, 76998, 79940, 62333, 80678, 26104, 71210, 45048, 24443, 17860, 83575, 62670, 98401, 93330, 95886, 38410, 65322, 59206, 60460, 29506, 5687, 38321, 44983, 32067, 37175, 83882, 52478, 10848, 67210, 31869, 89249, 94759, 3694, 10146, 9337, 5877, 59650, 6771, 64665, 50559, 29350, 53465, 11641, 67399, 3543, 9896, 76788, 24124, 70038, 5735, 46991, 55282, 72312, 21697, 65656, 86765, 33954, 71049, 65417, 58663, 93370, 42482, 8207, 94023, 67250, 73790, 93402, 13318, 58675, 9715, 37859, 40950, 85492, 65055, 61980, 8550, 78020, 74186, 17070, 68869, 65907, 43965, 41921, 19851, 84628, 47419, 36493, 79662, 86351, 96159, 16161, 55567, 74661, 59787, 84653, 17582, 25283, 14777, 97380, 96173, 82146, 4335, 91428, 78467, 34724, 82206, 3458, 53662, 26700, 56898, 86675, 81724, 88498, 18461, 35713, 83044, 87149, 59821, 93163, 50792, 79972, 28309, 75521, 39945, 93467, 93294, 78400, 35702, 25763, 11635, 31992, 62566, 19924, 94271, 19353, 6904, 27370, 27273, 18309, 73557, 43587, 40111, 42893, 3057, 32140, 14919, 41892, 11890, 14484, 84637, 72015, 93228, 36951, 79086, 13326, 41459, 75571, 91252, 31125, 72389, 40322, 70, 45540, 77001, 82414, 59452, 97612, 17432, 76311, 7087, 25542, 38431, 13816, 82926, 67599, 89740, 44716, 90951, 80370, 57048, 24697, 26723, 57092, 60878, 33519, 84977, 29072, 51681, 16491, 39196, 11223, 99929, 87335, 48260, 7272, 27715, 11983, 23720, 45012, 53686, 23636, 43025, 17725, 43990, 98788, 20110, 81928, 63487, 34630, 42006, 6883, 66365, 40, 33769, 28460, 53817, 21442, 7402, 75348, 10814, 73166, 86304, 4200, 53439, 93329, 81978, 28508, 92582, 53546, 97260, 94057, 49286, 51399, 74933, 21672, 73850, 40662, 18592, 44661, 99802, 61625, 60912, 26595, 80324, 34012, 74397, 9810, 99706, 13475, 24120, 78493, 39967, 68288, 45042, 49678, 29725, 44071, 54438, 59773, 99437, 3648, 36147, 73385, 32533, 46377, 40767, 28917, 11613, 9082, 21861, 80942, 44422, 66620, 94085, 83744, 24952, 15827, 99366, 71328, 27983, 30303, 8680, 33916, 23817, 2733, 92662, 49798, 56486, 21365, 46736, 66009, 91405, 18919, 55002, 73765, 59659, 84247, 35599, 62215, 3828, 24488, 74121, 24180, 83611, 91426, 3187, 67013, 78731, 18314, 78266, 55991, 82218, 78643, 16486, 84377, 54459, 13080, 45744, 68119, 50754, 6632, 81645, 87388, 73414, 48424, 44599, 91498, 10754, 58260, 80602, 87177, 40881, 87057, 41001, 60432, 67551, 48178, 40500, 50977, 91450, 87843, 54517, 3920, 48142, 71078, 61418, 95790, 5180, 27156, 24205, 99086, 9804, 11015, 63635, 93627, 65496, 46807, 21667, 97198, 57474, 3234, 19630, 52248, 21695, 48316, 41942, 29850, 36790, 20727, 41099, 93464, 61539, 48799, 86926, 7909, 62829, 84770, 41242, 67240, 59950, 85831, 59767, 67059, 41036, 81022, 21046, 27188, 91649, 57989, 74940, 44219, 59342, 80067, 37738, 51708, 26407, 31509, 29187, 94328, 32561, 88241, 67847, 75415, 9415, 78033, 43835, 64547, 83899, 49398, 76289, 71071, 94438, 9399, 43900, 22799, 82416, 7941, 60926, 61481, 93268, 80776, 42668, 69003, 22372, 64164, 75397, 16889, 25538, 15744, 20793, 29756, 94311, 30780, 24363, 73277, 47840, 70999, 82640, 6518, 26264, 64597, 48212),8), 374027)
42
+ }
43
+
44
+ }
sum_of_variable_length_subarrays/haskell_tests/Main.hs ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+ subarraySum :: [Int] -> Int
7
+ subarraySum nums = undefined
8
+
9
+ --Program end
10
+
11
+ -- Test cases
12
+
13
+ test1 :: Test
14
+ test1 = TestCase (assertEqual "for (subarraySum [2,3,1])," 11 (subarraySum [2,3,1]))
15
+
16
+ test2 :: Test
17
+ test2 = TestCase (assertEqual "for (subarraySum [3,1,1,2])," 13 (subarraySum [3,1,1,2]))
18
+
19
+ test3 :: Test
20
+ test3 = TestCase (assertEqual "for (subarraySum [49, 985, 533, 224, 602, 116, 615, 938, 668, 974, 622, 437, 930, 129, 165, 665, 812, 546, 478, 327, 547, 84, 397, 546, 45, 40, 14, 37, 87, 2, 391, 957, 835, 180, 944, 950, 843, 960, 962, 726, 96, 480, 842, 492, 992, 687])," 514501 (subarraySum [49, 985, 533, 224, 602, 116, 615, 938, 668, 974, 622, 437, 930, 129, 165, 665, 812, 546, 478, 327, 547, 84, 397, 546, 45, 40, 14, 37, 87, 2, 391, 957, 835, 180, 944, 950, 843, 960, 962, 726, 96, 480, 842, 492, 992, 687]))
21
+
22
+ test4 :: Test
23
+ test4 = TestCase (assertEqual "for (subarraySum [582, 41, 803, 568, 745, 96, 718, 367, 192, 344, 927, 340, 297, 315, 481, 8, 969, 320, 283, 565, 607, 703, 734, 31, 728, 735, 34, 897, 171, 344, 570, 513, 731, 570, 736, 754, 919, 866, 380, 641, 147])," 408941 (subarraySum [582, 41, 803, 568, 745, 96, 718, 367, 192, 344, 927, 340, 297, 315, 481, 8, 969, 320, 283, 565, 607, 703, 734, 31, 728, 735, 34, 897, 171, 344, 570, 513, 731, 570, 736, 754, 919, 866, 380, 641, 147]))
24
+
25
+ test5 :: Test
26
+ test5 = TestCase (assertEqual "for (subarraySum [428, 632, 781, 464, 958, 596, 612, 900, 545, 579, 435, 357, 748, 84, 548, 152, 754, 782, 436, 156, 175, 549, 318, 793, 990, 881, 304, 491, 634, 117, 553, 65, 737, 638, 529, 272, 935, 922])," 411014 (subarraySum [428, 632, 781, 464, 958, 596, 612, 900, 545, 579, 435, 357, 748, 84, 548, 152, 754, 782, 436, 156, 175, 549, 318, 793, 990, 881, 304, 491, 634, 117, 553, 65, 737, 638, 529, 272, 935, 922]))
27
+
28
+ test6 :: Test
29
+ test6 = TestCase (assertEqual "for (subarraySum [640, 345, 535, 711, 195, 114, 123, 973, 274, 356, 846, 230, 90, 592, 486, 809, 786, 684, 908, 576, 424, 541, 699, 327, 940, 654, 438, 91, 831, 531, 423, 535, 79, 72, 450, 192, 802, 587, 704, 75, 972, 607, 85, 280, 792, 21, 839, 846, 263, 925, 438, 531, 508, 676, 151, 805, 475, 164, 973, 667, 564, 915, 781, 859, 567, 230, 300])," 1137405 (subarraySum [640, 345, 535, 711, 195, 114, 123, 973, 274, 356, 846, 230, 90, 592, 486, 809, 786, 684, 908, 576, 424, 541, 699, 327, 940, 654, 438, 91, 831, 531, 423, 535, 79, 72, 450, 192, 802, 587, 704, 75, 972, 607, 85, 280, 792, 21, 839, 846, 263, 925, 438, 531, 508, 676, 151, 805, 475, 164, 973, 667, 564, 915, 781, 859, 567, 230, 300]))
30
+
31
+ test7 :: Test
32
+ test7 = TestCase (assertEqual "for (subarraySum [858, 782, 632, 395, 53, 800, 808, 422, 867, 470, 71, 832, 475, 380, 419, 156, 867, 614, 778, 930, 537])," 133223 (subarraySum [858, 782, 632, 395, 53, 800, 808, 422, 867, 470, 71, 832, 475, 380, 419, 156, 867, 614, 778, 930, 537]))
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
sum_of_variable_length_subarrays/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(11, subarraySum(Arrays.asList(2,3,1)));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(13, subarraySum(Arrays.asList(3,1,1,2)));
18
+ }
19
+
20
+ }
sum_of_variable_length_subarrays/meta.json ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3731,
3
+ "name": "sum_of_variable_length_subarrays",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/sum-of-variable-length-subarrays/",
6
+ "date": "2025-01-12 00:00:00",
7
+ "task_description": "You are given an integer array `nums` of size `n`. For **each** index `i` where `0 <= i < n`, define a subarray `nums[start ... i]` where `start = max(0, i - nums[i])`. Return the total sum of all elements from the subarray defined for each index in the array. **Example 1:** **Input:** nums = [2,3,1] **Output:** 11 **Explanation:** i Subarray Sum 0 `nums[0] = [2]` 2 1 `nums[0 ... 1] = [2, 3]` 5 2 `nums[1 ... 2] = [3, 1]` 4 **Total Sum** 11 The total sum is 11. Hence, 11 is the output. **Example 2:** **Input:** nums = [3,1,1,2] **Output:** 13 **Explanation:** i Subarray Sum 0 `nums[0] = [3]` 3 1 `nums[0 ... 1] = [3, 1]` 4 2 `nums[1 ... 2] = [1, 1]` 2 3 `nums[1 ... 3] = [1, 1, 2]` 4 **Total Sum** 13 The total sum is 13. Hence, 13 is the output. **Constraints:** `1 <= n == nums.length <= 100` `1 <= nums[i] <= 1000`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [2,3,1]",
12
+ "output": "11 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [3,1,1,2]",
17
+ "output": "13 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 49,
24
+ 985,
25
+ 533,
26
+ 224,
27
+ 602,
28
+ 116,
29
+ 615,
30
+ 938,
31
+ 668,
32
+ 974,
33
+ 622,
34
+ 437,
35
+ 930,
36
+ 129,
37
+ 165,
38
+ 665,
39
+ 812,
40
+ 546,
41
+ 478,
42
+ 327,
43
+ 547,
44
+ 84,
45
+ 397,
46
+ 546,
47
+ 45,
48
+ 40,
49
+ 14,
50
+ 37,
51
+ 87,
52
+ 2,
53
+ 391,
54
+ 957,
55
+ 835,
56
+ 180,
57
+ 944,
58
+ 950,
59
+ 843,
60
+ 960,
61
+ 962,
62
+ 726,
63
+ 96,
64
+ 480,
65
+ 842,
66
+ 492,
67
+ 992,
68
+ 687
69
+ ],
70
+ "output": 514501
71
+ },
72
+ {
73
+ "input": [
74
+ 582,
75
+ 41,
76
+ 803,
77
+ 568,
78
+ 745,
79
+ 96,
80
+ 718,
81
+ 367,
82
+ 192,
83
+ 344,
84
+ 927,
85
+ 340,
86
+ 297,
87
+ 315,
88
+ 481,
89
+ 8,
90
+ 969,
91
+ 320,
92
+ 283,
93
+ 565,
94
+ 607,
95
+ 703,
96
+ 734,
97
+ 31,
98
+ 728,
99
+ 735,
100
+ 34,
101
+ 897,
102
+ 171,
103
+ 344,
104
+ 570,
105
+ 513,
106
+ 731,
107
+ 570,
108
+ 736,
109
+ 754,
110
+ 919,
111
+ 866,
112
+ 380,
113
+ 641,
114
+ 147
115
+ ],
116
+ "output": 408941
117
+ },
118
+ {
119
+ "input": [
120
+ 428,
121
+ 632,
122
+ 781,
123
+ 464,
124
+ 958,
125
+ 596,
126
+ 612,
127
+ 900,
128
+ 545,
129
+ 579,
130
+ 435,
131
+ 357,
132
+ 748,
133
+ 84,
134
+ 548,
135
+ 152,
136
+ 754,
137
+ 782,
138
+ 436,
139
+ 156,
140
+ 175,
141
+ 549,
142
+ 318,
143
+ 793,
144
+ 990,
145
+ 881,
146
+ 304,
147
+ 491,
148
+ 634,
149
+ 117,
150
+ 553,
151
+ 65,
152
+ 737,
153
+ 638,
154
+ 529,
155
+ 272,
156
+ 935,
157
+ 922
158
+ ],
159
+ "output": 411014
160
+ },
161
+ {
162
+ "input": [
163
+ 640,
164
+ 345,
165
+ 535,
166
+ 711,
167
+ 195,
168
+ 114,
169
+ 123,
170
+ 973,
171
+ 274,
172
+ 356,
173
+ 846,
174
+ 230,
175
+ 90,
176
+ 592,
177
+ 486,
178
+ 809,
179
+ 786,
180
+ 684,
181
+ 908,
182
+ 576,
183
+ 424,
184
+ 541,
185
+ 699,
186
+ 327,
187
+ 940,
188
+ 654,
189
+ 438,
190
+ 91,
191
+ 831,
192
+ 531,
193
+ 423,
194
+ 535,
195
+ 79,
196
+ 72,
197
+ 450,
198
+ 192,
199
+ 802,
200
+ 587,
201
+ 704,
202
+ 75,
203
+ 972,
204
+ 607,
205
+ 85,
206
+ 280,
207
+ 792,
208
+ 21,
209
+ 839,
210
+ 846,
211
+ 263,
212
+ 925,
213
+ 438,
214
+ 531,
215
+ 508,
216
+ 676,
217
+ 151,
218
+ 805,
219
+ 475,
220
+ 164,
221
+ 973,
222
+ 667,
223
+ 564,
224
+ 915,
225
+ 781,
226
+ 859,
227
+ 567,
228
+ 230,
229
+ 300
230
+ ],
231
+ "output": 1137405
232
+ },
233
+ {
234
+ "input": [
235
+ 858,
236
+ 782,
237
+ 632,
238
+ 395,
239
+ 53,
240
+ 800,
241
+ 808,
242
+ 422,
243
+ 867,
244
+ 470,
245
+ 71,
246
+ 832,
247
+ 475,
248
+ 380,
249
+ 419,
250
+ 156,
251
+ 867,
252
+ 614,
253
+ 778,
254
+ 930,
255
+ 537
256
+ ],
257
+ "output": 133223
258
+ }
259
+ ],
260
+ "haskell_template": "subarraySum :: [Int] -> Int\nsubarraySum nums ",
261
+ "ocaml_template": "let subarraySum (nums: int list) : int = ",
262
+ "scala_template": "def subarraySum(nums: List[Int]): Int = { \n \n}",
263
+ "java_template": "class Solution {\n public int subarraySum(int[] nums) {\n \n }\n}",
264
+ "python_template": "class Solution(object):\n def subarraySum(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n "
265
+ }
sum_of_variable_length_subarrays/ocaml_tests/main.ml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let subarraySum (nums: int list) : int = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal 11 (subarraySum [2;3;1])
13
+
14
+ let test2 _ = assert_equal 13 (subarraySum [3;1;1;2])
15
+
16
+ let test3 _ = assert_equal 13 (subarraySum [49; 985; 533; 224; 602; 116; 615; 938; 668; 974; 622; 437; 930; 129; 165; 665; 812; 546; 478; 327; 547; 84; 397; 546; 45; 40; 14; 37; 87; 2; 391; 957; 835; 180; 944; 950; 843; 960; 962; 726; 96; 480; 842; 492; 992; 687])
17
+
18
+ let test4 _ = assert_equal 13 (subarraySum [582; 41; 803; 568; 745; 96; 718; 367; 192; 344; 927; 340; 297; 315; 481; 8; 969; 320; 283; 565; 607; 703; 734; 31; 728; 735; 34; 897; 171; 344; 570; 513; 731; 570; 736; 754; 919; 866; 380; 641; 147])
19
+
20
+ let test5 _ = assert_equal 13 (subarraySum [428; 632; 781; 464; 958; 596; 612; 900; 545; 579; 435; 357; 748; 84; 548; 152; 754; 782; 436; 156; 175; 549; 318; 793; 990; 881; 304; 491; 634; 117; 553; 65; 737; 638; 529; 272; 935; 922])
21
+
22
+ let test6 _ = assert_equal 13 (subarraySum [640; 345; 535; 711; 195; 114; 123; 973; 274; 356; 846; 230; 90; 592; 486; 809; 786; 684; 908; 576; 424; 541; 699; 327; 940; 654; 438; 91; 831; 531; 423; 535; 79; 72; 450; 192; 802; 587; 704; 75; 972; 607; 85; 280; 792; 21; 839; 846; 263; 925; 438; 531; 508; 676; 151; 805; 475; 164; 973; 667; 564; 915; 781; 859; 567; 230; 300])
23
+
24
+ let test7 _ = assert_equal 13 (subarraySum [858; 782; 632; 395; 53; 800; 808; 422; 867; 470; 71; 832; 475; 380; 419; 156; 867; 614; 778; 930; 537])
25
+
26
+
27
+ (* Grouping test cases *)
28
+ let suite = "Test Suite for subarraySum" >::: [
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
sum_of_variable_length_subarrays/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.subarraySum(List(2,3,1)), 11)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.subarraySum(List(3,1,1,2)), 13)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.subarraySum(49,985,533,224,602,116,615,938,668,974,622,437,930,129,165,665,812,546,478,327,547,84,397,546,45,40,14,37,87,2,391,957,835,180,944,950,843,960,962,726,96,480,842,492,992,687), 514501)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.subarraySum(582,41,803,568,745,96,718,367,192,344,927,340,297,315,481,8,969,320,283,565,607,703,734,31,728,735,34,897,171,344,570,513,731,570,736,754,919,866,380,641,147), 408941)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.subarraySum(428,632,781,464,958,596,612,900,545,579,435,357,748,84,548,152,754,782,436,156,175,549,318,793,990,881,304,491,634,117,553,65,737,638,529,272,935,922), 411014)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.subarraySum(640,345,535,711,195,114,123,973,274,356,846,230,90,592,486,809,786,684,908,576,424,541,699,327,940,654,438,91,831,531,423,535,79,72,450,192,802,587,704,75,972,607,85,280,792,21,839,846,263,925,438,531,508,676,151,805,475,164,973,667,564,915,781,859,567,230,300), 1137405)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.subarraySum(858,782,632,395,53,800,808,422,867,470,71,832,475,380,419,156,867,614,778,930,537), 133223)
30
+ }
31
+
32
+ }
take_gifts_from_the_richest_pile/.DS_Store ADDED
Binary file (6.15 kB). View file
 
take_gifts_from_the_richest_pile/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 (pickGifts [25,64,9,4,100] 4)," 29 (pickGifts [25,64,9,4,100] 4))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (pickGifts [1,1,1,1] 4)," 4 (pickGifts [1,1,1,1] 4))
16
+
17
+
18
+ -- Grouping test cases
19
+ tests :: Test
20
+ tests = TestList [TestLabel "Test1" test1]
21
+
22
+ -- Running the tests
23
+ main :: IO Counts
24
+ main = runTestTT tests
take_gifts_from_the_richest_pile/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(29, pickGifts(new ArrayList<>(Arrays.asList(25,64,9,4,100)), 4));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(4, pickGifts(new ArrayList<>(Arrays.asList(1,1,1,1)), 4));
19
+ }
20
+
21
+ }
take_gifts_from_the_richest_pile/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
take_gifts_from_the_richest_pile/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 29 (pickGifts [25;64;9;4;100] 4)
12
+
13
+ let test2 _ = assert_equal 4 (pickGifts [1;1;1;1] 4)
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for pickGifts" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
take_gifts_from_the_richest_pile/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.pickGifts(List(25,64,9,4,100),4), 29)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.pickGifts(List(1,1,1,1),4), 4)
10
+ }
11
+
12
+ }
take_k_of_each_character_from_left_and_right/.DS_Store ADDED
Binary file (6.15 kB). View file
 
take_k_of_each_character_from_left_and_right/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 (takeCharacters \"aabaaaacaabc \" 2)," 8 (takeCharacters "aabaaaacaabc" 2))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (takeCharacters \"a \" 1)," (-1) (takeCharacters "a" 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
take_k_of_each_character_from_left_and_right/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(8, takeCharacters("aabaaaacaabc", 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(-1, takeCharacters("a", 1));
19
+ }
20
+
21
+ }
take_k_of_each_character_from_left_and_right/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
take_k_of_each_character_from_left_and_right/ocaml_tests/main.ml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal 8 (takeCharacters "aabaaaacaabc" 2)
12
+
13
+ let test2 _ = assert_equal (-1) (takeCharacters "a" 1)
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for takeCharacters" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
take_k_of_each_character_from_left_and_right/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.takeCharacters("aabaaaacaabc",2), 8)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.takeCharacters("a",1), -1)
10
+ }
11
+
12
+ }
taking_maximum_energy_from_the_mystic_dungeon/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, None(new ArrayList<>(Arrays.asList(5,2,-10,-5,1)), 3));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(-1, None(new ArrayList<>(Arrays.asList(-2,-3,-1)), 2));
19
+ }
20
+
21
+ }
task_scheduler_ii/.DS_Store ADDED
Binary file (6.15 kB). View file
 
task_scheduler_ii/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 (taskSchedulerII [1,2,1,2,3,1] 3)," 9 (taskSchedulerII [1,2,1,2,3,1] 3))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (taskSchedulerII [5,8,8,5] 2)," 6 (taskSchedulerII [5,8,8,5] 2))
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
task_scheduler_ii/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(9, taskSchedulerII(new ArrayList<>(Arrays.asList(1,2,1,2,3,1)), 3));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(6, taskSchedulerII(new ArrayList<>(Arrays.asList(5,8,8,5)), 2));
19
+ }
20
+
21
+ }
task_scheduler_ii/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fc4778d8a30928a059a6a108fbdd019376ac304e08db070ae21889891ee7b2ee
3
+ size 15074605
task_scheduler_ii/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 9 (taskSchedulerII [1;2;1;2;3;1] 3)
12
+
13
+ let test2 _ = assert_equal 6 (taskSchedulerII [5;8;8;5] 2)
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for taskSchedulerII" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
task_scheduler_ii/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.taskSchedulerII(List(1,2,1,2,3,1),3), 9)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.taskSchedulerII(List(5,8,8,5),2), 6)
10
+ }
11
+
12
+ }
the_latest_time_to_catch_a_bus/.DS_Store ADDED
Binary file (6.15 kB). View file
 
the_latest_time_to_catch_a_bus/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 (latestTimeCatchTheBus [10,20] [2,17,18,19] 2)," 16 (latestTimeCatchTheBus [10,20] [2,17,18,19] 2))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (latestTimeCatchTheBus [20,30,10] [19,13,26,4,25,11,21] 2)," 20 (latestTimeCatchTheBus [20,30,10] [19,13,26,4,25,11,21] 2))
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
the_latest_time_to_catch_a_bus/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(16, latestTimeCatchTheBus(new ArrayList<>(Arrays.asList(10,20)), new ArrayList<>(Arrays.asList(2,17,18,19)), 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(20, latestTimeCatchTheBus(new ArrayList<>(Arrays.asList(20,30,10)), new ArrayList<>(Arrays.asList(19,13,26,4,25,11,21)), 2));
19
+ }
20
+
21
+ }
the_latest_time_to_catch_a_bus/meta.json ADDED
@@ -0,0 +1,1316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2417,
3
+ "name": "the_latest_time_to_catch_a_bus",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/the-latest-time-to-catch-a-bus/",
6
+ "date": "1656115200000",
7
+ "task_description": "You are given a **0-indexed** integer array `buses` of length `n`, where `buses[i]` represents the departure time of the `ith` bus. You are also given a **0-indexed** integer array `passengers` of length `m`, where `passengers[j]` represents the arrival time of the `jth` passenger. All bus departure times are unique. All passenger arrival times are unique. You are given an integer `capacity`, which represents the **maximum** number of passengers that can get on each bus. When a passenger arrives, they will wait in line for the next available bus. You can get on a bus that departs at `x` minutes if you arrive at `y` minutes where `y <= x`, and the bus is not full. Passengers with the **earliest** arrival times get on the bus first. More formally when a bus arrives, either: If `capacity` or fewer passengers are waiting for a bus, they will **all** get on the bus, or The `capacity` passengers with the **earliest** arrival times will get on the bus. Return _the latest time you may arrive at the bus station to catch a bus_. You **cannot** arrive at the same time as another passenger. **Note: **The arrays `buses` and `passengers` are not necessarily sorted. **Example 1:** ``` **Input:** buses = [10,20], passengers = [2,17,18,19], capacity = 2 **Output:** 16 **Explanation:** Suppose you arrive at time 16. At time 10, the first bus departs with the 0th passenger. At time 20, the second bus departs with you and the 1st passenger. Note that you may not arrive at the same time as another passenger, which is why you must arrive before the 1st passenger to catch the bus. ``` **Example 2:** ``` **Input:** buses = [20,30,10], passengers = [19,13,26,4,25,11,21], capacity = 2 **Output:** 20 **Explanation:** Suppose you arrive at time 20. At time 10, the first bus departs with the 3rd passenger. At time 20, the second bus departs with the 5th and 1st passengers. At time 30, the third bus departs with the 0th passenger and you. Notice if you had arrived any later, then the 6th passenger would have taken your seat on the third bus. ``` **Constraints:** `n == buses.length` `m == passengers.length` `1 <= n, m, capacity <= 105` `2 <= buses[i], passengers[i] <= 109` Each element in `buses` is **unique**. Each element in `passengers` is **unique**.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "buses = [10,20], passengers = [2,17,18,19], capacity = 2",
12
+ "output": "16 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "buses = [20,30,10], passengers = [19,13,26,4,25,11,21], capacity = 2",
17
+ "output": "20 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ [
24
+ 20857257,
25
+ 117515105,
26
+ 125074709,
27
+ 168095133,
28
+ 255758273,
29
+ 257228988,
30
+ 289989505,
31
+ 291342915,
32
+ 297480937,
33
+ 306916859,
34
+ 390582648,
35
+ 438567120,
36
+ 464846468,
37
+ 476797945,
38
+ 518924261,
39
+ 545186915,
40
+ 606333680,
41
+ 608443610,
42
+ 617474487,
43
+ 660696704,
44
+ 667641330,
45
+ 701054355,
46
+ 714391120,
47
+ 729580013,
48
+ 733181386,
49
+ 754790165,
50
+ 775208901,
51
+ 787358757,
52
+ 849377004,
53
+ 867855932,
54
+ 936760847,
55
+ 961028859,
56
+ 980796187
57
+ ],
58
+ [
59
+ 1115164,
60
+ 10581048,
61
+ 31428089,
62
+ 46689814,
63
+ 68239446,
64
+ 75097436,
65
+ 80751711,
66
+ 84497950,
67
+ 91851815,
68
+ 103854418,
69
+ 105064512,
70
+ 127646521,
71
+ 139696137,
72
+ 143892784,
73
+ 157536616,
74
+ 164621886,
75
+ 166629209,
76
+ 170727320,
77
+ 173328031,
78
+ 211859821,
79
+ 218522055,
80
+ 241140294,
81
+ 258456297,
82
+ 287636071,
83
+ 292355476,
84
+ 301882015,
85
+ 320423761,
86
+ 322807093,
87
+ 335887428,
88
+ 347477923,
89
+ 369543426,
90
+ 378580326,
91
+ 378931015,
92
+ 403456450,
93
+ 447755942,
94
+ 448414307,
95
+ 458028760,
96
+ 462201692,
97
+ 484477409,
98
+ 484652054,
99
+ 498570350,
100
+ 515768883,
101
+ 552924086,
102
+ 578323893,
103
+ 582777188,
104
+ 596324107,
105
+ 613122856,
106
+ 613545150,
107
+ 617629262,
108
+ 633982837,
109
+ 644278863,
110
+ 647881714,
111
+ 653270809,
112
+ 657418862,
113
+ 683323559,
114
+ 690105297,
115
+ 699685284,
116
+ 718221008,
117
+ 718756811,
118
+ 744031244,
119
+ 777183817,
120
+ 778637129,
121
+ 779949960,
122
+ 785467321,
123
+ 826712013,
124
+ 827610343,
125
+ 828736039,
126
+ 840429589,
127
+ 845890343,
128
+ 857535608,
129
+ 878590475,
130
+ 880466204,
131
+ 882088814,
132
+ 887917885,
133
+ 904683781,
134
+ 913023109,
135
+ 915018299,
136
+ 915612086,
137
+ 919322465,
138
+ 935462339,
139
+ 948303862,
140
+ 975806319,
141
+ 977542162,
142
+ 987230945
143
+ ],
144
+ 5
145
+ ],
146
+ "output": 980796187
147
+ },
148
+ {
149
+ "input": [
150
+ [
151
+ 30051333,
152
+ 74667541,
153
+ 90917241,
154
+ 94602549,
155
+ 100332961,
156
+ 107392511,
157
+ 122624681,
158
+ 185451724,
159
+ 200990271,
160
+ 207318050,
161
+ 217230360,
162
+ 218740187,
163
+ 219042932,
164
+ 242479637,
165
+ 254116919,
166
+ 274618794,
167
+ 281586852,
168
+ 291947711,
169
+ 321042872,
170
+ 348377207,
171
+ 355069326,
172
+ 369454497,
173
+ 416169611,
174
+ 423385324,
175
+ 444270719,
176
+ 476199490,
177
+ 478484093,
178
+ 511570457,
179
+ 529383546,
180
+ 531707815,
181
+ 544327275,
182
+ 546320904,
183
+ 574295384,
184
+ 592491551,
185
+ 613679262,
186
+ 659406062,
187
+ 665696757,
188
+ 675842492,
189
+ 722700158,
190
+ 754513365,
191
+ 756466858,
192
+ 764413580,
193
+ 805308150,
194
+ 836284038,
195
+ 878662623,
196
+ 882172451,
197
+ 888937637,
198
+ 933472481,
199
+ 937368678,
200
+ 945652604
201
+ ],
202
+ [
203
+ 12628004,
204
+ 36445170,
205
+ 44281623,
206
+ 46874614,
207
+ 76521206,
208
+ 95423226,
209
+ 98877582,
210
+ 108894462,
211
+ 123942265,
212
+ 128298675,
213
+ 132981373,
214
+ 152885610,
215
+ 157169777,
216
+ 203992786,
217
+ 215726111,
218
+ 219691974,
219
+ 243272157,
220
+ 246633325,
221
+ 267415172,
222
+ 276252953,
223
+ 286007741,
224
+ 315966500,
225
+ 352179494,
226
+ 354722228,
227
+ 407427956,
228
+ 423142080,
229
+ 427102082,
230
+ 453054652,
231
+ 474611617,
232
+ 507382046,
233
+ 514369951,
234
+ 527565747,
235
+ 551558751,
236
+ 571599184,
237
+ 573414442,
238
+ 575648359,
239
+ 576014059,
240
+ 582676950,
241
+ 601227888,
242
+ 605115294,
243
+ 617792096,
244
+ 619788200,
245
+ 621603426,
246
+ 621788025,
247
+ 630720718,
248
+ 634294262,
249
+ 658280906,
250
+ 661430055,
251
+ 690245796,
252
+ 701762801,
253
+ 721800146,
254
+ 744182719,
255
+ 789011298,
256
+ 799036238,
257
+ 801375685,
258
+ 806428326,
259
+ 829386276,
260
+ 846690413,
261
+ 858368151,
262
+ 860200601,
263
+ 870776072,
264
+ 874995819,
265
+ 893366475,
266
+ 893625951,
267
+ 945031464,
268
+ 959388757,
269
+ 995835841
270
+ ],
271
+ 6
272
+ ],
273
+ "output": 945652604
274
+ },
275
+ {
276
+ "input": [
277
+ [
278
+ 26975672,
279
+ 34290873,
280
+ 52962975,
281
+ 53805889,
282
+ 61925448,
283
+ 62164330,
284
+ 90864379,
285
+ 93333362,
286
+ 97750214,
287
+ 103615501,
288
+ 113534264,
289
+ 114049997,
290
+ 123283125,
291
+ 125325184,
292
+ 187840891,
293
+ 190947085,
294
+ 213667245,
295
+ 216829699,
296
+ 236373873,
297
+ 238330363,
298
+ 273778888,
299
+ 276092488,
300
+ 288965228,
301
+ 302268869,
302
+ 305253064,
303
+ 307564278,
304
+ 308352186,
305
+ 331178253,
306
+ 332688958,
307
+ 344069149,
308
+ 356574097,
309
+ 359307382,
310
+ 377771705,
311
+ 391098208,
312
+ 399831176,
313
+ 413674059,
314
+ 435748683,
315
+ 439620285,
316
+ 460310872,
317
+ 485395211,
318
+ 507221203,
319
+ 520854621,
320
+ 521209616,
321
+ 525981336,
322
+ 531315176,
323
+ 539419984,
324
+ 546605366,
325
+ 552583522,
326
+ 557588176,
327
+ 584550289,
328
+ 587675240,
329
+ 591233205,
330
+ 592919540,
331
+ 599300714,
332
+ 606032838,
333
+ 625033598,
334
+ 652707015,
335
+ 660778058,
336
+ 673477279,
337
+ 678960448,
338
+ 684635214,
339
+ 696511813,
340
+ 715723490,
341
+ 728056932,
342
+ 737209866,
343
+ 793418413,
344
+ 804986700,
345
+ 812449377,
346
+ 850776879,
347
+ 855135951,
348
+ 871486226,
349
+ 882832442,
350
+ 894368387,
351
+ 894463897,
352
+ 898529121,
353
+ 918019593,
354
+ 919130685,
355
+ 926591218,
356
+ 933956911,
357
+ 944989701,
358
+ 948115009,
359
+ 948323144,
360
+ 959190345,
361
+ 968382694,
362
+ 970411619,
363
+ 997297035
364
+ ],
365
+ [
366
+ 36014266,
367
+ 37883507,
368
+ 49950987,
369
+ 51261745,
370
+ 66203187,
371
+ 84466567,
372
+ 134366526,
373
+ 140791394,
374
+ 142903991,
375
+ 144177739,
376
+ 158674015,
377
+ 166754068,
378
+ 167848817,
379
+ 193742089,
380
+ 220014423,
381
+ 225949130,
382
+ 232071966,
383
+ 241732626,
384
+ 250495725,
385
+ 257999564,
386
+ 258488575,
387
+ 270734547,
388
+ 275506341,
389
+ 286058702,
390
+ 288341143,
391
+ 334340079,
392
+ 355304316,
393
+ 355418752,
394
+ 423509748,
395
+ 483110794,
396
+ 490507277,
397
+ 498701359,
398
+ 513556630,
399
+ 516718113,
400
+ 541955020,
401
+ 542683158,
402
+ 572969870,
403
+ 573926592,
404
+ 601339079,
405
+ 630424399,
406
+ 631251235,
407
+ 651655253,
408
+ 653256670,
409
+ 655477799,
410
+ 656137580,
411
+ 665214989,
412
+ 667219481,
413
+ 680016328,
414
+ 691087886,
415
+ 692139932,
416
+ 713933261,
417
+ 724836327,
418
+ 729676048,
419
+ 732950979,
420
+ 740447382,
421
+ 744465436,
422
+ 749137025,
423
+ 751692486,
424
+ 760117258,
425
+ 762158336,
426
+ 800061399,
427
+ 803968943,
428
+ 807696208,
429
+ 835389216,
430
+ 836691100,
431
+ 851075802,
432
+ 857921347,
433
+ 866739117,
434
+ 872795692,
435
+ 881854225,
436
+ 883490665,
437
+ 886024541,
438
+ 891147314,
439
+ 912373172,
440
+ 915865681,
441
+ 921716853,
442
+ 923210470,
443
+ 935570549,
444
+ 951998332,
445
+ 952371148,
446
+ 962123237,
447
+ 965809284
448
+ ],
449
+ 6
450
+ ],
451
+ "output": 997297035
452
+ },
453
+ {
454
+ "input": [
455
+ [
456
+ 37985618,
457
+ 82978179,
458
+ 86134656,
459
+ 109175485,
460
+ 110681847,
461
+ 112507705,
462
+ 112605256,
463
+ 156929268,
464
+ 167718123,
465
+ 172703751,
466
+ 183610063,
467
+ 191542837,
468
+ 209401988,
469
+ 223839333,
470
+ 226833194,
471
+ 247811486,
472
+ 254153728,
473
+ 254254423,
474
+ 255491190,
475
+ 304841950,
476
+ 321406999,
477
+ 333029102,
478
+ 376069080,
479
+ 383068698,
480
+ 406427284,
481
+ 410659772,
482
+ 418602911,
483
+ 437466582,
484
+ 451591792,
485
+ 464871774,
486
+ 467534177,
487
+ 469109121,
488
+ 472391187,
489
+ 521591385,
490
+ 555566398,
491
+ 580316257,
492
+ 580341825,
493
+ 614030813,
494
+ 632325518,
495
+ 653890169,
496
+ 669905989,
497
+ 673122165,
498
+ 730875205,
499
+ 733031619,
500
+ 737969926,
501
+ 748405232,
502
+ 752940337,
503
+ 754804241,
504
+ 770298120,
505
+ 794597438,
506
+ 801723075,
507
+ 812482460,
508
+ 836680135,
509
+ 842051623,
510
+ 866793076,
511
+ 884526148,
512
+ 958977143,
513
+ 968269309,
514
+ 983704312,
515
+ 989852128
516
+ ],
517
+ [
518
+ 11256401,
519
+ 24323173,
520
+ 40781440,
521
+ 64769073,
522
+ 75778035,
523
+ 91050112,
524
+ 160900614,
525
+ 177961724,
526
+ 179260646,
527
+ 184703864,
528
+ 193784245,
529
+ 211734716,
530
+ 215238976,
531
+ 249357067,
532
+ 255245188,
533
+ 267231969,
534
+ 274005247,
535
+ 287967514,
536
+ 334623634,
537
+ 335795987,
538
+ 346109124,
539
+ 363706539,
540
+ 383209541,
541
+ 412509398,
542
+ 424917109,
543
+ 439727718,
544
+ 454203958,
545
+ 490330238,
546
+ 501097975,
547
+ 522973233,
548
+ 527938578,
549
+ 579643193,
550
+ 595692988,
551
+ 616646485,
552
+ 667672932,
553
+ 674152924,
554
+ 707054334,
555
+ 712250175,
556
+ 714902270,
557
+ 802892629,
558
+ 804340247,
559
+ 862663900,
560
+ 930542137,
561
+ 973702348,
562
+ 976497443,
563
+ 986410198
564
+ ],
565
+ 10
566
+ ],
567
+ "output": 989852128
568
+ },
569
+ {
570
+ "input": [
571
+ [
572
+ 13248923,
573
+ 17209405,
574
+ 49520485,
575
+ 52620828,
576
+ 52855453,
577
+ 55550356,
578
+ 62108543,
579
+ 66591246,
580
+ 71904569,
581
+ 78067330,
582
+ 84325663,
583
+ 88978851,
584
+ 103843582,
585
+ 116844642,
586
+ 118835349,
587
+ 137954663,
588
+ 185693438,
589
+ 187603821,
590
+ 188484867,
591
+ 188626060,
592
+ 189266252,
593
+ 194318431,
594
+ 206719219,
595
+ 209735904,
596
+ 216539558,
597
+ 238671190,
598
+ 247388483,
599
+ 250281180,
600
+ 250365313,
601
+ 269280092,
602
+ 279611781,
603
+ 298093072,
604
+ 310360005,
605
+ 318207549,
606
+ 325427004,
607
+ 363437190,
608
+ 369467945,
609
+ 370302404,
610
+ 374040954,
611
+ 378880571,
612
+ 399816374,
613
+ 404788891,
614
+ 406904418,
615
+ 412191497,
616
+ 433923730,
617
+ 438032437,
618
+ 458228172,
619
+ 461115806,
620
+ 464697412,
621
+ 491027377,
622
+ 493903104,
623
+ 494466791,
624
+ 530153231,
625
+ 567996931,
626
+ 576315162,
627
+ 594442866,
628
+ 595290129,
629
+ 601767699,
630
+ 634001705,
631
+ 645356172,
632
+ 650397910,
633
+ 656193931,
634
+ 667521314,
635
+ 680051301,
636
+ 681100638,
637
+ 694690290,
638
+ 721443459,
639
+ 766151014,
640
+ 766644317,
641
+ 773610212,
642
+ 775526385,
643
+ 783488841,
644
+ 789308056,
645
+ 792500308,
646
+ 802030366,
647
+ 810459852,
648
+ 814662141,
649
+ 825452298,
650
+ 826959904,
651
+ 828069322,
652
+ 828462252,
653
+ 836006796,
654
+ 836068445,
655
+ 858722828,
656
+ 864333876,
657
+ 875573955,
658
+ 889196176,
659
+ 914577861,
660
+ 920515239,
661
+ 924533811,
662
+ 932637843,
663
+ 934791920,
664
+ 940195324,
665
+ 944204073,
666
+ 955967868,
667
+ 960531981,
668
+ 967573248,
669
+ 974749195,
670
+ 978461233,
671
+ 995456868
672
+ ],
673
+ [
674
+ 2023745,
675
+ 19515396,
676
+ 45273990,
677
+ 77064518,
678
+ 77130017,
679
+ 78251636,
680
+ 91584043,
681
+ 105246357,
682
+ 108089062,
683
+ 108841179,
684
+ 123632175,
685
+ 129511005,
686
+ 145202024,
687
+ 152334364,
688
+ 156322509,
689
+ 157864014,
690
+ 167240820,
691
+ 177301559,
692
+ 228187616,
693
+ 230003213,
694
+ 231402114,
695
+ 234760642,
696
+ 244867468,
697
+ 247467389,
698
+ 247696983,
699
+ 265227316,
700
+ 275055605,
701
+ 288571276,
702
+ 294799168,
703
+ 312299654,
704
+ 313769579,
705
+ 315864623,
706
+ 333211596,
707
+ 342786476,
708
+ 346618539,
709
+ 352277824,
710
+ 352756711,
711
+ 353017528,
712
+ 358226124,
713
+ 370668353,
714
+ 389814313,
715
+ 396373079,
716
+ 429074594,
717
+ 447382147,
718
+ 448741823,
719
+ 450360557,
720
+ 488909202,
721
+ 537936419,
722
+ 569278653,
723
+ 578779103,
724
+ 582873381,
725
+ 636160718,
726
+ 651716525,
727
+ 658738053,
728
+ 659666898,
729
+ 669835517,
730
+ 672437731,
731
+ 676341381,
732
+ 692888162,
733
+ 695138519,
734
+ 703505946,
735
+ 709173268,
736
+ 718889421,
737
+ 726452446,
738
+ 726814913,
739
+ 752324161,
740
+ 761115144,
741
+ 769865820,
742
+ 780051782,
743
+ 785590016,
744
+ 797781746,
745
+ 805316518,
746
+ 836132978,
747
+ 862480873,
748
+ 865863128,
749
+ 873324790,
750
+ 884337118,
751
+ 884438226,
752
+ 890020277,
753
+ 935686407,
754
+ 944947459,
755
+ 988525152
756
+ ],
757
+ 2
758
+ ],
759
+ "output": 995456868
760
+ },
761
+ {
762
+ "input": [
763
+ [
764
+ 21682879,
765
+ 53312549,
766
+ 81598798,
767
+ 192328230,
768
+ 225301132,
769
+ 270923157,
770
+ 322408167,
771
+ 344679826,
772
+ 413993911,
773
+ 445878654,
774
+ 469597636,
775
+ 537228357,
776
+ 632674093,
777
+ 641855931,
778
+ 652281992,
779
+ 669941083,
780
+ 714407453,
781
+ 940210630,
782
+ 948742574
783
+ ],
784
+ [
785
+ 25170324,
786
+ 39270765,
787
+ 46872233,
788
+ 53344085,
789
+ 66401508,
790
+ 67899952,
791
+ 68361952,
792
+ 84377540,
793
+ 96598480,
794
+ 98488831,
795
+ 117764993,
796
+ 120020675,
797
+ 134860858,
798
+ 179098505,
799
+ 187047220,
800
+ 187817590,
801
+ 195439047,
802
+ 310879600,
803
+ 313528688,
804
+ 317696641,
805
+ 349690614,
806
+ 357009828,
807
+ 392138284,
808
+ 394950329,
809
+ 413462806,
810
+ 447427058,
811
+ 468990204,
812
+ 482942061,
813
+ 492376927,
814
+ 535794864,
815
+ 537862317,
816
+ 600271404,
817
+ 661030098,
818
+ 761746707,
819
+ 782270742,
820
+ 782930336,
821
+ 783198265,
822
+ 789782719,
823
+ 801600448,
824
+ 815957910,
825
+ 820085821,
826
+ 839518888,
827
+ 883874268,
828
+ 891754299,
829
+ 904704427,
830
+ 914146603,
831
+ 924634814,
832
+ 940000313,
833
+ 954273190,
834
+ 960462463,
835
+ 972366365,
836
+ 976592334
837
+ ],
838
+ 7
839
+ ],
840
+ "output": 924634813
841
+ },
842
+ {
843
+ "input": [
844
+ [
845
+ 8079604,
846
+ 46773400,
847
+ 126096231,
848
+ 167925893,
849
+ 193154078,
850
+ 245861048,
851
+ 386893851,
852
+ 430477759,
853
+ 492683942,
854
+ 740250693,
855
+ 778498827,
856
+ 829321708
857
+ ],
858
+ [
859
+ 168075828,
860
+ 189473469,
861
+ 203768168,
862
+ 223061186,
863
+ 230131521,
864
+ 249880224,
865
+ 278613788,
866
+ 321800112,
867
+ 427548951,
868
+ 443643855,
869
+ 472397196,
870
+ 514909800,
871
+ 544145696,
872
+ 544347292,
873
+ 562388766,
874
+ 644694699,
875
+ 689039139,
876
+ 757440376,
877
+ 780402934,
878
+ 854026582,
879
+ 890037063,
880
+ 908257615,
881
+ 943312694,
882
+ 964042721,
883
+ 968523294
884
+ ],
885
+ 4
886
+ ],
887
+ "output": 829321708
888
+ },
889
+ {
890
+ "input": [
891
+ [
892
+ 11083570,
893
+ 15410326,
894
+ 45033205,
895
+ 55782264,
896
+ 58120458,
897
+ 99085597,
898
+ 117890389,
899
+ 159907175,
900
+ 218477772,
901
+ 227369306,
902
+ 328062610,
903
+ 348540026,
904
+ 365971923,
905
+ 456369471,
906
+ 457070163,
907
+ 464149568,
908
+ 477584925,
909
+ 483208487,
910
+ 492762859,
911
+ 519660908,
912
+ 522785111,
913
+ 548618376,
914
+ 562995044,
915
+ 579450573,
916
+ 654782424,
917
+ 686891993,
918
+ 714537955,
919
+ 819001809,
920
+ 867731188,
921
+ 888083891,
922
+ 936315060,
923
+ 959791199,
924
+ 987292636
925
+ ],
926
+ [
927
+ 1284869,
928
+ 10625419,
929
+ 18014619,
930
+ 20153011,
931
+ 33605174,
932
+ 41165506,
933
+ 43522083,
934
+ 48753246,
935
+ 49300773,
936
+ 50081163,
937
+ 53757252,
938
+ 61657204,
939
+ 78327588,
940
+ 84371754,
941
+ 100513875,
942
+ 114496318,
943
+ 119160121,
944
+ 121531652,
945
+ 125007275,
946
+ 142375100,
947
+ 157985675,
948
+ 166820762,
949
+ 174458816,
950
+ 209456720,
951
+ 210251063,
952
+ 220312256,
953
+ 242687798,
954
+ 280596938,
955
+ 302290585,
956
+ 320254125,
957
+ 361392908,
958
+ 386715796,
959
+ 401701566,
960
+ 421135070,
961
+ 461956101,
962
+ 480784444,
963
+ 488561286,
964
+ 522892005,
965
+ 527758380,
966
+ 558773368,
967
+ 563026607,
968
+ 573496048,
969
+ 574358460,
970
+ 575937237,
971
+ 576503742,
972
+ 578058251,
973
+ 586691666,
974
+ 601490805,
975
+ 606044029,
976
+ 627795048,
977
+ 635115567,
978
+ 645179106,
979
+ 659289974,
980
+ 672038105,
981
+ 713093401,
982
+ 744097049,
983
+ 757507232,
984
+ 779991709,
985
+ 787680725,
986
+ 792271313,
987
+ 806567232,
988
+ 814171984,
989
+ 864260352,
990
+ 864511041,
991
+ 875415082,
992
+ 888014700,
993
+ 889608903,
994
+ 927239048,
995
+ 947109225,
996
+ 964414070,
997
+ 982641105,
998
+ 999631898,
999
+ 999898691
1000
+ ],
1001
+ 4
1002
+ ],
1003
+ "output": 987292636
1004
+ },
1005
+ {
1006
+ "input": [
1007
+ [
1008
+ 3577022,
1009
+ 90730428,
1010
+ 203840384,
1011
+ 220226581,
1012
+ 262018657,
1013
+ 273166006,
1014
+ 319464225,
1015
+ 411661986,
1016
+ 426842649,
1017
+ 449934325,
1018
+ 474898946,
1019
+ 514546979,
1020
+ 517192700,
1021
+ 525404414,
1022
+ 528173633,
1023
+ 545451444,
1024
+ 597553998,
1025
+ 611860405,
1026
+ 617705369,
1027
+ 639193135,
1028
+ 646422908,
1029
+ 648392363,
1030
+ 662623322,
1031
+ 680931910,
1032
+ 708166389,
1033
+ 715738082,
1034
+ 737391135,
1035
+ 757628375,
1036
+ 766069555,
1037
+ 791756209,
1038
+ 814455499,
1039
+ 828751842,
1040
+ 844304225,
1041
+ 882624251,
1042
+ 885036359,
1043
+ 890826958,
1044
+ 924702522,
1045
+ 953228173,
1046
+ 976150293
1047
+ ],
1048
+ [
1049
+ 3188506,
1050
+ 25898538,
1051
+ 33668430,
1052
+ 39826833,
1053
+ 42744670,
1054
+ 54240951,
1055
+ 55047921,
1056
+ 71301359,
1057
+ 76043510,
1058
+ 87900890,
1059
+ 92317149,
1060
+ 92573291,
1061
+ 96172362,
1062
+ 105241469,
1063
+ 128151226,
1064
+ 147925214,
1065
+ 156179742,
1066
+ 168306689,
1067
+ 182755977,
1068
+ 207297641,
1069
+ 212673526,
1070
+ 220932516,
1071
+ 227069105,
1072
+ 230611246,
1073
+ 239657322,
1074
+ 240696252,
1075
+ 245530647,
1076
+ 306496540,
1077
+ 316235001,
1078
+ 336310147,
1079
+ 349284050,
1080
+ 357910832,
1081
+ 368784108,
1082
+ 376745346,
1083
+ 380915708,
1084
+ 417969677,
1085
+ 424017362,
1086
+ 440377960,
1087
+ 448023399,
1088
+ 455521542,
1089
+ 488152766,
1090
+ 496646051,
1091
+ 504144824,
1092
+ 506411344,
1093
+ 527629636,
1094
+ 532148462,
1095
+ 547950420,
1096
+ 602493472,
1097
+ 610027383,
1098
+ 637444025,
1099
+ 646739923,
1100
+ 660946889,
1101
+ 668229896,
1102
+ 682727664,
1103
+ 705790768,
1104
+ 778312744,
1105
+ 783442250,
1106
+ 794196819,
1107
+ 806633597,
1108
+ 806937641,
1109
+ 813098559,
1110
+ 844952011,
1111
+ 858698089,
1112
+ 873768343,
1113
+ 892255775,
1114
+ 895409541,
1115
+ 895962593,
1116
+ 911037415,
1117
+ 929615285,
1118
+ 931053156,
1119
+ 937303563,
1120
+ 962409665,
1121
+ 967226468,
1122
+ 968343606,
1123
+ 992045424
1124
+ ],
1125
+ 5
1126
+ ],
1127
+ "output": 976150293
1128
+ },
1129
+ {
1130
+ "input": [
1131
+ [
1132
+ 1293896,
1133
+ 7786729,
1134
+ 12558975,
1135
+ 18843277,
1136
+ 56998025,
1137
+ 59911724,
1138
+ 62060830,
1139
+ 77075712,
1140
+ 105540574,
1141
+ 110103005,
1142
+ 124346248,
1143
+ 158900540,
1144
+ 197625872,
1145
+ 225881090,
1146
+ 225982302,
1147
+ 227468615,
1148
+ 231799423,
1149
+ 249807951,
1150
+ 249975719,
1151
+ 250713159,
1152
+ 253160561,
1153
+ 267683041,
1154
+ 284690823,
1155
+ 298335310,
1156
+ 299042616,
1157
+ 299740707,
1158
+ 307596356,
1159
+ 319388338,
1160
+ 340567125,
1161
+ 351845036,
1162
+ 359203851,
1163
+ 364976160,
1164
+ 367667237,
1165
+ 368252487,
1166
+ 392191958,
1167
+ 400735528,
1168
+ 420912352,
1169
+ 441663068,
1170
+ 442600535,
1171
+ 464852637,
1172
+ 496401591,
1173
+ 503641501,
1174
+ 505520241,
1175
+ 508674483,
1176
+ 514570124,
1177
+ 523453276,
1178
+ 552434589,
1179
+ 561370935,
1180
+ 574037995,
1181
+ 593042818,
1182
+ 597290971,
1183
+ 615682190,
1184
+ 645446880,
1185
+ 656446951,
1186
+ 657359982,
1187
+ 668319581,
1188
+ 671402419,
1189
+ 677546788,
1190
+ 689221156,
1191
+ 693647461,
1192
+ 699927162,
1193
+ 702125080,
1194
+ 715350112,
1195
+ 736660112,
1196
+ 758580595,
1197
+ 758770468,
1198
+ 770451390,
1199
+ 776211191,
1200
+ 797091574,
1201
+ 800183900,
1202
+ 800186508,
1203
+ 800461279,
1204
+ 819590741,
1205
+ 826308395,
1206
+ 827336916,
1207
+ 874886249,
1208
+ 894722052,
1209
+ 899633245,
1210
+ 901875955,
1211
+ 913156186,
1212
+ 934960444,
1213
+ 938478927,
1214
+ 948011918,
1215
+ 950113714,
1216
+ 980036200
1217
+ ],
1218
+ [
1219
+ 11707206,
1220
+ 27008828,
1221
+ 30295616,
1222
+ 37891055,
1223
+ 38832288,
1224
+ 48126298,
1225
+ 53492204,
1226
+ 63407585,
1227
+ 69163317,
1228
+ 90239466,
1229
+ 95349817,
1230
+ 101158214,
1231
+ 103351630,
1232
+ 117048826,
1233
+ 117898391,
1234
+ 121478451,
1235
+ 127954109,
1236
+ 128671757,
1237
+ 143259225,
1238
+ 147374999,
1239
+ 184949750,
1240
+ 201868044,
1241
+ 210638719,
1242
+ 227728601,
1243
+ 236158536,
1244
+ 237628307,
1245
+ 258248263,
1246
+ 261267461,
1247
+ 265700732,
1248
+ 317053838,
1249
+ 334902493,
1250
+ 341791730,
1251
+ 345923243,
1252
+ 356536606,
1253
+ 360453921,
1254
+ 373933915,
1255
+ 377286242,
1256
+ 390645711,
1257
+ 402477773,
1258
+ 403589232,
1259
+ 405013025,
1260
+ 409064729,
1261
+ 409986501,
1262
+ 443374624,
1263
+ 457009614,
1264
+ 458036816,
1265
+ 461444845,
1266
+ 489431758,
1267
+ 523686668,
1268
+ 525954685,
1269
+ 550066531,
1270
+ 618312207,
1271
+ 639427649,
1272
+ 645074629,
1273
+ 676407594,
1274
+ 679535285,
1275
+ 686648385,
1276
+ 695744579,
1277
+ 696651768,
1278
+ 698855829,
1279
+ 714156185,
1280
+ 719080786,
1281
+ 731815150,
1282
+ 737223487,
1283
+ 750751271,
1284
+ 756011739,
1285
+ 759595494,
1286
+ 765066030,
1287
+ 807019065,
1288
+ 807364739,
1289
+ 837264056,
1290
+ 851495556,
1291
+ 853341403,
1292
+ 869548974,
1293
+ 870838736,
1294
+ 885215702,
1295
+ 897789812,
1296
+ 902871038,
1297
+ 903585464,
1298
+ 909200795,
1299
+ 932781202,
1300
+ 936384572,
1301
+ 941828185,
1302
+ 953013902,
1303
+ 989520913,
1304
+ 990939312
1305
+ ],
1306
+ 9
1307
+ ],
1308
+ "output": 980036200
1309
+ }
1310
+ ],
1311
+ "haskell_template": "latestTimeCatchTheBus :: [Int] -> [Int] -> Int -> Int\nlatestTimeCatchTheBus buses passengers capacity ",
1312
+ "ocaml_template": "let latestTimeCatchTheBus (buses: int list) (passengers: int list) (capacity: int) : int = ",
1313
+ "scala_template": "def latestTimeCatchTheBus(buses: List[Int],passengers: List[Int],capacity: Int): Int = { \n \n}",
1314
+ "java_template": "public static int latestTimeCatchTheBus(List<Integer> buses, List<Integer> passengers, int capacity) {\n\n}",
1315
+ "python_template": "class Solution(object):\n def latestTimeCatchTheBus(self, buses, passengers, capacity):\n \"\"\"\n :type buses: List[int]\n :type passengers: List[int]\n :type capacity: int\n :rtype: int\n \"\"\"\n "
1316
+ }
the_latest_time_to_catch_a_bus/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 16 (latestTimeCatchTheBus [10;20] [2;17;18;19] 2)
12
+
13
+ let test2 _ = assert_equal 20 (latestTimeCatchTheBus [20;30;10] [19;13;26;4;25;11;21] 2)
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for latestTimeCatchTheBus" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
the_latest_time_to_catch_a_bus/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.latestTimeCatchTheBus(List(10,20),List(2,17,18,19),2), 16)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.latestTimeCatchTheBus(List(20,30,10),List(19,13,26,4,25,11,21),2), 20)
10
+ }
11
+
12
+ }
the_number_of_beautiful_subsets/.DS_Store ADDED
Binary file (6.15 kB). View file
 
the_number_of_beautiful_subsets/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 (beautifulSubsets [2,4,6] 2)," 4 (beautifulSubsets [2,4,6] 2))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (beautifulSubsets [1] 1)," 1 (beautifulSubsets [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
the_number_of_beautiful_subsets/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(4, beautifulSubsets(new ArrayList<>(Arrays.asList(2,4,6)), 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(1, beautifulSubsets(new ArrayList<>(Arrays.asList(1)), 1));
19
+ }
20
+
21
+ }
the_number_of_beautiful_subsets/meta.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2696,
3
+ "name": "the_number_of_beautiful_subsets",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/the-number-of-beautiful-subsets/",
6
+ "date": "1678579200000",
7
+ "task_description": "You are given an array `nums` of positive integers and a **positive** integer `k`. A subset of `nums` is **beautiful** if it does not contain two integers with an absolute difference equal to `k`. Return _the number of **non-empty beautiful **subsets of the array_ `nums`. A **subset** of `nums` is an array that can be obtained by deleting some (possibly none) elements from `nums`. Two subsets are different if and only if the chosen indices to delete are different. **Example 1:** ``` **Input:** nums = [2,4,6], k = 2 **Output:** 4 **Explanation:** The beautiful subsets of the array nums are: [2], [4], [6], [2, 6]. It can be proved that there are only 4 beautiful subsets in the array [2,4,6]. ``` **Example 2:** ``` **Input:** nums = [1], k = 1 **Output:** 1 **Explanation:** The beautiful subset of the array nums is [1]. It can be proved that there is only 1 beautiful subset in the array [1]. ``` **Constraints:** `1 <= nums.length <= 18` `1 <= nums[i], k <= 1000`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [2,4,6], k = 2",
12
+ "output": "4 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [1], k = 1",
17
+ "output": "1 "
18
+ }
19
+ ],
20
+ "private_test_cases": [],
21
+ "haskell_template": "beautifulSubsets :: [Int] -> Int -> Int\nbeautifulSubsets nums k ",
22
+ "ocaml_template": "let beautifulSubsets (nums: int list) (k: int) : int = ",
23
+ "scala_template": "def beautifulSubsets(nums: List[Int],k: Int): Int = { \n \n}",
24
+ "java_template": "public static int beautifulSubsets(List<Integer> nums, int k) {\n\n}",
25
+ "python_template": "class Solution(object):\n def beautifulSubsets(self, nums, k):\n \"\"\"\n :type nums: List[int]\n :type k: int\n :rtype: int\n \"\"\"\n "
26
+ }
the_number_of_beautiful_subsets/ocaml_tests/main.ml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal 4 (beautifulSubsets [2;4;6] 2)
12
+
13
+ let test2 _ = assert_equal 1 (beautifulSubsets [1] 1)
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for beautifulSubsets" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
the_number_of_beautiful_subsets/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.beautifulSubsets(List(2,4,6),2), 4)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.beautifulSubsets(List(1),1), 1)
10
+ }
11
+
12
+ }