text stringlengths 424 69.5k |
|---|
### Prompt
Please formulate a Cpp solution to the following problem:
There is a string S of length N consisting of characters `0` and `1`. You will perform the following operation for each i = 1, 2, ..., m:
* Arbitrarily permute the characters within the substring of S starting at the l_i-th character from the left ... |
### Prompt
Please formulate a CPP solution to the following problem:
A and B are preparing themselves for programming contests.
After several years of doing sports programming and solving many problems that require calculating all sorts of abstract objects, A and B also developed rather peculiar tastes.
A likes low... |
### Prompt
Your task is to create a CPP solution to the following problem:
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 T... |
### Prompt
Generate a Cpp solution to the following problem:
This is an interactive problem.
Note: the XOR-sum of an array a_1, a_2, β¦, a_n (1 β€ a_i β€ 10^9) is defined as a_1 β a_2 β β¦ β a_n, where β denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR).
Little Dormi received an a... |
### Prompt
Generate a CPP solution to the following problem:
User ainta has a stack of n red and blue balls. He can apply a certain operation which changes the colors of the balls inside the stack.
* While the top ball inside the stack is red, pop the ball from the top of the stack.
* Then replace the blue ball... |
### Prompt
In CPP, your task is to solve the following problem:
You are given a weighted undirected graph. The vertices are enumerated from 1 to n. Your task is to find the shortest path between the vertex 1 and the vertex n.
Input
The first line contains two integers n and m (2 β€ n β€ 105, 0 β€ m β€ 105), where n is ... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.
The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)
Assuming that nothing other than the interest a... |
### Prompt
Please formulate a CPP solution to the following problem:
One department of some software company has n servers of different specifications. Servers are indexed with consecutive integers from 1 to n. Suppose that the specifications of the j-th server may be expressed with a single integer number c_j of art... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Sereja is a coder and he likes to take part in Codesorfes rounds. However, Uzhland doesn't have good internet connection, so Sereja sometimes skips rounds.
Codesorfes has rounds of two types: Div1 (for advanced coders) and Div2 (for beginner ... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Vasya participates in a ski race along the X axis. The start is at point 0, and the finish is at L, that is, at a distance L meters from the start in the positive direction of the axis. Vasya has been training so hard that he can run one m... |
### Prompt
Please formulate a CPP solution to the following problem:
Mishka got an integer array a of length n as a birthday present (what a surprise!).
Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorit... |
### Prompt
Please formulate a CPP solution to the following problem:
You are given an array a_1, a_2, ... , a_n and two integers m and k.
You can choose some subarray a_l, a_{l+1}, ..., a_{r-1}, a_r.
The cost of subarray a_l, a_{l+1}, ..., a_{r-1}, a_r is equal to β_{i=l}^{r} a_i - k β (r - l + 1)/(m) β, where β x... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
You are given a following process.
There is a platform with n columns. 1 Γ 1 squares are appearing one after another in some columns on this platform. If there are no squares in the column, a square will occupy the bottom row. Otherwise ... |
### Prompt
Develop a solution in cpp to the problem described below:
In this problem you have to implement an algorithm to defragment your hard disk. The hard disk consists of a sequence of clusters, numbered by integers from 1 to n. The disk has m recorded files, the i-th file occupies clusters with numbers ai, 1, a... |
### Prompt
Please formulate a CPP solution to the following problem:
At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are kno... |
### Prompt
Please create a solution in CPP to the following problem:
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to t... |
### Prompt
Your task is to create a cpp solution to the following problem:
The plans for HC2 are rather far-fetched: we are just over 500 000 days away from HC2 3387, for example, and accordingly we are planning to have a couple hundred thousand problems in that edition (we hope that programming contests will become ... |
### Prompt
Please provide a cpp coded solution to the problem described below:
There are N slimes lining up in a row. Initially, the i-th slime from the left has a size of a_i.
Taro is trying to combine all the slimes into a larger slime. He will perform the following operation repeatedly until there is only one sli... |
### Prompt
Construct a CPP code solution to the problem outlined:
Heidi the Cow is aghast: cracks in the northern Wall? Zombies gathering outside, forming groups, preparing their assault? This must not happen! Quickly, she fetches her HC2 (Handbook of Crazy Constructions) and looks for the right chapter:
How to buil... |
### Prompt
Construct a CPP code solution to the problem outlined:
You are given a string s of length n. Each character is either one of the first k lowercase Latin letters or a question mark.
You are asked to replace every question mark with one of the first k lowercase Latin letters in such a way that the following... |
### Prompt
Please formulate a cpp solution to the following problem:
Cirno has prepared n arrays of length n each. Each array is a permutation of n integers from 1 to n. These arrays are special: for all 1 β€ i β€ n, if we take the i-th element of each array and form another array of length n with these elements, the r... |
### Prompt
Please create a solution in cpp to the following problem:
One day you wanted to read something, so you went to your bookshelf to grab some book. But when you saw how messy the bookshelf was you decided to clean it up first.
<image>
There are n books standing in a row on the shelf, the i-th book has color... |
### Prompt
Please formulate a Cpp solution to the following problem:
You are given a multiset S consisting of positive integers (initially empty). There are two kind of queries:
1. Add a positive integer to S, the newly added integer is not less than any number in it.
2. Find a subset s of the set S such that ... |
### Prompt
Please formulate a cpp solution to the following problem:
As you may know, MemSQL has American offices in both San Francisco and Seattle. Being a manager in the company, you travel a lot between the two cities, always by plane.
You prefer flying from Seattle to San Francisco than in the other direction, b... |
### Prompt
Create a solution in cpp for the following problem:
Igor K. always used to trust his favorite Kashpirovsky Antivirus. That is why he didn't hesitate to download the link one of his groupmates sent him via QIP Infinium. The link was said to contain "some real funny stuff about swine influenza". The antiviru... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Convexity of a set of points on the plane is the size of the largest subset of points that form a convex polygon. Your task is to build a set of n points with the convexity of exactly m. Your set of points should not contain three points that lie on a ... |
### Prompt
Develop a solution in CPP to the problem described below:
A flea is sitting at one of the n hassocks, arranged in a circle, at the moment. After minute number k the flea jumps through k - 1 hassoΡks (clockwise). For example, after the first minute the flea jumps to the neighboring hassock. You should answe... |
### Prompt
In cpp, your task is to solve the following problem:
Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is.
You are given a strin... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
You have an integer n. Let's define following tree generation as McDic's generation:
1. Make a complete and full binary tree of 2^{n} - 1 vertices. Complete and full binary tree means a tree that exactly one vertex is a root, all leaves... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Yaroslav is playing a game called "Time". The game has a timer showing the lifespan he's got left. As soon as the timer shows 0, Yaroslav's character dies and the game ends. Also, the game has n clock stations, station number i is at point (xi... |
### Prompt
Your task is to create a CPP solution to the following problem:
You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room.
For each notice, you are given four inte... |
### Prompt
Construct a Cpp code solution to the problem outlined:
This problem consists of three subproblems: for solving subproblem F1 you will receive 8 points, for solving subproblem F2 you will receive 15 points, and for solving subproblem F3 you will receive 10 points.
Manao has developed a model to predict the... |
### Prompt
Please create a solution in Cpp to the following problem:
Vasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon.
The canyon consists of two vertical parallel walls, their height is n meters. Let's imagine that we split these walls into 1 meter-long areas and ... |
### Prompt
Create a solution in CPP for the following problem:
On vacations n pupils decided to go on excursion and gather all together. They need to overcome the path with the length l meters. Each of the pupils will go with the speed equal to v1. To get to the excursion quickly, it was decided to rent a bus, which ... |
### Prompt
Develop a solution in cpp to the problem described below:
Polycarp took n videos, the duration of the i-th video is a_i seconds. The videos are listed in the chronological order, i.e. the 1-st video is the earliest, the 2-nd video is the next, ..., the n-th video is the last.
Now Polycarp wants to publish... |
### Prompt
Your task is to create a cpp solution to the following problem:
In the city of Nevermore, there are 10^8 streets and 10^8 avenues, both numbered from 0 to 10^8-1. All streets run straight from west to east, and all avenues run straight from south to north. The distance between neighboring streets and betwe... |
### 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 this tree connects Vertex a_i and b_i. For each k=1, ..., N, solve the problem below:
* Consider writing a number on each vertex in the tree in the following manner:
* First, write 1 on Ve... |
### Prompt
Your task is to create a Cpp solution to the following problem:
There is a trampoline park with n trampolines in a line. The i-th of which has strength S_i.
Pekora can jump on trampolines in multiple passes. She starts the pass by jumping on any trampoline of her choice.
If at the moment Pekora jumps on... |
### Prompt
Develop a solution in CPP 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 to find th... |
### Prompt
Please formulate a cpp solution to the following problem:
Rational numbers are numbers represented by ratios of two integers. For a prime number p, one of the elementary theorems in the number theory is that there is no rational number equal to βp. Such numbers are called irrational numbers. It is also kno... |
### Prompt
Create a solution in cpp for the following problem:
Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving problems, but she found this problem too interesting, so she wanted to know its solution and decided to ask you about it. So, the pro... |
### Prompt
Generate a CPP solution to the following problem:
In an English class Nick had nothing to do at all, and remembered about wonderful strings called palindromes. We should remind you that a string is called a palindrome if it can be read the same way both from left to right and from right to left. Here are e... |
### Prompt
Create a solution in CPP for the following problem:
The Smart Beaver from ABBYY has once again surprised us! He has developed a new calculating device, which he called the "Beaver's Calculator 1.0". It is very peculiar and it is planned to be used in a variety of scientific problems.
To test it, the Smart... |
### Prompt
Generate a Cpp solution to the following problem:
We have a string S of length N consisting of `R`, `G`, and `B`.
Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions:
* S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k.
* j - i \neq k - j.
Constraints
... |
### Prompt
In cpp, your task is to solve the following problem:
Baby Ehab is known for his love for a certain operation. He has an array a of length n, and he decided to keep doing the following operation on it:
* he picks 2 adjacent elements; he then removes them and places a single integer in their place: their... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Little X has solved the #P-complete problem in polynomial time recently. So he gives this task to you.
There is a special n Γ n matrix A, you should calculate its permanent modulo 1000000007 (109 + 7). The special property of matrix A is... |
### Prompt
Create a solution in CPP for the following problem:
RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1.
<image>
Figure B-1: Layout of the exchange lines
A freight train consists of 2 to... |
### Prompt
Please create a solution in cpp to the following problem:
Mayor of city S just hates trees and lawns. They take so much space and there could be a road on the place they occupy!
The Mayor thinks that one of the main city streets could be considerably widened on account of lawn nobody needs anyway. Moreove... |
### Prompt
In Cpp, your task is to solve the following problem:
Lakhesh loves to make movies, so Nephren helps her run a cinema. We may call it No. 68 Cinema.
<image>
However, one day, the No. 68 Cinema runs out of changes (they don't have 50-yuan notes currently), but Nephren still wants to start their business. (... |
### Prompt
Develop a solution in Cpp to the problem described below:
Mr. A, who will graduate next spring, decided to move when he got a job. The company that finds a job has offices in several towns, and the offices that go to work differ depending on the day. So Mr. A decided to live in a town where he had a short ... |
### Prompt
Please create a solution in CPP to the following problem:
There are b blocks of digits. Each one consisting of the same n digits, which are given to you in the input. Wet Shark must choose exactly one digit from each block and concatenate all of those digits together to form one large integer. For example,... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Oleg's favorite subjects are History and Math, and his favorite branch of mathematics is division.
To improve his division skills, Oleg came up with t pairs of integers p_i and q_i and for each pair decided to find the greatest integer x_... |
### Prompt
Develop a solution in Cpp to the problem described below:
Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organized into an 8 Γ 8 table. A field is represented by a p... |
### Prompt
Please create a solution in CPP to the following problem:
The annual college sports-ball tournament is approaching, which for trademark reasons we'll refer to as Third Month Insanity. There are a total of 2N teams participating in the tournament, numbered from 1 to 2N. The tournament lasts N rounds, with e... |
### Prompt
In CPP, your task is to solve the following problem:
During the archaeological research in the Middle East you found the traces of three ancient religions: First religion, Second religion and Third religion. You compiled the information on the evolution of each of these beliefs, and you now wonder if the f... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coordinates) within dis... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
You are given two positive integers d and s. Find minimal positive integer n which is divisible by d and has sum of digits equal to s.
Input
The first line contains two positive integers d and s (1 β€ d β€ 500, 1 β€ s β€ 5000) separated by s... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Rng has a connected undirected graph with N vertices. Currently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i.
Rng will add new edges to the graph by repeating the following operation:
* Operation: Choo... |
### Prompt
Generate 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 Morty are g... |
### Prompt
Develop a solution in CPP to the problem described below:
You have been blessed as a child of Omkar. To express your gratitude, please solve this problem for Omkar!
An array a of length n is called complete if all elements are positive and don't exceed 1000, and for all indices x,y,z (1 β€ x,y,z β€ n), a_{x... |
### Prompt
Please formulate a CPP solution to the following problem:
Ivan has an array consisting of n elements. Each of the elements is an integer from 1 to n.
Recently Ivan learned about permutations and their lexicographical order. Now he wants to change (replace) minimum number of elements in his array in such a... |
### Prompt
Develop a solution in CPP to the problem described below:
You, the mighty Blackout, are standing in the upper-left (0,0) corner of NxM matrix. You must move either right or down each second.
There are K transformers jumping around the matrix in the following way. Each transformer starts jumping from posi... |
### Prompt
Please formulate a CPP solution to the following problem:
We will call a string that can be obtained by concatenating two equal strings an even string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not.
For a non-empty string S, we will define f(S) as the shortest even string... |
### Prompt
Generate a CPP solution to the following problem:
Vasya follows a basketball game and marks the distances from which each team makes a throw. He knows that each successful throw has value of either 2 or 3 points. A throw is worth 2 points if the distance it was made from doesn't exceed some value of d mete... |
### Prompt
Generate a cpp solution to the following problem:
All-Berland programming contest comes to an end. In total, n teams participated in it. Like in ACM-ICPC, current results stopped refreshing one hour before the contest ends. So at the Award Ceremony, results are partially known. For each team the value ai i... |
### Prompt
Construct a Cpp code solution to the problem outlined:
The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)
We will close the window so as to minimize ... |
### Prompt
In Cpp, your task is to solve the following problem:
For a given array $a_1, a_2, a_3, ... , a_N$ of $N$ elements and an integer $S$, find the smallest sub-array size (smallest window length) where the sum of the sub-array is greater than or equal to $S$. If there is not such sub-array, report 0.
Constrai... |
### Prompt
Please create a solution in cpp to the following problem:
You have an array a consisting of n integers. Each integer from 1 to n appears exactly once in this array.
For some indices i (1 β€ i β€ n - 1) it is possible to swap i-th element with (i + 1)-th, for other indices it is not possible. You may perform... |
### Prompt
Please create a solution in cpp to the following problem:
One day Maria Ivanovna found a Sasha's piece of paper with a message dedicated to Olya. Maria Ivanovna wants to know what is there in a message, but unfortunately the message is ciphered. Maria Ivanovna knows that her students usually cipher their m... |
### Prompt
Please formulate a Cpp solution to the following problem:
After returning to shore, uncle Bogdan usually visits the computer club "The Rock", to solve tasks in a pleasant company. One day, uncle Bogdan met his good old friend who told him one unusual task...
There are n non-intersecting horizontal segment... |
### Prompt
Create a solution in Cpp for the following problem:
Given are 1-digit positive integers a and b. Consider these two strings: the concatenation of b copies of the digit a, and the concatenation of a copies of the digit b. Which of these is lexicographically smaller?
Constraints
* 1 \leq a \leq 9
* 1 \leq ... |
### Prompt
Create a solution in Cpp for the following problem:
AtCoDeer the deer found N rectangle lying on the table, each with height 1. If we consider the surface of the desk as a two-dimensional plane, the i-th rectangle i(1β€iβ€N) covers the vertical range of [i-1,i] and the horizontal range of [l_i,r_i], as shown... |
### Prompt
Create a solution in Cpp for the following problem:
Karlsson has visited Lillebror again. They found a box of chocolates and a big whipped cream cake at Lillebror's place. Karlsson immediately suggested to divide the sweets fairly between Lillebror and himself. Specifically, to play together a game he has ... |
### Prompt
Your task is to create a cpp solution to the following problem:
problem
If you write a positive integer in decimal notation (without leading 0) and look at the digit numbers in order, when the number increases and decreases alternately, the number is "zigza". Let's call it. For example, 2947 is a zigzag n... |
### Prompt
Generate a CPP solution to the following problem:
You are visiting a large electronics store to buy a refrigerator and a microwave.
The store sells A kinds of refrigerators and B kinds of microwaves. The i-th refrigerator ( 1 \le i \le A ) is sold at a_i yen (the currency of Japan), and the j-th microwave... |
### Prompt
Create a solution in Cpp for the following problem:
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 100,000 or less... |
### Prompt
Generate a cpp solution to the following problem:
Berland, 2016. The exchange rate of currency you all know against the burle has increased so much that to simplify the calculations, its fractional part was neglected and the exchange rate is now assumed to be an integer.
Reliable sources have informed the... |
### Prompt
Develop a solution in CPP to the problem described below:
A New Year party is not a New Year party without lemonade! As usual, you are expecting a lot of guests, and buying lemonade has already become a pleasant necessity.
Your favorite store sells lemonade in bottles of n different volumes at different c... |
### Prompt
Create a solution in CPP for the following problem:
A string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied:
* S is a palindrome.
* Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrom... |
### Prompt
Your task is to create a CPP solution to the following problem:
There are n cities in Berland. Some pairs of them are connected with m directed roads. One can use only these roads to move from one city to another. There are no roads that connect a city to itself. For each pair of cities (x, y) there is at ... |
### Prompt
Construct a Cpp code solution to the problem outlined:
You are given the strings a and b, consisting of lowercase Latin letters. You can do any number of the following operations in any order:
* if |a| > 0 (the length of the string a is greater than zero), delete the first character of the string a, th... |
### Prompt
Please formulate a cpp solution to the following problem:
C: Mod! Mod!
story
That's right! I'm looking for eyewitness testimony! A phantom thief has appeared in Aizu! Everyone's horse stick was stolen! Who is the culprit! ?? Unravel! Mod! Mod!
Problem statement
"Eyes" ... it's a miracle bud that swells... |
### Prompt
Construct a CPP code solution to the problem outlined:
Vasya is reading a e-book. The file of the book consists of n pages, numbered from 1 to n. The screen is currently displaying the contents of page x, and Vasya wants to read the page y. There are two buttons on the book which allow Vasya to scroll d pa... |
### Prompt
Construct a cpp code solution to the problem outlined:
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 you u... |
### Prompt
Please create a solution in Cpp to the following problem:
problem
Taro often shop at JOI general stores. At JOI general stores, there are enough coins of 500 yen, 100 yen, 50 yen, 10 yen, 5 yen, and 1 yen, and we always pay the change so that the number of coins is the smallest. Create a program to find t... |
### Prompt
Create a solution in CPP for the following problem:
A triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.
You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`.
Constraints
*... |
### Prompt
Construct a Cpp code solution to the problem outlined:
problem
During this time of winter in Japan, hot days continue in Australia in the Southern Hemisphere. IOI, who lives in Australia, decided to plan what clothes to wear based on the weather forecast for a certain D day. The maximum temperature on day... |
### Prompt
Generate a CPP solution to the following problem:
Write a program which converts uppercase/lowercase letters to lowercase/uppercase for a given string.
Constraints
* The length of the input string < 1200
Input
A string is given in a line.
Output
Print the converted string in a line. Note that you do ... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Bizon the Champion isn't just attentive, he also is very hardworking.
Bizon the Champion decided to paint his old fence his favorite color, orange. The fence is represented as n vertical planks, put in a row. Adjacent planks have no gap b... |
### Prompt
Please formulate a cpp solution to the following problem:
Arpa is researching the Mexican wave.
There are n spectators in the stadium, labeled from 1 to n. They start the Mexican wave at time 0.
* At time 1, the first spectator stands.
* At time 2, the second spectator stands.
* ...
* At time ... |
### Prompt
In Cpp, your task is to solve the following problem:
Takahashi and Aoki will have a battle using their monsters.
The health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.
The two monsters will take turns attacking, in the order Takaha... |
### Prompt
Generate a CPP solution to the following problem:
You are given two integers n and m (m < n). Consider a convex regular polygon of n vertices. Recall that a regular polygon is a polygon that is equiangular (all angles are equal in measure) and equilateral (all sides have the same length).
<image> Examples... |
### Prompt
Construct a cpp code solution to the problem outlined:
The Dogeforces company has k employees. Each employee, except for lower-level employees, has at least 2 subordinates. Lower-level employees have no subordinates. Each employee, except for the head of the company, has exactly one direct supervisor. The ... |
### Prompt
Your task is to create a CPP solution to the following problem:
Dima has a birthday soon! It's a big day! Saryozha's present to Dima is that Seryozha won't be in the room and won't disturb Dima and Inna as they celebrate the birthday. Inna's present to Dima is a stack, a queue and a deck.
Inna wants her p... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
We have N integers. The i-th number is A_i.
\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\leq i < j \leq N.
\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise cop... |
### Prompt
Develop a solution in CPP to the problem described below:
One day Jeff got hold of an integer sequence a1, a2, ..., an of length n. The boy immediately decided to analyze the sequence. For that, he needs to find all values of x, for which these conditions hold:
* x occurs in sequence a.
* Consider al... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
problem
The JOI building is a combination of regular hexagons with a side of 1 meter as shown in the figure. As Christmas is approaching, JOI decided to decorate the walls of the building with illuminations. However, since it is useless t... |
### Prompt
Construct a CPP code solution to the problem outlined:
Student Dima from Kremland has a matrix a of size n Γ m filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help... |
### Prompt
Your task is to create a Cpp solution to the following problem:
You are given n positive integers a1, a2, ..., an.
For every ai you need to find a positive integer ki such that the decimal notation of 2ki contains the decimal notation of ai as a substring among its last min(100, length(2ki)) digits. Here ... |
### Prompt
Please provide a CPP coded solution to the problem described below:
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...
Lee thinks a regular n-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.