messages
listlengths
3
3
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Live Parentheses Editor\n\n**Time limit:** 2 seconds\n**Memory limit:** 512 MB\n\nYou...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Maximum Subarray Sum with One Deletion – Range Queries\n\n**Time Limit:** 1 second\n...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Palindromic DNA Motifs\n\nIn a cutting‑edge bioinformatics pipeline, a researcher nee...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def book_seats(R, C, Q, requests):\n \"\"\"\n You have been asked to develop a mov...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Homopolymer Queries\n\n### Problem Statement\nYou are developing a bioinformatics ana...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Problem Statement\n\nA maintenance robot is equipped with **n** energy cells arranged...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Sort the List: Iterative vs Recursive\n\nYou are given two algorithms to sort a list...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Finding the Minimum Steps in a Grid\n\n**Background**:\nConsider an `m x n` grid whe...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: **Problem Statement**\n\nYou are a cartographer analyzing a satellite‑derived map of a r...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Maximum Safe Deletions in a Security Log\n\n**Problem Statement**\n\nA security syst...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Using a similar format and style as the provided question, here is a new coding assessme...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Implement a Min-Heap Using an Array\n\n#### Scenario:\nHeaps are a specialized tree-...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Persistent Linear Document Editor\n\nYou are asked to implement a **persistent** sin...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Reconstructing the Hidden Phrase\n\n### Problem Statement\nArchaeologists have discov...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### ZigZag Signal Path\n\n**Time Limit:** 2 seconds\n**Memory Limit:** 512 MB\n\n#### De...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Given an array of integers `nums`, you need to find the length of the longest contiguous...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: from typing import List, Tuple\n\ndef find_shortest_path(n: int, m: int, edges: List[Tup...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def check_schedule_conflicts(n, schedules):\n \"\"\"\n Given the number of schedul...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Lexicographically Smallest String After K Adjacent Swaps\n\n**Time Limit:** 2 second...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: **Problem Statement**\n\nYou are given a string `S` consisting of `N` (1 ≤ N ≤ 10⁶) lowe...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Given a matrix `grid` of size `n x m`, where each cell contains an integer representing ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Many websites use weighted averages of various polls to make projections for elections. ...
[ { "role": "system", "content": "You will complete a python code block to implement the desired function. You will only write code blocks." }, { "role": "user", "content": "Complete the following python code: def find_Min_Sum(a,b,n)::\n \"\"\" Write a python function to find the minimum sum of...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Satellite Image Reorientation\n\n**Problem Statement**\nA low‑Earth‑orbit satellite ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: \nGiven two squares on a two-dimensional plane, find a line that would cut these two squ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Problem Statement\nA security analyst has recovered a massive dump of integer fragmen...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Maximum Growth Streak\n\n**Time Limit:** 1 second\n\n**Memory Limit:** 256 MB\n\n###...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: #### Question:\n\nIn this task, you are required to implement the merge sort algorithm t...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: You are given a string that represents a sequence of moves on an infinite grid. The move...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Largest Intact Surveillance Zone\n\n**Problem Description**\nYou are in charge of a ...
[ { "role": "system", "content": "You will complete a python code block to implement the desired function. You will only write code blocks." }, { "role": "user", "content": "Complete the following python code: ```python\ndef min_deletions_to_even_product(arr: list[int]) -> int:\n \"\"\"Minimum ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Maximum Profit Path in an Investment Decision Tree\n\n**Time Limit:** 2 seconds\n**M...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def shortest_path_length(graph: dict, start: int, end: int) -> int:\n \"\"\" \n De...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Coding Assessment: Optimizing Warehouse Inventory Management System \n\n#### Context...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Problem Statement\nA coding bootcamp has just finished its introductory meeting. The...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: A large financial institution uses a sophisticated network of computers and processes to...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def kth_smallest_element(arr1, arr2, k):\n \"\"\"\n Returns the k-th smallest elem...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Problem Statement\n\nYou are given a line of **resource nodes**. The i‑th node contai...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Minimum Length Subarray with Sum at Least S\n\n**Problem Description**\n\nA logistic...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def longest_increasing_path(matrix: List[List[int]]) -> int:\n \"\"\" Given an `m x n...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: class SalesData:\n def __init__(self, transactions):\n self.transactions = tra...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: from typing import List\n\ndef min_possible_final_array_sum(B: List[int]) -> int:\n \...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Dynamic Shoreline\n\n### Description\nA coastal city is represented by a rectangular ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Ancient Glyph Evolution\n\n**Time Limit:** 2 seconds\n**Memory Limit:** 256 MB\n\n###...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Sensor Line – Dynamic Suffix‑Flip Counter\n\n**Time limit:** 1 second\n\n**Memory li...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: You are given a list of integers representing the heights of trees in a forest. You need...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: You are given an array of integers $$$a$$$ of size $$$n$$$, and a single integer $$$k$$$...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def max_arithmetic_subsequence_length(n: int, a: List[int]) -> int:\n \"\"\" Paul has...
[ { "role": "system", "content": "You will complete a python code block to implement the desired function. You will only write code blocks." }, { "role": "user", "content": "Complete the following python code: ```python\ndef maintain_heap(N, arr, queries):\n \"\"\"\n You are given an array `...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def final_amounts(initial_X: int, initial_Y: int, evaporation_amount: int) -> Tuple[int,...
[ { "role": "system", "content": "You will complete a python code block to implement the desired function. You will only write code blocks." }, { "role": "user", "content": "Complete the following python code: def func():\n \"\"\" A monochrome screen is stored as a single array of int, allowing...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Versioned Ledger Queries\n\n**Time Limit:** 2 seconds\n**Memory Limit:** 256 MB\n\n#...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def min_power_usage(n: int, l: int, lamps: List[Tuple[int, int, int]]) -> int:\n \"\"...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Problem Statement\n\nYou are tasked with implementing a function that counts the occu...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def is_prime(n):\n \"\"\"\n Returns True if n is a prime number, otherwise False.\...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: class Node:\n def __init__(self, key):\n self.data = key\n self.left = ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def can_form_palindrome(s: str) -> str:\n \"\"\"\n Determine if the characters of ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Dynamic Total Latency in a Satellite Network\n\n### Statement\nA space agency operate...
[ { "role": "system", "content": "You will complete a python code block to implement the desired function. You will only write code blocks." }, { "role": "user", "content": "Complete the following python code: ```python\ndef longest_compound_word(words):\n \"\"\"\n In the ancient Xel'Naga ar...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Problem Statement\nYou are working for a hardware design company that builds circular...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: You are given a string `s` and a list of words `words` from the string `s`. The goal is ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def longest_word(s: str, words: List[str]) -> str:\n \"\"\"\n Given a string s and...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def min_cost_to_palindrome(s: str) -> int:\n \"\"\" Return the minimum cost required ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: from typing import List\n\ndef largest_water_body(matrix: List[List[int]]) -> int:\n ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def count_unique_subarrays(n: int, k: int, elevations: List[int]) -> int:\n \"\"\"\n ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: Given a positive integer N, MoEngage wants you to determine if it is possible to rearran...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Self‑Healing Network\n\nIn a distributed system, devices are organized in a **binary...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Problem Statement\n\nYou are in charge of deploying **k** identical sensors on a rec...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: There are N students in a class and each student has exactly one best friend in the clas...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Satellite Telemetry Re‑ordering\n\n**Time Limit:** 1 second\n**Memory Limit:** 256 M...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Problem Statement\n\nYou are given a long DNA sequence `s` and a shorter DNA pattern...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def is_possible_to_sort_boxes(test_cases):\n \"\"\" Determines if it is possible to s...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def check_ingredients(n: int, required: List[int], available: List[int]) -> str:\n \"...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Word Frequency Counter: Efficient Text Analysis\n\nDesign a class `TextAnalyzer` tha...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Warehouse Reordering\n\n**Time Limit:** 1 second\n\n**Memory Limit:** 256 MB\n\n####...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Longest Palindromic‑Convertible Substring\n\n**Problem Statement**\n\nA cryptographe...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: from typing import List\nfrom collections import defaultdict\n\nclass DigitalLibrarySyst...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Minimum Add Operations\n\n**Time Limit:** 1 second\n**Memory Limit:** 256 MB\n\n---\...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: **Problem Statement**\n\nA legacy calibration device prints the constant π for the opera...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Stable Warming Trend\n\n**Time Limit:** 1 second\n\n**Memory Limit:** 256 MB\n\n####...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def min_operations(a: str, b: str) -> int:\n \"\"\"\n Returns the minimum number o...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def min_moves_to_sort(arr):\n \"\"\"Returns the minimum number of moves required to s...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def transpose_matrix(matrix):\n \"\"\"\n Transpose the given matrix.\n\n :param...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Balanced Split Points\n\n**Time Limit:** 2 seconds \n**Memory Limit:** 256 MB\n\n###...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Peak Load on the Digital Campus\n\nThe university has deployed a digital campus plat...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Typist's Letter Bank\n\n**Time Limit:** 2 seconds\n**Memory Limit:** 256 MB\n\n### Pr...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Rotating Platform Balance – Online Edition\n\n### Story\nA high‑precision assembly li...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def sequence_operations(n: int, q: int, operations: List[str]) -> List[int]:\n \"\"\"...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Deepest Shared Namespace\n\n**Time Limit:** 1 second\n**Memory Limit:** 256 MB\n\n##...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Real‑Time Expression Evaluation\n\n**Problem Statement**\n\nA data‑analytics engine ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: \nThe median is the middle value in an ordered integer list. If the size of the list is ...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Problem Statement\nYou are tasked with implementing a function to manage a limited c...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def most_frequent_word(text: str) -> str:\n \"\"\"\n Return the most frequently oc...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ## Problem Statement\n\nA research robot is exploring a square **terrain matrix** `grid`...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: There is a town with n buildings connected by m roads; each road has a travel time assoc...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: import heapq\n\ndef kth_largest_transaction(transactions: list[float], k: int) -> float:...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: You are given a directed graph with `n` vertices and `m` edges, represented as an adjace...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: You are given two non-negative integers N and K. Your task is to find the smallest non-n...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def longestLineOfConsecutiveOnes(mat):\n \"\"\" \n Given an m x n binary matrix `m...
[ { "role": "system", "content": "You will write python program to solve algorithm problems. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: ### Problem Statement\nYou are hired to implement the core of a high‑throughput logging ...