Datasets:
Tasks:
Text Generation
Modalities:
Text
Formats:
json
Languages:
English
Size:
10K - 100K
Tags:
code
License:
text stringlengths 424 69.5k |
|---|
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Takahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. He defines the beauty of the tower as follows:
... |
### Prompt
In Cpp, your task is to solve the following problem:
It's one more school day now. Sasha doesn't like classes and is always bored at them. So, each day he invents some game and plays in it alone or with friends.
Today he invented one simple game to play with Lena, with whom he shares a desk. The rules are... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Adilbek's house is located on a street which can be represented as the OX axis. This street is really dark, so Adilbek wants to install some post lamps to illuminate it. Street has n positions to install lamps, they correspond to the integ... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Given a string s, find the number of ways to split s to substrings such that if there are k substrings (p1, p2, p3, ..., pk) in partition, then pi = pk - i + 1 for all i (1 ≤ i ≤ k) and k is even.
Since the number of ways can be large, print ... |
### Prompt
Please formulate a Cpp solution to the following problem:
There are two standard ways to represent a graph $G = (V, E)$, where $V$ is a set of vertices and $E$ is a set of edges; Adjacency list representation and Adjacency matrix representation.
An adjacency-list representation consists of an array $Adj[|... |
### Prompt
Please formulate a cpp solution to the following problem:
You are given a rooted tree. Let's denote d(x) as depth of node x: depth of the root is 1, depth of any other node x is d(y) + 1, where y is a parent of x.
The tree has the following property: every node x with d(x) = i has exactly ai children. Max... |
### Prompt
Please create a solution in cpp to the following problem:
Please notice the unusual memory limit of this problem.
Orac likes games. Recently he came up with the new game, "Game of Life".
You should play this game on a black and white grid with n rows and m columns. Each cell is either black or white.
Fo... |
### Prompt
Please formulate a CPP solution to the following problem:
The cloth coasters produced and sold by Aizu Takada City are known for their symmetrical design and great beauty. As part of quality control, Aizu Takada City has installed cameras on the production line to automatically verify that the images obtai... |
### Prompt
Create a solution in Cpp for the following problem:
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≤ li ≤ ri ≤ n) meaning that value <image> should be equal to qi.
Your tas... |
### Prompt
In cpp, your task is to solve the following problem:
There was no problem about a cactus at the NERC 2020 online round. That's a bad mistake, so judges decided to fix it. You shall not pass to the World Finals 2021 without solving a problem about a cactus!
A cactus is a connected undirected graph in which... |
### Prompt
Please create a solution in cpp to the following problem:
DZY loves planting, and he enjoys solving tree problems.
DZY has a weighted tree (connected undirected graph without cycles) containing n nodes (they are numbered from 1 to n). He defines the function g(x, y) (1 ≤ x, y ≤ n) as the longest edge in t... |
### Prompt
Please create a solution in Cpp to the following problem:
Thank you for helping Heidi! It is now the second of April, but she has been summoned by Jenny again. The pranks do not seem to end...
In the meantime, Heidi has decided that she does not trust her friends anymore. Not too much, anyway. Her relativ... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Write a program which reads two integers a, b and an operator op, and then prints the value of a op b.
The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part.
Cons... |
### Prompt
Develop a solution in CPP to the problem described below:
<image>
It is well-known that the best decoration for a flower bed in Sweetland are vanilla muffins. Seedlings of this plant need sun to grow up. Slastyona has m seedlings, and the j-th seedling needs at least kj minutes of sunlight to grow up.
Mo... |
### Prompt
Please create a solution in CPP to the following problem:
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separate... |
### Prompt
Please formulate a CPP solution to the following problem:
Now that Kuroni has reached 10 years old, he is a big boy and doesn't like arrays of integers as presents anymore. This year he wants a Bracket sequence as a Birthday present. More specifically, he wants a bracket sequence so complex that no matter ... |
### Prompt
Please create a solution in CPP to the following problem:
Bizon the Champion isn't just charming, he also is very smart.
While some of us were learning the multiplication table, Bizon the Champion had fun in his own manner. Bizon the Champion painted an n × m multiplication table, where the element on the... |
### Prompt
Develop a solution in cpp to the problem described below:
New Year is getting near. So it's time to change handles on codeforces. Mishka wants to change his handle but in such a way that people would not forget who he is.
To make it work, he only allowed to change letters case. More formally, during one h... |
### Prompt
Develop a solution in cpp to the problem described below:
Konrad is a Human Relations consultant working for VoltModder, a large electrical equipment producer. Today, he has been tasked with evaluating the level of happiness in the company.
There are n people working for VoltModder, numbered from 1 to n. ... |
### Prompt
Your task is to create a cpp solution to the following problem:
You are given an array of n integer numbers. Let sum(l, r) be the sum of all numbers on positions from l to r non-inclusive (l-th element is counted, r-th element is not counted). For indices l and r holds 0 ≤ l ≤ r ≤ n. Indices in array are n... |
### Prompt
Please formulate a CPP solution to the following problem:
There are n children in Jzzhu's school. Jzzhu is going to give some candies to them. Let's number all the children from 1 to n. The i-th child wants to get at least ai candies.
Jzzhu asks children to line up. Initially, the i-th child stands at the... |
### Prompt
Create a solution in Cpp for the following problem:
Pikachu had an array with him. He wrote down all the non-empty subsequences of the array on paper. Note that an array of size n has 2n - 1 non-empty subsequences in it.
Pikachu being mischievous as he always is, removed all the subsequences in which Max... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
You've got an undirected graph, consisting of n vertices and m edges. We will consider the graph's vertices numbered with integers from 1 to n. Each vertex of the graph has a color. The color of the i-th vertex is an integer ci.
Let's con... |
### Prompt
Develop a solution in Cpp to the problem described below:
Bessie the cow and her best friend Elsie each received a sliding puzzle on Pi Day. Their puzzles consist of a 2 × 2 grid and three tiles labeled 'A', 'B', and 'C'. The three tiles sit on top of the grid, leaving one grid cell empty. To make a move, ... |
### Prompt
Construct a cpp code solution to the problem outlined:
<image>
Arrange integers (0 or more and 99 or less) in a rhombus as illustrated in Fig. 1. Create a program that reads the data representing the rhombus and outputs the maximum value of the sum of the integers that pass when starting from the top and... |
### Prompt
In cpp, your task is to solve the following problem:
I see a pink boar and I want it painted black. Black boars look much more awesome and mighty than the pink ones. Since Jaggy became the ruler of the forest, he has been trying his best to improve the diplomatic relations between the forest region and the... |
### Prompt
Create a solution in Cpp for the following problem:
On a random day, Neko found n treasure chests and m keys. The i-th chest has an integer a_i written on it and the j-th key has an integer b_j on it. Neko knows those chests contain the powerful mysterious green Grapes, thus Neko wants to open as many trea... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it [here](http://tiny.cc/636xmz).
The picture showing the correct sudoku solution:
<image>
Blocks are bordered with bold bla... |
### Prompt
Please create a solution in Cpp to the following problem:
Happy PMP is freshman and he is learning about algorithmic problems. He enjoys playing algorithmic games a lot.
One of the seniors gave Happy PMP a nice game. He is given two permutations of numbers 1 through n and is asked to convert the first one... |
### Prompt
Please provide a CPP coded solution to the problem described below:
Alice received a set of Toy Train™ from Bob. It consists of one train and a connected railway network of n stations, enumerated from 1 through n. The train occupies one station at a time and travels around the network of stations in a circ... |
### Prompt
In Cpp, your task is to solve the following problem:
Long time ago Alex created an interesting problem about parallelogram. The input data for this problem contained four integer points on the Cartesian plane, that defined the set of vertices of some non-degenerate (positive area) parallelogram. Points not... |
### Prompt
Develop a solution in Cpp to the problem described below:
One day Vasya went out for a walk in the yard but there weren't any of his friends outside and he had no one to play touch and run. But the boy didn't lose the high spirits and decided to play touch and run with himself. You may ask: "How did he do ... |
### Prompt
Create a solution in cpp for the following problem:
Hands that shed innocent blood!
There are n guilty people in a line, the i-th of them holds a claw with length Li. The bell rings and every person kills some of people in front of him. All people kill others at the same time. Namely, the i-th person kill... |
### Prompt
Develop a solution in cpp to the problem described below:
You are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x have been successful. Thus, your current success rate on Codeforces is equal to x / y.
Your favorite rat... |
### Prompt
Construct a cpp code solution to the problem outlined:
You are planning to build housing on a street. There are n spots available on the street on which you can build a house. The spots are labeled from 1 to n from left to right. In each spot, you can build a house with an integer height between 0 and h.
... |
### Prompt
Construct a CPP code solution to the problem outlined:
Emuskald considers himself a master of flow algorithms. Now he has completed his most ingenious program yet — it calculates the maximum flow in an undirected graph. The graph consists of n vertices and m edges. Vertices are numbered from 1 to n. Vertic... |
### Prompt
Construct a cpp code solution to the problem outlined:
Polycarp is playing a new computer game. This game has n stones in a row. The stone on the position i has integer power a_i. The powers of all stones are distinct.
Each turn Polycarp can destroy either stone on the first position or stone on the last ... |
### Prompt
Your task is to create a Cpp solution to the following problem:
You have probably registered on Internet sites many times. And each time you should enter your invented password. Usually the registration form automatically checks the password's crypt resistance. If the user's password isn't complex enough, ... |
### Prompt
Create a solution in cpp for the following problem:
There is a connected undirected graph with N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Also, each of these vertices and edges has a specified weight. Vertex i has a weight of X_i; Edge i has a weight of Y_i... |
### Prompt
Your task is to create a Cpp solution to the following problem:
There is an empty array. The following N operations will be performed to insert integers into the array. In the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array. Find the K-th smallest integer in the array after... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
There is a square field of size n × n in which two cells are marked. These cells can be in the same row or column.
You are to mark two more cells so that they are the corners of a rectangle with sides parallel to the coordinate axes.
For... |
### Prompt
Please provide a cpp coded solution to the problem described below:
problem
Once upon a time there were settlements and many people lived there. People built buildings of various shapes and sizes. But those buildings have already been lost, only the literature and the pillars found in the ruins. Was a clu... |
### Prompt
Develop a solution in cpp to the problem described below:
Let's consider a table consisting of n rows and n columns. The cell located at the intersection of i-th row and j-th column contains number i × j. The rows and columns are numbered starting from 1.
You are given a positive integer x. Your task is t... |
### Prompt
Please formulate a CPP solution to the following problem:
Manao is trying to open a rather challenging lock. The lock has n buttons on it and to open it, you should press the buttons in a certain order to open the lock. When you push some button, it either stays pressed into the lock (that means that you'v... |
### Prompt
Develop a solution in Cpp to the problem described below:
You are given $n$ packages of $w_i$ kg from a belt conveyor in order ($i = 0, 1, ... n-1$). You should load all packages onto $k$ trucks which have the common maximum load $P$. Each truck can load consecutive packages (more than or equals to zero) f... |
### Prompt
Please create a solution in Cpp to the following problem:
You are given a connected undirected simple graph, which has N vertices and M edges. The vertices are numbered 1 through N, and the edges are numbered 1 through M. Edge i connects vertices A_i and B_i. Your task is to find a path that satisfies the ... |
### Prompt
Create a solution in CPP for the following problem:
Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Lucky number is super lucky if it's d... |
### Prompt
Create a solution in CPP for the following problem:
One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the... |
### Prompt
Please provide a cpp coded solution to the problem described below:
You are given an integer array a_1, a_2, …, a_n.
The array b is called to be a subsequence of a if it is possible to remove some elements from a to get b.
Array b_1, b_2, …, b_k is called to be good if it is not empty and for every i (1 ... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Yet another round on DecoForces is coming! Grandpa Maks wanted to participate in it but someone has stolen his precious sofa! And how can one perform well with such a major loss?
Fortunately, the thief had left a note for Grandpa Maks. Th... |
### Prompt
Please provide a cpp coded solution to the problem described below:
If the girl doesn't go to Denis, then Denis will go to the girl. Using this rule, the young man left home, bought flowers and went to Nastya.
On the way from Denis's house to the girl's house is a road of n lines. This road can't be alwa... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Bob has a rectangular chocolate bar of the size W × H. He introduced a cartesian coordinate system so that the point (0, 0) corresponds to the lower-left corner of the bar, and the point (W, H) corresponds to the upper-right corner. Bob de... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Special Agent Smart Beaver works in a secret research department of ABBYY. He's been working there for a long time and is satisfied with his job, as it allows him to eat out in the best restaurants and order the most expensive and exotic wood ... |
### Prompt
Generate a cpp solution to the following problem:
There is a rectangular grid of size n × m. Each cell of the grid is colored black ('0') or white ('1'). The color of the cell (i, j) is c_{i, j}. You are also given a map of directions: for each cell, there is a direction s_{i, j} which is one of the four c... |
### Prompt
Create a solution in Cpp for the following problem:
You have N items that you want to put them into a knapsack. Item i has value vi, weight wi and limitation mi.
You want to find a subset of items to put such that:
* The total value of the items is as large as possible.
* The items have combined weight a... |
### Prompt
Develop a solution in cpp to the problem described below:
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates.
You can build a road between two towns at coordinates (a,b) and (c,d) for a cost of min(|a-c|,|b-d|) yen (... |
### Prompt
Generate a CPP solution to the following problem:
This problem consists of two subproblems: for solving subproblem D1 you will receive 3 points, and for solving subproblem D2 you will receive 16 points.
Manao is the chief architect involved in planning a new supercollider. He has to identify a plot of lan... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another snow drift. He has noticed that in this way it's impossible... |
### Prompt
Please create a solution in cpp to the following problem:
Bankopolis is an incredible city in which all the n crossroads are located on a straight line and numbered from 1 to n along it. On each crossroad there is a bank office.
The crossroads are connected with m oriented bicycle lanes (the i-th lane goe... |
End of preview. Expand in Data Studio
10k random lines of the "text" column of the https://huggingface.co/datasets/wttw/code_contest_instruct_cpp dataset
- Downloads last month
- 26