Team Ai
Datasetpublic

lbaf23/LeetCode-Contest

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 pip install sortedcontainers Dataset Structure Dataset Fields index: The problem numbers in the dataset, from 0 to 79. title: The title of the problem.… See the full description on the dataset page: https://huggingface.co/datasets/lbaf23/LeetCode-Contest.

sourceHugging Facemitupdated 1y agoView on Hugging Face
2likes8downloads
Dataset Card

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.
  • —titleslug: The title name connected by "".
  • —question_id: The problem id.
  • —questionfrontedid: The problem id in the LeetCode front-end.
  • —difficulty: The difficulty level of the problem, one of "Easy", "Medium", and "Hard".
LevelNumbers
Easy20
Medium39
Hard21
  • —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{11098743,
  author={Li, Kefan and Yuan, Yuan and Yu, Hongyue and Guo, Tingyu and Cao, Shijie},
  journal={IEEE Transactions on Evolutionary Computation}, 
  title={CoCoEvo: Co-Evolution of Programs and Test Cases to Enhance Code Generation}, 
  year={2025},
  volume={},
  number={},
  pages={1-1},
  keywords={Codes;Accuracy;Maintenance engineering;Evolutionary computation;Electronic mail;Software development management;Programming;Dynamic scheduling;Computer bugs;Training;Large Language Models;Code Generation;Test Case Generation;Co-Evolution},
  doi={10.1109/TEVC.2025.3593272}}