text stringlengths 424 69.5k |
|---|
### Prompt
Construct a Cpp code solution to the problem outlined:
As Gerald, Alexander, Sergey and Gennady are already busy with the usual New Year chores, Edward hastily decorates the New Year Tree. And any decent New Year Tree must be decorated with a good garland. Edward has lamps of m colors and he wants to make ... |
### Prompt
Construct a Cpp code solution to the problem outlined:
The height of the student was measured at the medical examination. Create a program that takes height data as input, creates a frequency distribution, and outputs it. The frequency distribution is divided into 6 classes in 5 cm increments, and the numb... |
### Prompt
Please provide a CPP coded solution to the problem described below:
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are n displays placed along a road, and the i-th of them ... |
### Prompt
Please create a solution in cpp to the following problem:
Gosha is hunting. His goal is to catch as many Pokemons as possible. Gosha has a Poke Balls and b Ultra Balls. There are n Pokemons. They are numbered 1 through n. Gosha knows that if he throws a Poke Ball at the i-th Pokemon he catches it with prob... |
### Prompt
Create a solution in Cpp for the following problem:
Polycarp often uses his smartphone. He has already installed n applications on it. Application with number i takes up a_i units of memory.
Polycarp wants to free at least m units of memory (by removing some applications).
Of course, some applications ar... |
### Prompt
Create a solution in CPP for the following problem:
There are n cities in Cyberland, numbered from 1 to n, connected by m bidirectional roads. The j-th road connects city aj and bj.
For tourists, souvenirs are sold in every city of Cyberland. In particular, city i sell it at a price of wi.
Now there are ... |
### Prompt
Please create a solution in CPP to the following problem:
Alfred wants to buy a toy moose that costs c dollars. The store doesn’t give change, so he must give the store exactly c dollars, no more and no less. He has n coins. To make c dollars from his coins, he follows the following algorithm: let S be the... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Takahashi received otoshidama (New Year's money gifts) from N of his relatives.
You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the c... |
### Prompt
Create a solution in Cpp for the following problem:
Input
The input contains two integers N, M (1 ≤ N ≤ 1024, 2 ≤ M ≤ 16), separated by a single space.
Output
Output "YES" or "NO".
Examples
Input
2 3
Output
YES
Input
3 2
Output
NO
Input
33 16
Output
YES
Input
26 5
Output
... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
One day Om Nom found a thread with n beads of different colors. He decided to cut the first several beads from this thread to make a bead necklace and present it to his girlfriend Om Nelly.
<image>
Om Nom knows that his girlfriend loves ... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction.
More specifically, in one move, he can go from coordinate x to x + D or x - D.
He wants to... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
There are n psychos standing in a line. Each psycho is assigned a unique integer from 1 to n. At each step every psycho who has an id greater than the psycho to his right (if exists) kills his right neighbor in the line. Note that a psycho... |
### Prompt
Develop a solution in CPP to the problem described below:
Friday is Polycarpus' favourite day of the week. Not because it is followed by the weekend, but because the lessons on Friday are 2 IT lessons, 2 math lessons and 2 literature lessons. Of course, Polycarpus has prepared to all of them, unlike his bu... |
### Prompt
Create a solution in CPP for 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 minimum ... |
### Prompt
Create a solution in CPP for the following problem:
The HR manager was disappointed again. The last applicant failed the interview the same way as 24 previous ones. "Do I give such a hard task?" — the HR manager thought. "Just raise number 5 to the power of n and get last two digits of the number. Yes, of ... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Let s(x) be sum of digits in decimal representation of positive integer x. Given two integers n and m, find some positive integers a and b such that
* s(a) ≥ n,
* s(b) ≥ n,
* s(a + b) ≤ m.
Input
The only line of input contain ... |
### Prompt
Please formulate a Cpp solution to the following problem:
This problem's actual name, "Lexicographically Largest Palindromic Subsequence" is too long to fit into the page headline.
You are given string s consisting of lowercase English letters only. Find its lexicographically largest palindromic subsequen... |
### Prompt
Please provide a cpp coded solution to the problem described below:
After a wonderful evening in the restaurant the time to go home came. Leha as a true gentlemen suggested Noora to give her a lift. Certainly the girl agreed with pleasure. Suddenly one problem appeared: Leha cannot find his car on a huge p... |
### Prompt
Please create a solution in CPP to the following problem:
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)... |
### Prompt
Construct a CPP code solution to the problem outlined:
A string is called a KEYENCE string when it can be changed to `keyence` by removing its contiguous substring (possibly empty) only once.
Given a string S consisting of lowercase English letters, determine if S is a KEYENCE string.
Constraints
* The ... |
### Prompt
Create a solution in CPP for the following problem:
Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks.
There is only one shower and there are multiple students who wish to have a shower in the morning. That's why every... |
### Prompt
Please formulate a Cpp solution to the following problem:
The full exploration sister is a very talented woman. Your sister can easily count the number of routes in a grid pattern if it is in the thousands. You and your exploration sister are now in a room lined with hexagonal tiles. The older sister seems... |
### Prompt
Generate a Cpp solution to the following problem:
Today, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.
As the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be... |
### Prompt
Construct a cpp code solution to the problem outlined:
You are given two squares, one with sides parallel to the coordinate axes, and another one with sides at 45 degrees to the coordinate axes. Find whether the two squares intersect.
The interior of the square is considered to be part of the square, i.e.... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Bob wants to put a new bargaining table in his office. To do so he measured the office room thoroughly and drew its plan: Bob's office room is a rectangular room n × m meters. Each square meter of the room is either occupied by some furnit... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
In this problem you have to build tournament graph, consisting of n vertices, such, that for any oriented pair of vertices (v, u) (v ≠ u) there exists a path from vertex v to vertex u consisting of no more then two edges.
A directed graph... |
### Prompt
Please create a solution in Cpp to the following problem:
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 parallel to th... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
problem
Given the sequence $ A $ of length $ N $. The $ i $ item in $ A $ is $ A_i $. You can do the following for this sequence:
* $ 1 \ leq i \ leq N --Choose the integer i that is 1 $. Swap the value of $ A_i $ with the value of $ A_ ... |
### Prompt
Generate a cpp solution to the following problem:
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 arra... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Levko has an array that consists of integers: a1, a2, ... , an. But he doesn’t like this array at all.
Levko thinks that the beauty of the array a directly depends on value c(a), which can be calculated by the formula:
<image> The less ... |
### Prompt
Your task is to create a Cpp solution to the following problem:
There are quite a lot of ways to have fun with inflatable balloons. For example, you can fill them with water and see what happens.
Grigory and Andrew have the same opinion. So, once upon a time, they went to the shop and bought n packets wit... |
### Prompt
In cpp, your task is to solve the following problem:
Vasilisa the Wise from a far away kingdom got a present from her friend Helga the Wise from a farther away kingdom. The present is a surprise box, yet Vasilisa the Wise doesn't know yet what the surprise actually is because she cannot open the box. She h... |
### Prompt
Your task is to create a cpp solution to the following problem:
Consider the infinite sequence of integers: 1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5.... The sequence is built in the following way: at first the number 1 is written out, then the numbers from 1 to 2, then the numbers from 1 to 3, then the ... |
### Prompt
Generate a CPP solution to the following problem:
Snuke found N strange creatures. Each creature has a fixed color and size. The color and size of the i-th creature are represented by i and A_i, respectively.
Every creature can absorb another creature whose size is at most twice the size of itself. When a... |
### Prompt
Create a solution in CPP for the following problem:
There is an infinite sequence consisting of all positive integers in the increasing order: p = {1, 2, 3, ...}. We performed n swap operations with this sequence. A swap(a, b) is an operation of swapping the elements of the sequence on positions a and b. Y... |
### Prompt
Please provide a cpp coded solution to the problem described below:
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.
The three friends are very smart s... |
### Prompt
Please create a solution in CPP to the following problem:
You are planning to buy an apartment in a n-floor building. The floors are numbered from 1 to n from the bottom to the top. At first for each floor you want to know the minimum total time to reach it from the first (the bottom) floor.
Let:
* a_i... |
### Prompt
In CPP, your task is to solve the following problem:
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that
1. 1 ≤ i, j ≤ N
2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Input
The single input line co... |
### Prompt
Please formulate a Cpp solution to the following problem:
You are given a sequence a_1, a_2, ..., a_n, consisting of integers.
You can apply the following operation to this sequence: choose some integer x and move all elements equal to x either to the beginning, or to the end of a. Note that you have to m... |
### Prompt
Please create a solution in cpp to the following problem:
Do you like summer? Residents of Berland do. They especially love eating ice cream in the hot summer. So this summer day a large queue of n Berland residents lined up in front of the ice cream stall. We know that each of them has a certain amount of... |
### Prompt
Your task is to create a cpp solution to the following problem:
The Zoo in the Grid Kingdom is represented by an infinite grid. The Zoo has n observation binoculars located at the OX axis. For each i between 1 and n, inclusive, there exists a single binocular located at the point with coordinates (i, 0). T... |
### Prompt
Construct a CPP code solution to the problem outlined:
There is a directed graph with N vertices and N edges. The vertices are numbered 1, 2, ..., N.
The graph has the following N edges: (p_1, 1), (p_2, 2), ..., (p_N, N), and the graph is weakly connected. Here, an edge from Vertex u to Vertex v is denote... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Snuke has two boards, each divided into a grid with N rows and N columns. For both of these boards, the square at the i-th row from the top and the j-th column from the left is called Square (i,j).
There is a lowercase English letter writ... |
### Prompt
Please provide a CPP coded solution to the problem described below:
Diameter of a Tree
Given a tree T with non-negative weight, find the diameter of the tree.
The diameter of a tree is the maximum distance between two nodes in a tree.
Constraints
* 1 ≤ n ≤ 100,000
* 0 ≤ wi ≤ 1,000
Input
n
s1 t1 w... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Ujan decided to make a new wooden roof for the house. He has n rectangular planks numbered from 1 to n. The i-th plank has size a_i × 1 (that is, the width is 1 and the height is a_i).
Now, Ujan wants to make a square roof. He will first ... |
### Prompt
In cpp, your task is to solve the following problem:
In Japan, temperature is usually expressed using the Celsius (℃) scale. In America, they used the Fahrenheit (℉) scale instead. $20$ degrees Celsius is roughly equal to $68$ degrees Fahrenheit. A phrase such as "Today’s temperature is $68$ degrees" is co... |
### Prompt
Construct a CPP code solution to the problem outlined:
Gena loves sequences of numbers. Recently, he has discovered a new type of sequences which he called an almost arithmetical progression. A sequence is an almost arithmetical progression, if its elements can be represented as:
* a1 = p, where p is so... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Vasya plays the sleuth with his friends. The rules of the game are as follows: those who play for the first time, that is Vasya is the sleuth, he should investigate a "crime" and find out what is happening. He can ask any questions whatsoe... |
### Prompt
Create a solution in CPP for the following problem:
You got a box with a combination lock. The lock has a display showing n digits. There are two buttons on the box, each button changes digits on the display. You have quickly discovered that the first button adds 1 to all the digits (all digits 9 become di... |
### Prompt
In Cpp, your task is to solve the following problem:
In this problem you have to solve a simple classification task: given an image, determine whether it depicts a Fourier doodle.
You are given a set of 50 images with ids 1 through 50. You are also given a text file labels.txt containing the labels for i... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
A binary matrix is called good if every even length square sub-matrix has an odd number of ones.
Given a binary matrix a consisting of n rows and m columns, determine the minimum number of cells you need to change to make it good, or rep... |
### Prompt
Construct a cpp code solution to the problem outlined:
Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key.
To begin with, he is using a plain text editor with this keyboard. This editor always displays one s... |
### Prompt
Please create a solution in cpp to the following problem:
For a given sequence of distinct non-negative integers (b_1, b_2, ..., b_k) we determine if it is good in the following way:
* Consider a graph on k nodes, with numbers from b_1 to b_k written on them.
* For every i from 1 to k: find such j (1 ... |
### Prompt
Generate a Cpp solution to the following problem:
A process RAM is a sequence of bytes that are indexed from 1 to n. Polycarpus's program contains such instructions as "memset", that is, the operations of filling memory cells on a segment with some value. The details are: the code only contains m instructi... |
### Prompt
Develop a solution in Cpp to the problem described below:
Mike is the president of country What-The-Fatherland. There are n bears living in this country besides Mike. All of them are standing in a line and they are numbered from 1 to n from left to right. i-th bear is exactly ai feet high.
<image>
A gro... |
### Prompt
Develop a solution in Cpp to the problem described below:
Zibi is a competitive programming coach. There are n competitors who want to be prepared well. The training contests are quite unusual – there are two people in a team, two problems, and each competitor will code exactly one of them. Of course, peop... |
### Prompt
Please formulate a Cpp solution to the following problem:
This is the easy version of the problem. The difference between the versions is in the number of possible operations that can be made. You can make hacks if and only if you solved both versions of the problem.
You are given a binary table of size n... |
### Prompt
Please create a solution in CPP to the following problem:
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors <im... |
### Prompt
Please create a solution in Cpp to the following problem:
Duff is addicted to meat! Malek wants to keep her happy for n days. In order to be happy in i-th day, she needs to eat exactly ai kilograms of meat.
<image>
There is a big shop uptown and Malek wants to buy meat for her from there. In i-th day, th... |
### Prompt
Please formulate a Cpp solution to the following problem:
Snuke received a positive integer N from Takahashi. A positive integer m is called a favorite number when the following condition is satisfied:
* The quotient and remainder of N divided by m are equal, that is, \lfloor \frac{N}{m} \rfloor = N \bmod... |
### Prompt
Generate a cpp solution to the following problem:
Nearly each project of the F company has a whole team of developers working on it. They often are in different rooms of the office in different cities and even countries. To keep in touch and track the results of the project, the F company conducts shared o... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Aka Beko, trying to escape from 40 bandits, got lost in the city of A. Aka Beko wants to go to City B, where the new hideout is, but the map has been stolen by a bandit.
Kobborg, one of the thieves, sympathized with Aka Beko and felt sorr... |
### Prompt
Your task is to create a CPP solution to the following problem:
This is an interactive problem.
You are given a sorted in increasing order singly linked list. You should find the minimum integer in the list which is greater than or equal to x.
More formally, there is a singly liked list built on an array... |
### Prompt
Please formulate a cpp solution to the following problem:
You have m = n·k wooden staves. The i-th stave has length ai. You have to assemble n barrels consisting of k staves each, you can use any k staves to construct a barrel. Each stave must belong to exactly one barrel.
Let volume vj of barrel j be equ... |
### Prompt
Develop a solution in CPP to the problem described below:
One day as Petya and his friend Vasya were having one of their numerous trips, they decided to visit a museum castle. The museum has a specific shape: it consists of n rooms connected with m corridors so that one can access any room from any other o... |
### Prompt
Please create a solution in CPP to the following problem:
Find places where a string P is found within a text T. Print all indices of T where P found. The indices of T start with 0.
Constraints
* 1 ≤ length of T ≤ 1000
* 1 ≤ length of P ≤ 1000
* The input consists of alphabetical characters and digits
I... |
### Prompt
Generate a cpp solution to the following problem:
Omkar has a pie tray with k (2 ≤ k ≤ 20) spots. Each spot in the tray contains either a chocolate pie or a pumpkin pie. However, Omkar does not like the way that the pies are currently arranged, and has another ideal arrangement that he would prefer instead... |
### Prompt
Develop a solution in cpp to the problem described below:
This problem consists of three subproblems: for solving subproblem C1 you will receive 4 points, for solving subproblem C2 you will receive 4 points, and for solving subproblem C3 you will receive 8 points.
Manao decided to pursue a fighter's caree... |
### Prompt
In cpp, your task is to solve the following problem:
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 t... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Stick n circular stickers with a radius of 1 on a square origami paper with a side length of 10. The stickers can be stacked. Create a program that reads the coordinates of the position where the stickers are to be attached and outputs the... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Professor GukiZ has two arrays of integers, a and b. Professor wants to make the sum of the elements in the array a sa as close as possible to the sum of the elements in the array b sb. So he wants to minimize the value v = |sa - sb|.
In ... |
### Prompt
Develop a solution in Cpp to the problem described below:
Phoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strings a_1, a_2, ..., a_k such that every letter of s goes to exactly one of the strings a_i. The strings a_i do not... |
### Prompt
Develop a solution in CPP to the problem described below:
Example
Input
4 4
1 2 3
1 3 3
2 3 3
2 4 3
Output
1 3
### Response
```cpp
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb pus... |
### Prompt
Please formulate a CPP solution to the following problem:
Little Alyona is celebrating Happy Birthday! Her mother has an array of n flowers. Each flower has some mood, the mood of i-th flower is ai. The mood can be positive, zero or negative.
Let's define a subarray as a segment of consecutive flowers. Th... |
### Prompt
Develop a solution in cpp to the problem described below:
You have a password which you often type — a string s of length n. Every character of this string is one of the first m lowercase Latin letters.
Since you spend a lot of time typing it, you want to buy a new keyboard.
A keyboard is a permutation o... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that <image>).... |
### Prompt
Develop a solution in CPP to the problem described below:
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
Please create a solution in Cpp to the following problem:
Johnny is at a carnival which has n raffles. Raffle i has a prize with value pi. Each participant can put tickets in whichever raffles they choose (they may have more than one ticket in a single raffle). At the end of the carnival, one ticket is sel... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Abendsen assigned a mission to Juliana. In this mission, Juliana has a rooted tree with n vertices. Vertex number 1 is the root of this tree. Each vertex can be either black or white. At first, all vertices are white. Juliana is asked to process q quer... |
### Prompt
Create a solution in Cpp for the following problem:
A duck hunter is doing his favorite thing, hunting. He lives in a two dimensional world and is located at point (0, 0). As he doesn't like walking for his prey, he prefers to shoot only vertically up (because in this case, the ducks fall straight into his... |
### Prompt
Please provide a CPP coded solution to the problem described below:
People like to be fit. That's why many of them are ready to wake up at dawn, go to the stadium and run. In this problem your task is to help a company design a new stadium.
The city of N has a shabby old stadium. Many people like it and ... |
### Prompt
Your task is to create a Cpp solution to the following problem:
A fraction whose numerator is 1 and whose denominator is a positive integer is called a unit fraction. A representation of a positive rational number p/q as the sum of finitely many unit fractions is called a partition of p/q into unit fractio... |
### Prompt
Generate a cpp solution to the following problem:
Takahashi loves takoyaki - a ball-shaped snack.
With a takoyaki machine, he can make at most X pieces of takoyaki at a time, taking T minutes regardless of the number of pieces to make.
How long does it take to make N takoyaki?
Constraints
* 1 \leq N,X,... |
### Prompt
Develop a solution in CPP to the problem described below:
You are playing a computer card game called Splay the Sire. Currently you are struggling to defeat the final boss of the game.
The boss battle consists of n turns. During each turn, you will get several cards. Each card has two parameters: its cost... |
### Prompt
Develop a solution in cpp to the problem described below:
Sonya was unable to think of a story for this problem, so here comes the formal description.
You are given the array containing n positive integers. At one turn you can pick any element and increase or decrease it by 1. The goal is the make the arr... |
### Prompt
Construct a Cpp code solution to the problem outlined:
problem
President K decided to make a flag for IOI 2016 in Russia. Chairman K first took out the old flag from the warehouse. This flag is divided into squares of N rows and M columns, and each square is painted in one of white, blue, and red.
Chairm... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Taro is a member of a programming contest circle. In this circle, the members manage their schedules in the system called Great Web Calender.
Taro has just added some of his friends to his calendar so that he can browse their schedule on ... |
### Prompt
In cpp, your task is to solve the following problem:
At Akabe High School, which is a programmer training school, the roles of competition programmers in team battles are divided into the following three types.
C: | Coder | I am familiar with the language and code.
--- | --- | ---
A: | Algorithm | I am goo... |
### Prompt
Please provide a CPP coded solution to the problem described below:
Taro is planning a long trip by train during the summer vacation. However, in order for Taro, who is a high school student, to travel as far as possible during the summer vacation, which has only one month, he cannot make a good plan unles... |
### Prompt
In CPP, your task is to solve the following problem:
Today, Wet Shark is given n integers. Using any of these integers no more than once, Wet Shark wants to get maximum possible even (divisible by 2) sum. Please, calculate this value for Wet Shark.
Note, that if Wet Shark uses no integers from the n inte... |
### Prompt
Develop a solution in Cpp to the problem described below:
Alice and Bob play ping-pong with simplified rules.
During the game, the player serving the ball commences a play. The server strikes the ball then the receiver makes a return by hitting the ball back. Thereafter, the server and receiver must alter... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Japanese video game company has developed the music video game called Step Step Evolution. The gameplay of Step Step Evolution is very simple. Players stand on the dance platform, and step on panels on it according to a sequence of arrows show... |
### Prompt
Create a solution in CPP for the following problem:
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 positiv... |
### Prompt
Please create a solution in CPP to the following problem:
Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more.
Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbe... |
### Prompt
In CPP, your task is to solve the following problem:
This problem has nothing to do with Little Chris. It is about hill climbers instead (and Chris definitely isn't one).
There are n hills arranged on a line, each in the form of a vertical line segment with one endpoint on the ground. The hills are number... |
### Prompt
Please formulate a cpp solution to 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... |
### Prompt
Your task is to create a cpp solution to the following problem:
We have a grid with N rows and M columns of squares. Each integer from 1 to NM is written in this grid once. The number written in the square at the i-th row from the top and the j-th column from the left is A_{ij}.
You need to rearrange thes... |
### Prompt
Construct a cpp code solution to the problem outlined:
There are n programmers that you want to split into several non-empty teams. The skill of the i-th programmer is a_i. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the tea... |
### Prompt
Your task is to create a Cpp solution to the following problem:
You are given a tree with N vertices.
Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices.
The i-th edge (1≤i≤N-1) connects Vertices a_i and b_i, and has a ... |
### Prompt
Your task is to create a cpp solution to the following problem:
You are given an undirected graph with n vertices and m edges. You have to write a number on each vertex of this graph, each number should be either 0 or 1. After that, you write a number on each edge equal to the sum of numbers on vertices in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.