Prompt:
#lang racket

;; Return length of given string
;; >>> (strlen "")
;; 0
;; >>> (strlen "abc")
;; 3
(define (strlen string)

(require rackunit)

(define (test-humaneval)

  (let (( candidate strlen))
    (check-within (candidate "") 0 0.001)
    (check-within (candidate "x") 1 0.001)
    (check-within (candidate "asdasnakj") 9 0.001)
))

(test-humaneval)


Prompt:
#lang racket

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

(require rackunit)

(define (test-humaneval)

  (let (( candidate encrypt))
    (check-within (candidate "hi") "lm" 0.001)
    (check-within (candidate "asdfghjkl") "ewhjklnop" 0.001)
    (check-within (candidate "gf") "kj" 0.001)
    (check-within (candidate "et") "ix" 0.001)
    (check-within (candidate "faewfawefaewg") "jeiajeaijeiak" 0.001)
    (check-within (candidate "hellomyfriend") "lippsqcjvmirh" 0.001)
    (check-within (candidate "dxzdlmnilfuhmilufhlihufnmlimnufhlimnufhfucufh") "hbdhpqrmpjylqmpyjlpmlyjrqpmqryjlpmqryjljygyjl" 0.001)
    (check-within (candidate "a") "e" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a hash, return #t if all keys are strings in lower
;; case or all keys are strings in upper case, else return #f.
;; The function should return #f is the given hash is empty.
;; Examples:
;; >>> (check_dict_case #hash(("a" .  "apple") ("b" .  "banana")))
;; #t
;; >>> (check_dict_case #hash(("a" .  "apple") ("A" .  "banana") ("B" .  "banana")))
;; #f
;; >>> (check_dict_case #hash(("a" .  "apple") (8 .  "banana") ("a" .  "apple")))
;; #f
;; >>> (check_dict_case #hash(("Name" .  "John") ("Age" .  "36") ("City" .  "Houston")))
;; #f
;; >>> (check_dict_case #hash(("STATE" .  "NC") ("ZIP" .  "12345")))
;; #t
(define (check_dict_case dict)

(require rackunit)

(define (test-humaneval)

  (let (( candidate check_dict_case))
    (check-within (candidate #hash(("p" .  "pineapple") ("b" .  "banana"))) #t 0.001)
    (check-within (candidate #hash(("p" .  "pineapple") ("A" .  "banana") ("B" .  "banana"))) #f 0.001)
    (check-within (candidate #hash(("p" .  "pineapple") ("5" .  "banana") ("a" .  "apple"))) #f 0.001)
    (check-within (candidate #hash(("Name" .  "John") ("Age" .  "36") ("City" .  "Houston"))) #f 0.001)
    (check-within (candidate #hash(("STATE" .  "NC") ("ZIP" .  "12345"))) #t 0.001)
    (check-within (candidate #hash(("fruit" .  "Orange") ("taste" .  "Sweet"))) #t 0.001)
    (check-within (candidate #hash()) #f 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a non-empty list of integers lst. add the even elements that are at odd indices..
;; Examples:
;; >>> (add (list 4 2 6 7))
;; 2
(define (add lst)

(require rackunit)

(define (test-humaneval)

  (let (( candidate add))
    (check-within (candidate (list 4 88)) 88 0.001)
    (check-within (candidate (list 4 5 6 7 2 122)) 122 0.001)
    (check-within (candidate (list 4 0 6 7)) 0 0.001)
    (check-within (candidate (list 4 4 6 8)) 12 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a string text, replace all spaces in it with underscores,
;; and if a string has more than 2 consecutive spaces,
;; then replace all consecutive spaces with -
;; >>> (fix_spaces " Example")
;; "Example"
;; >>> (fix_spaces " Example 1")
;; "Example_1"
;; >>> (fix_spaces " Example 2")
;; "_Example_2"
;; >>> (fix_spaces " Example 3")
;; "_Example-3"
(define (fix_spaces text)

(require rackunit)

(define (test-humaneval)

  (let (( candidate fix_spaces))
    (check-within (candidate "Example") "Example" 0.001)
    (check-within (candidate "Mudasir Hanif ") "Mudasir_Hanif_" 0.001)
    (check-within (candidate "Yellow Yellow  Dirty  Fellow") "Yellow_Yellow__Dirty__Fellow" 0.001)
    (check-within (candidate "Exa   mple") "Exa-mple" 0.001)
    (check-within (candidate "   Exa 1 2 2 mple") "-Exa_1_2_2_mple" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

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

(require rackunit)

(define (test-humaneval)

  (let (( candidate fibfib))
    (check-within (candidate 2) 1 0.001)
    (check-within (candidate 1) 0 0.001)
    (check-within (candidate 5) 4 0.001)
    (check-within (candidate 8) 24 0.001)
    (check-within (candidate 10) 81 0.001)
    (check-within (candidate 12) 274 0.001)
    (check-within (candidate 14) 927 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a list of numbers, return the sum of squares of the numbers
;; in the list that are odd. Ignore numbers that are negative or not integers.
;; >>> (double_the_difference (list 1 3 2 0))
;; 10
;; >>> (double_the_difference (list -1 -2 0))
;; 0
;; >>> (double_the_difference (list 9 -2))
;; 81
;; >>> (double_the_difference (list 0))
;; 0
;; If the input list is empty, return 0.
(define (double_the_difference lst)

(require rackunit)

(define (test-humaneval)

  (let (( candidate double_the_difference))
    (check-within (candidate (list )) 0 0.001)
    (check-within (candidate (list 5.0 4.0)) 25 0.001)
    (check-within (candidate (list 0.1 0.2 0.3)) 0 0.001)
    (check-within (candidate (list -10.0 -20.0 -30.0)) 0 0.001)
    (check-within (candidate (list -1.0 -2.0 8.0)) 0 0.001)
    (check-within (candidate (list 0.2 3.0 5.0)) 34 0.001)
    (check-within (candidate (list -9.0 -7.0 -5.0 -3.0 -1.0 1.0 3.0 5.0 7.0 9.0)) 165 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Filter given list of any rktthon values only for integers
;; >>> (filter_integers (list "a" 3.14 5))
;; (list 5)
;; >>> (filter_integers (list 1 2 3 "abc" #hash() (list )))
;; (list 1 2 3)
(define (filter_integers values)

(require rackunit)

(define (test-humaneval)

  (let (( candidate filter_integers))
    (check-within (candidate (list )) (list ) 0.001)
    (check-within (candidate (list 4 #hash() (list ) 23.2 9 "adasd")) (list 4 9) 0.001)
    (check-within (candidate (list 3 "c" 3 3 "a" "b")) (list 3 3 3) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

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

(require rackunit)

(define (test-humaneval)

  (let (( candidate car_race_collision))
    (check-within (candidate 2) 4 0.001)
    (check-within (candidate 3) 9 0.001)
    (check-within (candidate 4) 16 0.001)
    (check-within (candidate 8) 64 0.001)
    (check-within (candidate 10) 100 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Input to this function is a string representing musical notes in a special ASCII format.
;; Your task is to parse this string and return list of integers corresponding to how many beats does each
;; not last.
;; Here is a legend:
;; 'o' - whole note, lasts four beats
;; 'o|' - half note, lasts two beats
;; '.|' - quater note, lasts one beat
;; >>> (parse_music "o o| .| o| o| .| .| .| .| o o")
;; (list 4 2 1 2 2 1 1 1 1 4 4)
(define (parse_music music_string)

(require rackunit)

(define (test-humaneval)

  (let (( candidate parse_music))
    (check-within (candidate "") (list ) 0.001)
    (check-within (candidate "o o o o") (list 4 4 4 4) 0.001)
    (check-within (candidate ".| .| .| .|") (list 1 1 1 1) 0.001)
    (check-within (candidate "o| o| .| .| o o o o") (list 2 2 1 1 4 4 4 4) 0.001)
    (check-within (candidate "o| .| o| .| o o| o o|") (list 2 1 2 1 4 2 4 2) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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"
(define (decimal_to_binary decimal)

(require rackunit)

(define (test-humaneval)

  (let (( candidate decimal_to_binary))
    (check-within (candidate 0) "db0db" 0.001)
    (check-within (candidate 32) "db100000db" 0.001)
    (check-within (candidate 103) "db1100111db" 0.001)
    (check-within (candidate 15) "db1111db" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Return list of all prefixes from shortest to longest of the input string
;; >>> (all_prefixes "abc")
;; (list "a" "ab" "abc")
(define (all_prefixes string)

(require rackunit)

(define (test-humaneval)

  (let (( candidate all_prefixes))
    (check-within (candidate "") (list ) 0.001)
    (check-within (candidate "asdfgh") (list "a" "as" "asd" "asdf" "asdfg" "asdfgh") 0.001)
    (check-within (candidate "WWW") (list "W" "WW" "WWW") 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Add two numbers x and y
;; >>> (add 2 3)
;; 5
;; >>> (add 5 7)
;; 12
(define (add x y)

(require rackunit)

(define (test-humaneval)

  (let (( candidate add))
    (check-within (candidate 0 1) 1 0.001)
    (check-within (candidate 1 0) 1 0.001)
    (check-within (candidate 2 3) 5 0.001)
    (check-within (candidate 5 7) 12 0.001)
    (check-within (candidate 7 5) 12 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; You're a hungry rabbit, and you already have eaten a certain number of carrots,
;; but now you need to eat more carrots to complete the day's meals.
;; you should return a list of [ total number of eaten carrots after your meals,
;; the number of carrots left after your meals ]
;; if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
;; Example:
;; >>> (eat 5 6 10)
;; (list 11 4)
;; >>> (eat 4 8 9)
;; (list 12 1)
;; >>> (eat 1 10 10)
;; (list 11 0)
;; >>> (eat 2 11 5)
;; (list 7 0)
;; Variables:
;; @number : integer
;; the number of carrots that you have eaten.
;; @need : integer
;; the number of carrots that you need to eat.
;; @remaining : integer
;; the number of remaining carrots thet exist in stock
;; Constrain:
;; * 0 <= number <= 1000
;; * 0 <= need <= 1000
;; * 0 <= remaining <= 1000
;; Have fun :)
(define (eat number need remaining)

(require rackunit)

(define (test-humaneval)

  (let (( candidate eat))
    (check-within (candidate 5 6 10) (list 11 4) 0.001)
    (check-within (candidate 4 8 9) (list 12 1) 0.001)
    (check-within (candidate 1 10 10) (list 11 0) 0.001)
    (check-within (candidate 2 11 5) (list 7 0) 0.001)
    (check-within (candidate 4 5 7) (list 9 2) 0.001)
    (check-within (candidate 4 5 1) (list 5 0) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; You are given a rectangular grid of wells. Each row represents a single well,
;; and each 1 in a row represents a single unit of water.
;; Each well has a corresponding bucket that can be used to extract water from it,
;; and all buckets have the same capacity.
;; Your task is to use the buckets to empty the wells.
;; Output the number of times you need to lower the buckets.
;; Example 1:
;; >>> (max_fill (list (list 0 0 1 0) (list 0 1 0 0) (list 1 1 1 1)) 1)
;; 6
;; Example 2:
;; >>> (max_fill (list (list 0 0 1 1) (list 0 0 0 0) (list 1 1 1 1) (list 0 1 1 1)) 2)
;; 5
;; Example 3:
;; >>> (max_fill (list (list 0 0 0) (list 0 0 0)) 5)
;; 0
;; Constraints:
;; * all wells have the same length
;; * 1 <= grid.length <= 10^2
;; * 1 <= grid[:,1].length <= 10^2
;; * grid[i][j] -> 0 | 1
;; * 1 <= capacity <= 10
(define (max_fill grid capacity)

(require rackunit)

(define (test-humaneval)

  (let (( candidate max_fill))
    (check-within (candidate (list (list 0 0 1 0) (list 0 1 0 0) (list 1 1 1 1)) 1) 6 0.001)
    (check-within (candidate (list (list 0 0 1 1) (list 0 0 0 0) (list 1 1 1 1) (list 0 1 1 1)) 2) 5 0.001)
    (check-within (candidate (list (list 0 0 0) (list 0 0 0)) 5) 0 0.001)
    (check-within (candidate (list (list 1 1 1 1) (list 1 1 1 1)) 2) 4 0.001)
    (check-within (candidate (list (list 1 1 1 1) (list 1 1 1 1)) 9) 2 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given two lists operator, and operand. The first list has basic algebra operations, and
;; the second list is a list of integers. Use the two given lists to build the algebric
;; expression and return the evaluation of this expression.
;; The basic algebra operations:
;; Addition ( + )
;; Subtraction ( - )
;; Multiplication ( * )
;; Floor division ( // )
;; Exponentiation ( ** )
;; Example:
;; operator['+', '*', '-']
;; list = [2, 3, 4, 5]
;; result = 2 + 3 * 4 - 5
;; => result = 9
;; Note:
;; The length of operator list is equal to the length of operand list minus one.
;; Operand is a list of of non-negative integers.
;; Operator list has at least one operator, and operand list has at least two operands.
(define (do_algebra operator operand)

(require rackunit)

(define (test-humaneval)

  (let (( candidate do_algebra))
    (check-within (candidate (list "**" "*" "+") (list 2 3 4 5)) 37 0.001)
    (check-within (candidate (list "+" "*" "-") (list 2 3 4 5)) 9 0.001)
    (check-within (candidate (list "//" "*") (list 7 3 4)) 8 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
;; >>> (flip_case "Hello")
;; "hELLO"
(define (flip_case string)

(require rackunit)

(define (test-humaneval)

  (let (( candidate flip_case))
    (check-within (candidate "") "" 0.001)
    (check-within (candidate "Hello!") "hELLO!" 0.001)
    (check-within (candidate "These violent delights have violent ends") "tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a list of integers, sort the integers that are between 1 and 9 inclusive,
;; reverse the resulting list, and then replace each digit by its corresponding name from
;; "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
;; For example:
;; >>> (by_length (list 2 1 1 4 5 8 2 3))
;; (list "Eight" "Five" "Four" "Three" "Two" "Two" "One" "One")
;; If the list is empty, return an empty list:
;; >>> (by_length (list ))
;; (list )
;; If the list has any strange number ignore it:
;; >>> (by_length (list 1 -1 55))
;; (list "One")
(define (by_length arr)

(require rackunit)

(define (test-humaneval)

  (let (( candidate by_length))
    (check-within (candidate (list 2 1 1 4 5 8 2 3)) (list "Eight" "Five" "Four" "Three" "Two" "Two" "One" "One") 0.001)
    (check-within (candidate (list )) (list ) 0.001)
    (check-within (candidate (list 1 -1 55)) (list "One") 0.001)
    (check-within (candidate (list 1 -1 3 2)) (list "Three" "Two" "One") 0.001)
    (check-within (candidate (list 9 4 8)) (list "Nine" "Eight" "Four") 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Return list of prime factors of given integer in the order from smallest to largest.
;; Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
;; Input number should be equal to the product of all factors
;; >>> (factorize 8)
;; (list 2 2 2)
;; >>> (factorize 25)
;; (list 5 5)
;; >>> (factorize 70)
;; (list 2 5 7)
(define (factorize n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate factorize))
    (check-within (candidate 2) (list 2) 0.001)
    (check-within (candidate 4) (list 2 2) 0.001)
    (check-within (candidate 8) (list 2 2 2) 0.001)
    (check-within (candidate 57) (list 3 19) 0.001)
    (check-within (candidate 3249) (list 3 3 19 19) 0.001)
    (check-within (candidate 185193) (list 3 3 3 19 19 19) 0.001)
    (check-within (candidate 20577) (list 3 19 19 19) 0.001)
    (check-within (candidate 18) (list 2 3 3) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Implement a function that takes an non-negative integer and returns a list of the first n
;; integers that are prime numbers and less than n.
;; for example:
;; >>> (count_up_to 5)
;; (list 2 3)
;; >>> (count_up_to 11)
;; (list 2 3 5 7)
;; >>> (count_up_to 0)
;; (list )
;; >>> (count_up_to 20)
;; (list 2 3 5 7 11 13 17 19)
;; >>> (count_up_to 1)
;; (list )
;; >>> (count_up_to 18)
;; (list 2 3 5 7 11 13 17)
(define (count_up_to n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate count_up_to))
    (check-within (candidate 5) (list 2 3) 0.001)
    (check-within (candidate 6) (list 2 3 5) 0.001)
    (check-within (candidate 7) (list 2 3 5) 0.001)
    (check-within (candidate 10) (list 2 3 5 7) 0.001)
    (check-within (candidate 0) (list ) 0.001)
    (check-within (candidate 22) (list 2 3 5 7 11 13 17 19) 0.001)
    (check-within (candidate 1) (list ) 0.001)
    (check-within (candidate 18) (list 2 3 5 7 11 13 17) 0.001)
    (check-within (candidate 47) (list 2 3 5 7 11 13 17 19 23 29 31 37 41 43) 0.001)
    (check-within (candidate 101) (list 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) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Return sorted unique elements in a list
;; >>> (unique (list 5 3 5 2 3 3 9 0 123))
;; (list 0 2 3 5 9 123)
(define (unique l)

(require rackunit)

(define (test-humaneval)

  (let (( candidate unique))
    (check-within (candidate (list 5 3 5 2 3 3 9 0 123)) (list 0 2 3 5 9 123) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Write a function that accepts two lists of strings and returns the list that has
;; total number of chars in the all strings of the list less than the other list.
;; if the two lists have the same number of chars, return the first list.
;; Examples
;; >>> (total_match (list ) (list ))
;; (list )
;; >>> (total_match (list "hi" "admin") (list "hI" "Hi"))
;; (list "hI" "Hi")
;; >>> (total_match (list "hi" "admin") (list "hi" "hi" "admin" "project"))
;; (list "hi" "admin")
;; >>> (total_match (list "hi" "admin") (list "hI" "hi" "hi"))
;; (list "hI" "hi" "hi")
;; >>> (total_match (list "4") (list "1" "2" "3" "4" "5"))
;; (list "4")
(define (total_match lst1 lst2)

(require rackunit)

(define (test-humaneval)

  (let (( candidate total_match))
    (check-within (candidate (list ) (list )) (list ) 0.001)
    (check-within (candidate (list "hi" "admin") (list "hi" "hi")) (list "hi" "hi") 0.001)
    (check-within (candidate (list "hi" "admin") (list "hi" "hi" "admin" "project")) (list "hi" "admin") 0.001)
    (check-within (candidate (list "4") (list "1" "2" "3" "4" "5")) (list "4") 0.001)
    (check-within (candidate (list "hi" "admin") (list "hI" "Hi")) (list "hI" "Hi") 0.001)
    (check-within (candidate (list "hi" "admin") (list "hI" "hi" "hi")) (list "hI" "hi" "hi") 0.001)
    (check-within (candidate (list "hi" "admin") (list "hI" "hi" "hii")) (list "hi" "admin") 0.001)
    (check-within (candidate (list ) (list "this")) (list ) 0.001)
    (check-within (candidate (list "this") (list )) (list ) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Return maximum element in the list.
;; >>> (max_element (list 1 2 3))
;; 3
;; >>> (max_element (list 5 3 -5 2 -3 3 9 0 123 1 -10))
;; 123
(define (max_element l)

(require rackunit)

(define (test-humaneval)

  (let (( candidate max_element))
    (check-within (candidate (list 1 2 3)) 3 0.001)
    (check-within (candidate (list 5 3 -5 2 -3 3 9 0 124 1 -10)) 124 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Create a function that takes a string as input which contains only square brackets.
;; The function should return #t if and only if there is a valid subsequence of brackets
;; where at least one bracket in the subsequence is nested.
;; >>> (is_nested "[[]]")
;; #t
;; >>> (is_nested "[]]]]]]][[[[[]")
;; #f
;; >>> (is_nested "[][]")
;; #f
;; >>> (is_nested "[]")
;; #f
;; >>> (is_nested "[[][]]")
;; #t
;; >>> (is_nested "[[]][[")
;; #t
(define (is_nested string)

(require rackunit)

(define (test-humaneval)

  (let (( candidate is_nested))
    (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 "[[[[]]]]") #t 0.001)
    (check-within (candidate "[]]]]]]]]]]") #f 0.001)
    (check-within (candidate "[][][[]]") #t 0.001)
    (check-within (candidate "[[]") #f 0.001)
    (check-within (candidate "[]]") #f 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)
))

(test-humaneval)


Prompt:
#lang racket

;; You are given two positive integers n and m, and your task is to compute the
;; average of the integers from n through m (including n and m).
;; Round the answer to the nearest integer and convert that to binary.
;; If n is greater than m, return -1.
;; Example:
;; >>> (rounded_avg 1 5)
;; "0b11"
;; >>> (rounded_avg 7 5)
;; -1
;; >>> (rounded_avg 10 20)
;; "0b1111"
;; >>> (rounded_avg 20 33)
;; "0b11010"
(define (rounded_avg n m)

(require rackunit)

(define (test-humaneval)

  (let (( candidate rounded_avg))
    (check-within (candidate 1 5) "0b11" 0.001)
    (check-within (candidate 7 13) "0b1010" 0.001)
    (check-within (candidate 964 977) "0b1111001010" 0.001)
    (check-within (candidate 996 997) "0b1111100100" 0.001)
    (check-within (candidate 560 851) "0b1011000010" 0.001)
    (check-within (candidate 185 546) "0b101101110" 0.001)
    (check-within (candidate 362 496) "0b110101101" 0.001)
    (check-within (candidate 350 902) "0b1001110010" 0.001)
    (check-within (candidate 197 233) "0b11010111" 0.001)
    (check-within (candidate 7 5) -1 0.001)
    (check-within (candidate 5 1) -1 0.001)
    (check-within (candidate 5 5) "0b101" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a list of strings, where each string consists of only digits, return a list.
;; Each element i of the output should be "the number of odd elements in the
;; string i of the input." where all the i's should be replaced by the number
;; of odd digits in the i'th string of the input.
;; >>> (odd_count (list "1234567"))
;; (list "the number of odd elements 4n the str4ng 4 of the 4nput.")
;; >>> (odd_count (list "3" "11111111"))
;; (list "the number of odd elements 1n the str1ng 1 of the 1nput." "the number of odd elements 8n the str8ng 8 of the 8nput.")
(define (odd_count lst)

(require rackunit)

(define (test-humaneval)

  (let (( candidate odd_count))
    (check-within (candidate (list "1234567")) (list "the number of odd elements 4n the str4ng 4 of the 4nput.") 0.001)
    (check-within (candidate (list "3" "11111111")) (list "the number of odd elements 1n the str1ng 1 of the 1nput." "the number of odd elements 8n the str8ng 8 of the 8nput.") 0.001)
    (check-within (candidate (list "271" "137" "314")) (list "the number of odd elements 2n the str2ng 2 of the 2nput." "the number of odd elements 3n the str3ng 3 of the 3nput." "the number of odd elements 2n the str2ng 2 of the 2nput.") 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; We have a list 'arr' of N integers arr[1], arr[2], ..., arr[N].The
;; numbers in the list will be randomly ordered. Your task is to determine if
;; it is possible to get a list sorted in non-decreasing order by performing
;; the following operation on the given list:
;; You are allowed to perform right shift operation any number of times.
;; One right shift operation means shifting all elements of the list by one
;; position in the right direction. The last element of the list will be moved to
;; the starting position in the list i.e. 0th index.
;; If it is possible to obtain the sorted list by performing the above operation
;; then return #t else return #f.
;; If the given list is empty then return #t.
;; Note: The given list is guaranteed to have unique elements.
;; For Example:
;; >>> (move_one_ball (list 3 4 5 1 2))
;; #t
;; Explanation: By performin 2 right shift operations, non-decreasing order can
;; be achieved for the given list.
;; >>> (move_one_ball (list 3 5 4 1 2))
;; #f
;; Explanation:It is not possible to get non-decreasing order for the given
;; list by performing any number of right shift operations.
(define (move_one_ball arr)

(require rackunit)

(define (test-humaneval)

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

(test-humaneval)


Prompt:
#lang racket

;; Given a positive integer n, return a list that has the number of even and odd
;; integer palindromes that fall within the range(1, n), inclusive.
;; Example 1:
;; >>> (even_odd_palindrome 3)
;; (list 1 2)
;; Explanation:
;; Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
;; Example 2:
;; >>> (even_odd_palindrome 12)
;; (list 4 6)
;; Explanation:
;; Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.
;; Note:
;; 1. 1 <= n <= 10^3
;; 2. returned list has the number of even and odd integer palindromes respectively.
(define (even_odd_palindrome n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate even_odd_palindrome))
    (check-within (candidate 123) (list 8 13) 0.001)
    (check-within (candidate 12) (list 4 6) 0.001)
    (check-within (candidate 3) (list 1 2) 0.001)
    (check-within (candidate 63) (list 6 8) 0.001)
    (check-within (candidate 25) (list 5 6) 0.001)
    (check-within (candidate 19) (list 4 6) 0.001)
    (check-within (candidate 9) (list 4 5) 0.001)
    (check-within (candidate 1) (list 0 1) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers
;; Example
;; >>> (is_equal_to_sum_even 4)
;; #f
;; >>> (is_equal_to_sum_even 6)
;; #f
;; >>> (is_equal_to_sum_even 8)
;; #t
(define (is_equal_to_sum_even n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate is_equal_to_sum_even))
    (check-within (candidate 4) #f 0.001)
    (check-within (candidate 6) #f 0.001)
    (check-within (candidate 8) #t 0.001)
    (check-within (candidate 10) #t 0.001)
    (check-within (candidate 11) #f 0.001)
    (check-within (candidate 12) #t 0.001)
    (check-within (candidate 13) #f 0.001)
    (check-within (candidate 16) #t 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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 (list 3 1 2 4 5))
;; (list 1 4 12 20)
;; >>> (derivative (list 1 2 3))
;; (list 2 6)
(define (derivative xs)

(require rackunit)

(define (test-humaneval)

  (let (( candidate derivative))
    (check-within (candidate (list 3 1 2 4 5)) (list 1 4 12 20) 0.001)
    (check-within (candidate (list 1 2 3)) (list 2 6) 0.001)
    (check-within (candidate (list 3 2 1)) (list 2 2) 0.001)
    (check-within (candidate (list 3 2 1 0 4)) (list 2 2 0 16) 0.001)
    (check-within (candidate (list 1)) (list ) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a list of numbers, return whether or not they are sorted
;; in ascending order. If list has more than 1 duplicate of the same
;; number, return #f. Assume no negative numbers and only integers.
;; Examples
;; >>> (is_sorted (list 5))
;; #t
;; >>> (is_sorted (list 1 2 3 4 5))
;; #t
;; >>> (is_sorted (list 1 3 2 4 5))
;; #f
;; >>> (is_sorted (list 1 2 3 4 5 6))
;; #t
;; >>> (is_sorted (list 1 2 3 4 5 6 7))
;; #t
;; >>> (is_sorted (list 1 3 2 4 5 6 7))
;; #f
;; >>> (is_sorted (list 1 2 2 3 3 4))
;; #t
;; >>> (is_sorted (list 1 2 2 2 3 4))
;; #f
(define (is_sorted lst)

(require rackunit)

(define (test-humaneval)

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

(test-humaneval)


Prompt:
#lang racket

;; You are given a string s.
;; if s[i] is a letter, reverse its case from lower to upper or vise versa,
;; otherwise keep it as it is.
;; If the string contains no letters, reverse the string.
;; The function should return the resulted string.
;; Examples
;; >>> (solve "1234")
;; "4321"
;; >>> (solve "ab")
;; "AB"
;; >>> (solve "#a@C")
;; "#A@c"
(define (solve s)

(require rackunit)

(define (test-humaneval)

  (let (( candidate solve))
    (check-within (candidate "AsDf") "aSdF" 0.001)
    (check-within (candidate "1234") "4321" 0.001)
    (check-within (candidate "ab") "AB" 0.001)
    (check-within (candidate "#a@C") "#A@c" 0.001)
    (check-within (candidate "#AsdfW^45") "#aSDFw^45" 0.001)
    (check-within (candidate "#6@2") "2@6#" 0.001)
    (check-within (candidate "#$a^D") "#$A^d" 0.001)
    (check-within (candidate "#ccc") "#CCC" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in
;; the last couple centuries. However, what people don't know is Tribonacci sequence.
;; Tribonacci sequence is defined by the recurrence:
;; tri(1) = 3
;; tri(n) = 1 + n / 2, if n is even.
;; tri(n) =  tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.
;; For example:
;; tri(2) = 1 + (2 / 2) = 2
;; tri(4) = 3
;; tri(3) = tri(2) + tri(1) + tri(4)
;; = 2 + 3 + 3 = 8
;; You are given a non-negative integer number n, you have to a return a list of the
;; first n + 1 numbers of the Tribonacci sequence.
;; Examples:
;; >>> (tri 3)
;; (list 1 3 2 8)
(define (tri n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate tri))
    (check-within (candidate 3) (list 1 3 2 8) 0.001)
    (check-within (candidate 4) (list 1 3 2 8 3) 0.001)
    (check-within (candidate 5) (list 1 3 2 8 3 15) 0.001)
    (check-within (candidate 6) (list 1 3 2 8 3 15 4) 0.001)
    (check-within (candidate 7) (list 1 3 2 8 3 15 4 24) 0.001)
    (check-within (candidate 8) (list 1 3 2 8 3 15 4 24 5) 0.001)
    (check-within (candidate 9) (list 1 3 2 8 3 15 4 24 5 35) 0.001)
    (check-within (candidate 20) (list 1 3 2 8 3 15 4 24 5 35 6 48 7 63 8 80 9 99 10 120 11) 0.001)
    (check-within (candidate 0) (list 1) 0.001)
    (check-within (candidate 1) (list 1 3) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

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

(require rackunit)

(define (test-humaneval)

  (let (( candidate fizz_buzz))
    (check-within (candidate 50) 0 0.001)
    (check-within (candidate 78) 2 0.001)
    (check-within (candidate 79) 3 0.001)
    (check-within (candidate 100) 3 0.001)
    (check-within (candidate 200) 6 0.001)
    (check-within (candidate 4000) 192 0.001)
    (check-within (candidate 10000) 639 0.001)
    (check-within (candidate 100000) 8026 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Filter an input list of strings only for ones that start with a given prefix.
;; >>> (filter_by_prefix (list ) "a")
;; (list )
;; >>> (filter_by_prefix (list "abc" "bcd" "cde" "array") "a")
;; (list "abc" "array")
(define (filter_by_prefix strings prefix)

(require rackunit)

(define (test-humaneval)

  (let (( candidate filter_by_prefix))
    (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)
))

(test-humaneval)


Prompt:
#lang racket

;; 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
(define (solve N)

(require rackunit)

(define (test-humaneval)

  (let (( candidate solve))
    (check-within (candidate 1000) "1" 0.001)
    (check-within (candidate 150) "110" 0.001)
    (check-within (candidate 147) "1100" 0.001)
    (check-within (candidate 333) "1001" 0.001)
    (check-within (candidate 963) "10010" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a grid with N rows and N columns (N >= 2) and a positive integer k,
;; each cell of the grid contains a value. Every integer in the range [1, N * N]
;; inclusive appears exactly once on the cells of the grid.
;; You have to find the minimum path of length k in the grid. You can start
;; from any cell, and in each step you can move to any of the neighbor cells,
;; in other words, you can go to cells which share an edge with you current
;; cell.
;; Please note that a path of length k means visiting exactly k cells (not
;; necessarily distinct).
;; You CANNOT go off the grid.
;; A path A (of length k) is considered less than a path B (of length k) if
;; after making the ordered lists of the values on the cells that A and B go
;; through (let's call them lst_A and lst_B), lst_A is lexicographically less
;; than lst_B, in other words, there exist an integer index i (1 <= i <= k)
;; such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
;; lst_A[j] = lst_B[j].
;; It is guaranteed that the answer is unique.
;; Return an ordered list of the values on the cells that the minimum path go through.
;; Examples:
;; >>> (minPath (list (list 1 2 3) (list 4 5 6) (list 7 8 9)) 3)
;; (list 1 2 1)
;; >>> (minPath (list (list 5 9 3) (list 4 1 6) (list 7 8 2)) 1)
;; (list 1)
(define (minPath grid k)

(require rackunit)

(define (test-humaneval)

  (let (( candidate minPath))
    (check-within (candidate (list (list 1 2 3) (list 4 5 6) (list 7 8 9)) 3) (list 1 2 1) 0.001)
    (check-within (candidate (list (list 5 9 3) (list 4 1 6) (list 7 8 2)) 1) (list 1) 0.001)
    (check-within (candidate (list (list 1 2 3 4) (list 5 6 7 8) (list 9 10 11 12) (list 13 14 15 16)) 4) (list 1 2 1 2) 0.001)
    (check-within (candidate (list (list 6 4 13 10) (list 5 7 12 1) (list 3 16 11 15) (list 8 14 9 2)) 7) (list 1 10 1 10 1 10 1) 0.001)
    (check-within (candidate (list (list 8 14 9 2) (list 6 4 13 15) (list 5 7 1 12) (list 3 10 11 16)) 5) (list 1 7 1 7 1) 0.001)
    (check-within (candidate (list (list 11 8 7 2) (list 5 16 14 4) (list 9 3 15 6) (list 12 13 10 1)) 9) (list 1 6 1 6 1 6 1 6 1) 0.001)
    (check-within (candidate (list (list 12 13 10 1) (list 9 3 15 6) (list 5 16 14 4) (list 11 8 7 2)) 12) (list 1 6 1 6 1 6 1 6 1 6 1 6) 0.001)
    (check-within (candidate (list (list 2 7 4) (list 3 1 5) (list 6 8 9)) 8) (list 1 3 1 3 1 3 1 3) 0.001)
    (check-within (candidate (list (list 6 1 5) (list 3 8 9) (list 2 7 4)) 8) (list 1 5 1 5 1 5 1 5) 0.001)
    (check-within (candidate (list (list 1 2) (list 3 4)) 10) (list 1 2 1 2 1 2 1 2 1 2) 0.001)
    (check-within (candidate (list (list 1 3) (list 3 2)) 10) (list 1 3 1 3 1 3 1 3 1 3) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

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

(require rackunit)

(define (test-humaneval)

  (let (( candidate count_upper))
    (check-within (candidate "aBCdEf") 1 0.001)
    (check-within (candidate "abcdefg") 0 0.001)
    (check-within (candidate "dBBE") 0 0.001)
    (check-within (candidate "B") 0 0.001)
    (check-within (candidate "U") 1 0.001)
    (check-within (candidate "") 0 0.001)
    (check-within (candidate "EEEE") 2 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a list arr of integers and a positive integer k, return a sorted list
;; of length k with the maximum k numbers in arr.
;; Example 1:
;; >>> (maximum (list -3 -4 5) 3)
;; (list -4 -3 5)
;; Example 2:
;; >>> (maximum (list 4 -4 4) 2)
;; (list 4 4)
;; Example 3:
;; >>> (maximum (list -3 2 1 2 -1 -2 1) 1)
;; (list 2)
;; Note:
;; 1. The length of the list will be in the range of [1, 1000].
;; 2. The elements in the list will be in the range of [-1000, 1000].
;; 3. 0 <= k <= len(arr)
(define (maximum arr k)

(require rackunit)

(define (test-humaneval)

  (let (( candidate maximum))
    (check-within (candidate (list -3 -4 5) 3) (list -4 -3 5) 0.001)
    (check-within (candidate (list 4 -4 4) 2) (list 4 4) 0.001)
    (check-within (candidate (list -3 2 1 2 -1 -2 1) 1) (list 2) 0.001)
    (check-within (candidate (list 123 -123 20 0 1 2 -3) 3) (list 2 20 123) 0.001)
    (check-within (candidate (list -123 20 0 1 2 -3) 4) (list 0 1 2 20) 0.001)
    (check-within (candidate (list 5 15 0 3 -13 -8 0) 7) (list -13 -8 0 0 3 5 15) 0.001)
    (check-within (candidate (list -1 0 2 5 3 -10) 2) (list 3 5) 0.001)
    (check-within (candidate (list 1 0 5 -7) 1) (list 5) 0.001)
    (check-within (candidate (list 4 -4) 2) (list -4 4) 0.001)
    (check-within (candidate (list -10 10) 2) (list -10 10) 0.001)
    (check-within (candidate (list 1 2 3 -23 243 -400 0) 0) (list ) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; For a given number n, find the largest number that divides n evenly, smaller than n
;; >>> (largest_divisor 15)
;; 5
(define (largest_divisor n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate largest_divisor))
    (check-within (candidate 3) 1 0.001)
    (check-within (candidate 7) 1 0.001)
    (check-within (candidate 10) 5 0.001)
    (check-within (candidate 100) 50 0.001)
    (check-within (candidate 49) 7 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a list of non-negative integers, return a corkt of the given list after sorting,
;; you will sort the given list in ascending order if the sum( first index value, last index value) is odd,
;; or sort it in descending order if the sum( first index value, last index value) is even.
;; Note:
;; * don't change the given list.
;; Examples:
;; >>> (sort_array (list ))
;; (list )
;; >>> (sort_array (list 5))
;; (list 5)
;; >>> (sort_array (list 2 4 3 0 1 5))
;; (list 0 1 2 3 4 5)
;; >>> (sort_array (list 2 4 3 0 1 5 6))
;; (list 6 5 4 3 2 1 0)
(define (sort_array array)

(require rackunit)

(define (test-humaneval)

  (let (( candidate sort_array))
    (check-within (candidate (list )) (list ) 0.001)
    (check-within (candidate (list 5)) (list 5) 0.001)
    (check-within (candidate (list 2 4 3 0 1 5)) (list 0 1 2 3 4 5) 0.001)
    (check-within (candidate (list 2 4 3 0 1 5 6)) (list 6 5 4 3 2 1 0) 0.001)
    (check-within (candidate (list 2 1)) (list 1 2) 0.001)
    (check-within (candidate (list 15 42 87 32 11 0)) (list 0 11 15 32 42 87) 0.001)
    (check-within (candidate (list 21 14 23 11)) (list 23 21 14 11) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Implement the function f that takes n as a parameter,
;; and returns a list of size n, such that the value of the element at index i is the factorial of i if i is even
;; or the sum of numbers from 1 to i otherwise.
;; i starts from 1.
;; the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).
;; Example:
;; >>> (f 5)
;; (list 1 2 6 24 15)
(define (f n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate f))
    (check-within (candidate 5) (list 1 2 6 24 15) 0.001)
    (check-within (candidate 7) (list 1 2 6 24 15 720 28) 0.001)
    (check-within (candidate 1) (list 1) 0.001)
    (check-within (candidate 3) (list 1 2 6) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Write a function that takes an integer a and returns #t
;; if this ingeger is a cube of some integer number.
;; Note: you may assume the input is always valid.
;; Examples:
;; >>> (iscube 1)
;; #t
;; >>> (iscube 2)
;; #f
;; >>> (iscube -1)
;; #t
;; >>> (iscube 64)
;; #t
;; >>> (iscube 0)
;; #t
;; >>> (iscube 180)
;; #f
(define (iscube a)

(require rackunit)

(define (test-humaneval)

  (let (( candidate iscube))
    (check-within (candidate 1) #t 0.001)
    (check-within (candidate 2) #f 0.001)
    (check-within (candidate -1) #t 0.001)
    (check-within (candidate 64) #t 0.001)
    (check-within (candidate 180) #f 0.001)
    (check-within (candidate 1000) #t 0.001)
    (check-within (candidate 0) #t 0.001)
    (check-within (candidate 1729) #f 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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"
(define (encode message)

(require rackunit)

(define (test-humaneval)

  (let (( candidate encode))
    (check-within (candidate "TEST") "tgst" 0.001)
    (check-within (candidate "Mudasir") "mWDCSKR" 0.001)
    (check-within (candidate "YES") "ygs" 0.001)
    (check-within (candidate "This is a message") "tHKS KS C MGSSCGG" 0.001)
    (check-within (candidate "I DoNt KnOw WhAt tO WrItE") "k dQnT kNqW wHcT Tq wRkTg" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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
(define (is_bored S)

(require rackunit)

(define (test-humaneval)

  (let (( candidate is_bored))
    (check-within (candidate "Hello world") 0 0.001)
    (check-within (candidate "Is the sky blue?") 0 0.001)
    (check-within (candidate "I love It !") 1 0.001)
    (check-within (candidate "bIt") 0 0.001)
    (check-within (candidate "I feel good today. I will be productive. will kill It") 2 0.001)
    (check-within (candidate "You and I are going for a walk") 0 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; pairs_sum_to_zero takes a list of integers as an input.
;; it returns #t if there are two distinct elements in the list that
;; sum to zero, and #f otherwise.
;; >>> (pairs_sum_to_zero (list 1 3 5 0))
;; #f
;; >>> (pairs_sum_to_zero (list 1 3 -2 1))
;; #f
;; >>> (pairs_sum_to_zero (list 1 2 3 7))
;; #f
;; >>> (pairs_sum_to_zero (list 2 4 -5 3 5 7))
;; #t
;; >>> (pairs_sum_to_zero (list 1))
;; #f
(define (pairs_sum_to_zero l)

(require rackunit)

(define (test-humaneval)

  (let (( candidate pairs_sum_to_zero))
    (check-within (candidate (list 1 3 5 0)) #f 0.001)
    (check-within (candidate (list 1 3 -2 1)) #f 0.001)
    (check-within (candidate (list 1 2 3 7)) #f 0.001)
    (check-within (candidate (list 2 4 -5 3 5 7)) #t 0.001)
    (check-within (candidate (list 1)) #f 0.001)
    (check-within (candidate (list -3 9 -1 3 2 30)) #t 0.001)
    (check-within (candidate (list -3 9 -1 3 2 31)) #t 0.001)
    (check-within (candidate (list -3 9 -1 4 2 30)) #f 0.001)
    (check-within (candidate (list -3 9 -1 4 2 31)) #f 0.001)
))

(test-humaneval)


Prompt:
#lang racket

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

(require rackunit)

(define (test-humaneval)

  (let (( candidate triangle_area))
    (check-within (candidate 3 4 5) 6.0 0.001)
    (check-within (candidate 1 2 10) -1 0.001)
    (check-within (candidate 4 8 5) 8.18 0.001)
    (check-within (candidate 2 2 2) 1.73 0.001)
    (check-within (candidate 1 2 3) -1 0.001)
    (check-within (candidate 10 5 7) 16.25 0.001)
    (check-within (candidate 2 6 3) -1 0.001)
    (check-within (candidate 1 1 1) 0.43 0.001)
    (check-within (candidate 2 2 10) -1 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; There are eight planets in our solar system: the closerst to the Sun
;; is Mercury, the next one is Venus, then Earth, Mars, Jupiter, Saturn,
;; Uranus, Neptune.
;; Write a function that takes two planet names as strings planet1 and planet2.
;; The function should return a list containing all planets whose orbits are
;; located between the orbit of planet1 and the orbit of planet2, sorted by
;; the proximity to the sun.
;; The function should return an empty list if planet1 or planet2
;; are not correct planet names.
;; Examples
;; >>> (bf "Jupiter" "Neptune")
;; (list "Saturn" "Uranus")
;; >>> (bf "Earth" "Mercury")
;; "Venus"
;; >>> (bf "Mercury" "Uranus")
;; (list "Venus" "Earth" "Mars" "Jupiter" "Saturn")
(define (bf planet1 planet2)

(require rackunit)

(define (test-humaneval)

  (let (( candidate bf))
    (check-within (candidate "Jupiter" "Neptune") (list "Saturn" "Uranus") 0.001)
    (check-within (candidate "Earth" "Mercury") (list "Venus") 0.001)
    (check-within (candidate "Mercury" "Uranus") (list "Venus" "Earth" "Mars" "Jupiter" "Saturn") 0.001)
    (check-within (candidate "Neptune" "Venus") (list "Earth" "Mars" "Jupiter" "Saturn" "Uranus") 0.001)
    (check-within (candidate "Earth" "Earth") (list ) 0.001)
    (check-within (candidate "Mars" "Earth") (list ) 0.001)
    (check-within (candidate "Jupiter" "Makemake") (list ) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a positive integer n, return the product of the odd digits.
;; Return 0 if all digits are even.
;; For example:
;; >>> (digits 1)
;; 1
;; >>> (digits 4)
;; 0
;; >>> (digits 235)
;; 15
(define (digits n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate digits))
    (check-within (candidate 5) 5 0.001)
    (check-within (candidate 54) 5 0.001)
    (check-within (candidate 120) 1 0.001)
    (check-within (candidate 5014) 5 0.001)
    (check-within (candidate 98765) 315 0.001)
    (check-within (candidate 5576543) 2625 0.001)
    (check-within (candidate 2468) 0 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; You will be given a string of words separated by commas or spaces. Your task is
;; to split the string into words and return a list of the words.
;; For example:
;; >>> (words_string "Hi, my name is John")
;; (list "Hi" "my" "name" "is" "John")
;; >>> (words_string "One, two, three, four, five, six")
;; (list "One" "two" "three" "four" "five" "six")
(define (words_string s)

(require rackunit)

(define (test-humaneval)

  (let (( candidate words_string))
    (check-within (candidate "Hi, my name is John") (list "Hi" "my" "name" "is" "John") 0.001)
    (check-within (candidate "One, two, three, four, five, six") (list "One" "two" "three" "four" "five" "six") 0.001)
    (check-within (candidate "Hi, my name") (list "Hi" "my" "name") 0.001)
    (check-within (candidate "One,, two, three, four, five, six,") (list "One" "two" "three" "four" "five" "six") 0.001)
    (check-within (candidate "") (list ) 0.001)
    (check-within (candidate "ahmed     , gamal") (list "ahmed" "gamal") 0.001)
))

(test-humaneval)


Prompt:
#lang racket

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

(require rackunit)

(define (test-humaneval)

  (let (( candidate how_many_times))
    (check-within (candidate "" "x") 0 0.001)
    (check-within (candidate "xyxyxyx" "x") 4 0.001)
    (check-within (candidate "cacacacac" "cac") 4 0.001)
    (check-within (candidate "john doe" "john") 1 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Create a function that takes integers, floats, or strings representing
;; real numbers, and returns the larger variable in its given variable type.
;; Return #f if the values are equal.
;; Note: If a real number is represented as a string, the floating point might be . or ,
;; >>> (compare_one 1 2.5)
;; 2.5
;; >>> (compare_one 1 "2,3")
;; "2,3"
;; >>> (compare_one "5,1" "6")
;; "6"
;; >>> (compare_one "1" 1)
;; #f
(define (compare_one a b)

(require rackunit)

(define (test-humaneval)

  (let (( candidate compare_one))
    (check-within (candidate 1 2) 2 0.001)
    (check-within (candidate 1 2.5) 2.5 0.001)
    (check-within (candidate 2 3) 3 0.001)
    (check-within (candidate 5 6) 6 0.001)
    (check-within (candidate 1 "2,3") "2,3" 0.001)
    (check-within (candidate "5,1" "6") "6" 0.001)
    (check-within (candidate "1" "2") "2" 0.001)
    (check-within (candidate "1" 1) #f 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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"
(define (remove_vowels text)

(require rackunit)

(define (test-humaneval)

  (let (( candidate remove_vowels))
    (check-within (candidate "") "" 0.001)
    (check-within (candidate "abcdef
ghijklm") "bcdf
ghjklm" 0.001)
    (check-within (candidate "fedcba") "fdcb" 0.001)
    (check-within (candidate "eeeee") "" 0.001)
    (check-within (candidate "acBAA") "cB" 0.001)
    (check-within (candidate "EcBOO") "cB" 0.001)
    (check-within (candidate "ybcd") "ybcd" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given list of integers, return list in strange order.
;; Strange sorting, is when you start with the minimum value,
;; then maximum of the remaining integers, then minimum and so on.
;; Examples:
;; >>> (strange_sort_list (list 1 2 3 4))
;; (list 1 4 2 3)
;; >>> (strange_sort_list (list 5 5 5 5))
;; (list 5 5 5 5)
;; >>> (strange_sort_list (list ))
;; (list )
(define (strange_sort_list lst)

(require rackunit)

(define (test-humaneval)

  (let (( candidate strange_sort_list))
    (check-within (candidate (list 1 2 3 4)) (list 1 4 2 3) 0.001)
    (check-within (candidate (list 5 6 7 8 9)) (list 5 9 6 8 7) 0.001)
    (check-within (candidate (list 1 2 3 4 5)) (list 1 5 2 4 3) 0.001)
    (check-within (candidate (list 5 6 7 8 9 1)) (list 1 9 5 8 6 7) 0.001)
    (check-within (candidate (list 5 5 5 5)) (list 5 5 5 5) 0.001)
    (check-within (candidate (list )) (list ) 0.001)
    (check-within (candidate (list 1 2 3 4 5 6 7 8)) (list 1 8 2 7 3 6 4 5) 0.001)
    (check-within (candidate (list 0 2 2 2 5 5 -5 -5)) (list -5 5 -5 5 0 2 2 2) 0.001)
    (check-within (candidate (list 111111)) (list 111111) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; From a supplied list of numbers (of length at least two) select and return two that are the closest to each
;; other and return them in order (smaller number, larger number).
;; >>> (find_closest_elements (list 1.0 2.0 3.0 4.0 5.0 2.2))
;; (list 2.0 2.2)
;; >>> (find_closest_elements (list 1.0 2.0 3.0 4.0 5.0 2.0))
;; (list 2.0 2.0)
(define (find_closest_elements numbers)

(require rackunit)

(define (test-humaneval)

  (let (( candidate find_closest_elements))
    (check-within (candidate (list 1.0 2.0 3.9 4.0 5.0 2.2)) (list 3.9 4.0) 0.001)
    (check-within (candidate (list 1.0 2.0 5.9 4.0 5.0)) (list 5.0 5.9) 0.001)
    (check-within (candidate (list 1.0 2.0 3.0 4.0 5.0 2.2)) (list 2.0 2.2) 0.001)
    (check-within (candidate (list 1.0 2.0 3.0 4.0 5.0 2.0)) (list 2.0 2.0) 0.001)
    (check-within (candidate (list 1.1 2.2 3.1 4.1 5.1)) (list 2.2 3.1) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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)
;; #t
;; >>> (is_simple_power 2 2)
;; #t
;; >>> (is_simple_power 8 2)
;; #t
;; >>> (is_simple_power 3 2)
;; #f
;; >>> (is_simple_power 3 1)
;; #f
;; >>> (is_simple_power 5 3)
;; #f
(define (is_simple_power x n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate is_simple_power))
    (check-within (candidate 16 2) #t 0.001)
    (check-within (candidate 143214 16) #f 0.001)
    (check-within (candidate 4 2) #t 0.001)
    (check-within (candidate 9 3) #t 0.001)
    (check-within (candidate 16 4) #t 0.001)
    (check-within (candidate 24 2) #f 0.001)
    (check-within (candidate 128 4) #f 0.001)
    (check-within (candidate 12 6) #f 0.001)
    (check-within (candidate 1 1) #t 0.001)
    (check-within (candidate 1 12) #t 0.001)
))

(test-humaneval)


Prompt:
#lang racket

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

(require rackunit)

(define (test-humaneval)

  (let (( candidate prime_fib))
    (check-within (candidate 1) 2 0.001)
    (check-within (candidate 2) 3 0.001)
    (check-within (candidate 3) 5 0.001)
    (check-within (candidate 4) 13 0.001)
    (check-within (candidate 5) 89 0.001)
    (check-within (candidate 6) 233 0.001)
    (check-within (candidate 7) 1597 0.001)
    (check-within (candidate 8) 28657 0.001)
    (check-within (candidate 9) 514229 0.001)
    (check-within (candidate 10) 433494437 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Write a function which sorts the given list of integers
;; in ascending order according to the sum of their digits.
;; Note: if there are several items with similar sum of their digits,
;; order them based on their index in original list.
;; For example:
;; >>> (order_by_points (list 1 11 -1 -11 -12))
;; (list -1 -11 1 -12 11)
;; >>> (order_by_points (list ))
;; (list )
(define (order_by_points nums)


Prompt:
#lang racket

;; Check if in given list of numbers, are any two numbers closer to each other than
;; given threshold.
;; >>> (has_close_elements (list 1.0 2.0 3.0) 0.5)
;; #f
;; >>> (has_close_elements (list 1.0 2.8 3.0 4.0 5.0 2.0) 0.3)
;; #t
(define (has_close_elements numbers threshold)

(require rackunit)

(define (test-humaneval)

  (let (( candidate has_close_elements))
    (check-within (candidate (list 1.0 2.0 3.9 4.0 5.0 2.2) 0.3) #t 0.001)
    (check-within (candidate (list 1.0 2.0 3.9 4.0 5.0 2.2) 0.05) #f 0.001)
    (check-within (candidate (list 1.0 2.0 5.9 4.0 5.0) 0.95) #t 0.001)
    (check-within (candidate (list 1.0 2.0 5.9 4.0 5.0) 0.8) #f 0.001)
    (check-within (candidate (list 1.0 2.0 3.0 4.0 5.0 2.0) 0.1) #t 0.001)
    (check-within (candidate (list 1.1 2.2 3.1 4.1 5.1) 1.0) #t 0.001)
    (check-within (candidate (list 1.1 2.2 3.1 4.1 5.1) 0.5) #f 0.001)
))

(test-humaneval)


Prompt:
#lang racket

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

(require rackunit)

(define (test-humaneval)

  (let (( candidate make_palindrome))
    (check-within (candidate "") "" 0.001)
    (check-within (candidate "x") "x" 0.001)
    (check-within (candidate "xyz") "xyzyx" 0.001)
    (check-within (candidate "xyx") "xyx" 0.001)
    (check-within (candidate "jerry") "jerryrrej" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

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

(require rackunit)

(define (test-humaneval)

  (let (( candidate string_xor))
    (check-within (candidate "111000" "101010") "010010" 0.001)
    (check-within (candidate "1" "1") "0" 0.001)
    (check-within (candidate "0101" "0000") "0101" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; The Brazilian factorial is defined as:
;; brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
;; where n > 0
;; For example:
;; >>> (special_factorial 4)
;; 288
;; The function will receive an integer as input and should return the special
;; factorial of this integer.
(define (special_factorial n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate special_factorial))
    (check-within (candidate 4) 288 0.001)
    (check-within (candidate 5) 34560 0.001)
    (check-within (candidate 7) 125411328000 0.001)
    (check-within (candidate 1) 1 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a non-empty list of integers arr and an integer k, return
;; the sum of the elements with at most two digits from the first k elements of arr.
;; Example:
;; >>> (add_elements (list 111 21 3 4000 5 6 7 8 9) 4)
;; 24
;; Constraints:
;; 1. 1 <= len(arr) <= 100
;; 2. 1 <= k <= len(arr)
(define (add_elements arr k)

(require rackunit)

(define (test-humaneval)

  (let (( candidate add_elements))
    (check-within (candidate (list 1 -2 -3 41 57 76 87 88 99) 3) -4 0.001)
    (check-within (candidate (list 111 121 3 4000 5 6) 2) 0 0.001)
    (check-within (candidate (list 11 21 3 90 5 6 7 8 9) 4) 125 0.001)
    (check-within (candidate (list 111 21 3 4000 5 6 7 8 9) 4) 24 0.001)
    (check-within (candidate (list 1) 1) 1 0.001)
))

(test-humaneval)


Prompt:
#lang racket

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

(require rackunit)

(define (test-humaneval)

  (let (( candidate fib4))
    (check-within (candidate 5) 4 0.001)
    (check-within (candidate 8) 28 0.001)
    (check-within (candidate 10) 104 0.001)
    (check-within (candidate 12) 386 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a list of positive integers x. return a sorted list of all
;; elements that hasn't any even digit.
;; Note: Returned list should be sorted in increasing order.
;; For example:
;; >>> (unique_digits (list 15 33 1422 1))
;; (list 1 15 33)
;; >>> (unique_digits (list 152 323 1422 10))
;; (list )
(define (unique_digits x)

(require rackunit)

(define (test-humaneval)

  (let (( candidate unique_digits))
    (check-within (candidate (list 15 33 1422 1)) (list 1 15 33) 0.001)
    (check-within (candidate (list 152 323 1422 10)) (list ) 0.001)
    (check-within (candidate (list 12345 2033 111 151)) (list 111 151) 0.001)
    (check-within (candidate (list 135 103 31)) (list 31 135) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a string s and a natural number n, you have been tasked to implement
;; a function that returns a list of all words from string s that contain exactly
;; n consonants, in order these words appear in the string s.
;; If the string s is empty then the function should return an empty list.
;; Note: you may assume the input string contains only letters and spaces.
;; Examples:
;; >>> (select_words "Mary had a little lamb" 4)
;; (list "little")
;; >>> (select_words "Mary had a little lamb" 3)
;; (list "Mary" "lamb")
;; >>> (select_words "simple white space" 2)
;; (list )
;; >>> (select_words "Hello world" 4)
;; (list "world")
;; >>> (select_words "Uncle sam" 3)
;; (list "Uncle")
(define (select_words s n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate select_words))
    (check-within (candidate "Mary had a little lamb" 4) (list "little") 0.001)
    (check-within (candidate "Mary had a little lamb" 3) (list "Mary" "lamb") 0.001)
    (check-within (candidate "simple white space" 2) (list ) 0.001)
    (check-within (candidate "Hello world" 4) (list "world") 0.001)
    (check-within (candidate "Uncle sam" 3) (list "Uncle") 0.001)
    (check-within (candidate "" 4) (list ) 0.001)
    (check-within (candidate "a b c d e f" 1) (list "b" "c" "d" "f") 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Write a function that returns #t if the object q will fly, and #f otherwise.
;; The object q will fly if it's balanced (it is a palindromic list) and the sum of its elements is less than or equal the maximum possible weight w.
;; Example:
;; >>> (will_it_fly (list 1 2) 5)
;; #f
;; # 1+2 is less than the maximum possible weight, but it's unbalanced.
;; >>> (will_it_fly (list 3 2 3) 1)
;; #f
;; # it's balanced, but 3+2+3 is more than the maximum possible weight.
;; >>> (will_it_fly (list 3 2 3) 9)
;; #t
;; # 3+2+3 is less than the maximum possible weight, and it's balanced.
;; >>> (will_it_fly (list 3) 5)
;; #t
;; # 3 is less than the maximum possible weight, and it's balanced.
(define (will_it_fly q w)

(require rackunit)

(define (test-humaneval)

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

(test-humaneval)


Prompt:
#lang racket

;; Return n-th Fibonacci number.
;; >>> (fib 10)
;; 55
;; >>> (fib 1)
;; 1
;; >>> (fib 8)
;; 21
(define (fib n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate fib))
    (check-within (candidate 10) 55 0.001)
    (check-within (candidate 1) 1 0.001)
    (check-within (candidate 8) 21 0.001)
    (check-within (candidate 11) 89 0.001)
    (check-within (candidate 12) 144 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; You will be given the name of a class (a string) and a list of extensions.
;; The extensions are to be used to load additional classes to the class. The
;; strength of the extension is as follows: Let CAP be the number of the uppercase
;; letters in the extension's name, and let SM be the number of lowercase letters
;; in the extension's name, the strength is given by the fraction CAP - SM.
;; You should find the strongest extension and return a string in this
;; format: ClassName.StrongestExtensionName.
;; If there are two or more extensions with the same strength, you should
;; choose the one that comes first in the list.
;; For example, if you are given "Slices" as the class and a list of the
;; extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
;; return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension
;; (its strength is -1).
;; Example:
;; >>> (Strongest_Extension "my_class" (list "AA" "Be" "CC"))
;; "my_class.AA"
(define (Strongest_Extension class_name extensions)

(require rackunit)

(define (test-humaneval)

  (let (( candidate Strongest_Extension))
    (check-within (candidate "Watashi" (list "tEN" "niNE" "eIGHt8OKe")) "Watashi.eIGHt8OKe" 0.001)
    (check-within (candidate "Boku123" (list "nani" "NazeDa" "YEs.WeCaNe" "32145tggg")) "Boku123.YEs.WeCaNe" 0.001)
    (check-within (candidate "__YESIMHERE" (list "t" "eMptY" "nothing" "zeR00" "NuLl__" "123NoooneB321")) "__YESIMHERE.NuLl__" 0.001)
    (check-within (candidate "K" (list "Ta" "TAR" "t234An" "cosSo")) "K.TAR" 0.001)
    (check-within (candidate "__HAHA" (list "Tab" "123" "781345" "-_-")) "__HAHA.123" 0.001)
    (check-within (candidate "YameRore" (list "HhAas" "okIWILL123" "WorkOut" "Fails" "-_-")) "YameRore.okIWILL123" 0.001)
    (check-within (candidate "finNNalLLly" (list "Die" "NowW" "Wow" "WoW")) "finNNalLLly.WoW" 0.001)
    (check-within (candidate "_" (list "Bb" "91245")) "_.Bb" 0.001)
    (check-within (candidate "Sp" (list "671235" "Bb")) "Sp.671235" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; You are given a list of two strings, both strings consist of open
;; parentheses '(' or close parentheses ')' only.
;; Your job is to check if it is possible to concatenate the two strings in
;; some order, that the resulting string will be good.
;; A string S is considered to be good if and only if all parentheses in S
;; are balanced. For example: the string '(())()' is good, while the string
;; '())' is not.
;; Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
;; Examples:
;; >>> (match_parens (list "()(" ")"))
;; "Yes"
;; >>> (match_parens (list ")" ")"))
;; "No"
(define (match_parens lst)

(require rackunit)

(define (test-humaneval)

  (let (( candidate match_parens))
    (check-within (candidate (list "()(" ")")) "Yes" 0.001)
    (check-within (candidate (list ")" ")")) "No" 0.001)
    (check-within (candidate (list "(()(())" "())())")) "No" 0.001)
    (check-within (candidate (list ")())" "(()()(")) "Yes" 0.001)
    (check-within (candidate (list "(())))" "(()())((")) "Yes" 0.001)
    (check-within (candidate (list "()" "())")) "No" 0.001)
    (check-within (candidate (list "(()(" "()))()")) "Yes" 0.001)
    (check-within (candidate (list "((((" "((())")) "No" 0.001)
    (check-within (candidate (list ")(()" "(()(")) "No" 0.001)
    (check-within (candidate (list ")(" ")(")) "No" 0.001)
    (check-within (candidate (list "(" ")")) "Yes" 0.001)
    (check-within (candidate (list ")" "(")) "Yes" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; You are given a list of integers.
;; Write a function next_smallest() that returns the 2nd smallest element of the list.
;; Return #f if there is no such element.
;; >>> (next_smallest (list 1 2 3 4 5))
;; 2
;; >>> (next_smallest (list 5 1 4 3 2))
;; 2
;; >>> (next_smallest (list ))
;; #f
;; >>> (next_smallest (list 1 1))
;; #f
(define (next_smallest lst)

(require rackunit)

(define (test-humaneval)

  (let (( candidate next_smallest))
    (check-within (candidate (list 1 2 3 4 5)) 2 0.001)
    (check-within (candidate (list 5 1 4 3 2)) 2 0.001)
    (check-within (candidate (list )) #f 0.001)
    (check-within (candidate (list 1 1)) #f 0.001)
    (check-within (candidate (list 1 1 1 1 0)) 1 0.001)
    (check-within (candidate (list 1 1)) #f 0.001)
    (check-within (candidate (list -35 34 12 -45)) -35 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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)
;; #t
;; >>> (any_int 3 2 2)
;; #f
;; >>> (any_int 3 -2 1)
;; #t
;; >>> (any_int 3.6 -2.2 2)
;; #f
(define (any_int x y z)

(require rackunit)

(define (test-humaneval)

  (let (( candidate any_int))
    (check-within (candidate 2 3 1) #t 0.001)
    (check-within (candidate 2.5 2 3) #f 0.001)
    (check-within (candidate 1.5 5 3.5) #f 0.001)
    (check-within (candidate 2 6 2) #f 0.001)
    (check-within (candidate 4 2 2) #t 0.001)
    (check-within (candidate 2.2 2.2 2.2) #f 0.001)
    (check-within (candidate -4 6 2) #t 0.001)
    (check-within (candidate 2 1 1) #t 0.001)
    (check-within (candidate 3 4 7) #t 0.001)
    (check-within (candidate 3.0 4 7) #f 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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
(define (truncate_number number)

(require rackunit)

(define (test-humaneval)

  (let (( candidate truncate_number))
    (check-within (candidate 3.5) 0.5 0.001)
    (check-within (candidate 1.25) 0.25 0.001)
    (check-within (candidate 123.0) 0.0 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Return list with elements incremented by 1.
;; >>> (incr_list (list 1 2 3))
;; (list 2 3 4)
;; >>> (incr_list (list 5 3 5 2 3 3 9 0 123))
;; (list 6 4 6 3 4 4 10 1 124)
(define (incr_list l)

(require rackunit)

(define (test-humaneval)

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

(test-humaneval)


Prompt:
#lang racket

;; A simple program which should return the value of x if n is
;; a prime number and should return the value of y otherwise.
;; Examples:
;; >>> (x_or_y 7 34 12)
;; 34
;; >>> (x_or_y 15 8 5)
;; 5
(define (x_or_y n x y)

(require rackunit)

(define (test-humaneval)

  (let (( candidate x_or_y))
    (check-within (candidate 7 34 12) 34 0.001)
    (check-within (candidate 15 8 5) 5 0.001)
    (check-within (candidate 3 33 5212) 33 0.001)
    (check-within (candidate 1259 3 52) 3 0.001)
    (check-within (candidate 7919 -1 12) -1 0.001)
    (check-within (candidate 3609 1245 583) 583 0.001)
    (check-within (candidate 91 56 129) 129 0.001)
    (check-within (candidate 6 34 1234) 1234 0.001)
    (check-within (candidate 1 2 0) 0 0.001)
    (check-within (candidate 2 2 0) 2 0.001)
))

(test-humaneval)


Prompt:
#lang racket

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

(require rackunit)

(define (test-humaneval)

  (let (( candidate modp))
    (check-within (candidate 3 5) 3 0.001)
    (check-within (candidate 1101 101) 2 0.001)
    (check-within (candidate 0 101) 1 0.001)
    (check-within (candidate 3 11) 8 0.001)
    (check-within (candidate 100 101) 1 0.001)
    (check-within (candidate 30 5) 4 0.001)
    (check-within (candidate 31 5) 3 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given an integer. return a list that has the number of even and odd digits respectively.
;; Example:
;; >>> (even_odd_count -12)
;; (list 1 1)
;; >>> (even_odd_count 123)
;; (list 1 2)
(define (even_odd_count num)

(require rackunit)

(define (test-humaneval)

  (let (( candidate even_odd_count))
    (check-within (candidate 7) (list 0 1) 0.001)
    (check-within (candidate -78) (list 1 1) 0.001)
    (check-within (candidate 3452) (list 2 2) 0.001)
    (check-within (candidate 346211) (list 3 3) 0.001)
    (check-within (candidate -345821) (list 3 3) 0.001)
    (check-within (candidate -2) (list 1 0) 0.001)
    (check-within (candidate -45347) (list 2 3) 0.001)
    (check-within (candidate 0) (list 1 0) 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; You are given a string s.
;; Your task is to check if the string is haprkt or not.
;; A string is haprkt if its length is at least 3 and every 3 consecutive letters are distinct
;; For example:
;; >>> (is_happy "a")
;; #f
;; >>> (is_happy "aa")
;; #f
;; >>> (is_happy "abcd")
;; #t
;; >>> (is_happy "aabb")
;; #f
;; >>> (is_happy "adb")
;; #t
;; >>> (is_happy "xyy")
;; #f
(define (is_happy s)

(require rackunit)

(define (test-humaneval)

  (let (( candidate is_happy))
    (check-within (candidate "a") #f 0.001)
    (check-within (candidate "aa") #f 0.001)
    (check-within (candidate "abcd") #t 0.001)
    (check-within (candidate "aabb") #f 0.001)
    (check-within (candidate "adb") #t 0.001)
    (check-within (candidate "xyy") #f 0.001)
    (check-within (candidate "iopaxpoi") #t 0.001)
    (check-within (candidate "iopaxioi") #f 0.001)
))

(test-humaneval)


Prompt:
#lang racket

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

(require rackunit)

(define (test-humaneval)

  (let (( candidate largest_prime_factor))
    (check-within (candidate 15) 5 0.001)
    (check-within (candidate 27) 3 0.001)
    (check-within (candidate 63) 7 0.001)
    (check-within (candidate 330) 11 0.001)
    (check-within (candidate 13195) 29 0.001)
))

(test-humaneval)


Prompt:
#lang racket

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

(require rackunit)

(define (test-humaneval)

  (let (( candidate digitSum))
    (check-within (candidate "") 0 0.001)
    (check-within (candidate "abAB") 131 0.001)
    (check-within (candidate "abcCd") 67 0.001)
    (check-within (candidate "helloE") 69 0.001)
    (check-within (candidate "woArBld") 131 0.001)
    (check-within (candidate "aAaaaXa") 153 0.001)
    (check-within (candidate " How are yOu?") 151 0.001)
    (check-within (candidate "You arE Very Smart") 327 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given list of numbers (of at least two elements), apply a linear transform to that list,
;; such that the smallest number will become 0 and the largest will become 1
;; >>> (rescale_to_unit (list 1.0 2.0 3.0 4.0 5.0))
;; (list 0.0 0.25 0.5 0.75 1.0)
(define (rescale_to_unit numbers)


Prompt:
#lang racket

;; Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
;; Examples
;; >>> (solution (list 5 8 7 1))
;; 12
;; >>> (solution (list 3 3 3 3 3))
;; 9
;; >>> (solution (list 30 13 24 321))
;; 0
(define (solution lst)

(require rackunit)

(define (test-humaneval)

  (let (( candidate solution))
    (check-within (candidate (list 5 8 7 1)) 12 0.001)
    (check-within (candidate (list 3 3 3 3 3)) 9 0.001)
    (check-within (candidate (list 30 13 24 321)) 0 0.001)
    (check-within (candidate (list 5 9)) 5 0.001)
    (check-within (candidate (list 2 4 8)) 0 0.001)
    (check-within (candidate (list 30 13 23 32)) 23 0.001)
    (check-within (candidate (list 3 13 2 9)) 3 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; "Given a list representing a branch of a tree that has non-negative integer nodes
;; your task is to pluck one of the nodes and return it.
;; The plucked node should be the node with the smallest even value.
;; If multiple nodes with the same smallest even value are found return the node that has smallest index.
;; The plucked node should be returned in a list, [ smalest_value, its index ],
;; If there are no even values or the given list is empty, return [].
;; Example 1:
;; >>> (pluck (list 4 2 3))
;; (list 2 1)
;; Explanation: 2 has the smallest even value, and 2 has the smallest index.
;; Example 2:
;; >>> (pluck (list 1 2 3))
;; (list 2 1)
;; Explanation: 2 has the smallest even value, and 2 has the smallest index.
;; Example 3:
;; >>> (pluck (list ))
;; (list )
;; Example 4:
;; >>> (pluck (list 5 0 3 0 4 2))
;; (list 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
(define (pluck arr)

(require rackunit)

(define (test-humaneval)

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

(test-humaneval)


Prompt:
#lang racket

;; You are given a positive integer n. You have to create an integer list a of length n.
;; For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1.
;; Return the number of triples (a[i], a[j], a[k]) of a where i < j < k,
;; and a[i] + a[j] + a[k] is a multiple of 3.
;; Example :
;; >>> (get_max_triples 5)
;; 1
;; Explanation:
;; a = [1, 3, 7, 13, 21]
;; The only valid triple is (1, 7, 13).
(define (get_max_triples n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate get_max_triples))
    (check-within (candidate 5) 1 0.001)
    (check-within (candidate 6) 4 0.001)
    (check-within (candidate 10) 36 0.001)
    (check-within (candidate 100) 53361 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; In this problem, you will implement a function that takes two lists of numbers,
;; and determines whether it is possible to perform an exchange of elements
;; between them to make lst1 a list of only even numbers.
;; There is no limit on the number of exchanged elements between lst1 and lst2.
;; If it is possible to exchange elements between the lst1 and lst2 to make
;; all the elements of lst1 to be even, return "YES".
;; Otherwise, return "NO".
;; For example:
;; >>> (exchange (list 1 2 3 4) (list 1 2 3 4))
;; "YES"
;; >>> (exchange (list 1 2 3 4) (list 1 5 3 4))
;; "NO"
;; It is assumed that the input lists will be non-empty.
(define (exchange lst1 lst2)

(require rackunit)

(define (test-humaneval)

  (let (( candidate exchange))
    (check-within (candidate (list 1 2 3 4) (list 1 2 3 4)) "YES" 0.001)
    (check-within (candidate (list 1 2 3 4) (list 1 5 3 4)) "NO" 0.001)
    (check-within (candidate (list 1 2 3 4) (list 2 1 4 3)) "YES" 0.001)
    (check-within (candidate (list 5 7 3) (list 2 6 4)) "YES" 0.001)
    (check-within (candidate (list 5 7 3) (list 2 6 3)) "NO" 0.001)
    (check-within (candidate (list 3 2 6 1 8 9) (list 3 5 5 1 1 1)) "NO" 0.001)
    (check-within (candidate (list 100 200) (list 200 200)) "YES" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Return median of elements in the list l.
;; >>> (median (list 3 1 2 4 5))
;; 3
;; >>> (median (list -10 4 6 1000 10 20))
;; 15.0
(define (median l)

(require rackunit)

(define (test-humaneval)

  (let (( candidate median))
    (check-within (candidate (list 3 1 2 4 5)) 3 0.001)
    (check-within (candidate (list -10 4 6 1000 10 20)) 8.0 0.001)
    (check-within (candidate (list 5)) 5 0.001)
    (check-within (candidate (list 6 5)) 5.5 0.001)
    (check-within (candidate (list 8 1 3 9 9 2 7)) 7 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Write a function that takes a string and returns #t if the string
;; length is a prime number or #f otherwise
;; Examples
;; >>> (prime_length "Hello")
;; #t
;; >>> (prime_length "abcdcba")
;; #t
;; >>> (prime_length "kittens")
;; #t
;; >>> (prime_length "orange")
;; #f
(define (prime_length string)

(require rackunit)

(define (test-humaneval)

  (let (( candidate prime_length))
    (check-within (candidate "Hello") #t 0.001)
    (check-within (candidate "abcdcba") #t 0.001)
    (check-within (candidate "kittens") #t 0.001)
    (check-within (candidate "orange") #f 0.001)
    (check-within (candidate "wow") #t 0.001)
    (check-within (candidate "world") #t 0.001)
    (check-within (candidate "MadaM") #t 0.001)
    (check-within (candidate "Wow") #t 0.001)
    (check-within (candidate "") #f 0.001)
    (check-within (candidate "HI") #t 0.001)
    (check-within (candidate "go") #t 0.001)
    (check-within (candidate "gogo") #f 0.001)
    (check-within (candidate "aaaaaaaaaaaaaaa") #f 0.001)
    (check-within (candidate "Madam") #t 0.001)
    (check-within (candidate "M") #f 0.001)
    (check-within (candidate "0") #f 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Given a list arr of integers, find the minimum number of elements that
;; need to be changed to make the list palindromic. A palindromic list is a list that
;; is read the same backwards and forwards. In one change, you can change one element to any other element.
;; For example:
;; >>> (smallest_change (list 1 2 3 5 4 7 9 6))
;; 4
;; >>> (smallest_change (list 1 2 3 4 3 2 2))
;; 1
;; >>> (smallest_change (list 1 2 3 2 1))
;; 0
(define (smallest_change arr)

(require rackunit)

(define (test-humaneval)

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

(test-humaneval)


Prompt:
#lang racket

;; You are given a list of numbers.
;; You need to return the sum of squared numbers in the given list,
;; round each element in the list to the upper int(Ceiling) first.
;; Examples:
;; >>> (lst (list 1.0 2.0 3.0))
;; 14
;; >>> (lst (list 1.0 4.0 9.0))
;; 98
;; >>> (lst (list 1.0 3.0 5.0 7.0))
;; 84
;; >>> (lst (list 1.4 4.2 0.0))
;; 29
;; >>> (lst (list -2.4 1.0 1.0))
;; 6
(define (sum_squares lst)

(require rackunit)

(define (test-humaneval)

  (let (( candidate sum_squares))
    (check-within (candidate (list 1.0 2.0 3.0)) 14 0.001)
    (check-within (candidate (list 1.0 2.0 3.0)) 14 0.001)
    (check-within (candidate (list 1.0 3.0 5.0 7.0)) 84 0.001)
    (check-within (candidate (list 1.4 4.2 0.0)) 29 0.001)
    (check-within (candidate (list -2.4 1.0 1.0)) 6 0.001)
    (check-within (candidate (list 100.0 1.0 15.0 2.0)) 10230 0.001)
    (check-within (candidate (list 10000.0 10000.0)) 200000000 0.001)
    (check-within (candidate (list -1.4 4.6 6.3)) 75 0.001)
    (check-within (candidate (list -1.4 17.9 18.9 19.9)) 1086 0.001)
    (check-within (candidate (list 0.0)) 0 0.001)
    (check-within (candidate (list -1.0)) 1 0.001)
    (check-within (candidate (list -1.0 1.0 0.0)) 2 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Create a function which takes a string representing a file's name, and returns
;; 'Yes' if the the file's name is valid, and returns 'No' otherwise.
;; A file's name is considered to be valid if and only if all the following conditions
;; are met:
;; - There should not be more than three digits ('0'-'9') in the file's name.
;; - The file's name contains exactly one dot '.'
;; - The substring before the dot should not be empty, and it starts with a letter from
;; the latin alphapet ('a'-'z' and 'A'-'Z').
;; - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
;; Examples:
;; >>> (file_name_check "example.txt")
;; "Yes"
;; >>> (file_name_check "1example.dll")
;; "No"
(define (file_name_check file_name)

(require rackunit)

(define (test-humaneval)

  (let (( candidate file_name_check))
    (check-within (candidate "example.txt") "Yes" 0.001)
    (check-within (candidate "1example.dll") "No" 0.001)
    (check-within (candidate "s1sdf3.asd") "No" 0.001)
    (check-within (candidate "K.dll") "Yes" 0.001)
    (check-within (candidate "MY16FILE3.exe") "Yes" 0.001)
    (check-within (candidate "His12FILE94.exe") "No" 0.001)
    (check-within (candidate "_Y.txt") "No" 0.001)
    (check-within (candidate "?aREYA.exe") "No" 0.001)
    (check-within (candidate "/this_is_valid.dll") "No" 0.001)
    (check-within (candidate "this_is_valid.wow") "No" 0.001)
    (check-within (candidate "this_is_valid.txt") "Yes" 0.001)
    (check-within (candidate "this_is_valid.txtexe") "No" 0.001)
    (check-within (candidate "#this2_i4s_5valid.ten") "No" 0.001)
    (check-within (candidate "@this1_is6_valid.exe") "No" 0.001)
    (check-within (candidate "this_is_12valid.6exe4.txt") "No" 0.001)
    (check-within (candidate "all.exe.txt") "No" 0.001)
    (check-within (candidate "I563_No.exe") "Yes" 0.001)
    (check-within (candidate "Is3youfault.txt") "Yes" 0.001)
    (check-within (candidate "no_one#knows.dll") "Yes" 0.001)
    (check-within (candidate "1I563_Yes3.exe") "No" 0.001)
    (check-within (candidate "I563_Yes3.txtt") "No" 0.001)
    (check-within (candidate "final..txt") "No" 0.001)
    (check-within (candidate "final132") "No" 0.001)
    (check-within (candidate "_f4indsartal132.") "No" 0.001)
    (check-within (candidate ".txt") "No" 0.001)
    (check-within (candidate "s.") "No" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; triples_sum_to_zero takes a list of integers as an input.
;; it returns #t if there are three distinct elements in the list that
;; sum to zero, and #f otherwise.
;; >>> (triples_sum_to_zero (list 1 3 5 0))
;; #f
;; >>> (triples_sum_to_zero (list 1 3 -2 1))
;; #t
;; >>> (triples_sum_to_zero (list 1 2 3 7))
;; #f
;; >>> (triples_sum_to_zero (list 2 4 -5 3 9 7))
;; #t
;; >>> (triples_sum_to_zero (list 1))
;; #f
(define (triples_sum_to_zero l)

(require rackunit)

(define (test-humaneval)

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

(test-humaneval)


Prompt:
#lang racket

;; You are given two intervals,
;; where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
;; The given intervals are closed which means that the interval (start, end)
;; includes both start and end.
;; For each given interval, it is assumed that its start is less or equal its end.
;; Your task is to determine whether the length of intersection of these two
;; intervals is a prime number.
;; Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
;; which its length is 1, which not a prime number.
;; If the length of the intersection is a prime number, return "YES",
;; otherwise, return "NO".
;; If the two intervals don't intersect, return "NO".
;; [input/output] samples:
;; >>> (intersection (list 1 2) (list 2 3))
;; "NO"
;; >>> (intersection (list -1 1) (list 0 4))
;; "NO"
;; >>> (intersection (list -3 -1) (list -5 5))
;; "YES"
(define (intersection interval1 interval2)

(require rackunit)

(define (test-humaneval)

  (let (( candidate intersection))
    (check-within (candidate (list 1 2) (list 2 3)) "NO" 0.001)
    (check-within (candidate (list -1 1) (list 0 4)) "NO" 0.001)
    (check-within (candidate (list -3 -1) (list -5 5)) "YES" 0.001)
    (check-within (candidate (list -2 2) (list -4 0)) "YES" 0.001)
    (check-within (candidate (list -11 2) (list -1 -1)) "NO" 0.001)
    (check-within (candidate (list 1 2) (list 3 5)) "NO" 0.001)
    (check-within (candidate (list 1 2) (list 1 2)) "NO" 0.001)
    (check-within (candidate (list -2 -2) (list -3 -2)) "NO" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; 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 list of those.
;; Separate groups are balanced (each open brace is properly closed) and not nested within each other
;; Ignore any spaces in the input string.
;; >>> (separate_paren_groups "( ) (( )) (( )( ))")
;; (list "()" "(())" "(()())")
(define (separate_paren_groups paren_string)


Prompt:
#lang racket

;; I think we all remember that feeling when the result of some long-awaited
;; event is finally known. The feelings and thoughts you have at that moment are
;; definitely worth noting down and comparing.
;; Your task is to determine if a person correctly guessed the results of a number of matches.
;; You are given two lists of scores and guesses of equal length, where each index shows a match.
;; Return a list of the same length denoting how far off each guess was. If they have guessed correctly,
;; the value is 0, and if not, the value is the absolute difference between the guess and the score.
;; example:
;; >>> (compare (list 1 2 3 4 5 1) (list 1 2 3 4 2 -2))
;; (list 0 0 0 0 3 3)
;; >>> (compare (list 0 5 0 0 0 4) (list 4 1 1 0 0 -2))
;; (list 4 4 1 0 0 6)
(define (compare game guess)

(require rackunit)

(define (test-humaneval)

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

(test-humaneval)


Prompt:
#lang racket

;; Given a positive integer n, return the count of the numbers of n-digit
;; positive integers that start or end with 1.
(define (starts_one_ends n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate starts_one_ends))
    (check-within (candidate 1) 1 0.001)
    (check-within (candidate 2) 18 0.001)
    (check-within (candidate 3) 180 0.001)
    (check-within (candidate 4) 1800 0.001)
    (check-within (candidate 5) 18000 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Create a function that returns #t if the last character
;; of a given string is an alphabetical character and is not
;; a part of a word, and #f otherwise.
;; Note: "word" is a group of characters separated by space.
;; Examples:
;; >>> (check_if_last_char_is_a_letter "apple pie")
;; #f
;; >>> (check_if_last_char_is_a_letter "apple pi e")
;; #t
;; >>> (check_if_last_char_is_a_letter "apple pi e ")
;; #f
;; >>> (check_if_last_char_is_a_letter "")
;; #f
(define (check_if_last_char_is_a_letter txt)

(require rackunit)

(define (test-humaneval)

  (let (( candidate check_if_last_char_is_a_letter))
    (check-within (candidate "apple") #f 0.001)
    (check-within (candidate "apple pi e") #t 0.001)
    (check-within (candidate "eeeee") #f 0.001)
    (check-within (candidate "A") #t 0.001)
    (check-within (candidate "Pumpkin pie ") #f 0.001)
    (check-within (candidate "Pumpkin pie 1") #f 0.001)
    (check-within (candidate "") #f 0.001)
    (check-within (candidate "eeeee e ") #f 0.001)
    (check-within (candidate "apple pie") #f 0.001)
    (check-within (candidate "apple pi e ") #f 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; You have to write a function which validates a given date string and
;; returns #t if the date is valid otherwise #f.
;; The date is valid if all of the following rules are satisfied:
;; 1. The date string is not empty.
;; 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
;; 3. The months should not be less than 1 or higher than 12.
;; 4. The date should be in the format: mm-dd-yyyy
;; >>> (valid_date "03-11-2000")
;; #t
;; >>> (valid_date "15-01-2012")
;; #f
;; >>> (valid_date "04-0-2040")
;; #f
;; >>> (valid_date "06-04-2020")
;; #t
;; >>> (valid_date "06/04/2020")
;; #f
(define (valid_date date)

(require rackunit)

(define (test-humaneval)

  (let (( candidate valid_date))
    (check-within (candidate "03-11-2000") #t 0.001)
    (check-within (candidate "15-01-2012") #f 0.001)
    (check-within (candidate "04-0-2040") #f 0.001)
    (check-within (candidate "06-04-2020") #t 0.001)
    (check-within (candidate "01-01-2007") #t 0.001)
    (check-within (candidate "03-32-2011") #f 0.001)
    (check-within (candidate "") #f 0.001)
    (check-within (candidate "04-31-3000") #f 0.001)
    (check-within (candidate "06-06-2005") #t 0.001)
    (check-within (candidate "21-31-2000") #f 0.001)
    (check-within (candidate "04-12-2003") #t 0.001)
    (check-within (candidate "04122003") #f 0.001)
    (check-within (candidate "20030412") #f 0.001)
    (check-within (candidate "2003-04") #f 0.001)
    (check-within (candidate "2003-04-12") #f 0.001)
    (check-within (candidate "04-2003") #f 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Write a function count_nums which takes a list of integers and returns
;; the number of elements which has a sum of digits > 0.
;; If a number is negative, then its first signed digit will be negative:
;; e.g. -123 has signed digits -1, 2, and 3.
;; >>> (count_nums (list ))
;; 0
;; >>> (count_nums (list -1 11 -11))
;; 1
;; >>> (count_nums (list 1 1 2))
;; 3
(define (count_nums arr)

(require rackunit)

(define (test-humaneval)

  (let (( candidate count_nums))
    (check-within (candidate (list )) 0 0.001)
    (check-within (candidate (list -1 -2 0)) 0 0.001)
    (check-within (candidate (list 1 1 2 -2 3 4 5)) 6 0.001)
    (check-within (candidate (list 1 6 9 -6 0 1 5)) 5 0.001)
    (check-within (candidate (list 1 100 98 -7 1 -1)) 4 0.001)
    (check-within (candidate (list 12 23 34 -45 -56 0)) 5 0.001)
    (check-within (candidate (list 0 1)) 1 0.001)
    (check-within (candidate (list 1)) 1 0.001)
))

(test-humaneval)


Prompt:
#lang racket

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

(require rackunit)

(define (test-humaneval)

  (let (( candidate anti_shuffle))
    (check-within (candidate "Hi") "Hi" 0.001)
    (check-within (candidate "hello") "ehllo" 0.001)
    (check-within (candidate "number") "bemnru" 0.001)
    (check-within (candidate "abcd") "abcd" 0.001)
    (check-within (candidate "Hello World!!!") "Hello !!!Wdlor" 0.001)
    (check-within (candidate "") "" 0.001)
    (check-within (candidate "Hi. My name is Mister Robot. How are you?") ".Hi My aemn is Meirst .Rboot How aer ?ouy" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Checks if given string is a palindrome
;; >>> (is_palindrome "")
;; #t
;; >>> (is_palindrome "aba")
;; #t
;; >>> (is_palindrome "aaaaa")
;; #t
;; >>> (is_palindrome "zbcd")
;; #f
(define (is_palindrome text)

(require rackunit)

(define (test-humaneval)

  (let (( candidate is_palindrome))
    (check-within (candidate "") #t 0.001)
    (check-within (candidate "aba") #t 0.001)
    (check-within (candidate "aaaaa") #t 0.001)
    (check-within (candidate "zbcd") #f 0.001)
    (check-within (candidate "xywyx") #t 0.001)
    (check-within (candidate "xywyz") #f 0.001)
    (check-within (candidate "xywzx") #f 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; You are given a word. Your task is to find the closest vowel that stands between
;; two consonants from the right side of the word (case sensitive).
;; Vowels in the beginning and ending doesn't count. Return empty string if you didn't
;; find any vowel met the above condition.
;; You may assume that the given string contains English letter only.
;; Example:
;; >>> (get_closest_vowel "yogurt")
;; "u"
;; >>> (get_closest_vowel "FULL")
;; "U"
;; >>> (get_closest_vowel "quick")
;; ""
;; >>> (get_closest_vowel "ab")
;; ""
(define (get_closest_vowel word)

(require rackunit)

(define (test-humaneval)

  (let (( candidate get_closest_vowel))
    (check-within (candidate "yogurt") "u" 0.001)
    (check-within (candidate "full") "u" 0.001)
    (check-within (candidate "easy") "" 0.001)
    (check-within (candidate "eAsy") "" 0.001)
    (check-within (candidate "ali") "" 0.001)
    (check-within (candidate "bad") "a" 0.001)
    (check-within (candidate "most") "o" 0.001)
    (check-within (candidate "ab") "" 0.001)
    (check-within (candidate "ba") "" 0.001)
    (check-within (candidate "quick") "" 0.001)
    (check-within (candidate "anime") "i" 0.001)
    (check-within (candidate "Asia") "" 0.001)
    (check-within (candidate "Above") "o" 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Return true if a given number is prime, and false otherwise.
;; >>> (is_prime 6)
;; #f
;; >>> (is_prime 101)
;; #t
;; >>> (is_prime 11)
;; #t
;; >>> (is_prime 13441)
;; #t
;; >>> (is_prime 61)
;; #t
;; >>> (is_prime 4)
;; #f
;; >>> (is_prime 1)
;; #f
(define (is_prime n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate is_prime))
    (check-within (candidate 6) #f 0.001)
    (check-within (candidate 101) #t 0.001)
    (check-within (candidate 11) #t 0.001)
    (check-within (candidate 13441) #t 0.001)
    (check-within (candidate 61) #t 0.001)
    (check-within (candidate 4) #f 0.001)
    (check-within (candidate 1) #f 0.001)
    (check-within (candidate 5) #t 0.001)
    (check-within (candidate 11) #t 0.001)
    (check-within (candidate 17) #t 0.001)
    (check-within (candidate 85) #f 0.001)
    (check-within (candidate 77) #f 0.001)
    (check-within (candidate 255379) #f 0.001)
))

(test-humaneval)


Prompt:
#lang racket

;; Your task is to implement a function that will simplify the expression
;; x * n. The function returns #t if x * n evaluates to a whole number and #f
;; otherwise. Both x and n, are string representation of a fraction, and have the following format,
;; <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
;; You can assume that x, and n are valid fractions, and do not have zero as denominator.
;; >>> (simplify "1/5" "5/1")
;; #t
;; >>> (simplify "1/6" "2/1")
;; #f
;; >>> (simplify "7/10" "10/2")
;; #f
(define (simplify x n)

(require rackunit)

(define (test-humaneval)

  (let (( candidate simplify))
    (check-within (candidate "1/5" "5/1") #t 0.001)
    (check-within (candidate "1/6" "2/1") #f 0.001)
    (check-within (candidate "5/1" "3/1") #t 0.001)
    (check-within (candidate "7/10" "10/2") #f 0.001)
    (check-within (candidate "2/10" "50/10") #t 0.001)
    (check-within (candidate "7/2" "4/2") #t 0.001)
    (check-within (candidate "11/6" "6/1") #t 0.001)
    (check-within (candidate "2/3" "5/2") #f 0.001)
    (check-within (candidate "5/2" "3/5") #f 0.001)
    (check-within (candidate "2/4" "8/4") #t 0.001)
    (check-within (candidate "2/4" "4/2") #t 0.001)
    (check-within (candidate "1/5" "5/1") #t 0.001)
    (check-within (candidate "1/5" "1/5") #f 0.001)
))

(test-humaneval)