text stringlengths 424 69.5k |
|---|
### Prompt
Please provide a Cpp coded solution to the problem described below:
In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network β for each pair of different towns x and y, there is a bidirectional road between towns x and y if and onl... |
### Prompt
Develop a solution in cpp to the problem described below:
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the l... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
So we got bored and decided to take our own guess at how would "Inception" production go if the budget for the film had been terribly low.
The first scene we remembered was the one that features the whole city bending onto itself:
<image... |
### Prompt
Develop a solution in Cpp to the problem described below:
There is a bookshelf which can fit n books. The i-th position of bookshelf is a_i = 1 if there is a book on this position and a_i = 0 otherwise. It is guaranteed that there is at least one book on the bookshelf.
In one move, you can choose some con... |
### Prompt
In Cpp, your task is to solve the following problem:
Phoenix is trying to take a photo of his n friends with labels 1, 2, ..., n who are lined up in a row in a special order. But before he can take the photo, his friends get distracted by a duck and mess up their order.
Now, Phoenix must restore the order... |
### Prompt
Generate a cpp solution to the following problem:
Artem has an array of n positive integers. Artem decided to play with it. The game consists of n moves. Each move goes like this. Artem chooses some element of the array and removes it. For that, he gets min(a, b) points, where a and b are numbers that were... |
### Prompt
In Cpp, your task is to solve the following problem:
Toshizo is the manager of a convenience store chain in Hakodate. Every day, each of the stores in his chain sends him a table of the products that they have sold. Toshizo's job is to compile these figures and calculate how much the stores have sold in to... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Rng is preparing a problem set for a qualification round of CODEFESTIVAL.
He has N candidates of problems. The difficulty of the i-th candidate is D_i.
There must be M problems in the problem set, and the difficulty of the i-th problem must ... |
### Prompt
Please create a solution in cpp to the following problem:
When little Petya grew up and entered the university, he started to take part in ΠΠ‘Π contests. Later he realized that he doesn't like how the ΠΠ‘Π contests are organised: the team could only have three members (and he couldn't take all his friends to... |
### Prompt
Develop a solution in Cpp to the problem described below:
As a big fan of Formula One, Charlie is really happy with the fact that he has to organize ticket sells for the next Grand Prix race in his own city. Unfortunately, the finacial crisis is striking everywhere and all the banknotes left in his country... |
### Prompt
Please create a solution in CPP to the following problem:
Today is the birthday of Mr. Bon Vivant, who is known as one of the greatest patissiers in the world. Those who are invited to his birthday party are gourmets from around the world. They are eager to see and eat his extremely creative cakes. Now a l... |
### Prompt
Please create a solution in cpp to the following problem:
β Thanks a lot for today.
β I experienced so many great things.
β You gave me memories like dreams... But I have to leave now...
β One last request, can you...
β Help me solve a Codeforces problem?
β ......
β What?
Chtholly has been thinking ... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
There is an infinite line consisting of cells. There are n boxes in some cells of this line. The i-th box stands in the cell a_i and has weight w_i. All a_i are distinct, moreover, a_{i - 1} < a_i holds for all valid i.
You would like to ... |
### Prompt
In cpp, your task is to solve the following problem:
Phoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strings a_1, a_2, ..., a_k such that every letter of s goes to exactly one of the strings a_i. The strings a_i do not need... |
### Prompt
Please provide a cpp coded solution to the problem described below:
This is an interactive problem.
A legendary tree rests deep in the forest. Legend has it that individuals who realize this tree would eternally become a Legendary Grandmaster.
To help you determine the tree, Mikaela the Goddess has revea... |
### 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
Construct a Cpp code solution to the problem outlined:
Andrey's favourite number is n. Andrey's friends gave him two identical numbers n as a New Year present. He hung them on a wall and watched them adoringly.
Then Andrey got bored from looking at the same number and he started to swap digits first in on... |
### Prompt
In CPP, your task is to solve the following problem:
AtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K. Here, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K Γ K square.... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Alica and Bob are playing a game.
Initially they have a binary string s consisting of only characters 0 and 1.
Alice and Bob make alternating moves: Alice makes the first move, Bob makes the second move, Alice makes the third one, and so... |
### Prompt
Please provide a cpp coded solution to the problem described below:
You are given a tree (connected graph without cycles) consisting of n vertices. The tree is unrooted β it is just a connected undirected graph without cycles.
In one move, you can choose exactly k leaves (leaf is such a vertex that is con... |
### Prompt
Create a solution in Cpp for the following problem:
Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around.
You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and eac... |
### Prompt
Generate a Cpp solution to the following problem:
On one quiet day all of sudden Mister B decided to draw angle a on his field. Aliens have already visited his field and left many different geometric figures on it. One of the figures is regular convex n-gon (regular convex polygon with n sides).
That's wh... |
### Prompt
Please formulate a cpp solution to the following problem:
Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.
Recall that integer k is called ... |
### Prompt
In cpp, your task is to solve the following problem:
JATC's math teacher always gives the class some interesting math problems so that they don't get bored. Today the problem is as follows. Given an integer n, you can perform the following operations zero or more times:
* mul x: multiplies n by x (where... |
### Prompt
Develop a solution in CPP to the problem described below:
There are N people living on a number line.
The i-th person lives at coordinate X_i.
You are going to hold a meeting that all N people have to attend.
The meeting can be held at any integer coordinate. If you choose to hold the meeting at coordin... |
### Prompt
Develop a solution in Cpp to the problem described below:
Mr. Funt now lives in a country with a very specific tax laws. The total income of mr. Funt during this year is equal to n (n β₯ 2) burles and the amount of tax he has to pay is calculated as the maximum divisor of n (not equal to n, of course). For ... |
### Prompt
Develop a solution in CPP to the problem described below:
There is a grid with H rows and W columns, where each square is painted black or white.
You are given H strings S_1, S_2, ..., S_H, each of length W. If the square at the i-th row from the top and the j-th column from the left is painted black, the... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale:
"Once upon a time, there lived an emperor. He was very rich and had much grain. One day he ordered to ... |
### Prompt
Please provide a CPP coded solution to the problem described below:
Bob has a string s consisting of lowercase English letters. He defines s' to be the string after removing all "a" characters from s (keeping all other characters in the same order). He then generates a new string t by concatenating s and s... |
### Prompt
Create a solution in CPP for the following problem:
It's that time of the year, Felicity is around the corner and you can see people celebrating all around the Himalayan region. The Himalayan region has n gyms. The i-th gym has gi Pokemon in it. There are m distinct Pokemon types in the Himalayan region nu... |
### Prompt
Develop a solution in Cpp to the problem described below:
Amugae has a hotel consisting of 10 rooms. The rooms are numbered from 0 to 9 from left to right.
The hotel has two entrances β one from the left end, and another from the right end. When a customer arrives to the hotel through the left entrance, t... |
### Prompt
Create a solution in CPP for the following problem:
You've got an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers li, ri. Numbers li, ri define a subsegment of the original array, that is, the sequence of numbers ali, ali + 1, ali + 2... |
### Prompt
Please formulate a Cpp solution to the following problem:
Write a program which manipulates a weighted rooted tree $T$ with the following operations:
* $add(v,w)$: add $w$ to the edge which connects node $v$ and its parent
* $getSum(u)$: report the sum of weights of all edges from the root to node $u$
... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
You are given two positive integers d and s. Find minimal positive integer n which is divisible by d and has sum of digits equal to s.
Input
The first line contains two positive integers d and s (1 β€ d β€ 500, 1 β€ s β€ 5000) separated by s... |
### Prompt
Please provide a cpp coded solution to the problem described below:
A frog is currently at the point 0 on a coordinate axis Ox. It jumps by the following algorithm: the first jump is a units to the right, the second jump is b units to the left, the third jump is a units to the right, the fourth jump is b u... |
### Prompt
Generate a cpp solution to the following problem:
Vasya will fancy any number as long as it is an integer power of two. Petya, on the other hand, is very conservative and only likes a single integer p (which may be positive, negative, or zero). To combine their tastes, they invented p-binary numbers of the... |
### Prompt
In CPP, your task is to solve the following problem:
Consider a tree T (that is, a connected graph without cycles) with n vertices labelled 1 through n. We start the following process with T: while T has more than one vertex, do the following:
* choose a random edge of T equiprobably;
* shrink the cho... |
### Prompt
Your task is to create a Cpp solution to the following problem:
SmallR is a biologist. Her latest research finding is how to change the sex of dogs. In other words, she can change female dogs into male dogs and vice versa.
She is going to demonstrate this technique. Now SmallR has n dogs, the costs of eac... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
You are given a sequence (P_1,P_2,...,P_N) which is a permutation of the integers from 1 through N. You would like to sort this sequence in ascending order by repeating the following operation:
* Choose an element in the sequence and move... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h Γ w field, and it is painted in two colors, but not like in chess. Almost all cells of the field are w... |
### Prompt
Develop a solution in Cpp to the problem described below:
A widely known among some people Belarusian sport programmer Yura possesses lots of information about cars. That is why he has been invited to participate in a game show called "Guess That Car!".
The game show takes place on a giant parking lot, wh... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
JATC's math teacher always gives the class some interesting math problems so that they don't get bored. Today the problem is as follows. Given an integer n, you can perform the following operations zero or more times:
* mul x: multiplie... |
### Prompt
Construct a CPP code solution to the problem outlined:
Limak is a grizzly bear who desires power and adoration. He wants to win in upcoming elections and rule over the Bearland.
There are n candidates, including Limak. We know how many citizens are going to vote for each candidate. Now i-th candidate woul... |
### Prompt
Please formulate a Cpp solution to the following problem:
In 2028 and after a continuous growth, AtCoder Inc. finally built an empire with six cities (City 1, 2, 3, 4, 5, 6)!
There are five means of transport in this empire:
* Train: travels from City 1 to 2 in one minute. A train can occupy at most A pe... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
The project of a data center of a Big Software Company consists of n computers connected by m cables. Simply speaking, each computer can be considered as a box with multiple cables going out of the box. Very Important Information is transm... |
### Prompt
Please create a solution in Cpp to the following problem:
You are given a board of size n Γ n, where n is odd (not divisible by 2). Initially, each cell of the board contains one figure.
In one move, you can select exactly one figure presented in some cell and move it to one of the cells sharing a side or... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Vasya lives in a round building, whose entrances are numbered sequentially by integers from 1 to n. Entrance n and entrance 1 are adjacent.
Today Vasya got bored and decided to take a walk in the yard. Vasya lives in entrance a and he dec... |
### Prompt
Create a solution in CPP for the following problem:
You are given a set of n segments on the axis Ox, each segment has integer endpoints between 1 and m inclusive. Segments may intersect, overlap or even coincide with each other. Each segment is characterized by two integers l_i and r_i (1 β€ l_i β€ r_i β€ m)... |
### Prompt
Create a solution in cpp for the following problem:
Obesity is cited as the cause of many adult diseases. In the past, with a few exceptions, it was unrelated to high school students. However, it is no longer unrealistic to suffer from lack of exercise due to excessive studying for entrance exams, or to be... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
There is a grid with H rows and W columns.
The square at the i-th row and j-th column contains a string S_{i,j} of length 5.
The rows are labeled with the numbers from 1 through H, and the columns are labeled with the uppercase English l... |
### Prompt
Please provide a cpp coded solution to the problem described below:
You are given an array a of n (n β₯ 2) positive integers and an integer p. Consider an undirected weighted graph of n vertices numbered from 1 to n for which the edges between the vertices i and j (i<j) are added in the following manner:
... |
### Prompt
Please formulate a Cpp solution to the following problem:
Geometric progression with the first element a and common ratio b is a sequence of numbers a, ab, ab2, ab3, ....
You are given n integer geometric progressions. Your task is to find the smallest integer x, that is the element of all the given progr... |
### Prompt
Your task is to create a CPP solution to the following problem:
There is a frequency operation in the conversion operation of a finite number sequence. The conversion result of the sequence $ S = \\ {s_1, s_2, ... s_n \\} $ is a sequence of the same length. If the result is $ C = \\ {c_1, c_2, ..., c_n \\}... |
### Prompt
In CPP, your task is to solve the following problem:
There are n lights aligned in a row. These lights are numbered 1 to n from left to right. Initially some of the lights are switched on. Shaass wants to switch all the lights on. At each step he can switch a light on (this light should be switched off at ... |
### Prompt
Please formulate a cpp solution to the following problem:
Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase ... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers.
You can assume that a word consists of at most 30 characters, and the page numbe... |
### Prompt
Construct a Cpp code solution to the problem outlined:
For a string S, let f(S) be the lexicographically smallest cyclic shift of S. For example, if S = `babca`, f(S) = `ababc` because this is the smallest among all cyclic shifts (`babca`, `abcab`, `bcaba`, `cabab`, `ababc`).
You are given three integers ... |
### Prompt
Generate a CPP solution to the following problem:
Ivar the Boneless is a great leader. He is trying to capture Kattegat from Lagertha. The war has begun and wave after wave Ivar's warriors are falling in battle.
Ivar has n warriors, he places them on a straight line in front of the main gate, in a way tha... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
You are given two integers n and k. Your task is to find if n can be represented as a sum of k distinct positive odd (not divisible by 2) integers or not.
You have to answer t independent test cases.
Input
The first line of the input co... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
In this problem you will have to deal with a very special network.
The network consists of two parts: part A and part B. Each part consists of n vertices; i-th vertex of part A is denoted as Ai, and i-th vertex of part B is denoted as Bi.... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Dima's got a staircase that consists of n stairs. The first stair is at height a1, the second one is at a2, the last one is at an (1 β€ a1 β€ a2 β€ ... β€ an).
Dima decided to play with the staircase, so he is throwing rectangular boxes at t... |
### Prompt
Create a solution in CPP for the following problem:
Simon has a prime number x and an array of non-negative integers a1, a2, ..., an.
Simon loves fractions very much. Today he wrote out number <image> on a piece of paper. After Simon led all fractions to a common denominator and summed them up, he got a f... |
### Prompt
In Cpp, your task is to solve the following problem:
Write a program which reads a sequence of integers $A = \\{a_0, a_1, ..., a_{n-1}\\}$ and reverse specified elements by a list of the following operation:
* reverse($b, e$): reverse the order of $a_b, a_{b+1}, ..., a_{e-1}$
Constraints
* $1 \leq n \le... |
### Prompt
Develop a solution in Cpp to the problem described below:
There are N slimes lining up in a row. Initially, the i-th slime from the left has a size of a_i.
Taro is trying to combine all the slimes into a larger slime. He will perform the following operation repeatedly until there is only one slime:
* Cho... |
### Prompt
Please formulate a cpp solution to the following problem:
You are an immigration officer in the Kingdom of AtCoder. The document carried by an immigrant has some number of integers written on it, and you need to check whether they meet certain criteria.
According to the regulation, the immigrant should be... |
### Prompt
Construct a CPP code solution to the problem outlined:
Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya calls a mask of a positi... |
### Prompt
Your task is to create a cpp solution to the following problem:
One must train much to do well on wizardry contests. So, there are numerous wizardry schools and magic fees.
One of such magic schools consists of n tours. A winner of each tour gets a huge prize. The school is organised quite far away, so on... |
### Prompt
Construct a cpp code solution to the problem outlined:
Pashmak has fallen in love with an attractive girl called Parmida since one year ago...
Today, Pashmak set up a meeting with his partner in a romantic garden. Unfortunately, Pashmak has forgotten where the garden is. But he remembers that the garden l... |
### Prompt
In CPP, your task is to solve the following problem:
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. 2 β
n students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly n people in each ... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Some time ago Lesha found an entertaining string s consisting of lowercase English letters. Lesha immediately developed an unique algorithm for this string and shared it with you. The algorithm is as follows.
Lesha chooses an arbitrary (possi... |
### Prompt
Please formulate a CPP solution to the following problem:
It is known that fleas in Berland can jump only vertically and horizontally, and the length of the jump is always equal to s centimeters. A flea has found herself at the center of some cell of the checked board of the size n Γ m centimeters (each ce... |
### Prompt
Generate a cpp solution to the following problem:
You are given n points on a plane. All points are different.
Find the number of different groups of three points (A, B, C) such that point B is the middle of segment AC.
The groups of three points are considered unordered, that is, if point B is the midd... |
### Prompt
Create a solution in Cpp for the following problem:
Phoenix has decided to become a scientist! He is currently investigating the growth of bacteria.
Initially, on day 1, there is one bacterium with mass 1.
Every day, some number of bacteria will split (possibly zero or all). When a bacterium of mass m sp... |
### Prompt
Develop a solution in cpp to the problem described below:
Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.
There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Connected undirected graph without cycles is called a tree. Trees is a class of graphs which is interesting not only for people, but for ants too.
An ant stands at the root of some tree. He sees that there are n vertexes in the tree, and ... |
### Prompt
Your task is to create a Cpp solution to the following problem:
You are given a long decimal number a consisting of n digits from 1 to 9. You also have a function f that maps every digit from 1 to 9 to some (possibly the same) digit from 1 to 9.
You can perform the following operation no more than once: c... |
### Prompt
Please formulate a cpp solution to the following problem:
Kuro is living in a country called Uberland, consisting of n towns, numbered from 1 to n, and n - 1 bidirectional roads connecting these towns. It is possible to reach each town from any other. Each road connects two towns a and b. Kuro loves walkin... |
### Prompt
Please create a solution in Cpp to the following problem:
Taro is addicted to a novel. The novel has n volumes in total, and each volume has a different thickness. Taro likes this novel so much that he wants to buy a bookshelf dedicated to it. However, if you put a large bookshelf in the room, it will be q... |
### Prompt
Your task is to create a cpp solution to the following problem:
You have two strings A = A_1 A_2 ... A_n and B = B_1 B_2 ... B_n of the same length consisting of 0 and 1.
You can transform A using the following operations in any order and as many times as you want:
* Shift A by one character to the left ... |
### Prompt
Please create a solution in CPP to the following problem:
Uncle Fyodor, Matroskin the Cat and Sharic the Dog live their simple but happy lives in Prostokvashino. Sometimes they receive parcels from Uncle Fyodorβs parents and sometimes from anonymous benefactors, in which case it is hard to determine to whi... |
### Prompt
In CPP, your task is to solve the following problem:
You are given two strings s and t consisting of lowercase Latin letters. Also you have a string z which is initially empty. You want string z to be equal to string t. You can perform the following operation to achieve this: append any subsequence of s at... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
There is a dice with one letter of the alphabet (a ~ z, A ~ Z) drawn on each side.
<image>
Consider combining eight such dice to make a 2 x 2 x 2 cube.
<image>
There are conditions on how to combine the dice, and the facing faces o... |
### Prompt
In Cpp, your task is to solve the following problem:
problem
AOR Ika likes rooted trees with a fractal (self-similar) structure. Consider using the weighted rooted tree $ T $ consisting of $ N $ vertices to represent the rooted tree $ T'$ with the following fractal structure.
* $ T'$ is the addition of a... |
### Prompt
Please create a solution in CPP to the following problem:
According to Berland laws it is only allowed to sell alcohol to people not younger than 18 years. Vasya's job is to monitor the law's enforcement. Tonight he entered a bar and saw n people sitting there. For every one of them Vasya happened to deter... |
### Prompt
In CPP, your task is to solve the following problem:
Your friend gave you a dequeue D as a birthday present.
D is a horizontal cylinder that contains a row of N jewels.
The values of the jewels are V_1, V_2, ..., V_N from left to right. There may be jewels with negative values.
In the beginning, you hav... |
### Prompt
Please formulate a Cpp solution to the following problem:
You are given an array which is initially empty. You need to perform n operations of the given format:
* "a l r k": append a to the end of the array. After that count the number of integer pairs x, y such that l β€ x β€ y β€ r and \operatorname{mex... |
### Prompt
Develop a solution in cpp to the problem described below:
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordin... |
### Prompt
Generate a CPP solution to the following problem:
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.
Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled wit... |
### 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
Create a solution in Cpp for the following problem:
KleofΓ‘Ε‘ is participating in an n-thlon - a tournament consisting of n different competitions in n different disciplines (numbered 1 through n). There are m participants in the n-thlon and each of them participates in all competitions.
In each of these n ... |
### Prompt
Generate a Cpp solution to the following problem:
There are several days left before the fiftieth birthday of a famous Berland's writer Berlbury. In this connection the local library decided to make an exposition of the works of this famous science-fiction writer. It was decided as well that it is necessar... |
### Prompt
Please create a solution in cpp to the following problem:
You have two positive integers w and h. Your task is to count the number of rhombi which have the following properties:
* Have positive area.
* With vertices at integer points.
* All vertices of the rhombi are located inside or on the bord... |
### Prompt
Develop a solution in CPP to the problem described below:
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.
Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy:
* Each piece should contain at least l numbers.
*... |
### Prompt
Generate a Cpp solution to the following problem:
Phoenix is picking berries in his backyard. There are n shrubs, and each shrub has a_i red berries and b_i blue berries.
Each basket can contain k berries. But, Phoenix has decided that each basket may only contain berries from the same shrub or berries of... |
### Prompt
In CPP, your task is to solve the following problem:
Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers β amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Effi... |
### Prompt
Please create a solution in Cpp to the following problem:
The process of mammoth's genome decoding in Berland comes to its end!
One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'... |
### Prompt
Generate a Cpp solution to the following problem:
An exam for n students will take place in a long and narrow room, so the students will sit in a line in some order. The teacher suspects that students with adjacent numbers (i and i + 1) always studied side by side and became friends and if they take an exa... |
### Prompt
Create a solution in cpp for the following problem:
Fibonacci numbers are the sequence of integers: f0 = 0, f1 = 1, f2 = 1, f3 = 2, f4 = 3, f5 = 5, ..., fn = fn - 2 + fn - 1. So every next number is the sum of the previous two.
Bajtek has developed a nice way to compute Fibonacci numbers on a blackboard. ... |
### Prompt
Develop a solution in CPP to the problem described below:
Lunar New Year is approaching, and Bob decides to take a wander in a nearby park.
The park can be represented as a connected graph with n nodes and m bidirectional edges. Initially Bob is at the node 1 and he records 1 on his notebook. He can wande... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
This is an easier version of the next problem. The difference is only in constraints.
You are given a rectangular n Γ m matrix a. In one move you can choose any column and cyclically shift elements in this column. You can perform this ope... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.