File size: 4,972 Bytes
9778f73
 
 
 
d8caef1
9778f73
 
 
 
d8caef1
1dc791b
17530ca
 
 
 
 
 
657690f
17530ca
6a7d655
 
 
 
 
 
17530ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d7aa1da
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
---
license: mit
task_categories:
- text-generation
- text2text-generation
language:
- en
tags:
- code
size_categories:
- n<1K
---

# LeetCode-Contest

Contains 80 questions of LeetCode weekly and bi-weekly contests released after **March 2024**.

Each question contains an average of **644** test cases, as well as programming solutions in Python language collected from the official LeetCode website.

## Requirements

```bash
pip install sortedcontainers
```

## Dataset Structure

### Dataset Fields

- index: The problem numbers in the dataset, from 0 to 79.  
- title: The title of the problem.
- title_slug: The title name connected by "_".   
- question_id: The problem id.
- question_fronted_id: The problem id in the LeetCode front-end.
- difficulty: The difficulty level of the problem, one of "Easy", "Medium", and "Hard".

| Level     | Numbers   |
| -         | -         |
| Easy      | 20        |
| Medium    | 39        |
| Hard      | 21        |


- contest: The name of the contest that include the problem.
- prompt: The problem description with the example input and output removed.
- entry_point: The function name.
- solution: The Python solution for the problem.
- tests: The main test cases, used to verify the correctness of the generated code.
- challenge_tests: Some large scale test cases that be used to further verify the performance of the code.
- public_tests: The public test cases extracted from the problem description.
- prompt_full: The original problem description.


### An Example of a Dataset Instance

```json
{
    "index": 0,
    "title": "Count Pairs That Form a Complete Day I",
    "title_slug": "count-pairs-that-form-a-complete-day-i",
    "question_id": "3421",
    "question_frontend_id": "3184",
    "difficulty": "Easy",
    "contest": "weekly-contest-402",
    "prompt": "from typing import List\n\ndef countCompleteDayPairs(hours: List[int]) -> int:\n    \"\"\"\n    Given an integer array `hours` representing times in **hours** , return an\n    integer denoting the number of pairs `i`, `j` where `i < j` and `hours[i] +\n    hours[j]` forms a **complete day**.\n    \n    A **complete day** is defined as a time duration that is an **exact**\n    **multiple** of 24 hours.  \n    \n    **Constraints:**\n    \n      * `1 <= hours.length <= 100`\n      * `1 <= hours[i] <= 10 ^ 9`\n    \"\"\"",
    "entry_point": "countCompleteDayPairs",
    "solution": "from typing import List\nfrom collections import Counter\n\ndef countCompleteDayPairs(hours: List[int]) -> int:\n    ctr = Counter(map(lambda x: x % 24, hours))\n    count = sum(ctr[i] * ctr[24 - i] for i in range(1, 12))\n    return count + (ctr[12] * (ctr[12] - 1) + ctr[0] * (ctr[0] - 1)) // 2",
    "tests": ["assert countCompleteDayPairs([12, 12, 30, 24, 24]) == 2", ...], // about 500 test cases
    "challenge_tests": [],
    "public_tests": ["assert countCompleteDayPairs([12, 12, 30, 24, 24]) == 2", "assert countCompleteDayPairs([72, 48, 24, 3]) == 3"],
    "prompt_full": "from typing import List\n\ndef countCompleteDayPairs(hours: List[int]) -> int:\n    \"\"\"\n    Given an integer array `hours` representing times in **hours** , return an\n    integer denoting the number of pairs `i`, `j` where `i < j` and `hours[i] +\n    hours[j]` forms a **complete day**.\n    \n    A **complete day** is defined as a time duration that is an **exact**\n    **multiple** of 24 hours.\n    \n    For example, 1 day is 24 hours, 2 days is 48 hours, 3 days is 72 hours, and so\n    on.\n    \n    \n    \n    **Example 1:**\n    \n    **Input:** hours = [12,12,30,24,24]\n    \n    **Output:** 2\n    \n    **Explanation:**\n    \n    The pairs of indices that form a complete day are `(0, 1)` and `(3, 4)`.\n    \n    **Example 2:**\n    \n    **Input:** hours = [72,48,24,3]\n    \n    **Output:** 3\n    \n    **Explanation:**\n    \n    The pairs of indices that form a complete day are `(0, 1)`, `(0, 2)`, and `(1,\n    2)`.\n    \n    \n    \n    **Constraints:**\n    \n      * `1 <= hours.length <= 100`\n      * `1 <= hours[i] <= 10 ^ 9`\n    \"\"\""
}
```


- prompt

```python
from typing import List

def countCompleteDayPairs(hours: List[int]) -> int:
    """
    Given an integer array `hours` representing times in **hours** , return an
    integer denoting the number of pairs `i`, `j` where `i < j` and `hours[i] +
    hours[j]` forms a **complete day**.
    
    A **complete day** is defined as a time duration that is an **exact**
    **multiple** of 24 hours.  
    
    **Constraints:**
    
      * `1 <= hours.length <= 100`
      * `1 <= hours[i] <= 10 ^ 9`
    """
```

- test
```python
assert countCompleteDayPairs([12, 12, 30, 24, 24]) == 2
```


### Citation

```
@article{li2025cocoevo,
  title={CoCoEvo: Co-Evolution of Programs and Test Cases to Enhance Code Generation},
  author={Li, Kefan and Yu, Hongyue and Guo, Tingyu and Cao, Shijie and Yuan, Yuan},
  journal={arXiv preprint arXiv:2502.10802},
  year={2025}
}
```