text stringlengths 424 69.5k |
|---|
### Prompt
Please provide a cpp coded solution to the problem described below:
There are n psychos standing in a line. Each psycho is assigned a unique integer from 1 to n. At each step every psycho who has an id greater than the psycho to his right (if exists) kills his right neighbor in the line. Note that a psycho... |
### Prompt
In Cpp, your task is to solve the following problem:
XXI Berland Annual Fair is coming really soon! Traditionally fair consists of n booths, arranged in a circle. The booths are numbered 1 through n clockwise with n being adjacent to 1. The i-th booths sells some candies for the price of a_i burles per ite... |
### Prompt
In cpp, your task is to solve the following problem:
Okabe needs bananas for one of his experiments for some strange reason. So he decides to go to the forest and cut banana trees.
Consider the point (x, y) in the 2D plane such that x and y are integers and 0 β€ x, y. There is a tree in such a point, and i... |
### Prompt
Generate a CPP solution to the following problem:
Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring card ga... |
### Prompt
Create a solution in cpp for the following problem:
Let s be some string consisting of symbols "0" or "1". Let's call a string t a substring of string s, if there exists such number 1 β€ l β€ |s| - |t| + 1 that t = s_l s_{l+1} β¦ s_{l + |t| - 1}. Let's call a substring t of string s unique, if there exist onl... |
### Prompt
Develop a solution in Cpp to the problem described below:
Dreamoon likes to play with sets, integers and <image>. <image> is defined as the largest positive integer that divides both a and b.
Let S be a set of exactly four distinct integers greater than 0. Define S to be of rank k if and only if for all p... |
### Prompt
Create a solution in CPP for the following problem:
The only difference between easy and hard versions is a number of elements in the array.
You are given an array a consisting of n integers. The value of the i-th element of the array is a_i.
You are also given a set of m segments. The j-th segment is [l... |
### Prompt
Please create a solution in Cpp to the following problem:
There were n groups of students which came to write a training contest. A group is either one person who can write the contest with anyone else, or two people who want to write the contest in the same team.
The coach decided to form teams of exactl... |
### Prompt
Develop a solution in Cpp to the problem described below:
Let's play Amidakuji.
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
<image>
In the starting points (top of the figure), numbers are assigne... |
### Prompt
Please formulate a cpp solution to the following problem:
KM country has N kinds of coins and each coin has its value a_i.
The king of the country, Kita_masa, thought that the current currency system is poor, and he decided to make it beautiful by changing the values of some (possibly no) coins.
A curren... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
We have N locked treasure boxes, numbered 1 to N.
A shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any n... |
### Prompt
Please formulate a cpp solution to the following problem:
Buber is a Berland technology company that specializes in waste of investor's money. Recently Buber decided to transfer its infrastructure to a cloud. The company decided to rent CPU cores in the cloud for n consecutive days, which are numbered from... |
### Prompt
In cpp, your task is to solve the following problem:
Autumn came late to the kingdom of Far Far Away. The harvest was exuberant and it is now time to get ready for the winter. As most people celebrate the Harvest festival, Simon the Caretaker tries to solve a very non-trivial task of how to find place for ... |
### Prompt
Create a solution in cpp for the following problem:
Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to present him a rectangular parallelepiped of marble from which ... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
You are given an undirected graph consisting of n vertices. A number is written on each vertex; the number on vertex i is a_i. Initially there are no edges in the graph.
You may add some edges to this graph, but you have to pay for them. ... |
### Prompt
Develop a solution in CPP to the problem described below:
You are given an array A, consisting of n positive integers a_1, a_2, ..., a_n, and an array B, consisting of m positive integers b_1, b_2, ..., b_m.
Choose some element a of A and some element b of B such that a+b doesn't belong to A and doesn't ... |
### Prompt
Create a solution in CPP for the following problem:
Alice and Bob have a tree (undirected acyclic connected graph). There are ai chocolates waiting to be picked up in the i-th vertex of the tree. First, they choose two different vertices as their starting positions (Alice chooses first) and take all the ch... |
### Prompt
Generate a Cpp solution to the following problem:
Misha has a tree with characters written on the vertices. He can choose two vertices s and t of this tree and write down characters of vertices lying on a path from s to t. We'll say that such string corresponds to pair (s, t).
Misha has m queries of type:... |
### Prompt
In cpp, your task is to solve the following problem:
We have a string s consisting of lowercase English letters. Snuke can perform the following operation repeatedly:
* Insert a letter `x` to any position in s of his choice, including the beginning and end of s.
Snuke's objective is to turn s into a pa... |
### Prompt
Your task is to create a cpp solution to the following problem:
Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.
Sergey gives Nastya the word ... |
### Prompt
Your challenge is to write 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... |
### Prompt
Please formulate a Cpp solution to the following problem:
Vasya owns three big integers β a, l, r. Let's define a partition of x such a sequence of strings s_1, s_2, ..., s_k that s_1 + s_2 + ... + s_k = x, where + is a concatanation of strings. s_i is the i-th element of the partition. For example, number... |
### Prompt
Please create a solution in Cpp to the following problem:
Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice.
First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge.
Then, Aoki gave him M queries. The i-th of the... |
### Prompt
Construct a cpp code solution to the problem outlined:
This is the easy version of this problem. The only difference is the limit of n - the length of the input string. In this version, 1 β€ n β€ 2000. The hard version of this challenge is not offered in the round for the second division.
Let's define a co... |
### Prompt
Please create a solution in cpp to the following problem:
One day Vasya came across three Berland coins. They didn't have any numbers that's why Vasya didn't understand how their denominations differ. He supposed that if one coin is heavier than the other one, then it should be worth more. Vasya weighed al... |
### Prompt
Create a solution in CPP for the following problem:
Daniel has a string s, consisting of lowercase English letters and period signs (characters '.'). Let's define the operation of replacement as the following sequence of steps: find a substring ".." (two consecutive periods) in string s, of all occurrences... |
### Prompt
Create a solution in Cpp for the following problem:
Vanya got an important task β he should enumerate books in the library and label each book with its number. Each of the n books should be assigned with a number from 1 to n. Naturally, distinct books should be assigned distinct numbers.
Vanya wants to kn... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Vasya decided to learn to play chess. Classic chess doesn't seem interesting to him, so he plays his own sort of chess.
The queen is the piece that captures all squares on its vertical, horizontal and diagonal lines. If the cell is locate... |
### Prompt
In cpp, your task is to solve the following problem:
Example
Input
4 3
1000 1
2000 2
3000 3
Output
2 3 4 4
### Response
```cpp
/* template.cpp {{{ */
#include <bits/stdc++.h>
using namespace std;
#define get_macro(a, b, c, d, name, ...) name
#define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, ... |
### Prompt
Please create a solution in Cpp to the following problem:
Bob came to a cash & carry store, put n items into his trolley, and went to the checkout counter to pay. Each item is described by its price ci and time ti in seconds that a checkout assistant spends on this item. While the checkout assistant is occ... |
### Prompt
Please create a solution in cpp to the following problem:
Daniel has a string s, consisting of lowercase English letters and period signs (characters '.'). Let's define the operation of replacement as the following sequence of steps: find a substring ".." (two consecutive periods) in string s, of all occur... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Dima is a beginner programmer. During his working process, he regularly has to repeat the following operation again and again: to remove every second element from the array. One day he has been bored with easy solutions of this problem, and he has come... |
### Prompt
Please provide a CPP coded solution to the problem described below:
You are given n chips on a number line. The i-th chip is placed at the integer coordinate x_i. Some chips can have equal coordinates.
You can perform each of the two following types of moves any (possibly, zero) number of times on any chi... |
### Prompt
Create a solution in Cpp for the following problem:
Vanya got bored and he painted n distinct points on the plane. After that he connected all the points pairwise and saw that as a result many triangles were formed with vertices in the painted points. He asks you to count the number of the formed triangles... |
### Prompt
Your task is to create a Cpp solution to the following problem:
We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it β either 1 or 2.
However, there is one condition you must fulfill in order to receive t... |
### Prompt
Generate a CPP solution to the following problem:
Polycarp starts his own business. Tomorrow will be the first working day of his car repair shop. For now the car repair shop is very small and only one car can be repaired at a given time.
Polycarp is good at marketing, so he has already collected n reques... |
### Prompt
Please formulate a Cpp solution to the following problem:
In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N.
There are M kinds of regular boat services between these islands. Each service connects two ... |
### Prompt
Please provide a CPP coded solution to the problem described below:
Ivan loves burgers and spending money. There are n burger joints on the street where Ivan lives. Ivan has q friends, and the i-th friend suggested to meet at the joint l_i and walk to the joint r_i (l_i β€ r_i). While strolling with the i-t... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Reforms have started in Berland again! At this time, the Parliament is discussing the reform of the calendar. To make the lives of citizens of Berland more varied, it was decided to change the calendar. As more and more people are complain... |
### Prompt
Your challenge is to write a cpp solution to 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... |
### Prompt
Generate a cpp solution to the following problem:
Note the unusual memory limit.
For a rectangular grid where each square is painted white or black, we define its complexity as follows:
* If all the squares are black or all the squares are white, the complexity is 0.
* Otherwise, divide the grid into two... |
### Prompt
Construct a CPP code solution to the problem outlined:
Amugae has a hotel consisting of 10 rooms. The rooms are numbered from 0 to 9 from left to right.
The hotel has two entrances β one from the left end, and another from the right end. When a customer arrives to the hotel through the left entrance, they... |
### Prompt
Create a solution in cpp for the following problem:
Two players play a simple game. Each player is provided with a box with balls. First player's box contains exactly n1 balls and second player's box contains exactly n2 balls. In one move first player can take from 1 to k1 balls from his box and throw them... |
### Prompt
Your task is to create a cpp solution to the following problem:
Sitting in a station waiting room, Joisino is gazing at her train ticket.
The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).
In the formula A op1 B op2 C op3 D = 7, replace each of the symb... |
### Prompt
In cpp, your task is to solve the following problem:
Print the K-th element of the following sequence of length 32:
1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
Constraints
* 1 \leq K \leq 32
* All values in input are integers.
Input
Input is given... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Vasya will fancy any number as long as it is an integer power of two. Petya, on the other hand, is very conservative and only likes a single integer p (which may be positive, negative, or zero). To combine their tastes, they invented p-binary numbers o... |
### Prompt
Your task is to create a cpp solution to the following problem:
When Petya went to school, he got interested in large numbers and what they were called in ancient times. For instance, he learned that the Russian word "tma" (which now means "too much to be counted") used to stand for a thousand and "tma tmy... |
### Prompt
Your task is to create a cpp solution to the following problem:
There are N slimes standing on a number line. The i-th slime from the left is at position x_i.
It is guaruanteed that 1 \leq x_1 < x_2 < \ldots < x_N \leq 10^{9}.
Niwango will perform N-1 operations. The i-th operation consists of the follow... |
### Prompt
Create a solution in Cpp for the following problem:
There are N robots and M exits on a number line. The N + M coordinates of these are all integers and all distinct. For each i (1 \leq i \leq N), the coordinate of the i-th robot from the left is x_i. Also, for each j (1 \leq j \leq M), the coordinate of t... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Example
Input
1+2*3+4
11
Output
M
### Response
```cpp
#include <bits/stdc++.h>
using namespace std;
int in = 0;
int num(string str) {
int res = str[in] - '0';
in++;
return res;
}
int mul(string str) {
int res = n... |
### Prompt
Please formulate a cpp solution to the following problem:
Vanya and his friend Vova play a computer game where they need to destroy n monsters to pass a level. Vanya's character performs attack with frequency x hits per second and Vova's character performs attack with frequency y hits per second. Each char... |
### Prompt
Develop a solution in cpp to the problem described below:
Dreamoon loves summing up something for no reason. One day he obtains two integers a and b occasionally. He wants to calculate the sum of all nice integers. Positive integer x is called nice if <image> and <image>, where k is some integer number in ... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
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 zigz... |
### Prompt
Develop a solution in CPP to the problem described below:
You are at the top left cell (1, 1) of an n Γ m labyrinth. Your goal is to get to the bottom right cell (n, m). You can only move right or down, one cell per step. Moving right from a cell (x, y) takes you to the cell (x, y + 1), while moving down t... |
### Prompt
Generate a Cpp solution to the following problem:
Karafs is some kind of vegetable in shape of an 1 Γ h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs.
<image>
Each Karafs has a positive integer height. Tavas has an infinite ... |
### Prompt
In CPP, your task is to solve the following problem:
Can you imagine our life if we removed all zeros from it? For sure we will have many problems.
In this problem we will have a simple example if we removed all zeros from our life, it's the addition operation. Let's assume you are given this equation a +... |
### Prompt
Your task is to create a Cpp solution to the following problem:
You have unlimited number of coins with values 1, 2, β¦, n. You want to select some set of coins having the total value of S.
It is allowed to have multiple coins with the same value in the set. What is the minimum number of coins required to... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
You are given two lists of non-zero digits.
Let's call an integer pretty if its (base 10) representation has at least one digit from the first list and at least one digit from the second list. What is the smallest positive pretty integer?... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange t... |
### Prompt
Please provide a CPP coded solution to the problem described below:
At the beginning of the school year Berland State University starts two city school programming groups, for beginners and for intermediate coders. The children were tested in order to sort them into groups. According to the results, each s... |
### Prompt
Create a solution in Cpp for the following problem:
Let's assume that we have a pair of numbers (a, b). We can get a new pair (a + b, b) or (a, a + b) from the given pair in a single step.
Let the initial pair of numbers be (1,1). Your task is to find number k, that is, the least number of steps needed to... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
It is September 9 in Japan now.
You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N?
Constraints
* 10β€Nβ€99
Input
Input is given from Standard Input in the following format:
N
Outpu... |
### Prompt
Please create a solution in CPP to the following problem:
A plane is flying at a constant height of h meters above the ground surface. Let's consider that it is flying from the point (-10^9, h) to the point (10^9, h) parallel with Ox axis.
A glider is inside the plane, ready to start his flight at any mom... |
### Prompt
Construct a CPP code solution to the problem outlined:
You are given a tree that consists of n nodes. You should label each of its n-1 edges with an integer in such way that satisfies the following conditions:
* each integer must be greater than 0;
* the product of all n-1 numbers should be equal to... |
### Prompt
Create a solution in Cpp for the following problem:
Nearly each project of the F company has a whole team of developers working on it. They often are in different rooms of the office in different cities and even countries. To keep in touch and track the results of the project, the F company conducts shared... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
"QAQ" is a word to denote an expression of crying. Imagine "Q" as eyes with tears and "A" as a mouth.
Now Diamond has given Bort a string consisting of only uppercase English letters of length n. There is a great number of "QAQ" in the st... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
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 formulate a Cpp solution to the following problem:
Ringo is giving a present to Snuke.
Ringo has found out that Snuke loves yakiniku (a Japanese term meaning grilled meat. yaki: grilled, niku: meat). He supposes that Snuke likes grilled things starting with `YAKI` in Japanese, and does not like oth... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
The Fair Nut got stacked in planar world. He should solve this task to get out.
You are given n rectangles with vertexes in (0, 0), (x_i, 0), (x_i, y_i), (0, y_i). For each rectangle, you are also given a number a_i. Choose some of them t... |
### Prompt
Please create a solution in cpp to the following problem:
Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).
Constraints
* 1 \leq N \leq 10^4
* 1 \leq A \leq B \leq 36
* All input values are integers.
Input
Input is given fro... |
### Prompt
In cpp, your task is to solve the following problem:
Tom loves vowels, and he likes long words with many vowels. His favorite words are vowelly words. We say a word of length k is vowelly if there are positive integers n and m such that nβ
m = k and when the word is written by using n rows and m columns (t... |
### Prompt
Please formulate a CPP solution to the following problem:
Jon fought bravely to rescue the wildlings who were attacked by the white-walkers at Hardhome. On his arrival, Sam tells him that he wants to go to Oldtown to train at the Citadel to become a maester, so he can return and take the deceased Aemon's p... |
### Prompt
Please create a solution in Cpp to the following problem:
Today is the ticket release date for Aizu Entertainment's recommended idol group "Akabeko & Koboushi". There are four types of tickets:
S seat 6000 yen
A seat 4000 yen
B seat 3000 yen
C seat 2000 yen
You, the sales manager, are excitedly waiting f... |
### Prompt
Create a solution in CPP for the following problem:
You are given a string s consisting of n lowercase Latin letters.
Let's denote k-substring of s as a string subsk = sksk + 1..sn + 1 - k. Obviously, subs1 = s, and there are exactly <image> such substrings.
Let's call some string t an odd proper suprefi... |
### Prompt
Please formulate a cpp solution to the following problem:
Polycarp wants to build a fence near his house. He has n white boards and k red boards he can use to build it. Each board is characterised by its length, which is an integer.
A good fence should consist of exactly one red board and several (possibl... |
### Prompt
Create a solution in CPP for 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:
Vanya has a table consisting of 100 rows, each row contains 100 cells. The rows are numbered by integers from 1 to 100 from bottom to top, the columns are numbered from 1 to 100 from left to right.
In this table, Vanya chose n rectangles with sides tha... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger this value is, the better the friendship is. No... |
### Prompt
Please provide a CPP coded solution to the problem described below:
Meka-Naruto plays a computer game. His character has the following ability: given an enemy hero, deal a instant damage to him, and then heal that enemy b health points at the end of every second, for exactly c seconds, starting one second ... |
### Prompt
Please formulate a Cpp solution to the following problem:
You have a team of N people. For a particular task, you can pick any non-empty subset of people. The cost of having x people for the task is xk.
Output the sum of costs over all non-empty subsets of people.
Input
Only line of input contains two ... |
### Prompt
Develop a solution in cpp to the problem described below:
There are 2N points generally positioned on the circumference of a circle, numbered 1,\dots,2N in counterclockwise order. Here, a set of points is said to be generally positioned if, for any six distinct points U, V, W, X, Y, and Z among them, the s... |
### Prompt
Generate a cpp solution to the following problem:
In a magical land there are n cities conveniently numbered 1, 2, ..., n. Some pairs of these cities are connected by magical colored roads. Magic is unstable, so at any time, new roads may appear between two cities.
Vicky the witch has been tasked with per... |
### Prompt
In Cpp, your task is to solve the following problem:
There is a plan view consisting of 12 vertical and 12 horizontal squares showing the terrain. Each square is painted white or black. White represents the sea and black represents the land. When two black squares touch each other vertically or horizontall... |
### Prompt
Please create a solution in cpp to the following problem:
Once Volodya was at the museum and saw a regular chessboard as a museum piece. And there were only four chess pieces on it: two white rooks, a white king and a black king. "Aha, blacks certainly didn't win!", β Volodya said and was right for sure. A... |
### Prompt
In Cpp, your task is to solve the following problem:
You are given a string s, consisting of small Latin letters. Let's denote the length of the string as |s|. The characters in the string are numbered starting from 1.
Your task is to find out if it is possible to rearrange characters in string s so that... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations.
Max is a young biologist. For n days he watched a specific shark, ... |
### Prompt
Please create a solution in Cpp to the following problem:
You are given a chess board with n rows and n columns. Initially all cells of the board are empty, and you have to put a white or a black knight into each cell of the board.
A knight is a chess piece that can attack a piece in cell (x_2, y_2) from ... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Let's analyze a program written on some strange programming language. The variables in this language have names consisting of 1 to 4 characters, and each character is a lowercase or an uppercase Latin letter, or a digit. There is an extra ... |
### Prompt
Construct a cpp code solution to the problem outlined:
The great Shaass is the new king of the Drakht empire. The empire has n cities which are connected by n - 1 bidirectional roads. Each road has an specific length and connects a pair of cities. There's a unique simple path connecting each pair of cities... |
### Prompt
Construct a cpp code solution to the problem outlined:
Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each sec... |
### Prompt
Create a solution in CPP for the following problem:
A bracket sequence is a string, containing only characters "(", ")", "[" and "]".
A correct bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original chara... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
You are given an integer n.
You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times:
1. Replace n with n/2 if n is divisible by 2;
2. Replace n with 2n/3 if n is divisible by 3... |
### Prompt
Create a solution in cpp for the following problem:
Nothing is eternal in the world, Kostya understood it on the 7-th of January when he saw partially dead four-color garland.
Now he has a goal to replace dead light bulbs, however he doesn't know how many light bulbs for each color are required. It is gua... |
### Prompt
In Cpp, your task is to solve the following problem:
You are given a string S of length N consisting of `A`, `B` and `C`, and an integer K which is between 1 and N (inclusive). Print the string S after lowercasing the K-th character in it.
Constraints
* 1 β€ N β€ 50
* 1 β€ K β€ N
* S is a string of length N ... |
### Prompt
Create a solution in CPP for the following problem:
Paul is at the orchestra. The string section is arranged in an r Γ c rectangular grid and is filled with violinists with the exception of n violists. Paul really likes violas, so he would like to take a picture including at least k of them. Paul can take ... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Little X and Little Z are good friends. They always chat online. But both of them have schedules.
Little Z has fixed schedule. He always online at any moment of time between a1 and b1, between a2 and b2, ..., between ap and bp (all border... |
### Prompt
In CPP, your task is to solve the following problem:
Heidi and Doctor Who hopped out of the TARDIS and found themselves at EPFL in 2018. They were surrounded by stormtroopers and Darth Vader was approaching. Miraculously, they managed to escape to a nearby rebel base but the Doctor was very confused. Heidi... |
### Prompt
Please create a solution in cpp to the following problem:
Johnny has just found the new, great tutorial: "How to become a grandmaster?". The tutorial tells many strange and unexpected for Johnny things, such as you have to be patient or that very important is solving many harder and harder problems.
The ... |
### Prompt
Create a solution in cpp for 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 fo... |
### Prompt
Please create a solution in CPP to the following problem:
You've got a table of size n Γ m. We'll consider the table rows numbered from top to bottom 1 through n, and the columns numbered from left to right 1 through m. Then we'll denote the cell in row x and column y as (x, y).
Initially cell (1, 1) cont... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.