Dataset Viewer
Auto-converted to Parquet
task
stringlengths
120
1.39k
edge_weight
listlengths
5
5
mask
listlengths
5
5
def strlen(string: str) -> int: """ Return length of given string >>> strlen('') 0 >>> strlen('abc') 3 """
[ [ 0, 0.7310585975646973, 0.5459527969360352, 0.5714032053947449, 0.3744261860847473 ], [ 0, 0, 0.5459527969360352, 0.5714032053947449, 0.3744261860847473 ], [ 0, 0, 0, 0.43433743715286255, 0.3160649240016937 ], [ 0, 0, 0, 0, 0.32281172275543213 ], [ 0, 0, 0, 0.32281172275543213, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def encrypt(s: str) -> str: """Create a function encrypt that takes a string as an argument and returns a string encrypted with the alphabet being rotated. The alphabet should be rotated in a manner such that the letters shift down by two multiplied to two places. For example: >>> encrypt('hi') 'lm' >>> encrypt('asdfghjkl') 'ewhjklnop' >>> encrypt('gf') 'kj' >>> encrypt('et') 'ix' """
[ [ 0, 0.7310585975646973, 0.5361953973770142, 0.5466917753219604, 0.3652215301990509 ], [ 0, 0, 0.5361953973770142, 0.5466917753219604, 0.3652215301990509 ], [ 0.5361953973770142, 0.5361953973770142, 0, 0.4151560068130493, 0.3113667070865631 ], [ 0.5466917753219604, 0.5466917753219604, 0, 0, 0.3134291470050812 ], [ 0, 0, 0, 0.3134291470050812, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import Dict def check_dict_case(dict: Dict[str, str]) -> bool: """ Given a dictionary, return True if all keys are strings in lower case or all keys are strings in upper case, else return False. The function should return False is the given dictionary is empty. Examples: >>> check_dict_case({ 'a': 'apple', 'b': 'banana' }) True >>> check_dict_case({ 'a': 'apple', 'A': 'banana', 'B': 'banana' }) False >>> check_dict_case({ 'a': 'apple', 8: 'banana', 'a': 'apple' }) False >>> check_dict_case({ 'Name': 'John', 'Age': '36', 'City': 'Houston' }) False >>> check_dict_case({ 'STATE': 'NC', 'ZIP': '12345' }) True """
[ [ 0, 0.7310585975646973, 0.5638694763183594, 0.5860448479652405, 0.3892608880996704 ], [ 0, 0, 0.5638694763183594, 0.5860448479652405, 0.3892608880996704 ], [ 0.5638694763183594, 0.5638694763183594, 0, 0.45396485924720764, 0.3255983889102936 ], [ 0, 0, 0, 0, 0.33271223306655884 ], [ 0, 0, 0, 0.33271223306655884, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def add(lst: List[int]) -> int: """Given a non-empty list of integers lst. add the even elements that are at odd indices.. Examples: >>> add([4, 2, 6, 7]) 2 """
[ [ 0, 0.7310585975646973, 0.5917603969573975, 0.6037102341651917, 0.4078986942768097 ], [ 0, 0, 0.5917603969573975, 0.6037102341651917, 0.4078986942768097 ], [ 0, 0, 0, 0.48488569259643555, 0.3416709303855896 ], [ 0, 0, 0, 0, 0.3462536036968231 ], [ 0.4078986942768097, 0.4078986942768097, 0.3416709303855896, 0.3462536036968231, 0 ] ]
[ 0, 0, 0, 0, 1 ]
def fibfib(n: int) -> int: """The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows: fibfib(0) == 0 fibfib(1) == 0 fibfib(2) == 1 fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3). Please write a function to efficiently compute the n-th element of the fibfib number sequence. >>> fibfib(1) 0 >>> fibfib(5) 4 >>> fibfib(8) 24 """
[ [ 0, 0.7310585975646973, 0.5725210905075073, 0.5909836888313293, 0.3961414694786072 ], [ 0, 0, 0.5725210905075073, 0.5909836888313293, 0.3961414694786072 ], [ 0, 0, 0, 0.462358683347702, 0.33030572533607483 ], [ 0.5909836888313293, 0.5909836888313293, 0.462358683347702, 0, 0.33682766556739807 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 1, 1 ]
from typing import List, Any def filter_integers(values: List[Any]) -> List[int]: """ Filter given list of any python values only for integers >>> filter_integers(['a', 3.14, 5]) [5] >>> filter_integers([1, 2, 3, 'abc', { }, []]) [1, 2, 3] """
[ [ 0, 0.7310585975646973, 0.6458622813224792, 0.6326209902763367, 0.43708816170692444 ], [ 0, 0, 0.6458622813224792, 0.6326209902763367, 0.43708816170692444 ], [ 0, 0, 0, 0.5512309074401855, 0.380502849817276 ], [ 0.6326209902763367, 0.6326209902763367, 0.5512309074401855, 0, 0.37198930978775024 ], [ 0, 0, 0.380502849817276, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def car_race_collision(n: int) -> int: """ Imagine a road that's a perfectly straight infinitely long line. n cars are driving left to right; simultaneously, a different set of n cars are driving right to left. The two sets of cars start out being very far from each other. All cars move in the same speed. Two cars are said to collide when a car that's moving left to right hits a car that's moving right to left. However, the cars are infinitely sturdy and strong; as a result, they continue moving in their trajectory as if they did not collide. This function outputs the number of such collisions. """
[ [ 0, 0.7310585975646973, 0.5742687582969666, 0.5938686728477478, 0.3972034752368927 ], [ 0, 0, 0.5742687582969666, 0.5938686728477478, 0.3972034752368927 ], [ 0, 0, 0, 0.465483158826828, 0.33116966485977173 ], [ 0, 0, 0.465483158826828, 0, 0.33824780583381653 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def parse_music(music_string: str) -> List[int]: """ Input to this function is a string representing musical notes in a special ASCII format. Your task is to parse this string and return list of integers corresponding to how many beats does each not last. Here is a legend: 'o' - whole note, lasts four beats 'o|' - half note, lasts two beats '.|' - quater note, lasts one beat >>> parse_music('o o| .| o| o| .| .| .| .| o o') [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4] """
[ [ 0, 0.7310585975646973, 0.5831202864646912, 0.5988083481788635, 0.40273162722587585 ], [ 0, 0, 0.5831202864646912, 0.5988083481788635, 0.40273162722587585 ], [ 0, 0, 0, 0.4751892387866974, 0.33646705746650696 ], [ 0, 0, 0, 0, 0.34230419993400574 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def decimal_to_binary(decimal: int) -> str: """You will be given a number in decimal form and your task is to convert it to binary format. The function should return a string, with each character representing a binary number. Each character in the string will be '0' or '1'. There will be an extra couple of characters 'db' at the beginning and at the end of the string. The extra characters are there to help with the format. Examples: >>> decimal_to_binary(15) 'db1111db' >>> decimal_to_binary(32) 'db100000db' """
[ [ 0, 0.7310585975646973, 0.5360420346260071, 0.5598841905593872, 0.3656363785266876 ], [ 0, 0, 0.5360420346260071, 0.5598841905593872, 0.3656363785266876 ], [ 0, 0.5360420346260071, 0, 0.4224376380443573, 0.3112088441848755 ], [ 0, 0, 0.4224376380443573, 0, 0.31671246886253357 ], [ 0, 0, 0.3112088441848755, 0, 0 ] ]
[ 0, 0, 1, 0, 0 ]
from typing import List def all_prefixes(string: str) -> List[str]: """ Return list of all prefixes from shortest to longest of the input string >>> all_prefixes('abc') ['a', 'ab', 'abc'] """
[ [ 0, 0.7310585975646973, 0.5559654235839844, 0.5758942365646362, 0.3821430206298828 ], [ 0, 0, 0.5559654235839844, 0.5758942365646362, 0.3821430206298828 ], [ 0, 0.5559654235839844, 0, 0.44295763969421387, 0.32128581404685974 ], [ 0, 0, 0, 0, 0.3269478380680084 ], [ 0, 0.3821430206298828, 0, 0.3269478380680084, 0 ] ]
[ 0, 0, 0, 0, 1 ]
def add(x: int, y: int) -> int: """Add two numbers x and y >>> add(2, 3) 5 >>> add(5, 7) 12 """
[ [ 0, 0.7310585975646973, 0.5831549167633057, 0.5988715291023254, 0.40312984585762024 ], [ 0, 0, 0.5831549167633057, 0.5988715291023254, 0.40312984585762024 ], [ 0, 0, 0, 0.4750344157218933, 0.3364291489124298 ], [ 0, 0, 0, 0, 0.3423990309238434 ], [ 0, 0, 0.3364291489124298, 0.3423990309238434, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def flip_case(string: str) -> str: """ For a given string, flip lowercase characters to uppercase and uppercase to lowercase. >>> flip_case('Hello') 'hELLO' """
[ [ 0, 0.7310585975646973, 0.5291882157325745, 0.5488349795341492, 0.3592526614665985 ], [ 0, 0, 0.5291882157325745, 0.5488349795341492, 0.3592526614665985 ], [ 0.5291882157325745, 0.5291882157325745, 0, 0.4130275547504425, 0.3080199062824249 ], [ 0, 0, 0, 0, 0.31195443868637085 ], [ 0.3592526614665985, 0.3592526614665985, 0, 0.31195443868637085, 0 ] ]
[ 0, 0, 0, 1, 1 ]
from typing import List def by_length(arr: List[int]) -> List[str]: """ Given an array of integers, sort the integers that are between 1 and 9 inclusive, reverse the resulting array, and then replace each digit by its corresponding name from "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine". For example: >>> by_length([2, 1, 1, 4, 5, 8, 2, 3]) ['Eight', 'Five', 'Four', 'Three', 'Two', 'Two', 'One', 'One'] If the array is empty, return an empty array: >>> by_length([]) [] If the array has any strange number ignore it: >>> by_length([1, -1, 55]) ['One'] """
[ [ 0, 0.7310585975646973, 0.5944650173187256, 0.6051067113876343, 0.410251259803772 ], [ 0, 0, 0.5944650173187256, 0.6051067113876343, 0.410251259803772 ], [ 0, 0.5944650173187256, 0, 0.48766735196113586, 0.3435167372226715 ], [ 0, 0, 0, 0, 0.3476908504962921 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def factorize(n: int) -> List[int]: """ Return list of prime factors of given integer in the order from smallest to largest. Each of the factors should be listed number of times corresponding to how many times it appeares in factorization. Input number should be equal to the product of all factors >>> factorize(8) [2, 2, 2] >>> factorize(25) [5, 5] >>> factorize(70) [2, 5, 7] """
[ [ 0, 0.7310585975646973, 0.5900800228118896, 0.6027089357376099, 0.40773141384124756 ], [ 0, 0, 0.5900800228118896, 0.6027089357376099, 0.40773141384124756 ], [ 0, 0.5900800228118896, 0, 0.48259904980659485, 0.3406849801540375 ], [ 0, 0.6027089357376099, 0, 0, 0.34566929936408997 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def count_up_to(n: int) -> List[int]: """Implement a function that takes an non-negative integer and returns an array of the first n integers that are prime numbers and less than n. for example: >>> count_up_to(5) [2, 3] >>> count_up_to(11) [2, 3, 5, 7] >>> count_up_to(0) [] >>> count_up_to(20) [2, 3, 5, 7, 11, 13, 17, 19] >>> count_up_to(1) [] >>> count_up_to(18) [2, 3, 5, 7, 11, 13, 17] """
[ [ 0, 0.7310585975646973, 0.6102949380874634, 0.6138947010040283, 0.41964709758758545 ], [ 0.7310585975646973, 0, 0.6102949380874634, 0.6138947010040283, 0.41964709758758545 ], [ 0, 0, 0, 0.5059905052185059, 0.35375046730041504 ], [ 0, 0, 0.5059905052185059, 0, 0.35511690378189087 ], [ 0.41964709758758545, 0.41964709758758545, 0.35375046730041504, 0.35511690378189087, 0 ] ]
[ 0, 0, 0, 0, 1 ]
from typing import List def unique(l: List[int]) -> List[int]: """Return sorted unique elements in a list >>> unique([5, 3, 5, 2, 3, 3, 9, 0, 123]) [0, 2, 3, 5, 9, 123] """
[ [ 0, 0.7310585975646973, 0.5864791870117188, 0.6006300449371338, 0.40503692626953125 ], [ 0, 0, 0.5864791870117188, 0.6006300449371338, 0.40503692626953125 ], [ 0, 0, 0, 0.4788343012332916, 0.33857831358909607 ], [ 0.6006300449371338, 0.6006300449371338, 0.4788343012332916, 0, 0.3439120650291443 ], [ 0, 0, 0.33857831358909607, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def max_element(l: List[int]) -> int: """Return maximum element in the list. >>> max_element([1, 2, 3]) 3 >>> max_element([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) 123 """
[ [ 0, 0.7310585975646973, 0.5832149386405945, 0.5988035202026367, 0.40277957916259766 ], [ 0, 0, 0.5832149386405945, 0.5988035202026367, 0.40277957916259766 ], [ 0, 0, 0, 0.47531503438949585, 0.3365890085697174 ], [ 0, 0, 0.47531503438949585, 0, 0.3423502445220947 ], [ 0, 0, 0, 0.3423502445220947, 0 ] ]
[ 0, 0, 0, 0, 1 ]
from typing import Union def rounded_avg(n: int, m: int) -> Union[str, int]: """You are given two positive integers n and m, and your task is to compute the average of the integers from n through m (including n and m). Round the answer to the nearest integer and convert that to binary. If n is greater than m, return -1. Example: >>> rounded_avg(1, 5) '0b11' >>> rounded_avg(7, 5) -1 >>> rounded_avg(10, 20) '0b1111' >>> rounded_avg(20, 33) '0b11010' """
[ [ 0, 0.7310585975646973, 0.5847081542015076, 0.599746584892273, 0.40404918789863586 ], [ 0, 0, 0.5847081542015076, 0.599746584892273, 0.40404918789863586 ], [ 0, 0, 0, 0.4767725467681885, 0.337362676858902 ], [ 0, 0, 0.4767725467681885, 0, 0.3431037366390228 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def odd_count(lst: List[str]) -> List[str]: """Given a list of strings, where each string consists of only digits, return a list. Each element i of the output should be "the number of odd elements in the string i of the input." where all the i's should be replaced by the number of odd digits in the i'th string of the input. >>> odd_count(['1234567']) ['the number of odd elements 4n the str4ng 4 of the 4nput.'] >>> odd_count(['3', '11111111']) ['the number of odd elements 1n the str1ng 1 of the 1nput.', 'the number of odd elements 8n the str8ng 8 of the 8nput.'] """
[ [ 0, 0.7310585975646973, 0.5618352890014648, 0.5864667296409607, 0.3857838809490204 ], [ 0, 0, 0.5618352890014648, 0.5864667296409607, 0.3857838809490204 ], [ 0, 0, 0, 0.45361289381980896, 0.3241393268108368 ], [ 0.5864667296409607, 0.5864667296409607, 0.45361289381980896, 0, 0.3316294252872467 ], [ 0, 0.3857838809490204, 0.3241393268108368, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def move_one_ball(arr: List[int]) -> bool: """We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The numbers in the array will be randomly ordered. Your task is to determine if it is possible to get an array sorted in non-decreasing order by performing the following operation on the given array: You are allowed to perform right shift operation any number of times. One right shift operation means shifting all elements of the array by one position in the right direction. The last element of the array will be moved to the starting position in the array i.e. 0th index. If it is possible to obtain the sorted array by performing the above operation then return True else return False. If the given array is empty then return True. Note: The given list is guaranteed to have unique elements. For Example: >>> move_one_ball([3, 4, 5, 1, 2]) True Explanation: By performin 2 right shift operations, non-decreasing order can be achieved for the given array. >>> move_one_ball([3, 5, 4, 1, 2]) False Explanation:It is not possible to get non-decreasing order for the given array by performing any number of right shift operations. """
[ [ 0, 0.7310585975646973, 0.5880574584007263, 0.6016290783882141, 0.40647369623184204 ], [ 0.7310585975646973, 0, 0.5880574584007263, 0.6016290783882141, 0.40647369623184204 ], [ 0, 0, 0, 0.4803132712841034, 0.33936551213264465 ], [ 0.6016290783882141, 0, 0.4803132712841034, 0, 0.344719260931015 ], [ 0, 0, 0.33936551213264465, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import Tuple def even_odd_palindrome(n: int) -> Tuple[int, int]: """ Given a positive integer n, return a tuple that has the number of even and odd integer palindromes that fall within the range(1, n), inclusive. Example 1: >>> even_odd_palindrome(3) (1, 2) Explanation: Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd. Example 2: >>> even_odd_palindrome(12) (4, 6) Explanation: Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd. Note: 1. 1 <= n <= 10^3 2. returned tuple has the number of even and odd integer palindromes respectively. """
[ [ 0, 0.7310585975646973, 0.5764344334602356, 0.5950533151626587, 0.39804208278656006 ], [ 0, 0, 0.5764344334602356, 0.5950533151626587, 0.39804208278656006 ], [ 0, 0.5764344334602356, 0, 0.4680807590484619, 0.33247560262680054 ], [ 0, 0.5950533151626587, 0, 0, 0.3391137719154358 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def is_equal_to_sum_even(n: int) -> bool: """Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers Example >>> is_equal_to_sum_even(4) False >>> is_equal_to_sum_even(6) False >>> is_equal_to_sum_even(8) True """
[ [ 0, 0.7310585975646973, 0.577495813369751, 0.5957269072532654, 0.39879825711250305 ], [ 0, 0, 0.577495813369751, 0.5957269072532654, 0.39879825711250305 ], [ 0, 0, 0, 0.4691532850265503, 0.3329944908618927 ], [ 0, 0, 0, 0, 0.3396034240722656 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def derivative(xs: List[int]) -> List[int]: """ xs represent coefficients of a polynomial. xs[0] + xs[1] * x + xs[2] * x^2 + .... Return derivative of this polynomial in the same form. >>> derivative([3, 1, 2, 4, 5]) [1, 4, 12, 20] >>> derivative([1, 2, 3]) [2, 6] """
[ [ 0, 0.7310585975646973, 0.5846138596534729, 0.5996387600898743, 0.4038187563419342 ], [ 0, 0, 0.5846138596534729, 0.5996387600898743, 0.4038187563419342 ], [ 0, 0.5846138596534729, 0, 0.47677120566368103, 0.33737748861312866 ], [ 0, 0, 0.47677120566368103, 0, 0.34302982687950134 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def solve(s: str) -> str: """You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string. Examples >>> solve('1234') '4321' >>> solve('ab') 'AB' >>> solve('#a@C') '#A@c' """
[ [ 0, 0.7310585975646973, 0.5270752906799316, 0.5494014620780945, 0.3576663136482239 ], [ 0, 0, 0.5270752906799316, 0.5494014620780945, 0.3576663136482239 ], [ 0, 0, 0, 0.41221871972084045, 0.3070538640022278 ], [ 0, 0, 0.41221871972084045, 0, 0.3115081489086151 ], [ 0.3576663136482239, 0.3576663136482239, 0.3070538640022278, 0.3115081489086151, 0 ] ]
[ 0, 0, 1, 1, 1 ]
def fizz_buzz(n: int) -> int: """Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13. >>> fizz_buzz(50) 0 >>> fizz_buzz(78) 2 >>> fizz_buzz(79) 3 """
[ [ 0, 0.7310585975646973, 0.5811337828636169, 0.597224235534668, 0.40191125869750977 ], [ 0.7310585975646973, 0, 0.5811337828636169, 0.597224235534668, 0.40191125869750977 ], [ 0, 0, 0, 0.47240468859672546, 0.3352111876010895 ], [ 0, 0, 0, 0, 0.3412751257419586 ], [ 0, 0, 0, 0.3412751257419586, 0 ] ]
[ 0, 0, 0, 0, 1 ]
from typing import List def filter_by_prefix(strings: List[str], prefix: str) -> List[str]: """ Filter an input list of strings only for ones that start with a given prefix. >>> filter_by_prefix([], 'a') [] >>> filter_by_prefix(['abc', 'bcd', 'cde', 'array'], 'a') ['abc', 'array'] """
[ [ 0, 0.7310585975646973, 0.5842877626419067, 0.5980392694473267, 0.40381038188934326 ], [ 0, 0, 0.5842877626419067, 0.5980392694473267, 0.40381038188934326 ], [ 0, 0, 0, 0.47546568512916565, 0.33741775155067444 ], [ 0, 0, 0, 0, 0.342448353767395 ], [ 0.40381038188934326, 0.40381038188934326, 0.33741775155067444, 0.342448353767395, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def minPath(grid: List[List[int]], k: int) -> List[int]: """ Given a grid with N rows and N columns (N >= 2) and a positive integer k, each cell of the grid contains a value. Every integer in the range [1, N * N] inclusive appears exactly once on the cells of the grid. You have to find the minimum path of length k in the grid. You can start from any cell, and in each step you can move to any of the neighbor cells, in other words, you can go to cells which share an edge with you current cell. Please note that a path of length k means visiting exactly k cells (not necessarily distinct). You CANNOT go off the grid. A path A (of length k) is considered less than a path B (of length k) if after making the ordered lists of the values on the cells that A and B go through (let's call them lst_A and lst_B), lst_A is lexicographically less than lst_B, in other words, there exist an integer index i (1 <= i <= k) such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have lst_A[j] = lst_B[j]. It is guaranteed that the answer is unique. Return an ordered list of the values on the cells that the minimum path go through. Examples: >>> minPath([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 3) [1, 2, 1] >>> minPath([[5, 9, 3], [4, 1, 6], [7, 8, 2]], 1) [1] """
[ [ 0, 0.7310585975646973, 0.561525821685791, 0.5859988331794739, 0.38759687542915344 ], [ 0, 0, 0.561525821685791, 0.5859988331794739, 0.38759687542915344 ], [ 0, 0.561525821685791, 0, 0.45243874192237854, 0.3242640793323517 ], [ 0, 0, 0, 0, 0.3320569396018982 ], [ 0, 0, 0, 0.3320569396018982, 0 ] ]
[ 0, 0, 0, 1, 1 ]
def count_upper(s: str) -> int: """ Given a string s, count the number of uppercase vowels in even indices. For example: >>> count_upper('aBCdEf') 1 >>> count_upper('abcdefg') 0 >>> count_upper('dBBE') 0 """
[ [ 0, 0.7310585975646973, 0.5335609316825867, 0.556732714176178, 0.363095223903656 ], [ 0.7310585975646973, 0, 0.5335609316825867, 0.556732714176178, 0.363095223903656 ], [ 0, 0, 0, 0.41963258385658264, 0.3100614845752716 ], [ 0.556732714176178, 0.556732714176178, 0.41963258385658264, 0, 0.3150981366634369 ], [ 0.363095223903656, 0, 0.3100614845752716, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def maximum(arr: List[int], k: int) -> List[int]: """ Given an array arr of integers and a positive integer k, return a sorted list of length k with the maximum k numbers in arr. Example 1: >>> maximum([-3, -4, 5], 3) [-4, -3, 5] Example 2: >>> maximum([4, -4, 4], 2) [4, 4] Example 3: >>> maximum([-3, 2, 1, 2, -1, -2, 1], 1) [2] Note: 1. The length of the array will be in the range of [1, 1000]. 2. The elements in the array will be in the range of [-1000, 1000]. 3. 0 <= k <= len(arr) """
[ [ 0, 0.7310585975646973, 0.5892570614814758, 0.6021843552589417, 0.4070928692817688 ], [ 0, 0, 0.5892570614814758, 0.6021843552589417, 0.4070928692817688 ], [ 0, 0.5892570614814758, 0, 0.4817778468132019, 0.3402806222438812 ], [ 0, 0, 0, 0, 0.34527403116226196 ], [ 0, 0.4070928692817688, 0, 0.34527403116226196, 0 ] ]
[ 0, 0, 0, 0, 1 ]
def largest_divisor(n: int) -> int: """ For a given number n, find the largest number that divides n evenly, smaller than n >>> largest_divisor(15) 5 """
[ [ 0, 0.7310585975646973, 0.5651302337646484, 0.5879199504852295, 0.3908939063549042 ], [ 0, 0, 0.5651302337646484, 0.5879199504852295, 0.3908939063549042 ], [ 0, 0, 0, 0.4557155668735504, 0.32628777623176575 ], [ 0, 0, 0, 0, 0.33387142419815063 ], [ 0, 0, 0.32628777623176575, 0.33387142419815063, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def sort_array(array: List[int]) -> List[int]: """ Given an array of non-negative integers, return a copy of the given array after sorting, you will sort the given array in ascending order if the sum( first index value, last index value) is odd, or sort it in descending order if the sum( first index value, last index value) is even. Note: * don't change the given array. Examples: >>> sort_array([]) [] >>> sort_array([5]) [5] >>> sort_array([2, 4, 3, 0, 1, 5]) [0, 1, 2, 3, 4, 5] >>> sort_array([2, 4, 3, 0, 1, 5, 6]) [6, 5, 4, 3, 2, 1, 0] """
[ [ 0, 0.7310585975646973, 0.5914967656135559, 0.6035051941871643, 0.40835583209991455 ], [ 0, 0, 0.5914967656135559, 0.6035051941871643, 0.40835583209991455 ], [ 0, 0.5914967656135559, 0, 0.4843255579471588, 0.3415861427783966 ], [ 0, 0.6035051941871643, 0, 0, 0.3462822139263153 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def f(n: int) -> List[int]: """ Implement the function f that takes n as a parameter, and returns a list of size n, such that the value of the element at index i is the factorial of i if i is even or the sum of numbers from 1 to i otherwise. i starts from 1. the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i). Example: >>> f(5) [1, 2, 6, 24, 15] """
[ [ 0, 0.7310585975646973, 0.6031373739242554, 0.61001056432724, 0.4155429005622864 ], [ 0, 0, 0.6031373739242554, 0.61001056432724, 0.4155429005622864 ], [ 0, 0, 0, 0.49752524495124817, 0.34891822934150696 ], [ 0, 0, 0, 0, 0.35174667835235596 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 1 ]
def iscube(a: int) -> bool: """ Write a function that takes an integer a and returns True if this ingeger is a cube of some integer number. Note: you may assume the input is always valid. Examples: >>> iscube(1) True >>> iscube(2) False >>> iscube(-1) True >>> iscube(64) True >>> iscube(0) True >>> iscube(180) False """
[ [ 0, 0.7310585975646973, 0.5957325100898743, 0.6059268116950989, 0.4113304913043976 ], [ 0.7310585975646973, 0, 0.5957325100898743, 0.6059268116950989, 0.4113304913043976 ], [ 0, 0, 0, 0.4888753294944763, 0.34410718083381653 ], [ 0, 0, 0.4888753294944763, 0, 0.3483148217201233 ], [ 0.4113304913043976, 0, 0.34410718083381653, 0.3483148217201233, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def pairs_sum_to_zero(l: List[int]) -> bool: """ pairs_sum_to_zero takes a list of integers as an input. it returns True if there are two distinct elements in the list that sum to zero, and False otherwise. >>> pairs_sum_to_zero([1, 3, 5, 0]) False >>> pairs_sum_to_zero([1, 3, -2, 1]) False >>> pairs_sum_to_zero([1, 2, 3, 7]) False >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7]) True >>> pairs_sum_to_zero([1]) False """
[ [ 0, 0.7310585975646973, 0.5902866721153259, 0.6029381155967712, 0.4070470631122589 ], [ 0, 0, 0.5902866721153259, 0.6029381155967712, 0.4070470631122589 ], [ 0, 0.5902866721153259, 0, 0.48316827416419983, 0.34067603945732117 ], [ 0, 0.6029381155967712, 0, 0, 0.3455675542354584 ], [ 0, 0.4070470631122589, 0, 0.3455675542354584, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def triangle_area(a: int, b: int, c: int) -> float: """ Given the lengths of the three sides of a triangle. Return the area of the triangle rounded to 2 decimal points if the three sides form a valid triangle. Otherwise return -1 Three sides make a valid triangle when the sum of any two sides is greater than the third side. Example: >>> triangle_area(3, 4, 5) 6.0 >>> triangle_area(1, 2, 10) -1 """
[ [ 0, 0.7310585975646973, 0.5786261558532715, 0.5963612198829651, 0.3999643623828888 ], [ 0, 0, 0.5786261558532715, 0.5963612198829651, 0.3999643623828888 ], [ 0, 0, 0, 0.4701862633228302, 0.33367031812667847 ], [ 0, 0, 0, 0, 0.3402319550514221 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 1 ]
from typing import Tuple def bf(planet1: str, planet2: str) -> Tuple[str, ...]: """ There are eight planets in our solar system: the closerst to the Sun is Mercury, the next one is Venus, then Earth, Mars, Jupiter, Saturn, Uranus, Neptune. Write a function that takes two planet names as strings planet1 and planet2. The function should return a tuple containing all planets whose orbits are located between the orbit of planet1 and the orbit of planet2, sorted by the proximity to the sun. The function should return an empty tuple if planet1 or planet2 are not correct planet names. Examples >>> bf('Jupiter', 'Neptune') ('Saturn', 'Uranus') >>> bf('Earth', 'Mercury') 'Venus' >>> bf('Mercury', 'Uranus') ('Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn') """
[ [ 0, 0.7310585975646973, 0.5407697558403015, 0.5638874173164368, 0.36994311213493347 ], [ 0.7310585975646973, 0, 0.5407697558403015, 0.5638874173164368, 0.36994311213493347 ], [ 0.5407697558403015, 0, 0, 0.42708975076675415, 0.31352806091308594 ], [ 0.5638874173164368, 0, 0, 0, 0.31921038031578064 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 1 ]
def digits(n: int) -> int: """Given a positive integer n, return the product of the odd digits. Return 0 if all digits are even. For example: >>> digits(1) 1 >>> digits(4) 0 >>> digits(235) 15 """
[ [ 0, 0.7310585975646973, 0.5786634683609009, 0.595920741558075, 0.3995455801486969 ], [ 0, 0, 0.5786634683609009, 0.595920741558075, 0.3995455801486969 ], [ 0, 0.5786634683609009, 0, 0.47009897232055664, 0.3337024748325348 ], [ 0, 0.595920741558075, 0, 0, 0.3399713933467865 ], [ 0.3995455801486969, 0.3995455801486969, 0.3337024748325348, 0.3399713933467865, 0 ] ]
[ 0, 0, 0, 0, 1 ]
from typing import List def words_string(s: str) -> List[str]: """ You will be given a string of words separated by commas or spaces. Your task is to split the string into words and return an array of the words. For example: >>> words_string('Hi, my name is John') ['Hi', 'my', 'name', 'is', 'John'] >>> words_string('One, two, three, four, five, six') ['One', 'two', 'three', 'four', 'five', 'six'] """
[ [ 0, 0.7310585975646973, 0.5454996228218079, 0.5630558133125305, 0.37295737862586975 ], [ 0, 0, 0.5454996228218079, 0.5630558133125305, 0.37295737862586975 ], [ 0, 0, 0, 0.42955106496810913, 0.3158920109272003 ], [ 0, 0, 0.42955106496810913, 0, 0.320150226354599 ], [ 0, 0, 0, 0.320150226354599, 0 ] ]
[ 0, 0, 0, 0, 1 ]
def how_many_times(string: str, substring: str) -> int: """ Find how many times a given substring can be found in the original string. Count overlaping cases. >>> how_many_times('', 'a') 0 >>> how_many_times('aaa', 'a') 3 >>> how_many_times('aaaa', 'aa') 3 """
[ [ 0, 0.7310585975646973, 0.5490551590919495, 0.5735914707183838, 0.3768863081932068 ], [ 0, 0, 0.5490551590919495, 0.5735914707183838, 0.3768863081932068 ], [ 0.5490551590919495, 0.5490551590919495, 0, 0.437447726726532, 0.31764376163482666 ], [ 0, 0, 0, 0, 0.32433027029037476 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 1, 0, 1 ]
from typing import Union def compare_one(a: Union[int, float, str], b: Union[int, float, str]) -> Union[int, float, str, None]: """ Create a function that takes integers, floats, or strings representing real numbers, and returns the larger variable in its given variable type. Return None if the values are equal. Note: If a real number is represented as a string, the floating point might be . or , >>> compare_one(1, 2.5) 2.5 >>> compare_one(1, '2,3') '2,3' >>> compare_one('5,1', '6') '6' >>> compare_one('1', 1) None """
[ [ 0, 0.7310585975646973, 0.5941138863563538, 0.6050254702568054, 0.41008105874061584 ], [ 0, 0, 0.5941138863563538, 0.6050254702568054, 0.41008105874061584 ], [ 0, 0, 0, 0.4871819019317627, 0.3431181311607361 ], [ 0, 0.6050254702568054, 0.4871819019317627, 0, 0.3475112318992615 ], [ 0, 0, 0.3431181311607361, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def remove_vowels(text: str) -> str: """ remove_vowels is a function that takes string and returns string without vowels. >>> remove_vowels('') '' >>> remove_vowels('abcdef') 'bcdf' >>> remove_vowels('aaaaa') '' >>> remove_vowels('aaBAA') 'B' >>> remove_vowels('zbcd') 'zbcd' """
[ [ 0, 0.7310585975646973, 0.52146315574646, 0.5416050553321838, 0.3529658317565918 ], [ 0.7310585975646973, 0, 0.52146315574646, 0.5416050553321838, 0.3529658317565918 ], [ 0.52146315574646, 0.52146315574646, 0, 0.40551844239234924, 0.30477800965309143 ], [ 0.5416050553321838, 0, 0.40551844239234924, 0, 0.3082667887210846 ], [ 0.3529658317565918, 0, 0, 0, 0 ] ]
[ 0, 1, 0, 0, 1 ]
from typing import List def strange_sort_list(lst: List[int]) -> List[int]: """ Given list of integers, return list in strange order. Strange sorting, is when you start with the minimum value, then maximum of the remaining integers, then minimum and so on. Examples: >>> strange_sort_list([1, 2, 3, 4]) [1, 4, 2, 3] >>> strange_sort_list([5, 5, 5, 5]) [5, 5, 5, 5] >>> strange_sort_list([]) [] """
[ [ 0, 0.7310585975646973, 0.5906568169593811, 0.6030043363571167, 0.40796172618865967 ], [ 0, 0, 0.5906568169593811, 0.6030043363571167, 0.40796172618865967 ], [ 0, 0, 0, 0.48333123326301575, 0.34109848737716675 ], [ 0, 0, 0.48333123326301575, 0, 0.3459206521511078 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List, Tuple def find_closest_elements(numbers: List[float]) -> Tuple[float, float]: """ From a supplied list of numbers (of length at least two) select and return two that are the closest to each other and return them in order (smaller number, larger number). >>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) (2.0, 2.2) >>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) (2.0, 2.0) """
[ [ 0, 0.7310585975646973, 0.5854631662368774, 0.6001133918762207, 0.4044189453125 ], [ 0, 0, 0.5854631662368774, 0.6001133918762207, 0.4044189453125 ], [ 0, 0.5854631662368774, 0, 0.4776844382286072, 0.33789941668510437 ], [ 0.6001133918762207, 0.6001133918762207, 0.4776844382286072, 0, 0.3434407711029053 ], [ 0, 0, 0.33789941668510437, 0, 0 ] ]
[ 0, 0, 1, 0, 1 ]
def is_simple_power(x: int, n: int) -> bool: """Your task is to write a function that returns true if a number x is a simple power of n and false in other cases. x is a simple power of n if n**int=x For example: >>> is_simple_power(1, 4) True >>> is_simple_power(2, 2) True >>> is_simple_power(8, 2) True >>> is_simple_power(3, 2) False >>> is_simple_power(3, 1) False >>> is_simple_power(5, 3) False """
[ [ 0, 0.7310585975646973, 0.5812557935714722, 0.5976129174232483, 0.402077317237854 ], [ 0, 0, 0.5812557935714722, 0.5976129174232483, 0.402077317237854 ], [ 0, 0, 0, 0.4727616012096405, 0.3353106677532196 ], [ 0, 0, 0.4727616012096405, 0, 0.3414905071258545 ], [ 0.402077317237854, 0.402077317237854, 0.3353106677532196, 0.3414905071258545, 0 ] ]
[ 0, 0, 0, 1, 1 ]
def prime_fib(n: int) -> int: """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """
[ [ 0, 0.7310585975646973, 0.5775979161262512, 0.5944811701774597, 0.3996463418006897 ], [ 0, 0, 0.5775979161262512, 0.5944811701774597, 0.3996463418006897 ], [ 0, 0, 0, 0.46803906559944153, 0.3331422805786133 ], [ 0, 0, 0, 0, 0.33937156200408936 ], [ 0, 0.3996463418006897, 0.3331422805786133, 0.33937156200408936, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def has_close_elements(numbers: List[float], threshold: float) -> bool: """ Check if in given list of numbers, are any two numbers closer to each other than given threshold. >>> has_close_elements([1.0, 2.0, 3.0], 0.5) False >>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3) True """
[ [ 0, 0.7310585975646973, 0.6043148636817932, 0.6106183528900146, 0.41614073514938354 ], [ 0, 0, 0.6043148636817932, 0.6106183528900146, 0.41614073514938354 ], [ 0, 0, 0, 0.49897339940071106, 0.3497667610645294 ], [ 0, 0, 0.49897339940071106, 0, 0.3522919714450836 ], [ 0, 0, 0.3497667610645294, 0, 0 ] ]
[ 0, 0, 0, 0, 1 ]
def make_palindrome(string: str) -> str: """ Find the shortest palindrome that begins with a supplied string. Algorithm idea is simple: - Find the longest postfix of supplied string that is a palindrome. - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix. >>> make_palindrome('') '' >>> make_palindrome('cat') 'catac' >>> make_palindrome('cata') 'catac' """
[ [ 0, 0.7310585975646973, 0.5098133683204651, 0.5308934450149536, 0.34300026297569275 ], [ 0, 0, 0.5098133683204651, 0.5308934450149536, 0.34300026297569275 ], [ 0.5098133683204651, 0.5098133683204651, 0, 0.3942408859729767, 0.29948410391807556 ], [ 0.5308934450149536, 0.5308934450149536, 0.3942408859729767, 0, 0.3027604818344116 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def string_xor(a: str, b: str) -> str: """ Input are two strings a and b consisting only of 1s and 0s. Perform binary XOR on these inputs and return result also as a string. >>> string_xor('010', '110') '100' """
[ [ 0, 0.7310585975646973, 0.5345494151115417, 0.5563687682151794, 0.3645571172237396 ], [ 0, 0, 0.5345494151115417, 0.5563687682151794, 0.3645571172237396 ], [ 0, 0.5345494151115417, 0, 0.41955840587615967, 0.31054413318634033 ], [ 0, 0.5563687682151794, 0, 0, 0.3154647648334503 ], [ 0.3645571172237396, 0.3645571172237396, 0.31054413318634033, 0.3154647648334503, 0 ] ]
[ 0, 0, 0, 0, 1 ]
def special_factorial(n: int) -> int: """The Brazilian factorial is defined as: brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1! where n > 0 For example: >>> special_factorial(4) 288 The function will receive an integer as input and should return the special factorial of this integer. """
[ [ 0, 0.7310585975646973, 0.5698283910751343, 0.5897971987724304, 0.39426517486572266 ], [ 0, 0, 0.5698283910751343, 0.5897971987724304, 0.39426517486572266 ], [ 0, 0, 0, 0.45983418822288513, 0.32879671454429626 ], [ 0, 0, 0, 0, 0.3357201814651489 ], [ 0, 0, 0.32879671454429626, 0.3357201814651489, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def add_elements(arr: List[int], k: int) -> int: """ Given a non-empty array of integers arr and an integer k, return the sum of the elements with at most two digits from the first k elements of arr. Example: >>> add_elements([111, 21, 3, 4000, 5, 6, 7, 8, 9], 4) 24 Constraints: 1. 1 <= len(arr) <= 100 2. 1 <= k <= len(arr) """
[ [ 0, 0.7310585975646973, 0.5949661135673523, 0.6054607629776001, 0.4105266034603119 ], [ 0.7310585975646973, 0, 0.5949661135673523, 0.6054607629776001, 0.4105266034603119 ], [ 0, 0.5949661135673523, 0, 0.4882138669490814, 0.3437255918979645 ], [ 0.6054607629776001, 0, 0.4882138669490814, 0, 0.3479049503803253 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def fib4(n: int) -> int: """The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows: fib4(0) -> 0 fib4(1) -> 0 fib4(2) -> 2 fib4(3) -> 0 fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4). Please write a function to efficiently compute the n-th element of the fib4 number sequence. Do not use recursion. >>> fib4(5) 4 >>> fib4(6) 8 >>> fib4(7) 14 """
[ [ 0, 0.7310585975646973, 0.5543820261955261, 0.5795750617980957, 0.38226136565208435 ], [ 0, 0, 0.5543820261955261, 0.5795750617980957, 0.38226136565208435 ], [ 0, 0, 0, 0.4438852369785309, 0.3204600512981415 ], [ 0, 0.5795750617980957, 0.4438852369785309, 0, 0.32801055908203125 ], [ 0, 0, 0.3204600512981415, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def unique_digits(x: List[int]) -> List[int]: """Given a list of positive integers x. return a sorted list of all elements that hasn't any even digit. Note: Returned list should be sorted in increasing order. For example: >>> unique_digits([15, 33, 1422, 1]) [1, 15, 33] >>> unique_digits([152, 323, 1422, 10]) [] """
[ [ 0, 0.7310585975646973, 0.5897971987724304, 0.6025541424751282, 0.4070347249507904 ], [ 0.7310585975646973, 0, 0.5897971987724304, 0.6025541424751282, 0.4070347249507904 ], [ 0.5897971987724304, 0, 0, 0.48254719376564026, 0.3405384123325348 ], [ 0, 0, 0, 0, 0.34543174505233765 ], [ 0.4070347249507904, 0, 0.3405384123325348, 0.34543174505233765, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def select_words(s: str, n: int) -> List[str]: """Given a string s and a natural number n, you have been tasked to implement a function that returns a list of all words from string s that contain exactly n consonants, in order these words appear in the string s. If the string s is empty then the function should return an empty list. Note: you may assume the input string contains only letters and spaces. Examples: >>> select_words('Mary had a little lamb', 4) ['little'] >>> select_words('Mary had a little lamb', 3) ['Mary', 'lamb'] >>> select_words('simple white space', 2) [] >>> select_words('Hello world', 4) ['world'] >>> select_words('Uncle sam', 3) ['Uncle'] """
[ [ 0, 0.7310585975646973, 0.5546517968177795, 0.5762976408004761, 0.3811649680137634 ], [ 0, 0, 0.5546517968177795, 0.5762976408004761, 0.3811649680137634 ], [ 0, 0, 0, 0.4424263834953308, 0.32056504487991333 ], [ 0, 0, 0, 0, 0.3267062306404114 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def will_it_fly(q: List[int], w: int) -> bool: """ Write a function that returns True if the object q will fly, and False otherwise. The object q will fly if it's balanced (it is a palindromic list) and the sum of its elements is less than or equal the maximum possible weight w. Example: >>> will_it_fly([1, 2], 5) False # 1+2 is less than the maximum possible weight, but it's unbalanced. >>> will_it_fly([3, 2, 3], 1) False # it's balanced, but 3+2+3 is more than the maximum possible weight. >>> will_it_fly([3, 2, 3], 9) True # 3+2+3 is less than the maximum possible weight, and it's balanced. >>> will_it_fly([3], 5) True # 3 is less than the maximum possible weight, and it's balanced. """
[ [ 0, 0.7310585975646973, 0.5805330872535706, 0.5973538756370544, 0.4015035033226013 ], [ 0, 0, 0.5805330872535706, 0.5973538756370544, 0.4015035033226013 ], [ 0.5805330872535706, 0.5805330872535706, 0, 0.47216519713401794, 0.33491700887680054 ], [ 0.5973538756370544, 0.5973538756370544, 0, 0, 0.341204434633255 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def fib(n: int) -> int: """Return n-th Fibonacci number. >>> fib(10) 55 >>> fib(1) 1 >>> fib(8) 21 """
[ [ 0, 0.7310585975646973, 0.5793894529342651, 0.5955475568771362, 0.40078991651535034 ], [ 0, 0, 0.5793894529342651, 0.5955475568771362, 0.40078991651535034 ], [ 0, 0, 0, 0.4699932038784027, 0.33417069911956787 ], [ 0, 0, 0.4699932038784027, 0, 0.34019824862480164 ], [ 0, 0.40078991651535034, 0.33417069911956787, 0.34019824862480164, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def Strongest_Extension(class_name: str, extensions: List[str]) -> str: """You will be given the name of a class (a string) and a list of extensions. The extensions are to be used to load additional classes to the class. The strength of the extension is as follows: Let CAP be the number of the uppercase letters in the extension's name, and let SM be the number of lowercase letters in the extension's name, the strength is given by the fraction CAP - SM. You should find the strongest extension and return a string in this format: ClassName.StrongestExtensionName. If there are two or more extensions with the same strength, you should choose the one that comes first in the list. For example, if you are given "Slices" as the class and a list of the extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension (its strength is -1). Example: >>> Strongest_Extension('my_class', ['AA', 'Be', 'CC']) 'my_class.AA' """
[ [ 0, 0.7310585975646973, 0.55995774269104, 0.5838906168937683, 0.38615667819976807 ], [ 0, 0, 0.55995774269104, 0.5838906168937683, 0.38615667819976807 ], [ 0, 0, 0, 0.45019975304603577, 0.32343652844429016 ], [ 0, 0, 0, 0, 0.330859899520874 ], [ 0.38615667819976807, 0.38615667819976807, 0.32343652844429016, 0.330859899520874, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List, Optional def next_smallest(lst: List[int]) -> Optional[int]: """ You are given a list of integers. Write a function next_smallest() that returns the 2nd smallest element of the list. Return None if there is no such element. >>> next_smallest([1, 2, 3, 4, 5]) 2 >>> next_smallest([5, 1, 4, 3, 2]) 2 >>> next_smallest([]) None >>> next_smallest([1, 1]) None """
[ [ 0, 0.7310585975646973, 0.6000675559043884, 0.6082530617713928, 0.4137435853481293 ], [ 0, 0, 0.6000675559043884, 0.6082530617713928, 0.4137435853481293 ], [ 0, 0.6000675559043884, 0, 0.4939919710159302, 0.34701818227767944 ], [ 0, 0.6082530617713928, 0, 0, 0.35032278299331665 ], [ 0, 0.4137435853481293, 0.34701818227767944, 0.35032278299331665, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def any_int(x: float, y: float, z: float) -> bool: """ Create a function that takes 3 numbers. Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers. Returns false in any other cases. Examples >>> any_int(5, 2, 7) True >>> any_int(3, 2, 2) False >>> any_int(3, -2, 1) True >>> any_int(3.6, -2.2, 2) False """
[ [ 0, 0.7310585975646973, 0.6138161420822144, 0.6158602833747864, 0.42155376076698303 ], [ 0, 0, 0.6138161420822144, 0.6158602833747864, 0.42155376076698303 ], [ 0, 0.6138161420822144, 0, 0.5102178454399109, 0.3560820519924164 ], [ 0, 0, 0, 0, 0.35675641894340515 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def truncate_number(number: float) -> float: """ Given a positive floating point number, it can be decomposed into and integer part (largest integer smaller than given number) and decimals (leftover part always smaller than 1). Return the decimal part of the number. >>> truncate_number(3.5) 0.5 """
[ [ 0, 0.7310585975646973, 0.56861811876297, 0.5905695557594299, 0.39261406660079956 ], [ 0.7310585975646973, 0, 0.56861811876297, 0.5905695557594299, 0.39261406660079956 ], [ 0.56861811876297, 0, 0, 0.4598991274833679, 0.3280330300331116 ], [ 0, 0, 0, 0, 0.33545437455177307 ], [ 0, 0, 0, 0.33545437455177307, 0 ] ]
[ 0, 1, 0, 0, 0 ]
from typing import List def incr_list(l: List[int]) -> List[int]: """Return list with elements incremented by 1. >>> incr_list([1, 2, 3]) [2, 3, 4] >>> incr_list([5, 3, 5, 2, 3, 3, 9, 0, 123]) [6, 4, 6, 3, 4, 4, 10, 1, 124] """
[ [ 0, 0.7310585975646973, 0.5958303809165955, 0.6058320999145508, 0.4109688699245453 ], [ 0, 0, 0.5958303809165955, 0.6058320999145508, 0.4109688699245453 ], [ 0.5958303809165955, 0.5958303809165955, 0, 0.4892849326133728, 0.344424307346344 ], [ 0.6058320999145508, 0.6058320999145508, 0, 0, 0.34830769896507263 ], [ 0.4109688699245453, 0.4109688699245453, 0, 0, 0 ] ]
[ 0, 0, 1, 0, 0 ]
def x_or_y(n: int, x: int, y: int) -> int: """A simple program which should return the value of x if n is a prime number and should return the value of y otherwise. Examples: >>> x_or_y(7, 34, 12) 34 >>> x_or_y(15, 8, 5) 5 """
[ [ 0, 0.7310585975646973, 0.583605945110321, 0.5989648103713989, 0.40350762009620667 ], [ 0, 0, 0.583605945110321, 0.5989648103713989, 0.40350762009620667 ], [ 0, 0.583605945110321, 0, 0.4753410518169403, 0.3366687297821045 ], [ 0, 0, 0, 0, 0.3425513803958893 ], [ 0, 0, 0, 0.3425513803958893, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def modp(n: int, p: int) -> int: """Return 2^n modulo p (be aware of numerics). >>> modp(3, 5) 3 >>> modp(1101, 101) 2 >>> modp(0, 101) 1 >>> modp(3, 11) 8 >>> modp(100, 101) 1 """
[ [ 0, 0.7310585975646973, 0.5646987557411194, 0.586878776550293, 0.3903690576553345 ], [ 0, 0, 0.5646987557411194, 0.586878776550293, 0.3903690576553345 ], [ 0, 0, 0, 0.45480698347091675, 0.3260306119918823 ], [ 0, 0, 0.45480698347091675, 0, 0.33333927392959595 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import Tuple def even_odd_count(num: int) -> Tuple[int, int]: """Given an integer. return a tuple that has the number of even and odd digits respectively. Example: >>> even_odd_count(-12) (1, 1) >>> even_odd_count(123) (1, 2) """
[ [ 0, 0.7310585975646973, 0.5840105414390564, 0.599388599395752, 0.40274399518966675 ], [ 0.7310585975646973, 0, 0.5840105414390564, 0.599388599395752, 0.40274399518966675 ], [ 0.5840105414390564, 0, 0, 0.4763708710670471, 0.33687764406204224 ], [ 0.599388599395752, 0, 0.4763708710670471, 0, 0.3425626754760742 ], [ 0, 0, 0.33687764406204224, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def is_happy(s: str) -> bool: """You are given a string s. Your task is to check if the string is happy or not. A string is happy if its length is at least 3 and every 3 consecutive letters are distinct For example: >>> is_happy('a') False >>> is_happy('aa') False >>> is_happy('abcd') True >>> is_happy('aabb') False >>> is_happy('adb') True >>> is_happy('xyy') False """
[ [ 0, 0.7310585975646973, 0.5433745980262756, 0.5674501657485962, 0.37236952781677246 ], [ 0, 0, 0.5433745980262756, 0.5674501657485962, 0.37236952781677246 ], [ 0, 0, 0, 0.4305037260055542, 0.3148254156112671 ], [ 0, 0, 0.4305037260055542, 0, 0.3209867477416992 ], [ 0, 0, 0.3148254156112671, 0, 0 ] ]
[ 0, 0, 0, 0, 1 ]
def largest_prime_factor(n: int) -> int: """Return the largest prime factor of n. Assume n > 1 and is not a prime. >>> largest_prime_factor(13195) 29 >>> largest_prime_factor(2048) 2 """
[ [ 0, 0.7310585975646973, 0.5686620473861694, 0.5901235342025757, 0.3934708535671234 ], [ 0, 0, 0.5686620473861694, 0.5901235342025757, 0.3934708535671234 ], [ 0, 0, 0, 0.4593780040740967, 0.32820162177085876 ], [ 0.5901235342025757, 0.5901235342025757, 0.4593780040740967, 0, 0.3355688452720642 ], [ 0, 0.3934708535671234, 0.32820162177085876, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def digitSum(s: str) -> int: """Task Write a function that takes a string as input and returns the sum of the upper characters only' ASCII codes. Examples: >>> digitSum('') 0 >>> digitSum('abAB') 131 >>> digitSum('abcCd') 67 >>> digitSum('helloE') 69 >>> digitSum('woArBld') 131 >>> digitSum('aAaaaXa') 153 """
[ [ 0, 0.7310585975646973, 0.545807421207428, 0.5712180733680725, 0.37381038069725037 ], [ 0.7310585975646973, 0, 0.545807421207428, 0.5712180733680725, 0.37381038069725037 ], [ 0, 0, 0, 0.4343608617782593, 0.31594789028167725 ], [ 0, 0, 0.4343608617782593, 0, 0.3225821852684021 ], [ 0, 0, 0.31594789028167725, 0.3225821852684021, 0 ] ]
[ 0, 0, 0, 1, 0 ]
from typing import List def rescale_to_unit(numbers: List[float]) -> List[float]: """ Given list of numbers (of at least two elements), apply a linear transform to that list, such that the smallest number will become 0 and the largest will become 1 >>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0]) [0.0, 0.25, 0.5, 0.75, 1.0] """
[ [ 0, 0.7310585975646973, 0.5859383344650269, 0.6003737449645996, 0.4046376645565033 ], [ 0, 0, 0.5859383344650269, 0.6003737449645996, 0.4046376645565033 ], [ 0, 0, 0, 0.478246808052063, 0.3381924629211426 ], [ 0, 0, 0, 0, 0.34364211559295654 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def solution(lst: List[int]) -> int: """Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions. Examples >>> solution([5, 8, 7, 1]) 12 >>> solution([3, 3, 3, 3, 3]) 9 >>> solution([30, 13, 24, 321]) 0 """
[ [ 0, 0.7310585975646973, 0.5922714471817017, 0.6040906310081482, 0.4078421890735626 ], [ 0.7310585975646973, 0, 0.5922714471817017, 0.6040906310081482, 0.4078421890735626 ], [ 0, 0, 0, 0.4855717718601227, 0.3418327867984772 ], [ 0, 0, 0, 0, 0.3463767468929291 ], [ 0.4078421890735626, 0.4078421890735626, 0.3418327867984772, 0.3463767468929291, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def pluck(arr: List[int]) -> List[int]: """ "Given an array representing a branch of a tree that has non-negative integer nodes your task is to pluck one of the nodes and return it. The plucked node should be the node with the smallest even value. If multiple nodes with the same smallest even value are found return the node that has smallest index. The plucked node should be returned in a list, [ smalest_value, its index ], If there are no even values or the given array is empty, return []. Example 1: >>> pluck([4, 2, 3]) [2, 1] Explanation: 2 has the smallest even value, and 2 has the smallest index. Example 2: >>> pluck([1, 2, 3]) [2, 1] Explanation: 2 has the smallest even value, and 2 has the smallest index. Example 3: >>> pluck([]) [] Example 4: >>> pluck([5, 0, 3, 0, 4, 2]) [0, 1] Explanation: 0 is the smallest value, but there are two zeros, so we will choose the first zero, which has the smallest index. Constraints: * 1 <= nodes.length <= 10000 * 0 <= node.value """
[ [ 0, 0.7310585975646973, 0.569451093673706, 0.5909125208854675, 0.39353612065315247 ], [ 0.7310585975646973, 0, 0.569451093673706, 0.5909125208854675, 0.39353612065315247 ], [ 0.569451093673706, 0, 0, 0.4606221914291382, 0.3286162316799164 ], [ 0.5909125208854675, 0, 0.4606221914291382, 0, 0.335928350687027 ], [ 0.39353612065315247, 0, 0, 0.335928350687027, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def get_max_triples(n: int) -> int: """ You are given a positive integer n. You have to create an integer array a of length n. For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1. Return the number of triples (a[i], a[j], a[k]) of a where i < j < k, and a[i] + a[j] + a[k] is a multiple of 3. Example : >>> get_max_triples(5) 1 Explanation: a = [1, 3, 7, 13, 21] The only valid triple is (1, 7, 13). """
[ [ 0, 0.7310585975646973, 0.5944256782531738, 0.6051740646362305, 0.4103638231754303 ], [ 0, 0, 0.5944256782531738, 0.6051740646362305, 0.4103638231754303 ], [ 0, 0, 0, 0.4875003695487976, 0.3433433473110199 ], [ 0, 0, 0, 0, 0.3476797342300415 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def median(l: List[int]) -> float: """Return median of elements in the list l. >>> median([3, 1, 2, 4, 5]) 3 >>> median([-10, 4, 6, 1000, 10, 20]) 15.0 """
[ [ 0, 0.7310585975646973, 0.5946719646453857, 0.6052678227424622, 0.41008877754211426 ], [ 0, 0, 0.5946719646453857, 0.6052678227424622, 0.41008877754211426 ], [ 0.5946719646453857, 0.5946719646453857, 0, 0.4880213737487793, 0.34358930587768555 ], [ 0, 0, 0, 0, 0.34771832823753357 ], [ 0, 0, 0, 0.34771832823753357, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def prime_length(string: str) -> bool: """Write a function that takes a string and returns True if the string length is a prime number or False otherwise Examples >>> prime_length('Hello') True >>> prime_length('abcdcba') True >>> prime_length('kittens') True >>> prime_length('orange') False """
[ [ 0, 0.7310585975646973, 0.5525911450386047, 0.577632486820221, 0.3805767893791199 ], [ 0, 0, 0.5525911450386047, 0.577632486820221, 0.3805767893791199 ], [ 0, 0, 0, 0.441745400428772, 0.3195730447769165 ], [ 0, 0, 0.441745400428772, 0, 0.3268339931964874 ], [ 0, 0, 0.3195730447769165, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def smallest_change(arr: List[int]) -> int: """ Given an array arr of integers, find the minimum number of elements that need to be changed to make the array palindromic. A palindromic array is an array that is read the same backwards and forwards. In one change, you can change one element to any other element. For example: >>> smallest_change([1, 2, 3, 5, 4, 7, 9, 6]) 4 >>> smallest_change([1, 2, 3, 4, 3, 2, 2]) 1 >>> smallest_change([1, 2, 3, 2, 1]) 0 """
[ [ 0, 0.7310585975646973, 0.5607568025588989, 0.5854937434196472, 0.3861747980117798 ], [ 0, 0, 0.5607568025588989, 0.5854937434196472, 0.3861747980117798 ], [ 0, 0, 0, 0.45194128155708313, 0.32377132773399353 ], [ 0, 0, 0.45194128155708313, 0, 0.3314216136932373 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def sum_squares(lst: List[float]) -> int: """You are given a list of numbers. You need to return the sum of squared numbers in the given list, round each element in the list to the upper int(Ceiling) first. Examples: >>> lst([1.0, 2.0, 3.0]) 14 >>> lst([1.0, 4.0, 9.0]) 98 >>> lst([1.0, 3.0, 5.0, 7.0]) 84 >>> lst([1.4, 4.2, 0.0]) 29 >>> lst([-2.4, 1.0, 1.0]) 6 """
[ [ 0, 0.7310585975646973, 0.5927611589431763, 0.6043702363967896, 0.4082050025463104 ], [ 0.7310585975646973, 0, 0.5927611589431763, 0.6043702363967896, 0.4082050025463104 ], [ 0, 0, 0, 0.48609086871147156, 0.34212741255760193 ], [ 0, 0, 0, 0, 0.3466181457042694 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def file_name_check(file_name: str) -> str: """Create a function which takes a string representing a file's name, and returns 'Yes' if the the file's name is valid, and returns 'No' otherwise. A file's name is considered to be valid if and only if all the following conditions are met: - There should not be more than three digits ('0'-'9') in the file's name. - The file's name contains exactly one dot '.' - The substring before the dot should not be empty, and it starts with a letter from the latin alphapet ('a'-'z' and 'A'-'Z'). - The substring after the dot should be one of these: ['txt', 'exe', 'dll'] Examples: >>> file_name_check('example.txt') 'Yes' >>> file_name_check('1example.dll') 'No' """
[ [ 0, 0.7310585975646973, 0.5367625951766968, 0.5601611137390137, 0.3666885495185852 ], [ 0.7310585975646973, 0, 0.5367625951766968, 0.5601611137390137, 0.3666885495185852 ], [ 0.5367625951766968, 0, 0, 0.42275285720825195, 0.31159472465515137 ], [ 0.5601611137390137, 0.5601611137390137, 0.42275285720825195, 0, 0.31710386276245117 ], [ 0.3666885495185852, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def triples_sum_to_zero(l: List[int]) -> bool: """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """
[ [ 0, 0.7310585975646973, 0.6003603935241699, 0.6084508299827576, 0.4136900007724762 ], [ 0, 0, 0.6003603935241699, 0.6084508299827576, 0.4136900007724762 ], [ 0, 0, 0, 0.4944375157356262, 0.34717974066734314 ], [ 0, 0, 0, 0, 0.35041236877441406 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import Tuple def intersection(interval1: Tuple[int, int], interval2: Tuple[int, int]) -> str: """You are given two intervals, where each interval is a pair of integers. For example, interval = (start, end) = (1, 2). The given intervals are closed which means that the interval (start, end) includes both start and end. For each given interval, it is assumed that its start is less or equal its end. Your task is to determine whether the length of intersection of these two intervals is a prime number. Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3) which its length is 1, which not a prime number. If the length of the intersection is a prime number, return "YES", otherwise, return "NO". If the two intervals don't intersect, return "NO". [input/output] samples: >>> intersection((1, 2), (2, 3)) 'NO' >>> intersection((-1, 1), (0, 4)) 'NO' >>> intersection((-3, -1), (-5, 5)) 'YES' """
[ [ 0, 0.7310585975646973, 0.5897165536880493, 0.602515697479248, 0.4074074923992157 ], [ 0, 0, 0.5897165536880493, 0.602515697479248, 0.4074074923992157 ], [ 0, 0.5897165536880493, 0, 0.4822452664375305, 0.3404625654220581 ], [ 0, 0.602515697479248, 0, 0, 0.3454822599887848 ], [ 0, 0.4074074923992157, 0.3404625654220581, 0.3454822599887848, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """
[ [ 0, 0.7310585975646973, 0.5544047355651855, 0.5752745866775513, 0.3808407783508301 ], [ 0, 0, 0.5544047355651855, 0.5752745866775513, 0.3808407783508301 ], [ 0, 0, 0, 0.44170063734054565, 0.3204469382762909 ], [ 0, 0, 0, 0, 0.32630324363708496 ], [ 0.3808407783508301, 0.3808407783508301, 0.3204469382762909, 0.32630324363708496, 0 ] ]
[ 0, 0, 0, 0, 1 ]
from typing import List def compare(game: List[int], guess: List[int]) -> List[int]: """I think we all remember that feeling when the result of some long-awaited event is finally known. The feelings and thoughts you have at that moment are definitely worth noting down and comparing. Your task is to determine if a person correctly guessed the results of a number of matches. You are given two arrays of scores and guesses of equal length, where each index shows a match. Return an array of the same length denoting how far off each guess was. If they have guessed correctly, the value is 0, and if not, the value is the absolute difference between the guess and the score. example: >>> compare([1, 2, 3, 4, 5, 1], [1, 2, 3, 4, 2, -2]) [0, 0, 0, 0, 3, 3] >>> compare([0, 5, 0, 0, 0, 4], [4, 1, 1, 0, 0, -2]) [4, 4, 1, 0, 0, 6] """
[ [ 0, 0.7310585975646973, 0.5794734358787537, 0.5967720746994019, 0.40049445629119873 ], [ 0, 0, 0.5794734358787537, 0.5967720746994019, 0.40049445629119873 ], [ 0.5794734358787537, 0.5794734358787537, 0, 0.47115597128868103, 0.3342715799808502 ], [ 0, 0, 0, 0, 0.3406372666358948 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def valid_date(date: str) -> bool: """You have to write a function which validates a given date string and returns True if the date is valid otherwise False. The date is valid if all of the following rules are satisfied: 1. The date string is not empty. 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2. 3. The months should not be less than 1 or higher than 12. 4. The date should be in the format: mm-dd-yyyy >>> valid_date('03-11-2000') True >>> valid_date('15-01-2012') False >>> valid_date('04-0-2040') False >>> valid_date('06-04-2020') True >>> valid_date('06/04/2020') False """
[ [ 0, 0.7310585975646973, 0.5504218935966492, 0.5763934850692749, 0.37874263525009155 ], [ 0, 0, 0.5504218935966492, 0.5763934850692749, 0.37874263525009155 ], [ 0, 0, 0, 0.4397432804107666, 0.3184210956096649 ], [ 0, 0, 0, 0, 0.325794517993927 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def count_nums(arr: List[int]) -> int: """ Write a function count_nums which takes an array of integers and returns the number of elements which has a sum of digits > 0. If a number is negative, then its first signed digit will be negative: e.g. -123 has signed digits -1, 2, and 3. >>> count_nums([]) 0 >>> count_nums([-1, 11, -11]) 1 >>> count_nums([1, 1, 2]) 3 """
[ [ 0, 0.7310585975646973, 0.5882293581962585, 0.6017311811447144, 0.40599164366722107 ], [ 0, 0, 0.5882293581962585, 0.6017311811447144, 0.40599164366722107 ], [ 0.5882293581962585, 0.5882293581962585, 0, 0.48079735040664673, 0.3394944667816162 ], [ 0, 0, 0.48079735040664673, 0, 0.3446756601333618 ], [ 0, 0.40599164366722107, 0.3394944667816162, 0.3446756601333618, 0 ] ]
[ 0, 0, 1, 0, 0 ]
def anti_shuffle(s: str) -> str: """ Write a function that takes a string and returns an ordered version of it. Ordered version of string, is a string where all words (separated by space) are replaced by a new word where all the characters arranged in ascending order based on ascii value. Note: You should keep the order of words and blank spaces in the sentence. For example: >>> anti_shuffle('Hi') 'Hi' >>> anti_shuffle('hello') 'ehllo' >>> anti_shuffle('Hello World!!!') 'Hello !!!Wdlor' """
[ [ 0, 0.7310585975646973, 0.5233182907104492, 0.5444914102554321, 0.3545159101486206 ], [ 0.7310585975646973, 0, 0.5233182907104492, 0.5444914102554321, 0.3545159101486206 ], [ 0.5233182907104492, 0, 0, 0.40762990713119507, 0.30532315373420715 ], [ 0.5444914102554321, 0, 0.40762990713119507, 0, 0.3093506693840027 ], [ 0.3545159101486206, 0, 0.30532315373420715, 0.3093506693840027, 0 ] ]
[ 1, 1, 1, 1, 1 ]
def is_palindrome(text: str) -> bool: """ Checks if given string is a palindrome >>> is_palindrome('') True >>> is_palindrome('aba') True >>> is_palindrome('aaaaa') True >>> is_palindrome('zbcd') False """
[ [ 0, 0.7310585975646973, 0.5350460410118103, 0.5581983327865601, 0.36524850130081177 ], [ 0, 0, 0.5350460410118103, 0.5581983327865601, 0.36524850130081177 ], [ 0, 0.5350460410118103, 0, 0.42073771357536316, 0.310791552066803 ], [ 0, 0, 0.42073771357536316, 0, 0.316118448972702 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def is_prime(n: int) -> bool: """Return true if a given number is prime, and false otherwise. >>> is_prime(6) False >>> is_prime(101) True >>> is_prime(11) True >>> is_prime(13441) True >>> is_prime(61) True >>> is_prime(4) False >>> is_prime(1) False """
[ [ 0, 0.7310585975646973, 0.5840052366256714, 0.5993255972862244, 0.4039573073387146 ], [ 0, 0, 0.5840052366256714, 0.5993255972862244, 0.4039573073387146 ], [ 0, 0.5840052366256714, 0, 0.4758242964744568, 0.3369399607181549 ], [ 0, 0, 0, 0, 0.34285110235214233 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def simplify(x: str, n: str) -> bool: """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where both numerator and denominator are positive whole numbers. You can assume that x, and n are valid fractions, and do not have zero as denominator. >>> simplify('1/5', '5/1') True >>> simplify('1/6', '2/1') False >>> simplify('7/10', '10/2') False """
[ [ 0, 0.7310585975646973, 0.5647356510162354, 0.5882095098495483, 0.39063894748687744 ], [ 0.7310585975646973, 0, 0.5647356510162354, 0.5882095098495483, 0.39063894748687744 ], [ 0, 0.5647356510162354, 0, 0.45566317439079285, 0.3260744512081146 ], [ 0, 0.5882095098495483, 0.45566317439079285, 0, 0.3338747024536133 ], [ 0, 0.39063894748687744, 0.3260744512081146, 0, 0 ] ]
[ 0, 1, 1, 0, 1 ]
def hex_key(num: str) -> int: """You have been tasked to write a function that receives a hexadecimal number as a string and counts the number of hexadecimal digits that are primes (prime number, or a prime, is a natural number greater than 1 that is not a product of two smaller natural numbers). Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. Prime numbers are 2, 3, 5, 7, 11, 13, 17,... So you have to determine a number of the following digits: 2, 3, 5, 7, B (=decimal 11), D (=decimal 13). Note: you may assume the input is always correct or empty string, and symbols A,B,C,D,E,F are always uppercase. Examples: >>> hex_key('AB') 1 >>> hex_key('1077E') 2 >>> hex_key('ABED1A33') 4 >>> hex_key('123456789ABCDEF0') 6 >>> hex_key('2020') 2 """
[ [ 0, 0.7310585975646973, 0.5604940056800842, 0.5849973559379578, 0.38658392429351807 ], [ 0, 0, 0.5604940056800842, 0.5849973559379578, 0.38658392429351807 ], [ 0, 0.5604940056800842, 0, 0.4512520134449005, 0.3237161338329315 ], [ 0, 0, 0.4512520134449005, 0, 0.3313775360584259 ], [ 0, 0, 0.3237161338329315, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def words_in_sentence(sentence: str) -> str: """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new string should be the same as the original one. Example 1: >>> words_in_sentence('This is a test') 'is' Example 2: >>> words_in_sentence('lets go for swimming') 'go for' Constraints: * 1 <= len(sentence) <= 100 * sentence contains only letters """
[ [ 0, 0.7310585975646973, 0.5317237377166748, 0.5525836944580078, 0.3620990514755249 ], [ 0, 0, 0.5317237377166748, 0.5525836944580078, 0.3620990514755249 ], [ 0, 0, 0, 0.4160088002681732, 0.30922770500183105 ], [ 0, 0, 0, 0, 0.31372231245040894 ], [ 0.3620990514755249, 0.3620990514755249, 0.30922770500183105, 0.31372231245040894, 0 ] ]
[ 0, 0, 0, 0, 1 ]
from typing import Dict def histogram(test: str) -> Dict[str, int]: """Given a string representing a space separated lowercase letters, return a dictionary of the letter with the most repetition and containing the corresponding count. If several letters have the same occurrence, return all of them. Example: >>> histogram('a b c') { 'a': 1, 'b': 1, 'c': 1 } >>> histogram('a b b a') { 'a': 2, 'b': 2 } >>> histogram('a b c a b') { 'a': 2, 'b': 2 } >>> histogram('b b b b a') { 'b': 4 } >>> histogram('') { } """
[ [ 0, 0.7310585975646973, 0.541121244430542, 0.5618743896484375, 0.3701690435409546 ], [ 0.7310585975646973, 0, 0.541121244430542, 0.5618743896484375, 0.3701690435409546 ], [ 0, 0, 0, 0.4261249005794525, 0.3137488067150116 ], [ 0, 0, 0, 0, 0.318780779838562 ], [ 0.3701690435409546, 0, 0.3137488067150116, 0.318780779838562, 0 ] ]
[ 0, 0, 0, 0, 1 ]
from typing import List, Tuple def get_row(lst: List[List[int]], x: int) -> List[Tuple[int, int]]: """ You are given a 2 dimensional data, as a nested lists, which is similar to matrix, however, unlike matrices, each row may contain a different number of columns. Given lst, and integer x, find integers x in the list, and return list of tuples, [(x1, y1), (x2, y2) ...] such that each tuple is a coordinate - (row, columns), starting with 0. Sort coordinates initially by rows in ascending order. Also, sort coordinates of the row by columns in descending order. Examples: >>> get_row([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], 1) [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)] >>> get_row([], 1) [] >>> get_row([[], [1], [1, 2, 3]], 3) [(2, 2)] """
[ [ 0, 0.7310585975646973, 0.5786038637161255, 0.596193790435791, 0.3996194005012512 ], [ 0.7310585975646973, 0, 0.5786038637161255, 0.596193790435791, 0.3996194005012512 ], [ 0, 0, 0, 0.4703744053840637, 0.33384689688682556 ], [ 0, 0, 0.4703744053840637, 0, 0.3401661813259125 ], [ 0, 0.3996194005012512, 0.33384689688682556, 0.3401661813259125, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def get_odd_collatz(n: int) -> List[int]: """ Given a positive integer n, return a sorted list that has the odd numbers in collatz sequence. The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined as follows: start with any positive integer n. Then each term is obtained from the previous term as follows: if the previous term is even, the next term is one half of the previous term. If the previous term is odd, the next term is 3 times the previous term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1. Note: 1. Collatz(1) is [1]. 2. returned list sorted in increasing order. For example: get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5. >>> get_odd_collatz(5) [1, 5] """
[ [ 0, 0.7310585975646973, 0.5756554007530212, 0.5936579704284668, 0.3975965082645416 ], [ 0, 0, 0.5756554007530212, 0.5936579704284668, 0.3975965082645416 ], [ 0, 0.5756554007530212, 0, 0.4665448069572449, 0.33204394578933716 ], [ 0, 0.5936579704284668, 0, 0, 0.33842194080352783 ], [ 0, 0.3975965082645416, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 1 ]
from typing import List def can_arrange(arr: List[int]) -> int: """Create a function which returns the largest index of an element which is not greater than or equal to the element immediately preceding it. If no such element exists then return -1. The given array will not contain duplicate values. Examples: >>> can_arrange([1, 2, 4, 3, 5]) 3 >>> can_arrange([1, 2, 3]) -1 """
[ [ 0, 0.7310585975646973, 0.584736704826355, 0.5996635556221008, 0.40427571535110474 ], [ 0, 0, 0.584736704826355, 0.5996635556221008, 0.40427571535110474 ], [ 0, 0, 0, 0.4767422676086426, 0.3374970853328705 ], [ 0, 0.5996635556221008, 0.4767422676086426, 0, 0.3431757092475891 ], [ 0, 0.40427571535110474, 0.3374970853328705, 0, 0 ] ]
[ 0, 0, 1, 0, 0 ]
def sort_numbers(numbers: str) -> str: """ Input is a space-delimited string of numberals from 'zero' to 'nine'. Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'. Return the string with numbers sorted from smallest to largest >>> sort_numbers('three one five') 'one three five' """
[ [ 0, 0.7310585975646973, 0.5776221752166748, 0.5956207513809204, 0.3992435932159424 ], [ 0, 0, 0.5776221752166748, 0.5956207513809204, 0.3992435932159424 ], [ 0, 0, 0, 0.4692132771015167, 0.3333052098751068 ], [ 0, 0, 0, 0, 0.3397830128669739 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List def sum_squares(lst: List[int]) -> int: """" This function will take a list of integers. For all entries in the list, the function shall square the integer entry if its index is a multiple of 3 and will cube the integer entry if its index is a multiple of 4 and not a multiple of 3. The function will not change the entries in the list whose indexes are not a multiple of 3 or 4. The function shall then return the sum of all entries. Examples: >>> lst [1, 2, 3] >>> lst [] >>> lst [-1, -5, 2, -1, -5] """
[ [ 0, 0.7310585975646973, 0.5936618447303772, 0.6048485040664673, 0.4089498817920685 ], [ 0, 0, 0.5936618447303772, 0.6048485040664673, 0.4089498817920685 ], [ 0, 0, 0, 0.48703962564468384, 0.3427361249923706 ], [ 0, 0, 0.48703962564468384, 0, 0.34709420800209045 ], [ 0.4089498817920685, 0.4089498817920685, 0.3427361249923706, 0.34709420800209045, 0 ] ]
[ 0, 0, 0, 0, 1 ]
from typing import List def skjkasdkd(lst: List[int]) -> int: """You are given a list of integers. You need to find the largest prime value and return the sum of its digits. Examples: >>> skjkasdkd([0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) 10 >>> skjkasdkd([1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) 25 >>> skjkasdkd([1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) 13 >>> skjkasdkd([0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) 11 >>> skjkasdkd([0, 81, 12, 3, 1, 21]) 3 >>> skjkasdkd([0, 8, 1, 2, 1, 7]) 7 """
[ [ 0, 0.7310585975646973, 0.5802977085113525, 0.5972254276275635, 0.40067994594573975 ], [ 0, 0, 0.5802977085113525, 0.5972254276275635, 0.40067994594573975 ], [ 0, 0.5802977085113525, 0, 0.47220709919929504, 0.3347657322883606 ], [ 0, 0.5972254276275635, 0, 0, 0.3409348130226135 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List, Tuple def sum_product(numbers: List[int]) -> Tuple[int, int]: """ For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list. Empty sum should be equal to 0 and empty product should be equal to 1. >>> sum_product([]) (0, 1) >>> sum_product([1, 2, 3, 4]) (10, 24) """
[ [ 0, 0.7310585975646973, 0.6062941551208496, 0.6117088198661804, 0.4172549247741699 ], [ 0, 0, 0.6062941551208496, 0.6117088198661804, 0.4172549247741699 ], [ 0, 0, 0, 0.501312255859375, 0.3510749042034149 ], [ 0, 0, 0.501312255859375, 0, 0.35321515798568726 ], [ 0, 0, 0.3510749042034149, 0.35321515798568726, 0 ] ]
[ 0, 0, 0, 0, 1 ]
def choose_num(x: int, y: int) -> int: """This function takes two positive numbers x and y and returns the biggest even integer number that is in the range [x, y] inclusive. If there's no such number, then the function should return -1. For example: >>> choose_num(12, 15) 14 >>> choose_num(13, 12) -1 """
[ [ 0, 0.7310585975646973, 0.5862179398536682, 0.6005951762199402, 0.40520885586738586 ], [ 0, 0, 0.5862179398536682, 0.6005951762199402, 0.40520885586738586 ], [ 0, 0, 0, 0.47833430767059326, 0.3382611870765686 ], [ 0, 0, 0, 0, 0.3438456356525421 ], [ 0, 0, 0.3382611870765686, 0.3438456356525421, 0 ] ]
[ 0, 0, 0, 0, 1 ]
from typing import List, Tuple, Optional def largest_smallest_integers(lst: List[int]) -> Tuple[Optional[int], Optional[int]]: """ Create a function that returns a tuple (a, b), where 'a' is the largest of negative integers, and 'b' is the smallest of positive integers in a list. If there is no negative or positive integers, return them as None. Examples: >>> largest_smallest_integers([2, 4, 1, 3, 5, 7]) (None, 1) >>> largest_smallest_integers([]) (None, None) >>> largest_smallest_integers([0]) (None, None) """
[ [ 0, 0.7310585975646973, 0.6037754416465759, 0.6103050112724304, 0.4158819019794464 ], [ 0.7310585975646973, 0, 0.6037754416465759, 0.6103050112724304, 0.4158819019794464 ], [ 0, 0, 0, 0.49832046031951904, 0.34943071007728577 ], [ 0, 0, 0.49832046031951904, 0, 0.352051705121994 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
def count_distinct_characters(string: str) -> int: """ Given a string, find out how many distinct characters (regardless of case) does it consist of >>> count_distinct_characters('xyzXYZ') 3 >>> count_distinct_characters('Jerry') 4 """
[ [ 0, 0.7310585975646973, 0.538064181804657, 0.5617998242378235, 0.36745497584342957 ], [ 0.7310585975646973, 0, 0.538064181804657, 0.5617998242378235, 0.36745497584342957 ], [ 0, 0, 0, 0.4245395064353943, 0.3121894896030426 ], [ 0, 0, 0, 0, 0.3178136646747589 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 1 ]
from typing import List def make_a_pile(n: int) -> List[int]: """ Given a positive integer n, you have to make a pile of n levels of stones. The first level has n stones. The number of stones in the next level is: - the next odd number if n is odd. - the next even number if n is even. Return the number of stones in each level in a list, where element at index i represents the number of stones in the level (i+1). Examples: >>> make_a_pile(3) [3, 5, 7] """
[ [ 0, 0.7310585975646973, 0.5898783802986145, 0.6026273965835571, 0.40741705894470215 ], [ 0, 0, 0.5898783802986145, 0.6026273965835571, 0.40741705894470215 ], [ 0, 0, 0, 0.4824644923210144, 0.3405419886112213 ], [ 0, 0, 0, 0, 0.34553641080856323 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
from typing import List, Optional def prod_signs(arr: List[int]) -> Optional[int]: """ You are given an array arr of integers and you need to return sum of magnitudes of integers multiplied by product of all signs of each number in the array, represented by 1, -1 or 0. Note: return None for empty arr. Example: >>> prod_signs([1, 2, 2, -4]) 9 >>> prod_signs([0, 1]) 0 >>> prod_signs([]) None """
[ [ 0, 0.7310585975646973, 0.5830348134040833, 0.5987851023674011, 0.4025266170501709 ], [ 0, 0, 0.5830348134040833, 0.5987851023674011, 0.4025266170501709 ], [ 0, 0, 0, 0.4751497805118561, 0.33637896180152893 ], [ 0, 0, 0, 0, 0.3422231376171112 ], [ 0, 0, 0, 0, 0 ] ]
[ 0, 0, 0, 0, 0 ]
End of preview. Expand in Data Studio

Dataset Card for AGP-Training

Dataset Summary

AGP-Training is the dataset for training Adaptive Graph Pruning (AGP). We open-source our training set so that you can reproduce our work.

For further usage, please refer to our repository

Citation

If you find AGP helpful in your research, please consider citing:

@article{li2025adaptive,
  title={Adaptive Graph Pruning for Multi-Agent Communication},
  author={Li, Boyi and Zhao, Zhonghan and Lee, Der-Horng and Wang, Gaoang},
  journal={arXiv preprint arXiv:2506.02951},
  year={2025}
}
Downloads last month
125

Models trained or fine-tuned on Resurgammm/AGP-Training

Collection including Resurgammm/AGP-Training