text
stringlengths
424
69.5k
### Prompt Please provide a cpp coded solution to the problem described below: You are given a grid with n rows and m columns, where each cell has a non-negative integer written on it. We say the grid is good if for each cell the following condition holds: if it has a number k > 0 written on it, then exactly k of its...
### Prompt Construct a CPP code solution to the problem outlined: When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the...
### Prompt Generate a Cpp solution to the following problem: Recently Anton found a box with digits in his room. There are k2 digits 2, k3 digits 3, k5 digits 5 and k6 digits 6. Anton's favorite integers are 32 and 256. He decided to compose this integers from digits he has. He wants to make the sum of these integer...
### Prompt Your task is to create a CPP solution to the following problem: Revised The current era, Heisei, will end on April 30, 2019, and a new era will begin the next day. The day after the last day of Heisei will be May 1, the first year of the new era. In the system developed by the ACM-ICPC OB / OG Associatio...
### Prompt Please provide a CPP coded solution to the problem described below: Takahashi went to an all-you-can-eat buffet with N kinds of dishes and ate all of them (Dish 1, Dish 2, \ldots, Dish N) once. The i-th dish (1 \leq i \leq N) he ate was Dish A_i. When he eats Dish i (1 \leq i \leq N), he gains B_i satisf...
### Prompt Please provide a CPP coded solution to the problem described below: I am a pipe tie craftsman. As long as you get the joints and pipes that connect the pipes, you can connect any pipe. Every day, my master gives me pipes and joints, which I connect and give to my master. But if you have too many pipes, you...
### Prompt Construct a Cpp code solution to the problem outlined: You have 4 bags A, B, C and D each of which includes N coins (there are totally 4N coins). Values of the coins in each bag are ai, bi, ci and di respectively. Find the number of combinations that result when you choose one coin from each bag (totally ...
### Prompt Create a solution in Cpp for the following problem: Edo has got a collection of n refrigerator magnets! He decided to buy a refrigerator and hang the magnets on the door. The shop can make the refrigerator with any size of the door that meets the following restrictions: the refrigerator door must be recta...
### Prompt Please provide a Cpp coded solution to the problem described below: Kolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle. More formally, there are 3n gnomes sitting in a circle. Each gnome can ...
### Prompt Construct a cpp code solution to the problem outlined: One company of IT City decided to create a group of innovative developments consisting from 5 to 7 people and hire new employees for it. After placing an advertisment the company received n resumes. Now the HR department has to evaluate each possible g...
### Prompt Your challenge is to write a Cpp solution to the following problem: You work as a system administrator in a dormitory, which has n rooms one after another along a straight hallway. Rooms are numbered from 1 to n. You have to connect all n rooms to the Internet. You can connect each room to the Internet d...
### Prompt Please formulate a cpp solution to the following problem: You have a new professor of graph theory and he speaks very quickly. You come up with the following plan to keep up with his lecture and make notes. You know two languages, and the professor is giving the lecture in the first one. The words in both...
### Prompt Please provide a Cpp coded solution to the problem described below: There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake...
### Prompt Please provide a cpp coded solution to the problem described below: Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi). They need to arrange a plan, but...
### Prompt Develop a solution in Cpp to the problem described below: problem JOI Pizza sells pizza home delivery along the d-meter-long ring road that runs through the city center. JOI Pizza has n stores S1, ..., Sn on the loop line. The head office is S1. The distance from S1 to Si when moving the loop line clockw...
### Prompt Construct a CPP code solution to the problem outlined: The developers of Looksery have to write an efficient algorithm that detects faces on a picture. Unfortunately, they are currently busy preparing a contest for you, so you will have to do it for them. In this problem an image is a rectangular table t...
### Prompt Please create a solution in Cpp to the following problem: Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card. Vasya is watc...
### Prompt Your task is to create a cpp solution to the following problem: Little Artyom decided to study probability theory. He found a book with a lot of nice exercises and now wants you to help him with one of them. Consider two dices. When thrown each dice shows some integer from 1 to n inclusive. For each dice ...
### Prompt Please create a solution in Cpp to the following problem: problem You are in charge of quality control at a machine manufacturing plant. This machine requires a power supply, a motor, and a cable as parts. The manufacturing plant has a power supply, b motors, and c cables, numbered from 1 to a, a + 1 to a...
### Prompt Please create a solution in cpp to the following problem: Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him. The area looks like a strip of cells 1 Γ— n. Each cell contains the direction for the next jump and the length of that jump. Grasshopper starts in t...
### Prompt Create a solution in cpp for the following problem: Kuroni is very angry at the other setters for using him as a theme! As a punishment, he forced them to solve the following problem: You have an array a consisting of n positive integers. An operation consists of choosing an element and either adding 1 to...
### Prompt Please formulate a cpp solution to the following problem: This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to flush the output. If yo...
### Prompt Please provide a Cpp coded solution to the problem described below: There is a chain consisting of multiple circles on a plane. The first (last) circle of the chain only intersects with the next (previous) circle, and each intermediate circle intersects only with the two neighboring circles. Your task is ...
### Prompt Your challenge is to write a cpp solution to the following problem: On the Berland Dependence Day it was decided to organize a great marathon. Berland consists of n cities, some of which are linked by two-way roads. Each road has a certain length. The cities are numbered from 1 to n. It is known that one c...
### Prompt Please formulate a CPP solution to the following problem: Write a program which calculates the area and circumference of a circle for given radius r. Constraints * 0 < r < 10000 Input A real number r is given. Output Print the area and circumference of the circle in a line. Put a single space between...
### Prompt Develop a solution in Cpp to the problem described below: N people are waiting in a single line in front of the Takahashi Store. The cash on hand of the i-th person from the front of the line is a positive integer A_i. Mr. Takahashi, the shop owner, has decided on the following scheme: He picks a product,...
### Prompt Please provide a cpp coded solution to the problem described below: Petya has n integers: 1, 2, 3, ..., n. He wants to split these integers in two non-empty groups in such a way that the absolute difference of sums of integers in each group is as small as possible. Help Petya to split the integers. Each ...
### Prompt Create a solution in Cpp for 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 allowed to r...
### Prompt In CPP, your task is to solve the following problem: You are given a permutation of integers from 1 to n. Exactly once you apply the following operation to this permutation: pick a random segment and shuffle its elements. Formally: 1. Pick a random segment (continuous subsequence) from l to r. All <imag...
### Prompt Please formulate a Cpp solution to the following problem: The Little Elephant loves strings very much. He has an array a from n strings, consisting of lowercase English letters. Let's number the elements of the array from 1 to n, then let's denote the element number i as ai. For each string ai (1 ≀ i ≀ n...
### Prompt Construct a cpp code solution to the problem outlined: Vus the Cossack has a simple graph with n vertices and m edges. Let d_i be a degree of the i-th vertex. Recall that a degree of the i-th vertex is the number of conected edges to the i-th vertex. He needs to remain not more than ⌈ (n+m)/(2) βŒ‰ edges. L...
### Prompt Please create a solution in CPP to the following problem: You are given an array a consisting of n integers. You can perform the following operations with it: 1. Choose some positions i and j (1 ≀ i, j ≀ n, i β‰  j), write the value of a_i β‹… a_j into the j-th cell and remove the number from the i-th cell...
### Prompt In Cpp, your task is to solve the following problem: You are going to work in Codeforces as an intern in a team of n engineers, numbered 1 through n. You want to give each engineer a souvenir: a T-shirt from your country (T-shirts are highly desirable in Codeforces). Unfortunately you don't know the size o...
### Prompt Please provide a cpp coded solution to the problem described below: You have a statistic of price changes for one product represented as an array of n positive integers p_0, p_1, ..., p_{n - 1}, where p_0 is the initial price of the product and p_i is how the price was increased during the i-th month. Usi...
### Prompt In CPP, your task is to solve the following problem: Sigma and Sugim are playing a game. The game is played on a graph with N vertices numbered 1 through N. The graph has N-1 red edges and N-1 blue edges, and the N-1 edges in each color forms a tree. The red edges are represented by pairs of integers (a_i...
### Prompt Your challenge is to write a CPP solution to the following problem: Ichihime is the current priestess of the Mahjong Soul Temple. She claims to be human, despite her cat ears. These days the temple is holding a math contest. Usually, Ichihime lacks interest in these things, but this time the prize for the...
### Prompt Develop a solution in Cpp to the problem described below: This morning Tolik has understood that while he was sleeping he had invented an incredible problem which will be a perfect fit for Codeforces! But, as a "Discuss tasks" project hasn't been born yet (in English, well), he decides to test a problem an...
### Prompt Please provide a cpp coded solution to the problem described below: Example Input 2 3 1 3 1 0 Output 2 ### Response ```cpp #include <bits/stdc++.h> #define ll long long #define INF 1000000005 #define MOD 1000000007 #define EPS 1e-10 #define rep(i,n) for(int i=0;i<(int)(n);++i) #define rrep(i,n) for(...
### Prompt Generate a cpp solution to the following problem: The Olympic Games in Bercouver are in full swing now. Here everyone has their own objectives: sportsmen compete for medals, and sport commentators compete for more convenient positions to give a running commentary. Today the main sport events take place at ...
### Prompt Your task is to create a CPP solution to the following problem: Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset. Artem wants to create a basic mult...
### Prompt In cpp, your task is to solve the following problem: Goldbach's Conjecture: For any even number n greater than or equal to 4, there exists at least one pair of prime numbers p1 and p2 such that n = p1 + p2. This conjecture has not been proved nor refused yet. No one is sure whether this conjecture actuall...
### Prompt Create a solution in CPP for the following problem: Find the edit distance between given two words s1 and s2. The disntace is the minimum number of single-character edits required to change one word into the other. The edits including the following operations: * insertion: Insert a character at a particu...
### Prompt Please create a solution in Cpp to the following problem: You are given an array a of n integers. You want to make all elements of a equal to zero by doing the following operation exactly three times: * Select a segment, for each number in this segment we can add a multiple of len to it, where len is t...
### Prompt Your challenge is to write a cpp solution to the following problem: In one very old text file there was written Great Wisdom. This Wisdom was so Great that nobody could decipher it, even Phong β€” the oldest among the inhabitants of Mainframe. But still he managed to get some information from there. For exam...
### Prompt Your challenge is to write a Cpp solution to the following problem: Arkady decides to observe a river for n consecutive days. The river's water level on each day is equal to some real value. Arkady goes to the riverside each day and makes a mark on the side of the channel at the height of the water level,...
### Prompt Please provide a Cpp coded solution to the problem described below: Dreamoon saw a large integer x written on the ground and wants to print its binary form out. Dreamoon has accomplished the part of turning x into its binary format. Now he is going to print it in the following manner. He has an integer n ...
### Prompt Your task is to create a cpp solution to the following problem: Takahashi has K 500-yen coins. (Yen is the currency of Japan.) If these coins add up to X yen or more, print `Yes`; otherwise, print `No`. Constraints * 1 \leq K \leq 100 * 1 \leq X \leq 10^5 Input Input is given from Standard Input in the...
### Prompt Generate a cpp solution to the following problem: The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which characterizes t...
### Prompt Please provide a CPP coded solution to the problem described below: I conducted an exit poll of the shopping amount at a department store. Create a program that takes the shopping amount data as input, calculates the average shopping amount per person, and outputs it. The number of people surveyed shall be...
### Prompt Please provide a cpp coded solution to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
### Prompt Generate a Cpp solution to the following problem: Given are two strings s and t consisting of lowercase English letters. Determine if the number of non-negative integers i satisfying the following condition is finite, and find the maximum value of such i if the number is finite. * There exists a non-negat...
### Prompt Your challenge is to write a Cpp solution to the following problem: The Committee for Research on Binary Viruses discovered a method of replication for a large family of viruses whose genetic codes are sequences of zeros and ones. Each virus originates from a single gene; for simplicity genes are denoted b...
### Prompt Create a solution in Cpp for the following problem: You are organizing a boxing tournament, where n boxers will participate (n is a power of 2), and your friend is one of them. All boxers have different strength from 1 to n, and boxer i wins in the match against boxer j if and only if i is stronger than j....
### Prompt In cpp, your task is to solve the following problem: In Takahashi Kingdom, which once existed, there are N cities, and some pairs of cities are connected bidirectionally by roads. The following are known about the road network: * People traveled between cities only through roads. It was possible to reach ...
### Prompt Create a solution in Cpp for the following problem: Gerda is travelling to the palace of the Snow Queen. The road network consists of n intersections and m bidirectional roads. Roads are numbered from 1 to m. Snow Queen put a powerful spell on the roads to change the weather conditions there. Now, if Gerd...
### Prompt Generate a cpp solution to the following problem: You are given an undirected graph where each edge has one of two colors: black or red. Your task is to assign a real number to each node so that: * for each black edge the sum of values at its endpoints is 1; * for each red edge the sum of values at...
### Prompt In cpp, your task is to solve the following problem: Once again Tavas started eating coffee mix without water! Keione told him that it smells awful, but he didn't stop doing that. That's why Keione told his smart friend, SaDDas to punish him! SaDDas took Tavas' headphones and told him: "If you solve the fo...
### Prompt Please provide a Cpp coded solution to the problem described below: The problem uses a simplified TCP/IP address model, please make sure you've read the statement attentively. Polycarpus has found a job, he is a system administrator. One day he came across n IP addresses. Each IP address is a 32 bit numbe...
### Prompt Please create a solution in CPP to the following problem: Once upon a time a little frog whose name was Vasya decided to travel around his home swamp. Overall there are n mounds on the swamp, located on one line. The distance between the neighboring mounds is one meter. Vasya wants to visit all the mounds ...
### Prompt In cpp, your task is to solve the following problem: Unknown pathogen Dr. Hideyo discovered an unknown pathogen. This pathogen has a chain structure in which two types of bacteria called Akdamakin and Zendamakin are linked in a straight line. We want to detoxify this pathogen for humankind. It is known t...
### Prompt Your task is to create a CPP solution to the following problem: From tomorrow, the long-awaited summer vacation will begin. So I decided to invite my friends to go out to the sea. However, many of my friends are shy. They would hate it if they knew that too many people would come with them. Besides, many...
### Prompt Please create a solution in Cpp to the following problem: The only difference between easy and hard versions is the length of the string. You are given a string s and a string t, both consisting only of lowercase Latin letters. It is guaranteed that t can be obtained from s by removing some (possibly, zer...
### Prompt Develop a solution in Cpp to the problem described below: J: City Santa decides to deliver a present to a city. The city has a rectangular shape divided into north-south $ H $ parcels x east-west $ W $ parcels, with one house delivering gifts to each parcel. The $ X $ th section from the north and the $...
### Prompt Construct a cpp code solution to the problem outlined: Good job! Now that Heidi is able to distinguish between Poisson and uniform distributions, she is in a good position to actually estimate the populations. Can you help Heidi estimate each village's population? Input Same as the easy version. Output...
### Prompt Construct a CPP code solution to the problem outlined: Furik loves writing all sorts of problems, especially such that he can't solve himself. You've got one of his problems, the one Furik gave to Rubik. And Rubik asks you to solve it. There is integer n and array a, consisting of ten integers, indexed by...
### Prompt Your task is to create a cpp solution to the following problem: Sean is trying to save a large file to a USB flash drive. He has n USB flash drives with capacities equal to a1, a2, ..., an megabytes. The file size is equal to m megabytes. Find the minimum number of USB flash drives needed to write Sean's...
### Prompt Develop a solution in cpp to the problem described below: You are given $n$ integers $w_i (i = 0, 1, ..., n-1)$ to be sorted in ascending order. You can swap two integers $w_i$ and $w_j$. Each swap operation has a cost, which is the sum of the two integers $w_i + w_j$. You can perform the operations any nu...
### Prompt Develop a solution in Cpp to the problem described below: Iahub is playing an uncommon game. Initially, he has n boxes, numbered 1, 2, 3, ..., n. Each box has some number of candies in it, described by a sequence a1, a2, ..., an. The number ak represents the number of candies in box k. The goal of the ga...
### Prompt Your task is to create a cpp solution to the following problem: 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 stands ...
### Prompt Your challenge is to write a CPP solution to the following problem: Polycarp is currently developing a project in Vaja language and using a popular dependency management system called Vamen. From Vamen's point of view both Vaja project and libraries are treated projects for simplicity. A project in Vaja h...
### Prompt Construct a CPP code solution to the problem outlined: Cthulhu decided to catch Scaygerboss. Scaygerboss found it out and is trying to hide in a pack of his scaygers. Each scayger except Scaygerboss is either a male or a female. Scaygerboss's gender is "other". Scaygers are scattered on a two-dimensional ...
### Prompt Your task is to create a Cpp solution to the following problem: Denis was very sad after Nastya rejected him. So he decided to walk through the gateways to have some fun. And luck smiled at him! When he entered the first courtyard, he met a strange man who was selling something. Denis bought a mysterious...
### Prompt Please create a solution in CPP to the following problem: In Finite Encyclopedia of Integer Sequences (FEIS), all integer sequences of lengths between 1 and N (inclusive) consisting of integers between 1 and K (inclusive) are listed. Let the total number of sequences listed in FEIS be X. Among those seque...
### Prompt Construct a Cpp code solution to the problem outlined: Given are N points (x_i, y_i) in a two-dimensional plane. Find the minimum radius of a circle such that all the points are inside or on it. Constraints * 2 \leq N \leq 50 * 0 \leq x_i \leq 1000 * 0 \leq y_i \leq 1000 * The given N points are all dif...
### Prompt Create a solution in Cpp for the following problem: Compute A + B. Constraints * -1000 ≀ A, B ≀ 1000 Input The input will consist of a series of pairs of integers A and B separated by a space, one pair of integers per line. The input will be terminated by EOF. Output For each pair of input integers A...
### Prompt Your task is to create a CPP solution to the following problem: We guessed a permutation p consisting of n integers. The permutation of length n is the array of length n where each element from 1 to n appears exactly once. This permutation is a secret for you. For each position r from 2 to n we chose some...
### Prompt Create a solution in Cpp for the following problem: Given is an integer sequence A_1, ..., A_N of length N. We will choose exactly \left\lfloor \frac{N}{2} \right\rfloor elements from this sequence so that no two adjacent elements are chosen. Find the maximum possible sum of the chosen elements. Here \l...
### Prompt Please provide a Cpp coded solution to the problem described below: Vanya wants to pass n exams and get the academic scholarship. He will get the scholarship if the average grade mark for all the exams is at least avg. The exam grade cannot exceed r. Vanya has passed the exams and got grade ai for the i-th...
### Prompt Please create a solution in CPP to the following problem: You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. Constraints * All values ...
### Prompt Your challenge is to write a cpp solution to the following problem: To get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, and then sell the bought items on another pla...
### Prompt Construct a Cpp code solution to the problem outlined: Little C loves number Β«3Β» very much. He loves all things about it. Now he has a positive integer n. He wants to split n into 3 positive integers a,b,c, such that a+b+c=n and none of the 3 integers is a multiple of 3. Help him to find a solution. Inpu...
### Prompt Please provide a Cpp coded solution to the problem described below: We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Initially, all the squares are white. square1001 wants to draw a picture wi...
### Prompt Your challenge is to write a cpp solution to the following problem: A positive integer is called a 2-3-integer, if it is equal to 2xΒ·3y for some non-negative integers x and y. In other words, these integers are such integers that only have 2 and 3 among their prime divisors. For example, integers 1, 6, 9, ...
### Prompt Please provide a CPP coded solution to the problem described below: For a given polygon g, computes the area of the polygon. g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≀ i ≀ n-1) are sides of g. The line segment connecting pn and p1 is also a side...
### Prompt Your task is to create a CPP solution to the following problem: Let's assume that set S consists of m distinct intervals [l1, r1], [l2, r2], ..., [lm, rm] (1 ≀ li ≀ ri ≀ n; li, ri are integers). Let's assume that f(S) is the maximum number of intervals that you can choose from the set S, such that every t...
### Prompt Create a solution in CPP for the following problem: There are n distinct points on a coordinate line, the coordinate of i-th point equals to x_i. Choose a subset of the given set of points such that the distance between each pair of points in a subset is an integral power of two. It is necessary to conside...
### Prompt Construct a Cpp code solution to the problem outlined: We call an array almost increasing if we can erase not more than one element from it so that the array becomes strictly increasing (that is, every element is striclty greater than every element before it). You are given an array a consisting of n elem...
### Prompt Develop a solution in Cpp to the problem described below: One way to create a task is to learn from life. You can choose some experience in real life, formalize it and then you will get a new task. Let's think about a scene in real life: there are lots of people waiting in front of the elevator, each pers...
### Prompt Construct a Cpp code solution to the problem outlined: A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn. Nick...
### Prompt Your challenge is to write a Cpp solution to the following problem: There are n points marked on the plane. The points are situated in such a way that they form a regular polygon (marked points are its vertices, and they are numbered in counter-clockwise order). You can draw n - 1 segments, each connecting...
### Prompt Your challenge is to write a Cpp solution to the following problem: qd ucyhf yi q fhycu dkcruh mxeiu huluhiu yi q tyvvuhudj fhycu dkcruh. oekh jqia yi je vydt jxu djx ucyhf. Input jxu ydfkj sediyiji ev q iydwbu ydjuwuh d (1 ≀ d ≀ 11184) β€” jxu edu-rqiut ydtun ev jxu ucyhf je vydt. Output ekjfkj q iydwbu...
### Prompt Generate a cpp solution to the following problem: One day Vasya the Hipster decided to count how many socks he had. It turned out that he had a red socks and b blue socks. According to the latest fashion, hipsters should wear the socks of different colors: a red one on the left foot, a blue one on the rig...
### Prompt In CPP, your task is to solve the following problem: Vasya is choosing a laptop. The shop has n laptops to all tastes. Vasya is interested in the following properties: processor speed, ram and hdd. Vasya is a programmer and not a gamer which is why he is not interested in all other properties. If all thr...
### Prompt Generate a cpp solution to the following problem: Vasya has a tree consisting of n vertices with root in vertex 1. At first all vertices has 0 written on it. Let d(i, j) be the distance between vertices i and j, i.e. number of edges in the shortest path from i to j. Also, let's denote k-subtree of vertex ...
### Prompt Please formulate a CPP solution to the following problem: Nastya received a gift on New Year β€” a magic wardrobe. It is magic because in the end of each month the number of dresses in it doubles (i.e. the number of dresses becomes twice as large as it is in the beginning of the month). Unfortunately, right...
### Prompt Create a solution in cpp for the following problem: Arthur and Alexander are number busters. Today they've got a competition. Arthur took a group of four integers a, b, w, x (0 ≀ b < w, 0 < x < w) and Alexander took integer с. Arthur and Alexander use distinct approaches to number bustings. Alexander is ...
### Prompt Your task is to create a Cpp solution to the following problem: On Planet MM-21, after their Olympic games this year, curling is getting popular. But the rules are somewhat different from ours. The game is played on an ice game board on which a square mesh is marked. They use only a single stone. The purpo...
### Prompt Your challenge is to write a CPP solution to the following problem: There are n seats in the train's car and there is exactly one passenger occupying every seat. The seats are numbered from 1 to n from left to right. The trip is long, so each passenger will become hungry at some moment of time and will go ...
### Prompt Create a solution in Cpp for the following problem: While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Patrick's personal stuff and found a sequence a1, a2, ..., am of length m, consisting of integers from 1 to n, not necessarily dist...
### Prompt In Cpp, your task is to solve 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 cities i...