text stringlengths 424 69.5k |
|---|
### Prompt
Construct a CPP code solution to the problem outlined:
Naruto has sneaked into the Orochimaru's lair and is now looking for Sasuke. There are T rooms there. Every room has a door into it, each door can be described by the number n of seals on it and their integer energies a_1, a_2, ..., a_n. All energies a... |
### Prompt
Please provide a cpp coded solution to the problem described below:
PMP is getting a warrior. He is practicing a lot, but the results are not acceptable yet. This time instead of programming contests, he decided to compete in a car racing to increase the spirit of victory. He decides to choose a competitio... |
### Prompt
Your task is to create a Cpp solution to the following problem:
A classroom in a school has six rows with 3 desks in each row. Two people can use the same desk: one sitting on the left and one sitting on the right.
Some places are already occupied, and some places are vacant. Petya has just entered the c... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
There is a legend in the IT City college. A student that failed to answer all questions on the game theory exam is given one more chance by his professor. The student has to play a game with the professor.
The game is played on a square f... |
### Prompt
Please create a solution in Cpp to the following problem:
The Hedgehog likes to give presents to his friend, but no less he likes to receive them.
Having received another present today, the Hedgehog suddenly understood that he has no place to put it as there was no room left on the special shelf in the cu... |
### Prompt
Please formulate a Cpp solution to the following problem:
There is a plane like Figure 1 with 8 vertical and 8 horizontal squares. There are several bombs on that plane. Figure 2 shows an example (β = bomb).
| β‘ | β‘ | β‘ | β‘ | β‘ | β‘ | β‘ | β‘
--- | --- | --- | --- | --- | --- | --- | ---
β‘ | β‘ | β‘ | β‘ | β‘ | ... |
### Prompt
Develop a solution in Cpp to the problem described below:
<image>
After William is done with work for the day, he enjoys playing his favorite video game.
The game happens in a 2D world, starting at turn 0. William can pick any cell in the game world and spawn in it. Then, each turn, William may remain at... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Recently an official statement of the world Olympic Committee said that the Olympic Winter Games 2030 will be held in Tomsk. The city officials decided to prepare for the Olympics thoroughly and to build all the necessary Olympic facilitie... |
### Prompt
Please provide a CPP coded solution to the problem described below:
Gargari got bored to play with the bishops and now, after solving the problem about them, he is trying to do math homework. In a math book he have found k permutations. Each of them consists of numbers 1, 2, ..., n in some order. Now he sh... |
### Prompt
Please create a solution in Cpp to the following problem:
You are given a rectangular board of M Γ N squares. Also you are given an unlimited number of standard domino pieces of 2 Γ 1 squares. You are allowed to rotate the pieces. You are asked to place as many dominoes as possible on the board so as to me... |
### Prompt
Create a solution in Cpp for the following problem:
Dr. Moriarty is about to send a message to Sherlock Holmes. He has a string s.
String p is called a substring of string s if you can read it starting from some position in the string s. For example, string "aba" has six substrings: "a", "b", "a", "ab", ... |
### Prompt
Your task is to create a CPP solution to the following problem:
Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up.
Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance o... |
### Prompt
Develop a solution in cpp to the problem described below:
Polycarp has decided to decorate his room because the New Year is soon. One of the main decorations that Polycarp will install is the garland he is going to solder himself.
Simple garlands consisting of several lamps connected by one wire are too b... |
### Prompt
Develop a solution in CPP to the problem described below:
Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).
Constraints
* 1 \leq N \leq 10^5
Input
Input is given from Standard Input in the following... |
### Prompt
Construct a CPP code solution to the problem outlined:
Taro and Hanako decided to play hit-and-blow. The hit-and-blow rules are as follows.
* Separated into questioners and respondents.
* The questioner decides a 4-digit number (correct answer) that does not include duplicate numbers.
* Respondents guess ... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Luba has to do n chores today. i-th chore takes ai units of time to complete. It is guaranteed that for every <image> the condition ai β₯ ai - 1 is met, so the sequence is sorted.
Also Luba can work really hard on some chores. She can choose not more t... |
### Prompt
Please formulate a CPP solution to the following problem:
While creating high loaded systems one should pay a special attention to caching. This problem will be about one of the most popular caching algorithms called LRU (Least Recently Used).
Suppose the cache may store no more than k objects. At the beg... |
### Prompt
Please create a solution in cpp to the following problem:
Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are clo... |
### Prompt
Your task is to create a CPP solution to the following problem:
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... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Mike has discovered a new way to encode permutations. If he has a permutation P = [p1, p2, ..., pn], he will encode it in the following way:
Denote by A = [a1, a2, ..., an] a sequence of length n which will represent the code of the permu... |
### Prompt
Develop a solution in Cpp to the problem described below:
Recently Monocarp got a job. His working day lasts exactly m minutes. During work, Monocarp wants to drink coffee at certain moments: there are n minutes a_1, a_2, ..., a_n, when he is able and willing to take a coffee break (for the sake of simplic... |
### Prompt
Create a solution in CPP for the following problem:
Kefa wants to celebrate his first big salary by going to restaurant. However, he needs company.
Kefa has n friends, each friend will agree to go to the restaurant if Kefa asks. Each friend is characterized by the amount of money he has and the friendshi... |
### Prompt
Please formulate a CPP solution to the following problem:
Sereja has an array a, consisting of n integers a1, a2, ..., an. The boy cannot sit and do nothing, he decided to study an array. Sereja took a piece of paper and wrote out m integers l1, l2, ..., lm (1 β€ li β€ n). For each number li he wants to know... |
### Prompt
Construct a cpp code solution to the problem outlined:
There are n cows playing poker at a table. For the current betting phase, each player's status is either "ALLIN", "IN", or "FOLDED", and does not change throughout the phase. To increase the suspense, a player whose current status is not "FOLDED" may s... |
### Prompt
Develop a solution in CPP to the problem described below:
A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a big month. A common year shall ... |
### Prompt
Please formulate a Cpp solution to the following problem:
You are given a bipartite graph: the first part of this graph contains n_1 vertices, the second part contains n_2 vertices, and there are m edges. The graph can contain multiple edges.
Initially, each edge is colorless. For each edge, you may eithe... |
### Prompt
Develop a solution in cpp to the problem described below:
We have a point A with coordinate x = n on OX-axis. We'd like to find an integer point B (also on OX-axis), such that the absolute difference between the distance from O to B and the distance from A to B is equal to k.
<image> The description of th... |
### Prompt
Please provide a cpp coded solution to the problem described below:
There is a matrix A of size x Γ y filled with integers. For every <image>, <image> Ai, j = y(i - 1) + j. Obviously, every integer from [1..xy] occurs exactly once in this matrix.
You have traversed some path in this matrix. Your path can... |
### Prompt
Develop a solution in CPP to the problem described below:
Sergey Semyonovich is a mayor of a county city N and he used to spend his days and nights in thoughts of further improvements of Nkers' lives. Unfortunately for him, anything and everything has been done already, and there are no more possible impro... |
### Prompt
Generate a CPP solution to the following problem:
At Moscow Workshops ICPC team gets a balloon for each problem they solved first. Team MSU Red Panda got so many balloons that they didn't know how to spend them. So they came up with a problem with them.
There are several balloons, not more than 10^6 in to... |
### Prompt
Please create a solution in cpp to the following problem:
Wilbur the pig really wants to be a beaver, so he decided today to pretend he is a beaver and bite at trees to cut them down.
There are n trees located at various positions on a line. Tree i is located at position xi. All the given positions of the... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Alice wants to send an email to Miku on her mobile phone.
The only buttons that can be used for input on mobile phones are number buttons. Therefore, in order to input characters, the number buttons are pressed several times to input char... |
### Prompt
Develop a solution in cpp to the problem described below:
Having stayed home alone, Petya decided to watch forbidden films on the Net in secret. "What ungentlemanly behavior!" β you can say that, of course, but don't be too harsh on the kid. In his country films about the Martians and other extraterrestria... |
### Prompt
Please formulate a Cpp solution to the following problem:
Let's look at the following process: initially you have an empty stack and an array s of the length l. You are trying to push array elements to the stack in the order s_1, s_2, s_3, ... s_{l}. Moreover, if the stack is empty or the element at the to... |
### Prompt
Develop a solution in cpp to the problem described below:
Limak is a grizzly bear. He is big and dreadful. You were chilling in the forest when you suddenly met him. It's very unfortunate for you. He will eat all your cookies unless you can demonstrate your mathematical skills. To test you, Limak is going ... |
### Prompt
In cpp, your task is to solve the following problem:
VK news recommendation system daily selects interesting publications of one of n disjoint categories for each user. Each publication belongs to exactly one category. For each category i batch algorithm selects a_i publications.
The latest A/B test sugge... |
### Prompt
In Cpp, your task is to solve the following problem:
Karen has just arrived at school, and she has a math test today!
<image>
The test is about basic addition and subtraction. Unfortunately, the teachers were too busy writing tasks for Codeforces rounds, and had no time to make an actual test. So, they j... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Little Artyom decided to study probability theory. He found a book with a lot of nice exercises and now wants you to help him with one of them.
Consider two dices. When thrown each dice shows some integer from 1 to n inclusive. For each dice ... |
### Prompt
Develop a solution in cpp to the problem described below:
The Smart Beaver from ABBYY has a long history of cooperating with the "Institute of Cytology and Genetics". Recently, the Institute staff challenged the Beaver with a new problem. The problem is as follows.
There is a collection of n proteins (not... |
### Prompt
Develop a solution in CPP to the problem described below:
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot... |
### Prompt
Create a solution in Cpp for the following problem:
Luba is surfing the Internet. She currently has n opened tabs in her browser, indexed from 1 to n from left to right. The mouse cursor is currently located at the pos-th tab. Luba needs to use the tabs with indices from l to r (inclusive) for her studies,... |
### Prompt
In Cpp, your task is to solve the following problem:
Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys have lowercase Latin letters on them and some of the keys wo... |
### Prompt
Please provide a CPP coded solution to the problem described below:
Let's define an unambiguous arithmetic expression (UAE) as follows.
* All non-negative integers are UAE's. Integers may have leading zeroes (for example, 0000 and 0010 are considered valid integers).
* If X and Y are two UAE's, then... |
### Prompt
Please provide a cpp coded solution to the problem described below:
You are given strings S and T consisting of lowercase English letters.
You can perform the following operation on S any number of times:
Operation: Choose two distinct lowercase English letters c_1 and c_2, then replace every occurrence ... |
### Prompt
Create a solution in Cpp for the following problem:
You are given nonnegative integers a and b (a β€ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x?
Constraints
* 0 β€ a β€ b β€ 10^{18}
* 1 β€ x β€ 10^{18}
Input
The input is given from Standard Input ... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Find the number of ways to choose a pair of an even number and an odd number from the positive integers between 1 and K (inclusive). The order does not matter.
Constraints
* 2\leq K\leq 100
* K is an integer.
Input
Input is given from ... |
### Prompt
Generate a CPP solution to the following problem:
problem
There are the following games.
N characters are lined up in a vertical row. The color of these characters is red, blue, or yellow, and in the initial state, four or more characters of the same color are not lined up in a row. The player can select... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distanc... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Takahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.
A game is played by ... |
### Prompt
In Cpp, your task is to solve the following problem:
The Berland road network consists of n cities and of m bidirectional roads. The cities are numbered from 1 to n, where the main capital city has number n, and the culture capital β number 1. The road network is set up so that it is possible to reach any ... |
### Prompt
Please provide a CPP coded solution to the problem described below:
Two boys decided to compete in text typing on the site "Key races". During the competition, they have to type a text consisting of s characters. The first participant types one character in v1 milliseconds and has ping t1 milliseconds. The... |
### Prompt
In Cpp, your task is to solve the following problem:
Kolya is developing an economy simulator game. His most favourite part of the development process is in-game testing. Once he was entertained by the testing so much, that he found out his game-coin score become equal to 0.
Kolya remembers that at the be... |
### Prompt
Generate a Cpp solution to the following problem:
Polycarpus got hold of a family tree. The found tree describes the family relations of n people, numbered from 1 to n. Every person in this tree has at most one direct ancestor. Also, each person in the tree has a name, the names are not necessarily unique.... |
### Prompt
Generate a Cpp solution to the following problem:
Vasily has a number a, which he wants to turn into a number b. For this purpose, he can do two types of operations:
* multiply the current number by 2 (that is, replace the number x by 2Β·x);
* append the digit 1 to the right of current number (that is... |
### Prompt
Please formulate a cpp solution to the following problem:
Barney lives in country USC (United States of Charzeh). USC has n cities numbered from 1 through n and n - 1 roads between them. Cities and roads of USC form a rooted tree (Barney's not sure why it is rooted). Root of the tree is the city number 1. ... |
### Prompt
Please formulate a cpp solution to the following problem:
You are given the following points with integer coordinates on the plane: M0, A0, A1, ..., An - 1, where n is odd number. Now we define the following infinite sequence of points Mi: Mi is symmetric to Mi - 1 according <image> (for every natural numb... |
### Prompt
Generate a CPP solution to the following problem:
Snuke found a record of a tree with N vertices in ancient ruins. The findings are as follows:
* The vertices of the tree were numbered 1,2,...,N, and the edges were numbered 1,2,...,N-1.
* Edge i connected Vertex a_i and b_i.
* The length of each edge was ... |
### Prompt
Develop a solution in CPP to the problem described below:
Have you ever played Hanabi? If not, then you've got to try it out! This problem deals with a simplified version of the game.
Overall, the game has 25 types of cards (5 distinct colors and 5 distinct values). Borya is holding n cards. The game is s... |
### Prompt
In cpp, your task is to solve the following problem:
In the town of Aalam-Aara (meaning the Light of the Earth), previously there was no crime, no criminals but as the time progressed, sins started creeping into the hearts of once righteous people. Seeking solution to the problem, some of the elders found ... |
### Prompt
Generate a CPP solution to the following problem:
There is a rooted tree (see Notes) with N vertices numbered 1 to N. Each of the vertices, except the root, has a directed edge coming from its parent. Note that the root may not be Vertex 1.
Takahashi has added M new directed edges to this graph. Each of t... |
### Prompt
Please formulate a Cpp solution to the following problem:
Monocarp and Bicarp live in Berland, where every bus ticket consists of n digits (n is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased ... |
### Prompt
Create a solution in CPP for the following problem:
Chief Judge's log, stardate 48642.5. We have decided to make a problem from elementary number theory. The problem looks like finding all prime factors of a positive integer, but it is not.
A positive integer whose remainder divided by 7 is either 1 or 6 ... |
### Prompt
Develop a solution in Cpp to the problem described below:
There is a house with n flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of n integer numbers a_1, a_2, ..., a_n, where a_i = 1 if in the i-th flat the light is on and a... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
We call two numbers x and y similar if they have the same parity (the same remainder when divided by 2), or if |x-y|=1. For example, in each of the pairs (2, 6), (4, 3), (11, 7), the numbers are similar to each other, and in the pairs (1, ... |
### Prompt
Please create a solution in cpp to the following problem:
There is a sequence of length N: a = (a_1, a_2, ..., a_N). Here, each a_i is a non-negative integer.
Snuke can repeatedly perform the following operation:
* Let the XOR of all the elements in a be x. Select an integer i (1 β€ i β€ N) and replace a_i... |
### Prompt
Develop a solution in Cpp to the problem described below:
The clique problem is one of the most well-known NP-complete problems. Under some simplification it can be formulated as follows. Consider an undirected graph G. It is required to find a subset of vertices C of the maximum size such that any two of ... |
### Prompt
Construct a cpp code solution to the problem outlined:
This problem consists of two subproblems: for solving subproblem E1 you will receive 11 points, and for solving subproblem E2 you will receive 13 points.
A tree is an undirected connected graph containing no cycles. The distance between two nodes in a... |
### Prompt
In Cpp, your task is to solve the following problem:
Today you are going to lead a group of elven archers to defend the castle that is attacked by an army of angry orcs. Three sides of the castle are protected by impassable mountains and the remaining side is occupied by a long wall that is split into n se... |
### Prompt
Generate a cpp solution to the following problem:
You are given n strings ti. Each string has cost ci.
Let's define the function of string <image>, where ps, i is the number of occurrences of s in ti, |s| is the length of the string s. Find the maximal value of function f(s) over all strings.
Note that t... |
### Prompt
Please provide a cpp coded solution to the problem described below:
The term of this problem is the same as the previous one, the only exception β increased restrictions.
Input
The first line contains two positive integers n and k (1 β€ n β€ 100 000, 1 β€ k β€ 109) β the number of ingredients and the number ... |
### Prompt
Create a solution in CPP for the following problem:
Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively.
An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular vel... |
### Prompt
Develop a solution in Cpp to the problem described below:
Write a program which reads a list of student test scores and evaluates the performance for each student.
The test scores for a student include scores of the midterm examination m (out of 50), the final examination f (out of 50) and the makeup exam... |
### Prompt
Please formulate a cpp solution to the following problem:
One day Om Nom found a thread with n beads of different colors. He decided to cut the first several beads from this thread to make a bead necklace and present it to his girlfriend Om Nelly.
<image>
Om Nom knows that his girlfriend loves beautiful ... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Christmas was knocking on the door, and our protagonist, Bob, was preparing a spectacular present for his long-time second best friend Charlie. As chocolate boxes are lame, he decided to decorate a tree instead. Bob's tree can be represented as an undi... |
### Prompt
Create a solution in cpp for the following problem:
A connected undirected graph is called a vertex cactus, if each vertex of this graph belongs to at most one simple cycle.
A simple cycle in a undirected graph is a sequence of distinct vertices v1, v2, ..., vt (t > 2), such that for any i (1 β€ i < t) exi... |
### Prompt
Construct a cpp code solution to the problem outlined:
You came to a local shop and want to buy some chocolate bars. There are n bars in the shop, i-th of them costs a_i coins (and you want to buy all of them).
You have m different coupons that allow you to buy chocolate bars. i-th coupon allows you to bu... |
### Prompt
Create a solution in Cpp for the following problem:
You are given an array a of n integers.
You need to find the maximum value of a_{i} | ( a_{j} \& a_{k} ) over all triplets (i,j,k) such that i < j < k.
Here \& denotes the [bitwise AND operation](https://en.wikipedia.org/wiki/Bitwise_operation#AND), and... |
### Prompt
Generate a cpp solution to the following problem:
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.
Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled wit... |
### Prompt
Generate a cpp solution to the following problem:
You are running through a rectangular field. This field can be represented as a matrix with 3 rows and m columns. (i, j) denotes a cell belonging to i-th row and j-th column.
You start in (2, 1) and have to end your path in (2, m). From the cell (i, j) you... |
### Prompt
Please create a solution in cpp to the following problem:
Indian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy β she doesn't take a leaf if it matches the color and the species of the tree of one of ... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Barney lives in country USC (United States of Charzeh). USC has n cities numbered from 1 through n and n - 1 roads between them. Cities and roads of USC form a rooted tree (Barney's not sure why it is rooted). Root of the tree is the city ... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Japanese video game company has developed the music video game called Step Step Evolution. The gameplay of Step Step Evolution is very simple. Players stand on the dance platform, and step on panels on it according to a sequence of arrows ... |
### Prompt
Please formulate a Cpp solution to the following problem:
In Japan, temperature is usually expressed using the Celsius (β) scale. In America, they used the Fahrenheit (β) scale instead. $20$ degrees Celsius is roughly equal to $68$ degrees Fahrenheit. A phrase such as "Todayβs temperature is $68$ degrees" ... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Let \mathrm{popcount}(n) be the number of `1`s in the binary representation of n. For example, \mathrm{popcount}(3) = 2, \mathrm{popcount}(7) = 3, and \mathrm{popcount}(0) = 0.
Let f(n) be the number of times the following operation will be done when ... |
### Prompt
Please create a solution in CPP to the following problem:
There are a total of W x H squares, with H rows vertically and W columns horizontally. Some squares are marked. Create a program that reads the marked state of each square and outputs the maximum rectangular area consisting of only the unmarked squa... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Fox Ciel wants to write a task for a programming contest. The task is: "You are given a simple undirected graph with n vertexes. Each its edge has unit length. You should calculate the number of shortest paths between vertex 1 and vertex 2."
... |
### Prompt
In CPP, your task is to solve the following problem:
Hibiki and Dita are in love with each other, but belong to communities that are in a long lasting conflict. Hibiki is deeply concerned with the state of affairs, and wants to figure out if his relationship with Dita is an act of love or an act of treason... |
### Prompt
Generate a Cpp solution to the following problem:
Wabbit is trying to move a box containing food for the rest of the zoo in the coordinate plane from the point (x_1,y_1) to the point (x_2,y_2).
He has a rope, which he can use to pull the box. He can only pull the box if he stands exactly 1 unit away from ... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
In this problem, a n Γ m rectangular matrix a is called increasing if, for each row of i, when go from left to right, the values strictly increase (that is, a_{i,1}<a_{i,2}<...<a_{i,m}) and for each column j, when go from top to bottom, th... |
### Prompt
In Cpp, your task is to solve the following problem:
Ujan decided to make a new wooden roof for the house. He has n rectangular planks numbered from 1 to n. The i-th plank has size a_i Γ 1 (that is, the width is 1 and the height is a_i).
Now, Ujan wants to make a square roof. He will first choose some of ... |
### Prompt
Construct a CPP code solution to the problem outlined:
In some country live wizards. They like to make weird bets.
Two wizards draw an acyclic directed graph with n vertices and m edges (the graph's vertices are numbered from 1 to n). A source is a vertex with no incoming edges, and a sink is the vertex w... |
### Prompt
Create a solution in cpp for the following problem:
Joker returns to Gotham City to execute another evil plan. In Gotham City, there are N street junctions (numbered from 1 to N) and M streets (numbered from 1 to M). Each street connects two distinct junctions, and two junctions are connected by at most on... |
### Prompt
Your task is to create 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, ... |
### Prompt
Please formulate a CPP solution to the following problem:
Little Chris is participating in a graph cutting contest. He's a pro. The time has come to test his skills to the fullest.
Chris is given a simple undirected connected graph with n vertices (numbered from 1 to n) and m edges. The problem is to cut ... |
### Prompt
Your task is to create a CPP solution to the following problem:
Compute A \times B, truncate its fractional part, and print the result as an integer.
Constraints
* 0 \leq A \leq 10^{15}
* 0 \leq B < 10
* A is an integer.
* B is a number with two digits after the decimal point.
Input
Input is given from... |
### Prompt
Please create a solution in Cpp to the following problem:
Polycarpus has a finite sequence of opening and closing brackets. In order not to fall asleep in a lecture, Polycarpus is having fun with his sequence. He is able to perform two operations:
* adding any bracket in any position (in the beginning, ... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
There is a robot staying at X=0 on the Ox axis. He has to walk to X=n. You are controlling this robot and controlling how he goes. The robot has a battery and an accumulator with a solar panel.
The i-th segment of the path (from X=i-1 to ... |
### Prompt
Please formulate a cpp solution to the following problem:
Vasya has a non-negative integer n. He wants to round it to nearest integer, which ends up with 0. If n already ends up with 0, Vasya considers it already rounded.
For example, if n = 4722 answer is 4720. If n = 5 Vasya can round it to 0 or to 10. ... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
The only difference between easy and hard versions is the maximum value of n.
You are given a positive integer number n. You really love good numbers so you want to find the smallest good number greater than or equal to n.
The positive i... |
### Prompt
Create a solution in CPP for the following problem:
The World Programming Olympics Medal is a metal disk, consisting of two parts: the first part is a ring with outer radius of r1 cm, inner radius of r2 cm, (0 < r2 < r1) made of metal with density p1 g/cm3. The second part is an inner disk with radius r2 c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.