algorithm-discovery-engine 1.0.0__tar.gz → 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/PKG-INFO +4 -4
  2. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/README.md +3 -3
  3. algorithm_discovery_engine-1.0.1/catalog/discoveries/report.json +126 -0
  4. algorithm_discovery_engine-1.0.1/catalog/discoveries/report.md +158 -0
  5. algorithm_discovery_engine-1.0.1/catalog/discoveries/solutions/best_time_buy_sell.py +10 -0
  6. algorithm_discovery_engine-1.0.1/catalog/discoveries/solutions/climbing_stairs.py +5 -0
  7. algorithm_discovery_engine-1.0.1/catalog/discoveries/solutions/contains_duplicate.py +7 -0
  8. algorithm_discovery_engine-1.0.1/catalog/discoveries/solutions/jump_game.py +8 -0
  9. algorithm_discovery_engine-1.0.1/catalog/discoveries/solutions/majority_element.py +12 -0
  10. algorithm_discovery_engine-1.0.1/catalog/discoveries/solutions/max_circular_subarray.py +15 -0
  11. algorithm_discovery_engine-1.0.1/catalog/discoveries/solutions/max_subarray.py +10 -0
  12. algorithm_discovery_engine-1.0.1/catalog/discovery_targets.json +238 -0
  13. algorithm_discovery_engine-1.0.1/catalog/problems.json +190 -0
  14. algorithm_discovery_engine-1.0.1/engine/gen_tests.py +198 -0
  15. algorithm_discovery_engine-1.0.1/engine/runner.py +226 -0
  16. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/pyproject.toml +6 -2
  17. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/gui/core.py +13 -1
  18. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/synth/corpus.py +13 -1
  19. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/.gitignore +0 -0
  20. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/LICENSE +0 -0
  21. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/languages/cpp/tests/generated_test_data.hpp +0 -0
  22. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/languages/cpp/tests/test_runner.cpp +0 -0
  23. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/languages/java/src/ads/Benchmark.java +0 -0
  24. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/languages/java/src/ads/Solutions.java +0 -0
  25. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/languages/java/src/ads/Structures.java +0 -0
  26. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/languages/java/src/ads/TestRunner.java +0 -0
  27. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/languages/java/src/ads/gen/TestData.java +0 -0
  28. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/languages/rust/src/gen/mod.rs +0 -0
  29. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/languages/rust/src/lib.rs +0 -0
  30. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/languages/rust/src/solutions.rs +0 -0
  31. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/languages/rust/src/structures.rs +0 -0
  32. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/languages/rust/tests/catalog.rs +0 -0
  33. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/ads/__init__.py +0 -0
  34. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/ads/benchmark.py +0 -0
  35. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/ads/problems.py +0 -0
  36. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/ads/problems_advanced.py +0 -0
  37. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/ads/structures.py +0 -0
  38. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/ads/structures_advanced.py +0 -0
  39. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/algo_discovery/__init__.py +0 -0
  40. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/algo_discovery/__main__.py +0 -0
  41. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/algo_discovery/engine.py +0 -0
  42. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/algo_discovery/features.py +0 -0
  43. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/algo_discovery/hypotheses.py +0 -0
  44. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/algo_discovery/models.py +0 -0
  45. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/gui/__init__.py +0 -0
  46. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/gui/__main__.py +0 -0
  47. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/gui/app.py +0 -0
  48. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/synth/__init__.py +0 -0
  49. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/synth/__main__.py +0 -0
  50. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/synth/discovery.py +0 -0
  51. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/synth/grammar.py +0 -0
  52. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/src/synth/search.py +0 -0
  53. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/tests/test_catalog.py +0 -0
  54. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/tests/test_engine.py +0 -0
  55. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/tests/test_features.py +0 -0
  56. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/tests/test_gui.py +0 -0
  57. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/tests/test_hypotheses.py +0 -0
  58. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/tests/test_models.py +0 -0
  59. {algorithm_discovery_engine-1.0.0 → algorithm_discovery_engine-1.0.1}/tests/test_synth.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: algorithm-discovery-engine
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: Multi-language algorithms & data structures solving engine (Java, C++, Rust, Python) with cross-language benchmarks and a local AI synthesizer that rediscovers algorithms from examples.
5
5
  Author: dsk-dev-ai
6
6
  License: MIT
@@ -208,11 +208,11 @@ Core logic lives in `gui/core.py` and is tested headlessly in CI (`-p gui` mypy
208
208
  Prebuilt on **GitHub Packages** (amd64 + arm64) — no install needed:
209
209
 
210
210
  ```sh
211
- docker pull ghcr.io/dsk-dev-ai/algorithm-discovery-engine:v1.0.0
212
- docker run --rm ghcr.io/dsk-dev-ai/algorithm-discovery-engine:v1.0.0 --smoke
211
+ docker pull ghcr.io/dsk-dev-ai/algorithm-discovery-engine:v1.0.1
212
+ docker run --rm ghcr.io/dsk-dev-ai/algorithm-discovery-engine:v1.0.1 --smoke
213
213
  ```
214
214
 
215
- Tags: `latest`, per-version (`v1.0.0`), and per-commit (`sha-<hash>`). The image runs
215
+ Tags: `latest`, per-version (`v1.0.1`), and per-commit (`sha-<hash>`). The image runs
216
216
  the local algorithm synthesizer by default; override with any `python -m` command.
217
217
 
218
218
  ## Documentation
@@ -185,11 +185,11 @@ Core logic lives in `gui/core.py` and is tested headlessly in CI (`-p gui` mypy
185
185
  Prebuilt on **GitHub Packages** (amd64 + arm64) — no install needed:
186
186
 
187
187
  ```sh
188
- docker pull ghcr.io/dsk-dev-ai/algorithm-discovery-engine:v1.0.0
189
- docker run --rm ghcr.io/dsk-dev-ai/algorithm-discovery-engine:v1.0.0 --smoke
188
+ docker pull ghcr.io/dsk-dev-ai/algorithm-discovery-engine:v1.0.1
189
+ docker run --rm ghcr.io/dsk-dev-ai/algorithm-discovery-engine:v1.0.1 --smoke
190
190
  ```
191
191
 
192
- Tags: `latest`, per-version (`v1.0.0`), and per-commit (`sha-<hash>`). The image runs
192
+ Tags: `latest`, per-version (`v1.0.1`), and per-commit (`sha-<hash>`). The image runs
193
193
  the local algorithm synthesizer by default; override with any `python -m` command.
194
194
 
195
195
  ## Documentation
@@ -0,0 +1,126 @@
1
+ {
2
+ "generated_at": "2026-09-10T17:55:40Z",
3
+ "fuzz_per_target": 10,
4
+ "solved_catalog_problems": 10,
5
+ "targets": [
6
+ {
7
+ "id": "max_subarray",
8
+ "status": "verified",
9
+ "hidden": false,
10
+ "search_ms": 34257,
11
+ "curated_examples_pass": true,
12
+ "fuzz_examples_pass": true,
13
+ "fuzz_run": 10,
14
+ "source": "def discovered_max_subarray(arg):\n if not arg:\n return 0\n s0 = arg[0]\n s1 = 0\n for i, x in enumerate(arg):\n n = len(arg)\n s1 = max(x, s1 + x)\n s0 = max(s0, s1)\n return s0",
15
+ "size_metric": 4,
16
+ "kind": "scan",
17
+ "strategy": "",
18
+ "time_class": "O(n), O(1) extra space",
19
+ "novelty": "rediscovered",
20
+ "novelty_note": "target already solved in the shared (4-language) catalog; this candidate matches the same contract all tier runners assert",
21
+ "signature": "max_subarray(nums: list[int]) -> int"
22
+ },
23
+ {
24
+ "id": "max_circular_subarray",
25
+ "status": "verified",
26
+ "hidden": false,
27
+ "search_ms": 0,
28
+ "curated_examples_pass": true,
29
+ "fuzz_examples_pass": true,
30
+ "fuzz_run": 10,
31
+ "source": "def discovered_max_circular_subarray(arg):\n if not arg:\n return 0\n best_end = arg[0]\n best = arg[0]\n for x in arg[1:]:\n best_end = max(x, best_end + x)\n best = max(best, best_end)\n total = sum(arg)\n min_end = 0\n min_wrap = 0\n for x in arg:\n min_end = min(0, min_end + x)\n min_wrap = min(min_wrap, min_end)\n return max(best, total - min_wrap, 0)",
32
+ "size_metric": 24,
33
+ "kind": "template:circular-kadane",
34
+ "strategy": "Kadane + minimum-window wrap (two passes)",
35
+ "time_class": "O(n), O(1) extra space",
36
+ "novelty": "new-to-catalog",
37
+ "novelty_note": "not part of the shared catalog yet - a candidate worth porting to the language tiers",
38
+ "signature": "max_circular_subarray(nums: list[int]) -> int"
39
+ },
40
+ {
41
+ "id": "best_time_buy_sell",
42
+ "status": "verified",
43
+ "hidden": false,
44
+ "search_ms": 31282,
45
+ "curated_examples_pass": true,
46
+ "fuzz_examples_pass": true,
47
+ "fuzz_run": 10,
48
+ "source": "def discovered_best_time_buy_sell(arg):\n if not arg:\n return 0\n s0 = arg[0]\n s1 = 0\n for i, x in enumerate(arg):\n n = len(arg)\n s0 = min(s0, x)\n s1 = max(s1, x - s0)\n return s1",
49
+ "size_metric": 4,
50
+ "kind": "scan",
51
+ "strategy": "",
52
+ "time_class": "O(n), O(1) extra space",
53
+ "novelty": "new-to-catalog",
54
+ "novelty_note": "not part of the shared catalog yet - a candidate worth porting to the language tiers",
55
+ "signature": "best_time_buy_sell(prices: list[int]) -> int"
56
+ },
57
+ {
58
+ "id": "jump_game",
59
+ "status": "verified",
60
+ "hidden": false,
61
+ "search_ms": 30814,
62
+ "curated_examples_pass": true,
63
+ "fuzz_examples_pass": true,
64
+ "fuzz_run": 10,
65
+ "source": "def discovered_jump_game(arg):\n s0 = 0\n s1 = 0\n for i, x in enumerate(arg):\n n = len(arg)\n s1 = max(s1, i - s0)\n s0 = max(s0, i + x)\n return s1 == 0",
66
+ "size_metric": 6,
67
+ "kind": "scan",
68
+ "strategy": "",
69
+ "time_class": "O(n), O(1) extra space",
70
+ "novelty": "new-to-catalog",
71
+ "novelty_note": "not part of the shared catalog yet - a candidate worth porting to the language tiers",
72
+ "signature": "jump_game(nums: list[int]) -> bool"
73
+ },
74
+ {
75
+ "id": "contains_duplicate",
76
+ "status": "verified",
77
+ "hidden": false,
78
+ "search_ms": 0,
79
+ "curated_examples_pass": true,
80
+ "fuzz_examples_pass": true,
81
+ "fuzz_run": 10,
82
+ "source": "def discovered_contains_duplicate(arg):\n seen = set()\n for x in arg:\n if x in seen:\n return True\n seen.add(x)\n return False",
83
+ "size_metric": 8,
84
+ "kind": "seen",
85
+ "strategy": "hash-set membership trace",
86
+ "time_class": "O(n), O(n) extra space",
87
+ "novelty": "new-to-catalog",
88
+ "novelty_note": "not part of the shared catalog yet - a candidate worth porting to the language tiers",
89
+ "signature": "contains_duplicate(nums: list[int]) -> bool"
90
+ },
91
+ {
92
+ "id": "majority_element",
93
+ "status": "verified",
94
+ "hidden": false,
95
+ "search_ms": 0,
96
+ "curated_examples_pass": true,
97
+ "fuzz_examples_pass": true,
98
+ "fuzz_run": 10,
99
+ "source": "def discovered_majority_element(arg):\n candidate = arg[0]\n count = 1\n for x in arg[1:]:\n if x == candidate:\n count += 1\n elif count == 0:\n candidate = x\n count = 1\n else:\n count -= 1\n return candidate",
100
+ "size_metric": 15,
101
+ "kind": "vote",
102
+ "strategy": "Boyer-Moore majority voting",
103
+ "time_class": "O(n), O(1) extra space",
104
+ "novelty": "new-to-catalog",
105
+ "novelty_note": "not part of the shared catalog yet - a candidate worth porting to the language tiers",
106
+ "signature": "majority_element(nums: list[int]) -> int"
107
+ },
108
+ {
109
+ "id": "climbing_stairs",
110
+ "status": "verified",
111
+ "hidden": false,
112
+ "search_ms": 0,
113
+ "curated_examples_pass": true,
114
+ "fuzz_examples_pass": true,
115
+ "fuzz_run": 10,
116
+ "source": "def discovered_climbing_stairs(arg):\n a, b = 1, 1\n for _ in range(arg):\n a, b = b, a + b\n return a",
117
+ "size_metric": 9,
118
+ "kind": "fib",
119
+ "strategy": "two-token linear recurrence (Fibonacci)",
120
+ "time_class": "O(n), O(1) extra space",
121
+ "novelty": "new-to-catalog",
122
+ "novelty_note": "not part of the shared catalog yet - a candidate worth porting to the language tiers",
123
+ "signature": "climbing_stairs(n: int) -> int"
124
+ }
125
+ ]
126
+ }
@@ -0,0 +1,158 @@
1
+ # Discovery report
2
+
3
+ Fuzz cases per target: 10 · solved catalog problems: 10
4
+
5
+ | target | status | strategy | size | novelty |
6
+ | --- | --- | --- | ---: | --- |
7
+ | max_subarray | verified | | 4 | rediscovered |
8
+ | max_circular_subarray | verified | Kadane + minimum-window wrap (two passes) | 24 | new-to-catalog |
9
+ | best_time_buy_sell | verified | | 4 | new-to-catalog |
10
+ | jump_game | verified | | 6 | new-to-catalog |
11
+ | contains_duplicate | verified | hash-set membership trace | 8 | new-to-catalog |
12
+ | majority_element | verified | Boyer-Moore majority voting | 15 | new-to-catalog |
13
+ | climbing_stairs | verified | two-token linear recurrence (Fibonacci) | 9 | new-to-catalog |
14
+
15
+ ## max_subarray (`scan`)
16
+
17
+ `max_subarray(nums: list[int]) -> int`
18
+
19
+ - Complexity: O(n), O(1) extra space
20
+ - Novelty: rediscovered — target already solved in the shared (4-language) catalog; this candidate matches the same contract all tier runners assert
21
+ - Verified on all curated examples and 10 fuzz inputs.
22
+
23
+ ```python
24
+ def discovered_max_subarray(arg):
25
+ if not arg:
26
+ return 0
27
+ s0 = arg[0]
28
+ s1 = 0
29
+ for i, x in enumerate(arg):
30
+ n = len(arg)
31
+ s1 = max(x, s1 + x)
32
+ s0 = max(s0, s1)
33
+ return s0
34
+ ```
35
+
36
+ ## max_circular_subarray (`template:circular-kadane`)
37
+
38
+ `max_circular_subarray(nums: list[int]) -> int`
39
+
40
+ - Complexity: O(n), O(1) extra space
41
+ - Novelty: new-to-catalog — not part of the shared catalog yet - a candidate worth porting to the language tiers
42
+ - Verified on all curated examples and 10 fuzz inputs.
43
+
44
+ ```python
45
+ def discovered_max_circular_subarray(arg):
46
+ if not arg:
47
+ return 0
48
+ best_end = arg[0]
49
+ best = arg[0]
50
+ for x in arg[1:]:
51
+ best_end = max(x, best_end + x)
52
+ best = max(best, best_end)
53
+ total = sum(arg)
54
+ min_end = 0
55
+ min_wrap = 0
56
+ for x in arg:
57
+ min_end = min(0, min_end + x)
58
+ min_wrap = min(min_wrap, min_end)
59
+ return max(best, total - min_wrap, 0)
60
+ ```
61
+
62
+ ## best_time_buy_sell (`scan`)
63
+
64
+ `best_time_buy_sell(prices: list[int]) -> int`
65
+
66
+ - Complexity: O(n), O(1) extra space
67
+ - Novelty: new-to-catalog — not part of the shared catalog yet - a candidate worth porting to the language tiers
68
+ - Verified on all curated examples and 10 fuzz inputs.
69
+
70
+ ```python
71
+ def discovered_best_time_buy_sell(arg):
72
+ if not arg:
73
+ return 0
74
+ s0 = arg[0]
75
+ s1 = 0
76
+ for i, x in enumerate(arg):
77
+ n = len(arg)
78
+ s0 = min(s0, x)
79
+ s1 = max(s1, x - s0)
80
+ return s1
81
+ ```
82
+
83
+ ## jump_game (`scan`)
84
+
85
+ `jump_game(nums: list[int]) -> bool`
86
+
87
+ - Complexity: O(n), O(1) extra space
88
+ - Novelty: new-to-catalog — not part of the shared catalog yet - a candidate worth porting to the language tiers
89
+ - Verified on all curated examples and 10 fuzz inputs.
90
+
91
+ ```python
92
+ def discovered_jump_game(arg):
93
+ s0 = 0
94
+ s1 = 0
95
+ for i, x in enumerate(arg):
96
+ n = len(arg)
97
+ s1 = max(s1, i - s0)
98
+ s0 = max(s0, i + x)
99
+ return s1 == 0
100
+ ```
101
+
102
+ ## contains_duplicate (`seen`)
103
+
104
+ `contains_duplicate(nums: list[int]) -> bool`
105
+
106
+ - Complexity: O(n), O(n) extra space
107
+ - Novelty: new-to-catalog — not part of the shared catalog yet - a candidate worth porting to the language tiers
108
+ - Verified on all curated examples and 10 fuzz inputs.
109
+
110
+ ```python
111
+ def discovered_contains_duplicate(arg):
112
+ seen = set()
113
+ for x in arg:
114
+ if x in seen:
115
+ return True
116
+ seen.add(x)
117
+ return False
118
+ ```
119
+
120
+ ## majority_element (`vote`)
121
+
122
+ `majority_element(nums: list[int]) -> int`
123
+
124
+ - Complexity: O(n), O(1) extra space
125
+ - Novelty: new-to-catalog — not part of the shared catalog yet - a candidate worth porting to the language tiers
126
+ - Verified on all curated examples and 10 fuzz inputs.
127
+
128
+ ```python
129
+ def discovered_majority_element(arg):
130
+ candidate = arg[0]
131
+ count = 1
132
+ for x in arg[1:]:
133
+ if x == candidate:
134
+ count += 1
135
+ elif count == 0:
136
+ candidate = x
137
+ count = 1
138
+ else:
139
+ count -= 1
140
+ return candidate
141
+ ```
142
+
143
+ ## climbing_stairs (`fib`)
144
+
145
+ `climbing_stairs(n: int) -> int`
146
+
147
+ - Complexity: O(n), O(1) extra space
148
+ - Novelty: new-to-catalog — not part of the shared catalog yet - a candidate worth porting to the language tiers
149
+ - Verified on all curated examples and 10 fuzz inputs.
150
+
151
+ ```python
152
+ def discovered_climbing_stairs(arg):
153
+ a, b = 1, 1
154
+ for _ in range(arg):
155
+ a, b = b, a + b
156
+ return a
157
+ ```
158
+
@@ -0,0 +1,10 @@
1
+ def discovered_best_time_buy_sell(arg):
2
+ if not arg:
3
+ return 0
4
+ s0 = arg[0]
5
+ s1 = 0
6
+ for i, x in enumerate(arg):
7
+ n = len(arg)
8
+ s0 = min(s0, x)
9
+ s1 = max(s1, x - s0)
10
+ return s1
@@ -0,0 +1,5 @@
1
+ def discovered_climbing_stairs(arg):
2
+ a, b = 1, 1
3
+ for _ in range(arg):
4
+ a, b = b, a + b
5
+ return a
@@ -0,0 +1,7 @@
1
+ def discovered_contains_duplicate(arg):
2
+ seen = set()
3
+ for x in arg:
4
+ if x in seen:
5
+ return True
6
+ seen.add(x)
7
+ return False
@@ -0,0 +1,8 @@
1
+ def discovered_jump_game(arg):
2
+ s0 = 0
3
+ s1 = 0
4
+ for i, x in enumerate(arg):
5
+ n = len(arg)
6
+ s1 = max(s1, i - s0)
7
+ s0 = max(s0, i + x)
8
+ return s1 == 0
@@ -0,0 +1,12 @@
1
+ def discovered_majority_element(arg):
2
+ candidate = arg[0]
3
+ count = 1
4
+ for x in arg[1:]:
5
+ if x == candidate:
6
+ count += 1
7
+ elif count == 0:
8
+ candidate = x
9
+ count = 1
10
+ else:
11
+ count -= 1
12
+ return candidate
@@ -0,0 +1,15 @@
1
+ def discovered_max_circular_subarray(arg):
2
+ if not arg:
3
+ return 0
4
+ best_end = arg[0]
5
+ best = arg[0]
6
+ for x in arg[1:]:
7
+ best_end = max(x, best_end + x)
8
+ best = max(best, best_end)
9
+ total = sum(arg)
10
+ min_end = 0
11
+ min_wrap = 0
12
+ for x in arg:
13
+ min_end = min(0, min_end + x)
14
+ min_wrap = min(min_wrap, min_end)
15
+ return max(best, total - min_wrap, 0)
@@ -0,0 +1,10 @@
1
+ def discovered_max_subarray(arg):
2
+ if not arg:
3
+ return 0
4
+ s0 = arg[0]
5
+ s1 = 0
6
+ for i, x in enumerate(arg):
7
+ n = len(arg)
8
+ s1 = max(x, s1 + x)
9
+ s0 = max(s0, s1)
10
+ return s0
@@ -0,0 +1,238 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "_meta": "Discovery targets for the local synthesizer. Each entry carries curated I/O examples (the search learns from these), plus an oracle + fuzz generator used for out-of-sample verification. 'kind' selects which search backend runs.",
4
+ "targets": [
5
+ {
6
+ "id": "max_subarray",
7
+ "kind": "scan",
8
+ "signature": "max_subarray(nums: list[int]) -> int",
9
+ "description": "Maximum contiguous subarray sum (non-empty). Already solved in the shared catalog - the synthesizer must rediscover it from examples.",
10
+ "returns": "int",
11
+ "cases": [
12
+ {
13
+ "in": "1 -2 3 4|",
14
+ "out": "7"
15
+ },
16
+ {
17
+ "in": "-2 1 -3 4 -1 2 1 -5 4|",
18
+ "out": "6"
19
+ },
20
+ {
21
+ "in": "-1 -2 -3|",
22
+ "out": "-1"
23
+ },
24
+ {
25
+ "in": "5|",
26
+ "out": "5"
27
+ },
28
+ {
29
+ "in": "5 -2 3|",
30
+ "out": "6"
31
+ }
32
+ ],
33
+ "arg_types": [
34
+ "list"
35
+ ]
36
+ },
37
+ {
38
+ "id": "max_circular_subarray",
39
+ "kind": "template",
40
+ "signature": "max_circular_subarray(nums: list[int]) -> int",
41
+ "description": "Maximum sum over all circular subarrays (wrap-around allowed); empty selection allowed so all-negative input returns 0.",
42
+ "returns": "int",
43
+ "cases": [
44
+ {
45
+ "in": "5 -3 5|",
46
+ "out": "10"
47
+ },
48
+ {
49
+ "in": "8 -1 3 4|",
50
+ "out": "15"
51
+ },
52
+ {
53
+ "in": "-3 -2 -1|",
54
+ "out": "0"
55
+ },
56
+ {
57
+ "in": "1 -2 3 -2|",
58
+ "out": "3"
59
+ },
60
+ {
61
+ "in": "3 -1 2 -1|",
62
+ "out": "4"
63
+ },
64
+ {
65
+ "in": "6 -10 6|",
66
+ "out": "12"
67
+ }
68
+ ],
69
+ "arg_types": [
70
+ "list"
71
+ ]
72
+ },
73
+ {
74
+ "id": "best_time_buy_sell",
75
+ "kind": "scan",
76
+ "signature": "best_time_buy_sell(prices: list[int]) -> int",
77
+ "description": "Maximum profit from a single buy-then-sell pair; 0 when none is possible.",
78
+ "returns": "int",
79
+ "cases": [
80
+ {
81
+ "in": "7 1 5 3 6 4|",
82
+ "out": "5"
83
+ },
84
+ {
85
+ "in": "7 6 4 3 1|",
86
+ "out": "0"
87
+ },
88
+ {
89
+ "in": "1 2|",
90
+ "out": "1"
91
+ },
92
+ {
93
+ "in": "2 1|",
94
+ "out": "0"
95
+ },
96
+ {
97
+ "in": "3 2 6 5 0 3|",
98
+ "out": "4"
99
+ }
100
+ ],
101
+ "arg_types": [
102
+ "list"
103
+ ]
104
+ },
105
+ {
106
+ "id": "jump_game",
107
+ "kind": "scan",
108
+ "signature": "jump_game(nums: list[int]) -> bool",
109
+ "description": "Whether the last index is reachable by jumping at most nums[i] steps from each index.",
110
+ "returns": "bool",
111
+ "cases": [
112
+ {
113
+ "in": "2 3 1 1 4|",
114
+ "out": "true"
115
+ },
116
+ {
117
+ "in": "3 2 1 0 4|",
118
+ "out": "false"
119
+ },
120
+ {
121
+ "in": "0|",
122
+ "out": "true"
123
+ },
124
+ {
125
+ "in": "0 2 3|",
126
+ "out": "false"
127
+ },
128
+ {
129
+ "in": "1 2 0 1|",
130
+ "out": "true"
131
+ }
132
+ ],
133
+ "arg_types": [
134
+ "list"
135
+ ]
136
+ },
137
+ {
138
+ "id": "contains_duplicate",
139
+ "kind": "seen",
140
+ "signature": "contains_duplicate(nums: list[int]) -> bool",
141
+ "description": "Whether any value appears more than once.",
142
+ "returns": "bool",
143
+ "cases": [
144
+ {
145
+ "in": "1 2 3 1|",
146
+ "out": "true"
147
+ },
148
+ {
149
+ "in": "1 2 3 4|",
150
+ "out": "false"
151
+ },
152
+ {
153
+ "in": "1 1 1|",
154
+ "out": "true"
155
+ },
156
+ {
157
+ "in": "|",
158
+ "out": "false"
159
+ },
160
+ {
161
+ "in": "0 5 0|",
162
+ "out": "true"
163
+ }
164
+ ],
165
+ "arg_types": [
166
+ "list"
167
+ ]
168
+ },
169
+ {
170
+ "id": "majority_element",
171
+ "kind": "vote",
172
+ "signature": "majority_element(nums: list[int]) -> int",
173
+ "description": "Element occurring more than n//2 times (guaranteed present).",
174
+ "returns": "int",
175
+ "cases": [
176
+ {
177
+ "in": "3 2 3|",
178
+ "out": "3"
179
+ },
180
+ {
181
+ "in": "2 2 1 1 1 2 2|",
182
+ "out": "2"
183
+ },
184
+ {
185
+ "in": "5|",
186
+ "out": "5"
187
+ },
188
+ {
189
+ "in": "1 1 2|",
190
+ "out": "1"
191
+ },
192
+ {
193
+ "in": "-1 -1 3|",
194
+ "out": "-1"
195
+ }
196
+ ],
197
+ "arg_types": [
198
+ "list"
199
+ ]
200
+ },
201
+ {
202
+ "id": "climbing_stairs",
203
+ "kind": "fib",
204
+ "signature": "climbing_stairs(n: int) -> int",
205
+ "description": "Number of distinct ways to climb n stairs taking 1 or 2 steps at a time.",
206
+ "returns": "int",
207
+ "cases": [
208
+ {
209
+ "in": "0|",
210
+ "out": "1"
211
+ },
212
+ {
213
+ "in": "1|",
214
+ "out": "1"
215
+ },
216
+ {
217
+ "in": "2|",
218
+ "out": "2"
219
+ },
220
+ {
221
+ "in": "3|",
222
+ "out": "3"
223
+ },
224
+ {
225
+ "in": "4|",
226
+ "out": "5"
227
+ },
228
+ {
229
+ "in": "6|",
230
+ "out": "13"
231
+ }
232
+ ],
233
+ "arg_types": [
234
+ "int"
235
+ ]
236
+ }
237
+ ]
238
+ }