name
stringlengths 15
44
| language
stringclasses 1
value | prompt
stringlengths 311
1.97k
| doctests
stringclasses 1
value | original
stringlengths 108
137
| prompt_terminology
stringclasses 1
value | tests
stringlengths 300
2.15k
| stop_tokens
sequencelengths 1
1
|
---|---|---|---|---|---|---|---|
HumanEval_0_has_close_elements | adb | pragma Ada_2022;
package Placeholder is
type Float_Array is array (Positive range <>) of Float;
function Has_Close_Elements (Numbers : Float_Array; Threshold : Float) return Boolean;
-- Check if in given Vector of numbers, are any two numbers closer to each other than
-- given threshold.
-- >>> Has_Close_Elements ([1.0, 2.0, 3.0], 0.5)
-- False
-- >>> Has_Close_Elements ([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)
-- True
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Has_Close_Elements (Numbers : Float_Array; Threshold : Float) return Boolean | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_0_has_close_elements.py | reworded |
end Has_Close_Elements;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Numbers : Float_Array; Threshold : Float) return Boolean renames Placeholder.Has_Close_Elements;
begin
pragma Assert (Candidate ([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3) = True);
pragma Assert (Candidate ([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05) = False);
pragma Assert (Candidate ([1.0, 2.0, 5.9, 4.0, 5.0], 0.95) = True);
pragma Assert (Candidate ([1.0, 2.0, 5.9, 4.0, 5.0], 0.8) = False);
pragma Assert (Candidate ([1.0, 2.0, 3.0, 4.0, 5.0, 2.0], 0.1) = True);
pragma Assert (Candidate ([1.1, 2.2, 3.1, 4.1, 5.1], 1.0) = True);
pragma Assert (Candidate ([1.1, 2.2, 3.1, 4.1, 5.1], 0.5) = False);
end Main; | [
"\n end "
] |
HumanEval_1_separate_paren_groups | adb | pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package Placeholder is
type Unbounded_String_Array is array (Positive range <>) of Unbounded_String;
function Separate_Paren_Groups (Paren_String : String) return Unbounded_String_Array;
-- 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 Vector 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.
-- >>> Separate_Paren_Groups ("( ) (( )) (( )( ))")
-- [To_Unbounded_String ("()"), To_Unbounded_String ("(())"), To_Unbounded_String ("(()())")]
end Placeholder;
pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package body Placeholder is
function Separate_Paren_Groups (Paren_String : String) return Unbounded_String_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_1_separate_paren_groups.py | reworded |
end Separate_Paren_Groups;
end Placeholder;
pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Paren_String : String) return Unbounded_String_Array renames Placeholder.Separate_Paren_Groups;
begin
pragma Assert (Candidate ("(()()) ((())) () ((())()())") = [To_Unbounded_String ("(()())"), To_Unbounded_String ("((()))"), To_Unbounded_String ("()"), To_Unbounded_String ("((())()())")]);
pragma Assert (Candidate ("() (()) ((())) (((())))") = [To_Unbounded_String ("()"), To_Unbounded_String ("(())"), To_Unbounded_String ("((()))"), To_Unbounded_String ("(((())))")]);
pragma Assert (Candidate ("(()(())((())))") = [To_Unbounded_String ("(()(())((())))")]);
pragma Assert (Candidate ("( ) (( )) (( )( ))") = [To_Unbounded_String ("()"), To_Unbounded_String ("(())"), To_Unbounded_String ("(()())")]);
end Main; | [
"\n end "
] |
HumanEval_2_truncate_number | adb | pragma Ada_2022;
package Placeholder is
function Truncate_Number (Number : Float) return Float;
-- 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.
-- >>> Truncate_Number (3.5)
-- 0.5
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Truncate_Number (Number : Float) return Float | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_2_truncate_number.py | reworded |
end Truncate_Number;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Number : Float) return Float renames Placeholder.Truncate_Number;
begin
pragma Assert (Candidate (3.5) = 0.5);
pragma Assert (Candidate (1.25) = 0.25);
pragma Assert (Candidate (123.0) = 0.0);
end Main; | [
"\n end "
] |
HumanEval_3_below_zero | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Below_Zero (Operations : Integer_Array) return Boolean;
-- You're given a Vector 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.
-- >>> Below_Zero ([1, 2, 3])
-- False
-- >>> Below_Zero ([1, 2, -4, 5])
-- True
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Below_Zero (Operations : Integer_Array) return Boolean | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_3_below_zero.py | reworded |
end Below_Zero;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Operations : Integer_Array) return Boolean renames Placeholder.Below_Zero;
begin
pragma Assert (Candidate ([]) = False);
pragma Assert (Candidate ([1, 2, -3, 1, 2, -3]) = False);
pragma Assert (Candidate ([1, 2, -4, 5, 6]) = True);
pragma Assert (Candidate ([1, -1, 2, -2, 5, -5, 4, -4]) = False);
pragma Assert (Candidate ([1, -1, 2, -2, 5, -5, 4, -5]) = True);
pragma Assert (Candidate ([1, -2, 2, -2, 5, -5, 4, -4]) = True);
end Main; | [
"\n end "
] |
HumanEval_4_mean_absolute_deviation | adb | pragma Ada_2022;
package Placeholder is
type Float_Array is array (Positive range <>) of Float;
function Mean_Absolute_Deviation (Numbers : Float_Array) return Float;
-- For a given Vector 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 |
-- >>> Mean_Absolute_Deviation ([1.0, 2.0, 3.0, 4.0])
-- 1.0
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Mean_Absolute_Deviation (Numbers : Float_Array) return Float | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_4_mean_absolute_deviation.py | reworded |
end Mean_Absolute_Deviation;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Numbers : Float_Array) return Float renames Placeholder.Mean_Absolute_Deviation;
begin
pragma Assert (Candidate ([1.0, 2.0]) = 0.5);
pragma Assert (Candidate ([1.0, 2.0, 3.0, 4.0]) = 1.0);
pragma Assert (Candidate ([1.0, 2.0, 3.0, 4.0, 5.0]) = 1.2);
end Main; | [
"\n end "
] |
HumanEval_5_intersperse | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Intersperse (Numbers : Integer_Array; Delimeter : Integer) return Integer_Array;
-- Insert a number 'delimeter' between every two consecutive elements of input Vector `numbers'
-- >>> Intersperse ([], 4)
-- []
-- >>> Intersperse ([1, 2, 3], 4)
-- [1, 4, 2, 4, 3]
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Intersperse (Numbers : Integer_Array; Delimeter : Integer) return Integer_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_5_intersperse.py | reworded |
end Intersperse;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Numbers : Integer_Array; Delimeter : Integer) return Integer_Array renames Placeholder.Intersperse;
begin
pragma Assert (Candidate ([], 7) = []);
pragma Assert (Candidate ([5, 6, 3, 2], 8) = [5, 8, 6, 8, 3, 8, 2]);
pragma Assert (Candidate ([2, 2, 2], 2) = [2, 2, 2, 2, 2]);
end Main; | [
"\n end "
] |
HumanEval_6_parse_nested_parens | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Parse_Nested_Parens (Paren_String : String) return Integer_Array;
-- 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.
-- >>> Parse_Nested_Parens ("(()()) ((())) () ((())()())")
-- [2, 3, 1, 3]
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Parse_Nested_Parens (Paren_String : String) return Integer_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_6_parse_nested_parens.py | reworded |
end Parse_Nested_Parens;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Paren_String : String) return Integer_Array renames Placeholder.Parse_Nested_Parens;
begin
pragma Assert (Candidate ("(()()) ((())) () ((())()())") = [2, 3, 1, 3]);
pragma Assert (Candidate ("() (()) ((())) (((())))") = [1, 2, 3, 4]);
pragma Assert (Candidate ("(()(())((())))") = [4]);
end Main; | [
"\n end "
] |
HumanEval_7_filter_by_substring | adb | pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package Placeholder is
type Unbounded_String_Array is array (Positive range <>) of Unbounded_String;
function Filter_By_Substring (Strings : Unbounded_String_Array; Substring : String) return Unbounded_String_Array;
-- Filter an input Vector of strings only for ones that contain given substring
-- >>> Filter_By_Substring ([], "a")
-- []
-- >>> Filter_By_Substring ([To_Unbounded_String ("abc"), To_Unbounded_String ("bacd"), To_Unbounded_String ("cde"), To_Unbounded_String ("array")], "a")
-- [To_Unbounded_String ("abc"), To_Unbounded_String ("bacd"), To_Unbounded_String ("array")]
end Placeholder;
pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package body Placeholder is
function Filter_By_Substring (Strings : Unbounded_String_Array; Substring : String) return Unbounded_String_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_7_filter_by_substring.py | reworded |
end Filter_By_Substring;
end Placeholder;
pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Strings : Unbounded_String_Array; Substring : String) return Unbounded_String_Array renames Placeholder.Filter_By_Substring;
begin
pragma Assert (Candidate ([], "john") = []);
pragma Assert (Candidate ([To_Unbounded_String ("xxx"), To_Unbounded_String ("asd"), To_Unbounded_String ("xxy"), To_Unbounded_String ("john doe"), To_Unbounded_String ("xxxAAA"), To_Unbounded_String ("xxx")], "xxx") = [To_Unbounded_String ("xxx"), To_Unbounded_String ("xxxAAA"), To_Unbounded_String ("xxx")]);
pragma Assert (Candidate ([To_Unbounded_String ("xxx"), To_Unbounded_String ("asd"), To_Unbounded_String ("aaaxxy"), To_Unbounded_String ("john doe"), To_Unbounded_String ("xxxAAA"), To_Unbounded_String ("xxx")], "xx") = [To_Unbounded_String ("xxx"), To_Unbounded_String ("aaaxxy"), To_Unbounded_String ("xxxAAA"), To_Unbounded_String ("xxx")]);
pragma Assert (Candidate ([To_Unbounded_String ("grunt"), To_Unbounded_String ("trumpet"), To_Unbounded_String ("prune"), To_Unbounded_String ("gruesome")], "run") = [To_Unbounded_String ("grunt"), To_Unbounded_String ("prune")]);
end Main; | [
"\n end "
] |
HumanEval_8_sum_product | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
type Integer_Integer_Tuple is record
Integer_1 : Integer;
Integer_2 : Integer;
end record;
function Sum_Product (Numbers : Integer_Array) return Integer_Integer_Tuple;
-- For a given Vector of integers, return a record consisting of a sum and a product of all the integers in a Vector.
-- Empty sum should be equal to 0 and empty product should be equal to 1.
-- >>> Sum_Product ([])
-- (0, 1)
-- >>> Sum_Product ([1, 2, 3, 4])
-- (10, 24)
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Sum_Product (Numbers : Integer_Array) return Integer_Integer_Tuple | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_8_sum_product.py | reworded |
end Sum_Product;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Numbers : Integer_Array) return Integer_Integer_Tuple renames Placeholder.Sum_Product;
begin
pragma Assert (Candidate ([]) = (0, 1));
pragma Assert (Candidate ([1, 1, 1]) = (3, 1));
pragma Assert (Candidate ([100, 0]) = (100, 0));
pragma Assert (Candidate ([3, 5, 7]) = (15, 105));
pragma Assert (Candidate ([10]) = (10, 10));
end Main; | [
"\n end "
] |
HumanEval_9_rolling_max | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Rolling_Max (Numbers : Integer_Array) return Integer_Array;
-- From a given Vector of integers, generate a Vector of rolling maximum element found until given moment
-- in the sequence.
-- >>> Rolling_Max ([1, 2, 3, 2, 3, 4, 2])
-- [1, 2, 3, 3, 3, 4, 4]
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Rolling_Max (Numbers : Integer_Array) return Integer_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_9_rolling_max.py | reworded |
end Rolling_Max;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Numbers : Integer_Array) return Integer_Array renames Placeholder.Rolling_Max;
begin
pragma Assert (Candidate ([]) = []);
pragma Assert (Candidate ([1, 2, 3, 4]) = [1, 2, 3, 4]);
pragma Assert (Candidate ([4, 3, 2, 1]) = [4, 4, 4, 4]);
pragma Assert (Candidate ([3, 2, 3, 100, 3]) = [3, 3, 3, 100, 100]);
end Main; | [
"\n end "
] |
HumanEval_10_make_palindrome | adb | pragma Ada_2022;
package Placeholder is
function Make_Palindrome (My_String : String) return String;
-- 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.
-- >>> Make_Palindrome ("")
-- ""
-- >>> Make_Palindrome ("cat")
-- "catac"
-- >>> Make_Palindrome ("cata")
-- "catac"
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Make_Palindrome (My_String : String) return String | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_10_make_palindrome.py | reworded |
end Make_Palindrome;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (My_String : String) return String renames Placeholder.Make_Palindrome;
begin
pragma Assert (Candidate ("") = "");
pragma Assert (Candidate ("x") = "x");
pragma Assert (Candidate ("xyz") = "xyzyx");
pragma Assert (Candidate ("xyx") = "xyx");
pragma Assert (Candidate ("jerry") = "jerryrrej");
end Main; | [
"\n end "
] |
HumanEval_11_string_xor | adb | pragma Ada_2022;
package Placeholder is
function String_Xor (A : String; B : String) return String;
-- 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.
-- >>> String_Xor ("010", "110")
-- "100"
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function String_Xor (A : String; B : String) return String | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_11_string_xor.py | reworded |
end String_Xor;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (A : String; B : String) return String renames Placeholder.String_Xor;
begin
pragma Assert (Candidate ("111000", "101010") = "010010");
pragma Assert (Candidate ("1", "1") = "0");
pragma Assert (Candidate ("0101", "0000") = "0101");
end Main; | [
"\n end "
] |
HumanEval_12_longest | adb | pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package Placeholder is
type Unbounded_String_Array is array (Positive range <>) of Unbounded_String;
type Unbounded_String_Option (Valid : Boolean := False) is record
case Valid is
when True =>
Value : Unbounded_String;
when False =>
null;
end case;
end record;
function Longest (Strings : Unbounded_String_Array) return Unbounded_String_Option;
-- Out of Vector 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 Vector is empty.
-- >>> Longest ([])
-- (Valid => False)
-- >>> Longest ([To_Unbounded_String ("a"), To_Unbounded_String ("b"), To_Unbounded_String ("c")])
-- (Valid => True, Value => To_Unbounded_String ("a"))
-- >>> Longest ([To_Unbounded_String ("a"), To_Unbounded_String ("bb"), To_Unbounded_String ("ccc")])
-- (Valid => True, Value => To_Unbounded_String ("ccc"))
end Placeholder;
pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package body Placeholder is
function Longest (Strings : Unbounded_String_Array) return Unbounded_String_Option | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_12_longest.py | reworded |
end Longest;
end Placeholder;
pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Strings : Unbounded_String_Array) return Unbounded_String_Option renames Placeholder.Longest;
begin
pragma Assert (Candidate ([]) = (Valid => False));
pragma Assert (Candidate ([To_Unbounded_String ("x"), To_Unbounded_String ("y"), To_Unbounded_String ("z")]) = (Valid => True, Value => To_Unbounded_String ("x")));
pragma Assert (Candidate ([To_Unbounded_String ("x"), To_Unbounded_String ("yyy"), To_Unbounded_String ("zzzz"), To_Unbounded_String ("www"), To_Unbounded_String ("kkkk"), To_Unbounded_String ("abc")]) = (Valid => True, Value => To_Unbounded_String ("zzzz")));
end Main; | [
"\n end "
] |
HumanEval_13_greatest_common_divisor | adb | pragma Ada_2022;
package Placeholder is
function Greatest_Common_Divisor (A : Integer; B : Integer) return Integer;
-- Return a greatest common divisor of two integers a and b
-- >>> Greatest_Common_Divisor (3, 5)
-- 1
-- >>> Greatest_Common_Divisor (25, 15)
-- 5
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Greatest_Common_Divisor (A : Integer; B : Integer) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_13_greatest_common_divisor.py | reworded |
end Greatest_Common_Divisor;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (A : Integer; B : Integer) return Integer renames Placeholder.Greatest_Common_Divisor;
begin
pragma Assert (Candidate (3, 7) = 1);
pragma Assert (Candidate (10, 15) = 5);
pragma Assert (Candidate (49, 14) = 7);
pragma Assert (Candidate (144, 60) = 12);
end Main; | [
"\n end "
] |
HumanEval_14_all_prefixes | adb | pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package Placeholder is
type Unbounded_String_Array is array (Positive range <>) of Unbounded_String;
function All_Prefixes (My_String : String) return Unbounded_String_Array;
-- Return Vector of all prefixes from shortest to longest of the input string
-- >>> All_Prefixes ("abc")
-- [To_Unbounded_String ("a"), To_Unbounded_String ("ab"), To_Unbounded_String ("abc")]
end Placeholder;
pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package body Placeholder is
function All_Prefixes (My_String : String) return Unbounded_String_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_14_all_prefixes.py | reworded |
end All_Prefixes;
end Placeholder;
pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (My_String : String) return Unbounded_String_Array renames Placeholder.All_Prefixes;
begin
pragma Assert (Candidate ("") = []);
pragma Assert (Candidate ("asdfgh") = [To_Unbounded_String ("a"), To_Unbounded_String ("as"), To_Unbounded_String ("asd"), To_Unbounded_String ("asdf"), To_Unbounded_String ("asdfg"), To_Unbounded_String ("asdfgh")]);
pragma Assert (Candidate ("WWW") = [To_Unbounded_String ("W"), To_Unbounded_String ("WW"), To_Unbounded_String ("WWW")]);
end Main; | [
"\n end "
] |
HumanEval_15_string_sequence | adb | pragma Ada_2022;
package Placeholder is
function String_Sequence (N : Integer) return String;
-- Return a string containing space-delimited numbers starting from 0 upto n inclusive.
-- >>> String_Sequence (0)
-- "0"
-- >>> String_Sequence (5)
-- "0 1 2 3 4 5"
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function String_Sequence (N : Integer) return String | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_15_string_sequence.py | reworded |
end String_Sequence;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (N : Integer) return String renames Placeholder.String_Sequence;
begin
pragma Assert (Candidate (0) = "0");
pragma Assert (Candidate (3) = "0 1 2 3");
pragma Assert (Candidate (10) = "0 1 2 3 4 5 6 7 8 9 10");
end Main; | [
"\n end "
] |
HumanEval_16_count_distinct_characters | adb | pragma Ada_2022;
package Placeholder is
function Count_Distinct_Characters (My_String : String) return Integer;
-- Given a string, find out how many distinct characters (regardless of case) does it consist of
-- >>> Count_Distinct_Characters ("xyzXYZ")
-- 3
-- >>> Count_Distinct_Characters ("Jerry")
-- 4
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Count_Distinct_Characters (My_String : String) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_16_count_distinct_characters.py | reworded |
end Count_Distinct_Characters;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (My_String : String) return Integer renames Placeholder.Count_Distinct_Characters;
begin
pragma Assert (Candidate ("") = 0);
pragma Assert (Candidate ("abcde") = 5);
pragma Assert (Candidate ("abcdecadeCADE") = 5);
pragma Assert (Candidate ("aaaaAAAAaaaa") = 1);
pragma Assert (Candidate ("Jerry jERRY JeRRRY") = 5);
end Main; | [
"\n end "
] |
HumanEval_17_parse_music | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Parse_Music (Music_String : String) return Integer_Array;
-- Input to this function is a string representing musical notes in a special ASCII format.
-- Your task is to parse this string and return Vector 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
-- >>> Parse_Music ("o o| .| o| o| .| .| .| .| o o")
-- [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Parse_Music (Music_String : String) return Integer_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_17_parse_music.py | reworded |
end Parse_Music;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Music_String : String) return Integer_Array renames Placeholder.Parse_Music;
begin
pragma Assert (Candidate ("") = []);
pragma Assert (Candidate ("o o o o") = [4, 4, 4, 4]);
pragma Assert (Candidate (".| .| .| .|") = [1, 1, 1, 1]);
pragma Assert (Candidate ("o| o| .| .| o o o o") = [2, 2, 1, 1, 4, 4, 4, 4]);
pragma Assert (Candidate ("o| .| o| .| o o| o o|") = [2, 1, 2, 1, 4, 2, 4, 2]);
end Main; | [
"\n end "
] |
HumanEval_18_how_many_times | adb | pragma Ada_2022;
package Placeholder is
function How_Many_Times (My_String : String; Substring : String) return Integer;
-- Find how many times a given substring can be found in the original string. Count overlaping cases.
-- >>> How_Many_Times ("", "a")
-- 0
-- >>> How_Many_Times ("aaa", "a")
-- 3
-- >>> How_Many_Times ("aaaa", "aa")
-- 3
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function How_Many_Times (My_String : String; Substring : String) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_18_how_many_times.py | reworded |
end How_Many_Times;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (My_String : String; Substring : String) return Integer renames Placeholder.How_Many_Times;
begin
pragma Assert (Candidate ("", "x") = 0);
pragma Assert (Candidate ("xyxyxyx", "x") = 4);
pragma Assert (Candidate ("cacacacac", "cac") = 4);
pragma Assert (Candidate ("john doe", "john") = 1);
end Main; | [
"\n end "
] |
HumanEval_19_sort_numbers | adb | pragma Ada_2022;
package Placeholder is
function Sort_Numbers (Numbers : String) return String;
-- 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
-- >>> Sort_Numbers ("three one five")
-- "one three five"
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Sort_Numbers (Numbers : String) return String | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_19_sort_numbers.py | reworded |
end Sort_Numbers;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Numbers : String) return String renames Placeholder.Sort_Numbers;
begin
pragma Assert (Candidate ("") = "");
pragma Assert (Candidate ("three") = "three");
pragma Assert (Candidate ("three five nine") = "three five nine");
pragma Assert (Candidate ("five zero four seven nine eight") = "zero four five seven eight nine");
pragma Assert (Candidate ("six five four three two one zero") = "zero one two three four five six");
end Main; | [
"\n end "
] |
HumanEval_20_find_closest_elements | adb | pragma Ada_2022;
package Placeholder is
type Float_Array is array (Positive range <>) of Float;
type Float_Float_Tuple is record
Float_1 : Float;
Float_2 : Float;
end record;
function Find_Closest_Elements (Numbers : Float_Array) return Float_Float_Tuple;
-- From a supplied Vector 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).
-- >>> Find_Closest_Elements ([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
-- (2.0, 2.2)
-- >>> Find_Closest_Elements ([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
-- (2.0, 2.0)
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Find_Closest_Elements (Numbers : Float_Array) return Float_Float_Tuple | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_20_find_closest_elements.py | reworded |
end Find_Closest_Elements;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Numbers : Float_Array) return Float_Float_Tuple renames Placeholder.Find_Closest_Elements;
begin
pragma Assert (Candidate ([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) = (3.9, 4.0));
pragma Assert (Candidate ([1.0, 2.0, 5.9, 4.0, 5.0]) = (5.0, 5.9));
pragma Assert (Candidate ([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) = (2.0, 2.2));
pragma Assert (Candidate ([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) = (2.0, 2.0));
pragma Assert (Candidate ([1.1, 2.2, 3.1, 4.1, 5.1]) = (2.2, 3.1));
end Main; | [
"\n end "
] |
HumanEval_21_rescale_to_unit | adb | pragma Ada_2022;
package Placeholder is
type Float_Array is array (Positive range <>) of Float;
function Rescale_To_Unit (Numbers : Float_Array) return Float_Array;
-- Given Vector of numbers (of at least two elements), apply a linear transform to that Vector,
-- such that the smallest number will become 0 and the largest will become 1
-- >>> Rescale_To_Unit ([1.0, 2.0, 3.0, 4.0, 5.0])
-- [0.0, 0.25, 0.5, 0.75, 1.0]
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Rescale_To_Unit (Numbers : Float_Array) return Float_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_21_rescale_to_unit.py | reworded |
end Rescale_To_Unit;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Numbers : Float_Array) return Float_Array renames Placeholder.Rescale_To_Unit;
begin
pragma Assert (Candidate ([2.0, 49.9]) = [0.0, 1.0]);
pragma Assert (Candidate ([100.0, 49.9]) = [1.0, 0.0]);
pragma Assert (Candidate ([1.0, 2.0, 3.0, 4.0, 5.0]) = [0.0, 0.25, 0.5, 0.75, 1.0]);
pragma Assert (Candidate ([2.0, 1.0, 5.0, 3.0, 4.0]) = [0.25, 0.0, 1.0, 0.5, 0.75]);
pragma Assert (Candidate ([12.0, 11.0, 15.0, 13.0, 14.0]) = [0.25, 0.0, 1.0, 0.5, 0.75]);
end Main; | [
"\n end "
] |
HumanEval_23_strlen | adb | pragma Ada_2022;
package Placeholder is
function Strlen (My_String : String) return Integer;
-- Return length of given string
-- >>> Strlen ("")
-- 0
-- >>> Strlen ("abc")
-- 3
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Strlen (My_String : String) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_23_strlen.py | reworded |
end Strlen;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (My_String : String) return Integer renames Placeholder.Strlen;
begin
pragma Assert (Candidate ("") = 0);
pragma Assert (Candidate ("x") = 1);
pragma Assert (Candidate ("asdasnakj") = 9);
end Main; | [
"\n end "
] |
HumanEval_24_largest_divisor | adb | pragma Ada_2022;
package Placeholder is
function Largest_Divisor (N : Integer) return Integer;
-- For a given number n, find the largest number that divides n evenly, smaller than n
-- >>> Largest_Divisor (15)
-- 5
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Largest_Divisor (N : Integer) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_24_largest_divisor.py | reworded |
end Largest_Divisor;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (N : Integer) return Integer renames Placeholder.Largest_Divisor;
begin
pragma Assert (Candidate (3) = 1);
pragma Assert (Candidate (7) = 1);
pragma Assert (Candidate (10) = 5);
pragma Assert (Candidate (100) = 50);
pragma Assert (Candidate (49) = 7);
end Main; | [
"\n end "
] |
HumanEval_25_factorize | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Factorize (N : Integer) return Integer_Array;
-- Return Vector of prime factors of given integer in the order from smallest to largest.
-- Each of the factors should be Vectored number of times corresponding to how many times it appeares in factorization.
-- Input number should be equal to the product of all factors
-- >>> Factorize (8)
-- [2, 2, 2]
-- >>> Factorize (25)
-- [5, 5]
-- >>> Factorize (70)
-- [2, 5, 7]
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Factorize (N : Integer) return Integer_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_25_factorize.py | reworded |
end Factorize;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (N : Integer) return Integer_Array renames Placeholder.Factorize;
begin
pragma Assert (Candidate (2) = [2]);
pragma Assert (Candidate (4) = [2, 2]);
pragma Assert (Candidate (8) = [2, 2, 2]);
pragma Assert (Candidate (57) = [3, 19]);
pragma Assert (Candidate (3249) = [3, 3, 19, 19]);
pragma Assert (Candidate (185193) = [3, 3, 3, 19, 19, 19]);
pragma Assert (Candidate (20577) = [3, 19, 19, 19]);
pragma Assert (Candidate (18) = [2, 3, 3]);
end Main; | [
"\n end "
] |
HumanEval_26_remove_duplicates | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Remove_Duplicates (Numbers : Integer_Array) return Integer_Array;
-- From a Vector of integers, remove all elements that occur more than once.
-- Keep order of elements left the same as in the input.
-- >>> Remove_Duplicates ([1, 2, 3, 2, 4])
-- [1, 3, 4]
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Remove_Duplicates (Numbers : Integer_Array) return Integer_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_26_remove_duplicates.py | reworded |
end Remove_Duplicates;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Numbers : Integer_Array) return Integer_Array renames Placeholder.Remove_Duplicates;
begin
pragma Assert (Candidate ([]) = []);
pragma Assert (Candidate ([1, 2, 3, 4]) = [1, 2, 3, 4]);
pragma Assert (Candidate ([1, 2, 3, 2, 4, 3, 5]) = [1, 4, 5]);
end Main; | [
"\n end "
] |
HumanEval_27_flip_case | adb | pragma Ada_2022;
package Placeholder is
function Flip_Case (My_String : String) return String;
-- For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
-- >>> Flip_Case ("Hello")
-- "hELLO"
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Flip_Case (My_String : String) return String | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_27_flip_case.py | reworded |
end Flip_Case;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (My_String : String) return String renames Placeholder.Flip_Case;
begin
pragma Assert (Candidate ("") = "");
pragma Assert (Candidate ("Hello!") = "hELLO!");
pragma Assert (Candidate ("These violent delights have violent ends") = "tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS");
end Main; | [
"\n end "
] |
HumanEval_28_concatenate | adb | pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package Placeholder is
type Unbounded_String_Array is array (Positive range <>) of Unbounded_String;
function Concatenate (Strings : Unbounded_String_Array) return String;
-- Concatenate Vector of strings into a single string
-- >>> Concatenate ([])
-- ""
-- >>> Concatenate ([To_Unbounded_String ("a"), To_Unbounded_String ("b"), To_Unbounded_String ("c")])
-- "abc"
end Placeholder;
pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package body Placeholder is
function Concatenate (Strings : Unbounded_String_Array) return String | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_28_concatenate.py | reworded |
end Concatenate;
end Placeholder;
pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Strings : Unbounded_String_Array) return String renames Placeholder.Concatenate;
begin
pragma Assert (Candidate ([]) = "");
pragma Assert (Candidate ([To_Unbounded_String ("x"), To_Unbounded_String ("y"), To_Unbounded_String ("z")]) = "xyz");
pragma Assert (Candidate ([To_Unbounded_String ("x"), To_Unbounded_String ("y"), To_Unbounded_String ("z"), To_Unbounded_String ("w"), To_Unbounded_String ("k")]) = "xyzwk");
end Main; | [
"\n end "
] |
HumanEval_29_filter_by_prefix | adb | pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package Placeholder is
type Unbounded_String_Array is array (Positive range <>) of Unbounded_String;
function Filter_By_Prefix (Strings : Unbounded_String_Array; Prefix : String) return Unbounded_String_Array;
-- Filter an input Vector of strings only for ones that start with a given prefix.
-- >>> Filter_By_Prefix ([], "a")
-- []
-- >>> Filter_By_Prefix ([To_Unbounded_String ("abc"), To_Unbounded_String ("bcd"), To_Unbounded_String ("cde"), To_Unbounded_String ("array")], "a")
-- [To_Unbounded_String ("abc"), To_Unbounded_String ("array")]
end Placeholder;
pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package body Placeholder is
function Filter_By_Prefix (Strings : Unbounded_String_Array; Prefix : String) return Unbounded_String_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_29_filter_by_prefix.py | reworded |
end Filter_By_Prefix;
end Placeholder;
pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Strings : Unbounded_String_Array; Prefix : String) return Unbounded_String_Array renames Placeholder.Filter_By_Prefix;
begin
pragma Assert (Candidate ([], "john") = []);
pragma Assert (Candidate ([To_Unbounded_String ("xxx"), To_Unbounded_String ("asd"), To_Unbounded_String ("xxy"), To_Unbounded_String ("john doe"), To_Unbounded_String ("xxxAAA"), To_Unbounded_String ("xxx")], "xxx") = [To_Unbounded_String ("xxx"), To_Unbounded_String ("xxxAAA"), To_Unbounded_String ("xxx")]);
end Main; | [
"\n end "
] |
HumanEval_30_get_positive | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Get_Positive (L : Integer_Array) return Integer_Array;
-- Return only positive numbers in the Vector.
-- >>> Get_Positive ([-1, 2, -4, 5, 6])
-- [2, 5, 6]
-- >>> Get_Positive ([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])
-- [5, 3, 2, 3, 9, 123, 1]
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Get_Positive (L : Integer_Array) return Integer_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_30_get_positive.py | reworded |
end Get_Positive;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (L : Integer_Array) return Integer_Array renames Placeholder.Get_Positive;
begin
pragma Assert (Candidate ([-1, -2, 4, 5, 6]) = [4, 5, 6]);
pragma Assert (Candidate ([5, 3, -5, 2, 3, 3, 9, 0, 123, 1, -10]) = [5, 3, 2, 3, 3, 9, 123, 1]);
pragma Assert (Candidate ([-1, -2]) = []);
pragma Assert (Candidate ([]) = []);
end Main; | [
"\n end "
] |
HumanEval_31_is_prime | adb | pragma Ada_2022;
package Placeholder is
function Is_Prime (N : Integer) return Boolean;
-- Return true if a given number is prime, and false otherwise.
-- >>> Is_Prime (6)
-- False
-- >>> Is_Prime (101)
-- True
-- >>> Is_Prime (11)
-- True
-- >>> Is_Prime (13441)
-- True
-- >>> Is_Prime (61)
-- True
-- >>> Is_Prime (4)
-- False
-- >>> Is_Prime (1)
-- False
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Is_Prime (N : Integer) return Boolean | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_31_is_prime.py | reworded |
end Is_Prime;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (N : Integer) return Boolean renames Placeholder.Is_Prime;
begin
pragma Assert (Candidate (6) = False);
pragma Assert (Candidate (101) = True);
pragma Assert (Candidate (11) = True);
pragma Assert (Candidate (13441) = True);
pragma Assert (Candidate (61) = True);
pragma Assert (Candidate (4) = False);
pragma Assert (Candidate (1) = False);
pragma Assert (Candidate (5) = True);
pragma Assert (Candidate (11) = True);
pragma Assert (Candidate (17) = True);
pragma Assert (Candidate (85) = False);
pragma Assert (Candidate (77) = False);
pragma Assert (Candidate (255379) = False);
end Main; | [
"\n end "
] |
HumanEval_33_sort_third | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Sort_Third (L : Integer_Array) return Integer_Array;
-- This function takes a Vector l and returns a Vector 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.
-- >>> Sort_Third ([1, 2, 3])
-- [1, 2, 3]
-- >>> Sort_Third ([5, 6, 3, 4, 8, 9, 2])
-- [2, 6, 3, 4, 8, 9, 5]
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Sort_Third (L : Integer_Array) return Integer_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_33_sort_third.py | reworded |
end Sort_Third;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (L : Integer_Array) return Integer_Array renames Placeholder.Sort_Third;
begin
pragma Assert (Candidate ([5, 6, 3, 4, 8, 9, 2]) = [2, 6, 3, 4, 8, 9, 5]);
pragma Assert (Candidate ([5, 8, 3, 4, 6, 9, 2]) = [2, 8, 3, 4, 6, 9, 5]);
pragma Assert (Candidate ([5, 6, 9, 4, 8, 3, 2]) = [2, 6, 9, 4, 8, 3, 5]);
pragma Assert (Candidate ([5, 6, 3, 4, 8, 9, 2, 1]) = [2, 6, 3, 4, 8, 9, 5, 1]);
end Main; | [
"\n end "
] |
HumanEval_34_unique | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Unique (L : Integer_Array) return Integer_Array;
-- Return sorted unique elements in a Vector
-- >>> Unique ([5, 3, 5, 2, 3, 3, 9, 0, 123])
-- [0, 2, 3, 5, 9, 123]
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Unique (L : Integer_Array) return Integer_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_34_unique.py | reworded |
end Unique;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (L : Integer_Array) return Integer_Array renames Placeholder.Unique;
begin
pragma Assert (Candidate ([5, 3, 5, 2, 3, 3, 9, 0, 123]) = [0, 2, 3, 5, 9, 123]);
end Main; | [
"\n end "
] |
HumanEval_35_max_element | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Max_Element (L : Integer_Array) return Integer;
-- Return maximum element in the Vector.
-- >>> Max_Element ([1, 2, 3])
-- 3
-- >>> Max_Element ([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])
-- 123
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Max_Element (L : Integer_Array) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_35_max_element.py | reworded |
end Max_Element;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (L : Integer_Array) return Integer renames Placeholder.Max_Element;
begin
pragma Assert (Candidate ([1, 2, 3]) = 3);
pragma Assert (Candidate ([5, 3, -5, 2, -3, 3, 9, 0, 124, 1, -10]) = 124);
end Main; | [
"\n end "
] |
HumanEval_36_fizz_buzz | adb | pragma Ada_2022;
package Placeholder is
function Fizz_Buzz (N : Integer) return Integer;
-- Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
-- >>> Fizz_Buzz (50)
-- 0
-- >>> Fizz_Buzz (78)
-- 2
-- >>> Fizz_Buzz (79)
-- 3
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Fizz_Buzz (N : Integer) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_36_fizz_buzz.py | reworded |
end Fizz_Buzz;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (N : Integer) return Integer renames Placeholder.Fizz_Buzz;
begin
pragma Assert (Candidate (50) = 0);
pragma Assert (Candidate (78) = 2);
pragma Assert (Candidate (79) = 3);
pragma Assert (Candidate (100) = 3);
pragma Assert (Candidate (200) = 6);
pragma Assert (Candidate (4000) = 192);
pragma Assert (Candidate (10000) = 639);
pragma Assert (Candidate (100000) = 8026);
end Main; | [
"\n end "
] |
HumanEval_37_sort_even | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Sort_Even (L : Integer_Array) return Integer_Array;
-- This function takes a Vector l and returns a Vector 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.
-- >>> Sort_Even ([1, 2, 3])
-- [1, 2, 3]
-- >>> Sort_Even ([5, 6, 3, 4])
-- [3, 6, 5, 4]
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Sort_Even (L : Integer_Array) return Integer_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_37_sort_even.py | reworded |
end Sort_Even;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (L : Integer_Array) return Integer_Array renames Placeholder.Sort_Even;
begin
pragma Assert (Candidate ([1, 2, 3]) = [1, 2, 3]);
pragma Assert (Candidate ([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) = [-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]);
pragma Assert (Candidate ([5, 8, -12, 4, 23, 2, 3, 11, 12, -10]) = [-12, 8, 3, 4, 5, 2, 12, 11, 23, -10]);
end Main; | [
"\n end "
] |
HumanEval_39_prime_fib | adb | pragma Ada_2022;
package Placeholder is
function Prime_Fib (N : Integer) return Integer;
-- prime_fib returns n-th number that is a Fibonacci number and it's also prime.
-- >>> Prime_Fib (1)
-- 2
-- >>> Prime_Fib (2)
-- 3
-- >>> Prime_Fib (3)
-- 5
-- >>> Prime_Fib (4)
-- 13
-- >>> Prime_Fib (5)
-- 89
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Prime_Fib (N : Integer) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_39_prime_fib.py | reworded |
end Prime_Fib;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (N : Integer) return Integer renames Placeholder.Prime_Fib;
begin
pragma Assert (Candidate (1) = 2);
pragma Assert (Candidate (2) = 3);
pragma Assert (Candidate (3) = 5);
pragma Assert (Candidate (4) = 13);
pragma Assert (Candidate (5) = 89);
pragma Assert (Candidate (6) = 233);
pragma Assert (Candidate (7) = 1597);
pragma Assert (Candidate (8) = 28657);
pragma Assert (Candidate (9) = 514229);
pragma Assert (Candidate (10) = 433494437);
end Main; | [
"\n end "
] |
HumanEval_40_triples_sum_to_zero | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Triples_Sum_To_Zero (L : Integer_Array) return Boolean;
-- triples_sum_to_zero takes a Vector of integers as an input.
-- it returns True if there are three distinct elements in the Vector that
-- sum to zero, and False otherwise.
-- >>> Triples_Sum_To_Zero ([1, 3, 5, 0])
-- False
-- >>> Triples_Sum_To_Zero ([1, 3, -2, 1])
-- True
-- >>> Triples_Sum_To_Zero ([1, 2, 3, 7])
-- False
-- >>> Triples_Sum_To_Zero ([2, 4, -5, 3, 9, 7])
-- True
-- >>> Triples_Sum_To_Zero ([1])
-- False
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Triples_Sum_To_Zero (L : Integer_Array) return Boolean | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_40_triples_sum_to_zero.py | reworded |
end Triples_Sum_To_Zero;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (L : Integer_Array) return Boolean renames Placeholder.Triples_Sum_To_Zero;
begin
pragma Assert (Candidate ([1, 3, 5, 0]) = False);
pragma Assert (Candidate ([1, 3, 5, -1]) = False);
pragma Assert (Candidate ([1, 3, -2, 1]) = True);
pragma Assert (Candidate ([1, 2, 3, 7]) = False);
pragma Assert (Candidate ([1, 2, 5, 7]) = False);
pragma Assert (Candidate ([2, 4, -5, 3, 9, 7]) = True);
pragma Assert (Candidate ([1]) = False);
pragma Assert (Candidate ([1, 3, 5, -100]) = False);
pragma Assert (Candidate ([100, 3, 5, -100]) = False);
end Main; | [
"\n end "
] |
HumanEval_41_car_race_collision | adb | pragma Ada_2022;
package Placeholder is
function Car_Race_Collision (N : Integer) return Integer;
-- 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.
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Car_Race_Collision (N : Integer) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_41_car_race_collision.py | reworded |
end Car_Race_Collision;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (N : Integer) return Integer renames Placeholder.Car_Race_Collision;
begin
pragma Assert (Candidate (2) = 4);
pragma Assert (Candidate (3) = 9);
pragma Assert (Candidate (4) = 16);
pragma Assert (Candidate (8) = 64);
pragma Assert (Candidate (10) = 100);
end Main; | [
"\n end "
] |
HumanEval_42_incr_list | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Incr_List (L : Integer_Array) return Integer_Array;
-- Return Vector with elements incremented by 1.
-- >>> Incr_List ([1, 2, 3])
-- [2, 3, 4]
-- >>> Incr_List ([5, 3, 5, 2, 3, 3, 9, 0, 123])
-- [6, 4, 6, 3, 4, 4, 10, 1, 124]
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Incr_List (L : Integer_Array) return Integer_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_42_incr_list.py | reworded |
end Incr_List;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (L : Integer_Array) return Integer_Array renames Placeholder.Incr_List;
begin
pragma Assert (Candidate ([]) = []);
pragma Assert (Candidate ([3, 2, 1]) = [4, 3, 2]);
pragma Assert (Candidate ([5, 2, 5, 2, 3, 3, 9, 0, 123]) = [6, 3, 6, 3, 4, 4, 10, 1, 124]);
end Main; | [
"\n end "
] |
HumanEval_43_pairs_sum_to_zero | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Pairs_Sum_To_Zero (L : Integer_Array) return Boolean;
-- pairs_sum_to_zero takes a Vector of integers as an input.
-- it returns True if there are two distinct elements in the Vector that
-- sum to zero, and False otherwise.
-- >>> Pairs_Sum_To_Zero ([1, 3, 5, 0])
-- False
-- >>> Pairs_Sum_To_Zero ([1, 3, -2, 1])
-- False
-- >>> Pairs_Sum_To_Zero ([1, 2, 3, 7])
-- False
-- >>> Pairs_Sum_To_Zero ([2, 4, -5, 3, 5, 7])
-- True
-- >>> Pairs_Sum_To_Zero ([1])
-- False
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Pairs_Sum_To_Zero (L : Integer_Array) return Boolean | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_43_pairs_sum_to_zero.py | reworded |
end Pairs_Sum_To_Zero;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (L : Integer_Array) return Boolean renames Placeholder.Pairs_Sum_To_Zero;
begin
pragma Assert (Candidate ([1, 3, 5, 0]) = False);
pragma Assert (Candidate ([1, 3, -2, 1]) = False);
pragma Assert (Candidate ([1, 2, 3, 7]) = False);
pragma Assert (Candidate ([2, 4, -5, 3, 5, 7]) = True);
pragma Assert (Candidate ([1]) = False);
pragma Assert (Candidate ([-3, 9, -1, 3, 2, 30]) = True);
pragma Assert (Candidate ([-3, 9, -1, 3, 2, 31]) = True);
pragma Assert (Candidate ([-3, 9, -1, 4, 2, 30]) = False);
pragma Assert (Candidate ([-3, 9, -1, 4, 2, 31]) = False);
end Main; | [
"\n end "
] |
HumanEval_44_change_base | adb | pragma Ada_2022;
package Placeholder is
function Change_Base (X : Integer; Base : Integer) return String;
-- Change numerical base of input number x to base.
-- return string representation after the conversion.
-- base numbers are less than 10.
-- >>> Change_Base (8, 3)
-- "22"
-- >>> Change_Base (8, 2)
-- "1000"
-- >>> Change_Base (7, 2)
-- "111"
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Change_Base (X : Integer; Base : Integer) return String | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_44_change_base.py | reworded |
end Change_Base;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (X : Integer; Base : Integer) return String renames Placeholder.Change_Base;
begin
pragma Assert (Candidate (8, 3) = "22");
pragma Assert (Candidate (9, 3) = "100");
pragma Assert (Candidate (234, 2) = "11101010");
pragma Assert (Candidate (16, 2) = "10000");
pragma Assert (Candidate (8, 2) = "1000");
pragma Assert (Candidate (7, 2) = "111");
pragma Assert (Candidate (2, 3) = "2");
pragma Assert (Candidate (3, 4) = "3");
pragma Assert (Candidate (4, 5) = "4");
pragma Assert (Candidate (5, 6) = "5");
pragma Assert (Candidate (6, 7) = "6");
pragma Assert (Candidate (7, 8) = "7");
end Main; | [
"\n end "
] |
HumanEval_45_triangle_area | adb | pragma Ada_2022;
package Placeholder is
function Triangle_Area (A : Integer; H : Integer) return Float;
-- Given length of a side and high return area for a triangle.
-- >>> Triangle_Area (5, 3)
-- 7.5
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Triangle_Area (A : Integer; H : Integer) return Float | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_45_triangle_area.py | reworded |
end Triangle_Area;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (A : Integer; H : Integer) return Float renames Placeholder.Triangle_Area;
begin
pragma Assert (Candidate (5, 3) = 7.5);
pragma Assert (Candidate (2, 2) = 2.0);
pragma Assert (Candidate (10, 8) = 40.0);
end Main; | [
"\n end "
] |
HumanEval_46_fib4 | adb | pragma Ada_2022;
package Placeholder is
function Fib4 (N : Integer) return Integer;
-- 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 (5)
-- 4
-- >>> Fib4 (6)
-- 8
-- >>> Fib4 (7)
-- 14
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Fib4 (N : Integer) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_46_fib4.py | reworded |
end Fib4;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (N : Integer) return Integer renames Placeholder.Fib4;
begin
pragma Assert (Candidate (5) = 4);
pragma Assert (Candidate (8) = 28);
pragma Assert (Candidate (10) = 104);
pragma Assert (Candidate (12) = 386);
end Main; | [
"\n end "
] |
HumanEval_47_median | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Median (L : Integer_Array) return Float;
-- Return median of elements in the Vector l.
-- >>> Median ([3, 1, 2, 4, 5])
-- 3
-- >>> Median ([-10, 4, 6, 1000, 10, 20])
-- 15.0
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Median (L : Integer_Array) return Float | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_47_median.py | reworded |
end Median;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (L : Integer_Array) return Float renames Placeholder.Median;
begin
pragma Assert (Candidate ([3, 1, 2, 4, 5]) = 3);
pragma Assert (Candidate ([-10, 4, 6, 1000, 10, 20]) = 8.0);
pragma Assert (Candidate ([5]) = 5);
pragma Assert (Candidate ([6, 5]) = 5.5);
pragma Assert (Candidate ([8, 1, 3, 9, 9, 2, 7]) = 7);
end Main; | [
"\n end "
] |
HumanEval_48_is_palindrome | adb | pragma Ada_2022;
package Placeholder is
function Is_Palindrome (Text : String) return Boolean;
-- Checks if given string is a palindrome
-- >>> Is_Palindrome ("")
-- True
-- >>> Is_Palindrome ("aba")
-- True
-- >>> Is_Palindrome ("aaaaa")
-- True
-- >>> Is_Palindrome ("zbcd")
-- False
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Is_Palindrome (Text : String) return Boolean | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_48_is_palindrome.py | reworded |
end Is_Palindrome;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Text : String) return Boolean renames Placeholder.Is_Palindrome;
begin
pragma Assert (Candidate ("") = True);
pragma Assert (Candidate ("aba") = True);
pragma Assert (Candidate ("aaaaa") = True);
pragma Assert (Candidate ("zbcd") = False);
pragma Assert (Candidate ("xywyx") = True);
pragma Assert (Candidate ("xywyz") = False);
pragma Assert (Candidate ("xywzx") = False);
end Main; | [
"\n end "
] |
HumanEval_49_modp | adb | pragma Ada_2022;
package Placeholder is
function Modp (N : Integer; P : Integer) return Integer;
-- Return 2^n modulo p (be aware of numerics).
-- >>> Modp (3, 5)
-- 3
-- >>> Modp (1101, 101)
-- 2
-- >>> Modp (0, 101)
-- 1
-- >>> Modp (3, 11)
-- 8
-- >>> Modp (100, 101)
-- 1
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Modp (N : Integer; P : Integer) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_49_modp.py | reworded |
end Modp;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (N : Integer; P : Integer) return Integer renames Placeholder.Modp;
begin
pragma Assert (Candidate (3, 5) = 3);
pragma Assert (Candidate (1101, 101) = 2);
pragma Assert (Candidate (0, 101) = 1);
pragma Assert (Candidate (3, 11) = 8);
pragma Assert (Candidate (100, 101) = 1);
pragma Assert (Candidate (30, 5) = 4);
pragma Assert (Candidate (31, 5) = 3);
end Main; | [
"\n end "
] |
HumanEval_51_remove_vowels | adb | pragma Ada_2022;
package Placeholder is
function Remove_Vowels (Text : String) return String;
-- remove_vowels is a function that takes string and returns string without vowels.
-- >>> Remove_Vowels ("")
-- ""
-- >>> Remove_Vowels ("abcdef")
-- "bcdf"
-- >>> Remove_Vowels ("aaaaa")
-- ""
-- >>> Remove_Vowels ("aaBAA")
-- "B"
-- >>> Remove_Vowels ("zbcd")
-- "zbcd"
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Remove_Vowels (Text : String) return String | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_51_remove_vowels.py | reworded |
end Remove_Vowels;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Text : String) return String renames Placeholder.Remove_Vowels;
begin
pragma Assert (Candidate ("") = "");
pragma Assert (Candidate ("abcdef
ghijklm") = "bcdf
ghjklm");
pragma Assert (Candidate ("fedcba") = "fdcb");
pragma Assert (Candidate ("eeeee") = "");
pragma Assert (Candidate ("acBAA") = "cB");
pragma Assert (Candidate ("EcBOO") = "cB");
pragma Assert (Candidate ("ybcd") = "ybcd");
end Main; | [
"\n end "
] |
HumanEval_52_below_threshold | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Below_Threshold (L : Integer_Array; T : Integer) return Boolean;
-- Return True if all numbers in the Vector l are below threshold t.
-- >>> Below_Threshold ([1, 2, 4, 10], 100)
-- True
-- >>> Below_Threshold ([1, 20, 4, 10], 5)
-- False
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Below_Threshold (L : Integer_Array; T : Integer) return Boolean | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_52_below_threshold.py | reworded |
end Below_Threshold;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (L : Integer_Array; T : Integer) return Boolean renames Placeholder.Below_Threshold;
begin
pragma Assert (Candidate ([1, 2, 4, 10], 100) = True);
pragma Assert (Candidate ([1, 20, 4, 10], 5) = False);
pragma Assert (Candidate ([1, 20, 4, 10], 21) = True);
pragma Assert (Candidate ([1, 20, 4, 10], 22) = True);
pragma Assert (Candidate ([1, 8, 4, 10], 11) = True);
pragma Assert (Candidate ([1, 8, 4, 10], 10) = False);
end Main; | [
"\n end "
] |
HumanEval_53_add | adb | pragma Ada_2022;
package Placeholder is
function Add (X : Integer; Y : Integer) return Integer;
-- Add two numbers x and y
-- >>> Add (2, 3)
-- 5
-- >>> Add (5, 7)
-- 12
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Add (X : Integer; Y : Integer) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_53_add.py | reworded |
end Add;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (X : Integer; Y : Integer) return Integer renames Placeholder.Add;
begin
pragma Assert (Candidate (0, 1) = 1);
pragma Assert (Candidate (1, 0) = 1);
pragma Assert (Candidate (2, 3) = 5);
pragma Assert (Candidate (5, 7) = 12);
pragma Assert (Candidate (7, 5) = 12);
end Main; | [
"\n end "
] |
HumanEval_54_same_chars | adb | pragma Ada_2022;
package Placeholder is
function Same_Chars (S0 : String; S1 : String) return Boolean;
-- Check if two words have the same characters.
-- >>> Same_Chars ("eabcdzzzz", "dddzzzzzzzddeddabc")
-- True
-- >>> Same_Chars ("abcd", "dddddddabc")
-- True
-- >>> Same_Chars ("dddddddabc", "abcd")
-- True
-- >>> Same_Chars ("eabcd", "dddddddabc")
-- False
-- >>> Same_Chars ("abcd", "dddddddabce")
-- False
-- >>> Same_Chars ("eabcdzzzz", "dddzzzzzzzddddabc")
-- False
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Same_Chars (S0 : String; S1 : String) return Boolean | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_54_same_chars.py | reworded |
end Same_Chars;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (S0 : String; S1 : String) return Boolean renames Placeholder.Same_Chars;
begin
pragma Assert (Candidate ("eabcdzzzz", "dddzzzzzzzddeddabc") = True);
pragma Assert (Candidate ("abcd", "dddddddabc") = True);
pragma Assert (Candidate ("dddddddabc", "abcd") = True);
pragma Assert (Candidate ("eabcd", "dddddddabc") = False);
pragma Assert (Candidate ("abcd", "dddddddabcf") = False);
pragma Assert (Candidate ("eabcdzzzz", "dddzzzzzzzddddabc") = False);
pragma Assert (Candidate ("aabb", "aaccc") = False);
end Main; | [
"\n end "
] |
HumanEval_55_fib | adb | pragma Ada_2022;
package Placeholder is
function Fib (N : Integer) return Integer;
-- Return n-th Fibonacci number.
-- >>> Fib (10)
-- 55
-- >>> Fib (1)
-- 1
-- >>> Fib (8)
-- 21
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Fib (N : Integer) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_55_fib.py | reworded |
end Fib;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (N : Integer) return Integer renames Placeholder.Fib;
begin
pragma Assert (Candidate (10) = 55);
pragma Assert (Candidate (1) = 1);
pragma Assert (Candidate (8) = 21);
pragma Assert (Candidate (11) = 89);
pragma Assert (Candidate (12) = 144);
end Main; | [
"\n end "
] |
HumanEval_56_correct_bracketing | adb | pragma Ada_2022;
package Placeholder is
function Correct_Bracketing (Brackets : String) return Boolean;
-- brackets is a string of "<" and ">".
-- return True if every opening bracket has a corresponding closing bracket.
-- >>> Correct_Bracketing ("<")
-- False
-- >>> Correct_Bracketing ("<>")
-- True
-- >>> Correct_Bracketing ("<<><>>")
-- True
-- >>> Correct_Bracketing ("><<>")
-- False
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Correct_Bracketing (Brackets : String) return Boolean | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_56_correct_bracketing.py | reworded |
end Correct_Bracketing;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Brackets : String) return Boolean renames Placeholder.Correct_Bracketing;
begin
pragma Assert (Candidate ("<>") = True);
pragma Assert (Candidate ("<<><>>") = True);
pragma Assert (Candidate ("<><><<><>><>") = True);
pragma Assert (Candidate ("<><><<<><><>><>><<><><<>>>") = True);
pragma Assert (Candidate ("<<<><>>>>") = False);
pragma Assert (Candidate ("><<>") = False);
pragma Assert (Candidate ("<") = False);
pragma Assert (Candidate ("<<<<") = False);
pragma Assert (Candidate (">") = False);
pragma Assert (Candidate ("<<>") = False);
pragma Assert (Candidate ("<><><<><>><>><<>") = False);
pragma Assert (Candidate ("<><><<><>><>>><>") = False);
end Main; | [
"\n end "
] |
HumanEval_57_monotonic | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Monotonic (L : Integer_Array) return Boolean;
-- Return True is Vector elements are monotonically increasing or decreasing.
-- >>> Monotonic ([1, 2, 4, 20])
-- True
-- >>> Monotonic ([1, 20, 4, 10])
-- False
-- >>> Monotonic ([4, 1, 0, -10])
-- True
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Monotonic (L : Integer_Array) return Boolean | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_57_monotonic.py | reworded |
end Monotonic;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (L : Integer_Array) return Boolean renames Placeholder.Monotonic;
begin
pragma Assert (Candidate ([1, 2, 4, 10]) = True);
pragma Assert (Candidate ([1, 2, 4, 20]) = True);
pragma Assert (Candidate ([1, 20, 4, 10]) = False);
pragma Assert (Candidate ([4, 1, 0, -10]) = True);
pragma Assert (Candidate ([4, 1, 1, 0]) = True);
pragma Assert (Candidate ([1, 2, 3, 2, 5, 60]) = False);
pragma Assert (Candidate ([1, 2, 3, 4, 5, 60]) = True);
pragma Assert (Candidate ([9, 9, 9, 9]) = True);
end Main; | [
"\n end "
] |
HumanEval_58_common | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Common (L1 : Integer_Array; L2 : Integer_Array) return Integer_Array;
-- Return sorted unique common elements for two Vectors.
-- >>> Common ([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121])
-- [1, 5, 653]
-- >>> Common ([5, 3, 2, 8], [3, 2])
-- [2, 3]
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Common (L1 : Integer_Array; L2 : Integer_Array) return Integer_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_58_common.py | reworded |
end Common;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (L1 : Integer_Array; L2 : Integer_Array) return Integer_Array renames Placeholder.Common;
begin
pragma Assert (Candidate ([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121]) = [1, 5, 653]);
pragma Assert (Candidate ([5, 3, 2, 8], [3, 2]) = [2, 3]);
pragma Assert (Candidate ([4, 3, 2, 8], [3, 2, 4]) = [2, 3, 4]);
pragma Assert (Candidate ([4, 3, 2, 8], []) = []);
end Main; | [
"\n end "
] |
HumanEval_59_largest_prime_factor | adb | pragma Ada_2022;
package Placeholder is
function Largest_Prime_Factor (N : Integer) return Integer;
-- Return the largest prime factor of n. Assume n > 1 and is not a prime.
-- >>> Largest_Prime_Factor (13195)
-- 29
-- >>> Largest_Prime_Factor (2048)
-- 2
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Largest_Prime_Factor (N : Integer) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_59_largest_prime_factor.py | reworded |
end Largest_Prime_Factor;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (N : Integer) return Integer renames Placeholder.Largest_Prime_Factor;
begin
pragma Assert (Candidate (15) = 5);
pragma Assert (Candidate (27) = 3);
pragma Assert (Candidate (63) = 7);
pragma Assert (Candidate (330) = 11);
pragma Assert (Candidate (13195) = 29);
end Main; | [
"\n end "
] |
HumanEval_60_sum_to_n | adb | pragma Ada_2022;
package Placeholder is
function Sum_To_N (N : Integer) return Integer;
-- sum_to_n is a function that sums numbers from 1 to n.
-- >>> Sum_To_N (30)
-- 465
-- >>> Sum_To_N (100)
-- 5050
-- >>> Sum_To_N (5)
-- 15
-- >>> Sum_To_N (10)
-- 55
-- >>> Sum_To_N (1)
-- 1
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Sum_To_N (N : Integer) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_60_sum_to_n.py | reworded |
end Sum_To_N;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (N : Integer) return Integer renames Placeholder.Sum_To_N;
begin
pragma Assert (Candidate (1) = 1);
pragma Assert (Candidate (6) = 21);
pragma Assert (Candidate (11) = 66);
pragma Assert (Candidate (30) = 465);
pragma Assert (Candidate (100) = 5050);
end Main; | [
"\n end "
] |
HumanEval_61_correct_bracketing | adb | pragma Ada_2022;
package Placeholder is
function Correct_Bracketing (Brackets : String) return Boolean;
-- brackets is a string of "(" and ")".
-- return True if every opening bracket has a corresponding closing bracket.
-- >>> Correct_Bracketing ("(")
-- False
-- >>> Correct_Bracketing ("()")
-- True
-- >>> Correct_Bracketing ("(()())")
-- True
-- >>> Correct_Bracketing (")(()")
-- False
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Correct_Bracketing (Brackets : String) return Boolean | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_61_correct_bracketing.py | reworded |
end Correct_Bracketing;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Brackets : String) return Boolean renames Placeholder.Correct_Bracketing;
begin
pragma Assert (Candidate ("()") = True);
pragma Assert (Candidate ("(()())") = True);
pragma Assert (Candidate ("()()(()())()") = True);
pragma Assert (Candidate ("()()((()()())())(()()(()))") = True);
pragma Assert (Candidate ("((()())))") = False);
pragma Assert (Candidate (")(()") = False);
pragma Assert (Candidate ("(") = False);
pragma Assert (Candidate ("((((") = False);
pragma Assert (Candidate (")") = False);
pragma Assert (Candidate ("(()") = False);
pragma Assert (Candidate ("()()(()())())(()") = False);
pragma Assert (Candidate ("()()(()())()))()") = False);
end Main; | [
"\n end "
] |
HumanEval_62_derivative | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Derivative (Xs : Integer_Array) return Integer_Array;
-- 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 ([3, 1, 2, 4, 5])
-- [1, 4, 12, 20]
-- >>> Derivative ([1, 2, 3])
-- [2, 6]
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Derivative (Xs : Integer_Array) return Integer_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_62_derivative.py | reworded |
end Derivative;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Xs : Integer_Array) return Integer_Array renames Placeholder.Derivative;
begin
pragma Assert (Candidate ([3, 1, 2, 4, 5]) = [1, 4, 12, 20]);
pragma Assert (Candidate ([1, 2, 3]) = [2, 6]);
pragma Assert (Candidate ([3, 2, 1]) = [2, 2]);
pragma Assert (Candidate ([3, 2, 1, 0, 4]) = [2, 2, 0, 16]);
pragma Assert (Candidate ([1]) = []);
end Main; | [
"\n end "
] |
HumanEval_63_fibfib | adb | pragma Ada_2022;
package Placeholder is
function Fibfib (N : Integer) return Integer;
-- 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 (1)
-- 0
-- >>> Fibfib (5)
-- 4
-- >>> Fibfib (8)
-- 24
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Fibfib (N : Integer) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_63_fibfib.py | reworded |
end Fibfib;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (N : Integer) return Integer renames Placeholder.Fibfib;
begin
pragma Assert (Candidate (2) = 1);
pragma Assert (Candidate (1) = 0);
pragma Assert (Candidate (5) = 4);
pragma Assert (Candidate (8) = 24);
pragma Assert (Candidate (10) = 81);
pragma Assert (Candidate (12) = 274);
pragma Assert (Candidate (14) = 927);
end Main; | [
"\n end "
] |
HumanEval_64_vowels_count | adb | pragma Ada_2022;
package Placeholder is
function Vowels_Count (S : String) return Integer;
-- 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:
-- >>> Vowels_Count ("abcde")
-- 2
-- >>> Vowels_Count ("ACEDY")
-- 3
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Vowels_Count (S : String) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_64_vowels_count.py | reworded |
end Vowels_Count;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (S : String) return Integer renames Placeholder.Vowels_Count;
begin
pragma Assert (Candidate ("abcde") = 2);
pragma Assert (Candidate ("Alone") = 3);
pragma Assert (Candidate ("key") = 2);
pragma Assert (Candidate ("bye") = 1);
pragma Assert (Candidate ("keY") = 2);
pragma Assert (Candidate ("bYe") = 1);
pragma Assert (Candidate ("ACEDY") = 3);
end Main; | [
"\n end "
] |
HumanEval_65_circular_shift | adb | pragma Ada_2022;
package Placeholder is
function Circular_Shift (X : Integer; Shift : Integer) return String;
-- 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.
-- >>> Circular_Shift (12, 1)
-- "21"
-- >>> Circular_Shift (12, 2)
-- "12"
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Circular_Shift (X : Integer; Shift : Integer) return String | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_65_circular_shift.py | reworded |
end Circular_Shift;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (X : Integer; Shift : Integer) return String renames Placeholder.Circular_Shift;
begin
pragma Assert (Candidate (100, 2) = "001");
pragma Assert (Candidate (12, 2) = "12");
pragma Assert (Candidate (97, 8) = "79");
pragma Assert (Candidate (12, 1) = "21");
pragma Assert (Candidate (11, 101) = "11");
end Main; | [
"\n end "
] |
HumanEval_66_digitSum | adb | pragma Ada_2022;
package Placeholder is
function Digit_Sum (S : String) return Integer;
-- Task
-- Write a function that takes a string as input and returns the sum of the upper characters only'
-- ASCII codes.
-- Examples:
-- >>> Digitsum ("")
-- 0
-- >>> Digitsum ("abAB")
-- 131
-- >>> Digitsum ("abcCd")
-- 67
-- >>> Digitsum ("helloE")
-- 69
-- >>> Digitsum ("woArBld")
-- 131
-- >>> Digitsum ("aAaaaXa")
-- 153
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Digit_Sum (S : String) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_66_digitSum.py | reworded |
end Digit_Sum;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (S : String) return Integer renames Placeholder.Digit_Sum;
begin
pragma Assert (Candidate ("") = 0);
pragma Assert (Candidate ("abAB") = 131);
pragma Assert (Candidate ("abcCd") = 67);
pragma Assert (Candidate ("helloE") = 69);
pragma Assert (Candidate ("woArBld") = 131);
pragma Assert (Candidate ("aAaaaXa") = 153);
pragma Assert (Candidate (" How are yOu?") = 151);
pragma Assert (Candidate ("You arE Very Smart") = 327);
end Main; | [
"\n end "
] |
HumanEval_67_fruit_distribution | adb | pragma Ada_2022;
package Placeholder is
function Fruit_Distribution (S : String; N : Integer) return Integer;
-- 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:
-- >>> Fruit_Distribution ("5 apples and 6 oranges", 19)
-- 8
-- >>> Fruit_Distribution ("0 apples and 1 oranges", 3)
-- 2
-- >>> Fruit_Distribution ("2 apples and 3 oranges", 100)
-- 95
-- >>> Fruit_Distribution ("100 apples and 1 oranges", 120)
-- 19
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Fruit_Distribution (S : String; N : Integer) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_67_fruit_distribution.py | reworded |
end Fruit_Distribution;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (S : String; N : Integer) return Integer renames Placeholder.Fruit_Distribution;
begin
pragma Assert (Candidate ("5 apples and 6 oranges", 19) = 8);
pragma Assert (Candidate ("5 apples and 6 oranges", 21) = 10);
pragma Assert (Candidate ("0 apples and 1 oranges", 3) = 2);
pragma Assert (Candidate ("1 apples and 0 oranges", 3) = 2);
pragma Assert (Candidate ("2 apples and 3 oranges", 100) = 95);
pragma Assert (Candidate ("2 apples and 3 oranges", 5) = 0);
pragma Assert (Candidate ("1 apples and 100 oranges", 120) = 19);
end Main; | [
"\n end "
] |
HumanEval_68_pluck | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Pluck (Arr : Integer_Array) return Integer_Array;
-- "Given an array 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 a Vector, [ smalest_value, its index ],
-- If there are no even values or the given array is empty, return [].
-- Example 1:
-- >>> Pluck ([4, 2, 3])
-- [2, 1]
-- Explanation: 2 has the smallest even value, and 2 has the smallest index.
-- Example 2:
-- >>> Pluck ([1, 2, 3])
-- [2, 1]
-- Explanation: 2 has the smallest even value, and 2 has the smallest index.
-- Example 3:
-- >>> Pluck ([])
-- []
-- Example 4:
-- >>> Pluck ([5, 0, 3, 0, 4, 2])
-- [0, 1]
-- 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
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Pluck (Arr : Integer_Array) return Integer_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_68_pluck.py | reworded |
end Pluck;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Arr : Integer_Array) return Integer_Array renames Placeholder.Pluck;
begin
pragma Assert (Candidate ([4, 2, 3]) = [2, 1]);
pragma Assert (Candidate ([1, 2, 3]) = [2, 1]);
pragma Assert (Candidate ([]) = []);
pragma Assert (Candidate ([5, 0, 3, 0, 4, 2]) = [0, 1]);
pragma Assert (Candidate ([1, 2, 3, 0, 5, 3]) = [0, 3]);
pragma Assert (Candidate ([5, 4, 8, 4, 8]) = [4, 1]);
pragma Assert (Candidate ([7, 6, 7, 1]) = [6, 1]);
pragma Assert (Candidate ([7, 9, 7, 1]) = []);
end Main; | [
"\n end "
] |
HumanEval_69_search | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Search (Lst : Integer_Array) return Integer;
-- You are given a non-empty Vector 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 Vector.
-- If no such a value exist, return -1.
-- Examples:
-- >>> Search ([4, 1, 2, 2, 3, 1])
-- 2
-- >>> Search ([1, 2, 2, 3, 3, 3, 4, 4, 4])
-- 3
-- >>> Search ([5, 5, 4, 4, 4])
-- -1
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Search (Lst : Integer_Array) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_69_search.py | reworded |
end Search;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Lst : Integer_Array) return Integer renames Placeholder.Search;
begin
pragma Assert (Candidate ([5, 5, 5, 5, 1]) = 1);
pragma Assert (Candidate ([4, 1, 4, 1, 4, 4]) = 4);
pragma Assert (Candidate ([3, 3]) = -1);
pragma Assert (Candidate ([8, 8, 8, 8, 8, 8, 8, 8]) = 8);
pragma Assert (Candidate ([2, 3, 3, 2, 2]) = 2);
pragma Assert (Candidate ([2, 7, 8, 8, 4, 8, 7, 3, 9, 6, 5, 10, 4, 3, 6, 7, 1, 7, 4, 10, 8, 1]) = 1);
pragma Assert (Candidate ([3, 2, 8, 2]) = 2);
pragma Assert (Candidate ([6, 7, 1, 8, 8, 10, 5, 8, 5, 3, 10]) = 1);
pragma Assert (Candidate ([8, 8, 3, 6, 5, 6, 4]) = -1);
pragma Assert (Candidate ([6, 9, 6, 7, 1, 4, 7, 1, 8, 8, 9, 8, 10, 10, 8, 4, 10, 4, 10, 1, 2, 9, 5, 7, 9]) = 1);
pragma Assert (Candidate ([1, 9, 10, 1, 3]) = 1);
pragma Assert (Candidate ([6, 9, 7, 5, 8, 7, 5, 3, 7, 5, 10, 10, 3, 6, 10, 2, 8, 6, 5, 4, 9, 5, 3, 10]) = 5);
pragma Assert (Candidate ([1]) = 1);
pragma Assert (Candidate ([8, 8, 10, 6, 4, 3, 5, 8, 2, 4, 2, 8, 4, 6, 10, 4, 2, 1, 10, 2, 1, 1, 5]) = 4);
pragma Assert (Candidate ([2, 10, 4, 8, 2, 10, 5, 1, 2, 9, 5, 5, 6, 3, 8, 6, 4, 10]) = 2);
pragma Assert (Candidate ([1, 6, 10, 1, 6, 9, 10, 8, 6, 8, 7, 3]) = 1);
pragma Assert (Candidate ([9, 2, 4, 1, 5, 1, 5, 2, 5, 7, 7, 7, 3, 10, 1, 5, 4, 2, 8, 4, 1, 9, 10, 7, 10, 2, 8, 10, 9, 4]) = 4);
pragma Assert (Candidate ([2, 6, 4, 2, 8, 7, 5, 6, 4, 10, 4, 6, 3, 7, 8, 8, 3, 1, 4, 2, 2, 10, 7]) = 4);
pragma Assert (Candidate ([9, 8, 6, 10, 2, 6, 10, 2, 7, 8, 10, 3, 8, 2, 6, 2, 3, 1]) = 2);
pragma Assert (Candidate ([5, 5, 3, 9, 5, 6, 3, 2, 8, 5, 6, 10, 10, 6, 8, 4, 10, 7, 7, 10, 8]) = -1);
pragma Assert (Candidate ([10]) = -1);
pragma Assert (Candidate ([9, 7, 7, 2, 4, 7, 2, 10, 9, 7, 5, 7, 2]) = 2);
pragma Assert (Candidate ([5, 4, 10, 2, 1, 1, 10, 3, 6, 1, 8]) = 1);
pragma Assert (Candidate ([7, 9, 9, 9, 3, 4, 1, 5, 9, 1, 2, 1, 1, 10, 7, 5, 6, 7, 6, 7, 7, 6]) = 1);
pragma Assert (Candidate ([3, 10, 10, 9, 2]) = -1);
end Main; | [
"\n end "
] |
HumanEval_70_strange_sort_list | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Strange_Sort_List (Lst : Integer_Array) return Integer_Array;
-- Given Vector of integers, return Vector 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:
-- >>> Strange_Sort_List ([1, 2, 3, 4])
-- [1, 4, 2, 3]
-- >>> Strange_Sort_List ([5, 5, 5, 5])
-- [5, 5, 5, 5]
-- >>> Strange_Sort_List ([])
-- []
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Strange_Sort_List (Lst : Integer_Array) return Integer_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_70_strange_sort_list.py | reworded |
end Strange_Sort_List;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Lst : Integer_Array) return Integer_Array renames Placeholder.Strange_Sort_List;
begin
pragma Assert (Candidate ([1, 2, 3, 4]) = [1, 4, 2, 3]);
pragma Assert (Candidate ([5, 6, 7, 8, 9]) = [5, 9, 6, 8, 7]);
pragma Assert (Candidate ([1, 2, 3, 4, 5]) = [1, 5, 2, 4, 3]);
pragma Assert (Candidate ([5, 6, 7, 8, 9, 1]) = [1, 9, 5, 8, 6, 7]);
pragma Assert (Candidate ([5, 5, 5, 5]) = [5, 5, 5, 5]);
pragma Assert (Candidate ([]) = []);
pragma Assert (Candidate ([1, 2, 3, 4, 5, 6, 7, 8]) = [1, 8, 2, 7, 3, 6, 4, 5]);
pragma Assert (Candidate ([0, 2, 2, 2, 5, 5, -5, -5]) = [-5, 5, -5, 5, 0, 2, 2, 2]);
pragma Assert (Candidate ([111111]) = [111111]);
end Main; | [
"\n end "
] |
HumanEval_71_triangle_area | adb | pragma Ada_2022;
package Placeholder is
function Triangle_Area (A : Integer; B : Integer; C : Integer) return Float;
-- 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:
-- >>> Triangle_Area (3, 4, 5)
-- 6.0
-- >>> Triangle_Area (1, 2, 10)
-- -1
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Triangle_Area (A : Integer; B : Integer; C : Integer) return Float | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_71_triangle_area.py | reworded |
end Triangle_Area;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (A : Integer; B : Integer; C : Integer) return Float renames Placeholder.Triangle_Area;
begin
pragma Assert (Candidate (3, 4, 5) = 6.0);
pragma Assert (Candidate (1, 2, 10) = -1);
pragma Assert (Candidate (4, 8, 5) = 8.18);
pragma Assert (Candidate (2, 2, 2) = 1.73);
pragma Assert (Candidate (1, 2, 3) = -1);
pragma Assert (Candidate (10, 5, 7) = 16.25);
pragma Assert (Candidate (2, 6, 3) = -1);
pragma Assert (Candidate (1, 1, 1) = 0.43);
pragma Assert (Candidate (2, 2, 10) = -1);
end Main; | [
"\n end "
] |
HumanEval_72_will_it_fly | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Will_It_Fly (Q : Integer_Array; W : Integer) return Boolean;
-- 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 Vector) and the sum of its elements is less than or equal the maximum possible weight w.
-- Example:
-- >>> Will_It_Fly ([1, 2], 5)
-- False
-- # 1+2 is less than the maximum possible weight, but it's unbalanced.
-- >>> Will_It_Fly ([3, 2, 3], 1)
-- False
-- # it's balanced, but 3+2+3 is more than the maximum possible weight.
-- >>> Will_It_Fly ([3, 2, 3], 9)
-- True
-- # 3+2+3 is less than the maximum possible weight, and it's balanced.
-- >>> Will_It_Fly ([3], 5)
-- True
-- # 3 is less than the maximum possible weight, and it's balanced.
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Will_It_Fly (Q : Integer_Array; W : Integer) return Boolean | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_72_will_it_fly.py | reworded |
end Will_It_Fly;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Q : Integer_Array; W : Integer) return Boolean renames Placeholder.Will_It_Fly;
begin
pragma Assert (Candidate ([3, 2, 3], 9) = True);
pragma Assert (Candidate ([1, 2], 5) = False);
pragma Assert (Candidate ([3], 5) = True);
pragma Assert (Candidate ([3, 2, 3], 1) = False);
pragma Assert (Candidate ([1, 2, 3], 6) = False);
pragma Assert (Candidate ([5], 5) = True);
end Main; | [
"\n end "
] |
HumanEval_73_smallest_change | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Smallest_Change (Arr : Integer_Array) return Integer;
-- Given an array arr of integers, find the minimum number of elements that
-- need to be changed to make the array palindromic. A palindromic array is an array that
-- is read the same backwards and forwards. In one change, you can change one element to any other element.
-- For example:
-- >>> Smallest_Change ([1, 2, 3, 5, 4, 7, 9, 6])
-- 4
-- >>> Smallest_Change ([1, 2, 3, 4, 3, 2, 2])
-- 1
-- >>> Smallest_Change ([1, 2, 3, 2, 1])
-- 0
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Smallest_Change (Arr : Integer_Array) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_73_smallest_change.py | reworded |
end Smallest_Change;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Arr : Integer_Array) return Integer renames Placeholder.Smallest_Change;
begin
pragma Assert (Candidate ([1, 2, 3, 5, 4, 7, 9, 6]) = 4);
pragma Assert (Candidate ([1, 2, 3, 4, 3, 2, 2]) = 1);
pragma Assert (Candidate ([1, 4, 2]) = 1);
pragma Assert (Candidate ([1, 4, 4, 2]) = 1);
pragma Assert (Candidate ([1, 2, 3, 2, 1]) = 0);
pragma Assert (Candidate ([3, 1, 1, 3]) = 0);
pragma Assert (Candidate ([1]) = 0);
pragma Assert (Candidate ([0, 1]) = 1);
end Main; | [
"\n end "
] |
HumanEval_74_total_match | adb | pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package Placeholder is
type Unbounded_String_Array is array (Positive range <>) of Unbounded_String;
function Total_Match (Lst1 : Unbounded_String_Array; Lst2 : Unbounded_String_Array) return Unbounded_String_Array;
-- Write a function that accepts two Vectors of strings and returns the Vector that has
-- total number of chars in the all strings of the Vector less than the other Vector.
-- if the two Vectors have the same number of chars, return the first Vector.
-- Examples
-- >>> Total_Match ([], [])
-- []
-- >>> Total_Match ([To_Unbounded_String ("hi"), To_Unbounded_String ("admin")], [To_Unbounded_String ("hI"), To_Unbounded_String ("Hi")])
-- [To_Unbounded_String ("hI"), To_Unbounded_String ("Hi")]
-- >>> Total_Match ([To_Unbounded_String ("hi"), To_Unbounded_String ("admin")], [To_Unbounded_String ("hi"), To_Unbounded_String ("hi"), To_Unbounded_String ("admin"), To_Unbounded_String ("project")])
-- [To_Unbounded_String ("hi"), To_Unbounded_String ("admin")]
-- >>> Total_Match ([To_Unbounded_String ("hi"), To_Unbounded_String ("admin")], [To_Unbounded_String ("hI"), To_Unbounded_String ("hi"), To_Unbounded_String ("hi")])
-- [To_Unbounded_String ("hI"), To_Unbounded_String ("hi"), To_Unbounded_String ("hi")]
-- >>> Total_Match ([To_Unbounded_String ("4")], [To_Unbounded_String ("1"), To_Unbounded_String ("2"), To_Unbounded_String ("3"), To_Unbounded_String ("4"), To_Unbounded_String ("5")])
-- [To_Unbounded_String ("4")]
end Placeholder;
pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package body Placeholder is
function Total_Match (Lst1 : Unbounded_String_Array; Lst2 : Unbounded_String_Array) return Unbounded_String_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_74_total_match.py | reworded |
end Total_Match;
end Placeholder;
pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Lst1 : Unbounded_String_Array; Lst2 : Unbounded_String_Array) return Unbounded_String_Array renames Placeholder.Total_Match;
begin
pragma Assert (Candidate ([], []) = []);
pragma Assert (Candidate ([To_Unbounded_String ("hi"), To_Unbounded_String ("admin")], [To_Unbounded_String ("hi"), To_Unbounded_String ("hi")]) = [To_Unbounded_String ("hi"), To_Unbounded_String ("hi")]);
pragma Assert (Candidate ([To_Unbounded_String ("hi"), To_Unbounded_String ("admin")], [To_Unbounded_String ("hi"), To_Unbounded_String ("hi"), To_Unbounded_String ("admin"), To_Unbounded_String ("project")]) = [To_Unbounded_String ("hi"), To_Unbounded_String ("admin")]);
pragma Assert (Candidate ([To_Unbounded_String ("4")], [To_Unbounded_String ("1"), To_Unbounded_String ("2"), To_Unbounded_String ("3"), To_Unbounded_String ("4"), To_Unbounded_String ("5")]) = [To_Unbounded_String ("4")]);
pragma Assert (Candidate ([To_Unbounded_String ("hi"), To_Unbounded_String ("admin")], [To_Unbounded_String ("hI"), To_Unbounded_String ("Hi")]) = [To_Unbounded_String ("hI"), To_Unbounded_String ("Hi")]);
pragma Assert (Candidate ([To_Unbounded_String ("hi"), To_Unbounded_String ("admin")], [To_Unbounded_String ("hI"), To_Unbounded_String ("hi"), To_Unbounded_String ("hi")]) = [To_Unbounded_String ("hI"), To_Unbounded_String ("hi"), To_Unbounded_String ("hi")]);
pragma Assert (Candidate ([To_Unbounded_String ("hi"), To_Unbounded_String ("admin")], [To_Unbounded_String ("hI"), To_Unbounded_String ("hi"), To_Unbounded_String ("hii")]) = [To_Unbounded_String ("hi"), To_Unbounded_String ("admin")]);
pragma Assert (Candidate ([], [To_Unbounded_String ("this")]) = []);
pragma Assert (Candidate ([To_Unbounded_String ("this")], []) = []);
end Main; | [
"\n end "
] |
HumanEval_75_is_multiply_prime | adb | pragma Ada_2022;
package Placeholder is
function Is_Multiply_Prime (A : Integer) return Boolean;
-- 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:
-- >>> Is_Multiply_Prime (30)
-- True
-- 30 = 2 * 3 * 5
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Is_Multiply_Prime (A : Integer) return Boolean | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_75_is_multiply_prime.py | reworded |
end Is_Multiply_Prime;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (A : Integer) return Boolean renames Placeholder.Is_Multiply_Prime;
begin
pragma Assert (Candidate (5) = False);
pragma Assert (Candidate (30) = True);
pragma Assert (Candidate (8) = True);
pragma Assert (Candidate (10) = False);
pragma Assert (Candidate (125) = True);
pragma Assert (Candidate (105) = True);
pragma Assert (Candidate (126) = False);
pragma Assert (Candidate (729) = False);
pragma Assert (Candidate (891) = False);
pragma Assert (Candidate (1001) = True);
end Main; | [
"\n end "
] |
HumanEval_76_is_simple_power | adb | pragma Ada_2022;
package Placeholder is
function Is_Simple_Power (X : Integer; N : Integer) return Boolean;
-- 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:
-- >>> Is_Simple_Power (1, 4)
-- True
-- >>> Is_Simple_Power (2, 2)
-- True
-- >>> Is_Simple_Power (8, 2)
-- True
-- >>> Is_Simple_Power (3, 2)
-- False
-- >>> Is_Simple_Power (3, 1)
-- False
-- >>> Is_Simple_Power (5, 3)
-- False
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Is_Simple_Power (X : Integer; N : Integer) return Boolean | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_76_is_simple_power.py | reworded |
end Is_Simple_Power;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (X : Integer; N : Integer) return Boolean renames Placeholder.Is_Simple_Power;
begin
pragma Assert (Candidate (16, 2) = True);
pragma Assert (Candidate (143214, 16) = False);
pragma Assert (Candidate (4, 2) = True);
pragma Assert (Candidate (9, 3) = True);
pragma Assert (Candidate (16, 4) = True);
pragma Assert (Candidate (24, 2) = False);
pragma Assert (Candidate (128, 4) = False);
pragma Assert (Candidate (12, 6) = False);
pragma Assert (Candidate (1, 1) = True);
pragma Assert (Candidate (1, 12) = True);
end Main; | [
"\n end "
] |
HumanEval_77_iscube | adb | pragma Ada_2022;
package Placeholder is
function Iscube (A : Integer) return Boolean;
-- 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 (1)
-- True
-- >>> Iscube (2)
-- False
-- >>> Iscube (-1)
-- True
-- >>> Iscube (64)
-- True
-- >>> Iscube (0)
-- True
-- >>> Iscube (180)
-- False
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Iscube (A : Integer) return Boolean | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_77_iscube.py | reworded |
end Iscube;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (A : Integer) return Boolean renames Placeholder.Iscube;
begin
pragma Assert (Candidate (1) = True);
pragma Assert (Candidate (2) = False);
pragma Assert (Candidate (-1) = True);
pragma Assert (Candidate (64) = True);
pragma Assert (Candidate (180) = False);
pragma Assert (Candidate (1000) = True);
pragma Assert (Candidate (0) = True);
pragma Assert (Candidate (1729) = False);
end Main; | [
"\n end "
] |
HumanEval_78_hex_key | adb | pragma Ada_2022;
package Placeholder is
function Hex_Key (Num : String) return Integer;
-- 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:
-- >>> Hex_Key ("AB")
-- 1
-- >>> Hex_Key ("1077E")
-- 2
-- >>> Hex_Key ("ABED1A33")
-- 4
-- >>> Hex_Key ("123456789ABCDEF0")
-- 6
-- >>> Hex_Key ("2020")
-- 2
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Hex_Key (Num : String) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_78_hex_key.py | reworded |
end Hex_Key;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Num : String) return Integer renames Placeholder.Hex_Key;
begin
pragma Assert (Candidate ("AB") = 1);
pragma Assert (Candidate ("1077E") = 2);
pragma Assert (Candidate ("ABED1A33") = 4);
pragma Assert (Candidate ("2020") = 2);
pragma Assert (Candidate ("123456789ABCDEF0") = 6);
pragma Assert (Candidate ("112233445566778899AABBCCDDEEFF00") = 12);
end Main; | [
"\n end "
] |
HumanEval_79_decimal_to_binary | adb | pragma Ada_2022;
package Placeholder is
function Decimal_To_Binary (Decimal : Integer) return String;
-- 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:
-- >>> Decimal_To_Binary (15)
-- "db1111db"
-- >>> Decimal_To_Binary (32)
-- "db100000db"
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Decimal_To_Binary (Decimal : Integer) return String | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_79_decimal_to_binary.py | reworded |
end Decimal_To_Binary;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Decimal : Integer) return String renames Placeholder.Decimal_To_Binary;
begin
pragma Assert (Candidate (0) = "db0db");
pragma Assert (Candidate (32) = "db100000db");
pragma Assert (Candidate (103) = "db1100111db");
pragma Assert (Candidate (15) = "db1111db");
end Main; | [
"\n end "
] |
HumanEval_80_is_happy | adb | pragma Ada_2022;
package Placeholder is
function Is_Happy (S : String) return Boolean;
-- You are given a string s.
-- Your task is to check if the string is hapadb or not.
-- A string is hapadb if its length is at least 3 and every 3 consecutive letters are distinct
-- For example:
-- >>> Is_Happy ("a")
-- False
-- >>> Is_Happy ("aa")
-- False
-- >>> Is_Happy ("abcd")
-- True
-- >>> Is_Happy ("aabb")
-- False
-- >>> Is_Happy ("adb")
-- True
-- >>> Is_Happy ("xyy")
-- False
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Is_Happy (S : String) return Boolean | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_80_is_happy.py | reworded |
end Is_Happy;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (S : String) return Boolean renames Placeholder.Is_Happy;
begin
pragma Assert (Candidate ("a") = False);
pragma Assert (Candidate ("aa") = False);
pragma Assert (Candidate ("abcd") = True);
pragma Assert (Candidate ("aabb") = False);
pragma Assert (Candidate ("adb") = True);
pragma Assert (Candidate ("xyy") = False);
pragma Assert (Candidate ("iopaxpoi") = True);
pragma Assert (Candidate ("iopaxioi") = False);
end Main; | [
"\n end "
] |
HumanEval_81_numerical_letter_grade | adb | pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package Placeholder is
type Float_Array is array (Positive range <>) of Float;
type Unbounded_String_Array is array (Positive range <>) of Unbounded_String;
function Numerical_Letter_Grade (Grades : Float_Array) return Unbounded_String_Array;
-- 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 a Vector of GPAs for some students and you have to write
-- a function that can output a Vector 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:
-- >>> Grade_Equation ([4.0, 3, 1.7, 2, 3.5])
-- [To_Unbounded_String ("A+"), To_Unbounded_String ("B"), To_Unbounded_String ("C-"), To_Unbounded_String ("C"), To_Unbounded_String ("A-")]
end Placeholder;
pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package body Placeholder is
function Numerical_Letter_Grade (Grades : Float_Array) return Unbounded_String_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_81_numerical_letter_grade.py | reworded |
end Numerical_Letter_Grade;
end Placeholder;
pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Grades : Float_Array) return Unbounded_String_Array renames Placeholder.Numerical_Letter_Grade;
begin
pragma Assert (Candidate ([4.0, 3, 1.7, 2, 3.5]) = [To_Unbounded_String ("A+"), To_Unbounded_String ("B"), To_Unbounded_String ("C-"), To_Unbounded_String ("C"), To_Unbounded_String ("A-")]);
pragma Assert (Candidate ([1.2]) = [To_Unbounded_String ("D+")]);
pragma Assert (Candidate ([0.5]) = [To_Unbounded_String ("D-")]);
pragma Assert (Candidate ([0.0]) = [To_Unbounded_String ("E")]);
pragma Assert (Candidate ([1.0, 0.3, 1.5, 2.8, 3.3]) = [To_Unbounded_String ("D"), To_Unbounded_String ("D-"), To_Unbounded_String ("C-"), To_Unbounded_String ("B"), To_Unbounded_String ("B+")]);
pragma Assert (Candidate ([0.0, 0.7]) = [To_Unbounded_String ("E"), To_Unbounded_String ("D-")]);
end Main; | [
"\n end "
] |
HumanEval_82_prime_length | adb | pragma Ada_2022;
package Placeholder is
function Prime_Length (My_String : String) return Boolean;
-- Write a function that takes a string and returns True if the string
-- length is a prime number or False otherwise
-- Examples
-- >>> Prime_Length ("Hello")
-- True
-- >>> Prime_Length ("abcdcba")
-- True
-- >>> Prime_Length ("kittens")
-- True
-- >>> Prime_Length ("orange")
-- False
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Prime_Length (My_String : String) return Boolean | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_82_prime_length.py | reworded |
end Prime_Length;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (My_String : String) return Boolean renames Placeholder.Prime_Length;
begin
pragma Assert (Candidate ("Hello") = True);
pragma Assert (Candidate ("abcdcba") = True);
pragma Assert (Candidate ("kittens") = True);
pragma Assert (Candidate ("orange") = False);
pragma Assert (Candidate ("wow") = True);
pragma Assert (Candidate ("world") = True);
pragma Assert (Candidate ("MadaM") = True);
pragma Assert (Candidate ("Wow") = True);
pragma Assert (Candidate ("") = False);
pragma Assert (Candidate ("HI") = True);
pragma Assert (Candidate ("go") = True);
pragma Assert (Candidate ("gogo") = False);
pragma Assert (Candidate ("aaaaaaaaaaaaaaa") = False);
pragma Assert (Candidate ("Madam") = True);
pragma Assert (Candidate ("M") = False);
pragma Assert (Candidate ("0") = False);
end Main; | [
"\n end "
] |
HumanEval_83_starts_one_ends | adb | pragma Ada_2022;
package Placeholder is
function Starts_One_Ends (N : Integer) return Integer;
-- Given a positive integer n, return the count of the numbers of n-digit
-- positive integers that start or end with 1.
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Starts_One_Ends (N : Integer) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_83_starts_one_ends.py | reworded |
end Starts_One_Ends;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (N : Integer) return Integer renames Placeholder.Starts_One_Ends;
begin
pragma Assert (Candidate (1) = 1);
pragma Assert (Candidate (2) = 18);
pragma Assert (Candidate (3) = 180);
pragma Assert (Candidate (4) = 1800);
pragma Assert (Candidate (5) = 18000);
end Main; | [
"\n end "
] |
HumanEval_84_solve | adb | pragma Ada_2022;
package Placeholder is
function Solve (N : Integer) return String;
-- Given a positive integer N, return the total sum of its digits in binary.
-- Example
-- >>> Solve (1000)
-- "1"
-- >>> Solve (150)
-- "110"
-- >>> Solve (147)
-- "1100"
-- Variables:
-- @N integer
-- Constraints: 0 ≤ N ≤ 10000.
-- Output:
-- a string of binary number
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Solve (N : Integer) return String | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_84_solve.py | reworded |
end Solve;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (N : Integer) return String renames Placeholder.Solve;
begin
pragma Assert (Candidate (1000) = "1");
pragma Assert (Candidate (150) = "110");
pragma Assert (Candidate (147) = "1100");
pragma Assert (Candidate (333) = "1001");
pragma Assert (Candidate (963) = "10010");
end Main; | [
"\n end "
] |
HumanEval_85_add | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Add (Lst : Integer_Array) return Integer;
-- Given a non-empty Vector of integers lst. add the even elements that are at odd indices..
-- Examples:
-- >>> Add ([4, 2, 6, 7])
-- 2
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Add (Lst : Integer_Array) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_85_add.py | reworded |
end Add;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Lst : Integer_Array) return Integer renames Placeholder.Add;
begin
pragma Assert (Candidate ([4, 88]) = 88);
pragma Assert (Candidate ([4, 5, 6, 7, 2, 122]) = 122);
pragma Assert (Candidate ([4, 0, 6, 7]) = 0);
pragma Assert (Candidate ([4, 4, 6, 8]) = 12);
end Main; | [
"\n end "
] |
HumanEval_86_anti_shuffle | adb | pragma Ada_2022;
package Placeholder is
function Anti_Shuffle (S : String) return String;
-- 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:
-- >>> Anti_Shuffle ("Hi")
-- "Hi"
-- >>> Anti_Shuffle ("hello")
-- "ehllo"
-- >>> Anti_Shuffle ("Hello World!!!")
-- "Hello !!!Wdlor"
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Anti_Shuffle (S : String) return String | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_86_anti_shuffle.py | reworded |
end Anti_Shuffle;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (S : String) return String renames Placeholder.Anti_Shuffle;
begin
pragma Assert (Candidate ("Hi") = "Hi");
pragma Assert (Candidate ("hello") = "ehllo");
pragma Assert (Candidate ("number") = "bemnru");
pragma Assert (Candidate ("abcd") = "abcd");
pragma Assert (Candidate ("Hello World!!!") = "Hello !!!Wdlor");
pragma Assert (Candidate ("") = "");
pragma Assert (Candidate ("Hi. My name is Mister Robot. How are you?") = ".Hi My aemn is Meirst .Rboot How aer ?ouy");
end Main; | [
"\n end "
] |
HumanEval_87_get_row | adb | pragma Ada_2022;
with Ada.Containers.Vectors;
package Placeholder is
package Integer_Vector is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Integer);
use Integer_Vector;
type Integer_Vector_Vector_Array is array (Positive range <>) of Integer_Vector.Vector;
type Integer_Integer_Tuple is record
Integer_1 : Integer;
Integer_2 : Integer;
end record;
type Integer_Integer_Tuple_Array is array (Positive range <>) of Integer_Integer_Tuple;
function Get_Row (Lst : Integer_Vector_Vector_Array; X : Integer) return Integer_Integer_Tuple_Array;
-- You are given a 2 dimensional data, as a nested Vectors,
-- 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 Vector,
-- and return Vector of records, [(x1, y1), (x2, y2) ...] such that
-- each record 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:
-- >>> Get_Row ([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], 1)
-- [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
-- >>> Get_Row ([], 1)
-- []
-- >>> Get_Row ([[], [1], [1, 2, 3]], 3)
-- [(2, 2)]
end Placeholder;
pragma Ada_2022;
with Ada.Containers.Vectors;
package body Placeholder is
function Get_Row (Lst : Integer_Vector_Vector_Array; X : Integer) return Integer_Integer_Tuple_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_87_get_row.py | reworded |
end Get_Row;
end Placeholder;
pragma Ada_2022;
with Ada.Containers.Vectors;
with Placeholder; use Placeholder;
procedure Main is
use Integer_Vector;
function Candidate (Lst : Integer_Vector_Vector_Array; X : Integer) return Integer_Integer_Tuple_Array renames Placeholder.Get_Row;
begin
pragma Assert (Candidate ([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], 1) = [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]);
pragma Assert (Candidate ([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6]], 2) = [(0, 1), (1, 1), (2, 1), (3, 1), (4, 1), (5, 1)]);
pragma Assert (Candidate ([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6], [1, 1, 3, 4, 5, 6], [1, 2, 1, 4, 5, 6], [1, 2, 3, 1, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], 1) = [(0, 0), (1, 0), (2, 1), (2, 0), (3, 2), (3, 0), (4, 3), (4, 0), (5, 4), (5, 0), (6, 5), (6, 0)]);
pragma Assert (Candidate ([], 1) = []);
pragma Assert (Candidate ([[1]], 2) = []);
pragma Assert (Candidate ([[], [1], [1, 2, 3]], 3) = [(2, 2)]);
end Main; | [
"\n end "
] |
HumanEval_88_sort_array | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Sort_Array (My_Array : Integer_Array) return Integer_Array;
-- Given an array of non-negative integers, return a coadb of the given array after sorting,
-- you will sort the given array 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.
-- Examples:
-- >>> Sort_Array ([])
-- []
-- >>> Sort_Array ([5])
-- [5]
-- >>> Sort_Array ([2, 4, 3, 0, 1, 5])
-- [0, 1, 2, 3, 4, 5]
-- >>> Sort_Array ([2, 4, 3, 0, 1, 5, 6])
-- [6, 5, 4, 3, 2, 1, 0]
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Sort_Array (My_Array : Integer_Array) return Integer_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_88_sort_array.py | reworded |
end Sort_Array;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (My_Array : Integer_Array) return Integer_Array renames Placeholder.Sort_Array;
begin
pragma Assert (Candidate ([]) = []);
pragma Assert (Candidate ([5]) = [5]);
pragma Assert (Candidate ([2, 4, 3, 0, 1, 5]) = [0, 1, 2, 3, 4, 5]);
pragma Assert (Candidate ([2, 4, 3, 0, 1, 5, 6]) = [6, 5, 4, 3, 2, 1, 0]);
pragma Assert (Candidate ([2, 1]) = [1, 2]);
pragma Assert (Candidate ([15, 42, 87, 32, 11, 0]) = [0, 11, 15, 32, 42, 87]);
pragma Assert (Candidate ([21, 14, 23, 11]) = [23, 21, 14, 11]);
end Main; | [
"\n end "
] |
HumanEval_89_encrypt | adb | pragma Ada_2022;
package Placeholder is
function Encrypt (S : String) return String;
-- 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"
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Encrypt (S : String) return String | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_89_encrypt.py | reworded |
end Encrypt;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (S : String) return String renames Placeholder.Encrypt;
begin
pragma Assert (Candidate ("hi") = "lm");
pragma Assert (Candidate ("asdfghjkl") = "ewhjklnop");
pragma Assert (Candidate ("gf") = "kj");
pragma Assert (Candidate ("et") = "ix");
pragma Assert (Candidate ("faewfawefaewg") = "jeiajeaijeiak");
pragma Assert (Candidate ("hellomyfriend") = "lippsqcjvmirh");
pragma Assert (Candidate ("dxzdlmnilfuhmilufhlihufnmlimnufhlimnufhfucufh") = "hbdhpqrmpjylqmpyjlpmlyjrqpmqryjlpmqryjljygyjl");
pragma Assert (Candidate ("a") = "e");
end Main; | [
"\n end "
] |
HumanEval_90_next_smallest | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
type Integer_Option (Valid : Boolean := False) is record
case Valid is
when True =>
Value : Integer;
when False =>
null;
end case;
end record;
function Next_Smallest (Lst : Integer_Array) return Integer_Option;
-- You are given a Vector of integers.
-- Write a function next_smallest() that returns the 2nd smallest element of the Vector.
-- Return null if there is no such element.
-- >>> Next_Smallest ([1, 2, 3, 4, 5])
-- (Valid => True, Value => 2)
-- >>> Next_Smallest ([5, 1, 4, 3, 2])
-- (Valid => True, Value => 2)
-- >>> Next_Smallest ([])
-- (Valid => False)
-- >>> Next_Smallest ([1, 1])
-- (Valid => False)
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Next_Smallest (Lst : Integer_Array) return Integer_Option | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_90_next_smallest.py | reworded |
end Next_Smallest;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Lst : Integer_Array) return Integer_Option renames Placeholder.Next_Smallest;
begin
pragma Assert (Candidate ([1, 2, 3, 4, 5]) = (Valid => True, Value => 2));
pragma Assert (Candidate ([5, 1, 4, 3, 2]) = (Valid => True, Value => 2));
pragma Assert (Candidate ([]) = (Valid => False));
pragma Assert (Candidate ([1, 1]) = (Valid => False));
pragma Assert (Candidate ([1, 1, 1, 1, 0]) = (Valid => True, Value => 1));
pragma Assert (Candidate ([1, 1]) = (Valid => False));
pragma Assert (Candidate ([-35, 34, 12, -45]) = (Valid => True, Value => -35));
end Main; | [
"\n end "
] |
HumanEval_91_is_bored | adb | pragma Ada_2022;
package Placeholder is
function Is_Bored (S : String) return Integer;
-- 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:
-- >>> Is_Bored ("Hello world")
-- 0
-- >>> Is_Bored ("The sky is blue. The sun is shining. I love this weather")
-- 1
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Is_Bored (S : String) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_91_is_bored.py | reworded |
end Is_Bored;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (S : String) return Integer renames Placeholder.Is_Bored;
begin
pragma Assert (Candidate ("Hello world") = 0);
pragma Assert (Candidate ("Is the sky blue?") = 0);
pragma Assert (Candidate ("I love It !") = 1);
pragma Assert (Candidate ("bIt") = 0);
pragma Assert (Candidate ("I feel good today. I will be productive. will kill It") = 2);
pragma Assert (Candidate ("You and I are going for a walk") = 0);
end Main; | [
"\n end "
] |
HumanEval_92_any_int | adb | pragma Ada_2022;
package Placeholder is
function Any_Int (X : Float; Y : Float; Z : Float) return Boolean;
-- 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
-- >>> Any_Int (5, 2, 7)
-- True
-- >>> Any_Int (3, 2, 2)
-- False
-- >>> Any_Int (3, -2, 1)
-- True
-- >>> Any_Int (3.6, -2.2, 2)
-- False
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Any_Int (X : Float; Y : Float; Z : Float) return Boolean | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_92_any_int.py | reworded |
end Any_Int;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (X : Float; Y : Float; Z : Float) return Boolean renames Placeholder.Any_Int;
begin
pragma Assert (Candidate (2, 3, 1) = True);
pragma Assert (Candidate (2.5, 2, 3) = False);
pragma Assert (Candidate (1.5, 5, 3.5) = False);
pragma Assert (Candidate (2, 6, 2) = False);
pragma Assert (Candidate (4, 2, 2) = True);
pragma Assert (Candidate (2.2, 2.2, 2.2) = False);
pragma Assert (Candidate (-4, 6, 2) = True);
pragma Assert (Candidate (2, 1, 1) = True);
pragma Assert (Candidate (3, 4, 7) = True);
pragma Assert (Candidate (3.0, 4, 7) = False);
end Main; | [
"\n end "
] |
HumanEval_93_encode | adb | pragma Ada_2022;
package Placeholder is
function Encode (Message : String) return String;
-- 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"
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Encode (Message : String) return String | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_93_encode.py | reworded |
end Encode;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Message : String) return String renames Placeholder.Encode;
begin
pragma Assert (Candidate ("TEST") = "tgst");
pragma Assert (Candidate ("Mudasir") = "mWDCSKR");
pragma Assert (Candidate ("YES") = "ygs");
pragma Assert (Candidate ("This is a message") = "tHKS KS C MGSSCGG");
pragma Assert (Candidate ("I DoNt KnOw WhAt tO WrItE") = "k dQnT kNqW wHcT Tq wRkTg");
end Main; | [
"\n end "
] |
HumanEval_94_skjkasdkd | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Skjkasdkd (Lst : Integer_Array) return Integer;
-- You are given a Vector of integers.
-- You need to find the largest prime value and return the sum of its digits.
-- Examples:
-- >>> Skjkasdkd ([0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3])
-- 10
-- >>> Skjkasdkd ([1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1])
-- 25
-- >>> Skjkasdkd ([1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3])
-- 13
-- >>> Skjkasdkd ([0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6])
-- 11
-- >>> Skjkasdkd ([0, 81, 12, 3, 1, 21])
-- 3
-- >>> Skjkasdkd ([0, 8, 1, 2, 1, 7])
-- 7
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Skjkasdkd (Lst : Integer_Array) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_94_skjkasdkd.py | reworded |
end Skjkasdkd;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Lst : Integer_Array) return Integer renames Placeholder.Skjkasdkd;
begin
pragma Assert (Candidate ([0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) = 10);
pragma Assert (Candidate ([1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) = 25);
pragma Assert (Candidate ([1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) = 13);
pragma Assert (Candidate ([0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) = 11);
pragma Assert (Candidate ([0, 81, 12, 3, 1, 21]) = 3);
pragma Assert (Candidate ([0, 8, 1, 2, 1, 7]) = 7);
pragma Assert (Candidate ([8191]) = 19);
pragma Assert (Candidate ([8191, 123456, 127, 7]) = 19);
pragma Assert (Candidate ([127, 97, 8192]) = 10);
end Main; | [
"\n end "
] |
HumanEval_95_check_dict_case | adb | pragma Ada_2022;
with Ada.Containers.Indefinite_Ordered_Maps;
package Placeholder is
package String_String_Dict is new Ada.Containers.Indefinite_Ordered_Maps (Key_Type => String, Element_Type => String);
use String_String_Dict;
function Check_Dict_Case (Dict : String_String_Dict.Map) return Boolean;
-- Given a 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 Map is empty.
-- Examples:
-- >>> Check_Dict_Case (["a" => "apple", "b" => "banana"])
-- True
-- >>> Check_Dict_Case (["a" => "apple", "A" => "banana", "B" => "banana"])
-- False
-- >>> Check_Dict_Case (["a" => "apple", 8 => "banana", "a" => "apple"])
-- False
-- >>> Check_Dict_Case (["Name" => "John", "Age" => "36", "City" => "Houston"])
-- False
-- >>> Check_Dict_Case (["STATE" => "NC", "ZIP" => "12345"])
-- True
end Placeholder;
pragma Ada_2022;
with Ada.Containers.Indefinite_Ordered_Maps;
package body Placeholder is
function Check_Dict_Case (Dict : String_String_Dict.Map) return Boolean | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_95_check_dict_case.py | reworded |
end Check_Dict_Case;
end Placeholder;
pragma Ada_2022;
with Ada.Containers.Indefinite_Ordered_Maps;
with Placeholder; use Placeholder;
procedure Main is
use String_String_Dict;
function Candidate (Dict : String_String_Dict.Map) return Boolean renames Placeholder.Check_Dict_Case;
begin
pragma Assert (Candidate (["p" => "pineapple", "b" => "banana"]) = True);
pragma Assert (Candidate (["p" => "pineapple", "A" => "banana", "B" => "banana"]) = False);
pragma Assert (Candidate (["p" => "pineapple", "5" => "banana", "a" => "apple"]) = False);
pragma Assert (Candidate (["Name" => "John", "Age" => "36", "City" => "Houston"]) = False);
pragma Assert (Candidate (["STATE" => "NC", "ZIP" => "12345"]) = True);
pragma Assert (Candidate (["fruit" => "Orange", "taste" => "Sweet"]) = True);
pragma Assert (Candidate ([]) = False);
end Main; | [
"\n end "
] |
HumanEval_96_count_up_to | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Count_Up_To (N : Integer) return Integer_Array;
-- Implement a function that takes an non-negative integer and returns an array of the first n
-- integers that are prime numbers and less than n.
-- for example:
-- >>> Count_Up_To (5)
-- [2, 3]
-- >>> Count_Up_To (11)
-- [2, 3, 5, 7]
-- >>> Count_Up_To (0)
-- []
-- >>> Count_Up_To (20)
-- [2, 3, 5, 7, 11, 13, 17, 19]
-- >>> Count_Up_To (1)
-- []
-- >>> Count_Up_To (18)
-- [2, 3, 5, 7, 11, 13, 17]
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Count_Up_To (N : Integer) return Integer_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_96_count_up_to.py | reworded |
end Count_Up_To;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (N : Integer) return Integer_Array renames Placeholder.Count_Up_To;
begin
pragma Assert (Candidate (5) = [2, 3]);
pragma Assert (Candidate (6) = [2, 3, 5]);
pragma Assert (Candidate (7) = [2, 3, 5]);
pragma Assert (Candidate (10) = [2, 3, 5, 7]);
pragma Assert (Candidate (0) = []);
pragma Assert (Candidate (22) = [2, 3, 5, 7, 11, 13, 17, 19]);
pragma Assert (Candidate (1) = []);
pragma Assert (Candidate (18) = [2, 3, 5, 7, 11, 13, 17]);
pragma Assert (Candidate (47) = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43]);
pragma Assert (Candidate (101) = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]);
end Main; | [
"\n end "
] |
HumanEval_97_multiply | adb | pragma Ada_2022;
package Placeholder is
function Multiply (A : Integer; B : Integer) return Integer;
-- Complete the function that takes two integers and returns
-- the product of their unit digits.
-- Assume the input is always valid.
-- Examples:
-- >>> Multiply (148, 412)
-- 16
-- >>> Multiply (19, 28)
-- 72
-- >>> Multiply (2020, 1851)
-- 0
-- >>> Multiply (14, -15)
-- 20
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Multiply (A : Integer; B : Integer) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_97_multiply.py | reworded |
end Multiply;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (A : Integer; B : Integer) return Integer renames Placeholder.Multiply;
begin
pragma Assert (Candidate (148, 412) = 16);
pragma Assert (Candidate (19, 28) = 72);
pragma Assert (Candidate (2020, 1851) = 0);
pragma Assert (Candidate (14, -15) = 20);
pragma Assert (Candidate (76, 67) = 42);
pragma Assert (Candidate (17, 27) = 49);
pragma Assert (Candidate (0, 1) = 0);
pragma Assert (Candidate (0, 0) = 0);
end Main; | [
"\n end "
] |
HumanEval_98_count_upper | adb | pragma Ada_2022;
package Placeholder is
function Count_Upper (S : String) return Integer;
-- Given a string s, count the number of uppercase vowels in even indices.
-- For example:
-- >>> Count_Upper ("aBCdEf")
-- 1
-- >>> Count_Upper ("abcdefg")
-- 0
-- >>> Count_Upper ("dBBE")
-- 0
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Count_Upper (S : String) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_98_count_upper.py | reworded |
end Count_Upper;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (S : String) return Integer renames Placeholder.Count_Upper;
begin
pragma Assert (Candidate ("aBCdEf") = 1);
pragma Assert (Candidate ("abcdefg") = 0);
pragma Assert (Candidate ("dBBE") = 0);
pragma Assert (Candidate ("B") = 0);
pragma Assert (Candidate ("U") = 1);
pragma Assert (Candidate ("") = 0);
pragma Assert (Candidate ("EEEE") = 2);
end Main; | [
"\n end "
] |
HumanEval_99_closest_integer | adb | pragma Ada_2022;
package Placeholder is
function Closest_Integer (Value : String) return Integer;
-- 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
-- >>> Closest_Integer ("10")
-- 10
-- >>> Closest_Integer ("15.3")
-- 15
-- 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.
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Closest_Integer (Value : String) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_99_closest_integer.py | reworded |
end Closest_Integer;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (Value : String) return Integer renames Placeholder.Closest_Integer;
begin
pragma Assert (Candidate ("10") = 10);
pragma Assert (Candidate ("14.5") = 15);
pragma Assert (Candidate ("-15.5") = -16);
pragma Assert (Candidate ("15.3") = 15);
pragma Assert (Candidate ("0") = 0);
end Main; | [
"\n end "
] |
HumanEval_100_make_a_pile | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Make_A_Pile (N : Integer) return Integer_Array;
-- 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 a Vector, where element at index
-- i represents the number of stones in the level (i+1).
-- Examples:
-- >>> Make_A_Pile (3)
-- [3, 5, 7]
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Make_A_Pile (N : Integer) return Integer_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_100_make_a_pile.py | reworded |
end Make_A_Pile;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (N : Integer) return Integer_Array renames Placeholder.Make_A_Pile;
begin
pragma Assert (Candidate (3) = [3, 5, 7]);
pragma Assert (Candidate (4) = [4, 6, 8, 10]);
pragma Assert (Candidate (5) = [5, 7, 9, 11, 13]);
pragma Assert (Candidate (6) = [6, 8, 10, 12, 14, 16]);
pragma Assert (Candidate (8) = [8, 10, 12, 14, 16, 18, 20, 22]);
end Main; | [
"\n end "
] |
HumanEval_101_words_string | adb | pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package Placeholder is
type Unbounded_String_Array is array (Positive range <>) of Unbounded_String;
function Words_String (S : String) return Unbounded_String_Array;
-- 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 of the words.
-- For example:
-- >>> Words_String ("Hi, my name is John")
-- [To_Unbounded_String ("Hi"), To_Unbounded_String ("my"), To_Unbounded_String ("name"), To_Unbounded_String ("is"), To_Unbounded_String ("John")]
-- >>> Words_String ("One, two, three, four, five, six")
-- [To_Unbounded_String ("One"), To_Unbounded_String ("two"), To_Unbounded_String ("three"), To_Unbounded_String ("four"), To_Unbounded_String ("five"), To_Unbounded_String ("six")]
end Placeholder;
pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package body Placeholder is
function Words_String (S : String) return Unbounded_String_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_101_words_string.py | reworded |
end Words_String;
end Placeholder;
pragma Ada_2022;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (S : String) return Unbounded_String_Array renames Placeholder.Words_String;
begin
pragma Assert (Candidate ("Hi, my name is John") = [To_Unbounded_String ("Hi"), To_Unbounded_String ("my"), To_Unbounded_String ("name"), To_Unbounded_String ("is"), To_Unbounded_String ("John")]);
pragma Assert (Candidate ("One, two, three, four, five, six") = [To_Unbounded_String ("One"), To_Unbounded_String ("two"), To_Unbounded_String ("three"), To_Unbounded_String ("four"), To_Unbounded_String ("five"), To_Unbounded_String ("six")]);
pragma Assert (Candidate ("Hi, my name") = [To_Unbounded_String ("Hi"), To_Unbounded_String ("my"), To_Unbounded_String ("name")]);
pragma Assert (Candidate ("One,, two, three, four, five, six,") = [To_Unbounded_String ("One"), To_Unbounded_String ("two"), To_Unbounded_String ("three"), To_Unbounded_String ("four"), To_Unbounded_String ("five"), To_Unbounded_String ("six")]);
pragma Assert (Candidate ("") = []);
pragma Assert (Candidate ("ahmed , gamal") = [To_Unbounded_String ("ahmed"), To_Unbounded_String ("gamal")]);
end Main; | [
"\n end "
] |
HumanEval_102_choose_num | adb | pragma Ada_2022;
package Placeholder is
function Choose_Num (X : Integer; Y : Integer) return Integer;
-- 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:
-- >>> Choose_Num (12, 15)
-- 14
-- >>> Choose_Num (13, 12)
-- -1
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Choose_Num (X : Integer; Y : Integer) return Integer | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_102_choose_num.py | reworded |
end Choose_Num;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (X : Integer; Y : Integer) return Integer renames Placeholder.Choose_Num;
begin
pragma Assert (Candidate (12, 15) = 14);
pragma Assert (Candidate (13, 12) = -1);
pragma Assert (Candidate (33, 12354) = 12354);
pragma Assert (Candidate (5234, 5233) = -1);
pragma Assert (Candidate (6, 29) = 28);
pragma Assert (Candidate (27, 10) = -1);
pragma Assert (Candidate (7, 7) = -1);
pragma Assert (Candidate (546, 546) = 546);
end Main; | [
"\n end "
] |
HumanEval_104_unique_digits | adb | pragma Ada_2022;
package Placeholder is
type Integer_Array is array (Positive range <>) of Integer;
function Unique_Digits (X : Integer_Array) return Integer_Array;
-- Given a Vector of positive integers x. return a sorted Vector of all
-- elements that hasn't any even digit.
-- Note: Returned Vector should be sorted in increasing order.
-- For example:
-- >>> Unique_Digits ([15, 33, 1422, 1])
-- [1, 15, 33]
-- >>> Unique_Digits ([152, 323, 1422, 10])
-- []
end Placeholder;
pragma Ada_2022;
package body Placeholder is
function Unique_Digits (X : Integer_Array) return Integer_Array | transform | /mnt/ssd/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_104_unique_digits.py | reworded |
end Unique_Digits;
end Placeholder;
pragma Ada_2022;
with Placeholder; use Placeholder;
procedure Main is
function Candidate (X : Integer_Array) return Integer_Array renames Placeholder.Unique_Digits;
begin
pragma Assert (Candidate ([15, 33, 1422, 1]) = [1, 15, 33]);
pragma Assert (Candidate ([152, 323, 1422, 10]) = []);
pragma Assert (Candidate ([12345, 2033, 111, 151]) = [111, 151]);
pragma Assert (Candidate ([135, 103, 31]) = [31, 135]);
end Main; | [
"\n end "
] |