text stringlengths 424 69.5k |
|---|
### Prompt
Your task is to create a Cpp solution to the following problem:
You must have heard all about the Foolland on your Geography lessons. Specifically, you must know that federal structure of this country has been the same for many centuries. The country consists of n cities, some pairs of cities are connected... |
### Prompt
Create a solution in Cpp for the following problem:
Mahmoud has an array a consisting of n integers. He asked Ehab to find another array b of the same length such that:
* b is lexicographically greater than or equal to a.
* bi ≥ 2.
* b is pairwise coprime: for every 1 ≤ i < j ≤ n, bi and bj are co... |
### Prompt
Construct a CPP code solution to the problem outlined:
Yaroslav has an array, consisting of (2·n - 1) integers. In a single operation Yaroslav can change the sign of exactly n elements in the array. In other words, in one operation Yaroslav can select exactly n array elements, and multiply each of them by ... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
You are given three integers n, k, m and m conditions (l_1, r_1, x_1), (l_2, r_2, x_2), ..., (l_m, r_m, x_m).
Calculate the number of distinct arrays a, consisting of n integers such that:
* 0 ≤ a_i < 2^k for each 1 ≤ i ≤ n;
* bitw... |
### Prompt
Create a solution in Cpp for the following problem:
Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.
Arpa can perform two types of operations:
* Choose a number and delete it with... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it... |
### Prompt
Generate a Cpp solution to the following problem:
There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i.
There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N:
* If the frog is currently on... |
### Prompt
Your task is to create a Cpp solution to the following problem:
There was a powerful school where powerful people gathered. At the athletic meet of the powerful school, powerful people march in a formation.
While the powerhouses always want to show off their power, most of them don't want to walk on their... |
### Prompt
Your task is to create a cpp solution to the following problem:
There is a light source on the plane. This source is so small that it can be represented as point. The light source is moving from point (a, s_y) to the (b, s_y) (s_y < 0) with speed equal to 1 unit per second. The trajectory of this light sou... |
### Prompt
In CPP, your task is to solve the following problem:
Alice and Bob decided to eat some fruit. In the kitchen they found a large bag of oranges and apples. Alice immediately took an orange for herself, Bob took an apple. To make the process of sharing the remaining fruit more fun, the friends decided to pla... |
### Prompt
In cpp, your task is to solve the following problem:
While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Patrick's personal stuff and found a sequence a1, a2, ..., am of length m, consisting of integers from 1 to n, not necessarily dis... |
### Prompt
Please provide a CPP coded solution to the problem described below:
The phantom thief "Lupin IV" is told by the beautiful "Fujiko Mine", a descendant of the Aizu clan, that the military funds left by the Aizu clan are sleeping in Aizuwakamatsu city. According to a report by Lupine's longtime companion, "Is... |
### Prompt
Please provide a CPP coded solution to the problem described below:
A programming competition site AtCode regularly holds programming contests.
The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200.
The contest after the ABC is called ARC, which is rated for... |
### Prompt
Construct a cpp code solution to the problem outlined:
Given is a string S of length N.
Find the maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping.
More formally, find the maximum positive integer len such that there exist integers l_1 and l_... |
### Prompt
Develop a solution in CPP to the problem described below:
There are n segments [l_i, r_i] for 1 ≤ i ≤ n. You should divide all segments into two non-empty groups in such way that there is no pair of segments from different groups which have at least one common point, or say that it's impossible to do it. E... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
The administration of the Tomsk Region firmly believes that it's time to become a megacity (that is, get population of one million). Instead of improving the demographic situation, they decided to achieve its goal by expanding the boundari... |
### Prompt
In CPP, your task is to solve the following problem:
You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
Constraints
* 0 \leq N_1, N_2, N_3, N_4 \leq 9
* N_1, N_2, N_3 and N_4 are integers.
Input
Input is given from Standard Input in t... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
There is a forest that we model as a plane and live n rare animals. Animal number i has its lair in the point (x_{i}, y_{i}). In order to protect them, a decision to build a nature reserve has been made.
The reserve must have a form of a ... |
### Prompt
Construct a cpp code solution to the problem outlined:
The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good:
* Elements of the main diagonal.
* Elements of the secondary ... |
### Prompt
Develop a solution in Cpp to the problem described below:
On the surface of a newly discovered planet, which we model by a plane, explorers found remains of two different civilizations in various locations. They would like to learn more about those civilizations and to explore the area they need to build r... |
### Prompt
Create a solution in CPP for the following problem:
For given an integer $n$, print all permutations of $\\{1, 2, ..., n\\}$ in lexicographic order.
Constraints
* $1 \leq n \leq 9$
Input
An integer $n$ is given in a line.
Output
Print each permutation in a line in order. Separate adjacency elements b... |
### Prompt
In cpp, your task is to solve the following problem:
In one school with Vasya there is a student Kostya. Kostya does not like physics, he likes different online games. Every day, having come home, Kostya throws his bag in the farthest corner and sits down at his beloved computer. Kostya even eats glued to ... |
### Prompt
Develop a solution in Cpp to the problem described below:
Kostya likes Codeforces contests very much. However, he is very disappointed that his solutions are frequently hacked. That's why he decided to obfuscate (intentionally make less readable) his code before upcoming contest.
To obfuscate the code, Ko... |
### Prompt
Generate a CPP solution to the following problem:
<image>
Some time ago Slastyona the Sweetmaid decided to open her own bakery! She bought required ingredients and a wonder-oven which can bake several types of cakes, and opened the bakery.
Soon the expenses started to overcome the income, so Slastyona de... |
### Prompt
Construct a cpp code solution to the problem outlined:
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 equal ... |
### Prompt
Please create a solution in CPP to the following problem:
Serge, the chef of the famous restaurant "Salt, Pepper & Garlic" is trying to obtain his first Michelin star. He has been informed that a secret expert plans to visit his restaurant this evening.
Even though the expert's name hasn't been disclosed,... |
### Prompt
In cpp, your task is to solve the following problem:
Polycarpus works as a programmer in a start-up social network. His boss gave his a task to develop a mechanism for determining suggested friends. Polycarpus thought much about the task and came to the folowing conclusion.
Let's say that all friendship ... |
### Prompt
Create a solution in Cpp for the following problem:
By 2312 there were n Large Hadron Colliders in the inhabited part of the universe. Each of them corresponded to a single natural number from 1 to n. However, scientists did not know what activating several colliders simultaneously could cause, so the coll... |
### Prompt
Please formulate a Cpp solution to the following problem:
Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya has sequence a consis... |
### Prompt
Construct a cpp code solution to the problem outlined:
Monocarp plays a computer game called "Goblins and Gnomes". In this game, he manages a large underground city of gnomes and defends it from hordes of goblins.
The city consists of n halls and m one-directional tunnels connecting them. The structure of... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
There are N dishes of cuisine placed in front of Takahashi and Aoki. For convenience, we call these dishes Dish 1, Dish 2, ..., Dish N.
When Takahashi eats Dish i, he earns A_i points of happiness; when Aoki eats Dish i, she earns B_i poi... |
### Prompt
Generate a CPP solution to the following problem:
We have N cards. A number a_i is written on the i-th card.
Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.
The game ends when all the cards are taken by the two players, and the scor... |
### Prompt
In cpp, your task is to solve the following problem:
Snuke has a rooted tree with N+1 vertices. The vertices are numbered 0 through N, and Vertex 0 is the root of the tree. The parent of Vertex i (1 \leq i \leq N) is Vertex p_i.
Besides this tree, Snuke also has an box which is initially empty and many ma... |
### Prompt
Please create a solution in cpp to the following problem:
Berland crossword is a puzzle that is solved on a square grid with n rows and n columns. Initially all the cells are white.
To solve the puzzle one has to color some cells on the border of the grid black in such a way that:
* exactly U cells in... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
Once when Gerald studied in the first year at school, his teacher gave the class the following homework. She offered the students a string consisting of n small Latin letters; the task was to learn the way the letters that the string conta... |
### Prompt
Please formulate a cpp solution to the following problem:
One night, having had a hard day at work, Petya saw a nightmare. There was a binary search tree in the dream. But it was not the actual tree that scared Petya. The horrifying thing was that Petya couldn't search for elements in this tree. Petya trie... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Write a program which prints multiplication tables in the following format:
1x1=1
1x2=2
.
.
9x8=72
9x9=81
Input
No input.
Output
1x1=1
1x2=2
.
.
9x8=72
9x9=81
Example
Input
Output
### Response
```cpp
#include<iostream>
u... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
You have received your birthday gifts — n triples of integers! The i-th of them is { a_{i}, b_{i}, c_{i} }. All numbers are greater than or equal to 0, and strictly smaller than 2^{k}, where k is a fixed integer.
One day, you felt tired p... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
As a big fan of Formula One, Charlie is really happy with the fact that he has to organize ticket sells for the next Grand Prix race in his own city. Unfortunately, the finacial crisis is striking everywhere and all the banknotes left in h... |
### Prompt
Please formulate a cpp solution to the following problem:
Consider a table of size n × m, initially fully white. Rows are numbered 1 through n from top to bottom, columns 1 through m from left to right. Some square inside the table with odd side length was painted black. Find the center of this square.
In... |
### Prompt
Your task is to create a CPP solution to the following problem:
D: Sontaku (Surmise)
Some twins like even numbers.
Count how many even numbers are in $ N $ integers $ A_1, A_2, A_3, \ dots, A_N $.
input
The integer $ N $ is given on the first line.
On the second line, $ N $ integers $ A_1, A_2, A_3, \... |
### Prompt
Please formulate a CPP solution to the following problem:
There are X+Y+Z people, conveniently numbered 1 through X+Y+Z. Person i has A_i gold coins, B_i silver coins and C_i bronze coins.
Snuke is thinking of getting gold coins from X of those people, silver coins from Y of the people and bronze coins fr... |
### Prompt
Please create a solution in CPP to the following problem:
Danil decided to earn some money, so he had found a part-time job. The interview have went well, so now he is a light switcher.
Danil works in a rooted tree (undirected connected acyclic graph) with n vertices, vertex 1 is the root of the tree. The... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
T is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly two children). All leaves of a complete binary... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Little Artem is fond of dancing. Most of all dances Artem likes rueda — Cuban dance that is danced by pairs of boys and girls forming a circle and dancing together.
More detailed, there are n pairs of boys and girls standing in a circle. ... |
### Prompt
Your task is to create a Cpp solution to the following problem:
<image>
You can preview the image in better quality by the link: [http://assets.codeforces.com/files/656/without-text.png](//assets.codeforces.com/files/656/without-text.png)
Input
The only line of the input is a string (between 1 and 50 ch... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
There is a cave consisting of N rooms and M one-directional passages. The rooms are numbered 1 through N.
Takahashi is now in Room 1, and Room N has the exit. The i-th passage connects Room s_i and Room t_i (s_i < t_i) and can only be tra... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Example
Input
4
B
W
WB
WB
Output
5
### Response
```cpp
#include <bits/stdc++.h>
using namespace std;
double value[45];
int size[45];
double get_value(string &pile){
bool b_can_move = 0, w_can_move = 0;
double b_max, w_min... |
### Prompt
Develop a solution in CPP to the problem described below:
It is only a few days until Seollal (Korean Lunar New Year), and Jaehyun has invited his family to his garden. There are kids among the guests. To make the gathering more fun for the kids, Jaehyun is going to run a game of hide-and-seek.
The garden... |
### Prompt
Your task is to create a Cpp solution to the following problem:
In Manhattan, roads run where the x or y coordinate is an integer. Both Sunuke-kun's house and Sumeke-kun's house are on the road, and the straight line distance (Euclidean distance) is just d. Find the maximum value that can be considered as ... |
### Prompt
Please create a solution in CPP to the following problem:
Maxim wants to buy some games at the local game shop. There are n games in the shop, the i-th game costs c_i.
Maxim has a wallet which can be represented as an array of integers. His wallet contains m bills, the j-th bill has value a_j.
Games in t... |
### Prompt
Construct a cpp code solution to the problem outlined:
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 followin... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
You are given a string S of length N consisting of `A`, `B` and `C`, and an integer K which is between 1 and N (inclusive). Print the string S after lowercasing the K-th character in it.
Constraints
* 1 ≤ N ≤ 50
* 1 ≤ K ≤ N
* S is a stri... |
### Prompt
Your task is to create a CPP solution to the following problem:
Bob is playing a game named "Walk on Matrix".
In this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}.
To r... |
### Prompt
Construct a CPP code solution to the problem outlined:
There are N Snukes lining up in a row. You are given a string S of length N. The i-th Snuke from the front has two red balls if the i-th character in S is `0`; one red ball and one blue ball if the i-th character in S is `1`; two blue balls if the i-th... |
### Prompt
Develop a solution in Cpp to the problem described below:
Bananistan is a beautiful banana republic. Beautiful women in beautiful dresses. Beautiful statues of beautiful warlords. Beautiful stars in beautiful nights.
In Bananistan people play this crazy game – Bulbo. There’s an array of bulbs and player a... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Professor Vasechkin is studying evolution of worms. Recently he put forward hypotheses that all worms evolve by division. There are n forms of worms. Worms of these forms have lengths a1, a2, ..., an. To prove his theory, professor needs to fi... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Vika has n jars with paints of distinct colors. All the jars are numbered from 1 to n and the i-th jar contains ai liters of paint of color i.
Vika also has an infinitely long rectangular piece of paper of width 1, consisting of squares o... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Recently Luba bought a monitor. Monitor is a rectangular matrix of size n × m. But then she started to notice that some pixels cease to work properly. Luba thinks that the monitor will become broken the first moment when it contains a square k × k cons... |
### Prompt
Generate a Cpp solution to the following problem:
The new PIN is hard to remember. I was told that I shouldn't take notes, but I don't think I can remember them. Therefore, I decided to embed a numerical value in the text and make a note of the PIN. Here, the sum of all the numbers is the PIN.
Create a pr... |
### Prompt
In cpp, your task is to solve the following problem:
Create a program that outputs all leap years between the year a and year b.
The leap year conditions are as follows. However, 0 <a ≤ b <3,000. If there is no leap year in the given period, output "NA".
* The year is divisible by 4.
* However, a year di... |
### Prompt
Please provide a cpp coded solution to the problem described below:
Mr. Takahashi has a string s consisting of lowercase English letters. He repeats the following operation on s exactly K times.
* Choose an arbitrary letter on s and change that letter to the next alphabet. Note that the next letter of `z`... |
### Prompt
Your task is to create a CPP solution to the following problem:
You are given two strings s and t both of length 2 and both consisting only of characters 'a', 'b' and 'c'.
Possible examples of strings s and t: "ab", "ca", "bb".
You have to find a string res consisting of 3n characters, n characters shoul... |
### Prompt
Please create a solution in CPP to the following problem:
After too much playing on paper, Iahub has switched to computer games. The game he plays is called "Block Towers". It is played in a rectangular grid with n rows and m columns (it contains n × m cells). The goal of the game is to build your own city... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distanc... |
### Prompt
Create a solution in CPP for the following problem:
Valentin participates in a show called "Shockers". The rules are quite easy: jury selects one letter which Valentin doesn't know. He should make a small speech, but every time he pronounces a word that contains the selected letter, he receives an electric... |
### Prompt
Your challenge is to write a CPP solution to the following problem:
The last contest held on Johnny's favorite competitive programming platform has been received rather positively. However, Johnny's rating has dropped again! He thinks that the presented tasks are lovely, but don't show the truth about comp... |
### Prompt
Please create a solution in cpp to the following problem:
Sereja is interested in intervals of numbers, so he has prepared a problem about intervals for you. An interval of numbers is a pair of integers [l, r] (1 ≤ l ≤ r ≤ m). Interval [l1, r1] belongs to interval [l2, r2] if the following condition is met... |
### Prompt
Please formulate a cpp solution to the following problem:
You are given array ai of length n. You may consecutively apply two operations to this array:
* remove some subsegment (continuous subsequence) of length m < n and pay for it m·a coins;
* change some elements of the array by at most 1, and pay... |
### Prompt
Construct a CPP code solution to the problem outlined:
Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing 4 points so that the p... |
### Prompt
Generate a Cpp solution to the following problem:
Mad scientist Mike has constructed a rooted tree, which consists of n vertices. Each vertex is a reservoir which can be either empty or filled with water.
The vertices of the tree are numbered from 1 to n with the root at vertex 1. For each vertex, the res... |
### Prompt
Develop a solution in Cpp to the problem described below:
Let's play a traditional game Nim. You and I are seated across a table and we have a hundred stones on the table (we know the number of stones exactly). We play in turn and at each turn, you or I can remove one to four stones from the heap. You play... |
### Prompt
Develop a solution in Cpp to the problem described below:
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 < ai for each i: 0 < i < t.
You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is ... |
### Prompt
Please create a solution in cpp to the following problem:
Input
The first line contains a single integer n (1 ≤ n ≤ 1000) — the number of points on a plane.
Each of the next n lines contains two real coordinates xi and yi of the <image> point, specified with exactly 2 fractional digits. All coordinates... |
### Prompt
Generate a cpp solution to the following problem:
Example
Input
1+2*3+4
11
Output
M
### Response
```cpp
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;... |
### Prompt
Generate a Cpp solution to the following problem:
Problem
N people with IDs from 1 to N are about to sit in N-legged chairs with numbers from 1 to N. The person with ID i wants to sit in the chair pi.
N people are lined up in a row in ascending order of ID, and the first person in the row takes the follo... |
### Prompt
Generate a Cpp solution to the following problem:
Soon a school Olympiad in Informatics will be held in Berland, n schoolchildren will participate there.
At a meeting of the jury of the Olympiad it was decided that each of the n participants, depending on the results, will get a diploma of the first, seco... |
### Prompt
Please create a solution in CPP to the following problem:
Rng is baking cookies.
Initially, he can bake one cookie per second.
He can also eat the cookies baked by himself. When there are x cookies not yet eaten, he can choose to eat all those cookies. After he finishes eating those cookies, the number o... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
An English booklet has been created for publicizing Aizu to the world. When you read it carefully, you found a misnomer (an error in writing) on the last name of Masayuki Hoshina, the lord of the Aizu domain. The booklet says "Hoshino" not... |
### Prompt
Please formulate a cpp solution to the following problem:
A positive integer number n is written on a blackboard. It consists of not more than 105 digits. You have to transform it into a beautiful number by erasing some of the digits, and you want to erase as few digits as possible.
The number is called b... |
### Prompt
In Cpp, your task is to solve the following problem:
There are n students living in the campus. Every morning all students wake up at the same time and go to wash. There are m rooms with wash basins. The i-th of these rooms contains ai wash basins. Every student independently select one the rooms with equa... |
### Prompt
Create a solution in cpp for the following problem:
Kitahara Haruki has bought n apples for Touma Kazusa and Ogiso Setsuna. Now he wants to divide all the apples between the friends.
Each apple weights 100 grams or 200 grams. Of course Kitahara Haruki doesn't want to offend any of his friend. Therefore th... |
### Prompt
In cpp, your task is to solve the following problem:
Little X and Little Z are good friends. They always chat online. But both of them have schedules.
Little Z has fixed schedule. He always online at any moment of time between a1 and b1, between a2 and b2, ..., between ap and bp (all borders inclusive). B... |
### Prompt
Create a solution in CPP for the following problem:
There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, …, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 ≤ i_1 < i_2 < ... |
### Prompt
Please formulate 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 stra... |
### Prompt
Please create a solution in CPP to the following problem:
You are given an array a consisting of n non-negative integers. You have to choose a non-negative integer x and form a new array b of size n according to the following rule: for all i from 1 to n, b_i = a_i ⊕ x (⊕ denotes the operation [bitwise XOR]... |
### Prompt
Please provide a Cpp coded solution to the problem described below:
Nick likes strings very much, he likes to rotate them, sort them, rearrange characters within a string... Once he wrote a random string of characters a, b, c on a piece of paper and began to perform the following operations:
* to take ... |
### Prompt
Generate a Cpp solution to the following problem:
One day Vasya painted a Cartesian coordinate system on a piece of paper and marked some set of points (x1, y1), (x2, y2), ..., (xn, yn). Let's define neighbors for some fixed point from the given set (x, y):
* point (x', y') is (x, y)'s right neighbor, ... |
### Prompt
Please create a solution in Cpp to the following problem:
This is an interactive problem.
Imur Ishakov decided to organize a club for people who love to play the famous game «The hat». The club was visited by n students, where n is even. Imur arranged them all in a circle and held a draw to break the stud... |
### Prompt
Your challenge is to write a Cpp solution to the following problem:
Bran and his older sister Arya are from the same house. Bran like candies so much, so Arya is going to give him some Candies.
At first, Arya and Bran have 0 Candies. There are n days, at the i-th day, Arya finds ai candies in a box, that ... |
### Prompt
Please create a solution in CPP to the following problem:
The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...
Given is a string S representing the weather in the town today. Predict the weather tomorrow.
Constraints
* S is `Sunny`, ... |
### Prompt
Please provide a cpp coded solution to the problem described below:
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... |
### Prompt
Your task is to create a Cpp solution to the following problem:
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?
Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each ... |
### Prompt
Your challenge is to write a cpp solution to the following problem:
Consider a tree T (that is, a connected graph without cycles) with n vertices labelled 1 through n. We start the following process with T: while T has more than one vertex, do the following:
* choose a random edge of T equiprobably;
*... |
### Prompt
Please create a solution in cpp to the following problem:
For each positive integer n consider the integer ψ(n) which is obtained from n by replacing every digit a in the decimal notation of n with the digit (9 - a). We say that ψ(n) is the reflection of n. For example, reflection of 192 equals 807. Note t... |
### Prompt
Create a solution in Cpp for the following problem:
Bessie the cow and her best friend Elsie each received a sliding puzzle on Pi Day. Their puzzles consist of a 2 × 2 grid and three tiles labeled 'A', 'B', and 'C'. The three tiles sit on top of the grid, leaving one grid cell empty. To make a move, Bessie... |
### Prompt
Construct a Cpp code solution to the problem outlined:
Igor K. always used to trust his favorite Kashpirovsky Antivirus. That is why he didn't hesitate to download the link one of his groupmates sent him via QIP Infinium. The link was said to contain "some real funny stuff about swine influenza". The antiv... |
### Prompt
Construct a Cpp code solution to the problem outlined:
The map of Bertown can be represented as a set of n intersections, numbered from 1 to n and connected by m one-way roads. It is possible to move along the roads from any intersection to any other intersection. The length of some path from one intersect... |
### Prompt
Construct a CPP code solution to the problem outlined:
There are n cows playing poker at a table. For the current betting phase, each player's status is either "ALLIN", "IN", or "FOLDED", and does not change throughout the phase. To increase the suspense, a player whose current status is not "FOLDED" may s... |
### Prompt
Please formulate a cpp solution to the following problem:
G: Donuts Orientation
story
Homu-chan's recent boom is making sweets. It seems that he makes a lot of sweets and shares them with his friends. Homu-chan seems to be trying to make donuts this time.
There are many important things in making donuts... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.