year stringclasses 1
value | day stringclasses 7
values | part stringclasses 2
values | pass stringclasses 15
values | fail stringclasses 15
values | test stringclasses 14
values | change stringclasses 2
values | i1 uint32 2 54 | i2 uint32 6 58 | j1 uint32 2 54 | j2 uint32 6 61 |
|---|---|---|---|---|---|---|---|---|---|---|
2022 | day01 | part1 | def solve(test: str) -> str:
numbers = test.strip().splitlines(keepends=False)
maximum = 0
current = 0
for number in numbers:
if number == "":
if current > maximum:
maximum = current
current = 0
continue
current += int(number)
if... | def solve(test: str) -> str:
numbers = test.strip().splitlines(keepends=False)
maximum = 0
current = 0
for number in numbers:
if number == "":
if current > maximum:
maximum = current
current = 0
continue
current += int(number)
re... | assert solve('1000\n2000\n3000\n\n4000\n\n5000\n6000\n\n7000\n8000\n9000\n\n10000') == '24000'
assert solve('1000\n2000\n3000\n\n4000\n\n5000\n6000\n\n7000\n8000\n9000\n\n100000') == '100000' | insert | 14 | 14 | 14 | 17 |
2022 | day01 | part1 | def solve(test: str) -> str:
chunks = test.strip().split("\n\n")
maximum = 0
for chunk in chunks:
current = 0
numbers = map(int, chunk.splitlines())
for number in numbers:
current += number
if current > maximum:
maximum = current
return str(maxi... | def solve(test: str) -> str:
chunks = test.strip().split("\n\n")
current = 0
maximum = 0
for chunk in chunks:
numbers = map(int, chunk.splitlines())
for number in numbers:
current += number
if current > maximum:
maximum = current
return str(maximum)... | assert solve('1000\n2000\n3000\n\n4000\n\n5000\n6000\n\n7000\n8000\n9000\n\n10000') == '24000'
assert solve('1000\n2000\n3000\n\n4000\n\n5000\n6000\n\n7000\n8000\n9000\n\n100000') == '100000' | replace | 2 | 6 | 2 | 6 |
2022 | day01 | part2 | def solve(test: str) -> str:
chunks = test.strip().split("\n\n")
values = []
for chunk in chunks:
numbers = map(int, chunk.splitlines())
current = 0
for number in numbers:
current += number
values.append(current)
top = sum(sorted(values, reverse=True)[:3])
... | def solve(test: str) -> str:
chunks = test.strip().split("\n\n")
values = []
for chunk in chunks:
numbers = map(int, chunk.splitlines())
current = 0
for number in numbers:
current += number
values.append(current)
top = sum(reversed(sorted(values)[:3]))
... | assert solve('1000\n2000\n3000\n\n4000\n\n5000\n6000\n\n7000\n8000\n9000\n\n10000') == '45000'
assert solve('1000\n2000\n3000\n\n4000\n\n5000\n6000\n\n7000\n8000\n9000\n\n100000') == '135000' | replace | 12 | 13 | 12 | 13 |
2022 | day02 | part1 | def solve(test: str) -> str:
points = {"X": 1, "Y": 2, "Z": 3}
beats = {"X": "C", "Y": "A", "Z": "B"}
mapping = {"X": "A", "Y": "B", "Z": "C"}
lines = test.strip().splitlines(keepends=False)
score = 0
for line in lines:
fst, snd = line.split(" ")
if fst == beats[snd]:
... | def solve(test: str) -> str:
points = {"X": 1, "Y": 2, "Z": 3}
beats = {"X": "C", "Y": "A", "Z": "B"}
lines = test.strip().splitlines(keepends=False)
score = 0
for line in lines:
fst, snd = line.split(" ")
if fst == beats[snd]:
score += 6
elif fst == snd:
... | assert solve('A Y\nB X\nC Z') == '15' | replace | 3 | 13 | 3 | 14 |
2022 | day02 | part2 | def solve(test: str) -> str:
points = {"A": 1, "B": 2, "C": 3}
beats = {"A": "C", "B": "A", "C": "B"}
loses = {"A": "B", "B": "C", "C": "A"}
lines = test.strip().splitlines(keepends=False)
score = 0
for line in lines:
fst, out = line.split(" ")
if out == "X":
score... | def solve(test: str) -> str:
points = {"A": 1, "B": 2, "C": 3}
beats = {"A": "C", "B": "A", "C": "B"}
loses = {"A": "B", "B": "C", "C": "A"}
lines = test.strip().splitlines(keepends=False)
score = 0
for line in lines:
fst, out = line.split(" ")
if out == "X":
score... | assert solve('A Y\nB X\nC Z') == '12' | replace | 12 | 17 | 12 | 17 |
2022 | day03 | part1 | import string
def solve(test: str) -> str:
priorities = {
c: v
for v, c in enumerate(string.ascii_lowercase + string.ascii_uppercase, start=1)
}
lines = test.strip().splitlines(keepends=False)
priority = 0
for line in lines:
midpoint = len(line) // 2
part1, part2 ... | import string
def solve(test: str) -> str:
priorities = dict(
enumerate(string.ascii_lowercase + string.ascii_uppercase, start=1)
)
lines = test.strip().splitlines(keepends=False)
priority = 0
for line in lines:
midpoint = len(line) // 2
part1, part2 = set(line[:midpoint]... | assert solve('vJrwpWtwJgWrhcsFMMfFFhFp\njqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL\nPmmdzqPrVvPwwTWBwg\nwMqvLMZHhHMvwLHjbvcjnnSBnvTQFn\nttgJtRGJQctTZtZT\nCrZsJsPPZsGzwwsLwLmpwMDw') == '157' | replace | 4 | 7 | 4 | 8 |
2022 | day03 | part2 | import string
def solve(test: str) -> str:
priorities = {
c: v
for v, c in enumerate(string.ascii_lowercase + string.ascii_uppercase, start=1)
}
lines = test.strip().splitlines(keepends=False)
priority = 0
for i in range(0, len(lines), 3):
common = "".join(set(lines[i]) &... | import string
def solve(test: str) -> str:
priorities = {
c: v
for v, c in enumerate(string.ascii_lowercase + string.ascii_uppercase, start=1)
}
lines = test.strip().splitlines(keepends=False)
priority = 0
for i in range(0, len(lines), 3):
common = "".join(set(lines[i]) &... | assert solve('vJrwpWtwJgWrhcsFMMfFFhFp\njqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL\nPmmdzqPrVvPwwTWBwg\nwMqvLMZHhHMvwLHjbvcjnnSBnvTQFn\nttgJtRGJQctTZtZT\nCrZsJsPPZsGzwwsLwLmpwMDw') == '70' | replace | 13 | 14 | 13 | 14 |
2022 | day04 | part1 | def solve(test: str) -> str:
lines = test.strip().splitlines(keepends=False)
result = 0
for line in lines:
int1, int2 = line.split(",", maxsplit=1)
low1, high1 = map(int, int1.split("-", maxsplit=1))
low2, high2 = map(int, int2.split("-", maxsplit=1))
if (low1 <= low2 and h... | def solve(test: str) -> str:
lines = test.strip().splitlines(keepends=False)
result = 0
for line in lines:
int1, int2 = line.split(",", maxsplit=1)
low1, high1 = map(int, int1.split("-", maxsplit=1))
low2, high2 = map(int, int2.split("-", maxsplit=1))
if max(low1, low2) <= ... | assert solve('2-4,6-8\n2-3,4-5\n5-7,7-9\n2-8,3-7\n6-6,4-6\n2-6,4-8') == '2' | replace | 9 | 10 | 9 | 10 |
2022 | day04 | part2 | def solve(test: str) -> str:
lines = test.strip().splitlines(keepends=False)
result = 0
for line in lines:
int1, int2 = line.split(",", maxsplit=1)
low1, high1 = map(int, int1.split("-", maxsplit=1))
low2, high2 = map(int, int2.split("-", maxsplit=1))
if high1 >= low2 and h... | def solve(test: str) -> str:
lines = test.strip().splitlines(keepends=False)
result = 0
for line in lines:
int1, int2 = line.split(",", maxsplit=1)
low1, high1 = map(int, int1.split("-", maxsplit=1))
low2, high2 = map(int, int2.split("-", maxsplit=1))
if (low1 <= low2 and h... | assert solve('2-4,6-8\n2-3,4-5\n5-7,7-9\n2-8,3-7\n6-6,4-6\n2-6,4-8') == '4' | replace | 9 | 10 | 9 | 10 |
2022 | day05 | part1 | import string
def solve(test: str) -> str:
configuration, moves = test.split("\n\n", maxsplit=1)
moves = moves.splitlines(keepends=False)
stacks = []
for line in zip(*configuration.splitlines(keepends=False)):
stack = [block for block in reversed(line) if block in string.ascii_uppercase]
... | import string
def solve(test: str) -> str:
configuration, moves = test.split("\n\n", maxsplit=1)
moves = moves.splitlines(keepends=False)
stacks = []
for line in zip(*configuration.splitlines(keepends=False)):
stack = [block for block in line if block in string.ascii_uppercase]
if st... | assert solve(' [D] \n[N] [C] \n[Z] [M] [P]\n 1 2 3 \n\nmove 1 from 2 to 1\nmove 3 from 1 to 3\nmove 2 from 2 to 1\nmove 1 from 1 to 2') == 'CMZ' | replace | 9 | 10 | 9 | 10 |
2022 | day05 | part2 | import string
def solve(test: str) -> str:
configuration, moves = test.split("\n\n", maxsplit=1)
moves = moves.splitlines(keepends=False)
stacks = []
for line in zip(*configuration.splitlines(keepends=False)):
stack = [block for block in reversed(line) if block in string.ascii_uppercase]
... | import string
def solve(test: str) -> str:
configuration, moves = test.split("\n\n", maxsplit=1)
moves = moves.splitlines(keepends=False)
stacks = []
for line in zip(*configuration.splitlines(keepends=False)):
stack = [block for block in reversed(line) if block in string.ascii_uppercase]
... | assert solve(' [D] \n[N] [C] \n[Z] [M] [P]\n 1 2 3 \n\nmove 1 from 2 to 1\nmove 3 from 1 to 3\nmove 2 from 2 to 1\nmove 1 from 1 to 2') == 'MCD' | replace | 25 | 26 | 25 | 26 |
2022 | day06 | part1 | def solve(test: str) -> str:
for i in range(len(test) - 3):
if len(set(test[i : i + 4])) == 4:
break
return str(i + 4)
| def solve(test: str) -> str:
for i in range(len(test) - 3):
if len(set(test[i : i + 4])) == 4:
break
return str(i)
| assert solve('mjqjpqmgbljsphdztnvjfqwrcgsmlb') == '7'
assert solve('bvwbjplbgvbhsrlpgdmjqwftvncz') == '5'
assert solve('nppdvjthqldpwncqszvftbrmjlhg') == '6'
assert solve('nznrnfrfntjfmvfwmzdfjlvtqnbhcprsg') == '10'
assert solve('zcfzfwzzqfrljwzlrfnpqdbhtmscgvjw') == '11' | replace | 5 | 6 | 5 | 6 |
2022 | day06 | part2 | def solve(test: str) -> str:
for i in range(len(test) - 13):
if len(set(test[i : i + 14])) == 14:
break
return str(i + 14)
| def solve(test: str) -> str:
for i in range(len(test) - 13):
if len(set(test[i : i + 14])) == 14:
break
return str(i)
| assert solve('mjqjpqmgbljsphdztnvjfqwrcgsmlb') == '19'
assert solve('bvwbjplbgvbhsrlpgdmjqwftvncz') == '23'
assert solve('nppdvjthqldpwncqszvftbrmjlhg') == '23'
assert solve('nznrnfrfntjfmvfwmzdfjlvtqnbhcprsg') == '29'
assert solve('zcfzfwzzqfrljwzlrfnpqdbhtmscgvjw') == '26' | replace | 5 | 6 | 5 | 6 |
2022 | day07 | part1 | def calculate_directory_size(directory, cwd, sizes):
size = 0
for name, content in directory.items():
current_name = cwd + name + "/"
if isinstance(content, int):
size += content
else:
size += calculate_directory_size(content, current_name, sizes)
sizes[cwd]... | def calculate_directory_size(directory, cwd, sizes):
size = 0
for name, content in directory.items():
current_name = cwd + name + "/"
if isinstance(content, int):
size += content
else:
size += calculate_directory_size(content, current_name, sizes)
sizes[... | assert solve('$ cd /\n$ ls\ndir a\n14848514 b.txt\n8504156 c.dat\ndir d\n$ cd a\n$ ls\ndir e\n29116 f\n2557 g\n62596 h.lst\n$ cd e\n$ ls\n584 i\n$ cd ..\n$ cd ..\n$ cd d\n$ ls\n4060174 j\n8033020 d.log\n5626152 d.ext\n7214296 k') == '95437' | replace | 10 | 11 | 10 | 11 |
2022 | day07 | part2 | def calculate_directory_size(directory, cwd, sizes):
size = 0
for name, content in directory.items():
current_name = cwd + name + "/"
if isinstance(content, int):
size += content
else:
size += calculate_directory_size(content, current_name, sizes)
sizes[cwd]... | def calculate_directory_size(directory, cwd, sizes):
size = 0
for name, content in directory.items():
current_name = cwd + name + "/"
if isinstance(content, int):
size += content
else:
size += calculate_directory_size(content, current_name, sizes)
sizes[cwd]... | assert solve('$ cd /\n$ ls\ndir a\n14848514 b.txt\n8504156 c.dat\ndir d\n$ cd a\n$ ls\ndir e\n29116 f\n2557 g\n62596 h.lst\n$ cd e\n$ ls\n584 i\n$ cd ..\n$ cd ..\n$ cd d\n$ ls\n4060174 j\n8033020 d.log\n5626152 d.ext\n7214296 k') == '24933642'
assert solve('$ cd /\n$ ls\ndir a\n8504156 c.dat\ndir d\n$ cd a\n$ ls\ndir e... | replace | 54 | 58 | 54 | 61 |
About the Dataset
This dataset is inspired by HumanEval
The source code used to generate the dataset can be found on GitHub
A collection of submissions for the Advent of Code challenge. This repository contains both passing and failing submissions.
This dataset is similar to BugNet, however it is meant to be used as an evaluation dataset.
The resulting dataset file will be a csv with the following columns:
year: Used to identify the submissionday: Used to identify the submissionpart: Used to identify the submissionfail: The initial (buggy) source code formatted (black)pass: The modified (accepted) source code formatted (black)change: The change that was made (replace,insert,delete)i1: Start of the change in the buggy source (the line; starting with 1)i2: End of the change in the buggy source (not inclusive; for insert we have i1 == i2)j1: Start of the change in the accepted source (the line; starting with 1)j2: End of the change in the accepted source (not inclusive; for delete we have j1 == j2)test: The test case that can be used to evaluate the submission.
- Downloads last month
- 5