samahadhoud commited on
Commit
7680b70
·
verified ·
1 Parent(s): ae44ed1

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +248 -91
README.md CHANGED
@@ -1,93 +1,250 @@
1
  ---
2
- dataset_info:
3
- features:
4
- - name: problem_id
5
- dtype: string
6
- - name: problem_code
7
- dtype: string
8
- - name: problem_slug
9
- dtype: string
10
- - name: problem_title
11
- dtype: string
12
- - name: contest_name
13
- dtype: string
14
- - name: contest_full_name
15
- dtype: string
16
- - name: year
17
- dtype: string
18
- - name: source
19
- dtype: string
20
- - name: total_teams
21
- dtype: int64
22
- - name: total_problems
23
- dtype: int64
24
- - name: time_limit
25
- dtype: string
26
- - name: memory_limit
27
- dtype: string
28
- - name: author
29
- dtype: string
30
- - name: analysis_author
31
- dtype: string
32
- - name: statement
33
- dtype: string
34
- - name: analysis
35
- dtype: string
36
- - name: sample_test_cases_input
37
- list: string
38
- - name: sample_test_cases_output
39
- list: string
40
- - name: num_sample_test_cases
41
- dtype: int64
42
- - name: hidden_test_cases_input
43
- list: string
44
- - name: hidden_test_cases_output
45
- list: string
46
- - name: num_hidden_test_cases
47
- dtype: int64
48
- - name: has_special_judge
49
- dtype: bool
50
- - name: special_judge_code
51
- dtype: string
52
- - name: special_judge_format
53
- dtype: string
54
- - name: uses_kattis
55
- dtype: bool
56
- - name: kattis_problem_id
57
- dtype: string
58
- - name: contest_standings_csv
59
- dtype: string
60
- - name: scoreboard_url
61
- dtype: string
62
- - name: teams_solved
63
- dtype: int64
64
- - name: teams_wrong_answer
65
- dtype: int64
66
- - name: teams_unattempted
67
- dtype: int64
68
- - name: teams_tried
69
- dtype: int64
70
- - name: solve_percentage
71
- dtype: float64
72
- - name: first_solve_time
73
- dtype: int64
74
- - name: average_solve_time
75
- dtype: float64
76
- - name: total_attempts
77
- dtype: int64
78
- - name: average_attempts
79
- dtype: float64
80
- - name: Difficulty_Tertile
81
- dtype: string
82
- splits:
83
- - name: train
84
- num_bytes: 1962094241
85
- num_examples: 83
86
- download_size: 1198195640
87
- dataset_size: 1962094241
88
- configs:
89
- - config_name: default
90
- data_files:
91
- - split: train
92
- path: data/train-*
93
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: mit
3
+ task_categories:
4
+ - text-generation
5
+ - question-answering
6
+ language:
7
+ - en
8
+ tags:
9
+ - competitive-programming
10
+ - algorithms
11
+ - icpc
12
+ - code-generation
13
+ - programming-challenges
14
+ - llm-evaluation
15
+ - benchmark
16
+ size_categories:
17
+ - n<1K
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  ---
19
+
20
+ # Idea First, Code Later: CP Benchmark
21
+
22
+ > Benchmark dataset for the paper: **"Idea First, Code Later: Disentangling Problem Solving from Code Generation in Evaluating LLMs for Competitive Programming"**
23
+
24
+ A curated benchmark of 83 competitive programming problems designed for evaluating LLMs on algorithmic problem-solving separately from code generation.
25
+
26
+ ## Motivation
27
+
28
+ We curate problems from seven contests that are **not hosted on major public CP platforms** (e.g., Codeforces, AtCoder). While some problem statements may be publicly accessible (e.g., contest PDFs or course materials), we expect contamination risk to be lower than for widely scraped judge platforms.
29
+
30
+ The problems come from **regional ICPC contests** and **CS3233** (Competitive Programming course) examinations at the National University of Singapore, spanning **2017–2025**.
31
+
32
+ ## What's Included
33
+
34
+ Each problem package includes:
35
+ - **Original problem statement** in Markdown format
36
+ - **Gold editorial** written by the problem setter or tester (solution analysis)
37
+ - **Full official test suite** (sample + hidden test cases)
38
+
39
+ We rely on complete judge test suites to avoid false positives in evaluation.
40
+
41
+ ## Difficulty Grouping
42
+
43
+ To account for variation in problem difficulty, we group problems using **solve rates** (the proportion of teams that solved the problem) from official scoreboards. Within each contest, problems are ranked by solve rate and partitioned into three **contest-relative tertiles**:
44
+ - **T1** (easiest third)
45
+ - **T2** (middle third)
46
+ - **T3** (hardest third)
47
+
48
+ Pooling across contests yields approximately balanced difficulty groups while preserving each contest's intrinsic difficulty profile.
49
+
50
+ ## Dataset Composition
51
+
52
+ | Contest | Year | Source | #Teams | #Problems |
53
+ |---------|------|--------|--------|-----------|
54
+ | CS3233 Midterm Contest | 2023 | NUS | 25 | 11 |
55
+ | CS3233 Midterm Contest | 2024 | NUS | 15 | 12 |
56
+ | CS3233 Midterm Contest | 2025 | NUS | 16 | 11 |
57
+ | ICPC Asia Pacific Championship | 2024 | GitHub | 65 | 13 |
58
+ | ICPC Asia Jakarta Regional | 2017 | GitHub | 80 | 12 |
59
+ | ICPC Asia Jakarta Regional | 2018 | GitHub | 75 | 12 |
60
+ | ICPC Asia Jakarta Regional | 2019 | GitHub | 80 | 12 |
61
+ | **Total** | -- | -- | -- | **83** |
62
+
63
+ ## Dataset Description
64
+
65
+ This dataset contains competitive programming problems with:
66
+ - **Problem statements** in Markdown format
67
+ - **Test cases** (input/output pairs)
68
+ - **Solution analysis** (where available)
69
+ - **Contest metadata** (difficulty, solve rates, etc.)
70
+
71
+ ## Sources
72
+
73
+ The problems are sourced from:
74
+ - **ICPC Asia Pacific Championship 2024**
75
+ - **ICPC Jakarta Regionals** (2017, 2018, 2019)
76
+ - **CS3233 NUS Midterm Contests** (2023, 2024, 2025)
77
+
78
+ ## Copyright and Permissions
79
+
80
+ The **CS3233 portion** of the dataset consists of course assessment materials from the National University of Singapore. We obtained copyright permission from the course instructor to include and redistribute these materials (problem statements, gold editorials) as part of our dataset release.
81
+
82
+ The CS3233 gold editorials are **private course materials** that were not publicly released prior to this work.
83
+
84
+ ## Dataset Structure
85
+
86
+ Each example contains:
87
+
88
+ ### Identifiers
89
+ | Field | Type | Description |
90
+ |-------|------|-------------|
91
+ | `problem_id` | string | Unique identifier (contest_slug) |
92
+ | `problem_code` | string | Problem letter (A, B, C, ...) |
93
+ | `problem_slug` | string | URL-friendly problem name |
94
+ | `problem_title` | string | Full problem title |
95
+
96
+ ### Contest Information
97
+ | Field | Type | Description |
98
+ |-------|------|-------------|
99
+ | `contest_name` | string | Contest identifier |
100
+ | `contest_full_name` | string | Full contest name |
101
+ | `year` | string | Competition year |
102
+ | `source` | string | Source URL/repository |
103
+ | `total_teams` | int | Total teams in contest |
104
+ | `total_problems` | int | Total problems in contest |
105
+
106
+ ### Problem Details
107
+ | Field | Type | Description |
108
+ |-------|------|-------------|
109
+ | `statement` | string | Problem statement in Markdown |
110
+ | `analysis` | string | Editorial/solution analysis |
111
+ | `time_limit` | string | Time limit for solutions |
112
+ | `memory_limit` | string | Memory limit |
113
+ | `author` | string | Problem author |
114
+ | `analysis_author` | string | Editorial author |
115
+
116
+ ### Test Cases
117
+ | Field | Type | Description |
118
+ |-------|------|-------------|
119
+ | `sample_test_cases_input` | list[string] | Sample inputs (public) |
120
+ | `sample_test_cases_output` | list[string] | Sample outputs (public) |
121
+ | `hidden_test_cases_input` | list[string] | Hidden inputs (judging) |
122
+ | `hidden_test_cases_output` | list[string] | Hidden outputs (judging) |
123
+ | `has_special_judge` | bool | True if problem accepts multiple correct outputs |
124
+ | `special_judge_code` | string | C++ scorer code (testlib) for validating outputs |
125
+ | `special_judge_format` | string | "standard" or "jakarta2017" |
126
+ | `uses_kattis` | bool | True for CS3233 (submit via Kattis) |
127
+ | `kattis_problem_id` | string | Kattis problem ID for submission |
128
+ | `contest_standings_csv` | string | Full contest scoreboard in CSV format |
129
+ | `scoreboard_url` | string | Original URL of the contest scoreboard |
130
+
131
+ #### Special Judge (Scorer)
132
+
133
+ Some problems accept **multiple correct outputs** for a given input (e.g., "output any valid permutation"). These problems have `has_special_judge=True` and include a C++ scorer in `special_judge_code` that validates whether a contestant's output is correct.
134
+
135
+ **standard** format (most contests):
136
+ ```bash
137
+ ./scorer <input_file> <judge_output_file> <contestant_output_file>
138
+ # Prints "AC" or "WA" to stdout
139
+ ```
140
+
141
+ **jakarta2017** format (ICPC Jakarta 2017 only):
142
+ ```bash
143
+ ./scorer <input_file> <unused> <judge_output_file> < contestant_output
144
+ # Reads contestant output from stdin
145
+ # Prints "WA" if wrong, nothing if correct
146
+ ```
147
+
148
+ ### CS3233 Contests (Kattis Submission)
149
+
150
+ For CS3233 problems, hidden test cases are not publicly available (hosted on Kattis). Sample test cases are extracted from problem statements.
151
+
152
+ To submit solutions, set up [Kattis CLI](https://github.com/Kattis/kattis-cli) following the instructions in their repository, then run:
153
+
154
+ ```bash
155
+ kattis <solution_file> -p <problem_id> -f
156
+ ```
157
+
158
+ The `kattis_problem_id` field contains the Kattis problem ID for submission.
159
+
160
+ ## Notes on Empty Fields
161
+
162
+ Some fields may be empty depending on the contest source:
163
+
164
+ | Field | When Empty | Reason |
165
+ |-------|------------|--------|
166
+ | `hidden_test_cases_*` | CS3233 contests | Test cases hosted on Kattis, not public |
167
+ | `author`, `analysis_author` | CS3233 contests | Author info not available |
168
+ | `special_judge_*` | Most problems | Only ~40% of problems need special judges |
169
+ | `kattis_problem_id` | ICPC contests | Only CS3233 uses Kattis |
170
+ | `memory_limit` | Some ICPC contests | Not always specified |
171
+
172
+ ### Contest Statistics
173
+ | Field | Type | Description |
174
+ |-------|------|-------------|
175
+ | `teams_solved` | int | Number of teams that solved |
176
+ | `teams_wrong_answer` | int | Teams with wrong answers |
177
+ | `teams_unattempted` | int | Teams that didn't try |
178
+ | `teams_tried` | int | Teams that attempted |
179
+ | `solve_percentage` | float | % of teams that solved |
180
+ | `first_solve_time` | int | Time to first solve (minutes) |
181
+ | `average_solve_time` | float | Average solve time (minutes) |
182
+ | `total_attempts` | int | Total submission attempts |
183
+ | `average_attempts` | float | Average attempts per team |
184
+ | `Difficulty_Tertile` | int | Difficulty rank in contest |
185
+
186
+ ## Usage
187
+
188
+ ```python
189
+ from datasets import load_dataset
190
+
191
+ dataset = load_dataset("samahadhoud/idea-first-code-later-cp")
192
+
193
+ # Access a problem
194
+ problem = dataset["train"][0]
195
+ print(problem["problem_title"])
196
+ print(problem["statement"])
197
+
198
+ # Get test cases
199
+ for inp, out in zip(problem["sample_test_cases_input"], problem["sample_test_cases_output"]):
200
+ print(f"Sample Input: {inp[:100]}...")
201
+ print(f"Sample Output: {out[:100]}...")
202
+
203
+ # Hidden test cases for evaluation
204
+ print(f"Hidden test cases: {len(problem['hidden_test_cases_input'])}")
205
+ ```
206
+
207
+ ## Test Runner
208
+
209
+ Use the provided test runner to evaluate solutions:
210
+
211
+ ```python
212
+ from hf_test_runner import TestRunner
213
+
214
+ runner = TestRunner()
215
+
216
+ # Run a C++ solution
217
+ results = runner.run_solution(
218
+ problem_id="icpc-jakarta-2017_icpc",
219
+ solution_code="""
220
+ #include <iostream>
221
+ using namespace std;
222
+
223
+ int main() {
224
+ int n;
225
+ cin >> n;
226
+ cout << n * 2 << endl;
227
+ return 0;
228
+ }
229
+ """,
230
+ language="cpp"
231
+ )
232
+
233
+ print(results["status"]) # "PASSED" or error type
234
+ ```
235
+
236
+ The test runner automatically handles:
237
+ - **Sample and hidden test cases**
238
+ - **Special judges** (problems with multiple valid outputs)
239
+ - **Kattis submission** (for CS3233 problems via [kattis-cli](https://github.com/Kattis/kattis-cli))
240
+ - **Memory and time limits**
241
+
242
+ ## Citation
243
+
244
+ Paper: **"Idea First, Code Later: Disentangling Problem Solving from Code Generation in Evaluating LLMs for Competitive Programming"**
245
+
246
+ *Citation details will be added once the paper is published on arXiv.*
247
+
248
+ ## License
249
+
250
+ MIT License