text
stringlengths
424
69.5k
### Prompt Your challenge is to write a Cpp solution to the following problem: AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. Constraints * 1 ≀ a,b ≀ 10000 * a and b are integers. Input Input is given from Standard Input in the following format: ...
### Prompt Construct a cpp code solution to the problem outlined: There have recently been elections in the zoo. Overall there were 7 main political parties: one of them is the Little Elephant Political Party, 6 other parties have less catchy names. Political parties find their number in the ballot highly important....
### Prompt Please formulate a CPP solution to the following problem: Lengths are measures in Baden in inches and feet. To a length from centimeters it is enough to know that an inch equals three centimeters in Baden and one foot contains 12 inches. You are given a length equal to n centimeters. Your task is to conve...
### Prompt Create a solution in CPP for the following problem: <!-- Problem B --> On-Screen Keyboard You are to input a string with an OSK (on-screen keyboard). A remote control with five buttons, four arrows and an OK (Fig. B-1), is used for the OSK. Find the minimum number of button presses required to input a ...
### 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 Develop a solution in Cpp to the problem described below: In the city, there are two pastry shops. One shop was very popular because its cakes are pretty tasty. However, there was a man who is displeased at the shop. He was an owner of another shop. Although cause of his shop's unpopularity is incredibly a...
### Prompt Develop a solution in cpp to the problem described below: While Vasya finished eating his piece of pizza, the lesson has already started. For being late for the lesson, the teacher suggested Vasya to solve one interesting problem. Vasya has an array a and integer x. He should find the number of different o...
### Prompt Your challenge is to write a cpp solution to the following problem: You are a coach of a group consisting of n students. The i-th student has programming skill a_i. All students have distinct programming skills. You want to divide them into teams in such a way that: * No two students i and j such that |...
### Prompt Please provide a CPP coded solution to the problem described below: You are given an array a consisting of n integers a_1, a_2, ... , a_n. In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). F...
### Prompt Please provide a cpp coded solution to the problem described below: There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. F...
### Prompt Construct a cpp code solution to the problem outlined: 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 will ...
### Prompt Please provide a cpp coded solution to the problem described below: Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can ta...
### Prompt Create a solution in cpp for the following problem: I guess there's not much point in reminding you that Nvodsk winters aren't exactly hot. That increased the popularity of the public transport dramatically. The route of bus 62 has exactly n stops (stop 1 goes first on its way and stop n goes last). The st...
### Prompt Construct a CPP code solution to the problem outlined: There is the following puzzle popular among nuclear physicists. A reactor contains a set of n atoms of some chemical elements. We shall understand the phrase "atomic number" as the number of this atom's element in the periodic table of the chemical el...
### Prompt Please formulate a cpp solution to the following problem: You are given a string s consisting of n lowercase Latin letters. n is even. For each position i (1 ≀ i ≀ n) in string s you are required to change the letter on this position either to the previous letter in alphabetic order or to the next one (le...
### Prompt In Cpp, your task is to solve the following problem: Dreamoon is a big fan of the Codeforces contests. One day, he claimed that he will collect all the places from 1 to 54 after two more rated contests. It's amazing! Based on this, you come up with the following problem: There is a person who participat...
### Prompt Construct a cpp code solution to the problem outlined: Robot Bender decided to make Fray a birthday present. He drove n nails and numbered them from 1 to n in some order. Bender decided to make a picture using metal rods. The picture is a closed polyline, which vertices should be nails (in the given order)...
### Prompt Create a solution in CPP for the following problem: Twilight Sparkle learnt that the evil Nightmare Moon would return during the upcoming Summer Sun Celebration after one thousand years of imprisonment on the moon. She tried to warn her mentor Princess Celestia, but the princess ignored her and sent her to...
### Prompt Create a solution in CPP for the following problem: You are given a string s consisting only of characters 0 and 1. A substring [l, r] of s is a string slsl + 1sl + 2... sr, and its length equals to r - l + 1. A substring is called balanced if the number of zeroes (0) equals to the number of ones in this s...
### Prompt Please provide a cpp coded solution to the problem described below: Polycarpus has a chessboard of size n Γ— m, where k rooks are placed. Polycarpus hasn't yet invented the rules of the game he will play. However, he has already allocated q rectangular areas of special strategic importance on the board, the...
### Prompt Develop a solution in cpp to the problem described below: Serval soon said goodbye to Japari kindergarten, and began his life in Japari Primary School. In his favorite math class, the teacher taught him the following interesting definitions. A parenthesis sequence is a string, containing only characters ...
### Prompt Construct a Cpp code solution to the problem outlined: Kuro has just learned about permutations and he is really excited to create a new permutation type. He has chosen n distinct positive integers and put all of them in a set S. Now he defines a magical permutation to be: * A permutation of integers fr...
### Prompt Please provide a Cpp coded solution to the problem described below: In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are deno...
### Prompt Your task is to create a CPP solution to the following problem: The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforces. In the task he was given a set of n lines defined by the equations y = kiΒ·x + bi. It was necessary to determi...
### Prompt Your task is to create a cpp solution to the following problem: For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations. Max is a young biologist. For n days he watched a specific shark, and ...
### Prompt Develop a solution in Cpp to the problem described below: Mahmoud and Ehab play a game called the even-odd game. Ehab chooses his favorite integer n and then they take turns, starting from Mahmoud. In each player's turn, he has to choose an integer a and subtract it from n such that: * 1 ≀ a ≀ n. * I...
### Prompt Please provide a cpp coded solution to the problem described below: Let's define radix sum of number a consisting of digits a_1, … ,a_k and number b consisting of digits b_1, … ,b_k(we add leading zeroes to the shorter number to match longer length) as number s(a,b) consisting of digits (a_1+b_1)mod 10, … ...
### Prompt Please provide a cpp coded solution to the problem described below: You are given an array a of length n. You are also given a set of distinct positions p_1, p_2, ..., p_m, where 1 ≀ p_i < n. The position p_i means that you can swap elements a[p_i] and a[p_i + 1]. You can apply this operation any number o...
### Prompt Your challenge is to write a Cpp solution to the following problem: Having watched the last Harry Potter film, little Gerald also decided to practice magic. He found in his father's magical book a spell that turns any number in the sum of its digits. At the moment Gerald learned that, he came across a numb...
### Prompt Generate a cpp solution to the following problem: You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? Constraints * -40 \leq X \leq 40 * X is an i...
### Prompt In Cpp, your task is to solve the following problem: For given three integers $a, b, c$, print the minimum value and the maximum value. Constraints * $-1,000,000,000 \leq a, b, c \leq 1,000,000,000$ Input The input is given in the following format. $a \; b \; c\;$ Three integers $a, b, c$ are given...
### Prompt Develop a solution in CPP to the problem described below: The Smart Beaver from ABBYY has a long history of cooperating with the "Institute of Cytology and Genetics". Recently, the Institute staff challenged the Beaver with a new problem. The problem is as follows. There is a collection of n proteins (not...
### Prompt Create a solution in Cpp for the following problem: You are given an undirected bipartite graph without multiple edges. You should paint the edges of graph to minimal number of colours, so that no two adjacent edges have the same colour. Input The first line contains three integers a, b, m (1 ≀ a, b ≀ 10...
### Prompt Please provide a cpp coded solution to the problem described below: Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners. The valid sizes of T-shirts are either "M" or from 0 to 3 "X" followed by "S" or "L". For examp...
### Prompt Your challenge is to write a Cpp solution to the following problem: A dial lock is a kind of lock which has some dials with printed numbers. It has a special sequence of numbers, namely an unlocking sequence, to be opened. You are working at a manufacturer of dial locks. Your job is to verify that every m...
### Prompt Please formulate a Cpp solution to the following problem: You are given a tree with n vertices; its root is vertex 1. Also there is a token, initially placed in the root. You can move the token to other vertices. Let's assume current vertex of token is v, then you make any of the following two possible mov...
### Prompt Please create a solution in Cpp to the following problem: There are n cities along the road, which can be represented as a straight line. The i-th city is situated at the distance of a_i kilometers from the origin. All cities are situated in the same direction from the origin. There are m trucks travelling...
### Prompt Please formulate a Cpp solution to the following problem: Once upon a time in the Kingdom of Far Far Away lived Sam the Farmer. Sam had a cow named Dawn and he was deeply attached to her. Sam would spend the whole summer stocking hay to feed Dawn in winter. Sam scythed hay and put it into haystack. As Sam ...
### Prompt Please create a solution in cpp to the following problem: One Martian boy called Zorg wants to present a string of beads to his friend from the Earth β€” Masha. He knows that Masha likes two colours: blue and red, β€” and right in the shop where he has come, there is a variety of adornments with beads of these...
### Prompt Please create a solution in CPP to the following problem: Snuke got an integer sequence of length N from his mother, as a birthday present. The i-th (1 ≦ i ≦ N) element of the sequence is a_i. The elements are pairwise distinct. He is sorting this sequence in increasing order. With supernatural power, he c...
### Prompt In cpp, your task is to solve the following problem: The sequence is called ordered if it is non-decreasing or non-increasing. For example, sequnces [3, 1, 1, 0] and [1, 2, 3, 100] are ordered, but the sequence [1, 3, 3, 1] is not. You are given a sequence of numbers. You are to find it's shortest subseque...
### Prompt Please create a solution in Cpp to the following problem: There are n children, who study at the school β„–41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right. Ch...
### Prompt Please formulate a cpp solution to the following problem: You've got an array a, consisting of n integers: a1, a2, ..., an. Your task is to find a minimal by inclusion segment [l, r] (1 ≀ l ≀ r ≀ n) such, that among numbers al, al + 1, ..., ar there are exactly k distinct numbers. Segment [l, r] (1 ≀ l ≀ ...
### Prompt Your challenge is to write a CPP solution to the following problem: A biscuit making machine produces B biscuits at the following moments: A seconds, 2A seconds, 3A seconds and each subsequent multiple of A seconds after activation. Find the total number of biscuits produced within T + 0.5 seconds after a...
### Prompt Create a solution in CPP for the following problem: Natasha is planning an expedition to Mars for n people. One of the important tasks is to provide food for each participant. The warehouse has m daily food packages. Each package has some food type a_i. Each participant must eat exactly one food package ...
### Prompt Construct a CPP code solution to the problem outlined: Polycarpus has a hobby β€” he develops an unusual social network. His work is almost completed, and there is only one more module to implement β€” the module which determines friends. Oh yes, in this social network one won't have to add friends manually! P...
### Prompt Your task is to create a CPP solution to the following problem: Nowadays, most of the internet advertisements are not statically linked to a web page. Instead, what will be shown to the person opening a web page is determined within 100 milliseconds after the web page is opened. Usually, multiple companies...
### Prompt Construct a cpp code solution to the problem outlined: Let's denote as <image> the number of bits set ('1' bits) in the binary representation of the non-negative integer x. You are given multiple queries consisting of pairs of integers l and r. For each query, find the x, such that l ≀ x ≀ r, and <image> ...
### Prompt In cpp, your task is to solve the following problem: We, the researchers who discovered and investigated the ancient nation Iwashiro, finally discovered the temple in the center of Iwashiro. A lithograph dedicated to the god of Iwashiro was stored in the temple. On the lithograph, two strings were written,...
### Prompt Create a solution in Cpp for the following problem: problem N students from JOI High School are lined up in a row from east to west. The i-th student from the western end of the column is student i. Each student has a bib with one integer. Initially, the integer Ai is written on the number of student i. ...
### Prompt Your challenge is to write a Cpp solution to the following problem: There are n students standing in a circle in some order. The index of the i-th student is p_i. It is guaranteed that all indices of students are distinct integers from 1 to n (i. e. they form a permutation). Students want to start a round...
### 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 Please formulate a Cpp solution to the following problem: Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copyb...
### Prompt Develop a solution in CPP to the problem described below: problem Given two strings, find the longest of the strings contained in both strings and write a program that answers that length. Here, the string s included in the string t means that s appears consecutively in t. An empty string, that is, a str...
### Prompt Create a solution in Cpp for the following problem: A system of n vessels with water is given. Several pairs of vessels are connected by tubes with transfusion mechanisms. One may transfer an integer amount of liters of water between two vessels connected by such tube (tube works in both directions). There...
### Prompt Construct a Cpp code solution to the problem outlined: <image> Input The input contains two integers row, col (0 ≀ row, col ≀ 63), separated by a single space. Output Output "IN" or "OUT". Examples Input 0 0 Output OUT Input 27 0 Output IN Input 0 27 Output OUT Input 27 27 ...
### Prompt Your challenge is to write a Cpp solution to the following problem: ...Mike the TV greets you again! Tired of the monotonous furniture? Sick of gray routine? Dreaming about dizzying changes in your humble abode? We have something to offer you! This domino carpet for only $99.99 will change your life! You...
### Prompt Please create a solution in CPP to the following problem: In this problem you have to solve a simple classification task: given an image, determine whether it depicts a Fourier doodle. You are given a set of 50 images with ids 1 through 50. You are also given a text file labels.txt containing the labels ...
### Prompt Please provide a cpp coded solution to the problem described below: Now that Heidi knows that she can assign Rebel spaceships to bases (recall the easy subtask), she is asking you: how exactly to do this? Now, given positions of N spaceships and N bases on a plane, your task is to connect spaceships and ba...
### Prompt Please provide a CPP coded solution to the problem described below: You are given a set of n elements indexed from 1 to n. The weight of i-th element is wi. The weight of some subset of a given set is denoted as <image>. The weight of some partition R of a given set into k subsets is <image> (recall that a...
### Prompt Your challenge is to write a CPP solution to the following problem: Polycarpus got hold of a family tree. The found tree describes the family relations of n people, numbered from 1 to n. Every person in this tree has at most one direct ancestor. Also, each person in the tree has a name, the names are not n...
### Prompt Your challenge is to write a CPP solution to the following problem: Little Chris is having a nightmare. Even in dreams all he thinks about is math. Chris dreams about m binary strings of length n, indexed with numbers from 1 to m. The most horrifying part is that the bits of each string are ordered in eit...
### Prompt Develop a solution in cpp to the problem described below: Nuske has a grid with N rows and M columns of squares. The rows are numbered 1 through N from top to bottom, and the columns are numbered 1 through M from left to right. Each square in the grid is painted in either blue or white. If S_{i,j} is 1, th...
### Prompt Your task is to create a cpp solution to the following problem: Write a program which computes the area of a shape represented by the following three lines: $y = x^2$ $y = 0$ $x = 600$ It is clear that the area is $72000000$, if you use an integral you learn in high school. On the other hand, we can ob...
### Prompt Construct a CPP code solution to the problem outlined: Calculate the minimum number of characters you need to change in the string s, so that it contains at least k different letters, or print that it is impossible. String s consists only of lowercase Latin letters, and it is allowed to change characters ...
### Prompt Develop a solution in CPP to the problem described below: Hilbert's Hotel is a very unusual hotel since the number of rooms is infinite! In fact, there is exactly one room for every integer, including zero and negative integers. Even stranger, the hotel is currently at full capacity, meaning there is exact...
### Prompt Please provide a CPP coded solution to the problem described below: In 20XX AD, a school competition was held. The tournament has finally left only the final competition. You are one of the athletes in the competition. The competition you participate in is to compete for the time it takes to destroy all t...
### Prompt Please formulate a cpp solution to the following problem: An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may ha...
### Prompt Your challenge is to write a cpp solution to the following problem: The crowdedness of the discotheque would never stop our friends from having fun, but a bit more spaciousness won't hurt, will it? The discotheque can be seen as an infinite xy-plane, in which there are a total of n dancers. Once someone s...
### Prompt Your task is to create a CPP solution to the following problem: Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a_1, a_2, ..., a_n, respectively. His plan is to practice for exactly k days. Each day he has to solve at least one problem from his list. Polycarp...
### Prompt Your challenge is to write a CPP solution to the following problem: This is a hard version of the problem. The actual problems are different, but the easy version is almost a subtask of the hard version. Note that the constraints and the output format are different. You are given a string s consisting of ...
### Prompt Please create a solution in CPP to the following problem: Heidi is a statistician to the core, and she likes to study the evolution of marmot populations in each of V (1 ≀ V ≀ 100) villages! So it comes that every spring, when Heidi sees the first snowdrops sprout in the meadows around her barn, she impati...
### Prompt In cpp, your task is to solve the following problem: We have a tree with N vertices numbered 1 to N. The i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i. Your objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so th...
### Prompt Please create a solution in Cpp to the following problem: As a result of Pinky and Brain's mysterious experiments in the Large Hadron Collider some portals or black holes opened to the parallel dimension. And the World Evil has crept to the veil between their world and ours. Brain quickly evaluated the sit...
### Prompt Please formulate a cpp solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya and his friend Vasya pl...
### Prompt Construct a cpp code solution to the problem outlined: Due to atheistic Soviet past, Christmas wasn't officially celebrated in Russia for most of the twentieth century. As a result, the Russian traditions for Christmas and New Year mixed into one event celebrated on the New Year but including the tree, a S...
### Prompt Please provide a Cpp coded solution to the problem described below: You are given an array a_1, a_2, ..., a_n and an integer k. You are asked to divide this array into k non-empty consecutive subarrays. Every element in the array should be included in exactly one subarray. Let f(i) be the index of subarra...
### Prompt Develop a solution in cpp to the problem described below: John Doe started thinking about graphs. After some thought he decided that he wants to paint an undirected graph, containing exactly k cycles of length 3. A cycle of length 3 is an unordered group of three distinct graph vertices a, b and c, such ...
### Prompt In Cpp, your task is to solve the following problem: The Bitlandians are quite weird people. They have very peculiar customs. As is customary, Uncle J. wants to have n eggs painted for Bitruz (an ancient Bitland festival). He has asked G. and A. to do the work. The kids are excited because just as is cus...
### Prompt Construct a CPP code solution to the problem outlined: There are n people and k keys on a straight line. Every person wants to get to the office which is located on the line as well. To do that, he needs to reach some point with a key, take the key and then go to the office. Once a key is taken by somebody...
### Prompt Construct a cpp code solution to the problem outlined: Snuke has N hats. The i-th hat has an integer a_i written on it. There are N camels standing in a circle. Snuke will put one of his hats on each of these camels. If there exists a way to distribute the hats to the camels such that the following condi...
### Prompt Your task is to create a CPP solution to the following problem: Consider a linear function f(x) = Ax + B. Let's define g(0)(x) = x and g(n)(x) = f(g(n - 1)(x)) for n > 0. For the given integer values A, B, n and x find the value of g(n)(x) modulo 109 + 7. Input The only line contains four integers A, B, ...
### Prompt Please provide a cpp coded solution to the problem described below: There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is...
### Prompt Your task is to create a cpp solution to the following problem: We have a rectangular grid of squares with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left. On this grid, there is a piece, which is initially placed at squar...
### Prompt Construct a CPP code solution to the problem outlined: Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it. Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m w...
### Prompt Please create a solution in CPP to the following problem: Priests of the Quetzalcoatl cult want to build a tower to represent a power of their god. Tower is usually made of power-charged rocks. It is built with the help of rare magic by levitating the current top of tower and adding rocks at its bottom. If...
### Prompt Your task is to create a cpp solution to the following problem: A sweet little monster Om Nom loves candies very much. One day he found himself in a rather tricky situation that required him to think a bit in order to enjoy candies the most. Would you succeed with the same task if you were on his place? <...
### Prompt Construct a cpp code solution to the problem outlined: Let's play a game using a robot on a rectangular board covered with a square mesh (Figure D-1). The robot is initially set at the start square in the northwest corner facing the east direction. The goal of this game is to lead the robot to the goal squ...
### Prompt Your task is to create a CPP solution to the following problem: It seems like the year of 2013 came only yesterday. Do you know a curious fact? The year of 2013 is the first year after the old 1987 with only distinct digits. Now you are suggested to solve the following problem: given a year number, find t...
### Prompt Your task is to create a CPP solution to the following problem: Valera has 2Β·n cubes, each cube contains an integer from 10 to 99. He arbitrarily chooses n cubes and puts them in the first heap. The remaining cubes form the second heap. Valera decided to play with cubes. During the game he takes a cube f...
### Prompt In cpp, your task is to solve the following problem: Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev decided to build a house of cards. For that they've already found a hefty deck of n playing cards. Let's describe the house they want to make: 1....
### Prompt Construct a CPP code solution to the problem outlined: The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below. The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game...
### Prompt Develop a solution in CPP to the problem described below: You are a given a list of integers a_1, a_2, …, a_n and s of its segments [l_j; r_j] (where 1 ≀ l_j ≀ r_j ≀ n). You need to select exactly m segments in such a way that the k-th order statistic of the multiset of a_i, where i is contained in at lea...
### Prompt Develop a solution in CPP to the problem described below: You are given an integer n. In one move, you can either multiply n by two or divide n by 6 (if it is divisible by 6 without the remainder). Your task is to find the minimum number of moves needed to obtain 1 from n or determine if it's impossible t...
### Prompt Your task is to create a CPP solution to the following problem: Petya sometimes has to water his field. To water the field, Petya needs a tank with exactly V ml of water. Petya has got N tanks, i-th of them initially containing ai ml of water. The tanks are really large, any of them can contain any amount...
### Prompt In CPP, your task is to solve the following problem: We have an integer sequence A, whose length is N. Find the number of the non-empty contiguous subsequences of A whose sums are 0. Note that we are counting the ways to take out subsequences. That is, even if the contents of some two subsequences are the...
### Prompt Your challenge is to write a cpp solution to the following problem: Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters. The text includes only alph...
### Prompt Create a solution in Cpp for the following problem: Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one el...
### Prompt Please formulate a CPP solution to the following problem: The Tower of Hanoi is a well-known mathematical puzzle. It consists of three rods, and a number of disks of different sizes which can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending order of size on one rod, the sma...
### Prompt Your task is to create a Cpp solution to the following problem: Phoenix is playing with a new puzzle, which consists of n identical puzzle pieces. Each puzzle piece is a right isosceles triangle as shown below. <image> A puzzle piece The goal of the puzzle is to create a square using the n pieces. He is ...