text stringlengths 424 69.5k |
|---|
### Prompt
In cpp, your task is to solve the following problem:
Erelong Leha was bored by calculating of the greatest common divisor of two factorials. Therefore he decided to solve some crosswords. It's well known that it is a very interesting occupation though it can be very difficult from time to time. In the cour... |
### Prompt
Construct a cpp code solution to the problem outlined:
Adilbek was assigned to a special project. For Adilbek it means that he has n days to run a special program and provide its results. But there is a problem: the program needs to run for d days to calculate the results.
Fortunately, Adilbek can optimiz... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Maxim loves sequences, especially those that strictly increase. He is wondering, what is the length of the longest increasing subsequence of the given sequence a?
Sequence a is given as follows:
* the length of the sequence equals n ×... |
### Prompt
Please create a solution in CPP to the following problem:
Some company is going to hold a fair in Byteland. There are n towns in Byteland and m two-way roads between towns. Of course, you can reach any town from any other town using roads.
There are k types of goods produced in Byteland and every town pro... |
### Prompt
Develop a solution in CPP to the problem described below:
Little Vasya's uncle is a postman. The post offices are located on one circular road. Besides, each post office has its own gas station located next to it. Petya's uncle works as follows: in the morning he should leave the house and go to some post ... |
### Prompt
Please formulate a cpp solution to the following problem:
A long time ago somewhere in the depths of America existed a powerful tribe governed by the great leader Pinnie-the-Wooh. Once the tribe conquered three Maya cities. Pinnie-the-Wooh grew concerned: there had to be some control over the conquered ter... |
### Prompt
Please formulate a cpp solution to the following problem:
Petya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name w and the collection of forbidden substrings s1, s... |
### Prompt
Create a solution in CPP for the following problem:
We have a square grid with H rows and W columns. Snuke wants to write 0 or 1 in each of the squares. Here, all of the following conditions have to be satisfied:
* For every row, the smaller of the following is A: the number of 0s contained in the row, an... |
### Prompt
Please formulate a CPP solution to the following problem:
Kamil likes streaming the competitive programming videos. His MeTube channel has recently reached 100 million subscribers. In order to celebrate this, he posted a video with an interesting problem he couldn't solve yet. Can you help him?
You're giv... |
### Prompt
Construct a cpp code solution to the problem outlined:
Student Vladislav came to his programming exam completely unprepared as usual. He got a question about some strange algorithm on a graph — something that will definitely never be useful in real life. He asked a girl sitting next to him to lend him some... |
### Prompt
Your task is to create a CPP solution to the following problem:
This is yet another problem dealing with regular bracket sequences.
We should remind you that a bracket sequence is called regular, if by inserting «+» and «1» into it we can get a correct mathematical expression. For example, sequences «(())... |
### Prompt
Develop a solution in cpp to the problem described below:
You are given an undirected tree consisting of n vertices. An undirected tree is a connected undirected graph with n - 1 edges.
Your task is to add the minimum number of edges in such a way that the length of the shortest path from the vertex 1 to ... |
### Prompt
Create a solution in cpp for the following problem:
Find the least common multiple (LCM) of given n integers.
Constraints
* 2 ≤ n ≤ 10
* 1 ≤ ai ≤ 1000
* Product of given integers ai(i = 1, 2, ... n) does not exceed 231-1
Input
n
a1 a2 ... an
n is given in the first line. Then, n integers are given i... |
### Prompt
In Cpp, your task is to solve the following problem:
Maxim always goes to the supermarket on Sundays. Today the supermarket has a special offer of discount systems.
There are m types of discounts. We assume that the discounts are indexed from 1 to m. To use the discount number i, the customer takes a spec... |
### Prompt
Please formulate a Cpp solution to the following problem:
A very unusual citizen lives in a far away kingdom — Dwarf Gracula. However, his unusual name is not the weirdest thing (besides, everyone long ago got used to calling him simply Dwarf Greg). What is special about Dwarf Greg — he's been living for o... |
### Prompt
Please formulate a CPP solution to the following problem:
Vivek initially has an empty array a and some integer constant m.
He performs the following algorithm:
1. Select a random integer x uniformly in range from 1 to m and append it to the end of a.
2. Compute the greatest common divisor of intege... |
### Prompt
Construct a cpp code solution to the problem outlined:
There are N persons called Person 1 through Person N.
You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times.
If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There... |
### Prompt
Develop a solution in Cpp to the problem described below:
Valera is a lazy student. He has m clean bowls and k clean plates.
Valera has made an eating plan for the next n days. As Valera is lazy, he will eat exactly one dish per day. At that, in order to eat a dish, he needs exactly one clean plate or bo... |
### Prompt
Develop a solution in cpp to the problem described below:
Airport Codes
Airport code
In the Kingdom of JAG, airport codes are assigned to each domestic airport for identification.
Airport codes are assigned according to the following rules based on the name of the airport in lowercase English alphabet:
... |
### Prompt
Your task is to create a Cpp solution to the following problem:
A tree is a connected undirected graph consisting of n vertices and n - 1 edges. Vertices are numbered 1 through n.
Limak is a little polar bear. He once had a tree with n vertices but he lost it. He still remembers something about the lost t... |
### Prompt
Generate a Cpp solution to the following problem:
Problem statement
Meatishi can increase or decrease the number of fingers.
There are n buns in front of Nikunishi-kun.
Meatishi is trying to count the number of steamed buns by breaking his finger.
There are only two shapes that Nishikun's fingers can take... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
You are given a string s consisting only of first 20 lowercase Latin letters ('a', 'b', ..., 't').
Recall that the substring s[l; r] of the string s is the string s_l s_{l + 1} ... s_r. For example, the substrings of "codeforces" are "cod... |
### Prompt
Construct a cpp code solution to the problem outlined:
A new pack of n t-shirts came to a shop. Each of the t-shirts is characterized by three integers pi, ai and bi, where pi is the price of the i-th t-shirt, ai is front color of the i-th t-shirt and bi is back color of the i-th t-shirt. All values pi are... |
### Prompt
Please create a solution in Cpp to the following problem:
You finally got a magic pot, an alchemy pot. You can create a new item by putting multiple items in the alchemy pot. Newly created items can also be placed in alchemy pots to make other items. A list of items needed to make an item will be called an... |
### Prompt
In Cpp, your task is to solve the following problem:
Vasya owns a cornfield which can be defined with two integers n and d. The cornfield can be represented as rectangle with vertices having Cartesian coordinates (0, d), (d, 0), (n, n - d) and (n - d, n).
<image> An example of a cornfield with n = 7 and d... |
### Prompt
Please create a solution in CPP to the following problem:
Salem gave you n sticks with integer positive lengths a_1, a_2, …, a_n.
For every stick, you can change its length to any other positive integer length (that is, either shrink or stretch it). The cost of changing the stick's length from a to b is |... |
### Prompt
Develop a solution in cpp to the problem described below:
Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions:
1.... |
### Prompt
Generate a Cpp solution to the following problem:
Thumbelina has had an accident. She has found herself on a little island in the middle of a swamp and wants to get to the shore very much.
One can get to the shore only by hills that are situated along a straight line that connects the little island with t... |
### Prompt
Please formulate a cpp solution to the following problem:
Mountaineers Mr. Takahashi and Mr. Aoki recently trekked across a certain famous mountain range. The mountain range consists of N mountains, extending from west to east in a straight line as Mt. 1, Mt. 2, ..., Mt. N. Mr. Takahashi traversed the rang... |
### Prompt
In cpp, your task is to solve the following problem:
Given any integer x, Aoki can do the operation below.
Operation: Replace x with the absolute difference of x and K.
You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more t... |
### Prompt
In CPP, your task is to solve the following problem:
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path of side-adja... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
You have a rooted tree consisting of n vertices. Let's number them with integers from 1 to n inclusive. The root of the tree is the vertex 1. For each i > 1 direct parent of the vertex i is pi. We say that vertex i is child for its direct ... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Smith wakes up at the side of a dirty, disused bathroom, his ankle chained to pipes. Next to him is tape-player with a hand-written message "Play Me". He finds a tape in his own back pocket. After putting the tape in the tape-player, he sees a... |
### Prompt
Please provide a cpp coded solution to the problem described below:
a is an array of n positive integers, all of which are not greater than n.
You have to process q queries to this array. Each query is represented by two numbers p and k. Several operations are performed in each query; each operation chang... |
### Prompt
Please formulate a cpp solution to the following problem:
The black king is standing on a chess field consisting of 109 rows and 109 columns. We will consider the rows of the field numbered with integers from 1 to 109 from top to bottom. The columns are similarly numbered with integers from 1 to 109 from l... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
The full exploration sister is a very talented woman. Your sister can easily count the number of routes in a grid pattern if it is in the thousands. You and your exploration sister are now in a room lined with hexagonal tiles. The older si... |
### Prompt
Create a solution in Cpp for the following problem:
Ksenia has an array a consisting of n positive integers a_1, a_2, …, a_n.
In one operation she can do the following:
* choose three distinct indices i, j, k, and then
* change all of a_i, a_j, a_k to a_i ⊕ a_j ⊕ a_k simultaneously, where ⊕ denote... |
### Prompt
Please create a solution in cpp to the following problem:
Arya has n opponents in the school. Each day he will fight with all opponents who are present this day. His opponents have some fighting plan that guarantees they will win, but implementing this plan requires presence of them all. That means if one ... |
### Prompt
Please provide a CPP coded solution to the problem described below:
Snuke received an integer sequence a of length 2N-1.
He arbitrarily permuted the elements in a, then used it to construct a new integer sequence b of length N, as follows:
* b_1 = the median of (a_1)
* b_2 = the median of (a_1, a_2, a_3)... |
### Prompt
Please create a solution in CPP to the following problem:
All space-time unified dimension sugoroku tournament. You are representing the Earth in the 21st century in the tournament, which decides only one Sugoroku absolute champion out of more than 500 trillion participants.
The challenge you are currentl... |
### Prompt
Generate a Cpp solution to the following problem:
One player came to a casino and found a slot machine where everything depends only on how he plays. The rules follow.
A positive integer a is initially on the screen. The player can put a coin into the machine and then add 1 to or subtract 1 from any two a... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
This problem differs from the next one only in the presence of the constraint on the equal length of all numbers a_1, a_2, ..., a_n. Actually, this problem is a subtask of the problem D2 from the same contest and the solution of D2 solves ... |
### Prompt
Your task is to create a CPP solution to the following problem:
Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make h... |
### Prompt
Generate a cpp solution to the following problem:
Scrooge McDuck keeps his most treasured savings in a home safe with a combination lock. Each time he wants to put there the treasures that he's earned fair and square, he has to open the lock.
<image>
The combination lock is represented by n rotating disk... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal... |
### Prompt
Develop a solution in CPP to the problem described below:
You are given a connected weighted undirected graph without any loops and multiple edges.
Let us remind you that a graph's spanning tree is defined as an acyclic connected subgraph of the given graph that includes all of the graph's vertexes. The ... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
You are given n numbers a_1, a_2, ..., a_n. With a cost of one coin you can perform the following operation:
Choose one of these numbers and add or subtract 1 from it.
In particular, we can apply this operation to the same number several... |
### Prompt
In CPP, your task is to solve the following problem:
Given are integers a,b,c and d. If x and y are integers and a \leq x \leq b and c\leq y \leq d hold, what is the maximum possible value of x \times y?
Constraints
* -10^9 \leq a \leq b \leq 10^9
* -10^9 \leq c \leq d \leq 10^9
* All values in input are... |
### Prompt
Develop a solution in cpp to the problem described below:
You are given three sticks with positive integer lengths of a, b, and c centimeters. You can increase length of some of them by some positive integer number of centimeters (different sticks can be increased by a different length), but in total by at... |
### Prompt
Develop a solution in cpp to the problem described below:
Given are a prime number p and a sequence of p integers a_0, \ldots, a_{p-1} consisting of zeros and ones.
Find a polynomial of degree at most p-1, f(x) = b_{p-1} x^{p-1} + b_{p-2} x^{p-2} + \ldots + b_0, satisfying the following conditions:
* For... |
### Prompt
Please provide a cpp coded solution to the problem described below:
The king is left alone on the chessboard. In spite of this loneliness, he doesn't lose heart, because he has business of national importance. For example, he has to pay an official visit to square t. As the king is not in habit of wasting ... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
You are given two integers A and B.
Print a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:
* Let the size of the grid be h \times w (h vertical, w hori... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Tokitsukaze and her friends are trying to infiltrate a secret base built by Claris. However, Claris has been aware of that and set a bomb which is going to explode in a minute. Although they try to escape, they have no place to go after they f... |
### Prompt
Construct a Cpp code solution to the problem outlined:
<image>
Input
The input contains two integers row, col (0 ≤ row, col ≤ 63), separated by a single space.
Output
Output "IN" or "OUT".
Examples
Input
0 0
Output
OUT
Input
27 0
Output
IN
Input
0 27
Output
OUT
Input
27 27
... |
### Prompt
Develop a solution in CPP to the problem described below:
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 planet. Note ... |
### Prompt
Please formulate a CPP solution to the following problem:
You have a set of items, each having some integer weight not greater than 8. You denote that a subset of items is good if total weight of items in the subset does not exceed W.
You want to calculate the maximum possible weight of a good subset of i... |
### Prompt
Create a solution in CPP for the following problem:
Allen is playing Number Clicker on his phone.
He starts with an integer u on the screen. Every second, he can press one of 3 buttons.
1. Turn u → u+1 \pmod{p}.
2. Turn u → u+p-1 \pmod{p}.
3. Turn u → u^{p-2} \pmod{p}.
Allen wants to press at... |
### Prompt
Develop a solution in cpp to the problem described below:
Problem statement
Jota made a scale as shown in the figure below using a stick with a length of $ 2L $.
<image>
The rods are evenly spaced with $ 2L + 1 $ holes, from left to right: $ -L, -L + 1, \ cdots, -1, 0, 1, \ cdots, L-1, L $. It is number... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Mashmokh's boss, Bimokh, didn't like Mashmokh. So he fired him. Mashmokh decided to go to university and participate in ACM instead of finding a new job. He wants to become a member of Bamokh's team. In order to join he was given some programming tasks... |
### Prompt
Create a solution in CPP for the following problem:
Yaroslav thinks that two strings s and w, consisting of digits and having length n are non-comparable if there are two numbers, i and j (1 ≤ i, j ≤ n), such that si > wi and sj < wj. Here sign si represents the i-th digit of string s, similarly, wj repres... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Petya collects beautiful matrix.
A matrix of size n × n is beautiful if:
* All elements of the matrix are integers between 1 and n;
* For every row of the matrix, all elements of this row are different;
* For every pair of vertically adjacen... |
### Prompt
Please formulate a Cpp solution to the following problem:
There are n candy boxes in front of Tania. The boxes are arranged in a row from left to right, numbered from 1 to n. The i-th box contains r_i candies, candies have the color c_i (the color can take one of three values — red, green, or blue). All ... |
### Prompt
In CPP, your task is to solve the following problem:
Mitya has a rooted tree with n vertices indexed from 1 to n, where the root has index 1. Each vertex v initially had an integer number a_v ≥ 0 written on it. For every vertex v Mitya has computed s_v: the sum of all values written on the vertices on the ... |
### Prompt
Develop a solution in Cpp to the problem described below:
Dima got into number sequences. Now he's got sequence a1, a2, ..., an, consisting of n positive integers. Also, Dima has got a function f(x), which can be defined with the following recurrence:
* f(0) = 0;
* f(2·x) = f(x);
* f(2·x + 1) = f(... |
### Prompt
Create a solution in CPP for the following problem:
A straight tunnel without branches is crowded with busy ants coming and going. Some ants walk left to right and others right to left. All ants walk at a constant speed of 1 cm/s. When two ants meet, they try to pass each other. However, some sections of t... |
### Prompt
In Cpp, your task is to solve the following problem:
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each othe... |
### Prompt
Develop a solution in Cpp 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 of the po... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
We define x mod y as the remainder of division of x by y (\% operator in C++ or Java, mod operator in Pascal).
Let's call an array of positive integers [a_1, a_2, ..., a_k] stable if for every permutation p of integers from 1 to k, and fo... |
### Prompt
Please create a solution in cpp to the following problem:
The Berland road network consists of n cities and of m bidirectional roads. The cities are numbered from 1 to n, where the main capital city has number n, and the culture capital — number 1. The road network is set up so that it is possible to reach... |
### Prompt
Please formulate a Cpp solution to the following problem:
We have an N×N checkerboard.
From the square at the upper left corner, a square that is i squares to the right and j squares below is denoted as (i, j). Particularly, the square at the upper left corner is denoted as (0, 0).
Each square (i, j) suc... |
### Prompt
Please formulate a CPP solution to the following problem:
Student Andrey has been skipping physical education lessons for the whole term, and now he must somehow get a passing grade on this subject. Obviously, it is impossible to do this by legal means, but Andrey doesn't give up. Having obtained an empty ... |
### Prompt
Please provide a CPP coded solution to the problem described below:
Kyoto University decided to build a straight wall on the west side of the university to protect against gorillas that attack the university from the west every night. Since it is difficult to protect the university at some points along the... |
### Prompt
Generate a Cpp solution to the following problem:
When the river brought Gerda to the house of the Old Lady who Knew Magic, this lady decided to make Gerda her daughter. She wants Gerda to forget about Kay, so she puts all the roses from the garden underground.
Mole, who lives in this garden, now can watc... |
### Prompt
In cpp, your task is to solve the following problem:
Two little greedy bears have found two pieces of cheese in the forest of weight a and b grams, correspondingly. The bears are so greedy that they are ready to fight for the larger piece. That's where the fox comes in and starts the dialog: "Little bears,... |
### Prompt
In CPP, your task is to solve the following problem:
One day, Taro received a strange email with only the number "519345213244" in the text. The email was from my cousin, who was 10 years older than me, so when I called and asked, "Oh, I sent it with a pocket bell because I was in a hurry. It's convenient.... |
### Prompt
Please create a solution in Cpp to the following problem:
Yasin has an array a containing n integers. Yasin is a 5 year old, so he loves ultimate weird things.
Yasin denotes weirdness of an array as maximum gcd(ai, aj) value among all 1 ≤ i < j ≤ n. For n ≤ 1 weirdness is equal to 0, gcd(x, y) is the grea... |
### Prompt
Please provide a cpp coded solution to the problem described below:
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 m... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Sasha is a very happy guy, that's why he is always on the move. There are n cities in the country where Sasha lives. They are all located on one straight line, and for convenience, they are numbered from 1 to n in increasing order. The dis... |
### Prompt
Generate a CPP solution to the following problem:
Fox Ciel saw a large field while she was on a bus. The field was a n × m rectangle divided into 1 × 1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes.
After seeing the field carefully, Ciel fo... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
There is an infinite set generated as follows:
* 1 is in this set.
* If x is in this set, x ⋅ a and x+b both are in this set.
For example, when a=3 and b=6, the five smallest elements of the set are:
* 1,
* 3 (1 is in this ... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
We saw the little game Marmot made for Mole's lunch. Now it's Marmot's dinner time and, as we all know, Marmot eats flowers. At every dinner he eats some red and white flowers. Therefore a dinner can be represented as a sequence of several... |
### Prompt
Please create a solution in Cpp to the following problem:
Given an n × n table T consisting of lowercase English letters. We'll consider some string s good if the table contains a correct path corresponding to the given string. In other words, good strings are all strings we can obtain by moving from the l... |
### Prompt
Please formulate a CPP solution to the following problem:
Ostap already settled down in Rio de Janiero suburb and started to grow a tree in his garden. Recall that a tree is a connected undirected acyclic graph.
Ostap's tree now has n vertices. He wants to paint some vertices of the tree black such that ... |
### Prompt
Please create a solution in Cpp to the following problem:
— Thanks a lot for today.
— I experienced so many great things.
— You gave me memories like dreams... But I have to leave now...
— One last request, can you...
— Help me solve a Codeforces problem?
— ......
— What?
Chtholly has been thinking ... |
### Prompt
Create a solution in cpp for the following problem:
In the rush of modern life, people often forget how beautiful the world is. The time to enjoy those around them is so little that some even stand in queues to several rooms at the same time in the clinic, running from one queue to another.
(Cultural note... |
### Prompt
Please formulate a Cpp solution to the following problem:
You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:
* The initial character of S is an uppercase `A`.
* There is exactly one occurrence of `C` between the... |
### Prompt
Create a solution in cpp for the following problem:
One day Om Nom found a thread with n beads of different colors. He decided to cut the first several beads from this thread to make a bead necklace and present it to his girlfriend Om Nelly.
<image>
Om Nom knows that his girlfriend loves beautiful patter... |
### Prompt
Generate a CPP solution 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 sequences, fi... |
### Prompt
Please provide a CPP coded solution to the problem described below:
Oleg came to see the maze of mirrors. The maze is a n by n room in which each cell is either empty or contains a mirror connecting opposite corners of this cell. Mirrors in this maze reflect light in a perfect way, which causes the interes... |
### Prompt
Please create a solution in cpp to the following problem:
You are given the following concurrent program. There are N processes and the i-th process has the following pseudocode:
repeat ni times
yi := y
y := yi + 1
end repeat
Here y is a shared variable. Eve... |
### Prompt
Develop a solution in CPP to the problem described below:
So you decided to hold a contest on Codeforces. You prepared the problems: statements, solutions, checkers, validators, tests... Suddenly, your coordinator asks you to change all your tests to multiple testcases in the easiest problem!
Initially, e... |
### Prompt
Please provide a CPP coded solution to the problem described below:
Andrewid the Android is a galaxy-famous detective. He is now chasing a criminal hiding on the planet Oxa-5, the planet almost fully covered with water.
The only dry land there is an archipelago of n narrow islands located in a row. For mo... |
### Prompt
Create a solution in Cpp for the following problem:
Omkar has a pie tray with k (2 ≤ k ≤ 20) spots. Each spot in the tray contains either a chocolate pie or a pumpkin pie. However, Omkar does not like the way that the pies are currently arranged, and has another ideal arrangement that he would prefer inste... |
### Prompt
In cpp, your task is to solve the following problem:
Snuke has decided to play with N cards and a deque (that is, a double-ended queue). Each card shows an integer from 1 through N, and the deque is initially empty.
Snuke will insert the cards at the beginning or the end of the deque one at a time, in ord... |
### Prompt
Develop a solution in CPP to the problem described below:
There are n rabbits, one in each of the huts numbered 0 through n − 1.
At one point, information came to the rabbits that a secret organization would be constructing an underground passage. The underground passage would allow the rabbits to visit o... |
### Prompt
Create a solution in cpp for the following problem:
Alice and Bob play a game. The game consists of several sets, and each set consists of several rounds. Each round is won either by Alice or by Bob, and the set ends when one of the players has won x rounds in a row. For example, if Bob won five rounds in ... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Let’s play a stone removing game.
Initially, n stones are arranged on a circle and numbered 1, ... , n clockwise (Figure 1). You are also given two numbers k and m. From this state, remove stones one by one following the rules explained below... |
### Prompt
Create a solution in cpp for the following problem:
Estimating the Flood Risk
Mr. Boat is the owner of a vast extent of land. As many typhoons have struck Japan this year, he became concerned of flood risk of his estate and he wants to know the average altitude of his land. The land is too vast to measure... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Andrey needs one more problem to conduct a programming contest. He has n friends who are always willing to help. He can ask some of them to come up with a contest problem. Andrey knows one value for each of his fiends — the probability tha... |
### Prompt
Generate a Cpp solution to the following problem:
So, the Berland is at war with its eternal enemy Flatland again, and Vasya, an accountant, was assigned to fulfil his duty to the nation.
Right now the situation in Berland is dismal — their both cities are surrounded! The armies of flatlanders stand on t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.