text stringlengths 424 69.5k |
|---|
### Prompt
Please create a solution in CPP to the following problem:
Vova decided to clean his room. The room can be represented as the coordinate axis OX. There are n piles of trash in the room, coordinate of the i-th pile is the integer p_i. All piles have different coordinates.
Let's define a total cleanup as the... |
### Prompt
Your task is to create a Cpp solution to the following problem:
You have an array a[1], a[2], ..., a[n], containing distinct integers from 1 to n. Your task is to sort this array in increasing order with the following operation (you may need to apply it multiple times):
* choose two indexes, i and j (1 ... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
In Berland prime numbers are fashionable β the respectable citizens dwell only on the floors with numbers that are prime numbers. The numismatists value particularly high the coins with prime nominal values. All the prime days are announce... |
### Prompt
Please provide a CPP coded solution to the problem described below:
Arpa is researching the Mexican wave.
There are n spectators in the stadium, labeled from 1 to n. They start the Mexican wave at time 0.
* At time 1, the first spectator stands.
* At time 2, the second spectator stands.
* ...
... |
### Prompt
Please formulate a cpp solution to the following problem:
Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. We'll denote the i-th element of permutation p as pi. We'll call number n the size or the length of permutation p... |
### Prompt
In CPP, your task is to solve the following problem:
You are given an array a_1, a_2, ..., a_n and an array b_1, b_2, ..., b_n.
For one operation you can sort in non-decreasing order any subarray a[l ... r] of the array a.
For example, if a = [4, 2, 2, 1, 3, 1] and you choose subbarray a[2 ... 5], then t... |
### Prompt
Please formulate a CPP solution to the following problem:
Given is a string S. Replace every character in S with `x` and print the result.
Constraints
* S is a string consisting of lowercase English letters.
* The length of S is between 1 and 100 (inclusive).
Input
Input is given from Standard Input in... |
### Prompt
In cpp, your task is to solve the following problem:
The Ohgas are a prestigious family based on Hachioji. The head of the family, Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune by depositing his money to an operation company. You are asked to help Mr. Ohga maximize his profit by op... |
### Prompt
In Cpp, your task is to solve the following problem:
Sherlock has a new girlfriend (so unlike him!). Valentine's day is coming and he wants to gift her some jewelry.
He bought n pieces of jewelry. The i-th piece has price equal to i + 1, that is, the prices of the jewelry are 2, 3, 4, ... n + 1.
Watson g... |
### Prompt
Please create a solution in cpp to the following problem:
There are N blocks arranged in a row, numbered 1 to N from left to right. Each block has a weight, and the weight of Block i is A_i. Snuke will perform the following operation on these blocks N times:
* Choose one block that is still not removed, a... |
### Prompt
Please create a solution in CPP to the following problem:
Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29.
Input
The input is a sequence of datasets. The end of ... |
### Prompt
Please formulate a Cpp solution to the following problem:
From beginning till end, this message has been waiting to be conveyed.
For a given unordered multiset of n lowercase English letters ("multi" means that a letter may appear more than once), we treat all letters as strings of length 1, and repeat th... |
### Prompt
Develop a solution in Cpp to the problem described below:
Ori and Sein have overcome many difficult challenges. They finally lit the Shrouded Lantern and found Gumon Seal, the key to the Forlorn Ruins. When they tried to open the door to the ruins... nothing happened.
Ori was very surprised, but Sein gave... |
### Prompt
Construct a CPP code solution to the problem outlined:
You are enthusiastic about the popular web game "Moonlight Ranch". The purpose of this game is to grow crops in the fields, sell them to earn income, and use that income to grow the ranch.
You wanted to grow the field quickly. Therefore, we decided to... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Housing maker Yamada House has launched a new featured product, a land for sale in a green home town with a rich environment such as schools and hospitals. This lot is divided into multiple lots and you can buy as many as you like, but the... |
### Prompt
Please create a solution in CPP to the following problem:
You are given a string s of length n consisting of lowercase Latin letters. You may apply some operations to this string: in one operation you can delete some contiguous substring of this string, if all letters in the substring you delete are equal.... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
You are given an array of length n and a number k. Let's pick k non-overlapping non-empty subarrays of the initial array. Let si be the sum of the i-th subarray in order from left to right. Compute the maximum value of the following expres... |
### Prompt
Please formulate a cpp solution to the following problem:
The Romans have attacked again. This time they are much more than the Persians but Shapur is ready to defeat them. He says: "A lion is never afraid of a hundred sheep".
Nevertheless Shapur has to find weaknesses in the Roman army to defeat them. S... |
### Prompt
Your task is to create a CPP solution to the following problem:
There are N white balls arranged in a row, numbered 1,2,..,N from left to right. AtCoDeer the deer is thinking of painting some of these balls red and blue, while leaving some of them white.
You are given a string s of length K. AtCoDeer perf... |
### Prompt
Your task is to create a CPP solution to the following problem:
Recently Polycarp noticed that some of the buttons of his keyboard are malfunctioning. For simplicity, we assume that Polycarp's keyboard contains 26 buttons (one for each letter of the Latin alphabet). Each button is either working fine or ma... |
### Prompt
Please create a solution in Cpp to the following problem:
You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For example, 1912 becomes 21023 after applying the operation onc... |
### Prompt
Please provide a cpp coded solution to the problem described below:
You are given array a_1, a_2, ..., a_n. You need to split it into k subsegments (so every element is included in exactly one subsegment).
The weight of a subsegment a_l, a_{l+1}, ..., a_r is equal to (r - l + 1) β
max_{l β€ i β€ r}(a_i). Th... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Iahub is a big fan of tourists. He wants to become a tourist himself, so he planned a trip. There are n destinations on a straight road that Iahub wants to visit. Iahub starts the excursion from kilometer 0. The n destinations are described by... |
### Prompt
Develop a solution in Cpp to the problem described below:
You are given a tetrahedron. Let's mark its vertices with letters A, B, C and D correspondingly.
<image>
An ant is standing in the vertex D of the tetrahedron. The ant is quite active and he wouldn't stay idle. At each moment of time he makes a st... |
### Prompt
Develop a solution in Cpp to the problem described below:
Input
The input contains a single integer a (1 β€ a β€ 30).
Output
Output a single integer.
Example
Input
3
Output
27
### Response
```cpp
#include <bits/stdc++.h>
int a[] = {0, 4, 22, 27, 58, 85, 94, 121, 166, 202, 265,
... |
### Prompt
Develop a solution in Cpp to the problem described below:
A team of three programmers is going to play a contest. The contest consists of n problems, numbered from 1 to n. Each problem is printed on a separate sheet of paper. The participants have decided to divide the problem statements into three parts: ... |
### Prompt
Generate a CPP solution to the following problem:
Three years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one door, then another, then one more and ... |
### Prompt
Construct a cpp code solution to the problem outlined:
You have to organize a wedding party. The program of the party will include a concentration game played by the bride and groom. The arrangement of the concentration game should be easy since this game will be played to make the party fun.
We have a 4x... |
### Prompt
Your task is to create a CPP solution to the following problem:
When you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters. You have decided to choose some three consecutive characters from S and ma... |
### Prompt
Please formulate a Cpp solution to the following problem:
You are given an array of n integers a_1,a_2,...,a_n.
You have to create an array of n integers b_1,b_2,...,b_n such that:
* The array b is a rearrangement of the array a, that is, it contains the same values and each value appears the same num... |
### Prompt
In Cpp, your task is to solve the following problem:
<image>
One evening. As usual, when you were watching TV in the living room, my sister in fifth grade offered me a consultation. When I listened to the story, I couldn't understand the math problem that was presented at school today, so I want you to te... |
### Prompt
Please formulate a Cpp solution to the following problem:
Initially there was an array a consisting of n integers. Positions in it are numbered from 1 to n.
Exactly q queries were performed on the array. During the i-th query some segment (l_i, r_i) (1 β€ l_i β€ r_i β€ n) was selected and values of elements ... |
### Prompt
Create a solution in Cpp for the following problem:
problem
At the JOI pasta shop, the recommended pasta for lunch and the set menu of freshly squeezed juice are popular. When ordering this set menu, choose one from each of the three pasta and two juices of the day. The price is the total price of pasta a... |
### Prompt
Develop a solution in Cpp to the problem described below:
Just in case somebody missed it: this winter is totally cold in Nvodsk! It is so cold that one gets funny thoughts. For example, let's say there are strings with the length exactly n, based on the alphabet of size m. Any its substring with length eq... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Aiz, which is located in cyberspace, trades information with Wakamatsu. The two countries are developing their economies by exchanging useful data with each other. The two countries, whose national policy is philanthropy and equality, and ... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
One day a bear lived on the Oxy axis. He was afraid of the dark, so he couldn't move at night along the plane points that aren't lit. One day the bear wanted to have a night walk from his house at point (l, 0) to his friend's house at poin... |
### Prompt
Develop a solution in cpp to the problem described below:
Write a program which performs the following operations to a binary search tree $T$ by adding delete operation to B: Binary Search Tree II.
* insert $k$: Insert a node containing $k$ as key into $T$.
* find $k$: Report whether $T$ has a node conta... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
You are given three integers x, y and n. Your task is to find the maximum integer k such that 0 β€ k β€ n that k mod x = y, where mod is modulo operation. Many programming languages use percent operator % to implement it.
In other words, wi... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Example
Input
mmemewwemeww
Output
Cat
### Response
```cpp
#include <iostream>
#include <string>
#include <vector>
using namespace std;
bool check(string const& s, int& p) {
//cout << "p: " << p << endl;
if(s.size() >= p+3 &... |
### Prompt
Please create a solution in cpp to the following problem:
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya wonders eagerly what mi... |
### Prompt
Please formulate a Cpp solution to the following problem:
Allen is hosting a formal dinner party. 2n people come to the event in n pairs (couples). After a night of fun, Allen wants to line everyone up for a final picture. The 2n people line up, but Allen doesn't like the ordering. Allen prefers if each pa... |
### Prompt
Please create a solution in Cpp to the following problem:
Alexandra has an even-length array a, consisting of 0s and 1s. The elements of the array are enumerated from 1 to n. She wants to remove at most n/2 elements (where n β length of array) in the way that alternating sum of the array will be equal 0 (i... |
### Prompt
Please create a solution in CPP to the following problem:
After several latest reforms many tourists are planning to visit Berland, and Berland people understood that it's an opportunity to earn money and changed their jobs to attract tourists. Petya, for example, left the IT corporation he had been workin... |
### Prompt
Construct a CPP code solution to the problem outlined:
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob β to check his answers, he... |
### Prompt
Create a solution in CPP for the following problem:
Once again, Boris needs the help of Anton in creating a task. This time Anton needs to solve the following problem:
There are two arrays of integers a and b of length n. It turned out that array a contains only elements from the set \{-1, 0, 1\}.
Anton ... |
### Prompt
Develop a solution in Cpp to the problem described below:
You've got a undirected graph G, consisting of n nodes. We will consider the nodes of the graph indexed by integers from 1 to n. We know that each node of graph G is connected by edges with at least k other nodes of this graph. Your task is to find ... |
### Prompt
Develop a solution in CPP to the problem described below:
Logical quantifiers are very useful tools for expressing claims about a set. For this problem, let's focus on the set of real numbers specifically. The set of real numbers includes zero and negatives. There are two kinds of quantifiers: universal (β... |
### Prompt
In CPP, your task is to solve the following problem:
Vova's house is an array consisting of n elements (yeah, this is the first problem, I think, where someone lives in the array). There are heaters in some positions of the array. The i-th element of the array is 1 if there is a heater in the position i, o... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Yukiya, the owner of Aizuyama Ski Resort, has prepared a course for advanced skiers with obstacles and jumping hills. There are various ways to slide on the course, and users who can slide in all patterns during the season will be given a ... |
### Prompt
Please provide a CPP coded solution to the problem described below:
This problem is same as the next one, but has smaller constraints.
Shiro's just moved to the new house. She wants to invite all friends of her to the house so they can play monopoly. However, her house is too small, so she can only invite... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Unfortunately, Vasya can only sum pairs of integers (a, b), such that for any decimal place at least one number has digit 0 in this place. For example, Vasya can sum numbers 505 and 50, but he cannot sum 1 and 4.
Vasya has a set of k dist... |
### Prompt
Please provide a cpp coded solution to the problem described below:
In the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they got an order that Bob is a scouter, if t... |
### Prompt
In CPP, your task is to solve the following problem:
Little X has met the following problem recently.
Let's define f(x) as the sum of digits in decimal representation of number x (for example, f(1234) = 1 + 2 + 3 + 4). You are to calculate <image>
Of course Little X has solved this problem quickly, has ... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Find the number of palindromic numbers among the integers between A and B (inclusive). Here, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward.
Co... |
### Prompt
Create a solution in cpp for 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.
Recor... |
### Prompt
Develop a solution in CPP to the problem described below:
The number "zero" is called "love" (or "l'oeuf" to be precise, literally means "egg" in French), for example when denoting the zero score in a game of tennis.
Aki is fond of numbers, especially those with trailing zeros. For example, the number 92... |
### Prompt
In cpp, your task is to solve the following problem:
In the State of Takahashi in AtCoderian Federation, there are N cities, numbered 1, 2, ..., N. M bidirectional roads connect these cities. The i-th road connects City A_i and City B_i. Every road connects two distinct cities. Also, for any two cities, th... |
### Prompt
Construct a CPP code solution to the problem outlined:
Drazil is playing a math game with Varda.
Let's define <image> for positive integer x as a product of factorials of its digits. For example, <image>.
First, they choose a decimal number a consisting of n digits that contains at least one digit larger... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
You are given an array a of n positive integers.
You can use the following operation as many times as you like: select any integer 1 β€ k β€ n and do one of two things:
* decrement by one k of the first elements of the array.
* decre... |
### Prompt
Generate a Cpp solution to the following problem:
You are given a directed graph G with n vertices and m arcs (multiple arcs and self-loops are allowed). You have to paint each vertex of the graph into one of the k (k β€ n) colors in such way that for all arcs of the graph leading from a vertex u to vertex ... |
### Prompt
Develop a solution in CPP to the problem described below:
In 2028 and after a continuous growth, AtCoder Inc. finally built an empire with six cities (City 1, 2, 3, 4, 5, 6)!
There are five means of transport in this empire:
* Train: travels from City 1 to 2 in one minute. A train can occupy at most A pe... |
### Prompt
In CPP, your task is to solve 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 friendsh... |
### Prompt
Create a solution in Cpp for the following problem:
Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.
The world can be modeled as an undirected graph with n nodes and m edges. k of the nodes are home to the governments... |
### Prompt
Generate a cpp solution to the following problem:
For a connected undirected weighted graph G, MST (minimum spanning tree) is a subgraph of G that contains all of G's vertices, is a tree, and sum of its edges is minimum possible.
You are given a graph G. If you run a MST algorithm on graph it would give y... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
We call a string good, if after merging all the consecutive equal characters, the resulting string is palindrome. For example, "aabba" is good, because after the merging step it will become "aba".
Given a string, you have to find two valu... |
### Prompt
Please create a solution in cpp to the following problem:
We guessed some integer number x. You are given a list of almost all its divisors. Almost all means that there are all divisors except 1 and x in the list.
Your task is to find the minimum possible integer x that can be the guessed number, or say t... |
### Prompt
Your task is to create a Cpp solution to the following problem:
You are given an undirected graph consisting of n vertices. Initially there are no edges in the graph. Also you are given q queries, each query either adds one undirected edge to the graph or removes it. After each query you have to check if t... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
You are managing a mobile phone network, and want to offer competitive prices to connect a network.
The network has n nodes.
Your competitor has already offered some connections between some nodes, with some fixed prices. These connectio... |
### Prompt
In cpp, your task is to solve the following problem:
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers... |
### Prompt
Develop a solution in cpp to the problem described below:
You are given two arrays a and b, both of length n.
Let's define a function f(l, r) = β_{l β€ i β€ r} a_i β
b_i.
Your task is to reorder the elements (choose an arbitrary order of elements) of the array b to minimize the value of β_{1 β€ l β€ r β€ n} f... |
### Prompt
Please provide a CPP coded solution to the problem described below:
The Metropolis computer network consists of n servers, each has an encryption key in the range from 0 to 2^k - 1 assigned to it. Let c_i be the encryption key assigned to the i-th server. Additionally, m pairs of servers are directly conne... |
### Prompt
Generate a cpp solution to the following problem:
Dr. Asimov, a robotics researcher, loves to research, but hates houseworks and his house were really dirty. So, he has developed a cleaning robot.
As shown in the following figure, his house has 9 rooms, where each room is identified by an alphabet:
<ima... |
### Prompt
Please create a solution in cpp 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! More preci... |
### Prompt
Please provide a cpp coded solution to the problem described below:
There was an electronic store heist last night.
All keyboards which were in the store yesterday were numbered in ascending order from some integer number x. For example, if x = 4 and there were 3 keyboards in the store, then the devices h... |
### Prompt
Create a solution in CPP for the following problem:
Vasya decided to pass a very large integer n to Kate. First, he wrote that number as a string, then he appended to the right integer k β the number of digits in n.
Magically, all the numbers were shuffled in arbitrary order while this note was passed to... |
### Prompt
Create a solution in CPP for the following problem:
Priests of the Quetzalcoatl cult want to build a tower to represent a power of their god. Tower is usually made of power-charged rocks. It is built with the help of rare magic by levitating the current top of tower and adding rocks at its bottom. If top, ... |
### Prompt
Create a solution in Cpp for the following problem:
This problem differs from the next one only in the presence of the constraint on the equal length of all numbers a_1, a_2, ..., a_n. Actually, this problem is a subtask of the problem D2 from the same contest and the solution of D2 solves this subtask too... |
### Prompt
Please provide a CPP coded solution to the problem described below:
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 o... |
### Prompt
Construct a CPP code solution to the problem outlined:
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates.
You can build a road between two towns at coordinates (a,b) and (c,d) for a cost of min(|a-c|,|b-d|) yen (the... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes.
Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). ... |
### Prompt
Develop a solution in CPP to the problem described below:
Jeff's got n cards, each card contains either digit 0, or digit 5. Jeff can choose several cards and put them in a line so that he gets some number. What is the largest possible number divisible by 90 Jeff can make from the cards he's got?
Jeff mus... |
### Prompt
Please provide a CPP coded solution to the problem described below:
In one well-known algorithm of finding the k-th order statistics we should divide all elements into groups of five consecutive elements and find the median of each five. A median is called the middle element of a sorted array (it's the thi... |
### Prompt
Create a solution in cpp for the following problem:
Little Petya is now fond of data compression algorithms. He has already studied gz, bz, zip algorithms and many others. Inspired by the new knowledge, Petya is now developing the new compression algorithm which he wants to name dis.
Petya decided to comp... |
### Prompt
Generate a CPP solution to the following problem:
You are given an integer k and a tree T with n nodes (n is even).
Let dist(u, v) be the number of edges on the shortest path from node u to node v in T.
Let us define a undirected weighted complete graph G = (V, E) as following:
* V = \\{x β£ 1 β€ x β€ n... |
### Prompt
In CPP, your task is to solve the following problem:
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?
There are n students living in a building, and for e... |
### Prompt
Please formulate a cpp solution to the following problem:
Write a program of a Merge Sort algorithm implemented by the following pseudocode. You should also report the number of comparisons in the Merge function.
Merge(A, left, mid, right)
n1 = mid - left;
n2 = right - mid;
create array L[0...n1], R[0...... |
### Prompt
Generate a CPP solution to the following problem:
If you draw a few infinitely long straight lines on an infinitely wide plane, this plane will be divided into several areas. For example, if you draw a straight line, the plane will be divided into two areas. Even if you draw the same number of straight lin... |
### Prompt
Please formulate a Cpp solution to the following problem:
Everybody knows that the capital of Berland is connected to Bercouver (the Olympic capital) by a direct road. To improve the road's traffic capacity, there was placed just one traffic sign, limiting the maximum speed. Traffic signs in Berland are a ... |
### Prompt
Please formulate a Cpp solution to the following problem:
You are given two arrays of integers a and b. For each element of the second array bj you should find the number of elements in array a that are less than or equal to the value bj.
Input
The first line contains two integers n, m (1 β€ n, m β€ 2Β·105)... |
### Prompt
Construct a cpp code solution to the problem outlined:
A brave princess in a poor country's tomboy is married to another country for a political marriage. However, a villain who is trying to kill the princess is releasing a thug on the way to his wife.
You have already decided on a safe route to safely de... |
### Prompt
Create a solution in CPP for the following problem:
Initially Ildar has an empty array. He performs n steps. On each step he takes a subset of integers already added to the array and appends the mex of this subset to the array.
The mex of an multiset of integers is the smallest non-negative integer not p... |
### Prompt
Please formulate a cpp solution to the following problem:
You are given an array a consisting of positive integers and q queries to this array. There are two types of queries:
* 1 l r x β for each index i such that l β€ i β€ r set ai = x.
* 2 l r β find the minimum among such ai that l β€ i β€ r.
We... |
### Prompt
Create a solution in cpp for the following problem:
You are given two integers a and b. You can perform a sequence of operations: during the first operation you choose one of these numbers and increase it by 1; during the second operation you choose one of these numbers and increase it by 2, and so on. You... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Short Phrase
A Short Phrase (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition:
> (The Conditio... |
### Prompt
Create a solution in Cpp for the following problem:
A ladies' shop has recently opened in the city of Ultima Thule. To get ready for the opening, the shop bought n bags. Each bag is characterised by the total weight ai of the items you can put there. The weird thing is, you cannot use these bags to put a s... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Under the command "Save Sergeant Ryan," Aiz's rescue team fought fierce battles with enemy forces in the floating city of Lee, Germany. They successfully joined the sergeant, but there were many enemy tanks and they could not call a rescue... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Consider a rooted tree. A rooted tree has one special vertex called the root. All edges are directed from the root. Vertex u is called a child of vertex v and vertex v is called a parent of vertex u if there exists a directed edge from v t... |
### Prompt
Please provide a CPP coded solution to the problem described below:
Three-valued logic is a logic system that has, in addition to "true" and "false", "unknown" as a valid value. In the following, logical values "false", "unknown" and "true" are represented by 0, 1 and 2 respectively.
Let "-" be a unary op... |
### Prompt
Create a solution in Cpp for the following problem:
You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different.
Constraints
* 2 β€ |S| β€ 26, where |S| denotes the length of S.
* S consists of lowercase English letters.
Input
Input is given f... |
### Prompt
In Cpp, your task is to solve the following problem:
There are n animals in the queue to Dr. Dolittle. When an animal comes into the office, the doctor examines him, gives prescriptions, appoints tests and may appoint extra examination. Doc knows all the forest animals perfectly well and therefore knows ex... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.