id
stringlengths
14
18
description
stringlengths
321
1.77k
lean_code
stringlengths
1.1k
7.34k
signature
dict
metadata
dict
tests
dict
reject_inputs
dict
difficulty
stringclasses
2 values
verina_advanced_68
-----Description----- This task requires implementing a Run-Length Encoding (RLE) algorithm in Lean 4. The method should take a string as input and return a compressed string where consecutive duplicate characters are replaced by the character followed by its count. The output must strictly alternate between character...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def runLengthEncoder_precond (input : String) : Prop := -- !benchmark @start precond input.all (fun ...
{ "name": "runLengthEncoder", "parameters": { "param_name": [ "input" ], "param_type": [ "String" ] }, "return_type": "String" }
{ "upstream": { "name": "lab_assignment", "link": "inspired by: https://leetcode.com/problems/string-compression/description/", "task_id": "lab_runLengthEncoder_325008552", "student_id": [ 49 ] } }
{ "input": [ "{\"input\": \"aaabbbcc\"}", "{\"input\": \"!!!$$$%%%\"}", "{\"input\": \"aaaaa\"}", "{\"input\": \"abcd\"}", "{\"input\": \"\"}", "{\"input\": \"AaABb\"}", "{\"input\": \"wwwwwwwwwwwwwwwww\"}", "{\"input\": \"a\"}", "{\"input\": \" \"}" ], "expected": [ [ ...
{ "input": [ "{'input': '111'}", "{'input': 'a1b'}", "{'input': '123'}", "{'input': 'abc123def'}" ] }
advanced
verina_basic_70
-----Description----- This task involves determining the first index in an array where a given condition holds true. The goal is to identify the position of the first element that meets a specified criterion, ensuring that no preceding element does. -----Input----- The input consists of: • a: An array of element...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def LinearSearch3_precond (a : Array Int) (P : Int -> Bool) : Prop := -- !benchmark @start preco...
{ "name": "LinearSearch3", "parameters": { "param_name": [ "a", "P" ], "param_type": [ "Array Int", "Int -> Bool" ] }, "return_type": "Nat" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_linear_search3", "student_id": null } }
{ "input": [ "{\"a\": \"#[4, 7, 2, 9]\", \"P\": \"fun x => x > 5\"}", "{\"a\": \"#[10, 8, 6, 4, 2]\", \"P\": \"fun x => x < 5\"}", "{\"a\": \"#[5, 3, 1, 2]\", \"P\": \"fun x => x == 1\"}", "{\"a\": \"#[0, 1, 2, 3]\", \"P\": \"fun x => x == 0\"}", "{\"a\": \"#[9, 9, 9, 9]\", \"P\": \"fun x => x == ...
{ "input": [ "{'a': '#[1, 2, 3, 4, 5]', 'P': 'fun x => x > 10'}" ] }
basic
verina_advanced_42
-----Description----- This task requires writing a Lean 4 function that takes a list of stock prices and returns the maximum profit achievable by buying on one day and selling on a later day. If no profit is possible, the function should return 0. -----Input----- The input consists of: prices: A list of natural numbe...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def maxProfit_precond (prices : List Nat) : Prop := -- !benchmark @start precond True -- !be...
{ "name": "maxProfit", "parameters": { "param_name": [ "prices" ], "param_type": [ "List Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "", "task_id": "lab_maxProfit_324256904", "student_id": [ 34 ] } }
{ "input": [ "{\"prices\": \"[7, 1, 5, 3, 6, 4]\"}", "{\"prices\": \"[7, 6, 4, 3, 1]\"}", "{\"prices\": \"[2, 4, 1]\"}", "{\"prices\": \"[1, 2]\"}", "{\"prices\": \"[]\"}" ], "expected": [ [ "5" ], [ "0" ], [ "2" ], [ "1" ], [ "...
{ "input": [] }
advanced
verina_basic_100
-----Description----- This task involves determining the triple of a given integer. The goal is to create a function that, for any integer provided as input, returns a value equal to three times that integer, including handling the case when the input is zero. -----Input----- The input consists of: • x: An integ...
-- !benchmark @start import type=solution import Mathlib -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def Triple_precond (x : Int) : Prop := -- !benchmark @start precond True -- !b...
{ "name": "Triple", "parameters": { "param_name": [ "x" ], "param_type": [ "Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_triple3", "student_id": null } }
{ "input": [ "{\"x\": 0}", "{\"x\": 1}", "{\"x\": -2}", "{\"x\": 10}", "{\"x\": -5}" ], "expected": [ [ "0" ], [ "3" ], [ "-6" ], [ "30" ], [ "-15" ] ], "unexpected": [ [ "1", "-1", "10" ], ...
{ "input": [] }
basic
verina_basic_95
-----Description----- This problem involves swapping two elements in an array of integers at specified positions. Given an array and two indices, the task is to exchange these elements so that the element from the first index moves to the second index and vice versa, while all other elements remain unchanged. -----I...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def swap_precond (arr : Array Int) (i : Int) (j : Int) : Prop := -- !benchmark @start precond ...
{ "name": "swap", "parameters": { "param_name": [ "arr", "i", "j" ], "param_type": [ "Array Int", "Int", "Int" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_swap_in_array", "student_id": null } }
{ "input": [ "{\"arr\": \"#[1, 2, 3, 4, 5]\", \"i\": 1, \"j\": 3}", "{\"arr\": \"#[10, 20, 30, 40]\", \"i\": 0, \"j\": 3}", "{\"arr\": \"#[7, 8, 9]\", \"i\": 1, \"j\": 2}", "{\"arr\": \"#[1, 2, 3, 4]\", \"i\": 0, \"j\": 0}", "{\"arr\": \"#[-1, -2, -3]\", \"i\": 0, \"j\": 2}" ], "expected": [ ...
{ "input": [ "{'arr': '#[1, 2, 3, 4]', 'i': -1, 'j': 2}" ] }
basic
verina_advanced_81
-----Description----- Implement a Lean 4 function that, given a list of integers, removes all duplicates and returns the resulting list in ascending order. -----Input----- The input consists of a single list of integers: arr: A list of integers. -----Output----- The output is a list of integers: Returns a list contai...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def uniqueSorted_precond (arr : List Int) : Prop := -- !benchmark @start precond True -- !be...
{ "name": "uniqueSorted", "parameters": { "param_name": [ "arr" ], "param_type": [ "List Int" ] }, "return_type": "List Int" }
{ "upstream": { "name": "lab_assignment", "link": "", "task_id": "lab_uniqueSorted_325097530", "student_id": [ 17 ] } }
{ "input": [ "{\"arr\": \"[1, 1, 2, 3]\"}", "{\"arr\": \"[3, 3, 3]\"}", "{\"arr\": \"[]\"}", "{\"arr\": \"[5, 2, 2, 5]\"}", "{\"arr\": \"[1, 2, 3, 4, 5]\"}" ], "expected": [ [ "[1, 2, 3]" ], [ "[3]" ], [ "[]" ], [ "[2, 5]" ], [ ...
{ "input": [] }
advanced
verina_basic_46
-----Description----- This task requires writing a Lean 4 method that finds the last occurrence of a specified element in a sorted array of integers. The method should return the index corresponding to the last occurrence of the element if it is present; if the element is absent, it should return -1. Additionally, the...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def lastPosition_precond (arr : Array Int) (elem : Int) : Prop := -- !benchmark @start precond ...
{ "name": "lastPosition", "parameters": { "param_name": [ "arr", "elem" ], "param_type": [ "Array Int", "Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_793", "student_id": null } }
{ "input": [ "{\"arr\": \"#[1, 2, 2, 3, 4, 5]\", \"elem\": 2}", "{\"arr\": \"#[1, 2, 2, 3, 4, 5]\", \"elem\": 6}", "{\"arr\": \"#[1, 2, 2, 3, 4, 5]\", \"elem\": 5}", "{\"arr\": \"#[1]\", \"elem\": 1}", "{\"arr\": \"#[1, 1, 1, 1]\", \"elem\": 1}", "{\"arr\": \"#[2, 2, 3, 3, 3]\", \"elem\": 3}" ...
{ "input": [ "{'arr': '#[3, 2, 1]', 'elem': 2}" ] }
basic
verina_basic_14
-----Description----- This task requires writing a Lean 4 method that determines whether a given string contains the character 'z' or 'Z'. The method should return true if the string includes either the lowercase or uppercase letter 'z', and false otherwise. -----Input----- The input consists of: s: A string. -----O...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def containsZ_precond (s : String) : Prop := -- !benchmark @start precond True -- !benchmar...
{ "name": "containsZ", "parameters": { "param_name": [ "s" ], "param_type": [ "String" ] }, "return_type": "Bool" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_454", "student_id": null } }
{ "input": [ "{\"s\": \"hello\"}", "{\"s\": \"zebra\"}", "{\"s\": \"Zebra\"}", "{\"s\": \"\"}", "{\"s\": \"crazy\"}", "{\"s\": \"AZ\"}", "{\"s\": \"abc\"}", "{\"s\": \"Zz\"}", "{\"s\": \"no letter\"}" ], "expected": [ [ "False" ], [ "True" ], [ ...
{ "input": [] }
basic
verina_basic_36
-----Description----- This task requires writing a Lean 4 method that takes a given string and returns a new string where every occurrence of a space, comma, or dot is replaced with a colon. The transformation must preserve the original string’s length and leave all other characters unmodified. -----Input----- The...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux def isSpaceCommaDot (c : Char) : Bool := if c = ' ' then true else if c = ',' then true else if c = '.' then true else false -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @e...
{ "name": "replaceWithColon", "parameters": { "param_name": [ "s" ], "param_type": [ "String" ] }, "return_type": "String" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_732", "student_id": null } }
{ "input": [ "{\"s\": \"Hello, world. How are you?\"}", "{\"s\": \"No-changes!\"}", "{\"s\": \",. \"}", "{\"s\": \"\"}" ], "expected": [ [ "Hello::world::How:are:you?" ], [ "No-changes!" ], [ ":::" ], [ "" ] ], "unexpected": [ [ ...
{ "input": [] }
basic
verina_advanced_64
-----Description----- This task requires writing a Lean 4 method that removes all occurrences of a given element from a list of natural numbers. The method should return a new list that contains all the elements of the original list except those equal to the target number. The order of the remaining elements must be pr...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def removeElement_precond (lst : List Nat) (target : Nat) : Prop := -- !benchmark @start precond Tru...
{ "name": "removeElement", "parameters": { "param_name": [ "lst", "target" ], "param_type": [ "List Nat", "Nat" ] }, "return_type": "List Nat" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/remove-element/", "task_id": "lab_removeElement_323929890", "student_id": [ 47 ] } }
{ "input": [ "{\"lst\": \"[1, 2, 3, 2, 4]\", \"target\": 2}", "{\"lst\": \"[5, 5, 5, 5]\", \"target\": 5}", "{\"lst\": \"[7, 8, 9]\", \"target\": 4}", "{\"lst\": \"[]\", \"target\": 3}", "{\"lst\": \"[0, 1, 0, 2, 0]\", \"target\": 0}" ], "expected": [ [ "[1, 3, 4]" ], [ ...
{ "input": [] }
advanced
verina_basic_49
-----Description----- This task requires writing a Lean 4 method that searches an array of integers to locate the first odd number. The method should return a pair where the first element is a Boolean indicating whether an odd number was found, and the second element is the index of that odd number if found, or -1 if ...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux def isOdd (x : Int) : Bool := x % 2 ≠ 0 -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def findFirstOdd_precond (a : Array Int) : Prop := -- ...
{ "name": "findFirstOdd", "parameters": { "param_name": [ "a" ], "param_type": [ "Array Int" ] }, "return_type": "Option Nat" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_807", "student_id": null } }
{ "input": [ "{\"a\": \"#[2, 4, 6, 8]\"}", "{\"a\": \"#[3, 4, 6, 8]\"}", "{\"a\": \"#[2, 4, 5, 8]\"}", "{\"a\": \"#[7]\"}", "{\"a\": \"#[2]\"}", "{\"a\": \"#[1, 2, 3]\"}" ], "expected": [ [ "none" ], [ "some (0)" ], [ "some (2)" ], [ "som...
{ "input": [ "{'a': '#[]'}" ] }
basic
verina_basic_8
-----Description----- This task requires writing a Lean 4 method that determines the minimum of two integers. The method should return the smaller of the two numbers. When both numbers are equal, either one may be returned. -----Input----- The input consists of two integers: a: The first integer. b: The second intege...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def myMin_precond (a : Int) (b : Int) : Prop := -- !benchmark @start precond True -- !bench...
{ "name": "myMin", "parameters": { "param_name": [ "a", "b" ], "param_type": [ "Int", "Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_404", "student_id": null } }
{ "input": [ "{\"a\": 3, \"b\": 5}", "{\"a\": 10, \"b\": 7}", "{\"a\": 4, \"b\": 4}", "{\"a\": -3, \"b\": 5}", "{\"a\": 3, \"b\": -5}", "{\"a\": -3, \"b\": -5}", "{\"a\": 0, \"b\": 10}", "{\"a\": 0, \"b\": -10}" ], "expected": [ [ "3" ], [ "7" ], [ ...
{ "input": [] }
basic
verina_advanced_33
-----Description----- This task requires implementing the "Longest Increasing Subsequence" problem in Lean 4. Given a list of integers, the function should compute the length of the longest strictly increasing subsequence. A subsequence is formed by deleting zero or more elements without changing the order. If the list...
-- !benchmark @start import type=solution import Mathlib.Data.List.Basic -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def longestIncreasingSubsequence_precond (nums : List Int) : Prop :=...
{ "name": "longestIncreasingSubsequence", "parameters": { "param_name": [ "nums" ], "param_type": [ "List Int" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "[{\"text_file_id\"=>804930699}]", "task_id": "lab_longestIncreasingSubsequence_325684656", "student_id": [ 27 ] } }
{ "input": [ "{\"nums\": \"[10, 9, 2, 5, 3, 7, 101, 18]\"}", "{\"nums\": \"[0, 1, 0, 3, 2, 3]\"}", "{\"nums\": \"[7, 7, 7, 7, 7]\"}", "{\"nums\": \"[]\"}", "{\"nums\": \"[4, 10, 4, 3, 8, 9]\"}" ], "expected": [ [ "4" ], [ "4" ], [ "1" ], [ "0...
{ "input": [] }
advanced
verina_basic_59
-----Description----- Given an integer x, determine a pair (a, b) where the first element is twice the value of x and the second element is four times the value of x. -----Input----- The input consists of: • x: An integer. -----Output----- The output is a tuple (a, b) where: • a = 2 * x • b = 4 * x -----...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def DoubleQuadruple_precond (x : Int) : Prop := -- !benchmark @start precond True -- !benchm...
{ "name": "DoubleQuadruple", "parameters": { "param_name": [ "x" ], "param_type": [ "Int" ] }, "return_type": "(Int × Int)" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_double_quadruple", "student_id": null } }
{ "input": [ "{\"x\": 0}", "{\"x\": 1}", "{\"x\": -1}", "{\"x\": 10}", "{\"x\": -5}" ], "expected": [ [ "(0, 0)" ], [ "(2, 4)" ], [ "(-2, -4)" ], [ "(20, 40)" ], [ "(-10, -20)" ] ], "unexpected": [ [ "(1, 0)", ...
{ "input": [] }
basic
verina_advanced_56
-----Description----- This task requires writing a Lean 4 method that moves all zeroes in a given integer list to the end, while preserving the relative order of the non-zero elements. The method `moveZeroes` processes the input list by separating the non-zero and zero elements. It then returns a new list formed by ap...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def moveZeroes_precond (xs : List Int) : Prop := -- !benchmark @start precond True -- !benchmark @...
{ "name": "moveZeroes", "parameters": { "param_name": [ "xs" ], "param_type": [ "List Int" ] }, "return_type": "List Int" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/move-zeroes/description/", "task_id": "lab_moveZeroes_324883943", "student_id": [ 41 ] } }
{ "input": [ "{\"xs\": \"[0, 1, 0, 3, 12]\"}", "{\"xs\": \"[0, 0, 1]\"}", "{\"xs\": \"[1, 2, 3]\"}", "{\"xs\": \"[0, 0, 0]\"}", "{\"xs\": \"[]\"}", "{\"xs\": \"[4, 0, 5, 0, 6]\"}", "{\"xs\": \"[0, 1]\"}", "{\"xs\": \"[1, 0]\"}", "{\"xs\": \"[2, 0, 0, 3]\"}" ], "expected": [ ...
{ "input": [] }
advanced
verina_basic_60
-----Description----- This task requires writing a function that processes an array of integers and produces a new array containing only the even numbers from the input. The order of these even numbers should remain the same as in the original array, ensuring that every even number from the input appears in the outpu...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux def isEven (n : Int) : Bool := n % 2 = 0 -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def FindEvenNumbers_precond (arr : Array Int) : Prop := ...
{ "name": "FindEvenNumbers", "parameters": { "param_name": [ "arr" ], "param_type": [ "Array Int" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_even_list", "student_id": null } }
{ "input": [ "{\"arr\": \"#[1, 2, 3, 4, 5, 6]\"}", "{\"arr\": \"#[0, -2, 3, -4, 7]\"}", "{\"arr\": \"#[1, 3, 5, 7]\"}", "{\"arr\": \"#[2, 4, 8, 10]\"}", "{\"arr\": \"#[]\"}", "{\"arr\": \"#[2, 4, 2, 6]\"}", "{\"arr\": \"#[1, 2, 8, 2, 5]\"}" ], "expected": [ [ "#[2, 4, 6]" ...
{ "input": [] }
basic
verina_advanced_38
-----Description----- This task requires implementing a Lean 4 method that, given a list of intervals, returns the maximum amount that can be spanned after we removed one of the intervals You may assume you'll receive at least one interval -----Input----- The input consists of a list of ordered pairs of intervals. ---...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def maxCoverageAfterRemovingOne_precond (intervals : List (Prod Nat Nat)) : Prop := -- !benchmar...
{ "name": "maxCoverageAfterRemovingOne", "parameters": { "param_name": [ "intervals" ], "param_type": [ "List (Prod Nat Nat)" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "[{\"text_file_id\"=>804563720}]", "task_id": "lab_maxCoverageAfterRemovingOne_325587004", "student_id": [ 31 ] } }
{ "input": [ "{\"intervals\": \"[(1, 3), (2, 5), (6, 8)]\"}", "{\"intervals\": \"[(1, 4), (2, 6), (8, 10), (9, 12)]\"}", "{\"intervals\": \"[(1, 2), (2, 3), (3, 4)]\"}", "{\"intervals\": \"[(1, 10), (2, 3), (4, 5)]\"}", "{\"intervals\": \"[(5, 6), (1, 2), (3, 4)]\"}" ], "expected": [ [ ...
{ "input": [ "{'intervals': '[]'}" ] }
advanced
verina_basic_68
-----Description----- The task is to determine the position of a target integer in a given array. The goal is to return the index corresponding to the first occurrence of the target value. If the target is not present in the array, the result should indicate that by returning the size of the array. This description f...
-- !benchmark @start import type=solution import Mathlib -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def LinearSearch_precond (a : Array Int) (e : Int) : Prop := -- !benchmark @start ...
{ "name": "LinearSearch", "parameters": { "param_name": [ "a", "e" ], "param_type": [ "Array Int", "Int" ] }, "return_type": "Nat" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_linear_search1", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 3, 5, 7, 9]\", \"e\": 5}", "{\"a\": \"#[2, 4, 6, 8]\", \"e\": 5}", "{\"a\": \"#[5, 5, 5]\", \"e\": 5}", "{\"a\": \"#[10, 9, 8, 7]\", \"e\": 10}", "{\"a\": \"#[1, 2, 3, 3, 4]\", \"e\": 3}" ], "expected": [ [ "2" ], [ "4" ], [ "0...
{ "input": [] }
basic
verina_advanced_71
-----Description----- This task requires writing a Lean 4 method that, given a binary string `s` and an integer `k`, finds the shortest contiguous substring that contains exactly `k` characters `'1'`. Among all substrings of `s` that contain exactly `k` occurrences of `'1'`, return the one that is shortest in length. ...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux def countOnes (lst : List Char) : Nat := lst.foldl (fun acc c => if c = '1' then acc + 1 else acc) 0 -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] de...
{ "name": "shortestBeautifulSubstring", "parameters": { "param_name": [ "s", "k" ], "param_type": [ "String", "Nat" ] }, "return_type": "String" }
{ "upstream": { "name": "lab_assignment", "link": "https://huggingface.co/spaces/livecodebench/code_generation_samples", "task_id": "lab_shortestBeautifulSubstring_325098964", "student_id": [ 32 ] } }
{ "input": [ "{\"s\": \"100011001\", \"k\": 3}", "{\"s\": \"1011\", \"k\": 2}", "{\"s\": \"000\", \"k\": 1}", "{\"s\": \"11111\", \"k\": 3}", "{\"s\": \"10100101\", \"k\": 2}", "{\"s\": \"1001001\", \"k\": 2}", "{\"s\": \"10010001\", \"k\": 1}", "{\"s\": \"1001\", \"k\": 0}" ], "ex...
{ "input": [ "{'s': '2', 'k': 1}" ] }
advanced
verina_advanced_59
-----Description----- This task requires writing a Lean 4 method that determines if a given string is a palindrome, ignoring all non-alphanumeric characters and case differences. For example, the string "A man, a plan, a canal: Panama" should return true. -----Input----- A single string: s: The string to check for pal...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def palindromeIgnoreNonAlnum_precond (s : String) : Prop := -- !benchmark @start precond True -- !...
{ "name": "palindromeIgnoreNonAlnum", "parameters": { "param_name": [ "s" ], "param_type": [ "String" ] }, "return_type": "Bool" }
{ "upstream": { "name": "lab_assignment", "link": "N/A", "task_id": "lab_palindromeIgnoreNonAlnum_325057855", "student_id": [ 17 ] } }
{ "input": [ "{\"s\": \"\"}", "{\"s\": \"A man, a plan, a canal: Panama\"}", "{\"s\": \"race a car\"}", "{\"s\": \"No 'x' in Nixon\"}", "{\"s\": \"abc!!cba?\"}", "{\"s\": \"Hello, world!\"}" ], "expected": [ [ "True" ], [ "True" ], [ "False" ], ...
{ "input": [] }
advanced
verina_advanced_24
-----Description----- This task requires writing a Lean 4 method that determines the length of the longest strictly increasing subsequence in a given array of integers. A subsequence is a sequence that can be derived from the array by deleting some or no elements without changing the order of the remaining elements. T...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def lengthOfLIS_precond (nums : List Int) : Prop := -- !benchmark @start precond True -- !be...
{ "name": "lengthOfLIS", "parameters": { "param_name": [ "nums" ], "param_type": [ "List Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "lab_assignment", "link": "[{\"text_file_id\"=>804740897}]", "task_id": "lab_lengthOfLIS_325627981", "student_id": [ 6 ] } }
{ "input": [ "{\"nums\": \"[10, 9, 2, 5, 3, 7, 101, 18]\"}", "{\"nums\": \"[0, 1, 0, 3, 2, 3]\"}", "{\"nums\": \"[7, 7, 7, 7, 7, 7, 7]\"}", "{\"nums\": \"[4, 10, 4, 3, 8, 9]\"}", "{\"nums\": \"[1, 3, 6, 7, 9, 4, 10, 5, 6]\"}" ], "expected": [ [ "4" ], [ "4" ], [...
{ "input": [] }
advanced
verina_advanced_69
-----Description----- Given a sorted list of distinct integers and a target value, return the index if the target is found. If it is not found, return the index where it would be inserted to maintain the sorted order. This function must preserve the sorted property of the list. The list is assumed to be strictly incre...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def searchInsert_precond (xs : List Int) (target : Int) : Prop := -- !benchmark @start precond List....
{ "name": "searchInsert", "parameters": { "param_name": [ "xs", "target" ], "param_type": [ "List Int", "Int" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/search-insert-position/", "task_id": "lab_searchInsert_325772357", "student_id": [ 50 ] } }
{ "input": [ "{\"xs\": \"[1, 3, 5, 6]\", \"target\": 5}", "{\"xs\": \"[1, 3, 5, 6]\", \"target\": 2}", "{\"xs\": \"[1, 3, 5, 6]\", \"target\": 7}", "{\"xs\": \"[1, 3, 5, 6]\", \"target\": 0}", "{\"xs\": \"[]\", \"target\": 3}", "{\"xs\": \"[10]\", \"target\": 5}", "{\"xs\": \"[10]\", \"tar...
{ "input": [ "{'xs': '[2, 1]', 'target': 5}", "{'xs': '[1, 1]', 'target': 2}" ] }
advanced
verina_advanced_2
-----Description----- This task requires writing a Lean 4 method that finds the length of the logest common subsequence of two input arrays. -----Input----- The input consists of two arrays: a: The first array. b: The second array. -----Output----- The output is an integer: Returns the length of array a and b's lon...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def LongestCommonSubsequence_precond (a : Array Int) (b : Array Int) : Prop := -- !benchmark @st...
{ "name": "LongestCommonSubsequence", "parameters": { "param_name": [ "a", "b" ], "param_type": [ "Array Int", "Array Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "lab_assignment", "link": "", "task_id": "lab_LongestCommonSubsequence_324999618", "student_id": [ 2 ] } }
{ "input": [ "{\"a\": \"#[1, 2, 3]\", \"b\": \"#[1, 2, 3]\"}", "{\"a\": \"#[1, 3, 5, 7]\", \"b\": \"#[1, 2, 3, 4, 5, 6, 7]\"}", "{\"a\": \"#[1, 2, 3]\", \"b\": \"#[4, 5, 6]\"}", "{\"a\": \"#[]\", \"b\": \"#[1, 2, 3]\"}", "{\"a\": \"#[1, 2, 3, 4]\", \"b\": \"#[2, 4, 6, 8]\"}" ], "expected": [ ...
{ "input": [] }
advanced
verina_advanced_52
-----Description----- This task requires writing a Lean 4 function that finds the minimum number of operations to collect the integers from 1 to k by performing the following removal operation on a list of integers. A removal operation consists of removing the last element from the list nums and adding it to your coll...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def minOperations_precond (nums : List Nat) (k : Nat) : Prop := -- !benchmark @start precond l...
{ "name": "minOperations", "parameters": { "param_name": [ "nums", "k" ], "param_type": [ "List Nat", "Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "", "task_id": "lab_minOperations_325696322", "student_id": [ 40 ] } }
{ "input": [ "{\"nums\": \"[3, 1, 5, 4, 2]\", \"k\": 2}", "{\"nums\": \"[3, 1, 5, 4, 2]\", \"k\": 5}", "{\"nums\": \"[3, 2, 5, 3, 1]\", \"k\": 3}", "{\"nums\": \"[5, 4, 3, 2, 1]\", \"k\": 1}", "{\"nums\": \"[5, 4, 1, 2, 3]\", \"k\": 3}", "{\"nums\": \"[1, 3, 2, 2, 1]\", \"k\": 2}", "{\"num...
{ "input": [ "{'nums': '[5, 6, 7, 8, 9]', 'k': 3}" ] }
advanced
verina_advanced_75
-----Description----- Given a non-empty sequence of n integers, your task is to find the largest sum obtainable by choosing a contiguous subarray of the sequence. At least one number must be selected. The algorithm uses dynamic programming (Kadane's Algorithm) to solve the problem: 1. Initialize the current maximum (c...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def task_code_precond (sequence : List Int) : Prop := -- !benchmark @start precond sequence.le...
{ "name": "task_code", "parameters": { "param_name": [ "sequence" ], "param_type": [ "List Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "lab_assignment", "link": "", "task_id": "lab_task_code_325773191", "student_id": [ 53 ] } }
{ "input": [ "{\"sequence\": \"[10, -4, 3, 1, 5, 6, -35, 12, 21, -1]\"}", "{\"sequence\": \"[2, 1, -4, 3, 4, -4, 6, 5, -5, 1]\"}", "{\"sequence\": \"[-1, -2, -3, -4, -5]\"}", "{\"sequence\": \"[7]\"}", "{\"sequence\": \"[1, 2, 3, 4, 5]\"}" ], "expected": [ [ "33" ], [ "...
{ "input": [ "{'sequence': []}" ] }
advanced
verina_basic_39
-----Description----- This task requires writing a Lean 4 method that rotates a list of integers to the right by a specified number of positions. The method should produce a new list where each element is shifted to the right while preserving the original list's length. -----Input----- The input consists of: • l...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def rotateRight_precond (l : List Int) (n : Nat) : Prop := -- !benchmark @start precond True ...
{ "name": "rotateRight", "parameters": { "param_name": [ "l", "n" ], "param_type": [ "List Int", "Nat" ] }, "return_type": "List Int" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_743", "student_id": null } }
{ "input": [ "{\"l\": \"[1, 2, 3, 4, 5]\", \"n\": 2}", "{\"l\": \"[1, 2, 3, 4, 5]\", \"n\": 7}", "{\"l\": \"[1, 2, 3, 4, 5]\", \"n\": 0}", "{\"l\": \"[]\", \"n\": 2}" ], "expected": [ [ "4", "5", "1", "2", "3" ], [ "4", "5", "1", "2...
{ "input": [] }
basic
verina_basic_15
-----Description----- This task requires writing a Lean 4 method that determines whether an array of integers contains at least one pair of consecutive numbers. The method should return true if there is any index where an element, when increased by one, equals the next element in the array. If no such consecutive pair...
-- !benchmark @start import type=solution import Mathlib -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def containsConsecutiveNumbers_precond (a : Array Int) : Prop := -- !benchmark @s...
{ "name": "containsConsecutiveNumbers", "parameters": { "param_name": [ "a" ], "param_type": [ "Array Int" ] }, "return_type": "Bool" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_472", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 2, 3, 5]\"}", "{\"a\": \"#[1, 3, 5, 7]\"}", "{\"a\": \"#[]\"}", "{\"a\": \"#[10]\"}", "{\"a\": \"#[5, 6]\"}", "{\"a\": \"#[5, 7, 8, 10]\"}", "{\"a\": \"#[9, 9, 10]\"}", "{\"a\": \"#[3, 3, 3]\"}" ], "expected": [ [ "True" ], [ "Fa...
{ "input": [] }
basic
verina_advanced_80
-----Description----- This task requires writing a Lean 4 method that finds the indices of two numbers in an array that add up to a target value. Given an array of integers and a target integer, the function should return the indices of the two numbers such that they add up to the target. You may assume that each inpu...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def twoSum_precond (nums : Array Int) (target : Int) : Prop := -- !benchmark @start precond -- The a...
{ "name": "twoSum", "parameters": { "param_name": [ "nums", "target" ], "param_type": [ "Array Int", "Int" ] }, "return_type": "Array Nat" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/two-sum/description/", "task_id": "lab_twoSum_325585735", "student_id": [ 31 ] } }
{ "input": [ "{\"nums\": \"#[2, 7, 11, 15]\", \"target\": 9}", "{\"nums\": \"#[3, 2, 4]\", \"target\": 6}", "{\"nums\": \"#[3, 3]\", \"target\": 6}", "{\"nums\": \"#[1, 2, 3, 4, 5]\", \"target\": 9}", "{\"nums\": \"#[0, 4, 3, 0]\", \"target\": 0}" ], "expected": [ [ "#[0, 1]" ], ...
{ "input": [ "{'nums': '#[0]', 'target': 2}" ] }
advanced
verina_advanced_77
-----Description----- This task requires writing a Lean 4 function that calculates how much water can be trapped between elevations after it rains. The input is a list of non-negative integers representing an elevation map. Each index traps water depending on the min of max heights to its left and right. -----Input---...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def trapRainWater_precond (height : List Nat) : Prop := -- !benchmark @start precond True --...
{ "name": "trapRainWater", "parameters": { "param_name": [ "height" ], "param_type": [ "List Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "", "task_id": "lab_trapRainWater_325601349", "student_id": [ 22 ] } }
{ "input": [ "{\"height\": \"[0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1]\"}", "{\"height\": \"[4, 2, 0, 3, 2, 5]\"}", "{\"height\": \"[1, 0, 2]\"}", "{\"height\": \"[3, 0, 1, 3, 0, 5]\"}", "{\"height\": \"[0, 1, 2, 3, 4, 5]\"}", "{\"height\": \"[]\"}" ], "expected": [ [ "6" ], [...
{ "input": [] }
advanced
verina_basic_30
-----Description----- This task requires writing a Lean 4 method that computes the element-wise modulo between two arrays of integers. The method should produce a new array where each element is the remainder after dividing the corresponding element from the first array by the element from the second array. -----Inpu...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def elementWiseModulo_precond (a : Array Int) (b : Array Int) : Prop := -- !benchmark @start pr...
{ "name": "elementWiseModulo", "parameters": { "param_name": [ "a", "b" ], "param_type": [ "Array Int", "Array Int" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_616", "student_id": null } }
{ "input": [ "{\"a\": \"#[10, 20, 30]\", \"b\": \"#[3, 7, 5]\"}", "{\"a\": \"#[100, 200, 300, 400]\", \"b\": \"#[10, 20, 30, 50]\"}", "{\"a\": \"#[-10, -20, 30]\", \"b\": \"#[3, -7, 5]\"}" ], "expected": [ [ "#[1, 6, 0]" ], [ "#[0, 0, 0, 0]" ], [ "#[2, 1, 0]" ...
{ "input": [ "{'a': '#[1]', 'b': '#[4, 0]'}" ] }
basic
verina_advanced_18
-----Description----- This task requires writing a Lean 4 method that determines whether a given number `n` is an Armstrong number (also known as a Narcissistic number). An Armstrong number is a number that is equal to the sum of its own digits raised to the power of the number of digits. -----Input----- The input con...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux def countDigits (n : Nat) : Nat := let rec go (n acc : Nat) : Nat := if n = 0 then acc else go (n / 10) (acc + 1) go n (if n = 0 then 1 else 0) -- !benchmark @end solution_aux -- !benchmark @start precon...
{ "name": "isArmstrong", "parameters": { "param_name": [ "n" ], "param_type": [ "Nat" ] }, "return_type": "Bool" }
{ "upstream": { "name": "lab_assignment", "link": "leetcode 1134: https://leetcode.ca/all/1134.html", "task_id": "lab_isArmstrong_325011347", "student_id": [ 7 ] } }
{ "input": [ "{\"n\": 0}", "{\"n\": 1}", "{\"n\": 10}", "{\"n\": 153}", "{\"n\": 9474}", "{\"n\": 9475}" ], "expected": [ [ "True" ], [ "True" ], [ "False" ], [ "True" ], [ "True" ], [ "False" ] ], "une...
{ "input": [] }
advanced
verina_advanced_21
-----Description----- Implement a Lean 4 function that checks if a given string is a palindrome. A string is considered a palindrome if it reads the same forward and backward. -----Input----- The input consists of a single string: s: A string -----Output----- The output is a boolean: Returns true if s is a palindrome...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def isPalindrome_precond (s : String) : Prop := -- !benchmark @start precond True -- !benchm...
{ "name": "isPalindrome", "parameters": { "param_name": [ "s" ], "param_type": [ "String" ] }, "return_type": "Bool" }
{ "upstream": { "name": "lab_assignment", "link": "", "task_id": "lab_isPalindrome_325097530", "student_id": [ 17 ] } }
{ "input": [ "{\"s\": \"racecar\"}", "{\"s\": \"abba\"}", "{\"s\": \"abc\"}", "{\"s\": \"\"}", "{\"s\": \"a\"}" ], "expected": [ [ "True" ], [ "True" ], [ "False" ], [ "True" ], [ "True" ] ], "unexpected": [ [ ...
{ "input": [] }
advanced
verina_basic_52
-----Description----- This task requires developing a solution that sorts an array of integers in non-decreasing order. The solution must return an array that is a rearrangement of the input, containing exactly the same elements but ordered from smallest to largest. -----Input----- The input consists of: • a: An...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def BubbleSort_precond (a : Array Int) : Prop := -- !benchmark @start precond True -- !bench...
{ "name": "BubbleSort", "parameters": { "param_name": [ "a" ], "param_type": [ "Array Int" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_bubble_sort", "student_id": null } }
{ "input": [ "{\"a\": \"#[5, 4, 3, 2, 1]\"}", "{\"a\": \"#[1, 2, 3, 4, 5]\"}", "{\"a\": \"#[3, 1, 2, 1, 5]\"}", "{\"a\": \"#[10]\"}", "{\"a\": \"#[4, 4, 4, 2, 2, 8]\"}" ], "expected": [ [ "#[1, 2, 3, 4, 5]" ], [ "#[1, 2, 3, 4, 5]" ], [ "#[1, 1, 2, 3, 5]" ...
{ "input": [] }
basic
verina_basic_71
-----Description----- This problem involves determining the longest common prefix shared by two lists of characters. Given two sequences, the goal is to identify and return the maximal contiguous sequence of characters from the beginning of both lists that are identical. -----Input----- The input consists of: •...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def LongestCommonPrefix_precond (str1 : List Char) (str2 : List Char) : Prop := -- !benchmark @s...
{ "name": "LongestCommonPrefix", "parameters": { "param_name": [ "str1", "str2" ], "param_type": [ "List Char", "List Char" ] }, "return_type": "List Char" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_longest_prefix", "student_id": null } }
{ "input": [ "{\"str1\": \"['a', 'b', 'c']\", \"str2\": \"['a', 'b', 'd']\"}", "{\"str1\": \"['x', 'y', 'z']\", \"str2\": \"['x', 'y', 'z']\"}", "{\"str1\": \"['w', 'o']\", \"str2\": \"['w', 'o', 'w']\"}", "{\"str1\": \"['a', 'x']\", \"str2\": \"['b', 'y']\"}", "{\"str1\": \"[]\", \"str2\": \"['h'...
{ "input": [] }
basic
verina_basic_56
-----Description----- The problem is to update a destination array by replacing a specific segment with values taken from a source array. Given two arrays, starting positions, and a length, the task is to construct a new array where the segment in the destination from the specified starting index for the given length...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def copy_precond (src : Array Int) (sStart : Nat) (dest : Array Int) (dStart : Nat) (len : Nat) : ...
{ "name": "copy", "parameters": { "param_name": [ "src", "sStart", "dest", "dStart", "len" ], "param_type": [ "Array Int", "Nat", "Array Int", "Nat", "Nat" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_copy_part", "student_id": null } }
{ "input": [ "{\"src\": \"#[10, 20, 30, 40, 50]\", \"sStart\": 1, \"dest\": \"#[1, 2, 3, 4, 5, 6]\", \"dStart\": 3, \"len\": 2}", "{\"src\": \"#[5, 6, 7, 8]\", \"sStart\": 0, \"dest\": \"#[9, 9, 9, 9, 9]\", \"dStart\": 1, \"len\": 3}", "{\"src\": \"#[100, 200]\", \"sStart\": 0, \"dest\": \"#[1, 2, 3]\", \...
{ "input": [ "{'src': '#[10, 20, 30]', 'sStart': 1, 'dest': '#[1, 2, 3, 4]', 'dStart': 2, 'len': 3}" ] }
basic
verina_basic_34
-----Description----- This task requires writing a Lean 4 method that extracts even numbers from an array of integers. The method should return a new array containing only the even numbers found in the input array, while preserving the order in which they appear. -----Input----- The input consists of: arr: An array o...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux def isEven (n : Int) : Bool := n % 2 = 0 -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def findEvenNumbers_precond (arr : Array Int) : Prop :=...
{ "name": "findEvenNumbers", "parameters": { "param_name": [ "arr" ], "param_type": [ "Array Int" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_629", "student_id": null } }
{ "input": [ "{\"arr\": \"#[1, 2, 3, 4, 5, 6]\"}", "{\"arr\": \"#[7, 8, 10, 13, 14]\"}", "{\"arr\": \"#[1, 3, 5, 7]\"}", "{\"arr\": \"#[]\"}", "{\"arr\": \"#[0, -2, -3, -4, 5]\"}" ], "expected": [ [ "#[2, 4, 6]" ], [ "#[8, 10, 14]" ], [ "#[]" ], [ ...
{ "input": [] }
basic
verina_basic_65
-----Description----- This task involves computing the integer square root of a given natural number. The goal is to determine the largest natural number r that satisfies r * r ≤ N and N < (r + 1) * (r + 1). -----Input----- The input consists of: • N: A natural number. -----Output----- The output is a natural...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def SquareRoot_precond (N : Nat) : Prop := -- !benchmark @start precond True -- !benchmark @...
{ "name": "SquareRoot", "parameters": { "param_name": [ "N" ], "param_type": [ "Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_integer_square_root", "student_id": null } }
{ "input": [ "{\"N\": 0}", "{\"N\": 1}", "{\"N\": 15}", "{\"N\": 16}", "{\"N\": 26}" ], "expected": [ [ "0" ], [ "1" ], [ "3" ], [ "4" ], [ "5" ] ], "unexpected": [ [ "1", "2" ], [ "0", ...
{ "input": [] }
basic
verina_advanced_35
-----Description----- This task requires writing a Lean 4 function that finds the majority element in a list of integers. The majority element is the element that appears more than ⌊n/2⌋ times, where n is the list’s length. You may assume that a majority element always exists in the input. -----Input----- - nums: A li...
-- !benchmark @start import type=solution import Std.Data.HashMap open Std -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def majorityElement_precond (nums : List Int) : Prop := -- !benchmark ...
{ "name": "majorityElement", "parameters": { "param_name": [ "nums" ], "param_type": [ "List Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/majority-element/description/", "task_id": "lab_majorityElement_324976035", "student_id": [ 22 ] } }
{ "input": [ "{\"nums\": \"[3, 2, 3]\"}", "{\"nums\": \"[2, 2, 1, 1, 1, 2, 2]\"}", "{\"nums\": \"[1, 1, 1, 2, 3, 1]\"}", "{\"nums\": \"[0, 0, 0, 0]\"}", "{\"nums\": \"[7]\"}" ], "expected": [ [ "3" ], [ "2" ], [ "1" ], [ "0" ], [ ...
{ "input": [ "{'nums': '[1, 2, 3]'}", "{'nums': '[]'}" ] }
advanced
verina_advanced_8
-----Description----- This task requires writing a Lean 4 method that determines whether it is possible to complete a circular journey around a set of gas stations. Each gas station provides a certain amount of gas, and traveling from one station to the next consumes a certain amount of gas. You start the journey at o...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def canCompleteCircuit_precond (gas : List Int) (cost : List Int) : Prop := -- !benchmark @start preco...
{ "name": "canCompleteCircuit", "parameters": { "param_name": [ "gas", "cost" ], "param_type": [ "List Int", "List Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/gas-station", "task_id": "lab_canCompleteCircuit_324678911", "student_id": [ 6 ] } }
{ "input": [ "{\"gas\": \"[1, 2, 3, 4, 5]\", \"cost\": \"[3, 4, 5, 1, 2]\"}", "{\"gas\": \"[2, 3, 4]\", \"cost\": \"[3, 4, 3]\"}", "{\"gas\": \"[5, 1, 2, 3, 4]\", \"cost\": \"[4, 4, 1, 5, 1]\"}", "{\"gas\": \"[3, 3, 4]\", \"cost\": \"[3, 4, 4]\"}", "{\"gas\": \"[1, 2, 3]\", \"cost\": \"[1, 2, 3]\"...
{ "input": [ "{'gas': '[]', 'cost': '[]'}", "{'gas': '[1, 2]', 'cost': '[1]'}", "{'gas': '[1]', 'cost': '[1, 2]'}" ] }
advanced
verina_advanced_12
-----Description----- Write a Lean 4 function that returns the first duplicate integer found in a list. The function should return the value of the first duplicate it encounters, scanning from left to right. If no duplicates exist, return -1. -----Input----- lst: A list of integers. -----Output----- An Option Int: - ...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def firstDuplicate_precond (lst : List Int) : Prop := -- !benchmark @start precond True -- !benchm...
{ "name": "firstDuplicate", "parameters": { "param_name": [ "lst" ], "param_type": [ "List Int" ] }, "return_type": "Option Int" }
{ "upstream": { "name": "lab_assignment", "link": "NA-These are typical problems we solve, im sure their links exist, I just didn't copy directly from any link", "task_id": "lab_firstDuplicate_325276763", "student_id": [ 10 ] } }
{ "input": [ "{\"lst\": \"[1, 2, 3, 2, 4]\"}", "{\"lst\": \"[5, 1, 2, 3, 4, 5]\"}", "{\"lst\": \"[1, 2, 3, 4, 5]\"}", "{\"lst\": \"[7, 7, 7, 7]\"}", "{\"lst\": \"[]\"}", "{\"lst\": \"[-1, 2, -1]\"}" ], "expected": [ [ "some 2" ], [ "some 5" ], [ "none"...
{ "input": [] }
advanced
verina_advanced_11
-----Description----- This task requires writing a Lean 4 method that finds the **majority element** in a list of integers. A majority element is defined as an element that appears **strictly more than half** the number of times in the list. If such an element exists, the method should return that element. Otherwise...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def findMajorityElement_precond (lst : List Int) : Prop := -- !benchmark @start precond True ...
{ "name": "findMajorityElement", "parameters": { "param_name": [ "lst" ], "param_type": [ "List Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "lab_assignment", "link": "[{\"text_file_id\"=>803067667}]", "task_id": "lab_findMajorityElement_325106966", "student_id": [ 9 ] } }
{ "input": [ "{\"lst\": \"[1, 2, 1, 1]\"}", "{\"lst\": \"[1, 2, 3, 4]\"}", "{\"lst\": \"[2, 2, 2, 2, 3, 3]\"}", "{\"lst\": \"[]\"}", "{\"lst\": \"[5, 5, 5, 5, 5, 5]\"}", "{\"lst\": \"[-1, -1, -1, 2, 2]\"}", "{\"lst\": \"[-3, -3, -3, -3, 1]\"}" ], "expected": [ [ "1" ], ...
{ "input": [] }
advanced
verina_basic_66
-----Description----- This task focuses on determining if a given integer is even. The problem requires checking whether the integer can be represented as twice another integer, meaning it is divisible by 2 without any remainder. -----Input----- The input consists of a single integer: • x: An integer to be evalu...
-- !benchmark @start import type=solution import Mathlib -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def ComputeIsEven_precond (x : Int) : Prop := -- !benchmark @start precond True ...
{ "name": "ComputeIsEven", "parameters": { "param_name": [ "x" ], "param_type": [ "Int" ] }, "return_type": "Bool" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_is_even", "student_id": null } }
{ "input": [ "{\"x\": 4}", "{\"x\": 7}", "{\"x\": 0}", "{\"x\": -2}", "{\"x\": -3}" ], "expected": [ [ "True" ], [ "False" ], [ "True" ], [ "True" ], [ "False" ] ], "unexpected": [ [ "False" ], [ ...
{ "input": [] }
basic
verina_advanced_32
-----Description----- This test implements a function in Lean 4 that finds the length of the longest increasing subsequence in a list of integers. A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements. An increasing su...
-- !benchmark @start import type=solution import Mathlib -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def longestIncreasingSubsequence_precond (numbers : List Int) : Prop := -- !benchm...
{ "name": "longestIncreasingSubsequence", "parameters": { "param_name": [ "numbers" ], "param_type": [ "List Int" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "", "task_id": "lab_longestIncreasingSubsequence_324969521", "student_id": [ 26 ] } }
{ "input": [ "{\"numbers\": \"[10, 22, 9, 33, 21, 50, 41, 60]\"}", "{\"numbers\": \"[3, 10, 2, 1, 20]\"}", "{\"numbers\": \"[50, 3, 10, 7, 40, 80]\"}", "{\"numbers\": \"[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]\"}", "{\"numbers\": \"[1, 2, 3, 4, 5]\"}", "{\"numbers\": \"[]\"}", "{\"numbers\": \"[5]\...
{ "input": [] }
advanced
verina_basic_84
-----Description----- You are given an array of integers and a threshold value k. The problem is to create a new array where every element greater than k is replaced with -1 while every other element remains unchanged. -----Input----- The input consists of: • arr: An array of integers. • k: An integer used as ...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def replace_precond (arr : Array Int) (k : Int) : Prop := -- !benchmark @start precond True ...
{ "name": "replace", "parameters": { "param_name": [ "arr", "k" ], "param_type": [ "Array Int", "Int" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_replace", "student_id": null } }
{ "input": [ "{\"arr\": \"#[1, 5, 3, 10]\", \"k\": 4}", "{\"arr\": \"#[-1, 0, 1, 2]\", \"k\": 2}", "{\"arr\": \"#[100, 50, 100]\", \"k\": 100}", "{\"arr\": \"#[-5, -2, 0, 3]\", \"k\": -3}", "{\"arr\": \"#[1, 2, 3]\", \"k\": 5}" ], "expected": [ [ "#[1, -1, 3, -1]" ], [ ...
{ "input": [] }
basic
verina_basic_35
-----Description----- This task requires writing a Lean 4 method that rearranges an array of integers by moving all zero values to the end of the array. The method should ensure that the relative order of the non-zero elements remains the same, the overall size of the array is unchanged, and the number of zeroes in th...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def MoveZeroesToEnd_precond (arr : Array Int) : Prop := -- !benchmark @start precond True -...
{ "name": "MoveZeroesToEnd", "parameters": { "param_name": [ "arr" ], "param_type": [ "Array Int" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_632", "student_id": null } }
{ "input": [ "{\"arr\": \"#[0, 1, 0, 3, 12]\"}", "{\"arr\": \"#[0, 0, 1]\"}", "{\"arr\": \"#[1, 2, 3]\"}", "{\"arr\": \"#[0, 0, 0]\"}", "{\"arr\": \"#[]\"}" ], "expected": [ [ "#[1, 3, 12, 0, 0]" ], [ "#[1, 0, 0]" ], [ "#[1, 2, 3]" ], [ "#[0,...
{ "input": [] }
basic
verina_basic_93
-----Description----- This task requires swapping two 8-bit unsigned integers. Given two unsigned integer inputs, the goal is to produce an output pair where the first element is the original second input and the second element is the original first input. The problem focuses solely on exchanging the values without s...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def SwapBitvectors_precond (X : UInt8) (Y : UInt8) : Prop := -- !benchmark @start precond True...
{ "name": "SwapBitvectors", "parameters": { "param_name": [ "X", "Y" ], "param_type": [ "UInt8", "UInt8" ] }, "return_type": "UInt8 × UInt8" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_swap_bitvector", "student_id": null } }
{ "input": [ "{\"X\": 0, \"Y\": 0}", "{\"X\": 5, \"Y\": 10}", "{\"X\": 255, \"Y\": 1}", "{\"X\": 128, \"Y\": 64}", "{\"X\": 15, \"Y\": 15}" ], "expected": [ [ "(0, 0)" ], [ "(10, 5)" ], [ "(1, 255)" ], [ "(64, 128)" ], [ "(15, 1...
{ "input": [] }
basic
verina_advanced_7
-----Description----- This task requires writing a Lean 4 function that converts a binary number represented as a list of digits (0 or 1) into its corresponding decimal value. The list is ordered in big-endian format, meaning the most significant digit comes first. The function should interpret the list as a binary num...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def binaryToDecimal_precond (digits : List Nat) : Prop := -- !benchmark @start precond digits.all (f...
{ "name": "binaryToDecimal", "parameters": { "param_name": [ "digits" ], "param_type": [ "List Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/convert-binary-number-in-a-linked-list-to-integer/description/", "task_id": "lab_binaryToDecimal_325751702", "student_id": [ 5 ] } }
{ "input": [ "{\"digits\": \"[1, 0, 1]\"}", "{\"digits\": \"[1, 1, 1, 1]\"}", "{\"digits\": \"[0, 0, 0]\"}", "{\"digits\": \"[1, 0, 0, 0, 0]\"}", "{\"digits\": \"[]\"}", "{\"digits\": \"[1]\"}" ], "expected": [ [ "5" ], [ "15" ], [ "0" ], [ ...
{ "input": [ "{'digits': '[2]'}" ] }
advanced
verina_advanced_54
-----Description----- This task requires writing a Lean 4 function that finds the one missing number in a list of distinct natural numbers from 0 to n. The list contains exactly n numbers and all numbers are in the range [0, n], but one number in that range is missing. Your function must return the missing number. You...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def missingNumber_precond (nums : List Nat) : Prop := -- !benchmark @start precond nums.all (fun x =...
{ "name": "missingNumber", "parameters": { "param_name": [ "nums" ], "param_type": [ "List Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/missing-number/description/", "task_id": "lab_missingNumber_324976035", "student_id": [ 22 ] } }
{ "input": [ "{\"nums\": \"[3, 0, 1]\"}", "{\"nums\": \"[0, 1]\"}", "{\"nums\": \"[9, 6, 4, 2, 3, 5, 7, 0, 1]\"}", "{\"nums\": \"[0]\"}", "{\"nums\": \"[1]\"}" ], "expected": [ [ "2" ], [ "2" ], [ "8" ], [ "1" ], [ "0" ] ]...
{ "input": [ "{'nums': '[0, 0, 1]'}" ] }
advanced
verina_basic_22
-----Description----- This task requires writing a Lean 4 method that identifies the dissimilar elements between two arrays of integers. In other words, the method should return an array containing all elements that appear in one input array but not in the other. The output array must contain no duplicate elements and...
-- !benchmark @start import type=solution import Std.Data.HashSet -- !benchmark @end import -- !benchmark @start solution_aux def inArray (a : Array Int) (x : Int) : Bool := a.any (fun y => y = x) -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] de...
{ "name": "dissimilarElements", "parameters": { "param_name": [ "a", "b" ], "param_type": [ "Array Int", "Array Int" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_579", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 2, 3, 4]\", \"b\": \"#[3, 4, 5, 6]\"}", "{\"a\": \"#[1, 1, 2]\", \"b\": \"#[2, 3]\"}", "{\"a\": \"#[]\", \"b\": \"#[4, 5]\"}", "{\"a\": \"#[7, 8]\", \"b\": \"#[]\"}", "{\"a\": \"#[1, 2, 3]\", \"b\": \"#[1, 2, 3]\"}", "{\"a\": \"#[1, 2, 3]\", \"b\": \"#[4, 5, 6]\"}"...
{ "input": [] }
basic
verina_advanced_66
-----Description----- Given an input string "words_str", this task requires writing a Lean 4 function that reverses the order of its words. A word is defined as a contiguous sequence of non-space characters. The function must remove any extra spaces so that the output string contains words separated by a single space a...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def reverseWords_precond (words_str : String) : Prop := -- !benchmark @start precond True -- !benc...
{ "name": "reverseWords", "parameters": { "param_name": [ "words_str" ], "param_type": [ "String" ] }, "return_type": "String" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/reverse-words-in-a-string/description/", "task_id": "lab_reverseWords_324895224", "student_id": [ 48 ] } }
{ "input": [ "{\"words_str\": \"the sky is blue\"}", "{\"words_str\": \" hello world \"}", "{\"words_str\": \"a good example\"}", "{\"words_str\": \" Bob Loves Alice \"}", "{\"words_str\": \"this lab is interesting\"}" ], "expected": [ [ "blue is sky the" ], [ ...
{ "input": [] }
advanced
verina_basic_69
-----Description----- This problem involves determining the index of the first occurrence of a specified element within an array of integers. The objective is to identify the correct position where the target element appears for the first time, ensuring that all elements prior to that index are different from the tar...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def LinearSearch_precond (a : Array Int) (e : Int) : Prop := -- !benchmark @start precond ∃ i,...
{ "name": "LinearSearch", "parameters": { "param_name": [ "a", "e" ], "param_type": [ "Array Int", "Int" ] }, "return_type": "Nat" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_linear_search2", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 2, 3, 4, 5]\", \"e\": 3}", "{\"a\": \"#[10, 20, 30, 40, 50]\", \"e\": 10}", "{\"a\": \"#[5, 4, 3, 2, 1]\", \"e\": 1}", "{\"a\": \"#[-1, 0, 1, 2]\", \"e\": -1}", "{\"a\": \"#[7, 8, 7, 9, 7]\", \"e\": 7}" ], "expected": [ [ "2" ], [ "0" ],...
{ "input": [ "{'a': '#[1, 2, 3, 4, 5]', 'e': 6}" ] }
basic
verina_basic_7
-----Description----- This task requires writing a Lean 4 method that computes the sum of the squares of the first n odd natural numbers. The result should match the formula: (n * (2 * n - 1) * (2 * n + 1)) / 3. -----Input----- The input consists of: n: A natural number representing the count of odd natural numbers t...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def sumOfSquaresOfFirstNOddNumbers_precond (n : Nat) : Prop := -- !benchmark @start precond T...
{ "name": "sumOfSquaresOfFirstNOddNumbers", "parameters": { "param_name": [ "n" ], "param_type": [ "Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_267", "student_id": null } }
{ "input": [ "{\"n\": 0}", "{\"n\": 1}", "{\"n\": 2}", "{\"n\": 3}", "{\"n\": 4}", "{\"n\": 5}", "{\"n\": 10}" ], "expected": [ [ "0" ], [ "1" ], [ "10" ], [ "35" ], [ "84" ], [ "165" ], [ "13...
{ "input": [] }
basic
verina_basic_106
-----Description----- The task is to compute the element-wise sum of two integer arrays. The result should be a new array where each element is the sum of the corresponding elements from the two input arrays. The problem assumes that both arrays have the same length. -----Input----- The input consists of two param...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def arraySum_precond (a : Array Int) (b : Array Int) : Prop := -- !benchmark @start precond a....
{ "name": "arraySum", "parameters": { "param_name": [ "a", "b" ], "param_type": [ "Array Int", "Array Int" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_array_sum", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 2, 3]\", \"b\": \"#[4, 5, 6]\"}", "{\"a\": \"#[0, 0, 0]\", \"b\": \"#[0, 0, 0]\"}", "{\"a\": \"#[-1, 2, 3]\", \"b\": \"#[1, -2, 4]\"}", "{\"a\": \"#[10]\", \"b\": \"#[-10]\"}", "{\"a\": \"#[100, 200, 300]\", \"b\": \"#[100, 200, 300]\"}" ], "expected": [ [ ...
{ "input": [ "{'a': '#[1, 2, 3, 4]', 'b': '#[5, 6, 7]'}" ] }
basic
verina_advanced_23
-----Description----- This task requires writing a Lean 4 method that determines whether a given integer is a power of two. An integer n is a power of two if there exists an integer x such that n = 2^x. The method should return true if n is a power of two, and false otherwise. Note that negative numbers and zero are n...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def isPowerOfTwo_precond (n : Int) : Prop := -- !benchmark @start precond True -- !benchmark @end ...
{ "name": "isPowerOfTwo", "parameters": { "param_name": [ "n" ], "param_type": [ "Int" ] }, "return_type": "Bool" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/power-of-two/description/", "task_id": "lab_isPowerOfTwo_324854887", "student_id": [ 18 ] } }
{ "input": [ "{\"n\": 1}", "{\"n\": 16}", "{\"n\": 3}", "{\"n\": 0}", "{\"n\": -2}", "{\"n\": 8}", "{\"n\": 10}" ], "expected": [ [ "True" ], [ "True" ], [ "False" ], [ "False" ], [ "False" ], [ "True" ...
{ "input": [] }
advanced
verina_basic_23
-----Description----- This task requires writing a Lean 4 method that calculates the difference between the maximum and minimum values in an array of integers. In other words, the method should determine the highest and lowest numbers in the array and return the result of subtracting the minimum from the maximum. ---...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def differenceMinMax_precond (a : Array Int) : Prop := -- !benchmark @start precond a.size > ...
{ "name": "differenceMinMax", "parameters": { "param_name": [ "a" ], "param_type": [ "Array Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_588", "student_id": null } }
{ "input": [ "{\"a\": \"#[3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]\"}", "{\"a\": \"#[10, 20, 30, 40, 50]\"}", "{\"a\": \"#[-10, -20, -30, -40, -50]\"}", "{\"a\": \"#[7]\"}", "{\"a\": \"#[5, 5, 5, 5]\"}", "{\"a\": \"#[1, -1, 2, -2]\"}" ], "expected": [ [ "8" ], [ "40" ],...
{ "input": [ "{'a': '#[]'}" ] }
basic
verina_basic_48
-----Description----- This task requires writing a Lean 4 method that determines whether a given non-negative natural number is a perfect square. In other words, the method should return true if there exists a natural number whose square is equal to the input number, and false if no such number exists. -----Input---...
-- !benchmark @start import type=solution import Mathlib -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def isPerfectSquare_precond (n : Nat) : Prop := -- !benchmark @start precond Tr...
{ "name": "isPerfectSquare", "parameters": { "param_name": [ "n" ], "param_type": [ "Nat" ] }, "return_type": "Bool" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_803", "student_id": null } }
{ "input": [ "{\"n\": 0}", "{\"n\": 1}", "{\"n\": 4}", "{\"n\": 9}", "{\"n\": 2}", "{\"n\": 3}", "{\"n\": 10}", "{\"n\": 16}", "{\"n\": 25}", "{\"n\": 26}" ], "expected": [ [ "True" ], [ "True" ], [ "True" ], [ "True" ...
{ "input": [] }
basic
verina_advanced_73
-----Description----- This task requires writing a Lean 4 method that finds the first missing natural number in an increasingly sorted list. The method should return the smallest natural number that is not in the list, ensuring that all natural numbers that are smaller is inside the list. -----Input----- The input co...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def smallestMissing_precond (l : List Nat) : Prop := -- !benchmark @start precond List.Pairwise (· <...
{ "name": "smallestMissing", "parameters": { "param_name": [ "l" ], "param_type": [ "List Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "NA, idea from ed stem comment", "task_id": "lab_smallestMissing_325415996", "student_id": [ 51 ] } }
{ "input": [ "{\"l\": \"[0, 1, 2, 4, 5]\"}", "{\"l\": \"[]\"}", "{\"l\": \"[1, 2, 3, 4]\"}", "{\"l\": \"[0, 1, 2, 3, 4]\"}", "{\"l\": \"[2, 3, 4, 5, 6]\"}" ], "expected": [ [ "3" ], [ "0" ], [ "0" ], [ "5" ], [ "0" ] ], ...
{ "input": [ "{'l': '[1, 1]'}", "{'l': '[1, 0]'}" ] }
advanced
verina_advanced_45
-----Description----- This task requires writing a Lean 4 function that finds the maximum subarray sum from a given list of integers. A subarray is a contiguous sequence of elements within the list. The function should return the maximum sum that can be obtained from any subarray. -----Input----- The input is a list...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def maxSubarraySum_precond (xs : List Int) : Prop := -- !benchmark @start precond True -- !b...
{ "name": "maxSubarraySum", "parameters": { "param_name": [ "xs" ], "param_type": [ "List Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "lab_assignment", "link": "", "task_id": "lab_maxSubarraySum_324785655", "student_id": [ 37 ] } }
{ "input": [ "{\"xs\": \"[1, -2, 3, 4, -1]\"}", "{\"xs\": \"[-2, -3, -1, -5]\"}", "{\"xs\": \"[5, -1, 2, -1, 3]\"}", "{\"xs\": \"[]\"}", "{\"xs\": \"[4, -1, -2, 1, 5]\"}" ], "expected": [ [ "7" ], [ "-1" ], [ "8" ], [ "0" ], [ "...
{ "input": [] }
advanced
verina_basic_74
-----Description----- This task involves identifying the maximum value in a non-empty array of integers. The objective is to determine which element in the array is greater than or equal to every other element, ensuring that the selected value is one of the elements in the array. -----Input----- The input consists...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def maxArray_precond (a : Array Int) : Prop := -- !benchmark @start precond a.size > 0 -- !b...
{ "name": "maxArray", "parameters": { "param_name": [ "a" ], "param_type": [ "Array Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_max_array", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 2, 3, 4, 5]\"}", "{\"a\": \"#[5, 3, 4, 1, 2]\"}", "{\"a\": \"#[7]\"}", "{\"a\": \"#[-1, -5, -3, -4]\"}", "{\"a\": \"#[-10, -20, -30, -5, -15]\"}" ], "expected": [ [ "5" ], [ "5" ], [ "7" ], [ "-1" ], [ ...
{ "input": [ "{'a': '#[]'}" ] }
basic
verina_basic_82
-----Description----- This task is about processing an array of integers by producing a new array that excludes the first element. The objective is to define a clear behavior: if the array contains at least one element, return a modified array starting from the second element. -----Input----- The input consists of...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def remove_front_precond (a : Array Int) : Prop := -- !benchmark @start precond a.size > 0 -...
{ "name": "remove_front", "parameters": { "param_name": [ "a" ], "param_type": [ "Array Int" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_remove_front", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 2, 3, 4, 5]\"}", "{\"a\": \"#[10, 20, 30]\"}", "{\"a\": \"#[0, -1, -2, -3]\"}", "{\"a\": \"#[7]\"}", "{\"a\": \"#[100, 0, 50]\"}" ], "expected": [ [ "#[2, 3, 4, 5]" ], [ "#[20, 30]" ], [ "#[-1, -2, -3]" ], [ "#[]"...
{ "input": [ "{'a': '#[]'}" ] }
basic
verina_basic_1
-----Description----- This task requires writing a Lean 4 method that determines whether two given integers have opposite signs. In other words, the method should return true if one integer is positive and the other is negative. Note that zero is considered neither positive nor negative; therefore, if either integer i...
-- !benchmark @start import type=solution import Mathlib -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def hasOppositeSign_precond (a : Int) (b : Int) : Prop := -- !benchmark @start pr...
{ "name": "hasOppositeSign", "parameters": { "param_name": [ "a", "b" ], "param_type": [ "Int", "Int" ] }, "return_type": "Bool" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_58", "student_id": null } }
{ "input": [ "{\"a\": -5, \"b\": 10}", "{\"a\": 5, \"b\": -10}", "{\"a\": 5, \"b\": 10}", "{\"a\": -5, \"b\": -10}", "{\"a\": 0, \"b\": 10}", "{\"a\": 10, \"b\": 0}", "{\"a\": 0, \"b\": -10}", "{\"a\": -10, \"b\": 0}", "{\"a\": 0, \"b\": 0}", "{\"a\": -1, \"b\": 1}", "{\"a\...
{ "input": [] }
basic
verina_advanced_14
-----Description----- This task requires writing a Lean 4 method that determines whether a natural number is a power of four. The method should return a boolean value that indicates whether the given natural number is a power of four. An integer n is a power of four, if there exists an natural number x such that n = 4...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def ifPowerOfFour_precond (n : Nat) : Prop := -- !benchmark @start precond True -- !benchmark @end...
{ "name": "ifPowerOfFour", "parameters": { "param_name": [ "n" ], "param_type": [ "Nat" ] }, "return_type": "Bool" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/power-of-four/", "task_id": "lab_ifPowerOfFour_325708699", "student_id": [ 12 ] } }
{ "input": [ "{\"n\": 0}", "{\"n\": 1}", "{\"n\": 2}", "{\"n\": 3}", "{\"n\": 4}", "{\"n\": 8}", "{\"n\": 16}", "{\"n\": 64}", "{\"n\": 95}", "{\"n\": 100}", "{\"n\": 256}", "{\"n\": 520}", "{\"n\": 1024}" ], "expected": [ [ "False" ], [ ...
{ "input": [] }
advanced
verina_advanced_4
-----Description----- This task requires writing a Lean 4 method that finds the length of the longest increasing sequence in a given array. The method should return the length of the longest increasing subsequence, in which every element is strictly less than the latter element. -----Input----- The input consists of ...
-- !benchmark @start import type=solution import Mathlib -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def LongestIncreasingSubsequence_precond (a : Array Int) : Prop := -- !benchmark @...
{ "name": "LongestIncreasingSubsequence", "parameters": { "param_name": [ "a" ], "param_type": [ "Array Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "lab_assignment", "link": "", "task_id": "lab_LongestIncreasingSubsequence_324999618", "student_id": [ 2 ] } }
{ "input": [ "{\"a\": \"#[5, 2, 8, 6, 3, 6, 9, 7]\"}", "{\"a\": \"#[3, 1, 2, 1, 0]\"}", "{\"a\": \"#[2, 3, -2, -1, 7, 19, 3, 6, -4, 6, -7, 0, 9, 12, 10]\"}", "{\"a\": \"#[5, -5, -3, 2, 4, 1, 0, -1, 3, 2, 0]\"}", "{\"a\": \"#[1, 7, 23, 14, -4, 21, 8, 2, -1, 9, 12, 2]\"}", "{\"a\": \"#[]\"}" ]...
{ "input": [] }
advanced
verina_advanced_22
-----Description----- This task requires writing a Lean 4 method that determines whether a list of integers follows a peak-valley pattern. A list follows this pattern if: A. It strictly increases at first, B. Then strictly decreases, C. Both parts are non-empty. Examples: - [1, 3, 5, 4, 2] -> true - [1, 2, 3] -> fal...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def isPeakValley_precond (lst : List Int) : Prop := -- !benchmark @start precond True -- !be...
{ "name": "isPeakValley", "parameters": { "param_name": [ "lst" ], "param_type": [ "List Int" ] }, "return_type": "Bool" }
{ "upstream": { "name": "lab_assignment", "link": "", "task_id": "lab_isPeakValley_325583306", "student_id": [ 4 ] } }
{ "input": [ "{\"lst\": \"[1, 3, 5, 2, 1]\"}", "{\"lst\": \"[1, 2, 3, 4, 5]\"}", "{\"lst\": \"[]\"}", "{\"lst\": \"[1]\"}", "{\"lst\": \"[1, 1, 1, 1, 1]\"}", "{\"lst\": \"[1, 10, 100, 1]\"}" ], "expected": [ [ "True" ], [ "False" ], [ "False" ], ...
{ "input": [] }
advanced
verina_basic_19
-----Description----- This task requires writing a Lean 4 method that checks whether an array of integers is sorted in non-decreasing order. The method should return true if every element is less than or equal to the element that follows it, and false otherwise. -----Input----- The input consists of: a: An array of i...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def isSorted_precond (a : Array Int) : Prop := -- !benchmark @start precond True -- !benchm...
{ "name": "isSorted", "parameters": { "param_name": [ "a" ], "param_type": [ "Array Int" ] }, "return_type": "Bool" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_567", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 2, 3, 4, 5]\"}", "{\"a\": \"#[5, 4, 3, 2, 1]\"}", "{\"a\": \"#[1, 3, 2, 4, 5]\"}", "{\"a\": \"#[]\"}", "{\"a\": \"#[10]\"}", "{\"a\": \"#[2, 2, 2, 2]\"}", "{\"a\": \"#[1, 2, 2, 3]\"}" ], "expected": [ [ "True" ], [ "False" ], ...
{ "input": [] }
basic
verina_basic_76
-----Description----- This task requires determining the smaller of two integers. Given two input numbers, the goal is to compare them and return the one that is less than or equal to the other. -----Input----- The input consists of two integers: • x: The first integer. • y: The second integer. -----Output---...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def myMin_precond (x : Int) (y : Int) : Prop := -- !benchmark @start precond True -- !benchm...
{ "name": "myMin", "parameters": { "param_name": [ "x", "y" ], "param_type": [ "Int", "Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_min_of_two", "student_id": null } }
{ "input": [ "{\"x\": 3, \"y\": 5}", "{\"x\": 10, \"y\": 7}", "{\"x\": 4, \"y\": 4}", "{\"x\": -5, \"y\": 0}", "{\"x\": 0, \"y\": -10}" ], "expected": [ [ "3" ], [ "7" ], [ "4" ], [ "-5" ], [ "-10" ] ], "unexpected": [ ...
{ "input": [] }
basic
verina_advanced_39
-----Description----- This task requires writing a Lean 4 function that returns the maximum element from a non-empty list of natural numbers. -----Input----- The input consists of: lst: a non-empty list of natural numbers. -----Output----- The output is: A natural number representing the largest element in the list. ...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def maxOfList_precond (lst : List Nat) : Prop := -- !benchmark @start precond lst.length > 0 ...
{ "name": "maxOfList", "parameters": { "param_name": [ "lst" ], "param_type": [ "List Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "", "task_id": "lab_maxOfList_325053133", "student_id": [ 32 ] } }
{ "input": [ "{\"lst\": \"[1, 2, 3]\"}", "{\"lst\": \"[5, 5, 5]\"}", "{\"lst\": \"[10, 1, 9]\"}", "{\"lst\": \"[7]\"}", "{\"lst\": \"[0, 0, 0, 0]\"}" ], "expected": [ [ "3" ], [ "5" ], [ "10" ], [ "7" ], [ "0" ] ], "unex...
{ "input": [ "{'lst': '[]'}" ] }
advanced
verina_basic_63
-----Description----- The task is to determine whether there exists at least one pair of different floating-point numbers in a list such that the absolute difference between them is less than a given threshold. The focus is solely on deciding if such a pair is present in the list. -----Input----- The input consist...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux def absDiff (a b : Float) : Float := if a - b < 0.0 then b - a else a - b -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def has_close_elements_...
{ "name": "has_close_elements", "parameters": { "param_name": [ "numbers", "threshold" ], "param_type": [ "List Float", "Float" ] }, "return_type": "Bool" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_has_close_elements", "student_id": null } }
{ "input": [ "{\"numbers\": \"[1.0, 2.0, 3.0]\", \"threshold\": 1.5}", "{\"numbers\": \"[10.0, 12.0, 15.0]\", \"threshold\": 1.5}", "{\"numbers\": \"[5.0, 5.0]\", \"threshold\": 0.1}", "{\"numbers\": \"[]\", \"threshold\": 2.0}", "{\"numbers\": \"[0.0, 0.5, 1.1, 2.2]\", \"threshold\": 0.6}" ], ...
{ "input": [ "{'numbers': '[1.0, 2.0, 3.0]', 'threshold': -1.0}", "{'numbers': '[Float.nan, 1.0]', 'threshold': 1.0}", "{'numbers': '[1.0, Float.nan, 2.0]', 'threshold': 0.5}", "{'numbers': '[Float.inf, 1.0]', 'threshold': 1.0}" ] }
basic
verina_advanced_19
-----Description----- This task requires writing a Lean 4 method that checks whether a given string is a palindrome. A palindrome is a string that reads the same forwards and backwards. The function should ignore whitespace, punctuation, and capitalization when checking for palindromes. -----Input----- The input consi...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- Check if a character is an uppercase alphabet letter def isUpperAlpha (c : Char) : Bool := 'A' ≤ c ∧ c ≤ 'Z' -- Check if a character is a lowercase alphabet letter def isLowerAlpha (c : Char) : Bool := 'a' ≤ ...
{ "name": "isCleanPalindrome", "parameters": { "param_name": [ "s" ], "param_type": [ "String" ] }, "return_type": "Bool" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/valid-palindrome/", "task_id": "lab_isCleanPalindrome_325752578", "student_id": [ 15 ] } }
{ "input": [ "{\"s\": \"A man, a plan, a canal, Panama\"}", "{\"s\": \"No lemon, no melon\"}", "{\"s\": \"OpenAI\"}", "{\"s\": \"Was it a car or a cat I saw?\"}", "{\"s\": \"Hello, World!\"}" ], "expected": [ [ "True" ], [ "True" ], [ "False" ], [ ...
{ "input": [] }
advanced
verina_basic_89
-----Description----- This problem asks you to design a solution that transforms a list with possible duplicate entries into a new list where each element appears only once, maintaining the order of its first occurrence. -----Input----- The input consists of: • s: A list of integers (or any type supporting decid...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def SetToSeq_precond (s : List Int) : Prop := -- !benchmark @start precond True -- !benchmar...
{ "name": "SetToSeq", "parameters": { "param_name": [ "s" ], "param_type": [ "List Int" ] }, "return_type": "List Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_set_to_seq", "student_id": null } }
{ "input": [ "{\"s\": \"[1, 2, 2, 3, 1]\"}", "{\"s\": \"[5, 5, 5, 5]\"}", "{\"s\": \"[]\"}", "{\"s\": \"[11, 22, 33]\"}", "{\"s\": \"[3, 1, 4, 1, 5, 9, 2, 6, 5]\"}" ], "expected": [ [ "[1, 2, 3]" ], [ "[5]" ], [ "[]" ], [ "[11, 22, 33]" ]...
{ "input": [] }
basic
verina_basic_40
-----Description----- This task requires writing a Lean 4 method that finds the second-smallest number in an array of integers. The method should determine and return the number that is larger than the smallest element in the array. It is crucial that the input array remains unchanged after the computation. -----Inpu...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def secondSmallest_precond (s : Array Int) : Prop := -- !benchmark @start precond s.size > 1 ...
{ "name": "secondSmallest", "parameters": { "param_name": [ "s" ], "param_type": [ "Array Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_755", "student_id": null } }
{ "input": [ "{\"s\": \"#[5, 3, 1, 4, 2]\"}", "{\"s\": \"#[7, 2, 5, 3]\"}", "{\"s\": \"#[10, 20]\"}", "{\"s\": \"#[20, 10]\"}", "{\"s\": \"#[3, 1, 2]\"}" ], "expected": [ [ "2" ], [ "3" ], [ "20" ], [ "20" ], [ "2" ] ], ...
{ "input": [ "{'s': '#[1]'}", "{'s': '#[5, 5]'}", "{'s': '#[3, 3, 3]'}", "{'s': '#[-1, -1, -1, -1]'}" ] }
basic
verina_basic_97
-----Description----- This task involves updating an array of integers such that the element at a specified index is set to 60 while all other elements remain unchanged. -----Input----- The input consists of: • a: An array of integers. • j: A natural number representing the index (0-indexed) to update. It is a...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def TestArrayElements_precond (a : Array Int) (j : Nat) : Prop := -- !benchmark @start precond ...
{ "name": "TestArrayElements", "parameters": { "param_name": [ "a", "j" ], "param_type": [ "Array Int", "Nat" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_test_array", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 2, 3, 4, 5]\", \"j\": 2}", "{\"a\": \"#[60, 30, 20]\", \"j\": 1}", "{\"a\": \"#[10, 20, 30]\", \"j\": 0}", "{\"a\": \"#[5, 10, 15]\", \"j\": 2}", "{\"a\": \"#[0]\", \"j\": 0}" ], "expected": [ [ "#[1, 2, 60, 4, 5]" ], [ "#[60, 60, 20]" ]...
{ "input": [ "{'a': '#[1, 2, 3, 4]', 'j': 5}" ] }
basic
verina_basic_78
-----Description----- Given two integers, the task is to compute two output values: one being the sum of the integers and the other being their difference. -----Input----- The input consists of two integers: • x: An integer. • y: An integer. -----Output----- The output is a tuple of two integers: • The fi...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def MultipleReturns_precond (x : Int) (y : Int) : Prop := -- !benchmark @start precond True ...
{ "name": "MultipleReturns", "parameters": { "param_name": [ "x", "y" ], "param_type": [ "Int", "Int" ] }, "return_type": "(Int × Int)" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_multi_return", "student_id": null } }
{ "input": [ "{\"x\": 3, \"y\": 2}", "{\"x\": -2, \"y\": 3}", "{\"x\": 0, \"y\": 0}", "{\"x\": 10, \"y\": 5}", "{\"x\": -5, \"y\": -10}" ], "expected": [ [ "(5, 1)" ], [ "(1, -5)" ], [ "(0, 0)" ], [ "(15, 5)" ], [ "(-15, 5)" ...
{ "input": [] }
basic
verina_advanced_65
-----Description----- This task requires writing a Lean 4 method that reverses a given string. The method should return a new string which consists of the characters of the input string in reverse order. -----Input----- The input consists of: s: A string (which may be empty). -----Output----- The output is a string: ...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def reverseString_precond (s : String) : Prop := -- !benchmark @start precond True -- !benchmark @...
{ "name": "reverseString", "parameters": { "param_name": [ "s" ], "param_type": [ "String" ] }, "return_type": "String" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/reverse-string/", "task_id": "lab_reverseString_325766147", "student_id": [ 33 ] } }
{ "input": [ "{\"s\": \"hello\"}", "{\"s\": \"a\"}", "{\"s\": \"\"}", "{\"s\": \"racecar\"}", "{\"s\": \"Lean\"}" ], "expected": [ [ "olleh" ], [ "a" ], [ "" ], [ "racecar" ], [ "naeL" ] ], "unexpected": [ [ "h...
{ "input": [] }
advanced
verina_advanced_67
-----Description----- This task requires writing a Lean 4 method that performs run-length encoding on a given string. The method should scan the string from left to right and group consecutive identical characters into pairs. Each pair consists of the character itself and the number of times it appears consecutively. F...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def runLengthEncode_precond (s : String) : Prop := -- !benchmark @start precond True -- !ben...
{ "name": "runLengthEncode", "parameters": { "param_name": [ "s" ], "param_type": [ "String" ] }, "return_type": "List (Char × Nat)" }
{ "upstream": { "name": "lab_assignment", "link": "[{\"text_file_id\"=>802373105}]", "task_id": "lab_runLengthEncode_324976093", "student_id": [ 13 ] } }
{ "input": [ "{\"s\": \"\"}", "{\"s\": \"aaa\"}", "{\"s\": \"abbbcccaa\"}", "{\"s\": \"xyz\"}", "{\"s\": \"aabbaa\"}" ], "expected": [ [ "[]" ], [ "[('a', 3)]" ], [ "[('a', 1), ('b', 3), ('c', 3), ('a', 2)]" ], [ "[('x', 1), ('y', 1), ('z', 1...
{ "input": [] }
advanced
verina_advanced_60
-----Description----- This task requires writing a Lean 4 method that takes a list of natural numbers and partitions it into two separate lists: one containing all the even numbers and the other containing all the odd numbers. The order of elements in each sublist should match their appearance in the original list. As...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def partitionEvensOdds_precond (nums : List Nat) : Prop := -- !benchmark @start precond True -- !b...
{ "name": "partitionEvensOdds", "parameters": { "param_name": [ "nums" ], "param_type": [ "List Nat" ] }, "return_type": "(List Nat × List Nat)" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/sort-array-by-parity/description/", "task_id": "lab_partitionEvensOdds_325775567", "student_id": [ 44 ] } }
{ "input": [ "{\"nums\": \"[1, 2, 3, 4, 5, 6]\"}", "{\"nums\": \"[0, 7, 8, 9, 10]\"}", "{\"nums\": \"[]\"}", "{\"nums\": \"[2, 4, 6, 8]\"}", "{\"nums\": \"[1, 3, 5, 7]\"}" ], "expected": [ [ "([2, 4, 6], [1, 3, 5])" ], [ "([0, 8, 10], [7, 9])" ], [ "([], [...
{ "input": [] }
advanced
verina_advanced_61
-----Description----- This task requires writing a Lean 4 function that takes a list of integers and returns a new list. For each index i in the input list, the output at i is equal to the product of all numbers in the list except the number at index i. The solution must run in O(n) time without using the division oper...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def productExceptSelf_precond (nums : List Int) : Prop := -- !benchmark @start precond True -- !be...
{ "name": "productExceptSelf", "parameters": { "param_name": [ "nums" ], "param_type": [ "List Int" ] }, "return_type": "List Int" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/product-of-array-except-self/description/", "task_id": "lab_productExceptSelf_325619864", "student_id": [ 45 ] } }
{ "input": [ "{\"nums\": \"[1, 2, 3, 4]\"}", "{\"nums\": \"[-1, 1, 0, -3, 3]\"}", "{\"nums\": \"[2, 3]\"}", "{\"nums\": \"[5, 5, 5, 5]\"}", "{\"nums\": \"[0, 1, 2]\"}" ], "expected": [ [ "[24, 12, 8, 6]" ], [ "[0, 0, 9, 0, 0]" ], [ "[3, 2]" ], [ ...
{ "input": [] }
advanced
verina_advanced_31
-----Description----- This task requires writing a Lean 4 function that finds the length of the longest strictly increasing subsequence in a list of integers. A subsequence is any sequence that can be derived from the list by deleting zero or more elements without changing the order of the remaining elements. The funct...
-- !benchmark @start import type=solution import Mathlib.Data.List.Basic -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def longestIncreasingSubseqLength_precond (xs : List Int) : Prop := -- !...
{ "name": "longestIncreasingSubseqLength", "parameters": { "param_name": [ "xs" ], "param_type": [ "List Int" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/valid-parentheses/description/", "task_id": "lab_longestIncreasingSubseqLength_325618023", "student_id": [ 25 ] } }
{ "input": [ "{\"xs\": \"[1, 2, 3, 4]\"}", "{\"xs\": \"[4, 3, 2, 1]\"}", "{\"xs\": \"[1, 3, 2, 4, 0, 5]\"}", "{\"xs\": \"[]\"}", "{\"xs\": \"[5, 1, 6, 2, 7]\"}" ], "expected": [ [ "4" ], [ "1" ], [ "4" ], [ "0" ], [ "3" ] ...
{ "input": [] }
advanced
verina_basic_6
-----Description----- This task requires writing a Lean 4 method that finds the minimum among three given integers. The method should return the smallest value, ensuring that the result is less than or equal to each of the input numbers and that it is one of the provided integers. -----Input----- The input consists o...
-- !benchmark @start import type=solution import Mathlib -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def minOfThree_precond (a : Int) (b : Int) (c : Int) : Prop := -- !benchmark @sta...
{ "name": "minOfThree", "parameters": { "param_name": [ "a", "b", "c" ], "param_type": [ "Int", "Int", "Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_227", "student_id": null } }
{ "input": [ "{\"a\": 3, \"b\": 2, \"c\": 1}", "{\"a\": 5, \"b\": 5, \"c\": 5}", "{\"a\": 10, \"b\": 20, \"c\": 15}", "{\"a\": -1, \"b\": 2, \"c\": 3}", "{\"a\": 2, \"b\": -3, \"c\": 4}", "{\"a\": 2, \"b\": 3, \"c\": -5}", "{\"a\": 0, \"b\": 0, \"c\": 1}", "{\"a\": 0, \"b\": -1, \"c\":...
{ "input": [] }
basic
verina_basic_50
-----Description----- This task is about calculating the absolute value of an integer. The goal is to determine the non-negative value of a given integer: if the integer is non-negative, it remains unchanged; if it is negative, its positive counterpart is returned. -----Input----- The input consists of: • x: An ...
-- !benchmark @start import type=solution import Mathlib -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def Abs_precond (x : Int) : Prop := -- !benchmark @start precond True -- !benc...
{ "name": "Abs", "parameters": { "param_name": [ "x" ], "param_type": [ "Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_abs", "student_id": null } }
{ "input": [ "{\"x\": 5}", "{\"x\": 0}", "{\"x\": -5}", "{\"x\": 10}", "{\"x\": -10}" ], "expected": [ [ "5" ], [ "0" ], [ "5" ], [ "10" ], [ "10" ] ], "unexpected": [ [ "-5", "0", "10" ], [...
{ "input": [] }
basic
verina_advanced_10
-----Description----- his task requires writing a Lean 4 method decomposes a natural number `n` into its prime factorization components based on a user-provided list of primes. Specifically, it calculates the exponents for each prime in the factorization such that: \[ n = \prod p^e \] In other words, it determines th...
-- !benchmark @start import type=solution import Mathlib.Data.Nat.Prime.Defs -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def findExponents_precond (n : Nat) (primes : List Nat) : Prop := --...
{ "name": "findExponents", "parameters": { "param_name": [ "n", "primes" ], "param_type": [ "Nat", "List Nat" ] }, "return_type": "List (Nat × Nat)" }
{ "upstream": { "name": "lab_assignment", "link": "N/A", "task_id": "lab_findExponents_325706703", "student_id": [ 8 ] } }
{ "input": [ "{\"n\": 6, \"primes\": \"[2, 3]\"}", "{\"n\": 6285195213566005335561053533150026217291776, \"primes\": \"[2, 3, 5]\"}", "{\"n\": 360, \"primes\": \"[2, 3, 5]\"}", "{\"n\": 18903812908, \"primes\": \"[2, 43, 823, 133543]\"}", "{\"n\": 114514, \"primes\": \"[2, 31, 1847]\"}", "{\"n...
{ "input": [ "{'n': 6, 'primes': '[6]'}", "{'n': 0, 'primes': '[]'}", "{'n': 0, 'primes': '[2, 3]'}", "{'n': 12, 'primes': '[]'}", "{'n': 12, 'primes': '[2, 2, 3]'}" ] }
advanced
verina_advanced_62
-----Description----- This task requires writing a Lean 4 method that calculates how much rainwater would be trapped by a terrain represented as an array of heights. Imagine rainwater falls onto a terrain with varying elevation levels. The water can only be trapped between higher elevation points. Given an array of n...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def rain_precond (heights : List (Int)) : Prop := -- !benchmark @start precond heights.all (fun h =>...
{ "name": "rain", "parameters": { "param_name": [ "heights" ], "param_type": [ "List (Int)" ] }, "return_type": "Int" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/trapping-rain-water/description/", "task_id": "lab_rain_327045007", "student_id": [ 46 ] } }
{ "input": [ "{\"heights\": \"[0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1]\"}", "{\"heights\": \"[4, 2, 0, 3, 2, 5]\"}", "{\"heights\": \"[1, 1, 1]\"}", "{\"heights\": \"[10, 5]\"}", "{\"heights\": \"[1, 10, 9, 11]\"}", "{\"heights\": \"[]\"}" ], "expected": [ [ "6" ], [ "9...
{ "input": [ "{'heights': '[-1]'}" ] }
advanced
verina_basic_11
-----Description----- This task requires writing a Lean 4 method that extracts the last digit of a given non-negative integer. The method should return the last digit, which is obtained by computing the remainder when the number is divided by 10. The result must always be between 0 and 9. -----Input----- The input...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def lastDigit_precond (n : Nat) : Prop := -- !benchmark @start precond True -- !benchmark @...
{ "name": "lastDigit", "parameters": { "param_name": [ "n" ], "param_type": [ "Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_435", "student_id": null } }
{ "input": [ "{\"n\": 123}", "{\"n\": 0}", "{\"n\": 987654321}", "{\"n\": 10}", "{\"n\": 999}", "{\"n\": 45}", "{\"n\": 100}", "{\"n\": 5}" ], "expected": [ [ "3" ], [ "0" ], [ "1" ], [ "0" ], [ "9" ], [ ...
{ "input": [] }
basic
verina_basic_33
-----Description----- This task requires writing a Lean 4 method that returns the smallest natural number missing from a given sorted list of natural numbers. In other words, starting from 0, the method should identify the first natural number that does not appear in the list. The input list is assumed to be sorted in...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def smallestMissingNumber_precond (s : List Nat) : Prop := -- !benchmark @start precond List....
{ "name": "smallestMissingNumber", "parameters": { "param_name": [ "s" ], "param_type": [ "List Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_627", "student_id": null } }
{ "input": [ "{\"s\": \"[0, 1, 2, 6, 9]\"}", "{\"s\": \"[4, 5, 10, 11]\"}", "{\"s\": \"[0, 1, 2, 3, 4, 5]\"}", "{\"s\": \"[]\"}", "{\"s\": \"[0, 2, 3, 4]\"}" ], "expected": [ [ "3" ], [ "0" ], [ "6" ], [ "0" ], [ "1" ] ], ...
{ "input": [ "{'s': '[3, 2, 1]'}" ] }
basic
verina_advanced_72
-----Description----- This task requires writing a Lean 4 method that given an natural number n, returns the smallest prime factor that is less than 10. If none exist, return 0 -----Input----- The input consists of one natural number: n: The main natural number. -----Output----- The output is an natural number: Retu...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def singleDigitPrimeFactor_precond (n : Nat) : Prop := -- !benchmark @start precond True -- ...
{ "name": "singleDigitPrimeFactor", "parameters": { "param_name": [ "n" ], "param_type": [ "Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "", "task_id": "lab_singleDigitPrimeFactor_324367187", "student_id": [ 16 ] } }
{ "input": [ "{\"n\": 0}", "{\"n\": 98}", "{\"n\": 9}", "{\"n\": 73}", "{\"n\": 529}", "{\"n\": 161}", "{\"n\": 0}" ], "expected": [ [ "0" ], [ "2" ], [ "3" ], [ "0" ], [ "0" ], [ "7" ], [ "0"...
{ "input": [] }
advanced
verina_basic_38
-----Description----- This task requires writing a Lean 4 method that checks whether all characters in an input string are identical. The method should return true if every character in the string is the same, and false if at least one character differs. An empty string or a single-character string is considered to h...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def allCharactersSame_precond (s : String) : Prop := -- !benchmark @start precond True -- !...
{ "name": "allCharactersSame", "parameters": { "param_name": [ "s" ], "param_type": [ "String" ] }, "return_type": "Bool" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_741", "student_id": null } }
{ "input": [ "{\"s\": \"aaa\"}", "{\"s\": \"aba\"}", "{\"s\": \"\"}", "{\"s\": \"a\"}", "{\"s\": \"bbbb\"}", "{\"s\": \"bbab\"}" ], "expected": [ [ "True" ], [ "False" ], [ "True" ], [ "True" ], [ "True" ], [ "...
{ "input": [] }
basic
verina_advanced_55
-----Description----- This task requires writing a Lean 4 method that returns the integer that appears most frequently in the input list. If multiple integers have the same maximum frequency, return the one that appears first in the original list. You should implement a frequency counter using a fold over the list, ext...
-- !benchmark @start import type=solution import Std.Data.HashMap open Std -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def mostFrequent_precond (xs : List Int) : Prop := -- !benchmark @star...
{ "name": "mostFrequent", "parameters": { "param_name": [ "xs" ], "param_type": [ "List Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/majority-element/", "task_id": "lab_mostFrequent_325752578", "student_id": [ 15 ] } }
{ "input": [ "{\"xs\": \"[1, 2, 2, 3]\"}", "{\"xs\": \"[4, 4, 5, 5, 4]\"}", "{\"xs\": \"[9]\"}", "{\"xs\": \"[1, 2, 3, 1, 2, 3, 2]\"}", "{\"xs\": \"[7, 7, 8, 8, 9, 9, 7]\"}" ], "expected": [ [ "2" ], [ "4" ], [ "9" ], [ "2" ], [ ...
{ "input": [ "{'xs': '[]'}" ] }
advanced
verina_basic_25
-----Description----- This task requires writing a Lean 4 method that calculates both the sum and the average of the first n natural numbers. The method should compute the sum of numbers from 0 to n (which equals n * (n + 1) / 2) and then determine the average by dividing this sum by n. The specification assumes that ...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def sumAndAverage_precond (n : Nat) : Prop := -- !benchmark @start precond n > 0 ∧ n < 900719...
{ "name": "sumAndAverage", "parameters": { "param_name": [ "n" ], "param_type": [ "Nat" ] }, "return_type": "Int × Float" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_599", "student_id": null } }
{ "input": [ "{\"n\": 5}", "{\"n\": 1}", "{\"n\": 10}", "{\"n\": 2}" ], "expected": [ [ "(15, 3.0)" ], [ "(1, 1.0)" ], [ "(55, 5.5)" ], [ "(3, 1.5)" ] ], "unexpected": [ [ "(14, 2.8)", "(16, 3.2)" ], [ "(0, 0...
{ "input": [ "{'n': 0}", "{'n': 9007199254740992}" ] }
basic
verina_advanced_17
-----Description----- This task requires implementing the insertion sort algorithm to sort a list of integers in ascending order. The function should take a list of integers as input and return a new list containing the same elements sorted in non-decreasing order. -----Input----- The input is: l: A list of integer...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def insertionSort_precond (l : List Int) : Prop := -- !benchmark @start precond True -- !benchmark...
{ "name": "insertionSort", "parameters": { "param_name": [ "l" ], "param_type": [ "List Int" ] }, "return_type": "List Int" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/insertion-sort-list/", "task_id": "lab_insertionSort_325670071", "student_id": [ 14 ] } }
{ "input": [ "{\"l\": \"[]\"}", "{\"l\": \"[5]\"}", "{\"l\": \"[1, 2, 3]\"}", "{\"l\": \"[3, 2, 1]\"}", "{\"l\": \"[4, 2, 2, 3]\"}" ], "expected": [ [ "[]" ], [ "[5]" ], [ "[1, 2, 3]" ], [ "[1, 2, 3]" ], [ "[2, 2, 3, 4]" ] ...
{ "input": [] }
advanced
verina_basic_43
-----Description----- This task requires writing a Lean 4 method that computes the sum of the fourth power of the first n odd natural numbers. In other words, given a non-negative integer n, the method should calculate the sum: 1⁴ + 3⁴ + 5⁴ + ... for the first n odd numbers. -----Input----- The input consists of: n: ...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def sumOfFourthPowerOfOddNumbers_precond (n : Nat) : Prop := -- !benchmark @start precond Tru...
{ "name": "sumOfFourthPowerOfOddNumbers", "parameters": { "param_name": [ "n" ], "param_type": [ "Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_770", "student_id": null } }
{ "input": [ "{\"n\": 0}", "{\"n\": 1}", "{\"n\": 2}", "{\"n\": 3}", "{\"n\": 4}", "{\"n\": 5}" ], "expected": [ [ "0" ], [ "1" ], [ "82" ], [ "707" ], [ "3108" ], [ "9669" ] ], "unexpected": [ [ ...
{ "input": [] }
basic
verina_basic_88
-----Description----- This task involves converting a list of integers into an array such that the array contains all the elements of the list in the exact same order. The objective is to ensure that the array has the same number of elements as the list and that each element in the array corresponds exactly to the el...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def ToArray_precond (xs : List Int) : Prop := -- !benchmark @start precond True -- !benchmar...
{ "name": "ToArray", "parameters": { "param_name": [ "xs" ], "param_type": [ "List Int" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_seq_to_array", "student_id": null } }
{ "input": [ "{\"xs\": \"[1, 2, 3]\"}", "{\"xs\": \"[]\"}", "{\"xs\": \"[0, -1, 5]\"}", "{\"xs\": \"[7]\"}", "{\"xs\": \"[100, 200, 300, 400]\"}" ], "expected": [ [ "#[1, 2, 3]" ], [ "#[]" ], [ "#[0, -1, 5]" ], [ "#[7]" ], [ "#[...
{ "input": [] }
basic
verina_advanced_53
-----Description----- This task requires writing a Lean 4 function that calculates the minimum number of right shifts required to sort a given list of distinct positive integers. A right shift operation on a list nums of length n moves the element at index i to index (i + 1) % n for all indices i. Effectively, the las...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def minimumRightShifts_precond (nums : List Int) : Prop := -- !benchmark @start precond List.N...
{ "name": "minimumRightShifts", "parameters": { "param_name": [ "nums" ], "param_type": [ "List Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "lab_assignment", "link": "", "task_id": "lab_minimumRightShifts_325696322", "student_id": [ 40 ] } }
{ "input": [ "{\"nums\": \"[3, 4, 5, 1, 2]\"}", "{\"nums\": \"[1, 3, 5]\"}", "{\"nums\": \"[2, 1, 4]\"}", "{\"nums\": \"[1]\"}", "{\"nums\": \"[2, 1]\"}", "{\"nums\": \"[1, 2, 3, 4, 5]\"}", "{\"nums\": \"[5, 1, 2, 3, 4]\"}", "{\"nums\": \"[1, 5, 2, 3, 4]\"}" ], "expected": [ [ ...
{ "input": [ "{'nums': '[1, 1]'}" ] }
advanced
verina_advanced_6
-----Description----- This task requires writing a Lean 4 method that determines whether a given string contains all 5 English vowels: a, e, i, o, u. The check is case-insensitive, meaning that both uppercase and lowercase vowels count. -----Input----- The input consists of a string: s: A string of alphabetic charac...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux def toLower (c : Char) : Char := if 'A' ≤ c && c ≤ 'Z' then Char.ofNat (Char.toNat c + 32) else c def normalize_str (s : String) : List Char := s.data.map toLower -- !benchmark @end solution_aux -- !b...
{ "name": "allVowels", "parameters": { "param_name": [ "s" ], "param_type": [ "String" ] }, "return_type": "Bool" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/check-if-the-sentence-is-prangram/", "task_id": "lab_allVowels_325657053", "student_id": [ 4 ] } }
{ "input": [ "{\"s\": \"education\"}", "{\"s\": \"education123\"}", "{\"s\": \"AEIOU\"}", "{\"s\": \"hello\"}", "{\"s\": \"\"}", "{\"s\": \"apple orange union\"}" ], "expected": [ [ "True" ], [ "True" ], [ "True" ], [ "False" ], [...
{ "input": [] }
advanced
verina_advanced_37
-----Description----- This task requires writing a Lean 4 method that returns the majority element from a list of integers. The majority element is the one that appears more than ⌊n / 2⌋ times in the list, where n is the list's length. You may assume that a majority element always exists in the input. -----Input-----...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def majorityElement_precond (nums : List Int) : Prop := -- !benchmark @start precond nums.leng...
{ "name": "majorityElement", "parameters": { "param_name": [ "nums" ], "param_type": [ "List Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "lab_assignment", "link": "[{\"text_file_id\"=>805208302}]", "task_id": "lab_majorityElement_325759376", "student_id": [ 30 ] } }
{ "input": [ "{\"nums\": \"[3, 2, 3]\"}", "{\"nums\": \"[2, 2, 1, 1, 1, 2, 2]\"}", "{\"nums\": \"[1]\"}", "{\"nums\": \"[4, 4, 4, 4, 4, 2, 2, 3, 3]\"}", "{\"nums\": \"[9, 8, 9, 9, 7, 9, 6, 9, 9]\"}", "{\"nums\": \"[0, 0, 0, 0, 1]\"}", "{\"nums\": \"[100000, 100000, 100000, 100000, -100000]...
{ "input": [ "{'nums': '[]'}", "{'nums': '[1, 2, 3, 4, 5]'}", "{'nums': '[1, 2, 1, 2]'}", "{'nums': '[1, 2, 3]'}" ] }
advanced
verina_basic_94
-----Description----- This task involves taking an array as input and producing a new array that has the same size and identical elements in the same order as the input. -----Input----- The input consists of: • s: An array of elements (for testing purposes, assume an array of integers, i.e., Array Int). -----Output--...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def iter_copy_precond (s : Array Int) : Prop := -- !benchmark @start precond True -- !benchm...
{ "name": "iter_copy", "parameters": { "param_name": [ "s" ], "param_type": [ "Array Int" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_array_copy", "student_id": null } }
{ "input": [ "{\"s\": \"#[1, 2, 3]\"}", "{\"s\": \"#[10, 20, 30, 40]\"}", "{\"s\": \"#[]\"}", "{\"s\": \"#[-1, -2, -3]\"}", "{\"s\": \"#[5, 5, 5, 5]\"}" ], "expected": [ [ "#[1, 2, 3]" ], [ "#[10, 20, 30, 40]" ], [ "#[]" ], [ "#[-1, -2, -3]" ...
{ "input": [] }
basic
verina_advanced_50
-----Description----- This task involves merging two sorted arrays of natural numbers (it is ill defined if inputs aren't sorted.) -----Input----- The input consists of two arrays: a1: A sorted array of natural numbers a2: A sorted array of natural numbers -----Output----- The output is an array: Returns a new array wi...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def mergeSorted_precond (a1 : Array Nat) (a2 : Array Nat) : Prop := -- !benchmark @start precond Lis...
{ "name": "mergeSorted", "parameters": { "param_name": [ "a1", "a2" ], "param_type": [ "Array Nat", "Array Nat" ] }, "return_type": "Array Nat" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/merge-sorted-array/description/", "task_id": "lab_mergeSorted_325695851", "student_id": [ 39 ] } }
{ "input": [ "{\"a1\": \"#[1, 3, 5]\", \"a2\": \"#[2, 4, 6]\"}", "{\"a1\": \"#[]\", \"a2\": \"#[1, 2, 3]\"}", "{\"a1\": \"#[1, 2, 3]\", \"a2\": \"#[]\"}", "{\"a1\": \"#[]\", \"a2\": \"#[]\"}", "{\"a1\": \"#[1, 1, 2]\", \"a2\": \"#[1, 2, 2]\"}", "{\"a1\": \"#[10, 20, 30]\", \"a2\": \"#[5, 15, 2...
{ "input": [ "{'a1': '#[3, 2, 1]', 'a2': '#[6, 5, 4]'}" ] }
advanced
verina_basic_16
-----Description----- This task requires writing a Lean 4 method that replaces every occurrence of a specified character within a string with a new character. The output should be a new string that maintains the same length as the input string, with all instances of the designated character replaced by the given subst...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def replaceChars_precond (s : String) (oldChar : Char) (newChar : Char) : Prop := -- !benchmark...
{ "name": "replaceChars", "parameters": { "param_name": [ "s", "oldChar", "newChar" ], "param_type": [ "String", "Char", "Char" ] }, "return_type": "String" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_474", "student_id": null } }
{ "input": [ "{\"s\": \"hello, world!\", \"oldChar\": \",\", \"newChar\": \";\"}", "{\"s\": \"a,b.c\", \"oldChar\": \",\", \"newChar\": \":\"}", "{\"s\": \"hello, world!\", \"oldChar\": \"o\", \"newChar\": \"O\"}", "{\"s\": \"\", \"oldChar\": \"x\", \"newChar\": \"y\"}", "{\"s\": \"test\", \"oldCh...
{ "input": [] }
basic
verina_basic_102
-----Description----- This task involves identifying the first occurrence of a pair of indices in an array of integers such that the sum of the corresponding elements equals the given target value. The focus is on determining the earliest valid pair (i, j), with 0 ≤ i < j < nums.size, where the sum of the two numbers e...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def twoSum_precond (nums : Array Int) (target : Int) : Prop := -- !benchmark @start precond nu...
{ "name": "twoSum", "parameters": { "param_name": [ "nums", "target" ], "param_type": [ "Array Int", "Int" ] }, "return_type": "(Nat × Nat)" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_two_sum", "student_id": null } }
{ "input": [ "{\"nums\": \"#[2, 7, 11, 15]\", \"target\": 9}", "{\"nums\": \"#[3, 2, 4]\", \"target\": 6}", "{\"nums\": \"#[-1, 0, 1, 2]\", \"target\": 1}", "{\"nums\": \"#[5, 75, 25]\", \"target\": 100}", "{\"nums\": \"#[1, 2, 3, 4, 5]\", \"target\": 9}", "{\"nums\": \"#[1, 5, 3, 5]\", \"targ...
{ "input": [ "{'nums': '#[1]', 'target': 11}" ] }
basic
verina_advanced_25
-----Description----- This task requires implementing a Lean 4 method that finds the length of the longest strictly increasing subsequence in an array of integers. A subsequence is a sequence that can be derived from an array by deleting some or no elements without changing the order of the remaining elements. -----I...
-- !benchmark @start import type=solution import Mathlib.Data.List.Basic -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def lengthOfLIS_precond (nums : List Int) : Prop := -- !benchmark @start...
{ "name": "lengthOfLIS", "parameters": { "param_name": [ "nums" ], "param_type": [ "List Int" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/longest-increasing-subsequence/description/", "task_id": "lab_lengthOfLIS_325743927", "student_id": [ 19 ] } }
{ "input": [ "{\"nums\": \"[10, 9, 2, 5, 3, 7, 101, 18]\"}", "{\"nums\": \"[0, 1, 0, 3, 2, 3]\"}", "{\"nums\": \"[7, 7, 7, 7, 7, 7, 7]\"}", "{\"nums\": \"[]\"}", "{\"nums\": \"[4, 10, 4, 3, 8, 9]\"}", "{\"nums\": \"[1, 3, 6, 7, 9, 4, 10, 5, 6]\"}", "{\"nums\": \"[10, 22, 9, 33, 21, 50, 41,...
{ "input": [] }
advanced
verina_basic_9
-----Description----- This task requires writing a Lean 4 method that checks whether two arrays of integers have any elements in common. In other words, the method should return true if there is at least one element that appears in both arrays, and false if no such element exists. -----Input----- The input consists o...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def hasCommonElement_precond (a : Array Int) (b : Array Int) : Prop := -- !benchmark @start pre...
{ "name": "hasCommonElement", "parameters": { "param_name": [ "a", "b" ], "param_type": [ "Array Int", "Array Int" ] }, "return_type": "Bool" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_431", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 2, 3]\", \"b\": \"#[4, 5, 6]\"}", "{\"a\": \"#[1, 2, 3]\", \"b\": \"#[3, 4, 5]\"}", "{\"a\": \"#[7, 8, 9]\", \"b\": \"#[10, 11, 7]\"}", "{\"a\": \"#[1, 2, 3, 4]\", \"b\": \"#[5, 6, 7, 8]\"}", "{\"a\": \"#[1, 2, 3, 4]\", \"b\": \"#[4, 5, 6]\"}", "{\"a\": \"#[1, 1, 1...
{ "input": [ "{'a': '#[]', 'b': '#[]'}" ] }
basic