text stringlengths 424 69.5k |
|---|
### Prompt
Create a solution in Cpp for the following problem:
You are given a set of 2n+1 integer points on a Cartesian plane. Points are numbered from 0 to 2n inclusive. Let P_i be the i-th point. The x-coordinate of the point P_i equals i. The y-coordinate of the point P_i equals zero (initially). Thus, initially ... |
### Prompt
Generate a CPP solution to the following problem:
Fibonacci numbers are the sequence of integers: f0 = 0, f1 = 1, f2 = 1, f3 = 2, f4 = 3, f5 = 5, ..., fn = fn - 2 + fn - 1. So every next number is the sum of the previous two.
Bajtek has developed a nice way to compute Fibonacci numbers on a blackboard. Fi... |
### Prompt
In CPP, your task is to solve the following problem:
You are given three strings (s1, s2, s3). For each integer l (1 ≤ l ≤ min(|s1|, |s2|, |s3|) you need to find how many triples (i1, i2, i3) exist such that three strings sk[ik... ik + l - 1] (k = 1, 2, 3) are pairwise equal. Print all found numbers modulo... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Suppose you have two polynomials <image> and <image>. Then polynomial <image> can be uniquely represented in the following way:
<image>
This can be done using [long division](https://en.wikipedia.org/wiki/Polynomial_long_division). Here, <im... |
### Prompt
Generate a Cpp solution to the following problem:
Petya has an array a consisting of n integers. He wants to remove duplicate (equal) elements.
Petya wants to leave only the rightmost entry (occurrence) for each element of the array. The relative order of the remaining unique elements should not be change... |
### Prompt
Please create a solution in CPP to the following problem:
A --D's Ambition / D's Yabou
Story
Aizunyan is a second-year student who belongs to the programming contest club of Wakagamatsu High School, commonly known as the Prokon club. cute. The person in D is horrified by the cute Aizu Nyan like an angel,... |
### Prompt
Develop a solution in Cpp to the problem described below:
Snuke has a string x of length N. Initially, every character in x is `0`.
Snuke can do the following two operations any number of times in any order:
* Choose A consecutive characters in x and replace each of them with `0`.
* Choose B consecutive ... |
### Prompt
In Cpp, your task is to solve the following problem:
Yurii is sure he can do everything. Can he solve this task, though?
He has an array a consisting of n positive integers. Let's call a subarray a[l...r] good if the following conditions are simultaneously satisfied:
* l+1 ≤ r-1, i. e. the subarray ha... |
### Prompt
Create a solution in CPP for the following problem:
Recently, Anton has found a set. The set consists of small English letters. Anton carefully wrote out all the letters from the set in one line, separated by a comma. He also added an opening curved bracket at the beginning of the line and a closing curved... |
### Prompt
Generate a CPP solution to the following problem:
Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter y Koa selects must be strictly greater alphabetically than x (read statement for better understanding). You can mak... |
### Prompt
Your task is to create a cpp solution to the following problem:
Find the minimum area of a square land on which you can place two identical rectangular a × b houses. The sides of the houses should be parallel to the sides of the desired square land.
Formally,
* You are given two identical rectangles w... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Arkady and Kirill visited an exhibition of rare coins. The coins were located in a row and enumerated from left to right from 1 to k, each coin either was laid with its obverse (front) side up, or with its reverse (back) side up.
Arkady and K... |
### Prompt
Please formulate a Cpp solution to the following problem:
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... |
### Prompt
Please formulate 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 ... |
### Prompt
Create a solution in cpp for the following problem:
Vasya's bicycle chain drive consists of two parts: n stars are attached to the pedal axle, m stars are attached to the rear wheel axle. The chain helps to rotate the rear wheel by transmitting the pedal rotation.
We know that the i-th star on the pedal a... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
You are given a tree (an undirected connected acyclic graph) consisting of n vertices and n - 1 edges. A number is written on each edge, each number is either 0 (let's call such edges 0-edges) or 1 (those are 1-edges).
Let's call an order... |
### Prompt
In CPP, your task is to solve the following problem:
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion.
All string... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
You are given N integers. The i-th integer is a_i. Find the number, modulo 998244353, of ways to paint each of the integers red, green or blue so that the following condition is satisfied:
* Let R, G and B be the sums of the integers pain... |
### Prompt
In cpp, your task is to solve the following problem:
B-Mansion and courier
Problem Statement
Taro lives alone in a mansion. Taro, who loves studying, intends to study in his study in the house today. Taro can't concentrate outside the study, so he always studies in the study.
However, on this day, $ N $... |
### Prompt
Please formulate a Cpp solution to the following problem:
Bash has set out on a journey to become the greatest Pokemon master. To get his first Pokemon, he went to Professor Zulu's Lab. Since Bash is Professor Zulu's favourite student, Zulu allows him to take as many Pokemon from his lab as he pleases.
Bu... |
### Prompt
Please formulate a CPP solution to the following problem:
One of the most important products of the R1 company is a popular @r1.com mail service. The R1 mailboxes receive and send millions of emails every day.
Today, the online news thundered with terrible information. The R1 database crashed and almost n... |
### Prompt
Your task is to create a CPP solution to the following problem:
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k ... |
### Prompt
Construct a CPP code solution to the problem outlined:
The country Treeland consists of n cities connected with n - 1 bidirectional roads in such a way that it's possible to reach every city starting from any other city using these roads. There will be a soccer championship next year, and all participants ... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Vivek initially has an empty array a and some integer constant m.
He performs the following algorithm:
1. Select a random integer x uniformly in range from 1 to m and append it to the end of a.
2. Compute the greatest common divisor of ... |
### Prompt
In cpp, your task is to solve the following problem:
Let's denote correct match equation (we will denote it as CME) an equation a + b = c there all integers a, b and c are greater than zero.
For example, equations 2 + 2 = 4 (||+||=||||) and 1 + 2 = 3 (|+||=|||) are CME but equations 1 + 2 = 4 (|+||=||||),... |
### Prompt
Generate a Cpp solution to the following problem:
There is a game called "I Wanna Be the Guy", consisting of n levels. Little X and his friend Little Y are addicted to the game. Each of them wants to pass the whole game.
Little X can pass only p levels of the game. And Little Y can pass only q levels of t... |
### Prompt
Construct a cpp code solution to the problem outlined:
Vasya and Petya are using an interesting data storing structure: a pyramid.
The pyramid consists of n rows, the i-th row contains i cells. Each row is shifted half a cell to the left relative to the previous row. The cells are numbered by integers fro... |
### Prompt
In cpp, your task is to solve the following problem:
You have a bag of balls of n different colors. You have ai balls of the i-th color.
While there are at least two different colored balls in the bag, perform the following steps:
* Take out two random balls without replacement one by one. These balls... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Dima and Inna love spending time together. The problem is, Seryozha isn't too enthusiastic to leave his room for some reason. But Dima and Inna love each other so much that they decided to get criminal...
Dima constructed a trap graph. He... |
### Prompt
Create a solution in cpp for the following problem:
All of us know that girls in Arpa’s land are... ok, you’ve got the idea :D
Anyone knows that Arpa isn't a normal man, he is ... well, sorry, I can't explain it more. Mehrdad is interested about the reason, so he asked Sipa, one of the best biology scient... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Anton is growing a tree in his garden. In case you forgot, the tree is a connected acyclic undirected graph.
There are n vertices in the tree, each of them is painted black or white. Anton doesn't like multicolored trees, so he wants to c... |
### Prompt
Please formulate a Cpp solution to the following problem:
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 i... |
### Prompt
Develop a solution in Cpp to the problem described below:
Pavel plays a famous computer game. A player is responsible for a whole country and he can travel there freely, complete quests and earn experience.
This country has n cities connected by m bidirectional roads of different lengths so that it is pos... |
### Prompt
Construct a cpp code solution to the problem outlined:
In Aizu prefecture, we decided to create a new town to increase the population. To that end, we decided to cultivate a new rectangular land and divide this land into squares of the same size. The cost of developing this land is proportional to the numb... |
### Prompt
Generate a cpp solution to the following problem:
You are given a multiset S consisting of positive integers (initially empty). There are two kind of queries:
1. Add a positive integer to S, the newly added integer is not less than any number in it.
2. Find a subset s of the set S such that the valu... |
### Prompt
In CPP, your task is to solve the following problem:
Tavas lives in Kansas. Kansas has n cities numbered from 1 to n connected with m bidirectional roads. We can travel from any city to any other city via these roads. Kansas is as strange as Tavas. So there may be a road between a city and itself or more t... |
### Prompt
Your task is to create a CPP solution to the following problem:
Many people are aware of DMCA – Digital Millennium Copyright Act. But another recently proposed DMCA – Digital Millennium Calculation Act – is much less known.
In this problem you need to find a root of a number according to this new DMCA law... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
As we all know Barney's job is "PLEASE" and he has not much to do at work. That's why he started playing "cups and key". In this game there are three identical cups arranged in a line from left to right. Initially key to Barney's heart is ... |
### Prompt
In cpp, your task is to solve the following problem:
Let A = {a1, a2, ..., an} be any permutation of the first n natural numbers {1, 2, ..., n}. You are given a positive integer k and another sequence B = {b1, b2, ..., bn}, where bi is the number of elements aj in A to the left of the element at = i such t... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Sereja has an n × m rectangular table a, each cell of the table contains a zero or a number one. Sereja wants his table to meet the following requirement: each connected component of the same values forms a rectangle with sides parallel to... |
### Prompt
Create a solution in Cpp for the following problem:
In this task Anna and Maria play the following game. Initially they have a checkered piece of paper with a painted n × m rectangle (only the border, no filling). Anna and Maria move in turns and Anna starts. During each move one should paint inside the la... |
### Prompt
Develop a solution in cpp to the problem described below:
Since Boboniu finished building his Jianghu, he has been doing Kungfu on these mountains every day.
Boboniu designs a map for his n mountains. He uses n-1 roads to connect all n mountains. Every pair of mountains is connected via roads.
For the i... |
### Prompt
In cpp, your task is to solve the following problem:
This is an interactive problem. You should use flush operation after each printed line. For example, in C++ you should use fflush(stdout), in Java you should use System.out.flush(), and in Pascal — flush(output).
In this problem you should guess an arra... |
### Prompt
In CPP, your task is to solve the following problem:
You are given an array a of n integers. Find the number of pairs (i, j) (1 ≤ i < j ≤ n) where the sum of a_i + a_j is greater than or equal to l and less than or equal to r (that is, l ≤ a_i + a_j ≤ r).
For example, if n = 3, a = [5, 1, 2], l = 4 and r ... |
### Prompt
Generate a CPP solution to the following problem:
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 numbers from 1 to 9 (inc... |
### Prompt
Generate a CPP solution to the following problem:
The campus has m rooms numbered from 0 to m - 1. Also the x-mouse lives in the campus. The x-mouse is not just a mouse: each second x-mouse moves from room i to the room i ⋅ x mod{m} (in fact, it teleports from one room to another since it doesn't visit any... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.
There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the c... |
### Prompt
Your task is to create a cpp solution to the following problem:
Polycarp is making a quest for his friends. He has already made n tasks, for each task the boy evaluated how interesting it is as an integer qi, and the time ti in minutes needed to complete the task.
An interesting feature of his quest is: ... |
### Prompt
Construct a CPP code solution to the problem outlined:
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a posi... |
### Prompt
Please provide a CPP coded solution to the problem described below:
We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the foll... |
### Prompt
Construct a cpp code solution to the problem outlined:
While roaming the mystic areas of Stonefalls, in order to drop legendary loot, an adventurer was given a quest as follows. He was given an array A = {a_1,a_2,...,a_N } of length N, and a number K.
Define array B as B(q, A) = { q-a_1, q-a_2, ..., q-a_... |
### Prompt
Please create a solution in cpp to the following problem:
During the loading of the game "Dungeons and Candies" you are required to get descriptions of k levels from the server. Each description is a map of an n × m checkered rectangular field. Some cells of the field contain candies (each cell has at most... |
### Prompt
In CPP, your task is to solve the following problem:
Recently Vova found n candy wrappers. He remembers that he bought x candies during the first day, 2x candies during the second day, 4x candies during the third day, ..., 2^{k-1} x candies during the k-th day. But there is an issue: Vova remembers neither... |
### Prompt
In Cpp, your task is to solve the following problem:
You are given two strings s and t. In a single move, you can choose any of two strings and delete the first (that is, the leftmost) character. After a move, the length of the string decreases by 1. You can't choose a string if it is empty.
For example:
... |
### Prompt
Your task is to create a CPP solution to the following problem:
IT City administration has no rest because of the fame of the Pyramids in Egypt. There is a project of construction of pyramid complex near the city in the place called Emerald Walley. The distinction of the complex is that its pyramids will b... |
### Prompt
Construct a CPP code solution to the problem outlined:
A divisor tree is a rooted tree that meets the following conditions:
* Each vertex of the tree contains a positive integer number.
* The numbers written in the leaves of the tree are prime numbers.
* For any inner vertex, the number within it... |
### Prompt
Please provide a CPP coded solution to the problem described below:
In one very old text file there was written Great Wisdom. This Wisdom was so Great that nobody could decipher it, even Phong — the oldest among the inhabitants of Mainframe. But still he managed to get some information from there. For exam... |
### Prompt
Construct a CPP code solution to the problem outlined:
At first, there was a legend related to the name of the problem, but now it's just a formal statement.
You are given n points a_1, a_2, ..., a_n on the OX axis. Now you are asked to find such an integer point x on OX axis that f_k(x) is minimal possib... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Amr is a young coder who likes music a lot. He always wanted to learn how to play music but he was busy coding so he got an idea.
Amr has n instruments, it takes ai days to learn i-th instrument. Being busy, Amr dedicated k days to learn ... |
### Prompt
Generate a cpp solution to the following problem:
Today at the lesson of mathematics, Petya learns about the digital root.
The digital root of a non-negative integer is the single digit value obtained by an iterative process of summing digits, on each iteration using the result from the previous iteration... |
### Prompt
Generate a cpp solution to the following problem:
Problem statement
Cards with ranks of $ 2 $ and $ 8 $ are powerful in card game millionaires. Therefore, we call an integer consisting of only the numbers $ 2 $ and $ 8 $ in $ 10 $ decimal notation a good integer. The best integers are listed from the smal... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Lunar New Year is approaching, and Bob is planning to go for a famous restaurant — "Alice's".
The restaurant "Alice's" serves n kinds of food. The cost for the i-th kind is always c_i. Initially, the restaurant has enough ingredients for ... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
You finally woke up after this crazy dream and decided to walk around to clear your head. Outside you saw your house's fence — so plain and boring, that you'd like to repaint it.
<image>
You have a fence consisting of n planks, where the... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
After long studying how embryos of organisms become asymmetric during their development, Dr. Podboq, a famous biologist, has reached his new hypothesis. Dr. Podboq is now preparing a poster for the coming academic conference, which shows a... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Qwerty the Ranger arrived to the Diatar system with a very important task. He should deliver a special carcinogen for scientific research to planet Persephone. This is urgent, so Qwerty has to get to the planet as soon as possible. A lost ... |
### Prompt
Construct a cpp code solution to the problem outlined:
For the multiset of positive integers s=\\{s_1,s_2,...,s_k\}, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of s as follow:
* \gcd(s) is the maximum positive integer x, such that all integers in s are divisible on x.
* l... |
### Prompt
Develop a solution in CPP to the problem described below:
A frog is initially at position 0 on the number line. The frog has two positive integers a and b. From a position k, it can either jump to position k+a or k-b.
Let f(x) be the number of distinct integers the frog can reach if it never jumps on an i... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
You are given a figure on a grid representing stairs consisting of 7 steps. The width of the stair on height i is wi squares. Formally, the figure is created by consecutively joining rectangles of size wi × i so that the wi sides lie on on... |
### Prompt
Develop a solution in CPP to the problem described below:
JOI is playing with a nail in the board. As shown in the figure below, JOI stabbed nails in the shape of an equilateral triangle with N sides. A nails are lined up in the ath line (1 ≤ a ≤ N) from the top. The bth nail (1 ≤ b ≤ a) from the left is r... |
### Prompt
Generate a Cpp solution to the following problem:
There are n houses in a row. They are numbered from 1 to n in order from left to right. Initially you are in the house 1.
You have to perform k moves to other house. In one move you go from your current house to some other house. You can't stay where you a... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
One-day pass
Mr. D, a university student living in a certain country, is a big fan of Mr. A, a national guitarist, and is thinking of going to a live concert in the city center this summer. However, since Mr. D lives in a remote area, he ... |
### Prompt
Please provide a CPP coded solution to the problem described below:
Two foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly ... |
### Prompt
In Cpp, your task is to solve the following problem:
Bitwise exclusive OR (or bitwise addition modulo two) is a binary operation which is equivalent to applying logical exclusive OR to every pair of bits located on the same positions in binary notation of operands. In other words, a binary digit of the res... |
### Prompt
Please create a solution in cpp to the following problem:
Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be desc... |
### Prompt
Generate a CPP solution to the following problem:
Recently Polycarp started to develop a text editor that works only with correct bracket sequences (abbreviated as CBS).
Note that a bracket sequence is correct if it is possible to get a correct mathematical expression by adding "+"-s and "1"-s to it. For... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
There is a programing contest named SnakeUp, 2n people want to compete for it. In order to attend this contest, people need to form teams of exactly two people. You are given the strength of each possible combination of two people. All the... |
### Prompt
Please create a solution in Cpp to the following problem:
An arithmetic progression is such a non-empty sequence of numbers where the difference between any two successive numbers is constant. This constant number is called common difference. For example, the sequence 3, 7, 11, 15 is an arithmetic progress... |
### Prompt
Generate a CPP solution to the following problem:
You've got an array consisting of n integers: a[1], a[2], ..., a[n]. Moreover, there are m queries, each query can be described by three integers li, ri, ki. Query li, ri, ki means that we should add <image> to each element a[j], where li ≤ j ≤ ri.
Record ... |
### Prompt
Generate a Cpp solution to the following problem:
You are given a permutation p consisting of exactly 26 integers from 1 to 26 (since it is a permutation, each integer from 1 to 26 occurs in p exactly once) and two strings s and t consisting of lowercase Latin letters.
A substring t' of string t is an occ... |
### Prompt
Generate a cpp solution to the following problem:
Not long ago Billy came across such a problem, where there were given three natural numbers A, B and C from the range [1, N], and it was asked to check whether the equation AB = C is correct. Recently Billy studied the concept of a digital root of a number.... |
### Prompt
Create a solution in Cpp for the following problem:
Dreamoon likes sequences very much. So he created a problem about the sequence that you can't find in OEIS:
You are given two integers d, m, find the number of arrays a, satisfying the following constraints:
* The length of a is n, n ≥ 1
* 1 ≤ a_1... |
### Prompt
Your task is to create a CPP solution to the following problem:
Limak is a little polar bear. Polar bears hate long strings and thus they like to compress them. You should also know that Limak is so young that he knows only first six letters of the English alphabet: 'a', 'b', 'c', 'd', 'e' and 'f'.
You ar... |
### Prompt
Please formulate a Cpp solution to the following problem:
The Bitlandians are quite weird people. They do everything differently. They have a different alphabet so they have a different definition for a string.
A Bitlandish string is a string made only of characters "0" and "1".
BitHaval (the mayor of Bi... |
### Prompt
Please create a solution in Cpp to the following problem:
You are given a positive integer x. Find any such 2 positive integers a and b such that GCD(a,b)+LCM(a,b)=x.
As a reminder, GCD(a,b) is the greatest integer that divides both a and b. Similarly, LCM(a,b) is the smallest integer such that both a and... |
### Prompt
Generate a Cpp solution to the following problem:
An oriented weighted forest is an acyclic weighted digraph in which from each vertex at most one edge goes.
The root of vertex v of an oriented weighted forest is a vertex from which no edge goes and which can be reached from vertex v moving along the edge... |
### Prompt
Please formulate a cpp solution to the following problem:
Mahmoud and Ehab live in a country with n cities numbered from 1 to n and connected by n - 1 undirected roads. It's guaranteed that you can reach any city from any other using these roads. Each city has a number ai attached to it.
We define the dis... |
### Prompt
Please formulate a Cpp solution to the following problem:
In this problem, we use the 24-hour clock.
Takahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2. (See Sample Inputs below for clarity.) He has decided to study for K consecutive minutes while he is up. What ... |
### Prompt
Create a solution in Cpp for the following problem:
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visitor entered the ... |
### Prompt
Construct a cpp code solution to the problem outlined:
Squirrel Liss is interested in sequences. She also has preferences of integers. She thinks n integers a1, a2, ..., an are good.
Now she is interested in good sequences. A sequence x1, x2, ..., xk is called good if it satisfies the following three cond... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Artem is building a new robot. He has a matrix a consisting of n rows and m columns. The cell located on the i-th row from the top and the j-th column from the left has a value a_{i,j} written in it.
If two adjacent cells contain the same value, the ... |
### Prompt
Create a solution in Cpp for the following problem:
Greg has a weighed directed graph, consisting of n vertices. In this graph any pair of distinct vertices has an edge between them in both directions. Greg loves playing with the graph and now he has invented a new game:
* The game consists of n steps. ... |
### Prompt
Develop a solution in cpp to the problem described below:
One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal.
The game starts on a square flat grid, which initially has the outline border... |
### Prompt
Create a solution in cpp for the following problem:
As I was cleaning up the warehouse, I found an old document that describes how to get to the treasures of my ancestors. The following was written in this ancient document.
1. First, stand 1m east of the well on the outskirts of the town and turn straigh... |
### Prompt
Develop a solution in Cpp to the problem described below:
Sagheer is playing a game with his best friend Soliman. He brought a tree with n nodes numbered from 1 to n and rooted at node 1. The i-th node has ai apples. This tree has a special property: the lengths of all paths from the root to any leaf have ... |
### Prompt
Your task is to create a CPP solution to the following problem:
Two integers x and y are compatible, if the result of their bitwise "AND" equals zero, that is, a & b = 0. For example, numbers 90 (10110102) and 36 (1001002) are compatible, as 10110102 & 1001002 = 02, and numbers 3 (112) and 6 (1102) are not... |
### Prompt
Create a solution in Cpp for the following problem:
Little boy Igor wants to become a traveller. At first, he decided to visit all the cities of his motherland — Uzhlyandia.
It is widely known that Uzhlyandia has n cities connected with m bidirectional roads. Also, there are no two roads in the country th... |
### Prompt
Please create a solution in Cpp to the following problem:
Problem
Let $ f (x) $ be the sum of each digit when the non-negative integer $ x $ is expressed in binary.
Given a positive integer $ N $, output the largest of $ f (0) $, $ f (1) $, ..., $ f (N) $.
Example of calculating the function $ f (5) $:
... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Btoh yuo adn yuor roomatme lhoate wianshg disehs, btu stlil sdmoeboy msut peorrfm tihs cohre dialy. Oen dya yuo decdie to idourtcne smoe syestm. Yuor rmmotaoe sstgegus teh fooniwllg dael. Yuo argee on tow arayrs of ientgres M adn R, nmebur... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
The Cereal Guy's friend Serial Guy likes to watch soap operas. An episode is about to start, and he hasn't washed his plate yet. But he decided to at least put in under the tap to be filled with water. The plate can be represented by a par... |
### Prompt
Create a solution in CPP for the following problem:
Fox Ciel is playing a card game with her friend Jiro.
Jiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attributes too. It's known that position of all Ciel's cards is A... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.