text
stringlengths
424
69.5k
### Prompt Your challenge is to write a cpp solution to the following problem: You are given a positive integer k and an array a_1, a_2, …, a_n of non-negative distinct integers not smaller than k and not greater than 2^c-1. In each of the next k seconds, one element is chosen randomly equiprobably out of all n elem...
### Prompt Please provide a CPP coded solution to the problem described below: Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to weeks (a week is seven consequent days from Monday to Sunday), rows correspond to weekdays, and cells contain dates. For exam...
### Prompt Create a solution in Cpp for the following problem: Lenny had an n × m matrix of positive integers. He loved the matrix so much, because each row of the matrix was sorted in non-decreasing order. For the same reason he calls such matrices of integers lovely. One day when Lenny was at school his little bro...
### Prompt Your challenge is to write a CPP solution to the following problem: Write a program which prints small/large/equal relation of given two integers a and b. Constraints * -1000 ≤ a, b ≤ 1000 Input Two integers a and b separated by a single space are given in a line. Output For given two integers a and ...
### Prompt Generate a CPP solution to the following problem: Ringo has an undirected graph G with N vertices numbered 1,2,...,N and M edges numbered 1,2,...,M. Edge i connects Vertex a_{i} and b_{i} and has a length of w_i. Now, he is in the middle of painting these N vertices in K colors numbered 1,2,...,K. Vertex ...
### Prompt Your challenge is to write a CPP solution to the following problem: Anu has created her own function f: f(x, y) = (x | y) - y where | denotes the [bitwise OR operation](https://en.wikipedia.org/wiki/Bitwise_operation#OR). For example, f(11, 6) = (11|6) - 6 = 15 - 6 = 9. It can be proved that for any nonneg...
### Prompt Create a solution in Cpp for the following problem: Adieu l'ami. Koyomi is helping Oshino, an acquaintance of his, to take care of an open space around the abandoned Eikou Cram School building, Oshino's makeshift residence. The space is represented by a rectangular grid of n × m cells, arranged into n ro...
### Prompt Develop a solution in cpp to the problem described below: You are given N integers; the i-th of them is A_i. Find the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like. Constraints * 2 \leq N \leq 10^5 * 1 \leq A_i...
### Prompt Your task is to create a CPP solution to the following problem: This is an easier version of the next problem. In this version, q = 0. A sequence of integers is called nice if its elements are arranged in blocks like in [3, 3, 3, 4, 1, 1]. Formally, if two elements are equal, everything in between must al...
### Prompt Please create a solution in cpp to the following problem: Guy-Manuel and Thomas are going to build a polygon spaceship. You're given a strictly convex (i. e. no three points are collinear) polygon P which is defined by coordinates of its vertices. Define P(x,y) as a polygon obtained by translating P by ve...
### Prompt In cpp, your task is to solve the following problem: You are given an array a consisting of n integers (it is guaranteed that n is even, i.e. divisible by 2). All a_i does not exceed some integer k. Your task is to replace the minimum number of elements (replacement is the following operation: choose some...
### Prompt Please provide a CPP coded solution to the problem described below: Given are a positive integer N and a string S of length N consisting of lowercase English letters. Determine whether the string is a concatenation of two copies of some string. That is, determine whether there is a string T such that S = ...
### Prompt Generate a cpp solution to the following problem: In this problem you are to calculate the sum of all integers from 1 to n, but you should take all powers of two with minus in the sum. For example, for n = 4 the sum is equal to - 1 - 2 + 3 - 4 = - 4, because 1, 2 and 4 are 20, 21 and 22 respectively. Ca...
### Prompt Please provide a CPP coded solution to the problem described below: Peterson loves to learn new languages, but his favorite hobby is making new ones. Language is a set of words, and word is a sequence of lowercase Latin letters. Peterson makes new language every morning. It is difficult task to store the ...
### Prompt Generate a Cpp solution to the following problem: Given is a directed graph G with N vertices and M edges. The vertices are numbered 1 to N, and the i-th edge is directed from Vertex A_i to Vertex B_i. It is guaranteed that the graph contains no self-loops or multiple edges. Determine whether there exists...
### Prompt Develop a solution in cpp to the problem described below: You are given an integer sequence a of length N. How many permutations p of the integers 1 through N satisfy the following condition? * For each 1 ≤ i ≤ N, at least one of the following holds: p_i = a_i and p_{p_i} = a_i. Find the count modulo 1...
### Prompt Please provide a CPP coded solution to the problem described below: You are given an array of n integer numbers a0, a1, ..., an - 1. Find the distance between two closest (nearest) minimums in it. It is guaranteed that in the array a minimum occurs at least two times. Input The first line contains positi...
### Prompt Create a solution in CPP for the following problem: Create a program that inputs the vertex information of two polygons inscribed in one circle and outputs the magnitude relationship of their areas. Assume that each vertex of the X-side is numbered counterclockwise from 1 to X (the figure shows an example...
### Prompt Construct a cpp code solution to the problem outlined: We have a grid with N rows and M columns of squares. Initially, all the squares are white. There is a button attached to each row and each column. When a button attached to a row is pressed, the colors of all the squares in that row are inverted; that...
### Prompt Construct a CPP code solution to the problem outlined: BerDonalds, a well-known fast food restaurant, is going to open a cafe in Bertown. The important thing is to choose the new restaurant's location so that it would be easy to get there. The Bertown road system is represented by n junctions, connected by...
### Prompt Your challenge is to write a cpp solution to the following problem: Alice and Bob are well-known for sending messages to each other. This time you have a rooted tree with Bob standing in the root node and copies of Alice standing in each of the other vertices. The root node has number 0, the rest are numbe...
### Prompt Please create a solution in cpp to the following problem: C: Acrophobia Yayoi Takasugi is a super-selling idol. There is one thing she is not good at. It's a high place ... She is extremely afraid of heights. This time, due to the producer's inadequacy, she decided to take on the following challenges on a...
### Prompt Please create a solution in CPP to the following problem: Iahub is so happy about inventing bubble sort graphs that he's staying all day long at the office and writing permutations. Iahubina is angry that she is no more important for Iahub. When Iahub goes away, Iahubina comes to his office and sabotage hi...
### Prompt Develop a solution in Cpp to the problem described below: 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 Please provide a CPP coded solution to the problem described below: Generalized leap year Normally, whether or not the year x is a leap year is defined as follows. 1. If x is a multiple of 400, it is a leap year. 2. Otherwise, if x is a multiple of 100, it is not a leap year. 3. Otherwise, if x is a mult...
### Prompt Please create a solution in Cpp to the following problem: N contestants participated in a competition. The total of N-1 matches were played in a knockout tournament. For some reasons, the tournament may not be "fair" for all the contestants. That is, the number of the matches that must be played in order t...
### Prompt Please provide a Cpp coded solution to the problem described below: 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 a...
### Prompt Please provide a cpp coded solution to the problem described below: Joisino is working as a receptionist at a theater. The theater has 100000 seats, numbered from 1 to 100000. According to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive seats from Seat l_i to...
### Prompt Create a solution in cpp for the following problem: You are given a rectangle grid. That grid's size is n × m. Let's denote the coordinate system on the grid. So, each point on the grid will have coordinates — a pair of integers (x, y) (0 ≤ x ≤ n, 0 ≤ y ≤ m). Your task is to find a maximum sub-rectangle o...
### Prompt Your task is to create a cpp solution to the following problem: Flatland is inhabited by pixels of three colors: red, green and blue. We know that if two pixels of different colors meet in a violent fight, only one of them survives the fight (that is, the total number of pixels decreases by one). Besides, ...
### Prompt Your task is to create a Cpp solution to the following problem: An bydrocarbon is an organic compound which contains only carbons and hydrogens. An isomer is a compound that has the same number of carbons but different structures. Heptane, for example, is a hydrocarbon with 7 carbons. It has nine isomers. ...
### Prompt Your challenge is to write a CPP solution to the following problem: In the official contest this problem has a different statement, for which jury's solution was working incorrectly, and for this reason it was excluded from the contest. This mistake have been fixed and the current given problem statement a...
### Prompt Construct a CPP code solution to the problem outlined: There are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs. Takahashi says: "there are X animals in total in the garden, and they have Y legs in total." Determine whether there is a combination of numbers of c...
### Prompt Generate a cpp solution to the following problem: Koto Municipal Subway Koto Municipal Subway Koto City is a famous city whose roads are in a grid pattern, as shown in the figure below. The roads extending from north to south and the roads extending from east to west are lined up at intervals of 1 km eac...
### Prompt Please formulate a Cpp solution to the following problem: You are given an infinite periodic array a0, a1, ..., an - 1, ... with the period of length n. Formally, <image>. A periodic subarray (l, s) (0 ≤ l < n, 1 ≤ s < n) of array a is an infinite periodic array with a period of length s that is a subsegme...
### Prompt Your challenge is to write a cpp solution to the following problem: You are given an array a consisting of n positive integers. Initially, you have an integer x = 0. During one move, you can do one of the following two operations: 1. Choose exactly one i from 1 to n and increase a_i by x (a_i := a_i + ...
### Prompt Create a solution in Cpp for the following problem: Rick and his co-workers have made a new radioactive formula and a lot of bad guys are after them. So Rick wants to give his legacy to Morty before bad guys catch them. There are n planets in their universe numbered from 1 to n. Rick is in planet number ...
### Prompt Your task is to create a cpp solution to the following problem: There was a large mansion surrounded by high walls. The owner of the mansion loved cats so much that he always prepared delicious food for the occasional cats. The hungry cats jumped over the high walls and rushed straight to the rice that was...
### Prompt Your task is to create a cpp solution to the following problem: AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blu...
### Prompt Develop a solution in CPP to the problem described below: Xenia the beginner mathematician is a third year student at elementary school. She is now learning the addition operation. The teacher has written down the sum of multiple numbers. Pupils should calculate the sum. To make the calculation easier, th...
### Prompt Your task is to create a Cpp solution to the following problem: Imp is really pleased that you helped him. But it you solve the last problem, his gladness would raise even more. <image> Let's define <image> for some set of integers <image> as the number of pairs a, b in <image>, such that: * a is stric...
### Prompt Please provide a cpp coded solution to the problem described below: Snuke arranged N colorful balls in a row. The i-th ball from the left has color c_i and weight w_i. He can rearrange the balls by performing the following two operations any number of times, in any order: * Operation 1: Select two balls ...
### Prompt Develop a solution in Cpp to the problem described below: Oleg Petrov loves crossword puzzles and every Thursday he buys his favorite magazine with crosswords and other word puzzles. In the last magazine Oleg found a curious puzzle, and the magazine promised a valuable prize for it's solution. We give a fo...
### Prompt Your task is to create a CPP solution to the following problem: Motorist Kojiro spent 10 years saving up for his favorite car brand, Furrari. Finally Kojiro's dream came true! Kojiro now wants to get to his girlfriend Johanna to show off his car to her. Kojiro wants to get to his girlfriend, so he will go...
### Prompt Create a solution in CPP for the following problem: Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the efficiency of the SMSC. For that, he asked to give him the stat...
### Prompt Please create a solution in cpp to the following problem: Sergey just turned five years old! When he was one year old, his parents gave him a number; when he was two years old, his parents gave him an array of integers. On his third birthday he received a string. When he was four, his mother woke him up in...
### Prompt Please provide a cpp coded solution to the problem described below: Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days are alternating in i...
### Prompt Please provide a CPP coded solution to the problem described below: Welcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market! In the morning, there are n opportunities to buy share...
### Prompt Generate a Cpp solution to the following problem: Recently an official statement of the world Olympic Committee said that the Olympic Winter Games 2030 will be held in Tomsk. The city officials decided to prepare for the Olympics thoroughly and to build all the necessary Olympic facilities as early as poss...
### Prompt Construct a CPP code solution to the problem outlined: Numbers 1, 2, 3, ... n (each integer from 1 to n once) are written on a board. In one operation you can erase any two numbers a and b from the board and write one integer (a + b)/(2) rounded up instead. You should perform the given operation n - 1 tim...
### Prompt In Cpp, your task is to solve the following problem: I decided to create a program that displays a "round and round pattern". The "round and round pattern" is as follows. * If the length of one side is n, it is displayed as a character string with n rows and n columns. * A spiral pattern that rotates cloc...
### Prompt Develop a solution in CPP to the problem described below: You are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x have been successful. Thus, your current success rate on Codeforces is equal to x / y. Your favorite rat...
### Prompt Your challenge is to write a Cpp solution to the following problem: Codeforces user' handle color depends on his rating — it is red if his rating is greater or equal to 2400; it is orange if his rating is less than 2400 but greater or equal to 2200, etc. Each time participant takes part in a rated contest,...
### Prompt Your task is to create a Cpp solution to the following problem: Ashish has a tree consisting of n nodes numbered 1 to n rooted at node 1. The i-th node in the tree has a cost a_i, and binary digit b_i is written in it. He wants to have binary digit c_i written in the i-th node in the end. To achieve this,...
### Prompt Develop a solution in cpp 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 only if there...
### Prompt Create a solution in Cpp for the following problem: You are given a colored permutation p_1, p_2, ..., p_n. The i-th element of the permutation has color c_i. Let's define an infinite path as infinite sequence i, p[i], p[p[i]], p[p[p[i]]] ... where all elements have same color (c[i] = c[p[i]] = c[p[p[i]]]...
### Prompt Please formulate a Cpp solution to the following problem: Vasya has n burles. One bottle of Ber-Cola costs a burles and one Bars bar costs b burles. He can buy any non-negative integer number of bottles of Ber-Cola and any non-negative integer number of Bars bars. Find out if it's possible to buy some amo...
### Prompt Develop a solution in Cpp to the problem described below: In some other world, today is the day before Christmas Eve. Mr. Takaha is buying N items at a department store. The regular price of the i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan). He has a discount coupon, and can buy one item...
### Prompt Please create a solution in CPP to the following problem: You are given a connected undirected graph consisting of n vertices and m edges. There are no self-loops or multiple edges in the given graph. You have to direct its edges in such a way that the obtained directed graph does not contain any paths of...
### Prompt In Cpp, your task is to solve the following problem: In the last war of PMP, he defeated all his opponents and advanced to the final round. But after the end of semi-final round evil attacked him from behind and killed him! God bless him. Before his death, PMP signed a contract with the bus rapid transit...
### Prompt Construct a cpp code solution to the problem outlined: Lenny is playing a game on a 3 × 3 grid of lights. In the beginning of the game all lights are switched on. Pressing any of the lights will toggle it and all side-adjacent lights. The goal of the game is to switch all the lights off. We consider the to...
### Prompt Please provide a cpp coded solution to the problem described below: Assume that sk(n) equals the sum of digits of number n in the k-based notation. For example, s2(5) = s2(1012) = 1 + 0 + 1 = 2, s3(14) = s3(1123) = 1 + 1 + 2 = 4. The sequence of integers a0, ..., an - 1 is defined as <image>. Your task is...
### Prompt Please provide a CPP coded solution to the problem described below: Snuke is having another barbeque party. This time, he will make one serving of Skewer Meal. He has a stock of N Skewer Meal Packs. The i-th Skewer Meal Pack contains one skewer, A_i pieces of beef and B_i pieces of green pepper. All skew...
### Prompt Generate a cpp solution to the following problem: You are given an undirected graph with N vertices and M edges. Here, N-1≤M≤N holds and the graph is connected. There are no self-loops or multiple edges in this graph. The vertices are numbered 1 through N, and the edges are numbered 1 through M. Edge i co...
### Prompt Generate a CPP solution to the following problem: We have a 3 \times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left. According to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose v...
### Prompt Create a solution in cpp for the following problem: problem JOI decided to make a signboard for the store. There are N old signboards with letters written at equal intervals. JOI makes a sign by erasing some letters from the old sign. I want the remaining characters to be the name of the store, and the r...
### Prompt Please formulate a CPP solution to the following problem: Rick and Morty want to find MR. PBH and they can't do it alone. So they need of Mr. Meeseeks. They Have generated n Mr. Meeseeks, standing in a line numbered from 1 to n. Each of them has his own color. i-th Mr. Meeseeks' color is ai. Rick and Mor...
### Prompt Construct a CPP code solution to the problem outlined: ZS the Coder and Chris the Baboon has arrived at Udayland! They walked in the park where n trees grow. They decided to be naughty and color the trees in the park. The trees are numbered with integers from 1 to n from left to right. Initially, tree i h...
### Prompt Construct a CPP code solution to the problem outlined: You have a pot and N ingredients. Each ingredient has a real number parameter called value, and the value of the i-th ingredient (1 \leq i \leq N) is v_i. When you put two ingredients in the pot, they will vanish and result in the formation of a new i...
### Prompt Develop a solution in CPP to the problem described below: Connected undirected weighted graph without self-loops and multiple edges is given. Graph contains n vertices and m edges. For each edge (u, v) find the minimal possible weight of the spanning tree that contains the edge (u, v). The weight of the ...
### Prompt Develop a solution in Cpp to the problem described below: You are given an integer N. Determine if there exists a tuple of subsets of \\{1,2,...N\\}, (S_1,S_2,...,S_k), that satisfies the following conditions: * Each of the integers 1,2,...,N is contained in exactly two of the sets S_1,S_2,...,S_k. * Any ...
### Prompt In Cpp, your task is to solve the following problem: You have an array of positive integers a[1], a[2], ..., a[n] and a set of bad prime numbers b1, b2, ..., bm. The prime numbers that do not occur in the set b are considered good. The beauty of array a is the sum <image>, where function f(s) is determined...
### Prompt Create a solution in cpp for 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 popular. Weather ...
### Prompt Create a solution in cpp for the following problem: The famous joke programming language HQ9+ has only 4 commands. In this problem we will explore its subset — a language called HQ... Input The only line of the input is a string between 1 and 106 characters long. Output Output "Yes" or "No". Examples ...
### Prompt Please formulate a cpp solution to the following problem: Mashmokh works in a factory. At the end of each day he must turn off all of the lights. The lights on the factory are indexed from 1 to n. There are n buttons in Mashmokh's room indexed from 1 to n as well. If Mashmokh pushes button with index i, ...
### Prompt Generate a Cpp solution to the following problem: Misha and Vasya participated in a Codeforces contest. Unfortunately, each of them solved only one problem, though successfully submitted it at the first attempt. Misha solved the problem that costs a points and Vasya solved the problem that costs b points. ...
### Prompt Develop a solution in CPP to the problem described below: A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer y and the participants guess it by asking questions to the host. There ...
### Prompt Your challenge is to write a CPP solution to the following problem: Fox Ciel starts to learn programming. The first task is drawing a fox! However, that turns out to be too hard for a beginner, so she decides to draw a snake instead. A snake is a pattern on a n by m table. Denote c-th cell of r-th row as ...
### Prompt Generate a cpp solution to the following problem: k people want to split n candies between them. Each candy should be given to exactly one of them or be thrown away. The people are numbered from 1 to k, and Arkady is the first of them. To split the candies, Arkady will choose an integer x and then give th...
### Prompt Please create a solution in Cpp to the following problem: Vasya likes everything infinite. Now he is studying the properties of a sequence s, such that its first element is equal to a (s1 = a), and the difference between any two neighbouring elements is equal to c (si - si - 1 = c). In particular, Vasya wo...
### Prompt Create a solution in CPP for the following problem: A graph is called planar, if it can be drawn in such a way that its edges intersect only at their vertexes. An articulation point is such a vertex of an undirected graph, that when removed increases the number of connected components of the graph. A bri...
### Prompt Please formulate a cpp solution to the following problem: You are given an n × m table, consisting of characters «A», «G», «C», «T». Let's call a table nice, if every 2 × 2 square contains all four distinct characters. Your task is to find a nice table (also consisting of «A», «G», «C», «T»), that differs ...
### Prompt In CPP, your task is to solve the following problem: Recently Ivan noticed an array a while debugging his code. Now Ivan can't remember this array, but the bug he was trying to fix didn't go away, so Ivan thinks that the data from this array might help him to reproduce the bug. Ivan clearly remembers that...
### Prompt Construct a Cpp code solution to the problem outlined: The best programmers of Embezzland compete to develop a part of the project called "e-Government" — the system of automated statistic collecting and press analysis. We know that any of the k citizens can become a member of the Embezzland government. T...
### Prompt In cpp, your task is to solve the following problem: Space Coconut Crab Space coconut crab English text is not available in this practice contest. Ken Marine Blue is a space hunter who travels through the entire galaxy in search of space coconut crabs. The space coconut crab is the largest crustacean in...
### Prompt Create a solution in Cpp for the following problem: The only difference between the easy and the hard versions is constraints. A subsequence is a string that can be derived from another string by deleting some or no symbols without changing the order of the remaining symbols. Characters to be deleted are ...
### Prompt Please create a solution in CPP to the following problem: <image> Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting. The game consists of multiple rounds. Its rules are very simple: in each round, a natural number k is chosen. Then, the one who says (or bar...
### Prompt Please provide a cpp coded solution to the problem described below: As the first step in algebra, students learn quadratic formulas and their factorization. Often, the factorization is a severe burden for them. A large number of students cannot master the factorization; such students cannot be aware of the...
### Prompt Your task is to create a Cpp solution to the following problem: Alice wants to send an important message to Bob. Message a = (a1, ..., an) is a sequence of positive integers (characters). To compress the message Alice wants to use binary Huffman coding. We recall that binary Huffman code, or binary prefix...
### Prompt In CPP, your task is to solve the following problem: Numbers k-bonacci (k is integer, k > 1) are a generalization of Fibonacci numbers and are determined as follows: * F(k, n) = 0, for integer n, 1 ≤ n < k; * F(k, k) = 1; * F(k, n) = F(k, n - 1) + F(k, n - 2) + ... + F(k, n - k), for integer n, n ...
### Prompt Please provide a cpp coded solution to the problem described below: You are given an undirected graph with n vertices and m edges. Also, you are given an integer k. Find either a clique of size k or a non-empty subset of vertices such that each vertex of this subset has at least k neighbors in the subset....
### Prompt Your task is to create a CPP solution to the following problem: Joisino is about to compete in the final round of a certain programming competition. In this contest, there are N problems, numbered 1 through N. Joisino knows that it takes her T_i seconds to solve problem i(1≦i≦N). In this contest, a contes...
### Prompt Generate a cpp solution to the following problem: Transformation Write a program which performs a sequence of commands to a given string $str$. The command is one of: * print a b: print from the a-th character to the b-th character of $str$ * reverse a b: reverse from the a-th character to the b-th ch...
### Prompt Please formulate a CPP solution to the following problem: A social network for dogs called DH (DogHouse) has k special servers to recompress uploaded videos of cute cats. After each video is uploaded, it should be recompressed on one (any) of the servers, and only after that it can be saved in the social n...
### Prompt Please create a solution in CPP to the following problem: A boy named Ayrat lives on planet AMI-1511. Each inhabitant of this planet has a talent. Specifically, Ayrat loves running, moreover, just running is not enough for him. He is dreaming of making running a real art. First, he wants to construct the ...
### Prompt Your task is to create a CPP solution to the following problem: Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation 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 number al...
### Prompt Create a solution in CPP for the following problem: You are given n chips on a number line. The i-th chip is placed at the integer coordinate x_i. Some chips can have equal coordinates. You can perform each of the two following types of moves any (possibly, zero) number of times on any chip: * Move the...
### Prompt Please formulate a CPP solution to the following problem: Johnny drives a truck and must deliver a package from his hometown to the district center. His hometown is located at point 0 on a number line, and the district center is located at the point d. Johnny's truck has a gas tank that holds exactly n li...
### Prompt Your task is to create a CPP solution to the following problem: Write a program which judges wheather given length of three side form a right triangle. Print "YES" if the given sides (integers) form a right triangle, "NO" if not so. Constraints * 1 ≤ length of the side ≤ 1,000 * N ≤ 1,000 Input Input c...
### Prompt Construct a cpp code solution to the problem outlined: You are given a sequence a_1, a_2, …, a_n of non-negative integers. You need to find the largest number m of triples (i_1, j_1, k_1), (i_2, j_2, k_2), ..., (i_m, j_m, k_m) such that: * 1 ≤ i_p < j_p < k_p ≤ n for each p in 1, 2, …, m; * a_{i_p} =...