File size: 3,530 Bytes
6fee13c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7cd75d5
 
 
 
 
 
 
 
6fee13c
7cd75d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
---
dataset_info:
  features:
  - name: Source
    dtype: string
  - name: Date
    dtype: int64
  - name: Text
    dtype: string
  - name: Token_count
    dtype: int64
  splits:
  - name: train
    num_bytes: 8122744210
    num_examples: 6366648
  download_size: 3707767805
  dataset_size: 8122744210
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
pretty_name: Project_CodeNet
size_categories:
- 1M<n<10M
task_categories:
- text-generation
language:
- code
license: other
---

# Project_CodeNet

## Overview

This dataset is constructed from the **Project CodeNet** corpus, consisting of competitive programming submissions collected from online judges.

We extract a large-scale code corpus designed for pretraining language models, with a focus on:
- clean executable code
- temporal metadata (submission time)
- minimal preprocessing to preserve the original distribution

---

## Dataset Statistics

- **Total samples:** ~6.37M
- **Total tokens:** ~3.06B
- **Average tokens per sample:** 480.44

### Token Length Distribution
- P50: 162 tokens
- P90: 679 tokens
- P95: 1035 tokens
- P99: 2702 tokens
---

## Construction

### Source
- Project CodeNet https://github.com/IBM/Project_CodeNet

### Filtering Rules

We apply the following steps:

1. **Keep only Accepted submissions**
   - Removes incorrect or incomplete code.

2. **Deduplication at metadata level**
   - For each `(problem_id, user_id, language)`, keep the **last accepted submission**
   - This approximates the user's final solution

3. **No content-based deduplication**
   - Similar solutions across users are preserved
   - Reflects real-world submission distribution

4. **No balancing**
   - Language and temporal distributions are kept as-is

---

## Fields

Each sample contains:

| Field | Description |
|------|------------|
| `Source` | Dataset name (`Project_CodeNet`) |
| `Date` | Submission year |
| `Text` | Source code |
| `Token_count` | Token count computed using `tiktoken` |

---

## Tokenization

- Tokenizer: `tiktoken`
- Encoding: `cl100k_base`

---

## Distribution Characteristics

### Language Distribution
The dataset is highly skewed toward C++:

- C++ dominates (~60%)
- Python is the second largest (~23%)
- Other languages form a long tail

### Temporal Distribution
The dataset is heavily concentrated in recent years:

- Majority of samples from **2019–2020**
- Reflects real submission activity in CodeNet

---

## Important Notes

- This dataset preserves the **original submission distribution** of CodeNet.
- It is **not balanced** across languages or time.
- It is primarily composed of **competitive programming code**, which may differ from production software code.
- Some level of **near-duplicate solutions** exists due to similar problem-solving strategies.

---

## Intended Use

- Pretraining code language models
- Studying temporal evolution of programming patterns
- Benchmarking under real-world distribution settings

---

## Limitations

- Not representative of general software engineering code
- Strong bias toward:
  - competitive programming tasks
  - algorithmic problem solving
- Language and temporal imbalance

---

## License

Please refer to the original **Project CodeNet** dataset for licensing details.

---

## Citation

If you use this dataset, please cite Project CodeNet:

@article{puri2021project,
title={Project CodeNet: A Large-Scale AI for Code Dataset for Learning a Diversity of Coding Tasks},
author={Puri, Ruchir and others},
year={2021}
}