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: ## K-th Smallest Measurement\n\n**Time Limit:** 2 seconds \n**Memory Limit:** 256 MB\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 given a sequence of sensor readings recorded over time....
[ { "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 num_of_subsequences(s: str, word: str) -> int:\n \"\"\"\n Returns the 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 max_treasures(N, T, treasures, start_x, start_y):\n \"\"\" Determine the maximum ...
[ { "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_laser(n: int, m: int, xs: int, ys: int, xl: int, yl: 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 rob_houses(arr, m):\n \"\"\"\n Given a list of non-negative integers represent...
[ { "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\nRoma is an avid online poker player. On his favourite site each...
[ { "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: ## Monthly Temperature Pivot\n\nThe National Weather Service collects a massive log of 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: Given an integer array `heights` representing the heights of a series of buildings along...
[ { "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_deletions_to_balance(S: str) -> int:\n \"\"\" Determine the minimum number 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: ## Rising River Profile\n\n**Time Limit:** 2 seconds\n**Memory Limit:** 512 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: \nGiven an integer array hours representing times in hours, return an integer denoting 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: ### Problem Statement\n\nYou are implementing the back‑end of a live code editor that su...
[ { "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: Disk Utilization Over Time Simulator\n\nYour task is to implement a functi...
[ { "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 high‑frequency sensor array records a stream of integer readi...
[ { "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 Log Buffer\n\n**Time Limit:** 2 seconds\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: ## Infinite Grid K‑in‑a‑Row\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 find_rendezvous_point(coordinates):\n \"\"\"\n Finds the coordinates of the op...
[ { "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: ### Pipeline Security Upgrade\n\nA long oil pipeline is divided into **n** consecutive 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: You are given an array of integers and a window size 'k'. Implement the function 'max_sl...
[ { "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 longest_increasing_subsequence_length(array: List[int]) -...
[ { "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 plant_flowers(N, G, M, flowers):\n \"\"\"\n Plants flowers in the garden follo...
[ { "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 stream of data representing stock prices over time for a particular stoc...
[ { "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: Background\n----------------\nIn the land of Algravia, there exists a magical forest whi...
[ { "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 Re‑wiring Operations in a Data‑Center Grid\n\n#### Problem Description\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: ### Perfect Boxes\n\n**Time Limit:** 2 seconds \n**Memory Limit:** 256 MB\n\n#### Probl...
[ { "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 Non‑Adjacent Maximum Sum\n\n**Time Limit:** 2 seconds\n**Memory Limit:** 256...
[ { "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, Dict\n\ndef shortest_path_bfs(graph: Dict[int, List[int]], star...
[ { "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: Johnny is playing a simplified version of a strategy game. In this game, there are `n` 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: ## Enchanted Knight Tour Validation\n\nA mischievous wizard has enchanted an **n × n** 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: **Problem Title:** Minimum Cost to Make a Pangram\n\n**Time Limit:** 2 seconds \n**Memo...
[ { "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: ### Twin Artifact Selection\n\n**Story**\n\nDeep within the forgotten ruins of **Arcanum...
[ { "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 positive integer x is called a 321-like Number when it satisfies the following conditi...
[ { "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 filter_transactions(transactions, threshold):\n \"\"\"\n Filters out all trans...
[ { "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: ### Leaderboard BST\n\n**Time Limit:** 2 seconds\n**Memory Limit:** 256 MB\n\n#### Probl...
[ { "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 Inventory:\n def __init__(self):\n \"\"\" Initialize the inventory syste...
[ { "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: ## Maximal Topic Sets\n\n**Problem Statement**\nOn a knowledge‑sharing platform each use...
[ { "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 network of environmental sensors records the temperature of a ...
[ { "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_rectangle_area(heights: 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: import numpy as np\n\ndef matrix_product_inverse(input_list):\n \"\"\"\n Computes ...
[ { "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 automorphicNumber(n: int) -> str:\n \"\"\"\n Given a number, find if it is Aut...
[ { "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_equal_even_odd_subarray(arr: List[int]) -> int:\n \"\"\"\n Function 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: ## Count Feasible Schedules\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: You are given a binary array nums.\nA subarray of an array is good if it contains exactl...
[ { "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 find_healthy_ingredients(available_ingredients, healthy_ingredients):\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\nYou are tasked with designing an algorithm to process and manip...
[ { "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: ### Squirrel and Nuts with Capacity\n\n**Time Limit:** 2 seconds\n**Memory Limit:** 256 ...
[ { "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: ## Rune Tablet Queries\n\n### Story\nAn intrepid explorer has uncovered a massive stone ...
[ { "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\nCinePulse is a streaming platform that records the rating a user...
[ { "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: Shortest Path in a Weighted Graph\n\nYou are tasked with implementing a fun...
[ { "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 high‑throughput logging system records a chronological stream 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: ## Data Center Zones\n\n**Time Limit:** 2 seconds\n**Memory Limit:** 256 MB\n\n### Probl...
[ { "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: ### Parking Lot Manager\n\n**Time Limit:** 2 seconds\n**Memory Limit:** 256 MB\n\n#### P...
[ { "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: ## Cloud‑Ops Service Dashboard\n\n**Time Limit:** 1 second\n\n**Memory Limit:** 256 MB\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: Write a function that takes in a 2D list representing a grid of letters and a word. 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: def rot13(s: str) -> str:\n \"\"\"\n Applies the ROT13 cipher to a given string.\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 perform_operations(n: int, q: int, array: List[int], operations: List[Tuple[int, int...
[ { "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 maxProfit(prices: List[int]) -> int:\n \"\"\"\n This function takes a list 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: ### Problem Statement\nYou are hired to implement the core data structure of a high‑freq...
[ { "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: ### River Marks\n\nArkady watches a river for **n** consecutive days. On the *i*-th day ...
[ { "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: Sarah loves crossword puzzles and is currently working on her latest creation where she ...
[ { "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 Capital After At Most K Projects\n\n### Description\nA fast‑growing startup i...
[ { "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\nimport threading\n\ndef multi_threaded_keyword_search(filename:...
[ { "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(source: str, target: str) -> int:\n \"\"\"\n Compute the minimu...
[ { "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_subgroups(players: List[str], k: int) -> int:\n \"\"\"\n Calculate the max...
[ { "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 `text` consisting of lowercase English letters and an 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: ### Card Duel Championship\n\nTwo players, **Player 1** and **Player 2**, are competing ...
[ { "role": "system", "content": "You will complete a python code block to implement the desired function. You will only write code blocks." }, { "role": "user", "content": "Write python code to solve the following problem: def Odd_Length_Sum(arr)::\n \"\"\" Write a python function to find 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: ### Problem Statement\n\nYou are building a real‑time ticker for a single stock. The tic...
[ { "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: ### K-th Smallest Achievable Amount\n\n**Problem Statement**\n\nIn a certain market ever...
[ { "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 list of positive integers. Write a Python funct...
[ { "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_number_of_groups(n: int, m: int, friendships: List[Tuple[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: ### Question: Social Network Connection Finder\n\nYou are tasked with developing a funct...
[ { "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 manage_permissions(commands, permissions):\n \"\"\"\n Manages the file permiss...
[ { "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 total_surface_area(edges):\n \"\"\"\n Crystal‑Growth Simulator\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 shiftRight(arr, N, K):\n \"\"\"\n Shift elements of the array to the right by ...
[ { "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 Delivery Window Compression\n\n**Problem Statement**\nA logistics platform 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: ### Dynamic Gradebook\n\n**Time Limit:** 2 seconds\n**Memory Limit:** 256 MB\n\n#### Sta...
[ { "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 merge(nums1: List[int], m: int, nums2: List[int], n: int) -> 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: # Task\nA group of friends decided to play a chain word game. In this game, one player 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 max_importance_path(n, m, k, s, t, importance, edges):\n \"\"\"Find the maximum i...
[ { "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 flatten_dict(d, parent_key='', sep='.'):\n \"\"\" \n Takes a dictionary which ...
[ { "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: \nA 0-indexed array derived with length n is derived by computing the bitwise XOR (...
[ { "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: Consider a scenario where you have a grid of integers and your task is to find the large...
[ { "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 given a single line string **code** that represents a snip...
[ { "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 by **MegaChat**, a massive online platform that must...
[ { "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: ### Find the Corrupted Sensor Reading\n\n**Problem Statement**\nYou are given a square 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 max_gold(n: int, grid: List[List[int]]) -> int:\n \"\"\" Calculate the maximum am...
[ { "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: Peter is trying to analyze the frequency of words in a document to understand which word...
[ { "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 calculate_scores(scores: str) -> list:\n \"\"\" Calculate the total score for eac...
[ { "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 system of pipes. It consists of two rows, each row consists of $n$ pipes...
[ { "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: ### Zero the Production Line\n\n**Problem Statement**\nA factory has a straight producti...
[ { "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: # Rogue's Run (Sliding‑Window DP + Expiring Bonuses)\n\n**Time limit:** 2 seconds\n**Mem...
[ { "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: ## Crystal Radiance – First Day of Dominance\n\n### Story\nDeep beneath the ancient cave...
[ { "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\nThe National Examination Board processes the results of a massiv...
[ { "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: **Floyd-Warshall Algorithm Path Retrieval**\n\n**Objective**:\nImplement the Floyd-Warsh...
[ { "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: ## Drone Survey – Visible Trees\n\n### Problem Statement\nA forest monitoring drone 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: import pandas as pd\nimport matplotlib.pyplot as plt\n\n\ndef task_func(data, column, bi...
[ { "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: ### Re‑indexing Shuffled Transaction Logs\n\nYou are given two integer arrays `A` and `B...
[ { "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: ## K‑th Reading from Two Sensor Streams\n\n### Problem Statement\nTwo high‑frequency sen...