Upload 8 files
Browse files- README.md +99 -101
- data/dublin_data_test.jsonl +0 -0
- data/dublin_data_train.jsonl +0 -0
- data/dublin_repair_test.jsonl +0 -0
- data/dublin_repair_train.jsonl +0 -0
- data/singapore_data_train.jsonl +0 -0
- data/singapore_repair_train.jsonl +18 -0
- intro_prog.py +133 -0
README.md
CHANGED
@@ -1,103 +1,101 @@
|
|
1 |
---
|
2 |
-
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
---
|
6 |
-
|
7 |
-
# Dataset Card for "intro_prog"
|
8 |
-
|
9 |
-
## Dataset Description
|
10 |
-
|
11 |
-
- **Homepage:**
|
12 |
-
- **Repository:**
|
13 |
-
- **Paper:**
|
14 |
-
- **Leaderboard:**
|
15 |
-
- **Point of Contact:**
|
16 |
-
|
17 |
-
### Dataset Summary
|
18 |
-
|
19 |
-
This dataset card aims to be a base template for new datasets. It has been generated using [this raw template](https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/templates/datasetcard_template.md?plain=1).
|
20 |
-
|
21 |
-
### Supported Tasks and Leaderboards
|
22 |
-
|
23 |
-
[More Information Needed]
|
24 |
-
|
25 |
-
### Languages
|
26 |
-
|
27 |
-
[More Information Needed]
|
28 |
-
|
29 |
-
## Dataset Structure
|
30 |
-
|
31 |
-
### Data Instances
|
32 |
-
|
33 |
-
[More Information Needed]
|
34 |
-
|
35 |
-
### Data Fields
|
36 |
-
|
37 |
-
[More Information Needed]
|
38 |
-
|
39 |
-
### Data Splits
|
40 |
-
|
41 |
-
[More Information Needed]
|
42 |
-
|
43 |
-
## Dataset Creation
|
44 |
-
|
45 |
-
### Curation Rationale
|
46 |
-
|
47 |
-
[More Information Needed]
|
48 |
-
|
49 |
-
### Source Data
|
50 |
-
|
51 |
-
#### Initial Data Collection and Normalization
|
52 |
-
|
53 |
-
[More Information Needed]
|
54 |
-
|
55 |
-
#### Who are the source language producers?
|
56 |
-
|
57 |
-
[More Information Needed]
|
58 |
-
|
59 |
-
### Annotations
|
60 |
-
|
61 |
-
#### Annotation process
|
62 |
-
|
63 |
-
[More Information Needed]
|
64 |
-
|
65 |
-
#### Who are the annotators?
|
66 |
-
|
67 |
-
[More Information Needed]
|
68 |
-
|
69 |
-
### Personal and Sensitive Information
|
70 |
-
|
71 |
-
[More Information Needed]
|
72 |
-
|
73 |
-
## Considerations for Using the Data
|
74 |
-
|
75 |
-
### Social Impact of Dataset
|
76 |
-
|
77 |
-
[More Information Needed]
|
78 |
-
|
79 |
-
### Discussion of Biases
|
80 |
-
|
81 |
-
[More Information Needed]
|
82 |
-
|
83 |
-
### Other Known Limitations
|
84 |
-
|
85 |
-
[More Information Needed]
|
86 |
-
|
87 |
-
## Additional Information
|
88 |
-
|
89 |
-
### Dataset Curators
|
90 |
-
|
91 |
-
[More Information Needed]
|
92 |
-
|
93 |
-
### Licensing Information
|
94 |
-
|
95 |
-
[More Information Needed]
|
96 |
-
|
97 |
-
### Citation Information
|
98 |
-
|
99 |
-
[More Information Needed]
|
100 |
-
|
101 |
-
### Contributions
|
102 |
-
|
103 |
-
[More Information Needed]
|
|
|
1 |
---
|
2 |
+
dataset_info:
|
3 |
+
- config_name: dublin_data
|
4 |
+
features:
|
5 |
+
- name: submission_id
|
6 |
+
dtype: int32
|
7 |
+
- name: func_code
|
8 |
+
dtype: string
|
9 |
+
- name: assignment_id
|
10 |
+
dtype: string
|
11 |
+
- name: func_name
|
12 |
+
dtype: string
|
13 |
+
- name: description
|
14 |
+
dtype: string
|
15 |
+
- name: test
|
16 |
+
dtype: string
|
17 |
+
- name: user
|
18 |
+
dtype: string
|
19 |
+
- name: academic_year
|
20 |
+
dtype: int32
|
21 |
+
splits:
|
22 |
+
- name: train
|
23 |
+
num_bytes: 3659009
|
24 |
+
num_examples: 6117
|
25 |
+
- name: test
|
26 |
+
num_bytes: 6442216
|
27 |
+
num_examples: 9885
|
28 |
+
download_size: 12774289
|
29 |
+
dataset_size: 10101225
|
30 |
+
- config_name: singapore_data
|
31 |
+
features:
|
32 |
+
- name: submission_id
|
33 |
+
dtype: int32
|
34 |
+
- name: func_code
|
35 |
+
dtype: string
|
36 |
+
- name: assignment_id
|
37 |
+
dtype: string
|
38 |
+
- name: func_name
|
39 |
+
dtype: string
|
40 |
+
- name: description
|
41 |
+
dtype: string
|
42 |
+
- name: test
|
43 |
+
dtype: string
|
44 |
+
splits:
|
45 |
+
- name: train
|
46 |
+
num_bytes: 5098378
|
47 |
+
num_examples: 4394
|
48 |
+
download_size: 5705043
|
49 |
+
dataset_size: 5098378
|
50 |
+
- config_name: dublin_repair
|
51 |
+
features:
|
52 |
+
- name: submission_id
|
53 |
+
dtype: int32
|
54 |
+
- name: func_code
|
55 |
+
dtype: string
|
56 |
+
- name: assignment_id
|
57 |
+
dtype: string
|
58 |
+
- name: func_name
|
59 |
+
dtype: string
|
60 |
+
- name: description
|
61 |
+
dtype: string
|
62 |
+
- name: test
|
63 |
+
dtype: string
|
64 |
+
- name: annotation
|
65 |
+
dtype: string
|
66 |
+
- name: user
|
67 |
+
dtype: string
|
68 |
+
- name: academic_year
|
69 |
+
dtype: int32
|
70 |
+
splits:
|
71 |
+
- name: train
|
72 |
+
num_bytes: 234628
|
73 |
+
num_examples: 307
|
74 |
+
- name: test
|
75 |
+
num_bytes: 1479344
|
76 |
+
num_examples: 1698
|
77 |
+
download_size: 2137031
|
78 |
+
dataset_size: 1713972
|
79 |
+
- config_name: singapore_repair
|
80 |
+
features:
|
81 |
+
- name: submission_id
|
82 |
+
dtype: int32
|
83 |
+
- name: func_code
|
84 |
+
dtype: string
|
85 |
+
- name: assignment_id
|
86 |
+
dtype: string
|
87 |
+
- name: func_name
|
88 |
+
dtype: string
|
89 |
+
- name: description
|
90 |
+
dtype: string
|
91 |
+
- name: test
|
92 |
+
dtype: string
|
93 |
+
- name: annotation
|
94 |
+
dtype: string
|
95 |
+
splits:
|
96 |
+
- name: train
|
97 |
+
num_bytes: 18979
|
98 |
+
num_examples: 18
|
99 |
+
download_size: 21737
|
100 |
+
dataset_size: 18979
|
101 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data/dublin_data_test.jsonl
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/dublin_data_train.jsonl
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/dublin_repair_test.jsonl
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/dublin_repair_train.jsonl
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/singapore_data_train.jsonl
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/singapore_repair_train.jsonl
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{"submission_id":4270,"assignment_id":5,"func_code":"def top_k(lst, k):\n result = []\n while k >= 0:\n big = max(lst)\n result.append(big)\n lst.remove(big)\n k -= 1\n return result\n","func_name":"top_k","test":"import heapq\nassert top_k([9, 9, 4, 9, 7, 9, 3, 1, 6], 5)==[9, 9, 9, 9, 7] and top_k([9, 8, 4, 5, 7, 2, 3, 1, 6], 5)==[9, 8, 7, 6, 5] and top_k([4, 5, 2, 3, 1, 6], 6)==[6, 5, 4, 3, 2, 1] and top_k([4, 5, 2, 3, 1, 6], 3)==[6, 5, 4] and top_k([4, 5, 2, 3, 1, 6], 0)==[]","description":"Task: Top-K\n\n\nWrite a function top_k that accepts a list of integers as the input and returns the greatest\nk number of values as a list, with its elements sorted in descending order. You may use\nany sorting algorithm you wish, but you are not allowed to use sort and sorted.","annotation":"def top_k(lst, k):\n result = []\n while k > 0:\n big = max(lst)\n result.append(big)\n lst.remove(big)\n k -= 1\n return result\n","comments":"# KC# wrong operand \/ wrong number of iterations"}
|
2 |
+
{"submission_id":4271,"assignment_id":5,"func_code":"def top_k(lst, k):\n lst_res = lst\n sort = []\n while lst_res:\n largest = lst_res[0]\n for elements in lst_res:\n if element > largest:\n largest = element\n lst_res.remove(largest)\n sort.append(largest)\n return sort[:k]\n","func_name":"top_k","test":"import heapq\nassert top_k([9, 9, 4, 9, 7, 9, 3, 1, 6], 5)==[9, 9, 9, 9, 7] and top_k([9, 8, 4, 5, 7, 2, 3, 1, 6], 5)==[9, 8, 7, 6, 5] and top_k([4, 5, 2, 3, 1, 6], 6)==[6, 5, 4, 3, 2, 1] and top_k([4, 5, 2, 3, 1, 6], 3)==[6, 5, 4] and top_k([4, 5, 2, 3, 1, 6], 0)==[]","description":"Task: Top-K\n\n\nWrite a function top_k that accepts a list of integers as the input and returns the greatest\nk number of values as a list, with its elements sorted in descending order. You may use\nany sorting algorithm you wish, but you are not allowed to use sort and sorted.","annotation":"def top_k(lst, k):\n lst_res = lst\n sort = []\n while lst_res:\n largest = lst_res[0]\n for element in lst_res:\n if element > largest:\n largest = element\n lst_res.remove(largest)\n sort.append(largest)\n return sort[:k]\n","comments":"# typo"}
|
3 |
+
{"submission_id":4272,"assignment_id":5,"func_code":"def top_k(lst, k):\n tmp = []\n while len(lst) > 0:\n tmp.append(max(lst))\n lst.remove(max(lst))\n return tmp[:5]\n","func_name":"top_k","test":"import heapq\nassert top_k([9, 9, 4, 9, 7, 9, 3, 1, 6], 5)==[9, 9, 9, 9, 7] and top_k([9, 8, 4, 5, 7, 2, 3, 1, 6], 5)==[9, 8, 7, 6, 5] and top_k([4, 5, 2, 3, 1, 6], 6)==[6, 5, 4, 3, 2, 1] and top_k([4, 5, 2, 3, 1, 6], 3)==[6, 5, 4] and top_k([4, 5, 2, 3, 1, 6], 0)==[]","description":"Task: Top-K\n\n\nWrite a function top_k that accepts a list of integers as the input and returns the greatest\nk number of values as a list, with its elements sorted in descending order. You may use\nany sorting algorithm you wish, but you are not allowed to use sort and sorted.","annotation":"def top_k(lst, k):\n tmp = []\n while len(lst) > 0:\n tmp.append(max(lst))\n lst.remove(max(lst))\n return tmp[:k]\n","comments":"# typo"}
|
4 |
+
{"submission_id":4273,"assignment_id":5,"func_code":"def top_k(lst, k):\n sort = []\n while lst: \n biggest = lst[0]\n for element in lst:\n if ele > biggest:\n biggest = ele\n \n lst.remove(element)\n sort.append(element)\n if len(sort)==k:\n break\n return sort\n","func_name":"top_k","test":"import heapq\nassert top_k([9, 9, 4, 9, 7, 9, 3, 1, 6], 5)==[9, 9, 9, 9, 7] and top_k([9, 8, 4, 5, 7, 2, 3, 1, 6], 5)==[9, 8, 7, 6, 5] and top_k([4, 5, 2, 3, 1, 6], 6)==[6, 5, 4, 3, 2, 1] and top_k([4, 5, 2, 3, 1, 6], 3)==[6, 5, 4] and top_k([4, 5, 2, 3, 1, 6], 0)==[]","description":"Task: Top-K\n\n\nWrite a function top_k that accepts a list of integers as the input and returns the greatest\nk number of values as a list, with its elements sorted in descending order. You may use\nany sorting algorithm you wish, but you are not allowed to use sort and sorted.","annotation":"def top_k(lst, k):\n sort = []\n while lst and k:\n biggest = lst[0]\n for element in lst:\n if element > biggest:\n biggest = element\n lst.remove(biggest)\n sort.append(biggest)\n if len(sort) == k:\n break\n return sort\n","comments":"# wrong variable usage# missing input case"}
|
5 |
+
{"submission_id":4274,"assignment_id":5,"func_code":"def top_k(lst, k):\n sort = []\n while lst: \n biggest = lst[0]\n for element in lst:\n if element > biggest:\n biggest = element\n \n lst.remove(element)\n sort.append(element)\n if len(sort)==k:\n break\n return sort\n","func_name":"top_k","test":"import heapq\nassert top_k([9, 9, 4, 9, 7, 9, 3, 1, 6], 5)==[9, 9, 9, 9, 7] and top_k([9, 8, 4, 5, 7, 2, 3, 1, 6], 5)==[9, 8, 7, 6, 5] and top_k([4, 5, 2, 3, 1, 6], 6)==[6, 5, 4, 3, 2, 1] and top_k([4, 5, 2, 3, 1, 6], 3)==[6, 5, 4] and top_k([4, 5, 2, 3, 1, 6], 0)==[]","description":"Task: Top-K\n\n\nWrite a function top_k that accepts a list of integers as the input and returns the greatest\nk number of values as a list, with its elements sorted in descending order. You may use\nany sorting algorithm you wish, but you are not allowed to use sort and sorted.","annotation":"def top_k(lst, k):\n sort = []\n while lst and k:\n biggest = lst[0]\n for element in lst:\n if element > biggest:\n biggest = element\n lst.remove(biggest)\n sort.append(biggest)\n if len(sort) == k:\n break\n return sort\n","comments":"# wrong variable usage# missing input case"}
|
6 |
+
{"submission_id":4275,"assignment_id":5,"func_code":"def top_k(lst, k):\n sort = []\n while lst: \n biggest = lst[0]\n for element in lst:\n if element > biggest:\n biggest = element\n \n lst.remove(biggest)\n sort.append(biggest)\n if len(sort)==k:\n break\n return sort\n","func_name":"top_k","test":"import heapq\nassert top_k([9, 9, 4, 9, 7, 9, 3, 1, 6], 5)==[9, 9, 9, 9, 7] and top_k([9, 8, 4, 5, 7, 2, 3, 1, 6], 5)==[9, 8, 7, 6, 5] and top_k([4, 5, 2, 3, 1, 6], 6)==[6, 5, 4, 3, 2, 1] and top_k([4, 5, 2, 3, 1, 6], 3)==[6, 5, 4] and top_k([4, 5, 2, 3, 1, 6], 0)==[]","description":"Task: Top-K\n\n\nWrite a function top_k that accepts a list of integers as the input and returns the greatest\nk number of values as a list, with its elements sorted in descending order. You may use\nany sorting algorithm you wish, but you are not allowed to use sort and sorted.","annotation":"def top_k(lst, k):\n sort = []\n while lst and k:\n biggest = lst[0]\n for element in lst:\n if element > biggest:\n biggest = element\n lst.remove(biggest)\n sort.append(biggest)\n if len(sort) == k:\n break\n return sort\n","comments":""}
|
7 |
+
{"submission_id":4276,"assignment_id":5,"func_code":"def top_k(lst, k):\n lst1 = []\n for i in lst:\n if i >= k:\n lst1.append(i) \n sort = []\n while lst1: \n biggest = lst[0]\n for element in lst1:\n if element > biggest:\n biggest = element\n lst1.remove(biggest)\n sort.append(biggest)\n return sort\n","func_name":"top_k","test":"import heapq\nassert top_k([9, 9, 4, 9, 7, 9, 3, 1, 6], 5)==[9, 9, 9, 9, 7] and top_k([9, 8, 4, 5, 7, 2, 3, 1, 6], 5)==[9, 8, 7, 6, 5] and top_k([4, 5, 2, 3, 1, 6], 6)==[6, 5, 4, 3, 2, 1] and top_k([4, 5, 2, 3, 1, 6], 3)==[6, 5, 4] and top_k([4, 5, 2, 3, 1, 6], 0)==[]","description":"Task: Top-K\n\n\nWrite a function top_k that accepts a list of integers as the input and returns the greatest\nk number of values as a list, with its elements sorted in descending order. You may use\nany sorting algorithm you wish, but you are not allowed to use sort and sorted.","annotation":"def top_k(lst, k):\n sort = []\n while lst and k > 0:\n biggest = lst[0]\n for element in lst:\n if element > biggest:\n biggest = element\n lst.remove(biggest)\n sort.append(biggest)\n k -= 1\n return sort\n","comments":"# wrong-strategy# missing input case handling"}
|
8 |
+
{"submission_id":4277,"assignment_id":5,"func_code":"def top_k(lst, k):\n sort = []\n while lst: \n biggest = lst[0]\n for element in lst:\n if element > biggest:\n biggest = element\n lst.remove(biggest)\n sort.append(biggest)\n return sort[:k+1]\n","func_name":"top_k","test":"import heapq\nassert top_k([9, 9, 4, 9, 7, 9, 3, 1, 6], 5)==[9, 9, 9, 9, 7] and top_k([9, 8, 4, 5, 7, 2, 3, 1, 6], 5)==[9, 8, 7, 6, 5] and top_k([4, 5, 2, 3, 1, 6], 6)==[6, 5, 4, 3, 2, 1] and top_k([4, 5, 2, 3, 1, 6], 3)==[6, 5, 4] and top_k([4, 5, 2, 3, 1, 6], 0)==[]","description":"Task: Top-K\n\n\nWrite a function top_k that accepts a list of integers as the input and returns the greatest\nk number of values as a list, with its elements sorted in descending order. You may use\nany sorting algorithm you wish, but you are not allowed to use sort and sorted.","annotation":"def top_k(lst, k):\n sort = []\n while lst:\n biggest = lst[0]\n for element in lst:\n if element > biggest:\n biggest = element\n lst.remove(biggest)\n sort.append(biggest)\n return sort[:k]\n","comments":""}
|
9 |
+
{"submission_id":4278,"assignment_id":5,"func_code":"def top_k(lst, k):\n n = len(lst) - k\n counter = 0\n while counter < k:\n lst.remove(min(lst))\n counter = counter + 1\n sort_list = []\n while lst != []:\n sort_lst.append(max(lst))\n lst.remove(max(lst))\n return sort_list\n \n","func_name":"top_k","test":"import heapq\nassert top_k([9, 9, 4, 9, 7, 9, 3, 1, 6], 5)==[9, 9, 9, 9, 7] and top_k([9, 8, 4, 5, 7, 2, 3, 1, 6], 5)==[9, 8, 7, 6, 5] and top_k([4, 5, 2, 3, 1, 6], 6)==[6, 5, 4, 3, 2, 1] and top_k([4, 5, 2, 3, 1, 6], 3)==[6, 5, 4] and top_k([4, 5, 2, 3, 1, 6], 0)==[]","description":"Task: Top-K\n\n\nWrite a function top_k that accepts a list of integers as the input and returns the greatest\nk number of values as a list, with its elements sorted in descending order. You may use\nany sorting algorithm you wish, but you are not allowed to use sort and sorted.","annotation":"def top_k(lst, k):\n n = len(lst) - k\n counter = 0\n while counter < n:\n lst.remove(min(lst))\n counter = counter + 1\n sort_list = []\n while lst != []:\n sort_list.append(max(lst))\n lst.remove(max(lst))\n return sort_list\n","comments":"# wrong variable usage"}
|
10 |
+
{"submission_id":4279,"assignment_id":5,"func_code":"def top_k(lst, k):\n n = len(lst) - k\n counter = 0\n while counter < k:\n lst.remove(min(lst))\n counter = counter + 1\n sort_list = []\n while lst != []:\n sort_list.append(max(lst))\n lst.remove(max(lst))\n return sort_list\n \n","func_name":"top_k","test":"import heapq\nassert top_k([9, 9, 4, 9, 7, 9, 3, 1, 6], 5)==[9, 9, 9, 9, 7] and top_k([9, 8, 4, 5, 7, 2, 3, 1, 6], 5)==[9, 8, 7, 6, 5] and top_k([4, 5, 2, 3, 1, 6], 6)==[6, 5, 4, 3, 2, 1] and top_k([4, 5, 2, 3, 1, 6], 3)==[6, 5, 4] and top_k([4, 5, 2, 3, 1, 6], 0)==[]","description":"Task: Top-K\n\n\nWrite a function top_k that accepts a list of integers as the input and returns the greatest\nk number of values as a list, with its elements sorted in descending order. You may use\nany sorting algorithm you wish, but you are not allowed to use sort and sorted.","annotation":"def top_k(lst, k):\n n = len(lst) - k\n counter = 0\n while counter < n:\n lst.remove(min(lst))\n counter = counter + 1\n sort_list = []\n while lst != []:\n sort_list.append(max(lst))\n lst.remove(max(lst))\n return sort_list\n","comments":"# wrong variable usage"}
|
11 |
+
{"submission_id":4287,"assignment_id":5,"func_code":"def top_k(lst, k):\n # Fill in your code here\n sort = []\n while lst: # a is not []\n largest = lst[0]\n for element in lst:\n if element > largest:\n largest = element\n lst.remove(largest)\n sort.append(largest)\n return sort[:k+1]\n","func_name":"top_k","test":"import heapq\nassert top_k([9, 9, 4, 9, 7, 9, 3, 1, 6], 5)==[9, 9, 9, 9, 7] and top_k([9, 8, 4, 5, 7, 2, 3, 1, 6], 5)==[9, 8, 7, 6, 5] and top_k([4, 5, 2, 3, 1, 6], 6)==[6, 5, 4, 3, 2, 1] and top_k([4, 5, 2, 3, 1, 6], 3)==[6, 5, 4] and top_k([4, 5, 2, 3, 1, 6], 0)==[]","description":"Task: Top-K\n\n\nWrite a function top_k that accepts a list of integers as the input and returns the greatest\nk number of values as a list, with its elements sorted in descending order. You may use\nany sorting algorithm you wish, but you are not allowed to use sort and sorted.","annotation":"def top_k(lst, k):\n sort = []\n while lst:\n biggest = lst[0]\n for element in lst:\n if element > biggest:\n biggest = element\n lst.remove(biggest)\n sort.append(biggest)\n return sort[:k]\n","comments":""}
|
12 |
+
{"submission_id":4281,"assignment_id":5,"func_code":"def top_k(lst, k):\n \n if lst == []:\n return lst\n \n lower = []\n higher = []\n plist = []\n \n pivot = lst[0]\n for e in lst:\n if e < pivot:\n lower.append(e)\n if x == pivot:\n plist.append(e)\n if x > pivot:\n higher.append(e)\n sort_list = lower + plist + higher\n \n return sort_list[:k]\n","func_name":"top_k","test":"import heapq\nassert top_k([9, 9, 4, 9, 7, 9, 3, 1, 6], 5)==[9, 9, 9, 9, 7] and top_k([9, 8, 4, 5, 7, 2, 3, 1, 6], 5)==[9, 8, 7, 6, 5] and top_k([4, 5, 2, 3, 1, 6], 6)==[6, 5, 4, 3, 2, 1] and top_k([4, 5, 2, 3, 1, 6], 3)==[6, 5, 4] and top_k([4, 5, 2, 3, 1, 6], 0)==[]","description":"Task: Top-K\n\n\nWrite a function top_k that accepts a list of integers as the input and returns the greatest\nk number of values as a list, with its elements sorted in descending order. You may use\nany sorting algorithm you wish, but you are not allowed to use sort and sorted.","annotation":"","comments":"# KC# complex strategy# partial solution"}
|
13 |
+
{"submission_id":4282,"assignment_id":5,"func_code":"def top_k(lst, k):\n \n if lst == []:\n return lst\n \n lower = []\n higher = []\n plist = []\n \n pivot = lst[0]\n for e in lst:\n if e < pivot:\n lower.append(e)\n if x == pivot:\n plist.append(e)\n if x > pivot:\n higher.append(e)\n sort_list = higher + plist + lower\n \n return sort_list[:k]\n","func_name":"top_k","test":"import heapq\nassert top_k([9, 9, 4, 9, 7, 9, 3, 1, 6], 5)==[9, 9, 9, 9, 7] and top_k([9, 8, 4, 5, 7, 2, 3, 1, 6], 5)==[9, 8, 7, 6, 5] and top_k([4, 5, 2, 3, 1, 6], 6)==[6, 5, 4, 3, 2, 1] and top_k([4, 5, 2, 3, 1, 6], 3)==[6, 5, 4] and top_k([4, 5, 2, 3, 1, 6], 0)==[]","description":"Task: Top-K\n\n\nWrite a function top_k that accepts a list of integers as the input and returns the greatest\nk number of values as a list, with its elements sorted in descending order. You may use\nany sorting algorithm you wish, but you are not allowed to use sort and sorted.","annotation":"","comments":"# KC# complex strategy# partial solution"}
|
14 |
+
{"submission_id":4283,"assignment_id":5,"func_code":"def top_k(lst, k):\n \n if lst == []:\n return lst\n \n lower = []\n higher = []\n plist = []\n \n pivot = lst[0]\n for e in lst:\n if e < pivot:\n lower.append(e)\n if e == pivot:\n plist.append(e)\n if e > pivot:\n higher.append(e)\n sort_list = higher + plist + lower\n \n return sort_list[:k]\n","func_name":"top_k","test":"import heapq\nassert top_k([9, 9, 4, 9, 7, 9, 3, 1, 6], 5)==[9, 9, 9, 9, 7] and top_k([9, 8, 4, 5, 7, 2, 3, 1, 6], 5)==[9, 8, 7, 6, 5] and top_k([4, 5, 2, 3, 1, 6], 6)==[6, 5, 4, 3, 2, 1] and top_k([4, 5, 2, 3, 1, 6], 3)==[6, 5, 4] and top_k([4, 5, 2, 3, 1, 6], 0)==[]","description":"Task: Top-K\n\n\nWrite a function top_k that accepts a list of integers as the input and returns the greatest\nk number of values as a list, with its elements sorted in descending order. You may use\nany sorting algorithm you wish, but you are not allowed to use sort and sorted.","annotation":"","comments":"# KC# complex strategy# partial solution"}
|
15 |
+
{"submission_id":4284,"assignment_id":5,"func_code":"def top_k(lst, k):\n \n if lst == []:\n return lst\n \n lower = []\n higher = []\n plist = []\n \n pivot = lst[0]\n for e in lst:\n if e < pivot:\n lower.append(e)\n if e == pivot:\n plist.append(e)\n if e > pivot:\n higher.append(e)\n sort_list = lower + plist + higher\n sort_list = sort_list[::-1]\n \n return sort_list[:k]\n","func_name":"top_k","test":"import heapq\nassert top_k([9, 9, 4, 9, 7, 9, 3, 1, 6], 5)==[9, 9, 9, 9, 7] and top_k([9, 8, 4, 5, 7, 2, 3, 1, 6], 5)==[9, 8, 7, 6, 5] and top_k([4, 5, 2, 3, 1, 6], 6)==[6, 5, 4, 3, 2, 1] and top_k([4, 5, 2, 3, 1, 6], 3)==[6, 5, 4] and top_k([4, 5, 2, 3, 1, 6], 0)==[]","description":"Task: Top-K\n\n\nWrite a function top_k that accepts a list of integers as the input and returns the greatest\nk number of values as a list, with its elements sorted in descending order. You may use\nany sorting algorithm you wish, but you are not allowed to use sort and sorted.","annotation":"","comments":"# KC# complex strategy# partial solution"}
|
16 |
+
{"submission_id":4285,"assignment_id":5,"func_code":"def top_k(lst, k):\n \n if lst == []:\n return lst\n \n lower = []\n higher = []\n plist = []\n \n pivot = lst[0]\n for e in lst:\n if e < pivot:\n lower.append(e)\n if e == pivot:\n plist.append(e)\n if e > pivot:\n higher.append(e)\n sort_list = lower + plist + higher\n sort_list = sort_list[::-1]\n \n if k == len(lst):\n return sort_list[:k-1]\n elif k > len(lst):\n return sort_list\n else:\n return sort_list[:k]\n","func_name":"top_k","test":"import heapq\nassert top_k([9, 9, 4, 9, 7, 9, 3, 1, 6], 5)==[9, 9, 9, 9, 7] and top_k([9, 8, 4, 5, 7, 2, 3, 1, 6], 5)==[9, 8, 7, 6, 5] and top_k([4, 5, 2, 3, 1, 6], 6)==[6, 5, 4, 3, 2, 1] and top_k([4, 5, 2, 3, 1, 6], 3)==[6, 5, 4] and top_k([4, 5, 2, 3, 1, 6], 0)==[]","description":"Task: Top-K\n\n\nWrite a function top_k that accepts a list of integers as the input and returns the greatest\nk number of values as a list, with its elements sorted in descending order. You may use\nany sorting algorithm you wish, but you are not allowed to use sort and sorted.","annotation":"","comments":"# KC# complex strategy# partial solution"}
|
17 |
+
{"submission_id":4286,"assignment_id":5,"func_code":"def top_k(lst, k):\n result = []\n while lst:\n biggest = lst[0]\n for number in lst:\n if number > biggest:\n biggest = number\n lst.remove(biggest)\n result.append(oldest)\n return result[:k]\n","func_name":"top_k","test":"import heapq\nassert top_k([9, 9, 4, 9, 7, 9, 3, 1, 6], 5)==[9, 9, 9, 9, 7] and top_k([9, 8, 4, 5, 7, 2, 3, 1, 6], 5)==[9, 8, 7, 6, 5] and top_k([4, 5, 2, 3, 1, 6], 6)==[6, 5, 4, 3, 2, 1] and top_k([4, 5, 2, 3, 1, 6], 3)==[6, 5, 4] and top_k([4, 5, 2, 3, 1, 6], 0)==[]","description":"Task: Top-K\n\n\nWrite a function top_k that accepts a list of integers as the input and returns the greatest\nk number of values as a list, with its elements sorted in descending order. You may use\nany sorting algorithm you wish, but you are not allowed to use sort and sorted.","annotation":"def top_k(lst, k):\n result = []\n while lst:\n biggest = lst[0]\n for number in lst:\n if number > biggest:\n biggest = number\n lst.remove(biggest)\n result.append(biggest)\n return result[:k]\n","comments":"# wrong variable usage"}
|
18 |
+
{"submission_id":4291,"assignment_id":5,"func_code":"def top_k(lst, k):\n rs=[]\n for qwerty in range(0,k):\n biggest=lst[0]\n for k in lst:\n if biggest<k:\n biggest=k\n rs.append[biggest]\n lst.remove[biggest]\n return r\n \n","func_name":"top_k","test":"import heapq\nassert top_k([9, 9, 4, 9, 7, 9, 3, 1, 6], 5)==[9, 9, 9, 9, 7] and top_k([9, 8, 4, 5, 7, 2, 3, 1, 6], 5)==[9, 8, 7, 6, 5] and top_k([4, 5, 2, 3, 1, 6], 6)==[6, 5, 4, 3, 2, 1] and top_k([4, 5, 2, 3, 1, 6], 3)==[6, 5, 4] and top_k([4, 5, 2, 3, 1, 6], 0)==[]","description":"Task: Top-K\n\n\nWrite a function top_k that accepts a list of integers as the input and returns the greatest\nk number of values as a list, with its elements sorted in descending order. You may use\nany sorting algorithm you wish, but you are not allowed to use sort and sorted.","annotation":"def top_k(lst, k):\n rs = []\n for qwerty in range(0, k):\n biggest = lst[0]\n for k in lst:\n if biggest < k:\n biggest = k\n rs.append(biggest)\n lst.remove(biggest)\n return rs\n","comments":"# KC # wrong variable usage"}
|
intro_prog.py
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2023 Charles Koutcheme
|
3 |
+
#
|
4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
+
# you may not use this file except in compliance with the License.
|
6 |
+
# You may obtain a copy of the License at
|
7 |
+
#
|
8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
#
|
10 |
+
# Unless required by applicable law or agreed to in writing, software
|
11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
+
# See the License for the specific language governing permissions and
|
14 |
+
# limitations under the License.
|
15 |
+
|
16 |
+
|
17 |
+
import json
|
18 |
+
import datasets
|
19 |
+
from itertools import product
|
20 |
+
|
21 |
+
|
22 |
+
_DESCRIPTION = """
|
23 |
+
Intro Programming. A dataset of open student submissions to programming assignments.
|
24 |
+
|
25 |
+
"""
|
26 |
+
|
27 |
+
_DUBLIN_URLS = {
|
28 |
+
"data": {
|
29 |
+
"train": f"./data/dublin_data_train.jsonl",
|
30 |
+
"test": f"./data/dublin_data_test.jsonl",
|
31 |
+
},
|
32 |
+
"repair": {
|
33 |
+
"train": f"./data/dublin_repair_train.jsonl",
|
34 |
+
"test": f"./data/dublin_repair_test.jsonl",
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
_SINGAPORE_URLS = {
|
39 |
+
"data": {
|
40 |
+
"train": f"./data/singapore_data_train.jsonl",
|
41 |
+
},
|
42 |
+
"repair": {
|
43 |
+
"train": f"./data/singapore_repair_train.jsonl",
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
_URLS = {
|
48 |
+
"dublin": _DUBLIN_URLS,
|
49 |
+
"singapore": _SINGAPORE_URLS
|
50 |
+
}
|
51 |
+
|
52 |
+
class IntroProgConfig(datasets.BuilderConfig):
|
53 |
+
""" BuilderConfig for StaQC."""
|
54 |
+
|
55 |
+
def __init__(self, **kwargs):
|
56 |
+
"""BuilderConfig for StaQC.
|
57 |
+
Args:
|
58 |
+
**kwargs: keyword arguments forwarded to super.
|
59 |
+
|
60 |
+
"""
|
61 |
+
super(IntroProgConfig, self).__init__(**kwargs)
|
62 |
+
|
63 |
+
|
64 |
+
class IntroProg(datasets.GeneratorBasedBuilder):
|
65 |
+
|
66 |
+
VERSION = datasets.Version("1.0.0")
|
67 |
+
|
68 |
+
# splits "data", "repair", "bugs"
|
69 |
+
# also add here the "metadata" split which will also contain the full metadata
|
70 |
+
tasks = [("data", "Submissions to the programming assignments."),
|
71 |
+
("repair", "Buggy programs and ground truth repair(s)."),]
|
72 |
+
# ("bug", "Buggy programs and bug categories.")]
|
73 |
+
|
74 |
+
sources = ["dublin", "singapore"]
|
75 |
+
|
76 |
+
BUILDER_CONFIGS = []
|
77 |
+
for (task, description), source in product(tasks, sources):
|
78 |
+
BUILDER_CONFIGS.append(
|
79 |
+
IntroProgConfig(
|
80 |
+
name=f"{source}_{task}",
|
81 |
+
description=description,
|
82 |
+
version=VERSION,
|
83 |
+
)
|
84 |
+
)
|
85 |
+
|
86 |
+
|
87 |
+
def _info(self):
|
88 |
+
|
89 |
+
features = datasets.Features({
|
90 |
+
"submission_id": datasets.Value("int32"),
|
91 |
+
"func_code": datasets.Value("string"),
|
92 |
+
|
93 |
+
# assignment information
|
94 |
+
"assignment_id": datasets.Value("string"),
|
95 |
+
"func_name": datasets.Value("string"),
|
96 |
+
"description": datasets.Value(dtype='string'),
|
97 |
+
"test": datasets.Value(dtype='string'),
|
98 |
+
})
|
99 |
+
|
100 |
+
if self.config.name.split("_")[1] == "repair":
|
101 |
+
features["annotation"] = datasets.Value("string")
|
102 |
+
if self.config.name.split("_")[1] == "bug":
|
103 |
+
features["comments"] = datasets.Value("string")
|
104 |
+
|
105 |
+
if self.config.name.split("_")[0] == "dublin":
|
106 |
+
features["user"] = datasets.Value("string")
|
107 |
+
features["academic_year"] = datasets.Value('int32')
|
108 |
+
|
109 |
+
return datasets.DatasetInfo(
|
110 |
+
description=_DESCRIPTION,
|
111 |
+
features=features,
|
112 |
+
supervised_keys=None,
|
113 |
+
)
|
114 |
+
|
115 |
+
|
116 |
+
def _split_generators(self, dl_manager: datasets.DownloadManager):
|
117 |
+
source, task = self.config.name.split("_")
|
118 |
+
urls = _URLS[source][task]
|
119 |
+
downloaded_files = dl_manager.download_and_extract(urls)
|
120 |
+
|
121 |
+
splits = []
|
122 |
+
for name, files in downloaded_files.items():
|
123 |
+
splits.append(datasets.SplitGenerator(name=name, gen_kwargs={"filepath": files}))
|
124 |
+
|
125 |
+
return splits
|
126 |
+
|
127 |
+
def _generate_examples(self, filepath):
|
128 |
+
with open(filepath, "r") as f:
|
129 |
+
lines = f.read().splitlines()
|
130 |
+
for key, line in enumerate(lines):
|
131 |
+
d = json.loads(line)
|
132 |
+
d = {k:v for k, v in d.items() if k in self.info.features}
|
133 |
+
yield key, d
|