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_basic_53
-----Description----- This problem asks for a method to determine the sum of the first N natural numbers. The task focuses on computing the total when given an input N, ensuring that the value is 0 when N is 0 and correctly calculated for positive values of N. -----Input----- The input consists of: • N: A natural numb...
-- !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 CalSum_precond (N : Nat) : Prop := -- !benchmark @start precond True -- !benchmark @end ...
{ "name": "CalSum", "parameters": { "param_name": [ "N" ], "param_type": [ "Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_cal_sum", "student_id": null } }
{ "input": [ "{\"N\": 0}", "{\"N\": 1}", "{\"N\": 5}", "{\"N\": 10}", "{\"N\": 20}" ], "expected": [ [ "0" ], [ "1" ], [ "15" ], [ "55" ], [ "210" ] ], "unexpected": [ [ "1", "2", "3" ], [ ...
{ "input": [] }
basic
verina_advanced_9
-----Description----- This task requires writing a Lean 4 method of which given a number n and divisor d, it counts all the number that is smaller than n whose sum of digits is divisible by d. -----Input----- The input consists of three Nat: n: Nat d:Nat where d > 0 -----Output----- The output is an Natural number: ...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux def sumOfDigits (x : Nat) : Nat := let rec go (n acc : Nat) : Nat := if n = 0 then acc else go (n / 10) (acc + (n % 10)) go x 0 -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !bench...
{ "name": "countSumDivisibleBy", "parameters": { "param_name": [ "n", "d" ], "param_type": [ "Nat", "Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "this is a leetcode style problem but not a specifc one. similar to this: https://leetcode.com/problems/count-the-digits-that-divide-a-number/description/", "task_id": "lab_countSumDivisibleBy_325011347", "student_id": [ 7 ] } }
{ "input": [ "{\"n\": 0, \"d\": 2}", "{\"n\": 1, \"d\": 2}", "{\"n\": 10, \"d\": 3}", "{\"n\": 12, \"d\": 2}", "{\"n\": 20, \"d\": 5}" ], "expected": [ [ "0" ], [ "1" ], [ "4" ], [ "6" ], [ "4" ] ], "unexpected": [ [...
{ "input": [ "{'n': 1, 'd': 0}" ] }
advanced
verina_advanced_34
-----Description----- This task requires writing a Lean 4 method that finds the length of the longest strictly increasing subsequence from a given list of integers. -----Input----- The input consists of a list of integers called nums -----Output----- The output is an integer: Returns a number representing the lengt...
-- !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 longestIncreasingSubsequence_precond (nums : List Int) : Prop := -- ...
{ "name": "longestIncreasingSubsequence", "parameters": { "param_name": [ "nums" ], "param_type": [ "List Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/longest-increasing-subsequence/description/", "task_id": "lab_longestIncreasingSubsequence_325773003", "student_id": [ 28 ] } }
{ "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\": \"[1, 3, 2, 4]\"}", "{\"nums\": \"[10]\"}" ], "expected": [ [ "4" ], [ "4" ], [ "1" ], [ "...
{ "input": [] }
advanced
verina_advanced_13
-----Description----- This task requires writing a Lean 4 method that determines whether there are any intersections between chords on a circle. The method should return true if at least one pair of chords intersects, and false otherwise. A chord is defined as a line segment connecting two distinct points on a circle....
-- !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 hasChordIntersection_precond (N : Nat) (chords : List (List Nat)) : Prop := -- !benchmark @start p...
{ "name": "hasChordIntersection", "parameters": { "param_name": [ "N", "chords" ], "param_type": [ "Nat", "List (List Nat)" ] }, "return_type": "Bool" }
{ "upstream": { "name": "lab_assignment", "link": "https://huggingface.co/spaces/livecodebench/code_generation_samples", "task_id": "lab_hasChordIntersection_325324847", "student_id": [ 11 ] } }
{ "input": [ "{\"N\": 3, \"chords\": \"[[1, 3], [4, 2], [5, 6]]\"}", "{\"N\": 3, \"chords\": \"[[6, 1], [4, 3], [2, 5]]\"}", "{\"N\": 4, \"chords\": \"[[2, 4], [3, 7], [8, 6], [5, 1]]\"}", "{\"N\": 2, \"chords\": \"[[1, 2], [3, 4]]\"}" ], "expected": [ [ "True" ], [ "False"...
{ "input": [ "{'N': 3, 'chords': '[[1, 1]]'}", "{'N': 3, 'chords': '[[7, 1]]'}", "{'N': 3, 'chords': '[[0, 1]]'}", "{'N': 3, 'chords': '[[1, 0]]'}", "{'N': 3, 'chords': '[[1, 7]]'}", "{'N': 0, 'chords': '[]'}" ] }
advanced
verina_basic_92
-----Description----- This problem involves swapping the values of two integers. Given two integers as inputs, the objective is to return the two numbers in reversed order. -----Input----- The input consists of two integers: • X: The first integer. • Y: The second integer. -----Output----- The output is a 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 SwapArithmetic_precond (X : Int) (Y : Int) : Prop := -- !benchmark @start precond True -...
{ "name": "SwapArithmetic", "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_swap_arith", "student_id": null } }
{ "input": [ "{\"X\": 3, \"Y\": 4}", "{\"X\": -1, \"Y\": 10}", "{\"X\": 0, \"Y\": 0}", "{\"X\": 100, \"Y\": 50}", "{\"X\": -5, \"Y\": -10}" ], "expected": [ [ "(4, 3)" ], [ "(10, -1)" ], [ "(0, 0)" ], [ "(50, 100)" ], [ "(-10, -...
{ "input": [] }
basic
verina_basic_45
-----Description----- This task requires writing a Lean 4 method that computes the product of the first even and the first odd number encountered in a list of integers. The method should search the list for the earliest even number and the earliest odd number, then return the product of these two numbers. -----Input...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux def isEven (n : Int) : Bool := n % 2 = 0 def isOdd (n : Int) : Bool := n % 2 ≠ 0 def firstEvenOddIndices (lst : List Int) : Option (Nat × Nat) := let evenIndex := lst.findIdx? isEven let oddIndex := lst.fin...
{ "name": "findProduct", "parameters": { "param_name": [ "lst" ], "param_type": [ "List Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_784", "student_id": null } }
{ "input": [ "{\"lst\": \"[2, 3, 4, 5]\"}", "{\"lst\": \"[2, 4, 3, 6]\"}", "{\"lst\": \"[1, 2, 5, 4]\"}" ], "expected": [ [ "6" ], [ "6" ], [ "2" ] ], "unexpected": [ [ "8", "0", "10" ], [ "8", "0", "24" ...
{ "input": [ "{'lst': '[2]'}" ] }
basic
verina_advanced_51
-----Description----- This task requires writing a Lean 4 method that takes two sorted (non-decreasing) integer lists and merges them into a single sorted list. The output must preserve order and include all elements from both input lists. -----Input----- The input consists of: a: A list of integers sorted in non-decr...
-- !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 mergeSorted_precond (a : List Int) (b : List Int) : Prop := -- !benchmark @start precond L...
{ "name": "mergeSorted", "parameters": { "param_name": [ "a", "b" ], "param_type": [ "List Int", "List Int" ] }, "return_type": "List Int" }
{ "upstream": { "name": "lab_assignment", "link": "", "task_id": "lab_mergeSorted_325769371", "student_id": [ 15 ] } }
{ "input": [ "{\"a\": \"[1, 3, 5]\", \"b\": \"[2, 4, 6]\"}", "{\"a\": \"[1, 2]\", \"b\": \"[1, 2, 3]\"}", "{\"a\": \"[]\", \"b\": \"[4, 5]\"}", "{\"a\": \"[0, 3, 4]\", \"b\": \"[]\"}", "{\"a\": \"[1, 4, 6]\", \"b\": \"[2, 3, 5]\"}" ], "expected": [ [ "[1, 2, 3, 4, 5, 6]" ], [...
{ "input": [ "{'a': '[1, 2, 3]', 'b': '[6, 5, 4]'}", "{'a': '[3, 2, 1]', 'b': '[6, 5, 4]'}" ] }
advanced
verina_advanced_40
-----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] def maxOfList_precond (lst : List Nat) : Prop := -- !benchmark @start precond lst ≠ [] -- Ensure th...
{ "name": "maxOfList", "parameters": { "param_name": [ "lst" ], "param_type": [ "List Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "Original", "task_id": "lab_maxOfList_325098964", "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_5
-----Description----- This task requires writing a Lean 4 method that multiplies two integers. The method should return the product of the two input numbers. -----Input----- The input consists of: a: The first integer. b: The second integer. -----Output----- The output is an integer: Returns the product of the two 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 multiply_precond (a : Int) (b : Int) : Prop := -- !benchmark @start precond True -- !be...
{ "name": "multiply", "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_127", "student_id": null } }
{ "input": [ "{\"a\": 3, \"b\": 4}", "{\"a\": 3, \"b\": -4}", "{\"a\": -3, \"b\": 4}", "{\"a\": -3, \"b\": -4}", "{\"a\": 0, \"b\": 5}", "{\"a\": 5, \"b\": 0}", "{\"a\": 0, \"b\": 0}" ], "expected": [ [ "12" ], [ "-12" ], [ "-12" ], [ ...
{ "input": [] }
basic
verina_basic_85
-----Description----- This problem focuses on reversing an array of integers. The goal is to take an input array and produce a new array with the elements arranged in the reverse order. -----Input----- The input consists of: • a: An array of integers, which may be empty, contain one element, or many elements. ...
-- !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 reverse_precond (a : Array Int) : Prop := -- !benchmark @start precond True -- !benchmar...
{ "name": "reverse", "parameters": { "param_name": [ "a" ], "param_type": [ "Array Int" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_reverse", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 2, 3, 4, 5]\"}", "{\"a\": \"#[10, 20, 30, 40]\"}", "{\"a\": \"#[]\"}", "{\"a\": \"#[7]\"}", "{\"a\": \"#[-1, 0, 1]\"}" ], "expected": [ [ "#[5, 4, 3, 2, 1]" ], [ "#[40, 30, 20, 10]" ], [ "#[]" ], [ "#[7]" ], ...
{ "input": [] }
basic
verina_basic_17
-----Description----- This task requires writing a Lean 4 method that converts all uppercase characters in a given string to their lowercase equivalents while keeping the other characters unchanged. The output string must have the same length as the input string. -----Input----- The input consists of: s: A string tha...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux def isUpperCase (c : Char) : Bool := 'A' ≤ c ∧ c ≤ 'Z' def shift32 (c : Char) : Char := Char.ofNat (c.toNat + 32) -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux...
{ "name": "toLowercase", "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_477", "student_id": null } }
{ "input": [ "{\"s\": \"Hello, World!\"}", "{\"s\": \"ABC\"}", "{\"s\": \"abc\"}", "{\"s\": \"\"}", "{\"s\": \"1234!@\"}", "{\"s\": \"MixedCASE123\"}" ], "expected": [ [ "hello, world!" ], [ "abc" ], [ "abc" ], [ "" ], [ "12...
{ "input": [] }
basic
verina_advanced_36
-----Description----- This task requires writing a Lean 4 method that finds the majority element in a list of natural numbers. The majority element is defined as the element that appears more than ⌊n / 2⌋ times in the list, where n is the total number of elements. You may assume that the input list always contains a m...
-- !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 majorityElement_precond (xs : List Nat) : Prop := -- !benchmark @start precond xs.length > 0 ∧ x...
{ "name": "majorityElement", "parameters": { "param_name": [ "xs" ], "param_type": [ "List Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/majority-element/description/", "task_id": "lab_majorityElement_325005413", "student_id": [ 29 ] } }
{ "input": [ "{\"xs\": \"[3, 3, 4, 2, 3, 3, 3]\"}", "{\"xs\": \"[1, 1, 2, 1, 3, 1, 1]\"}", "{\"xs\": \"[2, 2, 2, 1, 1]\"}", "{\"xs\": \"[9, 9, 9, 9, 1, 2, 3]\"}", "{\"xs\": \"[5, 5, 5, 5, 5, 6, 7]\"}" ], "expected": [ [ "3" ], [ "1" ], [ "2" ], [ ...
{ "input": [ "{'xs': '[1, 2, 3]'}", "{'xs': '[]'}" ] }
advanced
verina_basic_73
-----Description----- Determine whether two strings match based on a specific pattern: for each position in the strings, either the characters are the same, or the character in p is a wildcard represented by a question mark '?' that may match any character. -----Input----- The input consists of: • s: A string 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 Match_precond (s : String) (p : String) : Prop := -- !benchmark @start precond s.toList.le...
{ "name": "Match", "parameters": { "param_name": [ "s", "p" ], "param_type": [ "String", "String" ] }, "return_type": "Bool" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_match", "student_id": null } }
{ "input": [ "{\"s\": \"abc\", \"p\": \"a?c\"}", "{\"s\": \"hello\", \"p\": \"he?lo\"}", "{\"s\": \"world\", \"p\": \"w?rld\"}", "{\"s\": \"test\", \"p\": \"te?t\"}", "{\"s\": \"abc\", \"p\": \"abd\"}" ], "expected": [ [ "True" ], [ "True" ], [ "True" ...
{ "input": [ "{'s': 'abc', 'p': 'ac'}" ] }
basic
verina_basic_61
-----Description----- This task involves determining whether every character in a provided string is a digit. The objective is to check if all characters fall within the standard digit range, returning true if they do and false otherwise. -----Input----- The input consists of: • s: A string whose characters will...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux def isDigit (c : Char) : Bool := (c ≥ '0') && (c ≤ '9') -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def allDigits_precond (s : String) : Prop...
{ "name": "allDigits", "parameters": { "param_name": [ "s" ], "param_type": [ "String" ] }, "return_type": "Bool" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_all_digits", "student_id": null } }
{ "input": [ "{\"s\": \"123456\"}", "{\"s\": \"123a56\"}", "{\"s\": \"\"}", "{\"s\": \"007\"}", "{\"s\": \"98 76\"}" ], "expected": [ [ "True" ], [ "False" ], [ "True" ], [ "True" ], [ "False" ] ], "unexpected": [ [ ...
{ "input": [] }
basic
verina_basic_20
-----Description----- This task requires writing a Lean 4 method that calculates the product of all distinct integers in an array. The method should consider each unique integer only once when computing the product and return the resulting value. If the array is empty, the method should return 1. -----Input----- The ...
-- !benchmark @start import type=solution import Std.Data.HashSet -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def uniqueProduct_precond (arr : Array Int) : Prop := -- !benchmark @sta...
{ "name": "uniqueProduct", "parameters": { "param_name": [ "arr" ], "param_type": [ "Array Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_573", "student_id": null } }
{ "input": [ "{\"arr\": \"#[2, 3, 2, 4]\"}", "{\"arr\": \"#[5, 5, 5, 5]\"}", "{\"arr\": \"#[]\"}", "{\"arr\": \"#[1, 2, 3]\"}", "{\"arr\": \"#[0, 2, 3]\"}", "{\"arr\": \"#[-1, -2, -1, -3]\"}", "{\"arr\": \"#[10, 10, 20, 20, 30]\"}" ], "expected": [ [ "24" ], [ "...
{ "input": [] }
basic
verina_basic_4
-----Description----- This task requires writing a Lean 4 method that finds the kth element in a given array using 1-based indexing. The method should return the element at the specified position, where the first element is at position 1. -----Input----- The input consists of: arr: An array of integers. k: An 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, simp] def kthElement_precond (arr : Array Int) (k : Nat) : Prop := -- !benchmark @start precond k ≥...
{ "name": "kthElement", "parameters": { "param_name": [ "arr", "k" ], "param_type": [ "Array Int", "Nat" ] }, "return_type": "Int" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_101", "student_id": null } }
{ "input": [ "{\"arr\": \"#[10, 20, 30, 40, 50]\", \"k\": 1}", "{\"arr\": \"#[10, 20, 30, 40, 50]\", \"k\": 3}", "{\"arr\": \"#[10, 20, 30, 40, 50]\", \"k\": 5}", "{\"arr\": \"#[5]\", \"k\": 1}", "{\"arr\": \"#[1, 2, 3]\", \"k\": 3}", "{\"arr\": \"#[1, 2, 3]\", \"k\": 2}", "{\"arr\": \"#[9...
{ "input": [ "{'arr': '#[1, 2, 3]', 'k': 0}" ] }
basic
verina_advanced_48
-----Description----- This task requires implementing the merge sort algorithm in Lean 4 to sort a list of integers in ascending order. Merge sort is a divide-and-conquer algorithm that recursively splits the input list into two halves, sorts them separately, and then merges the sorted halves to produce the final sort...
-- !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 mergeSort_precond (list : List Int) : Prop := -- !benchmark @start precond True -- !benc...
{ "name": "mergeSort", "parameters": { "param_name": [ "list" ], "param_type": [ "List Int" ] }, "return_type": "List Int" }
{ "upstream": { "name": "lab_assignment", "link": "[{\"text_file_id\"=>805010081}]", "task_id": "lab_mergeSort_325707390", "student_id": [ 38 ] } }
{ "input": [ "{\"list\": \"[5, 2, 9, 1, 5, 6]\"}", "{\"list\": \"[3, 1, 4, 1, 5, 9, 2, 6]\"}", "{\"list\": \"[]\"}", "{\"list\": \"[1]\"}", "{\"list\": \"[5, 5, 5, 5]\"}", "{\"list\": \"[9, 8, 7, 6, 5, 4, 3, 2, 1]\"}", "{\"list\": \"[1, 2, 3, 4, 5]\"}", "{\"list\": \"[-3, -1, -5, -2]\"...
{ "input": [] }
advanced
verina_basic_90
-----Description----- The task is to search for a specific integer in a 2D array where the rows and columns are sorted in non-decreasing order. The goal is to locate the key and return its position as row and column indices, or return (-1, -1) if the algorithm fails to find the key. -----Input----- The input consist...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux @[reducible, simp] def get2d (a : Array (Array Int)) (i j : Int) : Int := (a[Int.toNat i]!)[Int.toNat j]! -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducibl...
{ "name": "SlopeSearch", "parameters": { "param_name": [ "a", "key" ], "param_type": [ "Array (Array Int)", "Int" ] }, "return_type": "(Int × Int)" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_slope_search", "student_id": null } }
{ "input": [ "{\"a\": \"#[#[1, 2, 3], #[4, 5, 6], #[7, 8, 9]]\", \"key\": 5}", "{\"a\": \"#[#[1, 2, 3], #[4, 5, 6], #[7, 8, 9]]\", \"key\": 3}", "{\"a\": \"#[#[1, 2, 3], #[4, 5, 6], #[7, 8, 9]]\", \"key\": 10}", "{\"a\": \"#[#[1, 2, 3, 4]]\", \"key\": 4}", "{\"a\": \"#[#[1], #[2], #[3], #[4]]\", \...
{ "input": [ "{'a': '#[#[1, 3, 2], #[0, 6, 5], #[7, 8, 9]]', 'key': 2}", "{'a': '#[]', 'key': 5}", "{'a': '#[#[]]', 'key': 5}", "{'a': '#[#[], #[]]', 'key': 5}" ] }
basic
verina_basic_104
-----Description----- This problem involves combining two maps by creating a new map that includes every key from both inputs. When a key is found in both maps, the value from the second map is used in the result. -----Input----- The input consists of: • m1: A Map (represented as a list of key-value pairs) where...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start task_aux structure Map (K V : Type) [BEq K] [BEq V] where entries : List (K × V) deriving Inhabited instance (K V : Type) [BEq K] [BEq V] : BEq (Map K V) where beq m1 m2 := List.length m1.entries = List.length m2.entries ∧ ...
{ "name": "update_map", "parameters": { "param_name": [ "m1", "m2" ], "param_type": [ "Map Int Int", "Map Int Int" ] }, "return_type": "Map Int Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_update_map", "student_id": null } }
{ "input": [ "{\"m1\": \"\\u27e8[(1, 10), (2, 20)]\\u27e9\", \"m2\": \"\\u27e8[(2, 30), (3, 40)]\\u27e9\"}", "{\"m1\": \"\\u27e8[(1, 100)]\\u27e9\", \"m2\": \"\\u27e8[(1, 200)]\\u27e9\"}", "{\"m1\": \"\\u27e8[(5, 50), (6, 60)]\\u27e9\", \"m2\": \"\\u27e8[]\\u27e9\"}", "{\"m1\": \"\\u27e8[]\\u27e9\", \...
{ "input": [] }
basic
verina_basic_58
-----Description----- This task involves transforming an array of integers by doubling each element. -----Input----- The input consists of: • s: An array of integers. -----Output----- The output is an array of integers where for each valid index i, the element at position i is equal to twice the corresponding...
-- !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 double_array_elements_precond (s : Array Int) : Prop := -- !benchmark @start precond True ...
{ "name": "double_array_elements", "parameters": { "param_name": [ "s" ], "param_type": [ "Array Int" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_double_array_elements", "student_id": null } }
{ "input": [ "{\"s\": \"#[]\"}", "{\"s\": \"#[1, 2, 3, 4, 5]\"}", "{\"s\": \"#[0, -1, 5]\"}", "{\"s\": \"#[100]\"}", "{\"s\": \"#[-3, -4]\"}" ], "expected": [ [ "#[]" ], [ "#[2, 4, 6, 8, 10]" ], [ "#[0, -2, 10]" ], [ "#[200]" ], [ ...
{ "input": [] }
basic
verina_advanced_57
-----Description----- This task requires writing a Lean 4 function that finds the next greater element for a given array of numbers. The next greater element for an element x is defined as the first element greater than x that appears to the right of x in the array. Given two distinct 0-indexed integer arrays `nums1`...
-- !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 nextGreaterElement_precond (nums1 : List Int) (nums2 : List Int) : Prop := -- !benchmark @start pr...
{ "name": "nextGreaterElement", "parameters": { "param_name": [ "nums1", "nums2" ], "param_type": [ "List Int", "List Int" ] }, "return_type": "List Int" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/spiral-matrix-ii/", "task_id": "lab_nextGreaterElement_324720188", "student_id": [ 42 ] } }
{ "input": [ "{\"nums1\": \"[4, 1, 2]\", \"nums2\": \"[1, 3, 4, 2]\"}", "{\"nums1\": \"[2, 4]\", \"nums2\": \"[1, 2, 3, 4]\"}", "{\"nums1\": \"[1]\", \"nums2\": \"[1, 2]\"}", "{\"nums1\": \"[5]\", \"nums2\": \"[5, 4, 3, 2, 1]\"}", "{\"nums1\": \"[1, 3, 5, 2, 4]\", \"nums2\": \"[6, 5, 4, 3, 2, 1]\"...
{ "input": [ "{'nums1': '[1, 3]', 'nums2': '[1, 2]'}", "{'nums1': '[1, 1]', 'nums2': '[1, 2]'}" ] }
advanced
verina_basic_47
-----Description----- This task requires writing a Lean 4 method that calculates the sum of all the elements in an array of integers. The method should process the entire array and return the total sum of its elements. -----Input----- The input consists of: a: An array of integers. -----Output----- The output is 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 arraySum_precond (a : Array Int) : Prop := -- !benchmark @start precond a.size > 0 -- !...
{ "name": "arraySum", "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_798", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 2, 3, 4, 5]\"}", "{\"a\": \"#[13, 14, 15, 16, 17]\"}", "{\"a\": \"#[-1, -2, -3]\"}", "{\"a\": \"#[10, -10]\"}" ], "expected": [ [ "15" ], [ "75" ], [ "-6" ], [ "0" ] ], "unexpected": [ [ "14", ...
{ "input": [ "{'a': '#[]'}" ] }
basic
verina_basic_75
-----Description----- This task involves finding the minimum element in a non-empty array of integers. The goal is to identify and return the smallest number present in the array. -----Input----- The input consists of: • a: An array of integers (the array is assumed to be non-empty). -----Output----- The outp...
-- !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 minArray_precond (a : Array Int) : Prop := -- !benchmark @start precond a.size > 0 -- !b...
{ "name": "minArray", "parameters": { "param_name": [ "a" ], "param_type": [ "Array Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_min_array", "student_id": null } }
{ "input": [ "{\"a\": \"#[5, 3, 8, 2, 7]\"}", "{\"a\": \"#[10, 10, 10]\"}", "{\"a\": \"#[-1, -5, 3, 0]\"}", "{\"a\": \"#[42]\"}", "{\"a\": \"#[3, -2, 0, -2, 5]\"}" ], "expected": [ [ "2" ], [ "10" ], [ "-5" ], [ "42" ], [ "-2" ...
{ "input": [ "{'a': '#[]'}" ] }
basic
verina_basic_108
-----Description----- The problem is about processing a sequence of integer operations to determine cumulative results and identify potential negative outcomes. Given a list of integers, the task is to generate an array where the first element is 0 and each subsequent element is the cumulative sum of the operations per...
-- !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 below_zero_precond (operations : List Int) : Prop := -- !benchmark @start precond True -...
{ "name": "below_zero", "parameters": { "param_name": [ "operations" ], "param_type": [ "List Int" ] }, "return_type": "(Array Int × Bool)" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_below_zero", "student_id": null } }
{ "input": [ "{\"operations\": \"[1, 2, 3]\"}", "{\"operations\": \"[-1, 2, -1]\"}", "{\"operations\": \"[]\"}", "{\"operations\": \"[0, 0, 0]\"}", "{\"operations\": \"[10, -20, 5]\"}" ], "expected": [ [ "(#[0, 1, 3, 6], false)" ], [ "(#[0, -1, 1, 0], true)" ], ...
{ "input": [] }
basic
verina_basic_37
-----Description----- This task requires writing a Lean 4 method that locates the first occurrence of a specified integer within a sorted array of integers. The method returns the index corresponding to the first time the target value appears in the array; if the target is absent, it returns -1. It is also essential ...
-- !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 findFirstOccurrence_precond (arr : Array Int) (target : Int) : Prop := -- !benchmark @start...
{ "name": "findFirstOccurrence", "parameters": { "param_name": [ "arr", "target" ], "param_type": [ "Array Int", "Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_733", "student_id": null } }
{ "input": [ "{\"arr\": \"#[1, 2, 2, 3, 4, 5]\", \"target\": 2}", "{\"arr\": \"#[1, 2, 2, 3, 4, 5]\", \"target\": 6}", "{\"arr\": \"#[1, 2, 3, 4, 5]\", \"target\": 1}", "{\"arr\": \"#[1, 2, 3, 4, 5]\", \"target\": 5}", "{\"arr\": \"#[1, 2, 3, 4, 5]\", \"target\": 0}" ], "expected": [ [ ...
{ "input": [ "{'arr': '#[3, 2, 1]', 'target': 2}" ] }
basic
verina_basic_98
-----Description----- This task involves computing three times a given integer. Given an integer, the goal is to produce a value that is exactly three times its value. -----Input----- The input consists of a single integer: x: An integer. -----Output----- The output is an integer: Returns the product of the input 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, simp] def Triple_precond (x : Int) : Prop := -- !benchmark @start precond True -- !benchmark @end ...
{ "name": "Triple", "parameters": { "param_name": [ "x" ], "param_type": [ "Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_triple", "student_id": null } }
{ "input": [ "{\"x\": 0}", "{\"x\": 2}", "{\"x\": -4}", "{\"x\": 10}", "{\"x\": -1}" ], "expected": [ [ "0" ], [ "6" ], [ "-12" ], [ "30" ], [ "-3" ] ], "unexpected": [ [ "-1", "1", "2" ], [...
{ "input": [] }
basic
verina_advanced_46
-----Description----- This test implements a function in Lean 4 that finds the maximum sum of any contiguous subarray within a list of integers. A subarray is a continuous section of the original array. If all integers in the list are negative, the function should return 0 (representing the empty subarray). -----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 maxSubarraySum_precond (numbers : List Int) : Prop := -- !benchmark @start precond True ...
{ "name": "maxSubarraySum", "parameters": { "param_name": [ "numbers" ], "param_type": [ "List Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "lab_assignment", "link": "", "task_id": "lab_maxSubarraySum_324969521", "student_id": [ 26 ] } }
{ "input": [ "{\"numbers\": \"[1, 2, 3, -2, 5]\"}", "{\"numbers\": \"[-2, -3, 4, -1, -2, 1, 5, -3]\"}", "{\"numbers\": \"[-1, -2, -3, -4]\"}", "{\"numbers\": \"[5, -3, 2, 1, -2]\"}", "{\"numbers\": \"[0, 0, 0, 0]\"}", "{\"numbers\": \"[]\"}", "{\"numbers\": \"[10]\"}", "{\"numbers\": \...
{ "input": [] }
advanced
verina_basic_57
-----Description----- This task involves determining how many numbers within an array are less than a specified threshold. The problem is focused on identifying and counting such numbers based purely on their value in relation to the threshold. -----Input----- The input consists of: • numbers: An array of integers (wh...
-- !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 CountLessThan_precond (numbers : Array Int) (threshold : Int) : Prop := -- !benchmark @start...
{ "name": "CountLessThan", "parameters": { "param_name": [ "numbers", "threshold" ], "param_type": [ "Array Int", "Int" ] }, "return_type": "Nat" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_count_lessthan", "student_id": null } }
{ "input": [ "{\"numbers\": \"#[1, 2, 3, 4, 5]\", \"threshold\": 3}", "{\"numbers\": \"#[]\", \"threshold\": 10}", "{\"numbers\": \"#[-1, 0, 1]\", \"threshold\": 0}", "{\"numbers\": \"#[5, 6, 7, 2, 1]\", \"threshold\": 5}", "{\"numbers\": \"#[3, 3, 3, 3]\", \"threshold\": 3}" ], "expected": [ ...
{ "input": [] }
basic
verina_advanced_20
-----Description----- This task requires writing a Lean 4 method that returns true if the input n is divisible by 8 or has 8 as one of it's digits. -----Input----- The input consists of one integer: n: The main integer. -----Output----- The output is an boolean: Returns true if the input is divisible by 8 or has 8 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 isItEight_precond (n : Int) : Prop := -- !benchmark @start precond True -- !benchmark @end pre...
{ "name": "isItEight", "parameters": { "param_name": [ "n" ], "param_type": [ "Int" ] }, "return_type": "Bool" }
{ "upstream": { "name": "lab_assignment", "link": "N/A Problem I came up with", "task_id": "lab_isItEight_324366300", "student_id": [ 16 ] } }
{ "input": [ "{\"n\": 8}", "{\"n\": 98}", "{\"n\": 1224}", "{\"n\": 73}", "{\"n\": 208}", "{\"n\": 0}", "{\"n\": -123456780}", "{\"n\": 1}", "{\"n\": -9999}", "{\"n\": -123453}" ], "expected": [ [ "True" ], [ "True" ], [ "True" ], ...
{ "input": [] }
advanced
verina_basic_77
-----Description----- This task involves updating an element within a 2-dimensional array. The goal is to modify only a specific inner array by changing one of its elements to a new value while keeping every other element and all other inner arrays unchanged. -----Input----- The input consists of: • arr: An arra...
-- !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 modify_array_element_precond (arr : Array (Array Nat)) (index1 : Nat) (index2 : Nat) (val : Na...
{ "name": "modify_array_element", "parameters": { "param_name": [ "arr", "index1", "index2", "val" ], "param_type": [ "Array (Array Nat)", "Nat", "Nat", "Nat" ] }, "return_type": "Array (Array Nat)" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_modify_2d_array", "student_id": null } }
{ "input": [ "{\"arr\": \"#[#[1, 2, 3], #[4, 5, 6]]\", \"index1\": 0, \"index2\": 1, \"val\": 99}", "{\"arr\": \"#[#[7, 8], #[9, 10]]\", \"index1\": 1, \"index2\": 0, \"val\": 0}", "{\"arr\": \"#[#[0, 0, 0]]\", \"index1\": 0, \"index2\": 2, \"val\": 5}", "{\"arr\": \"#[#[3, 4, 5], #[6, 7, 8], #[9, 10,...
{ "input": [ "{'arr': '#[#[1, 2, 3], #[4, 5, 6]]', 'index1': 1, 'index2': 3, 'val': 99}" ] }
basic
verina_advanced_49
-----Description----- Implement a Lean 4 function that merges two ascendingly sorted lists of integers into one single sorted list (ascending). The resulting list must contain all elements from both input lists, preserving their ascending order. -----Input----- The input consists of two lists of integers: arr1: A sort...
-- !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 mergeSortedLists_precond (arr1 : List Int) (arr2 : List Int) : Prop := -- !benchmark @start precon...
{ "name": "mergeSortedLists", "parameters": { "param_name": [ "arr1", "arr2" ], "param_type": [ "List Int", "List Int" ] }, "return_type": "List Int" }
{ "upstream": { "name": "lab_assignment", "link": "N/A", "task_id": "lab_mergeSortedLists_325057855", "student_id": [ 17 ] } }
{ "input": [ "{\"arr1\": \"[1, 3, 5]\", \"arr2\": \"[2, 4, 6]\"}", "{\"arr1\": \"[]\", \"arr2\": \"[]\"}", "{\"arr1\": \"[-2, 0, 1]\", \"arr2\": \"[-3, -1]\"}", "{\"arr1\": \"[10, 20, 30]\", \"arr2\": \"[5, 25, 35]\"}", "{\"arr1\": \"[1, 2, 2]\", \"arr2\": \"[2, 3, 3]\"}" ], "expected": [ ...
{ "input": [ "{'arr1': '[3, 2, 1]', 'arr2': '[6, 5, 4]'}" ] }
advanced
verina_advanced_28
-----Description----- This task requires writing a Lean 4 function that finds the length of the longest sequence of consecutive integers present in a given list. The numbers do not need to appear in order. The elements are unique. A consecutive sequence consists of integers that can be arranged in increasing order wit...
-- !benchmark @start import type=solution import Std.Data.HashSet import Mathlib open Std -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def longestConsecutive_precond (nums : List Int) : ...
{ "name": "longestConsecutive", "parameters": { "param_name": [ "nums" ], "param_type": [ "List Int" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "", "task_id": "lab_longestConsecutive_325601349", "student_id": [ 22 ] } }
{ "input": [ "{\"nums\": \"[100, 4, 200, 1, 3, 2]\"}", "{\"nums\": \"[0, 3, 7, 2, 5, 8, 4, 6, 1]\"}", "{\"nums\": \"[1, 2, 0]\"}", "{\"nums\": \"[]\"}", "{\"nums\": \"[10]\"}" ], "expected": [ [ "4" ], [ "9" ], [ "3" ], [ "0" ], [ ...
{ "input": [ "{'nums': '[1, 1]'}" ] }
advanced
verina_basic_44
-----Description----- This task requires writing a Lean 4 method that verifies if every odd index in an array of integers holds an odd number. In other words, for each index in the array that is odd, the number located at that index must also be odd. The method should return true if this condition is satisfied for eve...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux def isOdd (n : Int) : Bool := n % 2 == 1 -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def isOddAtIndexOdd_precond (a : Array Int) : Prop := ...
{ "name": "isOddAtIndexOdd", "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_775", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 2, 3, 4, 5]\"}", "{\"a\": \"#[1, 3, 5, 7, 9]\"}", "{\"a\": \"#[2, 4, 6, 8, 10]\"}", "{\"a\": \"#[]\"}", "{\"a\": \"#[7]\"}", "{\"a\": \"#[0, 1, 0, 1]\"}", "{\"a\": \"#[0, 2, 4, 6]\"}" ], "expected": [ [ "False" ], [ "True" ], ...
{ "input": [] }
basic
verina_basic_79
-----Description----- Given a nonempty array of integers and a valid index x (with 1 ≤ x < array size), the task is to identify two key pieces of information. First, determine the maximum value among the first x elements of the array. Second, select an index p within the range [x, array size) that satisfies the followi...
-- !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 onlineMax_precond (a : Array Int) (x : Nat) : Prop := -- !benchmark @start precond a.size ...
{ "name": "onlineMax", "parameters": { "param_name": [ "a", "x" ], "param_type": [ "Array Int", "Nat" ] }, "return_type": "Int × Nat" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_online_max", "student_id": null } }
{ "input": [ "{\"a\": \"#[3, 7, 5, 2, 9]\", \"x\": 3}", "{\"a\": \"#[10, 10, 5, 1]\", \"x\": 2}", "{\"a\": \"#[1, 3, 3, 3, 1]\", \"x\": 2}", "{\"a\": \"#[5, 4, 4, 6, 2]\", \"x\": 2}", "{\"a\": \"#[2, 8, 7, 7, 7]\", \"x\": 3}" ], "expected": [ [ "(7, 4)" ], [ "(10, 3)" ...
{ "input": [ "{'a': '#[]', 'x': 2}", "{'a': '#[1, 2, 3]', 'x': 0}", "{'a': '#[5]', 'x': 0}", "{'a': '#[1, 2]', 'x': 2}" ] }
basic
verina_basic_81
-----Description----- This task involves performing integer division with remainder on natural numbers. Given two natural numbers, x (the dividend) and y (the divisor), the objective is to determine the quotient and remainder. When y is non-zero, the quotient and remainder should satisfy the condition that the divide...
-- !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 DivisionFunction_precond (x : Nat) (y : Nat) : Prop := -- !benchmark @start pr...
{ "name": "DivisionFunction", "parameters": { "param_name": [ "x", "y" ], "param_type": [ "Nat", "Nat" ] }, "return_type": "Int × Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_quotient", "student_id": null } }
{ "input": [ "{\"x\": 10, \"y\": 3}", "{\"x\": 15, \"y\": 5}", "{\"x\": 7, \"y\": 2}", "{\"x\": 0, \"y\": 4}", "{\"x\": 10, \"y\": 0}" ], "expected": [ [ "(1, 3)" ], [ "(0, 3)" ], [ "(1, 3)" ], [ "(0, 0)" ], [ "(10, 0)" ] ...
{ "input": [] }
basic
verina_basic_51
-----Description----- This task requires creating a function that determines the correct insertion index for a given integer in a sorted array. The goal is to identify an index where every number before it is less than the specified value, and every number from that index onward is greater than or equal to the value. 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 BinarySearch_precond (a : Array Int) (key : Int) : Prop := -- !benchmark @start precond Li...
{ "name": "BinarySearch", "parameters": { "param_name": [ "a", "key" ], "param_type": [ "Array Int", "Int" ] }, "return_type": "Nat" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_binary_search", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 3, 5, 7, 9]\", \"key\": 5}", "{\"a\": \"#[1, 3, 5, 7, 9]\", \"key\": 6}", "{\"a\": \"#[2, 4, 6, 8]\", \"key\": 1}", "{\"a\": \"#[2, 4, 6, 8]\", \"key\": 10}", "{\"a\": \"#[1, 1, 1, 1]\", \"key\": 1}" ], "expected": [ [ "2" ], [ "3" ], ...
{ "input": [ "{'a': '#[3, 2, 1]', 'key': 2}" ] }
basic
verina_basic_13
-----Description----- This task requires writing a Lean 4 method that transforms an array of integers by replacing every element with its cube. In other words, for each element in the input array, the output array should contain the result of multiplying that element by itself three times. -----Input----- The input 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 cubeElements_precond (a : Array Int) : Prop := -- !benchmark @start precond True -- !be...
{ "name": "cubeElements", "parameters": { "param_name": [ "a" ], "param_type": [ "Array Int" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_447", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 2, 3, 4]\"}", "{\"a\": \"#[0, -1, -2, 3]\"}", "{\"a\": \"#[]\"}", "{\"a\": \"#[5]\"}", "{\"a\": \"#[-3, -3]\"}" ], "expected": [ [ "#[1, 8, 27, 64]" ], [ "#[0, -1, -8, 27]" ], [ "#[]" ], [ "#[125]" ], [ ...
{ "input": [] }
basic
verina_basic_87
-----Description----- This problem requires sorting an array of integers into non-decreasing order, ensuring that the output contains exactly the same elements as the input (i.e., it is a permutation of the original array). -----Input----- The input consists of: • a: An array of integers (Array Int). -----Out...
-- !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 SelectionSort_precond (a : Array Int) : Prop := -- !benchmark @start precond True -- !be...
{ "name": "SelectionSort", "parameters": { "param_name": [ "a" ], "param_type": [ "Array Int" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_selectionsort", "student_id": null } }
{ "input": [ "{\"a\": \"#[3, 1, 2]\"}", "{\"a\": \"#[0]\"}", "{\"a\": \"#[5, 4, 3, 2, 1]\"}", "{\"a\": \"#[2, 2, 1, 4]\"}", "{\"a\": \"#[10, -5, 0, 3]\"}" ], "expected": [ [ "#[1, 2, 3]" ], [ "#[0]" ], [ "#[1, 2, 3, 4, 5]" ], [ "#[1, 2, 2, 4]...
{ "input": [] }
basic
verina_basic_83
-----Description----- This task involves concatenating two arrays of integers by appending the second array to the end of the first array. The goal is to produce a new array that sequentially contains all elements from the first array followed by all elements from the second array. -----Input----- The input consis...
-- !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 concat_precond (a : Array Int) (b : Array Int) : Prop := -- !benchmark @start precond True...
{ "name": "concat", "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_concat", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 2, 3]\", \"b\": \"#[4, 5]\"}", "{\"a\": \"#[]\", \"b\": \"#[]\"}", "{\"a\": \"#[10]\", \"b\": \"#[20, 30, 40]\"}", "{\"a\": \"#[-1, -2]\", \"b\": \"#[0]\"}", "{\"a\": \"#[7, 8, 9]\", \"b\": \"#[]\"}" ], "expected": [ [ "#[1, 2, 3, 4, 5]" ], [ ...
{ "input": [] }
basic
verina_advanced_43
------Description----- This task requires writing a Lean 4 method that given a 0-indexed integer array `nums` representing the scores of students in an exam. A teacher wants to select a non empty group of students such that the strength of group is maximized. The strength of a group is defined as the product of the s...
-- !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] def maxStrength_precond (nums : List Int) : Prop := -- !benchmark @start precond nums ...
{ "name": "maxStrength", "parameters": { "param_name": [ "nums" ], "param_type": [ "List Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "lab_assignment", "link": "Livecodebench has problem, but couldn't find that link so using leetcode: https://leetcode.com/problems/maximum-product-subarray/description/", "task_id": "lab_maxStrength_324857110", "student_id": [ 35 ] } }
{ "input": [ "{\"nums\": \"[-2]\"}", "{\"nums\": \"[3, -1, -5, 2, 5, -9]\"}", "{\"nums\": \"[-4, -5, -4]\"}", "{\"nums\": \"[0, -3, 4]\"}", "{\"nums\": \"[1, -1, -1]\"}" ], "expected": [ [ "-2" ], [ "1350" ], [ "20" ], [ "4" ], [ ...
{ "input": [ "{'nums': '[]'}" ] }
advanced
verina_basic_105
-----Description----- This task involves computing the element-wise product of two integer arrays. For each position in the arrays, the corresponding numbers are multiplied together. If an element is missing in one of the arrays at a given index, the missing value is treated as 0. When both arrays provide values for ev...
-- !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 arrayProduct_precond (a : Array Int) (b : Array Int) : Prop := -- !benchmark @start precond ...
{ "name": "arrayProduct", "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_product", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 2, 3]\", \"b\": \"#[4, 5, 6]\"}", "{\"a\": \"#[0, 0, 0]\", \"b\": \"#[1, 2, 3]\"}", "{\"a\": \"#[-1, 2, -3]\", \"b\": \"#[3, -4, 5]\"}", "{\"a\": \"#[2]\", \"b\": \"#[10]\"}", "{\"a\": \"#[1, 2, 3, 4]\", \"b\": \"#[2, 2, 2, 2]\"}" ], "expected": [ [ "#[4,...
{ "input": [ "{'a': '#[1, 2, 3]', 'b': '#[4, 5]'}" ] }
basic
verina_basic_42
-----Description----- This task requires writing a Lean 4 method that counts the number of digit characters within a given string. A digit is any character between '0' and '9'. The method should determine how many such digit characters appear in the input. -----Input----- The input consists of: s: A string. ---...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux def isDigit (c : Char) : Bool := '0' ≤ c ∧ c ≤ '9' -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def countDigits_precond (s : String) : Prop :...
{ "name": "countDigits", "parameters": { "param_name": [ "s" ], "param_type": [ "String" ] }, "return_type": "Nat" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_764", "student_id": null } }
{ "input": [ "{\"s\": \"123abc456\"}", "{\"s\": \"no digits here!\"}", "{\"s\": \"1234567890\"}", "{\"s\": \"\"}", "{\"s\": \"a1b2c3\"}", "{\"s\": \"0\"}", "{\"s\": \"abc\"}" ], "expected": [ [ "6" ], [ "0" ], [ "10" ], [ "0" ], ...
{ "input": [] }
basic
verina_advanced_47
-----Description----- This task requires writing a Lean 4 method that merges all overlapping intervals from a given list of intervals. Each interval is represented as a pair [start, end], indicating the start and end of the interval. If two intervals overlap, they should be merged into a single interval that spans fro...
-- !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 mergeIntervals_precond (intervals : List (Prod Int Int)) : Prop := -- !benchmark @start prec...
{ "name": "mergeIntervals", "parameters": { "param_name": [ "intervals" ], "param_type": [ "List (Prod Int Int)" ] }, "return_type": "List (Prod Int Int)" }
{ "upstream": { "name": "lab_assignment", "link": "[{\"text_file_id\"=>804740898}]", "task_id": "lab_mergeIntervals_325627981", "student_id": [ 6 ] } }
{ "input": [ "{\"intervals\": \"[(1, 3), (2, 6), (8, 10), (15, 18)]\"}", "{\"intervals\": \"[(1, 4), (4, 5)]\"}", "{\"intervals\": \"[(1, 10), (2, 3), (4, 5)]\"}", "{\"intervals\": \"[(1, 2), (3, 4), (5, 6)]\"}", "{\"intervals\": \"[(5, 6), (1, 3), (2, 4)]\"}" ], "expected": [ [ "[(1...
{ "input": [] }
advanced
verina_advanced_70
-----Description--- This task requires writing a Lean 4 method that's goal is to determine the minimum number of adjacent swaps needed to make the array semi-ordered. You may repeatedly swap 2 adjacent elements in the array. A permutation is called semi-ordered if the first number equals 1 and the last number equals 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 semiOrderedPermutation_precond (nums : List Int) : Prop := -- !benchmark @start precond let n :=...
{ "name": "semiOrderedPermutation", "parameters": { "param_name": [ "nums" ], "param_type": [ "List Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "lab_assignment", "link": "Found on livecodebench, but similar problem on leetcode: https://leetcode.com/problems/minimum-adjacent-swaps-to-make-a-valid-array/description/", "task_id": "lab_semiOrderedPermutation_324857110", "student_id": [ 35 ] } }
{ "input": [ "{\"nums\": \"[2, 1, 4, 3]\"}", "{\"nums\": \"[2, 4, 1, 3]\"}", "{\"nums\": \"[1, 3, 4, 2, 5]\"}", "{\"nums\": \"[3, 1, 2]\"}", "{\"nums\": \"[2, 3, 1, 5, 4]\"}" ], "expected": [ [ "2" ], [ "3" ], [ "0" ], [ "2" ], [ ...
{ "input": [ "{'nums': []}", "{'nums': [2, 3, 4]}", "{'nums': [1, 1, 2]}", "{'nums': [0, 1, 2]}" ] }
advanced
verina_basic_18
-----Description----- This task requires writing a Lean 4 method that computes the sum of the digits of a non-negative integer. The method should process each digit of the input number and return the total sum. The output is guaranteed to be a non-negative natural number. -----Input----- The input consists of: n: A 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 sumOfDigits_precond (n : Nat) : Prop := -- !benchmark @start precond True -- !benchmark...
{ "name": "sumOfDigits", "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_566", "student_id": null } }
{ "input": [ "{\"n\": 12345}", "{\"n\": 0}", "{\"n\": 987654321}", "{\"n\": 11111}", "{\"n\": 1001}", "{\"n\": 9999}" ], "expected": [ [ "15" ], [ "0" ], [ "45" ], [ "5" ], [ "2" ], [ "36" ] ], "unexpec...
{ "input": [] }
basic
verina_basic_10
-----Description----- This task requires writing a Lean 4 method that determines if a given integer is strictly greater than every element in a provided array. The method should return true only if the integer is larger than each element in the array; otherwise, it should return false. -----Input----- The input consi...
-- !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 isGreater_precond (n : Int) (a : Array Int) : Prop := -- !benchmark @start precond a.size...
{ "name": "isGreater", "parameters": { "param_name": [ "n", "a" ], "param_type": [ "Int", "Array Int" ] }, "return_type": "Bool" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_433", "student_id": null } }
{ "input": [ "{\"n\": 6, \"a\": \"#[1, 2, 3, 4, 5]\"}", "{\"n\": 3, \"a\": \"#[1, 2, 3, 4, 5]\"}", "{\"n\": 5, \"a\": \"#[5, 5, 5]\"}", "{\"n\": -1, \"a\": \"#[-10, -5, -3]\"}", "{\"n\": -3, \"a\": \"#[-1, -2, -3]\"}", "{\"n\": 0, \"a\": \"#[0, -1, -2]\"}", "{\"n\": 10, \"a\": \"#[1, 2, 9,...
{ "input": [ "{'n': 0, 'a': '#[]'}" ] }
basic
verina_advanced_16
-----Description----- Implement the insertion sort algorithm in Lean 4. The function takes a single list of integers as input and returns a new list that contains the same integers in ascending order. Implementation must follow a standard insertion sort approach, placing each element into its correct position. The res...
-- !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 (xs : List Int) : Prop := -- !benchmark @start precond True -- !benchmar...
{ "name": "insertionSort", "parameters": { "param_name": [ "xs" ], "param_type": [ "List Int" ] }, "return_type": "List Int" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/insertion-sort-list/description/", "task_id": "lab_insertionSort_324868790", "student_id": [ 13 ] } }
{ "input": [ "{\"xs\": \"[]\"}", "{\"xs\": \"[42]\"}", "{\"xs\": \"[3, 1, 4, 2]\"}", "{\"xs\": \"[5, -1, 0, 10, -1]\"}", "{\"xs\": \"[2, 2, 2, 2, 2]\"}" ], "expected": [ [ "[]" ], [ "[42]" ], [ "[1, 2, 3, 4]" ], [ "[-1, -1, 0, 5, 10]" ], ...
{ "input": [] }
advanced
verina_advanced_44
-----Description----- Given an integer array arr and a positive integer k, this task requires writing a Lean 4 method that finds the maximum sum of a subarray of arr, such that the length of the subarray is divisible by k. If the array is empty, or generally if there exists no subarray with length divisible by k, 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] def maxSubarraySumDivisibleByK_precond (arr : Array Int) (k : Int) : Prop := -- !benchmark @start prec...
{ "name": "maxSubarraySumDivisibleByK", "parameters": { "param_name": [ "arr", "k" ], "param_type": [ "Array Int", "Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/maximum-subarray-sum-with-length-divisible-by-k/description/", "task_id": "lab_maxSubarraySumDivisibleByK_325772368", "student_id": [ 36 ] } }
{ "input": [ "{\"arr\": \"#[1, 2, 3, 4, 5]\", \"k\": 2}", "{\"arr\": \"#[1, -2, 3, -4, 5]\", \"k\": 3}", "{\"arr\": \"#[]\", \"k\": 5}", "{\"arr\": \"#[1, 2, 3, 4]\", \"k\": 1}", "{\"arr\": \"#[-2, 7, 1, 3]\", \"k\": 2}", "{\"arr\": \"#[-100, 0, 1]\", \"k\": 5}", "{\"arr\": \"#[1999, 1, -1...
{ "input": [] }
advanced
verina_basic_72
-----Description----- The problem asks you to construct a new list by adding an extra number to the end of an existing list of numbers. The focus is on understanding what the final list should look like when a given number is included as the last element. -----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 append_precond (a : Array Int) (b : Int) : Prop := -- !benchmark @start precond True -- ...
{ "name": "append", "parameters": { "param_name": [ "a", "b" ], "param_type": [ "Array Int", "Int" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_array_append", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 2, 3]\", \"b\": 4}", "{\"a\": \"#[]\", \"b\": 0}", "{\"a\": \"#[5, 6]\", \"b\": -1}", "{\"a\": \"#[0, 0, 0]\", \"b\": 1}", "{\"a\": \"#[-2, -3]\", \"b\": -4}" ], "expected": [ [ "#[1, 2, 3, 4]" ], [ "#[0]" ], [ "#[5, 6, -1]" ...
{ "input": [] }
basic
verina_basic_26
-----Description----- This task requires writing a Lean 4 method that determines whether a given integer is even. In other words, the method should return true if the number is even and false if the number is odd. -----Input----- The input consists of: n: An integer. -----Output----- The output is a Boolean value: R...
-- !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 isEven_precond (n : Int) : Prop := -- !benchmark @start precond True -- !benchmark @end...
{ "name": "isEven", "parameters": { "param_name": [ "n" ], "param_type": [ "Int" ] }, "return_type": "Bool" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_600", "student_id": null } }
{ "input": [ "{\"n\": 4}", "{\"n\": 7}", "{\"n\": 0}", "{\"n\": -2}", "{\"n\": -3}" ], "expected": [ [ "True" ], [ "False" ], [ "True" ], [ "True" ], [ "False" ] ], "unexpected": [ [ "False" ], [ ...
{ "input": [] }
basic
verina_advanced_29
-----Description----- You are given a natural number array nums and a natural number k. The frequency of an element x is the number of times it occurs in an array. An array is called good if the frequency of each element in this array is less than or equal to k. Return the length of the longest good subarray of nums. ...
-- !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 longestGoodSubarray_precond (nums : List Nat) (k : Nat) : Prop := ...
{ "name": "longestGoodSubarray", "parameters": { "param_name": [ "nums", "k" ], "param_type": [ "List Nat", "Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/length-of-longest-subarray-with-at-most-k-frequency/description/", "task_id": "lab_longestGoodSubarray_325744111", "student_id": [ 23 ] } }
{ "input": [ "{\"nums\": \"[1, 2, 3, 1, 2, 3, 1, 2]\", \"k\": 2}", "{\"nums\": \"[1, 2, 1, 2, 1, 2, 1, 2]\", \"k\": 1}", "{\"nums\": \"[5, 5, 5, 5, 5, 5, 5]\", \"k\": 4}", "{\"nums\": \"[1]\", \"k\": 1}", "{\"nums\": \"[2, 2, 1, 1, 3]\", \"k\": 2}" ], "expected": [ [ "6" ], [...
{ "input": [ "{'nums': '[1, 2, 3]', 'k': 0}", "{'nums': '[]', 'k': 0}" ] }
advanced
verina_advanced_1
-----Description----- This task requires writing a Lean 4 function that finds the single number in a non-empty list of integers, where every element appears exactly twice except for one element that appears only once. The function should return the integer that appears only once. -----Input----- The input is a non-em...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux def filterlist (x : Int) (nums : List Int) : List Int := let rec aux (lst : List Int) : List Int := match lst with | [] => [] | y :: ys => if y = x then y :: aux ys else aux ys aux nums -- !bench...
{ "name": "FindSingleNumber", "parameters": { "param_name": [ "nums" ], "param_type": [ "List Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "lab_assignment", "link": "N/A", "task_id": "lab_FindSingleNumber_324594979", "student_id": [ 1 ] } }
{ "input": [ "{\"nums\": \"[2, 2, 3]\"}", "{\"nums\": \"[1, 2, 2]\"}", "{\"nums\": \"[3, 3, 4, 4, 1]\"}", "{\"nums\": \"[0, 1, 3, 1, 3, 88, 88, 100, 100]\"}", "{\"nums\": \"[-1, -1, 7, 9, 7]\"}" ], "expected": [ [ "3" ], [ "1" ], [ "1" ], [ "...
{ "input": [ "{'nums': '[2, 2]'}", "{'nums': '[2, 2, 3, 3]'}" ] }
advanced
verina_basic_41
-----Description----- This task requires writing a Lean 4 method that determines whether an array of integers contains only one distinct element. The method should return true if the array is empty or if every element in the array is the same, and false if there are at least two different elements. -----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 hasOnlyOneDistinctElement_precond (a : Array Int) : Prop := -- !benchmark @start precond ...
{ "name": "hasOnlyOneDistinctElement", "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_760", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 1, 1]\"}", "{\"a\": \"#[1, 2, 1]\"}", "{\"a\": \"#[3, 4, 5, 6]\"}", "{\"a\": \"#[7]\"}", "{\"a\": \"#[0, 0, 0, 0]\"}", "{\"a\": \"#[0, 0, 1, 0]\"}" ], "expected": [ [ "True" ], [ "False" ], [ "False" ], [ "Tru...
{ "input": [ "{'a': '#[]'}" ] }
basic
verina_advanced_79
-----Description----- This task requires writing a Lean 4 method that implementing the "Two Sum" problem. Given a list of integers and a target integer, the function should return the indices of the two numbers that add up to the target. If no valid pair exists, the function should return none. And the indices returned...
-- !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 : List Int) (target : Int) : Prop := -- !benchmark @start precond True --...
{ "name": "twoSum", "parameters": { "param_name": [ "nums", "target" ], "param_type": [ "List Int", "Int" ] }, "return_type": "Option (Nat × Nat)" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/two-sum/description/", "task_id": "lab_twoSum_325525518", "student_id": [ 27 ] } }
{ "input": [ "{\"nums\": \"[2, 7, 11, 15]\", \"target\": 9}", "{\"nums\": \"[3, 2, 4]\", \"target\": 6}", "{\"nums\": \"[3, 3]\", \"target\": 6}", "{\"nums\": \"[1, 2, 3]\", \"target\": 7}", "{\"nums\": \"[0, 4, 3, 0]\", \"target\": 0}" ], "expected": [ [ "some (0, 1)" ], [ ...
{ "input": [] }
advanced
verina_advanced_58
-----Description----- This task requires writing a Lean 4 function that returns the nth "ugly number". Ugly numbers are positive integers whose only prime factors are 2, 3, or 5. The function should generate ugly numbers in ascending order and return the nth one. The first ugly number is 1. -----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 nthUglyNumber_precond (n : Nat) : Prop := -- !benchmark @start precond n > 0 -- !benchma...
{ "name": "nthUglyNumber", "parameters": { "param_name": [ "n" ], "param_type": [ "Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "", "task_id": "lab_nthUglyNumber_324647099", "student_id": [ 43 ] } }
{ "input": [ "{\"n\": 1}", "{\"n\": 10}", "{\"n\": 15}", "{\"n\": 5}", "{\"n\": 7}" ], "expected": [ [ "1" ], [ "12" ], [ "24" ], [ "5" ], [ "8" ] ], "unexpected": [ [ "0", "2" ], [ "13", ...
{ "input": [] }
advanced
verina_advanced_3
-----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] def LongestCommonSubsequence_precond (a : Array Int) (b : Array Int) : Prop := -- !benchmark @start pr...
{ "name": "LongestCommonSubsequence", "parameters": { "param_name": [ "a", "b" ], "param_type": [ "Array Int", "Array Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "lab_assignment", "link": "longest common subsequence from cs170 hw07", "task_id": "lab_LongestCommonSubsequence_325033255", "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_basic_2
-----Description----- This task requires writing a Lean 4 method that finds the smallest number in an array of integers. -----Input----- The input consists of: s: An array of integers. -----Output----- The output is an option integer: Returns the smallest number found in the input array or none if the array is empty...
-- !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 findSmallest_precond (s : Array Nat) : Prop := -- !benchmark @start precond True -- !be...
{ "name": "findSmallest", "parameters": { "param_name": [ "s" ], "param_type": [ "Array Nat" ] }, "return_type": "Option Nat" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_62", "student_id": null } }
{ "input": [ "{\"s\": \"#[3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]\"}", "{\"s\": \"#[0, 1, 2, 3, 4, 5]\"}", "{\"s\": \"#[1]\"}", "{\"s\": \"#[10, 10, 10]\"}", "{\"s\": \"#[3, 2, 2, 2, 2, 2, 2, 1]\"}", "{\"s\": \"#[0]\"}", "{\"s\": \"#[100, 99, 98]\"}", "{\"s\": \"#[]\"}" ], "expected": [ ...
{ "input": [] }
basic
verina_basic_103
-----Description----- This problem involves updating an array of integers by modifying two specific positions. Specifically, the element at index 4 should be increased by 3, and the element at index 7 should be changed to 516. The goal is to correctly update these positions while leaving the rest of the array unchang...
-- !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 UpdateElements_precond (a : Array Int) : Prop := -- !benchmark @start precond a.size ≥ 8 ...
{ "name": "UpdateElements", "parameters": { "param_name": [ "a" ], "param_type": [ "Array Int" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_update_array", "student_id": null } }
{ "input": [ "{\"a\": \"#[0, 1, 2, 3, 4, 5, 6, 7, 8]\"}", "{\"a\": \"#[10, 20, 30, 40, 50, 60, 70, 80]\"}", "{\"a\": \"#[-1, -2, -3, -4, -5, -6, -7, -8, -9, -10]\"}", "{\"a\": \"#[0, 0, 0, 0, 0, 0, 0, 0]\"}", "{\"a\": \"#[5, 5, 5, 5, 5, 5, 5, 5]\"}" ], "expected": [ [ "#[0, 1, 2, 3, ...
{ "input": [ "{'a': '#[1, 2, 3, 4, 5, 6]'}" ] }
basic
verina_basic_67
-----Description----- This task requires determining whether a given list of characters is a palindrome; that is, whether the sequence reads the same forward and backward. -----Input----- The input consists of: • x: A list of characters (List Char). The list can be empty or non-empty. -----Output----- The out...
-- !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 (x : List Char) : Prop := -- !benchmark @start precond True -- !ben...
{ "name": "IsPalindrome", "parameters": { "param_name": [ "x" ], "param_type": [ "List Char" ] }, "return_type": "Bool" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_is_palindrome", "student_id": null } }
{ "input": [ "{\"x\": \"[]\"}", "{\"x\": \"['a']\"}", "{\"x\": \"['a', 'b', 'a']\"}", "{\"x\": \"['a', 'b', 'c']\"}", "{\"x\": \"['r', 'a', 'c', 'e', 'c', 'a', 'r']\"}" ], "expected": [ [ "true" ], [ "true" ], [ "true" ], [ "false" ], ...
{ "input": [] }
basic
verina_basic_96
-----Description----- This task requires swapping two integer values. Given two integers as input, the objective is to produce an output where their order is reversed: the first element of the output corresponds to the second input and the second element corresponds to the first input. -----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, simp] def SwapSimultaneous_precond (X : Int) (Y : Int) : Prop := -- !benchmark @start precond True ...
{ "name": "SwapSimultaneous", "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_swap_sim", "student_id": null } }
{ "input": [ "{\"X\": 3, \"Y\": 4}", "{\"X\": -10, \"Y\": 20}", "{\"X\": 0, \"Y\": 0}", "{\"X\": 123, \"Y\": -456}", "{\"X\": -1, \"Y\": -2}" ], "expected": [ [ "(4, 3)" ], [ "(20, -10)" ], [ "(0, 0)" ], [ "(-456, 123)" ], [ "(-...
{ "input": [] }
basic
verina_advanced_30
-----Description----- This task requires writing a Lean 4 function that computes the length of the longest strictly increasing contiguous subarray in a list of integers. A subarray is a sequence of consecutive elements, and it is strictly increasing if each element is greater than the previous one. The function should...
-- !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 longestIncreasingStreak_precond (nums : List Int) : Prop := -- !benchmark @start precond True ...
{ "name": "longestIncreasingStreak", "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_longestIncreasingStreak_324801033", "student_id": [ 24 ] } }
{ "input": [ "{\"nums\": \"[1, 2, 3, 2, 4, 5, 6]\"}", "{\"nums\": \"[10, 20, 30, 40]\"}", "{\"nums\": \"[5, 5, 5, 5]\"}", "{\"nums\": \"[10, 9, 8, 7]\"}", "{\"nums\": \"[]\"}", "{\"nums\": \"[1, 2, 1, 2, 3, 0, 1, 2, 3, 4]\"}" ], "expected": [ [ "4" ], [ "4" ], ...
{ "input": [] }
advanced
verina_basic_91
-----Description----- This task involves creating a function that swaps two integer values. Given two integers, the function should return a pair where the first element is the second input value and the second element is the first input value. -----Input----- The input consists of two integers: • X: An 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, simp] def Swap_precond (X : Int) (Y : Int) : Prop := -- !benchmark @start precond True -- !benchma...
{ "name": "Swap", "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_swap", "student_id": null } }
{ "input": [ "{\"X\": 1, \"Y\": 2}", "{\"X\": 0, \"Y\": 0}", "{\"X\": -1, \"Y\": 5}", "{\"X\": 100, \"Y\": -100}", "{\"X\": 42, \"Y\": 42}" ], "expected": [ [ "(2, 1)" ], [ "(0, 0)" ], [ "(5, -1)" ], [ "(-100, 100)" ], [ "(42, 4...
{ "input": [] }
basic
verina_basic_3
-----Description----- This task requires writing a Lean 4 method that determines whether a given integer is divisible by 11. The method should return true if the number is divisible by 11 and false otherwise. -----Input----- The input consists of: n: An integer to check for divisibility by 11. -----Output----- The 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 isDivisibleBy11_precond (n : Int) : Prop := -- !benchmark @start precond Tr...
{ "name": "isDivisibleBy11", "parameters": { "param_name": [ "n" ], "param_type": [ "Int" ] }, "return_type": "Bool" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_77", "student_id": null } }
{ "input": [ "{\"n\": 0}", "{\"n\": 11}", "{\"n\": 22}", "{\"n\": 23}", "{\"n\": 33}", "{\"n\": 44}", "{\"n\": -11}", "{\"n\": -22}", "{\"n\": 1}", "{\"n\": -1}", "{\"n\": 121}", "{\"n\": 123}" ], "expected": [ [ "True" ], [ "True" ], ...
{ "input": [] }
basic
verina_basic_32
-----Description----- This task requires writing a Lean 4 method that swaps the first and last elements of an array of integers. The method should produce a new array where the first element of the output is the last element of the input, the last element of the output is the first element of the input, and all other...
-- !benchmark @start import type=solution import Mathlib -- !benchmark @end import -- !benchmark @start import type=llm -- !benchmark @end import -- !benchmark @start import type=test -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benc...
{ "name": "swapFirstAndLast", "parameters": { "param_name": [ "a" ], "param_type": [ "Array Int" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_625", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 2, 3, 4, 5]\"}", "{\"a\": \"#[10]\"}", "{\"a\": \"#[1, 2]\"}", "{\"a\": \"#[1, 2, 3]\"}" ], "expected": [ [ "#[5, 2, 3, 4, 1]" ], [ "#[10]" ], [ "#[2, 1]" ], [ "#[3, 2, 1]" ] ], "unexpected": [ [ "#[...
{ "input": [ "{'a': '#[]'}" ] }
basic
verina_basic_86
-----Description----- This task requires writing a Lean 4 method that rotates an array of integers to the left by a specified offset. -----Input----- The input consists of: • a: An array of integers (which may be empty or non-empty). • offset: An integer representing the number of positions to rotate the array...
-- !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 rotate_precond (a : Array Int) (offset : Int) : Prop := -- !benchmark @start precond offse...
{ "name": "rotate", "parameters": { "param_name": [ "a", "offset" ], "param_type": [ "Array Int", "Int" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_rotate", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 2, 3, 4, 5]\", \"offset\": 2}", "{\"a\": \"#[10, 20, 30, 40]\", \"offset\": 1}", "{\"a\": \"#[]\", \"offset\": 5}", "{\"a\": \"#[7]\", \"offset\": 0}", "{\"a\": \"#[-1, -2, -3, -4]\", \"offset\": 3}", "{\"a\": \"#[5, 10, 15]\", \"offset\": 5}" ], "expected": [ ...
{ "input": [ "{'a': '#[1, 2, 3, 4, 5]', 'offset': -1}" ] }
basic
verina_basic_99
-----Description----- This task requires computing three times the given integer. The goal is to determine the product of the input integer and 3. -----Input----- The input consists of: • x: An integer. -----Output----- The output is an integer that represents three times the input value. -----Note----- Th...
-- !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_triple2", "student_id": null } }
{ "input": [ "{\"x\": 10}", "{\"x\": 18}", "{\"x\": 0}", "{\"x\": -5}", "{\"x\": 25}" ], "expected": [ [ "30" ], [ "54" ], [ "0" ], [ "-15" ], [ "75" ] ], "unexpected": [ [ "20", "25", "35" ], ...
{ "input": [] }
basic
verina_basic_107
-----Description----- This task involves computing the average of two integers. The objective is to determine a value that closely approximates the true arithmetic mean when using integer division, ensuring that the result reflects the necessary rounding behavior. -----Input----- The input consists of: • a: An 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 ComputeAvg_precond (a : Int) (b : Int) : Prop := -- !benchmark @start precond True -- !b...
{ "name": "ComputeAvg", "parameters": { "param_name": [ "a", "b" ], "param_type": [ "Int", "Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_avg", "student_id": null } }
{ "input": [ "{\"a\": 4, \"b\": 6}", "{\"a\": 3, \"b\": 5}", "{\"a\": 3, \"b\": 4}", "{\"a\": -3, \"b\": 7}", "{\"a\": -5, \"b\": 5}" ], "expected": [ [ "5" ], [ "4" ], [ "3" ], [ "2" ], [ "0" ] ], "unexpected": [ [ ...
{ "input": [] }
basic
verina_advanced_5
-----Description----- This task requires writing a Lean 4 method that adds two non-empty linked lists representing non-negative integers. The digits are stored in reverse order (i.e., the first element is the least significant digit). Each node (list element) holds a single digit (ranging from 0 to 9). The function sh...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux def listToNat : List Nat → Nat | [] => 0 | d :: ds => d + 10 * listToNat ds -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def addTwoNumbers_prec...
{ "name": "addTwoNumbers", "parameters": { "param_name": [ "l1", "l2" ], "param_type": [ "List Nat", "List Nat" ] }, "return_type": "List Nat" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/add-two-numbers/description/", "task_id": "lab_addTwoNumbers_324428059", "student_id": [ 3 ] } }
{ "input": [ "{\"l1\": \"[2,4,3]\", \"l2\": \"[5,6,4]\"}", "{\"l1\": \"[0]\", \"l2\": \"[0]\"}", "{\"l1\": \"[9,9,9,9,9,9,9]\", \"l2\": \"[9,9,9,9]\"}", "{\"l1\": \"[1,2,3]\", \"l2\": \"[4,5]\"}" ], "expected": [ [ "[7,0,8]" ], [ "[0]" ], [ "[8,9,9,9,0,0,0,1]"...
{ "input": [ "{'l1': '[]', 'l2': '[]'}", "{'l1': '[0, 0]', 'l2': '[0, 0]'}" ] }
advanced
verina_basic_101
-----Description----- This problem involves computing the triple of a given integer. The goal is to produce an output that is exactly three times the input value. -----Input----- The input consists of: • x: An integer representing the value to be tripled. -----Output----- The output is an integer that is thre...
-- !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 Triple_precond (x : Int) : Prop := -- !benchmark @start precond True -- !benchmark @end ...
{ "name": "Triple", "parameters": { "param_name": [ "x" ], "param_type": [ "Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_triple4", "student_id": null } }
{ "input": [ "{\"x\": 0}", "{\"x\": 1}", "{\"x\": -1}", "{\"x\": 5}", "{\"x\": -10}" ], "expected": [ [ "0" ], [ "3" ], [ "-3" ], [ "15" ], [ "-30" ] ], "unexpected": [ [ "1", "-1", "2" ], [...
{ "input": [] }
basic
verina_advanced_41
-----Description----- This task requires writing a Lean 4 method that finds the maximum among three given integers. The method should return the largest value, ensuring that the result is greater than or equal to each of the input numbers and that it is one of the provided integers. -----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] def maxOfThree_precond (a : Int) (b : Int) (c : Int) : Prop := -- !benchmark @start precond True -...
{ "name": "maxOfThree", "parameters": { "param_name": [ "a", "b", "c" ], "param_type": [ "Int", "Int", "Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/maximum-product-of-three-numbers/", "task_id": "lab_maxOfThree_325766147", "student_id": [ 33 ] } }
{ "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\": 0, \"b\": -10, \"c\": -5}" ], "expected": [ [ "3" ], [ "5" ], [ "20" ], [ "-1"...
{ "input": [] }
advanced
verina_basic_27
-----Description----- This task requires writing a Lean 4 method that identifies the first repeated character in a given string. The method should return a tuple containing a Boolean value and a character. The Boolean value indicates whether any character in the string is repeated. If it is true, the accompanying char...
-- !benchmark @start import type=solution import Std.Data.HashSet -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def findFirstRepeatedChar_precond (s : String) : Prop := -- !benchmark @...
{ "name": "findFirstRepeatedChar", "parameters": { "param_name": [ "s" ], "param_type": [ "String" ] }, "return_type": "Option Char" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_602", "student_id": null } }
{ "input": [ "{\"s\": \"abca\"}", "{\"s\": \"abcdef\"}", "{\"s\": \"aabbcc\"}", "{\"s\": \"\"}", "{\"s\": \"abbc\"}", "{\"s\": \"Aa\"}" ], "expected": [ [ "some ('a')" ], [ "none" ], [ "some ('a')" ], [ "none" ], [ "some ('b...
{ "input": [] }
basic
verina_basic_28
-----Description----- This task requires writing a Lean 4 method that determines whether a given natural number is prime. A number (with n ≥ 2) is considered prime if it is divisible only by 1 and itself. The method should return true when the input number is prime and false otherwise. -----Input----- The input consi...
-- !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 isPrime_precond (n : Nat) : Prop := -- !benchmark @start precond n ≥ 2 -- !benchmark @e...
{ "name": "isPrime", "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_605", "student_id": null } }
{ "input": [ "{\"n\": 2}", "{\"n\": 3}", "{\"n\": 4}", "{\"n\": 5}", "{\"n\": 9}", "{\"n\": 11}", "{\"n\": 12}", "{\"n\": 13}" ], "expected": [ [ "True" ], [ "True" ], [ "False" ], [ "True" ], [ "False" ], [ ...
{ "input": [ "{'n': 0}" ] }
basic
verina_basic_64
-----Description----- This task requires writing a Lean 4 method that inserts a subarray of characters into another array of characters at a specified index. The method takes the original array (oline) and, given the effective length l to consider, inserts another array of characters (nl) of effective length p starti...
-- !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 insert_precond (oline : Array Char) (l : Nat) (nl : Array Char) (p : Nat) (atPos : Nat) : Prop...
{ "name": "insert", "parameters": { "param_name": [ "oline", "l", "nl", "p", "atPos" ], "param_type": [ "Array Char", "Nat", "Array Char", "Nat", "Nat" ] }, "return_type": "Array Char" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_insert", "student_id": null } }
{ "input": [ "{\"oline\": \"#['a','b','c','d','e']\", \"l\": 5, \"nl\": \"#['X','Y']\", \"p\": 2, \"atPos\": 2}", "{\"oline\": \"#['H','e','l','l','o']\", \"l\": 5, \"nl\": \"#['W','o','r','l','d']\", \"p\": 5, \"atPos\": 0}", "{\"oline\": \"#['L','e','a','n']\", \"l\": 4, \"nl\": \"#['4']\", \"p\": 1, \"...
{ "input": [ "{'oline': \"#['a','b','c']\", 'l': 5, 'nl': \"#['X','Y']\", 'p': 3, 'atPos': 2}" ] }
basic
verina_advanced_78
-----Description----- This task requires writing a Lean 4 method that solves the Two Sum problem. Given a list of integers and a target integer, the method must return a pair of indices such that the sum of the numbers at those indices equals the target. You may assume that each input has exactly one solution and 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] def twoSum_precond (nums : List Int) (target : Int) : Prop := -- !benchmark @start precond let pairw...
{ "name": "twoSum", "parameters": { "param_name": [ "nums", "target" ], "param_type": [ "List Int", "Int" ] }, "return_type": "Prod Nat Nat" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/two-sum/description/", "task_id": "lab_twoSum_324854887", "student_id": [ 18 ] } }
{ "input": [ "{\"nums\": \"[2, 7, 11, 15]\", \"target\": 9}", "{\"nums\": \"[3, 2, 4]\", \"target\": 6}", "{\"nums\": \"[3, 3]\", \"target\": 6}", "{\"nums\": \"[1, 2, 3, 4]\", \"target\": 7}", "{\"nums\": \"[0, 4, 3, 0]\", \"target\": 0}" ], "expected": [ [ "(0, 1)" ], [ ...
{ "input": [ "{'nums': '[1, 2]', 'target': 0}" ] }
advanced
verina_advanced_63
-----Description----- This task requires writing a Lean 4 method that counts the unique elements from a sorted array. -----Input----- The input is a single list of integers: nums: An array of integers sorted in non-decreasing order. -----Output----- The output is a single integer: Returns the number of unique 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] def removeDuplicates_precond (nums : List Int) : Prop := -- !benchmark @start precond -- nums are so...
{ "name": "removeDuplicates", "parameters": { "param_name": [ "nums" ], "param_type": [ "List Int" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/remove-duplicates-from-sorted-array/description/", "task_id": "lab_removeDuplicates_325739229", "student_id": [ 30 ] } }
{ "input": [ "{\"nums\": \"[1, 1, 2]\"}", "{\"nums\": \"[0, 0, 1, 1, 1, 2, 2, 3, 3, 4]\"}", "{\"nums\": \"[-1, -1, 0, 1, 2, 2, 3]\"}", "{\"nums\": \"[1, 2, 3, 4, 5]\"}", "{\"nums\": \"[1, 1, 1, 1]\"}", "{\"nums\": \"[]\"}", "{\"nums\": \"[1]\"}", "{\"nums\": \"[-100, -100, -100]\"}", ...
{ "input": [ "{'nums': '[3, 2, 1]'}" ] }
advanced
verina_basic_21
-----Description----- This task requires writing a Lean 4 method that determines whether one list is a sublist of another. In other words, the method should check if the first list appears as a contiguous sequence within the second list and return true if it does, and false otherwise. -----Input----- The input con...
-- !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 isSublist_precond (sub : List Int) (main : List Int) : Prop := -- !benchmark @start precond...
{ "name": "isSublist", "parameters": { "param_name": [ "sub", "main" ], "param_type": [ "List Int", "List Int" ] }, "return_type": "Bool" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_576", "student_id": null } }
{ "input": [ "{\"sub\": \"[1, 2]\", \"main\": \"[3, 1, 2, 4]\"}", "{\"sub\": \"[2, 3]\", \"main\": \"[3, 1, 2, 4]\"}", "{\"sub\": \"[3, 1]\", \"main\": \"[3, 1, 2, 4]\"}", "{\"sub\": \"[4]\", \"main\": \"[3, 1, 2, 4]\"}", "{\"sub\": \"[5]\", \"main\": \"[3, 1, 2, 4]\"}", "{\"sub\": \"[]\", \"m...
{ "input": [] }
basic
verina_basic_31
-----Description----- This task requires writing a Lean 4 method that converts a given string to uppercase. The method should replace every lowercase letter in the input string with its corresponding uppercase character while leaving all other characters unchanged. The output string must have the same length as the in...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux def isLowerCase (c : Char) : Bool := 'a' ≤ c ∧ c ≤ 'z' def shiftMinus32 (c : Char) : Char := Char.ofNat ((c.toNat - 32) % 128) -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @en...
{ "name": "toUppercase", "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_624", "student_id": null } }
{ "input": [ "{\"s\": \"Hello, World!\"}", "{\"s\": \"abc\"}", "{\"s\": \"ABC\"}", "{\"s\": \"123!?@\"}", "{\"s\": \"\"}" ], "expected": [ [ "HELLO, WORLD!" ], [ "ABC" ], [ "ABC" ], [ "123!?@" ], [ "" ] ], "unexpected": ...
{ "input": [] }
basic
verina_basic_54
-----Description----- This task is about determining the minimum absolute difference between any pair of integers, where one integer is taken from the first sorted array and the other integer is taken from the second sorted array. The focus is on accurately finding the smallest absolute difference between any two ele...
-- !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 CanyonSearch_precond (a : Array Int) (b : Array Int) : Prop := -- !benchmark @start precond ...
{ "name": "CanyonSearch", "parameters": { "param_name": [ "a", "b" ], "param_type": [ "Array Int", "Array Int" ] }, "return_type": "Nat" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_canyon_search", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 3, 5]\", \"b\": \"#[2, 4, 6]\"}", "{\"a\": \"#[-5, -2, 0]\", \"b\": \"#[1, 3]\"}", "{\"a\": \"#[10, 20, 30]\", \"b\": \"#[5, 15, 25]\"}", "{\"a\": \"#[1, 2, 3, 4, 5]\", \"b\": \"#[3]\"}", "{\"a\": \"#[-10, -5, 0, 5, 10]\", \"b\": \"#[-3, 2, 8]\"}" ], "expected": [ ...
{ "input": [ "{'a': '#[]', 'b': '#[]'}" ] }
basic
verina_basic_12
-----Description----- This task requires writing a Lean 4 method that calculates the surface area of a cube based on the length of one of its edges. The method should compute the surface area using the standard formula for a cube. -----Input----- The input consists of: size: An natural number representing the 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 cubeSurfaceArea_precond (size : Nat) : Prop := -- !benchmark @start precond True -- !be...
{ "name": "cubeSurfaceArea", "parameters": { "param_name": [ "size" ], "param_type": [ "Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_441", "student_id": null } }
{ "input": [ "{\"size\": 3}", "{\"size\": 1}", "{\"size\": 10}", "{\"size\": 5}", "{\"size\": 2}" ], "expected": [ [ "54" ], [ "6" ], [ "600" ], [ "150" ], [ "24" ] ], "unexpected": [ [ "27", "48", ...
{ "input": [] }
basic
verina_basic_29
-----Description----- This task requires writing a Lean 4 method that removes an element from a given array of integers at a specified index. The resulting array should contain all the original elements except for the one at the given index. Elements before the removed element remain unchanged, and elements after it ...
-- !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 removeElement_precond (s : Array Int) (k : Nat) : Prop := -- !benchmark @start precond k ...
{ "name": "removeElement", "parameters": { "param_name": [ "s", "k" ], "param_type": [ "Array Int", "Nat" ] }, "return_type": "Array Int" }
{ "upstream": { "name": "dafny-synthesis", "link": "https://github.com/Mondego/dafny-synthesis", "task_id": "task_id_610", "student_id": null } }
{ "input": [ "{\"s\": \"#[1, 2, 3, 4, 5]\", \"k\": 2}", "{\"s\": \"#[10, 20, 30, 40]\", \"k\": 0}", "{\"s\": \"#[10, 20, 30, 40]\", \"k\": 3}", "{\"s\": \"#[7]\", \"k\": 0}" ], "expected": [ [ "#[1, 2, 4, 5]" ], [ "#[20, 30, 40]" ], [ "#[10, 20, 30]" ], ...
{ "input": [ "{'s': '#[1]', 'k': 2}" ] }
basic
verina_basic_62
-----Description----- The problem involves finding the first occurrence of a specified key in an array of integers. Your task is to identify the index at which the key appears for the first time in the array and return that index. If the key is not found, return -1. -----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 Find_precond (a : Array Int) (key : Int) : Prop := -- !benchmark @start precond True -- ...
{ "name": "Find", "parameters": { "param_name": [ "a", "key" ], "param_type": [ "Array Int", "Int" ] }, "return_type": "Int" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_find", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 2, 3, 4, 5]\", \"key\": 3}", "{\"a\": \"#[5, 7, 5, 9]\", \"key\": 5}", "{\"a\": \"#[2, 4, 6, 8]\", \"key\": 5}", "{\"a\": \"#[]\", \"key\": 10}", "{\"a\": \"#[0, -3, -1, -3]\", \"key\": -3}" ], "expected": [ [ "2" ], [ "0" ], [ ...
{ "input": [] }
basic
verina_basic_55
-----Description----- This task involves determining whether two integer values are equal. The goal is simply to compare the two provided numbers and indicate with a Boolean result whether they are the same. -----Input----- The input consists of two elements: • a: An element of type Int. • b: An element of type 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, simp] def Compare_precond (a : Int) (b : Int) : Prop := -- !benchmark @start precond True -- !benc...
{ "name": "Compare", "parameters": { "param_name": [ "a", "b" ], "param_type": [ "Int", "Int" ] }, "return_type": "Bool" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_compare", "student_id": null } }
{ "input": [ "{\"a\": 1, \"b\": 1}", "{\"a\": 1, \"b\": 2}" ], "expected": [ [ "True" ], [ "False" ] ], "unexpected": [ [ "False" ], [ "True" ] ] }
{ "input": [] }
basic
verina_advanced_74
-----Description----- This task requires writing a Lean 4 function called `solution` that takes a list of natural numbers `nums`. The function should calculate and return the sum of values obtained for each subarray, where the value for a subarray is the square of the count of distinct elements within that subarray. -...
-- !benchmark @start import type=solution import Std.Data.HashSet open Std -- !benchmark @end import -- !benchmark @start solution_aux -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible] def solution_precond (nums : List Nat) : Prop := -- !benchmark @start ...
{ "name": "solution", "parameters": { "param_name": [ "nums" ], "param_type": [ "List Nat" ] }, "return_type": "Nat" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/subarrays-distinct-element-sum-of-squares-i/", "task_id": "lab_solution_324856546", "student_id": [ 52 ] } }
{ "input": [ "{\"nums\": \"[1]\"}", "{\"nums\": \"[1, 1, 1]\"}", "{\"nums\": \"[1, 2, 1]\"}", "{\"nums\": \"[1, 2, 3, 4]\"}", "{\"nums\": \"[1, 2, 2, 3, 1]\"}" ], "expected": [ [ "1" ], [ "6" ], [ "15" ], [ "50" ], [ "62" ] ...
{ "input": [ "{'nums': '[]'}", "{'nums': '[101]'}" ] }
advanced
verina_advanced_27
-----Description----- This task requires writing a Lean 4 function that computes the longest common subsequence (LCS) of two input strings. A subsequence of a string is a sequence that can be derived from the original string by deleting zero or more characters (not necessarily contiguous) without changing the order 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] def longestCommonSubsequence_precond (s1 : String) (s2 : String) : Prop := -- !benchmark @start precon...
{ "name": "longestCommonSubsequence", "parameters": { "param_name": [ "s1", "s2" ], "param_type": [ "String", "String" ] }, "return_type": "String" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/longest-common-subsequence/description/", "task_id": "lab_longestCommonSubsequence_325767793", "student_id": [ 21 ] } }
{ "input": [ "{\"s1\": \"abcde\", \"s2\": \"ace\"}", "{\"s1\": \"aaaa\", \"s2\": \"bbaaa\"}", "{\"s1\": \"xyz\", \"s2\": \"abc\"}", "{\"s1\": \"axbxc\", \"s2\": \"abxc\"}", "{\"s1\": \"AGGTAB\", \"s2\": \"GXTXAYB\"}" ], "expected": [ [ "ace" ], [ "aaa" ], [ ...
{ "input": [] }
advanced
verina_advanced_15
-----Description----- Given an integer array nums, return true if there exists a triple of indices (i, j, k) such that i < j < k and nums[i] < nums[j] < nums[k]. If no such indices exist, return false. -----Input----- The input consists of a single list: nums: A list of integers. -----Output----- The output is a bool...
-- !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 increasingTriplet_precond (nums : List Int) : Prop := -- !benchmark @start precond True -- !be...
{ "name": "increasingTriplet", "parameters": { "param_name": [ "nums" ], "param_type": [ "List Int" ] }, "return_type": "Bool" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/increasing-triplet-subsequence?envType=study-plan-v2&envId=leetcode-75", "task_id": "lab_increasingTriplet_324678911", "student_id": [ 6 ] } }
{ "input": [ "{\"nums\": \"[1, 2, 3]\"}", "{\"nums\": \"[5, 4, 3, 2, 1]\"}", "{\"nums\": \"[2, 1, 5, 0, 4, 6]\"}", "{\"nums\": \"[1, 5, 0, 4, 1, 3]\"}", "{\"nums\": \"[5, 4, 3]\"}", "{\"nums\": \"[]\"}" ], "expected": [ [ "True" ], [ "False" ], [ "True...
{ "input": [] }
advanced
verina_basic_24
-----Description----- This task requires writing a Lean 4 method that finds the difference between the first even number and the first odd number in an array of integers. The method should process the array sequentially until it identifies the first even number and the first odd number, and then return the difference ...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux def isEven (n : Int) : Bool := n % 2 == 0 def isOdd (n : Int) : Bool := n % 2 != 0 -- !benchmark @end solution_aux -- !benchmark @start precond_aux -- !benchmark @end precond_aux @[reducible, simp] def firstE...
{ "name": "firstEvenOddDifference", "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_594", "student_id": null } }
{ "input": [ "{\"a\": \"#[2, 3, 4, 5]\"}", "{\"a\": \"#[1, 4, 6, 8]\"}", "{\"a\": \"#[7, 2, 9, 4]\"}", "{\"a\": \"#[2, 2, 3, 3]\"}", "{\"a\": \"#[1, 1, 2, 2]\"}" ], "expected": [ [ "-1" ], [ "3" ], [ "-5" ], [ "-1" ], [ "1" ...
{ "input": [ "{'a': '#[2]'}" ] }
basic
verina_advanced_76
-----Description----- This task requires writing a Lean 4 method that returns the k most frequent elements from a list of integers. The method should count the frequency of each distinct element in the list and return the k elements with the highest frequency. -----Input----- The input consists of two values: nums: 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 topKFrequent_precond (nums : List Int) (k : Nat) : Prop := -- !benchmark @start precond k ≤ nums...
{ "name": "topKFrequent", "parameters": { "param_name": [ "nums", "k" ], "param_type": [ "List Int", "Nat" ] }, "return_type": "List Int" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/top-k-frequent-elements/description/", "task_id": "lab_topKFrequent_325315163", "student_id": [ 54 ] } }
{ "input": [ "{\"nums\": \"[1, 1, 1, 2, 2, 3]\", \"k\": 2}", "{\"nums\": \"[4, 1, -1, 2, -1, 2, 3]\", \"k\": 2}", "{\"nums\": \"[5]\", \"k\": 1}", "{\"nums\": \"[7, 7, 7, 8, 8, 9]\", \"k\": 1}", "{\"nums\": \"[]\", \"k\": 0}" ], "expected": [ [ "[1, 2]" ], [ "[-1, 2]" ...
{ "input": [ "{'nums': '[1, 2, 3]', 'k': 4}" ] }
advanced
verina_advanced_26
-----Description----- This task requires writing a Lean 4 method that generates all possible letter combinations from a string of digits based on the traditional telephone keypad letter mappings. -----Input----- The input consists of a string (String). The string may be empty. -----Output----- The output is a list o...
-- !benchmark @start import type=solution -- !benchmark @end import -- !benchmark @start solution_aux def digitToLetters (c : Char) : List Char := match c with | '2' => ['a', 'b', 'c'] | '3' => ['d', 'e', 'f'] | '4' => ['g', 'h', 'i'] | '5' => ['j', 'k', 'l'] | '6' => ['m', 'n', 'o'] | '7' => ['p', 'q',...
{ "name": "letterCombinations", "parameters": { "param_name": [ "digits" ], "param_type": [ "String" ] }, "return_type": "List String" }
{ "upstream": { "name": "lab_assignment", "link": "https://leetcode.com/problems/letter-combinations-of-a-phone-number/description/", "task_id": "lab_letterCombinations_325016944", "student_id": [ 20 ] } }
{ "input": [ "{\"digits\": \"\"}", "{\"digits\": \"2\"}", "{\"digits\": \"9\"}", "{\"digits\": \"23\"}", "{\"digits\": \"27\"}", "{\"digits\": \"0\"}", "{\"digits\": \"21\"}" ], "expected": [ [ "[]" ], [ "[\"a\", \"b\", \"c\"]" ], [ "[\"w\", \"x\",...
{ "input": [] }
advanced
verina_basic_80
-----Description----- This task involves determining whether a specified key appears exactly once in an array. The goal is to verify the uniqueness of the key's occurrence without prescribing any specific approach or implementation method. -----Input----- The input consists of: • a: An array of integers. • key...
-- !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 only_once_precond (a : Array Int) (key : Int) : Prop := -- !benchmark @start precond True ...
{ "name": "only_once", "parameters": { "param_name": [ "a", "key" ], "param_type": [ "Array Int", "Int" ] }, "return_type": "Bool" }
{ "upstream": { "name": "clover", "link": "https://github.com/ChuyueSun/Clover", "task_id": "Clover_only_once", "student_id": null } }
{ "input": [ "{\"a\": \"#[1, 2, 3, 4]\", \"key\": 2}", "{\"a\": \"#[1, 2, 2, 3, 4]\", \"key\": 2}", "{\"a\": \"#[1, 1, 1, 1]\", \"key\": 1}", "{\"a\": \"#[10]\", \"key\": 10}", "{\"a\": \"#[]\", \"key\": 5}" ], "expected": [ [ "true" ], [ "false" ], [ "fal...
{ "input": [] }
basic