USACO / README.md
vectorzhou's picture
Add README.md
d96153d verified
# USACO Dataset
This dataset contains problems from the USA Computing Olympiad (USACO) organized by *seasons*. Each season runs from **November of the previous year → October of the current year, plus the US Open**. One JSONL file per season is provided (``usaco_<season>.jsonl``) for efficient storage and loading.
## Dataset Statistics
- **Total Problems**: 680
- **Total Seasons**: 14
- **Total Sample Cases**: 854
- **Total Test Cases**: 9,055
## Data Structure
Each record contains:
- `id`: Unique stable identifier for the problem
- `contest_name`: USACO contest name (e.g., "USACO_24jan")
- `difficulty_group`: Problem difficulty level (bronze, silver, gold, platinum)
- `problem_name`: Name of the specific problem
- `problem_statement`: Problem description in Markdown format
- `sample_data`: Dictionary with `inputs` and `outputs` lists for sample test cases
- `test_data`: Dictionary with `inputs` and `outputs` lists for test cases
- `num_sample_cases`: Number of sample test cases
- `num_test_cases`: Number of test cases
- `season`: Season year (e.g., "2024")
- `checker`: Always null (USACO uses standard output checking)
- `checker_interface`: Always null (USACO uses standard output checking)
## Seasons Available
| Season | Problems | File |
|--------|----------|------|
| 2025 | 48 | `usaco_2025.jsonl` |
| 2024 | 48 | `usaco_2024.jsonl` |
| 2023 | 48 | `usaco_2023.jsonl` |
| 2022 | 48 | `usaco_2022.jsonl` |
| 2021 | 48 | `usaco_2021.jsonl` |
| 2020 | 48 | `usaco_2020.jsonl` |
| 2019 | 47 | `usaco_2019.jsonl` |
| 2018 | 47 | `usaco_2018.jsonl` |
| 2017 | 47 | `usaco_2017.jsonl` |
| 2016 | 48 | `usaco_2016.jsonl` |
| 2015 | 38 | `usaco_2015.jsonl` |
| 2014 | 54 | `usaco_2014.jsonl` |
| 2013 | 55 | `usaco_2013.jsonl` |
| 2012 | 56 | `usaco_2012.jsonl` |
## Difficulty Distribution
| Difficulty | Problems |
|------------|----------|
| Bronze | 192 |
| Gold | 184 |
| Platinum | 118 |
| Silver | 186 |
## Loading Examples
```python
from datasets import load_dataset
import json
# Load all seasons (merged dataset)
all_ds = load_dataset("vectorzhou/USACO", split="train")
# Load a specific season using data_files
s2025 = load_dataset(
"vectorzhou/USACO",
data_files="usaco_2025.jsonl",
split="train",
)
# Or load directly as JSONL
with open("usaco_2025.jsonl", 'r') as f:
problems_2025 = [json.loads(line) for line in f]
# Filter by difficulty across all seasons
bronze_problems = all_ds.filter(lambda x: x['difficulty_group'] == 'bronze')
# Filter by season (when loading all data)
season_2024 = all_ds.filter(lambda x: x['season'] == '2024')
# Access a specific problem
problem = all_ds[0]
print(f"Contest: {problem['contest_name']}")
print(f"Difficulty: {problem['difficulty_group']}")
print(f"Problem: {problem['problem_name']}")
print(f"Season: {problem['season']}")
print(f"Sample inputs: {len(problem['sample_data']['inputs'])}")
print(f"Has custom checker: {problem['checker'] is not None}") # Always False for USACO
```
## Data Organization
The dataset follows USACO's seasonal structure:
- **November-December**: Counted towards the following year's season
- **January-October + US Open**: Counted towards the current year's season
- Each season typically contains 3-4 contests with Bronze, Silver, Gold, and Platinum divisions
## Format Benefits
- **JSONL format** for easy streaming and processing
- **Season-based files** for selective loading of specific time periods
- **Consistent schema** across all seasons
- **Efficient storage** with one record per line
## Data Source
The data was crawled from the USACO platform and organized into the following structure:
- Problem statements in Markdown format
- Sample and test cases with input/output pairs
- Contest and difficulty metadata
- Season classification for temporal organization
- Comprehensive coverage of available problems
## License
Please respect the original terms of use of the USACO platform when using this dataset.