name
stringlengths 15
44
| language
stringclasses 1
value | prompt
stringlengths 308
2.24k
| doctests
stringclasses 1
value | original
stringlengths 130
159
| prompt_terminology
stringclasses 1
value | tests
stringlengths 172
5.35k
| stop_tokens
sequencelengths 1
1
|
---|---|---|---|---|---|---|---|
HumanEval_0_has_close_elements | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Check if in given array list of numbers, are any two numbers closer to each other than
// given threshold.
// >>> hasCloseElements((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.0f, (float)3.0f))), (0.5f))
// (false)
// >>> hasCloseElements((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.8f, (float)3.0f, (float)4.0f, (float)5.0f, (float)2.0f))), (0.3f))
// (true)
public static boolean hasCloseElements(ArrayList<Float> numbers, float threshold) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_0_has_close_elements.py | reworded | }
public static void main(String[] args) {
assert(hasCloseElements((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.0f, (float)3.9f, (float)4.0f, (float)5.0f, (float)2.2f))), (0.3f)) == (true));
assert(hasCloseElements((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.0f, (float)3.9f, (float)4.0f, (float)5.0f, (float)2.2f))), (0.05f)) == (false));
assert(hasCloseElements((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.0f, (float)5.9f, (float)4.0f, (float)5.0f))), (0.95f)) == (true));
assert(hasCloseElements((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.0f, (float)5.9f, (float)4.0f, (float)5.0f))), (0.8f)) == (false));
assert(hasCloseElements((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.0f, (float)3.0f, (float)4.0f, (float)5.0f, (float)2.0f))), (0.1f)) == (true));
assert(hasCloseElements((new ArrayList<Float>(Arrays.asList((float)1.1f, (float)2.2f, (float)3.1f, (float)4.1f, (float)5.1f))), (1.0f)) == (true));
assert(hasCloseElements((new ArrayList<Float>(Arrays.asList((float)1.1f, (float)2.2f, (float)3.1f, (float)4.1f, (float)5.1f))), (0.5f)) == (false));
}
}
| [
"\n }\n"
] |
HumanEval_1_separate_paren_groups | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
// separate those group into separate strings and return the array list of those.
// Separate groups are balanced (each open brace is properly closed) and not nested within each other
// Ignore any spaces in the input string.
// >>> separateParenGroups(("( ) (( )) (( )( ))"))
// (new ArrayList<String>(Arrays.asList((String)"()", (String)"(())", (String)"(()())")))
public static ArrayList<String> separateParenGroups(String paren_string) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_1_separate_paren_groups.py | reworded | }
public static void main(String[] args) {
assert(separateParenGroups(("(()()) ((())) () ((())()())")).equals((new ArrayList<String>(Arrays.asList((String)"(()())", (String)"((()))", (String)"()", (String)"((())()())")))));
assert(separateParenGroups(("() (()) ((())) (((())))")).equals((new ArrayList<String>(Arrays.asList((String)"()", (String)"(())", (String)"((()))", (String)"(((())))")))));
assert(separateParenGroups(("(()(())((())))")).equals((new ArrayList<String>(Arrays.asList((String)"(()(())((())))")))));
assert(separateParenGroups(("( ) (( )) (( )( ))")).equals((new ArrayList<String>(Arrays.asList((String)"()", (String)"(())", (String)"(()())")))));
}
}
| [
"\n }\n"
] |
HumanEval_2_truncate_number | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the decimal part of the number.
// >>> truncateNumber((3.5f))
// (0.5f)
public static float truncateNumber(float number) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_2_truncate_number.py | reworded | }
public static void main(String[] args) {
assert(truncateNumber((3.5f)) == (0.5f));
assert(truncateNumber((1.25f)) == (0.25f));
assert(truncateNumber((123.0f)) == (0.0f));
}
}
| [
"\n }\n"
] |
HumanEval_3_below_zero | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// You're given an array array list of deposit and withdrawal operations on a bank account that starts with
// zero balance. Your task is to detect if at any point the balance of account fallls below zero, and
// at that point function should return true. Otherwise it should return false.
// >>> belowZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l))))
// (false)
// >>> belowZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)-4l, (long)5l))))
// (true)
public static boolean belowZero(ArrayList<Long> operations) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_3_below_zero.py | reworded | }
public static void main(String[] args) {
assert(belowZero((new ArrayList<Long>(Arrays.asList()))) == (false));
assert(belowZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)-3l, (long)1l, (long)2l, (long)-3l)))) == (false));
assert(belowZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)-4l, (long)5l, (long)6l)))) == (true));
assert(belowZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)-1l, (long)2l, (long)-2l, (long)5l, (long)-5l, (long)4l, (long)-4l)))) == (false));
assert(belowZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)-1l, (long)2l, (long)-2l, (long)5l, (long)-5l, (long)4l, (long)-5l)))) == (true));
assert(belowZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)-2l, (long)2l, (long)-2l, (long)5l, (long)-5l, (long)4l, (long)-4l)))) == (true));
}
}
| [
"\n }\n"
] |
HumanEval_4_mean_absolute_deviation | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// For a given array list of input numbers, calculate Mean Absolute Deviation
// around the mean of this dataset.
// Mean Absolute Deviation is the average absolute difference between each
// element and a centerpoint (mean in this case):
// MAD = average | x - x_mean |
// >>> meanAbsoluteDeviation((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.0f, (float)3.0f, (float)4.0f))))
// (1.0f)
public static float meanAbsoluteDeviation(ArrayList<Float> numbers) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_4_mean_absolute_deviation.py | reworded | }
public static void main(String[] args) {
assert(meanAbsoluteDeviation((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.0f)))) == (0.5f));
assert(meanAbsoluteDeviation((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.0f, (float)3.0f, (float)4.0f)))) == (1.0f));
assert(meanAbsoluteDeviation((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.0f, (float)3.0f, (float)4.0f, (float)5.0f)))) == (1.2f));
}
}
| [
"\n }\n"
] |
HumanEval_5_intersperse | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Insert a number 'delimeter' between every two consecutive elements of input array list `numbers'
// >>> intersperse((new ArrayList<Long>(Arrays.asList())), (4l))
// (new ArrayList<Long>(Arrays.asList()))
// >>> intersperse((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l))), (4l))
// (new ArrayList<Long>(Arrays.asList((long)1l, (long)4l, (long)2l, (long)4l, (long)3l)))
public static ArrayList<Long> intersperse(ArrayList<Long> numbers, long delimeter) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_5_intersperse.py | reworded | }
public static void main(String[] args) {
assert(intersperse((new ArrayList<Long>(Arrays.asList())), (7l)).equals((new ArrayList<Long>(Arrays.asList()))));
assert(intersperse((new ArrayList<Long>(Arrays.asList((long)5l, (long)6l, (long)3l, (long)2l))), (8l)).equals((new ArrayList<Long>(Arrays.asList((long)5l, (long)8l, (long)6l, (long)8l, (long)3l, (long)8l, (long)2l)))));
assert(intersperse((new ArrayList<Long>(Arrays.asList((long)2l, (long)2l, (long)2l))), (2l)).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)2l, (long)2l, (long)2l, (long)2l)))));
}
}
| [
"\n }\n"
] |
HumanEval_6_parse_nested_parens | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
// For each of the group, output the deepest level of nesting of parentheses.
// E.g. (()()) has maximum two levels of nesting while ((())) has three.
// >>> parseNestedParens(("(()()) ((())) () ((())()())"))
// (new ArrayList<Long>(Arrays.asList((long)2l, (long)3l, (long)1l, (long)3l)))
public static ArrayList<Long> parseNestedParens(String paren_string) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_6_parse_nested_parens.py | reworded | }
public static void main(String[] args) {
assert(parseNestedParens(("(()()) ((())) () ((())()())")).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)3l, (long)1l, (long)3l)))));
assert(parseNestedParens(("() (()) ((())) (((())))")).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l)))));
assert(parseNestedParens(("(()(())((())))")).equals((new ArrayList<Long>(Arrays.asList((long)4l)))));
}
}
| [
"\n }\n"
] |
HumanEval_7_filter_by_substring | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Filter an input array list of strings only for ones that contain given substring
// >>> filterBySubstring((new ArrayList<String>(Arrays.asList())), ("a"))
// (new ArrayList<String>(Arrays.asList()))
// >>> filterBySubstring((new ArrayList<String>(Arrays.asList((String)"abc", (String)"bacd", (String)"cde", (String)"array"))), ("a"))
// (new ArrayList<String>(Arrays.asList((String)"abc", (String)"bacd", (String)"array")))
public static ArrayList<String> filterBySubstring(ArrayList<String> strings, String substring) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_7_filter_by_substring.py | reworded | }
public static void main(String[] args) {
assert(filterBySubstring((new ArrayList<String>(Arrays.asList())), ("john")).equals((new ArrayList<String>(Arrays.asList()))));
assert(filterBySubstring((new ArrayList<String>(Arrays.asList((String)"xxx", (String)"asd", (String)"xxy", (String)"john doe", (String)"xxxAAA", (String)"xxx"))), ("xxx")).equals((new ArrayList<String>(Arrays.asList((String)"xxx", (String)"xxxAAA", (String)"xxx")))));
assert(filterBySubstring((new ArrayList<String>(Arrays.asList((String)"xxx", (String)"asd", (String)"aaaxxy", (String)"john doe", (String)"xxxAAA", (String)"xxx"))), ("xx")).equals((new ArrayList<String>(Arrays.asList((String)"xxx", (String)"aaaxxy", (String)"xxxAAA", (String)"xxx")))));
assert(filterBySubstring((new ArrayList<String>(Arrays.asList((String)"grunt", (String)"trumpet", (String)"prune", (String)"gruesome"))), ("run")).equals((new ArrayList<String>(Arrays.asList((String)"grunt", (String)"prune")))));
}
}
| [
"\n }\n"
] |
HumanEval_8_sum_product | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// For a given array list of integers, return a pair consisting of a sum and a product of all the integers in an array array list.
// Empty sum should be equal to 0 and empty product should be equal to 1.
// >>> sumProduct((new ArrayList<Long>(Arrays.asList())))
// (Pair.with(0l, 1l))
// >>> sumProduct((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l))))
// (Pair.with(10l, 24l))
public static Pair<Long, Long> sumProduct(ArrayList<Long> numbers) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_8_sum_product.py | reworded | }
public static void main(String[] args) {
assert(sumProduct((new ArrayList<Long>(Arrays.asList()))).equals((Pair.with(0l, 1l))));
assert(sumProduct((new ArrayList<Long>(Arrays.asList((long)1l, (long)1l, (long)1l)))).equals((Pair.with(3l, 1l))));
assert(sumProduct((new ArrayList<Long>(Arrays.asList((long)100l, (long)0l)))).equals((Pair.with(100l, 0l))));
assert(sumProduct((new ArrayList<Long>(Arrays.asList((long)3l, (long)5l, (long)7l)))).equals((Pair.with(15l, 105l))));
assert(sumProduct((new ArrayList<Long>(Arrays.asList((long)10l)))).equals((Pair.with(10l, 10l))));
}
}
| [
"\n }\n"
] |
HumanEval_9_rolling_max | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// From a given array list of integers, generate an array array list of rolling maximum element found until given moment
// in the sequence.
// >>> rollingMax((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)2l, (long)3l, (long)4l, (long)2l))))
// (new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)3l, (long)3l, (long)4l, (long)4l)))
public static ArrayList<Long> rollingMax(ArrayList<Long> numbers) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_9_rolling_max.py | reworded | }
public static void main(String[] args) {
assert(rollingMax((new ArrayList<Long>(Arrays.asList()))).equals((new ArrayList<Long>(Arrays.asList()))));
assert(rollingMax((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l)))).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l)))));
assert(rollingMax((new ArrayList<Long>(Arrays.asList((long)4l, (long)3l, (long)2l, (long)1l)))).equals((new ArrayList<Long>(Arrays.asList((long)4l, (long)4l, (long)4l, (long)4l)))));
assert(rollingMax((new ArrayList<Long>(Arrays.asList((long)3l, (long)2l, (long)3l, (long)100l, (long)3l)))).equals((new ArrayList<Long>(Arrays.asList((long)3l, (long)3l, (long)3l, (long)100l, (long)100l)))));
}
}
| [
"\n }\n"
] |
HumanEval_10_make_palindrome | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Find the shortest palindrome that begins with a supplied string.
// Algorithm idea is simple:
// - Find the longest postfix of supplied string that is a palindrome.
// - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
// >>> makePalindrome((""))
// ("")
// >>> makePalindrome(("cat"))
// ("catac")
// >>> makePalindrome(("cata"))
// ("catac")
public static String makePalindrome(String string) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_10_make_palindrome.py | reworded | }
public static void main(String[] args) {
assert(makePalindrome(("")).equals(("")));
assert(makePalindrome(("x")).equals(("x")));
assert(makePalindrome(("xyz")).equals(("xyzyx")));
assert(makePalindrome(("xyx")).equals(("xyx")));
assert(makePalindrome(("jerry")).equals(("jerryrrej")));
}
}
| [
"\n }\n"
] |
HumanEval_11_string_xor | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// >>> stringXor(("010"), ("110"))
// ("100")
public static String stringXor(String a, String b) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_11_string_xor.py | reworded | }
public static void main(String[] args) {
assert(stringXor(("111000"), ("101010")).equals(("010010")));
assert(stringXor(("1"), ("1")).equals(("0")));
assert(stringXor(("0101"), ("0000")).equals(("0101")));
}
}
| [
"\n }\n"
] |
HumanEval_12_longest | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Out of array list of strings, return the longest one. Return the first one in case of multiple
// strings of the same length. Return null in case the input array list is empty.
// >>> longest((new ArrayList<String>(Arrays.asList())))
// Optional.empty()
// >>> longest((new ArrayList<String>(Arrays.asList((String)"a", (String)"b", (String)"c"))))
// Optional.of("a")
// >>> longest((new ArrayList<String>(Arrays.asList((String)"a", (String)"bb", (String)"ccc"))))
// Optional.of("ccc")
public static Optional<String> longest(ArrayList<String> strings) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_12_longest.py | reworded | }
public static void main(String[] args) {
assert(longest((new ArrayList<String>(Arrays.asList()))).equals(Optional.empty()));
assert(longest((new ArrayList<String>(Arrays.asList((String)"x", (String)"y", (String)"z")))).equals(Optional.of("x")));
assert(longest((new ArrayList<String>(Arrays.asList((String)"x", (String)"yyy", (String)"zzzz", (String)"www", (String)"kkkk", (String)"abc")))).equals(Optional.of("zzzz")));
}
}
| [
"\n }\n"
] |
HumanEval_13_greatest_common_divisor | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Return a greatest common divisor of two integers a and b
// >>> greatestCommonDivisor((3l), (5l))
// (1l)
// >>> greatestCommonDivisor((25l), (15l))
// (5l)
public static long greatestCommonDivisor(long a, long b) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_13_greatest_common_divisor.py | reworded | }
public static void main(String[] args) {
assert(greatestCommonDivisor((3l), (7l)) == (1l));
assert(greatestCommonDivisor((10l), (15l)) == (5l));
assert(greatestCommonDivisor((49l), (14l)) == (7l));
assert(greatestCommonDivisor((144l), (60l)) == (12l));
}
}
| [
"\n }\n"
] |
HumanEval_14_all_prefixes | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Return array list of all prefixes from shortest to longest of the input string
// >>> allPrefixes(("abc"))
// (new ArrayList<String>(Arrays.asList((String)"a", (String)"ab", (String)"abc")))
public static ArrayList<String> allPrefixes(String string) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_14_all_prefixes.py | reworded | }
public static void main(String[] args) {
assert(allPrefixes(("")).equals((new ArrayList<String>(Arrays.asList()))));
assert(allPrefixes(("asdfgh")).equals((new ArrayList<String>(Arrays.asList((String)"a", (String)"as", (String)"asd", (String)"asdf", (String)"asdfg", (String)"asdfgh")))));
assert(allPrefixes(("WWW")).equals((new ArrayList<String>(Arrays.asList((String)"W", (String)"WW", (String)"WWW")))));
}
}
| [
"\n }\n"
] |
HumanEval_15_string_sequence | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Return a string containing space-delimited numbers starting from 0 upto n inclusive.
// >>> stringSequence((0l))
// ("0")
// >>> stringSequence((5l))
// ("0 1 2 3 4 5")
public static String stringSequence(long n) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_15_string_sequence.py | reworded | }
public static void main(String[] args) {
assert(stringSequence((0l)).equals(("0")));
assert(stringSequence((3l)).equals(("0 1 2 3")));
assert(stringSequence((10l)).equals(("0 1 2 3 4 5 6 7 8 9 10")));
}
}
| [
"\n }\n"
] |
HumanEval_16_count_distinct_characters | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given a string, find out how many distinct characters (regardless of case) does it consist of
// >>> countDistinctCharacters(("xyzXYZ"))
// (3l)
// >>> countDistinctCharacters(("Jerry"))
// (4l)
public static long countDistinctCharacters(String string) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_16_count_distinct_characters.py | reworded | }
public static void main(String[] args) {
assert(countDistinctCharacters(("")) == (0l));
assert(countDistinctCharacters(("abcde")) == (5l));
assert(countDistinctCharacters(("abcdecadeCADE")) == (5l));
assert(countDistinctCharacters(("aaaaAAAAaaaa")) == (1l));
assert(countDistinctCharacters(("Jerry jERRY JeRRRY")) == (5l));
}
}
| [
"\n }\n"
] |
HumanEval_17_parse_music | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Input to this function is a string representing musical notes in a special ASCII format.
// Your task is to parse this string and return array list of integers corresponding to how many beats does each
// not last.
// Here is a legend:
// 'o' - whole note, lasts four beats
// 'o|' - half note, lasts two beats
// '.|' - quater note, lasts one beat
// >>> parseMusic(("o o| .| o| o| .| .| .| .| o o"))
// (new ArrayList<Long>(Arrays.asList((long)4l, (long)2l, (long)1l, (long)2l, (long)2l, (long)1l, (long)1l, (long)1l, (long)1l, (long)4l, (long)4l)))
public static ArrayList<Long> parseMusic(String music_string) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_17_parse_music.py | reworded | }
public static void main(String[] args) {
assert(parseMusic(("")).equals((new ArrayList<Long>(Arrays.asList()))));
assert(parseMusic(("o o o o")).equals((new ArrayList<Long>(Arrays.asList((long)4l, (long)4l, (long)4l, (long)4l)))));
assert(parseMusic((".| .| .| .|")).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)1l, (long)1l, (long)1l)))));
assert(parseMusic(("o| o| .| .| o o o o")).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)2l, (long)1l, (long)1l, (long)4l, (long)4l, (long)4l, (long)4l)))));
assert(parseMusic(("o| .| o| .| o o| o o|")).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)1l, (long)2l, (long)1l, (long)4l, (long)2l, (long)4l, (long)2l)))));
}
}
| [
"\n }\n"
] |
HumanEval_18_how_many_times | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Find how many times a given substring can be found in the original string. Count overlaping cases.
// >>> howManyTimes((""), ("a"))
// (0l)
// >>> howManyTimes(("aaa"), ("a"))
// (3l)
// >>> howManyTimes(("aaaa"), ("aa"))
// (3l)
public static long howManyTimes(String string, String substring) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_18_how_many_times.py | reworded | }
public static void main(String[] args) {
assert(howManyTimes((""), ("x")) == (0l));
assert(howManyTimes(("xyxyxyx"), ("x")) == (4l));
assert(howManyTimes(("cacacacac"), ("cac")) == (4l));
assert(howManyTimes(("john doe"), ("john")) == (1l));
}
}
| [
"\n }\n"
] |
HumanEval_19_sort_numbers | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// >>> sortNumbers(("three one five"))
// ("one three five")
public static String sortNumbers(String numbers) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_19_sort_numbers.py | reworded | }
public static void main(String[] args) {
assert(sortNumbers(("")).equals(("")));
assert(sortNumbers(("three")).equals(("three")));
assert(sortNumbers(("three five nine")).equals(("three five nine")));
assert(sortNumbers(("five zero four seven nine eight")).equals(("zero four five seven eight nine")));
assert(sortNumbers(("six five four three two one zero")).equals(("zero one two three four five six")));
}
}
| [
"\n }\n"
] |
HumanEval_20_find_closest_elements | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// From a supplied array list of numbers (of length at least two) select and return two that are the closest to each
// other and return them in order (smaller number, larger number).
// >>> findClosestElements((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.0f, (float)3.0f, (float)4.0f, (float)5.0f, (float)2.2f))))
// (Pair.with(2.0f, 2.2f))
// >>> findClosestElements((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.0f, (float)3.0f, (float)4.0f, (float)5.0f, (float)2.0f))))
// (Pair.with(2.0f, 2.0f))
public static Pair<Float, Float> findClosestElements(ArrayList<Float> numbers) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_20_find_closest_elements.py | reworded | }
public static void main(String[] args) {
assert(findClosestElements((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.0f, (float)3.9f, (float)4.0f, (float)5.0f, (float)2.2f)))).equals((Pair.with(3.9f, 4.0f))));
assert(findClosestElements((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.0f, (float)5.9f, (float)4.0f, (float)5.0f)))).equals((Pair.with(5.0f, 5.9f))));
assert(findClosestElements((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.0f, (float)3.0f, (float)4.0f, (float)5.0f, (float)2.2f)))).equals((Pair.with(2.0f, 2.2f))));
assert(findClosestElements((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.0f, (float)3.0f, (float)4.0f, (float)5.0f, (float)2.0f)))).equals((Pair.with(2.0f, 2.0f))));
assert(findClosestElements((new ArrayList<Float>(Arrays.asList((float)1.1f, (float)2.2f, (float)3.1f, (float)4.1f, (float)5.1f)))).equals((Pair.with(2.2f, 3.1f))));
}
}
| [
"\n }\n"
] |
HumanEval_21_rescale_to_unit | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given array list of numbers (of at least two elements), apply a linear transform to that array list,
// such that the smallest number will become 0 and the largest will become 1
// >>> rescaleToUnit((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.0f, (float)3.0f, (float)4.0f, (float)5.0f))))
// (new ArrayList<Float>(Arrays.asList((float)0.0f, (float)0.25f, (float)0.5f, (float)0.75f, (float)1.0f)))
public static ArrayList<Float> rescaleToUnit(ArrayList<Float> numbers) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_21_rescale_to_unit.py | reworded | }
public static void main(String[] args) {
assert(rescaleToUnit((new ArrayList<Float>(Arrays.asList((float)2.0f, (float)49.9f)))).equals((new ArrayList<Float>(Arrays.asList((float)0.0f, (float)1.0f)))));
assert(rescaleToUnit((new ArrayList<Float>(Arrays.asList((float)100.0f, (float)49.9f)))).equals((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)0.0f)))));
assert(rescaleToUnit((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.0f, (float)3.0f, (float)4.0f, (float)5.0f)))).equals((new ArrayList<Float>(Arrays.asList((float)0.0f, (float)0.25f, (float)0.5f, (float)0.75f, (float)1.0f)))));
assert(rescaleToUnit((new ArrayList<Float>(Arrays.asList((float)2.0f, (float)1.0f, (float)5.0f, (float)3.0f, (float)4.0f)))).equals((new ArrayList<Float>(Arrays.asList((float)0.25f, (float)0.0f, (float)1.0f, (float)0.5f, (float)0.75f)))));
assert(rescaleToUnit((new ArrayList<Float>(Arrays.asList((float)12.0f, (float)11.0f, (float)15.0f, (float)13.0f, (float)14.0f)))).equals((new ArrayList<Float>(Arrays.asList((float)0.25f, (float)0.0f, (float)1.0f, (float)0.5f, (float)0.75f)))));
}
}
| [
"\n }\n"
] |
HumanEval_22_filter_integers | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Filter given array list of any javathon values only for integers
// >>> filterIntegers((new ArrayList<Object>(Arrays.asList((String)"a", (String)3.14f, (String)5l))))
// (new ArrayList<Long>(Arrays.asList((long)5l)))
// >>> filterIntegers((new ArrayList<Object>(Arrays.asList(1l, 2l, 3l, "abc", new HashMap<Long,Long>(Map.of()), new ArrayList<Long>(Arrays.asList())))))
// (new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l)))
public static ArrayList<Long> filterIntegers(ArrayList<Object> values) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_22_filter_integers.py | reworded | }
public static void main(String[] args) {
assert(filterIntegers((new ArrayList<Object>(Arrays.asList()))).equals((new ArrayList<Long>(Arrays.asList()))));
assert(filterIntegers((new ArrayList<Object>(Arrays.asList(4l, new HashMap<Long,Long>(Map.of()), new ArrayList<Long>(Arrays.asList()), 23.2f, 9l, "adasd")))).equals((new ArrayList<Long>(Arrays.asList((long)4l, (long)9l)))));
assert(filterIntegers((new ArrayList<Object>(Arrays.asList(3l, "c", 3l, 3l, "a", "b")))).equals((new ArrayList<Long>(Arrays.asList((long)3l, (long)3l, (long)3l)))));
}
}
| [
"\n }\n"
] |
HumanEval_23_strlen | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Return length of given string
// >>> stringLength((""))
// (0l)
// >>> stringLength(("abc"))
// (3l)
public static long strlen(String string) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_23_strlen.py | reworded | }
public static void main(String[] args) {
assert(strlen(("")) == (0l));
assert(strlen(("x")) == (1l));
assert(strlen(("asdasnakj")) == (9l));
}
}
| [
"\n }\n"
] |
HumanEval_24_largest_divisor | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// For a given number n, find the largest number that divides n evenly, smaller than n
// >>> largestDivisor((15l))
// (5l)
public static long largestDivisor(long n) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_24_largest_divisor.py | reworded | }
public static void main(String[] args) {
assert(largestDivisor((3l)) == (1l));
assert(largestDivisor((7l)) == (1l));
assert(largestDivisor((10l)) == (5l));
assert(largestDivisor((100l)) == (50l));
assert(largestDivisor((49l)) == (7l));
}
}
| [
"\n }\n"
] |
HumanEval_25_factorize | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Return array list of prime factors of given integer in the order from smallest to largest.
// Each of the factors should be array listed number of times corresponding to how many times it appeares in factorization.
// Input number should be equal to the product of all factors
// >>> factorize((8l))
// (new ArrayList<Long>(Arrays.asList((long)2l, (long)2l, (long)2l)))
// >>> factorize((25l))
// (new ArrayList<Long>(Arrays.asList((long)5l, (long)5l)))
// >>> factorize((70l))
// (new ArrayList<Long>(Arrays.asList((long)2l, (long)5l, (long)7l)))
public static ArrayList<Long> factorize(long n) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_25_factorize.py | reworded | }
public static void main(String[] args) {
assert(factorize((2l)).equals((new ArrayList<Long>(Arrays.asList((long)2l)))));
assert(factorize((4l)).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)2l)))));
assert(factorize((8l)).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)2l, (long)2l)))));
assert(factorize((57l)).equals((new ArrayList<Long>(Arrays.asList((long)3l, (long)19l)))));
assert(factorize((3249l)).equals((new ArrayList<Long>(Arrays.asList((long)3l, (long)3l, (long)19l, (long)19l)))));
assert(factorize((185193l)).equals((new ArrayList<Long>(Arrays.asList((long)3l, (long)3l, (long)3l, (long)19l, (long)19l, (long)19l)))));
assert(factorize((20577l)).equals((new ArrayList<Long>(Arrays.asList((long)3l, (long)19l, (long)19l, (long)19l)))));
assert(factorize((18l)).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)3l, (long)3l)))));
}
}
| [
"\n }\n"
] |
HumanEval_26_remove_duplicates | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// From an array array list of integers, remove all elements that occur more than once.
// Keep order of elements left the same as in the input.
// >>> removeDuplicates((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)2l, (long)4l))))
// (new ArrayList<Long>(Arrays.asList((long)1l, (long)3l, (long)4l)))
public static ArrayList<Long> removeDuplicates(ArrayList<Long> numbers) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_26_remove_duplicates.py | reworded | }
public static void main(String[] args) {
assert(removeDuplicates((new ArrayList<Long>(Arrays.asList()))).equals((new ArrayList<Long>(Arrays.asList()))));
assert(removeDuplicates((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l)))).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l)))));
assert(removeDuplicates((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)2l, (long)4l, (long)3l, (long)5l)))).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)4l, (long)5l)))));
}
}
| [
"\n }\n"
] |
HumanEval_27_flip_case | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
// >>> flipCase(("Hello"))
// ("hELLO")
public static String flipCase(String string) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_27_flip_case.py | reworded | }
public static void main(String[] args) {
assert(flipCase(("")).equals(("")));
assert(flipCase(("Hello!")).equals(("hELLO!")));
assert(flipCase(("These violent delights have violent ends")).equals(("tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS")));
}
}
| [
"\n }\n"
] |
HumanEval_28_concatenate | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Concatenate array list of strings into a single string
// >>> concatenate((new ArrayList<String>(Arrays.asList())))
// ("")
// >>> concatenate((new ArrayList<String>(Arrays.asList((String)"a", (String)"b", (String)"c"))))
// ("abc")
public static String concatenate(ArrayList<String> strings) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_28_concatenate.py | reworded | }
public static void main(String[] args) {
assert(concatenate((new ArrayList<String>(Arrays.asList()))).equals(("")));
assert(concatenate((new ArrayList<String>(Arrays.asList((String)"x", (String)"y", (String)"z")))).equals(("xyz")));
assert(concatenate((new ArrayList<String>(Arrays.asList((String)"x", (String)"y", (String)"z", (String)"w", (String)"k")))).equals(("xyzwk")));
}
}
| [
"\n }\n"
] |
HumanEval_29_filter_by_prefix | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Filter an input array list of strings only for ones that start with a given prefix.
// >>> filterByPrefix((new ArrayList<String>(Arrays.asList())), ("a"))
// (new ArrayList<String>(Arrays.asList()))
// >>> filterByPrefix((new ArrayList<String>(Arrays.asList((String)"abc", (String)"bcd", (String)"cde", (String)"array"))), ("a"))
// (new ArrayList<String>(Arrays.asList((String)"abc", (String)"array")))
public static ArrayList<String> filterByPrefix(ArrayList<String> strings, String prefix) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_29_filter_by_prefix.py | reworded | }
public static void main(String[] args) {
assert(filterByPrefix((new ArrayList<String>(Arrays.asList())), ("john")).equals((new ArrayList<String>(Arrays.asList()))));
assert(filterByPrefix((new ArrayList<String>(Arrays.asList((String)"xxx", (String)"asd", (String)"xxy", (String)"john doe", (String)"xxxAAA", (String)"xxx"))), ("xxx")).equals((new ArrayList<String>(Arrays.asList((String)"xxx", (String)"xxxAAA", (String)"xxx")))));
}
}
| [
"\n }\n"
] |
HumanEval_30_get_positive | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Return only positive numbers in the array list.
// >>> getPositive((new ArrayList<Long>(Arrays.asList((long)-1l, (long)2l, (long)-4l, (long)5l, (long)6l))))
// (new ArrayList<Long>(Arrays.asList((long)2l, (long)5l, (long)6l)))
// >>> getPositive((new ArrayList<Long>(Arrays.asList((long)5l, (long)3l, (long)-5l, (long)2l, (long)-3l, (long)3l, (long)9l, (long)0l, (long)123l, (long)1l, (long)-10l))))
// (new ArrayList<Long>(Arrays.asList((long)5l, (long)3l, (long)2l, (long)3l, (long)9l, (long)123l, (long)1l)))
public static ArrayList<Long> getPositive(ArrayList<Long> l) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_30_get_positive.py | reworded | }
public static void main(String[] args) {
assert(getPositive((new ArrayList<Long>(Arrays.asList((long)-1l, (long)-2l, (long)4l, (long)5l, (long)6l)))).equals((new ArrayList<Long>(Arrays.asList((long)4l, (long)5l, (long)6l)))));
assert(getPositive((new ArrayList<Long>(Arrays.asList((long)5l, (long)3l, (long)-5l, (long)2l, (long)3l, (long)3l, (long)9l, (long)0l, (long)123l, (long)1l, (long)-10l)))).equals((new ArrayList<Long>(Arrays.asList((long)5l, (long)3l, (long)2l, (long)3l, (long)3l, (long)9l, (long)123l, (long)1l)))));
assert(getPositive((new ArrayList<Long>(Arrays.asList((long)-1l, (long)-2l)))).equals((new ArrayList<Long>(Arrays.asList()))));
assert(getPositive((new ArrayList<Long>(Arrays.asList()))).equals((new ArrayList<Long>(Arrays.asList()))));
}
}
| [
"\n }\n"
] |
HumanEval_31_is_prime | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Return true if a given number is prime, and false otherwise.
// >>> isPrime((6l))
// (false)
// >>> isPrime((101l))
// (true)
// >>> isPrime((11l))
// (true)
// >>> isPrime((13441l))
// (true)
// >>> isPrime((61l))
// (true)
// >>> isPrime((4l))
// (false)
// >>> isPrime((1l))
// (false)
public static boolean isPrime(long n) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_31_is_prime.py | reworded | }
public static void main(String[] args) {
assert(isPrime((6l)) == (false));
assert(isPrime((101l)) == (true));
assert(isPrime((11l)) == (true));
assert(isPrime((13441l)) == (true));
assert(isPrime((61l)) == (true));
assert(isPrime((4l)) == (false));
assert(isPrime((1l)) == (false));
assert(isPrime((5l)) == (true));
assert(isPrime((11l)) == (true));
assert(isPrime((17l)) == (true));
assert(isPrime((85l)) == (false));
assert(isPrime((77l)) == (false));
assert(isPrime((255379l)) == (false));
}
}
| [
"\n }\n"
] |
HumanEval_33_sort_third | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// This function takes an array array list l and returns an array array list l' such that
// l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
// to the values of the corresponding indicies of l, but sorted.
// >>> sortThird((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l))))
// (new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l)))
// >>> sortThird((new ArrayList<Long>(Arrays.asList((long)5l, (long)6l, (long)3l, (long)4l, (long)8l, (long)9l, (long)2l))))
// (new ArrayList<Long>(Arrays.asList((long)2l, (long)6l, (long)3l, (long)4l, (long)8l, (long)9l, (long)5l)))
public static ArrayList<Long> sortThird(ArrayList<Long> l) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_33_sort_third.py | reworded | }
public static void main(String[] args) {
assert(sortThird((new ArrayList<Long>(Arrays.asList((long)5l, (long)6l, (long)3l, (long)4l, (long)8l, (long)9l, (long)2l)))).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)6l, (long)3l, (long)4l, (long)8l, (long)9l, (long)5l)))));
assert(sortThird((new ArrayList<Long>(Arrays.asList((long)5l, (long)8l, (long)3l, (long)4l, (long)6l, (long)9l, (long)2l)))).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)8l, (long)3l, (long)4l, (long)6l, (long)9l, (long)5l)))));
assert(sortThird((new ArrayList<Long>(Arrays.asList((long)5l, (long)6l, (long)9l, (long)4l, (long)8l, (long)3l, (long)2l)))).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)6l, (long)9l, (long)4l, (long)8l, (long)3l, (long)5l)))));
assert(sortThird((new ArrayList<Long>(Arrays.asList((long)5l, (long)6l, (long)3l, (long)4l, (long)8l, (long)9l, (long)2l, (long)1l)))).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)6l, (long)3l, (long)4l, (long)8l, (long)9l, (long)5l, (long)1l)))));
}
}
| [
"\n }\n"
] |
HumanEval_34_unique | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Return sorted unique elements in an array array list
// >>> unique((new ArrayList<Long>(Arrays.asList((long)5l, (long)3l, (long)5l, (long)2l, (long)3l, (long)3l, (long)9l, (long)0l, (long)123l))))
// (new ArrayList<Long>(Arrays.asList((long)0l, (long)2l, (long)3l, (long)5l, (long)9l, (long)123l)))
public static ArrayList<Long> unique(ArrayList<Long> l) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_34_unique.py | reworded | }
public static void main(String[] args) {
assert(unique((new ArrayList<Long>(Arrays.asList((long)5l, (long)3l, (long)5l, (long)2l, (long)3l, (long)3l, (long)9l, (long)0l, (long)123l)))).equals((new ArrayList<Long>(Arrays.asList((long)0l, (long)2l, (long)3l, (long)5l, (long)9l, (long)123l)))));
}
}
| [
"\n }\n"
] |
HumanEval_35_max_element | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Return maximum element in the array list.
// >>> maxElement((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l))))
// (3l)
// >>> maxElement((new ArrayList<Long>(Arrays.asList((long)5l, (long)3l, (long)-5l, (long)2l, (long)-3l, (long)3l, (long)9l, (long)0l, (long)123l, (long)1l, (long)-10l))))
// (123l)
public static long maxElement(ArrayList<Long> l) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_35_max_element.py | reworded | }
public static void main(String[] args) {
assert(maxElement((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l)))) == (3l));
assert(maxElement((new ArrayList<Long>(Arrays.asList((long)5l, (long)3l, (long)-5l, (long)2l, (long)-3l, (long)3l, (long)9l, (long)0l, (long)124l, (long)1l, (long)-10l)))) == (124l));
}
}
| [
"\n }\n"
] |
HumanEval_36_fizz_buzz | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
// >>> fizzBuzz((50l))
// (0l)
// >>> fizzBuzz((78l))
// (2l)
// >>> fizzBuzz((79l))
// (3l)
public static long fizzBuzz(long n) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_36_fizz_buzz.py | reworded | }
public static void main(String[] args) {
assert(fizzBuzz((50l)) == (0l));
assert(fizzBuzz((78l)) == (2l));
assert(fizzBuzz((79l)) == (3l));
assert(fizzBuzz((100l)) == (3l));
assert(fizzBuzz((200l)) == (6l));
assert(fizzBuzz((4000l)) == (192l));
assert(fizzBuzz((10000l)) == (639l));
assert(fizzBuzz((100000l)) == (8026l));
}
}
| [
"\n }\n"
] |
HumanEval_37_sort_even | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// This function takes an array array list l and returns an array array list l' such that
// l' is identical to l in the odd indicies, while its values at the even indicies are equal
// to the values of the even indicies of l, but sorted.
// >>> sortEven((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l))))
// (new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l)))
// >>> sortEven((new ArrayList<Long>(Arrays.asList((long)5l, (long)6l, (long)3l, (long)4l))))
// (new ArrayList<Long>(Arrays.asList((long)3l, (long)6l, (long)5l, (long)4l)))
public static ArrayList<Long> sortEven(ArrayList<Long> l) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_37_sort_even.py | reworded | }
public static void main(String[] args) {
assert(sortEven((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l)))).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l)))));
assert(sortEven((new ArrayList<Long>(Arrays.asList((long)5l, (long)3l, (long)-5l, (long)2l, (long)-3l, (long)3l, (long)9l, (long)0l, (long)123l, (long)1l, (long)-10l)))).equals((new ArrayList<Long>(Arrays.asList((long)-10l, (long)3l, (long)-5l, (long)2l, (long)-3l, (long)3l, (long)5l, (long)0l, (long)9l, (long)1l, (long)123l)))));
assert(sortEven((new ArrayList<Long>(Arrays.asList((long)5l, (long)8l, (long)-12l, (long)4l, (long)23l, (long)2l, (long)3l, (long)11l, (long)12l, (long)-10l)))).equals((new ArrayList<Long>(Arrays.asList((long)-12l, (long)8l, (long)3l, (long)4l, (long)5l, (long)2l, (long)12l, (long)11l, (long)23l, (long)-10l)))));
}
}
| [
"\n }\n"
] |
HumanEval_39_prime_fib | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// prime_fib returns n-th number that is a Fibonacci number and it's also prime.
// >>> primeFib((1l))
// (2l)
// >>> primeFib((2l))
// (3l)
// >>> primeFib((3l))
// (5l)
// >>> primeFib((4l))
// (13l)
// >>> primeFib((5l))
// (89l)
public static long primeFib(long n) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_39_prime_fib.py | reworded | }
public static void main(String[] args) {
assert(primeFib((1l)) == (2l));
assert(primeFib((2l)) == (3l));
assert(primeFib((3l)) == (5l));
assert(primeFib((4l)) == (13l));
assert(primeFib((5l)) == (89l));
assert(primeFib((6l)) == (233l));
assert(primeFib((7l)) == (1597l));
assert(primeFib((8l)) == (28657l));
assert(primeFib((9l)) == (514229l));
assert(primeFib((10l)) == (433494437l));
}
}
| [
"\n }\n"
] |
HumanEval_40_triples_sum_to_zero | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// triples_sum_to_zero takes an array array list of integers as an input.
// it returns true if there are three distinct elements in the array list that
// sum to zero, and false otherwise.
// >>> triplesSumToZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)3l, (long)5l, (long)0l))))
// (false)
// >>> triplesSumToZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)3l, (long)-2l, (long)1l))))
// (true)
// >>> triplesSumToZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)7l))))
// (false)
// >>> triplesSumToZero((new ArrayList<Long>(Arrays.asList((long)2l, (long)4l, (long)-5l, (long)3l, (long)9l, (long)7l))))
// (true)
// >>> triplesSumToZero((new ArrayList<Long>(Arrays.asList((long)1l))))
// (false)
public static boolean triplesSumToZero(ArrayList<Long> l) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_40_triples_sum_to_zero.py | reworded | }
public static void main(String[] args) {
assert(triplesSumToZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)3l, (long)5l, (long)0l)))) == (false));
assert(triplesSumToZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)3l, (long)5l, (long)-1l)))) == (false));
assert(triplesSumToZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)3l, (long)-2l, (long)1l)))) == (true));
assert(triplesSumToZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)7l)))) == (false));
assert(triplesSumToZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)5l, (long)7l)))) == (false));
assert(triplesSumToZero((new ArrayList<Long>(Arrays.asList((long)2l, (long)4l, (long)-5l, (long)3l, (long)9l, (long)7l)))) == (true));
assert(triplesSumToZero((new ArrayList<Long>(Arrays.asList((long)1l)))) == (false));
assert(triplesSumToZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)3l, (long)5l, (long)-100l)))) == (false));
assert(triplesSumToZero((new ArrayList<Long>(Arrays.asList((long)100l, (long)3l, (long)5l, (long)-100l)))) == (false));
}
}
| [
"\n }\n"
] |
HumanEval_41_car_race_collision | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// 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 moving left to right hits a car that's moving right to left.
// However, the cars are infinitely sturdy and strong; as a result, they continue moving
// in their trajectory as if they did not collide.
// This function outputs the number of such collisions.
public static long carRaceCollision(long n) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_41_car_race_collision.py | reworded | }
public static void main(String[] args) {
assert(carRaceCollision((2l)) == (4l));
assert(carRaceCollision((3l)) == (9l));
assert(carRaceCollision((4l)) == (16l));
assert(carRaceCollision((8l)) == (64l));
assert(carRaceCollision((10l)) == (100l));
}
}
| [
"\n }\n"
] |
HumanEval_42_incr_list | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Return array list with elements incremented by 1.
// >>> incrList((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l))))
// (new ArrayList<Long>(Arrays.asList((long)2l, (long)3l, (long)4l)))
// >>> incrList((new ArrayList<Long>(Arrays.asList((long)5l, (long)3l, (long)5l, (long)2l, (long)3l, (long)3l, (long)9l, (long)0l, (long)123l))))
// (new ArrayList<Long>(Arrays.asList((long)6l, (long)4l, (long)6l, (long)3l, (long)4l, (long)4l, (long)10l, (long)1l, (long)124l)))
public static ArrayList<Long> incrList(ArrayList<Long> l) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_42_incr_list.py | reworded | }
public static void main(String[] args) {
assert(incrList((new ArrayList<Long>(Arrays.asList()))).equals((new ArrayList<Long>(Arrays.asList()))));
assert(incrList((new ArrayList<Long>(Arrays.asList((long)3l, (long)2l, (long)1l)))).equals((new ArrayList<Long>(Arrays.asList((long)4l, (long)3l, (long)2l)))));
assert(incrList((new ArrayList<Long>(Arrays.asList((long)5l, (long)2l, (long)5l, (long)2l, (long)3l, (long)3l, (long)9l, (long)0l, (long)123l)))).equals((new ArrayList<Long>(Arrays.asList((long)6l, (long)3l, (long)6l, (long)3l, (long)4l, (long)4l, (long)10l, (long)1l, (long)124l)))));
}
}
| [
"\n }\n"
] |
HumanEval_43_pairs_sum_to_zero | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// pairs_sum_to_zero takes an array array list of integers as an input.
// it returns true if there are two distinct elements in the array list that
// sum to zero, and false otherwise.
// >>> pairsSumToZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)3l, (long)5l, (long)0l))))
// (false)
// >>> pairsSumToZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)3l, (long)-2l, (long)1l))))
// (false)
// >>> pairsSumToZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)7l))))
// (false)
// >>> pairsSumToZero((new ArrayList<Long>(Arrays.asList((long)2l, (long)4l, (long)-5l, (long)3l, (long)5l, (long)7l))))
// (true)
// >>> pairsSumToZero((new ArrayList<Long>(Arrays.asList((long)1l))))
// (false)
public static boolean pairsSumToZero(ArrayList<Long> l) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_43_pairs_sum_to_zero.py | reworded | }
public static void main(String[] args) {
assert(pairsSumToZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)3l, (long)5l, (long)0l)))) == (false));
assert(pairsSumToZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)3l, (long)-2l, (long)1l)))) == (false));
assert(pairsSumToZero((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)7l)))) == (false));
assert(pairsSumToZero((new ArrayList<Long>(Arrays.asList((long)2l, (long)4l, (long)-5l, (long)3l, (long)5l, (long)7l)))) == (true));
assert(pairsSumToZero((new ArrayList<Long>(Arrays.asList((long)1l)))) == (false));
assert(pairsSumToZero((new ArrayList<Long>(Arrays.asList((long)-3l, (long)9l, (long)-1l, (long)3l, (long)2l, (long)30l)))) == (true));
assert(pairsSumToZero((new ArrayList<Long>(Arrays.asList((long)-3l, (long)9l, (long)-1l, (long)3l, (long)2l, (long)31l)))) == (true));
assert(pairsSumToZero((new ArrayList<Long>(Arrays.asList((long)-3l, (long)9l, (long)-1l, (long)4l, (long)2l, (long)30l)))) == (false));
assert(pairsSumToZero((new ArrayList<Long>(Arrays.asList((long)-3l, (long)9l, (long)-1l, (long)4l, (long)2l, (long)31l)))) == (false));
}
}
| [
"\n }\n"
] |
HumanEval_44_change_base | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Change numerical base of input number x to base.
// return string representation after the conversion.
// base numbers are less than 10.
// >>> changeBase((8l), (3l))
// ("22")
// >>> changeBase((8l), (2l))
// ("1000")
// >>> changeBase((7l), (2l))
// ("111")
public static String changeBase(long x, long base) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_44_change_base.py | reworded | }
public static void main(String[] args) {
assert(changeBase((8l), (3l)).equals(("22")));
assert(changeBase((9l), (3l)).equals(("100")));
assert(changeBase((234l), (2l)).equals(("11101010")));
assert(changeBase((16l), (2l)).equals(("10000")));
assert(changeBase((8l), (2l)).equals(("1000")));
assert(changeBase((7l), (2l)).equals(("111")));
assert(changeBase((2l), (3l)).equals(("2")));
assert(changeBase((3l), (4l)).equals(("3")));
assert(changeBase((4l), (5l)).equals(("4")));
assert(changeBase((5l), (6l)).equals(("5")));
assert(changeBase((6l), (7l)).equals(("6")));
assert(changeBase((7l), (8l)).equals(("7")));
}
}
| [
"\n }\n"
] |
HumanEval_45_triangle_area | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given length of a side and high return area for a triangle.
// >>> triangleArea((5l), (3l))
// (7.5f)
public static float triangleArea(long a, long h) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_45_triangle_area.py | reworded | }
public static void main(String[] args) {
assert(triangleArea((5l), (3l)) == (7.5f));
assert(triangleArea((2l), (2l)) == (2.0f));
assert(triangleArea((10l), (8l)) == (40.0f));
}
}
| [
"\n }\n"
] |
HumanEval_46_fib4 | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fib4(0) -> 0
// fib4(1) -> 0
// fib4(2) -> 2
// fib4(3) -> 0
// fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).
// Please write a function to efficiently compute the n-th element of the fib4 number sequence. Do not use recursion.
// >>> fib4((5l))
// (4l)
// >>> fib4((6l))
// (8l)
// >>> fib4((7l))
// (14l)
public static long fib4(long n) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_46_fib4.py | reworded | }
public static void main(String[] args) {
assert(fib4((5l)) == (4l));
assert(fib4((8l)) == (28l));
assert(fib4((10l)) == (104l));
assert(fib4((12l)) == (386l));
}
}
| [
"\n }\n"
] |
HumanEval_47_median | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Return median of elements in the array list l.
// >>> median((new ArrayList<Long>(Arrays.asList((long)3l, (long)1l, (long)2l, (long)4l, (long)5l))))
// (float)3l
// >>> median((new ArrayList<Long>(Arrays.asList((long)-10l, (long)4l, (long)6l, (long)1000l, (long)10l, (long)20l))))
// (15.0f)
public static float median(ArrayList<Long> l) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_47_median.py | reworded | }
public static void main(String[] args) {
assert(median((new ArrayList<Long>(Arrays.asList((long)3l, (long)1l, (long)2l, (long)4l, (long)5l)))) == (float)3l);
assert(median((new ArrayList<Long>(Arrays.asList((long)-10l, (long)4l, (long)6l, (long)1000l, (long)10l, (long)20l)))) == (8.0f));
assert(median((new ArrayList<Long>(Arrays.asList((long)5l)))) == (float)5l);
assert(median((new ArrayList<Long>(Arrays.asList((long)6l, (long)5l)))) == (5.5f));
assert(median((new ArrayList<Long>(Arrays.asList((long)8l, (long)1l, (long)3l, (long)9l, (long)9l, (long)2l, (long)7l)))) == (float)7l);
}
}
| [
"\n }\n"
] |
HumanEval_48_is_palindrome | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Checks if given string is a palindrome
// >>> isPalindrome((""))
// (true)
// >>> isPalindrome(("aba"))
// (true)
// >>> isPalindrome(("aaaaa"))
// (true)
// >>> isPalindrome(("zbcd"))
// (false)
public static boolean isPalindrome(String text) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_48_is_palindrome.py | reworded | }
public static void main(String[] args) {
assert(isPalindrome(("")) == (true));
assert(isPalindrome(("aba")) == (true));
assert(isPalindrome(("aaaaa")) == (true));
assert(isPalindrome(("zbcd")) == (false));
assert(isPalindrome(("xywyx")) == (true));
assert(isPalindrome(("xywyz")) == (false));
assert(isPalindrome(("xywzx")) == (false));
}
}
| [
"\n }\n"
] |
HumanEval_49_modp | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Return 2^n modulo p (be aware of numerics).
// >>> modp((3l), (5l))
// (3l)
// >>> modp((1101l), (101l))
// (2l)
// >>> modp((0l), (101l))
// (1l)
// >>> modp((3l), (11l))
// (8l)
// >>> modp((100l), (101l))
// (1l)
public static long modp(long n, long p) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_49_modp.py | reworded | }
public static void main(String[] args) {
assert(modp((3l), (5l)) == (3l));
assert(modp((1101l), (101l)) == (2l));
assert(modp((0l), (101l)) == (1l));
assert(modp((3l), (11l)) == (8l));
assert(modp((100l), (101l)) == (1l));
assert(modp((30l), (5l)) == (4l));
assert(modp((31l), (5l)) == (3l));
}
}
| [
"\n }\n"
] |
HumanEval_51_remove_vowels | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// remove_vowels is a function that takes string and returns string without vowels.
// >>> removeVowels((""))
// ("")
// >>> removeVowels(("abcdef"))
// ("bcdf")
// >>> removeVowels(("aaaaa"))
// ("")
// >>> removeVowels(("aaBAA"))
// ("B")
// >>> removeVowels(("zbcd"))
// ("zbcd")
public static String removeVowels(String text) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_51_remove_vowels.py | reworded | }
public static void main(String[] args) {
assert(removeVowels(("")).equals(("")));
assert(removeVowels(("abcdef\nghijklm")).equals(("bcdf\nghjklm")));
assert(removeVowels(("fedcba")).equals(("fdcb")));
assert(removeVowels(("eeeee")).equals(("")));
assert(removeVowels(("acBAA")).equals(("cB")));
assert(removeVowels(("EcBOO")).equals(("cB")));
assert(removeVowels(("ybcd")).equals(("ybcd")));
}
}
| [
"\n }\n"
] |
HumanEval_52_below_threshold | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Return true if all numbers in the array list l are below threshold t.
// >>> belowThreshold((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)4l, (long)10l))), (100l))
// (true)
// >>> belowThreshold((new ArrayList<Long>(Arrays.asList((long)1l, (long)20l, (long)4l, (long)10l))), (5l))
// (false)
public static boolean belowThreshold(ArrayList<Long> l, long t) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_52_below_threshold.py | reworded | }
public static void main(String[] args) {
assert(belowThreshold((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)4l, (long)10l))), (100l)) == (true));
assert(belowThreshold((new ArrayList<Long>(Arrays.asList((long)1l, (long)20l, (long)4l, (long)10l))), (5l)) == (false));
assert(belowThreshold((new ArrayList<Long>(Arrays.asList((long)1l, (long)20l, (long)4l, (long)10l))), (21l)) == (true));
assert(belowThreshold((new ArrayList<Long>(Arrays.asList((long)1l, (long)20l, (long)4l, (long)10l))), (22l)) == (true));
assert(belowThreshold((new ArrayList<Long>(Arrays.asList((long)1l, (long)8l, (long)4l, (long)10l))), (11l)) == (true));
assert(belowThreshold((new ArrayList<Long>(Arrays.asList((long)1l, (long)8l, (long)4l, (long)10l))), (10l)) == (false));
}
}
| [
"\n }\n"
] |
HumanEval_53_add | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Add two numbers x and y
// >>> add((2l), (3l))
// (5l)
// >>> add((5l), (7l))
// (12l)
public static long add(long x, long y) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_53_add.py | reworded | }
public static void main(String[] args) {
assert(add((0l), (1l)) == (1l));
assert(add((1l), (0l)) == (1l));
assert(add((2l), (3l)) == (5l));
assert(add((5l), (7l)) == (12l));
assert(add((7l), (5l)) == (12l));
}
}
| [
"\n }\n"
] |
HumanEval_54_same_chars | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Check if two words have the same characters.
// >>> sameChars(("eabcdzzzz"), ("dddzzzzzzzddeddabc"))
// (true)
// >>> sameChars(("abcd"), ("dddddddabc"))
// (true)
// >>> sameChars(("dddddddabc"), ("abcd"))
// (true)
// >>> sameChars(("eabcd"), ("dddddddabc"))
// (false)
// >>> sameChars(("abcd"), ("dddddddabce"))
// (false)
// >>> sameChars(("eabcdzzzz"), ("dddzzzzzzzddddabc"))
// (false)
public static boolean sameChars(String s0, String s1) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_54_same_chars.py | reworded | }
public static void main(String[] args) {
assert(sameChars(("eabcdzzzz"), ("dddzzzzzzzddeddabc")) == (true));
assert(sameChars(("abcd"), ("dddddddabc")) == (true));
assert(sameChars(("dddddddabc"), ("abcd")) == (true));
assert(sameChars(("eabcd"), ("dddddddabc")) == (false));
assert(sameChars(("abcd"), ("dddddddabcf")) == (false));
assert(sameChars(("eabcdzzzz"), ("dddzzzzzzzddddabc")) == (false));
assert(sameChars(("aabb"), ("aaccc")) == (false));
}
}
| [
"\n }\n"
] |
HumanEval_55_fib | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Return n-th Fibonacci number.
// >>> fib((10l))
// (55l)
// >>> fib((1l))
// (1l)
// >>> fib((8l))
// (21l)
public static long fib(long n) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_55_fib.py | reworded | }
public static void main(String[] args) {
assert(fib((10l)) == (55l));
assert(fib((1l)) == (1l));
assert(fib((8l)) == (21l));
assert(fib((11l)) == (89l));
assert(fib((12l)) == (144l));
}
}
| [
"\n }\n"
] |
HumanEval_56_correct_bracketing | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// brackets is a string of "<" and ">".
// return true if every opening bracket has a corresponding closing bracket.
// >>> correctBracketing(("<"))
// (false)
// >>> correctBracketing(("<>"))
// (true)
// >>> correctBracketing(("<<><>>"))
// (true)
// >>> correctBracketing(("><<>"))
// (false)
public static boolean correctBracketing(String brackets) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_56_correct_bracketing.py | reworded | }
public static void main(String[] args) {
assert(correctBracketing(("<>")) == (true));
assert(correctBracketing(("<<><>>")) == (true));
assert(correctBracketing(("<><><<><>><>")) == (true));
assert(correctBracketing(("<><><<<><><>><>><<><><<>>>")) == (true));
assert(correctBracketing(("<<<><>>>>")) == (false));
assert(correctBracketing(("><<>")) == (false));
assert(correctBracketing(("<")) == (false));
assert(correctBracketing(("<<<<")) == (false));
assert(correctBracketing((">")) == (false));
assert(correctBracketing(("<<>")) == (false));
assert(correctBracketing(("<><><<><>><>><<>")) == (false));
assert(correctBracketing(("<><><<><>><>>><>")) == (false));
}
}
| [
"\n }\n"
] |
HumanEval_57_monotonic | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Return true is array list elements are monotonically increasing or decreasing.
// >>> monotonic((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)4l, (long)20l))))
// (true)
// >>> monotonic((new ArrayList<Long>(Arrays.asList((long)1l, (long)20l, (long)4l, (long)10l))))
// (false)
// >>> monotonic((new ArrayList<Long>(Arrays.asList((long)4l, (long)1l, (long)0l, (long)-10l))))
// (true)
public static boolean monotonic(ArrayList<Long> l) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_57_monotonic.py | reworded | }
public static void main(String[] args) {
assert(monotonic((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)4l, (long)10l)))) == (true));
assert(monotonic((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)4l, (long)20l)))) == (true));
assert(monotonic((new ArrayList<Long>(Arrays.asList((long)1l, (long)20l, (long)4l, (long)10l)))) == (false));
assert(monotonic((new ArrayList<Long>(Arrays.asList((long)4l, (long)1l, (long)0l, (long)-10l)))) == (true));
assert(monotonic((new ArrayList<Long>(Arrays.asList((long)4l, (long)1l, (long)1l, (long)0l)))) == (true));
assert(monotonic((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)2l, (long)5l, (long)60l)))) == (false));
assert(monotonic((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)5l, (long)60l)))) == (true));
assert(monotonic((new ArrayList<Long>(Arrays.asList((long)9l, (long)9l, (long)9l, (long)9l)))) == (true));
}
}
| [
"\n }\n"
] |
HumanEval_58_common | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Return sorted unique common elements for two array lists.
// >>> common((new ArrayList<Long>(Arrays.asList((long)1l, (long)4l, (long)3l, (long)34l, (long)653l, (long)2l, (long)5l))), (new ArrayList<Long>(Arrays.asList((long)5l, (long)7l, (long)1l, (long)5l, (long)9l, (long)653l, (long)121l))))
// (new ArrayList<Long>(Arrays.asList((long)1l, (long)5l, (long)653l)))
// >>> common((new ArrayList<Long>(Arrays.asList((long)5l, (long)3l, (long)2l, (long)8l))), (new ArrayList<Long>(Arrays.asList((long)3l, (long)2l))))
// (new ArrayList<Long>(Arrays.asList((long)2l, (long)3l)))
public static ArrayList<Long> common(ArrayList<Long> l1, ArrayList<Long> l2) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_58_common.py | reworded | }
public static void main(String[] args) {
assert(common((new ArrayList<Long>(Arrays.asList((long)1l, (long)4l, (long)3l, (long)34l, (long)653l, (long)2l, (long)5l))), (new ArrayList<Long>(Arrays.asList((long)5l, (long)7l, (long)1l, (long)5l, (long)9l, (long)653l, (long)121l)))).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)5l, (long)653l)))));
assert(common((new ArrayList<Long>(Arrays.asList((long)5l, (long)3l, (long)2l, (long)8l))), (new ArrayList<Long>(Arrays.asList((long)3l, (long)2l)))).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)3l)))));
assert(common((new ArrayList<Long>(Arrays.asList((long)4l, (long)3l, (long)2l, (long)8l))), (new ArrayList<Long>(Arrays.asList((long)3l, (long)2l, (long)4l)))).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)3l, (long)4l)))));
assert(common((new ArrayList<Long>(Arrays.asList((long)4l, (long)3l, (long)2l, (long)8l))), (new ArrayList<Long>(Arrays.asList()))).equals((new ArrayList<Long>(Arrays.asList()))));
}
}
| [
"\n }\n"
] |
HumanEval_59_largest_prime_factor | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Return the largest prime factor of n. Assume n > 1 and is not a prime.
// >>> largestPrimeFactor((13195l))
// (29l)
// >>> largestPrimeFactor((2048l))
// (2l)
public static long largestPrimeFactor(long n) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_59_largest_prime_factor.py | reworded | }
public static void main(String[] args) {
assert(largestPrimeFactor((15l)) == (5l));
assert(largestPrimeFactor((27l)) == (3l));
assert(largestPrimeFactor((63l)) == (7l));
assert(largestPrimeFactor((330l)) == (11l));
assert(largestPrimeFactor((13195l)) == (29l));
}
}
| [
"\n }\n"
] |
HumanEval_60_sum_to_n | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// sum_to_n is a function that sums numbers from 1 to n.
// >>> sumToN((30l))
// (465l)
// >>> sumToN((100l))
// (5050l)
// >>> sumToN((5l))
// (15l)
// >>> sumToN((10l))
// (55l)
// >>> sumToN((1l))
// (1l)
public static long sumToN(long n) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_60_sum_to_n.py | reworded | }
public static void main(String[] args) {
assert(sumToN((1l)) == (1l));
assert(sumToN((6l)) == (21l));
assert(sumToN((11l)) == (66l));
assert(sumToN((30l)) == (465l));
assert(sumToN((100l)) == (5050l));
}
}
| [
"\n }\n"
] |
HumanEval_61_correct_bracketing | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// >>> correctBracketing(("("))
// (false)
// >>> correctBracketing(("()"))
// (true)
// >>> correctBracketing(("(()())"))
// (true)
// >>> correctBracketing((")(()"))
// (false)
public static boolean correctBracketing(String brackets) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_61_correct_bracketing.py | reworded | }
public static void main(String[] args) {
assert(correctBracketing(("()")) == (true));
assert(correctBracketing(("(()())")) == (true));
assert(correctBracketing(("()()(()())()")) == (true));
assert(correctBracketing(("()()((()()())())(()()(()))")) == (true));
assert(correctBracketing(("((()())))")) == (false));
assert(correctBracketing((")(()")) == (false));
assert(correctBracketing(("(")) == (false));
assert(correctBracketing(("((((")) == (false));
assert(correctBracketing((")")) == (false));
assert(correctBracketing(("(()")) == (false));
assert(correctBracketing(("()()(()())())(()")) == (false));
assert(correctBracketing(("()()(()())()))()")) == (false));
}
}
| [
"\n }\n"
] |
HumanEval_62_derivative | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 + ....
// Return derivative of this polynomial in the same form.
// >>> derivative((new ArrayList<Long>(Arrays.asList((long)3l, (long)1l, (long)2l, (long)4l, (long)5l))))
// (new ArrayList<Long>(Arrays.asList((long)1l, (long)4l, (long)12l, (long)20l)))
// >>> derivative((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l))))
// (new ArrayList<Long>(Arrays.asList((long)2l, (long)6l)))
public static ArrayList<Long> derivative(ArrayList<Long> xs) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_62_derivative.py | reworded | }
public static void main(String[] args) {
assert(derivative((new ArrayList<Long>(Arrays.asList((long)3l, (long)1l, (long)2l, (long)4l, (long)5l)))).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)4l, (long)12l, (long)20l)))));
assert(derivative((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l)))).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)6l)))));
assert(derivative((new ArrayList<Long>(Arrays.asList((long)3l, (long)2l, (long)1l)))).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)2l)))));
assert(derivative((new ArrayList<Long>(Arrays.asList((long)3l, (long)2l, (long)1l, (long)0l, (long)4l)))).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)2l, (long)0l, (long)16l)))));
assert(derivative((new ArrayList<Long>(Arrays.asList((long)1l)))).equals((new ArrayList<Long>(Arrays.asList()))));
}
}
| [
"\n }\n"
] |
HumanEval_63_fibfib | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fibfib(0) == 0
// fibfib(1) == 0
// fibfib(2) == 1
// fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
// Please write a function to efficiently compute the n-th element of the fibfib number sequence.
// >>> fibfib((1l))
// (0l)
// >>> fibfib((5l))
// (4l)
// >>> fibfib((8l))
// (24l)
public static long fibfib(long n) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_63_fibfib.py | reworded | }
public static void main(String[] args) {
assert(fibfib((2l)) == (1l));
assert(fibfib((1l)) == (0l));
assert(fibfib((5l)) == (4l));
assert(fibfib((8l)) == (24l));
assert(fibfib((10l)) == (81l));
assert(fibfib((12l)) == (274l));
assert(fibfib((14l)) == (927l));
}
}
| [
"\n }\n"
] |
HumanEval_64_vowels_count | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Write a function vowels_count which takes a string representing
// a word as input and returns the number of vowels in the string.
// Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
// vowel, but only when it is at the end of the given word.
// Example:
// >>> vowelsCount(("abcde"))
// (2l)
// >>> vowelsCount(("ACEDY"))
// (3l)
public static long vowelsCount(String s) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_64_vowels_count.py | reworded | }
public static void main(String[] args) {
assert(vowelsCount(("abcde")) == (2l));
assert(vowelsCount(("Alone")) == (3l));
assert(vowelsCount(("key")) == (2l));
assert(vowelsCount(("bye")) == (1l));
assert(vowelsCount(("keY")) == (2l));
assert(vowelsCount(("bYe")) == (1l));
assert(vowelsCount(("ACEDY")) == (3l));
}
}
| [
"\n }\n"
] |
HumanEval_65_circular_shift | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// >>> circularShift((12l), (1l))
// ("21")
// >>> circularShift((12l), (2l))
// ("12")
public static String circularShift(long x, long shift) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_65_circular_shift.py | reworded | }
public static void main(String[] args) {
assert(circularShift((100l), (2l)).equals(("001")));
assert(circularShift((12l), (2l)).equals(("12")));
assert(circularShift((97l), (8l)).equals(("79")));
assert(circularShift((12l), (1l)).equals(("21")));
assert(circularShift((11l), (101l)).equals(("11")));
}
}
| [
"\n }\n"
] |
HumanEval_66_digitSum | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Task
// Write a function that takes a string as input and returns the sum of the upper characters only'
// ASCII codes.
// Examples:
// >>> digitSum((""))
// (0l)
// >>> digitSum(("abAB"))
// (131l)
// >>> digitSum(("abcCd"))
// (67l)
// >>> digitSum(("helloE"))
// (69l)
// >>> digitSum(("woArBld"))
// (131l)
// >>> digitSum(("aAaaaXa"))
// (153l)
public static long digitSum(String s) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_66_digitSum.py | reworded | }
public static void main(String[] args) {
assert(digitSum(("")) == (0l));
assert(digitSum(("abAB")) == (131l));
assert(digitSum(("abcCd")) == (67l));
assert(digitSum(("helloE")) == (69l));
assert(digitSum(("woArBld")) == (131l));
assert(digitSum(("aAaaaXa")) == (153l));
assert(digitSum((" How are yOu?")) == (151l));
assert(digitSum(("You arE Very Smart")) == (327l));
}
}
| [
"\n }\n"
] |
HumanEval_67_fruit_distribution | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// In this task, you will be given a string that represents a number of apples and oranges
// that are distributed in a basket of fruit this basket contains
// apples, oranges, and mango fruits. Given the string that represents the total number of
// the oranges and apples and an integer that represent the total number of the fruits
// in the basket return the number of the mango fruits in the basket.
// for examble:
// >>> fruitDistribution(("5 apples and 6 oranges"), (19l))
// (8l)
// >>> fruitDistribution(("0 apples and 1 oranges"), (3l))
// (2l)
// >>> fruitDistribution(("2 apples and 3 oranges"), (100l))
// (95l)
// >>> fruitDistribution(("100 apples and 1 oranges"), (120l))
// (19l)
public static long fruitDistribution(String s, long n) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_67_fruit_distribution.py | reworded | }
public static void main(String[] args) {
assert(fruitDistribution(("5 apples and 6 oranges"), (19l)) == (8l));
assert(fruitDistribution(("5 apples and 6 oranges"), (21l)) == (10l));
assert(fruitDistribution(("0 apples and 1 oranges"), (3l)) == (2l));
assert(fruitDistribution(("1 apples and 0 oranges"), (3l)) == (2l));
assert(fruitDistribution(("2 apples and 3 oranges"), (100l)) == (95l));
assert(fruitDistribution(("2 apples and 3 oranges"), (5l)) == (0l));
assert(fruitDistribution(("1 apples and 100 oranges"), (120l)) == (19l));
}
}
| [
"\n }\n"
] |
HumanEval_68_pluck | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// "Given an array array list representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array array list, [ smalest_value, its index ],
// If there are no even values or the given array array list is empty, return [].
// Example 1:
// >>> pluck((new ArrayList<Long>(Arrays.asList((long)4l, (long)2l, (long)3l))))
// (new ArrayList<Long>(Arrays.asList((long)2l, (long)1l)))
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// >>> pluck((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l))))
// (new ArrayList<Long>(Arrays.asList((long)2l, (long)1l)))
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// >>> pluck((new ArrayList<Long>(Arrays.asList())))
// (new ArrayList<Long>(Arrays.asList()))
// Example 4:
// >>> pluck((new ArrayList<Long>(Arrays.asList((long)5l, (long)0l, (long)3l, (long)0l, (long)4l, (long)2l))))
// (new ArrayList<Long>(Arrays.asList((long)0l, (long)1l)))
// Explanation: 0 is the smallest value, but there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
public static ArrayList<Long> pluck(ArrayList<Long> arr) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_68_pluck.py | reworded | }
public static void main(String[] args) {
assert(pluck((new ArrayList<Long>(Arrays.asList((long)4l, (long)2l, (long)3l)))).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)1l)))));
assert(pluck((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l)))).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)1l)))));
assert(pluck((new ArrayList<Long>(Arrays.asList()))).equals((new ArrayList<Long>(Arrays.asList()))));
assert(pluck((new ArrayList<Long>(Arrays.asList((long)5l, (long)0l, (long)3l, (long)0l, (long)4l, (long)2l)))).equals((new ArrayList<Long>(Arrays.asList((long)0l, (long)1l)))));
assert(pluck((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)0l, (long)5l, (long)3l)))).equals((new ArrayList<Long>(Arrays.asList((long)0l, (long)3l)))));
assert(pluck((new ArrayList<Long>(Arrays.asList((long)5l, (long)4l, (long)8l, (long)4l, (long)8l)))).equals((new ArrayList<Long>(Arrays.asList((long)4l, (long)1l)))));
assert(pluck((new ArrayList<Long>(Arrays.asList((long)7l, (long)6l, (long)7l, (long)1l)))).equals((new ArrayList<Long>(Arrays.asList((long)6l, (long)1l)))));
assert(pluck((new ArrayList<Long>(Arrays.asList((long)7l, (long)9l, (long)7l, (long)1l)))).equals((new ArrayList<Long>(Arrays.asList()))));
}
}
| [
"\n }\n"
] |
HumanEval_69_search | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// You are given a non-empty array list of positive integers. Return the greatest integer that is greater than
// zero, and has a frequency greater than or equal to the value of the integer itself.
// The frequency of an integer is the number of times it appears in the array list.
// If no such a value exist, return -1.
// Examples:
// >>> search((new ArrayList<Long>(Arrays.asList((long)4l, (long)1l, (long)2l, (long)2l, (long)3l, (long)1l))))
// (2l)
// >>> search((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)2l, (long)3l, (long)3l, (long)3l, (long)4l, (long)4l, (long)4l))))
// (3l)
// >>> search((new ArrayList<Long>(Arrays.asList((long)5l, (long)5l, (long)4l, (long)4l, (long)4l))))
// (-1l)
public static long search(ArrayList<Long> lst) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_69_search.py | reworded | }
public static void main(String[] args) {
assert(search((new ArrayList<Long>(Arrays.asList((long)5l, (long)5l, (long)5l, (long)5l, (long)1l)))) == (1l));
assert(search((new ArrayList<Long>(Arrays.asList((long)4l, (long)1l, (long)4l, (long)1l, (long)4l, (long)4l)))) == (4l));
assert(search((new ArrayList<Long>(Arrays.asList((long)3l, (long)3l)))) == (-1l));
assert(search((new ArrayList<Long>(Arrays.asList((long)8l, (long)8l, (long)8l, (long)8l, (long)8l, (long)8l, (long)8l, (long)8l)))) == (8l));
assert(search((new ArrayList<Long>(Arrays.asList((long)2l, (long)3l, (long)3l, (long)2l, (long)2l)))) == (2l));
assert(search((new ArrayList<Long>(Arrays.asList((long)2l, (long)7l, (long)8l, (long)8l, (long)4l, (long)8l, (long)7l, (long)3l, (long)9l, (long)6l, (long)5l, (long)10l, (long)4l, (long)3l, (long)6l, (long)7l, (long)1l, (long)7l, (long)4l, (long)10l, (long)8l, (long)1l)))) == (1l));
assert(search((new ArrayList<Long>(Arrays.asList((long)3l, (long)2l, (long)8l, (long)2l)))) == (2l));
assert(search((new ArrayList<Long>(Arrays.asList((long)6l, (long)7l, (long)1l, (long)8l, (long)8l, (long)10l, (long)5l, (long)8l, (long)5l, (long)3l, (long)10l)))) == (1l));
assert(search((new ArrayList<Long>(Arrays.asList((long)8l, (long)8l, (long)3l, (long)6l, (long)5l, (long)6l, (long)4l)))) == (-1l));
assert(search((new ArrayList<Long>(Arrays.asList((long)6l, (long)9l, (long)6l, (long)7l, (long)1l, (long)4l, (long)7l, (long)1l, (long)8l, (long)8l, (long)9l, (long)8l, (long)10l, (long)10l, (long)8l, (long)4l, (long)10l, (long)4l, (long)10l, (long)1l, (long)2l, (long)9l, (long)5l, (long)7l, (long)9l)))) == (1l));
assert(search((new ArrayList<Long>(Arrays.asList((long)1l, (long)9l, (long)10l, (long)1l, (long)3l)))) == (1l));
assert(search((new ArrayList<Long>(Arrays.asList((long)6l, (long)9l, (long)7l, (long)5l, (long)8l, (long)7l, (long)5l, (long)3l, (long)7l, (long)5l, (long)10l, (long)10l, (long)3l, (long)6l, (long)10l, (long)2l, (long)8l, (long)6l, (long)5l, (long)4l, (long)9l, (long)5l, (long)3l, (long)10l)))) == (5l));
assert(search((new ArrayList<Long>(Arrays.asList((long)1l)))) == (1l));
assert(search((new ArrayList<Long>(Arrays.asList((long)8l, (long)8l, (long)10l, (long)6l, (long)4l, (long)3l, (long)5l, (long)8l, (long)2l, (long)4l, (long)2l, (long)8l, (long)4l, (long)6l, (long)10l, (long)4l, (long)2l, (long)1l, (long)10l, (long)2l, (long)1l, (long)1l, (long)5l)))) == (4l));
assert(search((new ArrayList<Long>(Arrays.asList((long)2l, (long)10l, (long)4l, (long)8l, (long)2l, (long)10l, (long)5l, (long)1l, (long)2l, (long)9l, (long)5l, (long)5l, (long)6l, (long)3l, (long)8l, (long)6l, (long)4l, (long)10l)))) == (2l));
assert(search((new ArrayList<Long>(Arrays.asList((long)1l, (long)6l, (long)10l, (long)1l, (long)6l, (long)9l, (long)10l, (long)8l, (long)6l, (long)8l, (long)7l, (long)3l)))) == (1l));
assert(search((new ArrayList<Long>(Arrays.asList((long)9l, (long)2l, (long)4l, (long)1l, (long)5l, (long)1l, (long)5l, (long)2l, (long)5l, (long)7l, (long)7l, (long)7l, (long)3l, (long)10l, (long)1l, (long)5l, (long)4l, (long)2l, (long)8l, (long)4l, (long)1l, (long)9l, (long)10l, (long)7l, (long)10l, (long)2l, (long)8l, (long)10l, (long)9l, (long)4l)))) == (4l));
assert(search((new ArrayList<Long>(Arrays.asList((long)2l, (long)6l, (long)4l, (long)2l, (long)8l, (long)7l, (long)5l, (long)6l, (long)4l, (long)10l, (long)4l, (long)6l, (long)3l, (long)7l, (long)8l, (long)8l, (long)3l, (long)1l, (long)4l, (long)2l, (long)2l, (long)10l, (long)7l)))) == (4l));
assert(search((new ArrayList<Long>(Arrays.asList((long)9l, (long)8l, (long)6l, (long)10l, (long)2l, (long)6l, (long)10l, (long)2l, (long)7l, (long)8l, (long)10l, (long)3l, (long)8l, (long)2l, (long)6l, (long)2l, (long)3l, (long)1l)))) == (2l));
assert(search((new ArrayList<Long>(Arrays.asList((long)5l, (long)5l, (long)3l, (long)9l, (long)5l, (long)6l, (long)3l, (long)2l, (long)8l, (long)5l, (long)6l, (long)10l, (long)10l, (long)6l, (long)8l, (long)4l, (long)10l, (long)7l, (long)7l, (long)10l, (long)8l)))) == (-1l));
assert(search((new ArrayList<Long>(Arrays.asList((long)10l)))) == (-1l));
assert(search((new ArrayList<Long>(Arrays.asList((long)9l, (long)7l, (long)7l, (long)2l, (long)4l, (long)7l, (long)2l, (long)10l, (long)9l, (long)7l, (long)5l, (long)7l, (long)2l)))) == (2l));
assert(search((new ArrayList<Long>(Arrays.asList((long)5l, (long)4l, (long)10l, (long)2l, (long)1l, (long)1l, (long)10l, (long)3l, (long)6l, (long)1l, (long)8l)))) == (1l));
assert(search((new ArrayList<Long>(Arrays.asList((long)7l, (long)9l, (long)9l, (long)9l, (long)3l, (long)4l, (long)1l, (long)5l, (long)9l, (long)1l, (long)2l, (long)1l, (long)1l, (long)10l, (long)7l, (long)5l, (long)6l, (long)7l, (long)6l, (long)7l, (long)7l, (long)6l)))) == (1l));
assert(search((new ArrayList<Long>(Arrays.asList((long)3l, (long)10l, (long)10l, (long)9l, (long)2l)))) == (-1l));
}
}
| [
"\n }\n"
] |
HumanEval_70_strange_sort_list | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given array list of integers, return array list in strange order.
// Strange sorting, is when you start with the minimum value,
// then maximum of the remaining integers, then minimum and so on.
// Examples:
// >>> strangeSortList((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l))))
// (new ArrayList<Long>(Arrays.asList((long)1l, (long)4l, (long)2l, (long)3l)))
// >>> strangeSortList((new ArrayList<Long>(Arrays.asList((long)5l, (long)5l, (long)5l, (long)5l))))
// (new ArrayList<Long>(Arrays.asList((long)5l, (long)5l, (long)5l, (long)5l)))
// >>> strangeSortList((new ArrayList<Long>(Arrays.asList())))
// (new ArrayList<Long>(Arrays.asList()))
public static ArrayList<Long> strangeSortList(ArrayList<Long> lst) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_70_strange_sort_list.py | reworded | }
public static void main(String[] args) {
assert(strangeSortList((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l)))).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)4l, (long)2l, (long)3l)))));
assert(strangeSortList((new ArrayList<Long>(Arrays.asList((long)5l, (long)6l, (long)7l, (long)8l, (long)9l)))).equals((new ArrayList<Long>(Arrays.asList((long)5l, (long)9l, (long)6l, (long)8l, (long)7l)))));
assert(strangeSortList((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)5l)))).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)5l, (long)2l, (long)4l, (long)3l)))));
assert(strangeSortList((new ArrayList<Long>(Arrays.asList((long)5l, (long)6l, (long)7l, (long)8l, (long)9l, (long)1l)))).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)9l, (long)5l, (long)8l, (long)6l, (long)7l)))));
assert(strangeSortList((new ArrayList<Long>(Arrays.asList((long)5l, (long)5l, (long)5l, (long)5l)))).equals((new ArrayList<Long>(Arrays.asList((long)5l, (long)5l, (long)5l, (long)5l)))));
assert(strangeSortList((new ArrayList<Long>(Arrays.asList()))).equals((new ArrayList<Long>(Arrays.asList()))));
assert(strangeSortList((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)5l, (long)6l, (long)7l, (long)8l)))).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)8l, (long)2l, (long)7l, (long)3l, (long)6l, (long)4l, (long)5l)))));
assert(strangeSortList((new ArrayList<Long>(Arrays.asList((long)0l, (long)2l, (long)2l, (long)2l, (long)5l, (long)5l, (long)-5l, (long)-5l)))).equals((new ArrayList<Long>(Arrays.asList((long)-5l, (long)5l, (long)-5l, (long)5l, (long)0l, (long)2l, (long)2l, (long)2l)))));
assert(strangeSortList((new ArrayList<Long>(Arrays.asList((long)111111l)))).equals((new ArrayList<Long>(Arrays.asList((long)111111l)))));
}
}
| [
"\n }\n"
] |
HumanEval_71_triangle_area | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given the lengths of the three sides of a triangle. Return the area of
// the triangle rounded to 2 decimal points if the three sides form a valid triangle.
// Otherwise return -1
// Three sides make a valid triangle when the sum of any two sides is greater
// than the third side.
// Example:
// >>> triangleArea((3l), (4l), (5l))
// (6.0f)
// >>> triangleArea((1l), (2l), (10l))
// (float)-1l
public static float triangleArea(long a, long b, long c) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_71_triangle_area.py | reworded | }
public static void main(String[] args) {
assert(triangleArea((3l), (4l), (5l)) == (6.0f));
assert(triangleArea((1l), (2l), (10l)) == (float)-1l);
assert(triangleArea((4l), (8l), (5l)) == (8.18f));
assert(triangleArea((2l), (2l), (2l)) == (1.73f));
assert(triangleArea((1l), (2l), (3l)) == (float)-1l);
assert(triangleArea((10l), (5l), (7l)) == (16.25f));
assert(triangleArea((2l), (6l), (3l)) == (float)-1l);
assert(triangleArea((1l), (1l), (1l)) == (0.43f));
assert(triangleArea((2l), (2l), (10l)) == (float)-1l);
}
}
| [
"\n }\n"
] |
HumanEval_72_will_it_fly | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Write a function that returns true if the object q will fly, and false otherwise.
// The object q will fly if it's balanced (it is a palindromic array list) and the sum of its elements is less than or equal the maximum possible weight w.
// Example:
// >>> willItFly((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l))), (5l))
// (false)
// # 1+2 is less than the maximum possible weight, but it's unbalanced.
// >>> willItFly((new ArrayList<Long>(Arrays.asList((long)3l, (long)2l, (long)3l))), (1l))
// (false)
// # it's balanced, but 3+2+3 is more than the maximum possible weight.
// >>> willItFly((new ArrayList<Long>(Arrays.asList((long)3l, (long)2l, (long)3l))), (9l))
// (true)
// # 3+2+3 is less than the maximum possible weight, and it's balanced.
// >>> willItFly((new ArrayList<Long>(Arrays.asList((long)3l))), (5l))
// (true)
// # 3 is less than the maximum possible weight, and it's balanced.
public static boolean willItFly(ArrayList<Long> q, long w) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_72_will_it_fly.py | reworded | }
public static void main(String[] args) {
assert(willItFly((new ArrayList<Long>(Arrays.asList((long)3l, (long)2l, (long)3l))), (9l)) == (true));
assert(willItFly((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l))), (5l)) == (false));
assert(willItFly((new ArrayList<Long>(Arrays.asList((long)3l))), (5l)) == (true));
assert(willItFly((new ArrayList<Long>(Arrays.asList((long)3l, (long)2l, (long)3l))), (1l)) == (false));
assert(willItFly((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l))), (6l)) == (false));
assert(willItFly((new ArrayList<Long>(Arrays.asList((long)5l))), (5l)) == (true));
}
}
| [
"\n }\n"
] |
HumanEval_73_smallest_change | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given an array array list arr of integers, find the minimum number of elements that
// need to be changed to make the array array list palindromic. A palindromic array array list is an array array list that
// is read the same backwards and forwards. In one change, you can change one element to any other element.
// For example:
// >>> smallestChange((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)5l, (long)4l, (long)7l, (long)9l, (long)6l))))
// (4l)
// >>> smallestChange((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)3l, (long)2l, (long)2l))))
// (1l)
// >>> smallestChange((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)2l, (long)1l))))
// (0l)
public static long smallestChange(ArrayList<Long> arr) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_73_smallest_change.py | reworded | }
public static void main(String[] args) {
assert(smallestChange((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)5l, (long)4l, (long)7l, (long)9l, (long)6l)))) == (4l));
assert(smallestChange((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)3l, (long)2l, (long)2l)))) == (1l));
assert(smallestChange((new ArrayList<Long>(Arrays.asList((long)1l, (long)4l, (long)2l)))) == (1l));
assert(smallestChange((new ArrayList<Long>(Arrays.asList((long)1l, (long)4l, (long)4l, (long)2l)))) == (1l));
assert(smallestChange((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)2l, (long)1l)))) == (0l));
assert(smallestChange((new ArrayList<Long>(Arrays.asList((long)3l, (long)1l, (long)1l, (long)3l)))) == (0l));
assert(smallestChange((new ArrayList<Long>(Arrays.asList((long)1l)))) == (0l));
assert(smallestChange((new ArrayList<Long>(Arrays.asList((long)0l, (long)1l)))) == (1l));
}
}
| [
"\n }\n"
] |
HumanEval_74_total_match | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Write a function that accepts two array lists of strings and returns the array list that has
// total number of chars in the all strings of the array list less than the other array list.
// if the two array lists have the same number of chars, return the first array list.
// Examples
// >>> totalMatch((new ArrayList<String>(Arrays.asList())), (new ArrayList<String>(Arrays.asList())))
// (new ArrayList<String>(Arrays.asList()))
// >>> totalMatch((new ArrayList<String>(Arrays.asList((String)"hi", (String)"admin"))), (new ArrayList<String>(Arrays.asList((String)"hI", (String)"Hi"))))
// (new ArrayList<String>(Arrays.asList((String)"hI", (String)"Hi")))
// >>> totalMatch((new ArrayList<String>(Arrays.asList((String)"hi", (String)"admin"))), (new ArrayList<String>(Arrays.asList((String)"hi", (String)"hi", (String)"admin", (String)"project"))))
// (new ArrayList<String>(Arrays.asList((String)"hi", (String)"admin")))
// >>> totalMatch((new ArrayList<String>(Arrays.asList((String)"hi", (String)"admin"))), (new ArrayList<String>(Arrays.asList((String)"hI", (String)"hi", (String)"hi"))))
// (new ArrayList<String>(Arrays.asList((String)"hI", (String)"hi", (String)"hi")))
// >>> totalMatch((new ArrayList<String>(Arrays.asList((String)"4"))), (new ArrayList<String>(Arrays.asList((String)"1", (String)"2", (String)"3", (String)"4", (String)"5"))))
// (new ArrayList<String>(Arrays.asList((String)"4")))
public static ArrayList<String> totalMatch(ArrayList<String> lst1, ArrayList<String> lst2) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_74_total_match.py | reworded | }
public static void main(String[] args) {
assert(totalMatch((new ArrayList<String>(Arrays.asList())), (new ArrayList<String>(Arrays.asList()))).equals((new ArrayList<String>(Arrays.asList()))));
assert(totalMatch((new ArrayList<String>(Arrays.asList((String)"hi", (String)"admin"))), (new ArrayList<String>(Arrays.asList((String)"hi", (String)"hi")))).equals((new ArrayList<String>(Arrays.asList((String)"hi", (String)"hi")))));
assert(totalMatch((new ArrayList<String>(Arrays.asList((String)"hi", (String)"admin"))), (new ArrayList<String>(Arrays.asList((String)"hi", (String)"hi", (String)"admin", (String)"project")))).equals((new ArrayList<String>(Arrays.asList((String)"hi", (String)"admin")))));
assert(totalMatch((new ArrayList<String>(Arrays.asList((String)"4"))), (new ArrayList<String>(Arrays.asList((String)"1", (String)"2", (String)"3", (String)"4", (String)"5")))).equals((new ArrayList<String>(Arrays.asList((String)"4")))));
assert(totalMatch((new ArrayList<String>(Arrays.asList((String)"hi", (String)"admin"))), (new ArrayList<String>(Arrays.asList((String)"hI", (String)"Hi")))).equals((new ArrayList<String>(Arrays.asList((String)"hI", (String)"Hi")))));
assert(totalMatch((new ArrayList<String>(Arrays.asList((String)"hi", (String)"admin"))), (new ArrayList<String>(Arrays.asList((String)"hI", (String)"hi", (String)"hi")))).equals((new ArrayList<String>(Arrays.asList((String)"hI", (String)"hi", (String)"hi")))));
assert(totalMatch((new ArrayList<String>(Arrays.asList((String)"hi", (String)"admin"))), (new ArrayList<String>(Arrays.asList((String)"hI", (String)"hi", (String)"hii")))).equals((new ArrayList<String>(Arrays.asList((String)"hi", (String)"admin")))));
assert(totalMatch((new ArrayList<String>(Arrays.asList())), (new ArrayList<String>(Arrays.asList((String)"this")))).equals((new ArrayList<String>(Arrays.asList()))));
assert(totalMatch((new ArrayList<String>(Arrays.asList((String)"this"))), (new ArrayList<String>(Arrays.asList()))).equals((new ArrayList<String>(Arrays.asList()))));
}
}
| [
"\n }\n"
] |
HumanEval_75_is_multiply_prime | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100.
// Example:
// >>> isMultiplyPrime((30l))
// (true)
// 30 = 2 * 3 * 5
public static boolean isMultiplyPrime(long a) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_75_is_multiply_prime.py | reworded | }
public static void main(String[] args) {
assert(isMultiplyPrime((5l)) == (false));
assert(isMultiplyPrime((30l)) == (true));
assert(isMultiplyPrime((8l)) == (true));
assert(isMultiplyPrime((10l)) == (false));
assert(isMultiplyPrime((125l)) == (true));
assert(isMultiplyPrime((105l)) == (true));
assert(isMultiplyPrime((126l)) == (false));
assert(isMultiplyPrime((729l)) == (false));
assert(isMultiplyPrime((891l)) == (false));
assert(isMultiplyPrime((1001l)) == (true));
}
}
| [
"\n }\n"
] |
HumanEval_76_is_simple_power | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Your task is to write a function that returns true if a number x is a simple
// power of n and false in other cases.
// x is a simple power of n if n**int=x
// For example:
// >>> isSimplePower((1l), (4l))
// (true)
// >>> isSimplePower((2l), (2l))
// (true)
// >>> isSimplePower((8l), (2l))
// (true)
// >>> isSimplePower((3l), (2l))
// (false)
// >>> isSimplePower((3l), (1l))
// (false)
// >>> isSimplePower((5l), (3l))
// (false)
public static boolean isSimplePower(long x, long n) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_76_is_simple_power.py | reworded | }
public static void main(String[] args) {
assert(isSimplePower((16l), (2l)) == (true));
assert(isSimplePower((143214l), (16l)) == (false));
assert(isSimplePower((4l), (2l)) == (true));
assert(isSimplePower((9l), (3l)) == (true));
assert(isSimplePower((16l), (4l)) == (true));
assert(isSimplePower((24l), (2l)) == (false));
assert(isSimplePower((128l), (4l)) == (false));
assert(isSimplePower((12l), (6l)) == (false));
assert(isSimplePower((1l), (1l)) == (true));
assert(isSimplePower((1l), (12l)) == (true));
}
}
| [
"\n }\n"
] |
HumanEval_77_iscube | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Write a function that takes an integer a and returns true
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// >>> iscube((1l))
// (true)
// >>> iscube((2l))
// (false)
// >>> iscube((-1l))
// (true)
// >>> iscube((64l))
// (true)
// >>> iscube((0l))
// (true)
// >>> iscube((180l))
// (false)
public static boolean iscube(long a) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_77_iscube.py | reworded | }
public static void main(String[] args) {
assert(iscube((1l)) == (true));
assert(iscube((2l)) == (false));
assert(iscube((-1l)) == (true));
assert(iscube((64l)) == (true));
assert(iscube((180l)) == (false));
assert(iscube((1000l)) == (true));
assert(iscube((0l)) == (true));
assert(iscube((1729l)) == (false));
}
}
| [
"\n }\n"
] |
HumanEval_78_hex_key | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// You have been tasked to write a function that receives
// a hexadecimal number as a string and counts the number of hexadecimal
// digits that are primes (prime number, or a prime, is a natural number
// greater than 1 that is not a product of two smaller natural numbers).
// Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
// Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
// So you have to determine a number of the following digits: 2, 3, 5, 7,
// B (=decimal 11), D (=decimal 13).
// Note: you may assume the input is always correct or empty string,
// and symbols A,B,C,D,E,F are always uppercase.
// Examples:
// >>> hexKey(("AB"))
// (1l)
// >>> hexKey(("1077E"))
// (2l)
// >>> hexKey(("ABED1A33"))
// (4l)
// >>> hexKey(("123456789ABCDEF0"))
// (6l)
// >>> hexKey(("2020"))
// (2l)
public static long hexKey(String num) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_78_hex_key.py | reworded | }
public static void main(String[] args) {
assert(hexKey(("AB")) == (1l));
assert(hexKey(("1077E")) == (2l));
assert(hexKey(("ABED1A33")) == (4l));
assert(hexKey(("2020")) == (2l));
assert(hexKey(("123456789ABCDEF0")) == (6l));
assert(hexKey(("112233445566778899AABBCCDDEEFF00")) == (12l));
}
}
| [
"\n }\n"
] |
HumanEval_79_decimal_to_binary | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// You will be given a number in decimal form and your task is to convert it to
// binary format. The function should return a string, with each character representing a binary
// number. Each character in the string will be '0' or '1'.
// There will be an extra couple of characters 'db' at the beginning and at the end of the string.
// The extra characters are there to help with the format.
// Examples:
// >>> decimalToBinary((15l))
// ("db1111db")
// >>> decimalToBinary((32l))
// ("db100000db")
public static String decimalToBinary(long decimal) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_79_decimal_to_binary.py | reworded | }
public static void main(String[] args) {
assert(decimalToBinary((0l)).equals(("db0db")));
assert(decimalToBinary((32l)).equals(("db100000db")));
assert(decimalToBinary((103l)).equals(("db1100111db")));
assert(decimalToBinary((15l)).equals(("db1111db")));
}
}
| [
"\n }\n"
] |
HumanEval_80_is_happy | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// You are given a string s.
// Your task is to check if the string is hapjava or not.
// A string is hapjava if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// >>> isHappy(("a"))
// (false)
// >>> isHappy(("aa"))
// (false)
// >>> isHappy(("abcd"))
// (true)
// >>> isHappy(("aabb"))
// (false)
// >>> isHappy(("adb"))
// (true)
// >>> isHappy(("xyy"))
// (false)
public static boolean isHappy(String s) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_80_is_happy.py | reworded | }
public static void main(String[] args) {
assert(isHappy(("a")) == (false));
assert(isHappy(("aa")) == (false));
assert(isHappy(("abcd")) == (true));
assert(isHappy(("aabb")) == (false));
assert(isHappy(("adb")) == (true));
assert(isHappy(("xyy")) == (false));
assert(isHappy(("iopaxpoi")) == (true));
assert(isHappy(("iopaxioi")) == (false));
}
}
| [
"\n }\n"
] |
HumanEval_81_numerical_letter_grade | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// It is the last week of the semester and the teacher has to give the grades
// to students. The teacher has been making her own algorithm for grading.
// The only problem is, she has lost the code she used for grading.
// She has given you an array array list of GPAs for some students and you have to write
// a function that can output an array array list of letter grades using the following table:
// GPA | Letter grade
// 4.0 A+
// > 3.7 A
// > 3.3 A-
// > 3.0 B+
// > 2.7 B
// > 2.3 B-
// > 2.0 C+
// > 1.7 C
// > 1.3 C-
// > 1.0 D+
// > 0.7 D
// > 0.0 D-
// 0.0 E
// Example:
// >>> gradeEquation((new ArrayList<Float>(Arrays.asList((float)4.0f, (float)3l, (float)1.7f, (float)2l, (float)3.5f))))
// (new ArrayList<String>(Arrays.asList((String)"A+", (String)"B", (String)"C-", (String)"C", (String)"A-")))
public static ArrayList<String> numericalLetterGrade(ArrayList<Float> grades) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_81_numerical_letter_grade.py | reworded | }
public static void main(String[] args) {
assert(numericalLetterGrade((new ArrayList<Float>(Arrays.asList((float)4.0f, (float)3l, (float)1.7f, (float)2l, (float)3.5f)))).equals((new ArrayList<String>(Arrays.asList((String)"A+", (String)"B", (String)"C-", (String)"C", (String)"A-")))));
assert(numericalLetterGrade((new ArrayList<Float>(Arrays.asList((float)1.2f)))).equals((new ArrayList<String>(Arrays.asList((String)"D+")))));
assert(numericalLetterGrade((new ArrayList<Float>(Arrays.asList((float)0.5f)))).equals((new ArrayList<String>(Arrays.asList((String)"D-")))));
assert(numericalLetterGrade((new ArrayList<Float>(Arrays.asList((float)0.0f)))).equals((new ArrayList<String>(Arrays.asList((String)"E")))));
assert(numericalLetterGrade((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)0.3f, (float)1.5f, (float)2.8f, (float)3.3f)))).equals((new ArrayList<String>(Arrays.asList((String)"D", (String)"D-", (String)"C-", (String)"B", (String)"B+")))));
assert(numericalLetterGrade((new ArrayList<Float>(Arrays.asList((float)0.0f, (float)0.7f)))).equals((new ArrayList<String>(Arrays.asList((String)"E", (String)"D-")))));
}
}
| [
"\n }\n"
] |
HumanEval_82_prime_length | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// >>> primeLength(("Hello"))
// (true)
// >>> primeLength(("abcdcba"))
// (true)
// >>> primeLength(("kittens"))
// (true)
// >>> primeLength(("orange"))
// (false)
public static boolean primeLength(String string) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_82_prime_length.py | reworded | }
public static void main(String[] args) {
assert(primeLength(("Hello")) == (true));
assert(primeLength(("abcdcba")) == (true));
assert(primeLength(("kittens")) == (true));
assert(primeLength(("orange")) == (false));
assert(primeLength(("wow")) == (true));
assert(primeLength(("world")) == (true));
assert(primeLength(("MadaM")) == (true));
assert(primeLength(("Wow")) == (true));
assert(primeLength(("")) == (false));
assert(primeLength(("HI")) == (true));
assert(primeLength(("go")) == (true));
assert(primeLength(("gogo")) == (false));
assert(primeLength(("aaaaaaaaaaaaaaa")) == (false));
assert(primeLength(("Madam")) == (true));
assert(primeLength(("M")) == (false));
assert(primeLength(("0")) == (false));
}
}
| [
"\n }\n"
] |
HumanEval_83_starts_one_ends | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
public static long startsOneEnds(long n) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_83_starts_one_ends.py | reworded | }
public static void main(String[] args) {
assert(startsOneEnds((1l)) == (1l));
assert(startsOneEnds((2l)) == (18l));
assert(startsOneEnds((3l)) == (180l));
assert(startsOneEnds((4l)) == (1800l));
assert(startsOneEnds((5l)) == (18000l));
}
}
| [
"\n }\n"
] |
HumanEval_84_solve | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given a positive integer N, return the total sum of its digits in binary.
// Example
// >>> solve((1000l))
// ("1")
// >>> solve((150l))
// ("110")
// >>> solve((147l))
// ("1100")
// Variables:
// @N integer
// Constraints: 0 ≤ N ≤ 10000.
// Output:
// a string of binary number
public static String solve(long N) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_84_solve.py | reworded | }
public static void main(String[] args) {
assert(solve((1000l)).equals(("1")));
assert(solve((150l)).equals(("110")));
assert(solve((147l)).equals(("1100")));
assert(solve((333l)).equals(("1001")));
assert(solve((963l)).equals(("10010")));
}
}
| [
"\n }\n"
] |
HumanEval_85_add | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given a non-empty array list of integers lst. add the even elements that are at odd indices..
// Examples:
// >>> add((new ArrayList<Long>(Arrays.asList((long)4l, (long)2l, (long)6l, (long)7l))))
// (2l)
public static long add(ArrayList<Long> lst) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_85_add.py | reworded | }
public static void main(String[] args) {
assert(add((new ArrayList<Long>(Arrays.asList((long)4l, (long)88l)))) == (88l));
assert(add((new ArrayList<Long>(Arrays.asList((long)4l, (long)5l, (long)6l, (long)7l, (long)2l, (long)122l)))) == (122l));
assert(add((new ArrayList<Long>(Arrays.asList((long)4l, (long)0l, (long)6l, (long)7l)))) == (0l));
assert(add((new ArrayList<Long>(Arrays.asList((long)4l, (long)4l, (long)6l, (long)8l)))) == (12l));
}
}
| [
"\n }\n"
] |
HumanEval_86_anti_shuffle | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Write a function that takes a string and returns an ordered version of it.
// Ordered version of string, is a string where all words (separated by space)
// are replaced by a new word where all the characters arranged in
// ascending order based on ascii value.
// Note: You should keep the order of words and blank spaces in the sentence.
// For example:
// >>> antiShuffle(("Hi"))
// ("Hi")
// >>> antiShuffle(("hello"))
// ("ehllo")
// >>> antiShuffle(("Hello World!!!"))
// ("Hello !!!Wdlor")
public static String antiShuffle(String s) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_86_anti_shuffle.py | reworded | }
public static void main(String[] args) {
assert(antiShuffle(("Hi")).equals(("Hi")));
assert(antiShuffle(("hello")).equals(("ehllo")));
assert(antiShuffle(("number")).equals(("bemnru")));
assert(antiShuffle(("abcd")).equals(("abcd")));
assert(antiShuffle(("Hello World!!!")).equals(("Hello !!!Wdlor")));
assert(antiShuffle(("")).equals(("")));
assert(antiShuffle(("Hi. My name is Mister Robot. How are you?")).equals((".Hi My aemn is Meirst .Rboot How aer ?ouy")));
}
}
| [
"\n }\n"
] |
HumanEval_87_get_row | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// You are given a 2 dimensional data, as a nested array lists,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array list,
// and return array list of pairs, [(x1, y1), (x2, y2) ...] such that
// each pair is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// >>> getRow((new ArrayList<ArrayList<Long>>(Arrays.asList((ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)5l, (long)6l)), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)1l, (long)6l)), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)5l, (long)1l))))), (1l))
// (new ArrayList<Pair<Long, Long>>(Arrays.asList((Pair<Long, Long>)Pair.with(0l, 0l), (Pair<Long, Long>)Pair.with(1l, 4l), (Pair<Long, Long>)Pair.with(1l, 0l), (Pair<Long, Long>)Pair.with(2l, 5l), (Pair<Long, Long>)Pair.with(2l, 0l))))
// >>> getRow((new ArrayList<ArrayList<Long>>(Arrays.asList())), (1l))
// (new ArrayList<Pair<Long, Long>>(Arrays.asList()))
// >>> getRow((new ArrayList<ArrayList<Long>>(Arrays.asList((ArrayList<Long>)new ArrayList<Long>(Arrays.asList()), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l)), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l))))), (3l))
// (new ArrayList<Pair<Long, Long>>(Arrays.asList((Pair<Long, Long>)Pair.with(2l, 2l))))
public static ArrayList<Pair<Long, Long>> getRow(ArrayList<ArrayList<Long>> lst, long x) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_87_get_row.py | reworded | }
public static void main(String[] args) {
assert(getRow((new ArrayList<ArrayList<Long>>(Arrays.asList((ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)5l, (long)6l)), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)1l, (long)6l)), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)5l, (long)1l))))), (1l)).equals((new ArrayList<Pair<Long, Long>>(Arrays.asList((Pair<Long, Long>)Pair.with(0l, 0l), (Pair<Long, Long>)Pair.with(1l, 4l), (Pair<Long, Long>)Pair.with(1l, 0l), (Pair<Long, Long>)Pair.with(2l, 5l), (Pair<Long, Long>)Pair.with(2l, 0l))))));
assert(getRow((new ArrayList<ArrayList<Long>>(Arrays.asList((ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)5l, (long)6l)), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)5l, (long)6l)), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)5l, (long)6l)), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)5l, (long)6l)), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)5l, (long)6l)), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)5l, (long)6l))))), (2l)).equals((new ArrayList<Pair<Long, Long>>(Arrays.asList((Pair<Long, Long>)Pair.with(0l, 1l), (Pair<Long, Long>)Pair.with(1l, 1l), (Pair<Long, Long>)Pair.with(2l, 1l), (Pair<Long, Long>)Pair.with(3l, 1l), (Pair<Long, Long>)Pair.with(4l, 1l), (Pair<Long, Long>)Pair.with(5l, 1l))))));
assert(getRow((new ArrayList<ArrayList<Long>>(Arrays.asList((ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)5l, (long)6l)), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)5l, (long)6l)), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)1l, (long)3l, (long)4l, (long)5l, (long)6l)), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)1l, (long)4l, (long)5l, (long)6l)), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)1l, (long)5l, (long)6l)), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)1l, (long)6l)), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)5l, (long)1l))))), (1l)).equals((new ArrayList<Pair<Long, Long>>(Arrays.asList((Pair<Long, Long>)Pair.with(0l, 0l), (Pair<Long, Long>)Pair.with(1l, 0l), (Pair<Long, Long>)Pair.with(2l, 1l), (Pair<Long, Long>)Pair.with(2l, 0l), (Pair<Long, Long>)Pair.with(3l, 2l), (Pair<Long, Long>)Pair.with(3l, 0l), (Pair<Long, Long>)Pair.with(4l, 3l), (Pair<Long, Long>)Pair.with(4l, 0l), (Pair<Long, Long>)Pair.with(5l, 4l), (Pair<Long, Long>)Pair.with(5l, 0l), (Pair<Long, Long>)Pair.with(6l, 5l), (Pair<Long, Long>)Pair.with(6l, 0l))))));
assert(getRow((new ArrayList<ArrayList<Long>>(Arrays.asList())), (1l)).equals((new ArrayList<Pair<Long, Long>>(Arrays.asList()))));
assert(getRow((new ArrayList<ArrayList<Long>>(Arrays.asList((ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l))))), (2l)).equals((new ArrayList<Pair<Long, Long>>(Arrays.asList()))));
assert(getRow((new ArrayList<ArrayList<Long>>(Arrays.asList((ArrayList<Long>)new ArrayList<Long>(Arrays.asList()), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l)), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l))))), (3l)).equals((new ArrayList<Pair<Long, Long>>(Arrays.asList((Pair<Long, Long>)Pair.with(2l, 2l))))));
}
}
| [
"\n }\n"
] |
HumanEval_88_sort_array | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given an array array list of non-negative integers, return a cojava of the given array array list after sorting,
// you will sort the given array array list in ascending order if the sum( first index value, last index value) is odd,
// or sort it in descending order if the sum( first index value, last index value) is even.
// Note:
// * don't change the given array array list.
// Examples:
// >>> sortArray((new ArrayList<Long>(Arrays.asList())))
// (new ArrayList<Long>(Arrays.asList()))
// >>> sortArray((new ArrayList<Long>(Arrays.asList((long)5l))))
// (new ArrayList<Long>(Arrays.asList((long)5l)))
// >>> sortArray((new ArrayList<Long>(Arrays.asList((long)2l, (long)4l, (long)3l, (long)0l, (long)1l, (long)5l))))
// (new ArrayList<Long>(Arrays.asList((long)0l, (long)1l, (long)2l, (long)3l, (long)4l, (long)5l)))
// >>> sortArray((new ArrayList<Long>(Arrays.asList((long)2l, (long)4l, (long)3l, (long)0l, (long)1l, (long)5l, (long)6l))))
// (new ArrayList<Long>(Arrays.asList((long)6l, (long)5l, (long)4l, (long)3l, (long)2l, (long)1l, (long)0l)))
public static ArrayList<Long> sortArray(ArrayList<Long> array) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_88_sort_array.py | reworded | }
public static void main(String[] args) {
assert(sortArray((new ArrayList<Long>(Arrays.asList()))).equals((new ArrayList<Long>(Arrays.asList()))));
assert(sortArray((new ArrayList<Long>(Arrays.asList((long)5l)))).equals((new ArrayList<Long>(Arrays.asList((long)5l)))));
assert(sortArray((new ArrayList<Long>(Arrays.asList((long)2l, (long)4l, (long)3l, (long)0l, (long)1l, (long)5l)))).equals((new ArrayList<Long>(Arrays.asList((long)0l, (long)1l, (long)2l, (long)3l, (long)4l, (long)5l)))));
assert(sortArray((new ArrayList<Long>(Arrays.asList((long)2l, (long)4l, (long)3l, (long)0l, (long)1l, (long)5l, (long)6l)))).equals((new ArrayList<Long>(Arrays.asList((long)6l, (long)5l, (long)4l, (long)3l, (long)2l, (long)1l, (long)0l)))));
assert(sortArray((new ArrayList<Long>(Arrays.asList((long)2l, (long)1l)))).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l)))));
assert(sortArray((new ArrayList<Long>(Arrays.asList((long)15l, (long)42l, (long)87l, (long)32l, (long)11l, (long)0l)))).equals((new ArrayList<Long>(Arrays.asList((long)0l, (long)11l, (long)15l, (long)32l, (long)42l, (long)87l)))));
assert(sortArray((new ArrayList<Long>(Arrays.asList((long)21l, (long)14l, (long)23l, (long)11l)))).equals((new ArrayList<Long>(Arrays.asList((long)23l, (long)21l, (long)14l, (long)11l)))));
}
}
| [
"\n }\n"
] |
HumanEval_89_encrypt | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated.
// The alphabet should be rotated in a manner such that the letters
// shift down by two multiplied to two places.
// For example:
// >>> encrypt(("hi"))
// ("lm")
// >>> encrypt(("asdfghjkl"))
// ("ewhjklnop")
// >>> encrypt(("gf"))
// ("kj")
// >>> encrypt(("et"))
// ("ix")
public static String encrypt(String s) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_89_encrypt.py | reworded | }
public static void main(String[] args) {
assert(encrypt(("hi")).equals(("lm")));
assert(encrypt(("asdfghjkl")).equals(("ewhjklnop")));
assert(encrypt(("gf")).equals(("kj")));
assert(encrypt(("et")).equals(("ix")));
assert(encrypt(("faewfawefaewg")).equals(("jeiajeaijeiak")));
assert(encrypt(("hellomyfriend")).equals(("lippsqcjvmirh")));
assert(encrypt(("dxzdlmnilfuhmilufhlihufnmlimnufhlimnufhfucufh")).equals(("hbdhpqrmpjylqmpyjlpmlyjrqpmqryjlpmqryjljygyjl")));
assert(encrypt(("a")).equals(("e")));
}
}
| [
"\n }\n"
] |
HumanEval_90_next_smallest | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// You are given an array array list of integers.
// Write a function next_smallest() that returns the 2nd smallest element of the array list.
// Return null if there is no such element.
// >>> nextSmallest((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)5l))))
// Optional.of(2l)
// >>> nextSmallest((new ArrayList<Long>(Arrays.asList((long)5l, (long)1l, (long)4l, (long)3l, (long)2l))))
// Optional.of(2l)
// >>> nextSmallest((new ArrayList<Long>(Arrays.asList())))
// Optional.empty()
// >>> nextSmallest((new ArrayList<Long>(Arrays.asList((long)1l, (long)1l))))
// Optional.empty()
public static Optional<Long> nextSmallest(ArrayList<Long> lst) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_90_next_smallest.py | reworded | }
public static void main(String[] args) {
assert(nextSmallest((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)5l)))).equals(Optional.of(2l)));
assert(nextSmallest((new ArrayList<Long>(Arrays.asList((long)5l, (long)1l, (long)4l, (long)3l, (long)2l)))).equals(Optional.of(2l)));
assert(nextSmallest((new ArrayList<Long>(Arrays.asList()))).equals(Optional.empty()));
assert(nextSmallest((new ArrayList<Long>(Arrays.asList((long)1l, (long)1l)))).equals(Optional.empty()));
assert(nextSmallest((new ArrayList<Long>(Arrays.asList((long)1l, (long)1l, (long)1l, (long)1l, (long)0l)))).equals(Optional.of(1l)));
assert(nextSmallest((new ArrayList<Long>(Arrays.asList((long)1l, (long)1l)))).equals(Optional.empty()));
assert(nextSmallest((new ArrayList<Long>(Arrays.asList((long)-35l, (long)34l, (long)12l, (long)-45l)))).equals(Optional.of(-35l)));
}
}
| [
"\n }\n"
] |
HumanEval_91_is_bored | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// >>> isBored(("Hello world"))
// (0l)
// >>> isBored(("The sky is blue. The sun is shining. I love this weather"))
// (1l)
public static long isBored(String S) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_91_is_bored.py | reworded | }
public static void main(String[] args) {
assert(isBored(("Hello world")) == (0l));
assert(isBored(("Is the sky blue?")) == (0l));
assert(isBored(("I love It !")) == (1l));
assert(isBored(("bIt")) == (0l));
assert(isBored(("I feel good today. I will be productive. will kill It")) == (2l));
assert(isBored(("You and I are going for a walk")) == (0l));
}
}
| [
"\n }\n"
] |
HumanEval_92_any_int | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// >>> anyInt((float)5l, (float)2l, (float)7l)
// (true)
// >>> anyInt((float)3l, (float)2l, (float)2l)
// (false)
// >>> anyInt((float)3l, (float)-2l, (float)1l)
// (true)
// >>> anyInt((3.6f), (-2.2f), (float)2l)
// (false)
public static boolean anyInt(float x, float y, float z) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_92_any_int.py | reworded | }
public static void main(String[] args) {
assert(anyInt((float)2l, (float)3l, (float)1l) == (true));
assert(anyInt((2.5f), (float)2l, (float)3l) == (false));
assert(anyInt((1.5f), (float)5l, (3.5f)) == (false));
assert(anyInt((float)2l, (float)6l, (float)2l) == (false));
assert(anyInt((float)4l, (float)2l, (float)2l) == (true));
assert(anyInt((2.2f), (2.2f), (2.2f)) == (false));
assert(anyInt((float)-4l, (float)6l, (float)2l) == (true));
assert(anyInt((float)2l, (float)1l, (float)1l) == (true));
assert(anyInt((float)3l, (float)4l, (float)7l) == (true));
assert(anyInt((3.0f), (float)4l, (float)7l) == (false));
}
}
| [
"\n }\n"
] |
HumanEval_93_encode | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Write a function that takes a message, and encodes in such a
// way that it swaps case of all letters, replaces all vowels in
// the message with the letter that appears 2 places ahead of that
// vowel in the english alphabet.
// Assume only letters.
// Examples:
// >>> encode(("test"))
// ("TGST")
// >>> encode(("This is a message"))
// ("tHKS KS C MGSSCGG")
public static String encode(String message) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_93_encode.py | reworded | }
public static void main(String[] args) {
assert(encode(("TEST")).equals(("tgst")));
assert(encode(("Mudasir")).equals(("mWDCSKR")));
assert(encode(("YES")).equals(("ygs")));
assert(encode(("This is a message")).equals(("tHKS KS C MGSSCGG")));
assert(encode(("I DoNt KnOw WhAt tO WrItE")).equals(("k dQnT kNqW wHcT Tq wRkTg")));
}
}
| [
"\n }\n"
] |
HumanEval_94_skjkasdkd | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// You are given an array array list of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// >>> skjkasdkd((new ArrayList<Long>(Arrays.asList((long)0l, (long)3l, (long)2l, (long)1l, (long)3l, (long)5l, (long)7l, (long)4l, (long)5l, (long)5l, (long)5l, (long)2l, (long)181l, (long)32l, (long)4l, (long)32l, (long)3l, (long)2l, (long)32l, (long)324l, (long)4l, (long)3l))))
// (10l)
// >>> skjkasdkd((new ArrayList<Long>(Arrays.asList((long)1l, (long)0l, (long)1l, (long)8l, (long)2l, (long)4597l, (long)2l, (long)1l, (long)3l, (long)40l, (long)1l, (long)2l, (long)1l, (long)2l, (long)4l, (long)2l, (long)5l, (long)1l))))
// (25l)
// >>> skjkasdkd((new ArrayList<Long>(Arrays.asList((long)1l, (long)3l, (long)1l, (long)32l, (long)5107l, (long)34l, (long)83278l, (long)109l, (long)163l, (long)23l, (long)2323l, (long)32l, (long)30l, (long)1l, (long)9l, (long)3l))))
// (13l)
// >>> skjkasdkd((new ArrayList<Long>(Arrays.asList((long)0l, (long)724l, (long)32l, (long)71l, (long)99l, (long)32l, (long)6l, (long)0l, (long)5l, (long)91l, (long)83l, (long)0l, (long)5l, (long)6l))))
// (11l)
// >>> skjkasdkd((new ArrayList<Long>(Arrays.asList((long)0l, (long)81l, (long)12l, (long)3l, (long)1l, (long)21l))))
// (3l)
// >>> skjkasdkd((new ArrayList<Long>(Arrays.asList((long)0l, (long)8l, (long)1l, (long)2l, (long)1l, (long)7l))))
// (7l)
public static long skjkasdkd(ArrayList<Long> lst) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_94_skjkasdkd.py | reworded | }
public static void main(String[] args) {
assert(skjkasdkd((new ArrayList<Long>(Arrays.asList((long)0l, (long)3l, (long)2l, (long)1l, (long)3l, (long)5l, (long)7l, (long)4l, (long)5l, (long)5l, (long)5l, (long)2l, (long)181l, (long)32l, (long)4l, (long)32l, (long)3l, (long)2l, (long)32l, (long)324l, (long)4l, (long)3l)))) == (10l));
assert(skjkasdkd((new ArrayList<Long>(Arrays.asList((long)1l, (long)0l, (long)1l, (long)8l, (long)2l, (long)4597l, (long)2l, (long)1l, (long)3l, (long)40l, (long)1l, (long)2l, (long)1l, (long)2l, (long)4l, (long)2l, (long)5l, (long)1l)))) == (25l));
assert(skjkasdkd((new ArrayList<Long>(Arrays.asList((long)1l, (long)3l, (long)1l, (long)32l, (long)5107l, (long)34l, (long)83278l, (long)109l, (long)163l, (long)23l, (long)2323l, (long)32l, (long)30l, (long)1l, (long)9l, (long)3l)))) == (13l));
assert(skjkasdkd((new ArrayList<Long>(Arrays.asList((long)0l, (long)724l, (long)32l, (long)71l, (long)99l, (long)32l, (long)6l, (long)0l, (long)5l, (long)91l, (long)83l, (long)0l, (long)5l, (long)6l)))) == (11l));
assert(skjkasdkd((new ArrayList<Long>(Arrays.asList((long)0l, (long)81l, (long)12l, (long)3l, (long)1l, (long)21l)))) == (3l));
assert(skjkasdkd((new ArrayList<Long>(Arrays.asList((long)0l, (long)8l, (long)1l, (long)2l, (long)1l, (long)7l)))) == (7l));
assert(skjkasdkd((new ArrayList<Long>(Arrays.asList((long)8191l)))) == (19l));
assert(skjkasdkd((new ArrayList<Long>(Arrays.asList((long)8191l, (long)123456l, (long)127l, (long)7l)))) == (19l));
assert(skjkasdkd((new ArrayList<Long>(Arrays.asList((long)127l, (long)97l, (long)8192l)))) == (10l));
}
}
| [
"\n }\n"
] |
HumanEval_95_check_dict_case | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given a hash map, return true if all keys are strings in lower
// case or all keys are strings in upper case, else return false.
// The function should return false is the given hash map is empty.
// Examples:
// >>> checkDictCase((new HashMap<String,String>(Map.of("a", "apple", "b", "banana"))))
// (true)
// >>> checkDictCase((new HashMap<String,String>(Map.of("a", "apple", "A", "banana", "B", "banana"))))
// (false)
// >>> checkDictCase((new HashMap<String,String>(Map.of("a", "apple", 8l, "banana", "a", "apple"))))
// (false)
// >>> checkDictCase((new HashMap<String,String>(Map.of("Name", "John", "Age", "36", "City", "Houston"))))
// (false)
// >>> checkDictCase((new HashMap<String,String>(Map.of("STATE", "NC", "ZIP", "12345"))))
// (true)
public static boolean checkDictCase(HashMap<String,String> dict) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_95_check_dict_case.py | reworded | }
public static void main(String[] args) {
assert(checkDictCase((new HashMap<String,String>(Map.of("p", "pineapple", "b", "banana")))) == (true));
assert(checkDictCase((new HashMap<String,String>(Map.of("p", "pineapple", "A", "banana", "B", "banana")))) == (false));
assert(checkDictCase((new HashMap<String,String>(Map.of("p", "pineapple", "5", "banana", "a", "apple")))) == (false));
assert(checkDictCase((new HashMap<String,String>(Map.of("Name", "John", "Age", "36", "City", "Houston")))) == (false));
assert(checkDictCase((new HashMap<String,String>(Map.of("STATE", "NC", "ZIP", "12345")))) == (true));
assert(checkDictCase((new HashMap<String,String>(Map.of("fruit", "Orange", "taste", "Sweet")))) == (true));
assert(checkDictCase((new HashMap<String,String>())) == (false));
}
}
| [
"\n }\n"
] |
HumanEval_96_count_up_to | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Implement a function that takes an non-negative integer and returns an array array list of the first n
// integers that are prime numbers and less than n.
// for example:
// >>> countUpTo((5l))
// (new ArrayList<Long>(Arrays.asList((long)2l, (long)3l)))
// >>> countUpTo((11l))
// (new ArrayList<Long>(Arrays.asList((long)2l, (long)3l, (long)5l, (long)7l)))
// >>> countUpTo((0l))
// (new ArrayList<Long>(Arrays.asList()))
// >>> countUpTo((20l))
// (new ArrayList<Long>(Arrays.asList((long)2l, (long)3l, (long)5l, (long)7l, (long)11l, (long)13l, (long)17l, (long)19l)))
// >>> countUpTo((1l))
// (new ArrayList<Long>(Arrays.asList()))
// >>> countUpTo((18l))
// (new ArrayList<Long>(Arrays.asList((long)2l, (long)3l, (long)5l, (long)7l, (long)11l, (long)13l, (long)17l)))
public static ArrayList<Long> countUpTo(long n) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_96_count_up_to.py | reworded | }
public static void main(String[] args) {
assert(countUpTo((5l)).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)3l)))));
assert(countUpTo((6l)).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)3l, (long)5l)))));
assert(countUpTo((7l)).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)3l, (long)5l)))));
assert(countUpTo((10l)).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)3l, (long)5l, (long)7l)))));
assert(countUpTo((0l)).equals((new ArrayList<Long>(Arrays.asList()))));
assert(countUpTo((22l)).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)3l, (long)5l, (long)7l, (long)11l, (long)13l, (long)17l, (long)19l)))));
assert(countUpTo((1l)).equals((new ArrayList<Long>(Arrays.asList()))));
assert(countUpTo((18l)).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)3l, (long)5l, (long)7l, (long)11l, (long)13l, (long)17l)))));
assert(countUpTo((47l)).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)3l, (long)5l, (long)7l, (long)11l, (long)13l, (long)17l, (long)19l, (long)23l, (long)29l, (long)31l, (long)37l, (long)41l, (long)43l)))));
assert(countUpTo((101l)).equals((new ArrayList<Long>(Arrays.asList((long)2l, (long)3l, (long)5l, (long)7l, (long)11l, (long)13l, (long)17l, (long)19l, (long)23l, (long)29l, (long)31l, (long)37l, (long)41l, (long)43l, (long)47l, (long)53l, (long)59l, (long)61l, (long)67l, (long)71l, (long)73l, (long)79l, (long)83l, (long)89l, (long)97l)))));
}
}
| [
"\n }\n"
] |
HumanEval_97_multiply | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Complete the function that takes two integers and returns
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// >>> multiply((148l), (412l))
// (16l)
// >>> multiply((19l), (28l))
// (72l)
// >>> multiply((2020l), (1851l))
// (0l)
// >>> multiply((14l), (-15l))
// (20l)
public static long multiply(long a, long b) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_97_multiply.py | reworded | }
public static void main(String[] args) {
assert(multiply((148l), (412l)) == (16l));
assert(multiply((19l), (28l)) == (72l));
assert(multiply((2020l), (1851l)) == (0l));
assert(multiply((14l), (-15l)) == (20l));
assert(multiply((76l), (67l)) == (42l));
assert(multiply((17l), (27l)) == (49l));
assert(multiply((0l), (1l)) == (0l));
assert(multiply((0l), (0l)) == (0l));
}
}
| [
"\n }\n"
] |
HumanEval_98_count_upper | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// >>> countUpper(("aBCdEf"))
// (1l)
// >>> countUpper(("abcdefg"))
// (0l)
// >>> countUpper(("dBBE"))
// (0l)
public static long countUpper(String s) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_98_count_upper.py | reworded | }
public static void main(String[] args) {
assert(countUpper(("aBCdEf")) == (1l));
assert(countUpper(("abcdefg")) == (0l));
assert(countUpper(("dBBE")) == (0l));
assert(countUpper(("B")) == (0l));
assert(countUpper(("U")) == (1l));
assert(countUpper(("")) == (0l));
assert(countUpper(("EEEE")) == (2l));
}
}
| [
"\n }\n"
] |
HumanEval_99_closest_integer | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// >>> closestInteger(("10"))
// (10l)
// >>> closestInteger(("15.3"))
// (15l)
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
public static long closestInteger(String value) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_99_closest_integer.py | reworded | }
public static void main(String[] args) {
assert(closestInteger(("10")) == (10l));
assert(closestInteger(("14.5")) == (15l));
assert(closestInteger(("-15.5")) == (-16l));
assert(closestInteger(("15.3")) == (15l));
assert(closestInteger(("0")) == (0l));
}
}
| [
"\n }\n"
] |
HumanEval_100_make_a_pile | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given a positive integer n, you have to make a pile of n levels of stones.
// The first level has n stones.
// The number of stones in the next level is:
// - the next odd number if n is odd.
// - the next even number if n is even.
// Return the number of stones in each level in an array array list, where element at index
// i represents the number of stones in the level (i+1).
// Examples:
// >>> makeAPile((3l))
// (new ArrayList<Long>(Arrays.asList((long)3l, (long)5l, (long)7l)))
public static ArrayList<Long> makeAPile(long n) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_100_make_a_pile.py | reworded | }
public static void main(String[] args) {
assert(makeAPile((3l)).equals((new ArrayList<Long>(Arrays.asList((long)3l, (long)5l, (long)7l)))));
assert(makeAPile((4l)).equals((new ArrayList<Long>(Arrays.asList((long)4l, (long)6l, (long)8l, (long)10l)))));
assert(makeAPile((5l)).equals((new ArrayList<Long>(Arrays.asList((long)5l, (long)7l, (long)9l, (long)11l, (long)13l)))));
assert(makeAPile((6l)).equals((new ArrayList<Long>(Arrays.asList((long)6l, (long)8l, (long)10l, (long)12l, (long)14l, (long)16l)))));
assert(makeAPile((8l)).equals((new ArrayList<Long>(Arrays.asList((long)8l, (long)10l, (long)12l, (long)14l, (long)16l, (long)18l, (long)20l, (long)22l)))));
}
}
| [
"\n }\n"
] |
HumanEval_101_words_string | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// You will be given a string of words separated by commas or spaces. Your task is
// to split the string into words and return an array array list of the words.
// For example:
// >>> wordsString(("Hi, my name is John"))
// (new ArrayList<String>(Arrays.asList((String)"Hi", (String)"my", (String)"name", (String)"is", (String)"John")))
// >>> wordsString(("One, two, three, four, five, six"))
// (new ArrayList<String>(Arrays.asList((String)"One", (String)"two", (String)"three", (String)"four", (String)"five", (String)"six")))
public static ArrayList<String> wordsString(String s) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_101_words_string.py | reworded | }
public static void main(String[] args) {
assert(wordsString(("Hi, my name is John")).equals((new ArrayList<String>(Arrays.asList((String)"Hi", (String)"my", (String)"name", (String)"is", (String)"John")))));
assert(wordsString(("One, two, three, four, five, six")).equals((new ArrayList<String>(Arrays.asList((String)"One", (String)"two", (String)"three", (String)"four", (String)"five", (String)"six")))));
assert(wordsString(("Hi, my name")).equals((new ArrayList<String>(Arrays.asList((String)"Hi", (String)"my", (String)"name")))));
assert(wordsString(("One,, two, three, four, five, six,")).equals((new ArrayList<String>(Arrays.asList((String)"One", (String)"two", (String)"three", (String)"four", (String)"five", (String)"six")))));
assert(wordsString(("")).equals((new ArrayList<String>(Arrays.asList()))));
assert(wordsString(("ahmed , gamal")).equals((new ArrayList<String>(Arrays.asList((String)"ahmed", (String)"gamal")))));
}
}
| [
"\n }\n"
] |
HumanEval_102_choose_num | java | import java.util.*;
import java.lang.reflect.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If
// there's no such number, then the function should return -1.
// For example:
// >>> chooseNum((12l), (15l))
// (14l)
// >>> chooseNum((13l), (12l))
// (-1l)
public static long chooseNum(long x, long y) {
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_102_choose_num.py | reworded | }
public static void main(String[] args) {
assert(chooseNum((12l), (15l)) == (14l));
assert(chooseNum((13l), (12l)) == (-1l));
assert(chooseNum((33l), (12354l)) == (12354l));
assert(chooseNum((5234l), (5233l)) == (-1l));
assert(chooseNum((6l), (29l)) == (28l));
assert(chooseNum((27l), (10l)) == (-1l));
assert(chooseNum((7l), (7l)) == (-1l));
assert(chooseNum((546l), (546l)) == (546l));
}
}
| [
"\n }\n"
] |
End of preview. Expand
in Dataset Viewer.
README.md exists but content is empty.
- Downloads last month
- 15