text stringlengths 424 69.5k |
|---|
### Prompt
Please create a solution in cpp to the following problem:
Ostap is preparing to play chess again and this time he is about to prepare. Thus, he was closely monitoring one recent chess tournament. There were m players participating and each pair of players played exactly one game. The victory gives 2 points... |
### Prompt
Please formulate a CPP solution to the following problem:
Valera loves his garden, where n fruit trees grow.
This year he will enjoy a great harvest! On the i-th tree bi fruit grow, they will ripen on a day number ai. Unfortunately, the fruit on the tree get withered, so they can only be collected on day ... |
### Prompt
In CPP, your task is to solve the following problem:
Vasya came up with his own weather forecasting method. He knows the information about the average air temperature for each of the last n days. Assume that the average air temperature for each day is integral.
Vasya believes that if the average temperatu... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Smart Beaver decided to be not only smart, but also a healthy beaver! And so he began to attend physical education classes at school X. In this school, physical education has a very creative teacher. One of his favorite warm-up exercises i... |
### Prompt
Please create a solution in cpp to the following problem:
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
Constraints
* 1 \leq N,K... |
### Prompt
Generate a Cpp solution to the following problem:
There are several days left before the fiftieth birthday of a famous Berland's writer Berlbury. In this connection the local library decided to make an exposition of the works of this famous science-fiction writer. It was decided as well that it is necessar... |
### Prompt
Please create a solution in cpp to the following problem:
You are given an array a consisting of n integer numbers.
You have to color this array in k colors in such a way that:
* Each element of the array should be colored in some color;
* For each i from 1 to k there should be at least one element... |
### Prompt
Construct a CPP code solution to the problem outlined:
When Kefa came to the restaurant and sat at a table, the waiter immediately brought him the menu. There were n dishes. Kefa knows that he needs exactly m dishes. But at that, he doesn't want to order the same dish twice to taste as many dishes as possi... |
### Prompt
Generate a CPP solution to the following problem:
You must have heard of the two brothers dreaming of ruling the world. With all their previous plans failed, this time they decided to cooperate with each other in order to rule the world.
As you know there are n countries in the world. These countries are... |
### Prompt
Develop a solution in CPP to the problem described below:
Om Nom is the main character of a game "Cut the Rope". He is a bright little monster who likes visiting friends living at the other side of the park. However the dark old parks can scare even somebody as fearless as Om Nom, so he asks you to help hi... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Sasha and Ira are two best friends. But they aren’t just friends, they are software engineers and experts in artificial intelligence. They are developing an algorithm for two bots playing a two-player game. The game is cooperative and turn... |
### Prompt
Generate a Cpp solution to the following problem:
You are given a huge integer a consisting of n digits (n is between 1 and 3 ⋅ 10^5, inclusive). It may contain leading zeros.
You can swap two digits on adjacent (neighboring) positions if the swapping digits are of different parity (that is, they have dif... |
### Prompt
Construct a Cpp code solution to the problem outlined:
You are given two positive integers a and b. There are two possible operations:
1. multiply one of the numbers by some prime p;
2. divide one of the numbers on its prime factor p.
What is the minimum number of operations required to obtain t... |
### Prompt
Generate a CPP solution to the following problem:
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N.
Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference w... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Vasya studies divisibility rules at school. Here are some of them:
* Divisibility by 2. A number is divisible by 2 if and only if its last digit is divisible by 2 or in other words, is even.
* Divisibility by 3. A number is divisible ... |
### Prompt
Create a solution in CPP for the following problem:
You are given an image, that can be represented with a 2-d n by m grid of pixels. Each pixel of the image is either on or off, denoted by the characters "0" or "1", respectively. You would like to compress this image. You want to choose an integer k > 1 a... |
### Prompt
Your task is to create a CPP solution to the following problem:
You are given undirected weighted graph. Find the length of the shortest cycle which starts from the vertex 1 and passes throught all the edges at least once. Graph may contain multiply edges between a pair of vertices and loops (edges from th... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
This is an interactive problem.
Homer likes arrays a lot and he wants to play a game with you.
Homer has hidden from you a permutation a_1, a_2, ..., a_n of integers 1 to n. You are asked to find any index k (1 ≤ k ≤ n) which is a local... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Many modern text editors automatically check the spelling of the user's text. Some editors even suggest how to correct typos.
In this problem your task to implement a small functionality to correct two types of typos in a word. We will assume that thr... |
### Prompt
Generate a CPP solution to the following problem:
Heiankyo is known as a town with a grid of roads.
Hokusai, a cat who lives in Heiankyo, has to go from his home to a secret place on the outskirts of town every day for patrol. However, I get tired of following the same path every day, and there is a risk ... |
### Prompt
Generate a CPP solution to the following problem:
Write a program which reads a sequence A of n elements and an integer M, and outputs "yes" if you can make M by adding elements in A, otherwise "no". You can use an element only once.
You are given the sequence A and q questions where each question contain... |
### Prompt
Generate a CPP solution to the following problem:
You are given a set S of strings consisting of `0` and `1`, and an integer K.
Find the longest string that is a subsequence of K or more different strings in S. If there are multiple strings that satisfy this condition, find the lexicographically smallest ... |
### Prompt
Create a solution in Cpp for the following problem:
Fibonacci numbers have the following form:
F1 = 1, F2 = 2, Fi = Fi - 1 + Fi - 2, i > 2.
Let's consider some non-empty set S = {s1, s2, ..., sk}, consisting of different Fibonacci numbers. Let's find the sum of values of this set's elements:
<image>
... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Vasily the Programmer loves romance, so this year he decided to illuminate his room with candles.
Vasily has a candles.When Vasily lights up a new candle, it first burns for an hour and then it goes out. Vasily is smart, so he can make b ... |
### Prompt
Your task is to create a CPP solution to the following problem:
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.
Let's consider a word too long, if its length is strictly more than 10 characters. All too long words s... |
### Prompt
Please provide a cpp coded solution to the problem described below:
A positive (strictly greater than zero) integer is called round if it is of the form d00...0. In other words, a positive integer is round if all its digits except the leftmost (most significant) are equal to zero. In particular, all number... |
### Prompt
Please formulate a cpp solution to the following problem:
There are some beautiful girls in Arpa’s land as mentioned before.
Once Arpa came up with an obvious problem:
Given an array and a number x, count the number of pairs of indices i, j (1 ≤ i < j ≤ n) such that <image>, where <image> is bitwise xor ... |
### Prompt
Your task is to create a CPP solution to the following problem:
There are N points in a two-dimensional plane. The initial coordinates of the i-th point are (x_i, y_i). Now, each point starts moving at a speed of 1 per second, in a direction parallel to the x- or y- axis. You are given a character d_i that... |
### Prompt
Construct a Cpp code solution to the problem outlined:
This is the easy version of the problem. The difference is constraints on the number of wise men and the time limit. You can make hacks only if all versions of this task are solved.
n wise men live in a beautiful city. Some of them know each other.
F... |
### Prompt
Your task is to create a CPP solution to the following problem:
In this problem we consider a very simplified model of Barcelona city.
Barcelona can be represented as a plane with streets of kind x = c and y = c for every integer c (that is, the rectangular grid). However, there is a detail which makes Ba... |
### Prompt
Create a solution in CPP for the following problem:
You are given two integers a and b. You may perform any number of operations on them (possibly zero).
During each operation you should choose any positive integer x and set a := a - x, b := b - 2x or a := a - 2x, b := b - x. Note that you may choose diff... |
### Prompt
Construct a cpp code solution to the problem outlined:
Petya and Vasya are competing with each other in a new interesting game as they always do.
At the beginning of the game Petya has to come up with an array of N positive integers. Sum of all elements in his array should be equal to S. Then Petya has to... |
### Prompt
Please create a solution in CPP to the following problem:
There is an integer sequence A of length N whose values are unknown.
Given is an integer sequence B of length N-1 which is known to satisfy the following:
B_i \geq \max(A_i, A_{i+1})
Find the maximum possible sum of the elements of A.
Constraint... |
### Prompt
Create a solution in cpp for the following problem:
Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representi... |
### Prompt
Construct a cpp code solution to the problem outlined:
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 th... |
### Prompt
Please provide a cpp coded solution to the problem described below:
The R1 company wants to hold a web search championship. There were n computers given for the competition, each of them is connected to the Internet. The organizers believe that the data transfer speed directly affects the result. The highe... |
### Prompt
In Cpp, your task is to solve the following problem:
While Duff was resting in the beach, she accidentally found a strange array b0, b1, ..., bl - 1 consisting of l positive integers. This array was strange because it was extremely long, but there was another (maybe shorter) array, a0, ..., an - 1 that b c... |
### Prompt
Create a solution in Cpp for the following problem:
There are N lines in the xy-plane. The i-th line is represented by A_ix+B_iy=C_i. Any two lines among the N+2 lines, the above N lines plus the x-axis and y-axis, cross each other at exactly one point.
For each pair 1 \leq i < j \leq N, there is a car at... |
### Prompt
Please provide a cpp coded solution to the problem described below:
While Grisha was celebrating New Year with Ded Moroz, Misha gifted Sasha a small rectangular pond of size n × m, divided into cells of size 1 × 1, inhabited by tiny evil fishes (no more than one fish per cell, otherwise they'll strife!).
... |
### Prompt
Construct a Cpp code solution to the problem outlined:
There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. Here, h_1 < h_2 < \cdots < h_N holds.
There is a frog who is initially on Stone 1. He will repeat the following action some number of times to re... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Problem
If you bring an empty bottle of $ a $ milk, you can exchange it for a new bottle of $ b $ milk.
How many bottles of milk can Mr. Kawabayashi, who initially has a bottle of $ x $ milk, drink? Output the remainder after dividing by ... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Let's define a function f(p) on a permutation p as follows. Let g_i be the [greatest common divisor (GCD)](https://en.wikipedia.org/wiki/Greatest_common_divisor) of elements p_1, p_2, ..., p_i (in other words, it is the GCD of the prefix o... |
### Prompt
Generate a CPP solution to the following problem:
Dasha decided to have a rest after solving the problem. She had been ready to start her favourite activity — origami, but remembered the puzzle that she could not solve.
<image>
The tree is a non-oriented connected graph without cycles. In particular, th... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Koto Municipal Subway
Koto Municipal Subway
Koto City is a famous city whose roads are in a grid pattern, as shown in the figure below. The roads extending from north to south and the roads extending from east to west are lined up at intervals of 1 k... |
### Prompt
Generate a CPP solution to the following problem:
Lee is used to finish his stories in a stylish way, this time he barely failed it, but Ice Bear came and helped him. Lee is so grateful for it, so he decided to show Ice Bear his new game called "Critic"...
The game is a one versus one game. It has t round... |
### Prompt
In CPP, your task is to solve the following problem:
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 takes ... |
### Prompt
Create a solution in CPP for the following problem:
Ujan needs some rest from cleaning, so he started playing with infinite sequences. He has two integers n and k. He creates an infinite sequence s by repeating the following steps.
1. Find k smallest distinct positive integers that are not in s. Let's c... |
### Prompt
Create a solution in cpp for the following problem:
So, the New Year holidays are over. Santa Claus and his colleagues can take a rest and have guests at last. When two "New Year and Christmas Men" meet, thear assistants cut out of cardboard the letters from the guest's name and the host's name in honor of... |
### Prompt
Please formulate a Cpp solution to the following problem:
For a sequence of integers $A = \\{a_0, a_1, ..., a_{n-1}\\}$ which is sorted by ascending order, eliminate all equivalent elements.
Constraints
* $1 \leq n \leq 100,000$
* $-1000,000,000 \leq a_i \leq 1,000,000,000$
* $a_0 \leq a_1 \leq ... \leq ... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
After you had helped Fedor to find friends in the «Call of Soldiers 3» game, he stopped studying completely. Today, the English teacher told him to prepare an essay. Fedor didn't want to prepare the essay, so he asked Alex for help. Alex c... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more... |
### Prompt
Create a solution in Cpp for the following problem:
A great king of a certain country suddenly decided to visit the land of a friendly country. The country is famous for trains, and the king visits various stations.
There are 52 train stations, each with a single uppercase or lowercase alphabetic name (no... |
### Prompt
Create a solution in CPP for the following problem:
Beroffice text editor has a wide range of features that help working with text. One of the features is an automatic search for typos and suggestions of how to fix them.
Beroffice works only with small English letters (i.e. with 26 letters from a to z). B... |
### Prompt
Create a solution in Cpp for the following problem:
Nothing has changed since the last round. Dima and Inna still love each other and want to be together. They've made a deal with Seryozha and now they need to make a deal with the dorm guards...
There are four guardposts in Dima's dorm. Each post contains... |
### Prompt
Construct a CPP code solution to the problem outlined:
In a small but very proud high school it was decided to win ACM ICPC. This goal requires to compose as many teams of three as possible, but since there were only 6 students who wished to participate, the decision was to build exactly two teams.
After ... |
### Prompt
Your task is to create a Cpp solution to the following problem:
We'll call a sequence of integers a good k-d sequence if we can add to it at most k numbers in such a way that after the sorting the sequence will be an arithmetic progression with difference d.
You got hold of some sequence a, consisting of ... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
You are given an array a consisting of n positive integers. You pick two integer numbers l and r from 1 to n, inclusive (numbers are picked randomly, equiprobably and independently). If l > r, then you swap values of l and r. You have to c... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Ksusha the Squirrel is standing at the beginning of a straight road, divided into n sectors. The sectors are numbered 1 to n, from left to right. Initially, Ksusha stands in sector 1.
Ksusha wants to walk to the end of the road, that is, get to secto... |
### Prompt
Construct a Cpp code solution to the problem outlined:
After your debut mobile game "Nim" blew up, you decided to make a sequel called "Nim 2". This game will expand on the trusted Nim game formula, adding the much awaited second heap!
In the game, there are two heaps, each containing a non-negative numb... |
### Prompt
Develop a solution in CPP to the problem described below:
Kyoya Ootori wants to take the train to get to school. There are n train stations and m one-way train lines going between various stations. Kyoya is currently at train station 1, and the school is at station n. To take a train, he must pay for a tic... |
### Prompt
Develop a solution in Cpp to the problem described below:
Gerald found a table consisting of n rows and m columns. As a prominent expert on rectangular tables, he immediately counted the table's properties, that is, the minimum of the numbers in the corners of the table (minimum of four numbers). However, ... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Alice and Bob are playing a game with a string of characters, with Alice going first. The string consists n characters, each of which is one of the first k letters of the alphabet. On a player’s turn, they can either arbitrarily permute the ch... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
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... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Arkady and his friends love playing checkers on an n × n field. The rows and the columns of the field are enumerated from 1 to n.
The friends have recently won a championship, so Arkady wants to please them with some candies. Remembering ... |
### Prompt
Construct a cpp code solution to the problem outlined:
Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinat... |
### Prompt
Please provide a CPP coded solution to the problem described below:
Please notice the unusual memory limit of this problem.
Orac likes games. Recently he came up with the new game, "Game of Life".
You should play this game on a black and white grid with n rows and m columns. Each cell is either black or ... |
### Prompt
In CPP, your task is to solve the following problem:
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to h... |
### Prompt
Please formulate a Cpp solution to the following problem:
Little Petya loves looking for numbers' divisors. One day Petya came across the following problem:
You are given n queries in the form "xi yi". For each query Petya should count how many divisors of number xi divide none of the numbers xi - yi, xi ... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
You are given two lists of segments [al_1, ar_1], [al_2, ar_2], ..., [al_n, ar_n] and [bl_1, br_1], [bl_2, br_2], ..., [bl_n, br_n].
Initially, all segments [al_i, ar_i] are equal to [l_1, r_1] and all segments [bl_i, br_i] are equal to [... |
### Prompt
Please formulate a cpp solution to the following problem:
N people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green.
The person numbered i says:
* "In front of me, exactly A_i people are wearing hats with the same color as mine."
... |
### Prompt
Generate a Cpp solution to the following problem:
Jeff's friends know full well that the boy likes to get sequences and arrays for his birthday. Thus, Jeff got sequence p1, p2, ..., pn for his birthday.
Jeff hates inversions in sequences. An inversion in sequence a1, a2, ..., an is a pair of indexes i, j ... |
### Prompt
Develop a solution in cpp to the problem described below:
Farmer John is obsessed with making Bessie exercise more!
Bessie is out grazing on the farm, which consists of n fields connected by m directed roads. Each road takes some time w_i to cross. She is currently at field 1 and will return to her home a... |
### Prompt
Please create a solution in CPP 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
Please formulate a CPP solution to the following problem:
The company X has n employees numbered from 1 through n. Each employee u has a direct boss p_u (1 ≤ p_u ≤ n), except for the employee 1 who has no boss. It is guaranteed, that values p_i form a tree. Employee u is said to be in charge of employee v ... |
### Prompt
Please formulate a Cpp solution to the following problem:
You are given two strings x and y, both consist only of lowercase Latin letters. Let |s| be the length of string s.
Let's call a sequence a a merging sequence if it consists of exactly |x| zeros and exactly |y| ones in some order.
A merge z is pro... |
### Prompt
In Cpp, your task is to solve the following problem:
RedDreamer has an array a consisting of n non-negative integers, and an unlucky integer T.
Let's denote the misfortune of array b having length m as f(b) — the number of pairs of integers (i, j) such that 1 ≤ i < j ≤ m and b_i + b_j = T. RedDreamer has ... |
### Prompt
Create a solution in CPP for the following problem:
Most C/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use.
In this problem we consider the following model of #define constru... |
### Prompt
Your task is to create a CPP solution to the following problem:
Given is a positive integer N. Consider repeatedly applying the operation below on N:
* First, choose a positive integer z satisfying all of the conditions below:
* z can be represented as z=p^e, where p is a prime number and e is a positive ... |
### Prompt
Construct a cpp code solution to the problem outlined:
Genos and Saitama went shopping for Christmas trees. However, a different type of tree caught their attention, the exalted Power Tree.
A Power Tree starts out as a single root vertex indexed 1. A Power Tree grows through a magical phenomenon known as... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Nicholas, a painter is going to paint several new canvases. Nicholas is sure that the canvases will turn out so great that each one will need framing and being hung on the wall. Frames are what Nicholas decided to begin with.
Nicholas ha... |
### Prompt
Your task is to create a cpp solution to the following problem:
Everyone loves a freebie. Especially students.
It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass... |
### Prompt
Please formulate a CPP solution to the following problem:
Vasya became interested in bioinformatics. He's going to write an article about similar cyclic DNA sequences, so he invented a new method for determining the similarity of cyclic sequences.
Let's assume that strings s and t have the same length n, ... |
### Prompt
Please formulate a CPP solution to the following problem:
On a two-dimensional plane, there are m lines drawn parallel to the x axis, and n lines drawn parallel to the y axis. Among the lines parallel to the x axis, the i-th from the bottom is represented by y = y_i. Similarly, among the lines parallel to ... |
### Prompt
Create a solution in CPP for the following problem:
Little penguin Polo adores strings. But most of all he adores strings of length n.
One day he wanted to find a string that meets the following conditions:
1. The string consists of n lowercase English letters (that is, the string's length equals n), e... |
### Prompt
Create a solution in Cpp for the following problem:
People like to be fit. That's why many of them are ready to wake up at dawn, go to the stadium and run. In this problem your task is to help a company design a new stadium.
The city of N has a shabby old stadium. Many people like it and every morning th... |
### Prompt
Please provide a CPP coded solution to the problem described below:
Takahashi will do a tap dance. The dance is described by a string S where each character is `L`, `R`, `U`, or `D`. These characters indicate the positions on which Takahashi should step. He will follow these instructions one by one in orde... |
### Prompt
Your task is to create a cpp solution to the following problem:
A permutation p of size n is an array such that every integer from 1 to n occurs exactly once in this array.
Let's call a permutation an almost identity permutation iff there exist at least n - k indices i (1 ≤ i ≤ n) such that pi = i.
Your ... |
### Prompt
Generate a cpp solution to the following problem:
As you could know there are no male planes nor female planes. However, each plane on Earth likes some other plane. There are n planes on Earth, numbered from 1 to n, and the plane with number i likes the plane with number fi, where 1 ≤ fi ≤ n and fi ≠ i.
W... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Given simple (without self-intersections) n-gon. It is not necessary convex. Also you are given m lines. For each line find the length of common part of the line and the n-gon.
The boundary of n-gon belongs to polygon. It is possible that n-g... |
### Prompt
Construct a CPP code solution to the problem outlined:
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a cl... |
### Prompt
Generate a cpp solution to the following problem:
Dante is engaged in a fight with "The Savior". Before he can fight it with his sword, he needs to break its shields. He has two guns, Ebony and Ivory, each of them is able to perform any non-negative number of shots.
For every bullet that hits the shield, ... |
### Prompt
Construct a Cpp code solution to the problem outlined:
DO YOU EXPECT ME TO FIND THIS OUT?
WHAT BASE AND/XOR LANGUAGE INCLUDES string?
DON'T BYTE OF MORE THAN YOU CAN CHEW
YOU CAN ONLY DISTORT THE LARGEST OF MATHEMATICS SO FAR
SAYING "ABRACADABRA" WITHOUT A MAGIC AND WON'T DO YOU ANY GOOD
THE LAST STAC... |
### Prompt
Your task is to create a cpp solution to the following problem:
Ryouko is an extremely forgetful girl, she could even forget something that has just happened. So in order to remember, she takes a notebook with her, called Ryouko's Memory Note. She writes what she sees and what she hears on the notebook, an... |
### Prompt
Please provide a CPP coded solution to the problem described below:
There are N people living on a number line.
The i-th person lives at coordinate X_i.
You are going to hold a meeting that all N people have to attend.
The meeting can be held at any integer coordinate. If you choose to hold the meeting ... |
### Prompt
Create a solution in Cpp for the following problem:
Koa the Koala has a binary string s of length n. Koa can perform no more than n-1 (possibly zero) operations of the following form:
In one operation Koa selects positions i and i+1 for some i with 1 ≤ i < |s| and sets s_i to max(s_i, s_{i+1}). Then Koa d... |
### Prompt
Your task is to create a CPP solution to the following problem:
Some of you know an old story of Voronoi Island. There were N liege lords and they are always involved in territorial disputes. The residents of the island were despaired of the disputes.
One day, a clever lord proposed to stop the disputes a... |
### Prompt
Please formulate a Cpp solution to the following problem:
The Little Elephant very much loves sums on intervals.
This time he has a pair of integers l and r (l ≤ r). The Little Elephant has to find the number of such integers x (l ≤ x ≤ r), that the first digit of integer x equals the last one (in decimal... |
### Prompt
In Cpp, your task is to solve the following problem:
Polycarpus analyzes a string called abracadabra. This string is constructed using the following algorithm:
* On the first step the string consists of a single character "a".
* On the k-th step Polycarpus concatenates two copies of the string obtai... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
All techniques in the ninja world consist of hand seals. At the moment Naruto is learning a new technique, which consists of n⋅ m different seals, denoted by distinct numbers. All of them were written in an n× m table.
The table is lost n... |
### Prompt
Construct a cpp code solution to the problem outlined:
A group of n schoolboys decided to ride bikes. As nobody of them has a bike, the boys need to rent them.
The renting site offered them m bikes. The renting price is different for different bikes, renting the j-th bike costs pj rubles.
In total, the b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.