text stringlengths 424 69.5k |
|---|
### Prompt
Please provide a CPP coded solution to the problem described below:
Dwarfs have planted a very interesting plant, which is a triangle directed "upwards". This plant has an amusing feature. After one year a triangle plant directed "upwards" divides into four triangle plants: three of them will point "upward... |
### Prompt
Please create a solution in cpp to the following problem:
The official capital and the cultural capital of Berland are connected by a single road running through n regions. Each region has a unique climate, so the i-th (1 β€ i β€ n) region has a stable temperature of ti degrees in summer.
This summer a grou... |
### Prompt
Construct a Cpp code solution to the problem outlined:
For some reason in many American cartoons anvils fall from time to time onto heroes' heads. Of course, safes, wardrobes, cruisers, planes fall sometimes too... But anvils do so most of all.
Anvils come in different sizes and shapes. Quite often they g... |
### Prompt
In cpp, your task is to solve the following problem:
Alice and Bob like games. And now they are ready to start a new game. They have placed n chocolate bars in a line. Alice starts to eat chocolate bars one by one from left to right, and Bob β from right to left. For each chocololate bar the time, needed f... |
### Prompt
Develop a solution in cpp to the problem described below:
You generate real numbers s1, s2, ..., sn as follows:
* s0 = 0;
* si = si - 1 + ti, where ti is a real number chosen independently uniformly at random between 0 and 1, inclusive.
You are given real numbers x1, x2, ..., xn. You are interes... |
### Prompt
Please provide a CPP coded solution to the problem described below:
A-Aun's breathing
Problem Statement
Maeda-san and Goto-san, who will both turn 70 years old in 2060, are long-time friends and friends who fought together at the ACM-ICPC in college.
The two are still excited about competitive programmi... |
### Prompt
Develop a solution in CPP to the problem described below:
This is an interactive problem.
We hid from you a permutation p of length n, consisting of the elements from 1 to n. You want to guess it. To do that, you can give us 2 different indices i and j, and we will reply with p_{i} mod p_{j} (remainder of... |
### Prompt
Your task is to create a Cpp solution to the following problem:
There is an H \times W grid (H vertical, W horizontal), where each square contains a lowercase English letter. Specifically, the letter in the square at the i-th row and j-th column is equal to the j-th character in the string S_i.
Snuke can ... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
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, differ... |
### Prompt
Please create a solution in cpp to the following problem:
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.
The level of the cave where you are is ... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Polycarp's phone book contains n phone numbers, each of them is described by s_i β the number itself and m_i β the number of times Polycarp dials it in daily.
Polycarp has just bought a brand new phone with an amazing speed dial feature! ... |
### Prompt
Please formulate a Cpp solution to the following problem:
You are given a permutation p_1, p_2, ... , p_n (an array where each integer from 1 to n appears exactly once). The weight of the i-th element of this permutation is a_i.
At first, you separate your permutation into two non-empty sets β prefix and ... |
### Prompt
Create a solution in Cpp for the following problem:
There are N integers, A_1, A_2, ..., A_N, arranged in a row in this order.
You can perform the following operation on this integer sequence any number of times:
Operation: Choose an integer i satisfying 1 \leq i \leq N-1. Multiply both A_i and A_{i+1} b... |
### Prompt
Generate a CPP solution to the following problem:
There is a directed graph G with N vertices and M edges. The vertices are numbered 1, 2, \ldots, N, and for each i (1 \leq i \leq M), the i-th directed edge goes from Vertex x_i to y_i. G does not contain directed cycles.
Find the length of the longest dir... |
### Prompt
Please create a solution in cpp to the following problem:
Constanze is the smartest girl in her village but she has bad eyesight.
One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce 'c', 'o',... |
### Prompt
Please formulate a Cpp solution to the following problem:
Harry, upon inquiring Helena Ravenclaw's ghost, came to know that she told Tom Riddle or You-know-who about Rowena Ravenclaw's diadem and that he stole it from her.
Harry thought that Riddle would have assumed that he was the only one to discover ... |
### Prompt
Please formulate a Cpp solution to the following problem:
You are given three strings s, t and p consisting of lowercase Latin letters. You may perform any number (possibly, zero) operations on these strings.
During each operation you choose any character from p, erase it from p and insert it into string ... |
### Prompt
Please formulate a CPP solution to the following problem:
Today on a lecture about strings Gerald learned a new definition of string equivalency. Two strings a and b of equal length are called equivalent in one of the two cases:
1. They are equal.
2. If we split string a into two halves of the same ... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
The legend of the foundation of Vectorland talks of two integers x and y. Centuries ago, the array king placed two markers at points |x| and |y| on the number line and conquered all the land in between (including the endpoints), which he d... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Innocentius has a problem β his computer monitor has broken. Now some of the pixels are "dead", that is, they are always black. As consequence, Innocentius can't play the usual computer games. He is recently playing the following game with his younger ... |
### Prompt
Please formulate a CPP solution to the following problem:
We ask you to select some number of positive integers, and calculate the sum of them.
It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a mu... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Alice and Bob are playing a game. They have a tree consisting of n vertices. Initially, Bob has k chips, the i-th chip is located in the vertex a_i (all these vertices are unique). Before the game starts, Alice will place a chip into one o... |
### Prompt
Develop a solution in cpp to the problem described below:
There are n positive integers written on the blackboard. Also, a positive number k β₯ 2 is chosen, and none of the numbers on the blackboard are divisible by k. In one operation, you can choose any two integers x and y, erase them and write one extra... |
### Prompt
Please provide a CPP coded solution to the problem described below:
At a break Vanya came to the class and saw an array of n k-bit integers a_1, a_2, β¦, a_n on the board. An integer x is called a k-bit integer if 0 β€ x β€ 2^k - 1.
Of course, Vanya was not able to resist and started changing the numbers wr... |
### Prompt
Generate a Cpp solution to the following problem:
Little Vlad is fond of popular computer game Bota-2. Recently, the developers announced the new add-on named Bota-3. Of course, Vlad immediately bought only to find out his computer is too old for the new game and needs to be updated.
There are n video car... |
### Prompt
Please create a solution in CPP to the following problem:
Ruritania is a country with a very badly maintained road network, which is not exactly good news for lorry drivers that constantly have to do deliveries. In fact, when roads are maintained, they become one-way. It turns out that it is sometimes impo... |
### Prompt
Please provide a CPP coded solution to the problem described below:
We often have to copy large volumes of information. Such operation can take up many computer resources. Therefore, in this problem you are advised to come up with a way to copy some part of a number array into another one, quickly.
More f... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Tonight, in your favourite cinema they are giving the movie Joker and all seats are occupied. In the cinema there are N rows with N seats each, forming an N\times N square. We denote with 1, 2,\dots, N the viewers in the first row (from le... |
### Prompt
Please create a solution in Cpp to the following problem:
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, t... |
### Prompt
Generate a Cpp solution to the following problem:
Consider a sequence of n numbers using integers from 0 to 9 k1, k2, ..., kn. Read the positive integers n and s,
k1 + 2 x k2 + 3 x k3 + ... + n x kn = s
Create a program that outputs how many rows of n numbers such as. However, the same number does not ap... |
### Prompt
Your task is to create a CPP solution to the following problem:
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`.
When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE ... |
### Prompt
Construct a Cpp code solution to the problem outlined:
You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?
Constraints
* -40 \leq X \leq 40
* X is... |
### Prompt
Construct a cpp code solution to the problem outlined:
Hooray! Berl II, the king of Berland is making a knight tournament. The king has already sent the message to all knights in the kingdom and they in turn agreed to participate in this grand event.
As for you, you're just a simple peasant. There's no su... |
### Prompt
Develop a solution in CPP to the problem described below:
On a number axis directed from the left rightwards, n marbles with coordinates x1, x2, ..., xn are situated. Let's assume that the sizes of the marbles are infinitely small, that is in this task each of them is assumed to be a material point. You ca... |
### Prompt
Construct a Cpp code solution to the problem outlined:
In Takahashi Kingdom, which once existed, there are N cities, and some pairs of cities are connected bidirectionally by roads. The following are known about the road network:
* People traveled between cities only through roads. It was possible to reac... |
### Prompt
Your task is to create a CPP solution to the following problem:
Iahub is very proud of his recent discovery, propagating trees. Right now, he invented a new tree, called xor-tree. After this new revolutionary discovery, he invented a game for kids which uses xor-trees.
The game is played on a tree having ... |
### Prompt
Create a solution in Cpp for the following problem:
One day, at the "Russian Code Cup" event it was decided to play football as an out of competition event. All participants was divided into n teams and played several matches, two teams could not play against each other more than once.
The appointed Judge... |
### Prompt
Your task is to create a Cpp solution to the following problem:
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array:
* The array consists of n distinct positive (greater than 0) integers.
* The array contains two elements x and y... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
There are K items placed on a grid of squares with R rows and C columns. Let (i, j) denote the square at the i-th row (1 \leq i \leq R) and the j-th column (1 \leq j \leq C). The i-th item is at (r_i, c_i) and has the value v_i.
Takahashi... |
### Prompt
Generate a CPP solution to the following problem:
Manao has invented a new mathematical term β a beautiful set of points. He calls a set of points on a plane beautiful if it meets the following conditions:
1. The coordinates of each point in the set are integers.
2. For any two points from the set, t... |
### Prompt
Please create a solution in Cpp 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
Create a solution in CPP for the following problem:
Snuke has N integers: 1,2,\ldots,N. He will choose K of them and give those to Takahashi.
How many ways are there to choose K consecutive integers?
Constraints
* All values in input are integers.
* 1 \leq K \leq N \leq 50
Input
Input is given from St... |
### Prompt
Please create a solution in cpp to 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 exam... |
### Prompt
Your task is to create a CPP solution to the following problem:
One day, ZS the Coder wrote down an array of integers a with elements a1, a2, ..., an.
A subarray of the array a is a sequence al, al + 1, ..., ar for some integers (l, r) such that 1 β€ l β€ r β€ n. ZS the Coder thinks that a subarray of a is b... |
### Prompt
Construct a CPP code solution to the problem outlined:
You are given an undirected connected weighted graph consisting of n vertices and m edges. Let's denote the length of the shortest path from vertex 1 to vertex i as d_i.
You have to erase some edges of the graph so that at most k edges remain. Let's ... |
### Prompt
Develop a solution in cpp to the problem described below:
Consider some positive integer x. Its prime factorization will be of form x = 2^{k_1} β
3^{k_2} β
5^{k_3} β
...
Let's call x elegant if the greatest common divisor of the sequence k_1, k_2, ... is equal to 1. For example, numbers 5 = 5^1, 12 = 2^2 ... |
### Prompt
Develop a solution in cpp to the problem described below:
100 years have passed since the last victory of the man versus computer in Go. Technologies made a huge step forward and robots conquered the Earth! It's time for the final fight between human and robot that will decide the faith of the planet.
The... |
### Prompt
Create a solution in Cpp for the following problem:
We have a tree with N vertices. The vertices are numbered 1, 2, ..., N. The i-th (1 β¦ i β¦ N - 1) edge connects the two vertices A_i and B_i.
Takahashi wrote integers into K of the vertices. Specifically, for each 1 β¦ j β¦ K, he wrote the integer P_j into ... |
### Prompt
Create a solution in CPP for the following problem:
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 forma... |
### Prompt
Please formulate 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."
Same w... |
### Prompt
Generate a CPP solution to the following problem:
A car moves from point A to point B at speed v meters per second. The action takes place on the X-axis. At the distance d meters from A there are traffic lights. Starting from time 0, for the first g seconds the green light is on, then for the following r s... |
### Prompt
Generate a cpp solution to the following problem:
Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plasticine pack (rep... |
### Prompt
Create a solution in Cpp for the following problem:
Johnny has a younger sister Anne, who is very clever and smart. As she came home from the kindergarten, she told his brother about the task that her kindergartener asked her to solve. The task was just to construct a triangle out of four sticks of differe... |
### Prompt
Construct a cpp code solution to the problem outlined:
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week.
Write a program which computes the amou... |
### Prompt
Your task is to create a CPP solution to the following problem:
In Berland a money reform is being prepared. New coins are being introduced. After long economic calculations was decided that the most expensive coin should possess the denomination of exactly n Berland dollars. Also the following restriction... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. P... |
### Prompt
Please formulate a cpp solution to the following problem:
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started exper... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
A sequence (b_1, b_2, β¦, b_k) is called strange, if the absolute difference between any pair of its elements is greater than or equal to the maximum element in the sequence. Formally speaking, it's strange if for every pair (i, j) with 1 β€... |
### Prompt
Develop a solution in cpp to the problem described below:
First-rate specialists graduate from Berland State Institute of Peace and Friendship. You are one of the most talented students in this university. The education is not easy because you need to have fundamental knowledge in different areas, which so... |
### Prompt
Please create a solution in CPP to the following problem:
The Patisserie AtCoder sells cakes with number-shaped candles. There are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively. Each cake has an integer value called deliciousness, as follows:
* The deliciousness of t... |
### Prompt
Construct a cpp code solution to the problem outlined:
There are a lot of things which could be cut β trees, paper, "the rope". In this problem you are going to cut a sequence of integers.
There is a sequence of integers, which contains the equal number of even and odd numbers. Given a limited budget, you... |
### Prompt
Develop a solution in Cpp to the problem described below:
Once Bob got to a sale of old TV sets. There were n TV sets at that sale. TV set with index i costs ai bellars. Some TV sets have a negative price β their owners are ready to pay Bob if he buys their useless apparatus. Bob can Β«buyΒ» any TV sets he w... |
### Prompt
Create a solution in cpp for the following problem:
Genos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of which has color ci. The goal of the game is to destroy all the gemstones in the line as quickly as possible.
In one second, Genos is able to choo... |
### Prompt
Create a solution in cpp for the following problem:
Mahmoud and Ehab play a game called the even-odd game. Ehab chooses his favorite integer n and then they take turns, starting from Mahmoud. In each player's turn, he has to choose an integer a and subtract it from n such that:
* 1 β€ a β€ n.
* If it's... |
### Prompt
Please formulate a CPP solution to the following problem:
Jenya has recently acquired quite a useful tool β k-scissors for cutting strings. They are generally used for cutting out two non-intersecting substrings of length k from an arbitrary string s (its length should be at least 2Β·k in order to perform t... |
### Prompt
Generate a Cpp solution to the following problem:
A bitstring is a string consisting only of the characters 0 and 1. A bitstring is called k-balanced if every substring of size k of this bitstring has an equal amount of 0 and 1 characters (k/2 of each).
You are given an integer k and a string s which is c... |
### Prompt
Please formulate 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 lev... |
### Prompt
Your task is to create a CPP solution 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 f... |
### Prompt
Please create a solution in CPP to the following problem:
Advertising has become part of our routine. And now, in the era of progressive technologies, we need your ideas to make advertising better!
In this problem we'll look at a simplified version of context advertising. You've got a text, consisting of ... |
### Prompt
Construct a cpp code solution to the problem outlined:
In the city of Nevermore, there are 10^8 streets and 10^8 avenues, both numbered from 0 to 10^8-1. All streets run straight from west to east, and all avenues run straight from south to north. The distance between neighboring streets and between neighb... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Takahashi is practicing shiritori alone again today.
Shiritori is a game as follows:
* In the first turn, a player announces any one word.
* In the subsequent turns, a player announces a word that satisfies the following conditions:
* Th... |
### Prompt
Please formulate a CPP solution to the following problem:
The only difference between the easy and the hard versions is the maximum value of k.
You are given an infinite sequence of form "112123123412345..." which consist of blocks of all consecutive positive integers written one after another. The first ... |
### Prompt
Please provide a cpp coded solution to the problem described below:
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four neighbouring buildings. All streets are para... |
### Prompt
Please create a solution in CPP to the following problem:
You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times.
* Choose a contiguous segment [l,r... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Throughout Igor K.'s life he has had many situations worthy of attention. We remember the story with the virus, the story of his mathematical career and of course, his famous programming achievements. However, one does not always adopt new... |
### Prompt
In Cpp, your task is to solve the following problem:
If the strings are consecutive, you can replace the characters with a rule to shorten the string. For example, for the string AAAA, the expression @ 4A will compress one character. Create a program that restores the character string compressed by this ru... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
DZY loves chessboard, and he enjoys playing with it.
He has a chessboard of n rows and m columns. Some cells of the chessboard are bad, others are good. For every good cell, DZY wants to put a chessman on it. Each chessman is either white... |
### Prompt
Please create a solution in Cpp to the following problem:
It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following moves. During each move, eithe... |
### Prompt
Your task is to create a cpp solution to the following problem:
You are given a sequence of positive integers x1, x2, ..., xn and two non-negative integers a and b. Your task is to transform a into b. To do that, you can perform the following moves:
* subtract 1 from the current a;
* subtract a mod x... |
### Prompt
Please formulate a cpp solution to the following problem:
You are given a directed weighted graph with n nodes and 2n - 2 edges. The nodes are labeled from 1 to n, while the edges are labeled from 1 to 2n - 2. The graph's edges can be split into two parts.
* The first n - 1 edges will form a rooted span... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Example
Input
0 3 1 7 5 9 8 6 4 2
7 0 9 2 1 5 4 8 6 3
4 2 0 6 8 7 1 3 5 9
1 7 5 0 9 8 3 4 2 6
6 1 2 3 0 4 5 9 7 8
3 6 7 4 2 0 9 5 8 1
5 8 6 9 7 2 0 1 3 4
8 9 4 5 3 6 2 0 1 7
9 4 3 8 6 1 7 2 0 5
2 5 8 1 4 3 6 7 9 0
Output
0
### Respon... |
### Prompt
Please formulate a Cpp solution to the following problem:
You are working for an administration office of the International Center for Picassonian Cubism (ICPC), which plans to build a new art gallery for young artists. The center is organizing an architectural design competition to find the best design fo... |
### Prompt
Construct a CPP code solution to the problem outlined:
To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation:
* 1 yen (the currency of Japan)
* 6 yen, 6^2(=36) yen, 6^3(=216) yen, ...
* 9 yen, 9^2(=81) yen, 9^3(=729) ye... |
### Prompt
Please formulate a cpp solution to the following problem:
BCPC stands for Byteforces Collegiate Programming Contest, and is the most famous competition in Byteforces.
BCPC is a team competition. Each team is composed by a coach and three contestants. Blenda is the coach of the Bit State University(BSU), a... |
### Prompt
In cpp, your task is to solve the following problem:
You are given a line of n colored squares in a row, numbered from 1 to n from left to right. The i-th square initially has the color c_i.
Let's say, that two squares i and j belong to the same connected component if c_i = c_j, and c_i = c_k for all k sa... |
### Prompt
Create a solution in Cpp for the following problem:
In an English class Nick had nothing to do at all, and remembered about wonderful strings called palindromes. We should remind you that a string is called a palindrome if it can be read the same way both from left to right and from right to left. Here are... |
### Prompt
Please create a solution in CPP to the following problem:
Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1, p2, ..., pn.
Your task is to find such permutation p of length n, that the gr... |
### Prompt
Develop a solution in CPP to the problem described below:
Students in a class are making towers of blocks. Each student makes a (non-zero) tower by stacking pieces lengthwise on top of each other. n of the students use pieces made of two blocks and m of the students use pieces made of three blocks.
The st... |
### Prompt
Your task is to create a CPP solution to the following problem:
Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play t matches of a digit game...
In each of t matches of the digit game, a positive integer is g... |
### Prompt
Please create a solution in cpp to the following problem:
When Adam gets a rooted tree (connected non-directed graph without cycles), he immediately starts coloring it. More formally, he assigns a color to each edge of the tree so that it meets the following two conditions:
* There is no vertex that ha... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
A new airplane SuperPuperJet has an infinite number of rows, numbered with positive integers starting with 1 from cockpit to tail. There are six seats in each row, denoted with letters from 'a' to 'f'. Seats 'a', 'b' and 'c' are located to... |
### Prompt
Create a solution in CPP for the following problem:
A permutation of size n is an array of size n such that each integer from 1 to n occurs exactly once in this array. An inversion in a permutation p is a pair of indices (i, j) such that i > j and ai < aj. For example, a permutation [4, 1, 3, 2] contains 4... |
### Prompt
Develop a solution in cpp to the problem described below:
Vus the [Cossack](https://en.wikipedia.org/wiki/Cossacks) holds a programming competition, in which n people participate. He decided to award them all with pens and notebooks. It is known that Vus has exactly m pens and k notebooks.
Determine wheth... |
### Prompt
Develop a solution in Cpp to the problem described below:
One day Squidward, Spongebob and Patrick decided to go to the beach. Unfortunately, the weather was bad, so the friends were unable to ride waves. However, they decided to spent their time building sand castles.
At the end of the day there were n c... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Well, here is another math class task. In mathematics, GCD is the greatest common divisor, and it's an easy task to calculate the GCD between two positive integers.
A common divisor for two positive numbers is a number which both numbers ... |
### Prompt
Please create a solution in cpp to the following problem:
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct.
... |
### Prompt
Construct a cpp code solution to the problem outlined:
The Galaxy contains n planets, there are many different living creatures inhabiting each planet. And each creature can get into troubles! Space rescuers know it perfectly well and they are always ready to help anyone who really needs help. All you need... |
### Prompt
Develop a solution in CPP to the problem described below:
There are n students studying in the 6th grade, in group "B" of a berland secondary school. Every one of them has exactly one friend whom he calls when he has some news. Let us denote the friend of the person number i by g(i). Note that the friendsh... |
### Prompt
Please create a solution in Cpp to the following problem:
Let's say you are standing on the XY-plane at point (0, 0) and you want to reach point (n, n).
You can move only in two directions:
* to the right, i. e. horizontally and in the direction that increase your x coordinate,
* or up, i. e. verti... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Misha didn't do his math homework for today's lesson once again. As a punishment, his teacher Dr. Andrew decided to give him a hard, but very useless task.
Dr. Andrew has written two strings s and t of lowercase English letters at the bla... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.