text stringlengths 424 69.5k |
|---|
### Prompt
Your challenge is to write a cpp solution to the following problem:
You are given three integers A, B and C.
Determine if there exists an equilateral triangle whose sides have lengths A, B and C.
Constraints
* All values in input are integers.
* 1 \leq A,B,C \leq 100
Input
Input is given from Standard... |
### Prompt
Construct a Cpp code solution to the problem outlined:
You are given a picture consisting of n rows and m columns. Rows are numbered from 1 to n from the top to the bottom, columns are numbered from 1 to m from the left to the right. Each cell is painted either black or white.
You think that this picture... |
### Prompt
Generate a Cpp solution to the following problem:
Igor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is ai, and after a week of discounts its price will be bi.
Not all of sellers are honest, so now so... |
### Prompt
Your task is to create a Cpp solution to the following problem:
We have a directed weighted graph with N vertices. Each vertex has two integers written on it, and the integers written on Vertex i are A_i and B_i.
In this graph, there is an edge from Vertex x to Vertex y for all pairs 1 \leq x,y \leq N, an... |
### Prompt
In CPP, your task is to solve the following problem:
Lunar New Year is approaching, and Bob is planning to go for a famous restaurant — "Alice's".
The restaurant "Alice's" serves n kinds of food. The cost for the i-th kind is always c_i. Initially, the restaurant has enough ingredients for serving exactly... |
### Prompt
Your task is to create a CPP solution to the following problem:
There are n players sitting at the card table. Each player has a favorite number. The favorite number of the j-th player is f_j.
There are k ⋅ n cards on the table. Each card contains a single integer: the i-th card contains number c_i. Also,... |
### Prompt
Develop a solution in cpp to the problem described below:
Malek has recently found a treasure map. While he was looking for a treasure he found a locked door. There was a string s written on the door consisting of characters '(', ')' and '#'. Below there was a manual on how to open the door. After spending... |
### Prompt
Your task is to create a cpp solution to the following problem:
Professor Matsuzaki is a scientist studying the truth of the universe. Life, the universe, all the answers are said to be 42, but Professor Matsuzaki thinks that this alone is not enough to elucidate the truth of the universe. Professor Matsuz... |
### Prompt
Develop a solution in CPP to the problem described below:
Let's define a balanced multiset the following way. Write down the sum of all elements of the multiset in its decimal representation. For each position of that number check if the multiset includes at least one element such that the digit of the ele... |
### Prompt
Generate a CPP solution to the following problem:
Tattah's youngest brother, Tuftuf, is new to programming.
Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava.
Today... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
There are many caves deep in mountains found in the countryside. In legend, each cave has a treasure hidden within the farthest room from the cave's entrance. The Shogun has ordered his Samurais to explore these caves with Karakuri dolls (... |
### Prompt
Please create a solution in Cpp to the following problem:
Filled with optimism, Hyunuk will host a conference about how great this new year will be!
The conference will have n lectures. Hyunuk has two candidate venues a and b. For each of the n lectures, the speaker specified two time intervals [sa_i, ea_... |
### Prompt
Create a solution in CPP for the following problem:
You are given n arrays a_1, a_2, ..., a_n; each array consists of exactly m integers. We denote the y-th element of the x-th array as a_{x, y}.
You have to choose two arrays a_i and a_j (1 ≤ i, j ≤ n, it is possible that i = j). After that, you will obta... |
### Prompt
Generate a CPP solution to the following problem:
Enough is enough. Too many times it happened that Vasya forgot to dispose of garbage and his apartment stank afterwards. Now he wants to create a garbage disposal plan and stick to it.
For each of next n days Vasya knows a_i — number of units of garbage he... |
### Prompt
Create a solution in cpp for the following problem:
You are given a directed graph of n vertices and m edges. Vertices are numbered from 1 to n. There is a token in vertex 1.
The following actions are allowed:
* Token movement. To move the token from vertex u to vertex v if there is an edge u → v in t... |
### Prompt
Please create a solution in CPP to the following problem:
Robbers, who attacked the Gerda's cab, are very successful in covering from the kingdom police. To make the goal of catching them even harder, they use their own watches.
First, as they know that kingdom police is bad at math, robbers use the posit... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Nauuo is a girl who loves playing cards.
One day she was playing cards but found that the cards were mixed with some empty ones.
There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n ... |
### Prompt
Your task is to create a cpp solution to the following problem:
In the spring of 2014, a student successfully passed the university and started living alone. The problem here is what to do with the supper. He decided to plan a supper for the next N days.
He wants to maximize the total happiness he gets in... |
### Prompt
Create a solution in CPP for the following problem:
It has been decided that a programming contest sponsored by company A will be held, so we will post the notice on a bulletin board.
The bulletin board is in the form of a grid with N rows and N columns, and the notice will occupy a rectangular region wit... |
### Prompt
Please formulate a Cpp solution to the following problem:
Recently Polycarp started to develop a text editor that works only with correct bracket sequences (abbreviated as CBS).
Note that a bracket sequence is correct if it is possible to get a correct mathematical expression by adding "+"-s and "1"-s to... |
### Prompt
Generate a cpp solution to the following problem:
You are given a sequence a_1, a_2, …, a_n of non-negative integers.
You need to find the largest number m of triples (i_1, j_1, k_1), (i_2, j_2, k_2), ..., (i_m, j_m, k_m) such that:
* 1 ≤ i_p < j_p < k_p ≤ n for each p in 1, 2, …, m;
* a_{i_p} = a_{k... |
### Prompt
Construct a cpp code solution to the problem outlined:
The tram in Berland goes along a straight line from the point 0 to the point s and back, passing 1 meter per t1 seconds in both directions. It means that the tram is always in the state of uniform rectilinear motion, instantly turning around at points ... |
### Prompt
Develop a solution in CPP to the problem described below:
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They play until someone wi... |
### Prompt
Please provide a CPP coded solution to the problem described below:
You are given a connected undirected graph consisting of n vertices and m edges. There are no self-loops or multiple edges in the given graph.
You have to direct its edges in such a way that the obtained directed graph does not contain an... |
### Prompt
Your task is to create a Cpp solution to the following problem:
While Duff was resting in the beach, she accidentally found a strange array b0, b1, ..., bl - 1 consisting of l positive integers. This array was strange because it was extremely long, but there was another (maybe shorter) array, a0, ..., an -... |
### Prompt
Please create a solution in CPP to the following problem:
Given an array a of length n, tell us whether it has a non-empty subsequence such that the product of its elements is not a perfect square.
A sequence b is a subsequence of an array a if b can be obtained from a by deleting some (possibly zero) ele... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Lunar New Year is approaching, and Bob is struggling with his homework – a number division problem.
There are n positive integers a_1, a_2, …, a_n on Bob's homework paper, where n is always an even number. Bob is asked to divide those num... |
### Prompt
Develop a solution in CPP to the problem described below:
User ainta has a stack of n red and blue balls. He can apply a certain operation which changes the colors of the balls inside the stack.
* While the top ball inside the stack is red, pop the ball from the top of the stack.
* Then replace the b... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are conveniently numbered 1 through N. Snuke currently has no slime. His objective is to have slimes of all the co... |
### Prompt
Create a solution in cpp for the following problem:
N friends of Takahashi has come to a theme park.
To ride the most popular roller coaster in the park, you must be at least K centimeters tall.
The i-th friend is h_i centimeters tall.
How many of the Takahashi's friends can ride the roller coaster?
Co... |
### Prompt
Please formulate a Cpp solution to the following problem:
Among other things, Bob is keen on photography. Especially he likes to take pictures of sportsmen. That was the reason why he placed himself in position x0 of a long straight racetrack and got ready to take pictures. But the problem was that not all... |
### Prompt
Please create a solution in cpp to the following problem:
Write a program which reads a sequence of integers $A = \\{a_0, a_1, ..., a_{n-1}\\}$ and rotate specified elements by a list of the following operation:
* rotate($b, m, e$): For each integer $k$ ($0 \leq k < (e - b)$), move element $b + k$ to the ... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we've used to: it can have 26 distinct nucleotide ... |
### Prompt
In CPP, your task is to solve the following problem:
The administration of the Tomsk Region firmly believes that it's time to become a megacity (that is, get population of one million). Instead of improving the demographic situation, they decided to achieve its goal by expanding the boundaries of the city.... |
### Prompt
Please create a solution in CPP to the following problem:
You work in a big office. It is a 9 floor building with an elevator that can accommodate up to 4 people. It is your responsibility to manage this elevator.
Today you are late, so there are queues on some floors already. For each person you know the... |
### Prompt
Construct a Cpp code solution to the problem outlined:
As we all know, Max is the best video game player among her friends. Her friends were so jealous of hers, that they created an actual game just to prove that she's not the best at games. The game is played on a directed acyclic graph (a DAG) with n ver... |
### Prompt
Construct a Cpp code solution to the problem outlined:
While discussing a proper problem A for a Codeforces Round, Kostya created a cyclic array of positive integers a_1, a_2, …, a_n. Since the talk was long and not promising, Kostya created a new cyclic array b_1, b_2, …, b_{n} so that b_i = (a_i mod a_{i... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Polycarpus works as a programmer in a start-up social network. His boss gave his a task to develop a mechanism for determining suggested friends. Polycarpus thought much about the task and came to the folowing conclusion.
Let's say that all ... |
### Prompt
Generate a CPP solution to the following problem:
The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Amr has got a large array of size n. Amr doesn't like large arrays so he intends to make it smaller.
Amr doesn't care about anything in the array except the beauty of it. The beauty of the array is defined to be the maximum number of time... |
### Prompt
Generate a CPP solution to the following problem:
There are N cubes stacked vertically on a desk.
You are given a string S of length N. The color of the i-th cube from the bottom is red if the i-th character in S is `0`, and blue if that character is `1`.
You can perform the following operation any numbe... |
### Prompt
Construct a CPP code solution to the problem outlined:
We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it — either 1 or 2.
However, there is one condition you must fulfill in order to receive the prize.... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Little Petya has recently started attending a programming club. Naturally he is facing the problem of choosing a programming language. After long considerations he realized that Java is the best choice. The main argument in favor of choosi... |
### Prompt
Construct a cpp code solution to the problem outlined:
Anya and Kirill are doing a physics laboratory work. In one of the tasks they have to measure some value n times, and then compute the average value to lower the error.
Kirill has already made his measurements, and has got the following integer values... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Binary trees are defined recursively. A binary tree T is a structure defined on a finite set of nodes that either
* contains no nodes, or
* is composed of three disjoint sets of nodes:
- a root node.
- a binary tree called its left subtre... |
### Prompt
Please formulate a Cpp solution to the following problem:
Petya studies positional notations. He has already learned to add and subtract numbers in the systems of notations with different radices and has moved on to a more complicated action — multiplication. To multiply large numbers one has to learn the ... |
### Prompt
Generate a Cpp solution to the following problem:
Warawreh created a great company called Nanosoft. The only thing that Warawreh still has to do is to place a large picture containing its logo on top of the company's building.
The logo of Nanosoft can be described as four squares of the same size merged t... |
### Prompt
In Cpp, your task is to solve the following problem:
We have a tree with N vertices. The vertices are numbered 0 through N - 1, and the i-th edge (0 ≤ i < N - 1) comnnects Vertex a_i and b_i. For each pair of vertices u and v (0 ≤ u, v < N), we define the distance d(u, v) as the number of edges in the path... |
### Prompt
Develop a solution in Cpp to the problem described below:
Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is.
You are given a ... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Fibonacci number f(i) appear in a variety of puzzles in nature and math, including packing problems, family trees or Pythagorean triangles. They obey the rule f(i) = f(i - 1) + f(i - 2), where we set f(0) = 1 = f(-1).
Let V and d be two c... |
### Prompt
In Cpp, your task is to solve the following problem:
You might have remembered Theatre square from the [problem 1A](https://codeforces.com/problemset/problem/1/A). Now it's finally getting repaved.
The square still has a rectangular shape of n × m meters. However, the picture is about to get more complica... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
The Hedgehog likes to give presents to his friend, but no less he likes to receive them.
Having received another present today, the Hedgehog suddenly understood that he has no place to put it as there was no room left on the special shelf... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties toget... |
### Prompt
Develop a solution in CPP to the problem described below:
Don't you tell me what you think that I can be
If you say that Arkady is a bit old-fashioned playing checkers, you won't be right. There is also a modern computer game Arkady and his friends are keen on. We won't discuss its rules, the only feature... |
### Prompt
Construct a Cpp code solution to the problem outlined:
You are given n segments on a number line; each endpoint of every segment has integer coordinates. Some segments can degenerate to points. Segments can intersect with each other, be nested in each other or even coincide.
The intersection of a sequence... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
A coordinate line has n segments, the i-th segment starts at the position li and ends at the position ri. We will denote such a segment as [li, ri].
You have suggested that one of the defined segments covers all others. In other words, th... |
### Prompt
Construct a cpp code solution to the problem outlined:
The statement of this problem is the same as the statement of problem C1. The only difference is that, in problem C1, n is always even, and in C2, n is always odd.
You are given a regular polygon with 2 ⋅ n vertices (it's convex and has equal sides an... |
### Prompt
Please provide a CPP coded solution to the problem described below:
Vasya has recently developed a new algorithm to optimize the reception of customer flow and he considered the following problem.
Let the queue to the cashier contain n people, at that each of them is characterized by a positive integer ai... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
You've got a table of size n × m. We'll consider the table rows numbered from top to bottom 1 through n, and the columns numbered from left to right 1 through m. Then we'll denote the cell in row x and column y as (x, y).
Initially cell (... |
### Prompt
Please formulate a cpp solution to the following problem:
One day a well-known sponsor of a well-known contest decided to give every participant of the contest a T-shirt as a present. A natural problem occurred: on the one hand, it is not clear how many T-shirts of what sizes should be ordered, and on the ... |
### Prompt
In Cpp, your task is to solve the following problem:
You are given an array a of length 2n. Consider a partition of array a into two subsequences p and q of length n each (each element of array a should be in exactly one subsequence: either in p or in q).
Let's sort p in non-decreasing order, and q in non... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short name... |
### Prompt
Your task is to create a Cpp solution to the following problem:
This contest, AtCoder Beginner Contest, is abbreviated as ABC.
When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC.
What is the abbreviation for the N-th round o... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Professor Bajtocy is conducting experiments on alien DNA. He has discovered that it is subject to repetitive mutations — each mutation happens in the same way: some continuous subsequence of the alien DNA becomes active, copies itself, the copy gets ma... |
### Prompt
Generate a cpp solution to the following problem:
Valery is a PE teacher at a school in Berland. Soon the students are going to take a test in long jumps, and Valery has lost his favorite ruler!
However, there is no reason for disappointment, as Valery has found another ruler, its length is l centimeters... |
### Prompt
In CPP, your task is to solve the following problem:
In 2215 A.D., a war between two planets, ACM and ICPC, is being more and more intense.
ACM introduced new combat planes. These planes have a special system that is called Graze, and fighting power of a plane increases when it is close to energy bullets ... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Unlucky year in Berland is such a year that its number n can be represented as n = xa + yb, where a and b are non-negative integer numbers.
For example, if x = 2 and y = 3 then the years 4 and 17 are unlucky (4 = 20 + 31, 17 = 23 + 32 = 24 + 30) and ... |
### Prompt
Please formulate a cpp solution to the following problem:
This is an interactive problem!
Ehab plays a game with Laggy. Ehab has 2 hidden integers (a,b). Laggy can ask a pair of integers (c,d) and Ehab will reply with:
* 1 if a ⊕ c>b ⊕ d.
* 0 if a ⊕ c=b ⊕ d.
* -1 if a ⊕ c<b ⊕ d.
Operation a ⊕... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
After all the events in Orlando we all know, Sasha and Roma decided to find out who is still the team's biggest loser. Thankfully, Masha found somewhere a revolver with a rotating cylinder of n bullet slots able to contain exactly k bullet... |
### Prompt
In cpp, your task is to solve the following problem:
To your surprise, Jamie is the final boss! Ehehehe.
Jamie has given you a tree with n vertices, numbered from 1 to n. Initially, the root of the tree is the vertex with number 1. Also, each vertex has a value on it.
Jamie also gives you three types of ... |
### Prompt
Create a solution in cpp for the following problem:
A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the sea level. On the i-th day height was equal to some integer hi. The tourist pick smooth enough route for his hike, meaning that the be... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Long time ago, there was a great kingdom and it was being ruled by The Great Arya and Pari The Great. These two had some problems about the numbers they like, so they decided to divide the great kingdom between themselves.
The great kingdom c... |
### Prompt
Please formulate a Cpp solution to the following problem:
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working on the a... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Igor is in the museum and he wants to see as many pictures as possible.
Museum can be represented as a rectangular field of n × m cells. Each cell is either empty or impassable. Empty cells are marked with '.', impassable cells are marked... |
### Prompt
Construct a CPP code solution to the problem outlined:
Little C loves number «3» very much. He loves all things about it.
Now he has a positive integer n. He wants to split n into 3 positive integers a,b,c, such that a+b+c=n and none of the 3 integers is a multiple of 3. Help him to find a solution.
Inpu... |
### Prompt
Construct a CPP code solution to the problem outlined:
It has been noted that if some ants are put in the junctions of the graphene integer lattice then they will act in the following fashion: every minute at each junction (x, y) containing at least four ants a group of four ants will be formed, and these ... |
### Prompt
Generate a CPP solution to the following problem:
Vladimir wants to modernize partitions in his office. To make the office more comfortable he decided to remove a partition and plant several bamboos in a row. He thinks it would be nice if there are n bamboos in a row, and the i-th from the left is ai meter... |
### Prompt
Develop a solution in CPP to the problem described below:
Alyona has a tree with n vertices. The root of the tree is the vertex 1. In each vertex Alyona wrote an positive integer, in the vertex i she wrote ai. Moreover, the girl wrote a positive integer to every edge of the tree (possibly, different intege... |
### Prompt
Construct a cpp code solution to the problem outlined:
You are given two integer sequences of length N: a_1,a_2,..,a_N and b_1,b_2,..,b_N. Determine if we can repeat the following operation zero or more times so that the sequences a and b become equal.
Operation: Choose two integers i and j (possibly the ... |
### Prompt
Please create a solution in cpp to the following problem:
Petya and Vasya are tossing a coin. Their friend Valera is appointed as a judge. The game is very simple. First Vasya tosses a coin x times, then Petya tosses a coin y times. If the tossing player gets head, he scores one point. If he gets tail, nob... |
### Prompt
Your task is to create a cpp solution to the following problem:
Genos has been given n distinct lines on the Cartesian plane. Let <image> be a list of intersection points of these lines. A single point might appear multiple times in this list if it is the intersection of multiple pairs of lines. The order ... |
### Prompt
Generate a Cpp solution to the following problem:
The sequence of integers a_1, a_2, ..., a_k is called a good array if a_1 = k - 1 and a_1 > 0. For example, the sequences [3, -1, 44, 0], [1, -99] are good arrays, and the sequences [3, 7, 8], [2, 5, 4, 1], [0] — are not.
A sequence of integers is called g... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Hooray! Berl II, the king of Berland is making a knight tournament. The king has already sent the message to all knights in the kingdom and they in turn agreed to participate in this grand event.
As for you, you're just a simple peasant. ... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms:
1. Make vi-th array element equal to xi. In other... |
### Prompt
In CPP, your task is to solve the following problem:
Manao's friends often send him new songs. He never listens to them right away. Instead, he compiles them into a playlist. When he feels that his mind is open to new music, he opens the playlist and starts to listen to the songs.
Of course, there are som... |
### Prompt
Please formulate a cpp solution to the following problem:
Vanya is in the palace that can be represented as a grid n × m. Each room contains a single chest, an the room located in the i-th row and j-th columns contains the chest of type aij. Each chest of type x ≤ p - 1 contains a key that can open any che... |
### Prompt
Create a solution in cpp for the following problem:
There is a 120 minute videotape with standard recording. When I set the VCR counter to 00:00:00 with the tape completely rewound and recorded in standard recording mode, I got a certain counter value. Enter this counter value (hours, minutes, seconds), fi... |
### Prompt
Generate a cpp solution to the following problem:
Misha has an array of n integers indexed by integers from 1 to n. Let's define palindrome degree of array a as the number of such index pairs (l, r)(1 ≤ l ≤ r ≤ n), that the elements from the l-th to the r-th one inclusive can be rearranged in such a way th... |
### Prompt
In CPP, your task is to solve the following problem:
Reforms continue entering Berland. For example, during yesterday sitting the Berland Parliament approved as much as n laws (each law has been assigned a unique number from 1 to n). Today all these laws were put on the table of the President of Berland, G... |
### Prompt
Generate a CPP solution to the following problem:
There are K pieces of cakes. Mr. Takahashi would like to eat one cake per day, taking K days to eat them all.
There are T types of cake, and the number of the cakes of type i (1 ≤ i ≤ T) is a_i.
Eating the same type of cake two days in a row would be no f... |
### Prompt
Create a solution in Cpp for the following problem:
You are given three integers a ≤ b ≤ c.
In one move, you can add +1 or -1 to any of these integers (i.e. increase or decrease any number by one). You can perform such operation any (possibly, zero) number of times, you can even perform this operation sev... |
### Prompt
Generate a CPP solution to the following problem:
Ahmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla asked them to solve one challenging problem, of course Ahmed was able to solve it but Mostafa couldn't.
This problem is similar to a standard probl... |
### Prompt
In CPP, your task is to solve the following problem:
This is the easy version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve all versions of this task.
You are given a string s, consisting of lowercase En... |
### Prompt
Generate a Cpp solution to the following problem:
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately go... |
### Prompt
Develop a solution in cpp to the problem described below:
The country has n cities and n - 1 bidirectional roads, it is possible to get from every city to any other one if you move only along the roads. The cities are numbered with integers from 1 to n inclusive.
All the roads are initially bad, but the g... |
### Prompt
In cpp, your task is to solve the following problem:
Toad Pimple has an array of integers a_1, a_2, …, a_n.
We say that y is reachable from x if x<y and there exists an integer array p such that x = p_1 < p_2 < … < p_k=y, and a_{p_i} \& a_{p_{i+1}} > 0 for all integers i such that 1 ≤ i < k.
Here \& de... |
### Prompt
Construct a CPP code solution to the problem outlined:
Ilya is a very clever lion, he lives in an unusual city ZooVille. In this city all the animals have their rights and obligations. Moreover, they even have their own bank accounts. The state of a bank account is an integer. The state of a bank account c... |
### Prompt
Construct a CPP code solution to the problem outlined:
A boy named Ayrat lives on planet AMI-1511. Each inhabitant of this planet has a talent. Specifically, Ayrat loves running, moreover, just running is not enough for him. He is dreaming of making running a real art.
First, he wants to construct the run... |
### Prompt
Please create a solution in Cpp 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 types ... |
### Prompt
Create a solution in cpp for the following problem:
Wu got hungry after an intense training session, and came to a nearby store to buy his favourite instant noodles. After Wu paid for his purchase, the cashier gave him an interesting task.
You are given a bipartite graph with positive integers in all vert... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.