Prompt:
#lang racket

;; 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
(define (hex_key num)

(require rackunit)

(define (test-humaneval)

  (let (( candidate hex_key))
    (check-within (candidate "AB") 1 0.001)
    (check-within (candidate "1077E") 2 0.001)
    (check-within (candidate "ABED1A33") 4 0.001)
    (check-within (candidate "2020") 2 0.001)
    (check-within (candidate "123456789ABCDEF0") 6 0.001)
    (check-within (candidate "112233445566778899AABBCCDDEEFF00") 12 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; You are given a string representing a sentence,
;; the sentence contains some words separated by a space,
;; and you have to return a string that contains the words from the original sentence,
;; whose lengths are prime numbers,
;; the order of the words in the new string should be the same as the original one.
;; Example 1:
;; >>> (words_in_sentence "This is a test")
;; "is"
;; Example 2:
;; >>> (words_in_sentence "lets go for swimming")
;; "go for"
;; Constraints:
;; * 1 <= len(sentence) <= 100
;; * sentence contains only letters
(define (words_in_sentence sentence)

(require rackunit)

(define (test-humaneval)

  (let (( candidate words_in_sentence))
    (check-within (candidate "This is a test") "is" 0.001)
    (check-within (candidate "lets go for swimming") "go for" 0.001)
    (check-within (candidate "there is no place available here") "there is no place" 0.001)
    (check-within (candidate "Hi I am Hussein") "Hi am Hussein" 0.001)
    (check-within (candidate "go for it") "go for it" 0.001)
    (check-within (candidate "here") "" 0.001)
    (check-within (candidate "here is") "is" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a string representing a space separated lowercase letters, return a hash
;; of the letter with the most repetition and containing the corresponding count.
;; If several letters have the same occurrence, return all of them.
;; Example:
;; >>> (histogram "a b c")
;; #hash(("a" .  1) ("b" .  1) ("c" .  1))
;; >>> (histogram "a b b a")
;; #hash(("a" .  2) ("b" .  2))
;; >>> (histogram "a b c a b")
;; #hash(("a" .  2) ("b" .  2))
;; >>> (histogram "b b b b a")
;; #hash(("b" .  4))
;; >>> (histogram "")
;; #hash()
(define (histogram test)

(require rackunit)

(define (test-humaneval)

  (let (( candidate histogram))
    (check-within (candidate "a b b a") #hash(("a" .  2) ("b" .  2)) 0.001)
    (check-within (candidate "a b c a b") #hash(("a" .  2) ("b" .  2)) 0.001)
    (check-within (candidate "a b c d g") #hash(("a" .  1) ("b" .  1) ("c" .  1) ("d" .  1) ("g" .  1)) 0.001)
    (check-within (candidate "r t g") #hash(("r" .  1) ("t" .  1) ("g" .  1)) 0.001)
    (check-within (candidate "b b b b a") #hash(("b" .  4)) 0.001)
    (check-within (candidate "r t g") #hash(("r" .  1) ("t" .  1) ("g" .  1)) 0.001)
    (check-within (candidate "") #hash() 0.001)
    (check-within (candidate "a") #hash(("a" .  1)) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; You are given a 2 dimensional data, as a nested lists,
;; which is similar to matrix, however, unlike matrices,
;; each row may contain a different number of columns.
;; Given lst, and integer x, find integers x in the list,
;; and return list of lists, [(x1, y1), (x2, y2) ...] such that
;; each list 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 (list (list 1 2 3 4 5 6) (list 1 2 3 4 1 6) (list 1 2 3 4 5 1)) 1)
;; (list (list 0 0) (list 1 4) (list 1 0) (list 2 5) (list 2 0))
;; >>> (get_row (list ) 1)
;; (list )
;; >>> (get_row (list (list ) (list 1) (list 1 2 3)) 3)
;; (list (list 2 2))
(define (get_row lst x)

(require rackunit)

(define (test-humaneval)

  (let (( candidate get_row))
    (check-within (candidate (list (list 1 2 3 4 5 6) (list 1 2 3 4 1 6) (list 1 2 3 4 5 1)) 1) (list (list 0 0) (list 1 4) (list 1 0) (list 2 5) (list 2 0)) 0.001)
    (check-within (candidate (list (list 1 2 3 4 5 6) (list 1 2 3 4 5 6) (list 1 2 3 4 5 6) (list 1 2 3 4 5 6) (list 1 2 3 4 5 6) (list 1 2 3 4 5 6)) 2) (list (list 0 1) (list 1 1) (list 2 1) (list 3 1) (list 4 1) (list 5 1)) 0.001)
    (check-within (candidate (list (list 1 2 3 4 5 6) (list 1 2 3 4 5 6) (list 1 1 3 4 5 6) (list 1 2 1 4 5 6) (list 1 2 3 1 5 6) (list 1 2 3 4 1 6) (list 1 2 3 4 5 1)) 1) (list (list 0 0) (list 1 0) (list 2 1) (list 2 0) (list 3 2) (list 3 0) (list 4 3) (list 4 0) (list 5 4) (list 5 0) (list 6 5) (list 6 0)) 0.001)
    (check-within (candidate (list ) 1) (list ) 0.001)
    (check-within (candidate (list (list 1)) 2) (list ) 0.001)
    (check-within (candidate (list (list ) (list 1) (list 1 2 3)) 3) (list (list 2 2)) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a positive integer n, return a sorted list that has the odd numbers in collatz sequence.
;; The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
;; as follows: start with any positive integer n. Then each term is obtained from the
;; previous term as follows: if the previous term is even, the next term is one half of
;; the previous term. If the previous term is odd, the next term is 3 times the previous
;; term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
;; Note:
;; 1. Collatz(1) is [1].
;; 2. returned list sorted in increasing order.
;; For example:
;; get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
;; >>> (get_odd_collatz 5)
;; (list 1 5)
(define (get_odd_collatz n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate get_odd_collatz))
    (check-within (candidate 14) (list 1 5 7 11 13 17) 0.001)
    (check-within (candidate 5) (list 1 5) 0.001)
    (check-within (candidate 12) (list 1 3 5) 0.001)
    (check-within (candidate 1) (list 1) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Create a function which returns the largest index of an element which
;; is not greater than or equal to the element immediately preceding it. If
;; no such element exists then return -1. The given list will not contain
;; duplicate values.
;; Examples:
;; >>> (can_arrange (list 1 2 4 3 5))
;; 3
;; >>> (can_arrange (list 1 2 3))
;; -1
(define (can_arrange arr)

(require rackunit)

(define (test-humaneval)

  (let (( candidate can_arrange))
    (check-within (candidate (list 1 2 4 3 5)) 3 0.001)
    (check-within (candidate (list 1 2 4 5)) -1 0.001)
    (check-within (candidate (list 1 4 2 5 6 7 8 9 10)) 2 0.001)
    (check-within (candidate (list 4 8 5 7 3)) 4 0.001)
    (check-within (candidate (list )) -1 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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"
(define (sort_numbers numbers)

(require rackunit)

(define (test-humaneval)

  (let (( candidate sort_numbers))
    (check-within (candidate "") "" 0.001)
    (check-within (candidate "three") "three" 0.001)
    (check-within (candidate "three five nine") "three five nine" 0.001)
    (check-within (candidate "five zero four seven nine eight") "zero four five seven eight nine" 0.001)
    (check-within (candidate "six five four three two one zero") "zero one two three four five six" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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"
(define (circular_shift x shift)

(require rackunit)

(define (test-humaneval)

  (let (( candidate circular_shift))
    (check-within (candidate 100 2) "001" 0.001)
    (check-within (candidate 12 2) "12" 0.001)
    (check-within (candidate 97 8) "79" 0.001)
    (check-within (candidate 12 1) "21" 0.001)
    (check-within (candidate 11 101) "11" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; "
;; This function will take a list of integers. For all entries in the list, the function shall square the integer entry if its index is a
;; multiple of 3 and will cube the integer entry if its index is a multiple of 4 and not a multiple of 3. The function will not
;; change the entries in the list whose indexes are not a multiple of 3 or 4. The function shall then return the sum of all entries.
;; Examples:
;; >>> lst
;; (list 1 2 3)
;; >>> lst
;; (list )
;; >>> lst
;; (list -1 -5 2 -1 -5)
(define (sum_squares lst)

(require rackunit)

(define (test-humaneval)

  (let (( candidate sum_squares))
    (check-within (candidate (list 1 2 3)) 6 0.001)
    (check-within (candidate (list 1 4 9)) 14 0.001)
    (check-within (candidate (list )) 0 0.001)
    (check-within (candidate (list 1 1 1 1 1 1 1 1 1)) 9 0.001)
    (check-within (candidate (list -1 -1 -1 -1 -1 -1 -1 -1 -1)) -3 0.001)
    (check-within (candidate (list 0)) 0 0.001)
    (check-within (candidate (list -1 -5 2 -1 -5)) -126 0.001)
    (check-within (candidate (list -56 -99 1 0 -2)) 3030 0.001)
    (check-within (candidate (list -1 0 0 0 0 0 0 0 -1)) 0 0.001)
    (check-within (candidate (list -16 -9 -2 36 36 26 -20 25 -40 20 -4 12 -26 35 37)) -14196 0.001)
    (check-within (candidate (list -1 -3 17 -1 -15 13 -1 14 -14 -12 -5 14 -14 6 13 11 16 16 4 10)) -1448 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; You are given a list of integers.
;; You need to find the largest prime value and return the sum of its digits.
;; Examples:
;; >>> (skjkasdkd (list 0 3 2 1 3 5 7 4 5 5 5 2 181 32 4 32 3 2 32 324 4 3))
;; 10
;; >>> (skjkasdkd (list 1 0 1 8 2 4597 2 1 3 40 1 2 1 2 4 2 5 1))
;; 25
;; >>> (skjkasdkd (list 1 3 1 32 5107 34 83278 109 163 23 2323 32 30 1 9 3))
;; 13
;; >>> (skjkasdkd (list 0 724 32 71 99 32 6 0 5 91 83 0 5 6))
;; 11
;; >>> (skjkasdkd (list 0 81 12 3 1 21))
;; 3
;; >>> (skjkasdkd (list 0 8 1 2 1 7))
;; 7
(define (skjkasdkd lst)


Prompt:
#lang racket

;; For a given list of integers, return a list consisting of a sum and a product of all the integers in a list.
;; Empty sum should be equal to 0 and empty product should be equal to 1.
;; >>> (sum_product (list ))
;; (list 0 1)
;; >>> (sum_product (list 1 2 3 4))
;; (list 10 24)
(define (sum_product numbers)

(require rackunit)

(define (test-humaneval)

  (let (( candidate sum_product))
    (check-within (candidate (list )) (list 0 1) 0.001)
    (check-within (candidate (list 1 1 1)) (list 3 1) 0.001)
    (check-within (candidate (list 100 0)) (list 100 0) 0.001)
    (check-within (candidate (list 3 5 7)) (list 15 105) 0.001)
    (check-within (candidate (list 10)) (list 10 10) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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
(define (choose_num x y)

(require rackunit)

(define (test-humaneval)

  (let (( candidate choose_num))
    (check-within (candidate 12 15) 14 0.001)
    (check-within (candidate 13 12) -1 0.001)
    (check-within (candidate 33 12354) 12354 0.001)
    (check-within (candidate 5234 5233) -1 0.001)
    (check-within (candidate 6 29) 28 0.001)
    (check-within (candidate 27 10) -1 0.001)
    (check-within (candidate 7 7) -1 0.001)
    (check-within (candidate 546 546) 546 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Create a function that returns a list (a, b), where 'a' is
;; the largest of negative integers, and 'b' is the smallest
;; of positive integers in a list.
;; If there is no negative or positive integers, return them as #f.
;; Examples:
;; >>> (largest_smallest_integers (list 2 4 1 3 5 7))
;; (list #f 1)
;; >>> (largest_smallest_integers (list ))
;; (list #f #f)
;; >>> (largest_smallest_integers (list 0))
;; (list #f #f)
(define (largest_smallest_integers lst)

(require rackunit)

(define (test-humaneval)

  (let (( candidate largest_smallest_integers))
    (check-within (candidate (list 2 4 1 3 5 7)) (list #f 1) 0.001)
    (check-within (candidate (list 2 4 1 3 5 7 0)) (list #f 1) 0.001)
    (check-within (candidate (list 1 3 2 4 5 6 -2)) (list -2 1) 0.001)
    (check-within (candidate (list 4 5 3 6 2 7 -7)) (list -7 2) 0.001)
    (check-within (candidate (list 7 3 8 4 9 2 5 -9)) (list -9 2) 0.001)
    (check-within (candidate (list )) (list #f #f) 0.001)
    (check-within (candidate (list 0)) (list #f #f) 0.001)
    (check-within (candidate (list -1 -3 -5 -6)) (list -1 #f) 0.001)
    (check-within (candidate (list -1 -3 -5 -6 0)) (list -1 #f) 0.001)
    (check-within (candidate (list -6 -4 -4 -3 1)) (list -3 1) 0.001)
    (check-within (candidate (list -6 -4 -4 -3 -100 1)) (list -3 1) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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
(define (count_distinct_characters string)

(require rackunit)

(define (test-humaneval)

  (let (( candidate count_distinct_characters))
    (check-within (candidate "") 0 0.001)
    (check-within (candidate "abcde") 5 0.001)
    (check-within (candidate "abcdecadeCADE") 5 0.001)
    (check-within (candidate "aaaaAAAAaaaa") 1 0.001)
    (check-within (candidate "Jerry jERRY JeRRRY") 5 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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 list, where element at index
;; i represents the number of stones in the level (i+1).
;; Examples:
;; >>> (make_a_pile 3)
;; (list 3 5 7)
(define (make_a_pile n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate make_a_pile))
    (check-within (candidate 3) (list 3 5 7) 0.001)
    (check-within (candidate 4) (list 4 6 8 10) 0.001)
    (check-within (candidate 5) (list 5 7 9 11 13) 0.001)
    (check-within (candidate 6) (list 6 8 10 12 14 16) 0.001)
    (check-within (candidate 8) (list 8 10 12 14 16 18 20 22) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; You are given a list arr of integers and you need to return
;; sum of magnitudes of integers multiplied by product of all signs
;; of each number in the list, represented by 1, -1 or 0.
;; Note: return #f for empty arr.
;; Example:
;; >>> (prod_signs (list 1 2 2 -4))
;; 9
;; >>> (prod_signs (list 0 1))
;; 0
;; >>> (prod_signs (list ))
;; #f
(define (prod_signs arr)

(require rackunit)

(define (test-humaneval)

  (let (( candidate prod_signs))
    (check-within (candidate (list 1 2 2 -4)) -9 0.001)
    (check-within (candidate (list 0 1)) 0 0.001)
    (check-within (candidate (list 1 1 1 2 3 -1 1)) -10 0.001)
    (check-within (candidate (list )) #f 0.001)
    (check-within (candidate (list 2 4 1 2 -1 -1 9)) 20 0.001)
    (check-within (candidate (list -1 1 -1 1)) 4 0.001)
    (check-within (candidate (list -1 1 1 1)) -4 0.001)
    (check-within (candidate (list -1 1 1 0)) 0 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a list of integers nums, find the minimum sum of any non-empty sub-list
;; of nums.
;; Example
;; >>> (minSubArraySum (list 2 3 4 1 2 4))
;; 1
;; >>> (minSubArraySum (list -1 -2 -3))
;; -6
(define (minSubArraySum nums)

(require rackunit)

(define (test-humaneval)

  (let (( candidate minSubArraySum))
    (check-within (candidate (list 2 3 4 1 2 4)) 1 0.001)
    (check-within (candidate (list -1 -2 -3)) -6 0.001)
    (check-within (candidate (list -1 -2 -3 2 -10)) -14 0.001)
    (check-within (candidate (list -9999999999999999)) -9999999999999999 0.001)
    (check-within (candidate (list 0 10 20 1000000)) 0 0.001)
    (check-within (candidate (list -1 -2 -3 10 -5)) -6 0.001)
    (check-within (candidate (list 100 -1 -2 -3 10 -5)) -6 0.001)
    (check-within (candidate (list 10 11 13 8 3 4)) 3 0.001)
    (check-within (candidate (list 100 -33 32 -1 0 -2)) -33 0.001)
    (check-within (candidate (list -10)) -10 0.001)
    (check-within (candidate (list 7)) 7 0.001)
    (check-within (candidate (list 1 -1)) -1 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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"
(define (string_sequence n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate string_sequence))
    (check-within (candidate 0) "0" 0.001)
    (check-within (candidate 3) "0 1 2 3" 0.001)
    (check-within (candidate 10) "0 1 2 3 4 5 6 7 8 9 10" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; You are given 2 words. You need to return #t if the second word or any of its rotations is a substring in the first word
;; >>> (cycpattern_check "abcd" "abd")
;; #f
;; >>> (cycpattern_check "hello" "ell")
;; #t
;; >>> (cycpattern_check "whassup" "psus")
;; #f
;; >>> (cycpattern_check "abab" "baa")
;; #t
;; >>> (cycpattern_check "efef" "eeff")
;; #f
;; >>> (cycpattern_check "himenss" "simen")
;; #t
(define (cycpattern_check a b)

(require rackunit)

(define (test-humaneval)

  (let (( candidate cycpattern_check))
    (check-within (candidate "xyzw" "xyw") #f 0.001)
    (check-within (candidate "yello" "ell") #t 0.001)
    (check-within (candidate "whattup" "ptut") #f 0.001)
    (check-within (candidate "efef" "fee") #t 0.001)
    (check-within (candidate "abab" "aabb") #f 0.001)
    (check-within (candidate "winemtt" "tinem") #t 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Return #t is list elements are monotonically increasing or decreasing.
;; >>> (monotonic (list 1 2 4 20))
;; #t
;; >>> (monotonic (list 1 20 4 10))
;; #f
;; >>> (monotonic (list 4 1 0 -10))
;; #t
(define (monotonic l)

(require rackunit)

(define (test-humaneval)

  (let (( candidate monotonic))
    (check-within (candidate (list 1 2 4 10)) #t 0.001)
    (check-within (candidate (list 1 2 4 20)) #t 0.001)
    (check-within (candidate (list 1 20 4 10)) #f 0.001)
    (check-within (candidate (list 4 1 0 -10)) #t 0.001)
    (check-within (candidate (list 4 1 1 0)) #t 0.001)
    (check-within (candidate (list 1 2 3 2 5 60)) #f 0.001)
    (check-within (candidate (list 1 2 3 4 5 60)) #t 0.001)
    (check-within (candidate (list 9 9 9 9)) #t 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Out of list of strings, return the longest one. Return the first one in case of multiple
;; strings of the same length. Return #f in case the input list is empty.
;; >>> (longest (list ))
;; #f
;; >>> (longest (list "a" "b" "c"))
;; "a"
;; >>> (longest (list "a" "bb" "ccc"))
;; "ccc"
(define (longest strings)

(require rackunit)

(define (test-humaneval)

  (let (( candidate longest))
    (check-within (candidate (list )) #f 0.001)
    (check-within (candidate (list "x" "y" "z")) "x" 0.001)
    (check-within (candidate (list "x" "yyy" "zzzz" "www" "kkkk" "abc")) "zzzz" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Return #t if all numbers in the list l are below threshold t.
;; >>> (below_threshold (list 1 2 4 10) 100)
;; #t
;; >>> (below_threshold (list 1 20 4 10) 5)
;; #f
(define (below_threshold l t)

(require rackunit)

(define (test-humaneval)

  (let (( candidate below_threshold))
    (check-within (candidate (list 1 2 4 10) 100) #t 0.001)
    (check-within (candidate (list 1 20 4 10) 5) #f 0.001)
    (check-within (candidate (list 1 20 4 10) 21) #t 0.001)
    (check-within (candidate (list 1 20 4 10) 22) #t 0.001)
    (check-within (candidate (list 1 8 4 10) 11) #t 0.001)
    (check-within (candidate (list 1 8 4 10) 10) #f 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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)
;; #t
;; 30 = 2 * 3 * 5
(define (is_multiply_prime a)

(require rackunit)

(define (test-humaneval)

  (let (( candidate is_multiply_prime))
    (check-within (candidate 5) #f 0.001)
    (check-within (candidate 30) #t 0.001)
    (check-within (candidate 8) #t 0.001)
    (check-within (candidate 10) #f 0.001)
    (check-within (candidate 125) #t 0.001)
    (check-within (candidate 105) #t 0.001)
    (check-within (candidate 126) #f 0.001)
    (check-within (candidate 729) #f 0.001)
    (check-within (candidate 891) #f 0.001)
    (check-within (candidate 1001) #t 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Return only positive numbers in the list.
;; >>> (get_positive (list -1 2 -4 5 6))
;; (list 2 5 6)
;; >>> (get_positive (list 5 3 -5 2 -3 3 9 0 123 1 -10))
;; (list 5 3 2 3 9 123 1)
(define (get_positive l)

(require rackunit)

(define (test-humaneval)

  (let (( candidate get_positive))
    (check-within (candidate (list -1 -2 4 5 6)) (list 4 5 6) 0.001)
    (check-within (candidate (list 5 3 -5 2 3 3 9 0 123 1 -10)) (list 5 3 2 3 3 9 123 1) 0.001)
    (check-within (candidate (list -1 -2)) (list ) 0.001)
    (check-within (candidate (list )) (list ) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; This function takes a list l and returns a list l' such that
;; l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
;; to the values of the corresponding indicies of l, but sorted.
;; >>> (sort_third (list 1 2 3))
;; (list 1 2 3)
;; >>> (sort_third (list 5 6 3 4 8 9 2))
;; (list 2 6 3 4 8 9 5)
(define (sort_third l)

(require rackunit)

(define (test-humaneval)

  (let (( candidate sort_third))
    (check-within (candidate (list 5 6 3 4 8 9 2)) (list 2 6 3 4 8 9 5) 0.001)
    (check-within (candidate (list 5 8 3 4 6 9 2)) (list 2 8 3 4 6 9 5) 0.001)
    (check-within (candidate (list 5 6 9 4 8 3 2)) (list 2 6 9 4 8 3 5) 0.001)
    (check-within (candidate (list 5 6 3 4 8 9 2 1)) (list 2 6 3 4 8 9 5 1) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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 "(()()) ((())) () ((())()())")
;; (list 2 3 1 3)
(define (parse_nested_parens paren_string)

(require rackunit)

(define (test-humaneval)

  (let (( candidate parse_nested_parens))
    (check-within (candidate "(()()) ((())) () ((())()())") (list 2 3 1 3) 0.001)
    (check-within (candidate "() (()) ((())) (((())))") (list 1 2 3 4) 0.001)
    (check-within (candidate "(()(())((())))") (list 4) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given length of a side and high return area for a triangle.
;; >>> (triangle_area 5 3)
;; 7.5
(define (triangle_area a h)

(require rackunit)

(define (test-humaneval)

  (let (( candidate triangle_area))
    (check-within (candidate 5 3) 7.5 0.001)
    (check-within (candidate 2 2) 2.0 0.001)
    (check-within (candidate 10 8) 40.0 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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
(define (multiply a b)

(require rackunit)

(define (test-humaneval)

  (let (( candidate multiply))
    (check-within (candidate 148 412) 16 0.001)
    (check-within (candidate 19 28) 72 0.001)
    (check-within (candidate 2020 1851) 0 0.001)
    (check-within (candidate 14 -15) 20 0.001)
    (check-within (candidate 76 67) 42 0.001)
    (check-within (candidate 17 27) 49 0.001)
    (check-within (candidate 0 1) 0 0.001)
    (check-within (candidate 0 0) 0 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; For a given list of input numbers, calculate Mean Absolute Deviation
;; around the mean of this dataset.
;; Mean Absolute Deviation is the average absolute difference between each
;; element and a centerpoint (mean in this case):
;; MAD = average | x - x_mean |
;; >>> (mean_absolute_deviation (list 1.0 2.0 3.0 4.0))
;; 1.0
(define (mean_absolute_deviation numbers)

(require rackunit)

(define (test-humaneval)

  (let (( candidate mean_absolute_deviation))
    (check-within (candidate (list 1.0 2.0)) 0.5 0.001)
    (check-within (candidate (list 1.0 2.0 3.0 4.0)) 1.0 0.001)
    (check-within (candidate (list 1.0 2.0 3.0 4.0 5.0)) 1.2 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Return sorted unique common elements for two lists.
;; >>> (common (list 1 4 3 34 653 2 5) (list 5 7 1 5 9 653 121))
;; (list 1 5 653)
;; >>> (common (list 5 3 2 8) (list 3 2))
;; (list 2 3)
(define (common l1 l2)

(require rackunit)

(define (test-humaneval)

  (let (( candidate common))
    (check-within (candidate (list 1 4 3 34 653 2 5) (list 5 7 1 5 9 653 121)) (list 1 5 653) 0.001)
    (check-within (candidate (list 5 3 2 8) (list 3 2)) (list 2 3) 0.001)
    (check-within (candidate (list 4 3 2 8) (list 3 2 4)) (list 2 3 4) 0.001)
    (check-within (candidate (list 4 3 2 8) (list )) (list ) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a positive integer, obtain its roman numeral equivalent as a string,
;; and return it in lowercase.
;; Restrictions: 1 <= num <= 1000
;; Examples:
;; >>> (int_to_mini_roman 19)
;; "xix"
;; >>> (int_to_mini_roman 152)
;; "clii"
;; >>> (int_to_mini_roman 426)
;; "cdxxvi"
(define (int_to_mini_roman number)

(require rackunit)

(define (test-humaneval)

  (let (( candidate int_to_mini_roman))
    (check-within (candidate 19) "xix" 0.001)
    (check-within (candidate 152) "clii" 0.001)
    (check-within (candidate 251) "ccli" 0.001)
    (check-within (candidate 426) "cdxxvi" 0.001)
    (check-within (candidate 500) "d" 0.001)
    (check-within (candidate 1) "i" 0.001)
    (check-within (candidate 4) "iv" 0.001)
    (check-within (candidate 43) "xliii" 0.001)
    (check-within (candidate 90) "xc" 0.001)
    (check-within (candidate 94) "xciv" 0.001)
    (check-within (candidate 532) "dxxxii" 0.001)
    (check-within (candidate 900) "cm" 0.001)
    (check-within (candidate 994) "cmxciv" 0.001)
    (check-within (candidate 1000) "m" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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
(define (fruit_distribution s n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate fruit_distribution))
    (check-within (candidate "5 apples and 6 oranges" 19) 8 0.001)
    (check-within (candidate "5 apples and 6 oranges" 21) 10 0.001)
    (check-within (candidate "0 apples and 1 oranges" 3) 2 0.001)
    (check-within (candidate "1 apples and 0 oranges" 3) 2 0.001)
    (check-within (candidate "2 apples and 3 oranges" 100) 95 0.001)
    (check-within (candidate "2 apples and 3 oranges" 5) 0 0.001)
    (check-within (candidate "1 apples and 100 oranges" 120) 19 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Task
;; We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
;; then check if the result string is palindrome.
;; A string is called palindrome if it reads the same backward as forward.
;; You should return a list containing the result string and #t/#f for the check.
;; Example
;; >>> (reverse_delete "abcde" "ae")
;; (list "bcd" #f)
;; >>> (reverse_delete "abcdef" "b")
;; (list "acdef" #f)
;; >>> (reverse_delete "abcdedcba" "ab")
;; (list "cdedc" #t)
(define (reverse_delete s c)

(require rackunit)

(define (test-humaneval)

  (let (( candidate reverse_delete))
    (check-within (candidate "abcde" "ae") (list "bcd" #f) 0.001)
    (check-within (candidate "abcdef" "b") (list "acdef" #f) 0.001)
    (check-within (candidate "abcdedcba" "ab") (list "cdedc" #t) 0.001)
    (check-within (candidate "dwik" "w") (list "dik" #f) 0.001)
    (check-within (candidate "a" "a") (list "" #t) 0.001)
    (check-within (candidate "abcdedcba" "") (list "abcdedcba" #t) 0.001)
    (check-within (candidate "abcdedcba" "v") (list "abcdedcba" #t) 0.001)
    (check-within (candidate "vabba" "v") (list "abba" #t) 0.001)
    (check-within (candidate "mamma" "mia") (list "" #t) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Return a greatest common divisor of two integers a and b
;; >>> (greatest_common_divisor 3 5)
;; 1
;; >>> (greatest_common_divisor 25 15)
;; 5
(define (greatest_common_divisor a b)

(require rackunit)

(define (test-humaneval)

  (let (( candidate greatest_common_divisor))
    (check-within (candidate 3 7) 1 0.001)
    (check-within (candidate 10 15) 5 0.001)
    (check-within (candidate 49 14) 7 0.001)
    (check-within (candidate 144 60) 12 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a string of words, return a list of words split on whitespace, if no whitespaces exists in the text you
;; should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
;; alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
;; Examples
;; >>> (split_words "Hello world!")
;; (list "Hello" "world!")
;; >>> (split_words "Hello,world!")
;; (list "Hello" "world!")
;; >>> (split_words "abcdef")
;; 3
(define (split_words txt)

(require rackunit)

(define (test-humaneval)

  (let (( candidate split_words))
    (check-within (candidate "Hello world!") (list "Hello" "world!") 0.001)
    (check-within (candidate "Hello,world!") (list "Hello" "world!") 0.001)
    (check-within (candidate "Hello world,!") (list "Hello" "world,!") 0.001)
    (check-within (candidate "Hello,Hello,world !") (list "Hello,Hello,world" "!") 0.001)
    (check-within (candidate "abcdef") 3 0.001)
    (check-within (candidate "aaabb") 2 0.001)
    (check-within (candidate "aaaBb") 1 0.001)
    (check-within (candidate "") 0 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; In this Kata, you have to sort a list of non-negative integers according to
;; number of ones in their binary representation in ascending order.
;; For similar number of ones, sort based on decimal value.
;; It must be implemented like this:
;; >>> (sort_array (list 1 5 2 3 4))
;; (list 1 2 3 4 5)
;; >>> (sort_array (list -2 -3 -4 -5 -6))
;; (list -6 -5 -4 -3 -2)
;; >>> (sort_array (list 1 0 2 3 4))
;; (list 0 1 2 3 4)
(define (sort_array arr)

(require rackunit)

(define (test-humaneval)

  (let (( candidate sort_array))
    (check-within (candidate (list 1 5 2 3 4)) (list 1 2 4 3 5) 0.001)
    (check-within (candidate (list -2 -3 -4 -5 -6)) (list -4 -2 -6 -5 -3) 0.001)
    (check-within (candidate (list 1 0 2 3 4)) (list 0 1 2 4 3) 0.001)
    (check-within (candidate (list )) (list ) 0.001)
    (check-within (candidate (list 2 5 77 4 5 3 5 7 2 3 4)) (list 2 2 4 4 3 3 5 5 5 7 77) 0.001)
    (check-within (candidate (list 3 6 44 12 32 5)) (list 32 3 5 6 12 44) 0.001)
    (check-within (candidate (list 2 4 8 16 32)) (list 2 4 8 16 32) 0.001)
    (check-within (candidate (list 2 4 8 16 32)) (list 2 4 8 16 32) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Concatenate list of strings into a single string
;; >>> (concatenate (list ))
;; ""
;; >>> (concatenate (list "a" "b" "c"))
;; "abc"
(define (concatenate strings)

(require rackunit)

(define (test-humaneval)

  (let (( candidate concatenate))
    (check-within (candidate (list )) "" 0.001)
    (check-within (candidate (list "x" "y" "z")) "xyz" 0.001)
    (check-within (candidate (list "x" "y" "z" "w" "k")) "xyzwk" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Write a function that accepts a list of strings as a parameter,
;; deletes the strings that have odd lengths from it,
;; and returns the resulted list with a sorted order,
;; The list is always a list of strings and never a list of numbers,
;; and it may contain duplicates.
;; The order of the list should be ascending by length of each word, and you
;; should return the list sorted by that rule.
;; If two words have the same length, sort the list alphabetically.
;; The function should return a list of strings in sorted order.
;; You may assume that all words will have the same length.
;; For example:
;; >>> (list_sort (list "aa" "a" "aaa"))
;; (list "aa")
;; >>> (list_sort (list "ab" "a" "aaa" "cd"))
;; (list "ab" "cd")
(define (sorted_list_sum lst)

(require rackunit)

(define (test-humaneval)

  (let (( candidate sorted_list_sum))
    (check-within (candidate (list "aa" "a" "aaa")) (list "aa") 0.001)
    (check-within (candidate (list "school" "AI" "asdf" "b")) (list "AI" "asdf" "school") 0.001)
    (check-within (candidate (list "d" "b" "c" "a")) (list ) 0.001)
    (check-within (candidate (list "d" "dcba" "abcd" "a")) (list "abcd" "dcba") 0.001)
    (check-within (candidate (list "AI" "ai" "au")) (list "AI" "ai" "au") 0.001)
    (check-within (candidate (list "a" "b" "b" "c" "c" "a")) (list ) 0.001)
    (check-within (candidate (list "aaaa" "bbbb" "dd" "cc")) (list "cc" "dd" "aaaa" "bbbb") 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Filter an input list of strings only for ones that contain given substring
;; >>> (filter_by_substring (list ) "a")
;; (list )
;; >>> (filter_by_substring (list "abc" "bacd" "cde" "array") "a")
;; (list "abc" "bacd" "array")
(define (filter_by_substring strings substring)

(require rackunit)

(define (test-humaneval)

  (let (( candidate filter_by_substring))
    (check-within (candidate (list ) "john") (list ) 0.001)
    (check-within (candidate (list "xxx" "asd" "xxy" "john doe" "xxxAAA" "xxx") "xxx") (list "xxx" "xxxAAA" "xxx") 0.001)
    (check-within (candidate (list "xxx" "asd" "aaaxxy" "john doe" "xxxAAA" "xxx") "xx") (list "xxx" "aaaxxy" "xxxAAA" "xxx") 0.001)
    (check-within (candidate (list "grunt" "trumpet" "prune" "gruesome") "run") (list "grunt" "prune") 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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.
(define (closest_integer value)

(require rackunit)

(define (test-humaneval)

  (let (( candidate closest_integer))
    (check-within (candidate "10") 10 0.001)
    (check-within (candidate "14.5") 15 0.001)
    (check-within (candidate "-15.5") -16 0.001)
    (check-within (candidate "15.3") 15 0.001)
    (check-within (candidate "0") 0 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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
(define (vowels_count s)

(require rackunit)

(define (test-humaneval)

  (let (( candidate vowels_count))
    (check-within (candidate "abcde") 2 0.001)
    (check-within (candidate "Alone") 3 0.001)
    (check-within (candidate "key") 2 0.001)
    (check-within (candidate "bye") 1 0.001)
    (check-within (candidate "keY") 2 0.001)
    (check-within (candidate "bYe") 1 0.001)
    (check-within (candidate "ACEDY") 3 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Write a function that accepts a list of strings.
;; The list contains different words. Return the word with maximum number
;; of unique characters. If multiple strings have maximum number of unique
;; characters, return the one which comes first in lexicographical order.
;; >>> (find_max (list "name" "of" "string"))
;; "string"
;; >>> (find_max (list "name" "enam" "game"))
;; "enam"
;; >>> (find_max (list "aaaaaaa" "bb" "cc"))
;; "aaaaaaa"
(define (find_max words)

(require rackunit)

(define (test-humaneval)

  (let (( candidate find_max))
    (check-within (candidate (list "name" "of" "string")) "string" 0.001)
    (check-within (candidate (list "name" "enam" "game")) "enam" 0.001)
    (check-within (candidate (list "aaaaaaa" "bb" "cc")) "aaaaaaa" 0.001)
    (check-within (candidate (list "abc" "cba")) "abc" 0.001)
    (check-within (candidate (list "play" "this" "game" "of" "footbott")) "footbott" 0.001)
    (check-within (candidate (list "we" "are" "gonna" "rock")) "gonna" 0.001)
    (check-within (candidate (list "we" "are" "a" "mad" "nation")) "nation" 0.001)
    (check-within (candidate (list "this" "is" "a" "prrk")) "this" 0.001)
    (check-within (candidate (list "b")) "b" 0.001)
    (check-within (candidate (list "play" "play" "play")) "play" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a string 'text', return its md5 hash equivalent string.
;; If 'text' is an empty string, return #f.
;; >>> (string_to_md5 "Hello world")
;; "3e25960a79dbc69b674cd4ec67a72c62"
(define (string_to_md5 text)

(require rackunit)

(define (test-humaneval)

  (let (( candidate string_to_md5))
    (check-within (candidate "Hello world") "3e25960a79dbc69b674cd4ec67a72c62" 0.001)
    (check-within (candidate "") #f 0.001)
    (check-within (candidate "A B C") "0ef78513b0cb8cef12743f5aeb35f888" 0.001)
    (check-within (candidate "password") "5f4dcc3b5aa765d61d8327deb882cf99" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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"
(define (change_base x base)

(require rackunit)

(define (test-humaneval)

  (let (( candidate change_base))
    (check-within (candidate 8 3) "22" 0.001)
    (check-within (candidate 9 3) "100" 0.001)
    (check-within (candidate 234 2) "11101010" 0.001)
    (check-within (candidate 16 2) "10000" 0.001)
    (check-within (candidate 8 2) "1000" 0.001)
    (check-within (candidate 7 2) "111" 0.001)
    (check-within (candidate 2 3) "2" 0.001)
    (check-within (candidate 3 4) "3" 0.001)
    (check-within (candidate 4 5) "4" 0.001)
    (check-within (candidate 5 6) "5" 0.001)
    (check-within (candidate 6 7) "6" 0.001)
    (check-within (candidate 7 8) "7" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given the lengths of the three sides of a triangle. Return #t if the three
;; sides form a right-angled triangle, #f otherwise.
;; A right-angled triangle is a triangle in which one angle is right angle or
;; 90 degree.
;; Example:
;; >>> (right_angle_triangle 3 4 5)
;; #t
;; >>> (right_angle_triangle 1 2 3)
;; #f
(define (right_angle_triangle a b c)

(require rackunit)

(define (test-humaneval)

  (let (( candidate right_angle_triangle))
    (check-within (candidate 3 4 5) #t 0.001)
    (check-within (candidate 1 2 3) #f 0.001)
    (check-within (candidate 10 6 8) #t 0.001)
    (check-within (candidate 2 2 2) #f 0.001)
    (check-within (candidate 7 24 25) #t 0.001)
    (check-within (candidate 10 5 7) #f 0.001)
    (check-within (candidate 5 12 13) #t 0.001)
    (check-within (candidate 15 8 17) #t 0.001)
    (check-within (candidate 48 55 73) #t 0.001)
    (check-within (candidate 1 1 1) #f 0.001)
    (check-within (candidate 2 2 10) #f 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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 list of GPAs for some students and you have to write
;; a function that can output a list of letter grades using the following table:
;; GPA       |    Letter grade
;; 4.0                A+
;; > 3.7                A
;; > 3.3                A-
;; > 3.0                B+
;; > 2.7                B
;; > 2.3                B-
;; > 2.0                C+
;; > 1.7                C
;; > 1.3                C-
;; > 1.0                D+
;; > 0.7                D
;; > 0.0                D-
;; 0.0                E
;; Example:
;; >>> (grade_equation (list 4.0 3 1.7 2 3.5))
;; (list "A+" "B" "C-" "C" "A-")
(define (numerical_letter_grade grades)

(require rackunit)

(define (test-humaneval)

  (let (( candidate numerical_letter_grade))
    (check-within (candidate (list 4.0 3 1.7 2 3.5)) (list "A+" "B" "C-" "C" "A-") 0.001)
    (check-within (candidate (list 1.2)) (list "D+") 0.001)
    (check-within (candidate (list 0.5)) (list "D-") 0.001)
    (check-within (candidate (list 0.0)) (list "E") 0.001)
    (check-within (candidate (list 1.0 0.3 1.5 2.8 3.3)) (list "D" "D-" "C-" "B" "B+") 0.001)
    (check-within (candidate (list 0.0 0.7)) (list "E" "D-") 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Insert a number 'delimeter' between every two consecutive elements of input list `numbers'
;; >>> (intersperse (list ) 4)
;; (list )
;; >>> (intersperse (list 1 2 3) 4)
;; (list 1 4 2 4 3)
(define (intersperse numbers delimeter)

(require rackunit)

(define (test-humaneval)

  (let (( candidate intersperse))
    (check-within (candidate (list ) 7) (list ) 0.001)
    (check-within (candidate (list 5 6 3 2) 8) (list 5 8 6 8 3 8 2) 0.001)
    (check-within (candidate (list 2 2 2) 2) (list 2 2 2 2 2) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Write a function that takes a list of numbers as input and returns
;; the number of elements in the list that are greater than 10 and both
;; first and last digits of a number are odd (1, 3, 5, 7, 9).
;; For example:
;; >>> (specialFilter (list 15 -73 14 -15))
;; 1
;; >>> (specialFilter (list 33 -2 -3 45 21 109))
;; 2
(define (specialFilter nums)

(require rackunit)

(define (test-humaneval)

  (let (( candidate specialFilter))
    (check-within (candidate (list 5 -2 1 -5)) 0 0.001)
    (check-within (candidate (list 15 -73 14 -15)) 1 0.001)
    (check-within (candidate (list 33 -2 -3 45 21 109)) 2 0.001)
    (check-within (candidate (list 43 -12 93 125 121 109)) 4 0.001)
    (check-within (candidate (list 71 -2 -33 75 21 19)) 3 0.001)
    (check-within (candidate (list 1)) 0 0.001)
    (check-within (candidate (list )) 0 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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
(define (sum_to_n n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate sum_to_n))
    (check-within (candidate 1) 1 0.001)
    (check-within (candidate 6) 21 0.001)
    (check-within (candidate 11) 66 0.001)
    (check-within (candidate 30) 465 0.001)
    (check-within (candidate 100) 5050 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; From a list of integers, remove all elements that occur more than once.
;; Keep order of elements left the same as in the input.
;; >>> (remove_duplicates (list 1 2 3 2 4))
;; (list 1 3 4)
(define (remove_duplicates numbers)

(require rackunit)

(define (test-humaneval)

  (let (( candidate remove_duplicates))
    (check-within (candidate (list )) (list ) 0.001)
    (check-within (candidate (list 1 2 3 4)) (list 1 2 3 4) 0.001)
    (check-within (candidate (list 1 2 3 2 4 3 5)) (list 1 4 5) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given two positive integers a and b, return the even digits between a
;; and b, in ascending order.
;; For example:
;; >>> (generate_integers 2 8)
;; (list 2 4 6 8)
;; >>> (generate_integers 8 2)
;; (list 2 4 6 8)
;; >>> (generate_integers 10 14)
;; (list )
(define (generate_integers a b)

(require rackunit)

(define (test-humaneval)

  (let (( candidate generate_integers))
    (check-within (candidate 2 10) (list 2 4 6 8) 0.001)
    (check-within (candidate 10 2) (list 2 4 6 8) 0.001)
    (check-within (candidate 132 2) (list 2 4 6 8) 0.001)
    (check-within (candidate 17 89) (list ) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; From a given list of integers, generate a list of rolling maximum element found until given moment
;; in the sequence.
;; >>> (rolling_max (list 1 2 3 2 3 4 2))
;; (list 1 2 3 3 3 4 4)
(define (rolling_max numbers)

(require rackunit)

(define (test-humaneval)

  (let (( candidate rolling_max))
    (check-within (candidate (list )) (list ) 0.001)
    (check-within (candidate (list 1 2 3 4)) (list 1 2 3 4) 0.001)
    (check-within (candidate (list 4 3 2 1)) (list 4 4 4 4) 0.001)
    (check-within (candidate (list 3 2 3 100 3)) (list 3 3 3 100 100) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; You're given a list of deposit and withdrawal operations on a bank account that starts with
;; zero balance. Your task is to detect if at any point the balance of account fallls below zero, and
;; at that point function should return #t. Otherwise it should return #f.
;; >>> (below_zero (list 1 2 3))
;; #f
;; >>> (below_zero (list 1 2 -4 5))
;; #t
(define (below_zero operations)

(require rackunit)

(define (test-humaneval)

  (let (( candidate below_zero))
    (check-within (candidate (list )) #f 0.001)
    (check-within (candidate (list 1 2 -3 1 2 -3)) #f 0.001)
    (check-within (candidate (list 1 2 -4 5 6)) #t 0.001)
    (check-within (candidate (list 1 -1 2 -2 5 -5 4 -4)) #f 0.001)
    (check-within (candidate (list 1 -1 2 -2 5 -5 4 -5)) #t 0.001)
    (check-within (candidate (list 1 -2 2 -2 5 -5 4 -4)) #t 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; You are given a non-empty list of positive integers. Return the greatest integer that is greater than
;; zero, and has a frequency greater than or equal to the value of the integer itself.
;; The frequency of an integer is the number of times it appears in the list.
;; If no such a value exist, return -1.
;; Examples:
;; >>> (search (list 4 1 2 2 3 1))
;; 2
;; >>> (search (list 1 2 2 3 3 3 4 4 4))
;; 3
;; >>> (search (list 5 5 4 4 4))
;; -1
(define (search lst)


Prompt:
#lang racket

;; brackets is a string of "(" and ")".
;; return #t if every opening bracket has a corresponding closing bracket.
;; >>> (correct_bracketing "(")
;; #f
;; >>> (correct_bracketing "()")
;; #t
;; >>> (correct_bracketing "(()())")
;; #t
;; >>> (correct_bracketing ")(()")
;; #f
(define (correct_bracketing brackets)

(require rackunit)

(define (test-humaneval)

  (let (( candidate correct_bracketing))
    (check-within (candidate "()") #t 0.001)
    (check-within (candidate "(()())") #t 0.001)
    (check-within (candidate "()()(()())()") #t 0.001)
    (check-within (candidate "()()((()()())())(()()(()))") #t 0.001)
    (check-within (candidate "((()())))") #f 0.001)
    (check-within (candidate ")(()") #f 0.001)
    (check-within (candidate "(") #f 0.001)
    (check-within (candidate "((((") #f 0.001)
    (check-within (candidate ")") #f 0.001)
    (check-within (candidate "(()") #f 0.001)
    (check-within (candidate "()()(()())())(()") #f 0.001)
    (check-within (candidate "()()(()())()))()") #f 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; This function takes a list l and returns a list l' such that
;; l' is identical to l in the odd indicies, while its values at the even indicies are equal
;; to the values of the even indicies of l, but sorted.
;; >>> (sort_even (list 1 2 3))
;; (list 1 2 3)
;; >>> (sort_even (list 5 6 3 4))
;; (list 3 6 5 4)
(define (sort_even l)

(require rackunit)

(define (test-humaneval)

  (let (( candidate sort_even))
    (check-within (candidate (list 1 2 3)) (list 1 2 3) 0.001)
    (check-within (candidate (list 5 3 -5 2 -3 3 9 0 123 1 -10)) (list -10 3 -5 2 -3 3 5 0 9 1 123) 0.001)
    (check-within (candidate (list 5 8 -12 4 23 2 3 11 12 -10)) (list -12 8 3 4 5 2 12 11 23 -10) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Check if two words have the same characters.
;; >>> (same_chars "eabcdzzzz" "dddzzzzzzzddeddabc")
;; #t
;; >>> (same_chars "abcd" "dddddddabc")
;; #t
;; >>> (same_chars "dddddddabc" "abcd")
;; #t
;; >>> (same_chars "eabcd" "dddddddabc")
;; #f
;; >>> (same_chars "abcd" "dddddddabce")
;; #f
;; >>> (same_chars "eabcdzzzz" "dddzzzzzzzddddabc")
;; #f
(define (same_chars s0 s1)

(require rackunit)

(define (test-humaneval)

  (let (( candidate same_chars))
    (check-within (candidate "eabcdzzzz" "dddzzzzzzzddeddabc") #t 0.001)
    (check-within (candidate "abcd" "dddddddabc") #t 0.001)
    (check-within (candidate "dddddddabc" "abcd") #t 0.001)
    (check-within (candidate "eabcd" "dddddddabc") #f 0.001)
    (check-within (candidate "abcd" "dddddddabcf") #f 0.001)
    (check-within (candidate "eabcdzzzz" "dddzzzzzzzddddabc") #f 0.001)
    (check-within (candidate "aabb" "aaccc") #f 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; brackets is a string of "<" and ">".
;; return #t if every opening bracket has a corresponding closing bracket.
;; >>> (correct_bracketing "<")
;; #f
;; >>> (correct_bracketing "<>")
;; #t
;; >>> (correct_bracketing "<<><>>")
;; #t
;; >>> (correct_bracketing "><<>")
;; #f
(define (correct_bracketing brackets)

(require rackunit)

(define (test-humaneval)

  (let (( candidate correct_bracketing))
    (check-within (candidate "<>") #t 0.001)
    (check-within (candidate "<<><>>") #t 0.001)
    (check-within (candidate "<><><<><>><>") #t 0.001)
    (check-within (candidate "<><><<<><><>><>><<><><<>>>") #t 0.001)
    (check-within (candidate "<<<><>>>>") #f 0.001)
    (check-within (candidate "><<>") #f 0.001)
    (check-within (candidate "<") #f 0.001)
    (check-within (candidate "<<<<") #f 0.001)
    (check-within (candidate ">") #f 0.001)
    (check-within (candidate "<<>") #f 0.001)
    (check-within (candidate "<><><<><>><>><<>") #f 0.001)
    (check-within (candidate "<><><<><>><>>><>") #f 0.001)
))

(test-humaneval)