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": "A thermal decomposition reaction is breakdown of a compound into one or more compounds when heated.\n\nFor example, P \\rightarrow a\\cdot Q + b\\cdot R is a decomposition reaction. Here, 1 unit of P is converted into a unit of Q and b unit of R after completion of the reaction... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Chef is known to have friends as well as enemies. Chef has a habit of communicating with friends through encrypted messages. But recently some of his enemies found the way to decrypt and get the original message. You need to write a program that simulates how the enemies decryp... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Professor Ibrahim has prepared the final homework for his algorithm’s class. He asked his students to implement the Posterization Image Filter.\n\nTheir algorithm will be tested on an array of integers, where the $$$i$$$-th integer represents the color of the $$$i$$$-th pixel i... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "# Task\n\n**Your task** is to implement function `printNumber` (`print_number` in C/C++ and Python `Kata.printNumber` in Java) that returns string that represents given number in text format (see examples below).\n\nArguments:\n - `number` — Number that we need to print (`num` ... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Harry is a bright student. To prepare thoroughly for exams, he completes all the exercises in his book! Now that the exams are approaching fast, he is doing book exercises day and night. He writes down and keeps updating the remaining number of exercises on the back cover of ea... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Ramu was a lazy farmer. He had inherited a fairly large farm and a nice house from his father. Ramu leased out the farm land to others and earned a rather handsome income. His father used to keep a buffalo at home and sell its milk but the buffalo died a few days after his fath... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "In this problem you will have to deal with a real algorithm that is used in the VK social network.\n\nAs in any other company that creates high-loaded websites, the VK developers have to deal with request statistics regularly. An important indicator reflecting the load of the s... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "It’s the company's 3^rd anniversary, and everyone is super-excited about it. There is a tradition in the company, that the interns decide the seating arrangement of all the members. The requirements of this order are:\nThe CEO of the company must sit in the middle. (In case of ... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Let $$$n$$$ and $$$d$$$ be positive integers. We build the the divisor tree $$$T_{n,d}$$$ as follows:\n\n- The root of the tree is a node marked with number $$$n$$$. This is the $$$0$$$-th layer of the tree.\n- For each $$$i$$$ from $$$0$$$ to $$$d - 1$$$, for each vertex of th... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Copying large hexadecimal (base 16) strings by hand can be error prone, but that doesn't stop people from doing it. You've discovered a bug in the code that was likely caused by someone making a mistake when copying such a string. You suspect that whoever copied the string did ... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "The grille cipher is a technique that dates back to 1550 when it was first described by Girolamo Cardano. The version we’ll be dealing with comes from the late 1800’s and works as follows. The message to be encoded is written on an $n \\times n$ grid row-wise, top to bottom, a... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "You are given an undirected tree of n vertices. \n\nSome vertices are colored one of the k colors, some are uncolored. It is guaranteed that the tree contains at least one vertex of each of the k colors. There might be no uncolored vertices.\n\nYou choose a subset of exactly k ... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "We have a rooted binary tree with N vertices, where the vertices are numbered 1 to N. Vertex 1 is the root, and the parent of Vertex i (i \\geq 2) is Vertex \\left[ \\frac{i}{2} \\right].\n\nEach vertex has one item in it. The item in Vertex i has a value of V_i and a weight of... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "We have seen the applications of union, intersection, difference and symmetric difference operations, but these operations do not make any changes or mutations to the set. \n\nWe can use the following operations to create mutations to a set:\n\n.update() or |= \n\nUpdate the s... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "During the COVID-19 quarantine, Theta discovered Minecraft Dungeons which is an offshoot of the popular Minecraft game. In Minecraft Dungeons, players crawl through a dungeon, trying to accomplish a mission without getting killed by various mobs. At the end, a boss battle with ... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "When you were a child you must have been told a puzzle of bags and coins. Anyway, here's one of its versions: \n\nA horse has three bags. The first bag has one coin, the second bag has one coin and the third bag has three coins. In total, the horse has three coins in the bags. ... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "ZS the Coder and Chris the Baboon arrived at the entrance of Udayland. There is a n × n magic grid on the entrance which is filled with integers. Chris noticed that exactly one of the cells in the grid is empty, and to enter Udayland, they need to fill a positive integer into t... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "DZY loves strings, and he enjoys collecting them.\n\nIn China, many people like to use strings containing their names' initials, for example: xyz, jcvb, dzy, dyh.\n\nOnce DZY found a lucky string s. A lot of pairs of good friends came to DZY when they heard about the news. The ... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "You are given a bipartite graph: the first part of this graph contains n_1 vertices, the second part contains n_2 vertices, and there are m edges. The graph can contain multiple edges.\n\nInitially, each edge is colorless. For each edge, you may either leave it uncolored (it is... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Earlier, when there was no Internet, each bank had a lot of offices all around Bankopolis, and it caused a lot of problems. Namely, each day the bank had to collect cash from all the offices.\n\nOnce Oleg the bank client heard a dialogue of two cash collectors. Each day they tr... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Alice and Bob play a game on an array of N integers. They alternate moves, with Alice making the first move.\n\nThe rules are as follows:\n1. On their first move, a player can pick any element in the array, add its value to their score, and then remove it from the array.\n2. On... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "We all know that a superhero can transform to certain other superheroes. But not all Superheroes can transform to any other superhero. A superhero with name $s$ can transform to another superhero with name $t$ if $s$ can be made equal to $t$ by changing any vowel in $s$ to any ... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "We have five variables x_1, x_2, x_3, x_4, and x_5.\nThe variable x_i was initially assigned a value of i.\nSnuke chose one of these variables and assigned it 0.\nYou are given the values of the five variables after this assignment.\nFind out which variable Snuke assigned 0.\n\... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Joisino the magical girl has decided to turn every single digit that exists on this world into 1.\nRewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points).\nShe is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Patrick's personal stuff and found a sequence a_1, a_2, ..., a_{m} of length m, consisting of integers from 1 to n, not necessarily distinct. Then he pick... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Please write a function that sums a list, but ignores any duplicate items in the list.\n\nFor instance, for the list [3, 4, 3, 6] , the function should return 10.\n",
"tool_calls": null
},
{
"role": "assistant",
"content": "```python\ndef sum_unique(lst):\n \... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "We have a 3×3 square grid, where each square contains a lowercase English letters.\nThe letter in the square at the i-th row from the top and j-th column from the left is c_{ij}.\nPrint the string of length 3 that can be obtained by concatenating the letters in the squares on t... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Let’s face it... you are not that handy. When you need to make a major home repair, you often need to hire someone to help. When they come for the first visit, they make an estimate of the cost. Here they must be careful: if they overestimate the cost, it might scare you off, b... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Write a function `reverse` which reverses a list (or in clojure's case, any list-like data structure)\n\n(the dedicated builtin(s) functionalities are deactivated)\n",
"tool_calls": null
},
{
"role": "assistant",
"content": "```python\ndef reverse(lst):\n \"\... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Check if given numbers are prime numbers. \nIf number N is prime ```return \"Probable Prime\"``` else ``` return \"Composite\"```. \nHINT: Upper bount is really big so you should use an efficient algorithm.\n\nInput\n 1 < N ≤ 10^(100)\n\nExample\n prime_or_composite(2) # sho... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Oh no! Joanna just spilled some syrup on her keyboard and now some of the keys are sticky. This causes her considerable frustration, as every time she presses one of the sticky keys, the corresponding character gets entered twice on her computer. \n\nThis could not have happene... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "There are Infinite People Standing in a row, indexed from 1.\nA person having index 'i' has strength of (i*i).\nYou have Strength 'P'. You need to tell what is the maximum number of People You can Kill With your Strength P.\nYou can only Kill a person with strength 'X' if P >= ... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Every summer Vitya comes to visit his grandmother in the countryside. This summer, he got a huge wart. Every grandma knows that one should treat warts when the moon goes down. Thus, Vitya has to catch the moment when the moon is down.\n\nMoon cycle lasts 30 days. The size of th... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "You just got done with your set at the gym, and you are wondering how much weight you could lift if you did a single repetition. Thankfully, a few scholars have devised formulas for this purpose (from [Wikipedia](https://en.wikipedia.org/wiki/One-repetition_maximum)) :\n\n\n###... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Read problems statements in Mandarin chinese, Russian and Vietnamese as well. \n\nChef Tobby asked Bhuvan to brush up his knowledge of statistics for a test. While studying some distributions, Bhuvan learns the fact that for symmetric distributions, the mean and the median are ... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "In a game of darts a player throws darts at a board consisting of 20 different sections labelled $1$ to $20$. When the dart hits section $i$ the player scores $i$ points. Each section also contains a double area and a triple area. When the dart hits the double area of section $... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Do you have in mind the good old TicTacToe?\n\nAssuming that you get all the data in one array, you put a space around each value, `|` as a columns separator and multiple `-` as rows separator, with something like `[\"O\", \"X\", \" \", \" \", \"X\", \" \", \"X\", \"O\", \" \"]... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "You are given two arrays $$$a$$$ and $$$b$$$ of positive integers, with length $$$n$$$ and $$$m$$$ respectively.\n\nLet $$$c$$$ be an $$$n \\times m$$$ matrix, where $$$c_{i,j} = a_i \\cdot b_j$$$.\n\nYou need to find a subrectangle of the matrix $$$c$$$ such that the sum of it... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "The 26 letters of the English alphabets are randomly divided into 5 groups of 5 letters with the remaining letter being ignored. Each of the group is assigned a score of more than 0. The ignored letter always has a score of 0.\n\nWith this kata, write a function ```nameScore(... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Atish is very talkative. He just doesn't stop speaking. Unfortunately for those around him, he's also a maths wiz, and befuddles anyone who dares speak to him. Annoyed with this, Souradeep asked him to shut up, to which Atish replied, \nTake a number, x, find its factorial, re... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Takahashi is meeting up with Aoki.\nThey have planned to meet at a place that is D meters away from Takahashi's house in T minutes from now.\nTakahashi will leave his house now and go straight to the place at a speed of S meters per minute.\nWill he arrive in time?\n\n-----Cons... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "I have n tickets for a train with a rabbit. Each ticket is numbered from 0 to n − 1, and you can use the k ticket to go to p⋅ak + q⋅bk station.\n\nRabbit wants to go to the all-you-can-eat carrot shop at the station m station ahead of the current station, but wants to walk as s... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Write a function that rearranges an integer into its largest possible value. \n\n```python\nsuper_size(123456) # 654321\nsuper_size(105) # 510\nsuper_size(12) # 21\n```\n``` haskell\nsuperSize 123456 `shouldBe` 654321\nsuperSize 105 `shouldBe` 510\nsuperSize 12... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "You all might have heard about hamming distance in Information Theory.\n\nThe Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. It measures the minimum number of errors that could have transformed o... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "There are $n$ slimes in a row. Each slime has an integer value (possibly negative or zero) associated with it.\n\nAny slime can eat its adjacent slime (the closest slime to its left or to its right, assuming that this slime exists). \n\nWhen a slime with a value $x$ eats a slim... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Forrest lives in a prehistoric era of “dial-up Internet.” Unlike the fast streaming of today’s broadband era, dial-up connections are only capable of transmitting small amounts of text data at reasonable speeds. Forrest has noticed that his communications typically include repe... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "An array in a certain programming language is defined in the following way:\n - The beginning and the end of an array is denoted by an open and closed curly bracket, respectively.\n - Inside the curly braces, there are (possibly even 0) values separated by a comma (there is no ... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Kolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle.\n\nMore formally, there are 3n gnomes sitting in a circle. Each gnome can have from 1 to 3 coins. Let's number ... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "You are given string s consists of opening and closing brackets of four kinds <>, {}, [], (). There are two types of brackets: opening and closing. You can replace any bracket by another of the same type. For example, you can replace < by the bracket {, but you can't replace it... | null |
Coding | competitive-programming-python | cp_python_stdin | [
{
"role": "user",
"content": "Write a program which calculates the area and circumference of a circle for given radius r.\n\nConstraints\n\n* 0 < r < 10000\n\nInput\n\nA real number r is given.\n\nOutput\n\nPrint the area and circumference of the circle in a line. Put a single space between them. The output... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "You are given an integer N followed by N strings (containing only lowercase English letters). Write a program that prints the longest common prefix shared by all the strings.\n\nInput format\n• The first line contains a single integer N (1 ≤ N ≤ 1000).\n• The second line contai... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "You are given a string S of length N consisting of A, B and C, and an integer K which is between 1 and N (inclusive).\nPrint the string S after lowercasing the K-th character in it.\n\n-----Constraints-----\n - 1 ≤ N ≤ 50\n - 1 ≤ K ≤ N\n - S is a string of length N consisting o... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Mr. Knight is a chief architect of the project to build a new art museum. One day, he was struggling to determine the design of the building. He believed that a brilliant art museum must have an artistic building, so he started to search for a good motif of his building. The ar... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "You are given two integers A and B as the input. Output the value of A + B.\nHowever, if A + B is 10 or greater, output error instead.\n\n-----Constraints-----\n - A and B are integers.\n - 1 ≤ A, B ≤ 9\n\n-----Input-----\nInput is given from Standard Input in the following for... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Given a temperature in celsius C. You have to convert it in Fahrenheit.\n \nExample 1:\nInput:\nC = 32\nOutput:\n89.60\nExplanation:\nFor 32 degree C temperature \nin farenheit = 89.60\nExample 2:\nInput:\nC = 25\nOutput:\n77.00\nExplanation:\nFor 25 degree C temperature \nin f... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "Write a Python program that reads a list of dictionaries representing people from standard input, where each dictionary contains the keys 'name', 'age', and 'city'. The program should generate and print an HTML page that contains a table displaying this data, sorted by age in d... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "A bracket sequence is a string, containing only characters \"(\", \")\", \"[\" and \"]\".\n\nA correct bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters \"1\" and \"+\" between the original characters of ... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Given a Binary Heap of size N in an array arr[]. Write a program to calculate the height of the Heap.\nExample 1:\nInput: N = 6\narr = {1, 3, 6, 5, 9, 8}\nOutput: 2\nExplaination: The tree is like the following\n (1)\n / \\\n (3) (6)\n / \\ /\n (... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "In order to pass time during your vacation, you decided to go on a hike to visit a scenic lake up in the mountains. Hiking to the lake will take you a full day, then you will stay there for a day to rest and enjoy the scenery, and then spend another day hiking home, for a total... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Ranjit wants to design a algorithm such that, if he enters two numbers, all the numbers between these two numbers are listed(except the number divisible by 5 & 3).\n\nBUT the number divisible by both 3 & 5 is also listed (example 30)\nThe Numbers should be separated by a \",\" ... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Given two Singly Linked List of N and M nodes respectively. The task is to check whether two linked lists are identical or not. \nTwo Linked Lists are identical when they have same data and with same arrangement too.\nExample 1:\nInput:\nLinkedList1: 1->2->3->4->5->6\nLinkedLis... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "A newspaper is published in Walrusland. Its heading is s1, it consists of lowercase Latin letters. Fangy the little walrus wants to buy several such newspapers, cut out their headings, glue them one to another in order to get one big string. After that walrus erase several lett... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Praveen went crazy yesterday and created an arbitrary matrix consisting of 0, 1 or 2. There was no rule observed in forming this matrix. But then he made up some rules himself.\n\nIf there are adjacent 1's, they are said to be connected. Similarly, if there are adjacent 2's, th... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "While purchasing certain items, a discount of 10% is offered if the quantity purchased is more than 1000. \nIf the quantity and price per item are input, write a program to calculate the total expenses.\n\n------ Input Format ------ \n\nThe first line contains an integer T, tot... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Given an array arr[] of n integers containing only 0 and 1. Write a program to find the minimum toggles (switch from 0 to 1 or vice-versa) required such the array the array become partitioned, i.e., it has first 0s then 1s. There should be at least one 0 in the beginning, and t... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Mr. Retardo has lost his marbles. He's a professor, and absolutely loathes his students. And since going full retard, he asks them all sorts of useless questions. His latest obsession is prime numbers, and he gives all his a students random number n and asks them to check if it... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "There are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in whi... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Smaug, the dragon, rules under The Mountain, Erabor which was originally the ruling place of Dwarf King. King Thorin, who is the rightful heir to the throne is on his way to take back his kingdom from Smaug. With the help of a map, King Thorin is able to find a secret entry int... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Given a Binary Tree, find vertical sum of the nodes that are in same vertical line. Print all sums through different vertical lines starting from left-most vertical line to right-most vertical line.\nExample 1:\nInput:\n 1\n / \\\n 2 3\n / \\ / \\\n4 5 6 ... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "An array is a type of data structure that stores elements of the same type in a contiguous block of memory. In an array, $A$, of size $N$, each memory location has some unique index, $i$ (where $0\\leq i<N$), that can be referenced as $A[i]$ or $A_i$.\n\nReverse an array of int... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Tim is an absolutely obsessive soda drinker, he simply cannot get enough. Most annoyingly though, he almost never has any money, so his only obvious legal way to obtain more soda is to take the money he gets when he recycles empty soda bottles to buy new ones. In addition to th... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "People in Cubeland use cubic coins. Not only the unit of currency is called a cube but also the coins are shaped like cubes and their values are cubes. Coins with values of all cubic numbers up to 9261 (= 213), i.e., coins with the denominations of 1, 8, 27, ..., up to 9261 cub... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "You are given the head of a Linked List. You have to move the last element to the front of the Linked List and return the list.\n \nExample 1:\nInput:\nN = 5\nList = {2,5,6,2,1}\nOutput:\n{1,2,5,6,2}\nExplanation:\nIn the given linked list, the last element is 1,\nafter moving ... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "A ball will bounce along a number line, making N + 1 bounces. It will make the first bounce at coordinate D_1 = 0, and the i-th bounce (2 \\leq i \\leq N+1) at coordinate D_i = D_{i-1} + L_{i-1}.\nHow many times will the ball make a bounce where the coordinate is at most X?\n\n... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "problem\n\nCreate a program that counts the number of consecutive JOI or IOI characters in a given character string. The character string consists only of uppercase letters of the alphabet. For example, the character string \"JOIOIOI\" in the figure below contains JOI in one pl... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot to do the homework. Specifically, he forgot to complete his physics tasks. N... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Check Tutorial tab to know how to to solve. \n\nYou are given a string $N$. \n\nYour task is to verify that $N$ is a floating point number. \n\nIn this task, a valid float number must satisfy all of the following requirements: \n\n$>$ Number can start with +, - or . symbol. ... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white.\n\nThe grid is said to be good if and only if the following condition is satisfied:\n\n* Fro... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Read problems statements in Mandarin Chinese and Russian. \n\nIn a far away dystopian world, the measure of the quality of a person’s life is the numbers of likes he gets for an article about their life. For a person to stay alive, he has to acquire at least L number of likes ... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Write a command line tool which takes a file path as input and prints the number of lines, number of words, number of characters in the file, userid of the owner of the file, groupid of owner of the file and last modification time of the file in UNIX timestamp format. Please no... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Consider a rectangle ABCD. Given the co-ordinates of the mid points of side AD and BC (p and q respectively) along with their length L (AD = BC = L). Find the co-ordinates of the 4 points A, B, C and D.\nExample 1:\nInput: L = 2, points = {{1,0},{1,2}}\nOutput: {{0,0},{0,2},{2,... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Alice gave Bob two integers $a$ and $b$ ($a > 0$ and $b \\ge 0$). Being a curious boy, Bob wrote down an array of non-negative integers with $\\operatorname{MEX}$ value of all elements equal to $a$ and $\\operatorname{XOR}$ value of all elements equal to $b$.\n\nWhat is the sho... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Given an integer $$$r$$$, find the number of lattice points that have a Euclidean distance from $$$(0, 0)$$$ greater than or equal to $$$r$$$ but strictly less than $$$r+1$$$.\n\nA lattice point is a point with integer coordinates. The Euclidean distance from $$$(0, 0)$$$ to th... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "You are given two integer arrays a_0, a_1, ..., a_{N - 1} and b_0, b_1, ..., b_{M - 1}. Calculate the array c_0, c_1, ..., c_{(N - 1) + (M - 1)}, defined by c_i = \\sum_{j = 0}^i a_j b_{i - j} \\bmod 998244353.\n\nConstraints\n\n* 1 \\leq N, M \\leq 524288\n* 0 \\leq a_i, b_i <... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "The absolute difference is the positive difference between two values $\\boldsymbol{a}$ and $\\boldsymbol{b}$, is written $\\left|a-b\\right|$ or $|b-a|$ and they are equal. If $\\boldsymbol{a}=3$ and $b=2$, $|3-2|=|2-3|=1$. Given an array of integers, find the minimum absolut... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Find the smallest number that can be framed using the series created by the digits obtained by raising the given number ( \"a\" ) to the power from 1 to n i.e. a^1 , a^2 , a^3 .......a^n . We get b1,b2 , b3 , ........... bn . \nUsing all the digits ( including repeating... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Sum and Color\nChef is a mathematics student. His professor has given him a difficult task. Professor initially provides Chef with a list of numbers. For every number in the list, Chef has to calculate the sum 'S' of digits such that 0<=S<=9. Even if the sum of digits is coming... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Write a program which reads two sequences of nodes obtained by the preorder tree walk and the inorder tree walk on a binary tree respectively, and prints a sequence of the nodes obtained by the postorder tree walk on the binary tree.\n\nConstraints\n\n* $1 \\leq n \\leq 40$\n\n... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Taro is going to play a card game. However, now he has only n cards, even though there should be 52 cards (he has no Jokers).\n\nThe 52 cards include 13 ranks of each of the four suits: spade, heart, club and diamond.\n\nNote\n\n解説\n\n\n\nInput\n\nIn the first line, the number ... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "As the students are back in hostel after a long time, the gamers have decided to have a LAN gaming competition to find out who has utilized his time in gaming during vacations. They play \"Counter ATOD\". However, the scoring of this game is weird. There are N players and there... | null |
Coding | Dolci-Python-Algorithms | engineering_oop_api | [
{
"role": "user",
"content": "Write a program that reads a string from standard input and prints the number of vowels and consonants in the string.\n\nInput:\nA single line containing a string. The string may contain spaces and any characters.\n\nOutput:\nFirst, print 'Number of vowels: X' where X is the nu... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "There are N dishes of cuisine placed in front of Takahashi and Aoki. For convenience, we call these dishes Dish 1, Dish 2, ..., Dish N.\n\nWhen Takahashi eats Dish i, he earns A_i points of happiness; when Aoki eats Dish i, she earns B_i points of happiness.\n\nStarting from Ta... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Last summer Peter was at his granny's in the country, when a wolf attacked sheep in the nearby forest. Now he fears to walk through the forest, to walk round the forest, even to get out of the house. He explains this not by the fear of the wolf, but by a strange, in his opinion... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "=====Problem Statement=====\nFor this challenge, you are given two complex numbers, and you have to print the result of their addition, subtraction, multiplication, division and modulus operations. The real and imaginary precision part should be correct up to two decimal places... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Nikit has to give a short contest of duration \"n\" minutes. The contest is divided into 2 sections-Easy and Hard. x and y marks will be awarded per problem for Easy and Hard respectively. Assume that he will take p minutes to solve an Easy problem and q minutes to solve a Hard... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev decided to build a house of cards. For that they've already found a hefty deck of n playing cards. Let's describe the house they want to make:\n\n1. The house consists of so... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "An avid hiker keeps meticulous records of their hikes. During the last hike that took exactly $\\textit{steps}$ steps, for every step it was noted if it was an uphill, $\\mbox{U}$, or a downhill, $\\mbox{D}$ step. Hikes always start and end at sea level, and each step up or dow... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "A student is assigned a problem, to get a alphanumeric string from the user and to calculate the sum of digits in the given string.after this he has to delete the digits(0-9) from the string and to display the each word of the string in dictionary order followed by the sum of d... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "You are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n - Query i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both... | null |
Coding | competitive-programming-cpp | cp_cpp_stdin | [
{
"role": "user",
"content": "These days a lot of new coders are emerging at RJIT. One of the many programmers in RJIT thought of making a program to find the weekday for any given date. He successfully builds it but there is one problem, his program prints the day of yesterday's date. Now he wonders wheth... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.