Dataset Viewer
Auto-converted to Parquet Duplicate
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
End of preview. Expand in Data Studio

Verina: Benchmarking Verifiable Code Generation

Check out GitHub for more information.

Downloads last month
566