domain stringclasses 7
values | sub_source stringclasses 15
values | coding_subclass stringclasses 6
values | messages listlengths 2 24 | tools listlengths 1 94 ⌀ |
|---|---|---|---|---|
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "You have two arguments: ```string``` - a string of random letters(only lowercase) and ```array``` - an array of strings(feelings). Your task is to return how many specific feelings are in the ```array```. \n\nFor example: \n\n```\nstring -> 'yliausoenvjw'\narray -> ['anger', 'a... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "Write a program that reads two floating point numbers, x and y, from standard input (one per line), divides x by y, and prints the result. If division by zero occurs, log the error message to a file named 'error.log' and ensure that the log file does not exceed 10 lines (keep o... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "Write a Python program that acts as a simple calculator. The program should prompt the user via standard input to perform one of four operations: addition, subtraction, multiplication, or division. Then, prompt the user to enter two numbers. Output the result of the operation t... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "You are tasked with implementing a function `check_note_update(note_title: str, note_text: str, updated_text: str) -> bool` that checks whether a note's content should be updated based on a given updated text. The function should return `True` if the note's text is the same as ... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "Write a program that reads a single value n from standard input and computes the double factorial (n!!), using a recursive algorithm. The program must log each recursive call and its depth (the number of recursive calls from the start), formatting the log as:\n\ndouble_factoria... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "You are given a string s.\nAmong the different substrings of s, print the K-th lexicographically smallest one.\nA substring of s is a string obtained by taking out a non-empty contiguous part in s.\nFor example, if s = ababc, a, bab and ababc are substrings of s, while ac, z an... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Implement a function which behaves like the uniq command in UNIX.\n\nIt takes as input a sequence and returns a sequence in which all duplicate elements following each other have been reduced to one instance.\n\nExample:\n\n```\n[\"a\", \"a\", \"b\", \"b\", \"c\", \"a\", \"b\",... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "Write a Python program that reads an integer n from standard input, and prints out the nth Fibonacci number twice:\n- First, the value as computed by a recursive Fibonacci function\n- Second, the value as computed by an iterative Fibonacci function\n\nIf the input is not a non-... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters.\n\nLet A be a set of positions in the string. Let's call it pretty if following conditions are met: letters on positions from A in the... | null |
Coding | Dolci-Python-Algorithms | func_signature_completion | [
{
"role": "user",
"content": "You are given the following Python class that defines a binary tree node:\n\nclass TreeNode:\n def __init__(self, x):\n self.val = x\n self.left = None\n self.right = None\n\nModify this class to add a method is_balanced that checks if the binary search ... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "Create a program that simulates a simple bank account using standard input and output. The program should support the following commands:\n\n- deposit amount: Deposit the specified positive amount to the account.\n- withdraw amount: Withdraw the specified positive amount from t... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Given an integer a as input, print the value a + a^2 + a^3.\n\n-----Constraints-----\n - 1 \\leq a \\leq 10\n - a is an integer.\n\n-----Input-----\nInput is given from Standard Input in the following format:\na\n\n-----Output-----\nPrint the value a + a^2 + a^3 as an integer.\... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "You are tasked with implementing a function `can_build_model(master_config)` that determines whether a machine learning model can be built based on a given configuration. The function should take a dictionary `master_config` as input, which contains the following keys: 'Core_Co... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "You are tasked with creating a Python function that processes a list of dictionaries representing authors and their email addresses. Each dictionary in the input list will have the keys 'author_name' and 'author_email', where 'author_email' holds the email address of the author... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "You must create a function, `spread`, that takes a function and a list of arguments to be applied to that function. You must make this function return the result of calling the given function/lambda with the given arguments.\n\neg:\n```python\nspread(someFunction, [1, true, \"F... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).\n\nYou may assume that the intervals were initially sorted according to their start times.\n\nExample 1:\n\n\nInput: intervals = [[1,3],[6,9]], newInterval = [2,5]\nOutput: ... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "Given an integer upper_limit (2 ≤ upper_limit ≤ 10^4) supplied on standard input, find the largest ordered pair of integers (m , n) that satisfies the following conditions:\n1. upper_limit > m > n > 0\n2. Both m + n and m − n are perfect squares.\n\nA pair A = (a0 , a1) is cons... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "Given a JSON string and a key, write a program that parses the JSON string (which may be deeply nested) and returns all unique, non-null values associated with the specified key. If the key does not occur anywhere in the JSON structure, output an empty list. Duplicate values an... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "Given two DNA sequences, each as a string containing only the characters 'A', 'T', 'C', and 'G', write a program that reads these two strings from standard input (one per line), and outputs the length and the value of the longest common subsequence (LCS) between them. The outpu... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "Implement a circular doubly linked list from scratch (do not use any built-in data structures or libraries that implement linked lists).\n\nGiven a string representing a DNA sequence, count the number of occurrences of each nucleotide (A, T, C, G) using a circular doubly linked... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates a travel agency's itinerary management. The function takes a destination as input and returns a predefined list of itineraries for that destination. You are provided with the following destinations and their corresponding i... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "You are tasked with writing a function that takes an integer representing an account ID and a string representing the account hash. The function should return a string that indicates whether the account is 'Active', 'Inactive', or 'Unknown'. The rules for determining the status... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Vova plans to go to the conference by train. Initially, the train is at the point $1$ and the destination point of the path is the point $L$. The speed of the train is $1$ length unit per minute (i.e. at the first minute the train is at the point $1$, at the second minute — at ... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "The night after the graduation ceremony graduate students of German University in Cairo (GUC) are playing darts. As there's no real dart board available, the photographs of members of the GUC upper management are being used.\n\nSo, n rectangular photos are placed on the wall. T... | null |
Coding | Dolci-Python-Algorithms | leetcode_class_solution | [
{
"role": "user",
"content": "You are tasked with creating a function that processes a list of guest data represented as strings in the format 'name, email, age'. Each string contains a guest's name, email, and age separated by commas. Your function should validate the guest data and return a list of valid ... | null |
Coding | Dolci-Python-Algorithms | leetcode_class_solution | [
{
"role": "user",
"content": "You are tasked with creating a function that processes a list of movie file names and extracts their IMDb IDs. The function should take a list of file names as input and return a list of tuples, where each tuple contains the file name and its corresponding IMDb ID. The IMDb ID ... | null |
Coding | competitive-programming-cpp | leetcode_class_solution | [
{
"role": "user",
"content": "Print numbers from 1 to N without the help of loops.\nExample 1:\nInput:\nN = 10\nOutput: 1 2 3 4 5 6 7 8 9 10\nExample 2:\nInput:\nN = 5\nOutput: 1 2 3 4 5\n \nYour Task:\nThis is a function problem. You only need to complete the function printNos() that takes N as parameter a... | null |
Coding | competitive-programming-cpp | leetcode_class_solution | [
{
"role": "user",
"content": "Given a polynomial represented as poly[] of size n and a value x, compute value of the polynomial for given x. The result should be computed under modulo 10^{9}+7. \nExample 1:\nInput: n = 4, x = 3\npoly = {2, -6, 2, -1}\nOutput: 5\nExplaination: Output is value of 2x^{3} - 6x... | null |
Coding | competitive-programming-cpp | leetcode_class_solution | [
{
"role": "user",
"content": "Initially, the zoo have a single chick. A chick gives birth to 2 chicks every day and the life expectancy of a chick is 6 days. Zoo officials want to buy food for chicks so they want to know the number of chicks on an N^{th} day. Help the officials with this task.\n \nExample 1... | null |
Coding | competitive-programming-cpp | leetcode_class_solution | [
{
"role": "user",
"content": "You are given an array arr[ ] of integers having N elements and a non-weighted undirected graph having N nodes and M edges. The details of each edge in the graph is given to you in the form of list of list. \nYour task is to find the number of lucky permutations of the given ar... | null |
Coding | Dolci-Python-Algorithms | leetcode_class_solution | [
{
"role": "user",
"content": "A one-way tunnel was used by n cars, numbered from 1 to n. Every car entered the tunnel exactly once and exited exactly once, always moving at a constant speed.\n\nTwo cameras recorded the order of the cars: one at the entrance and one at the exit. No two cars entered or exited... | null |
Coding | Dolci-Python-Algorithms | leetcode_class_solution | [
{
"role": "user",
"content": "Given a list of integers, classify each integer as either prime or non-prime. Primes are integers greater than 1 that are divisible only by 1 and themselves. Zero and negative numbers should be treated as non-prime. Your program should read a single line from standard input, co... | null |
Coding | Dolci-Python-Algorithms | leetcode_class_solution | [
{
"role": "user",
"content": "Hackerland is a one-dimensional city. The i-th house is located at coordinate x[i] (an integer). A radio transmitter installed on a house with range k serves every house whose coordinate differs from its own by at most k.\n\nYour task is to place transmitters on some of the hou... | null |
Coding | competitive-programming-cpp | leetcode_class_solution | [
{
"role": "user",
"content": "Given a graph which represents a flow network with N vertices numbered 1 to N and M edges.Find the maximum flow from vertex numbered 1 to vertex numbered N.\nIn a flow network,every edge has a flow capacity and the maximum flow of a path can't exceed the flow-capacity of an edg... | null |
Coding | competitive-programming-python | leetcode_class_solution | [
{
"role": "user",
"content": "Given a String S, Find all possible Palindromic partitions of the given String.\n \nExample 1:\nInput:\nS = \"geeks\"\nOutput:\ng e e k s\ng ee k s\nExplanation:\nAll possible palindromic partitions\nare printed.\nExample 2:\nInput:\nS = \"madam\"\nOutput:\nm a d a m\nm ada m\n... | null |
Coding | competitive-programming-python | leetcode_class_solution | [
{
"role": "user",
"content": "Given an unsorted array Arr of N positive and negative numbers. Your task is to create an array of alternate positive and negative numbers without changing the relative order of positive and negative numbers.\nNote: Array should start with a positive number and 0 (zero) should ... | null |
Coding | competitive-programming-python | leetcode_class_solution | [
{
"role": "user",
"content": "Given an array A[ ] of N integers and an integer X. In one operation, you can change the i^{th} element of the array to any integer value where 1 ≤ i ≤ N. Calculate minimum number of such operations required such that the bitwise AND of all the elements of the array is strictly... | null |
Coding | competitive-programming-cpp | leetcode_class_solution | [
{
"role": "user",
"content": "You are given a decimal number n. You need to find the gray code of the number n and convert it into decimal.\nGray code is a binary numeral system where two successive values differ in only one bit.\nFor example, the sequence of Gray codes for 3-bit numbers is: 000, 001, 011, ... | null |
Coding | competitive-programming-cpp | leetcode_class_solution | [
{
"role": "user",
"content": "Given an integer N, list all the divisors of N (excluding N) in sorted order. Find the number formed by performing the XOR operation on each divisor in the list.\nExample 1:\nInput: N = 10\nOutput:\n1 2 5\n6\nExplanation:\nAll the proper divisors are 1, 2 and 5.\n1 XOR 2 XOR 5 ... | null |
Coding | competitive-programming-cpp | leetcode_class_solution | [
{
"role": "user",
"content": "You are given two four digit prime numbers Num1 and Num2. Find the distance of the shortest path from Num1 to Num2 that can be attained by altering only one single digit at a time. Every number obtained after changing a digit should be a four digit prime number with no leading ... | null |
Coding | competitive-programming-cpp | leetcode_class_solution | [
{
"role": "user",
"content": "You are given an array Arr of size N. You have to find the K-th largest sum of contiguous subarray within the array elements.\n \nExample 1:\nInput:\nN = 3\nK = 2\nArr = {3,2,1}\nOutput:\n5\nExplanation:\nThe different subarray sums we can get from the array\nare = {6,5,3,2,1}.... | null |
Coding | competitive-programming-cpp | leetcode_class_solution | [
{
"role": "user",
"content": "Given two integers L and R . Find the resultant after applying the series of Bitwise AND ( & ) operation on every natural number between the Range L and R (including both).\n \nExample 1:\nInput: L = 8, R = 13\nOutput: 8\nExplanation: \n8 AND 9 AND 10 AND 11 AND 12 AND 13 = 8.\... | null |
Coding | competitive-programming-cpp | leetcode_class_solution | [
{
"role": "user",
"content": "Given an array and two integers say, x and y, find the number of sub-arrays in which the number of occurrences of x is equal to number of occurrences of y.\nExample 1:\nInput:\nn = 4, x = 1, y = 2\narr[] = {1, 2, 1}\nOutput: 2\nExplanation:\nThe possible sub-arrays have same eq... | null |
Coding | competitive-programming-cpp | leetcode_class_solution | [
{
"role": "user",
"content": "Once there was a Geek he was quite intelligent and was also fond of jumping. But he jumped in a pattern like 1 leap, 2 leap, 3 leap and again from the start after 3rd leap.\n1 leap means if Geek is at point P then he will jump to P+1.\n2 leap means if Geek is at point P then he... | null |
Coding | competitive-programming-cpp | leetcode_class_solution | [
{
"role": "user",
"content": "Given two arrays A and B of positive integers of size N and M where N >= M, the task is to maximize the dot product by inserting zeros in the second array but you cannot disturb the order of elements.\nDot Product of array A and B of size N is A[0]*B[0] + A[1]*B[1]+....A[N]*B[N... | null |
Coding | competitive-programming-cpp | leetcode_class_solution | [
{
"role": "user",
"content": "There are n cities and m edges connected by some number of flights. You are given an array flights where flights[i] = [from_{i}, to_{i}, price_{i}] indicates that there is a flight from the city from_{i} to city to_{i} with cost price_{i}.\nYou are also given three integers src... | null |
Coding | competitive-programming-cpp | leetcode_class_solution | [
{
"role": "user",
"content": "Given a set of N jobs where each job_{i} has a deadline and profit associated with it. Each job takes 1 unit of time to complete and only one job can be scheduled at a time. We earn the profit if and only if the job is completed by its deadline. The task is to find the number o... | null |
Coding | competitive-programming-cpp | leetcode_class_solution | [
{
"role": "user",
"content": "Given two integers ‘n’ and ‘sum’, find the count of all n digit numbers whose sum of digits is ‘sum’. Leading 0’s are not counted as digits. \nExample 1:\nInput: n = 2, sum = 2\nOutput: 2\nExplaination: \nThe 2 digit numbers are 11 and 20.\nExample 2:\nInput: n = 1, sum = 10\nO... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.