You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .cursor/commands/batch-problem-creation.md
+44-11Lines changed: 44 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,9 +9,11 @@ When user requests **batch creation of multiple problems**, the assistant will:
9
9
3.**For each problem**:
10
10
- Find next problem via `poetry run python .cursor/.dev/next_problem.py`
11
11
- Follow all steps from `.cursor/commands/problem-creation.md`
12
-
-Verify reproducibility and quality via `.cursor/commands/test-quality-assurance.md`
12
+
-**MANDATORY**: Read and follow `.cursor/commands/test-quality-assurance.md` for quality verification
13
13
4.**Provide batch summary** at the end
14
14
15
+
**CRITICAL INSTRUCTION**: You MUST read the test-quality-assurance.md file before executing quality assurance for any problem. Do not rely on memory or assumptions about the workflow.
16
+
15
17
## High-Level Process
16
18
17
19
### Step 1: Initialize Batch
@@ -32,6 +34,7 @@ poetry run python .cursor/.dev/next_problem.py
32
34
33
35
- Extract problem number and name from output
34
36
- Log progress: "Problem X/Count: #NUMBER - NAME"
37
+
-**Note**: The script automatically excludes unscrapable problems (premium, API issues, etc.)
35
38
36
39
#### 2.2: Follow Problem Creation Workflow
37
40
@@ -55,15 +58,17 @@ Execute complete workflow from `.cursor/commands/problem-creation.md`:
55
58
3.**Use parametrized testing**: Ensure all solution approaches are tested
56
59
4.**Verify correctness**: Solution must handle all test cases correctly
**CRITICAL**: Do NOT proceed without reading the test-quality-assurance.md file first. The workflow includes specific backup, regenerate, and restore steps that must be followed exactly.
67
72
68
73
### Step 3: Batch Summary
69
74
@@ -142,11 +147,12 @@ Next Steps: All problems created successfully!
142
147
143
148
### Common failure scenarios:
144
149
145
-
- Scraping fails (problem not found)
150
+
- Scraping fails (problem not found, premium problem, API issues)
146
151
- JSON template issues (invalid syntax)
147
152
- Generation fails (missing dependencies)
148
153
- Tests fail (incorrect expected values)
149
154
- Linting errors (template problems)
155
+
- Unscrapable problems (automatically excluded by next_problem.py)
150
156
151
157
### Recovery actions:
152
158
@@ -155,6 +161,9 @@ Next Steps: All problems created successfully!
155
161
-**Generation**: Check Makefile and dependencies
156
162
-**Tests**: Update expected values in JSON template
157
163
-**Linting**: Fix template issues and regenerate
164
+
-**Unscrapable**: Add to `.cursor/.dev/problem_lists/unscrapable.py` and continue with next problem
165
+
166
+
**CRITICAL**: Never edit generated files directly (helpers.py, test_solution.py, README.md, etc.). Always fix issues in the JSON template and regenerate to ensure reproducibility. The ONLY exception is solution.py implementation - you may edit this file directly to implement the optimal solution.
158
167
159
168
## Success Criteria
160
169
@@ -166,10 +175,13 @@ Each problem must meet:
166
175
- ✅ **Parametrized testing** for all solution approaches
167
176
- ✅ Linting passes without errors
168
177
- ✅ All tests pass
169
-
- ✅ Minimum 12 comprehensive test cases
178
+
- ✅ **test-quality-assurance.md file read and complete workflow executed**
179
+
- ✅ Minimum 12 comprehensive test cases (verified via check_test_cases tool)
Updates `.tags.json5` by running the `update_tags.py` script, sorting the output alphabetically, and cleaning up temporary files. The LLM handles this process directly to preserve comments in the JSON5 file.
6
+
7
+
## Usage
8
+
9
+
When user requests "update tags" or "update-tags", the assistant will:
10
+
11
+
1.**Run update script**: Execute `poetry run python .cursor/.dev/update_tags.py`
12
+
2.**Read output**: Read the generated `.cursor/.dev/update_tags.json` file
13
+
3.**Read current tags**: Read the existing `.tags.json5` file to preserve comments
14
+
4.**Sort and merge**: Sort the new tags alphabetically by name and merge with existing structure
15
+
5.**Update file**: Write the updated tags to `.tags.json5` while preserving comments
16
+
6.**Cleanup**: Delete the temporary `.cursor/.dev/update_tags.json` file
17
+
18
+
## LLM Workflow
19
+
20
+
```python
21
+
# 1. Run the update script
22
+
poetry run python .cursor/.dev/update_tags.py
23
+
24
+
# 2. Read the generated JSON file
25
+
withopen('.cursor/.dev/update_tags.json', 'r') as f:
26
+
new_tags = json.load(f)
27
+
28
+
# 3. Read existing .tags.json5 to preserve comments
Given an integer `n`, return _an array_`ans`_of length_`n + 1`_such that for each_`i`_(0 <= i <= n),_`ans[i]`\*is the **number of\***`1`**\*'s** in the binary representation of\*`i`.
12
+
13
+
## Examples
14
+
15
+
### Example 1:
16
+
17
+
```
18
+
Input: n = 2
19
+
Output: [0,1,1]
20
+
Explanation:
21
+
0 --> 0
22
+
1 --> 1
23
+
2 --> 10
24
+
```
25
+
26
+
### Example 2:
27
+
28
+
```
29
+
Input: n = 5
30
+
Output: [0,1,1,2,1,2]
31
+
Explanation:
32
+
0 --> 0
33
+
1 --> 1
34
+
2 --> 10
35
+
3 --> 11
36
+
4 --> 100
37
+
5 --> 101
38
+
```
39
+
40
+
## Constraints
41
+
42
+
- 0 <= n <= 10^5
43
+
44
+
**Follow up:**
45
+
46
+
- It is very easy to come up with a solution with a runtime of `O(n log n)`. Can you do it in linear time `O(n)` and possibly in a single pass?
47
+
- Can you do it without using any built-in function (i.e., like `__builtin_popcount` in C++)?
0 commit comments