domain stringclasses 7
values | sub_source stringclasses 15
values | coding_subclass stringclasses 6
values | messages listlengths 2 24 | tools listlengths 1 94 ⌀ |
|---|---|---|---|---|
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Implement a function `generate_valid_string()` that generates a random 16-character string. This string must include at least two uppercase letters, two lowercase letters, two digits, and two special characters. The function should return the generated string. The string should... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Implement a function `reverse_array(arr: List[int]) -> List[int]` that takes a list of integers (which may include both positive and negative numbers) and returns a new list with the elements reversed. The reversal should be done using a recursive approach. You may assume that ... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are tasked with writing a function that extracts extreme emotion words from a given text. Extreme emotion words are defined as those that express strong positive sentiments, such as 'great', 'awesome', 'amazing', 'interesting', and 'intriguing'. Your function should take a ... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Implement a function that sorts a 3D array based on the value of the third element in each sub-array. The function should return a new 3D array, sorted in ascending order by the third element of each sub-array. If any sub-array does not contain a third element, it should be exc... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Implement a function `reverse_fibonacci(n: int) -> List[int]` that computes the Fibonacci sequence up to the nth entry and returns it in reverse order. The Fibonacci sequence is defined as follows: F(0) = 0, F(1) = 1, and F(n) = F(n-1) + F(n-2) for n > 1. Ensure that your imple... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are tasked with generating a verification email message for a user account. Write a function `generate_verification_email(address: str, passwd: str) -> str` that takes in two parameters: `address`, a string representing the user's email address, and `passwd`, a string repre... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Given a list of integers and a comparison function, implement a function that calculates the median of the list. The median is the middle value when the list is sorted. If the list has an even number of elements, the median is the average of the two middle numbers. The comparis... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Implement the merge sort algorithm to sort an array of integers in ascending order. Write a function that takes an array of integers as input and returns a new array with the integers sorted in ascending order.",
"tool_calls": null
},
{
"role": "assistant",
"con... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Given a list of integers, implement a function `remove_odd_numbers(data)` that returns a new list containing only the even numbers from the input list. The original list should not be modified. You must not use any built-in filter functions or methods.",
"tool_calls": null
... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Given a list of integers, write a function `max_sum_subarray(arr: List[int]) -> int` that returns the maximum sum of any contiguous subarray within the list. A subarray is a contiguous part of an array. The function should handle both positive and negative integers. If the arra... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Implement a function that analyzes multiple nested lists of mixed data types (numbers, string literals, more sub-lists, etc.) to find and return the frequency percentage of a specified lexical item among all total string literals. The function should handle both case-sensitive ... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Given a string of text and a language code, implement a function that splits the text into individual words based on the language specified. For the Japanese language (language code 'JA'), the text should be split using Japanese word segmentation rules. For any other language, ... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Implement a function `get_person_name(yaml_string: str) -> str` that takes a YAML formatted string representing a person's information, including their name, age, and occupation. The function should return the person's name if the input string is correctly formatted and contain... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Given an integer n, write a function `find_next_mersenne_prime(n)` that returns the next Mersenne prime number greater than n. A Mersenne prime is defined as a prime number that can be expressed in the form 2^p - 1, where p is a prime number. If there is no Mersenne prime great... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are given a byte stream that contains a null-terminated string encoded in UTF-8. Your task is to implement a function that reads the byte stream starting from a specified offset and returns the string up to the null terminator. The input to the function will be a byte array... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are given a list of images categorized by their class names in a dataset. Your task is to split the images into two subsets based on the specified sizes: one for training and one for validation. You need to implement a function `split_images` that takes the following parame... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Write a function `find_twin_primes(start: int, end: int) -> List[Tuple[int, int]]` that returns a list of tuples containing all twin prime numbers between the specified `start` and `end` (inclusive). Twin prime numbers are defined as pairs of prime numbers that have a differenc... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are given a string `text` consisting of lowercase letters and a string `key` consisting of lowercase letters. Your task is to implement a function `encrypt(key: str, text: str) -> str` that simulates a simple encryption process. The encryption process involves shifting each... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Write a function that determines if a given statement about square roots is true or false. The statement will be in the format 'The square root of X is Y', where X is a non-negative integer and Y is a number (which can be negative). Your function should return True if the state... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are given a string containing Chinese numerals. Your task is to write a function that converts this string representation of a number into an integer. The input string will only consist of Chinese characters representing numbers and their units. The characters you may encou... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Write a function `simulate_quantum_interaction` that takes a list of lists, where each inner list contains three unique quantum numbers of three different particles. The function should randomly change a quantum number of each particle while ensuring that no two particles have ... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are tasked with improving a food delivery service's recommendation system. Given two lists, `historical_orders` and `new_orders`, your goal is to create a function that predicts food preferences based on historical customer orders. Each order is represented as a dictionary ... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Implement a function `search_avl_tree` that takes an array of distinct integers and a target integer as input. The function should construct an AVL tree from the given array and then search for the target integer in the tree. The function should return True if the target is fou... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Write a function `generate_unique_palindromes(n: int) -> List[str]` that generates an array of `n` unique palindromic strings, where each string must have a length between 5 and 10 characters. Each string should only consist of lowercase alphabetical characters and must be a va... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Given a value of any type, write a function that checks if the value is immutable. Immutable types include built-in types such as integers, floats, booleans, strings, tuples, ranges, and bytes. Additionally, consider custom types from a hypothetical library, such as Int, Number... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Implement a function `rank_lexemes` that takes a list of strings `data` and a string `start`. The function should identify and rank all the lexemes in the given list according to their frequency of occurrence, where the lexemes must commence with the specified string `start`. T... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are given a string representing a sequence of hexadecimal values. Your task is to convert this sequence into a list of decimal integers. The hexadecimal values are separated by whitespace and can be followed by comments (which start with the '#' character and continue to th... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are given a list of strings representing command-line arguments for a program. Your task is to parse these arguments and return a dictionary where each key is the name of an argument (without the leading dashes) and each value is the corresponding value provided in the argu... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are given a string that represents a Git LFS (Large File Storage) pointer file. Git LFS is an extension for Git that allows large files to be stored outside the Git repository. The pointer file contains metadata about the large file, including its version, SHA256 hash, and ... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are tasked with creating a Python function that extracts metadata from a given dictionary representing a Python package's setup configuration. The dictionary contains the following keys: 'long_description', 'classifiers', and 'install_requires', which represent the long des... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Given an input string, identify each adjacent pair of characters that contains one vowel and one consonant, and then invert their positions while retaining the original location of all other character types. Write a function `invert_positions(input_str: str) -> str` that implem... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are given a list of bone constraints defined by their rotation limits along the x, y, and z axes. Each bone constraint is represented as a tuple of two floats for each axis (min, max). Implement a function `set_bone_limits` that accepts a list of bones and their respective ... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Given a 2D array of strings, implement a function `find_word(matrix, word)` that searches for a specified word in its lowercase form. The function should return the index of the first occurrence of the word in the form of a tuple (row, column). The word can be split across mult... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Implement a function `calculate_teacher_score(qualifications: List[str], specialty: str, experience: int, institutions: List[str], published_papers: List[str]) -> int` that calculates a score based on the teacher's experience and the number of their published papers that are re... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Given a dictionary containing details about a typing test, implement a function `compute_accuracy(data)` that calculates the words per minute (WPM) and accuracy of the typed text compared to the prompted text. The input dictionary `data` will contain the following keys: \n- 'p... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Given a 4-dimensional matrix, write a function that returns the elements of the matrix in a spiral order. The matrix structure is defined as follows: a list containing 3D matrices, each of which is a list containing 2D matrices, and so on. Implement a function `spiral_traverse_... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are tasked with implementing a function that generates a histogram of confidence score distributions for detected objects. The function should take a list of confidence scores as input and return a histogram as a dictionary where the keys represent the confidence score rang... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Given a list of numeric data, calculate the magnitude (Euclidean norm) of each sublist. The input can be a nested list of numbers or a string representation of such a list. If the input list is empty or None, return an empty list. If the input is a string, it should be in a val... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are given the coordinates of a ship defined by its starting and ending points on a grid. Your task is to implement a function `get_ship_coordinates(start: Tuple[int, int], end: Tuple[int, int]) -> List[Tuple[int, int]]` that returns a list of all the coordinates occupied by... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are tasked with generating a random number from a predefined list of integers ranging from 1 to 90. However, the same number should not be displayed consecutively. Implement a function `generate_random_number(previous_number: int) -> int` that takes an integer `previous_num... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are tasked with creating a basic web application framework that allows you to manage routes and sub-applications. Implement a function `manage_routes` that takes a list of route definitions and a list of sub-applications. Each route definition is a tuple containing an HTTP ... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Write a function `create_array()` that generates an array of size 10 where each element is a random decimal number between 0 and 1, following these conditions: 1. No two consecutive elements should have the same value. 2. The average value of all elements in the array should be... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Implement a function `time_to_minutes(days: int, hours: int, minutes: int) -> List[int]` that accepts three integers representing durations in days, hours, and minutes. The function should convert these durations into total minutes, sort them from longest to shortest, and retur... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are tasked with calculating the normalized score for employees based on their contract type and work-related metrics. Implement a function `calculate_employee_score(contract_type: str, hours_per_week: int, additional_hours: int, responsibilities: int, projects: int) -> floa... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are given a list of users where each user is represented as a list. The first element in each list is the user's name, followed by the names of their friends. Implement a function `merge_friends(users)` that merges the friend groups such that if two users are friends with a... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Implement a function `arrange_decimals(numbers)` that takes a list of decimal numbers and arranges them in descending order. The function should handle edge cases such as duplicate values, negative numbers, and extremely large or small values. You should not modify the input li... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Implement a function `fermatsFactorBasic(N)` that factors a given odd integer `N` using Fermat's factorization method. The function should find two integers `factor1` and `factor2` such that `N = factor1 * factor2`. The function should return these factors as a tuple `(factor1,... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Develop a function that sorts a dictionary by the number of vowels and consonants in each key. If two keys contain an equal count of vowels, prioritize by the number of consonants. The sorting should be case-insensitive. The keys are strings. Implement a function `sort_dictiona... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are tasked with implementing a function that checks whether a given string representing an animal and a string representing a food item satisfy a specific condition. The condition is that the first character of the animal's name must be the same as the first character of th... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are tasked with extracting specific Google Cloud Storage (GCS) related tags from a given dictionary. Write a function `extract_gcs_tags(tags: Dict[str, Optional[str]]) -> Dict[str, Optional[str]]` that takes a dictionary `tags` containing GCS-related keys and returns a new ... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are given a list of dictionaries, where each dictionary represents a field with a unique 'id' and a 'name'. Your task is to implement a function that takes in a list of fields and a string 'name', and returns the value of the field corresponding to that name. If no field wi... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are given an array of integers, where each integer represents the height of a building. Your task is to write a function `max_water_trapped(heights: List[int]) -> int` that calculates the maximum amount of water that can be trapped between the buildings after it rains. The ... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are given a list of integers representing a Bluetooth address, where each integer is a byte (0 to 255). Your task is to implement a function that converts this list of integers into a formatted string representation of the Bluetooth address. The output should be in the form... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Implement a function `bubble_sort(arr: List[int]) -> List[int]` that takes a list of integers and sorts it in ascending order using the bubble sort algorithm. The function should return the sorted list. You may not use any built-in sorting functions or libraries.",
"tool_ca... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are given a list of strings representing package names. Your task is to write a function that takes this list as input and returns a new list that contains only the package names that start with the letter 'a' (case insensitive). If the input list is empty, return an empty ... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Given a list of floating-point numbers and a positive integer window size, implement a function that calculates the rolling mean of the numbers in the list. The rolling mean for a given index is defined as the average of the numbers in the window defined by the index and the pr... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Given a list of integers, implement a function that removes any number that occurs more than once, while keeping the order of the remaining numbers the same as the original list. The function should return a new list containing only the unique integers. Implement the function `... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Implement a function `manage_account` that simulates basic banking operations. The function should take three parameters: an initial balance (float), a deposit amount (float), and a withdrawal amount (float). It should return the final balance after performing the deposit follo... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are tasked with creating a function that draws a line on a canvas based on given coordinates and color. Implement a function called `draw_line(x1: int, y1: int, x2: int, y2: int, color: str) -> str`, which takes the following parameters:\n\n- `x1` (int): The x-coordinate of... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are given a list of integers. Write a function that returns the maximum sum of any contiguous subarray of the list. A contiguous subarray is defined as a sequence of elements that are adjacent in the array. Implement the function `max_subarray_sum(arr: List[int]) -> int` wh... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates a file upload process for a web application. The function should take in a list of tuples, where each tuple contains a file name and a boolean indicating whether the file upload was successful. Your function should return a... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are given a list of integers representing the daily stock prices of a certain stock. Your task is to write a function that calculates the maximum profit that can be obtained by buying and selling the stock at most once. If it is not possible to make any profit, the function... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "Implement a function `compareOne(a, b)` that accepts two parameters which can be integers, floating-point numbers, or string representations of real numbers. The function should return the larger value while retaining the original type of that value. If both values are equal, r... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are tasked with creating a function that returns the weather forecast for a given city and state for the next three days. The function should take two parameters: a string 'city' representing the name of the city and a string 'state' representing the state abbreviation. The... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "Write a Python program that takes a list of values from standard input (as a single line of input), and computes the sum of all positive numbers in the list. Improve readability, performance, and robustness:\n\n- If the input is not a list or contains non-numeric values (string... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Two players called $\\mathbf{P1}$ and $\\textbf{P2}$ are playing a game with a starting number of stones. Player $1$ always plays first, and the two players move in alternating turns. The game's rules are as follows:\n\nIn a single move, a player can remove either $2$, $3$, or ... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.\n\nA *directed tree* is a directed graph such that if all edges were undirected, this graph would be a tree. A *rooted directed tree* is a directed tree in which there is one... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Given a number `n` we will define its scORe to be `0 | 1 | 2 | 3 | ... | n`, where `|` is the [bitwise OR operator](https://en.wikipedia.org/wiki/Bitwise_operation#OR).\n\nWrite a function that takes `n` and finds its scORe.\n\n---------------------\n| n | scORe n |\n|---... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "You are given an integer n. You have to apply m operations to it.\n\nIn a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For example, 1912 becomes 21023 after applying the operation once.\n\nYou have to find the ... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "Given a list of people, each represented by a tuple of their name and their age as a string in the format \"X years, Y months, Z days\" (for example, \"60 years, 5 months, 12 days\"), write a program that finds and prints the name of the oldest person. If there are multiple peo... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Takahashi is taking exams on N subjects. The score on each subject will be an integer between 0 and K (inclusive).\nHe has already taken exams on N-1 subjects and scored A_i points on the i-th subject.\nHis goal is to achieve the average score of M points or above on the N subj... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates the creation of a directory given a specified path. The function should take a string representing the directory path as input and return the same path if the directory does not already exist. If the directory already exist... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Variation of this nice kata, the war has expanded and become dirtier and meaner; both even and odd numbers will fight with their pointy `1`s. And negative integers are coming into play as well, with, ça va sans dire, a negative contribution (think of them as spies or saboteurs)... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "Given an array of n integers, print the elements in the following order: smallest element, largest element, 2nd smallest element, 2nd largest element, 3rd smallest element, 3rd largest element and so on until all elements are printed.\n\nInput format\n1. An integer n (1 ≤ n ≤ 1... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "We will use the Flesch–Kincaid Grade Level to evaluate the readability of a piece of text. This grade level is an approximation for what schoolchildren are able to understand a piece of text. For example, a piece of text with a grade level of 7 can be read by seventh-graders an... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according ... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Give you N cards. Only one natural number is written on each card. However, the same number is never written.\n\nFrom now on, as a question, I will say an appropriate natural number. Please answer the largest remainder you get when you divide the number on the card you have by ... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Bangalore City, where peace prevails most of the time. Not everyone is a huge fan of peace, though. Certainly not Mr. XYZ, whose identity is not known to us - yet. Mr. XYZ has somehow managed to bring vampires and zombies to Bangalore City to attack and destroy the city.\n\nFat... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Given a long number, return all the possible sum of two digits of it.\n\nFor example, `12345`: all possible sum of two digits from that number are:\n\n [ 1 + 2, 1 + 3, 1 + 4, 1 + 5, 2 + 3, 2 + 4, 2 + 5, 3 + 4, 3 + 5, 4 + 5 ]\n\nTherefore the result must be:\n\n [ 3, 4, 5,... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Create a __moreZeros__ function which will __receive a string__ for input, and __return an array__ (or null terminated string in C) containing only the characters from that string whose __binary representation of its ASCII value__ consists of _more zeros than ones_. \n\nYou sho... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates a simple library system. The library contains books, and users can perform the following operations: add books, remove books, display the list of available books, borrow a book, and return a borrowed book. Your function... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Example\n\nInput\n\n4 4\n1 2 3\n1 3 3\n2 3 3\n2 4 3\n\n\nOutput\n\n1 3\n",
"tool_calls": null
},
{
"role": "assistant",
"content": "```python\nimport sys\n\ndef main():\n data = sys.stdin.read().split()\n if not data:\n return\n it = iter(data)\n... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "You are tasked with implementing a function to determine the order of rebuilding tasks based on the user's choice of direction. The function should accept a list of tasks and a rebuild direction as input. The rebuild direction can be either 'fromstart' or 'fromend'. When 'froms... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Given is a string S consisting of L and R.\nLet N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square from the left.\nThe character written on the leftmost square is always R, and the chara... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "You are tasked with checking whether a data uploading process should be executed based on certain configuration settings. Write a Python function `should_execute_upload(settings: dict) -> bool` that takes a dictionary representing configuration settings as input and returns a b... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "You are given a list of people, where each person is represented by their name, age, and email address. The list is given in JSON format, one person per line. Your task is to filter out duplicates based on the email field, keeping only the first occurrence of each email, and pr... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "You are tasked with creating a function that processes a list of image filenames from a hypothetical image database. Your function should take a list of image filenames and return a filtered list containing only the unique filenames. Write a Python function `get_unique_filename... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "You are tasked with creating a function that retrieves the name of a storage bucket from a given string. The function should take a single parameter, `bucket_name` which represents the name of the bucket. Your task is to implement the function `get_bucket_name` that returns the... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "You are given a list of intervals. Each interval is described by two integers, the start and end of the interval (inclusive), and is given on a separate line. There may be multiple intervals. The input is structured as follows:\n\n- The first line contains an integer n, the num... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "You are tasked with creating a Python function that processes a list of posts associated with various providers and returns a specific data structure. Write a Python function `generate_provider_data` that takes a list of dictionaries as an argument, where each dictionary repres... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "In a class of N students, each student scored a distinct mark in a test. A student passes if their score is strictly greater than the passing mark.\n\nFor every test case you are given the number of students N, the number of students X that must pass, and the list of the N dist... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "Write a program that reads a Python dictionary from standard input. The dictionary contains hashable values. Your program should output a new dictionary with the keys and values swapped such that:\n- The new dictionary's keys are the original values.\n- The values are lists of ... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "Write a program that reads a string from standard input and checks whether all characters in the string are unique (no character repeats).\n\nThe program should:\n- Print 'True' if all characters are unique.\n- Print 'False' if there are any duplicate characters.\n- If the inpu... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "Write a Python program that reads two strings from standard input (each on its own line), and outputs the Levenshtein distance between them. The Levenshtein distance between two strings is the minimum number of single-character edits (insertions, deletions, or substitutions) re... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "Write a Python program that implements the QuickSort algorithm in an efficient manner suitable for large datasets. Use randomized pivot selection, and optimize the algorithm to reduce stack depth during recursion (for example, by sorting smaller partitions first and replacing t... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "A square chocolate bar is represented by an n × n grid. Columns are numbered from 1 to n from left to right and rows are numbered from 1 to n from top to bottom.\n\nThe anti-diagonal consists of the cells (x , y) that satisfy x + y = n + 1. All cells strictly below the anti-dia... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "Write a program that reads a single value from standard input, which can be either an integer or a floating-point number (possibly negative). The program must output the hexadecimal representation of the absolute value of the input, truncating the decimal part if the input is a... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "You are given a binary matrix with H rows and W columns (1 ≤ H, W ≤ 1400). Each entry is either 0 or 1.\n\nStandard Input\nThe first line contains two integers H and W separated by a space.\nEach of the next H lines contains W integers (0 or 1) separated by single spaces, descr... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "You are given a set of integers, possibly containing duplicate elements. Write a program that reads the elements of the set from standard input (space-separated integers on a single line) and prints all unique subsets (the power set) in lexicographical order, one subset per lin... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "Write a Python program that reads a JSON configuration for an HTML form from standard input and writes a corresponding HTML page with a form to standard output. The JSON configuration will specify the form title and a list of fields, which can include text inputs, email inputs,... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.