Datasets:
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,48 +1,17 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
task_categories:
|
| 4 |
-
- text-generation
|
| 5 |
language:
|
| 6 |
-
- en
|
| 7 |
tags:
|
| 8 |
-
- assembly
|
| 9 |
-
- c
|
| 10 |
-
- leetcode
|
| 11 |
-
- compiler
|
| 12 |
-
- code
|
| 13 |
size_categories:
|
| 14 |
-
- 10K<n<100K
|
| 15 |
-
dataset_info:
|
| 16 |
-
features:
|
| 17 |
-
- name: id
|
| 18 |
-
dtype: int64
|
| 19 |
-
- name: problem_id
|
| 20 |
-
dtype: int64
|
| 21 |
-
- name: problem_title
|
| 22 |
-
dtype: string
|
| 23 |
-
- name: difficulty
|
| 24 |
-
dtype: string
|
| 25 |
-
- name: c_source
|
| 26 |
-
dtype: string
|
| 27 |
-
- name: architecture
|
| 28 |
-
dtype: string
|
| 29 |
-
- name: optimization
|
| 30 |
-
dtype: string
|
| 31 |
-
- name: compiler
|
| 32 |
-
dtype: string
|
| 33 |
-
- name: assembly
|
| 34 |
-
dtype: string
|
| 35 |
-
splits:
|
| 36 |
-
- name: train
|
| 37 |
-
num_bytes: 93820718
|
| 38 |
-
num_examples: 14112
|
| 39 |
-
download_size: 14016763
|
| 40 |
-
dataset_size: 93820718
|
| 41 |
-
configs:
|
| 42 |
-
- config_name: default
|
| 43 |
-
data_files:
|
| 44 |
-
- split: train
|
| 45 |
-
path: data/train-*
|
| 46 |
---
|
| 47 |
|
| 48 |
# LeetCode Assembly Dataset
|
|
@@ -74,12 +43,6 @@ Each problem has **32 assembly variants** (4 architectures x 2 compilers x 4 opt
|
|
| 74 |
- **The largest output is LFU Cache** (1,121 lines at -O0 on x86-64), a complex doubly-linked list plus hash table implementation.
|
| 75 |
- **The smallest output is Nim Game at -O3** (4 lines on x86-64) -- the entire solution optimizes to a single bitwise AND.
|
| 76 |
|
| 77 |
-
## Use Cases
|
| 78 |
-
|
| 79 |
-
- Training or evaluating models on C-to-assembly translation
|
| 80 |
-
- Studying how optimization levels affect generated code
|
| 81 |
-
- Compiler behavior research
|
| 82 |
-
|
| 83 |
## Schema
|
| 84 |
|
| 85 |
| Column | Type | Description |
|
|
@@ -89,7 +52,6 @@ Each problem has **32 assembly variants** (4 architectures x 2 compilers x 4 opt
|
|
| 89 |
| `problem_title` | string | Problem name (e.g. "Two Sum") |
|
| 90 |
| `difficulty` | string | Easy, Medium, or Hard |
|
| 91 |
| `c_source` | string | Complete C source code |
|
| 92 |
-
| `source_repo` | string | GitHub repo the solution came from |
|
| 93 |
| `architecture` | string | Target ISA: `x86-64`, `aarch64`, `mips64`, `riscv64` |
|
| 94 |
| `optimization` | string | Optimization flag: `-O0`, `-O1`, `-O2`, `-O3` |
|
| 95 |
| `compiler` | string | Compiler version used (e.g. `x86-64 gcc 15.2`, `x86-64 clang 21.1.0`) |
|
|
@@ -122,3 +84,38 @@ C solutions were collected from three open-source GitHub repositories of pure-C
|
|
| 122 |
- [lennylxx/leetcode](https://github.com/lennylxx/leetcode) (159 solutions)
|
| 123 |
|
| 124 |
After deduplication, 441 unique problems remained. Solutions are self-contained C files using only the standard library (no C++ STL), producing clean and readable assembly output.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
task_categories:
|
| 4 |
+
- text-generation
|
| 5 |
language:
|
| 6 |
+
- en
|
| 7 |
tags:
|
| 8 |
+
- assembly
|
| 9 |
+
- c
|
| 10 |
+
- leetcode
|
| 11 |
+
- compiler
|
| 12 |
+
- code
|
| 13 |
size_categories:
|
| 14 |
+
- 10K<n<100K
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
---
|
| 16 |
|
| 17 |
# LeetCode Assembly Dataset
|
|
|
|
| 43 |
- **The largest output is LFU Cache** (1,121 lines at -O0 on x86-64), a complex doubly-linked list plus hash table implementation.
|
| 44 |
- **The smallest output is Nim Game at -O3** (4 lines on x86-64) -- the entire solution optimizes to a single bitwise AND.
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
## Schema
|
| 47 |
|
| 48 |
| Column | Type | Description |
|
|
|
|
| 52 |
| `problem_title` | string | Problem name (e.g. "Two Sum") |
|
| 53 |
| `difficulty` | string | Easy, Medium, or Hard |
|
| 54 |
| `c_source` | string | Complete C source code |
|
|
|
|
| 55 |
| `architecture` | string | Target ISA: `x86-64`, `aarch64`, `mips64`, `riscv64` |
|
| 56 |
| `optimization` | string | Optimization flag: `-O0`, `-O1`, `-O2`, `-O3` |
|
| 57 |
| `compiler` | string | Compiler version used (e.g. `x86-64 gcc 15.2`, `x86-64 clang 21.1.0`) |
|
|
|
|
| 84 |
- [lennylxx/leetcode](https://github.com/lennylxx/leetcode) (159 solutions)
|
| 85 |
|
| 86 |
After deduplication, 441 unique problems remained. Solutions are self-contained C files using only the standard library (no C++ STL), producing clean and readable assembly output.
|
| 87 |
+
|
| 88 |
+
## Compilation Details
|
| 89 |
+
|
| 90 |
+
Assembly was generated using the [Godbolt Compiler Explorer](https://godbolt.org) public API with the following compilers:
|
| 91 |
+
|
| 92 |
+
| Architecture | GCC Compiler ID | Clang Compiler ID | Syntax |
|
| 93 |
+
|-------------|----------------|-------------------|--------|
|
| 94 |
+
| x86-64 | `cg152` (GCC 15.2) | `cclang2110` (Clang 21.1.0) | Intel |
|
| 95 |
+
| AArch64 | `carm64g1520` (GCC 15.2) | `armv8-cclang2110` (Clang 21.1.0) | Native |
|
| 96 |
+
| MIPS64 | `cmips64g1520` (GCC 15.2) | `mips64-cclang2110` (Clang 21.1.0) | Native |
|
| 97 |
+
| RISC-V 64 | `rv64-cgcc1520` (GCC 15.2) | `rv64-cclang2110` (Clang 21.1.0) | Native |
|
| 98 |
+
|
| 99 |
+
Compiler flags: `-std=gnu89 -w -include stdio.h -include stdlib.h -include string.h -include stdbool.h -include limits.h -include math.h -include stdint.h -include ctype.h`
|
| 100 |
+
|
| 101 |
+
Assembly output filters: directives removed, comments removed, labels preserved, symbols demangled.
|
| 102 |
+
|
| 103 |
+
## Potential Use Cases
|
| 104 |
+
|
| 105 |
+
- Training or evaluating models on C-to-assembly translation
|
| 106 |
+
- Studying how optimization levels affect generated code
|
| 107 |
+
- Comparing GCC vs Clang assembly output on identical source code
|
| 108 |
+
- Cross-architecture assembly comparison and analysis
|
| 109 |
+
- Assembly language education and reference
|
| 110 |
+
- Compiler behavior research
|
| 111 |
+
|
| 112 |
+
## Build Pipeline
|
| 113 |
+
|
| 114 |
+
The dataset was built with an automated Python pipeline:
|
| 115 |
+
|
| 116 |
+
1. **Extract**: Clone repos, extract `.c` files, normalize unicode, deduplicate by problem ID
|
| 117 |
+
2. **Metadata**: Enrich with LeetCode problem titles and difficulty from HuggingFace
|
| 118 |
+
3. **Compile**: Send each solution to Godbolt API across all architecture/compiler/optimization combinations (with SQLite checkpointing for resumability)
|
| 119 |
+
4. **Publish**: Build HuggingFace Dataset and push to Hub
|
| 120 |
+
|
| 121 |
+
Source code for the pipeline is available at [github.com/ronantakizawa/leetcodeassembly](https://github.com/ronantakizawa/leetcodeassembly).
|