text
stringlengths
424
69.5k
### Prompt Generate a CPP solution to the following problem: Given a positive integer m, we say that a sequence x_1, x_2, ..., x_n of positive integers is m-cute if for every index i such that 2 ≤ i ≤ n it holds that x_i = x_{i - 1} + x_{i - 2} + ... + x_1 + r_i for some positive integer r_i satisfying 1 ≤ r_i ≤ m. ...
### Prompt Your task is to create a CPP solution to the following problem: Natsuki and her friends were taken to the space by an alien and made friends with a lot of aliens. During the space travel, she discovered that aliens’ hands were often very different from humans’. Generally speaking, in a kind of aliens, ther...
### Prompt Create a solution in cpp for the following problem: During the last 24 hours Hamed and Malek spent all their time playing "Sharti". Now they are too exhausted to finish the last round. So they asked you for help to determine the winner of this round. "Sharti" is played on a n × n board with some of cells...
### Prompt Please formulate a CPP solution to the following problem: Sonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants. The country where Sonya lives is an endless line. There is a city in each integer coordinate on this line. She has...
### Prompt Please formulate a CPP solution to the following problem: Little beaver is a beginner programmer, so informatics is his favorite subject. Soon his informatics teacher is going to have a birthday and the beaver has decided to prepare a present for her. He planted n flowers in a row on his windowsill and sta...
### Prompt Develop a solution in cpp to the problem described below: Dima and Inna love spending time together. The problem is, Seryozha isn't too enthusiastic to leave his room for some reason. But Dima and Inna love each other so much that they decided to get criminal... Dima constructed a trap graph. He shouted: ...
### Prompt Please create a solution in Cpp to the following problem: Nick has n bottles of soda left after his birthday. Each bottle is described by two values: remaining amount of soda ai and bottle volume bi (ai ≤ bi). Nick has decided to pour all remaining soda into minimal number of bottles, moreover he has to d...
### Prompt Construct a Cpp code solution to the problem outlined: Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters. There is a filler word ogo in Oleg's speech. All words...
### Prompt Please provide a Cpp coded solution to the problem described below: This problem is the most boring one you've ever seen. Given a sequence of integers a1, a2, ..., an and a non-negative integer h, our goal is to partition the sequence into two subsequences (not necessarily consist of continuous elements)...
### Prompt Generate a cpp solution to the following problem: For a set $S$ of integers, perform a sequence of the following operations. Note that each value in $S$ must be unique. * insert($x$): Insert $x$ to $S$ and report the number of elements in $S$ after the operation. * find($x$): Report the number of $x$ in $...
### Prompt Generate a Cpp solution to the following problem: Panic is rising in the committee for doggo standardization — the puppies of the new brood have been born multi-colored! In total there are 26 possible colors of puppies in the nature and they are denoted by letters from 'a' to 'z' inclusive. The committee ...
### Prompt Create a solution in cpp for the following problem: You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The ...
### Prompt Create a solution in cpp for the following problem: To get on the Shinkansen, you need two tickets, a "ticket" and a "limited express ticket". These are separate tickets because some of the routes may not use the Shinkansen, but for routes that use only the Shinkansen, one ticket can be used as both a tick...
### Prompt Generate a Cpp solution to the following problem: Vasya is developing his own programming language VPL (Vasya Programming Language). Right now he is busy making the system of exceptions. He thinks that the system of exceptions must function like that. The exceptions are processed by try-catch-blocks. Ther...
### Prompt In cpp, your task is to solve the following problem: Let us remind you part of the rules of Codeforces. The given rules slightly simplified, use the problem statement as a formal document. In the beginning of the round the contestants are divided into rooms. Each room contains exactly n participants. Duri...
### Prompt Develop a solution in Cpp to the problem described below: 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 In cpp, your task is to solve the following problem: Imagine a board with n pins put into it, the i-th pin is located at (x_i, y_i). For simplicity, we will restrict the problem to the case where the pins are placed in vertices of a convex polygon. Then, take a non-stretchable string of length l, and put ...
### Prompt Generate a Cpp solution to the following problem: The first semester ended. You know, after the end of the first semester the holidays begin. On holidays Noora decided to return to Vičkopolis. As a modest souvenir for Leha, she brought a sausage of length m from Pavlopolis. Everyone knows that any sausage ...
### Prompt In cpp, your task is to solve the following problem: There are N dots in a two-dimensional plane. The coordinates of the i-th dot are (x_i, y_i). We will repeat the following operation as long as possible: * Choose four integers a, b, c, d (a \neq c, b \neq d) such that there are dots at exactly three of...
### Prompt Please create a solution in cpp 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 of the...
### Prompt Create a solution in cpp for the following problem: Amr loves Geometry. One day he came up with a very interesting problem. Amr has a circle of radius r and center in point (x, y). He wants the circle center to be in new position (x', y'). In one step Amr can put a pin to the border of the circle in a ce...
### Prompt Develop a solution in Cpp to the problem described below: Alice and Bob are decorating a Christmas Tree. Alice wants only 3 types of ornaments to be used on the Christmas Tree: yellow, blue and red. They have y yellow ornaments, b blue ornaments and r red ornaments. In Bob's opinion, a Christmas Tree wi...
### Prompt Please provide a Cpp coded solution to the problem described below: Sereja adores trees. Today he came up with a revolutionary new type of binary root trees. His new tree consists of n levels, each vertex is indexed by two integers: the number of the level and the number of the vertex on the current level...
### Prompt Please provide a CPP coded solution to the problem described below: The bear has a string s = s1s2... s|s| (record |s| is the string's length), consisting of lowercase English letters. The bear wants to count the number of such pairs of indices i, j (1 ≤ i ≤ j ≤ |s|), that string x(i, j) = sisi + 1... sj c...
### Prompt Construct a Cpp code solution to the problem outlined: Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of ...
### Prompt Please formulate a CPP solution to the following problem: We all know that GukiZ often plays with arrays. Now he is thinking about this problem: how many arrays a, of length n, with non-negative elements strictly less then 2l meet the following condition: <image>? Here operation <image> means bitwise AND...
### Prompt Your challenge is to write a cpp solution to the following problem: Mashmokh's boss, Bimokh, didn't like Mashmokh. So he fired him. Mashmokh decided to go to university and participate in ACM instead of finding a new job. He wants to become a member of Bamokh's team. In order to join he was given some prog...
### Prompt Develop a solution in CPP to the problem described below: The subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. You are given an integer n. You have to find a sequence s consisting of digits \{1, 3, 7\} suc...
### Prompt Please provide a cpp coded solution to the problem described below: You are given an array of positive integers a1, a2, ..., an × T of length n × T. We know that for any i > n it is true that ai = ai - n. Find the length of the longest non-decreasing sequence of the given array. Input The first line cont...
### Prompt Develop a solution in CPP to the problem described below: Kurt reaches nirvana when he finds the product of all the digits of some positive integer. Greater value of the product makes the nirvana deeper. Help Kurt find the maximum possible product of digits among all integers from 1 to n. Input The only...
### Prompt In cpp, your task is to solve the following problem: Write a program which manipulates a sequence $A$ = {$a_0, a_1, ..., a_{n-1}$} with the following operations: * $add(s, t, x)$ : add $x$ to $a_s, a_{s+1}, ..., a_t$. * $find(s, t)$ : report the minimum value in $a_s, a_{s+1}, ..., a_t$. Note that the ...
### Prompt Your challenge is to write a cpp solution to the following problem: Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following condition...
### Prompt Please provide a Cpp coded solution to the problem described below: There are N squares in a row. The leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty. Aohashi would like to fill the empty squares with integers so that the following condition is...
### Prompt Please create a solution in cpp to the following problem: Inspired by the tv series Stranger Things, bear Limak is going for a walk between two mirror worlds. There are two perfect binary trees of height H, each with the standard numeration of vertices from 1 to 2^H-1. The root is 1 and the children of x ...
### Prompt Your challenge is to write a cpp solution to the following problem: Mr. Kitayuta has kindly given you a string s consisting of lowercase English letters. You are asked to insert exactly n lowercase English letters into s to make it a palindrome. (A palindrome is a string that reads the same forward and bac...
### Prompt Please create a solution in cpp to the following problem: There are N squares arranged in a row, numbered 1, 2, ..., N from left to right. You are given a string S of length N consisting of `.` and `#`. If the i-th character of S is `#`, Square i contains a rock; if the i-th character of S is `.`, Square i...
### Prompt In CPP, your task is to solve the following problem: You are solving the crossword problem K from IPSC 2014. You solved all the clues except for one: who does Eevee evolve into? You are not very into pokemons, but quick googling helped you find out, that Eevee can evolve into eight different pokemons: Vapo...
### Prompt Create a solution in Cpp for the following problem: A prisoner wants to escape from a prison. The prison is represented by the interior of the convex polygon with vertices P_1, P_2, P_3, …, P_{n+1}, P_{n+2}, P_{n+3}. It holds P_1=(0,0), P_{n+1}=(0, h), P_{n+2}=(-10^{18}, h) and P_{n+3}=(-10^{18}, 0). <ima...
### Prompt Your task is to create a cpp solution to the following problem: You are given an undirected connected graph G consisting of n vertexes and n edges. G contains no self-loops or multiple edges. Let each edge has two states: on and off. Initially all edges are switched off. You are also given m queries repre...
### Prompt Construct a CPP code solution to the problem outlined: Dima came to the horse land. There are n horses living in the land. Each horse in the horse land has several enemies (enmity is a symmetric relationship). The horse land isn't very hostile, so the number of enemies of each horse is at most 3. Right no...
### Prompt Generate a cpp solution to the following problem: Tanya has n candies numbered from 1 to n. The i-th candy has the weight a_i. She plans to eat exactly n-1 candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day. Your task is to ...
### Prompt Construct a cpp code solution to the problem outlined: You are given a tree with N vertices. Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices. The i-th edge (1≤i≤N-1) connects Vertices a_i and b_i, and has a length of...
### Prompt Develop a solution in cpp to the problem described below: You are given a string S. Takahashi can insert the character `A` at any position in this string any number of times. Can he change S into `AKIHABARA`? Constraints * 1 \leq |S| \leq 50 * S consists of uppercase English letters. Input Input is g...
### Prompt Your challenge is to write a CPP solution to the following problem: Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a "domino show". Chris arranges n dominoes in a line, placing each piece ve...
### Prompt Please formulate a Cpp solution to the following problem: A straight tunnel without branches is crowded with busy ants coming and going. Some ants walk left to right and others right to left. All ants walk at a constant speed of 1 cm/s. When two ants meet, they try to pass each other. However, some section...
### Prompt Create a solution in CPP for the following problem: Little C loves number «3» very much. He loves all things about it. Now he is interested in the following problem: There are two arrays of 2^n intergers a_0,a_1,...,a_{2^n-1} and b_0,b_1,...,b_{2^n-1}. The task is for each i (0 ≤ i ≤ 2^n-1), to calculat...
### Prompt Create a solution in Cpp for the following problem: Alice recently found some cactuses growing near her house! After several months, more and more cactuses appeared and soon they blocked the road. So Alice wants to clear them. [A cactus](https://en.wikipedia.org/wiki/Cactus_graph) is a connected undirecte...
### Prompt Construct a Cpp code solution to the problem outlined: As it's the first of April, Heidi is suspecting that the news she reads today are fake, and she does not want to look silly in front of all the contestants. She knows that a newspiece is fake if it contains heidi as a subsequence. Help Heidi assess whe...
### Prompt Please provide a CPP coded solution to the problem described below: Vasya and Petya are playing a simple game. Vasya thought of number x between 1 and n, and Petya tries to guess the number. Petya can ask questions like: "Is the unknown number divisible by number y?". The game is played by the following ...
### Prompt Your task is to create 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 put ...
### Prompt Please create a solution in cpp to the following problem: <image> Input The input contains a single floating-point number x with exactly 6 decimal places (0 < x < 5). Output Output two integers separated by a single space. Each integer should be between 1 and 10, inclusive. If several solutions exist, ...
### Prompt Please provide a CPP coded solution to the problem described below: English text is not available in this practice contest. At one point, a nobleman fell in love with a brave princess in a poor country and applied for marriage. The princess has given certain conditions to the aristocrats. The condition wa...
### Prompt In Cpp, your task is to solve the following problem: You have been hired to supervise the project of a new amusement park. The park will have a special gimmick: directed slides that can get customers from one attraction to another quickly and in an entertaining way. The park owner has given you the curren...
### Prompt Please formulate a Cpp solution to the following problem: Two positive integers a and b have a sum of s and a bitwise XOR of x. How many possible values are there for the ordered pair (a, b)? Input The first line of the input contains two integers s and x (2 ≤ s ≤ 1012, 0 ≤ x ≤ 1012), the sum and bitwise...
### Prompt Generate a CPP solution to the following problem: You are given a multiset S. Over all pairs of subsets A and B, such that: * B ⊂ A; * |B| = |A| - 1; * greatest common divisor of all elements in A is equal to one; find the sum of ∑_{x ∈ A}{x} ⋅ ∑_{x ∈ B}{x}, modulo 998 244 353. Input The fir...
### Prompt Please provide a Cpp coded solution to the problem described below: We held two competitions: Coding Contest and Robot Maneuver. In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contesta...
### Prompt Create a solution in CPP for the following problem: Manao is taking part in a quiz. The quiz consists of n consecutive questions. A correct answer gives one point to the player. The game also has a counter of consecutive correct answers. When the player answers a question correctly, the number on this coun...
### Prompt Your challenge is to write a cpp solution to the following problem: Buber is a Berland technology company that specializes in waste of investor's money. Recently Buber decided to transfer its infrastructure to a cloud. The company decided to rent CPU cores in the cloud for n consecutive days, which are num...
### Prompt Please formulate a Cpp solution to the following problem: You have a directed acyclic graph G, consisting of n vertexes, numbered from 0 to n - 1. The graph contains n edges numbered from 0 to n - 1. An edge with number i connects vertexes i and (i + 1) mod n, and it can be directed in either direction (fr...
### Prompt Construct a Cpp code solution to the problem outlined: Given are simple undirected graphs X, Y, Z, with N vertices each and M_1, M_2, M_3 edges, respectively. The vertices in X, Y, Z are respectively called x_1, x_2, \dots, x_N, y_1, y_2, \dots, y_N, z_1, z_2, \dots, z_N. The edges in X, Y, Z are respectiv...
### Prompt Please create a solution in cpp to the following problem: For each positive integer n consider the integer ψ(n) which is obtained from n by replacing every digit a in the decimal notation of n with the digit (9 - a). We say that ψ(n) is the reflection of n. For example, reflection of 192 equals 807. Note t...
### Prompt Construct a cpp code solution to the problem outlined: Imagine a city with n horizontal streets crossing m vertical streets, forming an (n - 1) × (m - 1) grid. In order to increase the traffic flow, mayor of the city has decided to make each street one way. This means in each horizontal street, the traffic...
### Prompt Your task is to create a CPP solution to the following problem: BerPhone X is almost ready for release with n applications being preinstalled on the phone. A category of an application characterizes a genre or a theme of this application (like "game", "business", or "education"). The categories are given a...
### Prompt Develop a solution in Cpp to the problem described below: In the NN country, there are n cities, numbered from 1 to n, and n - 1 roads, connecting them. There is a roads path between any two cities. There are m bidirectional bus routes between cities. Buses drive between two cities taking the shortest pat...
### Prompt In CPP, your task is to solve the following problem: Takahashi is at an all-you-can-eat restaurant. The restaurant offers N kinds of dishes. It takes A_i minutes to eat the i-th dish, whose deliciousness is B_i. The restaurant has the following rules: * You can only order one dish at a time. The dish or...
### Prompt Please formulate a CPP solution to the following problem: The Little Elephant loves to play with color cards. He has n cards, each has exactly two colors (the color of the front side and the color of the back side). Initially, all the cards lay on the table with the front side up. In one move the Little E...
### Prompt In cpp, your task is to solve the following problem: Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation p of length n, and Skynyrd bought an array a of length m, consisting of integers from 1 to n. Lynyrd and Skynyrd became bored, so they asked you q queries, each of which has t...
### Prompt Create a solution in cpp for the following problem: An architect, Devunky, who lives in Water Deven, has been asked to renovate an old large hospital. In some countries, people don't want to use numbers that are disliked as numerophobia (4 and 9 are famous in Japan). However, the room numbers in this hosp...
### Prompt Your task is to create a Cpp solution to the following problem: On one of the planets of Solar system, in Atmosphere University, many students are fans of bingo game. It is well known that one month on this planet consists of n^2 days, so calendars, represented as square matrix n by n are extremely popula...
### Prompt Your task is to create a cpp solution to the following problem: Arkady is playing Battleship. The rules of this game aren't really important. There is a field of n × n cells. There should be exactly one k-decker on the field, i. e. a ship that is k cells long oriented either horizontally or vertically. Ho...
### Prompt Please create a solution in cpp to the following problem: The mobile application store has a new game called "Subway Roller". The protagonist of the game Philip is located in one end of the tunnel and wants to get out of the other one. The tunnel is a rectangular field consisting of three rows and n colum...
### Prompt Construct a CPP code solution to the problem outlined: Tanya has n candies numbered from 1 to n. The i-th candy has the weight a_i. She plans to eat exactly n-1 candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day. Your task i...
### Prompt Develop a solution in CPP to the problem described below: At the entrance examination for the magistracy of the MSU Cyber-Mechanics Department Sasha got the question about Ford-Fulkerson algorithm. He knew the topic perfectly as he worked with it many times on programming competition. As the task for the q...
### Prompt Please provide a cpp coded solution to the problem described below: Hanh lives in a shared apartment. There are n people (including Hanh) living there, each has a private fridge. n fridges are secured by several steel chains. Each steel chain connects two different fridges and is protected by a digital l...
### Prompt Please provide a CPP coded solution to the problem described below: There are n games in a football tournament. Three teams are participating in it. Currently k games had already been played. You are an avid football fan, but recently you missed the whole k games. Fortunately, you remember a guess of you...
### Prompt In CPP, your task is to solve the following problem: Given an integer x. Your task is to find out how many positive integers n (1 ≤ n ≤ x) satisfy $$$n ⋅ a^n ≡ b (mod\;p), where a, b, p$$$ are all known constants. Input The only line contains four integers a,b,p,x (2 ≤ p ≤ 10^6+3, 1 ≤ a,b < p, 1 ≤ x ≤ ...
### Prompt Please create a solution in CPP to the following problem: Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively n...
### Prompt Create a solution in CPP for the following problem: Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. Yo...
### Prompt Your challenge is to write a cpp solution to the following problem: The History of Magic is perhaps the most boring subject in the Hogwarts school of Witchcraft and Wizardry. Harry Potter is usually asleep during history lessons, and his magical quill writes the lectures for him. Professor Binns, the histo...
### Prompt Develop a solution in CPP to the problem described below: Hr0d1y has q queries on a binary string s of length n. A binary string is a string containing only characters '0' and '1'. A query is described by a pair of integers l_i, r_i (1 ≤ l_i < r_i ≤ n). For each query, he has to determine whether there ...
### Prompt Please formulate a Cpp solution to the following problem: The only difference between easy and hard versions is constraints. A session has begun at Beland State University. Many students are taking exams. Polygraph Poligrafovich is going to examine a group of n students. Students will take the exam one-b...
### Prompt Develop a solution in Cpp to the problem described below: Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures). There are n members, numbered 1 through n. m pairs of members are friends. Of course,...
### Prompt Develop a solution in CPP to the problem described below: Acacius is studying strings theory. Today he came with the following problem. You are given a string s of length n consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters i...
### Prompt Your challenge is to write a Cpp solution to the following problem: Recall that a binary search tree is a rooted binary tree, whose nodes each store a key and each have at most two distinguished subtrees, left and right. The key in each node must be greater than any key stored in the left subtree, and less...
### Prompt Your challenge is to write a cpp solution to the following problem: I'm the Map, I'm the Map! I'm the MAP!!! Map In anticipation of new adventures Boots wanted to do a good deed. After discussion with the Map and Backpack, they decided to gift Dora a connected graph. After a long search, Boots chose t gr...
### Prompt Construct a Cpp code solution to the problem outlined: Masha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives on the floor x, Egor on the floor y (not on the same floor...
### Prompt Please create a solution in CPP to the following problem: The only difference between easy and hard versions is the maximum value of n. You are given a positive integer number n. You really love good numbers so you want to find the smallest good number greater than or equal to n. The positive integer is ...
### Prompt Your challenge is to write a CPP solution to the following problem: Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4. Vasya wants to split multiset ...
### Prompt Construct a Cpp code solution to the problem outlined: Create a program that outputs the surface area S of a square cone with a height of h, with a square with one side x as the base. However, assume that the line segment connecting the apex and the center of the base is orthogonal to the base. Also, x and...
### Prompt Create a solution in cpp for the following problem: Find the largest square number not exceeding N. Here, a square number is an integer that can be represented as the square of an integer. Constraints * 1 \leq N \leq 10^9 * N is an integer. Input Input is given from Standard Input in the following form...
### Prompt Your task is to create a Cpp solution to the following problem: Programmer Vasya is studying a new programming language &K*. The &K* language resembles the languages of the C family in its syntax. However, it is more powerful, which is why the rules of the actual C-like languages are unapplicable to it. To...
### Prompt Construct a CPP code solution to the problem outlined: There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coordinates) within distance bi incl...
### Prompt Please formulate a Cpp solution to the following problem: You have a password which you often type — a string s of length n. Every character of this string is one of the first m lowercase Latin letters. Since you spend a lot of time typing it, you want to buy a new keyboard. A keyboard is a permutation o...
### Prompt Develop a solution in CPP to the problem described below: Paul is at the orchestra. The string section is arranged in an r × c rectangular grid and is filled with violinists with the exception of n violists. Paul really likes violas, so he would like to take a picture including at least k of them. Paul can...
### Prompt Please provide a CPP coded solution to the problem described below: You have decided to watch the best moments of some movie. There are two buttons on your player: 1. Watch the current minute of the movie. By pressing this button, you watch the current minute of the movie and the player automatically p...
### Prompt Please create a solution in Cpp to the following problem: All Berland residents are waiting for an unprecedented tour of wizard in his Blue Helicopter over the cities of Berland! It is well-known that there are n cities in Berland, some pairs of which are connected by bidirectional roads. Each pair of cit...
### Prompt Please provide a Cpp coded solution to the problem described below: Jeff's got n cards, each card contains either digit 0, or digit 5. Jeff can choose several cards and put them in a line so that he gets some number. What is the largest possible number divisible by 90 Jeff can make from the cards he's got?...
### Prompt Please provide a Cpp coded solution to the problem described below: 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 sta...
### Prompt Please create a solution in cpp to the following problem: You can find anything whatsoever in our Galaxy! A cubical planet goes round an icosahedral star. Let us introduce a system of axes so that the edges of the cubical planet are parallel to the coordinate axes and two opposite vertices lay in the point...
### Prompt Please create a solution in CPP to the following problem: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≤ a ≤ b ≤ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21 domin...