text stringlengths 424 69.5k |
|---|
### Prompt
Please provide a CPP coded solution to the problem described below:
Molly Hooper has n different kinds of chemicals arranged in a line. Each of the chemicals has an affection value, The i-th of them has affection value ai.
Molly wants Sherlock to fall in love with her. She intends to do this by mixing a c... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Dasha decided to have a rest after solving the problem D and began to look photos from previous competitions.
Let's call photos as the matrix with the size n × m, which consists of lowercase English letters.
Some k photos especially inte... |
### Prompt
Generate a CPP solution to the following problem:
Appleman has a tree with n vertices. Some of the vertices (at least one) are colored black and other vertices are colored white.
Consider a set consisting of k (0 ≤ k < n) edges of Appleman's tree. If Appleman deletes these edges from the tree, then it wil... |
### Prompt
In CPP, your task is to solve the following problem:
Connect the countless points with lines, till we reach the faraway yonder.
There are n points on a coordinate plane, the i-th of which being (i, yi).
Determine whether it's possible to draw two parallel and non-overlapping lines, such that every point ... |
### Prompt
Please formulate a CPP solution to the following problem:
Write a program which manipulates a sequence A = {a0, a1, . . . , an−1} with the following operations:
* update(s, t, x): change as, as+1, ..., at to x.
* find(s, t): report the minimum element in as, as+1, ..., at.
Note that the initial values ... |
### Prompt
Create a solution in cpp for the following problem:
When Petya has free from computer games time, he attends university classes. Every day the lessons on Petya’s faculty consist of two double classes. The floor where the lessons take place is a long corridor with M classrooms numbered from 1 to M, situated... |
### Prompt
In CPP, your task is to solve the following problem:
I won't feel lonely, nor will I be sorrowful... not before everything is buried.
A string of n beads is left as the message of leaving. The beads are numbered from 1 to n from left to right, each having a shape numbered by integers between 1 and n inclu... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
There are X+Y+Z people, conveniently numbered 1 through X+Y+Z. Person i has A_i gold coins, B_i silver coins and C_i bronze coins.
Snuke is thinking of getting gold coins from X of those people, silver coins from Y of the people and bronz... |
### Prompt
Please formulate a Cpp solution to the following problem:
problem
The IOI country consists of N towns from town 1 to town N, and the towns are connected by roads. The IOI country has K roads, all of which connect two different towns. Cars can move freely in both directions on the road, but they cannot go ... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Valera loves to participate in competitions. Especially in programming contests. Today he has participated in the contest with his team, consisting of n students (including Valera). This contest was an individual competition, so each stude... |
### Prompt
Develop a solution in Cpp to the problem described below:
Alyona has a tree with n vertices. The root of the tree is the vertex 1. In each vertex Alyona wrote an positive integer, in the vertex i she wrote ai. Moreover, the girl wrote a positive integer to every edge of the tree (possibly, different intege... |
### Prompt
Construct a cpp code solution to the problem outlined:
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 all t... |
### Prompt
Construct a CPP code solution to the problem outlined:
Limak is going to participate in a contest on the last day of the 2016. The contest will start at 20:00 and will last four hours, exactly until midnight. There will be n problems, sorted by difficulty, i.e. problem 1 is the easiest and problem n is the... |
### Prompt
Generate a cpp solution to the following problem:
There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, …, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 ≤ i_1 < i_2 < i_... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya loves long lucky numbers... |
### Prompt
Create a solution in Cpp for the following problem:
Welcome! Everything is fine.
You have arrived in The Medium Place, the place between The Good Place and The Bad Place. You are assigned a task that will either make people happier or torture them for eternity.
You have a list of k pairs of people who ha... |
### Prompt
Please formulate a CPP solution to the following problem:
The determinant of a matrix 2 × 2 is defined as follows:
<image>
A matrix is called degenerate if its determinant is equal to zero.
The norm ||A|| of a matrix A is defined as a maximum of absolute values of its elements.
You are given a matrix ... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
In the city, there are two pastry shops. One shop was very popular because its cakes are pretty tasty. However, there was a man who is displeased at the shop. He was an owner of another shop. Although cause of his shop's unpopularity is in... |
### Prompt
Construct a cpp code solution to the problem outlined:
Takahashi has received an undirected graph with N vertices, numbered 1, 2, ..., N. The edges in this graph are represented by (u_i, v_i). There are no self-loops and multiple edges in this graph.
Based on this graph, Takahashi is now constructing a ne... |
### Prompt
In Cpp, your task is to solve the following problem:
In Dwango Co., Ltd., there is a content distribution system named 'Dwango Media Cluster', and it is called 'DMC' for short.
The name 'DMC' sounds cool for Niwango-kun, so he starts to define DMC-ness of a string.
Given a string S of length N and an inte... |
### Prompt
In CPP, your task is to solve the following problem:
The spring is coming and it means that a lot of fruits appear on the counters. One sunny day little boy Valera decided to go shopping. He made a list of m fruits he wanted to buy. If Valera want to buy more than one fruit of some kind, he includes it int... |
### Prompt
Create a solution in Cpp for the following problem:
It is known that passages in Singer house are complex and intertwined. Let's define a Singer k-house as a graph built by the following process: take complete binary tree of height k and add edges from each vertex to all its successors, if they are not yet... |
### Prompt
Please create a solution in cpp to the following problem:
You are given a string s=s_1s_2... s_n of length n, which only contains digits 1, 2, ..., 9.
A substring s[l ... r] of s is a string s_l s_{l + 1} s_{l + 2} … s_r. A substring s[l ... r] of s is called even if the number represented by it is even. ... |
### Prompt
Generate 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 came to help and wr... |
### Prompt
Please provide a CPP coded solution to the problem described below:
T is playing a game with his friend, HL.
There are n piles of stones, the i-th pile initially has a_i stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a s... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Bob likes to draw camels: with a single hump, two humps, three humps, etc. He draws a camel by connecting points on a coordinate plane. Now he's drawing camels with t humps, representing them as polylines in the plane. Each polyline consis... |
### Prompt
Your task is to create a Cpp solution to the following problem:
The country of Reberland is the archenemy of Berland. Recently the authorities of Berland arrested a Reberlandian spy who tried to bring the leaflets intended for agitational propaganda to Berland illegally . The most leaflets contain substrin... |
### Prompt
Develop a solution in CPP to the problem described below:
The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good:
* Elements of the main diagonal.
* Elements of the seconda... |
### Prompt
Develop a solution in Cpp to the problem described below:
There are n sharks who grow flowers for Wet Shark. They are all sitting around the table, such that sharks i and i + 1 are neighbours for all i from 1 to n - 1. Sharks n and 1 are neighbours too.
Each shark will grow some number of flowers si. For ... |
### Prompt
Your task is to create a cpp solution to the following problem:
There are well-known formulas: <image>, <image>, <image>. Also mathematicians found similar formulas for higher degrees.
Find the value of the sum <image> modulo 109 + 7 (so you should find the remainder after dividing the answer by the value... |
### Prompt
Please formulate a Cpp solution to the following problem:
A lot of people associate Logo programming language with turtle graphics. In this case the turtle moves along the straight line and accepts commands "T" ("turn around") and "F" ("move 1 unit forward").
You are given a list of commands that will be ... |
### Prompt
Please formulate a CPP solution to the following problem:
You are given an array of integers b_1, b_2, …, b_n.
An array a_1, a_2, …, a_n of integers is hybrid if for each i (1 ≤ i ≤ n) at least one of these conditions is true:
* b_i = a_i, or
* b_i = ∑_{j=1}^{i} a_j.
Find the number of hybrid a... |
### Prompt
Please formulate a CPP solution to the following problem:
The subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements.
You are given an integer n.
You have to find a sequence s consisting of digits \{1, 3, 7\} suc... |
### Prompt
Please provide a CPP coded solution to the problem described below:
problem
JOI decided to make a signboard for the store.
There are N old signboards with letters written at equal intervals. JOI makes a sign by erasing some letters from the old sign. I want the remaining characters to be the name of the ... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Snuke is buying a lamp. The light of the lamp can be adjusted to m levels of brightness, represented by integers from 1 through m, by the two buttons on the remote control.
The first button is a "forward" button. When this button is press... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
A tree is a graph with n vertices and exactly n - 1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices.
A subtree of a tree T is a tree with ... |
### Prompt
Generate a cpp solution to the following problem:
Recently personal training sessions have finished in the Berland State University Olympiad Programmer Training Centre. By the results of these training sessions teams are composed for the oncoming team contest season. Each team consists of three people. All... |
### Prompt
Create a solution in CPP for the following problem:
Kolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle.
More formally, there are 3n gnomes sitting in a circle. Each gnome can have from 1 to 3... |
### Prompt
Create a solution in CPP for the following problem:
A factory produces thimbles in bulk. Typically, it can produce up to a thimbles a day. However, some of the machinery is defective, so it can currently only produce b thimbles each day. The factory intends to choose a k-day period to do maintenance and co... |
### Prompt
Develop a solution in cpp to the problem described below:
Let's call an array of non-negative integers a_1, a_2, …, a_n a k-extension for some non-negative integer k if for all possible pairs of indices 1 ≤ i, j ≤ n the inequality k ⋅ |i - j| ≤ min(a_i, a_j) is satisfied. The expansion coefficient of the a... |
### Prompt
Please create a solution in Cpp to the following problem:
Luke Skywalker got locked up in a rubbish shredder between two presses. R2D2 is already working on his rescue, but Luke needs to stay alive as long as possible. For simplicity we will assume that everything happens on a straight line, the presses ar... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
You are going to the beach with the idea to build the greatest sand castle ever in your head! The beach is not as three-dimensional as you could have imagined, it can be decribed as a line of spots to pile up sand pillars. Spots are number... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Robot Doc is located in the hall, with n computers stand in a line, numbered from left to right from 1 to n. Each computer contains exactly one piece of information, each of which Doc wants to get eventually. The computers are equipped wit... |
### Prompt
Develop a solution in CPP to the problem described below:
Emuskald is a well-known illusionist. One of his trademark tricks involves a set of magical boxes. The essence of the trick is in packing the boxes inside other boxes.
From the top view each magical box looks like a square with side length equal to... |
### Prompt
Construct a cpp code solution to the problem outlined:
You have a coins of value n and b coins of value 1. You always pay in exact change, so you want to know if there exist such x and y that if you take x (0 ≤ x ≤ a) coins of value n and y (0 ≤ y ≤ b) coins of value 1, then the total value of taken coins ... |
### Prompt
Construct a CPP code solution to the problem outlined:
Petya has an array a consisting of n integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to another in t... |
### Prompt
Construct a cpp code solution to the problem outlined:
Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well.
Today's training is to gain the power of business by running around the city and conducting trade.
I want to earn as m... |
### Prompt
Please create a solution in CPP to the following problem:
This problem's actual name, "Lexicographically Largest Palindromic Subsequence" is too long to fit into the page headline.
You are given string s consisting of lowercase English letters only. Find its lexicographically largest palindromic subsequen... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Priests of the Quetzalcoatl cult want to build a tower to represent a power of their god. Tower is usually made of power-charged rocks. It is built with the help of rare magic by levitating the current top of tower and adding rocks at its ... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Optimizing the amount of data transmitted via a network is an important and interesting part of developing any network application.
<image>
In one secret game developed deep in the ZeptoLab company, the game universe consists of n levels, located in ... |
### Prompt
Develop a solution in cpp to the problem described below:
There are n stones arranged on an axis. Initially the i-th stone is located at the coordinate s_i. There may be more than one stone in a single place.
You can perform zero or more operations of the following type:
* take two stones with indices... |
### Prompt
Please formulate 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 sister seems... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Igor the analyst is at work. He learned about a feature in his text editor called "Replace All". Igor is too bored at work and thus he came up with the following problem:
Given two strings x and y which consist of the English letters 'A' and ... |
### Prompt
Generate a Cpp solution to the following problem:
A direced graph is strongly connected if every two nodes are reachable from each other. In a strongly connected component of a directed graph, every two nodes of the component are mutually reachable.
Constraints
* 1 ≤ |V| ≤ 10,000
* 0 ≤ |E| ≤ 30,000
* 1 ≤... |
### Prompt
Please formulate a Cpp solution to the following problem:
There are n people who want to participate in a boat competition. The weight of the i-th participant is w_i. Only teams consisting of two people can participate in this competition. As an organizer, you think that it's fair to allow only teams with ... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Masha and Grisha like studying sets of positive integers.
One day Grisha has written a set A containing n different integers ai on a blackboard. Now he asks Masha to create a set B containing n different integers bj such that all n2 integers that can ... |
### Prompt
Please formulate a cpp solution to the following problem:
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.
Pinkie Pie eats the patty-ca... |
### Prompt
Develop a solution in cpp to the problem described below:
There are N dishes, numbered 1, 2, \ldots, N. Initially, for each i (1 \leq i \leq N), Dish i has a_i (1 \leq a_i \leq 3) pieces of sushi on it.
Taro will perform the following operation repeatedly until all the pieces of sushi are eaten:
* Roll a... |
### Prompt
In cpp, your task is to solve the following problem:
Yuezheng Ling gives Luo Tianyi a tree which has n nodes, rooted at 1.
Luo Tianyi will tell you that the parent of the i-th node is a_i (1 ≤ a_i<i for 2 ≤ i ≤ n), and she will ask you to perform q queries of 2 types:
1. She'll give you three integers... |
### Prompt
Your task is to create a cpp solution to the following problem:
There is a set of cards with positive integers written on them. Stack the cards to make several piles and arrange them side by side. Select two adjacent piles of cards from them, and stack the left pile on top of the right pile. Repeat this op... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Takahashi will play a game using a piece on an array of squares numbered 1, 2, \cdots, N. Square i has an integer C_i written on it. Also, he is given a permutation of 1, 2, \cdots, N: P_1, P_2, \cdots, P_N.
Now, he will choose one square and... |
### Prompt
Please formulate a CPP solution to the following problem:
There is a sequence of length 2N: A_1, A_2, ..., A_{2N}. Each A_i is either -1 or an integer between 1 and 2N (inclusive). Any integer other than -1 appears at most once in {A_i}.
For each i such that A_i = -1, Snuke replaces A_i with an integer be... |
### Prompt
Your task is to create a CPP solution to the following problem:
Recently Roma has become the happy owner of a new game World of Darkraft. This game combines elements of virtually all known genres, and on one of the later stages of the game Roma faced difficulties solving a puzzle.
In this part Roma fights... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Two best friends Serozha and Gena play a game.
Initially there is one pile consisting of n stones on the table. During one move one pile should be taken and divided into an arbitrary number of piles consisting of a1 > a2 > ... > ak > 0 st... |
### Prompt
In CPP, your task is to solve the following problem:
You have probably learnt chemical equations (chemical reaction formulae) in your high-school days. The following are some well-known equations.
2H2 + O2 -> 2H2O (1)
Ca(OH)2 + CO2 -> CaCO3 + H2O ... |
### Prompt
Develop a solution in Cpp to the problem described below:
Famous Brazil city Rio de Janeiro holds a tennis tournament and Ostap Bender doesn't want to miss this event. There will be n players participating, and the tournament will follow knockout rules from the very first game. That means, that if someone ... |
### Prompt
Construct a Cpp code solution to the problem outlined:
You are an assistant director in a new musical play. The play consists of n musical parts, each part must be performed by exactly one actor. After the casting the director chose m actors who can take part in the play. Your task is to assign the parts t... |
### Prompt
Please create a solution in Cpp to the following problem:
Polycarp studies at the university in the group which consists of n students (including himself). All they are registrated in the social net "TheContacnt!".
Not all students are equally sociable. About each student you know the value ai — the maxim... |
### Prompt
Construct a CPP code solution to the problem outlined:
Graph constructive problems are back! This time the graph you are asked to build should match the following properties.
The graph is connected if and only if there exists a path between every pair of vertices.
The diameter (aka "longest shortest path... |
### Prompt
Create a solution in cpp for the following problem:
Leha somehow found an array consisting of n integers. Looking at it, he came up with a task. Two players play the game on the array. Players move one by one. The first player can choose for his move a subsegment of non-zero length with an odd sum of numbe... |
### Prompt
In cpp, your task is to solve the following problem:
There is a square grid with N rows and M columns. Each square contains an integer: 0 or 1. The square at the i-th row from the top and the j-th column from the left contains a_{ij}.
Among the 2^{N+M} possible pairs of a subset A of the rows and a subset... |
### Prompt
Please formulate a CPP solution to the following problem:
Takahashi is going to buy N items one by one.
The price of the i-th item he buys is A_i yen (the currency of Japan).
He has M discount tickets, and he can use any number of them when buying an item.
If Y tickets are used when buying an item price... |
### Prompt
Develop a solution in cpp to the problem described below:
After a long day, Alice and Bob decided to play a little game. The game board consists of n cells in a straight line, numbered from 1 to n, where each cell contains a number a_i between 1 and n. Furthermore, no two cells contain the same number.
A... |
### Prompt
Develop a solution in cpp to the problem described below:
Kolya has a turtle and a field of size 2 × n. The field rows are numbered from 1 to 2 from top to bottom, while the columns are numbered from 1 to n from left to right.
Suppose in each cell of the field there is a lettuce leaf. The energy value of ... |
### Prompt
Create a solution in cpp for the following problem:
You are going to eat X red apples and Y green apples.
You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C.
Before eating a colorless a... |
### Prompt
Create a solution in CPP for the following problem:
Arkady is playing Battleship. The rules of this game aren't really important.
There is a field of n × n cells. There should be exactly one k-decker on the field, i. e. a ship that is k cells long oriented either horizontally or vertically. However, Arkad... |
### Prompt
Please create a solution in cpp to the following problem:
A two dimensional array is called a bracket array if each grid contains one of the two possible brackets — "(" or ")". A path through the two dimensional array cells is called monotonous if any two consecutive cells in the path are side-adjacent and... |
### Prompt
Please formulate a Cpp solution to the following problem:
In this problem at each moment you have a set of intervals. You can move from interval (a, b) from our set to interval (c, d) from our set if and only if c < a < d or c < b < d. Also there is a path from interval I1 from our set to interval I2 from ... |
### Prompt
Generate a Cpp solution to the following problem:
Levko has an array that consists of integers: a1, a2, ... , an. But he doesn’t like this array at all.
Levko thinks that the beauty of the array a directly depends on value c(a), which can be calculated by the formula:
<image> The less value c(a) is, the... |
### Prompt
Develop a solution in Cpp to the problem described below:
You are given several queries. Each query consists of three integers p, q and b. You need to answer whether the result of p/q in notation with base b is a finite fraction.
A fraction in notation with base b is finite if it contains finite number of... |
### Prompt
Please create a solution in cpp to the following problem:
problem
There are n cards with numbers from 1 to n. First, make a pile of cards by stacking them in order so that the top is the number 1 card, the second from the top is the number 2 card, ..., and the bottom is the number n card.
<image>
Sort... |
### Prompt
In cpp, your task is to solve the following problem:
There are N points in a D-dimensional space.
The coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).
The distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ..... |
### Prompt
Develop a solution in Cpp to the problem described below:
Stepan had a favorite string s which consisted of the lowercase letters of the Latin alphabet.
After graduation, he decided to remember it, but it was a long time ago, so he can't now remember it. But Stepan remembers some information about the st... |
### Prompt
Generate a Cpp solution to the following problem:
The last stage of Football World Cup is played using the play-off system.
There are n teams left in this stage, they are enumerated from 1 to n. Several rounds are held, in each round the remaining teams are sorted in the order of their ids, then the first... |
### Prompt
Please create a solution in Cpp to the following problem:
It seems that Borya is seriously sick. He is going visit n doctors to find out the exact diagnosis. Each of the doctors needs the information about all previous visits, so Borya has to visit them in the prescribed order (i.e. Borya should first visi... |
### Prompt
Please provide a CPP coded solution to the problem described below:
We have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i. Vertex i has an integer a_i written on it. For every integer k from 1 through N, solve the following problem:
* We will make a sequence by lining up the i... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
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 th... |
### Prompt
Construct a CPP code solution to the problem outlined:
Appleman and Toastman like games. Today they play a game with strings with the following rules. Firstly Toastman tells Appleman two strings s and t both consisting only of letters 'A', 'B', 'C', 'D'. Then Appleman must build string s as quickly as poss... |
### Prompt
Please create a solution in cpp to the following problem:
Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of n integers a_i.
It is allowed to select any subset of them, ... |
### Prompt
In CPP, your task is to solve the following problem:
Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the floor number a. You are very bored, so you want to take the l... |
### Prompt
Please formulate a Cpp solution to the following problem:
Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ).
Consider a sequence A satisfying the following conditions:
* A is a sequence of N positive integers.
* 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M.
... |
### Prompt
Please formulate a CPP solution to the following problem:
The tournament «Sleepyhead-2010» in the rapid falling asleep has just finished in Berland. n best participants from the country have participated in it. The tournament consists of games, each of them is a match between two participants. n·(n - 1) / ... |
### Prompt
Construct a Cpp code solution to the problem outlined:
As behooves any intelligent schoolboy, Kevin Sun is studying psycowlogy, cowculus, and cryptcowgraphy at the Bovinia State University (BGU) under Farmer Ivan. During his Mathematics of Olympiads (MoO) class, Kevin was confronted with a weird functional... |
### Prompt
In CPP, your task is to solve the following problem:
You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room.
For each notice, you are given four integers b, f, ... |
### Prompt
Generate a Cpp solution to the following problem:
Let us call a pair of integer numbers m-perfect, if at least one number in the pair is greater than or equal to m. Thus, the pairs (3, 3) and (0, 2) are 2-perfect while the pair (-1, 1) is not.
Two integers x, y are written on the blackboard. It is allowed... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
There are league games and tournament games in sports competitions. In soccer league games, points are given to each of the wins, losses, and draws, and the rankings are competed based on the points. The points are win (3 points), negative... |
### Prompt
Construct a cpp code solution to the problem outlined:
Summer is coming! It's time for Iahub and Iahubina to work out, as they both want to look hot at the beach. The gym where they go is a matrix a with n lines and m columns. Let number a[i][j] represents the calories burned by performing workout at the c... |
### Prompt
In Cpp, your task is to solve the following problem:
There was an electronic store heist last night.
All keyboards which were in the store yesterday were numbered in ascending order from some integer number x. For example, if x = 4 and there were 3 keyboards in the store, then the devices had indices 4, 5... |
### Prompt
Please create a solution in CPP to the following problem:
Bessie has way too many friends because she is everyone's favorite cow! Her new friend Rabbit is trying to hop over so they can play!
More specifically, he wants to get from (0,0) to (x,0) by making multiple hops. He is only willing to hop from on... |
### Prompt
Please formulate a CPP solution to the following problem:
You are given a string s of length n, consisting of first k lowercase English letters.
We define a c-repeat of some string q as a string, consisting of c copies of the string q. For example, string "acbacbacbacb" is a 4-repeat of the string "acb".
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.