MORepair
Collection
A Collection of MORepair that includes the multi-objective fine-tuned CodeLlama-13B and all evaluation benchmarks. • 6 items • Updated • 1
task_id stringlengths 1 30 | buggy_code stringlengths 162 2.31k | fixed_code stringlengths 162 2.31k | prompt stringlengths 134 1.35k | unit_tests stringlengths 317 8.03M |
|---|---|---|---|---|
is_palindrome | /*
Checks if given string is a palindrome
>>> is_palindrome("")
true
>>> is_palindrome("aba")
true
>>> is_palindrome("aaaaa")
true
>>> is_palindrome("zbcd")
false
*/
#include<stdio.h>
#include<string>
using namespace std;
bool is_palindrome(string text){
string pr(text.rbegin(),text.rend()-1);
return pr==text;
... | /*
Checks if given string is a palindrome
>>> is_palindrome("")
true
>>> is_palindrome("aba")
true
>>> is_palindrome("aaaaa")
true
>>> is_palindrome("zbcd")
false
*/
#include<stdio.h>
#include<string>
using namespace std;
bool is_palindrome(string text){
string pr(text.rbegin(),text.rend());
return pr==text;
}
... | /*
Checks if given string is a palindrome
>>> is_palindrome("")
true
>>> is_palindrome("aba")
true
>>> is_palindrome("aaaaa")
true
>>> is_palindrome("zbcd")
false
*/
#include<stdio.h>
#include<string>
using namespace std;
bool is_palindrome(string text){
| #undef NDEBUG
#include<assert.h>
int main(){
assert (is_palindrome("") == true);
assert (is_palindrome("aba") == true);
assert (is_palindrome("aaaaa") == true);
assert (is_palindrome("zbcd") == false);
assert (is_palindrome("xywyx") == true);
assert (is_palindrome("xywyz") == false);
assert ... |
car_race_collision | /*
Imagine a road that's a perfectly straight infinitely long line.
n cars are driving left to right; simultaneously, a different set of n cars
are driving right to left. The two sets of cars start out being very far from
each other. All cars move in the same speed. Two cars are said to collide
when a car that's m... | /*
Imagine a road that's a perfectly straight infinitely long line.
n cars are driving left to right; simultaneously, a different set of n cars
are driving right to left. The two sets of cars start out being very far from
each other. All cars move in the same speed. Two cars are said to collide
when a car that's m... | /*
Imagine a road that's a perfectly straight infinitely long line.
n cars are driving left to right; simultaneously, a different set of n cars
are driving right to left. The two sets of cars start out being very far from
each other. All cars move in the same speed. Two cars are said to collide
when a car that's m... | #undef NDEBUG
#include<assert.h>
int main(){
assert (car_race_collision(2) == 4);
assert (car_race_collision(3) == 9);
assert (car_race_collision(4) == 16);
assert (car_race_collision(8) == 64);
assert (car_race_collision(10) == 100);
assert (car_race_collision(2) == 4);
assert (car_race_col... |
solution | /*
Given a non-empty vector of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution({5, 8, 7, 1}) ==> 12
solution({3, 3, 3, 3, 3}) ==> 9
solution({30, 13, 24, 321}) ==>0
*/
#include<stdio.h>
#include<vector>
using namespace std;
int solutions(vector<int> lst){
int sum=... | /*
Given a non-empty vector of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution({5, 8, 7, 1}) ==> 12
solution({3, 3, 3, 3, 3}) ==> 9
solution({30, 13, 24, 321}) ==>0
*/
#include<stdio.h>
#include<vector>
using namespace std;
int solutions(vector<int> lst){
int sum=... | /*
Given a non-empty vector of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution({5, 8, 7, 1}) ==> 12
solution({3, 3, 3, 3, 3}) ==> 9
solution({30, 13, 24, 321}) ==>0
*/
#include<stdio.h>
#include<vector>
using namespace std;
int solutions(vector<int> lst){
| #undef NDEBUG
#include<assert.h>
int main(){
assert (solutions({5, 8, 7, 1}) == 12);
assert (solutions({3, 3, 3, 3, 3}) == 9);
assert (solutions({30, 13, 24, 321}) == 0);
assert (solutions({5, 9}) == 5);
assert (solutions({2, 4, 8}) == 0);
assert (solutions({30, 13, 23, 32}) == 23);
asser... |
starts_one_ends | /*
Given a positive integer n, return the count of the numbers of n-digit
positive integers that start or end with 1.
*/
#include<stdio.h>
using namespace std;
int starts_one_ends(int n){
if (n<1) return 0;
if (n==1) return 1;
int out=19;
for (int i=2;i<n;i++)
out=out*10;
return out;
}
| /*
Given a positive integer n, return the count of the numbers of n-digit
positive integers that start or end with 1.
*/
#include<stdio.h>
using namespace std;
int starts_one_ends(int n){
if (n<1) return 0;
if (n==1) return 1;
int out=18;
for (int i=2;i<n;i++)
out=out*10;
return out;
}
| /*
Given a positive integer n, return the count of the numbers of n-digit
positive integers that start or end with 1.
*/
#include<stdio.h>
using namespace std;
int starts_one_ends(int n){
| #undef NDEBUG
#include<assert.h>
int main(){
assert (starts_one_ends(1) == 1);
assert (starts_one_ends(2) == 18);
assert (starts_one_ends(3) == 180);
assert (starts_one_ends(4) == 1800);
assert (starts_one_ends(5) == 18000);
assert(starts_one_ends(1) == 1);
assert(starts_one_ends(2) == 18);
... |
is_prime | /*
Return true if a given number is prime, and false otherwise.
>>> is_prime(6)
false
>>> is_prime(101)
true
>>> is_prime(11)
true
>>> is_prime(13441)
true
>>> is_prime(61)
true
>>> is_prime(4)
false
>>> is_prime(1)
false
*/
#include<stdio.h>
using namespace std;
bool is_prime(long long n){
if (n<2) return false;
... | /*
Return true if a given number is prime, and false otherwise.
>>> is_prime(6)
false
>>> is_prime(101)
true
>>> is_prime(11)
true
>>> is_prime(13441)
true
>>> is_prime(61)
true
>>> is_prime(4)
false
>>> is_prime(1)
false
*/
#include<stdio.h>
using namespace std;
bool is_prime(long long n){
if (n<2) return false;
... | /*
Return true if a given number is prime, and false otherwise.
>>> is_prime(6)
false
>>> is_prime(101)
true
>>> is_prime(11)
true
>>> is_prime(13441)
true
>>> is_prime(61)
true
>>> is_prime(4)
false
>>> is_prime(1)
false
*/
#include<stdio.h>
using namespace std;
bool is_prime(long long n){
| #undef NDEBUG
#include<assert.h>
int main(){
assert (is_prime(6) == false);
assert (is_prime(101) == true);
assert (is_prime(11) == true);
assert (is_prime(13441) == true);
assert (is_prime(61) == true);
assert (is_prime(4) == false);
assert (is_prime(1) == false);
assert (is_prime(5) ==... |
digits | /*
Given a positive integer n, return the product of the odd digits.
Return 0 if all digits are even.
For example:
digits(1) == 1
digits(4) == 0
digits(235) == 15
*/
#include<stdio.h>
#include<string>
using namespace std;
int digits(int n){
int prod=1,has=0;
string s=to_string(n);
for (int i=0;i<s.length(... | /*
Given a positive integer n, return the product of the odd digits.
Return 0 if all digits are even.
For example:
digits(1) == 1
digits(4) == 0
digits(235) == 15
*/
#include<stdio.h>
#include<string>
using namespace std;
int digits(int n){
int prod=1,has=0;
string s=to_string(n);
for (int i=0;i<s.length(... | /*
Given a positive integer n, return the product of the odd digits.
Return 0 if all digits are even.
For example:
digits(1) == 1
digits(4) == 0
digits(235) == 15
*/
#include<stdio.h>
#include<string>
using namespace std;
int digits(int n){
| #undef NDEBUG
#include<assert.h>
int main(){
assert (digits(5) == 5);
assert (digits(54) == 5);
assert (digits(120) ==1);
assert (digits(5014) == 5);
assert (digits(98765) == 315);
assert (digits(5576543) == 2625);
assert (digits(2468) == 0);
assert (digits(5) == 5);
assert (digits(5... |
flip_case | /*
For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
>>> flip_case("Hello")
"hELLO"
*/
#include<stdio.h>
#include<string>
using namespace std;
string flip_case(string str){
string out="";
for (int i=0;i<str.length();i++)
{
char w=str[i];
if (w>=97 and w<=... | /*
For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
>>> flip_case("Hello")
"hELLO"
*/
#include<stdio.h>
#include<string>
using namespace std;
string flip_case(string str){
string out="";
for (int i=0;i<str.length();i++)
{
char w=str[i];
if (w>=97 and w<=... | /*
For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
>>> flip_case("Hello")
"hELLO"
*/
#include<stdio.h>
#include<string>
using namespace std;
string flip_case(string str){
| #undef NDEBUG
#include<assert.h>
int main(){
assert (flip_case("") == "");
assert (flip_case("Hello!") == "hELLO!");
assert (flip_case("These violent delights have violent ends") == "tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS");
assert (flip_case("") == "");
assert (flip_case("Hello!") == "hELLO!");
... |
largest_smallest_integers | /*
Create a function that returns a vector (a, b), where "a" is
the largest of negative integers, and "b" is the smallest
of positive integers in a vector.
If there is no negative or positive integers, return them as 0.
Examples:
largest_smallest_integers({2, 4, 1, 3, 5, 7}) == {0, 1}
largest_smallest_integers({}) == ... | /*
Create a function that returns a vector (a, b), where "a" is
the largest of negative integers, and "b" is the smallest
of positive integers in a vector.
If there is no negative or positive integers, return them as 0.
Examples:
largest_smallest_integers({2, 4, 1, 3, 5, 7}) == {0, 1}
largest_smallest_integers({}) == ... | /*
Create a function that returns a vector (a, b), where "a" is
the largest of negative integers, and "b" is the smallest
of positive integers in a vector.
If there is no negative or positive integers, return them as 0.
Examples:
largest_smallest_integers({2, 4, 1, 3, 5, 7}) == {0, 1}
largest_smallest_integers({}) == ... | #undef NDEBUG
#include<assert.h>
bool issame(vector<int> a,vector<int>b){
if (a.size()!=b.size()) return false;
for (int i=0;i<a.size();i++)
{
if (a[i]!=b[i]) return false;
}
return true;
}
int main(){
assert (issame(largest_smallest_integers({2, 4, 1, 3, 5, 7}) , {0, 1}));
assert (issam... |
file_name_check | "/*\nCreate a function which takes a string representing a file's name, and returns\n\"Yes\" if the (...TRUNCATED) | "/*\nCreate a function which takes a string representing a file's name, and returns\n\"Yes\" if the (...TRUNCATED) | "/*\nCreate a function which takes a string representing a file's name, and returns\n\"Yes\" if the (...TRUNCATED) | "#undef NDEBUG\n#include<assert.h>\nint main(){\n assert (file_name_check(\"example.txt\") == \"Y(...TRUNCATED) |
sort_array | "/*\nIn this Kata, you have to sort a vector of non-negative integers according to\nnumber of ones i(...TRUNCATED) | "/*\nIn this Kata, you have to sort a vector of non-negative integers according to\nnumber of ones i(...TRUNCATED) | "/*\nIn this Kata, you have to sort a vector of non-negative integers according to\nnumber of ones i(...TRUNCATED) | "#undef NDEBUG\n#include<assert.h>\nbool issame(vector<int> a,vector<int>b){\n if (a.size()!=b.si(...TRUNCATED) |
EvalRepair-C++ is a benchmark for evaluating C++ program repair performance, derived from HumanEval. It contains 164 single-function repair tasks, each with a buggy implementation and its corresponding fixed version.
Each row contains:
task_id: Unique identifier for the task (same as HumanEval)buggy_code: The buggy implementationfixed_code: The correct implementationunit_test: Unit tests for verifying the correctness of the implementationprompt: Prefix information for generating fixed codeThis dataset is derived from HumanEval, a benchmark for evaluating code generation capabilities. We manually introduced bugs into the original implementations and verified the fixes.
@article{morepair,
author = {Yang, Boyang and Tian, Haoye and Ren, Jiadong and Zhang, Hongyu and Klein, Jacques and Bissyande, Tegawende and Le Goues, Claire and Jin, Shunfu},
title = {MORepair: Teaching LLMs to Repair Code via Multi-Objective Fine-Tuning},
year = {2025},
publisher = {Association for Computing Machinery},
issn = {1049-331X},
url = {https://doi.org/10.1145/3735129},
doi = {10.1145/3735129},
journal = {ACM Trans. Softw. Eng. Methodol.},
}